@astralyn/pi 1.4.9 → 1.4.11

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 (230) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/bundle/chunks/{chunk-BAGHIP5J.js → chunk-NUQMVNKQ.js} +3 -3
  3. package/dist/bundle/chunks/{chunk-3PKXUKTB.js → chunk-PUU43PDV.js} +121 -136
  4. package/dist/bundle/chunks/{chunk-F66AY3WR.js → chunk-TH3QDDPD.js} +1 -1
  5. package/dist/bundle/chunks/{execute-P22VMM2H.js → execute-VLAIP26K.js} +1 -1
  6. package/dist/bundle/chunks/{virtual-modules-VKMBQTR2.js → virtual-modules-63XNTSVN.js} +1 -1
  7. package/dist/bundle/cli.js +1 -1
  8. package/dist/bundle/index.js +1 -1
  9. package/dist/bundle/rpc-entry.js +1 -1
  10. package/dist/core/agent-session.d.ts +34 -0
  11. package/dist/core/agent-session.d.ts.map +1 -1
  12. package/dist/core/agent-session.js +99 -5
  13. package/dist/core/agent-session.js.map +1 -1
  14. package/dist/core/extensions/index.d.ts +1 -1
  15. package/dist/core/extensions/index.d.ts.map +1 -1
  16. package/dist/core/extensions/index.js.map +1 -1
  17. package/dist/core/extensions/loader.d.ts.map +1 -1
  18. package/dist/core/extensions/loader.js +14 -7
  19. package/dist/core/extensions/loader.js.map +1 -1
  20. package/dist/core/isolated-session.d.ts +7 -2
  21. package/dist/core/isolated-session.d.ts.map +1 -1
  22. package/dist/core/isolated-session.js +7 -3
  23. package/dist/core/isolated-session.js.map +1 -1
  24. package/dist/core/session-manager.d.ts +17 -1
  25. package/dist/core/session-manager.d.ts.map +1 -1
  26. package/dist/core/session-manager.js +29 -0
  27. package/dist/core/session-manager.js.map +1 -1
  28. package/dist/core/tasks/delivery.d.ts +31 -12
  29. package/dist/core/tasks/delivery.d.ts.map +1 -1
  30. package/dist/core/tasks/delivery.js +97 -36
  31. package/dist/core/tasks/delivery.js.map +1 -1
  32. package/dist/core/tasks/execution.d.ts +27 -14
  33. package/dist/core/tasks/execution.d.ts.map +1 -1
  34. package/dist/core/tasks/execution.js +90 -86
  35. package/dist/core/tasks/execution.js.map +1 -1
  36. package/dist/core/tasks/limits.d.ts +7 -11
  37. package/dist/core/tasks/limits.d.ts.map +1 -1
  38. package/dist/core/tasks/limits.js +8 -16
  39. package/dist/core/tasks/limits.js.map +1 -1
  40. package/dist/core/tasks/output.d.ts +9 -1
  41. package/dist/core/tasks/output.d.ts.map +1 -1
  42. package/dist/core/tasks/output.js +23 -10
  43. package/dist/core/tasks/output.js.map +1 -1
  44. package/dist/core/tasks/presentation.d.ts +1 -1
  45. package/dist/core/tasks/presentation.d.ts.map +1 -1
  46. package/dist/core/tasks/presentation.js +6 -4
  47. package/dist/core/tasks/presentation.js.map +1 -1
  48. package/dist/core/tasks/record.d.ts +41 -29
  49. package/dist/core/tasks/record.d.ts.map +1 -1
  50. package/dist/core/tasks/record.js +82 -37
  51. package/dist/core/tasks/record.js.map +1 -1
  52. package/dist/core/tasks/reminder.js +2 -2
  53. package/dist/core/tasks/reminder.js.map +1 -1
  54. package/dist/core/tasks/runtime.d.ts +15 -23
  55. package/dist/core/tasks/runtime.d.ts.map +1 -1
  56. package/dist/core/tasks/runtime.js +50 -178
  57. package/dist/core/tasks/runtime.js.map +1 -1
  58. package/dist/core/tasks/scheduler.d.ts +3 -1
  59. package/dist/core/tasks/scheduler.d.ts.map +1 -1
  60. package/dist/core/tasks/scheduler.js +16 -12
  61. package/dist/core/tasks/scheduler.js.map +1 -1
  62. package/dist/core/tasks/session.d.ts +24 -6
  63. package/dist/core/tasks/session.d.ts.map +1 -1
  64. package/dist/core/tasks/session.js +70 -22
  65. package/dist/core/tasks/session.js.map +1 -1
  66. package/dist/core/tasks/store.d.ts +17 -4
  67. package/dist/core/tasks/store.d.ts.map +1 -1
  68. package/dist/core/tasks/store.js +45 -48
  69. package/dist/core/tasks/store.js.map +1 -1
  70. package/dist/core/tasks/types.d.ts +64 -93
  71. package/dist/core/tasks/types.d.ts.map +1 -1
  72. package/dist/core/tasks/types.js +7 -0
  73. package/dist/core/tasks/types.js.map +1 -1
  74. package/dist/core/tools/shell-execution.d.ts.map +1 -1
  75. package/dist/core/tools/shell-execution.js +2 -1
  76. package/dist/core/tools/shell-execution.js.map +1 -1
  77. package/dist/core/tools/shell-tool.d.ts.map +1 -1
  78. package/dist/core/tools/shell-tool.js +20 -13
  79. package/dist/core/tools/shell-tool.js.map +1 -1
  80. package/dist/extensions/agent/activity-lines.d.ts +10 -0
  81. package/dist/extensions/agent/activity-lines.d.ts.map +1 -0
  82. package/dist/extensions/agent/activity-lines.js +76 -0
  83. package/dist/extensions/agent/activity-lines.js.map +1 -0
  84. package/dist/extensions/agent/activity.d.ts +25 -4
  85. package/dist/extensions/agent/activity.d.ts.map +1 -1
  86. package/dist/extensions/agent/activity.js +76 -21
  87. package/dist/extensions/agent/activity.js.map +1 -1
  88. package/dist/extensions/agent/artifacts.d.ts +15 -0
  89. package/dist/extensions/agent/artifacts.d.ts.map +1 -0
  90. package/dist/extensions/agent/artifacts.js +44 -0
  91. package/dist/extensions/agent/artifacts.js.map +1 -0
  92. package/dist/extensions/agent/progress.d.ts +30 -4
  93. package/dist/extensions/agent/progress.d.ts.map +1 -1
  94. package/dist/extensions/agent/progress.js +84 -11
  95. package/dist/extensions/agent/progress.js.map +1 -1
  96. package/dist/extensions/agent/render.d.ts.map +1 -1
  97. package/dist/extensions/agent/render.js +8 -24
  98. package/dist/extensions/agent/render.js.map +1 -1
  99. package/dist/extensions/agent/report.d.ts +11 -3
  100. package/dist/extensions/agent/report.d.ts.map +1 -1
  101. package/dist/extensions/agent/report.js +32 -7
  102. package/dist/extensions/agent/report.js.map +1 -1
  103. package/dist/extensions/agent/tool.d.ts.map +1 -1
  104. package/dist/extensions/agent/tool.js +20 -5
  105. package/dist/extensions/agent/tool.js.map +1 -1
  106. package/dist/extensions/agent/types.d.ts +2 -0
  107. package/dist/extensions/agent/types.d.ts.map +1 -1
  108. package/dist/extensions/agent/types.js.map +1 -1
  109. package/dist/extensions/agent/worker.d.ts +7 -0
  110. package/dist/extensions/agent/worker.d.ts.map +1 -1
  111. package/dist/extensions/agent/worker.js +9 -3
  112. package/dist/extensions/agent/worker.js.map +1 -1
  113. package/dist/extensions/cached-compaction/summary.d.ts +1 -1
  114. package/dist/extensions/cached-compaction/summary.d.ts.map +1 -1
  115. package/dist/extensions/cached-compaction/summary.js +13 -16
  116. package/dist/extensions/cached-compaction/summary.js.map +1 -1
  117. package/dist/extensions/search/index.d.ts.map +1 -1
  118. package/dist/extensions/search/index.js +6 -7
  119. package/dist/extensions/search/index.js.map +1 -1
  120. package/dist/extensions/tasks/tool/actions.d.ts +1 -2
  121. package/dist/extensions/tasks/tool/actions.d.ts.map +1 -1
  122. package/dist/extensions/tasks/tool/actions.js +12 -80
  123. package/dist/extensions/tasks/tool/actions.js.map +1 -1
  124. package/dist/extensions/tasks/tool/constants.d.ts +1 -3
  125. package/dist/extensions/tasks/tool/constants.d.ts.map +1 -1
  126. package/dist/extensions/tasks/tool/constants.js +1 -3
  127. package/dist/extensions/tasks/tool/constants.js.map +1 -1
  128. package/dist/extensions/tasks/tool/schema.d.ts +2 -3
  129. package/dist/extensions/tasks/tool/schema.d.ts.map +1 -1
  130. package/dist/extensions/tasks/tool/schema.js +10 -18
  131. package/dist/extensions/tasks/tool/schema.js.map +1 -1
  132. package/dist/extensions/tasks/tool/types.d.ts +1 -17
  133. package/dist/extensions/tasks/tool/types.d.ts.map +1 -1
  134. package/dist/extensions/tasks/tool/types.js.map +1 -1
  135. package/dist/extensions/tasks/tool.d.ts +1 -2
  136. package/dist/extensions/tasks/tool.d.ts.map +1 -1
  137. package/dist/extensions/tasks/tool.js +5 -6
  138. package/dist/extensions/tasks/tool.js.map +1 -1
  139. package/dist/extensions/tasks/ui/completion-render.d.ts.map +1 -1
  140. package/dist/extensions/tasks/ui/completion-render.js +2 -2
  141. package/dist/extensions/tasks/ui/completion-render.js.map +1 -1
  142. package/dist/extensions/tasks/ui/footer.d.ts +37 -0
  143. package/dist/extensions/tasks/ui/footer.d.ts.map +1 -0
  144. package/dist/extensions/tasks/ui/footer.js +129 -0
  145. package/dist/extensions/tasks/ui/footer.js.map +1 -0
  146. package/dist/extensions/tasks/ui/frame.d.ts +36 -0
  147. package/dist/extensions/tasks/ui/frame.d.ts.map +1 -0
  148. package/dist/extensions/tasks/ui/frame.js +33 -0
  149. package/dist/extensions/tasks/ui/frame.js.map +1 -0
  150. package/dist/extensions/tasks/ui/help.d.ts +6 -0
  151. package/dist/extensions/tasks/ui/help.d.ts.map +1 -0
  152. package/dist/extensions/tasks/ui/help.js +53 -0
  153. package/dist/extensions/tasks/ui/help.js.map +1 -0
  154. package/dist/extensions/tasks/ui/inspector.d.ts +4 -3
  155. package/dist/extensions/tasks/ui/inspector.d.ts.map +1 -1
  156. package/dist/extensions/tasks/ui/inspector.js +25 -6
  157. package/dist/extensions/tasks/ui/inspector.js.map +1 -1
  158. package/dist/extensions/tasks/ui/layout.d.ts +15 -18
  159. package/dist/extensions/tasks/ui/layout.d.ts.map +1 -1
  160. package/dist/extensions/tasks/ui/layout.js +162 -255
  161. package/dist/extensions/tasks/ui/layout.js.map +1 -1
  162. package/dist/extensions/tasks/ui/list.d.ts +3 -1
  163. package/dist/extensions/tasks/ui/list.d.ts.map +1 -1
  164. package/dist/extensions/tasks/ui/list.js +19 -14
  165. package/dist/extensions/tasks/ui/list.js.map +1 -1
  166. package/dist/extensions/tasks/ui/manager.d.ts +17 -5
  167. package/dist/extensions/tasks/ui/manager.d.ts.map +1 -1
  168. package/dist/extensions/tasks/ui/manager.js +147 -90
  169. package/dist/extensions/tasks/ui/manager.js.map +1 -1
  170. package/dist/extensions/tasks/ui/model.d.ts +32 -5
  171. package/dist/extensions/tasks/ui/model.d.ts.map +1 -1
  172. package/dist/extensions/tasks/ui/model.js +7 -7
  173. package/dist/extensions/tasks/ui/model.js.map +1 -1
  174. package/dist/extensions/tasks/ui/panes.d.ts +40 -0
  175. package/dist/extensions/tasks/ui/panes.d.ts.map +1 -0
  176. package/dist/extensions/tasks/ui/panes.js +144 -0
  177. package/dist/extensions/tasks/ui/panes.js.map +1 -0
  178. package/dist/extensions/tasks/ui/render.d.ts +2 -16
  179. package/dist/extensions/tasks/ui/render.d.ts.map +1 -1
  180. package/dist/extensions/tasks/ui/render.js +13 -85
  181. package/dist/extensions/tasks/ui/render.js.map +1 -1
  182. package/dist/extensions/tasks/ui/viewport.d.ts +12 -4
  183. package/dist/extensions/tasks/ui/viewport.d.ts.map +1 -1
  184. package/dist/extensions/tasks/ui/viewport.js +23 -7
  185. package/dist/extensions/tasks/ui/viewport.js.map +1 -1
  186. package/dist/extensions/tasks/ui/views.d.ts +12 -6
  187. package/dist/extensions/tasks/ui/views.d.ts.map +1 -1
  188. package/dist/extensions/tasks/ui/views.js +39 -32
  189. package/dist/extensions/tasks/ui/views.js.map +1 -1
  190. package/dist/index.d.ts +1 -1
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js.map +1 -1
  193. package/dist/modes/interactive/components/session-selector.d.ts +11 -1
  194. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  195. package/dist/modes/interactive/components/session-selector.js +43 -17
  196. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  197. package/dist/modes/print-mode.d.ts.map +1 -1
  198. package/dist/modes/print-mode.js +38 -2
  199. package/dist/modes/print-mode.js.map +1 -1
  200. package/dist/modes/rpc/rpc-client.d.ts +11 -0
  201. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  202. package/dist/modes/rpc/rpc-client.js +48 -0
  203. package/dist/modes/rpc/rpc-client.js.map +1 -1
  204. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  205. package/dist/modes/rpc/rpc-mode.js +2 -0
  206. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  207. package/dist/modes/rpc/rpc-types.d.ts +2 -0
  208. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  209. package/dist/modes/rpc/rpc-types.js.map +1 -1
  210. package/docs/bundled/extensions/agent.md +39 -7
  211. package/docs/bundled/extensions/statusline.md +1 -1
  212. package/docs/bundled/tasks.md +28 -37
  213. package/docs/bundled/tool-presentation.md +1 -1
  214. package/docs/extensions.md +15 -13
  215. package/docs/json.md +3 -0
  216. package/docs/models-configuration.md +1 -1
  217. package/docs/models.md +7 -85
  218. package/docs/rpc.md +14 -0
  219. package/docs/sdk.md +12 -2
  220. package/docs/session-format.md +11 -5
  221. package/docs/sessions.md +1 -1
  222. package/docs/usage.md +2 -0
  223. package/package.json +3 -4
  224. package/dist/modes/interactive/tool-view/tool-execution.d.ts +0 -14
  225. package/dist/modes/interactive/tool-view/tool-execution.d.ts.map +0 -1
  226. package/dist/modes/interactive/tool-view/tool-execution.js +0 -13
  227. package/dist/modes/interactive/tool-view/tool-execution.js.map +0 -1
  228. package/docs/images/doom-extension.png +0 -0
  229. package/docs/images/exy.png +0 -0
  230. package/npm-shrinkwrap.json +0 -4207
@@ -1 +1 @@
1
- {"version":3,"file":"shell-tool.js","sourceRoot":"","sources":["../../../src/core/tools/shell-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAGN,mBAAmB,EACnB,gBAAgB,GAEhB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAyB,MAAM,eAAe,CAAC;AAE5F,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,OA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AAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\nimport { TaskRuntime } from \"../tasks/runtime.ts\";\nimport type { TaskCompletion, TaskControl, TaskToolOutcome } from \"../tasks/types.ts\";\nimport {\n\ttype BashOperations,\n\ttype BashToolOptions,\n\tresolveSpawnContext,\n\tresolveTimeoutMs,\n\ttype ShellToolConfig,\n} from \"./bash.ts\";\nimport { createShellRenderers } from \"./renderers/bash.ts\";\nimport { runShellCommand } from \"./shell-execution.ts\";\nimport { createLocalBashOperations } from \"./shell-operations.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type TruncationResult } from \"./truncate.ts\";\n\nconst bashSchema = Type.Object({\n\tcommand: Type.String({ description: \"Shell command to execute\" }),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (optional, no default timeout)\" })),\n\tbackground: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"true returns a managed task ID immediately and runs the command in the background, and you are notified when it completes — do not poll for its result; omit or false to block until exit\",\n\t\t}),\n\t),\n});\n\nexport const bashToolSystemPromptContribution = {\n\tsnippet: \"Execute bash commands, foreground or background\",\n\tguidelines: [\"You can inspect PI_* environment variables for current model and session details.\"],\n} as const;\n\nexport type BashToolInput = Static<typeof bashSchema>;\n\nconst bashOutputSchema = Type.Union([\n\tType.Object({\n\t\toutput: Type.String({\n\t\t\tdescription: \"Combined stdout and stderr, up to 1 MiB, keeping head and tail when truncated.\",\n\t\t}),\n\t\ttruncated: Type.Boolean(),\n\t\tfull_output_path: Type.Optional(Type.String()),\n\t\texit_code: Type.Number(),\n\t\twall_time_seconds: Type.Number(),\n\t}),\n\tType.Object({ task_id: Type.String(), status: Type.String() }),\n]);\n\nexport interface BashToolDetails {\n\ttruncation?: TruncationResult;\n\tfullOutputPath?: string;\n\t/** Settled handoff snapshot, not a command completion or exit code. */\n\tbackground?: { kind: \"background\"; taskId: string };\n}\n\nexport type BashRenderState = {\n\tdispose?: () => void;\n};\n\n/** Translate terminal shell failures to the native foreground tool contract once. */\nfunction shellToolResult(completion: TaskCompletion<BashToolDetails | undefined>) {\n\tconst status = completion.status;\n\tif (completion.result.structuredContent) return completion.result;\n\tif (status === \"failed\" || status === \"timeout\" || status === \"cancelled\") {\n\t\tconst text = completion.result.content\n\t\t\t.filter((part) => part.type === \"text\")\n\t\t\t.map((part) => part.text)\n\t\t\t.join(\"\\n\");\n\t\tconst message = completion.error ? text || completion.error : `${text ? `${text}\\n\\n` : \"\"}Command ${status}`;\n\t\tthrow new Error(message);\n\t}\n\treturn completion.result;\n}\n\nexport function createShellToolDefinition(\n\tcwd: string,\n\tconfig: ShellToolConfig,\n\toptions: BashToolOptions & { operations: BashOperations },\n): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState> {\n\tconst ops = options.operations;\n\tconst commandPrefix = options?.commandPrefix;\n\tconst exposeSessionEnvironment = options?.exposeSessionEnvironment ?? true;\n\tconst spawnHook = options?.spawnHook;\n\treturn {\n\t\tname: config.name,\n\t\tlabel: config.label,\n\t\tdescription: `Execute a ${config.shellName} command in the current working directory. Returns stdout and stderr, truncated to the last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first); the full output is saved to a temp file. Optionally provide a timeout in seconds (no default). Choose the mode per call: foreground (default) blocks until the command exits — use it when your next step needs the output; background: true returns immediately with a task ID — use it for long-running work (builds, servers, watchers, big test suites) or when you have independent work to continue. A handoff is not completion: the result arrives later as an automatic completion notification; meanwhile use tasks read to inspect output, tasks wait with an ID for one task or without one for any running task, and tasks kill to stop it. Steering interrupts only a wait, never execution. Background output is limited to 20 MiB; an expired tasks wait window never stops the command.`,\n\t\tpromptSnippet: config.promptSnippet,\n\t\tpromptGuidelines: exposeSessionEnvironment && config.promptGuidelines ? [...config.promptGuidelines] : undefined,\n\t\tparameters: bashSchema,\n\t\toutputSchema: bashOutputSchema,\n\t\tconstrainedSampling: { type: \"json_schema\", strict: \"prefer\" },\n\t\tasync execute(\n\t\t\ttoolCallId,\n\t\t\t{ command, timeout, background }: BashToolInput,\n\t\t\tparentSignal?: AbortSignal,\n\t\t\toriginalUpdate?,\n\t\t\tctx?: ExtensionContext,\n\t\t) {\n\t\t\tconst sessionTasks = ctx?.tasks;\n\t\t\tif (sessionTasks?.closed) throw new Error(\"Task service is closed\");\n\t\t\tif (!sessionTasks && background)\n\t\t\t\tthrow new Error(\"Background execution is not available in this host. No command was started.\");\n\t\t\t// Without a session the command still runs as a task, on a throwaway runtime that never backgrounds.\n\t\t\tconst standalone = sessionTasks ? undefined : new TaskRuntime();\n\t\t\tconst run = async (\n\t\t\t\tcontrol: TaskControl<BashToolDetails | undefined>,\n\t\t\t): Promise<TaskCompletion<BashToolDetails | undefined>> => {\n\t\t\t\tif (control.signal.aborted) throw new Error(\"Command aborted\");\n\t\t\t\tresolveTimeoutMs(timeout);\n\t\t\t\tconst resolvedCommand = commandPrefix ? `${commandPrefix}\\n${command}` : command;\n\t\t\t\tconst spawnContext = resolveSpawnContext(\n\t\t\t\t\tresolvedCommand,\n\t\t\t\t\tctx?.cwd || cwd,\n\t\t\t\t\tspawnHook,\n\t\t\t\t\texposeSessionEnvironment,\n\t\t\t\t\tctx,\n\t\t\t\t);\n\t\t\t\t// A setup throw settles the task as failed, or cancelled once its signal fired.\n\t\t\t\treturn await runShellCommand({\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tcontext: spawnContext,\n\t\t\t\t\ttempFilePrefix: config.tempFilePrefix,\n\t\t\t\t\ttimeout,\n\t\t\t\t\tcontrol,\n\t\t\t\t\ttaskLog: sessionTasks !== undefined,\n\t\t\t\t});\n\t\t\t};\n\t\t\tlet outcome: TaskToolOutcome<BashToolDetails | undefined>;\n\t\t\ttry {\n\t\t\t\toutcome = await (sessionTasks ?? standalone!).execute<BashToolDetails | undefined>({\n\t\t\t\t\tkind: config.name,\n\t\t\t\t\tlabel: config.shellName[0]!.toUpperCase() + config.shellName.slice(1),\n\t\t\t\t\ttitle: command,\n\t\t\t\t\tinput: { label: \"Command\", text: command, truncated: false, language: config.name },\n\t\t\t\t\tfacts: [[\"Directory\", ctx?.cwd || cwd]],\n\t\t\t\t\ttoolCallId,\n\t\t\t\t\tbackground,\n\t\t\t\t\tsignal: parentSignal,\n\t\t\t\t\tonUpdate: originalUpdate,\n\t\t\t\t\trun,\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstandalone?.close();\n\t\t\t}\n\t\t\tif (outcome.kind === \"result\") return shellToolResult(outcome);\n\t\t\tconst tail = `Task ID: ${outcome.task.id}. Status: ${outcome.task.status}. Completion arrives automatically as a notification — do not poll or immediately wait on it; continue with other work or hand back to the user. Use tasks read to inspect output, tasks wait only when your next step is blocked on a result (one ID or any running task; prefer foreground next time in that case), or tasks kill to stop it.`;\n\t\t\t// Shell execution can become background work in two ways, and the model has to know which\n\t\t\t// one it got: a submitted background command starts from an empty log, while a detached\n\t\t\t// one already holds output and keeps its original timeout.\n\t\t\tconst handoff =\n\t\t\t\tbackground === true\n\t\t\t\t\t? `Command handed to background. ${tail}`\n\t\t\t\t\t: `Command moved to the background while it was running, by the user. The execution continues unchanged — no restart, and a supplied timeout is still measured from command startup. Output produced so far is already in the log, so tasks read now returns partial output, not a fresh start. ${tail}`;\n\t\t\treturn {\n\t\t\t\tstructuredContent: { task_id: outcome.task.id, status: outcome.task.status },\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${handoff}${outcome.task.outputPath ? `\\nFull output: ${outcome.task.outputPath}` : \"\"}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: {\n\t\t\t\t\tbackground: { kind: \"background\", taskId: outcome.task.id },\n\t\t\t\t\tfullOutputPath: outcome.task.outputPath,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t...createShellRenderers(config),\n\t};\n}\n\nconst bashToolConfig: ShellToolConfig = {\n\tname: \"bash\",\n\tlabel: \"bash\",\n\tshellName: \"bash\",\n\tprompt: \"$\",\n\tpromptSnippet: bashToolSystemPromptContribution.snippet,\n\tpromptGuidelines: bashToolSystemPromptContribution.guidelines,\n\ttempFilePrefix: \"pi-bash\",\n};\n\nexport function createBashToolDefinition(\n\tcwd: string,\n\toptions?: BashToolOptions,\n): ReturnType<typeof createShellToolDefinition> {\n\treturn createShellToolDefinition(cwd, bashToolConfig, {\n\t\t...options,\n\t\toperations: options?.operations ?? createLocalBashOperations({ shellPath: options?.shellPath }),\n\t});\n}\n\nexport function createBashTool(cwd: string, options?: BashToolOptions) {\n\tconst definition = createBashToolDefinition(cwd, options);\n\tconst tool = wrapToolDefinition(definition);\n\tObject.assign(tool, {\n\t\tpromptSnippet: definition.promptSnippet,\n\t\tpromptGuidelines: definition.promptGuidelines,\n\t});\n\treturn tool;\n}\n"]}
1
+ {"version":3,"file":"shell-tool.js","sourceRoot":"","sources":["../../../src/core/tools/shell-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAA+D,MAAM,mBAAmB,CAAC;AACjH,OAAO,EAGN,mBAAmB,EACnB,gBAAgB,GAEhB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAyB,MAAM,eAAe,CAAC;AAE5F,MAAM,UAAU,GAAG,IAAI,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AAG,EAAE,cAAc,EAAE;QACrD,GAAG,OAAO;QACV,UAAU,EAAE,OAAO,EAAE,UAAU,IAAI,yBAAyB,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KAC/F,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAyB;IACpE,MAAM,UAAU,GAAG,wBAAwB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QACnB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;KAC7C,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport type { ExtensionContext, ToolDefinition } from \"../extensions/types.ts\";\nimport { TaskRuntime } from \"../tasks/runtime.ts\";\nimport { TASKS_TOOL_NAME, type TaskCompletion, type TaskControl, type TaskToolOutcome } from \"../tasks/types.ts\";\nimport {\n\ttype BashOperations,\n\ttype BashToolOptions,\n\tresolveSpawnContext,\n\tresolveTimeoutMs,\n\ttype ShellToolConfig,\n} from \"./bash.ts\";\nimport { createShellRenderers } from \"./renderers/bash.ts\";\nimport { runShellCommand } from \"./shell-execution.ts\";\nimport { createLocalBashOperations } from \"./shell-operations.ts\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type TruncationResult } from \"./truncate.ts\";\n\nconst bashSchema = Type.Object({\n\tcommand: Type.String({ description: \"Shell command to execute\" }),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (optional, no default timeout)\" })),\n\tbackground: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription:\n\t\t\t\t\"true returns a managed task ID immediately and runs the command in the background, and you are notified when it completes — do not poll for its result; omit or false to block until exit\",\n\t\t}),\n\t),\n});\n\nexport const bashToolSystemPromptContribution = {\n\tsnippet: \"Execute bash commands, foreground or background\",\n\tguidelines: [\"You can inspect PI_* environment variables for current model and session details.\"],\n} as const;\n\nexport type BashToolInput = Static<typeof bashSchema>;\n\nconst bashOutputSchema = Type.Union([\n\tType.Object({\n\t\toutput: Type.String({\n\t\t\tdescription: \"Combined stdout and stderr, up to 1 MiB, keeping head and tail when truncated.\",\n\t\t}),\n\t\ttruncated: Type.Boolean(),\n\t\tfull_output_path: Type.Optional(Type.String()),\n\t\texit_code: Type.Number(),\n\t\twall_time_seconds: Type.Number(),\n\t}),\n\tType.Object({ task_id: Type.String(), status: Type.String() }),\n]);\n\nexport interface BashToolDetails {\n\ttruncation?: TruncationResult;\n\tfullOutputPath?: string;\n\t/** Settled handoff snapshot, not a command completion or exit code. */\n\tbackground?: { kind: \"background\"; taskId: string };\n}\n\nexport type BashRenderState = {\n\tdispose?: () => void;\n};\n\n/**\n * Translate terminal shell failures to the native foreground tool contract once. A task result\n * holds the command's output only; the foreground text is that output followed by the failure.\n */\nfunction shellToolResult(completion: TaskCompletion<BashToolDetails | undefined>) {\n\tconst status = completion.status;\n\tconst output = completion.result.content\n\t\t.filter((part) => part.type === \"text\")\n\t\t.map((part) => part.text)\n\t\t.join(\"\\n\");\n\tconst withError = (error: string) => (output ? `${output}\\n\\n${error}` : error);\n\tif (completion.result.structuredContent) {\n\t\tif (!completion.result.isError || !completion.error) return completion.result;\n\t\treturn { ...completion.result, content: [{ type: \"text\" as const, text: withError(completion.error) }] };\n\t}\n\tif (status === \"failed\" || status === \"timeout\" || status === \"cancelled\") {\n\t\tthrow new Error(\n\t\t\tcompletion.error ? withError(completion.error) : `${output ? `${output}\\n\\n` : \"\"}Command ${status}`,\n\t\t);\n\t}\n\treturn completion.result;\n}\n\nexport function createShellToolDefinition(\n\tcwd: string,\n\tconfig: ShellToolConfig,\n\toptions: BashToolOptions & { operations: BashOperations },\n): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState> {\n\tconst ops = options.operations;\n\tconst commandPrefix = options?.commandPrefix;\n\tconst exposeSessionEnvironment = options?.exposeSessionEnvironment ?? true;\n\tconst spawnHook = options?.spawnHook;\n\treturn {\n\t\tname: config.name,\n\t\tlabel: config.label,\n\t\tdescription: `Execute a ${config.shellName} command in the current working directory. Returns stdout and stderr, truncated to the last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first); the full output is saved to a temp file. Optionally provide a timeout in seconds (no default). Choose the mode per call: foreground (default) blocks until the command exits — use it when your next step needs the output; background: true returns immediately with a task ID — use it for long-running work (builds, servers, watchers, big test suites) or when you have independent work to continue. A handoff is not completion: the result arrives later as an automatic completion notification; meanwhile use ${TASKS_TOOL_NAME} read to inspect output and ${TASKS_TOOL_NAME} kill to stop it. Background output is limited to 20 MiB.`,\n\t\tpromptSnippet: config.promptSnippet,\n\t\tpromptGuidelines: exposeSessionEnvironment && config.promptGuidelines ? [...config.promptGuidelines] : undefined,\n\t\tparameters: bashSchema,\n\t\toutputSchema: bashOutputSchema,\n\t\tconstrainedSampling: { type: \"json_schema\", strict: \"prefer\" },\n\t\tasync execute(\n\t\t\ttoolCallId,\n\t\t\t{ command, timeout, background }: BashToolInput,\n\t\t\tparentSignal?: AbortSignal,\n\t\t\toriginalUpdate?,\n\t\t\tctx?: ExtensionContext,\n\t\t) {\n\t\t\tconst sessionTasks = ctx?.tasks;\n\t\t\tif (sessionTasks?.closed) throw new Error(\"Task service is closed\");\n\t\t\tif (!sessionTasks && background)\n\t\t\t\tthrow new Error(\"Background execution is not available in this host. No command was started.\");\n\t\t\t// Without a session the command still runs as a task, on a throwaway runtime that never backgrounds.\n\t\t\tconst standalone = sessionTasks ? undefined : new TaskRuntime();\n\t\t\tconst run = async (\n\t\t\t\tcontrol: TaskControl<BashToolDetails | undefined>,\n\t\t\t): Promise<TaskCompletion<BashToolDetails | undefined>> => {\n\t\t\t\tif (control.signal.aborted) throw new Error(\"Command aborted\");\n\t\t\t\tresolveTimeoutMs(timeout);\n\t\t\t\tconst resolvedCommand = commandPrefix ? `${commandPrefix}\\n${command}` : command;\n\t\t\t\tconst spawnContext = resolveSpawnContext(\n\t\t\t\t\tresolvedCommand,\n\t\t\t\t\tctx?.cwd || cwd,\n\t\t\t\t\tspawnHook,\n\t\t\t\t\texposeSessionEnvironment,\n\t\t\t\t\tctx,\n\t\t\t\t);\n\t\t\t\t// A setup throw settles the task as failed, or cancelled once its signal fired.\n\t\t\t\treturn await runShellCommand({\n\t\t\t\t\toperations: ops,\n\t\t\t\t\tcontext: spawnContext,\n\t\t\t\t\ttempFilePrefix: config.tempFilePrefix,\n\t\t\t\t\ttimeout,\n\t\t\t\t\tcontrol,\n\t\t\t\t\ttaskLog: sessionTasks !== undefined,\n\t\t\t\t});\n\t\t\t};\n\t\t\tlet outcome: TaskToolOutcome<BashToolDetails | undefined>;\n\t\t\ttry {\n\t\t\t\toutcome = await (sessionTasks ?? standalone!).execute<BashToolDetails | undefined>({\n\t\t\t\t\tkind: config.name,\n\t\t\t\t\tlabel: config.shellName[0]!.toUpperCase() + config.shellName.slice(1),\n\t\t\t\t\ttitle: command,\n\t\t\t\t\tinput: { label: \"Command\", text: command, truncated: false, language: config.name },\n\t\t\t\t\tfacts: [[\"Directory\", ctx?.cwd || cwd]],\n\t\t\t\t\ttoolCallId,\n\t\t\t\t\tbackground,\n\t\t\t\t\tsignal: parentSignal,\n\t\t\t\t\tonUpdate: originalUpdate,\n\t\t\t\t\trun,\n\t\t\t\t});\n\t\t\t} finally {\n\t\t\t\tstandalone?.close();\n\t\t\t}\n\t\t\tif (outcome.kind === \"result\") return shellToolResult(outcome);\n\t\t\tconst tail = `Task ID: ${outcome.task.id}. Status: ${outcome.task.status}. Completion arrives and wakes you automatically — do not poll or wait on it; continue with other work, or end your turn and hand back to the user. If you would only wait for the result, prefer foreground next time. Use ${TASKS_TOOL_NAME} read to inspect output or ${TASKS_TOOL_NAME} kill to stop it.`;\n\t\t\t// Shell execution can become background work in two ways, and the model has to know which\n\t\t\t// one it got: a submitted background command starts from an empty log, while a detached\n\t\t\t// one already holds output and keeps its original timeout.\n\t\t\tconst handoff =\n\t\t\t\toutcome.reason === \"submitted\"\n\t\t\t\t\t? `Command handed to background. ${tail}`\n\t\t\t\t\t: `Command moved to the background while it was running, by the user. The execution continues unchanged — no restart, and a supplied timeout is still measured from command startup. Output produced so far is already in the log, so ${TASKS_TOOL_NAME} read now returns partial output, not a fresh start. ${tail}`;\n\t\t\treturn {\n\t\t\t\tstructuredContent: { task_id: outcome.task.id, status: outcome.task.status },\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${handoff}${outcome.task.outputPath ? `\\nFull output: ${outcome.task.outputPath}` : \"\"}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: {\n\t\t\t\t\tbackground: { kind: \"background\", taskId: outcome.task.id },\n\t\t\t\t\tfullOutputPath: outcome.task.outputPath,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t...createShellRenderers(config),\n\t};\n}\n\nconst bashToolConfig: ShellToolConfig = {\n\tname: \"bash\",\n\tlabel: \"bash\",\n\tshellName: \"bash\",\n\tprompt: \"$\",\n\tpromptSnippet: bashToolSystemPromptContribution.snippet,\n\tpromptGuidelines: bashToolSystemPromptContribution.guidelines,\n\ttempFilePrefix: \"pi-bash\",\n};\n\nexport function createBashToolDefinition(\n\tcwd: string,\n\toptions?: BashToolOptions,\n): ReturnType<typeof createShellToolDefinition> {\n\treturn createShellToolDefinition(cwd, bashToolConfig, {\n\t\t...options,\n\t\toperations: options?.operations ?? createLocalBashOperations({ shellPath: options?.shellPath }),\n\t});\n}\n\nexport function createBashTool(cwd: string, options?: BashToolOptions) {\n\tconst definition = createBashToolDefinition(cwd, options);\n\tconst tool = wrapToolDefinition(definition);\n\tObject.assign(tool, {\n\t\tpromptSnippet: definition.promptSnippet,\n\t\tpromptGuidelines: definition.promptGuidelines,\n\t});\n\treturn tool;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { Theme } from "../../modes/interactive/theme/theme.ts";
2
+ import type { AgentActivity } from "./types.ts";
3
+ /**
4
+ * Themed rows for `activities`: an optional `… N earlier tool calls` line, then one row per call
5
+ * with an aligned tool-name column, durations right-aligned in one column, and a failed call's first
6
+ * error line beneath it. The table is as wide as its longest row, at most `width`. Measured at
7
+ * `now`, a running call shows a spinner frame and the time since it started.
8
+ */
9
+ export declare function activityLines(activities: readonly AgentActivity[], earlier: number, width: number, theme: Theme, now?: number): string[];
10
+ //# sourceMappingURL=activity-lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-lines.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/activity-lines.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAUpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAyDhD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,KAAK,EACZ,GAAG,SAAa,GACd,MAAM,EAAE,CAwBV"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The themed tool-call list of a running Agent. The Transcript's expanded row and the /tasks
3
+ * Output both render through `activityLines`, so the two cannot drift apart.
4
+ */
5
+ import { stripTerminalSequences, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
6
+ import { sanitizeBinaryOutput } from "../../utils/shell.js";
7
+ import { activityMarker, earlierLabel, errorLine, formatActivityDuration, nameColumnWidth, targetOf, } from "./activity.js";
8
+ /** ` · ` before the duration column. */
9
+ const SEPARATOR_WIDTH = 3;
10
+ /** One line of tool-call text with no terminal sequences or control characters; the Agent's arguments are untrusted. */
11
+ function oneLine(text) {
12
+ return sanitizeBinaryOutput(stripTerminalSequences(text)).replace(/\s+/gu, " ").trim();
13
+ }
14
+ /** A finished call's own duration; a running call's time since it started. */
15
+ function shownDuration(activity, now) {
16
+ if (activity.status === "running")
17
+ return activity.startedAt === undefined ? "" : formatActivityDuration(Math.max(0, now - activity.startedAt));
18
+ return formatActivityDuration(activity.durationMs);
19
+ }
20
+ /** `glyph name` with the padding that lines targets up, plus the space before the target. */
21
+ function headWidth(row, nameWidth) {
22
+ return visibleWidth(row.marker.glyph) + 1 + Math.max(nameWidth, visibleWidth(row.name)) + 1;
23
+ }
24
+ /**
25
+ * `glyph name target · duration`, with the durations right-aligned in one column ending at
26
+ * `tableWidth`. A long target gives way before the duration does.
27
+ */
28
+ function activityRow(row, nameWidth, durationWidth, tableWidth, theme) {
29
+ const { marker, name, target, duration } = row;
30
+ const padding = " ".repeat(Math.max(0, nameWidth - visibleWidth(name)));
31
+ const head = `${theme.fg(marker.color, marker.glyph)} ${theme.fg("toolTitle", name)}${padding}`;
32
+ const durationPad = " ".repeat(Math.max(0, durationWidth - visibleWidth(duration)));
33
+ const tail = duration ? `${theme.fg("dim", " · ")}${durationPad}${theme.fg("dim", duration)}` : "";
34
+ if (!target && !tail)
35
+ return truncateToWidth(head.trimEnd(), tableWidth, "…");
36
+ const room = tableWidth - headWidth(row, nameWidth) - (tail ? SEPARATOR_WIDTH + durationWidth : 0);
37
+ // Without room for even a clipped target, the whole row is clipped instead.
38
+ if (room < 2)
39
+ return truncateToWidth(`${head} ${theme.fg("muted", target)}${tail}`, tableWidth, "…");
40
+ const clipped = truncateToWidth(target, room, "…");
41
+ // A row without a duration ends at its target instead of trailing blanks.
42
+ if (!tail)
43
+ return `${head} ${theme.fg("muted", clipped)}`;
44
+ return `${head} ${theme.fg("muted", clipped)}${" ".repeat(room - visibleWidth(clipped))}${tail}`;
45
+ }
46
+ /**
47
+ * Themed rows for `activities`: an optional `… N earlier tool calls` line, then one row per call
48
+ * with an aligned tool-name column, durations right-aligned in one column, and a failed call's first
49
+ * error line beneath it. The table is as wide as its longest row, at most `width`. Measured at
50
+ * `now`, a running call shows a spinner frame and the time since it started.
51
+ */
52
+ export function activityLines(activities, earlier, width, theme, now = Date.now()) {
53
+ if (width <= 0)
54
+ return [];
55
+ const nameWidth = nameColumnWidth(activities);
56
+ const rows = activities.map((activity) => ({
57
+ activity,
58
+ marker: activityMarker(activity.status, now),
59
+ name: oneLine(activity.name),
60
+ target: oneLine(targetOf(activity)),
61
+ duration: shownDuration(activity, now),
62
+ }));
63
+ const durationWidth = Math.max(0, ...rows.map((row) => visibleWidth(row.duration)));
64
+ const tailWidth = durationWidth ? SEPARATOR_WIDTH + durationWidth : 0;
65
+ const naturalWidth = Math.max(0, ...rows.map((row) => headWidth(row, nameWidth) + visibleWidth(row.target) + tailWidth));
66
+ const tableWidth = Math.min(width, naturalWidth);
67
+ const lines = earlier > 0 ? [truncateToWidth(theme.fg("dim", earlierLabel(earlier)), width, "…")] : [];
68
+ for (const row of rows) {
69
+ lines.push(activityRow(row, nameWidth, durationWidth, tableWidth, theme));
70
+ const error = row.activity.error ? oneLine(errorLine(row.activity.error)) : "";
71
+ if (error)
72
+ lines.push(truncateToWidth(`${" ".repeat(3 + nameWidth)}${theme.fg("error", error)}`, width, "…"));
73
+ }
74
+ return lines;
75
+ }
76
+ //# sourceMappingURL=activity-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-lines.js","sourceRoot":"","sources":["../../../src/extensions/agent/activity-lines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACN,cAAc,EACd,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,eAAe,EACf,QAAQ,GACR,MAAM,eAAe,CAAC;AAGvB,wCAAwC;AAC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,KAAK,EAAE,YAAY,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvG,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1E,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAC/G,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/**\n * The themed tool-call list of a running Agent. The Transcript's expanded row and the /tasks\n * Output both render through `activityLines`, so the two cannot drift apart.\n */\nimport { stripTerminalSequences, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { StatusMarker } from \"../../modes/interactive/components/status-marker.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { sanitizeBinaryOutput } from \"../../utils/shell.ts\";\nimport {\n\tactivityMarker,\n\tearlierLabel,\n\terrorLine,\n\tformatActivityDuration,\n\tnameColumnWidth,\n\ttargetOf,\n} from \"./activity.ts\";\nimport type { AgentActivity } from \"./types.ts\";\n\n/** ` · ` before the duration column. */\nconst SEPARATOR_WIDTH = 3;\n\n/** One row's text and marker before styling; widths are measured on these. */\ninterface RowParts {\n\tactivity: AgentActivity;\n\tmarker: StatusMarker;\n\tname: string;\n\ttarget: string;\n\tduration: string;\n}\n\n/** One line of tool-call text with no terminal sequences or control characters; the Agent's arguments are untrusted. */\nfunction oneLine(text: string): string {\n\treturn sanitizeBinaryOutput(stripTerminalSequences(text)).replace(/\\s+/gu, \" \").trim();\n}\n\n/** A finished call's own duration; a running call's time since it started. */\nfunction shownDuration(activity: AgentActivity, now: number): string {\n\tif (activity.status === \"running\")\n\t\treturn activity.startedAt === undefined ? \"\" : formatActivityDuration(Math.max(0, now - activity.startedAt));\n\treturn formatActivityDuration(activity.durationMs);\n}\n\n/** `glyph name` with the padding that lines targets up, plus the space before the target. */\nfunction headWidth(row: RowParts, nameWidth: number): number {\n\treturn visibleWidth(row.marker.glyph) + 1 + Math.max(nameWidth, visibleWidth(row.name)) + 1;\n}\n\n/**\n * `glyph name target · duration`, with the durations right-aligned in one column ending at\n * `tableWidth`. A long target gives way before the duration does.\n */\nfunction activityRow(\n\trow: RowParts,\n\tnameWidth: number,\n\tdurationWidth: number,\n\ttableWidth: number,\n\ttheme: Theme,\n): string {\n\tconst { marker, name, target, duration } = row;\n\tconst padding = \" \".repeat(Math.max(0, nameWidth - visibleWidth(name)));\n\tconst head = `${theme.fg(marker.color, marker.glyph)} ${theme.fg(\"toolTitle\", name)}${padding}`;\n\tconst durationPad = \" \".repeat(Math.max(0, durationWidth - visibleWidth(duration)));\n\tconst tail = duration ? `${theme.fg(\"dim\", \" · \")}${durationPad}${theme.fg(\"dim\", duration)}` : \"\";\n\tif (!target && !tail) return truncateToWidth(head.trimEnd(), tableWidth, \"…\");\n\tconst room = tableWidth - headWidth(row, nameWidth) - (tail ? SEPARATOR_WIDTH + durationWidth : 0);\n\t// Without room for even a clipped target, the whole row is clipped instead.\n\tif (room < 2) return truncateToWidth(`${head} ${theme.fg(\"muted\", target)}${tail}`, tableWidth, \"…\");\n\tconst clipped = truncateToWidth(target, room, \"…\");\n\t// A row without a duration ends at its target instead of trailing blanks.\n\tif (!tail) return `${head} ${theme.fg(\"muted\", clipped)}`;\n\treturn `${head} ${theme.fg(\"muted\", clipped)}${\" \".repeat(room - visibleWidth(clipped))}${tail}`;\n}\n\n/**\n * Themed rows for `activities`: an optional `… N earlier tool calls` line, then one row per call\n * with an aligned tool-name column, durations right-aligned in one column, and a failed call's first\n * error line beneath it. The table is as wide as its longest row, at most `width`. Measured at\n * `now`, a running call shows a spinner frame and the time since it started.\n */\nexport function activityLines(\n\tactivities: readonly AgentActivity[],\n\tearlier: number,\n\twidth: number,\n\ttheme: Theme,\n\tnow = Date.now(),\n): string[] {\n\tif (width <= 0) return [];\n\tconst nameWidth = nameColumnWidth(activities);\n\tconst rows: RowParts[] = activities.map((activity) => ({\n\t\tactivity,\n\t\tmarker: activityMarker(activity.status, now),\n\t\tname: oneLine(activity.name),\n\t\ttarget: oneLine(targetOf(activity)),\n\t\tduration: shownDuration(activity, now),\n\t}));\n\tconst durationWidth = Math.max(0, ...rows.map((row) => visibleWidth(row.duration)));\n\tconst tailWidth = durationWidth ? SEPARATOR_WIDTH + durationWidth : 0;\n\tconst naturalWidth = Math.max(\n\t\t0,\n\t\t...rows.map((row) => headWidth(row, nameWidth) + visibleWidth(row.target) + tailWidth),\n\t);\n\tconst tableWidth = Math.min(width, naturalWidth);\n\tconst lines = earlier > 0 ? [truncateToWidth(theme.fg(\"dim\", earlierLabel(earlier)), width, \"…\")] : [];\n\tfor (const row of rows) {\n\t\tlines.push(activityRow(row, nameWidth, durationWidth, tableWidth, theme));\n\t\tconst error = row.activity.error ? oneLine(errorLine(row.activity.error)) : \"\";\n\t\tif (error) lines.push(truncateToWidth(`${\" \".repeat(3 + nameWidth)}${theme.fg(\"error\", error)}`, width, \"…\"));\n\t}\n\treturn lines;\n}\n"]}
@@ -1,13 +1,34 @@
1
+ import { type StatusMarker } from "../../modes/interactive/components/status-marker.ts";
1
2
  import type { AgentActivity } from "./types.ts";
2
3
  export declare function clipText(text: string, bytes: number): string;
3
4
  export declare function compactArguments(args: unknown): string;
5
+ /**
6
+ * An absolute path inside `cwd` as a forward-slash relative path. Relative paths and paths outside
7
+ * `cwd` are returned unchanged; nothing is ever resolved against the process working directory.
8
+ */
9
+ export declare function relativeToCwd(path: string, cwd: string | undefined): string;
4
10
  /** A short display target; full arguments remain available in Tasks Output. */
5
- export declare function activityTarget(name: string, args: unknown): string;
11
+ export declare function activityTarget(name: string, args: unknown, cwd?: string): string;
6
12
  /** The stored display target, or one derived from the bounded arguments. */
7
13
  export declare function targetOf(activity: AgentActivity): string;
14
+ /** `Nms` under a second, `N.Ns` under a minute, then the shared `1m 5s` form. */
8
15
  export declare function formatActivityDuration(ms: number | undefined): string;
16
+ /**
17
+ * A call's glyph and color in the shared task status vocabulary, so a call reads like the task
18
+ * rows around it in /tasks. Pass `now` to animate a running call as a spinner frame.
19
+ */
20
+ export declare function activityMarker(status: AgentActivity["status"], now?: number): StatusMarker;
9
21
  export declare function activityGlyph(status: AgentActivity["status"]): string;
10
- /** The Transcript's `glyph tool target · duration` form, plus an indented failure excerpt. */
11
- export declare function activityText(activity: AgentActivity, includeError?: boolean): string;
12
- export declare function activitiesText(activities: readonly AgentActivity[]): string;
22
+ /** Width of the tool-name column for the calls being shown. */
23
+ export declare function nameColumnWidth(activities: readonly AgentActivity[]): number;
24
+ /** Pads a name only when a target follows it, so a bare name leaves no trailing blanks. */
25
+ export declare function paddedName(activity: AgentActivity, width: number): string;
26
+ /** The first non-empty line of a failure, clipped to one display line. */
27
+ export declare function errorLine(error: string): string;
28
+ /** `glyph name target · duration`, plus a failure line under the target column. */
29
+ export declare function activityText(activity: AgentActivity, nameWidth?: number): string;
30
+ /** The line standing for calls no longer retained. */
31
+ export declare function earlierLabel(earlier: number): string;
32
+ /** The plain /tasks display: a count of calls no longer retained, then one aligned row per call. */
33
+ export declare function activitiesText(activities: readonly AgentActivity[], earlier?: number): string;
13
34
  //# sourceMappingURL=activity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/activity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAMtD;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAgBlE;AAED,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAOxD;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAGrE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,MAAM,CAWrE;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,YAAY,UAAO,GAAG,MAAM,CAOjF;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAE3E"}
1
+ {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/activity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,qDAAqD,CAAC;AAEtG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMhD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAMtD;AAOD;;;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Transcript and /tasks. */
2
+ import { isAbsolute, relative, sep, win32 } from "node:path";
2
3
  import { boundText } from "../../core/tasks/output.js";
4
+ import { statusMarker } from "../../modes/interactive/components/status-marker.js";
5
+ import { formatDuration } from "../../utils/duration.js";
6
+ /** The tool-name column never grows past this, so one long name cannot push every target away. */
7
+ const NAME_COLUMN_MAX = 8;
8
+ const ERROR_LINE_CHARS = 160;
3
9
  export function clipText(text, bytes) {
4
10
  if (Buffer.byteLength(text) <= bytes)
5
11
  return text;
@@ -13,8 +19,27 @@ export function compactArguments(args) {
13
19
  return "{…}";
14
20
  }
15
21
  }
22
+ /** A fully qualified absolute path; a rooted path without a drive would resolve against the process drive. */
23
+ function isQualifiedAbsolute(path) {
24
+ return process.platform === "win32" ? /^(?:[A-Za-z]:[\\/]|[\\/]{2})/u.test(path) : isAbsolute(path);
25
+ }
26
+ /**
27
+ * An absolute path inside `cwd` as a forward-slash relative path. Relative paths and paths outside
28
+ * `cwd` are returned unchanged; nothing is ever resolved against the process working directory.
29
+ */
30
+ export function relativeToCwd(path, cwd) {
31
+ if (!cwd || !isQualifiedAbsolute(path) || !isQualifiedAbsolute(cwd))
32
+ return path;
33
+ // node:path compares case-insensitively on Windows and exactly elsewhere.
34
+ const rel = relative(cwd, path);
35
+ if (rel === "")
36
+ return ".";
37
+ if (rel === ".." || rel.startsWith(`..${sep}`) || isAbsolute(rel) || win32.isAbsolute(rel))
38
+ return path;
39
+ return rel.split(sep).join("/");
40
+ }
16
41
  /** A short display target; full arguments remain available in Tasks Output. */
17
- export function activityTarget(name, args) {
42
+ export function activityTarget(name, args, cwd) {
18
43
  if (!args || typeof args !== "object" || Array.isArray(args))
19
44
  return compactArguments(args);
20
45
  const record = args;
@@ -28,7 +53,8 @@ export function activityTarget(name, args) {
28
53
  if (typeof value !== "string" || !value.trim())
29
54
  continue;
30
55
  const first = key === "command" ? value.split(/\r?\n/).find((line) => line.trim()) : value;
31
- return clipText((first ?? value).trim().replace(/[ \t]+/gu, " "), 160);
56
+ const text = (first ?? value).trim().replace(/[ \t]+/gu, " ");
57
+ return clipText(key === "path" ? relativeToCwd(text, cwd) : text, 160);
32
58
  }
33
59
  return compactArguments(args);
34
60
  }
@@ -43,33 +69,62 @@ export function targetOf(activity) {
43
69
  return activity.args;
44
70
  }
45
71
  }
72
+ /** `Nms` under a second, `N.Ns` under a minute, then the shared `1m 5s` form. */
46
73
  export function formatActivityDuration(ms) {
47
74
  if (ms === undefined)
48
75
  return "";
49
- return ms < 1000 ? `${Math.round(ms)}ms` : `${(ms / 1000).toFixed(1)}s`;
76
+ const millis = Math.round(ms);
77
+ if (millis < 1000)
78
+ return `${millis}ms`;
79
+ const tenths = Math.round(ms / 100) / 10;
80
+ return tenths < 60 ? `${tenths.toFixed(1)}s` : formatDuration(ms);
81
+ }
82
+ const TASK_STATUS = {
83
+ running: "running",
84
+ ok: "completed",
85
+ error: "failed",
86
+ cancelled: "cancelled",
87
+ };
88
+ /**
89
+ * A call's glyph and color in the shared task status vocabulary, so a call reads like the task
90
+ * rows around it in /tasks. Pass `now` to animate a running call as a spinner frame.
91
+ */
92
+ export function activityMarker(status, now) {
93
+ return statusMarker(TASK_STATUS[status], now === undefined ? undefined : { now });
50
94
  }
51
95
  export function activityGlyph(status) {
52
- switch (status) {
53
- case "running":
54
- return "…";
55
- case "ok":
56
- return "✓";
57
- case "error":
58
- return "✗";
59
- case "cancelled":
60
- return "⊘";
61
- }
96
+ return activityMarker(status).glyph;
62
97
  }
63
- /** The Transcript's `glyph tool target · duration` form, plus an indented failure excerpt. */
64
- export function activityText(activity, includeError = true) {
98
+ /** Width of the tool-name column for the calls being shown. */
99
+ export function nameColumnWidth(activities) {
100
+ return Math.min(NAME_COLUMN_MAX, Math.max(0, ...activities.map((activity) => activity.name.length)));
101
+ }
102
+ /** Pads a name only when a target follows it, so a bare name leaves no trailing blanks. */
103
+ export function paddedName(activity, width) {
104
+ return targetOf(activity) ? activity.name.padEnd(width) : activity.name;
105
+ }
106
+ /** The first non-empty line of a failure, clipped to one display line. */
107
+ export function errorLine(error) {
108
+ const line = (error.split(/\r?\n/u).find((part) => part.trim()) ?? "").replace(/\s+/gu, " ").trim();
109
+ const chars = Array.from(line);
110
+ return chars.length > ERROR_LINE_CHARS ? `${chars.slice(0, ERROR_LINE_CHARS - 1).join("")}…` : line;
111
+ }
112
+ /** `glyph name target · duration`, plus a failure line under the target column. */
113
+ export function activityText(activity, nameWidth = nameColumnWidth([activity])) {
65
114
  const target = targetOf(activity);
66
115
  const duration = formatActivityDuration(activity.durationMs);
67
- const line = `${activityGlyph(activity.status)} ${activity.name}${target ? ` ${target}` : ""}${duration ? ` · ${duration}` : ""}`;
68
- return includeError && activity.error
69
- ? `${line}\n ${clipText(activity.error, 1000).replaceAll("\n", "\n ")}`
70
- : line;
116
+ const line = `${activityGlyph(activity.status)} ${paddedName(activity, nameWidth)}${target ? ` ${target}` : ""}${duration ? ` · ${duration}` : ""}`;
117
+ const error = activity.error ? errorLine(activity.error) : "";
118
+ return error ? `${line}\n${" ".repeat(3 + nameWidth)}${error}` : line;
119
+ }
120
+ /** The line standing for calls no longer retained. */
121
+ export function earlierLabel(earlier) {
122
+ return `… ${earlier} earlier tool ${earlier === 1 ? "call" : "calls"}`;
71
123
  }
72
- export function activitiesText(activities) {
73
- return activities.map((activity) => activityText(activity)).join("\n");
124
+ /** The plain /tasks display: a count of calls no longer retained, then one aligned row per call. */
125
+ export function activitiesText(activities, earlier = 0) {
126
+ const width = nameColumnWidth(activities);
127
+ const rows = activities.map((activity) => activityText(activity, width));
128
+ return (earlier > 0 ? [earlierLabel(earlier), ...rows] : rows).join("\n");
74
129
  }
75
130
  //# sourceMappingURL=activity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../src/extensions/agent/activity.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGvD,MAAM,UAAU,QAAQ,CAAC,IAAY,E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AAC;QACZ,KAAK,WAAW;YACf,OAAO,GAAG,CAAC;IACb,CAAC;AACF,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,YAAY,CAAC,QAAuB,EAAE,YAAY,GAAG,IAAI;IACxE,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAClI,OAAO,YAAY,IAAI,QAAQ,CAAC,KAAK;QACpC,CAAC,CAAC,GAAG,IAAI,SAAS,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;QAC7E,CAAC,CAAC,IAAI,CAAC;AACT,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAoC;IAClE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/** Compact, bounded formatting of an Agent's tool-call activity, shared by the Transcript and /tasks. */\nimport { boundText } from \"../../core/tasks/output.ts\";\nimport type { AgentActivity } from \"./types.ts\";\n\nexport function clipText(text: string, bytes: number): string {\n\tif (Buffer.byteLength(text) <= bytes) return text;\n\treturn `${boundText(text, Math.max(1, bytes - 1))}…`;\n}\n\nexport function compactArguments(args: unknown): string {\n\ttry {\n\t\treturn clipText(JSON.stringify(args) ?? String(args), 512).replace(/\\s+/gu, \" \");\n\t} catch {\n\t\treturn \"{…}\";\n\t}\n}\n\n/** A short display target; full arguments remain available in Tasks Output. */\nexport function activityTarget(name: string, args: unknown): string {\n\tif (!args || typeof args !== \"object\" || Array.isArray(args)) return compactArguments(args);\n\tconst record = args as Record<string, unknown>;\n\tconst keys =\n\t\tname === \"bash\" || name === \"powershell\"\n\t\t\t? [\"command\"]\n\t\t\t: name === \"grep\" || name === \"find\"\n\t\t\t\t? [\"pattern\", \"path\"]\n\t\t\t\t: [\"path\", \"pattern\", \"command\"];\n\tfor (const key of keys) {\n\t\tconst value = record[key];\n\t\tif (typeof value !== \"string\" || !value.trim()) continue;\n\t\tconst first = key === \"command\" ? value.split(/\\r?\\n/).find((line) => line.trim()) : value;\n\t\treturn clipText((first ?? value).trim().replace(/[ \\t]+/gu, \" \"), 160);\n\t}\n\treturn compactArguments(args);\n}\n\n/** The stored display target, or one derived from the bounded arguments. */\nexport function targetOf(activity: AgentActivity): string {\n\tif (activity.target) return activity.target;\n\ttry {\n\t\treturn activityTarget(activity.name, JSON.parse(activity.args));\n\t} catch {\n\t\treturn activity.args;\n\t}\n}\n\nexport function formatActivityDuration(ms: number | undefined): string {\n\tif (ms === undefined) return \"\";\n\treturn ms < 1000 ? `${Math.round(ms)}ms` : `${(ms / 1000).toFixed(1)}s`;\n}\n\nexport function activityGlyph(status: AgentActivity[\"status\"]): string {\n\tswitch (status) {\n\t\tcase \"running\":\n\t\t\treturn \"…\";\n\t\tcase \"ok\":\n\t\t\treturn \"✓\";\n\t\tcase \"error\":\n\t\t\treturn \"✗\";\n\t\tcase \"cancelled\":\n\t\t\treturn \"⊘\";\n\t}\n}\n\n/** The Transcript's `glyph tool target · duration` form, plus an indented failure excerpt. */\nexport function activityText(activity: AgentActivity, includeError = true): string {\n\tconst target = targetOf(activity);\n\tconst duration = formatActivityDuration(activity.durationMs);\n\tconst line = `${activityGlyph(activity.status)} ${activity.name}${target ? ` ${target}` : \"\"}${duration ? ` · ${duration}` : \"\"}`;\n\treturn includeError && activity.error\n\t\t? `${line}\\n ${clipText(activity.error, 1000).replaceAll(\"\\n\", \"\\n \")}`\n\t\t: line;\n}\n\nexport function activitiesText(activities: readonly AgentActivity[]): string {\n\treturn activities.map((activity) => activityText(activity)).join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"activity.js","sourceRoot":"","sources":["../../../src/extensions/agent/activity.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAqB,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,kGAAkG;AAClG,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAa;IACnD,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,IAAI,CAAC;IAClD,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAa;IAC7C,IAAI,CAAC;QACJ,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAClF,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AAED,8GAA8G;AAC9G,SAAS,mBAAmB,CAAC,IAAY;IACxC,OAAO,OAAO,CAAC,QAAQ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,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,OAAe;IAC3C,OAAO,KAAK,OAAO,iBAAiB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AACxE,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,UAAoC,EAAE,OAAO,GAAG,CAAC;IAC/E,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IACzE,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["/** Compact, bounded formatting of an Agent's tool-call activity, shared by the Transcript and /tasks. */\nimport { isAbsolute, relative, sep, win32 } from \"node:path\";\nimport { boundText } from \"../../core/tasks/output.ts\";\nimport type { TaskStatus } from \"../../core/tasks/types.ts\";\nimport { type StatusMarker, statusMarker } from \"../../modes/interactive/components/status-marker.ts\";\nimport { formatDuration } from \"../../utils/duration.ts\";\nimport type { AgentActivity } from \"./types.ts\";\n\n/** The tool-name column never grows past this, so one long name cannot push every target away. */\nconst NAME_COLUMN_MAX = 8;\nconst ERROR_LINE_CHARS = 160;\n\nexport function clipText(text: string, bytes: number): string {\n\tif (Buffer.byteLength(text) <= bytes) return text;\n\treturn `${boundText(text, Math.max(1, bytes - 1))}…`;\n}\n\nexport function compactArguments(args: unknown): string {\n\ttry {\n\t\treturn clipText(JSON.stringify(args) ?? String(args), 512).replace(/\\s+/gu, \" \");\n\t} catch {\n\t\treturn \"{…}\";\n\t}\n}\n\n/** A fully qualified absolute path; a rooted path without a drive would resolve against the process drive. */\nfunction isQualifiedAbsolute(path: string): boolean {\n\treturn process.platform === \"win32\" ? /^(?:[A-Za-z]:[\\\\/]|[\\\\/]{2})/u.test(path) : isAbsolute(path);\n}\n\n/**\n * An absolute path inside `cwd` as a forward-slash relative path. Relative paths and paths outside\n * `cwd` are returned unchanged; nothing is ever resolved against the process working directory.\n */\nexport function relativeToCwd(path: string, cwd: string | undefined): string {\n\tif (!cwd || !isQualifiedAbsolute(path) || !isQualifiedAbsolute(cwd)) return path;\n\t// node:path compares case-insensitively on Windows and exactly elsewhere.\n\tconst rel = relative(cwd, path);\n\tif (rel === \"\") return \".\";\n\tif (rel === \"..\" || rel.startsWith(`..${sep}`) || isAbsolute(rel) || win32.isAbsolute(rel)) return path;\n\treturn rel.split(sep).join(\"/\");\n}\n\n/** A short display target; full arguments remain available in Tasks Output. */\nexport function activityTarget(name: string, args: unknown, cwd?: string): string {\n\tif (!args || typeof args !== \"object\" || Array.isArray(args)) return compactArguments(args);\n\tconst record = args as Record<string, unknown>;\n\tconst keys =\n\t\tname === \"bash\" || name === \"powershell\"\n\t\t\t? [\"command\"]\n\t\t\t: name === \"grep\" || name === \"find\"\n\t\t\t\t? [\"pattern\", \"path\"]\n\t\t\t\t: [\"path\", \"pattern\", \"command\"];\n\tfor (const key of keys) {\n\t\tconst value = record[key];\n\t\tif (typeof value !== \"string\" || !value.trim()) continue;\n\t\tconst first = key === \"command\" ? value.split(/\\r?\\n/).find((line) => line.trim()) : value;\n\t\tconst text = (first ?? value).trim().replace(/[ \\t]+/gu, \" \");\n\t\treturn clipText(key === \"path\" ? relativeToCwd(text, cwd) : text, 160);\n\t}\n\treturn compactArguments(args);\n}\n\n/** The stored display target, or one derived from the bounded arguments. */\nexport function targetOf(activity: AgentActivity): string {\n\tif (activity.target) return activity.target;\n\ttry {\n\t\treturn activityTarget(activity.name, JSON.parse(activity.args));\n\t} catch {\n\t\treturn activity.args;\n\t}\n}\n\n/** `Nms` under a second, `N.Ns` under a minute, then the shared `1m 5s` form. */\nexport function formatActivityDuration(ms: number | undefined): string {\n\tif (ms === undefined) return \"\";\n\tconst millis = Math.round(ms);\n\tif (millis < 1000) return `${millis}ms`;\n\tconst tenths = Math.round(ms / 100) / 10;\n\treturn tenths < 60 ? `${tenths.toFixed(1)}s` : formatDuration(ms);\n}\n\nconst TASK_STATUS: Record<AgentActivity[\"status\"], TaskStatus> = {\n\trunning: \"running\",\n\tok: \"completed\",\n\terror: \"failed\",\n\tcancelled: \"cancelled\",\n};\n\n/**\n * A call's glyph and color in the shared task status vocabulary, so a call reads like the task\n * rows around it in /tasks. Pass `now` to animate a running call as a spinner frame.\n */\nexport function activityMarker(status: AgentActivity[\"status\"], now?: number): StatusMarker {\n\treturn statusMarker(TASK_STATUS[status], now === undefined ? undefined : { now });\n}\n\nexport function activityGlyph(status: AgentActivity[\"status\"]): string {\n\treturn activityMarker(status).glyph;\n}\n\n/** Width of the tool-name column for the calls being shown. */\nexport function nameColumnWidth(activities: readonly AgentActivity[]): number {\n\treturn Math.min(NAME_COLUMN_MAX, Math.max(0, ...activities.map((activity) => activity.name.length)));\n}\n\n/** Pads a name only when a target follows it, so a bare name leaves no trailing blanks. */\nexport function paddedName(activity: AgentActivity, width: number): string {\n\treturn targetOf(activity) ? activity.name.padEnd(width) : activity.name;\n}\n\n/** The first non-empty line of a failure, clipped to one display line. */\nexport function errorLine(error: string): string {\n\tconst line = (error.split(/\\r?\\n/u).find((part) => part.trim()) ?? \"\").replace(/\\s+/gu, \" \").trim();\n\tconst chars = Array.from(line);\n\treturn chars.length > ERROR_LINE_CHARS ? `${chars.slice(0, ERROR_LINE_CHARS - 1).join(\"\")}…` : line;\n}\n\n/** `glyph name target · duration`, plus a failure line under the target column. */\nexport function activityText(activity: AgentActivity, nameWidth = nameColumnWidth([activity])): string {\n\tconst target = targetOf(activity);\n\tconst duration = formatActivityDuration(activity.durationMs);\n\tconst line = `${activityGlyph(activity.status)} ${paddedName(activity, nameWidth)}${target ? ` ${target}` : \"\"}${duration ? ` · ${duration}` : \"\"}`;\n\tconst error = activity.error ? errorLine(activity.error) : \"\";\n\treturn error ? `${line}\\n${\" \".repeat(3 + nameWidth)}${error}` : line;\n}\n\n/** The line standing for calls no longer retained. */\nexport function earlierLabel(earlier: number): string {\n\treturn `… ${earlier} earlier tool ${earlier === 1 ? \"call\" : \"calls\"}`;\n}\n\n/** The plain /tasks display: a count of calls no longer retained, then one aligned row per call. */\nexport function activitiesText(activities: readonly AgentActivity[], earlier = 0): string {\n\tconst width = nameColumnWidth(activities);\n\tconst rows = activities.map((activity) => activityText(activity, width));\n\treturn (earlier > 0 ? [earlierLabel(earlier), ...rows] : rows).join(\"\\n\");\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /** Files one Agent task keeps beside the session that launched it, so they outlive Tasks retention and restore. */
2
+ export interface AgentArtifacts {
3
+ dir: string;
4
+ reportPath: string;
5
+ transcriptPath: string;
6
+ /** The launching session file, recorded as the transcript's parent. */
7
+ parentSession?: string;
8
+ }
9
+ /** `<session artifacts>/agents/<taskId>/`, created on demand; undefined when the session is not persisted or the directory is unavailable. */
10
+ export declare function prepareArtifacts(sessionArtifactDir: string | undefined, taskId: string, parentSession: string | undefined): Promise<AgentArtifacts | undefined>;
11
+ /** The transcript path once the child session has written it; a run that failed before its first message has none. */
12
+ export declare function savedTranscript(artifacts: AgentArtifacts | undefined): string | undefined;
13
+ /** Items joined by commas within `bytes`, ending in `+N more` when some do not fit. */
14
+ export declare function fitList(items: readonly string[], bytes: number): string;
15
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/artifacts.ts"],"names":[],"mappings":"AAKA,mHAAmH;AACnH,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAKD,8IAA8I;AAC9I,wBAAsB,gBAAgB,CACrC,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CASrC;AAED,sHAAsH;AACtH,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzF;AAED,uFAAuF;AACvF,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAcvE"}
@@ -0,0 +1,44 @@
1
+ import { existsSync } from "node:fs";
2
+ import { mkdir } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { clipText } from "./activity.js";
5
+ /** Room reserved for a trailing ` +N more`. */
6
+ const MORE_RESERVE_BYTES = 16;
7
+ /** `<session artifacts>/agents/<taskId>/`, created on demand; undefined when the session is not persisted or the directory is unavailable. */
8
+ export async function prepareArtifacts(sessionArtifactDir, taskId, parentSession) {
9
+ if (!sessionArtifactDir)
10
+ return undefined;
11
+ const dir = join(sessionArtifactDir, "agents", taskId);
12
+ try {
13
+ await mkdir(dir, { recursive: true });
14
+ }
15
+ catch {
16
+ return undefined;
17
+ }
18
+ return { dir, reportPath: join(dir, "report.md"), transcriptPath: join(dir, "transcript.jsonl"), parentSession };
19
+ }
20
+ /** The transcript path once the child session has written it; a run that failed before its first message has none. */
21
+ export function savedTranscript(artifacts) {
22
+ return artifacts && existsSync(artifacts.transcriptPath) ? artifacts.transcriptPath : undefined;
23
+ }
24
+ /** Items joined by commas within `bytes`, ending in `+N more` when some do not fit. */
25
+ export function fitList(items, bytes) {
26
+ const full = items.join(", ");
27
+ if (Buffer.byteLength(full) <= bytes)
28
+ return full;
29
+ let shown = 0;
30
+ let used = 0;
31
+ for (const item of items) {
32
+ const next = used + Buffer.byteLength(item) + (shown ? 2 : 0);
33
+ if (next > bytes - MORE_RESERVE_BYTES)
34
+ break;
35
+ used = next;
36
+ shown++;
37
+ }
38
+ if (items.length === 1)
39
+ return clipText(full, bytes);
40
+ if (shown === 0)
41
+ return `${clipText(items[0] ?? "", bytes - MORE_RESERVE_BYTES)} +${items.length - 1} more`;
42
+ return `${items.slice(0, shown).join(", ")} +${items.length - shown} more`;
43
+ }
44
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../../src/extensions/agent/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAWzC,+CAA+C;AAC/C,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,8IAA8I;AAC9I,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,kBAAsC,EACtC,MAAc,EACd,aAAiC;IAEjC,IAAI,CAAC,kBAAkB;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvD,IAAI,CAAC;QACJ,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,O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AC;IAC5G,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,KAAK,OAAO,CAAC;AAC5E,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { clipText } from \"./activity.ts\";\n\n/** Files one Agent task keeps beside the session that launched it, so they outlive Tasks retention and restore. */\nexport interface AgentArtifacts {\n\tdir: string;\n\treportPath: string;\n\ttranscriptPath: string;\n\t/** The launching session file, recorded as the transcript's parent. */\n\tparentSession?: string;\n}\n\n/** Room reserved for a trailing ` +N more`. */\nconst MORE_RESERVE_BYTES = 16;\n\n/** `<session artifacts>/agents/<taskId>/`, created on demand; undefined when the session is not persisted or the directory is unavailable. */\nexport async function prepareArtifacts(\n\tsessionArtifactDir: string | undefined,\n\ttaskId: string,\n\tparentSession: string | undefined,\n): Promise<AgentArtifacts | undefined> {\n\tif (!sessionArtifactDir) return undefined;\n\tconst dir = join(sessionArtifactDir, \"agents\", taskId);\n\ttry {\n\t\tawait mkdir(dir, { recursive: true });\n\t} catch {\n\t\treturn undefined;\n\t}\n\treturn { dir, reportPath: join(dir, \"report.md\"), transcriptPath: join(dir, \"transcript.jsonl\"), parentSession };\n}\n\n/** The transcript path once the child session has written it; a run that failed before its first message has none. */\nexport function savedTranscript(artifacts: AgentArtifacts | undefined): string | undefined {\n\treturn artifacts && existsSync(artifacts.transcriptPath) ? artifacts.transcriptPath : undefined;\n}\n\n/** Items joined by commas within `bytes`, ending in `+N more` when some do not fit. */\nexport function fitList(items: readonly string[], bytes: number): string {\n\tconst full = items.join(\", \");\n\tif (Buffer.byteLength(full) <= bytes) return full;\n\tlet shown = 0;\n\tlet used = 0;\n\tfor (const item of items) {\n\t\tconst next = used + Buffer.byteLength(item) + (shown ? 2 : 0);\n\t\tif (next > bytes - MORE_RESERVE_BYTES) break;\n\t\tused = next;\n\t\tshown++;\n\t}\n\tif (items.length === 1) return clipText(full, bytes);\n\tif (shown === 0) return `${clipText(items[0] ?? \"\", bytes - MORE_RESERVE_BYTES)} +${items.length - 1} more`;\n\treturn `${items.slice(0, shown).join(\", \")} +${items.length - shown} more`;\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  import type { AgentMessage } from "@earendil-works/pi-agent-core";
2
2
  import type { AgentSessionEvent } from "../../core/agent-session.ts";
3
- import type { TaskCompletion, TaskControl, TaskTerminalStatus } from "../../core/tasks/types.ts";
3
+ import type { TaskCompletion, TaskControl, TaskFact, TaskTerminalStatus } from "../../core/tasks/types.ts";
4
+ import type { Theme } from "../../modes/interactive/theme/theme.ts";
5
+ import { type AgentArtifacts } from "./artifacts.ts";
6
+ import type { FinalReport } from "./report.ts";
4
7
  import { type AgentToolDetails } from "./types.ts";
5
8
  export declare function finalAssistantText(messages: readonly AgentMessage[]): string;
6
9
  /**
@@ -12,20 +15,43 @@ export declare class AgentProgress {
12
15
  private readonly activities;
13
16
  private readonly counted;
14
17
  private calls;
18
+ private failedCalls;
19
+ /** The file key of each in-flight edit/write call, by tool call id. */
20
+ private readonly pendingEdits;
21
+ /**
22
+ * Files named by edit/write calls in the order their first call started, so parallel calls give a
23
+ * stable order; only files with a successful call count as edited. Never trimmed with the activity list.
24
+ */
25
+ private readonly attempts;
15
26
  private usage;
16
27
  private last?;
17
- constructor(control: TaskControl<AgentToolDetails>);
28
+ /** What the model-facing status line names; it keeps the path as the Agent wrote it. */
29
+ private latest;
30
+ /** The Agent's working directory, used to show paths inside it relative. */
31
+ private readonly cwd?;
32
+ constructor(control: TaskControl<AgentToolDetails>, cwd?: string);
18
33
  handle(event: AgentSessionEvent): void;
19
34
  publish(): void;
35
+ /** The themed live tool-call list for /tasks Output; `undefined` before the first call, so the default view shows. */
36
+ present(width: number, theme: Theme): string[] | undefined;
20
37
  /** Classify a finished run from its last assistant message. */
21
38
  outcome(): {
22
39
  status: TaskTerminalStatus;
23
40
  error?: string;
24
41
  };
25
- complete(status: TaskTerminalStatus, error: string | undefined, report: string): TaskCompletion<AgentToolDetails>;
42
+ /** The settled Agent's Details rows: call counts, files changed, and where the full report and transcript live. */
43
+ facts(report: FinalReport, artifacts?: AgentArtifacts): TaskFact[];
44
+ /** Settle with the bounded report, then the Edited line, so truncation can never cut it. */
45
+ complete(status: TaskTerminalStatus, error: string | undefined, report: FinalReport, artifacts?: AgentArtifacts): TaskCompletion<AgentToolDetails>;
46
+ /** Display paths of the files a successful edit/write call changed, each once. */
47
+ private editedFiles;
48
+ private trackEditStart;
26
49
  /** Model-readable progress: the report is the contract, so intermediate text never leaves the worker. */
27
50
  private status;
28
- /** Human-only Output: compact tool calls, never sent to the model. */
51
+ /**
52
+ * Human-only live Output: the compact tool-call list, never sent to the model. A settled Agent
53
+ * publishes no display, so /tasks then shows its report.
54
+ */
29
55
  private display;
30
56
  }
31
57
  //# sourceMappingURL=progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAGjG,OAAO,EAA4C,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAY7F,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAM5E;AAWD;;;GAGG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IACxD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CA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