@agentconnect.md/daemon 2.5.0-rc.66 → 2.5.0-rc.67

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":"correlator-DCB1Q6aH.js","names":["z.string","z.enum","z.object","z\n .object","z.number","z.boolean","z.discriminatedUnion","z.literal","z\n .string","z.array","z\n .object","z.discriminatedUnion","z\n .object","z.literal","z.string","z.object","z.enum","z\n .object","z.boolean","z.object","z\n .string","z.enum","z.number","z.discriminatedUnion","z.literal","z.string","z\n .string","z.boolean","z\n .enum","z.array","z.union","z.record","z.unknown","z\n .object","z\n .object","z.object","z.number","z.string","z.array","z.unknown","z.boolean","z.enum","z\n .object","z.record","z\n .object","z\n .string","z\n .enum","z.enum","z.object","z.string","z.number","z\n .string","z\n .object","z\n .array","z.array","z.boolean","z.enum","z\n .object","z.string","z.number","z.array","z\n .number","z\n .array","z.object","z\n .object","z.boolean","z.literal","z.discriminatedUnion","z.object","z.string","z.number","z\n .string","z\n .object","z.boolean","z.array","z.enum","z.literal","z.record","z.unknown","z\n .string","z\n .object","z\n .array","z.string","z.discriminatedUnion","z.object","z.literal","z.number","z.enum","z.boolean","z.array","z.unknown","z\n .object","z.string","z.enum","z\n .object","z.literal","z.array","z.boolean","z.object","z.number","z\n .number","z.record","z.unknown","z.union","z\n .object","z.string","z\n .string","z.discriminatedUnion","z\n .object","z.literal","z.object","z.enum","z\n .array","z\n .object","z\n .array","z.boolean"],"sources":["../../protocol/dist/frames/hook.js","../../protocol/dist/mcp-app.js","../../protocol/dist/frames/webchat.js","../../protocol/dist/frames/session.js","../../protocol/dist/frames/follow-up-watch.js","../../protocol/dist/frames/organization-knowledge.js","../../protocol/dist/frames/memory.js","../../protocol/dist/frames/memory-store.js","../../protocol/dist/memory-entries.js","../../protocol/dist/frames/memory-transaction.js","../../connection/dist/correlator.js"],"sourcesContent":["import { z } from 'zod';\nimport { CodeHostExternalId, CodeHostProviderString, HOOK_KINDS } from '../code-host.js';\n/** Decimal wire form for Prisma/GitHub bigint values. */\nexport const HookBigIntString = z.string().regex(/^(?:0|[1-9]\\d*)$/);\n/** The highest formal-review event one hook permits. */\nexport const HookReviewPolicy = z.enum(['off', 'comment', 'request_changes', 'full']);\n/** External run-reporting transport. `status` is reserved for the later R3. */\nexport const HookReportingMode = z.enum(['off', 'check', 'status']);\n/** R2a only admits informational; `required` remains a fail-closed future mode. */\nexport const HookGateMode = z.enum(['informational', 'required']);\n/**\n * Exact config + dispatch identity captured when the CP compiles a hook fire.\n *\n * The relay-facing frames expose these fields individually at top level so an\n * older CP/relay can omit them without making the whole fire undecodable. A\n * consumer MUST have every field before enabling review/reporting; absence is\n * not filled with a revision and therefore fails closed. Action-time RPCs use\n * this complete object so a partially rolled-out tuple cannot authorize an\n * effect.\n */\nexport const HookConfigSnapshot = z.object({\n configRevision: HookBigIntString,\n dispatchRevision: HookBigIntString,\n dispatchDaemonId: z.string().uuid(),\n reviewPolicy: HookReviewPolicy,\n reportingMode: HookReportingMode,\n gateMode: HookGateMode\n});\n/** Optional top-level form used only on rolling-compatible delivery frames. */\nexport const OptionalHookConfigSnapshot = HookConfigSnapshot.partial();\n/** Signature-verified, body-free GitHub subject/revision metadata; optional review and comment ids preserve mixed-version decoding. */\nexport const GithubHookMetadata = z\n .object({\n repoId: HookBigIntString,\n repoFullName: z.string().min(1),\n sourceInstallationId: HookBigIntString,\n subjectKind: z.enum(['issue', 'pull_request']),\n pullNumber: z.number().int().positive().optional(),\n headSha: z.string().min(1).optional(),\n baseSha: z.string().min(1).optional(),\n reportSha: z.string().min(1).optional(),\n headRepoFullName: z.string().min(1).optional(),\n mergeCommitSha: z.string().min(1).optional(),\n isDraft: z.boolean().optional(),\n baseChanged: z.boolean().optional(),\n // Relay-derived from a newly-authored PR conversation comment that\n // explicitly mentions this agent or the App while the accepted rule\n // enables formal reviews. The body stays off the CP wire; only this\n // trusted routing fact reopens the review generation.\n explicitReviewRequest: z.boolean().optional(),\n pullRequestReviewId: HookBigIntString.refine((value) => value !== '0').optional(),\n reviewCommentId: HookBigIntString.optional(),\n reviewThreadRootCommentId: HookBigIntString.optional(),\n // The `issue_comment` delivery's own comment id — the exact acknowledgement-reaction\n // target. `reviewCommentId` above is the same fact for an inline review comment; a\n // delivery with neither was fired by the subject itself.\n issueCommentId: HookBigIntString.optional()\n})\n .superRefine((value, ctx) => {\n if (value.subjectKind === 'pull_request' && value.pullNumber === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['pullNumber'],\n message: 'pullNumber is required for a pull_request subject'\n });\n }\n if (value.reportSha !== undefined && value.headSha === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['reportSha'],\n message: 'reportSha requires an authoritative headSha'\n });\n }\n if (value.reportSha !== undefined && value.headSha !== undefined && value.reportSha !== value.headSha) {\n ctx.addIssue({\n code: 'custom',\n path: ['reportSha'],\n message: 'R2a reports only the authoritative pull head SHA'\n });\n }\n});\n/** GitHub folds target-branch changes into `pull_request:edited`; only the signed `changes.base` fact makes that edit a revision. */\nexport function isGithubPullRequestRevisionEvent(event, github) {\n return (event === 'pull_request:opened' ||\n event === 'pull_request:synchronize' ||\n (event === 'pull_request:edited' && github?.baseChanged === true));\n}\n/** Actions `release:*` skips: `created` saves a draft or precedes `published`; `released`/`prereleased` restate a publish or an edit. */\nexport const GITHUB_RELEASE_RESTATED_EVENTS = new Set([\n 'release:created',\n 'release:released',\n 'release:prereleased'\n]);\n/** One GitLab hook subject: issue/MR by IID, or a standalone push ref (gitlab-com-integration.md §17.2). */\nexport const GitlabHookTarget = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('issue'), iid: z.number().int().positive() }),\n z.object({\n kind: z.literal('merge_request'),\n iid: z.number().int().positive(),\n // Source-project + revision facts, present when the verified payload carries them.\n sourceProjectId: HookBigIntString.optional(),\n headSha: z.string().min(1).optional(),\n baseSha: z.string().min(1).optional(),\n isDraft: z.boolean().optional(),\n // Relay-derived trusted routing fact (reviewer request / authorized mention);\n // authored text stays off the CP wire, exactly like explicitReviewRequest above.\n explicitReviewRequest: z.boolean().optional()\n }),\n z.object({ kind: z.literal('push'), ref: z.string().min(1) }),\n // Every release of the repository continues one session; an older daemon cannot decode this member (RD_CODEHOST_RELEASE_V1).\n z.object({ kind: z.literal('release'), tag: z.string().min(1) })\n]);\n/** Signature-verified, body-free GitLab subject metadata — the trusted normalization\n * discriminator the daemon recomputes session keys from; never inferred from model-visible text. */\nexport const GitlabHookMetadata = z.object({\n projectId: HookBigIntString,\n projectPath: z.string().min(1), // current namespaced path — display only, never a match key\n webhookId: HookBigIntString.optional(),\n // The instance this delivery came from, copied from the compiled rule and never read\n // off the payload (§24.4). The turn-time fence: a delivery whose host disagrees with the\n // session's spec-carried host is refused, never re-targeted. Absent means GitLab.com.\n host: z.string().optional(),\n target: GitlabHookTarget,\n // The note delivery's own id — GitLab's counterpart of `issueCommentId`, and the exact\n // acknowledgement-reaction target. Absent ⇒ the subject itself fired this delivery.\n noteId: HookBigIntString.optional()\n});\n/** One Gitea hook subject (gitea-integration.md §8): issues and pull requests share one index space, so the subject kind is the discriminator. */\nexport const GiteaHookTarget = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('issue'), index: z.number().int().positive() }),\n z.object({\n kind: z.literal('pull'),\n index: z.number().int().positive(),\n // Source-repository + revision facts, present when the verified payload carries them.\n sourceRepoId: HookBigIntString.optional(),\n headSha: z.string().min(1).optional(),\n baseSha: z.string().min(1).optional(),\n isDraft: z.boolean().optional(),\n // Relay-derived trusted routing fact (reviewer request / authorized mention); authored text stays off the CP wire.\n explicitReviewRequest: z.boolean().optional()\n }),\n z.object({ kind: z.literal('push'), ref: z.string().min(1) }),\n // Every release of the repository continues one session; an older daemon cannot decode this member (RD_CODEHOST_RELEASE_V1).\n z.object({ kind: z.literal('release'), tag: z.string().min(1) })\n]);\n/** Signature-verified, body-free Gitea subject metadata — the trusted normalization\n * discriminator the daemon recomputes session keys from; never inferred from model-visible text. */\nexport const GiteaHookMetadata = z.object({\n repoId: HookBigIntString,\n repoPath: z.string().min(1), // current owner/repo — display only, never a match key\n webhookId: HookBigIntString.optional(),\n // The instance this delivery came from, copied from the compiled rule and never read off the\n // payload (gitea-integration.md §3). The turn-time fence: a delivery whose host disagrees with\n // the session's spec-carried host is refused, never re-targeted. Absent means gitea.com.\n host: z.string().optional(),\n target: GiteaHookTarget,\n // The comment delivery's own id — Gitea's counterpart of `issueCommentId`, and the exact\n // acknowledgement-reaction target. Absent means the subject itself fired this delivery.\n commentId: HookBigIntString.optional()\n});\n/** Every member a frame carries, in provider order — a well-formed frame carries at most one; a new provider adds its arm here. */\nfunction codeHostHookMembers(frame) {\n const members = [];\n if (frame.github) {\n const { repoId: externalId, repoFullName: path } = frame.github;\n members.push({ provider: 'github', repo: { provider: 'github', externalId, path }, metadata: frame.github });\n }\n if (frame.gitlab) {\n const { projectId: externalId, projectPath: path } = frame.gitlab;\n members.push({ provider: 'gitlab', repo: { provider: 'gitlab', externalId, path }, metadata: frame.gitlab });\n }\n if (frame.gitea) {\n const { repoId: externalId, repoPath: path } = frame.gitea;\n members.push({ provider: 'gitea', repo: { provider: 'gitea', externalId, path }, metadata: frame.gitea });\n }\n return members;\n}\n/** The one provider member a frame carries; undefined for none or (malformed) several, so a consumer fails closed on both. */\nexport function codeHostHookMetadataOf(frame) {\n const members = codeHostHookMembers(frame);\n return members.length === 1 ? members[0] : undefined;\n}\n/** The pull/merge-request revision a trusted member carries; undefined for an issue, a push, or a head-less subject. */\nexport function codeHostHookRevisionOf(member) {\n let headSha;\n let baseSha;\n if (member.provider === 'github') {\n if (member.metadata.subjectKind !== 'pull_request')\n return undefined;\n ({ headSha, baseSha } = member.metadata);\n }\n else if (member.provider === 'gitlab') {\n if (member.metadata.target.kind !== 'merge_request')\n return undefined;\n ({ headSha, baseSha } = member.metadata.target);\n }\n else {\n if (member.metadata.target.kind !== 'pull')\n return undefined;\n ({ headSha, baseSha } = member.metadata.target);\n }\n return headSha ? { headSha, ...(baseSha ? { baseSha } : {}) } : undefined;\n}\n/** A frame's provider members copied forward as they are, for a frame that forwards trusted metadata rather than reading it. */\nexport function pickCodeHostHookMembers(frame) {\n return {\n ...(frame.github ? { github: frame.github } : {}),\n ...(frame.gitlab ? { gitlab: frame.gitlab } : {}),\n ...(frame.gitea ? { gitea: frame.gitea } : {})\n };\n}\nexport const HookReviewEvent = z.enum(['COMMENT', 'REQUEST_CHANGES', 'APPROVE']);\nexport const HookReviewVerdict = z.enum(['pass', 'fail', 'neutral']);\n/** Short machine code only; raw GitHub/runtime exception text never crosses to reporting. */\nconst HookReviewResultCode = z\n .string()\n .min(1)\n .max(100)\n .regex(/^[a-z0-9_:-]+$/);\n/**\n * Body-free outcome of one reserved formal-review attempt.\n *\n * `not_submitted` is only legal after a deterministic no-effect failure and\n * lets the CP release the reservation. An uncertain POST remains `ambiguous`\n * until marker reconciliation proves whether GitHub created it.\n */\nexport const HookReviewResult = z.discriminatedUnion('state', [\n z.object({\n state: z.literal('submitted'),\n reviewId: z.string().min(1),\n event: HookReviewEvent,\n verdict: HookReviewVerdict,\n commitId: z.string().min(1)\n }),\n z.object({ state: z.literal('not_submitted'), code: HookReviewResultCode }),\n z.object({ state: z.literal('ambiguous'), code: HookReviewResultCode })\n]);\n/** Body-free identity of the daemon's one fallback GitHub comment. */\nexport const GithubPublishedComment = z.object({\n kind: z.enum(['issue_comment', 'review_comment']),\n commentId: HookBigIntString\n});\n/** Provider-neutral counterpart of GithubPublishedComment: the one published output's\n * identity (e.g. a GitLab note id). `kind` is provider vocabulary, open by design. */\nexport const PublishedHookOutput = z.object({\n provider: CodeHostProviderString,\n kind: z.string().min(1), // e.g. 'note'\n externalId: CodeHostExternalId\n});\n/**\n * Hook (inbound-webhook trigger) frames — webhook-triggers-and-github-events.md.\n *\n * A hook maps an inbound webhook delivery to ONE AGENT turn. The CP owns the\n * definition (`HookDef`) and compiles it into relay-side rules\n * (`rc/hook-assign`, frames/relay-cp.ts); the relay pool is the public ingress\n * that verifies + matches + dispatches the trigger to the target daemon as an\n * `rd/msg` `hook` member (frames/relay-daemon.ts). Event payloads never touch\n * the CP. R1/R2a add only metadata barriers and action-result control frames;\n * the model-visible body remains relay↔daemon.\n */\n/**\n * The trimmed event envelope a fire carries — bounded excerpts only; the full\n * payload lives in relay/daemon memory for the duration of the dispatch and the\n * agent pulls source-of-truth content itself (gh / API) when it needs more.\n * The whole frame rides under the 256 KiB frame cap; these excerpt caps are far\n * below it. Trust differs by kind (design security boundary 1): a webhook `body` IS the\n * caller's message (the URL is a capability credential), while github excerpts\n * (P2) are untrusted third-party content the daemon fences in the prompt.\n */\nexport const HookContext = z.object({\n source: z.enum(HOOK_KINDS),\n // ── github (P2) ──\n event: z.string().optional(), // 'issues' | 'pull_request' | 'issue_comment' | 'deployment' | 'deployment_status' | 'release'\n action: z.string().optional(), // 'opened' | 'synchronize' | 'created' | … (a deployment_status carries its state here)\n repo: z.string().optional(), // 'owner/repo'\n number: z.number().int().optional(), // issue/PR number\n title: z.string().optional(),\n senderLogin: z.string().optional(),\n senderAvatarUrl: z.string().url().optional(),\n authorAssociation: z.string().optional(),\n labels: z.array(z.string()).optional(),\n htmlUrl: z.string().optional(),\n bodyExcerpt: z.string().optional(), // ≤4 KiB\n // The issue/PR itself; its description keeps both ends within 8 KiB (code-host-decisions.md §5).\n subject: z\n .object({\n authorLogin: z.string().optional(),\n authorType: z.string().optional(),\n authorAssociation: z.string().optional(),\n state: z.string().optional(),\n draft: z.boolean().optional(),\n body: z.string().optional(),\n bodyTruncated: z.boolean().optional()\n })\n .optional(),\n // ── github deployment (no thread: the environment is the subject) ──\n environment: z.string().optional(), // 'production'\n ref: z.string().optional(), // the deployed ref, as GitHub names it\n sha: z.string().optional(), // the deployed commit\n // ── code-host release (no thread: every release of the repository continues one session) ──\n release: z\n .object({\n tag: z.string(), // 'v1.2.0'\n target: z.string().optional(), // the branch or commit the tag was cut from\n prerelease: z.boolean().optional(),\n draft: z.boolean().optional()\n })\n .optional(),\n // ── webhook ──\n body: z.string().optional(), // raw body, truncated to ≤64 KiB\n truncated: z.boolean().optional()\n});\n/** Normalized quota failure; the unfinished review Check remains non-passing. */\nexport const HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED = 'provider_quota_exhausted';\n/** Normalized provider sign-in failure; the unfinished review Check remains non-passing. */\nexport const HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED = 'provider_auth_required';\n/** Normalized infrastructure interruption: the daemon stopped serving the agent mid-turn (a duty\n * handover, or a self-fence on an unrenewed lease). Distinct from a user stop because nothing was\n * judged and the same work can simply be run again. */\nexport const HOOK_REPORT_REASON_AGENT_HANDOVER = 'agent_handover';\n/** The delivery's session is bound to another source, so its turn was refused before it ran. */\nexport const HOOK_REPORT_REASON_SESSION_SOURCE_MISMATCH = 'session_source_mismatch';\n/** A `notice` delivery posted its fixed text; the run row records a post, not a model turn. */\nexport const HOOK_REPORT_REASON_NOTICE_POSTED = 'notice_posted';\n/** A `notice` delivery found its thread already carried one — a thread is told once. */\nexport const HOOK_REPORT_REASON_NOTICE_ALREADY_POSTED = 'notice_already_posted';\n/**\n * `hook/report` (D→C REQ → generic `ack`) — the dispatched turn ended; closes\n * the `HookRun` row the relay's `rc/run-report` opened. Same discipline as\n * `cron/report`: scoped (the agent must be placed on the reporting daemon),\n * latest-wins, lost reports harvested by the HookRunReaper (late arrivals may\n * still overwrite `orphaned`). The daemon retains a metadata-only outbox entry\n * until ACK. Keyed by `(hookId, deliveryKey)`.\n */\nexport const HookReport = z\n .object({\n hookId: z.string().uuid(),\n agentId: z.string().uuid(), // the owning agent — scopes the report to its daemon\n deliveryKey: z.string().min(1),\n // Rolling-compatible copy of the exact accepted dispatch tuple. Every field\n // is optional on the delivery frame, but review/report consumers require the\n // complete HookConfigSnapshot before taking an effect.\n ...OptionalHookConfigSnapshot.shape,\n event: z.string().min(1).optional(), // 'pull_request:synchronize', etc.\n github: GithubHookMetadata.optional(),\n gitlab: GitlabHookMetadata.optional(),\n gitea: GiteaHookMetadata.optional(),\n status: z.enum(['success', 'failed']),\n durationMs: z.number().int().nonnegative().optional(), // dispatch → turn end\n sessionId: z.string().optional(), // the session the run prompted, by its outward id (§1.1)\n reason: z.string().optional(), // short failure text (status \"failed\")\n // A submitted result is repeated here as recovery if the immediate\n // github/review-result request was lost. No review/comment body crosses CP.\n reviewAttemptId: z.string().uuid().optional(),\n reviewResult: HookReviewResult.optional(),\n // Exact public fallback location. The comment body remains daemon-owned.\n publishedComment: GithubPublishedComment.optional(),\n // Provider-neutral counterpart (one of the two, never both).\n publishedOutput: PublishedHookOutput.optional()\n})\n .superRefine((report, ctx) => {\n if ((report.reviewAttemptId === undefined) !== (report.reviewResult === undefined)) {\n ctx.addIssue({\n code: 'custom',\n path: report.reviewAttemptId === undefined ? ['reviewAttemptId'] : ['reviewResult'],\n message: 'reviewAttemptId and reviewResult must be reported together'\n });\n }\n // An inline thread reply is not the top-level fallback: a verdict amendment may ride beside it.\n if ((report.publishedComment?.kind === 'issue_comment' || report.publishedOutput) &&\n report.reviewResult?.state === 'submitted') {\n ctx.addIssue({\n code: 'custom',\n path: [report.publishedComment ? 'publishedComment' : 'publishedOutput'],\n message: 'a submitted formal review and fallback comment are mutually exclusive'\n });\n }\n if (report.publishedComment && report.publishedOutput) {\n ctx.addIssue({\n code: 'custom',\n path: ['publishedOutput'],\n message: 'publishedComment and publishedOutput are mutually exclusive'\n });\n }\n const members = codeHostHookMembers(report);\n if (members.length > 1) {\n ctx.addIssue({\n code: 'custom',\n path: [members[1].provider],\n message: 'provider metadata members are mutually exclusive'\n });\n }\n});\n/** The daemon has begun preparing an accepted GitHub review, before a session exists. */\nexport const HookPreparing = z.object({\n hookId: z.string().uuid(),\n agentId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n ...HookConfigSnapshot.shape\n});\nexport const HookPreparingOk = z.object({ accepted: z.literal(true) });\n/** Why a formal review lost its exact checkout; a fixed enum so it can label a metric. */\nexport const ReviewCheckoutDegradedReason = z.enum([\n 'no_review_root',\n 'fetch_timeout',\n 'sandbox_conflict',\n 'authority_draining',\n 'credential_unavailable',\n 'revision_mismatch',\n 'other'\n]);\n/** How a formal review's workspace was prepared: the exact verified checkout, or revision-only for a reason. */\nexport const ReviewCheckout = z.discriminatedUnion('outcome', [\n z.object({ outcome: z.literal('exact') }),\n z.object({ outcome: z.literal('degraded'), reason: ReviewCheckoutDegradedReason })\n]);\n/**\n * `hook/start` (D→C REQ) — metadata barrier immediately before an accepted\n * GitHub hook enters the model prompt. A successful reply means the CP durably\n * attached the authoritative revision to the accepted HookRun and, for R2a,\n * advanced its informational projection to in_progress.\n */\nexport const HookStart = z\n .object({\n hookId: z.string().uuid(),\n agentId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n sessionId: z.string().min(1).optional(), // the turn's session by its outward id (§1.1); rolling-compatible\n event: z.string().min(1).optional(),\n // Provider one-of: exactly one member carries the trusted subject metadata.\n // `github` was required pre-GitLab, so every existing sender stays valid.\n github: GithubHookMetadata.optional(),\n gitlab: GitlabHookMetadata.optional(),\n gitea: GiteaHookMetadata.optional(),\n reviewCheckout: ReviewCheckout.optional(), // only on a turn that prepared a formal review's workspace\n ...HookConfigSnapshot.shape\n})\n .superRefine((start, ctx) => {\n if (codeHostHookMembers(start).length !== 1) {\n ctx.addIssue({\n code: 'custom',\n path: ['github'],\n message: 'exactly one provider metadata member is required'\n });\n }\n});\n/** The sealed verdict a conversation turn may amend: this hook's latest on the turn's own revision. */\nexport const HookReviewAmendment = z.object({\n reportSha: z.string().min(1),\n event: HookReviewEvent,\n verdict: HookReviewVerdict\n});\n// `amendment` names the one formal-review authority a `review_action_only` turn can hold; an older CP omits it.\nexport const HookStartOk = z.object({ accepted: z.literal(true), amendment: HookReviewAmendment.optional() });\n/** D→C action-time authorization for one formal GitHub review attempt. */\nexport const GithubReviewAuthorize = z.object({\n hookId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n attemptId: z.string().uuid(),\n requestedEvent: HookReviewEvent,\n requestedVerdict: HookReviewVerdict,\n snapshot: HookConfigSnapshot\n});\n/** Trusted target echoed with a broker-only purpose token. Secret: never log. */\nexport const GithubReviewAuthorized = z.object({\n attemptId: z.string().uuid(),\n token: z.string().min(1),\n ttlSec: z.number().int().positive(),\n expiresAt: z.string().datetime(),\n repoId: HookBigIntString,\n repoFullName: z.string().min(1),\n pullNumber: z.number().int().positive(),\n expectedHeadSha: z.string().min(1),\n expectedBaseSha: z.string().min(1)\n});\n/**\n * Immediate metadata-only convergence after the daemon's GitHub review POST.\n * Submitted metadata is also repeated on HookReport for lost-REP recovery.\n */\nexport const GithubReviewResultReport = z.object({\n hookId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n attemptId: z.string().uuid(),\n snapshot: HookConfigSnapshot,\n result: HookReviewResult\n});\nexport const GithubReviewResultOk = z.object({ accepted: z.literal(true) });\n//# sourceMappingURL=hook.js.map","// ⚠️ NO RELATIVE IMPORTS — a bundler compiles this from source; web's protocol-imports.leaf.test.ts enforces it.\nimport { z } from 'zod';\nexport const INTEGRATION_SETUP_URI = 'ui://agentconnect/integration-setup';\nexport const IntegrationSetupIntent = z.discriminatedUnion('mode', [\n z\n .object({\n mode: z.literal('create'),\n provider: z.string().min(1).max(64).optional(),\n agentId: z.string().uuid().optional()\n })\n .strict(),\n z\n .object({\n mode: z.literal('edit'),\n agentId: z.string().uuid(),\n target: z.object({ kind: z.enum(['integration', 'codehost-subscription']), id: z.string().uuid() }).strict()\n })\n .strict()\n]);\nexport const CODE_HOST_SETUP_URI = 'ui://agentconnect/code-host-setup';\n// Redeclared rather than imported from `./code-host`: this module is a leaf (see the banner).\nexport const CODE_HOST_SETUP_PROVIDERS = ['github', 'gitlab', 'gitea'];\n// Which card the connection surface opens on; omitted means the whole surface, as the Console page shows it.\nexport const CodeHostSetupIntent = z.object({ provider: z.enum(CODE_HOST_SETUP_PROVIDERS).optional() }).strict();\nexport const AGENT_SETUP_URI = 'ui://agentconnect/agent-setup';\n// The groups of the Console agent editor; omitted opens on its first one.\nexport const AGENT_SETUP_SECTIONS = ['basics', 'runtime', 'access', 'secrets'];\n// What a delegated `createAgent` PROPOSES: the arguments it collected, carried to the Console create\n// dialog prefilled instead of written, so the human submits the agent under their own Console JWT.\n// Bounds mirror the tool's own — the card's byte budget is what caps a drafted string.\nexport const AgentSetupDraft = z\n .object({\n name: z.string().min(1).max(63),\n displayName: z.string().min(1).optional(),\n description: z.string().optional(),\n runtime: z.string().min(1).optional(),\n model: z.string().min(1).optional(),\n reasoningEffort: z.string().min(1).optional(),\n outputMode: z.enum(['none', 'minimal', 'low', 'medium', 'high']).optional(),\n fastMode: z.boolean().optional(),\n permissionMode: z.string().min(1).optional(),\n placementKind: z.enum(['daemon', 'pool', 'set']).optional(),\n setId: z.string().uuid().optional(),\n daemonId: z.string().min(1).optional(),\n workspace: z\n .object({\n mode: z.enum(['scratch', 'git']),\n gitRepo: z.string().min(1).optional(),\n gitBranch: z.string().min(1).optional(),\n agentDir: z.string().min(1).optional(),\n worktree: z.boolean().optional(),\n access: z.enum(['read', 'write']).optional()\n })\n .strict()\n .optional()\n})\n .strict();\nexport const AgentSetupIntent = z\n .object({\n agentId: z.string().uuid().optional(),\n section: z.enum(AGENT_SETUP_SECTIONS).optional(),\n // Set by a direct `createAgent`, whose card is the new agent's own next step rather than an edit of an old one.\n created: z.boolean().optional(),\n // Set by a delegated `createAgent`: no agent exists yet, and the dialog opens prefilled on this proposal.\n draft: AgentSetupDraft.optional()\n})\n .strict()\n // An editor needs its subject and a create dialog has none — one intent is never both.\n .refine((intent) => (intent.agentId === undefined) !== (intent.draft === undefined), {\n message: 'exactly one of agentId or draft'\n});\nexport const SKILL_SETUP_URI = 'ui://agentconnect/skill-setup';\n// `registry` searches skills.sh by name; `git` imports a repository. Omitted takes the registry.\nexport const SKILL_SETUP_SOURCES = ['registry', 'git'];\nexport const SkillSetupIntent = z\n .object({\n source: z.enum(SKILL_SETUP_SOURCES).optional(),\n query: z.string().min(1).max(200).optional(),\n agentId: z.string().uuid().optional()\n})\n .strict();\nexport const MCP_SETUP_URI = 'ui://agentconnect/mcp-setup';\n// A server's url, headers and OAuth credential are typed in the dialog, never carried in an intent.\nexport const McpSetupIntent = z.object({ agentId: z.string().uuid().optional() }).strict();\nexport const AGENT_TOOLS_URI = 'ui://agentconnect/agent-tools';\n// Which roster to show; omitted shows both, as the Console's Tools & Skills tab does.\nexport const AGENT_TOOLS_FOCUS = ['mcp', 'skills'];\nexport const AgentToolsIntent = z\n .object({ agentId: z.string().uuid(), focus: z.enum(AGENT_TOOLS_FOCUS).optional() })\n .strict();\nconst nativeApp = (uri, intent) => z\n .object({\n resourceUri: z.literal(uri),\n resourceVersion: z.literal(1),\n orgId: z.string().min(1).max(200),\n intent\n})\n .strict();\n// A bounded presentation request; Console JWT authorization governs every form read and write.\nexport const NativeMcpUi = z.discriminatedUnion('resourceUri', [\n nativeApp(INTEGRATION_SETUP_URI, IntegrationSetupIntent),\n nativeApp(CODE_HOST_SETUP_URI, CodeHostSetupIntent),\n nativeApp(AGENT_SETUP_URI, AgentSetupIntent),\n nativeApp(SKILL_SETUP_URI, SkillSetupIntent),\n nativeApp(MCP_SETUP_URI, McpSetupIntent),\n nativeApp(AGENT_TOOLS_URI, AgentToolsIntent)\n]);\n// A write tool's own answer stays its answer; the card it earns rides alongside it under this key.\nexport const NativeUiEnvelope = z.object({ nativeUi: NativeMcpUi }).loose();\n/** The heading one intent earns, decided by the resource — the daemon's card chrome and the Console card must not word it differently. */\nexport function nativeUiTitle(ui) {\n switch (ui.resourceUri) {\n case CODE_HOST_SETUP_URI:\n return 'Code host connections';\n case AGENT_SETUP_URI:\n return ui.intent.draft ? 'Create agent' : ui.intent.created ? 'Agent created' : 'Edit agent';\n case SKILL_SETUP_URI:\n return 'Install skill';\n case MCP_SETUP_URI:\n return 'Add MCP server';\n case AGENT_TOOLS_URI:\n return ui.intent.focus === 'skills' ? 'Skills' : ui.intent.focus === 'mcp' ? 'MCP servers' : 'Tools & skills';\n default:\n return ui.intent.mode === 'edit' ? 'Edit integration' : 'Add integration';\n }\n}\n// Sent as `protocolVersion` in the `ui/initialize` result; the official SDK's `App.connect()` rejects a result without it (SEP-1865 Final).\nexport const MCP_APPS_PROTOCOL_VERSION = '2026-01-26';\n// The most text one `ui/message` may carry into the conversation; matches the wire field's bound so a decoded list is clamped before it is refused.\nexport const MCP_APP_MESSAGE_MAX_CHARS = 4000;\n// The most model context one app may hold via `ui/update-model-context`; a note for the next turn carried on the session, not a store.\nexport const MCP_APP_CONTEXT_MAX_CHARS = 4000;\n//# sourceMappingURL=mcp-app.js.map","import { z } from 'zod';\nimport { MCP_APP_CONTEXT_MAX_CHARS, NativeMcpUi } from '../mcp-app.js';\n// The MCP Apps constants live in the `./mcp-app` leaf so the console can value-import them; the barrel still re-exports them.\nexport * from '../mcp-app.js';\n// webchat's content plane is the RELAY, not the daemon↔CP control WS:\n// a browser dials the relay pool with a CP-minted token and the relay bridges the\n// conversation onto the target daemon's rd/* socket. These payloads describe the reply\n// stream + the turn verdict; the relay's `rd/chat` / `rd/ack` frames REUSE them verbatim\n// (packages/protocol/src/frames/relay-daemon.ts). Live content never touches the CP;\n// an authorized session-history read may later proxy a daemon-local image for display.\n// The browser rasterizes/compresses one selected image below this cap. It fits the\n// relay ingress frame and, later, one daemon→CP history frame with base64 expansion.\nexport const WEBCHAT_IMAGE_MAX_BYTES = 160 * 1024;\nexport const WEBCHAT_IMAGE_MAX_BASE64_CHARS = Math.ceil(WEBCHAT_IMAGE_MAX_BYTES / 3) * 4;\nconst CANONICAL_BASE64 = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nfunction decodedBase64Bytes(value) {\n const padding = value.endsWith('==') ? 2 : value.endsWith('=') ? 1 : 0;\n return (value.length / 4) * 3 - padding;\n}\nexport const WebchatImageAttachment = z.object({\n name: z\n .string()\n .trim()\n .min(1)\n .max(255)\n .regex(/^[^\\u0000-\\u001f\\u007f]+$/, 'webchat image name must not contain control characters'),\n mimeType: z.enum(['image/png', 'image/jpeg', 'image/webp']),\n data: z\n .string()\n .min(4)\n .max(WEBCHAT_IMAGE_MAX_BASE64_CHARS)\n .refine((value) => CANONICAL_BASE64.test(value) && decodedBase64Bytes(value) <= WEBCHAT_IMAGE_MAX_BYTES, {\n message: `webchat image must be canonical base64 encoding at most ${WEBCHAT_IMAGE_MAX_BYTES} bytes`\n })\n});\n// ── Shared images (webchat-generated-images.md) ─────────────────────────────\n/** Daemon, relay and console support shared-image cards: the `image` event, post/transcript images and `image_update`. */\nexport const WEBCHAT_IMAGES_FEATURE = 'webchat-images-v1';\n/** Decoded-byte cap of one shared-image preview; the same transport limit inbound images use. */\nexport const SHARED_IMAGE_PREVIEW_MAX_BYTES = WEBCHAT_IMAGE_MAX_BYTES;\n/** Bound on the caption-plus-provenance text a shared image carries. */\nexport const SHARED_IMAGE_TEXT_MAX_CHARS = 6000;\n/** Outbound preview: unlike {@link WebchatImageAttachment} it admits SVG, so inbound uploads do not widen with it. */\nexport const SharedImagePreview = WebchatImageAttachment.extend({\n mimeType: z.enum(['image/png', 'image/jpeg', 'image/webp', 'image/svg+xml']),\n width: z.number().int().positive().max(65_535).optional(),\n height: z.number().int().positive().max(65_535).optional()\n});\n/** Delivery state of a cache-backed original; `unavailable` is a read-time fallback for a pending upload with no live task. */\nexport const SharedImageOriginalStatus = z.enum(['pending', 'ready', 'upload_failed', 'expired', 'unavailable']);\n/** Where the full-resolution original lives; never a URL — signed GETs are transient and travel beside it. */\nexport const SharedImageOriginal = z.discriminatedUnion('kind', [\n // The preview IS the complete original.\n z.object({ kind: z.literal('inline') }),\n z.object({\n kind: z.literal('cache'),\n attachmentId: z.string().uuid(),\n // The original's file name for Download; sniffed extension, no path.\n name: z\n .string()\n .trim()\n .min(1)\n .max(255)\n .regex(/^[^\\u0000-\\u001f\\u007f/\\\\]+$/)\n .optional(),\n mimeType: z.string().max(255),\n bytes: z.number().int().positive(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/),\n status: SharedImageOriginalStatus\n }),\n // No transfer cache: the share marker's path and digest drive the authenticated workspace download.\n z.object({ kind: z.literal('workspace') })\n]);\n/** A temporary signed GET for a cached original; never persisted. */\nexport const SharedImageDownload = z.object({\n url: z.string().url().max(4096),\n expiresAt: z.string().datetime()\n});\n/** The image half of a shared-image post, as every copy and transcript row carries it. */\nexport const SharedImage = z.object({\n attachment: SharedImagePreview,\n original: SharedImageOriginal,\n // Monotonic per post; readers ignore an update older than what they hold.\n revision: z.number().int().min(0)\n});\n/** One original-state change of an already published image, delivered outside any turn stream. */\nexport const WebchatImageUpdate = z.object({\n conversationId: z.string().uuid(),\n agentId: z.string().uuid(),\n postId: z.string().uuid(),\n revision: z.number().int().min(1),\n original: SharedImageOriginal,\n download: SharedImageDownload.optional()\n});\n// The webchat turn verdict — `dispatchWebchatTurn` returns this and the relay path folds\n// it into `rd/ack` (accepted + the turnId that correlates the reply stream; `reason`\n// explains a rejection). Not a wire frame of its own anymore.\n// `agentId` attributes the verdict in a multi-agent conversation: a multi-target turn\n// produces one ack per targeted agent. Absent ⇒ the conversation's sole agent.\nexport const WebchatAck = z.object({\n accepted: z.boolean(),\n turnId: z.string().uuid(), // correlates the streamed output to this turn\n agentId: z.string().uuid().optional(),\n // The last three are session-continuation refusals\n // (webchat-cross-integration-continuation.md §5.2/§6.4).\n reason: z\n .enum([\n 'queued',\n 'no_agent',\n 'busy',\n 'paused',\n 'draining',\n 'not_participant',\n 'not_found',\n 'integration_offline',\n 'integration_delivery_failed',\n // The daemon owns this agent but its runtime would not start — distinct from `no_agent`,\n // which says no daemon serves it at all. Only this one carries `detail`.\n 'start_failed',\n // The API turn's Decision gate answered no (shared-bot-relay.md §10.4).\n 'declined'\n ])\n .optional(),\n // One bounded, path-free line naming the fault, so the client can state the cause instead of\n // guessing at it. The daemon redacts it; nothing here reveals its filesystem layout.\n detail: z.string().max(240).optional(),\n // The turn was delivered INTO the running turn over `_session/steering` (#1847); its own\n // stream ends at once with `stopReason: 'steered_into_turn'` and the live reply continues.\n steered: z.boolean().optional()\n});\n// One canonical conversation post — the unit every participant daemon records and\n// the browser merges by `(at, postId)`. Identity (`postId`, `at`) is minted exactly\n// ONCE at the origin (the relay for a user turn, the owning daemon for an agent\n// reply) and carried on every frame that transports the post, so all copies agree\n// on ordering and the shared transcript dedupes across co-hosted participants.\nexport const WebchatPost = z.object({\n postId: z.string().uuid(),\n conversationId: z.string().uuid(),\n author: z.discriminatedUnion('kind', [\n // `userId` is the stable CP principal and is what a recipient records as the\n // transcript sender; `user` is the mutable display handle for the author line.\n z.object({ kind: z.literal('user'), user: z.string().optional(), userId: z.string().optional() }),\n z.object({\n kind: z.literal('agent'),\n agentId: z.string().uuid(),\n // The authoring TURN's depth in the agent-call chain (send-message-routing-\n // rework.md §4.1), stamped by the origin daemon at the commit boundary. A\n // receiving participant's daemon charges ONE +1 transition on it — against the\n // same MAX_AGENT_CALL_HOPS budget an internal agent call spends — before the\n // post may continue the conversation as an activation (webchat-multi-agents.md\n // §5.2a, the #549 parity). Absent (a pre-parity daemon), the post stays\n // transcript-only: a missing depth must never coerce to zero.\n hopCount: z.number().int().min(0).optional(),\n // The participants the human narrowed this exchange to (§5.2a); a peer outside it wakes only when the post @-names it.\n addressedAgentIds: z.array(z.string().uuid()).max(16).optional()\n })\n ]),\n text: z.string(),\n at: z.number().int(), // canonical epoch-ms timestamp, minted once at origin\n attachments: z.array(WebchatImageAttachment).max(1).optional(),\n // A shared image the agent published; peers keep it as transcript only, never as model input.\n image: SharedImage.optional()\n});\n// One structured chunk of the agent's reply stream. Ordered per-connection (TCP);\n// 'index' is a per-turn monotonic counter for client-side assembly (NOT a global fence).\n/**\n * One entry of an agent's task list, as ACP `plan` sends it. Defined HERE rather than\n * beside `PlanBody` in session.ts because both the live stream and the persisted row carry\n * it and session.ts already imports this module — the other direction would be a cycle.\n */\nexport const PlanEntry = z.object({\n content: z.string(),\n status: z.string(), // ACP PlanEntryStatus: pending|in_progress|completed\n priority: z.string().optional() // ACP PlanEntryPriority: high|medium|low\n});\n/** The most fields one elicitation card renders. A card is a question standing in a\n * transcript, not a settings page: past ten controls the reader cannot take the ask in, and\n * the daemon must hold and re-validate every field of the record that answers it. A longer\n * form is declined, which is honest — the agent can ask again in smaller pieces. */\nexport const ELICIT_FORM_FIELD_CAP = 10;\n/** The most FIELDS one card's wire payload carries. The cap above counts QUESTIONS, and an\n * AskUserQuestion bridge gives every question its own free-text companion (`customAnswerFor`),\n * so a form at the cap arrives as twice that many properties — and answers with them too. */\nexport const ELICIT_FORM_WIRE_FIELD_CAP = ELICIT_FORM_FIELD_CAP * 2;\n/** The per-kind field descriptors of an elicitation card. Shared by the single-field card and\n * by each entry of a multi-field form, so the two can never describe one field differently. */\nconst ElicitOptions = z.array(z.object({ value: z.string(), label: z.string() }));\nconst ElicitMulti = z.object({\n minItems: z.number().int().min(0).optional(),\n maxItems: z.number().int().min(0).optional()\n});\nconst ElicitText = z.object({\n minLength: z.number().int().min(0).optional(),\n maxLength: z.number().int().min(0).optional(),\n pattern: z.string().max(200).optional(),\n format: z.enum(['email', 'uri', 'date', 'date-time']).optional()\n});\nconst ElicitNumber = z.object({\n integer: z.boolean().optional(),\n minimum: z.number().optional(),\n maximum: z.number().optional()\n});\nconst ElicitDefault = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]);\n/** One field of a multi-field form card: the descriptors above plus what only a form needs —\n * the schema key the answer is returned under, a label to render it beside, its kind (a\n * boolean's two options are indistinguishable from an enum's otherwise), and whether the\n * schema requires it, since an optional field may be left out of the answer entirely. */\nexport const ElicitField = z.object({\n propName: z.string().min(1).max(200),\n label: z.string(),\n kind: z.enum(['enum', 'boolean', 'multi-enum', 'text', 'number']),\n required: z.boolean().optional(),\n /** The schema's own `description` — the question text, where the title is only its header. */\n description: z.string().max(300).optional(),\n /** Set on a select question's free-text companion: the property whose question this box types\n * an answer for. The card renders it INSIDE that question rather than as a question of its\n * own, and never numbers or counts it. What said so — an ACP `_askUserQuestionCustomAnswer`\n * marker, Codex's `_meta.codex.isOtherAnswer`, or, for a bridge that marks nothing, the pair's\n * own property names — is the daemon's to read: the raw schema never crosses this wire, so a\n * reader has only this field. */\n customAnswerFor: z.string().min(1).max(200).optional(),\n options: ElicitOptions,\n multi: ElicitMulti.optional(),\n text: ElicitText.optional(),\n number: ElicitNumber.optional(),\n defaultValue: ElicitDefault.optional()\n});\n/** ONE elicitation card, as the daemon reduced it. Both the live event below and the\n * transcript row that persists the card (`ElicitBody`) are this shape, so a reader who\n * loads the conversation later is shown the very card the reader in the moment answered.\n *\n * The agent asked for a choice (ACP `elicitation/create`, form or url mode) — webchat's own\n * in-band card, the peer of the Slack Block Kit one. Deliberately NOT the raw\n * `requestedSchema`: the daemon has already reduced the form to its renderable field(s), and\n * its options are the only answers the browser may send back (as the `elicitation_choice` op\n * keyed by this `requestId`). `message` is agent-authored text, masked before it reaches here.\n * Options are UNCAPPED — the Slack button cap is a Slack surface limit and does not follow the\n * choice onto this surface. They are also EMPTY for a typed field (`text`/`number`), whose\n * card offers nothing to pick. */\nexport const ElicitCard = z.object({\n requestId: z.string().min(1).max(200),\n message: z.string(),\n options: ElicitOptions,\n // Absent ⇒ pick exactly ONE option, the original card. Present ⇒ pick several of the same\n // options and confirm, and the answer is a list. An added OPTIONAL field rather than a new\n // event kind on purpose: a relay or browser predating it decodes the event unchanged\n // (zod strips what it does not know) instead of dropping the frame the way an unknown\n // kind would, and a daemon predating it simply never sets it.\n multi: ElicitMulti.optional(),\n // Present ⇒ the card is a free-text input carrying the schema's own constraints, which the\n // daemon re-checks on the way back in. Same optional-field reasoning as `multi`, with one\n // added skew note: an old reader keeps `options` (now empty) and shows a card with nothing\n // but Dismiss — unanswerable, never wrongly answered. `pattern` reaches here only once the\n // daemon has cleared it as safe to run.\n text: ElicitText.optional(),\n // Present ⇒ a numeric input; `integer` is the schema's `integer` type, not just a bound.\n number: ElicitNumber.optional(),\n // The schema's `default`, already checked against the constraints above: the card\n // pre-populates its control with it (MCP `2025-11-25`), and the reader may answer otherwise.\n defaultValue: ElicitDefault.optional(),\n // Present ⇒ the card is a multi-field FORM: one control per field, one submit, and the\n // answer is a record of value-per-field. The single-field descriptors above are then all\n // absent — deliberately, and the same closed-failure trade `text` records: an old reader\n // sees an optionless card it can only Dismiss, rather than a card it could half-fill with\n // one field's answer that the daemon would then refuse.\n fields: z.array(ElicitField).min(2).max(ELICIT_FORM_WIRE_FIELD_CAP).optional(),\n // Present ⇒ the card is a URL-mode CONSENT card (ACP `ElicitationUrlMode`): the reader is\n // shown this exact URL and opens it in their own browser, and nothing about the page ever\n // returns here. `options` is then empty and every field descriptor above is absent, so the\n // same closed skew `text` records holds — an old reader sees a card it can only Dismiss,\n // which the daemon reads as the spec's `decline`, never as consent. Only http/https reach\n // here; the daemon declines any other scheme rather than hand a browser an unopenable href.\n url: z.string().min(1).max(2048).optional()\n});\n/**\n * The most HTML one MCP App template may carry.\n *\n * A real bound on a real document, not a transport artifact. The transport is handled separately:\n * a template does NOT ride the card event as one blob past {@link MCP_APP_INLINE_TEMPLATE_MAX_BYTES},\n * because the `rd/chat` frame it would ride is capped at {@link MAX_FRAME_BYTES} (256 KiB) and a\n * genuine app — one that inlines the official SDK — is comfortably past that on its own. Templates\n * therefore arrive as ordered `app_template` chunks and are reassembled by the browser, which is\n * why this cap can describe what a page may reasonably be instead of what one frame happens to hold.\n *\n * A larger template is DECLINED with a notice rather than truncated — half a document renders as a\n * broken page, which is the one outcome worse than saying the interface could not be shown.\n */\nexport const MCP_APP_HTML_MAX_BYTES = 1024 * 1024;\n/**\n * How much template one `app_template` chunk carries, in characters.\n *\n * Chosen against the frame rather than for tidiness: {@link MAX_FRAME_BYTES} is 256 KiB, and JSON\n * escaping can roughly double quote-dense HTML on the way in, so 48 KiB of template stays under\n * the cap even at that worst case with the envelope on top.\n */\nexport const MCP_APP_TEMPLATE_CHUNK_CHARS = 48 * 1024;\n/** Under this, a template simply rides the card's own frame and no chunks are sent. Set well below\n * {@link MCP_APP_CARD_MAX_BYTES} so the card still fits once its result and metadata are on top —\n * the decision is made against the thing that has to encode, not against the template alone. */\nexport const MCP_APP_INLINE_TEMPLATE_MAX_BYTES = 48 * 1024;\n/** The most one card's whole encoded payload may take, including the tool result it carries\n * through. Checked where the card is assembled, because the template cap alone does not bound a\n * tool that answered with a megabyte of `structuredContent` — and a card that cannot encode is a\n * frame the reader never sees, for a reason nothing in the stream would explain. */\nexport const MCP_APP_CARD_MAX_BYTES = 160 * 1024;\n/** The most live app cards one conversation holds. A fifth settles the oldest as `superseded`:\n * every live card is an armed iframe with a tool-calling bridge, and an unbounded stack of\n * them is an unbounded stack of those. */\nexport const MCP_APP_LIVE_CAP = 4;\n/** The domain allowlists an MCP App resource declared, each widening exactly its own CSP\n * directive (SEP-1865). The host builds the policy FROM this and never from the page, and may\n * restrict further but must not admit an undeclared domain — so an absent list is the\n * restrictive default, not \"anything\". */\nexport const McpAppCsp = z.object({\n /** `connect-src` — fetch / XHR / WebSocket. */\n connect: z.array(z.string().min(1).max(253)).max(32).optional(),\n /** `script-src` / `style-src` / `img-src` / `font-src` — static assets. */\n resource: z.array(z.string().min(1).max(253)).max(32).optional(),\n /** `frame-src` — nested iframes. */\n frame: z.array(z.string().min(1).max(253)).max(32).optional(),\n /** `base-uri`. */\n baseUri: z.array(z.string().min(1).max(253)).max(32).optional()\n});\n/** `containerDimensions` — what the view negotiated. An axis marked flexible is the one the\n * view may grow along by reporting `ui/notifications/size-changed`; a fixed axis is the\n * host's to decide, so the view's report on it is ignored rather than obeyed. */\nexport const McpAppDimensions = z.object({\n width: z.number().int().min(1).max(4096).optional(),\n height: z.number().int().min(1).max(4096).optional(),\n flexibleWidth: z.boolean().optional(),\n flexibleHeight: z.boolean().optional()\n});\n/**\n * ONE MCP App card, as the daemon's Apps host assembled it — the peer of {@link ElicitCard},\n * and webchat's ONLY rich-UI surface by construction (webchat-mcp-apps.md §2).\n *\n * A UI-capable MCP server predeclares an interface as a `ui://` resource and links it to a tool\n * with `_meta.ui.resourceUri`; the daemon — which is the MCP Apps host, because no ACP runtime\n * is (§3) — reads the template, calls the tool, and streams both here. The browser renders the\n * template in an OPAQUE-origin sandboxed frame and speaks MCP's own JSON-RPC to it over\n * `postMessage`, forwarding the four host methods that need the daemon back as the `app_rpc` op.\n *\n * This card is NOT an elicitation: the tool's own result returns to the model the moment the\n * call completes, so an app that is never opened, never answered, or shown on a surface with no\n * renderer never blocks the turn. What the reader does in the frame reaches the agent through\n * ordinary tool calls and `ui/message`, not through a parked resolver.\n */\nexport const McpAppCard = z.object({\n nativeUi: NativeMcpUi.optional(),\n /** The unguessable id every RPC from this view carries back — the card's identity, exactly as\n * `requestId` is an elicitation card's. A view may only reach the server that opened it, and\n * only while this id is live in its own conversation. */\n appId: z.string().min(1).max(200),\n /** The words above the frame, and the words the decline uses on a surface that has none. */\n title: z.string().max(200),\n /** The tool that opened the frame, namespaced `<server>__<tool>` as the bridge exposes it. */\n toolName: z.string().min(1).max(200),\n /**\n * The `ui://` template's own text (`text/html;profile=mcp-app`), when it is small enough to ride\n * this frame whole. ABSENT ⇒ it arrives as `app_template` chunks; {@link htmlBytes} says how much\n * to expect, and the frame is armed only once that much has been reassembled.\n *\n * Optional rather than always-chunked so a small first-party template stays one frame and one\n * code path — and so a reader that never receives its chunks renders a card that is honestly\n * unarmed rather than one that half-works.\n */\n html: z.string().min(1).max(MCP_APP_HTML_MAX_BYTES).optional(),\n /** Set when the template is chunked: the assembled length in CHARACTERS, so the browser knows\n * when it has the whole document, and can distinguish a template still arriving from one that\n * never arrived at all.\n *\n * (Worded to keep `from` away from a following quote on purpose: the daemon's\n * `scripts/assert-self-contained.mjs` scans the built bundle for import specifiers with a regex\n * that does not skip comments, so a comment placing that word directly before a quoted string\n * is read as a bare import and fails the build.) */\n htmlBytes: z.number().int().min(1).max(MCP_APP_HTML_MAX_BYTES).optional(),\n /** The call's arguments, handed to the view as `ui/notifications/tool-input`. */\n toolInput: z.record(z.string(), z.unknown()).optional(),\n /** The call's result, handed to the view as `ui/notifications/tool-result`. `structuredContent`\n * is the UI-optimized half the spec keeps out of model context; `content` is the text the\n * model already received, carried again so a view may render exactly what the agent read. */\n toolResult: z\n .object({\n content: z.array(z.unknown()).max(64).optional(),\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n isError: z.boolean().optional()\n })\n .optional(),\n csp: McpAppCsp.optional(),\n dimensions: McpAppDimensions.optional()\n});\n// Ordinary app pages may re-arm after expiry; dismissed or completed interfaces stay settled.\nexport const McpAppOutcome = z.enum(['closed', 'superseded', 'expired', 'completed']);\n/**\n * What a view may ASK THE DAEMON for — the four host methods of SEP-1865 that cannot be served\n * in the browser, reduced to a checked union rather than forwarded as raw JSON-RPC.\n *\n * The reduction is the point. Everything else the spec gives a view (`ui/initialize`, the size\n * and logging notifications, `ui/open-link`) is browser-local and never reaches a wire, so what\n * remains here is exactly the surface with an authorization question attached — and a union the\n * daemon can validate before it acts beats a passthrough it has to sanitize after. The candidate\n * set for every one of them comes from the trusted session snapshot, never from this payload:\n * `appId` names a live card in the sender's OWN conversation, and that card names the one server\n * whose tools and resources the view may reach.\n */\nexport const McpAppRpc = z.discriminatedUnion('method', [\n // `tools/call` — a real tool call on this app's own server, recorded in the transcript like any\n // other. An app cannot act invisibly.\n z.object({\n method: z.literal('tools/call'),\n name: z.string().min(1).max(200),\n args: z.record(z.string(), z.unknown()).optional()\n }),\n // `resources/read` — this app's own server only, which is what makes a bare uri safe to take.\n z.object({ method: z.literal('resources/read'), uri: z.string().min(1).max(2048) }),\n // `ui/message` — the frame speaking into the conversation. Delivered as an ORDINARY user turn\n // under the author the relay verified, never an author the page named: the roster check, the\n // busy/steer decision and the transcript then apply to it exactly as to something typed in the\n // composer. What bounds a page posting in a loop is the card's own call budget and that busy\n // gate, not a hop count — a user turn has no hop to charge.\n z.object({ method: z.literal('ui/message'), text: z.string().min(1).max(4000) }),\n // `ui/update-model-context` — what the app wants the next turn to know. Held on the session.\n z.object({ method: z.literal('ui/update-model-context'), context: z.string().max(MCP_APP_CONTEXT_MAX_CHARS) })\n]);\n/** One view RPC's answer, as the daemon hands it back for the browser to complete the view's\n * JSON-RPC call with. `ok:false` carries a message the frame may show; it is never a transport\n * failure dressed as a result — an undeliverable RPC never reaches here at all. */\nexport const McpAppRpcResult = z.union([\n z.object({ ok: z.literal(true), result: z.unknown() }),\n z.object({ ok: z.literal(false), error: z.string().max(500) })\n]);\nexport const WebchatEvent = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('message'),\n text: z.string(),\n segmentId: z.string().uuid().optional(),\n postId: z.string().uuid().optional()\n }), // from agent_message_chunk\n z.object({ kind: z.literal('thinking'), text: z.string() }), // from agent_thought_chunk\n z.object({ kind: z.literal('tool_call'), toolCallId: z.string(), title: z.string(), status: z.string() }),\n // `title` is set only when this update refines the initial `tool_call` title (e.g.\n // Codex web_search names itself generically first, then retitles with the actual\n // query once known) — mirrors the ACP field so the live view can retitle in place\n // the same way the persisted transcript already does (TranscriptRecorder.titles).\n z.object({\n kind: z.literal('tool_update'),\n toolCallId: z.string(),\n status: z.string(),\n title: z.string().optional()\n }),\n // The runtime's auto-generated session title (from ACP session_info_update). The\n // daemon persists it (session/list surfaces it on the persisted row); this streams\n // the same value so the LIVE playground session renames itself in place, matching\n // what a Slack session shows once its title lands.\n z.object({ kind: z.literal('session_info'), title: z.string() }),\n // A turn-final context refresh discarded the streamed candidate\n // (webchat-multi-agents.md §5.4): the conversation changed while the agent was\n // answering, so the browser collapses this lane's streamed text in place and\n // the replacement generation streams next under the SAME turnId. `generation`\n // is the replacement's ordinal (1 = first retry). An event rather than a\n // terminal frame: the turn still ends with exactly one `done`, so replay,\n // busy-state, and older browsers (which ignore unknown kinds) stay coherent.\n z.object({ kind: z.literal('superseded'), generation: z.number().int() }),\n // Live-only startup progress: replace this turn's wait notice; empty text clears it. Never persisted.\n // `standing` ⇒ the line is not a wait but something the reader has to keep: an ask this surface\n // could not show, or an answer it would not take (#1794). A wait notice retires the moment\n // output resumes, which would delete exactly those lines; a standing one stays put. An added\n // OPTIONAL field rather than a new kind, for the reason `elicitation.multi` records: a relay or\n // browser predating it decodes the event unchanged and merely retires the line early, where an\n // unknown kind would drop the frame and leave the silence this field exists to end.\n z.object({ kind: z.literal('notice'), text: z.string(), standing: z.boolean().optional() }),\n // The turn's task list (ACP `plan`). Unlike every other kind here it is a SNAPSHOT: ACP\n // resends the whole list on each revision, so the client keeps the latest and never\n // appends. Streamed because the same block already lands in the persisted transcript\n // (transcript-full-tool-body.md §8) — without it a live turn hides its plan until the\n // page is re-read from history, which is exactly the gap this closes.\n // COMPAT: a relay predating this kind fails that ONE frame's decode and drops the chunk.\n // Non-fatal by construction — the relay answers with an error frame and keeps the\n // connection, so every other chunk still flows and the turn degrades to showing its plan\n // only after the fact. There is no relay capability echo to gate on (`rd/hello/ok` carries\n // only `relayId`), so this is the tradeoff rather than an oversight.\n z.object({ kind: z.literal('plan'), entries: z.array(PlanEntry) }),\n ElicitCard.extend({ kind: z.literal('elicitation') }),\n // The same card, settled. Slack rewrites its message in place; this stream is\n // append-only, so the collapse is a second event keyed by the same `requestId`.\n // `label` is the chosen option's label — the chosen labels joined, for a multi-select —\n // and is present only on 'accepted'.\n // 'completed' is URL mode's second settlement (ACP `elicitation/complete`): the card is\n // already 'accepted' at consent, and this only re-labels it once the agent says the flow\n // finished. An old reader fails THIS frame's decode and keeps showing the consented card —\n // the losing direction is a missing \"Completed\" label, never a wrong verdict.\n z.object({\n kind: z.literal('elicitation_resolved'),\n requestId: z.string().min(1).max(200),\n outcome: z.enum(['accepted', 'dismissed', 'cancelled', 'completed']),\n label: z.string().optional()\n }),\n // A runtime approval handed to an API caller first (shared-bot-relay.md §10.4), answered by `permission_choice`.\n z.object({\n kind: z.literal('permission'),\n requestId: z.string().uuid(),\n tool: z.string().max(240),\n detail: z.string().max(240)\n }),\n // An MCP App opened (webchat-mcp-apps.md §5). A new KIND rather than a field on something\n // existing, and the skew that follows is the closed one: a relay or browser predating it fails\n // exactly this frame's decode and shows the turn without the frame, while the tool's own text\n // result has already reached the model — so the agent still answered in words and nothing\n // waits on a reader who was never shown anything. An elicitation could not take that trade,\n // which is why `multi`/`text`/`url` went on the card as optional fields instead.\n McpAppCard.extend({ kind: z.literal('app') }),\n // One ordered slice of a card's template. Rides the ordinary reply stream, so it takes the\n // turn's own cursor and arrives in order — unlike `app_rpc_result`/`app_resolved`, which are\n // correlated and idempotent and may bypass it, a chunk is meaningless out of sequence.\n z.object({\n kind: z.literal('app_template'),\n appId: z.string().min(1).max(200),\n seq: z.number().int().min(0),\n chunk: z.string().min(1).max(MCP_APP_TEMPLATE_CHUNK_CHARS)\n }),\n // The same card, settled — append-only, keyed by `appId`, exactly as `elicitation_resolved` is.\n z.object({ kind: z.literal('app_resolved'), appId: z.string().min(1).max(200), outcome: McpAppOutcome }),\n // One view RPC's answer, correlated by the `callId` the browser minted on the `app_rpc` op.\n // It rides the reply STREAM rather than a request/reply frame of its own, because the stream is\n // the only channel webchat has that already survives what an app's RPC has to survive: the\n // relay bridging a browser onto a daemon, a reconnect mid-call, and a turn ending underneath it.\n // The browser completes the view's JSON-RPC call from this; an answer with no live call is\n // dropped, which is what makes a replayed stream harmless.\n z.object({\n kind: z.literal('app_rpc_result'),\n appId: z.string().min(1).max(200),\n callId: z.string().min(1).max(64),\n outcome: McpAppRpcResult\n }),\n // A shared image, already committed to the transcript; later original changes arrive as `image_update`.\n SharedImage.extend({\n kind: z.literal('image'),\n postId: z.string().uuid(),\n at: z.number().int(),\n text: z.string().max(SHARED_IMAGE_TEXT_MAX_CHARS),\n download: SharedImageDownload.optional()\n })\n]);\n// The session status-bar snapshot (model / context / tokens / cost), rebuilt from\n// the daemon's model selector + folded ACP usage. All fields optional so a partial\n// snapshot is valid: context/cost stream live via ACP `usage_update`, while token\n// totals only refresh at each turn's end. Carried as an extra field on the output\n// payload (see below) rather than a reply-stream event — a status update is not part\n// of the transcript and can arrive with no text chunk of its own.\nexport const WebchatStatus = z.object({\n runtime: z.string().optional(),\n model: z.string().optional(),\n effort: z.string().optional(),\n // Effective session permission preset; Codex Auto is composite rather than a raw mode.\n permissionMode: z.string().optional(),\n fastMode: z.boolean().optional(),\n contextUsed: z.number().int().optional(),\n contextSize: z.number().int().optional(),\n totalTokens: z.number().int().optional(),\n costAmount: z.number().optional(),\n costCurrency: z.string().optional(),\n // The models this session's runtime advertises as selectable (from the ACP model\n // config option) — populates the console's model dropdown. Absent ⇒ no selector.\n models: z.array(z.string()).optional(),\n // The reasoning-effort levels this session's runtime offers (from the ACP\n // `thought_level` config option, plus the synthetic `ultracode`/`max` entries on\n // Claude runtimes) — populates the console's effort dropdown. Absent ⇒ no selector.\n efforts: z.array(z.string()).optional(),\n // Selectable session permission modes, from the runtime's ACP `mode` select.\n // Omitted when the Agent disables chat-side changes.\n permissionModes: z.array(z.string()).optional(),\n // Whether the selected model advertises a fast-mode toggle (the ACP `model_config`\n // config option only appears once a fast-capable model is selected). Absent/false ⇒\n // no fast toggle shown.\n fastModeAvailable: z.boolean().optional(),\n // Whether a message sent while this turn runs can be steered into it over the runtime's\n // `_session/steering` (#1847): the composer then sends at once instead of queueing locally.\n steerable: z.boolean().optional(),\n // This conversation's session, by its outward id (session-concept.md §1.1), so the console can\n // deep-link to the session detail page. Absent until the session is created.\n sessionId: z.string().optional()\n});\n// Daemon→browser reply payload, carried as an `output` item inside relay `rd/chat`:\n// one chunk of a turn's reply and/or a status snapshot. `event` is optional so a\n// status-only payload (no reply chunk) is valid; every payload still carries a\n// monotonic `index` for client-side ordering.\nexport const WebchatOutput = z\n .object({\n conversationId: z.string().uuid(),\n turnId: z.string().uuid(),\n // Which participant is streaming — a multi-agent conversation renders one\n // stream lane per (turnId, agentId). Absent ⇒ the conversation's sole agent.\n agentId: z.string().uuid().optional(),\n index: z.number().int(),\n event: WebchatEvent.optional(),\n status: WebchatStatus.optional()\n})\n // A payload must carry at least one of event/status — an empty payload is meaningless.\n .refine((o) => o.event !== undefined || o.status !== undefined, {\n message: 'WebchatOutput must carry event and/or status'\n});\n// Daemon→browser terminal payload, carried as a `done` item inside relay `rd/chat`.\n// `error` is set when the turn ended in FAILURE (agent failed to start, ACP\n// handshake/prompt rejected) rather than completing — a human-readable reason the\n// client renders instead of a normal reply. When present, `stopReason`/`usage` are\n// absent (the turn produced no clean result).\nexport const WebchatDone = z.object({\n conversationId: z.string().uuid(),\n turnId: z.string().uuid(),\n // Which participant's turn ended (multi-agent attribution, as on WebchatOutput).\n agentId: z.string().uuid().optional(),\n // Last output index emitted before this terminal marker. A reconnecting browser\n // holds `done` until it has assembled every output through this index, so an\n // early terminal frame cannot hide a gap. Optional for rolling compatibility.\n lastIndex: z.number().int().min(-1).optional(),\n stopReason: z.string().optional(),\n usage: z.object({ used: z.number().int().optional(), cost: z.number().optional() }).optional(),\n error: z.string().optional()\n});\n// Browser operations ride relay `rd/msg` as RelayWebchatOp. No webchat content\n// frame is registered on the daemon↔CP control WS, so the CP stays off the\n// webchat hot path.\n//# sourceMappingURL=webchat.js.map","import { z } from 'zod';\nimport { NativeMcpUi } from '../mcp-app.js';\nimport { SessionKey } from './route.js';\nimport { ElicitCard, MCP_APP_HTML_MAX_BYTES, McpAppCsp, McpAppDimensions, McpAppOutcome, PlanEntry, SharedImage, WebchatImageAttachment } from './webchat.js';\n/**\n * Session read-back (C→D REQ → REP) — the console's on-demand pulls.\n *\n * Session bodies are daemon-local (body-locality, §1/§12). The CP may persist a\n * metadata-only session-list snapshot from daemon `event/session` events, while\n * transcript/tool bodies are pulled live from the owning daemon and proxied to\n * the console only for display.\n *\n * - `session/list`: the daemon's local metadata projection, used for snapshots\n * and direct read-back/debugging.\n * - `session/history`: one cursor-paginated page of a session's transcript.\n */\n/**\n * Per-session token accounting, metered by the daemon from the agent's ACP usage\n * stream. Token counts are CUMULATIVE across the session's turns (summed from each\n * turn's `PromptResponse.usage`); context/cost are the LATEST snapshot from the\n * agent's `usage_update` stream. Every field is optional — a runtime that reports\n * no usage yields an absent field, not a zero.\n */\nexport const SessionUsage = z.object({\n totalTokens: z.number().int().optional(),\n inputTokens: z.number().int().optional(),\n outputTokens: z.number().int().optional(),\n thoughtTokens: z.number().int().optional(),\n cachedReadTokens: z.number().int().optional(),\n cachedWriteTokens: z.number().int().optional(),\n contextUsed: z.number().int().optional(), // current context-window occupancy\n contextSize: z.number().int().optional(), // context-window size\n costAmount: z.number().optional(), // running session cost\n costCurrency: z.string().optional()\n});\n/** One row in the session list (metadata + console metrics; NOT the transcript). */\nexport const SessionListItem = z.object({\n sessionId: z.string(), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n // The stable ACP session id that spawned this session through sendMessage.\n // Absent for root sessions. This is lineage metadata only, never a body.\n parentSessionId: z.string().optional(),\n sessionKey: SessionKey, // platform/channel/thread — drives the \"integration · channel\" column\n agentId: z.string().uuid(),\n title: z.string().optional(), // human-facing session title (daemon-derived)\n status: z.string().optional(), // e.g. \"plan\" / \"completed\" / \"awaiting approval\"\n lastActivityAt: z.string().optional(), // ISO/string ts of the last activity\n usage: SessionUsage.optional(), // per-session token/cost accounting (daemon-metered)\n triggeredBy: z.string().optional(), // sender handle/id that triggered/drove the run\n // Human-readable display names, resolved + cached by the daemon (the only side\n // holding platform credentials). Always optional — the raw ids above stay the\n // canonical identity; absent when the daemon hasn't resolved them (yet).\n channelName: z.string().optional(), // \"general\" for a Slack \"C…\" channel; \"@Dana Reyes\" for a \"D…\" DM\n triggeredByName: z.string().optional(), // display name for `triggeredBy`\n // Platform-native deep link back to the source message/thread. The daemon\n // either captures the provider URL at ingress or derives it from the owning\n // integration. Optional when the platform exposes no addressable source.\n threadUrl: z.string().optional()\n});\n/** C→D REQ: list the daemon's sessions (optionally just one agent's). */\nexport const SessionListReq = z.object({\n agentId: z.string().uuid().optional() // omit ⇒ all this daemon's sessions\n});\n/** D→C REP (corr = req id): the daemon's current sessions. */\nexport const SessionListPage = z.object({\n sessions: z.array(SessionListItem)\n});\n/**\n * The full ACP tool body, transported as a JSON STRING in `SessionMessage.body`.\n * Kept structurally faithful to the ACP `ToolCall`; free-form fields stay opaque\n * (`z.unknown()`) so no daemon-side redaction/reshaping is implied.\n */\nexport const ToolBody = z.object({\n toolCallId: z.string(),\n kind: z.string().optional(), // ACP ToolKind: read|edit|delete|move|search|execute|think|fetch|switch_mode|other\n status: z.string().optional(), // ACP ToolCallStatus: pending|in_progress|completed|failed\n rawInput: z.unknown().optional(),\n rawOutput: z.unknown().optional(),\n content: z.array(z.unknown()).optional(), // ACP ToolCallContent[] kept opaque (content|diff|terminal blocks)\n locations: z.array(z.object({ path: z.string(), line: z.number().int().optional() })).optional(),\n truncated: z.boolean().optional() // set when the daemon capped the stored body at write time\n});\n/**\n * The agent's task list for ONE turn, transported as a JSON STRING in `SessionMessage.body`\n * on a `plan` row. An ACP plan update carries the WHOLE entry list every time, so this is a\n * snapshot, not a delta — the daemon rewrites one row per turn rather than appending. The\n * live webchat stream carries the same entries as they change (`WebchatEvent` kind `plan`).\n */\nexport const PlanBody = z.object({ entries: z.array(PlanEntry) });\n/** How a persisted elicitation card ended. The four the live stream also carries, plus\n * `unrenderable` — the ask no surface had a control for, which was only ever a live notice\n * (#1839) and so vanished on reload. Absent ⇒ the card was still open when it was recorded,\n * which after a daemon restart means nobody ever answered it. */\nexport const ElicitOutcome = z.enum(['accepted', 'dismissed', 'cancelled', 'completed', 'unrenderable']);\n/**\n * The agent's structured question, transported as a JSON STRING in `SessionMessage.body` on an\n * `elicit` row: the card exactly as it was offered, plus how it ended. The row exists so a page\n * reload — or a reader who joins later — still sees that the question was asked and what was\n * answered, which the live-only card lost.\n *\n * `answerLabel` is the chosen option's LABEL (the labels joined, for a multi-select or a form),\n * never the accepted content: what a reader needs is what was picked, and the values are already\n * in the agent's own context. The raw `requestedSchema` is absent for the same reason it never\n * reaches any wire — the card is the reduction, and the reduction is what was shown.\n */\nexport const ElicitBody = ElicitCard.extend({\n outcome: ElicitOutcome.optional(),\n answerLabel: z.string().optional()\n});\n/**\n * An `app` row: one MCP App card as the transcript KEEPS it (webchat-mcp-apps.md §8).\n *\n * The WHOLE card, template included, because a reader who reloads wants the interface back and a\n * header saying one was shown is not that. The template is what makes the row large, so it never\n * rides a transcript PAGE: the history projection strips it and marks the row truncated, and the\n * console pulls the full body through the same on-demand daemon read an oversized tool body uses.\n *\n * `server` and `conversationId` are the daemon's OWN record of what the card may reach, kept here\n * so a card outlives the process that opened it. They are read back by the daemon, never by the\n * frame: a view still names only its `appId`, so it can no more select a server after a reload\n * than it could before one.\n *\n * `outcome` absent while the card is live; a row that STAYS absent is a card whose daemon died\n * holding it, which reads as unfinished rather than as falsely closed.\n */\nexport const McpAppBody = z.object({\n nativeUi: NativeMcpUi.optional(),\n appId: z.string().min(1).max(200),\n title: z.string().max(200),\n toolName: z.string().min(1).max(200),\n toolResult: z\n .object({\n content: z.array(z.unknown()).max(64).optional(),\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n isError: z.boolean().optional()\n })\n .optional(),\n outcome: McpAppOutcome.optional(),\n /** The `ui://` template, verbatim. Absent from a transcript PAGE (stripped as oversized) and\n * present in the full-body read — so a row with `bodyTruncated` is a card whose page is one\n * fetch away, not one that was never recorded. */\n html: z.string().max(MCP_APP_HTML_MAX_BYTES).optional(),\n /** The arguments the card was opened with, replayed to the view as `ui/notifications/tool-input`\n * so a reloaded page renders what it rendered live rather than an empty shell. */\n toolInput: z.record(z.string(), z.unknown()).optional(),\n csp: McpAppCsp.optional(),\n dimensions: McpAppDimensions.optional(),\n /** The CONFIGURED server name the card's tool came from — the one server a re-armed view may\n * reach. Daemon-read; absent on a row written before templates were kept, which is what makes\n * such a card replayable as a record but never re-armable. */\n server: z.string().max(200).optional(),\n /** The conversation the card was opened in, re-checked against the routed frame's own before a\n * reloaded card is re-armed — the persisted half of the live registry's conversation fence. */\n conversationId: z.string().max(200).optional()\n});\n// The user-turn body schemas live in a bundler-safe leaf (the console validates with them);\n// re-exported here so every wire consumer keeps finding them beside the tool and plan bodies.\nexport { CodehostTurnFacts, LinearTurnFacts, SessionMessageTurnFacts, UserTurnBody } from '../user-turn-body.js';\n/** One bounded webchat image persisted only in the daemon-local transcript. */\nexport const SessionImageAttachment = WebchatImageAttachment;\n/** One message in a session transcript page (a body — returned only for display). */\nexport const SessionMessage = z.object({\n seq: z.number().int(), // daemon-local insertion order within the session\n sender: z.string(), // platform handle/id of the author\n senderName: z.string().optional(), // display name (daemon-resolved; absent if unknown)\n senderAvatarUrl: z.string().url().optional(), // public provider profile image; absent if unavailable\n // Daemon-verified AgentConnect Slack app/bot provenance. Optional for rolling\n // compatibility and absent on legacy rows or every non-Slack transport.\n trustedAgentBot: z.boolean().optional(),\n ts: z.string(), // platform timestamp (daemon-local string form)\n // Normalized chronological coordinate (epoch µs) from the daemon's event-time\n // axis — provider-authoritative when the platform supplied its send time.\n // Absent on legacy rows; consumers fall back to deriving it from `ts`.\n eventTimeUs: z.number().int().positive().optional(),\n // Canonical webchat post identity (merged-conversation-view.md §6): minted once\n // at origin and identical on every participant's copy, independent of a\n // collision-bumped `ts`. Absent on non-webchat rows and pre-upgrade rows.\n postId: z.string().uuid().optional(),\n kind: z.string(), // \"text\" / tool / reasoning / plan / elicit / … (daemon transcript kind)\n text: z.string(),\n attachments: z.array(SessionImageAttachment).max(1).optional(),\n // A shared image's preview and original descriptor (webchat-generated-images.md §4); never a signed URL.\n sharedImage: SharedImage.optional(),\n // ── body enrichment (optional ⇒ text/reasoning rows and old daemons omit these) ──\n toolCallId: z.string().optional(), // parsed from the ToolBody (tool rows only)\n toolStatus: z.string().optional(), // ACP ToolCallStatus, surfaced for the console badge\n toolKind: z.string().optional(), // ACP ToolKind, surfaced for the console icon\n body: z.string().optional(), // JSON.stringify(ToolBody) on a tool row, PlanBody on a plan row, ElicitBody on an elicit row; a tool body may be a truncated-but-VALID-JSON preview\n bodyTruncated: z.boolean().optional(), // preview was shrunk for the frame; full body via session/tool-body\n bodyBytes: z.number().int().optional() // full (untruncated) body byte length\n});\n/** C→D REQ: fetch one page of a session's history from the owning daemon. */\nexport const SessionHistoryReq = z\n .object({\n // Optional only for rolling compatibility with an older CP. A current CP always\n // sends the authorized owner and the daemon re-checks the session binding.\n agentId: z.string().uuid().optional(),\n sessionId: z.string(), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n cursor: z.string().optional(), // opaque; omit ⇒ newest page\n // Monotonic daemon-local transcript revision. Mutually exclusive with the\n // backward-pagination cursor; used by an open console view to pull inserts\n // and same-seq tool updates without replaying the whole transcript.\n after: z\n .string()\n .regex(/^\\d+$/)\n .refine((value) => Number.isSafeInteger(Number(value)))\n .optional(),\n limit: z.number().int().positive().max(200).default(50)\n})\n .refine(({ cursor, after }) => cursor === undefined || after === undefined, {\n message: 'cursor and after are mutually exclusive'\n});\n/** D→C REP (corr = the req id): a page of messages + the cursor for the next page. */\nexport const SessionHistoryPage = z.object({\n sessionId: z.string(), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n messages: z.array(SessionMessage), // chronological oldest→newest within the page (seq breaks equal-time ties)\n nextCursor: z.string().optional(), // absent ⇒ no older messages\n // Optional for rolling compatibility. `liveCursor` is the next `after`\n // watermark; `liveMore` means another forward page is immediately available.\n liveCursor: z.string().optional(),\n liveMore: z.boolean().optional()\n});\n/**\n * C→D REQ: fetch the FULL (untruncated) ToolBody JSON for one tool call, chunked.\n * The inline `SessionMessage.body` preview is capped at 32 KiB; when a body is\n * bigger the console pages the whole thing back through this frame by offset.\n */\nexport const SessionToolBodyReq = z.object({\n // Optional only for rolling compatibility with an older CP; see SessionHistoryReq.\n agentId: z.string().uuid().optional(),\n sessionId: z.string(),\n toolCallId: z.string(),\n offset: z.number().int().nonnegative().default(0)\n});\n/** D→C REP (corr = the req id): one frame-budgeted byte slice of the full ToolBody JSON. */\nexport const SessionToolBodyChunk = z.object({\n sessionId: z.string(),\n toolCallId: z.string(),\n data: z.string(), // UTF-8-boundary-safe byte slice of the FULL ToolBody JSON\n totalBytes: z.number().int(),\n nextOffset: z.number().int().optional() // absent ⇒ this is the last chunk\n});\n/**\n * session-concept §5.4 — the shared shape of a child-session status answer, returned by BOTH\n * legs of a cross-daemon status read (`session/child-status/ok` from the CP to the asking daemon,\n * and `session/child-status/probe/ok` from the owning daemon to the CP).\n *\n * `found:false` is deliberately the single negative outcome for \"unknown session\" AND \"not your\n * child\": distinguishing them would let a caller probe for the existence of sessions it may not\n * read, which is exactly what the daemon-local path also refuses to do. `reason` describes only\n * TRANSPORT-level failure (the owning daemon is unreachable), never an authorization verdict.\n */\nexport const ChildSessionStatus = z.object({\n found: z.boolean(),\n /** The agent that owns the child session. Present only when `found`. */\n agentId: z.string().uuid().optional(),\n /** Coarse progress, collapsed by the OWNING daemon from its own session lifecycle. */\n status: z.enum(['in-progress', 'failed', 'done']).optional(),\n /** The underlying lifecycle state, for a caller that wants the detail. */\n state: z.enum(['starting', 'idle', 'prompting', 'cancelling', 'resuming', 'closed']).optional(),\n /** Epoch ms of the child's last state change. */\n updatedAt: z.number().int().optional(),\n /** Optional during rolling upgrades; current daemons always return it for found children. */\n reply: z\n .object({\n requested: z.boolean(),\n state: z.enum(['not-requested', 'awaiting', 'queued-for-parent', 'not-sent', 'failed', 'unknown'])\n })\n .optional(),\n nextAction: z.enum(['none', 'wait', 'finish-turn-and-wait', 'report-failure', 'report-missing-reply']).optional(),\n message: z.string().optional(),\n /** Transport-level failure only: the owning daemon is not currently reachable. */\n reason: z.enum(['offline']).optional()\n});\n/**\n * D→C REQ: \"what is the status of a child session my session started, which lives on ANOTHER\n * daemon?\" The CP is the placement authority, so it resolves `childAgentId` to the owning daemon\n * and forwards the question there — the daemon never addresses another daemon directly.\n *\n * AUTHORIZATION IS TWO-SIDED. The CP verifies that `parentSessionId` really is a session reported\n * by the ASKING daemon (a daemon cannot claim someone else's parent session), and the owning\n * daemon then verifies that the child's durable origin link actually equals `parentSessionId`.\n * Neither check alone is sufficient: the first stops a forged parent claim, the second is the\n * real lineage rule and is enforced where the session lives.\n */\nexport const ChildSessionStatusReq = z.object({\n /** The ASKING session's own stable acpSessionId. The CP validates ownership of this. */\n parentSessionId: z.string().min(1),\n /** The child's logical session key, exactly as `sendMessage` handed it back. Opaque to the CP. */\n childSessionId: z.string().min(1),\n /** The child agent, so the CP can resolve placement without parsing the composite key. */\n childAgentId: z.string().uuid()\n});\n/**\n * C→D REQ: the forwarded leg of {@link ChildSessionStatusReq}, sent to the daemon that OWNS the\n * child. `childAgentId` is dropped — placement is already resolved — leaving exactly the lineage\n * pair the owning daemon authorizes on. The CP does not persist or interpret the answer.\n */\nexport const ChildSessionStatusProbe = z.object({\n parentSessionId: z.string().min(1),\n childSessionId: z.string().min(1)\n});\n/**\n * C→D REQ → `session/visibility/ok` (session-visibility.md §5.1): the CP pushes\n * a session's authoritative effective visibility so the owning daemon updates\n * its local memory-capture gate. Control signaling only — one privacy bit per\n * session, never content.\n *\n * `visibilityRev` is the session's dedicated durable visibility counter\n * (bumped in the same CP transaction as every visibility change, settlement,\n * and cascade). It is deliberately NOT the transcript revision nor the WS\n * `sessionEpoch`/`seq` fences — those are connection/launch-scoped and do not\n * advance with visibility. Delivery is at-least-once; the rev makes duplicate\n * and out-of-order application safe on the daemon.\n */\nexport const SessionVisibilityPush = z.object({\n sessionId: z.string().min(1), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n // The session's owning agent. ACP session ids are runtime-local, so on a pool's\n // shared store the id alone names a gate every org could claim. Optional for\n // rolling upgrades: an older CP omits it and the daemon attributes the push to\n // the sole local holder, or leaves the gate closed when there is no single one.\n agentId: z.string().min(1).optional(),\n visibility: z.enum(['private', 'org', 'external']),\n // New daemons use this explicit capture/recall verdict. It is optional for\n // wire compatibility with older CPs and decouples the runtime safety gate\n // from the console visibility vocabulary.\n sharedMemoryExcluded: z.boolean().optional(),\n visibilityRev: z.number().int().nonnegative()\n});\n/**\n * D→C REP (corr = the push's id). `status` reports how the daemon settled the\n * push: `applied` = the rev advanced its stored gate state; `superseded` = the\n * rev is ≤ the stored one, so nothing was reapplied — but the frame is STILL\n * acknowledged (never answered with an `error` frame): \"ignore\" must never\n * mean \"don't ACK\", or a lost ACK leaves the CP retrying forever. The CP\n * records the ack watermark on either status.\n */\nexport const SessionVisibilityOk = z.object({\n sessionId: z.string().min(1),\n visibilityRev: z.number().int().nonnegative(),\n status: z.enum(['applied', 'superseded'])\n});\n/**\n * C→D REQ → generic `ack` (session-visibility.md §5.1): the register-time\n * replay of the current `(sessionId, visibility, visibilityRev)` set for the\n * daemon's active sessions — a snapshot, not a diff — closing the window\n * where a visibility change happened while the daemon was offline. Each entry\n * applies with the same rev semantics as a single push; a stale entry is\n * skipped, never an error. Chunked by the CP; ≤ 1000 entries per frame keeps\n * it far under the frame-size cap.\n */\nexport const SessionVisibilitySnapshot = z.object({\n entries: z.array(SessionVisibilityPush).max(1000)\n});\n/** R→C level-triggered wake. Review bodies, event details, and CI logs stay off the CP. */\nexport const PullRequestFeedbackSignal = z.object({\n deliveryKey: z.string().min(1).max(200),\n installationId: z.string().regex(/^[1-9]\\d*$/),\n repoId: z.string().regex(/^[1-9]\\d*$/),\n repoFullName: z.string().min(3).max(300),\n pullNumber: z.number().int().positive()\n});\n/** C→D exact-session continuation. The daemon constructs the prompt locally and reads current code-host state. */\nexport const SessionPullRequestFeedback = PullRequestFeedbackSignal.omit({ installationId: true }).extend({\n agentId: z.string().uuid(),\n sessionId: z.string().min(1),\n provider: z.enum(['gitlab', 'gitea']).optional(),\n host: z.string().url().optional()\n});\nexport const SessionPullRequestFeedbackResult = z.object({\n deliveryKey: z.string().min(1).max(200),\n accepted: z.boolean(),\n reason: z\n .enum(['not_found', 'not_ready', 'paused', 'busy', 'draining', 'integration_offline', 'durability'])\n .optional()\n});\n//# sourceMappingURL=session.js.map","import { z } from 'zod';\n/** Event wake for follow-ups (assistant-mode.md §5.14): a relay advertising it is sent the watched objects, and a CP advertising it accepts their events and answers `assistant/follow-up-watch`. */\nexport const FOLLOW_UP_WATCH_FEATURE = 'follow-up-watch-v1';\n/** A daemon advertising it answers `assistant/follow-up-wake`; the CP accepts no subscription from one without it and sends it no wake. */\nexport const FOLLOW_UP_WAKE_FEATURE = 'follow-up-wake-v1';\n/** An agent holds at most this many watches, a fixed limit as reminders have. */\nexport const FOLLOW_UP_WATCH_MAX = 100;\n/** A daemon sends `assistant/follow-up-watch` single-shot with this ack budget: a new watch reads its object on the code host first. */\nexport const FOLLOW_UP_WATCH_BUDGET_MS = 30_000;\n/** What happened on a watched object; the first six are changes of state, the rest discussion. */\nexport const FollowUpEventKind = z.enum([\n 'merged',\n 'closed',\n 'reopened',\n 'approved',\n 'changes_requested',\n 'checks',\n 'comment',\n 'review',\n 'commits'\n]);\nconst STATE_EVENTS = new Set([\n 'merged',\n 'closed',\n 'reopened',\n 'approved',\n 'changes_requested',\n 'checks'\n]);\n/** A change of state wakes after one quiet minute; discussion waits 30 minutes (§5.14 Events). */\nexport function isFollowUpStateEvent(kind) {\n return STATE_EVENTS.has(kind);\n}\nexport const FollowUpWatchSubject = z.enum(['pull', 'issue']);\n/** The one pull request, merge request or issue a follow-up watches, as its URL names it; the CP resolves the numeric identity. */\nexport const FollowUpWatchTarget = z.object({\n provider: z.enum(['github', 'gitlab']),\n host: z.string().min(1).max(253),\n repoPath: z.string().min(3).max(300),\n subject: FollowUpWatchSubject,\n number: z.number().int().positive()\n});\nconst GITHUB_HOSTS = new Set(['github.com', 'www.github.com']);\nconst GITHUB_PATH = /^\\/([A-Za-z0-9-]+)\\/([A-Za-z0-9._-]+)\\/(pull|issues)\\/([1-9]\\d{0,9})(?:\\/.*)?$/;\nconst GITLAB_PATH = /^\\/((?:[A-Za-z0-9._-]+\\/)+[A-Za-z0-9._-]+)\\/-\\/(merge_requests|issues)\\/([1-9]\\d{0,9})(?:\\/.*)?$/;\n/** Parse a watch URL: GitHub's `/<owner>/<repo>/pull|issues/<n>`, GitLab's `/<path>/-/merge_requests|issues/<iid>`; anything else is refused with a reason. */\nexport function parseFollowUpWatchUrl(raw) {\n let url;\n try {\n url = new URL(raw.trim());\n }\n catch {\n return { error: 'not a URL' };\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:')\n return { error: 'not an http(s) URL' };\n const host = url.hostname.toLowerCase();\n const path = decodeURIComponent(url.pathname).replace(/\\/+$/, '');\n if (GITHUB_HOSTS.has(host)) {\n const match = GITHUB_PATH.exec(path);\n if (!match)\n return { error: 'not a GitHub pull request or issue URL' };\n return {\n target: {\n provider: 'github',\n host: 'github.com',\n repoPath: `${match[1]}/${match[2]}`,\n subject: match[3] === 'pull' ? 'pull' : 'issue',\n number: Number(match[4])\n }\n };\n }\n const match = GITLAB_PATH.exec(path);\n if (!match)\n return { error: 'not a pull request, merge request or issue URL' };\n return {\n target: {\n provider: 'gitlab',\n host: url.port ? `${host}:${url.port}` : host,\n repoPath: match[1],\n subject: match[2] === 'merge_requests' ? 'pull' : 'issue',\n number: Number(match[3])\n }\n };\n}\n/** Why a watch was not taken: not readable with the agent's access, no such object, no events from that host here, the agent's limit, or a transient failure. */\nexport const FollowUpWatchRefusal = z.enum(['no_access', 'not_found', 'unsupported', 'limit', 'unavailable']);\n/** A taken watch, as the CP resolved it: the canonical path for display, never a numeric id. */\nexport const FollowUpWatched = FollowUpWatchTarget.pick({\n provider: true,\n repoPath: true,\n subject: true,\n number: true\n}).extend({\n // The repository's numeric id, which a check's code-host reads aim at (§5.14).\n repoId: z\n .string()\n .regex(/^[1-9]\\d*$/)\n .optional()\n});\n/** How a watched object is named to people: `owner/repo#12`, or a GitLab merge request's `group/project!3`. */\nexport function followUpWatchLabel(watched) {\n const mark = watched.provider === 'gitlab' && watched.subject === 'pull' ? '!' : '#';\n return `${watched.repoPath}${mark}${watched.number}`;\n}\n/** A follow-up's watch as the Activity row and the console show it (§5.14). */\nexport const FollowUpWatchState = z.enum(['pending', 'watching', 'refused', 'ended']);\nconst FollowUpId = z.string().min(1).max(200);\n/** D→C REQ: `set` subscribes or moves each listed follow-up, `remove` ends each, `full` is the agent's whole set and drops the rest. */\nexport const AssistantFollowUpWatchReq = z\n .object({\n agentId: z.string().uuid(),\n mode: z.enum(['set', 'remove', 'full']),\n watches: z\n .array(z.object({ followUpId: FollowUpId, target: FollowUpWatchTarget.optional() }))\n .max(FOLLOW_UP_WATCH_MAX)\n})\n .refine((req) => req.mode === 'remove' || req.watches.every((watch) => watch.target !== undefined), {\n message: 'set and full name a target for every watch'\n});\n/** C→D REP: one entry per listed follow-up, what is watched or why not; `remove` answers each with neither. */\nexport const AssistantFollowUpWatchResult = z.object({\n results: z\n .array(z.object({\n followUpId: FollowUpId,\n watched: FollowUpWatched.optional(),\n refused: FollowUpWatchRefusal.optional()\n }))\n .max(FOLLOW_UP_WATCH_MAX)\n});\n/** C→D REQ, body-free: the events that make a follow-up's check due, or a notice that its watch ended; `wakeId` grows per subscription so a retry starts no second check. */\nexport const AssistantFollowUpWake = z\n .object({\n agentId: z.string().uuid(),\n followUpId: FollowUpId,\n // The subscription's identity: its wakeIds count from a new start whenever it changes.\n subscription: z.number().int().positive().optional(),\n wakeId: z.number().int().positive(),\n kinds: z.array(FollowUpEventKind).max(FollowUpEventKind.options.length),\n latestAt: z.string().datetime().optional(),\n ended: z.enum(['access_lost']).optional()\n})\n .refine((wake) => wake.ended !== undefined || (wake.kinds.length > 0 && wake.latestAt !== undefined), {\n message: 'a wake names its events and when the latest arrived'\n});\n/** D→C REP: `not_found` ends the subscription; any other refusal holds the wake for a retry. */\nexport const AssistantFollowUpWakeResult = z.object({\n accepted: z.boolean(),\n reason: z.enum(['not_found', 'not_holder', 'not_ready']).optional()\n});\n/** C→R EVT: one watched GitHub object, by numeric identity; it never says which agent or follow-up watches it. */\nexport const RcFollowUpWatch = z.object({\n provider: z.enum(['github']),\n installationId: z.string().regex(/^[1-9]\\d*$/),\n repoId: z.string().regex(/^[1-9]\\d*$/),\n subject: FollowUpWatchSubject,\n number: z.number().int().positive(),\n watched: z.boolean()\n});\n/** The relay's key for one watched object. */\nexport function followUpWatchKey(watch) {\n return `${watch.provider}:${watch.repoId}:${watch.subject}:${watch.number}`;\n}\n//# sourceMappingURL=follow-up-watch.js.map","import { z } from 'zod';\n/** Organization Knowledge wire contracts (organization-knowledge.md). */\nexport const OrganizationArtifactKind = z.enum(['knowledge', 'skill']);\nexport const OrganizationSuggestionOperation = z.enum(['create', 'update']);\nexport const OrganizationSuggestionState = z.enum(['proposed', 'accepted', 'rejected']);\n/** Pending suggestion JSON is pulled in bounded chunks so even the largest\n * accepted skill candidate remains below the control wire's 256 KiB frame cap. */\nexport const MAX_ORGANIZATION_SUGGESTION_BODY_BYTES = 4 * 1024 * 1024;\nexport const ORGANIZATION_SUGGESTION_CHUNK_BYTES = 128 * 1024;\nexport const SkillBundleTextFile = z\n .object({\n path: z.string().min(1).max(256),\n /** UTF-8 text by default; base64 permits binary assets in a complete Agent\n * Skills directory bundle without embedding raw binary in JSON. */\n encoding: z.enum(['utf8', 'base64']).default('utf8'),\n content: z.string().max(699_052)\n})\n .strict();\nexport const OrganizationSuggestionInfo = z\n .object({\n candidateId: z.string().uuid(),\n kind: OrganizationArtifactKind,\n operation: OrganizationSuggestionOperation,\n targetId: z.string().uuid().optional(),\n targetRevision: z.number().int().positive().optional(),\n title: z.string().min(1).max(128),\n summary: z.string().max(1024).optional(),\n tags: z.array(z.string().min(1).max(64)).max(16).optional(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n contentBytes: z\n .number()\n .int()\n .positive()\n .max(4 * 1024 * 1024),\n state: OrganizationSuggestionState,\n sessionIds: z.array(z.string().min(1).max(256)).min(1).max(100),\n createdAt: z.string().datetime()\n})\n .strict()\n .superRefine((value, ctx) => {\n const hasTarget = value.targetId !== undefined || value.targetRevision !== undefined;\n if ((value.operation === 'update') !== hasTarget || (hasTarget && (!value.targetId || !value.targetRevision))) {\n ctx.addIssue({\n code: 'custom',\n message: 'update suggestions require both targetId and targetRevision; create suggestions require neither'\n });\n }\n});\n/** D→C: replace/upsert this daemon's bounded local suggestion inventory. */\nexport const OrganizationSuggestionsSyncReq = z\n .object({\n suggestions: z\n .array(OrganizationSuggestionInfo.extend({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128)\n }).strict())\n .max(256)\n})\n .strict();\nexport const OrganizationSuggestionDecision = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n state: z.enum(['accepted', 'rejected'])\n})\n .strict();\nexport const OrganizationSuggestionsSyncOk = z\n .object({ decisions: z.array(OrganizationSuggestionDecision).max(256) })\n .strict();\n/** Both sides read and write the organization record (organization-knowledge.md §15): the record frames and `withOutsiders` are sent only when the peer advertises it. */\nexport const KNOWLEDGE_RECORD_FEATURE = 'knowledge-record-v1';\n/** The three record entries' file names, as an assistant-mode agent's memory tools name them. */\nexport const KnowledgeRecordFile = z.enum(['organization.md', 'channels.md', 'members.md']);\n/** What kind of writer a record write comes from, kept on the revision. */\nexport const KnowledgeRecordWriterKind = z.enum(['research', 'first-look', 'conversation', 'person']);\n/** A record body is capped well under the 256 KiB frame limit. */\nexport const KNOWLEDGE_RECORD_MAX_BYTES = 128 * 1024;\nconst RecordOptOutKeys = z.array(z.string().min(1).max(512)).max(4096);\n/** D→C: one record entry, its revision and the opt-out keys. */\nexport const KnowledgeRecordReadReq = z.object({ agentId: z.string().uuid(), file: KnowledgeRecordFile }).strict();\n/** D→C: a revision-checked write of one record entry by an agent; opt-out marks land before it, lifts after. */\nexport const KnowledgeRecordWriteReq = z\n .object({\n agentId: z.string().uuid(),\n file: KnowledgeRecordFile,\n baseRevision: z.number().int().positive(),\n content: z.string().max(KNOWLEDGE_RECORD_MAX_BYTES),\n writerKind: KnowledgeRecordWriterKind,\n optOut: z\n .object({ mark: RecordOptOutKeys.max(64).default([]), lift: RecordOptOutKeys.max(64).default([]) })\n .strict()\n .default({ mark: [], lift: [] })\n})\n .strict();\n/** C→D: a read's entry with its opt-out keys, or a write's new revision. */\nexport const KnowledgeRecordOk = z\n .object({\n id: z.string().uuid(),\n revision: z.number().int().positive(),\n content: z.string().max(KNOWLEDGE_RECORD_MAX_BYTES).optional(),\n optOut: RecordOptOutKeys.optional()\n})\n .strict();\n/** C→D: the write's base revision is stale; the current entry, to re-read and merge. */\nexport const KnowledgeRecordConflict = z\n .object({\n id: z.string().uuid(),\n revision: z.number().int().positive(),\n content: z.string().max(KNOWLEDGE_RECORD_MAX_BYTES),\n optOut: RecordOptOutKeys\n})\n .strict();\nexport const KnowledgeSearchReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n query: z.string().trim().min(1).max(4096),\n limit: z.number().int().min(1).max(10).default(5),\n maxBytes: z.number().int().min(1).max(32_768).default(8192),\n tags: z.array(z.string().trim().min(1).max(64)).max(10).optional(),\n /** The conversation holds people from outside, or its audience is not known yet: People is left out (§15.3). Sent only under `knowledge-record-v1`. */\n withOutsiders: z.boolean().optional()\n})\n .strict();\nexport const KnowledgeSearchItem = z\n .object({\n id: z.string().uuid(),\n title: z.string(),\n summary: z.string().nullable(),\n tags: z.array(z.string()),\n revision: z.number().int().positive(),\n updatedAt: z.string().datetime(),\n content: z.string(),\n truncated: z.boolean()\n})\n .strict();\nexport const KnowledgeSearchOk = z.object({ items: z.array(KnowledgeSearchItem).max(10) }).strict();\n// List (query-less) recent org knowledge the requester's org can see — the\n// \"browse what already exists\" companion to knowledge/search, so a dreamer can\n// enumerate existing knowledge before proposing new. Reuses KnowledgeSearchOk.\nexport const KnowledgeListReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n limit: z.number().int().min(1).max(20).default(10),\n maxBytes: z.number().int().min(1).max(32_768).default(8192),\n tags: z.array(z.string().trim().min(1).max(64)).max(10).optional(),\n /** As on `knowledge/search`: People is left out. */\n withOutsiders: z.boolean().optional()\n})\n .strict();\n// Its own response cap: `KnowledgeListReq.limit` allows up to 20, so the reply\n// must not reuse the search response's max of 10 (11+ rows would fail codec\n// validation as BAD_PAYLOAD).\nexport const KnowledgeListOk = z.object({ items: z.array(KnowledgeSearchItem).max(20) }).strict();\n// List or search accepted organization skills (managed skill bundles) the\n// requester's org can see. `query` present ⇒ filter by name/description; absent\n// ⇒ list recent. Metadata only (no bundle bytes), so a dreamer can enumerate\n// existing skills and choose update-vs-create.\nexport const OrgSkillsReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n query: z.string().trim().min(1).max(4096).optional(),\n limit: z.number().int().min(1).max(50).default(20)\n})\n .strict();\nexport const OrgSkillItem = z\n .object({\n id: z.string().uuid(),\n name: z.string(),\n description: z.string(),\n revision: z.number().int().positive(),\n updatedAt: z.string().datetime()\n})\n .strict();\nexport const OrgSkillsOk = z.object({ items: z.array(OrgSkillItem).max(50) }).strict();\nexport const OrganizationSuggestionReadReq = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n kind: OrganizationArtifactKind,\n offset: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES).default(0),\n limit: z\n .number()\n .int()\n .positive()\n .max(ORGANIZATION_SUGGESTION_CHUNK_BYTES)\n .default(ORGANIZATION_SUGGESTION_CHUNK_BYTES)\n})\n .strict();\nexport const OrganizationKnowledgeCandidateContent = z\n .object({\n kind: z.literal('knowledge'),\n content: z.string().max(262_144),\n summary: z.string().max(1024).optional(),\n tags: z.array(z.string().min(1).max(64)).max(16).optional()\n})\n .strict();\nexport const OrganizationSkillCandidateContent = z\n .object({\n kind: z.literal('skill'),\n files: z.array(SkillBundleTextFile).min(1).max(64)\n})\n .strict();\nexport const OrganizationSuggestionContentBody = z.discriminatedUnion('kind', [\n OrganizationKnowledgeCandidateContent,\n OrganizationSkillCandidateContent\n]);\n/** Canonical bytes covered by suggestion metadata. Knowledge revisions keep\n * their longstanding content digest; a skill candidate covers its complete,\n * path-sorted file tree. Display metadata is independently compared with the\n * centrally indexed row during review. */\nexport function organizationSuggestionCanonical(body) {\n return body.kind === 'knowledge'\n ? body.content\n : JSON.stringify({\n kind: body.kind,\n // String comparison is locale-independent. `localeCompare` can order the\n // same Unicode paths differently on the daemon and CP hosts, which would\n // make an otherwise identical candidate fail its cross-host digest fence.\n files: [...body.files].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))\n });\n}\n/** Fully assembled application value. It is deliberately not a frame payload;\n * the wire carries {@link OrganizationSuggestionChunk} slices below. */\nexport const OrganizationSuggestionContent = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n exists: z.boolean(),\n body: OrganizationSuggestionContentBody.optional()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (value.exists !== (value.body !== undefined)) {\n ctx.addIssue({ code: 'custom', message: 'body must be present exactly when exists is true' });\n }\n});\nexport const OrganizationSuggestionChunk = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n exists: z.boolean(),\n size: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES),\n offset: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES),\n nextOffset: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES),\n data: z.string().max(Math.ceil(ORGANIZATION_SUGGESTION_CHUNK_BYTES / 3) * 4),\n truncated: z.boolean()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (!value.exists &&\n (value.size !== 0 || value.offset !== 0 || value.nextOffset !== 0 || value.data !== '' || value.truncated)) {\n ctx.addIssue({ code: 'custom', message: 'a missing suggestion chunk must carry an empty zero-length body' });\n }\n if (value.exists &&\n (value.offset > value.size ||\n value.nextOffset < value.offset ||\n value.nextOffset > value.size ||\n value.truncated !== value.nextOffset < value.size)) {\n ctx.addIssue({ code: 'custom', message: 'suggestion chunk offsets must be monotonic and bounded by size' });\n }\n});\nexport const OrganizationSuggestionReviewReq = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n state: z.enum(['accepted', 'rejected'])\n})\n .strict();\n/** D→C: fetch one bounded slice of an immutable accepted `.skill` ZIP. */\nexport const ManagedSkillReadReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n managedSkillId: z.string().uuid(),\n revision: z.number().int().positive(),\n offset: z.number().int().nonnegative().max(524_288).default(0),\n limit: z.number().int().positive().max(131_072).default(131_072)\n})\n .strict();\nexport const ManagedSkillChunk = z\n .object({\n managedSkillId: z.string().uuid(),\n revision: z.number().int().positive(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n size: z.number().int().positive().max(524_288),\n offset: z.number().int().nonnegative().max(524_288),\n nextOffset: z.number().int().nonnegative().max(524_288),\n data: z.string().max(Math.ceil(131_072 / 3) * 4),\n truncated: z.boolean()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (value.offset > value.size ||\n value.nextOffset < value.offset ||\n value.nextOffset > value.size ||\n value.truncated !== value.nextOffset < value.size) {\n ctx.addIssue({ code: 'custom', message: 'managed skill chunk offsets must be monotonic and bounded by size' });\n }\n});\n//# sourceMappingURL=organization-knowledge.js.map","import { z } from 'zod';\nimport { CanonicalMemoryRecord, MemoryPluginHistoryEvent, MemoryPluginOperation } from '../memory-plugin.js';\nimport { SessionUsage } from './session.js';\nimport { OrganizationSuggestionInfo } from './organization-knowledge.js';\n/**\n * Agent memory directory (C→D REQ → REP) — the console's read/write of an agent's\n * long-term memory, and the surface the daemon serves it from.\n *\n * Memory is a DIRECTORY at the agent's ROOT (`<agent-root>/memory/`), OUTSIDE the\n * workspace — so it survives a workspace reset / re-clone and is never committed\n * into a github-workspace repo. It follows the index-plus-topics shape: a lean\n * `MEMORY.md` index (injected into the prompt every session, bounded) plus any\n * number of `<topic>.md` files the agent reads on demand. The agent maintains it\n * via MCP tools; these frames are the third channel — the CP reading/writing it\n * for the console — all pointing at the same directory.\n *\n * The CP stores NO memory content — bytes are pulled live from the owning daemon\n * and proxied to the console, never persisted (body-locality). A not-yet-created\n * file/dir is DATA (`exists:false`), not an error; only an unknown agent or a\n * path-containment violation (`BAD_PAYLOAD`) or an unexpected fs failure\n * (`INTERNAL`) comes back as an `error` frame.\n *\n * - `memory/list`: the topic files in the memory dir (flat; the index + topics).\n * - `memory/read`: one byte slice of a memory file (`path` relative to the memory\n * dir; default `MEMORY.md`). `limit` is a ceiling — the daemon returns fewer\n * bytes to keep the JSON-escaped REP under the 256 KiB frame cap and always ends\n * on a UTF-8 boundary. `nextOffset` is authoritative — do NOT recompute it.\n * - `memory/write`: replace the whole named memory file with `content`.\n * - `memory/history`: page the managed provider's hidden `.history` change log\n * for one file, newest first. The sidecar itself never appears in `memory/list`.\n */\n/** The default file name of the memory index (loaded into the prompt each session). */\nexport const MEMORY_INDEX = 'MEMORY.md';\n/** One entry in a memory-dir listing (name-only; not a path). */\nexport const MemoryEntry = z.object({\n name: z.string(), // file name relative to the memory dir\n size: z.number().int().nonnegative(),\n mtime: z.string() // RFC3339\n});\n/** A channel's memory-folder key (from `memoryChannelKey`) — selects the channel\n * layer for a channel-scoped agent's console reads/writes (#653). Absent ⇒ the\n * agent-level store. Bounded + charset-limited so it can't escape the tree. */\nexport const MemoryChannelKey = z\n .string()\n .min(1)\n .max(120)\n .regex(/^[A-Za-z0-9._-]+$/);\n/** C→D REQ: list the files in the agent's memory dir (or one channel's overlay). */\n/** The console user whose own person layer a read names, set by the CP from the signed-in caller only; never beside a channel key. */\nconst MemoryPersonUserId = z.string().min(1).max(256);\nexport const MemoryListReq = z.object({\n agentId: z.string().min(1), // local agent id (NOT a wire UUID)\n channelKey: MemoryChannelKey.optional(),\n personUserId: MemoryPersonUserId.optional()\n});\n/** C→D REQ: list the channels that have a memory folder for this agent; `channelKey` asks for that one alone (an older daemon lists all). */\nexport const MemoryChannelsReq = z.object({\n agentId: z.string().min(1),\n channelKey: MemoryChannelKey.optional()\n});\n/** One channel with its own memory folder, for the console channel selector. */\nexport const MemoryChannelEntry = z.object({\n channelKey: MemoryChannelKey,\n channel: z.string().optional(), // source channel id (from channel.json), if recorded\n transportScope: z.string().optional(),\n platform: z.string().optional(), // the conversation's platform id, if recorded\n name: z.string().optional() // the conversation's display name when last seen, if recorded\n});\n/** C→D REQ: delete one place layer whole, its change log included, returning no content. */\nexport const MemoryChannelClearReq = z\n .object({\n agentId: z.string().min(1),\n channelKey: MemoryChannelKey\n})\n .strict();\n/** D→C REP: whether there was a layer folder to delete. */\nexport const MemoryChannelClearOk = z\n .object({\n agentId: z.string(),\n channelKey: MemoryChannelKey,\n cleared: z.boolean()\n})\n .strict();\n/** D→C REP: the agent's channel memory folders (empty when none / not channel-scoped). */\nexport const MemoryChannelsPage = z.object({\n agentId: z.string(),\n channels: z.array(MemoryChannelEntry).max(1000)\n});\n/** D→C REP (corr = the req id): the memory dir's files (or `exists:false`). */\nexport const MemoryListPage = z.object({\n agentId: z.string(),\n exists: z.boolean(), // false ⇒ the memory dir does not exist yet (NOT an error)\n entries: z.array(MemoryEntry)\n});\n/** C→D REQ: read one byte slice of a memory file (path relative to the memory dir). */\nexport const MemoryReadReq = z.object({\n agentId: z.string().min(1), // local agent id (NOT a wire UUID)\n channelKey: MemoryChannelKey.optional(),\n personUserId: MemoryPersonUserId.optional(),\n path: z.string().default(MEMORY_INDEX), // memory-dir-relative POSIX path; default the index\n offset: z.number().int().nonnegative().default(0), // byte offset\n limit: z.number().int().positive().max(65536).default(65536) // byte count per slice (64 KiB, see docblock)\n});\n/** D→C REP (corr = the req id): the memory file slice (or `exists:false`). Always utf8 text. */\nexport const MemoryReadContent = z.object({\n agentId: z.string(),\n path: z.string(),\n exists: z.boolean(), // false ⇒ the file does not exist yet (NOT an error)\n size: z.number().int().nonnegative().optional(), // total file size in bytes\n mtime: z.string().optional(), // RFC3339\n content: z.string().optional(), // utf8 text slice\n offset: z.number().int().nonnegative().optional(), // byte offset this slice starts at\n nextOffset: z.number().int().nonnegative().optional(), // byte offset to request next (offset + bytes in this slice)\n truncated: z.boolean().optional() // true ⇒ nextOffset < size (more bytes remain)\n});\n/** C→D REQ: replace the whole named memory file with `content` (console edit). */\nexport const MemoryWriteReq = z.object({\n agentId: z.string().min(1), // local agent id (NOT a wire UUID)\n channelKey: MemoryChannelKey.optional(),\n path: z.string().default(MEMORY_INDEX), // memory-dir-relative POSIX path; default the index\n content: z.string(), // full new file content (utf8); '' clears the file\n // Optimistic concurrency: the mtime the writer last read. When present the write\n // fails (CONFLICT) unless the file still has this mtime — so a console edit can't\n // clobber a newer agent write. Omit to force (last-write-wins).\n ifMatchMtime: z.string().optional()\n});\n/** D→C REP (corr = the req id): the written state, so the console can refresh. */\nexport const MemoryWriteOk = z.object({\n agentId: z.string(),\n path: z.string(),\n size: z.number().int().nonnegative(), // bytes written\n mtime: z.string() // RFC3339 of the write\n});\n/** One provenance entry from managed memory's retained `.history` sidecar. */\nexport const MemoryFileHistoryEvent = z\n .object({\n // Optional while legacy JSONL rows are upgraded on their next read/write.\n id: z.string().uuid().optional(),\n path: z.string().min(1).max(255),\n event: z.enum(['add', 'update', 'delete']),\n before: z.string().max(4001).optional(),\n after: z.string().max(4001),\n at: z.string().datetime(),\n scope: z.literal('agent'),\n source: z.enum(['tool', 'console', 'distill', 'dream']),\n truncated: z.boolean().optional()\n})\n .strict();\n/** C→D REQ: page the history of one managed memory file, newest first. */\nexport const MemoryHistoryReq = z\n .object({\n agentId: z.string().min(1).max(255),\n channelKey: MemoryChannelKey.optional(),\n path: z.string().min(1).max(255),\n // Opaque to callers. This is a stable event ID, so appends and retention\n // cannot shift older pages.\n cursor: z.string().uuid().optional(),\n // Five worst-case escaped before/after snapshots still fit one wire frame.\n limit: z.number().int().positive().max(5).default(5)\n})\n .strict();\n/** D→C REP: one newest-first page from managed memory's change log. */\nexport const MemoryHistoryPage = z\n .object({\n agentId: z.string().min(1).max(255),\n path: z.string().min(1).max(255),\n events: z.array(MemoryFileHistoryEvent).max(5),\n nextCursor: z.string().uuid().optional()\n})\n .strict();\n/**\n * Provider-aware memory administration (M-5C).\n *\n * File frames above remain the managed/native compatibility surface. External\n * providers expose canonical records instead. The CP only sees the neutral\n * `files | records | none` shape and capability names; surface discovery never\n * exposes plugin/backend identity, endpoint details, credentials, or raw MCP\n * tool descriptions. A record may carry the profile's bounded canonical\n * provenance, but core never branches on it. Record bodies transit the CP only\n * as correlated request/reply payloads.\n */\nconst AgentMemoryAdminReq = z.object({ agentId: z.string().min(1) }).strict();\nconst OptionalRecordCursor = z.string().min(1).max(2048).optional();\nconst RecordId = z.string().min(1).max(512);\nconst OperationId = z.string().min(1).max(512);\nconst RecordMetadata = z.record(z.string(), z.unknown());\n/** C→D REQ: discover the provider-neutral administration shape/capabilities. */\nexport const MemorySurfaceReq = AgentMemoryAdminReq;\n/** D→C REP: which console shape is available for this agent. */\nexport const MemorySurfaceInfo = z\n .object({\n agentId: z.string().min(1),\n shape: z.enum(['files', 'records', 'none']),\n capabilities: z.array(MemoryPluginOperation).max(8)\n})\n .strict();\n/** C→D REQ: semantic search over canonical external-memory records. */\nexport const MemoryRecordSearchReq = z\n .object({\n agentId: z.string().min(1),\n query: z.string().min(1).max(32768),\n topK: z.number().int().positive().max(20).default(20),\n maxBytes: z.number().int().positive().max(32768).default(32768)\n})\n .strict();\nexport const MemoryRecordSearchPage = z\n .object({ agentId: z.string().min(1), records: z.array(CanonicalMemoryRecord).max(20) })\n .strict();\n/** C→D REQ: cursor-page the external store without inventing file semantics. */\nexport const MemoryRecordListReq = z\n .object({\n agentId: z.string().min(1),\n cursor: OptionalRecordCursor,\n limit: z.number().int().positive().max(20).default(20)\n})\n .strict();\nexport const MemoryRecordListPage = z\n .object({\n agentId: z.string().min(1),\n records: z.array(CanonicalMemoryRecord).max(20),\n nextCursor: OptionalRecordCursor\n})\n .strict();\nexport const MemoryRecordGetReq = z.object({ agentId: z.string().min(1), id: RecordId }).strict();\nexport const MemoryRecordGetResult = z\n .object({ agentId: z.string().min(1), record: CanonicalMemoryRecord.nullable() })\n .strict();\nexport const MemoryRecordCreateReq = z\n .object({\n agentId: z.string().min(1),\n operationId: OperationId,\n text: z\n .string()\n .min(1)\n .max(128 * 1024),\n metadata: RecordMetadata.optional()\n})\n .strict();\nexport const MemoryRecordCreateResult = z.object({ agentId: z.string().min(1), record: CanonicalMemoryRecord }).strict();\nexport const MemoryRecordUpdateReq = z\n .object({\n agentId: z.string().min(1),\n operationId: OperationId,\n id: RecordId,\n text: z\n .string()\n .min(1)\n .max(128 * 1024),\n metadata: RecordMetadata.optional(),\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryRecordUpdateResult = MemoryRecordCreateResult;\nexport const MemoryRecordDeleteReq = z\n .object({\n agentId: z.string().min(1),\n operationId: OperationId,\n id: RecordId,\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryRecordDeleteResult = z\n .object({ agentId: z.string().min(1), id: RecordId, deleted: z.boolean() })\n .strict();\nexport const MemoryRecordHistoryReq = z\n .object({\n agentId: z.string().min(1),\n id: RecordId,\n cursor: OptionalRecordCursor,\n limit: z.number().int().positive().max(20).default(20)\n})\n .strict();\nexport const MemoryRecordHistoryPage = z\n .object({\n agentId: z.string().min(1),\n events: z.array(MemoryPluginHistoryEvent).max(20),\n nextCursor: OptionalRecordCursor\n})\n .strict();\n/**\n * Memory dreaming (C→D REQ → REP) — offline consolidation jobs over the\n * MANAGED store (design: docs/designs/memory-dreaming.md).\n *\n * A dream reads a snapshot of `<agent-root>/memory/` plus recent session\n * transcripts and stages a rebuilt store under\n * `<agent-root>/memory-dreams/<dreamId>/`; the live store is never modified by\n * a running dream. The CP relays these frames and persists at most the\n * metadata (`DreamInfo`) — staged bodies transit only as correlated\n * request/reply payloads, exactly like `memory/read` (body-locality).\n *\n * - `memory/dream/start|cancel|adopt|discard`: lifecycle commands; each REP is\n * the updated `DreamInfo` so the console can refresh without a second read.\n * - `memory/dream/list|get`: job metadata for the history view.\n * - `memory/dream/files` + `memory/dream/file/read`: browse the STAGED output\n * tree (byte-sliced like `memory/read`; same UTF-8-boundary semantics).\n * - `memory/dream/skill/accept|dismiss`: review actions on mined skill\n * candidates (skills are never auto-adopted; see the design §7).\n */\nexport const DreamStatus = z.enum([\n 'pending',\n 'running',\n 'completed',\n 'failed',\n 'canceled',\n 'adopted',\n 'discarded',\n 'superseded'\n]);\nexport const DreamTrigger = z.enum(['manual', 'schedule', 'auto']);\n/** Review state of one mined skill candidate (design §7). */\nexport const DreamSkillInfo = z\n .object({\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/, 'skill name must be lowercase kebab-case'),\n description: z.string().max(1024),\n state: z.enum(['proposed', 'accepted', 'dismissed'])\n})\n .strict();\n/** Organization candidates have an independent review lifecycle from both the\n * reconstructed memory store and agent-local skill candidates. */\nexport const DreamOrganizationSuggestionInfo = OrganizationSuggestionInfo;\n/** Model-run metering for one dream. Byte counts describe the bounded extraction\n * payload; token/context/cost fields use the same semantics as a normal session. */\nexport const DreamUsage = SessionUsage.extend({\n inputBytes: z.number().int().nonnegative(),\n outputBytes: z.number().int().nonnegative()\n});\n/** Dream job metadata (never staged bodies). The only dream shape the CP may persist. */\nexport const DreamInfo = z\n .object({\n dreamId: z.string().min(1).max(128),\n agentId: z.string().min(1),\n status: DreamStatus,\n trigger: DreamTrigger,\n sessionIds: z.array(z.string().min(1)).max(100),\n snapshotDigest: z.string().min(1).max(128),\n /** The isolated ACP session that executed this dream. It is retained as a\n * metadata-only/background session after the runtime session is discarded,\n * so Sessions can show lifecycle, usage, and safe audit history. */\n executionSessionId: z.string().min(1).optional(),\n runtime: z.string().min(1).optional(),\n model: z.string().min(1).optional(),\n stopReason: z.string().min(1).max(128).optional(),\n /** The store's write counters when it was snapshotted, captured under the\n * memory-dir lock. Adoption compares them with the live counters to tell a\n * distill-only drift — which it may rebase over — from a tool/console write,\n * which must hard-fence to review. These come from the daemon's in-process\n * write ledger, NOT from the best-effort `.history` log, which can silently\n * drop an entry and so cannot authorize anything. */\n snapshotWrites: z\n .object({\n /** Opaque daemon-process/store generation. Counts are comparable only\n * within one generation — a restart resets them, which numeric\n * comparison alone cannot detect. */\n generation: z.string().min(1).max(64),\n total: z.number().int().nonnegative(),\n nonDistill: z.number().int().nonnegative()\n })\n .strict()\n .optional(),\n instructions: z.string().max(4096).optional(),\n skills: z.array(DreamSkillInfo).max(16).optional(),\n organizationSuggestions: z.array(DreamOrganizationSuggestionInfo).max(32).optional(),\n usage: DreamUsage.optional(),\n error: z\n .object({ type: z.string().min(1).max(128), message: z.string().max(2048) })\n .strict()\n .optional(),\n createdAt: z.string(), // RFC3339\n endedAt: z.string().optional() // RFC3339\n})\n .strict();\n/** C→D REQ: start a dream for one agent (managed provider only). */\nexport const DreamStartReq = z\n .object({\n agentId: z.string().min(1),\n trigger: DreamTrigger.default('manual'),\n /** Per-run overrides of the agent's configured dreaming policy. */\n sessionWindow: z.number().int().min(1).max(100).optional(),\n instructions: z.string().max(4096).optional()\n})\n .strict();\n/** D→C REP (corr = the req id): the created/updated dream job. Shared by every\n * lifecycle command so the console always renders from one shape. */\nexport const DreamState = z.object({ dream: DreamInfo }).strict();\n/** C→D REQ: cancel a pending|running dream. */\nexport const DreamCancelReq = z.object({ agentId: z.string().min(1), dreamId: z.string().min(1) }).strict();\n/** C→D REQ: list dream jobs for one agent (newest first; bounded). */\nexport const DreamListReq = z\n .object({\n agentId: z.string().min(1),\n limit: z.number().int().positive().max(50).default(20),\n /** Only dreams still holding an unreviewed skill candidate. These deliberately\n * outlive store adoption/discard, so they must be reachable independently of\n * how deep the newest-first history has grown. */\n pendingSkills: z.boolean().optional()\n})\n .strict();\n/** D→C REP (corr = the req id). */\nexport const DreamListPage = z.object({ agentId: z.string().min(1), dreams: z.array(DreamInfo).max(50) }).strict();\n/** C→D REQ: fetch one dream job's metadata. */\nexport const DreamGetReq = DreamCancelReq;\n/** C→D REQ: adopt a completed dream's staged store (atomic swap + backup). */\nexport const DreamAdoptReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n /** Adopt even when the live store changed since the snapshot (fence override). */\n force: z.boolean().default(false),\n /** Same-bytes review fence (task #36 Phase B): the store review token from\n * `DreamFilesPage.reviewToken`. When present the daemon refuses adoption\n * unless the staged bytes still hash to it, so a re-run/rebase after review\n * forces a re-review. Omitted by auto-adopt (which skips content review). */\n reviewToken: z.string().optional()\n})\n .strict();\n/** C→D REQ: discard a terminal dream's staged output. */\nexport const DreamDiscardReq = DreamCancelReq;\n/** C→D REQ: list the STAGED output files of one dream (review surface). */\nexport const DreamFilesReq = DreamCancelReq;\n/** D→C REP (corr = the req id): staged store listing (or `exists:false`). */\nexport const DreamFilesPage = z\n .object({\n agentId: z.string(),\n dreamId: z.string(),\n exists: z.boolean(), // false ⇒ nothing staged (yet) — DATA, not an error\n entries: z.array(MemoryEntry),\n /** Same-bytes review fence (task #36 Phase B): digest of the staged store the\n * console is reviewing; echo it back as `DreamAdoptReq.reviewToken` to bind\n * adoption to these exact bytes. Present only when `exists`. */\n reviewToken: z.string().optional()\n})\n .strict();\n/** C→D REQ: read one byte slice of a STAGED dream file (semantics of `memory/read`). */\nexport const DreamFileReadReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n path: z.string().default(MEMORY_INDEX),\n offset: z.number().int().nonnegative().default(0),\n limit: z.number().int().positive().max(65536).default(65536)\n})\n .strict();\n/** D→C REP (corr = the req id): the staged file slice (fields as `memory/read/content`). */\nexport const DreamFileReadContent = z\n .object({\n agentId: z.string(),\n dreamId: z.string(),\n path: z.string(),\n exists: z.boolean(),\n size: z.number().int().nonnegative().optional(),\n mtime: z.string().optional(),\n content: z.string().optional(),\n offset: z.number().int().nonnegative().optional(),\n nextOffset: z.number().int().nonnegative().optional(),\n truncated: z.boolean().optional()\n})\n .strict();\n/** C→D REQ: read one staged skill candidate's FULL body for review. Acceptance\n * installs executable instruction content, so the reviewer must be able to see\n * the actual `SKILL.md` and every script — a model-authored name and\n * description cannot be evidence for itself (design §7). */\nexport const DreamSkillReadReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/)\n})\n .strict();\nconst DreamSkillReviewText = z\n .string()\n .max(16_000)\n .refine((value) => new TextEncoder().encode(value).byteLength <= 16_000, {\n message: 'dream skill review text must be at most 16000 UTF-8 bytes'\n});\nexport const DreamSkillContent = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n name: z.string().min(1),\n /** false ⇒ nothing staged under that name (DATA, not an error). */\n exists: z.boolean(),\n skill: DreamSkillReviewText.optional(),\n scripts: z\n .array(z\n .object({\n path: z.string().regex(/^[a-z0-9][a-z0-9._-]{0,62}$/),\n content: DreamSkillReviewText\n })\n .strict())\n .max(4)\n .optional(),\n /** Same-bytes review fence (task #36 Phase B): canonical digest of the staged\n * skill the console is reviewing; echo it back as\n * `DreamSkillReviewReq.reviewToken` on Accept to bind publication to these\n * exact bytes. Present only when `exists`. */\n reviewToken: z.string().optional()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (value.exists !== (value.skill !== undefined)) {\n ctx.addIssue({ code: 'custom', message: 'skill must be present exactly when exists is true' });\n }\n if (!value.exists && value.scripts !== undefined) {\n ctx.addIssue({ code: 'custom', message: 'a missing dream skill cannot carry scripts' });\n }\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 180_000) {\n ctx.addIssue({ code: 'custom', message: 'dream skill review response exceeds its wire budget' });\n }\n});\n/** C→D REQ: accept or dismiss one mined skill candidate (design §7). */\nexport const DreamSkillReviewReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),\n /** Same-bytes review fence (task #36 Phase B): the skill review token from\n * `DreamSkillContent.reviewToken`. Used on Accept — publication refuses\n * unless the captured snapshot hashes to it; ignored on Dismiss. */\n reviewToken: z.string().optional()\n})\n .strict();\n//# sourceMappingURL=memory.js.map","import { z } from 'zod';\nimport { REPLY_BUDGET } from '../wire.js';\nimport { MemoryFileHistoryEvent } from './memory.js';\n// The managed memory tree's file-system op set as a wire contract (memory-evolution.md §3.2.1), spoken by two carriers.\n// On the sandbox shim channel `root` is pod-absolute; on the `memory/store` pair below it is relative to the agent's tree.\nconst MemoryFsRoot = z.string().min(1).max(4096);\n// A POSIX path under `root`; lexical containment is checked by whichever side holds the files, never by the sender.\nconst MemoryFsRel = z.string().max(4096);\n// A read answers one budgeted slice at `offset`; a write is appended chunks into a sibling temp file, then one commit.\nexport const MemoryFsPayloadSchema = z.discriminatedUnion('op', [\n z.object({\n op: z.literal('memory-read'),\n root: MemoryFsRoot,\n rel: MemoryFsRel,\n offset: z.number().int().nonnegative(),\n limit: z.number().int().positive().max(REPLY_BUDGET),\n encoding: z.enum(['utf8', 'base64']).optional()\n }),\n z.object({\n op: z.literal('memory-append'),\n root: MemoryFsRoot,\n rel: MemoryFsRel,\n content: z.string(),\n encoding: z.enum(['utf8', 'base64']).optional(),\n create: z.boolean(),\n mode: z.number().int().optional()\n }),\n // Publish `temp` as `rel` by one rename; `ifMatchMtime` is the optimistic precondition checked in the same step.\n z.object({\n op: z.literal('memory-commit'),\n root: MemoryFsRoot,\n rel: MemoryFsRel,\n temp: MemoryFsRel,\n ifMatchMtime: z.string().optional()\n }),\n z.object({ op: z.literal('memory-create-commit'), root: MemoryFsRoot, rel: MemoryFsRel, temp: MemoryFsRel }),\n z.object({ op: z.literal('memory-stat'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-readdir'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-mkdir'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-rmdir'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-rename'), root: MemoryFsRoot, from: MemoryFsRel, to: MemoryFsRel }),\n z.object({ op: z.literal('memory-rm'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-utimes'), root: MemoryFsRoot, rel: MemoryFsRel, mtime: z.string() })\n]);\n// `memory-read`: a missing file is data, not an error; `nextOffset` is authoritative for the next slice.\nexport const MemoryFsReadReplySchema = z.discriminatedUnion('exists', [\n z.object({ exists: z.literal(false) }),\n z.object({\n exists: z.literal(true),\n size: z.number().int().nonnegative(),\n mtime: z.string(),\n content: z.string(),\n nextOffset: z.number().int().nonnegative()\n })\n]);\n/** `memory-append`: the staged file's size once the chunk landed. */\nexport const MemoryFsAppendReplySchema = z.object({ size: z.number().int().nonnegative() });\n/** `memory-commit`: the published file's stat; its `mtime` is the token the next precondition compares. */\nexport const MemoryFsCommitReplySchema = z.object({ size: z.number().int().nonnegative(), mtime: z.string() });\n/** `memory-stat`: what one path IS, never following a symlink; `other` covers a link and every non-regular entry. */\nexport const MemoryFsStatReplySchema = z.enum(['file', 'dir', 'missing', 'other']);\n/** `memory-readdir`: the entries directly under `rel`. */\nexport const MemoryFsReaddirReplySchema = z.array(z.object({\n name: z.string(),\n kind: z.enum(['file', 'dir', 'other']),\n size: z.number().int().nonnegative().optional(),\n mtime: z.string().optional()\n}));\n// `memory-rename` and `memory-rmdir` answer whether anything moved or went; `mkdir`, `rm` and `utimes` answer null.\n// The carrier's answer: `value` is the op's reply above, and the two typed refusals ride as data, not as an error.\nexport const MemoryFsReplySchema = z.discriminatedUnion('ok', [\n z.object({ ok: z.literal(true), value: z.unknown() }),\n z.object({\n ok: z.literal(false),\n refusal: z.object({ kind: z.enum(['path', 'conflict']), message: z.string().max(500) })\n })\n]);\n/** CP applies a `memory/store` carrying `operationId` at most once, answering a re-send with the stored reply. */\nexport const AGENT_MEMORY_STORE_OPERATION_ID_V1_FEATURE = 'agent-memory-store-operation-id-v1';\n// D→C REQ `memory/store`: one op against the named agent's `control-plane` home; the REP is `MemoryFsReplySchema`.\n// Error REPs: `SCOPE_DENIED` (agent not served here, or its home is not the CP), `BAD_PAYLOAD`, `INTERNAL`.\nexport const MemoryStoreReq = z\n .object({\n agentId: z.string().uuid(),\n op: MemoryFsPayloadSchema,\n // One write's identity across a re-send; only a CP advertising the feature above accepts it.\n operationId: z.string().uuid().optional()\n})\n .strict();\n/** Records per change-log batch; the byte refinement on the request is the bound that keeps it in one frame. */\nexport const MEMORY_HISTORY_APPEND_MAX_RECORDS = 64;\n// D→C REQ `memory/history/append`: best-effort provenance for writes already made to one store (`root`), one frame.\n// Error REPs as `memory/store`; the sender packs batches under `REPLY_BUDGET` and never reads the log back.\nexport const MemoryHistoryAppendReq = z\n .object({\n agentId: z.string().uuid(),\n root: MemoryFsRoot,\n records: z.array(MemoryFileHistoryEvent).min(1).max(MEMORY_HISTORY_APPEND_MAX_RECORDS)\n})\n .strict()\n .superRefine((value, ctx) => {\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > REPLY_BUDGET) {\n ctx.addIssue({ code: 'custom', path: ['records'], message: 'memory history batch exceeds the frame budget' });\n }\n});\n/** C→D REP `memory/history/append/ok`. */\nexport const MemoryHistoryAppendOk = z.object({ accepted: z.literal(true) });\n/** A CP that pages a `control-plane` home's change log back to its daemon over `memory/history/read`. */\nexport const AGENT_MEMORY_HISTORY_READ_V1_FEATURE = 'agent-memory-history-read-v1';\n// D→C REQ `memory/history/read`: one newest-first page of one file's change log in a CP-homed store (`root` as in\n// `memory/history/append`), so the daemon can answer the common entry history for every home. Error REPs as `memory/store`.\nexport const MemoryHistoryReadReq = z\n .object({\n agentId: z.string().uuid(),\n root: MemoryFsRoot,\n path: z.string().min(1).max(255),\n cursor: z.string().uuid().optional(),\n limit: z.number().int().positive().max(5).default(5)\n})\n .strict();\n/** C→D REP `memory/history/read/ok`: the page in the sidecar's shape; `nextCursor` is the next not-yet-returned record. */\nexport const MemoryHistoryReadOk = z\n .object({ events: z.array(MemoryFileHistoryEvent).max(5), nextCursor: z.string().uuid().optional() })\n .strict();\n// D→C REQ `memory/home/migrated`: the one-way `daemon` → `control-plane` copy of this agent's tree is complete.\n// Not a store op, because it is not a file operation. Error REPs: `SCOPE_DENIED`, `CONFLICT` (home is no longer the CP).\nexport const MemoryHomeMigratedReq = z.object({ agentId: z.string().uuid() }).strict();\n/** C→D REP `memory/home/migrated/ok`: the CP recorded the completion on the binding. */\nexport const MemoryHomeMigratedOk = z.object({ accepted: z.literal(true) });\n//# sourceMappingURL=memory-store.js.map","import { z } from 'zod';\nexport const MEMORY_ENTRIES_VERSION = 1;\nexport const MEMORY_ENTRY_FRAME_BYTES = 64 * 1024;\nexport const MEMORY_ENTRY_REF_MAX_LENGTH = 4096;\nexport const MemoryEntryRef = z.string().min(1).max(MEMORY_ENTRY_REF_MAX_LENGTH);\nexport const MemoryEntryCursor = z.string().min(1).max(2048);\nexport const MemoryEntryOperation = z.enum(['list', 'get', 'search', 'create', 'update', 'delete', 'history']);\nexport const MemoryEntryCapabilities = z\n .object({\n version: z.literal(MEMORY_ENTRIES_VERSION),\n operations: z.array(MemoryEntryOperation),\n searchKind: z.enum(['lexical', 'semantic', 'hybrid']).optional(),\n supportedScopes: z.array(z.enum(['agent', 'channel'])),\n writeConsistency: z.enum(['conditional', 'last-write-wins']),\n exactEdit: z.boolean(),\n exactCreate: z.boolean(),\n enumeration: z.enum(['snapshot', 'live', 'unavailable']),\n graph: z.boolean(),\n limits: z.object({\n maxMutationRequestBytes: z.number().int().positive().optional(),\n maxItemBytes: z.number().int().positive(),\n maxPageItems: z.number().int().min(1).max(100)\n })\n})\n .strict();\nexport const MemoryEntrySummary = z\n .object({\n ref: MemoryEntryRef,\n label: z.string().max(512),\n description: z.string().max(1024).optional(),\n format: z.enum(['markdown', 'text']),\n byteSize: z.number().int().nonnegative(),\n createdAt: z.string().optional(),\n updatedAt: z.string().optional(),\n revision: z.string().max(512).optional(),\n origin: z.enum(['active', 'inherited']),\n editable: z.boolean()\n})\n .strict();\nexport const MemoryEntryListRequest = z\n .object({\n cursor: MemoryEntryCursor.optional(),\n limit: z.number().int().min(1).max(100).default(20)\n})\n .strict();\nexport const MemoryEntryListResult = z\n .object({\n entries: z.array(MemoryEntrySummary).max(100),\n nextCursor: MemoryEntryCursor.optional(),\n consistency: z.enum(['snapshot', 'live']),\n order: z.enum(['topic', 'backend']),\n catalogRevision: z.string().max(512).optional()\n})\n .strict();\nexport const MemoryEntryGetRequest = z\n .object({\n ref: MemoryEntryRef,\n cursor: MemoryEntryCursor.optional(),\n maxBytes: z\n .number()\n .int()\n .min(4)\n .max(32 * 1024)\n .default(32 * 1024)\n})\n .strict();\nexport const MemoryEntryLink = z\n .object({ label: z.string().max(512), ref: MemoryEntryRef.optional(), exists: z.boolean() })\n .strict();\nexport const MemoryEntryContent = z\n .object({\n entry: MemoryEntrySummary,\n text: z.string(),\n complete: z.boolean(),\n nextContentCursor: MemoryEntryCursor.optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n links: z.array(MemoryEntryLink).max(20).optional(),\n backlinks: z.array(MemoryEntryLink).max(20).optional()\n})\n .strict();\nexport const MemoryEntrySearchRequest = z\n .object({ query: z.string().min(1).max(2048), limit: z.number().int().min(1).max(20).default(5) })\n .strict();\nexport const MemoryEntrySearchHit = z.object({ entry: MemoryEntrySummary, snippet: z.string().max(1024) }).strict();\n// Search is retrieval, never enumeration: the kind and coverage say what the hits can and cannot prove.\nexport const MemoryEntrySearchResult = z\n .object({\n hits: z.array(MemoryEntrySearchHit).max(20),\n kind: z.enum(['lexical', 'semantic', 'hybrid', 'unknown']),\n coverage: z.enum(['complete', 'partial', 'unknown'])\n})\n .strict();\nexport const MemoryEntryHistoryRequest = z\n .object({\n ref: MemoryEntryRef,\n cursor: MemoryEntryCursor.optional(),\n limit: z.number().int().min(1).max(5).default(5)\n})\n .strict();\n// A console-side audit view: what changed, by whom, with bounded snapshots; never model-readable authority.\nexport const MemoryEntryHistoryEvent = z\n .object({\n id: z.string().max(512).optional(),\n kind: z.enum(['create', 'update', 'delete']),\n at: z.string().optional(),\n source: z.enum(['tool', 'console', 'distill', 'dream']).optional(),\n before: z.string().max(4001).optional(),\n after: z.string().max(4001).optional(),\n truncated: z.boolean().optional()\n})\n .strict();\nexport const MemoryEntryHistoryResult = z\n .object({\n events: z.array(MemoryEntryHistoryEvent).max(5),\n nextCursor: MemoryEntryCursor.optional(),\n order: z.enum(['newest-first', 'backend'])\n})\n .strict();\nexport const MemoryContextRequest = z\n .object({\n seenRevision: z.string().max(512).optional(),\n maxBytes: z\n .number()\n .int()\n .min(4)\n .max(32 * 1024)\n .default(25_000)\n})\n .strict();\nexport const MemoryContextResult = z\n .object({\n catalogRevision: z.string().max(512).optional(),\n freshness: z.enum(['current', 'cached', 'unknown']),\n coverage: z.enum(['complete', 'partial', 'unavailable']),\n overview: z.string()\n})\n .strict();\nexport const MemoryEntryErrorCode = z.enum([\n 'UNSUPPORTED',\n 'FORBIDDEN',\n 'NOT_FOUND',\n 'INVALID_ARGUMENT',\n 'CONFLICT',\n 'STALE_BINDING',\n 'CURSOR_EXPIRED',\n 'TOO_LARGE',\n 'UNAVAILABLE',\n 'AMBIGUOUS_WRITE'\n]);\nconst mutationText = z.string().max(256_000);\nconst mutationMetadata = z.record(z.string(), z.unknown()).optional();\nexport const MemoryEntryCreateRequest = z\n .object({ label: z.string().min(1).max(512).optional(), text: mutationText, metadata: mutationMetadata })\n .strict();\nconst updateTarget = {\n ref: MemoryEntryRef,\n revision: z.string().min(1).max(512).optional(),\n metadata: mutationMetadata\n};\nexport const MemoryEntryUpdateRequest = z.union([\n z.object({ ...updateTarget, text: mutationText }).strict(),\n z\n .object({ ...updateTarget, edit: z.object({ oldText: mutationText.min(1), newText: mutationText }).strict() })\n .strict()\n]);\nexport const MemoryEntryDeleteRequest = z\n .object({ ref: MemoryEntryRef, revision: z.string().min(1).max(512).optional() })\n .strict();\nexport const MemoryEntryMutationReceipt = z\n .object({\n operationId: z.string().uuid(),\n state: z.literal('completed'),\n entry: MemoryEntrySummary.optional(),\n deletedRef: MemoryEntryRef.optional(),\n catalogRevision: z.string().max(512).optional()\n})\n .strict();\n//# sourceMappingURL=memory-entries.js.map","import { z } from 'zod';\nimport { MemoryEntryErrorCode } from '../memory-entries.js';\nexport const MEMORY_TRANSACTION_V1_FEATURE = 'memory-transaction-v1';\nexport const MEMORY_CAPTURE_FENCE_V1_FEATURE = 'memory-capture-fence-v1';\nconst digest = z.string().regex(/^[0-9a-f]{64}$/);\nexport const MemoryTransactionPath = z\n .string()\n .min(1)\n .max(256)\n .regex(/^[^./\\\\\\0][^/\\\\\\0]*\\.md$/);\nconst change = z.discriminatedUnion('action', [\n z\n .object({\n action: z.literal('put'),\n path: MemoryTransactionPath,\n expectedRevision: digest.nullable(),\n temp: z.string().regex(/^\\.agentconnect-memory-[0-9a-f-]{36}\\.tmp$/),\n stagedRevision: digest\n })\n .strict(),\n z.object({ action: z.literal('delete'), path: MemoryTransactionPath, expectedRevision: digest }).strict()\n]);\nconst scope = z.object({ agentId: z.string().uuid(), root: z.string().min(1).max(1024) });\nexport const MemoryTransactionReq = z.discriminatedUnion('operation', [\n scope.extend({ operation: z.literal('snapshot') }).strict(),\n scope.extend({ operation: z.literal('capture-status'), sourceTurnId: z.string().uuid() }).strict(),\n scope\n .extend({\n operation: z.literal('commit'),\n operationId: z.string().uuid(),\n expectedRevision: digest,\n source: z.enum(['tool', 'console', 'distill', 'dream']),\n sourceTurnId: z.string().uuid().optional(),\n changes: z\n .array(change)\n .min(1)\n .max(2)\n .refine((changes) => new Set(changes.map((change) => change.path)).size === changes.length, 'duplicate paths')\n .refine((changes) => {\n const temps = changes.flatMap((change) => (change.action === 'put' ? [change.temp] : []));\n return new Set(temps).size === temps.length;\n }, 'duplicate staging files')\n })\n .strict()\n]);\nexport const MemoryTransactionReceipt = z\n .object({\n operationId: z.string().uuid(),\n revision: digest,\n committedAt: z.string().datetime(),\n files: z\n .array(z\n .object({ path: MemoryTransactionPath, revision: digest.nullable(), mtime: z.string().datetime().nullable() })\n .strict())\n .max(2)\n})\n .strict();\nexport const MemoryTransactionResult = z.discriminatedUnion('operation', [\n z.object({ operation: z.literal('snapshot'), revision: digest }).strict(),\n z.object({ operation: z.literal('capture-status'), suppressed: z.boolean() }).strict(),\n z.object({ operation: z.literal('commit'), receipt: MemoryTransactionReceipt, replayed: z.boolean() }).strict(),\n z.object({ operation: z.literal('error'), code: MemoryEntryErrorCode, message: z.string().max(512) }).strict()\n]);\n//# sourceMappingURL=memory-transaction.js.map","/** Transport-free representation of a typed wire `error` REP. */\nexport class WireError extends Error {\n code;\n retryable;\n details;\n constructor(code, message, retryable = false, details) {\n super(message);\n this.name = 'WireError';\n this.code = code;\n this.retryable = retryable;\n if (details)\n this.details = details;\n }\n}\nexport class ReqRep {\n clock;\n ackTimeoutMs;\n maxTries;\n pending = new Map();\n constructor(clock, ackTimeoutMs, maxTries = 5) {\n this.clock = clock;\n this.ackTimeoutMs = ackTimeoutMs;\n this.maxTries = maxTries;\n }\n request(frame, write, opts = {}) {\n const encoded = JSON.stringify(frame);\n return new Promise((resolve, reject) => {\n const entry = {\n id: frame.id,\n request: { type: frame.type, ...(frame.orgId ? { orgId: frame.orgId } : {}) },\n encoded,\n resolve,\n reject,\n tries: 1,\n maxTries: opts.maxTries ?? this.maxTries\n };\n this.pending.set(frame.id, entry);\n this.arm(entry, write, opts.ackTimeoutMs ?? this.ackTimeoutMs);\n // A dead transport must reject THIS request — never throw into the caller\n // (or, on the timer path below, crash the process as an uncaught throw).\n try {\n write(encoded);\n }\n catch (e) {\n this.fail(entry, new WireError('INTERNAL', `send failed: ${e.message}`, true));\n }\n });\n }\n arm(entry, write, ackTimeoutMs) {\n entry.timer = this.clock.setTimeout(() => {\n if (!this.pending.has(entry.id))\n return;\n if (entry.tries >= entry.maxTries) {\n this.pending.delete(entry.id);\n entry.reject(new WireError('INTERNAL', `no ack after ${entry.maxTries} tries for ${entry.id}`, true));\n return;\n }\n entry.tries += 1;\n this.arm(entry, write, ackTimeoutMs);\n try {\n write(entry.encoded);\n }\n catch (e) {\n this.fail(entry, new WireError('INTERNAL', `send failed: ${e.message}`, true));\n }\n }, ackTimeoutMs);\n }\n fail(entry, err) {\n if (!this.pending.has(entry.id))\n return;\n this.pending.delete(entry.id);\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.reject(err);\n }\n /**\n * Settle a pending REQ from an inbound correlated frame. Returns true when\n * `frame.corr` matched a pending REQ (a REP resolves it; an `error` frame\n * rejects with a {@link WireError}), false when it correlates nothing.\n */\n settle(frame) {\n const corr = frame.corr;\n if (!corr)\n return false;\n if (frame.type === 'error') {\n const e = frame.payload;\n return this.reject(corr, new WireError(e.code, e.message, e.retryable, e.details));\n }\n const entry = this.pending.get(corr);\n if (!entry)\n return false;\n this.pending.delete(corr);\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.resolve(frame);\n return true;\n }\n /** The still-pending REQ a reply with `corr` would settle, if any — read before `settle` to fence the reply. */\n requested(corr) {\n return this.pending.get(corr)?.request;\n }\n /** Reject one pending request by correlation id (e.g. a REP whose envelope is\n * valid but whose payload cannot be decoded). Returns false when nothing matches. */\n reject(corr, err) {\n const entry = this.pending.get(corr);\n if (!entry)\n return false;\n this.pending.delete(corr);\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.reject(err);\n return true;\n }\n inflight() {\n return this.pending.size;\n }\n rejectAll(err) {\n for (const entry of this.pending.values()) {\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.reject(err);\n }\n this.pending.clear();\n }\n}\n//# sourceMappingURL=correlator.js.map"],"mappings":";;;;;AAGA,MAAa,mBAAmBA,OAAS,CAAC,CAAC,MAAM,kBAAkB;;AAEnE,MAAa,mBAAmBC,MAAO;CAAC;CAAO;CAAW;CAAmB;AAAM,CAAC;;AAEpF,MAAa,oBAAoBA,MAAO;CAAC;CAAO;CAAS;AAAQ,CAAC;;AAElE,MAAa,eAAeA,MAAO,CAAC,iBAAiB,UAAU,CAAC;;;;;;;;;;;AAWhE,MAAa,qBAAqBC,OAAS;CACvC,gBAAgB;CAChB,kBAAkB;CAClB,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IAAI;EACxB,IAAI,MAAM,UAAU,KAAA,GAChB,KAAK,MAAM,aAAa,MAAM,KAAK;EACvC,MAAM,QAAQ,KAAK;EACnB,OAAO;CACX;;CAEA,UAAU,MAAM;EACZ,OAAO,KAAK,QAAQ,IAAI,IAAI,CAAC,EAAE;CACnC;;;CAGA,OAAO,MAAM,KAAK;EACd,MAAM,QAAQ,KAAK,QAAQ,IAAI,IAAI;EACnC,IAAI,CAAC,OACD,OAAO;EACX,KAAK,QAAQ,OAAO,IAAI;EACxB,IAAI,MAAM,UAAU,KAAA,GAChB,KAAK,MAAM,aAAa,MAAM,KAAK;EACvC,MAAM,OAAO,GAAG;EAChB,OAAO;CACX;CACA,WAAW;EACP,OAAO,KAAK,QAAQ;CACxB;CACA,UAAU,KAAK;EACX,KAAK,MAAM,SAAS,KAAK,QAAQ,OAAO,GAAG;GACvC,IAAI,MAAM,UAAU,KAAA,GAChB,KAAK,MAAM,aAAa,MAAM,KAAK;GACvC,MAAM,OAAO,GAAG;EACpB;EACA,KAAK,QAAQ,MAAM;CACvB;AACJ"}
1
+ {"version":3,"file":"correlator-DCB1Q6aH.js","names":["z.string","z.enum","z.object","z\n .object","z.number","z.boolean","z.discriminatedUnion","z.literal","z\n .string","z.array","z\n .object","z.discriminatedUnion","z\n .object","z.literal","z.string","z.object","z.enum","z\n .object","z.boolean","z.object","z\n .string","z.enum","z.number","z.discriminatedUnion","z.literal","z.string","z\n .string","z.boolean","z\n .enum","z.array","z.union","z.record","z.unknown","z\n .object","z\n .object","z.object","z.number","z.string","z.array","z.unknown","z.boolean","z.enum","z\n .object","z.record","z\n .object","z\n .string","z\n .enum","z.enum","z.object","z.string","z.number","z\n .string","z\n .object","z\n .array","z.array","z.boolean","z.enum","z\n .object","z.string","z.number","z.array","z\n .number","z\n .array","z.object","z\n .object","z.boolean","z.literal","z.discriminatedUnion","z.object","z.string","z.number","z\n .string","z\n .object","z.boolean","z.array","z.enum","z.literal","z.record","z.unknown","z\n .string","z\n .object","z\n .array","z.string","z.discriminatedUnion","z.object","z.literal","z.number","z.enum","z.boolean","z.array","z.unknown","z\n .object","z.string","z.enum","z\n .object","z.literal","z.array","z.boolean","z.object","z.number","z\n .number","z.record","z.unknown","z.union","z\n .object","z.string","z\n .string","z.discriminatedUnion","z\n .object","z.literal","z.object","z.enum","z\n .array","z\n .object","z\n .array","z.boolean"],"sources":["../../protocol/dist/frames/hook.js","../../protocol/dist/mcp-app.js","../../protocol/dist/frames/webchat.js","../../protocol/dist/frames/session.js","../../protocol/dist/frames/follow-up-watch.js","../../protocol/dist/frames/organization-knowledge.js","../../protocol/dist/frames/memory.js","../../protocol/dist/frames/memory-store.js","../../protocol/dist/memory-entries.js","../../protocol/dist/frames/memory-transaction.js","../../connection/dist/correlator.js"],"sourcesContent":["import { z } from 'zod';\nimport { CodeHostExternalId, CodeHostProviderString, HOOK_KINDS } from '../code-host.js';\n/** Decimal wire form for Prisma/GitHub bigint values. */\nexport const HookBigIntString = z.string().regex(/^(?:0|[1-9]\\d*)$/);\n/** The highest formal-review event one hook permits. */\nexport const HookReviewPolicy = z.enum(['off', 'comment', 'request_changes', 'full']);\n/** External run-reporting transport. `status` is reserved for the later R3. */\nexport const HookReportingMode = z.enum(['off', 'check', 'status']);\n/** R2a only admits informational; `required` remains a fail-closed future mode. */\nexport const HookGateMode = z.enum(['informational', 'required']);\n/**\n * Exact config + dispatch identity captured when the CP compiles a hook fire.\n *\n * The relay-facing frames expose these fields individually at top level so an\n * older CP/relay can omit them without making the whole fire undecodable. A\n * consumer MUST have every field before enabling review/reporting; absence is\n * not filled with a revision and therefore fails closed. Action-time RPCs use\n * this complete object so a partially rolled-out tuple cannot authorize an\n * effect.\n */\nexport const HookConfigSnapshot = z.object({\n configRevision: HookBigIntString,\n dispatchRevision: HookBigIntString,\n dispatchDaemonId: z.string().uuid(),\n reviewPolicy: HookReviewPolicy,\n reportingMode: HookReportingMode,\n gateMode: HookGateMode\n});\n/** Optional top-level form used only on rolling-compatible delivery frames. */\nexport const OptionalHookConfigSnapshot = HookConfigSnapshot.partial();\n/** Signature-verified, body-free GitHub subject/revision metadata; optional review and comment ids preserve mixed-version decoding. */\nexport const GithubHookMetadata = z\n .object({\n repoId: HookBigIntString,\n repoFullName: z.string().min(1),\n sourceInstallationId: HookBigIntString,\n subjectKind: z.enum(['issue', 'pull_request']),\n pullNumber: z.number().int().positive().optional(),\n headSha: z.string().min(1).optional(),\n baseSha: z.string().min(1).optional(),\n reportSha: z.string().min(1).optional(),\n headRepoFullName: z.string().min(1).optional(),\n mergeCommitSha: z.string().min(1).optional(),\n isDraft: z.boolean().optional(),\n baseChanged: z.boolean().optional(),\n // Relay-derived from a newly-authored PR conversation comment that\n // explicitly mentions this agent or the App while the accepted rule\n // enables formal reviews. The body stays off the CP wire; only this\n // trusted routing fact reopens the review generation.\n explicitReviewRequest: z.boolean().optional(),\n pullRequestReviewId: HookBigIntString.refine((value) => value !== '0').optional(),\n reviewCommentId: HookBigIntString.optional(),\n reviewThreadRootCommentId: HookBigIntString.optional(),\n // The `issue_comment` delivery's own comment id — the exact acknowledgement-reaction\n // target. `reviewCommentId` above is the same fact for an inline review comment; a\n // delivery with neither was fired by the subject itself.\n issueCommentId: HookBigIntString.optional()\n})\n .superRefine((value, ctx) => {\n if (value.subjectKind === 'pull_request' && value.pullNumber === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['pullNumber'],\n message: 'pullNumber is required for a pull_request subject'\n });\n }\n if (value.reportSha !== undefined && value.headSha === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['reportSha'],\n message: 'reportSha requires an authoritative headSha'\n });\n }\n if (value.reportSha !== undefined && value.headSha !== undefined && value.reportSha !== value.headSha) {\n ctx.addIssue({\n code: 'custom',\n path: ['reportSha'],\n message: 'R2a reports only the authoritative pull head SHA'\n });\n }\n});\n/** GitHub folds target-branch changes into `pull_request:edited`; only the signed `changes.base` fact makes that edit a revision. */\nexport function isGithubPullRequestRevisionEvent(event, github) {\n return (event === 'pull_request:opened' ||\n event === 'pull_request:synchronize' ||\n (event === 'pull_request:edited' && github?.baseChanged === true));\n}\n/** Actions `release:*` skips: `created` saves a draft or precedes `published`; `released`/`prereleased` restate a publish or an edit. */\nexport const GITHUB_RELEASE_RESTATED_EVENTS = new Set([\n 'release:created',\n 'release:released',\n 'release:prereleased'\n]);\n/** One GitLab hook subject: issue/MR by IID, or a standalone push ref (gitlab-com-integration.md §17.2). */\nexport const GitlabHookTarget = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('issue'), iid: z.number().int().positive() }),\n z.object({\n kind: z.literal('merge_request'),\n iid: z.number().int().positive(),\n // Source-project + revision facts, present when the verified payload carries them.\n sourceProjectId: HookBigIntString.optional(),\n headSha: z.string().min(1).optional(),\n baseSha: z.string().min(1).optional(),\n isDraft: z.boolean().optional(),\n // Relay-derived trusted routing fact (reviewer request / authorized mention);\n // authored text stays off the CP wire, exactly like explicitReviewRequest above.\n explicitReviewRequest: z.boolean().optional()\n }),\n z.object({ kind: z.literal('push'), ref: z.string().min(1) }),\n // Every release of the repository continues one session; an older daemon cannot decode this member (RD_CODEHOST_RELEASE_V1).\n z.object({ kind: z.literal('release'), tag: z.string().min(1) })\n]);\n/** Signature-verified, body-free GitLab subject metadata — the trusted normalization\n * discriminator the daemon recomputes session keys from; never inferred from model-visible text. */\nexport const GitlabHookMetadata = z.object({\n projectId: HookBigIntString,\n projectPath: z.string().min(1), // current namespaced path — display only, never a match key\n webhookId: HookBigIntString.optional(),\n // The instance this delivery came from, copied from the compiled rule and never read\n // off the payload (§24.4). The turn-time fence: a delivery whose host disagrees with the\n // session's spec-carried host is refused, never re-targeted. Absent means GitLab.com.\n host: z.string().optional(),\n target: GitlabHookTarget,\n // The note delivery's own id — GitLab's counterpart of `issueCommentId`, and the exact\n // acknowledgement-reaction target. Absent ⇒ the subject itself fired this delivery.\n noteId: HookBigIntString.optional()\n});\n/** One Gitea hook subject (gitea-integration.md §8): issues and pull requests share one index space, so the subject kind is the discriminator. */\nexport const GiteaHookTarget = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('issue'), index: z.number().int().positive() }),\n z.object({\n kind: z.literal('pull'),\n index: z.number().int().positive(),\n // Source-repository + revision facts, present when the verified payload carries them.\n sourceRepoId: HookBigIntString.optional(),\n headSha: z.string().min(1).optional(),\n baseSha: z.string().min(1).optional(),\n isDraft: z.boolean().optional(),\n // Relay-derived trusted routing fact (reviewer request / authorized mention); authored text stays off the CP wire.\n explicitReviewRequest: z.boolean().optional()\n }),\n z.object({ kind: z.literal('push'), ref: z.string().min(1) }),\n // Every release of the repository continues one session; an older daemon cannot decode this member (RD_CODEHOST_RELEASE_V1).\n z.object({ kind: z.literal('release'), tag: z.string().min(1) })\n]);\n/** Signature-verified, body-free Gitea subject metadata — the trusted normalization\n * discriminator the daemon recomputes session keys from; never inferred from model-visible text. */\nexport const GiteaHookMetadata = z.object({\n repoId: HookBigIntString,\n repoPath: z.string().min(1), // current owner/repo — display only, never a match key\n webhookId: HookBigIntString.optional(),\n // The instance this delivery came from, copied from the compiled rule and never read off the\n // payload (gitea-integration.md §3). The turn-time fence: a delivery whose host disagrees with\n // the session's spec-carried host is refused, never re-targeted. Absent means gitea.com.\n host: z.string().optional(),\n target: GiteaHookTarget,\n // The comment delivery's own id — Gitea's counterpart of `issueCommentId`, and the exact\n // acknowledgement-reaction target. Absent means the subject itself fired this delivery.\n commentId: HookBigIntString.optional()\n});\n/** Every member a frame carries, in provider order — a well-formed frame carries at most one; a new provider adds its arm here. */\nfunction codeHostHookMembers(frame) {\n const members = [];\n if (frame.github) {\n const { repoId: externalId, repoFullName: path } = frame.github;\n members.push({ provider: 'github', repo: { provider: 'github', externalId, path }, metadata: frame.github });\n }\n if (frame.gitlab) {\n const { projectId: externalId, projectPath: path } = frame.gitlab;\n members.push({ provider: 'gitlab', repo: { provider: 'gitlab', externalId, path }, metadata: frame.gitlab });\n }\n if (frame.gitea) {\n const { repoId: externalId, repoPath: path } = frame.gitea;\n members.push({ provider: 'gitea', repo: { provider: 'gitea', externalId, path }, metadata: frame.gitea });\n }\n return members;\n}\n/** The one provider member a frame carries; undefined for none or (malformed) several, so a consumer fails closed on both. */\nexport function codeHostHookMetadataOf(frame) {\n const members = codeHostHookMembers(frame);\n return members.length === 1 ? members[0] : undefined;\n}\n/** The pull/merge-request revision a trusted member carries; undefined for an issue, a push, or a head-less subject. */\nexport function codeHostHookRevisionOf(member) {\n let headSha;\n let baseSha;\n if (member.provider === 'github') {\n if (member.metadata.subjectKind !== 'pull_request')\n return undefined;\n ({ headSha, baseSha } = member.metadata);\n }\n else if (member.provider === 'gitlab') {\n if (member.metadata.target.kind !== 'merge_request')\n return undefined;\n ({ headSha, baseSha } = member.metadata.target);\n }\n else {\n if (member.metadata.target.kind !== 'pull')\n return undefined;\n ({ headSha, baseSha } = member.metadata.target);\n }\n return headSha ? { headSha, ...(baseSha ? { baseSha } : {}) } : undefined;\n}\n/** A frame's provider members copied forward as they are, for a frame that forwards trusted metadata rather than reading it. */\nexport function pickCodeHostHookMembers(frame) {\n return {\n ...(frame.github ? { github: frame.github } : {}),\n ...(frame.gitlab ? { gitlab: frame.gitlab } : {}),\n ...(frame.gitea ? { gitea: frame.gitea } : {})\n };\n}\nexport const HookReviewEvent = z.enum(['COMMENT', 'REQUEST_CHANGES', 'APPROVE']);\nexport const HookReviewVerdict = z.enum(['pass', 'fail', 'neutral']);\n/** Short machine code only; raw GitHub/runtime exception text never crosses to reporting. */\nconst HookReviewResultCode = z\n .string()\n .min(1)\n .max(100)\n .regex(/^[a-z0-9_:-]+$/);\n/**\n * Body-free outcome of one reserved formal-review attempt.\n *\n * `not_submitted` is only legal after a deterministic no-effect failure and\n * lets the CP release the reservation. An uncertain POST remains `ambiguous`\n * until marker reconciliation proves whether GitHub created it.\n */\nexport const HookReviewResult = z.discriminatedUnion('state', [\n z.object({\n state: z.literal('submitted'),\n reviewId: z.string().min(1),\n event: HookReviewEvent,\n verdict: HookReviewVerdict,\n commitId: z.string().min(1)\n }),\n z.object({ state: z.literal('not_submitted'), code: HookReviewResultCode }),\n z.object({ state: z.literal('ambiguous'), code: HookReviewResultCode })\n]);\n/** Body-free identity of the daemon's one fallback GitHub comment. */\nexport const GithubPublishedComment = z.object({\n kind: z.enum(['issue_comment', 'review_comment']),\n commentId: HookBigIntString\n});\n/** Provider-neutral counterpart of GithubPublishedComment: the one published output's\n * identity (e.g. a GitLab note id). `kind` is provider vocabulary, open by design. */\nexport const PublishedHookOutput = z.object({\n provider: CodeHostProviderString,\n kind: z.string().min(1), // e.g. 'note'\n externalId: CodeHostExternalId\n});\n/**\n * Hook (inbound-webhook trigger) frames — webhook-triggers-and-github-events.md.\n *\n * A hook maps an inbound webhook delivery to ONE AGENT turn. The CP owns the\n * definition (`HookDef`) and compiles it into relay-side rules\n * (`rc/hook-assign`, frames/relay-cp.ts); the relay pool is the public ingress\n * that verifies + matches + dispatches the trigger to the target daemon as an\n * `rd/msg` `hook` member (frames/relay-daemon.ts). Event payloads never touch\n * the CP. R1/R2a add only metadata barriers and action-result control frames;\n * the model-visible body remains relay↔daemon.\n */\n/**\n * The trimmed event envelope a fire carries — bounded excerpts only; the full\n * payload lives in relay/daemon memory for the duration of the dispatch and the\n * agent pulls source-of-truth content itself (gh / API) when it needs more.\n * The whole frame rides under the 256 KiB frame cap; these excerpt caps are far\n * below it. Trust differs by kind (design security boundary 1): a webhook `body` IS the\n * caller's message (the URL is a capability credential), while github excerpts\n * (P2) are untrusted third-party content the daemon fences in the prompt.\n */\nexport const HookContext = z.object({\n source: z.enum(HOOK_KINDS),\n // ── github (P2) ──\n event: z.string().optional(), // 'issues' | 'pull_request' | 'issue_comment' | 'deployment' | 'deployment_status' | 'release'\n action: z.string().optional(), // 'opened' | 'synchronize' | 'created' | … (a deployment_status carries its state here)\n repo: z.string().optional(), // 'owner/repo'\n number: z.number().int().optional(), // issue/PR number\n title: z.string().optional(),\n senderLogin: z.string().optional(),\n senderAvatarUrl: z.string().url().optional(),\n authorAssociation: z.string().optional(),\n labels: z.array(z.string()).optional(),\n htmlUrl: z.string().optional(),\n bodyExcerpt: z.string().optional(), // ≤4 KiB\n // The issue/PR itself; its description keeps both ends within 8 KiB (code-host-decisions.md §5).\n subject: z\n .object({\n authorLogin: z.string().optional(),\n authorType: z.string().optional(),\n authorAssociation: z.string().optional(),\n state: z.string().optional(),\n draft: z.boolean().optional(),\n body: z.string().optional(),\n bodyTruncated: z.boolean().optional()\n })\n .optional(),\n // ── github deployment (no thread: the environment is the subject) ──\n environment: z.string().optional(), // 'production'\n ref: z.string().optional(), // the deployed ref, as GitHub names it\n sha: z.string().optional(), // the deployed commit\n // ── code-host release (no thread: every release of the repository continues one session) ──\n release: z\n .object({\n tag: z.string(), // 'v1.2.0'\n target: z.string().optional(), // the branch or commit the tag was cut from\n prerelease: z.boolean().optional(),\n draft: z.boolean().optional()\n })\n .optional(),\n // ── webhook ──\n body: z.string().optional(), // raw body, truncated to ≤64 KiB\n truncated: z.boolean().optional()\n});\n/** Normalized quota failure; the unfinished review Check remains non-passing. */\nexport const HOOK_REPORT_REASON_PROVIDER_QUOTA_EXHAUSTED = 'provider_quota_exhausted';\n/** Normalized provider sign-in failure; the unfinished review Check remains non-passing. */\nexport const HOOK_REPORT_REASON_PROVIDER_AUTH_REQUIRED = 'provider_auth_required';\n/** Normalized infrastructure interruption: the daemon stopped serving the agent mid-turn (a duty\n * handover, or a self-fence on an unrenewed lease). Distinct from a user stop because nothing was\n * judged and the same work can simply be run again. */\nexport const HOOK_REPORT_REASON_AGENT_HANDOVER = 'agent_handover';\n/** The delivery's session is bound to another source, so its turn was refused before it ran. */\nexport const HOOK_REPORT_REASON_SESSION_SOURCE_MISMATCH = 'session_source_mismatch';\n/** A `notice` delivery posted its fixed text; the run row records a post, not a model turn. */\nexport const HOOK_REPORT_REASON_NOTICE_POSTED = 'notice_posted';\n/** A `notice` delivery found its thread already carried one — a thread is told once. */\nexport const HOOK_REPORT_REASON_NOTICE_ALREADY_POSTED = 'notice_already_posted';\n/**\n * `hook/report` (D→C REQ → generic `ack`) — the dispatched turn ended; closes\n * the `HookRun` row the relay's `rc/run-report` opened. Same discipline as\n * `cron/report`: scoped (the agent must be placed on the reporting daemon),\n * latest-wins, lost reports harvested by the HookRunReaper (late arrivals may\n * still overwrite `orphaned`). The daemon retains a metadata-only outbox entry\n * until ACK. Keyed by `(hookId, deliveryKey)`.\n */\nexport const HookReport = z\n .object({\n hookId: z.string().uuid(),\n agentId: z.string().uuid(), // the owning agent — scopes the report to its daemon\n deliveryKey: z.string().min(1),\n // Rolling-compatible copy of the exact accepted dispatch tuple. Every field\n // is optional on the delivery frame, but review/report consumers require the\n // complete HookConfigSnapshot before taking an effect.\n ...OptionalHookConfigSnapshot.shape,\n event: z.string().min(1).optional(), // 'pull_request:synchronize', etc.\n github: GithubHookMetadata.optional(),\n gitlab: GitlabHookMetadata.optional(),\n gitea: GiteaHookMetadata.optional(),\n status: z.enum(['success', 'failed']),\n durationMs: z.number().int().nonnegative().optional(), // dispatch → turn end\n sessionId: z.string().optional(), // the session the run prompted, by its outward id (§1.1)\n reason: z.string().optional(), // short failure text (status \"failed\")\n // A submitted result is repeated here as recovery if the immediate\n // github/review-result request was lost. No review/comment body crosses CP.\n reviewAttemptId: z.string().uuid().optional(),\n reviewResult: HookReviewResult.optional(),\n // Exact public fallback location. The comment body remains daemon-owned.\n publishedComment: GithubPublishedComment.optional(),\n // Provider-neutral counterpart (one of the two, never both).\n publishedOutput: PublishedHookOutput.optional()\n})\n .superRefine((report, ctx) => {\n if ((report.reviewAttemptId === undefined) !== (report.reviewResult === undefined)) {\n ctx.addIssue({\n code: 'custom',\n path: report.reviewAttemptId === undefined ? ['reviewAttemptId'] : ['reviewResult'],\n message: 'reviewAttemptId and reviewResult must be reported together'\n });\n }\n // An inline thread reply is not the top-level fallback: a verdict amendment may ride beside it.\n if ((report.publishedComment?.kind === 'issue_comment' || report.publishedOutput) &&\n report.reviewResult?.state === 'submitted') {\n ctx.addIssue({\n code: 'custom',\n path: [report.publishedComment ? 'publishedComment' : 'publishedOutput'],\n message: 'a submitted formal review and fallback comment are mutually exclusive'\n });\n }\n if (report.publishedComment && report.publishedOutput) {\n ctx.addIssue({\n code: 'custom',\n path: ['publishedOutput'],\n message: 'publishedComment and publishedOutput are mutually exclusive'\n });\n }\n const members = codeHostHookMembers(report);\n if (members.length > 1) {\n ctx.addIssue({\n code: 'custom',\n path: [members[1].provider],\n message: 'provider metadata members are mutually exclusive'\n });\n }\n});\n/** The daemon has begun preparing an accepted GitHub review, before a session exists. */\nexport const HookPreparing = z.object({\n hookId: z.string().uuid(),\n agentId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n ...HookConfigSnapshot.shape\n});\nexport const HookPreparingOk = z.object({ accepted: z.literal(true) });\n/** Why a formal review lost its exact checkout; a fixed enum so it can label a metric. */\nexport const ReviewCheckoutDegradedReason = z.enum([\n 'no_review_root',\n 'fetch_timeout',\n 'sandbox_conflict',\n 'authority_draining',\n 'credential_unavailable',\n 'revision_mismatch',\n 'other'\n]);\n/** How a formal review's workspace was prepared: the exact verified checkout, or revision-only for a reason. */\nexport const ReviewCheckout = z.discriminatedUnion('outcome', [\n z.object({ outcome: z.literal('exact') }),\n z.object({ outcome: z.literal('degraded'), reason: ReviewCheckoutDegradedReason })\n]);\n/**\n * `hook/start` (D→C REQ) — metadata barrier immediately before an accepted\n * GitHub hook enters the model prompt. A successful reply means the CP durably\n * attached the authoritative revision to the accepted HookRun and, for R2a,\n * advanced its informational projection to in_progress.\n */\nexport const HookStart = z\n .object({\n hookId: z.string().uuid(),\n agentId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n sessionId: z.string().min(1).optional(), // the turn's session by its outward id (§1.1); rolling-compatible\n event: z.string().min(1).optional(),\n // Provider one-of: exactly one member carries the trusted subject metadata.\n // `github` was required pre-GitLab, so every existing sender stays valid.\n github: GithubHookMetadata.optional(),\n gitlab: GitlabHookMetadata.optional(),\n gitea: GiteaHookMetadata.optional(),\n reviewCheckout: ReviewCheckout.optional(), // only on a turn that prepared a formal review's workspace\n ...HookConfigSnapshot.shape\n})\n .superRefine((start, ctx) => {\n if (codeHostHookMembers(start).length !== 1) {\n ctx.addIssue({\n code: 'custom',\n path: ['github'],\n message: 'exactly one provider metadata member is required'\n });\n }\n});\n/** The sealed verdict a conversation turn may amend: this hook's latest on the turn's own revision. */\nexport const HookReviewAmendment = z.object({\n reportSha: z.string().min(1),\n event: HookReviewEvent,\n verdict: HookReviewVerdict\n});\n// `amendment` names the one formal-review authority a `review_action_only` turn can hold; an older CP omits it.\nexport const HookStartOk = z.object({ accepted: z.literal(true), amendment: HookReviewAmendment.optional() });\n/** D→C action-time authorization for one formal GitHub review attempt. */\nexport const GithubReviewAuthorize = z.object({\n hookId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n attemptId: z.string().uuid(),\n requestedEvent: HookReviewEvent,\n requestedVerdict: HookReviewVerdict,\n snapshot: HookConfigSnapshot\n});\n/** Trusted target echoed with a broker-only purpose token. Secret: never log. */\nexport const GithubReviewAuthorized = z.object({\n attemptId: z.string().uuid(),\n token: z.string().min(1),\n ttlSec: z.number().int().positive(),\n expiresAt: z.string().datetime(),\n repoId: HookBigIntString,\n repoFullName: z.string().min(1),\n pullNumber: z.number().int().positive(),\n expectedHeadSha: z.string().min(1),\n expectedBaseSha: z.string().min(1)\n});\n/**\n * Immediate metadata-only convergence after the daemon's GitHub review POST.\n * Submitted metadata is also repeated on HookReport for lost-REP recovery.\n */\nexport const GithubReviewResultReport = z.object({\n hookId: z.string().uuid(),\n deliveryKey: z.string().min(1),\n attemptId: z.string().uuid(),\n snapshot: HookConfigSnapshot,\n result: HookReviewResult\n});\nexport const GithubReviewResultOk = z.object({ accepted: z.literal(true) });\n//# sourceMappingURL=hook.js.map","// ⚠️ NO RELATIVE IMPORTS — a bundler compiles this from source; web's protocol-imports.leaf.test.ts enforces it.\nimport { z } from 'zod';\nexport const INTEGRATION_SETUP_URI = 'ui://agentconnect/integration-setup';\nexport const IntegrationSetupIntent = z.discriminatedUnion('mode', [\n z\n .object({\n mode: z.literal('create'),\n provider: z.string().min(1).max(64).optional(),\n agentId: z.string().uuid().optional()\n })\n .strict(),\n z\n .object({\n mode: z.literal('edit'),\n agentId: z.string().uuid(),\n target: z.object({ kind: z.enum(['integration', 'codehost-subscription']), id: z.string().uuid() }).strict()\n })\n .strict()\n]);\nexport const CODE_HOST_SETUP_URI = 'ui://agentconnect/code-host-setup';\n// Redeclared rather than imported from `./code-host`: this module is a leaf (see the banner).\nexport const CODE_HOST_SETUP_PROVIDERS = ['github', 'gitlab', 'gitea'];\n// Which card the connection surface opens on; omitted means the whole surface, as the Console page shows it.\nexport const CodeHostSetupIntent = z.object({ provider: z.enum(CODE_HOST_SETUP_PROVIDERS).optional() }).strict();\nexport const AGENT_SETUP_URI = 'ui://agentconnect/agent-setup';\n// The groups of the Console agent editor; omitted opens on its first one.\nexport const AGENT_SETUP_SECTIONS = ['basics', 'runtime', 'access', 'secrets'];\n// What a delegated `createAgent` PROPOSES: the arguments it collected, carried to the Console create\n// dialog prefilled instead of written, so the human submits the agent under their own Console JWT.\n// Bounds mirror the tool's own — the card's byte budget is what caps a drafted string.\nexport const AgentSetupDraft = z\n .object({\n name: z.string().min(1).max(63),\n displayName: z.string().min(1).optional(),\n description: z.string().optional(),\n runtime: z.string().min(1).optional(),\n model: z.string().min(1).optional(),\n reasoningEffort: z.string().min(1).optional(),\n outputMode: z.enum(['none', 'minimal', 'low', 'medium', 'high']).optional(),\n fastMode: z.boolean().optional(),\n permissionMode: z.string().min(1).optional(),\n placementKind: z.enum(['daemon', 'pool', 'set']).optional(),\n setId: z.string().uuid().optional(),\n daemonId: z.string().min(1).optional(),\n workspace: z\n .object({\n mode: z.enum(['scratch', 'git']),\n gitRepo: z.string().min(1).optional(),\n gitBranch: z.string().min(1).optional(),\n agentDir: z.string().min(1).optional(),\n worktree: z.boolean().optional(),\n access: z.enum(['read', 'write']).optional()\n })\n .strict()\n .optional()\n})\n .strict();\nexport const AgentSetupIntent = z\n .object({\n agentId: z.string().uuid().optional(),\n section: z.enum(AGENT_SETUP_SECTIONS).optional(),\n // Set by a direct `createAgent`, whose card is the new agent's own next step rather than an edit of an old one.\n created: z.boolean().optional(),\n // Set by a delegated `createAgent`: no agent exists yet, and the dialog opens prefilled on this proposal.\n draft: AgentSetupDraft.optional()\n})\n .strict()\n // An editor needs its subject and a create dialog has none — one intent is never both.\n .refine((intent) => (intent.agentId === undefined) !== (intent.draft === undefined), {\n message: 'exactly one of agentId or draft'\n});\nexport const SKILL_SETUP_URI = 'ui://agentconnect/skill-setup';\n// `registry` searches skills.sh by name; `git` imports a repository. Omitted takes the registry.\nexport const SKILL_SETUP_SOURCES = ['registry', 'git'];\nexport const SkillSetupIntent = z\n .object({\n source: z.enum(SKILL_SETUP_SOURCES).optional(),\n query: z.string().min(1).max(200).optional(),\n agentId: z.string().uuid().optional()\n})\n .strict();\nexport const MCP_SETUP_URI = 'ui://agentconnect/mcp-setup';\n// A server's url, headers and OAuth credential are typed in the dialog, never carried in an intent.\nexport const McpSetupIntent = z.object({ agentId: z.string().uuid().optional() }).strict();\nexport const AGENT_TOOLS_URI = 'ui://agentconnect/agent-tools';\n// Which roster to show; omitted shows both, as the Console's Tools & Skills tab does.\nexport const AGENT_TOOLS_FOCUS = ['mcp', 'skills'];\nexport const AgentToolsIntent = z\n .object({ agentId: z.string().uuid(), focus: z.enum(AGENT_TOOLS_FOCUS).optional() })\n .strict();\nconst nativeApp = (uri, intent) => z\n .object({\n resourceUri: z.literal(uri),\n resourceVersion: z.literal(1),\n orgId: z.string().min(1).max(200),\n intent\n})\n .strict();\n// A bounded presentation request; Console JWT authorization governs every form read and write.\nexport const NativeMcpUi = z.discriminatedUnion('resourceUri', [\n nativeApp(INTEGRATION_SETUP_URI, IntegrationSetupIntent),\n nativeApp(CODE_HOST_SETUP_URI, CodeHostSetupIntent),\n nativeApp(AGENT_SETUP_URI, AgentSetupIntent),\n nativeApp(SKILL_SETUP_URI, SkillSetupIntent),\n nativeApp(MCP_SETUP_URI, McpSetupIntent),\n nativeApp(AGENT_TOOLS_URI, AgentToolsIntent)\n]);\n// A write tool's own answer stays its answer; the card it earns rides alongside it under this key.\nexport const NativeUiEnvelope = z.object({ nativeUi: NativeMcpUi }).loose();\n/** The heading one intent earns, decided by the resource — the daemon's card chrome and the Console card must not word it differently. */\nexport function nativeUiTitle(ui) {\n switch (ui.resourceUri) {\n case CODE_HOST_SETUP_URI:\n return 'Code host connections';\n case AGENT_SETUP_URI:\n return ui.intent.draft ? 'Create agent' : ui.intent.created ? 'Agent created' : 'Edit agent';\n case SKILL_SETUP_URI:\n return 'Install skill';\n case MCP_SETUP_URI:\n return 'Add MCP server';\n case AGENT_TOOLS_URI:\n return ui.intent.focus === 'skills' ? 'Skills' : ui.intent.focus === 'mcp' ? 'MCP servers' : 'Tools & skills';\n default:\n return ui.intent.mode === 'edit' ? 'Edit integration' : 'Add integration';\n }\n}\n// Sent as `protocolVersion` in the `ui/initialize` result; the official SDK's `App.connect()` rejects a result without it (SEP-1865 Final).\nexport const MCP_APPS_PROTOCOL_VERSION = '2026-01-26';\n// The most text one `ui/message` may carry into the conversation; matches the wire field's bound so a decoded list is clamped before it is refused.\nexport const MCP_APP_MESSAGE_MAX_CHARS = 4000;\n// The most model context one app may hold via `ui/update-model-context`; a note for the next turn carried on the session, not a store.\nexport const MCP_APP_CONTEXT_MAX_CHARS = 4000;\n//# sourceMappingURL=mcp-app.js.map","import { z } from 'zod';\nimport { MCP_APP_CONTEXT_MAX_CHARS, NativeMcpUi } from '../mcp-app.js';\n// The MCP Apps constants live in the `./mcp-app` leaf so the console can value-import them; the barrel still re-exports them.\nexport * from '../mcp-app.js';\n// webchat's content plane is the RELAY, not the daemon↔CP control WS:\n// a browser dials the relay pool with a CP-minted token and the relay bridges the\n// conversation onto the target daemon's rd/* socket. These payloads describe the reply\n// stream + the turn verdict; the relay's `rd/chat` / `rd/ack` frames REUSE them verbatim\n// (packages/protocol/src/frames/relay-daemon.ts). Live content never touches the CP;\n// an authorized session-history read may later proxy a daemon-local image for display.\n// The browser rasterizes/compresses one selected image below this cap. It fits the\n// relay ingress frame and, later, one daemon→CP history frame with base64 expansion.\nexport const WEBCHAT_IMAGE_MAX_BYTES = 160 * 1024;\nexport const WEBCHAT_IMAGE_MAX_BASE64_CHARS = Math.ceil(WEBCHAT_IMAGE_MAX_BYTES / 3) * 4;\nconst CANONICAL_BASE64 = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nfunction decodedBase64Bytes(value) {\n const padding = value.endsWith('==') ? 2 : value.endsWith('=') ? 1 : 0;\n return (value.length / 4) * 3 - padding;\n}\nexport const WebchatImageAttachment = z.object({\n name: z\n .string()\n .trim()\n .min(1)\n .max(255)\n .regex(/^[^\\u0000-\\u001f\\u007f]+$/, 'webchat image name must not contain control characters'),\n mimeType: z.enum(['image/png', 'image/jpeg', 'image/webp']),\n data: z\n .string()\n .min(4)\n .max(WEBCHAT_IMAGE_MAX_BASE64_CHARS)\n .refine((value) => CANONICAL_BASE64.test(value) && decodedBase64Bytes(value) <= WEBCHAT_IMAGE_MAX_BYTES, {\n message: `webchat image must be canonical base64 encoding at most ${WEBCHAT_IMAGE_MAX_BYTES} bytes`\n })\n});\n// ── Shared images (webchat-generated-images.md) ─────────────────────────────\n/** Daemon, relay and console support shared-image cards: the `image` event, post/transcript images and `image_update`. */\nexport const WEBCHAT_IMAGES_FEATURE = 'webchat-images-v1';\n/** Decoded-byte cap of one shared-image preview; the same transport limit inbound images use. */\nexport const SHARED_IMAGE_PREVIEW_MAX_BYTES = WEBCHAT_IMAGE_MAX_BYTES;\n/** Bound on the caption-plus-provenance text a shared image carries. */\nexport const SHARED_IMAGE_TEXT_MAX_CHARS = 6000;\n/** Outbound preview: unlike {@link WebchatImageAttachment} it admits SVG, so inbound uploads do not widen with it. */\nexport const SharedImagePreview = WebchatImageAttachment.extend({\n mimeType: z.enum(['image/png', 'image/jpeg', 'image/webp', 'image/svg+xml']),\n width: z.number().int().positive().max(65_535).optional(),\n height: z.number().int().positive().max(65_535).optional()\n});\n/** Delivery state of a cache-backed original; `unavailable` is a read-time fallback for a pending upload with no live task. */\nexport const SharedImageOriginalStatus = z.enum(['pending', 'ready', 'upload_failed', 'expired', 'unavailable']);\n/** Where the full-resolution original lives; never a URL — signed GETs are transient and travel beside it. */\nexport const SharedImageOriginal = z.discriminatedUnion('kind', [\n // The preview IS the complete original.\n z.object({ kind: z.literal('inline') }),\n z.object({\n kind: z.literal('cache'),\n attachmentId: z.string().uuid(),\n // The original's file name for Download; sniffed extension, no path.\n name: z\n .string()\n .trim()\n .min(1)\n .max(255)\n .regex(/^[^\\u0000-\\u001f\\u007f/\\\\]+$/)\n .optional(),\n mimeType: z.string().max(255),\n bytes: z.number().int().positive(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/),\n status: SharedImageOriginalStatus\n }),\n // No transfer cache: the share marker's path and digest drive the authenticated workspace download.\n z.object({ kind: z.literal('workspace') })\n]);\n/** A temporary signed GET for a cached original; never persisted. */\nexport const SharedImageDownload = z.object({\n url: z.string().url().max(4096),\n expiresAt: z.string().datetime()\n});\n/** The image half of a shared-image post, as every copy and transcript row carries it. */\nexport const SharedImage = z.object({\n attachment: SharedImagePreview,\n original: SharedImageOriginal,\n // Monotonic per post; readers ignore an update older than what they hold.\n revision: z.number().int().min(0)\n});\n/** One original-state change of an already published image, delivered outside any turn stream. */\nexport const WebchatImageUpdate = z.object({\n conversationId: z.string().uuid(),\n agentId: z.string().uuid(),\n postId: z.string().uuid(),\n revision: z.number().int().min(1),\n original: SharedImageOriginal,\n download: SharedImageDownload.optional()\n});\n// The webchat turn verdict — `dispatchWebchatTurn` returns this and the relay path folds\n// it into `rd/ack` (accepted + the turnId that correlates the reply stream; `reason`\n// explains a rejection). Not a wire frame of its own anymore.\n// `agentId` attributes the verdict in a multi-agent conversation: a multi-target turn\n// produces one ack per targeted agent. Absent ⇒ the conversation's sole agent.\nexport const WebchatAck = z.object({\n accepted: z.boolean(),\n turnId: z.string().uuid(), // correlates the streamed output to this turn\n agentId: z.string().uuid().optional(),\n // The last three are session-continuation refusals\n // (webchat-cross-integration-continuation.md §5.2/§6.4).\n reason: z\n .enum([\n 'queued',\n 'no_agent',\n 'busy',\n 'paused',\n 'draining',\n 'not_participant',\n 'not_found',\n 'integration_offline',\n 'integration_delivery_failed',\n // The daemon owns this agent but its runtime would not start — distinct from `no_agent`,\n // which says no daemon serves it at all. Only this one carries `detail`.\n 'start_failed',\n // The API turn's Decision gate answered no (shared-bot-relay.md §10.4).\n 'declined'\n ])\n .optional(),\n // One bounded, path-free line naming the fault, so the client can state the cause instead of\n // guessing at it. The daemon redacts it; nothing here reveals its filesystem layout.\n detail: z.string().max(240).optional(),\n // The turn was delivered INTO the running turn over `_session/steering` (#1847); its own\n // stream ends at once with `stopReason: 'steered_into_turn'` and the live reply continues.\n steered: z.boolean().optional()\n});\n// One canonical conversation post — the unit every participant daemon records and\n// the browser merges by `(at, postId)`. Identity (`postId`, `at`) is minted exactly\n// ONCE at the origin (the relay for a user turn, the owning daemon for an agent\n// reply) and carried on every frame that transports the post, so all copies agree\n// on ordering and the shared transcript dedupes across co-hosted participants.\nexport const WebchatPost = z.object({\n postId: z.string().uuid(),\n conversationId: z.string().uuid(),\n author: z.discriminatedUnion('kind', [\n // `userId` is the stable CP principal and is what a recipient records as the\n // transcript sender; `user` is the mutable display handle for the author line.\n z.object({ kind: z.literal('user'), user: z.string().optional(), userId: z.string().optional() }),\n z.object({\n kind: z.literal('agent'),\n agentId: z.string().uuid(),\n // The authoring TURN's depth in the agent-call chain (send-message-routing-\n // rework.md §4.1), stamped by the origin daemon at the commit boundary. A\n // receiving participant's daemon charges ONE +1 transition on it — against the\n // same MAX_AGENT_CALL_HOPS budget an internal agent call spends — before the\n // post may continue the conversation as an activation (webchat-multi-agents.md\n // §5.2a, the #549 parity). Absent (a pre-parity daemon), the post stays\n // transcript-only: a missing depth must never coerce to zero.\n hopCount: z.number().int().min(0).optional(),\n // The participants the human narrowed this exchange to (§5.2a); a peer outside it wakes only when the post @-names it.\n addressedAgentIds: z.array(z.string().uuid()).max(16).optional()\n })\n ]),\n text: z.string(),\n at: z.number().int(), // canonical epoch-ms timestamp, minted once at origin\n attachments: z.array(WebchatImageAttachment).max(1).optional(),\n // A shared image the agent published; peers keep it as transcript only, never as model input.\n image: SharedImage.optional()\n});\n// One structured chunk of the agent's reply stream. Ordered per-connection (TCP);\n// 'index' is a per-turn monotonic counter for client-side assembly (NOT a global fence).\n/**\n * One entry of an agent's task list, as ACP `plan` sends it. Defined HERE rather than\n * beside `PlanBody` in session.ts because both the live stream and the persisted row carry\n * it and session.ts already imports this module — the other direction would be a cycle.\n */\nexport const PlanEntry = z.object({\n content: z.string(),\n status: z.string(), // ACP PlanEntryStatus: pending|in_progress|completed\n priority: z.string().optional() // ACP PlanEntryPriority: high|medium|low\n});\n/** The most fields one elicitation card renders. A card is a question standing in a\n * transcript, not a settings page: past ten controls the reader cannot take the ask in, and\n * the daemon must hold and re-validate every field of the record that answers it. A longer\n * form is declined, which is honest — the agent can ask again in smaller pieces. */\nexport const ELICIT_FORM_FIELD_CAP = 10;\n/** The most FIELDS one card's wire payload carries. The cap above counts QUESTIONS, and an\n * AskUserQuestion bridge gives every question its own free-text companion (`customAnswerFor`),\n * so a form at the cap arrives as twice that many properties — and answers with them too. */\nexport const ELICIT_FORM_WIRE_FIELD_CAP = ELICIT_FORM_FIELD_CAP * 2;\n/** The per-kind field descriptors of an elicitation card. Shared by the single-field card and\n * by each entry of a multi-field form, so the two can never describe one field differently. */\nconst ElicitOptions = z.array(z.object({ value: z.string(), label: z.string() }));\nconst ElicitMulti = z.object({\n minItems: z.number().int().min(0).optional(),\n maxItems: z.number().int().min(0).optional()\n});\nconst ElicitText = z.object({\n minLength: z.number().int().min(0).optional(),\n maxLength: z.number().int().min(0).optional(),\n pattern: z.string().max(200).optional(),\n format: z.enum(['email', 'uri', 'date', 'date-time']).optional()\n});\nconst ElicitNumber = z.object({\n integer: z.boolean().optional(),\n minimum: z.number().optional(),\n maximum: z.number().optional()\n});\nconst ElicitDefault = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]);\n/** One field of a multi-field form card: the descriptors above plus what only a form needs —\n * the schema key the answer is returned under, a label to render it beside, its kind (a\n * boolean's two options are indistinguishable from an enum's otherwise), and whether the\n * schema requires it, since an optional field may be left out of the answer entirely. */\nexport const ElicitField = z.object({\n propName: z.string().min(1).max(200),\n label: z.string(),\n kind: z.enum(['enum', 'boolean', 'multi-enum', 'text', 'number']),\n required: z.boolean().optional(),\n /** The schema's own `description` — the question text, where the title is only its header. */\n description: z.string().max(300).optional(),\n /** Set on a select question's free-text companion: the property whose question this box types\n * an answer for. The card renders it INSIDE that question rather than as a question of its\n * own, and never numbers or counts it. What said so — an ACP `_askUserQuestionCustomAnswer`\n * marker, Codex's `_meta.codex.isOtherAnswer`, or, for a bridge that marks nothing, the pair's\n * own property names — is the daemon's to read: the raw schema never crosses this wire, so a\n * reader has only this field. */\n customAnswerFor: z.string().min(1).max(200).optional(),\n options: ElicitOptions,\n multi: ElicitMulti.optional(),\n text: ElicitText.optional(),\n number: ElicitNumber.optional(),\n defaultValue: ElicitDefault.optional()\n});\n/** ONE elicitation card, as the daemon reduced it. Both the live event below and the\n * transcript row that persists the card (`ElicitBody`) are this shape, so a reader who\n * loads the conversation later is shown the very card the reader in the moment answered.\n *\n * The agent asked for a choice (ACP `elicitation/create`, form or url mode) — webchat's own\n * in-band card, the peer of the Slack Block Kit one. Deliberately NOT the raw\n * `requestedSchema`: the daemon has already reduced the form to its renderable field(s), and\n * its options are the only answers the browser may send back (as the `elicitation_choice` op\n * keyed by this `requestId`). `message` is agent-authored text, masked before it reaches here.\n * Options are UNCAPPED — the Slack button cap is a Slack surface limit and does not follow the\n * choice onto this surface. They are also EMPTY for a typed field (`text`/`number`), whose\n * card offers nothing to pick. */\nexport const ElicitCard = z.object({\n requestId: z.string().min(1).max(200),\n message: z.string(),\n options: ElicitOptions,\n // Absent ⇒ pick exactly ONE option, the original card. Present ⇒ pick several of the same\n // options and confirm, and the answer is a list. An added OPTIONAL field rather than a new\n // event kind on purpose: a relay or browser predating it decodes the event unchanged\n // (zod strips what it does not know) instead of dropping the frame the way an unknown\n // kind would, and a daemon predating it simply never sets it.\n multi: ElicitMulti.optional(),\n // Present ⇒ the card is a free-text input carrying the schema's own constraints, which the\n // daemon re-checks on the way back in. Same optional-field reasoning as `multi`, with one\n // added skew note: an old reader keeps `options` (now empty) and shows a card with nothing\n // but Dismiss — unanswerable, never wrongly answered. `pattern` reaches here only once the\n // daemon has cleared it as safe to run.\n text: ElicitText.optional(),\n // Present ⇒ a numeric input; `integer` is the schema's `integer` type, not just a bound.\n number: ElicitNumber.optional(),\n // The schema's `default`, already checked against the constraints above: the card\n // pre-populates its control with it (MCP `2025-11-25`), and the reader may answer otherwise.\n defaultValue: ElicitDefault.optional(),\n // Present ⇒ the card is a multi-field FORM: one control per field, one submit, and the\n // answer is a record of value-per-field. The single-field descriptors above are then all\n // absent — deliberately, and the same closed-failure trade `text` records: an old reader\n // sees an optionless card it can only Dismiss, rather than a card it could half-fill with\n // one field's answer that the daemon would then refuse.\n fields: z.array(ElicitField).min(2).max(ELICIT_FORM_WIRE_FIELD_CAP).optional(),\n // Present ⇒ the card is a URL-mode CONSENT card (ACP `ElicitationUrlMode`): the reader is\n // shown this exact URL and opens it in their own browser, and nothing about the page ever\n // returns here. `options` is then empty and every field descriptor above is absent, so the\n // same closed skew `text` records holds — an old reader sees a card it can only Dismiss,\n // which the daemon reads as the spec's `decline`, never as consent. Only http/https reach\n // here; the daemon declines any other scheme rather than hand a browser an unopenable href.\n url: z.string().min(1).max(2048).optional()\n});\n/**\n * The most HTML one MCP App template may carry.\n *\n * A real bound on a real document, not a transport artifact. The transport is handled separately:\n * a template does NOT ride the card event as one blob past {@link MCP_APP_INLINE_TEMPLATE_MAX_BYTES},\n * because the `rd/chat` frame it would ride is capped at {@link MAX_FRAME_BYTES} (256 KiB) and a\n * genuine app — one that inlines the official SDK — is comfortably past that on its own. Templates\n * therefore arrive as ordered `app_template` chunks and are reassembled by the browser, which is\n * why this cap can describe what a page may reasonably be instead of what one frame happens to hold.\n *\n * A larger template is DECLINED with a notice rather than truncated — half a document renders as a\n * broken page, which is the one outcome worse than saying the interface could not be shown.\n */\nexport const MCP_APP_HTML_MAX_BYTES = 1024 * 1024;\n/**\n * How much template one `app_template` chunk carries, in characters.\n *\n * Chosen against the frame rather than for tidiness: {@link MAX_FRAME_BYTES} is 256 KiB, and JSON\n * escaping can roughly double quote-dense HTML on the way in, so 48 KiB of template stays under\n * the cap even at that worst case with the envelope on top.\n */\nexport const MCP_APP_TEMPLATE_CHUNK_CHARS = 48 * 1024;\n/** Under this, a template simply rides the card's own frame and no chunks are sent. Set well below\n * {@link MCP_APP_CARD_MAX_BYTES} so the card still fits once its result and metadata are on top —\n * the decision is made against the thing that has to encode, not against the template alone. */\nexport const MCP_APP_INLINE_TEMPLATE_MAX_BYTES = 48 * 1024;\n/** The most one card's whole encoded payload may take, including the tool result it carries\n * through. Checked where the card is assembled, because the template cap alone does not bound a\n * tool that answered with a megabyte of `structuredContent` — and a card that cannot encode is a\n * frame the reader never sees, for a reason nothing in the stream would explain. */\nexport const MCP_APP_CARD_MAX_BYTES = 160 * 1024;\n/** The most live app cards one conversation holds. A fifth settles the oldest as `superseded`:\n * every live card is an armed iframe with a tool-calling bridge, and an unbounded stack of\n * them is an unbounded stack of those. */\nexport const MCP_APP_LIVE_CAP = 4;\n/** The domain allowlists an MCP App resource declared, each widening exactly its own CSP\n * directive (SEP-1865). The host builds the policy FROM this and never from the page, and may\n * restrict further but must not admit an undeclared domain — so an absent list is the\n * restrictive default, not \"anything\". */\nexport const McpAppCsp = z.object({\n /** `connect-src` — fetch / XHR / WebSocket. */\n connect: z.array(z.string().min(1).max(253)).max(32).optional(),\n /** `script-src` / `style-src` / `img-src` / `font-src` — static assets. */\n resource: z.array(z.string().min(1).max(253)).max(32).optional(),\n /** `frame-src` — nested iframes. */\n frame: z.array(z.string().min(1).max(253)).max(32).optional(),\n /** `base-uri`. */\n baseUri: z.array(z.string().min(1).max(253)).max(32).optional()\n});\n/** `containerDimensions` — what the view negotiated. An axis marked flexible is the one the\n * view may grow along by reporting `ui/notifications/size-changed`; a fixed axis is the\n * host's to decide, so the view's report on it is ignored rather than obeyed. */\nexport const McpAppDimensions = z.object({\n width: z.number().int().min(1).max(4096).optional(),\n height: z.number().int().min(1).max(4096).optional(),\n flexibleWidth: z.boolean().optional(),\n flexibleHeight: z.boolean().optional()\n});\n/**\n * ONE MCP App card, as the daemon's Apps host assembled it — the peer of {@link ElicitCard},\n * and webchat's ONLY rich-UI surface by construction (webchat-mcp-apps.md §2).\n *\n * A UI-capable MCP server predeclares an interface as a `ui://` resource and links it to a tool\n * with `_meta.ui.resourceUri`; the daemon — which is the MCP Apps host, because no ACP runtime\n * is (§3) — reads the template, calls the tool, and streams both here. The browser renders the\n * template in an OPAQUE-origin sandboxed frame and speaks MCP's own JSON-RPC to it over\n * `postMessage`, forwarding the four host methods that need the daemon back as the `app_rpc` op.\n *\n * This card is NOT an elicitation: the tool's own result returns to the model the moment the\n * call completes, so an app that is never opened, never answered, or shown on a surface with no\n * renderer never blocks the turn. What the reader does in the frame reaches the agent through\n * ordinary tool calls and `ui/message`, not through a parked resolver.\n */\nexport const McpAppCard = z.object({\n nativeUi: NativeMcpUi.optional(),\n /** The unguessable id every RPC from this view carries back — the card's identity, exactly as\n * `requestId` is an elicitation card's. A view may only reach the server that opened it, and\n * only while this id is live in its own conversation. */\n appId: z.string().min(1).max(200),\n /** The words above the frame, and the words the decline uses on a surface that has none. */\n title: z.string().max(200),\n /** The tool that opened the frame, namespaced `<server>__<tool>` as the bridge exposes it. */\n toolName: z.string().min(1).max(200),\n /**\n * The `ui://` template's own text (`text/html;profile=mcp-app`), when it is small enough to ride\n * this frame whole. ABSENT ⇒ it arrives as `app_template` chunks; {@link htmlBytes} says how much\n * to expect, and the frame is armed only once that much has been reassembled.\n *\n * Optional rather than always-chunked so a small first-party template stays one frame and one\n * code path — and so a reader that never receives its chunks renders a card that is honestly\n * unarmed rather than one that half-works.\n */\n html: z.string().min(1).max(MCP_APP_HTML_MAX_BYTES).optional(),\n /** Set when the template is chunked: the assembled length in CHARACTERS, so the browser knows\n * when it has the whole document, and can distinguish a template still arriving from one that\n * never arrived at all.\n *\n * (Worded to keep `from` away from a following quote on purpose: the daemon's\n * `scripts/assert-self-contained.mjs` scans the built bundle for import specifiers with a regex\n * that does not skip comments, so a comment placing that word directly before a quoted string\n * is read as a bare import and fails the build.) */\n htmlBytes: z.number().int().min(1).max(MCP_APP_HTML_MAX_BYTES).optional(),\n /** The call's arguments, handed to the view as `ui/notifications/tool-input`. */\n toolInput: z.record(z.string(), z.unknown()).optional(),\n /** The call's result, handed to the view as `ui/notifications/tool-result`. `structuredContent`\n * is the UI-optimized half the spec keeps out of model context; `content` is the text the\n * model already received, carried again so a view may render exactly what the agent read. */\n toolResult: z\n .object({\n content: z.array(z.unknown()).max(64).optional(),\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n isError: z.boolean().optional()\n })\n .optional(),\n csp: McpAppCsp.optional(),\n dimensions: McpAppDimensions.optional()\n});\n// Ordinary app pages may re-arm after expiry; dismissed or completed interfaces stay settled.\nexport const McpAppOutcome = z.enum(['closed', 'superseded', 'expired', 'completed']);\n/**\n * What a view may ASK THE DAEMON for — the four host methods of SEP-1865 that cannot be served\n * in the browser, reduced to a checked union rather than forwarded as raw JSON-RPC.\n *\n * The reduction is the point. Everything else the spec gives a view (`ui/initialize`, the size\n * and logging notifications, `ui/open-link`) is browser-local and never reaches a wire, so what\n * remains here is exactly the surface with an authorization question attached — and a union the\n * daemon can validate before it acts beats a passthrough it has to sanitize after. The candidate\n * set for every one of them comes from the trusted session snapshot, never from this payload:\n * `appId` names a live card in the sender's OWN conversation, and that card names the one server\n * whose tools and resources the view may reach.\n */\nexport const McpAppRpc = z.discriminatedUnion('method', [\n // `tools/call` — a real tool call on this app's own server, recorded in the transcript like any\n // other. An app cannot act invisibly.\n z.object({\n method: z.literal('tools/call'),\n name: z.string().min(1).max(200),\n args: z.record(z.string(), z.unknown()).optional()\n }),\n // `resources/read` — this app's own server only, which is what makes a bare uri safe to take.\n z.object({ method: z.literal('resources/read'), uri: z.string().min(1).max(2048) }),\n // `ui/message` — the frame speaking into the conversation. Delivered as an ORDINARY user turn\n // under the author the relay verified, never an author the page named: the roster check, the\n // busy/steer decision and the transcript then apply to it exactly as to something typed in the\n // composer. What bounds a page posting in a loop is the card's own call budget and that busy\n // gate, not a hop count — a user turn has no hop to charge.\n z.object({ method: z.literal('ui/message'), text: z.string().min(1).max(4000) }),\n // `ui/update-model-context` — what the app wants the next turn to know. Held on the session.\n z.object({ method: z.literal('ui/update-model-context'), context: z.string().max(MCP_APP_CONTEXT_MAX_CHARS) })\n]);\n/** One view RPC's answer, as the daemon hands it back for the browser to complete the view's\n * JSON-RPC call with. `ok:false` carries a message the frame may show; it is never a transport\n * failure dressed as a result — an undeliverable RPC never reaches here at all. */\nexport const McpAppRpcResult = z.union([\n z.object({ ok: z.literal(true), result: z.unknown() }),\n z.object({ ok: z.literal(false), error: z.string().max(500) })\n]);\nexport const WebchatEvent = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('message'),\n text: z.string(),\n segmentId: z.string().uuid().optional(),\n postId: z.string().uuid().optional()\n }), // from agent_message_chunk\n z.object({ kind: z.literal('thinking'), text: z.string() }), // from agent_thought_chunk\n z.object({ kind: z.literal('tool_call'), toolCallId: z.string(), title: z.string(), status: z.string() }),\n // `title` is set only when this update refines the initial `tool_call` title (e.g.\n // Codex web_search names itself generically first, then retitles with the actual\n // query once known) — mirrors the ACP field so the live view can retitle in place\n // the same way the persisted transcript already does (TranscriptRecorder.titles).\n z.object({\n kind: z.literal('tool_update'),\n toolCallId: z.string(),\n status: z.string(),\n title: z.string().optional()\n }),\n // The runtime's auto-generated session title (from ACP session_info_update). The\n // daemon persists it (session/list surfaces it on the persisted row); this streams\n // the same value so the LIVE playground session renames itself in place, matching\n // what a Slack session shows once its title lands.\n z.object({ kind: z.literal('session_info'), title: z.string() }),\n // A turn-final context refresh discarded the streamed candidate\n // (webchat-multi-agents.md §5.4): the conversation changed while the agent was\n // answering, so the browser collapses this lane's streamed text in place and\n // the replacement generation streams next under the SAME turnId. `generation`\n // is the replacement's ordinal (1 = first retry). An event rather than a\n // terminal frame: the turn still ends with exactly one `done`, so replay,\n // busy-state, and older browsers (which ignore unknown kinds) stay coherent.\n z.object({ kind: z.literal('superseded'), generation: z.number().int() }),\n // Live-only startup progress: replace this turn's wait notice; empty text clears it. Never persisted.\n // `standing` ⇒ the line is not a wait but something the reader has to keep: an ask this surface\n // could not show, or an answer it would not take (#1794). A wait notice retires the moment\n // output resumes, which would delete exactly those lines; a standing one stays put. An added\n // OPTIONAL field rather than a new kind, for the reason `elicitation.multi` records: a relay or\n // browser predating it decodes the event unchanged and merely retires the line early, where an\n // unknown kind would drop the frame and leave the silence this field exists to end.\n z.object({ kind: z.literal('notice'), text: z.string(), standing: z.boolean().optional() }),\n // The turn's task list (ACP `plan`). Unlike every other kind here it is a SNAPSHOT: ACP\n // resends the whole list on each revision, so the client keeps the latest and never\n // appends. Streamed because the same block already lands in the persisted transcript\n // (transcript-full-tool-body.md §8) — without it a live turn hides its plan until the\n // page is re-read from history, which is exactly the gap this closes.\n // COMPAT: a relay predating this kind fails that ONE frame's decode and drops the chunk.\n // Non-fatal by construction — the relay answers with an error frame and keeps the\n // connection, so every other chunk still flows and the turn degrades to showing its plan\n // only after the fact. There is no relay capability echo to gate on (`rd/hello/ok` carries\n // only `relayId`), so this is the tradeoff rather than an oversight.\n z.object({ kind: z.literal('plan'), entries: z.array(PlanEntry) }),\n ElicitCard.extend({ kind: z.literal('elicitation') }),\n // The same card, settled. Slack rewrites its message in place; this stream is\n // append-only, so the collapse is a second event keyed by the same `requestId`.\n // `label` is the chosen option's label — the chosen labels joined, for a multi-select —\n // and is present only on 'accepted'.\n // 'completed' is URL mode's second settlement (ACP `elicitation/complete`): the card is\n // already 'accepted' at consent, and this only re-labels it once the agent says the flow\n // finished. An old reader fails THIS frame's decode and keeps showing the consented card —\n // the losing direction is a missing \"Completed\" label, never a wrong verdict.\n z.object({\n kind: z.literal('elicitation_resolved'),\n requestId: z.string().min(1).max(200),\n outcome: z.enum(['accepted', 'dismissed', 'cancelled', 'completed']),\n label: z.string().optional()\n }),\n // A runtime approval handed to an API caller first (shared-bot-relay.md §10.4), answered by `permission_choice`.\n z.object({\n kind: z.literal('permission'),\n requestId: z.string().uuid(),\n tool: z.string().max(240),\n detail: z.string().max(240)\n }),\n // An MCP App opened (webchat-mcp-apps.md §5). A new KIND rather than a field on something\n // existing, and the skew that follows is the closed one: a relay or browser predating it fails\n // exactly this frame's decode and shows the turn without the frame, while the tool's own text\n // result has already reached the model — so the agent still answered in words and nothing\n // waits on a reader who was never shown anything. An elicitation could not take that trade,\n // which is why `multi`/`text`/`url` went on the card as optional fields instead.\n McpAppCard.extend({ kind: z.literal('app') }),\n // One ordered slice of a card's template. Rides the ordinary reply stream, so it takes the\n // turn's own cursor and arrives in order — unlike `app_rpc_result`/`app_resolved`, which are\n // correlated and idempotent and may bypass it, a chunk is meaningless out of sequence.\n z.object({\n kind: z.literal('app_template'),\n appId: z.string().min(1).max(200),\n seq: z.number().int().min(0),\n chunk: z.string().min(1).max(MCP_APP_TEMPLATE_CHUNK_CHARS)\n }),\n // The same card, settled — append-only, keyed by `appId`, exactly as `elicitation_resolved` is.\n z.object({ kind: z.literal('app_resolved'), appId: z.string().min(1).max(200), outcome: McpAppOutcome }),\n // One view RPC's answer, correlated by the `callId` the browser minted on the `app_rpc` op.\n // It rides the reply STREAM rather than a request/reply frame of its own, because the stream is\n // the only channel webchat has that already survives what an app's RPC has to survive: the\n // relay bridging a browser onto a daemon, a reconnect mid-call, and a turn ending underneath it.\n // The browser completes the view's JSON-RPC call from this; an answer with no live call is\n // dropped, which is what makes a replayed stream harmless.\n z.object({\n kind: z.literal('app_rpc_result'),\n appId: z.string().min(1).max(200),\n callId: z.string().min(1).max(64),\n outcome: McpAppRpcResult\n }),\n // A shared image, already committed to the transcript; later original changes arrive as `image_update`.\n SharedImage.extend({\n kind: z.literal('image'),\n postId: z.string().uuid(),\n at: z.number().int(),\n text: z.string().max(SHARED_IMAGE_TEXT_MAX_CHARS),\n download: SharedImageDownload.optional()\n })\n]);\n// The session status-bar snapshot (model / context / tokens / cost), rebuilt from\n// the daemon's model selector + folded ACP usage. All fields optional so a partial\n// snapshot is valid: context/cost stream live via ACP `usage_update`, while token\n// totals only refresh at each turn's end. Carried as an extra field on the output\n// payload (see below) rather than a reply-stream event — a status update is not part\n// of the transcript and can arrive with no text chunk of its own.\nexport const WebchatStatus = z.object({\n runtime: z.string().optional(),\n model: z.string().optional(),\n effort: z.string().optional(),\n // Effective session permission preset; Codex Auto is composite rather than a raw mode.\n permissionMode: z.string().optional(),\n fastMode: z.boolean().optional(),\n contextUsed: z.number().int().optional(),\n contextSize: z.number().int().optional(),\n totalTokens: z.number().int().optional(),\n costAmount: z.number().optional(),\n costCurrency: z.string().optional(),\n // The models this session's runtime advertises as selectable (from the ACP model\n // config option) — populates the console's model dropdown. Absent ⇒ no selector.\n models: z.array(z.string()).optional(),\n // The reasoning-effort levels this session's runtime offers (from the ACP\n // `thought_level` config option, plus the synthetic `ultracode`/`max` entries on\n // Claude runtimes) — populates the console's effort dropdown. Absent ⇒ no selector.\n efforts: z.array(z.string()).optional(),\n // Selectable session permission modes, from the runtime's ACP `mode` select.\n // Omitted when the Agent disables chat-side changes.\n permissionModes: z.array(z.string()).optional(),\n // Whether the selected model advertises a fast-mode toggle (the ACP `model_config`\n // config option only appears once a fast-capable model is selected). Absent/false ⇒\n // no fast toggle shown.\n fastModeAvailable: z.boolean().optional(),\n // Whether a message sent while this turn runs can be steered into it over the runtime's\n // `_session/steering` (#1847): the composer then sends at once instead of queueing locally.\n steerable: z.boolean().optional(),\n // This conversation's session, by its outward id (session-concept.md §1.1), so the console can\n // deep-link to the session detail page. Absent until the session is created.\n sessionId: z.string().optional()\n});\n// Daemon→browser reply payload, carried as an `output` item inside relay `rd/chat`:\n// one chunk of a turn's reply and/or a status snapshot. `event` is optional so a\n// status-only payload (no reply chunk) is valid; every payload still carries a\n// monotonic `index` for client-side ordering.\nexport const WebchatOutput = z\n .object({\n conversationId: z.string().uuid(),\n turnId: z.string().uuid(),\n // Which participant is streaming — a multi-agent conversation renders one\n // stream lane per (turnId, agentId). Absent ⇒ the conversation's sole agent.\n agentId: z.string().uuid().optional(),\n index: z.number().int(),\n event: WebchatEvent.optional(),\n status: WebchatStatus.optional()\n})\n // A payload must carry at least one of event/status — an empty payload is meaningless.\n .refine((o) => o.event !== undefined || o.status !== undefined, {\n message: 'WebchatOutput must carry event and/or status'\n});\n// Daemon→browser terminal payload, carried as a `done` item inside relay `rd/chat`.\n// `error` is set when the turn ended in FAILURE (agent failed to start, ACP\n// handshake/prompt rejected) rather than completing — a human-readable reason the\n// client renders instead of a normal reply. When present, `stopReason`/`usage` are\n// absent (the turn produced no clean result).\nexport const WebchatDone = z.object({\n conversationId: z.string().uuid(),\n turnId: z.string().uuid(),\n // Which participant's turn ended (multi-agent attribution, as on WebchatOutput).\n agentId: z.string().uuid().optional(),\n // Last output index emitted before this terminal marker. A reconnecting browser\n // holds `done` until it has assembled every output through this index, so an\n // early terminal frame cannot hide a gap. Optional for rolling compatibility.\n lastIndex: z.number().int().min(-1).optional(),\n stopReason: z.string().optional(),\n usage: z.object({ used: z.number().int().optional(), cost: z.number().optional() }).optional(),\n error: z.string().optional()\n});\n// Browser operations ride relay `rd/msg` as RelayWebchatOp. No webchat content\n// frame is registered on the daemon↔CP control WS, so the CP stays off the\n// webchat hot path.\n//# sourceMappingURL=webchat.js.map","import { z } from 'zod';\nimport { NativeMcpUi } from '../mcp-app.js';\nimport { SessionKey } from './route.js';\nimport { ElicitCard, MCP_APP_HTML_MAX_BYTES, McpAppCsp, McpAppDimensions, McpAppOutcome, PlanEntry, SharedImage, WebchatImageAttachment } from './webchat.js';\n/**\n * Session read-back (C→D REQ → REP) — the console's on-demand pulls.\n *\n * Session bodies are daemon-local (body-locality, §1/§12). The CP may persist a\n * metadata-only session-list snapshot from daemon `event/session` events, while\n * transcript/tool bodies are pulled live from the owning daemon and proxied to\n * the console only for display.\n *\n * - `session/list`: the daemon's local metadata projection, used for snapshots\n * and direct read-back/debugging.\n * - `session/history`: one cursor-paginated page of a session's transcript.\n */\n/**\n * Per-session token accounting, metered by the daemon from the agent's ACP usage\n * stream. Token counts are CUMULATIVE across the session's turns (summed from each\n * turn's `PromptResponse.usage`); context/cost are the LATEST snapshot from the\n * agent's `usage_update` stream. Every field is optional — a runtime that reports\n * no usage yields an absent field, not a zero.\n */\nexport const SessionUsage = z.object({\n totalTokens: z.number().int().optional(),\n inputTokens: z.number().int().optional(),\n outputTokens: z.number().int().optional(),\n thoughtTokens: z.number().int().optional(),\n cachedReadTokens: z.number().int().optional(),\n cachedWriteTokens: z.number().int().optional(),\n contextUsed: z.number().int().optional(), // current context-window occupancy\n contextSize: z.number().int().optional(), // context-window size\n costAmount: z.number().optional(), // running session cost\n costCurrency: z.string().optional()\n});\n/** One row in the session list (metadata + console metrics; NOT the transcript). */\nexport const SessionListItem = z.object({\n sessionId: z.string(), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n // The stable ACP session id that spawned this session through sendMessage.\n // Absent for root sessions. This is lineage metadata only, never a body.\n parentSessionId: z.string().optional(),\n sessionKey: SessionKey, // platform/channel/thread — drives the \"integration · channel\" column\n agentId: z.string().uuid(),\n title: z.string().optional(), // human-facing session title (daemon-derived)\n status: z.string().optional(), // e.g. \"plan\" / \"completed\" / \"awaiting approval\"\n lastActivityAt: z.string().optional(), // ISO/string ts of the last activity\n usage: SessionUsage.optional(), // per-session token/cost accounting (daemon-metered)\n triggeredBy: z.string().optional(), // sender handle/id that triggered/drove the run\n // Human-readable display names, resolved + cached by the daemon (the only side\n // holding platform credentials). Always optional — the raw ids above stay the\n // canonical identity; absent when the daemon hasn't resolved them (yet).\n channelName: z.string().optional(), // \"general\" for a Slack \"C…\" channel; \"@Dana Reyes\" for a \"D…\" DM\n triggeredByName: z.string().optional(), // display name for `triggeredBy`\n // Platform-native deep link back to the source message/thread. The daemon\n // either captures the provider URL at ingress or derives it from the owning\n // integration. Optional when the platform exposes no addressable source.\n threadUrl: z.string().optional()\n});\n/** C→D REQ: list the daemon's sessions (optionally just one agent's). */\nexport const SessionListReq = z.object({\n agentId: z.string().uuid().optional() // omit ⇒ all this daemon's sessions\n});\n/** D→C REP (corr = req id): the daemon's current sessions. */\nexport const SessionListPage = z.object({\n sessions: z.array(SessionListItem)\n});\n/**\n * The full ACP tool body, transported as a JSON STRING in `SessionMessage.body`.\n * Kept structurally faithful to the ACP `ToolCall`; free-form fields stay opaque\n * (`z.unknown()`) so no daemon-side redaction/reshaping is implied.\n */\nexport const ToolBody = z.object({\n toolCallId: z.string(),\n kind: z.string().optional(), // ACP ToolKind: read|edit|delete|move|search|execute|think|fetch|switch_mode|other\n status: z.string().optional(), // ACP ToolCallStatus: pending|in_progress|completed|failed\n rawInput: z.unknown().optional(),\n rawOutput: z.unknown().optional(),\n content: z.array(z.unknown()).optional(), // ACP ToolCallContent[] kept opaque (content|diff|terminal blocks)\n locations: z.array(z.object({ path: z.string(), line: z.number().int().optional() })).optional(),\n truncated: z.boolean().optional() // set when the daemon capped the stored body at write time\n});\n/**\n * The agent's task list for ONE turn, transported as a JSON STRING in `SessionMessage.body`\n * on a `plan` row. An ACP plan update carries the WHOLE entry list every time, so this is a\n * snapshot, not a delta — the daemon rewrites one row per turn rather than appending. The\n * live webchat stream carries the same entries as they change (`WebchatEvent` kind `plan`).\n */\nexport const PlanBody = z.object({ entries: z.array(PlanEntry) });\n/** How a persisted elicitation card ended. The four the live stream also carries, plus\n * `unrenderable` — the ask no surface had a control for, which was only ever a live notice\n * (#1839) and so vanished on reload. Absent ⇒ the card was still open when it was recorded,\n * which after a daemon restart means nobody ever answered it. */\nexport const ElicitOutcome = z.enum(['accepted', 'dismissed', 'cancelled', 'completed', 'unrenderable']);\n/**\n * The agent's structured question, transported as a JSON STRING in `SessionMessage.body` on an\n * `elicit` row: the card exactly as it was offered, plus how it ended. The row exists so a page\n * reload — or a reader who joins later — still sees that the question was asked and what was\n * answered, which the live-only card lost.\n *\n * `answerLabel` is the chosen option's LABEL (the labels joined, for a multi-select or a form),\n * never the accepted content: what a reader needs is what was picked, and the values are already\n * in the agent's own context. The raw `requestedSchema` is absent for the same reason it never\n * reaches any wire — the card is the reduction, and the reduction is what was shown.\n */\nexport const ElicitBody = ElicitCard.extend({\n outcome: ElicitOutcome.optional(),\n answerLabel: z.string().optional()\n});\n/**\n * An `app` row: one MCP App card as the transcript KEEPS it (webchat-mcp-apps.md §8).\n *\n * The WHOLE card, template included, because a reader who reloads wants the interface back and a\n * header saying one was shown is not that. The template is what makes the row large, so it never\n * rides a transcript PAGE: the history projection strips it and marks the row truncated, and the\n * console pulls the full body through the same on-demand daemon read an oversized tool body uses.\n *\n * `server` and `conversationId` are the daemon's OWN record of what the card may reach, kept here\n * so a card outlives the process that opened it. They are read back by the daemon, never by the\n * frame: a view still names only its `appId`, so it can no more select a server after a reload\n * than it could before one.\n *\n * `outcome` absent while the card is live; a row that STAYS absent is a card whose daemon died\n * holding it, which reads as unfinished rather than as falsely closed.\n */\nexport const McpAppBody = z.object({\n nativeUi: NativeMcpUi.optional(),\n appId: z.string().min(1).max(200),\n title: z.string().max(200),\n toolName: z.string().min(1).max(200),\n toolResult: z\n .object({\n content: z.array(z.unknown()).max(64).optional(),\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n isError: z.boolean().optional()\n })\n .optional(),\n outcome: McpAppOutcome.optional(),\n /** The `ui://` template, verbatim. Absent from a transcript PAGE (stripped as oversized) and\n * present in the full-body read — so a row with `bodyTruncated` is a card whose page is one\n * fetch away, not one that was never recorded. */\n html: z.string().max(MCP_APP_HTML_MAX_BYTES).optional(),\n /** The arguments the card was opened with, replayed to the view as `ui/notifications/tool-input`\n * so a reloaded page renders what it rendered live rather than an empty shell. */\n toolInput: z.record(z.string(), z.unknown()).optional(),\n csp: McpAppCsp.optional(),\n dimensions: McpAppDimensions.optional(),\n /** The CONFIGURED server name the card's tool came from — the one server a re-armed view may\n * reach. Daemon-read; absent on a row written before templates were kept, which is what makes\n * such a card replayable as a record but never re-armable. */\n server: z.string().max(200).optional(),\n /** The conversation the card was opened in, re-checked against the routed frame's own before a\n * reloaded card is re-armed — the persisted half of the live registry's conversation fence. */\n conversationId: z.string().max(200).optional()\n});\n// The user-turn body schemas live in a bundler-safe leaf (the console validates with them);\n// re-exported here so every wire consumer keeps finding them beside the tool and plan bodies.\nexport { CodehostTurnFacts, LinearTurnFacts, SessionMessageTurnFacts, UserTurnBody } from '../user-turn-body.js';\n/** One bounded webchat image persisted only in the daemon-local transcript. */\nexport const SessionImageAttachment = WebchatImageAttachment;\n/** One message in a session transcript page (a body — returned only for display). */\nexport const SessionMessage = z.object({\n seq: z.number().int(), // daemon-local insertion order within the session\n sender: z.string(), // platform handle/id of the author\n senderName: z.string().optional(), // display name (daemon-resolved; absent if unknown)\n senderAvatarUrl: z.string().url().optional(), // public provider profile image; absent if unavailable\n // Daemon-verified AgentConnect Slack app/bot provenance. Optional for rolling\n // compatibility and absent on legacy rows or every non-Slack transport.\n trustedAgentBot: z.boolean().optional(),\n ts: z.string(), // platform timestamp (daemon-local string form)\n // Normalized chronological coordinate (epoch µs) from the daemon's event-time\n // axis — provider-authoritative when the platform supplied its send time.\n // Absent on legacy rows; consumers fall back to deriving it from `ts`.\n eventTimeUs: z.number().int().positive().optional(),\n // Canonical webchat post identity (merged-conversation-view.md §6): minted once\n // at origin and identical on every participant's copy, independent of a\n // collision-bumped `ts`. Absent on non-webchat rows and pre-upgrade rows.\n postId: z.string().uuid().optional(),\n kind: z.string(), // \"text\" / tool / reasoning / plan / elicit / … (daemon transcript kind)\n text: z.string(),\n attachments: z.array(SessionImageAttachment).max(1).optional(),\n // A shared image's preview and original descriptor (webchat-generated-images.md §4); never a signed URL.\n sharedImage: SharedImage.optional(),\n // ── body enrichment (optional ⇒ text/reasoning rows and old daemons omit these) ──\n toolCallId: z.string().optional(), // parsed from the ToolBody (tool rows only)\n toolStatus: z.string().optional(), // ACP ToolCallStatus, surfaced for the console badge\n toolKind: z.string().optional(), // ACP ToolKind, surfaced for the console icon\n body: z.string().optional(), // JSON.stringify(ToolBody) on a tool row, PlanBody on a plan row, ElicitBody on an elicit row; a tool body may be a truncated-but-VALID-JSON preview\n bodyTruncated: z.boolean().optional(), // preview was shrunk for the frame; full body via session/tool-body\n bodyBytes: z.number().int().optional() // full (untruncated) body byte length\n});\n/** C→D REQ: fetch one page of a session's history from the owning daemon. */\nexport const SessionHistoryReq = z\n .object({\n // Optional only for rolling compatibility with an older CP. A current CP always\n // sends the authorized owner and the daemon re-checks the session binding.\n agentId: z.string().uuid().optional(),\n sessionId: z.string(), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n cursor: z.string().optional(), // opaque; omit ⇒ newest page\n // Monotonic daemon-local transcript revision. Mutually exclusive with the\n // backward-pagination cursor; used by an open console view to pull inserts\n // and same-seq tool updates without replaying the whole transcript.\n after: z\n .string()\n .regex(/^\\d+$/)\n .refine((value) => Number.isSafeInteger(Number(value)))\n .optional(),\n limit: z.number().int().positive().max(200).default(50)\n})\n .refine(({ cursor, after }) => cursor === undefined || after === undefined, {\n message: 'cursor and after are mutually exclusive'\n});\n/** D→C REP (corr = the req id): a page of messages + the cursor for the next page. */\nexport const SessionHistoryPage = z.object({\n sessionId: z.string(), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n messages: z.array(SessionMessage), // chronological oldest→newest within the page (seq breaks equal-time ties)\n nextCursor: z.string().optional(), // absent ⇒ no older messages\n // Optional for rolling compatibility. `liveCursor` is the next `after`\n // watermark; `liveMore` means another forward page is immediately available.\n liveCursor: z.string().optional(),\n liveMore: z.boolean().optional()\n});\n/**\n * C→D REQ: fetch the FULL (untruncated) ToolBody JSON for one tool call, chunked.\n * The inline `SessionMessage.body` preview is capped at 32 KiB; when a body is\n * bigger the console pages the whole thing back through this frame by offset.\n */\nexport const SessionToolBodyReq = z.object({\n // Optional only for rolling compatibility with an older CP; see SessionHistoryReq.\n agentId: z.string().uuid().optional(),\n sessionId: z.string(),\n toolCallId: z.string(),\n offset: z.number().int().nonnegative().default(0)\n});\n/** D→C REP (corr = the req id): one frame-budgeted byte slice of the full ToolBody JSON. */\nexport const SessionToolBodyChunk = z.object({\n sessionId: z.string(),\n toolCallId: z.string(),\n data: z.string(), // UTF-8-boundary-safe byte slice of the FULL ToolBody JSON\n totalBytes: z.number().int(),\n nextOffset: z.number().int().optional() // absent ⇒ this is the last chunk\n});\n/**\n * session-concept §5.4 — the shared shape of a child-session status answer, returned by BOTH\n * legs of a cross-daemon status read (`session/child-status/ok` from the CP to the asking daemon,\n * and `session/child-status/probe/ok` from the owning daemon to the CP).\n *\n * `found:false` is deliberately the single negative outcome for \"unknown session\" AND \"not your\n * child\": distinguishing them would let a caller probe for the existence of sessions it may not\n * read, which is exactly what the daemon-local path also refuses to do. `reason` describes only\n * TRANSPORT-level failure (the owning daemon is unreachable), never an authorization verdict.\n */\nexport const ChildSessionStatus = z.object({\n found: z.boolean(),\n /** The agent that owns the child session. Present only when `found`. */\n agentId: z.string().uuid().optional(),\n /** Coarse progress, collapsed by the OWNING daemon from its own session lifecycle. */\n status: z.enum(['in-progress', 'failed', 'done']).optional(),\n /** The underlying lifecycle state, for a caller that wants the detail. */\n state: z.enum(['starting', 'idle', 'prompting', 'cancelling', 'resuming', 'closed']).optional(),\n /** Epoch ms of the child's last state change. */\n updatedAt: z.number().int().optional(),\n /** Optional during rolling upgrades; current daemons always return it for found children. */\n reply: z\n .object({\n requested: z.boolean(),\n state: z.enum(['not-requested', 'awaiting', 'queued-for-parent', 'not-sent', 'failed', 'unknown'])\n })\n .optional(),\n nextAction: z.enum(['none', 'wait', 'finish-turn-and-wait', 'report-failure', 'report-missing-reply']).optional(),\n message: z.string().optional(),\n /** Transport-level failure only: the owning daemon is not currently reachable. */\n reason: z.enum(['offline']).optional()\n});\n/**\n * D→C REQ: \"what is the status of a child session my session started, which lives on ANOTHER\n * daemon?\" The CP is the placement authority, so it resolves `childAgentId` to the owning daemon\n * and forwards the question there — the daemon never addresses another daemon directly.\n *\n * AUTHORIZATION IS TWO-SIDED. The CP verifies that `parentSessionId` really is a session reported\n * by the ASKING daemon (a daemon cannot claim someone else's parent session), and the owning\n * daemon then verifies that the child's durable origin link actually equals `parentSessionId`.\n * Neither check alone is sufficient: the first stops a forged parent claim, the second is the\n * real lineage rule and is enforced where the session lives.\n */\nexport const ChildSessionStatusReq = z.object({\n /** The ASKING session's own stable acpSessionId. The CP validates ownership of this. */\n parentSessionId: z.string().min(1),\n /** The child's logical session key, exactly as `sendMessage` handed it back. Opaque to the CP. */\n childSessionId: z.string().min(1),\n /** The child agent, so the CP can resolve placement without parsing the composite key. */\n childAgentId: z.string().uuid()\n});\n/**\n * C→D REQ: the forwarded leg of {@link ChildSessionStatusReq}, sent to the daemon that OWNS the\n * child. `childAgentId` is dropped — placement is already resolved — leaving exactly the lineage\n * pair the owning daemon authorizes on. The CP does not persist or interpret the answer.\n */\nexport const ChildSessionStatusProbe = z.object({\n parentSessionId: z.string().min(1),\n childSessionId: z.string().min(1)\n});\n/**\n * C→D REQ → `session/visibility/ok` (session-visibility.md §5.1): the CP pushes\n * a session's authoritative effective visibility so the owning daemon updates\n * its local memory-capture gate. Control signaling only — one privacy bit per\n * session, never content.\n *\n * `visibilityRev` is the session's dedicated durable visibility counter\n * (bumped in the same CP transaction as every visibility change, settlement,\n * and cascade). It is deliberately NOT the transcript revision nor the WS\n * `sessionEpoch`/`seq` fences — those are connection/launch-scoped and do not\n * advance with visibility. Delivery is at-least-once; the rev makes duplicate\n * and out-of-order application safe on the daemon.\n */\nexport const SessionVisibilityPush = z.object({\n sessionId: z.string().min(1), // the session's opaque outward identity (session-concept.md §1.1) — never the ACP hop's id\n // The session's owning agent. ACP session ids are runtime-local, so on a pool's\n // shared store the id alone names a gate every org could claim. Optional for\n // rolling upgrades: an older CP omits it and the daemon attributes the push to\n // the sole local holder, or leaves the gate closed when there is no single one.\n agentId: z.string().min(1).optional(),\n visibility: z.enum(['private', 'org', 'external']),\n // New daemons use this explicit capture/recall verdict. It is optional for\n // wire compatibility with older CPs and decouples the runtime safety gate\n // from the console visibility vocabulary.\n sharedMemoryExcluded: z.boolean().optional(),\n visibilityRev: z.number().int().nonnegative()\n});\n/**\n * D→C REP (corr = the push's id). `status` reports how the daemon settled the\n * push: `applied` = the rev advanced its stored gate state; `superseded` = the\n * rev is ≤ the stored one, so nothing was reapplied — but the frame is STILL\n * acknowledged (never answered with an `error` frame): \"ignore\" must never\n * mean \"don't ACK\", or a lost ACK leaves the CP retrying forever. The CP\n * records the ack watermark on either status.\n */\nexport const SessionVisibilityOk = z.object({\n sessionId: z.string().min(1),\n visibilityRev: z.number().int().nonnegative(),\n status: z.enum(['applied', 'superseded'])\n});\n/**\n * C→D REQ → generic `ack` (session-visibility.md §5.1): the register-time\n * replay of the current `(sessionId, visibility, visibilityRev)` set for the\n * daemon's active sessions — a snapshot, not a diff — closing the window\n * where a visibility change happened while the daemon was offline. Each entry\n * applies with the same rev semantics as a single push; a stale entry is\n * skipped, never an error. Chunked by the CP; ≤ 1000 entries per frame keeps\n * it far under the frame-size cap.\n */\nexport const SessionVisibilitySnapshot = z.object({\n entries: z.array(SessionVisibilityPush).max(1000)\n});\n/** R→C level-triggered wake. Review bodies, event details, and CI logs stay off the CP. */\nexport const PullRequestFeedbackSignal = z.object({\n deliveryKey: z.string().min(1).max(200),\n installationId: z.string().regex(/^[1-9]\\d*$/),\n repoId: z.string().regex(/^[1-9]\\d*$/),\n repoFullName: z.string().min(3).max(300),\n pullNumber: z.number().int().positive()\n});\n/** C→D exact-session continuation. The daemon constructs the prompt locally and reads current code-host state. */\nexport const SessionPullRequestFeedback = PullRequestFeedbackSignal.omit({ installationId: true }).extend({\n agentId: z.string().uuid(),\n sessionId: z.string().min(1),\n provider: z.enum(['gitlab', 'gitea']).optional(),\n host: z.string().url().optional()\n});\nexport const SessionPullRequestFeedbackResult = z.object({\n deliveryKey: z.string().min(1).max(200),\n accepted: z.boolean(),\n reason: z\n .enum(['not_found', 'not_ready', 'paused', 'busy', 'draining', 'integration_offline', 'durability'])\n .optional()\n});\n//# sourceMappingURL=session.js.map","import { z } from 'zod';\n/** Event wake for follow-ups (assistant-mode.md §5.14): a relay advertising it is sent the watched objects, and a CP advertising it accepts their events and answers `assistant/follow-up-watch`. */\nexport const FOLLOW_UP_WATCH_FEATURE = 'follow-up-watch-v1';\n/** A daemon advertising it answers `assistant/follow-up-wake`; the CP accepts no subscription from one without it and sends it no wake. */\nexport const FOLLOW_UP_WAKE_FEATURE = 'follow-up-wake-v1';\n/** An agent holds at most this many watches, a fixed limit as reminders have. */\nexport const FOLLOW_UP_WATCH_MAX = 100;\n/** A daemon sends `assistant/follow-up-watch` single-shot with this ack budget: a new watch reads its object on the code host first. */\nexport const FOLLOW_UP_WATCH_BUDGET_MS = 30_000;\n/** What happened on a watched object; the first six are changes of state, the rest discussion. */\nexport const FollowUpEventKind = z.enum([\n 'merged',\n 'closed',\n 'reopened',\n 'approved',\n 'changes_requested',\n 'checks',\n 'comment',\n 'review',\n 'commits'\n]);\nconst STATE_EVENTS = new Set([\n 'merged',\n 'closed',\n 'reopened',\n 'approved',\n 'changes_requested',\n 'checks'\n]);\n/** A change of state wakes after one quiet minute; discussion waits five minutes (§5.14 Events). */\nexport function isFollowUpStateEvent(kind) {\n return STATE_EVENTS.has(kind);\n}\nexport const FollowUpWatchSubject = z.enum(['pull', 'issue']);\n/** The one pull request, merge request or issue a follow-up watches, as its URL names it; the CP resolves the numeric identity. */\nexport const FollowUpWatchTarget = z.object({\n provider: z.enum(['github', 'gitlab']),\n host: z.string().min(1).max(253),\n repoPath: z.string().min(3).max(300),\n subject: FollowUpWatchSubject,\n number: z.number().int().positive()\n});\nconst GITHUB_HOSTS = new Set(['github.com', 'www.github.com']);\nconst GITHUB_PATH = /^\\/([A-Za-z0-9-]+)\\/([A-Za-z0-9._-]+)\\/(pull|issues)\\/([1-9]\\d{0,9})(?:\\/.*)?$/;\nconst GITLAB_PATH = /^\\/((?:[A-Za-z0-9._-]+\\/)+[A-Za-z0-9._-]+)\\/-\\/(merge_requests|issues)\\/([1-9]\\d{0,9})(?:\\/.*)?$/;\n/** Parse a watch URL: GitHub's `/<owner>/<repo>/pull|issues/<n>`, GitLab's `/<path>/-/merge_requests|issues/<iid>`; anything else is refused with a reason. */\nexport function parseFollowUpWatchUrl(raw) {\n let url;\n try {\n url = new URL(raw.trim());\n }\n catch {\n return { error: 'not a URL' };\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:')\n return { error: 'not an http(s) URL' };\n const host = url.hostname.toLowerCase();\n const path = decodeURIComponent(url.pathname).replace(/\\/+$/, '');\n if (GITHUB_HOSTS.has(host)) {\n const match = GITHUB_PATH.exec(path);\n if (!match)\n return { error: 'not a GitHub pull request or issue URL' };\n return {\n target: {\n provider: 'github',\n host: 'github.com',\n repoPath: `${match[1]}/${match[2]}`,\n subject: match[3] === 'pull' ? 'pull' : 'issue',\n number: Number(match[4])\n }\n };\n }\n const match = GITLAB_PATH.exec(path);\n if (!match)\n return { error: 'not a pull request, merge request or issue URL' };\n return {\n target: {\n provider: 'gitlab',\n host: url.port ? `${host}:${url.port}` : host,\n repoPath: match[1],\n subject: match[2] === 'merge_requests' ? 'pull' : 'issue',\n number: Number(match[3])\n }\n };\n}\n/** Why a watch was not taken: not readable with the agent's access, no such object, no events from that host here, the agent's limit, or a transient failure. */\nexport const FollowUpWatchRefusal = z.enum(['no_access', 'not_found', 'unsupported', 'limit', 'unavailable']);\n/** A taken watch, as the CP resolved it: the canonical path for display, never a numeric id. */\nexport const FollowUpWatched = FollowUpWatchTarget.pick({\n provider: true,\n repoPath: true,\n subject: true,\n number: true\n}).extend({\n // The repository's numeric id, which a check's code-host reads aim at (§5.14).\n repoId: z\n .string()\n .regex(/^[1-9]\\d*$/)\n .optional()\n});\n/** How a watched object is named to people: `owner/repo#12`, or a GitLab merge request's `group/project!3`. */\nexport function followUpWatchLabel(watched) {\n const mark = watched.provider === 'gitlab' && watched.subject === 'pull' ? '!' : '#';\n return `${watched.repoPath}${mark}${watched.number}`;\n}\n/** A follow-up's watch as the Activity row and the console show it (§5.14). */\nexport const FollowUpWatchState = z.enum(['pending', 'watching', 'refused', 'ended']);\nconst FollowUpId = z.string().min(1).max(200);\n/** D→C REQ: `set` subscribes or moves each listed follow-up, `remove` ends each, `full` is the agent's whole set and drops the rest. */\nexport const AssistantFollowUpWatchReq = z\n .object({\n agentId: z.string().uuid(),\n mode: z.enum(['set', 'remove', 'full']),\n watches: z\n .array(z.object({ followUpId: FollowUpId, target: FollowUpWatchTarget.optional() }))\n .max(FOLLOW_UP_WATCH_MAX)\n})\n .refine((req) => req.mode === 'remove' || req.watches.every((watch) => watch.target !== undefined), {\n message: 'set and full name a target for every watch'\n});\n/** C→D REP: one entry per listed follow-up, what is watched or why not; `remove` answers each with neither. */\nexport const AssistantFollowUpWatchResult = z.object({\n results: z\n .array(z.object({\n followUpId: FollowUpId,\n watched: FollowUpWatched.optional(),\n refused: FollowUpWatchRefusal.optional()\n }))\n .max(FOLLOW_UP_WATCH_MAX)\n});\n/** C→D REQ, body-free: the events that make a follow-up's check due, or a notice that its watch ended; `wakeId` grows per subscription so a retry starts no second check. */\nexport const AssistantFollowUpWake = z\n .object({\n agentId: z.string().uuid(),\n followUpId: FollowUpId,\n // The subscription's identity: its wakeIds count from a new start whenever it changes.\n subscription: z.number().int().positive().optional(),\n wakeId: z.number().int().positive(),\n kinds: z.array(FollowUpEventKind).max(FollowUpEventKind.options.length),\n latestAt: z.string().datetime().optional(),\n ended: z.enum(['access_lost']).optional()\n})\n .refine((wake) => wake.ended !== undefined || (wake.kinds.length > 0 && wake.latestAt !== undefined), {\n message: 'a wake names its events and when the latest arrived'\n});\n/** D→C REP: `not_found` ends the subscription; any other refusal holds the wake for a retry. */\nexport const AssistantFollowUpWakeResult = z.object({\n accepted: z.boolean(),\n reason: z.enum(['not_found', 'not_holder', 'not_ready']).optional()\n});\n/** C→R EVT: one watched GitHub object, by numeric identity; it never says which agent or follow-up watches it. */\nexport const RcFollowUpWatch = z.object({\n provider: z.enum(['github']),\n installationId: z.string().regex(/^[1-9]\\d*$/),\n repoId: z.string().regex(/^[1-9]\\d*$/),\n subject: FollowUpWatchSubject,\n number: z.number().int().positive(),\n watched: z.boolean()\n});\n/** The relay's key for one watched object. */\nexport function followUpWatchKey(watch) {\n return `${watch.provider}:${watch.repoId}:${watch.subject}:${watch.number}`;\n}\n//# sourceMappingURL=follow-up-watch.js.map","import { z } from 'zod';\n/** Organization Knowledge wire contracts (organization-knowledge.md). */\nexport const OrganizationArtifactKind = z.enum(['knowledge', 'skill']);\nexport const OrganizationSuggestionOperation = z.enum(['create', 'update']);\nexport const OrganizationSuggestionState = z.enum(['proposed', 'accepted', 'rejected']);\n/** Pending suggestion JSON is pulled in bounded chunks so even the largest\n * accepted skill candidate remains below the control wire's 256 KiB frame cap. */\nexport const MAX_ORGANIZATION_SUGGESTION_BODY_BYTES = 4 * 1024 * 1024;\nexport const ORGANIZATION_SUGGESTION_CHUNK_BYTES = 128 * 1024;\nexport const SkillBundleTextFile = z\n .object({\n path: z.string().min(1).max(256),\n /** UTF-8 text by default; base64 permits binary assets in a complete Agent\n * Skills directory bundle without embedding raw binary in JSON. */\n encoding: z.enum(['utf8', 'base64']).default('utf8'),\n content: z.string().max(699_052)\n})\n .strict();\nexport const OrganizationSuggestionInfo = z\n .object({\n candidateId: z.string().uuid(),\n kind: OrganizationArtifactKind,\n operation: OrganizationSuggestionOperation,\n targetId: z.string().uuid().optional(),\n targetRevision: z.number().int().positive().optional(),\n title: z.string().min(1).max(128),\n summary: z.string().max(1024).optional(),\n tags: z.array(z.string().min(1).max(64)).max(16).optional(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n contentBytes: z\n .number()\n .int()\n .positive()\n .max(4 * 1024 * 1024),\n state: OrganizationSuggestionState,\n sessionIds: z.array(z.string().min(1).max(256)).min(1).max(100),\n createdAt: z.string().datetime()\n})\n .strict()\n .superRefine((value, ctx) => {\n const hasTarget = value.targetId !== undefined || value.targetRevision !== undefined;\n if ((value.operation === 'update') !== hasTarget || (hasTarget && (!value.targetId || !value.targetRevision))) {\n ctx.addIssue({\n code: 'custom',\n message: 'update suggestions require both targetId and targetRevision; create suggestions require neither'\n });\n }\n});\n/** D→C: replace/upsert this daemon's bounded local suggestion inventory. */\nexport const OrganizationSuggestionsSyncReq = z\n .object({\n suggestions: z\n .array(OrganizationSuggestionInfo.extend({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128)\n }).strict())\n .max(256)\n})\n .strict();\nexport const OrganizationSuggestionDecision = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n state: z.enum(['accepted', 'rejected'])\n})\n .strict();\nexport const OrganizationSuggestionsSyncOk = z\n .object({ decisions: z.array(OrganizationSuggestionDecision).max(256) })\n .strict();\n/** Both sides read and write the organization record (organization-knowledge.md §15): the record frames and `withOutsiders` are sent only when the peer advertises it. */\nexport const KNOWLEDGE_RECORD_FEATURE = 'knowledge-record-v1';\n/** The three record entries' file names, as an assistant-mode agent's memory tools name them. */\nexport const KnowledgeRecordFile = z.enum(['organization.md', 'channels.md', 'members.md']);\n/** What kind of writer a record write comes from, kept on the revision. */\nexport const KnowledgeRecordWriterKind = z.enum(['research', 'first-look', 'conversation', 'person']);\n/** A record body is capped well under the 256 KiB frame limit. */\nexport const KNOWLEDGE_RECORD_MAX_BYTES = 128 * 1024;\nconst RecordOptOutKeys = z.array(z.string().min(1).max(512)).max(4096);\n/** D→C: one record entry, its revision and the opt-out keys. */\nexport const KnowledgeRecordReadReq = z.object({ agentId: z.string().uuid(), file: KnowledgeRecordFile }).strict();\n/** D→C: a revision-checked write of one record entry by an agent; opt-out marks land before it, lifts after. */\nexport const KnowledgeRecordWriteReq = z\n .object({\n agentId: z.string().uuid(),\n file: KnowledgeRecordFile,\n baseRevision: z.number().int().positive(),\n content: z.string().max(KNOWLEDGE_RECORD_MAX_BYTES),\n writerKind: KnowledgeRecordWriterKind,\n optOut: z\n .object({ mark: RecordOptOutKeys.max(64).default([]), lift: RecordOptOutKeys.max(64).default([]) })\n .strict()\n .default({ mark: [], lift: [] })\n})\n .strict();\n/** C→D: a read's entry with its opt-out keys, or a write's new revision. */\nexport const KnowledgeRecordOk = z\n .object({\n id: z.string().uuid(),\n revision: z.number().int().positive(),\n content: z.string().max(KNOWLEDGE_RECORD_MAX_BYTES).optional(),\n optOut: RecordOptOutKeys.optional()\n})\n .strict();\n/** C→D: the write's base revision is stale; the current entry, to re-read and merge. */\nexport const KnowledgeRecordConflict = z\n .object({\n id: z.string().uuid(),\n revision: z.number().int().positive(),\n content: z.string().max(KNOWLEDGE_RECORD_MAX_BYTES),\n optOut: RecordOptOutKeys\n})\n .strict();\nexport const KnowledgeSearchReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n query: z.string().trim().min(1).max(4096),\n limit: z.number().int().min(1).max(10).default(5),\n maxBytes: z.number().int().min(1).max(32_768).default(8192),\n tags: z.array(z.string().trim().min(1).max(64)).max(10).optional(),\n /** The conversation holds people from outside, or its audience is not known yet: People is left out (§15.3). Sent only under `knowledge-record-v1`. */\n withOutsiders: z.boolean().optional()\n})\n .strict();\nexport const KnowledgeSearchItem = z\n .object({\n id: z.string().uuid(),\n title: z.string(),\n summary: z.string().nullable(),\n tags: z.array(z.string()),\n revision: z.number().int().positive(),\n updatedAt: z.string().datetime(),\n content: z.string(),\n truncated: z.boolean()\n})\n .strict();\nexport const KnowledgeSearchOk = z.object({ items: z.array(KnowledgeSearchItem).max(10) }).strict();\n// List (query-less) recent org knowledge the requester's org can see — the\n// \"browse what already exists\" companion to knowledge/search, so a dreamer can\n// enumerate existing knowledge before proposing new. Reuses KnowledgeSearchOk.\nexport const KnowledgeListReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n limit: z.number().int().min(1).max(20).default(10),\n maxBytes: z.number().int().min(1).max(32_768).default(8192),\n tags: z.array(z.string().trim().min(1).max(64)).max(10).optional(),\n /** As on `knowledge/search`: People is left out. */\n withOutsiders: z.boolean().optional()\n})\n .strict();\n// Its own response cap: `KnowledgeListReq.limit` allows up to 20, so the reply\n// must not reuse the search response's max of 10 (11+ rows would fail codec\n// validation as BAD_PAYLOAD).\nexport const KnowledgeListOk = z.object({ items: z.array(KnowledgeSearchItem).max(20) }).strict();\n// List or search accepted organization skills (managed skill bundles) the\n// requester's org can see. `query` present ⇒ filter by name/description; absent\n// ⇒ list recent. Metadata only (no bundle bytes), so a dreamer can enumerate\n// existing skills and choose update-vs-create.\nexport const OrgSkillsReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n query: z.string().trim().min(1).max(4096).optional(),\n limit: z.number().int().min(1).max(50).default(20)\n})\n .strict();\nexport const OrgSkillItem = z\n .object({\n id: z.string().uuid(),\n name: z.string(),\n description: z.string(),\n revision: z.number().int().positive(),\n updatedAt: z.string().datetime()\n})\n .strict();\nexport const OrgSkillsOk = z.object({ items: z.array(OrgSkillItem).max(50) }).strict();\nexport const OrganizationSuggestionReadReq = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n kind: OrganizationArtifactKind,\n offset: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES).default(0),\n limit: z\n .number()\n .int()\n .positive()\n .max(ORGANIZATION_SUGGESTION_CHUNK_BYTES)\n .default(ORGANIZATION_SUGGESTION_CHUNK_BYTES)\n})\n .strict();\nexport const OrganizationKnowledgeCandidateContent = z\n .object({\n kind: z.literal('knowledge'),\n content: z.string().max(262_144),\n summary: z.string().max(1024).optional(),\n tags: z.array(z.string().min(1).max(64)).max(16).optional()\n})\n .strict();\nexport const OrganizationSkillCandidateContent = z\n .object({\n kind: z.literal('skill'),\n files: z.array(SkillBundleTextFile).min(1).max(64)\n})\n .strict();\nexport const OrganizationSuggestionContentBody = z.discriminatedUnion('kind', [\n OrganizationKnowledgeCandidateContent,\n OrganizationSkillCandidateContent\n]);\n/** Canonical bytes covered by suggestion metadata. Knowledge revisions keep\n * their longstanding content digest; a skill candidate covers its complete,\n * path-sorted file tree. Display metadata is independently compared with the\n * centrally indexed row during review. */\nexport function organizationSuggestionCanonical(body) {\n return body.kind === 'knowledge'\n ? body.content\n : JSON.stringify({\n kind: body.kind,\n // String comparison is locale-independent. `localeCompare` can order the\n // same Unicode paths differently on the daemon and CP hosts, which would\n // make an otherwise identical candidate fail its cross-host digest fence.\n files: [...body.files].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))\n });\n}\n/** Fully assembled application value. It is deliberately not a frame payload;\n * the wire carries {@link OrganizationSuggestionChunk} slices below. */\nexport const OrganizationSuggestionContent = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n exists: z.boolean(),\n body: OrganizationSuggestionContentBody.optional()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (value.exists !== (value.body !== undefined)) {\n ctx.addIssue({ code: 'custom', message: 'body must be present exactly when exists is true' });\n }\n});\nexport const OrganizationSuggestionChunk = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n exists: z.boolean(),\n size: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES),\n offset: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES),\n nextOffset: z.number().int().nonnegative().max(MAX_ORGANIZATION_SUGGESTION_BODY_BYTES),\n data: z.string().max(Math.ceil(ORGANIZATION_SUGGESTION_CHUNK_BYTES / 3) * 4),\n truncated: z.boolean()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (!value.exists &&\n (value.size !== 0 || value.offset !== 0 || value.nextOffset !== 0 || value.data !== '' || value.truncated)) {\n ctx.addIssue({ code: 'custom', message: 'a missing suggestion chunk must carry an empty zero-length body' });\n }\n if (value.exists &&\n (value.offset > value.size ||\n value.nextOffset < value.offset ||\n value.nextOffset > value.size ||\n value.truncated !== value.nextOffset < value.size)) {\n ctx.addIssue({ code: 'custom', message: 'suggestion chunk offsets must be monotonic and bounded by size' });\n }\n});\nexport const OrganizationSuggestionReviewReq = z\n .object({\n sourceAgentId: z.string().uuid(),\n dreamId: z.string().min(1).max(128),\n candidateId: z.string().uuid(),\n state: z.enum(['accepted', 'rejected'])\n})\n .strict();\n/** D→C: fetch one bounded slice of an immutable accepted `.skill` ZIP. */\nexport const ManagedSkillReadReq = z\n .object({\n requesterAgentId: z.string().uuid(),\n managedSkillId: z.string().uuid(),\n revision: z.number().int().positive(),\n offset: z.number().int().nonnegative().max(524_288).default(0),\n limit: z.number().int().positive().max(131_072).default(131_072)\n})\n .strict();\nexport const ManagedSkillChunk = z\n .object({\n managedSkillId: z.string().uuid(),\n revision: z.number().int().positive(),\n digest: z.string().regex(/^sha256:[a-f0-9]{64}$/),\n size: z.number().int().positive().max(524_288),\n offset: z.number().int().nonnegative().max(524_288),\n nextOffset: z.number().int().nonnegative().max(524_288),\n data: z.string().max(Math.ceil(131_072 / 3) * 4),\n truncated: z.boolean()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (value.offset > value.size ||\n value.nextOffset < value.offset ||\n value.nextOffset > value.size ||\n value.truncated !== value.nextOffset < value.size) {\n ctx.addIssue({ code: 'custom', message: 'managed skill chunk offsets must be monotonic and bounded by size' });\n }\n});\n//# sourceMappingURL=organization-knowledge.js.map","import { z } from 'zod';\nimport { CanonicalMemoryRecord, MemoryPluginHistoryEvent, MemoryPluginOperation } from '../memory-plugin.js';\nimport { SessionUsage } from './session.js';\nimport { OrganizationSuggestionInfo } from './organization-knowledge.js';\n/**\n * Agent memory directory (C→D REQ → REP) — the console's read/write of an agent's\n * long-term memory, and the surface the daemon serves it from.\n *\n * Memory is a DIRECTORY at the agent's ROOT (`<agent-root>/memory/`), OUTSIDE the\n * workspace — so it survives a workspace reset / re-clone and is never committed\n * into a github-workspace repo. It follows the index-plus-topics shape: a lean\n * `MEMORY.md` index (injected into the prompt every session, bounded) plus any\n * number of `<topic>.md` files the agent reads on demand. The agent maintains it\n * via MCP tools; these frames are the third channel — the CP reading/writing it\n * for the console — all pointing at the same directory.\n *\n * The CP stores NO memory content — bytes are pulled live from the owning daemon\n * and proxied to the console, never persisted (body-locality). A not-yet-created\n * file/dir is DATA (`exists:false`), not an error; only an unknown agent or a\n * path-containment violation (`BAD_PAYLOAD`) or an unexpected fs failure\n * (`INTERNAL`) comes back as an `error` frame.\n *\n * - `memory/list`: the topic files in the memory dir (flat; the index + topics).\n * - `memory/read`: one byte slice of a memory file (`path` relative to the memory\n * dir; default `MEMORY.md`). `limit` is a ceiling — the daemon returns fewer\n * bytes to keep the JSON-escaped REP under the 256 KiB frame cap and always ends\n * on a UTF-8 boundary. `nextOffset` is authoritative — do NOT recompute it.\n * - `memory/write`: replace the whole named memory file with `content`.\n * - `memory/history`: page the managed provider's hidden `.history` change log\n * for one file, newest first. The sidecar itself never appears in `memory/list`.\n */\n/** The default file name of the memory index (loaded into the prompt each session). */\nexport const MEMORY_INDEX = 'MEMORY.md';\n/** One entry in a memory-dir listing (name-only; not a path). */\nexport const MemoryEntry = z.object({\n name: z.string(), // file name relative to the memory dir\n size: z.number().int().nonnegative(),\n mtime: z.string() // RFC3339\n});\n/** A channel's memory-folder key (from `memoryChannelKey`) — selects the channel\n * layer for a channel-scoped agent's console reads/writes (#653). Absent ⇒ the\n * agent-level store. Bounded + charset-limited so it can't escape the tree. */\nexport const MemoryChannelKey = z\n .string()\n .min(1)\n .max(120)\n .regex(/^[A-Za-z0-9._-]+$/);\n/** C→D REQ: list the files in the agent's memory dir (or one channel's overlay). */\n/** The console user whose own person layer a read names, set by the CP from the signed-in caller only; never beside a channel key. */\nconst MemoryPersonUserId = z.string().min(1).max(256);\nexport const MemoryListReq = z.object({\n agentId: z.string().min(1), // local agent id (NOT a wire UUID)\n channelKey: MemoryChannelKey.optional(),\n personUserId: MemoryPersonUserId.optional()\n});\n/** C→D REQ: list the channels that have a memory folder for this agent; `channelKey` asks for that one alone (an older daemon lists all). */\nexport const MemoryChannelsReq = z.object({\n agentId: z.string().min(1),\n channelKey: MemoryChannelKey.optional()\n});\n/** One channel with its own memory folder, for the console channel selector. */\nexport const MemoryChannelEntry = z.object({\n channelKey: MemoryChannelKey,\n channel: z.string().optional(), // source channel id (from channel.json), if recorded\n transportScope: z.string().optional(),\n platform: z.string().optional(), // the conversation's platform id, if recorded\n name: z.string().optional() // the conversation's display name when last seen, if recorded\n});\n/** C→D REQ: delete one place layer whole, its change log included, returning no content. */\nexport const MemoryChannelClearReq = z\n .object({\n agentId: z.string().min(1),\n channelKey: MemoryChannelKey\n})\n .strict();\n/** D→C REP: whether there was a layer folder to delete. */\nexport const MemoryChannelClearOk = z\n .object({\n agentId: z.string(),\n channelKey: MemoryChannelKey,\n cleared: z.boolean()\n})\n .strict();\n/** D→C REP: the agent's channel memory folders (empty when none / not channel-scoped). */\nexport const MemoryChannelsPage = z.object({\n agentId: z.string(),\n channels: z.array(MemoryChannelEntry).max(1000)\n});\n/** D→C REP (corr = the req id): the memory dir's files (or `exists:false`). */\nexport const MemoryListPage = z.object({\n agentId: z.string(),\n exists: z.boolean(), // false ⇒ the memory dir does not exist yet (NOT an error)\n entries: z.array(MemoryEntry)\n});\n/** C→D REQ: read one byte slice of a memory file (path relative to the memory dir). */\nexport const MemoryReadReq = z.object({\n agentId: z.string().min(1), // local agent id (NOT a wire UUID)\n channelKey: MemoryChannelKey.optional(),\n personUserId: MemoryPersonUserId.optional(),\n path: z.string().default(MEMORY_INDEX), // memory-dir-relative POSIX path; default the index\n offset: z.number().int().nonnegative().default(0), // byte offset\n limit: z.number().int().positive().max(65536).default(65536) // byte count per slice (64 KiB, see docblock)\n});\n/** D→C REP (corr = the req id): the memory file slice (or `exists:false`). Always utf8 text. */\nexport const MemoryReadContent = z.object({\n agentId: z.string(),\n path: z.string(),\n exists: z.boolean(), // false ⇒ the file does not exist yet (NOT an error)\n size: z.number().int().nonnegative().optional(), // total file size in bytes\n mtime: z.string().optional(), // RFC3339\n content: z.string().optional(), // utf8 text slice\n offset: z.number().int().nonnegative().optional(), // byte offset this slice starts at\n nextOffset: z.number().int().nonnegative().optional(), // byte offset to request next (offset + bytes in this slice)\n truncated: z.boolean().optional() // true ⇒ nextOffset < size (more bytes remain)\n});\n/** C→D REQ: replace the whole named memory file with `content` (console edit). */\nexport const MemoryWriteReq = z.object({\n agentId: z.string().min(1), // local agent id (NOT a wire UUID)\n channelKey: MemoryChannelKey.optional(),\n path: z.string().default(MEMORY_INDEX), // memory-dir-relative POSIX path; default the index\n content: z.string(), // full new file content (utf8); '' clears the file\n // Optimistic concurrency: the mtime the writer last read. When present the write\n // fails (CONFLICT) unless the file still has this mtime — so a console edit can't\n // clobber a newer agent write. Omit to force (last-write-wins).\n ifMatchMtime: z.string().optional()\n});\n/** D→C REP (corr = the req id): the written state, so the console can refresh. */\nexport const MemoryWriteOk = z.object({\n agentId: z.string(),\n path: z.string(),\n size: z.number().int().nonnegative(), // bytes written\n mtime: z.string() // RFC3339 of the write\n});\n/** One provenance entry from managed memory's retained `.history` sidecar. */\nexport const MemoryFileHistoryEvent = z\n .object({\n // Optional while legacy JSONL rows are upgraded on their next read/write.\n id: z.string().uuid().optional(),\n path: z.string().min(1).max(255),\n event: z.enum(['add', 'update', 'delete']),\n before: z.string().max(4001).optional(),\n after: z.string().max(4001),\n at: z.string().datetime(),\n scope: z.literal('agent'),\n source: z.enum(['tool', 'console', 'distill', 'dream']),\n truncated: z.boolean().optional()\n})\n .strict();\n/** C→D REQ: page the history of one managed memory file, newest first. */\nexport const MemoryHistoryReq = z\n .object({\n agentId: z.string().min(1).max(255),\n channelKey: MemoryChannelKey.optional(),\n path: z.string().min(1).max(255),\n // Opaque to callers. This is a stable event ID, so appends and retention\n // cannot shift older pages.\n cursor: z.string().uuid().optional(),\n // Five worst-case escaped before/after snapshots still fit one wire frame.\n limit: z.number().int().positive().max(5).default(5)\n})\n .strict();\n/** D→C REP: one newest-first page from managed memory's change log. */\nexport const MemoryHistoryPage = z\n .object({\n agentId: z.string().min(1).max(255),\n path: z.string().min(1).max(255),\n events: z.array(MemoryFileHistoryEvent).max(5),\n nextCursor: z.string().uuid().optional()\n})\n .strict();\n/**\n * Provider-aware memory administration (M-5C).\n *\n * File frames above remain the managed/native compatibility surface. External\n * providers expose canonical records instead. The CP only sees the neutral\n * `files | records | none` shape and capability names; surface discovery never\n * exposes plugin/backend identity, endpoint details, credentials, or raw MCP\n * tool descriptions. A record may carry the profile's bounded canonical\n * provenance, but core never branches on it. Record bodies transit the CP only\n * as correlated request/reply payloads.\n */\nconst AgentMemoryAdminReq = z.object({ agentId: z.string().min(1) }).strict();\nconst OptionalRecordCursor = z.string().min(1).max(2048).optional();\nconst RecordId = z.string().min(1).max(512);\nconst OperationId = z.string().min(1).max(512);\nconst RecordMetadata = z.record(z.string(), z.unknown());\n/** C→D REQ: discover the provider-neutral administration shape/capabilities. */\nexport const MemorySurfaceReq = AgentMemoryAdminReq;\n/** D→C REP: which console shape is available for this agent. */\nexport const MemorySurfaceInfo = z\n .object({\n agentId: z.string().min(1),\n shape: z.enum(['files', 'records', 'none']),\n capabilities: z.array(MemoryPluginOperation).max(8)\n})\n .strict();\n/** C→D REQ: semantic search over canonical external-memory records. */\nexport const MemoryRecordSearchReq = z\n .object({\n agentId: z.string().min(1),\n query: z.string().min(1).max(32768),\n topK: z.number().int().positive().max(20).default(20),\n maxBytes: z.number().int().positive().max(32768).default(32768)\n})\n .strict();\nexport const MemoryRecordSearchPage = z\n .object({ agentId: z.string().min(1), records: z.array(CanonicalMemoryRecord).max(20) })\n .strict();\n/** C→D REQ: cursor-page the external store without inventing file semantics. */\nexport const MemoryRecordListReq = z\n .object({\n agentId: z.string().min(1),\n cursor: OptionalRecordCursor,\n limit: z.number().int().positive().max(20).default(20)\n})\n .strict();\nexport const MemoryRecordListPage = z\n .object({\n agentId: z.string().min(1),\n records: z.array(CanonicalMemoryRecord).max(20),\n nextCursor: OptionalRecordCursor\n})\n .strict();\nexport const MemoryRecordGetReq = z.object({ agentId: z.string().min(1), id: RecordId }).strict();\nexport const MemoryRecordGetResult = z\n .object({ agentId: z.string().min(1), record: CanonicalMemoryRecord.nullable() })\n .strict();\nexport const MemoryRecordCreateReq = z\n .object({\n agentId: z.string().min(1),\n operationId: OperationId,\n text: z\n .string()\n .min(1)\n .max(128 * 1024),\n metadata: RecordMetadata.optional()\n})\n .strict();\nexport const MemoryRecordCreateResult = z.object({ agentId: z.string().min(1), record: CanonicalMemoryRecord }).strict();\nexport const MemoryRecordUpdateReq = z\n .object({\n agentId: z.string().min(1),\n operationId: OperationId,\n id: RecordId,\n text: z\n .string()\n .min(1)\n .max(128 * 1024),\n metadata: RecordMetadata.optional(),\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryRecordUpdateResult = MemoryRecordCreateResult;\nexport const MemoryRecordDeleteReq = z\n .object({\n agentId: z.string().min(1),\n operationId: OperationId,\n id: RecordId,\n version: z.string().min(1).max(512).optional()\n})\n .strict();\nexport const MemoryRecordDeleteResult = z\n .object({ agentId: z.string().min(1), id: RecordId, deleted: z.boolean() })\n .strict();\nexport const MemoryRecordHistoryReq = z\n .object({\n agentId: z.string().min(1),\n id: RecordId,\n cursor: OptionalRecordCursor,\n limit: z.number().int().positive().max(20).default(20)\n})\n .strict();\nexport const MemoryRecordHistoryPage = z\n .object({\n agentId: z.string().min(1),\n events: z.array(MemoryPluginHistoryEvent).max(20),\n nextCursor: OptionalRecordCursor\n})\n .strict();\n/**\n * Memory dreaming (C→D REQ → REP) — offline consolidation jobs over the\n * MANAGED store (design: docs/designs/memory-dreaming.md).\n *\n * A dream reads a snapshot of `<agent-root>/memory/` plus recent session\n * transcripts and stages a rebuilt store under\n * `<agent-root>/memory-dreams/<dreamId>/`; the live store is never modified by\n * a running dream. The CP relays these frames and persists at most the\n * metadata (`DreamInfo`) — staged bodies transit only as correlated\n * request/reply payloads, exactly like `memory/read` (body-locality).\n *\n * - `memory/dream/start|cancel|adopt|discard`: lifecycle commands; each REP is\n * the updated `DreamInfo` so the console can refresh without a second read.\n * - `memory/dream/list|get`: job metadata for the history view.\n * - `memory/dream/files` + `memory/dream/file/read`: browse the STAGED output\n * tree (byte-sliced like `memory/read`; same UTF-8-boundary semantics).\n * - `memory/dream/skill/accept|dismiss`: review actions on mined skill\n * candidates (skills are never auto-adopted; see the design §7).\n */\nexport const DreamStatus = z.enum([\n 'pending',\n 'running',\n 'completed',\n 'failed',\n 'canceled',\n 'adopted',\n 'discarded',\n 'superseded'\n]);\nexport const DreamTrigger = z.enum(['manual', 'schedule', 'auto']);\n/** Review state of one mined skill candidate (design §7). */\nexport const DreamSkillInfo = z\n .object({\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/, 'skill name must be lowercase kebab-case'),\n description: z.string().max(1024),\n state: z.enum(['proposed', 'accepted', 'dismissed'])\n})\n .strict();\n/** Organization candidates have an independent review lifecycle from both the\n * reconstructed memory store and agent-local skill candidates. */\nexport const DreamOrganizationSuggestionInfo = OrganizationSuggestionInfo;\n/** Model-run metering for one dream. Byte counts describe the bounded extraction\n * payload; token/context/cost fields use the same semantics as a normal session. */\nexport const DreamUsage = SessionUsage.extend({\n inputBytes: z.number().int().nonnegative(),\n outputBytes: z.number().int().nonnegative()\n});\n/** Dream job metadata (never staged bodies). The only dream shape the CP may persist. */\nexport const DreamInfo = z\n .object({\n dreamId: z.string().min(1).max(128),\n agentId: z.string().min(1),\n status: DreamStatus,\n trigger: DreamTrigger,\n sessionIds: z.array(z.string().min(1)).max(100),\n snapshotDigest: z.string().min(1).max(128),\n /** The isolated ACP session that executed this dream. It is retained as a\n * metadata-only/background session after the runtime session is discarded,\n * so Sessions can show lifecycle, usage, and safe audit history. */\n executionSessionId: z.string().min(1).optional(),\n runtime: z.string().min(1).optional(),\n model: z.string().min(1).optional(),\n stopReason: z.string().min(1).max(128).optional(),\n /** The store's write counters when it was snapshotted, captured under the\n * memory-dir lock. Adoption compares them with the live counters to tell a\n * distill-only drift — which it may rebase over — from a tool/console write,\n * which must hard-fence to review. These come from the daemon's in-process\n * write ledger, NOT from the best-effort `.history` log, which can silently\n * drop an entry and so cannot authorize anything. */\n snapshotWrites: z\n .object({\n /** Opaque daemon-process/store generation. Counts are comparable only\n * within one generation — a restart resets them, which numeric\n * comparison alone cannot detect. */\n generation: z.string().min(1).max(64),\n total: z.number().int().nonnegative(),\n nonDistill: z.number().int().nonnegative()\n })\n .strict()\n .optional(),\n instructions: z.string().max(4096).optional(),\n skills: z.array(DreamSkillInfo).max(16).optional(),\n organizationSuggestions: z.array(DreamOrganizationSuggestionInfo).max(32).optional(),\n usage: DreamUsage.optional(),\n error: z\n .object({ type: z.string().min(1).max(128), message: z.string().max(2048) })\n .strict()\n .optional(),\n createdAt: z.string(), // RFC3339\n endedAt: z.string().optional() // RFC3339\n})\n .strict();\n/** C→D REQ: start a dream for one agent (managed provider only). */\nexport const DreamStartReq = z\n .object({\n agentId: z.string().min(1),\n trigger: DreamTrigger.default('manual'),\n /** Per-run overrides of the agent's configured dreaming policy. */\n sessionWindow: z.number().int().min(1).max(100).optional(),\n instructions: z.string().max(4096).optional()\n})\n .strict();\n/** D→C REP (corr = the req id): the created/updated dream job. Shared by every\n * lifecycle command so the console always renders from one shape. */\nexport const DreamState = z.object({ dream: DreamInfo }).strict();\n/** C→D REQ: cancel a pending|running dream. */\nexport const DreamCancelReq = z.object({ agentId: z.string().min(1), dreamId: z.string().min(1) }).strict();\n/** C→D REQ: list dream jobs for one agent (newest first; bounded). */\nexport const DreamListReq = z\n .object({\n agentId: z.string().min(1),\n limit: z.number().int().positive().max(50).default(20),\n /** Only dreams still holding an unreviewed skill candidate. These deliberately\n * outlive store adoption/discard, so they must be reachable independently of\n * how deep the newest-first history has grown. */\n pendingSkills: z.boolean().optional()\n})\n .strict();\n/** D→C REP (corr = the req id). */\nexport const DreamListPage = z.object({ agentId: z.string().min(1), dreams: z.array(DreamInfo).max(50) }).strict();\n/** C→D REQ: fetch one dream job's metadata. */\nexport const DreamGetReq = DreamCancelReq;\n/** C→D REQ: adopt a completed dream's staged store (atomic swap + backup). */\nexport const DreamAdoptReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n /** Adopt even when the live store changed since the snapshot (fence override). */\n force: z.boolean().default(false),\n /** Same-bytes review fence (task #36 Phase B): the store review token from\n * `DreamFilesPage.reviewToken`. When present the daemon refuses adoption\n * unless the staged bytes still hash to it, so a re-run/rebase after review\n * forces a re-review. Omitted by auto-adopt (which skips content review). */\n reviewToken: z.string().optional()\n})\n .strict();\n/** C→D REQ: discard a terminal dream's staged output. */\nexport const DreamDiscardReq = DreamCancelReq;\n/** C→D REQ: list the STAGED output files of one dream (review surface). */\nexport const DreamFilesReq = DreamCancelReq;\n/** D→C REP (corr = the req id): staged store listing (or `exists:false`). */\nexport const DreamFilesPage = z\n .object({\n agentId: z.string(),\n dreamId: z.string(),\n exists: z.boolean(), // false ⇒ nothing staged (yet) — DATA, not an error\n entries: z.array(MemoryEntry),\n /** Same-bytes review fence (task #36 Phase B): digest of the staged store the\n * console is reviewing; echo it back as `DreamAdoptReq.reviewToken` to bind\n * adoption to these exact bytes. Present only when `exists`. */\n reviewToken: z.string().optional()\n})\n .strict();\n/** C→D REQ: read one byte slice of a STAGED dream file (semantics of `memory/read`). */\nexport const DreamFileReadReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n path: z.string().default(MEMORY_INDEX),\n offset: z.number().int().nonnegative().default(0),\n limit: z.number().int().positive().max(65536).default(65536)\n})\n .strict();\n/** D→C REP (corr = the req id): the staged file slice (fields as `memory/read/content`). */\nexport const DreamFileReadContent = z\n .object({\n agentId: z.string(),\n dreamId: z.string(),\n path: z.string(),\n exists: z.boolean(),\n size: z.number().int().nonnegative().optional(),\n mtime: z.string().optional(),\n content: z.string().optional(),\n offset: z.number().int().nonnegative().optional(),\n nextOffset: z.number().int().nonnegative().optional(),\n truncated: z.boolean().optional()\n})\n .strict();\n/** C→D REQ: read one staged skill candidate's FULL body for review. Acceptance\n * installs executable instruction content, so the reviewer must be able to see\n * the actual `SKILL.md` and every script — a model-authored name and\n * description cannot be evidence for itself (design §7). */\nexport const DreamSkillReadReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/)\n})\n .strict();\nconst DreamSkillReviewText = z\n .string()\n .max(16_000)\n .refine((value) => new TextEncoder().encode(value).byteLength <= 16_000, {\n message: 'dream skill review text must be at most 16000 UTF-8 bytes'\n});\nexport const DreamSkillContent = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n name: z.string().min(1),\n /** false ⇒ nothing staged under that name (DATA, not an error). */\n exists: z.boolean(),\n skill: DreamSkillReviewText.optional(),\n scripts: z\n .array(z\n .object({\n path: z.string().regex(/^[a-z0-9][a-z0-9._-]{0,62}$/),\n content: DreamSkillReviewText\n })\n .strict())\n .max(4)\n .optional(),\n /** Same-bytes review fence (task #36 Phase B): canonical digest of the staged\n * skill the console is reviewing; echo it back as\n * `DreamSkillReviewReq.reviewToken` on Accept to bind publication to these\n * exact bytes. Present only when `exists`. */\n reviewToken: z.string().optional()\n})\n .strict()\n .superRefine((value, ctx) => {\n if (value.exists !== (value.skill !== undefined)) {\n ctx.addIssue({ code: 'custom', message: 'skill must be present exactly when exists is true' });\n }\n if (!value.exists && value.scripts !== undefined) {\n ctx.addIssue({ code: 'custom', message: 'a missing dream skill cannot carry scripts' });\n }\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > 180_000) {\n ctx.addIssue({ code: 'custom', message: 'dream skill review response exceeds its wire budget' });\n }\n});\n/** C→D REQ: accept or dismiss one mined skill candidate (design §7). */\nexport const DreamSkillReviewReq = z\n .object({\n agentId: z.string().min(1),\n dreamId: z.string().min(1),\n name: z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/),\n /** Same-bytes review fence (task #36 Phase B): the skill review token from\n * `DreamSkillContent.reviewToken`. Used on Accept — publication refuses\n * unless the captured snapshot hashes to it; ignored on Dismiss. */\n reviewToken: z.string().optional()\n})\n .strict();\n//# sourceMappingURL=memory.js.map","import { z } from 'zod';\nimport { REPLY_BUDGET } from '../wire.js';\nimport { MemoryFileHistoryEvent } from './memory.js';\n// The managed memory tree's file-system op set as a wire contract (memory-evolution.md §3.2.1), spoken by two carriers.\n// On the sandbox shim channel `root` is pod-absolute; on the `memory/store` pair below it is relative to the agent's tree.\nconst MemoryFsRoot = z.string().min(1).max(4096);\n// A POSIX path under `root`; lexical containment is checked by whichever side holds the files, never by the sender.\nconst MemoryFsRel = z.string().max(4096);\n// A read answers one budgeted slice at `offset`; a write is appended chunks into a sibling temp file, then one commit.\nexport const MemoryFsPayloadSchema = z.discriminatedUnion('op', [\n z.object({\n op: z.literal('memory-read'),\n root: MemoryFsRoot,\n rel: MemoryFsRel,\n offset: z.number().int().nonnegative(),\n limit: z.number().int().positive().max(REPLY_BUDGET),\n encoding: z.enum(['utf8', 'base64']).optional()\n }),\n z.object({\n op: z.literal('memory-append'),\n root: MemoryFsRoot,\n rel: MemoryFsRel,\n content: z.string(),\n encoding: z.enum(['utf8', 'base64']).optional(),\n create: z.boolean(),\n mode: z.number().int().optional()\n }),\n // Publish `temp` as `rel` by one rename; `ifMatchMtime` is the optimistic precondition checked in the same step.\n z.object({\n op: z.literal('memory-commit'),\n root: MemoryFsRoot,\n rel: MemoryFsRel,\n temp: MemoryFsRel,\n ifMatchMtime: z.string().optional()\n }),\n z.object({ op: z.literal('memory-create-commit'), root: MemoryFsRoot, rel: MemoryFsRel, temp: MemoryFsRel }),\n z.object({ op: z.literal('memory-stat'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-readdir'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-mkdir'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-rmdir'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-rename'), root: MemoryFsRoot, from: MemoryFsRel, to: MemoryFsRel }),\n z.object({ op: z.literal('memory-rm'), root: MemoryFsRoot, rel: MemoryFsRel }),\n z.object({ op: z.literal('memory-utimes'), root: MemoryFsRoot, rel: MemoryFsRel, mtime: z.string() })\n]);\n// `memory-read`: a missing file is data, not an error; `nextOffset` is authoritative for the next slice.\nexport const MemoryFsReadReplySchema = z.discriminatedUnion('exists', [\n z.object({ exists: z.literal(false) }),\n z.object({\n exists: z.literal(true),\n size: z.number().int().nonnegative(),\n mtime: z.string(),\n content: z.string(),\n nextOffset: z.number().int().nonnegative()\n })\n]);\n/** `memory-append`: the staged file's size once the chunk landed. */\nexport const MemoryFsAppendReplySchema = z.object({ size: z.number().int().nonnegative() });\n/** `memory-commit`: the published file's stat; its `mtime` is the token the next precondition compares. */\nexport const MemoryFsCommitReplySchema = z.object({ size: z.number().int().nonnegative(), mtime: z.string() });\n/** `memory-stat`: what one path IS, never following a symlink; `other` covers a link and every non-regular entry. */\nexport const MemoryFsStatReplySchema = z.enum(['file', 'dir', 'missing', 'other']);\n/** `memory-readdir`: the entries directly under `rel`. */\nexport const MemoryFsReaddirReplySchema = z.array(z.object({\n name: z.string(),\n kind: z.enum(['file', 'dir', 'other']),\n size: z.number().int().nonnegative().optional(),\n mtime: z.string().optional()\n}));\n// `memory-rename` and `memory-rmdir` answer whether anything moved or went; `mkdir`, `rm` and `utimes` answer null.\n// The carrier's answer: `value` is the op's reply above, and the two typed refusals ride as data, not as an error.\nexport const MemoryFsReplySchema = z.discriminatedUnion('ok', [\n z.object({ ok: z.literal(true), value: z.unknown() }),\n z.object({\n ok: z.literal(false),\n refusal: z.object({ kind: z.enum(['path', 'conflict']), message: z.string().max(500) })\n })\n]);\n/** CP applies a `memory/store` carrying `operationId` at most once, answering a re-send with the stored reply. */\nexport const AGENT_MEMORY_STORE_OPERATION_ID_V1_FEATURE = 'agent-memory-store-operation-id-v1';\n// D→C REQ `memory/store`: one op against the named agent's `control-plane` home; the REP is `MemoryFsReplySchema`.\n// Error REPs: `SCOPE_DENIED` (agent not served here, or its home is not the CP), `BAD_PAYLOAD`, `INTERNAL`.\nexport const MemoryStoreReq = z\n .object({\n agentId: z.string().uuid(),\n op: MemoryFsPayloadSchema,\n // One write's identity across a re-send; only a CP advertising the feature above accepts it.\n operationId: z.string().uuid().optional()\n})\n .strict();\n/** Records per change-log batch; the byte refinement on the request is the bound that keeps it in one frame. */\nexport const MEMORY_HISTORY_APPEND_MAX_RECORDS = 64;\n// D→C REQ `memory/history/append`: best-effort provenance for writes already made to one store (`root`), one frame.\n// Error REPs as `memory/store`; the sender packs batches under `REPLY_BUDGET` and never reads the log back.\nexport const MemoryHistoryAppendReq = z\n .object({\n agentId: z.string().uuid(),\n root: MemoryFsRoot,\n records: z.array(MemoryFileHistoryEvent).min(1).max(MEMORY_HISTORY_APPEND_MAX_RECORDS)\n})\n .strict()\n .superRefine((value, ctx) => {\n if (new TextEncoder().encode(JSON.stringify(value)).byteLength > REPLY_BUDGET) {\n ctx.addIssue({ code: 'custom', path: ['records'], message: 'memory history batch exceeds the frame budget' });\n }\n});\n/** C→D REP `memory/history/append/ok`. */\nexport const MemoryHistoryAppendOk = z.object({ accepted: z.literal(true) });\n/** A CP that pages a `control-plane` home's change log back to its daemon over `memory/history/read`. */\nexport const AGENT_MEMORY_HISTORY_READ_V1_FEATURE = 'agent-memory-history-read-v1';\n// D→C REQ `memory/history/read`: one newest-first page of one file's change log in a CP-homed store (`root` as in\n// `memory/history/append`), so the daemon can answer the common entry history for every home. Error REPs as `memory/store`.\nexport const MemoryHistoryReadReq = z\n .object({\n agentId: z.string().uuid(),\n root: MemoryFsRoot,\n path: z.string().min(1).max(255),\n cursor: z.string().uuid().optional(),\n limit: z.number().int().positive().max(5).default(5)\n})\n .strict();\n/** C→D REP `memory/history/read/ok`: the page in the sidecar's shape; `nextCursor` is the next not-yet-returned record. */\nexport const MemoryHistoryReadOk = z\n .object({ events: z.array(MemoryFileHistoryEvent).max(5), nextCursor: z.string().uuid().optional() })\n .strict();\n// D→C REQ `memory/home/migrated`: the one-way `daemon` → `control-plane` copy of this agent's tree is complete.\n// Not a store op, because it is not a file operation. Error REPs: `SCOPE_DENIED`, `CONFLICT` (home is no longer the CP).\nexport const MemoryHomeMigratedReq = z.object({ agentId: z.string().uuid() }).strict();\n/** C→D REP `memory/home/migrated/ok`: the CP recorded the completion on the binding. */\nexport const MemoryHomeMigratedOk = z.object({ accepted: z.literal(true) });\n//# sourceMappingURL=memory-store.js.map","import { z } from 'zod';\nexport const MEMORY_ENTRIES_VERSION = 1;\nexport const MEMORY_ENTRY_FRAME_BYTES = 64 * 1024;\nexport const MEMORY_ENTRY_REF_MAX_LENGTH = 4096;\nexport const MemoryEntryRef = z.string().min(1).max(MEMORY_ENTRY_REF_MAX_LENGTH);\nexport const MemoryEntryCursor = z.string().min(1).max(2048);\nexport const MemoryEntryOperation = z.enum(['list', 'get', 'search', 'create', 'update', 'delete', 'history']);\nexport const MemoryEntryCapabilities = z\n .object({\n version: z.literal(MEMORY_ENTRIES_VERSION),\n operations: z.array(MemoryEntryOperation),\n searchKind: z.enum(['lexical', 'semantic', 'hybrid']).optional(),\n supportedScopes: z.array(z.enum(['agent', 'channel'])),\n writeConsistency: z.enum(['conditional', 'last-write-wins']),\n exactEdit: z.boolean(),\n exactCreate: z.boolean(),\n enumeration: z.enum(['snapshot', 'live', 'unavailable']),\n graph: z.boolean(),\n limits: z.object({\n maxMutationRequestBytes: z.number().int().positive().optional(),\n maxItemBytes: z.number().int().positive(),\n maxPageItems: z.number().int().min(1).max(100)\n })\n})\n .strict();\nexport const MemoryEntrySummary = z\n .object({\n ref: MemoryEntryRef,\n label: z.string().max(512),\n description: z.string().max(1024).optional(),\n format: z.enum(['markdown', 'text']),\n byteSize: z.number().int().nonnegative(),\n createdAt: z.string().optional(),\n updatedAt: z.string().optional(),\n revision: z.string().max(512).optional(),\n origin: z.enum(['active', 'inherited']),\n editable: z.boolean()\n})\n .strict();\nexport const MemoryEntryListRequest = z\n .object({\n cursor: MemoryEntryCursor.optional(),\n limit: z.number().int().min(1).max(100).default(20)\n})\n .strict();\nexport const MemoryEntryListResult = z\n .object({\n entries: z.array(MemoryEntrySummary).max(100),\n nextCursor: MemoryEntryCursor.optional(),\n consistency: z.enum(['snapshot', 'live']),\n order: z.enum(['topic', 'backend']),\n catalogRevision: z.string().max(512).optional()\n})\n .strict();\nexport const MemoryEntryGetRequest = z\n .object({\n ref: MemoryEntryRef,\n cursor: MemoryEntryCursor.optional(),\n maxBytes: z\n .number()\n .int()\n .min(4)\n .max(32 * 1024)\n .default(32 * 1024)\n})\n .strict();\nexport const MemoryEntryLink = z\n .object({ label: z.string().max(512), ref: MemoryEntryRef.optional(), exists: z.boolean() })\n .strict();\nexport const MemoryEntryContent = z\n .object({\n entry: MemoryEntrySummary,\n text: z.string(),\n complete: z.boolean(),\n nextContentCursor: MemoryEntryCursor.optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n links: z.array(MemoryEntryLink).max(20).optional(),\n backlinks: z.array(MemoryEntryLink).max(20).optional()\n})\n .strict();\nexport const MemoryEntrySearchRequest = z\n .object({ query: z.string().min(1).max(2048), limit: z.number().int().min(1).max(20).default(5) })\n .strict();\nexport const MemoryEntrySearchHit = z.object({ entry: MemoryEntrySummary, snippet: z.string().max(1024) }).strict();\n// Search is retrieval, never enumeration: the kind and coverage say what the hits can and cannot prove.\nexport const MemoryEntrySearchResult = z\n .object({\n hits: z.array(MemoryEntrySearchHit).max(20),\n kind: z.enum(['lexical', 'semantic', 'hybrid', 'unknown']),\n coverage: z.enum(['complete', 'partial', 'unknown'])\n})\n .strict();\nexport const MemoryEntryHistoryRequest = z\n .object({\n ref: MemoryEntryRef,\n cursor: MemoryEntryCursor.optional(),\n limit: z.number().int().min(1).max(5).default(5)\n})\n .strict();\n// A console-side audit view: what changed, by whom, with bounded snapshots; never model-readable authority.\nexport const MemoryEntryHistoryEvent = z\n .object({\n id: z.string().max(512).optional(),\n kind: z.enum(['create', 'update', 'delete']),\n at: z.string().optional(),\n source: z.enum(['tool', 'console', 'distill', 'dream']).optional(),\n before: z.string().max(4001).optional(),\n after: z.string().max(4001).optional(),\n truncated: z.boolean().optional()\n})\n .strict();\nexport const MemoryEntryHistoryResult = z\n .object({\n events: z.array(MemoryEntryHistoryEvent).max(5),\n nextCursor: MemoryEntryCursor.optional(),\n order: z.enum(['newest-first', 'backend'])\n})\n .strict();\nexport const MemoryContextRequest = z\n .object({\n seenRevision: z.string().max(512).optional(),\n maxBytes: z\n .number()\n .int()\n .min(4)\n .max(32 * 1024)\n .default(25_000)\n})\n .strict();\nexport const MemoryContextResult = z\n .object({\n catalogRevision: z.string().max(512).optional(),\n freshness: z.enum(['current', 'cached', 'unknown']),\n coverage: z.enum(['complete', 'partial', 'unavailable']),\n overview: z.string()\n})\n .strict();\nexport const MemoryEntryErrorCode = z.enum([\n 'UNSUPPORTED',\n 'FORBIDDEN',\n 'NOT_FOUND',\n 'INVALID_ARGUMENT',\n 'CONFLICT',\n 'STALE_BINDING',\n 'CURSOR_EXPIRED',\n 'TOO_LARGE',\n 'UNAVAILABLE',\n 'AMBIGUOUS_WRITE'\n]);\nconst mutationText = z.string().max(256_000);\nconst mutationMetadata = z.record(z.string(), z.unknown()).optional();\nexport const MemoryEntryCreateRequest = z\n .object({ label: z.string().min(1).max(512).optional(), text: mutationText, metadata: mutationMetadata })\n .strict();\nconst updateTarget = {\n ref: MemoryEntryRef,\n revision: z.string().min(1).max(512).optional(),\n metadata: mutationMetadata\n};\nexport const MemoryEntryUpdateRequest = z.union([\n z.object({ ...updateTarget, text: mutationText }).strict(),\n z\n .object({ ...updateTarget, edit: z.object({ oldText: mutationText.min(1), newText: mutationText }).strict() })\n .strict()\n]);\nexport const MemoryEntryDeleteRequest = z\n .object({ ref: MemoryEntryRef, revision: z.string().min(1).max(512).optional() })\n .strict();\nexport const MemoryEntryMutationReceipt = z\n .object({\n operationId: z.string().uuid(),\n state: z.literal('completed'),\n entry: MemoryEntrySummary.optional(),\n deletedRef: MemoryEntryRef.optional(),\n catalogRevision: z.string().max(512).optional()\n})\n .strict();\n//# sourceMappingURL=memory-entries.js.map","import { z } from 'zod';\nimport { MemoryEntryErrorCode } from '../memory-entries.js';\nexport const MEMORY_TRANSACTION_V1_FEATURE = 'memory-transaction-v1';\nexport const MEMORY_CAPTURE_FENCE_V1_FEATURE = 'memory-capture-fence-v1';\nconst digest = z.string().regex(/^[0-9a-f]{64}$/);\nexport const MemoryTransactionPath = z\n .string()\n .min(1)\n .max(256)\n .regex(/^[^./\\\\\\0][^/\\\\\\0]*\\.md$/);\nconst change = z.discriminatedUnion('action', [\n z\n .object({\n action: z.literal('put'),\n path: MemoryTransactionPath,\n expectedRevision: digest.nullable(),\n temp: z.string().regex(/^\\.agentconnect-memory-[0-9a-f-]{36}\\.tmp$/),\n stagedRevision: digest\n })\n .strict(),\n z.object({ action: z.literal('delete'), path: MemoryTransactionPath, expectedRevision: digest }).strict()\n]);\nconst scope = z.object({ agentId: z.string().uuid(), root: z.string().min(1).max(1024) });\nexport const MemoryTransactionReq = z.discriminatedUnion('operation', [\n scope.extend({ operation: z.literal('snapshot') }).strict(),\n scope.extend({ operation: z.literal('capture-status'), sourceTurnId: z.string().uuid() }).strict(),\n scope\n .extend({\n operation: z.literal('commit'),\n operationId: z.string().uuid(),\n expectedRevision: digest,\n source: z.enum(['tool', 'console', 'distill', 'dream']),\n sourceTurnId: z.string().uuid().optional(),\n changes: z\n .array(change)\n .min(1)\n .max(2)\n .refine((changes) => new Set(changes.map((change) => change.path)).size === changes.length, 'duplicate paths')\n .refine((changes) => {\n const temps = changes.flatMap((change) => (change.action === 'put' ? [change.temp] : []));\n return new Set(temps).size === temps.length;\n }, 'duplicate staging files')\n })\n .strict()\n]);\nexport const MemoryTransactionReceipt = z\n .object({\n operationId: z.string().uuid(),\n revision: digest,\n committedAt: z.string().datetime(),\n files: z\n .array(z\n .object({ path: MemoryTransactionPath, revision: digest.nullable(), mtime: z.string().datetime().nullable() })\n .strict())\n .max(2)\n})\n .strict();\nexport const MemoryTransactionResult = z.discriminatedUnion('operation', [\n z.object({ operation: z.literal('snapshot'), revision: digest }).strict(),\n z.object({ operation: z.literal('capture-status'), suppressed: z.boolean() }).strict(),\n z.object({ operation: z.literal('commit'), receipt: MemoryTransactionReceipt, replayed: z.boolean() }).strict(),\n z.object({ operation: z.literal('error'), code: MemoryEntryErrorCode, message: z.string().max(512) }).strict()\n]);\n//# sourceMappingURL=memory-transaction.js.map","/** Transport-free representation of a typed wire `error` REP. */\nexport class WireError extends Error {\n code;\n retryable;\n details;\n constructor(code, message, retryable = false, details) {\n super(message);\n this.name = 'WireError';\n this.code = code;\n this.retryable = retryable;\n if (details)\n this.details = details;\n }\n}\nexport class ReqRep {\n clock;\n ackTimeoutMs;\n maxTries;\n pending = new Map();\n constructor(clock, ackTimeoutMs, maxTries = 5) {\n this.clock = clock;\n this.ackTimeoutMs = ackTimeoutMs;\n this.maxTries = maxTries;\n }\n request(frame, write, opts = {}) {\n const encoded = JSON.stringify(frame);\n return new Promise((resolve, reject) => {\n const entry = {\n id: frame.id,\n request: { type: frame.type, ...(frame.orgId ? { orgId: frame.orgId } : {}) },\n encoded,\n resolve,\n reject,\n tries: 1,\n maxTries: opts.maxTries ?? this.maxTries\n };\n this.pending.set(frame.id, entry);\n this.arm(entry, write, opts.ackTimeoutMs ?? this.ackTimeoutMs);\n // A dead transport must reject THIS request — never throw into the caller\n // (or, on the timer path below, crash the process as an uncaught throw).\n try {\n write(encoded);\n }\n catch (e) {\n this.fail(entry, new WireError('INTERNAL', `send failed: ${e.message}`, true));\n }\n });\n }\n arm(entry, write, ackTimeoutMs) {\n entry.timer = this.clock.setTimeout(() => {\n if (!this.pending.has(entry.id))\n return;\n if (entry.tries >= entry.maxTries) {\n this.pending.delete(entry.id);\n entry.reject(new WireError('INTERNAL', `no ack after ${entry.maxTries} tries for ${entry.id}`, true));\n return;\n }\n entry.tries += 1;\n this.arm(entry, write, ackTimeoutMs);\n try {\n write(entry.encoded);\n }\n catch (e) {\n this.fail(entry, new WireError('INTERNAL', `send failed: ${e.message}`, true));\n }\n }, ackTimeoutMs);\n }\n fail(entry, err) {\n if (!this.pending.has(entry.id))\n return;\n this.pending.delete(entry.id);\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.reject(err);\n }\n /**\n * Settle a pending REQ from an inbound correlated frame. Returns true when\n * `frame.corr` matched a pending REQ (a REP resolves it; an `error` frame\n * rejects with a {@link WireError}), false when it correlates nothing.\n */\n settle(frame) {\n const corr = frame.corr;\n if (!corr)\n return false;\n if (frame.type === 'error') {\n const e = frame.payload;\n return this.reject(corr, new WireError(e.code, e.message, e.retryable, e.details));\n }\n const entry = this.pending.get(corr);\n if (!entry)\n return false;\n this.pending.delete(corr);\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.resolve(frame);\n return true;\n }\n /** The still-pending REQ a reply with `corr` would settle, if any — read before `settle` to fence the reply. */\n requested(corr) {\n return this.pending.get(corr)?.request;\n }\n /** Reject one pending request by correlation id (e.g. a REP whose envelope is\n * valid but whose payload cannot be decoded). Returns false when nothing matches. */\n reject(corr, err) {\n const entry = this.pending.get(corr);\n if (!entry)\n return false;\n this.pending.delete(corr);\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.reject(err);\n return true;\n }\n inflight() {\n return this.pending.size;\n }\n rejectAll(err) {\n for (const entry of this.pending.values()) {\n if (entry.timer !== undefined)\n this.clock.clearTimeout(entry.timer);\n entry.reject(err);\n }\n this.pending.clear();\n }\n}\n//# sourceMappingURL=correlator.js.map"],"mappings":";;;;;AAGA,MAAa,mBAAmBA,OAAS,CAAC,CAAC,MAAM,kBAAkB;;AAEnE,MAAa,mBAAmBC,MAAO;CAAC;CAAO;CAAW;CAAmB;AAAM,CAAC;;AAEpF,MAAa,oBAAoBA,MAAO;CAAC;CAAO;CAAS;AAAQ,CAAC;;AAElE,MAAa,eAAeA,MAAO,CAAC,iBAAiB,UAAU,CAAC;;;;;;;;;;;AAWhE,MAAa,qBAAqBC,OAAS;CACvC,gBAAgB;CAChB,kBAAkB;CAClB,kBAAkBF,OAAS,CAAC,CAAC,KAAK;CAClC,cAAc;CACd,eAAe;CACf,UAAU;AACd,CAAC;;AAED,MAAa,6BAA6B,mBAAmB,QAAQ;;AAErE,MAAa,qBAAqBG,OACtB;CACR,QAAQ;CACR,cAAcH,OAAS,CAAC,CAAC,IAAI,CAAC;CAC9B,sBAAsB;CACtB,aAAaC,MAAO,CAAC,SAAS,cAAc,CAAC;CAC7C,YAAYG,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACjD,SAASJ,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACpC,SAASA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACpC,WAAWA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CACtC,kBAAkBA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC7C,gBAAgBA,OAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC3C,SAASK,QAAU,CAAC,CAAC,SAAS;CAC9B,aAAaA,QAAU,CAAC,CAA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boxImage":"ghcr.io/agentconnect-md/runtime-sandbox-full:v2.5.0-rc.66"}
1
+ {"runtimeSandboxImage":"ghcr.io/agentconnect-md/runtime-sandbox-full:v2.5.0-rc.67"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentconnect.md/daemon",
3
- "version": "2.5.0-rc.66",
3
+ "version": "2.5.0-rc.67",
4
4
  "description": "AgentConnect daemon — edge message + agent execution unit",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {