@leitwerk-dev/domain 0.2.1 → 0.3.1

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.
@@ -418,11 +418,70 @@ export interface TurnStartRecord {
418
418
  continuation: TurnStartContinuation | null;
419
419
  /** @internal */
420
420
  state: TurnStartRecordState;
421
+ /** Mapped-turn item this start executes; null for ordinary turns. @internal */
422
+ iteration?: MappedTurnItemRef | null;
421
423
  /** @internal */
422
424
  createdAt: string;
423
425
  /** @internal */
424
426
  updatedAt: string;
425
427
  }
428
+ /** Identity of one frozen item in a mapped LLM run. @internal */
429
+ export interface MappedTurnItemRef {
430
+ /** @internal */
431
+ runId: string;
432
+ /** @internal */
433
+ itemKey: string;
434
+ /** Zero-based position in the frozen order. @internal */
435
+ itemIndex: number;
436
+ }
437
+ /** @internal */
438
+ export type MappedRunStatus = "active" | "completed" | "aborted";
439
+ /** Durable bookkeeping for one sequential pass of a mapped LLM turn. @internal */
440
+ export interface MappedRun {
441
+ /** @internal */
442
+ id: string;
443
+ /** @internal */
444
+ instanceId: string;
445
+ /** @internal */
446
+ turnId: TurnId;
447
+ /** @internal */
448
+ status: MappedRunStatus;
449
+ /** @internal */
450
+ itemCount: number;
451
+ /** Index of the item currently executing, or itemCount when all results exist. @internal */
452
+ nextIndex: number;
453
+ /** @internal */
454
+ createdAt: string;
455
+ /** @internal */
456
+ updatedAt: string;
457
+ }
458
+ /** @internal */
459
+ export type MappedItemStatus = "pending" | "completed";
460
+ /** One frozen item of a mapped run and its validated result. @internal */
461
+ export interface MappedItem {
462
+ /** @internal */
463
+ runId: string;
464
+ /** @internal */
465
+ instanceId: string;
466
+ /** @internal */
467
+ itemIndex: number;
468
+ /** @internal */
469
+ itemKey: string;
470
+ /** @internal */
471
+ label: string;
472
+ /** Codec-serialized item value. @internal */
473
+ itemJson: string;
474
+ /** @internal */
475
+ status: MappedItemStatus;
476
+ /** @internal */
477
+ outcome: string | null;
478
+ /** Codec-serialized result, set once when the item completes. @internal */
479
+ resultJson: string | null;
480
+ /** Turn record whose outcome produced the result. @internal */
481
+ turnRecordId: string | null;
482
+ /** @internal */
483
+ completedAt: string | null;
484
+ }
426
485
  /** Tree positioning selected during bootstrap, before a turn is accepted. @internal */
427
486
  export interface PreparedTurnStart {
428
487
  /** @internal */
@@ -801,6 +860,8 @@ export interface ProcessTurnRecord {
801
860
  modelProfileId: string | null;
802
861
  /** @internal */
803
862
  modelSelectionProvenance?: ModelSelectionProvenance | null;
863
+ /** Mapped-turn item this record executed; retries keep the same item. @internal */
864
+ iteration?: MappedTurnItemRef | null;
804
865
  /** @internal */
805
866
  turnResultMarkdown: string | null;
806
867
  /** @public */
@@ -1 +1 @@
1
- {"version":3,"file":"domain-model.d.ts","sourceRoot":"","sources":["../src/domain-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,gBAAgB;AAChB,MAAM,MAAM,iBAAiB,GAC1B,OAAO,GACP,SAAS,GACT,oBAAoB,GACpB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,WAAW,GACX,OAAO,GACP,kBAAkB,CAAC;AAEtB,cAAc;AACd,MAAM,MAAM,WAAW,GACpB,kBAAkB,GAClB,WAAW,GACX,eAAe,GACf,eAAe,GACf,YAAY,GACZ,QAAQ,CAAC;AAEZ;;;;GAIG;AACH,cAAc;AACd,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEtD,cAAc;AACd,MAAM,WAAW,KAAK;IACrB;;;OAGG;IACH,cAAc;IACd,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,IAAI,EA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CAAC;CACxB;AAED;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,MAAM,WAAW,GACpB,QAAQ,GACR,UAAU,GACV,eAAe,GACf,MAAM,GACN,MAAM,GACN,UAAU,GACV,QAAQ,GACR,SAAS,GACT,QAAQ,CAAC;AAEZ;;;GAGG;AACH,cAAc;AACd,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,cAAc;AACd,MAAM,WAAW,gBAAgB;IAChC,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;GAKG;AACH,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,CAW/E"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { normalizeActor, parseActorOrSystem, SERIALIZED_SYSTEM_ACTOR, serializeActor, } from "./actor.js";
2
- export type { Actor, CurrentExecutionRef, DurableModelSelection, ExternalWriteLog, ExternalWriteType, FutureExecution, FutureExecutionBlockReason, FutureExecutionKind, FutureExecutionScheduleKind, InputKind, InputSource, LaunchChecklistStep, LaunchChecklistStepStatus, LaunchOrigin, LaunchRun, LaunchRunStatus, ModelSelectionKind, ModelSelectionProvenance, NormalizedQuestion, PreparedTurnStart, ProcessCustomizableFields, ProcessEvent, ProcessInput, ProcessInputTarget, ProcessInstance, ProcessLeafOutcomeSnapshot, ProcessLeafOutcomeSnapshotStatus, ProcessLifecycleStatus, ProcessProject, ProcessQuestionRequest, ProcessRelation, ProcessSelectedTurnModelSource, ProcessToolApprovalDestination, ProcessToolApprovalRequest, ProcessTurnRecord, ProcessTurnRecordPathType, ProcessTurnRecordStatus, ProcessTurnType, QuestionAnswerDraft, ResolvedTurnStart, ToolApprovalStatus, TransitionTrigger, TurnFailedPayload, TurnFailureCode, TurnId, TurnOutcomePayload, TurnProgressLink, TurnProgressReport, TurnProgressStepStatus, TurnStartContinuation, TurnStartKind, TurnStartPreparationFailureCode, TurnStartRecord, TurnStartRecordState, WorkerBootstrapReceipt, WorkerErrorClass, WorkerLease, WorkerState, } from "./domain-model.js";
2
+ export type { Actor, CurrentExecutionRef, DurableModelSelection, ExternalWriteLog, ExternalWriteType, FutureExecution, FutureExecutionBlockReason, FutureExecutionKind, FutureExecutionScheduleKind, InputKind, InputSource, LaunchChecklistStep, LaunchChecklistStepStatus, LaunchOrigin, LaunchRun, LaunchRunStatus, MappedItem, MappedItemStatus, MappedRun, MappedRunStatus, MappedTurnItemRef, ModelSelectionKind, ModelSelectionProvenance, NormalizedQuestion, PreparedTurnStart, ProcessCustomizableFields, ProcessEvent, ProcessInput, ProcessInputTarget, ProcessInstance, ProcessLeafOutcomeSnapshot, ProcessLeafOutcomeSnapshotStatus, ProcessLifecycleStatus, ProcessProject, ProcessQuestionRequest, ProcessRelation, ProcessSelectedTurnModelSource, ProcessToolApprovalDestination, ProcessToolApprovalRequest, ProcessTurnRecord, ProcessTurnRecordPathType, ProcessTurnRecordStatus, ProcessTurnType, QuestionAnswerDraft, ResolvedTurnStart, ToolApprovalStatus, TransitionTrigger, TurnFailedPayload, TurnFailureCode, TurnId, TurnOutcomePayload, TurnProgressLink, TurnProgressReport, TurnProgressStepStatus, TurnStartContinuation, TurnStartKind, TurnStartPreparationFailureCode, TurnStartRecord, TurnStartRecordState, WorkerBootstrapReceipt, WorkerErrorClass, WorkerLease, WorkerState, } from "./domain-model.js";
3
3
  export { ADMIN_ACTOR, canonicalizeQuestionAnswers, emptyQuestionDrafts, formatPathTypeLabel, isProcessSelectedTurnModelSource, isProcessTurnType, isTurnFailureCode, isWaitingTurnType, isWorkerErrorClass, isWorkerOwnedTurnType, lifecycleStatusForSelectedTurnType, normalizeAskQuestionsInput, PROCESS_TURN_RECORD_PATH_TYPES, PROCESS_TURN_TYPES, SYSTEM_ACTOR, WORKER_ERROR_CLASSES, } from "./domain-model.js";
4
4
  export { addLauncherRecentValue, DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT, normalizeLauncherRecentValue, normalizeLauncherRecentValues, redactCredentialBearingAbsoluteUrl, } from "./launcher-recent-values.js";
5
5
  export { normalizeMarkdownLineEndings, normalizeMarkdownText, normalizeOptionalMarkdown, } from "./markdown-normalize.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACX,KAAK,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,mBAAmB,EACnB,2BAA2B,EAC3B,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,0BAA0B,EAC1B,gCAAgC,EAChC,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,8BAA8B,EAC9B,8BAA8B,EAC9B,0BAA0B,EAC1B,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EAC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M,sBAAsB,CAAC;AAChE,OAAO,EACN,KAAK,qBAAqB,EAC1B,6BAA6B,EAC7B,KAAK,uBAAuB,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,+BAA+B,EAC/B,4BAA4B,EAC5B,sCAAsC,EACtC,uBAAuB,EACvB,iCAAiC,EACjC,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,+CAA+C,EAC/C,uBAAuB,EACvB,6BAA6B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,6BAA6B,GAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/string-normalize.ts","../src/domain-model.ts","../src/actor.ts","../src/launcher-recent-values.ts","../src/markdown-normalize.ts","../src/number-normalize.ts","../src/process-model-config.ts","../src/process-row-slots.ts","../src/unknown-record.ts","../src/semantic-entry-refs.ts","../src/process-state-json.ts","../src/repo-locator.ts","../src/startup-observation.ts","../src/turn-annotations.ts","../src/turn-recovery.ts","../src/turn-start-resolution.ts"],"sourcesContent":["/** @internal */\nexport function toErrorMessage(error: unknown): string {\n\tif (error instanceof Error && error.message.trim() !== \"\") {\n\t\treturn error.message;\n\t}\n\treturn String(error);\n}\n\n/** Return non-blank strings verbatim; unlike trimToNull, preserve surrounding whitespace. @internal */\nexport function readNonBlankString(value: unknown): string | null {\n\treturn typeof value === \"string\" && value.trim() !== \"\" ? value : null;\n}\n\n/** @internal */\nexport function trimString(value: unknown): string {\n\treturn typeof value === \"string\" ? value.trim() : \"\";\n}\n\n/** @internal */\nexport function trimToNull(value: unknown): string | null {\n\tconst trimmed = trimString(value);\n\treturn trimmed === \"\" ? null : trimmed;\n}\n\n/** @internal */\nexport function normalizeStringArray(value: unknown): string[] {\n\tif (!Array.isArray(value)) {\n\t\treturn [];\n\t}\n\treturn value.map((entry) => trimString(entry)).filter((entry) => entry.length > 0);\n}\n\n/**\n * Single source of truth for turning an internal identifier (an action id,\n * outcome id, or trigger) into a human-readable Title Case label, e.g.\n * `approve_plan` -> `Approve Plan`. All operator-facing surfaces (action forms,\n * flow diagrams) must route through this so the translation lives in one place\n * and can later be swapped for a localized lookup.\n */\n/** @internal */\nexport function humanizeProcessLabel(identifier: unknown): string {\n\treturn trimString(identifier)\n\t\t.replace(/[_-]+/g, \" \")\n\t\t.replace(/\\s+/g, \" \")\n\t\t.replace(/\\b\\w/g, (letter) => letter.toUpperCase())\n\t\t.trim();\n}\n\nconst IDENTIFIER_WORD_LABELS: Record<string, string> = {\n\tapi: \"API\",\n\tid: \"ID\",\n\tllm: \"LLM\",\n\tmr: \"MR\",\n\tpi: \"Pi\",\n\tui: \"UI\",\n};\n\n/** Display an identifier with known acronyms, preserving the remaining spelling. @internal */\nexport function formatProcessIdentifier(value: string): string {\n\treturn value\n\t\t.split(/[_-]+/)\n\t\t.filter((part) => part.length > 0)\n\t\t.map((part) => {\n\t\t\tconst normalizedPart = part.toLowerCase();\n\t\t\treturn IDENTIFIER_WORD_LABELS[normalizedPart] ?? part.charAt(0).toUpperCase() + part.slice(1);\n\t\t})\n\t\t.join(\" \");\n}\n","import type { RepoLocatorKind } from \"./repo-locator.js\";\nimport type { ProcessSemanticEntryRefKey } from \"./semantic-entry-refs.js\";\nimport { trimToNull } from \"./string-normalize.js\";\nimport type { FailedTurnRecoveryContext } from \"./turn-recovery.js\";\nimport type { ProcessTurnStartTarget } from \"./turn-start-resolution.js\";\n\n/** @internal */\nexport type TransitionTrigger =\n\t| \"start\"\n\t| \"advance\"\n\t| \"revision_requested\"\n\t| \"plan_approved\"\n\t| \"feedback_received\"\n\t| \"operator_re_review\"\n\t| \"mr_merged\"\n\t| \"abort\"\n\t| \"mr_state_waiting\";\n\n/** @public */\nexport type InputSource =\n\t| \"external_comment\"\n\t| \"app_steer\"\n\t| \"action_prompt\"\n\t| \"watcher_event\"\n\t| \"llm_review\"\n\t| \"system\";\n\n/**\n * Stable principal that drove an action, orthogonal to `InputSource` (the\n * channel an input arrived through) and `TransitionTrigger` (the graph edge a\n * transition followed). An `Actor` answers \"who acted\", not \"how\" or \"why\".\n */\n/** @public */\nexport type ActorKind = \"user\" | \"channel\" | \"system\";\n\n/** @public */\nexport interface Actor {\n\t/**\n\t * Stable principal id, namespaced by provider where applicable.\n\t * e.g. \"identity-provider:alice\", \"operator-channel\", \"system\", \"admin\".\n\t */\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tkind: ActorKind;\n\t/** Origin that vouched for this actor. `null` for system/admin/local. @public */\n\tprovider: string | null;\n\t/** Optional human-readable name for UI display. @internal */\n\tdisplayName?: string;\n}\n\n/** Watcher / scheduler / startup reconciliation and other internal callers. @internal */\nexport const SYSTEM_ACTOR: Actor = { id: \"system\", kind: \"system\", provider: null };\n\n/**\n * Unauthenticated default for human-driven web/HTTP/WS actions when no SSO\n * provider is configured. Keeps an auth-disabled leitwerk behaving exactly\n * as it does today while still attributing actions to a stable principal.\n */\n/** @internal */\nexport const ADMIN_ACTOR: Actor = { id: \"admin\", kind: \"user\", provider: null };\n\n/** @internal */\nexport type QuestionSelectionMode = \"single\" | \"multiple\";\n\n/** @internal */\nexport interface NormalizedQuestionOption {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tlabel: string;\n\t/** @internal */\n\tdetails: string | null;\n}\n\n/** @internal */\nexport interface NormalizedQuestion {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tquestion: string;\n\t/** @internal */\n\tselection: QuestionSelectionMode;\n\t/** @internal */\n\toptions: readonly NormalizedQuestionOption[];\n}\n\n/** @internal */\nexport interface QuestionAnswerDraft {\n\t/** @internal */\n\tselectedOptionIds: readonly string[];\n\t/** @internal */\n\tfreeText: string;\n\t/** @internal */\n\tcomment: string;\n}\n\n/** @internal */\nexport interface ProcessRelation {\n\t/** @internal */\n\tparentInstanceId: string;\n\t/** @internal */\n\tchildInstanceId: string;\n\t/** @internal */\n\tkind: \"derived\";\n\t/** @internal */\n\tpurpose: string;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tcreatedBy: Actor;\n}\n\n/** @internal */\nexport type ToolApprovalStatus = \"open\" | \"accepted\" | \"feedback\" | \"declined\" | \"cancelled\";\n\n/** @internal */\nexport interface ProcessToolApprovalDestination {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tdisplayName: string;\n\t/** @internal */\n\tgroup?: string;\n\t/** @internal */\n\tdescription?: string;\n}\n\n/** @internal */\nexport interface ProcessToolApprovalRequest {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\ttoolCallId: string;\n\t/** @internal */\n\ttoolName: string;\n\t/** @internal */\n\targuments: Record<string, unknown>;\n\t/** @internal */\n\tdestination: ProcessToolApprovalDestination | null;\n\t/** @internal */\n\tstatus: ToolApprovalStatus;\n\t/** @internal */\n\trequestedAt: string;\n\t/** @internal */\n\tresolvedAt: string | null;\n\t/** @internal */\n\tresolvedBy: Actor | null;\n\t/** @internal */\n\tfeedback: string | null;\n}\n\n/** @internal */\nexport interface ProcessQuestionRequest {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\ttoolCallId: string;\n\t/** @internal */\n\tquestions: readonly NormalizedQuestion[];\n\t/** @internal */\n\tstatus: \"open\" | \"answered\" | \"cancelled\";\n\t/** @internal */\n\tanswers: readonly string[] | null;\n\t/** @internal */\n\taskedAt: string;\n\t/** @internal */\n\tansweredAt: string | null;\n\t/** @internal */\n\tansweredBy: Actor | null;\n\t/** @internal */\n\tcancelledAt: string | null;\n}\n\nfunction requiredTrimmedString(value: unknown, field: string): string {\n\tconst trimmed = trimToNull(value);\n\tif (!trimmed) {\n\t\tthrow new Error(`${field} must be a non-empty string`);\n\t}\n\treturn trimmed;\n}\n\n/** Normalize an LLM-authored request into immutable, position-stable identities. @internal */\nexport function normalizeAskQuestionsInput(value: unknown): NormalizedQuestion[] {\n\tconst questions = (\n\t\tvalue as {\n\t\t\tquestions?: Array<{\n\t\t\t\tquestion?: unknown;\n\t\t\t\tselection?: unknown;\n\t\t\t\toptions?: Array<{ label?: unknown; details?: unknown }>;\n\t\t\t}>;\n\t\t}\n\t)?.questions;\n\tif (!Array.isArray(questions)) throw new Error(\"questions must be an array\");\n\tif (questions.length === 0) throw new Error(\"questions must not be empty\");\n\treturn questions.map((candidate, questionIndex) => {\n\t\tconst question = requiredTrimmedString(\n\t\t\tcandidate?.question,\n\t\t\t`questions[${questionIndex}].question`,\n\t\t);\n\t\tif (candidate?.selection !== \"single\" && candidate?.selection !== \"multiple\") {\n\t\t\tthrow new Error(`questions[${questionIndex}].selection must be 'single' or 'multiple'`);\n\t\t}\n\t\tif (!Array.isArray(candidate.options) || candidate.options.length === 0) {\n\t\t\tthrow new Error(`questions[${questionIndex}].options must not be empty`);\n\t\t}\n\t\tconst labels = new Set<string>();\n\t\tconst questionId = `question_${questionIndex + 1}`;\n\t\tconst options = candidate.options.map((option, optionIndex) => {\n\t\t\tconst label = requiredTrimmedString(\n\t\t\t\toption?.label,\n\t\t\t\t`questions[${questionIndex}].options[${optionIndex}].label`,\n\t\t\t);\n\t\t\tconst key = label.toLocaleLowerCase();\n\t\t\tif (labels.has(key)) {\n\t\t\t\tthrow new Error(`questions[${questionIndex}] contains duplicate option '${label}'`);\n\t\t\t}\n\t\t\tlabels.add(key);\n\t\t\treturn {\n\t\t\t\tid: `${questionId}_option_${optionIndex + 1}`,\n\t\t\t\tlabel,\n\t\t\t\tdetails: trimToNull(option.details),\n\t\t\t};\n\t\t});\n\t\treturn { id: questionId, question, selection: candidate.selection, options };\n\t});\n}\n\n/** @internal */\nexport function emptyQuestionDrafts(\n\tquestions: readonly NormalizedQuestion[],\n): QuestionAnswerDraft[] {\n\treturn questions.map(() => ({ selectedOptionIds: [], freeText: \"\", comment: \"\" }));\n}\n\nfunction normalizeQuestionDrafts(\n\tquestions: readonly NormalizedQuestion[],\n\tvalue: unknown,\n): QuestionAnswerDraft[] {\n\tif (!Array.isArray(value) || value.length !== questions.length) {\n\t\tthrow new Error(\"Every question must have one draft answer in question order\");\n\t}\n\treturn questions.map((question, index) => {\n\t\tconst answer = value[index] as Partial<QuestionAnswerDraft> | undefined;\n\t\tif (!Array.isArray(answer?.selectedOptionIds)) {\n\t\t\tthrow new Error(`Question ${index + 1} has a malformed selection`);\n\t\t}\n\t\tconst selectedOptionIds = answer.selectedOptionIds.map((id) => {\n\t\t\tif (typeof id !== \"string\" || !question.options.some((option) => option.id === id)) {\n\t\t\t\tthrow new Error(`Question ${index + 1} contains an unknown selection`);\n\t\t\t}\n\t\t\treturn id;\n\t\t});\n\t\tif (new Set(selectedOptionIds).size !== selectedOptionIds.length) {\n\t\t\tthrow new Error(`Question ${index + 1} contains duplicate selections`);\n\t\t}\n\t\tif (question.selection === \"single\" && selectedOptionIds.length > 1) {\n\t\t\tthrow new Error(`Question ${index + 1} accepts only one selection`);\n\t\t}\n\t\tif (typeof answer.freeText !== \"string\" || typeof answer.comment !== \"string\") {\n\t\t\tthrow new Error(`Question ${index + 1} contains malformed text`);\n\t\t}\n\t\treturn { selectedOptionIds, freeText: answer.freeText, comment: answer.comment };\n\t});\n}\n\n/** Validate a complete structured draft and produce one canonical free-text answer per question. @internal */\nexport function canonicalizeQuestionAnswers(\n\tquestions: readonly NormalizedQuestion[],\n\tvalue: unknown,\n): string[] {\n\treturn normalizeQuestionDrafts(questions, value).map((answer, index) => {\n\t\tconst question = questions[index];\n\t\tif (!question) throw new Error(`Question ${index + 1} is missing`);\n\t\tconst options = answer.selectedOptionIds.map(\n\t\t\t(id) => question.options.find((option) => option.id === id)?.label ?? \"\",\n\t\t);\n\t\tconst freeText = answer.freeText.trim();\n\t\tconst comment = answer.comment.trim();\n\t\tif (options.length === 0 && freeText === \"\") {\n\t\t\tthrow new Error(`Question ${index + 1} requires an answer`);\n\t\t}\n\t\treturn [options.join(\", \"), freeText, comment ? `Context: ${comment}` : \"\"]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\"\\n\");\n\t});\n}\n\n/**\n * Durable operator/system input queued for worker delivery.\n * `action_prompt` is the conventional source for action-originated follow-up\n * prompts. Delivery semantics are owned by `ProcessInput.target`, not by\n * `source` or `kind`.\n */\n\n/** @public */\nexport type InputKind = \"instruction\" | \"action\" | \"system_event\";\n\n/** @public */\nexport type ProcessInputTarget =\n\t| {\n\t\t\t/** @public */\n\t\t\tsemanticRef: ProcessSemanticEntryRefKey;\n\t\t\t/** @internal */\n\t\t\tproductName?: never;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tproductName: string;\n\t\t\t/** @public */\n\t\t\tsemanticRef?: never;\n\t };\n\n/** @internal */\nexport const WORKER_ERROR_CLASSES = [\n\t\"llm_error\",\n\t\"git_error\",\n\t\"pi_crash\",\n\t\"pipeline_error\",\n\t\"infrastructure\",\n\t\"protocol_error\",\n\t\"operator_abort\",\n] as const;\n\n/** @internal */\nexport type WorkerErrorClass = (typeof WORKER_ERROR_CLASSES)[number];\n\n/** @internal */\nexport function isWorkerErrorClass(value: string): value is WorkerErrorClass {\n\treturn (WORKER_ERROR_CLASSES as readonly string[]).includes(value);\n}\n\n/** @internal */\nexport type TurnFailureCode = \"branch_drift\";\n\n/** @internal */\nexport function isTurnFailureCode(value: string): value is TurnFailureCode {\n\treturn value === \"branch_drift\";\n}\n\n/** Extension-defined stable turn identifier. @public */\nexport type TurnId = string;\n\n/** @internal */\nexport const PROCESS_TURN_TYPES = [\"llm\", \"human\", \"external\", \"automatic\"] as const;\n\n/** @internal */\nexport type ProcessTurnType = (typeof PROCESS_TURN_TYPES)[number];\n\n/** @internal */\nexport interface TurnOutcomePayload {\n\t/** @internal */\n\tresultSummary?: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: ProcessTurnType;\n\t/** @internal */\n\toutcome: string;\n\t/** @internal */\n\tparams: Record<string, unknown>;\n\t/** @internal */\n\tpathType?: ProcessTurnRecordPathType;\n\t/** @internal */\n\tforkPiEntryId?: string | null;\n\t/** @internal */\n\tresultPiEntryId?: string | null;\n\t/** @internal */\n\tturnResultMarkdown?: string | null;\n\t/** @internal */\n\trootEntryId?: string | null;\n\t/** @internal */\n\tstate?: unknown;\n}\n\n/** @internal */\nexport interface TurnFailedPayload {\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: ProcessTurnType;\n\t/** @internal */\n\tpathType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tforkPiEntryId?: string | null;\n\t/** @internal */\n\tresultPiEntryId?: string | null;\n\t/** @internal */\n\terrorSummary: string;\n\t/** @internal */\n\terrorClass?: WorkerErrorClass;\n\t/** @internal */\n\tfailureCode?: TurnFailureCode | null;\n\t/** @internal */\n\tfailureDetails?: Record<string, unknown> | null;\n\t/** @internal */\n\trecoveryContext?: FailedTurnRecoveryContext | null;\n}\n\n/** @public */\nexport type ProcessLifecycleStatus =\n\t| \"discovered\"\n\t| \"active\"\n\t| \"waiting\"\n\t| \"error\"\n\t| \"completed\"\n\t| \"aborted\";\n\n/** @internal */\nexport function isProcessTurnType(value: unknown): value is ProcessTurnType {\n\treturn typeof value === \"string\" && (PROCESS_TURN_TYPES as readonly string[]).includes(value);\n}\n\n/** @internal */\nexport function isWorkerOwnedTurnType(turnType: ProcessTurnType): boolean {\n\treturn turnType === \"llm\" || turnType === \"automatic\";\n}\n\n/** @internal */\nexport function isWaitingTurnType(turnType: ProcessTurnType): boolean {\n\treturn turnType === \"human\" || turnType === \"external\";\n}\n\n/** @internal */\nexport function lifecycleStatusForSelectedTurnType(\n\tturnType: ProcessTurnType,\n): Extract<ProcessLifecycleStatus, \"active\" | \"waiting\"> {\n\treturn isWaitingTurnType(turnType) ? \"waiting\" : \"active\";\n}\n\n/** @internal */\nexport type ProcessSelectedTurnModelSource =\n\t| \"action_override\"\n\t| \"launch_override\"\n\t| \"instance_turn_config\"\n\t| \"process_config_turn\"\n\t| \"instance_default\"\n\t| \"process_config_default\"\n\t| \"catalog_default\"\n\t| \"legacy_persisted\";\n\n/** @internal */\nexport type ModelSelectionKind = \"explicit\" | \"inherited\";\n/** @internal */\nexport type ModelSelectionSource = ProcessSelectedTurnModelSource;\n\n/** Durable intent and resolution path for one effective model selection. @internal */\nexport interface ModelSelectionProvenance {\n\t/** @internal */\n\tkind: ModelSelectionKind;\n\t/** @internal */\n\tsource: ModelSelectionSource;\n}\n\n/** @internal */\nexport interface DurableModelSelection {\n\t/** @internal */\n\tmodelProfileId: string;\n\t/** @internal */\n\tprovenance: ModelSelectionProvenance;\n}\n\n/** @internal */\nexport type ModelPolicyFailureCode =\n\t| \"invalid_model_configuration\"\n\t| \"unknown_model_profile\"\n\t| \"model_profile_not_allowed\"\n\t| \"model_required\"\n\t| \"model_unavailable\"\n\t| \"model_stale\"\n\t| \"stale_evaluation_snapshot\";\n\n/** @internal */\nexport interface FutureExecutionBlockReason {\n\t/** @internal */\n\tcode: ModelPolicyFailureCode;\n\t/** @internal */\n\tselection: DurableModelSelection | null;\n\t/** @internal */\n\tsummary: string;\n\t/** @internal */\n\tdetectedAt: string;\n\t/** Present when the block depends on a runtime availability snapshot. @internal */\n\tavailabilityRevision?: number;\n}\n\n/** JSON object persisted as non-secret turn-start configuration. @internal */\nexport type JsonObject = Record<string, unknown>;\n\n/** The one durable technical execution currently owned by a process. @internal */\nexport type CurrentExecutionRef = {\n\t/** @internal */\n\tkind: \"worker_start\";\n\t/** @internal */\n\tid: string;\n} | null;\n\n/** Immutable non-secret inputs resolved for a worker-owned turn start. @internal */\nexport type ResolvedTurnStart =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"llm\";\n\t\t\t/** @internal */\n\t\t\tmodel: {\n\t\t\t\t/** @internal */\n\t\t\t\tprofileId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tproviderId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tmodelId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tthinkingLevel: string;\n\t\t\t};\n\t\t\t/** Frozen provenance used to resolve this prepared start. @internal */\n\t\t\tmodelSelectionProvenance?: ModelSelectionProvenance;\n\t\t\t/** Status revision evaluated before preparation. Diagnostic only. @internal */\n\t\t\tavailabilityRevision?: number;\n\t\t\t/** @internal */\n\t\t\tproviderOptions: Record<string, string>;\n\t\t\t/** @internal */\n\t\t\tproviderWorkerConfig: {\n\t\t\t\t/** @internal */\n\t\t\t\tversion: number;\n\t\t\t\t/** @internal */\n\t\t\t\tvalue: JsonObject;\n\t\t\t} | null;\n\t\t\t/** @internal */\n\t\t\tpiResourceSnapshotDigest: string;\n\t\t\t/** @internal */\n\t\t\tworkerRuntimeProfileId: string;\n\t\t\t/** @internal */\n\t\t\tpiSettings: JsonObject;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"automatic\";\n\t };\n\n/** @internal */\nexport type TurnStartKind = \"selected_turn\" | \"retry\" | \"continue\" | \"startup_retry\";\n\n/** @internal */\nexport interface TurnStartContinuation {\n\t/** @internal */\n\tcontinueFromPiEntryId: string;\n\t/** @internal */\n\tcontinuePrompt: string;\n\t/** @internal */\n\tsavedPrimaryLeafEntryId: string | null;\n}\n\n/** @internal */\nexport type TurnStartPreparationFailureCode =\n\t| \"invalid_model_configuration\"\n\t| \"model_required\"\n\t| \"model_unavailable\"\n\t| \"model_stale\"\n\t| \"provider_options_required\"\n\t| \"provider_preflight_failed\";\n\n/** @internal */\nexport type TurnStartRecordState =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"preparation_failed\";\n\t\t\t/** @internal */\n\t\t\trequestedModelProfileId: string | null;\n\t\t\t/** @internal */\n\t\t\tproviderOptions: Record<string, string>;\n\t\t\t/** @internal */\n\t\t\tcode: TurnStartPreparationFailureCode;\n\t\t\t/** @internal */\n\t\t\tsafeSummary: string;\n\t\t\t/** @internal */\n\t\t\tmodelSelectionProvenance?: ModelSelectionProvenance;\n\t\t\t/** @internal */\n\t\t\tavailabilityRevision?: number;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"starting\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"bootstrap_failed\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart;\n\t\t\t/** @internal */\n\t\t\tfailedWorkerLeaseId: string | null;\n\t\t\t/** @internal */\n\t\t\tcode: string;\n\t\t\t/** @internal */\n\t\t\tsafeSummary: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"accepted\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart;\n\t\t\t/** @internal */\n\t\t\tturnRecordId: string;\n\t\t\t/** @internal */\n\t\t\tacceptedWorkerLeaseId: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"superseded\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart | null;\n\t };\n\n/** Durable preparation for a single worker-owned selected turn, not an attempt. @internal */\nexport interface TurnStartRecord {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: Extract<ProcessTurnType, \"llm\" | \"automatic\">;\n\t/** Reserved id used when, and only when, this start is accepted. @internal */\n\tproposedTurnRecordId: string;\n\t/** @internal */\n\tstartKind: TurnStartKind;\n\t/** @internal */\n\trecoveryTurnRecordId: string | null;\n\t/** @internal */\n\tcontinuation: TurnStartContinuation | null;\n\t/** @internal */\n\tstate: TurnStartRecordState;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** Tree positioning selected during bootstrap, before a turn is accepted. @internal */\nexport interface PreparedTurnStart {\n\t/** @internal */\n\tpathType: ProcessTurnRecordPathType;\n\t/** Durable authored context mode used to reconcile pre-prompt positioning and compaction. @internal */\n\tcontextMode: LlmContextMode;\n\t/** @internal */\n\tstartTarget: ProcessTurnStartTarget;\n\t/** @internal */\n\tforkPiEntryId: string | null;\n}\n\n/** @internal */\nexport type LlmContextMode = \"full\" | \"compacted\" | \"fresh\" | \"fresh_seeded\";\n\n/** Immutable, lease-correlated proof of successful worker bootstrap. @internal */\nexport type WorkerBootstrapReceipt =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"llm\";\n\t\t\t/** @internal */\n\t\t\tstartRecordId: string;\n\t\t\t/** @internal */\n\t\t\tworkerLeaseId: string;\n\t\t\t/** @internal */\n\t\t\treceiptEpoch: string;\n\t\t\t/** @internal */\n\t\t\tverifiedResourceSnapshotDigest: string;\n\t\t\t/** @internal */\n\t\t\tcredentialRevision: number | null;\n\t\t\t/** @internal */\n\t\t\tloadedResourceIds: string[];\n\t\t\t/** @internal */\n\t\t\tresolvedModel: {\n\t\t\t\t/** @internal */\n\t\t\t\tproviderId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tmodelId: string;\n\t\t\t};\n\t\t\t/** @internal */\n\t\t\tpreparedStart: PreparedTurnStart | null;\n\t\t\t/** @internal */\n\t\t\treadyAt: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"automatic\";\n\t\t\t/** @internal */\n\t\t\tstartRecordId: string;\n\t\t\t/** @internal */\n\t\t\tworkerLeaseId: string;\n\t\t\t/** @internal */\n\t\t\treceiptEpoch: string;\n\t\t\t/** @internal */\n\t\t\treadyAt: string;\n\t };\n\n/** @internal */\nexport const PROCESS_SELECTED_TURN_MODEL_SOURCES = [\n\t\"action_override\",\n\t\"launch_override\",\n\t\"instance_turn_config\",\n\t\"process_config_turn\",\n\t\"instance_default\",\n\t\"process_config_default\",\n\t\"catalog_default\",\n\t\"legacy_persisted\",\n] as const satisfies readonly ProcessSelectedTurnModelSource[];\n\n/** @internal */\nexport function isProcessSelectedTurnModelSource(\n\tvalue: unknown,\n): value is ProcessSelectedTurnModelSource {\n\treturn PROCESS_SELECTED_TURN_MODEL_SOURCES.includes(value as ProcessSelectedTurnModelSource);\n}\n\n/** @public */\nexport interface ProcessCustomizableFields {\n\t/** @internal */\n\ttitle?: string | null;\n\t/** @public */\n\texternalId?: string | null;\n\t/** @internal */\n\texternalUrl?: string | null;\n\t/** @internal */\n\tmetadata?: Record<string, unknown> | null;\n\t/** @internal */\n\tdefaultModelProfileId?: string | null;\n\t/** @internal */\n\tinitialDefaultModelProfileId?: string | null;\n\t/** @internal */\n\tturnConfigsJson?: string | null;\n\t/** @internal */\n\tselectedTurnModelProfileId?: string | null;\n\t/** @internal */\n\tselectedTurnModelKind?: ModelSelectionKind | null;\n\t/** @internal */\n\tselectedTurnModelSource?: ProcessSelectedTurnModelSource | null;\n}\n\n/** @public */\nexport interface ProcessInstance {\n\t/** @public */\n\tid: string;\n\t/** Canonical process identifier from the extension catalog. @public */\n\tprocessId: string;\n\t/** Durable pointer to the currently selected business turn, if any. @public */\n\tselectedTurnId: TurnId | null;\n\t/** High-level lifecycle bucket for scheduling and operator state. @public */\n\tlifecycleStatus: ProcessLifecycleStatus;\n\t/** Single durable technical execution reference; null for waiting/terminal states. @internal */\n\tcurrentExecution: CurrentExecutionRef;\n\t/** @public */\n\tplanRevision: number;\n\t/** Short operator-facing process title used in process lists and related UI. @public */\n\ttitle: string | null;\n\t/** Provider-agnostic external reference, such as a work item key or change path. @public */\n\texternalId: string | null;\n\t/** URL to the external resource, if applicable. @internal */\n\texternalUrl: string | null;\n\t/** Extension-owned JSON metadata blob. @internal */\n\tmetadata: Record<string, unknown> | null;\n\t/** Instance-scoped default model profile used when no turn override applies. @internal */\n\tdefaultModelProfileId?: string | null;\n\t/** Effective default model at creation time, retained for historical inspection. @internal */\n\tinitialDefaultModelProfileId?: string | null;\n\t/** JSON-serialized per-turn runtime config overrides for this instance. @internal */\n\tturnConfigsJson?: string | null;\n\t/** Frozen effective model profile for the currently selected LLM turn, if any. @internal */\n\tselectedTurnModelProfileId?: string | null;\n\t/** Explicit operator intent or inherited policy resolution for the selected model. @internal */\n\tselectedTurnModelKind?: ModelSelectionKind | null;\n\t/** Resolution path that selected `selectedTurnModelProfileId`; null for empty selections. @internal */\n\tselectedTurnModelSource?: ProcessSelectedTurnModelSource | null;\n\t/** JSON-serialized process params. @public */\n\tparamsJson: string | null;\n\t/** JSON-serialized process state. @public */\n\tstateJson: string | null;\n\t/** @public */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n\t/** Set once when the process first reaches a terminal lifecycle status. @internal */\n\tclosedAt?: string | null;\n}\n\n/** @public */\nexport interface ProcessProject {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tinstanceId: string;\n\t/** @public */\n\tkey: string;\n\t/** Repository source identifier. May be a remote URL or a local filesystem path. @public */\n\trepoLocator: string;\n\t/** @internal */\n\trepoLocatorKind: RepoLocatorKind;\n\t/** @internal */\n\tbaseBranch: string;\n\t/** @internal */\n\tworkBranch: string | null;\n\t/** Provider-agnostic external identifier (e.g. MR IID, PR number). @internal */\n\texternalId: string | null;\n\t/** URL to the external resource (e.g. MR URL, PR URL). @internal */\n\texternalUrl: string | null;\n\t/** Extension-owned JSON metadata blob. @public */\n\tmetadata: Record<string, unknown> | null;\n\t/** @internal */\n\tpipelineStatus: string | null;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport interface ProcessInput {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tsequence: number;\n\t/** @internal */\n\tsource: InputSource;\n\t/** @internal */\n\tkind: InputKind;\n\t/** @internal */\n\ttarget: ProcessInputTarget | null;\n\t/** @internal */\n\tbodyMarkdown: string;\n\t/** Stable principal that queued this input. Defaults to `SYSTEM_ACTOR`. @internal */\n\tactor: Actor;\n\t/** @internal */\n\treceivedAt: string;\n\t/** @internal */\n\tconsumedAt: string | null;\n}\n\n/** @internal */\nexport type LaunchOrigin = \"ui\" | \"programmatic\" | \"watcher\" | \"scheduled\" | \"startup_retry\";\n/** @internal */\nexport type LaunchRunStatus =\n\t| \"preparing\"\n\t| \"process_created\"\n\t| \"starting\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"cancelled\";\n/** @internal */\nexport type LaunchChecklistStepStatus =\n\t| \"pending\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"skipped\";\n\n/** Presentation-safe durable progress for one process launch attempt. @internal */\nexport interface LaunchChecklistStep {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tlabel: string;\n\t/** @internal */\n\tstatus: LaunchChecklistStepStatus;\n\t/** @internal */\n\tsafeSummary?: string;\n\t/** @internal */\n\tstartedAt?: string;\n\t/** @internal */\n\tcompletedAt?: string;\n}\n\n/** Durable launch attempt. Secrets and runner identifiers never belong here. @internal */\nexport interface LaunchRun {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tlauncherId: string | null;\n\t/** @internal */\n\torigin: LaunchOrigin;\n\t/** @internal */\n\tinstanceId: string | null;\n\t/** @internal */\n\tstatus: LaunchRunStatus;\n\t/** @internal */\n\tsteps: LaunchChecklistStep[];\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n\t/** @internal */\n\tcompletedAt: string | null;\n\t/** @internal */\n\trevision: number;\n}\n\n/** @internal */\nexport type FutureExecutionKind = \"launch\" | \"action\";\n/** @internal */\nexport type FutureExecutionScheduleKind = \"once\" | \"cron\";\n\n/** @internal */\nexport interface FutureExecution {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tkind: FutureExecutionKind;\n\t/** @internal */\n\tscheduleKind: FutureExecutionScheduleKind;\n\t/** Canonical target process identifier. @internal */\n\tprocessId: string;\n\t/** Populated only for scheduled actions on an existing process instance. @internal */\n\tinstanceId: string | null;\n\t/** @internal */\n\tlauncherId: string | null;\n\t/** @internal */\n\tactionId: string | null;\n\t/** JSON-serialized kind-specific payload. @internal */\n\tpayloadJson: string;\n\t/** @internal */\n\tcronExpression: string | null;\n\t/** @internal */\n\tnextRunAt: string;\n\t/** Immediate LLM selection caused by this execution, if known. @internal */\n\tmodelSelection?: DurableModelSelection | null;\n\t/** Structured model-policy block. Blocked rows remain durable. @internal */\n\tblockedReason?: FutureExecutionBlockReason | null;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport interface ProcessEvent {\n\t/** Persisted ingestion order. Absent only on legacy in-memory fixtures. @internal */\n\teventSequence?: number;\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\teventType: string;\n\t/** @internal */\n\tdata: Record<string, unknown>;\n\t/** @internal */\n\tcreatedAt: string;\n}\n\n/** @internal */\nexport type ProcessLeafOutcomeSnapshotStatus = \"ready\" | \"capture_error\";\n\n/** @internal */\nexport interface ProcessLeafOutcomeSnapshot {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tleafEntryId: string;\n\t/** @internal */\n\tturnRecordId: string | null;\n\t/** @internal */\n\trendererId: string | null;\n\t/** @internal */\n\tschemaVersion: number | null;\n\t/** @internal */\n\tprops: Record<string, unknown> | null;\n\t/** @internal */\n\tfallbackMarkdown: string | null;\n\t/** @internal */\n\tstatus: ProcessLeafOutcomeSnapshotStatus;\n\t/** @internal */\n\twarningCode: string | null;\n\t/** @internal */\n\twarningMessage: string | null;\n\t/** @internal */\n\tanchoredAt: string;\n\t/** @internal */\n\tcreatedAt: string;\n}\n\n/** @public */\nexport type ProcessTurnRecordStatus = \"running\" | \"succeeded\" | \"failed\" | \"superseded\";\n\n/** @public */\nexport type TurnProgressStepStatus = \"incomplete\" | \"in_progress\" | \"completed\" | \"failed\";\n\n/** @public */\nexport interface TurnProgressStep {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tlabel: string;\n\t/** @public */\n\tstatus: TurnProgressStepStatus;\n\t/** @public */\n\tdetail?: string | null;\n}\n\n/** @public */\nexport interface TurnProgressLink {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tlabel: string;\n\t/** @public */\n\turl: string;\n\t/** @public */\n\tkind?: \"pull_request\" | \"merge_request\" | \"commit\" | \"pipeline\" | \"other\";\n}\n\n/** A complete operator-facing snapshot. Reporters replace, rather than patch, this value. @public */\nexport interface TurnProgressReport {\n\t/** @public */\n\ttitle: string;\n\t/** Attempt-specific progress or waiting explanation; not an operation receipt. @public */\n\tsummary?: string;\n\t/** @public */\n\tsteps: TurnProgressStep[];\n\t/** @public */\n\tlinks?: TurnProgressLink[];\n}\n\n/**\n * Structural tree position for a turn record.\n * - `primary`: continue the primary path from the current leaf\n * - `root_branch`: start from the implicit session root with no prior Pi entry context\n * - `leaf_branch`: fork from the current leaf as a side path\n */\n/** @public */\nexport const PROCESS_TURN_RECORD_PATH_TYPES = [\"primary\", \"root_branch\", \"leaf_branch\"] as const;\n\n/** @public */\nexport type ProcessTurnRecordPathType = (typeof PROCESS_TURN_RECORD_PATH_TYPES)[number];\n\n/** @public */\nexport interface ProcessTurnRecord {\n\t/** @public */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @public */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: ProcessTurnType;\n\t/** @public */\n\tstatus: ProcessTurnRecordStatus;\n\t/** @internal */\n\tattemptNumber: number;\n\t/** @internal */\n\tparentTurnRecordId: string | null;\n\t/** @internal */\n\tpathType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tforkPiEntryId: string | null;\n\t/** Accepted worker-start preparation that created this worker-owned record. @internal */\n\tturnStartRecordId?: string | null;\n\t/** Lease whose receipt first authorized this worker-owned record. @internal */\n\tacceptedWorkerLeaseId?: string | null;\n\t/** @internal */\n\tresultPiEntryId: string | null;\n\t/** @internal */\n\tmodelProfileId: string | null;\n\t/** @internal */\n\tmodelSelectionProvenance?: ModelSelectionProvenance | null;\n\t/** @internal */\n\tturnResultMarkdown: string | null;\n\t/** @public */\n\terrorSummary: string | null;\n\t/** @internal */\n\terrorClass: WorkerErrorClass | null;\n\t/** @internal */\n\tstartedAt: string;\n\t/** @internal */\n\tendedAt: string | null;\n}\n\n/** @internal */\nexport interface WorkerLease {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tworkerId: string;\n\t/** Worker start this physical lease was created to execute. @internal */\n\tturnStartRecordId?: string | null;\n\t/** Durable server-owned supervision state for the current worker lease. @internal */\n\tstate: WorkerState;\n\t/** Server epoch this lease belongs to, used to reject stale snapshot writes. @internal */\n\tserverEpoch?: string | null;\n\t/** Hash of the lease-scoped WebSocket connect token. The raw token is never stored. @internal */\n\tconnectTokenHash?: string | null;\n\t/** Hash of the lease-scoped HTTP session-snapshot credential. The raw token is never stored. @internal */\n\tsnapshotTokenHash?: string | null;\n\t/** Fingerprint of the effective instance model policy/config snapshot used to start this worker. @internal */\n\tmodelPolicyFingerprint?: string | null;\n\t/** First valid lease-correlated bootstrap receipt; written once by the server. @internal */\n\tbootstrapReceipt?: WorkerBootstrapReceipt | null;\n\t/** Updated from heartbeats for liveness/recovery diagnostics. @internal */\n\tlastHeartbeatAt: string | null;\n\t/** @internal */\n\tstartedAt: string;\n\t/** First valid server-observed worker handshake. @internal */\n\tconnectedAt?: string | null;\n\t/** First valid server-observed workspace preparation progress. @internal */\n\tworkspacePreparationStartedAt?: string | null;\n\t/** First accepted server-observed worker readiness. @internal */\n\treadyAt?: string | null;\n\t/** Set once the lease is no longer active for supervision. @internal */\n\texitedAt: string | null;\n}\n\n/**\n * Durable worker lease states owned by the server.\n * `absent` is conceptual in lifecycle logic and usually represented by\n * the absence of an active lease row.\n */\n/** @internal */\nexport type WorkerState =\n\t| \"absent\"\n\t| \"spawning\"\n\t| \"bootstrapping\"\n\t| \"idle\"\n\t| \"busy\"\n\t| \"draining\"\n\t| \"failed\"\n\t| \"cleanup\"\n\t| \"exited\";\n\n/**\n * External write type identifier. Extensions define their own write types\n * as plain strings (e.g. \"tracker.approved_plan_comment\", \"code_host.create_change\").\n */\n/** @public */\nexport type ExternalWriteType = string;\n\n/** @public */\nexport interface ExternalWriteLog {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @public */\n\twriteType: ExternalWriteType;\n\t/** @internal */\n\tdedupKey: string;\n\t/** @internal */\n\tcompletedAt: string;\n\t/** @internal */\n\tmetadata: Record<string, unknown>;\n}\n\n/**\n * Returns a human-readable, operator-facing label for the structural path\n * position of a turn record. These labels avoid internal domain terms such\n * as \"primary\" or \"root_branch\" in favour of plain descriptions of what the\n * turn is doing relative to the main path.\n */\n/** @internal */\nexport function formatPathTypeLabel(pathType: ProcessTurnRecordPathType): string {\n\tswitch (pathType) {\n\t\tcase \"primary\":\n\t\t\treturn \"Continuing the main path\";\n\t\tcase \"root_branch\":\n\t\t\treturn \"Starting from the beginning\";\n\t\tcase \"leaf_branch\":\n\t\t\treturn \"Exploring an alternative\";\n\t\tdefault:\n\t\t\treturn \"Path\";\n\t}\n}\n","import { type Actor, type ActorKind, SYSTEM_ACTOR } from \"./domain-model.js\";\nimport { trimToNull } from \"./string-normalize.js\";\n\nconst ACTOR_KINDS: readonly ActorKind[] = [\"user\", \"channel\", \"system\"];\nfunction isActorKind(value: unknown): value is ActorKind {\n\treturn typeof value === \"string\" && (ACTOR_KINDS as readonly string[]).includes(value);\n}\n\n/**\n * Builds a validated `Actor`, dropping unknown fields and falling back to\n * defaults for invalid kind/provider. Returns `null` when no stable id is\n * present so callers can decide on a fallback actor.\n */\n/** @internal */\nexport function normalizeActor(value: unknown): Actor | null {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn null;\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\tconst id = trimToNull(candidate.id);\n\tif (!id) {\n\t\treturn null;\n\t}\n\tconst kind = isActorKind(candidate.kind) ? candidate.kind : \"system\";\n\tconst displayName =\n\t\ttypeof candidate.displayName === \"string\" && candidate.displayName.trim() !== \"\"\n\t\t\t? candidate.displayName\n\t\t\t: undefined;\n\treturn {\n\t\tid,\n\t\tkind,\n\t\tprovider: trimToNull(candidate.provider),\n\t\t...(displayName !== undefined ? { displayName } : {}),\n\t};\n}\n\n/** Serializes an `Actor` to a stable JSON string for durable storage. @internal */\nexport function serializeActor(actor: Actor): string {\n\treturn JSON.stringify({\n\t\tid: actor.id,\n\t\tkind: actor.kind,\n\t\tprovider: actor.provider,\n\t\t...(actor.displayName !== undefined ? { displayName: actor.displayName } : {}),\n\t});\n}\n\n/**\n * Parses a durable actor JSON value, falling back to `SYSTEM_ACTOR` when the\n * stored value is missing or malformed. Used when reading legacy rows that\n * predate actor attribution.\n */\n/** @internal */\nexport function parseActorOrSystem(value: string | null | undefined): Actor {\n\tif (value === null || value === undefined || value.trim() === \"\") {\n\t\treturn SYSTEM_ACTOR;\n\t}\n\ttry {\n\t\treturn normalizeActor(JSON.parse(value)) ?? SYSTEM_ACTOR;\n\t} catch {\n\t\treturn SYSTEM_ACTOR;\n\t}\n}\n\n/** Canonical serialized form of `SYSTEM_ACTOR`, used as the durable default. @internal */\nexport const SERIALIZED_SYSTEM_ACTOR = serializeActor(SYSTEM_ACTOR);\n","/** @internal */\nexport const DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT = 5;\n\nfunction hasCredentialBearingAbsoluteUrl(value: string): boolean {\n\tif (!/^[a-z][a-z0-9+.-]*:\\/\\//i.test(value)) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn url.protocol !== \"file:\" && (url.username !== \"\" || url.password !== \"\");\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Strip any embedded credentials (`user:pass@`) from an absolute non-`file:` URL,\n * returning the value unchanged when it is not such a URL.\n */\n/** @internal */\nexport function redactCredentialBearingAbsoluteUrl(value: string): string {\n\tif (!hasCredentialBearingAbsoluteUrl(value)) {\n\t\treturn value;\n\t}\n\tconst url = new URL(value);\n\turl.username = \"\";\n\turl.password = \"\";\n\treturn url.toString();\n}\n\n/** @internal */\nexport function normalizeLauncherRecentValue(value: unknown): string | null {\n\tconst normalizedValue = typeof value === \"string\" ? value.trim() : \"\";\n\tif (!normalizedValue || hasCredentialBearingAbsoluteUrl(normalizedValue)) {\n\t\treturn null;\n\t}\n\treturn normalizedValue;\n}\n\n/** @internal */\nexport function normalizeLauncherRecentValues(\n\tvalues: readonly unknown[],\n\tlimit = DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT,\n): string[] {\n\tconst nextValues = new Set<string>();\n\tfor (const value of values) {\n\t\tconst normalizedValue = normalizeLauncherRecentValue(value);\n\t\tif (!normalizedValue || nextValues.has(normalizedValue)) {\n\t\t\tcontinue;\n\t\t}\n\t\tnextValues.add(normalizedValue);\n\t\tif (nextValues.size >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn [...nextValues];\n}\n\n/** @internal */\nexport function addLauncherRecentValue(\n\texistingValues: readonly string[],\n\tvalue: string,\n\tlimit = DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT,\n): string[] {\n\tconst normalizedValue = normalizeLauncherRecentValue(value);\n\tif (!normalizedValue) {\n\t\treturn normalizeLauncherRecentValues(existingValues, limit);\n\t}\n\treturn normalizeLauncherRecentValues([normalizedValue, ...existingValues], limit);\n}\n","/** @internal */\nexport function normalizeMarkdownLineEndings(markdown: string): string {\n\treturn markdown.replace(/\\r\\n?/g, \"\\n\");\n}\n\n/** @internal */\nexport function normalizeMarkdownText(markdown: string): string {\n\treturn normalizeMarkdownLineEndings(markdown).trim();\n}\n\n/** @internal */\nexport function normalizeOptionalMarkdown(value: unknown): string | null {\n\tif (typeof value !== \"string\") {\n\t\treturn null;\n\t}\n\tconst normalized = normalizeMarkdownText(value);\n\treturn normalized === \"\" ? null : normalized;\n}\n","/** Accept finite numbers and non-blank numeric strings, without coercing other values. @internal */\nexport function readFiniteNumber(value: unknown): number | null {\n\tif (typeof value === \"number\" && Number.isFinite(value)) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"string\" && value.trim() !== \"\") {\n\t\tconst parsed = Number(value);\n\t\treturn Number.isFinite(parsed) ? parsed : null;\n\t}\n\treturn null;\n}\n","import * as v from \"valibot\";\nimport { trimToNull } from \"./string-normalize.js\";\n\n/** @internal */\nexport interface InstanceTurnConfigInput {\n\t/** @internal */\n\tmodelProfileId?: string | null;\n}\n\n/** @internal */\nexport type InstanceTurnConfigMap = Record<string, InstanceTurnConfigInput>;\n\n/** @public */\nexport interface LaunchModelConfigInput {\n\t/** @internal */\n\tdefaultModelProfileId?: string | null;\n\t/** @internal */\n\tturnConfigs?: InstanceTurnConfigMap;\n}\n\n/** @internal */\nexport interface InstanceTurnConfigsJsonError {\n\t/** @internal */\n\tcode: \"invalid_turn_configs_json\";\n\t/** @internal */\n\tprocessId: string;\n\t/** @internal */\n\treason: \"invalid_json\" | \"not_object\" | \"turn_config_not_object\";\n\t/** @internal */\n\tturnId?: string;\n}\n\nconst jsonObjectSchema = v.custom<Record<string, unknown>>(\n\t(value): value is Record<string, unknown> =>\n\t\ttypeof value === \"object\" && value !== null && !Array.isArray(value),\n\t\"Expected object\",\n);\n\nconst instanceTurnConfigSchema = v.pipe(\n\tjsonObjectSchema,\n\tv.object({\n\t\tmodelProfileId: v.optional(v.unknown()),\n\t}),\n);\n\nconst strictInstanceTurnConfigsJsonSchema = v.pipe(\n\tv.string(),\n\tv.parseJson(),\n\tjsonObjectSchema,\n\tv.record(v.string(), instanceTurnConfigSchema),\n);\n\nfunction normalizeInstanceTurnConfigs(\n\tturnConfigs: Record<string, { modelProfileId?: unknown }>,\n): InstanceTurnConfigMap {\n\tconst next: InstanceTurnConfigMap = {};\n\tfor (const [turnId, turnConfig] of Object.entries(turnConfigs)) {\n\t\tconst modelProfileId = trimToNull(turnConfig.modelProfileId);\n\t\tnext[turnId] = modelProfileId ? { modelProfileId } : {};\n\t}\n\treturn next;\n}\n\nfunction getFirstIssuePathKey(issue: v.BaseIssue<unknown>): string | undefined {\n\tconst pathItem = issue.path?.[0] as { key?: unknown } | undefined;\n\treturn typeof pathItem?.key === \"string\" ? pathItem.key : undefined;\n}\n\n/** @internal */\nexport function parseStrictInstanceTurnConfigsJson(\n\tprocessId: string,\n\tturnConfigsJson: string | null | undefined,\n):\n\t| {\n\t\t\t/** @internal */\n\t\t\tok: true;\n\t\t\t/** @internal */\n\t\t\tvalue: InstanceTurnConfigMap;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tok: false;\n\t\t\t/** @internal */\n\t\t\terror: InstanceTurnConfigsJsonError;\n\t } {\n\tif (!turnConfigsJson) return { ok: true, value: {} };\n\tconst result = v.safeParse(strictInstanceTurnConfigsJsonSchema, turnConfigsJson, {\n\t\tabortEarly: true,\n\t});\n\tif (!result.success) {\n\t\tconst issue = result.issues[0];\n\t\tif (issue?.type === \"parse_json\") {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terror: { code: \"invalid_turn_configs_json\", processId, reason: \"invalid_json\" },\n\t\t\t};\n\t\t}\n\t\tconst turnId = issue ? getFirstIssuePathKey(issue) : undefined;\n\t\treturn {\n\t\t\tok: false,\n\t\t\terror: {\n\t\t\t\tcode: \"invalid_turn_configs_json\",\n\t\t\t\tprocessId,\n\t\t\t\treason: turnId !== undefined ? \"turn_config_not_object\" : \"not_object\",\n\t\t\t\t...(turnId !== undefined ? { turnId } : {}),\n\t\t\t},\n\t\t};\n\t}\n\treturn { ok: true, value: normalizeInstanceTurnConfigs(result.output) };\n}\n\n/** @internal */\nexport function serializeInstanceTurnConfigs(turnConfigs: InstanceTurnConfigMap): string | null {\n\tconst normalizedEntries = Object.entries(turnConfigs)\n\t\t.map(([turnId, turnConfig]) => {\n\t\t\tconst modelProfileId = trimToNull(turnConfig.modelProfileId);\n\t\t\treturn [turnId, modelProfileId ? { modelProfileId } : {}] as const;\n\t\t})\n\t\t.filter(([, turnConfig]) => Object.keys(turnConfig).length > 0);\n\treturn normalizedEntries.length === 0\n\t\t? null\n\t\t: JSON.stringify(Object.fromEntries(normalizedEntries));\n}\n\n/** @internal */\nexport function normalizeLaunchModelConfigInput(\n\tinput: LaunchModelConfigInput,\n): LaunchModelConfigInput {\n\tconst defaultModelProfileId = trimToNull(input.defaultModelProfileId);\n\tconst nextTurnConfigs: InstanceTurnConfigMap = {};\n\tfor (const [turnId, turnConfig] of Object.entries(input.turnConfigs ?? {})) {\n\t\tconst modelProfileId = trimToNull(turnConfig.modelProfileId);\n\t\tif (modelProfileId) nextTurnConfigs[turnId] = { modelProfileId };\n\t}\n\treturn { defaultModelProfileId, turnConfigs: nextTurnConfigs };\n}\n","import type { ProcessInstance, ProcessLifecycleStatus, ProcessProject } from \"./domain-model.js\";\n\n/** @internal */\nexport interface ProcessRowSlot {\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tprocessId: string;\n\t/** @internal */\n\ttitle: string;\n\t/** @internal */\n\tsubtitle: string;\n\t/** @internal */\n\tselectedTurnId: string | null;\n\t/** @internal */\n\tlifecycleStatus: ProcessLifecycleStatus;\n\t/** @internal */\n\tstatusCategory: \"error\" | \"active\" | \"waiting\" | \"terminal\" | \"discovered\";\n\t/** @internal */\n\tprojectCount: number;\n\t/** @internal */\n\texternalId: string | null;\n\t/** @internal */\n\texternalLinkCount: number;\n}\n\n/** @internal */\nexport function getProcessStatusCategory(\n\tlifecycleStatus: ProcessLifecycleStatus,\n): ProcessRowSlot[\"statusCategory\"] {\n\tif (lifecycleStatus === \"error\") return \"error\";\n\tif (lifecycleStatus === \"active\") return \"active\";\n\tif (lifecycleStatus === \"waiting\") return \"waiting\";\n\tif (lifecycleStatus === \"completed\" || lifecycleStatus === \"aborted\") return \"terminal\";\n\treturn \"discovered\";\n}\n\n/** @internal */\nexport function buildProcessRowSlot(\n\tprocess: ProcessInstance,\n\tprojects: ReadonlyArray<ProcessProject>,\n): ProcessRowSlot {\n\tconst externalLinkCount = projects.filter((p) => p.externalId !== null).length;\n\n\tconst title = process.title ?? process.externalId ?? process.id;\n\tconst subtitle = `${process.processId} \\u00b7 ${projects.length} component${projects.length !== 1 ? \"s\" : \"\"}`;\n\n\treturn {\n\t\tinstanceId: process.id,\n\t\tprocessId: process.processId,\n\t\ttitle,\n\t\tsubtitle,\n\t\tselectedTurnId: process.selectedTurnId,\n\t\tlifecycleStatus: process.lifecycleStatus,\n\t\tstatusCategory: getProcessStatusCategory(process.lifecycleStatus),\n\t\tprojectCount: projects.length,\n\t\texternalId: process.externalId,\n\t\texternalLinkCount,\n\t};\n}\n\n/** @internal */\nexport function sortProcessRows(rows: ProcessRowSlot[]): ProcessRowSlot[] {\n\tconst categoryOrder: Record<string, number> = {\n\t\terror: 0,\n\t\tactive: 1,\n\t\twaiting: 2,\n\t\tdiscovered: 3,\n\t\tterminal: 4,\n\t};\n\n\treturn [...rows].sort((a, b) => {\n\t\tconst catA = categoryOrder[a.statusCategory] ?? 4;\n\t\tconst catB = categoryOrder[b.statusCategory] ?? 4;\n\t\tif (catA !== catB) return catA - catB;\n\t\treturn a.title.localeCompare(b.title);\n\t});\n}\n","import * as v from \"valibot\";\n\n/** Parse non-array objects into a fresh record using Valibot's key handling. @internal */\nexport const copiedUnknownRecordSchema = v.pipe(\n\tv.unknown(),\n\tv.check(isUnknownRecord, \"Expected object\"),\n\tv.record(v.string(), v.unknown()),\n);\n\n/** @internal */\nexport function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** @internal */\nexport function asUnknownRecord(value: unknown): Record<string, unknown> | null {\n\treturn isUnknownRecord(value) ? value : null;\n}\n","import { trimToNull } from \"./string-normalize.js\";\nimport { asUnknownRecord, isUnknownRecord } from \"./unknown-record.js\";\n\n/** @public */\nexport const PROCESS_SEMANTIC_ENTRY_REF_KEYS = [\n\t\"plan\",\n\t\"review\",\n\t\"currentPrimaryPathLeaf\",\n\t\"rootEntry\",\n] as const;\n\n/** @public */\nexport type ProcessSemanticEntryRefKey = (typeof PROCESS_SEMANTIC_ENTRY_REF_KEYS)[number];\n\n/** @internal */\nexport interface SemanticEntryRef {\n\t/** @internal */\n\tentryId: string;\n\t/** @internal */\n\tturnRecordId: string | null;\n}\n\n/** @internal */\nexport function areSemanticEntryRefsEqual(\n\tleft: SemanticEntryRef | null | undefined,\n\tright: SemanticEntryRef | null | undefined,\n): boolean {\n\treturn (\n\t\t(left?.entryId ?? null) === (right?.entryId ?? null) &&\n\t\t(left?.turnRecordId ?? null) === (right?.turnRecordId ?? null)\n\t);\n}\n\n/** @internal */\nexport type ProcessProductRef = SemanticEntryRef;\n/** @internal */\nexport type ProcessProductRefs = Record<string, ProcessProductRef>;\n\nconst PRODUCT_NAME_PATTERN = /^[a-z][a-z0-9-]*$/;\n\n/** @internal */\nexport function isValidProcessProductName(value: string): boolean {\n\treturn PRODUCT_NAME_PATTERN.test(value);\n}\n\n/** @internal */\nexport function assertValidProcessProductName(value: string): void {\n\tif (!isValidProcessProductName(value)) {\n\t\tthrow new Error(\n\t\t\t`Invalid process product name '${value}'. Product names must match ${PRODUCT_NAME_PATTERN.source}`,\n\t\t);\n\t}\n}\n\n/**\n * Stage 2 keeps these refs as structural placeholders initialized to `null`.\n * Current runtime population:\n * - `rootEntry` during worker bootstrap and subsequent worker tree-fact reporting\n * - `currentPrimaryPathLeaf` during worker bootstrap, successful primary turns,\n * and prompt-style primary-path input delivery\n * - `plan` during successful planning turns; it remains the current plan through\n * implementation until another planning turn replaces it\n * - `review` during successful review turns; it remains the current review until\n * another review turn replaces it\n */\n/** @internal */\nexport interface ProcessSemanticEntryRefs {\n\t/** @internal */\n\tplan: SemanticEntryRef | null;\n\t/** @internal */\n\treview: SemanticEntryRef | null;\n\t/** @internal */\n\tcurrentPrimaryPathLeaf: SemanticEntryRef | null;\n\t/** @internal */\n\trootEntry: SemanticEntryRef | null;\n}\n\n/** @internal */\nexport function isProcessSemanticEntryRefKey(value: string): value is ProcessSemanticEntryRefKey {\n\treturn (PROCESS_SEMANTIC_ENTRY_REF_KEYS as readonly string[]).includes(value);\n}\n\n/** @internal */\nexport function parseSemanticEntryRef(value: unknown): SemanticEntryRef | null {\n\tconst record = asUnknownRecord(value);\n\tconst entryId = trimToNull(record?.entryId);\n\tif (!entryId) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tentryId,\n\t\tturnRecordId: trimToNull(record?.turnRecordId),\n\t};\n}\n\n/** @internal */\nexport function createEmptyProcessSemanticEntryRefs(): ProcessSemanticEntryRefs {\n\treturn {\n\t\tplan: null,\n\t\treview: null,\n\t\tcurrentPrimaryPathLeaf: null,\n\t\trootEntry: null,\n\t};\n}\n\n/** @internal */\nexport function createEmptyProcessProductRefs(): ProcessProductRefs {\n\treturn {};\n}\n\n/** @internal */\nexport function parseProcessProductRefs(value: unknown): ProcessProductRefs {\n\tif (!isUnknownRecord(value)) return createEmptyProcessProductRefs();\n\tconst refs: ProcessProductRefs = {};\n\tfor (const [name, rawRef] of Object.entries(value)) {\n\t\tif (!isValidProcessProductName(name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst ref = parseSemanticEntryRef(rawRef);\n\t\tif (ref) {\n\t\t\trefs[name] = ref;\n\t\t}\n\t}\n\treturn refs;\n}\n\n/** @internal */\nexport function parseProcessSemanticEntryRefs(value: unknown): ProcessSemanticEntryRefs {\n\tconst record = asUnknownRecord(value) ?? {};\n\treturn {\n\t\tplan: parseSemanticEntryRef(record.plan),\n\t\treview: parseSemanticEntryRef(record.review),\n\t\tcurrentPrimaryPathLeaf: parseSemanticEntryRef(record.currentPrimaryPathLeaf),\n\t\trootEntry: parseSemanticEntryRef(record.rootEntry),\n\t};\n}\n","import {\n\tcreateEmptyProcessProductRefs,\n\tcreateEmptyProcessSemanticEntryRefs,\n\tisValidProcessProductName,\n\ttype ProcessProductRefs,\n\ttype ProcessSemanticEntryRefs,\n\tparseProcessSemanticEntryRefs,\n\tparseSemanticEntryRef,\n} from \"./semantic-entry-refs.js\";\n\n/** @internal */\nexport interface ProcessStateJsonParseContext {\n\t/** @internal */\n\tlabel?: string;\n\t/** @internal */\n\tprocessId?: string;\n}\n\nfunction formatMalformedSubject(\n\tdefaultLabel: string,\n\tcontext: string | ProcessStateJsonParseContext | undefined,\n): string {\n\tif (typeof context === \"string\") {\n\t\treturn context;\n\t}\n\tconst label = context?.label ?? defaultLabel;\n\treturn context?.processId ? `${label} for process '${context.processId}'` : label;\n}\n\n/** @internal */\nexport function parseProcessStateJsonStrict(\n\tstateJson: string | null | undefined,\n\tcontext?: string | ProcessStateJsonParseContext,\n): Record<string, unknown> {\n\tif (!stateJson) {\n\t\treturn {};\n\t}\n\tconst subject = formatMalformedSubject(\"stateJson\", context);\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(stateJson);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Malformed ${subject}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n\t\tthrow new Error(`Malformed ${subject}: expected a JSON object`);\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n\n/** @internal */\nexport function parseProcessStateJsonLenient(\n\tstateJson: string | null | undefined,\n): Record<string, unknown> {\n\ttry {\n\t\treturn parseProcessStateJsonStrict(stateJson);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsStrict(\n\tvalue: unknown,\n\tcontext?: ProcessStateJsonParseContext,\n): ProcessSemanticEntryRefs {\n\tif (value === undefined) {\n\t\treturn createEmptyProcessSemanticEntryRefs();\n\t}\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(\n\t\t\t`Malformed ${formatMalformedSubject(\"semanticEntryRefs\", {\n\t\t\t\tlabel: \"semanticEntryRefs\",\n\t\t\t\tprocessId: context?.processId,\n\t\t\t})}: expected an object when present`,\n\t\t);\n\t}\n\treturn parseProcessSemanticEntryRefs(value);\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsLenient(value: unknown): ProcessSemanticEntryRefs {\n\ttry {\n\t\treturn parseSemanticEntryRefsStrict(value);\n\t} catch {\n\t\treturn createEmptyProcessSemanticEntryRefs();\n\t}\n}\n\n/** @internal */\nexport function parseProductRefsStrict(\n\tvalue: unknown,\n\tcontext?: ProcessStateJsonParseContext,\n): ProcessProductRefs {\n\tif (value === undefined) {\n\t\treturn createEmptyProcessProductRefs();\n\t}\n\tconst subject = formatMalformedSubject(\"productRefs\", {\n\t\tlabel: \"productRefs\",\n\t\tprocessId: context?.processId,\n\t});\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(`Malformed ${subject}: expected an object when present`);\n\t}\n\tconst refs: ProcessProductRefs = {};\n\tfor (const [name, rawRef] of Object.entries(value as Record<string, unknown>)) {\n\t\tif (!isValidProcessProductName(name)) {\n\t\t\tthrow new Error(`Malformed ${subject}: invalid product name '${name}'`);\n\t\t}\n\t\tconst ref = parseSemanticEntryRef(rawRef);\n\t\tif (!ref) {\n\t\t\tthrow new Error(`Malformed ${subject}: product '${name}' must reference an entry`);\n\t\t}\n\t\trefs[name] = ref;\n\t}\n\treturn refs;\n}\n\n/** @internal */\nexport function parseProductRefsLenient(value: unknown): ProcessProductRefs {\n\ttry {\n\t\treturn parseProductRefsStrict(value);\n\t} catch {\n\t\treturn createEmptyProcessProductRefs();\n\t}\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsFromStateJsonStrict(\n\tstateJson: string | null | undefined,\n\tcontext?: string | ProcessStateJsonParseContext,\n): ProcessSemanticEntryRefs {\n\tconst stateRecord = parseProcessStateJsonStrict(stateJson, context);\n\treturn parseSemanticEntryRefsStrict(\n\t\tstateRecord.semanticEntryRefs,\n\t\ttypeof context === \"string\" ? undefined : context,\n\t);\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsFromStateJsonLenient(\n\tstateJson: string | null | undefined,\n): ProcessSemanticEntryRefs {\n\tconst stateRecord = parseProcessStateJsonLenient(stateJson);\n\treturn parseSemanticEntryRefsLenient(stateRecord.semanticEntryRefs);\n}\n\n/** @internal */\nexport function parseProductRefsFromStateJsonStrict(\n\tstateJson: string | null | undefined,\n\tcontext?: string | ProcessStateJsonParseContext,\n): ProcessProductRefs {\n\tconst stateRecord = parseProcessStateJsonStrict(stateJson, context);\n\treturn parseProductRefsStrict(\n\t\tstateRecord.productRefs,\n\t\ttypeof context === \"string\" ? undefined : context,\n\t);\n}\n\n/** @internal */\nexport function parseProductRefsFromStateJsonLenient(\n\tstateJson: string | null | undefined,\n): ProcessProductRefs {\n\tconst stateRecord = parseProcessStateJsonLenient(stateJson);\n\treturn parseProductRefsLenient(stateRecord.productRefs);\n}\n","/** @internal */\nexport type RepoLocatorKind = \"remote_url\" | \"local_path\";\n\n/** @internal */\nexport interface ParsedRepoLocator {\n\t/** @internal */\n\tkind: RepoLocatorKind;\n\t/** @internal */\n\tvalue: string;\n}\n\nfunction isFileUrl(value: string): boolean {\n\ttry {\n\t\tconst url = new URL(value);\n\t\tif (url.protocol !== \"file:\") {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\t(url.hostname === \"\" || url.hostname === \"localhost\") &&\n\t\t\turl.pathname.startsWith(\"/\") &&\n\t\t\tdecodeURIComponent(url.pathname).length > 1\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isLocalFilesystemPath(value: string): boolean {\n\treturn (\n\t\tvalue.startsWith(\"/\") ||\n\t\tvalue.startsWith(\"./\") ||\n\t\tvalue.startsWith(\"../\") ||\n\t\tvalue.startsWith(\"~/\") ||\n\t\tisFileUrl(value)\n\t);\n}\n\nconst scpLikeGitUrlPattern = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+:[^\\s]+$/;\nconst explicitRemoteGitUrlPattern = /^(?:https?|ssh|git):\\/\\//;\n\nfunction hasRepositoryPath(pathname: string): boolean {\n\treturn pathname.split(\"/\").filter(Boolean).length >= 1;\n}\n\nfunction isRemoteGitUrl(value: string): boolean {\n\tif (scpLikeGitUrlPattern.test(value)) {\n\t\tconst path = value.slice(value.indexOf(\":\") + 1);\n\t\treturn hasRepositoryPath(path);\n\t}\n\tif (!explicitRemoteGitUrlPattern.test(value)) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn (\n\t\t\t[\"http:\", \"https:\", \"ssh:\", \"git:\"].includes(url.protocol) &&\n\t\t\t!!url.hostname &&\n\t\t\thasRepositoryPath(url.pathname)\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** @internal */\nexport function detectRepoLocatorKind(value: string): RepoLocatorKind | null {\n\tconst trimmed = value.trim();\n\tif (trimmed.length === 0) {\n\t\treturn null;\n\t}\n\tif (isLocalFilesystemPath(trimmed)) {\n\t\treturn \"local_path\";\n\t}\n\tif (isRemoteGitUrl(trimmed)) {\n\t\treturn \"remote_url\";\n\t}\n\treturn null;\n}\n\n/** @internal */\nexport function parseRepoLocator(value: unknown): ParsedRepoLocator | null {\n\tif (typeof value !== \"string\") {\n\t\treturn null;\n\t}\n\tconst trimmed = value.trim();\n\tconst kind = detectRepoLocatorKind(trimmed);\n\tif (!kind) {\n\t\treturn null;\n\t}\n\treturn { kind, value: trimmed };\n}\n\n/** @internal */\nexport function isRepoLocator(value: unknown): value is string {\n\treturn parseRepoLocator(value) !== null;\n}\n\n/** @internal */\nexport function assertRepoLocator(value: unknown, fieldName = \"repoLocator\"): string {\n\tconst parsed = parseRepoLocator(value);\n\tif (!parsed) {\n\t\tthrow new Error(`${fieldName} must be a remote URL or local filesystem path`);\n\t}\n\treturn parsed.value;\n}\n","/** First server receipt of a physical worker startup milestone. @internal */\nexport type StartupMilestone =\n\t| \"pvc_requested\"\n\t| \"pvc_acknowledged\"\n\t| \"pvc_bound\"\n\t| \"pod_requested\"\n\t| \"pod_acknowledged\"\n\t| \"pod_created\"\n\t| \"pod_scheduled\"\n\t| \"image_pull_started\"\n\t| \"image_pull_finished\"\n\t| \"image_cached\"\n\t| \"container_started\"\n\t| \"prompt_started\"\n\t| \"first_text\";\n/** @internal */\nexport interface StartupObservation {\n\t/** @internal */\n\tworkerLeaseId: string;\n\t/** @internal */\n\tmilestone: StartupMilestone;\n\t/** @internal */\n\tobservedAt: string;\n\t/** @internal */\n\tsourceAt: string | null;\n\t/** @internal */\n\tsourceKind: \"server\" | \"kubernetes_status\" | \"kubernetes_event\";\n\t/** @internal */\n\tobjectUid: string | null;\n\t/** @internal */\n\tturnRecordId: string | null;\n\t/** Sampling lower bound, never an exact binding timestamp. @internal */\n\tnotBefore: string | null;\n\t/** @internal */\n\tmetadata: {\n\t\t/** @internal */\n\t\tnode?: string;\n\t\t/** @internal */\n\t\timageId?: string;\n\t\t/** @internal */\n\t\timage?: string;\n\t\t/** @internal */\n\t\tstorageClass?: string;\n\t\t/** @internal */\n\t\tcpu?: string;\n\t\t/** @internal */\n\t\tmemory?: string;\n\t\t/** @internal */\n\t\tnamespace?: string;\n\t\t/** @internal */\n\t\tpodName?: string;\n\t\t/** @internal */\n\t\tprecision?: \"milliseconds\" | \"microseconds\" | \"seconds\" | \"sampling_interval\";\n\t};\n}\n/** @internal */\nexport interface StartupInterval {\n\t/** @internal */\n\tstart: string | null;\n\t/** @internal */\n\tend: string | null;\n\t/** @internal */\n\tdurationMs: number | null;\n\t/** @internal */\n\tstatus: \"available\" | \"missing\" | \"invalid_order\";\n\t/** @internal */\n\tclock: \"server\" | \"kubernetes\";\n}\n/** @internal */\nexport function startupInterval(\n\tstart: string | null | undefined,\n\tend: string | null | undefined,\n\tclock: StartupInterval[\"clock\"] = \"server\",\n): StartupInterval {\n\tconst delta = start && end ? Date.parse(end) - Date.parse(start) : NaN;\n\tconst status =\n\t\t!start || !end\n\t\t\t? \"missing\"\n\t\t\t: !Number.isFinite(delta) || delta < 0\n\t\t\t\t? \"invalid_order\"\n\t\t\t\t: \"available\";\n\treturn {\n\t\tstart: start ?? null,\n\t\tend: end ?? null,\n\t\tdurationMs: status === \"available\" ? delta : null,\n\t\tstatus,\n\t\tclock,\n\t};\n}\n/** @internal */\nexport interface PhysicalWorkerStart {\n\t/** @internal */\n\tworkerLeaseId: string;\n\t/** @internal */\n\tworkerId: string;\n\t/** @internal */\n\tturnStartRecordId: string | null;\n\t/** @internal */\n\tturnRecordId: string | null;\n\t/** @internal */\n\tstate: string;\n\t/** @internal */\n\tobservations: StartupObservation[];\n\t/** @internal */\n\tintervals: Record<string, StartupInterval>;\n}\n","import {\n\tisProcessSemanticEntryRefKey,\n\ttype ProcessSemanticEntryRefKey,\n} from \"./semantic-entry-refs.js\";\nimport { trimToNull } from \"./string-normalize.js\";\n\n/** @internal */\nexport const TURN_ANNOTATION_REFERENCE_KINDS = [\n\t\"turn_record\",\n\t\"entry\",\n\t\"semantic_entry_ref\",\n] as const;\n\n/** @internal */\nexport type TurnAnnotationReferenceKind = (typeof TURN_ANNOTATION_REFERENCE_KINDS)[number];\n/** @internal */\nexport type TurnAnnotationReferenceRole = string;\n\n/** @internal */\nexport interface TurnRecordAnnotationReference {\n\t/** @internal */\n\tkind: \"turn_record\";\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\trole: TurnAnnotationReferenceRole | null;\n}\n\n/** @internal */\nexport interface EntryTurnAnnotationReference {\n\t/** @internal */\n\tkind: \"entry\";\n\t/** @internal */\n\tentryId: string;\n\t/** @internal */\n\trole: TurnAnnotationReferenceRole | null;\n}\n\n/** @internal */\nexport interface SemanticEntryRefTurnAnnotationReference {\n\t/** @internal */\n\tkind: \"semantic_entry_ref\";\n\t/** @internal */\n\tref: ProcessSemanticEntryRefKey;\n\t/** @internal */\n\trole: TurnAnnotationReferenceRole | null;\n}\n\n/** @internal */\nexport type TurnAnnotationReference =\n\t| TurnRecordAnnotationReference\n\t| EntryTurnAnnotationReference\n\t| SemanticEntryRefTurnAnnotationReference;\n\n/** @internal */\nexport interface ProcessTurnAnnotation {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tannotationType: string;\n\t/** @internal */\n\tannotationKey: string | null;\n\t/** @internal */\n\treferences: TurnAnnotationReference[];\n\t/** @internal */\n\tpayload: Record<string, unknown>;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport function parseTurnAnnotationReference(value: unknown): TurnAnnotationReference | null {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\treturn null;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst kind = trimToNull(record.kind);\n\tconst role = trimToNull(record.role);\n\tif (kind === \"turn_record\") {\n\t\tconst turnRecordId = trimToNull(record.turnRecordId);\n\t\treturn turnRecordId ? { kind, turnRecordId, role } : null;\n\t}\n\tif (kind === \"entry\") {\n\t\tconst entryId = trimToNull(record.entryId);\n\t\treturn entryId ? { kind, entryId, role } : null;\n\t}\n\tif (kind === \"semantic_entry_ref\") {\n\t\tconst ref = trimToNull(record.ref);\n\t\treturn ref && isProcessSemanticEntryRefKey(ref) ? { kind, ref, role } : null;\n\t}\n\treturn null;\n}\n\n/** @internal */\nexport function parseTurnAnnotationReferences(value: unknown): TurnAnnotationReference[] {\n\tif (!Array.isArray(value)) {\n\t\treturn [];\n\t}\n\treturn value\n\t\t.map(parseTurnAnnotationReference)\n\t\t.filter((reference): reference is TurnAnnotationReference => reference !== null);\n}\n","import { normalizeStringArray, trimToNull } from \"./string-normalize.js\";\nimport { isUnknownRecord as isRecord } from \"./unknown-record.js\";\n\n/** @internal */\nexport const DEFAULT_CONTINUE_PROMPT = \"continue\";\n\n/** @internal */\nexport const FAILED_TURN_RECOVERY_CODES = [\n\t\"generic_continue\",\n\t\"missing_outcome_tool\",\n\t\"missing_markdown_result\",\n\t\"missing_required_tool_calls\",\n] as const;\n\n/** @internal */\nexport type FailedTurnRecoveryCode = (typeof FAILED_TURN_RECOVERY_CODES)[number];\n\n/** @internal */\nexport interface FailedTurnRecoveryContext {\n\t/** @internal */\n\tstrategy: \"continue\";\n\t/** @internal */\n\tsuggestedContinuePrompt: string;\n\t/** @internal */\n\tfailureCode: FailedTurnRecoveryCode;\n\t/** @internal */\n\tmissingToolNames?: string[];\n}\n\n/** @internal */\nexport type FailedTurnRecoveryOverrides = Partial<Omit<FailedTurnRecoveryContext, \"strategy\">>;\n\n/** @internal */\nexport const FAILED_TURN_RECOVERY_METADATA_KEY = \"failedTurnRecovery\";\n/** @internal */\nexport const CONTINUE_PROMPT_METADATA_KEY = \"continuePrompt\";\nconst TERMINAL_OUTCOME_RECORDING_FAILURE_PREFIX =\n\t\"Server could not durably record worker turn outcome:\";\n\n/** @internal */\nexport function isFailedTurnRecoveryCode(value: string): value is FailedTurnRecoveryCode {\n\treturn (FAILED_TURN_RECOVERY_CODES as readonly string[]).includes(value);\n}\n\nfunction normalizeUniqueStringArray(value: unknown): string[] | undefined {\n\tconst normalized = normalizeStringArray(value);\n\treturn normalized.length > 0 ? [...new Set(normalized)] : undefined;\n}\n\nexport { trimToNull as normalizeContinuePrompt };\n\n/** @internal */\nexport function createGenericFailedTurnRecoveryContext(\n\toverrides: FailedTurnRecoveryOverrides = {},\n): FailedTurnRecoveryContext {\n\treturn {\n\t\tstrategy: \"continue\",\n\t\tsuggestedContinuePrompt: DEFAULT_CONTINUE_PROMPT,\n\t\tfailureCode: \"generic_continue\",\n\t\t...overrides,\n\t};\n}\n\n/** @internal */\nexport function inferTerminalRecordingFailedTurnRecoveryContext(input: {\n\t/** @internal */\n\terrorSummary?: string | null;\n\t/** @internal */\n\terrorClass?: string | null;\n}): FailedTurnRecoveryContext | null {\n\tif (\n\t\tinput.errorClass !== \"infrastructure\" ||\n\t\t!input.errorSummary?.startsWith(TERMINAL_OUTCOME_RECORDING_FAILURE_PREFIX)\n\t) {\n\t\treturn null;\n\t}\n\treturn createGenericFailedTurnRecoveryContext();\n}\n\n/** @internal */\nexport function buildFailedTurnRecoveryMetadata(\n\tturnRecordId: string,\n\tcontext: FailedTurnRecoveryOverrides = {},\n) {\n\treturn {\n\t\t/** @internal */\n\t\t[FAILED_TURN_RECOVERY_METADATA_KEY]: {\n\t\t\t/** @internal */\n\t\t\tturnRecordId,\n\t\t\t...createGenericFailedTurnRecoveryContext(context),\n\t\t},\n\t};\n}\n\n/** @internal */\nexport function readFailedTurnRecoveryContext(\n\tmetadata: Record<string, unknown> | null | undefined,\n\texpectedTurnRecordId?: string | null,\n): FailedTurnRecoveryContext | null {\n\tif (!metadata) {\n\t\treturn null;\n\t}\n\tconst raw = metadata[FAILED_TURN_RECOVERY_METADATA_KEY];\n\tif (!isRecord(raw)) {\n\t\treturn null;\n\t}\n\tif (expectedTurnRecordId) {\n\t\tconst turnRecordId = trimToNull(raw.turnRecordId);\n\t\tif (turnRecordId !== expectedTurnRecordId) {\n\t\t\treturn null;\n\t\t}\n\t}\n\tif (raw.strategy !== \"continue\") {\n\t\treturn null;\n\t}\n\tconst suggestedContinuePrompt = trimToNull(raw.suggestedContinuePrompt);\n\tconst failureCode = trimToNull(raw.failureCode);\n\tif (!suggestedContinuePrompt || !failureCode || !isFailedTurnRecoveryCode(failureCode)) {\n\t\treturn null;\n\t}\n\tconst missingToolNames = normalizeUniqueStringArray(raw.missingToolNames);\n\treturn {\n\t\tstrategy: \"continue\",\n\t\tsuggestedContinuePrompt,\n\t\tfailureCode,\n\t\t...(missingToolNames ? { missingToolNames } : {}),\n\t};\n}\n","import type { ProcessTurnRecordPathType } from \"./domain-model.js\";\nimport type {\n\tProcessProductRefs,\n\tProcessSemanticEntryRefKey,\n\tProcessSemanticEntryRefs,\n} from \"./semantic-entry-refs.js\";\n\n/** @internal */\nexport interface ProcessTurnStartFromCurrentLeaf {\n\t/** @internal */\n\tkind: \"current_leaf\";\n}\n\n/** @internal */\nexport interface ProcessTurnStartFromSessionRoot {\n\t/** Start with no persisted Pi entry in context. The kickoff entry has parentId null. @internal */\n\tkind: \"session_root\";\n}\n\n/** @internal */\nexport interface ProcessTurnStartFromEntry {\n\t/** @internal */\n\tkind: \"entry\";\n\t/** @internal */\n\tentryId: string;\n}\n\n/** @internal */\nexport type ProcessTurnStartFallback =\n\t| ProcessTurnStartFromCurrentLeaf\n\t| ProcessTurnStartFromSessionRoot\n\t| ProcessTurnStartFromEntry;\n\n/** @internal */\nexport interface ProcessTurnStartFromSemanticRef {\n\t/** @internal */\n\tkind: \"semantic_ref\";\n\t/** @internal */\n\tref: ProcessSemanticEntryRefKey;\n\t/** @internal */\n\tfallback?: ProcessTurnStartSelection;\n}\n\n/** @internal */\nexport interface ProcessTurnStartFromProductRef {\n\t/** @internal */\n\tkind: \"product_ref\";\n\t/** @internal */\n\tproductName: string;\n\t/** @internal */\n\tfallback?: ProcessTurnStartSelection;\n}\n\n/** @internal */\nexport type ProcessTurnStartSelection =\n\t| ProcessTurnStartFallback\n\t| ProcessTurnStartFromSemanticRef\n\t| ProcessTurnStartFromProductRef;\n\n/** @internal */\nexport type ProcessTurnStartTarget =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"current_leaf\";\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"entry\";\n\t\t\t/** @internal */\n\t\t\tentryId: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"root\";\n\t };\n\n/** @internal */\nexport interface ProcessTurnStartResolution {\n\t/** @internal */\n\tforkPiEntryId: string | null;\n\t/** @internal */\n\tstartTarget: ProcessTurnStartTarget;\n}\n\n/** @internal */\nexport function defaultProcessTurnStartSelection(\n\tbranchType: ProcessTurnRecordPathType,\n): ProcessTurnStartFallback {\n\tswitch (branchType) {\n\t\tcase \"primary\":\n\t\tcase \"leaf_branch\":\n\t\t\treturn { kind: \"current_leaf\" };\n\t\tcase \"root_branch\":\n\t\t\treturn { kind: \"session_root\" };\n\t}\n}\n\n/** @internal */\nexport function resolveProcessTurnStartSelection(input: {\n\t/** @internal */\n\tbranchType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tstartFrom?: ProcessTurnStartSelection;\n}): ProcessTurnStartSelection {\n\treturn input.startFrom ?? defaultProcessTurnStartSelection(input.branchType);\n}\n\n/** @internal */\nexport function resolveExistingProcessEntryId(\n\tentryId: string | null,\n\tentryExists?: ((entryId: string) => boolean) | undefined,\n): string | null {\n\tif (!entryId) {\n\t\treturn null;\n\t}\n\treturn entryExists && !entryExists(entryId) ? null : entryId;\n}\n\n/** @internal */\nexport function resolveProcessSemanticRefEntryId(input: {\n\t/** @internal */\n\tref: keyof ProcessSemanticEntryRefs;\n\t/** @internal */\n\tsemanticEntryRefs?: ProcessSemanticEntryRefs | null;\n\t/** @internal */\n\tcurrentLeafId: string | null;\n\t/** @internal */\n\trootEntryId: string | null;\n\t/** @internal */\n\tentryExists?: (entryId: string) => boolean;\n}): string | null {\n\tconst fromState = resolveExistingProcessEntryId(\n\t\tinput.semanticEntryRefs?.[input.ref]?.entryId ?? null,\n\t\tinput.entryExists,\n\t);\n\tif (fromState) {\n\t\treturn fromState;\n\t}\n\tif (input.ref === \"currentPrimaryPathLeaf\") {\n\t\treturn resolveExistingProcessEntryId(input.currentLeafId, input.entryExists);\n\t}\n\tif (input.ref === \"rootEntry\") {\n\t\treturn resolveExistingProcessEntryId(input.rootEntryId, input.entryExists);\n\t}\n\treturn null;\n}\n\n/** @internal */\nexport function resolveProcessProductRefEntryId(input: {\n\t/** @internal */\n\tproductName: string;\n\t/** @internal */\n\tproductRefs?: ProcessProductRefs | null;\n\t/** @internal */\n\tentryExists?: (entryId: string) => boolean;\n}): string | null {\n\tconst productName = input.productName.trim();\n\tif (!productName) {\n\t\treturn null;\n\t}\n\treturn resolveExistingProcessEntryId(\n\t\tinput.productRefs?.[productName]?.entryId ?? null,\n\t\tinput.entryExists,\n\t);\n}\n\n/** @internal */\nexport function resolveProcessTurnStartTarget(input: {\n\t/** @internal */\n\tbranchType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tselection: ProcessTurnStartSelection;\n\t/** @internal */\n\tcurrentLeafId: string | null;\n\t/** @internal */\n\trootEntryId: string | null;\n\t/** @internal */\n\tsemanticEntryRefs?: ProcessSemanticEntryRefs | null;\n\t/** @internal */\n\tproductRefs?: ProcessProductRefs | null;\n\t/** @internal */\n\tentryExists?: (entryId: string) => boolean;\n}): ProcessTurnStartResolution {\n\tswitch (input.selection.kind) {\n\t\tcase \"current_leaf\": {\n\t\t\treturn {\n\t\t\t\tforkPiEntryId: resolveExistingProcessEntryId(input.currentLeafId, input.entryExists),\n\t\t\t\tstartTarget: { kind: \"current_leaf\" },\n\t\t\t};\n\t\t}\n\t\tcase \"session_root\": {\n\t\t\treturn {\n\t\t\t\tforkPiEntryId: null,\n\t\t\t\tstartTarget: { kind: \"root\" },\n\t\t\t};\n\t\t}\n\t\tcase \"entry\": {\n\t\t\treturn {\n\t\t\t\tforkPiEntryId: input.selection.entryId,\n\t\t\t\tstartTarget: { kind: \"entry\", entryId: input.selection.entryId },\n\t\t\t};\n\t\t}\n\t\tcase \"semantic_ref\":\n\t\tcase \"product_ref\": {\n\t\t\tconst entryId =\n\t\t\t\tinput.selection.kind === \"semantic_ref\"\n\t\t\t\t\t? resolveProcessSemanticRefEntryId({\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t\tref: input.selection.ref,\n\t\t\t\t\t\t})\n\t\t\t\t\t: resolveProcessProductRefEntryId({\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t\tproductName: input.selection.productName,\n\t\t\t\t\t\t});\n\t\t\tif (entryId) {\n\t\t\t\treturn {\n\t\t\t\t\tforkPiEntryId: entryId,\n\t\t\t\t\tstartTarget: { kind: \"entry\", entryId },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn resolveProcessTurnStartTarget({\n\t\t\t\t...input,\n\t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ACA,SAAO;AAAA,IACN,MAAM,cAAc,WAAW,GAAG,WAAW;AAAA,IAC7C,MAAM;AAAA,EACP;AACD;AAGO,SAAS,8BAA8B,OAef;AAC9B,UAAQ,MAAM,UAAU,MAAM;AAAA,IAC7B,KAAK,gBAAgB;AACpB,aAAO;AAAA,QACN,eAAe,8BAA8B,MAAM,eAAe,MAAM,WAAW;AAAA,QACnF,aAAa,EAAE,MAAM,eAAe;AAAA,MACrC;AAAA,IACD;AAAA,IACA,KAAK,gBAAgB;AACpB,aAAO;AAAA,QACN,eAAe;AAAA,QACf,aAAa,EAAE,MAAM,OAAO;AAAA,MAC7B;AAAA,IACD;AAAA,IACA,KAAK,SAAS;AACb,aAAO;AAAA,QACN,eAAe,MAAM,UAAU;AAAA,QAC/B,aAAa,EAAE,MAAM,SAAS,SAAS,MAAM,UAAU,QAAQ;AAAA,MAChE;AAAA,IACD;AAAA,IACA,KAAK;AAAA,IACL,KAAK,eAAe;AACnB,YAAM,UACL,MAAM,UAAU,SAAS,iBACtB,iCAAiC;AAAA,QACjC,GAAG;AAAA,QACH,KAAK,MAAM,UAAU;AAAA,MACtB,CAAC,IACA,gCAAgC;AAAA,QAChC,GAAG;AAAA,QACH,aAAa,MAAM,UAAU;AAAA,MAC9B,CAAC;AACJ,UAAI,SAAS;AACZ,eAAO;AAAA,UACN,eAAe;AAAA,UACf,aAAa,EAAE,MAAM,SAAS,QAAQ;AAAA,QACvC;AAAA,MACD;AAEA,aAAO,8BAA8B;AAAA,QACpC,GAAG;AAAA,QACH,WAAW,MAAM,UAAU,YAAY,iCAAiC,MAAM,UAAU;AAAA,MACzF,CAAC;AAAA,IACF;AAAA,EACD;AACD;","names":["v","record","record"]}
1
+ {"version":3,"sources":["../src/string-normalize.ts","../src/domain-model.ts","../src/actor.ts","../src/launcher-recent-values.ts","../src/markdown-normalize.ts","../src/number-normalize.ts","../src/process-model-config.ts","../src/process-row-slots.ts","../src/unknown-record.ts","../src/semantic-entry-refs.ts","../src/process-state-json.ts","../src/repo-locator.ts","../src/startup-observation.ts","../src/turn-annotations.ts","../src/turn-recovery.ts","../src/turn-start-resolution.ts"],"sourcesContent":["/** @internal */\nexport function toErrorMessage(error: unknown): string {\n\tif (error instanceof Error && error.message.trim() !== \"\") {\n\t\treturn error.message;\n\t}\n\treturn String(error);\n}\n\n/** Return non-blank strings verbatim; unlike trimToNull, preserve surrounding whitespace. @internal */\nexport function readNonBlankString(value: unknown): string | null {\n\treturn typeof value === \"string\" && value.trim() !== \"\" ? value : null;\n}\n\n/** @internal */\nexport function trimString(value: unknown): string {\n\treturn typeof value === \"string\" ? value.trim() : \"\";\n}\n\n/** @internal */\nexport function trimToNull(value: unknown): string | null {\n\tconst trimmed = trimString(value);\n\treturn trimmed === \"\" ? null : trimmed;\n}\n\n/** @internal */\nexport function normalizeStringArray(value: unknown): string[] {\n\tif (!Array.isArray(value)) {\n\t\treturn [];\n\t}\n\treturn value.map((entry) => trimString(entry)).filter((entry) => entry.length > 0);\n}\n\n/**\n * Single source of truth for turning an internal identifier (an action id,\n * outcome id, or trigger) into a human-readable Title Case label, e.g.\n * `approve_plan` -> `Approve Plan`. All operator-facing surfaces (action forms,\n * flow diagrams) must route through this so the translation lives in one place\n * and can later be swapped for a localized lookup.\n */\n/** @internal */\nexport function humanizeProcessLabel(identifier: unknown): string {\n\treturn trimString(identifier)\n\t\t.replace(/[_-]+/g, \" \")\n\t\t.replace(/\\s+/g, \" \")\n\t\t.replace(/\\b\\w/g, (letter) => letter.toUpperCase())\n\t\t.trim();\n}\n\nconst IDENTIFIER_WORD_LABELS: Record<string, string> = {\n\tapi: \"API\",\n\tid: \"ID\",\n\tllm: \"LLM\",\n\tmr: \"MR\",\n\tpi: \"Pi\",\n\tui: \"UI\",\n};\n\n/** Display an identifier with known acronyms, preserving the remaining spelling. @internal */\nexport function formatProcessIdentifier(value: string): string {\n\treturn value\n\t\t.split(/[_-]+/)\n\t\t.filter((part) => part.length > 0)\n\t\t.map((part) => {\n\t\t\tconst normalizedPart = part.toLowerCase();\n\t\t\treturn IDENTIFIER_WORD_LABELS[normalizedPart] ?? part.charAt(0).toUpperCase() + part.slice(1);\n\t\t})\n\t\t.join(\" \");\n}\n","import type { RepoLocatorKind } from \"./repo-locator.js\";\nimport type { ProcessSemanticEntryRefKey } from \"./semantic-entry-refs.js\";\nimport { trimToNull } from \"./string-normalize.js\";\nimport type { FailedTurnRecoveryContext } from \"./turn-recovery.js\";\nimport type { ProcessTurnStartTarget } from \"./turn-start-resolution.js\";\n\n/** @internal */\nexport type TransitionTrigger =\n\t| \"start\"\n\t| \"advance\"\n\t| \"revision_requested\"\n\t| \"plan_approved\"\n\t| \"feedback_received\"\n\t| \"operator_re_review\"\n\t| \"mr_merged\"\n\t| \"abort\"\n\t| \"mr_state_waiting\";\n\n/** @public */\nexport type InputSource =\n\t| \"external_comment\"\n\t| \"app_steer\"\n\t| \"action_prompt\"\n\t| \"watcher_event\"\n\t| \"llm_review\"\n\t| \"system\";\n\n/**\n * Stable principal that drove an action, orthogonal to `InputSource` (the\n * channel an input arrived through) and `TransitionTrigger` (the graph edge a\n * transition followed). An `Actor` answers \"who acted\", not \"how\" or \"why\".\n */\n/** @public */\nexport type ActorKind = \"user\" | \"channel\" | \"system\";\n\n/** @public */\nexport interface Actor {\n\t/**\n\t * Stable principal id, namespaced by provider where applicable.\n\t * e.g. \"identity-provider:alice\", \"operator-channel\", \"system\", \"admin\".\n\t */\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tkind: ActorKind;\n\t/** Origin that vouched for this actor. `null` for system/admin/local. @public */\n\tprovider: string | null;\n\t/** Optional human-readable name for UI display. @internal */\n\tdisplayName?: string;\n}\n\n/** Watcher / scheduler / startup reconciliation and other internal callers. @internal */\nexport const SYSTEM_ACTOR: Actor = { id: \"system\", kind: \"system\", provider: null };\n\n/**\n * Unauthenticated default for human-driven web/HTTP/WS actions when no SSO\n * provider is configured. Keeps an auth-disabled leitwerk behaving exactly\n * as it does today while still attributing actions to a stable principal.\n */\n/** @internal */\nexport const ADMIN_ACTOR: Actor = { id: \"admin\", kind: \"user\", provider: null };\n\n/** @internal */\nexport type QuestionSelectionMode = \"single\" | \"multiple\";\n\n/** @internal */\nexport interface NormalizedQuestionOption {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tlabel: string;\n\t/** @internal */\n\tdetails: string | null;\n}\n\n/** @internal */\nexport interface NormalizedQuestion {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tquestion: string;\n\t/** @internal */\n\tselection: QuestionSelectionMode;\n\t/** @internal */\n\toptions: readonly NormalizedQuestionOption[];\n}\n\n/** @internal */\nexport interface QuestionAnswerDraft {\n\t/** @internal */\n\tselectedOptionIds: readonly string[];\n\t/** @internal */\n\tfreeText: string;\n\t/** @internal */\n\tcomment: string;\n}\n\n/** @internal */\nexport interface ProcessRelation {\n\t/** @internal */\n\tparentInstanceId: string;\n\t/** @internal */\n\tchildInstanceId: string;\n\t/** @internal */\n\tkind: \"derived\";\n\t/** @internal */\n\tpurpose: string;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tcreatedBy: Actor;\n}\n\n/** @internal */\nexport type ToolApprovalStatus = \"open\" | \"accepted\" | \"feedback\" | \"declined\" | \"cancelled\";\n\n/** @internal */\nexport interface ProcessToolApprovalDestination {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tdisplayName: string;\n\t/** @internal */\n\tgroup?: string;\n\t/** @internal */\n\tdescription?: string;\n}\n\n/** @internal */\nexport interface ProcessToolApprovalRequest {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\ttoolCallId: string;\n\t/** @internal */\n\ttoolName: string;\n\t/** @internal */\n\targuments: Record<string, unknown>;\n\t/** @internal */\n\tdestination: ProcessToolApprovalDestination | null;\n\t/** @internal */\n\tstatus: ToolApprovalStatus;\n\t/** @internal */\n\trequestedAt: string;\n\t/** @internal */\n\tresolvedAt: string | null;\n\t/** @internal */\n\tresolvedBy: Actor | null;\n\t/** @internal */\n\tfeedback: string | null;\n}\n\n/** @internal */\nexport interface ProcessQuestionRequest {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\ttoolCallId: string;\n\t/** @internal */\n\tquestions: readonly NormalizedQuestion[];\n\t/** @internal */\n\tstatus: \"open\" | \"answered\" | \"cancelled\";\n\t/** @internal */\n\tanswers: readonly string[] | null;\n\t/** @internal */\n\taskedAt: string;\n\t/** @internal */\n\tansweredAt: string | null;\n\t/** @internal */\n\tansweredBy: Actor | null;\n\t/** @internal */\n\tcancelledAt: string | null;\n}\n\nfunction requiredTrimmedString(value: unknown, field: string): string {\n\tconst trimmed = trimToNull(value);\n\tif (!trimmed) {\n\t\tthrow new Error(`${field} must be a non-empty string`);\n\t}\n\treturn trimmed;\n}\n\n/** Normalize an LLM-authored request into immutable, position-stable identities. @internal */\nexport function normalizeAskQuestionsInput(value: unknown): NormalizedQuestion[] {\n\tconst questions = (\n\t\tvalue as {\n\t\t\tquestions?: Array<{\n\t\t\t\tquestion?: unknown;\n\t\t\t\tselection?: unknown;\n\t\t\t\toptions?: Array<{ label?: unknown; details?: unknown }>;\n\t\t\t}>;\n\t\t}\n\t)?.questions;\n\tif (!Array.isArray(questions)) throw new Error(\"questions must be an array\");\n\tif (questions.length === 0) throw new Error(\"questions must not be empty\");\n\treturn questions.map((candidate, questionIndex) => {\n\t\tconst question = requiredTrimmedString(\n\t\t\tcandidate?.question,\n\t\t\t`questions[${questionIndex}].question`,\n\t\t);\n\t\tif (candidate?.selection !== \"single\" && candidate?.selection !== \"multiple\") {\n\t\t\tthrow new Error(`questions[${questionIndex}].selection must be 'single' or 'multiple'`);\n\t\t}\n\t\tif (!Array.isArray(candidate.options) || candidate.options.length === 0) {\n\t\t\tthrow new Error(`questions[${questionIndex}].options must not be empty`);\n\t\t}\n\t\tconst labels = new Set<string>();\n\t\tconst questionId = `question_${questionIndex + 1}`;\n\t\tconst options = candidate.options.map((option, optionIndex) => {\n\t\t\tconst label = requiredTrimmedString(\n\t\t\t\toption?.label,\n\t\t\t\t`questions[${questionIndex}].options[${optionIndex}].label`,\n\t\t\t);\n\t\t\tconst key = label.toLocaleLowerCase();\n\t\t\tif (labels.has(key)) {\n\t\t\t\tthrow new Error(`questions[${questionIndex}] contains duplicate option '${label}'`);\n\t\t\t}\n\t\t\tlabels.add(key);\n\t\t\treturn {\n\t\t\t\tid: `${questionId}_option_${optionIndex + 1}`,\n\t\t\t\tlabel,\n\t\t\t\tdetails: trimToNull(option.details),\n\t\t\t};\n\t\t});\n\t\treturn { id: questionId, question, selection: candidate.selection, options };\n\t});\n}\n\n/** @internal */\nexport function emptyQuestionDrafts(\n\tquestions: readonly NormalizedQuestion[],\n): QuestionAnswerDraft[] {\n\treturn questions.map(() => ({ selectedOptionIds: [], freeText: \"\", comment: \"\" }));\n}\n\nfunction normalizeQuestionDrafts(\n\tquestions: readonly NormalizedQuestion[],\n\tvalue: unknown,\n): QuestionAnswerDraft[] {\n\tif (!Array.isArray(value) || value.length !== questions.length) {\n\t\tthrow new Error(\"Every question must have one draft answer in question order\");\n\t}\n\treturn questions.map((question, index) => {\n\t\tconst answer = value[index] as Partial<QuestionAnswerDraft> | undefined;\n\t\tif (!Array.isArray(answer?.selectedOptionIds)) {\n\t\t\tthrow new Error(`Question ${index + 1} has a malformed selection`);\n\t\t}\n\t\tconst selectedOptionIds = answer.selectedOptionIds.map((id) => {\n\t\t\tif (typeof id !== \"string\" || !question.options.some((option) => option.id === id)) {\n\t\t\t\tthrow new Error(`Question ${index + 1} contains an unknown selection`);\n\t\t\t}\n\t\t\treturn id;\n\t\t});\n\t\tif (new Set(selectedOptionIds).size !== selectedOptionIds.length) {\n\t\t\tthrow new Error(`Question ${index + 1} contains duplicate selections`);\n\t\t}\n\t\tif (question.selection === \"single\" && selectedOptionIds.length > 1) {\n\t\t\tthrow new Error(`Question ${index + 1} accepts only one selection`);\n\t\t}\n\t\tif (typeof answer.freeText !== \"string\" || typeof answer.comment !== \"string\") {\n\t\t\tthrow new Error(`Question ${index + 1} contains malformed text`);\n\t\t}\n\t\treturn { selectedOptionIds, freeText: answer.freeText, comment: answer.comment };\n\t});\n}\n\n/** Validate a complete structured draft and produce one canonical free-text answer per question. @internal */\nexport function canonicalizeQuestionAnswers(\n\tquestions: readonly NormalizedQuestion[],\n\tvalue: unknown,\n): string[] {\n\treturn normalizeQuestionDrafts(questions, value).map((answer, index) => {\n\t\tconst question = questions[index];\n\t\tif (!question) throw new Error(`Question ${index + 1} is missing`);\n\t\tconst options = answer.selectedOptionIds.map(\n\t\t\t(id) => question.options.find((option) => option.id === id)?.label ?? \"\",\n\t\t);\n\t\tconst freeText = answer.freeText.trim();\n\t\tconst comment = answer.comment.trim();\n\t\tif (options.length === 0 && freeText === \"\") {\n\t\t\tthrow new Error(`Question ${index + 1} requires an answer`);\n\t\t}\n\t\treturn [options.join(\", \"), freeText, comment ? `Context: ${comment}` : \"\"]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\"\\n\");\n\t});\n}\n\n/**\n * Durable operator/system input queued for worker delivery.\n * `action_prompt` is the conventional source for action-originated follow-up\n * prompts. Delivery semantics are owned by `ProcessInput.target`, not by\n * `source` or `kind`.\n */\n\n/** @public */\nexport type InputKind = \"instruction\" | \"action\" | \"system_event\";\n\n/** @public */\nexport type ProcessInputTarget =\n\t| {\n\t\t\t/** @public */\n\t\t\tsemanticRef: ProcessSemanticEntryRefKey;\n\t\t\t/** @internal */\n\t\t\tproductName?: never;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tproductName: string;\n\t\t\t/** @public */\n\t\t\tsemanticRef?: never;\n\t };\n\n/** @internal */\nexport const WORKER_ERROR_CLASSES = [\n\t\"llm_error\",\n\t\"git_error\",\n\t\"pi_crash\",\n\t\"pipeline_error\",\n\t\"infrastructure\",\n\t\"protocol_error\",\n\t\"operator_abort\",\n] as const;\n\n/** @internal */\nexport type WorkerErrorClass = (typeof WORKER_ERROR_CLASSES)[number];\n\n/** @internal */\nexport function isWorkerErrorClass(value: string): value is WorkerErrorClass {\n\treturn (WORKER_ERROR_CLASSES as readonly string[]).includes(value);\n}\n\n/** @internal */\nexport type TurnFailureCode = \"branch_drift\";\n\n/** @internal */\nexport function isTurnFailureCode(value: string): value is TurnFailureCode {\n\treturn value === \"branch_drift\";\n}\n\n/** Extension-defined stable turn identifier. @public */\nexport type TurnId = string;\n\n/** @internal */\nexport const PROCESS_TURN_TYPES = [\"llm\", \"human\", \"external\", \"automatic\"] as const;\n\n/** @internal */\nexport type ProcessTurnType = (typeof PROCESS_TURN_TYPES)[number];\n\n/** @internal */\nexport interface TurnOutcomePayload {\n\t/** @internal */\n\tresultSummary?: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: ProcessTurnType;\n\t/** @internal */\n\toutcome: string;\n\t/** @internal */\n\tparams: Record<string, unknown>;\n\t/** @internal */\n\tpathType?: ProcessTurnRecordPathType;\n\t/** @internal */\n\tforkPiEntryId?: string | null;\n\t/** @internal */\n\tresultPiEntryId?: string | null;\n\t/** @internal */\n\tturnResultMarkdown?: string | null;\n\t/** @internal */\n\trootEntryId?: string | null;\n\t/** @internal */\n\tstate?: unknown;\n}\n\n/** @internal */\nexport interface TurnFailedPayload {\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: ProcessTurnType;\n\t/** @internal */\n\tpathType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tforkPiEntryId?: string | null;\n\t/** @internal */\n\tresultPiEntryId?: string | null;\n\t/** @internal */\n\terrorSummary: string;\n\t/** @internal */\n\terrorClass?: WorkerErrorClass;\n\t/** @internal */\n\tfailureCode?: TurnFailureCode | null;\n\t/** @internal */\n\tfailureDetails?: Record<string, unknown> | null;\n\t/** @internal */\n\trecoveryContext?: FailedTurnRecoveryContext | null;\n}\n\n/** @public */\nexport type ProcessLifecycleStatus =\n\t| \"discovered\"\n\t| \"active\"\n\t| \"waiting\"\n\t| \"error\"\n\t| \"completed\"\n\t| \"aborted\";\n\n/** @internal */\nexport function isProcessTurnType(value: unknown): value is ProcessTurnType {\n\treturn typeof value === \"string\" && (PROCESS_TURN_TYPES as readonly string[]).includes(value);\n}\n\n/** @internal */\nexport function isWorkerOwnedTurnType(turnType: ProcessTurnType): boolean {\n\treturn turnType === \"llm\" || turnType === \"automatic\";\n}\n\n/** @internal */\nexport function isWaitingTurnType(turnType: ProcessTurnType): boolean {\n\treturn turnType === \"human\" || turnType === \"external\";\n}\n\n/** @internal */\nexport function lifecycleStatusForSelectedTurnType(\n\tturnType: ProcessTurnType,\n): Extract<ProcessLifecycleStatus, \"active\" | \"waiting\"> {\n\treturn isWaitingTurnType(turnType) ? \"waiting\" : \"active\";\n}\n\n/** @internal */\nexport type ProcessSelectedTurnModelSource =\n\t| \"action_override\"\n\t| \"launch_override\"\n\t| \"instance_turn_config\"\n\t| \"process_config_turn\"\n\t| \"instance_default\"\n\t| \"process_config_default\"\n\t| \"catalog_default\"\n\t| \"legacy_persisted\";\n\n/** @internal */\nexport type ModelSelectionKind = \"explicit\" | \"inherited\";\n/** @internal */\nexport type ModelSelectionSource = ProcessSelectedTurnModelSource;\n\n/** Durable intent and resolution path for one effective model selection. @internal */\nexport interface ModelSelectionProvenance {\n\t/** @internal */\n\tkind: ModelSelectionKind;\n\t/** @internal */\n\tsource: ModelSelectionSource;\n}\n\n/** @internal */\nexport interface DurableModelSelection {\n\t/** @internal */\n\tmodelProfileId: string;\n\t/** @internal */\n\tprovenance: ModelSelectionProvenance;\n}\n\n/** @internal */\nexport type ModelPolicyFailureCode =\n\t| \"invalid_model_configuration\"\n\t| \"unknown_model_profile\"\n\t| \"model_profile_not_allowed\"\n\t| \"model_required\"\n\t| \"model_unavailable\"\n\t| \"model_stale\"\n\t| \"stale_evaluation_snapshot\";\n\n/** @internal */\nexport interface FutureExecutionBlockReason {\n\t/** @internal */\n\tcode: ModelPolicyFailureCode;\n\t/** @internal */\n\tselection: DurableModelSelection | null;\n\t/** @internal */\n\tsummary: string;\n\t/** @internal */\n\tdetectedAt: string;\n\t/** Present when the block depends on a runtime availability snapshot. @internal */\n\tavailabilityRevision?: number;\n}\n\n/** JSON object persisted as non-secret turn-start configuration. @internal */\nexport type JsonObject = Record<string, unknown>;\n\n/** The one durable technical execution currently owned by a process. @internal */\nexport type CurrentExecutionRef = {\n\t/** @internal */\n\tkind: \"worker_start\";\n\t/** @internal */\n\tid: string;\n} | null;\n\n/** Immutable non-secret inputs resolved for a worker-owned turn start. @internal */\nexport type ResolvedTurnStart =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"llm\";\n\t\t\t/** @internal */\n\t\t\tmodel: {\n\t\t\t\t/** @internal */\n\t\t\t\tprofileId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tproviderId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tmodelId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tthinkingLevel: string;\n\t\t\t};\n\t\t\t/** Frozen provenance used to resolve this prepared start. @internal */\n\t\t\tmodelSelectionProvenance?: ModelSelectionProvenance;\n\t\t\t/** Status revision evaluated before preparation. Diagnostic only. @internal */\n\t\t\tavailabilityRevision?: number;\n\t\t\t/** @internal */\n\t\t\tproviderOptions: Record<string, string>;\n\t\t\t/** @internal */\n\t\t\tproviderWorkerConfig: {\n\t\t\t\t/** @internal */\n\t\t\t\tversion: number;\n\t\t\t\t/** @internal */\n\t\t\t\tvalue: JsonObject;\n\t\t\t} | null;\n\t\t\t/** @internal */\n\t\t\tpiResourceSnapshotDigest: string;\n\t\t\t/** @internal */\n\t\t\tworkerRuntimeProfileId: string;\n\t\t\t/** @internal */\n\t\t\tpiSettings: JsonObject;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"automatic\";\n\t };\n\n/** @internal */\nexport type TurnStartKind = \"selected_turn\" | \"retry\" | \"continue\" | \"startup_retry\";\n\n/** @internal */\nexport interface TurnStartContinuation {\n\t/** @internal */\n\tcontinueFromPiEntryId: string;\n\t/** @internal */\n\tcontinuePrompt: string;\n\t/** @internal */\n\tsavedPrimaryLeafEntryId: string | null;\n}\n\n/** @internal */\nexport type TurnStartPreparationFailureCode =\n\t| \"invalid_model_configuration\"\n\t| \"model_required\"\n\t| \"model_unavailable\"\n\t| \"model_stale\"\n\t| \"provider_options_required\"\n\t| \"provider_preflight_failed\";\n\n/** @internal */\nexport type TurnStartRecordState =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"preparation_failed\";\n\t\t\t/** @internal */\n\t\t\trequestedModelProfileId: string | null;\n\t\t\t/** @internal */\n\t\t\tproviderOptions: Record<string, string>;\n\t\t\t/** @internal */\n\t\t\tcode: TurnStartPreparationFailureCode;\n\t\t\t/** @internal */\n\t\t\tsafeSummary: string;\n\t\t\t/** @internal */\n\t\t\tmodelSelectionProvenance?: ModelSelectionProvenance;\n\t\t\t/** @internal */\n\t\t\tavailabilityRevision?: number;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"starting\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"bootstrap_failed\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart;\n\t\t\t/** @internal */\n\t\t\tfailedWorkerLeaseId: string | null;\n\t\t\t/** @internal */\n\t\t\tcode: string;\n\t\t\t/** @internal */\n\t\t\tsafeSummary: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"accepted\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart;\n\t\t\t/** @internal */\n\t\t\tturnRecordId: string;\n\t\t\t/** @internal */\n\t\t\tacceptedWorkerLeaseId: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"superseded\";\n\t\t\t/** @internal */\n\t\t\tstart: ResolvedTurnStart | null;\n\t };\n\n/** Durable preparation for a single worker-owned selected turn, not an attempt. @internal */\nexport interface TurnStartRecord {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: Extract<ProcessTurnType, \"llm\" | \"automatic\">;\n\t/** Reserved id used when, and only when, this start is accepted. @internal */\n\tproposedTurnRecordId: string;\n\t/** @internal */\n\tstartKind: TurnStartKind;\n\t/** @internal */\n\trecoveryTurnRecordId: string | null;\n\t/** @internal */\n\tcontinuation: TurnStartContinuation | null;\n\t/** @internal */\n\tstate: TurnStartRecordState;\n\t/** Mapped-turn item this start executes; null for ordinary turns. @internal */\n\titeration?: MappedTurnItemRef | null;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** Identity of one frozen item in a mapped LLM run. @internal */\nexport interface MappedTurnItemRef {\n\t/** @internal */\n\trunId: string;\n\t/** @internal */\n\titemKey: string;\n\t/** Zero-based position in the frozen order. @internal */\n\titemIndex: number;\n}\n\n/** @internal */\nexport type MappedRunStatus = \"active\" | \"completed\" | \"aborted\";\n\n/** Durable bookkeeping for one sequential pass of a mapped LLM turn. @internal */\nexport interface MappedRun {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tturnId: TurnId;\n\t/** @internal */\n\tstatus: MappedRunStatus;\n\t/** @internal */\n\titemCount: number;\n\t/** Index of the item currently executing, or itemCount when all results exist. @internal */\n\tnextIndex: number;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport type MappedItemStatus = \"pending\" | \"completed\";\n\n/** One frozen item of a mapped run and its validated result. @internal */\nexport interface MappedItem {\n\t/** @internal */\n\trunId: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\titemIndex: number;\n\t/** @internal */\n\titemKey: string;\n\t/** @internal */\n\tlabel: string;\n\t/** Codec-serialized item value. @internal */\n\titemJson: string;\n\t/** @internal */\n\tstatus: MappedItemStatus;\n\t/** @internal */\n\toutcome: string | null;\n\t/** Codec-serialized result, set once when the item completes. @internal */\n\tresultJson: string | null;\n\t/** Turn record whose outcome produced the result. @internal */\n\tturnRecordId: string | null;\n\t/** @internal */\n\tcompletedAt: string | null;\n}\n\n/** Tree positioning selected during bootstrap, before a turn is accepted. @internal */\nexport interface PreparedTurnStart {\n\t/** @internal */\n\tpathType: ProcessTurnRecordPathType;\n\t/** Durable authored context mode used to reconcile pre-prompt positioning and compaction. @internal */\n\tcontextMode: LlmContextMode;\n\t/** @internal */\n\tstartTarget: ProcessTurnStartTarget;\n\t/** @internal */\n\tforkPiEntryId: string | null;\n}\n\n/** @internal */\nexport type LlmContextMode = \"full\" | \"compacted\" | \"fresh\" | \"fresh_seeded\";\n\n/** Immutable, lease-correlated proof of successful worker bootstrap. @internal */\nexport type WorkerBootstrapReceipt =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"llm\";\n\t\t\t/** @internal */\n\t\t\tstartRecordId: string;\n\t\t\t/** @internal */\n\t\t\tworkerLeaseId: string;\n\t\t\t/** @internal */\n\t\t\treceiptEpoch: string;\n\t\t\t/** @internal */\n\t\t\tverifiedResourceSnapshotDigest: string;\n\t\t\t/** @internal */\n\t\t\tcredentialRevision: number | null;\n\t\t\t/** @internal */\n\t\t\tloadedResourceIds: string[];\n\t\t\t/** @internal */\n\t\t\tresolvedModel: {\n\t\t\t\t/** @internal */\n\t\t\t\tproviderId: string;\n\t\t\t\t/** @internal */\n\t\t\t\tmodelId: string;\n\t\t\t};\n\t\t\t/** @internal */\n\t\t\tpreparedStart: PreparedTurnStart | null;\n\t\t\t/** @internal */\n\t\t\treadyAt: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"automatic\";\n\t\t\t/** @internal */\n\t\t\tstartRecordId: string;\n\t\t\t/** @internal */\n\t\t\tworkerLeaseId: string;\n\t\t\t/** @internal */\n\t\t\treceiptEpoch: string;\n\t\t\t/** @internal */\n\t\t\treadyAt: string;\n\t };\n\n/** @internal */\nexport const PROCESS_SELECTED_TURN_MODEL_SOURCES = [\n\t\"action_override\",\n\t\"launch_override\",\n\t\"instance_turn_config\",\n\t\"process_config_turn\",\n\t\"instance_default\",\n\t\"process_config_default\",\n\t\"catalog_default\",\n\t\"legacy_persisted\",\n] as const satisfies readonly ProcessSelectedTurnModelSource[];\n\n/** @internal */\nexport function isProcessSelectedTurnModelSource(\n\tvalue: unknown,\n): value is ProcessSelectedTurnModelSource {\n\treturn PROCESS_SELECTED_TURN_MODEL_SOURCES.includes(value as ProcessSelectedTurnModelSource);\n}\n\n/** @public */\nexport interface ProcessCustomizableFields {\n\t/** @internal */\n\ttitle?: string | null;\n\t/** @public */\n\texternalId?: string | null;\n\t/** @internal */\n\texternalUrl?: string | null;\n\t/** @internal */\n\tmetadata?: Record<string, unknown> | null;\n\t/** @internal */\n\tdefaultModelProfileId?: string | null;\n\t/** @internal */\n\tinitialDefaultModelProfileId?: string | null;\n\t/** @internal */\n\tturnConfigsJson?: string | null;\n\t/** @internal */\n\tselectedTurnModelProfileId?: string | null;\n\t/** @internal */\n\tselectedTurnModelKind?: ModelSelectionKind | null;\n\t/** @internal */\n\tselectedTurnModelSource?: ProcessSelectedTurnModelSource | null;\n}\n\n/** @public */\nexport interface ProcessInstance {\n\t/** @public */\n\tid: string;\n\t/** Canonical process identifier from the extension catalog. @public */\n\tprocessId: string;\n\t/** Durable pointer to the currently selected business turn, if any. @public */\n\tselectedTurnId: TurnId | null;\n\t/** High-level lifecycle bucket for scheduling and operator state. @public */\n\tlifecycleStatus: ProcessLifecycleStatus;\n\t/** Single durable technical execution reference; null for waiting/terminal states. @internal */\n\tcurrentExecution: CurrentExecutionRef;\n\t/** @public */\n\tplanRevision: number;\n\t/** Short operator-facing process title used in process lists and related UI. @public */\n\ttitle: string | null;\n\t/** Provider-agnostic external reference, such as a work item key or change path. @public */\n\texternalId: string | null;\n\t/** URL to the external resource, if applicable. @internal */\n\texternalUrl: string | null;\n\t/** Extension-owned JSON metadata blob. @internal */\n\tmetadata: Record<string, unknown> | null;\n\t/** Instance-scoped default model profile used when no turn override applies. @internal */\n\tdefaultModelProfileId?: string | null;\n\t/** Effective default model at creation time, retained for historical inspection. @internal */\n\tinitialDefaultModelProfileId?: string | null;\n\t/** JSON-serialized per-turn runtime config overrides for this instance. @internal */\n\tturnConfigsJson?: string | null;\n\t/** Frozen effective model profile for the currently selected LLM turn, if any. @internal */\n\tselectedTurnModelProfileId?: string | null;\n\t/** Explicit operator intent or inherited policy resolution for the selected model. @internal */\n\tselectedTurnModelKind?: ModelSelectionKind | null;\n\t/** Resolution path that selected `selectedTurnModelProfileId`; null for empty selections. @internal */\n\tselectedTurnModelSource?: ProcessSelectedTurnModelSource | null;\n\t/** JSON-serialized process params. @public */\n\tparamsJson: string | null;\n\t/** JSON-serialized process state. @public */\n\tstateJson: string | null;\n\t/** @public */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n\t/** Set once when the process first reaches a terminal lifecycle status. @internal */\n\tclosedAt?: string | null;\n}\n\n/** @public */\nexport interface ProcessProject {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tinstanceId: string;\n\t/** @public */\n\tkey: string;\n\t/** Repository source identifier. May be a remote URL or a local filesystem path. @public */\n\trepoLocator: string;\n\t/** @internal */\n\trepoLocatorKind: RepoLocatorKind;\n\t/** @internal */\n\tbaseBranch: string;\n\t/** @internal */\n\tworkBranch: string | null;\n\t/** Provider-agnostic external identifier (e.g. MR IID, PR number). @internal */\n\texternalId: string | null;\n\t/** URL to the external resource (e.g. MR URL, PR URL). @internal */\n\texternalUrl: string | null;\n\t/** Extension-owned JSON metadata blob. @public */\n\tmetadata: Record<string, unknown> | null;\n\t/** @internal */\n\tpipelineStatus: string | null;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport interface ProcessInput {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tsequence: number;\n\t/** @internal */\n\tsource: InputSource;\n\t/** @internal */\n\tkind: InputKind;\n\t/** @internal */\n\ttarget: ProcessInputTarget | null;\n\t/** @internal */\n\tbodyMarkdown: string;\n\t/** Stable principal that queued this input. Defaults to `SYSTEM_ACTOR`. @internal */\n\tactor: Actor;\n\t/** @internal */\n\treceivedAt: string;\n\t/** @internal */\n\tconsumedAt: string | null;\n}\n\n/** @internal */\nexport type LaunchOrigin = \"ui\" | \"programmatic\" | \"watcher\" | \"scheduled\" | \"startup_retry\";\n/** @internal */\nexport type LaunchRunStatus =\n\t| \"preparing\"\n\t| \"process_created\"\n\t| \"starting\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"cancelled\";\n/** @internal */\nexport type LaunchChecklistStepStatus =\n\t| \"pending\"\n\t| \"in_progress\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"skipped\";\n\n/** Presentation-safe durable progress for one process launch attempt. @internal */\nexport interface LaunchChecklistStep {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tlabel: string;\n\t/** @internal */\n\tstatus: LaunchChecklistStepStatus;\n\t/** @internal */\n\tsafeSummary?: string;\n\t/** @internal */\n\tstartedAt?: string;\n\t/** @internal */\n\tcompletedAt?: string;\n}\n\n/** Durable launch attempt. Secrets and runner identifiers never belong here. @internal */\nexport interface LaunchRun {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tlauncherId: string | null;\n\t/** @internal */\n\torigin: LaunchOrigin;\n\t/** @internal */\n\tinstanceId: string | null;\n\t/** @internal */\n\tstatus: LaunchRunStatus;\n\t/** @internal */\n\tsteps: LaunchChecklistStep[];\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n\t/** @internal */\n\tcompletedAt: string | null;\n\t/** @internal */\n\trevision: number;\n}\n\n/** @internal */\nexport type FutureExecutionKind = \"launch\" | \"action\";\n/** @internal */\nexport type FutureExecutionScheduleKind = \"once\" | \"cron\";\n\n/** @internal */\nexport interface FutureExecution {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tkind: FutureExecutionKind;\n\t/** @internal */\n\tscheduleKind: FutureExecutionScheduleKind;\n\t/** Canonical target process identifier. @internal */\n\tprocessId: string;\n\t/** Populated only for scheduled actions on an existing process instance. @internal */\n\tinstanceId: string | null;\n\t/** @internal */\n\tlauncherId: string | null;\n\t/** @internal */\n\tactionId: string | null;\n\t/** JSON-serialized kind-specific payload. @internal */\n\tpayloadJson: string;\n\t/** @internal */\n\tcronExpression: string | null;\n\t/** @internal */\n\tnextRunAt: string;\n\t/** Immediate LLM selection caused by this execution, if known. @internal */\n\tmodelSelection?: DurableModelSelection | null;\n\t/** Structured model-policy block. Blocked rows remain durable. @internal */\n\tblockedReason?: FutureExecutionBlockReason | null;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport interface ProcessEvent {\n\t/** Persisted ingestion order. Absent only on legacy in-memory fixtures. @internal */\n\teventSequence?: number;\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\teventType: string;\n\t/** @internal */\n\tdata: Record<string, unknown>;\n\t/** @internal */\n\tcreatedAt: string;\n}\n\n/** @internal */\nexport type ProcessLeafOutcomeSnapshotStatus = \"ready\" | \"capture_error\";\n\n/** @internal */\nexport interface ProcessLeafOutcomeSnapshot {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tleafEntryId: string;\n\t/** @internal */\n\tturnRecordId: string | null;\n\t/** @internal */\n\trendererId: string | null;\n\t/** @internal */\n\tschemaVersion: number | null;\n\t/** @internal */\n\tprops: Record<string, unknown> | null;\n\t/** @internal */\n\tfallbackMarkdown: string | null;\n\t/** @internal */\n\tstatus: ProcessLeafOutcomeSnapshotStatus;\n\t/** @internal */\n\twarningCode: string | null;\n\t/** @internal */\n\twarningMessage: string | null;\n\t/** @internal */\n\tanchoredAt: string;\n\t/** @internal */\n\tcreatedAt: string;\n}\n\n/** @public */\nexport type ProcessTurnRecordStatus = \"running\" | \"succeeded\" | \"failed\" | \"superseded\";\n\n/** @public */\nexport type TurnProgressStepStatus = \"incomplete\" | \"in_progress\" | \"completed\" | \"failed\";\n\n/** @public */\nexport interface TurnProgressStep {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tlabel: string;\n\t/** @public */\n\tstatus: TurnProgressStepStatus;\n\t/** @public */\n\tdetail?: string | null;\n}\n\n/** @public */\nexport interface TurnProgressLink {\n\t/** @public */\n\tid: string;\n\t/** @public */\n\tlabel: string;\n\t/** @public */\n\turl: string;\n\t/** @public */\n\tkind?: \"pull_request\" | \"merge_request\" | \"commit\" | \"pipeline\" | \"other\";\n}\n\n/** A complete operator-facing snapshot. Reporters replace, rather than patch, this value. @public */\nexport interface TurnProgressReport {\n\t/** @public */\n\ttitle: string;\n\t/** Attempt-specific progress or waiting explanation; not an operation receipt. @public */\n\tsummary?: string;\n\t/** @public */\n\tsteps: TurnProgressStep[];\n\t/** @public */\n\tlinks?: TurnProgressLink[];\n}\n\n/**\n * Structural tree position for a turn record.\n * - `primary`: continue the primary path from the current leaf\n * - `root_branch`: start from the implicit session root with no prior Pi entry context\n * - `leaf_branch`: fork from the current leaf as a side path\n */\n/** @public */\nexport const PROCESS_TURN_RECORD_PATH_TYPES = [\"primary\", \"root_branch\", \"leaf_branch\"] as const;\n\n/** @public */\nexport type ProcessTurnRecordPathType = (typeof PROCESS_TURN_RECORD_PATH_TYPES)[number];\n\n/** @public */\nexport interface ProcessTurnRecord {\n\t/** @public */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @public */\n\tturnId: TurnId;\n\t/** @internal */\n\tturnType: ProcessTurnType;\n\t/** @public */\n\tstatus: ProcessTurnRecordStatus;\n\t/** @internal */\n\tattemptNumber: number;\n\t/** @internal */\n\tparentTurnRecordId: string | null;\n\t/** @internal */\n\tpathType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tforkPiEntryId: string | null;\n\t/** Accepted worker-start preparation that created this worker-owned record. @internal */\n\tturnStartRecordId?: string | null;\n\t/** Lease whose receipt first authorized this worker-owned record. @internal */\n\tacceptedWorkerLeaseId?: string | null;\n\t/** @internal */\n\tresultPiEntryId: string | null;\n\t/** @internal */\n\tmodelProfileId: string | null;\n\t/** @internal */\n\tmodelSelectionProvenance?: ModelSelectionProvenance | null;\n\t/** Mapped-turn item this record executed; retries keep the same item. @internal */\n\titeration?: MappedTurnItemRef | null;\n\t/** @internal */\n\tturnResultMarkdown: string | null;\n\t/** @public */\n\terrorSummary: string | null;\n\t/** @internal */\n\terrorClass: WorkerErrorClass | null;\n\t/** @internal */\n\tstartedAt: string;\n\t/** @internal */\n\tendedAt: string | null;\n}\n\n/** @internal */\nexport interface WorkerLease {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tworkerId: string;\n\t/** Worker start this physical lease was created to execute. @internal */\n\tturnStartRecordId?: string | null;\n\t/** Durable server-owned supervision state for the current worker lease. @internal */\n\tstate: WorkerState;\n\t/** Server epoch this lease belongs to, used to reject stale snapshot writes. @internal */\n\tserverEpoch?: string | null;\n\t/** Hash of the lease-scoped WebSocket connect token. The raw token is never stored. @internal */\n\tconnectTokenHash?: string | null;\n\t/** Hash of the lease-scoped HTTP session-snapshot credential. The raw token is never stored. @internal */\n\tsnapshotTokenHash?: string | null;\n\t/** Fingerprint of the effective instance model policy/config snapshot used to start this worker. @internal */\n\tmodelPolicyFingerprint?: string | null;\n\t/** First valid lease-correlated bootstrap receipt; written once by the server. @internal */\n\tbootstrapReceipt?: WorkerBootstrapReceipt | null;\n\t/** Updated from heartbeats for liveness/recovery diagnostics. @internal */\n\tlastHeartbeatAt: string | null;\n\t/** @internal */\n\tstartedAt: string;\n\t/** First valid server-observed worker handshake. @internal */\n\tconnectedAt?: string | null;\n\t/** First valid server-observed workspace preparation progress. @internal */\n\tworkspacePreparationStartedAt?: string | null;\n\t/** First accepted server-observed worker readiness. @internal */\n\treadyAt?: string | null;\n\t/** Set once the lease is no longer active for supervision. @internal */\n\texitedAt: string | null;\n}\n\n/**\n * Durable worker lease states owned by the server.\n * `absent` is conceptual in lifecycle logic and usually represented by\n * the absence of an active lease row.\n */\n/** @internal */\nexport type WorkerState =\n\t| \"absent\"\n\t| \"spawning\"\n\t| \"bootstrapping\"\n\t| \"idle\"\n\t| \"busy\"\n\t| \"draining\"\n\t| \"failed\"\n\t| \"cleanup\"\n\t| \"exited\";\n\n/**\n * External write type identifier. Extensions define their own write types\n * as plain strings (e.g. \"tracker.approved_plan_comment\", \"code_host.create_change\").\n */\n/** @public */\nexport type ExternalWriteType = string;\n\n/** @public */\nexport interface ExternalWriteLog {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @public */\n\twriteType: ExternalWriteType;\n\t/** @internal */\n\tdedupKey: string;\n\t/** @internal */\n\tcompletedAt: string;\n\t/** @internal */\n\tmetadata: Record<string, unknown>;\n}\n\n/**\n * Returns a human-readable, operator-facing label for the structural path\n * position of a turn record. These labels avoid internal domain terms such\n * as \"primary\" or \"root_branch\" in favour of plain descriptions of what the\n * turn is doing relative to the main path.\n */\n/** @internal */\nexport function formatPathTypeLabel(pathType: ProcessTurnRecordPathType): string {\n\tswitch (pathType) {\n\t\tcase \"primary\":\n\t\t\treturn \"Continuing the main path\";\n\t\tcase \"root_branch\":\n\t\t\treturn \"Starting from the beginning\";\n\t\tcase \"leaf_branch\":\n\t\t\treturn \"Exploring an alternative\";\n\t\tdefault:\n\t\t\treturn \"Path\";\n\t}\n}\n","import { type Actor, type ActorKind, SYSTEM_ACTOR } from \"./domain-model.js\";\nimport { trimToNull } from \"./string-normalize.js\";\n\nconst ACTOR_KINDS: readonly ActorKind[] = [\"user\", \"channel\", \"system\"];\nfunction isActorKind(value: unknown): value is ActorKind {\n\treturn typeof value === \"string\" && (ACTOR_KINDS as readonly string[]).includes(value);\n}\n\n/**\n * Builds a validated `Actor`, dropping unknown fields and falling back to\n * defaults for invalid kind/provider. Returns `null` when no stable id is\n * present so callers can decide on a fallback actor.\n */\n/** @internal */\nexport function normalizeActor(value: unknown): Actor | null {\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn null;\n\t}\n\tconst candidate = value as Record<string, unknown>;\n\tconst id = trimToNull(candidate.id);\n\tif (!id) {\n\t\treturn null;\n\t}\n\tconst kind = isActorKind(candidate.kind) ? candidate.kind : \"system\";\n\tconst displayName =\n\t\ttypeof candidate.displayName === \"string\" && candidate.displayName.trim() !== \"\"\n\t\t\t? candidate.displayName\n\t\t\t: undefined;\n\treturn {\n\t\tid,\n\t\tkind,\n\t\tprovider: trimToNull(candidate.provider),\n\t\t...(displayName !== undefined ? { displayName } : {}),\n\t};\n}\n\n/** Serializes an `Actor` to a stable JSON string for durable storage. @internal */\nexport function serializeActor(actor: Actor): string {\n\treturn JSON.stringify({\n\t\tid: actor.id,\n\t\tkind: actor.kind,\n\t\tprovider: actor.provider,\n\t\t...(actor.displayName !== undefined ? { displayName: actor.displayName } : {}),\n\t});\n}\n\n/**\n * Parses a durable actor JSON value, falling back to `SYSTEM_ACTOR` when the\n * stored value is missing or malformed. Used when reading legacy rows that\n * predate actor attribution.\n */\n/** @internal */\nexport function parseActorOrSystem(value: string | null | undefined): Actor {\n\tif (value === null || value === undefined || value.trim() === \"\") {\n\t\treturn SYSTEM_ACTOR;\n\t}\n\ttry {\n\t\treturn normalizeActor(JSON.parse(value)) ?? SYSTEM_ACTOR;\n\t} catch {\n\t\treturn SYSTEM_ACTOR;\n\t}\n}\n\n/** Canonical serialized form of `SYSTEM_ACTOR`, used as the durable default. @internal */\nexport const SERIALIZED_SYSTEM_ACTOR = serializeActor(SYSTEM_ACTOR);\n","/** @internal */\nexport const DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT = 5;\n\nfunction hasCredentialBearingAbsoluteUrl(value: string): boolean {\n\tif (!/^[a-z][a-z0-9+.-]*:\\/\\//i.test(value)) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn url.protocol !== \"file:\" && (url.username !== \"\" || url.password !== \"\");\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * Strip any embedded credentials (`user:pass@`) from an absolute non-`file:` URL,\n * returning the value unchanged when it is not such a URL.\n */\n/** @internal */\nexport function redactCredentialBearingAbsoluteUrl(value: string): string {\n\tif (!hasCredentialBearingAbsoluteUrl(value)) {\n\t\treturn value;\n\t}\n\tconst url = new URL(value);\n\turl.username = \"\";\n\turl.password = \"\";\n\treturn url.toString();\n}\n\n/** @internal */\nexport function normalizeLauncherRecentValue(value: unknown): string | null {\n\tconst normalizedValue = typeof value === \"string\" ? value.trim() : \"\";\n\tif (!normalizedValue || hasCredentialBearingAbsoluteUrl(normalizedValue)) {\n\t\treturn null;\n\t}\n\treturn normalizedValue;\n}\n\n/** @internal */\nexport function normalizeLauncherRecentValues(\n\tvalues: readonly unknown[],\n\tlimit = DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT,\n): string[] {\n\tconst nextValues = new Set<string>();\n\tfor (const value of values) {\n\t\tconst normalizedValue = normalizeLauncherRecentValue(value);\n\t\tif (!normalizedValue || nextValues.has(normalizedValue)) {\n\t\t\tcontinue;\n\t\t}\n\t\tnextValues.add(normalizedValue);\n\t\tif (nextValues.size >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn [...nextValues];\n}\n\n/** @internal */\nexport function addLauncherRecentValue(\n\texistingValues: readonly string[],\n\tvalue: string,\n\tlimit = DEFAULT_LAUNCHER_RECENT_VALUE_LIMIT,\n): string[] {\n\tconst normalizedValue = normalizeLauncherRecentValue(value);\n\tif (!normalizedValue) {\n\t\treturn normalizeLauncherRecentValues(existingValues, limit);\n\t}\n\treturn normalizeLauncherRecentValues([normalizedValue, ...existingValues], limit);\n}\n","/** @internal */\nexport function normalizeMarkdownLineEndings(markdown: string): string {\n\treturn markdown.replace(/\\r\\n?/g, \"\\n\");\n}\n\n/** @internal */\nexport function normalizeMarkdownText(markdown: string): string {\n\treturn normalizeMarkdownLineEndings(markdown).trim();\n}\n\n/** @internal */\nexport function normalizeOptionalMarkdown(value: unknown): string | null {\n\tif (typeof value !== \"string\") {\n\t\treturn null;\n\t}\n\tconst normalized = normalizeMarkdownText(value);\n\treturn normalized === \"\" ? null : normalized;\n}\n","/** Accept finite numbers and non-blank numeric strings, without coercing other values. @internal */\nexport function readFiniteNumber(value: unknown): number | null {\n\tif (typeof value === \"number\" && Number.isFinite(value)) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"string\" && value.trim() !== \"\") {\n\t\tconst parsed = Number(value);\n\t\treturn Number.isFinite(parsed) ? parsed : null;\n\t}\n\treturn null;\n}\n","import * as v from \"valibot\";\nimport { trimToNull } from \"./string-normalize.js\";\n\n/** @internal */\nexport interface InstanceTurnConfigInput {\n\t/** @internal */\n\tmodelProfileId?: string | null;\n}\n\n/** @internal */\nexport type InstanceTurnConfigMap = Record<string, InstanceTurnConfigInput>;\n\n/** @public */\nexport interface LaunchModelConfigInput {\n\t/** @internal */\n\tdefaultModelProfileId?: string | null;\n\t/** @internal */\n\tturnConfigs?: InstanceTurnConfigMap;\n}\n\n/** @internal */\nexport interface InstanceTurnConfigsJsonError {\n\t/** @internal */\n\tcode: \"invalid_turn_configs_json\";\n\t/** @internal */\n\tprocessId: string;\n\t/** @internal */\n\treason: \"invalid_json\" | \"not_object\" | \"turn_config_not_object\";\n\t/** @internal */\n\tturnId?: string;\n}\n\nconst jsonObjectSchema = v.custom<Record<string, unknown>>(\n\t(value): value is Record<string, unknown> =>\n\t\ttypeof value === \"object\" && value !== null && !Array.isArray(value),\n\t\"Expected object\",\n);\n\nconst instanceTurnConfigSchema = v.pipe(\n\tjsonObjectSchema,\n\tv.object({\n\t\tmodelProfileId: v.optional(v.unknown()),\n\t}),\n);\n\nconst strictInstanceTurnConfigsJsonSchema = v.pipe(\n\tv.string(),\n\tv.parseJson(),\n\tjsonObjectSchema,\n\tv.record(v.string(), instanceTurnConfigSchema),\n);\n\nfunction normalizeInstanceTurnConfigs(\n\tturnConfigs: Record<string, { modelProfileId?: unknown }>,\n): InstanceTurnConfigMap {\n\tconst next: InstanceTurnConfigMap = {};\n\tfor (const [turnId, turnConfig] of Object.entries(turnConfigs)) {\n\t\tconst modelProfileId = trimToNull(turnConfig.modelProfileId);\n\t\tnext[turnId] = modelProfileId ? { modelProfileId } : {};\n\t}\n\treturn next;\n}\n\nfunction getFirstIssuePathKey(issue: v.BaseIssue<unknown>): string | undefined {\n\tconst pathItem = issue.path?.[0] as { key?: unknown } | undefined;\n\treturn typeof pathItem?.key === \"string\" ? pathItem.key : undefined;\n}\n\n/** @internal */\nexport function parseStrictInstanceTurnConfigsJson(\n\tprocessId: string,\n\tturnConfigsJson: string | null | undefined,\n):\n\t| {\n\t\t\t/** @internal */\n\t\t\tok: true;\n\t\t\t/** @internal */\n\t\t\tvalue: InstanceTurnConfigMap;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tok: false;\n\t\t\t/** @internal */\n\t\t\terror: InstanceTurnConfigsJsonError;\n\t } {\n\tif (!turnConfigsJson) return { ok: true, value: {} };\n\tconst result = v.safeParse(strictInstanceTurnConfigsJsonSchema, turnConfigsJson, {\n\t\tabortEarly: true,\n\t});\n\tif (!result.success) {\n\t\tconst issue = result.issues[0];\n\t\tif (issue?.type === \"parse_json\") {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terror: { code: \"invalid_turn_configs_json\", processId, reason: \"invalid_json\" },\n\t\t\t};\n\t\t}\n\t\tconst turnId = issue ? getFirstIssuePathKey(issue) : undefined;\n\t\treturn {\n\t\t\tok: false,\n\t\t\terror: {\n\t\t\t\tcode: \"invalid_turn_configs_json\",\n\t\t\t\tprocessId,\n\t\t\t\treason: turnId !== undefined ? \"turn_config_not_object\" : \"not_object\",\n\t\t\t\t...(turnId !== undefined ? { turnId } : {}),\n\t\t\t},\n\t\t};\n\t}\n\treturn { ok: true, value: normalizeInstanceTurnConfigs(result.output) };\n}\n\n/** @internal */\nexport function serializeInstanceTurnConfigs(turnConfigs: InstanceTurnConfigMap): string | null {\n\tconst normalizedEntries = Object.entries(turnConfigs)\n\t\t.map(([turnId, turnConfig]) => {\n\t\t\tconst modelProfileId = trimToNull(turnConfig.modelProfileId);\n\t\t\treturn [turnId, modelProfileId ? { modelProfileId } : {}] as const;\n\t\t})\n\t\t.filter(([, turnConfig]) => Object.keys(turnConfig).length > 0);\n\treturn normalizedEntries.length === 0\n\t\t? null\n\t\t: JSON.stringify(Object.fromEntries(normalizedEntries));\n}\n\n/** @internal */\nexport function normalizeLaunchModelConfigInput(\n\tinput: LaunchModelConfigInput,\n): LaunchModelConfigInput {\n\tconst defaultModelProfileId = trimToNull(input.defaultModelProfileId);\n\tconst nextTurnConfigs: InstanceTurnConfigMap = {};\n\tfor (const [turnId, turnConfig] of Object.entries(input.turnConfigs ?? {})) {\n\t\tconst modelProfileId = trimToNull(turnConfig.modelProfileId);\n\t\tif (modelProfileId) nextTurnConfigs[turnId] = { modelProfileId };\n\t}\n\treturn { defaultModelProfileId, turnConfigs: nextTurnConfigs };\n}\n","import type { ProcessInstance, ProcessLifecycleStatus, ProcessProject } from \"./domain-model.js\";\n\n/** @internal */\nexport interface ProcessRowSlot {\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tprocessId: string;\n\t/** @internal */\n\ttitle: string;\n\t/** @internal */\n\tsubtitle: string;\n\t/** @internal */\n\tselectedTurnId: string | null;\n\t/** @internal */\n\tlifecycleStatus: ProcessLifecycleStatus;\n\t/** @internal */\n\tstatusCategory: \"error\" | \"active\" | \"waiting\" | \"terminal\" | \"discovered\";\n\t/** @internal */\n\tprojectCount: number;\n\t/** @internal */\n\texternalId: string | null;\n\t/** @internal */\n\texternalLinkCount: number;\n}\n\n/** @internal */\nexport function getProcessStatusCategory(\n\tlifecycleStatus: ProcessLifecycleStatus,\n): ProcessRowSlot[\"statusCategory\"] {\n\tif (lifecycleStatus === \"error\") return \"error\";\n\tif (lifecycleStatus === \"active\") return \"active\";\n\tif (lifecycleStatus === \"waiting\") return \"waiting\";\n\tif (lifecycleStatus === \"completed\" || lifecycleStatus === \"aborted\") return \"terminal\";\n\treturn \"discovered\";\n}\n\n/** @internal */\nexport function buildProcessRowSlot(\n\tprocess: ProcessInstance,\n\tprojects: ReadonlyArray<ProcessProject>,\n): ProcessRowSlot {\n\tconst externalLinkCount = projects.filter((p) => p.externalId !== null).length;\n\n\tconst title = process.title ?? process.externalId ?? process.id;\n\tconst subtitle = `${process.processId} \\u00b7 ${projects.length} component${projects.length !== 1 ? \"s\" : \"\"}`;\n\n\treturn {\n\t\tinstanceId: process.id,\n\t\tprocessId: process.processId,\n\t\ttitle,\n\t\tsubtitle,\n\t\tselectedTurnId: process.selectedTurnId,\n\t\tlifecycleStatus: process.lifecycleStatus,\n\t\tstatusCategory: getProcessStatusCategory(process.lifecycleStatus),\n\t\tprojectCount: projects.length,\n\t\texternalId: process.externalId,\n\t\texternalLinkCount,\n\t};\n}\n\n/** @internal */\nexport function sortProcessRows(rows: ProcessRowSlot[]): ProcessRowSlot[] {\n\tconst categoryOrder: Record<string, number> = {\n\t\terror: 0,\n\t\tactive: 1,\n\t\twaiting: 2,\n\t\tdiscovered: 3,\n\t\tterminal: 4,\n\t};\n\n\treturn [...rows].sort((a, b) => {\n\t\tconst catA = categoryOrder[a.statusCategory] ?? 4;\n\t\tconst catB = categoryOrder[b.statusCategory] ?? 4;\n\t\tif (catA !== catB) return catA - catB;\n\t\treturn a.title.localeCompare(b.title);\n\t});\n}\n","import * as v from \"valibot\";\n\n/** Parse non-array objects into a fresh record using Valibot's key handling. @internal */\nexport const copiedUnknownRecordSchema = v.pipe(\n\tv.unknown(),\n\tv.check(isUnknownRecord, \"Expected object\"),\n\tv.record(v.string(), v.unknown()),\n);\n\n/** @internal */\nexport function isUnknownRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** @internal */\nexport function asUnknownRecord(value: unknown): Record<string, unknown> | null {\n\treturn isUnknownRecord(value) ? value : null;\n}\n","import { trimToNull } from \"./string-normalize.js\";\nimport { asUnknownRecord, isUnknownRecord } from \"./unknown-record.js\";\n\n/** @public */\nexport const PROCESS_SEMANTIC_ENTRY_REF_KEYS = [\n\t\"plan\",\n\t\"review\",\n\t\"currentPrimaryPathLeaf\",\n\t\"rootEntry\",\n] as const;\n\n/** @public */\nexport type ProcessSemanticEntryRefKey = (typeof PROCESS_SEMANTIC_ENTRY_REF_KEYS)[number];\n\n/** @internal */\nexport interface SemanticEntryRef {\n\t/** @internal */\n\tentryId: string;\n\t/** @internal */\n\tturnRecordId: string | null;\n}\n\n/** @internal */\nexport function areSemanticEntryRefsEqual(\n\tleft: SemanticEntryRef | null | undefined,\n\tright: SemanticEntryRef | null | undefined,\n): boolean {\n\treturn (\n\t\t(left?.entryId ?? null) === (right?.entryId ?? null) &&\n\t\t(left?.turnRecordId ?? null) === (right?.turnRecordId ?? null)\n\t);\n}\n\n/** @internal */\nexport type ProcessProductRef = SemanticEntryRef;\n/** @internal */\nexport type ProcessProductRefs = Record<string, ProcessProductRef>;\n\nconst PRODUCT_NAME_PATTERN = /^[a-z][a-z0-9-]*$/;\n\n/** @internal */\nexport function isValidProcessProductName(value: string): boolean {\n\treturn PRODUCT_NAME_PATTERN.test(value);\n}\n\n/** @internal */\nexport function assertValidProcessProductName(value: string): void {\n\tif (!isValidProcessProductName(value)) {\n\t\tthrow new Error(\n\t\t\t`Invalid process product name '${value}'. Product names must match ${PRODUCT_NAME_PATTERN.source}`,\n\t\t);\n\t}\n}\n\n/**\n * Stage 2 keeps these refs as structural placeholders initialized to `null`.\n * Current runtime population:\n * - `rootEntry` during worker bootstrap and subsequent worker tree-fact reporting\n * - `currentPrimaryPathLeaf` during worker bootstrap, successful primary turns,\n * and prompt-style primary-path input delivery\n * - `plan` during successful planning turns; it remains the current plan through\n * implementation until another planning turn replaces it\n * - `review` during successful review turns; it remains the current review until\n * another review turn replaces it\n */\n/** @internal */\nexport interface ProcessSemanticEntryRefs {\n\t/** @internal */\n\tplan: SemanticEntryRef | null;\n\t/** @internal */\n\treview: SemanticEntryRef | null;\n\t/** @internal */\n\tcurrentPrimaryPathLeaf: SemanticEntryRef | null;\n\t/** @internal */\n\trootEntry: SemanticEntryRef | null;\n}\n\n/** @internal */\nexport function isProcessSemanticEntryRefKey(value: string): value is ProcessSemanticEntryRefKey {\n\treturn (PROCESS_SEMANTIC_ENTRY_REF_KEYS as readonly string[]).includes(value);\n}\n\n/** @internal */\nexport function parseSemanticEntryRef(value: unknown): SemanticEntryRef | null {\n\tconst record = asUnknownRecord(value);\n\tconst entryId = trimToNull(record?.entryId);\n\tif (!entryId) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tentryId,\n\t\tturnRecordId: trimToNull(record?.turnRecordId),\n\t};\n}\n\n/** @internal */\nexport function createEmptyProcessSemanticEntryRefs(): ProcessSemanticEntryRefs {\n\treturn {\n\t\tplan: null,\n\t\treview: null,\n\t\tcurrentPrimaryPathLeaf: null,\n\t\trootEntry: null,\n\t};\n}\n\n/** @internal */\nexport function createEmptyProcessProductRefs(): ProcessProductRefs {\n\treturn {};\n}\n\n/** @internal */\nexport function parseProcessProductRefs(value: unknown): ProcessProductRefs {\n\tif (!isUnknownRecord(value)) return createEmptyProcessProductRefs();\n\tconst refs: ProcessProductRefs = {};\n\tfor (const [name, rawRef] of Object.entries(value)) {\n\t\tif (!isValidProcessProductName(name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst ref = parseSemanticEntryRef(rawRef);\n\t\tif (ref) {\n\t\t\trefs[name] = ref;\n\t\t}\n\t}\n\treturn refs;\n}\n\n/** @internal */\nexport function parseProcessSemanticEntryRefs(value: unknown): ProcessSemanticEntryRefs {\n\tconst record = asUnknownRecord(value) ?? {};\n\treturn {\n\t\tplan: parseSemanticEntryRef(record.plan),\n\t\treview: parseSemanticEntryRef(record.review),\n\t\tcurrentPrimaryPathLeaf: parseSemanticEntryRef(record.currentPrimaryPathLeaf),\n\t\trootEntry: parseSemanticEntryRef(record.rootEntry),\n\t};\n}\n","import {\n\tcreateEmptyProcessProductRefs,\n\tcreateEmptyProcessSemanticEntryRefs,\n\tisValidProcessProductName,\n\ttype ProcessProductRefs,\n\ttype ProcessSemanticEntryRefs,\n\tparseProcessSemanticEntryRefs,\n\tparseSemanticEntryRef,\n} from \"./semantic-entry-refs.js\";\n\n/** @internal */\nexport interface ProcessStateJsonParseContext {\n\t/** @internal */\n\tlabel?: string;\n\t/** @internal */\n\tprocessId?: string;\n}\n\nfunction formatMalformedSubject(\n\tdefaultLabel: string,\n\tcontext: string | ProcessStateJsonParseContext | undefined,\n): string {\n\tif (typeof context === \"string\") {\n\t\treturn context;\n\t}\n\tconst label = context?.label ?? defaultLabel;\n\treturn context?.processId ? `${label} for process '${context.processId}'` : label;\n}\n\n/** @internal */\nexport function parseProcessStateJsonStrict(\n\tstateJson: string | null | undefined,\n\tcontext?: string | ProcessStateJsonParseContext,\n): Record<string, unknown> {\n\tif (!stateJson) {\n\t\treturn {};\n\t}\n\tconst subject = formatMalformedSubject(\"stateJson\", context);\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(stateJson);\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Malformed ${subject}: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n\t\tthrow new Error(`Malformed ${subject}: expected a JSON object`);\n\t}\n\treturn parsed as Record<string, unknown>;\n}\n\n/** @internal */\nexport function parseProcessStateJsonLenient(\n\tstateJson: string | null | undefined,\n): Record<string, unknown> {\n\ttry {\n\t\treturn parseProcessStateJsonStrict(stateJson);\n\t} catch {\n\t\treturn {};\n\t}\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsStrict(\n\tvalue: unknown,\n\tcontext?: ProcessStateJsonParseContext,\n): ProcessSemanticEntryRefs {\n\tif (value === undefined) {\n\t\treturn createEmptyProcessSemanticEntryRefs();\n\t}\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(\n\t\t\t`Malformed ${formatMalformedSubject(\"semanticEntryRefs\", {\n\t\t\t\tlabel: \"semanticEntryRefs\",\n\t\t\t\tprocessId: context?.processId,\n\t\t\t})}: expected an object when present`,\n\t\t);\n\t}\n\treturn parseProcessSemanticEntryRefs(value);\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsLenient(value: unknown): ProcessSemanticEntryRefs {\n\ttry {\n\t\treturn parseSemanticEntryRefsStrict(value);\n\t} catch {\n\t\treturn createEmptyProcessSemanticEntryRefs();\n\t}\n}\n\n/** @internal */\nexport function parseProductRefsStrict(\n\tvalue: unknown,\n\tcontext?: ProcessStateJsonParseContext,\n): ProcessProductRefs {\n\tif (value === undefined) {\n\t\treturn createEmptyProcessProductRefs();\n\t}\n\tconst subject = formatMalformedSubject(\"productRefs\", {\n\t\tlabel: \"productRefs\",\n\t\tprocessId: context?.processId,\n\t});\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(`Malformed ${subject}: expected an object when present`);\n\t}\n\tconst refs: ProcessProductRefs = {};\n\tfor (const [name, rawRef] of Object.entries(value as Record<string, unknown>)) {\n\t\tif (!isValidProcessProductName(name)) {\n\t\t\tthrow new Error(`Malformed ${subject}: invalid product name '${name}'`);\n\t\t}\n\t\tconst ref = parseSemanticEntryRef(rawRef);\n\t\tif (!ref) {\n\t\t\tthrow new Error(`Malformed ${subject}: product '${name}' must reference an entry`);\n\t\t}\n\t\trefs[name] = ref;\n\t}\n\treturn refs;\n}\n\n/** @internal */\nexport function parseProductRefsLenient(value: unknown): ProcessProductRefs {\n\ttry {\n\t\treturn parseProductRefsStrict(value);\n\t} catch {\n\t\treturn createEmptyProcessProductRefs();\n\t}\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsFromStateJsonStrict(\n\tstateJson: string | null | undefined,\n\tcontext?: string | ProcessStateJsonParseContext,\n): ProcessSemanticEntryRefs {\n\tconst stateRecord = parseProcessStateJsonStrict(stateJson, context);\n\treturn parseSemanticEntryRefsStrict(\n\t\tstateRecord.semanticEntryRefs,\n\t\ttypeof context === \"string\" ? undefined : context,\n\t);\n}\n\n/** @internal */\nexport function parseSemanticEntryRefsFromStateJsonLenient(\n\tstateJson: string | null | undefined,\n): ProcessSemanticEntryRefs {\n\tconst stateRecord = parseProcessStateJsonLenient(stateJson);\n\treturn parseSemanticEntryRefsLenient(stateRecord.semanticEntryRefs);\n}\n\n/** @internal */\nexport function parseProductRefsFromStateJsonStrict(\n\tstateJson: string | null | undefined,\n\tcontext?: string | ProcessStateJsonParseContext,\n): ProcessProductRefs {\n\tconst stateRecord = parseProcessStateJsonStrict(stateJson, context);\n\treturn parseProductRefsStrict(\n\t\tstateRecord.productRefs,\n\t\ttypeof context === \"string\" ? undefined : context,\n\t);\n}\n\n/** @internal */\nexport function parseProductRefsFromStateJsonLenient(\n\tstateJson: string | null | undefined,\n): ProcessProductRefs {\n\tconst stateRecord = parseProcessStateJsonLenient(stateJson);\n\treturn parseProductRefsLenient(stateRecord.productRefs);\n}\n","/** @internal */\nexport type RepoLocatorKind = \"remote_url\" | \"local_path\";\n\n/** @internal */\nexport interface ParsedRepoLocator {\n\t/** @internal */\n\tkind: RepoLocatorKind;\n\t/** @internal */\n\tvalue: string;\n}\n\nfunction isFileUrl(value: string): boolean {\n\ttry {\n\t\tconst url = new URL(value);\n\t\tif (url.protocol !== \"file:\") {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\t(url.hostname === \"\" || url.hostname === \"localhost\") &&\n\t\t\turl.pathname.startsWith(\"/\") &&\n\t\t\tdecodeURIComponent(url.pathname).length > 1\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isLocalFilesystemPath(value: string): boolean {\n\treturn (\n\t\tvalue.startsWith(\"/\") ||\n\t\tvalue.startsWith(\"./\") ||\n\t\tvalue.startsWith(\"../\") ||\n\t\tvalue.startsWith(\"~/\") ||\n\t\tisFileUrl(value)\n\t);\n}\n\nconst scpLikeGitUrlPattern = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+:[^\\s]+$/;\nconst explicitRemoteGitUrlPattern = /^(?:https?|ssh|git):\\/\\//;\n\nfunction hasRepositoryPath(pathname: string): boolean {\n\treturn pathname.split(\"/\").filter(Boolean).length >= 1;\n}\n\nfunction isRemoteGitUrl(value: string): boolean {\n\tif (scpLikeGitUrlPattern.test(value)) {\n\t\tconst path = value.slice(value.indexOf(\":\") + 1);\n\t\treturn hasRepositoryPath(path);\n\t}\n\tif (!explicitRemoteGitUrlPattern.test(value)) {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn (\n\t\t\t[\"http:\", \"https:\", \"ssh:\", \"git:\"].includes(url.protocol) &&\n\t\t\t!!url.hostname &&\n\t\t\thasRepositoryPath(url.pathname)\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/** @internal */\nexport function detectRepoLocatorKind(value: string): RepoLocatorKind | null {\n\tconst trimmed = value.trim();\n\tif (trimmed.length === 0) {\n\t\treturn null;\n\t}\n\tif (isLocalFilesystemPath(trimmed)) {\n\t\treturn \"local_path\";\n\t}\n\tif (isRemoteGitUrl(trimmed)) {\n\t\treturn \"remote_url\";\n\t}\n\treturn null;\n}\n\n/** @internal */\nexport function parseRepoLocator(value: unknown): ParsedRepoLocator | null {\n\tif (typeof value !== \"string\") {\n\t\treturn null;\n\t}\n\tconst trimmed = value.trim();\n\tconst kind = detectRepoLocatorKind(trimmed);\n\tif (!kind) {\n\t\treturn null;\n\t}\n\treturn { kind, value: trimmed };\n}\n\n/** @internal */\nexport function isRepoLocator(value: unknown): value is string {\n\treturn parseRepoLocator(value) !== null;\n}\n\n/** @internal */\nexport function assertRepoLocator(value: unknown, fieldName = \"repoLocator\"): string {\n\tconst parsed = parseRepoLocator(value);\n\tif (!parsed) {\n\t\tthrow new Error(`${fieldName} must be a remote URL or local filesystem path`);\n\t}\n\treturn parsed.value;\n}\n","/** First server receipt of a physical worker startup milestone. @internal */\nexport type StartupMilestone =\n\t| \"pvc_requested\"\n\t| \"pvc_acknowledged\"\n\t| \"pvc_bound\"\n\t| \"pod_requested\"\n\t| \"pod_acknowledged\"\n\t| \"pod_created\"\n\t| \"pod_scheduled\"\n\t| \"image_pull_started\"\n\t| \"image_pull_finished\"\n\t| \"image_cached\"\n\t| \"container_started\"\n\t| \"prompt_started\"\n\t| \"first_text\";\n/** @internal */\nexport interface StartupObservation {\n\t/** @internal */\n\tworkerLeaseId: string;\n\t/** @internal */\n\tmilestone: StartupMilestone;\n\t/** @internal */\n\tobservedAt: string;\n\t/** @internal */\n\tsourceAt: string | null;\n\t/** @internal */\n\tsourceKind: \"server\" | \"kubernetes_status\" | \"kubernetes_event\";\n\t/** @internal */\n\tobjectUid: string | null;\n\t/** @internal */\n\tturnRecordId: string | null;\n\t/** Sampling lower bound, never an exact binding timestamp. @internal */\n\tnotBefore: string | null;\n\t/** @internal */\n\tmetadata: {\n\t\t/** @internal */\n\t\tnode?: string;\n\t\t/** @internal */\n\t\timageId?: string;\n\t\t/** @internal */\n\t\timage?: string;\n\t\t/** @internal */\n\t\tstorageClass?: string;\n\t\t/** @internal */\n\t\tcpu?: string;\n\t\t/** @internal */\n\t\tmemory?: string;\n\t\t/** @internal */\n\t\tnamespace?: string;\n\t\t/** @internal */\n\t\tpodName?: string;\n\t\t/** @internal */\n\t\tprecision?: \"milliseconds\" | \"microseconds\" | \"seconds\" | \"sampling_interval\";\n\t};\n}\n/** @internal */\nexport interface StartupInterval {\n\t/** @internal */\n\tstart: string | null;\n\t/** @internal */\n\tend: string | null;\n\t/** @internal */\n\tdurationMs: number | null;\n\t/** @internal */\n\tstatus: \"available\" | \"missing\" | \"invalid_order\";\n\t/** @internal */\n\tclock: \"server\" | \"kubernetes\";\n}\n/** @internal */\nexport function startupInterval(\n\tstart: string | null | undefined,\n\tend: string | null | undefined,\n\tclock: StartupInterval[\"clock\"] = \"server\",\n): StartupInterval {\n\tconst delta = start && end ? Date.parse(end) - Date.parse(start) : NaN;\n\tconst status =\n\t\t!start || !end\n\t\t\t? \"missing\"\n\t\t\t: !Number.isFinite(delta) || delta < 0\n\t\t\t\t? \"invalid_order\"\n\t\t\t\t: \"available\";\n\treturn {\n\t\tstart: start ?? null,\n\t\tend: end ?? null,\n\t\tdurationMs: status === \"available\" ? delta : null,\n\t\tstatus,\n\t\tclock,\n\t};\n}\n/** @internal */\nexport interface PhysicalWorkerStart {\n\t/** @internal */\n\tworkerLeaseId: string;\n\t/** @internal */\n\tworkerId: string;\n\t/** @internal */\n\tturnStartRecordId: string | null;\n\t/** @internal */\n\tturnRecordId: string | null;\n\t/** @internal */\n\tstate: string;\n\t/** @internal */\n\tobservations: StartupObservation[];\n\t/** @internal */\n\tintervals: Record<string, StartupInterval>;\n}\n","import {\n\tisProcessSemanticEntryRefKey,\n\ttype ProcessSemanticEntryRefKey,\n} from \"./semantic-entry-refs.js\";\nimport { trimToNull } from \"./string-normalize.js\";\n\n/** @internal */\nexport const TURN_ANNOTATION_REFERENCE_KINDS = [\n\t\"turn_record\",\n\t\"entry\",\n\t\"semantic_entry_ref\",\n] as const;\n\n/** @internal */\nexport type TurnAnnotationReferenceKind = (typeof TURN_ANNOTATION_REFERENCE_KINDS)[number];\n/** @internal */\nexport type TurnAnnotationReferenceRole = string;\n\n/** @internal */\nexport interface TurnRecordAnnotationReference {\n\t/** @internal */\n\tkind: \"turn_record\";\n\t/** @internal */\n\tturnRecordId: string;\n\t/** @internal */\n\trole: TurnAnnotationReferenceRole | null;\n}\n\n/** @internal */\nexport interface EntryTurnAnnotationReference {\n\t/** @internal */\n\tkind: \"entry\";\n\t/** @internal */\n\tentryId: string;\n\t/** @internal */\n\trole: TurnAnnotationReferenceRole | null;\n}\n\n/** @internal */\nexport interface SemanticEntryRefTurnAnnotationReference {\n\t/** @internal */\n\tkind: \"semantic_entry_ref\";\n\t/** @internal */\n\tref: ProcessSemanticEntryRefKey;\n\t/** @internal */\n\trole: TurnAnnotationReferenceRole | null;\n}\n\n/** @internal */\nexport type TurnAnnotationReference =\n\t| TurnRecordAnnotationReference\n\t| EntryTurnAnnotationReference\n\t| SemanticEntryRefTurnAnnotationReference;\n\n/** @internal */\nexport interface ProcessTurnAnnotation {\n\t/** @internal */\n\tid: string;\n\t/** @internal */\n\tinstanceId: string;\n\t/** @internal */\n\tannotationType: string;\n\t/** @internal */\n\tannotationKey: string | null;\n\t/** @internal */\n\treferences: TurnAnnotationReference[];\n\t/** @internal */\n\tpayload: Record<string, unknown>;\n\t/** @internal */\n\tcreatedAt: string;\n\t/** @internal */\n\tupdatedAt: string;\n}\n\n/** @internal */\nexport function parseTurnAnnotationReference(value: unknown): TurnAnnotationReference | null {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\treturn null;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst kind = trimToNull(record.kind);\n\tconst role = trimToNull(record.role);\n\tif (kind === \"turn_record\") {\n\t\tconst turnRecordId = trimToNull(record.turnRecordId);\n\t\treturn turnRecordId ? { kind, turnRecordId, role } : null;\n\t}\n\tif (kind === \"entry\") {\n\t\tconst entryId = trimToNull(record.entryId);\n\t\treturn entryId ? { kind, entryId, role } : null;\n\t}\n\tif (kind === \"semantic_entry_ref\") {\n\t\tconst ref = trimToNull(record.ref);\n\t\treturn ref && isProcessSemanticEntryRefKey(ref) ? { kind, ref, role } : null;\n\t}\n\treturn null;\n}\n\n/** @internal */\nexport function parseTurnAnnotationReferences(value: unknown): TurnAnnotationReference[] {\n\tif (!Array.isArray(value)) {\n\t\treturn [];\n\t}\n\treturn value\n\t\t.map(parseTurnAnnotationReference)\n\t\t.filter((reference): reference is TurnAnnotationReference => reference !== null);\n}\n","import { normalizeStringArray, trimToNull } from \"./string-normalize.js\";\nimport { isUnknownRecord as isRecord } from \"./unknown-record.js\";\n\n/** @internal */\nexport const DEFAULT_CONTINUE_PROMPT = \"continue\";\n\n/** @internal */\nexport const FAILED_TURN_RECOVERY_CODES = [\n\t\"generic_continue\",\n\t\"missing_outcome_tool\",\n\t\"missing_markdown_result\",\n\t\"missing_required_tool_calls\",\n] as const;\n\n/** @internal */\nexport type FailedTurnRecoveryCode = (typeof FAILED_TURN_RECOVERY_CODES)[number];\n\n/** @internal */\nexport interface FailedTurnRecoveryContext {\n\t/** @internal */\n\tstrategy: \"continue\";\n\t/** @internal */\n\tsuggestedContinuePrompt: string;\n\t/** @internal */\n\tfailureCode: FailedTurnRecoveryCode;\n\t/** @internal */\n\tmissingToolNames?: string[];\n}\n\n/** @internal */\nexport type FailedTurnRecoveryOverrides = Partial<Omit<FailedTurnRecoveryContext, \"strategy\">>;\n\n/** @internal */\nexport const FAILED_TURN_RECOVERY_METADATA_KEY = \"failedTurnRecovery\";\n/** @internal */\nexport const CONTINUE_PROMPT_METADATA_KEY = \"continuePrompt\";\nconst TERMINAL_OUTCOME_RECORDING_FAILURE_PREFIX =\n\t\"Server could not durably record worker turn outcome:\";\n\n/** @internal */\nexport function isFailedTurnRecoveryCode(value: string): value is FailedTurnRecoveryCode {\n\treturn (FAILED_TURN_RECOVERY_CODES as readonly string[]).includes(value);\n}\n\nfunction normalizeUniqueStringArray(value: unknown): string[] | undefined {\n\tconst normalized = normalizeStringArray(value);\n\treturn normalized.length > 0 ? [...new Set(normalized)] : undefined;\n}\n\nexport { trimToNull as normalizeContinuePrompt };\n\n/** @internal */\nexport function createGenericFailedTurnRecoveryContext(\n\toverrides: FailedTurnRecoveryOverrides = {},\n): FailedTurnRecoveryContext {\n\treturn {\n\t\tstrategy: \"continue\",\n\t\tsuggestedContinuePrompt: DEFAULT_CONTINUE_PROMPT,\n\t\tfailureCode: \"generic_continue\",\n\t\t...overrides,\n\t};\n}\n\n/** @internal */\nexport function inferTerminalRecordingFailedTurnRecoveryContext(input: {\n\t/** @internal */\n\terrorSummary?: string | null;\n\t/** @internal */\n\terrorClass?: string | null;\n}): FailedTurnRecoveryContext | null {\n\tif (\n\t\tinput.errorClass !== \"infrastructure\" ||\n\t\t!input.errorSummary?.startsWith(TERMINAL_OUTCOME_RECORDING_FAILURE_PREFIX)\n\t) {\n\t\treturn null;\n\t}\n\treturn createGenericFailedTurnRecoveryContext();\n}\n\n/** @internal */\nexport function buildFailedTurnRecoveryMetadata(\n\tturnRecordId: string,\n\tcontext: FailedTurnRecoveryOverrides = {},\n) {\n\treturn {\n\t\t/** @internal */\n\t\t[FAILED_TURN_RECOVERY_METADATA_KEY]: {\n\t\t\t/** @internal */\n\t\t\tturnRecordId,\n\t\t\t...createGenericFailedTurnRecoveryContext(context),\n\t\t},\n\t};\n}\n\n/** @internal */\nexport function readFailedTurnRecoveryContext(\n\tmetadata: Record<string, unknown> | null | undefined,\n\texpectedTurnRecordId?: string | null,\n): FailedTurnRecoveryContext | null {\n\tif (!metadata) {\n\t\treturn null;\n\t}\n\tconst raw = metadata[FAILED_TURN_RECOVERY_METADATA_KEY];\n\tif (!isRecord(raw)) {\n\t\treturn null;\n\t}\n\tif (expectedTurnRecordId) {\n\t\tconst turnRecordId = trimToNull(raw.turnRecordId);\n\t\tif (turnRecordId !== expectedTurnRecordId) {\n\t\t\treturn null;\n\t\t}\n\t}\n\tif (raw.strategy !== \"continue\") {\n\t\treturn null;\n\t}\n\tconst suggestedContinuePrompt = trimToNull(raw.suggestedContinuePrompt);\n\tconst failureCode = trimToNull(raw.failureCode);\n\tif (!suggestedContinuePrompt || !failureCode || !isFailedTurnRecoveryCode(failureCode)) {\n\t\treturn null;\n\t}\n\tconst missingToolNames = normalizeUniqueStringArray(raw.missingToolNames);\n\treturn {\n\t\tstrategy: \"continue\",\n\t\tsuggestedContinuePrompt,\n\t\tfailureCode,\n\t\t...(missingToolNames ? { missingToolNames } : {}),\n\t};\n}\n","import type { ProcessTurnRecordPathType } from \"./domain-model.js\";\nimport type {\n\tProcessProductRefs,\n\tProcessSemanticEntryRefKey,\n\tProcessSemanticEntryRefs,\n} from \"./semantic-entry-refs.js\";\n\n/** @internal */\nexport interface ProcessTurnStartFromCurrentLeaf {\n\t/** @internal */\n\tkind: \"current_leaf\";\n}\n\n/** @internal */\nexport interface ProcessTurnStartFromSessionRoot {\n\t/** Start with no persisted Pi entry in context. The kickoff entry has parentId null. @internal */\n\tkind: \"session_root\";\n}\n\n/** @internal */\nexport interface ProcessTurnStartFromEntry {\n\t/** @internal */\n\tkind: \"entry\";\n\t/** @internal */\n\tentryId: string;\n}\n\n/** @internal */\nexport type ProcessTurnStartFallback =\n\t| ProcessTurnStartFromCurrentLeaf\n\t| ProcessTurnStartFromSessionRoot\n\t| ProcessTurnStartFromEntry;\n\n/** @internal */\nexport interface ProcessTurnStartFromSemanticRef {\n\t/** @internal */\n\tkind: \"semantic_ref\";\n\t/** @internal */\n\tref: ProcessSemanticEntryRefKey;\n\t/** @internal */\n\tfallback?: ProcessTurnStartSelection;\n}\n\n/** @internal */\nexport interface ProcessTurnStartFromProductRef {\n\t/** @internal */\n\tkind: \"product_ref\";\n\t/** @internal */\n\tproductName: string;\n\t/** @internal */\n\tfallback?: ProcessTurnStartSelection;\n}\n\n/** @internal */\nexport type ProcessTurnStartSelection =\n\t| ProcessTurnStartFallback\n\t| ProcessTurnStartFromSemanticRef\n\t| ProcessTurnStartFromProductRef;\n\n/** @internal */\nexport type ProcessTurnStartTarget =\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"current_leaf\";\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"entry\";\n\t\t\t/** @internal */\n\t\t\tentryId: string;\n\t }\n\t| {\n\t\t\t/** @internal */\n\t\t\tkind: \"root\";\n\t };\n\n/** @internal */\nexport interface ProcessTurnStartResolution {\n\t/** @internal */\n\tforkPiEntryId: string | null;\n\t/** @internal */\n\tstartTarget: ProcessTurnStartTarget;\n}\n\n/** @internal */\nexport function defaultProcessTurnStartSelection(\n\tbranchType: ProcessTurnRecordPathType,\n): ProcessTurnStartFallback {\n\tswitch (branchType) {\n\t\tcase \"primary\":\n\t\tcase \"leaf_branch\":\n\t\t\treturn { kind: \"current_leaf\" };\n\t\tcase \"root_branch\":\n\t\t\treturn { kind: \"session_root\" };\n\t}\n}\n\n/** @internal */\nexport function resolveProcessTurnStartSelection(input: {\n\t/** @internal */\n\tbranchType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tstartFrom?: ProcessTurnStartSelection;\n}): ProcessTurnStartSelection {\n\treturn input.startFrom ?? defaultProcessTurnStartSelection(input.branchType);\n}\n\n/** @internal */\nexport function resolveExistingProcessEntryId(\n\tentryId: string | null,\n\tentryExists?: ((entryId: string) => boolean) | undefined,\n): string | null {\n\tif (!entryId) {\n\t\treturn null;\n\t}\n\treturn entryExists && !entryExists(entryId) ? null : entryId;\n}\n\n/** @internal */\nexport function resolveProcessSemanticRefEntryId(input: {\n\t/** @internal */\n\tref: keyof ProcessSemanticEntryRefs;\n\t/** @internal */\n\tsemanticEntryRefs?: ProcessSemanticEntryRefs | null;\n\t/** @internal */\n\tcurrentLeafId: string | null;\n\t/** @internal */\n\trootEntryId: string | null;\n\t/** @internal */\n\tentryExists?: (entryId: string) => boolean;\n}): string | null {\n\tconst fromState = resolveExistingProcessEntryId(\n\t\tinput.semanticEntryRefs?.[input.ref]?.entryId ?? null,\n\t\tinput.entryExists,\n\t);\n\tif (fromState) {\n\t\treturn fromState;\n\t}\n\tif (input.ref === \"currentPrimaryPathLeaf\") {\n\t\treturn resolveExistingProcessEntryId(input.currentLeafId, input.entryExists);\n\t}\n\tif (input.ref === \"rootEntry\") {\n\t\treturn resolveExistingProcessEntryId(input.rootEntryId, input.entryExists);\n\t}\n\treturn null;\n}\n\n/** @internal */\nexport function resolveProcessProductRefEntryId(input: {\n\t/** @internal */\n\tproductName: string;\n\t/** @internal */\n\tproductRefs?: ProcessProductRefs | null;\n\t/** @internal */\n\tentryExists?: (entryId: string) => boolean;\n}): string | null {\n\tconst productName = input.productName.trim();\n\tif (!productName) {\n\t\treturn null;\n\t}\n\treturn resolveExistingProcessEntryId(\n\t\tinput.productRefs?.[productName]?.entryId ?? null,\n\t\tinput.entryExists,\n\t);\n}\n\n/** @internal */\nexport function resolveProcessTurnStartTarget(input: {\n\t/** @internal */\n\tbranchType: ProcessTurnRecordPathType;\n\t/** @internal */\n\tselection: ProcessTurnStartSelection;\n\t/** @internal */\n\tcurrentLeafId: string | null;\n\t/** @internal */\n\trootEntryId: string | null;\n\t/** @internal */\n\tsemanticEntryRefs?: ProcessSemanticEntryRefs | null;\n\t/** @internal */\n\tproductRefs?: ProcessProductRefs | null;\n\t/** @internal */\n\tentryExists?: (entryId: string) => boolean;\n}): ProcessTurnStartResolution {\n\tswitch (input.selection.kind) {\n\t\tcase \"current_leaf\": {\n\t\t\treturn {\n\t\t\t\tforkPiEntryId: resolveExistingProcessEntryId(input.currentLeafId, input.entryExists),\n\t\t\t\tstartTarget: { kind: \"current_leaf\" },\n\t\t\t};\n\t\t}\n\t\tcase \"session_root\": {\n\t\t\treturn {\n\t\t\t\tforkPiEntryId: null,\n\t\t\t\tstartTarget: { kind: \"root\" },\n\t\t\t};\n\t\t}\n\t\tcase \"entry\": {\n\t\t\treturn {\n\t\t\t\tforkPiEntryId: input.selection.entryId,\n\t\t\t\tstartTarget: { kind: \"entry\", entryId: input.selection.entryId },\n\t\t\t};\n\t\t}\n\t\tcase \"semantic_ref\":\n\t\tcase \"product_ref\": {\n\t\t\tconst entryId =\n\t\t\t\tinput.selection.kind === \"semantic_ref\"\n\t\t\t\t\t? resolveProcessSemanticRefEntryId({\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t\tref: input.selection.ref,\n\t\t\t\t\t\t})\n\t\t\t\t\t: resolveProcessProductRefEntryId({\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t\tproductName: input.selection.productName,\n\t\t\t\t\t\t});\n\t\t\tif (entryId) {\n\t\t\t\treturn {\n\t\t\t\t\tforkPiEntryId: entryId,\n\t\t\t\t\tstartTarget: { kind: \"entry\", entryId },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn resolveProcessTurnStartTarget({\n\t\t\t\t...input,\n\t\t\t\tselection: input.selection.fallback ?? defaultProcessTurnStartSelection(input.branchType),\n\t\t\t});\n\t\t}\n\t}\n}\n"],"mappings":";AACO,SAAS,eAAe,OAAwB;AACtD,MAAI,iBAAiB,SAAS,MAAM,QAAQ,KAAK,MAAM,IAAI;AAC1D,WAAO,MAAM;AAAA,EACd;AACA,SAAO,OAAO,KAAK;AACpB;AAGO,SAAS,mBAAmB,OAA+B;AACjE,SAAO,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,KAAK,QAAQ;AACnE;AAGO,SAAS,WAAW,OAAwB;AAClD,SAAO,OAAO,UAAU,WAAW,MAAM,KAAK,IAAI;AACnD;AAGO,SAAS,WAAW,OAA+B;AACzD,QAAM,UAAU,WAAW,KAAK;AAChC,SAAO,YAAY,KAAK,OAAO;AAChC;AAGO,SAAS,qBAAqB,OAA0B;AAC9D,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,WAAO,CAAC;AAAA,EACT;AACA,SAAO,MAAM,IAAI,CAAC,UAAU,WAAW,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,MAAM,SAAS,CAAC;AAClF;AAUO,SAAS,qBAAqB,YAA6B;AACjE,SAAO,WAAW,UAAU,EAC1B,QAAQ,UAAU,GAAG,EACrB,QAAQ,QAAQ,GAAG,EACnB,QAAQ,SAAS,CAAC,WAAW,OAAO,YAAY,CAAC,EACjD,KAAK;AACR;AAEA,IAAM,yBAAiD;AAAA,EACtD,KAAK;AAAA,EACL,IAAI;AAA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C,GAAG;AAAA,QACH,WAAW,MAAM,UAAU,YAAY,iCAAiC,MAAM,UAAU;AAAA,MACzF,CAAC;AAAA,IACF;AAAA,EACD;AACD;","names":["v","record","record"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leitwerk-dev/domain",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/leitwerk-dev/leitwerk.git",
@@ -647,12 +647,76 @@ export interface TurnStartRecord {
647
647
  continuation: TurnStartContinuation | null;
648
648
  /** @internal */
649
649
  state: TurnStartRecordState;
650
+ /** Mapped-turn item this start executes; null for ordinary turns. @internal */
651
+ iteration?: MappedTurnItemRef | null;
650
652
  /** @internal */
651
653
  createdAt: string;
652
654
  /** @internal */
653
655
  updatedAt: string;
654
656
  }
655
657
 
658
+ /** Identity of one frozen item in a mapped LLM run. @internal */
659
+ export interface MappedTurnItemRef {
660
+ /** @internal */
661
+ runId: string;
662
+ /** @internal */
663
+ itemKey: string;
664
+ /** Zero-based position in the frozen order. @internal */
665
+ itemIndex: number;
666
+ }
667
+
668
+ /** @internal */
669
+ export type MappedRunStatus = "active" | "completed" | "aborted";
670
+
671
+ /** Durable bookkeeping for one sequential pass of a mapped LLM turn. @internal */
672
+ export interface MappedRun {
673
+ /** @internal */
674
+ id: string;
675
+ /** @internal */
676
+ instanceId: string;
677
+ /** @internal */
678
+ turnId: TurnId;
679
+ /** @internal */
680
+ status: MappedRunStatus;
681
+ /** @internal */
682
+ itemCount: number;
683
+ /** Index of the item currently executing, or itemCount when all results exist. @internal */
684
+ nextIndex: number;
685
+ /** @internal */
686
+ createdAt: string;
687
+ /** @internal */
688
+ updatedAt: string;
689
+ }
690
+
691
+ /** @internal */
692
+ export type MappedItemStatus = "pending" | "completed";
693
+
694
+ /** One frozen item of a mapped run and its validated result. @internal */
695
+ export interface MappedItem {
696
+ /** @internal */
697
+ runId: string;
698
+ /** @internal */
699
+ instanceId: string;
700
+ /** @internal */
701
+ itemIndex: number;
702
+ /** @internal */
703
+ itemKey: string;
704
+ /** @internal */
705
+ label: string;
706
+ /** Codec-serialized item value. @internal */
707
+ itemJson: string;
708
+ /** @internal */
709
+ status: MappedItemStatus;
710
+ /** @internal */
711
+ outcome: string | null;
712
+ /** Codec-serialized result, set once when the item completes. @internal */
713
+ resultJson: string | null;
714
+ /** Turn record whose outcome produced the result. @internal */
715
+ turnRecordId: string | null;
716
+ /** @internal */
717
+ completedAt: string | null;
718
+ }
719
+
656
720
  /** Tree positioning selected during bootstrap, before a turn is accepted. @internal */
657
721
  export interface PreparedTurnStart {
658
722
  /** @internal */
@@ -1081,6 +1145,8 @@ export interface ProcessTurnRecord {
1081
1145
  modelProfileId: string | null;
1082
1146
  /** @internal */
1083
1147
  modelSelectionProvenance?: ModelSelectionProvenance | null;
1148
+ /** Mapped-turn item this record executed; retries keep the same item. @internal */
1149
+ iteration?: MappedTurnItemRef | null;
1084
1150
  /** @internal */
1085
1151
  turnResultMarkdown: string | null;
1086
1152
  /** @public */
package/src/index.ts CHANGED
@@ -21,6 +21,11 @@ export type {
21
21
  LaunchOrigin,
22
22
  LaunchRun,
23
23
  LaunchRunStatus,
24
+ MappedItem,
25
+ MappedItemStatus,
26
+ MappedRun,
27
+ MappedRunStatus,
28
+ MappedTurnItemRef,
24
29
  ModelSelectionKind,
25
30
  ModelSelectionProvenance,
26
31
  NormalizedQuestion,