agent-relay 8.3.7 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +0 -4
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/index.cjs +432 -278
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/cli/bootstrap.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgEpC,eAAO,MAAM,OAAO,QAAsB,CAAC;AAkB3C,eAAO,MAAM,WAAW,oBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/cli/bootstrap.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgEpC,eAAO,MAAM,OAAO,QAAsB,CAAC;AAkB3C,eAAO,MAAM,WAAW,oBAAsB,CAAC;AA+L/C,wBAAgB,aAAa,CAAC,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAiCtE;AAqCD,wBAAsB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAsE5E"}
|
package/dist/cli/bootstrap.js
CHANGED
|
@@ -68,7 +68,6 @@ function resolveSdkVersion() {
|
|
|
68
68
|
}
|
|
69
69
|
export const SDK_VERSION = resolveSdkVersion();
|
|
70
70
|
const AGENT_RELAY_DISTINCT_ID_ENV = 'AGENT_RELAY_DISTINCT_ID';
|
|
71
|
-
const TELEMETRY_SURFACE_ENV = 'AGENT_RELAY_TELEMETRY_SURFACE';
|
|
72
71
|
const TELEMETRY_CLIENT_ENV = 'AGENT_RELAY_TELEMETRY_CLIENT';
|
|
73
72
|
function hasConfiguredTelemetryKey() {
|
|
74
73
|
return Boolean(process.env.POSTHOG_API_KEY?.trim() || process.env.AGENT_RELAY_POSTHOG_KEY?.trim());
|
|
@@ -101,9 +100,6 @@ function propagateTelemetryContextToChildren() {
|
|
|
101
100
|
if (!process.env[ORCHESTRATOR_HARNESS_ENV]) {
|
|
102
101
|
process.env[ORCHESTRATOR_HARNESS_ENV] = orchestratorHarness;
|
|
103
102
|
}
|
|
104
|
-
if (!process.env[TELEMETRY_SURFACE_ENV]) {
|
|
105
|
-
process.env[TELEMETRY_SURFACE_ENV] = 'cli';
|
|
106
|
-
}
|
|
107
103
|
if (!process.env[TELEMETRY_CLIENT_ENV]) {
|
|
108
104
|
process.env[TELEMETRY_CLIENT_ENV] = 'agent-relay';
|
|
109
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/cli/bootstrap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,SAAS,IAAI,kBAAkB,EAC/B,QAAQ,IAAI,iBAAiB,EAC7B,KAAK,GACN,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OA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C;YACH,MAAM,iBAAiB,EAAE,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,kCAAkC;QACpC,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -175,11 +175,13 @@ __export(index_exports, {
|
|
|
175
175
|
MessageReactedPredicate: () => MessageReactedPredicate,
|
|
176
176
|
MessageReadPredicate: () => MessageReadPredicate,
|
|
177
177
|
RelayCapabilityError: () => RelayCapabilityError,
|
|
178
|
+
RelayError: () => RelayError,
|
|
178
179
|
RelaycastMessagingClient: () => RelaycastMessagingClient,
|
|
179
180
|
StaticPatterns: () => StaticPatterns,
|
|
180
181
|
StatusPredicate: () => StatusPredicate,
|
|
181
182
|
ToolCalledPredicate: () => ToolCalledPredicate,
|
|
182
183
|
TracedError: () => TracedError,
|
|
184
|
+
TypedActionPredicate: () => TypedActionPredicate,
|
|
183
185
|
actionSchemaToJsonSchema: () => actionSchemaToJsonSchema,
|
|
184
186
|
agentRelayAgent: () => agentRelayAgent,
|
|
185
187
|
agentTokenRecoveryMessage: () => agentTokenRecoveryMessage,
|
|
@@ -201,6 +203,7 @@ __export(index_exports, {
|
|
|
201
203
|
createRequestEnvelope: () => createRequestEnvelope,
|
|
202
204
|
createRequestHandler: () => createRequestHandler,
|
|
203
205
|
createTraceableError: () => createTraceableError,
|
|
206
|
+
createTypedActionHandle: () => createTypedActionHandle,
|
|
204
207
|
createWorkspaceFacade: () => createWorkspaceFacade,
|
|
205
208
|
defineHarness: () => defineHarness,
|
|
206
209
|
findGitRoot: () => findGitRoot,
|
|
@@ -233,6 +236,7 @@ __export(index_exports, {
|
|
|
233
236
|
isSpawnOrReleaseCommandFast: () => isSpawnOrReleaseCommandFast,
|
|
234
237
|
isValidAgentName: () => isValidAgentName,
|
|
235
238
|
logAndTraceError: () => logAndTraceError,
|
|
239
|
+
logRelayHandlerError: () => logRelayHandlerError,
|
|
236
240
|
mapModelToCli: () => mapModelToCli,
|
|
237
241
|
matchesSelector: () => matchesSelector,
|
|
238
242
|
nextHarnessName: () => nextHarnessName,
|
|
@@ -33550,6 +33554,7 @@ var RelaycastMessagingClient = class {
|
|
|
33550
33554
|
},
|
|
33551
33555
|
get: async (name) => normalizeAgent(await this.relaycast.agents.get(name)),
|
|
33552
33556
|
register: async (input) => normalizeAgentRegistration(await this.relaycast.agents.register(input)),
|
|
33557
|
+
registerOrRotate: async (input) => normalizeAgentRegistration(this.relaycast.agents.registerOrRotate ? await this.relaycast.agents.registerOrRotate(input) : await this.relaycast.agents.register(input)),
|
|
33553
33558
|
me: async () => normalizeAgent(await this.requireAgentClient("agents.me").me()),
|
|
33554
33559
|
update: async (name, input) => normalizeAgent(await this.relaycast.agents.update(name, input)),
|
|
33555
33560
|
delete: async (name) => {
|
|
@@ -33895,270 +33900,38 @@ var RelaycastMessagingClient = class {
|
|
|
33895
33900
|
}
|
|
33896
33901
|
};
|
|
33897
33902
|
|
|
33898
|
-
// ../sdk/dist/
|
|
33899
|
-
function
|
|
33900
|
-
|
|
33901
|
-
|
|
33902
|
-
const value = ref.handle ?? ref.name ?? ref.id;
|
|
33903
|
-
if (!value) {
|
|
33904
|
-
throw new Error("Unable to resolve agent name: reference has no name, handle, or id.");
|
|
33905
|
-
}
|
|
33906
|
-
return stripSigil(value);
|
|
33907
|
-
}
|
|
33908
|
-
function resolveAgentToken(ref) {
|
|
33909
|
-
return ref && typeof ref !== "string" ? ref.token : void 0;
|
|
33903
|
+
// ../sdk/dist/listeners.js
|
|
33904
|
+
function logRelayHandlerError(error101, context) {
|
|
33905
|
+
const where = context.action ? `action "${context.action}"` : `"${context.selector ?? "unknown"}"`;
|
|
33906
|
+
console.warn(`[agent-relay] ${context.source} handler for ${where} threw:`, error101);
|
|
33910
33907
|
}
|
|
33911
33908
|
function stripSigil(value) {
|
|
33912
33909
|
return value.startsWith("@") || value.startsWith("#") ? value.slice(1) : value;
|
|
33913
33910
|
}
|
|
33914
|
-
function
|
|
33915
|
-
return to.startsWith("#");
|
|
33916
|
-
}
|
|
33917
|
-
function deliveryToMode(delivery) {
|
|
33918
|
-
if (!delivery)
|
|
33919
|
-
return void 0;
|
|
33920
|
-
return delivery === "immediate" || delivery === "next-tool-call" ? "steer" : "wait";
|
|
33921
|
-
}
|
|
33922
|
-
function buildText(text, mentions) {
|
|
33923
|
-
let body = text ?? "";
|
|
33924
|
-
if (mentions?.length) {
|
|
33925
|
-
const handles = mentions.map((mention) => `@${resolveAgentName(mention)}`);
|
|
33926
|
-
const missing = handles.filter((handle) => !body.includes(handle));
|
|
33927
|
-
if (missing.length) {
|
|
33928
|
-
body = body ? `${missing.join(" ")} ${body}` : missing.join(" ");
|
|
33929
|
-
}
|
|
33930
|
-
}
|
|
33931
|
-
return body;
|
|
33932
|
-
}
|
|
33933
|
-
function resolveMessageId(ref) {
|
|
33934
|
-
if (!ref) {
|
|
33935
|
-
throw new Error("reply requires a `messageId` or `thread`.");
|
|
33936
|
-
}
|
|
33937
|
-
if (typeof ref === "string")
|
|
33938
|
-
return ref;
|
|
33939
|
-
const value = ref.id ?? ref.threadId;
|
|
33940
|
-
if (!value) {
|
|
33941
|
-
throw new Error("Unable to resolve a message id from the provided thread reference.");
|
|
33942
|
-
}
|
|
33943
|
-
return value;
|
|
33944
|
-
}
|
|
33945
|
-
function createEnrichedMessages(base, resolveFrom) {
|
|
33946
|
-
const enriched = Object.create(base);
|
|
33947
|
-
enriched.send = async (input) => {
|
|
33948
|
-
if ("channel" in input && input.channel) {
|
|
33949
|
-
return base.send(input);
|
|
33950
|
-
}
|
|
33951
|
-
const sendInput = input;
|
|
33952
|
-
const messages = resolveFrom(sendInput.from);
|
|
33953
|
-
const text = buildText(sendInput.text ?? sendInput.msg, sendInput.mentions);
|
|
33954
|
-
if (Array.isArray(sendInput.to)) {
|
|
33955
|
-
return messages.groupDirect({
|
|
33956
|
-
participants: sendInput.to.map(resolveAgentName),
|
|
33957
|
-
text,
|
|
33958
|
-
attachments: sendInput.attachments,
|
|
33959
|
-
mode: sendInput.mode,
|
|
33960
|
-
idempotencyKey: sendInput.idempotencyKey
|
|
33961
|
-
});
|
|
33962
|
-
}
|
|
33963
|
-
if (isChannelTarget(sendInput.to)) {
|
|
33964
|
-
return messages.send({
|
|
33965
|
-
channel: stripSigil(sendInput.to),
|
|
33966
|
-
text,
|
|
33967
|
-
blocks: sendInput.blocks,
|
|
33968
|
-
attachments: sendInput.attachments,
|
|
33969
|
-
mode: sendInput.mode,
|
|
33970
|
-
idempotencyKey: sendInput.idempotencyKey
|
|
33971
|
-
});
|
|
33972
|
-
}
|
|
33973
|
-
return messages.direct({
|
|
33974
|
-
to: resolveAgentName(sendInput.to),
|
|
33975
|
-
text,
|
|
33976
|
-
attachments: sendInput.attachments,
|
|
33977
|
-
mode: sendInput.mode,
|
|
33978
|
-
idempotencyKey: sendInput.idempotencyKey
|
|
33979
|
-
});
|
|
33980
|
-
};
|
|
33981
|
-
enriched.reply = async (input) => {
|
|
33982
|
-
const messages = resolveFrom(input.from);
|
|
33983
|
-
return messages.reply({
|
|
33984
|
-
messageId: resolveMessageId(input.messageId ?? input.thread),
|
|
33985
|
-
text: input.text,
|
|
33986
|
-
blocks: input.blocks,
|
|
33987
|
-
idempotencyKey: input.idempotencyKey
|
|
33988
|
-
});
|
|
33989
|
-
};
|
|
33990
|
-
enriched.react = (async (arg1, arg2) => {
|
|
33991
|
-
if (typeof arg1 === "string") {
|
|
33992
|
-
return base.react(arg1, arg2);
|
|
33993
|
-
}
|
|
33994
|
-
const messageId = typeof arg1.message === "string" ? arg1.message : arg1.message.id;
|
|
33995
|
-
const messages = resolveFrom(arg1.agent);
|
|
33996
|
-
return messages.react(messageId, arg1.emoji);
|
|
33997
|
-
});
|
|
33998
|
-
enriched.dm = async (input) => {
|
|
33999
|
-
const messages = resolveFrom(input.from);
|
|
34000
|
-
return messages.direct({
|
|
34001
|
-
to: resolveAgentName(input.to),
|
|
34002
|
-
text: input.text ?? input.msg ?? "",
|
|
34003
|
-
attachments: input.attachments,
|
|
34004
|
-
mode: input.mode,
|
|
34005
|
-
idempotencyKey: input.idempotencyKey
|
|
34006
|
-
});
|
|
34007
|
-
};
|
|
34008
|
-
return enriched;
|
|
34009
|
-
}
|
|
34010
|
-
function createWorkspaceFacade(messaging, deps) {
|
|
34011
|
-
const register = async (agents) => {
|
|
34012
|
-
if (!deps) {
|
|
34013
|
-
throw new Error("register() is only available on the workspace client.");
|
|
34014
|
-
}
|
|
34015
|
-
const list = Array.isArray(agents) ? agents : [agents];
|
|
34016
|
-
const inputs = list.map((agent) => typeof agent === "string" ? { name: stripSigil(agent) } : {
|
|
34017
|
-
name: resolveAgentName(agent),
|
|
34018
|
-
type: agent.type,
|
|
34019
|
-
persona: agent.persona,
|
|
34020
|
-
metadata: agent.metadata
|
|
34021
|
-
});
|
|
34022
|
-
const seen = /* @__PURE__ */ new Set();
|
|
34023
|
-
for (const { name } of inputs) {
|
|
34024
|
-
if (seen.has(name)) {
|
|
34025
|
-
throw new Error(`Duplicate agent name in register(): "${name}".`);
|
|
34026
|
-
}
|
|
34027
|
-
seen.add(name);
|
|
34028
|
-
}
|
|
34029
|
-
const clients = [];
|
|
34030
|
-
for (const input of inputs) {
|
|
34031
|
-
clients.push(deps.buildAgentClient(await messaging.agents.register(input)));
|
|
34032
|
-
}
|
|
34033
|
-
return Array.isArray(agents) ? clients : clients[0];
|
|
34034
|
-
};
|
|
34035
|
-
return {
|
|
34036
|
-
info: () => messaging.workspace.info(),
|
|
34037
|
-
register,
|
|
34038
|
-
reconnect: async ({ apiToken }) => {
|
|
34039
|
-
if (!deps) {
|
|
34040
|
-
throw new Error("reconnect() is only available on the workspace client.");
|
|
34041
|
-
}
|
|
34042
|
-
return deps.reconnectAgent(apiToken);
|
|
34043
|
-
}
|
|
34044
|
-
};
|
|
34045
|
-
}
|
|
34046
|
-
function registerFacadeAction(actions, def, wiring) {
|
|
34047
|
-
const allowed = def.availableTo?.map(resolveAgentName);
|
|
34048
|
-
const policy = allowed || def.policy ? async (input, ctx) => {
|
|
34049
|
-
if (allowed && !allowed.includes(ctx.caller.name)) {
|
|
34050
|
-
return {
|
|
34051
|
-
allowed: false,
|
|
34052
|
-
reason: `${ctx.caller.name} is not permitted to call ${def.name}.`
|
|
34053
|
-
};
|
|
34054
|
-
}
|
|
34055
|
-
return def.policy ? def.policy(input, ctx) : { allowed: true };
|
|
34056
|
-
} : void 0;
|
|
34057
|
-
const localHandle = actions.register({
|
|
34058
|
-
name: def.name,
|
|
34059
|
-
description: def.description,
|
|
34060
|
-
input: def.input,
|
|
34061
|
-
inputSchema: def.inputSchema,
|
|
34062
|
-
output: def.output,
|
|
34063
|
-
outputSchema: def.outputSchema,
|
|
34064
|
-
visibility: def.visibility,
|
|
34065
|
-
policy,
|
|
34066
|
-
handler: (input, ctx) => def.handler({ input, agent: ctx.caller, ctx })
|
|
34067
|
-
});
|
|
34068
|
-
const relayUnsubscribe = wireRelayAction(actions, def, wiring, allowed);
|
|
34069
|
-
if (!relayUnsubscribe) {
|
|
34070
|
-
return localHandle;
|
|
34071
|
-
}
|
|
34072
|
-
return {
|
|
34073
|
-
unregister: () => {
|
|
34074
|
-
relayUnsubscribe();
|
|
34075
|
-
localHandle.unregister();
|
|
34076
|
-
}
|
|
34077
|
-
};
|
|
34078
|
-
}
|
|
34079
|
-
function wireRelayAction(actions, def, wiring, allowed) {
|
|
34080
|
-
const commands = wiring?.messaging.commands;
|
|
34081
|
-
if (!wiring || !commands?.agentScoped?.() || !commands.available?.()) {
|
|
34082
|
-
return void 0;
|
|
34083
|
-
}
|
|
34084
|
-
const handlerAgent = wiring.handlerAgent;
|
|
34085
|
-
if (!handlerAgent) {
|
|
34086
|
-
return void 0;
|
|
34087
|
-
}
|
|
34088
|
-
void commands.register({
|
|
34089
|
-
command: def.name,
|
|
34090
|
-
description: def.description ?? def.name,
|
|
34091
|
-
handlerAgent,
|
|
34092
|
-
inputSchema: actionSchemaToJsonSchema(def.inputSchema ?? def.input),
|
|
34093
|
-
outputSchema: actionSchemaToJsonSchema(def.outputSchema ?? def.output),
|
|
34094
|
-
...allowed ? { availableTo: allowed } : {}
|
|
34095
|
-
}).catch((error101) => {
|
|
34096
|
-
console.error(`[agent-relay] failed to register action descriptor "${def.name}":`, error101);
|
|
34097
|
-
});
|
|
34098
|
-
const unsubscribe = wiring.messaging.events.on("actionInvoked", async (event) => {
|
|
34099
|
-
if (event.actionName !== def.name) {
|
|
34100
|
-
return;
|
|
34101
|
-
}
|
|
34102
|
-
await handleActionInvoked(actions, commands, def.name, event);
|
|
34103
|
-
});
|
|
33911
|
+
function runHandler(handler, event, report) {
|
|
34104
33912
|
try {
|
|
34105
|
-
|
|
33913
|
+
void Promise.resolve(handler(event)).catch(report);
|
|
34106
33914
|
} catch (error101) {
|
|
34107
|
-
|
|
33915
|
+
report(error101);
|
|
34108
33916
|
}
|
|
34109
|
-
return unsubscribe;
|
|
34110
33917
|
}
|
|
34111
|
-
|
|
34112
|
-
|
|
34113
|
-
|
|
34114
|
-
|
|
34115
|
-
|
|
34116
|
-
|
|
34117
|
-
|
|
34118
|
-
|
|
34119
|
-
|
|
34120
|
-
|
|
34121
|
-
input,
|
|
34122
|
-
caller: { name: event.callerName, type: "agent" }
|
|
34123
|
-
});
|
|
34124
|
-
try {
|
|
34125
|
-
await commands.completeInvocation(actionName, event.invocationId, result.ok ? { output: toOutputRecord(result.output) } : { error: result.error?.message ?? "handler failed" });
|
|
34126
|
-
} catch (error101) {
|
|
34127
|
-
console.error(`[agent-relay] failed to complete invocation "${event.invocationId}":`, error101);
|
|
34128
|
-
}
|
|
34129
|
-
}
|
|
34130
|
-
function toOutputRecord(output) {
|
|
34131
|
-
if (output !== null && typeof output === "object" && !Array.isArray(output)) {
|
|
34132
|
-
return output;
|
|
34133
|
-
}
|
|
34134
|
-
return { value: output };
|
|
34135
|
-
}
|
|
34136
|
-
function createNotifyHandler(messages, target, options) {
|
|
34137
|
-
return async () => {
|
|
34138
|
-
const subject = options.subject ? `@${resolveAgentName(options.subject)}` : void 0;
|
|
34139
|
-
const label = options.type ?? options.action ?? "notification";
|
|
34140
|
-
const text = options.text ?? [`[${label}]`, subject].filter(Boolean).join(" ");
|
|
34141
|
-
await messages.dm({
|
|
34142
|
-
to: resolveAgentName(target),
|
|
34143
|
-
text,
|
|
34144
|
-
mode: deliveryToMode(options.delivery)
|
|
34145
|
-
});
|
|
33918
|
+
function makeReporter(context, info) {
|
|
33919
|
+
return (error101) => {
|
|
33920
|
+
if (!context.onError) {
|
|
33921
|
+
logRelayHandlerError(error101, info);
|
|
33922
|
+
return;
|
|
33923
|
+
}
|
|
33924
|
+
try {
|
|
33925
|
+
context.onError(error101, info);
|
|
33926
|
+
} catch {
|
|
33927
|
+
}
|
|
34146
33928
|
};
|
|
34147
33929
|
}
|
|
34148
|
-
|
|
34149
|
-
// ../sdk/dist/listeners.js
|
|
34150
|
-
function stripSigil2(value) {
|
|
34151
|
-
return value.startsWith("@") || value.startsWith("#") ? value.slice(1) : value;
|
|
34152
|
-
}
|
|
34153
|
-
function runHandler(handler, event) {
|
|
34154
|
-
void Promise.resolve(handler(event)).catch(() => {
|
|
34155
|
-
});
|
|
34156
|
-
}
|
|
34157
33930
|
var MessageCreatedPredicate = class {
|
|
34158
33931
|
channel;
|
|
34159
33932
|
mentioned;
|
|
34160
33933
|
in(channel) {
|
|
34161
|
-
this.channel =
|
|
33934
|
+
this.channel = stripSigil(channel);
|
|
34162
33935
|
return this;
|
|
34163
33936
|
}
|
|
34164
33937
|
mentions(agent) {
|
|
@@ -34166,30 +33939,33 @@ var MessageCreatedPredicate = class {
|
|
|
34166
33939
|
return this;
|
|
34167
33940
|
}
|
|
34168
33941
|
subscribe(context, handler) {
|
|
33942
|
+
const report = makeReporter(context, { source: "listener", selector: "message.created" });
|
|
34169
33943
|
return context.events.on("messageCreated", (event) => {
|
|
34170
|
-
if (this.channel &&
|
|
33944
|
+
if (this.channel && stripSigil(event.channel) !== this.channel)
|
|
34171
33945
|
return;
|
|
34172
33946
|
if (this.mentioned && !messageMentions(event, this.mentioned))
|
|
34173
33947
|
return;
|
|
34174
|
-
runHandler(handler, event);
|
|
33948
|
+
runHandler(handler, event, report);
|
|
34175
33949
|
});
|
|
34176
33950
|
}
|
|
34177
33951
|
};
|
|
34178
33952
|
function messageMentions(event, name) {
|
|
34179
33953
|
const mentions = event.message.mentions ?? [];
|
|
34180
|
-
if (mentions.some((mention) =>
|
|
33954
|
+
if (mentions.some((mention) => stripSigil(mention) === name))
|
|
34181
33955
|
return true;
|
|
34182
33956
|
return event.message.text?.includes(`@${name}`) ?? false;
|
|
34183
33957
|
}
|
|
34184
33958
|
var MessageReadPredicate = class {
|
|
34185
33959
|
subscribe(context, handler) {
|
|
34186
|
-
|
|
33960
|
+
const report = makeReporter(context, { source: "listener", selector: "message.read" });
|
|
33961
|
+
return context.events.on("messageRead", (event) => runHandler(handler, event, report));
|
|
34187
33962
|
}
|
|
34188
33963
|
};
|
|
34189
33964
|
var MessageReactedPredicate = class {
|
|
34190
33965
|
subscribe(context, handler) {
|
|
34191
|
-
const
|
|
34192
|
-
const
|
|
33966
|
+
const report = makeReporter(context, { source: "listener", selector: "message.reacted" });
|
|
33967
|
+
const off1 = context.events.on("reactionAdded", (event) => runHandler(handler, event, report));
|
|
33968
|
+
const off2 = context.events.on("reactionRemoved", (event) => runHandler(handler, event, report));
|
|
34193
33969
|
return () => {
|
|
34194
33970
|
off1();
|
|
34195
33971
|
off2();
|
|
@@ -34229,6 +34005,11 @@ var ActionPredicate = class {
|
|
|
34229
34005
|
return this;
|
|
34230
34006
|
}
|
|
34231
34007
|
subscribe(context, handler) {
|
|
34008
|
+
const report = makeReporter(context, {
|
|
34009
|
+
source: "listener",
|
|
34010
|
+
selector: this.phase,
|
|
34011
|
+
action: this.action
|
|
34012
|
+
});
|
|
34232
34013
|
return context.onActionEvent((event) => {
|
|
34233
34014
|
if (event.action !== this.action)
|
|
34234
34015
|
return;
|
|
@@ -34236,10 +34017,61 @@ var ActionPredicate = class {
|
|
|
34236
34017
|
return;
|
|
34237
34018
|
if (this.caller && event.caller.name !== this.caller)
|
|
34238
34019
|
return;
|
|
34239
|
-
runHandler(handler, event);
|
|
34020
|
+
runHandler(handler, event, report);
|
|
34240
34021
|
});
|
|
34241
34022
|
}
|
|
34242
34023
|
};
|
|
34024
|
+
var TypedActionPredicate = class {
|
|
34025
|
+
action;
|
|
34026
|
+
phase;
|
|
34027
|
+
caller;
|
|
34028
|
+
constructor(action, phase) {
|
|
34029
|
+
this.action = action;
|
|
34030
|
+
this.phase = phase;
|
|
34031
|
+
}
|
|
34032
|
+
calledBy(agent) {
|
|
34033
|
+
this.caller = resolveAgentName(agent);
|
|
34034
|
+
return this;
|
|
34035
|
+
}
|
|
34036
|
+
subscribe(context, handler) {
|
|
34037
|
+
const report = makeReporter(context, {
|
|
34038
|
+
source: "listener",
|
|
34039
|
+
selector: this.phase,
|
|
34040
|
+
action: this.action
|
|
34041
|
+
});
|
|
34042
|
+
return context.onActionEvent((event) => {
|
|
34043
|
+
if (event.action !== this.action)
|
|
34044
|
+
return;
|
|
34045
|
+
if (event.type !== this.phase)
|
|
34046
|
+
return;
|
|
34047
|
+
if (this.caller && event.caller.name !== this.caller)
|
|
34048
|
+
return;
|
|
34049
|
+
runHandler(handler, toTypedActionEvent(event), report);
|
|
34050
|
+
});
|
|
34051
|
+
}
|
|
34052
|
+
};
|
|
34053
|
+
function toTypedActionEvent(raw) {
|
|
34054
|
+
return {
|
|
34055
|
+
type: raw.type,
|
|
34056
|
+
action: raw.action,
|
|
34057
|
+
agent: raw.caller,
|
|
34058
|
+
...raw.input !== void 0 ? { input: raw.input } : {},
|
|
34059
|
+
...raw.output !== void 0 ? { output: raw.output } : {},
|
|
34060
|
+
...raw.error !== void 0 ? { error: raw.error } : {},
|
|
34061
|
+
...raw.reason !== void 0 ? { reason: raw.reason } : {},
|
|
34062
|
+
at: raw.at
|
|
34063
|
+
};
|
|
34064
|
+
}
|
|
34065
|
+
function createTypedActionHandle(name, unregister) {
|
|
34066
|
+
return {
|
|
34067
|
+
name,
|
|
34068
|
+
unregister,
|
|
34069
|
+
invoked: () => new TypedActionPredicate(name, "action.invoked"),
|
|
34070
|
+
completed: () => new TypedActionPredicate(name, "action.completed"),
|
|
34071
|
+
failed: () => new TypedActionPredicate(name, "action.failed"),
|
|
34072
|
+
denied: () => new TypedActionPredicate(name, "action.denied")
|
|
34073
|
+
};
|
|
34074
|
+
}
|
|
34243
34075
|
var StatusPredicate = class {
|
|
34244
34076
|
agentId;
|
|
34245
34077
|
status;
|
|
@@ -34248,12 +34080,16 @@ var StatusPredicate = class {
|
|
|
34248
34080
|
this.status = status;
|
|
34249
34081
|
}
|
|
34250
34082
|
subscribe(context, handler) {
|
|
34083
|
+
const report = makeReporter(context, {
|
|
34084
|
+
source: "listener",
|
|
34085
|
+
selector: `agent.status.${this.status}`
|
|
34086
|
+
});
|
|
34251
34087
|
return context.onSessionEvent(({ agentId, event }) => {
|
|
34252
34088
|
if (agentId !== this.agentId)
|
|
34253
34089
|
return;
|
|
34254
34090
|
const matches = event.type === "status.changed" && event.status === this.status || event.type === `status.${this.status}`;
|
|
34255
34091
|
if (matches)
|
|
34256
|
-
runHandler(handler, event);
|
|
34092
|
+
runHandler(handler, event, report);
|
|
34257
34093
|
});
|
|
34258
34094
|
}
|
|
34259
34095
|
};
|
|
@@ -34270,6 +34106,7 @@ var ToolCalledPredicate = class {
|
|
|
34270
34106
|
return this;
|
|
34271
34107
|
}
|
|
34272
34108
|
subscribe(context, handler) {
|
|
34109
|
+
const report = makeReporter(context, { source: "listener", selector: `tool.called:${this.tool}` });
|
|
34273
34110
|
return context.onSessionEvent(({ agentId, event }) => {
|
|
34274
34111
|
if (agentId !== this.agentId)
|
|
34275
34112
|
return;
|
|
@@ -34277,7 +34114,7 @@ var ToolCalledPredicate = class {
|
|
|
34277
34114
|
return;
|
|
34278
34115
|
if (this.filter && !this.filter(event))
|
|
34279
34116
|
return;
|
|
34280
|
-
runHandler(handler, event);
|
|
34117
|
+
runHandler(handler, event, report);
|
|
34281
34118
|
});
|
|
34282
34119
|
}
|
|
34283
34120
|
};
|
|
@@ -34289,7 +34126,7 @@ var PUBLIC_MESSAGE_TYPE = {
|
|
|
34289
34126
|
groupDmReceived: "group_dm.received"
|
|
34290
34127
|
};
|
|
34291
34128
|
function buildEnvelope(message, channelName) {
|
|
34292
|
-
const channel = message.channel ?? (channelName ? { name:
|
|
34129
|
+
const channel = message.channel ?? (channelName ? { name: stripSigil(channelName) } : void 0);
|
|
34293
34130
|
return {
|
|
34294
34131
|
...message.from ? { from: message.from } : {},
|
|
34295
34132
|
...message.target ? { to: message.target } : {},
|
|
@@ -34352,7 +34189,7 @@ function matchesSelector(selector, type) {
|
|
|
34352
34189
|
return type.startsWith(selector.slice(0, -1));
|
|
34353
34190
|
return selector === type;
|
|
34354
34191
|
}
|
|
34355
|
-
function createListenerHub(baseEvents, actions) {
|
|
34192
|
+
function createListenerHub(baseEvents, actions, options) {
|
|
34356
34193
|
const sessionHandlers = /* @__PURE__ */ new Set();
|
|
34357
34194
|
const events = createEnrichedEvents(baseEvents);
|
|
34358
34195
|
const context = {
|
|
@@ -34362,7 +34199,8 @@ function createListenerHub(baseEvents, actions) {
|
|
|
34362
34199
|
onSessionEvent: (handler) => {
|
|
34363
34200
|
sessionHandlers.add(handler);
|
|
34364
34201
|
return () => sessionHandlers.delete(handler);
|
|
34365
|
-
}
|
|
34202
|
+
},
|
|
34203
|
+
...options?.onError ? { onError: options.onError } : {}
|
|
34366
34204
|
};
|
|
34367
34205
|
const addListener = (selector, handler) => {
|
|
34368
34206
|
try {
|
|
@@ -34372,29 +34210,49 @@ function createListenerHub(baseEvents, actions) {
|
|
|
34372
34210
|
if (typeof selector !== "string") {
|
|
34373
34211
|
return selector.subscribe(context, handler);
|
|
34374
34212
|
}
|
|
34213
|
+
const report = makeReporter(context, { source: "listener", selector });
|
|
34375
34214
|
const offs = [
|
|
34376
34215
|
context.events.on("any", (raw) => {
|
|
34377
34216
|
const evt = toPublicMessagingEvent(raw);
|
|
34378
34217
|
if (evt && matchesSelector(selector, evt.type))
|
|
34379
|
-
runHandler(handler, evt);
|
|
34218
|
+
runHandler(handler, evt, report);
|
|
34380
34219
|
}),
|
|
34381
34220
|
context.onActionEvent((raw) => {
|
|
34382
34221
|
const evt = toPublicActionEvent(raw);
|
|
34383
34222
|
if (matchesSelector(selector, evt.type))
|
|
34384
|
-
runHandler(handler, evt);
|
|
34223
|
+
runHandler(handler, evt, report);
|
|
34385
34224
|
}),
|
|
34386
34225
|
context.onSessionEvent(({ agentId, event }) => {
|
|
34387
34226
|
const evt = toPublicSessionEvent(agentId, event);
|
|
34388
34227
|
if (matchesSelector(selector, evt.type))
|
|
34389
|
-
runHandler(handler, evt);
|
|
34228
|
+
runHandler(handler, evt, report);
|
|
34390
34229
|
})
|
|
34391
34230
|
];
|
|
34392
34231
|
return () => offs.forEach((off) => off());
|
|
34393
34232
|
};
|
|
34233
|
+
const once = (selector, handler) => {
|
|
34234
|
+
let done = false;
|
|
34235
|
+
let off;
|
|
34236
|
+
const wrapped = (event) => {
|
|
34237
|
+
if (done)
|
|
34238
|
+
return;
|
|
34239
|
+
done = true;
|
|
34240
|
+
off?.();
|
|
34241
|
+
return handler(event);
|
|
34242
|
+
};
|
|
34243
|
+
off = addListener(selector, wrapped);
|
|
34244
|
+
if (done)
|
|
34245
|
+
off();
|
|
34246
|
+
return () => {
|
|
34247
|
+
done = true;
|
|
34248
|
+
off?.();
|
|
34249
|
+
};
|
|
34250
|
+
};
|
|
34394
34251
|
return {
|
|
34395
34252
|
events,
|
|
34396
34253
|
on: (predicate, handler) => predicate.subscribe(context, handler),
|
|
34397
34254
|
addListener,
|
|
34255
|
+
once,
|
|
34398
34256
|
action: (name) => new ActionPredicate(name),
|
|
34399
34257
|
agent: (input) => createAgentHandle(input),
|
|
34400
34258
|
emitSessionEvent: (agentId, event) => {
|
|
@@ -34423,6 +34281,263 @@ function createAgentHandle(input) {
|
|
|
34423
34281
|
};
|
|
34424
34282
|
}
|
|
34425
34283
|
|
|
34284
|
+
// ../sdk/dist/facade.js
|
|
34285
|
+
function resolveAgentName(ref) {
|
|
34286
|
+
if (typeof ref === "string")
|
|
34287
|
+
return stripSigil2(ref);
|
|
34288
|
+
const value = ref.handle ?? ref.name ?? ref.id;
|
|
34289
|
+
if (!value) {
|
|
34290
|
+
throw new Error("Unable to resolve agent name: reference has no name, handle, or id.");
|
|
34291
|
+
}
|
|
34292
|
+
return stripSigil2(value);
|
|
34293
|
+
}
|
|
34294
|
+
function resolveAgentToken(ref) {
|
|
34295
|
+
return ref && typeof ref !== "string" ? ref.token : void 0;
|
|
34296
|
+
}
|
|
34297
|
+
function stripSigil2(value) {
|
|
34298
|
+
return value.startsWith("@") || value.startsWith("#") ? value.slice(1) : value;
|
|
34299
|
+
}
|
|
34300
|
+
function isChannelTarget(to) {
|
|
34301
|
+
return to.startsWith("#");
|
|
34302
|
+
}
|
|
34303
|
+
function deliveryToMode(delivery) {
|
|
34304
|
+
if (!delivery)
|
|
34305
|
+
return void 0;
|
|
34306
|
+
return delivery === "immediate" || delivery === "next-tool-call" ? "steer" : "wait";
|
|
34307
|
+
}
|
|
34308
|
+
function buildText(text, mentions) {
|
|
34309
|
+
let body = text ?? "";
|
|
34310
|
+
if (mentions?.length) {
|
|
34311
|
+
const handles = mentions.map((mention) => `@${resolveAgentName(mention)}`);
|
|
34312
|
+
const missing = handles.filter((handle) => !body.includes(handle));
|
|
34313
|
+
if (missing.length) {
|
|
34314
|
+
body = body ? `${missing.join(" ")} ${body}` : missing.join(" ");
|
|
34315
|
+
}
|
|
34316
|
+
}
|
|
34317
|
+
return body;
|
|
34318
|
+
}
|
|
34319
|
+
function resolveMessageId(ref) {
|
|
34320
|
+
if (!ref) {
|
|
34321
|
+
throw new Error("reply requires a `messageId` or `thread`.");
|
|
34322
|
+
}
|
|
34323
|
+
if (typeof ref === "string")
|
|
34324
|
+
return ref;
|
|
34325
|
+
const value = ref.id ?? ref.threadId;
|
|
34326
|
+
if (!value) {
|
|
34327
|
+
throw new Error("Unable to resolve a message id from the provided thread reference.");
|
|
34328
|
+
}
|
|
34329
|
+
return value;
|
|
34330
|
+
}
|
|
34331
|
+
function createEnrichedMessages(base, resolveFrom) {
|
|
34332
|
+
const enriched = Object.create(base);
|
|
34333
|
+
enriched.send = async (input) => {
|
|
34334
|
+
if ("channel" in input && input.channel) {
|
|
34335
|
+
return base.send(input);
|
|
34336
|
+
}
|
|
34337
|
+
const sendInput = input;
|
|
34338
|
+
const messages = resolveFrom(sendInput.from);
|
|
34339
|
+
const text = buildText(sendInput.text ?? sendInput.msg, sendInput.mentions);
|
|
34340
|
+
if (Array.isArray(sendInput.to)) {
|
|
34341
|
+
return messages.groupDirect({
|
|
34342
|
+
participants: sendInput.to.map(resolveAgentName),
|
|
34343
|
+
text,
|
|
34344
|
+
attachments: sendInput.attachments,
|
|
34345
|
+
mode: sendInput.mode,
|
|
34346
|
+
idempotencyKey: sendInput.idempotencyKey
|
|
34347
|
+
});
|
|
34348
|
+
}
|
|
34349
|
+
if (isChannelTarget(sendInput.to)) {
|
|
34350
|
+
return messages.send({
|
|
34351
|
+
channel: stripSigil2(sendInput.to),
|
|
34352
|
+
text,
|
|
34353
|
+
blocks: sendInput.blocks,
|
|
34354
|
+
attachments: sendInput.attachments,
|
|
34355
|
+
mode: sendInput.mode,
|
|
34356
|
+
idempotencyKey: sendInput.idempotencyKey
|
|
34357
|
+
});
|
|
34358
|
+
}
|
|
34359
|
+
return messages.direct({
|
|
34360
|
+
to: resolveAgentName(sendInput.to),
|
|
34361
|
+
text,
|
|
34362
|
+
attachments: sendInput.attachments,
|
|
34363
|
+
mode: sendInput.mode,
|
|
34364
|
+
idempotencyKey: sendInput.idempotencyKey
|
|
34365
|
+
});
|
|
34366
|
+
};
|
|
34367
|
+
enriched.reply = async (input) => {
|
|
34368
|
+
const messages = resolveFrom(input.from);
|
|
34369
|
+
return messages.reply({
|
|
34370
|
+
messageId: resolveMessageId(input.messageId ?? input.thread),
|
|
34371
|
+
text: input.text,
|
|
34372
|
+
blocks: input.blocks,
|
|
34373
|
+
idempotencyKey: input.idempotencyKey
|
|
34374
|
+
});
|
|
34375
|
+
};
|
|
34376
|
+
enriched.react = (async (arg1, arg2) => {
|
|
34377
|
+
if (typeof arg1 === "string") {
|
|
34378
|
+
return base.react(arg1, arg2);
|
|
34379
|
+
}
|
|
34380
|
+
const messageId = typeof arg1.message === "string" ? arg1.message : arg1.message.id;
|
|
34381
|
+
const messages = resolveFrom(arg1.agent);
|
|
34382
|
+
return messages.react(messageId, arg1.emoji);
|
|
34383
|
+
});
|
|
34384
|
+
enriched.dm = async (input) => {
|
|
34385
|
+
const messages = resolveFrom(input.from);
|
|
34386
|
+
return messages.direct({
|
|
34387
|
+
to: resolveAgentName(input.to),
|
|
34388
|
+
text: input.text ?? input.msg ?? "",
|
|
34389
|
+
attachments: input.attachments,
|
|
34390
|
+
mode: input.mode,
|
|
34391
|
+
idempotencyKey: input.idempotencyKey
|
|
34392
|
+
});
|
|
34393
|
+
};
|
|
34394
|
+
return enriched;
|
|
34395
|
+
}
|
|
34396
|
+
function createWorkspaceFacade(messaging, deps) {
|
|
34397
|
+
const register = async (agents, options) => {
|
|
34398
|
+
if (!deps) {
|
|
34399
|
+
throw new Error("register() is only available on the workspace client.");
|
|
34400
|
+
}
|
|
34401
|
+
const list = Array.isArray(agents) ? agents : [agents];
|
|
34402
|
+
const inputs = list.map((agent) => typeof agent === "string" ? { name: stripSigil2(agent) } : {
|
|
34403
|
+
name: resolveAgentName(agent),
|
|
34404
|
+
type: agent.type,
|
|
34405
|
+
persona: agent.persona,
|
|
34406
|
+
metadata: agent.metadata
|
|
34407
|
+
});
|
|
34408
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34409
|
+
for (const { name } of inputs) {
|
|
34410
|
+
if (seen.has(name)) {
|
|
34411
|
+
throw new RelayError("name_conflict", `Duplicate agent name in register(): "${name}".`);
|
|
34412
|
+
}
|
|
34413
|
+
seen.add(name);
|
|
34414
|
+
}
|
|
34415
|
+
const registerOne = !options?.strict && messaging.agents.registerOrRotate ? messaging.agents.registerOrRotate.bind(messaging.agents) : messaging.agents.register.bind(messaging.agents);
|
|
34416
|
+
const clients = [];
|
|
34417
|
+
for (const input of inputs) {
|
|
34418
|
+
clients.push(deps.buildAgentClient(await registerOne(input)));
|
|
34419
|
+
}
|
|
34420
|
+
return Array.isArray(agents) ? clients : clients[0];
|
|
34421
|
+
};
|
|
34422
|
+
return {
|
|
34423
|
+
info: () => messaging.workspace.info(),
|
|
34424
|
+
register,
|
|
34425
|
+
reconnect: async ({ apiToken }) => {
|
|
34426
|
+
if (!deps) {
|
|
34427
|
+
throw new Error("reconnect() is only available on the workspace client.");
|
|
34428
|
+
}
|
|
34429
|
+
return deps.reconnectAgent(apiToken);
|
|
34430
|
+
}
|
|
34431
|
+
};
|
|
34432
|
+
}
|
|
34433
|
+
function reportActionError(wiring, action, operation, message, error101) {
|
|
34434
|
+
if (wiring.onError) {
|
|
34435
|
+
try {
|
|
34436
|
+
wiring.onError(error101, { source: "action", action, operation });
|
|
34437
|
+
} catch {
|
|
34438
|
+
}
|
|
34439
|
+
return;
|
|
34440
|
+
}
|
|
34441
|
+
console.error(`[agent-relay] ${message}`, error101);
|
|
34442
|
+
}
|
|
34443
|
+
function registerFacadeAction(actions, def, wiring) {
|
|
34444
|
+
const allowed = def.availableTo?.map(resolveAgentName);
|
|
34445
|
+
const policy = allowed || def.policy ? async (input, ctx) => {
|
|
34446
|
+
if (allowed && !allowed.includes(ctx.caller.name)) {
|
|
34447
|
+
return {
|
|
34448
|
+
allowed: false,
|
|
34449
|
+
reason: `${ctx.caller.name} is not permitted to call ${def.name}.`
|
|
34450
|
+
};
|
|
34451
|
+
}
|
|
34452
|
+
return def.policy ? def.policy(input, ctx) : { allowed: true };
|
|
34453
|
+
} : void 0;
|
|
34454
|
+
const localHandle = actions.register({
|
|
34455
|
+
name: def.name,
|
|
34456
|
+
description: def.description,
|
|
34457
|
+
input: def.input,
|
|
34458
|
+
inputSchema: def.inputSchema,
|
|
34459
|
+
output: def.output,
|
|
34460
|
+
outputSchema: def.outputSchema,
|
|
34461
|
+
visibility: def.visibility,
|
|
34462
|
+
policy,
|
|
34463
|
+
handler: (input, ctx) => def.handler({ input, agent: ctx.caller, ctx })
|
|
34464
|
+
});
|
|
34465
|
+
const relayUnsubscribe = wireRelayAction(actions, def, wiring, allowed);
|
|
34466
|
+
return createTypedActionHandle(def.name, () => {
|
|
34467
|
+
relayUnsubscribe?.();
|
|
34468
|
+
localHandle.unregister();
|
|
34469
|
+
});
|
|
34470
|
+
}
|
|
34471
|
+
function wireRelayAction(actions, def, wiring, allowed) {
|
|
34472
|
+
const commands = wiring?.messaging.commands;
|
|
34473
|
+
if (!wiring || !commands?.agentScoped?.() || !commands.available?.()) {
|
|
34474
|
+
return void 0;
|
|
34475
|
+
}
|
|
34476
|
+
const handlerAgent = wiring.handlerAgent;
|
|
34477
|
+
if (!handlerAgent) {
|
|
34478
|
+
return void 0;
|
|
34479
|
+
}
|
|
34480
|
+
void commands.register({
|
|
34481
|
+
command: def.name,
|
|
34482
|
+
description: def.description ?? def.name,
|
|
34483
|
+
handlerAgent,
|
|
34484
|
+
inputSchema: actionSchemaToJsonSchema(def.inputSchema ?? def.input),
|
|
34485
|
+
outputSchema: actionSchemaToJsonSchema(def.outputSchema ?? def.output),
|
|
34486
|
+
...allowed ? { availableTo: allowed } : {}
|
|
34487
|
+
}).catch((error101) => {
|
|
34488
|
+
reportActionError(wiring, def.name, "register", `failed to register action descriptor "${def.name}":`, error101);
|
|
34489
|
+
});
|
|
34490
|
+
const unsubscribe = wiring.messaging.events.on("actionInvoked", async (event) => {
|
|
34491
|
+
if (event.actionName !== def.name) {
|
|
34492
|
+
return;
|
|
34493
|
+
}
|
|
34494
|
+
await handleActionInvoked(actions, commands, def.name, event, wiring);
|
|
34495
|
+
});
|
|
34496
|
+
try {
|
|
34497
|
+
wiring.messaging.events.connect();
|
|
34498
|
+
} catch (error101) {
|
|
34499
|
+
reportActionError(wiring, def.name, "connect", `failed to open the event stream for action "${def.name}":`, error101);
|
|
34500
|
+
}
|
|
34501
|
+
return unsubscribe;
|
|
34502
|
+
}
|
|
34503
|
+
async function handleActionInvoked(actions, commands, actionName, event, wiring) {
|
|
34504
|
+
let input = {};
|
|
34505
|
+
try {
|
|
34506
|
+
const invocation = await commands.getInvocation(actionName, event.invocationId);
|
|
34507
|
+
input = invocation.input ?? {};
|
|
34508
|
+
} catch (error101) {
|
|
34509
|
+
reportActionError(wiring, actionName, "load_invocation", `failed to load invocation "${event.invocationId}":`, error101);
|
|
34510
|
+
}
|
|
34511
|
+
const result = await actions.invoke({
|
|
34512
|
+
name: actionName,
|
|
34513
|
+
input,
|
|
34514
|
+
caller: { name: event.callerName, type: "agent" }
|
|
34515
|
+
});
|
|
34516
|
+
try {
|
|
34517
|
+
await commands.completeInvocation(actionName, event.invocationId, result.ok ? { output: toOutputRecord(result.output) } : { error: result.error?.message ?? "handler failed" });
|
|
34518
|
+
} catch (error101) {
|
|
34519
|
+
reportActionError(wiring, actionName, "complete_invocation", `failed to complete invocation "${event.invocationId}":`, error101);
|
|
34520
|
+
}
|
|
34521
|
+
}
|
|
34522
|
+
function toOutputRecord(output) {
|
|
34523
|
+
if (output !== null && typeof output === "object" && !Array.isArray(output)) {
|
|
34524
|
+
return output;
|
|
34525
|
+
}
|
|
34526
|
+
return { value: output };
|
|
34527
|
+
}
|
|
34528
|
+
function createNotifyHandler(messages, target, options) {
|
|
34529
|
+
return async () => {
|
|
34530
|
+
const subject = options.subject ? `@${resolveAgentName(options.subject)}` : void 0;
|
|
34531
|
+
const label = options.type ?? options.action ?? "notification";
|
|
34532
|
+
const text = options.text ?? [`[${label}]`, subject].filter(Boolean).join(" ");
|
|
34533
|
+
await messages.dm({
|
|
34534
|
+
to: resolveAgentName(target),
|
|
34535
|
+
text,
|
|
34536
|
+
mode: deliveryToMode(options.delivery)
|
|
34537
|
+
});
|
|
34538
|
+
};
|
|
34539
|
+
}
|
|
34540
|
+
|
|
34426
34541
|
// ../sdk/dist/agent-relay.js
|
|
34427
34542
|
var AgentRelay = class _AgentRelay {
|
|
34428
34543
|
messaging;
|
|
@@ -34434,14 +34549,18 @@ var AgentRelay = class _AgentRelay {
|
|
|
34434
34549
|
enrichedMessages;
|
|
34435
34550
|
workspaceFacade;
|
|
34436
34551
|
hub;
|
|
34552
|
+
errorHooks = /* @__PURE__ */ new Set();
|
|
34437
34553
|
constructor(options = {}) {
|
|
34438
|
-
const { messaging, actions, workspaceKey, createAgentMessaging, ...messagingOptions } = options;
|
|
34554
|
+
const { messaging, actions, workspaceKey, createAgentMessaging, onError, ...messagingOptions } = options;
|
|
34439
34555
|
const resolvedWorkspaceKey = workspaceKey ?? messagingOptions.apiKey;
|
|
34440
34556
|
this.workspaceKey = resolvedWorkspaceKey;
|
|
34441
34557
|
this.messagingOptions = { ...messagingOptions, workspaceKey: resolvedWorkspaceKey };
|
|
34442
34558
|
this.messaging = messaging ?? new RelaycastMessagingClient(this.messagingOptions);
|
|
34443
34559
|
this.actions = actions ?? new ActionRegistry();
|
|
34444
34560
|
this.createAgentMessaging = createAgentMessaging ?? ((token) => new RelaycastMessagingClient({ ...this.messagingOptions, agentToken: token }));
|
|
34561
|
+
if (onError) {
|
|
34562
|
+
this.errorHooks.add(onError);
|
|
34563
|
+
}
|
|
34445
34564
|
}
|
|
34446
34565
|
static async createWorkspace(input) {
|
|
34447
34566
|
const options = typeof input === "string" ? { name: input } : input;
|
|
@@ -34452,7 +34571,7 @@ var AgentRelay = class _AgentRelay {
|
|
|
34452
34571
|
});
|
|
34453
34572
|
const workspaceKey = extractWorkspaceKey(workspace);
|
|
34454
34573
|
if (!workspaceKey) {
|
|
34455
|
-
throw new
|
|
34574
|
+
throw new RelayError("transport_error", "Workspace created, but the response did not include a workspace key.", { retryable: false });
|
|
34456
34575
|
}
|
|
34457
34576
|
return new _AgentRelay({
|
|
34458
34577
|
workspaceKey,
|
|
@@ -34485,7 +34604,9 @@ var AgentRelay = class _AgentRelay {
|
|
|
34485
34604
|
}
|
|
34486
34605
|
get listenerHub() {
|
|
34487
34606
|
if (!this.hub) {
|
|
34488
|
-
this.hub = createListenerHub(this.messaging.events, this.actions
|
|
34607
|
+
this.hub = createListenerHub(this.messaging.events, this.actions, {
|
|
34608
|
+
onError: (error101, context) => this.reportError(error101, context)
|
|
34609
|
+
});
|
|
34489
34610
|
}
|
|
34490
34611
|
return this.hub;
|
|
34491
34612
|
}
|
|
@@ -34516,7 +34637,7 @@ var AgentRelay = class _AgentRelay {
|
|
|
34516
34637
|
id: registration.id,
|
|
34517
34638
|
name: registration.name,
|
|
34518
34639
|
token: registration.token
|
|
34519
|
-
});
|
|
34640
|
+
}, { onError: (error101, context) => this.reportError(error101, context) });
|
|
34520
34641
|
}
|
|
34521
34642
|
/** Rehydrate a live client from a persisted agent token, resolving identity from the relay. */
|
|
34522
34643
|
async reconnectAgent(apiToken) {
|
|
@@ -34526,15 +34647,43 @@ var AgentRelay = class _AgentRelay {
|
|
|
34526
34647
|
id: identity.id,
|
|
34527
34648
|
name: identity.name,
|
|
34528
34649
|
token: apiToken
|
|
34529
|
-
});
|
|
34650
|
+
}, { onError: (error101, context) => this.reportError(error101, context) });
|
|
34530
34651
|
}
|
|
34531
34652
|
registerAction(def) {
|
|
34532
|
-
return registerFacadeAction(this.actions, def, {
|
|
34653
|
+
return registerFacadeAction(this.actions, def, {
|
|
34654
|
+
messaging: this.messaging,
|
|
34655
|
+
onError: (error101, context) => this.reportError(error101, context)
|
|
34656
|
+
});
|
|
34533
34657
|
}
|
|
34534
|
-
/** Subscribe by dotted event name, `'*'`/prefix wildcard, or a predicate. */
|
|
34535
34658
|
addListener(selector, handler) {
|
|
34536
34659
|
return this.listenerHub.addListener(selector, handler);
|
|
34537
34660
|
}
|
|
34661
|
+
once(selector, handler) {
|
|
34662
|
+
return this.listenerHub.once(selector, handler);
|
|
34663
|
+
}
|
|
34664
|
+
/**
|
|
34665
|
+
* Register a hook that receives listener and action handler errors. Returns
|
|
34666
|
+
* an unsubscribe callback. When no hook is registered, errors are logged as
|
|
34667
|
+
* console warnings.
|
|
34668
|
+
*/
|
|
34669
|
+
onError(hook) {
|
|
34670
|
+
this.errorHooks.add(hook);
|
|
34671
|
+
return () => {
|
|
34672
|
+
this.errorHooks.delete(hook);
|
|
34673
|
+
};
|
|
34674
|
+
}
|
|
34675
|
+
reportError(error101, context) {
|
|
34676
|
+
if (this.errorHooks.size === 0) {
|
|
34677
|
+
logRelayHandlerError(error101, context);
|
|
34678
|
+
return;
|
|
34679
|
+
}
|
|
34680
|
+
for (const hook of this.errorHooks) {
|
|
34681
|
+
try {
|
|
34682
|
+
hook(error101, context);
|
|
34683
|
+
} catch {
|
|
34684
|
+
}
|
|
34685
|
+
}
|
|
34686
|
+
}
|
|
34538
34687
|
action(name) {
|
|
34539
34688
|
return this.listenerHub.action(name);
|
|
34540
34689
|
}
|
|
@@ -34564,9 +34713,9 @@ function extractWorkspaceKey(payload) {
|
|
|
34564
34713
|
const value = payload.workspaceKey ?? payload.workspace_key ?? payload.apiKey ?? payload.api_key ?? data.workspaceKey ?? data.workspace_key ?? data.apiKey ?? data.api_key;
|
|
34565
34714
|
return typeof value === "string" && value.trim() ? value : void 0;
|
|
34566
34715
|
}
|
|
34567
|
-
function agentRelayAgent(messaging, actions, handlerAgent) {
|
|
34716
|
+
function agentRelayAgent(messaging, actions, handlerAgent, options) {
|
|
34568
34717
|
const messages = createEnrichedMessages(messaging.messages, () => messaging.messages);
|
|
34569
|
-
const hub = createListenerHub(messaging.events, actions);
|
|
34718
|
+
const hub = createListenerHub(messaging.events, actions, { onError: options?.onError });
|
|
34570
34719
|
return {
|
|
34571
34720
|
messaging,
|
|
34572
34721
|
agents: messaging.agents,
|
|
@@ -34580,15 +34729,16 @@ function agentRelayAgent(messaging, actions, handlerAgent) {
|
|
|
34580
34729
|
webhooks: messaging.webhooks,
|
|
34581
34730
|
capabilities: messaging.commands,
|
|
34582
34731
|
workspace: createWorkspaceFacade(messaging),
|
|
34583
|
-
registerAction: (def) => registerFacadeAction(actions, def, { messaging, handlerAgent }),
|
|
34584
|
-
addListener: (selector, handler) => hub.addListener(selector, handler),
|
|
34732
|
+
registerAction: (def) => registerFacadeAction(actions, def, { messaging, handlerAgent, onError: options?.onError }),
|
|
34733
|
+
addListener: ((selector, handler) => hub.addListener(selector, handler)),
|
|
34734
|
+
once: ((selector, handler) => hub.once(selector, handler)),
|
|
34585
34735
|
action: (name) => hub.action(name),
|
|
34586
34736
|
agent: (input) => hub.agent(input),
|
|
34587
34737
|
emitSessionEvent: (agentId, event) => hub.emitSessionEvent(agentId, event)
|
|
34588
34738
|
};
|
|
34589
34739
|
}
|
|
34590
|
-
function assembleAgentClient(messaging, actions, identity) {
|
|
34591
|
-
const base = agentRelayAgent(messaging, actions, identity.name);
|
|
34740
|
+
function assembleAgentClient(messaging, actions, identity, options) {
|
|
34741
|
+
const base = agentRelayAgent(messaging, actions, identity.name, options);
|
|
34592
34742
|
const handle = createAgentHandle(identity);
|
|
34593
34743
|
return {
|
|
34594
34744
|
...base,
|
|
@@ -36163,11 +36313,13 @@ function generateRequestId(prefix = "") {
|
|
|
36163
36313
|
MessageReactedPredicate,
|
|
36164
36314
|
MessageReadPredicate,
|
|
36165
36315
|
RelayCapabilityError,
|
|
36316
|
+
RelayError,
|
|
36166
36317
|
RelaycastMessagingClient,
|
|
36167
36318
|
StaticPatterns,
|
|
36168
36319
|
StatusPredicate,
|
|
36169
36320
|
ToolCalledPredicate,
|
|
36170
36321
|
TracedError,
|
|
36322
|
+
TypedActionPredicate,
|
|
36171
36323
|
actionSchemaToJsonSchema,
|
|
36172
36324
|
agentRelayAgent,
|
|
36173
36325
|
agentTokenRecoveryMessage,
|
|
@@ -36189,6 +36341,7 @@ function generateRequestId(prefix = "") {
|
|
|
36189
36341
|
createRequestEnvelope,
|
|
36190
36342
|
createRequestHandler,
|
|
36191
36343
|
createTraceableError,
|
|
36344
|
+
createTypedActionHandle,
|
|
36192
36345
|
createWorkspaceFacade,
|
|
36193
36346
|
defineHarness,
|
|
36194
36347
|
findGitRoot,
|
|
@@ -36221,6 +36374,7 @@ function generateRequestId(prefix = "") {
|
|
|
36221
36374
|
isSpawnOrReleaseCommandFast,
|
|
36222
36375
|
isValidAgentName,
|
|
36223
36376
|
logAndTraceError,
|
|
36377
|
+
logRelayHandlerError,
|
|
36224
36378
|
mapModelToCli,
|
|
36225
36379
|
matchesSelector,
|
|
36226
36380
|
nextHarnessName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-relay",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "Real-time agent-to-agent communication system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"pack:validate": "npm pack --dry-run"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agent-relay/cloud": "8.
|
|
47
|
-
"@agent-relay/config": "8.
|
|
48
|
-
"@agent-relay/harness-driver": "8.
|
|
49
|
-
"@agent-relay/sdk": "8.
|
|
50
|
-
"@agent-relay/utils": "8.
|
|
46
|
+
"@agent-relay/cloud": "8.4.0",
|
|
47
|
+
"@agent-relay/config": "8.4.0",
|
|
48
|
+
"@agent-relay/harness-driver": "8.4.0",
|
|
49
|
+
"@agent-relay/sdk": "8.4.0",
|
|
50
|
+
"@agent-relay/utils": "8.4.0",
|
|
51
51
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
52
52
|
"@relaycast/sdk": "^3.1.1",
|
|
53
53
|
"@relayflows/cli": "^1.0.1",
|