@kybernesis/create 0.11.0 → 0.12.1

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
@@ -367,9 +367,23 @@ export async function doctor() {
367
367
  }
368
368
  }
369
369
  // ── eve discovery + local port ─────────────────────────────────────────
370
- const info = capture("npx", ["eve", "info"], cwd);
371
- if (info === null)
372
- add("fail", "eve info failed", "run npx eve info for details");
370
+ /**
371
+ * Discovery, run with the environment the SERVER runs with.
372
+ *
373
+ * `eve info` compiles the agent, and an agent that reads a variable at module
374
+ * scope — a model id, a required credential — throws without it. eve does not
375
+ * load .env.local itself, so running this with a bare environment reported a
376
+ * healthy agent as a failed discovery, on a host where the service starts it
377
+ * correctly every time. That red is the one thing a person is told must be
378
+ * green before going further, so it stopped a deployment that was fine.
379
+ *
380
+ * `env` here is the same merged view every other check reads: .env.local
381
+ * underneath, the real environment on top.
382
+ */
383
+ const info = capture("npx", ["eve", "info"], cwd, env);
384
+ if (info === null) {
385
+ add("fail", "eve info failed", "run: set -a && . ./.env.local && set +a && npx eve info — the agent's own error is in that output");
386
+ }
373
387
  else {
374
388
  const diag = /Diagnostics\s+(\d+) errors?, (\d+) warnings?/.exec(info);
375
389
  if (diag && diag[1] === "0")
package/dist/init.js CHANGED
@@ -209,6 +209,30 @@ export async function init(rawName, options = {}) {
209
209
  catch {
210
210
  console.log(yellow(" ! could not install scripts/eve-server.sh — copy it from node_modules/@kybernesis/exe/scripts/"));
211
211
  }
212
+ /**
213
+ * The Claude subscription, as a script rather than a procedure.
214
+ *
215
+ * Same reasoning as the restart script above, and the same history: the
216
+ * provider (`claudeSubscription()`) was generalised into @kybernesis/exe
217
+ * after the first agent used it, but STANDING THE PROXY UP stayed a thing
218
+ * someone did by hand on one VM. So the capability was in every agent's
219
+ * packages while the only written procedure was a patch README telling the
220
+ * next person to clone a third-party repository — which is how a client
221
+ * ends up being walked through a git checkout by their consultant.
222
+ *
223
+ * Installed unconditionally for an exe host: it costs one file, and the
224
+ * alternative is rediscovering the procedure per deployment.
225
+ */
226
+ try {
227
+ const proxySource = join(dir, "node_modules/@kybernesis/exe/scripts/claude-subscription.sh");
228
+ const proxyTarget = join(dir, "scripts/claude-subscription.sh");
229
+ copyFileSync(proxySource, proxyTarget);
230
+ chmodSync(proxyTarget, 0o755);
231
+ console.log(dim(" scripts/claude-subscription.sh — put this agent on a Claude subscription, no API key"));
232
+ }
233
+ catch {
234
+ console.log(yellow(" ! could not install scripts/claude-subscription.sh — copy it from node_modules/@kybernesis/exe/scripts/"));
235
+ }
212
236
  /**
213
237
  * Point the management routes at that script.
214
238
  *
package/dist/util.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare function run(command: string, args: string[], options?: {
11
11
  allowFail?: boolean;
12
12
  quiet?: boolean;
13
13
  }): boolean;
14
- export declare function capture(command: string, args: string[], cwd?: string): string | null;
14
+ export declare function capture(command: string, args: string[], cwd?: string, extraEnv?: Record<string, string>): string | null;
15
15
  export declare function ask(question: string, fallback: string): Promise<string>;
16
16
  export declare function closePrompts(): void;
17
17
  /** Parse KEY="value" / KEY=value lines from an env file's contents. */
package/dist/util.js CHANGED
@@ -24,8 +24,12 @@ export function run(command, args, options) {
24
24
  }
25
25
  return ok;
26
26
  }
27
- export function capture(command, args, cwd) {
28
- const result = spawnSync(command, args, { cwd, encoding: "utf8", env: process.env });
27
+ export function capture(command, args, cwd, extraEnv) {
28
+ const result = spawnSync(command, args, {
29
+ cwd,
30
+ encoding: "utf8",
31
+ env: extraEnv ? { ...process.env, ...extraEnv } : process.env,
32
+ });
29
33
  return result.status === 0 ? result.stdout : null;
30
34
  }
31
35
  let rl = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/create",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "The Kybernesis agent scaffolder and FDE toolkit: one command to a governed, remembering, multiplayer, self-testing eve agent — plus doctor and upgrade.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1968,6 +1968,53 @@ nowhere in its context. Verify from the host — the configured model id and the
1968
1968
  credential in use — never by asking the agent. Expect a client to ask it in a
1969
1969
  demo, and have the real answer ready.
1970
1970
 
1971
+ **Claude, on a Claude Max / Pro / Claude Code subscription.** The one that is
1972
+ a process rather than a file. Anthropic's billing validator accepts an OAuth
1973
+ bearer *instead of* an API key, and that bearer expires — so something has to
1974
+ own the refresh. A small proxy holds Claude Code's own credentials, refreshes
1975
+ them, and swaps them in; the agent speaks ordinary Anthropic API to loopback and
1976
+ never holds a long-lived secret.
1977
+
1978
+ ```bash
1979
+ # on the host, installed by kyb init for an exe host
1980
+ bash scripts/claude-subscription.sh up
1981
+ bash scripts/claude-subscription.sh login # "Sign in with Claude", never an API key
1982
+ bash scripts/claude-subscription.sh status # signed in? bound to loopback?
1983
+ ```
1984
+
1985
+ ```ts title="agent/agent.ts"
1986
+ import { createAnthropic } from "@ai-sdk/anthropic";
1987
+ import { claudeSubscription, CLAUDE_SUBSCRIPTION_CONTEXT_WINDOW } from "@kybernesis/exe";
1988
+
1989
+ export default defineAgent({
1990
+ model: claudeSubscription({ model: "claude-opus-5", createAnthropic }),
1991
+ modelContextWindowTokens: CLAUDE_SUBSCRIPTION_CONTEXT_WINDOW,
1992
+ });
1993
+ ```
1994
+
1995
+ Four things to know before you promise it:
1996
+
1997
+ - **The exe LLM integration also serves `anthropic/*` ids, and that is NOT this.**
1998
+ It reaches Anthropic through a gateway, which bills metered usage. Same model,
1999
+ entirely different invoice. If the point is that the client pays nothing
2000
+ incremental, it has to be the proxy.
2001
+ - **If the agent searches the web, build the patched image** —
2002
+ `scripts/claude-subscription.sh build-patched`. The published proxy renames
2003
+ provider-defined tools, which Anthropic validates by name, and the failure
2004
+ (`tools.N.web_search_20250305.name: Input should be 'web_search'`) reads like
2005
+ a bug in the agent's own tool definitions.
2006
+ - **The sign-in is per host and interactive** — a browser step, once, in the
2007
+ container. It survives restarts because it lives in a named volume, but a new
2008
+ VM needs its own.
2009
+ - **It is a process to keep alive.** If the container stops, every turn fails
2010
+ with a connection error from inside the model SDK, which reads like the model
2011
+ being down. `hostPreflight({ claudeProxyUrl })` asks about it at boot; the
2012
+ restart policy keeps it up.
2013
+
2014
+ Scope it honestly with the client: this is their own subscription, on their own
2015
+ infrastructure, for their own agent. It is not a shared gateway or a resale of
2016
+ Anthropic access, and it should not be built as one.
2017
+
1971
2018
  ### 11.5 Third-party APIs: broker the credential, pin the version
1972
2019
 
1973
2020
  Do not put a client's API token on the agent host. Put it in an exe.dev