@pcircle/memesh 4.7.3 → 4.8.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/AGENTS.md +3 -1
- package/README.de.md +42 -16
- package/README.md +46 -19
- package/README.zh-TW.md +42 -17
- package/dashboard/dist/index.html +1 -1
- package/dist/core/agent-message-storage.d.ts +76 -0
- package/dist/core/agent-message-storage.d.ts.map +1 -0
- package/dist/core/agent-message-storage.js +359 -0
- package/dist/core/agent-message-storage.js.map +1 -0
- package/dist/core/agent-messaging.d.ts +224 -0
- package/dist/core/agent-messaging.d.ts.map +1 -0
- package/dist/core/agent-messaging.js +881 -0
- package/dist/core/agent-messaging.js.map +1 -0
- package/dist/core/agent-router.d.ts +194 -0
- package/dist/core/agent-router.d.ts.map +1 -0
- package/dist/core/agent-router.js +1138 -0
- package/dist/core/agent-router.js.map +1 -0
- package/dist/core/briefing.d.ts.map +1 -1
- package/dist/core/briefing.js +8 -1
- package/dist/core/briefing.js.map +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/doctor.d.ts +19 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +176 -2
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/dreamer.d.ts +8 -5
- package/dist/core/dreamer.d.ts.map +1 -1
- package/dist/core/dreamer.js +88 -3
- package/dist/core/dreamer.js.map +1 -1
- package/dist/core/product-improvements.d.ts +61 -0
- package/dist/core/product-improvements.d.ts.map +1 -0
- package/dist/core/product-improvements.js +216 -0
- package/dist/core/product-improvements.js.map +1 -0
- package/dist/core/repo-state.d.ts +11 -0
- package/dist/core/repo-state.d.ts.map +1 -0
- package/dist/core/repo-state.js +70 -0
- package/dist/core/repo-state.js.map +1 -0
- package/dist/core/schema-export.d.ts.map +1 -1
- package/dist/core/schema-export.js +70 -0
- package/dist/core/schema-export.js.map +1 -1
- package/dist/core/task-state.d.ts.map +1 -1
- package/dist/core/task-state.js +3 -3
- package/dist/core/task-state.js.map +1 -1
- package/dist/core/updater.d.ts +2 -0
- package/dist/core/updater.d.ts.map +1 -1
- package/dist/core/updater.js +11 -5
- package/dist/core/updater.js.map +1 -1
- package/dist/core/work-topology.d.ts.map +1 -1
- package/dist/core/work-topology.js +1 -0
- package/dist/core/work-topology.js.map +1 -1
- package/dist/host-adapters/acp-client.d.ts +147 -0
- package/dist/host-adapters/acp-client.d.ts.map +1 -0
- package/dist/host-adapters/acp-client.js +793 -0
- package/dist/host-adapters/acp-client.js.map +1 -0
- package/dist/host-adapters/claude-channel.d.ts +75 -0
- package/dist/host-adapters/claude-channel.d.ts.map +1 -0
- package/dist/host-adapters/claude-channel.js +255 -0
- package/dist/host-adapters/claude-channel.js.map +1 -0
- package/dist/host-adapters/codex-app-server.d.ts +83 -0
- package/dist/host-adapters/codex-app-server.d.ts.map +1 -0
- package/dist/host-adapters/codex-app-server.js +360 -0
- package/dist/host-adapters/codex-app-server.js.map +1 -0
- package/dist/host-adapters/codex-cli-queue.d.ts +17 -0
- package/dist/host-adapters/codex-cli-queue.d.ts.map +1 -0
- package/dist/host-adapters/codex-cli-queue.js +85 -0
- package/dist/host-adapters/codex-cli-queue.js.map +1 -0
- package/dist/host-runtime/acp.d.ts +57 -0
- package/dist/host-runtime/acp.d.ts.map +1 -0
- package/dist/host-runtime/acp.js +338 -0
- package/dist/host-runtime/acp.js.map +1 -0
- package/dist/host-runtime/claude.d.ts +41 -0
- package/dist/host-runtime/claude.d.ts.map +1 -0
- package/dist/host-runtime/claude.js +213 -0
- package/dist/host-runtime/claude.js.map +1 -0
- package/dist/host-runtime/codex-session.d.ts +24 -0
- package/dist/host-runtime/codex-session.d.ts.map +1 -0
- package/dist/host-runtime/codex-session.js +98 -0
- package/dist/host-runtime/codex-session.js.map +1 -0
- package/dist/host-runtime/codex.d.ts +33 -0
- package/dist/host-runtime/codex.d.ts.map +1 -0
- package/dist/host-runtime/codex.js +215 -0
- package/dist/host-runtime/codex.js.map +1 -0
- package/dist/host-runtime/config.d.ts +9 -0
- package/dist/host-runtime/config.d.ts.map +1 -0
- package/dist/host-runtime/config.js +91 -0
- package/dist/host-runtime/config.js.map +1 -0
- package/dist/host-runtime/router-client.d.ts +38 -0
- package/dist/host-runtime/router-client.d.ts.map +1 -0
- package/dist/host-runtime/router-client.js +463 -0
- package/dist/host-runtime/router-client.js.map +1 -0
- package/dist/host-runtime/router.d.ts +3 -0
- package/dist/host-runtime/router.d.ts.map +1 -0
- package/dist/host-runtime/router.js +43 -0
- package/dist/host-runtime/router.js.map +1 -0
- package/dist/mcp/server.js +2 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/skills-manifest.json +22 -17
- package/dist/storage/conflicts.d.ts.map +1 -1
- package/dist/storage/conflicts.js +8 -1
- package/dist/storage/conflicts.js.map +1 -1
- package/dist/storage/schema.d.ts +1 -1
- package/dist/storage/schema.d.ts.map +1 -1
- package/dist/storage/schema.js +255 -0
- package/dist/storage/schema.js.map +1 -1
- package/dist/transports/agent-messaging.d.ts +11 -0
- package/dist/transports/agent-messaging.d.ts.map +1 -0
- package/dist/transports/agent-messaging.js +273 -0
- package/dist/transports/agent-messaging.js.map +1 -0
- package/dist/transports/cli/cli.d.ts +6 -1
- package/dist/transports/cli/cli.d.ts.map +1 -1
- package/dist/transports/cli/cli.js +392 -17
- package/dist/transports/cli/cli.js.map +1 -1
- package/dist/transports/http/server.d.ts.map +1 -1
- package/dist/transports/http/server.js +31 -2
- package/dist/transports/http/server.js.map +1 -1
- package/dist/transports/mcp/handlers.d.ts +152 -1
- package/dist/transports/mcp/handlers.d.ts.map +1 -1
- package/dist/transports/mcp/handlers.js +108 -3
- package/dist/transports/mcp/handlers.js.map +1 -1
- package/dist/transports/schemas.d.ts +106 -1
- package/dist/transports/schemas.d.ts.map +1 -1
- package/dist/transports/schemas.js +86 -0
- package/dist/transports/schemas.js.map +1 -1
- package/docs/platforms/README.md +167 -0
- package/docs/platforms/agent-messaging.md +290 -0
- package/hooks/hooks.json +11 -0
- package/llms-install.md +101 -25
- package/package.json +14 -5
- package/scripts/hooks/_generated/repo-state.js +77 -0
- package/scripts/hooks/_generated/schema.js +255 -0
- package/scripts/hooks/_generated/task-state.js +3 -3
- package/scripts/hooks/_generated/work-topology.js +1 -0
- package/scripts/hooks/_shared.js +77 -97
- package/scripts/hooks/auto-update-runner.mjs +243 -0
- package/scripts/hooks/session-start.js +12 -2
- package/scripts/hooks/session-summary.js +7 -6
- package/skills/memesh/SKILL.md +40 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { MemeshDatabase } from '../storage/sqlite.js';
|
|
2
|
+
export interface AgentMessageStorageReportOptions {
|
|
3
|
+
cutoff: Date | string;
|
|
4
|
+
databasePath?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AgentMessageStorageReport {
|
|
7
|
+
message_count: number;
|
|
8
|
+
delivery_count: number;
|
|
9
|
+
event_count: number;
|
|
10
|
+
receipt_count: number;
|
|
11
|
+
cursor_count: number;
|
|
12
|
+
principal_count: number;
|
|
13
|
+
session_instance_count: number;
|
|
14
|
+
session_connection_count: number;
|
|
15
|
+
presence_fact_count: number;
|
|
16
|
+
dispatch_attempt_count: number;
|
|
17
|
+
host_accept_count: number;
|
|
18
|
+
ack_fact_count: number;
|
|
19
|
+
workflow_fact_count: number;
|
|
20
|
+
retention_fact_count: number;
|
|
21
|
+
payload_bytes: number;
|
|
22
|
+
original_payload_bytes: number;
|
|
23
|
+
tombstoned_message_count: number;
|
|
24
|
+
protected_unresolved_message_count: number;
|
|
25
|
+
terminal_retained_message_count: number;
|
|
26
|
+
terminal_prunable_message_count: number;
|
|
27
|
+
terminal_prunable_payload_bytes: number;
|
|
28
|
+
reconciled_message_count: number;
|
|
29
|
+
page_count: number;
|
|
30
|
+
page_size: number;
|
|
31
|
+
freelist_count: number;
|
|
32
|
+
allocated_database_bytes: number;
|
|
33
|
+
reusable_freelist_bytes: number;
|
|
34
|
+
database_file_bytes: number | null;
|
|
35
|
+
wal_file_bytes: number | null;
|
|
36
|
+
}
|
|
37
|
+
export interface AgentMessageRetentionOptions extends AgentMessageStorageReportOptions {
|
|
38
|
+
batchSize?: number;
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
actor?: string;
|
|
41
|
+
fault?: {
|
|
42
|
+
beforeTombstone?(candidate: AgentMessageRetentionCandidate): void;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface AgentMessageRetentionCandidate {
|
|
46
|
+
message_id: string;
|
|
47
|
+
payload_bytes: number;
|
|
48
|
+
payload_sha256: string;
|
|
49
|
+
}
|
|
50
|
+
export interface AgentMessageRetentionResult {
|
|
51
|
+
dry_run: boolean;
|
|
52
|
+
candidate_count: number;
|
|
53
|
+
tombstoned_count: number;
|
|
54
|
+
reclaimed_payload_bytes: number;
|
|
55
|
+
candidates: AgentMessageRetentionCandidate[];
|
|
56
|
+
}
|
|
57
|
+
export interface AgentMessageStorageQuotaInput {
|
|
58
|
+
quotaBytes: number;
|
|
59
|
+
additionalPayloadBytes: number;
|
|
60
|
+
}
|
|
61
|
+
export declare class AgentMessageStorageError extends Error {
|
|
62
|
+
readonly code: string;
|
|
63
|
+
constructor(code: string, message: string);
|
|
64
|
+
}
|
|
65
|
+
export declare class AgentMessageStorageQuotaExceededError extends AgentMessageStorageError {
|
|
66
|
+
readonly quotaBytes: number;
|
|
67
|
+
readonly usedBytes: number;
|
|
68
|
+
readonly requestedBytes: number;
|
|
69
|
+
constructor(quotaBytes: number, usedBytes: number, requestedBytes: number);
|
|
70
|
+
}
|
|
71
|
+
export declare function getAgentMessageStorageReport(db: MemeshDatabase, options: AgentMessageStorageReportOptions): AgentMessageStorageReport;
|
|
72
|
+
export declare function pruneTerminalAgentMessagePayloads(db: MemeshDatabase, options: AgentMessageRetentionOptions): AgentMessageRetentionResult;
|
|
73
|
+
export declare function enforceAgentMessageStorageQuota(db: MemeshDatabase, input: AgentMessageStorageQuotaInput): void;
|
|
74
|
+
export declare function agentMessagePayloadStorageBytes(payloadJson: string): number;
|
|
75
|
+
export declare const AGENT_MESSAGE_TERMINAL_WORKFLOW_STATES: readonly string[];
|
|
76
|
+
//# sourceMappingURL=agent-message-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-message-storage.d.ts","sourceRoot":"","sources":["../../src/core/agent-message-storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAO3D,MAAM,WAAW,gCAAgC;IAE/C,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,MAAM,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,MAAM,CAAC;IACjC,kCAAkC,EAAE,MAAM,CAAC;IAC3C,+BAA+B,EAAE,MAAM,CAAC;IACxC,+BAA+B,EAAE,MAAM,CAAC;IACxC,+BAA+B,EAAE,MAAM,CAAC;IACxC,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CA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AE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CAO1E;AAOD,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,gCAAgC,GACxC,yBAAyB,CAsD3B;AAMD,wBAAgB,iCAAiC,CAC/C,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CA8B7B;AAQD,wBAAgB,+BAA+B,CAC7C,EAAE,EAAE,cAAc,EAClB,KAAK,EAAE,6BAA6B,GACnC,IAAI,CAWN;AAGD,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAK3E;AA4RD,eAAO,MAAM,sCAAsC,mBAAyC,CAAC"}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
const TERMINAL_WORKFLOW_STATES = new Set(['completed', 'cancelled', 'rejected']);
|
|
4
|
+
const DEFAULT_BATCH_SIZE = 100;
|
|
5
|
+
const MAX_BATCH_SIZE = 1_000;
|
|
6
|
+
export class AgentMessageStorageError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
constructor(code, message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'AgentMessageStorageError';
|
|
11
|
+
this.code = code;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class AgentMessageStorageQuotaExceededError extends AgentMessageStorageError {
|
|
15
|
+
quotaBytes;
|
|
16
|
+
usedBytes;
|
|
17
|
+
requestedBytes;
|
|
18
|
+
constructor(quotaBytes, usedBytes, requestedBytes) {
|
|
19
|
+
super('storage_quota_exceeded', 'Agent message storage quota exceeded.');
|
|
20
|
+
this.name = 'AgentMessageStorageQuotaExceededError';
|
|
21
|
+
this.quotaBytes = quotaBytes;
|
|
22
|
+
this.usedBytes = usedBytes;
|
|
23
|
+
this.requestedBytes = requestedBytes;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function getAgentMessageStorageReport(db, options) {
|
|
27
|
+
const cutoff = normalizeCutoff(options.cutoff);
|
|
28
|
+
const states = readMessageStates(db, cutoff);
|
|
29
|
+
const lifecycle = db.prepare(`
|
|
30
|
+
SELECT
|
|
31
|
+
(SELECT COUNT(*) FROM agent_message_deliveries) AS delivery_count,
|
|
32
|
+
(SELECT COUNT(*) FROM agent_message_events) AS event_count,
|
|
33
|
+
(SELECT COUNT(*) FROM agent_message_receipts) AS receipt_count,
|
|
34
|
+
(SELECT COUNT(*) FROM agent_message_cursors) AS cursor_count,
|
|
35
|
+
(SELECT COUNT(*) FROM agent_principals) AS principal_count,
|
|
36
|
+
(SELECT COUNT(*) FROM agent_session_instances) AS session_instance_count,
|
|
37
|
+
(SELECT COUNT(*) FROM agent_session_connections) AS session_connection_count,
|
|
38
|
+
(SELECT COUNT(*) FROM agent_presence_facts) AS presence_fact_count,
|
|
39
|
+
(SELECT COUNT(*) FROM agent_dispatch_attempts) AS dispatch_attempt_count,
|
|
40
|
+
(SELECT COUNT(*) FROM agent_host_accepts) AS host_accept_count,
|
|
41
|
+
(SELECT COUNT(*) FROM agent_ack_facts) AS ack_fact_count,
|
|
42
|
+
(SELECT COUNT(*) FROM agent_workflow_facts) AS workflow_fact_count,
|
|
43
|
+
(SELECT COUNT(*) FROM agent_retention_facts) AS retention_fact_count
|
|
44
|
+
`).get();
|
|
45
|
+
const pageCount = pragmaInteger(db, 'page_count');
|
|
46
|
+
const pageSize = pragmaInteger(db, 'page_size');
|
|
47
|
+
const freelistCount = pragmaInteger(db, 'freelist_count');
|
|
48
|
+
return {
|
|
49
|
+
message_count: states.message_count,
|
|
50
|
+
delivery_count: lifecycle.delivery_count,
|
|
51
|
+
event_count: lifecycle.event_count,
|
|
52
|
+
receipt_count: lifecycle.receipt_count,
|
|
53
|
+
cursor_count: lifecycle.cursor_count,
|
|
54
|
+
principal_count: lifecycle.principal_count,
|
|
55
|
+
session_instance_count: lifecycle.session_instance_count,
|
|
56
|
+
session_connection_count: lifecycle.session_connection_count,
|
|
57
|
+
presence_fact_count: lifecycle.presence_fact_count,
|
|
58
|
+
dispatch_attempt_count: lifecycle.dispatch_attempt_count,
|
|
59
|
+
host_accept_count: lifecycle.host_accept_count,
|
|
60
|
+
ack_fact_count: lifecycle.ack_fact_count,
|
|
61
|
+
workflow_fact_count: lifecycle.workflow_fact_count,
|
|
62
|
+
retention_fact_count: lifecycle.retention_fact_count,
|
|
63
|
+
payload_bytes: states.payload_bytes,
|
|
64
|
+
original_payload_bytes: states.original_payload_bytes,
|
|
65
|
+
tombstoned_message_count: states.tombstoned_message_count,
|
|
66
|
+
protected_unresolved_message_count: states.protected_unresolved_message_count,
|
|
67
|
+
terminal_retained_message_count: states.terminal_retained_message_count,
|
|
68
|
+
terminal_prunable_message_count: states.terminal_prunable_message_count,
|
|
69
|
+
terminal_prunable_payload_bytes: states.terminal_prunable_payload_bytes,
|
|
70
|
+
reconciled_message_count: states.reconciled_message_count,
|
|
71
|
+
page_count: pageCount,
|
|
72
|
+
page_size: pageSize,
|
|
73
|
+
freelist_count: freelistCount,
|
|
74
|
+
allocated_database_bytes: pageCount * pageSize,
|
|
75
|
+
reusable_freelist_bytes: freelistCount * pageSize,
|
|
76
|
+
database_file_bytes: safeFileSize(options.databasePath),
|
|
77
|
+
wal_file_bytes: options.databasePath ? safeFileSize(`${options.databasePath}-wal`) : null,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function pruneTerminalAgentMessagePayloads(db, options) {
|
|
81
|
+
const cutoff = normalizeCutoff(options.cutoff);
|
|
82
|
+
const batchSize = normalizeBatchSize(options.batchSize);
|
|
83
|
+
const dryRun = options.dryRun === undefined ? true : options.dryRun;
|
|
84
|
+
const actor = normalizeActor(options.actor);
|
|
85
|
+
if (dryRun) {
|
|
86
|
+
const candidates = selectPrunableMessages(db, cutoff, batchSize).map(toCandidate);
|
|
87
|
+
return resultForCandidates(true, candidates);
|
|
88
|
+
}
|
|
89
|
+
return db.transaction(() => {
|
|
90
|
+
const selected = selectPrunableMessages(db, cutoff, batchSize);
|
|
91
|
+
const candidates = selected.map(toCandidate);
|
|
92
|
+
for (let index = 0; index < selected.length; index++) {
|
|
93
|
+
const candidate = candidates[index];
|
|
94
|
+
options.fault?.beforeTombstone?.(candidate);
|
|
95
|
+
const tombstone = stableTombstone(candidate.payload_sha256, candidate.payload_bytes);
|
|
96
|
+
const result = db.prepare(`
|
|
97
|
+
UPDATE agent_messages
|
|
98
|
+
SET payload_json = ?, payload_sha256 = ?, payload_original_bytes = ?, payload_tombstoned_at = CURRENT_TIMESTAMP
|
|
99
|
+
WHERE message_id = ? AND payload_tombstoned_at IS NULL
|
|
100
|
+
`).run(tombstone, candidate.payload_sha256, candidate.payload_bytes, candidate.message_id);
|
|
101
|
+
if (result.changes !== 1) {
|
|
102
|
+
throw new AgentMessageStorageError('retention_concurrent_change', 'Agent message retention candidate changed during pruning.');
|
|
103
|
+
}
|
|
104
|
+
insertRetentionFact(db, candidate, actor, tombstone);
|
|
105
|
+
}
|
|
106
|
+
return resultForCandidates(false, candidates);
|
|
107
|
+
}).immediate();
|
|
108
|
+
}
|
|
109
|
+
export function enforceAgentMessageStorageQuota(db, input) {
|
|
110
|
+
const quotaBytes = normalizeNonNegativeInteger('quotaBytes', input.quotaBytes);
|
|
111
|
+
const additionalPayloadBytes = normalizeNonNegativeInteger('additionalPayloadBytes', input.additionalPayloadBytes);
|
|
112
|
+
const row = db.prepare(`
|
|
113
|
+
SELECT COALESCE(SUM(length(CAST(payload_json AS BLOB))), 0) AS payload_bytes
|
|
114
|
+
FROM agent_messages
|
|
115
|
+
`).get();
|
|
116
|
+
const usedBytes = row.payload_bytes;
|
|
117
|
+
if (usedBytes + additionalPayloadBytes > quotaBytes) {
|
|
118
|
+
throw new AgentMessageStorageQuotaExceededError(quotaBytes, usedBytes, additionalPayloadBytes);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export function agentMessagePayloadStorageBytes(payloadJson) {
|
|
122
|
+
if (typeof payloadJson !== 'string') {
|
|
123
|
+
throw new AgentMessageStorageError('invalid_payload_storage_input', 'Agent message payload JSON must be a string.');
|
|
124
|
+
}
|
|
125
|
+
return Buffer.byteLength(payloadJson, 'utf8');
|
|
126
|
+
}
|
|
127
|
+
function readMessageStates(db, cutoff) {
|
|
128
|
+
return db.prepare(`
|
|
129
|
+
WITH workflow_candidates AS (
|
|
130
|
+
SELECT delivery_id, workflow_state, created_at
|
|
131
|
+
FROM agent_workflow_facts
|
|
132
|
+
UNION ALL
|
|
133
|
+
SELECT d.delivery_id, json_extract(r.detail_json, '$.disposition') AS workflow_state,
|
|
134
|
+
r.created_at
|
|
135
|
+
FROM agent_message_receipts r
|
|
136
|
+
JOIN agent_message_deliveries d
|
|
137
|
+
ON d.message_id = r.message_id AND d.project = r.project AND d.recipient = r.recipient
|
|
138
|
+
WHERE r.receipt_kind = 'disposition'
|
|
139
|
+
), ranked_workflow AS (
|
|
140
|
+
SELECT delivery_id, workflow_state, created_at,
|
|
141
|
+
DENSE_RANK() OVER (
|
|
142
|
+
PARTITION BY delivery_id
|
|
143
|
+
ORDER BY julianday(created_at) DESC
|
|
144
|
+
) AS time_rank
|
|
145
|
+
FROM workflow_candidates
|
|
146
|
+
), latest_workflow AS (
|
|
147
|
+
SELECT delivery_id,
|
|
148
|
+
CASE WHEN SUM(CASE
|
|
149
|
+
WHEN workflow_state IN ('completed', 'cancelled', 'rejected') THEN 0 ELSE 1
|
|
150
|
+
END) = 0 THEN 1 ELSE 0 END AS is_terminal,
|
|
151
|
+
MAX(created_at) AS created_at
|
|
152
|
+
FROM ranked_workflow
|
|
153
|
+
WHERE time_rank = 1
|
|
154
|
+
GROUP BY delivery_id
|
|
155
|
+
), acknowledged_deliveries AS (
|
|
156
|
+
SELECT delivery_id
|
|
157
|
+
FROM agent_ack_facts
|
|
158
|
+
UNION
|
|
159
|
+
SELECT d.delivery_id
|
|
160
|
+
FROM agent_message_receipts r
|
|
161
|
+
JOIN agent_message_deliveries d
|
|
162
|
+
ON d.message_id = r.message_id AND d.project = r.project AND d.recipient = r.recipient
|
|
163
|
+
WHERE r.receipt_kind = 'ack'
|
|
164
|
+
), delivery_states AS (
|
|
165
|
+
SELECT d.message_id,
|
|
166
|
+
COUNT(*) AS delivery_count,
|
|
167
|
+
SUM(CASE WHEN acknowledged_deliveries.delivery_id IS NOT NULL THEN 1 ELSE 0 END) AS acknowledged_count,
|
|
168
|
+
SUM(CASE WHEN lw.is_terminal = 1 THEN 1 ELSE 0 END) AS terminal_count,
|
|
169
|
+
SUM(CASE WHEN lw.is_terminal = 1
|
|
170
|
+
AND julianday(lw.created_at) < julianday(?) THEN 1 ELSE 0 END) AS old_terminal_count
|
|
171
|
+
FROM agent_message_deliveries d
|
|
172
|
+
LEFT JOIN acknowledged_deliveries ON acknowledged_deliveries.delivery_id = d.delivery_id
|
|
173
|
+
LEFT JOIN latest_workflow lw ON lw.delivery_id = d.delivery_id
|
|
174
|
+
GROUP BY d.message_id
|
|
175
|
+
), message_states AS (
|
|
176
|
+
SELECT m.message_id, length(CAST(m.payload_json AS BLOB)) AS payload_bytes,
|
|
177
|
+
COALESCE(m.payload_original_bytes, length(CAST(m.payload_json AS BLOB))) AS original_payload_bytes,
|
|
178
|
+
CASE
|
|
179
|
+
WHEN m.payload_tombstoned_at IS NOT NULL THEN 'tombstoned'
|
|
180
|
+
WHEN COALESCE(ds.delivery_count, 0) > 0
|
|
181
|
+
AND ds.acknowledged_count = ds.delivery_count
|
|
182
|
+
AND ds.terminal_count = ds.delivery_count
|
|
183
|
+
AND ds.old_terminal_count = ds.delivery_count THEN 'prunable'
|
|
184
|
+
WHEN COALESCE(ds.delivery_count, 0) > 0
|
|
185
|
+
AND ds.acknowledged_count = ds.delivery_count
|
|
186
|
+
AND ds.terminal_count = ds.delivery_count THEN 'terminal_retained'
|
|
187
|
+
ELSE 'protected'
|
|
188
|
+
END AS storage_state
|
|
189
|
+
FROM agent_messages m
|
|
190
|
+
LEFT JOIN delivery_states ds ON ds.message_id = m.message_id
|
|
191
|
+
)
|
|
192
|
+
SELECT
|
|
193
|
+
COUNT(*) AS message_count,
|
|
194
|
+
COALESCE(SUM(payload_bytes), 0) AS payload_bytes,
|
|
195
|
+
COALESCE(SUM(original_payload_bytes), 0) AS original_payload_bytes,
|
|
196
|
+
COALESCE(SUM(storage_state = 'tombstoned'), 0) AS tombstoned_message_count,
|
|
197
|
+
COALESCE(SUM(storage_state = 'protected'), 0) AS protected_unresolved_message_count,
|
|
198
|
+
COALESCE(SUM(storage_state = 'terminal_retained'), 0) AS terminal_retained_message_count,
|
|
199
|
+
COALESCE(SUM(storage_state = 'prunable'), 0) AS terminal_prunable_message_count,
|
|
200
|
+
COALESCE(SUM(CASE WHEN storage_state = 'prunable' THEN payload_bytes ELSE 0 END), 0) AS terminal_prunable_payload_bytes,
|
|
201
|
+
COALESCE(SUM(storage_state IN ('tombstoned', 'protected', 'terminal_retained', 'prunable')), 0) AS reconciled_message_count
|
|
202
|
+
FROM message_states
|
|
203
|
+
`).get(cutoff);
|
|
204
|
+
}
|
|
205
|
+
function selectPrunableMessages(db, cutoff, batchSize) {
|
|
206
|
+
return db.prepare(`
|
|
207
|
+
WITH workflow_candidates AS (
|
|
208
|
+
SELECT delivery_id, workflow_state, created_at
|
|
209
|
+
FROM agent_workflow_facts
|
|
210
|
+
UNION ALL
|
|
211
|
+
SELECT d.delivery_id, json_extract(r.detail_json, '$.disposition') AS workflow_state,
|
|
212
|
+
r.created_at
|
|
213
|
+
FROM agent_message_receipts r
|
|
214
|
+
JOIN agent_message_deliveries d
|
|
215
|
+
ON d.message_id = r.message_id AND d.project = r.project AND d.recipient = r.recipient
|
|
216
|
+
WHERE r.receipt_kind = 'disposition'
|
|
217
|
+
), ranked_workflow AS (
|
|
218
|
+
SELECT delivery_id, workflow_state, created_at,
|
|
219
|
+
DENSE_RANK() OVER (
|
|
220
|
+
PARTITION BY delivery_id
|
|
221
|
+
ORDER BY julianday(created_at) DESC
|
|
222
|
+
) AS time_rank
|
|
223
|
+
FROM workflow_candidates
|
|
224
|
+
), latest_workflow AS (
|
|
225
|
+
SELECT delivery_id,
|
|
226
|
+
CASE WHEN SUM(CASE
|
|
227
|
+
WHEN workflow_state IN ('completed', 'cancelled', 'rejected') THEN 0 ELSE 1
|
|
228
|
+
END) = 0 THEN 1 ELSE 0 END AS is_terminal,
|
|
229
|
+
MAX(created_at) AS created_at
|
|
230
|
+
FROM ranked_workflow
|
|
231
|
+
WHERE time_rank = 1
|
|
232
|
+
GROUP BY delivery_id
|
|
233
|
+
), acknowledged_deliveries AS (
|
|
234
|
+
SELECT delivery_id
|
|
235
|
+
FROM agent_ack_facts
|
|
236
|
+
UNION
|
|
237
|
+
SELECT d.delivery_id
|
|
238
|
+
FROM agent_message_receipts r
|
|
239
|
+
JOIN agent_message_deliveries d
|
|
240
|
+
ON d.message_id = r.message_id AND d.project = r.project AND d.recipient = r.recipient
|
|
241
|
+
WHERE r.receipt_kind = 'ack'
|
|
242
|
+
), delivery_states AS (
|
|
243
|
+
SELECT d.message_id,
|
|
244
|
+
COUNT(*) AS delivery_count,
|
|
245
|
+
SUM(CASE WHEN acknowledged_deliveries.delivery_id IS NOT NULL THEN 1 ELSE 0 END) AS acknowledged_count,
|
|
246
|
+
SUM(CASE WHEN lw.is_terminal = 1
|
|
247
|
+
AND julianday(lw.created_at) < julianday(?) THEN 1 ELSE 0 END) AS old_terminal_count
|
|
248
|
+
FROM agent_message_deliveries d
|
|
249
|
+
LEFT JOIN acknowledged_deliveries ON acknowledged_deliveries.delivery_id = d.delivery_id
|
|
250
|
+
LEFT JOIN latest_workflow lw ON lw.delivery_id = d.delivery_id
|
|
251
|
+
GROUP BY d.message_id
|
|
252
|
+
)
|
|
253
|
+
SELECT m.message_id, m.payload_json, length(CAST(m.payload_json AS BLOB)) AS payload_bytes
|
|
254
|
+
FROM agent_messages m
|
|
255
|
+
JOIN delivery_states ds ON ds.message_id = m.message_id
|
|
256
|
+
WHERE m.payload_tombstoned_at IS NULL
|
|
257
|
+
AND ds.delivery_count > 0
|
|
258
|
+
AND ds.acknowledged_count = ds.delivery_count
|
|
259
|
+
AND ds.old_terminal_count = ds.delivery_count
|
|
260
|
+
ORDER BY m.created_at ASC, m.message_id ASC
|
|
261
|
+
LIMIT ?
|
|
262
|
+
`).all(cutoff, batchSize);
|
|
263
|
+
}
|
|
264
|
+
function toCandidate(row) {
|
|
265
|
+
return {
|
|
266
|
+
message_id: row.message_id,
|
|
267
|
+
payload_bytes: row.payload_bytes,
|
|
268
|
+
payload_sha256: createHash('sha256').update(row.payload_json, 'utf8').digest('hex'),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function resultForCandidates(dryRun, candidates) {
|
|
272
|
+
return {
|
|
273
|
+
dry_run: dryRun,
|
|
274
|
+
candidate_count: candidates.length,
|
|
275
|
+
tombstoned_count: dryRun ? 0 : candidates.length,
|
|
276
|
+
reclaimed_payload_bytes: reclaimedPayloadBytes(candidates),
|
|
277
|
+
candidates,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function reclaimedPayloadBytes(candidates) {
|
|
281
|
+
const netPayloadBytes = candidates.reduce((total, candidate) => {
|
|
282
|
+
const tombstone = stableTombstone(candidate.payload_sha256, candidate.payload_bytes);
|
|
283
|
+
return total + candidate.payload_bytes - Buffer.byteLength(tombstone, 'utf8');
|
|
284
|
+
}, 0);
|
|
285
|
+
return Math.max(0, netPayloadBytes);
|
|
286
|
+
}
|
|
287
|
+
function insertRetentionFact(db, candidate, actor, tombstone) {
|
|
288
|
+
const idempotencyKey = `payload-tombstone:${candidate.message_id}:${candidate.payload_sha256}`;
|
|
289
|
+
const detailJson = JSON.stringify({
|
|
290
|
+
algorithm: 'sha256',
|
|
291
|
+
original_payload_bytes: candidate.payload_bytes,
|
|
292
|
+
payload_sha256: candidate.payload_sha256,
|
|
293
|
+
tombstone_payload_bytes: Buffer.byteLength(tombstone, 'utf8'),
|
|
294
|
+
});
|
|
295
|
+
const requestHash = createHash('sha256').update(detailJson, 'utf8').digest('hex');
|
|
296
|
+
db.prepare(`
|
|
297
|
+
INSERT INTO agent_retention_facts (
|
|
298
|
+
retention_fact_id, message_id, actor, retention_state, idempotency_key, request_hash, detail_json
|
|
299
|
+
) VALUES (?, ?, ?, 'payload_tombstoned', ?, ?, ?)
|
|
300
|
+
`).run(randomUUID(), candidate.message_id, actor, idempotencyKey, requestHash, detailJson);
|
|
301
|
+
}
|
|
302
|
+
function stableTombstone(payloadHash, originalPayloadBytes) {
|
|
303
|
+
return JSON.stringify({
|
|
304
|
+
_agent_message_tombstone_v1: {
|
|
305
|
+
algorithm: 'sha256',
|
|
306
|
+
original_payload_bytes: originalPayloadBytes,
|
|
307
|
+
payload_sha256: payloadHash,
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function normalizeCutoff(value) {
|
|
312
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
313
|
+
if (Number.isNaN(date.getTime())) {
|
|
314
|
+
throw new AgentMessageStorageError('invalid_retention_cutoff', 'Agent message retention cutoff must be a valid date.');
|
|
315
|
+
}
|
|
316
|
+
return date.toISOString();
|
|
317
|
+
}
|
|
318
|
+
function normalizeBatchSize(value) {
|
|
319
|
+
if (value === undefined)
|
|
320
|
+
return DEFAULT_BATCH_SIZE;
|
|
321
|
+
if (!Number.isInteger(value) || value < 1 || value > MAX_BATCH_SIZE) {
|
|
322
|
+
throw new AgentMessageStorageError('invalid_retention_batch_size', `Agent message retention batch size must be between 1 and ${MAX_BATCH_SIZE}.`);
|
|
323
|
+
}
|
|
324
|
+
return value;
|
|
325
|
+
}
|
|
326
|
+
function normalizeActor(value) {
|
|
327
|
+
const actor = (value ?? 'agent-message-retention-v1').trim();
|
|
328
|
+
if (actor.length === 0 || actor.length > 200) {
|
|
329
|
+
throw new AgentMessageStorageError('invalid_retention_actor', 'Agent message retention actor must be 1 to 200 characters.');
|
|
330
|
+
}
|
|
331
|
+
return actor;
|
|
332
|
+
}
|
|
333
|
+
function normalizeNonNegativeInteger(label, value) {
|
|
334
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
335
|
+
throw new AgentMessageStorageError('invalid_storage_quota', `${label} must be a non-negative safe integer.`);
|
|
336
|
+
}
|
|
337
|
+
return value;
|
|
338
|
+
}
|
|
339
|
+
function pragmaInteger(db, pragma) {
|
|
340
|
+
const row = db.prepare(`PRAGMA ${pragma}`).get();
|
|
341
|
+
const value = row[pragma];
|
|
342
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
343
|
+
throw new AgentMessageStorageError('invalid_storage_pragma', `SQLite PRAGMA ${pragma} returned an invalid value.`);
|
|
344
|
+
}
|
|
345
|
+
return value;
|
|
346
|
+
}
|
|
347
|
+
function safeFileSize(filePath) {
|
|
348
|
+
if (!filePath)
|
|
349
|
+
return null;
|
|
350
|
+
try {
|
|
351
|
+
const stat = fs.statSync(filePath);
|
|
352
|
+
return stat.isFile() ? stat.size : null;
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
export const AGENT_MESSAGE_TERMINAL_WORKFLOW_STATES = [...TERMINAL_WORKFLOW_STATES];
|
|
359
|
+
//# sourceMappingURL=agent-message-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-message-storage.js","sourceRoot":"","sources":["../../src/core/agent-message-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,SAAS,CAAC;AAIzB,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AACjF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,cAAc,GAAG,KAAK,CAAC;AA+E7B,MAAM,OAAO,wBAAyB,SAAQ,KAAK;I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wBAAwB,CAAC,wBAAwB,EAAE,iBAAiB,MAAM,6BAA6B,CAAC,CAAC;IACrH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,QAA4B;IAChD,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAID,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,GAAG,wBAAwB,CAAU,CAAC"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import type { MemeshDatabase } from '../storage/sqlite.js';
|
|
2
|
+
export type AgentJsonPrimitive = boolean | null | number | string;
|
|
3
|
+
export type AgentJsonValue = AgentJsonPrimitive | AgentJsonValue[] | {
|
|
4
|
+
[key: string]: AgentJsonValue;
|
|
5
|
+
};
|
|
6
|
+
export type AgentJsonObject = {
|
|
7
|
+
[key: string]: AgentJsonValue;
|
|
8
|
+
};
|
|
9
|
+
export type AgentMessagePrivacy = 'private' | 'team';
|
|
10
|
+
export type AgentContentType = 'text/plain' | 'application/json';
|
|
11
|
+
export type AgentTargetKind = 'principal' | 'session';
|
|
12
|
+
export type AgentReceiptKind = 'intake' | 'ack' | 'disposition' | 'host_activation';
|
|
13
|
+
export type AgentIntakeState = 'fetched' | 'ingested';
|
|
14
|
+
export type AgentDisposition = 'accepted' | 'rejected' | 'cancelled' | 'completed' | 'deferred';
|
|
15
|
+
export type AgentHostActivation = 'woken' | 'manual_resume_required' | 'unsupported' | 'failed';
|
|
16
|
+
export interface SendAgentMessageInput {
|
|
17
|
+
project: string;
|
|
18
|
+
sender: string;
|
|
19
|
+
recipient: string;
|
|
20
|
+
target_kind?: AgentTargetKind;
|
|
21
|
+
idempotency_key: string;
|
|
22
|
+
payload: AgentJsonValue;
|
|
23
|
+
content_type: AgentContentType;
|
|
24
|
+
sender_host?: string | null;
|
|
25
|
+
correlation_id?: string | null;
|
|
26
|
+
reply_to?: string | null;
|
|
27
|
+
privacy?: AgentMessagePrivacy;
|
|
28
|
+
provenance?: AgentJsonObject;
|
|
29
|
+
}
|
|
30
|
+
export interface SentAgentMessage {
|
|
31
|
+
message_id: string;
|
|
32
|
+
delivery_id: string;
|
|
33
|
+
event_id: string;
|
|
34
|
+
project: string;
|
|
35
|
+
sender: string;
|
|
36
|
+
sender_host: string | null;
|
|
37
|
+
recipient: string;
|
|
38
|
+
target_kind: AgentTargetKind;
|
|
39
|
+
content_type: AgentContentType;
|
|
40
|
+
correlation_id: string | null;
|
|
41
|
+
reply_to: string | null;
|
|
42
|
+
privacy: AgentMessagePrivacy;
|
|
43
|
+
created_at: string;
|
|
44
|
+
provenance: AgentJsonObject;
|
|
45
|
+
}
|
|
46
|
+
export interface AgentMessagePostCommitHint {
|
|
47
|
+
delivery_id: string;
|
|
48
|
+
event_id: string;
|
|
49
|
+
project: string;
|
|
50
|
+
target_kind: AgentTargetKind;
|
|
51
|
+
target_id: string;
|
|
52
|
+
}
|
|
53
|
+
export interface AgentMessagePostCommitNotifier {
|
|
54
|
+
notify(hint: AgentMessagePostCommitHint): void | Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
export interface SendAgentMessageOptions {
|
|
57
|
+
notifier?: AgentMessagePostCommitNotifier;
|
|
58
|
+
storage_quota_bytes?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface PollAgentEventsInput {
|
|
61
|
+
project: string;
|
|
62
|
+
recipient: string;
|
|
63
|
+
cursor?: string | null;
|
|
64
|
+
limit?: number;
|
|
65
|
+
}
|
|
66
|
+
export interface AgentMessageEventHeader {
|
|
67
|
+
event_id: string;
|
|
68
|
+
message_id: string;
|
|
69
|
+
sender: string;
|
|
70
|
+
sender_host: string | null;
|
|
71
|
+
recipient: string;
|
|
72
|
+
target_kind: AgentTargetKind;
|
|
73
|
+
content_type: AgentContentType;
|
|
74
|
+
correlation_id: string | null;
|
|
75
|
+
reply_to: string | null;
|
|
76
|
+
privacy: AgentMessagePrivacy;
|
|
77
|
+
created_at: string;
|
|
78
|
+
}
|
|
79
|
+
export interface PollAgentEventsResult {
|
|
80
|
+
events: AgentMessageEventHeader[];
|
|
81
|
+
next_cursor: string;
|
|
82
|
+
}
|
|
83
|
+
export interface WaitForAgentEventsInput extends PollAgentEventsInput {
|
|
84
|
+
wait_ms?: number;
|
|
85
|
+
poll_interval_ms?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface FetchAgentMessageInput {
|
|
88
|
+
project: string;
|
|
89
|
+
recipient: string;
|
|
90
|
+
message_id: string;
|
|
91
|
+
target_kind?: AgentTargetKind;
|
|
92
|
+
}
|
|
93
|
+
export interface AgentMessagePayload {
|
|
94
|
+
message_id: string;
|
|
95
|
+
project: string;
|
|
96
|
+
sender: string;
|
|
97
|
+
sender_host: string | null;
|
|
98
|
+
recipient: string;
|
|
99
|
+
target_kind: AgentTargetKind;
|
|
100
|
+
content_type: AgentContentType;
|
|
101
|
+
correlation_id: string | null;
|
|
102
|
+
reply_to: string | null;
|
|
103
|
+
privacy: AgentMessagePrivacy;
|
|
104
|
+
created_at: string;
|
|
105
|
+
payload: AgentJsonValue;
|
|
106
|
+
provenance: AgentJsonObject;
|
|
107
|
+
}
|
|
108
|
+
interface AgentReceiptBase {
|
|
109
|
+
project: string;
|
|
110
|
+
recipient: string;
|
|
111
|
+
message_id: string;
|
|
112
|
+
actor: string;
|
|
113
|
+
idempotency_key: string;
|
|
114
|
+
detail?: AgentJsonObject;
|
|
115
|
+
}
|
|
116
|
+
export type RecordAgentReceiptInput = (AgentReceiptBase & {
|
|
117
|
+
receipt_kind: 'intake';
|
|
118
|
+
intake_state: AgentIntakeState;
|
|
119
|
+
}) | (AgentReceiptBase & {
|
|
120
|
+
receipt_kind: 'ack';
|
|
121
|
+
}) | (AgentReceiptBase & {
|
|
122
|
+
receipt_kind: 'disposition';
|
|
123
|
+
disposition: AgentDisposition;
|
|
124
|
+
}) | (AgentReceiptBase & {
|
|
125
|
+
receipt_kind: 'host_activation';
|
|
126
|
+
host_activation: AgentHostActivation;
|
|
127
|
+
});
|
|
128
|
+
interface AgentReceiptRowBase {
|
|
129
|
+
receipt_id: string;
|
|
130
|
+
message_id: string;
|
|
131
|
+
project: string;
|
|
132
|
+
recipient: string;
|
|
133
|
+
actor: string;
|
|
134
|
+
idempotency_key: string;
|
|
135
|
+
created_at: string;
|
|
136
|
+
}
|
|
137
|
+
export type AgentMessageReceipt = (AgentReceiptRowBase & {
|
|
138
|
+
receipt_kind: 'intake';
|
|
139
|
+
intake_state: AgentIntakeState;
|
|
140
|
+
detail: AgentJsonObject;
|
|
141
|
+
}) | (AgentReceiptRowBase & {
|
|
142
|
+
receipt_kind: 'ack';
|
|
143
|
+
detail: AgentJsonObject;
|
|
144
|
+
}) | (AgentReceiptRowBase & {
|
|
145
|
+
receipt_kind: 'disposition';
|
|
146
|
+
disposition: AgentDisposition;
|
|
147
|
+
detail: AgentJsonObject;
|
|
148
|
+
}) | (AgentReceiptRowBase & {
|
|
149
|
+
receipt_kind: 'host_activation';
|
|
150
|
+
host_activation: AgentHostActivation;
|
|
151
|
+
detail: AgentJsonObject;
|
|
152
|
+
});
|
|
153
|
+
export interface ReadAgentMessageReceiptsInput {
|
|
154
|
+
project: string;
|
|
155
|
+
recipient: string;
|
|
156
|
+
message_id: string;
|
|
157
|
+
}
|
|
158
|
+
export interface RecordAgentAckFactInput {
|
|
159
|
+
delivery_id: string;
|
|
160
|
+
host_accept_id: string;
|
|
161
|
+
actor: string;
|
|
162
|
+
idempotency_key: string;
|
|
163
|
+
detail?: AgentJsonObject;
|
|
164
|
+
}
|
|
165
|
+
export interface AgentAckFact {
|
|
166
|
+
ack_fact_id: string;
|
|
167
|
+
delivery_id: string;
|
|
168
|
+
host_accept_id: string;
|
|
169
|
+
actor: string;
|
|
170
|
+
idempotency_key: string;
|
|
171
|
+
detail: AgentJsonObject;
|
|
172
|
+
created_at: string;
|
|
173
|
+
}
|
|
174
|
+
export interface RecordAgentWorkflowFactInput {
|
|
175
|
+
delivery_id: string;
|
|
176
|
+
actor: string;
|
|
177
|
+
workflow_state: string;
|
|
178
|
+
idempotency_key: string;
|
|
179
|
+
detail?: AgentJsonObject;
|
|
180
|
+
}
|
|
181
|
+
export interface AgentWorkflowFact {
|
|
182
|
+
workflow_fact_id: string;
|
|
183
|
+
delivery_id: string;
|
|
184
|
+
actor: string;
|
|
185
|
+
workflow_state: string;
|
|
186
|
+
idempotency_key: string;
|
|
187
|
+
detail: AgentJsonObject;
|
|
188
|
+
created_at: string;
|
|
189
|
+
}
|
|
190
|
+
export interface RecordAgentRetentionFactInput {
|
|
191
|
+
message_id: string;
|
|
192
|
+
actor: string;
|
|
193
|
+
retention_state: string;
|
|
194
|
+
idempotency_key: string;
|
|
195
|
+
detail?: AgentJsonObject;
|
|
196
|
+
}
|
|
197
|
+
export interface AgentRetentionFact {
|
|
198
|
+
retention_fact_id: string;
|
|
199
|
+
message_id: string;
|
|
200
|
+
actor: string;
|
|
201
|
+
retention_state: string;
|
|
202
|
+
idempotency_key: string;
|
|
203
|
+
detail: AgentJsonObject;
|
|
204
|
+
created_at: string;
|
|
205
|
+
}
|
|
206
|
+
export declare class AgentMessagingError extends Error {
|
|
207
|
+
}
|
|
208
|
+
export declare class AgentIdempotencyConflictError extends AgentMessagingError {
|
|
209
|
+
}
|
|
210
|
+
export declare class AgentMessageAccessError extends AgentMessagingError {
|
|
211
|
+
}
|
|
212
|
+
export declare class AgentWaitAbortedError extends AgentMessagingError {
|
|
213
|
+
}
|
|
214
|
+
export declare function sendAgentMessage(db: MemeshDatabase, input: SendAgentMessageInput, options?: SendAgentMessageOptions): SentAgentMessage;
|
|
215
|
+
export declare function pollAgentEvents(db: MemeshDatabase, input: PollAgentEventsInput): PollAgentEventsResult;
|
|
216
|
+
export declare function waitForAgentEvents(db: MemeshDatabase, input: WaitForAgentEventsInput, signal?: AbortSignal): Promise<PollAgentEventsResult>;
|
|
217
|
+
export declare function fetchAgentMessage(db: MemeshDatabase, input: FetchAgentMessageInput): AgentMessagePayload;
|
|
218
|
+
export declare function recordAgentReceipt(db: MemeshDatabase, input: RecordAgentReceiptInput): AgentMessageReceipt;
|
|
219
|
+
export declare function readAgentMessageReceipts(db: MemeshDatabase, input: ReadAgentMessageReceiptsInput): AgentMessageReceipt[];
|
|
220
|
+
export declare function recordAgentAckFact(db: MemeshDatabase, input: RecordAgentAckFactInput): AgentAckFact;
|
|
221
|
+
export declare function recordAgentWorkflowFact(db: MemeshDatabase, input: RecordAgentWorkflowFactInput): AgentWorkflowFact;
|
|
222
|
+
export declare function recordAgentRetentionFact(db: MemeshDatabase, input: RecordAgentRetentionFactInput): AgentRetentionFact;
|
|
223
|
+
export {};
|
|
224
|
+
//# sourceMappingURL=agent-messaging.d.ts.map
|