praxis-agent 0.6.0 → 0.8.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 +10 -1
- 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 +44 -3
- package/dist/cli/interactive.js +1431 -189
- package/dist/cli/tui/claude-style.d.ts +41 -3
- package/dist/cli/tui/claude-style.js +227 -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/hook-settings.d.ts +33 -0
- package/dist/cli/tui/hook-settings.js +200 -0
- 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 +15 -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 +12 -0
- package/dist/cli.js +140 -21
- package/dist/compatibility/claude/schema.js +2 -0
- package/dist/compatibility/claude/shared-resources.d.ts +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.d.ts +1 -0
- package/dist/plugins/claude-plugin-runtime.js +60 -24
- 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/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
package/README.md
CHANGED
|
@@ -83,7 +83,8 @@ troubleshooting. Run `praxis --help` for the authoritative command surface.
|
|
|
83
83
|
restored active-branch conversation history, streaming and expandable
|
|
84
84
|
thinking, grouped multi-file reads, globally expandable tool results,
|
|
85
85
|
command-specific `/add-dir`, `/copy`, `/branch`, `/rename`, `/export`,
|
|
86
|
-
provider-
|
|
86
|
+
provider-free read-only shared `/hooks`, provider-backed `/compact`, native
|
|
87
|
+
`/rewind`, runtime `/cd`, transcript-free
|
|
87
88
|
`/btw` side questions with background-Agent handoff, interactive
|
|
88
89
|
`/background` terminal handoff, `/config`, `/usage`, `/mcp`, `/memory` shared
|
|
89
90
|
instruction and auto-memory access, and live extension-reload controls,
|
|
@@ -91,6 +92,14 @@ troubleshooting. Run `praxis --help` for the authoritative command surface.
|
|
|
91
92
|
context/status/skill/task dashboards, prompt stash and continuation shortcuts,
|
|
92
93
|
filterable `@` file and agent references, composer undo, `Ctrl+G` external
|
|
93
94
|
editing, shared `/keybindings` creation/editing and supported-action remapping,
|
|
95
|
+
shared built-in and Claude-compatible custom `/theme` profiles with immediate
|
|
96
|
+
semantic recoloring, token editing/reset, deletion, and persisted syntax
|
|
97
|
+
toggles across transcript code and diff views,
|
|
98
|
+
shared runtime preferences for reduced motion, spinner tips, progress and
|
|
99
|
+
turn-duration display, editor mode, recap, notifications, auto-update channel,
|
|
100
|
+
gitignore-aware file references, and configurable AskUserQuestion timeouts,
|
|
101
|
+
provider-free `/terminal-setup` diagnostics and repeatable Shift+Enter setup
|
|
102
|
+
for supported local terminals,
|
|
94
103
|
`Ctrl+V` text/image clipboard paste, `Ctrl+Z` shell suspension and `fg`
|
|
95
104
|
recovery, permission-gated `!` shell turns, navigable current/per-turn Git
|
|
96
105
|
diff views, rich decision panels, and measured context budgets; print mode,
|
|
@@ -30,6 +30,10 @@ export interface BackgroundAgentSnapshot {
|
|
|
30
30
|
outputFile: string;
|
|
31
31
|
result: BackgroundAgentRunResult | null;
|
|
32
32
|
error: string | null;
|
|
33
|
+
name: string | null;
|
|
34
|
+
description: string;
|
|
35
|
+
startedAt: number;
|
|
36
|
+
durationMs: number | null;
|
|
33
37
|
}
|
|
34
38
|
export declare class BackgroundAgentManager {
|
|
35
39
|
private readonly tasks;
|
|
@@ -39,6 +43,7 @@ export declare class BackgroundAgentManager {
|
|
|
39
43
|
registerCompleted(spec: BackgroundAgentTaskSpec, result: BackgroundAgentRunResult): BackgroundAgentSnapshot;
|
|
40
44
|
has(agentId: string): boolean;
|
|
41
45
|
snapshotById(agentId: string): BackgroundAgentSnapshot | null;
|
|
46
|
+
snapshots(): readonly BackgroundAgentSnapshot[];
|
|
42
47
|
output(agentId: string, options: {
|
|
43
48
|
block: boolean;
|
|
44
49
|
timeout: number;
|
|
@@ -62,6 +62,8 @@ export class BackgroundAgentManager {
|
|
|
62
62
|
notifications: [],
|
|
63
63
|
generation: 0,
|
|
64
64
|
queuedMessages: [],
|
|
65
|
+
startedAt: Date.now(),
|
|
66
|
+
durationMs: null,
|
|
65
67
|
};
|
|
66
68
|
this.tasks.set(spec.agentId, task);
|
|
67
69
|
this.start(task, spec.prompt, false, spec.toolUseId);
|
|
@@ -91,6 +93,8 @@ export class BackgroundAgentManager {
|
|
|
91
93
|
notifications: [],
|
|
92
94
|
generation: 0,
|
|
93
95
|
queuedMessages: [],
|
|
96
|
+
startedAt: Date.now() - result.durationMs,
|
|
97
|
+
durationMs: result.durationMs,
|
|
94
98
|
};
|
|
95
99
|
this.tasks.set(spec.agentId, task);
|
|
96
100
|
return this.snapshot(task);
|
|
@@ -102,6 +106,11 @@ export class BackgroundAgentManager {
|
|
|
102
106
|
const task = this.tasks.get(agentId);
|
|
103
107
|
return task ? this.snapshot(task) : null;
|
|
104
108
|
}
|
|
109
|
+
snapshots() {
|
|
110
|
+
return [...this.tasks.values()]
|
|
111
|
+
.sort((left, right) => right.startedAt - left.startedAt)
|
|
112
|
+
.map((task) => this.snapshot(task));
|
|
113
|
+
}
|
|
105
114
|
async output(agentId, options) {
|
|
106
115
|
agentId = this.resolveRequired(agentId);
|
|
107
116
|
if (!Number.isFinite(options.timeout) ||
|
|
@@ -132,6 +141,7 @@ export class BackgroundAgentManager {
|
|
|
132
141
|
}
|
|
133
142
|
task.status = 'stopped';
|
|
134
143
|
task.error = 'Stopped by TaskStop';
|
|
144
|
+
task.durationMs ??= Date.now() - task.startedAt;
|
|
135
145
|
task.queuedMessages.length = 0;
|
|
136
146
|
task.controller.abort();
|
|
137
147
|
return `Task ${agentId} stopped successfully`;
|
|
@@ -208,6 +218,8 @@ export class BackgroundAgentManager {
|
|
|
208
218
|
const generation = task.generation;
|
|
209
219
|
const controller = new AbortController();
|
|
210
220
|
task.status = 'running';
|
|
221
|
+
task.startedAt = Date.now();
|
|
222
|
+
task.durationMs = null;
|
|
211
223
|
task.controller = controller;
|
|
212
224
|
task.result = null;
|
|
213
225
|
task.error = null;
|
|
@@ -222,6 +234,7 @@ export class BackgroundAgentManager {
|
|
|
222
234
|
}
|
|
223
235
|
task.status = 'completed';
|
|
224
236
|
task.result = result;
|
|
237
|
+
task.durationMs = result.durationMs;
|
|
225
238
|
task.error = null;
|
|
226
239
|
task.notifications.push({
|
|
227
240
|
status: 'completed',
|
|
@@ -237,8 +250,11 @@ export class BackgroundAgentManager {
|
|
|
237
250
|
this.finishStopped(task, error instanceof BackgroundAgentRunError ? error.result : undefined);
|
|
238
251
|
return;
|
|
239
252
|
}
|
|
253
|
+
const failedResult = error instanceof BackgroundAgentRunError ? error.result : undefined;
|
|
240
254
|
task.status = 'failed';
|
|
241
255
|
task.result = null;
|
|
256
|
+
task.durationMs =
|
|
257
|
+
failedResult?.durationMs ?? Date.now() - task.startedAt;
|
|
242
258
|
task.error = error instanceof Error ? error.message : String(error);
|
|
243
259
|
task.notifications.push({
|
|
244
260
|
status: 'failed',
|
|
@@ -279,6 +295,7 @@ export class BackgroundAgentManager {
|
|
|
279
295
|
durationMs: 0,
|
|
280
296
|
};
|
|
281
297
|
task.result = stoppedResult;
|
|
298
|
+
task.durationMs ??= stoppedResult.durationMs || Date.now() - task.startedAt;
|
|
282
299
|
task.notifications.push({
|
|
283
300
|
status: 'stopped',
|
|
284
301
|
result: stoppedResult,
|
|
@@ -303,6 +320,10 @@ export class BackgroundAgentManager {
|
|
|
303
320
|
outputFile: task.spec.outputFile,
|
|
304
321
|
result: task.result,
|
|
305
322
|
error: task.error,
|
|
323
|
+
name: task.spec.name ?? null,
|
|
324
|
+
description: task.spec.description,
|
|
325
|
+
startedAt: task.startedAt,
|
|
326
|
+
durationMs: task.durationMs,
|
|
306
327
|
};
|
|
307
328
|
}
|
|
308
329
|
formatOutput(task) {
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import type { RuntimeEventSink } from '../core/runtime.js';
|
|
2
|
+
export type BackgroundBashStatus = 'running' | 'completed' | 'failed' | 'stopped';
|
|
3
|
+
export interface BackgroundBashSnapshot {
|
|
4
|
+
taskId: string;
|
|
5
|
+
status: BackgroundBashStatus;
|
|
6
|
+
command: string;
|
|
7
|
+
description: string;
|
|
8
|
+
outputFile: string;
|
|
9
|
+
output: string;
|
|
10
|
+
exitCode: number | null;
|
|
11
|
+
startedAt: number;
|
|
12
|
+
durationMs: number | null;
|
|
13
|
+
}
|
|
2
14
|
export interface BackgroundBashManagerOptions {
|
|
3
15
|
cwd: string;
|
|
4
16
|
cwdProvider?: () => string;
|
|
@@ -30,6 +42,7 @@ export declare class BackgroundBashManager {
|
|
|
30
42
|
private readonly sessionStateRoot;
|
|
31
43
|
constructor(options: BackgroundBashManagerOptions);
|
|
32
44
|
has(taskId: string): boolean;
|
|
45
|
+
snapshots(): Promise<readonly BackgroundBashSnapshot[]>;
|
|
33
46
|
launch(input: BackgroundBashLaunchInput): Promise<{
|
|
34
47
|
taskId: string;
|
|
35
48
|
outputFile: string;
|
|
@@ -50,5 +63,6 @@ export declare class BackgroundBashManager {
|
|
|
50
63
|
private resolveTask;
|
|
51
64
|
private hydratePersistedTasks;
|
|
52
65
|
private persist;
|
|
66
|
+
private snapshot;
|
|
53
67
|
}
|
|
54
68
|
//# sourceMappingURL=background-bash-manager.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
1
|
+
import { mkdir, readFile, readdir, stat, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { sanitizeClaudeProjectPath } from '../compatibility/claude/paths.js';
|
|
4
4
|
import { writeFileAtomically } from '../platform/atomic-write.js';
|
|
@@ -32,7 +32,15 @@ function parsePersistedTask(source, taskId, outputFile) {
|
|
|
32
32
|
!['completed', 'failed', 'stopped'].includes(String(task.status)) ||
|
|
33
33
|
typeof task.output !== 'string' ||
|
|
34
34
|
(task.exitCode !== null && !Number.isSafeInteger(task.exitCode)) ||
|
|
35
|
-
typeof task.notified !== 'boolean'
|
|
35
|
+
typeof task.notified !== 'boolean' ||
|
|
36
|
+
(task.startedAt !== undefined &&
|
|
37
|
+
(typeof task.startedAt !== 'number' ||
|
|
38
|
+
!Number.isSafeInteger(task.startedAt) ||
|
|
39
|
+
task.startedAt < 0)) ||
|
|
40
|
+
(task.durationMs !== undefined &&
|
|
41
|
+
(typeof task.durationMs !== 'number' ||
|
|
42
|
+
!Number.isSafeInteger(task.durationMs) ||
|
|
43
|
+
task.durationMs < 0))) {
|
|
36
44
|
return null;
|
|
37
45
|
}
|
|
38
46
|
return task;
|
|
@@ -63,6 +71,12 @@ export class BackgroundBashManager {
|
|
|
63
71
|
has(taskId) {
|
|
64
72
|
return this.tasks.has(taskId);
|
|
65
73
|
}
|
|
74
|
+
async snapshots() {
|
|
75
|
+
await this.hydratePersistedTasks();
|
|
76
|
+
return [...this.tasks.values()]
|
|
77
|
+
.sort((left, right) => right.startedAt - left.startedAt)
|
|
78
|
+
.map((task) => this.snapshot(task));
|
|
79
|
+
}
|
|
66
80
|
async launch(input) {
|
|
67
81
|
await Promise.all([
|
|
68
82
|
mkdir(this.outputRoot, { recursive: true }),
|
|
@@ -87,6 +101,7 @@ export class BackgroundBashManager {
|
|
|
87
101
|
controller,
|
|
88
102
|
completion: Promise.resolve(),
|
|
89
103
|
startedAt: Date.now(),
|
|
104
|
+
durationMs: null,
|
|
90
105
|
...(input.signal
|
|
91
106
|
? {
|
|
92
107
|
parentSignal: input.signal,
|
|
@@ -220,6 +235,7 @@ export class BackgroundBashManager {
|
|
|
220
235
|
task.exitCode = 1;
|
|
221
236
|
task.output = `Background task failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
222
237
|
}
|
|
238
|
+
task.durationMs = Date.now() - task.startedAt;
|
|
223
239
|
await writeFile(task.outputFile, task.output, { mode: 0o600 }).catch(() => undefined);
|
|
224
240
|
await this.persist(task).catch((persistError) => {
|
|
225
241
|
task.output = `${task.output}${task.output ? '\n' : ''}Failed to persist background task: ${persistError instanceof Error
|
|
@@ -260,6 +276,7 @@ export class BackgroundBashManager {
|
|
|
260
276
|
task.output = result.output;
|
|
261
277
|
task.exitCode = result.code;
|
|
262
278
|
task.status = result.code === 0 && !result.timedOut ? 'completed' : 'failed';
|
|
279
|
+
task.durationMs = Date.now() - task.startedAt;
|
|
263
280
|
}
|
|
264
281
|
outputResult(task, retrievalOverride) {
|
|
265
282
|
const retrievalStatus = retrievalOverride ?? (task.status === 'running' ? 'not_ready' : 'success');
|
|
@@ -299,14 +316,20 @@ export class BackgroundBashManager {
|
|
|
299
316
|
if (existing)
|
|
300
317
|
return existing;
|
|
301
318
|
try {
|
|
302
|
-
const
|
|
319
|
+
const stateFile = resolve(this.sessionStateRoot, `${taskId}.json`);
|
|
320
|
+
const [source, metadata] = await Promise.all([
|
|
321
|
+
readFile(stateFile, 'utf8'),
|
|
322
|
+
stat(stateFile),
|
|
323
|
+
]);
|
|
324
|
+
const state = parsePersistedTask(source, taskId, resolve(this.outputRoot, `${taskId}.output`));
|
|
303
325
|
if (!state)
|
|
304
326
|
return null;
|
|
305
327
|
const task = {
|
|
306
328
|
...state,
|
|
307
329
|
controller: new AbortController(),
|
|
308
330
|
completion: Promise.resolve(),
|
|
309
|
-
startedAt:
|
|
331
|
+
startedAt: state.startedAt ?? Math.floor(metadata.mtimeMs),
|
|
332
|
+
durationMs: state.durationMs ?? null,
|
|
310
333
|
};
|
|
311
334
|
this.tasks.set(taskId, task);
|
|
312
335
|
return task;
|
|
@@ -347,8 +370,23 @@ export class BackgroundBashManager {
|
|
|
347
370
|
output: task.output,
|
|
348
371
|
exitCode: task.exitCode,
|
|
349
372
|
notified: task.notified,
|
|
373
|
+
startedAt: task.startedAt,
|
|
374
|
+
...(task.durationMs === null ? {} : { durationMs: task.durationMs }),
|
|
350
375
|
};
|
|
351
376
|
await writeFileAtomically(resolve(this.sessionStateRoot, `${task.taskId}.json`), JSON.stringify(state, null, 2), { mode: 0o600 });
|
|
352
377
|
}
|
|
378
|
+
snapshot(task) {
|
|
379
|
+
return {
|
|
380
|
+
taskId: task.taskId,
|
|
381
|
+
status: task.status,
|
|
382
|
+
command: task.command,
|
|
383
|
+
description: task.description,
|
|
384
|
+
outputFile: task.outputFile,
|
|
385
|
+
output: task.output,
|
|
386
|
+
exitCode: task.exitCode,
|
|
387
|
+
startedAt: task.startedAt,
|
|
388
|
+
durationMs: task.durationMs,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
353
391
|
}
|
|
354
392
|
//# sourceMappingURL=background-bash-manager.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BackgroundAgentSnapshot } from './background-agent-manager.js';
|
|
2
|
+
import type { BackgroundBashSnapshot, BackgroundBashToolResult } from './background-bash-manager.js';
|
|
3
|
+
import type { WorkflowTaskSnapshot } from './workflow-manager.js';
|
|
4
|
+
export interface BackgroundTaskSnapshot {
|
|
5
|
+
shells: readonly BackgroundBashSnapshot[];
|
|
6
|
+
agents: readonly BackgroundAgentSnapshot[];
|
|
7
|
+
workflows: readonly WorkflowTaskSnapshot[];
|
|
8
|
+
}
|
|
9
|
+
export interface BackgroundBashTaskSource {
|
|
10
|
+
backgroundSnapshots(): Promise<readonly BackgroundBashSnapshot[]>;
|
|
11
|
+
stopBackgroundTask(taskId: string): Promise<BackgroundBashToolResult>;
|
|
12
|
+
}
|
|
13
|
+
export interface BackgroundAgentTaskSource {
|
|
14
|
+
backgroundSnapshots(): readonly BackgroundAgentSnapshot[];
|
|
15
|
+
stopBackgroundTask(taskId: string): string;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkflowTaskSource {
|
|
18
|
+
list(sessionId?: string): readonly WorkflowTaskSnapshot[];
|
|
19
|
+
hasForSession(sessionId: string, taskId: string): boolean;
|
|
20
|
+
stopAndWait(taskId: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/** Aggregates the actual task owners created across turns of one CLI session. */
|
|
23
|
+
export declare class BackgroundTaskRuntime {
|
|
24
|
+
private readonly workflows;
|
|
25
|
+
private readonly bashSources;
|
|
26
|
+
private readonly agentSources;
|
|
27
|
+
constructor(workflows: WorkflowTaskSource | null);
|
|
28
|
+
registerBash(sessionId: string, source: BackgroundBashTaskSource): void;
|
|
29
|
+
registerAgents(sessionId: string, source: BackgroundAgentTaskSource): void;
|
|
30
|
+
snapshot(sessionId: string): Promise<BackgroundTaskSnapshot>;
|
|
31
|
+
stop(sessionId: string, taskId: string): Promise<void>;
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=background-task-runtime.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function uniqueById(values, id) {
|
|
2
|
+
return [...new Map(values.map((value) => [id(value), value])).values()];
|
|
3
|
+
}
|
|
4
|
+
function addSource(sources, sessionId, value) {
|
|
5
|
+
const existing = sources.get(sessionId);
|
|
6
|
+
if (existing)
|
|
7
|
+
existing.add(value);
|
|
8
|
+
else
|
|
9
|
+
sources.set(sessionId, new Set([value]));
|
|
10
|
+
}
|
|
11
|
+
/** Aggregates the actual task owners created across turns of one CLI session. */
|
|
12
|
+
export class BackgroundTaskRuntime {
|
|
13
|
+
workflows;
|
|
14
|
+
bashSources = new Map();
|
|
15
|
+
agentSources = new Map();
|
|
16
|
+
constructor(workflows) {
|
|
17
|
+
this.workflows = workflows;
|
|
18
|
+
}
|
|
19
|
+
registerBash(sessionId, source) {
|
|
20
|
+
addSource(this.bashSources, sessionId, source);
|
|
21
|
+
}
|
|
22
|
+
registerAgents(sessionId, source) {
|
|
23
|
+
addSource(this.agentSources, sessionId, source);
|
|
24
|
+
}
|
|
25
|
+
async snapshot(sessionId) {
|
|
26
|
+
const shellGroups = await Promise.all([...(this.bashSources.get(sessionId) ?? [])].map((source) => source.backgroundSnapshots()));
|
|
27
|
+
return {
|
|
28
|
+
shells: uniqueById(shellGroups.flat(), ({ taskId }) => taskId),
|
|
29
|
+
agents: uniqueById([...(this.agentSources.get(sessionId) ?? [])].flatMap((source) => source.backgroundSnapshots()), ({ agentId }) => agentId),
|
|
30
|
+
workflows: uniqueById(this.workflows?.list(sessionId) ?? [], ({ task_id: taskId }) => taskId),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async stop(sessionId, taskId) {
|
|
34
|
+
for (const source of this.bashSources.get(sessionId) ?? []) {
|
|
35
|
+
if (!(await source.backgroundSnapshots()).some(({ taskId: id }) => id === taskId)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
await source.stopBackgroundTask(taskId);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
for (const source of this.agentSources.get(sessionId) ?? []) {
|
|
42
|
+
if (!source.backgroundSnapshots().some(({ agentId }) => agentId === taskId)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
source.stopBackgroundTask(taskId);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.workflows?.hasForSession(sessionId, taskId)) {
|
|
49
|
+
await this.workflows.stopAndWait(taskId);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`No task found with ID: ${taskId}`);
|
|
53
|
+
}
|
|
54
|
+
clear() {
|
|
55
|
+
this.bashSources.clear();
|
|
56
|
+
this.agentSources.clear();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=background-task-runtime.js.map
|
|
@@ -2,6 +2,7 @@ import type { ClaudeConditionalRuleResolver } from '../compatibility/claude/cont
|
|
|
2
2
|
import { type ClaudeFileResource, type ClaudeFileResourceConfig } from '../compatibility/claude/file-resources.js';
|
|
3
3
|
import { type ClaudeDisplayTranscriptItem } from '../compatibility/claude/projection.js';
|
|
4
4
|
import { type ModelDocument, type ModelImage, type ModelToolCall, type ModelProvider, type ModelUsage, type PermissionApproval, type PermissionResolver, type RuntimeEventSink, type ToolRegistry } from '../core/runtime.js';
|
|
5
|
+
import { type BackgroundTaskSnapshot } from './background-task-runtime.js';
|
|
5
6
|
import type { ModelPricingRegistry } from '../core/usage.js';
|
|
6
7
|
import type { Compactor } from '../core/compaction.js';
|
|
7
8
|
import { ContextBudget } from '../core/context-budget.js';
|
|
@@ -10,9 +11,11 @@ import type { ClaudeExtensionCatalog } from '../extensions/claude-extensions.js'
|
|
|
10
11
|
import type { ClaudeHookRunner } from '../hooks/claude-hooks.js';
|
|
11
12
|
import { type TranscriptParseIssue } from '../persistence/claude-transcript-store.js';
|
|
12
13
|
import { type AgentPermissionMode } from './subagent-service.js';
|
|
14
|
+
import { type WorkflowTaskSnapshot } from './workflow-manager.js';
|
|
13
15
|
import type { WorkspaceContext } from './session-worktree.js';
|
|
14
16
|
import type { ClaudeInteractiveToolManager } from '../tools/claude-interactive-tools.js';
|
|
15
17
|
import type { ClaudePermissionMode } from '../permissions/claude-permission-resolver.js';
|
|
18
|
+
import type { ClaudeMcpRuntime, ClaudeMcpServerStatus, ClaudeMcpToolInspection } from '../mcp/claude-mcp-tools.js';
|
|
16
19
|
export interface ClaudeSessionServiceOptions {
|
|
17
20
|
configRoot: string;
|
|
18
21
|
cwd: string;
|
|
@@ -55,11 +58,15 @@ export interface ClaudeSessionServiceOptions {
|
|
|
55
58
|
initialWorktreeName?: string;
|
|
56
59
|
enableWorktrees?: boolean;
|
|
57
60
|
worktreeToolNames?: readonly ('EnterWorktree' | 'ExitWorktree')[];
|
|
61
|
+
worktreeBaseRef?: 'fresh' | 'head';
|
|
58
62
|
fileResources?: readonly ClaudeFileResource[];
|
|
59
63
|
fileResourceConfig?: Omit<ClaudeFileResourceConfig, 'sessionId' | 'signal'>;
|
|
60
64
|
fileCheckpointing?: boolean;
|
|
65
|
+
/** Disable only automatic context compaction; manual /compact remains available. */
|
|
66
|
+
autoCompact?: boolean;
|
|
61
67
|
fileRewindRoots?: readonly string[];
|
|
62
68
|
interactiveTools?: ClaudeInteractiveToolManager;
|
|
69
|
+
mcp?: ClaudeMcpRuntime;
|
|
63
70
|
}
|
|
64
71
|
export interface SessionRunResult {
|
|
65
72
|
sessionId: string;
|
|
@@ -133,16 +140,26 @@ export declare class ClaudeSessionService {
|
|
|
133
140
|
private readonly inMemoryStores;
|
|
134
141
|
private readonly scheduledPrompts;
|
|
135
142
|
private readonly workflowManager;
|
|
143
|
+
private readonly backgroundTasks;
|
|
136
144
|
private readonly worktreeManager;
|
|
137
145
|
private readonly sessionCwds;
|
|
138
146
|
private readonly hostedSubagents;
|
|
139
147
|
private readonly hostedSubagentsByRegistry;
|
|
140
148
|
private readonly backgroundNotificationWrites;
|
|
141
149
|
private readonly downloadedFileResourceSessions;
|
|
150
|
+
private mcpClosePromise;
|
|
142
151
|
private runtimeCwd;
|
|
143
152
|
constructor(options: ClaudeSessionServiceOptions);
|
|
144
153
|
nextScheduledPrompt(signal?: AbortSignal): Promise<import("./scheduled-prompt-manager.js").ScheduledPrompt | null>;
|
|
145
|
-
workflows(): readonly
|
|
154
|
+
workflows(): readonly WorkflowTaskSnapshot[];
|
|
155
|
+
mcpInspect(): Promise<readonly ClaudeMcpServerStatus[]>;
|
|
156
|
+
mcpReconnect(name: string): Promise<void>;
|
|
157
|
+
mcpAuthenticate(name: string): Promise<void>;
|
|
158
|
+
mcpReload(): Promise<void>;
|
|
159
|
+
mcpTools(name: string): Promise<readonly ClaudeMcpToolInspection[]>;
|
|
160
|
+
private requireMcp;
|
|
161
|
+
taskSnapshots(sessionId: string): Promise<BackgroundTaskSnapshot>;
|
|
162
|
+
stopTask(sessionId: string, taskId: string): Promise<void>;
|
|
146
163
|
close(): Promise<void>;
|
|
147
164
|
createHostedToolRegistry(sessionId: string): ToolRegistry;
|
|
148
165
|
run(prompt: string, signal?: AbortSignal, sessionId?: string, name?: string, images?: readonly ModelImage[], documents?: readonly ModelDocument[]): Promise<SessionRunResult>;
|
|
@@ -160,6 +177,8 @@ export declare class ClaudeSessionService {
|
|
|
160
177
|
rename(sessionId: string, name: string): Promise<void>;
|
|
161
178
|
changeCwd(sessionId: string | undefined, requestedCwd: string): Promise<string>;
|
|
162
179
|
recordCdUsage(sessionId: string): Promise<void>;
|
|
180
|
+
approveRecentlyDenied(sessionId: string, display: string): Promise<void>;
|
|
181
|
+
retryRecentlyDenied(sessionId: string, display: string, signal?: AbortSignal): Promise<SessionRunResult>;
|
|
163
182
|
recordBtwUsage(sessionId: string | undefined, permissionMode?: ClaudePermissionMode): Promise<string>;
|
|
164
183
|
recordBackgroundUsage(sessionId: string | undefined, permissionMode?: ClaudePermissionMode): Promise<string>;
|
|
165
184
|
recordBackgroundLaunch(sessionId: string): Promise<SessionForkCheckpoint>;
|
|
@@ -188,6 +207,7 @@ export declare class ClaudeSessionService {
|
|
|
188
207
|
private appendSystemLocalCommand;
|
|
189
208
|
private ensureLocalSession;
|
|
190
209
|
private appendInputHistory;
|
|
210
|
+
private appendPermissionGrant;
|
|
191
211
|
private appendBackgroundNotification;
|
|
192
212
|
private enqueueBackgroundNotifications;
|
|
193
213
|
private cdCommandEntries;
|