@kodycodes/cli 1.13.2 → 1.14.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/README.md CHANGED
@@ -186,12 +186,13 @@ npx @kodycodes/cli execute --local --file ./task.js --params '{"to":"me@example.
186
186
  `kody_at_…` token in that case.
187
187
  - **Node.js:** 22 or newer (`package.json` `engines` is `>=22`). Older Node
188
188
  fails immediately with that requirement, before workerd is downloaded or
189
- started. Stripping `.ts` / `.mts` / `.cts` files needs Node.js 22.13 or
190
- newer (`module.stripTypeScriptTypes`).
191
- - **TypeScript:** `--file` paths ending in `.ts`, `.mts`, or `.cts` are
192
- type-stripped before workerd loads `main.js`. `--code`, stdin (`--file -`),
193
- and `.js` files are left as written. Syntax that type erasure cannot remove
194
- (such as `enum`) fails with that strip error.
189
+ started.
190
+ - **Bundling:** `--file` entries are bundled with esbuild before workerd
191
+ loads `main.js` (relative local imports and bare npm packages from
192
+ `node_modules`; `kody:*` stays external for package-graph / runtime). That
193
+ matches hosted execute and publish. Unresolvable imports fail with a clear
194
+ bundle error before any network call. `--code` and stdin (`--file -`) are
195
+ left as written (no filesystem graph to follow).
195
196
  - **Runtime:** a pinned [workerd](https://github.com/cloudflare/workerd)
196
197
  release, downloaded once from GitHub, sha256-verified, and cached under
197
198
  `~/.cache/kody` (Linux, or `$XDG_CACHE_HOME/kody`) or
@@ -254,6 +255,15 @@ Access tokens refresh automatically on expiry or HTTP 401.
254
255
  uses stored CLI credentials from `kody login`. Token-only cloud execute still
255
256
  only reads `--token` / `KODY_API_TOKEN`.
256
257
 
258
+ ## Benchmark
259
+
260
+ `npm run build && npm run bench` times the built CLI (startup, `status`, and
261
+ `execute --local` against a loopback stand-in for api.kody.codes) over 20 runs
262
+ and prints p50/p95. The `bench` workflow runs it on every pull request and
263
+ weekly, failing when a scenario's p50 exceeds the budget in
264
+ `scripts/bench-budgets.json` (milliseconds over the bare Node startup of the
265
+ same run).
266
+
257
267
  ## Releases
258
268
 
259
269
  This repo uses [semantic-release](https://github.com/semantic-release/semantic-release)
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sandbox source for credential()/credentials() on the local kody:runtime host.
3
+ * Kept in sync with kentcdodds/kody `createCredentialClientRuntimeSource`
4
+ * (packages/worker/src/mcp/execute-modules/credential-client-source.ts).
5
+ * Client fetches carry only `x-kody-credential-client`; origin's fetch gateway
6
+ * places the credential. Secret values never enter local workerd.
7
+ */
8
+ export declare const credentialClientRuntimeSource = "function __kodyCreateCredentialRuntime(__kodyCredentialCall) {\n const handleHeader = \"x-kody-credential-client\";\n const codePattern = /^\\[([a-z_]+)\\] /;\n const redirectStatuses = new Set([301, 302, 303, 307, 308]);\n const maxRedirects = 20;\n const toError = (body) => {\n const error = new Error(String(body?.message ?? 'The credential could not be used.'));\n error.name = 'CredentialError';\n error.code = typeof body?.code === 'string' ? body.code : 'credential_error';\n error.retryWith = Array.isArray(body?.retryWith) ? body.retryWith : [];\n if (Array.isArray(body?.options)) error.options = body.options;\n if (Array.isArray(body?.possibleMatches)) error.possibleMatches = body.possibleMatches;\n return error;\n };\n const fromThrown = (error) => {\n const message = String(error?.message ?? error ?? '');\n const match = codePattern.exec(message);\n if (!match) return error;\n return toError({ code: match[1], message: message.slice(match[0].length) });\n };\n const invoke = async (name, args) => {\n let result;\n try {\n result = await __kodyCredentialCall(name, args);\n } catch (error) {\n throw fromThrown(error);\n }\n if (result && result.ok === false) throw toError(result.error);\n return result?.value;\n };\n const hostAllowed = (hosts, host) => {\n const target = String(host ?? '').toLowerCase();\n return hosts.some((entry) => {\n const normalized = String(entry).trim().toLowerCase();\n if (!normalized.startsWith('*.')) return normalized === target;\n const suffix = normalized.slice(1);\n if (!target.endsWith(suffix)) return false;\n const label = target.slice(0, -suffix.length);\n return label.length > 0 && !label.includes('.');\n });\n };\n const firstExactHost = (hosts) =>\n hosts.find((host) => !String(host).startsWith('*.')) ?? null;\n const resolveUrl = (input, hosts) => {\n const raw = input instanceof Request ? input.url : String(input);\n if (/^[a-z][a-z0-9+.-]*:/i.test(raw)) return raw;\n const host = firstExactHost(hosts);\n if (!host) {\n throw toError({\n code: 'invalid_request',\n message: 'This credential has no exact host to resolve a relative URL against; pass an absolute https:// URL on one of its hosts.',\n });\n }\n return new URL(raw, 'https://' + host).toString();\n };\n const send = async (request, handle) => {\n const headers = new Headers(request.headers);\n if (handle) headers.set(handleHeader, handle);\n else headers.delete(handleHeader);\n try {\n return await globalThis.fetch(new Request(request, { headers, redirect: 'manual' }));\n } catch (error) {\n throw fromThrown(error);\n }\n };\n const createFetch = (opened) => async (input, init) => {\n const redirectMode =\n init?.redirect ?? (input instanceof Request ? input.redirect : 'follow');\n const url = resolveUrl(input, opened.hosts);\n let request =\n input instanceof Request\n ? new Request(url, new Request(input, init))\n : new Request(url, init);\n let carriesCredential = true;\n for (let hop = 0; ; hop += 1) {\n const replay = request.body ? request.clone() : request;\n let response = await send(request, carriesCredential ? opened.handle : null);\n if (opened.kind === 'oauth' && carriesCredential && response.status === 401) {\n const refreshed = await invoke(\"credentialClientRefresh\", { handle: opened.handle });\n if (refreshed?.refreshed) {\n await response.body?.cancel();\n const retry = replay.body ? replay.clone() : replay;\n response = await send(retry, opened.handle);\n }\n }\n if (!redirectStatuses.has(response.status) || redirectMode === 'manual') {\n return response;\n }\n if (redirectMode === 'error') {\n await response.body?.cancel();\n throw new TypeError('The response redirected and redirect is \"error\".');\n }\n // A url credential owns its whole URL, so its redirects come back as\n // they are: following one would need the secret URL as the base.\n if (opened.kind === 'url') return response;\n const location = response.headers.get('location');\n if (!location) return response;\n if (hop >= maxRedirects) {\n await response.body?.cancel();\n throw new TypeError('Too many redirects.');\n }\n await response.body?.cancel();\n const next = new URL(location, response.url || request.url);\n const rewritesToGet =\n response.status === 303 ||\n ((response.status === 301 || response.status === 302) && request.method === 'POST');\n // The credential follows only to its own hosts over https.\n carriesCredential =\n next.protocol === 'https:' &&\n hostAllowed(opened.hosts, next.hostname);\n const headers = new Headers(replay.headers);\n if (!carriesCredential) headers.delete('authorization');\n if (rewritesToGet) {\n headers.delete('content-type');\n headers.delete('content-length');\n }\n request = new Request(next, {\n method: rewritesToGet ? 'GET' : replay.method,\n headers,\n body: rewritesToGet ? null : replay.body,\n ...(rewritesToGet || !replay.body ? {} : { duplex: 'half' }),\n });\n }\n };\n const toClient = (opened) => {\n const client = { name: opened.name, scope: opened.scope, kind: opened.kind, hosts: [...opened.hosts] };\n if (opened.kind === 'mcp') {\n client.callTool = async (tool, args) =>\n await invoke(\"credentialClientCallTool\", { handle: opened.handle, tool, args: args ?? {} });\n } else if (opened.kind === 'signing') {\n client.sign = async (operation) => {\n const { host, ...rest } = operation ?? {};\n const result = await invoke(\"credentialClientSign\", {\n handle: opened.handle,\n host: host ?? firstExactHost(opened.hosts),\n operation: rest,\n });\n return result?.signature;\n };\n } else {\n client.fetch = createFetch(opened);\n }\n return Object.freeze(client);\n };\n const open = async (args) => toClient(await invoke(\"credentialClientOpen\", args));\n const credential = async (key) => await open({ key });\n credential.named = async (name, options) =>\n await open({ name, scope: options?.scope ?? null });\n const credentials = async (key) => [await credential(key)];\n return { credential: Object.freeze(credential), credentials };\n}";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Sandbox source for credential()/credentials() on the local kody:runtime host.
3
+ * Kept in sync with kentcdodds/kody `createCredentialClientRuntimeSource`
4
+ * (packages/worker/src/mcp/execute-modules/credential-client-source.ts).
5
+ * Client fetches carry only `x-kody-credential-client`; origin's fetch gateway
6
+ * places the credential. Secret values never enter local workerd.
7
+ */
8
+ export const credentialClientRuntimeSource = "function __kodyCreateCredentialRuntime(__kodyCredentialCall) {\n const handleHeader = \"x-kody-credential-client\";\n const codePattern = /^\\[([a-z_]+)\\] /;\n const redirectStatuses = new Set([301, 302, 303, 307, 308]);\n const maxRedirects = 20;\n const toError = (body) => {\n const error = new Error(String(body?.message ?? 'The credential could not be used.'));\n error.name = 'CredentialError';\n error.code = typeof body?.code === 'string' ? body.code : 'credential_error';\n error.retryWith = Array.isArray(body?.retryWith) ? body.retryWith : [];\n if (Array.isArray(body?.options)) error.options = body.options;\n if (Array.isArray(body?.possibleMatches)) error.possibleMatches = body.possibleMatches;\n return error;\n };\n const fromThrown = (error) => {\n const message = String(error?.message ?? error ?? '');\n const match = codePattern.exec(message);\n if (!match) return error;\n return toError({ code: match[1], message: message.slice(match[0].length) });\n };\n const invoke = async (name, args) => {\n let result;\n try {\n result = await __kodyCredentialCall(name, args);\n } catch (error) {\n throw fromThrown(error);\n }\n if (result && result.ok === false) throw toError(result.error);\n return result?.value;\n };\n const hostAllowed = (hosts, host) => {\n const target = String(host ?? '').toLowerCase();\n return hosts.some((entry) => {\n const normalized = String(entry).trim().toLowerCase();\n if (!normalized.startsWith('*.')) return normalized === target;\n const suffix = normalized.slice(1);\n if (!target.endsWith(suffix)) return false;\n const label = target.slice(0, -suffix.length);\n return label.length > 0 && !label.includes('.');\n });\n };\n const firstExactHost = (hosts) =>\n hosts.find((host) => !String(host).startsWith('*.')) ?? null;\n const resolveUrl = (input, hosts) => {\n const raw = input instanceof Request ? input.url : String(input);\n if (/^[a-z][a-z0-9+.-]*:/i.test(raw)) return raw;\n const host = firstExactHost(hosts);\n if (!host) {\n throw toError({\n code: 'invalid_request',\n message: 'This credential has no exact host to resolve a relative URL against; pass an absolute https:// URL on one of its hosts.',\n });\n }\n return new URL(raw, 'https://' + host).toString();\n };\n const send = async (request, handle) => {\n const headers = new Headers(request.headers);\n if (handle) headers.set(handleHeader, handle);\n else headers.delete(handleHeader);\n try {\n return await globalThis.fetch(new Request(request, { headers, redirect: 'manual' }));\n } catch (error) {\n throw fromThrown(error);\n }\n };\n const createFetch = (opened) => async (input, init) => {\n const redirectMode =\n init?.redirect ?? (input instanceof Request ? input.redirect : 'follow');\n const url = resolveUrl(input, opened.hosts);\n let request =\n input instanceof Request\n ? new Request(url, new Request(input, init))\n : new Request(url, init);\n let carriesCredential = true;\n for (let hop = 0; ; hop += 1) {\n const replay = request.body ? request.clone() : request;\n let response = await send(request, carriesCredential ? opened.handle : null);\n if (opened.kind === 'oauth' && carriesCredential && response.status === 401) {\n const refreshed = await invoke(\"credentialClientRefresh\", { handle: opened.handle });\n if (refreshed?.refreshed) {\n await response.body?.cancel();\n const retry = replay.body ? replay.clone() : replay;\n response = await send(retry, opened.handle);\n }\n }\n if (!redirectStatuses.has(response.status) || redirectMode === 'manual') {\n return response;\n }\n if (redirectMode === 'error') {\n await response.body?.cancel();\n throw new TypeError('The response redirected and redirect is \"error\".');\n }\n // A url credential owns its whole URL, so its redirects come back as\n // they are: following one would need the secret URL as the base.\n if (opened.kind === 'url') return response;\n const location = response.headers.get('location');\n if (!location) return response;\n if (hop >= maxRedirects) {\n await response.body?.cancel();\n throw new TypeError('Too many redirects.');\n }\n await response.body?.cancel();\n const next = new URL(location, response.url || request.url);\n const rewritesToGet =\n response.status === 303 ||\n ((response.status === 301 || response.status === 302) && request.method === 'POST');\n // The credential follows only to its own hosts over https.\n carriesCredential =\n next.protocol === 'https:' &&\n hostAllowed(opened.hosts, next.hostname);\n const headers = new Headers(replay.headers);\n if (!carriesCredential) headers.delete('authorization');\n if (rewritesToGet) {\n headers.delete('content-type');\n headers.delete('content-length');\n }\n request = new Request(next, {\n method: rewritesToGet ? 'GET' : replay.method,\n headers,\n body: rewritesToGet ? null : replay.body,\n ...(rewritesToGet || !replay.body ? {} : { duplex: 'half' }),\n });\n }\n };\n const toClient = (opened) => {\n const client = { name: opened.name, scope: opened.scope, kind: opened.kind, hosts: [...opened.hosts] };\n if (opened.kind === 'mcp') {\n client.callTool = async (tool, args) =>\n await invoke(\"credentialClientCallTool\", { handle: opened.handle, tool, args: args ?? {} });\n } else if (opened.kind === 'signing') {\n client.sign = async (operation) => {\n const { host, ...rest } = operation ?? {};\n const result = await invoke(\"credentialClientSign\", {\n handle: opened.handle,\n host: host ?? firstExactHost(opened.hosts),\n operation: rest,\n });\n return result?.signature;\n };\n } else {\n client.fetch = createFetch(opened);\n }\n return Object.freeze(client);\n };\n const open = async (args) => toClient(await invoke(\"credentialClientOpen\", args));\n const credential = async (key) => await open({ key });\n credential.named = async (name, options) =>\n await open({ name, scope: options?.scope ?? null });\n const credentials = async (key) => [await credential(key)];\n return { credential: Object.freeze(credential), credentials };\n}";
9
+ //# sourceMappingURL=credential-client-runtime-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-client-runtime-source.js","sourceRoot":"","sources":["../src/credential-client-runtime-source.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,+8MAA+8M,CAAA"}
package/dist/help.js CHANGED
@@ -83,10 +83,11 @@ Usage:
83
83
  exchange).
84
84
 
85
85
  --local Run the execute module on this machine (workerd, Linux/macOS).
86
- Requires Node.js 22 or newer. \`--file\` modules ending in
87
- \`.ts\`, \`.mts\`, or \`.cts\` are type-stripped before workerd
88
- loads them; syntax that cannot be erased fails with that strip
89
- error. Auth: \`--token\` /
86
+ Requires Node.js 22 or newer. \`--file\` entries are bundled
87
+ (relative imports and npm packages; \`kody:*\` stays external)
88
+ before workerd loads them — same shape as hosted execute /
89
+ publish. Unresolvable imports fail with a clear bundle error.
90
+ Auth: \`--token\` /
90
91
  ${apiTokenEnvVar}, else stored \`auth bootstrap\` token, else
91
92
  paired \`kody login\` credentials. Static kody:@… imports are fetched via POST
92
93
  /v1/local-execute/package-graph and embedded in local workerd
package/dist/help.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;QAoB7C,aAAa,CAAC,aAAa,CAAC;;;;;;;oCAOA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eAyBvC,cAAc;;;;;;;;wCAQW,cAAc;;;eAGvC,aAAa;;;;cAId,cAAc;;;;;eAKb,cAAc;;;;;;;;;;;;;;eAcd,cAAc;;;;;;;;;;;;;sDAayB,aAAa;IAC/D,cAAc;mDACiC,aAAa;;;CAG/D,CAAA"}
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;QAoB7C,aAAa,CAAC,aAAa,CAAC;;;;;;;oCAOA,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eAyBvC,cAAc;;;;;;;;wCAQW,cAAc;;;eAGvC,aAAa;;;;cAId,cAAc;;;;;eAKb,cAAc;;;;;;;;;;;;;;;eAed,cAAc;;;;;;;;;;;;;sDAayB,aAAa;IAC/D,cAAc;mDACiC,aAAa;;;CAG/D,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Bundle a `--file` entry for local workerd the same way hosted execute /
3
+ * publish resolves code: follow relative imports and npm packages, keep
4
+ * `kody:*` external for package-graph + runtime binding, and leave `node:*`
5
+ * external for workerd `nodejs_compat` (same as unbundled `--code`).
6
+ */
7
+ export declare function bundleLocalUserModule(modulePath: string): Promise<string>;
@@ -0,0 +1,60 @@
1
+ import * as esbuild from 'esbuild';
2
+ import { resolve } from 'node:path';
3
+ /**
4
+ * Bundle a `--file` entry for local workerd the same way hosted execute /
5
+ * publish resolves code: follow relative imports and npm packages, keep
6
+ * `kody:*` external for package-graph + runtime binding, and leave `node:*`
7
+ * external for workerd `nodejs_compat` (same as unbundled `--code`).
8
+ */
9
+ export async function bundleLocalUserModule(modulePath) {
10
+ const entry = resolve(modulePath);
11
+ let result;
12
+ try {
13
+ result = await esbuild.build({
14
+ absWorkingDir: process.cwd(),
15
+ entryPoints: [entry],
16
+ bundle: true,
17
+ write: false,
18
+ format: 'esm',
19
+ platform: 'neutral',
20
+ target: 'esnext',
21
+ logLevel: 'silent',
22
+ packages: 'bundle',
23
+ external: ['kody:*', 'node:*'],
24
+ });
25
+ }
26
+ catch (error) {
27
+ throw new Error(formatBundleError(modulePath, error));
28
+ }
29
+ const output = result.outputFiles?.[0];
30
+ if (output === undefined) {
31
+ throw new Error(`Could not bundle ${modulePath} for local execute: esbuild produced no output.`);
32
+ }
33
+ if (result.errors.length > 0) {
34
+ throw new Error(formatBundleError(modulePath, { errors: result.errors }));
35
+ }
36
+ return output.text;
37
+ }
38
+ function formatBundleError(modulePath, error) {
39
+ const details = bundleErrorDetails(error);
40
+ const header = `Could not bundle ${modulePath} for local execute.`;
41
+ return details.length > 0 ? `${header}\n${details}` : header;
42
+ }
43
+ function bundleErrorDetails(error) {
44
+ if (isEsbuildFailure(error)) {
45
+ return error.errors
46
+ .map((item) => item.text.trim())
47
+ .filter((text) => text.length > 0)
48
+ .join('\n');
49
+ }
50
+ if (error instanceof Error)
51
+ return error.message;
52
+ return String(error);
53
+ }
54
+ function isEsbuildFailure(error) {
55
+ return (typeof error === 'object' &&
56
+ error !== null &&
57
+ 'errors' in error &&
58
+ Array.isArray(error.errors));
59
+ }
60
+ //# sourceMappingURL=local-bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-bundle.js","sourceRoot":"","sources":["../src/local-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAA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CAAC,CAAA;IACzC,MAAM,MAAM,GAAG,oBAAoB,UAAU,qBAAqB,CAAA;IAClE,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;AAC7D,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACzC,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,MAAM;aACjB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC/B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;aACjC,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,CAAC;IACD,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAA;IAChD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACvC,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,QAAQ,IAAI,KAAK;QACjB,KAAK,CAAC,OAAO,CAAE,KAA6B,CAAC,MAAM,CAAC,CACpD,CAAA;AACF,CAAC"}
@@ -4,7 +4,8 @@ export type LocalExecuteInput = {
4
4
  code: string;
5
5
  /**
6
6
  * `--file` path when that file supplied `code`.
7
- * `.ts`, `.mts`, and `.cts` are type-stripped before `main.js` is written.
7
+ * Bundled (relative + npm imports; `kody:*` external) before `main.js` is
8
+ * written — same resolution shape as hosted execute / publish.
8
9
  */
9
10
  modulePath?: string;
10
11
  params?: unknown;
@@ -11,7 +11,7 @@ import { assertLocalExecuteNodeEngine } from './node-engine.js';
11
11
  import { apiTokenEnvVar } from './defaults.js';
12
12
  import { fetchLocalPackageGraph, hasSavedPackageImports, localExecuteGatewayFetchShimModuleName, } from './local-package-graph.js';
13
13
  import { createLocalEntrySource, createLocalRuntimeModuleSource, createWorkerdConfig, runSecretEnvVar, runSecretHeader, } from './local-runtime-source.js';
14
- import { localUserModuleSource } from './local-typescript.js';
14
+ import { bundleLocalUserModule } from './local-bundle.js';
15
15
  import { redact } from './redact.js';
16
16
  import { ensureWorkerdBinary } from './workerd-binary.js';
17
17
  export { hasSavedPackageImports, listSavedPackageImports, localPackageGraphPlatformIssueUrl, } from './local-package-graph.js';
@@ -22,7 +22,9 @@ export const localExecutePackageGraphResolveStatus = 'Fetching local-execute pac
22
22
  export async function runLocalExecute(input) {
23
23
  assertLocalExecuteNodeEngine();
24
24
  assertTokenSafeApiUrl(input.apiUrl);
25
- const code = localUserModuleSource(input.code, input.modulePath);
25
+ const code = input.modulePath !== undefined
26
+ ? await bundleLocalUserModule(input.modulePath)
27
+ : input.code;
26
28
  const client = { apiUrl: input.apiUrl, token: input.token, fetchFn: input.fetchFn };
27
29
  await openCapabilityProxySession(client);
28
30
  // Always fetch package-graph: origin returns the gateway-fetch shim even
@@ -1 +1 @@
1
- {"version":3,"file":"local-execute.js","sourceRoot":"","sources":["../src/local-execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EACN,YAAY,EACZ,OAAO,IAAI,WAAW,GAGtB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EACN,qBAAqB,EACr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AI,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,EAC3D,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACnD,CAAC;IACD,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAqB;QAClC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;KACnD,CAAA;AACF,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,MAAuB;IAC9C,MAAM,MAAM,GAAkB,EAAE,CAAA;IAChC,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IACjE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAC9C,CAAC"}
@@ -6,10 +6,11 @@
6
6
  *
7
7
  * Stamped `kody:@…` packages also receive a package-graph CapabilityProxy shim
8
8
  * from origin. This host module still binds createAuthenticatedFetch /
9
- * secretHeaders / oauthClientCredentials for ad hoc imports, and the entry
10
- * installs the shared runtime ALS before evaluating user code so published
11
- * bundles that inline optional runtime exports (Dropbox-style) see a populated
12
- * store at module evaluation — matching cloud `__kodyRunInRuntime`.
9
+ * secretHeaders / oauthClientCredentials / credential / credentials for ad hoc
10
+ * imports, and the entry installs the shared runtime ALS before evaluating user
11
+ * code so published bundles that inline optional runtime exports
12
+ * (Dropbox-style) see a populated store at module evaluation — matching cloud
13
+ * `__kodyRunInRuntime`.
13
14
  */
14
15
  export declare const localExecuteCompatibilityDate = "2026-04-16";
15
16
  export declare const localExecuteCompatibilityFlags: readonly ["nodejs_compat"];
@@ -6,11 +6,13 @@
6
6
  *
7
7
  * Stamped `kody:@…` packages also receive a package-graph CapabilityProxy shim
8
8
  * from origin. This host module still binds createAuthenticatedFetch /
9
- * secretHeaders / oauthClientCredentials for ad hoc imports, and the entry
10
- * installs the shared runtime ALS before evaluating user code so published
11
- * bundles that inline optional runtime exports (Dropbox-style) see a populated
12
- * store at module evaluation — matching cloud `__kodyRunInRuntime`.
9
+ * secretHeaders / oauthClientCredentials / credential / credentials for ad hoc
10
+ * imports, and the entry installs the shared runtime ALS before evaluating user
11
+ * code so published bundles that inline optional runtime exports
12
+ * (Dropbox-style) see a populated store at module evaluation — matching cloud
13
+ * `__kodyRunInRuntime`.
13
14
  */
15
+ import { credentialClientRuntimeSource } from './credential-client-runtime-source.js';
14
16
  export const localExecuteCompatibilityDate = '2026-04-16';
15
17
  export const localExecuteCompatibilityFlags = ['nodejs_compat'];
16
18
  export const localWorkerModuleNames = {
@@ -210,6 +212,17 @@ export async function oauthClientCredentials(input) {
210
212
  return await __kodyCall(['kody', 'oauthClientCredentials'], [input ?? {}]);
211
213
  }
212
214
 
215
+ // Scoped credential clients (ADR 0068): open/sign/callTool/refresh through
216
+ // CapabilityProxy \`kody.credentialClient*\`. Fetches carry only an opaque
217
+ // handle; origin's gateway places the credential. Secret values never enter
218
+ // local workerd — same security as hosted and the package-graph shim.
219
+ ${credentialClientRuntimeSource}
220
+ const __kodyCredentialRuntime = __kodyCreateCredentialRuntime((name, args) =>
221
+ __kodyCall(['kody', name], [args ?? {}]),
222
+ );
223
+ export const credential = __kodyCredentialRuntime.credential;
224
+ export const credentials = __kodyCredentialRuntime.credentials;
225
+
213
226
  const __kodyRuntimeStorageSymbol = Symbol.for(${JSON.stringify(kodyRuntimeStorageSymbolDescription)});
214
227
  const __globalAny = globalThis;
215
228
  const __kodyRuntimeStorage =
@@ -222,6 +235,8 @@ const __kodyRuntimeDefault = Object.freeze({
222
235
  createAuthenticatedFetch,
223
236
  secretHeaders,
224
237
  oauthClientCredentials,
238
+ credential,
239
+ credentials,
225
240
  packageContext,
226
241
  packageSecrets,
227
242
  email,
@@ -1 +1 @@
1
- {"version":3,"file":"local-runtime-source.js","sourceRoot":"","sources":["../src/local-runtime-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,YAAY,CAAA;AACzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,eAAe,CAAU,CAAA;AAExE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,KAAK,EAAE,uBAAuB;IAC9B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,cAAc;CACd,CAAA;AAEV,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAA;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAEhD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mCAAmC,GAAG,qBAAqB,CAAA;AAExE,MAAM,UAAU,8BAA8B;IAC7C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDA0LwC,IAAI,CAAC,SAAS,CAAC,mCAAmC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BlG,CAAC,SAAS,EAAE,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAEnC,EAAE;IACL,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,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B,CAAC,OAAO,CAAC,sBAAsB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,YAAY;;wBAE9G,IAAI,CAAC,SAAS,CAAC,6BAA6B,CAAC;0BAC3C,KAAK;;;;cAIjB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;;;CAGlG,CAAA;AACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodycodes/cli",
3
- "version": "1.13.2",
3
+ "version": "1.14.0",
4
4
  "description": "Official Kody MCP client CLI: login, secure token storage, search, and execute.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,6 +20,7 @@
20
20
  ],
21
21
  "scripts": {
22
22
  "build": "tsc -p tsconfig.build.json",
23
+ "bench": "node scripts/bench.mjs",
23
24
  "typecheck": "tsc --noEmit",
24
25
  "test": "tsx --test test/*.test.ts",
25
26
  "validate": "npm run typecheck && npm run test && npm run build"
@@ -51,6 +52,7 @@
51
52
  "@modelcontextprotocol/client": "2.0.0",
52
53
  "@napi-rs/keyring": "^2.1.0",
53
54
  "add-mcp": "^2.4.0",
55
+ "esbuild": "^0.25.12",
54
56
  "ps-list": "^9.0.0",
55
57
  "undici": "^7.30.0"
56
58
  },
@@ -1,19 +1,19 @@
1
1
  ---
2
2
  name: kody
3
3
  description: >
4
- Install Kody as a remote MCP server, then use `search` and `execute`
5
- from the host agent. Use when the user mentions Kody, kody.codes,
6
- durable agent tasks, or wants to search/execute via Kody.
4
+ Install Kody as a remote MCP server, then use `search` / MCP tools and
5
+ prefer `kody execute --local` when the CLI and Node are available. Use
6
+ when the user mentions Kody, kody.codes, durable agent tasks, or wants
7
+ to search/execute via Kody.
7
8
  ---
8
9
 
9
10
  # Kody
10
11
 
11
- Kody is a remote MCP personal assistant. **Long term, install it as an MCP
12
- server in this agent** and call `search` / `execute` directly. Do not keep
13
- using the CLI as the everyday interface once the server is connected.
12
+ Kody is a remote MCP personal assistant. Install it as an MCP server in this
13
+ agent for `search`, `api`, and discovery. Prefer local CLI execute when Node ≥22 and `@kodycodes/cli` are available. Use MCP / hosted paths when the CLI or Node cannot run.
14
14
 
15
- `@kodycodes/cli` is a bootstrapper: it writes host MCP config and can act as
16
- a local client when MCP is not available.
15
+ `@kodycodes/cli` installs host MCP config and runs local execute against real
16
+ secrets while keeping `kody:runtime` hops on CapabilityProxy.
17
17
 
18
18
  ## Install the MCP server (recommended)
19
19
 
@@ -25,13 +25,17 @@ That command lists **running local** agents and writes each host's remote
25
25
  MCP entry for `https://kody.codes/mcp`. Host OAuth stays in that client —
26
26
  do not run `kody login` for the host connection.
27
27
 
28
- After install, prefer the Kody MCP tools in this agent:
28
+ After install, use the Kody MCP tools in this agent for discovery and Open API:
29
29
 
30
30
  - `search` — discover capabilities, packages, and entity detail
31
- - `execute` — run one-off modules against those capabilities
31
+ - `api` — call one Open API operation directly (no sandbox)
32
+ - Prefer `search` before composing work
32
33
 
33
- Prefer `search` before `execute`. If Kody is already connected here, skip
34
- the CLI and use those tools.
34
+ For one-off modules, smoke tests, and composition: when Node ≥22 and the CLI
35
+ are available, prefer `npx @kodycodes/cli execute --local` (see
36
+ [Local CLI execute](https://kody.codes/docs/local-execute)). If `--local`
37
+ cannot run, use Open API / MCP `api`, or fix the environment — do **not** use
38
+ hosted MCP `execute` for agent work when a local or Open API path exists.
35
39
 
36
40
  For web-based clients (ChatGPT, Claude.ai, Grok), point the user at
37
41
  https://kody.codes/onboarding.
@@ -42,10 +46,7 @@ To copy this skill into Claude Code / Cursor / Agents:
42
46
  npx @kodycodes/cli skill install
43
47
  ```
44
48
 
45
- ## CLI fallback
46
-
47
- Use the CLI only for bootstrap, scripting, or when this agent cannot reach
48
- Kody over MCP.
49
+ ## CLI
49
50
 
50
51
  ```bash
51
52
  npm install -g @kodycodes/cli
@@ -53,7 +54,7 @@ kody login
53
54
  kody login --org acme
54
55
  kody search "what can you do"
55
56
  kody search --domain email
56
- kody execute --code "import { kody } from 'kody:runtime'\nexport default async function main() { return await kody.search({ query: 'what can you do' }) }"
57
+ kody execute --local --code "import { kody } from 'kody:runtime'\nexport default async function main() { return await kody.search({ query: 'what can you do' }) }"
57
58
  kody status
58
59
  kody whoami
59
60
  kody logout
@@ -80,8 +81,9 @@ package modules via `POST /v1/local-execute/package-graph` and embeds them in
80
81
  local workerd (CapabilityProxy only for per-call `kody:runtime` hops — not a
81
82
  whole-module cloud defer). If that package-graph API is missing, `--local`
82
83
  fails clearly rather than silently billing a remote execute. `--file`
83
- paths ending in `.ts`, `.mts`, or `.cts` are type-stripped before workerd
84
- loads them (Node.js 22.13+). `--code` and `.js` files are not rewritten.
84
+ entries are bundled (relative imports and npm packages; `kody:*` external)
85
+ before workerd loads them, matching hosted execute / publish.
86
+ `--code` and stdin are not rewritten.
85
87
 
86
88
  For `execute --local` auth: `--token` / `KODY_API_TOKEN` wins when set;
87
89
  otherwise a stored token from `kody auth bootstrap --code` (after MCP
@@ -1,7 +0,0 @@
1
- export declare function isTypeScriptModulePath(modulePath: string): boolean;
2
- /**
3
- * Source written to workerd `main.js`.
4
- * `.ts`, `.mts`, and `.cts` files are type-stripped. Other paths, including
5
- * `--code` and `.js`, are returned unchanged.
6
- */
7
- export declare function localUserModuleSource(code: string, modulePath?: string): string;
@@ -1,59 +0,0 @@
1
- import * as nodeModule from 'node:module';
2
- import { basename, extname } from 'node:path';
3
- /** Extensions whose type syntax workerd cannot parse. */
4
- const typescriptModuleExtensions = new Set(['.ts', '.mts', '.cts']);
5
- let stripTypesWarningMuted = false;
6
- /**
7
- * Node 22.13+ prints an ExperimentalWarning the first time
8
- * `module.stripTypeScriptTypes` runs. Drop that one warning so local execute
9
- * stderr stays limited to real failures.
10
- */
11
- function muteStripTypeScriptTypesExperimentalWarning() {
12
- if (stripTypesWarningMuted)
13
- return;
14
- stripTypesWarningMuted = true;
15
- const emitWarning = process.emitWarning;
16
- const filtered = (warning, ...rest) => {
17
- const message = typeof warning === 'string' ? warning : warning.message;
18
- const typeName = typeof warning === 'string' ? rest[0] : warning.name;
19
- if (typeName === 'ExperimentalWarning' && message.includes('stripTypeScriptTypes'))
20
- return;
21
- return Reflect.apply(emitWarning, process, [warning, ...rest]);
22
- };
23
- process.emitWarning = filtered;
24
- }
25
- function stripTypeScriptTypes() {
26
- const strip = nodeModule.stripTypeScriptTypes;
27
- return typeof strip === 'function' ? strip : undefined;
28
- }
29
- export function isTypeScriptModulePath(modulePath) {
30
- return typescriptModuleExtensions.has(extname(modulePath).toLowerCase());
31
- }
32
- /**
33
- * Source written to workerd `main.js`.
34
- * `.ts`, `.mts`, and `.cts` files are type-stripped. Other paths, including
35
- * `--code` and `.js`, are returned unchanged.
36
- */
37
- export function localUserModuleSource(code, modulePath) {
38
- if (modulePath === undefined || !isTypeScriptModulePath(modulePath))
39
- return code;
40
- const strip = stripTypeScriptTypes();
41
- if (strip === undefined) {
42
- throw new Error(`Could not strip TypeScript from ${modulePath} before local execute wrote main.js.\nThis Node.js (v${process.versions.node}) does not provide module.stripTypeScriptTypes (included in Node.js 22.13 and newer). Upgrade Node.js and retry.`);
43
- }
44
- muteStripTypeScriptTypesExperimentalWarning();
45
- try {
46
- return strip(code, { mode: 'strip', sourceUrl: sourceUrlFor(modulePath) });
47
- }
48
- catch (error) {
49
- const detail = error instanceof Error ? error.message : String(error);
50
- throw new Error(`Could not strip TypeScript from ${modulePath} before local execute wrote main.js.\n${detail}`);
51
- }
52
- }
53
- function sourceUrlFor(modulePath) {
54
- const name = basename(modulePath);
55
- if (name.length === 0 || /[\r\n]/.test(name))
56
- return undefined;
57
- return name;
58
- }
59
- //# sourceMappingURL=local-typescript.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-typescript.js","sourceRoot":"","sources":["../src/local-typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MA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