@securecoms/agent-bridge 0.29.0 → 0.30.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 +119 -9
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +2486 -469
- package/dist/bridge-agent.d.ts +209 -2
- package/dist/config.d.ts +7 -0
- package/dist/consumer-grants.d.ts +19 -0
- package/dist/grants/binding.d.ts +58 -0
- package/dist/grants/effective.d.ts +47 -0
- package/dist/grants/manifest.d.ts +68 -0
- package/dist/grants/owner-turn.d.ts +52 -0
- package/dist/grants/persona-render.d.ts +30 -0
- package/dist/grants/pin-command.d.ts +31 -0
- package/dist/grants/pin.d.ts +35 -0
- package/dist/grants/room-search-cap.d.ts +15 -0
- package/dist/grants/voice-fence.d.ts +53 -0
- package/dist/http-server.d.ts +1 -0
- package/dist/index.js +1994 -171
- package/dist/memory/unified/item-book.d.ts +3 -0
- package/dist/memory/unified/migrate.d.ts +11 -0
- package/dist/memory/unified/read-book.d.ts +2 -1
- package/dist/memory/unified/worker-protocol.d.ts +4 -0
- package/dist/memory-taps.d.ts +1 -1
- package/dist/memory-worker.js +18 -3
- package/dist/service/runtime-config-dir.d.ts +15 -0
- package/dist/version.d.ts +1 -1
- package/dist/ws-server.d.ts +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,9 @@ export interface ItemWriteRequest {
|
|
|
23
23
|
sourceRef?: string;
|
|
24
24
|
vec?: Float32Array | null;
|
|
25
25
|
vecModelId?: string | null;
|
|
26
|
+
/** Owner grants plan 4 Task 16 (T-30): who wrote the line and, for an agent line, its origin (sealed in the record). */
|
|
27
|
+
role?: "peer" | "agent";
|
|
28
|
+
origin?: "fast_path" | "reply" | "untrusted";
|
|
26
29
|
/** Pins and migrated notes: one item, never chunked. */
|
|
27
30
|
noChunk?: true;
|
|
28
31
|
/** Task 30: a migrated source row changed since the marker: replace the item with the same source_ref, same trust. */
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* marker to just past the clear in the store's clear transaction (fix round 1), so no later run re-imports pre-clear
|
|
13
13
|
* history (a clear keeps history, section 14.4). After a disable or a purge the markers stay, so a later run resumes.
|
|
14
14
|
*/
|
|
15
|
+
import { type LineOrigin } from "../../grants/voice-fence.js";
|
|
15
16
|
import { type SqliteMlsStateStore } from "@agentvault/connect-mls-store";
|
|
16
17
|
import { type ServiceLog } from "../../service-log.js";
|
|
17
18
|
import type { ItemBook } from "./item-book.js";
|
|
@@ -35,6 +36,16 @@ export interface MigrationDeps {
|
|
|
35
36
|
* never migrated, never retried, holds nothing); "unknown" when it cannot be classified now (retried on a later run).
|
|
36
37
|
*/
|
|
37
38
|
classify: (conversationId: string) => MigrationClass;
|
|
39
|
+
/**
|
|
40
|
+
* Owner grants plan 4 Task 16 (T-30): the origin of an agent history row, so a fast-path line migrated from 0.30.0 on
|
|
41
|
+
* is marked. Absent: the row's own origin, else the pure rule with no fast-id knowledge (classifyAgentLine).
|
|
42
|
+
*/
|
|
43
|
+
classifyHistoryOrigin?: (conversationId: string, row: {
|
|
44
|
+
messageId: string | null;
|
|
45
|
+
modality: string;
|
|
46
|
+
origin?: LineOrigin;
|
|
47
|
+
recordedAt: number;
|
|
48
|
+
}) => LineOrigin;
|
|
38
49
|
/** Called after a conversation's notes committed pins (the bridge empties its pin cache under the memory mutex, as Task 28 does). */
|
|
39
50
|
pinsChanged?: () => Promise<void>;
|
|
40
51
|
/**
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { type SqliteMlsStateStore } from "@agentvault/connect-mls-store";
|
|
9
9
|
import type { Embedder } from "../embedder/client.js";
|
|
10
10
|
import type { RankingClient } from "./ranking-client.js";
|
|
11
|
+
import type { OpenedItem } from "./worker-protocol.js";
|
|
11
12
|
export interface UnifiedFrameItem {
|
|
12
13
|
block: "pinned" | "owner" | "reference";
|
|
13
14
|
id: number;
|
|
@@ -63,7 +64,7 @@ export declare class UnifiedReadBook {
|
|
|
63
64
|
kind: "text" | "voice";
|
|
64
65
|
}): Promise<void>;
|
|
65
66
|
/** ws flush (synchronous): the entry's own channel and owner scope, its capture still current (H-4, U11). */
|
|
66
|
-
deliverable(messageId: string, channelId: string, scopeIdNow: string): {
|
|
67
|
+
deliverable(messageId: string, channelId: string, scopeIdNow: string, keep?: (i: OpenedItem) => boolean): {
|
|
67
68
|
items: UnifiedFrameItem[];
|
|
68
69
|
pinnedMore: number;
|
|
69
70
|
} | undefined;
|
|
@@ -38,6 +38,10 @@ export interface OpenedItem {
|
|
|
38
38
|
source: ItemSource;
|
|
39
39
|
trust: ItemTrust;
|
|
40
40
|
text: string;
|
|
41
|
+
/** Owner grants plan 4 Task 16 (voice fence, OQ-9): text only, from the sealed record and the row's clear source_ref. */
|
|
42
|
+
role?: "peer" | "agent";
|
|
43
|
+
origin?: "fast_path" | "reply" | "untrusted";
|
|
44
|
+
sourceRef?: string;
|
|
41
45
|
}
|
|
42
46
|
export type ToWorker = {
|
|
43
47
|
type: "query";
|
package/dist/memory-taps.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ interface MemorySink {
|
|
|
15
15
|
export declare function recordInboundMemory(sink: MemorySink, channelId: string, senderId: string, text: string, messageId: string, modality?: "text" | "voice", expectPurgeEpoch?: number): Promise<void>;
|
|
16
16
|
/** Record the agent's own outbound reply. Best-effort. `modality` is "voice"
|
|
17
17
|
* for a line the voice fast path spoke (H1), else "text". */
|
|
18
|
-
export declare function recordOutboundMemory(sink: MemorySink, channelId: string, text: string, messageId: string, modality?: "text" | "voice", expectPurgeEpoch?: number): Promise<void>;
|
|
18
|
+
export declare function recordOutboundMemory(sink: MemorySink, channelId: string, text: string, messageId: string, modality?: "text" | "voice", expectPurgeEpoch?: number, origin?: "fast_path" | "reply" | "untrusted"): Promise<void>;
|
|
19
19
|
export {};
|
package/dist/memory-worker.js
CHANGED
|
@@ -150,7 +150,7 @@ function decodeItemRecord(b) {
|
|
|
150
150
|
}
|
|
151
151
|
if (!o || typeof o !== "object" || Array.isArray(o))
|
|
152
152
|
return null;
|
|
153
|
-
const { v, t, s, tr, sr, c } = o;
|
|
153
|
+
const { v, t, s, tr, sr, c, ro, or } = o;
|
|
154
154
|
if (v !== 1 || typeof t !== "string" || typeof s !== "string" || !ITEM_SOURCES.includes(s))
|
|
155
155
|
return null;
|
|
156
156
|
if (tr !== "owner" && tr !== "reference")
|
|
@@ -161,7 +161,19 @@ function decodeItemRecord(b) {
|
|
|
161
161
|
return null;
|
|
162
162
|
if (c !== void 0 && (typeof c !== "number" || !Number.isSafeInteger(c) || c < 1))
|
|
163
163
|
return null;
|
|
164
|
-
|
|
164
|
+
if (ro !== void 0 && ro !== "peer" && ro !== "agent")
|
|
165
|
+
return null;
|
|
166
|
+
if (or !== void 0 && or !== "fast_path" && or !== "reply" && or !== "untrusted")
|
|
167
|
+
return null;
|
|
168
|
+
return {
|
|
169
|
+
text: t,
|
|
170
|
+
source: s,
|
|
171
|
+
trust: tr,
|
|
172
|
+
...sr !== void 0 ? { sourceRef: sr } : {},
|
|
173
|
+
...c !== void 0 ? { chunks: c } : {},
|
|
174
|
+
...ro !== void 0 ? { role: ro } : {},
|
|
175
|
+
...or !== void 0 ? { origin: or } : {}
|
|
176
|
+
};
|
|
165
177
|
}
|
|
166
178
|
|
|
167
179
|
// src/memory/unified/ranking-core.ts
|
|
@@ -422,7 +434,10 @@ var RankingCore = class {
|
|
|
422
434
|
originAt: Number(r.origin_at),
|
|
423
435
|
source: rec.source,
|
|
424
436
|
trust: rec.trust,
|
|
425
|
-
text: rec.text
|
|
437
|
+
text: rec.text,
|
|
438
|
+
...rec.role !== void 0 ? { role: rec.role } : {},
|
|
439
|
+
...rec.origin !== void 0 ? { origin: rec.origin } : {},
|
|
440
|
+
...rec.sourceRef !== void 0 ? { sourceRef: rec.sourceRef } : {}
|
|
426
441
|
};
|
|
427
442
|
}
|
|
428
443
|
/** H-7: one batched statement, LIMIT 5,001 per MAC inside the allowed scopes; a MAC that fills its limit is skipped. */
|
|
@@ -13,6 +13,21 @@ export interface FsDeps {
|
|
|
13
13
|
unlink: (p: string) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare function runtimeConfigDir(home: string, identityId: string): string;
|
|
16
|
+
/** Owner grants (spec §7.8): the runtime honours a manifest-marked grant only for a tool listed here. */
|
|
17
|
+
export declare const MANIFEST_POLICY_FILE = "manifest-policy.json";
|
|
18
|
+
export interface ManifestPolicyDoc {
|
|
19
|
+
readonly v: 1;
|
|
20
|
+
readonly manifest_tools: readonly string[];
|
|
21
|
+
readonly secret_path_mode: "enforce";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Owner grants review H-2: under a manifest whose config signs no llm, a managed llm-source.json (written before the
|
|
25
|
+
* manifest, by an unsigned config) must not stay in force. The one deletion in this directory, by name, bridge-only.
|
|
26
|
+
* ENOENT is success; any other error throws.
|
|
27
|
+
*/
|
|
28
|
+
export declare function removeManagedLlmSource(home: string, identityId: string, deps?: FsDeps): void;
|
|
29
|
+
/** The bridge's own writer for manifest-policy.json (writeManagedFiles refuses the name). Atomic, 0600. Throws. */
|
|
30
|
+
export declare function writeManifestPolicy(home: string, identityId: string, policy: ManifestPolicyDoc, deps?: FsDeps): void;
|
|
16
31
|
export declare function writeManagedFiles(home: string, identityId: string, files: Record<string, string>, deps?: FsDeps): void;
|
|
17
32
|
/** Every path skills.json names, checked on disk. Contents are never read. */
|
|
18
33
|
export declare function checkConfiguredPaths(skillsJson: Record<string, unknown>, statFn?: (p: string) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const BRIDGE_VERSION = "0.
|
|
1
|
+
export declare const BRIDGE_VERSION = "0.30.0";
|
package/dist/ws-server.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare const MEMORY_UNIFIED_FEATURE = "memory_unified";
|
|
|
48
48
|
* fake against this list at run time (7b gate fix: a member added here without
|
|
49
49
|
* a fake made three tests throw "is not a function").
|
|
50
50
|
*/
|
|
51
|
-
export declare const WS_AGENT_MEMBERS: readonly ["ackRuntimeMessages", "action", "admitRuntimeDelivery", "applyMemoryNote", "clearHarnessReport", "clearPerToolConsumer", "isRuntimeMessageRetired", "noteNotesConsumer", "notePerToolConsumer", "noteRecallConsumer", "noteUnifiedConsumer", "noteSessionClose", "noteSessionEvicted", "noteSessionOpen", "notesAppliedGeneration", "notesForDelivery", "recallForDelivery", "unifiedFeatureOn", "unifiedForDelivery", "recordHarnessReport", "recordRuntimeReply", "reportStatusGated", "requeueFailedRuntimeDeliveries", "requeueFront", "runtimeReplyReceipt", "send", "sendA2A", "subscribe", "takeDeliverable", "wakeListeners"];
|
|
51
|
+
export declare const WS_AGENT_MEMBERS: readonly ["ackRuntimeMessages", "action", "admitRuntimeDelivery", "applyMemoryNote", "clearHarnessReport", "clearManifestConsumer", "clearPerToolConsumer", "harnessGrantsWithheld", "isRuntimeMessageRetired", "noteConsumerCapability", "noteManifestConsumer", "noteRoomCapReached", "noteNotesConsumer", "notePerToolConsumer", "noteRecallConsumer", "noteUnifiedConsumer", "noteSessionClose", "noteSessionEvicted", "noteSessionOpen", "notesAppliedGeneration", "notesForDelivery", "recallForDelivery", "unifiedFeatureOn", "unifiedForDelivery", "recordHarnessReport", "recordRuntimeReply", "reportStatusGated", "requeueFailedRuntimeDeliveries", "requeueFront", "runtimeReplyReceipt", "send", "sendA2A", "subscribe", "takeDeliverable", "wakeListeners"];
|
|
52
52
|
export type WsAgent = Pick<BridgeAgent, (typeof WS_AGENT_MEMBERS)[number]>;
|
|
53
53
|
export declare function attachAgentWebSocket(server: HttpServer, agent: WsAgent, opts: AgentWebSocketOptions): {
|
|
54
54
|
close(): void;
|