@martinloop/mcp 0.3.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -106
- package/dist/discovery-metadata.d.ts +1 -1
- package/dist/discovery-metadata.js +1 -1
- package/dist/resources.d.ts +1 -2
- package/dist/resources.js +190 -238
- package/dist/server-validation.d.ts +1 -1
- package/dist/server-validation.js +16 -11
- package/dist/server.d.ts +23 -0
- package/dist/server.js +152 -7
- package/dist/tools/run-dossier.d.ts +3 -1
- package/dist/tools/run-dossier.js +40 -2
- package/dist/tools/run-loop.d.ts +1 -4
- package/dist/tools/run-loop.js +6 -15
- package/dist/tools/tool-support.d.ts +2 -1
- package/dist/tools/tool-support.js +1 -12
- package/dist/vendor/adapters/claude-cli.js +38 -35
- package/dist/vendor/adapters/cli-bridge.d.ts +9 -1
- package/dist/vendor/adapters/cli-bridge.js +54 -13
- package/dist/vendor/adapters/codex-launcher.d.ts +61 -1
- package/dist/vendor/adapters/codex-launcher.js +118 -19
- package/dist/vendor/adapters/index.d.ts +1 -3
- package/dist/vendor/adapters/index.js +1 -3
- package/dist/vendor/adapters/openai-compatible.js +57 -18
- package/dist/vendor/contracts/adapter-capabilities.d.ts +1 -1
- package/dist/vendor/contracts/context-handoff.d.ts +100 -0
- package/dist/vendor/contracts/context-handoff.js +11 -0
- package/dist/vendor/contracts/context-manifest.d.ts +195 -0
- package/dist/vendor/contracts/context-manifest.js +17 -0
- package/dist/vendor/contracts/context-shadow.d.ts +75 -0
- package/dist/vendor/contracts/context-shadow.js +8 -0
- package/dist/vendor/contracts/exits.d.ts +126 -0
- package/dist/vendor/contracts/exits.js +32 -0
- package/dist/vendor/contracts/index.d.ts +39 -2
- package/dist/vendor/contracts/index.js +22 -0
- package/dist/vendor/contracts/mission.d.ts +102 -0
- package/dist/vendor/contracts/mission.js +64 -0
- package/dist/vendor/contracts/operator.d.ts +3 -1
- package/dist/vendor/contracts/operator.js +2 -1
- package/dist/vendor/contracts/verified-handoff.d.ts +100 -0
- package/dist/vendor/contracts/verified-handoff.js +35 -0
- package/dist/vendor/core/context-chain-gate.d.ts +89 -0
- package/dist/vendor/core/context-chain-gate.js +173 -0
- package/dist/vendor/core/context-compiler.d.ts +53 -0
- package/dist/vendor/core/context-compiler.js +261 -0
- package/dist/vendor/core/context-handoff.d.ts +42 -0
- package/dist/vendor/core/context-handoff.js +167 -0
- package/dist/vendor/core/context-shadow.d.ts +39 -0
- package/dist/vendor/core/context-shadow.js +200 -0
- package/dist/vendor/core/exit-signal.d.ts +88 -0
- package/dist/vendor/core/exit-signal.js +339 -0
- package/dist/vendor/core/exits.d.ts +41 -0
- package/dist/vendor/core/exits.js +258 -0
- package/dist/vendor/core/index.d.ts +42 -1
- package/dist/vendor/core/index.js +1086 -662
- package/dist/vendor/core/mission/aggregate.d.ts +27 -0
- package/dist/vendor/core/mission/aggregate.js +42 -0
- package/dist/vendor/core/mission/index.d.ts +2 -0
- package/dist/vendor/core/mission/index.js +1 -0
- package/dist/vendor/core/persistence/compiler.d.ts +8 -0
- package/dist/vendor/core/persistence/compiler.js +156 -0
- package/dist/vendor/core/persistence/context-handoff-store.d.ts +68 -0
- package/dist/vendor/core/persistence/context-handoff-store.js +112 -0
- package/dist/vendor/core/persistence/index.d.ts +4 -0
- package/dist/vendor/core/persistence/index.js +2 -0
- package/dist/vendor/core/persistence/ledger.d.ts +1 -1
- package/dist/vendor/core/persistence/mission-store.d.ts +56 -0
- package/dist/vendor/core/persistence/mission-store.js +281 -0
- package/dist/vendor/core/policy.d.ts +2 -0
- package/dist/vendor/core/policy.js +5 -2
- package/dist/vendor/core/rollback.js +15 -1
- package/dist/vendor/core/savings.d.ts +13 -0
- package/dist/vendor/core/savings.js +22 -0
- package/dist/vendor/core/termination-store.d.ts +15 -0
- package/dist/vendor/core/termination-store.js +44 -0
- package/dist/vendor/core/verified-handoff.d.ts +67 -0
- package/dist/vendor/core/verified-handoff.js +210 -0
- package/package.json +76 -83
- package/server.json +21 -21
- package/LICENSE +0 -216
- package/dist/vendor/adapters/adapters/src/claude-cli.d.ts +0 -146
- package/dist/vendor/adapters/adapters/src/claude-cli.js +0 -1100
- package/dist/vendor/adapters/adapters/src/cli-bridge.d.ts +0 -103
- package/dist/vendor/adapters/adapters/src/cli-bridge.js +0 -569
- package/dist/vendor/adapters/adapters/src/codex-launcher.d.ts +0 -78
- package/dist/vendor/adapters/adapters/src/codex-launcher.js +0 -663
- package/dist/vendor/adapters/adapters/src/direct-provider.d.ts +0 -10
- package/dist/vendor/adapters/adapters/src/direct-provider.js +0 -40
- package/dist/vendor/adapters/adapters/src/index.d.ts +0 -8
- package/dist/vendor/adapters/adapters/src/index.js +0 -8
- package/dist/vendor/adapters/adapters/src/openai-compatible.d.ts +0 -62
- package/dist/vendor/adapters/adapters/src/openai-compatible.js +0 -306
- package/dist/vendor/adapters/adapters/src/runtime-support.d.ts +0 -17
- package/dist/vendor/adapters/adapters/src/runtime-support.js +0 -59
- package/dist/vendor/adapters/adapters/src/stub-agent-cli.d.ts +0 -8
- package/dist/vendor/adapters/adapters/src/stub-agent-cli.js +0 -40
- package/dist/vendor/adapters/adapters/src/stub-direct-provider.d.ts +0 -8
- package/dist/vendor/adapters/adapters/src/stub-direct-provider.js +0 -12
- package/dist/vendor/adapters/adapters/src/verifier-only.d.ts +0 -9
- package/dist/vendor/adapters/adapters/src/verifier-only.js +0 -63
- package/dist/vendor/adapters/contracts/src/context-graph.d.ts +0 -48
- package/dist/vendor/adapters/contracts/src/context-graph.js +0 -26
- package/dist/vendor/adapters/contracts/src/execution-policy.d.ts +0 -78
- package/dist/vendor/adapters/contracts/src/execution-policy.js +0 -43
- package/dist/vendor/adapters/contracts/src/governance.d.ts +0 -24
- package/dist/vendor/adapters/contracts/src/governance.js +0 -11
- package/dist/vendor/adapters/contracts/src/identity.d.ts +0 -29
- package/dist/vendor/adapters/contracts/src/identity.js +0 -30
- package/dist/vendor/adapters/contracts/src/index.d.ts +0 -412
- package/dist/vendor/adapters/contracts/src/index.js +0 -225
- package/dist/vendor/adapters/contracts/src/operator.d.ts +0 -19
- package/dist/vendor/adapters/contracts/src/operator.js +0 -11
- package/dist/vendor/adapters/contracts/src/trajectory.d.ts +0 -26
- package/dist/vendor/adapters/contracts/src/trajectory.js +0 -27
- package/dist/vendor/adapters/core/src/compiler.d.ts +0 -52
- package/dist/vendor/adapters/core/src/compiler.js +0 -52
- package/dist/vendor/adapters/core/src/context-graph.d.ts +0 -3
- package/dist/vendor/adapters/core/src/context-graph.js +0 -371
- package/dist/vendor/adapters/core/src/context-integrity.d.ts +0 -26
- package/dist/vendor/adapters/core/src/context-integrity.js +0 -80
- package/dist/vendor/adapters/core/src/grounding.d.ts +0 -38
- package/dist/vendor/adapters/core/src/grounding.js +0 -273
- package/dist/vendor/adapters/core/src/identity.d.ts +0 -20
- package/dist/vendor/adapters/core/src/identity.js +0 -86
- package/dist/vendor/adapters/core/src/index.d.ts +0 -186
- package/dist/vendor/adapters/core/src/index.js +0 -1495
- package/dist/vendor/adapters/core/src/leash.d.ts +0 -48
- package/dist/vendor/adapters/core/src/leash.js +0 -497
- package/dist/vendor/adapters/core/src/persistence/compiler.d.ts +0 -18
- package/dist/vendor/adapters/core/src/persistence/compiler.js +0 -34
- package/dist/vendor/adapters/core/src/persistence/index.d.ts +0 -10
- package/dist/vendor/adapters/core/src/persistence/index.js +0 -5
- package/dist/vendor/adapters/core/src/persistence/integrity.d.ts +0 -39
- package/dist/vendor/adapters/core/src/persistence/integrity.js +0 -252
- package/dist/vendor/adapters/core/src/persistence/ledger.d.ts +0 -23
- package/dist/vendor/adapters/core/src/persistence/ledger.js +0 -9
- package/dist/vendor/adapters/core/src/persistence/memory-store.d.ts +0 -63
- package/dist/vendor/adapters/core/src/persistence/memory-store.js +0 -115
- package/dist/vendor/adapters/core/src/persistence/runs-reader.d.ts +0 -66
- package/dist/vendor/adapters/core/src/persistence/runs-reader.js +0 -140
- package/dist/vendor/adapters/core/src/persistence/store.d.ts +0 -89
- package/dist/vendor/adapters/core/src/persistence/store.js +0 -125
- package/dist/vendor/adapters/core/src/persistence/trace-store.d.ts +0 -85
- package/dist/vendor/adapters/core/src/persistence/trace-store.js +0 -125
- package/dist/vendor/adapters/core/src/policy-compiler.d.ts +0 -2
- package/dist/vendor/adapters/core/src/policy-compiler.js +0 -195
- package/dist/vendor/adapters/core/src/policy.d.ts +0 -156
- package/dist/vendor/adapters/core/src/policy.js +0 -704
- package/dist/vendor/adapters/core/src/repo-analyzer.d.ts +0 -53
- package/dist/vendor/adapters/core/src/repo-analyzer.js +0 -263
- package/dist/vendor/adapters/core/src/rollback.d.ts +0 -15
- package/dist/vendor/adapters/core/src/rollback.js +0 -253
- package/dist/vendor/adapters/core/src/routing.d.ts +0 -82
- package/dist/vendor/adapters/core/src/routing.js +0 -336
- package/dist/vendor/adapters/core/src/test-integrity.d.ts +0 -64
- package/dist/vendor/adapters/core/src/test-integrity.js +0 -197
- package/dist/vendor/adapters/core/src/trajectory.d.ts +0 -18
- package/dist/vendor/adapters/core/src/trajectory.js +0 -295
- package/dist/vendor/adapters/stub-agent-cli.d.ts +0 -8
- package/dist/vendor/adapters/stub-agent-cli.js +0 -40
- package/dist/vendor/adapters/verifier-only.d.ts +0 -9
- package/dist/vendor/adapters/verifier-only.js +0 -63
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Handoff — A-CTX-2 contracts.
|
|
3
|
+
*
|
|
4
|
+
* Chain verification circuit breaker for upstream-to-downstream context handoff.
|
|
5
|
+
*
|
|
6
|
+
* Rule: a downstream agent MUST NOT execute before verifyContextHandoff returns ok=true.
|
|
7
|
+
* Healthy handoffs are silent. Broken handoffs stop execution and return one reason code
|
|
8
|
+
* plus one recovery instruction. Never silently discard excluded or unverifiable context.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Overall integrity state of the upstream chain.
|
|
12
|
+
* "verified" — all upstream receipts and artifacts check out
|
|
13
|
+
* "evidence_boundary" — upstream integrity could not be established (no receipt)
|
|
14
|
+
* "tamper_detected" — receipt hash or artifact hash does not match
|
|
15
|
+
* "incomplete" — required fields or artifacts are absent
|
|
16
|
+
* "unsupported_schema"— handoff schemaVersion is not recognised
|
|
17
|
+
*/
|
|
18
|
+
export type ChainIntegrityState = "verified" | "evidence_boundary" | "tamper_detected" | "incomplete" | "unsupported_schema";
|
|
19
|
+
export type HandoffClaimState = "verified" | "unverified" | "rejected" | "unknown";
|
|
20
|
+
/** A single verifiable statement carried across the handoff boundary. */
|
|
21
|
+
export interface ContextHandoffClaim {
|
|
22
|
+
claimId: string;
|
|
23
|
+
statement: string;
|
|
24
|
+
evidenceRefs: string[];
|
|
25
|
+
verificationState: HandoffClaimState;
|
|
26
|
+
}
|
|
27
|
+
/** A content-addressed artifact that must be present and hash-stable across the boundary. */
|
|
28
|
+
export interface ContextHandoffArtifact {
|
|
29
|
+
path?: string;
|
|
30
|
+
sha256: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
label?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const HANDOFF_SCHEMA_VERSION: "martin.handoff.v1";
|
|
35
|
+
/**
|
|
36
|
+
* Immutable record produced by the upstream agent and verified before the
|
|
37
|
+
* downstream agent executes.
|
|
38
|
+
*
|
|
39
|
+
* upstreamIntegrity propagates from the parent handoff — it can never be
|
|
40
|
+
* upgraded by downstream success. A "tamper_detected" upstream remains
|
|
41
|
+
* "tamper_detected" regardless of what the current agent does.
|
|
42
|
+
*/
|
|
43
|
+
export interface ContextHandoffReceipt {
|
|
44
|
+
schemaVersion: typeof HANDOFF_SCHEMA_VERSION;
|
|
45
|
+
handoffId: string;
|
|
46
|
+
chainId: string;
|
|
47
|
+
missionId?: string;
|
|
48
|
+
producerRunId: string;
|
|
49
|
+
/** SHA-256 of the upstream run's canonical receipt file. */
|
|
50
|
+
producerReceiptHash: string;
|
|
51
|
+
/** Parent handoff IDs for multi-hop chain lineage. */
|
|
52
|
+
parentHandoffIds?: string[];
|
|
53
|
+
claims: ContextHandoffClaim[];
|
|
54
|
+
artifacts: ContextHandoffArtifact[];
|
|
55
|
+
/** Free-text assumptions that have not yet been verified at handoff time. */
|
|
56
|
+
unresolvedAssumptions: string[];
|
|
57
|
+
upstreamIntegrity: "verified" | "evidence_boundary" | "tamper_detected" | "incomplete";
|
|
58
|
+
createdAt: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Safe ledger record for a context object that was denied before reaching
|
|
62
|
+
* executable context.
|
|
63
|
+
*
|
|
64
|
+
* MUST NOT contain the secret value or raw denied content — only safe
|
|
65
|
+
* identity, hashes, and reason codes.
|
|
66
|
+
*/
|
|
67
|
+
export interface ContextExclusionDecision {
|
|
68
|
+
decision: "excluded";
|
|
69
|
+
objectId: string;
|
|
70
|
+
reasonCode: "secret_detected" | "policy_denied" | "authority_boundary" | "integrity_unverified";
|
|
71
|
+
reason: string;
|
|
72
|
+
/** SHA-256 of the denied content — never the content itself. */
|
|
73
|
+
sourceHash?: string;
|
|
74
|
+
excludedAt: string;
|
|
75
|
+
}
|
|
76
|
+
export interface ContextHandoffVerification {
|
|
77
|
+
ok: boolean;
|
|
78
|
+
integrity: ChainIntegrityState;
|
|
79
|
+
reasons: Array<{
|
|
80
|
+
code: string;
|
|
81
|
+
message: string;
|
|
82
|
+
claimId?: string;
|
|
83
|
+
artifactSha256?: string;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Decision produced by decideContextCircuitBreak.
|
|
88
|
+
*
|
|
89
|
+
* Healthy: { shouldStop: false, silent: true }
|
|
90
|
+
* Broken: { shouldStop: true, silent: false, reasonCode, message, nextAction }
|
|
91
|
+
*/
|
|
92
|
+
export interface ContextCircuitBreakResult {
|
|
93
|
+
shouldStop: boolean;
|
|
94
|
+
/** true = healthy, no human-visible output; false = must surface to caller */
|
|
95
|
+
silent: boolean;
|
|
96
|
+
verification: ContextHandoffVerification;
|
|
97
|
+
reasonCode?: string;
|
|
98
|
+
message?: string;
|
|
99
|
+
nextAction?: string;
|
|
100
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Handoff — A-CTX-2 contracts.
|
|
3
|
+
*
|
|
4
|
+
* Chain verification circuit breaker for upstream-to-downstream context handoff.
|
|
5
|
+
*
|
|
6
|
+
* Rule: a downstream agent MUST NOT execute before verifyContextHandoff returns ok=true.
|
|
7
|
+
* Healthy handoffs are silent. Broken handoffs stop execution and return one reason code
|
|
8
|
+
* plus one recovery instruction. Never silently discard excluded or unverifiable context.
|
|
9
|
+
*/
|
|
10
|
+
// ─── Receipt ──────────────────────────────────────────────────────────────────
|
|
11
|
+
export const HANDOFF_SCHEMA_VERSION = "martin.handoff.v1";
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Runtime — A-CTX-1 contracts.
|
|
3
|
+
*
|
|
4
|
+
* Defines the governed context layer: objects, budgets, manifests, ledger
|
|
5
|
+
* entries, fault protocol, and continuation checkpoints.
|
|
6
|
+
*
|
|
7
|
+
* Non-negotiable invariants (enforced in implementation, not type system):
|
|
8
|
+
* - No `confidence` float anywhere — use UsageEvidence enums only
|
|
9
|
+
* - No `outcome_delta` field anywhere — permanently banned
|
|
10
|
+
* - `nowMs` is always a captured input; never Date.now() inside a compiler
|
|
11
|
+
* - Secret scan hit → deny persistence entirely; reason-coded ledger entry only
|
|
12
|
+
* - Fault budget accumulates by taskId, NOT by runId
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Evidence quality for a metric or measurement.
|
|
16
|
+
*
|
|
17
|
+
* "observed" = distinctive substring from the object appears verbatim in model output
|
|
18
|
+
* "inferred" = weak kind correlation, narrow and documented per kind
|
|
19
|
+
* "unknown" = default; metrics MUST be withheld, never reported as zero
|
|
20
|
+
*/
|
|
21
|
+
export type UsageEvidence = "observed" | "inferred" | "unknown";
|
|
22
|
+
export type ContextKind = "mission" | "policy" | "security" | "task" | "continuation" | "working_diff" | "diagnostic" | "source" | "test" | "decision" | "todo" | "receipt_summary" | "tool_result";
|
|
23
|
+
export type ContextPriority = "required" | "high" | "normal" | "low";
|
|
24
|
+
export type ContextTrust = "authoritative" | "workspace" | "external" | "untrusted";
|
|
25
|
+
export type ContextSensitivity = "public" | "workspace" | "restricted" | "secret";
|
|
26
|
+
/** A typed, hashed, provenance-tracked object eligible for working-set inclusion. */
|
|
27
|
+
export interface ContextObject {
|
|
28
|
+
/** Stable identifier across revisions. */
|
|
29
|
+
id: string;
|
|
30
|
+
kind: ContextKind;
|
|
31
|
+
priority: ContextPriority;
|
|
32
|
+
trust: ContextTrust;
|
|
33
|
+
sensitivity: ContextSensitivity;
|
|
34
|
+
/** File path, receipt hash, or MCP URI — where the object originates. */
|
|
35
|
+
sourceRef: string;
|
|
36
|
+
/** SHA-256 of raw content. */
|
|
37
|
+
contentHash: string;
|
|
38
|
+
/** Git SHA or equivalent revision of the source file, if known. */
|
|
39
|
+
sourceRevisionHash?: string;
|
|
40
|
+
/** Pre-render token estimate used during selection. */
|
|
41
|
+
estimatedTokens: number;
|
|
42
|
+
/** Set iff the object was manually pinned; counts against pinnedTokensMax. */
|
|
43
|
+
pinnedBy?: string;
|
|
44
|
+
tags?: string[];
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Token budget for one context compilation pass.
|
|
49
|
+
*
|
|
50
|
+
* pinnedTokensMax REQUIRED: caps manual-pin tokens to prevent deterministic
|
|
51
|
+
* selector starvation. Any pin that would exceed this cap must be rejected.
|
|
52
|
+
*/
|
|
53
|
+
export interface ContextBudget {
|
|
54
|
+
modelWindowTokens: number;
|
|
55
|
+
systemReserveTokens: number;
|
|
56
|
+
outputReserveTokens: number;
|
|
57
|
+
toolReserveTokens: number;
|
|
58
|
+
overflowReserveTokens: number;
|
|
59
|
+
maxWorkingSetTokens: number;
|
|
60
|
+
/** Hard cap on manually-pinned token allocation. */
|
|
61
|
+
pinnedTokensMax: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The compiler's per-object inclusion/exclusion record.
|
|
65
|
+
*
|
|
66
|
+
* "included_truncated" is DISTINCT from "included" — truncation must be
|
|
67
|
+
* explicit in every receipt. Never use "included" for a truncated object.
|
|
68
|
+
*/
|
|
69
|
+
export interface ContextCandidateDecision {
|
|
70
|
+
objectId: string;
|
|
71
|
+
decision: "included" | "included_truncated" | "excluded" | "deferred" | "fault_loaded";
|
|
72
|
+
/**
|
|
73
|
+
* Only present when decision === "included_truncated".
|
|
74
|
+
* Records the pre-truncation token count for receipts.
|
|
75
|
+
*/
|
|
76
|
+
truncatedFromTokens?: number;
|
|
77
|
+
/** Machine-readable reason code for this decision. */
|
|
78
|
+
reason: string;
|
|
79
|
+
/** Actual post-render token count after adapter recount. Omitted pre-render. */
|
|
80
|
+
renderedTokens?: number;
|
|
81
|
+
}
|
|
82
|
+
export declare const CONTEXT_MANIFEST_VERSION: "context-manifest/1";
|
|
83
|
+
/**
|
|
84
|
+
* Immutable record of one context compilation pass.
|
|
85
|
+
*
|
|
86
|
+
* Determinism invariant:
|
|
87
|
+
* same inputs + policyHash + adapterVersion + nowMs → same manifestHash
|
|
88
|
+
*
|
|
89
|
+
* nowMs MUST be an explicit captured input — never Date.now() inside the
|
|
90
|
+
* compiler or rankContextObject.
|
|
91
|
+
*/
|
|
92
|
+
export interface ContextManifest {
|
|
93
|
+
schemaVersion: typeof CONTEXT_MANIFEST_VERSION;
|
|
94
|
+
/** SHA-256 of (decisions + budget + policyHash + adapterVersion + nowMs). */
|
|
95
|
+
manifestHash: string;
|
|
96
|
+
taskId: string;
|
|
97
|
+
runId: string;
|
|
98
|
+
/** Explicit input — never Date.now() inside the compiler. */
|
|
99
|
+
nowMs: number;
|
|
100
|
+
adapterVersion: string;
|
|
101
|
+
policyHash: string;
|
|
102
|
+
budget: ContextBudget;
|
|
103
|
+
decisions: ContextCandidateDecision[];
|
|
104
|
+
totalRenderedTokens: number;
|
|
105
|
+
/** Render pass count; must be ≤ MAX_RENDER_PASSES (5). */
|
|
106
|
+
renderPasses: number;
|
|
107
|
+
compilationDurationMs: number;
|
|
108
|
+
}
|
|
109
|
+
export declare const CONTEXT_LEDGER_VERSION: "context-ledger/1";
|
|
110
|
+
/**
|
|
111
|
+
* Fourth ledger entry type — on the SAME receipt chain as cost and verification.
|
|
112
|
+
*
|
|
113
|
+
* FORBIDDEN: confidence field, outcome_delta field — both permanently banned.
|
|
114
|
+
* overflowCount and faultBudgetUsed accumulate by taskId, NOT by runId.
|
|
115
|
+
*/
|
|
116
|
+
export interface ContextLedgerEntry {
|
|
117
|
+
schemaVersion: typeof CONTEXT_LEDGER_VERSION;
|
|
118
|
+
entryType: "context";
|
|
119
|
+
taskId: string;
|
|
120
|
+
runId: string;
|
|
121
|
+
manifestHash: string;
|
|
122
|
+
totalIncluded: number;
|
|
123
|
+
totalExcluded: number;
|
|
124
|
+
totalFaultLoaded: number;
|
|
125
|
+
/** Cumulative overflow count — resets per task, never per run. */
|
|
126
|
+
overflowCount: number;
|
|
127
|
+
/** Cumulative fault budget consumed — resets per task, never per run. */
|
|
128
|
+
faultBudgetUsed: number;
|
|
129
|
+
adapterVersion: string;
|
|
130
|
+
}
|
|
131
|
+
/** Request to demand-load a missing context object on fault. */
|
|
132
|
+
export interface ContextFaultRequest {
|
|
133
|
+
objectId: string;
|
|
134
|
+
taskId: string;
|
|
135
|
+
runId: string;
|
|
136
|
+
reason: string;
|
|
137
|
+
}
|
|
138
|
+
/** Result of a context fault resolution attempt. */
|
|
139
|
+
export interface ContextFaultResult {
|
|
140
|
+
objectId: string;
|
|
141
|
+
status: "loaded" | "unavailable" | "secret_blocked" | "budget_exceeded";
|
|
142
|
+
/** Post-render token count when status === "loaded". */
|
|
143
|
+
renderedTokens?: number;
|
|
144
|
+
ledgerEventEmitted: boolean;
|
|
145
|
+
}
|
|
146
|
+
/** Minimal task item tracked within a ContinuationCheckpoint. */
|
|
147
|
+
export interface TaskItem {
|
|
148
|
+
id: string;
|
|
149
|
+
description: string;
|
|
150
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
151
|
+
createdAtMs: number;
|
|
152
|
+
completedAtMs?: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Durable task state preserved outside the provider transcript.
|
|
156
|
+
*
|
|
157
|
+
* Write discipline (all enforced in CheckpointStore):
|
|
158
|
+
* - All writes MUST go through CheckpointStore.withTaskLock (CAS-locked).
|
|
159
|
+
* - Reject if store.read(taskId).sequenceNumber !== checkpoint.sequenceNumber - 1.
|
|
160
|
+
* - All array fields MUST be bounded before persistence.
|
|
161
|
+
* - Old completed entries MUST be compacted into completedSummaryHash.
|
|
162
|
+
*
|
|
163
|
+
* Testing requirement: two real concurrent Node processes, not jest mocks.
|
|
164
|
+
*/
|
|
165
|
+
export interface ContinuationCheckpoint {
|
|
166
|
+
schemaVersion: "checkpoint/1";
|
|
167
|
+
taskId: string;
|
|
168
|
+
/** CAS lock key: reject write if stored sequenceNumber !== this - 1. */
|
|
169
|
+
sequenceNumber: number;
|
|
170
|
+
/** SHA-256 of the previous checkpoint — integrity chain. */
|
|
171
|
+
parentHash: string;
|
|
172
|
+
/** Old completed[] compacted into a hash-referenced summary to bound size. */
|
|
173
|
+
completedSummaryHash?: string;
|
|
174
|
+
pending: TaskItem[];
|
|
175
|
+
inProgress: TaskItem[];
|
|
176
|
+
decisions: ContextCandidateDecision[];
|
|
177
|
+
createdAtMs: number;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Governs what may enter the working set, how much, and why.
|
|
181
|
+
* policyHash must be included in every manifestHash computation.
|
|
182
|
+
*/
|
|
183
|
+
export interface ContextPolicy {
|
|
184
|
+
policyHash: string;
|
|
185
|
+
/** Sensitivity levels that are unconditionally excluded. */
|
|
186
|
+
deniedSensitivities: ContextSensitivity[];
|
|
187
|
+
/** Trust levels that are unconditionally excluded. */
|
|
188
|
+
deniedTrustLevels: ContextTrust[];
|
|
189
|
+
/** Behaviour when required objects alone exceed budget. */
|
|
190
|
+
requiredOverBudgetAction: "explicit_escalation" | "fail_closed";
|
|
191
|
+
/** Maximum allowed compiler wall-clock duration in ms. */
|
|
192
|
+
maxCompilerDurationMs: number;
|
|
193
|
+
/** Maximum overhead ratio: compilationDurationMs / totalRenderedTokens. */
|
|
194
|
+
maxOverheadRatio: number;
|
|
195
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Runtime — A-CTX-1 contracts.
|
|
3
|
+
*
|
|
4
|
+
* Defines the governed context layer: objects, budgets, manifests, ledger
|
|
5
|
+
* entries, fault protocol, and continuation checkpoints.
|
|
6
|
+
*
|
|
7
|
+
* Non-negotiable invariants (enforced in implementation, not type system):
|
|
8
|
+
* - No `confidence` float anywhere — use UsageEvidence enums only
|
|
9
|
+
* - No `outcome_delta` field anywhere — permanently banned
|
|
10
|
+
* - `nowMs` is always a captured input; never Date.now() inside a compiler
|
|
11
|
+
* - Secret scan hit → deny persistence entirely; reason-coded ledger entry only
|
|
12
|
+
* - Fault budget accumulates by taskId, NOT by runId
|
|
13
|
+
*/
|
|
14
|
+
// ─── ContextManifest ─────────────────────────────────────────────────────────
|
|
15
|
+
export const CONTEXT_MANIFEST_VERSION = "context-manifest/1";
|
|
16
|
+
// ─── ContextLedgerEntry ───────────────────────────────────────────────────────
|
|
17
|
+
export const CONTEXT_LEDGER_VERSION = "context-ledger/1";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Shadow — A-CTX-0 schema contracts.
|
|
3
|
+
*
|
|
4
|
+
* Shadow mode observes the existing prompt without altering it.
|
|
5
|
+
* No source text is retained in manifests or receipts — only hashes and counts.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CONTEXT_SHADOW_MANIFEST_VERSION: "context-shadow-manifest/1";
|
|
8
|
+
export declare const CONTEXT_C5_VERSION: "context-c5/1";
|
|
9
|
+
export type ContextEvidence = "observed" | "configured" | "inferred" | "unknown";
|
|
10
|
+
export type ContextShadowSegmentKind = "system" | "mission" | "task" | "workspace" | "diagnostic" | "tool" | "other";
|
|
11
|
+
export interface ContextShadowSegmentInput {
|
|
12
|
+
segmentId: string;
|
|
13
|
+
kind: ContextShadowSegmentKind;
|
|
14
|
+
required: boolean;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ContextShadowDecisionV1 {
|
|
18
|
+
segmentId: string;
|
|
19
|
+
kind: string;
|
|
20
|
+
/** SHA-256 of segment.text — never the source text itself. */
|
|
21
|
+
contentHash: string;
|
|
22
|
+
estimatedTokens: number;
|
|
23
|
+
/** Always true in shadow mode — actual prompt is never altered. */
|
|
24
|
+
actuallyIncluded: true;
|
|
25
|
+
/** What the shadow compiler would have decided if it controlled selection. */
|
|
26
|
+
proposedDecision: "included" | "excluded";
|
|
27
|
+
reason: "required" | "within_shadow_budget" | "shadow_budget_exhausted" | "required_over_budget";
|
|
28
|
+
}
|
|
29
|
+
export interface ContextShadowManifestV1 {
|
|
30
|
+
schemaVersion: typeof CONTEXT_SHADOW_MANIFEST_VERSION;
|
|
31
|
+
manifestId: string;
|
|
32
|
+
/** SHA-256 of the canonical JSON of the manifest (excluding manifestId and manifestHash). */
|
|
33
|
+
manifestHash: string;
|
|
34
|
+
/** SHA-256 of the canonical compiler input, for cross-run determinism checks. */
|
|
35
|
+
compilerInputHash: string;
|
|
36
|
+
runId: string;
|
|
37
|
+
taskId?: string;
|
|
38
|
+
adapter: string;
|
|
39
|
+
model?: string;
|
|
40
|
+
capturedAt: string;
|
|
41
|
+
mode: "shadow";
|
|
42
|
+
modelWindowTokens: number | null;
|
|
43
|
+
modelWindowEvidence: ContextEvidence;
|
|
44
|
+
shadowBudgetTokens: number;
|
|
45
|
+
/** SHA-256 of framed source segments — confirms prompt identity without storing content. */
|
|
46
|
+
actualPromptHash: string;
|
|
47
|
+
/** Estimated token count of all segments (actual prompt). */
|
|
48
|
+
actualEstimatedTokens: number;
|
|
49
|
+
/** Estimated token count of shadow-selected segments only. */
|
|
50
|
+
proposedEstimatedTokens: number;
|
|
51
|
+
/** True if required segments alone exceed shadowBudgetTokens. */
|
|
52
|
+
requiredOverBudget: boolean;
|
|
53
|
+
decisions: ContextShadowDecisionV1[];
|
|
54
|
+
}
|
|
55
|
+
export interface ContextC5EnvelopeV1 {
|
|
56
|
+
schemaVersion: typeof CONTEXT_C5_VERSION;
|
|
57
|
+
resource: "context";
|
|
58
|
+
event: "shadow_compiled";
|
|
59
|
+
runId: string;
|
|
60
|
+
taskId?: string;
|
|
61
|
+
manifestId: string;
|
|
62
|
+
manifestHash: string;
|
|
63
|
+
adapter: string;
|
|
64
|
+
model?: string;
|
|
65
|
+
mode: "shadow";
|
|
66
|
+
actualEstimatedTokens: number;
|
|
67
|
+
proposedEstimatedTokens: number;
|
|
68
|
+
candidateCount: number;
|
|
69
|
+
includedCount: number;
|
|
70
|
+
excludedCount: number;
|
|
71
|
+
requiredOverBudget: boolean;
|
|
72
|
+
modelWindowTokens: number | null;
|
|
73
|
+
modelWindowEvidence: ContextEvidence;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Shadow — A-CTX-0 schema contracts.
|
|
3
|
+
*
|
|
4
|
+
* Shadow mode observes the existing prompt without altering it.
|
|
5
|
+
* No source text is retained in manifests or receipts — only hashes and counts.
|
|
6
|
+
*/
|
|
7
|
+
export const CONTEXT_SHADOW_MANIFEST_VERSION = "context-shadow-manifest/1";
|
|
8
|
+
export const CONTEXT_C5_VERSION = "context-c5/1";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit contracts for the MartinLoop Eight-Exit Runtime.
|
|
3
|
+
*
|
|
4
|
+
* Precedence rationale (product decision — changing EXIT_PRECEDENCE in core
|
|
5
|
+
* requires updating this paragraph in the same commit):
|
|
6
|
+
* 1. human_interrupt and external_event outrank all others — they represent
|
|
7
|
+
* authority external to the run's own evidence and cannot be argued with.
|
|
8
|
+
* 2. wall_clock, budget_cap, and turn_cap all outrank goal_met — governance
|
|
9
|
+
* limits (time, cost, iterations) cannot be overridden by a simultaneously
|
|
10
|
+
* verified goal; resource limits rank wall_clock > budget_cap > turn_cap.
|
|
11
|
+
* 3. turn_cap is suppressed at signal-generation time when the goal is already
|
|
12
|
+
* met, so goal_met and turn_cap cannot co-occur in a well-formed evaluation.
|
|
13
|
+
* Completing on the final permitted iteration is legitimate success, not an
|
|
14
|
+
* overrun; turn_cap fires only when iterations are exhausted without
|
|
15
|
+
* verified completion.
|
|
16
|
+
* 4. goal_met outranks error_threshold and no_progress — a deterministically
|
|
17
|
+
* verified result takes priority over soft progress signals.
|
|
18
|
+
*/
|
|
19
|
+
export declare const EXIT_POLICY_VERSION: "exit-policy/1";
|
|
20
|
+
export declare const EXIT_EVALUATION_VERSION: "exit-evaluation/1";
|
|
21
|
+
export declare const EXIT_SIGNAL_VERSION: "exit-signal/1";
|
|
22
|
+
export declare const TERMINATION_ENVELOPE_VERSION: "termination/1";
|
|
23
|
+
export declare const EXIT_KINDS: readonly ["goal_met", "turn_cap", "budget_cap", "wall_clock", "no_progress", "human_interrupt", "error_threshold", "external_event"];
|
|
24
|
+
export type ExitKind = (typeof EXIT_KINDS)[number];
|
|
25
|
+
export type ExitEvaluationPhase = "pre_run" | "pre_attempt" | "post_attempt" | "before_retry" | "during_attempt";
|
|
26
|
+
export type ExternalEventDisposition = "satisfied" | "superseded" | "cancelled";
|
|
27
|
+
export interface ExternalExitEvent {
|
|
28
|
+
source: string;
|
|
29
|
+
event: string;
|
|
30
|
+
disposition: ExternalEventDisposition;
|
|
31
|
+
observedAt: string;
|
|
32
|
+
subject?: string;
|
|
33
|
+
reason?: string;
|
|
34
|
+
evidenceUri?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ExitPolicyV1 {
|
|
37
|
+
schemaVersion: typeof EXIT_POLICY_VERSION;
|
|
38
|
+
goal: {
|
|
39
|
+
verifierRequired: boolean;
|
|
40
|
+
minimumScore: number;
|
|
41
|
+
};
|
|
42
|
+
turns: {
|
|
43
|
+
max: number;
|
|
44
|
+
};
|
|
45
|
+
budget: {
|
|
46
|
+
maxUsd: number;
|
|
47
|
+
maxTokens: number;
|
|
48
|
+
};
|
|
49
|
+
wallClock: {
|
|
50
|
+
maxElapsedMs: number;
|
|
51
|
+
deadlineAt?: string;
|
|
52
|
+
};
|
|
53
|
+
progress: {
|
|
54
|
+
windowSize: number;
|
|
55
|
+
unchangedStateLimit: number;
|
|
56
|
+
};
|
|
57
|
+
errors: {
|
|
58
|
+
maxConsecutive: number;
|
|
59
|
+
};
|
|
60
|
+
humanInterrupt: {
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
};
|
|
63
|
+
externalEvent: {
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface ExitSignalV1 {
|
|
68
|
+
schemaVersion: typeof EXIT_SIGNAL_VERSION;
|
|
69
|
+
runId: string;
|
|
70
|
+
kind: "human_interrupt" | "external_event";
|
|
71
|
+
requestedAt: string;
|
|
72
|
+
requestedBy: string;
|
|
73
|
+
reason?: string;
|
|
74
|
+
externalEvent?: ExternalExitEvent;
|
|
75
|
+
}
|
|
76
|
+
export interface ExitSnapshotV1 {
|
|
77
|
+
phase: ExitEvaluationPhase;
|
|
78
|
+
evaluatedAt: string;
|
|
79
|
+
runStartedAtMs: number;
|
|
80
|
+
nowMs: number;
|
|
81
|
+
turnsUsed: number;
|
|
82
|
+
actualUsd: number;
|
|
83
|
+
tokensUsed: number;
|
|
84
|
+
result?: {
|
|
85
|
+
status: "completed" | "failed";
|
|
86
|
+
verificationPassed: boolean;
|
|
87
|
+
verifierScore: number;
|
|
88
|
+
};
|
|
89
|
+
recentStateHashes: string[];
|
|
90
|
+
consecutiveErrors: number;
|
|
91
|
+
humanInterrupt?: ExitSignalV1;
|
|
92
|
+
externalEvent?: ExternalExitEvent;
|
|
93
|
+
trajectoryStop?: {
|
|
94
|
+
shouldStop: boolean;
|
|
95
|
+
reason: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface ExitMatchV1 {
|
|
99
|
+
kind: ExitKind;
|
|
100
|
+
reason: string;
|
|
101
|
+
evidence: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
export interface ExitEvaluationV1 {
|
|
104
|
+
schemaVersion: typeof EXIT_EVALUATION_VERSION;
|
|
105
|
+
policyVersion: typeof EXIT_POLICY_VERSION;
|
|
106
|
+
shouldExit: boolean;
|
|
107
|
+
primary?: ExitKind;
|
|
108
|
+
matched: ExitKind[];
|
|
109
|
+
phase: ExitEvaluationPhase;
|
|
110
|
+
evaluatedAt: string;
|
|
111
|
+
matches: ExitMatchV1[];
|
|
112
|
+
}
|
|
113
|
+
export type TerminationEnvelopeV1 = {
|
|
114
|
+
schemaVersion: typeof TERMINATION_ENVELOPE_VERSION;
|
|
115
|
+
class: "operational_exit";
|
|
116
|
+
exit: ExitEvaluationV1;
|
|
117
|
+
} | {
|
|
118
|
+
schemaVersion: typeof TERMINATION_ENVELOPE_VERSION;
|
|
119
|
+
class: "guard_stop";
|
|
120
|
+
guard: {
|
|
121
|
+
reasonCode: string;
|
|
122
|
+
reason: string;
|
|
123
|
+
failureClass?: string;
|
|
124
|
+
safetySurface?: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit contracts for the MartinLoop Eight-Exit Runtime.
|
|
3
|
+
*
|
|
4
|
+
* Precedence rationale (product decision — changing EXIT_PRECEDENCE in core
|
|
5
|
+
* requires updating this paragraph in the same commit):
|
|
6
|
+
* 1. human_interrupt and external_event outrank all others — they represent
|
|
7
|
+
* authority external to the run's own evidence and cannot be argued with.
|
|
8
|
+
* 2. wall_clock, budget_cap, and turn_cap all outrank goal_met — governance
|
|
9
|
+
* limits (time, cost, iterations) cannot be overridden by a simultaneously
|
|
10
|
+
* verified goal; resource limits rank wall_clock > budget_cap > turn_cap.
|
|
11
|
+
* 3. turn_cap is suppressed at signal-generation time when the goal is already
|
|
12
|
+
* met, so goal_met and turn_cap cannot co-occur in a well-formed evaluation.
|
|
13
|
+
* Completing on the final permitted iteration is legitimate success, not an
|
|
14
|
+
* overrun; turn_cap fires only when iterations are exhausted without
|
|
15
|
+
* verified completion.
|
|
16
|
+
* 4. goal_met outranks error_threshold and no_progress — a deterministically
|
|
17
|
+
* verified result takes priority over soft progress signals.
|
|
18
|
+
*/
|
|
19
|
+
export const EXIT_POLICY_VERSION = "exit-policy/1";
|
|
20
|
+
export const EXIT_EVALUATION_VERSION = "exit-evaluation/1";
|
|
21
|
+
export const EXIT_SIGNAL_VERSION = "exit-signal/1";
|
|
22
|
+
export const TERMINATION_ENVELOPE_VERSION = "termination/1";
|
|
23
|
+
export const EXIT_KINDS = [
|
|
24
|
+
"goal_met",
|
|
25
|
+
"turn_cap",
|
|
26
|
+
"budget_cap",
|
|
27
|
+
"wall_clock",
|
|
28
|
+
"no_progress",
|
|
29
|
+
"human_interrupt",
|
|
30
|
+
"error_threshold",
|
|
31
|
+
"external_event"
|
|
32
|
+
];
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contracts for the Martin Loop agentic system.
|
|
3
|
+
*
|
|
4
|
+
* This module defines the core type contracts and data structures for autonomous agent loop management,
|
|
5
|
+
* including loop lifecycle states, task definitions, budget tracking, cost accounting, verification,
|
|
6
|
+
* patch decisions, telemetry, and governance policies. It provides the public API surface for
|
|
7
|
+
* creating and managing loop records, handling events, validating batches, and tracking
|
|
8
|
+
* portfolio snapshots and routing economics.
|
|
9
|
+
*/
|
|
10
|
+
import type { TerminationEnvelopeV1 } from "./exits.js";
|
|
1
11
|
export type LoopStatus = "queued" | "running" | "verifying" | "completed" | "failed" | "exited";
|
|
2
|
-
export type LoopLifecycleState = "created" | "running" | "verifying" | "completed" | "budget_exit" | "diminishing_returns" | "stuck_exit" | "human_escalation";
|
|
12
|
+
export type LoopLifecycleState = "created" | "running" | "verifying" | "completed" | "budget_exit" | "diminishing_returns" | "stuck_exit" | "human_escalation" | "wall_clock" | "error_threshold" | "external_event";
|
|
3
13
|
export declare const FAILURE_CLASSES: readonly ["logic_error", "hallucination", "syntax_error", "type_error", "test_regression", "scope_creep", "no_progress", "repo_grounding_failure", "verification_failure", "environment_mismatch", "budget_pressure", "safety_leash_blocked", "sandbox_write_blocked"];
|
|
4
14
|
export type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
5
15
|
export type InterventionType = "compress_context" | "change_model" | "tighten_task" | "switch_adapter" | "run_verifier" | "escalate_human" | "stop_loop";
|
|
6
|
-
export type LoopEventType = "run.started" | "attempt.started" | "attempt.completed" | "failure.classified" | "intervention.selected" | "verification.completed" | "budget.updated" | "run.completed";
|
|
16
|
+
export type LoopEventType = "run.started" | "attempt.started" | "attempt.completed" | "failure.classified" | "intervention.selected" | "verification.completed" | "budget.updated" | "run.completed" | "run.terminated";
|
|
7
17
|
export interface LoopTask {
|
|
8
18
|
title: string;
|
|
9
19
|
objective: string;
|
|
@@ -12,6 +22,8 @@ export interface LoopTask {
|
|
|
12
22
|
verificationTimeoutMs?: number;
|
|
13
23
|
verificationStack?: VerificationStep[];
|
|
14
24
|
mutationMode?: MutationMode;
|
|
25
|
+
/** Explicit task-authority evidence that all definition-of-done criteria were satisfied before execution. */
|
|
26
|
+
definitionOfDonePreSatisfied?: boolean;
|
|
15
27
|
executionProfile?: ExecutionProfile;
|
|
16
28
|
allowedNetworkDomains?: string[];
|
|
17
29
|
approvalPolicy?: ApprovalPolicy;
|
|
@@ -73,6 +85,16 @@ export interface ReceiptScope {
|
|
|
73
85
|
workingDirectory?: string;
|
|
74
86
|
invocationRoot?: string;
|
|
75
87
|
runsRoot?: string;
|
|
88
|
+
/** Sandbox mode the mission requested before execution. */
|
|
89
|
+
requestedSandbox?: "read-only" | "workspace-write" | "danger-full-access";
|
|
90
|
+
/** Effective sandbox capability detected by pre-run filesystem probe. */
|
|
91
|
+
effectiveSandbox?: "read-only" | "workspace-write" | "unknown";
|
|
92
|
+
/** Absolute path that the filesystem write probe tested. */
|
|
93
|
+
writableRoot?: string;
|
|
94
|
+
/** How the effective sandbox was determined. */
|
|
95
|
+
capabilitySource?: "probe" | "configured" | "unknown";
|
|
96
|
+
/** Enforced demo changes (DEMO.md-only enforcement output). */
|
|
97
|
+
demoChangedFiles?: string[];
|
|
76
98
|
}
|
|
77
99
|
export type ReceiptIntegrityState = "verified" | "unsigned" | "tamper_detected" | "relocated" | "material_missing" | "selector_noncanonical";
|
|
78
100
|
export interface ReceiptIntegritySummary {
|
|
@@ -156,6 +178,8 @@ export interface LoopRecord {
|
|
|
156
178
|
receiptScope?: ReceiptScope;
|
|
157
179
|
receiptIntegrity?: ReceiptIntegritySummary;
|
|
158
180
|
routingEconomics?: RoutingEconomics;
|
|
181
|
+
/** Canonical termination identity written by finishFromEvaluation. Present when run ended via exit policy. */
|
|
182
|
+
terminationEnvelope?: TerminationEnvelopeV1;
|
|
159
183
|
}
|
|
160
184
|
export interface LoopRecordDraft {
|
|
161
185
|
loopId?: string;
|
|
@@ -175,6 +199,7 @@ export interface LoopRecordDraft {
|
|
|
175
199
|
updatedAt?: string;
|
|
176
200
|
receiptScope?: ReceiptScope;
|
|
177
201
|
receiptIntegrity?: ReceiptIntegritySummary;
|
|
202
|
+
terminationEnvelope?: TerminationEnvelopeV1;
|
|
178
203
|
}
|
|
179
204
|
export type { MartinErrorCategory, MartinOutputMode, MartinRunListFilters, MartinRunSelector } from "./operator.js";
|
|
180
205
|
export { MARTIN_ERROR_CATEGORIES } from "./operator.js";
|
|
@@ -410,5 +435,17 @@ export { cloneIdentityAttestation, cloneIdentityClaims, cloneIdentityToken } fro
|
|
|
410
435
|
export type { IdentityAttestation, IdentityClaims, IdentityToken } from "./identity.js";
|
|
411
436
|
export { cloneCircuitBreakDecision, cloneTrajectoryAssessment } from "./trajectory.js";
|
|
412
437
|
export type { CircuitBreakDecision, TrajectoryAssessment, TrajectorySignal } from "./trajectory.js";
|
|
438
|
+
export { EXIT_KINDS, EXIT_POLICY_VERSION, EXIT_EVALUATION_VERSION, EXIT_SIGNAL_VERSION, TERMINATION_ENVELOPE_VERSION } from "./exits.js";
|
|
439
|
+
export type { ExitKind, ExitEvaluationPhase, ExternalEventDisposition, ExternalExitEvent, ExitPolicyV1, ExitSignalV1, ExitSnapshotV1, ExitMatchV1, ExitEvaluationV1, TerminationEnvelopeV1 } from "./exits.js";
|
|
413
440
|
export { ALLOWED_ACTION_TYPES, DELIVERY_MESSAGE_SCHEMA_VERSION, DELIVERY_RECORD_SCHEMA_VERSION, MESSAGE_SELECTION_RESPONSE_SCHEMA_VERSION } from "./delivery.js";
|
|
414
441
|
export type { ActionType, DeliveryMessage, DeliveryRecord, MessageKind, MessageSelectionResponse, UpdateAvailableField } from "./delivery.js";
|
|
442
|
+
export { CONTEXT_SHADOW_MANIFEST_VERSION, CONTEXT_C5_VERSION } from "./context-shadow.js";
|
|
443
|
+
export type { ContextC5EnvelopeV1, ContextEvidence, ContextShadowDecisionV1, ContextShadowManifestV1, ContextShadowSegmentInput, ContextShadowSegmentKind } from "./context-shadow.js";
|
|
444
|
+
export { CONTEXT_MANIFEST_VERSION, CONTEXT_LEDGER_VERSION } from "./context-manifest.js";
|
|
445
|
+
export type { ContinuationCheckpoint, ContextBudget, ContextCandidateDecision, ContextFaultRequest, ContextFaultResult, ContextKind, ContextLedgerEntry, ContextManifest, ContextObject, ContextPolicy, ContextPriority, ContextSensitivity, ContextTrust, TaskItem, UsageEvidence } from "./context-manifest.js";
|
|
446
|
+
export { EVIDENCE_STATUSES, TEST_INTEGRITY_STATUSES, TEST_INTEGRITY_VERDICTS, VERIFIED_HANDOFF_OUTCOMES, } from "./verified-handoff.js";
|
|
447
|
+
export type { EvidenceStatus, TestIntegrityStatus, TestIntegrityVerdict, VerifiedHandoffCheckV1, VerifiedHandoffOutcome, VerifiedHandoffRecoveryV1, VerifiedHandoffRequirementV1, VerifiedHandoffScopeV1, VerifiedHandoffTestIntegrityV1, VerifiedHandoffV1, } from "./verified-handoff.js";
|
|
448
|
+
export { HANDOFF_SCHEMA_VERSION } from "./context-handoff.js";
|
|
449
|
+
export type { ChainIntegrityState, ContextCircuitBreakResult, ContextExclusionDecision, ContextHandoffArtifact, ContextHandoffClaim, ContextHandoffReceipt, ContextHandoffVerification, HandoffClaimState } from "./context-handoff.js";
|
|
450
|
+
export { MISSION_SCHEMA_VERSION, MISSION_STATUSES, ALLOWED_MISSION_TRANSITIONS, createMissionRecord, isMissionTransitionAllowed } from './mission.js';
|
|
451
|
+
export type { MissionStatus, MissionDecision, MissionBudget, MissionCost, MissionRunLink, MissionRunRole, MissionApproval, MissionOutcome, MissionEvent, MissionEventKind, MissionRecord, MissionDraft } from './mission.js';
|