@cleocode/contracts 2026.3.74 → 2026.4.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.
Files changed (46) hide show
  1. package/dist/agent-registry.d.ts +82 -0
  2. package/dist/agent-registry.d.ts.map +1 -0
  3. package/dist/agent-registry.js +12 -0
  4. package/dist/agent-registry.js.map +1 -0
  5. package/dist/code-symbol.d.ts +56 -0
  6. package/dist/code-symbol.d.ts.map +1 -0
  7. package/dist/code-symbol.js +10 -0
  8. package/dist/code-symbol.js.map +1 -0
  9. package/dist/conduit.d.ts +14 -7
  10. package/dist/conduit.d.ts.map +1 -1
  11. package/dist/conduit.js +4 -1
  12. package/dist/conduit.js.map +1 -1
  13. package/dist/data-accessor.d.ts +47 -0
  14. package/dist/data-accessor.d.ts.map +1 -1
  15. package/dist/data-accessor.js.map +1 -1
  16. package/dist/index.d.ts +6 -2
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/lafs.d.ts +1 -1
  21. package/dist/lafs.js +1 -1
  22. package/dist/orchestration-hierarchy.d.ts +81 -0
  23. package/dist/orchestration-hierarchy.d.ts.map +1 -0
  24. package/dist/orchestration-hierarchy.js +31 -0
  25. package/dist/orchestration-hierarchy.js.map +1 -0
  26. package/dist/task.d.ts +2 -0
  27. package/dist/task.d.ts.map +1 -1
  28. package/dist/transport.d.ts +49 -5
  29. package/dist/transport.d.ts.map +1 -1
  30. package/dist/transport.js +10 -3
  31. package/dist/transport.js.map +1 -1
  32. package/dist/wasm/index.d.ts +114 -0
  33. package/dist/wasm/index.d.ts.map +1 -0
  34. package/dist/wasm/index.js +184 -0
  35. package/dist/wasm/index.js.map +1 -0
  36. package/package.json +1 -1
  37. package/src/agent-registry.ts +104 -0
  38. package/src/code-symbol.ts +73 -0
  39. package/src/conduit.ts +14 -7
  40. package/src/data-accessor.ts +56 -0
  41. package/src/index.ts +32 -1
  42. package/src/lafs.ts +2 -2
  43. package/src/orchestration-hierarchy.ts +107 -0
  44. package/src/task.ts +3 -0
  45. package/src/transport.ts +69 -5
  46. package/src/wasm/index.ts +193 -0
@@ -1,12 +1,56 @@
1
1
  /**
2
- * Transport provider interface for CLEO provider adapters.
3
- * Allows providers to supply custom inter-agent transport mechanisms.
4
- * @task T5240
2
+ * Transport Low-level wire protocol adapters for agent messaging.
3
+ *
4
+ * Transport is the HOW layer: it moves messages over the wire using
5
+ * HTTP polling, SSE, WebSocket, or in-process napi-rs calls.
6
+ *
7
+ * The Conduit interface (conduit.ts) wraps Transport to provide
8
+ * high-level messaging semantics (WHAT the agent wants to do).
9
+ *
10
+ * @see docs/specs/SIGNALDOCK-UNIFIED-AGENT-REGISTRY.md Section 4
11
+ * @module transport
5
12
  */
13
+ import type { TransportConfig } from './agent-registry.js';
14
+ import type { ConduitMessage } from './conduit.js';
15
+ /** Configuration passed to Transport.connect(). */
16
+ export interface TransportConnectConfig extends TransportConfig {
17
+ /** Agent ID to connect as. */
18
+ agentId: string;
19
+ /** API key for authentication. */
20
+ apiKey: string;
21
+ /** Base URL of the messaging API. */
22
+ apiBaseUrl: string;
23
+ }
24
+ /** Low-level wire transport for agent messaging. */
25
+ export interface Transport {
26
+ /** Transport name for logging/debugging (e.g. 'http', 'sse', 'ws', 'local'). */
27
+ readonly name: string;
28
+ /** Connect to the messaging backend. */
29
+ connect(config: TransportConnectConfig): Promise<void>;
30
+ /** Disconnect from the messaging backend. */
31
+ disconnect(): Promise<void>;
32
+ /** Send a message payload. */
33
+ push(to: string, content: string, options?: {
34
+ conversationId?: string;
35
+ replyTo?: string;
36
+ }): Promise<{
37
+ messageId: string;
38
+ }>;
39
+ /** Poll for new messages (non-destructive peek). */
40
+ poll(options?: {
41
+ limit?: number;
42
+ since?: string;
43
+ }): Promise<ConduitMessage[]>;
44
+ /** Acknowledge processed messages (marks as delivered). */
45
+ ack(messageIds: string[]): Promise<void>;
46
+ /** Subscribe to real-time events (SSE/WebSocket). Returns unsubscribe. */
47
+ subscribe?(handler: (message: ConduitMessage) => void): () => void;
48
+ }
49
+ /** @deprecated Use Transport instead. Will be removed after unification. */
6
50
  export interface AdapterTransportProvider {
7
- /** Create a transport instance for inter-agent communication */
51
+ /** Create a transport instance for inter-agent communication. */
8
52
  createTransport(): unknown;
9
- /** Name of this transport type for logging/debugging */
53
+ /** Name of this transport type for logging/debugging. */
10
54
  readonly transportName: string;
11
55
  }
12
56
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,wBAAwB;IACvC,gEAAgE;IAChE,eAAe,IAAI,OAAO,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAMnD,mDAAmD;AACnD,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,wCAAwC;IACxC,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD,6CAA6C;IAC7C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,8BAA8B;IAC9B,IAAI,CACF,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAElC,oDAAoD;IACpD,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAE9E,2DAA2D;IAC3D,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC,0EAA0E;IAC1E,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACpE;AAMD,4EAA4E;AAC5E,MAAM,WAAW,wBAAwB;IACvC,iEAAiE;IACjE,eAAe,IAAI,OAAO,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC"}
package/dist/transport.js CHANGED
@@ -1,7 +1,14 @@
1
1
  /**
2
- * Transport provider interface for CLEO provider adapters.
3
- * Allows providers to supply custom inter-agent transport mechanisms.
4
- * @task T5240
2
+ * Transport Low-level wire protocol adapters for agent messaging.
3
+ *
4
+ * Transport is the HOW layer: it moves messages over the wire using
5
+ * HTTP polling, SSE, WebSocket, or in-process napi-rs calls.
6
+ *
7
+ * The Conduit interface (conduit.ts) wraps Transport to provide
8
+ * high-level messaging semantics (WHAT the agent wants to do).
9
+ *
10
+ * @see docs/specs/SIGNALDOCK-UNIFIED-AGENT-REGISTRY.md Section 4
11
+ * @module transport
5
12
  */
6
13
  export {};
7
14
  //# sourceMappingURL=transport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Central WASM SDK for CLEO Core Contracts
3
+ *
4
+ * Provides unified access to all Rust crate WASM modules:
5
+ * - lafs-core: LAFS envelope types and validation
6
+ * - conduit-core: Conduit wire types and CANT metadata
7
+ * - cant-core: CANT grammar parser (via @cleocode/cant)
8
+ *
9
+ * Usage:
10
+ * ```typescript
11
+ * import { initWasm, lafs, conduit } from '@cleocode/contracts/wasm';
12
+ *
13
+ * await initWasm();
14
+ *
15
+ * // LAFS
16
+ * const meta = new lafs.WasmLafsMeta('tasks.list', 'http');
17
+ * const envelope = lafs.WasmLafsEnvelope.createSuccess('{"tasks":[]}', meta);
18
+ *
19
+ * // Conduit
20
+ * const msg = new conduit.WasmConduitMessage('msg-1', 'agent-a', 'Hello', '2026-03-25T00:00:00Z');
21
+ * const cant = new conduit.WasmCantMetadata('actionable', '["@agent"]', '["T123"]', '["#tag"]');
22
+ * ```
23
+ */
24
+ /**
25
+ * Initialize all WASM modules
26
+ * Must be called before using any WASM classes/functions
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * import { initWasm, lafs, conduit } from '@cleocode/contracts/wasm';
31
+ *
32
+ * await initWasm();
33
+ *
34
+ * // Now you can use WASM classes
35
+ * const meta = new lafs.WasmLafsMeta('tasks.list', 'http');
36
+ * ```
37
+ */
38
+ export declare function initWasm(): Promise<void>;
39
+ /**
40
+ * Check if WASM is initialized and ready to use
41
+ *
42
+ * @returns true if WASM modules are loaded and initialized
43
+ */
44
+ export declare function isWasmReady(): boolean;
45
+ /**
46
+ * LAFS Core WASM exports
47
+ *
48
+ * Available after calling initWasm():
49
+ * - WasmLafsTransport - Transport type (Cli, Http, Grpc, Sdk)
50
+ * - WasmLafsMeta - Metadata for LAFS envelopes
51
+ * - WasmLafsEnvelope - The main LAFS response envelope
52
+ * - createTransport() - Helper to create transport from string
53
+ */
54
+ export declare const lafs: {
55
+ /**
56
+ * LAFS Transport enum
57
+ * Use WasmLafsTransport.cli(), .http(), .grpc(), or .sdk()
58
+ */
59
+ readonly WasmLafsTransport: typeof import("./lafs-core/lafs_core.js").WasmLafsTransport;
60
+ /**
61
+ * LAFS Metadata constructor
62
+ * new WasmLafsMeta(operation: string, transport: string)
63
+ */
64
+ readonly WasmLafsMeta: typeof import("./lafs-core/lafs_core.js").WasmLafsMeta;
65
+ /**
66
+ * LAFS Envelope class
67
+ * Use WasmLafsEnvelope.createSuccess() or .createError()
68
+ */
69
+ readonly WasmLafsEnvelope: typeof import("./lafs-core/lafs_core.js").WasmLafsEnvelope;
70
+ /**
71
+ * Helper function to create transport from string
72
+ * @param transport - "cli", "http", "grpc", or "sdk"
73
+ */
74
+ readonly createTransport: typeof import("./lafs-core/lafs_core.js").create_transport;
75
+ };
76
+ /**
77
+ * Conduit Core WASM exports
78
+ *
79
+ * Available after calling initWasm():
80
+ * - WasmConduitMessage - Agent-to-agent messages
81
+ * - WasmConduitState - Connection states (Disconnected, Connecting, Connected, etc.)
82
+ * - WasmCantMetadata - CANT parsing results
83
+ * - parseConduitMessage() - Parse message from JSON
84
+ * - createConduitState() - Create state from string
85
+ */
86
+ export declare const conduit: {
87
+ /**
88
+ * Conduit Message constructor
89
+ * new WasmConduitMessage(id, from, content, timestamp)
90
+ */
91
+ readonly WasmConduitMessage: typeof import("./conduit-core/conduit_core.js").WasmConduitMessage;
92
+ /**
93
+ * Conduit State enum
94
+ * Use WasmConduitState.disconnected(), .connecting(), .connected(), etc.
95
+ */
96
+ readonly WasmConduitState: typeof import("./conduit-core/conduit_core.js").WasmConduitState;
97
+ /**
98
+ * CANT Metadata constructor
99
+ * new WasmCantMetadata(directiveType, addressesJson, taskRefsJson, tagsJson)
100
+ */
101
+ readonly WasmCantMetadata: typeof import("./conduit-core/conduit_core.js").WasmCantMetadata;
102
+ /**
103
+ * Parse a ConduitMessage from JSON string
104
+ * @param json - JSON string
105
+ * @returns WasmConduitMessage or undefined
106
+ */
107
+ readonly parseConduitMessage: typeof import("./conduit-core/conduit_core.js").parse_conduit_message;
108
+ /**
109
+ * Create a ConduitState from string
110
+ * @param state - "disconnected", "connecting", "connected", "reconnecting", "error"
111
+ */
112
+ readonly createConduitState: typeof import("./conduit-core/conduit_core.js").create_conduit_state;
113
+ };
114
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wasm/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA4B9C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI;IACf;;;OAGG;;IAMH;;;OAGG;;IAMH;;;OAGG;;IAMH;;;OAGG;;CAKJ,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO;IAClB;;;OAGG;;IAMH;;;OAGG;;IAMH;;;OAGG;;IAMH;;;;OAIG;;IAMH;;;OAGG;;CAKJ,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Central WASM SDK for CLEO Core Contracts
3
+ *
4
+ * Provides unified access to all Rust crate WASM modules:
5
+ * - lafs-core: LAFS envelope types and validation
6
+ * - conduit-core: Conduit wire types and CANT metadata
7
+ * - cant-core: CANT grammar parser (via @cleocode/cant)
8
+ *
9
+ * Usage:
10
+ * ```typescript
11
+ * import { initWasm, lafs, conduit } from '@cleocode/contracts/wasm';
12
+ *
13
+ * await initWasm();
14
+ *
15
+ * // LAFS
16
+ * const meta = new lafs.WasmLafsMeta('tasks.list', 'http');
17
+ * const envelope = lafs.WasmLafsEnvelope.createSuccess('{"tasks":[]}', meta);
18
+ *
19
+ * // Conduit
20
+ * const msg = new conduit.WasmConduitMessage('msg-1', 'agent-a', 'Hello', '2026-03-25T00:00:00Z');
21
+ * const cant = new conduit.WasmCantMetadata('actionable', '["@agent"]', '["T123"]', '["#tag"]');
22
+ * ```
23
+ */
24
+ // WASM module instances
25
+ let lafsModule = null;
26
+ let conduitModule = null;
27
+ let isInitialized = false;
28
+ let isInitializing = false;
29
+ let initPromise = null;
30
+ /**
31
+ * Initialize all WASM modules
32
+ * Must be called before using any WASM classes/functions
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * import { initWasm, lafs, conduit } from '@cleocode/contracts/wasm';
37
+ *
38
+ * await initWasm();
39
+ *
40
+ * // Now you can use WASM classes
41
+ * const meta = new lafs.WasmLafsMeta('tasks.list', 'http');
42
+ * ```
43
+ */
44
+ export async function initWasm() {
45
+ if (isInitialized)
46
+ return;
47
+ if (isInitializing) {
48
+ return initPromise;
49
+ }
50
+ isInitializing = true;
51
+ initPromise = (async () => {
52
+ try {
53
+ // Dynamic imports to avoid loading if not needed
54
+ const [lafs, conduit] = await Promise.all([
55
+ import('./lafs-core/lafs_core.js'),
56
+ import('./conduit-core/conduit_core.js'),
57
+ ]);
58
+ // Initialize modules
59
+ await Promise.all([lafs.default(), conduit.default()]);
60
+ lafsModule = lafs;
61
+ conduitModule = conduit;
62
+ isInitialized = true;
63
+ }
64
+ catch (_error) {
65
+ throw new Error('WASM initialization failed. Ensure WASM files are present.');
66
+ }
67
+ })();
68
+ await initPromise;
69
+ isInitializing = false;
70
+ }
71
+ /**
72
+ * Check if WASM is initialized and ready to use
73
+ *
74
+ * @returns true if WASM modules are loaded and initialized
75
+ */
76
+ export function isWasmReady() {
77
+ return isInitialized;
78
+ }
79
+ /**
80
+ * LAFS Core WASM exports
81
+ *
82
+ * Available after calling initWasm():
83
+ * - WasmLafsTransport - Transport type (Cli, Http, Grpc, Sdk)
84
+ * - WasmLafsMeta - Metadata for LAFS envelopes
85
+ * - WasmLafsEnvelope - The main LAFS response envelope
86
+ * - createTransport() - Helper to create transport from string
87
+ */
88
+ export const lafs = {
89
+ /**
90
+ * LAFS Transport enum
91
+ * Use WasmLafsTransport.cli(), .http(), .grpc(), or .sdk()
92
+ */
93
+ get WasmLafsTransport() {
94
+ if (!lafsModule)
95
+ throw new Error('WASM not initialized. Call initWasm() first.');
96
+ return lafsModule.WasmLafsTransport;
97
+ },
98
+ /**
99
+ * LAFS Metadata constructor
100
+ * new WasmLafsMeta(operation: string, transport: string)
101
+ */
102
+ get WasmLafsMeta() {
103
+ if (!lafsModule)
104
+ throw new Error('WASM not initialized. Call initWasm() first.');
105
+ return lafsModule.WasmLafsMeta;
106
+ },
107
+ /**
108
+ * LAFS Envelope class
109
+ * Use WasmLafsEnvelope.createSuccess() or .createError()
110
+ */
111
+ get WasmLafsEnvelope() {
112
+ if (!lafsModule)
113
+ throw new Error('WASM not initialized. Call initWasm() first.');
114
+ return lafsModule.WasmLafsEnvelope;
115
+ },
116
+ /**
117
+ * Helper function to create transport from string
118
+ * @param transport - "cli", "http", "grpc", or "sdk"
119
+ */
120
+ get createTransport() {
121
+ if (!lafsModule)
122
+ throw new Error('WASM not initialized. Call initWasm() first.');
123
+ return lafsModule.create_transport;
124
+ },
125
+ };
126
+ /**
127
+ * Conduit Core WASM exports
128
+ *
129
+ * Available after calling initWasm():
130
+ * - WasmConduitMessage - Agent-to-agent messages
131
+ * - WasmConduitState - Connection states (Disconnected, Connecting, Connected, etc.)
132
+ * - WasmCantMetadata - CANT parsing results
133
+ * - parseConduitMessage() - Parse message from JSON
134
+ * - createConduitState() - Create state from string
135
+ */
136
+ export const conduit = {
137
+ /**
138
+ * Conduit Message constructor
139
+ * new WasmConduitMessage(id, from, content, timestamp)
140
+ */
141
+ get WasmConduitMessage() {
142
+ if (!conduitModule)
143
+ throw new Error('WASM not initialized. Call initWasm() first.');
144
+ return conduitModule.WasmConduitMessage;
145
+ },
146
+ /**
147
+ * Conduit State enum
148
+ * Use WasmConduitState.disconnected(), .connecting(), .connected(), etc.
149
+ */
150
+ get WasmConduitState() {
151
+ if (!conduitModule)
152
+ throw new Error('WASM not initialized. Call initWasm() first.');
153
+ return conduitModule.WasmConduitState;
154
+ },
155
+ /**
156
+ * CANT Metadata constructor
157
+ * new WasmCantMetadata(directiveType, addressesJson, taskRefsJson, tagsJson)
158
+ */
159
+ get WasmCantMetadata() {
160
+ if (!conduitModule)
161
+ throw new Error('WASM not initialized. Call initWasm() first.');
162
+ return conduitModule.WasmCantMetadata;
163
+ },
164
+ /**
165
+ * Parse a ConduitMessage from JSON string
166
+ * @param json - JSON string
167
+ * @returns WasmConduitMessage or undefined
168
+ */
169
+ get parseConduitMessage() {
170
+ if (!conduitModule)
171
+ throw new Error('WASM not initialized. Call initWasm() first.');
172
+ return conduitModule.parse_conduit_message;
173
+ },
174
+ /**
175
+ * Create a ConduitState from string
176
+ * @param state - "disconnected", "connecting", "connected", "reconnecting", "error"
177
+ */
178
+ get createConduitState() {
179
+ if (!conduitModule)
180
+ throw new Error('WASM not initialized. Call initWasm() first.');
181
+ return conduitModule.create_conduit_state;
182
+ },
183
+ };
184
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wasm/index.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/contracts",
3
- "version": "2026.3.74",
3
+ "version": "2026.4.0",
4
4
  "description": "Domain types, interfaces, and contracts for the CLEO ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Agent Registry — Credential management and lifecycle for registered agents.
3
+ *
4
+ * Provides typed CRUD operations for agent credentials stored in the
5
+ * local project database (`.cleo/tasks.db`). API keys are encrypted at
6
+ * rest using AES-256-GCM with a machine-bound key.
7
+ *
8
+ * @see docs/specs/SIGNALDOCK-UNIFIED-AGENT-REGISTRY.md Section 3
9
+ * @module agent-registry
10
+ */
11
+
12
+ // ============================================================================
13
+ // Transport configuration
14
+ // ============================================================================
15
+
16
+ /** Transport-specific configuration stored per agent credential. */
17
+ export interface TransportConfig {
18
+ /** Polling interval in milliseconds (for HTTP polling transport). */
19
+ pollIntervalMs?: number;
20
+ /** SSE endpoint URL (for Server-Sent Events transport). */
21
+ sseEndpoint?: string;
22
+ /** WebSocket URL (for WebSocket transport). */
23
+ wsUrl?: string;
24
+ /** HTTP polling endpoint path (for HTTP polling transport). */
25
+ pollEndpoint?: string;
26
+ /** Fallback API base URL (used when primary apiBaseUrl is unreachable). */
27
+ apiBaseUrlFallback?: string;
28
+ }
29
+
30
+ // ============================================================================
31
+ // Agent credential
32
+ // ============================================================================
33
+
34
+ /** A registered agent's credentials and profile. */
35
+ export interface AgentCredential {
36
+ /** Unique agent identifier (e.g. 'cleo-core', 'forge-ts-opus'). */
37
+ agentId: string;
38
+ /** Human-readable display name. */
39
+ displayName: string;
40
+ /** API key for authentication (`sk_live_*`). Stored encrypted at rest. */
41
+ apiKey: string;
42
+ /** Base URL of the messaging API (default: api.signaldock.io, legacy: api.clawmsgr.com). */
43
+ apiBaseUrl: string;
44
+ /** Agent classification from the registry (e.g. 'code_dev', 'orchestrator'). */
45
+ classification?: string;
46
+ /** Privacy tier controlling discoverability. */
47
+ privacyTier: 'public' | 'discoverable' | 'private';
48
+ /** Agent capabilities (e.g. ['chat', 'tools', 'code-execution']). */
49
+ capabilities: string[];
50
+ /** Agent skills (e.g. ['coding', 'review', 'testing']). */
51
+ skills: string[];
52
+ /** Transport type for agent connections. */
53
+ transportType: 'http' | 'sse' | 'websocket';
54
+ /** Transport-specific configuration. */
55
+ transportConfig: TransportConfig;
56
+ /** Whether this agent is currently active. */
57
+ isActive: boolean;
58
+ /** ISO 8601 timestamp of last use (polling, sending, etc.). */
59
+ lastUsedAt?: string;
60
+ /** ISO 8601 creation timestamp. */
61
+ createdAt: string;
62
+ /** ISO 8601 last update timestamp. */
63
+ updatedAt: string;
64
+ }
65
+
66
+ // ============================================================================
67
+ // Registry API
68
+ // ============================================================================
69
+
70
+ /** Filter options for listing agent credentials. */
71
+ export interface AgentListFilter {
72
+ /** Filter by active/inactive status. */
73
+ active?: boolean;
74
+ }
75
+
76
+ /** CRUD and lifecycle operations for agent credentials. */
77
+ export interface AgentRegistryAPI {
78
+ /** Register a new agent credential. */
79
+ register(credential: Omit<AgentCredential, 'createdAt' | 'updatedAt'>): Promise<AgentCredential>;
80
+
81
+ /** Get a single agent credential by ID. Returns null if not found. */
82
+ get(agentId: string): Promise<AgentCredential | null>;
83
+
84
+ /** List agent credentials with optional filtering. */
85
+ list(filter?: AgentListFilter): Promise<AgentCredential[]>;
86
+
87
+ /** Update fields on an existing agent credential. */
88
+ update(
89
+ agentId: string,
90
+ updates: Partial<Omit<AgentCredential, 'agentId' | 'createdAt'>>,
91
+ ): Promise<AgentCredential>;
92
+
93
+ /** Remove an agent credential permanently. */
94
+ remove(agentId: string): Promise<void>;
95
+
96
+ /** Rotate an agent's API key (generates new key on cloud, re-encrypts locally). */
97
+ rotateKey(agentId: string): Promise<{ agentId: string; newApiKey: string }>;
98
+
99
+ /** Get the most recently used active agent credential. Returns null if none. */
100
+ getActive(): Promise<AgentCredential | null>;
101
+
102
+ /** Mark an agent as recently used (updates `lastUsedAt`). */
103
+ markUsed(agentId: string): Promise<void>;
104
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Code symbol types for tree-sitter AST analysis.
3
+ *
4
+ * Used by the Smart Explore code analysis pipeline to represent
5
+ * parsed source code structures.
6
+ *
7
+ * @task T149
8
+ */
9
+
10
+ /** Kind of code symbol extracted from AST. */
11
+ export type CodeSymbolKind =
12
+ | 'function'
13
+ | 'method'
14
+ | 'class'
15
+ | 'interface'
16
+ | 'type'
17
+ | 'enum'
18
+ | 'variable'
19
+ | 'constant'
20
+ | 'module'
21
+ | 'import'
22
+ | 'export'
23
+ | 'struct'
24
+ | 'trait'
25
+ | 'impl';
26
+
27
+ /** A structured code symbol extracted from a source file via tree-sitter. */
28
+ export interface CodeSymbol {
29
+ /** Symbol name (e.g. "parseFile", "HttpTransport"). */
30
+ name: string;
31
+ /** Kind of symbol. */
32
+ kind: CodeSymbolKind;
33
+ /** Start line (1-based). */
34
+ startLine: number;
35
+ /** End line (1-based). */
36
+ endLine: number;
37
+ /** File path (relative to project root). */
38
+ filePath: string;
39
+ /** Language of the source file. */
40
+ language: string;
41
+ /** Parent symbol name (e.g. class name for methods). */
42
+ parent?: string;
43
+ /** Whether the symbol is exported. */
44
+ exported?: boolean;
45
+ /** Function/method parameters (if applicable). */
46
+ parameters?: string[];
47
+ /** Return type annotation (if available). */
48
+ returnType?: string;
49
+ /** JSDoc/docstring summary (first line only). */
50
+ docSummary?: string;
51
+ }
52
+
53
+ /** Result of parsing a single file. */
54
+ export interface ParseResult {
55
+ /** Source file path. */
56
+ filePath: string;
57
+ /** Detected language. */
58
+ language: string;
59
+ /** Extracted symbols. */
60
+ symbols: CodeSymbol[];
61
+ /** Parse errors (non-fatal). */
62
+ errors: string[];
63
+ }
64
+
65
+ /** Result of batch-parsing multiple files. */
66
+ export interface BatchParseResult {
67
+ /** Per-file results. */
68
+ results: ParseResult[];
69
+ /** Files that were skipped (unsupported language). */
70
+ skipped: string[];
71
+ /** Total symbols found across all files. */
72
+ totalSymbols: number;
73
+ }
package/src/conduit.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Conduit Protocol — Agent-to-agent communication interface.
3
3
  *
4
- * SignalDock implements this interface. CleoOS consumes it.
4
+ * This is a CLIENT-SIDE interface. Implementations call a messaging
5
+ * backend (SignalDock REST API, local napi-rs, etc.). SignalDock is
6
+ * the canonical backend; it does NOT implement this TypeScript interface.
7
+ *
5
8
  * CLEO Core defines the contract in @cleocode/contracts.
6
9
  *
7
10
  * This is the canonical TypeScript interface for the Conduit Protocol
@@ -81,16 +84,20 @@ export interface ConduitStateChange {
81
84
  // ============================================================================
82
85
 
83
86
  /**
84
- * The Conduit Protocol interface.
87
+ * The Conduit Protocol interface — high-level agent messaging.
88
+ *
89
+ * Conduit wraps a Transport adapter, adding messaging semantics.
85
90
  *
86
91
  * Implementations:
87
- * - ClawMsgrPollingService (CleoOS Electron main process polls cloud API)
88
- * - LocalSignalDock (napi-rs binding — WebSocket to local SignalDock runtime)
89
- * - ClawMsgrWorker (CLI polling script clawmsgr-worker.py wrapper)
92
+ * - `ConduitClient` (`@cleocode/core`wraps any Transport)
93
+ * - `HttpTransport` (HTTP polling to cloud SignalDock API)
94
+ * - `LocalTransport` (napi-rs in-processembedded SignalDock, future)
95
+ * - `SseTransport` (Server-Sent Events — real-time cloud, future)
90
96
  *
91
97
  * Consumers:
92
- * - CleoOS tRPC routers (wire into orchestration, session management)
93
- * - @cleocode/core facade (sessions.serialize/restore, orchestration commands)
98
+ * - `@cleocode/cleo` CLI (`cleo agent watch/poll/send`)
99
+ * - `@cleocode/runtime` (background polling, SSE connections)
100
+ * - CleoOS Electron (embedded SignalDock via LocalTransport)
94
101
  * - Agent spawners (deliver task assignments, collect results)
95
102
  */
96
103
  export interface Conduit {