@kybernesis/create 0.21.0 → 0.22.0

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/dist/doctor.js CHANGED
@@ -61,6 +61,8 @@ function modelReachCheck(reach) {
61
61
  return { verdict: "pass", label: "Model reach: exe (host LLM integration)" };
62
62
  case "grok-sub":
63
63
  return { verdict: "pass", label: "Model reach: grok-sub (direct xAI subscription credential)" };
64
+ case "chatgpt-sub":
65
+ return { verdict: "pass", label: "Model reach: chatgpt-sub (ChatGPT subscription through Codex)" };
64
66
  case "gateway":
65
67
  return { verdict: "pass", label: "Model reach: gateway" };
66
68
  case "direct-provider":
@@ -21,6 +21,8 @@ export type DoctorModelReach = {
21
21
  kind: "exe";
22
22
  } | {
23
23
  kind: "grok-sub";
24
+ } | {
25
+ kind: "chatgpt-sub";
24
26
  } | {
25
27
  kind: "gateway";
26
28
  } | {
@@ -1,3 +1,6 @@
1
+ import { existsSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
1
4
  export const MODEL_REACH_ENV = "KYB_MODEL_REACH";
2
5
  export const CLAUDE_SUBSCRIPTION_MODEL = "claude-opus-5";
3
6
  /** Resolve the one-shot scaffold selector. An explicit CLI value wins over Factory env. */
@@ -36,7 +39,7 @@ export function resolveModelScaffold(options) {
36
39
  export function switchedModelReach(source, env) {
37
40
  if (!/\bexeModelReach\s*\(/.test(source))
38
41
  return null;
39
- const authored = /\breach\s*:\s*["'](gateway|byok|claude-sub)["']/.exec(source)?.[1];
42
+ const authored = /\breach\s*:\s*["'](gateway|byok|claude-sub|grok-sub|chatgpt-sub)["']/.exec(source)?.[1];
40
43
  if (!authored)
41
44
  return { kind: "unresolved", reason: "exeModelReach has no literal default reach to read" };
42
45
  const model = env.EXE_MODEL ?? /\bmodel\s*:\s*["']([^"']+)["']/.exec(source)?.[1] ?? "";
@@ -45,6 +48,18 @@ export function switchedModelReach(source, env) {
45
48
  return { kind: "exe" };
46
49
  if (reach === "claude-sub")
47
50
  return { kind: "claude-sub" };
51
+ // Runs only once `grok login` has left a credential; the agent falls back otherwise.
52
+ if (reach === "grok-sub") {
53
+ const auth = env.GROK_AUTH_PATH?.trim() || join(homedir(), ".grok", "auth.json");
54
+ return existsSync(auth) ? { kind: "grok-sub" } : null;
55
+ }
56
+ // Needs eve's chatgpt passed in, and a Codex sign-in on the host.
57
+ if (reach === "chatgpt-sub") {
58
+ if (!/\bchatgpt\s*[,}]/.test(source))
59
+ return null;
60
+ const auth = join(env.CODEX_HOME?.trim() || join(homedir(), ".codex"), "auth.json");
61
+ return existsSync(auth) ? { kind: "chatgpt-sub" } : null;
62
+ }
48
63
  if (reach !== "byok")
49
64
  return null;
50
65
  const provider = /^(anthropic|openai)\//.exec(model)?.[1];
package/dist/templates.js CHANGED
@@ -425,9 +425,10 @@ function agentModelTemplate(host, config) {
425
425
  throw new Error("claude-sub model templates require an exe host");
426
426
  if (host === "exe") {
427
427
  /**
428
- * Every exe agent takes the runtime switch: KYB_MODEL_REACH (gateway, byok
429
- * or claude-sub) picks the route at boot, so the setup route can change it
430
- * by writing env. `reach` here is what runs while it is unset, which is
428
+ * Every exe agent takes the runtime switch: KYB_MODEL_REACH (gateway, byok,
429
+ * claude-sub, grok-sub or chatgpt-sub) picks the route at boot, so the
430
+ * setup route can change it by writing env. `chatgpt` is passed so the
431
+ * ChatGPT subscription is one of those routes; nothing calls it until then. `reach` here is what runs while it is unset, which is
431
432
  * exactly what this scaffold used to hard-code.
432
433
  *
433
434
  * The subscription scaffold still names a gateway id, used only if the
@@ -439,8 +440,9 @@ function agentModelTemplate(host, config) {
439
440
  return {
440
441
  imports: `import { createAnthropic } from "@ai-sdk/anthropic";\n` +
441
442
  `import { createOpenAI } from "@ai-sdk/openai";\n` +
443
+ `import { chatgpt } from "eve/models/openai";\n` +
442
444
  `import { exeModelReach } from "@kybernesis/exe";\n\n`,
443
- fields: ` ...exeModelReach({ ${defaults}, createOpenAI, createAnthropic }),\n`,
445
+ fields: ` ...exeModelReach({ ${defaults}, createOpenAI, createAnthropic, chatgpt }),\n`,
444
446
  };
445
447
  }
446
448
  return { imports: "", fields: ` model: ${JSON.stringify(config.model)},\n` };
@@ -452,7 +454,7 @@ export function hostAgentTs(host, model) {
452
454
  : (model.reach === "claude-sub"
453
455
  ? `// By default a Claude subscription through the loopback OAuth proxy — no API key or exe gateway.\n`
454
456
  : `// By default the exe.dev LLM integration — no provider key on the host; exe\n// injects the credential (managed gateway, your API key, or a connected\n// ChatGPT subscription) server-side.\n`) +
455
- `// KYB_MODEL_REACH (gateway | byok | claude-sub) switches the route at boot\n// without editing this file; EXE_MODEL names the gateway or BYOK model.\n`;
457
+ `// KYB_MODEL_REACH (gateway | byok | claude-sub | grok-sub | chatgpt-sub) switches the route at boot\n// without editing this file; EXE_MODEL names the gateway or BYOK model.\n`;
456
458
  return `import { defineAgent } from "eve";
457
459
  ${rendered.imports}${comment}export default defineAgent({
458
460
  ${rendered.fields}${host === "exe" ? ` // This long-lived self-hosted process has no metered platform session ceiling.\n limits: { maxInputTokensPerSession: false },\n` : ""}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/create",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "The Kybernesis agent scaffolder and FDE toolkit: one command to a governed, remembering, multiplayer, self-testing eve agent \u2014 plus doctor and upgrade.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -90,8 +90,8 @@ then `eve add @kybernesis/<item>`). Each covers one axis:
90
90
  `POST .../setup/env`, `POST .../setup/action`): a `manage` grant only;
91
91
  allowlisted env (`EXE_MODEL`, `EXE_LLM_URL`, `ANTHROPIC_API_KEY`,
92
92
  `OPENAI_API_KEY`, `SLACK_BOT_TOKEN`, `SLACK_SIGNING_SECRET`) and the actions
93
- `claude.login` (link, then the code on stdin), `linq.signup`/`linq.verify`,
94
- `link.login` and `vnc.password`. Every change applies at one restart that
93
+ `claude.login` (link, then the code on stdin), `linq.signup`/`linq.verify`, `linq.contacts`/`linq.contact.add`/`linq.contact.remove` (who can text a shared line, 0.15),
94
+ `link.login`/`link.logout`, `wallet.add` (0.16: adds the payments item to an agent with a computer, rebuilds, rolls back on a failed build, restarts only after a good one) and `vnc.password`. Every change applies at one restart that
95
95
  waits until no conversation is in flight (deploy.sh's count). A BYOK key only
96
96
  takes effect when `agent/agent.ts` uses that provider; status says so.
97
97
  Since 0.12 it also takes `KYB_MODEL_REACH` (`gateway`, `byok`,