@agentconnect.md/daemon 1.41.0-rc.216 → 1.41.0-rc.217

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 +1 @@
1
- {"version":3,"file":"register-_1hUPUNI.js","names":["z.string","z.object","z.discriminatedUnion","z.literal","z.array","z.boolean","z.number","z.unknown","z.union","z.object","z.string","z.boolean","z.enum","z.number","z.object","z.string","z.number","z.enum","z.enum","z\n .object","z.string","z.object","z.number","z.record","z.unknown","z\n .object","z.literal","z\n .string","z\n .array","z\n .object","z.boolean","z.array","z\n .array","z\n .object","z.enum","z.number","z\n .number","z.object","z.boolean","z.string","z.literal","z.union","z\n .string","z.array","z.record","z.unknown","z.discriminatedUnion","z.discriminatedUnion","z.object","z.literal","z.string","z.boolean","z.enum","z.array","z.unknown","z.discriminatedUnion","z.object","z.literal","z.enum","z.string","z\n .string","z\n .string","z\n .array","z\n .array","z.array","z\n .object","z.number","z.boolean","z.record","z.array","z.object","z.string","z\n .object","z.number","z.enum","z.object","z.string","z.boolean","z.enum","z.array","z.number","z.object","z.string","z.enum","z.array","z.literal","z.boolean","z.number","z.object","z.string","z.boolean","z.array","z.number","z.enum","z.custom"],"sources":["../../protocol/dist/consts.js","../../protocol/dist/frames/route.js","../../protocol/dist/frames/cron.js","../../protocol/dist/frames/secrets.js","../../protocol/dist/memory-plugin.js","../../protocol/dist/frames/memory-connection.js","../../protocol/dist/frames/integration.js","../../protocol/dist/frames/agent.js","../../protocol/dist/frames/mcpserver.js","../../protocol/dist/frames/collab.js","../../protocol/dist/frames/gitcred.js","../../protocol/dist/frames/register.js"],"sourcesContent":["/**\n * Cross-package wire + lifecycle constants shared by the daemon and the CLI.\n *\n * These are pure data (no zod, no runtime deps) so both `@agentconnect.md/cli`\n * and `@agentconnect.md/daemon` can import them without pulling in each other:\n * the daemon dials the CP with the subprotocol/path, and the CLI's login probe\n * dials the same way; both the daemon (planned-exit code) and the CLI (run\n * respawn shell + generated service units) must agree on the restart exit code.\n */\n/**\n * Cap on agent→agent hop depth (agent-collaboration §2.4/§4.5), shared by every\n * component that can admit an agent-to-agent edge.\n *\n * It lives here because send-message-routing-rework.md §4.1 requires ONE budget across\n * transports: \"the same `MAX_AGENT_CALL_HOPS`, whether it is a same-daemon internal\n * call, a relayed internal call, a direct-daemon platform mention, or a relayed platform\n * mention\". Three independent copies (daemon, relay agent-msg router, relay ingress)\n * could drift, and a relay that allowed one more hop than the daemon would let a relayed\n * chain outlive the budget an internal chain gets — a loop-safety hole that no single\n * package's tests would catch.\n *\n * The value is a runaway-loop backstop, not a conversation-length policy: a healthy\n * exchange terminates because the agents are done, and every extra hop only costs one\n * more turn. It was raised from 8 to 20 because 8 cut ordinary human-started relay games\n * short (a thread rooted in one human message affords exactly this many agent→agent\n * edges), while 20 is still far below anything a real collaboration needs and keeps a\n * genuine A↔B ping-pong bounded within seconds.\n */\nexport const MAX_AGENT_CALL_HOPS = 20;\n/**\n * Whether an agent-to-agent delivery has reached the exclusive hop boundary.\n *\n * A delivery at the boundary is not admitted: when the cap is 20, hop 19 is the\n * last agent turn that may run and its reply closes the autonomous exchange.\n * Keeping the comparison beside the shared constant prevents daemon and relay\n * admission paths from drifting on the boundary semantics.\n */\nexport function hasReachedAgentCallHopLimit(deliveryHopCount) {\n return deliveryHopCount >= MAX_AGENT_CALL_HOPS;\n}\n/** The daemon↔CP WebSocket subprotocol negotiated on `ClientTransport.dial`. */\nexport const CP_SUBPROTOCOL = 'agentconnect.v1';\n/** The CP mount path the daemon↔CP WebSocket connects to. */\nexport const CP_WS_PATH = '/daemon/ws';\n/** CP accepts metadata-only transcript activity invalidations from current daemons. */\nexport const SESSION_LIVE_TAIL_FEATURE = 'session-live-tail-v1';\n/** Daemon resolves workspace list/read/git-status requests against the isolated\n * worktree named by `sessionId` instead of silently falling back to primary. */\nexport const WORKSPACE_SESSION_READ_FEATURE = 'workspace-session-read-v1';\n/** Daemon serves the console's git review reads — `workspace/gitdiff`,\n * `workspace/gitlog`, and per-file `additions`/`deletions` on `workspace/gitstatus`.\n * The CP must check this before sending either new frame: an older daemon ignores\n * an unknown frame silently, so the REQ would burn its whole retransmit budget and\n * then surface as an offline daemon. */\nexport const WORKSPACE_GIT_REVIEW_FEATURE = 'workspace-git-review-v1';\n/** Daemon serves the console's git WRITES — `workspace/gitstage`, `workspace/gitunstage`,\n * `workspace/gitcommit` and `workspace/gitpush`. Checked before sending, for the same reason\n * as the review feature: an older daemon ignores an unknown frame silently, so the REQ would\n * burn its retransmit budget and then read as an offline daemon. The console renders the write\n * controls as ABSENT (not inert) on a daemon without it. */\nexport const WORKSPACE_GIT_WRITE_FEATURE = 'workspace-git-write-v1';\n/** Daemon serves `workspace/gitmessage` — the AI commit-message draft, run on the AGENT's own\n * runtime. Separate from the write feature on purpose: it is not a write, and the console hides one\n * button (the wand) on a daemon without it while keeping stage/commit/push. Checked before sending,\n * like every other new frame: an older daemon ignores it silently and the REQ would burn its\n * retransmit budget before reading as an offline daemon. */\nexport const WORKSPACE_GIT_MESSAGE_FEATURE = 'workspace-git-message-v1';\n/** Daemon serves `task/list` — the console Tasks panel's read of one ACP session's background-task\n * lease. Checked before sending, like every other new frame: an older daemon ignores it silently, so\n * the REQ would burn its whole retransmit budget and then read as an offline daemon. The console\n * hides the Tasks tab on a daemon without it rather than showing a tab that can never answer. */\nexport const TASK_LIST_FEATURE = 'task-list-v1';\n/** Daemon serves `agent/wake` — the console's \"start this agent's sandbox\" for a Files/Memory read.\n * Advertised only by a daemon that runs agents in cluster sandboxes: on any other daemon there is\n * nothing to wake, and the CP answers `unsupported` without sending a frame it would ignore. */\nexport const AGENT_WAKE_FEATURE = 'agent-wake-v1';\n/** How long the CP must let ONE `workspace/gitmessage` REQ run before giving up, and it must send it\n * single-shot (`{ ackTimeoutMs: WORKSPACE_GIT_MESSAGE_BUDGET_MS, maxTries: 1 }`). The default 5s ack\n * timeout would retransmit an in-flight model pass four times: identical frame ids, so the daemon\n * joins them into one pass, but the CP would still fail the request while the answer was coming.\n * The daemon's own budget is strictly smaller, so the REP always wins this race. */\nexport const WORKSPACE_GIT_MESSAGE_BUDGET_MS = 75_000;\n/**\n * CP accepts the `event/session-purged` retention-GC receipt (#485) and marks the\n * session's stored metadata content-purged. Advertised by the CP in\n * `register/ok.serverFeatures`; a daemon that does not see it KEEPS its durable\n * receipts instead of emitting a frame an older CP would reject as\n * `UNKNOWN_FRAME` — the report is re-tried once the CP is upgraded.\n */\nexport const SESSION_PURGE_FEATURE = 'session-purge-v1';\n/**\n * CP accepts the correlated `event/session-sync` metadata snapshot. Daemons\n * keep one latest-wins snapshot per session until the CP acknowledges the\n * persistence commit; older CPs continue receiving best-effort `event/session`\n * events while the durable snapshot remains queued for a later upgrade.\n */\nexport const SESSION_METADATA_ACK_FEATURE = 'session-metadata-ack-v1';\n/**\n * Daemon understands the `session/visibility` gate pushes + register-time\n * snapshot replay (session-visibility.md §5.1). Advertised by the daemon in\n * `RegisterReq.capabilities.features`; the CP gates all visibility pushes on\n * it so older daemons never see the frames.\n */\nexport const SESSION_VISIBILITY_FEATURE = 'session-visibility-v1';\n/** Daemon/runtime support private, session-scoped remote MCP headers and stable invocation ids. */\nexport const WEBCHAT_REMOTE_MCP_FEATURE = 'webchat_remote_mcp_v1';\n/**\n * Daemon understands multi-agent webchat conversations: `mentions`/`post` on\n * webchat turns, the transcript-only `context` op, agent-attributed\n * ack/output/done, and `rd/webchat-post` reply fan-out\n * (webchat-multi-agents.md). The CP refuses to CREATE a conversation with more\n * than one agent unless every selected agent's daemon advertises this.\n */\nexport const WEBCHAT_MULTI_AGENT_FEATURE = 'webchat_multi_agent_v1';\n/**\n * Cross-surface session continuation (webchat-cross-integration-continuation.md):\n * the daemon accepts `RdMsgWebchat.targetSessionId` and dispatches the browser\n * turn onto the target session's own local coordinates; a relay advertises the\n * same feature in `rc/register.features` when it preserves the field end to end.\n * The CP refuses to mint a session-targeted webchat token unless the owning\n * daemon AND every live relay advertise it (fail-closed rollout).\n */\nexport const WEBCHAT_SESSION_CONTINUATION_FEATURE = 'webchat_session_continuation_v1';\n/** Daemon and Control Plane support Organization Knowledge, Dream suggestions,\n * and immutable managed-skill bundle retrieval. */\nexport const ORGANIZATION_KNOWLEDGE_FEATURE = 'organization-knowledge-v1';\n/** Daemon currently admits staged Dream suggestion content reads and owner\n * review decisions. Omitted while the staged-content security hold is active. */\nexport const ORGANIZATION_SUGGESTION_REVIEW_FEATURE = 'organization-suggestion-review-v1';\n/** Daemon understands externally-bound Slack session audiences, including the\n * `external` visibility value and the stricter shared-memory exclusion bit. */\nexport const SLACK_SESSION_AUDIENCE_FEATURE = 'slack-session-audience-v1';\n/**\n * Daemon persists `AgentSpec.configRevision` and enforces the monotonic\n * comparison before applying a CP-owned snapshot\n * (organization-secrets-and-variables.md §7). Organization environment entries\n * rely on full-map replacement semantics, so a bound agent may only be placed on\n * a daemon that advertises this: without the fence, an older full snapshot that\n * completes late could reinstate a rotated or deleted value.\n */\nexport const AGENT_CONFIG_REVISION_FEATURE = 'agent-config-revision-v1';\n/** Auth-only recovery capability that permits CP to queue an offline daemon upgrade. */\nexport const DAEMON_BOOTSTRAP_UPGRADE_FEATURE = 'daemon-bootstrap-upgrade-v1';\n/** Frozen version of the auth-only bootstrap handshake. */\nexport const DAEMON_BOOTSTRAP_PROTOCOL_VERSION = 1;\n/**\n * Per-value ceiling for an environment variable or secret, shared by the agent\n * and organization surfaces so one entry can never be sized past what any\n * resolved `AgentSpec` could carry.\n *\n * 64 KiB is a quarter of `MAX_FRAME_BYTES`: generous for the real payloads\n * (a PEM block, a kubeconfig, a service-account JSON) while leaving room for the\n * rest of the spec. It is a per-VALUE guard only — the authoritative check is the\n * transaction-time admission budget over the whole resolved environment, which\n * the Control Plane applies per affected agent before persisting.\n */\nexport const MAX_ENVIRONMENT_VALUE_LENGTH = 64 * 1024;\n/**\n * Exit code a daemon uses for a PLANNED lifecycle exit (drain-then-exit on a\n * `daemon/restart` or `daemon/upgrade`, cli-daemon-split.md §6). It must be\n * non-zero: launchd's `KeepAlive.SuccessfulExit=false` only relaunches on a\n * non-zero exit, so exit 0 would leave the daemon down on macOS. Both\n * supervisors relaunch on it (systemd `Restart=always` covers any code). 75 is\n * EX_TEMPFAIL from sysexits(3) — \"temporary failure, retry\" — which reads\n * correctly for \"the daemon asked to be brought back up\".\n *\n * The CLI's `run` respawn shell (§6.1) also keys off this exact code to decide\n * whether to relaunch vs propagate the child's exit.\n */\nexport const RESERVED_RESTART_CODE = 75;\n/**\n * `AGENTCONNECT_SUPERVISOR` value a pool member runs under: Kubernetes, where the\n * kubelet takes the place of launchd/systemd AND of the CLI's version store.\n *\n * It supervises restart — `restartPolicy: Always` brings the container back after\n * {@link RESERVED_RESTART_CODE}, in place and in the same pod, which is the same\n * shape as a systemd process restart — but not upgrade: the running version is the\n * image, so only whoever owns the Deployment can change it.\n */\nexport const K8S_SUPERVISOR = 'k8s';\n/**\n * Audience the projected ServiceAccount token an in-cluster daemon authenticates with is\n * restricted to. The shim handshake run one hop up: a sandbox proves itself to the daemon\n * with a token scoped to `SHIM_TOKEN_AUDIENCE`, and here the daemon proves itself to the\n * control plane the same way. The audiences differ, so neither token is accepted at the\n * other end.\n *\n * This and {@link CLOUD_DAEMON_SA_NAME} are the two names the deployment that stamps them and\n * the control plane that checks them must agree on exactly. They live here rather than\n * being configured on each side because a constant kept in two places eventually holds two\n * values: a rename passes every build and every test, since each side stays self-consistent,\n * and fails only at runtime when a real daemon's token is rejected. One definition makes that\n * a compile error instead.\n */\nexport const CP_TOKEN_AUDIENCE = 'ac-control-plane';\n/**\n * ServiceAccount a pool member runs as, and the control plane's second check on a reviewed\n * token, so a later change cannot authenticate some other pod in the same namespace. A pool\n * member serves EVERY org, so it lives in the install's control namespace rather than in an\n * org namespace and no namespace⇒org mapping can name its org — the org is a per-connection\n * selector it declares in `auth`, which is safe precisely because this ServiceAccount is an\n * install-level principal. Shared for the same reason as {@link CP_TOKEN_AUDIENCE}.\n */\nexport const CLOUD_DAEMON_SA_NAME = 'ac-cloud-daemon';\n/**\n * ServiceAccount the usage-report collector runs as — the principal allowed to post\n * `gateway`-source session usage to the control plane's batch ingress. A separate name\n * from {@link CLOUD_DAEMON_SA_NAME} on purpose: both tokens carry\n * {@link CP_TOKEN_AUDIENCE}, so the ServiceAccount is what keeps a daemon's token from\n * writing usage and a collector's token from claiming a daemon identity. Like its two\n * siblings, it lives here so the side that stamps it and the side that checks it cannot\n * drift to two values.\n */\nexport const USAGE_COLLECTOR_SA_NAME = 'ac-usage-collector';\n/** Where the deployment projects that token into the daemon pod, and where the daemon reads it\n * from. Not part of the verification, but the same two-sided agreement: the mounter and the\n * reader are both in this repo, so one definition beats a comment asking them to match. */\nexport const CP_IDENTITY_TOKEN_PATH = '/var/run/ac-cp-identity/token';\n/** Env var carrying the control plane's own WebSocket URL into an in-cluster daemon. The pod\n * has no config file to read it from, and a URL is not a secret. Same two-sided agreement as\n * the token path: the deployment sets it, the daemon reads it. */\nexport const CP_URL_ENV = 'AC_CP_URL';\n/** A pool member's rollout generation (its pod-template hash), reported on register (frames/register.ts). */\nexport const POD_TEMPLATE_HASH_ENV = 'AC_POD_TEMPLATE_HASH';\n/** CP answers the `agent/exists` batch existence query the pool's orphan reconciler\n * asks before collecting a leaked sandbox object; a daemon that does not see it\n * skips the sweep rather than emit a frame an older CP rejects as `UNKNOWN_FRAME`. */\nexport const AGENT_EXISTS_FEATURE = 'agent-exists-v1';\n//# sourceMappingURL=consts.js.map","import { z } from 'zod';\n/**\n * Routing & orchestration (C→D control) — protocol §5.\n *\n * `SessionKey` is the canonical session primitive shared across route/*,\n * agent/*, and event/session. Its canonical string form is\n * `${platform}:${channel}:${thread ?? \"-\"}`.\n */\n// `webchat`, `hook`, and `dream` are session-identity platforms only (the\n// Playground conversation / a webhook trigger / a background memory-consolidation\n// run) — no integration, no bind rules, no routing-table participation, never a\n// persisted DB Platform.\n//\n// S1a tolerant readers (integration-plugin-architecture.md §6.2): every peer\n// READS platform fields as an open string, because zod rejects unknown enum\n// values wholesale and an unknown id inside a known frame is frame-fatal —\n// a new id reaching an old peer's `register` reader is a fatal handshake\n// reconnect loop. WRITERS keep emitting only `KNOWN_PLATFORMS` values until\n// the fleet gate passes (every deployed peer reads tolerantly); only then may\n// a new platform id be emitted (S1b).\n//\n// Per-frame policy for an unknown (non-legacy) id, decided per frame where the\n// value is consumed, never by closing this schema:\n// - `register.capabilities.platforms` — accept the frame; an unknown id\n// simply never matches a placement/capability gate (ignore-unknown).\n// - `event/session` — store the value verbatim (session rows are text).\n// - `rd/msg` — decode succeeds; the daemon may refuse the ITEM on semantic\n// grounds (fail-closed coordinate checks), but never the socket.\nexport const KNOWN_PLATFORMS = ['slack', 'telegram', 'webchat', 'discord', 'feishu', 'hook', 'dream'];\nexport function isKnownPlatform(p) {\n return KNOWN_PLATFORMS.includes(p);\n}\n// The origin-kind classification seed (integration-plugin-architecture.md §6.1): the\n// session-identity platforms are channel-free — no integration row, no persisted\n// conversation, no placement snapshot entry. Everything OUTSIDE this list is\n// chat-shaped and must be treated fail-closed where a placement matters\n// (`coordsDecision` refuses an unrecorded coordinate on any chat-shaped id,\n// including ids this build does not know). S1b replaces this constant with\n// wire-carried per-id classification riding collab snapshots / rc/bot-assign.\nexport const SESSION_IDENTITY_PLATFORMS = ['webchat', 'hook', 'dream'];\nexport function isSessionIdentityPlatform(p) {\n return SESSION_IDENTITY_PLATFORMS.includes(p);\n}\n// D3: the origin-KIND axis. `chat` = an external chat platform (an open, growing\n// set); the session-identity kinds are core surfaces and each is its own kind. A\n// new KIND is a core change, never a platform module — but wire fields carrying a\n// kind still read as open strings (the S1a rule), so adding one is not\n// frame-fatal to older peers.\nexport const ORIGIN_KINDS = ['chat', 'hook', 'dream', 'webchat'];\n/** Classification seed for the platform ids THIS build knows. Wire-carried\n * entries (`CollabRoutesSnapshot.platformKinds`, `rc/bot-assign.originKind`)\n * extend it for ids a newer peer introduces (§6.1). `undefined` = an id neither\n * the seed nor the wire classified — consumers treat it as `'chat'`, the\n * fail-closed default wherever placements matter. */\nexport function originKindOf(p) {\n if (isSessionIdentityPlatform(p))\n return p;\n return isKnownPlatform(p) ? 'chat' : undefined;\n}\nexport const Platform = z.string().min(1);\nexport const SessionKey = z.object({\n platform: Platform,\n channel: z.string(),\n thread: z.string().optional() // absent = channel-root\n});\n/** Trigger-matching rule for a binding (protocol §5.1). */\nexport const BindRule = z.object({\n match: z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('mention') }),\n z.object({ kind: z.literal('dm') }),\n z.object({ kind: z.literal('keyword'), value: z.string() }),\n z.object({ kind: z.literal('auto') }) // alert-channel auto-handle\n ])\n});\nexport const RouteAssign = z.object({\n // also appears in RegisterOk.assignments[]\n sessionKey: SessionKey,\n agentId: z.string().uuid(),\n workspaceId: z.string().uuid(), // which D9 workspace to prepare\n bindRules: z.array(BindRule).default([])\n});\nexport const RouteAssignAck = z.object({\n ok: z.boolean(),\n sessionKey: SessionKey,\n reason: z.string().optional()\n});\nexport const RouteUpdate = z.object({\n routingEpoch: z.number().int(),\n rules: z.array(z.object({ match: z.unknown(), agentId: z.string().uuid() }))\n});\n/** Graceful scale-down / rebalance — protocol §5.3. */\nexport const Drain = z.object({\n scope: z.union([\n z.object({ kind: z.literal('agent'), agentId: z.string().uuid() }),\n z.object({ kind: z.literal('daemon') }), // whole-daemon drain (shutdown/upgrade)\n z.object({ kind: z.literal('session'), sessionKey: SessionKey })\n ]),\n deadline: z.string().datetime() // hard cutoff; in-flight turns past this are cancelled\n});\nexport const DrainProgress = z.object({\n remaining: z.number().int(),\n drained: z.array(SessionKey)\n});\nexport const DrainDone = z.object({\n released: z.array(SessionKey) // CP may now reassign — fenced by new epoch\n});\n//# sourceMappingURL=route.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Cron sinks to the daemon (D5) — protocol §5.4.\n *\n * A cron periodically triggers ONE AGENT with a synthetic prompt (`trigger`) to\n * carry out some work. The CP owns the definition; the daemon owns firing +\n * last-run persistence, so crons fire even when the CP is down. On receipt the\n * daemon persists the def into the owning agent's `agent.json` `crons[]` (the\n * single source of truth, same model as integrations) — surviving a restart\n * with the CP down.\n *\n * `target` is OPTIONAL output routing: when present, the daemon posts the\n * trigger as a real message in that channel and the agent's session replies in\n * its thread; when absent the fire is headless (the agent works with no\n * platform output).\n */\nexport const CronTarget = z.object({\n // S1a open reader (route.ts Platform policy). The `'slack'` default is the\n // legacy envelope default §6.8 removes (anchor platform will derive from\n // `integrationId`); it is NOT a fold — a present unknown id passes through.\n platform: Platform.default('slack'),\n channel: z.string(),\n // The agent integration whose connection posts the anchor — targets come from\n // the owning agent's integrations, so the daemon posts through the right bot\n // when the agent has several. Absent (legacy defs) ⇒ first integration.\n integrationId: z.string().uuid().optional()\n});\nexport const CronUpsert = z.object({\n orgId: z.string().min(1).max(64).optional(),\n cronId: z.string().uuid(),\n agentId: z.string().uuid(), // the agent this cron drives — routes the def to its daemon\n schedule: z.string(), // croner expression interpreted in `timezone`\n timezone: z.string().min(1), // resolved IANA timezone; daemon converts ticks to UTC instants\n target: CronTarget.optional(), // absent ⇒ headless fire\n trigger: z.string(), // synthetic prompt text injected on fire\n enabled: z.boolean().default(true)\n});\nexport const CronRemove = z.object({\n cronId: z.string().uuid()\n});\n/**\n * `cron/report` (D→C EVT, fire-and-forget) — one CP-owned cron fired. The\n * daemon stamps the fire into its local store first (it stays authoritative,\n * §5.4) and reports it here so the console's `lastRunAt` converges; the CP\n * upsert is latest-wins, so the daemon re-asserting its stored stamps on\n * reconnect (fires while the CP was unreachable) is idempotent and can never\n * regress the value. Hand-authored (no-origin) crons are never reported.\n *\n * Reports are keyed by `(cronId, firedAt)`: the FIRE report (no `status`)\n * opens the run, an optional SESSION report attaches the ACP session as soon\n * as it is initialized, and the COMPLETION report (with `status` + outcome\n * fields) closes the run once the dispatched turn ends. A completion without\n * a prior fire report (CP was down at fire time) still creates the run row.\n */\nexport const CronRunStatus = z.enum(['success', 'failed']);\nexport const CronReport = z.object({\n cronId: z.string().uuid(),\n agentId: z.string().uuid(), // the owning agent — scopes the report to its daemon\n firedAt: z.string().datetime(),\n // Terminal outcome fields (absent on fire/session progress reports).\n status: CronRunStatus.optional(),\n durationMs: z.number().int().nonnegative().optional(), // fire → turn end\n // Sent once the ACP session exists, then repeated on completion.\n sessionId: z.string().optional(), // ACP session the run prompted (console deep-link)\n reason: z.string().optional() // short failure text (status \"failed\")\n});\n/**\n * `cron/run` (C→D REQ → ack) — fire one CP-owned cron NOW (console \"Run now\").\n * The daemon accepts (`ok:true`) and runs the fire asynchronously — outcome\n * arrives as normal `cron/report`s; `ok:false` when it holds no such cron.\n */\nexport const CronRunNow = z.object({\n cronId: z.string().uuid()\n});\n//# sourceMappingURL=cron.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Secrets (C5 ↔ D10) — protocol §6.\n *\n * Lease-based, no plaintext on the wire or in PG. Every frame carries a\n * REFERENCE to a Vault/KMS path, never the secret material itself.\n */\nexport const SecretsRequest = z.object({\n // D→C, REQ — daemon asks for a lease at session start\n scope: z.object({\n platform: Platform,\n workspaceId: z.string().uuid()\n })\n});\nexport const SecretsGrant = z.object({\n // C→D, REP (also in RegisterOk.leases[])\n leaseId: z.string().uuid(),\n scope: z.object({\n platform: z.string(),\n workspaceId: z.string().uuid()\n }),\n ref: z.string(), // Vault/KMS path or handle — NOT the secret\n ttl: z.number().int(), // seconds\n renewBeforeSec: z.number().int() // daemon should renew this many sec before expiry\n});\nexport const SecretsRenew = z.object({\n leaseId: z.string().uuid() // D→C REQ → new SecretsGrant\n});\nexport const SecretsRevoke = z.object({\n leaseId: z.string().uuid(),\n reason: z.string() // C→D EVT (hot revoke)\n});\n/** 🅼 Direct-to-store upload/download grant — protocol §3.2 / frame #25. */\nexport const ScopeAttestation = z.object({\n machineId: z.string().uuid(),\n scope: z.enum(['attachment.put', 'attachment.get', 'facts.put']),\n resourceRef: z.string(), // opaque object key/prefix\n jws: z.string(), // signed capability the store verifies offline\n exp: z.string().datetime()\n});\n//# sourceMappingURL=secrets.js.map","import { z } from 'zod';\n/**\n * Canonical, backend-neutral contract for an AgentConnect external-memory plugin.\n *\n * This is deliberately NOT a daemon↔CP frame group. Both the daemon's private MCP\n * client and first/third-party plugin implementations import these schemas so the\n * `agentconnect.memory/v1` profile has one executable source of truth. The model\n * never sees the plugin's raw MCP tools; AgentConnect core translates them into a\n * stable product surface.\n */\nexport const MEMORY_PLUGIN_PROFILE = 'agentconnect.memory/v1';\nexport const MEMORY_PLUGIN_PROFILE_MAJOR = 1;\nexport const MEMORY_PLUGIN_TOOL = {\n manifest: 'agentconnect_memory_manifest',\n recall: 'agentconnect_memory_recall',\n capture: 'agentconnect_memory_capture',\n health: 'agentconnect_memory_health',\n operationStatus: 'agentconnect_memory_operation_status',\n list: 'agentconnect_memory_list',\n get: 'agentconnect_memory_get',\n create: 'agentconnect_memory_create',\n update: 'agentconnect_memory_update',\n delete: 'agentconnect_memory_delete',\n history: 'agentconnect_memory_history'\n};\nexport const MEMORY_RECALL_DEFAULTS = {\n topK: 5,\n maxBytes: 8 * 1024,\n // The budget covers the complete daemon -> relay -> plugin -> embedder\n // round trip. A healthy remote Mem0 search can spend ~1s at the relay alone,\n // so 1s races successful responses instead of representing a useful SLA.\n timeoutMs: 3_000\n};\n// Recall runs before every activation and fails open, so the default budget\n// stays bounded while leaving transport headroom around the common warm path.\n// The ceiling is deliberately generous:\n// a local/self-hosted provider (e.g. Mem0 OSS) can need several seconds on a\n// cold first search — embedding-model load plus vector search — and an operator\n// must be able to configure a budget that a healthy cold start fits inside\n// rather than being forced to degrade it. This is the single source of truth\n// for the recall-timeout ceiling shared by the connection policy schema and,\n// by contract, the control-plane validation and console input.\nexport const MEMORY_RECALL_HARD_LIMITS = {\n topK: 20,\n maxBytes: 32 * 1024,\n timeoutMs: 10_000\n};\nexport const MemoryScopeKind = z.enum(['agent', 'user', 'session', 'shared']);\n/** The plugin-facing scope. `key` is always derived by daemon core, never tool input. */\nexport const CanonicalMemoryScope = z\n .object({\n kind: MemoryScopeKind,\n key: z.string().min(1).max(512)\n})\n .strict();\nexport const MemoryRecordProvenance = z\n .object({\n pluginId: z.string().min(1).max(255),\n backendId: z.string().min(1).max(512).optional()\n})\n .strict();\n/** The one record shape AgentConnect core understands, regardless of backend. */\nexport const CanonicalMemoryRecord = z.object({\n id: z.string().min(1).max(512),\n text: z.string().min(1),\n score: z.number().finite().optional(),\n scope: CanonicalMemoryScope,\n metadata: z.record(z.string(), z.unknown()).optional(),\n createdAt: z.string().datetime().optional(),\n updatedAt: z.string().datetime().optional(),\n provenance: MemoryRecordProvenance.optional(),\n /** Backend version/ETag for optimistic concurrency on update. */\n version: z.string().min(1).max(512).optional()\n});\nexport const CaptureReceipt = z.object({\n state: z.enum(['completed', 'accepted', 'failed', 'ambiguous']),\n backendOperationId: z.string().min(1).max(512).optional()\n});\n/** Every operation carries a core-created request, connection, and trusted scope. */\nexport const MemoryPluginCallContext = z\n .object({\n requestId: z.string().min(1).max(512),\n connection: z\n .object({\n id: z.string().min(1).max(512),\n config: z.record(z.string(), z.unknown())\n })\n .strict(),\n scope: CanonicalMemoryScope\n})\n .strict();\nexport const MemoryPluginOperation = z.enum([\n 'recall',\n 'capture',\n 'list',\n 'get',\n 'create',\n 'update',\n 'delete',\n 'history'\n]);\n/** Exact machine-readable text tokens for MCP tool results with `isError:true`.\n * MCP validates structuredContent against the success output schema even on an\n * error result, so profile errors use an exact token and never a free-form\n * plugin/upstream message. */\nexport const MEMORY_PLUGIN_ERROR_TOKEN = {\n conflict: 'agentconnect.memory.error/conflict'\n};\nconst unique = (xs) => new Set(xs).size === xs.length;\n/** The result of the required manifest tool (`structuredContent` directly). */\nexport const MemoryPluginManifest = z.object({\n profile: z.literal(MEMORY_PLUGIN_PROFILE),\n plugin: z.object({\n id: z\n .string()\n .max(255)\n .regex(/^[a-z0-9]+(?:[.-][a-z0-9]+)+$/, 'plugin id must be reverse-DNS-like'),\n version: z\n .string()\n .max(128)\n .regex(/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/, 'plugin version must be semver')\n }),\n connection: z.object({\n // A deliberately bounded JSON-Schema subset is enforced by daemon core during\n // conformance; this field remains JSON here so the console can render it later.\n configSchema: z.record(z.string(), z.unknown()),\n secretFields: z\n .array(z\n .object({\n name: z.string().min(1).max(128),\n required: z.boolean(),\n transportHeader: z.string().min(1).max(128).optional()\n })\n .strict())\n .max(64)\n .refine((fields) => unique(fields.map((field) => field.name)), 'secret field names must be unique')\n }),\n capabilities: z\n .object({\n scopes: z.array(MemoryScopeKind).min(1).max(4).refine(unique, 'scope capabilities must be unique'),\n operations: z.array(MemoryPluginOperation).min(2).max(8).refine(unique, 'operation capabilities must be unique'),\n asyncCapture: z.boolean(),\n idempotency: z.enum(['operation-id', 'none'])\n })\n .strict(),\n limits: z\n .object({\n maxQueryBytes: z.number().int().positive(),\n maxRecordBytes: z.number().int().positive(),\n maxBatchItems: z.number().int().positive()\n })\n .strict(),\n declaredEgressHosts: z\n .array(z.string().min(1).max(253))\n .max(128)\n .refine(unique, 'egress hosts must be unique')\n .optional()\n});\nexport const MemoryPluginRecallInput = z\n .object({\n context: MemoryPluginCallContext,\n query: z.string().min(1),\n topK: z.number().int().positive().max(MEMORY_RECALL_HARD_LIMITS.topK),\n maxBytes: z.number().int().positive().max(MEMORY_RECALL_HARD_LIMITS.maxBytes)\n})\n .strict();\nexport const MemoryPluginRecallOutput = z.object({ records: z.array(CanonicalMemoryRecord) }).strict();\nexport const MemoryPluginTurnObservation = z\n .object({\n turnId: z.string().min(1).max(512),\n input: z.string(),\n output: z.string(),\n sessionId: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginCaptureInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n turn: MemoryPluginTurnObservation\n})\n .strict();\nexport const MemoryPluginCaptureOutput = CaptureReceipt.strict();\nexport const MemoryPluginHealthInput = z.object({ context: MemoryPluginCallContext }).strict();\nexport const MemoryPluginHealthOutput = z\n .object({\n status: z.enum(['ready', 'degraded', 'invalid']),\n /** Stable, non-secret diagnostic code. Never an upstream response body. */\n reasonCode: z.string().min(1).max(128).optional()\n})\n .strict();\nexport const MemoryPluginOperationStatusInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n backendOperationId: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginOperationStatusOutput = CaptureReceipt.strict();\nconst OptionalCursor = z.string().min(1).max(2048).optional();\nexport const MemoryPluginListInput = z\n .object({\n context: MemoryPluginCallContext,\n cursor: OptionalCursor,\n limit: z.number().int().positive().max(100).default(50)\n})\n .strict();\nexport const MemoryPluginListOutput = z\n .object({ records: z.array(CanonicalMemoryRecord), nextCursor: OptionalCursor })\n .strict();\nexport const MemoryPluginGetInput = z\n .object({ context: MemoryPluginCallContext, id: z.string().min(1).max(512) })\n .strict();\nexport const MemoryPluginGetOutput = z.object({ record: CanonicalMemoryRecord.nullable() }).strict();\nexport const MemoryPluginCreateInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n text: z.string().min(1),\n metadata: z.record(z.string(), z.unknown()).optional()\n})\n .strict();\nexport const MemoryPluginCreateOutput = z.object({ record: CanonicalMemoryRecord }).strict();\nexport const MemoryPluginUpdateInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n id: z.string().min(1).max(512),\n text: z.string().min(1),\n metadata: z.record(z.string(), z.unknown()).optional(),\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginUpdateOutput = z.object({ record: CanonicalMemoryRecord }).strict();\nexport const MemoryPluginDeleteInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n id: z.string().min(1).max(512),\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginDeleteOutput = z.object({ deleted: z.boolean() }).strict();\nexport const MemoryPluginHistoryInput = z\n .object({\n context: MemoryPluginCallContext,\n id: z.string().min(1).max(512),\n cursor: OptionalCursor,\n limit: z.number().int().positive().max(100).default(50)\n})\n .strict();\nexport const MemoryPluginHistoryEvent = z\n .object({\n id: z.string().min(1).max(512),\n event: z.enum(['create', 'update', 'delete']),\n at: z.string().datetime(),\n record: CanonicalMemoryRecord.optional()\n})\n .strict();\nexport const MemoryPluginHistoryOutput = z\n .object({ events: z.array(MemoryPluginHistoryEvent), nextCursor: OptionalCursor })\n .strict();\n//# sourceMappingURL=memory-plugin.js.map","import { z } from 'zod';\nimport { MEMORY_PLUGIN_PROFILE, MEMORY_RECALL_DEFAULTS, MEMORY_RECALL_HARD_LIMITS, MemoryPluginManifest } from '../memory-plugin.js';\n/**\n * External-memory control-plane distribution (M-5A).\n *\n * The Control Plane owns installations and org connections. A daemon receives\n * a transport-specific private definition. Remote definitions carry a relay URL\n * and purpose-specific bearer grant; local definitions carry an operator\n * allowlist reference and daemon-private secret lease. Raw local commands never\n * cross this wire.\n */\nexport const MemoryRecallPolicy = z\n .object({\n mode: z.enum(['auto', 'tool-only']).default('auto'),\n topK: z.number().int().positive().max(MEMORY_RECALL_HARD_LIMITS.topK).default(MEMORY_RECALL_DEFAULTS.topK),\n maxBytes: z\n .number()\n .int()\n .positive()\n .max(MEMORY_RECALL_HARD_LIMITS.maxBytes)\n .default(MEMORY_RECALL_DEFAULTS.maxBytes),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .max(MEMORY_RECALL_HARD_LIMITS.timeoutMs)\n .default(MEMORY_RECALL_DEFAULTS.timeoutMs)\n})\n .strict();\nexport const MemoryCapturePolicy = z.object({ mode: z.enum(['turn', 'manual']).default('manual') }).strict();\n/**\n * Dreaming — periodic offline consolidation of the MANAGED store\n * (design: docs/designs/memory-dreaming.md). Valid only with\n * `provider: 'managed'`; the daemon stages a rebuilt store per dream and the\n * user reviews and adopts it, or an enabled auto-accept policy adopts it.\n * Bounds mirror the design: sessionWindow ≤ 100 mined transcripts,\n * instructions ≤ 4096 chars.\n */\nexport const MemoryDreamingPolicy = z\n .object({\n enabled: z.boolean(),\n /** Optional override pinning a fixed newest-N session window to mine. When\n * absent (the norm), the daemon sizes the window automatically — every\n * session active since the last successful dream, capped at 100 — so this\n * normally needs no configuration. */\n sessionWindow: z.number().int().min(1).max(100).optional(),\n /** Cron expression for scheduled dreams (same syntax as agent crons). A tick\n * that lands while a dream is already in flight is skipped, not queued. */\n schedule: z.string().min(1).max(128).optional(),\n /** IANA zone the `schedule` is evaluated in (as on agent crons). Absent ⇒ the\n * daemon host's local time. */\n timezone: z.string().min(1).max(64).optional(),\n /** Operator steering text applied through the whole dream pipeline. */\n instructions: z.string().max(4096).optional(),\n /** Also mine reusable procedures into candidate skills (never auto-installed —\n * a mined skill is always a proposal that needs explicit approval). Absent\n * defaults to true; false is the opt-out. */\n mineSkills: z.boolean().optional(),\n /** Adopt the staged store automatically on completion without content\n * review. Live-memory fence conflicts remain reviewable. Absent defaults\n * to true for effective managed-memory policies; false is the opt-out. */\n autoAdopt: z.boolean().optional()\n})\n .strict();\n/** Product default for managed memory with no explicit dreaming policy.\n *\n * The schedule is evaluated in the daemon host's timezone because no timezone\n * is set. Keeping this as an explicit policy lets a saved policy distinguish\n * manual-only dreaming (enabled with no schedule) from the default daily run.\n */\nexport const DEFAULT_MEMORY_DREAMING_POLICY = {\n enabled: true,\n schedule: '0 4 * * *',\n // By default a completed dream is adopted without review and reusable procedures\n // are mined into candidate skills. Adoption is text-only and reversible; mined\n // skills are still proposals that need explicit approval before install (they are\n // executable), so mining-on only surfaces candidates.\n autoAdopt: true,\n mineSkills: true\n};\n/** Managed-memory partitioning. `agent` (default) keeps one store per agent;\n * `channel` gives each channel (DM/webchat included, as special channels) its own\n * memory folder so different channels never cross. The agent-level store stays as\n * a shared read-only base under `channel` (see docs/designs/memory-dreaming.md). */\nexport const ManagedMemoryScope = z.enum(['agent', 'channel']);\nconst BuiltInMemoryBinding = z\n .object({\n provider: z.enum(['none', 'native', 'managed']),\n autoDistill: z.boolean().optional(),\n dreaming: MemoryDreamingPolicy.optional(),\n scope: ManagedMemoryScope.optional()\n})\n .strict()\n .superRefine((binding, ctx) => {\n if (binding.dreaming && binding.provider !== 'managed') {\n ctx.addIssue({\n code: 'custom',\n path: ['dreaming'],\n message: 'dreaming is only supported with the managed memory provider'\n });\n }\n if (binding.scope && binding.provider !== 'managed') {\n ctx.addIssue({\n code: 'custom',\n path: ['scope'],\n message: 'memory scope is only supported with the managed memory provider'\n });\n }\n});\nexport const ExternalMemoryBinding = z\n .object({\n provider: z.literal('external'),\n connectionId: z.string().uuid(),\n recall: MemoryRecallPolicy.default({ mode: 'auto', ...MEMORY_RECALL_DEFAULTS }),\n // The safe default never exports a full turn. Console users must explicitly\n // acknowledge the egress disclosure before selecting turn capture.\n capture: MemoryCapturePolicy.default({ mode: 'manual' })\n})\n .strict();\n/** Agent-facing provider selection. External bindings carry policy, never endpoints or secrets. */\nexport const AgentMemoryBinding = z.union([BuiltInMemoryBinding, ExternalMemoryBinding]);\n/** Resolve the managed-memory dreaming policy used by the daemon.\n *\n * No memory binding means the managed provider, and no explicit dreaming policy\n * means the daily product default. Once a policy exists its absent schedule\n * remains meaningful (manual-only), while absent `autoAdopt` and `mineSkills`\n * normalize to the product default (true); an explicit false is the opt-out.\n */\nexport function effectiveMemoryDreamingPolicy(binding) {\n if (binding && binding.provider !== 'managed')\n return undefined;\n // Dreaming (offline consolidation) is not supported under channel scope — a\n // dream mines and rewrites a single store, which does not map onto per-channel\n // folders. Channel-scoped agents have no dreaming policy (the console hides the\n // controls); per-channel dreaming may arrive later.\n if (effectiveManagedMemoryScope(binding) === 'channel')\n return undefined;\n const policy = binding?.dreaming;\n if (!policy)\n return { ...DEFAULT_MEMORY_DREAMING_POLICY };\n return { ...policy, autoAdopt: policy.autoAdopt ?? true, mineSkills: policy.mineSkills ?? true };\n}\n/** The effective managed-memory partitioning scope. Non-managed and unset ⇒\n * `agent` (the historical single-store behavior). */\nexport function effectiveManagedMemoryScope(binding) {\n if (!binding || binding.provider !== 'managed')\n return 'agent';\n return binding.scope ?? 'agent';\n}\n/** Reviewed mapping from a logical secret field to the header the relay injects. */\nexport const MemoryPluginSecretHeaderPin = z\n .object({ name: z.string().min(1).max(128), header: z.string().min(1).max(128), required: z.boolean() })\n .strict();\nexport const MemoryPluginPin = z\n .object({\n pluginId: z.string().min(1).max(255),\n profileMajor: z.literal(1),\n manifestDigest: z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/)\n .optional(),\n secretHeaders: z.array(MemoryPluginSecretHeaderPin).max(64).default([])\n})\n .strict();\nconst MemoryConnectionSpecBase = z\n .object({\n orgId: z.string().min(1).max(64).optional(),\n connectionId: z.string().uuid(),\n revision: z.number().int().positive(),\n config: z.record(z.string(), z.unknown()),\n secretKeys: z.array(z.string().min(1).max(128)).max(64).default([]),\n pin: MemoryPluginPin\n})\n .strict();\nconst RemoteMemoryConnectionSpec = MemoryConnectionSpecBase.extend({\n transport: z.literal('streamable-http'),\n relayUrl: z.string().url(),\n grantKey: z.string().min(1).max(512)\n}).strict();\n/** Plaintext values cross only the authenticated daemon control channel and\n * remain in its private registry until they are injected into the allowlisted\n * plugin child. They never enter AgentSpec, agent.json, or the agent runtime. */\nexport const MemoryConnectionSecretLease = z\n .object({\n values: z.record(z.string().min(1).max(128), z\n .string()\n .min(1)\n .max(16 * 1024)\n .refine((value) => !value.includes('\\0'), 'memory connection secret contains NUL'))\n})\n .strict()\n .superRefine((lease, ctx) => {\n if (new TextEncoder().encode(JSON.stringify(lease.values)).byteLength > 64 * 1024) {\n ctx.addIssue({ code: 'custom', path: ['values'], message: 'memory connection secret lease exceeds 64 KiB' });\n }\n});\nconst StdioMemoryConnectionSpec = MemoryConnectionSpecBase.extend({\n transport: z.literal('stdio'),\n // This is a logical lookup key in the daemon operator's local allowlist, not\n // a path/command supplied by the tenant or Control Plane.\n commandRef: z\n .string()\n .min(1)\n .max(128)\n .regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, 'commandRef must be an allowlist key'),\n secretLease: MemoryConnectionSecretLease\n})\n .strict()\n .superRefine((spec, ctx) => {\n const keys = Object.keys(spec.secretLease.values).sort();\n const declared = [...spec.secretKeys].sort();\n if (keys.length !== declared.length || keys.some((key, index) => key !== declared[index])) {\n ctx.addIssue({ code: 'custom', path: ['secretLease'], message: 'secret lease keys must match secretKeys' });\n }\n});\nconst TransportedMemoryConnectionSpec = z.discriminatedUnion('transport', [\n RemoteMemoryConnectionSpec,\n StdioMemoryConnectionSpec\n]);\n/** One daemon-private connection definition. Both relay grants and local secret\n * leases are secret-bearing; callers must never log this frame or validation\n * payload. Local commands are resolved solely from the operator allowlist. */\nexport const MemoryConnectionSpec = TransportedMemoryConnectionSpec;\n/** C→D live CRUD; reconnect baseline is `register/ok.memoryConnections`. */\nexport const MemoryConnectionUpsert = MemoryConnectionSpec;\nexport const MemoryConnectionRemove = z.object({ connectionId: z.string().uuid() }).strict();\n/** Stable, body-free probe fact for one connection revision. */\nexport const MemoryConnectionFact = z\n .object({\n connectionId: z.string().uuid(),\n revision: z.number().int().positive(),\n pluginId: z.string().min(1).max(255),\n version: z.string().max(128).optional(),\n profile: z.literal(MEMORY_PLUGIN_PROFILE).optional(),\n manifestDigest: z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/)\n .optional(),\n capabilities: MemoryPluginManifest.shape.capabilities.optional(),\n declaredEgressHosts: z.array(z.string().min(1).max(255)).max(128).optional(),\n status: z.enum(['probing', 'ready', 'degraded', 'invalid']),\n reasonCode: z.string().min(1).max(128).optional()\n})\n .strict();\n/** D→C full snapshot. Re-emitted on reconnect and after every probe transition. */\nexport const MemoryConnectionFacts = z.object({ connections: z.array(MemoryConnectionFact).max(1_024) }).strict();\n//# sourceMappingURL=memory-connection.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Platform integration distribution (C→D) — the Slack \"install\" flow.\n *\n * The Control Plane is the source of truth for platform integrations and pushes\n * them to the daemon that owns the integration's agent (`integration/upsert`, and\n * the reconcile snapshot `RegisterOk.integrations[]`). The daemon opens the Socket\n * Mode connection from the delivered config (see slack/connection.ts).\n *\n * SECURITY: `integration/upsert` and `RegisterOk.integrations[]` carry PLAINTEXT\n * platform tokens (botToken/appToken/appSecret). These payloads MUST NEVER be\n * logged — no body dump on decode error, no register/ok snapshot debug dump.\n * CP-owned integrations live only in daemon MEMORY and are re-converged on\n * reconnect; hand-authored agents keep tokens in their own `agent.json` (the\n * same trust boundary as the daemon process).\n *\n * `signingSecret` is intentionally absent: Socket Mode authenticates with the\n * app-level token, so the daemon never needs a signing secret.\n */\n/** Trigger match — mirrors the daemon BindRuleConfig.match (agents/agent-schema.ts). */\nexport const BindMatch = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('mention') }),\n z.object({ kind: z.literal('dm') }),\n z.object({ kind: z.literal('keyword'), value: z.string() }),\n z.object({ kind: z.literal('auto') })\n]);\n/** One channel/thread trigger binding — mirrors the daemon BindRuleConfig. */\nexport const IntegrationBindRule = z.object({\n channel: z.string().optional(), // absent = any channel\n thread: z.string().optional(),\n match: BindMatch\n});\n/**\n * The Slack config payload (no signingSecret). Platform-PRIVATE material only\n * (§6.4): the ingress mode and the routing knobs (`bindRules`/`mutedChannels`/\n * `gated`) live in the CORE ENVELOPE — this block never duplicates them. What\n * the envelope's `mode` means for Slack (shared-bot-relay.md §7.3):\n *\n * - `direct`: the daemon owns the whole bot — it opens the Socket Mode\n * connection itself, so the payload carries `appToken`.\n * - `shared`: the bot's INBOUND lives on a relay (§4.1), so the daemon gets\n * xoxb ONLY — enough to SEND (`chat.postMessage`, attachment fetch). No\n * `appToken` (credential domaining: the daemon must not be able to subscribe\n * the event stream). `botUserId` is optional and lazily resolved by the\n * daemon via `auth.test` (same as direct) if the sender ever needs it.\n *\n * The direct-mode `appToken` requirement is a cross-field rule with the\n * envelope's `mode`, so the daemon enforces it at its wire ingest, where both\n * are in view (`cp/cp-integration-registry.ts` `toIntegration`) — §6.4 puts\n * per-platform payload validation at the consuming edge.\n */\nexport const IntegrationSlackConfig = z.object({\n botToken: z.string(), // xoxb-… (plaintext — never log) — always present (send path)\n appToken: z.string().optional(), // xapp-… (plaintext — never log) — direct only (Socket Mode)\n appId: z.string().optional(), // A… public metadata — permission-update deep link (especially shared mode)\n // Multi-agent opt-in — the bot backs MANY agents, so an in-thread \"Switch agent\"\n // control is meaningful. ONLY ever true in `shared` mode (an http/relay bot); a\n // non-shareable http bot is still `shared` for routing but has one agent, so the\n // switch control is suppressed. Defaults false (every direct bot decodes as\n // non-shareable).\n shareable: z.boolean().default(false),\n botUserId: z.string().optional() // lazily resolved via auth.test; may be seeded by CP\n});\n/**\n * The Telegram config payload — long-polling + routing (grammY). Telegram has a\n * SINGLE BotFather HTTP token — no app-level token and no signing secret\n * (long-polling authenticates every getUpdates call with the bot token).\n */\nexport const IntegrationTelegramConfig = z.object({\n botToken: z.string() // BotFather \"123456:ABC…\" (plaintext — never log)\n});\n/**\n * The Discord config payload — the Gateway connection (discord.js). Discord\n * authenticates the Gateway with a SINGLE bot token — no Slack-style app-level\n * token and no signing secret. `applicationId` is public metadata (the client\n * id for the OAuth2 bot-invite URL); it is not secret material.\n */\nexport const IntegrationDiscordConfig = z.object({\n botToken: z.string(), // Bot <token> (plaintext — never log)\n applicationId: z.string().optional() // client/application id — public, for the invite URL\n});\n/**\n * The Feishu / Lark config payload — the long-connection WebSocket\n * (`@larksuiteoapi/node-sdk` `WSClient`) + REST client. A Feishu self-built app\n * authenticates with an `appId` + `appSecret` PAIR — the SDK exchanges them for a\n * short-lived `tenant_access_token` internally (no Slack-style app-level token, no\n * signing secret). `appId` is a semi-public identifier (`cli_…`); `appSecret` is\n * plaintext secret material — NEVER log it. `botOpenId` is the bot's own open_id\n * for @-mention routing; lazily resolved by the daemon via `bot/info` if absent.\n *\n * The envelope's `mode` decides the transport: `direct` opens the SDK long\n * connection on the daemon; `shared` keeps only the authenticated REST client\n * (callbacks arrive through the relay, pre-addressed over rd/*).\n *\n * `region` selects the open-platform gateway the daemon SDK (and CP verifier)\n * talk to — `'feishu'` = mainland China (`open.feishu.cn`, the SDK default) vs\n * `'lark'` = international (`open.larksuite.com`). Same app model, different host;\n * an app is registered in exactly one region. Defaults to `'feishu'` so existing\n * installs are unaffected.\n */\nexport const FeishuRegion = z.enum(['feishu', 'lark']);\nexport const IntegrationFeishuConfig = z.object({\n appId: z.string(), // cli_… — app identifier (semi-public), needed for REST and direct WS\n appSecret: z.string(), // app secret (plaintext — never log)\n botOpenId: z.string().optional(), // bot's own open_id; lazily resolved via bot/info\n region: FeishuRegion.default('feishu') // open-platform gateway: feishu.cn vs larksuite.com\n});\n/**\n * §6.3 core routing ENVELOPE (integration-plugin-architecture.md D4): the knobs CORE\n * reads — routing, gating, ingress mode — platform-independent. This is the ONLY\n * carrier of these knobs on the wire: the opaque per-platform `config` payload\n * never duplicates them (the daemon reads routing exclusively from here).\n */\nexport const IntegrationCoreEnvelope = z.object({\n mode: z.enum(['direct', 'shared']).default('direct'),\n bindRules: z.array(IntegrationBindRule).default([]),\n mutedChannels: z.array(z.string()).default([]),\n gated: z.boolean().default(false)\n});\n/**\n * One platform integration, owned by exactly one agent. Also the element type of\n * `RegisterOk.integrations[]` (the per-daemon reconcile set) and of\n * `AgentActivate.integrations[]` (the move bundle).\n *\n * §6.4 FINAL SHAPE (S3): one flat object — identity + an OPEN `platform` id +\n * the core envelope + an opaque per-platform `config`. Core never interprets\n * `config`; the consuming platform module validates it against its own schema,\n * resolved through the platform registry on the daemon\n * (`platforms/integration-config.ts`), and the CP's platform provider is the\n * only producer (`projectIntegrationConfig`, §9). The closed four-literal\n * discriminated union this replaces — and the per-variant duplication of the\n * routing knobs inside each config block — was the S1b dual-shape window;\n * pre-release, every deployment cut over in one release, so the legacy shape\n * has no readers or writers left.\n *\n * - `platform` stays the field name (not §6.4's sketch spelling `platformId`):\n * every platform-bearing frame on this wire (`SessionKey`, `rc/bot-assign`,\n * `event/session`, …) spells it `platform`, typed by the open\n * `Platform = z.string()` (S1a).\n * - `core` is REQUIRED. Its absence was the dual-shape tolerance; defaulting\n * it now would silently mint a rule-less integration out of a stale writer,\n * so a core-less spec fails the frame instead (fail-closed and visible).\n * - a spec whose `config` is absent or fails the platform module's schema is\n * rejected by the READER (skip + warn), not the frame schema — one bad spec\n * must not kill the register/ok snapshot it rides in.\n */\nexport const IntegrationSpec = z.object({\n orgId: z.string().min(1).max(64).optional(),\n integrationId: z.string().uuid(),\n agentId: z.string().uuid(),\n platform: Platform,\n core: IntegrationCoreEnvelope,\n config: z.unknown().optional()\n});\n/** C→D EVT — install/update an integration on the owning agent's daemon. */\nexport const IntegrationUpsert = IntegrationSpec;\n/** C→D EVT — remove an integration from the daemon. */\nexport const IntegrationRemove = z.object({\n integrationId: z.string().uuid()\n});\n/**\n * One conversation the bot participates in (metadata only — no messages).\n * `kind` distinguishes member channels from direct conversations (resource-\n * visibility.md §14.3): absent = 'channel' for wire compatibility. DM rows\n * (`kind: 'im'`, Slack \"D…\" ids) are reported for every integration on first\n * inbound DM; their `name` is the counterpart's display name. Group DMs\n * (`kind: 'mpim'`, Slack multi-person DMs) are reported on observation the same\n * way — never enumerated, because Slack does not list them as bot membership —\n * but they behave like a channel: several humans share the room, so the agent\n * stays mention-gated there rather than answering every message.\n *\n * `spaceId`/`space` identify the container the conversation lives in — a Discord\n * GUILD, which a bot in several servers needs for the channel to be identifiable at\n * all (every server has a \"#general\"). The ID is the identity: two distinct guilds\n * may carry the SAME name, so grouping on the name alone would merge them and hide\n * the ambiguity it was meant to resolve. `space` is the display label only. Both are\n * absent on platforms with one implicit container per bot (Slack workspace, Telegram,\n * Feishu tenant) and on DM rows.\n */\nexport const IntegrationChannel = z.object({\n id: z.string(), // platform conversation id (Slack \"C…\" / DM \"D…\")\n name: z.string().optional(), // \"#deploys\" without the hash (or DM counterpart); absent if lookup failed\n spaceId: z.string().optional(), // enclosing Discord guild snowflake — the space's IDENTITY\n space: z.string().optional(), // that guild's display name; absent until resolved\n isPrivate: z.boolean().optional(),\n kind: z.enum(['channel', 'im', 'mpim']).optional() // absent = 'channel'\n});\n/**\n * D→C EVT — channels observed by an integration's bot (fire-and-forget,\n * latest-wins). Slack reports an authoritative membership snapshot; platforms\n * such as Telegram that cannot enumerate every chat set `authoritative:false`,\n * so the CP upserts what was observed without deleting older rows that are\n * absent from this report. An absent flag means authoritative for wire\n * compatibility. Channel names are control metadata, never message content.\n *\n * `removed` is how a NON-enumerating platform retracts one conversation. Absence\n * from `channels` cannot mean \"gone\" there — the reported set is incomplete by\n * construction, so a non-authoritative report never deletes — which left a bot\n * that had actually left a group visible in the console forever. Naming the\n * conversation explicitly is the only way to say it. An authoritative reporter\n * needs none of this (its omissions already delete) but may still send it, and\n * a removal is applied even for a conversation absent from `channels`.\n */\nexport const IntegrationChannels = z.object({\n integrationId: z.string().uuid(),\n channels: z.array(IntegrationChannel),\n authoritative: z.boolean().optional(),\n // Optional rather than defaulted: nearly every report has nothing to retract, and\n // an absent field reads the same as an empty one to the CP.\n removed: z.array(z.string()).optional()\n});\n/**\n * What a leave targets. Platforms disagree about what a bot can withdraw from, and\n * the difference is not cosmetic — so the caller has to say which it means rather\n * than the daemon guessing from an id:\n *\n * - `conversation` — one channel/group the bot is a member of (Slack\n * `conversations.leave`, Telegram `leaveChat`).\n * - `space` — the whole container. Discord has no per-channel membership for a\n * bot at all: it is in a GUILD and sees that guild's channels through\n * permissions, so the only thing it can leave is the entire server. That is a\n * much larger action than leaving one channel and must be requested as such.\n */\nexport const IntegrationLeaveTarget = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('conversation'), channel: z.string().min(1) }),\n z.object({ kind: z.literal('space'), spaceId: z.string().min(1) })\n]);\n/**\n * C→D REQ → `integration/leave/ok` — withdraw the bot from a conversation or space\n * at the PLATFORM. Unlike every other channel control this leaves AgentConnect's own\n * state alone and changes the outside world, so it is a request with a reply: the\n * console reports what the platform actually said rather than assuming.\n *\n * The daemon owns provider egress for both transports (a relay-managed bot still\n * holds send credentials), so this is a daemon call in every topology.\n */\nexport const IntegrationLeave = z.object({\n integrationId: z.string().uuid(),\n target: IntegrationLeaveTarget\n});\n/**\n * C→D REQ → `ack` — stop REPORTING these conversations; the platform is not touched.\n *\n * The console's Forget needs this for the same reason a leave does. A non-enumerating\n * platform's observed set is rebuilt from session history, so deleting the row in the\n * CP alone lasts only until the daemon's next refresh pushes it back. The daemon holds\n * the suppression durably and lifts it when the conversation talks to it again.\n *\n * Acknowledged rather than fire-and-forget: the suppression is what makes the removal\n * stick, so a daemon that never received it WILL list the conversation again. Reporting\n * that as success would be a lie the operator only discovers later.\n */\nexport const IntegrationForget = z.object({\n integrationId: z.string().uuid(),\n channels: z.array(z.string()).min(1)\n});\n/**\n * D→C REP (corr = `integration/leave` id). `ok:false` carries the platform's own\n * refusal so the console can show it verbatim — \"last_member\", a missing scope, a\n * bot that lacks the right — instead of a generic failure. The daemon reconciles\n * the channel set separately over `integration/channels`; this reply is only the\n * verdict on the platform call.\n */\nexport const IntegrationLeaveOk = z.object({\n ok: z.boolean(),\n error: z.string().optional()\n});\n//# sourceMappingURL=integration.js.map","import { z } from 'zod';\nimport { AgentMemoryBinding } from './memory-connection.js';\nimport { IntegrationSpec } from './integration.js';\nimport { CronUpsert } from './cron.js';\nimport { normalizeGitHubSkillSource } from '../git-url.js';\n/**\n * Agent lifecycle (protocol §4.4, §7.4, §8).\n *\n * There is no CP→daemon prompt-delivery frame: the daemon prompts an agent from\n * its own ingress (platform adapters or relay `rd/*` delivery), never the CP.\n * The old `agent/prompt` + per-agent `seq` machinery was reserved infrastructure\n * with no live caller and has been removed.\n */\n/**\n * Where the agent runs. Two modes; the **path is always daemon-generated** —\n * never specified by the caller (UX picks the mode, the machine owns the dir).\n *\n * - `scratch`: a fresh empty working dir on the machine, with no default repo.\n * `gitCredential: github-app` enables credentials only for repositories that\n * were explicitly authorized for the agent.\n * - `github`: the daemon clones `gitRepo` @ `branch` and runs the agent in\n * `agentDir` (a subdir of the repo, repo-root if omitted). **Multiple agents\n * may share one repo** — they differ by `agentDir`, so the repo is not an\n * owned entity, just shared config on each agent.\n */\nexport const AgentWorkspace = z.discriminatedUnion('mode', [\n z.object({\n mode: z.literal('scratch'),\n // Workspace isolation is runtime-owned rather than a filesystem path. The\n // console exposes this as the simpler Worktree on/off choice for Git repos.\n isolation: z.enum(['shared', 'session']).default('shared'),\n // Scratch has no implicit/default repository. The credential helper still\n // lets git/gh request explicitly authorized repositories by name.\n gitCredential: z.enum(['github-app']).optional()\n }),\n z.object({\n mode: z.literal('github'),\n isolation: z.enum(['shared', 'session']).default('shared'),\n gitRepo: z.string(), // FULL cloneable address, e.g. https://github.com/acme/infra (normalizeGitUrl)\n branch: z.string().default('main'),\n agentDir: z.string().optional(), // subdir within the repo; omitted ⇒ repo root\n // Credential mode for remote git ops. Absent ⇒ anonymous (public repos,\n // the pre-github-app behavior). 'github-app' ⇒ the daemon pulls short-lived\n // CP-minted installation tokens over gitcred/request and injects them via\n // the local credential helper — no durable git credential on the host.\n gitCredential: z.enum(['github-app']).optional()\n })\n]);\n/** Who reviews Codex approval requests that cross the active sandbox boundary.\n * This is deliberately independent from the ACP permission mode: Auto-review\n * changes the reviewer, not the sandbox or approval policy. */\nexport const ApprovalsReviewer = z.enum(['user', 'auto_review']);\n/**\n * MCP-server name reserved for the daemon's own injected stdio bridge (its\n * platform tools). A config-defined or agent-enabled server under this name\n * would collide with the bridge entry at ACP `session/new`, so the daemon\n * strips it and the CP rejects it in `AgentSpec.mcpServers` at the API edge.\n */\nexport const RESERVED_MCP_SERVER_NAME = 'agentconnect';\n/**\n * The curated Lucide glyph set a `glyph` icon may use — the single source of\n * truth for the picker, the DTO validation, and the CP icon-endpoint renderer.\n * `glyph` is constrained to this set so an API/CLI-created icon can't persist a\n * name the console `<Icon>` and the PNG endpoint don't both render. The web\n * picker mirrors this list (it does not import this package) — keep in sync.\n */\nexport const AGENT_ICON_GLYPHS = [\n // The AgentConnect brand diamond — the fixed identity of the built-in preset\n // agents (preset-agents.md §3.1). Renderers special-case it: a multi-color\n // brand mark (not a Lucide stroke glyph) drawn plateless — the native logo,\n // its `color` field inert. The web picker deliberately does NOT offer it in\n // its grid, though a stored value renders everywhere.\n 'agentconnect',\n 'bot',\n 'cpu',\n 'terminal',\n 'code',\n 'rocket',\n 'zap',\n 'bug',\n 'git-branch',\n 'message-square',\n 'sparkles',\n 'brain',\n 'wrench',\n 'ship',\n 'box',\n 'hexagon',\n 'compass',\n 'atom',\n 'flame',\n 'star',\n 'heart',\n 'globe',\n 'database',\n 'shield',\n 'feather'\n];\n/**\n * An agent's display icon (docs: the Console \"Agent Avatar\" picker). A\n * discriminated union on `kind`:\n * - `runtime` — derive the mark from the agent's runtime (Claude/Codex/…), the\n * legacy behavior; also the meaning of a null/absent icon.\n * - `glyph` — a curated Lucide glyph (see {@link AGENT_ICON_GLYPHS}) on a solid\n * color plate (the create-time random default is a `glyph`). An unknown glyph\n * fails to parse and degrades to the runtime mark on every surface.\n * - `image` — a user-uploaded avatar. The bytes live in the CP's configured\n * object store (S3-compatible; see docs/designs/icon-uploads.md), NOT in this\n * descriptor. Its optional opaque generation distinguishes successive writes\n * to the stable object key; legacy rows omit it. The display/serve URL is\n * resolved separately (the object store's public URL for the owner's key),\n * surfaced as the DTO `iconUrl` / `AgentSpec.iconUrl`. Set only via the upload\n * route; never via a create/update body.\n * This descriptor is CP-owned + stored on the agent and surfaced to the web\n * console. The daemon never receives it — it gets only the resolved public\n * `AgentSpec.iconUrl` (for the Slack per-message avatar), so it needs no renderer.\n */\nexport const AgentIcon = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('runtime') }),\n z.object({ kind: z.literal('glyph'), glyph: z.enum(AGENT_ICON_GLYPHS), color: z.string() }),\n z.object({ kind: z.literal('image'), generation: z.string().min(1).max(128).optional() })\n]);\n/**\n * A self-contained Git skill definition the daemon acquires into a private\n * snapshot and installs through its exact `skills` dependency after the\n * workspace is ready and before the ACP host spawns (shared-skills.md §4/§6).\n * The source definition rides INLINE on the AgentSpec (and lands in agent.json,\n * like mcpServers) — there is no separate skillsource frame or daemon-side def\n * cache. The CP resolves each agent's enabled org-level `SkillSource` rows into\n * these entries when it builds the spec.\n */\n// Skill selections become `-s` arguments to the isolated CLI, while the source\n// is parsed by the Git acquisition boundary. Reject option-looking values at\n// the wire boundary — the daemon validates again in depth.\nconst SkillSelectionArg = z.string().regex(/^[a-z0-9](?:[a-z0-9._-]{0,126}[a-z0-9_])?$/, {\n message: 'must be a canonical lowercase skills CLI name without a trailing dot or hyphen'\n});\nconst SkillRef = z\n .string()\n .max(256)\n .refine((s) => s.length > 0 && !/[\\0\\r\\n]/.test(s), { message: 'must be a non-empty single-line ref' });\nconst SkillSubDir = z\n .string()\n .max(1_024)\n .refine((s) => s.length > 0 &&\n !s.startsWith('/') &&\n !s.includes('\\\\') &&\n !/[\\0\\r\\n]/.test(s) &&\n s.split('/').every((part) => part.length > 0 && part !== '.' && part !== '..'), { message: 'must be a safe relative subdirectory' });\nconst GitHubRepositoryId = z\n .string()\n .regex(/^[1-9]\\d{0,19}$/, { message: 'must be a canonical positive GitHub repository id' });\nexport const AgentSkillEntry = z.object({\n // Display/log label — the org-level source name. NOT passed to the CLI.\n name: z.string().min(1).max(64),\n // Credential-free Git acquisition input (owner/repo, clone URL, or a\n // tree/<ref>/<subdir> path). The CLI sees only the resulting local snapshot.\n source: z\n .string()\n .min(1)\n .max(512)\n .refine((s) => !s.startsWith('-'), { message: 'must not start with \"-\"' })\n .refine((s) => {\n try {\n normalizeGitHubSkillSource(s);\n return true;\n }\n catch {\n return false;\n }\n }, { message: 'must be a bounded GitHub repository source' }),\n // Rename-proof GitHub identity. Current CP projections must carry this exact\n // decimal id; the daemon verifies it through the numeric endpoint before any\n // name-based fetch.\n githubRepoId: GitHubRepositoryId,\n // Optional branch/tag/commit. The daemon composes it into the source when set;\n // a tag/commit pins content, a branch/absent tracks the head (design §5).\n ref: SkillRef.optional(),\n // Optional repo-relative install directory.\n subDir: SkillSubDir.optional(),\n // Which skills from the source to install (passed as repeated `-s`). Empty ⇒\n // install every skill the source exposes (no `-s`).\n skills: z\n .array(SkillSelectionArg)\n .max(64)\n .refine((skills) => new Set(skills).size === skills.length, { message: 'skill selections must be unique' })\n .default([])\n});\n/** Current-CP projection boundary. Kept separate from the rolling-compatible\n * wire decoder below: a new daemon may briefly receive an old CP's previously\n * legal rows, and one such row must not reject the entire register snapshot. */\nexport const InstallableAgentSkills = z\n .array(AgentSkillEntry)\n .max(64)\n .refine((entries) => new Set(entries.map((entry) => entry.name)).size === entries.length, {\n message: 'skill source names must be unique'\n});\nconst LegacySkillArg = z\n .string()\n .min(1)\n .refine((s) => !s.startsWith('-'), { message: 'must not start with \"-\"' });\nexport const CompatibleAgentSkillEntry = z.object({\n name: z.string(),\n source: LegacySkillArg,\n // Optional only for CP-first rolling upgrades and previously persisted\n // agent.json files. Strict daemon admission drops unbound legacy entries.\n githubRepoId: z.string().optional(),\n ref: z.string().optional(),\n subDir: z.string().optional(),\n skills: z.array(LegacySkillArg).default([])\n});\n/** One centrally accepted, immutable Agent Skills bundle enabled for an agent.\n * Content is fetched separately in bounded chunks; AgentSpec carries metadata\n * only so register/agent-upsert frames stay small. */\nexport const ManagedSkillEntry = z\n .object({\n id: z.string().uuid(),\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),\n revision: z.number().int().positive(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/)\n})\n .strict();\n/**\n * The editable agent definition the CP owns and the daemon needs to run it:\n * prompt + runtime selection. The launch protocol carries this config and the\n * daemon synthesizes the system prompt locally; `description` IS the prompt.\n */\nexport const AgentSpec = z.object({\n // Owning tenant. Optional only for CP/daemon rolling compatibility; a current CP always sends it.\n orgId: z.string().min(1).max(64).optional(),\n name: z.string(),\n // Human-readable bot name. CP snapshots/upserts always ship value or null so\n // clearing it removes a stale daemon-local display name; absent remains\n // available to hand-authored/partial specs as \"leave unchanged\".\n displayName: z.string().nullable().optional(),\n // Absolute, publicly-fetchable avatar URL the CP resolves from the agent's icon\n // (agent.icon → the CP icon endpoint for runtime/glyph, or the image URL directly).\n // The daemon uses it as the Slack per-message `icon_url` (chat:write.customize) —\n // the sibling of displayName→username (PR #539). CP ships value or null so clearing\n // the icon drops the override; null/absent ⇒ Slack keeps the app's default avatar.\n iconUrl: z.string().url().nullable().optional(),\n // The system prompt seed; appended to the daemon's standing prompt. The CP always\n // ships it as a string — a cleared description replicates as \"\" so the daemon\n // overwrites a stale seed; an absent key means \"leave unchanged\" (hand-authored/\n // partial specs). Deliberately NOT nullable: older daemons parse this as a plain\n // string and would reject a null register/ok roster entry, failing the whole\n // handshake. An empty prompt seed and \"no description\" are equivalent, so the \"\"\n // collapse is lossless.\n description: z.string().optional(),\n runtime: z.string().optional(), // which ACP runtime to run, e.g. \"claude\" / \"codex\"\n // Per-runtime override vocabularies (model / effort / permission mode). Switching\n // runtime invalidates them, so the CP must be able to CLEAR them, not just set them:\n // absent ⇒ leave the on-disk value alone (hand-authored agent.json / partial spec)\n // null ⇒ clear the override (revert to the runtime's own default)\n // string ⇒ set it\n // The CP's agentRecordToSpec always ships these (value or null) so a clear replicates.\n model: z.string().nullable().optional(), // runtime model, e.g. \"opus\"\n reasoningEffort: z.string().nullable().optional(),\n executionMode: z.string().optional(), // e.g. \"byoc\"\n outputMode: z.enum(['none', 'minimal', 'low', 'medium', 'high']).optional(), // platform output verbosity → agent.json output.mode ('none' = session-only, nothing to the IM)\n showFooter: z.boolean().optional(), // render platform attribution/session footers; absent ⇒ leave agent.json unchanged\n showStatusBar: z.boolean().optional(), // render Slack's persistent session status row; absent ⇒ leave agent.json unchanged\n fastMode: z.boolean().optional(), // runtime fast mode (ACP `model_config` toggle); absent ⇒ leave runtime default\n permissionMode: z.string().nullable().optional(), // runtime permission/approval mode (ACP `mode` selector); absent ⇒ leave alone, null ⇒ clear\n approvalsReviewer: ApprovalsReviewer.nullable().optional(), // Codex approval reviewer; independent from permissionMode\n // Explicit opt-in: when false, conversation participants cannot change runtime\n // settings (model, effort, permission mode, fast mode) or answer approval\n // requests. Agent editors decide pending requests from the console instead.\n allowRuntimeChangesInChat: z.boolean().optional(),\n // Operational message-processing toggle (orthogonal to placement). When true the\n // agent stays placed/connected but the daemon skips ALL turn dispatch (platform,\n // webchat, cron). Optional (not defaulted) so an absent value leaves the on-disk\n // agent.json pause untouched — same contract as fastMode/permissionMode.\n pause: z.boolean().optional(),\n workspace: AgentWorkspace.optional(), // where it runs; absent ⇒ daemon defaults to scratch\n env: z.record(z.string(), z.string()).optional(), // extra env injected into the runtime\n // Write-only secret env vars: same injection as `env` (merged into the spawned\n // child's environment, secrets winning on a key collision), but their VALUES never\n // travel back out — the CP DTO exposes only the key names, and the console masks\n // them. Plaintext at rest (like `env`) and shipped over the TLS WS; \"secret\" here\n // means write-only from the API/UI, not KMS-sealed. Always shipped (even {}) so a\n // removed secret replicates, same contract as `env` below.\n secrets: z.record(z.string(), z.string()).optional(),\n // Which memory backend the agent uses (design: docs/designs/memory-evolution.md):\n // managed — our <agent-root>/memory/ directory (default)\n // native — the runtime's own memory (Claude auto-memory / Codex memories),\n // redirected under the agent root for per-agent isolation\n // external — an outside service (mem0); not yet implemented\n // none — disable both daemon-managed and runtime-native persistent memory\n // Optional (absent ⇒ leave the on-disk agent.json value alone — same contract as\n // fastMode/pause). A brand-new agent with no value defaults to managed daemon-side.\n memory: AgentMemoryBinding.optional(),\n // Names of daemon-configured MCP servers (daemon config `mcpServers`, reported\n // via `facts/daemon-runtimes`) to attach at `session/new`. Empty/absent ⇒ none.\n mcpServers: z.array(z.string()).default([]),\n // Skill sources to install into the workspace before the ACP host spawns\n // (design: shared-skills.md). Unlike mcpServers (names resolved daemon-side),\n // these are SELF-CONTAINED entries — the daemon needs nothing but agent.json to\n // acquire bounded snapshots and invoke its bundled CLI. Always shipped (even\n // []) so removing the last skill replicates.\n // Decode the previous wire vocabulary during CP-first rolling upgrades. The\n // current CP projects only `InstallableAgentSkills`; the daemon independently\n // applies the same strict acquisition/size admission before any host starts.\n skills: z.array(CompatibleAgentSkillEntry).default([]),\n // Centrally accepted `.skill` ZIP revisions. Unlike Git source entries above,\n // these are digest-addressed metadata; the daemon downloads/cache-verifies the\n // bundle through managed-skill/read before session start.\n managedSkills: z\n .array(ManagedSkillEntry)\n .max(64)\n .refine((entries) => new Set(entries.map((entry) => entry.id)).size === entries.length, {\n message: 'managed skill ids must be unique'\n })\n .default([]),\n // Agent→agent call authorization (design §2.5). `callPolicy` gates who may wake\n // this agent via the `messageAgent` tool: 'all' ⇒ any peer in the org, 'selected'\n // ⇒ only agents in `allowedCallerAgentIds`. Replicated CP→daemon so the daemon can\n // enforce the policy LOCALLY on same-daemon delivery (no CP hop on the hot path).\n // Optional (absent ⇒ leave the on-disk agent.json value alone — same contract as\n // pause/memory); `allowedCallerAgentIds` always ships (even []) so removing the last\n // allowed caller replicates.\n callPolicy: z.enum(['all', 'selected']).optional(),\n allowedCallerAgentIds: z.array(z.string()).default([]),\n // Outbound half of agent→agent authorization. `selected` means this agent may\n // discover/message only peers in `allowedTargetAgentIds`. The target's inbound\n // policy must also allow this agent; effective authorization is the intersection.\n // Both fields remain optional when decoding an older CP payload so a mixed-version\n // update cannot retain an on-disk `selected` mode while silently clearing its list.\n // A current CP always ships both fields, including [] to clear the final member.\n outboundPolicy: z.enum(['all', 'selected']).optional(),\n allowedTargetAgentIds: z.array(z.string()).optional(),\n // Self-introduce-on-join (issue #536): when true, on a genuine new channel join the\n // agent proactively introduces itself to the peers already there (via listAgents\n // → messageAgent) so they can record it in memory. Replicated CP→daemon. Optional\n // (absent ⇒ leave the on-disk agent.json value alone — same contract as pause/fastMode).\n introduceOnJoin: z.boolean().optional(),\n // Per-agent OS sandbox preference (issue #642). It is effective only when the\n // host has bwrap/sandbox-exec; daemon `security.requireSandbox` forces it on and\n // prevents daemon startup when no mechanism exists. Optional means leave the\n // on-disk agent.json value alone; a brand-new agent defaults to false.\n runInSandbox: z.boolean().optional(),\n // True when this agent is an org built-in preset (preset-agents.md §3.1): a\n // `preset_agent` row references it. Replicated so the daemon can gate preset-only\n // behavior locally, including attaching `agentconnect-admin` only when the CP\n // supplies the conversation entitlement. Optional so an older CP's spec leaves\n // the on-disk value alone; a current CP always ships it.\n builtin: z.boolean().optional(),\n // Monotonic revision of this agent's fully resolved CP-owned configuration\n // (organization-secrets-and-variables.md §7). `env`/`secrets` are FULL maps, so\n // an out-of-order snapshot would reinstate a rotated or deleted value; the\n // daemon persists the greatest revision it applied and refuses an older one.\n // Not environment-specific — every CP-side mutation that can change a field\n // assembled into this spec bumps it through the same writer, giving one\n // ordering domain per agent.\n //\n // Encoded as a DECIMAL STRING, not a number: the CP column is a bigint and a\n // JSON number would silently lose precision past 2^53 on either side.\n // Optional for rolling upgrades (an older CP omits it, an older daemon ignores\n // it), but a bound agent may only be placed on a daemon advertising\n // `agent-config-revision-v1` — the feature never relies on lenient decoding.\n configRevision: z\n .string()\n .regex(/^(0|[1-9][0-9]*)$/)\n .optional()\n});\nexport const AgentLaunch = z.object({\n // C→D, carries ControlExt(epoch)\n agentId: z.string().uuid(),\n runtime: z.string(), // must be in RegisterReq.capabilities.runtimes\n workspaceId: z.string().uuid(),\n capabilities: z.array(z.string()), // the active-capability pin (§8.1)\n spec: AgentSpec, // prompt/model/env — arrives at start, no separate CRUD needed\n mode: z.enum(['long_lived', 'per_turn']).default('long_lived'), // 🅰️ decision #2 knob\n // Web API launch provenance (session-visibility.md §4.4): CP-minted when the\n // launch was requested by a console user, echoed back by the daemon on the\n // resulting session's `event/session` so ingest can classify it `private`\n // with that user as owner. Optional — CLI/orchestration launches and older\n // CPs omit it. NOT the launchId fence (which is per-launch, not per-user).\n launchCorrelationId: z.string().uuid().optional()\n});\n/**\n * Live agent CRUD (C→D): the console edited an agent's spec; push it so a\n * running daemon reloads without waiting for the next launch. `agent/remove`\n * tears the agent down. Deleting an agent never relaunches it.\n */\nexport const AgentUpsert = z.object({\n agentId: z.string().uuid(),\n spec: AgentSpec\n});\nexport const AgentRemove = z.object({\n agentId: z.string().uuid()\n});\n/** Hard cap on one existence query; a sweep with more candidates chunks. */\nexport const AGENT_EXISTS_MAX = 1000;\n/**\n * D→C REQ (reply: `agent/exists/ok`) — which of these agents the control plane still knows.\n * Install-wide: a pool member's orphan reconciler reads agent ids off cluster objects that\n * span every org it serves and asks in one round trip. Existence only, no spec: the answer\n * decides whether a leaked sandbox object may be collected, nothing more.\n */\nexport const AgentExists = z.object({\n agentIds: z.array(z.string().uuid()).min(1).max(AGENT_EXISTS_MAX)\n});\n/** C→D REP to `agent/exists`: the subset of the asked ids that exist. An id absent here is gone. */\nexport const AgentExistsOk = z.object({\n existing: z.array(z.string().uuid()).max(AGENT_EXISTS_MAX)\n});\n/**\n * Safe move lifecycle (C→D REQ → generic `ack`). `agent/detach` fences the\n * source or stages the target and archives any daemon-local root;\n * `agent/activate` atomically applies the authoritative spec/integration/cron\n * bundle, restores and exact-prunes an archive when present, then makes the\n * agent servable.\n */\nexport const AgentDetach = z.object({\n agentId: z.string().uuid(),\n /** Fences late lifecycle retries from a superseded move operation. */\n moveId: z.string().uuid(),\n /** Source-side hard cutover. Cancel already-admitted turns instead of waiting\n * for them to drain; their sessions remain daemon-local and are not replayed\n * after activation on the target. */\n discardActiveTurns: z.boolean().optional(),\n /** Scratch→GitHub conversion guard. The daemon drains the agent first, then\n * ACKs only when the live scratch working directory is still empty. */\n requireEmptyWorkspace: z.boolean().optional()\n});\nexport const AgentActivate = z.object({\n agentId: z.string().uuid(),\n /** Absent ⇒ authoritative unstage: release any fence held, and start no host unless the duty is held. */\n moveId: z.string().uuid().optional(),\n /**\n * One authoritative, acknowledged bootstrap bundle. Unlike the live CRUD\n * EVTs, these definitions are synchronously persisted under the staging gate\n * before activation can ACK, so a same-id stale secret/spec cannot survive.\n */\n spec: AgentSpec,\n integrations: z.array(IntegrationSpec),\n crons: z.array(CronUpsert),\n /** Prove the requested workspace can be materialized before activation ACK.\n * Used by scratch→GitHub conversion so a failed clone can be rolled back. */\n prepareWorkspace: z.boolean().optional(),\n /** Reconcile the daemon-local workspace to the authoritative mode/repo/branch.\n * The daemon preserves the checkout when that materialization is unchanged,\n * and replaces its contents when it changed. */\n reconcileWorkspace: z.boolean().optional()\n});\nexport const AgentLaunched = z.object({\n // D→C, REP/EVT\n agentId: z.string().uuid(),\n launchId: z.string().uuid(), // new fence value\n acpSessionId: z.string().optional(), // 🅰️ present iff long-lived ACP session (default)\n startedAt: z.string().datetime(),\n runtime: z.string() // e.g. \"claude\" / \"codex\"\n});\nexport const AgentStop = z.object({\n agentId: z.string().uuid(),\n launchId: z.string().uuid(),\n reason: z.string()\n});\nexport const AgentActivity = z.object({\n // D→C, EVT — activity-probe (§7.4)\n agentId: z.string().uuid(),\n launchId: z.string().uuid(),\n state: z.enum(['thinking', 'tool_call', 'awaiting_permission', 'idle']),\n ts: z.string().datetime()\n});\nexport const AgentScopeDenied = z.object({\n // D→C, EVT — capability-scope audit (§8.1)\n agentId: z.string().uuid(),\n launchId: z.string().uuid(),\n capability: z.string()\n});\n/** Editor approval queue. The daemon owns the live resolver and durable local\n * history; the Control Plane only proxies this bounded, secret-masked summary. */\nexport const AgentPermissionRequestRecord = z.object({\n id: z.string().uuid(),\n agentId: z.string().uuid(),\n // Optional for rolling compatibility with daemons that predate session-scoped\n // approval rendering. Current daemons always report the owning ACP session id.\n sessionId: z.string().min(1).optional(),\n createdAt: z.string().datetime(),\n requesterId: z.string().nullable(),\n requesterName: z.string().nullable(),\n command: z.string().max(240),\n status: z.enum(['pending', 'allowed', 'denied', 'expired']),\n resolvedAt: z.string().datetime().nullable()\n});\nexport const AgentPermissionRequestList = z.object({\n agentId: z.string().uuid(),\n limit: z.number().int().min(1).max(100).default(50)\n});\nexport const AgentPermissionRequestPage = z.object({\n agentId: z.string().uuid(),\n requests: z.array(AgentPermissionRequestRecord)\n});\nexport const AgentPermissionDecision = z.object({\n agentId: z.string().uuid(),\n requestId: z.string().uuid(),\n decision: z.enum(['allow', 'deny'])\n});\n// `agent/wake` (C→D REQ → `agent/wake/ok`): bring a cluster agent's sandbox to Running WITHOUT a turn.\n// The daemon claims the agent's duty on receipt like any trigger, so a set agent with no holder is\n// served by whichever member the wake reached; it answers with what it observed, never a promise.\nexport const AgentWakeReq = z.object({ agentId: z.string().min(1) });\n// `running` = the sandbox channel is bound; `starting` = the resume is in flight and the next read may\n// still refuse; `unsupported` = this daemon runs no sandboxes, so there is nothing to wake.\nexport const AgentWakeState = z.enum(['running', 'starting', 'unsupported']);\nexport const AgentWakeOk = z.object({ agentId: z.string().min(1), state: AgentWakeState });\n//# sourceMappingURL=agent.js.map","import { z } from 'zod';\n/**\n * Centralized MCP-provider distribution (C→D) — docs/designs/centralized-tool-management.md.\n *\n * The Control Plane owns MCP provider definitions and pushes them to the daemons\n * whose agents enable them (`mcpserver/upsert`, and the reconcile snapshot\n * `RegisterOk.mcpServers[]`). The daemon merges the spec into its `mcpServerDefs`\n * and attaches it at ACP `session/new` through the existing resolve path — a\n * pushed def is just an `http` MCP server.\n *\n * MCP-PROXY MODEL: in v1 the pushed `url` is a RELAY proxy URL and the injected\n * header is a short-lived **grant key** (`Authorization: Bearer …`) — never the\n * upstream endpoint or its real credential. Those stay on the CP + relay (§5).\n * SECURITY: `env`/`headers` may carry that bearer grant key — NEVER log this frame.\n */\n/** The `{name, value}[]` shape shared by MCP env + headers (mirrors the daemon's local McpServerDef). */\nconst NameValueList = z.array(z.object({ name: z.string(), value: z.string() })).default([]);\n/**\n * One MCP server definition the CP pushes to a daemon. Shape mirrors the daemon's\n * local `McpServerDef` (daemon config-schema.ts) with `name` inlined (the daemon\n * config keys the map by name). Transport-agnostic on the wire; the CP restricts\n * what it emits (v1 pushes proxied `http` defs only — the `sse`/`stdio`-only\n * restriction is a CP-side policy, not a wire constraint).\n */\nexport const McpServerSpec = z\n .object({\n orgId: z.string().min(1).max(64).optional(),\n name: z.string(),\n /**\n * Monotonic ordering marker: epoch millis of the ACTIVE GRANT this definition\n * was projected from — the only input that versions a proxy def, since the\n * proxy url is derived from the provider id and the relay base.\n *\n * Grant rotation keeps the retiring and the fresh grant both active until the\n * fresh one is distributed, so a definition projected inside that window can\n * be applied AFTER the fresh live push and would otherwise silently reinstate\n * a key the relay is about to retire. The daemon refuses a def strictly older\n * than the one it already applied; equal-or-newer applies, so a relay-base\n * change (same grant) still converges. Absent on daemon-local defs and from an\n * older CP, which reads as \"unordered — apply\".\n */\n issuedAt: z.number().int().nonnegative().optional(),\n transport: z.enum(['stdio', 'http', 'sse']).default('stdio'),\n command: z.string().optional(),\n args: z.array(z.string()).default([]),\n env: NameValueList,\n url: z.string().optional(),\n headers: NameValueList\n})\n .superRefine((def, ctx) => {\n if (def.transport === 'stdio' && !def.command)\n ctx.addIssue({ code: 'custom', path: ['command'], message: 'a stdio MCP server requires \"command\"' });\n if (def.transport !== 'stdio' && !def.url)\n ctx.addIssue({ code: 'custom', path: ['url'], message: `a ${def.transport} MCP server requires \"url\"` });\n});\n/** C→D EVT (`mcpserver/upsert`) — add or replace a pushed MCP server def on the daemon. */\nexport const McpServerUpsert = McpServerSpec;\n/** C→D EVT (`mcpserver/remove`) — drop a pushed MCP server def by name. */\nexport const McpServerRemove = z.object({ orgId: z.string().min(1).max(64).optional(), name: z.string() });\n//# sourceMappingURL=mcpserver.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Bot-AGNOSTIC agent-collaboration routing snapshot (agent-collaboration §2.3 / §6.2 / §6.5).\n *\n * The existing shared-bot `members` table is keyed by botId (`BotAssignment`) and\n * CANNOT address an agent on a DIFFERENT bot / arbitrary channel. This snapshot is\n * the fix: it maps a channel — `(orgId, platform, channelId)` — to the per-agent\n * placement + call policy the relay needs to route a cross-daemon `rd/agentmsg` and\n * the target daemon needs to terminal-verify a remote caller.\n *\n * It carries NO message body — pure routing/policy metadata, like the rest of the\n * control plane. The SAME shape is distributed two ways (§6.5):\n * - CP→relay over the `rc/*` wire (`rc/collab-routes`) — the relay routes\n * `toAgentId` → owning `daemonId` and authorizes the caller/target policy.\n * - CP→daemon over the daemon↔CP wire — as a `register/ok` field (reconnect\n * baseline) + a `collaboration/routes` EVT (hot push) — so the OWNING daemon of\n * the target can terminal-verify (defense in depth, §2.5 #4) the remote caller's\n * org/channel/placement against its OWN copy, never trusting the relay's claim\n * blindly.\n *\n * FOLLOW-UP (scoped down in P2, see PR description): the full versioned lifecycle\n * of §6.5 — per-entry tombstones, TTL/expiry after a CP disconnect, and\n * fail-closed-on-stale — is NOT fully implemented here. `generation` is present as\n * the version hook and the snapshot is FULL-REPLACE (converge-don't-diff, same as\n * `register/ok`), which is enough to route + authorize on a live CP. TTL-expiry and\n * tombstone semantics are a follow-up within this phase.\n */\n/** One agent's placement + call policy within a channel. `daemonId` is the owning\n * daemon the relay forwards to; `integrationId` is the DEFINITE reply integration\n * (§6.2 — no fallback to \"first connection\"). */\nexport const CollabAgentPlacement = z.object({\n agentId: z.string().uuid(),\n daemonId: z.string().uuid(),\n integrationId: z.string().uuid().optional(),\n /** Public Slack app id (`A…`) for this agent's bot. Receivers use it to recognize\n * AgentConnect-authored platform messages — the first half of verifying an\n * authorship claim (send-message-routing-rework.md §4). */\n botAppId: z.string().optional(),\n /** Public platform member id this agent's bot posts as (Slack `U…`) — the id a\n * `<@…>` mention resolves to. With {@link botShared} and `name` it is the complete\n * input for the conversation-specific mention ADDRESS\n * (send-message-routing-rework.md §8.5), which both directions need: rendering an\n * exact address to post, and resolving an inbound mention back to an agent.\n * Public metadata, never a credential. */\n botUserId: z.string().optional(),\n /** True when {@link botUserId} backs MORE THAN ONE agent (a shared bot). The bot user\n * id alone then cannot identify an agent, so its address carries the agent slug too\n * (`<@U_SHARED> reviewer`) and a BARE mention of it addresses no specific agent —\n * which is why a shared bot with no exact author claim fails closed at ingress (§4)\n * and why a bare shared-bot mention from an agent must not fall back to the channel\n * default (§6). */\n botShared: z.boolean().optional(),\n callPolicy: z.enum(['all', 'selected']).default('all'),\n allowedCallerAgentIds: z.array(z.string()).default([]),\n /** Caller-side authorization. Effective A→B access requires A's outbound\n * policy to admit B and B's inbound call policy to admit A. */\n outboundPolicy: z.enum(['all', 'selected']).default('all'),\n allowedTargetAgentIds: z.array(z.string()).default([]),\n // Directory name of the agent — carried so any daemon holding the snapshot can label a\n // REMOTE peer (caller or target) by name in a visible agent-call post, without a CP\n // round-trip or having listed the channel. `name` is the slug; `displayName` the\n // human-readable label. Optional for back-compat with an older CP that omits them.\n name: z.string().optional(),\n displayName: z.string().optional()\n});\n/**\n * One agent's placement + call policy carried OUTSIDE any channel — the org-scoped\n * peer directory entry.\n *\n * Every structure on the CP→daemon and CP→relay wires is channel-keyed, so an agent\n * with NO IM integration (webchat, hook, dream, memory-only) never appears in any\n * `channels[]` entry at all. The channel-keyed snapshot structurally cannot express\n * \"which agents exist in this org\", which is precisely the input channel-free\n * authorization needs: discovery and A2A authorization depend only on the directional\n * call policy (`outboundPolicy`/`allowedTargetAgentIds` on the caller,\n * `callPolicy`/`allowedCallerAgentIds` on the target), org-scoped, with channel\n * demoted to an optional filter. Hence the flat list below.\n */\nexport const CollabOrgAgent = CollabAgentPlacement.extend({\n // Org ids are opaque strings (see CollabChannelRoute) — carried per entry because\n // the flat list is not nested under an org-keyed parent. Cross-org pairs never resolve.\n orgId: z.string().min(1),\n // The member a wake is forwarded to. ABSENT ⇒ PENDING: the agent exists, its policy is authoritative, but\n // no member is addressable yet (unconfirmed pool grant / lapsed lease) → `not_ready`, not `not_found`.\n // Only this flat directory carries pending entries; `channels[]` never does.\n daemonId: z.string().uuid().optional()\n});\n/** All agents present in one channel, across daemons. `orgId` scopes routing +\n * authorization: a cross-org caller/target pair never resolves (§2.5 — cross-org\n * rejected). */\nexport const CollabChannelRoute = z.object({\n // Org ids are opaque strings (Prisma uses cuid(); the seeded dev org uses\n // `org_default...`), unlike daemon/agent/integration ids which are UUIDs.\n orgId: z.string().min(1),\n platform: Platform,\n channelId: z.string().min(1),\n agents: z.array(CollabAgentPlacement)\n});\n/**\n * The full collaboration snapshot — FULL-REPLACE (converge-don't-diff): the\n * recipient replaces its whole table with `channels`. `generation` monotonically\n * increases per source so a recipient can ignore a stale re-order (version hook for\n * the §6.5 lifecycle follow-up).\n */\nexport const CollabRoutesSnapshot = z.object({\n generation: z.number().int().nonnegative().default(0),\n channels: z.array(CollabChannelRoute).default([]),\n /**\n * FLAT org-scoped directory, alongside (not instead of) `channels`. It is the only\n * place an integration-less agent can appear — see `CollabOrgAgent` — and therefore\n * the authorization input for channel-free A2A. `default([])` keeps a snapshot from\n * an older CP (which advertises no `agent-directory-org-scope-v1`) decodable.\n */\n agents: z.array(CollabOrgAgent).default([]),\n /**\n * §6.1 origin-kind classification for the platform ids the EMITTER knows — how an\n * older peer classifies an id a newer CP introduces (its own built-in seed only\n * covers ids its build shipped with). Consumers overlay these entries on their\n * seed; an id classified by neither defaults to `'chat'`, the fail-closed answer\n * wherever placements matter (`coordsDecision`). Both fields read as open strings\n * per the S1a rule. `default([])` keeps a pre-S1b snapshot decodable.\n */\n platformKinds: z.array(z.object({ platformId: z.string().min(1), originKind: z.string().min(1) })).default([])\n});\n//# sourceMappingURL=collab.js.map","import { z } from 'zod';\n/**\n * Deployment GitHub App identity used for ordinary commits made by an agent.\n * This is public attribution metadata, not a credential.\n */\nexport const GitCommitIdentity = z.object({\n name: z.string().min(1),\n email: z.string().min(1)\n});\n/**\n * Git credentials (github-app workspaces) — daemon-pulled, CP-minted.\n *\n * The CP holds the GitHub App private key and mints short-lived (1h,\n * non-renewable) installation access tokens scoped to a single repository;\n * the daemon pulls one on demand right before a remote git operation and\n * holds it in memory only. Unlike `secrets/*` (lease + reference semantics,\n * still unwired), the grant here carries the TOKEN MATERIAL itself — same\n * plaintext-over-TLS-WS posture as `integration/upsert`, and the same\n * discipline: **never log the payload**.\n *\n * The daemon may only name an agentId — the CP resolves agent → workspace →\n * repo → installation itself, so a daemon can never pick a repo it wasn't\n * assigned. Failures come back as correlated `error` REPs: `SCOPE_DENIED`\n * (not a github-app workspace, or agent not placed on this daemon — stop\n * asking), `LEASE_DENIED` (installation uninstalled/suspended or the repo\n * left its grant set — recoverable only by an operator), `RATE_LIMITED`,\n * `INTERNAL`.\n */\n/**\n * Token capability classes (webhook-triggers-and-github-events.md P2.5 write-back).\n * `contents` is the git data plane (the pre-capabilities behavior); `issues` /\n * `pull_requests` buy the agent `gh` write-back (issue/PR comments), and\n * `actions` buys GitHub Actions inspection/execution. Every\n * General agent credentials mint every capability admitted by the repo's\n * `gitAccess` / authorization tier — a read-only agent gets read-only\n * issues/PR scopes and no Actions capability.\n * The one exception is purpose=github_hook_reply: a daemon-owned writer whose\n * token never enters the agent environment and is gated by an enabled hook.\n */\nexport const GitCredCapability = z.enum(['contents', 'issues', 'pull_requests', 'actions']);\nexport const GitCredRequest = z.object({\n // D→C, REQ\n agentId: z.string().uuid(),\n reason: z.enum(['clone', 'fetch', 'pull', 'push', 'helper']).optional(), // observability only\n // Absent ⇒ ['contents'] — pre-P2.5 daemons keep byte-identical behavior.\n capabilities: z.array(GitCredCapability).nonempty().optional(),\n // The daemon-owned GithubPoster is a narrower consumer than an agent's git/\n // gh tools: its token never enters the agent environment and may only back\n // the one final comment for an enabled GitHub hook turn. Marking that purpose\n // explicitly lets the CP apply the hook authorization instead of incorrectly\n // clamping the comment token to the workspace contents gitAccess.\n purpose: z.literal('github_hook_reply').optional(),\n // Trusted hook identity copied from the relay-delivered rd/msg. Required by\n // the CP for purpose=github_hook_reply so authorization stays rename-safe on\n // HookDef.repoId instead of comparing mutable owner/repo display names.\n hookId: z.string().uuid().optional(),\n // A poster sets this only after GitHub rejects a cached token with 401/403.\n // The CP then bypasses its installation-token cache exactly once; ordinary\n // git/gh requests ignore it.\n forceRefresh: z.boolean().optional(),\n // Absent ⇒ the agent's workspace repo (pre-multi-repo behavior). \"owner/repo\".\n // The CP admits only workspace ∪ the agent's AgentRepoAuthorization rows and\n // mints the requested capability subset at the row's access tier — the daemon\n // still cannot pick an arbitrary repo (agent-multi-repo-authorization.md\n // decision 2). A purpose=github_hook_reply request is separately gated by an\n // enabled GitHub hook and receives only issues/PR write, never contents. Old\n // CPs strip this field and answer with a WORKSPACE grant: consumers MUST\n // verify grant.repoFullName against what they asked for before trusting it.\n repoFullName: z.string().optional()\n});\nexport const GitCredGrant = z.object({\n // C→D, REP (plaintext token — never log)\n username: z.literal('x-access-token'), // fixed HTTPS basic-auth username for installation tokens\n token: z.string(), // ghs_… — new stateless format runs ~520 chars; never assume a length\n ttlSec: z.number().int(), // CP-computed remaining life, 60s clock-skew allowance already shaved.\n // Daemons MUST track expiry as monotonic receivedAt+ttlSec (a skewed local\n // clock must never resurrect a dead token); `expiresAt` is observability only.\n expiresAt: z.string().datetime(),\n repoFullName: z.string(), // owner/repo — helper path-match + diagnostics\n access: z.enum(['read', 'write'])\n});\n//# sourceMappingURL=gitcred.js.map","import { z } from 'zod';\nimport { Platform, RouteAssign } from './route.js';\nimport { CronUpsert } from './cron.js';\nimport { SecretsGrant } from './secrets.js';\nimport { AgentSpec } from './agent.js';\nimport { IntegrationSpec } from './integration.js';\nimport { McpServerSpec } from './mcpserver.js';\nimport { MemoryConnectionSpec } from './memory-connection.js';\nimport { CollabRoutesSnapshot } from './collab.js';\nimport { GitCommitIdentity } from './gitcred.js';\n/**\n * Capability upload + the reconcile snapshot — protocol §3.3.\n *\n * `register/ok` is the authoritative source of truth: the daemon converges its\n * local cache to it. CP wins all conflicts, so re-issuing the same snapshot is\n * idempotent.\n */\nexport const RegisterReq = z.object({\n host: z.string(), // hostname (display only)\n // Rollout generation of a pool member (the deployment's pod-template hash, from AC_POD_TEMPLATE_HASH).\n // Only the newest live generation of a member set may claim vacated duty groups; absent for\n // local daemons and older pods, which the rule never excludes.\n generation: z.string().min(1).max(128).optional(),\n // An OBSERVER connection: the `reconcile --once` CronJob, which authenticates with the same\n // projected pool identity but serves nothing. The CP admits the identity and answers reads, but\n // enrolls it in no member set, so the duty ledger can never grant it anything (k8s-daemon-pool.md §4).\n observer: z.boolean().optional(),\n capabilities: z.object({\n platforms: z.array(Platform), // D3 adapters present\n runtimes: z.array(z.string()), // e.g. [\"claude\",\"codex\"]\n acp: z.boolean(), // can this daemon host ACP sessions (D6)?\n features: z.array(z.string()).default([]) // e.g. [\"cli-wrapper-fallback\",\"worktree-iso\"]\n }),\n maxAgents: z.number().int(), // concurrency ceiling for placement (C3)\n localState: z.object({\n // what the daemon currently believes it owns (for reconcile)\n assignments: z.array(z.string()), // sessionKeys it is actively serving\n crons: z.array(z.string()), // cronIds it has scheduled\n leases: z.array(z.string()), // leaseIds it holds\n // Active on-disk replicas plus fail-closed interrupted-removal markers.\n // `unknown` is the rolling-upgrade/legacy value:\n // the CP may prune it only when the durable row proves the replica moved.\n // Defaults keep an older daemon compatible with a newer CP.\n agents: z.array(z.object({ agentId: z.string(), origin: z.enum(['cp', 'unknown']) })).default([]),\n integrations: z.array(z.object({ integrationId: z.string(), origin: z.enum(['cp', 'unknown']) })).default([]),\n // Durable fail-closed move tombstones. A newer CP repairs entries with a\n // valid token after register/ok. A missing token represents corrupt local\n // metadata: the daemon keeps that agent drained for manual repair without\n // making the whole registration undecodable.\n stagedAgents: z.array(z.object({ agentId: z.string(), moveId: z.string().uuid().optional() })).default([])\n })\n});\n/**\n * D→C EVT (`capabilities/update`) — hot full-replace of the connection's\n * `RegisterReq.capabilities`. `register` computes the feature set before the\n * reconcile roster lands and before the runtime probe sweep runs, so a feature\n * derived from either would otherwise stay hidden until the next reconnect.\n * `webchat_remote_mcp_v1` is not one of those dynamic features: it reflects the\n * daemon's confidential grant-delivery implementation, independently of roster,\n * runtime probe, and sandbox state. The daemon re-announces whenever its computed\n * capability set changes mid-connection; the CP treats it exactly like the register\n * value it refreshes. An older CP replies `error{UNKNOWN_FRAME}`, which the daemon\n * ignores — the feature then simply waits for the next register, the pre-frame behavior.\n */\nexport const CapabilitiesUpdate = z.object({\n capabilities: RegisterReq.shape.capabilities\n});\n/**\n * One relay the daemon SHOULD hold an outbound WS to (shared-bot-relay.md §5).\n * The roster is all-to-all by design: a webchat/webhook landing on ANY relay\n * instance must find this daemon's connection without cross-instance forwarding.\n * That only holds if `url` (the relay's registered `daemonUrl`) routes to that\n * SPECIFIC instance — the daemon confirms the landing spot against\n * `rd/hello/ok.relayId` and treats a mismatch as a deployment misroute.\n */\nexport const RelayRosterEntry = z.object({\n relayId: z.string().uuid(),\n url: z.string() // the relay's daemonUrl — per-instance routable, never a pool LB\n});\n/**\n * C→D EVT (`relay/roster`) — hot roster update (relay registered / swept).\n * Carries the WHOLE desired set, same converge-don't-diff semantics as the\n * `register/ok.relays` snapshot it refreshes.\n */\nexport const RelayRosterUpdate = z.object({\n relays: z.array(RelayRosterEntry)\n});\n/**\n * Console-set retention window for FINISHED sessions on the daemon's LOCAL\n * store (the daemon settings' \"Expire sessions\" option). CP-durable; the\n * register/ok snapshot is the reconnect baseline and a `config/push` with\n * `sessions.retention` is the hot update.\n *\n * `'never'` disables the sweep; otherwise an integer number of days as\n * `'<n>d'` (e.g. `'7d'`) — n ≥ 1, capped at 4 digits so a typo can't encode\n * a multi-millennium window.\n */\nexport const SESSION_RETENTION_RE = /^(?:never|[1-9]\\d{0,3}d)$/;\nexport const SessionRetentionSetting = z.custom((v) => typeof v === 'string' && SESSION_RETENTION_RE.test(v), { message: \"expected 'never' or '<days>d' (e.g. '7d')\" });\nexport const RegisterOk = z.object({\n routingEpoch: z.number().int(), // version of the routing table this snapshot reflects\n // CP protocol capabilities. Default keeps a new daemon compatible with an\n // older CP during rolling deploys; old daemons ignore this additive field.\n serverFeatures: z.array(z.string()).default([]),\n // Public attribution for github-app workspace commits. Derived from this\n // deployment's App slug; optional so new daemons still accept an older CP.\n gitCommitIdentity: GitCommitIdentity.optional(),\n // Console-set finished-session retention for this daemon's local store —\n // optional so new daemons still accept an older CP (absent ⇒ keep local config).\n sessionRetention: SessionRetentionSetting.optional(),\n // Authoritative reconcile snapshot — daemon converges its local cache to this:\n assignments: z.array(RouteAssign), // the route/assign set the daemon SHOULD own\n agents: z.array(AgentSpec.extend({ agentId: z.string().uuid() })).default([]), // spec set CP wants present; daemon converges\n crons: z.array(CronUpsert), // the cron set it SHOULD run\n // Platform integrations this daemon SHOULD hold — FILTERED to this daemon (never\n // org-wide), since each element carries plaintext tokens. Never log this array.\n integrations: z.array(IntegrationSpec).default([]),\n // MCP server defs this daemon SHOULD hold — FILTERED to this daemon (only providers\n // its agents enable). In the MCP-proxy model these carry a relay proxy URL + a bearer\n // grant key (not the upstream secret), but treat as sensitive — never log this array.\n // Defaulted so a pre-MCP-registry CP's snapshot still parses.\n mcpServers: z.array(McpServerSpec).default([]),\n // External-memory defs this daemon's agents reference. Relay grants and local\n // secret leases are daemon-private and must never be logged.\n memoryConnections: z.array(MemoryConnectionSpec).default([]),\n leases: z.array(SecretsGrant), // secret leases it SHOULD hold\n // Relay roster — the relays this daemon SHOULD dial (webchat ingress now;\n // shared-bot/webhook with milestone B). Hot updates ride `relay/roster`;\n // defaulted so a pre-relay CP's snapshot still parses.\n relays: z.array(RelayRosterEntry).default([]),\n // Bot-agnostic collaboration routing snapshot (agent-collaboration §2.3 / §6.5) —\n // the reconnect BASELINE for this daemon's terminal-verify of REMOTE agent callers.\n // Scoped to channels this daemon's agents participate in. Hot changes ride the\n // `collaboration/routes` EVT. Defaulted so a pre-collab CP's snapshot still parses.\n collabRoutes: CollabRoutesSnapshot.default({ generation: 0, channels: [], agents: [], platformKinds: [] }),\n drop: z.object({\n // things in localState the CP says to release\n assignments: z.array(z.string()),\n crons: z.array(z.string()),\n // A missed live move archives the replica (preserving workspace/memory); a\n // missed delete removes a replica that carries the explicit CP marker.\n agents: z.array(z.object({ agentId: z.string(), action: z.enum(['detach', 'remove']) })).default([]),\n integrations: z.array(z.string()).default([])\n })\n});\n//# sourceMappingURL=register.js.map"],"mappings":";;;;;;;;;;AAqCA,SAAgB,4BAA4B,kBAAkB;CAC1D,OAAO,oBAAA;AACX;;AAEA,MAAa,iBAAiB;;AAE9B,MAAa,aAAa;;AAE1B,MAAa,4BAA4B;;;AAGzC,MAAa,iCAAiC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QAAQ,CAAC,CAAC;CAChD,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"register-_1hUPUNI.js","names":["z.string","z.object","z.discriminatedUnion","z.literal","z.array","z.boolean","z.number","z.unknown","z.union","z.object","z.string","z.boolean","z.enum","z.number","z.object","z.string","z.number","z.enum","z.enum","z\n .object","z.string","z.object","z.number","z.record","z.unknown","z\n .object","z.literal","z\n .string","z\n .array","z\n .object","z.boolean","z.array","z\n .array","z\n .object","z.enum","z.number","z\n .number","z.object","z.boolean","z.string","z.literal","z.union","z\n .string","z.array","z.record","z.unknown","z.discriminatedUnion","z.discriminatedUnion","z.object","z.literal","z.string","z.boolean","z.enum","z.array","z.unknown","z.discriminatedUnion","z.object","z.literal","z.enum","z.string","z\n .string","z\n .string","z\n .array","z\n .array","z.array","z\n .object","z.number","z.boolean","z.record","z.array","z.object","z.string","z\n .object","z.number","z.enum","z.object","z.string","z.boolean","z.enum","z.array","z.number","z.object","z.string","z.enum","z.array","z.literal","z.boolean","z.number","z.object","z.string","z.boolean","z.array","z.number","z.enum","z.custom"],"sources":["../../protocol/dist/consts.js","../../protocol/dist/frames/route.js","../../protocol/dist/frames/cron.js","../../protocol/dist/frames/secrets.js","../../protocol/dist/memory-plugin.js","../../protocol/dist/frames/memory-connection.js","../../protocol/dist/frames/integration.js","../../protocol/dist/frames/agent.js","../../protocol/dist/frames/mcpserver.js","../../protocol/dist/frames/collab.js","../../protocol/dist/frames/gitcred.js","../../protocol/dist/frames/register.js"],"sourcesContent":["/**\n * Cross-package wire + lifecycle constants shared by the daemon and the CLI.\n *\n * These are pure data (no zod, no runtime deps) so both `@agentconnect.md/cli`\n * and `@agentconnect.md/daemon` can import them without pulling in each other:\n * the daemon dials the CP with the subprotocol/path, and the CLI's login probe\n * dials the same way; both the daemon (planned-exit code) and the CLI (run\n * respawn shell + generated service units) must agree on the restart exit code.\n */\n/**\n * Cap on agent→agent hop depth (agent-collaboration §2.4/§4.5), shared by every\n * component that can admit an agent-to-agent edge.\n *\n * It lives here because send-message-routing-rework.md §4.1 requires ONE budget across\n * transports: \"the same `MAX_AGENT_CALL_HOPS`, whether it is a same-daemon internal\n * call, a relayed internal call, a direct-daemon platform mention, or a relayed platform\n * mention\". Three independent copies (daemon, relay agent-msg router, relay ingress)\n * could drift, and a relay that allowed one more hop than the daemon would let a relayed\n * chain outlive the budget an internal chain gets — a loop-safety hole that no single\n * package's tests would catch.\n *\n * The value is a runaway-loop backstop, not a conversation-length policy: a healthy\n * exchange terminates because the agents are done, and every extra hop only costs one\n * more turn. It was raised from 8 to 20 because 8 cut ordinary human-started relay games\n * short (a thread rooted in one human message affords exactly this many agent→agent\n * edges), while 20 is still far below anything a real collaboration needs and keeps a\n * genuine A↔B ping-pong bounded within seconds.\n */\nexport const MAX_AGENT_CALL_HOPS = 20;\n/**\n * Whether an agent-to-agent delivery has reached the exclusive hop boundary.\n *\n * A delivery at the boundary is not admitted: when the cap is 20, hop 19 is the\n * last agent turn that may run and its reply closes the autonomous exchange.\n * Keeping the comparison beside the shared constant prevents daemon and relay\n * admission paths from drifting on the boundary semantics.\n */\nexport function hasReachedAgentCallHopLimit(deliveryHopCount) {\n return deliveryHopCount >= MAX_AGENT_CALL_HOPS;\n}\n/** The daemon↔CP WebSocket subprotocol negotiated on `ClientTransport.dial`. */\nexport const CP_SUBPROTOCOL = 'agentconnect.v1';\n/** The CP mount path the daemon↔CP WebSocket connects to. */\nexport const CP_WS_PATH = '/daemon/ws';\n/** CP accepts metadata-only transcript activity invalidations from current daemons. */\nexport const SESSION_LIVE_TAIL_FEATURE = 'session-live-tail-v1';\n/** Daemon resolves workspace list/read/git-status requests against the isolated\n * worktree named by `sessionId` instead of silently falling back to primary. */\nexport const WORKSPACE_SESSION_READ_FEATURE = 'workspace-session-read-v1';\n/** Daemon serves the console's git review reads — `workspace/gitdiff`,\n * `workspace/gitlog`, and per-file `additions`/`deletions` on `workspace/gitstatus`.\n * The CP must check this before sending either new frame: an older daemon ignores\n * an unknown frame silently, so the REQ would burn its whole retransmit budget and\n * then surface as an offline daemon. */\nexport const WORKSPACE_GIT_REVIEW_FEATURE = 'workspace-git-review-v1';\n/** Daemon serves the console's git WRITES — `workspace/gitstage`, `workspace/gitunstage`,\n * `workspace/gitcommit` and `workspace/gitpush`. Checked before sending, for the same reason\n * as the review feature: an older daemon ignores an unknown frame silently, so the REQ would\n * burn its retransmit budget and then read as an offline daemon. The console renders the write\n * controls as ABSENT (not inert) on a daemon without it. */\nexport const WORKSPACE_GIT_WRITE_FEATURE = 'workspace-git-write-v1';\n/** Daemon serves `workspace/gitmessage` — the AI commit-message draft, run on the AGENT's own\n * runtime. Separate from the write feature on purpose: it is not a write, and the console hides one\n * button (the wand) on a daemon without it while keeping stage/commit/push. Checked before sending,\n * like every other new frame: an older daemon ignores it silently and the REQ would burn its\n * retransmit budget before reading as an offline daemon. */\nexport const WORKSPACE_GIT_MESSAGE_FEATURE = 'workspace-git-message-v1';\n/** Daemon serves `task/list` — the console Tasks panel's read of one ACP session's background-task\n * lease. Checked before sending, like every other new frame: an older daemon ignores it silently, so\n * the REQ would burn its whole retransmit budget and then read as an offline daemon. The console\n * hides the Tasks tab on a daemon without it rather than showing a tab that can never answer. */\nexport const TASK_LIST_FEATURE = 'task-list-v1';\n/** Daemon serves `agent/wake` — the console's \"start this agent's sandbox\" for a Files/Memory read.\n * Advertised only by a daemon that runs agents in cluster sandboxes: on any other daemon there is\n * nothing to wake, and the CP answers `unsupported` without sending a frame it would ignore. */\nexport const AGENT_WAKE_FEATURE = 'agent-wake-v1';\n/** How long the CP must let ONE `workspace/gitmessage` REQ run before giving up, and it must send it\n * single-shot (`{ ackTimeoutMs: WORKSPACE_GIT_MESSAGE_BUDGET_MS, maxTries: 1 }`). The default 5s ack\n * timeout would retransmit an in-flight model pass four times: identical frame ids, so the daemon\n * joins them into one pass, but the CP would still fail the request while the answer was coming.\n * The daemon's own budget is strictly smaller, so the REP always wins this race. */\nexport const WORKSPACE_GIT_MESSAGE_BUDGET_MS = 75_000;\n/**\n * CP accepts the `event/session-purged` retention-GC receipt (#485) and marks the\n * session's stored metadata content-purged. Advertised by the CP in\n * `register/ok.serverFeatures`; a daemon that does not see it KEEPS its durable\n * receipts instead of emitting a frame an older CP would reject as\n * `UNKNOWN_FRAME` — the report is re-tried once the CP is upgraded.\n */\nexport const SESSION_PURGE_FEATURE = 'session-purge-v1';\n/**\n * CP accepts the correlated `event/session-sync` metadata snapshot. Daemons\n * keep one latest-wins snapshot per session until the CP acknowledges the\n * persistence commit; older CPs continue receiving best-effort `event/session`\n * events while the durable snapshot remains queued for a later upgrade.\n */\nexport const SESSION_METADATA_ACK_FEATURE = 'session-metadata-ack-v1';\n/**\n * Daemon understands the `session/visibility` gate pushes + register-time\n * snapshot replay (session-visibility.md §5.1). Advertised by the daemon in\n * `RegisterReq.capabilities.features`; the CP gates all visibility pushes on\n * it so older daemons never see the frames.\n */\nexport const SESSION_VISIBILITY_FEATURE = 'session-visibility-v1';\n/** Daemon/runtime support private, session-scoped remote MCP headers and stable invocation ids. */\nexport const WEBCHAT_REMOTE_MCP_FEATURE = 'webchat_remote_mcp_v1';\n/**\n * Daemon understands multi-agent webchat conversations: `mentions`/`post` on\n * webchat turns, the transcript-only `context` op, agent-attributed\n * ack/output/done, and `rd/webchat-post` reply fan-out\n * (webchat-multi-agents.md). The CP refuses to CREATE a conversation with more\n * than one agent unless every selected agent's daemon advertises this.\n */\nexport const WEBCHAT_MULTI_AGENT_FEATURE = 'webchat_multi_agent_v1';\n/**\n * Cross-surface session continuation (webchat-cross-integration-continuation.md):\n * the daemon accepts `RdMsgWebchat.targetSessionId` and dispatches the browser\n * turn onto the target session's own local coordinates; a relay advertises the\n * same feature in `rc/register.features` when it preserves the field end to end.\n * The CP refuses to mint a session-targeted webchat token unless the owning\n * daemon AND every live relay advertise it (fail-closed rollout).\n */\nexport const WEBCHAT_SESSION_CONTINUATION_FEATURE = 'webchat_session_continuation_v1';\n/** Daemon and Control Plane support Organization Knowledge, Dream suggestions,\n * and immutable managed-skill bundle retrieval. */\nexport const ORGANIZATION_KNOWLEDGE_FEATURE = 'organization-knowledge-v1';\n/** Daemon currently admits staged Dream suggestion content reads and owner\n * review decisions. Omitted while the staged-content security hold is active. */\nexport const ORGANIZATION_SUGGESTION_REVIEW_FEATURE = 'organization-suggestion-review-v1';\n/** Daemon understands externally-bound Slack session audiences, including the\n * `external` visibility value and the stricter shared-memory exclusion bit. */\nexport const SLACK_SESSION_AUDIENCE_FEATURE = 'slack-session-audience-v1';\n/**\n * Daemon persists `AgentSpec.configRevision` and enforces the monotonic\n * comparison before applying a CP-owned snapshot\n * (organization-secrets-and-variables.md §7). Organization environment entries\n * rely on full-map replacement semantics, so a bound agent may only be placed on\n * a daemon that advertises this: without the fence, an older full snapshot that\n * completes late could reinstate a rotated or deleted value.\n */\nexport const AGENT_CONFIG_REVISION_FEATURE = 'agent-config-revision-v1';\n/** Auth-only recovery capability that permits CP to queue an offline daemon upgrade. */\nexport const DAEMON_BOOTSTRAP_UPGRADE_FEATURE = 'daemon-bootstrap-upgrade-v1';\n/** Frozen version of the auth-only bootstrap handshake. */\nexport const DAEMON_BOOTSTRAP_PROTOCOL_VERSION = 1;\n/**\n * Per-value ceiling for an environment variable or secret, shared by the agent\n * and organization surfaces so one entry can never be sized past what any\n * resolved `AgentSpec` could carry.\n *\n * 64 KiB is a quarter of `MAX_FRAME_BYTES`: generous for the real payloads\n * (a PEM block, a kubeconfig, a service-account JSON) while leaving room for the\n * rest of the spec. It is a per-VALUE guard only — the authoritative check is the\n * transaction-time admission budget over the whole resolved environment, which\n * the Control Plane applies per affected agent before persisting.\n */\nexport const MAX_ENVIRONMENT_VALUE_LENGTH = 64 * 1024;\n/**\n * Exit code a daemon uses for a PLANNED lifecycle exit (drain-then-exit on a\n * `daemon/restart` or `daemon/upgrade`, cli-daemon-split.md §6). It must be\n * non-zero: launchd's `KeepAlive.SuccessfulExit=false` only relaunches on a\n * non-zero exit, so exit 0 would leave the daemon down on macOS. Both\n * supervisors relaunch on it (systemd `Restart=always` covers any code). 75 is\n * EX_TEMPFAIL from sysexits(3) — \"temporary failure, retry\" — which reads\n * correctly for \"the daemon asked to be brought back up\".\n *\n * The CLI's `run` respawn shell (§6.1) also keys off this exact code to decide\n * whether to relaunch vs propagate the child's exit.\n */\nexport const RESERVED_RESTART_CODE = 75;\n/**\n * `AGENTCONNECT_SUPERVISOR` value a pool member runs under: Kubernetes, where the\n * kubelet takes the place of launchd/systemd AND of the CLI's version store.\n *\n * It supervises restart — `restartPolicy: Always` brings the container back after\n * {@link RESERVED_RESTART_CODE}, in place and in the same pod, which is the same\n * shape as a systemd process restart — but not upgrade: the running version is the\n * image, so only whoever owns the Deployment can change it.\n */\nexport const K8S_SUPERVISOR = 'k8s';\n/**\n * Audience the projected ServiceAccount token an in-cluster daemon authenticates with is\n * restricted to. The shim handshake run one hop up: a sandbox proves itself to the daemon\n * with a token scoped to `SHIM_TOKEN_AUDIENCE`, and here the daemon proves itself to the\n * control plane the same way. The audiences differ, so neither token is accepted at the\n * other end.\n *\n * This and {@link CLOUD_DAEMON_SA_NAME} are the two names the deployment that stamps them and\n * the control plane that checks them must agree on exactly. They live here rather than\n * being configured on each side because a constant kept in two places eventually holds two\n * values: a rename passes every build and every test, since each side stays self-consistent,\n * and fails only at runtime when a real daemon's token is rejected. One definition makes that\n * a compile error instead.\n */\nexport const CP_TOKEN_AUDIENCE = 'ac-control-plane';\n/**\n * ServiceAccount a pool member runs as, and the control plane's second check on a reviewed\n * token, so a later change cannot authenticate some other pod in the same namespace. A pool\n * member serves EVERY org, so it lives in the install's control namespace rather than in an\n * org namespace and no namespace⇒org mapping can name its org — the org is a per-connection\n * selector it declares in `auth`, which is safe precisely because this ServiceAccount is an\n * install-level principal. Shared for the same reason as {@link CP_TOKEN_AUDIENCE}.\n */\nexport const CLOUD_DAEMON_SA_NAME = 'ac-cloud-daemon';\n/**\n * ServiceAccount the usage-report collector runs as — the principal allowed to post\n * `gateway`-source session usage to the control plane's batch ingress. A separate name\n * from {@link CLOUD_DAEMON_SA_NAME} on purpose: both tokens carry\n * {@link CP_TOKEN_AUDIENCE}, so the ServiceAccount is what keeps a daemon's token from\n * writing usage and a collector's token from claiming a daemon identity. Like its two\n * siblings, it lives here so the side that stamps it and the side that checks it cannot\n * drift to two values.\n */\nexport const USAGE_COLLECTOR_SA_NAME = 'ac-usage-collector';\n/**\n * ServiceAccount the org-usage READER runs as — the principal allowed to read an org's\n * usage aggregate without a human's session visibility, so a settlement job can total a\n * closed period. A third name beside {@link USAGE_COLLECTOR_SA_NAME} because the two\n * capabilities are not the same risk: the collector's token can create spend records,\n * this one can only disclose them, and no workload should hold both by accident. They\n * are separate pods, so they are separate ServiceAccounts; if they ever merge, that is a\n * deliberate deployment decision and not something a shared constant did quietly.\n */\nexport const USAGE_READER_SA_NAME = 'ac-usage-reader';\n/** Where the deployment projects that token into the daemon pod, and where the daemon reads it\n * from. Not part of the verification, but the same two-sided agreement: the mounter and the\n * reader are both in this repo, so one definition beats a comment asking them to match. */\nexport const CP_IDENTITY_TOKEN_PATH = '/var/run/ac-cp-identity/token';\n/** Env var carrying the control plane's own WebSocket URL into an in-cluster daemon. The pod\n * has no config file to read it from, and a URL is not a secret. Same two-sided agreement as\n * the token path: the deployment sets it, the daemon reads it. */\nexport const CP_URL_ENV = 'AC_CP_URL';\n/** A pool member's rollout generation (its pod-template hash), reported on register (frames/register.ts). */\nexport const POD_TEMPLATE_HASH_ENV = 'AC_POD_TEMPLATE_HASH';\n/** CP answers the `agent/exists` batch existence query the pool's orphan reconciler\n * asks before collecting a leaked sandbox object; a daemon that does not see it\n * skips the sweep rather than emit a frame an older CP rejects as `UNKNOWN_FRAME`. */\nexport const AGENT_EXISTS_FEATURE = 'agent-exists-v1';\n//# sourceMappingURL=consts.js.map","import { z } from 'zod';\n/**\n * Routing & orchestration (C→D control) — protocol §5.\n *\n * `SessionKey` is the canonical session primitive shared across route/*,\n * agent/*, and event/session. Its canonical string form is\n * `${platform}:${channel}:${thread ?? \"-\"}`.\n */\n// `webchat`, `hook`, and `dream` are session-identity platforms only (the\n// Playground conversation / a webhook trigger / a background memory-consolidation\n// run) — no integration, no bind rules, no routing-table participation, never a\n// persisted DB Platform.\n//\n// S1a tolerant readers (integration-plugin-architecture.md §6.2): every peer\n// READS platform fields as an open string, because zod rejects unknown enum\n// values wholesale and an unknown id inside a known frame is frame-fatal —\n// a new id reaching an old peer's `register` reader is a fatal handshake\n// reconnect loop. WRITERS keep emitting only `KNOWN_PLATFORMS` values until\n// the fleet gate passes (every deployed peer reads tolerantly); only then may\n// a new platform id be emitted (S1b).\n//\n// Per-frame policy for an unknown (non-legacy) id, decided per frame where the\n// value is consumed, never by closing this schema:\n// - `register.capabilities.platforms` — accept the frame; an unknown id\n// simply never matches a placement/capability gate (ignore-unknown).\n// - `event/session` — store the value verbatim (session rows are text).\n// - `rd/msg` — decode succeeds; the daemon may refuse the ITEM on semantic\n// grounds (fail-closed coordinate checks), but never the socket.\nexport const KNOWN_PLATFORMS = ['slack', 'telegram', 'webchat', 'discord', 'feishu', 'hook', 'dream'];\nexport function isKnownPlatform(p) {\n return KNOWN_PLATFORMS.includes(p);\n}\n// The origin-kind classification seed (integration-plugin-architecture.md §6.1): the\n// session-identity platforms are channel-free — no integration row, no persisted\n// conversation, no placement snapshot entry. Everything OUTSIDE this list is\n// chat-shaped and must be treated fail-closed where a placement matters\n// (`coordsDecision` refuses an unrecorded coordinate on any chat-shaped id,\n// including ids this build does not know). S1b replaces this constant with\n// wire-carried per-id classification riding collab snapshots / rc/bot-assign.\nexport const SESSION_IDENTITY_PLATFORMS = ['webchat', 'hook', 'dream'];\nexport function isSessionIdentityPlatform(p) {\n return SESSION_IDENTITY_PLATFORMS.includes(p);\n}\n// D3: the origin-KIND axis. `chat` = an external chat platform (an open, growing\n// set); the session-identity kinds are core surfaces and each is its own kind. A\n// new KIND is a core change, never a platform module — but wire fields carrying a\n// kind still read as open strings (the S1a rule), so adding one is not\n// frame-fatal to older peers.\nexport const ORIGIN_KINDS = ['chat', 'hook', 'dream', 'webchat'];\n/** Classification seed for the platform ids THIS build knows. Wire-carried\n * entries (`CollabRoutesSnapshot.platformKinds`, `rc/bot-assign.originKind`)\n * extend it for ids a newer peer introduces (§6.1). `undefined` = an id neither\n * the seed nor the wire classified — consumers treat it as `'chat'`, the\n * fail-closed default wherever placements matter. */\nexport function originKindOf(p) {\n if (isSessionIdentityPlatform(p))\n return p;\n return isKnownPlatform(p) ? 'chat' : undefined;\n}\nexport const Platform = z.string().min(1);\nexport const SessionKey = z.object({\n platform: Platform,\n channel: z.string(),\n thread: z.string().optional() // absent = channel-root\n});\n/** Trigger-matching rule for a binding (protocol §5.1). */\nexport const BindRule = z.object({\n match: z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('mention') }),\n z.object({ kind: z.literal('dm') }),\n z.object({ kind: z.literal('keyword'), value: z.string() }),\n z.object({ kind: z.literal('auto') }) // alert-channel auto-handle\n ])\n});\nexport const RouteAssign = z.object({\n // also appears in RegisterOk.assignments[]\n sessionKey: SessionKey,\n agentId: z.string().uuid(),\n workspaceId: z.string().uuid(), // which D9 workspace to prepare\n bindRules: z.array(BindRule).default([])\n});\nexport const RouteAssignAck = z.object({\n ok: z.boolean(),\n sessionKey: SessionKey,\n reason: z.string().optional()\n});\nexport const RouteUpdate = z.object({\n routingEpoch: z.number().int(),\n rules: z.array(z.object({ match: z.unknown(), agentId: z.string().uuid() }))\n});\n/** Graceful scale-down / rebalance — protocol §5.3. */\nexport const Drain = z.object({\n scope: z.union([\n z.object({ kind: z.literal('agent'), agentId: z.string().uuid() }),\n z.object({ kind: z.literal('daemon') }), // whole-daemon drain (shutdown/upgrade)\n z.object({ kind: z.literal('session'), sessionKey: SessionKey })\n ]),\n deadline: z.string().datetime() // hard cutoff; in-flight turns past this are cancelled\n});\nexport const DrainProgress = z.object({\n remaining: z.number().int(),\n drained: z.array(SessionKey)\n});\nexport const DrainDone = z.object({\n released: z.array(SessionKey) // CP may now reassign — fenced by new epoch\n});\n//# sourceMappingURL=route.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Cron sinks to the daemon (D5) — protocol §5.4.\n *\n * A cron periodically triggers ONE AGENT with a synthetic prompt (`trigger`) to\n * carry out some work. The CP owns the definition; the daemon owns firing +\n * last-run persistence, so crons fire even when the CP is down. On receipt the\n * daemon persists the def into the owning agent's `agent.json` `crons[]` (the\n * single source of truth, same model as integrations) — surviving a restart\n * with the CP down.\n *\n * `target` is OPTIONAL output routing: when present, the daemon posts the\n * trigger as a real message in that channel and the agent's session replies in\n * its thread; when absent the fire is headless (the agent works with no\n * platform output).\n */\nexport const CronTarget = z.object({\n // S1a open reader (route.ts Platform policy). The `'slack'` default is the\n // legacy envelope default §6.8 removes (anchor platform will derive from\n // `integrationId`); it is NOT a fold — a present unknown id passes through.\n platform: Platform.default('slack'),\n channel: z.string(),\n // The agent integration whose connection posts the anchor — targets come from\n // the owning agent's integrations, so the daemon posts through the right bot\n // when the agent has several. Absent (legacy defs) ⇒ first integration.\n integrationId: z.string().uuid().optional()\n});\nexport const CronUpsert = z.object({\n orgId: z.string().min(1).max(64).optional(),\n cronId: z.string().uuid(),\n agentId: z.string().uuid(), // the agent this cron drives — routes the def to its daemon\n schedule: z.string(), // croner expression interpreted in `timezone`\n timezone: z.string().min(1), // resolved IANA timezone; daemon converts ticks to UTC instants\n target: CronTarget.optional(), // absent ⇒ headless fire\n trigger: z.string(), // synthetic prompt text injected on fire\n enabled: z.boolean().default(true)\n});\nexport const CronRemove = z.object({\n cronId: z.string().uuid()\n});\n/**\n * `cron/report` (D→C EVT, fire-and-forget) — one CP-owned cron fired. The\n * daemon stamps the fire into its local store first (it stays authoritative,\n * §5.4) and reports it here so the console's `lastRunAt` converges; the CP\n * upsert is latest-wins, so the daemon re-asserting its stored stamps on\n * reconnect (fires while the CP was unreachable) is idempotent and can never\n * regress the value. Hand-authored (no-origin) crons are never reported.\n *\n * Reports are keyed by `(cronId, firedAt)`: the FIRE report (no `status`)\n * opens the run, an optional SESSION report attaches the ACP session as soon\n * as it is initialized, and the COMPLETION report (with `status` + outcome\n * fields) closes the run once the dispatched turn ends. A completion without\n * a prior fire report (CP was down at fire time) still creates the run row.\n */\nexport const CronRunStatus = z.enum(['success', 'failed']);\nexport const CronReport = z.object({\n cronId: z.string().uuid(),\n agentId: z.string().uuid(), // the owning agent — scopes the report to its daemon\n firedAt: z.string().datetime(),\n // Terminal outcome fields (absent on fire/session progress reports).\n status: CronRunStatus.optional(),\n durationMs: z.number().int().nonnegative().optional(), // fire → turn end\n // Sent once the ACP session exists, then repeated on completion.\n sessionId: z.string().optional(), // ACP session the run prompted (console deep-link)\n reason: z.string().optional() // short failure text (status \"failed\")\n});\n/**\n * `cron/run` (C→D REQ → ack) — fire one CP-owned cron NOW (console \"Run now\").\n * The daemon accepts (`ok:true`) and runs the fire asynchronously — outcome\n * arrives as normal `cron/report`s; `ok:false` when it holds no such cron.\n */\nexport const CronRunNow = z.object({\n cronId: z.string().uuid()\n});\n//# sourceMappingURL=cron.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Secrets (C5 ↔ D10) — protocol §6.\n *\n * Lease-based, no plaintext on the wire or in PG. Every frame carries a\n * REFERENCE to a Vault/KMS path, never the secret material itself.\n */\nexport const SecretsRequest = z.object({\n // D→C, REQ — daemon asks for a lease at session start\n scope: z.object({\n platform: Platform,\n workspaceId: z.string().uuid()\n })\n});\nexport const SecretsGrant = z.object({\n // C→D, REP (also in RegisterOk.leases[])\n leaseId: z.string().uuid(),\n scope: z.object({\n platform: z.string(),\n workspaceId: z.string().uuid()\n }),\n ref: z.string(), // Vault/KMS path or handle — NOT the secret\n ttl: z.number().int(), // seconds\n renewBeforeSec: z.number().int() // daemon should renew this many sec before expiry\n});\nexport const SecretsRenew = z.object({\n leaseId: z.string().uuid() // D→C REQ → new SecretsGrant\n});\nexport const SecretsRevoke = z.object({\n leaseId: z.string().uuid(),\n reason: z.string() // C→D EVT (hot revoke)\n});\n/** 🅼 Direct-to-store upload/download grant — protocol §3.2 / frame #25. */\nexport const ScopeAttestation = z.object({\n machineId: z.string().uuid(),\n scope: z.enum(['attachment.put', 'attachment.get', 'facts.put']),\n resourceRef: z.string(), // opaque object key/prefix\n jws: z.string(), // signed capability the store verifies offline\n exp: z.string().datetime()\n});\n//# sourceMappingURL=secrets.js.map","import { z } from 'zod';\n/**\n * Canonical, backend-neutral contract for an AgentConnect external-memory plugin.\n *\n * This is deliberately NOT a daemon↔CP frame group. Both the daemon's private MCP\n * client and first/third-party plugin implementations import these schemas so the\n * `agentconnect.memory/v1` profile has one executable source of truth. The model\n * never sees the plugin's raw MCP tools; AgentConnect core translates them into a\n * stable product surface.\n */\nexport const MEMORY_PLUGIN_PROFILE = 'agentconnect.memory/v1';\nexport const MEMORY_PLUGIN_PROFILE_MAJOR = 1;\nexport const MEMORY_PLUGIN_TOOL = {\n manifest: 'agentconnect_memory_manifest',\n recall: 'agentconnect_memory_recall',\n capture: 'agentconnect_memory_capture',\n health: 'agentconnect_memory_health',\n operationStatus: 'agentconnect_memory_operation_status',\n list: 'agentconnect_memory_list',\n get: 'agentconnect_memory_get',\n create: 'agentconnect_memory_create',\n update: 'agentconnect_memory_update',\n delete: 'agentconnect_memory_delete',\n history: 'agentconnect_memory_history'\n};\nexport const MEMORY_RECALL_DEFAULTS = {\n topK: 5,\n maxBytes: 8 * 1024,\n // The budget covers the complete daemon -> relay -> plugin -> embedder\n // round trip. A healthy remote Mem0 search can spend ~1s at the relay alone,\n // so 1s races successful responses instead of representing a useful SLA.\n timeoutMs: 3_000\n};\n// Recall runs before every activation and fails open, so the default budget\n// stays bounded while leaving transport headroom around the common warm path.\n// The ceiling is deliberately generous:\n// a local/self-hosted provider (e.g. Mem0 OSS) can need several seconds on a\n// cold first search — embedding-model load plus vector search — and an operator\n// must be able to configure a budget that a healthy cold start fits inside\n// rather than being forced to degrade it. This is the single source of truth\n// for the recall-timeout ceiling shared by the connection policy schema and,\n// by contract, the control-plane validation and console input.\nexport const MEMORY_RECALL_HARD_LIMITS = {\n topK: 20,\n maxBytes: 32 * 1024,\n timeoutMs: 10_000\n};\nexport const MemoryScopeKind = z.enum(['agent', 'user', 'session', 'shared']);\n/** The plugin-facing scope. `key` is always derived by daemon core, never tool input. */\nexport const CanonicalMemoryScope = z\n .object({\n kind: MemoryScopeKind,\n key: z.string().min(1).max(512)\n})\n .strict();\nexport const MemoryRecordProvenance = z\n .object({\n pluginId: z.string().min(1).max(255),\n backendId: z.string().min(1).max(512).optional()\n})\n .strict();\n/** The one record shape AgentConnect core understands, regardless of backend. */\nexport const CanonicalMemoryRecord = z.object({\n id: z.string().min(1).max(512),\n text: z.string().min(1),\n score: z.number().finite().optional(),\n scope: CanonicalMemoryScope,\n metadata: z.record(z.string(), z.unknown()).optional(),\n createdAt: z.string().datetime().optional(),\n updatedAt: z.string().datetime().optional(),\n provenance: MemoryRecordProvenance.optional(),\n /** Backend version/ETag for optimistic concurrency on update. */\n version: z.string().min(1).max(512).optional()\n});\nexport const CaptureReceipt = z.object({\n state: z.enum(['completed', 'accepted', 'failed', 'ambiguous']),\n backendOperationId: z.string().min(1).max(512).optional()\n});\n/** Every operation carries a core-created request, connection, and trusted scope. */\nexport const MemoryPluginCallContext = z\n .object({\n requestId: z.string().min(1).max(512),\n connection: z\n .object({\n id: z.string().min(1).max(512),\n config: z.record(z.string(), z.unknown())\n })\n .strict(),\n scope: CanonicalMemoryScope\n})\n .strict();\nexport const MemoryPluginOperation = z.enum([\n 'recall',\n 'capture',\n 'list',\n 'get',\n 'create',\n 'update',\n 'delete',\n 'history'\n]);\n/** Exact machine-readable text tokens for MCP tool results with `isError:true`.\n * MCP validates structuredContent against the success output schema even on an\n * error result, so profile errors use an exact token and never a free-form\n * plugin/upstream message. */\nexport const MEMORY_PLUGIN_ERROR_TOKEN = {\n conflict: 'agentconnect.memory.error/conflict'\n};\nconst unique = (xs) => new Set(xs).size === xs.length;\n/** The result of the required manifest tool (`structuredContent` directly). */\nexport const MemoryPluginManifest = z.object({\n profile: z.literal(MEMORY_PLUGIN_PROFILE),\n plugin: z.object({\n id: z\n .string()\n .max(255)\n .regex(/^[a-z0-9]+(?:[.-][a-z0-9]+)+$/, 'plugin id must be reverse-DNS-like'),\n version: z\n .string()\n .max(128)\n .regex(/^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/, 'plugin version must be semver')\n }),\n connection: z.object({\n // A deliberately bounded JSON-Schema subset is enforced by daemon core during\n // conformance; this field remains JSON here so the console can render it later.\n configSchema: z.record(z.string(), z.unknown()),\n secretFields: z\n .array(z\n .object({\n name: z.string().min(1).max(128),\n required: z.boolean(),\n transportHeader: z.string().min(1).max(128).optional()\n })\n .strict())\n .max(64)\n .refine((fields) => unique(fields.map((field) => field.name)), 'secret field names must be unique')\n }),\n capabilities: z\n .object({\n scopes: z.array(MemoryScopeKind).min(1).max(4).refine(unique, 'scope capabilities must be unique'),\n operations: z.array(MemoryPluginOperation).min(2).max(8).refine(unique, 'operation capabilities must be unique'),\n asyncCapture: z.boolean(),\n idempotency: z.enum(['operation-id', 'none'])\n })\n .strict(),\n limits: z\n .object({\n maxQueryBytes: z.number().int().positive(),\n maxRecordBytes: z.number().int().positive(),\n maxBatchItems: z.number().int().positive()\n })\n .strict(),\n declaredEgressHosts: z\n .array(z.string().min(1).max(253))\n .max(128)\n .refine(unique, 'egress hosts must be unique')\n .optional()\n});\nexport const MemoryPluginRecallInput = z\n .object({\n context: MemoryPluginCallContext,\n query: z.string().min(1),\n topK: z.number().int().positive().max(MEMORY_RECALL_HARD_LIMITS.topK),\n maxBytes: z.number().int().positive().max(MEMORY_RECALL_HARD_LIMITS.maxBytes)\n})\n .strict();\nexport const MemoryPluginRecallOutput = z.object({ records: z.array(CanonicalMemoryRecord) }).strict();\nexport const MemoryPluginTurnObservation = z\n .object({\n turnId: z.string().min(1).max(512),\n input: z.string(),\n output: z.string(),\n sessionId: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginCaptureInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n turn: MemoryPluginTurnObservation\n})\n .strict();\nexport const MemoryPluginCaptureOutput = CaptureReceipt.strict();\nexport const MemoryPluginHealthInput = z.object({ context: MemoryPluginCallContext }).strict();\nexport const MemoryPluginHealthOutput = z\n .object({\n status: z.enum(['ready', 'degraded', 'invalid']),\n /** Stable, non-secret diagnostic code. Never an upstream response body. */\n reasonCode: z.string().min(1).max(128).optional()\n})\n .strict();\nexport const MemoryPluginOperationStatusInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n backendOperationId: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginOperationStatusOutput = CaptureReceipt.strict();\nconst OptionalCursor = z.string().min(1).max(2048).optional();\nexport const MemoryPluginListInput = z\n .object({\n context: MemoryPluginCallContext,\n cursor: OptionalCursor,\n limit: z.number().int().positive().max(100).default(50)\n})\n .strict();\nexport const MemoryPluginListOutput = z\n .object({ records: z.array(CanonicalMemoryRecord), nextCursor: OptionalCursor })\n .strict();\nexport const MemoryPluginGetInput = z\n .object({ context: MemoryPluginCallContext, id: z.string().min(1).max(512) })\n .strict();\nexport const MemoryPluginGetOutput = z.object({ record: CanonicalMemoryRecord.nullable() }).strict();\nexport const MemoryPluginCreateInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n text: z.string().min(1),\n metadata: z.record(z.string(), z.unknown()).optional()\n})\n .strict();\nexport const MemoryPluginCreateOutput = z.object({ record: CanonicalMemoryRecord }).strict();\nexport const MemoryPluginUpdateInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n id: z.string().min(1).max(512),\n text: z.string().min(1),\n metadata: z.record(z.string(), z.unknown()).optional(),\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginUpdateOutput = z.object({ record: CanonicalMemoryRecord }).strict();\nexport const MemoryPluginDeleteInput = z\n .object({\n context: MemoryPluginCallContext,\n operationId: z.string().min(1).max(512),\n id: z.string().min(1).max(512),\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryPluginDeleteOutput = z.object({ deleted: z.boolean() }).strict();\nexport const MemoryPluginHistoryInput = z\n .object({\n context: MemoryPluginCallContext,\n id: z.string().min(1).max(512),\n cursor: OptionalCursor,\n limit: z.number().int().positive().max(100).default(50)\n})\n .strict();\nexport const MemoryPluginHistoryEvent = z\n .object({\n id: z.string().min(1).max(512),\n event: z.enum(['create', 'update', 'delete']),\n at: z.string().datetime(),\n record: CanonicalMemoryRecord.optional()\n})\n .strict();\nexport const MemoryPluginHistoryOutput = z\n .object({ events: z.array(MemoryPluginHistoryEvent), nextCursor: OptionalCursor })\n .strict();\n//# sourceMappingURL=memory-plugin.js.map","import { z } from 'zod';\nimport { MEMORY_PLUGIN_PROFILE, MEMORY_RECALL_DEFAULTS, MEMORY_RECALL_HARD_LIMITS, MemoryPluginManifest } from '../memory-plugin.js';\n/**\n * External-memory control-plane distribution (M-5A).\n *\n * The Control Plane owns installations and org connections. A daemon receives\n * a transport-specific private definition. Remote definitions carry a relay URL\n * and purpose-specific bearer grant; local definitions carry an operator\n * allowlist reference and daemon-private secret lease. Raw local commands never\n * cross this wire.\n */\nexport const MemoryRecallPolicy = z\n .object({\n mode: z.enum(['auto', 'tool-only']).default('auto'),\n topK: z.number().int().positive().max(MEMORY_RECALL_HARD_LIMITS.topK).default(MEMORY_RECALL_DEFAULTS.topK),\n maxBytes: z\n .number()\n .int()\n .positive()\n .max(MEMORY_RECALL_HARD_LIMITS.maxBytes)\n .default(MEMORY_RECALL_DEFAULTS.maxBytes),\n timeoutMs: z\n .number()\n .int()\n .positive()\n .max(MEMORY_RECALL_HARD_LIMITS.timeoutMs)\n .default(MEMORY_RECALL_DEFAULTS.timeoutMs)\n})\n .strict();\nexport const MemoryCapturePolicy = z.object({ mode: z.enum(['turn', 'manual']).default('manual') }).strict();\n/**\n * Dreaming — periodic offline consolidation of the MANAGED store\n * (design: docs/designs/memory-dreaming.md). Valid only with\n * `provider: 'managed'`; the daemon stages a rebuilt store per dream and the\n * user reviews and adopts it, or an enabled auto-accept policy adopts it.\n * Bounds mirror the design: sessionWindow ≤ 100 mined transcripts,\n * instructions ≤ 4096 chars.\n */\nexport const MemoryDreamingPolicy = z\n .object({\n enabled: z.boolean(),\n /** Optional override pinning a fixed newest-N session window to mine. When\n * absent (the norm), the daemon sizes the window automatically — every\n * session active since the last successful dream, capped at 100 — so this\n * normally needs no configuration. */\n sessionWindow: z.number().int().min(1).max(100).optional(),\n /** Cron expression for scheduled dreams (same syntax as agent crons). A tick\n * that lands while a dream is already in flight is skipped, not queued. */\n schedule: z.string().min(1).max(128).optional(),\n /** IANA zone the `schedule` is evaluated in (as on agent crons). Absent ⇒ the\n * daemon host's local time. */\n timezone: z.string().min(1).max(64).optional(),\n /** Operator steering text applied through the whole dream pipeline. */\n instructions: z.string().max(4096).optional(),\n /** Also mine reusable procedures into candidate skills (never auto-installed —\n * a mined skill is always a proposal that needs explicit approval). Absent\n * defaults to true; false is the opt-out. */\n mineSkills: z.boolean().optional(),\n /** Adopt the staged store automatically on completion without content\n * review. Live-memory fence conflicts remain reviewable. Absent defaults\n * to true for effective managed-memory policies; false is the opt-out. */\n autoAdopt: z.boolean().optional()\n})\n .strict();\n/** Product default for managed memory with no explicit dreaming policy.\n *\n * The schedule is evaluated in the daemon host's timezone because no timezone\n * is set. Keeping this as an explicit policy lets a saved policy distinguish\n * manual-only dreaming (enabled with no schedule) from the default daily run.\n */\nexport const DEFAULT_MEMORY_DREAMING_POLICY = {\n enabled: true,\n schedule: '0 4 * * *',\n // By default a completed dream is adopted without review and reusable procedures\n // are mined into candidate skills. Adoption is text-only and reversible; mined\n // skills are still proposals that need explicit approval before install (they are\n // executable), so mining-on only surfaces candidates.\n autoAdopt: true,\n mineSkills: true\n};\n/** Managed-memory partitioning. `agent` (default) keeps one store per agent;\n * `channel` gives each channel (DM/webchat included, as special channels) its own\n * memory folder so different channels never cross. The agent-level store stays as\n * a shared read-only base under `channel` (see docs/designs/memory-dreaming.md). */\nexport const ManagedMemoryScope = z.enum(['agent', 'channel']);\nconst BuiltInMemoryBinding = z\n .object({\n provider: z.enum(['none', 'native', 'managed']),\n autoDistill: z.boolean().optional(),\n dreaming: MemoryDreamingPolicy.optional(),\n scope: ManagedMemoryScope.optional()\n})\n .strict()\n .superRefine((binding, ctx) => {\n if (binding.dreaming && binding.provider !== 'managed') {\n ctx.addIssue({\n code: 'custom',\n path: ['dreaming'],\n message: 'dreaming is only supported with the managed memory provider'\n });\n }\n if (binding.scope && binding.provider !== 'managed') {\n ctx.addIssue({\n code: 'custom',\n path: ['scope'],\n message: 'memory scope is only supported with the managed memory provider'\n });\n }\n});\nexport const ExternalMemoryBinding = z\n .object({\n provider: z.literal('external'),\n connectionId: z.string().uuid(),\n recall: MemoryRecallPolicy.default({ mode: 'auto', ...MEMORY_RECALL_DEFAULTS }),\n // The safe default never exports a full turn. Console users must explicitly\n // acknowledge the egress disclosure before selecting turn capture.\n capture: MemoryCapturePolicy.default({ mode: 'manual' })\n})\n .strict();\n/** Agent-facing provider selection. External bindings carry policy, never endpoints or secrets. */\nexport const AgentMemoryBinding = z.union([BuiltInMemoryBinding, ExternalMemoryBinding]);\n/** Resolve the managed-memory dreaming policy used by the daemon.\n *\n * No memory binding means the managed provider, and no explicit dreaming policy\n * means the daily product default. Once a policy exists its absent schedule\n * remains meaningful (manual-only), while absent `autoAdopt` and `mineSkills`\n * normalize to the product default (true); an explicit false is the opt-out.\n */\nexport function effectiveMemoryDreamingPolicy(binding) {\n if (binding && binding.provider !== 'managed')\n return undefined;\n // Dreaming (offline consolidation) is not supported under channel scope — a\n // dream mines and rewrites a single store, which does not map onto per-channel\n // folders. Channel-scoped agents have no dreaming policy (the console hides the\n // controls); per-channel dreaming may arrive later.\n if (effectiveManagedMemoryScope(binding) === 'channel')\n return undefined;\n const policy = binding?.dreaming;\n if (!policy)\n return { ...DEFAULT_MEMORY_DREAMING_POLICY };\n return { ...policy, autoAdopt: policy.autoAdopt ?? true, mineSkills: policy.mineSkills ?? true };\n}\n/** The effective managed-memory partitioning scope. Non-managed and unset ⇒\n * `agent` (the historical single-store behavior). */\nexport function effectiveManagedMemoryScope(binding) {\n if (!binding || binding.provider !== 'managed')\n return 'agent';\n return binding.scope ?? 'agent';\n}\n/** Reviewed mapping from a logical secret field to the header the relay injects. */\nexport const MemoryPluginSecretHeaderPin = z\n .object({ name: z.string().min(1).max(128), header: z.string().min(1).max(128), required: z.boolean() })\n .strict();\nexport const MemoryPluginPin = z\n .object({\n pluginId: z.string().min(1).max(255),\n profileMajor: z.literal(1),\n manifestDigest: z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/)\n .optional(),\n secretHeaders: z.array(MemoryPluginSecretHeaderPin).max(64).default([])\n})\n .strict();\nconst MemoryConnectionSpecBase = z\n .object({\n orgId: z.string().min(1).max(64).optional(),\n connectionId: z.string().uuid(),\n revision: z.number().int().positive(),\n config: z.record(z.string(), z.unknown()),\n secretKeys: z.array(z.string().min(1).max(128)).max(64).default([]),\n pin: MemoryPluginPin\n})\n .strict();\nconst RemoteMemoryConnectionSpec = MemoryConnectionSpecBase.extend({\n transport: z.literal('streamable-http'),\n relayUrl: z.string().url(),\n grantKey: z.string().min(1).max(512)\n}).strict();\n/** Plaintext values cross only the authenticated daemon control channel and\n * remain in its private registry until they are injected into the allowlisted\n * plugin child. They never enter AgentSpec, agent.json, or the agent runtime. */\nexport const MemoryConnectionSecretLease = z\n .object({\n values: z.record(z.string().min(1).max(128), z\n .string()\n .min(1)\n .max(16 * 1024)\n .refine((value) => !value.includes('\\0'), 'memory connection secret contains NUL'))\n})\n .strict()\n .superRefine((lease, ctx) => {\n if (new TextEncoder().encode(JSON.stringify(lease.values)).byteLength > 64 * 1024) {\n ctx.addIssue({ code: 'custom', path: ['values'], message: 'memory connection secret lease exceeds 64 KiB' });\n }\n});\nconst StdioMemoryConnectionSpec = MemoryConnectionSpecBase.extend({\n transport: z.literal('stdio'),\n // This is a logical lookup key in the daemon operator's local allowlist, not\n // a path/command supplied by the tenant or Control Plane.\n commandRef: z\n .string()\n .min(1)\n .max(128)\n .regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, 'commandRef must be an allowlist key'),\n secretLease: MemoryConnectionSecretLease\n})\n .strict()\n .superRefine((spec, ctx) => {\n const keys = Object.keys(spec.secretLease.values).sort();\n const declared = [...spec.secretKeys].sort();\n if (keys.length !== declared.length || keys.some((key, index) => key !== declared[index])) {\n ctx.addIssue({ code: 'custom', path: ['secretLease'], message: 'secret lease keys must match secretKeys' });\n }\n});\nconst TransportedMemoryConnectionSpec = z.discriminatedUnion('transport', [\n RemoteMemoryConnectionSpec,\n StdioMemoryConnectionSpec\n]);\n/** One daemon-private connection definition. Both relay grants and local secret\n * leases are secret-bearing; callers must never log this frame or validation\n * payload. Local commands are resolved solely from the operator allowlist. */\nexport const MemoryConnectionSpec = TransportedMemoryConnectionSpec;\n/** C→D live CRUD; reconnect baseline is `register/ok.memoryConnections`. */\nexport const MemoryConnectionUpsert = MemoryConnectionSpec;\nexport const MemoryConnectionRemove = z.object({ connectionId: z.string().uuid() }).strict();\n/** Stable, body-free probe fact for one connection revision. */\nexport const MemoryConnectionFact = z\n .object({\n connectionId: z.string().uuid(),\n revision: z.number().int().positive(),\n pluginId: z.string().min(1).max(255),\n version: z.string().max(128).optional(),\n profile: z.literal(MEMORY_PLUGIN_PROFILE).optional(),\n manifestDigest: z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/)\n .optional(),\n capabilities: MemoryPluginManifest.shape.capabilities.optional(),\n declaredEgressHosts: z.array(z.string().min(1).max(255)).max(128).optional(),\n status: z.enum(['probing', 'ready', 'degraded', 'invalid']),\n reasonCode: z.string().min(1).max(128).optional()\n})\n .strict();\n/** D→C full snapshot. Re-emitted on reconnect and after every probe transition. */\nexport const MemoryConnectionFacts = z.object({ connections: z.array(MemoryConnectionFact).max(1_024) }).strict();\n//# sourceMappingURL=memory-connection.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Platform integration distribution (C→D) — the Slack \"install\" flow.\n *\n * The Control Plane is the source of truth for platform integrations and pushes\n * them to the daemon that owns the integration's agent (`integration/upsert`, and\n * the reconcile snapshot `RegisterOk.integrations[]`). The daemon opens the Socket\n * Mode connection from the delivered config (see slack/connection.ts).\n *\n * SECURITY: `integration/upsert` and `RegisterOk.integrations[]` carry PLAINTEXT\n * platform tokens (botToken/appToken/appSecret). These payloads MUST NEVER be\n * logged — no body dump on decode error, no register/ok snapshot debug dump.\n * CP-owned integrations live only in daemon MEMORY and are re-converged on\n * reconnect; hand-authored agents keep tokens in their own `agent.json` (the\n * same trust boundary as the daemon process).\n *\n * `signingSecret` is intentionally absent: Socket Mode authenticates with the\n * app-level token, so the daemon never needs a signing secret.\n */\n/** Trigger match — mirrors the daemon BindRuleConfig.match (agents/agent-schema.ts). */\nexport const BindMatch = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('mention') }),\n z.object({ kind: z.literal('dm') }),\n z.object({ kind: z.literal('keyword'), value: z.string() }),\n z.object({ kind: z.literal('auto') })\n]);\n/** One channel/thread trigger binding — mirrors the daemon BindRuleConfig. */\nexport const IntegrationBindRule = z.object({\n channel: z.string().optional(), // absent = any channel\n thread: z.string().optional(),\n match: BindMatch\n});\n/**\n * The Slack config payload (no signingSecret). Platform-PRIVATE material only\n * (§6.4): the ingress mode and the routing knobs (`bindRules`/`mutedChannels`/\n * `gated`) live in the CORE ENVELOPE — this block never duplicates them. What\n * the envelope's `mode` means for Slack (shared-bot-relay.md §7.3):\n *\n * - `direct`: the daemon owns the whole bot — it opens the Socket Mode\n * connection itself, so the payload carries `appToken`.\n * - `shared`: the bot's INBOUND lives on a relay (§4.1), so the daemon gets\n * xoxb ONLY — enough to SEND (`chat.postMessage`, attachment fetch). No\n * `appToken` (credential domaining: the daemon must not be able to subscribe\n * the event stream). `botUserId` is optional and lazily resolved by the\n * daemon via `auth.test` (same as direct) if the sender ever needs it.\n *\n * The direct-mode `appToken` requirement is a cross-field rule with the\n * envelope's `mode`, so the daemon enforces it at its wire ingest, where both\n * are in view (`cp/cp-integration-registry.ts` `toIntegration`) — §6.4 puts\n * per-platform payload validation at the consuming edge.\n */\nexport const IntegrationSlackConfig = z.object({\n botToken: z.string(), // xoxb-… (plaintext — never log) — always present (send path)\n appToken: z.string().optional(), // xapp-… (plaintext — never log) — direct only (Socket Mode)\n appId: z.string().optional(), // A… public metadata — permission-update deep link (especially shared mode)\n // Multi-agent opt-in — the bot backs MANY agents, so an in-thread \"Switch agent\"\n // control is meaningful. ONLY ever true in `shared` mode (an http/relay bot); a\n // non-shareable http bot is still `shared` for routing but has one agent, so the\n // switch control is suppressed. Defaults false (every direct bot decodes as\n // non-shareable).\n shareable: z.boolean().default(false),\n botUserId: z.string().optional() // lazily resolved via auth.test; may be seeded by CP\n});\n/**\n * The Telegram config payload — long-polling + routing (grammY). Telegram has a\n * SINGLE BotFather HTTP token — no app-level token and no signing secret\n * (long-polling authenticates every getUpdates call with the bot token).\n */\nexport const IntegrationTelegramConfig = z.object({\n botToken: z.string() // BotFather \"123456:ABC…\" (plaintext — never log)\n});\n/**\n * The Discord config payload — the Gateway connection (discord.js). Discord\n * authenticates the Gateway with a SINGLE bot token — no Slack-style app-level\n * token and no signing secret. `applicationId` is public metadata (the client\n * id for the OAuth2 bot-invite URL); it is not secret material.\n */\nexport const IntegrationDiscordConfig = z.object({\n botToken: z.string(), // Bot <token> (plaintext — never log)\n applicationId: z.string().optional() // client/application id — public, for the invite URL\n});\n/**\n * The Feishu / Lark config payload — the long-connection WebSocket\n * (`@larksuiteoapi/node-sdk` `WSClient`) + REST client. A Feishu self-built app\n * authenticates with an `appId` + `appSecret` PAIR — the SDK exchanges them for a\n * short-lived `tenant_access_token` internally (no Slack-style app-level token, no\n * signing secret). `appId` is a semi-public identifier (`cli_…`); `appSecret` is\n * plaintext secret material — NEVER log it. `botOpenId` is the bot's own open_id\n * for @-mention routing; lazily resolved by the daemon via `bot/info` if absent.\n *\n * The envelope's `mode` decides the transport: `direct` opens the SDK long\n * connection on the daemon; `shared` keeps only the authenticated REST client\n * (callbacks arrive through the relay, pre-addressed over rd/*).\n *\n * `region` selects the open-platform gateway the daemon SDK (and CP verifier)\n * talk to — `'feishu'` = mainland China (`open.feishu.cn`, the SDK default) vs\n * `'lark'` = international (`open.larksuite.com`). Same app model, different host;\n * an app is registered in exactly one region. Defaults to `'feishu'` so existing\n * installs are unaffected.\n */\nexport const FeishuRegion = z.enum(['feishu', 'lark']);\nexport const IntegrationFeishuConfig = z.object({\n appId: z.string(), // cli_… — app identifier (semi-public), needed for REST and direct WS\n appSecret: z.string(), // app secret (plaintext — never log)\n botOpenId: z.string().optional(), // bot's own open_id; lazily resolved via bot/info\n region: FeishuRegion.default('feishu') // open-platform gateway: feishu.cn vs larksuite.com\n});\n/**\n * §6.3 core routing ENVELOPE (integration-plugin-architecture.md D4): the knobs CORE\n * reads — routing, gating, ingress mode — platform-independent. This is the ONLY\n * carrier of these knobs on the wire: the opaque per-platform `config` payload\n * never duplicates them (the daemon reads routing exclusively from here).\n */\nexport const IntegrationCoreEnvelope = z.object({\n mode: z.enum(['direct', 'shared']).default('direct'),\n bindRules: z.array(IntegrationBindRule).default([]),\n mutedChannels: z.array(z.string()).default([]),\n gated: z.boolean().default(false)\n});\n/**\n * One platform integration, owned by exactly one agent. Also the element type of\n * `RegisterOk.integrations[]` (the per-daemon reconcile set) and of\n * `AgentActivate.integrations[]` (the move bundle).\n *\n * §6.4 FINAL SHAPE (S3): one flat object — identity + an OPEN `platform` id +\n * the core envelope + an opaque per-platform `config`. Core never interprets\n * `config`; the consuming platform module validates it against its own schema,\n * resolved through the platform registry on the daemon\n * (`platforms/integration-config.ts`), and the CP's platform provider is the\n * only producer (`projectIntegrationConfig`, §9). The closed four-literal\n * discriminated union this replaces — and the per-variant duplication of the\n * routing knobs inside each config block — was the S1b dual-shape window;\n * pre-release, every deployment cut over in one release, so the legacy shape\n * has no readers or writers left.\n *\n * - `platform` stays the field name (not §6.4's sketch spelling `platformId`):\n * every platform-bearing frame on this wire (`SessionKey`, `rc/bot-assign`,\n * `event/session`, …) spells it `platform`, typed by the open\n * `Platform = z.string()` (S1a).\n * - `core` is REQUIRED. Its absence was the dual-shape tolerance; defaulting\n * it now would silently mint a rule-less integration out of a stale writer,\n * so a core-less spec fails the frame instead (fail-closed and visible).\n * - a spec whose `config` is absent or fails the platform module's schema is\n * rejected by the READER (skip + warn), not the frame schema — one bad spec\n * must not kill the register/ok snapshot it rides in.\n */\nexport const IntegrationSpec = z.object({\n orgId: z.string().min(1).max(64).optional(),\n integrationId: z.string().uuid(),\n agentId: z.string().uuid(),\n platform: Platform,\n core: IntegrationCoreEnvelope,\n config: z.unknown().optional()\n});\n/** C→D EVT — install/update an integration on the owning agent's daemon. */\nexport const IntegrationUpsert = IntegrationSpec;\n/** C→D EVT — remove an integration from the daemon. */\nexport const IntegrationRemove = z.object({\n integrationId: z.string().uuid()\n});\n/**\n * One conversation the bot participates in (metadata only — no messages).\n * `kind` distinguishes member channels from direct conversations (resource-\n * visibility.md §14.3): absent = 'channel' for wire compatibility. DM rows\n * (`kind: 'im'`, Slack \"D…\" ids) are reported for every integration on first\n * inbound DM; their `name` is the counterpart's display name. Group DMs\n * (`kind: 'mpim'`, Slack multi-person DMs) are reported on observation the same\n * way — never enumerated, because Slack does not list them as bot membership —\n * but they behave like a channel: several humans share the room, so the agent\n * stays mention-gated there rather than answering every message.\n *\n * `spaceId`/`space` identify the container the conversation lives in — a Discord\n * GUILD, which a bot in several servers needs for the channel to be identifiable at\n * all (every server has a \"#general\"). The ID is the identity: two distinct guilds\n * may carry the SAME name, so grouping on the name alone would merge them and hide\n * the ambiguity it was meant to resolve. `space` is the display label only. Both are\n * absent on platforms with one implicit container per bot (Slack workspace, Telegram,\n * Feishu tenant) and on DM rows.\n */\nexport const IntegrationChannel = z.object({\n id: z.string(), // platform conversation id (Slack \"C…\" / DM \"D…\")\n name: z.string().optional(), // \"#deploys\" without the hash (or DM counterpart); absent if lookup failed\n spaceId: z.string().optional(), // enclosing Discord guild snowflake — the space's IDENTITY\n space: z.string().optional(), // that guild's display name; absent until resolved\n isPrivate: z.boolean().optional(),\n kind: z.enum(['channel', 'im', 'mpim']).optional() // absent = 'channel'\n});\n/**\n * D→C EVT — channels observed by an integration's bot (fire-and-forget,\n * latest-wins). Slack reports an authoritative membership snapshot; platforms\n * such as Telegram that cannot enumerate every chat set `authoritative:false`,\n * so the CP upserts what was observed without deleting older rows that are\n * absent from this report. An absent flag means authoritative for wire\n * compatibility. Channel names are control metadata, never message content.\n *\n * `removed` is how a NON-enumerating platform retracts one conversation. Absence\n * from `channels` cannot mean \"gone\" there — the reported set is incomplete by\n * construction, so a non-authoritative report never deletes — which left a bot\n * that had actually left a group visible in the console forever. Naming the\n * conversation explicitly is the only way to say it. An authoritative reporter\n * needs none of this (its omissions already delete) but may still send it, and\n * a removal is applied even for a conversation absent from `channels`.\n */\nexport const IntegrationChannels = z.object({\n integrationId: z.string().uuid(),\n channels: z.array(IntegrationChannel),\n authoritative: z.boolean().optional(),\n // Optional rather than defaulted: nearly every report has nothing to retract, and\n // an absent field reads the same as an empty one to the CP.\n removed: z.array(z.string()).optional()\n});\n/**\n * What a leave targets. Platforms disagree about what a bot can withdraw from, and\n * the difference is not cosmetic — so the caller has to say which it means rather\n * than the daemon guessing from an id:\n *\n * - `conversation` — one channel/group the bot is a member of (Slack\n * `conversations.leave`, Telegram `leaveChat`).\n * - `space` — the whole container. Discord has no per-channel membership for a\n * bot at all: it is in a GUILD and sees that guild's channels through\n * permissions, so the only thing it can leave is the entire server. That is a\n * much larger action than leaving one channel and must be requested as such.\n */\nexport const IntegrationLeaveTarget = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('conversation'), channel: z.string().min(1) }),\n z.object({ kind: z.literal('space'), spaceId: z.string().min(1) })\n]);\n/**\n * C→D REQ → `integration/leave/ok` — withdraw the bot from a conversation or space\n * at the PLATFORM. Unlike every other channel control this leaves AgentConnect's own\n * state alone and changes the outside world, so it is a request with a reply: the\n * console reports what the platform actually said rather than assuming.\n *\n * The daemon owns provider egress for both transports (a relay-managed bot still\n * holds send credentials), so this is a daemon call in every topology.\n */\nexport const IntegrationLeave = z.object({\n integrationId: z.string().uuid(),\n target: IntegrationLeaveTarget\n});\n/**\n * C→D REQ → `ack` — stop REPORTING these conversations; the platform is not touched.\n *\n * The console's Forget needs this for the same reason a leave does. A non-enumerating\n * platform's observed set is rebuilt from session history, so deleting the row in the\n * CP alone lasts only until the daemon's next refresh pushes it back. The daemon holds\n * the suppression durably and lifts it when the conversation talks to it again.\n *\n * Acknowledged rather than fire-and-forget: the suppression is what makes the removal\n * stick, so a daemon that never received it WILL list the conversation again. Reporting\n * that as success would be a lie the operator only discovers later.\n */\nexport const IntegrationForget = z.object({\n integrationId: z.string().uuid(),\n channels: z.array(z.string()).min(1)\n});\n/**\n * D→C REP (corr = `integration/leave` id). `ok:false` carries the platform's own\n * refusal so the console can show it verbatim — \"last_member\", a missing scope, a\n * bot that lacks the right — instead of a generic failure. The daemon reconciles\n * the channel set separately over `integration/channels`; this reply is only the\n * verdict on the platform call.\n */\nexport const IntegrationLeaveOk = z.object({\n ok: z.boolean(),\n error: z.string().optional()\n});\n//# sourceMappingURL=integration.js.map","import { z } from 'zod';\nimport { AgentMemoryBinding } from './memory-connection.js';\nimport { IntegrationSpec } from './integration.js';\nimport { CronUpsert } from './cron.js';\nimport { normalizeGitHubSkillSource } from '../git-url.js';\n/**\n * Agent lifecycle (protocol §4.4, §7.4, §8).\n *\n * There is no CP→daemon prompt-delivery frame: the daemon prompts an agent from\n * its own ingress (platform adapters or relay `rd/*` delivery), never the CP.\n * The old `agent/prompt` + per-agent `seq` machinery was reserved infrastructure\n * with no live caller and has been removed.\n */\n/**\n * Where the agent runs. Two modes; the **path is always daemon-generated** —\n * never specified by the caller (UX picks the mode, the machine owns the dir).\n *\n * - `scratch`: a fresh empty working dir on the machine, with no default repo.\n * `gitCredential: github-app` enables credentials only for repositories that\n * were explicitly authorized for the agent.\n * - `github`: the daemon clones `gitRepo` @ `branch` and runs the agent in\n * `agentDir` (a subdir of the repo, repo-root if omitted). **Multiple agents\n * may share one repo** — they differ by `agentDir`, so the repo is not an\n * owned entity, just shared config on each agent.\n */\nexport const AgentWorkspace = z.discriminatedUnion('mode', [\n z.object({\n mode: z.literal('scratch'),\n // Workspace isolation is runtime-owned rather than a filesystem path. The\n // console exposes this as the simpler Worktree on/off choice for Git repos.\n isolation: z.enum(['shared', 'session']).default('shared'),\n // Scratch has no implicit/default repository. The credential helper still\n // lets git/gh request explicitly authorized repositories by name.\n gitCredential: z.enum(['github-app']).optional()\n }),\n z.object({\n mode: z.literal('github'),\n isolation: z.enum(['shared', 'session']).default('shared'),\n gitRepo: z.string(), // FULL cloneable address, e.g. https://github.com/acme/infra (normalizeGitUrl)\n branch: z.string().default('main'),\n agentDir: z.string().optional(), // subdir within the repo; omitted ⇒ repo root\n // Credential mode for remote git ops. Absent ⇒ anonymous (public repos,\n // the pre-github-app behavior). 'github-app' ⇒ the daemon pulls short-lived\n // CP-minted installation tokens over gitcred/request and injects them via\n // the local credential helper — no durable git credential on the host.\n gitCredential: z.enum(['github-app']).optional()\n })\n]);\n/** Who reviews Codex approval requests that cross the active sandbox boundary.\n * This is deliberately independent from the ACP permission mode: Auto-review\n * changes the reviewer, not the sandbox or approval policy. */\nexport const ApprovalsReviewer = z.enum(['user', 'auto_review']);\n/**\n * MCP-server name reserved for the daemon's own injected stdio bridge (its\n * platform tools). A config-defined or agent-enabled server under this name\n * would collide with the bridge entry at ACP `session/new`, so the daemon\n * strips it and the CP rejects it in `AgentSpec.mcpServers` at the API edge.\n */\nexport const RESERVED_MCP_SERVER_NAME = 'agentconnect';\n/**\n * The curated Lucide glyph set a `glyph` icon may use — the single source of\n * truth for the picker, the DTO validation, and the CP icon-endpoint renderer.\n * `glyph` is constrained to this set so an API/CLI-created icon can't persist a\n * name the console `<Icon>` and the PNG endpoint don't both render. The web\n * picker mirrors this list (it does not import this package) — keep in sync.\n */\nexport const AGENT_ICON_GLYPHS = [\n // The AgentConnect brand diamond — the fixed identity of the built-in preset\n // agents (preset-agents.md §3.1). Renderers special-case it: a multi-color\n // brand mark (not a Lucide stroke glyph) drawn plateless — the native logo,\n // its `color` field inert. The web picker deliberately does NOT offer it in\n // its grid, though a stored value renders everywhere.\n 'agentconnect',\n 'bot',\n 'cpu',\n 'terminal',\n 'code',\n 'rocket',\n 'zap',\n 'bug',\n 'git-branch',\n 'message-square',\n 'sparkles',\n 'brain',\n 'wrench',\n 'ship',\n 'box',\n 'hexagon',\n 'compass',\n 'atom',\n 'flame',\n 'star',\n 'heart',\n 'globe',\n 'database',\n 'shield',\n 'feather'\n];\n/**\n * An agent's display icon (docs: the Console \"Agent Avatar\" picker). A\n * discriminated union on `kind`:\n * - `runtime` — derive the mark from the agent's runtime (Claude/Codex/…), the\n * legacy behavior; also the meaning of a null/absent icon.\n * - `glyph` — a curated Lucide glyph (see {@link AGENT_ICON_GLYPHS}) on a solid\n * color plate (the create-time random default is a `glyph`). An unknown glyph\n * fails to parse and degrades to the runtime mark on every surface.\n * - `image` — a user-uploaded avatar. The bytes live in the CP's configured\n * object store (S3-compatible; see docs/designs/icon-uploads.md), NOT in this\n * descriptor. Its optional opaque generation distinguishes successive writes\n * to the stable object key; legacy rows omit it. The display/serve URL is\n * resolved separately (the object store's public URL for the owner's key),\n * surfaced as the DTO `iconUrl` / `AgentSpec.iconUrl`. Set only via the upload\n * route; never via a create/update body.\n * This descriptor is CP-owned + stored on the agent and surfaced to the web\n * console. The daemon never receives it — it gets only the resolved public\n * `AgentSpec.iconUrl` (for the Slack per-message avatar), so it needs no renderer.\n */\nexport const AgentIcon = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('runtime') }),\n z.object({ kind: z.literal('glyph'), glyph: z.enum(AGENT_ICON_GLYPHS), color: z.string() }),\n z.object({ kind: z.literal('image'), generation: z.string().min(1).max(128).optional() })\n]);\n/**\n * A self-contained Git skill definition the daemon acquires into a private\n * snapshot and installs through its exact `skills` dependency after the\n * workspace is ready and before the ACP host spawns (shared-skills.md §4/§6).\n * The source definition rides INLINE on the AgentSpec (and lands in agent.json,\n * like mcpServers) — there is no separate skillsource frame or daemon-side def\n * cache. The CP resolves each agent's enabled org-level `SkillSource` rows into\n * these entries when it builds the spec.\n */\n// Skill selections become `-s` arguments to the isolated CLI, while the source\n// is parsed by the Git acquisition boundary. Reject option-looking values at\n// the wire boundary — the daemon validates again in depth.\nconst SkillSelectionArg = z.string().regex(/^[a-z0-9](?:[a-z0-9._-]{0,126}[a-z0-9_])?$/, {\n message: 'must be a canonical lowercase skills CLI name without a trailing dot or hyphen'\n});\nconst SkillRef = z\n .string()\n .max(256)\n .refine((s) => s.length > 0 && !/[\\0\\r\\n]/.test(s), { message: 'must be a non-empty single-line ref' });\nconst SkillSubDir = z\n .string()\n .max(1_024)\n .refine((s) => s.length > 0 &&\n !s.startsWith('/') &&\n !s.includes('\\\\') &&\n !/[\\0\\r\\n]/.test(s) &&\n s.split('/').every((part) => part.length > 0 && part !== '.' && part !== '..'), { message: 'must be a safe relative subdirectory' });\nconst GitHubRepositoryId = z\n .string()\n .regex(/^[1-9]\\d{0,19}$/, { message: 'must be a canonical positive GitHub repository id' });\nexport const AgentSkillEntry = z.object({\n // Display/log label — the org-level source name. NOT passed to the CLI.\n name: z.string().min(1).max(64),\n // Credential-free Git acquisition input (owner/repo, clone URL, or a\n // tree/<ref>/<subdir> path). The CLI sees only the resulting local snapshot.\n source: z\n .string()\n .min(1)\n .max(512)\n .refine((s) => !s.startsWith('-'), { message: 'must not start with \"-\"' })\n .refine((s) => {\n try {\n normalizeGitHubSkillSource(s);\n return true;\n }\n catch {\n return false;\n }\n }, { message: 'must be a bounded GitHub repository source' }),\n // Rename-proof GitHub identity. Current CP projections must carry this exact\n // decimal id; the daemon verifies it through the numeric endpoint before any\n // name-based fetch.\n githubRepoId: GitHubRepositoryId,\n // Optional branch/tag/commit. The daemon composes it into the source when set;\n // a tag/commit pins content, a branch/absent tracks the head (design §5).\n ref: SkillRef.optional(),\n // Optional repo-relative install directory.\n subDir: SkillSubDir.optional(),\n // Which skills from the source to install (passed as repeated `-s`). Empty ⇒\n // install every skill the source exposes (no `-s`).\n skills: z\n .array(SkillSelectionArg)\n .max(64)\n .refine((skills) => new Set(skills).size === skills.length, { message: 'skill selections must be unique' })\n .default([])\n});\n/** Current-CP projection boundary. Kept separate from the rolling-compatible\n * wire decoder below: a new daemon may briefly receive an old CP's previously\n * legal rows, and one such row must not reject the entire register snapshot. */\nexport const InstallableAgentSkills = z\n .array(AgentSkillEntry)\n .max(64)\n .refine((entries) => new Set(entries.map((entry) => entry.name)).size === entries.length, {\n message: 'skill source names must be unique'\n});\nconst LegacySkillArg = z\n .string()\n .min(1)\n .refine((s) => !s.startsWith('-'), { message: 'must not start with \"-\"' });\nexport const CompatibleAgentSkillEntry = z.object({\n name: z.string(),\n source: LegacySkillArg,\n // Optional only for CP-first rolling upgrades and previously persisted\n // agent.json files. Strict daemon admission drops unbound legacy entries.\n githubRepoId: z.string().optional(),\n ref: z.string().optional(),\n subDir: z.string().optional(),\n skills: z.array(LegacySkillArg).default([])\n});\n/** One centrally accepted, immutable Agent Skills bundle enabled for an agent.\n * Content is fetched separately in bounded chunks; AgentSpec carries metadata\n * only so register/agent-upsert frames stay small. */\nexport const ManagedSkillEntry = z\n .object({\n id: z.string().uuid(),\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),\n revision: z.number().int().positive(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/)\n})\n .strict();\n/**\n * The editable agent definition the CP owns and the daemon needs to run it:\n * prompt + runtime selection. The launch protocol carries this config and the\n * daemon synthesizes the system prompt locally; `description` IS the prompt.\n */\nexport const AgentSpec = z.object({\n // Owning tenant. Optional only for CP/daemon rolling compatibility; a current CP always sends it.\n orgId: z.string().min(1).max(64).optional(),\n name: z.string(),\n // Human-readable bot name. CP snapshots/upserts always ship value or null so\n // clearing it removes a stale daemon-local display name; absent remains\n // available to hand-authored/partial specs as \"leave unchanged\".\n displayName: z.string().nullable().optional(),\n // Absolute, publicly-fetchable avatar URL the CP resolves from the agent's icon\n // (agent.icon → the CP icon endpoint for runtime/glyph, or the image URL directly).\n // The daemon uses it as the Slack per-message `icon_url` (chat:write.customize) —\n // the sibling of displayName→username (PR #539). CP ships value or null so clearing\n // the icon drops the override; null/absent ⇒ Slack keeps the app's default avatar.\n iconUrl: z.string().url().nullable().optional(),\n // The system prompt seed; appended to the daemon's standing prompt. The CP always\n // ships it as a string — a cleared description replicates as \"\" so the daemon\n // overwrites a stale seed; an absent key means \"leave unchanged\" (hand-authored/\n // partial specs). Deliberately NOT nullable: older daemons parse this as a plain\n // string and would reject a null register/ok roster entry, failing the whole\n // handshake. An empty prompt seed and \"no description\" are equivalent, so the \"\"\n // collapse is lossless.\n description: z.string().optional(),\n runtime: z.string().optional(), // which ACP runtime to run, e.g. \"claude\" / \"codex\"\n // Per-runtime override vocabularies (model / effort / permission mode). Switching\n // runtime invalidates them, so the CP must be able to CLEAR them, not just set them:\n // absent ⇒ leave the on-disk value alone (hand-authored agent.json / partial spec)\n // null ⇒ clear the override (revert to the runtime's own default)\n // string ⇒ set it\n // The CP's agentRecordToSpec always ships these (value or null) so a clear replicates.\n model: z.string().nullable().optional(), // runtime model, e.g. \"opus\"\n reasoningEffort: z.string().nullable().optional(),\n executionMode: z.string().optional(), // e.g. \"byoc\"\n outputMode: z.enum(['none', 'minimal', 'low', 'medium', 'high']).optional(), // platform output verbosity → agent.json output.mode ('none' = session-only, nothing to the IM)\n showFooter: z.boolean().optional(), // render platform attribution/session footers; absent ⇒ leave agent.json unchanged\n showStatusBar: z.boolean().optional(), // render Slack's persistent session status row; absent ⇒ leave agent.json unchanged\n fastMode: z.boolean().optional(), // runtime fast mode (ACP `model_config` toggle); absent ⇒ leave runtime default\n permissionMode: z.string().nullable().optional(), // runtime permission/approval mode (ACP `mode` selector); absent ⇒ leave alone, null ⇒ clear\n approvalsReviewer: ApprovalsReviewer.nullable().optional(), // Codex approval reviewer; independent from permissionMode\n // Explicit opt-in: when false, conversation participants cannot change runtime\n // settings (model, effort, permission mode, fast mode) or answer approval\n // requests. Agent editors decide pending requests from the console instead.\n allowRuntimeChangesInChat: z.boolean().optional(),\n // Operational message-processing toggle (orthogonal to placement). When true the\n // agent stays placed/connected but the daemon skips ALL turn dispatch (platform,\n // webchat, cron). Optional (not defaulted) so an absent value leaves the on-disk\n // agent.json pause untouched — same contract as fastMode/permissionMode.\n pause: z.boolean().optional(),\n workspace: AgentWorkspace.optional(), // where it runs; absent ⇒ daemon defaults to scratch\n env: z.record(z.string(), z.string()).optional(), // extra env injected into the runtime\n // Write-only secret env vars: same injection as `env` (merged into the spawned\n // child's environment, secrets winning on a key collision), but their VALUES never\n // travel back out — the CP DTO exposes only the key names, and the console masks\n // them. Plaintext at rest (like `env`) and shipped over the TLS WS; \"secret\" here\n // means write-only from the API/UI, not KMS-sealed. Always shipped (even {}) so a\n // removed secret replicates, same contract as `env` below.\n secrets: z.record(z.string(), z.string()).optional(),\n // Which memory backend the agent uses (design: docs/designs/memory-evolution.md):\n // managed — our <agent-root>/memory/ directory (default)\n // native — the runtime's own memory (Claude auto-memory / Codex memories),\n // redirected under the agent root for per-agent isolation\n // external — an outside service (mem0); not yet implemented\n // none — disable both daemon-managed and runtime-native persistent memory\n // Optional (absent ⇒ leave the on-disk agent.json value alone — same contract as\n // fastMode/pause). A brand-new agent with no value defaults to managed daemon-side.\n memory: AgentMemoryBinding.optional(),\n // Names of daemon-configured MCP servers (daemon config `mcpServers`, reported\n // via `facts/daemon-runtimes`) to attach at `session/new`. Empty/absent ⇒ none.\n mcpServers: z.array(z.string()).default([]),\n // Skill sources to install into the workspace before the ACP host spawns\n // (design: shared-skills.md). Unlike mcpServers (names resolved daemon-side),\n // these are SELF-CONTAINED entries — the daemon needs nothing but agent.json to\n // acquire bounded snapshots and invoke its bundled CLI. Always shipped (even\n // []) so removing the last skill replicates.\n // Decode the previous wire vocabulary during CP-first rolling upgrades. The\n // current CP projects only `InstallableAgentSkills`; the daemon independently\n // applies the same strict acquisition/size admission before any host starts.\n skills: z.array(CompatibleAgentSkillEntry).default([]),\n // Centrally accepted `.skill` ZIP revisions. Unlike Git source entries above,\n // these are digest-addressed metadata; the daemon downloads/cache-verifies the\n // bundle through managed-skill/read before session start.\n managedSkills: z\n .array(ManagedSkillEntry)\n .max(64)\n .refine((entries) => new Set(entries.map((entry) => entry.id)).size === entries.length, {\n message: 'managed skill ids must be unique'\n })\n .default([]),\n // Agent→agent call authorization (design §2.5). `callPolicy` gates who may wake\n // this agent via the `messageAgent` tool: 'all' ⇒ any peer in the org, 'selected'\n // ⇒ only agents in `allowedCallerAgentIds`. Replicated CP→daemon so the daemon can\n // enforce the policy LOCALLY on same-daemon delivery (no CP hop on the hot path).\n // Optional (absent ⇒ leave the on-disk agent.json value alone — same contract as\n // pause/memory); `allowedCallerAgentIds` always ships (even []) so removing the last\n // allowed caller replicates.\n callPolicy: z.enum(['all', 'selected']).optional(),\n allowedCallerAgentIds: z.array(z.string()).default([]),\n // Outbound half of agent→agent authorization. `selected` means this agent may\n // discover/message only peers in `allowedTargetAgentIds`. The target's inbound\n // policy must also allow this agent; effective authorization is the intersection.\n // Both fields remain optional when decoding an older CP payload so a mixed-version\n // update cannot retain an on-disk `selected` mode while silently clearing its list.\n // A current CP always ships both fields, including [] to clear the final member.\n outboundPolicy: z.enum(['all', 'selected']).optional(),\n allowedTargetAgentIds: z.array(z.string()).optional(),\n // Self-introduce-on-join (issue #536): when true, on a genuine new channel join the\n // agent proactively introduces itself to the peers already there (via listAgents\n // → messageAgent) so they can record it in memory. Replicated CP→daemon. Optional\n // (absent ⇒ leave the on-disk agent.json value alone — same contract as pause/fastMode).\n introduceOnJoin: z.boolean().optional(),\n // Per-agent OS sandbox preference (issue #642). It is effective only when the\n // host has bwrap/sandbox-exec; daemon `security.requireSandbox` forces it on and\n // prevents daemon startup when no mechanism exists. Optional means leave the\n // on-disk agent.json value alone; a brand-new agent defaults to false.\n runInSandbox: z.boolean().optional(),\n // True when this agent is an org built-in preset (preset-agents.md §3.1): a\n // `preset_agent` row references it. Replicated so the daemon can gate preset-only\n // behavior locally, including attaching `agentconnect-admin` only when the CP\n // supplies the conversation entitlement. Optional so an older CP's spec leaves\n // the on-disk value alone; a current CP always ships it.\n builtin: z.boolean().optional(),\n // Monotonic revision of this agent's fully resolved CP-owned configuration\n // (organization-secrets-and-variables.md §7). `env`/`secrets` are FULL maps, so\n // an out-of-order snapshot would reinstate a rotated or deleted value; the\n // daemon persists the greatest revision it applied and refuses an older one.\n // Not environment-specific — every CP-side mutation that can change a field\n // assembled into this spec bumps it through the same writer, giving one\n // ordering domain per agent.\n //\n // Encoded as a DECIMAL STRING, not a number: the CP column is a bigint and a\n // JSON number would silently lose precision past 2^53 on either side.\n // Optional for rolling upgrades (an older CP omits it, an older daemon ignores\n // it), but a bound agent may only be placed on a daemon advertising\n // `agent-config-revision-v1` — the feature never relies on lenient decoding.\n configRevision: z\n .string()\n .regex(/^(0|[1-9][0-9]*)$/)\n .optional()\n});\nexport const AgentLaunch = z.object({\n // C→D, carries ControlExt(epoch)\n agentId: z.string().uuid(),\n runtime: z.string(), // must be in RegisterReq.capabilities.runtimes\n workspaceId: z.string().uuid(),\n capabilities: z.array(z.string()), // the active-capability pin (§8.1)\n spec: AgentSpec, // prompt/model/env — arrives at start, no separate CRUD needed\n mode: z.enum(['long_lived', 'per_turn']).default('long_lived'), // 🅰️ decision #2 knob\n // Web API launch provenance (session-visibility.md §4.4): CP-minted when the\n // launch was requested by a console user, echoed back by the daemon on the\n // resulting session's `event/session` so ingest can classify it `private`\n // with that user as owner. Optional — CLI/orchestration launches and older\n // CPs omit it. NOT the launchId fence (which is per-launch, not per-user).\n launchCorrelationId: z.string().uuid().optional()\n});\n/**\n * Live agent CRUD (C→D): the console edited an agent's spec; push it so a\n * running daemon reloads without waiting for the next launch. `agent/remove`\n * tears the agent down. Deleting an agent never relaunches it.\n */\nexport const AgentUpsert = z.object({\n agentId: z.string().uuid(),\n spec: AgentSpec\n});\nexport const AgentRemove = z.object({\n agentId: z.string().uuid()\n});\n/** Hard cap on one existence query; a sweep with more candidates chunks. */\nexport const AGENT_EXISTS_MAX = 1000;\n/**\n * D→C REQ (reply: `agent/exists/ok`) — which of these agents the control plane still knows.\n * Install-wide: a pool member's orphan reconciler reads agent ids off cluster objects that\n * span every org it serves and asks in one round trip. Existence only, no spec: the answer\n * decides whether a leaked sandbox object may be collected, nothing more.\n */\nexport const AgentExists = z.object({\n agentIds: z.array(z.string().uuid()).min(1).max(AGENT_EXISTS_MAX)\n});\n/** C→D REP to `agent/exists`: the subset of the asked ids that exist. An id absent here is gone. */\nexport const AgentExistsOk = z.object({\n existing: z.array(z.string().uuid()).max(AGENT_EXISTS_MAX)\n});\n/**\n * Safe move lifecycle (C→D REQ → generic `ack`). `agent/detach` fences the\n * source or stages the target and archives any daemon-local root;\n * `agent/activate` atomically applies the authoritative spec/integration/cron\n * bundle, restores and exact-prunes an archive when present, then makes the\n * agent servable.\n */\nexport const AgentDetach = z.object({\n agentId: z.string().uuid(),\n /** Fences late lifecycle retries from a superseded move operation. */\n moveId: z.string().uuid(),\n /** Source-side hard cutover. Cancel already-admitted turns instead of waiting\n * for them to drain; their sessions remain daemon-local and are not replayed\n * after activation on the target. */\n discardActiveTurns: z.boolean().optional(),\n /** Scratch→GitHub conversion guard. The daemon drains the agent first, then\n * ACKs only when the live scratch working directory is still empty. */\n requireEmptyWorkspace: z.boolean().optional()\n});\nexport const AgentActivate = z.object({\n agentId: z.string().uuid(),\n /** Absent ⇒ authoritative unstage: release any fence held, and start no host unless the duty is held. */\n moveId: z.string().uuid().optional(),\n /**\n * One authoritative, acknowledged bootstrap bundle. Unlike the live CRUD\n * EVTs, these definitions are synchronously persisted under the staging gate\n * before activation can ACK, so a same-id stale secret/spec cannot survive.\n */\n spec: AgentSpec,\n integrations: z.array(IntegrationSpec),\n crons: z.array(CronUpsert),\n /** Prove the requested workspace can be materialized before activation ACK.\n * Used by scratch→GitHub conversion so a failed clone can be rolled back. */\n prepareWorkspace: z.boolean().optional(),\n /** Reconcile the daemon-local workspace to the authoritative mode/repo/branch.\n * The daemon preserves the checkout when that materialization is unchanged,\n * and replaces its contents when it changed. */\n reconcileWorkspace: z.boolean().optional()\n});\nexport const AgentLaunched = z.object({\n // D→C, REP/EVT\n agentId: z.string().uuid(),\n launchId: z.string().uuid(), // new fence value\n acpSessionId: z.string().optional(), // 🅰️ present iff long-lived ACP session (default)\n startedAt: z.string().datetime(),\n runtime: z.string() // e.g. \"claude\" / \"codex\"\n});\nexport const AgentStop = z.object({\n agentId: z.string().uuid(),\n launchId: z.string().uuid(),\n reason: z.string()\n});\nexport const AgentActivity = z.object({\n // D→C, EVT — activity-probe (§7.4)\n agentId: z.string().uuid(),\n launchId: z.string().uuid(),\n state: z.enum(['thinking', 'tool_call', 'awaiting_permission', 'idle']),\n ts: z.string().datetime()\n});\nexport const AgentScopeDenied = z.object({\n // D→C, EVT — capability-scope audit (§8.1)\n agentId: z.string().uuid(),\n launchId: z.string().uuid(),\n capability: z.string()\n});\n/** Editor approval queue. The daemon owns the live resolver and durable local\n * history; the Control Plane only proxies this bounded, secret-masked summary. */\nexport const AgentPermissionRequestRecord = z.object({\n id: z.string().uuid(),\n agentId: z.string().uuid(),\n // Optional for rolling compatibility with daemons that predate session-scoped\n // approval rendering. Current daemons always report the owning ACP session id.\n sessionId: z.string().min(1).optional(),\n createdAt: z.string().datetime(),\n requesterId: z.string().nullable(),\n requesterName: z.string().nullable(),\n command: z.string().max(240),\n status: z.enum(['pending', 'allowed', 'denied', 'expired']),\n resolvedAt: z.string().datetime().nullable()\n});\nexport const AgentPermissionRequestList = z.object({\n agentId: z.string().uuid(),\n limit: z.number().int().min(1).max(100).default(50)\n});\nexport const AgentPermissionRequestPage = z.object({\n agentId: z.string().uuid(),\n requests: z.array(AgentPermissionRequestRecord)\n});\nexport const AgentPermissionDecision = z.object({\n agentId: z.string().uuid(),\n requestId: z.string().uuid(),\n decision: z.enum(['allow', 'deny'])\n});\n// `agent/wake` (C→D REQ → `agent/wake/ok`): bring a cluster agent's sandbox to Running WITHOUT a turn.\n// The daemon claims the agent's duty on receipt like any trigger, so a set agent with no holder is\n// served by whichever member the wake reached; it answers with what it observed, never a promise.\nexport const AgentWakeReq = z.object({ agentId: z.string().min(1) });\n// `running` = the sandbox channel is bound; `starting` = the resume is in flight and the next read may\n// still refuse; `unsupported` = this daemon runs no sandboxes, so there is nothing to wake.\nexport const AgentWakeState = z.enum(['running', 'starting', 'unsupported']);\nexport const AgentWakeOk = z.object({ agentId: z.string().min(1), state: AgentWakeState });\n//# sourceMappingURL=agent.js.map","import { z } from 'zod';\n/**\n * Centralized MCP-provider distribution (C→D) — docs/designs/centralized-tool-management.md.\n *\n * The Control Plane owns MCP provider definitions and pushes them to the daemons\n * whose agents enable them (`mcpserver/upsert`, and the reconcile snapshot\n * `RegisterOk.mcpServers[]`). The daemon merges the spec into its `mcpServerDefs`\n * and attaches it at ACP `session/new` through the existing resolve path — a\n * pushed def is just an `http` MCP server.\n *\n * MCP-PROXY MODEL: in v1 the pushed `url` is a RELAY proxy URL and the injected\n * header is a short-lived **grant key** (`Authorization: Bearer …`) — never the\n * upstream endpoint or its real credential. Those stay on the CP + relay (§5).\n * SECURITY: `env`/`headers` may carry that bearer grant key — NEVER log this frame.\n */\n/** The `{name, value}[]` shape shared by MCP env + headers (mirrors the daemon's local McpServerDef). */\nconst NameValueList = z.array(z.object({ name: z.string(), value: z.string() })).default([]);\n/**\n * One MCP server definition the CP pushes to a daemon. Shape mirrors the daemon's\n * local `McpServerDef` (daemon config-schema.ts) with `name` inlined (the daemon\n * config keys the map by name). Transport-agnostic on the wire; the CP restricts\n * what it emits (v1 pushes proxied `http` defs only — the `sse`/`stdio`-only\n * restriction is a CP-side policy, not a wire constraint).\n */\nexport const McpServerSpec = z\n .object({\n orgId: z.string().min(1).max(64).optional(),\n name: z.string(),\n /**\n * Monotonic ordering marker: epoch millis of the ACTIVE GRANT this definition\n * was projected from — the only input that versions a proxy def, since the\n * proxy url is derived from the provider id and the relay base.\n *\n * Grant rotation keeps the retiring and the fresh grant both active until the\n * fresh one is distributed, so a definition projected inside that window can\n * be applied AFTER the fresh live push and would otherwise silently reinstate\n * a key the relay is about to retire. The daemon refuses a def strictly older\n * than the one it already applied; equal-or-newer applies, so a relay-base\n * change (same grant) still converges. Absent on daemon-local defs and from an\n * older CP, which reads as \"unordered — apply\".\n */\n issuedAt: z.number().int().nonnegative().optional(),\n transport: z.enum(['stdio', 'http', 'sse']).default('stdio'),\n command: z.string().optional(),\n args: z.array(z.string()).default([]),\n env: NameValueList,\n url: z.string().optional(),\n headers: NameValueList\n})\n .superRefine((def, ctx) => {\n if (def.transport === 'stdio' && !def.command)\n ctx.addIssue({ code: 'custom', path: ['command'], message: 'a stdio MCP server requires \"command\"' });\n if (def.transport !== 'stdio' && !def.url)\n ctx.addIssue({ code: 'custom', path: ['url'], message: `a ${def.transport} MCP server requires \"url\"` });\n});\n/** C→D EVT (`mcpserver/upsert`) — add or replace a pushed MCP server def on the daemon. */\nexport const McpServerUpsert = McpServerSpec;\n/** C→D EVT (`mcpserver/remove`) — drop a pushed MCP server def by name. */\nexport const McpServerRemove = z.object({ orgId: z.string().min(1).max(64).optional(), name: z.string() });\n//# sourceMappingURL=mcpserver.js.map","import { z } from 'zod';\nimport { Platform } from './route.js';\n/**\n * Bot-AGNOSTIC agent-collaboration routing snapshot (agent-collaboration §2.3 / §6.2 / §6.5).\n *\n * The existing shared-bot `members` table is keyed by botId (`BotAssignment`) and\n * CANNOT address an agent on a DIFFERENT bot / arbitrary channel. This snapshot is\n * the fix: it maps a channel — `(orgId, platform, channelId)` — to the per-agent\n * placement + call policy the relay needs to route a cross-daemon `rd/agentmsg` and\n * the target daemon needs to terminal-verify a remote caller.\n *\n * It carries NO message body — pure routing/policy metadata, like the rest of the\n * control plane. The SAME shape is distributed two ways (§6.5):\n * - CP→relay over the `rc/*` wire (`rc/collab-routes`) — the relay routes\n * `toAgentId` → owning `daemonId` and authorizes the caller/target policy.\n * - CP→daemon over the daemon↔CP wire — as a `register/ok` field (reconnect\n * baseline) + a `collaboration/routes` EVT (hot push) — so the OWNING daemon of\n * the target can terminal-verify (defense in depth, §2.5 #4) the remote caller's\n * org/channel/placement against its OWN copy, never trusting the relay's claim\n * blindly.\n *\n * FOLLOW-UP (scoped down in P2, see PR description): the full versioned lifecycle\n * of §6.5 — per-entry tombstones, TTL/expiry after a CP disconnect, and\n * fail-closed-on-stale — is NOT fully implemented here. `generation` is present as\n * the version hook and the snapshot is FULL-REPLACE (converge-don't-diff, same as\n * `register/ok`), which is enough to route + authorize on a live CP. TTL-expiry and\n * tombstone semantics are a follow-up within this phase.\n */\n/** One agent's placement + call policy within a channel. `daemonId` is the owning\n * daemon the relay forwards to; `integrationId` is the DEFINITE reply integration\n * (§6.2 — no fallback to \"first connection\"). */\nexport const CollabAgentPlacement = z.object({\n agentId: z.string().uuid(),\n daemonId: z.string().uuid(),\n integrationId: z.string().uuid().optional(),\n /** Public Slack app id (`A…`) for this agent's bot. Receivers use it to recognize\n * AgentConnect-authored platform messages — the first half of verifying an\n * authorship claim (send-message-routing-rework.md §4). */\n botAppId: z.string().optional(),\n /** Public platform member id this agent's bot posts as (Slack `U…`) — the id a\n * `<@…>` mention resolves to. With {@link botShared} and `name` it is the complete\n * input for the conversation-specific mention ADDRESS\n * (send-message-routing-rework.md §8.5), which both directions need: rendering an\n * exact address to post, and resolving an inbound mention back to an agent.\n * Public metadata, never a credential. */\n botUserId: z.string().optional(),\n /** True when {@link botUserId} backs MORE THAN ONE agent (a shared bot). The bot user\n * id alone then cannot identify an agent, so its address carries the agent slug too\n * (`<@U_SHARED> reviewer`) and a BARE mention of it addresses no specific agent —\n * which is why a shared bot with no exact author claim fails closed at ingress (§4)\n * and why a bare shared-bot mention from an agent must not fall back to the channel\n * default (§6). */\n botShared: z.boolean().optional(),\n callPolicy: z.enum(['all', 'selected']).default('all'),\n allowedCallerAgentIds: z.array(z.string()).default([]),\n /** Caller-side authorization. Effective A→B access requires A's outbound\n * policy to admit B and B's inbound call policy to admit A. */\n outboundPolicy: z.enum(['all', 'selected']).default('all'),\n allowedTargetAgentIds: z.array(z.string()).default([]),\n // Directory name of the agent — carried so any daemon holding the snapshot can label a\n // REMOTE peer (caller or target) by name in a visible agent-call post, without a CP\n // round-trip or having listed the channel. `name` is the slug; `displayName` the\n // human-readable label. Optional for back-compat with an older CP that omits them.\n name: z.string().optional(),\n displayName: z.string().optional()\n});\n/**\n * One agent's placement + call policy carried OUTSIDE any channel — the org-scoped\n * peer directory entry.\n *\n * Every structure on the CP→daemon and CP→relay wires is channel-keyed, so an agent\n * with NO IM integration (webchat, hook, dream, memory-only) never appears in any\n * `channels[]` entry at all. The channel-keyed snapshot structurally cannot express\n * \"which agents exist in this org\", which is precisely the input channel-free\n * authorization needs: discovery and A2A authorization depend only on the directional\n * call policy (`outboundPolicy`/`allowedTargetAgentIds` on the caller,\n * `callPolicy`/`allowedCallerAgentIds` on the target), org-scoped, with channel\n * demoted to an optional filter. Hence the flat list below.\n */\nexport const CollabOrgAgent = CollabAgentPlacement.extend({\n // Org ids are opaque strings (see CollabChannelRoute) — carried per entry because\n // the flat list is not nested under an org-keyed parent. Cross-org pairs never resolve.\n orgId: z.string().min(1),\n // The member a wake is forwarded to. ABSENT ⇒ PENDING: the agent exists, its policy is authoritative, but\n // no member is addressable yet (unconfirmed pool grant / lapsed lease) → `not_ready`, not `not_found`.\n // Only this flat directory carries pending entries; `channels[]` never does.\n daemonId: z.string().uuid().optional()\n});\n/** All agents present in one channel, across daemons. `orgId` scopes routing +\n * authorization: a cross-org caller/target pair never resolves (§2.5 — cross-org\n * rejected). */\nexport const CollabChannelRoute = z.object({\n // Org ids are opaque strings (Prisma uses cuid(); the seeded dev org uses\n // `org_default...`), unlike daemon/agent/integration ids which are UUIDs.\n orgId: z.string().min(1),\n platform: Platform,\n channelId: z.string().min(1),\n agents: z.array(CollabAgentPlacement)\n});\n/**\n * The full collaboration snapshot — FULL-REPLACE (converge-don't-diff): the\n * recipient replaces its whole table with `channels`. `generation` monotonically\n * increases per source so a recipient can ignore a stale re-order (version hook for\n * the §6.5 lifecycle follow-up).\n */\nexport const CollabRoutesSnapshot = z.object({\n generation: z.number().int().nonnegative().default(0),\n channels: z.array(CollabChannelRoute).default([]),\n /**\n * FLAT org-scoped directory, alongside (not instead of) `channels`. It is the only\n * place an integration-less agent can appear — see `CollabOrgAgent` — and therefore\n * the authorization input for channel-free A2A. `default([])` keeps a snapshot from\n * an older CP (which advertises no `agent-directory-org-scope-v1`) decodable.\n */\n agents: z.array(CollabOrgAgent).default([]),\n /**\n * §6.1 origin-kind classification for the platform ids the EMITTER knows — how an\n * older peer classifies an id a newer CP introduces (its own built-in seed only\n * covers ids its build shipped with). Consumers overlay these entries on their\n * seed; an id classified by neither defaults to `'chat'`, the fail-closed answer\n * wherever placements matter (`coordsDecision`). Both fields read as open strings\n * per the S1a rule. `default([])` keeps a pre-S1b snapshot decodable.\n */\n platformKinds: z.array(z.object({ platformId: z.string().min(1), originKind: z.string().min(1) })).default([])\n});\n//# sourceMappingURL=collab.js.map","import { z } from 'zod';\n/**\n * Deployment GitHub App identity used for ordinary commits made by an agent.\n * This is public attribution metadata, not a credential.\n */\nexport const GitCommitIdentity = z.object({\n name: z.string().min(1),\n email: z.string().min(1)\n});\n/**\n * Git credentials (github-app workspaces) — daemon-pulled, CP-minted.\n *\n * The CP holds the GitHub App private key and mints short-lived (1h,\n * non-renewable) installation access tokens scoped to a single repository;\n * the daemon pulls one on demand right before a remote git operation and\n * holds it in memory only. Unlike `secrets/*` (lease + reference semantics,\n * still unwired), the grant here carries the TOKEN MATERIAL itself — same\n * plaintext-over-TLS-WS posture as `integration/upsert`, and the same\n * discipline: **never log the payload**.\n *\n * The daemon may only name an agentId — the CP resolves agent → workspace →\n * repo → installation itself, so a daemon can never pick a repo it wasn't\n * assigned. Failures come back as correlated `error` REPs: `SCOPE_DENIED`\n * (not a github-app workspace, or agent not placed on this daemon — stop\n * asking), `LEASE_DENIED` (installation uninstalled/suspended or the repo\n * left its grant set — recoverable only by an operator), `RATE_LIMITED`,\n * `INTERNAL`.\n */\n/**\n * Token capability classes (webhook-triggers-and-github-events.md P2.5 write-back).\n * `contents` is the git data plane (the pre-capabilities behavior); `issues` /\n * `pull_requests` buy the agent `gh` write-back (issue/PR comments), and\n * `actions` buys GitHub Actions inspection/execution. Every\n * General agent credentials mint every capability admitted by the repo's\n * `gitAccess` / authorization tier — a read-only agent gets read-only\n * issues/PR scopes and no Actions capability.\n * The one exception is purpose=github_hook_reply: a daemon-owned writer whose\n * token never enters the agent environment and is gated by an enabled hook.\n */\nexport const GitCredCapability = z.enum(['contents', 'issues', 'pull_requests', 'actions']);\nexport const GitCredRequest = z.object({\n // D→C, REQ\n agentId: z.string().uuid(),\n reason: z.enum(['clone', 'fetch', 'pull', 'push', 'helper']).optional(), // observability only\n // Absent ⇒ ['contents'] — pre-P2.5 daemons keep byte-identical behavior.\n capabilities: z.array(GitCredCapability).nonempty().optional(),\n // The daemon-owned GithubPoster is a narrower consumer than an agent's git/\n // gh tools: its token never enters the agent environment and may only back\n // the one final comment for an enabled GitHub hook turn. Marking that purpose\n // explicitly lets the CP apply the hook authorization instead of incorrectly\n // clamping the comment token to the workspace contents gitAccess.\n purpose: z.literal('github_hook_reply').optional(),\n // Trusted hook identity copied from the relay-delivered rd/msg. Required by\n // the CP for purpose=github_hook_reply so authorization stays rename-safe on\n // HookDef.repoId instead of comparing mutable owner/repo display names.\n hookId: z.string().uuid().optional(),\n // A poster sets this only after GitHub rejects a cached token with 401/403.\n // The CP then bypasses its installation-token cache exactly once; ordinary\n // git/gh requests ignore it.\n forceRefresh: z.boolean().optional(),\n // Absent ⇒ the agent's workspace repo (pre-multi-repo behavior). \"owner/repo\".\n // The CP admits only workspace ∪ the agent's AgentRepoAuthorization rows and\n // mints the requested capability subset at the row's access tier — the daemon\n // still cannot pick an arbitrary repo (agent-multi-repo-authorization.md\n // decision 2). A purpose=github_hook_reply request is separately gated by an\n // enabled GitHub hook and receives only issues/PR write, never contents. Old\n // CPs strip this field and answer with a WORKSPACE grant: consumers MUST\n // verify grant.repoFullName against what they asked for before trusting it.\n repoFullName: z.string().optional()\n});\nexport const GitCredGrant = z.object({\n // C→D, REP (plaintext token — never log)\n username: z.literal('x-access-token'), // fixed HTTPS basic-auth username for installation tokens\n token: z.string(), // ghs_… — new stateless format runs ~520 chars; never assume a length\n ttlSec: z.number().int(), // CP-computed remaining life, 60s clock-skew allowance already shaved.\n // Daemons MUST track expiry as monotonic receivedAt+ttlSec (a skewed local\n // clock must never resurrect a dead token); `expiresAt` is observability only.\n expiresAt: z.string().datetime(),\n repoFullName: z.string(), // owner/repo — helper path-match + diagnostics\n access: z.enum(['read', 'write'])\n});\n//# sourceMappingURL=gitcred.js.map","import { z } from 'zod';\nimport { Platform, RouteAssign } from './route.js';\nimport { CronUpsert } from './cron.js';\nimport { SecretsGrant } from './secrets.js';\nimport { AgentSpec } from './agent.js';\nimport { IntegrationSpec } from './integration.js';\nimport { McpServerSpec } from './mcpserver.js';\nimport { MemoryConnectionSpec } from './memory-connection.js';\nimport { CollabRoutesSnapshot } from './collab.js';\nimport { GitCommitIdentity } from './gitcred.js';\n/**\n * Capability upload + the reconcile snapshot — protocol §3.3.\n *\n * `register/ok` is the authoritative source of truth: the daemon converges its\n * local cache to it. CP wins all conflicts, so re-issuing the same snapshot is\n * idempotent.\n */\nexport const RegisterReq = z.object({\n host: z.string(), // hostname (display only)\n // Rollout generation of a pool member (the deployment's pod-template hash, from AC_POD_TEMPLATE_HASH).\n // Only the newest live generation of a member set may claim vacated duty groups; absent for\n // local daemons and older pods, which the rule never excludes.\n generation: z.string().min(1).max(128).optional(),\n // An OBSERVER connection: the `reconcile --once` CronJob, which authenticates with the same\n // projected pool identity but serves nothing. The CP admits the identity and answers reads, but\n // enrolls it in no member set, so the duty ledger can never grant it anything (k8s-daemon-pool.md §4).\n observer: z.boolean().optional(),\n capabilities: z.object({\n platforms: z.array(Platform), // D3 adapters present\n runtimes: z.array(z.string()), // e.g. [\"claude\",\"codex\"]\n acp: z.boolean(), // can this daemon host ACP sessions (D6)?\n features: z.array(z.string()).default([]) // e.g. [\"cli-wrapper-fallback\",\"worktree-iso\"]\n }),\n maxAgents: z.number().int(), // concurrency ceiling for placement (C3)\n localState: z.object({\n // what the daemon currently believes it owns (for reconcile)\n assignments: z.array(z.string()), // sessionKeys it is actively serving\n crons: z.array(z.string()), // cronIds it has scheduled\n leases: z.array(z.string()), // leaseIds it holds\n // Active on-disk replicas plus fail-closed interrupted-removal markers.\n // `unknown` is the rolling-upgrade/legacy value:\n // the CP may prune it only when the durable row proves the replica moved.\n // Defaults keep an older daemon compatible with a newer CP.\n agents: z.array(z.object({ agentId: z.string(), origin: z.enum(['cp', 'unknown']) })).default([]),\n integrations: z.array(z.object({ integrationId: z.string(), origin: z.enum(['cp', 'unknown']) })).default([]),\n // Durable fail-closed move tombstones. A newer CP repairs entries with a\n // valid token after register/ok. A missing token represents corrupt local\n // metadata: the daemon keeps that agent drained for manual repair without\n // making the whole registration undecodable.\n stagedAgents: z.array(z.object({ agentId: z.string(), moveId: z.string().uuid().optional() })).default([])\n })\n});\n/**\n * D→C EVT (`capabilities/update`) — hot full-replace of the connection's\n * `RegisterReq.capabilities`. `register` computes the feature set before the\n * reconcile roster lands and before the runtime probe sweep runs, so a feature\n * derived from either would otherwise stay hidden until the next reconnect.\n * `webchat_remote_mcp_v1` is not one of those dynamic features: it reflects the\n * daemon's confidential grant-delivery implementation, independently of roster,\n * runtime probe, and sandbox state. The daemon re-announces whenever its computed\n * capability set changes mid-connection; the CP treats it exactly like the register\n * value it refreshes. An older CP replies `error{UNKNOWN_FRAME}`, which the daemon\n * ignores — the feature then simply waits for the next register, the pre-frame behavior.\n */\nexport const CapabilitiesUpdate = z.object({\n capabilities: RegisterReq.shape.capabilities\n});\n/**\n * One relay the daemon SHOULD hold an outbound WS to (shared-bot-relay.md §5).\n * The roster is all-to-all by design: a webchat/webhook landing on ANY relay\n * instance must find this daemon's connection without cross-instance forwarding.\n * That only holds if `url` (the relay's registered `daemonUrl`) routes to that\n * SPECIFIC instance — the daemon confirms the landing spot against\n * `rd/hello/ok.relayId` and treats a mismatch as a deployment misroute.\n */\nexport const RelayRosterEntry = z.object({\n relayId: z.string().uuid(),\n url: z.string() // the relay's daemonUrl — per-instance routable, never a pool LB\n});\n/**\n * C→D EVT (`relay/roster`) — hot roster update (relay registered / swept).\n * Carries the WHOLE desired set, same converge-don't-diff semantics as the\n * `register/ok.relays` snapshot it refreshes.\n */\nexport const RelayRosterUpdate = z.object({\n relays: z.array(RelayRosterEntry)\n});\n/**\n * Console-set retention window for FINISHED sessions on the daemon's LOCAL\n * store (the daemon settings' \"Expire sessions\" option). CP-durable; the\n * register/ok snapshot is the reconnect baseline and a `config/push` with\n * `sessions.retention` is the hot update.\n *\n * `'never'` disables the sweep; otherwise an integer number of days as\n * `'<n>d'` (e.g. `'7d'`) — n ≥ 1, capped at 4 digits so a typo can't encode\n * a multi-millennium window.\n */\nexport const SESSION_RETENTION_RE = /^(?:never|[1-9]\\d{0,3}d)$/;\nexport const SessionRetentionSetting = z.custom((v) => typeof v === 'string' && SESSION_RETENTION_RE.test(v), { message: \"expected 'never' or '<days>d' (e.g. '7d')\" });\nexport const RegisterOk = z.object({\n routingEpoch: z.number().int(), // version of the routing table this snapshot reflects\n // CP protocol capabilities. Default keeps a new daemon compatible with an\n // older CP during rolling deploys; old daemons ignore this additive field.\n serverFeatures: z.array(z.string()).default([]),\n // Public attribution for github-app workspace commits. Derived from this\n // deployment's App slug; optional so new daemons still accept an older CP.\n gitCommitIdentity: GitCommitIdentity.optional(),\n // Console-set finished-session retention for this daemon's local store —\n // optional so new daemons still accept an older CP (absent ⇒ keep local config).\n sessionRetention: SessionRetentionSetting.optional(),\n // Authoritative reconcile snapshot — daemon converges its local cache to this:\n assignments: z.array(RouteAssign), // the route/assign set the daemon SHOULD own\n agents: z.array(AgentSpec.extend({ agentId: z.string().uuid() })).default([]), // spec set CP wants present; daemon converges\n crons: z.array(CronUpsert), // the cron set it SHOULD run\n // Platform integrations this daemon SHOULD hold — FILTERED to this daemon (never\n // org-wide), since each element carries plaintext tokens. Never log this array.\n integrations: z.array(IntegrationSpec).default([]),\n // MCP server defs this daemon SHOULD hold — FILTERED to this daemon (only providers\n // its agents enable). In the MCP-proxy model these carry a relay proxy URL + a bearer\n // grant key (not the upstream secret), but treat as sensitive — never log this array.\n // Defaulted so a pre-MCP-registry CP's snapshot still parses.\n mcpServers: z.array(McpServerSpec).default([]),\n // External-memory defs this daemon's agents reference. Relay grants and local\n // secret leases are daemon-private and must never be logged.\n memoryConnections: z.array(MemoryConnectionSpec).default([]),\n leases: z.array(SecretsGrant), // secret leases it SHOULD hold\n // Relay roster — the relays this daemon SHOULD dial (webchat ingress now;\n // shared-bot/webhook with milestone B). Hot updates ride `relay/roster`;\n // defaulted so a pre-relay CP's snapshot still parses.\n relays: z.array(RelayRosterEntry).default([]),\n // Bot-agnostic collaboration routing snapshot (agent-collaboration §2.3 / §6.5) —\n // the reconnect BASELINE for this daemon's terminal-verify of REMOTE agent callers.\n // Scoped to channels this daemon's agents participate in. Hot changes ride the\n // `collaboration/routes` EVT. Defaulted so a pre-collab CP's snapshot still parses.\n collabRoutes: CollabRoutesSnapshot.default({ generation: 0, channels: [], agents: [], platformKinds: [] }),\n drop: z.object({\n // things in localState the CP says to release\n assignments: z.array(z.string()),\n crons: z.array(z.string()),\n // A missed live move archives the replica (preserving workspace/memory); a\n // missed delete removes a replica that carries the explicit CP marker.\n agents: z.array(z.object({ agentId: z.string(), action: z.enum(['detach', 'remove']) })).default([]),\n integrations: z.array(z.string()).default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OAAS,CAAC;EAGzB,QAAQE,MAAQH,OAAS;GAAE,SAASC,OAAS;GAAG,QAAQI,MAAO,CAAC,UAAU,QAAQ,CAAC;EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;EACnG,cAAcF,MAAQF,OAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAChD,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentconnect.md/daemon",
3
- "version": "1.41.0-rc.216",
3
+ "version": "1.41.0-rc.217",
4
4
  "description": "AgentConnect daemon — edge message + agent execution unit",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {