Files
recap/startos/actions/setApiKey.ts
T
Keysat 574a16d9fa Save in-progress keysat integration and StartOS 0.4 work
Snapshot of the working tree before cleanup. Captures:
- Keysat licensing: server/license.js, /api/license/* endpoints in
  server/index.js, activation modal in public/index.html, embedded
  Ed25519 issuer key (assets/issuer.pub).
- StartOS 0.4 expansion: setApiKey action, version files v0.1.1
  through v0.1.15, file-models/config.json.ts, manifest updates.
- Self-hosted registry server (startos-registry/).
- Build/deploy scripts (bin/bump-version.sh, bin/deploy.sh, vendored
  yt-dlp binary), .gitignore, .deploy.env.example.
- Recent design docs (KEYSAT_INTEGRATION.md, UPGRADE-DESIGN.md) —
  retained here so they remain recoverable when removed in the
  follow-up cleanup commit.
2026-05-08 09:39:17 -05:00

44 lines
1.0 KiB
TypeScript

import { sdk } from '../sdk'
import { configFile } from '../file-models/config.json'
const { InputSpec, Value } = sdk
const inputSpec = InputSpec.of({
gemini_api_key: Value.text({
name: 'Gemini API Key',
description:
'Your Google Gemini API key. Get a free key at aistudio.google.com/apikey',
required: true,
default: null,
masked: true,
minLength: 1,
maxLength: 256,
}),
})
export const setApiKey = sdk.Action.withInput(
'set-api-key',
async ({ effects }) => ({
name: 'Set Gemini API Key',
description:
'Configure your Google Gemini API key for transcription and analysis',
warning: null,
allowedStatuses: 'any',
group: null,
visibility: 'enabled',
}),
inputSpec,
async ({ effects }) => {
const config = await configFile.read().once()
return { gemini_api_key: config?.gemini_api_key || undefined }
},
async ({ effects, input }) => {
await configFile.merge(effects, { gemini_api_key: input.gemini_api_key })
return null
},
)