agent-relay 12.4.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/agent-relay-mcp.d.ts.map +1 -1
- package/dist/cli/agent-relay-mcp.js +58 -7
- package/dist/cli/agent-relay-mcp.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +6 -2
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/commands/core.d.ts +2 -0
- package/dist/cli/commands/core.d.ts.map +1 -1
- package/dist/cli/commands/core.js.map +1 -1
- package/dist/cli/commands/fleet.d.ts +2 -0
- package/dist/cli/commands/fleet.d.ts.map +1 -1
- package/dist/cli/commands/fleet.js +89 -28
- package/dist/cli/commands/fleet.js.map +1 -1
- package/dist/cli/commands/integration.d.ts +15 -0
- package/dist/cli/commands/integration.d.ts.map +1 -1
- package/dist/cli/commands/integration.js +149 -6
- package/dist/cli/commands/integration.js.map +1 -1
- package/dist/cli/commands/product-surfaces.d.ts.map +1 -1
- package/dist/cli/commands/product-surfaces.js +6 -1
- package/dist/cli/commands/product-surfaces.js.map +1 -1
- package/dist/cli/lib/attach-fleet-node.d.ts +37 -0
- package/dist/cli/lib/attach-fleet-node.d.ts.map +1 -1
- package/dist/cli/lib/attach-fleet-node.js +143 -13
- package/dist/cli/lib/attach-fleet-node.js.map +1 -1
- package/dist/cli/lib/broker-lifecycle.d.ts.map +1 -1
- package/dist/cli/lib/broker-lifecycle.js +15 -3
- package/dist/cli/lib/broker-lifecycle.js.map +1 -1
- package/dist/cli/lib/fleet-sidecar.d.ts +18 -6
- package/dist/cli/lib/fleet-sidecar.d.ts.map +1 -1
- package/dist/cli/lib/fleet-sidecar.js +25 -0
- package/dist/cli/lib/fleet-sidecar.js.map +1 -1
- package/dist/cli/lib/node-provider-child.d.ts +3 -2
- package/dist/cli/lib/node-provider-child.d.ts.map +1 -1
- package/dist/cli/lib/node-provider-child.js +25 -5
- package/dist/cli/lib/node-provider-child.js.map +1 -1
- package/dist/cli/lib/spawn-lifecycle.d.ts.map +1 -1
- package/dist/cli/lib/spawn-lifecycle.js +6 -3
- package/dist/cli/lib/spawn-lifecycle.js.map +1 -1
- package/dist/cli/mcp/shared-sessions-client.d.ts +86 -0
- package/dist/cli/mcp/shared-sessions-client.d.ts.map +1 -0
- package/dist/cli/mcp/shared-sessions-client.js +329 -0
- package/dist/cli/mcp/shared-sessions-client.js.map +1 -0
- package/dist/cli/mcp/types.d.ts +8 -0
- package/dist/cli/mcp/types.d.ts.map +1 -1
- package/dist/index.cjs +60 -36
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -303,7 +303,7 @@ __export(index_exports, {
|
|
|
303
303
|
module.exports = __toCommonJS(index_exports);
|
|
304
304
|
|
|
305
305
|
// ../../node_modules/@relaycast/sdk/dist/version.js
|
|
306
|
-
var SDK_VERSION = "8.
|
|
306
|
+
var SDK_VERSION = "8.14.0";
|
|
307
307
|
|
|
308
308
|
// ../../node_modules/zod/v4/classic/external.js
|
|
309
309
|
var external_exports = {};
|
|
@@ -20052,6 +20052,11 @@ var AgentStatusSchema = external_exports.enum(["online", "offline", "away"]);
|
|
|
20052
20052
|
var AgentSchema = external_exports.object({
|
|
20053
20053
|
id: external_exports.string(),
|
|
20054
20054
|
name: external_exports.string(),
|
|
20055
|
+
/**
|
|
20056
|
+
* `agent@machine` for `address` on POST /v1/dm; `machine` is `direct` for a
|
|
20057
|
+
* self-connected agent. Null when the agent is not hosted anywhere.
|
|
20058
|
+
*/
|
|
20059
|
+
address: external_exports.string().nullable().optional(),
|
|
20055
20060
|
type: AgentTypeSchema,
|
|
20056
20061
|
status: AgentStatusSchema,
|
|
20057
20062
|
persona: external_exports.string().nullable(),
|
|
@@ -20186,6 +20191,8 @@ var CoreMessagePayloadSchema = external_exports.object({
|
|
|
20186
20191
|
agent_id: external_exports.string(),
|
|
20187
20192
|
agent_name: external_exports.string(),
|
|
20188
20193
|
agent_type: AgentTypeSchema.optional(),
|
|
20194
|
+
/** Sender's `agent@machine` address at send time; present on direct messages. */
|
|
20195
|
+
agent_address: external_exports.string().optional(),
|
|
20189
20196
|
text: external_exports.string(),
|
|
20190
20197
|
injection_mode: MessageInjectionModeSchema.optional(),
|
|
20191
20198
|
attachments: external_exports.array(FileAttachmentSchema).optional(),
|
|
@@ -20531,6 +20538,8 @@ var DeliveryMessageSchema = external_exports.object({
|
|
|
20531
20538
|
channel_id: external_exports.string(),
|
|
20532
20539
|
agent_id: external_exports.string().nullable(),
|
|
20533
20540
|
agent_name: external_exports.string().nullable(),
|
|
20541
|
+
/** Sender's `agent@machine` at send time; present on direct messages. */
|
|
20542
|
+
agent_address: external_exports.string().optional(),
|
|
20534
20543
|
text: external_exports.string(),
|
|
20535
20544
|
thread_id: external_exports.string().nullable(),
|
|
20536
20545
|
created_at: external_exports.string()
|
|
@@ -20600,7 +20609,8 @@ var DmParticipantSchema = external_exports.object({
|
|
|
20600
20609
|
});
|
|
20601
20610
|
var DmInjectionModeSchema = MessageInjectionModeSchema;
|
|
20602
20611
|
var SendDmRequestSchema = external_exports.object({
|
|
20603
|
-
to: external_exports.string(),
|
|
20612
|
+
to: external_exports.string().optional(),
|
|
20613
|
+
address: external_exports.string().optional(),
|
|
20604
20614
|
text: external_exports.string(),
|
|
20605
20615
|
attachments: external_exports.array(external_exports.string()).optional(),
|
|
20606
20616
|
data: external_exports.record(external_exports.string(), external_exports.unknown()).nullable().optional(),
|
|
@@ -20686,6 +20696,7 @@ var ChannelMessagePayloadSchema = CoreMessagePayloadSchema.extend({
|
|
|
20686
20696
|
var MessageCreatedEventSchema = external_exports.object({
|
|
20687
20697
|
id: external_exports.string().uuid(),
|
|
20688
20698
|
type: external_exports.literal("message.created"),
|
|
20699
|
+
created_at: external_exports.string().optional(),
|
|
20689
20700
|
channel: external_exports.string(),
|
|
20690
20701
|
message: ChannelMessagePayloadSchema
|
|
20691
20702
|
});
|
|
@@ -21540,6 +21551,8 @@ var FleetActionInvokeMessageSchema = external_exports.object({
|
|
|
21540
21551
|
action: external_exports.string(),
|
|
21541
21552
|
agent_id: external_exports.string().optional(),
|
|
21542
21553
|
agent_name: external_exports.string().optional(),
|
|
21554
|
+
caller_id: external_exports.string().optional(),
|
|
21555
|
+
caller_name: external_exports.string().optional(),
|
|
21543
21556
|
input: FleetWireJsonValueSchema,
|
|
21544
21557
|
task_execution: FleetTaskExecutionSchema.optional()
|
|
21545
21558
|
}).strict();
|
|
@@ -22173,12 +22186,14 @@ var WsClient = class {
|
|
|
22173
22186
|
console.warn('[relaycast] Dropped node event: missing or invalid "type" field', transformed);
|
|
22174
22187
|
}
|
|
22175
22188
|
}
|
|
22189
|
+
/** Normalize a direct-node delivery into the public workspace event shape. */
|
|
22176
22190
|
transformServerLikeEvent(eventType, data) {
|
|
22177
22191
|
switch (eventType) {
|
|
22178
22192
|
case "message.created":
|
|
22179
22193
|
return {
|
|
22180
22194
|
id: stableRelaycastEventId(String(data.id ?? "")),
|
|
22181
22195
|
type: "message.created",
|
|
22196
|
+
...typeof data.created_at === "string" ? { created_at: data.created_at } : {},
|
|
22182
22197
|
channel: data.channel_name,
|
|
22183
22198
|
message: {
|
|
22184
22199
|
id: data.id,
|
|
@@ -22186,7 +22201,8 @@ var WsClient = class {
|
|
|
22186
22201
|
agent_name: data.from_name,
|
|
22187
22202
|
text: data.text,
|
|
22188
22203
|
attachments: Array.isArray(data.attachments) ? data.attachments : [],
|
|
22189
|
-
...typeof data.injection_mode === "string" ? { injection_mode: data.injection_mode } : {}
|
|
22204
|
+
...typeof data.injection_mode === "string" ? { injection_mode: data.injection_mode } : {},
|
|
22205
|
+
...isRecord(data.metadata) ? { metadata: data.metadata } : {}
|
|
22190
22206
|
}
|
|
22191
22207
|
};
|
|
22192
22208
|
case "thread.reply":
|
|
@@ -22742,6 +22758,17 @@ var AgentClient = class {
|
|
|
22742
22758
|
};
|
|
22743
22759
|
return this.client.post("/v1/dm", body, idempotencyHeaders(opts));
|
|
22744
22760
|
}
|
|
22761
|
+
/** DM an `agent@machine` address; fails if the agent is no longer on that machine. */
|
|
22762
|
+
async sendTo(address, text, opts) {
|
|
22763
|
+
const body = {
|
|
22764
|
+
address,
|
|
22765
|
+
text,
|
|
22766
|
+
...opts?.attachments ? { attachments: opts.attachments } : {},
|
|
22767
|
+
...opts?.data !== void 0 ? { data: opts.data } : {},
|
|
22768
|
+
mode: opts?.mode ?? "wait"
|
|
22769
|
+
};
|
|
22770
|
+
return this.client.post("/v1/dm", body, idempotencyHeaders(opts));
|
|
22771
|
+
}
|
|
22745
22772
|
dms = {
|
|
22746
22773
|
conversations: (opts) => {
|
|
22747
22774
|
const query = {};
|
|
@@ -25857,14 +25884,6 @@ function toRelayTrigger(raw) {
|
|
|
25857
25884
|
enabled: readBoolean(trigger, "enabled") ?? true
|
|
25858
25885
|
};
|
|
25859
25886
|
}
|
|
25860
|
-
function toRelayWorkspaceFleetNodesConfig(raw) {
|
|
25861
|
-
const record2 = asRecord(raw);
|
|
25862
|
-
return {
|
|
25863
|
-
enabled: readBoolean(record2, "enabled") ?? false,
|
|
25864
|
-
defaultEnabled: readBoolean(record2, "defaultEnabled", "default_enabled") ?? false,
|
|
25865
|
-
override: readBoolean(record2, "override") ?? null
|
|
25866
|
-
};
|
|
25867
|
-
}
|
|
25868
25887
|
function normalizeActionInvocationAck(raw) {
|
|
25869
25888
|
const record2 = asRecord(raw);
|
|
25870
25889
|
return {
|
|
@@ -26013,6 +26032,8 @@ function placementActionName(capability) {
|
|
|
26013
26032
|
function placementActionInput(input2, placement) {
|
|
26014
26033
|
const payload = { ...input2 ?? {} };
|
|
26015
26034
|
payload.capability = placement.capability;
|
|
26035
|
+
if (placement.verifyReady)
|
|
26036
|
+
payload.verify_ready = true;
|
|
26016
26037
|
if (placement.node) {
|
|
26017
26038
|
payload.node = placement.node;
|
|
26018
26039
|
payload.target_node = placement.node;
|
|
@@ -26044,9 +26065,21 @@ var DEFAULT_CONFIRM_POLL_MS = 500;
|
|
|
26044
26065
|
var MAX_CONFIRM_TIMEOUT_MS = 2147483647;
|
|
26045
26066
|
var CONFIRM_SUCCESS_STATUSES = /* @__PURE__ */ new Set(["completed", "succeeded", "success"]);
|
|
26046
26067
|
var CONFIRM_FAILURE_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "denied", "cancelled", "canceled"]);
|
|
26047
|
-
function
|
|
26068
|
+
function hasSpawnReadinessProof(value) {
|
|
26048
26069
|
return value.output?.spawned === true && value.output?.ready === true;
|
|
26049
26070
|
}
|
|
26071
|
+
function hasSpawnLaunchProof(value) {
|
|
26072
|
+
return value.output?.spawned === true && typeof value.output?.ready === "boolean";
|
|
26073
|
+
}
|
|
26074
|
+
function hasSpawnProof(value, requireReadiness) {
|
|
26075
|
+
return requireReadiness ? hasSpawnReadinessProof(value) : hasSpawnLaunchProof(value);
|
|
26076
|
+
}
|
|
26077
|
+
function spawnProofError(node2, status, action, output2, requireReadiness) {
|
|
26078
|
+
if (output2?.spawned === true && typeof output2.ready !== "boolean") {
|
|
26079
|
+
return requireReadiness ? `node '${node2}' handler did not honour verify_ready: missing explicit spawned:true and ready:true proof; upgrade to a release containing Relay PR #1708` : `node '${node2}' reported ${status} for ${action} without an explicit ready boolean; upgrade to a release containing Relay PR #1708`;
|
|
26080
|
+
}
|
|
26081
|
+
return `node '${node2}' reported ${status} for ${action} without explicit ${requireReadiness ? "spawned:true and ready:true" : "spawned:true and a ready boolean"} proof`;
|
|
26082
|
+
}
|
|
26050
26083
|
var READ_TIMED_OUT = /* @__PURE__ */ Symbol("relay.confirm.readTimedOut");
|
|
26051
26084
|
function confirmDurationMs(value, fallback, max) {
|
|
26052
26085
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.min(value, max) : fallback;
|
|
@@ -26450,7 +26483,10 @@ var RelaycastMessagingClient = class {
|
|
|
26450
26483
|
if (decision.node) {
|
|
26451
26484
|
const actionName = input2.actionName ?? placementActionName(capability);
|
|
26452
26485
|
const clientMustTarget = Boolean(targetNode || repo || sandboxOnly);
|
|
26486
|
+
const verifyReady = input2.verifyReady ?? (input2.confirm === true && capability.startsWith("spawn:") && capability !== "spawn:persona");
|
|
26487
|
+
const requireReadiness = verifyReady || capability === "spawn:persona";
|
|
26453
26488
|
const actionInput = placementActionInput(input2.input, {
|
|
26489
|
+
verifyReady,
|
|
26454
26490
|
capability,
|
|
26455
26491
|
...clientMustTarget ? { node: decision.node.name } : {},
|
|
26456
26492
|
repo,
|
|
@@ -26473,8 +26509,8 @@ var RelaycastMessagingClient = class {
|
|
|
26473
26509
|
});
|
|
26474
26510
|
}
|
|
26475
26511
|
const ackOutput = ack.output;
|
|
26476
|
-
if (!input2.confirm && capability.startsWith("spawn:") && ackStatus && CONFIRM_SUCCESS_STATUSES.has(ackStatus) && !
|
|
26477
|
-
throw new RelayPlacementError("spawn_failed",
|
|
26512
|
+
if (!input2.confirm && capability.startsWith("spawn:") && ackStatus && CONFIRM_SUCCESS_STATUSES.has(ackStatus) && !hasSpawnProof({ output: ackOutput }, requireReadiness)) {
|
|
26513
|
+
throw new RelayPlacementError("spawn_failed", spawnProofError(placedNodeLabel, ackStatus, actionName, ackOutput, requireReadiness), {
|
|
26478
26514
|
capability,
|
|
26479
26515
|
node: placedNodeLabel,
|
|
26480
26516
|
repo,
|
|
@@ -26490,6 +26526,9 @@ var RelaycastMessagingClient = class {
|
|
|
26490
26526
|
node: placedNodeLabel,
|
|
26491
26527
|
repo,
|
|
26492
26528
|
attempts,
|
|
26529
|
+
// The mode this request actually asked the broker for, so the
|
|
26530
|
+
// poll judges the same contract the invocation carried.
|
|
26531
|
+
requireReadiness,
|
|
26493
26532
|
// Defaults and validation live in confirmPlacementInvocation
|
|
26494
26533
|
// so a direct caller cannot bypass them.
|
|
26495
26534
|
timeoutMs: input2.confirmTimeoutMs,
|
|
@@ -26505,7 +26544,10 @@ var RelaycastMessagingClient = class {
|
|
|
26505
26544
|
attempts,
|
|
26506
26545
|
queued,
|
|
26507
26546
|
confirmed: Boolean(confirmation),
|
|
26508
|
-
|
|
26547
|
+
// `ready` means proven harness readiness. A confirmation that
|
|
26548
|
+
// only judged the launch contract (`verifyReady: false`) is
|
|
26549
|
+
// confirmed, not ready.
|
|
26550
|
+
state: confirmation && requireReadiness ? "ready" : "accepted"
|
|
26509
26551
|
},
|
|
26510
26552
|
...confirmation ? { confirmation } : {}
|
|
26511
26553
|
};
|
|
@@ -26587,7 +26629,7 @@ var RelaycastMessagingClient = class {
|
|
|
26587
26629
|
* pending success — it times out as `spawn_unconfirmed`.
|
|
26588
26630
|
*/
|
|
26589
26631
|
async confirmPlacementInvocation(actionName, ack, context) {
|
|
26590
|
-
const { timeoutMs, pollIntervalMs, ...errorContext } = context;
|
|
26632
|
+
const { timeoutMs, pollIntervalMs, requireReadiness, ...errorContext } = context;
|
|
26591
26633
|
const invocationId = ack.invocationId;
|
|
26592
26634
|
const dispatchState = resolveDispatchState(ack);
|
|
26593
26635
|
if (!invocationId) {
|
|
@@ -26616,8 +26658,8 @@ var RelaycastMessagingClient = class {
|
|
|
26616
26658
|
const invocation = outcome.value;
|
|
26617
26659
|
const status = invocation?.status?.toLowerCase();
|
|
26618
26660
|
if (status && CONFIRM_SUCCESS_STATUSES.has(status)) {
|
|
26619
|
-
if (errorContext.capability.startsWith("spawn:") && !
|
|
26620
|
-
throw new RelayPlacementError("spawn_failed",
|
|
26661
|
+
if (errorContext.capability.startsWith("spawn:") && !hasSpawnProof(invocation, requireReadiness)) {
|
|
26662
|
+
throw new RelayPlacementError("spawn_failed", spawnProofError(context.node, status, actionName, invocation.output, requireReadiness), {
|
|
26621
26663
|
...errorContext,
|
|
26622
26664
|
state: "failed",
|
|
26623
26665
|
invocationId,
|
|
@@ -26666,17 +26708,6 @@ var RelaycastMessagingClient = class {
|
|
|
26666
26708
|
throw new Error("RelaycastMessagingClient.workspace.info requires the relaycast workspace API.");
|
|
26667
26709
|
}
|
|
26668
26710
|
return await this.relaycast.workspace.info();
|
|
26669
|
-
},
|
|
26670
|
-
fleetNodes: {
|
|
26671
|
-
get: async () => {
|
|
26672
|
-
return toRelayWorkspaceFleetNodesConfig(await this.requireWorkspaceFleetNodes().get());
|
|
26673
|
-
},
|
|
26674
|
-
set: async (enabled) => {
|
|
26675
|
-
return toRelayWorkspaceFleetNodesConfig(await this.requireWorkspaceFleetNodes().set(enabled));
|
|
26676
|
-
},
|
|
26677
|
-
inherit: async () => {
|
|
26678
|
-
return toRelayWorkspaceFleetNodesConfig(await this.requireWorkspaceFleetNodes().inherit());
|
|
26679
|
-
}
|
|
26680
26711
|
}
|
|
26681
26712
|
};
|
|
26682
26713
|
resolvePlacementNode(node2, selfNodeName) {
|
|
@@ -26838,12 +26869,6 @@ var RelaycastMessagingClient = class {
|
|
|
26838
26869
|
}
|
|
26839
26870
|
return this.relaycast.triggers;
|
|
26840
26871
|
}
|
|
26841
|
-
requireWorkspaceFleetNodes() {
|
|
26842
|
-
if (!this.relaycast.workspace?.fleetNodes) {
|
|
26843
|
-
throw new Error("RelaycastMessagingClient.workspace.fleetNodes requires @relaycast/sdk with the workspace fleet nodes API.");
|
|
26844
|
-
}
|
|
26845
|
-
return this.relaycast.workspace.fleetNodes;
|
|
26846
|
-
}
|
|
26847
26872
|
requireAgentActions(operation) {
|
|
26848
26873
|
const actions = this.agentClient?.actions;
|
|
26849
26874
|
if (!actions) {
|
|
@@ -27709,7 +27734,6 @@ function createWorkspaceFacade(messaging, deps) {
|
|
|
27709
27734
|
};
|
|
27710
27735
|
return {
|
|
27711
27736
|
info: () => messaging.workspace.info(),
|
|
27712
|
-
fleetNodes: messaging.workspace.fleetNodes,
|
|
27713
27737
|
register,
|
|
27714
27738
|
release: async (input2) => {
|
|
27715
27739
|
if (!deps) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-relay",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Real-time agent-to-agent communication system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -43,20 +43,20 @@
|
|
|
43
43
|
"pack:validate": "npm pack --dry-run"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agent-relay/cli-surface": "
|
|
47
|
-
"@agent-relay/cloud": "
|
|
48
|
-
"@agent-relay/config": "
|
|
49
|
-
"@agent-relay/fleet": "
|
|
50
|
-
"@agent-relay/harness-driver": "
|
|
51
|
-
"@agent-relay/harnesses": "
|
|
52
|
-
"@agent-relay/sdk": "
|
|
53
|
-
"@agent-relay/session": "
|
|
54
|
-
"@agent-relay/utils": "
|
|
46
|
+
"@agent-relay/cli-surface": "13.0.0",
|
|
47
|
+
"@agent-relay/cloud": "13.0.0",
|
|
48
|
+
"@agent-relay/config": "13.0.0",
|
|
49
|
+
"@agent-relay/fleet": "13.0.0",
|
|
50
|
+
"@agent-relay/harness-driver": "13.0.0",
|
|
51
|
+
"@agent-relay/harnesses": "13.0.0",
|
|
52
|
+
"@agent-relay/sdk": "13.0.0",
|
|
53
|
+
"@agent-relay/session": "13.0.0",
|
|
54
|
+
"@agent-relay/utils": "13.0.0",
|
|
55
55
|
"@modelcontextprotocol/sdk": "^1.23.0",
|
|
56
56
|
"@relayfile/client": "^0.10.27",
|
|
57
57
|
"@relayfile/sdk": "^0.10.64",
|
|
58
58
|
"@relayflows/cli": "1.0.1",
|
|
59
|
-
"@relayflows/sdk": "
|
|
59
|
+
"@relayflows/sdk": "2.0.22",
|
|
60
60
|
"@xterm/headless": "^6.0.0",
|
|
61
61
|
"ai-hist": "^0.18.1",
|
|
62
62
|
"commander": "^12.1.0",
|