blun-king-cli 9.1.643 → 9.1.644
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/LIESMICH.txt +18 -0
- package/README.md +20 -6
- package/bin/blun.js +3 -3
- package/bin/king.js +3 -3
- package/bin/launcher-mode.js +125 -126
- package/bin/launcher-runtime.js +603 -616
- package/bin/plugin-bootstrap.js +339 -405
- package/bin/rename-private-staging.cjs +2 -2
- package/bin/retired-bundled-plugins.cjs +84 -0
- package/bin/startup-security-host.cjs +105 -0
- package/bin/startup-security.cjs +9 -105
- package/bin/startup-warning-policy.cjs +22 -0
- package/bin/update-lease-installer.cjs +125 -0
- package/bin/update-lease-sockets.cjs +228 -0
- package/bin/update-lease.js +22 -327
- package/bin/verify-bundled-agent-sources.cjs +2 -4
- package/blun.mjs +18 -179
- package/bundled-agent-sources.json +1 -552
- package/package.json +1 -5
- package/tool-liveness642/receipt.json +1 -1
- package/worker-host.mjs +3 -119
- package/agent-spine-plugin/.claude-plugin/marketplace.json +0 -20
- package/agent-spine-plugin/.claude-plugin/plugin.json +0 -14
- package/agent-spine-plugin/.codex-plugin/plugin.json +0 -47
- package/agent-spine-plugin/.mcp.json +0 -8
- package/agent-spine-plugin/CHANGELOG.md +0 -1614
- package/agent-spine-plugin/LICENSE +0 -186
- package/agent-spine-plugin/README.md +0 -432
- package/agent-spine-plugin/assets/agentspine-banner.svg +0 -32
- package/agent-spine-plugin/bin/agentspine-mcp.js +0 -4
- package/agent-spine-plugin/bin/agentspine.js +0 -7
- package/agent-spine-plugin/blun.plugin.json +0 -68
- package/agent-spine-plugin/docs/acceptance.md +0 -61
- package/agent-spine-plugin/docs/artifact-evaluation.md +0 -93
- package/agent-spine-plugin/docs/host-integration.md +0 -193
- package/agent-spine-plugin/docs/preflight-recall.md +0 -71
- package/agent-spine-plugin/docs/preservation-contract.md +0 -53
- package/agent-spine-plugin/docs/quality-gates.md +0 -50
- package/agent-spine-plugin/docs/session-timeline.md +0 -112
- package/agent-spine-plugin/docs/source-roots.md +0 -113
- package/agent-spine-plugin/docs/world-model.md +0 -119
- package/agent-spine-plugin/hooks/codex.json +0 -47
- package/agent-spine-plugin/hooks/hooks.json +0 -106
- package/agent-spine-plugin/hooks/version.json +0 -5
- package/agent-spine-plugin/package.json +0 -77
- package/agent-spine-plugin/scripts/check-codex-install.js +0 -226
- package/agent-spine-plugin/scripts/check-hosts.js +0 -208
- package/agent-spine-plugin/scripts/check-install-hook.js +0 -227
- package/agent-spine-plugin/scripts/check-install-selfstarter.js +0 -154
- package/agent-spine-plugin/scripts/check-install.js +0 -478
- package/agent-spine-plugin/scripts/check-line-budget.js +0 -58
- package/agent-spine-plugin/scripts/check-syntax.js +0 -29
- package/agent-spine-plugin/scripts/github-actions.js +0 -11
- package/agent-spine-plugin/scripts/hermetic-process.js +0 -191
- package/agent-spine-plugin/scripts/release-check.js +0 -150
- package/agent-spine-plugin/scripts/run-acceptance.js +0 -19
- package/agent-spine-plugin/scripts/run-checks.js +0 -50
- package/agent-spine-plugin/scripts/run-tests-hermetic.js +0 -112
- package/agent-spine-plugin/skills/agent-spine/SKILL.md +0 -99
- package/agent-spine-plugin/spine-example/1-identity.md +0 -12
- package/agent-spine-plugin/spine-example/2-voice.md +0 -6
- package/agent-spine-plugin/spine-example/3-conduct.md +0 -8
- package/agent-spine-plugin/spine-example/4-history.md +0 -4
- package/agent-spine-plugin/src/cli-agent.js +0 -315
- package/agent-spine-plugin/src/cli-attention.js +0 -95
- package/agent-spine-plugin/src/cli-autonomy.js +0 -36
- package/agent-spine-plugin/src/cli-common.js +0 -71
- package/agent-spine-plugin/src/cli-continuity.js +0 -116
- package/agent-spine-plugin/src/cli-core.js +0 -128
- package/agent-spine-plugin/src/cli-diagnostics.js +0 -291
- package/agent-spine-plugin/src/cli-host.js +0 -21
- package/agent-spine-plugin/src/cli-learning.js +0 -320
- package/agent-spine-plugin/src/cli-premortem.js +0 -16
- package/agent-spine-plugin/src/cli-sharing.js +0 -230
- package/agent-spine-plugin/src/cli.js +0 -181
- package/agent-spine-plugin/src/codex-reader-launcher.js +0 -182
- package/agent-spine-plugin/src/hook.js +0 -500
- package/agent-spine-plugin/src/index.js +0 -108
- package/agent-spine-plugin/src/lib/acceptance.js +0 -435
- package/agent-spine-plugin/src/lib/action-lesson-recall.js +0 -118
- package/agent-spine-plugin/src/lib/attention-context.js +0 -167
- package/agent-spine-plugin/src/lib/attention-events.js +0 -113
- package/agent-spine-plugin/src/lib/attention-privacy.js +0 -72
- package/agent-spine-plugin/src/lib/attention-schema.js +0 -164
- package/agent-spine-plugin/src/lib/attention-storage.js +0 -93
- package/agent-spine-plugin/src/lib/attention.js +0 -164
- package/agent-spine-plugin/src/lib/audit-premortem.js +0 -223
- package/agent-spine-plugin/src/lib/audit.js +0 -401
- package/agent-spine-plugin/src/lib/authentication.js +0 -515
- package/agent-spine-plugin/src/lib/autonomy-policy.js +0 -110
- package/agent-spine-plugin/src/lib/autonomy-store.js +0 -202
- package/agent-spine-plugin/src/lib/autonomy.js +0 -8
- package/agent-spine-plugin/src/lib/briefing.js +0 -493
- package/agent-spine-plugin/src/lib/catalog-document-read.js +0 -51
- package/agent-spine-plugin/src/lib/catalog.js +0 -167
- package/agent-spine-plugin/src/lib/channel-continuity.js +0 -19
- package/agent-spine-plugin/src/lib/channel-runtime.js +0 -665
- package/agent-spine-plugin/src/lib/codex-installation.js +0 -231
- package/agent-spine-plugin/src/lib/codex-skill-installation.js +0 -211
- package/agent-spine-plugin/src/lib/context.js +0 -156
- package/agent-spine-plugin/src/lib/continuity.js +0 -338
- package/agent-spine-plugin/src/lib/coordination.js +0 -577
- package/agent-spine-plugin/src/lib/delivery-agent-usage.js +0 -231
- package/agent-spine-plugin/src/lib/delivery-assignment.js +0 -220
- package/agent-spine-plugin/src/lib/delivery-command-actions.js +0 -462
- package/agent-spine-plugin/src/lib/delivery-knowledge.js +0 -78
- package/agent-spine-plugin/src/lib/delivery-premortem-binding.js +0 -107
- package/agent-spine-plugin/src/lib/delivery-premortem-closure.js +0 -171
- package/agent-spine-plugin/src/lib/delivery-premortem-codec.js +0 -45
- package/agent-spine-plugin/src/lib/delivery-premortem-correction.js +0 -101
- package/agent-spine-plugin/src/lib/delivery-premortem-file.js +0 -21
- package/agent-spine-plugin/src/lib/delivery-premortem-index.js +0 -493
- package/agent-spine-plugin/src/lib/delivery-premortem-inspection.js +0 -37
- package/agent-spine-plugin/src/lib/delivery-premortem-recovery.js +0 -120
- package/agent-spine-plugin/src/lib/delivery-premortem-rejection.js +0 -65
- package/agent-spine-plugin/src/lib/delivery-premortem-results.js +0 -28
- package/agent-spine-plugin/src/lib/delivery-premortem-session-guard.js +0 -46
- package/agent-spine-plugin/src/lib/delivery-premortem-write-ledger.js +0 -285
- package/agent-spine-plugin/src/lib/delivery-premortem.js +0 -499
- package/agent-spine-plugin/src/lib/delivery-shell-heredoc.js +0 -115
- package/agent-spine-plugin/src/lib/delivery-shell-substitutions.js +0 -111
- package/agent-spine-plugin/src/lib/delivery-shell-wrapper.js +0 -64
- package/agent-spine-plugin/src/lib/delivery-target.js +0 -73
- package/agent-spine-plugin/src/lib/delivery-verification.js +0 -445
- package/agent-spine-plugin/src/lib/documents.js +0 -239
- package/agent-spine-plugin/src/lib/feed-transport.js +0 -499
- package/agent-spine-plugin/src/lib/filesystem-retry.js +0 -34
- package/agent-spine-plugin/src/lib/gateway-common.js +0 -68
- package/agent-spine-plugin/src/lib/gateway-control.js +0 -370
- package/agent-spine-plugin/src/lib/gateway-delivery.js +0 -103
- package/agent-spine-plugin/src/lib/gateway-execution.js +0 -350
- package/agent-spine-plugin/src/lib/gateway-group-response.js +0 -128
- package/agent-spine-plugin/src/lib/gateway-host-fencing.js +0 -92
- package/agent-spine-plugin/src/lib/gateway-host-lifecycle.js +0 -193
- package/agent-spine-plugin/src/lib/gateway-inspection.js +0 -85
- package/agent-spine-plugin/src/lib/gateway-knowledge.js +0 -129
- package/agent-spine-plugin/src/lib/gateway-policy-provenance.js +0 -197
- package/agent-spine-plugin/src/lib/gateway-premortem-disposition.js +0 -82
- package/agent-spine-plugin/src/lib/gateway-premortem.js +0 -363
- package/agent-spine-plugin/src/lib/gateway-prepared-host.js +0 -28
- package/agent-spine-plugin/src/lib/gateway-runs.js +0 -345
- package/agent-spine-plugin/src/lib/gateway-runtime-identity.js +0 -31
- package/agent-spine-plugin/src/lib/gateway-runtime-records.js +0 -21
- package/agent-spine-plugin/src/lib/gateway-runtime.js +0 -18
- package/agent-spine-plugin/src/lib/gateway-state-transaction.js +0 -356
- package/agent-spine-plugin/src/lib/gateway-state.js +0 -344
- package/agent-spine-plugin/src/lib/graph.js +0 -337
- package/agent-spine-plugin/src/lib/hook-artifact-guards.js +0 -356
- package/agent-spine-plugin/src/lib/hook-audit.js +0 -43
- package/agent-spine-plugin/src/lib/hook-briefing-use.js +0 -78
- package/agent-spine-plugin/src/lib/hook-context.js +0 -441
- package/agent-spine-plugin/src/lib/hook-final-message.js +0 -26
- package/agent-spine-plugin/src/lib/hook-input.js +0 -27
- package/agent-spine-plugin/src/lib/hook-output.js +0 -284
- package/agent-spine-plugin/src/lib/hook-premortem.js +0 -257
- package/agent-spine-plugin/src/lib/hook-process-advisory.js +0 -36
- package/agent-spine-plugin/src/lib/hook-protection.js +0 -95
- package/agent-spine-plugin/src/lib/hook-stop-verification.js +0 -84
- package/agent-spine-plugin/src/lib/hook-timeline.js +0 -102
- package/agent-spine-plugin/src/lib/host-instruction-budget.js +0 -11
- package/agent-spine-plugin/src/lib/https-transport.js +0 -392
- package/agent-spine-plugin/src/lib/identifier-analysis.js +0 -446
- package/agent-spine-plugin/src/lib/indexed-memory-offline.js +0 -40
- package/agent-spine-plugin/src/lib/indexed-memory.js +0 -298
- package/agent-spine-plugin/src/lib/knowledge-evidence.js +0 -431
- package/agent-spine-plugin/src/lib/learning-applications.js +0 -441
- package/agent-spine-plugin/src/lib/learning-artifact-evaluator.js +0 -114
- package/agent-spine-plugin/src/lib/learning-candidates.js +0 -274
- package/agent-spine-plugin/src/lib/learning-context.js +0 -137
- package/agent-spine-plugin/src/lib/learning-delivery-contracts.js +0 -310
- package/agent-spine-plugin/src/lib/learning-evaluation-contracts.js +0 -350
- package/agent-spine-plugin/src/lib/learning-evaluation-registration.js +0 -372
- package/agent-spine-plugin/src/lib/learning-evaluation-revocation.js +0 -292
- package/agent-spine-plugin/src/lib/learning-evidence-contracts.js +0 -321
- package/agent-spine-plugin/src/lib/learning-findings.js +0 -458
- package/agent-spine-plugin/src/lib/learning-measurement-contracts.js +0 -285
- package/agent-spine-plugin/src/lib/learning-measurements.js +0 -265
- package/agent-spine-plugin/src/lib/learning-outcome-contracts.js +0 -165
- package/agent-spine-plugin/src/lib/learning-outcomes.js +0 -343
- package/agent-spine-plugin/src/lib/learning-reconciliation.js +0 -290
- package/agent-spine-plugin/src/lib/learning-retry-contracts.js +0 -188
- package/agent-spine-plugin/src/lib/learning-schema.js +0 -229
- package/agent-spine-plugin/src/lib/learning-scope-targets.js +0 -424
- package/agent-spine-plugin/src/lib/learning-state-upgrade.js +0 -477
- package/agent-spine-plugin/src/lib/learning-status-configuration.js +0 -476
- package/agent-spine-plugin/src/lib/learning-storage.js +0 -203
- package/agent-spine-plugin/src/lib/learning-trial-recovery.js +0 -218
- package/agent-spine-plugin/src/lib/learning-validation-contracts.js +0 -375
- package/agent-spine-plugin/src/lib/learning-validation-renewal.js +0 -298
- package/agent-spine-plugin/src/lib/learning-validation-runtime.js +0 -234
- package/agent-spine-plugin/src/lib/learning.js +0 -36
- package/agent-spine-plugin/src/lib/lesson-recall-session.js +0 -172
- package/agent-spine-plugin/src/lib/mcp-autonomy-tools.js +0 -37
- package/agent-spine-plugin/src/lib/mcp-delivery-completion.js +0 -124
- package/agent-spine-plugin/src/lib/mcp-delivery-tools.js +0 -45
- package/agent-spine-plugin/src/lib/mcp-premortem.js +0 -68
- package/agent-spine-plugin/src/lib/mcp-runtime.js +0 -355
- package/agent-spine-plugin/src/lib/mcp-source-context.js +0 -61
- package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +0 -240
- package/agent-spine-plugin/src/lib/mcp-world-tools.js +0 -52
- package/agent-spine-plugin/src/lib/object-transport.js +0 -206
- package/agent-spine-plugin/src/lib/owned-file-lock.js +0 -182
- package/agent-spine-plugin/src/lib/paths.js +0 -109
- package/agent-spine-plugin/src/lib/peer-transport.js +0 -283
- package/agent-spine-plugin/src/lib/persona-runtime.js +0 -581
- package/agent-spine-plugin/src/lib/pre-answer-timeline-recall.js +0 -104
- package/agent-spine-plugin/src/lib/preflight-delivery-id.js +0 -27
- package/agent-spine-plugin/src/lib/preflight.js +0 -688
- package/agent-spine-plugin/src/lib/project-portfolio.js +0 -176
- package/agent-spine-plugin/src/lib/runtime.js +0 -13
- package/agent-spine-plugin/src/lib/selfstarter-core.js +0 -382
- package/agent-spine-plugin/src/lib/selfstarter-jobs.js +0 -149
- package/agent-spine-plugin/src/lib/selfstarter-lease.js +0 -204
- package/agent-spine-plugin/src/lib/selfstarter-policy.js +0 -90
- package/agent-spine-plugin/src/lib/selfstarter-workspace.js +0 -111
- package/agent-spine-plugin/src/lib/selfstarter.js +0 -11
- package/agent-spine-plugin/src/lib/session-timeline-auth.js +0 -316
- package/agent-spine-plugin/src/lib/session-timeline-codex.js +0 -69
- package/agent-spine-plugin/src/lib/session-timeline-contract.js +0 -56
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +0 -38
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +0 -128
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +0 -15
- package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +0 -478
- package/agent-spine-plugin/src/lib/session-timeline-event-extract.js +0 -186
- package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +0 -73
- package/agent-spine-plugin/src/lib/session-timeline-host-receipt.js +0 -117
- package/agent-spine-plugin/src/lib/session-timeline-invocation.js +0 -201
- package/agent-spine-plugin/src/lib/session-timeline-king.js +0 -93
- package/agent-spine-plugin/src/lib/session-timeline-prior.js +0 -57
- package/agent-spine-plugin/src/lib/session-timeline-provider.js +0 -36
- package/agent-spine-plugin/src/lib/session-timeline-query.js +0 -56
- package/agent-spine-plugin/src/lib/session-timeline-results.js +0 -56
- package/agent-spine-plugin/src/lib/session-timeline-root.js +0 -11
- package/agent-spine-plugin/src/lib/session-timeline-search.js +0 -82
- package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +0 -213
- package/agent-spine-plugin/src/lib/session-timeline-source-open.js +0 -30
- package/agent-spine-plugin/src/lib/session-timeline-source.js +0 -80
- package/agent-spine-plugin/src/lib/session-timeline-state.js +0 -45
- package/agent-spine-plugin/src/lib/session-timeline-transport.js +0 -42
- package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +0 -145
- package/agent-spine-plugin/src/lib/session-timeline.js +0 -462
- package/agent-spine-plugin/src/lib/sharing.js +0 -969
- package/agent-spine-plugin/src/lib/source-roots.js +0 -475
- package/agent-spine-plugin/src/lib/source-tree-scan.js +0 -178
- package/agent-spine-plugin/src/lib/sqlite-transport.js +0 -501
- package/agent-spine-plugin/src/lib/task-knowledge-context.js +0 -99
- package/agent-spine-plugin/src/lib/telegram-adapter.js +0 -119
- package/agent-spine-plugin/src/lib/timeline-continuation-update.js +0 -100
- package/agent-spine-plugin/src/lib/timeline-tool-guard.js +0 -225
- package/agent-spine-plugin/src/lib/timeline-user-feedback.js +0 -216
- package/agent-spine-plugin/src/lib/timeline-world-capture.js +0 -233
- package/agent-spine-plugin/src/lib/voice-runtime.js +0 -39
- package/agent-spine-plugin/src/lib/world-knowledge.js +0 -306
- package/agent-spine-plugin/src/lib/world-model.js +0 -333
- package/agent-spine-plugin/src/mcp.js +0 -456
- package/agent-spine-plugin/src/version.js +0 -1
- package/agent-spine-plugin/src/worker.js +0 -257
- package/bin/agentspine-king-goal-inbox.mjs +0 -127
- package/bin/agentspine-king-goal-intake.mjs +0 -106
- package/bin/agentspine-king-host-runner.mjs +0 -109
- package/bin/agentspine-king-snapshot-policy.cjs +0 -80
- package/bin/agentspine-king-status-policy.mjs +0 -226
- package/bin/agentspine-king-worker-host.mjs +0 -160
- package/bin/managed-plugin-selection.cjs +0 -141
- package/bin/verify-agent-behavior.cjs +0 -122
- package/bin/verify-agent-components.cjs +0 -104
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
|
|
3
|
-
export function parseCli(argv) {
|
|
4
|
-
const [command = "help", ...rest] = argv;
|
|
5
|
-
const flags = {};
|
|
6
|
-
const positional = [];
|
|
7
|
-
for (let index = 0; index < rest.length; index += 1) {
|
|
8
|
-
const token = rest[index];
|
|
9
|
-
if (!token.startsWith("--")) {
|
|
10
|
-
positional.push(token);
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
const [name, inline] = token.slice(2).split("=", 2);
|
|
14
|
-
if (inline !== undefined) flags[name] = inline;
|
|
15
|
-
else if (rest[index + 1] && !rest[index + 1].startsWith("--")) flags[name] = rest[++index];
|
|
16
|
-
else flags[name] = true;
|
|
17
|
-
}
|
|
18
|
-
return { command, flags, positional };
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function outputCli(value, json = false) {
|
|
22
|
-
if (json) {
|
|
23
|
-
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (typeof value === "string") process.stdout.write(`${value}\n`);
|
|
27
|
-
else process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function booleanFlag(value, fallback = false) {
|
|
31
|
-
if (value === undefined) return fallback;
|
|
32
|
-
if (value === true || value === "true" || value === "1") return true;
|
|
33
|
-
if (value === false || value === "false" || value === "0") return false;
|
|
34
|
-
throw new Error(`expected boolean flag, received: ${value}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export async function goalPlanFlag(path) {
|
|
38
|
-
if (!path) return null;
|
|
39
|
-
const content = await readFile(path, "utf8");
|
|
40
|
-
if (Buffer.byteLength(content) > 64 * 1024) throw new Error("goal plan exceeds 64 KiB");
|
|
41
|
-
const parsed = JSON.parse(content);
|
|
42
|
-
const steps = Array.isArray(parsed) ? parsed : parsed?.steps;
|
|
43
|
-
if (!Array.isArray(steps)) throw new Error("goal plan must be a JSON array or an object with a steps array");
|
|
44
|
-
return steps;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function learningScope(flags) {
|
|
48
|
-
return {
|
|
49
|
-
personaId: flags.persona || null,
|
|
50
|
-
userId: flags.user || null,
|
|
51
|
-
tenantId: flags.tenant || null,
|
|
52
|
-
projectId: flags.project || null,
|
|
53
|
-
groupId: flags.group || null,
|
|
54
|
-
taskId: flags.task || null
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function hasLearningScope(flags) {
|
|
59
|
-
return ["persona", "user", "tenant", "project", "group", "task"]
|
|
60
|
-
.some((name) => flags[name] !== undefined);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function evaluatorRootsFlag(value) {
|
|
64
|
-
return String(value || "").split(",").filter(Boolean).map((entry) => {
|
|
65
|
-
const separator = entry.lastIndexOf("=");
|
|
66
|
-
if (separator <= 0) throw new Error("evaluator roots must use evaluator-id=sha256 entries");
|
|
67
|
-
return { evaluatorId: entry.slice(0, separator), principalDigest: entry.slice(separator + 1) };
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export { outputCli as output, parseCli as parse };
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { configureContinuity, loadContinuity, purgeContinuity } from "./lib/continuity.js";
|
|
3
|
-
import { configurePreflightPolicy, confirmMustRemember, preflightStatus, proposeMustRemember, purgeMustRemember, rollbackMustRemember } from "./lib/preflight.js";
|
|
4
|
-
import { bindSourceRoot, inspectSourceRegistry, purgeSourceBinding, resolveHostSourceCatalog, rollbackSourceBinding } from "./lib/source-roots.js";
|
|
5
|
-
import { booleanFlag, output } from "./cli-common.js";
|
|
6
|
-
|
|
7
|
-
export const continuityCommands = new Set([
|
|
8
|
-
"continuity-config",
|
|
9
|
-
"continuity-status",
|
|
10
|
-
"continuity-purge",
|
|
11
|
-
"preflight-policy",
|
|
12
|
-
"preflight-status",
|
|
13
|
-
"remember-propose",
|
|
14
|
-
"remember-confirm",
|
|
15
|
-
"remember-rollback",
|
|
16
|
-
"remember-purge",
|
|
17
|
-
"source-status",
|
|
18
|
-
"source-bind",
|
|
19
|
-
"source-rollback",
|
|
20
|
-
"source-purge"
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
export async function runContinuityCommand({ command, flags, positional, json }) {
|
|
24
|
-
if (command === "continuity-config") {
|
|
25
|
-
const root = positional[0] || process.cwd();
|
|
26
|
-
const config = {};
|
|
27
|
-
if (flags.enabled !== undefined) config.enabled = booleanFlag(flags.enabled);
|
|
28
|
-
if (flags.entity !== undefined) config.defaultEntityId = flags.entity === "none" ? null : flags.entity;
|
|
29
|
-
if (flags.project !== undefined) config.defaultProjectId = flags.project === "none" ? null : flags.project;
|
|
30
|
-
if (flags["min-confidence"] !== undefined) config.minConfidence = Number(flags["min-confidence"]);
|
|
31
|
-
if (flags["min-directness"] !== undefined) config.minDirectness = Number(flags["min-directness"]);
|
|
32
|
-
if (flags["min-evidence"] !== undefined) config.minEvidence = Number(flags["min-evidence"]);
|
|
33
|
-
if (flags["max-prompt-bytes"] !== undefined) config.maxPromptBytes = Number(flags["max-prompt-bytes"]);
|
|
34
|
-
if (flags["max-briefing-bytes"] !== undefined) config.maxBriefingBytes = Number(flags["max-briefing-bytes"]);
|
|
35
|
-
if (!Object.keys(config).length) return output((await loadContinuity(root)).continuity.config, json);
|
|
36
|
-
return output(await configureContinuity({
|
|
37
|
-
root, config,
|
|
38
|
-
confirmation: booleanFlag(flags["confirm-local-opt-in"]) ? "local-user-opt-in" : null
|
|
39
|
-
}), json);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (command === "continuity-status") {
|
|
43
|
-
const { continuity, continuityPath } = await loadContinuity(positional[0] || process.cwd());
|
|
44
|
-
return output({
|
|
45
|
-
schema: continuity.schema, config: continuity.config,
|
|
46
|
-
signals: continuity.signals.length, history: continuity.history.length,
|
|
47
|
-
continuityPath, authority: "context-only"
|
|
48
|
-
}, json);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (command === "continuity-purge") {
|
|
52
|
-
return output(await purgeContinuity({
|
|
53
|
-
root: flags.root || process.cwd(), subjectId: positional[0],
|
|
54
|
-
confirmation: booleanFlag(flags["confirm-local-purge"]) ? "local-user-confirmed" : null
|
|
55
|
-
}), json);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (command === "preflight-policy") {
|
|
59
|
-
if (!positional[0]) throw new Error("preflight-policy requires one local JSON policy file");
|
|
60
|
-
const profile = JSON.parse(await readFile(positional[0], "utf8"));
|
|
61
|
-
return output(await configurePreflightPolicy({ profile,
|
|
62
|
-
confirmation: booleanFlag(flags["confirm-local-policy"]) ? "local-owner-confirmed" : null }), json);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (command === "preflight-status") return output(await preflightStatus(), json);
|
|
66
|
-
|
|
67
|
-
if (command === "remember-propose") {
|
|
68
|
-
return output(await proposeMustRemember({ claim: flags.claim, kind: flags.kind || "critical",
|
|
69
|
-
userId: flags.user, tenantId: flags.tenant, projectId: flags.project || null,
|
|
70
|
-
groupId: flags.group || null, taskId: flags.task || null, sourceDigest: flags["source-digest"] || null }), json);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (command === "remember-confirm") {
|
|
74
|
-
return output(await confirmMustRemember({ candidateId: positional[0], supersedes: flags.supersedes || null,
|
|
75
|
-
confirmation: booleanFlag(flags["confirm-local-user"]) ? "local-user-confirmed" : null }), json);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (command === "remember-rollback") {
|
|
79
|
-
return output(await rollbackMustRemember({ id: positional[0],
|
|
80
|
-
confirmation: booleanFlag(flags["confirm-local-user"]) ? "local-user-confirmed" : null }), json);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (command === "remember-purge") {
|
|
84
|
-
return output(await purgeMustRemember({ id: positional[0],
|
|
85
|
-
confirmation: booleanFlag(flags["confirm-local-purge"]) ? "local-user-purge-confirmed" : null }), json);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (command === "source-status") {
|
|
89
|
-
const host = flags.host || process.env.AGENTSPINE_HOST;
|
|
90
|
-
if (!["claude", "codex"].includes(host)) throw new Error("source-status requires --host claude or --host codex");
|
|
91
|
-
const resolved = await resolveHostSourceCatalog({ host, cwd: flags.cwd || process.cwd() });
|
|
92
|
-
const registry = await inspectSourceRegistry();
|
|
93
|
-
return output({ diagnostics: resolved.diagnostics, sources: resolved.catalog.documents.map((item) => ({
|
|
94
|
-
id: item.relativePath, scope: item.sourceScope, binding: item.sourceBinding, sha256: item.sha256,
|
|
95
|
-
bytes: item.bytes, authority: item.authority
|
|
96
|
-
})), bindings: registry.registry.bindings, authority: "context-only" }, json);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (command === "source-bind") {
|
|
100
|
-
return output(await bindSourceRoot({
|
|
101
|
-
host: flags.host, hostHome: flags["host-home"] || process.env.CLAUDE_CONFIG_DIR || process.env.CODEX_HOME || process.cwd(),
|
|
102
|
-
projectRoot: flags.project || process.cwd(), sourceRoot: positional[0], scope: flags.scope || "state-user",
|
|
103
|
-
confirmation: booleanFlag(flags["confirm-local-binding"]) ? "local-user-confirmed" : null
|
|
104
|
-
}), json);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (command === "source-rollback") {
|
|
108
|
-
return output(await rollbackSourceBinding({ id: positional[0],
|
|
109
|
-
confirmation: booleanFlag(flags["confirm-local-binding"]) ? "local-user-confirmed" : null }), json);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (command === "source-purge") {
|
|
113
|
-
return output(await purgeSourceBinding({ id: positional[0],
|
|
114
|
-
confirmation: booleanFlag(flags["confirm-local-binding"]) ? "local-user-confirmed" : null }), json);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { scanAndSave, verifyCatalog } from "./lib/catalog.js";
|
|
2
|
-
import { readDocument, resolveContext } from "./lib/context.js";
|
|
3
|
-
import { sessionBriefing } from "./lib/briefing.js";
|
|
4
|
-
import { annotateDocument, linkDocuments, linkEntities, relationshipContext, upsertEntity } from "./lib/graph.js";
|
|
5
|
-
import { renderAcceptanceReport, runVisibleAcceptance } from "./lib/acceptance.js";
|
|
6
|
-
import { booleanFlag, output } from "./cli-common.js";
|
|
7
|
-
|
|
8
|
-
export const coreCommands = new Set([
|
|
9
|
-
"acceptance",
|
|
10
|
-
"scan",
|
|
11
|
-
"context",
|
|
12
|
-
"briefing",
|
|
13
|
-
"read",
|
|
14
|
-
"verify",
|
|
15
|
-
"link",
|
|
16
|
-
"annotate",
|
|
17
|
-
"entity",
|
|
18
|
-
"relate",
|
|
19
|
-
"relationships"
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
export async function runCoreCommand({ command, flags, positional, json }) {
|
|
23
|
-
if (command === "acceptance") {
|
|
24
|
-
if (positional.length || Object.keys(flags).some((name) => name !== "json")) {
|
|
25
|
-
throw new Error("acceptance supports only --json");
|
|
26
|
-
}
|
|
27
|
-
const report = await runVisibleAcceptance();
|
|
28
|
-
if (json) return output(report, true);
|
|
29
|
-
process.stdout.write(renderAcceptanceReport(report));
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (command === "scan") {
|
|
34
|
-
const result = await scanAndSave(positional[0] || process.cwd());
|
|
35
|
-
return output(json ? result : {
|
|
36
|
-
root: result.catalog.root,
|
|
37
|
-
catalog: result.catalogPath,
|
|
38
|
-
documents: result.catalog.summary.total,
|
|
39
|
-
protected: result.catalog.summary.protected,
|
|
40
|
-
layers: result.catalog.summary.byLayer
|
|
41
|
-
}, json);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (command === "context") {
|
|
45
|
-
const root = positional[0] || process.cwd();
|
|
46
|
-
const result = await resolveContext({
|
|
47
|
-
root,
|
|
48
|
-
cwd: flags.cwd || root,
|
|
49
|
-
host: flags.host || "generic",
|
|
50
|
-
maxBytes: Number(flags["max-bytes"] || 65536),
|
|
51
|
-
includeContent: flags["no-content"] !== true
|
|
52
|
-
});
|
|
53
|
-
return output(result, json);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (command === "briefing") {
|
|
57
|
-
const root = positional[0] || process.cwd();
|
|
58
|
-
return output(await sessionBriefing({
|
|
59
|
-
root, cwd: flags.cwd || root, host: flags.host || "generic",
|
|
60
|
-
entityId: flags.entity || null, groupId: flags.group || null,
|
|
61
|
-
userId: flags.user || null, tenantId: flags.tenant || null,
|
|
62
|
-
projectId: flags.project || null, currentTaskId: flags["current-task"] || null,
|
|
63
|
-
includePrivate: booleanFlag(flags["include-private"]),
|
|
64
|
-
focusActive: !booleanFlag(flags["allow-attention"]),
|
|
65
|
-
includeSourceContent: !booleanFlag(flags["no-source-content"]),
|
|
66
|
-
maxBytes: Number(flags["max-bytes"] ?? 16384)
|
|
67
|
-
}), json);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (command === "read") {
|
|
71
|
-
const result = await readDocument({
|
|
72
|
-
root: flags.root || process.cwd(),
|
|
73
|
-
path: positional[0],
|
|
74
|
-
offset: Number(flags.offset || 0),
|
|
75
|
-
length: Number(flags.length || 65536)
|
|
76
|
-
});
|
|
77
|
-
return output(json ? result : result.content, json);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (command === "verify") {
|
|
81
|
-
const result = await verifyCatalog(positional[0] || process.cwd());
|
|
82
|
-
output(result, json);
|
|
83
|
-
if (!result.ok) process.exitCode = 1;
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (command === "link") {
|
|
88
|
-
const result = await linkDocuments({
|
|
89
|
-
root: flags.root || process.cwd(), from: positional[0], to: positional[1],
|
|
90
|
-
relation: flags.relation || "related", reason: flags.reason || "",
|
|
91
|
-
confidence: Number(flags.confidence ?? 0.5)
|
|
92
|
-
});
|
|
93
|
-
return output(result, json);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (command === "annotate") {
|
|
97
|
-
const result = await annotateDocument({
|
|
98
|
-
root: flags.root || process.cwd(), path: positional[0], layer: flags.layer,
|
|
99
|
-
reason: flags.reason || "", confidence: Number(flags.confidence ?? 0.5)
|
|
100
|
-
});
|
|
101
|
-
return output(result, json);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (command === "entity") {
|
|
105
|
-
const result = await upsertEntity({
|
|
106
|
-
root: flags.root || process.cwd(), id: positional[0], kind: flags.kind,
|
|
107
|
-
displayName: flags.name || "", confidence: Number(flags.confidence ?? 0.5),
|
|
108
|
-
privacy: flags.privacy || "private"
|
|
109
|
-
});
|
|
110
|
-
return output(result, json);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (command === "relate") {
|
|
114
|
-
const result = await linkEntities({
|
|
115
|
-
root: flags.root || process.cwd(), from: positional[0], to: positional[1],
|
|
116
|
-
relation: flags.relation || "related", reason: flags.reason || "",
|
|
117
|
-
confidence: Number(flags.confidence ?? 0.5), privacy: flags.privacy || "private"
|
|
118
|
-
});
|
|
119
|
-
return output(result, json);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (command === "relationships") {
|
|
123
|
-
return output(await relationshipContext({
|
|
124
|
-
root: flags.root || process.cwd(), entityId: positional[0],
|
|
125
|
-
includePrivate: Boolean(flags["include-private"]), groupId: flags.group || null
|
|
126
|
-
}), json);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from "node:url";
|
|
2
|
-
import { runAudit } from "./lib/audit.js";
|
|
3
|
-
import { learningOutcomeStatus } from "./lib/learning.js";
|
|
4
|
-
import { checkHosts } from "../scripts/check-hosts.js";
|
|
5
|
-
import { resolveHostSourceCatalog } from "./lib/source-roots.js";
|
|
6
|
-
import { scanIndexedMemoryOrphans } from "./lib/indexed-memory-offline.js";
|
|
7
|
-
import { preflightStatus } from "./lib/preflight.js";
|
|
8
|
-
import { VERSION } from "./version.js";
|
|
9
|
-
import { booleanFlag, output } from "./cli-common.js";
|
|
10
|
-
|
|
11
|
-
export const diagnosticsCommands = new Set([
|
|
12
|
-
"doctor",
|
|
13
|
-
"audit",
|
|
14
|
-
"mcp"
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
export async function runDiagnosticsCommand({ command, flags, positional, json }) {
|
|
18
|
-
if (command === "doctor") {
|
|
19
|
-
let hostIntegration;
|
|
20
|
-
try {
|
|
21
|
-
hostIntegration = await checkHosts(fileURLToPath(new URL("..", import.meta.url)));
|
|
22
|
-
} catch (error) {
|
|
23
|
-
hostIntegration = { ok: false, error: error.message };
|
|
24
|
-
}
|
|
25
|
-
let sourceResolution = null;
|
|
26
|
-
let orphanScan = null;
|
|
27
|
-
const sourceHost = flags.host || process.env.AGENTSPINE_HOST;
|
|
28
|
-
if (["claude", "codex"].includes(sourceHost)) {
|
|
29
|
-
try {
|
|
30
|
-
const resolved = await resolveHostSourceCatalog({ host: sourceHost, cwd: flags.cwd || process.cwd() });
|
|
31
|
-
sourceResolution = resolved.diagnostics;
|
|
32
|
-
if (booleanFlag(flags["offline-memory-orphans"])) {
|
|
33
|
-
if (sourceHost !== "claude" || !resolved.memoryRoot) throw new Error("offline memory orphan scan requires a resolved Claude project-memory root");
|
|
34
|
-
orphanScan = await scanIndexedMemoryOrphans(resolved.memoryRoot);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch (error) { sourceResolution = { status: "failed-closed", reason: error.message }; }
|
|
38
|
-
}
|
|
39
|
-
let preflight;
|
|
40
|
-
try { preflight = await preflightStatus(); }
|
|
41
|
-
catch (error) { preflight = { status: "failed-closed", error: error.message }; }
|
|
42
|
-
let learningOutcomes;
|
|
43
|
-
try {
|
|
44
|
-
const status = await learningOutcomeStatus({ root: positional[0] || process.cwd() });
|
|
45
|
-
const unboundAfterReceipts = status.records.reduce((sum, item) => sum + item.afterReceipts - item.boundAfterReceipts, 0);
|
|
46
|
-
const undeliveredAfterReceipts = status.records.reduce((sum, item) => sum + item.afterReceipts - item.deliveredAfterReceipts, 0);
|
|
47
|
-
const stalePendingApplications = status.records.reduce((sum, item) => sum + item.stalePendingApplications, 0);
|
|
48
|
-
const totalOutcomeReceipts = status.records.reduce((sum, item) => sum + item.beforeReceipts + item.afterReceipts, 0);
|
|
49
|
-
const plannedOutcomeReceipts = status.records.reduce((sum, item) => sum + item.plannedOutcomeReceipts, 0);
|
|
50
|
-
const coverageBoundReceipts = status.records.reduce((sum, item) => sum + item.coverageBoundReceipts, 0);
|
|
51
|
-
const legacyCoverageReceipts = status.records.reduce((sum, item) => sum + item.legacyCoverageReceipts, 0);
|
|
52
|
-
const provenanceBoundReceipts = status.records.reduce((sum, item) => sum + item.provenanceBoundReceipts, 0);
|
|
53
|
-
const legacyProvenanceReceipts = status.records.reduce((sum, item) => sum + item.legacyProvenanceReceipts, 0);
|
|
54
|
-
const measurementReceipts = status.records.reduce((sum, item) => sum + item.measurementReceipts, 0);
|
|
55
|
-
const measurementLineageReceipts = status.records.reduce((sum, item) => sum + item.measurementLineageReceipts, 0);
|
|
56
|
-
const candidateEvidenceLineageReceipts = status.candidateEvidenceLineageReceipts;
|
|
57
|
-
const consumedMeasurementReceipts = status.records.reduce((sum, item) => sum + item.consumedMeasurementReceipts, 0);
|
|
58
|
-
const staleUnconsumedMeasurements = status.records.reduce((sum, item) => sum + item.staleUnconsumedMeasurements, 0);
|
|
59
|
-
const lineageBoundReceipts = status.records.reduce((sum, item) => sum + item.lineageBoundReceipts, 0);
|
|
60
|
-
const pairedOutcomeReceipts = status.records.reduce((sum, item) => sum + item.pairedOutcomeReceipts, 0);
|
|
61
|
-
const pairedEvaluatorPairs = status.records.reduce((sum, item) => sum + item.pairedEvaluatorPairs, 0);
|
|
62
|
-
const evaluatorRootBoundReceipts = status.records.reduce((sum, item) => sum + item.evaluatorRootBoundReceipts, 0);
|
|
63
|
-
const independentEvaluatorRoots = status.records.reduce((sum, item) => sum + item.independentEvaluatorRoots, 0);
|
|
64
|
-
const evaluatorRegistryContracts = status.records.reduce((sum, item) => sum + item.evaluatorRegistryContracts, 0);
|
|
65
|
-
const inactiveEvaluatorRegistryContracts = status.records.reduce((sum, item) => sum + item.inactiveEvaluatorRegistryContracts, 0);
|
|
66
|
-
const currentValidatedLessons = status.records.filter((item) => item.validationLeaseStatus === "current-validated").length;
|
|
67
|
-
const staleValidatedLessons = status.records.filter((item) => item.validationLeaseStatus === "stale-validated").length;
|
|
68
|
-
const unprovenValidatedLessons = status.records.filter((item) => item.validationLeaseStatus === "unproven-validated").length;
|
|
69
|
-
const revokedValidatedLessons = status.records.filter((item) => item.validationLeaseStatus === "revoked-validated").length;
|
|
70
|
-
const renewedValidationLeases = status.records.filter((item) =>
|
|
71
|
-
["agentspine.learning-validation/v2", "agentspine.learning-validation/v3",
|
|
72
|
-
"agentspine.learning-validation/v4", "agentspine.learning-validation/v5"].includes(item.validationLeaseSchema)).length;
|
|
73
|
-
const fixedCohortValidationLeases = status.records.filter((item) =>
|
|
74
|
-
["agentspine.learning-validation/v3", "agentspine.learning-validation/v4",
|
|
75
|
-
"agentspine.learning-validation/v5"]
|
|
76
|
-
.includes(item.validationLeaseSchema)).length;
|
|
77
|
-
const admissionBoundValidationLeases = status.records.filter((item) =>
|
|
78
|
-
["agentspine.learning-validation/v4", "agentspine.learning-validation/v5"]
|
|
79
|
-
.includes(item.validationLeaseSchema)).length;
|
|
80
|
-
const trialBoundValidationLeases = status.records.filter((item) =>
|
|
81
|
-
item.validationLeaseSchema === "agentspine.learning-validation/v5").length;
|
|
82
|
-
const activeRevalidations = status.records.filter((item) => item.revalidationStatus === "active").length;
|
|
83
|
-
const staleRevalidations = status.records.filter((item) => item.revalidationStatus === "stale").length;
|
|
84
|
-
const fixedCohortRevalidations = status.records.filter((item) =>
|
|
85
|
-
item.revalidationStatus === "active"
|
|
86
|
-
&& ["first-completed-turns", "first-admitted-turns",
|
|
87
|
-
"first-admitted-trials"].includes(item.revalidationSelectionMode)).length;
|
|
88
|
-
const admissionBoundRevalidations = status.records.filter((item) =>
|
|
89
|
-
item.revalidationStatus === "active" && ["first-admitted-turns", "first-admitted-trials"]
|
|
90
|
-
.includes(item.revalidationSelectionMode)).length;
|
|
91
|
-
const trialBoundRevalidations = status.records.filter((item) =>
|
|
92
|
-
item.revalidationStatus === "active" && item.revalidationSelectionMode === "first-admitted-trials").length;
|
|
93
|
-
const requiredRevalidationDeliveries = status.records.reduce((sum, item) =>
|
|
94
|
-
sum + item.revalidationRequiredDeliveries, 0);
|
|
95
|
-
const completedRevalidationDeliveries = status.records.reduce((sum, item) =>
|
|
96
|
-
sum + item.revalidationCompletedDeliveries, 0);
|
|
97
|
-
const admittedRevalidationApplications = status.records.reduce((sum, item) =>
|
|
98
|
-
sum + item.revalidationAdmittedApplications, 0);
|
|
99
|
-
const initialTrialContracts = status.records.filter((item) => item.initialTrialMode === "first-admitted-trials").length;
|
|
100
|
-
const requiredInitialTrials = status.records.reduce((sum, item) => sum + item.initialTrialSlots, 0);
|
|
101
|
-
const admittedInitialApplications = status.records.reduce((sum, item) =>
|
|
102
|
-
sum + item.initialAdmittedApplications, 0);
|
|
103
|
-
const completedInitialDeliveries = status.records.reduce((sum, item) =>
|
|
104
|
-
sum + item.initialCompletedDeliveries, 0);
|
|
105
|
-
const incompleteInitialAdmissions = status.records.reduce((sum, item) =>
|
|
106
|
-
sum + item.incompleteInitialAdmissions, 0);
|
|
107
|
-
const targetBoundEvaluationContracts = status.records.reduce((sum, item) =>
|
|
108
|
-
sum + item.targetBoundEvaluationContracts, 0);
|
|
109
|
-
const targetBoundApplications = status.records.reduce((sum, item) =>
|
|
110
|
-
sum + item.targetBoundApplications, 0);
|
|
111
|
-
const deadlineBoundEvaluationContracts = status.records.reduce((sum, item) =>
|
|
112
|
-
sum + item.deadlineBoundEvaluationContracts, 0);
|
|
113
|
-
const stalenessBoundEvaluationContracts = status.records.reduce((sum, item) =>
|
|
114
|
-
sum + item.stalenessBoundEvaluationContracts, 0);
|
|
115
|
-
const promotionBoundEvaluationContracts = status.records.reduce((sum, item) =>
|
|
116
|
-
sum + item.promotionBoundEvaluationContracts, 0);
|
|
117
|
-
const candidateAdmissionEvaluationContracts = status.records.reduce((sum, item) =>
|
|
118
|
-
sum + item.candidateAdmissionEvaluationContracts, 0);
|
|
119
|
-
const evidenceSourceAttestedEvaluationContracts = status.records.reduce((sum, item) =>
|
|
120
|
-
sum + item.evidenceSourceAttestedEvaluationContracts, 0);
|
|
121
|
-
const candidateEvidenceLineageEvaluationContracts = status.records.reduce((sum, item) =>
|
|
122
|
-
sum + item.candidateEvidenceLineageEvaluationContracts, 0);
|
|
123
|
-
const candidateEvidenceCohortEvaluationContracts = status.records.reduce((sum, item) =>
|
|
124
|
-
sum + item.candidateEvidenceCohortEvaluationContracts, 0);
|
|
125
|
-
const blockingDefectBoundEvaluationContracts = status.records.reduce((sum, item) =>
|
|
126
|
-
sum + item.blockingDefectBoundEvaluationContracts, 0);
|
|
127
|
-
const evidenceSourceBoundEvaluationContracts = status.records.reduce((sum, item) =>
|
|
128
|
-
sum + item.evidenceSourceBoundEvaluationContracts, 0);
|
|
129
|
-
const blockingDefectOutcomeReceipts = status.records.reduce((sum, item) =>
|
|
130
|
-
sum + item.blockingDefectOutcomeReceipts, 0);
|
|
131
|
-
const deadlineBoundApplications = status.records.reduce((sum, item) =>
|
|
132
|
-
sum + item.deadlineBoundApplications, 0);
|
|
133
|
-
const trialRetryEvaluationContracts = status.records.reduce((sum, item) =>
|
|
134
|
-
sum + item.trialRetryEvaluationContracts, 0);
|
|
135
|
-
const comparableTrialRetryEvaluationContracts = status.records.reduce((sum, item) =>
|
|
136
|
-
sum + item.comparableTrialRetryEvaluationContracts, 0);
|
|
137
|
-
const boundedTrialRetryEvaluationContracts = status.records.reduce((sum, item) =>
|
|
138
|
-
sum + item.boundedTrialRetryEvaluationContracts, 0);
|
|
139
|
-
const trialRetryExhaustionReceipts = status.records.reduce((sum, item) =>
|
|
140
|
-
sum + item.trialRetryExhaustionReceipts, 0);
|
|
141
|
-
const trialFailureReceipts = status.records.reduce((sum, item) => sum + item.trialFailureReceipts, 0);
|
|
142
|
-
const trialFailureRevocationReceipts = status.records.reduce((sum, item) =>
|
|
143
|
-
sum + item.trialFailureRevocationReceipts, 0);
|
|
144
|
-
const evaluationRevocationReceipts = status.records.reduce((sum, item) => sum + item.evaluationRevocationReceipts, 0);
|
|
145
|
-
const evidenceSourceAttestationRevocationReceipts = status.records.reduce((sum, item) =>
|
|
146
|
-
sum + item.evidenceSourceAttestationRevocationReceipts, 0);
|
|
147
|
-
const validationRevocationReceipts = status.records.reduce((sum, item) => sum + item.validationRevocationReceipts, 0);
|
|
148
|
-
const evidenceRevocationReceipts = status.records.reduce((sum, item) => sum + item.evidenceRevocationReceipts, 0);
|
|
149
|
-
const measurementRevocationReceipts = status.records.reduce((sum, item) => sum + item.measurementRevocationReceipts, 0);
|
|
150
|
-
const applicationRevocationReceipts = status.records.reduce((sum, item) => sum + item.applicationRevocationReceipts, 0);
|
|
151
|
-
const deliveryRevocationReceipts = status.records.reduce((sum, item) => sum + item.deliveryRevocationReceipts, 0);
|
|
152
|
-
const outcomeRevocationReceipts = status.records.reduce((sum, item) => sum + item.outcomeRevocationReceipts, 0);
|
|
153
|
-
const deliveryTimeoutFailures = status.records.reduce((sum, item) => sum + item.deliveryTimeoutFailures, 0);
|
|
154
|
-
const outcomeTimeoutFailures = status.records.reduce((sum, item) => sum + item.outcomeTimeoutFailures, 0);
|
|
155
|
-
const pendingInitialOutcomes = status.records.reduce((sum, item) => sum + item.pendingInitialOutcomes, 0);
|
|
156
|
-
const staleInitialOutcomes = status.records.reduce((sum, item) => sum + item.staleInitialOutcomes, 0);
|
|
157
|
-
const unplannedOutcomeReceipts = totalOutcomeReceipts - plannedOutcomeReceipts;
|
|
158
|
-
learningOutcomes = {
|
|
159
|
-
status: status.records.some((item) => ["stale", "revoked", "revoked-evaluation",
|
|
160
|
-
"revoked-evidence-source-attestation", "revoked-validation", "revoked-evidence",
|
|
161
|
-
"revoked-measurement", "revoked-application", "revoked-delivery", "revoked-outcome",
|
|
162
|
-
"unproven", "failed-trial"].includes(item.canaryStatus))
|
|
163
|
-
|| unboundAfterReceipts > 0 || undeliveredAfterReceipts > 0 || unplannedOutcomeReceipts > 0
|
|
164
|
-
|| stalePendingApplications > 0 || staleUnconsumedMeasurements > 0
|
|
165
|
-
|| inactiveEvaluatorRegistryContracts > 0 || staleRevalidations > 0
|
|
166
|
-
|| staleInitialOutcomes > 0 || trialFailureRevocationReceipts > 0 ? "degraded" : "healthy",
|
|
167
|
-
candidates: status.records.length,
|
|
168
|
-
activeCanaries: status.records.filter((item) => item.canaryStatus === "active").length,
|
|
169
|
-
validatedCanaries: status.records.filter((item) => item.canaryStatus === "validated").length,
|
|
170
|
-
staleCanaries: status.records.filter((item) => item.canaryStatus === "stale").length,
|
|
171
|
-
awaitingApplication: status.records.filter((item) => item.canaryStatus === "active" && item.applicationReceipts === 0).length,
|
|
172
|
-
applicationReceipts: status.records.reduce((sum, item) => sum + item.applicationReceipts, 0),
|
|
173
|
-
deliveryReceipts: status.records.reduce((sum, item) => sum + item.deliveryReceipts, 0),
|
|
174
|
-
pendingApplications: status.records.reduce((sum, item) => sum + item.pendingApplications, 0),
|
|
175
|
-
stalePendingApplications,
|
|
176
|
-
evaluationContracts: status.records.reduce((sum, item) => sum + item.evaluationContracts, 0),
|
|
177
|
-
targetBoundEvaluationContracts,
|
|
178
|
-
targetBoundApplications,
|
|
179
|
-
deadlineBoundEvaluationContracts,
|
|
180
|
-
stalenessBoundEvaluationContracts,
|
|
181
|
-
promotionBoundEvaluationContracts,
|
|
182
|
-
candidateAdmissionEvaluationContracts,
|
|
183
|
-
evidenceSourceAttestedEvaluationContracts,
|
|
184
|
-
candidateEvidenceLineageEvaluationContracts,
|
|
185
|
-
candidateEvidenceLineageReceipts,
|
|
186
|
-
candidateEvidenceCohortEvaluationContracts,
|
|
187
|
-
blockingDefectBoundEvaluationContracts,
|
|
188
|
-
evidenceSourceBoundEvaluationContracts,
|
|
189
|
-
blockingDefectOutcomeReceipts,
|
|
190
|
-
deadlineBoundApplications,
|
|
191
|
-
trialRetryEvaluationContracts,
|
|
192
|
-
comparableTrialRetryEvaluationContracts,
|
|
193
|
-
boundedTrialRetryEvaluationContracts,
|
|
194
|
-
trialRetryExhaustionReceipts,
|
|
195
|
-
trialFailureReceipts,
|
|
196
|
-
trialFailureRevocationReceipts,
|
|
197
|
-
evaluationRevocationReceipts,
|
|
198
|
-
evidenceSourceAttestationRevocationReceipts,
|
|
199
|
-
validationRevocationReceipts,
|
|
200
|
-
evidenceRevocationReceipts,
|
|
201
|
-
measurementRevocationReceipts,
|
|
202
|
-
applicationRevocationReceipts,
|
|
203
|
-
deliveryRevocationReceipts,
|
|
204
|
-
outcomeRevocationReceipts,
|
|
205
|
-
deliveryTimeoutFailures,
|
|
206
|
-
outcomeTimeoutFailures,
|
|
207
|
-
pendingInitialOutcomes,
|
|
208
|
-
staleInitialOutcomes,
|
|
209
|
-
plannedOutcomeReceipts,
|
|
210
|
-
coverageBoundReceipts,
|
|
211
|
-
legacyCoverageReceipts,
|
|
212
|
-
provenanceBoundReceipts,
|
|
213
|
-
legacyProvenanceReceipts,
|
|
214
|
-
measurementReceipts,
|
|
215
|
-
measurementLineageReceipts,
|
|
216
|
-
consumedMeasurementReceipts,
|
|
217
|
-
staleUnconsumedMeasurements,
|
|
218
|
-
lineageBoundReceipts,
|
|
219
|
-
pairedOutcomeReceipts,
|
|
220
|
-
pairedEvaluatorPairs,
|
|
221
|
-
evaluatorRootBoundReceipts,
|
|
222
|
-
independentEvaluatorRoots,
|
|
223
|
-
activeEvaluatorRoots: status.evaluatorRegistry.active,
|
|
224
|
-
revokedEvaluatorRoots: status.evaluatorRegistry.revoked,
|
|
225
|
-
evaluatorRegistryBindings: status.evaluatorRegistry.bindings,
|
|
226
|
-
validationLeases: status.evaluatorRegistry.validationLeases,
|
|
227
|
-
renewedValidationLeases,
|
|
228
|
-
fixedCohortValidationLeases,
|
|
229
|
-
admissionBoundValidationLeases,
|
|
230
|
-
trialBoundValidationLeases,
|
|
231
|
-
initialTrialContracts,
|
|
232
|
-
requiredInitialTrials,
|
|
233
|
-
admittedInitialApplications,
|
|
234
|
-
completedInitialDeliveries,
|
|
235
|
-
incompleteInitialAdmissions,
|
|
236
|
-
activeRevalidations,
|
|
237
|
-
staleRevalidations,
|
|
238
|
-
fixedCohortRevalidations,
|
|
239
|
-
admissionBoundRevalidations,
|
|
240
|
-
trialBoundRevalidations,
|
|
241
|
-
requiredRevalidationDeliveries,
|
|
242
|
-
admittedRevalidationApplications,
|
|
243
|
-
completedRevalidationDeliveries,
|
|
244
|
-
currentValidatedLessons,
|
|
245
|
-
staleValidatedLessons,
|
|
246
|
-
unprovenValidatedLessons,
|
|
247
|
-
revokedValidatedLessons,
|
|
248
|
-
evaluatorRegistryContracts,
|
|
249
|
-
inactiveEvaluatorRegistryContracts,
|
|
250
|
-
unplannedOutcomeReceipts,
|
|
251
|
-
boundAfterReceipts: status.records.reduce((sum, item) => sum + item.boundAfterReceipts, 0),
|
|
252
|
-
unboundAfterReceipts,
|
|
253
|
-
deliveredAfterReceipts: status.records.reduce((sum, item) => sum + item.deliveredAfterReceipts, 0),
|
|
254
|
-
undeliveredAfterReceipts,
|
|
255
|
-
contradictions: status.records.filter((item) => item.conflictsWith.length > 0).length,
|
|
256
|
-
authority: "context-only"
|
|
257
|
-
};
|
|
258
|
-
} catch (error) { learningOutcomes = { status: "failed-closed", error: error.message, authority: "context-only" }; }
|
|
259
|
-
const result = {
|
|
260
|
-
ok: Number(process.versions.node.split(".")[0]) >= 20 && hostIntegration.ok
|
|
261
|
-
&& (!sourceResolution || sourceResolution.status === "loaded")
|
|
262
|
-
&& learningOutcomes.status !== "failed-closed",
|
|
263
|
-
version: VERSION,
|
|
264
|
-
node: process.versions.node,
|
|
265
|
-
platform: process.platform,
|
|
266
|
-
preservationMode: "read-only-source-overlay",
|
|
267
|
-
stateDirectory: process.env.AGENTSPINE_STATE_DIR || "platform-default",
|
|
268
|
-
hostIntegration,
|
|
269
|
-
sourceResolution,
|
|
270
|
-
orphanScan,
|
|
271
|
-
preflight,
|
|
272
|
-
learningOutcomes
|
|
273
|
-
};
|
|
274
|
-
output(result, json);
|
|
275
|
-
if (!result.ok) process.exitCode = 1;
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (command === "audit") {
|
|
280
|
-
const result = await runAudit(positional[0] || process.cwd(), { host: flags.host || process.env.AGENTSPINE_HOST || null });
|
|
281
|
-
output(result, json);
|
|
282
|
-
if (!result.ok) process.exitCode = 1;
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (command === "mcp") {
|
|
287
|
-
const { startMcpServer } = await import("./mcp.js");
|
|
288
|
-
startMcpServer();
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from "node:url";
|
|
2
|
-
import { installCodexMcp } from "./lib/codex-installation.js";
|
|
3
|
-
import { output } from "./cli-common.js";
|
|
4
|
-
|
|
5
|
-
export const hostCommands = new Set(["host-install"]);
|
|
6
|
-
|
|
7
|
-
export async function runHostCommand({ command, flags, positional, json }) {
|
|
8
|
-
if (command !== "host-install" || positional[0] !== "codex" || positional.length !== 1) {
|
|
9
|
-
throw new Error("host-install requires exactly the host name codex");
|
|
10
|
-
}
|
|
11
|
-
if (flags["confirm-local-host-install"] !== true) {
|
|
12
|
-
throw new Error("host-install requires --confirm-local-host-install from the local user");
|
|
13
|
-
}
|
|
14
|
-
const result = await installCodexMcp({
|
|
15
|
-
codexHome: flags["codex-home"],
|
|
16
|
-
skillsRoot: flags["skills-root"],
|
|
17
|
-
packageRoot: flags["package-root"] || fileURLToPath(new URL("..", import.meta.url)),
|
|
18
|
-
nodePath: flags["node-path"] || process.execPath
|
|
19
|
-
});
|
|
20
|
-
return output(result, json);
|
|
21
|
-
}
|