Files
ppq-private-mode-startos/startos/actions/configureApiKey.ts
T
helix-nine 42b2841945 bump upstream to 0.4.1, add the status page UI, fix CI branch triggers
Community-registry audit ahead of listing.

Upstream 0.4.1 renames the model catalog (private/kimi-k2-6 →
private/kimi-k3, drops qwen3-vl-30b) and serves a status page at GET /,
so the package was documenting a stale model list and hiding a whole
surface. Export that page as a `ui` interface alongside the existing
`api` on one host, and unmask the API interface — its URL carries no
credentials, so masking hid the address for nothing.

PPQ_DATA_DIR stays unset deliberately. With it set, upstream persists a
browser-entered key to its own config.json while the StartOS-supplied
PPQ_API_KEY still wins at every restart, silently reverting the user.
StartOS owns the key via the action; the status page's form renders
disabled.

CI never ran: build.yml's PR target and tagAndRelease.yml's push
trigger both named `master` on a repo whose only branch is `main`.
Point them at `main` and reset all three workflows to the package
template, dropping the guard job retired in start-technologies@ed0dca2.

packageRepo now names the Start9-Community fork, which is where CI
runs, where the org's registry variables live, and where releases are
cut.

Also: drop three .catch handlers on file-model reads, which swallowed a
genuine read failure into "no key configured" — readOnce already
returns null for a missing file; pass null rather than an empty Mounts
for the unmounted subcontainer; inline two single-use interface consts;
and rewrite README/instructions against the writing guides, fixing a
YAML block that claimed a /data mount the package deliberately does not
make.
2026-08-12 09:58:35 -06:00

63 lines
1.6 KiB
TypeScript

import { sdk } from '../sdk'
import { configJson } from '../fileModels/config.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.',
),
required: false,
default: null,
masked: true,
placeholder: 'sk-...',
}),
debug: Value.toggle({
name: i18n('Verbose Logging'),
description: i18n(
'Log every request the proxy handles. Useful for troubleshooting.',
),
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 configJson.read((c) => c.debug).once()) ?? false,
}),
async ({ effects, input }) => {
const apiKey =
(input.apiKey ?? '').trim() ||
(await configJson.read((c) => c.apiKey).once())
if (!apiKey) {
throw new Error(
i18n(
'An API key is required. Create one at ppq.ai under Settings → API Keys.',
),
)
}
await configJson.merge(effects, { apiKey, debug: input.debug })
},
)