@securecoms/agent-bridge 0.20.0 → 0.21.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.
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Content-free proof that an attached runtime published a reply for a specific
3
+ * inbound message.
4
+ *
5
+ * The ledger is process-local, bearer-gated by the HTTP surface, short-lived,
6
+ * and bounded. It stores identifiers and timestamps only: never prompt or
7
+ * reply plaintext. A receipt is recorded only after BridgeAgent.send()
8
+ * succeeds, so a caller cannot turn a model result that failed to publish into
9
+ * a healthy synthetic verdict.
10
+ */
11
+ export interface RuntimeReplyReceipt {
12
+ in_reply_to: string;
13
+ reply_message_id: string;
14
+ channel_id: string;
15
+ replied_at: number;
16
+ }
17
+ export declare class RuntimeReplyReceiptLedger {
18
+ private readonly receipts;
19
+ private readonly ttlMs;
20
+ private readonly capacity;
21
+ private readonly now;
22
+ constructor(opts?: {
23
+ ttlMs?: number;
24
+ capacity?: number;
25
+ now?: () => number;
26
+ });
27
+ record(inReplyTo: string, channelId: string, replyMessageId: string): RuntimeReplyReceipt;
28
+ get(inReplyTo: string): RuntimeReplyReceipt | null;
29
+ private prune;
30
+ }
@@ -34,8 +34,42 @@ export interface LocalReport {
34
34
  persona: Record<string, string>;
35
35
  has_search_key: boolean;
36
36
  has_llm_key: boolean;
37
+ legacy_memory: LegacyMemoryReport[];
38
+ }
39
+ export type LegacyMemoryKind = "global-memory" | "conversation-history" | "captured-memory";
40
+ export declare const LEGACY_MEMORY_FACT_MAX_BYTES = 1024;
41
+ export declare const LEGACY_MEMORY_FACT_DECISION_MAX = 500;
42
+ export interface LegacyMemoryReport {
43
+ id: string;
44
+ kind: LegacyMemoryKind;
45
+ channel_id?: string;
46
+ content: string | null;
47
+ bytes: number;
48
+ exportable: boolean;
49
+ }
50
+ export interface LegacyMemoryFactDecision {
51
+ source_id: string;
52
+ fact_hash: string;
53
+ action: "assign" | "delete";
54
+ channel_id?: string;
37
55
  }
38
56
  export declare function readLocalReport(home: string, identityId: string): LocalReport | null;
57
+ /** Delete only sources whose opaque id still matches the current regular-file
58
+ * bytes in the runtime-owned local report. A stale or tampered action deletes
59
+ * nothing and will be retried against the next report. */
60
+ export declare function deleteLegacyMemorySources(home: string, identityId: string, ids: string[]): number;
61
+ /**
62
+ * Apply a COMPLETE owner disposition for a quarantined global-memory source.
63
+ * Every nonblank line in the exact current source must have exactly one
64
+ * decision. Assigned facts are recorded first through the caller's protected,
65
+ * idempotent store; only after every write succeeds is the exact source
66
+ * revalidated and unlinked. Partial, stale, conflicting, oversized, or
67
+ * malformed batches are no-ops, so they cannot discard unreviewed data.
68
+ */
69
+ export declare function applyLegacyMemoryFactDecisions(home: string, identityId: string, rawDecisions: unknown, recordFact: (channelId: string, fact: string, assignmentKey: string) => Promise<void>): Promise<{
70
+ sourcesDeleted: number;
71
+ factsAssigned: number;
72
+ }>;
39
73
  export declare function readManagedMemory(home: string, identityId: string): string | null;
40
74
  /**
41
75
  * Remove exactly the named lines. Line-level, never a whole-file replace: the
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const BRIDGE_VERSION = "0.20.0";
1
+ export declare const BRIDGE_VERSION = "0.21.0";
@@ -9,13 +9,15 @@
9
9
  *
10
10
  * Protocol (all frames are JSON text):
11
11
  * Daemon → agent:
12
- * { "type":"message", channel_id, message_id, sender_id, text, ts } // inbound, decrypted
12
+ * { "type":"message", channel_id, message_id, sender_id, text, ts,
13
+ * authorization:{version,audience,sender_membership,tool_grants} } // inbound, decrypted
13
14
  * { "type":"sent", message_id } // ack of a send
14
15
  * { "type":"ok" } // ack of a status report
15
16
  * { "type":"error", error, message, detail? } // canonical codes (see errors.ts):
16
17
  * // channel_pending | invalid_request
17
18
  * Agent → daemon:
18
- * { "type":"send", channel_id, text?, a2a?, idempotency_key? } // exactly one of text | a2a
19
+ * { "type":"send", channel_id, text?, a2a?, idempotency_key?,
20
+ * in_reply_to? } // exactly one of text | a2a; correlation is metadata-only
19
21
  * { "type":"status", channel_id, state, detail? }
20
22
  * { "type":"ack", message_id } // confirms a delivered `message` was consumed
21
23
  * { "type":"action_begin", channel_id } // → { "type":"action_begun", run_id }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securecoms/agent-bridge",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,6 +49,6 @@
49
49
  "@types/ws": "^8.18.1",
50
50
  "esbuild": "0.24.0",
51
51
  "typescript": "^5.4.0",
52
- "vitest": "^2.0.0"
52
+ "vitest": "^3.2.6"
53
53
  }
54
54
  }