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.
- package/README.md +8 -0
- package/dist/application/background-agent-manager.d.ts +5 -0
- package/dist/application/background-agent-manager.js +21 -0
- package/dist/application/background-bash-manager.d.ts +14 -0
- package/dist/application/background-bash-manager.js +42 -4
- package/dist/application/background-task-runtime.d.ts +34 -0
- package/dist/application/background-task-runtime.js +59 -0
- package/dist/application/session-service.d.ts +21 -1
- package/dist/application/session-service.js +188 -17
- package/dist/application/session-worktree.d.ts +1 -0
- package/dist/application/session-worktree.js +13 -2
- package/dist/application/subagent-service.d.ts +3 -0
- package/dist/application/subagent-service.js +6 -0
- package/dist/application/workflow-manager.d.ts +70 -2
- package/dist/application/workflow-manager.js +21 -4
- package/dist/cli/agents-dashboard.d.ts +9 -0
- package/dist/cli/agents-dashboard.js +16 -5
- package/dist/cli/interactive.d.ts +41 -3
- package/dist/cli/interactive.js +1281 -183
- package/dist/cli/tui/claude-style.d.ts +31 -3
- package/dist/cli/tui/claude-style.js +171 -54
- package/dist/cli/tui/config-dashboard.d.ts +63 -0
- package/dist/cli/tui/config-dashboard.js +150 -0
- package/dist/cli/tui/config-settings.d.ts +32 -0
- package/dist/cli/tui/config-settings.js +276 -0
- package/dist/cli/tui/custom-themes.d.ts +21 -0
- package/dist/cli/tui/custom-themes.js +284 -0
- package/dist/cli/tui/file-picker.d.ts +3 -1
- package/dist/cli/tui/file-picker.js +8 -2
- package/dist/cli/tui/keybindings.js +0 -1
- package/dist/cli/tui/mcp-panel-controller.d.ts +32 -0
- package/dist/cli/tui/mcp-panel-controller.js +80 -0
- package/dist/cli/tui/mcp-panel-projector.d.ts +79 -0
- package/dist/cli/tui/mcp-panel-projector.js +181 -0
- package/dist/cli/tui/mcp-panel.d.ts +8 -0
- package/dist/cli/tui/mcp-panel.js +99 -0
- package/dist/cli/tui/recently-denied.d.ts +15 -0
- package/dist/cli/tui/recently-denied.js +19 -0
- package/dist/cli/tui/runtime-interactions.d.ts +17 -0
- package/dist/cli/tui/runtime-interactions.js +100 -0
- package/dist/cli/tui/runtime-settings.d.ts +40 -0
- package/dist/cli/tui/runtime-settings.js +84 -0
- package/dist/cli/tui/slash-commands.js +10 -0
- package/dist/cli/tui/task-panel.d.ts +53 -0
- package/dist/cli/tui/task-panel.js +204 -0
- package/dist/cli/tui/terminal-notifications.d.ts +10 -0
- package/dist/cli/tui/terminal-notifications.js +48 -0
- package/dist/cli/tui/terminal-setup.d.ts +24 -0
- package/dist/cli/tui/terminal-setup.js +618 -0
- package/dist/cli/tui/theme-settings.d.ts +8 -0
- package/dist/cli/tui/theme-settings.js +132 -0
- package/dist/cli/tui/theme.d.ts +53 -0
- package/dist/cli/tui/theme.js +265 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +97 -17
- package/dist/compatibility/claude/schema.js +2 -0
- package/dist/core/runtime.d.ts +12 -0
- package/dist/core/runtime.js +24 -0
- package/dist/maintenance/self-update.js +1 -1
- package/dist/mcp/claude-mcp-management.d.ts +6 -1
- package/dist/mcp/claude-mcp-management.js +191 -44
- package/dist/mcp/claude-mcp-oauth.js +2 -0
- package/dist/mcp/claude-mcp-tools.d.ts +31 -3
- package/dist/mcp/claude-mcp-tools.js +116 -34
- package/dist/permissions/claude-permission-resolver.d.ts +3 -0
- package/dist/permissions/claude-permission-resolver.js +42 -20
- package/dist/platform/claude-version.js +2 -1
- package/dist/plugins/claude-plugin-runtime.js +11 -3
- package/dist/tools/claude-interactive-tools.d.ts +7 -0
- package/dist/tools/claude-interactive-tools.js +21 -8
- package/dist/tools/claude-task-tools.d.ts +4 -0
- package/dist/tools/claude-task-tools.js +7 -0
- package/package.json +2 -1
- package/dist/application/background-agent-manager.d.ts.map +0 -1
- package/dist/application/background-agent-manager.js.map +0 -1
- package/dist/application/background-bash-manager.d.ts.map +0 -1
- package/dist/application/background-bash-manager.js.map +0 -1
- package/dist/application/background-task-id.d.ts.map +0 -1
- package/dist/application/background-task-id.js.map +0 -1
- package/dist/application/claude-project-purge.d.ts.map +0 -1
- package/dist/application/claude-project-purge.js.map +0 -1
- package/dist/application/managed-worktree.d.ts.map +0 -1
- package/dist/application/managed-worktree.js.map +0 -1
- package/dist/application/model-compactor.d.ts.map +0 -1
- package/dist/application/model-compactor.js.map +0 -1
- package/dist/application/scheduled-prompt-manager.d.ts.map +0 -1
- package/dist/application/scheduled-prompt-manager.js.map +0 -1
- package/dist/application/session-service.d.ts.map +0 -1
- package/dist/application/session-service.js.map +0 -1
- package/dist/application/session-worktree.d.ts.map +0 -1
- package/dist/application/session-worktree.js.map +0 -1
- package/dist/application/subagent-service.d.ts.map +0 -1
- package/dist/application/subagent-service.js.map +0 -1
- package/dist/application/tool-use-summary.d.ts.map +0 -1
- package/dist/application/tool-use-summary.js.map +0 -1
- package/dist/application/top-level-agent-manager.d.ts.map +0 -1
- package/dist/application/top-level-agent-manager.js.map +0 -1
- package/dist/application/workflow-manager.d.ts.map +0 -1
- package/dist/application/workflow-manager.js.map +0 -1
- package/dist/application/workflow-meta.d.ts.map +0 -1
- package/dist/application/workflow-meta.js.map +0 -1
- package/dist/application/workflow-runtime.d.ts.map +0 -1
- package/dist/application/workflow-runtime.js.map +0 -1
- package/dist/application/workflow-worktree.d.ts.map +0 -1
- package/dist/application/workflow-worktree.js.map +0 -1
- package/dist/cli/agents-dashboard.d.ts.map +0 -1
- package/dist/cli/agents-dashboard.js.map +0 -1
- package/dist/cli/controls.d.ts.map +0 -1
- package/dist/cli/controls.js.map +0 -1
- package/dist/cli/debug.d.ts.map +0 -1
- package/dist/cli/debug.js.map +0 -1
- package/dist/cli/interactive.d.ts.map +0 -1
- package/dist/cli/interactive.js.map +0 -1
- package/dist/cli/protocol.d.ts.map +0 -1
- package/dist/cli/protocol.js.map +0 -1
- package/dist/cli/tui/claude-style.d.ts.map +0 -1
- package/dist/cli/tui/claude-style.js.map +0 -1
- package/dist/cli/tui/clipboard.d.ts.map +0 -1
- package/dist/cli/tui/clipboard.js.map +0 -1
- package/dist/cli/tui/composer-editor.d.ts.map +0 -1
- package/dist/cli/tui/composer-editor.js.map +0 -1
- package/dist/cli/tui/composer-images.d.ts.map +0 -1
- package/dist/cli/tui/composer-images.js.map +0 -1
- package/dist/cli/tui/conversation-export.d.ts.map +0 -1
- package/dist/cli/tui/conversation-export.js.map +0 -1
- package/dist/cli/tui/external-editor.d.ts.map +0 -1
- package/dist/cli/tui/external-editor.js.map +0 -1
- package/dist/cli/tui/file-picker.d.ts.map +0 -1
- package/dist/cli/tui/file-picker.js.map +0 -1
- package/dist/cli/tui/git-diff.d.ts.map +0 -1
- package/dist/cli/tui/git-diff.js.map +0 -1
- package/dist/cli/tui/hook-settings.d.ts.map +0 -1
- package/dist/cli/tui/hook-settings.js.map +0 -1
- package/dist/cli/tui/keybindings.d.ts.map +0 -1
- package/dist/cli/tui/keybindings.js.map +0 -1
- package/dist/cli/tui/memory-files.d.ts.map +0 -1
- package/dist/cli/tui/memory-files.js.map +0 -1
- package/dist/cli/tui/permission-settings.d.ts.map +0 -1
- package/dist/cli/tui/permission-settings.js.map +0 -1
- package/dist/cli/tui/slash-commands.d.ts.map +0 -1
- package/dist/cli/tui/slash-commands.js.map +0 -1
- package/dist/cli/tui/terminal-suspend.d.ts.map +0 -1
- package/dist/cli/tui/terminal-suspend.js.map +0 -1
- package/dist/cli/tui/workspace-directories.d.ts.map +0 -1
- package/dist/cli/tui/workspace-directories.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/compatibility/claude/compaction.d.ts.map +0 -1
- package/dist/compatibility/claude/compaction.js.map +0 -1
- package/dist/compatibility/claude/context.d.ts.map +0 -1
- package/dist/compatibility/claude/context.js.map +0 -1
- package/dist/compatibility/claude/dynamic-context.d.ts.map +0 -1
- package/dist/compatibility/claude/dynamic-context.js.map +0 -1
- package/dist/compatibility/claude/file-history.d.ts.map +0 -1
- package/dist/compatibility/claude/file-history.js.map +0 -1
- package/dist/compatibility/claude/file-resources.d.ts.map +0 -1
- package/dist/compatibility/claude/file-resources.js.map +0 -1
- package/dist/compatibility/claude/fork.d.ts.map +0 -1
- package/dist/compatibility/claude/fork.js.map +0 -1
- package/dist/compatibility/claude/history.d.ts.map +0 -1
- package/dist/compatibility/claude/history.js.map +0 -1
- package/dist/compatibility/claude/ownership.d.ts.map +0 -1
- package/dist/compatibility/claude/ownership.js.map +0 -1
- package/dist/compatibility/claude/paths.d.ts.map +0 -1
- package/dist/compatibility/claude/paths.js.map +0 -1
- package/dist/compatibility/claude/pr-links.d.ts.map +0 -1
- package/dist/compatibility/claude/pr-links.js.map +0 -1
- package/dist/compatibility/claude/projection.d.ts.map +0 -1
- package/dist/compatibility/claude/projection.js.map +0 -1
- package/dist/compatibility/claude/schema.d.ts.map +0 -1
- package/dist/compatibility/claude/schema.js.map +0 -1
- package/dist/compatibility/claude/shared-resources.d.ts.map +0 -1
- package/dist/compatibility/claude/shared-resources.js.map +0 -1
- package/dist/compatibility/claude/sidechain.d.ts.map +0 -1
- package/dist/compatibility/claude/sidechain.js.map +0 -1
- package/dist/compatibility/claude/tool-links.d.ts.map +0 -1
- package/dist/compatibility/claude/tool-links.js.map +0 -1
- package/dist/compatibility/claude/translation.d.ts.map +0 -1
- package/dist/compatibility/claude/translation.js.map +0 -1
- package/dist/compatibility/claude/workflow-replay.d.ts.map +0 -1
- package/dist/compatibility/claude/workflow-replay.js.map +0 -1
- package/dist/compatibility/claude/workflow.d.ts.map +0 -1
- package/dist/compatibility/claude/workflow.js.map +0 -1
- package/dist/core/compaction.d.ts.map +0 -1
- package/dist/core/compaction.js.map +0 -1
- package/dist/core/context-budget.d.ts.map +0 -1
- package/dist/core/context-budget.js.map +0 -1
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/context.js.map +0 -1
- package/dist/core/runtime.d.ts.map +0 -1
- package/dist/core/runtime.js.map +0 -1
- package/dist/core/usage.d.ts.map +0 -1
- package/dist/core/usage.js.map +0 -1
- package/dist/extensions/claude-extension-tools.d.ts.map +0 -1
- package/dist/extensions/claude-extension-tools.js.map +0 -1
- package/dist/extensions/claude-extensions.d.ts.map +0 -1
- package/dist/extensions/claude-extensions.js.map +0 -1
- package/dist/hooks/claude-hook-tools.d.ts.map +0 -1
- package/dist/hooks/claude-hook-tools.js.map +0 -1
- package/dist/hooks/claude-hooks.d.ts.map +0 -1
- package/dist/hooks/claude-hooks.js.map +0 -1
- package/dist/maintenance/doctor.d.ts.map +0 -1
- package/dist/maintenance/doctor.js.map +0 -1
- package/dist/maintenance/self-update.d.ts.map +0 -1
- package/dist/maintenance/self-update.js.map +0 -1
- package/dist/mcp/claude-mcp-management.d.ts.map +0 -1
- package/dist/mcp/claude-mcp-management.js.map +0 -1
- package/dist/mcp/claude-mcp-oauth.d.ts.map +0 -1
- package/dist/mcp/claude-mcp-oauth.js.map +0 -1
- package/dist/mcp/claude-mcp-tools.d.ts.map +0 -1
- package/dist/mcp/claude-mcp-tools.js.map +0 -1
- package/dist/mcp/praxis-mcp-server.d.ts.map +0 -1
- package/dist/mcp/praxis-mcp-server.js.map +0 -1
- package/dist/permissions/claude-auto-classifier.d.ts.map +0 -1
- package/dist/permissions/claude-auto-classifier.js.map +0 -1
- package/dist/permissions/claude-permission-resolver.d.ts.map +0 -1
- package/dist/permissions/claude-permission-resolver.js.map +0 -1
- package/dist/persistence/claude-job-store.d.ts.map +0 -1
- package/dist/persistence/claude-job-store.js.map +0 -1
- package/dist/persistence/claude-scheduled-task-store.d.ts.map +0 -1
- package/dist/persistence/claude-scheduled-task-store.js.map +0 -1
- package/dist/persistence/claude-sidechain-store.d.ts.map +0 -1
- package/dist/persistence/claude-sidechain-store.js.map +0 -1
- package/dist/persistence/claude-task-store.d.ts.map +0 -1
- package/dist/persistence/claude-task-store.js.map +0 -1
- package/dist/persistence/claude-transcript-store.d.ts.map +0 -1
- package/dist/persistence/claude-transcript-store.js.map +0 -1
- package/dist/persistence/claude-workflow-store.d.ts.map +0 -1
- package/dist/persistence/claude-workflow-store.js.map +0 -1
- package/dist/persistence/in-memory-sidechain-store.d.ts.map +0 -1
- package/dist/persistence/in-memory-sidechain-store.js.map +0 -1
- package/dist/persistence/in-memory-transcript-store.d.ts.map +0 -1
- package/dist/persistence/in-memory-transcript-store.js.map +0 -1
- package/dist/platform/atomic-write.d.ts.map +0 -1
- package/dist/platform/atomic-write.js.map +0 -1
- package/dist/platform/bounded-process-runner.d.ts.map +0 -1
- package/dist/platform/bounded-process-runner.js.map +0 -1
- package/dist/platform/claude-version.d.ts.map +0 -1
- package/dist/platform/claude-version.js.map +0 -1
- package/dist/platform/command-shell.d.ts.map +0 -1
- package/dist/platform/command-shell.js.map +0 -1
- package/dist/platform/exclusive-file-lease.d.ts.map +0 -1
- package/dist/platform/exclusive-file-lease.js.map +0 -1
- package/dist/platform/sensitive-data.d.ts.map +0 -1
- package/dist/platform/sensitive-data.js.map +0 -1
- package/dist/platform/tmux-worktree.d.ts.map +0 -1
- package/dist/platform/tmux-worktree.js.map +0 -1
- package/dist/plugins/claude-plugin-eval-discovery.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-eval-discovery.js.map +0 -1
- package/dist/plugins/claude-plugin-eval-graders.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-eval-graders.js.map +0 -1
- package/dist/plugins/claude-plugin-eval-runner.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-eval-runner.js.map +0 -1
- package/dist/plugins/claude-plugin-eval-schema.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-eval-schema.js.map +0 -1
- package/dist/plugins/claude-plugin-eval.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-eval.js.map +0 -1
- package/dist/plugins/claude-plugin-maintenance.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-maintenance.js.map +0 -1
- package/dist/plugins/claude-plugin-marketplace.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-marketplace.js.map +0 -1
- package/dist/plugins/claude-plugin-mcpb.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-mcpb.js.map +0 -1
- package/dist/plugins/claude-plugin-runtime.d.ts.map +0 -1
- package/dist/plugins/claude-plugin-runtime.js.map +0 -1
- package/dist/providers/anthropic-compatible.d.ts.map +0 -1
- package/dist/providers/anthropic-compatible.js.map +0 -1
- package/dist/providers/environment.d.ts.map +0 -1
- package/dist/providers/environment.js.map +0 -1
- package/dist/providers/fallback-provider.d.ts.map +0 -1
- package/dist/providers/fallback-provider.js.map +0 -1
- package/dist/providers/openai-compatible.d.ts.map +0 -1
- package/dist/providers/openai-compatible.js.map +0 -1
- package/dist/tools/claude-interactive-tools.d.ts.map +0 -1
- package/dist/tools/claude-interactive-tools.js.map +0 -1
- package/dist/tools/claude-lsp-formatters.d.ts.map +0 -1
- package/dist/tools/claude-lsp-formatters.js.map +0 -1
- package/dist/tools/claude-lsp-tool.d.ts.map +0 -1
- package/dist/tools/claude-lsp-tool.js.map +0 -1
- package/dist/tools/claude-scheduled-tools.d.ts.map +0 -1
- package/dist/tools/claude-scheduled-tools.js.map +0 -1
- package/dist/tools/claude-task-tools.d.ts.map +0 -1
- package/dist/tools/claude-task-tools.js.map +0 -1
- package/dist/tools/claude-user-message.d.ts.map +0 -1
- package/dist/tools/claude-user-message.js.map +0 -1
- package/dist/tools/claude-workflow-tools.d.ts.map +0 -1
- package/dist/tools/claude-workflow-tools.js.map +0 -1
- package/dist/tools/claude-worktree-tools.d.ts.map +0 -1
- package/dist/tools/claude-worktree-tools.js.map +0 -1
- package/dist/tools/filtered-tool-registry.d.ts.map +0 -1
- package/dist/tools/filtered-tool-registry.js.map +0 -1
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js.map +0 -1
- package/dist/tools/local-tools.d.ts.map +0 -1
- package/dist/tools/local-tools.js.map +0 -1
- package/dist/tools/notebook.d.ts.map +0 -1
- package/dist/tools/notebook.js.map +0 -1
- package/dist/tools/pdf.d.ts.map +0 -1
- package/dist/tools/pdf.js.map +0 -1
- package/dist/tools/web.d.ts.map +0 -1
- 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
|