@astralyn/pi 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/bundle/chunks/{chunk-IRUUTK4W.js → chunk-3YGNXVKM.js} +1 -1
  3. package/dist/bundle/chunks/{chunk-THAJ4BZF.js → chunk-HLVMLRZJ.js} +3 -3
  4. package/dist/bundle/chunks/{chunk-R3YHAMWH.js → chunk-M3D4ADUT.js} +17 -17
  5. package/dist/bundle/chunks/{execute-ACWDKC3C.js → execute-SSRW6NGS.js} +1 -1
  6. package/dist/bundle/chunks/{virtual-modules-T2KLVAFL.js → virtual-modules-NFDW2JKH.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/tasks/activity.d.ts +14 -0
  11. package/dist/core/tasks/activity.d.ts.map +1 -0
  12. package/dist/core/tasks/activity.js +58 -0
  13. package/dist/core/tasks/activity.js.map +1 -0
  14. package/dist/core/tasks/execution.d.ts.map +1 -1
  15. package/dist/core/tasks/execution.js +2 -2
  16. package/dist/core/tasks/execution.js.map +1 -1
  17. package/dist/core/tasks/output.d.ts +4 -1
  18. package/dist/core/tasks/output.d.ts.map +1 -1
  19. package/dist/core/tasks/output.js +33 -0
  20. package/dist/core/tasks/output.js.map +1 -1
  21. package/dist/core/tasks/types.d.ts +19 -2
  22. package/dist/core/tasks/types.d.ts.map +1 -1
  23. package/dist/core/tasks/types.js.map +1 -1
  24. package/dist/extensions/agent/activity-lines.d.ts +1 -5
  25. package/dist/extensions/agent/activity-lines.d.ts.map +1 -1
  26. package/dist/extensions/agent/activity-lines.js +5 -69
  27. package/dist/extensions/agent/activity-lines.js.map +1 -1
  28. package/dist/extensions/agent/activity.d.ts +0 -19
  29. package/dist/extensions/agent/activity.d.ts.map +1 -1
  30. package/dist/extensions/agent/activity.js +0 -63
  31. package/dist/extensions/agent/activity.js.map +1 -1
  32. package/dist/extensions/agent/progress.d.ts.map +1 -1
  33. package/dist/extensions/agent/progress.js +9 -2
  34. package/dist/extensions/agent/progress.js.map +1 -1
  35. package/dist/extensions/agent/types.d.ts +3 -11
  36. package/dist/extensions/agent/types.d.ts.map +1 -1
  37. package/dist/extensions/agent/types.js.map +1 -1
  38. package/dist/extensions/tasks/ui/inspector.d.ts.map +1 -1
  39. package/dist/extensions/tasks/ui/inspector.js +3 -1
  40. package/dist/extensions/tasks/ui/inspector.js.map +1 -1
  41. package/dist/extensions/tasks/ui/views.d.ts +2 -1
  42. package/dist/extensions/tasks/ui/views.d.ts.map +1 -1
  43. package/dist/extensions/tasks/ui/views.js +13 -8
  44. package/dist/extensions/tasks/ui/views.js.map +1 -1
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/modes/interactive/components/task-activity-list.d.ts +5 -0
  49. package/dist/modes/interactive/components/task-activity-list.d.ts.map +1 -0
  50. package/dist/modes/interactive/components/task-activity-list.js +68 -0
  51. package/dist/modes/interactive/components/task-activity-list.js.map +1 -0
  52. package/docs/bundled/extensions/agent.md +1 -1
  53. package/docs/extensions.md +2 -0
  54. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/tasks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE1D,kGAAkG;AAClG,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,YAAY,CAAC;AACnD,eAAO,MAAM,sBAAsB,qEAAsE,CAAC;AAC1G,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAA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mBAAmB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type { AgentToolResult } from \"@earendil-works/pi-agent-core\";\nimport type { Usage } from \"@earendil-works/pi-ai/compat\";\n\n/** An executor-owned machine source: the task ID prefix, never a dispatch key for the runtime. */\nexport type TaskKind = string;\n/**\n * Where the task actually runs. `background` exactly when its caller was released with a\n * background outcome; a caller that is waiting, or was asked to leave but is still held while\n * the executor prepares, is `foreground`.\n */\nexport type TaskMode = \"foreground\" | \"background\";\nexport const TASK_TERMINAL_STATUSES = [\"completed\", \"partial\", \"failed\", \"cancelled\", \"timeout\"] as const;\nexport type TaskTerminalStatus = (typeof TASK_TERMINAL_STATUSES)[number];\nexport type TaskStatus = \"queued\" | \"running\" | \"stopping\" | TaskTerminalStatus;\nexport const TASK_KIND_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;\n\n/**\n * How a task's output is shaped, declared by its executor:\n * a `log` streams and carries its outcome at the end; a `report` is one finished document.\n */\nexport type TaskOutputKind = \"log\" | \"report\";\n\n/** A bounded snapshot; truncation is recorded at the source, never inferred from text. */\nexport interface TaskText {\n\ttext: string;\n\ttruncated: boolean;\n}\n\n/** What the task was asked to do, such as a shell command or a delegated briefing. */\nexport interface TaskInput extends TaskText {\n\t/** Human label for the input, such as \"Command\" or \"Prompt\". */\n\tlabel: string;\n\t/** Optional syntax-highlighting language. */\n\tlanguage?: string;\n}\n\n/** One labelled Details row, such as [\"Directory\", \"/repo\"] or [\"Exit\", \"1\"]. */\nexport type TaskFact = readonly [label: string, value: string];\n\n/** A read-only view of one task; the runtime returns frozen snapshots. */\nexport interface TaskSnapshot {\n\tid: string;\n\tkind: TaskKind;\n\t/** Human source name, such as \"Bash\" or \"Agent\". */\n\tlabel: string;\n\ttitle: string;\n\toutput: TaskOutputKind;\n\tinput?: TaskInput;\n\tfacts?: TaskFact[];\n\ttoolCallId: string;\n\tanchorId: string | null;\n\tmode: TaskMode;\n\tstatus: TaskStatus;\n\tstartedAt: number;\n\tendedAt?: number;\n\toutputPath?: string;\n\t/** Bounded model-readable result text. */\n\tresult?: TaskText;\n\t/**\n\t * The executor's human-only view. In /tasks it replaces the result as what a person reads;\n\t * model-facing reads always use `result`. A terminal snapshot has one only if the completion\n\t * supplied it: the last progress display does not survive settlement.\n\t */\n\tdisplay?: TaskText;\n\terror?: string;\n}\n\nexport interface TaskUpdate<T> {\n\t/** Model-readable progress; also forwarded to a foreground caller's onUpdate. */\n\tresult: AgentToolResult<T>;\n\t/** The live human-only view while running; replaces the result in /tasks and ends at settlement. */\n\tdisplay?: string;\n\t/** Cumulative usage so far, settled once if the execution ends without a final usage. */\n\tusage?: Usage;\n}\n\nexport interface TaskCompletion<T> {\n\tresult: AgentToolResult<T>;\n\t/** Defaults to completed, or cancelled when the task was already cancelled. */\n\tstatus?: TaskTerminalStatus;\n\t/**\n\t * The terminal human-only view. In /tasks it replaces the result as what a person reads; model-facing\n\t * reads and completion context always use `result`. Without it, the terminal snapshot has no display.\n\t */\n\tdisplay?: string;\n\t/** Terminal diagnostic, stored independently of log slices and bounded to 4096 bytes. */\n\terror?: string;\n\t/** Terminal Details rows; a label replaces the same label given at launch. */\n\tfacts?: TaskFact[];\n\t/** Authoritative cumulative usage; overrides the result's usage and the latest published usage. */\n\tusage?: Usage;\n}\n\nexport interface TaskControl<T> {\n\treadonly id: string;\n\treadonly signal: AbortSignal;\n\t/** Actual placement: `background` only once the caller was released. */\n\treadonly mode: TaskMode;\n\t/** Called once the caller is released and the mode becomes `background`. */\n\tonModeChange(listener: (mode: TaskMode) => void): () => void;\n\t/** The executor's own preflight passed; from now on the caller may be handed off to the background. */\n\taccept(): void;\n\tpublish(update: TaskUpdate<T>): void;\n\t/** Register once; cleanup must own only this exclusively-created file and close its writer first. */\n\tattachOutput(path: string, cleanup?: () => void | Promise<void>): void;\n\t/** Cancel this execution, for example when an executor policy limit is exceeded. */\n\tcancel(): void;\n}\n\nexport interface TaskExecution<T> {\n\tkind: TaskKind;\n\t/** Human source name; defaults to `kind`. */\n\tlabel?: string;\n\ttitle: string;\n\t/** Defaults to `log`. */\n\toutput?: TaskOutputKind;\n\tinput?: TaskInput;\n\tfacts?: TaskFact[];\n\ttoolCallId: string;\n\tbackground?: boolean;\n\t/**\n\t * At most `limit` executions sharing `key` run at once; lanes belong to one `kind`, so another\n\t * executor may reuse the key. Later ones wait as queued tasks whose `run` starts when a slot\n\t * frees; a queued task can be handed off or cancelled.\n\t */\n\tconcurrency?: { key: string; limit: number };\n\tsignal?: AbortSignal;\n\tonUpdate?: (result: AgentToolResult<T>) => void;\n\trun(control: TaskControl<T>): Promise<TaskCompletion<T>>;\n}\n\n/**\n * How a tool call ends. A `background` outcome says why the caller was released: `submitted`\n * when it asked for background, `detached` when it was moved while the work ran.\n */\nexport type TaskToolOutcome<T> =\n\t| { kind: \"result\"; result: AgentToolResult<T>; status: TaskTerminalStatus; error?: string }\n\t| { kind: \"background\"; task: TaskSnapshot; reason: \"submitted\" | \"detached\" };\n\n/** Which slice of a task's output to read. Defaults to 8 KiB. */\nexport interface TaskReadOptions {\n\t/**\n\t * `head` reads the start of the output, `tail` its end. Without it a `report` is read from its\n\t * start and a `log` from its end.\n\t */\n\tmode?: \"head\" | \"tail\";\n\t/** Maximum bytes to return, bounded by the runtime. */\n\tbytes?: number;\n\t/**\n\t * First unread byte. `head` reads forward from this offset; `tail` returns the newest window\n\t * at or after it. Without it the output kind selects the default end.\n\t */\n\tsinceBytes?: number;\n}\n\nexport interface TaskRead {\n\ttask: TaskSnapshot;\n\ttext: string;\n\t/** Bounded log-read/expiry diagnostic, independent of text slicing and byte offsets. */\n\treadError?: string;\n\ttotalBytes: number;\n\ttruncated: boolean;\n\tfromByte?: number;\n\t/** Raw source-byte end supplied by the runtime; older/custom hosts may omit it. */\n\tendByte?: number;\n}\n\n/** Optional host integration for products built on the execution runtime. */\nexport interface TasksSessionContext {\n\t/** Running tasks that navigating to `targetId` would cancel on this session branch. */\n\tstoppedByTreeNavigation(targetId: string): TaskSnapshot[];\n}\n\n/** Session-bound public capability. Captured instances close on runtime replacement. */\nexport interface TasksContext {\n\treadonly enabled: boolean;\n\treadonly closed?: boolean;\n\t/** Present when the runtime is attached to Pi's durable session lifecycle. */\n\treadonly session?: TasksSessionContext;\n\texecute<T>(execution: TaskExecution<T>): Promise<TaskToolOutcome<T>>;\n\tlist(): TaskSnapshot[];\n\tget(id: string): TaskSnapshot;\n\tread(id: string, options?: TaskReadOptions): Promise<TaskRead>;\n\tkill(id: string): boolean;\n\t/**\n\t * Move running foreground executions to the background while background slots remain;\n\t * returns how many moved. Throws when eligible work exists but every slot is taken.\n\t */\n\tdetachForeground(): number;\n\t/** Whether this execution can move now, including host policy and available background slots. */\n\tcanDetach(id: string): boolean;\n\t/** Returns false when the task cannot move; throws when every background slot is taken. */\n\tdetach(id: string): boolean;\n\tsubscribe(listener: () => void): () => void;\n\t/** Keep retained output available without delaying completion delivery. */\n\tretain(id: string): () => void;\n}\n\nexport interface TaskRuntimeOptions {\n\tenabled?: boolean;\n\t/** Branch-impact queries for a durable host; standalone runtimes omit it. */\n\tsession?: TasksSessionContext;\n\tanchor?: () => string | null;\n\t/** Admission limit for unsettled background tasks; foreground work is bounded by its caller. */\n\tmaxBackground?: number;\n\t/** Per-history limit: foreground and background tasks each get this allowance. */\n\tmaxHistory?: number;\n\t/** Best-effort cleanup errors, bounded to 4096 bytes; no retries or execution failure. */\n\tonCleanupError?: (message: string) => void;\n\t/** Synchronous persistence before terminal observers or notifications. */\n\tonSettled?: (task: TaskSnapshot, usage: Usage | undefined) => void;\n\t/**\n\t * Whether the host can supervise new background work, such as its management tool being\n\t * active. Gates admission and detaching only; work already admitted is unaffected.\n\t */\n\tcanManageBackground?: () => boolean;\n\t/** The runtime closed: a host holding retention pins for it must release them so output cleanup runs. */\n\tonClosed?: () => void;\n}\n\n/**\n * The model-facing management tool, owned by the bundled `builtin:tasks` extension. Background\n * work is admitted only while it is active, so the model can always read and stop what\n * it starts. Model-facing copy names it through this constant.\n */\nexport const TASKS_TOOL_NAME = \"tasks\";\n\nexport const TASK_MANAGEMENT_REJECTION = `Background execution needs the ${TASKS_TOOL_NAME} tool to read and stop the work, and it is not active. Activate the ${TASKS_TOOL_NAME} tool or run in the foreground. No work was started.`;\n\nexport const TASK_BACKGROUND_REJECTION =\n\t\"Background execution is not available in this host. Run with background: false or omit background. No work was started.\";\n\nexport function isTaskTerminal(status: TaskStatus): status is TaskTerminalStatus {\n\treturn (TASK_TERMINAL_STATUSES as readonly string[]).includes(status);\n}\n\n/**\n * A failed id lookup, typed so hosts can enrich the message without matching\n * on message text. `matches` snapshots exactly the records the id or prefix\n * resolved against — including records outside the current branch, which\n * list() hides but prefix matching still collides with.\n */\nexport class TaskLookupError extends Error {\n\treadonly kind: \"unknown\" | \"ambiguous\";\n\treadonly matches: TaskSnapshot[];\n\tconstructor(kind: \"unknown\" | \"ambiguous\", matches: TaskSnapshot[]) {\n\t\tsuper(kind === \"ambiguous\" ? \"Ambiguous task ID\" : \"Unknown task ID\");\n\t\tthis.name = \"TaskLookupError\";\n\t\tthis.kind = kind;\n\t\tthis.matches = matches;\n\t}\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/tasks/types.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAU,CAAC;AAG1G,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAiO1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC;AAEvC,MAAM,CAAC,MAAM,yBAAyB,GAAG,kCAAkC,eAAe,uEAAuE,eAAe,sDAAsD,CAAC;AAEvO,MAAM,CAAC,MAAM,yBAAyB,GACrC,yHAAyH,CAAC;AAE3H,MAAM,UAAU,cAAc,CAAC,MAAkB;IAChD,OAAQ,sBAA4C,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACvE,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAGzC,YAAY,IAA6B,EAAE,OAAuB;QACjE,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;QACtE,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CACD","sourcesContent":["import type { AgentToolResult } from \"@earendil-works/pi-agent-core\";\nimport type { Usage } from \"@earendil-works/pi-ai/compat\";\n\n/** An executor-owned machine source: the task ID prefix, never a dispatch key for the runtime. */\nexport type TaskKind = string;\n/**\n * Where the task actually runs. `background` exactly when its caller was released with a\n * background outcome; a caller that is waiting, or was asked to leave but is still held while\n * the executor prepares, is `foreground`.\n */\nexport type TaskMode = \"foreground\" | \"background\";\nexport const TASK_TERMINAL_STATUSES = [\"completed\", \"partial\", \"failed\", \"cancelled\", \"timeout\"] as const;\nexport type TaskTerminalStatus = (typeof TASK_TERMINAL_STATUSES)[number];\nexport type TaskStatus = \"queued\" | \"running\" | \"stopping\" | TaskTerminalStatus;\nexport const TASK_KIND_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;\n\n/**\n * How a task's output is shaped, declared by its executor:\n * a `log` streams and carries its outcome at the end; a `report` is one finished document.\n */\nexport type TaskOutputKind = \"log\" | \"report\";\n\n/** A bounded snapshot; truncation is recorded at the source, never inferred from text. */\nexport interface TaskText {\n\ttext: string;\n\ttruncated: boolean;\n}\n\n/** One live unit of work in a human display; UI derives its marker, elapsed time and layout. */\nexport interface TaskActivity {\n\tname: string;\n\ttarget?: string;\n\tstatus: \"running\" | \"ok\" | \"error\" | \"cancelled\";\n\tstartedAt?: number;\n\tdurationMs?: number;\n\terror?: string;\n}\n\n/**\n * Human-only output with an optional structured live view. `text` remains the portable fallback;\n * activities let an interactive renderer style and lay out the same content without executor UI callbacks.\n */\nexport interface TaskDisplay extends TaskText {\n\tactivities?: TaskActivity[];\n\tearlierActivities?: number;\n}\n\n/** What the task was asked to do, such as a shell command or a delegated briefing. */\nexport interface TaskInput extends TaskText {\n\t/** Human label for the input, such as \"Command\" or \"Prompt\". */\n\tlabel: string;\n\t/** Optional syntax-highlighting language. */\n\tlanguage?: string;\n}\n\n/** One labelled Details row, such as [\"Directory\", \"/repo\"] or [\"Exit\", \"1\"]. */\nexport type TaskFact = readonly [label: string, value: string];\n\n/** A read-only view of one task; the runtime returns frozen snapshots. */\nexport interface TaskSnapshot {\n\tid: string;\n\tkind: TaskKind;\n\t/** Human source name, such as \"Bash\" or \"Agent\". */\n\tlabel: string;\n\ttitle: string;\n\toutput: TaskOutputKind;\n\tinput?: TaskInput;\n\tfacts?: TaskFact[];\n\ttoolCallId: string;\n\tanchorId: string | null;\n\tmode: TaskMode;\n\tstatus: TaskStatus;\n\tstartedAt: number;\n\tendedAt?: number;\n\toutputPath?: string;\n\t/** Bounded model-readable result text. */\n\tresult?: TaskText;\n\t/**\n\t * The executor's human-only view. In /tasks it replaces the result as what a person reads;\n\t * model-facing reads always use `result`. A terminal snapshot has one only if the completion\n\t * supplied it: the last progress display does not survive settlement.\n\t */\n\tdisplay?: TaskDisplay;\n\terror?: string;\n}\n\nexport interface TaskUpdate<T> {\n\t/** Model-readable progress; also forwarded to a foreground caller's onUpdate. */\n\tresult: AgentToolResult<T>;\n\t/** The live human-only view while running; replaces the result in /tasks and ends at settlement. */\n\tdisplay?: string | TaskDisplay;\n\t/** Cumulative usage so far, settled once if the execution ends without a final usage. */\n\tusage?: Usage;\n}\n\nexport interface TaskCompletion<T> {\n\tresult: AgentToolResult<T>;\n\t/** Defaults to completed, or cancelled when the task was already cancelled. */\n\tstatus?: TaskTerminalStatus;\n\t/**\n\t * The terminal human-only view. In /tasks it replaces the result as what a person reads; model-facing\n\t * reads and completion context always use `result`. Without it, the terminal snapshot has no display.\n\t */\n\tdisplay?: string;\n\t/** Terminal diagnostic, stored independently of log slices and bounded to 4096 bytes. */\n\terror?: string;\n\t/** Terminal Details rows; a label replaces the same label given at launch. */\n\tfacts?: TaskFact[];\n\t/** Authoritative cumulative usage; overrides the result's usage and the latest published usage. */\n\tusage?: Usage;\n}\n\nexport interface TaskControl<T> {\n\treadonly id: string;\n\treadonly signal: AbortSignal;\n\t/** Actual placement: `background` only once the caller was released. */\n\treadonly mode: TaskMode;\n\t/** Called once the caller is released and the mode becomes `background`. */\n\tonModeChange(listener: (mode: TaskMode) => void): () => void;\n\t/** The executor's own preflight passed; from now on the caller may be handed off to the background. */\n\taccept(): void;\n\tpublish(update: TaskUpdate<T>): void;\n\t/** Register once; cleanup must own only this exclusively-created file and close its writer first. */\n\tattachOutput(path: string, cleanup?: () => void | Promise<void>): void;\n\t/** Cancel this execution, for example when an executor policy limit is exceeded. */\n\tcancel(): void;\n}\n\nexport interface TaskExecution<T> {\n\tkind: TaskKind;\n\t/** Human source name; defaults to `kind`. */\n\tlabel?: string;\n\ttitle: string;\n\t/** Defaults to `log`. */\n\toutput?: TaskOutputKind;\n\tinput?: TaskInput;\n\tfacts?: TaskFact[];\n\ttoolCallId: string;\n\tbackground?: boolean;\n\t/**\n\t * At most `limit` executions sharing `key` run at once; lanes belong to one `kind`, so another\n\t * executor may reuse the key. Later ones wait as queued tasks whose `run` starts when a slot\n\t * frees; a queued task can be handed off or cancelled.\n\t */\n\tconcurrency?: { key: string; limit: number };\n\tsignal?: AbortSignal;\n\tonUpdate?: (result: AgentToolResult<T>) => void;\n\trun(control: TaskControl<T>): Promise<TaskCompletion<T>>;\n}\n\n/**\n * How a tool call ends. A `background` outcome says why the caller was released: `submitted`\n * when it asked for background, `detached` when it was moved while the work ran.\n */\nexport type TaskToolOutcome<T> =\n\t| { kind: \"result\"; result: AgentToolResult<T>; status: TaskTerminalStatus; error?: string }\n\t| { kind: \"background\"; task: TaskSnapshot; reason: \"submitted\" | \"detached\" };\n\n/** Which slice of a task's output to read. Defaults to 8 KiB. */\nexport interface TaskReadOptions {\n\t/**\n\t * `head` reads the start of the output, `tail` its end. Without it a `report` is read from its\n\t * start and a `log` from its end.\n\t */\n\tmode?: \"head\" | \"tail\";\n\t/** Maximum bytes to return, bounded by the runtime. */\n\tbytes?: number;\n\t/**\n\t * First unread byte. `head` reads forward from this offset; `tail` returns the newest window\n\t * at or after it. Without it the output kind selects the default end.\n\t */\n\tsinceBytes?: number;\n}\n\nexport interface TaskRead {\n\ttask: TaskSnapshot;\n\ttext: string;\n\t/** Bounded log-read/expiry diagnostic, independent of text slicing and byte offsets. */\n\treadError?: string;\n\ttotalBytes: number;\n\ttruncated: boolean;\n\tfromByte?: number;\n\t/** Raw source-byte end supplied by the runtime; older/custom hosts may omit it. */\n\tendByte?: number;\n}\n\n/** Optional host integration for products built on the execution runtime. */\nexport interface TasksSessionContext {\n\t/** Running tasks that navigating to `targetId` would cancel on this session branch. */\n\tstoppedByTreeNavigation(targetId: string): TaskSnapshot[];\n}\n\n/** Session-bound public capability. Captured instances close on runtime replacement. */\nexport interface TasksContext {\n\treadonly enabled: boolean;\n\treadonly closed?: boolean;\n\t/** Present when the runtime is attached to Pi's durable session lifecycle. */\n\treadonly session?: TasksSessionContext;\n\texecute<T>(execution: TaskExecution<T>): Promise<TaskToolOutcome<T>>;\n\tlist(): TaskSnapshot[];\n\tget(id: string): TaskSnapshot;\n\tread(id: string, options?: TaskReadOptions): Promise<TaskRead>;\n\tkill(id: string): boolean;\n\t/**\n\t * Move running foreground executions to the background while background slots remain;\n\t * returns how many moved. Throws when eligible work exists but every slot is taken.\n\t */\n\tdetachForeground(): number;\n\t/** Whether this execution can move now, including host policy and available background slots. */\n\tcanDetach(id: string): boolean;\n\t/** Returns false when the task cannot move; throws when every background slot is taken. */\n\tdetach(id: string): boolean;\n\tsubscribe(listener: () => void): () => void;\n\t/** Keep retained output available without delaying completion delivery. */\n\tretain(id: string): () => void;\n}\n\nexport interface TaskRuntimeOptions {\n\tenabled?: boolean;\n\t/** Branch-impact queries for a durable host; standalone runtimes omit it. */\n\tsession?: TasksSessionContext;\n\tanchor?: () => string | null;\n\t/** Admission limit for unsettled background tasks; foreground work is bounded by its caller. */\n\tmaxBackground?: number;\n\t/** Per-history limit: foreground and background tasks each get this allowance. */\n\tmaxHistory?: number;\n\t/** Best-effort cleanup errors, bounded to 4096 bytes; no retries or execution failure. */\n\tonCleanupError?: (message: string) => void;\n\t/** Synchronous persistence before terminal observers or notifications. */\n\tonSettled?: (task: TaskSnapshot, usage: Usage | undefined) => void;\n\t/**\n\t * Whether the host can supervise new background work, such as its management tool being\n\t * active. Gates admission and detaching only; work already admitted is unaffected.\n\t */\n\tcanManageBackground?: () => boolean;\n\t/** The runtime closed: a host holding retention pins for it must release them so output cleanup runs. */\n\tonClosed?: () => void;\n}\n\n/**\n * The model-facing management tool, owned by the bundled `builtin:tasks` extension. Background\n * work is admitted only while it is active, so the model can always read and stop what\n * it starts. Model-facing copy names it through this constant.\n */\nexport const TASKS_TOOL_NAME = \"tasks\";\n\nexport const TASK_MANAGEMENT_REJECTION = `Background execution needs the ${TASKS_TOOL_NAME} tool to read and stop the work, and it is not active. Activate the ${TASKS_TOOL_NAME} tool or run in the foreground. No work was started.`;\n\nexport const TASK_BACKGROUND_REJECTION =\n\t\"Background execution is not available in this host. Run with background: false or omit background. No work was started.\";\n\nexport function isTaskTerminal(status: TaskStatus): status is TaskTerminalStatus {\n\treturn (TASK_TERMINAL_STATUSES as readonly string[]).includes(status);\n}\n\n/**\n * A failed id lookup, typed so hosts can enrich the message without matching\n * on message text. `matches` snapshots exactly the records the id or prefix\n * resolved against — including records outside the current branch, which\n * list() hides but prefix matching still collides with.\n */\nexport class TaskLookupError extends Error {\n\treadonly kind: \"unknown\" | \"ambiguous\";\n\treadonly matches: TaskSnapshot[];\n\tconstructor(kind: \"unknown\" | \"ambiguous\", matches: TaskSnapshot[]) {\n\t\tsuper(kind === \"ambiguous\" ? \"Ambiguous task ID\" : \"Unknown task ID\");\n\t\tthis.name = \"TaskLookupError\";\n\t\tthis.kind = kind;\n\t\tthis.matches = matches;\n\t}\n}\n"]}
@@ -1,9 +1,5 @@
1
1
  import type { Theme } from "../../modes/interactive/theme/theme.ts";
2
2
  import type { AgentActivity } from "./types.ts";
3
- /**
4
- * Themed rows for `activities`: one row per call with an aligned tool-name column, durations right-aligned in one column, and a failed call's first
5
- * error line beneath it. The table is as wide as its longest row, at most `width`. Measured at
6
- * `now`, a running call shows a spinner frame and the time since it started.
7
- */
3
+ /** Transcript details retain bounded arguments for older snapshots; derive their target before rendering. */
8
4
  export declare function activityLines(activities: readonly AgentActivity[], width: number, theme: Theme, now?: number): string[];
9
5
  //# sourceMappingURL=activity-lines.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity-lines.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/activity-lines.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAyDhD;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,KAAK,EACZ,GAAG,SAAa,GACd,MAAM,EAAE,CAwBV"}
1
+ {"version":3,"file":"activity-lines.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/activity-lines.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,6GAA6G;AAC7G,wBAAgB,aAAa,CAC5B,UAAU,EAAE,SAAS,aAAa,EAAE,EACpC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,KAAK,EACZ,GAAG,SAAa,GACd,MAAM,EAAE,CAQV"}
@@ -1,72 +1,8 @@
1
- /** The themed tool-call list of a running Agent's expanded Transcript row. */
2
- import { stripTerminalSequences, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
3
- import { sanitizeBinaryOutput } from "../../utils/shell.js";
4
- import { activityMarker, errorLine, formatActivityDuration, nameColumnWidth, targetOf } from "./activity.js";
5
- /** ` · ` before the duration column. */
6
- const SEPARATOR_WIDTH = 3;
7
- /** One line of tool-call text with no terminal sequences or control characters; the Agent's arguments are untrusted. */
8
- function oneLine(text) {
9
- return sanitizeBinaryOutput(stripTerminalSequences(text)).replace(/\s+/gu, " ").trim();
10
- }
11
- /** A finished call's own duration; a running call's time since it started. */
12
- function shownDuration(activity, now) {
13
- if (activity.status === "running")
14
- return activity.startedAt === undefined ? "" : formatActivityDuration(Math.max(0, now - activity.startedAt));
15
- return formatActivityDuration(activity.durationMs);
16
- }
17
- /** `glyph name` with the padding that lines targets up, plus the space before the target. */
18
- function headWidth(row, nameWidth) {
19
- return visibleWidth(row.marker.glyph) + 1 + Math.max(nameWidth, visibleWidth(row.name)) + 1;
20
- }
21
- /**
22
- * `glyph name target · duration`, with the durations right-aligned in one column ending at
23
- * `tableWidth`. A long target gives way before the duration does.
24
- */
25
- function activityRow(row, nameWidth, durationWidth, tableWidth, theme) {
26
- const { marker, name, target, duration } = row;
27
- const padding = " ".repeat(Math.max(0, nameWidth - visibleWidth(name)));
28
- const head = `${theme.fg(marker.color, marker.glyph)} ${theme.fg("toolTitle", name)}${padding}`;
29
- const durationPad = " ".repeat(Math.max(0, durationWidth - visibleWidth(duration)));
30
- const tail = duration ? `${theme.fg("dim", " · ")}${durationPad}${theme.fg("dim", duration)}` : "";
31
- if (!target && !tail)
32
- return truncateToWidth(head.trimEnd(), tableWidth, "…");
33
- const room = tableWidth - headWidth(row, nameWidth) - (tail ? SEPARATOR_WIDTH + durationWidth : 0);
34
- // Without room for even a clipped target, the whole row is clipped instead.
35
- if (room < 2)
36
- return truncateToWidth(`${head} ${theme.fg("muted", target)}${tail}`, tableWidth, "…");
37
- const clipped = truncateToWidth(target, room, "…");
38
- // A row without a duration ends at its target instead of trailing blanks.
39
- if (!tail)
40
- return `${head} ${theme.fg("muted", clipped)}`;
41
- return `${head} ${theme.fg("muted", clipped)}${" ".repeat(room - visibleWidth(clipped))}${tail}`;
42
- }
43
- /**
44
- * Themed rows for `activities`: one row per call with an aligned tool-name column, durations right-aligned in one column, and a failed call's first
45
- * error line beneath it. The table is as wide as its longest row, at most `width`. Measured at
46
- * `now`, a running call shows a spinner frame and the time since it started.
47
- */
1
+ /** Agent argument adaptation for the shared structured task-activity renderer. */
2
+ import { taskActivityLines } from "../../modes/interactive/components/task-activity-list.js";
3
+ import { targetOf } from "./activity.js";
4
+ /** Transcript details retain bounded arguments for older snapshots; derive their target before rendering. */
48
5
  export function activityLines(activities, width, theme, now = Date.now()) {
49
- if (width <= 0)
50
- return [];
51
- const nameWidth = nameColumnWidth(activities);
52
- const rows = activities.map((activity) => ({
53
- activity,
54
- marker: activityMarker(activity.status, now),
55
- name: oneLine(activity.name),
56
- target: oneLine(targetOf(activity)),
57
- duration: shownDuration(activity, now),
58
- }));
59
- const durationWidth = Math.max(0, ...rows.map((row) => visibleWidth(row.duration)));
60
- const tailWidth = durationWidth ? SEPARATOR_WIDTH + durationWidth : 0;
61
- const naturalWidth = Math.max(0, ...rows.map((row) => headWidth(row, nameWidth) + visibleWidth(row.target) + tailWidth));
62
- const tableWidth = Math.min(width, naturalWidth);
63
- const lines = [];
64
- for (const row of rows) {
65
- lines.push(activityRow(row, nameWidth, durationWidth, tableWidth, theme));
66
- const error = row.activity.error ? oneLine(errorLine(row.activity.error)) : "";
67
- if (error)
68
- lines.push(truncateToWidth(`${" ".repeat(3 + nameWidth)}${theme.fg("error", error)}`, width, "…"));
69
- }
70
- return lines;
6
+ return taskActivityLines(activities.map((activity) => ({ ...activity, target: targetOf(activity) })), width, theme, 0, now);
71
7
  }
72
8
  //# sourceMappingURL=activity-lines.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity-lines.js","sourceRoot":"","sources":["../../../src/extensions/agent/activity-lines.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,sBAAsB,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG7G,wCAAwC;AACxC,MAAM,eAAe,GAAG,CAAC,CAAC;AAW1B,wHAAwH;AACxH,SAAS,OAAO,CAAC,IAAY;IAC5B,OAAO,oBAAoB,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACxF,CAAC;AAED,8EAA8E;AAC9E,SAAS,aAAa,CAAC,QAAuB,EAAE,GAAW;IAC1D,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS;QAChC,OAAO,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9G,OAAO,sBAAsB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC;AAED,6FAA6F;AAC7F,SAAS,SAAS,CAAC,GAAa,EAAE,SAAiB;IAClD,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EA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,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAC5B,CAAC,EACD,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CACtF,CAAC;IACF,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACjD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,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":["/** The themed tool-call list of a running Agent's expanded Transcript row. */\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 { activityMarker, errorLine, formatActivityDuration, nameColumnWidth, targetOf } 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`: one row per call 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\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: string[] = [];\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
+ {"version":3,"file":"activity-lines.js","sourceRoot":"","sources":["../../../src/extensions/agent/activity-lines.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC;AAE7F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,6GAA6G;AAC7G,MAAM,UAAU,aAAa,CAC5B,UAAoC,EACpC,KAAa,EACb,KAAY,EACZ,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,OAAO,iBAAiB,CACvB,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAC3E,KAAK,EACL,KAAK,EACL,CAAC,EACD,GAAG,CACH,CAAC;AACH,CAAC","sourcesContent":["/** Agent argument adaptation for the shared structured task-activity renderer. */\nimport { taskActivityLines } from \"../../modes/interactive/components/task-activity-list.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.ts\";\nimport { targetOf } from \"./activity.ts\";\nimport type { AgentActivity } from \"./types.ts\";\n\n/** Transcript details retain bounded arguments for older snapshots; derive their target before rendering. */\nexport function activityLines(\n\tactivities: readonly AgentActivity[],\n\twidth: number,\n\ttheme: Theme,\n\tnow = Date.now(),\n): string[] {\n\treturn taskActivityLines(\n\t\tactivities.map((activity) => ({ ...activity, target: targetOf(activity) })),\n\t\twidth,\n\t\ttheme,\n\t\t0,\n\t\tnow,\n\t);\n}\n"]}
@@ -1,4 +1,3 @@
1
- import { type StatusMarker } from "../../modes/interactive/components/status-marker.ts";
2
1
  import type { AgentActivity } from "./types.ts";
3
2
  export declare function clipText(text: string, bytes: number): string;
4
3
  export declare function compactArguments(args: unknown): string;
@@ -11,22 +10,4 @@ export declare function relativeToCwd(path: string, cwd: string | undefined): st
11
10
  export declare function activityTarget(name: string, args: unknown, cwd?: string): string;
12
11
  /** The stored display target, or one derived from the bounded arguments. */
13
12
  export declare function targetOf(activity: AgentActivity): string;
14
- /** `Nms` under a second, `N.Ns` under a minute, then the shared `1m 5s` form. */
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;
21
- export declare function activityGlyph(status: AgentActivity["status"]): 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 plain /tasks display: a count of calls no longer retained, then one aligned row per call. */
31
- export declare function activitiesText(activities: readonly AgentActivity[], earlier?: number): string;
32
13
  //# sourceMappingURL=activity.d.ts.map
@@ -1 +1 @@
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;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAA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E,MAAM,GAAG,MAAM,CAG5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAMtD;AAOD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAO3E;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAiBhF;AAED,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAOxD"}
@@ -1,11 +1,6 @@
1
1
  /** Compact, bounded formatting of an Agent's tool-call activity, shared by the Transcript and /tasks. */
2
2
  import { isAbsolute, relative, sep, win32 } from "node:path";
3
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;
9
4
  export function clipText(text, bytes) {
10
5
  if (Buffer.byteLength(text) <= bytes)
11
6
  return text;
@@ -69,62 +64,4 @@ export function targetOf(activity) {
69
64
  return activity.args;
70
65
  }
71
66
  }
72
- /** `Nms` under a second, `N.Ns` under a minute, then the shared `1m 5s` form. */
73
- export function formatActivityDuration(ms) {
74
- if (ms === undefined)
75
- return "";
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 });
94
- }
95
- export function activityGlyph(status) {
96
- return activityMarker(status).glyph;
97
- }
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])) {
114
- const target = targetOf(activity);
115
- const duration = formatActivityDuration(activity.durationMs);
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
- function earlierLabel(earlier) {
122
- return `… ${earlier} earlier tool ${earlier === 1 ? "call" : "calls"}`;
123
- }
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");
129
- }
130
67
  //# sourceMappingURL=activity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity.js","sourceRoot":"","sources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SAAS,YAAY,CAAC,OAAe;IACpC,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. */\nfunction 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"]}
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;AAGvD,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,mBAAm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M,CAAC;YACrB,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACpC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YAAE,SAAS;QACzD,MAAM,KAAK,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC3F,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC9D,OAAO,QAAQ,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,QAAQ,CAAC,QAAuB;IAC/C,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC,MAAM,CAAC;IAC5C,IAAI,CAAC;QACJ,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;AACF,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 { 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 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"]}
@@ -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;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAK3G,OAAO,EAAE,KAAK,cAAc,EAA4B,MAAM,gBAAgB,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAA4C,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAY7F,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAM5E;AAiBD;;;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,CAAC,WAAW,CAAK;IACxB,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4D;IACrF,OAAO,CAAC,KAAK,C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BnC,kFAAkF;IAClF,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,cAAc;IAWtB,yGAAyG;IACzG,OAAO,CAAC,MAAM;IAMd;;;OAGG;IACH,OAAO,CAAC,OAAO;CASf"}
@@ -1,8 +1,9 @@
1
+ import { taskActivitiesText } from "../../core/tasks/activity.js";
1
2
  import { TASK_FACT_BYTES } from "../../core/tasks/output.js";
2
3
  import { resolveToCwd } from "../../core/tools/path-utils.js";
3
4
  import { combineUsage } from "../../core/usage-totals.js";
4
5
  import { emptyUsage } from "../../utils/usage.js";
5
- import { activitiesText, activityTarget, clipText, compactArguments, relativeToCwd } from "./activity.js";
6
+ import { activityTarget, clipText, compactArguments, relativeToCwd } from "./activity.js";
6
7
  import { fitList, savedTranscript } from "./artifacts.js";
7
8
  import { AGENT_MAX_ACTIVITIES } from "./types.js";
8
9
  function assistantText(message) {
@@ -196,7 +197,13 @@ export class AgentProgress {
196
197
  * publishes no display, so /tasks then shows its report.
197
198
  */
198
199
  display() {
199
- return this.activities.length ? activitiesText(this.activities, this.calls - this.activities.length) : "";
200
+ const earlierActivities = this.calls - this.activities.length;
201
+ return {
202
+ text: taskActivitiesText(this.activities, earlierActivities),
203
+ truncated: false,
204
+ activities: this.activities,
205
+ earlierActivities,
206
+ };
200
207
  }
201
208
  }
202
209
  //# sourceMappingURL=progress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/extensions/agent/progress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC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,EAAE,CAAC;QAC1E,OAAO,mBAAmB,KAAK,cAAc,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACK,OAAO;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3G,CAAC;CACD","sourcesContent":["import type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport type { Usage } from \"@earendil-works/pi-ai/compat\";\nimport type { AgentSessionEvent } from \"../../core/agent-session.ts\";\nimport { TASK_FACT_BYTES } from \"../../core/tasks/output.ts\";\nimport type { TaskCompletion, TaskControl, TaskFact, TaskTerminalStatus } from \"../../core/tasks/types.ts\";\nimport { resolveToCwd } from \"../../core/tools/path-utils.ts\";\nimport { combineUsage } from \"../../core/usage-totals.ts\";\nimport { emptyUsage } from \"../../utils/usage.ts\";\nimport { activitiesText, activityTarget, clipText, compactArguments, relativeToCwd } from \"./activity.ts\";\nimport { type AgentArtifacts, fitList, savedTranscript } from \"./artifacts.ts\";\nimport type { FinalReport } from \"./report.ts\";\nimport { AGENT_MAX_ACTIVITIES, type AgentActivity, type AgentToolDetails } from \"./types.ts\";\n\ntype AssistantMessage = Extract<AgentMessage, { role: \"assistant\" }>;\n\nfunction assistantText(message: AgentMessage): string {\n\tif (message.role !== \"assistant\") return \"\";\n\treturn message.content\n\t\t.filter((block) => block.type === \"text\")\n\t\t.map((block) => block.text)\n\t\t.join(\"\\n\");\n}\n\nexport function finalAssistantText(messages: readonly AgentMessage[]): string {\n\tfor (let index = messages.length - 1; index >= 0; index--) {\n\t\tconst text = assistantText(messages[index]!);\n\t\tif (text.trim()) return text;\n\t}\n\treturn \"\";\n}\n\nfunction toolErrorText(result: unknown): string {\n\tconst content = (result as { content?: Array<{ type: string; text?: string }> }).content;\n\tconst text = content\n\t\t?.filter((block) => block.type === \"text\")\n\t\t.map((block) => block.text ?? \"\")\n\t\t.join(\"\\n\");\n\treturn clipText(text || \"Tool call failed.\", 1000);\n}\n\n/** Tools whose successful calls change the named file. */\nconst EDIT_TOOLS = new Set([\"edit\", \"write\"]);\n/** The model-facing Edited line stays this small, whatever the Agent changed. */\nconst EDITED_LINE_BYTES = 1024;\nconst EDITED_LINE_PREFIX = \"Edited (edit/write): \";\n\n/**\n * One worker session translated into task progress: a one-line status for the model,\n * tool activity for humans, and cumulative usage for the ledger.\n */\nexport class AgentProgress {\n\tprivate readonly control: TaskControl<AgentToolDetails>;\n\tprivate readonly activities: AgentActivity[] = [];\n\tprivate readonly counted = new WeakSet<AgentMessage>();\n\tprivate calls = 0;\n\tprivate failedCalls = 0;\n\t/** The file key of each in-flight edit/write call, by tool call id. */\n\tprivate readonly pendingEdits = new Map<string, string>();\n\t/**\n\t * Files named by edit/write calls in the order their first call started, so parallel calls give a\n\t * stable order; only files with a successful call count as edited. Never trimmed with the activity list.\n\t */\n\tprivate readonly attempts = new Map<string, { display: string; changed: boolean }>();\n\tprivate usage: Usage = emptyUsage();\n\tprivate last?: AssistantMessage;\n\t/** What the model-facing status line names; it keeps the path as the Agent wrote it. */\n\tprivate latest = \"\";\n\t/** The Agent's working directory, used to show paths inside it relative. */\n\tprivate readonly cwd?: string;\n\n\tconstructor(control: TaskControl<AgentToolDetails>, cwd?: string) {\n\t\tthis.control = control;\n\t\tthis.cwd = cwd;\n\t}\n\n\thandle(event: AgentSessionEvent): void {\n\t\tswitch (event.type) {\n\t\t\tcase \"message_end\":\n\t\t\t\tif (event.message.role !== \"assistant\") return;\n\t\t\t\tthis.last = event.message;\n\t\t\t\tif (!this.counted.has(event.message)) {\n\t\t\t\t\tthis.counted.add(event.message);\n\t\t\t\t\tthis.usage = combineUsage(this.usage, event.message.usage);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase \"compaction_end\":\n\t\t\t\tif (event.result?.usage) this.usage = combineUsage(this.usage, event.result.usage);\n\t\t\t\treturn;\n\t\t\tcase \"tool_execution_start\":\n\t\t\t\tthis.calls++;\n\t\t\t\tif (EDIT_TOOLS.has(event.toolName)) this.trackEditStart(event.toolCallId, event.args);\n\t\t\t\tthis.latest = [event.toolName, activityTarget(event.toolName, event.args)].filter(Boolean).join(\" \");\n\t\t\t\tthis.activities.push({\n\t\t\t\t\tid: event.toolCallId,\n\t\t\t\t\tname: event.toolName,\n\t\t\t\t\targs: compactArguments(event.args),\n\t\t\t\t\ttarget: activityTarget(event.toolName, event.args, this.cwd),\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t\tstartedAt: Date.now(),\n\t\t\t\t});\n\t\t\t\tif (this.activities.length > AGENT_MAX_ACTIVITIES) this.activities.shift();\n\t\t\t\tbreak;\n\t\t\tcase \"tool_execution_end\": {\n\t\t\t\tconst key = this.pendingEdits.get(event.toolCallId);\n\t\t\t\tthis.pendingEdits.delete(event.toolCallId);\n\t\t\t\tconst attempt = key === undefined ? undefined : this.attempts.get(key);\n\t\t\t\tif (attempt && !event.isError) attempt.changed = true;\n\t\t\t\tif (event.isError && !this.control.signal.aborted) this.failedCalls++;\n\t\t\t\tconst activity = this.activities.findLast((item) => item.id === event.toolCallId);\n\t\t\t\tif (!activity) return;\n\t\t\t\tactivity.status = this.control.signal.aborted ? \"cancelled\" : event.isError ? \"error\" : \"ok\";\n\t\t\t\tactivity.durationMs = event.durationMs;\n\t\t\t\tif (event.isError) activity.error = toolErrorText(event.result);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\tthis.publish();\n\t}\n\n\tpublish(): void {\n\t\tthis.control.publish({\n\t\t\tresult: {\n\t\t\t\tcontent: [{ type: \"text\", text: this.status() }],\n\t\t\t\tdetails: {\n\t\t\t\t\tversion: 2,\n\t\t\t\t\tstate: \"running\",\n\t\t\t\t\ttaskId: this.control.id,\n\t\t\t\t\tactivities: structuredClone(this.activities),\n\t\t\t\t},\n\t\t\t},\n\t\t\tdisplay: this.display(),\n\t\t\tusage: this.usage,\n\t\t});\n\t}\n\n\t/** Classify a finished run from its last assistant message. */\n\toutcome(): { status: TaskTerminalStatus; error?: string } {\n\t\tconst last = this.last;\n\t\tif (this.control.signal.aborted || last?.stopReason === \"aborted\")\n\t\t\treturn { status: \"cancelled\", error: \"Agent cancelled.\" };\n\t\tif (!last || last.stopReason === \"error\" || last.stopReason === \"length\")\n\t\t\treturn {\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: clipText(last?.errorMessage || \"Agent ended without a complete report.\", 4096),\n\t\t\t};\n\t\treturn { status: \"completed\" };\n\t}\n\n\t/** The settled Agent's Details rows: call counts, files changed, and where the full report and transcript live. */\n\tfacts(report: FinalReport, artifacts?: AgentArtifacts): TaskFact[] {\n\t\tconst calls = `${this.calls}${this.failedCalls ? ` · ${this.failedCalls} failed` : \"\"}`;\n\t\tconst facts: TaskFact[] = [[\"Tool calls\", calls]];\n\t\tconst edited = this.editedFiles();\n\t\tif (edited.length) facts.push([\"Edited\", fitList(edited, TASK_FACT_BYTES)]);\n\t\tif (report.reportPath) facts.push([\"Report\", report.reportPath]);\n\t\tconst transcript = savedTranscript(artifacts);\n\t\tif (transcript) facts.push([\"Transcript\", transcript]);\n\t\treturn facts;\n\t}\n\n\t/** Settle with the bounded report, then the Edited line, so truncation can never cut it. */\n\tcomplete(\n\t\tstatus: TaskTerminalStatus,\n\t\terror: string | undefined,\n\t\treport: FinalReport,\n\t\tartifacts?: AgentArtifacts,\n\t): TaskCompletion<AgentToolDetails> {\n\t\tconst edited = this.editedFiles();\n\t\tconst line = edited.length\n\t\t\t? `\\n\\n${EDITED_LINE_PREFIX}${fitList(edited, EDITED_LINE_BYTES - EDITED_LINE_PREFIX.length)}`\n\t\t\t: \"\";\n\t\treturn {\n\t\t\tstatus,\n\t\t\terror,\n\t\t\tusage: this.usage,\n\t\t\tfacts: this.facts(report, artifacts),\n\t\t\tresult: {\n\t\t\t\tcontent: [{ type: \"text\", text: report.text + line }],\n\t\t\t\tdetails: { version: 2, state: status, taskId: this.control.id, ...(error ? { error } : {}) },\n\t\t\t\t...(status === \"completed\" ? {} : { isError: true }),\n\t\t\t},\n\t\t};\n\t}\n\n\t/** Display paths of the files a successful edit/write call changed, each once. */\n\tprivate editedFiles(): string[] {\n\t\treturn [...this.attempts.values()].filter((attempt) => attempt.changed).map((attempt) => attempt.display);\n\t}\n\n\tprivate trackEditStart(id: string, args: unknown): void {\n\t\tconst path = (args as { path?: unknown } | null)?.path;\n\t\tif (typeof path !== \"string\" || !path.trim()) return;\n\t\tconst resolved = this.cwd ? resolveToCwd(path, this.cwd) : path;\n\t\t// One key per file, however the Agent spelled its path.\n\t\tconst key = process.platform === \"win32\" ? resolved.toLowerCase() : resolved;\n\t\tif (!this.attempts.has(key))\n\t\t\tthis.attempts.set(key, { display: relativeToCwd(resolved, this.cwd), changed: false });\n\t\tthis.pendingEdits.set(id, key);\n\t}\n\n\t/** Model-readable progress: the report is the contract, so intermediate text never leaves the worker. */\n\tprivate status(): string {\n\t\tif (!this.latest) return \"Agent running; no tool calls yet.\";\n\t\tconst calls = `${this.calls} tool ${this.calls === 1 ? \"call\" : \"calls\"}`;\n\t\treturn `Agent running · ${calls} · latest: ${this.latest}`;\n\t}\n\n\t/**\n\t * Human-only live Output: the compact tool-call list, never sent to the model. A settled Agent\n\t * publishes no display, so /tasks then shows its report.\n\t */\n\tprivate display(): string {\n\t\treturn this.activities.length ? activitiesText(this.activities, this.calls - this.activities.length) : \"\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../../src/extensions/agent/progress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,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AAI,CAAC,MAAM;YAAE,OAAO,mCAAmC,CAAC;QAC7D,MAAM,KAAK,GAAG,GAAG,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAC1E,OAAO,mBAAmB,KAAK,cAAc,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5D,CAAC;IAED;;;OAGG;IACK,OAAO;QACd,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAC9D,OAAO;YACN,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC;YAC5D,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,iBAAiB;SACjB,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport type { Usage } from \"@earendil-works/pi-ai/compat\";\nimport type { AgentSessionEvent } from \"../../core/agent-session.ts\";\nimport { taskActivitiesText } from \"../../core/tasks/activity.ts\";\nimport { TASK_FACT_BYTES } from \"../../core/tasks/output.ts\";\nimport type { TaskCompletion, TaskControl, TaskDisplay, TaskFact, TaskTerminalStatus } from \"../../core/tasks/types.ts\";\nimport { resolveToCwd } from \"../../core/tools/path-utils.ts\";\nimport { combineUsage } from \"../../core/usage-totals.ts\";\nimport { emptyUsage } from \"../../utils/usage.ts\";\nimport { activityTarget, clipText, compactArguments, relativeToCwd } from \"./activity.ts\";\nimport { type AgentArtifacts, fitList, savedTranscript } from \"./artifacts.ts\";\nimport type { FinalReport } from \"./report.ts\";\nimport { AGENT_MAX_ACTIVITIES, type AgentActivity, type AgentToolDetails } from \"./types.ts\";\n\ntype AssistantMessage = Extract<AgentMessage, { role: \"assistant\" }>;\n\nfunction assistantText(message: AgentMessage): string {\n\tif (message.role !== \"assistant\") return \"\";\n\treturn message.content\n\t\t.filter((block) => block.type === \"text\")\n\t\t.map((block) => block.text)\n\t\t.join(\"\\n\");\n}\n\nexport function finalAssistantText(messages: readonly AgentMessage[]): string {\n\tfor (let index = messages.length - 1; index >= 0; index--) {\n\t\tconst text = assistantText(messages[index]!);\n\t\tif (text.trim()) return text;\n\t}\n\treturn \"\";\n}\n\nfunction toolErrorText(result: unknown): string {\n\tconst content = (result as { content?: Array<{ type: string; text?: string }> }).content;\n\tconst text = content\n\t\t?.filter((block) => block.type === \"text\")\n\t\t.map((block) => block.text ?? \"\")\n\t\t.join(\"\\n\");\n\treturn clipText(text || \"Tool call failed.\", 1000);\n}\n\n/** Tools whose successful calls change the named file. */\nconst EDIT_TOOLS = new Set([\"edit\", \"write\"]);\n/** The model-facing Edited line stays this small, whatever the Agent changed. */\nconst EDITED_LINE_BYTES = 1024;\nconst EDITED_LINE_PREFIX = \"Edited (edit/write): \";\n\n/**\n * One worker session translated into task progress: a one-line status for the model,\n * tool activity for humans, and cumulative usage for the ledger.\n */\nexport class AgentProgress {\n\tprivate readonly control: TaskControl<AgentToolDetails>;\n\tprivate readonly activities: AgentActivity[] = [];\n\tprivate readonly counted = new WeakSet<AgentMessage>();\n\tprivate calls = 0;\n\tprivate failedCalls = 0;\n\t/** The file key of each in-flight edit/write call, by tool call id. */\n\tprivate readonly pendingEdits = new Map<string, string>();\n\t/**\n\t * Files named by edit/write calls in the order their first call started, so parallel calls give a\n\t * stable order; only files with a successful call count as edited. Never trimmed with the activity list.\n\t */\n\tprivate readonly attempts = new Map<string, { display: string; changed: boolean }>();\n\tprivate usage: Usage = emptyUsage();\n\tprivate last?: AssistantMessage;\n\t/** What the model-facing status line names; it keeps the path as the Agent wrote it. */\n\tprivate latest = \"\";\n\t/** The Agent's working directory, used to show paths inside it relative. */\n\tprivate readonly cwd?: string;\n\n\tconstructor(control: TaskControl<AgentToolDetails>, cwd?: string) {\n\t\tthis.control = control;\n\t\tthis.cwd = cwd;\n\t}\n\n\thandle(event: AgentSessionEvent): void {\n\t\tswitch (event.type) {\n\t\t\tcase \"message_end\":\n\t\t\t\tif (event.message.role !== \"assistant\") return;\n\t\t\t\tthis.last = event.message;\n\t\t\t\tif (!this.counted.has(event.message)) {\n\t\t\t\t\tthis.counted.add(event.message);\n\t\t\t\t\tthis.usage = combineUsage(this.usage, event.message.usage);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase \"compaction_end\":\n\t\t\t\tif (event.result?.usage) this.usage = combineUsage(this.usage, event.result.usage);\n\t\t\t\treturn;\n\t\t\tcase \"tool_execution_start\":\n\t\t\t\tthis.calls++;\n\t\t\t\tif (EDIT_TOOLS.has(event.toolName)) this.trackEditStart(event.toolCallId, event.args);\n\t\t\t\tthis.latest = [event.toolName, activityTarget(event.toolName, event.args)].filter(Boolean).join(\" \");\n\t\t\t\tthis.activities.push({\n\t\t\t\t\tid: event.toolCallId,\n\t\t\t\t\tname: event.toolName,\n\t\t\t\t\targs: compactArguments(event.args),\n\t\t\t\t\ttarget: activityTarget(event.toolName, event.args, this.cwd),\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t\tstartedAt: Date.now(),\n\t\t\t\t});\n\t\t\t\tif (this.activities.length > AGENT_MAX_ACTIVITIES) this.activities.shift();\n\t\t\t\tbreak;\n\t\t\tcase \"tool_execution_end\": {\n\t\t\t\tconst key = this.pendingEdits.get(event.toolCallId);\n\t\t\t\tthis.pendingEdits.delete(event.toolCallId);\n\t\t\t\tconst attempt = key === undefined ? undefined : this.attempts.get(key);\n\t\t\t\tif (attempt && !event.isError) attempt.changed = true;\n\t\t\t\tif (event.isError && !this.control.signal.aborted) this.failedCalls++;\n\t\t\t\tconst activity = this.activities.findLast((item) => item.id === event.toolCallId);\n\t\t\t\tif (!activity) return;\n\t\t\t\tactivity.status = this.control.signal.aborted ? \"cancelled\" : event.isError ? \"error\" : \"ok\";\n\t\t\t\tactivity.durationMs = event.durationMs;\n\t\t\t\tif (event.isError) activity.error = toolErrorText(event.result);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\tthis.publish();\n\t}\n\n\tpublish(): void {\n\t\tthis.control.publish({\n\t\t\tresult: {\n\t\t\t\tcontent: [{ type: \"text\", text: this.status() }],\n\t\t\t\tdetails: {\n\t\t\t\t\tversion: 2,\n\t\t\t\t\tstate: \"running\",\n\t\t\t\t\ttaskId: this.control.id,\n\t\t\t\t\tactivities: structuredClone(this.activities),\n\t\t\t\t},\n\t\t\t},\n\t\t\tdisplay: this.display(),\n\t\t\tusage: this.usage,\n\t\t});\n\t}\n\n\t/** Classify a finished run from its last assistant message. */\n\toutcome(): { status: TaskTerminalStatus; error?: string } {\n\t\tconst last = this.last;\n\t\tif (this.control.signal.aborted || last?.stopReason === \"aborted\")\n\t\t\treturn { status: \"cancelled\", error: \"Agent cancelled.\" };\n\t\tif (!last || last.stopReason === \"error\" || last.stopReason === \"length\")\n\t\t\treturn {\n\t\t\t\tstatus: \"failed\",\n\t\t\t\terror: clipText(last?.errorMessage || \"Agent ended without a complete report.\", 4096),\n\t\t\t};\n\t\treturn { status: \"completed\" };\n\t}\n\n\t/** The settled Agent's Details rows: call counts, files changed, and where the full report and transcript live. */\n\tfacts(report: FinalReport, artifacts?: AgentArtifacts): TaskFact[] {\n\t\tconst calls = `${this.calls}${this.failedCalls ? ` · ${this.failedCalls} failed` : \"\"}`;\n\t\tconst facts: TaskFact[] = [[\"Tool calls\", calls]];\n\t\tconst edited = this.editedFiles();\n\t\tif (edited.length) facts.push([\"Edited\", fitList(edited, TASK_FACT_BYTES)]);\n\t\tif (report.reportPath) facts.push([\"Report\", report.reportPath]);\n\t\tconst transcript = savedTranscript(artifacts);\n\t\tif (transcript) facts.push([\"Transcript\", transcript]);\n\t\treturn facts;\n\t}\n\n\t/** Settle with the bounded report, then the Edited line, so truncation can never cut it. */\n\tcomplete(\n\t\tstatus: TaskTerminalStatus,\n\t\terror: string | undefined,\n\t\treport: FinalReport,\n\t\tartifacts?: AgentArtifacts,\n\t): TaskCompletion<AgentToolDetails> {\n\t\tconst edited = this.editedFiles();\n\t\tconst line = edited.length\n\t\t\t? `\\n\\n${EDITED_LINE_PREFIX}${fitList(edited, EDITED_LINE_BYTES - EDITED_LINE_PREFIX.length)}`\n\t\t\t: \"\";\n\t\treturn {\n\t\t\tstatus,\n\t\t\terror,\n\t\t\tusage: this.usage,\n\t\t\tfacts: this.facts(report, artifacts),\n\t\t\tresult: {\n\t\t\t\tcontent: [{ type: \"text\", text: report.text + line }],\n\t\t\t\tdetails: { version: 2, state: status, taskId: this.control.id, ...(error ? { error } : {}) },\n\t\t\t\t...(status === \"completed\" ? {} : { isError: true }),\n\t\t\t},\n\t\t};\n\t}\n\n\t/** Display paths of the files a successful edit/write call changed, each once. */\n\tprivate editedFiles(): string[] {\n\t\treturn [...this.attempts.values()].filter((attempt) => attempt.changed).map((attempt) => attempt.display);\n\t}\n\n\tprivate trackEditStart(id: string, args: unknown): void {\n\t\tconst path = (args as { path?: unknown } | null)?.path;\n\t\tif (typeof path !== \"string\" || !path.trim()) return;\n\t\tconst resolved = this.cwd ? resolveToCwd(path, this.cwd) : path;\n\t\t// One key per file, however the Agent spelled its path.\n\t\tconst key = process.platform === \"win32\" ? resolved.toLowerCase() : resolved;\n\t\tif (!this.attempts.has(key))\n\t\t\tthis.attempts.set(key, { display: relativeToCwd(resolved, this.cwd), changed: false });\n\t\tthis.pendingEdits.set(id, key);\n\t}\n\n\t/** Model-readable progress: the report is the contract, so intermediate text never leaves the worker. */\n\tprivate status(): string {\n\t\tif (!this.latest) return \"Agent running; no tool calls yet.\";\n\t\tconst calls = `${this.calls} tool ${this.calls === 1 ? \"call\" : \"calls\"}`;\n\t\treturn `Agent running · ${calls} · latest: ${this.latest}`;\n\t}\n\n\t/**\n\t * Human-only live Output: the compact tool-call list, never sent to the model. A settled Agent\n\t * publishes no display, so /tasks then shows its report.\n\t */\n\tprivate display(): TaskDisplay {\n\t\tconst earlierActivities = this.calls - this.activities.length;\n\t\treturn {\n\t\t\ttext: taskActivitiesText(this.activities, earlierActivities),\n\t\t\ttruncated: false,\n\t\t\tactivities: this.activities,\n\t\t\tearlierActivities,\n\t\t};\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
2
- import type { TaskTerminalStatus } from "../../core/tasks/types.ts";
2
+ import type { TaskActivity, TaskTerminalStatus } from "../../core/tasks/types.ts";
3
3
  export declare const AGENT_SETTINGS_NAMESPACE = "agent";
4
4
  export declare const AGENT_PROMPT_BYTES: number;
5
5
  export declare const AGENT_REPORT_BYTES: number;
@@ -9,18 +9,10 @@ export interface AgentSettings {
9
9
  model?: string;
10
10
  thinking?: ThinkingLevel;
11
11
  }
12
- export type AgentActivityStatus = "running" | "ok" | "error" | "cancelled";
13
- export interface AgentActivity {
12
+ export type AgentActivityStatus = TaskActivity["status"];
13
+ export interface AgentActivity extends TaskActivity {
14
14
  id: string;
15
- name: string;
16
15
  args: string;
17
- /** Short display label derived from the original arguments; args remains the full bounded form. */
18
- target?: string;
19
- status: AgentActivityStatus;
20
- /** Epoch milliseconds when the call began, so a running call can show its elapsed time. */
21
- startedAt?: number;
22
- durationMs?: number;
23
- error?: string;
24
16
  }
25
17
  /**
26
18
  * Agent tool-result details. Only progress updates carry activities; the persisted result
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extensions/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,kBAAkB,QAAY,CAAC;AAC5C,eAAO,MAAM,kBAAkB,QAAY,CAAC;AAC5C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,iBAAiB,IAAI,CAAC;A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esContent":["import type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { TaskTerminalStatus } from \"../../core/tasks/types.ts\";\n\nexport const AGENT_SETTINGS_NAMESPACE = \"agent\";\nexport const AGENT_PROMPT_BYTES = 16 * 1024;\nexport const AGENT_REPORT_BYTES = 24 * 1024;\nexport const AGENT_MAX_ACTIVITIES = 50;\nexport const AGENT_CONCURRENCY = 4;\n\nexport interface AgentSettings {\n\tmodel?: string;\n\tthinking?: ThinkingLevel;\n}\n\nexport type AgentActivityStatus = \"running\" | \"ok\" | \"error\" | \"cancelled\";\n\nexport interface AgentActivity {\n\tid: string;\n\tname: string;\n\targs: string;\n\t/** Short display label derived from the original arguments; args remains the full bounded form. */\n\ttarget?: string;\n\tstatus: AgentActivityStatus;\n\t/** Epoch milliseconds when the call began, so a running call can show its elapsed time. */\n\tstartedAt?: number;\n\tdurationMs?: number;\n\terror?: string;\n}\n\n/**\n * Agent tool-result details. Only progress updates carry activities; the persisted result\n * keeps the transcript row's facts, and the full history lives in the task's Output.\n */\nexport type AgentToolDetails =\n\t| { version: 2; state: \"running\"; taskId: string; activities: AgentActivity[] }\n\t| { version: 2; state: \"background\"; taskId: string; byUser: boolean }\n\t| { version: 2; state: TaskTerminalStatus; taskId: string; error?: string };\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/extensions/agent/types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC","sourcesContent":["import type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { TaskActivity, TaskTerminalStatus } from \"../../core/tasks/types.ts\";\n\nexport const AGENT_SETTINGS_NAMESPACE = \"agent\";\nexport const AGENT_PROMPT_BYTES = 16 * 1024;\nexport const AGENT_REPORT_BYTES = 24 * 1024;\nexport const AGENT_MAX_ACTIVITIES = 50;\nexport const AGENT_CONCURRENCY = 4;\n\nexport interface AgentSettings {\n\tmodel?: string;\n\tthinking?: ThinkingLevel;\n}\n\nexport type AgentActivityStatus = TaskActivity[\"status\"];\n\nexport interface AgentActivity extends TaskActivity {\n\tid: string;\n\targs: string;\n}\n\n/**\n * Agent tool-result details. Only progress updates carry activities; the persisted result\n * keeps the transcript row's facts, and the full history lives in the task's Output.\n */\nexport type AgentToolDetails =\n\t| { version: 2; state: \"running\"; taskId: string; activities: AgentActivity[] }\n\t| { version: 2; state: \"background\"; taskId: string; byUser: boolean }\n\t| { version: 2; state: TaskTerminalStatus; taskId: string; error?: string };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"inspector.d.ts","sourceRoot":"","sources":["../../../../src/extensions/tasks/ui/inspector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEzF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,UAAU,eAAe;IACxB,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,qFAAqF;IACrF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AACD,UAAU,gBAAgB;IACzB,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,IAAI,IAAI,CAAC;CACtB;AAOD,8FAA8F;AAC9F,qBAAa,aAAa;IACzB,IAAI,CAAC,EAAE,YAAY,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AAC;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,IAAI,IAAI,CAAC;CACtB;AAOD,8FAA8F;AAC9F,qBAAa,aAAa;IACzB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,OAAO,CAAC,CAAa;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,iFAAiF;IACjF,OAAO,CAAC,WAAW,CAAC,CAA0E;IAC9F,OAAO,CAAC,WAAW,CAAC,CAAyD;gBACjE,OAAO,EAAE,gBAAgB;IAGrC,IAAI,QAAQ,IAAI,eAAe,CAQ9B;IACD,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;IAiB5C,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI;IAGrC,UAAU,IAAI,IAAI;IAIZ,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B9B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAW/B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAQhC,OAAO,IAAI,IAAI;CAOf"}
@@ -93,7 +93,9 @@ export class TaskInspector {
93
93
  return [];
94
94
  const read = this.position.read;
95
95
  const cache = this.outputCache;
96
- if (cache?.task !== task || cache.read !== read || cache.width !== width)
96
+ // Activity markers and elapsed time advance between snapshot updates, so live rows repaint uncached.
97
+ const live = !isTaskTerminal(task.status) && !!task.display?.activities?.length;
98
+ if (live || cache?.task !== task || cache.read !== read || cache.width !== width)
97
99
  this.outputCache = { task, read, width, lines: outputLines(task, read, this.options.theme, width) };
98
100
  return this.outputCache.lines;
99
101
  }