blun-king-cli 9.1.567 → 9.1.569
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/agent-spine-plugin/.claude-plugin/marketplace.json +1 -1
- package/agent-spine-plugin/.claude-plugin/plugin.json +1 -1
- package/agent-spine-plugin/.codex-plugin/plugin.json +2 -1
- package/agent-spine-plugin/CHANGELOG.md +1581 -0
- package/agent-spine-plugin/README.md +30 -4
- package/agent-spine-plugin/blun.plugin.json +3 -3
- package/agent-spine-plugin/docs/acceptance.md +61 -0
- package/agent-spine-plugin/docs/assignment-continuation.md +48 -0
- package/agent-spine-plugin/docs/host-integration.md +178 -0
- package/agent-spine-plugin/docs/preflight-recall.md +69 -0
- package/agent-spine-plugin/docs/preservation-contract.md +53 -0
- package/agent-spine-plugin/docs/quality-gates.md +50 -0
- package/agent-spine-plugin/docs/releasing.md +85 -0
- package/agent-spine-plugin/docs/session-timeline.md +251 -0
- package/agent-spine-plugin/docs/source-roots.md +113 -0
- package/agent-spine-plugin/docs/structured-completion.md +67 -0
- package/agent-spine-plugin/docs/world-model.md +94 -0
- package/agent-spine-plugin/hooks/codex.json +2 -2
- package/agent-spine-plugin/hooks/hooks.json +1 -1
- package/agent-spine-plugin/hooks/version.json +1 -1
- package/agent-spine-plugin/package.json +13 -3
- package/agent-spine-plugin/scripts/check-codex-install.js +226 -0
- package/agent-spine-plugin/scripts/check-hosts.js +14 -5
- package/agent-spine-plugin/scripts/check-install-hook.js +226 -0
- package/agent-spine-plugin/scripts/check-install-selfstarter.js +154 -0
- package/agent-spine-plugin/scripts/check-install.js +478 -0
- package/agent-spine-plugin/scripts/check-line-budget.js +58 -0
- package/agent-spine-plugin/scripts/check-syntax.js +29 -0
- package/agent-spine-plugin/scripts/github-actions.js +11 -0
- package/agent-spine-plugin/scripts/hermetic-process.js +183 -0
- package/agent-spine-plugin/scripts/release-check.js +145 -0
- package/agent-spine-plugin/scripts/run-acceptance.js +19 -0
- package/agent-spine-plugin/scripts/run-checks.js +47 -0
- package/agent-spine-plugin/scripts/run-tests-hermetic.js +89 -0
- package/agent-spine-plugin/skills/agent-spine/SKILL.md +16 -2
- package/agent-spine-plugin/spine-example/1-identity.md +12 -0
- package/agent-spine-plugin/spine-example/2-voice.md +6 -0
- package/agent-spine-plugin/spine-example/3-conduct.md +8 -0
- package/agent-spine-plugin/spine-example/4-history.md +4 -0
- package/agent-spine-plugin/src/cli-agent.js +296 -0
- package/agent-spine-plugin/src/cli-attention.js +95 -0
- package/agent-spine-plugin/src/cli-autonomy.js +36 -0
- package/agent-spine-plugin/src/cli-common.js +71 -0
- package/agent-spine-plugin/src/cli-continuity.js +116 -0
- package/agent-spine-plugin/src/cli-core.js +128 -0
- package/agent-spine-plugin/src/cli-diagnostics.js +291 -0
- package/agent-spine-plugin/src/cli-host.js +21 -0
- package/agent-spine-plugin/src/cli-learning.js +305 -0
- package/agent-spine-plugin/src/cli-premortem.js +16 -0
- package/agent-spine-plugin/src/cli-sharing.js +230 -0
- package/agent-spine-plugin/src/cli.js +40 -1350
- package/agent-spine-plugin/src/codex-reader-launcher.js +182 -0
- package/agent-spine-plugin/src/hook.js +185 -567
- package/agent-spine-plugin/src/index.js +16 -2
- package/agent-spine-plugin/src/lib/acceptance.js +113 -11
- package/agent-spine-plugin/src/lib/action-lesson-recall.js +53 -0
- package/agent-spine-plugin/src/lib/attention-context.js +167 -0
- package/agent-spine-plugin/src/lib/attention-events.js +113 -0
- package/agent-spine-plugin/src/lib/attention-privacy.js +72 -0
- package/agent-spine-plugin/src/lib/attention-schema.js +164 -0
- package/agent-spine-plugin/src/lib/attention-storage.js +93 -0
- package/agent-spine-plugin/src/lib/attention.js +9 -600
- package/agent-spine-plugin/src/lib/audit-premortem.js +223 -0
- package/agent-spine-plugin/src/lib/audit.js +56 -6
- package/agent-spine-plugin/src/lib/autonomy-policy.js +110 -0
- package/agent-spine-plugin/src/lib/autonomy-store.js +202 -0
- package/agent-spine-plugin/src/lib/autonomy.js +8 -0
- package/agent-spine-plugin/src/lib/briefing.js +67 -4
- package/agent-spine-plugin/src/lib/catalog-document-read.js +51 -0
- package/agent-spine-plugin/src/lib/catalog.js +1 -1
- package/agent-spine-plugin/src/lib/codex-installation.js +231 -0
- package/agent-spine-plugin/src/lib/codex-skill-installation.js +211 -0
- package/agent-spine-plugin/src/lib/context.js +3 -1
- package/agent-spine-plugin/src/lib/delivery-agent-usage.js +224 -0
- package/agent-spine-plugin/src/lib/delivery-assignment.js +220 -0
- package/agent-spine-plugin/src/lib/delivery-command-actions.js +453 -0
- package/agent-spine-plugin/src/lib/delivery-knowledge.js +78 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-binding.js +107 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-closure.js +171 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-codec.js +45 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-correction.js +101 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-file.js +21 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-index.js +493 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-inspection.js +37 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-recovery.js +120 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-rejection.js +65 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-results.js +28 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-session-guard.js +46 -0
- package/agent-spine-plugin/src/lib/delivery-premortem-write-ledger.js +285 -0
- package/agent-spine-plugin/src/lib/delivery-premortem.js +499 -0
- package/agent-spine-plugin/src/lib/delivery-shell-heredoc.js +115 -0
- package/agent-spine-plugin/src/lib/delivery-shell-substitutions.js +111 -0
- package/agent-spine-plugin/src/lib/delivery-shell-wrapper.js +64 -0
- package/agent-spine-plugin/src/lib/delivery-target.js +73 -0
- package/agent-spine-plugin/src/lib/delivery-verification.js +445 -0
- package/agent-spine-plugin/src/lib/documents.js +27 -5
- package/agent-spine-plugin/src/lib/filesystem-retry.js +2 -0
- package/agent-spine-plugin/src/lib/gateway-common.js +68 -0
- package/agent-spine-plugin/src/lib/gateway-control.js +302 -0
- package/agent-spine-plugin/src/lib/gateway-delivery.js +103 -0
- package/agent-spine-plugin/src/lib/gateway-execution.js +350 -0
- package/agent-spine-plugin/src/lib/gateway-host-lifecycle.js +185 -0
- package/agent-spine-plugin/src/lib/gateway-inspection.js +85 -0
- package/agent-spine-plugin/src/lib/gateway-knowledge.js +129 -0
- package/agent-spine-plugin/src/lib/gateway-policy-provenance.js +197 -0
- package/agent-spine-plugin/src/lib/gateway-premortem-disposition.js +82 -0
- package/agent-spine-plugin/src/lib/gateway-premortem.js +363 -0
- package/agent-spine-plugin/src/lib/gateway-runs.js +300 -0
- package/agent-spine-plugin/src/lib/gateway-runtime-identity.js +31 -0
- package/agent-spine-plugin/src/lib/gateway-runtime-records.js +21 -0
- package/agent-spine-plugin/src/lib/gateway-runtime.js +18 -1623
- package/agent-spine-plugin/src/lib/gateway-state-transaction.js +356 -0
- package/agent-spine-plugin/src/lib/gateway-state.js +342 -0
- package/agent-spine-plugin/src/lib/hook-artifact-guards.js +356 -0
- package/agent-spine-plugin/src/lib/hook-audit.js +16 -2
- package/agent-spine-plugin/src/lib/hook-briefing-use.js +68 -0
- package/agent-spine-plugin/src/lib/hook-context.js +424 -0
- package/agent-spine-plugin/src/lib/hook-final-message.js +26 -0
- package/agent-spine-plugin/src/lib/hook-input.js +27 -0
- package/agent-spine-plugin/src/lib/hook-output.js +140 -0
- package/agent-spine-plugin/src/lib/hook-premortem.js +257 -0
- package/agent-spine-plugin/src/lib/hook-process-advisory.js +37 -0
- package/agent-spine-plugin/src/lib/hook-protection.js +95 -0
- package/agent-spine-plugin/src/lib/hook-stop-verification.js +84 -0
- package/agent-spine-plugin/src/lib/hook-timeline.js +91 -0
- package/agent-spine-plugin/src/lib/identifier-analysis.js +446 -0
- package/agent-spine-plugin/src/lib/indexed-memory.js +23 -6
- package/agent-spine-plugin/src/lib/knowledge-evidence.js +431 -0
- package/agent-spine-plugin/src/lib/learning-applications.js +441 -0
- package/agent-spine-plugin/src/lib/learning-candidates.js +274 -0
- package/agent-spine-plugin/src/lib/learning-context.js +130 -0
- package/agent-spine-plugin/src/lib/learning-delivery-contracts.js +310 -0
- package/agent-spine-plugin/src/lib/learning-evaluation-contracts.js +350 -0
- package/agent-spine-plugin/src/lib/learning-evaluation-registration.js +372 -0
- package/agent-spine-plugin/src/lib/learning-evaluation-revocation.js +292 -0
- package/agent-spine-plugin/src/lib/learning-evidence-contracts.js +321 -0
- package/agent-spine-plugin/src/lib/learning-findings.js +458 -0
- package/agent-spine-plugin/src/lib/learning-measurement-contracts.js +285 -0
- package/agent-spine-plugin/src/lib/learning-measurements.js +265 -0
- package/agent-spine-plugin/src/lib/learning-outcome-contracts.js +165 -0
- package/agent-spine-plugin/src/lib/learning-outcomes.js +343 -0
- package/agent-spine-plugin/src/lib/learning-reconciliation.js +290 -0
- package/agent-spine-plugin/src/lib/learning-retry-contracts.js +188 -0
- package/agent-spine-plugin/src/lib/learning-schema.js +229 -0
- package/agent-spine-plugin/src/lib/learning-scope-targets.js +424 -0
- package/agent-spine-plugin/src/lib/learning-state-upgrade.js +477 -0
- package/agent-spine-plugin/src/lib/learning-status-configuration.js +476 -0
- package/agent-spine-plugin/src/lib/learning-storage.js +203 -0
- package/agent-spine-plugin/src/lib/learning-trial-recovery.js +218 -0
- package/agent-spine-plugin/src/lib/learning-validation-contracts.js +375 -0
- package/agent-spine-plugin/src/lib/learning-validation-renewal.js +298 -0
- package/agent-spine-plugin/src/lib/learning-validation-runtime.js +234 -0
- package/agent-spine-plugin/src/lib/learning.js +36 -6923
- package/agent-spine-plugin/src/lib/lesson-recall-session.js +172 -0
- package/agent-spine-plugin/src/lib/mcp-autonomy-tools.js +37 -0
- package/agent-spine-plugin/src/lib/mcp-delivery-completion.js +124 -0
- package/agent-spine-plugin/src/lib/mcp-delivery-tools.js +45 -0
- package/agent-spine-plugin/src/lib/mcp-premortem.js +68 -0
- package/agent-spine-plugin/src/lib/mcp-runtime.js +269 -0
- package/agent-spine-plugin/src/lib/mcp-source-context.js +51 -0
- package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +164 -0
- package/agent-spine-plugin/src/lib/mcp-world-tools.js +52 -0
- package/agent-spine-plugin/src/lib/owned-file-lock.js +30 -10
- package/agent-spine-plugin/src/lib/project-portfolio.js +176 -0
- package/agent-spine-plugin/src/lib/selfstarter-core.js +382 -0
- package/agent-spine-plugin/src/lib/selfstarter-jobs.js +149 -0
- package/agent-spine-plugin/src/lib/selfstarter-lease.js +204 -0
- package/agent-spine-plugin/src/lib/selfstarter-policy.js +90 -0
- package/agent-spine-plugin/src/lib/selfstarter-workspace.js +111 -0
- package/agent-spine-plugin/src/lib/selfstarter.js +11 -911
- package/agent-spine-plugin/src/lib/session-timeline-auth.js +316 -0
- package/agent-spine-plugin/src/lib/session-timeline-codex.js +58 -0
- package/agent-spine-plugin/src/lib/session-timeline-contract.js +48 -0
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +41 -0
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +132 -0
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +17 -0
- package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +500 -0
- package/agent-spine-plugin/src/lib/session-timeline-event-extract.js +157 -0
- package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +74 -0
- package/agent-spine-plugin/src/lib/session-timeline-host-receipt.js +117 -0
- package/agent-spine-plugin/src/lib/session-timeline-invocation.js +201 -0
- package/agent-spine-plugin/src/lib/session-timeline-king.js +79 -0
- package/agent-spine-plugin/src/lib/session-timeline-prior.js +59 -0
- package/agent-spine-plugin/src/lib/session-timeline-provider.js +34 -0
- package/agent-spine-plugin/src/lib/session-timeline-query.js +55 -0
- package/agent-spine-plugin/src/lib/session-timeline-results.js +31 -0
- package/agent-spine-plugin/src/lib/session-timeline-root.js +11 -0
- package/agent-spine-plugin/src/lib/session-timeline-search.js +82 -0
- package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +217 -0
- package/agent-spine-plugin/src/lib/session-timeline-source.js +83 -0
- package/agent-spine-plugin/src/lib/session-timeline-state.js +45 -0
- package/agent-spine-plugin/src/lib/session-timeline-transport.js +50 -0
- package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +148 -0
- package/agent-spine-plugin/src/lib/session-timeline.js +453 -0
- package/agent-spine-plugin/src/lib/source-roots.js +69 -136
- package/agent-spine-plugin/src/lib/source-tree-scan.js +178 -0
- package/agent-spine-plugin/src/lib/task-knowledge-context.js +78 -0
- package/agent-spine-plugin/src/lib/timeline-tool-guard.js +202 -0
- package/agent-spine-plugin/src/lib/world-knowledge.js +249 -0
- package/agent-spine-plugin/src/lib/world-model.js +278 -0
- package/agent-spine-plugin/src/mcp.js +20 -161
- package/agent-spine-plugin/src/version.js +1 -1
- package/agent-spine-plugin/src/worker.js +22 -5
- package/bin/agent-resume-snapshot.cjs +2 -2
- package/bin/agentspine-king-goal-inbox.mjs +111 -0
- package/bin/agentspine-king-goal-intake.mjs +106 -0
- package/bin/baseline-skill-performance-policy.cjs +1 -16
- package/bin/core-bootstrap.js +2 -0
- package/bin/curiosity-scout-policy.cjs +5 -1
- package/bin/input-draft-persistence.cjs +2 -2
- package/bin/king-tui-function-contract.json +33 -0
- package/bin/launcher-restart-policy.cjs +150 -0
- package/bin/launcher-runtime.js +56 -44
- package/bin/managed-context-startup-policy.cjs +27 -0
- package/bin/managed-plugin-selection.cjs +116 -0
- package/bin/mistake-relevance-policy.cjs +1 -1
- package/bin/observer-hooks.cjs +14 -0
- package/bin/oversized-context-offload-policy.cjs +86 -0
- package/bin/plugin-bootstrap.js +7 -40
- package/bin/proactive-compaction-policy.cjs +1 -1
- package/bin/provider-model-refresh-deadline.cjs +53 -0
- package/bin/provider-model-refresh-policy.cjs +107 -0
- package/bin/release-artifact-freeze-policy.cjs +30 -0
- package/bin/repeated-user-message-projection.cjs +3 -126
- package/bin/research-page-result.cjs +74 -0
- package/bin/runtime-exit-ledger.cjs +1 -0
- package/bin/session-compaction-policy.cjs +84 -0
- package/bin/skill-listing-performance-policy.cjs +2 -2
- package/bin/standard-tools-bootstrap.js +0 -37
- package/bin/subagent-skill-policy.cjs +3 -1
- package/bin/telegram-approval-relay.cjs +12 -7
- package/bin/telegram-private-conversation-policy.cjs +3 -2
- package/bin/telegram-queue-handoff-policy.cjs +24 -0
- package/bin/thinking-activity-status-policy.cjs +1 -1
- package/bin/thinking-only-guard.cjs +16 -12
- package/bin/tool-call-loop-policy.cjs +0 -2
- package/bin/tool-result-offload-policy.cjs +11 -2
- package/bin/tui-functional-contract.cjs +55 -0
- package/bin/update-notice.js +18 -14
- package/bin/user-message-offload-policy.cjs +1 -1
- package/bin/user-prompt-hook-origin-policy.cjs +34 -0
- package/bin/windows-node-crash-dump.cjs +110 -0
- package/blun.mjs +2517 -1048
- package/codebase-index/codebase_index.py +4 -3
- package/package.json +3 -17
- package/standard-skills/research-evidence/SKILL.md +39 -0
- package/standard-skills/research-evidence/references/evidence-format.md +82 -0
- package/standard-skills/research-evidence/scripts/evidence-collection.cjs +254 -0
- package/standard-skills/research-evidence/scripts/score-report.cjs +112 -0
- package/standard-skills/web-lesen/SKILL.md +37 -22
- package/standard-skills/web-lesen/scripts/crawl_public.py +376 -0
- package/telegram-plugin/DELIVERY.md +36 -0
- package/telegram-plugin/bin/telegram-approval-relay.cjs +13 -7
- package/telegram-plugin/bin/telegram-launcher-status-queue.cjs +122 -0
- package/telegram-plugin/bin/telegram-private-conversation-policy.cjs +3 -2
- package/telegram-plugin/bin/telegram-reply-parts.cjs +149 -0
- package/telegram-plugin/dist/bridge.mjs +7 -56
- package/telegram-plugin/dist/mcp-server.mjs +33 -4
- package/agent-spine-plugin/skill/SKILL.md +0 -76
- package/bin/mnemo-connect-heartbeat.cjs +0 -204
- package/bin/mnemo-tool-agent-policy.cjs +0 -22
- package/telegram-plugin/bin/telegram-mnemo-capture.cjs +0 -297
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { addLearningEvidence, beginLearningRevalidation, configureLearning, deleteLearning, evaluateLearning, learningContext, learningOutcomeStatus, loadLearning, proposeLearning, purgeStaleLearningApplications, purgeStaleLearningMeasurements, recordLearningMeasurement, recordLearningOutcome, registerLearningEvaluation, registerLearningEvaluator, renewLearningValidation, revokeLearningEvaluator, reviewLearning, revokeLearningApplication, revokeLearningDelivery, revokeLearningEvaluation, revokeLearningEvidence, revokeLearningMeasurement, revokeLearningOutcome, revokeLearningTrialFailure, revokeLearningValidation, revokeLearningEvidenceSourceAttestation, rollbackLearning } from "./lib/learning.js";
|
|
2
|
+
import { booleanFlag, evaluatorRootsFlag, hasLearningScope, learningScope, output } from "./cli-common.js";
|
|
3
|
+
|
|
4
|
+
export const learningCommands = new Set([
|
|
5
|
+
"learn-propose",
|
|
6
|
+
"learn-evidence",
|
|
7
|
+
"learn-evidence-revoke",
|
|
8
|
+
"learn-review",
|
|
9
|
+
"learn-context",
|
|
10
|
+
"learn-evaluate",
|
|
11
|
+
"learn-evaluator-register",
|
|
12
|
+
"learn-evaluator-revoke",
|
|
13
|
+
"learn-evaluation",
|
|
14
|
+
"learn-revalidation-start",
|
|
15
|
+
"learn-revalidate",
|
|
16
|
+
"learn-measurement",
|
|
17
|
+
"learn-measurement-revoke",
|
|
18
|
+
"learn-evaluation-revoke",
|
|
19
|
+
"learn-evidence-source-attestation-revoke",
|
|
20
|
+
"learn-validation-revoke",
|
|
21
|
+
"learn-trial-failure-revoke",
|
|
22
|
+
"learn-application-revoke",
|
|
23
|
+
"learn-delivery-revoke",
|
|
24
|
+
"learn-outcome-revoke",
|
|
25
|
+
"learn-outcome",
|
|
26
|
+
"learn-status",
|
|
27
|
+
"learn-delivery-purge",
|
|
28
|
+
"learn-measurement-purge",
|
|
29
|
+
"learn-rollback",
|
|
30
|
+
"learn-delete",
|
|
31
|
+
"learn-config"
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
export async function runLearningCommand({ command, flags, positional, json }) {
|
|
35
|
+
if (command === "learn-propose") {
|
|
36
|
+
return output(await proposeLearning({
|
|
37
|
+
root: flags.root || process.cwd(), id: positional[0], kind: flags.kind,
|
|
38
|
+
claim: flags.claim, subjectId: flags.subject || null, privacy: flags.privacy || "private",
|
|
39
|
+
groupId: flags.group || null, supersedesId: flags.supersedes || null,
|
|
40
|
+
scope: hasLearningScope(flags) ? learningScope(flags) : null,
|
|
41
|
+
evidence: {
|
|
42
|
+
id: flags["evidence-id"], type: flags["evidence-type"] || "user-statement",
|
|
43
|
+
summary: flags.evidence, sourceDocument: flags.source || null,
|
|
44
|
+
confidence: Number(flags.confidence ?? 0.5), observedAt: flags.at
|
|
45
|
+
}
|
|
46
|
+
}), json);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (command === "learn-evidence") {
|
|
50
|
+
return output(await addLearningEvidence({
|
|
51
|
+
root: flags.root || process.cwd(), id: positional[0],
|
|
52
|
+
evidence: {
|
|
53
|
+
id: flags["evidence-id"], type: flags.type || "interaction", summary: flags.summary,
|
|
54
|
+
sourceDocument: flags.source || null, confidence: Number(flags.confidence ?? 0.5), observedAt: flags.at
|
|
55
|
+
}
|
|
56
|
+
}), json);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (command === "learn-evidence-revoke") {
|
|
60
|
+
return output(await revokeLearningEvidence({
|
|
61
|
+
root: flags.root || process.cwd(), learningId: positional[0], evidenceId: flags["evidence-id"],
|
|
62
|
+
reasonCode: flags["reason-code"], reason: flags.reason,
|
|
63
|
+
confirmation: booleanFlag(flags["confirm-local-evidence"])
|
|
64
|
+
? "local-evidence-revocation-confirmed" : null
|
|
65
|
+
}), json);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (command === "learn-review") {
|
|
69
|
+
return output(await reviewLearning({
|
|
70
|
+
root: flags.root || process.cwd(), id: positional[0], decision: flags.decision,
|
|
71
|
+
reason: flags.reason, confirmedByUser: booleanFlag(flags["confirmed-by-user"])
|
|
72
|
+
}), json);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (command === "learn-context") {
|
|
76
|
+
return output(await learningContext({
|
|
77
|
+
root: positional[0] || process.cwd(), includePrivate: booleanFlag(flags["include-private"]),
|
|
78
|
+
groupId: flags.group || null,
|
|
79
|
+
scope: hasLearningScope(flags) ? learningScope(flags) : null,
|
|
80
|
+
kinds: flags.kind ? String(flags.kind).split(",").filter(Boolean) : null,
|
|
81
|
+
subjectIds: flags.subject ? String(flags.subject).split(",").filter(Boolean) : null,
|
|
82
|
+
maxItems: flags["max-items"] === undefined ? null : Number(flags["max-items"])
|
|
83
|
+
}), json);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (command === "learn-evaluate") {
|
|
87
|
+
return output(await evaluateLearning({ root: positional[0] || process.cwd() }), json);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (command === "learn-evaluator-register") {
|
|
91
|
+
return output(await registerLearningEvaluator({
|
|
92
|
+
root: flags.root || process.cwd(), id: positional[0], principalDigest: flags["principal-digest"],
|
|
93
|
+
confirmLocalEvaluator: booleanFlag(flags["confirm-local-evaluator"])
|
|
94
|
+
}), json);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (command === "learn-evaluator-revoke") {
|
|
98
|
+
return output(await revokeLearningEvaluator({
|
|
99
|
+
root: flags.root || process.cwd(), id: positional[0], reason: flags.reason,
|
|
100
|
+
confirmLocalEvaluator: booleanFlag(flags["confirm-local-evaluator"])
|
|
101
|
+
}), json);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (command === "learn-evaluation") {
|
|
105
|
+
return output(await registerLearningEvaluation({
|
|
106
|
+
root: flags.root || process.cwd(), id: positional[0], learningId: flags.learning,
|
|
107
|
+
scope: learningScope(flags), metric: { name: flags.metric, direction: flags.direction },
|
|
108
|
+
benchmark: {
|
|
109
|
+
taskDigest: flags["task-digest"], datasetDigest: flags["dataset-digest"],
|
|
110
|
+
protocolDigest: flags["protocol-digest"], minCases: Number(flags["min-cases"])
|
|
111
|
+
},
|
|
112
|
+
evaluatorIds: String(flags.evaluators || "").split(",").filter(Boolean),
|
|
113
|
+
evaluatorRoots: evaluatorRootsFlag(flags["evaluator-roots"]),
|
|
114
|
+
expiresAt: flags["expires-at"] || null,
|
|
115
|
+
retryTrialFailureId: flags["retry-trial-failure"] || null,
|
|
116
|
+
confirmLocalTrialRetry: booleanFlag(flags["confirm-local-trial-retry"]),
|
|
117
|
+
confirmLocalEvidenceSources: booleanFlag(flags["confirm-local-evidence-sources"]),
|
|
118
|
+
confirmLocalEvaluation: booleanFlag(flags["confirm-local-evaluation"])
|
|
119
|
+
}), json);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (command === "learn-revalidation-start") {
|
|
123
|
+
return output(await beginLearningRevalidation({
|
|
124
|
+
root: flags.root || process.cwd(), learningId: positional[0],
|
|
125
|
+
confirmLocalValidation: booleanFlag(flags["confirm-local-validation"])
|
|
126
|
+
}), json);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (command === "learn-revalidate") {
|
|
130
|
+
const measurements = String(flags.measurements || "").split(",").filter(Boolean);
|
|
131
|
+
const applications = String(flags.applications || "").split(",").filter(Boolean);
|
|
132
|
+
const deliveries = String(flags.deliveries || "").split(",").filter(Boolean);
|
|
133
|
+
if (!measurements.length || measurements.length !== applications.length || measurements.length !== deliveries.length) {
|
|
134
|
+
throw new Error("revalidation requires equally sized measurement, application, and delivery lists");
|
|
135
|
+
}
|
|
136
|
+
return output(await renewLearningValidation({
|
|
137
|
+
root: flags.root || process.cwd(), learningId: positional[0],
|
|
138
|
+
evidence: measurements.map((measurementId, index) => ({ measurementId,
|
|
139
|
+
applicationId: applications[index], deliveryId: deliveries[index] })),
|
|
140
|
+
confirmLocalValidation: booleanFlag(flags["confirm-local-validation"])
|
|
141
|
+
}), json);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (command === "learn-measurement") {
|
|
145
|
+
return output(await recordLearningMeasurement({
|
|
146
|
+
root: flags.root || process.cwd(), id: positional[0], learningId: flags.learning,
|
|
147
|
+
evaluationId: flags.evaluation, phase: flags.phase, scope: learningScope(flags),
|
|
148
|
+
metric: {
|
|
149
|
+
name: flags.metric, direction: flags.direction, value: Number(flags.value),
|
|
150
|
+
blockingDefects: Number(flags["blocking-defects"] ?? 0)
|
|
151
|
+
},
|
|
152
|
+
measurement: {
|
|
153
|
+
kind: flags.measurement || "objective", evaluatorId: flags.evaluator,
|
|
154
|
+
runId: flags.run, sourceDigest: flags["source-digest"]
|
|
155
|
+
},
|
|
156
|
+
coverage: { datasetDigest: flags["dataset-digest"], caseCount: Number(flags["case-count"]) },
|
|
157
|
+
measuredAt: flags.at,
|
|
158
|
+
confirmLocalMeasurement: booleanFlag(flags["confirm-local-measurement"])
|
|
159
|
+
}), json);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (command === "learn-measurement-revoke") {
|
|
163
|
+
return output(await revokeLearningMeasurement({
|
|
164
|
+
root: flags.root || process.cwd(), measurementId: positional[0], reasonCode: flags["reason-code"],
|
|
165
|
+
reason: flags.reason,
|
|
166
|
+
confirmation: booleanFlag(flags["confirm-local-measurement-revocation"])
|
|
167
|
+
? "local-measurement-revocation-confirmed" : null
|
|
168
|
+
}), json);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (command === "learn-evaluation-revoke") {
|
|
172
|
+
return output(await revokeLearningEvaluation({
|
|
173
|
+
root: flags.root || process.cwd(), evaluationId: positional[0], reasonCode: flags["reason-code"],
|
|
174
|
+
reason: flags.reason,
|
|
175
|
+
confirmation: booleanFlag(flags["confirm-local-evaluation-revocation"])
|
|
176
|
+
? "local-evaluation-revocation-confirmed" : null
|
|
177
|
+
}), json);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (command === "learn-evidence-source-attestation-revoke") {
|
|
181
|
+
return output(await revokeLearningEvidenceSourceAttestation({
|
|
182
|
+
root: flags.root || process.cwd(), evaluationId: positional[0], evidenceDigest: flags["evidence-digest"],
|
|
183
|
+
reasonCode: flags["reason-code"], reason: flags.reason,
|
|
184
|
+
confirmation: booleanFlag(flags["confirm-local-evidence-source-attestation-revocation"])
|
|
185
|
+
? "local-evidence-source-attestation-revocation-confirmed" : null
|
|
186
|
+
}), json);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (command === "learn-validation-revoke") {
|
|
190
|
+
return output(await revokeLearningValidation({
|
|
191
|
+
root: flags.root || process.cwd(), validationLeaseId: positional[0], reasonCode: flags["reason-code"],
|
|
192
|
+
reason: flags.reason,
|
|
193
|
+
confirmation: booleanFlag(flags["confirm-local-validation-revocation"])
|
|
194
|
+
? "local-validation-revocation-confirmed" : null
|
|
195
|
+
}), json);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (command === "learn-trial-failure-revoke") {
|
|
199
|
+
return output(await revokeLearningTrialFailure({
|
|
200
|
+
root: flags.root || process.cwd(), trialFailureId: positional[0], reasonCode: flags["reason-code"],
|
|
201
|
+
reason: flags.reason,
|
|
202
|
+
confirmation: booleanFlag(flags["confirm-local-trial-failure-revocation"])
|
|
203
|
+
? "local-trial-failure-revocation-confirmed" : null
|
|
204
|
+
}), json);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (command === "learn-application-revoke") {
|
|
208
|
+
return output(await revokeLearningApplication({
|
|
209
|
+
root: flags.root || process.cwd(), applicationId: positional[0], reasonCode: flags["reason-code"],
|
|
210
|
+
reason: flags.reason,
|
|
211
|
+
confirmation: booleanFlag(flags["confirm-local-application-revocation"])
|
|
212
|
+
? "local-application-revocation-confirmed" : null
|
|
213
|
+
}), json);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (command === "learn-delivery-revoke") {
|
|
217
|
+
return output(await revokeLearningDelivery({
|
|
218
|
+
root: flags.root || process.cwd(), deliveryId: positional[0], reasonCode: flags["reason-code"],
|
|
219
|
+
reason: flags.reason,
|
|
220
|
+
confirmation: booleanFlag(flags["confirm-local-delivery-revocation"])
|
|
221
|
+
? "local-delivery-revocation-confirmed" : null
|
|
222
|
+
}), json);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (command === "learn-outcome-revoke") {
|
|
226
|
+
return output(await revokeLearningOutcome({
|
|
227
|
+
root: flags.root || process.cwd(), outcomeId: positional[0], reasonCode: flags["reason-code"],
|
|
228
|
+
reason: flags.reason,
|
|
229
|
+
confirmation: booleanFlag(flags["confirm-local-outcome-revocation"])
|
|
230
|
+
? "local-outcome-revocation-confirmed" : null
|
|
231
|
+
}), json);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (command === "learn-outcome") {
|
|
235
|
+
const lineage = flags["measurement-receipt"] || null;
|
|
236
|
+
return output(await recordLearningOutcome({
|
|
237
|
+
root: flags.root || process.cwd(), learningId: positional[0], id: flags.id,
|
|
238
|
+
evaluationId: flags.evaluation, measurementReceiptId: lineage,
|
|
239
|
+
applicationId: flags.application || null, deliveryId: flags.delivery || null,
|
|
240
|
+
...(lineage ? {} : { phase: flags.phase, scope: learningScope(flags), metric: {
|
|
241
|
+
name: flags.metric, direction: flags.direction, value: Number(flags.value),
|
|
242
|
+
blockingDefects: Number(flags["blocking-defects"] ?? 0)
|
|
243
|
+
},
|
|
244
|
+
measurement: {
|
|
245
|
+
kind: flags.measurement || "objective", evaluatorId: flags.evaluator,
|
|
246
|
+
sourceDigest: flags["source-digest"] || null
|
|
247
|
+
},
|
|
248
|
+
coverage: {
|
|
249
|
+
datasetDigest: flags["dataset-digest"],
|
|
250
|
+
caseCount: Number(flags["case-count"])
|
|
251
|
+
},
|
|
252
|
+
measuredAt: flags.at })
|
|
253
|
+
}), json);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (command === "learn-status") {
|
|
257
|
+
return output(await learningOutcomeStatus({
|
|
258
|
+
root: positional[0] || process.cwd(), scope: hasLearningScope(flags) ? learningScope(flags) : null
|
|
259
|
+
}), json);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (command === "learn-delivery-purge") {
|
|
263
|
+
return output(await purgeStaleLearningApplications({
|
|
264
|
+
root: positional[0] || process.cwd(),
|
|
265
|
+
confirmation: booleanFlag(flags["confirm-local-purge"]) ? "local-user-purge-confirmed" : null
|
|
266
|
+
}), json);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (command === "learn-measurement-purge") {
|
|
270
|
+
return output(await purgeStaleLearningMeasurements({
|
|
271
|
+
root: positional[0] || process.cwd(),
|
|
272
|
+
confirmation: booleanFlag(flags["confirm-local-purge"]) ? "local-user-purge-confirmed" : null
|
|
273
|
+
}), json);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (command === "learn-rollback") {
|
|
277
|
+
return output(await rollbackLearning({
|
|
278
|
+
root: flags.root || process.cwd(), id: positional[0], reason: flags.reason
|
|
279
|
+
}), json);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (command === "learn-delete") {
|
|
283
|
+
return output(await deleteLearning({ root: flags.root || process.cwd(), id: positional[0] }), json);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (command === "learn-config") {
|
|
287
|
+
const root = positional[0] || process.cwd();
|
|
288
|
+
const config = {};
|
|
289
|
+
if (flags["auto-promote"] !== undefined) config.autoPromote = booleanFlag(flags["auto-promote"]);
|
|
290
|
+
if (flags["min-confidence"] !== undefined) config.minConfidence = Number(flags["min-confidence"]);
|
|
291
|
+
if (flags["min-evidence"] !== undefined) config.minEvidence = Number(flags["min-evidence"]);
|
|
292
|
+
if (flags["max-items"] !== undefined) config.maxContextItems = Number(flags["max-items"]);
|
|
293
|
+
if (flags["min-outcomes"] !== undefined) config.minOutcomeReceipts = Number(flags["min-outcomes"]);
|
|
294
|
+
if (flags["min-improvement"] !== undefined) config.minImprovement = Number(flags["min-improvement"]);
|
|
295
|
+
if (flags["regression-tolerance"] !== undefined) config.regressionTolerance = Number(flags["regression-tolerance"]);
|
|
296
|
+
if (flags["outcome-max-age-days"] !== undefined) config.outcomeMaxAgeDays = Number(flags["outcome-max-age-days"]);
|
|
297
|
+
if (flags["canary-receipts"] !== undefined) config.canaryReceipts = Number(flags["canary-receipts"]);
|
|
298
|
+
if (flags["canary-ttl-days"] !== undefined) config.canaryTtlDays = Number(flags["canary-ttl-days"]);
|
|
299
|
+
if (flags["initial-trial-outcome-timeout-minutes"] !== undefined) {
|
|
300
|
+
config.initialTrialOutcomeTimeoutMinutes = Number(flags["initial-trial-outcome-timeout-minutes"]);
|
|
301
|
+
}
|
|
302
|
+
if (!Object.keys(config).length) return output((await loadLearning(root)).learning.config, json);
|
|
303
|
+
return output(await configureLearning({ root, config }), json);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { recoverDeliveryPremortem } from "./lib/delivery-premortem-correction.js";
|
|
2
|
+
import { output } from "./cli-common.js";
|
|
3
|
+
|
|
4
|
+
export const premortemCommands = new Set(["premortem-recover"]);
|
|
5
|
+
|
|
6
|
+
export async function runPremortemCommand({ command, flags, positional, json }) {
|
|
7
|
+
if (command !== "premortem-recover") throw new Error(`Unknown premortem command: ${command}`);
|
|
8
|
+
const predecessorRequirementId = positional[0];
|
|
9
|
+
if (!predecessorRequirementId) throw new Error("premortem-recover requires a predecessor requirementId");
|
|
10
|
+
const result = await recoverDeliveryPremortem({
|
|
11
|
+
root: flags.root || process.cwd(), predecessorRequirementId,
|
|
12
|
+
taskId: flags.task || null
|
|
13
|
+
});
|
|
14
|
+
output(result, json);
|
|
15
|
+
if (result.blocked) process.exitCode = 1;
|
|
16
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { configureSharing, deleteShared, initDirectoryAdapter, publishLearning, pullShared, reviewShared, rollbackShared, sharedContext, sharedInbox } from "./lib/sharing.js";
|
|
2
|
+
import { generateSigningIdentity, listSigningIdentities, revokeTrustedSigner, trustedSignerContext, trustSigner } from "./lib/authentication.js";
|
|
3
|
+
import { exportHttpsSnapshot, pullHttpsSnapshot } from "./lib/https-transport.js";
|
|
4
|
+
import { publishHttpsSnapshot } from "./lib/object-transport.js";
|
|
5
|
+
import { loadHttpsFeedState, publishHttpsFeed, pullHttpsFeed } from "./lib/feed-transport.js";
|
|
6
|
+
import { pullPeerCommand, servePeerOnce } from "./lib/peer-transport.js";
|
|
7
|
+
import { initSqliteAdapter, inspectSqliteAdapter, publishSqliteSnapshot, pullSqliteSnapshot } from "./lib/sqlite-transport.js";
|
|
8
|
+
import { booleanFlag, output } from "./cli-common.js";
|
|
9
|
+
|
|
10
|
+
export const sharingCommands = new Set([
|
|
11
|
+
"share-init",
|
|
12
|
+
"share-keygen",
|
|
13
|
+
"share-signers",
|
|
14
|
+
"share-trust",
|
|
15
|
+
"share-trust-revoke",
|
|
16
|
+
"share-trust-list",
|
|
17
|
+
"share-publish",
|
|
18
|
+
"share-pull",
|
|
19
|
+
"share-snapshot-export",
|
|
20
|
+
"share-https-publish",
|
|
21
|
+
"share-https-pull",
|
|
22
|
+
"share-feed-publish",
|
|
23
|
+
"share-feed-pull",
|
|
24
|
+
"share-feed-state",
|
|
25
|
+
"share-peer-serve",
|
|
26
|
+
"share-peer-pull",
|
|
27
|
+
"share-sqlite-init",
|
|
28
|
+
"share-sqlite-publish",
|
|
29
|
+
"share-sqlite-inspect",
|
|
30
|
+
"share-sqlite-pull",
|
|
31
|
+
"share-inbox",
|
|
32
|
+
"share-review",
|
|
33
|
+
"share-context",
|
|
34
|
+
"share-rollback",
|
|
35
|
+
"share-delete",
|
|
36
|
+
"share-config"
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
export async function runSharingCommand({ command, flags, positional, json }) {
|
|
40
|
+
if (command === "share-init") {
|
|
41
|
+
return output(await initDirectoryAdapter({
|
|
42
|
+
root: flags.root || process.cwd(), directory: positional[0], scopeId: flags.scope,
|
|
43
|
+
adapterId: flags.adapter, signerId: flags.signer || null,
|
|
44
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
45
|
+
}), json);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (command === "share-keygen") {
|
|
49
|
+
return output(await generateSigningIdentity({
|
|
50
|
+
root: flags.root || process.cwd(), signerId: positional[0], rotate: booleanFlag(flags.rotate),
|
|
51
|
+
publicOut: flags["public-out"] || null,
|
|
52
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
53
|
+
}), json);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (command === "share-signers") {
|
|
57
|
+
return output(await listSigningIdentities({ root: positional[0] || process.cwd() }), json);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (command === "share-trust") {
|
|
61
|
+
return output(await trustSigner({
|
|
62
|
+
root: flags.root || process.cwd(), publicIdentityPath: positional[0],
|
|
63
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
64
|
+
}), json);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (command === "share-trust-revoke") {
|
|
68
|
+
return output(await revokeTrustedSigner({
|
|
69
|
+
root: flags.root || process.cwd(), keyId: positional[0], reason: flags.reason,
|
|
70
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
71
|
+
}), json);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (command === "share-trust-list") {
|
|
75
|
+
return output(await trustedSignerContext({
|
|
76
|
+
root: positional[0] || process.cwd(), includeRevoked: booleanFlag(flags["include-revoked"])
|
|
77
|
+
}), json);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (command === "share-publish") {
|
|
81
|
+
return output(await publishLearning({
|
|
82
|
+
root: flags.root || process.cwd(), directory: positional[0], learningId: flags.learning,
|
|
83
|
+
eventId: flags.id, supersedesEventId: flags.supersedes || null, signerId: flags.signer || null,
|
|
84
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
85
|
+
}), json);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (command === "share-pull") {
|
|
89
|
+
return output(await pullShared({
|
|
90
|
+
root: flags.root || process.cwd(), directory: positional[0],
|
|
91
|
+
requireAuthenticated: booleanFlag(flags["require-authenticated"])
|
|
92
|
+
}), json);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (command === "share-snapshot-export") {
|
|
96
|
+
return output(await exportHttpsSnapshot({
|
|
97
|
+
root: flags.root || process.cwd(), directory: positional[0], output: flags.out,
|
|
98
|
+
snapshotId: flags.id,
|
|
99
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
100
|
+
}), json);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (command === "share-https-publish") {
|
|
104
|
+
return output(await publishHttpsSnapshot({
|
|
105
|
+
root: flags.root || process.cwd(), directory: positional[0], baseUrl: flags.base,
|
|
106
|
+
snapshotId: flags.id, tokenEnv: flags["token-env"] || null,
|
|
107
|
+
timeoutMs: Number(flags["timeout-ms"] ?? 10000),
|
|
108
|
+
allowPrivateNetwork: booleanFlag(flags["allow-private-network"]),
|
|
109
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
110
|
+
}), json);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (command === "share-https-pull") {
|
|
114
|
+
return output(await pullHttpsSnapshot({
|
|
115
|
+
root: flags.root || process.cwd(), url: positional[0], tokenEnv: flags["token-env"] || null,
|
|
116
|
+
timeoutMs: Number(flags["timeout-ms"] ?? 10000),
|
|
117
|
+
allowPrivateNetwork: booleanFlag(flags["allow-private-network"]),
|
|
118
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
119
|
+
}), json);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (command === "share-feed-publish") {
|
|
123
|
+
return output(await publishHttpsFeed({
|
|
124
|
+
root: flags.root || process.cwd(), directory: positional[0], baseUrl: flags.base,
|
|
125
|
+
feedId: flags.feed, signerId: flags.signer, snapshotId: flags.id,
|
|
126
|
+
tokenEnv: flags["token-env"] || null, timeoutMs: Number(flags["timeout-ms"] ?? 10000),
|
|
127
|
+
allowPrivateNetwork: booleanFlag(flags["allow-private-network"]),
|
|
128
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
129
|
+
}), json);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (command === "share-feed-pull") {
|
|
133
|
+
return output(await pullHttpsFeed({
|
|
134
|
+
root: flags.root || process.cwd(), baseUrl: flags.base, feedId: flags.feed,
|
|
135
|
+
tokenEnv: flags["token-env"] || null, timeoutMs: Number(flags["timeout-ms"] ?? 10000),
|
|
136
|
+
allowPrivateNetwork: booleanFlag(flags["allow-private-network"]),
|
|
137
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
138
|
+
}), json);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (command === "share-feed-state") {
|
|
142
|
+
return output(await loadHttpsFeedState(positional[0] || process.cwd()), json);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (command === "share-peer-serve") {
|
|
146
|
+
await servePeerOnce({
|
|
147
|
+
root: flags.root || process.cwd(), directory: positional[0], signerId: flags.signer,
|
|
148
|
+
input: process.stdin, output: process.stdout,
|
|
149
|
+
timeoutMs: Number(flags["timeout-ms"] ?? 10000),
|
|
150
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
151
|
+
});
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (command === "share-peer-pull") {
|
|
156
|
+
return output(await pullPeerCommand({
|
|
157
|
+
root: flags.root || process.cwd(), commandJson: flags["command-json"],
|
|
158
|
+
timeoutMs: Number(flags["timeout-ms"] ?? 10000),
|
|
159
|
+
maxBytes: Number(flags["max-bytes"] ?? 22 * 1024 * 1024),
|
|
160
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
161
|
+
}), json);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (command === "share-sqlite-init") {
|
|
165
|
+
return output(await initSqliteAdapter({
|
|
166
|
+
root: flags.root || process.cwd(), directory: positional[0], database: flags.database,
|
|
167
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
168
|
+
}), json);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (command === "share-sqlite-publish") {
|
|
172
|
+
return output(await publishSqliteSnapshot({
|
|
173
|
+
root: flags.root || process.cwd(), directory: positional[0], database: flags.database,
|
|
174
|
+
snapshotId: flags.id,
|
|
175
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
176
|
+
}), json);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (command === "share-sqlite-inspect") {
|
|
180
|
+
return output(await inspectSqliteAdapter({
|
|
181
|
+
root: flags.root || process.cwd(), database: flags.database
|
|
182
|
+
}), json);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (command === "share-sqlite-pull") {
|
|
186
|
+
return output(await pullSqliteSnapshot({
|
|
187
|
+
root: flags.root || process.cwd(), database: flags.database
|
|
188
|
+
}), json);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (command === "share-inbox") {
|
|
192
|
+
return output(await sharedInbox({ root: positional[0] || process.cwd(), status: flags.status || "pending" }), json);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (command === "share-review") {
|
|
196
|
+
return output(await reviewShared({
|
|
197
|
+
root: flags.root || process.cwd(), id: positional[0], decision: flags.decision,
|
|
198
|
+
reason: flags.reason, confirmedByUser: booleanFlag(flags["confirmed-by-user"])
|
|
199
|
+
}), json);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (command === "share-context") {
|
|
203
|
+
return output(await sharedContext({
|
|
204
|
+
root: positional[0] || process.cwd(), scopeId: flags.scope || null, groupId: flags.group || null,
|
|
205
|
+
includePrivate: booleanFlag(flags["include-private"]),
|
|
206
|
+
kinds: flags.kind ? String(flags.kind).split(",").filter(Boolean) : null,
|
|
207
|
+
subjectIds: flags.subject ? String(flags.subject).split(",").filter(Boolean) : null,
|
|
208
|
+
maxItems: flags["max-items"] === undefined ? null : Number(flags["max-items"])
|
|
209
|
+
}), json);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (command === "share-rollback") {
|
|
213
|
+
return output(await rollbackShared({
|
|
214
|
+
root: flags.root || process.cwd(), id: positional[0], reason: flags.reason
|
|
215
|
+
}), json);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (command === "share-delete") {
|
|
219
|
+
return output(await deleteShared({
|
|
220
|
+
root: flags.root || process.cwd(), id: positional[0],
|
|
221
|
+
confirmation: booleanFlag(flags["confirm-local-share"]) ? "local-share-confirmed" : null
|
|
222
|
+
}), json);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (command === "share-config") {
|
|
226
|
+
return output(await configureSharing({
|
|
227
|
+
root: positional[0] || process.cwd(), maxContextItems: Number(flags["max-items"])
|
|
228
|
+
}), json);
|
|
229
|
+
}
|
|
230
|
+
}
|