@earendil-works/pi-agent-core 0.87.1 → 0.99.0

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.
Files changed (242) hide show
  1. package/README.md +4 -0
  2. package/dist/agent-loop.d.ts +27 -2
  3. package/dist/agent-loop.d.ts.map +1 -1
  4. package/dist/agent-loop.js +44 -15
  5. package/dist/agent-loop.js.map +1 -1
  6. package/dist/agent.d.ts +9 -0
  7. package/dist/agent.d.ts.map +1 -1
  8. package/dist/agent.js +3 -0
  9. package/dist/agent.js.map +1 -1
  10. package/dist/harness/agent-harness.d.ts.map +1 -1
  11. package/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  12. package/dist/harness/compaction/branch-summarization.js.map +1 -1
  13. package/dist/harness/compaction/compaction.d.ts.map +1 -1
  14. package/dist/harness/compaction/compaction.js.map +1 -1
  15. package/dist/harness/compaction/utils.d.ts.map +1 -1
  16. package/dist/harness/compaction/utils.js.map +1 -1
  17. package/dist/harness/config.d.ts.map +1 -1
  18. package/dist/harness/config.js.map +1 -1
  19. package/dist/harness/context.d.ts.map +1 -1
  20. package/dist/harness/context.js.map +1 -1
  21. package/dist/harness/env/nodejs.d.ts.map +1 -1
  22. package/dist/harness/env/nodejs.js.map +1 -1
  23. package/dist/harness/events.d.ts.map +1 -1
  24. package/dist/harness/events.js.map +1 -1
  25. package/dist/harness/execution/assistant.d.ts.map +1 -1
  26. package/dist/harness/execution/assistant.js.map +1 -1
  27. package/dist/harness/execution/effect-gate.d.ts.map +1 -1
  28. package/dist/harness/execution/effect-gate.js.map +1 -1
  29. package/dist/harness/execution/tools.d.ts.map +1 -1
  30. package/dist/harness/execution/tools.js.map +1 -1
  31. package/dist/harness/hooks.d.ts.map +1 -1
  32. package/dist/harness/hooks.js.map +1 -1
  33. package/dist/harness/messages.d.ts.map +1 -1
  34. package/dist/harness/messages.js.map +1 -1
  35. package/dist/harness/pico3/bash.d.ts.map +1 -1
  36. package/dist/harness/pico3/bash.js.map +1 -1
  37. package/dist/harness/pico3/bounded.d.ts.map +1 -1
  38. package/dist/harness/pico3/bounded.js.map +1 -1
  39. package/dist/harness/pico3/chord.d.ts.map +1 -1
  40. package/dist/harness/pico3/chord.js.map +1 -1
  41. package/dist/harness/pico3/context.d.ts.map +1 -1
  42. package/dist/harness/pico3/context.js.map +1 -1
  43. package/dist/harness/pico3/harness.d.ts +4 -3
  44. package/dist/harness/pico3/harness.d.ts.map +1 -1
  45. package/dist/harness/pico3/harness.js.map +1 -1
  46. package/dist/harness/pico3/hooks.d.ts +2 -2
  47. package/dist/harness/pico3/hooks.d.ts.map +1 -1
  48. package/dist/harness/pico3/hooks.js.map +1 -1
  49. package/dist/harness/pico3/index.d.ts.map +1 -1
  50. package/dist/harness/pico3/jsonl.d.ts.map +1 -1
  51. package/dist/harness/pico3/jsonl.js.map +1 -1
  52. package/dist/harness/pico3/kinds/collapse.d.ts.map +1 -1
  53. package/dist/harness/pico3/kinds/collapse.js.map +1 -1
  54. package/dist/harness/pico3/kinds/entries.d.ts.map +1 -1
  55. package/dist/harness/pico3/kinds/frames.d.ts.map +1 -1
  56. package/dist/harness/pico3/kinds/frames.js.map +1 -1
  57. package/dist/harness/pico3/kinds/generation.d.ts.map +1 -1
  58. package/dist/harness/pico3/kinds/generation.js.map +1 -1
  59. package/dist/harness/pico3/kinds/job.d.ts.map +1 -1
  60. package/dist/harness/pico3/kinds/job.js.map +1 -1
  61. package/dist/harness/pico3/kinds/plugin.d.ts.map +1 -1
  62. package/dist/harness/pico3/kinds/plugin.js.map +1 -1
  63. package/dist/harness/pico3/kinds/post-tools.d.ts.map +1 -1
  64. package/dist/harness/pico3/kinds/post-tools.js.map +1 -1
  65. package/dist/harness/pico3/kinds/task-api.d.ts.map +1 -1
  66. package/dist/harness/pico3/kinds/task-api.js.map +1 -1
  67. package/dist/harness/pico3/kinds/tool.d.ts.map +1 -1
  68. package/dist/harness/pico3/kinds/tool.js.map +1 -1
  69. package/dist/harness/pico3/legacy-tracker.d.ts +11 -0
  70. package/dist/harness/pico3/legacy-tracker.d.ts.map +1 -0
  71. package/dist/harness/pico3/legacy-tracker.js +41 -0
  72. package/dist/harness/pico3/legacy-tracker.js.map +1 -0
  73. package/dist/harness/pico3/membrane.d.ts.map +1 -1
  74. package/dist/harness/pico3/membrane.js.map +1 -1
  75. package/dist/harness/pico3/memory.d.ts +1 -1
  76. package/dist/harness/pico3/memory.d.ts.map +1 -1
  77. package/dist/harness/pico3/memory.js.map +1 -1
  78. package/dist/harness/pico3/scheduler.d.ts +3 -0
  79. package/dist/harness/pico3/scheduler.d.ts.map +1 -1
  80. package/dist/harness/pico3/scheduler.js.map +1 -1
  81. package/dist/harness/pico3/session.d.ts +3 -2
  82. package/dist/harness/pico3/session.d.ts.map +1 -1
  83. package/dist/harness/pico3/session.js +5 -4
  84. package/dist/harness/pico3/session.js.map +1 -1
  85. package/dist/harness/pico3/system.d.ts +1 -1
  86. package/dist/harness/pico3/system.d.ts.map +1 -1
  87. package/dist/harness/pico3/system.js.map +1 -1
  88. package/dist/harness/pico3/types.d.ts +1 -1
  89. package/dist/harness/pico3/types.d.ts.map +1 -1
  90. package/dist/harness/pico3/types.js.map +1 -1
  91. package/dist/harness/pico3/view.d.ts.map +1 -1
  92. package/dist/harness/pico3/view.js +6 -12
  93. package/dist/harness/pico3/view.js.map +1 -1
  94. package/dist/harness/prompt-templates.d.ts.map +1 -1
  95. package/dist/harness/prompt-templates.js.map +1 -1
  96. package/dist/harness/result.d.ts.map +1 -1
  97. package/dist/harness/result.js.map +1 -1
  98. package/dist/harness/runtime/drive/boundary.d.ts.map +1 -1
  99. package/dist/harness/runtime/drive/boundary.js.map +1 -1
  100. package/dist/harness/runtime/drive/checkpoint.d.ts.map +1 -1
  101. package/dist/harness/runtime/drive/checkpoint.js.map +1 -1
  102. package/dist/harness/runtime/drive/deferred.d.ts.map +1 -1
  103. package/dist/harness/runtime/drive/deferred.js.map +1 -1
  104. package/dist/harness/runtime/drive/generation.d.ts.map +1 -1
  105. package/dist/harness/runtime/drive/generation.js.map +1 -1
  106. package/dist/harness/runtime/drive/reconcile.d.ts.map +1 -1
  107. package/dist/harness/runtime/drive/reconcile.js.map +1 -1
  108. package/dist/harness/runtime/drive/recovery.d.ts.map +1 -1
  109. package/dist/harness/runtime/drive/recovery.js.map +1 -1
  110. package/dist/harness/runtime/drive/response.d.ts.map +1 -1
  111. package/dist/harness/runtime/drive/response.js.map +1 -1
  112. package/dist/harness/runtime/drive/retry.d.ts.map +1 -1
  113. package/dist/harness/runtime/drive/retry.js.map +1 -1
  114. package/dist/harness/runtime/drive/structural.d.ts.map +1 -1
  115. package/dist/harness/runtime/drive/structural.js.map +1 -1
  116. package/dist/harness/runtime/drive/terminal.d.ts.map +1 -1
  117. package/dist/harness/runtime/drive/terminal.js.map +1 -1
  118. package/dist/harness/runtime/drive/tool-placement.d.ts.map +1 -1
  119. package/dist/harness/runtime/drive/tool-placement.js.map +1 -1
  120. package/dist/harness/runtime/drive/tools.d.ts.map +1 -1
  121. package/dist/harness/runtime/drive/tools.js.map +1 -1
  122. package/dist/harness/runtime/drive.d.ts.map +1 -1
  123. package/dist/harness/runtime/drive.js.map +1 -1
  124. package/dist/harness/runtime/harness.d.ts.map +1 -1
  125. package/dist/harness/runtime/harness.js.map +1 -1
  126. package/dist/harness/runtime/index.d.ts.map +1 -1
  127. package/dist/harness/runtime/lane.d.ts +17 -0
  128. package/dist/harness/runtime/lane.d.ts.map +1 -1
  129. package/dist/harness/runtime/lane.js.map +1 -1
  130. package/dist/harness/runtime/progress.d.ts.map +1 -1
  131. package/dist/harness/runtime/progress.js.map +1 -1
  132. package/dist/harness/runtime/reducer.d.ts.map +1 -1
  133. package/dist/harness/runtime/reducer.js.map +1 -1
  134. package/dist/harness/runtime/restore.d.ts.map +1 -1
  135. package/dist/harness/runtime/restore.js.map +1 -1
  136. package/dist/harness/runtime/transcript.d.ts.map +1 -1
  137. package/dist/harness/runtime/transcript.js.map +1 -1
  138. package/dist/harness/runtime/types.d.ts.map +1 -1
  139. package/dist/harness/runtime/types.js.map +1 -1
  140. package/dist/harness/session/commit.d.ts.map +1 -1
  141. package/dist/harness/session/commit.js.map +1 -1
  142. package/dist/harness/session/context.d.ts.map +1 -1
  143. package/dist/harness/session/context.js.map +1 -1
  144. package/dist/harness/session/fork-policy.d.ts.map +1 -1
  145. package/dist/harness/session/fork-policy.js.map +1 -1
  146. package/dist/harness/session/fork.d.ts.map +1 -1
  147. package/dist/harness/session/fork.js.map +1 -1
  148. package/dist/harness/session/in-memory-storage-state.d.ts.map +1 -1
  149. package/dist/harness/session/in-memory-storage-state.js.map +1 -1
  150. package/dist/harness/session/index.d.ts.map +1 -1
  151. package/dist/harness/session/jsonl/codec.d.ts.map +1 -1
  152. package/dist/harness/session/jsonl/codec.js.map +1 -1
  153. package/dist/harness/session/jsonl/fork.d.ts.map +1 -1
  154. package/dist/harness/session/jsonl/fork.js.map +1 -1
  155. package/dist/harness/session/jsonl/index.d.ts.map +1 -1
  156. package/dist/harness/session/jsonl/io.d.ts.map +1 -1
  157. package/dist/harness/session/jsonl/io.js.map +1 -1
  158. package/dist/harness/session/jsonl/legacy-v3.d.ts +1 -0
  159. package/dist/harness/session/jsonl/legacy-v3.d.ts.map +1 -1
  160. package/dist/harness/session/jsonl/legacy-v3.js.map +1 -1
  161. package/dist/harness/session/jsonl/repo.d.ts.map +1 -1
  162. package/dist/harness/session/jsonl/repo.js.map +1 -1
  163. package/dist/harness/session/jsonl/storage.d.ts +1 -0
  164. package/dist/harness/session/jsonl/storage.d.ts.map +1 -1
  165. package/dist/harness/session/jsonl/storage.js.map +1 -1
  166. package/dist/harness/session/jsonl/types.d.ts.map +1 -1
  167. package/dist/harness/session/memory.d.ts.map +1 -1
  168. package/dist/harness/session/memory.js.map +1 -1
  169. package/dist/harness/session/mutation-line.d.ts.map +1 -1
  170. package/dist/harness/session/mutation-line.js.map +1 -1
  171. package/dist/harness/session/session.d.ts.map +1 -1
  172. package/dist/harness/session/session.js.map +1 -1
  173. package/dist/harness/session/testing/benchmark/datasets.d.ts.map +1 -1
  174. package/dist/harness/session/testing/benchmark/datasets.js.map +1 -1
  175. package/dist/harness/session/testing/benchmark/session-repo.d.ts.map +1 -1
  176. package/dist/harness/session/testing/benchmark/session-repo.js.map +1 -1
  177. package/dist/harness/session/testing/benchmark/storage.d.ts.map +1 -1
  178. package/dist/harness/session/testing/benchmark/storage.js.map +1 -1
  179. package/dist/harness/session/testing/conformance/session-repo.d.ts.map +1 -1
  180. package/dist/harness/session/testing/conformance/session-repo.js.map +1 -1
  181. package/dist/harness/session/testing/conformance/storage.d.ts.map +1 -1
  182. package/dist/harness/session/testing/conformance/storage.js.map +1 -1
  183. package/dist/harness/session/testing/gating-storage.d.ts.map +1 -1
  184. package/dist/harness/session/testing/gating-storage.js.map +1 -1
  185. package/dist/harness/session/testing/index.d.ts.map +1 -1
  186. package/dist/harness/session/testing/instrumented-storage.d.ts.map +1 -1
  187. package/dist/harness/session/testing/instrumented-storage.js.map +1 -1
  188. package/dist/harness/session/testing/storage-decorator.d.ts.map +1 -1
  189. package/dist/harness/session/testing/storage-decorator.js.map +1 -1
  190. package/dist/harness/session/testing/types.d.ts.map +1 -1
  191. package/dist/harness/session/types.d.ts.map +1 -1
  192. package/dist/harness/session/types.js.map +1 -1
  193. package/dist/harness/session/values.d.ts +2 -2
  194. package/dist/harness/session/values.d.ts.map +1 -1
  195. package/dist/harness/session/values.js.map +1 -1
  196. package/dist/harness/skills.d.ts.map +1 -1
  197. package/dist/harness/skills.js.map +1 -1
  198. package/dist/harness/system-prompt.d.ts.map +1 -1
  199. package/dist/harness/system-prompt.js.map +1 -1
  200. package/dist/harness/telemetry.d.ts.map +1 -1
  201. package/dist/harness/telemetry.js.map +1 -1
  202. package/dist/harness/tools/bash.d.ts.map +1 -1
  203. package/dist/harness/tools/bash.js.map +1 -1
  204. package/dist/harness/tools/edit-diff.d.ts.map +1 -1
  205. package/dist/harness/tools/edit-diff.js.map +1 -1
  206. package/dist/harness/tools/edit.d.ts.map +1 -1
  207. package/dist/harness/tools/edit.js.map +1 -1
  208. package/dist/harness/tools/file-mutation-queue.d.ts.map +1 -1
  209. package/dist/harness/tools/file-mutation-queue.js.map +1 -1
  210. package/dist/harness/tools/image.d.ts.map +1 -1
  211. package/dist/harness/tools/image.js.map +1 -1
  212. package/dist/harness/tools/index.d.ts.map +1 -1
  213. package/dist/harness/tools/path-utils.d.ts.map +1 -1
  214. package/dist/harness/tools/path-utils.js.map +1 -1
  215. package/dist/harness/tools/read.d.ts.map +1 -1
  216. package/dist/harness/tools/read.js.map +1 -1
  217. package/dist/harness/tools/tool-context.d.ts.map +1 -1
  218. package/dist/harness/tools/write.d.ts.map +1 -1
  219. package/dist/harness/tools/write.js.map +1 -1
  220. package/dist/harness/types.d.ts.map +1 -1
  221. package/dist/harness/types.js.map +1 -1
  222. package/dist/harness/utils/adaptive-publisher.d.ts.map +1 -1
  223. package/dist/harness/utils/adaptive-publisher.js.map +1 -1
  224. package/dist/harness/utils/output-capture.d.ts.map +1 -1
  225. package/dist/harness/utils/output-capture.js.map +1 -1
  226. package/dist/harness/utils/shell-output.d.ts.map +1 -1
  227. package/dist/harness/utils/shell-output.js.map +1 -1
  228. package/dist/harness/utils/truncate.d.ts.map +1 -1
  229. package/dist/harness/utils/truncate.js.map +1 -1
  230. package/dist/harness/utils/usage.d.ts.map +1 -1
  231. package/dist/harness/utils/usage.js.map +1 -1
  232. package/dist/index.d.ts.map +1 -1
  233. package/dist/node.d.ts.map +1 -1
  234. package/dist/proxy.d.ts.map +1 -1
  235. package/dist/proxy.js.map +1 -1
  236. package/dist/search/index.d.ts.map +1 -1
  237. package/dist/stream-fn.d.ts.map +1 -1
  238. package/dist/stream-fn.js.map +1 -1
  239. package/dist/types.d.ts +30 -2
  240. package/dist/types.d.ts.map +1 -1
  241. package/dist/types.js.map +1 -1
  242. package/package.json +9 -10
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/harness/session/types.ts"],"names":[],"mappings":"AA4UA,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAAC,KAAqB,EAAkB;IACvE,OAAO;QACN,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;KACpD,CAAC;AAAA,CACF","sourcesContent":["import type { JsonValue } from \"@earendil-works/chord\";\nimport type { AssistantMessage, StopReason, Usage } from \"@earendil-works/pi-ai\";\nimport type { AgentMessage, QueueMode, ThinkingLevel } from \"../../types.ts\";\nimport type { BranchPreparation } from \"../compaction/branch-summarization.ts\";\nimport type { CompactionPreparation, CompactionSettings } from \"../compaction/compaction.ts\";\nimport type { Context } from \"../context.ts\";\nimport type { AgentHarnessStreamOptions } from \"../types.ts\";\nimport type { ListElement, ListReadOptions, ListWrite, StoredValue, Value, ValueList, ValueWrite } from \"./values.ts\";\n\nexport type { JsonValue } from \"@earendil-works/chord\";\n\nexport type SettledAssistantMessage = AssistantMessage & {\n\tstopReason: Exclude<StopReason, \"pending\">;\n};\n\nexport type EntryType = \"message\" | \"compaction\" | \"branch_summary\" | \"custom\";\n\nexport interface EntryBase {\n\tid: string;\n\tparentId: string | null;\n\tseq: number;\n\ttimestamp: number;\n\ttype: EntryType;\n\tcustomType?: string;\n}\n\nexport interface MessageEntry extends EntryBase {\n\ttype: \"message\";\n\tmessage: AgentMessage;\n\tterminate?: true;\n}\n\nexport interface CompactionEntry extends EntryBase {\n\ttype: \"compaction\";\n\tsummary: string;\n\tretainedTail: AgentMessage[];\n\ttokensBefore: number;\n\tdetails?: JsonValue;\n\tusage?: Usage;\n\tfromHook: boolean;\n}\n\nexport interface BranchSummaryEntry extends EntryBase {\n\ttype: \"branch_summary\";\n\tfromId: string | null;\n\tsummary: string;\n\tdetails?: JsonValue;\n\tusage?: Usage;\n\tfromHook: boolean;\n}\n\nexport interface CustomEntry extends EntryBase {\n\ttype: \"custom\";\n\tcustomType: string;\n\tdata?: JsonValue;\n}\n\n/** Convert an application-defined custom entry into model context. */\nexport type EntryProjector = (\n\tentry: CustomEntry,\n\tcontext: Context,\n) => AgentMessage[] | undefined | Promise<AgentMessage[] | undefined>;\n\nexport type Entry = MessageEntry | CompactionEntry | BranchSummaryEntry | CustomEntry;\n\n/** Entry supplied to a transaction before storage assigns sequence and timestamp. */\nexport type NewEntry<TEntry extends Entry = Entry> = TEntry extends Entry ? Omit<TEntry, \"seq\" | \"timestamp\"> : never;\n\nexport interface LaneConfiguration {\n\tmodel: { provider: string; modelId: string };\n\tthinkingLevel: ThinkingLevel;\n\tactiveToolNames: string[];\n}\n\nexport interface OperationMeta {\n\toperationId: string;\n\tlane: string;\n\tsourceTipId: string | null;\n\tstartedAt: number;\n\tintent:\n\t\t| { kind: \"run\"; promptEntryIds: string[] }\n\t\t| { kind: \"compaction\"; customInstructions?: string }\n\t\t| {\n\t\t\t\tkind: \"navigation\";\n\t\t\t\ttargetId: string | null;\n\t\t\t\tsummarize: boolean;\n\t\t\t\tlabel?: string;\n\t\t\t\tcustomInstructions?: string;\n\t\t };\n}\n\nexport type Control =\n\t| { status: \"running\" }\n\t| {\n\t\t\tstatus: \"cancel_requested\";\n\t\t\trequestedAt: number;\n\t };\n\nexport interface OperationError {\n\tcode: string;\n\tmessage: string;\n\tdetails?: JsonValue;\n}\n\nexport type TerminalStatus = \"completed\" | \"declined\" | \"aborted\" | \"failed\";\n\n/** Immutable lane-lived observation record written by one terminal transaction. */\nexport interface OperationResultRecord {\n\toperationId: string;\n\tkind: OperationMeta[\"intent\"][\"kind\"];\n\tstatus: TerminalStatus;\n\terror?: OperationError;\n\tfromTipId: string | null;\n\ttipId: string | null;\n\tstartedAt: number;\n\tendedAt: number;\n}\n\nexport type Continuation =\n\t| { kind: \"need_assistant\"; overflowRecoveryUsed: boolean }\n\t| { kind: \"may_finish\"; includeFinalAssistant: boolean };\n\n/** Checkpoint payload; the flat leaf literal replaces the old nested phase tag. */\nexport interface CheckpointData {\n\tcontinuation: Continuation;\n\ttriggerEntryId: string;\n}\n\nexport type InboxItemKind = \"steer\" | \"followUp\" | \"nextRun\" | \"write\";\n\nexport interface InboxItem {\n\tentryId: string;\n\tkind: InboxItemKind;\n}\n\nexport interface NormalizedRetryPolicy {\n\tmaxAttempts: number;\n\tbaseDelayMs: number;\n\tmaxAgentDelayMs: number;\n}\n\nexport interface GenerationContext {\n\tstepId: string;\n\ttriggerEntryId: string;\n\tconfiguration: LaneConfiguration;\n\tstreamOptions: AgentHarnessStreamOptions;\n\tretryPolicy: NormalizedRetryPolicy;\n\toverflowRecoveryUsed: boolean;\n}\n\ninterface ToolCallSource {\n\t/** Zero-based index in the assistant message's complete content array, not a filtered tool-call ordinal. */\n\tsourceIndex: number;\n\tresultEntryId: string;\n}\n\nexport type ToolCall = ToolCallSource &\n\t(\n\t\t| { status: \"planned\" }\n\t\t| { status: \"effect_pending\"; replay: \"never\" | \"safe\" }\n\t\t| { status: \"outcome_ready\"; terminate: boolean }\n\t\t| { status: \"completed\"; terminate: boolean }\n\t);\n\nexport interface ToolBatch {\n\tassistantEntryId: string;\n\tconfiguration: LaneConfiguration;\n\tturnId: string;\n\tcalls: ToolCall[];\n}\n\nexport interface SummaryContext {\n\tresultEntryId: string;\n\tconfiguration: LaneConfiguration;\n\tstreamOptions: AgentHarnessStreamOptions;\n\tretryPolicy: NormalizedRetryPolicy;\n}\n\n/*\n * Durable operation state is one flat union with one family-neutral discriminator\n * per dispatcher leaf. ToolBatch/ToolCall remain the nested child collection state\n * machine, and cancellation stays orthogonal via Control.\n */\n\nexport interface Cancellable {\n\tcontrol: Control;\n}\n\nexport interface RunSettings {\n\tcompaction: CompactionSettings;\n\tsteeringMode: QueueMode;\n\tfollowUpMode: QueueMode;\n\ttoolExecution: \"sequential\" | \"parallel\";\n}\n\n/** Uniform scope carried by every operation leaf. */\nexport interface OperationScope extends Cancellable {\n\tsettings: RunSettings;\n\tlatestAssistantEntryId: string | null;\n}\n\n/** Shared backoff data for every retry-wait leaf. */\nexport interface RetryWait {\n\tnextAttempt: number;\n\tnotBefore: number;\n\terrorMessage: string;\n}\n\nexport interface AssistantGenerationScope {\n\tgenerationContext: GenerationContext;\n}\n\nexport type ResultBoundary =\n\t| { kind: \"resume_checkpoint\"; resumeAfter: CheckpointData }\n\t| { kind: \"finish\" }\n\t| { kind: \"commit_navigation\"; targetId: string; label?: string };\n\nexport interface SummaryTask {\n\ttaskId: string;\n\treason?: \"manual\" | \"threshold\" | \"overflow\";\n\tcustomInstructions?: string;\n\tboundary: ResultBoundary;\n}\n\nexport interface SummaryGenerationScope {\n\ttask: SummaryTask;\n\tsummaryContext: SummaryContext;\n}\n\nexport interface SummaryGenerationReady extends SummaryGenerationScope {\n\tnextAttempt: number;\n}\n\nexport interface SummaryGenerationEffectPending extends SummaryGenerationScope {\n\tattempt: number;\n\trequest?: { index: number; usageId: string };\n\tusageIds: string[];\n}\n\nexport interface SummaryGenerationRetryWait extends SummaryGenerationScope, RetryWait {}\n\nexport interface DeferredScope extends OperationScope {\n\tstepId: string;\n\tsourceEntryId: string;\n\tpoll: number;\n\tconfiguration: LaneConfiguration;\n\tstreamOptions: AgentHarnessStreamOptions;\n}\n\nexport interface StartingOperation extends OperationScope {\n\tat: \"starting\";\n}\n\nexport interface CheckpointOperation extends OperationScope, CheckpointData {\n\tat: \"checkpoint\";\n}\n\nexport interface AssistantReadyOperation extends OperationScope, AssistantGenerationScope {\n\tat: \"assistant.ready\";\n\tnextAttempt: number;\n}\n\nexport interface AssistantEffectPendingOperation extends OperationScope, AssistantGenerationScope {\n\tat: \"assistant.effect_pending\";\n\tattempt: number;\n\tresponseEntryId: string;\n\tusageId: string;\n\tintendedOutputLimit: number;\n\tcontextWindow: number;\n}\n\nexport interface AssistantRetryWaitOperation extends OperationScope, AssistantGenerationScope, RetryWait {\n\tat: \"assistant.retry_wait\";\n}\n\nexport interface ToolsOperation extends OperationScope {\n\tat: \"tools\";\n\tbatch: ToolBatch;\n}\n\nexport interface DeferredSuspendedOperation extends DeferredScope {\n\tat: \"deferred.suspended\";\n}\n\nexport interface DeferredEffectPendingOperation extends DeferredScope {\n\tat: \"deferred.effect_pending\";\n\tresponseEntryId: string;\n\tusageId: string;\n}\n\nexport interface SummaryDecidingOperation extends OperationScope {\n\tat: \"summary.deciding\";\n\ttask: SummaryTask;\n}\n\nexport interface SummaryReadyOperation extends OperationScope, SummaryGenerationReady {\n\tat: \"summary.ready\";\n}\n\nexport interface SummaryEffectPendingOperation extends OperationScope, SummaryGenerationEffectPending {\n\tat: \"summary.effect_pending\";\n}\n\nexport interface SummaryRetryWaitOperation extends OperationScope, SummaryGenerationRetryWait {\n\tat: \"summary.retry_wait\";\n}\n\nexport interface NavigationReadyToCommitOperation extends OperationScope {\n\tat: \"navigation.ready_to_commit\";\n\t/** Unsummarized navigation may target the branch root (null). */\n\ttargetId: string | null;\n\tlabel?: string;\n}\n\n/** Flat durable operation state: exactly 13 family-neutral dispatcher leaves. */\nexport type OperationState =\n\t| StartingOperation\n\t| CheckpointOperation\n\t| AssistantReadyOperation\n\t| AssistantEffectPendingOperation\n\t| AssistantRetryWaitOperation\n\t| ToolsOperation\n\t| DeferredSuspendedOperation\n\t| DeferredEffectPendingOperation\n\t| SummaryDecidingOperation\n\t| SummaryReadyOperation\n\t| SummaryEffectPendingOperation\n\t| SummaryRetryWaitOperation\n\t| NavigationReadyToCommitOperation;\n\nexport type OperationAt = OperationState[\"at\"];\n\n/** Copy only the uniform operation scope when constructing a successor leaf. */\nexport function operationScopeOf(state: OperationState): OperationScope {\n\treturn {\n\t\tcontrol: state.control,\n\t\tsettings: state.settings,\n\t\tlatestAssistantEntryId: state.latestAssistantEntryId,\n\t};\n}\n\nexport type Operation = { meta: OperationMeta; state: OperationState };\n\nexport interface LaneState {\n\tcurrentOperationId: string | null;\n\tlastOperationId: string | null;\n\tinbox: InboxItem[];\n}\n\nexport type PendingEntry =\n\t| { type: \"message\"; payload: AgentMessage }\n\t| { type: \"custom\"; customType: string; payload?: JsonValue };\n\nexport interface DurableFileOperations {\n\tread: string[];\n\twritten: string[];\n\tedited: string[];\n}\n\nexport type DurableStructuralPreparation =\n\t| {\n\t\t\tkind: \"compaction\";\n\t\t\tmessagesToSummarize: CompactionPreparation[\"messagesToSummarize\"];\n\t\t\tturnPrefixMessages: CompactionPreparation[\"turnPrefixMessages\"];\n\t\t\tretainedTail: CompactionPreparation[\"retainedTail\"];\n\t\t\tisSplitTurn: boolean;\n\t\t\ttokensBefore: number;\n\t\t\tpreviousSummary?: string;\n\t\t\tfileOps: DurableFileOperations;\n\t\t\tsettings: CompactionSettings;\n\t }\n\t| {\n\t\t\tkind: \"branch_summary\";\n\t\t\tmessages: BranchPreparation[\"messages\"];\n\t\t\tfileOps: DurableFileOperations;\n\t\t\ttotalTokens: number;\n\t };\n\nexport interface UsageRow {\n\tid: string;\n\tseq: number;\n\tusage: Usage;\n\tentryId?: string;\n\tadjustment: boolean;\n\tdetails?: JsonValue;\n}\n\nexport interface EntryWrite {\n\tkind: \"entry\";\n\tentry: NewEntry;\n}\n\nexport interface UsageWrite {\n\tkind: \"usage\";\n\trow: Omit<UsageRow, \"seq\">;\n}\n\nexport type Write = EntryWrite | UsageWrite | ValueWrite | ListWrite;\n\nexport interface CommitResult {\n\tfirstSeq: number;\n\tseqs: number[];\n\ttimestamp: number;\n\t/** Session totals immediately after this commit was applied. */\n\tstats: SessionStats;\n}\n\nexport interface EntryStructure {\n\tid: string;\n\tparentId: string | null;\n\tseq: number;\n\ttimestamp: number;\n\ttype: EntryType;\n\tcustomType?: string;\n}\n\nexport interface EntryCursor {\n\tseq: number;\n}\n\nexport interface BranchScan {\n\tstart?: string;\n\tstopAtType?: EntryType;\n\tstopAtId?: string;\n\ttype?: EntryType;\n\tcustomType?: string;\n\torder?: \"newestFirst\" | \"oldestFirst\";\n\tlimit?: number;\n\tcursor?: EntryCursor;\n}\n\nexport type StorageBranchScan = BranchScan & { start: string };\n\nexport interface EntryScan {\n\ttype?: EntryType;\n\tcustomType?: string;\n\tfromSeq?: number;\n\ttoSeq?: number;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface UsageScan {\n\tfromSeq?: number;\n\ttoSeq?: number;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface SessionStats {\n\tmessageCount: number;\n\tusage: Usage;\n}\n\nexport interface Storage {\n\tcommit(writes: Write[], context: Context): Promise<CommitResult>;\n\tgetEntries(ids: string[], context: Context): Promise<Map<string, Entry>>;\n\tgetValue<T>(address: Value<T>, context: Context): Promise<StoredValue<T> | undefined>;\n\tscanValues<T>(prefix: Value<T>, context: Context): Promise<StoredValue<T>[]>;\n\treadList<T>(\n\t\taddress: ValueList<T>,\n\t\toptions: ListReadOptions | undefined,\n\t\tcontext: Context,\n\t): Promise<ListElement<T>[]>;\n\tscanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;\n\tscanBranchStructure(query: StorageBranchScan, context: Context): Promise<EntryStructure[]>;\n\tscanEntries(query: EntryScan, context: Context): Promise<Entry[]>;\n\tscanUsage(query: UsageScan, context: Context): Promise<UsageRow[]>;\n\tgetStats(context: Context): Promise<SessionStats>;\n\tclose(context: Context): Promise<void>;\n}\n\nexport interface SessionMetadata {\n\tid: string;\n\tcreatedAt: number;\n\tstorageVersion: number;\n\tcwd?: string;\n\tparentSessionId?: string;\n\tlegacyParentSessionPath?: string;\n}\n\nexport interface IdGenerator {\n\tnext(timestampMs?: number): string;\n}\n\nexport interface EntryQuery {\n\ttype?: EntryType;\n\tcustomType?: string;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n\tcursor?: EntryCursor;\n}\n\nexport interface SessionReader {\n\tgetEntries(ids: string[], context: Context): Promise<Map<string, Entry>>;\n\tgetStats(context: Context): Promise<SessionStats>;\n\tgetValue<T>(address: Value<T>, context: Context): Promise<StoredValue<T> | undefined>;\n\tscanValues<T>(prefix: Value<T>, context: Context): Promise<StoredValue<T>[]>;\n\treadList<T>(\n\t\taddress: ValueList<T>,\n\t\toptions: ListReadOptions | undefined,\n\t\tcontext: Context,\n\t): Promise<ListElement<T>[]>;\n\t/** Scan a branch from an explicit entry while this reader capability remains valid. */\n\tscanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;\n}\n\n/** Exclusive keyless mutation barrier for one Session. */\nexport interface SessionMutation extends SessionReader {\n\t/** Exactly zero or one commit attempt. A second attempt rejects. */\n\tcommit(writes: Write[], context: Context): Promise<CommitResult>;\n\t/** Wait for any commit attempt, invalidate the capability, and release the barrier. */\n\tend(context: Context): Promise<void>;\n}\n\n/** Callback-scoped mutation capability without authority to release its Session barrier. */\nexport type SessionMutator = Omit<SessionMutation, \"end\">;\n\nexport type SessionMutationCallback<T> = (mutator: SessionMutator, context: Context) => T | Promise<T>;\n\nexport interface Branch {\n\treadonly name: string;\n\tgetTipId(context: Context): Promise<string | null>;\n\tfindEntries(query: BranchScan | undefined, context: Context): Promise<Entry[]>;\n\tfindEntry(query: BranchScan | undefined, context: Context): Promise<Entry | undefined>;\n\tappendMessage(message: AgentMessage, context: Context): Promise<string>;\n\tappendCustomEntry(customType: string, data: JsonValue | undefined, context: Context): Promise<string>;\n}\n\nexport interface Session<TMetadata extends SessionMetadata = SessionMetadata> extends SessionReader {\n\treadonly metadata: TMetadata;\n\treadonly idGenerator: IdGenerator;\n\tgetEntry(id: string, context: Context): Promise<Entry | undefined>;\n\tgetStats(context: Context): Promise<SessionStats>;\n\tgetName(context: Context): Promise<string | undefined>;\n\tgetLabel(targetId: string, context: Context): Promise<string | undefined>;\n\tfindEntries(query: EntryQuery | undefined, context: Context): Promise<Entry[]>;\n\tfindEntry(query: EntryQuery | undefined, context: Context): Promise<Entry | undefined>;\n\tbranch(name: string, context: Context): Promise<Branch | undefined>;\n\tcreateBranch(name: string, at: string | null, context: Context): Promise<Branch>;\n\tbeginMutation(context: Context): Promise<SessionMutation>;\n\t/**\n\t * Trusted exclusive callback over the Session mutation line. Calling a public Session writer from\n\t * this callback queues it behind the callback; awaiting that nested writer therefore deadlocks.\n\t * Use the supplied mutator for the callback's sole commit.\n\t */\n\tmutate<T>(mutation: SessionMutationCallback<T>, context: Context): Promise<T>;\n\tsetValue<T>(address: Value<T>, next: NoInfer<T>, context: Context): Promise<void>;\n\tdeleteValue<T>(address: Value<T>, context: Context): Promise<void>;\n\tappendList<T>(address: ValueList<T>, element: NoInfer<T>, context: Context): Promise<void>;\n\tdeleteList<T>(address: ValueList<T>, context: Context): Promise<void>;\n\tsetName(name: string | undefined, context: Context): Promise<void>;\n\tsetLabel(targetId: string, label: string | undefined, context: Context): Promise<void>;\n\tclose(context: Context): Promise<void>;\n}\n\nexport interface SessionCreateOptions {\n\tid?: string;\n\tparentSessionId?: string;\n}\n\nexport type ForkOptions =\n\t| {\n\t\t\t/**\n\t\t\t * Copy one path from a complete configured source AgentLane under the same\n\t\t\t * Branch name, with copied configuration and fresh idle lane state.\n\t\t\t */\n\t\t\tscope: \"branch\";\n\t\t\t/** Source Branch to copy. */\n\t\t\tbranch: string;\n\t\t\t/** Entry on the source Branch's current tip ancestry. Defaults to the current tip. */\n\t\t\tentryId?: string;\n\t\t\t/**\n\t\t\t * Whether the fork includes the selected entry or stops at its parent.\n\t\t\t * Defaults to including the selected entry.\n\t\t\t */\n\t\t\tposition?: \"before\" | \"at\";\n\t\t\t/** Optional destination session id. */\n\t\t\tid?: string;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * Copy the whole conversation tree and every Branch tip. Each configured\n\t\t\t * AgentLane copies configuration plus fresh idle state; data-only Branches\n\t\t\t * remain data-only. Operation/pending/result/usage state is excluded.\n\t\t\t */\n\t\t\tscope: \"tree\";\n\t\t\t/** Optional destination session id. */\n\t\t\tid?: string;\n\t };\n\nexport interface SessionRepo<\n\tTMetadata extends SessionMetadata = SessionMetadata,\n\tTCreateOptions extends { id?: string; parentSessionId?: string } = SessionCreateOptions,\n\tTListOptions = void,\n> {\n\tcreate(options: TCreateOptions, context: Context): Promise<Session<TMetadata>>;\n\topen(metadata: TMetadata, context: Context): Promise<Session<TMetadata>>;\n\tlist(options: TListOptions | undefined, context: Context): Promise<TMetadata[]>;\n\tdelete(metadata: TMetadata, context: Context): Promise<void>;\n\tfork(source: TMetadata, options: ForkOptions, context: Context): Promise<Session<TMetadata>>;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/harness/session/types.ts"],"names":[],"mappings":"AA4UA,gFAAgF;AAChF,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACrD,OAAO;QACN,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;KACpD,CAAC;AACH,CAAC","sourcesContent":["import type { JsonValue } from \"@earendil-works/chord\";\nimport type { AssistantMessage, StopReason, Usage } from \"@earendil-works/pi-ai\";\nimport type { AgentMessage, QueueMode, ThinkingLevel } from \"../../types.ts\";\nimport type { BranchPreparation } from \"../compaction/branch-summarization.ts\";\nimport type { CompactionPreparation, CompactionSettings } from \"../compaction/compaction.ts\";\nimport type { Context } from \"../context.ts\";\nimport type { AgentHarnessStreamOptions } from \"../types.ts\";\nimport type { ListElement, ListReadOptions, ListWrite, StoredValue, Value, ValueList, ValueWrite } from \"./values.ts\";\n\nexport type { JsonValue } from \"@earendil-works/chord\";\n\nexport type SettledAssistantMessage = AssistantMessage & {\n\tstopReason: Exclude<StopReason, \"pending\">;\n};\n\nexport type EntryType = \"message\" | \"compaction\" | \"branch_summary\" | \"custom\";\n\nexport interface EntryBase {\n\tid: string;\n\tparentId: string | null;\n\tseq: number;\n\ttimestamp: number;\n\ttype: EntryType;\n\tcustomType?: string;\n}\n\nexport interface MessageEntry extends EntryBase {\n\ttype: \"message\";\n\tmessage: AgentMessage;\n\tterminate?: true;\n}\n\nexport interface CompactionEntry extends EntryBase {\n\ttype: \"compaction\";\n\tsummary: string;\n\tretainedTail: AgentMessage[];\n\ttokensBefore: number;\n\tdetails?: JsonValue;\n\tusage?: Usage;\n\tfromHook: boolean;\n}\n\nexport interface BranchSummaryEntry extends EntryBase {\n\ttype: \"branch_summary\";\n\tfromId: string | null;\n\tsummary: string;\n\tdetails?: JsonValue;\n\tusage?: Usage;\n\tfromHook: boolean;\n}\n\nexport interface CustomEntry extends EntryBase {\n\ttype: \"custom\";\n\tcustomType: string;\n\tdata?: JsonValue;\n}\n\n/** Convert an application-defined custom entry into model context. */\nexport type EntryProjector = (\n\tentry: CustomEntry,\n\tcontext: Context,\n) => AgentMessage[] | undefined | Promise<AgentMessage[] | undefined>;\n\nexport type Entry = MessageEntry | CompactionEntry | BranchSummaryEntry | CustomEntry;\n\n/** Entry supplied to a transaction before storage assigns sequence and timestamp. */\nexport type NewEntry<TEntry extends Entry = Entry> = TEntry extends Entry ? Omit<TEntry, \"seq\" | \"timestamp\"> : never;\n\nexport interface LaneConfiguration {\n\tmodel: { provider: string; modelId: string };\n\tthinkingLevel: ThinkingLevel;\n\tactiveToolNames: string[];\n}\n\nexport interface OperationMeta {\n\toperationId: string;\n\tlane: string;\n\tsourceTipId: string | null;\n\tstartedAt: number;\n\tintent:\n\t\t| { kind: \"run\"; promptEntryIds: string[] }\n\t\t| { kind: \"compaction\"; customInstructions?: string }\n\t\t| {\n\t\t\t\tkind: \"navigation\";\n\t\t\t\ttargetId: string | null;\n\t\t\t\tsummarize: boolean;\n\t\t\t\tlabel?: string;\n\t\t\t\tcustomInstructions?: string;\n\t\t };\n}\n\nexport type Control =\n\t| { status: \"running\" }\n\t| {\n\t\t\tstatus: \"cancel_requested\";\n\t\t\trequestedAt: number;\n\t };\n\nexport interface OperationError {\n\tcode: string;\n\tmessage: string;\n\tdetails?: JsonValue;\n}\n\nexport type TerminalStatus = \"completed\" | \"declined\" | \"aborted\" | \"failed\";\n\n/** Immutable lane-lived observation record written by one terminal transaction. */\nexport interface OperationResultRecord {\n\toperationId: string;\n\tkind: OperationMeta[\"intent\"][\"kind\"];\n\tstatus: TerminalStatus;\n\terror?: OperationError;\n\tfromTipId: string | null;\n\ttipId: string | null;\n\tstartedAt: number;\n\tendedAt: number;\n}\n\nexport type Continuation =\n\t| { kind: \"need_assistant\"; overflowRecoveryUsed: boolean }\n\t| { kind: \"may_finish\"; includeFinalAssistant: boolean };\n\n/** Checkpoint payload; the flat leaf literal replaces the old nested phase tag. */\nexport interface CheckpointData {\n\tcontinuation: Continuation;\n\ttriggerEntryId: string;\n}\n\nexport type InboxItemKind = \"steer\" | \"followUp\" | \"nextRun\" | \"write\";\n\nexport interface InboxItem {\n\tentryId: string;\n\tkind: InboxItemKind;\n}\n\nexport interface NormalizedRetryPolicy {\n\tmaxAttempts: number;\n\tbaseDelayMs: number;\n\tmaxAgentDelayMs: number;\n}\n\nexport interface GenerationContext {\n\tstepId: string;\n\ttriggerEntryId: string;\n\tconfiguration: LaneConfiguration;\n\tstreamOptions: AgentHarnessStreamOptions;\n\tretryPolicy: NormalizedRetryPolicy;\n\toverflowRecoveryUsed: boolean;\n}\n\ninterface ToolCallSource {\n\t/** Zero-based index in the assistant message's complete content array, not a filtered tool-call ordinal. */\n\tsourceIndex: number;\n\tresultEntryId: string;\n}\n\nexport type ToolCall = ToolCallSource &\n\t(\n\t\t| { status: \"planned\" }\n\t\t| { status: \"effect_pending\"; replay: \"never\" | \"safe\" }\n\t\t| { status: \"outcome_ready\"; terminate: boolean }\n\t\t| { status: \"completed\"; terminate: boolean }\n\t);\n\nexport interface ToolBatch {\n\tassistantEntryId: string;\n\tconfiguration: LaneConfiguration;\n\tturnId: string;\n\tcalls: ToolCall[];\n}\n\nexport interface SummaryContext {\n\tresultEntryId: string;\n\tconfiguration: LaneConfiguration;\n\tstreamOptions: AgentHarnessStreamOptions;\n\tretryPolicy: NormalizedRetryPolicy;\n}\n\n/*\n * Durable operation state is one flat union with one family-neutral discriminator\n * per dispatcher leaf. ToolBatch/ToolCall remain the nested child collection state\n * machine, and cancellation stays orthogonal via Control.\n */\n\nexport interface Cancellable {\n\tcontrol: Control;\n}\n\nexport interface RunSettings {\n\tcompaction: CompactionSettings;\n\tsteeringMode: QueueMode;\n\tfollowUpMode: QueueMode;\n\ttoolExecution: \"sequential\" | \"parallel\";\n}\n\n/** Uniform scope carried by every operation leaf. */\nexport interface OperationScope extends Cancellable {\n\tsettings: RunSettings;\n\tlatestAssistantEntryId: string | null;\n}\n\n/** Shared backoff data for every retry-wait leaf. */\nexport interface RetryWait {\n\tnextAttempt: number;\n\tnotBefore: number;\n\terrorMessage: string;\n}\n\nexport interface AssistantGenerationScope {\n\tgenerationContext: GenerationContext;\n}\n\nexport type ResultBoundary =\n\t| { kind: \"resume_checkpoint\"; resumeAfter: CheckpointData }\n\t| { kind: \"finish\" }\n\t| { kind: \"commit_navigation\"; targetId: string; label?: string };\n\nexport interface SummaryTask {\n\ttaskId: string;\n\treason?: \"manual\" | \"threshold\" | \"overflow\";\n\tcustomInstructions?: string;\n\tboundary: ResultBoundary;\n}\n\nexport interface SummaryGenerationScope {\n\ttask: SummaryTask;\n\tsummaryContext: SummaryContext;\n}\n\nexport interface SummaryGenerationReady extends SummaryGenerationScope {\n\tnextAttempt: number;\n}\n\nexport interface SummaryGenerationEffectPending extends SummaryGenerationScope {\n\tattempt: number;\n\trequest?: { index: number; usageId: string };\n\tusageIds: string[];\n}\n\nexport interface SummaryGenerationRetryWait extends SummaryGenerationScope, RetryWait {}\n\nexport interface DeferredScope extends OperationScope {\n\tstepId: string;\n\tsourceEntryId: string;\n\tpoll: number;\n\tconfiguration: LaneConfiguration;\n\tstreamOptions: AgentHarnessStreamOptions;\n}\n\nexport interface StartingOperation extends OperationScope {\n\tat: \"starting\";\n}\n\nexport interface CheckpointOperation extends OperationScope, CheckpointData {\n\tat: \"checkpoint\";\n}\n\nexport interface AssistantReadyOperation extends OperationScope, AssistantGenerationScope {\n\tat: \"assistant.ready\";\n\tnextAttempt: number;\n}\n\nexport interface AssistantEffectPendingOperation extends OperationScope, AssistantGenerationScope {\n\tat: \"assistant.effect_pending\";\n\tattempt: number;\n\tresponseEntryId: string;\n\tusageId: string;\n\tintendedOutputLimit: number;\n\tcontextWindow: number;\n}\n\nexport interface AssistantRetryWaitOperation extends OperationScope, AssistantGenerationScope, RetryWait {\n\tat: \"assistant.retry_wait\";\n}\n\nexport interface ToolsOperation extends OperationScope {\n\tat: \"tools\";\n\tbatch: ToolBatch;\n}\n\nexport interface DeferredSuspendedOperation extends DeferredScope {\n\tat: \"deferred.suspended\";\n}\n\nexport interface DeferredEffectPendingOperation extends DeferredScope {\n\tat: \"deferred.effect_pending\";\n\tresponseEntryId: string;\n\tusageId: string;\n}\n\nexport interface SummaryDecidingOperation extends OperationScope {\n\tat: \"summary.deciding\";\n\ttask: SummaryTask;\n}\n\nexport interface SummaryReadyOperation extends OperationScope, SummaryGenerationReady {\n\tat: \"summary.ready\";\n}\n\nexport interface SummaryEffectPendingOperation extends OperationScope, SummaryGenerationEffectPending {\n\tat: \"summary.effect_pending\";\n}\n\nexport interface SummaryRetryWaitOperation extends OperationScope, SummaryGenerationRetryWait {\n\tat: \"summary.retry_wait\";\n}\n\nexport interface NavigationReadyToCommitOperation extends OperationScope {\n\tat: \"navigation.ready_to_commit\";\n\t/** Unsummarized navigation may target the branch root (null). */\n\ttargetId: string | null;\n\tlabel?: string;\n}\n\n/** Flat durable operation state: exactly 13 family-neutral dispatcher leaves. */\nexport type OperationState =\n\t| StartingOperation\n\t| CheckpointOperation\n\t| AssistantReadyOperation\n\t| AssistantEffectPendingOperation\n\t| AssistantRetryWaitOperation\n\t| ToolsOperation\n\t| DeferredSuspendedOperation\n\t| DeferredEffectPendingOperation\n\t| SummaryDecidingOperation\n\t| SummaryReadyOperation\n\t| SummaryEffectPendingOperation\n\t| SummaryRetryWaitOperation\n\t| NavigationReadyToCommitOperation;\n\nexport type OperationAt = OperationState[\"at\"];\n\n/** Copy only the uniform operation scope when constructing a successor leaf. */\nexport function operationScopeOf(state: OperationState): OperationScope {\n\treturn {\n\t\tcontrol: state.control,\n\t\tsettings: state.settings,\n\t\tlatestAssistantEntryId: state.latestAssistantEntryId,\n\t};\n}\n\nexport type Operation = { meta: OperationMeta; state: OperationState };\n\nexport interface LaneState {\n\tcurrentOperationId: string | null;\n\tlastOperationId: string | null;\n\tinbox: InboxItem[];\n}\n\nexport type PendingEntry =\n\t| { type: \"message\"; payload: AgentMessage }\n\t| { type: \"custom\"; customType: string; payload?: JsonValue };\n\nexport interface DurableFileOperations {\n\tread: string[];\n\twritten: string[];\n\tedited: string[];\n}\n\nexport type DurableStructuralPreparation =\n\t| {\n\t\t\tkind: \"compaction\";\n\t\t\tmessagesToSummarize: CompactionPreparation[\"messagesToSummarize\"];\n\t\t\tturnPrefixMessages: CompactionPreparation[\"turnPrefixMessages\"];\n\t\t\tretainedTail: CompactionPreparation[\"retainedTail\"];\n\t\t\tisSplitTurn: boolean;\n\t\t\ttokensBefore: number;\n\t\t\tpreviousSummary?: string;\n\t\t\tfileOps: DurableFileOperations;\n\t\t\tsettings: CompactionSettings;\n\t }\n\t| {\n\t\t\tkind: \"branch_summary\";\n\t\t\tmessages: BranchPreparation[\"messages\"];\n\t\t\tfileOps: DurableFileOperations;\n\t\t\ttotalTokens: number;\n\t };\n\nexport interface UsageRow {\n\tid: string;\n\tseq: number;\n\tusage: Usage;\n\tentryId?: string;\n\tadjustment: boolean;\n\tdetails?: JsonValue;\n}\n\nexport interface EntryWrite {\n\tkind: \"entry\";\n\tentry: NewEntry;\n}\n\nexport interface UsageWrite {\n\tkind: \"usage\";\n\trow: Omit<UsageRow, \"seq\">;\n}\n\nexport type Write = EntryWrite | UsageWrite | ValueWrite | ListWrite;\n\nexport interface CommitResult {\n\tfirstSeq: number;\n\tseqs: number[];\n\ttimestamp: number;\n\t/** Session totals immediately after this commit was applied. */\n\tstats: SessionStats;\n}\n\nexport interface EntryStructure {\n\tid: string;\n\tparentId: string | null;\n\tseq: number;\n\ttimestamp: number;\n\ttype: EntryType;\n\tcustomType?: string;\n}\n\nexport interface EntryCursor {\n\tseq: number;\n}\n\nexport interface BranchScan {\n\tstart?: string;\n\tstopAtType?: EntryType;\n\tstopAtId?: string;\n\ttype?: EntryType;\n\tcustomType?: string;\n\torder?: \"newestFirst\" | \"oldestFirst\";\n\tlimit?: number;\n\tcursor?: EntryCursor;\n}\n\nexport type StorageBranchScan = BranchScan & { start: string };\n\nexport interface EntryScan {\n\ttype?: EntryType;\n\tcustomType?: string;\n\tfromSeq?: number;\n\ttoSeq?: number;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface UsageScan {\n\tfromSeq?: number;\n\ttoSeq?: number;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface SessionStats {\n\tmessageCount: number;\n\tusage: Usage;\n}\n\nexport interface Storage {\n\tcommit(writes: Write[], context: Context): Promise<CommitResult>;\n\tgetEntries(ids: string[], context: Context): Promise<Map<string, Entry>>;\n\tgetValue<T>(address: Value<T>, context: Context): Promise<StoredValue<T> | undefined>;\n\tscanValues<T>(prefix: Value<T>, context: Context): Promise<StoredValue<T>[]>;\n\treadList<T>(\n\t\taddress: ValueList<T>,\n\t\toptions: ListReadOptions | undefined,\n\t\tcontext: Context,\n\t): Promise<ListElement<T>[]>;\n\tscanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;\n\tscanBranchStructure(query: StorageBranchScan, context: Context): Promise<EntryStructure[]>;\n\tscanEntries(query: EntryScan, context: Context): Promise<Entry[]>;\n\tscanUsage(query: UsageScan, context: Context): Promise<UsageRow[]>;\n\tgetStats(context: Context): Promise<SessionStats>;\n\tclose(context: Context): Promise<void>;\n}\n\nexport interface SessionMetadata {\n\tid: string;\n\tcreatedAt: number;\n\tstorageVersion: number;\n\tcwd?: string;\n\tparentSessionId?: string;\n\tlegacyParentSessionPath?: string;\n}\n\nexport interface IdGenerator {\n\tnext(timestampMs?: number): string;\n}\n\nexport interface EntryQuery {\n\ttype?: EntryType;\n\tcustomType?: string;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n\tcursor?: EntryCursor;\n}\n\nexport interface SessionReader {\n\tgetEntries(ids: string[], context: Context): Promise<Map<string, Entry>>;\n\tgetStats(context: Context): Promise<SessionStats>;\n\tgetValue<T>(address: Value<T>, context: Context): Promise<StoredValue<T> | undefined>;\n\tscanValues<T>(prefix: Value<T>, context: Context): Promise<StoredValue<T>[]>;\n\treadList<T>(\n\t\taddress: ValueList<T>,\n\t\toptions: ListReadOptions | undefined,\n\t\tcontext: Context,\n\t): Promise<ListElement<T>[]>;\n\t/** Scan a branch from an explicit entry while this reader capability remains valid. */\n\tscanBranch(query: StorageBranchScan, context: Context): Promise<Entry[]>;\n}\n\n/** Exclusive keyless mutation barrier for one Session. */\nexport interface SessionMutation extends SessionReader {\n\t/** Exactly zero or one commit attempt. A second attempt rejects. */\n\tcommit(writes: Write[], context: Context): Promise<CommitResult>;\n\t/** Wait for any commit attempt, invalidate the capability, and release the barrier. */\n\tend(context: Context): Promise<void>;\n}\n\n/** Callback-scoped mutation capability without authority to release its Session barrier. */\nexport type SessionMutator = Omit<SessionMutation, \"end\">;\n\nexport type SessionMutationCallback<T> = (mutator: SessionMutator, context: Context) => T | Promise<T>;\n\nexport interface Branch {\n\treadonly name: string;\n\tgetTipId(context: Context): Promise<string | null>;\n\tfindEntries(query: BranchScan | undefined, context: Context): Promise<Entry[]>;\n\tfindEntry(query: BranchScan | undefined, context: Context): Promise<Entry | undefined>;\n\tappendMessage(message: AgentMessage, context: Context): Promise<string>;\n\tappendCustomEntry(customType: string, data: JsonValue | undefined, context: Context): Promise<string>;\n}\n\nexport interface Session<TMetadata extends SessionMetadata = SessionMetadata> extends SessionReader {\n\treadonly metadata: TMetadata;\n\treadonly idGenerator: IdGenerator;\n\tgetEntry(id: string, context: Context): Promise<Entry | undefined>;\n\tgetStats(context: Context): Promise<SessionStats>;\n\tgetName(context: Context): Promise<string | undefined>;\n\tgetLabel(targetId: string, context: Context): Promise<string | undefined>;\n\tfindEntries(query: EntryQuery | undefined, context: Context): Promise<Entry[]>;\n\tfindEntry(query: EntryQuery | undefined, context: Context): Promise<Entry | undefined>;\n\tbranch(name: string, context: Context): Promise<Branch | undefined>;\n\tcreateBranch(name: string, at: string | null, context: Context): Promise<Branch>;\n\tbeginMutation(context: Context): Promise<SessionMutation>;\n\t/**\n\t * Trusted exclusive callback over the Session mutation line. Calling a public Session writer from\n\t * this callback queues it behind the callback; awaiting that nested writer therefore deadlocks.\n\t * Use the supplied mutator for the callback's sole commit.\n\t */\n\tmutate<T>(mutation: SessionMutationCallback<T>, context: Context): Promise<T>;\n\tsetValue<T>(address: Value<T>, next: NoInfer<T>, context: Context): Promise<void>;\n\tdeleteValue<T>(address: Value<T>, context: Context): Promise<void>;\n\tappendList<T>(address: ValueList<T>, element: NoInfer<T>, context: Context): Promise<void>;\n\tdeleteList<T>(address: ValueList<T>, context: Context): Promise<void>;\n\tsetName(name: string | undefined, context: Context): Promise<void>;\n\tsetLabel(targetId: string, label: string | undefined, context: Context): Promise<void>;\n\tclose(context: Context): Promise<void>;\n}\n\nexport interface SessionCreateOptions {\n\tid?: string;\n\tparentSessionId?: string;\n}\n\nexport type ForkOptions =\n\t| {\n\t\t\t/**\n\t\t\t * Copy one path from a complete configured source AgentLane under the same\n\t\t\t * Branch name, with copied configuration and fresh idle lane state.\n\t\t\t */\n\t\t\tscope: \"branch\";\n\t\t\t/** Source Branch to copy. */\n\t\t\tbranch: string;\n\t\t\t/** Entry on the source Branch's current tip ancestry. Defaults to the current tip. */\n\t\t\tentryId?: string;\n\t\t\t/**\n\t\t\t * Whether the fork includes the selected entry or stops at its parent.\n\t\t\t * Defaults to including the selected entry.\n\t\t\t */\n\t\t\tposition?: \"before\" | \"at\";\n\t\t\t/** Optional destination session id. */\n\t\t\tid?: string;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * Copy the whole conversation tree and every Branch tip. Each configured\n\t\t\t * AgentLane copies configuration plus fresh idle state; data-only Branches\n\t\t\t * remain data-only. Operation/pending/result/usage state is excluded.\n\t\t\t */\n\t\t\tscope: \"tree\";\n\t\t\t/** Optional destination session id. */\n\t\t\tid?: string;\n\t };\n\nexport interface SessionRepo<\n\tTMetadata extends SessionMetadata = SessionMetadata,\n\tTCreateOptions extends { id?: string; parentSessionId?: string } = SessionCreateOptions,\n\tTListOptions = void,\n> {\n\tcreate(options: TCreateOptions, context: Context): Promise<Session<TMetadata>>;\n\topen(metadata: TMetadata, context: Context): Promise<Session<TMetadata>>;\n\tlist(options: TListOptions | undefined, context: Context): Promise<TMetadata[]>;\n\tdelete(metadata: TMetadata, context: Context): Promise<void>;\n\tfork(source: TMetadata, options: ForkOptions, context: Context): Promise<Session<TMetadata>>;\n}\n"]}
@@ -82,8 +82,8 @@ export declare const operationState: (operationId: string) => Value<OperationSta
82
82
  export declare const operationToolArgs: (operationId: string, stepId: string, sourceIndex: number) => Value<Record<string, JsonValue>>;
83
83
  export declare const operationToolMemo: (operationId: string, invocationId: string, name: string) => Value<JsonValue>;
84
84
  export declare const operationPreparation: (operationId: string, taskId: string) => Value<DurableStructuralPreparation>;
85
- export declare const operationToolArgsPrefix: (operationId: string, stepId?: string | undefined) => Value<Record<string, JsonValue>>;
86
- export declare const operationToolMemoPrefix: (operationId: string, invocationId?: string | undefined) => Value<JsonValue>;
85
+ export declare const operationToolArgsPrefix: (operationId: string, stepId?: string) => Value<Record<string, JsonValue>>;
86
+ export declare const operationToolMemoPrefix: (operationId: string, invocationId?: string) => Value<JsonValue>;
87
87
  export declare const operationPreparationPrefix: (operationId: string) => Value<DurableStructuralPreparation>;
88
88
  export declare const pendingEntry: (entryId: string) => Value<PendingEntry>;
89
89
  export declare const pendingToolOutput: (operationId: string, invocationId: string) => Value<AgentToolResult<unknown>>;
@@ -1 +1 @@
1
- {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/harness/session/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EA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MessageFrame } from \"@earendil-works/pi-ai\";\nimport type { AgentToolResult } from \"../../types.ts\";\nimport type {\n\tDurableStructuralPreparation,\n\tJsonValue,\n\tLaneConfiguration,\n\tLaneState,\n\tOperationMeta,\n\tOperationResultRecord,\n\tOperationState,\n\tPendingEntry,\n} from \"./types.ts\";\n\ndeclare const storedValueType: unique symbol;\n\nexport interface StoredAddressBase {\n\treadonly namespace: string;\n\treadonly key: string;\n\treadonly kind: \"value\" | \"list\";\n}\n\nexport interface Value<T> extends StoredAddressBase {\n\treadonly kind: \"value\";\n\treadonly [storedValueType]?: (value: T) => T;\n}\n\nexport interface ValueList<T> extends StoredAddressBase {\n\treadonly kind: \"list\";\n\treadonly [storedValueType]?: (value: T) => T;\n}\n\nexport interface StoredValue<T> {\n\taddress: Value<T>;\n\tvalue: T;\n\tseq: number;\n}\n\nexport interface ListElement<T> {\n\tseq: number;\n\tvalue: T;\n}\n\nexport interface ListCursor {\n\tseq: number;\n}\n\nexport interface ListReadOptions {\n\tcursor?: ListCursor;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface ResolvedListReadOptions {\n\tcursor?: ListCursor;\n\torder: \"asc\" | \"desc\";\n\tlimit: number;\n}\n\nexport interface ValueSetWrite {\n\tkind: \"value\";\n\top: \"set\";\n\tnamespace: string;\n\tkey: string;\n\tvalue: unknown;\n}\n\nexport interface ValueDeleteWrite {\n\tkind: \"value\";\n\top: \"delete\";\n\tnamespace: string;\n\tkey: string;\n}\n\nexport interface ListAppendWrite {\n\tkind: \"list\";\n\top: \"append\";\n\tnamespace: string;\n\tkey: string;\n\tvalue: unknown;\n}\n\nexport interface ListDeleteWrite {\n\tkind: \"list\";\n\top: \"delete\";\n\tnamespace: string;\n\tkey: string;\n}\n\nexport type ValueWrite = ValueSetWrite | ValueDeleteWrite;\nexport type ListWrite = ListAppendWrite | ListDeleteWrite;\n\nfunction validateAddress(namespace: string, key: string): void {\n\tif (namespace.length === 0) throw new TypeError(\"Value namespace must not be empty\");\n\tif (namespace.includes(\"\\u0000\")) throw new TypeError(\"Value namespace must not contain \\\\u0000\");\n\tif (key.includes(\"\\u0000\")) throw new TypeError(\"Value key must not contain \\\\u0000\");\n}\n\nexport function value<T>(namespace: string, key = \"\"): Value<T> {\n\tvalidateAddress(namespace, key);\n\treturn Object.freeze({ namespace, key, kind: \"value\" }) as Value<T>;\n}\n\nexport function list<T>(namespace: string, key = \"\"): ValueList<T> {\n\tvalidateAddress(namespace, key);\n\treturn Object.freeze({ namespace, key, kind: \"list\" }) as ValueList<T>;\n}\n\nexport function setValue<T>(address: Value<T>, next: NoInfer<T>): ValueSetWrite {\n\treturn {\n\t\tkind: \"value\",\n\t\top: \"set\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t\tvalue: next,\n\t};\n}\n\nexport function deleteValue<T>(address: Value<T>): ValueDeleteWrite {\n\treturn {\n\t\tkind: \"value\",\n\t\top: \"delete\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t};\n}\n\nexport function appendList<T>(address: ValueList<T>, element: NoInfer<T>): ListAppendWrite {\n\treturn {\n\t\tkind: \"list\",\n\t\top: \"append\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t\tvalue: element,\n\t};\n}\n\nexport function deleteList<T>(address: ValueList<T>): ListDeleteWrite {\n\treturn {\n\t\tkind: \"list\",\n\t\top: \"delete\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t};\n}\n\nexport function resolveListReadOptions(options: ListReadOptions = {}): ResolvedListReadOptions {\n\tconst requestedLimit = options.limit ?? 1_000;\n\tif (!Number.isSafeInteger(requestedLimit) || requestedLimit <= 0) {\n\t\tthrow new TypeError(\"List read limit must be a positive safe integer\");\n\t}\n\treturn {\n\t\t...(options.cursor === undefined ? {} : { cursor: options.cursor }),\n\t\torder: options.order ?? \"asc\",\n\t\tlimit: Math.min(requestedLimit, 10_000),\n\t};\n}\n\nexport const branchTip = (branch: string) => value<string | null>(\"pi.branch.tip\", branch);\nexport const branchTipInventoryPrefix = () => value<string | null>(\"pi.branch.tip\");\nexport const laneConfig = (lane: string) => value<LaneConfiguration>(\"pi.lane.config\", lane);\nexport const laneState = (lane: string) => value<LaneState>(\"pi.lane.state\", lane);\nexport const operationResult = (operationId: string) => value<OperationResultRecord>(\"pi.result\", operationId);\n\nexport const operationMeta = (operationId: string) => value<OperationMeta>(\"pi.op.meta\", operationId);\nexport const operationState = (operationId: string) => value<OperationState>(\"pi.op.state\", operationId);\nexport const operationToolArgs = (operationId: string, stepId: string, sourceIndex: number) =>\n\tvalue<Record<string, JsonValue>>(\"pi.op.tool_args\", `${operationId}:${stepId}:${sourceIndex}`);\nexport const operationToolMemo = (operationId: string, invocationId: string, name: string) =>\n\tvalue<JsonValue>(\"pi.op.tool_memo\", `${operationId}:${invocationId}:${name}`);\nexport const operationPreparation = (operationId: string, taskId: string) =>\n\tvalue<DurableStructuralPreparation>(\"pi.op.preparation\", `${operationId}:${taskId}`);\n\nexport const operationToolArgsPrefix = (operationId: string, stepId?: string) =>\n\tvalue<Record<string, JsonValue>>(\n\t\t\"pi.op.tool_args\",\n\t\tstepId === undefined ? `${operationId}:` : `${operationId}:${stepId}:`,\n\t);\nexport const operationToolMemoPrefix = (operationId: string, invocationId?: string) =>\n\tvalue<JsonValue>(\n\t\t\"pi.op.tool_memo\",\n\t\tinvocationId === undefined ? `${operationId}:` : `${operationId}:${invocationId}:`,\n\t);\nexport const operationPreparationPrefix = (operationId: string) =>\n\tvalue<DurableStructuralPreparation>(\"pi.op.preparation\", `${operationId}:`);\n\nexport const pendingEntry = (entryId: string) => value<PendingEntry>(\"pi.pending.entry\", entryId);\nexport const pendingToolOutput = (operationId: string, invocationId: string) =>\n\tvalue<AgentToolResult<unknown>>(\"pi.pending.tool_output\", `${operationId}:${invocationId}`);\nexport const pendingAssistantFrames = (operationId: string, responseEntryId: string) =>\n\tlist<AssistantMessageFrame>(\"pi.pending.assistant_frame\", `${operationId}:${responseEntryId}`);\nexport const pendingToolOutputPrefix = (operationId: string) =>\n\tvalue<AgentToolResult<unknown>>(\"pi.pending.tool_output\", `${operationId}:`);\n\nexport const sessionName = value<string>(\"pi.session.name\");\nexport const entryLabel = (entryId: string) => value<string>(\"pi.entry.label\", entryId);\n"]}
1
+ {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/harness/session/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EACX,4BAA4B,EAC5B,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,YAAY,EACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,KAAK,CAAC,CAAC,CAAE,SAAQ,iBAAiB;IAClD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,SAAS,CAAC,CAAC,CAAE,SAAQ,iBAAiB;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC7B,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,KAAK,EA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,CAAC;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,YAAoB,EAAE,EAAE,CAC9E,KAAK,CAA2B,wBAAwB,EAAE,GAAG,WAAW,IAAI,YAAY,EAAE,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,WAAmB,EAAE,eAAuB,EAAE,EAAE,CACtF,IAAI,CAAwB,4BAA4B,EAAE,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC,CAAC;AAChG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,WAAmB,EAAE,EAAE,CAC9D,KAAK,CAA2B,wBAAwB,EAAE,GAAG,WAAW,GAAG,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAS,iBAAiB,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,KAAK,CAAS,gBAAgB,EAAE,OAAO,CAAC,CAAC","sourcesContent":["import type { AssistantMessageFrame } from \"@earendil-works/pi-ai\";\nimport type { AgentToolResult } from \"../../types.ts\";\nimport type {\n\tDurableStructuralPreparation,\n\tJsonValue,\n\tLaneConfiguration,\n\tLaneState,\n\tOperationMeta,\n\tOperationResultRecord,\n\tOperationState,\n\tPendingEntry,\n} from \"./types.ts\";\n\ndeclare const storedValueType: unique symbol;\n\nexport interface StoredAddressBase {\n\treadonly namespace: string;\n\treadonly key: string;\n\treadonly kind: \"value\" | \"list\";\n}\n\nexport interface Value<T> extends StoredAddressBase {\n\treadonly kind: \"value\";\n\treadonly [storedValueType]?: (value: T) => T;\n}\n\nexport interface ValueList<T> extends StoredAddressBase {\n\treadonly kind: \"list\";\n\treadonly [storedValueType]?: (value: T) => T;\n}\n\nexport interface StoredValue<T> {\n\taddress: Value<T>;\n\tvalue: T;\n\tseq: number;\n}\n\nexport interface ListElement<T> {\n\tseq: number;\n\tvalue: T;\n}\n\nexport interface ListCursor {\n\tseq: number;\n}\n\nexport interface ListReadOptions {\n\tcursor?: ListCursor;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface ResolvedListReadOptions {\n\tcursor?: ListCursor;\n\torder: \"asc\" | \"desc\";\n\tlimit: number;\n}\n\nexport interface ValueSetWrite {\n\tkind: \"value\";\n\top: \"set\";\n\tnamespace: string;\n\tkey: string;\n\tvalue: unknown;\n}\n\nexport interface ValueDeleteWrite {\n\tkind: \"value\";\n\top: \"delete\";\n\tnamespace: string;\n\tkey: string;\n}\n\nexport interface ListAppendWrite {\n\tkind: \"list\";\n\top: \"append\";\n\tnamespace: string;\n\tkey: string;\n\tvalue: unknown;\n}\n\nexport interface ListDeleteWrite {\n\tkind: \"list\";\n\top: \"delete\";\n\tnamespace: string;\n\tkey: string;\n}\n\nexport type ValueWrite = ValueSetWrite | ValueDeleteWrite;\nexport type ListWrite = ListAppendWrite | ListDeleteWrite;\n\nfunction validateAddress(namespace: string, key: string): void {\n\tif (namespace.length === 0) throw new TypeError(\"Value namespace must not be empty\");\n\tif (namespace.includes(\"\\u0000\")) throw new TypeError(\"Value namespace must not contain \\\\u0000\");\n\tif (key.includes(\"\\u0000\")) throw new TypeError(\"Value key must not contain \\\\u0000\");\n}\n\nexport function value<T>(namespace: string, key = \"\"): Value<T> {\n\tvalidateAddress(namespace, key);\n\treturn Object.freeze({ namespace, key, kind: \"value\" }) as Value<T>;\n}\n\nexport function list<T>(namespace: string, key = \"\"): ValueList<T> {\n\tvalidateAddress(namespace, key);\n\treturn Object.freeze({ namespace, key, kind: \"list\" }) as ValueList<T>;\n}\n\nexport function setValue<T>(address: Value<T>, next: NoInfer<T>): ValueSetWrite {\n\treturn {\n\t\tkind: \"value\",\n\t\top: \"set\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t\tvalue: next,\n\t};\n}\n\nexport function deleteValue<T>(address: Value<T>): ValueDeleteWrite {\n\treturn {\n\t\tkind: \"value\",\n\t\top: \"delete\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t};\n}\n\nexport function appendList<T>(address: ValueList<T>, element: NoInfer<T>): ListAppendWrite {\n\treturn {\n\t\tkind: \"list\",\n\t\top: \"append\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t\tvalue: element,\n\t};\n}\n\nexport function deleteList<T>(address: ValueList<T>): ListDeleteWrite {\n\treturn {\n\t\tkind: \"list\",\n\t\top: \"delete\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t};\n}\n\nexport function resolveListReadOptions(options: ListReadOptions = {}): ResolvedListReadOptions {\n\tconst requestedLimit = options.limit ?? 1_000;\n\tif (!Number.isSafeInteger(requestedLimit) || requestedLimit <= 0) {\n\t\tthrow new TypeError(\"List read limit must be a positive safe integer\");\n\t}\n\treturn {\n\t\t...(options.cursor === undefined ? {} : { cursor: options.cursor }),\n\t\torder: options.order ?? \"asc\",\n\t\tlimit: Math.min(requestedLimit, 10_000),\n\t};\n}\n\nexport const branchTip = (branch: string) => value<string | null>(\"pi.branch.tip\", branch);\nexport const branchTipInventoryPrefix = () => value<string | null>(\"pi.branch.tip\");\nexport const laneConfig = (lane: string) => value<LaneConfiguration>(\"pi.lane.config\", lane);\nexport const laneState = (lane: string) => value<LaneState>(\"pi.lane.state\", lane);\nexport const operationResult = (operationId: string) => value<OperationResultRecord>(\"pi.result\", operationId);\n\nexport const operationMeta = (operationId: string) => value<OperationMeta>(\"pi.op.meta\", operationId);\nexport const operationState = (operationId: string) => value<OperationState>(\"pi.op.state\", operationId);\nexport const operationToolArgs = (operationId: string, stepId: string, sourceIndex: number) =>\n\tvalue<Record<string, JsonValue>>(\"pi.op.tool_args\", `${operationId}:${stepId}:${sourceIndex}`);\nexport const operationToolMemo = (operationId: string, invocationId: string, name: string) =>\n\tvalue<JsonValue>(\"pi.op.tool_memo\", `${operationId}:${invocationId}:${name}`);\nexport const operationPreparation = (operationId: string, taskId: string) =>\n\tvalue<DurableStructuralPreparation>(\"pi.op.preparation\", `${operationId}:${taskId}`);\n\nexport const operationToolArgsPrefix = (operationId: string, stepId?: string) =>\n\tvalue<Record<string, JsonValue>>(\n\t\t\"pi.op.tool_args\",\n\t\tstepId === undefined ? `${operationId}:` : `${operationId}:${stepId}:`,\n\t);\nexport const operationToolMemoPrefix = (operationId: string, invocationId?: string) =>\n\tvalue<JsonValue>(\n\t\t\"pi.op.tool_memo\",\n\t\tinvocationId === undefined ? `${operationId}:` : `${operationId}:${invocationId}:`,\n\t);\nexport const operationPreparationPrefix = (operationId: string) =>\n\tvalue<DurableStructuralPreparation>(\"pi.op.preparation\", `${operationId}:`);\n\nexport const pendingEntry = (entryId: string) => value<PendingEntry>(\"pi.pending.entry\", entryId);\nexport const pendingToolOutput = (operationId: string, invocationId: string) =>\n\tvalue<AgentToolResult<unknown>>(\"pi.pending.tool_output\", `${operationId}:${invocationId}`);\nexport const pendingAssistantFrames = (operationId: string, responseEntryId: string) =>\n\tlist<AssistantMessageFrame>(\"pi.pending.assistant_frame\", `${operationId}:${responseEntryId}`);\nexport const pendingToolOutputPrefix = (operationId: string) =>\n\tvalue<AgentToolResult<unknown>>(\"pi.pending.tool_output\", `${operationId}:`);\n\nexport const sessionName = value<string>(\"pi.session.name\");\nexport const entryLabel = (entryId: string) => value<string>(\"pi.entry.label\", entryId);\n"]}
1
+ {"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/harness/session/values.ts"],"names":[],"mappings":"AA2FA,SAAS,eAAe,CAAC,SAAiB,EAAE,GAAW;IACtD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;IACrF,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;IAClG,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;AACvF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AC,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,KAAK,CAAe,kBAAkB,EAAE,OAAO,CAAC,CAAC;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,YAAoB,EAAE,EAAE,CAC9E,KAAK,CAA2B,wBAAwB,EAAE,GAAG,WAAW,IAAI,YAAY,EAAE,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,WAAmB,EAAE,eAAuB,EAAE,EAAE,CACtF,IAAI,CAAwB,4BAA4B,EAAE,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC,CAAC;AAChG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,WAAmB,EAAE,EAAE,CAC9D,KAAK,CAA2B,wBAAwB,EAAE,GAAG,WAAW,GAAG,CAAC,CAAC;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAS,iBAAiB,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,KAAK,CAAS,gBAAgB,EAAE,OAAO,CAAC,CAAC","sourcesContent":["import type { AssistantMessageFrame } from \"@earendil-works/pi-ai\";\nimport type { AgentToolResult } from \"../../types.ts\";\nimport type {\n\tDurableStructuralPreparation,\n\tJsonValue,\n\tLaneConfiguration,\n\tLaneState,\n\tOperationMeta,\n\tOperationResultRecord,\n\tOperationState,\n\tPendingEntry,\n} from \"./types.ts\";\n\ndeclare const storedValueType: unique symbol;\n\nexport interface StoredAddressBase {\n\treadonly namespace: string;\n\treadonly key: string;\n\treadonly kind: \"value\" | \"list\";\n}\n\nexport interface Value<T> extends StoredAddressBase {\n\treadonly kind: \"value\";\n\treadonly [storedValueType]?: (value: T) => T;\n}\n\nexport interface ValueList<T> extends StoredAddressBase {\n\treadonly kind: \"list\";\n\treadonly [storedValueType]?: (value: T) => T;\n}\n\nexport interface StoredValue<T> {\n\taddress: Value<T>;\n\tvalue: T;\n\tseq: number;\n}\n\nexport interface ListElement<T> {\n\tseq: number;\n\tvalue: T;\n}\n\nexport interface ListCursor {\n\tseq: number;\n}\n\nexport interface ListReadOptions {\n\tcursor?: ListCursor;\n\torder?: \"asc\" | \"desc\";\n\tlimit?: number;\n}\n\nexport interface ResolvedListReadOptions {\n\tcursor?: ListCursor;\n\torder: \"asc\" | \"desc\";\n\tlimit: number;\n}\n\nexport interface ValueSetWrite {\n\tkind: \"value\";\n\top: \"set\";\n\tnamespace: string;\n\tkey: string;\n\tvalue: unknown;\n}\n\nexport interface ValueDeleteWrite {\n\tkind: \"value\";\n\top: \"delete\";\n\tnamespace: string;\n\tkey: string;\n}\n\nexport interface ListAppendWrite {\n\tkind: \"list\";\n\top: \"append\";\n\tnamespace: string;\n\tkey: string;\n\tvalue: unknown;\n}\n\nexport interface ListDeleteWrite {\n\tkind: \"list\";\n\top: \"delete\";\n\tnamespace: string;\n\tkey: string;\n}\n\nexport type ValueWrite = ValueSetWrite | ValueDeleteWrite;\nexport type ListWrite = ListAppendWrite | ListDeleteWrite;\n\nfunction validateAddress(namespace: string, key: string): void {\n\tif (namespace.length === 0) throw new TypeError(\"Value namespace must not be empty\");\n\tif (namespace.includes(\"\\u0000\")) throw new TypeError(\"Value namespace must not contain \\\\u0000\");\n\tif (key.includes(\"\\u0000\")) throw new TypeError(\"Value key must not contain \\\\u0000\");\n}\n\nexport function value<T>(namespace: string, key = \"\"): Value<T> {\n\tvalidateAddress(namespace, key);\n\treturn Object.freeze({ namespace, key, kind: \"value\" }) as Value<T>;\n}\n\nexport function list<T>(namespace: string, key = \"\"): ValueList<T> {\n\tvalidateAddress(namespace, key);\n\treturn Object.freeze({ namespace, key, kind: \"list\" }) as ValueList<T>;\n}\n\nexport function setValue<T>(address: Value<T>, next: NoInfer<T>): ValueSetWrite {\n\treturn {\n\t\tkind: \"value\",\n\t\top: \"set\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t\tvalue: next,\n\t};\n}\n\nexport function deleteValue<T>(address: Value<T>): ValueDeleteWrite {\n\treturn {\n\t\tkind: \"value\",\n\t\top: \"delete\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t};\n}\n\nexport function appendList<T>(address: ValueList<T>, element: NoInfer<T>): ListAppendWrite {\n\treturn {\n\t\tkind: \"list\",\n\t\top: \"append\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t\tvalue: element,\n\t};\n}\n\nexport function deleteList<T>(address: ValueList<T>): ListDeleteWrite {\n\treturn {\n\t\tkind: \"list\",\n\t\top: \"delete\",\n\t\tnamespace: address.namespace,\n\t\tkey: address.key,\n\t};\n}\n\nexport function resolveListReadOptions(options: ListReadOptions = {}): ResolvedListReadOptions {\n\tconst requestedLimit = options.limit ?? 1_000;\n\tif (!Number.isSafeInteger(requestedLimit) || requestedLimit <= 0) {\n\t\tthrow new TypeError(\"List read limit must be a positive safe integer\");\n\t}\n\treturn {\n\t\t...(options.cursor === undefined ? {} : { cursor: options.cursor }),\n\t\torder: options.order ?? \"asc\",\n\t\tlimit: Math.min(requestedLimit, 10_000),\n\t};\n}\n\nexport const branchTip = (branch: string) => value<string | null>(\"pi.branch.tip\", branch);\nexport const branchTipInventoryPrefix = () => value<string | null>(\"pi.branch.tip\");\nexport const laneConfig = (lane: string) => value<LaneConfiguration>(\"pi.lane.config\", lane);\nexport const laneState = (lane: string) => value<LaneState>(\"pi.lane.state\", lane);\nexport const operationResult = (operationId: string) => value<OperationResultRecord>(\"pi.result\", operationId);\n\nexport const operationMeta = (operationId: string) => value<OperationMeta>(\"pi.op.meta\", operationId);\nexport const operationState = (operationId: string) => value<OperationState>(\"pi.op.state\", operationId);\nexport const operationToolArgs = (operationId: string, stepId: string, sourceIndex: number) =>\n\tvalue<Record<string, JsonValue>>(\"pi.op.tool_args\", `${operationId}:${stepId}:${sourceIndex}`);\nexport const operationToolMemo = (operationId: string, invocationId: string, name: string) =>\n\tvalue<JsonValue>(\"pi.op.tool_memo\", `${operationId}:${invocationId}:${name}`);\nexport const operationPreparation = (operationId: string, taskId: string) =>\n\tvalue<DurableStructuralPreparation>(\"pi.op.preparation\", `${operationId}:${taskId}`);\n\nexport const operationToolArgsPrefix = (operationId: string, stepId?: string) =>\n\tvalue<Record<string, JsonValue>>(\n\t\t\"pi.op.tool_args\",\n\t\tstepId === undefined ? `${operationId}:` : `${operationId}:${stepId}:`,\n\t);\nexport const operationToolMemoPrefix = (operationId: string, invocationId?: string) =>\n\tvalue<JsonValue>(\n\t\t\"pi.op.tool_memo\",\n\t\tinvocationId === undefined ? `${operationId}:` : `${operationId}:${invocationId}:`,\n\t);\nexport const operationPreparationPrefix = (operationId: string) =>\n\tvalue<DurableStructuralPreparation>(\"pi.op.preparation\", `${operationId}:`);\n\nexport const pendingEntry = (entryId: string) => value<PendingEntry>(\"pi.pending.entry\", entryId);\nexport const pendingToolOutput = (operationId: string, invocationId: string) =>\n\tvalue<AgentToolResult<unknown>>(\"pi.pending.tool_output\", `${operationId}:${invocationId}`);\nexport const pendingAssistantFrames = (operationId: string, responseEntryId: string) =>\n\tlist<AssistantMessageFrame>(\"pi.pending.assistant_frame\", `${operationId}:${responseEntryId}`);\nexport const pendingToolOutputPrefix = (operationId: string) =>\n\tvalue<AgentToolResult<unknown>>(\"pi.pending.tool_output\", `${operationId}:`);\n\nexport const sessionName = value<string>(\"pi.session.name\");\nexport const entryLabel = (entryId: string) => value<string>(\"pi.entry.label\", entryId);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/harness/skills.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAA8B,KAAK,KAAK,EAAW,MAAM,YAAY,CAAC;AAQhG,MAAM,MAAM,mBAAmB,GAC5B,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,cAAc,GACd,kBAAkB,CAAC;AAEtB,6CAA6C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nimport { type ExecutionEnv, type FileInfo, type Result, type Skill, toError } from \"./types.ts\";\n\nconst MAX_NAME_LENGTH = 64;\nconst MAX_DESCRIPTION_LENGTH = 1024;\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nexport type SkillDiagnosticCode =\n\t| \"file_info_failed\"\n\t| \"list_failed\"\n\t| \"read_failed\"\n\t| \"parse_failed\"\n\t| \"invalid_metadata\";\n\n/** Warning produced while loading skills. */\nexport interface SkillDiagnostic {\n\t/** Diagnostic severity. Currently only warnings are emitted. */\n\ttype: \"warning\";\n\t/** Stable diagnostic code. */\n\tcode: SkillDiagnosticCode;\n\t/** Human-readable diagnostic message. */\n\tmessage: string;\n\t/** Path associated with the diagnostic. */\n\tpath: string;\n}\n\ninterface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\n/** Format a skill invocation prompt, optionally appending additional user instructions. */\nexport function formatSkillInvocation(skill: Skill, additionalInstructions?: string): string {\n\tconst skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${dirnameEnvPath(skill.filePath)}.\\n\\n${skill.content}\\n</skill>`;\n\treturn additionalInstructions ? `${skillBlock}\\n\\n${additionalInstructions}` : skillBlock;\n}\n\n/**\n * Load skills from one or more directories.\n *\n * Traverses directories recursively, loads `SKILL.md` files, loads direct root `.md` files with skill\n * frontmatter, honors ignore files, and returns diagnostics for invalid declared skill files. Missing input\n * directories are skipped.\n */\nexport async function loadSkills(\n\tenv: ExecutionEnv,\n\tdirs: string | string[],\n\tcontext: Context,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tfor (const dir of Array.isArray(dirs) ? dirs : [dirs]) {\n\t\tconst rootInfoResult = await env.fileInfo(dir, context);\n\t\tif (!rootInfoResult.ok) {\n\t\t\tif (rootInfoResult.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: rootInfoResult.error.message,\n\t\t\t\t\tpath: dir,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst rootInfo = rootInfoResult.value;\n\t\tif ((await resolveKind(env, rootInfo, diagnostics, context)) !== \"directory\") continue;\n\t\tconst result = await loadSkillsFromDirInternal(env, rootInfo.path, true, ignore(), rootInfo.path, context);\n\t\tskills.push(...result.skills);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\treturn { skills, diagnostics };\n}\n\n/**\n * Load skills from source-tagged directories.\n *\n * Source values are preserved exactly and attached to every loaded skill and diagnostic. The agent package does not\n * interpret source values; applications define their own provenance shape.\n */\nexport async function loadSourcedSkills<TSource, TSkill extends Skill = Skill>(\n\tenv: ExecutionEnv,\n\tinputs: Array<{ path: string; source: TSource }>,\n\tmapSkill: ((skill: Skill, source: TSource, context: Context) => TSkill) | undefined,\n\tcontext: Context,\n): Promise<{\n\tskills: Array<{ skill: TSkill; source: TSource }>;\n\tdiagnostics: Array<SkillDiagnostic & { source: TSource }>;\n}> {\n\tconst skills: Array<{ skill: TSkill; source: TSource }> = [];\n\tconst diagnostics: Array<SkillDiagnostic & { source: TSource }> = [];\n\tfor (const input of inputs) {\n\t\tconst result = await loadSkills(env, input.path, context);\n\t\tfor (const skill of result.skills) {\n\t\t\tskills.push({\n\t\t\t\tskill: mapSkill ? mapSkill(skill, input.source, context) : (skill as TSkill),\n\t\t\t\tsource: input.source,\n\t\t\t});\n\t\t}\n\t\tfor (const diagnostic of result.diagnostics) diagnostics.push({ ...diagnostic, source: input.source });\n\t}\n\treturn { skills, diagnostics };\n}\n\nasync function loadSkillsFromDirInternal(\n\tenv: ExecutionEnv,\n\tdir: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher: IgnoreMatcher,\n\trootDir: string,\n\tcontext: Context,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\n\tconst dirInfoResult = await env.fileInfo(dir, context);\n\tif (!dirInfoResult.ok) {\n\t\tif (dirInfoResult.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: dirInfoResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t}\n\t\treturn { skills, diagnostics };\n\t}\n\tconst dirInfo = dirInfoResult.value;\n\tif ((await resolveKind(env, dirInfo, diagnostics, context)) !== \"directory\") return { skills, diagnostics };\n\n\tawait addIgnoreRules(env, ignoreMatcher, dir, rootDir, diagnostics, context);\n\n\tconst entriesResult = await env.listDir(dir, context);\n\tif (!entriesResult.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"list_failed\", message: entriesResult.error.message, path: dir });\n\t\treturn { skills, diagnostics };\n\t}\n\tconst entries = entriesResult.value;\n\n\tfor (const entry of entries) {\n\t\tif (entry.name !== \"SKILL.md\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics, context);\n\t\tif (kind !== \"file\") continue;\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tif (ignoreMatcher.ignores(relPath)) continue;\n\n\t\tconst result = await loadSkillFromFile(env, fullPath, dirInfo.name, context);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t\treturn { skills, diagnostics };\n\t}\n\n\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics, context);\n\t\tif (!kind) continue;\n\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tconst ignorePath = kind === \"directory\" ? `${relPath}/` : relPath;\n\t\tif (ignoreMatcher.ignores(ignorePath)) continue;\n\n\t\tif (kind === \"directory\") {\n\t\t\tconst result = await loadSkillsFromDirInternal(env, fullPath, false, ignoreMatcher, rootDir, context);\n\t\t\tskills.push(...result.skills);\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (kind !== \"file\" || !includeRootFiles || !entry.name.endsWith(\".md\")) continue;\n\t\tconst result = await loadSkillFromFile(env, fullPath, dirInfo.name, context);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\n\treturn { skills, diagnostics };\n}\n\nasync function addIgnoreRules(\n\tenv: ExecutionEnv,\n\tig: IgnoreMatcher,\n\tdir: string,\n\trootDir: string,\n\tdiagnostics: SkillDiagnostic[],\n\tcontext: Context,\n): Promise<void> {\n\tconst relativeDir = relativeEnvPath(rootDir, dir);\n\tconst prefix = relativeDir ? `${relativeDir}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePathResult = await env.joinPath([dir, filename], context);\n\t\tif (!ignorePathResult.ok) {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: ignorePathResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst ignorePath = ignorePathResult.value;\n\t\tconst info = await env.fileInfo(ignorePath, context);\n\t\tif (!info.ok) {\n\t\t\tif (info.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: info.error.message,\n\t\t\t\t\tpath: ignorePath,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (info.value.kind !== \"file\") continue;\n\t\tconst content = await env.readTextFile(ignorePath, context);\n\t\tif (!content.ok) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: content.error.message, path: ignorePath });\n\t\t\tcontinue;\n\t\t}\n\t\tconst patterns = content.value\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t.filter((line): line is string => Boolean(line));\n\t\tif (patterns.length > 0) ig.add(patterns);\n\t}\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\tif (pattern.startsWith(\"/\")) pattern = pattern.slice(1);\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nasync function loadSkillFromFile(\n\tenv: ExecutionEnv,\n\tfilePath: string,\n\tparentDirName: string,\n\tcontext: Context,\n): Promise<{ skill: Skill | null; diagnostics: SkillDiagnostic[] }> {\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tconst isDeclaredSkill =\n\t\tfilePath\n\t\t\t.replace(/[\\\\/]+$/, \"\")\n\t\t\t.split(/[\\\\/]/)\n\t\t\t.pop() === \"SKILL.md\";\n\tconst rawContent = await env.readTextFile(filePath, context);\n\tif (!rawContent.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: rawContent.error.message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst parsed = parseFrontmatter<SkillFrontmatter>(rawContent.value);\n\tif (!parsed.ok) {\n\t\tif (isDeclaredSkill) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"parse_failed\", message: parsed.error.message, path: filePath });\n\t\t}\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst { frontmatter, body } = parsed.value;\n\tconst description = typeof frontmatter.description === \"string\" ? frontmatter.description : undefined;\n\tif (!isDeclaredSkill && (!description || description.trim() === \"\")) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tfor (const error of validateDescription(description)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tconst frontmatterName = typeof frontmatter.name === \"string\" ? frontmatter.name : undefined;\n\tconst name = frontmatterName || parentDirName;\n\tfor (const error of validateName(name, parentDirName)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tif (!description || description.trim() === \"\") {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\treturn {\n\t\tskill: {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tcontent: body,\n\t\t\tfilePath,\n\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n\nfunction validateName(name: string, parentDirName: string): string[] {\n\tconst errors: string[] = [];\n\tif (name !== parentDirName) errors.push(`name \"${name}\" does not match parent directory \"${parentDirName}\"`);\n\tif (name.length > MAX_NAME_LENGTH) errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(\"name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)\");\n\t}\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) errors.push(\"name must not start or end with a hyphen\");\n\tif (name.includes(\"--\")) errors.push(\"name must not contain consecutive hyphens\");\n\treturn errors;\n}\n\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\treturn errors;\n}\n\nfunction parseFrontmatter<T extends Record<string, unknown>>(\n\tcontent: string,\n): Result<{ frontmatter: T; body: string }, Error> {\n\ttry {\n\t\tconst normalized = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\t\tif (!normalized.startsWith(\"---\")) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\t\tif (endIndex === -1) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst yamlString = normalized.slice(4, endIndex);\n\t\tconst body = normalized.slice(endIndex + 4).trim();\n\t\treturn { ok: true, value: { frontmatter: (parse(yamlString) ?? {}) as T, body } };\n\t} catch (error) {\n\t\treturn { ok: false, error: toError(error) };\n\t}\n}\n\nasync function resolveKind(\n\tenv: ExecutionEnv,\n\tinfo: FileInfo,\n\tdiagnostics: SkillDiagnostic[],\n\tcontext: Context,\n): Promise<\"file\" | \"directory\" | undefined> {\n\tif (info.kind === \"file\" || info.kind === \"directory\") return info.kind;\n\tconst canonicalPath = await env.canonicalPath(info.path, context);\n\tif (!canonicalPath.ok) {\n\t\tif (canonicalPath.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: canonicalPath.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\tconst target = await env.fileInfo(canonicalPath.value, context);\n\tif (!target.ok) {\n\t\tif (target.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: target.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn target.value.kind === \"file\" || target.value.kind === \"directory\" ? target.value.kind : undefined;\n}\n\nfunction dirnameEnvPath(path: string): string {\n\tconst normalized = path.replace(/[\\\\/]+$/, \"\");\n\tconst separatorIndex = Math.max(normalized.lastIndexOf(\"/\"), normalized.lastIndexOf(\"\\\\\"));\n\tif (separatorIndex === 2 && normalized[1] === \":\") return normalized.slice(0, 3);\n\treturn separatorIndex <= 0 ? \"/\" : normalized.slice(0, separatorIndex);\n}\n\nfunction relativeEnvPath(root: string, path: string): string {\n\tconst normalizedRoot = root.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tconst normalizedPath = path.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tif (normalizedPath === normalizedRoot) return \"\";\n\treturn normalizedPath.startsWith(`${normalizedRoot}/`)\n\t\t? normalizedPath.slice(normalizedRoot.length + 1)\n\t\t: normalizedPath.replace(/^\\/+/, \"\");\n}\n"]}
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/harness/skills.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAA8B,KAAK,KAAK,EAAW,MAAM,YAAY,CAAC;AAQhG,MAAM,MAAM,mBAAmB,GAC5B,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,cAAc,GACd,kBAAkB,CAAC;AAEtB,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC/B,gEAAgE;IAChE,IAAI,EAAE,SAAS,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACb;AASD,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3F;AAED;;;;;;GAMG;AACH,wBAAs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UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3F,IAAI,cAAc,KAAK,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjF,OAAO,cAAc,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AAAA,CACvE;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,IAAY,EAAU;IAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,IAAI,cAAc,KAAK,cAAc;QAAE,OAAO,EAAE,CAAC;IACjD,OAAO,cAAc,CAAC,UAAU,CAAC,GAAG,cAAc,GAAG,CAAC;QACrD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QACjD,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAAA,CACtC","sourcesContent":["import ignore from \"ignore\";\nimport { parse } from \"yaml\";\nimport type { Context } from \"./context.ts\";\nimport { type ExecutionEnv, type FileInfo, type Result, type Skill, toError } from \"./types.ts\";\n\nconst MAX_NAME_LENGTH = 64;\nconst MAX_DESCRIPTION_LENGTH = 1024;\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nexport type SkillDiagnosticCode =\n\t| \"file_info_failed\"\n\t| \"list_failed\"\n\t| \"read_failed\"\n\t| \"parse_failed\"\n\t| \"invalid_metadata\";\n\n/** Warning produced while loading skills. */\nexport interface SkillDiagnostic {\n\t/** Diagnostic severity. Currently only warnings are emitted. */\n\ttype: \"warning\";\n\t/** Stable diagnostic code. */\n\tcode: SkillDiagnosticCode;\n\t/** Human-readable diagnostic message. */\n\tmessage: string;\n\t/** Path associated with the diagnostic. */\n\tpath: string;\n}\n\ninterface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\n/** Format a skill invocation prompt, optionally appending additional user instructions. */\nexport function formatSkillInvocation(skill: Skill, additionalInstructions?: string): string {\n\tconst skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${dirnameEnvPath(skill.filePath)}.\\n\\n${skill.content}\\n</skill>`;\n\treturn additionalInstructions ? `${skillBlock}\\n\\n${additionalInstructions}` : skillBlock;\n}\n\n/**\n * Load skills from one or more directories.\n *\n * Traverses directories recursively, loads `SKILL.md` files, loads direct root `.md` files with skill\n * frontmatter, honors ignore files, and returns diagnostics for invalid declared skill files. Missing input\n * directories are skipped.\n */\nexport async function loadSkills(\n\tenv: ExecutionEnv,\n\tdirs: string | string[],\n\tcontext: Context,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tfor (const dir of Array.isArray(dirs) ? dirs : [dirs]) {\n\t\tconst rootInfoResult = await env.fileInfo(dir, context);\n\t\tif (!rootInfoResult.ok) {\n\t\t\tif (rootInfoResult.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: rootInfoResult.error.message,\n\t\t\t\t\tpath: dir,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst rootInfo = rootInfoResult.value;\n\t\tif ((await resolveKind(env, rootInfo, diagnostics, context)) !== \"directory\") continue;\n\t\tconst result = await loadSkillsFromDirInternal(env, rootInfo.path, true, ignore(), rootInfo.path, context);\n\t\tskills.push(...result.skills);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\treturn { skills, diagnostics };\n}\n\n/**\n * Load skills from source-tagged directories.\n *\n * Source values are preserved exactly and attached to every loaded skill and diagnostic. The agent package does not\n * interpret source values; applications define their own provenance shape.\n */\nexport async function loadSourcedSkills<TSource, TSkill extends Skill = Skill>(\n\tenv: ExecutionEnv,\n\tinputs: Array<{ path: string; source: TSource }>,\n\tmapSkill: ((skill: Skill, source: TSource, context: Context) => TSkill) | undefined,\n\tcontext: Context,\n): Promise<{\n\tskills: Array<{ skill: TSkill; source: TSource }>;\n\tdiagnostics: Array<SkillDiagnostic & { source: TSource }>;\n}> {\n\tconst skills: Array<{ skill: TSkill; source: TSource }> = [];\n\tconst diagnostics: Array<SkillDiagnostic & { source: TSource }> = [];\n\tfor (const input of inputs) {\n\t\tconst result = await loadSkills(env, input.path, context);\n\t\tfor (const skill of result.skills) {\n\t\t\tskills.push({\n\t\t\t\tskill: mapSkill ? mapSkill(skill, input.source, context) : (skill as TSkill),\n\t\t\t\tsource: input.source,\n\t\t\t});\n\t\t}\n\t\tfor (const diagnostic of result.diagnostics) diagnostics.push({ ...diagnostic, source: input.source });\n\t}\n\treturn { skills, diagnostics };\n}\n\nasync function loadSkillsFromDirInternal(\n\tenv: ExecutionEnv,\n\tdir: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher: IgnoreMatcher,\n\trootDir: string,\n\tcontext: Context,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\n\tconst dirInfoResult = await env.fileInfo(dir, context);\n\tif (!dirInfoResult.ok) {\n\t\tif (dirInfoResult.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: dirInfoResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t}\n\t\treturn { skills, diagnostics };\n\t}\n\tconst dirInfo = dirInfoResult.value;\n\tif ((await resolveKind(env, dirInfo, diagnostics, context)) !== \"directory\") return { skills, diagnostics };\n\n\tawait addIgnoreRules(env, ignoreMatcher, dir, rootDir, diagnostics, context);\n\n\tconst entriesResult = await env.listDir(dir, context);\n\tif (!entriesResult.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"list_failed\", message: entriesResult.error.message, path: dir });\n\t\treturn { skills, diagnostics };\n\t}\n\tconst entries = entriesResult.value;\n\n\tfor (const entry of entries) {\n\t\tif (entry.name !== \"SKILL.md\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics, context);\n\t\tif (kind !== \"file\") continue;\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tif (ignoreMatcher.ignores(relPath)) continue;\n\n\t\tconst result = await loadSkillFromFile(env, fullPath, dirInfo.name, context);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t\treturn { skills, diagnostics };\n\t}\n\n\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics, context);\n\t\tif (!kind) continue;\n\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tconst ignorePath = kind === \"directory\" ? `${relPath}/` : relPath;\n\t\tif (ignoreMatcher.ignores(ignorePath)) continue;\n\n\t\tif (kind === \"directory\") {\n\t\t\tconst result = await loadSkillsFromDirInternal(env, fullPath, false, ignoreMatcher, rootDir, context);\n\t\t\tskills.push(...result.skills);\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (kind !== \"file\" || !includeRootFiles || !entry.name.endsWith(\".md\")) continue;\n\t\tconst result = await loadSkillFromFile(env, fullPath, dirInfo.name, context);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\n\treturn { skills, diagnostics };\n}\n\nasync function addIgnoreRules(\n\tenv: ExecutionEnv,\n\tig: IgnoreMatcher,\n\tdir: string,\n\trootDir: string,\n\tdiagnostics: SkillDiagnostic[],\n\tcontext: Context,\n): Promise<void> {\n\tconst relativeDir = relativeEnvPath(rootDir, dir);\n\tconst prefix = relativeDir ? `${relativeDir}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePathResult = await env.joinPath([dir, filename], context);\n\t\tif (!ignorePathResult.ok) {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: ignorePathResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst ignorePath = ignorePathResult.value;\n\t\tconst info = await env.fileInfo(ignorePath, context);\n\t\tif (!info.ok) {\n\t\t\tif (info.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: info.error.message,\n\t\t\t\t\tpath: ignorePath,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (info.value.kind !== \"file\") continue;\n\t\tconst content = await env.readTextFile(ignorePath, context);\n\t\tif (!content.ok) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: content.error.message, path: ignorePath });\n\t\t\tcontinue;\n\t\t}\n\t\tconst patterns = content.value\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t.filter((line): line is string => Boolean(line));\n\t\tif (patterns.length > 0) ig.add(patterns);\n\t}\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\tif (pattern.startsWith(\"/\")) pattern = pattern.slice(1);\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nasync function loadSkillFromFile(\n\tenv: ExecutionEnv,\n\tfilePath: string,\n\tparentDirName: string,\n\tcontext: Context,\n): Promise<{ skill: Skill | null; diagnostics: SkillDiagnostic[] }> {\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tconst isDeclaredSkill =\n\t\tfilePath\n\t\t\t.replace(/[\\\\/]+$/, \"\")\n\t\t\t.split(/[\\\\/]/)\n\t\t\t.pop() === \"SKILL.md\";\n\tconst rawContent = await env.readTextFile(filePath, context);\n\tif (!rawContent.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: rawContent.error.message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst parsed = parseFrontmatter<SkillFrontmatter>(rawContent.value);\n\tif (!parsed.ok) {\n\t\tif (isDeclaredSkill) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"parse_failed\", message: parsed.error.message, path: filePath });\n\t\t}\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst { frontmatter, body } = parsed.value;\n\tconst description = typeof frontmatter.description === \"string\" ? frontmatter.description : undefined;\n\tif (!isDeclaredSkill && (!description || description.trim() === \"\")) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tfor (const error of validateDescription(description)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tconst frontmatterName = typeof frontmatter.name === \"string\" ? frontmatter.name : undefined;\n\tconst name = frontmatterName || parentDirName;\n\tfor (const error of validateName(name, parentDirName)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tif (!description || description.trim() === \"\") {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\treturn {\n\t\tskill: {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tcontent: body,\n\t\t\tfilePath,\n\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n\nfunction validateName(name: string, parentDirName: string): string[] {\n\tconst errors: string[] = [];\n\tif (name !== parentDirName) errors.push(`name \"${name}\" does not match parent directory \"${parentDirName}\"`);\n\tif (name.length > MAX_NAME_LENGTH) errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(\"name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)\");\n\t}\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) errors.push(\"name must not start or end with a hyphen\");\n\tif (name.includes(\"--\")) errors.push(\"name must not contain consecutive hyphens\");\n\treturn errors;\n}\n\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\treturn errors;\n}\n\nfunction parseFrontmatter<T extends Record<string, unknown>>(\n\tcontent: string,\n): Result<{ frontmatter: T; body: string }, Error> {\n\ttry {\n\t\tconst normalized = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\t\tif (!normalized.startsWith(\"---\")) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\t\tif (endIndex === -1) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst yamlString = normalized.slice(4, endIndex);\n\t\tconst body = normalized.slice(endIndex + 4).trim();\n\t\treturn { ok: true, value: { frontmatter: (parse(yamlString) ?? {}) as T, body } };\n\t} catch (error) {\n\t\treturn { ok: false, error: toError(error) };\n\t}\n}\n\nasync function resolveKind(\n\tenv: ExecutionEnv,\n\tinfo: FileInfo,\n\tdiagnostics: SkillDiagnostic[],\n\tcontext: Context,\n): Promise<\"file\" | \"directory\" | undefined> {\n\tif (info.kind === \"file\" || info.kind === \"directory\") return info.kind;\n\tconst canonicalPath = await env.canonicalPath(info.path, context);\n\tif (!canonicalPath.ok) {\n\t\tif (canonicalPath.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: canonicalPath.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\tconst target = await env.fileInfo(canonicalPath.value, context);\n\tif (!target.ok) {\n\t\tif (target.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: target.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn target.value.kind === \"file\" || target.value.kind === \"directory\" ? target.value.kind : undefined;\n}\n\nfunction dirnameEnvPath(path: string): string {\n\tconst normalized = path.replace(/[\\\\/]+$/, \"\");\n\tconst separatorIndex = Math.max(normalized.lastIndexOf(\"/\"), normalized.lastIndexOf(\"\\\\\"));\n\tif (separatorIndex === 2 && normalized[1] === \":\") return normalized.slice(0, 3);\n\treturn separatorIndex <= 0 ? \"/\" : normalized.slice(0, separatorIndex);\n}\n\nfunction relativeEnvPath(root: string, path: string): string {\n\tconst normalizedRoot = root.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tconst normalizedPath = path.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tif (normalizedPath === normalizedRoot) return \"\";\n\treturn normalizedPath.startsWith(`${normalizedRoot}/`)\n\t\t? normalizedPath.slice(normalizedRoot.length + 1)\n\t\t: normalizedPath.replace(/^\\/+/, \"\");\n}\n"]}
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/harness/skills.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAA6D,OAAO,EAAE,MAAM,YAAY,CAAC;AAEhG,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AA8BjE,2FAA2F;AAC3F,MAAM,UAAU,qBAAqB,CAAC,KAAY,EAAE,sBAA+B;IAClF,MAAM,UAAU,GAAG,gBAAgB,KAAK,CAAC,IAAI,eAAe,KAAK,CAAC,QAAQ,kCAAkC,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,KAAK,CAAC,OAAO,YAAY,CAAC;IAC5K,OAAO,sBAAsB,CAAC,CAAC,CAAC,GAAG,UAAU,OAAO,sBAAsB,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC3F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC/B,GAAiB,EACjB,IAAuB,EAC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AAE,cAAc,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,IAAY;IAClD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,IAAI,cAAc,KAAK,cAAc;QAAE,OAAO,EAAE,CAAC;IACjD,OAAO,cAAc,CAAC,UAAU,CAAC,GAAG,cAAc,GAAG,CAAC;QACrD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QACjD,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import ignore from \"ignore\";\nimport { parse } from \"yaml\";\nimport type { Context } from \"./context.ts\";\nimport { type ExecutionEnv, type FileInfo, type Result, type Skill, toError } from \"./types.ts\";\n\nconst MAX_NAME_LENGTH = 64;\nconst MAX_DESCRIPTION_LENGTH = 1024;\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\ntype IgnoreMatcher = ReturnType<typeof ignore>;\n\nexport type SkillDiagnosticCode =\n\t| \"file_info_failed\"\n\t| \"list_failed\"\n\t| \"read_failed\"\n\t| \"parse_failed\"\n\t| \"invalid_metadata\";\n\n/** Warning produced while loading skills. */\nexport interface SkillDiagnostic {\n\t/** Diagnostic severity. Currently only warnings are emitted. */\n\ttype: \"warning\";\n\t/** Stable diagnostic code. */\n\tcode: SkillDiagnosticCode;\n\t/** Human-readable diagnostic message. */\n\tmessage: string;\n\t/** Path associated with the diagnostic. */\n\tpath: string;\n}\n\ninterface SkillFrontmatter {\n\tname?: string;\n\tdescription?: string;\n\t\"disable-model-invocation\"?: boolean;\n\t[key: string]: unknown;\n}\n\n/** Format a skill invocation prompt, optionally appending additional user instructions. */\nexport function formatSkillInvocation(skill: Skill, additionalInstructions?: string): string {\n\tconst skillBlock = `<skill name=\"${skill.name}\" location=\"${skill.filePath}\">\\nReferences are relative to ${dirnameEnvPath(skill.filePath)}.\\n\\n${skill.content}\\n</skill>`;\n\treturn additionalInstructions ? `${skillBlock}\\n\\n${additionalInstructions}` : skillBlock;\n}\n\n/**\n * Load skills from one or more directories.\n *\n * Traverses directories recursively, loads `SKILL.md` files, loads direct root `.md` files with skill\n * frontmatter, honors ignore files, and returns diagnostics for invalid declared skill files. Missing input\n * directories are skipped.\n */\nexport async function loadSkills(\n\tenv: ExecutionEnv,\n\tdirs: string | string[],\n\tcontext: Context,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tfor (const dir of Array.isArray(dirs) ? dirs : [dirs]) {\n\t\tconst rootInfoResult = await env.fileInfo(dir, context);\n\t\tif (!rootInfoResult.ok) {\n\t\t\tif (rootInfoResult.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: rootInfoResult.error.message,\n\t\t\t\t\tpath: dir,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst rootInfo = rootInfoResult.value;\n\t\tif ((await resolveKind(env, rootInfo, diagnostics, context)) !== \"directory\") continue;\n\t\tconst result = await loadSkillsFromDirInternal(env, rootInfo.path, true, ignore(), rootInfo.path, context);\n\t\tskills.push(...result.skills);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\treturn { skills, diagnostics };\n}\n\n/**\n * Load skills from source-tagged directories.\n *\n * Source values are preserved exactly and attached to every loaded skill and diagnostic. The agent package does not\n * interpret source values; applications define their own provenance shape.\n */\nexport async function loadSourcedSkills<TSource, TSkill extends Skill = Skill>(\n\tenv: ExecutionEnv,\n\tinputs: Array<{ path: string; source: TSource }>,\n\tmapSkill: ((skill: Skill, source: TSource, context: Context) => TSkill) | undefined,\n\tcontext: Context,\n): Promise<{\n\tskills: Array<{ skill: TSkill; source: TSource }>;\n\tdiagnostics: Array<SkillDiagnostic & { source: TSource }>;\n}> {\n\tconst skills: Array<{ skill: TSkill; source: TSource }> = [];\n\tconst diagnostics: Array<SkillDiagnostic & { source: TSource }> = [];\n\tfor (const input of inputs) {\n\t\tconst result = await loadSkills(env, input.path, context);\n\t\tfor (const skill of result.skills) {\n\t\t\tskills.push({\n\t\t\t\tskill: mapSkill ? mapSkill(skill, input.source, context) : (skill as TSkill),\n\t\t\t\tsource: input.source,\n\t\t\t});\n\t\t}\n\t\tfor (const diagnostic of result.diagnostics) diagnostics.push({ ...diagnostic, source: input.source });\n\t}\n\treturn { skills, diagnostics };\n}\n\nasync function loadSkillsFromDirInternal(\n\tenv: ExecutionEnv,\n\tdir: string,\n\tincludeRootFiles: boolean,\n\tignoreMatcher: IgnoreMatcher,\n\trootDir: string,\n\tcontext: Context,\n): Promise<{ skills: Skill[]; diagnostics: SkillDiagnostic[] }> {\n\tconst skills: Skill[] = [];\n\tconst diagnostics: SkillDiagnostic[] = [];\n\n\tconst dirInfoResult = await env.fileInfo(dir, context);\n\tif (!dirInfoResult.ok) {\n\t\tif (dirInfoResult.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: dirInfoResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t}\n\t\treturn { skills, diagnostics };\n\t}\n\tconst dirInfo = dirInfoResult.value;\n\tif ((await resolveKind(env, dirInfo, diagnostics, context)) !== \"directory\") return { skills, diagnostics };\n\n\tawait addIgnoreRules(env, ignoreMatcher, dir, rootDir, diagnostics, context);\n\n\tconst entriesResult = await env.listDir(dir, context);\n\tif (!entriesResult.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"list_failed\", message: entriesResult.error.message, path: dir });\n\t\treturn { skills, diagnostics };\n\t}\n\tconst entries = entriesResult.value;\n\n\tfor (const entry of entries) {\n\t\tif (entry.name !== \"SKILL.md\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics, context);\n\t\tif (kind !== \"file\") continue;\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tif (ignoreMatcher.ignores(relPath)) continue;\n\n\t\tconst result = await loadSkillFromFile(env, fullPath, dirInfo.name, context);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t\treturn { skills, diagnostics };\n\t}\n\n\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\tif (entry.name.startsWith(\".\") || entry.name === \"node_modules\") continue;\n\t\tconst fullPath = entry.path;\n\t\tconst kind = await resolveKind(env, entry, diagnostics, context);\n\t\tif (!kind) continue;\n\n\t\tconst relPath = relativeEnvPath(rootDir, fullPath);\n\t\tconst ignorePath = kind === \"directory\" ? `${relPath}/` : relPath;\n\t\tif (ignoreMatcher.ignores(ignorePath)) continue;\n\n\t\tif (kind === \"directory\") {\n\t\t\tconst result = await loadSkillsFromDirInternal(env, fullPath, false, ignoreMatcher, rootDir, context);\n\t\t\tskills.push(...result.skills);\n\t\t\tdiagnostics.push(...result.diagnostics);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (kind !== \"file\" || !includeRootFiles || !entry.name.endsWith(\".md\")) continue;\n\t\tconst result = await loadSkillFromFile(env, fullPath, dirInfo.name, context);\n\t\tif (result.skill) skills.push(result.skill);\n\t\tdiagnostics.push(...result.diagnostics);\n\t}\n\n\treturn { skills, diagnostics };\n}\n\nasync function addIgnoreRules(\n\tenv: ExecutionEnv,\n\tig: IgnoreMatcher,\n\tdir: string,\n\trootDir: string,\n\tdiagnostics: SkillDiagnostic[],\n\tcontext: Context,\n): Promise<void> {\n\tconst relativeDir = relativeEnvPath(rootDir, dir);\n\tconst prefix = relativeDir ? `${relativeDir}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePathResult = await env.joinPath([dir, filename], context);\n\t\tif (!ignorePathResult.ok) {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: ignorePathResult.error.message,\n\t\t\t\tpath: dir,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst ignorePath = ignorePathResult.value;\n\t\tconst info = await env.fileInfo(ignorePath, context);\n\t\tif (!info.ok) {\n\t\t\tif (info.error.code !== \"not_found\") {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"warning\",\n\t\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\t\tmessage: info.error.message,\n\t\t\t\t\tpath: ignorePath,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (info.value.kind !== \"file\") continue;\n\t\tconst content = await env.readTextFile(ignorePath, context);\n\t\tif (!content.ok) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: content.error.message, path: ignorePath });\n\t\t\tcontinue;\n\t\t}\n\t\tconst patterns = content.value\n\t\t\t.split(/\\r?\\n/)\n\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t.filter((line): line is string => Boolean(line));\n\t\tif (patterns.length > 0) ig.add(patterns);\n\t}\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tpattern = pattern.slice(1);\n\t}\n\tif (pattern.startsWith(\"/\")) pattern = pattern.slice(1);\n\tconst prefixed = prefix ? `${prefix}${pattern}` : pattern;\n\treturn negated ? `!${prefixed}` : prefixed;\n}\n\nasync function loadSkillFromFile(\n\tenv: ExecutionEnv,\n\tfilePath: string,\n\tparentDirName: string,\n\tcontext: Context,\n): Promise<{ skill: Skill | null; diagnostics: SkillDiagnostic[] }> {\n\tconst diagnostics: SkillDiagnostic[] = [];\n\tconst isDeclaredSkill =\n\t\tfilePath\n\t\t\t.replace(/[\\\\/]+$/, \"\")\n\t\t\t.split(/[\\\\/]/)\n\t\t\t.pop() === \"SKILL.md\";\n\tconst rawContent = await env.readTextFile(filePath, context);\n\tif (!rawContent.ok) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"read_failed\", message: rawContent.error.message, path: filePath });\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst parsed = parseFrontmatter<SkillFrontmatter>(rawContent.value);\n\tif (!parsed.ok) {\n\t\tif (isDeclaredSkill) {\n\t\t\tdiagnostics.push({ type: \"warning\", code: \"parse_failed\", message: parsed.error.message, path: filePath });\n\t\t}\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tconst { frontmatter, body } = parsed.value;\n\tconst description = typeof frontmatter.description === \"string\" ? frontmatter.description : undefined;\n\tif (!isDeclaredSkill && (!description || description.trim() === \"\")) {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\tfor (const error of validateDescription(description)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tconst frontmatterName = typeof frontmatter.name === \"string\" ? frontmatter.name : undefined;\n\tconst name = frontmatterName || parentDirName;\n\tfor (const error of validateName(name, parentDirName)) {\n\t\tdiagnostics.push({ type: \"warning\", code: \"invalid_metadata\", message: error, path: filePath });\n\t}\n\n\tif (!description || description.trim() === \"\") {\n\t\treturn { skill: null, diagnostics };\n\t}\n\n\treturn {\n\t\tskill: {\n\t\t\tname,\n\t\t\tdescription,\n\t\t\tcontent: body,\n\t\t\tfilePath,\n\t\t\tdisableModelInvocation: frontmatter[\"disable-model-invocation\"] === true,\n\t\t},\n\t\tdiagnostics,\n\t};\n}\n\nfunction validateName(name: string, parentDirName: string): string[] {\n\tconst errors: string[] = [];\n\tif (name !== parentDirName) errors.push(`name \"${name}\" does not match parent directory \"${parentDirName}\"`);\n\tif (name.length > MAX_NAME_LENGTH) errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);\n\tif (!/^[a-z0-9-]+$/.test(name)) {\n\t\terrors.push(\"name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)\");\n\t}\n\tif (name.startsWith(\"-\") || name.endsWith(\"-\")) errors.push(\"name must not start or end with a hyphen\");\n\tif (name.includes(\"--\")) errors.push(\"name must not contain consecutive hyphens\");\n\treturn errors;\n}\n\nfunction validateDescription(description: string | undefined): string[] {\n\tconst errors: string[] = [];\n\tif (!description || description.trim() === \"\") {\n\t\terrors.push(\"description is required\");\n\t} else if (description.length > MAX_DESCRIPTION_LENGTH) {\n\t\terrors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);\n\t}\n\treturn errors;\n}\n\nfunction parseFrontmatter<T extends Record<string, unknown>>(\n\tcontent: string,\n): Result<{ frontmatter: T; body: string }, Error> {\n\ttry {\n\t\tconst normalized = content.replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\");\n\t\tif (!normalized.startsWith(\"---\")) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst endIndex = normalized.indexOf(\"\\n---\", 3);\n\t\tif (endIndex === -1) return { ok: true, value: { frontmatter: {} as T, body: normalized } };\n\t\tconst yamlString = normalized.slice(4, endIndex);\n\t\tconst body = normalized.slice(endIndex + 4).trim();\n\t\treturn { ok: true, value: { frontmatter: (parse(yamlString) ?? {}) as T, body } };\n\t} catch (error) {\n\t\treturn { ok: false, error: toError(error) };\n\t}\n}\n\nasync function resolveKind(\n\tenv: ExecutionEnv,\n\tinfo: FileInfo,\n\tdiagnostics: SkillDiagnostic[],\n\tcontext: Context,\n): Promise<\"file\" | \"directory\" | undefined> {\n\tif (info.kind === \"file\" || info.kind === \"directory\") return info.kind;\n\tconst canonicalPath = await env.canonicalPath(info.path, context);\n\tif (!canonicalPath.ok) {\n\t\tif (canonicalPath.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: canonicalPath.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\tconst target = await env.fileInfo(canonicalPath.value, context);\n\tif (!target.ok) {\n\t\tif (target.error.code !== \"not_found\") {\n\t\t\tdiagnostics.push({\n\t\t\t\ttype: \"warning\",\n\t\t\t\tcode: \"file_info_failed\",\n\t\t\t\tmessage: target.error.message,\n\t\t\t\tpath: info.path,\n\t\t\t});\n\t\t}\n\t\treturn undefined;\n\t}\n\treturn target.value.kind === \"file\" || target.value.kind === \"directory\" ? target.value.kind : undefined;\n}\n\nfunction dirnameEnvPath(path: string): string {\n\tconst normalized = path.replace(/[\\\\/]+$/, \"\");\n\tconst separatorIndex = Math.max(normalized.lastIndexOf(\"/\"), normalized.lastIndexOf(\"\\\\\"));\n\tif (separatorIndex === 2 && normalized[1] === \":\") return normalized.slice(0, 3);\n\treturn separatorIndex <= 0 ? \"/\" : normalized.slice(0, separatorIndex);\n}\n\nfunction relativeEnvPath(root: string, path: string): string {\n\tconst normalizedRoot = root.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tconst normalizedPath = path.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n\tif (normalizedPath === normalizedRoot) return \"\";\n\treturn normalizedPath.startsWith(`${normalizedRoot}/`)\n\t\t? normalizedPath.slice(normalizedRoot.length + 1)\n\t\t: normalizedPath.replace(/^\\/+/, \"\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/harness/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAsBnE","sourcesContent":["import type { Skill } from \"./types.ts\";\n\nexport function formatSkillsForSystemPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((skill) => !skill.disableModelInvocation);\n\tif (visibleSkills.length === 0) return \"\";\n\n\tconst lines = [\n\t\t\"The following skills provide specialized instructions for specific tasks.\",\n\t\t\"Read the full skill file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(value: string): string {\n\treturn value\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n"]}
1
+ {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/harness/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAsBnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"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\"./types.ts\";\n\nexport function formatSkillsForSystemPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((skill) => !skill.disableModelInvocation);\n\tif (visibleSkills.length === 0) return \"\";\n\n\tconst lines = [\n\t\t\"The following skills provide specialized instructions for specific tasks.\",\n\t\t\"Read the full skill file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(value: string): string {\n\treturn value\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n"]}
1
+ {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/harness/system-prompt.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,2BAA2B,CAAC,MAAe;IAC1D,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC9E,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG;QACb,2EAA2E;QAC3E,iEAAiE;QACjE,8KAA8K;QAC9K,EAAE;QACF,oBAAoB;KACpB,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,aAAa,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,oBAAoB,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;QAC7E,KAAK,CAAC,IAAI,CAAC,iBAAiB,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACpE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC/B,OAAO,KAAK;SACV,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import type { Skill } from \"./types.ts\";\n\nexport function formatSkillsForSystemPrompt(skills: Skill[]): string {\n\tconst visibleSkills = skills.filter((skill) => !skill.disableModelInvocation);\n\tif (visibleSkills.length === 0) return \"\";\n\n\tconst lines = [\n\t\t\"The following skills provide specialized instructions for specific tasks.\",\n\t\t\"Read the full skill file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t];\n\n\tfor (const skill of visibleSkills) {\n\t\tlines.push(\" <skill>\");\n\t\tlines.push(` <name>${escapeXml(skill.name)}</name>`);\n\t\tlines.push(` <description>${escapeXml(skill.description)}</description>`);\n\t\tlines.push(` <location>${escapeXml(skill.filePath)}</location>`);\n\t\tlines.push(\" </skill>\");\n\t}\n\n\tlines.push(\"</available_skills>\");\n\treturn lines.join(\"\\n\");\n}\n\nfunction escapeXml(value: string): string {\n\treturn value\n\t\t.replace(/&/g, \"&amp;\")\n\t\t.replace(/</g, \"&lt;\")\n\t\t.replace(/>/g, \"&gt;\")\n\t\t.replace(/\"/g, \"&quot;\")\n\t\t.replace(/'/g, \"&apos;\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/harness/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,mBAAmB,EAEnB,gCAAgC,EAChC,kCAAkC,EAClC,4BAA4B,EAC5B,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,OAAO,EAA6C,MAAM,cAAc,CAAC;AAEvF,YAAY,EACX,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,UAAU,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,gBAAgB,EAChB,iCAAiC,EACjC,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,gCAAgC,EAChC,kCAAkC,EAClC,4BAA4B,EAC5B,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,iCAAiC,EACjC,gBAAgB,GAChB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ec,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC7E,MAAM,MAAM,qBAAqB,CAAC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AAE,CAAC,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAC1F,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,CAIjB","sourcesContent":["import type {\n\tExactTelemetryAttributes,\n\tSchemaTelemetrySpan,\n\tTelemetrySchemaDefinition,\n\tTelemetrySchemaSpanEndAttributes,\n\tTelemetrySchemaSpanEventAttributes,\n\tTelemetrySchemaSpanEventName,\n\tTelemetrySchemaSpanName,\n\tTelemetrySchemaSpanStartAttributes,\n\tTelemetrySchemaSpanUnion,\n\tTelemetrySpan,\n} from \"@earendil-works/pi-telemetry\";\nimport { type Context, getTelemetryContext, withTelemetryContext } from \"./context.ts\";\n\nexport type {\n\tAttributeValue,\n\tExactTelemetryAttributes,\n\tSchemaTelemetrySpan,\n\tSpanAttributes,\n\tSpanOptions,\n\tSpanStatus,\n\tTelemetryAttributeDefinition,\n\tTelemetryAttributeMetadata,\n\tTelemetryAttributeType,\n\tTelemetryContext,\n\tTelemetryEventAttributeDefinition,\n\tTelemetryEventDefinition,\n\tTelemetryParentDefinition,\n\tTelemetrySchemaDefinition,\n\tTelemetrySchemaSpanEndAttributes,\n\tTelemetrySchemaSpanEventAttributes,\n\tTelemetrySchemaSpanEventName,\n\tTelemetrySchemaSpanName,\n\tTelemetrySchemaSpanStartAttributes,\n\tTelemetrySchemaSpanUnion,\n\tTelemetrySpan,\n\tTelemetrySpanDefinition,\n\tTelemetryStartAttributeDefinition,\n\tTypedSpanStarter,\n} from \"@earendil-works/pi-telemetry\";\n\nexport const AI_TELEMETRY_SCHEMA = {\n\tversion: 1,\n\tspans: {\n\t\t\"pi.ai.request\": {\n\t\t\tdescription: \"One logical request to an AI provider\",\n\t\t\tparents: { kind: \"any\" },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.ai.operation\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"stream\", \"fetch_deferred\", \"cancel_deferred\", \"generate_images\"],\n\t\t\t\t\tdescription: \"Logical provider operation\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.provider\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Selected provider id\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.model\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Requested model id\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.api\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Provider API id\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.streaming\": {\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Whether this operation returns a stream\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.deferred\": {\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tdescription: \"Whether the operation requests or participates in deferred execution\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.ai.response.model\": { type: \"string\", description: \"Concrete response model\" },\n\t\t\t\t\"pi.ai.response.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Provider response id\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.response.stop_reason\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"stop\", \"length\", \"tool_use\", \"error\", \"aborted\", \"deferred\"],\n\t\t\t\t\tdescription: \"Normalized terminal response reason\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.http.status_code\": { type: \"number\", description: \"Final HTTP status\" },\n\t\t\t\t\"pi.ai.usage.input_tokens\": { type: \"number\", description: \"Reported input tokens\" },\n\t\t\t\t\"pi.ai.usage.output_tokens\": { type: \"number\", description: \"Reported output tokens\" },\n\t\t\t\t\"pi.ai.usage.cache_read_tokens\": { type: \"number\", description: \"Reported cache-read tokens\" },\n\t\t\t\t\"pi.ai.usage.cache_write_tokens\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\tdescription: \"Reported cache-write tokens\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.usage.reasoning_tokens\": { type: \"number\", description: \"Reported reasoning tokens\" },\n\t\t\t\t\"pi.ai.usage.total_tokens\": { type: \"number\", description: \"Reported total tokens\" },\n\t\t\t\t\"pi.ai.usage.cost\": { type: \"number\", description: \"Reported total cost\" },\n\t\t\t\t\"pi.ai.stream.chunk_count\": { type: \"number\", description: \"Streamed update chunk count\" },\n\t\t\t\t\"pi.ai.stream.time_to_first_chunk_ms\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\tdescription: \"Elapsed milliseconds to first update chunk\",\n\t\t\t\t},\n\t\t\t\t\"pi.ai.error.type\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tcardinality: \"low\",\n\t\t\t\t\tdescription: \"Provider or transport error class\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The operation throws or returns an error result\" },\n\t\t},\n\t},\n} as const satisfies TelemetrySchemaDefinition;\n\nexport type AiSpanName = TelemetrySchemaSpanName<typeof AI_TELEMETRY_SCHEMA>;\nexport type AiSpanStartAttributes<Name extends AiSpanName> = TelemetrySchemaSpanStartAttributes<\n\ttypeof AI_TELEMETRY_SCHEMA,\n\tName\n>;\nexport type AiSpanEndAttributes<Name extends AiSpanName> = TelemetrySchemaSpanEndAttributes<\n\ttypeof AI_TELEMETRY_SCHEMA,\n\tName\n>;\nexport type AiSpanAttributes<Name extends AiSpanName> = AiSpanStartAttributes<Name> & AiSpanEndAttributes<Name>;\nexport type AiSpanEventName<Name extends AiSpanName> = TelemetrySchemaSpanEventName<typeof AI_TELEMETRY_SCHEMA, Name>;\nexport type AiSpanEventAttributes<\n\tName extends AiSpanName,\n\tEventName extends AiSpanEventName<Name>,\n> = TelemetrySchemaSpanEventAttributes<typeof AI_TELEMETRY_SCHEMA, Name, EventName>;\nexport type AiTelemetrySpan<Name extends AiSpanName> = SchemaTelemetrySpan<typeof AI_TELEMETRY_SCHEMA, Name>;\nexport type AiSpan = TelemetrySchemaSpanUnion<typeof AI_TELEMETRY_SCHEMA>;\n\nexport function startAiSpan<Name extends AiSpanName, const Attributes extends AiSpanStartAttributes<Name>, Result>(\n\tname: Name,\n\tattributes: ExactTelemetryAttributes<AiSpanStartAttributes<Name>, Attributes>,\n\tcallback: (span: AiTelemetrySpan<Name>, context: Context) => Result | Promise<Result>,\n\tcontext: Context,\n): Promise<Result> {\n\treturn getTelemetryContext(context).startSpan({ name, attributes }, (span) =>\n\t\tcallback(span as AiTelemetrySpan<Name>, withTelemetryContext(span, context)),\n\t);\n}\n\nconst HOOK_NAMES = [\n\t\"before_run\",\n\t\"before_drive\",\n\t\"before_run_end\",\n\t\"transform_context\",\n\t\"before_request\",\n\t\"before_payload\",\n\t\"after_response\",\n\t\"before_tool\",\n\t\"after_tool\",\n\t\"before_compaction\",\n\t\"before_navigation\",\n] as const;\n\nconst EVENT_TYPES = [\n\t\"run_start\",\n\t\"run_resume\",\n\t\"run_suspend\",\n\t\"operation_abort\",\n\t\"run_end\",\n\t\"fault\",\n\t\"handler_error\",\n\t\"turn_start\",\n\t\"turn_end\",\n\t\"retry_scheduled\",\n\t\"retry_start\",\n\t\"retry_end\",\n\t\"message_start\",\n\t\"message_update\",\n\t\"message_end\",\n\t\"tool_start\",\n\t\"tool_update\",\n\t\"tool_end\",\n\t\"entry_added\",\n\t\"queue_update\",\n\t\"value_update\",\n\t\"config_update\",\n\t\"compaction_start\",\n\t\"compaction_end\",\n\t\"navigation_start\",\n\t\"navigation_end\",\n\t\"lane_created\",\n\t\"usage\",\n] as const;\n\nconst operationStartAttributes = {\n\t\"pi.session.id\": {\n\t\ttype: \"string\",\n\t\trequired: true,\n\t\tcardinality: \"high\",\n\t\tdescription: \"Session id\",\n\t},\n\t\"pi.lane.name\": {\n\t\ttype: \"string\",\n\t\trequired: true,\n\t\tcardinality: \"high\",\n\t\tdescription: \"Lane name\",\n\t},\n\t\"pi.operation.id\": {\n\t\ttype: \"string\",\n\t\trequired: true,\n\t\tcardinality: \"high\",\n\t\tdescription: \"Durable operation id\",\n\t},\n\t\"pi.operation.recovery\": {\n\t\ttype: \"boolean\",\n\t\trequired: true,\n\t\tdescription: \"Whether this invocation resumes durable work\",\n\t},\n} as const;\n\nconst operationErrorAttributes = {\n\t\"pi.error.code\": {\n\t\ttype: \"string\",\n\t\tcardinality: \"low\",\n\t\tdescription: \"Stable operation error code\",\n\t},\n\t\"pi.error.type\": {\n\t\ttype: \"string\",\n\t\tcardinality: \"low\",\n\t\tdescription: \"Low-cardinality operation error class\",\n\t},\n} as const;\n\nexport const HARNESS_TELEMETRY_SCHEMA = {\n\tversion: 1,\n\tspans: {\n\t\t\"pi.harness.run\": {\n\t\t\tdescription: \"One admitted in-process run invocation\",\n\t\t\tparents: { kind: \"root_or_external\" },\n\t\t\tstartAttributes: {\n\t\t\t\t...operationStartAttributes,\n\t\t\t\t\"pi.operation.kind\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"run\"],\n\t\t\t\t\tdescription: \"Run operation kind\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.operation.outcome\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"completed\", \"aborted\", \"failed\", \"suspended\"],\n\t\t\t\t\tdescription: \"Run invocation outcome\",\n\t\t\t\t},\n\t\t\t\t...operationErrorAttributes,\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The run fails or throws\" },\n\t\t},\n\t\t\"pi.harness.compaction\": {\n\t\t\tdescription: \"One admitted in-process manual compaction invocation\",\n\t\t\tparents: { kind: \"root_or_external\" },\n\t\t\tstartAttributes: {\n\t\t\t\t...operationStartAttributes,\n\t\t\t\t\"pi.operation.kind\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"compaction\"],\n\t\t\t\t\tdescription: \"Compaction operation kind\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.operation.outcome\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"completed\", \"declined\", \"aborted\", \"failed\"],\n\t\t\t\t\tdescription: \"Compaction invocation outcome\",\n\t\t\t\t},\n\t\t\t\t...operationErrorAttributes,\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The compaction fails or throws\" },\n\t\t},\n\t\t\"pi.harness.navigation\": {\n\t\t\tdescription: \"One admitted in-process navigation invocation\",\n\t\t\tparents: { kind: \"root_or_external\" },\n\t\t\tstartAttributes: {\n\t\t\t\t...operationStartAttributes,\n\t\t\t\t\"pi.operation.kind\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"navigation\"],\n\t\t\t\t\tdescription: \"Navigation operation kind\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.operation.outcome\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"completed\", \"declined\", \"aborted\", \"failed\"],\n\t\t\t\t\tdescription: \"Navigation invocation outcome\",\n\t\t\t\t},\n\t\t\t\t...operationErrorAttributes,\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The navigation fails or throws\" },\n\t\t},\n\t\t\"pi.harness.checkpoint\": {\n\t\t\tdescription: \"One run checkpoint\",\n\t\t\tparents: { kind: \"spans\", spans: [\"pi.harness.run\"] },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name\",\n\t\t\t\t},\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id\",\n\t\t\t\t},\n\t\t\t\t\"pi.checkpoint.kind\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"normal\", \"abort_reconcile\"],\n\t\t\t\t\tdescription: \"Checkpoint purpose\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"Checkpoint work throws\" },\n\t\t},\n\t\t\"pi.harness.turn\": {\n\t\t\tdescription: \"One assistant response and its tool batch\",\n\t\t\tparents: { kind: \"spans\", spans: [\"pi.harness.run\"] },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name\",\n\t\t\t\t},\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id\",\n\t\t\t\t},\n\t\t\t\t\"pi.turn.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Invocation-local turn id\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"Turn work throws\" },\n\t\t},\n\t\t\"pi.harness.step\": {\n\t\t\tdescription: \"One durable retry attempt\",\n\t\t\tparents: {\n\t\t\t\tkind: \"spans\",\n\t\t\t\tspans: [\"pi.harness.turn\", \"pi.harness.checkpoint\", \"pi.harness.compaction\", \"pi.harness.navigation\"],\n\t\t\t},\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name\",\n\t\t\t\t},\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id\",\n\t\t\t\t},\n\t\t\t\t\"pi.step.kind\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"assistant\", \"compaction\", \"branch_summary\"],\n\t\t\t\t\tdescription: \"Retryable step kind\",\n\t\t\t\t},\n\t\t\t\t\"pi.step.attempt\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"One-based durable attempt number\",\n\t\t\t\t},\n\t\t\t\t\"pi.compaction.reason\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tvalues: [\"manual\", \"threshold\", \"overflow\"],\n\t\t\t\t\tdescription: \"Compaction trigger\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.step.outcome\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"succeeded\", \"retry\", \"failed\", \"aborted\", \"deferred\", \"overflow\"],\n\t\t\t\t\tdescription: \"Attempt outcome\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The attempt retries, fails, or throws\" },\n\t\t},\n\t\t\"pi.harness.tool\": {\n\t\t\tdescription: \"One raw phase-2 tool execution\",\n\t\t\tparents: { kind: \"spans\", spans: [\"pi.harness.turn\", \"pi.harness.run\"] },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name\",\n\t\t\t\t},\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id\",\n\t\t\t\t},\n\t\t\t\t\"pi.turn.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Invocation-local live turn id\",\n\t\t\t\t},\n\t\t\t\t\"pi.tool.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Tool name\",\n\t\t\t\t},\n\t\t\t\t\"pi.tool.call_id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Tool call id\",\n\t\t\t\t},\n\t\t\t\t\"pi.tool.replay\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: [\"never\", \"safe\"],\n\t\t\t\t\tdescription: \"Declared replay policy\",\n\t\t\t\t},\n\t\t\t\t\"pi.tool.recovery\": {\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Whether this is recovery execution\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.tool.is_error\": {\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\tdescription: \"Whether raw phase-2 execution returned an error\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"Raw phase-2 execution returns an error\" },\n\t\t},\n\t\t\"pi.harness.hook\": {\n\t\t\tdescription: \"One registered hook handler invocation\",\n\t\t\tparents: { kind: \"any\" },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name\",\n\t\t\t\t},\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id when accepted\",\n\t\t\t\t},\n\t\t\t\t\"pi.hook.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvalues: HOOK_NAMES,\n\t\t\t\t\tdescription: \"Hook name\",\n\t\t\t\t},\n\t\t\t\t\"pi.hook.registration_id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tdescription: \"Optional hook registration metadata\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.hook.outcome\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"completed\", \"skipped\", \"blocked\", \"failed\"],\n\t\t\t\t\tdescription: \"Handler outcome\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The handler throws\" },\n\t\t},\n\t\t\"pi.harness.sleep\": {\n\t\t\tdescription: \"One retry delay\",\n\t\t\tparents: {\n\t\t\t\tkind: \"spans\",\n\t\t\t\tspans: [\n\t\t\t\t\t\"pi.harness.run\",\n\t\t\t\t\t\"pi.harness.compaction\",\n\t\t\t\t\t\"pi.harness.navigation\",\n\t\t\t\t\t\"pi.harness.turn\",\n\t\t\t\t\t\"pi.harness.checkpoint\",\n\t\t\t\t],\n\t\t\t},\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id\",\n\t\t\t\t},\n\t\t\t\t\"pi.sleep.delay_ms\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Requested delay in milliseconds\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.sleep.outcome\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalues: [\"elapsed\", \"aborted\"],\n\t\t\t\t\tdescription: \"Delay outcome\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"Sleep work throws\" },\n\t\t},\n\t\t\"pi.harness.event_handler\": {\n\t\t\tdescription: \"One passive event listener invocation\",\n\t\t\tparents: { kind: \"any\" },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.event.type\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"low\",\n\t\t\t\t\tvalues: EVENT_TYPES,\n\t\t\t\t\tdescription: \"Delivered harness event type\",\n\t\t\t\t},\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name for lane-scoped events\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"The listener throws\" },\n\t\t},\n\t\t\"pi.session.write\": {\n\t\t\tdescription: \"One committed session transaction\",\n\t\t\tparents: { kind: \"any\" },\n\t\t\tstartAttributes: {\n\t\t\t\t\"pi.session.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Session id\",\n\t\t\t\t},\n\t\t\t\t\"pi.lane.name\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Lane name when supplied by the caller\",\n\t\t\t\t},\n\t\t\t\t\"pi.operation.id\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\trequired: false,\n\t\t\t\t\tcardinality: \"high\",\n\t\t\t\t\tdescription: \"Durable operation id when supplied by the caller\",\n\t\t\t\t},\n\t\t\t\t\"pi.session.item_count\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdescription: \"Number of writes in the transaction\",\n\t\t\t\t},\n\t\t\t\t\"pi.session.item_kinds\": {\n\t\t\t\t\ttype: \"string[]\",\n\t\t\t\t\trequired: true,\n\t\t\t\t\telementValues: [\"entry\", \"usage\", \"value\", \"list\"],\n\t\t\t\t\tdescription: \"Distinct write kinds in the transaction\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tendAttributes: {\n\t\t\t\t\"pi.session.first_seq\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\tdescription: \"First committed sequence in the transaction\",\n\t\t\t\t},\n\t\t\t\t\"pi.session.last_seq\": {\n\t\t\t\t\ttype: \"number\",\n\t\t\t\t\tdescription: \"Last committed sequence in the transaction\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tstatus: { default: \"ok\", errorWhen: \"Storage rejects the transaction\" },\n\t\t},\n\t},\n} as const satisfies TelemetrySchemaDefinition;\n\n/** Combined typed span vocabulary for agent-owned AI-request and harness telemetry. */\nexport const AGENT_TELEMETRY_SCHEMAS = [AI_TELEMETRY_SCHEMA, HARNESS_TELEMETRY_SCHEMA] as const;\n\nexport type HarnessSpanName = TelemetrySchemaSpanName<typeof HARNESS_TELEMETRY_SCHEMA>;\nexport type HarnessSpanStartAttributes<Name extends HarnessSpanName> = TelemetrySchemaSpanStartAttributes<\n\ttypeof HARNESS_TELEMETRY_SCHEMA,\n\tName\n>;\nexport type HarnessSpanEndAttributes<Name extends HarnessSpanName> = TelemetrySchemaSpanEndAttributes<\n\ttypeof HARNESS_TELEMETRY_SCHEMA,\n\tName\n>;\nexport type HarnessSpanAttributes<Name extends HarnessSpanName> = HarnessSpanStartAttributes<Name> &\n\tHarnessSpanEndAttributes<Name>;\nexport type HarnessSpanEventName<Name extends HarnessSpanName> = TelemetrySchemaSpanEventName<\n\ttypeof HARNESS_TELEMETRY_SCHEMA,\n\tName\n>;\nexport type HarnessSpanEventAttributes<\n\tName extends HarnessSpanName,\n\tEventName extends HarnessSpanEventName<Name>,\n> = TelemetrySchemaSpanEventAttributes<typeof HARNESS_TELEMETRY_SCHEMA, Name, EventName>;\nexport type HarnessTelemetrySpan<Name extends HarnessSpanName> = SchemaTelemetrySpan<\n\ttypeof HARNESS_TELEMETRY_SCHEMA,\n\tName\n>;\nexport type HarnessSpan = TelemetrySchemaSpanUnion<typeof HARNESS_TELEMETRY_SCHEMA>;\n\nexport function startHarnessSpan<\n\tName extends HarnessSpanName,\n\tconst Attributes extends HarnessSpanStartAttributes<Name>,\n\tResult,\n>(\n\tname: Name,\n\tattributes: ExactTelemetryAttributes<HarnessSpanStartAttributes<Name>, Attributes>,\n\tcallback: (span: HarnessTelemetrySpan<Name>, context: Context) => Result | Promise<Result>,\n\tcontext: Context,\n): Promise<Result> {\n\treturn getTelemetryContext(context).startSpan({ name, attributes }, (span: TelemetrySpan) =>\n\t\tcallback(span as HarnessTelemetrySpan<Name>, withTelemetryContext(span, context)),\n\t);\n}\n"]}
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/harness/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,mBAAmB,EAEnB,gCAAgC,EAChC,kCAAkC,EAClC,4BAA4B,EAC5B,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,OAAO,EAA6C,MAAM,cAAc,CAAC;AAEvF,YAAY,EACX,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,UA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