@multi-agent-protocol/sdk 0.0.5 → 0.0.7
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 +164 -5
- package/dist/{index-DMcRbXOS.d.cts → index-BQXp4_rd.d.cts} +543 -12
- package/dist/{index-DMcRbXOS.d.ts → index-BQXp4_rd.d.ts} +543 -12
- package/dist/index.cjs +774 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +520 -12
- package/dist/index.d.ts +520 -12
- package/dist/index.js +773 -5
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +442 -8
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +442 -8
- package/dist/testing.js.map +1 -1
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,87 @@
|
|
|
1
|
+
import { TunnelStream, createMeshPeer } from 'agentic-mesh';
|
|
1
2
|
export { monotonicFactory, ulid } from 'ulid';
|
|
2
3
|
import { EventEmitter } from 'events';
|
|
3
4
|
import { z } from 'zod';
|
|
4
5
|
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/stream/agentic-mesh.ts
|
|
17
|
+
var agentic_mesh_exports = {};
|
|
18
|
+
__export(agentic_mesh_exports, {
|
|
19
|
+
agenticMeshStream: () => agenticMeshStream
|
|
20
|
+
});
|
|
21
|
+
async function agenticMeshStream(config) {
|
|
22
|
+
if (!config.transport.active) {
|
|
23
|
+
await config.transport.start();
|
|
24
|
+
}
|
|
25
|
+
const connected = await config.transport.connect(config.peer);
|
|
26
|
+
if (!connected) {
|
|
27
|
+
throw new Error(`Failed to connect to peer: ${config.peer.peerId}`);
|
|
28
|
+
}
|
|
29
|
+
const streamId = `map-${config.localPeerId}-${Date.now()}`;
|
|
30
|
+
const tunnelStream = new TunnelStream({
|
|
31
|
+
transport: config.transport,
|
|
32
|
+
peerId: config.peer.peerId,
|
|
33
|
+
streamId
|
|
34
|
+
});
|
|
35
|
+
await tunnelStream.open();
|
|
36
|
+
return tunnelStreamToMapStream(tunnelStream);
|
|
37
|
+
}
|
|
38
|
+
function tunnelStreamToMapStream(tunnel) {
|
|
39
|
+
let readingAborted = false;
|
|
40
|
+
const readable = new ReadableStream({
|
|
41
|
+
async start(controller) {
|
|
42
|
+
try {
|
|
43
|
+
for await (const frame of tunnel) {
|
|
44
|
+
if (readingAborted) break;
|
|
45
|
+
controller.enqueue(frame);
|
|
46
|
+
}
|
|
47
|
+
if (!readingAborted) {
|
|
48
|
+
controller.close();
|
|
49
|
+
}
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (!readingAborted) {
|
|
52
|
+
controller.error(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
cancel() {
|
|
57
|
+
readingAborted = true;
|
|
58
|
+
tunnel.close().catch(() => {
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const writable = new WritableStream({
|
|
63
|
+
async write(message) {
|
|
64
|
+
if (!tunnel.isOpen) {
|
|
65
|
+
throw new Error("Stream is not open");
|
|
66
|
+
}
|
|
67
|
+
await tunnel.write(message);
|
|
68
|
+
},
|
|
69
|
+
async close() {
|
|
70
|
+
await tunnel.close();
|
|
71
|
+
},
|
|
72
|
+
abort() {
|
|
73
|
+
readingAborted = true;
|
|
74
|
+
tunnel.close().catch(() => {
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return { readable, writable };
|
|
79
|
+
}
|
|
80
|
+
var init_agentic_mesh = __esm({
|
|
81
|
+
"src/stream/agentic-mesh.ts"() {
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
5
85
|
// src/types/index.ts
|
|
6
86
|
function isOrphanedAgent(agent) {
|
|
7
87
|
return agent.ownerId === null;
|
|
@@ -87,6 +167,7 @@ var SESSION_METHODS = {
|
|
|
87
167
|
SESSION_CLOSE: "map/session/close"
|
|
88
168
|
};
|
|
89
169
|
var AUTH_METHODS = {
|
|
170
|
+
AUTHENTICATE: "map/authenticate",
|
|
90
171
|
AUTH_REFRESH: "map/auth/refresh"
|
|
91
172
|
};
|
|
92
173
|
var PERMISSION_METHODS = {
|
|
@@ -100,7 +181,9 @@ var NOTIFICATION_METHODS = {
|
|
|
100
181
|
EVENT: "map/event",
|
|
101
182
|
MESSAGE: "map/message",
|
|
102
183
|
/** Client acknowledges received events (for backpressure) */
|
|
103
|
-
SUBSCRIBE_ACK: "map/subscribe.ack"
|
|
184
|
+
SUBSCRIBE_ACK: "map/subscribe.ack",
|
|
185
|
+
/** Server notifies client that auth is about to expire */
|
|
186
|
+
AUTH_EXPIRING: "map/auth/expiring"
|
|
104
187
|
};
|
|
105
188
|
var MAP_METHODS = {
|
|
106
189
|
...CORE_METHODS,
|
|
@@ -135,7 +218,10 @@ var AUTH_ERROR_CODES = {
|
|
|
135
218
|
AUTH_REQUIRED: 1e3,
|
|
136
219
|
AUTH_FAILED: 1001,
|
|
137
220
|
TOKEN_EXPIRED: 1002,
|
|
138
|
-
PERMISSION_DENIED: 1003
|
|
221
|
+
PERMISSION_DENIED: 1003,
|
|
222
|
+
INSUFFICIENT_SCOPE: 1004,
|
|
223
|
+
METHOD_NOT_SUPPORTED: 1005,
|
|
224
|
+
INVALID_CREDENTIALS: 1006
|
|
139
225
|
};
|
|
140
226
|
var ROUTING_ERROR_CODES = {
|
|
141
227
|
ADDRESS_NOT_FOUND: 2e3,
|
|
@@ -209,7 +295,8 @@ var CAPABILITY_REQUIREMENTS = {
|
|
|
209
295
|
[SESSION_METHODS.SESSION_LIST]: [],
|
|
210
296
|
[SESSION_METHODS.SESSION_LOAD]: [],
|
|
211
297
|
[SESSION_METHODS.SESSION_CLOSE]: [],
|
|
212
|
-
// Auth
|
|
298
|
+
// Auth (no capability required - anyone can authenticate)
|
|
299
|
+
[AUTH_METHODS.AUTHENTICATE]: [],
|
|
213
300
|
[AUTH_METHODS.AUTH_REFRESH]: [],
|
|
214
301
|
// Permissions (system-only, no capability check - enforced by participant type)
|
|
215
302
|
[PERMISSION_METHODS.PERMISSIONS_UPDATE]: [],
|
|
@@ -380,6 +467,27 @@ var MAPRequestError = class _MAPRequestError extends Error {
|
|
|
380
467
|
{ category: "auth" }
|
|
381
468
|
);
|
|
382
469
|
}
|
|
470
|
+
static insufficientScope(required) {
|
|
471
|
+
return new _MAPRequestError(
|
|
472
|
+
AUTH_ERROR_CODES.INSUFFICIENT_SCOPE,
|
|
473
|
+
required ? `Insufficient scope: ${required}` : "Insufficient scope",
|
|
474
|
+
{ category: "auth" }
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
static methodNotSupported(method) {
|
|
478
|
+
return new _MAPRequestError(
|
|
479
|
+
AUTH_ERROR_CODES.METHOD_NOT_SUPPORTED,
|
|
480
|
+
`Authentication method not supported: ${method}`,
|
|
481
|
+
{ category: "auth" }
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
static invalidCredentials(details) {
|
|
485
|
+
return new _MAPRequestError(
|
|
486
|
+
AUTH_ERROR_CODES.INVALID_CREDENTIALS,
|
|
487
|
+
details ?? "Invalid credentials",
|
|
488
|
+
{ category: "auth" }
|
|
489
|
+
);
|
|
490
|
+
}
|
|
383
491
|
// ==========================================================================
|
|
384
492
|
// Routing Errors (2xxx)
|
|
385
493
|
// ==========================================================================
|
|
@@ -561,6 +669,7 @@ var MAPTimeoutError = class extends Error {
|
|
|
561
669
|
};
|
|
562
670
|
|
|
563
671
|
// src/stream/index.ts
|
|
672
|
+
init_agentic_mesh();
|
|
564
673
|
function ndJsonStream(readable, writable) {
|
|
565
674
|
const encoder = new TextEncoder();
|
|
566
675
|
const decoder = new TextDecoder();
|
|
@@ -2392,6 +2501,33 @@ var ACPStreamConnection = class extends EventEmitter {
|
|
|
2392
2501
|
});
|
|
2393
2502
|
}
|
|
2394
2503
|
// ===========================================================================
|
|
2504
|
+
// Extension Methods
|
|
2505
|
+
// ===========================================================================
|
|
2506
|
+
/**
|
|
2507
|
+
* Call an ACP extension method on the target agent.
|
|
2508
|
+
*
|
|
2509
|
+
* Extension methods are prefixed with "_" (e.g., "_macro/spawnAgent").
|
|
2510
|
+
* The agent must support the extension for this to succeed.
|
|
2511
|
+
*
|
|
2512
|
+
* @param method - The extension method name (e.g., "_macro/spawnAgent")
|
|
2513
|
+
* @param params - Parameters to pass to the extension method
|
|
2514
|
+
* @returns The result from the extension method
|
|
2515
|
+
*
|
|
2516
|
+
* @example
|
|
2517
|
+
* ```typescript
|
|
2518
|
+
* const result = await acp.callExtension("_macro/spawnAgent", {
|
|
2519
|
+
* task: "Implement feature X",
|
|
2520
|
+
* cwd: "/project"
|
|
2521
|
+
* });
|
|
2522
|
+
* ```
|
|
2523
|
+
*/
|
|
2524
|
+
async callExtension(method, params) {
|
|
2525
|
+
if (!this.#initialized) {
|
|
2526
|
+
throw new Error("Must call initialize() before callExtension()");
|
|
2527
|
+
}
|
|
2528
|
+
return this.#sendRequest(method, params);
|
|
2529
|
+
}
|
|
2530
|
+
// ===========================================================================
|
|
2395
2531
|
// Lifecycle
|
|
2396
2532
|
// ===========================================================================
|
|
2397
2533
|
/**
|
|
@@ -2433,6 +2569,8 @@ var ClientConnection = class _ClientConnection {
|
|
|
2433
2569
|
#connected = false;
|
|
2434
2570
|
#lastConnectOptions;
|
|
2435
2571
|
#isReconnecting = false;
|
|
2572
|
+
#lastResumeToken;
|
|
2573
|
+
#onTokenExpiring;
|
|
2436
2574
|
constructor(stream, options = {}) {
|
|
2437
2575
|
this.#connection = new BaseConnection(stream, options);
|
|
2438
2576
|
this.#options = options;
|
|
@@ -2498,11 +2636,70 @@ var ClientConnection = class _ClientConnection {
|
|
|
2498
2636
|
await client.connect({ auth: options?.auth });
|
|
2499
2637
|
return client;
|
|
2500
2638
|
}
|
|
2639
|
+
/**
|
|
2640
|
+
* Connect to a MAP server via agentic-mesh transport.
|
|
2641
|
+
*
|
|
2642
|
+
* Handles:
|
|
2643
|
+
* - Dynamic import of agentic-mesh (optional peer dependency)
|
|
2644
|
+
* - Stream creation over encrypted mesh tunnel
|
|
2645
|
+
* - Auto-configuration of createStream for reconnection
|
|
2646
|
+
* - Initial MAP protocol connect handshake
|
|
2647
|
+
*
|
|
2648
|
+
* Requires `agentic-mesh` to be installed as a peer dependency.
|
|
2649
|
+
*
|
|
2650
|
+
* @param options - Mesh connection options
|
|
2651
|
+
* @returns Connected ClientConnection instance
|
|
2652
|
+
*
|
|
2653
|
+
* @example
|
|
2654
|
+
* ```typescript
|
|
2655
|
+
* import { createNebulaTransport } from 'agentic-mesh';
|
|
2656
|
+
*
|
|
2657
|
+
* const transport = createNebulaTransport({
|
|
2658
|
+
* configPath: '/etc/nebula/config.yml',
|
|
2659
|
+
* });
|
|
2660
|
+
*
|
|
2661
|
+
* const client = await ClientConnection.connectMesh({
|
|
2662
|
+
* transport,
|
|
2663
|
+
* peer: { peerId: 'server', address: '10.0.0.1', port: 4242 },
|
|
2664
|
+
* localPeerId: 'my-client',
|
|
2665
|
+
* name: 'MeshClient',
|
|
2666
|
+
* reconnection: true
|
|
2667
|
+
* });
|
|
2668
|
+
*
|
|
2669
|
+
* const agents = await client.listAgents();
|
|
2670
|
+
* ```
|
|
2671
|
+
*/
|
|
2672
|
+
static async connectMesh(options) {
|
|
2673
|
+
const { agenticMeshStream: agenticMeshStream2 } = await Promise.resolve().then(() => (init_agentic_mesh(), agentic_mesh_exports));
|
|
2674
|
+
const streamConfig = {
|
|
2675
|
+
transport: options.transport,
|
|
2676
|
+
peer: options.peer,
|
|
2677
|
+
localPeerId: options.localPeerId,
|
|
2678
|
+
timeout: options.timeout
|
|
2679
|
+
};
|
|
2680
|
+
const stream = await agenticMeshStream2(streamConfig);
|
|
2681
|
+
const createStream = async () => agenticMeshStream2(streamConfig);
|
|
2682
|
+
const reconnection = options.reconnection === true ? { enabled: true } : typeof options.reconnection === "object" ? options.reconnection : void 0;
|
|
2683
|
+
const client = new _ClientConnection(stream, {
|
|
2684
|
+
name: options.name,
|
|
2685
|
+
capabilities: options.capabilities,
|
|
2686
|
+
createStream,
|
|
2687
|
+
reconnection
|
|
2688
|
+
});
|
|
2689
|
+
await client.connect({ auth: options.auth });
|
|
2690
|
+
return client;
|
|
2691
|
+
}
|
|
2501
2692
|
// ===========================================================================
|
|
2502
2693
|
// Connection Lifecycle
|
|
2503
2694
|
// ===========================================================================
|
|
2504
2695
|
/**
|
|
2505
2696
|
* Connect to the MAP system
|
|
2697
|
+
*
|
|
2698
|
+
* @param options - Connection options
|
|
2699
|
+
* @param options.sessionId - Specific session ID to use
|
|
2700
|
+
* @param options.resumeToken - Token to resume a previously disconnected session
|
|
2701
|
+
* @param options.auth - Authentication credentials
|
|
2702
|
+
* @param options.onTokenExpiring - Callback invoked before token expires for proactive refresh
|
|
2506
2703
|
*/
|
|
2507
2704
|
async connect(options) {
|
|
2508
2705
|
const params = {
|
|
@@ -2518,10 +2715,134 @@ var ClientConnection = class _ClientConnection {
|
|
|
2518
2715
|
this.#sessionId = result.sessionId;
|
|
2519
2716
|
this.#serverCapabilities = result.capabilities;
|
|
2520
2717
|
this.#connected = true;
|
|
2718
|
+
if (result.resumeToken) {
|
|
2719
|
+
this.#lastResumeToken = result.resumeToken;
|
|
2720
|
+
}
|
|
2721
|
+
if (options?.onTokenExpiring) {
|
|
2722
|
+
this.#onTokenExpiring = options.onTokenExpiring;
|
|
2723
|
+
this.#setupTokenExpiryMonitoring(result);
|
|
2724
|
+
}
|
|
2521
2725
|
this.#connection._transitionTo("connected");
|
|
2522
2726
|
this.#lastConnectOptions = options;
|
|
2523
2727
|
return result;
|
|
2524
2728
|
}
|
|
2729
|
+
/**
|
|
2730
|
+
* Get the resume token for this session.
|
|
2731
|
+
* Can be used to reconnect and restore session state after disconnection.
|
|
2732
|
+
*
|
|
2733
|
+
* @returns The resume token, or undefined if not available
|
|
2734
|
+
*/
|
|
2735
|
+
getResumeToken() {
|
|
2736
|
+
return this.#lastResumeToken;
|
|
2737
|
+
}
|
|
2738
|
+
/**
|
|
2739
|
+
* Reconnect to the server, optionally using a resume token to restore session.
|
|
2740
|
+
*
|
|
2741
|
+
* @param resumeToken - Token to resume previous session. If not provided, uses the last known token.
|
|
2742
|
+
* @returns Connect response result
|
|
2743
|
+
*
|
|
2744
|
+
* @example
|
|
2745
|
+
* ```typescript
|
|
2746
|
+
* // Save token before disconnect
|
|
2747
|
+
* const token = await client.disconnect();
|
|
2748
|
+
*
|
|
2749
|
+
* // Later, reconnect with the token
|
|
2750
|
+
* const result = await client.reconnect(token);
|
|
2751
|
+
* console.log('Reconnected:', result.reconnected);
|
|
2752
|
+
* ```
|
|
2753
|
+
*/
|
|
2754
|
+
async reconnect(resumeToken) {
|
|
2755
|
+
const tokenToUse = resumeToken ?? this.#lastResumeToken;
|
|
2756
|
+
return this.connect({
|
|
2757
|
+
...this.#lastConnectOptions,
|
|
2758
|
+
resumeToken: tokenToUse
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
/**
|
|
2762
|
+
* Set up monitoring for token expiration
|
|
2763
|
+
*/
|
|
2764
|
+
#setupTokenExpiryMonitoring(connectResult) {
|
|
2765
|
+
const principal = connectResult.principal;
|
|
2766
|
+
if (!principal?.expiresAt || !this.#onTokenExpiring) {
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
const expiresAt = principal.expiresAt;
|
|
2770
|
+
const now = Date.now();
|
|
2771
|
+
const warningTime = expiresAt - 6e4;
|
|
2772
|
+
const delay = warningTime - now;
|
|
2773
|
+
if (delay > 0) {
|
|
2774
|
+
setTimeout(async () => {
|
|
2775
|
+
if (!this.#connected || !this.#onTokenExpiring) return;
|
|
2776
|
+
try {
|
|
2777
|
+
const newCredentials = await this.#onTokenExpiring(expiresAt);
|
|
2778
|
+
if (newCredentials) {
|
|
2779
|
+
const refreshResult = await this.refreshAuth({
|
|
2780
|
+
method: newCredentials.method,
|
|
2781
|
+
credential: newCredentials.credential
|
|
2782
|
+
});
|
|
2783
|
+
if (refreshResult.success && refreshResult.principal?.expiresAt) {
|
|
2784
|
+
this.#setupTokenExpiryMonitoring({
|
|
2785
|
+
...connectResult,
|
|
2786
|
+
principal: refreshResult.principal
|
|
2787
|
+
});
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
} catch {
|
|
2791
|
+
}
|
|
2792
|
+
}, delay);
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Authenticate with the server after connection.
|
|
2797
|
+
*
|
|
2798
|
+
* Use this when the server returns `authRequired` in the connect response,
|
|
2799
|
+
* indicating that authentication is needed before accessing protected resources.
|
|
2800
|
+
*
|
|
2801
|
+
* @param auth - Authentication credentials
|
|
2802
|
+
* @returns Authentication result with principal if successful
|
|
2803
|
+
*
|
|
2804
|
+
* @example
|
|
2805
|
+
* ```typescript
|
|
2806
|
+
* const connectResult = await client.connect();
|
|
2807
|
+
*
|
|
2808
|
+
* if (connectResult.authRequired) {
|
|
2809
|
+
* const authResult = await client.authenticate({
|
|
2810
|
+
* method: 'api-key',
|
|
2811
|
+
* credential: process.env.API_KEY,
|
|
2812
|
+
* });
|
|
2813
|
+
*
|
|
2814
|
+
* if (authResult.success) {
|
|
2815
|
+
* console.log('Authenticated as:', authResult.principal?.id);
|
|
2816
|
+
* }
|
|
2817
|
+
* }
|
|
2818
|
+
* ```
|
|
2819
|
+
*/
|
|
2820
|
+
async authenticate(auth) {
|
|
2821
|
+
const params = {
|
|
2822
|
+
method: auth.method,
|
|
2823
|
+
credential: auth.credential
|
|
2824
|
+
};
|
|
2825
|
+
const result = await this.#connection.sendRequest(AUTH_METHODS.AUTHENTICATE, params);
|
|
2826
|
+
if (result.success && result.sessionId) {
|
|
2827
|
+
this.#sessionId = result.sessionId;
|
|
2828
|
+
}
|
|
2829
|
+
return result;
|
|
2830
|
+
}
|
|
2831
|
+
/**
|
|
2832
|
+
* Refresh authentication credentials.
|
|
2833
|
+
*
|
|
2834
|
+
* Use this to update credentials before they expire for long-lived connections.
|
|
2835
|
+
*
|
|
2836
|
+
* @param auth - New authentication credentials
|
|
2837
|
+
* @returns Updated principal information
|
|
2838
|
+
*/
|
|
2839
|
+
async refreshAuth(auth) {
|
|
2840
|
+
const params = {
|
|
2841
|
+
method: auth.method,
|
|
2842
|
+
credential: auth.credential
|
|
2843
|
+
};
|
|
2844
|
+
return this.#connection.sendRequest(AUTH_METHODS.AUTH_REFRESH, params);
|
|
2845
|
+
}
|
|
2525
2846
|
/**
|
|
2526
2847
|
* Disconnect from the MAP system
|
|
2527
2848
|
* @param reason - Optional reason for disconnecting
|
|
@@ -2536,6 +2857,9 @@ var ClientConnection = class _ClientConnection {
|
|
|
2536
2857
|
reason ? { reason } : void 0
|
|
2537
2858
|
);
|
|
2538
2859
|
resumeToken = result.resumeToken;
|
|
2860
|
+
if (resumeToken) {
|
|
2861
|
+
this.#lastResumeToken = resumeToken;
|
|
2862
|
+
}
|
|
2539
2863
|
} finally {
|
|
2540
2864
|
for (const stream of this.#acpStreams.values()) {
|
|
2541
2865
|
await stream.close();
|
|
@@ -3229,6 +3553,66 @@ var AgentConnection = class _AgentConnection {
|
|
|
3229
3553
|
await agent.connect({ auth: options?.auth });
|
|
3230
3554
|
return agent;
|
|
3231
3555
|
}
|
|
3556
|
+
/**
|
|
3557
|
+
* Connect and register an agent via agentic-mesh transport.
|
|
3558
|
+
*
|
|
3559
|
+
* Handles:
|
|
3560
|
+
* - Dynamic import of agentic-mesh (optional peer dependency)
|
|
3561
|
+
* - Stream creation over encrypted mesh tunnel
|
|
3562
|
+
* - Auto-configuration of createStream for reconnection
|
|
3563
|
+
* - Initial MAP protocol connect handshake
|
|
3564
|
+
* - Agent registration
|
|
3565
|
+
*
|
|
3566
|
+
* Requires `agentic-mesh` to be installed as a peer dependency.
|
|
3567
|
+
*
|
|
3568
|
+
* @param options - Mesh connection and agent options
|
|
3569
|
+
* @returns Connected and registered AgentConnection instance
|
|
3570
|
+
*
|
|
3571
|
+
* @example
|
|
3572
|
+
* ```typescript
|
|
3573
|
+
* import { createNebulaTransport } from 'agentic-mesh';
|
|
3574
|
+
*
|
|
3575
|
+
* const transport = createNebulaTransport({
|
|
3576
|
+
* configPath: '/etc/nebula/config.yml',
|
|
3577
|
+
* });
|
|
3578
|
+
*
|
|
3579
|
+
* const agent = await AgentConnection.connectMesh({
|
|
3580
|
+
* transport,
|
|
3581
|
+
* peer: { peerId: 'server', address: '10.0.0.1', port: 4242 },
|
|
3582
|
+
* localPeerId: 'my-agent',
|
|
3583
|
+
* name: 'MeshWorker',
|
|
3584
|
+
* role: 'processor',
|
|
3585
|
+
* reconnection: true
|
|
3586
|
+
* });
|
|
3587
|
+
*
|
|
3588
|
+
* agent.onMessage(handleMessage);
|
|
3589
|
+
* await agent.busy();
|
|
3590
|
+
* ```
|
|
3591
|
+
*/
|
|
3592
|
+
static async connectMesh(options) {
|
|
3593
|
+
const { agenticMeshStream: agenticMeshStream2 } = await Promise.resolve().then(() => (init_agentic_mesh(), agentic_mesh_exports));
|
|
3594
|
+
const streamConfig = {
|
|
3595
|
+
transport: options.transport,
|
|
3596
|
+
peer: options.peer,
|
|
3597
|
+
localPeerId: options.localPeerId,
|
|
3598
|
+
timeout: options.timeout
|
|
3599
|
+
};
|
|
3600
|
+
const stream = await agenticMeshStream2(streamConfig);
|
|
3601
|
+
const createStream = async () => agenticMeshStream2(streamConfig);
|
|
3602
|
+
const reconnection = options.reconnection === true ? { enabled: true } : typeof options.reconnection === "object" ? options.reconnection : void 0;
|
|
3603
|
+
const agent = new _AgentConnection(stream, {
|
|
3604
|
+
name: options.name,
|
|
3605
|
+
role: options.role,
|
|
3606
|
+
capabilities: options.capabilities,
|
|
3607
|
+
visibility: options.visibility,
|
|
3608
|
+
parent: options.parent,
|
|
3609
|
+
scopes: options.scopes,
|
|
3610
|
+
createStream,
|
|
3611
|
+
reconnection
|
|
3612
|
+
});
|
|
3613
|
+
await agent.connect({ auth: options.auth });
|
|
3614
|
+
return agent;
|
|
3615
|
+
}
|
|
3232
3616
|
// ===========================================================================
|
|
3233
3617
|
// Connection Lifecycle
|
|
3234
3618
|
// ===========================================================================
|
|
@@ -3265,6 +3649,62 @@ var AgentConnection = class _AgentConnection {
|
|
|
3265
3649
|
this.#connection._transitionTo("connected");
|
|
3266
3650
|
return { connection: connectResult, agent: registerResult.agent };
|
|
3267
3651
|
}
|
|
3652
|
+
/**
|
|
3653
|
+
* Authenticate with the server after connection.
|
|
3654
|
+
*
|
|
3655
|
+
* Use this when the server returns `authRequired` in the connect response,
|
|
3656
|
+
* indicating that authentication is needed before registering or accessing
|
|
3657
|
+
* protected resources.
|
|
3658
|
+
*
|
|
3659
|
+
* @param auth - Authentication credentials
|
|
3660
|
+
* @returns Authentication result with principal if successful
|
|
3661
|
+
*
|
|
3662
|
+
* @example
|
|
3663
|
+
* ```typescript
|
|
3664
|
+
* const agent = new AgentConnection(stream, { name: 'MyAgent' });
|
|
3665
|
+
*
|
|
3666
|
+
* // First connect to get auth requirements
|
|
3667
|
+
* const connectResult = await agent.connectOnly();
|
|
3668
|
+
*
|
|
3669
|
+
* if (connectResult.authRequired) {
|
|
3670
|
+
* const authResult = await agent.authenticate({
|
|
3671
|
+
* method: 'api-key',
|
|
3672
|
+
* token: process.env.AGENT_API_KEY,
|
|
3673
|
+
* });
|
|
3674
|
+
*
|
|
3675
|
+
* if (authResult.success) {
|
|
3676
|
+
* // Now register the agent
|
|
3677
|
+
* await agent.register({ name: 'MyAgent', role: 'worker' });
|
|
3678
|
+
* }
|
|
3679
|
+
* }
|
|
3680
|
+
* ```
|
|
3681
|
+
*/
|
|
3682
|
+
async authenticate(auth) {
|
|
3683
|
+
const params = {
|
|
3684
|
+
method: auth.method,
|
|
3685
|
+
credential: auth.token
|
|
3686
|
+
};
|
|
3687
|
+
const result = await this.#connection.sendRequest(AUTH_METHODS.AUTHENTICATE, params);
|
|
3688
|
+
if (result.success && result.sessionId) {
|
|
3689
|
+
this.#sessionId = result.sessionId;
|
|
3690
|
+
}
|
|
3691
|
+
return result;
|
|
3692
|
+
}
|
|
3693
|
+
/**
|
|
3694
|
+
* Refresh authentication credentials.
|
|
3695
|
+
*
|
|
3696
|
+
* Use this to update credentials before they expire for long-lived connections.
|
|
3697
|
+
*
|
|
3698
|
+
* @param auth - New authentication credentials
|
|
3699
|
+
* @returns Updated principal information
|
|
3700
|
+
*/
|
|
3701
|
+
async refreshAuth(auth) {
|
|
3702
|
+
const params = {
|
|
3703
|
+
method: auth.method,
|
|
3704
|
+
credential: auth.token
|
|
3705
|
+
};
|
|
3706
|
+
return this.#connection.sendRequest(AUTH_METHODS.AUTH_REFRESH, params);
|
|
3707
|
+
}
|
|
3268
3708
|
/**
|
|
3269
3709
|
* Disconnect from the MAP system
|
|
3270
3710
|
* @param reason - Optional reason for disconnecting
|
|
@@ -4556,7 +4996,7 @@ var EventSchema = z.object({
|
|
|
4556
4996
|
var SubscriptionFilterSchema = z.object({
|
|
4557
4997
|
eventTypes: z.array(EventTypeSchema).optional(),
|
|
4558
4998
|
scopes: z.array(ScopeIdSchema).optional(),
|
|
4559
|
-
|
|
4999
|
+
fromAgents: z.array(AgentIdSchema).optional(),
|
|
4560
5000
|
includeChildren: z.boolean().optional(),
|
|
4561
5001
|
_meta: MetaSchema
|
|
4562
5002
|
}).strict();
|
|
@@ -5295,6 +5735,334 @@ function toAgent(agentId) {
|
|
|
5295
5735
|
function toScope(scopeId) {
|
|
5296
5736
|
return formatAddress("scope", scopeId);
|
|
5297
5737
|
}
|
|
5738
|
+
var MAPMeshPeer = class _MAPMeshPeer {
|
|
5739
|
+
#meshPeer;
|
|
5740
|
+
#config;
|
|
5741
|
+
#gitService;
|
|
5742
|
+
constructor(meshPeer, config) {
|
|
5743
|
+
this.#meshPeer = meshPeer;
|
|
5744
|
+
this.#config = config;
|
|
5745
|
+
this.#gitService = meshPeer.git ? new GitSyncServiceImpl(meshPeer.git, config.git?.repoPath ?? process.cwd()) : null;
|
|
5746
|
+
}
|
|
5747
|
+
// ===========================================================================
|
|
5748
|
+
// Static Factory
|
|
5749
|
+
// ===========================================================================
|
|
5750
|
+
/**
|
|
5751
|
+
* Create a new MAPMeshPeer.
|
|
5752
|
+
*
|
|
5753
|
+
* Requires `agentic-mesh` to be installed as a peer dependency.
|
|
5754
|
+
*
|
|
5755
|
+
* @param config - Peer configuration
|
|
5756
|
+
* @returns Promise resolving to the created peer (not yet started)
|
|
5757
|
+
*/
|
|
5758
|
+
static async create(config) {
|
|
5759
|
+
const meshPeer = createMeshPeer({
|
|
5760
|
+
peerId: config.peerId,
|
|
5761
|
+
peerName: config.peerName,
|
|
5762
|
+
transport: config.transport,
|
|
5763
|
+
git: config.git,
|
|
5764
|
+
peers: config.peers,
|
|
5765
|
+
map: config.map
|
|
5766
|
+
});
|
|
5767
|
+
return new _MAPMeshPeer(meshPeer, config);
|
|
5768
|
+
}
|
|
5769
|
+
// ===========================================================================
|
|
5770
|
+
// Properties
|
|
5771
|
+
// ===========================================================================
|
|
5772
|
+
/** Unique peer identifier */
|
|
5773
|
+
get peerId() {
|
|
5774
|
+
return this.#meshPeer.peerId;
|
|
5775
|
+
}
|
|
5776
|
+
/** Display name for this peer */
|
|
5777
|
+
get peerName() {
|
|
5778
|
+
return this.#meshPeer.peerName;
|
|
5779
|
+
}
|
|
5780
|
+
/** Whether the peer is currently running */
|
|
5781
|
+
get isRunning() {
|
|
5782
|
+
return this.#meshPeer.isRunning;
|
|
5783
|
+
}
|
|
5784
|
+
/** List of connected peer IDs */
|
|
5785
|
+
get connectedPeers() {
|
|
5786
|
+
return this.#meshPeer.connectedPeers;
|
|
5787
|
+
}
|
|
5788
|
+
/** Git sync service (null if git not enabled) */
|
|
5789
|
+
get git() {
|
|
5790
|
+
return this.#gitService;
|
|
5791
|
+
}
|
|
5792
|
+
// ===========================================================================
|
|
5793
|
+
// Lifecycle
|
|
5794
|
+
// ===========================================================================
|
|
5795
|
+
/**
|
|
5796
|
+
* Start the mesh peer.
|
|
5797
|
+
*
|
|
5798
|
+
* This starts the transport, MAP server, and git service (if enabled),
|
|
5799
|
+
* then connects to any initial peers specified in the config.
|
|
5800
|
+
*/
|
|
5801
|
+
async start() {
|
|
5802
|
+
await this.#meshPeer.start(this.#config.transport);
|
|
5803
|
+
}
|
|
5804
|
+
/**
|
|
5805
|
+
* Stop the mesh peer.
|
|
5806
|
+
*
|
|
5807
|
+
* This disconnects from all peers, unregisters all agents,
|
|
5808
|
+
* stops the git service, MAP server, and transport.
|
|
5809
|
+
*/
|
|
5810
|
+
async stop() {
|
|
5811
|
+
await this.#meshPeer.stop();
|
|
5812
|
+
}
|
|
5813
|
+
// ===========================================================================
|
|
5814
|
+
// Peer Connections
|
|
5815
|
+
// ===========================================================================
|
|
5816
|
+
/**
|
|
5817
|
+
* Connect to a remote peer.
|
|
5818
|
+
*
|
|
5819
|
+
* After connecting, agents on both peers will be discoverable
|
|
5820
|
+
* and messages can be routed between them.
|
|
5821
|
+
*
|
|
5822
|
+
* @param endpoint - Peer endpoint to connect to
|
|
5823
|
+
*/
|
|
5824
|
+
async connectToPeer(endpoint) {
|
|
5825
|
+
await this.#meshPeer.connectToPeer(endpoint);
|
|
5826
|
+
}
|
|
5827
|
+
/**
|
|
5828
|
+
* Disconnect from a peer.
|
|
5829
|
+
*
|
|
5830
|
+
* @param peerId - ID of peer to disconnect from
|
|
5831
|
+
* @param reason - Optional reason for disconnecting
|
|
5832
|
+
*/
|
|
5833
|
+
async disconnectFromPeer(peerId, reason) {
|
|
5834
|
+
await this.#meshPeer.disconnectFromPeer(peerId, reason);
|
|
5835
|
+
}
|
|
5836
|
+
/**
|
|
5837
|
+
* Check if connected to a specific peer.
|
|
5838
|
+
*
|
|
5839
|
+
* @param peerId - Peer ID to check
|
|
5840
|
+
* @returns true if connected
|
|
5841
|
+
*/
|
|
5842
|
+
isConnectedTo(peerId) {
|
|
5843
|
+
return this.connectedPeers.includes(peerId);
|
|
5844
|
+
}
|
|
5845
|
+
// ===========================================================================
|
|
5846
|
+
// Agent Management
|
|
5847
|
+
// ===========================================================================
|
|
5848
|
+
/**
|
|
5849
|
+
* Create and register a local agent on this peer's MapServer.
|
|
5850
|
+
*
|
|
5851
|
+
* @param config - Agent configuration
|
|
5852
|
+
* @returns The created agent
|
|
5853
|
+
*/
|
|
5854
|
+
async createAgent(config) {
|
|
5855
|
+
const agentConn = await this.#meshPeer.createAgent(config);
|
|
5856
|
+
return new LocalAgentImpl(agentConn);
|
|
5857
|
+
}
|
|
5858
|
+
/**
|
|
5859
|
+
* Get a local agent by ID.
|
|
5860
|
+
*
|
|
5861
|
+
* @param agentId - Agent ID to look up
|
|
5862
|
+
* @returns The agent, or undefined if not found
|
|
5863
|
+
*/
|
|
5864
|
+
getAgent(agentId) {
|
|
5865
|
+
const conn = this.#meshPeer.getAgentConnection(agentId);
|
|
5866
|
+
return conn ? new LocalAgentImpl(conn) : void 0;
|
|
5867
|
+
}
|
|
5868
|
+
/**
|
|
5869
|
+
* Get all local agents on this peer.
|
|
5870
|
+
*/
|
|
5871
|
+
getLocalAgents() {
|
|
5872
|
+
return this.#meshPeer.getLocalAgents();
|
|
5873
|
+
}
|
|
5874
|
+
/**
|
|
5875
|
+
* Get all known agents (local and discovered from connected peers).
|
|
5876
|
+
*/
|
|
5877
|
+
getAllAgents() {
|
|
5878
|
+
return this.#meshPeer.getAllAgents();
|
|
5879
|
+
}
|
|
5880
|
+
// ===========================================================================
|
|
5881
|
+
// Scope Management
|
|
5882
|
+
// ===========================================================================
|
|
5883
|
+
/**
|
|
5884
|
+
* Create a scope on this peer's MapServer.
|
|
5885
|
+
*
|
|
5886
|
+
* @param config - Scope configuration
|
|
5887
|
+
* @returns The created scope
|
|
5888
|
+
*/
|
|
5889
|
+
createScope(config) {
|
|
5890
|
+
return this.#meshPeer.createScope(config);
|
|
5891
|
+
}
|
|
5892
|
+
/**
|
|
5893
|
+
* Get a scope by ID.
|
|
5894
|
+
*
|
|
5895
|
+
* @param scopeId - Scope ID to look up
|
|
5896
|
+
* @returns The scope, or undefined if not found
|
|
5897
|
+
*/
|
|
5898
|
+
getScope(scopeId) {
|
|
5899
|
+
return this.#meshPeer.getScope(scopeId);
|
|
5900
|
+
}
|
|
5901
|
+
/**
|
|
5902
|
+
* List all scopes on this peer.
|
|
5903
|
+
*/
|
|
5904
|
+
listScopes() {
|
|
5905
|
+
return this.#meshPeer.listScopes();
|
|
5906
|
+
}
|
|
5907
|
+
// ===========================================================================
|
|
5908
|
+
// Messaging
|
|
5909
|
+
// ===========================================================================
|
|
5910
|
+
/**
|
|
5911
|
+
* Send a message from an agent to an address.
|
|
5912
|
+
*
|
|
5913
|
+
* Messages are routed to local agents or forwarded to connected peers.
|
|
5914
|
+
*
|
|
5915
|
+
* @param from - Sending agent ID
|
|
5916
|
+
* @param to - Destination address
|
|
5917
|
+
* @param payload - Message payload
|
|
5918
|
+
* @param meta - Optional message metadata
|
|
5919
|
+
* @returns Send result with delivery status
|
|
5920
|
+
*/
|
|
5921
|
+
async send(from, to, payload, meta) {
|
|
5922
|
+
return this.#meshPeer.send(from, to, payload, meta);
|
|
5923
|
+
}
|
|
5924
|
+
// ===========================================================================
|
|
5925
|
+
// Events
|
|
5926
|
+
// ===========================================================================
|
|
5927
|
+
/**
|
|
5928
|
+
* Subscribe to events from this peer's MapServer.
|
|
5929
|
+
*
|
|
5930
|
+
* @param filter - Optional filter for event types
|
|
5931
|
+
* @returns Event subscription
|
|
5932
|
+
*/
|
|
5933
|
+
subscribe(filter) {
|
|
5934
|
+
return this.#meshPeer.subscribe(this.peerId, filter);
|
|
5935
|
+
}
|
|
5936
|
+
/**
|
|
5937
|
+
* Register a handler for peer connection events.
|
|
5938
|
+
*
|
|
5939
|
+
* @param handler - Function called when a peer connects
|
|
5940
|
+
* @returns Unsubscribe function
|
|
5941
|
+
*/
|
|
5942
|
+
onPeerConnected(handler) {
|
|
5943
|
+
this.#meshPeer.on("peer:connected", handler);
|
|
5944
|
+
return () => this.#meshPeer.off("peer:connected", handler);
|
|
5945
|
+
}
|
|
5946
|
+
/**
|
|
5947
|
+
* Register a handler for peer disconnection events.
|
|
5948
|
+
*
|
|
5949
|
+
* @param handler - Function called when a peer disconnects
|
|
5950
|
+
* @returns Unsubscribe function
|
|
5951
|
+
*/
|
|
5952
|
+
onPeerDisconnected(handler) {
|
|
5953
|
+
this.#meshPeer.on("peer:disconnected", handler);
|
|
5954
|
+
return () => this.#meshPeer.off("peer:disconnected", handler);
|
|
5955
|
+
}
|
|
5956
|
+
/**
|
|
5957
|
+
* Register a handler for agent registration events.
|
|
5958
|
+
*
|
|
5959
|
+
* @param handler - Function called when an agent registers
|
|
5960
|
+
* @returns Unsubscribe function
|
|
5961
|
+
*/
|
|
5962
|
+
onAgentRegistered(handler) {
|
|
5963
|
+
this.#meshPeer.on("agent:registered", handler);
|
|
5964
|
+
return () => this.#meshPeer.off("agent:registered", handler);
|
|
5965
|
+
}
|
|
5966
|
+
/**
|
|
5967
|
+
* Register a handler for agent unregistration events.
|
|
5968
|
+
*
|
|
5969
|
+
* @param handler - Function called when an agent unregisters
|
|
5970
|
+
* @returns Unsubscribe function
|
|
5971
|
+
*/
|
|
5972
|
+
onAgentUnregistered(handler) {
|
|
5973
|
+
this.#meshPeer.on("agent:unregistered", handler);
|
|
5974
|
+
return () => this.#meshPeer.off("agent:unregistered", handler);
|
|
5975
|
+
}
|
|
5976
|
+
/**
|
|
5977
|
+
* Register a handler for error events.
|
|
5978
|
+
*
|
|
5979
|
+
* @param handler - Function called when an error occurs
|
|
5980
|
+
* @returns Unsubscribe function
|
|
5981
|
+
*/
|
|
5982
|
+
onError(handler) {
|
|
5983
|
+
this.#meshPeer.on("error", handler);
|
|
5984
|
+
return () => this.#meshPeer.off("error", handler);
|
|
5985
|
+
}
|
|
5986
|
+
};
|
|
5987
|
+
var LocalAgentImpl = class {
|
|
5988
|
+
#conn;
|
|
5989
|
+
constructor(conn) {
|
|
5990
|
+
this.#conn = conn;
|
|
5991
|
+
}
|
|
5992
|
+
get agentId() {
|
|
5993
|
+
return this.#conn.agentId;
|
|
5994
|
+
}
|
|
5995
|
+
get name() {
|
|
5996
|
+
return this.#conn.name;
|
|
5997
|
+
}
|
|
5998
|
+
get role() {
|
|
5999
|
+
return this.#conn.role;
|
|
6000
|
+
}
|
|
6001
|
+
get state() {
|
|
6002
|
+
return this.#conn.state;
|
|
6003
|
+
}
|
|
6004
|
+
async busy() {
|
|
6005
|
+
await this.#conn.updateState("busy");
|
|
6006
|
+
}
|
|
6007
|
+
async idle() {
|
|
6008
|
+
await this.#conn.updateState("idle");
|
|
6009
|
+
}
|
|
6010
|
+
async updateState(state) {
|
|
6011
|
+
await this.#conn.updateState(state);
|
|
6012
|
+
}
|
|
6013
|
+
async updateMetadata(metadata) {
|
|
6014
|
+
await this.#conn.updateMetadata(metadata);
|
|
6015
|
+
}
|
|
6016
|
+
async send(to, payload, meta) {
|
|
6017
|
+
return this.#conn.send(to, payload, meta);
|
|
6018
|
+
}
|
|
6019
|
+
onMessage(handler) {
|
|
6020
|
+
const wrappedHandler = (message) => handler(message);
|
|
6021
|
+
this.#conn.on("message", wrappedHandler);
|
|
6022
|
+
return () => {
|
|
6023
|
+
this.#conn.off("message", wrappedHandler);
|
|
6024
|
+
};
|
|
6025
|
+
}
|
|
6026
|
+
async unregister(reason) {
|
|
6027
|
+
await this.#conn.unregister(reason);
|
|
6028
|
+
}
|
|
6029
|
+
};
|
|
6030
|
+
var GitSyncServiceImpl = class {
|
|
6031
|
+
#service;
|
|
6032
|
+
#defaultRepoPath;
|
|
6033
|
+
#defaultClient = null;
|
|
6034
|
+
constructor(service, defaultRepoPath) {
|
|
6035
|
+
this.#service = service;
|
|
6036
|
+
this.#defaultRepoPath = defaultRepoPath;
|
|
6037
|
+
}
|
|
6038
|
+
get isRunning() {
|
|
6039
|
+
return true;
|
|
6040
|
+
}
|
|
6041
|
+
get httpPort() {
|
|
6042
|
+
return this.#service.httpPort;
|
|
6043
|
+
}
|
|
6044
|
+
createSyncClient(repoPath) {
|
|
6045
|
+
return this.#service.createSyncClient(repoPath);
|
|
6046
|
+
}
|
|
6047
|
+
#getDefaultClient() {
|
|
6048
|
+
if (!this.#defaultClient) {
|
|
6049
|
+
this.#defaultClient = this.#service.createSyncClient(this.#defaultRepoPath);
|
|
6050
|
+
}
|
|
6051
|
+
return this.#defaultClient;
|
|
6052
|
+
}
|
|
6053
|
+
async sync(peerId, options) {
|
|
6054
|
+
return this.#getDefaultClient().sync(peerId, options);
|
|
6055
|
+
}
|
|
6056
|
+
async pull(peerId, branch, options) {
|
|
6057
|
+
return this.#getDefaultClient().pull(peerId, branch, options);
|
|
6058
|
+
}
|
|
6059
|
+
async push(peerId, branch, options) {
|
|
6060
|
+
return this.#getDefaultClient().push(peerId, branch, options);
|
|
6061
|
+
}
|
|
6062
|
+
async clone(peerId, destPath, options) {
|
|
6063
|
+
return this.#getDefaultClient().clone(peerId, destPath, options);
|
|
6064
|
+
}
|
|
6065
|
+
};
|
|
5298
6066
|
|
|
5299
6067
|
// src/acp/adapter.ts
|
|
5300
6068
|
var ACPAgentAdapter = class {
|
|
@@ -5630,6 +6398,6 @@ var ACPAgentAdapter = class {
|
|
|
5630
6398
|
}
|
|
5631
6399
|
};
|
|
5632
6400
|
|
|
5633
|
-
export { ACPAgentAdapter, ACPError, ACPStreamConnection, ACP_ERROR_CODES, ACP_METHODS, ACP_PROTOCOL_VERSION, AGENT_ERROR_CODES, AUTH_ERROR_CODES, AUTH_METHODS, AddressSchema, AgentConnection, AgentIdSchema, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, AgentVisibilitySchema, BaseConnection, BroadcastAddressSchema, CAPABILITY_REQUIREMENTS, CORE_METHODS, CausalEventBuffer, ClientConnection, CorrelationIdSchema, DEFAULT_AGENT_PERMISSION_CONFIG, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, ERROR_CODES, EVENT_TYPES, EXTENSION_METHODS, ErrorCategorySchema, EventSchema, EventTypeSchema, FEDERATION_ERROR_CODES, FEDERATION_METHODS, FederatedAddressSchema, FederationOutageBuffer, GatewayConnection, HierarchicalAddressSchema, InvalidAddressError, JSONRPC_VERSION, JsonRpcVersionSchema, LIFECYCLE_METHODS, MAPConnectionError, MAPErrorDataSchema, MAPErrorSchema, MAPNotificationSchema, MAPRequestError, MAPRequestSchema, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, MAPTimeoutError, MAP_METHODS, METHOD_REGISTRY, MessageIdSchema, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, MessageVisibilitySchema, MetaSchema, MultiAddressSchema, NOTIFICATION_METHODS, OBSERVATION_METHODS, PERMISSION_METHODS, PROTOCOL_ERROR_CODES, PROTOCOL_VERSION, ParticipantAddressSchema, ParticipantCapabilitiesSchema, ParticipantIdSchema, ParticipantTypeSchema, ProtocolVersionSchema, RESOURCE_ERROR_CODES, ROUTING_ERROR_CODES, RequestIdSchema, RoleAddressSchema, SCOPE_METHODS, SESSION_METHODS, STATE_METHODS, STEERING_METHODS, STRUCTURE_METHODS, ScopeAddressSchema, ScopeIdSchema, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, ScopeVisibilitySchema, SessionIdSchema, Subscription, SubscriptionFilterSchema, SubscriptionIdSchema, SystemAddressSchema, TimestampSchema, TransportTypeSchema, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, canAgentAcceptMessage, canAgentMessageAgent, canAgentSeeAgent, canControlAgent, canJoinScope, canMessageAgent, canPerformAction, canPerformMethod, canSeeAgent, canSeeScope, canSendToScope, compareUlid, createACPStream, createErrorResponse, createEvent, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createStreamPair, createSubscription, createSuccessResponse, deepMergePermissions, extractId, extractType, filterVisibleAgents, filterVisibleEvents, filterVisibleScopes, formatAddress, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasCapability, hasRequiredCapabilities, isACPEnvelope, isACPErrorResponse, isACPNotification, isACPRequest, isACPResponse, isACPSuccessResponse, isAddress, isAgentAddress, isAgentExposed, isBroadcastAddress, isDirectAddress, isEnvelopeAtDestination, isErrorResponse, isEventTypeExposed, isFederatedAddress, isHierarchicalAddress, isNotification, isOrphanedAgent, isRequest, isResponse, isScopeAddress, isScopeExposed, isSuccessResponse, isValidEnvelope, isValidUlid, mapVisibilityToRule, ndJsonStream, parseAddress, processFederationEnvelope, resolveAgentPermissions, retryable, sleep, sortCausalOrder, toAgent, toScope, ulidTimestamp, unwrapEnvelope, validateCausalOrder, waitForOpen, websocketStream, withPayload, withRetry };
|
|
6401
|
+
export { ACPAgentAdapter, ACPError, ACPStreamConnection, ACP_ERROR_CODES, ACP_METHODS, ACP_PROTOCOL_VERSION, AGENT_ERROR_CODES, AUTH_ERROR_CODES, AUTH_METHODS, AddressSchema, AgentConnection, AgentIdSchema, AgentLifecycleSchema, AgentRelationshipSchema, AgentSchema, AgentStateSchema, AgentVisibilitySchema, BaseConnection, BroadcastAddressSchema, CAPABILITY_REQUIREMENTS, CORE_METHODS, CausalEventBuffer, ClientConnection, CorrelationIdSchema, DEFAULT_AGENT_PERMISSION_CONFIG, DEFAULT_RETRY_POLICY, DeliverySemanticsSchema, DirectAddressSchema, ERROR_CODES, EVENT_TYPES, EXTENSION_METHODS, ErrorCategorySchema, EventSchema, EventTypeSchema, FEDERATION_ERROR_CODES, FEDERATION_METHODS, FederatedAddressSchema, FederationOutageBuffer, GatewayConnection, HierarchicalAddressSchema, InvalidAddressError, JSONRPC_VERSION, JsonRpcVersionSchema, LIFECYCLE_METHODS, MAPConnectionError, MAPErrorDataSchema, MAPErrorSchema, MAPMeshPeer, MAPNotificationSchema, MAPRequestError, MAPRequestSchema, MAPResponseErrorSchema, MAPResponseSchema, MAPResponseSuccessSchema, MAPTimeoutError, MAP_METHODS, METHOD_REGISTRY, MessageIdSchema, MessageMetaSchema, MessagePrioritySchema, MessageRelationshipSchema, MessageSchema, MessageVisibilitySchema, MetaSchema, MultiAddressSchema, NOTIFICATION_METHODS, OBSERVATION_METHODS, PERMISSION_METHODS, PROTOCOL_ERROR_CODES, PROTOCOL_VERSION, ParticipantAddressSchema, ParticipantCapabilitiesSchema, ParticipantIdSchema, ParticipantTypeSchema, ProtocolVersionSchema, RESOURCE_ERROR_CODES, ROUTING_ERROR_CODES, RequestIdSchema, RoleAddressSchema, SCOPE_METHODS, SESSION_METHODS, STATE_METHODS, STEERING_METHODS, STRUCTURE_METHODS, ScopeAddressSchema, ScopeIdSchema, ScopeJoinPolicySchema, ScopeSchema, ScopeSendPolicySchema, ScopeVisibilitySchema, SessionIdSchema, Subscription, SubscriptionFilterSchema, SubscriptionIdSchema, SystemAddressSchema, TimestampSchema, TransportTypeSchema, agenticMeshStream, buildAgentsGetResponse, buildAgentsListResponse, buildAgentsRegisterResponse, buildAgentsSpawnResponse, buildAgentsUnregisterResponse, buildAgentsUpdateResponse, buildConnectResponse, buildDisconnectResponse, buildScopesCreateResponse, buildScopesJoinResponse, buildScopesLeaveResponse, buildScopesListResponse, buildSendResponse, buildSubscribeResponse, buildUnsubscribeResponse, calculateDelay, canAgentAcceptMessage, canAgentMessageAgent, canAgentSeeAgent, canControlAgent, canJoinScope, canMessageAgent, canPerformAction, canPerformMethod, canSeeAgent, canSeeScope, canSendToScope, compareUlid, createACPStream, createErrorResponse, createEvent, createFederationEnvelope, createNotification, createRequest, createRetryPolicy, createStreamPair, createSubscription, createSuccessResponse, deepMergePermissions, extractId, extractType, filterVisibleAgents, filterVisibleEvents, filterVisibleScopes, formatAddress, getEnvelopeRoutingInfo, getMethodInfo, getMethodsByCategory, getRequiredCapabilities, hasCapability, hasRequiredCapabilities, isACPEnvelope, isACPErrorResponse, isACPNotification, isACPRequest, isACPResponse, isACPSuccessResponse, isAddress, isAgentAddress, isAgentExposed, isBroadcastAddress, isDirectAddress, isEnvelopeAtDestination, isErrorResponse, isEventTypeExposed, isFederatedAddress, isHierarchicalAddress, isNotification, isOrphanedAgent, isRequest, isResponse, isScopeAddress, isScopeExposed, isSuccessResponse, isValidEnvelope, isValidUlid, mapVisibilityToRule, ndJsonStream, parseAddress, processFederationEnvelope, resolveAgentPermissions, retryable, sleep, sortCausalOrder, toAgent, toScope, ulidTimestamp, unwrapEnvelope, validateCausalOrder, waitForOpen, websocketStream, withPayload, withRetry };
|
|
5634
6402
|
//# sourceMappingURL=index.js.map
|
|
5635
6403
|
//# sourceMappingURL=index.js.map
|