Files
ppq-private-mode-startos/startos/actions/configureApiKey.ts
T
helix-bandClaude Opus 5.5 5603a42be0 chore: move to start-sdk 3.0.3; 0.4.1:0 → 0.4.1:1
- pin @start9labs/start-sdk 3.0.3, regenerate the lock, drop the
  toolchain devDependencies and scripts the SDK supplies, point
  .prettierrc at the SDK's shared config
- file models use z.looseObject
- empty sdk.Dependencies builder passed to buildManifest and setupInit;
  drop the manifest dependencies field
- sync workflows to the package template on main (ready_for_review,
  pr-retarget.yml)
- Verbose Logging's description says what it logs
- resync AGENTS.md boilerplate and trim its repo notes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 15:21:42 -06:00

65 lines
1.9 KiB
TypeScript

import { sdk } from '../sdk'
import { configJson } from '../fileModels/config.json'
import { storeJson } from '../fileModels/store.json'
import { i18n } from '../i18n'
const { InputSpec, Value } = sdk
const inputSpec = InputSpec.of({
apiKey: Value.text({
name: i18n('PPQ.AI API Key'),
description: i18n(
'Your API key from ppq.ai (Settings → API Keys). Leave blank to keep the key already saved, or to set one later from the Status Page.',
),
required: false,
default: null,
masked: true,
placeholder: 'sk-...',
// Upstream's own shape check, applied here too — the Status Page rejects a
// malformed key outright, but a key written straight to config.json would
// only surface as a 401 on the first request.
patterns: [
{
regex: '^sk-[A-Za-z0-9]{16,64}$',
description: i18n('A PPQ.AI key starts with "sk-".'),
},
],
}),
debug: Value.toggle({
name: i18n('Verbose Logging'),
description: i18n(
'Adds a log line naming the model for each chat request, and logs errors that cut off a streamed reply. Prompts and replies are never logged.',
),
default: false,
}),
})
export const configureApiKey = sdk.Action.withInput(
'configure-api-key',
async ({ effects }) => ({
name: i18n('Configure PPQ API Key'),
description: i18n(
'Set the PPQ.AI API key the proxy uses to authenticate. Requests are billed to this key.',
),
warning: null,
allowedStatuses: 'any',
group: null,
visibility: 'enabled',
}),
inputSpec,
// Prefill: the API key is never echoed back into the form.
async ({ effects }) => ({
debug: (await storeJson.read((s) => s.debug).once()) ?? false,
}),
async ({ effects, input }) => {
await storeJson.merge(effects, { debug: input.debug })
const apiKey = (input.apiKey ?? '').trim()
if (apiKey) await configJson.merge(effects, { apiKey })
},
)