@agentconnect.md/daemon 1.0.0-rc.280 → 1.0.0-rc.282

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.
@@ -1,4 +1,4 @@
1
- import { o as loadConfig, t as discoverAgents } from "./load-agents-Amic2B8b.js";
1
+ import { o as loadConfig, t as discoverAgents } from "./load-agents-DzCnR0cj.js";
2
2
  //#region src/cli/agent-list.ts
3
3
  async function runAgentList(opts) {
4
4
  const out = opts.out ?? process.stdout;
@@ -18,4 +18,4 @@ async function runAgentList(opts) {
18
18
  //#endregion
19
19
  export { runAgentList };
20
20
 
21
- //# sourceMappingURL=agent-list-DRSg2Fhd.js.map
21
+ //# sourceMappingURL=agent-list-BK1xbKJd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-list-DRSg2Fhd.js","names":[],"sources":["../src/cli/agent-list.ts"],"sourcesContent":["import { loadConfig } from '../config/load-config.js'\nimport { discoverAgents } from '../agents/load-agents.js'\n\nexport interface RunAgentListOpts {\n agentsDir?: string\n configPath?: string\n root?: string\n out?: NodeJS.WritableStream\n}\n\n// Read-only view of the local agent directory. Mutating agents (add/remove/\n// enable/disable) is intentionally not a CLI command — agent business config is\n// owned by the Control Plane (agent/upsert + register/ok roster, see\n// cp/cp-agent-registry.ts) or by hand-editing agent.json; the daemon only\n// reconciles what it finds on disk. This lists what that discovery sees.\nexport async function runAgentList(opts: RunAgentListOpts): Promise<void> {\n const out = opts.out ?? process.stdout\n const cfg = loadConfig({\n root: opts.root,\n configPath: opts.configPath,\n optional: true,\n overrides: { agentsDir: opts.agentsDir }\n })\n const agentsDir = cfg.agentsDir!\n const discovered = discoverAgents(agentsDir)\n if (discovered.length === 0) {\n out.write(`no agents found under ${agentsDir}\\n`)\n return\n }\n for (const { agent, dir } of discovered) {\n out.write(`${agent.id}\\t${agent.status}\\t${agent.runtime}\\t${agent.name}\\t${dir}\\n`)\n }\n}\n"],"mappings":";;AAeA,eAAsB,aAAa,MAAuC;CACxE,MAAM,MAAM,KAAK,OAAO,QAAQ;CAOhC,MAAM,YANM,WAAW;EACrB,MAAM,KAAK;EACX,YAAY,KAAK;EACjB,UAAU;EACV,WAAW,EAAE,WAAW,KAAK,UAAU;CACzC,CACoB,CAAC,CAAC;CACtB,MAAM,aAAa,eAAe,SAAS;CAC3C,IAAI,WAAW,WAAW,GAAG;EAC3B,IAAI,MAAM,yBAAyB,UAAU,GAAG;EAChD;CACF;CACA,KAAK,MAAM,EAAE,OAAO,SAAS,YAC3B,IAAI,MAAM,GAAG,MAAM,GAAG,IAAI,MAAM,OAAO,IAAI,MAAM,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,GAAG;AAEvF"}
1
+ {"version":3,"file":"agent-list-BK1xbKJd.js","names":[],"sources":["../src/cli/agent-list.ts"],"sourcesContent":["import { loadConfig } from '../config/load-config.js'\nimport { discoverAgents } from '../agents/load-agents.js'\n\nexport interface RunAgentListOpts {\n agentsDir?: string\n configPath?: string\n root?: string\n out?: NodeJS.WritableStream\n}\n\n// Read-only view of the local agent directory. Mutating agents (add/remove/\n// enable/disable) is intentionally not a CLI command — agent business config is\n// owned by the Control Plane (agent/upsert + register/ok roster, see\n// cp/cp-agent-registry.ts) or by hand-editing agent.json; the daemon only\n// reconciles what it finds on disk. This lists what that discovery sees.\nexport async function runAgentList(opts: RunAgentListOpts): Promise<void> {\n const out = opts.out ?? process.stdout\n const cfg = loadConfig({\n root: opts.root,\n configPath: opts.configPath,\n optional: true,\n overrides: { agentsDir: opts.agentsDir }\n })\n const agentsDir = cfg.agentsDir!\n const discovered = discoverAgents(agentsDir)\n if (discovered.length === 0) {\n out.write(`no agents found under ${agentsDir}\\n`)\n return\n }\n for (const { agent, dir } of discovered) {\n out.write(`${agent.id}\\t${agent.status}\\t${agent.runtime}\\t${agent.name}\\t${dir}\\n`)\n }\n}\n"],"mappings":";;AAeA,eAAsB,aAAa,MAAuC;CACxE,MAAM,MAAM,KAAK,OAAO,QAAQ;CAOhC,MAAM,YANM,WAAW;EACrB,MAAM,KAAK;EACX,YAAY,KAAK;EACjB,UAAU;EACV,WAAW,EAAE,WAAW,KAAK,UAAU;CACzC,CACoB,CAAC,CAAC;CACtB,MAAM,aAAa,eAAe,SAAS;CAC3C,IAAI,WAAW,WAAW,GAAG;EAC3B,IAAI,MAAM,yBAAyB,UAAU,GAAG;EAChD;CACF;CACA,KAAK,MAAM,EAAE,OAAO,SAAS,YAC3B,IAAI,MAAM,GAAG,MAAM,GAAG,IAAI,MAAM,OAAO,IAAI,MAAM,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,GAAG;AAEvF"}
@@ -1,6 +1,6 @@
1
- import { a as agentChildEnv, i as selectAgent, o as loadConfig } from "./load-agents-Amic2B8b.js";
1
+ import { a as agentChildEnv, i as selectAgent, o as loadConfig } from "./load-agents-DzCnR0cj.js";
2
2
  import { l as resolveRoot } from "./paths-DEcUO8lC.js";
3
- import { S as resolveRuntimes, d as memoryProviderFor, i as prepareWorkspace, t as AcpHost } from "./acp-host-CrjtbS3A.js";
3
+ import { S as resolveRuntimes, d as memoryProviderFor, i as prepareWorkspace, t as AcpHost } from "./acp-host-C-4zFhF8.js";
4
4
  import { createInterface } from "node:readline";
5
5
  //#region src/cli/chat.ts
6
6
  function renderUpdate(out) {
@@ -84,4 +84,4 @@ async function runChat(opts) {
84
84
  //#endregion
85
85
  export { renderUpdate, runChat };
86
86
 
87
- //# sourceMappingURL=chat-4Is9zl7L.js.map
87
+ //# sourceMappingURL=chat-B8VEWuix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-4Is9zl7L.js","names":[],"sources":["../src/cli/chat.ts"],"sourcesContent":["import { createInterface } from 'node:readline'\nimport type { ContentBlock, SessionUpdate } from '@agentclientprotocol/sdk'\nimport { loadConfig } from '../config/load-config.js'\nimport { resolveRuntimes } from '../runtimes/registry.js'\nimport { selectAgent } from '../agents/load-agents.js'\nimport { agentChildEnv } from '../agents/agent-env.js'\nimport { memoryProviderFor } from '../agents/memory-provider.js'\nimport { prepareWorkspace } from '../workspace/workspace-manager.js'\nimport { AcpHost } from '../acp/acp-host.js'\nimport { resolveRoot } from '../paths.js'\n\nexport function renderUpdate(out: NodeJS.WritableStream) {\n return (_sessionId: string, update: SessionUpdate): void => {\n if (update.sessionUpdate === 'agent_message_chunk' && update.content.type === 'text') {\n out.write(update.content.text)\n } else if (update.sessionUpdate === 'tool_call') {\n const title = ('title' in update && update.title) || update.toolCallId || 'tool'\n out.write(`\\n[tool] ${title}\\n`)\n }\n }\n}\n\nexport interface RunChatOpts {\n agentsDir?: string\n agentName?: string\n message?: string\n configPath?: string\n root?: string\n out?: NodeJS.WritableStream\n input?: NodeJS.ReadableStream\n}\n\nexport async function runChat(opts: RunChatOpts): Promise<void> {\n const out = opts.out ?? process.stdout\n const root = resolveRoot(opts.root)\n const cfg = loadConfig({\n root: opts.root,\n configPath: opts.configPath,\n optional: true,\n overrides: { agentsDir: opts.agentsDir }\n })\n const agent = selectAgent(cfg.agentsDir!, opts.agentName)\n\n const runtimes = await resolveRuntimes(cfg, root, { neededRuntimes: [agent.runtime], mode: 'cache-first' })\n const runtime = runtimes[agent.runtime]\n if (!runtime) {\n const available = Object.keys(runtimes).sort().join(', ') || '(none)'\n throw new Error(`runtime \"${agent.runtime}\" not found. Available: ${available}`)\n }\n\n const host = new AcpHost(runtime, {\n onUpdate: renderUpdate(out),\n // Memory-backend env for parity with the daemon (managed disables the runtime's\n // own memory; native redirects it under the agent root).\n env: { ...agentChildEnv(agent), ...memoryProviderFor(agent, runtime).runtimeEnv() },\n configPrefs: {\n model: agent.runtimeOverrides?.model,\n permissionMode: agent.permissionMode,\n reasoningEffort: agent.reasoningEffort,\n fastMode: agent.fastMode\n }\n })\n // The adapter child runs in its own process group (see AcpHost.start), so a\n // terminal Ctrl-C no longer kills it as a side effect — Node's default SIGINT\n // exit would skip the finally below and leak it. Stop the host, then re-exit.\n // Registered BEFORE start(): a first-run `npx -y` runtime download takes long\n // enough that Ctrl-C mid-start is common, and the spawn happens early in start().\n const onSigint = () => {\n void host.stop().finally(() => process.exit(130))\n }\n process.once('SIGINT', onSigint)\n try {\n await host.start()\n const cwd = await prepareWorkspace(agent)\n const sessionId = await host.newSession(cwd)\n\n const send = async (text: string) => {\n const blocks: ContentBlock[] = [{ type: 'text', text }]\n await host.prompt(sessionId, blocks)\n out.write('\\n')\n }\n\n if (typeof opts.message === 'string' && opts.message.length > 0) {\n await send(opts.message)\n return\n }\n\n const rl = createInterface({ input: opts.input ?? process.stdin })\n out.write(`Chatting with ${agent.name} (${agent.id}). Type .exit to quit.\\n> `)\n try {\n for await (const line of rl) {\n const text = line.trim()\n if (text === '.exit' || text === '.quit') break\n if (text.length > 0) await send(text)\n out.write('> ')\n }\n } finally {\n rl.close()\n }\n } finally {\n process.removeListener('SIGINT', onSigint)\n await host.stop()\n }\n}\n"],"mappings":";;;;;AAWA,SAAgB,aAAa,KAA4B;CACvD,QAAQ,YAAoB,WAAgC;EAC1D,IAAI,OAAO,kBAAkB,yBAAyB,OAAO,QAAQ,SAAS,QAC5E,IAAI,MAAM,OAAO,QAAQ,IAAI;OACxB,IAAI,OAAO,kBAAkB,aAAa;GAC/C,MAAM,QAAS,WAAW,UAAU,OAAO,SAAU,OAAO,cAAc;GAC1E,IAAI,MAAM,YAAY,MAAM,GAAG;EACjC;CACF;AACF;AAYA,eAAsB,QAAQ,MAAkC;CAC9D,MAAM,MAAM,KAAK,OAAO,QAAQ;CAChC,MAAM,OAAO,YAAY,KAAK,IAAI;CAClC,MAAM,MAAM,WAAW;EACrB,MAAM,KAAK;EACX,YAAY,KAAK;EACjB,UAAU;EACV,WAAW,EAAE,WAAW,KAAK,UAAU;CACzC,CAAC;CACD,MAAM,QAAQ,YAAY,IAAI,WAAY,KAAK,SAAS;CAExD,MAAM,WAAW,MAAM,gBAAgB,KAAK,MAAM;EAAE,gBAAgB,CAAC,MAAM,OAAO;EAAG,MAAM;CAAc,CAAC;CAC1G,MAAM,UAAU,SA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KAAK,IAAI;IACpC,IAAI,MAAM,IAAI;GAChB;EACF,UAAU;GACR,GAAG,MAAM;EACX;CACF,UAAU;EACR,QAAQ,eAAe,UAAU,QAAQ;EACzC,MAAM,KAAK,KAAK;CAClB;AACF"}
1
+ {"version":3,"file":"chat-B8VEWuix.js","names":[],"sources":["../src/cli/chat.ts"],"sourcesContent":["import { createInterface } from 'node:readline'\nimport type { ContentBlock, SessionUpdate } from '@agentclientprotocol/sdk'\nimport { loadConfig } from '../config/load-config.js'\nimport { resolveRuntimes } from '../runtimes/registry.js'\nimport { selectAgent } from '../agents/load-agents.js'\nimport { agentChildEnv } from '../agents/agent-env.js'\nimport { memoryProviderFor } from '../agents/memory-provider.js'\nimport { prepareWorkspace } from '../workspace/workspace-manager.js'\nimport { AcpHost } from '../acp/acp-host.js'\nimport { resolveRoot } from '../paths.js'\n\nexport function renderUpdate(out: NodeJS.WritableStream) {\n return (_sessionId: string, update: SessionUpdate): void => {\n if (update.sessionUpdate === 'agent_message_chunk' && update.content.type === 'text') {\n out.write(update.content.text)\n } else if (update.sessionUpdate === 'tool_call') {\n const title = ('title' in update && update.title) || update.toolCallId || 'tool'\n out.write(`\\n[tool] ${title}\\n`)\n }\n }\n}\n\nexport interface RunChatOpts {\n agentsDir?: string\n agentName?: string\n message?: string\n configPath?: string\n root?: string\n out?: NodeJS.WritableStream\n input?: NodeJS.ReadableStream\n}\n\nexport async function runChat(opts: RunChatOpts): Promise<void> {\n const out = opts.out ?? process.stdout\n const root = resolveRoot(opts.root)\n const cfg = loadConfig({\n root: opts.root,\n configPath: opts.configPath,\n optional: true,\n overrides: { agentsDir: opts.agentsDir }\n })\n const agent = selectAgent(cfg.agentsDir!, opts.agentName)\n\n const runtimes = await resolveRuntimes(cfg, root, { neededRuntimes: [agent.runtime], mode: 'cache-first' })\n const runtime = runtimes[agent.runtime]\n if (!runtime) {\n const available = Object.keys(runtimes).sort().join(', ') || '(none)'\n throw new Error(`runtime \"${agent.runtime}\" not found. Available: ${available}`)\n }\n\n const host = new AcpHost(runtime, {\n onUpdate: renderUpdate(out),\n // Memory-backend env for parity with the daemon (managed disables the runtime's\n // own memory; native redirects it under the agent root).\n env: { ...agentChildEnv(agent), ...memoryProviderFor(agent, runtime).runtimeEnv() },\n configPrefs: {\n model: agent.runtimeOverrides?.model,\n permissionMode: agent.permissionMode,\n reasoningEffort: agent.reasoningEffort,\n fastMode: agent.fastMode\n }\n })\n // The adapter child runs in its own process group (see AcpHost.start), so a\n // terminal Ctrl-C no longer kills it as a side effect — Node's default SIGINT\n // exit would skip the finally below and leak it. Stop the host, then re-exit.\n // Registered BEFORE start(): a first-run `npx -y` runtime download takes long\n // enough that Ctrl-C mid-start is common, and the spawn happens early in start().\n const onSigint = () => {\n void host.stop().finally(() => process.exit(130))\n }\n process.once('SIGINT', onSigint)\n try {\n await host.start()\n const cwd = await prepareWorkspace(agent)\n const sessionId = await host.newSession(cwd)\n\n const send = async (text: string) => {\n const blocks: ContentBlock[] = [{ type: 'text', text }]\n await host.prompt(sessionId, blocks)\n out.write('\\n')\n }\n\n if (typeof opts.message === 'string' && opts.message.length > 0) {\n await send(opts.message)\n return\n }\n\n const rl = createInterface({ input: opts.input ?? process.stdin })\n out.write(`Chatting with ${agent.name} (${agent.id}). Type .exit to quit.\\n> `)\n try {\n for await (const line of rl) {\n const text = line.trim()\n if (text === '.exit' || text === '.quit') break\n if (text.length > 0) await send(text)\n out.write('> ')\n }\n } finally {\n rl.close()\n }\n } finally {\n process.removeListener('SIGINT', onSigint)\n await host.stop()\n }\n}\n"],"mappings":";;;;;AAWA,SAAgB,aAAa,KAA4B;CACvD,QAAQ,YAAoB,WAAgC;EAC1D,IAAI,OAAO,kBAAkB,yBAAyB,OAAO,QAAQ,SAAS,QAC5E,IAAI,MAAM,OAAO,QAAQ,IAAI;OACxB,IAAI,OAAO,kBAAkB,aAAa;GAC/C,MAAM,QAAS,WAAW,UAAU,OAAO,SAAU,OAAO,cAAc;GAC1E,IAAI,MAAM,YAAY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AM;GACnC,IAAI,MAAM,IAAI;EAChB;EAEA,IAAI,OAAO,KAAK,YAAY,YAAY,KAAK,QAAQ,SAAS,GAAG;GAC/D,MAAM,KAAK,KAAK,OAAO;GACvB;EACF;EAEA,MAAM,KAAK,gBAAgB,EAAE,OAAO,KAAK,SAAS,QAAQ,MAAM,CAAC;EACjE,IAAI,MAAM,iBAAiB,MAAM,KAAK,IAAI,MAAM,GAAG,2BAA2B;EAC9E,IAAI;GACF,WAAW,MAAM,QAAQ,IAAI;IAC3B,MAAM,OAAO,KAAK,KAAK;IACvB,IAAI,SAAS,WAAW,SAAS,SAAS;IAC1C,IAAI,KAAK,SAAS,GAAG,MAAM,KAAK,IAAI;IACpC,IAAI,MAAM,IAAI;GAChB;EACF,UAAU;GACR,GAAG,MAAM;EACX;CACF,UAAU;EACR,QAAQ,eAAe,UAAU,QAAQ;EACzC,MAAM,KAAK,KAAK;CAClB;AACF"}
package/dist/index.js CHANGED
@@ -68492,9 +68492,9 @@ const telemetry = startDaemonOpenTelemetry({ serviceVersion: DAEMON_VERSION });
68492
68492
  const [{ Command }, { fileURLToPath }, { runChat }, { runLogin }, { runForeground }, { resolveController }, { acquireSingletonLock }, { resolveRoot }] = await Promise.all([
68493
68493
  import("./commander-B5QVEFzH.js"),
68494
68494
  import("node:url"),
68495
- import("./chat-4Is9zl7L.js"),
68496
- import("./login-CzDsJwym.js"),
68497
- import("./run-foreground-CfLjjwW7.js"),
68495
+ import("./chat-B8VEWuix.js"),
68496
+ import("./login-OT3DwN02.js"),
68497
+ import("./run-foreground-Cz_WXUfg.js"),
68498
68498
  import("./service-6w0WKhdx.js"),
68499
68499
  import("./lock-CA9Bm8_s.js"),
68500
68500
  import("./paths-CcRUjFjy.js")
@@ -68652,7 +68652,7 @@ program.command("git-credential").description("Git credential helper backed by t
68652
68652
  program.command("agent").description("Inspect local agent directories").command("list").description("List agents discovered under --agents-dir (id, status, runtime, name, dir)").action(async () => {
68653
68653
  const opts = program.opts();
68654
68654
  try {
68655
- const { runAgentList } = await import("./agent-list-DRSg2Fhd.js");
68655
+ const { runAgentList } = await import("./agent-list-BK1xbKJd.js");
68656
68656
  await runAgentList({
68657
68657
  agentsDir: opts.agentsDir,
68658
68658
  configPath: opts.config,
@@ -512,6 +512,63 @@ const IntegrationChannels = object({
512
512
  channels: array(IntegrationChannel)
513
513
  });
514
514
  //#endregion
515
+ //#region ../protocol/dist/frames/collab.js
516
+ /**
517
+ * Bot-AGNOSTIC agent-collaboration routing snapshot (agent-collaboration §2.3 / §6.2 / §6.5).
518
+ *
519
+ * The existing shared-bot `members` table is keyed by botId (`BotAssignment`) and
520
+ * CANNOT address an agent on a DIFFERENT bot / arbitrary channel. This snapshot is
521
+ * the fix: it maps a channel — `(orgId, platform, channelId)` — to the per-agent
522
+ * placement + call policy the relay needs to route a cross-daemon `rd/agentmsg` and
523
+ * the target daemon needs to terminal-verify a remote caller.
524
+ *
525
+ * It carries NO message body — pure routing/policy metadata, like the rest of the
526
+ * control plane. The SAME shape is distributed two ways (§6.5):
527
+ * - CP→relay over the `rc/*` wire (`rc/collab-routes`) — the relay routes
528
+ * `toAgentId` → owning `daemonId` and authorizes the caller/target policy.
529
+ * - CP→daemon over the daemon↔CP wire — as a `register/ok` field (reconnect
530
+ * baseline) + a `collaboration/routes` EVT (hot push) — so the OWNING daemon of
531
+ * the target can terminal-verify (defense in depth, §2.5 #4) the remote caller's
532
+ * org/channel/placement against its OWN copy, never trusting the relay's claim
533
+ * blindly.
534
+ *
535
+ * FOLLOW-UP (scoped down in P2, see PR description): the full versioned lifecycle
536
+ * of §6.5 — per-entry tombstones, TTL/expiry after a CP disconnect, and
537
+ * fail-closed-on-stale — is NOT fully implemented here. `generation` is present as
538
+ * the version hook and the snapshot is FULL-REPLACE (converge-don't-diff, same as
539
+ * `register/ok`), which is enough to route + authorize on a live CP. TTL-expiry and
540
+ * tombstone semantics are a follow-up within this phase.
541
+ */
542
+ /** One agent's placement + call policy within a channel. `daemonId` is the owning
543
+ * daemon the relay forwards to; `integrationId` is the DEFINITE reply integration
544
+ * (§6.2 — no fallback to "first connection"). */
545
+ const CollabAgentPlacement = object({
546
+ agentId: string().uuid(),
547
+ daemonId: string().uuid(),
548
+ integrationId: string().uuid().optional(),
549
+ callPolicy: _enum(["all", "selected"]).default("all"),
550
+ allowedCallerAgentIds: array(string()).default([])
551
+ });
552
+ /** All agents present in one channel, across daemons. `orgId` scopes routing +
553
+ * authorization: a cross-org caller/target pair never resolves (§2.5 — cross-org
554
+ * rejected). */
555
+ const CollabChannelRoute = object({
556
+ orgId: string().uuid(),
557
+ platform: Platform,
558
+ channelId: string().min(1),
559
+ agents: array(CollabAgentPlacement)
560
+ });
561
+ /**
562
+ * The full collaboration snapshot — FULL-REPLACE (converge-don't-diff): the
563
+ * recipient replaces its whole table with `channels`. `generation` monotonically
564
+ * increases per source so a recipient can ignore a stale re-order (version hook for
565
+ * the §6.5 lifecycle follow-up).
566
+ */
567
+ const CollabRoutesSnapshot = object({
568
+ generation: number().int().nonnegative().default(0),
569
+ channels: array(CollabChannelRoute).default([])
570
+ });
571
+ //#endregion
515
572
  //#region ../protocol/dist/frames/register.js
516
573
  /**
517
574
  * Capability upload + the reconcile snapshot — protocol §3.3.
@@ -561,6 +618,10 @@ const RegisterOk = object({
561
618
  integrations: array(IntegrationSpec).default([]),
562
619
  leases: array(SecretsGrant),
563
620
  relays: array(RelayRosterEntry).default([]),
621
+ collabRoutes: CollabRoutesSnapshot.default({
622
+ generation: 0,
623
+ channels: []
624
+ }),
564
625
  drop: object({
565
626
  assignments: array(string()),
566
627
  crons: array(string())
@@ -1280,6 +1341,7 @@ const FRAME_SCHEMAS = {
1280
1341
  register: RegisterReq,
1281
1342
  "register/ok": RegisterOk,
1282
1343
  "relay/roster": RelayRosterUpdate,
1344
+ "collaboration/routes": CollabRoutesSnapshot,
1283
1345
  heartbeat: Heartbeat,
1284
1346
  "agent/launch": AgentLaunch,
1285
1347
  "agent/launched": AgentLaunched,
@@ -1372,6 +1434,7 @@ discriminatedUnion("type", [
1372
1434
  frame("register", FRAME_SCHEMAS["register"]),
1373
1435
  frame("register/ok", FRAME_SCHEMAS["register/ok"]),
1374
1436
  frame("relay/roster", FRAME_SCHEMAS["relay/roster"]),
1437
+ frame("collaboration/routes", FRAME_SCHEMAS["collaboration/routes"]),
1375
1438
  frame("heartbeat", FRAME_SCHEMAS["heartbeat"]),
1376
1439
  frame("agent/launch", FRAME_SCHEMAS["agent/launch"]),
1377
1440
  frame("agent/launched", FRAME_SCHEMAS["agent/launched"]),
@@ -1680,6 +1743,7 @@ const RELAY_CP_SCHEMAS = {
1680
1743
  channelId: string().min(1),
1681
1744
  agentId: string().uuid().nullable()
1682
1745
  }),
1746
+ "rc/collab-routes": CollabRoutesSnapshot,
1683
1747
  error: ErrorFrame
1684
1748
  };
1685
1749
  Object.keys(RELAY_CP_SCHEMAS);
@@ -1701,6 +1765,7 @@ discriminatedUnion("type", [
1701
1765
  frameSchema("rc/routes", RELAY_CP_SCHEMAS["rc/routes"]),
1702
1766
  frameSchema("rc/assign", RELAY_CP_SCHEMAS["rc/assign"]),
1703
1767
  frameSchema("rc/set-channel-agent", RELAY_CP_SCHEMAS["rc/set-channel-agent"]),
1768
+ frameSchema("rc/collab-routes", RELAY_CP_SCHEMAS["rc/collab-routes"]),
1704
1769
  frameSchema("error", RELAY_CP_SCHEMAS["error"])
1705
1770
  ]);
1706
1771
  //#endregion
@@ -1843,6 +1908,84 @@ const RdAck = object({
1843
1908
  turnId: string().uuid().optional(),
1844
1909
  reason: string().optional()
1845
1910
  });
1911
+ /**
1912
+ * D→R REQ → `rd/agentmsg/ack`. A cross-daemon `messageAgent` (agent-collaboration
1913
+ * §2.3 / §6.2): the SOURCE daemon found the target is not local and routes over the
1914
+ * relay data plane (the body NEVER touches the CP).
1915
+ *
1916
+ * `claimedFromAgentId` is UNTRUSTED (§2.5/§6.2): a daemon hosts many agents, and the
1917
+ * `rd/hello` handshake only authenticates the socket's `daemonId` — it cannot prove
1918
+ * WHICH agent originated the call. The relay binds the request to the socket's
1919
+ * AUTHENTICATED daemonId, validates `claimedFromAgentId` actually belongs to that
1920
+ * daemon AND is in `coords` via the collaboration snapshot, checks the target's
1921
+ * callPolicy, resolves `toAgentId → daemonId`, and only then forwards a TRUSTED
1922
+ * claim (`RdAgentMsgFwd.trustedFromAgentId`) to the owning daemon.
1923
+ *
1924
+ * `deliveryId` is stable end-to-end (dedup at each hop, §6.3/§6.7). `hopCount` is
1925
+ * the depth of the SOURCE turn; the relay/target reject `hopCount+1 > cap` (§2.4).
1926
+ */
1927
+ const RdAgentMsg = object({
1928
+ claimedFromAgentId: string().uuid(),
1929
+ toAgentId: string().uuid(),
1930
+ text: string(),
1931
+ coords: object({
1932
+ platform: _enum([
1933
+ "slack",
1934
+ "telegram",
1935
+ "webchat",
1936
+ "discord"
1937
+ ]),
1938
+ channel: string().min(1),
1939
+ thread: string().optional()
1940
+ }),
1941
+ correlationId: string().optional(),
1942
+ hopCount: number().int().nonnegative(),
1943
+ deliveryId: string().min(1)
1944
+ });
1945
+ /**
1946
+ * R→D REQ → `rd/agentmsg/ack`. The relay forwards the validated call to the TARGET's
1947
+ * owning daemon, replacing the untrusted `claimedFromAgentId` with a TRUSTED caller
1948
+ * claim the relay minted after snapshot validation: `trustedFromAgentId` + the
1949
+ * asserted `orgId`/`platform`/`channel` the caller was verified in. The target daemon
1950
+ * TERMINAL-verifies this claim + its own callPolicy against its LOCAL snapshot
1951
+ * (defense in depth, §2.5 #4) before dispatching `source:'agent'`.
1952
+ */
1953
+ const RdAgentMsgFwd = object({
1954
+ trustedFromAgentId: string().uuid(),
1955
+ orgId: string().uuid(),
1956
+ toAgentId: string().uuid(),
1957
+ integrationId: string().uuid().optional(),
1958
+ text: string(),
1959
+ coords: object({
1960
+ platform: _enum([
1961
+ "slack",
1962
+ "telegram",
1963
+ "webchat",
1964
+ "discord"
1965
+ ]),
1966
+ channel: string().min(1),
1967
+ thread: string().optional()
1968
+ }),
1969
+ correlationId: string().optional(),
1970
+ hopCount: number().int().nonnegative(),
1971
+ deliveryId: string().min(1)
1972
+ });
1973
+ /** The typed admission verdict for an agent-call (§6.4). The ACK is returned after the
1974
+ * TARGET daemon durably admits/enqueues the turn (P4-gate) — NOT after the model turn.
1975
+ * `reason` is only set when `delivered:false`. */
1976
+ const RdAgentMsgReason = _enum([
1977
+ "busy",
1978
+ "offline",
1979
+ "queue_full",
1980
+ "not_allowed",
1981
+ "not_found",
1982
+ "hop_limit"
1983
+ ]);
1984
+ const RdAgentMsgAck = object({
1985
+ deliveryId: string().min(1),
1986
+ delivered: boolean(),
1987
+ reason: RdAgentMsgReason.optional()
1988
+ });
1846
1989
  const RdChatEvent = discriminatedUnion("kind", [object({
1847
1990
  kind: literal("output"),
1848
1991
  output: WebchatOutput
@@ -1856,6 +1999,9 @@ const RELAY_DAEMON_SCHEMAS = {
1856
1999
  "rd/hello/ok": RdHelloOk,
1857
2000
  "rd/msg": RdMsg,
1858
2001
  "rd/ack": RdAck,
2002
+ "rd/agentmsg": RdAgentMsg,
2003
+ "rd/agentmsg/fwd": RdAgentMsgFwd,
2004
+ "rd/agentmsg/ack": RdAgentMsgAck,
1859
2005
  "rd/chat": object({
1860
2006
  chatId: string().uuid(),
1861
2007
  seq: number().int(),
@@ -1869,6 +2015,9 @@ discriminatedUnion("type", [
1869
2015
  frameSchema("rd/hello/ok", RELAY_DAEMON_SCHEMAS["rd/hello/ok"]),
1870
2016
  frameSchema("rd/msg", RELAY_DAEMON_SCHEMAS["rd/msg"]),
1871
2017
  frameSchema("rd/ack", RELAY_DAEMON_SCHEMAS["rd/ack"]),
2018
+ frameSchema("rd/agentmsg", RELAY_DAEMON_SCHEMAS["rd/agentmsg"]),
2019
+ frameSchema("rd/agentmsg/fwd", RELAY_DAEMON_SCHEMAS["rd/agentmsg/fwd"]),
2020
+ frameSchema("rd/agentmsg/ack", RELAY_DAEMON_SCHEMAS["rd/agentmsg/ack"]),
1872
2021
  frameSchema("rd/chat", RELAY_DAEMON_SCHEMAS["rd/chat"]),
1873
2022
  frameSchema("error", RELAY_DAEMON_SCHEMAS["error"])
1874
2023
  ]);
@@ -2317,4 +2466,4 @@ function selectAgent(agentsDir, name) {
2317
2466
  //#endregion
2318
2467
  export { ZodIssueCode as C, RESERVED_MCP_SERVER_NAME as S, buildEnvelope as _, agentChildEnv as a, MAX_FRAME_BYTES as b, persistRelays as c, normalizeGitUrl as d, RELAY_DAEMON_SUBPROTOCOL as f, SHARED_CONFIG_ACTION_ID as g, decodeRelayDaemonFrame as h, selectAgent as i, ConfigSchema as l, buildRelayDaemonFrame as m, findAgentFiles as n, loadConfig as o, RELAY_DAEMON_WS_PATH as p, loadAgents as r, persistDaemonId as s, discoverAgents as t, isFrame as u, decodeEnvelope as v, MEMORY_INDEX as x, encode as y };
2319
2468
 
2320
- //# sourceMappingURL=load-agents-Amic2B8b.js.map
2469
+ //# sourceMappingURL=load-agents-DzCnR0cj.js.map