agent-relay 2.0.24 → 2.0.26
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/dist/src/cli/index.js +100 -10
- package/package.json +16 -16
- package/packages/api-types/package.json +1 -1
- package/packages/bridge/package.json +8 -8
- package/packages/cli-tester/package.json +1 -1
- package/packages/config/package.json +2 -2
- package/packages/continuity/package.json +1 -1
- package/packages/daemon/dist/consensus-integration.d.ts +2 -1
- package/packages/daemon/dist/consensus.d.ts +1 -3
- package/packages/daemon/dist/enhanced-features.d.ts +2 -1
- package/packages/daemon/dist/orchestrator.js +4 -3
- package/packages/daemon/dist/server.js +48 -0
- package/packages/daemon/package.json +12 -12
- package/packages/hooks/dist/inbox-check/types.d.ts +6 -1
- package/packages/hooks/dist/inbox-check/utils.d.ts +3 -3
- package/packages/hooks/package.json +4 -4
- package/packages/mcp/dist/client.d.ts +57 -46
- package/packages/mcp/dist/client.js +107 -81
- package/packages/mcp/dist/server.js +61 -1
- package/packages/mcp/dist/tools/index.d.ts +5 -0
- package/packages/mcp/dist/tools/index.js +5 -0
- package/packages/mcp/dist/tools/relay-broadcast.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-broadcast.js +25 -0
- package/packages/mcp/dist/tools/relay-channel.d.ts +49 -0
- package/packages/mcp/dist/tools/relay-channel.js +76 -0
- package/packages/mcp/dist/tools/relay-consensus.d.ts +45 -0
- package/packages/mcp/dist/tools/relay-consensus.js +80 -0
- package/packages/mcp/dist/tools/relay-inbox.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-send.d.ts +2 -2
- package/packages/mcp/dist/tools/relay-shadow.d.ts +30 -0
- package/packages/mcp/dist/tools/relay-shadow.js +55 -0
- package/packages/mcp/dist/tools/relay-subscribe.d.ts +27 -0
- package/packages/mcp/dist/tools/relay-subscribe.js +49 -0
- package/packages/mcp/package.json +3 -2
- package/packages/memory/package.json +2 -2
- package/packages/policy/package.json +2 -2
- package/packages/protocol/dist/types.d.ts +130 -2
- package/packages/protocol/package.json +1 -1
- package/packages/resiliency/package.json +1 -1
- package/packages/sdk/dist/client.d.ts +21 -1
- package/packages/sdk/dist/client.js +26 -2
- package/packages/sdk/dist/index.d.ts +1 -1
- package/packages/sdk/dist/protocol/index.d.ts +4 -2
- package/packages/sdk/dist/protocol/index.js +4 -2
- package/packages/sdk/package.json +2 -2
- package/packages/spawner/package.json +1 -1
- package/packages/state/package.json +1 -1
- package/packages/storage/package.json +2 -2
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +1 -1
- package/packages/wrapper/package.json +6 -6
- package/scripts/post-publish-verify/README.md +80 -0
- package/scripts/post-publish-verify/run-verify.sh +127 -0
- package/scripts/post-publish-verify/verify-install.sh +249 -0
- package/packages/sdk/dist/protocol/framing.d.ts +0 -80
- package/packages/sdk/dist/protocol/framing.js +0 -206
- package/packages/sdk/dist/protocol/types.d.ts +0 -560
- package/packages/sdk/dist/protocol/types.js +0 -8
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* relay_proposal / relay_vote - Consensus/voting operations
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// Create proposal
|
|
6
|
+
export const relayProposalSchema = z.object({
|
|
7
|
+
id: z.string().describe('Unique identifier for the proposal'),
|
|
8
|
+
description: z.string().describe('Description of what is being proposed'),
|
|
9
|
+
options: z.array(z.string()).describe('List of voting options'),
|
|
10
|
+
voting_method: z.enum(['majority', 'supermajority', 'unanimous', 'weighted', 'quorum']).optional()
|
|
11
|
+
.describe('Voting method (default: majority)'),
|
|
12
|
+
deadline: z.number().optional().describe('Optional deadline timestamp in milliseconds'),
|
|
13
|
+
});
|
|
14
|
+
export const relayProposalTool = {
|
|
15
|
+
name: 'relay_proposal',
|
|
16
|
+
description: 'Create a new proposal for agents to vote on. Use this to coordinate decisions among multiple agents.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
id: { type: 'string', description: 'Unique identifier for the proposal' },
|
|
21
|
+
description: { type: 'string', description: 'Description of what is being proposed' },
|
|
22
|
+
options: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
items: { type: 'string' },
|
|
25
|
+
description: 'List of voting options',
|
|
26
|
+
},
|
|
27
|
+
voting_method: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['majority', 'supermajority', 'unanimous', 'weighted', 'quorum'],
|
|
30
|
+
description: 'Voting method (default: majority)',
|
|
31
|
+
},
|
|
32
|
+
deadline: { type: 'number', description: 'Optional deadline timestamp in milliseconds' },
|
|
33
|
+
},
|
|
34
|
+
required: ['id', 'description', 'options'],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export async function handleRelayProposal(client, input) {
|
|
38
|
+
const result = await client.createProposal({
|
|
39
|
+
id: input.id,
|
|
40
|
+
description: input.description,
|
|
41
|
+
options: input.options,
|
|
42
|
+
votingMethod: input.voting_method,
|
|
43
|
+
deadline: input.deadline,
|
|
44
|
+
});
|
|
45
|
+
if (result.success) {
|
|
46
|
+
return `Proposal "${input.id}" created successfully. Options: ${input.options.join(', ')}`;
|
|
47
|
+
}
|
|
48
|
+
return `Failed to create proposal: ${result.error}`;
|
|
49
|
+
}
|
|
50
|
+
// Vote on proposal
|
|
51
|
+
export const relayVoteSchema = z.object({
|
|
52
|
+
proposal_id: z.string().describe('The ID of the proposal to vote on'),
|
|
53
|
+
vote: z.string().describe('Your vote (must be one of the proposal options, or "approve"/"reject"/"abstain")'),
|
|
54
|
+
reason: z.string().optional().describe('Optional reason for your vote'),
|
|
55
|
+
});
|
|
56
|
+
export const relayVoteTool = {
|
|
57
|
+
name: 'relay_vote',
|
|
58
|
+
description: 'Cast a vote on an existing proposal.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
proposal_id: { type: 'string', description: 'The ID of the proposal to vote on' },
|
|
63
|
+
vote: { type: 'string', description: 'Your vote (must be one of the proposal options, or "approve"/"reject"/"abstain")' },
|
|
64
|
+
reason: { type: 'string', description: 'Optional reason for your vote' },
|
|
65
|
+
},
|
|
66
|
+
required: ['proposal_id', 'vote'],
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export async function handleRelayVote(client, input) {
|
|
70
|
+
const result = await client.vote({
|
|
71
|
+
proposalId: input.proposal_id,
|
|
72
|
+
vote: input.vote,
|
|
73
|
+
reason: input.reason,
|
|
74
|
+
});
|
|
75
|
+
if (result.success) {
|
|
76
|
+
return `Vote "${input.vote}" cast on proposal "${input.proposal_id}"`;
|
|
77
|
+
}
|
|
78
|
+
return `Failed to vote: ${result.error}`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=relay-consensus.js.map
|
|
@@ -13,9 +13,9 @@ export declare const relayInboxSchema: z.ZodObject<{
|
|
|
13
13
|
channel?: string | undefined;
|
|
14
14
|
}, {
|
|
15
15
|
from?: string | undefined;
|
|
16
|
+
channel?: string | undefined;
|
|
16
17
|
limit?: number | undefined;
|
|
17
18
|
unread_only?: boolean | undefined;
|
|
18
|
-
channel?: string | undefined;
|
|
19
19
|
}>;
|
|
20
20
|
export type RelayInboxInput = z.infer<typeof relayInboxSchema>;
|
|
21
21
|
export declare const relayInboxTool: Tool;
|
|
@@ -8,14 +8,14 @@ export declare const relaySendSchema: z.ZodObject<{
|
|
|
8
8
|
await_response: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
9
9
|
timeout_ms: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
message: string;
|
|
12
11
|
to: string;
|
|
12
|
+
message: string;
|
|
13
13
|
await_response: boolean;
|
|
14
14
|
timeout_ms: number;
|
|
15
15
|
thread?: string | undefined;
|
|
16
16
|
}, {
|
|
17
|
-
message: string;
|
|
18
17
|
to: string;
|
|
18
|
+
message: string;
|
|
19
19
|
thread?: string | undefined;
|
|
20
20
|
await_response?: boolean | undefined;
|
|
21
21
|
timeout_ms?: number | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* relay_shadow_bind / relay_shadow_unbind - Shadow agent operations
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
import type { RelayClient } from '../client.js';
|
|
7
|
+
export declare const relayShadowBindSchema: z.ZodObject<{
|
|
8
|
+
primary_agent: z.ZodString;
|
|
9
|
+
speak_on: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
primary_agent: string;
|
|
12
|
+
speak_on?: string[] | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
primary_agent: string;
|
|
15
|
+
speak_on?: string[] | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type RelayShadowBindInput = z.infer<typeof relayShadowBindSchema>;
|
|
18
|
+
export declare const relayShadowBindTool: Tool;
|
|
19
|
+
export declare function handleRelayShadowBind(client: RelayClient, input: RelayShadowBindInput): Promise<string>;
|
|
20
|
+
export declare const relayShadowUnbindSchema: z.ZodObject<{
|
|
21
|
+
primary_agent: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
primary_agent: string;
|
|
24
|
+
}, {
|
|
25
|
+
primary_agent: string;
|
|
26
|
+
}>;
|
|
27
|
+
export type RelayShadowUnbindInput = z.infer<typeof relayShadowUnbindSchema>;
|
|
28
|
+
export declare const relayShadowUnbindTool: Tool;
|
|
29
|
+
export declare function handleRelayShadowUnbind(client: RelayClient, input: RelayShadowUnbindInput): Promise<string>;
|
|
30
|
+
//# sourceMappingURL=relay-shadow.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* relay_shadow_bind / relay_shadow_unbind - Shadow agent operations
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// Bind as shadow
|
|
6
|
+
export const relayShadowBindSchema = z.object({
|
|
7
|
+
primary_agent: z.string().describe('The name of the primary agent to shadow'),
|
|
8
|
+
speak_on: z.array(z.string()).optional().describe('Events that trigger the shadow to speak (e.g., ["SESSION_END", "CODE_WRITTEN"])'),
|
|
9
|
+
});
|
|
10
|
+
export const relayShadowBindTool = {
|
|
11
|
+
name: 'relay_shadow_bind',
|
|
12
|
+
description: 'Bind as a shadow agent to monitor another agent. Shadows can observe and optionally respond to specific events.',
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
primary_agent: { type: 'string', description: 'The name of the primary agent to shadow' },
|
|
17
|
+
speak_on: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: { type: 'string' },
|
|
20
|
+
description: 'Events that trigger the shadow to speak (e.g., ["SESSION_END", "CODE_WRITTEN", "REVIEW_REQUEST"])',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['primary_agent'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export async function handleRelayShadowBind(client, input) {
|
|
27
|
+
const result = await client.bindAsShadow(input.primary_agent, { speakOn: input.speak_on });
|
|
28
|
+
if (result.success) {
|
|
29
|
+
return `Now shadowing agent "${input.primary_agent}"`;
|
|
30
|
+
}
|
|
31
|
+
return `Failed to bind as shadow: ${result.error}`;
|
|
32
|
+
}
|
|
33
|
+
// Unbind from shadow
|
|
34
|
+
export const relayShadowUnbindSchema = z.object({
|
|
35
|
+
primary_agent: z.string().describe('The name of the primary agent to stop shadowing'),
|
|
36
|
+
});
|
|
37
|
+
export const relayShadowUnbindTool = {
|
|
38
|
+
name: 'relay_shadow_unbind',
|
|
39
|
+
description: 'Stop shadowing an agent.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
primary_agent: { type: 'string', description: 'The name of the primary agent to stop shadowing' },
|
|
44
|
+
},
|
|
45
|
+
required: ['primary_agent'],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export async function handleRelayShadowUnbind(client, input) {
|
|
49
|
+
const result = await client.unbindAsShadow(input.primary_agent);
|
|
50
|
+
if (result.success) {
|
|
51
|
+
return `Stopped shadowing agent "${input.primary_agent}"`;
|
|
52
|
+
}
|
|
53
|
+
return `Failed to unbind from shadow: ${result.error}`;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=relay-shadow.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* relay_subscribe / relay_unsubscribe - Pub/Sub topic subscription
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
+
import type { RelayClient } from '../client.js';
|
|
7
|
+
export declare const relaySubscribeSchema: z.ZodObject<{
|
|
8
|
+
topic: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
topic: string;
|
|
11
|
+
}, {
|
|
12
|
+
topic: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type RelaySubscribeInput = z.infer<typeof relaySubscribeSchema>;
|
|
15
|
+
export declare const relaySubscribeTool: Tool;
|
|
16
|
+
export declare function handleRelaySubscribe(client: RelayClient, input: RelaySubscribeInput): Promise<string>;
|
|
17
|
+
export declare const relayUnsubscribeSchema: z.ZodObject<{
|
|
18
|
+
topic: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
topic: string;
|
|
21
|
+
}, {
|
|
22
|
+
topic: string;
|
|
23
|
+
}>;
|
|
24
|
+
export type RelayUnsubscribeInput = z.infer<typeof relayUnsubscribeSchema>;
|
|
25
|
+
export declare const relayUnsubscribeTool: Tool;
|
|
26
|
+
export declare function handleRelayUnsubscribe(client: RelayClient, input: RelayUnsubscribeInput): Promise<string>;
|
|
27
|
+
//# sourceMappingURL=relay-subscribe.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* relay_subscribe / relay_unsubscribe - Pub/Sub topic subscription
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
// Subscribe schema and tool
|
|
6
|
+
export const relaySubscribeSchema = z.object({
|
|
7
|
+
topic: z.string().describe('The topic to subscribe to'),
|
|
8
|
+
});
|
|
9
|
+
export const relaySubscribeTool = {
|
|
10
|
+
name: 'relay_subscribe',
|
|
11
|
+
description: 'Subscribe to a topic to receive messages published to that topic.',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
topic: { type: 'string', description: 'The topic to subscribe to' },
|
|
16
|
+
},
|
|
17
|
+
required: ['topic'],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export async function handleRelaySubscribe(client, input) {
|
|
21
|
+
const result = await client.subscribe(input.topic);
|
|
22
|
+
if (result.success) {
|
|
23
|
+
return `Subscribed to topic "${input.topic}"`;
|
|
24
|
+
}
|
|
25
|
+
return `Failed to subscribe: ${result.error}`;
|
|
26
|
+
}
|
|
27
|
+
// Unsubscribe schema and tool
|
|
28
|
+
export const relayUnsubscribeSchema = z.object({
|
|
29
|
+
topic: z.string().describe('The topic to unsubscribe from'),
|
|
30
|
+
});
|
|
31
|
+
export const relayUnsubscribeTool = {
|
|
32
|
+
name: 'relay_unsubscribe',
|
|
33
|
+
description: 'Unsubscribe from a topic to stop receiving messages from it.',
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
topic: { type: 'string', description: 'The topic to unsubscribe from' },
|
|
38
|
+
},
|
|
39
|
+
required: ['topic'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export async function handleRelayUnsubscribe(client, input) {
|
|
43
|
+
const result = await client.unsubscribe(input.topic);
|
|
44
|
+
if (result.success) {
|
|
45
|
+
return `Unsubscribed from topic "${input.topic}"`;
|
|
46
|
+
}
|
|
47
|
+
return `Failed to unsubscribe: ${result.error}`;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=relay-subscribe.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "MCP server for Agent Relay - native messaging tools for AI agents in Claude, Cursor, and VS Code",
|
|
5
5
|
"author": "Agent Workforce Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"prepublishOnly": "npm run clean && npm run build && npm test"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@agent-relay/config": "2.0.
|
|
50
|
+
"@agent-relay/config": "2.0.26",
|
|
51
|
+
"@agent-relay/protocol": "2.0.26",
|
|
51
52
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
52
53
|
"smol-toml": "^1.6.0",
|
|
53
54
|
"zod": "^3.23.8"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/memory",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "Semantic memory storage and retrieval system for agent-relay with multiple backend support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/hooks": "2.0.
|
|
25
|
+
"@agent-relay/hooks": "2.0.26"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/policy",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "Agent policy management with multi-level fallback (repo, local PRPM, cloud workspace)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/config": "2.0.
|
|
25
|
+
"@agent-relay/config": "2.0.26"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* These types define the wire protocol for agent-to-agent communication.
|
|
6
6
|
*/
|
|
7
7
|
export declare const PROTOCOL_VERSION = 1;
|
|
8
|
-
export type MessageType = 'HELLO' | 'WELCOME' | 'SEND' | 'DELIVER' | 'ACK' | 'NACK' | 'PING' | 'PONG' | 'ERROR' | 'BUSY' | 'RESUME' | 'BYE' | 'STATE' | 'SYNC' | 'SYNC_SNAPSHOT' | 'SYNC_DELTA' | 'SUBSCRIBE' | 'UNSUBSCRIBE' | 'SHADOW_BIND' | 'SHADOW_UNBIND' | 'LOG' | 'CHANNEL_JOIN' | 'CHANNEL_LEAVE' | 'CHANNEL_MESSAGE' | 'CHANNEL_INFO' | 'CHANNEL_MEMBERS' | 'CHANNEL_TYPING' | 'SPAWN' | 'SPAWN_RESULT' | 'RELEASE' | 'RELEASE_RESULT' | 'STATUS' | 'STATUS_RESPONSE' | 'INBOX' | 'INBOX_RESPONSE' | 'LIST_AGENTS' | 'LIST_AGENTS_RESPONSE' | 'LIST_CONNECTED_AGENTS' | 'LIST_CONNECTED_AGENTS_RESPONSE' | 'REMOVE_AGENT' | 'REMOVE_AGENT_RESPONSE' | 'HEALTH' | 'HEALTH_RESPONSE' | 'METRICS' | 'METRICS_RESPONSE';
|
|
8
|
+
export type MessageType = 'HELLO' | 'WELCOME' | 'SEND' | 'DELIVER' | 'ACK' | 'NACK' | 'PING' | 'PONG' | 'ERROR' | 'BUSY' | 'RESUME' | 'BYE' | 'STATE' | 'SYNC' | 'SYNC_SNAPSHOT' | 'SYNC_DELTA' | 'SUBSCRIBE' | 'UNSUBSCRIBE' | 'SHADOW_BIND' | 'SHADOW_UNBIND' | 'LOG' | 'CHANNEL_JOIN' | 'CHANNEL_LEAVE' | 'CHANNEL_MESSAGE' | 'CHANNEL_INFO' | 'CHANNEL_MEMBERS' | 'CHANNEL_TYPING' | 'SPAWN' | 'SPAWN_RESULT' | 'RELEASE' | 'RELEASE_RESULT' | 'STATUS' | 'STATUS_RESPONSE' | 'INBOX' | 'INBOX_RESPONSE' | 'LIST_AGENTS' | 'LIST_AGENTS_RESPONSE' | 'LIST_CONNECTED_AGENTS' | 'LIST_CONNECTED_AGENTS_RESPONSE' | 'REMOVE_AGENT' | 'REMOVE_AGENT_RESPONSE' | 'HEALTH' | 'HEALTH_RESPONSE' | 'METRICS' | 'METRICS_RESPONSE' | 'MESSAGES_QUERY' | 'MESSAGES_RESPONSE' | 'PROPOSAL_CREATE' | 'VOTE';
|
|
9
9
|
export type PayloadKind = 'message' | 'action' | 'state' | 'thinking';
|
|
10
10
|
/**
|
|
11
11
|
* Base envelope structure for all protocol messages.
|
|
@@ -158,7 +158,7 @@ export interface PingPayload {
|
|
|
158
158
|
export interface PongPayload {
|
|
159
159
|
nonce: string;
|
|
160
160
|
}
|
|
161
|
-
export type ErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'NOT_FOUND' | 'INTERNAL' | 'RESUME_TOO_OLD' | 'DUPLICATE_CONNECTION';
|
|
161
|
+
export type ErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'NOT_FOUND' | 'INTERNAL' | 'RESUME_TOO_OLD' | 'DUPLICATE_CONNECTION' | 'TIMEOUT';
|
|
162
162
|
export interface ErrorPayload {
|
|
163
163
|
/** Error code */
|
|
164
164
|
code: ErrorCode;
|
|
@@ -391,6 +391,43 @@ export interface InboxResponsePayload {
|
|
|
391
391
|
timestamp: number;
|
|
392
392
|
}>;
|
|
393
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Payload for MESSAGES_QUERY request.
|
|
396
|
+
* Used by dashboard to query all messages (not filtered by recipient).
|
|
397
|
+
*/
|
|
398
|
+
export interface MessagesQueryPayload {
|
|
399
|
+
/** Maximum number of messages to return */
|
|
400
|
+
limit?: number;
|
|
401
|
+
/** Only return messages after this timestamp (Unix ms) */
|
|
402
|
+
sinceTs?: number;
|
|
403
|
+
/** Filter by sender */
|
|
404
|
+
from?: string;
|
|
405
|
+
/** Filter by recipient */
|
|
406
|
+
to?: string;
|
|
407
|
+
/** Filter by thread ID */
|
|
408
|
+
thread?: string;
|
|
409
|
+
/** Sort order */
|
|
410
|
+
order?: 'asc' | 'desc';
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Payload for MESSAGES_RESPONSE.
|
|
414
|
+
*/
|
|
415
|
+
export interface MessagesResponsePayload {
|
|
416
|
+
/** Messages matching the query */
|
|
417
|
+
messages: Array<{
|
|
418
|
+
id: string;
|
|
419
|
+
from: string;
|
|
420
|
+
to: string;
|
|
421
|
+
body: string;
|
|
422
|
+
channel?: string;
|
|
423
|
+
thread?: string;
|
|
424
|
+
timestamp: number;
|
|
425
|
+
status?: string;
|
|
426
|
+
isBroadcast?: boolean;
|
|
427
|
+
replyCount?: number;
|
|
428
|
+
data?: Record<string, unknown>;
|
|
429
|
+
}>;
|
|
430
|
+
}
|
|
394
431
|
/**
|
|
395
432
|
* Payload for LIST_AGENTS request.
|
|
396
433
|
*/
|
|
@@ -457,6 +494,8 @@ export type StatusEnvelope = Envelope<StatusPayload>;
|
|
|
457
494
|
export type StatusResponseEnvelope = Envelope<StatusResponsePayload>;
|
|
458
495
|
export type InboxEnvelope = Envelope<InboxPayload>;
|
|
459
496
|
export type InboxResponseEnvelope = Envelope<InboxResponsePayload>;
|
|
497
|
+
export type MessagesQueryEnvelope = Envelope<MessagesQueryPayload>;
|
|
498
|
+
export type MessagesResponseEnvelope = Envelope<MessagesResponsePayload>;
|
|
460
499
|
export type ListAgentsEnvelope = Envelope<ListAgentsPayload>;
|
|
461
500
|
export type ListAgentsResponseEnvelope = Envelope<ListAgentsResponsePayload>;
|
|
462
501
|
export type ListConnectedAgentsEnvelope = Envelope<ListConnectedAgentsPayload>;
|
|
@@ -535,4 +574,93 @@ export type HealthEnvelope = Envelope<HealthPayload>;
|
|
|
535
574
|
export type HealthResponseEnvelope = Envelope<HealthResponsePayload>;
|
|
536
575
|
export type MetricsEnvelope = Envelope<MetricsPayload>;
|
|
537
576
|
export type MetricsResponseEnvelope = Envelope<MetricsResponsePayload>;
|
|
577
|
+
export type ConsensusType = 'majority' | 'supermajority' | 'unanimous' | 'weighted' | 'quorum';
|
|
578
|
+
export type VoteValue = 'approve' | 'reject' | 'abstain';
|
|
579
|
+
export type ProposalStatus = 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
|
|
580
|
+
/**
|
|
581
|
+
* Options for creating a consensus proposal.
|
|
582
|
+
*/
|
|
583
|
+
export interface CreateProposalOptions {
|
|
584
|
+
/** Proposal title */
|
|
585
|
+
title: string;
|
|
586
|
+
/** Detailed description */
|
|
587
|
+
description: string;
|
|
588
|
+
/** Agents allowed to vote */
|
|
589
|
+
participants: string[];
|
|
590
|
+
/** Consensus type (default: majority) */
|
|
591
|
+
consensusType?: ConsensusType;
|
|
592
|
+
/** Timeout in milliseconds (default: 5 minutes) */
|
|
593
|
+
timeoutMs?: number;
|
|
594
|
+
/** Minimum votes required (for quorum type) */
|
|
595
|
+
quorum?: number;
|
|
596
|
+
/** Threshold for supermajority (0-1, default 0.67) */
|
|
597
|
+
threshold?: number;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Options for voting on a proposal.
|
|
601
|
+
*/
|
|
602
|
+
export interface VoteOptions {
|
|
603
|
+
/** Proposal ID to vote on */
|
|
604
|
+
proposalId: string;
|
|
605
|
+
/** Vote value */
|
|
606
|
+
value: VoteValue;
|
|
607
|
+
/** Optional reason for the vote */
|
|
608
|
+
reason?: string;
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* A stored message in the inbox.
|
|
612
|
+
*/
|
|
613
|
+
export interface InboxMessage {
|
|
614
|
+
id: string;
|
|
615
|
+
from: string;
|
|
616
|
+
body: string;
|
|
617
|
+
channel?: string;
|
|
618
|
+
thread?: string;
|
|
619
|
+
timestamp: number;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Agent info returned by LIST_AGENTS.
|
|
623
|
+
*/
|
|
624
|
+
export interface AgentInfo {
|
|
625
|
+
name: string;
|
|
626
|
+
cli?: string;
|
|
627
|
+
idle?: boolean;
|
|
628
|
+
parent?: string;
|
|
629
|
+
task?: string;
|
|
630
|
+
connectedAt?: number;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* A crash record.
|
|
634
|
+
*/
|
|
635
|
+
export interface CrashRecord {
|
|
636
|
+
id: string;
|
|
637
|
+
agentName: string;
|
|
638
|
+
crashedAt: string;
|
|
639
|
+
likelyCause: string;
|
|
640
|
+
summary?: string;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* An alert record.
|
|
644
|
+
*/
|
|
645
|
+
export interface AlertRecord {
|
|
646
|
+
id: string;
|
|
647
|
+
agentName: string;
|
|
648
|
+
alertType: string;
|
|
649
|
+
message: string;
|
|
650
|
+
createdAt: string;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Metrics for a single agent.
|
|
654
|
+
*/
|
|
655
|
+
export interface AgentMetrics {
|
|
656
|
+
name: string;
|
|
657
|
+
pid?: number;
|
|
658
|
+
status: string;
|
|
659
|
+
rssBytes?: number;
|
|
660
|
+
cpuPercent?: number;
|
|
661
|
+
trend?: string;
|
|
662
|
+
alertLevel?: string;
|
|
663
|
+
highWatermark?: number;
|
|
664
|
+
uptimeMs?: number;
|
|
665
|
+
}
|
|
538
666
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Lightweight client for agent-to-agent communication via Agent Relay daemon.
|
|
6
6
|
*/
|
|
7
|
-
import { type Envelope, type SendPayload, type SendMeta, type AckPayload, type PayloadKind, type SpeakOnTrigger, type EntityType, type ChannelMessagePayload, type MessageAttachment, type SpawnResultPayload, type ReleaseResultPayload, type StatusResponsePayload, type InboxMessage, type AgentInfo, type RemoveAgentResponsePayload, type HealthResponsePayload, type MetricsResponsePayload, type CreateProposalOptions, type VoteOptions } from '
|
|
7
|
+
import { type Envelope, type SendPayload, type SendMeta, type AckPayload, type PayloadKind, type SpeakOnTrigger, type EntityType, type ChannelMessagePayload, type MessageAttachment, type SpawnResultPayload, type ReleaseResultPayload, type StatusResponsePayload, type InboxMessage, type MessagesResponsePayload, type AgentInfo, type RemoveAgentResponsePayload, type HealthResponsePayload, type MetricsResponsePayload, type CreateProposalOptions, type VoteOptions } from '@agent-relay/protocol';
|
|
8
8
|
export type ClientState = 'DISCONNECTED' | 'CONNECTING' | 'HANDSHAKING' | 'READY' | 'BACKOFF';
|
|
9
9
|
export interface SyncOptions {
|
|
10
10
|
timeoutMs?: number;
|
|
@@ -258,6 +258,26 @@ export declare class RelayClient {
|
|
|
258
258
|
from?: string;
|
|
259
259
|
channel?: string;
|
|
260
260
|
}): Promise<InboxMessage[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Query all messages (not filtered by recipient).
|
|
263
|
+
* Used by dashboard to get message history.
|
|
264
|
+
* @param options - Query options
|
|
265
|
+
* @param options.limit - Maximum number of messages to return (default: 100)
|
|
266
|
+
* @param options.sinceTs - Only return messages after this timestamp
|
|
267
|
+
* @param options.from - Filter by sender
|
|
268
|
+
* @param options.to - Filter by recipient
|
|
269
|
+
* @param options.thread - Filter by thread ID
|
|
270
|
+
* @param options.order - Sort order ('asc' or 'desc', default: 'desc')
|
|
271
|
+
* @returns Array of messages
|
|
272
|
+
*/
|
|
273
|
+
queryMessages(options?: {
|
|
274
|
+
limit?: number;
|
|
275
|
+
sinceTs?: number;
|
|
276
|
+
from?: string;
|
|
277
|
+
to?: string;
|
|
278
|
+
thread?: string;
|
|
279
|
+
order?: 'asc' | 'desc';
|
|
280
|
+
}): Promise<MessagesResponsePayload['messages']>;
|
|
261
281
|
/**
|
|
262
282
|
* List online agents.
|
|
263
283
|
* @param options - Filter options
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import net from 'node:net';
|
|
8
8
|
import { randomUUID } from 'node:crypto';
|
|
9
|
-
|
|
10
|
-
import { encodeFrameLegacy, FrameParser } from '
|
|
9
|
+
// Import shared protocol types and framing utilities from @agent-relay/protocol
|
|
10
|
+
import { PROTOCOL_VERSION, encodeFrameLegacy, FrameParser, } from '@agent-relay/protocol';
|
|
11
11
|
const DEFAULT_SOCKET_PATH = '/tmp/agent-relay.sock';
|
|
12
12
|
const DEFAULT_CLIENT_CONFIG = {
|
|
13
13
|
socketPath: DEFAULT_SOCKET_PATH,
|
|
@@ -690,6 +690,30 @@ export class RelayClient {
|
|
|
690
690
|
const response = await this.query('INBOX', payload);
|
|
691
691
|
return response.messages || [];
|
|
692
692
|
}
|
|
693
|
+
/**
|
|
694
|
+
* Query all messages (not filtered by recipient).
|
|
695
|
+
* Used by dashboard to get message history.
|
|
696
|
+
* @param options - Query options
|
|
697
|
+
* @param options.limit - Maximum number of messages to return (default: 100)
|
|
698
|
+
* @param options.sinceTs - Only return messages after this timestamp
|
|
699
|
+
* @param options.from - Filter by sender
|
|
700
|
+
* @param options.to - Filter by recipient
|
|
701
|
+
* @param options.thread - Filter by thread ID
|
|
702
|
+
* @param options.order - Sort order ('asc' or 'desc', default: 'desc')
|
|
703
|
+
* @returns Array of messages
|
|
704
|
+
*/
|
|
705
|
+
async queryMessages(options = {}) {
|
|
706
|
+
const payload = {
|
|
707
|
+
limit: options.limit,
|
|
708
|
+
sinceTs: options.sinceTs,
|
|
709
|
+
from: options.from,
|
|
710
|
+
to: options.to,
|
|
711
|
+
thread: options.thread,
|
|
712
|
+
order: options.order,
|
|
713
|
+
};
|
|
714
|
+
const response = await this.query('MESSAGES_QUERY', payload);
|
|
715
|
+
return response.messages || [];
|
|
716
|
+
}
|
|
693
717
|
/**
|
|
694
718
|
* List online agents.
|
|
695
719
|
* @param options - Filter options
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
export { RelayClient, type ClientState, type ClientConfig, type SyncOptions, } from './client.js';
|
|
29
29
|
export { createRelay, createPair, type Relay, type RelayConfig, } from './standalone.js';
|
|
30
|
-
export { PROTOCOL_VERSION, type MessageType, type PayloadKind, type Envelope, type EntityType, type SendPayload, type SendMeta, type SyncMeta, type DeliveryInfo, type AckPayload, type ErrorCode, type ErrorPayload, type SpeakOnTrigger, type ShadowConfig, type SpawnPayload, type SpawnResultPayload, type ReleasePayload, type ReleaseResultPayload, type ChannelMessagePayload, type ChannelJoinPayload, type ChannelLeavePayload, type MessageAttachment, type StatusResponsePayload, type InboxMessage, type AgentInfo, type HealthResponsePayload, type CrashRecord, type AlertRecord, type MetricsResponsePayload, type AgentMetrics, type ConsensusType, type VoteValue, type ProposalStatus, type CreateProposalOptions, type VoteOptions, } from './protocol/index.js';
|
|
30
|
+
export { PROTOCOL_VERSION, type MessageType, type PayloadKind, type Envelope, type EntityType, type SendPayload, type SendMeta, type SyncMeta, type DeliveryInfo, type AckPayload, type ErrorCode, type ErrorPayload, type SpeakOnTrigger, type ShadowConfig, type SpawnPayload, type SpawnResultPayload, type ReleasePayload, type ReleaseResultPayload, type ChannelMessagePayload, type ChannelJoinPayload, type ChannelLeavePayload, type MessageAttachment, type StatusResponsePayload, type InboxMessage, type MessagesResponsePayload, type AgentInfo, type HealthResponsePayload, type CrashRecord, type AlertRecord, type MetricsResponsePayload, type AgentMetrics, type ConsensusType, type VoteValue, type ProposalStatus, type CreateProposalOptions, type VoteOptions, } from './protocol/index.js';
|
|
31
31
|
export { encodeFrame, encodeFrameLegacy, FrameParser, MAX_FRAME_BYTES, } from './protocol/index.js';
|
|
32
32
|
export { getLogs, listLoggedAgents, type GetLogsOptions, type LogsResult, } from './logs.js';
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Protocol exports for @agent-relay/sdk
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from @agent-relay/protocol for backwards compatibility.
|
|
5
|
+
* New code should import directly from @agent-relay/protocol.
|
|
3
6
|
*/
|
|
4
|
-
export
|
|
5
|
-
export { MAX_FRAME_BYTES, HEADER_SIZE, LEGACY_HEADER_SIZE, type WireFormat, initMessagePack, hasMessagePack, encodeFrame, encodeFrameLegacy, FrameParser, } from './framing.js';
|
|
7
|
+
export * from '@agent-relay/protocol';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Protocol exports for @agent-relay/sdk
|
|
3
|
+
*
|
|
4
|
+
* Re-exports from @agent-relay/protocol for backwards compatibility.
|
|
5
|
+
* New code should import directly from @agent-relay/protocol.
|
|
3
6
|
*/
|
|
4
|
-
export
|
|
5
|
-
export { MAX_FRAME_BYTES, HEADER_SIZE, LEGACY_HEADER_SIZE, initMessagePack, hasMessagePack, encodeFrame, encodeFrameLegacy, FrameParser, } from './framing.js';
|
|
7
|
+
export * from '@agent-relay/protocol';
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "Lightweight SDK for agent-to-agent communication via Agent Relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@agent-relay/protocol": "2.0.
|
|
58
|
+
"@agent-relay/protocol": "2.0.26"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=18.0.0"
|