{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/extension/schemas.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAqJ/B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;EA2B7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;EAmB/B,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;EAyBzC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;EAMhC,CAAC;AAGF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DrB,CAAC;AAmUF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA0D,CAAC;AA8BtF,eAAO,MAAM,kBAAkB;;;;;EAA8D,CAAC","sourcesContent":["/**\n * TypeBox schemas for subagent tool parameters\n */\n\nimport { Type } from \"typebox\";\n\nfunction keepTopLevelParameterDescriptions<T>(schema: T): T {\n\treturn pruneNestedDescriptions(schema, []) as T;\n}\n\nfunction pruneNestedDescriptions(value: unknown, path: string[]): unknown {\n\tif (!value || typeof value !== \"object\") return value;\n\n\tconst result = Array.isArray(value) ? [] : Object.create(Object.getPrototypeOf(value));\n\tfor (const key of Reflect.ownKeys(value)) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(value, key);\n\t\tif (!descriptor) continue;\n\t\tif (key === \"description\" && !isTopLevelParameterDescription(path)) continue;\n\t\tif (\"value\" in descriptor) {\n\t\t\tconst nextPath = typeof key === \"string\" ? [...path, key] : path;\n\t\t\tdescriptor.value = pruneNestedDescriptions(descriptor.value, nextPath);\n\t\t}\n\t\tObject.defineProperty(result, key, descriptor);\n\t}\n\treturn result;\n}\n\nfunction isTopLevelParameterDescription(path: string[]): boolean {\n\treturn path.length === 2 && path[0] === \"properties\";\n}\n\nconst SkillOverride = Type.Unsafe({\n\tanyOf: [{ type: \"array\", items: { type: \"string\" } }, { type: \"boolean\" }, { type: \"string\" }],\n\tdescription:\n\t\t\"Skill name(s) to make available (comma-separated), array of strings, or boolean (false disables, true uses default)\",\n});\n\nconst OutputOverride = Type.Unsafe({\n\tanyOf: [{ type: \"string\" }, { type: \"boolean\" }],\n\tdescription: \"Output filename/path (string), or false to disable file output\",\n});\n\nconst OutputModeOverride = Type.String({\n\tenum: [\"inline\", \"file-only\"],\n\tdescription:\n\t\t\"Return saved output inline (default) or only a concise file reference. file-only requires output to be a path.\",\n});\n\nconst ReadsOverride = Type.Unsafe({\n\tanyOf: [{ type: \"array\", items: { type: \"string\" } }, { type: \"boolean\" }],\n\tdescription: \"Files to read before running (array of filenames), or false to disable\",\n});\n\nconst JsonSchemaObject = Type.Unsafe({\n\ttype: \"object\",\n\tadditionalProperties: true,\n\tdescription: \"JSON Schema object for strict structured output. Non-object roots are rejected.\",\n});\n\nconst AcceptanceEvidenceKinds = [\n\t\"changed-files\",\n\t\"tests-added\",\n\t\"commands-run\",\n\t\"validation-output\",\n\t\"residual-risks\",\n\t\"no-staged-files\",\n\t\"diff-summary\",\n\t\"review-findings\",\n\t\"manual-notes\",\n];\n\nconst AcceptanceOverride = Type.Unsafe({\n\tanyOf: [\n\t\t{ type: \"string\", enum: [\"auto\", \"attested\", \"checked\"] },\n\t\t{\n\t\t\ttype: \"string\",\n\t\t\tenum: [\"reviewed\"],\n\t\t\tdeprecated: true,\n\t\t\tdescription:\n\t\t\t\t\"Invalid as an explicit policy. Recognized only so preflight can explain that reviewed is an achieved status.\",\n\t\t},\n\t\t{ type: \"boolean\", enum: [false] },\n\t\t{ type: \"object\", additionalProperties: true },\n\t],\n\tdescription: `Optional acceptance policy. For reviewer/read-only calls, omit acceptance. Example: { level: \"checked\", evidence: [\"commands-run\", \"changed-files\"] }. Supported evidence kinds: ${AcceptanceEvidenceKinds.join(\", \")}. Evidence levels end at verified; use acceptance.review.required for review. Omitted means auto-inferred unless agentContract compatibility behavior is enabled.`,\n});\n\nconst AgentContractOverride = Type.Object(\n\t{\n\t\tversion: Type.Integer({ enum: [1], description: \"Enable compatibility behavior for this run/child.\" }),\n\t},\n\t{ additionalProperties: false, description: \"Compatibility behavior. Omit for the default behavior.\" },\n);\n\nconst ChainGateOverride = Type.String({\n\tenum: [\"execution\", \"acceptance\"],\n\tdescription:\n\t\t\"For chain steps with agentContract, choose whether the chain advances on execution success or acceptance success. Defaults to execution.\",\n});\n\nconst TurnBudgetOverride = Type.Object(\n\t{\n\t\tmaxTurns: Type.Integer({ minimum: 1 }),\n\t\tgraceTurns: Type.Optional(Type.Integer({ minimum: 0 })),\n\t},\n\t{\n\t\tadditionalProperties: false,\n\t\tdescription:\n\t\t\t\"Optional assistant-turn budget. At maxTurns the child is asked to wrap up; after graceTurns additional assistant turns it is aborted and partial output is returned.\",\n\t},\n);\n\nconst ToolBudgetBlock = Type.Unsafe({\n\tanyOf: [\n\t\t{ type: \"array\", minItems: 1, items: { type: \"string\", minLength: 1 } },\n\t\t{ type: \"string\", enum: [\"*\"] },\n\t],\n});\n\nconst ToolBudgetOverride = Type.Object(\n\t{\n\t\tsoft: Type.Optional(Type.Integer({ minimum: 1 })),\n\t\thard: Type.Integer({ minimum: 1 }),\n\t\tblock: Type.Optional(ToolBudgetBlock),\n\t},\n\t{\n\t\tadditionalProperties: false,\n\t\tdescription:\n\t\t\t\"Optional child tool-call budget. soft nudges the child; after hard, block tools (default read/grep/find/ls, or '*' for all tools) are blocked so the child can finalize.\",\n\t},\n);\n\nconst UsageBudgetLimitOverride = Type.Object(\n\t{\n\t\tsoft: Type.Optional(Type.Number({ exclusiveMinimum: 0 })),\n\t\thard: Type.Number({ exclusiveMinimum: 0 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nconst UsageBudgetOverride = Type.Object(\n\t{\n\t\ttokens: Type.Optional(UsageBudgetLimitOverride),\n\t\tcostUsd: Type.Optional(UsageBudgetLimitOverride),\n\t},\n\t{\n\t\tadditionalProperties: false,\n\t\tdescription:\n\t\t\t\"Optional root-only reported-usage budget. Hard limits prevent future child launches; running children are not stopped.\",\n\t},\n);\n\n// Parallel task item (within a parallel step)\nexport const ParallelTaskSchema = Type.Object({\n\tagent: Type.String(),\n\ttask: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Task template with {task}, {previous}, {chain_dir} variables. Defaults to {previous}.\",\n\t\t}),\n\t),\n\tphase: Type.Optional(Type.String({ description: \"Optional phase/group label for status and graph rendering.\" })),\n\tlabel: Type.Optional(Type.String({ description: \"Optional user-facing label for this parallel task.\" })),\n\tas: Type.Optional(\n\t\tType.String({ description: \"Optional safe identifier used as {outputs.name} in later chain steps.\" }),\n\t),\n\toutputSchema: Type.Optional(JsonSchemaObject),\n\tcwd: Type.Optional(Type.String()),\n\tcount: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Repeat this parallel task N times with the same settings.\" }),\n\t),\n\toutput: Type.Optional(OutputOverride),\n\toutputMode: Type.Optional(OutputModeOverride),\n\treads: Type.Optional(ReadsOverride),\n\tprogress: Type.Optional(Type.Boolean({ description: \"Enable progress.md tracking in {chain_dir}\" })),\n\tskill: Type.Optional(SkillOverride),\n\tmodel: Type.Optional(Type.String({ description: \"Override model for this task\" })),\n\ttoolBudget: Type.Optional(ToolBudgetOverride),\n\tacceptance: Type.Optional(AcceptanceOverride),\n\tagentContract: Type.Optional(AgentContractOverride),\n\tgateOn: Type.Optional(ChainGateOverride),\n});\n\nexport const DynamicExpandSchema = Type.Object(\n\t{\n\t\tfrom: Type.Object(\n\t\t\t{\n\t\t\t\toutput: Type.String({ description: \"Prior named structured output to expand from.\" }),\n\t\t\t\tpath: Type.String({ description: \"JSON Pointer into the structured output, e.g. /items.\" }),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\titem: Type.Optional(Type.String({ description: \"Template variable name for each item. Defaults to item.\" })),\n\t\tkey: Type.Optional(Type.String({ description: \"JSON Pointer relative to each item for stable child ids.\" })),\n\t\tmaxItems: Type.Optional(\n\t\t\tType.Integer({ minimum: 0, description: \"Required fanout bound unless configured globally.\" }),\n\t\t),\n\t\tonEmpty: Type.Optional(\n\t\t\tType.String({ enum: [\"skip\", \"fail\"], description: \"Empty input behavior. Defaults to skip.\" }),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const DynamicParallelTemplateSchema = Type.Object(\n\t{\n\t\tagent: Type.String(),\n\t\ttask: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Task template with {item}, {item.path}, {task}, {previous}, {chain_dir}, and {outputs.name} variables.\",\n\t\t\t}),\n\t\t),\n\t\tphase: Type.Optional(Type.String({ description: \"Optional phase/group label for status and graph rendering.\" })),\n\t\tlabel: Type.Optional(Type.String({ description: \"Optional user-facing label; item templates are supported.\" })),\n\t\toutputSchema: Type.Optional(JsonSchemaObject),\n\t\tcwd: Type.Optional(Type.String()),\n\t\toutput: Type.Optional(OutputOverride),\n\t\toutputMode: Type.Optional(OutputModeOverride),\n\t\treads: Type.Optional(ReadsOverride),\n\t\tprogress: Type.Optional(Type.Boolean({ description: \"Enable progress.md tracking in {chain_dir}\" })),\n\t\tskill: Type.Optional(SkillOverride),\n\t\tmodel: Type.Optional(Type.String({ description: \"Override model for this task\" })),\n\t\ttoolBudget: Type.Optional(ToolBudgetOverride),\n\t\tacceptance: Type.Optional(AcceptanceOverride),\n\t\tagentContract: Type.Optional(AgentContractOverride),\n\t\tgateOn: Type.Optional(ChainGateOverride),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const DynamicCollectSchema = Type.Object(\n\t{\n\t\tas: Type.String({ description: \"Safe output name for the ordered collected result array.\" }),\n\t\toutputSchema: Type.Optional(JsonSchemaObject),\n\t},\n\t{ additionalProperties: false },\n);\n\n// Flattened so chain steps do not need an object-shape anyOf/oneOf union.\nexport const ChainItem = Type.Object(\n\t{\n\t\tcheckpoint: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Approval checkpoint name. Pauses the chain without launching a child until approve-checkpoint or reject-checkpoint is called.\",\n\t\t\t}),\n\t\t),\n\t\tmessage: Type.Optional(\n\t\t\tType.String({ description: \"Optional approval message shown while the checkpoint is paused.\" }),\n\t\t),\n\t\tagent: Type.Optional(Type.String({ description: \"Sequential step agent name\" })),\n\t\ttask: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Task template with variables: {task}=original request, {previous}=prior step's text response, {chain_dir}=shared folder, {outputs.name}=prior named output. Required for first step, defaults to '{previous}' for subsequent steps.\",\n\t\t\t}),\n\t\t),\n\t\tphase: Type.Optional(Type.String({ description: \"Optional phase/group label for status and graph rendering.\" })),\n\t\tlabel: Type.Optional(Type.String({ description: \"Optional user-facing label for this chain step.\" })),\n\t\tas: Type.Optional(\n\t\t\tType.String({ description: \"Optional safe identifier used as {outputs.name} in later chain steps.\" }),\n\t\t),\n\t\toutputSchema: Type.Optional(JsonSchemaObject),\n\t\tcwd: Type.Optional(Type.String()),\n\t\toutput: Type.Optional(OutputOverride),\n\t\toutputMode: Type.Optional(OutputModeOverride),\n\t\treads: Type.Optional(ReadsOverride),\n\t\tprogress: Type.Optional(Type.Boolean({ description: \"Enable progress.md tracking in {chain_dir}\" })),\n\t\tskill: Type.Optional(SkillOverride),\n\t\tmodel: Type.Optional(Type.String({ description: \"Override model for this step\" })),\n\t\ttoolBudget: Type.Optional(ToolBudgetOverride),\n\t\tacceptance: Type.Optional(AcceptanceOverride),\n\t\tagentContract: Type.Optional(AgentContractOverride),\n\t\tgateOn: Type.Optional(ChainGateOverride),\n\t\tparallel: Type.Optional(\n\t\t\tType.Unsafe({\n\t\t\t\tanyOf: [\n\t\t\t\t\tType.Array(ParallelTaskSchema, { minItems: 1, description: \"Tasks to run in parallel\" }),\n\t\t\t\t\tDynamicParallelTemplateSchema,\n\t\t\t\t],\n\t\t\t\tdescription:\n\t\t\t\t\t\"Static parallel tasks array, or a single dynamic fanout child template when expand/collect are present.\",\n\t\t\t}),\n\t\t),\n\t\texpand: Type.Optional(DynamicExpandSchema),\n\t\tcollect: Type.Optional(DynamicCollectSchema),\n\t\tconcurrency: Type.Optional(Type.Number({ description: \"Max concurrent tasks (default: 4)\" })),\n\t\tfailFast: Type.Optional(Type.Boolean({ description: \"Stop on first failure (default: false)\" })),\n\t\tworktree: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Create isolated git worktrees for each parallel task.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Chain step: use {agent, task?, ...} for sequential, {parallel: [...]} for static concurrent execution, {expand, parallel: {...}, collect} for dynamic fanout, or {checkpoint: name, message?} for an approval pause.\",\n\t\tadditionalProperties: false,\n\t},\n);\n\n// Runtime mission handlers validate these untrusted nested objects loudly. Keeping\n// their provider schema shallow avoids repeating a full durable-record schema in\n// every tool request.\nconst MissionLaunchOverride = Type.Unsafe({\n\tanyOf: [\n\t\t{ type: \"object\", additionalProperties: true },\n\t\t{ type: \"boolean\", enum: [false] },\n\t],\n});\nconst MissionUpdateOverride = Type.Unsafe({ type: \"object\", additionalProperties: true });\n\nconst ControlOverrides = Type.Object({\n\tenabled: Type.Optional(\n\t\tType.Boolean({ description: \"Enable/disable subagent control attention tracking for this run\" }),\n\t),\n\tneedsAttentionAfterMs: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"No-observed-activity window before a run needs attention\" }),\n\t),\n\tactiveNoticeAfterMs: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"Active-long-running notice threshold by elapsed ms (default: 240000)\" }),\n\t),\n\tactiveNoticeAfterTurns: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription: \"Optional active-long-running notice threshold by assistant turns (disabled by default)\",\n\t\t}),\n\t),\n\tactiveNoticeAfterTokens: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription: \"Optional active-long-running notice threshold by total tokens (disabled by default)\",\n\t\t}),\n\t),\n\tfailedToolAttemptsBeforeAttention: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription: \"Consecutive mutating-tool failures before escalating to needs_attention (default: 3)\",\n\t\t}),\n\t),\n\tnotifyOn: Type.Optional(\n\t\tType.Array(Type.String({ enum: [\"active_long_running\", \"needs_attention\"] }), {\n\t\t\tdescription:\n\t\t\t\t\"Control event types that should notify the parent/orchestrator. Defaults to active_long_running and needs_attention.\",\n\t\t}),\n\t),\n\tnotifyChannels: Type.Optional(\n\t\tType.Array(Type.String({ enum: [\"event\", \"async\", \"intercom\"] }), {\n\t\t\tdescription: \"Notification channels to use when available. Defaults to event, async, and intercom.\",\n\t\t}),\n\t),\n});\n\nconst SubagentParamsSchema = Type.Object({\n\tagent: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Child agent; omit to use the default worker.\",\n\t\t}),\n\t),\n\ttask: Type.Optional(\n\t\tType.String({\n\t\t\tminLength: 1,\n\t\t\tdescription: \"Direct child task; required for direct execution.\",\n\t\t}),\n\t),\n\tresume: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Retained child run id for a workflowScript runs.run/runs.all item. Mutually exclusive with agent; task supplies the follow-up.\",\n\t\t}),\n\t),\n\t// Management action (when present, tool operates in management mode)\n\taction: Type.Optional(\n\t\tType.String({\n\t\t\tminLength: 1,\n\t\t\tdescription: \"Optional management/control action; omit for direct or workflowScript execution; use it only for management/control actions.\",\n\t\t}),\n\t),\n\tname: Type.Optional(Type.String({ description: \"Human-readable name for action='schedule.create'.\" })),\n\tid: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Run id or prefix for status, interrupt, stop, resume, steer, append-step, approve-checkpoint, reject-checkpoint, or mission.attach-run.\",\n\t\t}),\n\t),\n\trunId: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Target run ID for interrupt, stop, resume, steer, append-step, approve-checkpoint, reject-checkpoint, or mission.attach-run. Prefer id for new calls.\",\n\t\t}),\n\t),\n\tdir: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Async run directory for action='status', action='stop', action='resume', or action='steer'.\",\n\t\t}),\n\t),\n\thandoffPath: Type.Optional(Type.String({ description: \"worktree.discard manifest.\" })),\n\tindex: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 0,\n\t\t\tdescription: \"Zero-based child index for actions that target a specific child or transcript.\",\n\t\t}),\n\t),\n\tview: Type.Optional(\n\t\tType.String({\n\t\t\tenum: [\"fleet\", \"transcript\"],\n\t\t\tdescription:\n\t\t\t\t\"Optional status view. Use view='fleet' for a read-only active foreground/async fleet surface, or view='transcript' with id/dir (and optional index) to tail a run transcript.\",\n\t\t}),\n\t),\n\tlines: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tmaximum: 500,\n\t\t\tdescription: \"Maximum transcript lines for action='status', view='transcript'. Defaults to 80.\",\n\t\t}),\n\t),\n\tmessage: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Follow-up message for resume, live guidance for steer, or optional startup prompt for project.open.\",\n\t\t}),\n\t),\n\tmode: Type.Optional(\n\t\tType.String({\n\t\t\tenum: [\"steer\", \"follow_up\", \"auto\"],\n\t\t\tdescription:\n\t\t\t\t\"Delivery mode for action='steer'. steer interrupts at the next safe point (default), follow_up waits for the next turn boundary, and auto follows up mid-turn but delivers immediately between turns.\",\n\t\t}),\n\t),\n\tsteeringRecovery: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"For action='steer', allow pause-and-revive recovery after a missed acknowledgment. Defaults true for direct tool calls in steer mode; extension RPC steering forces false so callers retain exact child ownership.\",\n\t\t}),\n\t),\n\tadditional: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription:\n\t\t\t\t\"Positive launches to add with action='grant-spawn-budget'. Root interactive parent with native user confirmation only; total grants cannot exceed the original configured cap.\",\n\t\t}),\n\t),\n\tscope: Type.Optional(\n\t\tType.String({\n\t\t\tenum: [\"session\", \"user\", \"project\"],\n\t\t\tdescription:\n\t\t\t\t\"Scope for action='watchdog.configure'. Defaults to session to avoid persistent settings writes unless user/project is explicit.\",\n\t\t}),\n\t),\n\ttarget: Type.Optional(\n\t\tType.String({ enum: [\"main\", \"children\", \"child\"], description: \"Target for watchdog actions.\" }),\n\t),\n\tfocus: Type.Optional(Type.Boolean({ description: \"Focus the new Herdr pane for inspector.open or project.open.\" })),\n\tthinking: Type.Optional(\n\t\tType.Unsafe({\n\t\t\tanyOf: [{ type: \"string\" }, { type: \"boolean\", enum: [false] }],\n\t\t\tdescription: \"Direct child thinking level override.\",\n\t\t}),\n\t),\n\tschedule: Type.Optional(\n\t\tType.String({\n\t\t\tdeprecated: true,\n\t\t\tdescription: \"Removed one-shot schedule field. Use action='schedule.create' with at.\",\n\t\t}),\n\t),\n\tscheduleName: Type.Optional(\n\t\tType.String({ deprecated: true, description: \"Removed schedule display field. Use name.\" }),\n\t),\n\tat: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"One-shot trigger for action='schedule.create': a relative delay such as '+10m' or an ISO timestamp with timezone.\",\n\t\t}),\n\t),\n\tevery: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Fixed recurring interval for action='schedule.create', such as '30m', '6h', '2d', or '2w'.\",\n\t\t}),\n\t),\n\ton: Type.Optional(\n\t\tType.Unsafe({\n\t\t\tanyOf: [{ type: \"string\" }, { type: \"integer\" }],\n\t\t\tdescription: \"Calendar selector reserved for a later schedule slice.\",\n\t\t}),\n\t),\n\ttimezone: Type.Optional(Type.String({ description: \"IANA timezone reserved for a later calendar schedule slice.\" })),\n\toverlap: Type.Optional(\n\t\tType.String({ enum: [\"skip\"], description: \"Overlap policy. This slice supports skip only.\" }),\n\t),\n\tcatchUp: Type.Optional(\n\t\tType.String({\n\t\t\tenum: [\"none\", \"latest\"],\n\t\t\tdescription: \"Missed occurrence policy for recurring schedules. Defaults to latest.\",\n\t\t}),\n\t),\n\tmissionId: Type.Optional(Type.String({ description: \"Mission id.\" })),\n\tmission: Type.Optional(\n\t\tType.Unsafe({\n\t\t\t...MissionLaunchOverride,\n\t\t\tdescription:\n\t\t\t\t\"Mission object, or false for no mission. Use objective for intent; goal:true with budget.tokens enables turn-end continuation notices.\",\n\t\t}),\n\t),\n\tmissionUpdate: Type.Optional(\n\t\tType.Unsafe({\n\t\t\t...MissionUpdateOverride,\n\t\t\tdescription:\n\t\t\t\t\"Mission update: objective, goal false or {paused:boolean}, budget, summary, labels, decisions, artifacts, or delivery receipts.\",\n\t\t}),\n\t),\n\tmissionStatus: Type.Optional(Type.String({ description: \"Mission status.\" })),\n\tmissionScope: Type.Optional(\n\t\tType.String({ description: \"Mission list scope: project (default) or global pointer index.\" }),\n\t),\n\trunMode: Type.Optional(Type.String({ description: \"Attached run mode.\" })),\n\trunStatus: Type.Optional(Type.String({ description: \"Attached run status.\" })),\n\tsummary: Type.Optional(Type.String({ description: \"Mission close summary.\" })),\n\t// Chain identifier for management (can't reuse 'chain' — that's the execution array)\n\tchainName: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Chain name for get/update/delete management actions\",\n\t\t}),\n\t),\n\t// Agent/chain configuration for create/update (nested to avoid conflicts with execution fields)\n\tconfig: Type.Optional(\n\t\tType.Unsafe({\n\t\t\tanyOf: [{ type: \"object\", additionalProperties: true }, { type: \"string\" }],\n\t\t\tdescription: \"Agent/chain config for create/update. Object or JSON string; presence of steps creates a chain.\",\n\t\t}),\n\t),\n\tworkflowScript: Type.Optional(\n\t\tType.String({\n\t\t\tminLength: 1,\n\t\t\tdescription:\n\t\t\t\t\"Trusted inline JavaScript statement body. Starts async by default; pass async:false for a small foreground run. Use explicit return for output. Use await runs.run(key, {agent, task, worktree?, gate?}) or runs.run(key, {resume, task}), runs.all([...]), runs.status(id), runs.ref(s), emit(value), console, and return. Mission workflows also have async state.get(key) and state.set(key, JSONValue). Use ordinary JavaScript loops, branches, awaits, and arrays to mix sequential and parallel phases dynamically. Set worktree:true at workflow or child level for a separate managed worktree; child fields override workflow defaults. gate is one host-run command and cannot be combined with acceptance. runs.run accepts one child only. No filesystem, shell, Pi tools, or host globals.\",\n\t\t}),\n\t),\n\tchatProgress: Type.Optional(\n\t\tType.String({\n\t\t\tenum: [\"auto\", \"off\", \"live-card\"],\n\t\t\tdescription:\n\t\t\t\t\"WorkflowScript chat progress projection. auto shows a live in-chat card only for watched foreground workflows in the same Git repository; it is off otherwise.\",\n\t\t}),\n\t),\n\tworktree: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"Managed child isolation. true gives each workflow child a separate git worktree; an individual runs.run/runs.all item can override a workflow default with worktree:false.\",\n\t\t}),\n\t),\n\tstep: Type.Optional(\n\t\tType.Unsafe({\n\t\t\t...ChainItem,\n\t\t\tdescription: \"One chain step for action='append-step' only. Not an execution mode.\",\n\t\t}),\n\t),\n\tcontext: Type.Optional(\n\t\tType.String({\n\t\t\tenum: [\"fresh\", \"fork\"],\n\t\t\tdescription:\n\t\t\t\t\"'fresh' or 'fork' to branch from parent session. Explicit context overrides every child in the invocation. If omitted, each requested agent uses its own defaultContext; agents without defaultContext: 'fork' run fresh.\",\n\t\t}),\n\t),\n\tasync: Type.Optional(\n\t\tType.Boolean({ description: \"Run in background; direct calls wait by default.\" }),\n\t),\n\ttimeoutMs: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription:\n\t\t\t\t\"Optional timeout for foreground and async/background runs. Foreground workflows default to 30m; async workflows have no default timeout. Alias maxRuntimeMs.\",\n\t\t}),\n\t),\n\tmaxRuntimeMs: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription:\n\t\t\t\t\"Alias timeoutMs for foreground and async/background runs. Foreground workflows default to 30m; async workflows have no default timeout.\",\n\t\t}),\n\t),\n\tturnBudget: Type.Optional(TurnBudgetOverride),\n\ttoolBudget: Type.Optional(ToolBudgetOverride),\n\tusageBudget: Type.Optional(UsageBudgetOverride),\n\tagentScope: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Agent discovery scope: 'user', 'project', or 'both' (default: 'both'; project wins on name collisions)\",\n\t\t}),\n\t),\n\tcwd: Type.Optional(\n\t\tType.String({ description: \"Execution cwd, or target project directory for project.open/status/close.\" }),\n\t),\n\tartifacts: Type.Optional(Type.Boolean({ description: \"Write debug artifacts (default: true)\" })),\n\tincludeProgress: Type.Optional(Type.Boolean({ description: \"Include full progress in result (default: false)\" })),\n\tshare: Type.Optional(Type.Boolean({ description: \"Upload session to GitHub Gist for sharing (default: false)\" })),\n\tsessionDir: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Directory to store session logs (default: temp; enables sessions even if share=false)\",\n\t\t}),\n\t),\n\tcontrol: Type.Optional(ControlOverrides),\n\t// Workflow defaults forwarded to each runs.run/runs.all child unless overridden there.\n\toutput: Type.Optional(\n\t\tType.Unsafe({\n\t\t\tanyOf: [{ type: \"string\" }, { type: \"boolean\" }],\n\t\t\tdescription: \"Default child output file (string), or false to disable. Relative paths resolve against cwd.\",\n\t\t}),\n\t),\n\toutputMode: Type.Optional(OutputModeOverride),\n\tskill: Type.Optional(SkillOverride),\n\tmodel: Type.Optional(\n\t\tType.String({ description: \"Child model override, or workflow child default.\" }),\n\t),\n\toutputSchema: Type.Optional(JsonSchemaObject),\n\tagentContract: Type.Optional(AgentContractOverride),\n\tacceptance: Type.Optional(AcceptanceOverride),\n\tgate: Type.Optional(\n\t\tType.String({ minLength: 1, description: \"Host gate command. Cannot be combined with acceptance.\" }),\n\t),\n});\n\nexport const SubagentParams = keepTopLevelParameterDescriptions(SubagentParamsSchema);\n\nconst SubagentWaitParamsSchema = Type.Object({\n\tid: Type.Optional(\n\t\tType.String({\n\t\t\tdescription:\n\t\t\t\t\"Async run or remembered detached foreground run id/prefix to wait for one specific run. Omit to wait across every active async run started in this session.\",\n\t\t}),\n\t),\n\tnonBlocking: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"When true, resolve id to one exact run, persist a wake subscription, and return immediately. The originating session is woken on completion, failure, attention, reconciliation failure, or timeout. Requires id and cannot be combined with all.\",\n\t\t}),\n\t),\n\tall: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"Wait for ALL active runs to finish. Default false: return as soon as the first run finishes, so a fleet manager can spawn a replacement and wait again. Ignored when id targets a single run.\",\n\t\t}),\n\t),\n\ttimeoutMs: Type.Optional(\n\t\tType.Integer({\n\t\t\tminimum: 1,\n\t\t\tdescription:\n\t\t\t\t\"Give up waiting after this many milliseconds (the runs keep going regardless). Defaults to 1800000 (30 minutes).\",\n\t\t}),\n\t),\n});\n\nexport const SubagentWaitParams = keepTopLevelParameterDescriptions(SubagentWaitParamsSchema);\n"]}