@kidsinai/kids-client 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/env.ts +7 -4
- package/src/core/setup.ts +21 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@kidsinai/kids-client",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Own-client TUI for Kids OpenCode — talks to local `opencode serve` via @opencode-ai/sdk v2 with kid-warm rendering, mission progress, permission dialog, and stderr-tail audit pipeline.",
|
|
7
7
|
"license": "MIT",
|
package/src/core/env.ts
CHANGED
|
@@ -60,14 +60,17 @@ export function validateEnv(env: KidsClientEnv): { ok: true } | { ok: false; rea
|
|
|
60
60
|
}
|
|
61
61
|
// Accept any supported provider's API key, not just DeepRouter. The
|
|
62
62
|
// setup wizard writes whatever the parent picked into ~/.config/kids-opencode/env
|
|
63
|
-
// which the wrapper sources before exec.
|
|
64
|
-
//
|
|
65
|
-
//
|
|
63
|
+
// which the wrapper sources before exec.
|
|
64
|
+
//
|
|
65
|
+
// KIDS_OAUTH_PROVIDER was previously trusted as a credential signal —
|
|
66
|
+
// that was wrong: upstream opencode dropped Anthropic Pro/Max OAuth in
|
|
67
|
+
// 1.3.0, so the marker existed without a real credential and opencode
|
|
68
|
+
// silently fell back to its own api-key picker. Users now get re-routed
|
|
69
|
+
// through SetupScreen until they paste an actual API key.
|
|
66
70
|
const hasAnyKey =
|
|
67
71
|
env.deeprouterApiKey
|
|
68
72
|
|| process.env.ANTHROPIC_API_KEY
|
|
69
73
|
|| process.env.OPENAI_API_KEY
|
|
70
|
-
|| process.env.KIDS_OAUTH_PROVIDER
|
|
71
74
|
if (!env.bypassGateway && !hasAnyKey) {
|
|
72
75
|
return {
|
|
73
76
|
ok: false,
|
package/src/core/setup.ts
CHANGED
|
@@ -24,8 +24,23 @@ export type ProviderId = "anthropic" | "openai" | "deeprouter"
|
|
|
24
24
|
*/
|
|
25
25
|
export const OAUTH_HANDOFF_EXIT_CODE = 123
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Providers for which upstream opencode currently ships an OAuth/subscription
|
|
29
|
+
* login method. Anthropic Pro/Max was REMOVED in opencode 1.3.0 — Anthropic's
|
|
30
|
+
* ToS prohibits using consumer Claude Pro/Max subscriptions through coding
|
|
31
|
+
* agents like opencode. See:
|
|
32
|
+
* ~/Documents/sites/kidsinai/opencode-kernel/packages/web/src/content/docs/providers.mdx
|
|
33
|
+
*
|
|
34
|
+
* OpenAI ChatGPT Plus IS supported by upstream and is the obvious next
|
|
35
|
+
* candidate to wire here — but until that's done, no provider triggers the
|
|
36
|
+
* auth_choice step and every kid lands directly on the api-key screen.
|
|
37
|
+
*
|
|
38
|
+
* The OAuth handoff infrastructure below (OAUTH_HANDOFF_EXIT_CODE,
|
|
39
|
+
* saveSetupOauth, the wrapper's exit-123 loop, the auth_choice screen) is
|
|
40
|
+
* intentionally kept inert rather than deleted — flipping OPENAI back on
|
|
41
|
+
* here when ChatGPT Plus is wired is a one-line revival.
|
|
42
|
+
*/
|
|
43
|
+
export const OAUTH_PROVIDERS: ReadonlyArray<ProviderId> = [] as const
|
|
29
44
|
|
|
30
45
|
export interface ProviderChoice {
|
|
31
46
|
id: ProviderId
|
|
@@ -173,16 +188,16 @@ function writeOpencodeConfig(
|
|
|
173
188
|
export function hasAnyProviderKey(configDir: string): boolean {
|
|
174
189
|
const env = readEnvFile(join(configDir, "env"))
|
|
175
190
|
if (env.ANTHROPIC_API_KEY || env.OPENAI_API_KEY || env.DEEPROUTER_API_KEY) return true
|
|
176
|
-
// OAuth handoff completed earlier? The marker means opencode has its own
|
|
177
|
-
// auth.json credentials; opencode itself will gate on actual token validity.
|
|
178
|
-
if (env.KIDS_OAUTH_PROVIDER) return true
|
|
179
191
|
// Also accept keys present in the parent shell env (advanced users).
|
|
180
192
|
return !!(
|
|
181
193
|
process.env.ANTHROPIC_API_KEY
|
|
182
194
|
|| process.env.OPENAI_API_KEY
|
|
183
195
|
|| process.env.DEEPROUTER_API_KEY
|
|
184
|
-
|| process.env.KIDS_OAUTH_PROVIDER
|
|
185
196
|
)
|
|
197
|
+
// Note: KIDS_OAUTH_PROVIDER marker is intentionally NOT accepted anymore.
|
|
198
|
+
// Users who got stuck with the marker but no actual OAuth credential
|
|
199
|
+
// (because opencode never had an Anthropic Pro/Max method to begin with)
|
|
200
|
+
// will be routed back through SetupScreen to pick an API-key flow.
|
|
186
201
|
}
|
|
187
202
|
|
|
188
203
|
/** Crude check of API key shape — refuses obvious typos. */
|