@kitman-sh/cli 0.11.7 → 0.12.0-rc.2
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/{chunk-8zg8nv7h.js → chunk-2k08hw5q.js} +8 -8
- package/dist/{chunk-z9zqctv2.js → chunk-2ptxq9cq.js} +5 -5
- package/dist/{chunk-0b93nv6j.js → chunk-3d4d52e5.js} +1 -10
- package/dist/{chunk-c41b37fd.js → chunk-4f72nbw2.js} +14 -14
- package/dist/{chunk-m1sqgdym.js → chunk-6pz3nsn5.js} +218 -69
- package/dist/{chunk-g31s31k7.js → chunk-7gnrnv4a.js} +176 -59
- package/dist/{chunk-y1rfbqaf.js → chunk-bxqfgc6z.js} +10 -9
- package/dist/{chunk-sr6ag7ye.js → chunk-cjscsbg8.js} +72 -18
- package/dist/{chunk-5vzznkvb.js → chunk-d9bv70qb.js} +3 -3
- package/dist/{chunk-f3cbjk00.js → chunk-db9q9y8h.js} +2 -2
- package/dist/{chunk-0wv30032.js → chunk-emh8zw7k.js} +4 -4
- package/dist/{chunk-5wvqtbfp.js → chunk-fhyn2b38.js} +63 -18
- package/dist/chunk-ha241q06.js +1460 -0
- package/dist/{chunk-ap9y5k9y.js → chunk-japwbj9n.js} +1 -1
- package/dist/{chunk-akzke77d.js → chunk-myqf27w2.js} +3 -3
- package/dist/{chunk-z2dnw6ey.js → chunk-n6hxwdm6.js} +2 -2
- package/dist/{chunk-ntfk63fx.js → chunk-rzzd7zv3.js} +3 -3
- package/dist/{chunk-2qarscbj.js → chunk-sk6ceghr.js} +1 -1
- package/dist/{chunk-kpfrhex3.js → chunk-vmv7gwwr.js} +6 -6
- package/dist/chunk-yfamq8xw.js +13 -0
- package/dist/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
FileSystem,
|
|
4
|
-
Path,
|
|
5
|
-
optionalEnv
|
|
6
|
-
} from "./chunk-0b93nv6j.js";
|
|
7
2
|
import {
|
|
8
3
|
Reference,
|
|
9
4
|
TaggedError,
|
|
@@ -33,14 +28,19 @@ import {
|
|
|
33
28
|
isJsonObject,
|
|
34
29
|
isString
|
|
35
30
|
} from "./chunk-c6rbt85q.js";
|
|
31
|
+
import {
|
|
32
|
+
FileSystem,
|
|
33
|
+
Path,
|
|
34
|
+
optionalEnv
|
|
35
|
+
} from "./chunk-3d4d52e5.js";
|
|
36
36
|
import {
|
|
37
37
|
AgentHarnessIds,
|
|
38
38
|
sha2562,
|
|
39
39
|
runCommand2
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-fhyn2b38.js";
|
|
41
41
|
import {
|
|
42
42
|
NpmRegistry
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-n6hxwdm6.js";
|
|
44
44
|
|
|
45
45
|
// packages/agent-runtime/src/config-convergence.ts
|
|
46
46
|
var writeAgentEnvironmentConfigFile2 = fnUntraced(function* (file, content, keep = {}) {
|
|
@@ -440,6 +440,7 @@ For repeated queue-draining orchestration across many ready Tasks, use the separ
|
|
|
440
440
|
1. Identify the Task from the user, assignment, Code Mode MCP operations, or claimable Task operations.
|
|
441
441
|
2. When the user asks for the current Team ID or Team context, call Code Mode MCP \`kitman.context.resolveTeam({})\` first and answer from its canonical result. Do not infer Team context from local repository search, environment variables, or local config unless MCP resolution is unavailable and you report that limitation.
|
|
442
442
|
3. Use Code Mode MCP operation search when you do not know the exact SDK/API operation. MCP should have public API/CLI parity; missing parity is a Kitman bug to record or report.
|
|
443
|
+
To learn how Kitman works, such as Kits, Agents and their layers (\`extends\`, \`harness\`, \`fallbacks\`), Loops, Runners or a CLI command, search its docs with \`kitman.docs.search({ query })\` in Code Mode or \`kitman docs search "<query>"\`, and read a section with \`kitman.docs.read({ path })\` or \`kitman docs read <path>\`. Do this before reading the SDK's \`.d.ts\` files or guessing CLI syntax.
|
|
443
444
|
4. If runtime binding is missing, inspect Workspace and Team RepoBindings and create only non-secret RepoBindings when authorized.
|
|
444
445
|
5. If blocked by dependencies or missing context, record the blocker or propose a graph change instead of forcing execution.
|
|
445
446
|
6. Move status to \`in_progress\` only when work actually starts.
|
|
@@ -500,7 +501,7 @@ Use \`kitman.searchOperations({ query })\` for tokenized descriptor search.
|
|
|
500
501
|
async ({ operations }) => {
|
|
501
502
|
return operations
|
|
502
503
|
.filter((operation) => /task|context|session/i.test(\`\${operation.name} \${operation.summary}\`))
|
|
503
|
-
.map(({ name, summary,
|
|
504
|
+
.map(({ name, summary, path, inputTypeScript }) => ({ name, summary, path, inputTypeScript }));
|
|
504
505
|
}
|
|
505
506
|
\`\`\`
|
|
506
507
|
|
|
@@ -631,7 +632,7 @@ async ({ kitman }) => {
|
|
|
631
632
|
}
|
|
632
633
|
\`\`\`
|
|
633
634
|
`,
|
|
634
|
-
"references/mcp-tools.md": '# Kitman Code Mode MCP\n\nKitman MCP uses Code Mode as its only interface. The MCP context stays compact, but the reachable capability should match the public Kitman CLI/API when the authenticated Actor is authorized.\n\n## Default Tools\n\nUse these as the normal MCP entry points:\n\n- `execute`: execute JavaScript that calls typed `kitman.*` public operations through a host-side SDK/API proxy.\n- `skills`: fetch on-demand Code Mode guidance, especially `skills({ name: "execute" })`.\n- `resume`: resume paused approval or elicitation flows when the MCP session exposes it.\n- `wait_run`: wait on a Run until it needs attention or settles, in one call however long that takes; use it instead of looping `runs.wait` in `execute`.\n\n## Auth, Grants, And Fallbacks\n\nLocal MCP authenticates through a human-scoped DelegatedToolCredential created by `kitman mcp setup --name <tool>`. Hosted MCP resolves the hosted request ActorContext. Autonomous AgentIdentities authenticate as Agent Actors.\n\nThe Code Mode sandbox must not receive AgentCredential private keys, bearer tokens, raw auth-store contents, runner secrets, or raw environment variables by default. The host signs SDK/API requests and Kitman Cloud enforces normal authorization, Team privacy, audit, Memory visibility, asset access, and admin checks.\n\nIf Code Mode MCP lacks an operation that exists through the public CLI/API, record or report a Kitman MCP parity bug. Do not silently shell out to the CLI, call raw REST manually, create hidden local state, or keep local task files as a substitute.\n\nUse only customer-visible Kitman surfaces for operation discovery: MCP descriptors, CLI help, the Kitman skill, and published API docs. Do not inspect Kitman implementation source to learn operation names, schemas, or input shapes. If those surfaces do not provide enough detail, record a Kitman docs/discoverability blocker.\n\n## Team Context\n\nRepo-local `.kitman/config.json`, CWD, and Git remotes are hints, not canonical state. Kitman Cloud remains canonical for Workspace, Team, Task, RepoBinding, Session, and audit state.\n\nWhen the user asks for the current Team ID or Team context, use Code Mode MCP resolution before inspecting local files or searching the repository:\n\n```execute\nasync ({ kitman }) => await kitman.context.resolveTeam({})\n```\n\nAnswer from `preferredTeamId` and include `workspaceId` when useful. If resolution returns warnings or no unambiguous Team, report that result and ask only for the missing explicit ID needed to proceed.\n\nLocal MCP may sanitize the nearest CWD Git `origin` remote to repository identity plus repository-relative path and ask Kitman Cloud to resolve authorized Team context from RepoBindings.\n\nWorkspace and Team RepoBindings may describe a whole repository or a repository-relative `pathPrefix` for monorepos. A CWD inside a monorepo should resolve by longest matching path prefix. A CWD at a monorepo root can resolve to the Teams that own the repository for reads and live updates. Mutations still require one explicit or subpath-resolved Team.\n\nWhen a mutation is ambiguous, retry with explicit canonical IDs such as `workspaceId`, `teamId`, `taskId`, `sessionId`, `dependencyId`, or `assetId`.\n\n## Code Mode Patterns\n\nSearch when you do not know the operation:\n\n```execute\nconst query = \'session update\';\nreturn kitman.search({ query }).items\n .map(({ name, summary,
|
|
635
|
+
"references/mcp-tools.md": '# Kitman Code Mode MCP\n\nKitman MCP uses Code Mode as its only interface. The MCP context stays compact, but the reachable capability should match the public Kitman CLI/API when the authenticated Actor is authorized.\n\n## Default Tools\n\nUse these as the normal MCP entry points:\n\n- `execute`: execute JavaScript that calls typed `kitman.*` public operations through a host-side SDK/API proxy.\n- `skills`: fetch on-demand Code Mode guidance, especially `skills({ name: "execute" })`.\n- `resume`: resume paused approval or elicitation flows when the MCP session exposes it.\n- `wait_run`: wait on a Run until it needs attention or settles, in one call however long that takes; use it instead of looping `runs.wait` in `execute`.\n\n## Auth, Grants, And Fallbacks\n\nLocal MCP authenticates through a human-scoped DelegatedToolCredential created by `kitman mcp setup --name <tool>`. Hosted MCP resolves the hosted request ActorContext. Autonomous AgentIdentities authenticate as Agent Actors.\n\nThe Code Mode sandbox must not receive AgentCredential private keys, bearer tokens, raw auth-store contents, runner secrets, or raw environment variables by default. The host signs SDK/API requests and Kitman Cloud enforces normal authorization, Team privacy, audit, Memory visibility, asset access, and admin checks.\n\nIf Code Mode MCP lacks an operation that exists through the public CLI/API, record or report a Kitman MCP parity bug. Do not silently shell out to the CLI, call raw REST manually, create hidden local state, or keep local task files as a substitute.\n\nUse only customer-visible Kitman surfaces for operation discovery: MCP descriptors, CLI help, the Kitman skill, and published API docs. Do not inspect Kitman implementation source to learn operation names, schemas, or input shapes. If those surfaces do not provide enough detail, record a Kitman docs/discoverability blocker.\n\n## Team Context\n\nRepo-local `.kitman/config.json`, CWD, and Git remotes are hints, not canonical state. Kitman Cloud remains canonical for Workspace, Team, Task, RepoBinding, Session, and audit state.\n\nWhen the user asks for the current Team ID or Team context, use Code Mode MCP resolution before inspecting local files or searching the repository:\n\n```execute\nasync ({ kitman }) => await kitman.context.resolveTeam({})\n```\n\nAnswer from `preferredTeamId` and include `workspaceId` when useful. If resolution returns warnings or no unambiguous Team, report that result and ask only for the missing explicit ID needed to proceed.\n\nLocal MCP may sanitize the nearest CWD Git `origin` remote to repository identity plus repository-relative path and ask Kitman Cloud to resolve authorized Team context from RepoBindings.\n\nWorkspace and Team RepoBindings may describe a whole repository or a repository-relative `pathPrefix` for monorepos. A CWD inside a monorepo should resolve by longest matching path prefix. A CWD at a monorepo root can resolve to the Teams that own the repository for reads and live updates. Mutations still require one explicit or subpath-resolved Team.\n\nWhen a mutation is ambiguous, retry with explicit canonical IDs such as `workspaceId`, `teamId`, `taskId`, `sessionId`, `dependencyId`, or `assetId`.\n\n## Code Mode Patterns\n\nSearch when you do not know the operation:\n\n```execute\nconst query = \'session update\';\nreturn kitman.search({ query }).items\n .map(({ name, summary, path, sdk, inputTypeScript, approvalPolicy }) => ({\n name,\n call: `kitman.${path}({...})`,\n parameters: sdk.parameters,\n inputTypeScript,\n approvalPolicy,\n summary\n }));\n```\n\nDescriptor search snippets receive `operations` and its shorthand alias `ops` as the public operation catalog. The same catalog is searchable through `kitman.search({ query })`; no other descriptor globals are required. Catalog entries and search items carry `name`, `summary`, `path`, `namespacePath`, `inputTypeScript`, `sdk`, `examples`, `tags`, `approvalPolicy`, `readOnly`, `idempotent` and `destructive`.\n\nFor the input JSON Schema, output TypeScript and auth notes, describe the operation:\n\n```execute\nconst details = await kitman.describe.operation({ path: \'runs.answer\' });\nreturn { inputSchema: details.inputSchema, outputTypeScript: details.outputTypeScript, auth: details.auth };\n```\n\n`describe.operation` takes a dotted `path` or an operation `name`, such as `name: \'answerRun\'`, and returns the descriptor itself, not an `{ ok, data }` envelope. Pass `full: true` for the output JSON Schema. An unknown operation returns `{ error: { code: \'operation_not_found\', message, suggestions } }`.\n\nThat descriptor output is the source of truth for Code Mode call shape. For example, if the descriptor says `path: \'sessions.recordUpdate\'` and parameters `sessionId` and `input`, call `kitman.sessions.recordUpdate({ sessionId, input })` through `execute`.\n\nExecute related work through typed operations:\n\n```execute\nasync ({ kitman }) => {\n const team = await kitman.teams.get({ workspaceId: \'workspace_123\', teamId: \'team_123\' });\n if (!team.ok) return team.error;\n\n const tasks = await kitman.tasks.list({ teamId: \'team_123\', options: { statuses: [\'ready\', \'in_progress\'] } });\n if (!tasks.ok) return tasks.error;\n\n return {\n team: team.data,\n tasks: tasks.data.items.map((task) => ({ id: task.id, teamId: task.teamId, title: task.title, status: task.status }))\n };\n}\n```\n\nUse one execution when the calls are tightly related, especially for read-filter-map flows or read-then-record workflows. Use separate executions when a human decision is needed between steps.\n\nParallel calls are appropriate for independent reads:\n\n```execute\nasync ({ kitman }) => {\n const [task, dependencies, sessions] = await Promise.all([\n kitman.tasks.get({ taskId: \'task_123\' }),\n kitman.taskDependencies.list({ taskId: \'task_123\' }),\n kitman.sessions.listForTask({ taskId: \'task_123\' })\n ]);\n\n return { task, dependencies, sessions };\n}\n```\n\n## Required Work Discipline\n\nUse Code Mode operations to keep normal Kitman workflow discipline:\n\n- Resolve or identify the Task before starting work.\n- Read TaskDependencies for build order when relevant.\n- Generate or read the appropriate ContextPack before implementation or review work.\n- Record meaningful findings, decisions, blockers, test results, and file references as SessionUpdates or Task thread entries.\n- Propose Memory only when the learning is durable and reusable.\n- Link delivery artifacts such as merge requests with `kitman.taskLinks.create` and verify them with `kitman.taskLinks.list`.\n- Generate a handoff before stopping.\n\n## Safety Rules\n\nNever put these in Memory, SessionUpdates, handoffs, examples, or cloud audit metadata:\n\n- secrets,\n- private keys,\n- bearer tokens,\n- raw auth-store contents,\n- raw terminal logs,\n- raw source snapshots,\n- raw diffs,\n- private customer data,\n- presigned upload or download URLs.\n\nDo not use Code Mode to bypass Kitman authorization, Team privacy, human review, Memory approval, Proposal approval, or AgentIdentity lifecycle restrictions.\n',
|
|
635
636
|
"references/privacy-and-safety.md": `# Privacy And Safety
|
|
636
637
|
|
|
637
638
|
Kitman is durable shared state. Treat every SessionUpdate, Memory proposal, ContextPack, and handoff as something future humans and Agents may read.
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
withDefault,
|
|
109
109
|
option,
|
|
110
110
|
String2
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-3d4d52e5.js";
|
|
112
112
|
import {
|
|
113
113
|
currentTimeMillis,
|
|
114
114
|
SecureRandom,
|
|
@@ -218,7 +218,7 @@ import {
|
|
|
218
218
|
harnessNames,
|
|
219
219
|
herdrRunnerCapabilities2,
|
|
220
220
|
declaredChecks
|
|
221
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-fhyn2b38.js";
|
|
222
222
|
import {
|
|
223
223
|
Id
|
|
224
224
|
} from "./chunk-0qz10ek8.js";
|
|
@@ -235,7 +235,7 @@ import {
|
|
|
235
235
|
import {
|
|
236
236
|
ChildProcessSpawner,
|
|
237
237
|
make3
|
|
238
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-sk6ceghr.js";
|
|
239
239
|
|
|
240
240
|
// apps/cli/src/cli-error.ts
|
|
241
241
|
function cliErrorCode(error, status) {
|
|
@@ -403,7 +403,7 @@ var unbindable = new Set("arguments await break case catch class config const co
|
|
|
403
403
|
|
|
404
404
|
// apps/cli/src/command-help.ts
|
|
405
405
|
var Usage = [
|
|
406
|
-
"Usage: kitman <init|pair|run|inbox|loop|agent|deploy|verify|secret|claim|team|repo|constraint|mcp|sync|whoami|config|kit|task|memory|proposal|decision|context|schedule|delivery|reconcile|lifecycle|logout> [options]",
|
|
406
|
+
"Usage: kitman <init|pair|docs|run|inbox|loop|agent|deploy|verify|secret|claim|team|repo|constraint|mcp|sync|whoami|config|kit|task|memory|proposal|decision|context|schedule|delivery|reconcile|lifecycle|logout> [options]",
|
|
407
407
|
"",
|
|
408
408
|
"Set up, in a repository (run it again to repair what is missing):",
|
|
409
409
|
" kitman init [--yes] [--api-url <url>]",
|
|
@@ -414,6 +414,10 @@ var Usage = [
|
|
|
414
414
|
" [--check-hosts <host,\u2026>|none] [--check-docker-image <image@sha256:\u2026>|none] [--check-registry-image <image@sha256:\u2026>|none]",
|
|
415
415
|
" kitman runner settings history <runner> (each change: who, when, old and new value)",
|
|
416
416
|
"",
|
|
417
|
+
"Kitman's docs, as this version ships them and offline: Kits, Agents and their layers, Loops, Runners and the CLI:",
|
|
418
|
+
' kitman docs search "<query>" [--limit <n>] [--json]',
|
|
419
|
+
" kitman docs read <path> [--json] (a path search printed; a guide's own path reads the whole guide)",
|
|
420
|
+
"",
|
|
417
421
|
"Runs:",
|
|
418
422
|
' kitman run start <loop> "<words>" [--input <json>] [--team <team>] [--type <task type>] [--constraint <text>]... [--fresh] [--override-blockers]',
|
|
419
423
|
" kitman run show <run>",
|
|
@@ -513,7 +517,7 @@ var Usage = [
|
|
|
513
517
|
" kitman kit unpin <name> [--team <team>|--me]",
|
|
514
518
|
" kitman kit remove <name> [--team <team>|--me] [--yes] (a deployed Kit prints the plan; it is removed only with --yes)",
|
|
515
519
|
"",
|
|
516
|
-
"Every run, loop, agent, verify, constraint, secret, claim, deploy, dev and kit command takes --json."
|
|
520
|
+
"Every docs, run, loop, agent, verify, constraint, secret, claim, deploy, dev and kit command takes --json."
|
|
517
521
|
].join(`
|
|
518
522
|
`);
|
|
519
523
|
var moreUsage = [
|
|
@@ -629,6 +633,8 @@ var examples = [
|
|
|
629
633
|
"kitman pair 4F7K-9QX2",
|
|
630
634
|
"kitman pair 8HJD-2MZP --credential-file ./runner.json",
|
|
631
635
|
"kitman runner start --credential-file ./runner.json",
|
|
636
|
+
'kitman docs search "override an agent harness for a team" --limit 5',
|
|
637
|
+
"kitman docs read loop-operations#agents-and-effort",
|
|
632
638
|
"kitman runner settings my-runner --concurrency 2 --sandbox srt",
|
|
633
639
|
"kitman runner settings history my-runner",
|
|
634
640
|
"kitman runner list",
|
|
@@ -981,10 +987,10 @@ var sandboxMissing = (sandbox, missing) => ({
|
|
|
981
987
|
var personalCheckBackend = (agentSandbox, dockerAvailable) => agentSandbox === "srt" || agentSandbox === "docker" && dockerAvailable ? agentSandbox : undefined;
|
|
982
988
|
var herdrCoreSession = (runnerId, personal) => personal ? undefined : `kitman-${sha2562(runnerId).slice(0, 16)}`;
|
|
983
989
|
var OpenHerdrCore = Reference("kitman/cli/OpenHerdrCore", {
|
|
984
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
990
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-rzzd7zv3.js")), ({ HerdrCore, herdrCoreLayer }) => provide3(service(HerdrCore), herdrCoreLayer(options)))
|
|
985
991
|
});
|
|
986
992
|
var UpdateHerdrCore = Reference("kitman/cli/UpdateHerdrCore", {
|
|
987
|
-
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-
|
|
993
|
+
defaultValue: () => (options) => flatMap3(promise(() => import("./chunk-rzzd7zv3.js")), (module) => module.updateHerdrCore(options))
|
|
988
994
|
});
|
|
989
995
|
var herdrCoreMissing = (error) => {
|
|
990
996
|
if (isTagged(error, "HerdrCoreMissing"))
|
|
@@ -1404,7 +1410,7 @@ var syncTargets = (harness) => gen(function* () {
|
|
|
1404
1410
|
});
|
|
1405
1411
|
var syncKits = (input) => gen(function* () {
|
|
1406
1412
|
const fs = yield* FileSystem;
|
|
1407
|
-
const { syncKitSetup } = yield* promise(() => import("./chunk-
|
|
1413
|
+
const { syncKitSetup } = yield* promise(() => import("./chunk-2k08hw5q.js"));
|
|
1408
1414
|
const harnesses = yield* syncTargets(input.harness);
|
|
1409
1415
|
const chain = yield* input.client.getKitChain(input.workspaceId);
|
|
1410
1416
|
for (const { name, problem } of chain.skipped)
|
|
@@ -2322,7 +2328,7 @@ var package_default = {
|
|
|
2322
2328
|
};
|
|
2323
2329
|
|
|
2324
2330
|
// apps/cli/src/scaffold.ts
|
|
2325
|
-
var cliVersion = "0.
|
|
2331
|
+
var cliVersion = "0.12.0-rc.2";
|
|
2326
2332
|
var packageJson = (name, scaffold) => `${JSON.stringify({
|
|
2327
2333
|
name,
|
|
2328
2334
|
private: true,
|
|
@@ -2474,7 +2480,7 @@ var scaffoldKit = (directory, scaffold = {}) => gen(function* () {
|
|
|
2474
2480
|
|
|
2475
2481
|
// apps/cli/src/commands.ts
|
|
2476
2482
|
var ClientId = "kitman-cli";
|
|
2477
|
-
var agentRuntime = promise(() => import("./chunk-
|
|
2483
|
+
var agentRuntime = promise(() => import("./chunk-6pz3nsn5.js"));
|
|
2478
2484
|
var TuiLauncher = Reference("kitman/cli/TuiLauncher", {
|
|
2479
2485
|
defaultValue: () => gen(function* () {
|
|
2480
2486
|
const tui = yield* tryPromise({
|
|
@@ -2508,6 +2514,8 @@ function runEffect(args) {
|
|
|
2508
2514
|
return yield* initCommand(rest);
|
|
2509
2515
|
if (command === "pair")
|
|
2510
2516
|
return yield* pairCommand(rest);
|
|
2517
|
+
if (command === "docs")
|
|
2518
|
+
return yield* docsCommand(args);
|
|
2511
2519
|
if (command === "login")
|
|
2512
2520
|
return yield* login(rest);
|
|
2513
2521
|
if (command === "logout")
|
|
@@ -3474,7 +3482,7 @@ var SandboxHostProbe = Reference("kitman/cli/SandboxHostProbe", {
|
|
|
3474
3482
|
});
|
|
3475
3483
|
var OpenRunnerRpc = Reference("kitman/cli/OpenRunnerRpc", {
|
|
3476
3484
|
defaultValue: () => (options) => gen(function* () {
|
|
3477
|
-
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-
|
|
3485
|
+
const { makeRunnerRpcClient, runnerRpcUrl, runnerWebSocketProtocol } = yield* promise(() => import("./chunk-emh8zw7k.js"));
|
|
3478
3486
|
return yield* makeRunnerRpcClient({
|
|
3479
3487
|
runnerId: options.runnerId,
|
|
3480
3488
|
bearer: options.bearer,
|
|
@@ -3840,8 +3848,10 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3840
3848
|
});
|
|
3841
3849
|
};
|
|
3842
3850
|
const storage = yield* provide3(service(HttpClient), layer4);
|
|
3851
|
+
const spending = new Map;
|
|
3843
3852
|
const runAgentStep = agentStepExecutor({
|
|
3844
3853
|
rootDir: path.join(runnerRootDir, ".kitman"),
|
|
3854
|
+
spending,
|
|
3845
3855
|
sandbox: sandboxOf,
|
|
3846
3856
|
heartbeat: heartbeatOf,
|
|
3847
3857
|
gitCredentials: rpc.gitCredential,
|
|
@@ -3935,10 +3945,11 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3935
3945
|
}).pipe(asVoid)), tapError2(onProtocolRefusal)),
|
|
3936
3946
|
heartbeatWork: (workUnitId, lease) => rpc.heartbeat({ workUnitId, lease }),
|
|
3937
3947
|
complete: (completion) => rpc.complete(completion),
|
|
3938
|
-
release: (workUnitId, lease, crashed) => rpc.release({
|
|
3948
|
+
release: (workUnitId, lease, crashed, tokens) => rpc.release({
|
|
3939
3949
|
workUnitId,
|
|
3940
3950
|
lease,
|
|
3941
|
-
...crashed === undefined ? undefined : { crashed: { reason: crashed } }
|
|
3951
|
+
...crashed === undefined ? undefined : { crashed: { reason: crashed } },
|
|
3952
|
+
...tokens === undefined ? undefined : { tokens }
|
|
3942
3953
|
})
|
|
3943
3954
|
};
|
|
3944
3955
|
};
|
|
@@ -3959,7 +3970,12 @@ function startCanonicalHerdrRunnerCommand(input) {
|
|
|
3959
3970
|
case "verification":
|
|
3960
3971
|
return runVerification(work).pipe(provideContext2(platform), failedWhenUnrun("verification"));
|
|
3961
3972
|
}
|
|
3962
|
-
}
|
|
3973
|
+
},
|
|
3974
|
+
spent: (workUnitId) => sync2(() => {
|
|
3975
|
+
const tokens = spending.get(workUnitId);
|
|
3976
|
+
spending.delete(workUnitId);
|
|
3977
|
+
return tokens;
|
|
3978
|
+
})
|
|
3963
3979
|
},
|
|
3964
3980
|
signals
|
|
3965
3981
|
});
|
|
@@ -3998,7 +4014,7 @@ function mcpCommand(args) {
|
|
|
3998
4014
|
if (command.action === "run") {
|
|
3999
4015
|
if (command.args.length > 0)
|
|
4000
4016
|
return yield* new CliError({ message: `Unknown command: ${args.join(" ")}` });
|
|
4001
|
-
const { runMcpServerCommand } = yield* promise(() => import("./chunk-
|
|
4017
|
+
const { runMcpServerCommand } = yield* promise(() => import("./chunk-7gnrnv4a.js"));
|
|
4002
4018
|
return yield* runMcpServerCommand({ flags: command.flags });
|
|
4003
4019
|
}
|
|
4004
4020
|
if (command.action !== "setup")
|
|
@@ -4486,6 +4502,40 @@ function programLoopCommand(command) {
|
|
|
4486
4502
|
return yield* new CliError({ message: `Unknown loop command: ${command.action}` });
|
|
4487
4503
|
});
|
|
4488
4504
|
}
|
|
4505
|
+
var docsModule = promise(() => import("./chunk-yfamq8xw.js"));
|
|
4506
|
+
function docsCommand(args) {
|
|
4507
|
+
return gen(function* () {
|
|
4508
|
+
const command = parseCommand(args);
|
|
4509
|
+
const [words] = command.args;
|
|
4510
|
+
const { readDoc, searchDocs } = yield* docsModule;
|
|
4511
|
+
if (command.action !== "search" && command.action !== "read" || words === undefined || command.args.length > 1)
|
|
4512
|
+
return yield* new CliError({
|
|
4513
|
+
message: 'Usage: kitman docs search "<query>" [--limit <n>] | kitman docs read <path>'
|
|
4514
|
+
});
|
|
4515
|
+
if (command.action === "search") {
|
|
4516
|
+
const found = searchDocs({ query: words, limit: command.flags.limit });
|
|
4517
|
+
if (command.flags.json)
|
|
4518
|
+
return yield* printJson(found);
|
|
4519
|
+
if (found.items.length === 0)
|
|
4520
|
+
return yield* log(`No docs section matches "${words}".`);
|
|
4521
|
+
return yield* log([
|
|
4522
|
+
...found.items.flatMap((hit) => [hit.title, ` ${hit.path} ${hit.link}`, ` ${hit.excerpt}`, ""]),
|
|
4523
|
+
"Read one with: kitman docs read <path>"
|
|
4524
|
+
].join(`
|
|
4525
|
+
`));
|
|
4526
|
+
}
|
|
4527
|
+
const section = readDoc({ path: words });
|
|
4528
|
+
if ("error" in section)
|
|
4529
|
+
return yield* new CliError({
|
|
4530
|
+
message: [section.error.message, ...section.error.suggestions.map((path) => ` kitman docs read ${path}`)].join(`
|
|
4531
|
+
`)
|
|
4532
|
+
});
|
|
4533
|
+
if (command.flags.json)
|
|
4534
|
+
return yield* printJson(section);
|
|
4535
|
+
yield* log([section.title, section.link, "", section.text].join(`
|
|
4536
|
+
`));
|
|
4537
|
+
});
|
|
4538
|
+
}
|
|
4489
4539
|
function agentCommand(args) {
|
|
4490
4540
|
return gen(function* () {
|
|
4491
4541
|
const command = parseCommand(args);
|
|
@@ -4677,6 +4727,8 @@ var runListLine = (item) => [
|
|
|
4677
4727
|
item.display.summary === undefined ? "" : listedSummary(item.display.summary),
|
|
4678
4728
|
item.run.id
|
|
4679
4729
|
].filter((part) => part !== "").join(" ");
|
|
4730
|
+
var tokenWords = (tokens) => `${tokens.input.toLocaleString("en-US")} input, ${tokens.output.toLocaleString("en-US")} output, ${tokens.cached.toLocaleString("en-US")} cached`;
|
|
4731
|
+
var stepTokenLines = (step) => step.tokens !== undefined ? [` Tokens: ${tokenWords(step.tokens)}`] : step.attempts.some((attempt) => attempt.tokens === "none") ? [" Tokens: none reported"] : [];
|
|
4680
4732
|
var runShowLines = (shown) => [
|
|
4681
4733
|
`Run ${shown.run.id}: ${runDisplayLabels[shown.display.state]}${shown.display.retried ? " \xB7 Retried" : ""}`,
|
|
4682
4734
|
...shown.display.summary === undefined ? [] : [`Now: ${shown.display.summary}`],
|
|
@@ -4687,8 +4739,10 @@ var runShowLines = (shown) => [
|
|
|
4687
4739
|
`Loop${shown.run.loopVersion === undefined ? "" : ` ${shown.run.loopVersion}`}${shown.run.loopLayer === undefined ? "" : ` from the ${shown.run.loopLayer} layer`}, digest ${shown.run.loopDigest}`
|
|
4688
4740
|
],
|
|
4689
4741
|
...shown.run.failureSummary === undefined ? [] : [`Failure: ${shown.run.failureSummary}`],
|
|
4742
|
+
...shown.tokens === undefined ? [] : [`Tokens: ${tokenWords(shown.tokens)}`],
|
|
4690
4743
|
...shown.steps.flatMap((step) => [
|
|
4691
4744
|
`Step ${step.name}: ${step.status} (attempt ${step.attempts.length})`,
|
|
4745
|
+
...stepTokenLines(step),
|
|
4692
4746
|
...claimLines(step)
|
|
4693
4747
|
]),
|
|
4694
4748
|
...evidenceLines(shown.evidence),
|
|
@@ -4696,7 +4750,7 @@ var runShowLines = (shown) => [
|
|
|
4696
4750
|
...questionLines2(shown.questions.filter((question) => question.status === "open")),
|
|
4697
4751
|
...shown.artifacts.flatMap((artifact) => [`Artifact ${artifact.kind}: ${artifact.title}`, artifact.text]),
|
|
4698
4752
|
...shown.children.map((child) => `Child ${child.name}: ${child.runId} ${child.status}`),
|
|
4699
|
-
...shown.waiting.map((waiting) => waiting.kind === "queue" ?
|
|
4753
|
+
...shown.waiting.map((waiting) => waiting.kind === "queue" ? `${waiting.unrunnable === undefined ? "Waiting for a Runner slot for" : "Waiting for a Runner that can run"} ${waiting.name}: ${queueWords(waiting)}` : `Waiting on ${waiting.kind} ${waiting.name}`)
|
|
4700
4754
|
];
|
|
4701
4755
|
var myTeamsSections = [
|
|
4702
4756
|
["needsYou", "Needs you"],
|
|
@@ -5268,9 +5322,9 @@ function changeRequestCommand(args) {
|
|
|
5268
5322
|
yield* log(command.action === "approve" ? `Approved ${short} of ${changeRequest.title}. A Run waiting on approval of ${short} resumes; one waiting on another head does not.` : `Requested changes to ${short} of ${changeRequest.title}`);
|
|
5269
5323
|
});
|
|
5270
5324
|
}
|
|
5271
|
-
var KitWriter = map8(promise(() => import("./chunk-
|
|
5325
|
+
var KitWriter = map8(promise(() => import("./chunk-4f72nbw2.js")), (build) => build.writeKit);
|
|
5272
5326
|
var KitBuilder = Reference("kitman/cli/KitBuilder", {
|
|
5273
|
-
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-
|
|
5327
|
+
defaultValue: () => (directory) => flatMap3(promise(() => import("./chunk-4f72nbw2.js")), (build) => build.buildKit(directory))
|
|
5274
5328
|
});
|
|
5275
5329
|
var uploadKit = (client, workspaceId, built) => gen(function* () {
|
|
5276
5330
|
yield* client.uploadKitBundle(workspaceId, built.digest, { bundle: encode2(built.bundle) });
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
decoded2,
|
|
8
8
|
readOpencode2,
|
|
9
9
|
runOpencodeReader2
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import"./chunk-
|
|
10
|
+
} from "./chunk-vmv7gwwr.js";
|
|
11
|
+
import"./chunk-sk6ceghr.js";
|
|
12
12
|
import"./chunk-c6rbt85q.js";
|
|
13
|
-
import"./chunk-
|
|
13
|
+
import"./chunk-3d4d52e5.js";
|
|
14
14
|
import"./chunk-vtfwjhzh.js";
|
|
15
15
|
export {
|
|
16
16
|
decoded2 as decoded,
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
shutdownUnsafe,
|
|
109
109
|
fromQueue,
|
|
110
110
|
unwrap
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-3d4d52e5.js";
|
|
112
112
|
import {
|
|
113
113
|
Clock,
|
|
114
114
|
empty,
|
|
@@ -123,7 +123,7 @@ import {
|
|
|
123
123
|
ParseOptions,
|
|
124
124
|
RpcClientDefect,
|
|
125
125
|
RpcClientError
|
|
126
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-fhyn2b38.js";
|
|
127
127
|
|
|
128
128
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/workers/Transferable.js
|
|
129
129
|
class Collector extends (/* @__PURE__ */ Service2()("effect/workers/Transferable/Collector")) {
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
runnerRpcUrl2,
|
|
5
5
|
makeRunnerRpcClient2,
|
|
6
6
|
makeProgramRpcClient2
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import"./chunk-
|
|
9
|
-
import"./chunk-
|
|
7
|
+
} from "./chunk-myqf27w2.js";
|
|
8
|
+
import"./chunk-db9q9y8h.js";
|
|
9
|
+
import"./chunk-fhyn2b38.js";
|
|
10
10
|
import"./chunk-0qz10ek8.js";
|
|
11
11
|
import"./chunk-c6rbt85q.js";
|
|
12
|
-
import"./chunk-
|
|
12
|
+
import"./chunk-3d4d52e5.js";
|
|
13
13
|
import"./chunk-vtfwjhzh.js";
|
|
14
14
|
export {
|
|
15
15
|
makeProgramRpcClient2 as makeProgramRpcClient,
|
|
@@ -253,7 +253,6 @@ import {
|
|
|
253
253
|
import {
|
|
254
254
|
map,
|
|
255
255
|
makeEquivalence,
|
|
256
|
-
toNumber,
|
|
257
256
|
bytes,
|
|
258
257
|
BadArgument,
|
|
259
258
|
systemError,
|
|
@@ -317,7 +316,7 @@ import {
|
|
|
317
316
|
String2,
|
|
318
317
|
optionalEnv,
|
|
319
318
|
harnessesUnsupportedInSrt2
|
|
320
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-3d4d52e5.js";
|
|
321
320
|
import {
|
|
322
321
|
isDateTime,
|
|
323
322
|
Numeric,
|
|
@@ -358,7 +357,7 @@ import {
|
|
|
358
357
|
make3,
|
|
359
358
|
parseFdName,
|
|
360
359
|
fdName
|
|
361
|
-
} from "./chunk-
|
|
360
|
+
} from "./chunk-sk6ceghr.js";
|
|
362
361
|
|
|
363
362
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Tuple.js
|
|
364
363
|
var makeEquivalence3 = Tuple;
|
|
@@ -900,6 +899,15 @@ var runMain2 = /* @__PURE__ */ makeRunMain(({
|
|
|
900
899
|
// node_modules/.bun/@effect+platform-bun@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-bun/dist/BunRuntime.js
|
|
901
900
|
var runMain = runMain2;
|
|
902
901
|
|
|
902
|
+
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/BigInt.js
|
|
903
|
+
var BigInt2 = globalThis.BigInt;
|
|
904
|
+
var toNumber = (b) => {
|
|
905
|
+
if (b > BigInt2(Number.MAX_SAFE_INTEGER) || b < BigInt2(Number.MIN_SAFE_INTEGER)) {
|
|
906
|
+
return none();
|
|
907
|
+
}
|
|
908
|
+
return some(Number(b));
|
|
909
|
+
};
|
|
910
|
+
|
|
903
911
|
// node_modules/.bun/effect@4.1.2/node_modules/effect/dist/DateTime.js
|
|
904
912
|
var makeUnsafe = makeUnsafe6;
|
|
905
913
|
var make18 = make4;
|
|
@@ -3206,7 +3214,7 @@ var waitingOnWords = ({ keys, hidden }) => {
|
|
|
3206
3214
|
|
|
3207
3215
|
// packages/core/src/run-queue.ts
|
|
3208
3216
|
var ClaimRanks = ["in_progress", "finishing", "new"];
|
|
3209
|
-
var queueWords = (place) => `#${place.position} in the queue, ${place.reason}`;
|
|
3217
|
+
var queueWords = (place) => place.unrunnable === undefined ? `#${place.position} in the queue, ${place.reason}` : `no online Runner can run it: ${place.unrunnable}`;
|
|
3210
3218
|
// packages/core/src/redaction.ts
|
|
3211
3219
|
var DurableSurfaceContractVersion = "durable-redaction.v1";
|
|
3212
3220
|
var EvidenceRefContractVersion = "evidence-ref.v1";
|
|
@@ -3373,8 +3381,23 @@ var LOCAL_PATH_KEYS = new Set([
|
|
|
3373
3381
|
"docker_socket",
|
|
3374
3382
|
"ssh_agent_socket"
|
|
3375
3383
|
]);
|
|
3376
|
-
var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _
|
|
3384
|
+
var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _.|-]*>|\$\{[^{}\s]*\}|\{\{[^{}]*\}\}|proxy-ep=[A-Za-z0-9.-]+;kitmanref(?:[0-9a-f]{2})+(?![A-Za-z0-9._~+/-])`;
|
|
3385
|
+
var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
|
|
3386
|
+
var placeholderNamePart = `(?:[A-Z]?[a-z]+|[A-Z]+)(?:[A-Z][a-z]+)*[0-9]{0,4}`;
|
|
3387
|
+
var anglePlaceholder = `<${placeholderWord}[0-9]{0,2}(?:[ _.|-]${placeholderWord}[0-9]{0,2})*>`;
|
|
3388
|
+
var secretReferencePart = String.raw`(?:[A-Za-z0-9_.-]+|${anglePlaceholder}|\$\{[A-Za-z_][A-Za-z0-9_]*\}|\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}|\*|\u2026)`;
|
|
3389
|
+
var describedSecretReference = new RegExp(`^secret://${secretReferencePart}/(?:${secretReferencePart})?$`, "u");
|
|
3377
3390
|
var secretReferenceTail = String.raw`(?<=secret:)\/\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?![^\s,;}"')\]\x60])`;
|
|
3391
|
+
var referenceInText = new RegExp(String.raw`secret:\/\/${secretReferencePart}\/${secretReferencePart}(?![^\s,;}"')\]\x60])`, "gu");
|
|
3392
|
+
function inSecretReference(text, start, end) {
|
|
3393
|
+
for (const reference of text.matchAll(referenceInText)) {
|
|
3394
|
+
const referenceEnd = reference.index + reference[0].length;
|
|
3395
|
+
if (reference.index <= start && end <= referenceEnd)
|
|
3396
|
+
return isPlaceholder(unwrapped(reference[0]));
|
|
3397
|
+
}
|
|
3398
|
+
return false;
|
|
3399
|
+
}
|
|
3400
|
+
var placeholderTokenName = new RegExp(`^<?(?:ghp_|github_pat_|glpat-|ksa1\\.|sk-|xox[baprs]-)${placeholderNamePart}(?:[_.-]${placeholderNamePart})*>?$`, "u");
|
|
3378
3401
|
var bearerValue = /[0-9]|[._~+/:-][A-Za-z0-9]|[<{]/u;
|
|
3379
3402
|
var VALUE_RULES = [
|
|
3380
3403
|
{ classification: "secret", name: "private-key", pattern: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u },
|
|
@@ -3388,7 +3411,7 @@ var VALUE_RULES = [
|
|
|
3388
3411
|
classification: "credential",
|
|
3389
3412
|
name: "provider-token",
|
|
3390
3413
|
pattern: /(?:^|[^A-Za-z0-9])(?<value><?(?:ghp_|github_pat_|glpat-|ksa1\.|sk-[A-Za-z0-9_-]{8,}|xox[baprs]-)[A-Za-z0-9._*-]*[A-Za-z0-9_*-]>?)/u,
|
|
3391
|
-
holds: (value) => !isPlaceholder(value)
|
|
3414
|
+
holds: (value, _matched, text, start) => !isPlaceholder(value) && !(placeholderTokenName.test(value) && inSecretReference(text, start, start + value.length))
|
|
3392
3415
|
},
|
|
3393
3416
|
{
|
|
3394
3417
|
classification: "credential",
|
|
@@ -3419,10 +3442,10 @@ var VALUE_RULES = [
|
|
|
3419
3442
|
{ classification: "transcript", name: "transcript-content", pattern: /(?:^|\n)\s*(?:user|assistant|system)\s*:/iu }
|
|
3420
3443
|
];
|
|
3421
3444
|
var maskedToken = /^(?:ghp_|github_pat_|glpat-|ksa1\.|xox[baprs]-|sk-(?:ant-(?:[a-z]+[0-9]*-)?|proj-|or-v[0-9]+-)?)(?:x{4,}|X{4,}|\*{4,})$/u;
|
|
3422
|
-
var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
|
|
3423
3445
|
var placeholders = [
|
|
3424
3446
|
maskedToken,
|
|
3425
|
-
new RegExp(
|
|
3447
|
+
new RegExp(`^${anglePlaceholder}$`, "u"),
|
|
3448
|
+
describedSecretReference,
|
|
3426
3449
|
/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/u,
|
|
3427
3450
|
/^\$[A-Za-z_][A-Za-z0-9_]*$/u,
|
|
3428
3451
|
/^\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}$/u,
|
|
@@ -3439,14 +3462,16 @@ function looksLikeCredential(raw, matched) {
|
|
|
3439
3462
|
const value = unwrapped(raw);
|
|
3440
3463
|
if (isPlaceholder(raw) || isPlaceholder(value))
|
|
3441
3464
|
return false;
|
|
3465
|
+
if (matched === `secret:${raw}` && isPlaceholder(`secret:${value}`))
|
|
3466
|
+
return false;
|
|
3442
3467
|
return /^[^\s:=]+=\S/u.test(matched) || value.length >= 6 && /[0-9]/u.test(value) || value.length >= 20 && /[a-z]/u.test(value) && /[A-Z]/u.test(value);
|
|
3443
3468
|
}
|
|
3444
3469
|
function ruleMatch(rule, text) {
|
|
3445
3470
|
for (const match of text.matchAll(globalPattern(rule))) {
|
|
3446
3471
|
const value = match.groups?.value ?? match[0];
|
|
3447
|
-
if (rule.holds !== undefined && !rule.holds(value, match[0]))
|
|
3448
|
-
continue;
|
|
3449
3472
|
const start = match.index + (match.groups?.value === undefined ? 0 : match[0].lastIndexOf(value));
|
|
3473
|
+
if (rule.holds !== undefined && !rule.holds(value, match[0], text, start))
|
|
3474
|
+
continue;
|
|
3450
3475
|
return { classification: rule.classification, rule: rule.name, span: { start, end: start + value.length } };
|
|
3451
3476
|
}
|
|
3452
3477
|
return;
|
|
@@ -3462,8 +3487,11 @@ var globalPattern = (rule) => {
|
|
|
3462
3487
|
};
|
|
3463
3488
|
var redactedBy = (text, rule) => text.replace(globalPattern(rule), (matched, ...rest) => {
|
|
3464
3489
|
const groups = rest.at(-1);
|
|
3465
|
-
const
|
|
3466
|
-
|
|
3490
|
+
const offset = isObject(groups) ? rest.at(-3) : rest.at(-2);
|
|
3491
|
+
const named = isObject(groups) && groups !== null && "value" in groups ? groups.value : undefined;
|
|
3492
|
+
const value = isString(named) ? named : matched;
|
|
3493
|
+
const start = (isNumber(offset) ? offset : 0) + matched.lastIndexOf(value);
|
|
3494
|
+
return rule.holds === undefined || rule.holds(value, matched, text, start) ? `[REDACTED:${rule.classification}]` : matched;
|
|
3467
3495
|
});
|
|
3468
3496
|
var runnerSecretReference = /^runner-secret:[A-Z0-9_]+:(?:env|file|exec)$/u;
|
|
3469
3497
|
var credentialUrlRule = {
|
|
@@ -5530,6 +5558,17 @@ var LoopLayers = ["team", "workspace"];
|
|
|
5530
5558
|
var AgentEfforts = ["low", "medium", "high", "xhigh"];
|
|
5531
5559
|
var AgentCapabilities = ["web", "subagents", "artifacts", "browser"];
|
|
5532
5560
|
|
|
5561
|
+
// packages/core/src/tokens.ts
|
|
5562
|
+
var TokenCount = Int.check(isGreaterThanOrEqualTo(0));
|
|
5563
|
+
var TokenUsage = Struct({ input: TokenCount, output: TokenCount, cached: TokenCount });
|
|
5564
|
+
var AttemptTokens = Union([TokenUsage, Literal("none")]);
|
|
5565
|
+
var sum = (usages) => usages.length === 0 ? undefined : usages.reduce((total, usage) => ({
|
|
5566
|
+
input: total.input + usage.input,
|
|
5567
|
+
output: total.output + usage.output,
|
|
5568
|
+
cached: total.cached + usage.cached
|
|
5569
|
+
}));
|
|
5570
|
+
var tokensSpent = (attempts) => sum(attempts.filter((tokens) => tokens !== undefined && tokens !== "none"));
|
|
5571
|
+
|
|
5533
5572
|
// packages/core/src/loop.ts
|
|
5534
5573
|
var LoopStatuses = ["draft", "active", "disabled", "archived"];
|
|
5535
5574
|
var LoopStepImplementationKinds = [
|
|
@@ -6078,7 +6117,8 @@ var RunWaiting = Union([
|
|
|
6078
6117
|
rank: Literals(ClaimRanks),
|
|
6079
6118
|
position: Int.check(isGreaterThanOrEqualTo(1)),
|
|
6080
6119
|
reason: String4,
|
|
6081
|
-
movesUpAt: optionalKey(String4)
|
|
6120
|
+
movesUpAt: optionalKey(String4),
|
|
6121
|
+
unrunnable: optionalKey(String4)
|
|
6082
6122
|
})
|
|
6083
6123
|
]);
|
|
6084
6124
|
var RunEvidence = Struct({
|
|
@@ -6419,8 +6459,10 @@ var RunStepSummary = Struct({
|
|
|
6419
6459
|
status: StepAttemptStatus,
|
|
6420
6460
|
failureSummary: optionalKey(String4),
|
|
6421
6461
|
output: optionalKey(Unknown),
|
|
6422
|
-
revision: optionalKey(String4)
|
|
6423
|
-
|
|
6462
|
+
revision: optionalKey(String4),
|
|
6463
|
+
tokens: optionalKey(AttemptTokens)
|
|
6464
|
+
})),
|
|
6465
|
+
tokens: optionalKey(TokenUsage)
|
|
6424
6466
|
});
|
|
6425
6467
|
var RunSteerDeliveries = ["queued", "delivered", "failed"];
|
|
6426
6468
|
var RunSteer = Struct({
|
|
@@ -6531,7 +6573,8 @@ var RunShow = Struct({
|
|
|
6531
6573
|
evidence: ArraySchema(RunEvidence),
|
|
6532
6574
|
steers: ArraySchema(RunSteer),
|
|
6533
6575
|
waiting: ArraySchema(RunWaiting),
|
|
6534
|
-
closures: ArraySchema(RunClosure)
|
|
6576
|
+
closures: ArraySchema(RunClosure),
|
|
6577
|
+
tokens: optionalKey(TokenUsage)
|
|
6535
6578
|
});
|
|
6536
6579
|
var RunStartPreview = Struct({
|
|
6537
6580
|
loop: Struct({ id: String4, title: String4, outcome: optionalKey(String4) }),
|
|
@@ -6909,7 +6952,8 @@ var WorkUnitHeartbeatResult = Struct({
|
|
|
6909
6952
|
var WorkUnitReleaseInput = Struct({
|
|
6910
6953
|
workUnitId: Id,
|
|
6911
6954
|
lease: WorkUnitLeaseInput,
|
|
6912
|
-
crashed: optionalKey(Struct({ reason: String4.check(isMinLength(1), isMaxLength(500)) }))
|
|
6955
|
+
crashed: optionalKey(Struct({ reason: String4.check(isMinLength(1), isMaxLength(500)) })),
|
|
6956
|
+
tokens: optionalKey(AttemptTokens)
|
|
6913
6957
|
});
|
|
6914
6958
|
var CheckEvidence = Struct({
|
|
6915
6959
|
name: String4.check(isMinLength(1), isMaxLength(120)),
|
|
@@ -6979,6 +7023,7 @@ var WorkUnitOutcome = Struct({
|
|
|
6979
7023
|
cleanSync: optionalKey(Literals(["up_to_date", "merged"])),
|
|
6980
7024
|
harnessHold: optionalKey(HarnessHold),
|
|
6981
7025
|
restart: optionalKey(StepRestart),
|
|
7026
|
+
tokens: optionalKey(AttemptTokens),
|
|
6982
7027
|
failureSummary: optionalKey(String4.check(isMinLength(1), isMaxLength(4000)))
|
|
6983
7028
|
});
|
|
6984
7029
|
var WorkUnitCompletion = Struct({
|
|
@@ -15999,4 +16044,4 @@ function checkServices(declaration) {
|
|
|
15999
16044
|
return isSome(decoded) ? [...new Set(decoded.value.services)] : undefined;
|
|
16000
16045
|
}
|
|
16001
16046
|
|
|
16002
|
-
export { Clock, currentTimeMillis, WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, SafeJson, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, checkTests, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, newerKitmanVersion, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
|
|
16047
|
+
export { Clock, currentTimeMillis, WebCrypto, SecureRandom, layerWebCrypto, makeUnsafe, formatIso, empty, fromInput, merge, runMain, layer, layer2, Stdio, Terminal, layer3, error, log, toDate, parseDate, toIso, currentDate, wallClockMillis, waitingOnWords, queueWords, scanDurableSurface, redactResponseSurface, redactCredentials, redactedOutputTail, SafeJson, AgentHarnessIds, AgentSkillRequirement, AgentMcpServerRequirement, AgentEnvironmentFragment, findForbiddenAgentEnvironmentSecretPath, NetworkHost, RepoBindingProviders, RepoBindingCredentialProviderTypes, findForbiddenRepoBindingSecretPath, AgentSandboxNetwork, runnerAgentSandboxPolicy, agentNetworkAllowlist, verificationNetworkAllowlist, programNetworkHosts, ContextPackModes, DefaultContextPackMode, ProposalStatuses, ProposalTargetTypes, canonicalJson, canonicalSha256, AgentEfforts, AgentCapabilities, tokensSpent, LoopDataSchemaRef, RunDisplayStates, LoopVersion, ProgramLoop, AgentFallback, RunWaitUntils, isTestReportName, checkTests, ProgramWorkUnit, MeasureSample, MeasureEvidence, catchUpPathLimit, CatchUp, RunnerOwnership, RunnerExecutionBackend, MaxRunnerConcurrency, PinnedImage, RunnerSettingNames, RunnerSettingsUpdate, defaultRunnerSettings, shownRunnerSetting, defaultRunnerCapabilities, deliveryProviderActions, newerKitmanVersion, MemoryStatuses, MemoryScopes, MaxMemoryListLimit, DecisionStatuses, Session, SessionEnd, SessionUpdate, SessionUpdateCreate, FixFlowRecoveryActions, KitmanAgentCapabilityNames, sha2562, isRunFileRefusalReason, runFileRefusalWords, RunFileRefused, runFileContentType, repositoryKey, createId, digestSha256, digestSha512, digestWith, sha256Hasher, AgentEvent, raw, make5, get, post, put, setHeaders, acceptJson, bodyUint8Array, bodyJsonUnsafe, bodyUrlParams, schemaBodyJson, filterStatusOk, HttpClient, execute, get2, Fetch, layer4, Socket, SocketReadError, SocketError, WebSocketConstructor, layerWebSocketConstructorGlobal, layerWebSocket, runDisplayLabels, listedSummary, KitName, KitDigest, defaultKitName, KitSetup, SetupArchive, kitMcpSecretNames, kitmanMcpServer, KitmanClientError, KitmanEffectClient, CliError, DefaultApiUrl, resolveConfig, apiUrlFromEnv, stepCredentialFromEnv, stepWorkspaceFromEnv, stepSkillsDirFromEnv, stepFittingSkillsFromEnv, stepOutputOnlyFromEnv, mcpCredentialNameFromEnv, userConfigPath, userAuthPath, userHarnessSyncPath, kitSetupCacheDir, bundleCacheDir, localConfigPath, readUserConfig, writeUserConfig, sessionForApi, readAuthStore, storeSession, removeSession, removeAllSessions, agentCredentialForApi, storeAgentCredential, removeAgentCredential, normalizeApiUrl, isStoredAgentCredential, isStreamSchema, getStreamSchemas, make6, exitSchema, ParseOptions, RpcClientDefect, RpcClientError, make7, Service, RunnerHeaders, RunnerRpcProtocolVersion, RunnerRpcError, RunSettled, UpdateAvailable, RunnerReplicaRpcs, RunnerRunFileRpcs, ProgramRpcs, parseCallbackUrl, revokeToken, toStoredSession, browserLogin, openBrowser, shouldRefresh, createSdkClient, refreshSession, AgentAuthClientError, executeAgentCapability, createAgentAuthBearerToken, McpPlatformLive, runMcpEffect, createAgentAuthSignedFetch, setupMcpAgentCredential, generateAgentKeyPair, HERDR_CORE_GENERATION2, HERDR_CORE_INSTALL_COMMAND2, HerdrCoreMissing2, HerdrCoreIncompatible2, HerdrCoreConnectionLost2, HerdrCoreRpcError2, HerdrCoreUpdateFailed2, HerdrCore2, herdrCoreLayer2, herdrCoreTransportLayer2, updateHerdrCore2, CommandFailed2, runCommand2, withoutPreloads2, shellOutputTailChars2, runProcess2, CommandRunner2, runShell2, detectHarnesses2, kitHarnesses, isKitHarness, instructionsStart, instructionsEnd, harnessNames, renderMcpServer, materializeKitSetup, tomlInline, herdrExecutionExtension2, herdrNativeExtensionIds2, herdrRunnerCapabilitiesForRepoBinding2, herdrRunnerCapabilities2, assertHerdrRunnerCapability2, declaredChecks, installCommand, checkServicesFile, checkServices };
|