praxis-agent 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/README.md +8 -0
  2. package/dist/application/background-agent-manager.d.ts +5 -0
  3. package/dist/application/background-agent-manager.js +21 -0
  4. package/dist/application/background-bash-manager.d.ts +14 -0
  5. package/dist/application/background-bash-manager.js +42 -4
  6. package/dist/application/background-task-runtime.d.ts +34 -0
  7. package/dist/application/background-task-runtime.js +59 -0
  8. package/dist/application/session-service.d.ts +21 -1
  9. package/dist/application/session-service.js +188 -17
  10. package/dist/application/session-worktree.d.ts +1 -0
  11. package/dist/application/session-worktree.js +13 -2
  12. package/dist/application/subagent-service.d.ts +3 -0
  13. package/dist/application/subagent-service.js +6 -0
  14. package/dist/application/workflow-manager.d.ts +70 -2
  15. package/dist/application/workflow-manager.js +21 -4
  16. package/dist/cli/agents-dashboard.d.ts +9 -0
  17. package/dist/cli/agents-dashboard.js +16 -5
  18. package/dist/cli/interactive.d.ts +41 -3
  19. package/dist/cli/interactive.js +1281 -183
  20. package/dist/cli/tui/claude-style.d.ts +31 -3
  21. package/dist/cli/tui/claude-style.js +171 -54
  22. package/dist/cli/tui/config-dashboard.d.ts +63 -0
  23. package/dist/cli/tui/config-dashboard.js +150 -0
  24. package/dist/cli/tui/config-settings.d.ts +32 -0
  25. package/dist/cli/tui/config-settings.js +276 -0
  26. package/dist/cli/tui/custom-themes.d.ts +21 -0
  27. package/dist/cli/tui/custom-themes.js +284 -0
  28. package/dist/cli/tui/file-picker.d.ts +3 -1
  29. package/dist/cli/tui/file-picker.js +8 -2
  30. package/dist/cli/tui/keybindings.js +0 -1
  31. package/dist/cli/tui/mcp-panel-controller.d.ts +32 -0
  32. package/dist/cli/tui/mcp-panel-controller.js +80 -0
  33. package/dist/cli/tui/mcp-panel-projector.d.ts +79 -0
  34. package/dist/cli/tui/mcp-panel-projector.js +181 -0
  35. package/dist/cli/tui/mcp-panel.d.ts +8 -0
  36. package/dist/cli/tui/mcp-panel.js +99 -0
  37. package/dist/cli/tui/recently-denied.d.ts +15 -0
  38. package/dist/cli/tui/recently-denied.js +19 -0
  39. package/dist/cli/tui/runtime-interactions.d.ts +17 -0
  40. package/dist/cli/tui/runtime-interactions.js +100 -0
  41. package/dist/cli/tui/runtime-settings.d.ts +40 -0
  42. package/dist/cli/tui/runtime-settings.js +84 -0
  43. package/dist/cli/tui/slash-commands.js +10 -0
  44. package/dist/cli/tui/task-panel.d.ts +53 -0
  45. package/dist/cli/tui/task-panel.js +204 -0
  46. package/dist/cli/tui/terminal-notifications.d.ts +10 -0
  47. package/dist/cli/tui/terminal-notifications.js +48 -0
  48. package/dist/cli/tui/terminal-setup.d.ts +24 -0
  49. package/dist/cli/tui/terminal-setup.js +618 -0
  50. package/dist/cli/tui/theme-settings.d.ts +8 -0
  51. package/dist/cli/tui/theme-settings.js +132 -0
  52. package/dist/cli/tui/theme.d.ts +53 -0
  53. package/dist/cli/tui/theme.js +265 -0
  54. package/dist/cli.d.ts +9 -0
  55. package/dist/cli.js +97 -17
  56. package/dist/compatibility/claude/schema.js +2 -0
  57. package/dist/core/runtime.d.ts +12 -0
  58. package/dist/core/runtime.js +24 -0
  59. package/dist/maintenance/self-update.js +1 -1
  60. package/dist/mcp/claude-mcp-management.d.ts +6 -1
  61. package/dist/mcp/claude-mcp-management.js +191 -44
  62. package/dist/mcp/claude-mcp-oauth.js +2 -0
  63. package/dist/mcp/claude-mcp-tools.d.ts +31 -3
  64. package/dist/mcp/claude-mcp-tools.js +116 -34
  65. package/dist/permissions/claude-permission-resolver.d.ts +3 -0
  66. package/dist/permissions/claude-permission-resolver.js +42 -20
  67. package/dist/platform/claude-version.js +2 -1
  68. package/dist/plugins/claude-plugin-runtime.js +11 -3
  69. package/dist/tools/claude-interactive-tools.d.ts +7 -0
  70. package/dist/tools/claude-interactive-tools.js +21 -8
  71. package/dist/tools/claude-task-tools.d.ts +4 -0
  72. package/dist/tools/claude-task-tools.js +7 -0
  73. package/package.json +2 -1
  74. package/dist/application/background-agent-manager.d.ts.map +0 -1
  75. package/dist/application/background-agent-manager.js.map +0 -1
  76. package/dist/application/background-bash-manager.d.ts.map +0 -1
  77. package/dist/application/background-bash-manager.js.map +0 -1
  78. package/dist/application/background-task-id.d.ts.map +0 -1
  79. package/dist/application/background-task-id.js.map +0 -1
  80. package/dist/application/claude-project-purge.d.ts.map +0 -1
  81. package/dist/application/claude-project-purge.js.map +0 -1
  82. package/dist/application/managed-worktree.d.ts.map +0 -1
  83. package/dist/application/managed-worktree.js.map +0 -1
  84. package/dist/application/model-compactor.d.ts.map +0 -1
  85. package/dist/application/model-compactor.js.map +0 -1
  86. package/dist/application/scheduled-prompt-manager.d.ts.map +0 -1
  87. package/dist/application/scheduled-prompt-manager.js.map +0 -1
  88. package/dist/application/session-service.d.ts.map +0 -1
  89. package/dist/application/session-service.js.map +0 -1
  90. package/dist/application/session-worktree.d.ts.map +0 -1
  91. package/dist/application/session-worktree.js.map +0 -1
  92. package/dist/application/subagent-service.d.ts.map +0 -1
  93. package/dist/application/subagent-service.js.map +0 -1
  94. package/dist/application/tool-use-summary.d.ts.map +0 -1
  95. package/dist/application/tool-use-summary.js.map +0 -1
  96. package/dist/application/top-level-agent-manager.d.ts.map +0 -1
  97. package/dist/application/top-level-agent-manager.js.map +0 -1
  98. package/dist/application/workflow-manager.d.ts.map +0 -1
  99. package/dist/application/workflow-manager.js.map +0 -1
  100. package/dist/application/workflow-meta.d.ts.map +0 -1
  101. package/dist/application/workflow-meta.js.map +0 -1
  102. package/dist/application/workflow-runtime.d.ts.map +0 -1
  103. package/dist/application/workflow-runtime.js.map +0 -1
  104. package/dist/application/workflow-worktree.d.ts.map +0 -1
  105. package/dist/application/workflow-worktree.js.map +0 -1
  106. package/dist/cli/agents-dashboard.d.ts.map +0 -1
  107. package/dist/cli/agents-dashboard.js.map +0 -1
  108. package/dist/cli/controls.d.ts.map +0 -1
  109. package/dist/cli/controls.js.map +0 -1
  110. package/dist/cli/debug.d.ts.map +0 -1
  111. package/dist/cli/debug.js.map +0 -1
  112. package/dist/cli/interactive.d.ts.map +0 -1
  113. package/dist/cli/interactive.js.map +0 -1
  114. package/dist/cli/protocol.d.ts.map +0 -1
  115. package/dist/cli/protocol.js.map +0 -1
  116. package/dist/cli/tui/claude-style.d.ts.map +0 -1
  117. package/dist/cli/tui/claude-style.js.map +0 -1
  118. package/dist/cli/tui/clipboard.d.ts.map +0 -1
  119. package/dist/cli/tui/clipboard.js.map +0 -1
  120. package/dist/cli/tui/composer-editor.d.ts.map +0 -1
  121. package/dist/cli/tui/composer-editor.js.map +0 -1
  122. package/dist/cli/tui/composer-images.d.ts.map +0 -1
  123. package/dist/cli/tui/composer-images.js.map +0 -1
  124. package/dist/cli/tui/conversation-export.d.ts.map +0 -1
  125. package/dist/cli/tui/conversation-export.js.map +0 -1
  126. package/dist/cli/tui/external-editor.d.ts.map +0 -1
  127. package/dist/cli/tui/external-editor.js.map +0 -1
  128. package/dist/cli/tui/file-picker.d.ts.map +0 -1
  129. package/dist/cli/tui/file-picker.js.map +0 -1
  130. package/dist/cli/tui/git-diff.d.ts.map +0 -1
  131. package/dist/cli/tui/git-diff.js.map +0 -1
  132. package/dist/cli/tui/hook-settings.d.ts.map +0 -1
  133. package/dist/cli/tui/hook-settings.js.map +0 -1
  134. package/dist/cli/tui/keybindings.d.ts.map +0 -1
  135. package/dist/cli/tui/keybindings.js.map +0 -1
  136. package/dist/cli/tui/memory-files.d.ts.map +0 -1
  137. package/dist/cli/tui/memory-files.js.map +0 -1
  138. package/dist/cli/tui/permission-settings.d.ts.map +0 -1
  139. package/dist/cli/tui/permission-settings.js.map +0 -1
  140. package/dist/cli/tui/slash-commands.d.ts.map +0 -1
  141. package/dist/cli/tui/slash-commands.js.map +0 -1
  142. package/dist/cli/tui/terminal-suspend.d.ts.map +0 -1
  143. package/dist/cli/tui/terminal-suspend.js.map +0 -1
  144. package/dist/cli/tui/workspace-directories.d.ts.map +0 -1
  145. package/dist/cli/tui/workspace-directories.js.map +0 -1
  146. package/dist/cli.d.ts.map +0 -1
  147. package/dist/cli.js.map +0 -1
  148. package/dist/compatibility/claude/compaction.d.ts.map +0 -1
  149. package/dist/compatibility/claude/compaction.js.map +0 -1
  150. package/dist/compatibility/claude/context.d.ts.map +0 -1
  151. package/dist/compatibility/claude/context.js.map +0 -1
  152. package/dist/compatibility/claude/dynamic-context.d.ts.map +0 -1
  153. package/dist/compatibility/claude/dynamic-context.js.map +0 -1
  154. package/dist/compatibility/claude/file-history.d.ts.map +0 -1
  155. package/dist/compatibility/claude/file-history.js.map +0 -1
  156. package/dist/compatibility/claude/file-resources.d.ts.map +0 -1
  157. package/dist/compatibility/claude/file-resources.js.map +0 -1
  158. package/dist/compatibility/claude/fork.d.ts.map +0 -1
  159. package/dist/compatibility/claude/fork.js.map +0 -1
  160. package/dist/compatibility/claude/history.d.ts.map +0 -1
  161. package/dist/compatibility/claude/history.js.map +0 -1
  162. package/dist/compatibility/claude/ownership.d.ts.map +0 -1
  163. package/dist/compatibility/claude/ownership.js.map +0 -1
  164. package/dist/compatibility/claude/paths.d.ts.map +0 -1
  165. package/dist/compatibility/claude/paths.js.map +0 -1
  166. package/dist/compatibility/claude/pr-links.d.ts.map +0 -1
  167. package/dist/compatibility/claude/pr-links.js.map +0 -1
  168. package/dist/compatibility/claude/projection.d.ts.map +0 -1
  169. package/dist/compatibility/claude/projection.js.map +0 -1
  170. package/dist/compatibility/claude/schema.d.ts.map +0 -1
  171. package/dist/compatibility/claude/schema.js.map +0 -1
  172. package/dist/compatibility/claude/shared-resources.d.ts.map +0 -1
  173. package/dist/compatibility/claude/shared-resources.js.map +0 -1
  174. package/dist/compatibility/claude/sidechain.d.ts.map +0 -1
  175. package/dist/compatibility/claude/sidechain.js.map +0 -1
  176. package/dist/compatibility/claude/tool-links.d.ts.map +0 -1
  177. package/dist/compatibility/claude/tool-links.js.map +0 -1
  178. package/dist/compatibility/claude/translation.d.ts.map +0 -1
  179. package/dist/compatibility/claude/translation.js.map +0 -1
  180. package/dist/compatibility/claude/workflow-replay.d.ts.map +0 -1
  181. package/dist/compatibility/claude/workflow-replay.js.map +0 -1
  182. package/dist/compatibility/claude/workflow.d.ts.map +0 -1
  183. package/dist/compatibility/claude/workflow.js.map +0 -1
  184. package/dist/core/compaction.d.ts.map +0 -1
  185. package/dist/core/compaction.js.map +0 -1
  186. package/dist/core/context-budget.d.ts.map +0 -1
  187. package/dist/core/context-budget.js.map +0 -1
  188. package/dist/core/context.d.ts.map +0 -1
  189. package/dist/core/context.js.map +0 -1
  190. package/dist/core/runtime.d.ts.map +0 -1
  191. package/dist/core/runtime.js.map +0 -1
  192. package/dist/core/usage.d.ts.map +0 -1
  193. package/dist/core/usage.js.map +0 -1
  194. package/dist/extensions/claude-extension-tools.d.ts.map +0 -1
  195. package/dist/extensions/claude-extension-tools.js.map +0 -1
  196. package/dist/extensions/claude-extensions.d.ts.map +0 -1
  197. package/dist/extensions/claude-extensions.js.map +0 -1
  198. package/dist/hooks/claude-hook-tools.d.ts.map +0 -1
  199. package/dist/hooks/claude-hook-tools.js.map +0 -1
  200. package/dist/hooks/claude-hooks.d.ts.map +0 -1
  201. package/dist/hooks/claude-hooks.js.map +0 -1
  202. package/dist/maintenance/doctor.d.ts.map +0 -1
  203. package/dist/maintenance/doctor.js.map +0 -1
  204. package/dist/maintenance/self-update.d.ts.map +0 -1
  205. package/dist/maintenance/self-update.js.map +0 -1
  206. package/dist/mcp/claude-mcp-management.d.ts.map +0 -1
  207. package/dist/mcp/claude-mcp-management.js.map +0 -1
  208. package/dist/mcp/claude-mcp-oauth.d.ts.map +0 -1
  209. package/dist/mcp/claude-mcp-oauth.js.map +0 -1
  210. package/dist/mcp/claude-mcp-tools.d.ts.map +0 -1
  211. package/dist/mcp/claude-mcp-tools.js.map +0 -1
  212. package/dist/mcp/praxis-mcp-server.d.ts.map +0 -1
  213. package/dist/mcp/praxis-mcp-server.js.map +0 -1
  214. package/dist/permissions/claude-auto-classifier.d.ts.map +0 -1
  215. package/dist/permissions/claude-auto-classifier.js.map +0 -1
  216. package/dist/permissions/claude-permission-resolver.d.ts.map +0 -1
  217. package/dist/permissions/claude-permission-resolver.js.map +0 -1
  218. package/dist/persistence/claude-job-store.d.ts.map +0 -1
  219. package/dist/persistence/claude-job-store.js.map +0 -1
  220. package/dist/persistence/claude-scheduled-task-store.d.ts.map +0 -1
  221. package/dist/persistence/claude-scheduled-task-store.js.map +0 -1
  222. package/dist/persistence/claude-sidechain-store.d.ts.map +0 -1
  223. package/dist/persistence/claude-sidechain-store.js.map +0 -1
  224. package/dist/persistence/claude-task-store.d.ts.map +0 -1
  225. package/dist/persistence/claude-task-store.js.map +0 -1
  226. package/dist/persistence/claude-transcript-store.d.ts.map +0 -1
  227. package/dist/persistence/claude-transcript-store.js.map +0 -1
  228. package/dist/persistence/claude-workflow-store.d.ts.map +0 -1
  229. package/dist/persistence/claude-workflow-store.js.map +0 -1
  230. package/dist/persistence/in-memory-sidechain-store.d.ts.map +0 -1
  231. package/dist/persistence/in-memory-sidechain-store.js.map +0 -1
  232. package/dist/persistence/in-memory-transcript-store.d.ts.map +0 -1
  233. package/dist/persistence/in-memory-transcript-store.js.map +0 -1
  234. package/dist/platform/atomic-write.d.ts.map +0 -1
  235. package/dist/platform/atomic-write.js.map +0 -1
  236. package/dist/platform/bounded-process-runner.d.ts.map +0 -1
  237. package/dist/platform/bounded-process-runner.js.map +0 -1
  238. package/dist/platform/claude-version.d.ts.map +0 -1
  239. package/dist/platform/claude-version.js.map +0 -1
  240. package/dist/platform/command-shell.d.ts.map +0 -1
  241. package/dist/platform/command-shell.js.map +0 -1
  242. package/dist/platform/exclusive-file-lease.d.ts.map +0 -1
  243. package/dist/platform/exclusive-file-lease.js.map +0 -1
  244. package/dist/platform/sensitive-data.d.ts.map +0 -1
  245. package/dist/platform/sensitive-data.js.map +0 -1
  246. package/dist/platform/tmux-worktree.d.ts.map +0 -1
  247. package/dist/platform/tmux-worktree.js.map +0 -1
  248. package/dist/plugins/claude-plugin-eval-discovery.d.ts.map +0 -1
  249. package/dist/plugins/claude-plugin-eval-discovery.js.map +0 -1
  250. package/dist/plugins/claude-plugin-eval-graders.d.ts.map +0 -1
  251. package/dist/plugins/claude-plugin-eval-graders.js.map +0 -1
  252. package/dist/plugins/claude-plugin-eval-runner.d.ts.map +0 -1
  253. package/dist/plugins/claude-plugin-eval-runner.js.map +0 -1
  254. package/dist/plugins/claude-plugin-eval-schema.d.ts.map +0 -1
  255. package/dist/plugins/claude-plugin-eval-schema.js.map +0 -1
  256. package/dist/plugins/claude-plugin-eval.d.ts.map +0 -1
  257. package/dist/plugins/claude-plugin-eval.js.map +0 -1
  258. package/dist/plugins/claude-plugin-maintenance.d.ts.map +0 -1
  259. package/dist/plugins/claude-plugin-maintenance.js.map +0 -1
  260. package/dist/plugins/claude-plugin-marketplace.d.ts.map +0 -1
  261. package/dist/plugins/claude-plugin-marketplace.js.map +0 -1
  262. package/dist/plugins/claude-plugin-mcpb.d.ts.map +0 -1
  263. package/dist/plugins/claude-plugin-mcpb.js.map +0 -1
  264. package/dist/plugins/claude-plugin-runtime.d.ts.map +0 -1
  265. package/dist/plugins/claude-plugin-runtime.js.map +0 -1
  266. package/dist/providers/anthropic-compatible.d.ts.map +0 -1
  267. package/dist/providers/anthropic-compatible.js.map +0 -1
  268. package/dist/providers/environment.d.ts.map +0 -1
  269. package/dist/providers/environment.js.map +0 -1
  270. package/dist/providers/fallback-provider.d.ts.map +0 -1
  271. package/dist/providers/fallback-provider.js.map +0 -1
  272. package/dist/providers/openai-compatible.d.ts.map +0 -1
  273. package/dist/providers/openai-compatible.js.map +0 -1
  274. package/dist/tools/claude-interactive-tools.d.ts.map +0 -1
  275. package/dist/tools/claude-interactive-tools.js.map +0 -1
  276. package/dist/tools/claude-lsp-formatters.d.ts.map +0 -1
  277. package/dist/tools/claude-lsp-formatters.js.map +0 -1
  278. package/dist/tools/claude-lsp-tool.d.ts.map +0 -1
  279. package/dist/tools/claude-lsp-tool.js.map +0 -1
  280. package/dist/tools/claude-scheduled-tools.d.ts.map +0 -1
  281. package/dist/tools/claude-scheduled-tools.js.map +0 -1
  282. package/dist/tools/claude-task-tools.d.ts.map +0 -1
  283. package/dist/tools/claude-task-tools.js.map +0 -1
  284. package/dist/tools/claude-user-message.d.ts.map +0 -1
  285. package/dist/tools/claude-user-message.js.map +0 -1
  286. package/dist/tools/claude-workflow-tools.d.ts.map +0 -1
  287. package/dist/tools/claude-workflow-tools.js.map +0 -1
  288. package/dist/tools/claude-worktree-tools.d.ts.map +0 -1
  289. package/dist/tools/claude-worktree-tools.js.map +0 -1
  290. package/dist/tools/filtered-tool-registry.d.ts.map +0 -1
  291. package/dist/tools/filtered-tool-registry.js.map +0 -1
  292. package/dist/tools/glob.d.ts.map +0 -1
  293. package/dist/tools/glob.js.map +0 -1
  294. package/dist/tools/local-tools.d.ts.map +0 -1
  295. package/dist/tools/local-tools.js.map +0 -1
  296. package/dist/tools/notebook.d.ts.map +0 -1
  297. package/dist/tools/notebook.js.map +0 -1
  298. package/dist/tools/pdf.d.ts.map +0 -1
  299. package/dist/tools/pdf.js.map +0 -1
  300. package/dist/tools/web.d.ts.map +0 -1
  301. package/dist/tools/web.js.map +0 -1
@@ -0,0 +1,204 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ function requiredString(record, names) {
4
+ for (const name of names) {
5
+ const value = record[name];
6
+ if (typeof value === 'string' && value.trim())
7
+ return value;
8
+ }
9
+ throw new Error(`Task record is missing ${names.join(' or ')}`);
10
+ }
11
+ function optionalNumber(value, name) {
12
+ if (value === undefined || value === null)
13
+ return undefined;
14
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
15
+ throw new Error(`Task record has invalid ${name}`);
16
+ }
17
+ return value;
18
+ }
19
+ function taskStatus(record) {
20
+ const status = record.status;
21
+ if (status === 'running' ||
22
+ status === 'completed' ||
23
+ status === 'failed' ||
24
+ status === 'stopped') {
25
+ return status;
26
+ }
27
+ if (status === 'error')
28
+ return 'failed';
29
+ if (status === 'killed' || status === 'cancelled')
30
+ return 'stopped';
31
+ throw new Error('Task record has invalid status');
32
+ }
33
+ export function projectBackgroundBashTask(snapshot) {
34
+ return {
35
+ id: snapshot.taskId,
36
+ kind: 'shell',
37
+ status: snapshot.status,
38
+ label: snapshot.command,
39
+ command: snapshot.command,
40
+ output: snapshot.output,
41
+ startedAtMs: snapshot.startedAt,
42
+ ...(snapshot.durationMs === null
43
+ ? {}
44
+ : { durationMs: snapshot.durationMs }),
45
+ createdAtMs: snapshot.startedAt,
46
+ };
47
+ }
48
+ export function projectBackgroundAgentTask(snapshot) {
49
+ return {
50
+ id: snapshot.agentId,
51
+ kind: 'agent',
52
+ status: snapshot.status,
53
+ label: snapshot.name ?? snapshot.description,
54
+ output: snapshot.result?.text ?? snapshot.error ?? '',
55
+ startedAtMs: snapshot.startedAt,
56
+ ...(snapshot.durationMs === null
57
+ ? {}
58
+ : { durationMs: snapshot.durationMs }),
59
+ createdAtMs: snapshot.startedAt,
60
+ };
61
+ }
62
+ export function projectWorkflowTask(workflow) {
63
+ const record = workflow;
64
+ const result = record.result;
65
+ const error = typeof record.error === 'string' ? record.error : undefined;
66
+ const output = error ??
67
+ (typeof result === 'string'
68
+ ? result
69
+ : result === undefined || result === null
70
+ ? ''
71
+ : JSON.stringify(result, null, 2));
72
+ const startTime = optionalNumber(record.startTime ?? record.startedAt ?? record.started_at_ms, 'startTime');
73
+ const durationMs = optionalNumber(record.durationMs ?? record.duration_ms, 'durationMs');
74
+ return {
75
+ id: requiredString(record, ['task_id', 'taskId', 'id']),
76
+ kind: 'workflow',
77
+ status: taskStatus(record),
78
+ label: requiredString(record, [
79
+ 'summary',
80
+ 'description',
81
+ 'workflowName',
82
+ 'name',
83
+ ]),
84
+ output,
85
+ ...(startTime === undefined ? {} : { startedAtMs: startTime }),
86
+ ...(durationMs === undefined ? {} : { durationMs }),
87
+ createdAtMs: startTime ?? 0,
88
+ };
89
+ }
90
+ export function projectTuiTasks(input) {
91
+ return [
92
+ ...(input.shells ?? []).map(projectBackgroundBashTask),
93
+ ...(input.agents ?? []).map(projectBackgroundAgentTask),
94
+ ...(input.workflows ?? []).map(projectWorkflowTask),
95
+ ].sort((left, right) => right.createdAtMs - left.createdAtMs);
96
+ }
97
+ /** Preserve selection by task identity across polling and task reordering. */
98
+ export function reconcileTuiTaskPanelState(state, previousTasks, tasks) {
99
+ const selectedId = previousTasks[state.selectedIndex]?.id;
100
+ const selectedIndex = selectedId
101
+ ? tasks.findIndex(({ id }) => id === selectedId)
102
+ : -1;
103
+ if (tasks.length === 0) {
104
+ return { depth: 'list', selectedIndex: 0, scrollOffset: 0 };
105
+ }
106
+ if (selectedIndex >= 0)
107
+ return { ...state, selectedIndex };
108
+ return {
109
+ depth: state.depth === 'detail' ? 'list' : state.depth,
110
+ selectedIndex: Math.min(state.selectedIndex, tasks.length - 1),
111
+ scrollOffset: 0,
112
+ };
113
+ }
114
+ export function updateTuiTaskPanelState(state, tasks, action) {
115
+ if (tasks.length === 0)
116
+ return initialTuiTaskPanelState(tasks);
117
+ if (action.type === 'back') {
118
+ return { ...state, depth: 'list', scrollOffset: 0 };
119
+ }
120
+ if (action.type === 'open') {
121
+ return { ...state, depth: 'detail', scrollOffset: 0 };
122
+ }
123
+ if (action.type === 'scroll') {
124
+ if (state.depth !== 'detail')
125
+ return state;
126
+ return {
127
+ ...state,
128
+ scrollOffset: Math.max(0, state.scrollOffset + action.delta),
129
+ };
130
+ }
131
+ if (state.depth !== 'list')
132
+ return state;
133
+ return {
134
+ ...state,
135
+ selectedIndex: Math.min(tasks.length - 1, Math.max(0, state.selectedIndex + action.delta)),
136
+ };
137
+ }
138
+ export function initialTuiTaskPanelState(tasks) {
139
+ return {
140
+ depth: tasks.length === 1 ? 'detail' : 'list',
141
+ selectedIndex: 0,
142
+ scrollOffset: 0,
143
+ };
144
+ }
145
+ function taskRuntime(task, nowMs) {
146
+ const milliseconds = task.status === 'running' && task.startedAtMs !== undefined
147
+ ? Math.max(0, nowMs - task.startedAtMs)
148
+ : (task.durationMs ?? 0);
149
+ const seconds = Math.floor(milliseconds / 1_000);
150
+ const minutes = Math.floor(seconds / 60);
151
+ return minutes > 0 ? `${minutes}m ${seconds % 60}s` : `${seconds}s`;
152
+ }
153
+ function activeSummary(tasks) {
154
+ const active = tasks.filter(({ status }) => status === 'running');
155
+ const rows = active.length > 0 ? active : tasks;
156
+ const allShells = rows.every(({ kind }) => kind === 'shell');
157
+ const noun = allShells ? (rows.length === 1 ? 'shell' : 'shells') : 'tasks';
158
+ return `${rows.length} ${active.length > 0 ? 'active ' : ''}${noun}`;
159
+ }
160
+ function detailTitle(kind) {
161
+ switch (kind) {
162
+ case 'shell':
163
+ return 'Shell details';
164
+ case 'agent':
165
+ return 'Agent details';
166
+ case 'workflow':
167
+ return 'Workflow details';
168
+ }
169
+ }
170
+ export function TaskPanel({ tasks, state, nowMs = Date.now(), screenReader = false, width = 80, height = 24, }) {
171
+ const selectedIndex = Math.min(Math.max(0, state.selectedIndex), Math.max(0, tasks.length - 1));
172
+ const selected = tasks[selectedIndex];
173
+ const listCapacity = Math.max(1, height - 4);
174
+ let listStart = Math.min(Math.max(0, state.scrollOffset), Math.max(0, tasks.length - listCapacity));
175
+ if (selectedIndex < listStart)
176
+ listStart = selectedIndex;
177
+ if (selectedIndex >= listStart + listCapacity) {
178
+ listStart = selectedIndex - listCapacity + 1;
179
+ }
180
+ const visibleTasks = tasks.slice(listStart, listStart + listCapacity);
181
+ if (state.depth === 'detail' && selected) {
182
+ const canStop = selected.status === 'running';
183
+ const outputLines = (selected.output?.trim() || 'No output available').split('\n');
184
+ const outputHeight = Math.max(1, height - 8);
185
+ const scrollOffset = Math.min(Math.max(0, state.scrollOffset), Math.max(0, outputLines.length - outputHeight));
186
+ const visibleOutput = outputLines.slice(scrollOffset, scrollOffset + outputHeight);
187
+ const outputScrollable = outputLines.length > outputHeight;
188
+ return (_jsxs(Box, { flexDirection: "column", width: width, children: [_jsx(Text, { bold: true, children: detailTitle(selected.kind) }), _jsxs(Text, { children: ["Status: ", selected.status] }), _jsxs(Text, { children: ["Runtime: ", taskRuntime(selected, nowMs)] }), selected.kind === 'shell' ? (_jsxs(Text, { wrap: "truncate-end", children: ["Command: ", selected.command ?? selected.label] })) : (_jsxs(Text, { wrap: "truncate-end", children: ["Task: ", selected.label] })), _jsx(Text, { children: "Output:" }), visibleOutput.map((line, index) => (_jsx(Text, { wrap: "truncate-end", children: line }, `${scrollOffset + index}-${line}`))), _jsx(Text, { dimColor: true, children: width < 50
189
+ ? `${outputScrollable ? '↑/↓ scroll · ' : ''}← back${canStop ? ' · x stop' : ''}`
190
+ : `${outputScrollable ? '↑/↓ to scroll · ' : ''}← to go back · Esc/Enter/Space to close${canStop ? ' · x to stop' : ''}` })] }));
191
+ }
192
+ return (_jsxs(Box, { flexDirection: "column", width: width, children: [_jsx(Text, { bold: true, children: "Background" }), tasks.length === 0 ? (_jsx(Text, { children: "No tasks currently running" })) : (_jsxs(_Fragment, { children: [_jsx(Text, { children: activeSummary(tasks) }), visibleTasks.map((task, visibleIndex) => {
193
+ const index = listStart + visibleIndex;
194
+ const selectedRow = index === selectedIndex;
195
+ return (_jsxs(Text, { inverse: !screenReader && selectedRow, wrap: "truncate-end", children: [screenReader && selectedRow
196
+ ? 'Selected: '
197
+ : selectedRow
198
+ ? '❯ '
199
+ : ' ', task.label, " (", task.status, ")"] }, task.id));
200
+ })] })), _jsx(Text, { dimColor: true, children: width < 50
201
+ ? `↑/↓ select · Enter view${selected?.status === 'running' ? ' · x stop' : ''} · Esc`
202
+ : `↑/↓ to select · Enter to view${selected?.status === 'running' ? ' · x to stop' : ''} · Esc to close` })] }));
203
+ }
204
+ //# sourceMappingURL=task-panel.js.map
@@ -0,0 +1,10 @@
1
+ export type TuiNotificationChannel = 'auto' | 'iterm2' | 'terminal_bell' | 'iterm2_with_bell' | 'kitty' | 'ghostty' | 'notifications_disabled';
2
+ export type TuiNotificationWriter = (sequence: string) => void;
3
+ export declare function notifyTerminal(options: {
4
+ channel: TuiNotificationChannel;
5
+ title: string;
6
+ message: string;
7
+ environment?: Readonly<Record<string, string | undefined>>;
8
+ write?: TuiNotificationWriter;
9
+ }): void;
10
+ //# sourceMappingURL=terminal-notifications.d.ts.map
@@ -0,0 +1,48 @@
1
+ function terminalProgram(environment) {
2
+ const program = environment.TERM_PROGRAM?.toLowerCase();
3
+ if (program === 'iterm.app')
4
+ return 'iterm2';
5
+ if (program === 'ghostty')
6
+ return 'ghostty';
7
+ if (environment.KITTY_WINDOW_ID)
8
+ return 'kitty';
9
+ return undefined;
10
+ }
11
+ function escapeOsc(value) {
12
+ return [...value]
13
+ .filter((character) => {
14
+ const code = character.codePointAt(0) ?? 0;
15
+ return code !== 7 && code !== 27;
16
+ })
17
+ .join('');
18
+ }
19
+ function sequenceFor(channel, title, message) {
20
+ const text = escapeOsc(`${title}: ${message}`);
21
+ switch (channel) {
22
+ case 'iterm2':
23
+ return `\u001b]9;${text}\u0007`;
24
+ case 'terminal_bell':
25
+ return '\u0007';
26
+ case 'iterm2_with_bell':
27
+ return `\u001b]9;${text}\u0007\u0007`;
28
+ case 'kitty':
29
+ return `\u001b]99;i=1:d=0:p=title;${escapeOsc(title)}\u001b\\\u001b]99;i=1:d=1:p=body;${escapeOsc(message)}\u001b\\`;
30
+ case 'ghostty':
31
+ return `\u001b]9;${text}\u0007`;
32
+ case 'auto':
33
+ case 'notifications_disabled':
34
+ return undefined;
35
+ }
36
+ }
37
+ export function notifyTerminal(options) {
38
+ if (options.channel === 'notifications_disabled')
39
+ return;
40
+ const environment = options.environment ?? process.env;
41
+ const selected = options.channel === 'auto' ? terminalProgram(environment) : options.channel;
42
+ if (!selected)
43
+ return;
44
+ const sequence = sequenceFor(selected, options.title, options.message);
45
+ if (sequence)
46
+ (options.write ?? ((value) => process.stdout.write(value)))(sequence);
47
+ }
48
+ //# sourceMappingURL=terminal-notifications.js.map
@@ -0,0 +1,24 @@
1
+ import type { TuiSlashCommand } from './slash-commands.js';
2
+ type TerminalSetupRunner = (command: string, arguments_: readonly string[]) => Promise<{
3
+ exitCode: number;
4
+ stdout: string;
5
+ stderr: string;
6
+ }>;
7
+ export interface TuiTerminalSetupOptions {
8
+ environment?: Readonly<Record<string, string | undefined>>;
9
+ platform?: NodeJS.Platform;
10
+ homeDirectory?: string;
11
+ run?: TerminalSetupRunner;
12
+ }
13
+ type SetupTerminal = 'Apple_Terminal' | 'vscode' | 'cursor' | 'windsurf' | 'alacritty' | 'zed' | 'ghostty' | 'kitty' | 'iTerm.app' | 'WezTerm' | 'WarpTerminal' | string;
14
+ export declare function detectTuiTerminal(environment?: Readonly<Record<string, string | undefined>>): SetupTerminal | null;
15
+ export declare function nativeShiftEnterTerminalName(terminal: string | null): string | null;
16
+ export declare function terminalSetupTuiSlashCommand(environment?: Readonly<Record<string, string | undefined>>, platform?: NodeJS.Platform): TuiSlashCommand | null;
17
+ /**
18
+ * Diagnose or install the terminal-local newline binding used by the Claude
19
+ * compatible composer. This intentionally operates outside shared transcripts:
20
+ * terminal preferences belong to the local single-user machine.
21
+ */
22
+ export declare function setupTuiTerminal(options?: TuiTerminalSetupOptions): Promise<string>;
23
+ export {};
24
+ //# sourceMappingURL=terminal-setup.d.ts.map