@motebit/protocol 1.0.0 → 1.2.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/dist/dispute.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * for dispute resolution in agent-to-agent delegations. Any implementation can
6
6
  * produce and verify dispute artifacts using these types.
7
7
  */
8
+ import type { MerkleInclusionProof } from "./retention-policy.js";
8
9
  /** Dispute lifecycle states. Terminal states (final, expired) are irreversible. */
9
10
  export type DisputeState = "opened" | "evidence" | "arbitration" | "resolved" | "appealed" | "final" | "expired";
10
11
  /** Dispute resolution outcome. */
@@ -87,10 +88,12 @@ export interface DisputeEvidence {
87
88
  * Foundation Law (§6.5):
88
89
  * - Federation resolution must include individual AdjudicatorVote entries
89
90
  * - Aggregated-only verdicts are rejected
90
- * - Each vote signature MUST cover `dispute_id` — votes are not portable
91
- * across disputes (a malicious adjudicator collecting old votes from
92
- * other disputes cannot stuff them into a new resolution because the
93
- * dispute_id binding breaks the signature).
91
+ * - Each vote signature MUST cover `dispute_id` AND `round` — votes are
92
+ * not portable across disputes OR adjudication rounds (a malicious
93
+ * adjudicator collecting old votes from other disputes cannot stuff
94
+ * them into a new resolution because the dispute_id binding breaks
95
+ * the signature; a leader cannot replay round-1 vote bytes as round-2
96
+ * evidence because the round binding breaks the signature).
94
97
  */
95
98
  export interface AdjudicatorVote {
96
99
  /**
@@ -101,6 +104,13 @@ export interface AdjudicatorVote {
101
104
  * fails to verify against the wrong binding).
102
105
  */
103
106
  dispute_id: string;
107
+ /**
108
+ * Adjudication round. 1 for original adjudication; 2 for §8.3 appeal.
109
+ * Signature-bound (§6.5): a peer's round-1 vote bytes do not satisfy
110
+ * round-2 binding even for the same evidence. The §8.3 round-isolation
111
+ * property is enforced cryptographically, not by leader bookkeeping.
112
+ */
113
+ round: number;
104
114
  /** Federation peer MotebitId. */
105
115
  peer_id: string;
106
116
  /** Vote outcome. */
@@ -115,6 +125,55 @@ export interface AdjudicatorVote {
115
125
  /** Ed25519 by the voting peer over canonical JSON of all fields except signature. */
116
126
  signature: string;
117
127
  }
128
+ /**
129
+ * Federation vote request — leader-to-peer fan-out body for §6.2
130
+ * federation adjudication. The leader (the relay where the dispute
131
+ * resolution was requested AND named in the dispute as filer or
132
+ * respondent) POSTs this to each active federation peer; each peer
133
+ * returns a signed `AdjudicatorVote`.
134
+ *
135
+ * Wire-format protocol type for `relay-federation@1.2` §16. The
136
+ * peer-side gate ladder (`spec/relay-federation-v1.md` §16.2) enforces:
137
+ * schema → known peer → requester-id binding → signature → freshness
138
+ * → operator policy configured.
139
+ *
140
+ * Foundation Law (`spec/dispute-v1.md` §6.5):
141
+ * - Signature MUST cover `dispute_id`, `round`, `requester_id`, and the
142
+ * evidence bundle. Cross-round replay and request-tampering both
143
+ * fail-closed.
144
+ * - For round=2 (appeal), `evidence_bundle` MUST carry the original
145
+ * round-1 evidence plus any new evidence introduced with the appeal
146
+ * (per §8.4).
147
+ */
148
+ export interface VoteRequest {
149
+ /** The dispute being adjudicated. MUST equal the URL `:disputeId` parameter. */
150
+ dispute_id: string;
151
+ /**
152
+ * Adjudication round. 1 for original adjudication; 2 for §8.3 appeal.
153
+ * Signature-bound — cross-round vote replay is cryptographically
154
+ * rejected.
155
+ */
156
+ round: number;
157
+ /** Original signed dispute artifact (§4.2). The peer can re-verify the dispute's provenance from this alone. */
158
+ dispute_request: DisputeRequest;
159
+ /**
160
+ * All evidence collected during the dispute's evidence window (§5.2).
161
+ * For round=2, MUST carry the original round-1 evidence plus any new
162
+ * evidence introduced with the appeal.
163
+ */
164
+ evidence_bundle: DisputeEvidence[];
165
+ /** Leader relay's `motebit_id`. MUST be a known peer to the receiver (gate 2). */
166
+ requester_id: string;
167
+ /** Unix ms when the leader signed. Used by gate 5 freshness check (default ±60s). */
168
+ requested_at: number;
169
+ /**
170
+ * Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"`
171
+ * (see DisputeRequest for the full recipe).
172
+ */
173
+ suite: "motebit-jcs-ed25519-b64-v1";
174
+ /** Base64url Ed25519 by the leader over `canonicalJson(body minus signature)`. */
175
+ signature: string;
176
+ }
118
177
  /**
119
178
  * Dispute resolution by adjudicator.
120
179
  *
@@ -173,4 +232,91 @@ export interface DisputeAppeal {
173
232
  /** Ed25519 over canonical JSON of all fields except signature. */
174
233
  signature: string;
175
234
  }
235
+ /**
236
+ * Evidence shape #1: disputant proves their peer pubkey is committed
237
+ * in the cert's `federation_graph_anchor.merkle_root` via an inclusion
238
+ * proof, but `witnessed_by[]` does not include them.
239
+ *
240
+ * Verifier in `@motebit/crypto` recomputes the proof against the cert's
241
+ * anchor root and asserts the leaf hash matches the canonical
242
+ * leaf-of-disputant-pubkey encoding (same hashing recipe as
243
+ * `relay-federation-v1.md` §7.6 / `credential-anchor-v1.md` §3).
244
+ */
245
+ export interface WitnessOmissionInclusionProofEvidence {
246
+ kind: "inclusion_proof";
247
+ /**
248
+ * Hex-encoded SHA-256 leaf hash for the disputant's federation pubkey
249
+ * under the anchor's canonicalization (lowercase hex pubkey bytes).
250
+ */
251
+ leaf_hash: string;
252
+ /** Inclusion proof against `cert.federation_graph_anchor.merkle_root`. */
253
+ proof: MerkleInclusionProof;
254
+ }
255
+ /**
256
+ * Evidence shape #2: disputant claims a peering relationship at
257
+ * `cert.horizon_ts` outside the cert's published anchor — i.e., the
258
+ * issuer published an incomplete or wrong anchor that omitted a peer
259
+ * who was peered with them at the horizon.
260
+ *
261
+ * The disputant supplies a signed peering artifact issued by the cert's
262
+ * issuer (e.g., a relay-federation PeeringConfirm or Heartbeat) whose
263
+ * timestamp window covers `cert.horizon_ts`. The verifier in
264
+ * `@motebit/crypto` asserts the embedded signature validates against
265
+ * the cert issuer's pubkey and the artifact's window covers
266
+ * `cert.horizon_ts`. Wire format of `peering_artifact` is opaque at this
267
+ * layer; verification dispatches on the artifact's own kind/spec.
268
+ */
269
+ export interface WitnessOmissionAlternativePeeringEvidence {
270
+ kind: "alternative_peering";
271
+ /**
272
+ * Signed peering artifact from the cert issuer — embeds its own
273
+ * signature. Carries enough fields for the verifier to re-check
274
+ * the issuer's signature and the peering window.
275
+ */
276
+ peering_artifact: Record<string, unknown>;
277
+ }
278
+ /** Discriminated evidence union — exactly one shape per dispute. */
279
+ export type WitnessOmissionEvidence = WitnessOmissionInclusionProofEvidence | WitnessOmissionAlternativePeeringEvidence;
280
+ /**
281
+ * Witness-omission dispute — files within 24h of `cert.issued_at`
282
+ * (`WITNESS_OMISSION_DISPUTE_WINDOW_MS` in `@motebit/crypto`) by a peer
283
+ * claiming the disputed cert's `witnessed_by[]` wrongly omits them.
284
+ *
285
+ * Foundation Law (Phase 4b-3 §4.4):
286
+ * - `cert_issuer` + `cert_signature` together pin the disputed cert —
287
+ * the relay reconciles the dispute against the cert in its local
288
+ * `relay_horizon_certs` table at validation time.
289
+ * - At least one evidence shape is required at filing time — either
290
+ * `inclusion_proof` (membership in the published anchor) or
291
+ * `alternative_peering` (peering attested outside the anchor).
292
+ * - The cert's `issued_at` is the lookup-derived clock for the 24h
293
+ * window — disputant-attested timestamps cannot widen the window.
294
+ * - Sustained disputes are reputation signals; the cert remains
295
+ * terminal (retention-policy.md decision 5).
296
+ */
297
+ export interface WitnessOmissionDispute {
298
+ /** UUID v7, generated by the disputant. */
299
+ dispute_id: string;
300
+ /** MotebitId / operator-id of the cert issuer — the relay that signed the disputed horizon cert. */
301
+ cert_issuer: string;
302
+ /**
303
+ * Hex-encoded signature of the disputed `append_only_horizon` cert.
304
+ * Opaque pointer; the relay resolves the cert from its local
305
+ * `relay_horizon_certs` table.
306
+ */
307
+ cert_signature: string;
308
+ /** MotebitId of the disputant peer claiming wrongful omission. */
309
+ disputant_motebit_id: string;
310
+ /** Exactly one of the two evidence shapes. */
311
+ evidence: WitnessOmissionEvidence;
312
+ /** Unix ms. */
313
+ filed_at: number;
314
+ /**
315
+ * Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"`
316
+ * (see DisputeRequest for the full recipe).
317
+ */
318
+ suite: "motebit-jcs-ed25519-b64-v1";
319
+ /** Ed25519 by disputant over canonical JSON of all fields except signature. */
320
+ signature: string;
321
+ }
176
322
  //# sourceMappingURL=dispute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispute.d.ts","sourceRoot":"","sources":["../src/dispute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,mFAAmF;AACnF,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,UAAU,GACV,aAAa,GACb,UAAU,GACV,UAAU,GACV,OAAO,GACP,SAAS,CAAC;AAEd,kCAAkC;AAClC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC;AAE/D,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,aAAa,GACb,iBAAiB,GACjB,cAAc,GACd,OAAO,CAAC;AAEZ,4DAA4D;AAC5D,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,OAAO,CAAC;AAItF;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,EAAE,4BAA4B,CAAC;IACpC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;CACnB;AAID,gEAAgE;AAChE,MAAM,MAAM,mBAAmB,GAC3B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;IACf,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,KAAK,EAAE,4BAA4B,CAAC;IACpC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;CACnB;AAeD;;;;;;;;;GASG;AACH,MAAM,WAAW,qCAAqC;IACpD,IAAI,EAAE,iBAAiB,CAAC;IACxB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,EAAE,oBAAoB,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,yCAAyC;IACxD,IAAI,EAAE,qBAAqB,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,oEAAoE;AACpE,MAAM,MAAM,uBAAuB,GAC/B,qCAAqC,GACrC,yCAAyC,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,oGAAoG;IACpG,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,8CAA8C;IAC9C,QAAQ,EAAE,uBAAuB,CAAC;IAClC,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,4BAA4B,CAAC;IACpC,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/index.d.ts CHANGED
@@ -85,6 +85,53 @@ export interface AgentTrustRecord {
85
85
  avg_quality?: number;
86
86
  /** Number of quality samples collected. */
87
87
  quality_sample_count?: number;
88
+ /**
89
+ * Most-recent verified hardware-attestation snapshot about the remote
90
+ * agent. Projected from the latest peer-issued `AgentTrustCredential`
91
+ * in the credential store at read time — never persisted on
92
+ * `agent_trust`. The credential is the authoritative source; caching
93
+ * the claim on the trust row would invite drift on revocation /
94
+ * re-attestation. Absent when no credential carries a claim.
95
+ *
96
+ * Shape mirrors `AgentHardwareAttestation` in `@motebit/panels` so
97
+ * surfaces can pass `AgentTrustRecord[]` straight to the Agents-panel
98
+ * adapter without per-field transformation. `score` is computed once
99
+ * at projection time via `scoreAttestation`
100
+ * (`packages/semiring/src/hardware-attestation.ts`) — keep both shapes
101
+ * byte-aligned. The same data flows into `HardwareAttestationSemiring`
102
+ * for routing — see `docs/doctrine/self-attesting-system.md`: a
103
+ * routing-input claim MUST be visible to the user.
104
+ */
105
+ hardware_attestation?: {
106
+ platform: HardwareAttestationClaim["platform"];
107
+ key_exported?: boolean;
108
+ score: number;
109
+ };
110
+ /**
111
+ * Most-recent observed-latency snapshot for delegations to this peer.
112
+ * Projected from the local `LatencyStatsStore` at read time — never
113
+ * persisted on `agent_trust`. The store is the authoritative source;
114
+ * caching avg/p95 on the trust row would invite drift on every new
115
+ * task. Absent when the store has zero samples for this pair.
116
+ *
117
+ * Same surface contract as `hardware_attestation`: every routing-input
118
+ * the runtime computes against MUST be visible to the user, per
119
+ * `docs/doctrine/self-attesting-system.md`. Latency factors into peer
120
+ * ranking through `agent-graph.ts`'s latency map (default 3000ms when
121
+ * stats are absent); the Agents-panel latency render is the user-facing
122
+ * surface for that input.
123
+ *
124
+ * Shape mirrors `AgentLatencyStats` in `@motebit/panels` so surfaces
125
+ * can pass `AgentTrustRecord[]` straight to the Agents-panel adapter
126
+ * without per-field transformation. Numbers in milliseconds; integer
127
+ * sample counts. The relay-side enricher uses the same shape from its
128
+ * `relay_latency_stats` table.
129
+ */
130
+ latency_stats?: {
131
+ avg_ms: number;
132
+ p95_ms: number;
133
+ sample_count: number;
134
+ };
88
135
  }
89
136
  /** Thresholds for automatic trust level promotion/demotion. */
90
137
  export interface TrustTransitionThresholds {
@@ -200,7 +247,8 @@ export declare enum EventType {
200
247
  TrustLevelChanged = "trust_level_changed",
201
248
  KeyRotated = "key_rotated",
202
249
  ComputerSessionOpened = "computer_session_opened",
203
- ComputerSessionClosed = "computer_session_closed"
250
+ ComputerSessionClosed = "computer_session_closed",
251
+ SkillLoaded = "skill_loaded"
204
252
  }
205
253
  export declare enum MemoryType {
206
254
  Episodic = "episodic",
@@ -321,6 +369,16 @@ export interface ToolAuditEntry {
321
369
  injection?: InjectionWarning;
322
370
  costUnits?: number;
323
371
  timestamp: number;
372
+ /**
373
+ * Sensitivity tier classified at write time. Optional in v1: pre-
374
+ * phase-5 entries drop the field, and the consolidation-cycle flush
375
+ * phase lazy-classifies on read per docs/doctrine/retention-policy.md
376
+ * §"Decision 6b". Tool-audit entries also carry an obligation floor
377
+ * resolved per record (settlement window, dispute window, regulatory
378
+ * floor); the cycle's flush phase computes
379
+ * `max(sensitivity_floor, obligation_floor)` per decision 3.
380
+ */
381
+ sensitivity?: SensitivityLevel;
324
382
  }
325
383
  export interface ToolDefinition {
326
384
  name: string;
@@ -340,6 +398,27 @@ export interface ToolDefinition {
340
398
  * last. See `@motebit/protocol/tool-mode`.
341
399
  */
342
400
  mode?: ToolMode;
401
+ /**
402
+ * Outbound axis — true when execution sends bytes outside the device
403
+ * (HTTP fetch, search-engine query, MCP server call,
404
+ * cross-motebit delegation). Independent of `riskHint` (which
405
+ * captures local risk: file overwrite, irreversible side effect).
406
+ *
407
+ * Consumed by the runtime's sensitivity-routing gate: an outbound
408
+ * tool refuses to execute when session sensitivity is
409
+ * medical/financial/secret AND the configured provider is not
410
+ * sovereign — the same fail-closed contract that gates AI provider
411
+ * calls (CLAUDE.md privacy doctrine: "Medical/financial/secret never
412
+ * reach external AI"; the principle generalizes to any outbound
413
+ * surface). Default `false`/absent ≡ local — matches the
414
+ * pre-existing builtin set (read_file, recall_memories, current_time).
415
+ *
416
+ * Tools added through `@motebit/mcp-client` always set this to
417
+ * `true` (MCP tools execute against a remote server by definition).
418
+ * See `check-tool-modes` for the cost-tier sibling and
419
+ * `check-sensitivity-routing` for the outbound enforcement gate.
420
+ */
421
+ outbound?: boolean;
343
422
  }
344
423
  export interface ToolResult {
345
424
  ok: boolean;
@@ -398,6 +477,14 @@ export interface SyncConversationMessage {
398
477
  tool_call_id: string | null;
399
478
  created_at: number;
400
479
  token_estimate: number;
480
+ /**
481
+ * Sensitivity tier classified at write time. Optional in v1: peers
482
+ * running pre-phase-5 builds drop the field on push, and the receiver
483
+ * lazy-classifies on flush per docs/doctrine/retention-policy.md
484
+ * §"Decision 6b" using the operator's
485
+ * `pre_classification_default_sensitivity`.
486
+ */
487
+ sensitivity?: import("./retention-policy.js").SensitivityLevelString;
401
488
  }
402
489
  /** Result of a conversation sync cycle. */
403
490
  export interface ConversationSyncResult {
@@ -614,9 +701,9 @@ export interface ExecutionReceipt {
614
701
  * Signed per-tool-call proof: one receipt per invocation of a tool during
615
702
  * an agent turn. Complements `ExecutionReceipt` (which commits to the
616
703
  * task as a whole) by committing to each individual tool call inside
617
- * the task — the finer-grained audit granularity the agent-workstation
618
- * surface needs to show the user exactly which tool ran, what it was
619
- * given, and what it returned, with a signature per call.
704
+ * the task — the finer-grained audit granularity the Motebit Computer
705
+ * needs to show the user exactly which tool ran, what it was given,
706
+ * and what it returned, with a signature per call.
620
707
  *
621
708
  * Why this exists as its own artifact instead of an inner field on
622
709
  * `ExecutionReceipt`:
@@ -624,8 +711,8 @@ export interface ExecutionReceipt {
624
711
  * - Third-party implementers verifying a single tool's output do not
625
712
  * need the enclosing task's receipt — the per-call receipt is
626
713
  * independently self-verifiable with just the signer's public key.
627
- * - The workstation surface emits these live as tool calls complete,
628
- * before the enclosing task finishes; nesting inside `ExecutionReceipt`
714
+ * - The slab emits these live as tool calls complete, before the
715
+ * enclosing task finishes; nesting inside `ExecutionReceipt`
629
716
  * would force the UI to wait for the outer receipt.
630
717
  * - Delegation is recursive at the task level (`delegation_receipts`);
631
718
  * keeping tool-invocation receipts separate avoids tangling two
@@ -721,10 +808,10 @@ export interface ConsolidationReceipt {
721
808
  finished_at: number;
722
809
  /** Phases that ran to completion. Closed union — adding a phase is a
723
810
  * protocol-coordinated change. */
724
- phases_run: ReadonlyArray<"orient" | "gather" | "consolidate" | "prune">;
811
+ phases_run: ReadonlyArray<"orient" | "gather" | "consolidate" | "prune" | "flush">;
725
812
  /** Phases that yielded mid-execution because their AbortSignal fired
726
813
  * (budget exhausted or parent signal aborted). Subset of `phases_run`. */
727
- phases_yielded: ReadonlyArray<"orient" | "gather" | "consolidate" | "prune">;
814
+ phases_yielded: ReadonlyArray<"orient" | "gather" | "consolidate" | "prune" | "flush">;
728
815
  /** Structural counts only — never memory content. The privacy boundary
729
816
  * is the type: there is no field here that could leak a memory's text
730
817
  * or embedding. Adding such a field is a protocol break. */
@@ -736,6 +823,10 @@ export interface ConsolidationReceipt {
736
823
  pruned_decay?: number;
737
824
  pruned_notability?: number;
738
825
  pruned_retention?: number;
826
+ /** Conversation messages flushed under `consolidation_flush` (phase 5-ship). */
827
+ flushed_conversations?: number;
828
+ /** Tool-audit entries flushed under `consolidation_flush` (phase 5-ship). */
829
+ flushed_tool_audits?: number;
739
830
  };
740
831
  /**
741
832
  * Cryptosuite discriminator. Always `"motebit-jcs-ed25519-b64-v1"` for
@@ -1168,7 +1259,7 @@ export declare const PLATFORM_FEE_RATE = 0.05;
1168
1259
  /**
1169
1260
  * Per-task settlement bookkeeping artifact.
1170
1261
  *
1171
- * Foundation Law (services/api/CLAUDE.md rule 6):
1262
+ * Foundation Law (services/relay/CLAUDE.md rule 6):
1172
1263
  * - Every truth the relay asserts (credential anchor proofs,
1173
1264
  * revocation memos, settlement receipts) is independently
1174
1265
  * verifiable onchain without relay contact.
@@ -1540,7 +1631,7 @@ export interface HardwareAttestationClaim {
1540
1631
  * `platform: "software"` is truthfully claiming "this key is not
1541
1632
  * hardware-backed", distinct from an absent claim ("unknown").
1542
1633
  */
1543
- platform: "secure_enclave" | "tpm" | "play_integrity" | "device_check" | "webauthn" | "software";
1634
+ platform: "secure_enclave" | "tpm" | "play_integrity" | "android_keystore" | "device_check" | "webauthn" | "software";
1544
1635
  /**
1545
1636
  * True when the private key was exported from hardware to software
1546
1637
  * storage (backup, pairing). Weakens the claim — the hardware no
@@ -1578,6 +1669,15 @@ export interface ConversationStoreAdapter {
1578
1669
  content: string;
1579
1670
  toolCalls?: string;
1580
1671
  toolCallId?: string;
1672
+ /**
1673
+ * Sensitivity tier the message was classified at on write.
1674
+ * Optional in v1: pre-classification messages and adapters that
1675
+ * haven't yet been migrated to the phase-5-ship column drop the
1676
+ * field, and the consolidation-cycle flush phase lazy-classifies
1677
+ * on read per docs/doctrine/retention-policy.md §"Decision 6b"
1678
+ * (operator manifest's `pre_classification_default_sensitivity`).
1679
+ */
1680
+ sensitivity?: SensitivityLevel;
1581
1681
  }): void;
1582
1682
  loadMessages(conversationId: string, limit?: number): Array<{
1583
1683
  messageId: string;
@@ -1589,6 +1689,7 @@ export interface ConversationStoreAdapter {
1589
1689
  toolCallId: string | null;
1590
1690
  createdAt: number;
1591
1691
  tokenEstimate: number;
1692
+ sensitivity?: SensitivityLevel;
1592
1693
  }>;
1593
1694
  getActiveConversation(motebitId: string): {
1594
1695
  conversationId: string;
@@ -1606,6 +1707,28 @@ export interface ConversationStoreAdapter {
1606
1707
  messageCount: number;
1607
1708
  }>;
1608
1709
  deleteConversation(conversationId: string): void;
1710
+ /**
1711
+ * Enumerate messages older than `beforeCreatedAt`. The
1712
+ * consolidation-cycle flush phase calls this per
1713
+ * docs/doctrine/retention-policy.md §"Consolidation flush" to find
1714
+ * candidates whose retention floor may have passed. Optional — when
1715
+ * absent, the flush phase is a no-op for this store on this surface.
1716
+ */
1717
+ enumerateForFlush?(motebitId: string, beforeCreatedAt: number): Array<{
1718
+ messageId: string;
1719
+ conversationId: string;
1720
+ role: string;
1721
+ content: string;
1722
+ createdAt: number;
1723
+ sensitivity?: SensitivityLevel;
1724
+ }>;
1725
+ /**
1726
+ * Erase a single message row — physical row removal, the storage
1727
+ * operation behind a `consolidation_flush` deletion certificate per
1728
+ * decision 7. Distinct from `deleteConversation` (whole-conversation
1729
+ * tombstone). Optional — paired with `enumerateForFlush`.
1730
+ */
1731
+ eraseMessage?(messageId: string): void;
1609
1732
  }
1610
1733
  export interface StateSnapshotAdapter {
1611
1734
  saveState(motebitId: string, stateJson: string, versionClock?: number): void;
@@ -1670,6 +1793,19 @@ export interface EventStoreAdapter {
1670
1793
  tombstone(eventId: string, motebitId: string): Promise<void>;
1671
1794
  /** Delete events with version_clock <= beforeClock. Returns count deleted. */
1672
1795
  compact?(motebitId: string, beforeClock: number): Promise<number>;
1796
+ /**
1797
+ * Erase events with `timestamp < horizonTs`. Returns count erased.
1798
+ * Distinct from `compact` (state-snapshot driven, version-clock-keyed):
1799
+ * `truncateBeforeHorizon` is the storage operation behind an
1800
+ * `append_only_horizon` deletion certificate per
1801
+ * docs/doctrine/retention-policy.md §"Decision 4". Whole-prefix
1802
+ * truncation only — entries before `horizonTs` are unrecoverable.
1803
+ *
1804
+ * Optional in phase 4a (local-only horizon advance ships first).
1805
+ * Phase 4b tightens to required once federation co-witness lands and
1806
+ * every operator's event log is expected to support horizon advance.
1807
+ */
1808
+ truncateBeforeHorizon?(motebitId: string, horizonTs: number): Promise<number>;
1673
1809
  /** Count total events for a motebit. */
1674
1810
  countEvents?(motebitId: string): Promise<number>;
1675
1811
  }
@@ -1680,6 +1816,17 @@ export interface DeviceRegistration {
1680
1816
  public_key: string;
1681
1817
  registered_at: number;
1682
1818
  device_name?: string;
1819
+ /**
1820
+ * Optional self-issued `AgentTrustCredential` (JSON-serialized signed
1821
+ * VC) bearing a `hardware_attestation` claim about this device's
1822
+ * identity key. Identity metadata, not a credential-index entry —
1823
+ * served via `GET /agent/:motebitId/capabilities` so peers can pull,
1824
+ * verify, and issue their own peer credentials about this subject.
1825
+ * The `/credentials/submit` self-issued rejection (spec §23) remains
1826
+ * unchanged. See `spec/identity-v1.md` §3 (device record) and
1827
+ * `docs/doctrine/promoting-private-to-public.md` companion.
1828
+ */
1829
+ hardware_attestation_credential?: string;
1683
1830
  }
1684
1831
  export interface IdentityStorage {
1685
1832
  save(identity: MotebitIdentity): Promise<void>;
@@ -1711,6 +1858,20 @@ export interface AuditLogSink {
1711
1858
  queryStatsSince(afterTimestamp: number): AuditStatsSince;
1712
1859
  /** Query tool audit entries by run_id (plan execution). Optional — returns [] if not implemented. */
1713
1860
  queryByRunId?(runId: string): ToolAuditEntry[];
1861
+ /**
1862
+ * Enumerate entries older than `beforeTimestamp`. The
1863
+ * consolidation-cycle flush phase calls this per
1864
+ * docs/doctrine/retention-policy.md §"Consolidation flush" to find
1865
+ * candidates whose retention floor may have passed. Optional — when
1866
+ * absent, the flush phase is a no-op for this store on this surface.
1867
+ */
1868
+ enumerateForFlush?(beforeTimestamp: number): ToolAuditEntry[];
1869
+ /**
1870
+ * Erase a single tool-audit entry — physical row removal, the storage
1871
+ * operation behind a `consolidation_flush` deletion certificate per
1872
+ * decision 7. Optional — paired with `enumerateForFlush`.
1873
+ */
1874
+ erase?(callId: string): void;
1714
1875
  }
1715
1876
  export interface PlanStoreAdapter {
1716
1877
  savePlan(plan: Plan): void;
@@ -1759,15 +1920,17 @@ export { TrustSemiring, CostSemiring, LatencySemiring, BottleneckSemiring, Relia
1759
1920
  export type { Edge } from "./graph.js";
1760
1921
  export { WeightedDigraph } from "./graph.js";
1761
1922
  export { optimalPaths, optimalPath, transitiveClosure, optimalPathTrace } from "./traversal.js";
1762
- export { TRUST_LEVEL_SCORES, trustLevelToScore, TRUST_ZERO, TRUST_ONE, trustAdd, trustMultiply, composeTrustChain, joinParallelRoutes, DEFAULT_TRUST_THRESHOLDS, } from "./trust-algebra.js";
1923
+ export { TRUST_LEVEL_SCORES, trustLevelToScore, TRUST_ZERO, TRUST_ONE, trustAdd, trustMultiply, composeTrustChain, joinParallelRoutes, REFERENCE_TRUST_THRESHOLDS, DEFAULT_TRUST_THRESHOLDS, } from "./trust-algebra.js";
1763
1924
  export type { CredentialAnchorBatch, CredentialChainAnchor, CredentialAnchorProof, ChainAnchorSubmitter, } from "./credential-anchor.js";
1764
1925
  export type { AgentSettlementAnchorBatch, AgentSettlementChainAnchor, AgentSettlementAnchorProof, } from "./agent-settlement-anchor.js";
1765
1926
  export type { RelayMetadata, RelayMetadataPeer, AgentResolutionResult } from "./discovery.js";
1766
1927
  export type { MigrationState, MigrationRequest, MigrationToken, DepartureAttestation, CredentialBundle, BalanceWaiver, MigrationPresentation, } from "./migration.js";
1767
- export type { DisputeState, DisputeOutcome, DisputeCategory, DisputeFundAction, DisputeRequest, DisputeEvidence, DisputeEvidenceType, AdjudicatorVote, DisputeResolution, DisputeAppeal, } from "./dispute.js";
1928
+ export type { DisputeState, DisputeOutcome, DisputeCategory, DisputeFundAction, DisputeRequest, DisputeEvidence, DisputeEvidenceType, AdjudicatorVote, VoteRequest, DisputeResolution, DisputeAppeal, WitnessOmissionDispute, WitnessOmissionEvidence, WitnessOmissionInclusionProofEvidence, WitnessOmissionAlternativePeeringEvidence, } from "./dispute.js";
1768
1929
  export type { SettlementMode, P2pPaymentProof, PaymentVerificationStatus, SettlementEligibility, SolvencyProof, } from "./settlement-mode.js";
1769
1930
  export type { SuiteId, SuiteEntry, SuiteStatus, SuiteAlgorithm, SuiteCanonicalization, SuiteSignatureEncoding, SuitePublicKeyEncoding, } from "./crypto-suite.js";
1770
1931
  export { SUITE_REGISTRY, ALL_SUITE_IDS, isSuiteId, getSuiteEntry } from "./crypto-suite.js";
1932
+ export { MAX_RETENTION_DAYS_BY_SENSITIVITY, REFERENCE_RETENTION_DAYS_BY_SENSITIVITY, RUNTIME_RETENTION_REGISTRY, EMPTY_FEDERATION_GRAPH_ANCHOR, } from "./retention-policy.js";
1933
+ export type { RetentionCeilingDays, RetentionShape, RetentionShapeDeclaration, RetentionStoreDeclaration, RetentionManifest, RuntimeStoreId, DeletionCertificate, DeletionReason, HorizonSubject, HorizonWitness, HorizonWitnessRequestBody, WitnessSolicitationRequest, WitnessSolicitationResponse, FederationGraphAnchor, MerkleAlgo, MerkleInclusionProof, SubjectSignature, OperatorSignature, DelegateSignature, GuardianSignature, SensitivityLevelString, } from "./retention-policy.js";
1771
1934
  export type { MemoryDecayedPayload, MemoryFormedPayload, MemoryAccessedPayload, MemoryPinnedPayload, MemoryDeletedPayload, MemoryConsolidatedPayload, MemoryAuditPayload, MemoryPromotedPayload, } from "./memory-events.js";
1772
1935
  export type { GoalCreatedPayload, GoalExecutedPayload, GoalProgressPayload, GoalCompletedPayload, GoalRemovedPayload, } from "./goal-lifecycle.js";
1773
1936
  export type { PlanCreatedPayload, PlanStepStartedPayload, PlanStepCompletedPayload, PlanStepFailedPayload, PlanStepDelegatedPayload, PlanCompletedPayload, PlanFailedPayload, } from "./plan-lifecycle.js";
@@ -1776,4 +1939,7 @@ export { COMPUTER_ACTION_KINDS, COMPUTER_FAILURE_REASONS } from "./computer-use.
1776
1939
  export type { ToolMode } from "./tool-mode.js";
1777
1940
  export { TOOL_MODES, toolModePriority } from "./tool-mode.js";
1778
1941
  import type { ToolMode } from "./tool-mode.js";
1942
+ export type { SkillSensitivity, SkillPlatform, SkillHardwareAttestationGate, SkillSignature, SkillManifestMetadata, SkillManifestMotebit, SkillManifest, SkillEnvelopeFile, SkillEnvelopeSkillRef, SkillEnvelope, SkillLoadPayload, } from "./skills.js";
1943
+ export { SKILL_SENSITIVITY_TIERS, SKILL_AUTO_LOADABLE_TIERS, SKILL_PLATFORMS } from "./skills.js";
1944
+ export type { SkillRegistryEntry, SkillRegistrySubmitRequest, SkillRegistrySubmitResponse, SkillRegistryListing, SkillRegistryBundle, } from "./skills.js";
1779
1945
  //# sourceMappingURL=index.d.ts.map