@esso0428/pi-subagents 0.17.16 → 0.17.17
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/CHANGELOG.md +6 -0
- package/ROADMAP.md +87 -0
- package/docs/post-0.17.6-agents-roster-viewer-spec.md +42 -0
- package/docs/post-0.17.6-durable-history-spec.md +41 -0
- package/docs/post-0.17.6-feature-specs.md +50 -0
- package/docs/post-0.17.6-nested-agents-spec.md +38 -0
- package/docs/post-0.17.6-recovery-shutdown-spec.md +46 -0
- package/docs/post-0.17.6-ui-latency-baseline-spec.md +46 -0
- package/docs/post-0.17.6-workflow-rpc-lifecycle-spec.md +54 -0
- package/package.json +1 -1
- package/src/agent-history.ts +2 -54
- package/src/agent-manager.ts +406 -1288
- package/src/agent-runner.ts +27 -251
- package/src/agent-types.ts +32 -188
- package/src/cross-extension-rpc.ts +20 -96
- package/src/custom-agents.ts +13 -170
- package/src/index.ts +480 -1920
- package/src/invocation-config.ts +3 -118
- package/src/model-resolver.ts +0 -18
- package/src/output-file.ts +6 -61
- package/src/prompts.ts +2 -45
- package/src/schedule.ts +14 -35
- package/src/settings.ts +2 -301
- package/src/status-note.ts +1 -66
- package/src/types.ts +10 -177
- package/src/ui/agent-widget.ts +57 -278
- package/src/ui/conversation-blocks.ts +0 -6
- package/src/ui/conversation-timeline.ts +25 -139
- package/src/ui/conversation-viewer.ts +48 -212
- package/src/ui/schedule-menu.ts +8 -9
- package/src/usage.ts +2 -109
- package/src/worktree.ts +55 -69
- package/dist/abortable.d.ts +0 -13
- package/dist/abortable.d.ts.map +0 -1
- package/dist/abortable.js +0 -43
- package/dist/abortable.js.map +0 -1
- package/dist/agent-color.d.ts +0 -36
- package/dist/agent-color.d.ts.map +0 -1
- package/dist/agent-color.js +0 -124
- package/dist/agent-color.js.map +0 -1
- package/dist/agent-file-toggle.d.ts +0 -126
- package/dist/agent-file-toggle.d.ts.map +0 -1
- package/dist/agent-file-toggle.js +0 -259
- package/dist/agent-file-toggle.js.map +0 -1
- package/dist/agent-history-list.d.ts +0 -19
- package/dist/agent-history-list.d.ts.map +0 -1
- package/dist/agent-history-list.js +0 -69
- package/dist/agent-history-list.js.map +0 -1
- package/dist/agent-history.d.ts +0 -35
- package/dist/agent-history.d.ts.map +0 -1
- package/dist/agent-history.js +0 -188
- package/dist/agent-history.js.map +0 -1
- package/dist/agent-manager.d.ts +0 -503
- package/dist/agent-manager.d.ts.map +0 -1
- package/dist/agent-manager.js +0 -1572
- package/dist/agent-manager.js.map +0 -1
- package/dist/agent-recovery.d.ts +0 -37
- package/dist/agent-recovery.d.ts.map +0 -1
- package/dist/agent-recovery.js +0 -171
- package/dist/agent-recovery.js.map +0 -1
- package/dist/agent-runner.d.ts +0 -303
- package/dist/agent-runner.d.ts.map +0 -1
- package/dist/agent-runner.js +0 -1003
- package/dist/agent-runner.js.map +0 -1
- package/dist/agent-types.d.ts +0 -120
- package/dist/agent-types.d.ts.map +0 -1
- package/dist/agent-types.js +0 -301
- package/dist/agent-types.js.map +0 -1
- package/dist/child-context.d.ts +0 -3
- package/dist/child-context.d.ts.map +0 -1
- package/dist/child-context.js +0 -13
- package/dist/child-context.js.map +0 -1
- package/dist/context.d.ts +0 -13
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -57
- package/dist/context.js.map +0 -1
- package/dist/cross-extension-rpc.d.ts +0 -67
- package/dist/cross-extension-rpc.d.ts.map +0 -1
- package/dist/cross-extension-rpc.js +0 -139
- package/dist/cross-extension-rpc.js.map +0 -1
- package/dist/custom-agents.d.ts +0 -55
- package/dist/custom-agents.d.ts.map +0 -1
- package/dist/custom-agents.js +0 -309
- package/dist/custom-agents.js.map +0 -1
- package/dist/default-agents.d.ts +0 -8
- package/dist/default-agents.d.ts.map +0 -1
- package/dist/default-agents.js +0 -123
- package/dist/default-agents.js.map +0 -1
- package/dist/enabled-models.d.ts +0 -50
- package/dist/enabled-models.d.ts.map +0 -1
- package/dist/enabled-models.js +0 -146
- package/dist/enabled-models.js.map +0 -1
- package/dist/env.d.ts +0 -7
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -29
- package/dist/env.js.map +0 -1
- package/dist/group-join.d.ts +0 -33
- package/dist/group-join.d.ts.map +0 -1
- package/dist/group-join.js +0 -117
- package/dist/group-join.js.map +0 -1
- package/dist/index.d.ts +0 -51
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3687
- package/dist/index.js.map +0 -1
- package/dist/invocation-config.d.ts +0 -108
- package/dist/invocation-config.d.ts.map +0 -1
- package/dist/invocation-config.js +0 -84
- package/dist/invocation-config.js.map +0 -1
- package/dist/memory.d.ts +0 -54
- package/dist/memory.d.ts.map +0 -1
- package/dist/memory.js +0 -166
- package/dist/memory.js.map +0 -1
- package/dist/mention-clone.d.ts +0 -88
- package/dist/mention-clone.d.ts.map +0 -1
- package/dist/mention-clone.js +0 -154
- package/dist/mention-clone.js.map +0 -1
- package/dist/mention.d.ts +0 -82
- package/dist/mention.d.ts.map +0 -1
- package/dist/mention.js +0 -132
- package/dist/mention.js.map +0 -1
- package/dist/model-resolver.d.ts +0 -37
- package/dist/model-resolver.d.ts.map +0 -1
- package/dist/model-resolver.js +0 -96
- package/dist/model-resolver.js.map +0 -1
- package/dist/model-scope.d.ts +0 -50
- package/dist/model-scope.d.ts.map +0 -1
- package/dist/model-scope.js +0 -49
- package/dist/model-scope.js.map +0 -1
- package/dist/nested-tools.d.ts +0 -57
- package/dist/nested-tools.d.ts.map +0 -1
- package/dist/nested-tools.js +0 -301
- package/dist/nested-tools.js.map +0 -1
- package/dist/nico-overrides.d.ts +0 -54
- package/dist/nico-overrides.d.ts.map +0 -1
- package/dist/nico-overrides.js +0 -170
- package/dist/nico-overrides.js.map +0 -1
- package/dist/output-file.d.ts +0 -44
- package/dist/output-file.d.ts.map +0 -1
- package/dist/output-file.js +0 -156
- package/dist/output-file.js.map +0 -1
- package/dist/prompts.d.ts +0 -56
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js +0 -92
- package/dist/prompts.js.map +0 -1
- package/dist/schedule-store.d.ts +0 -39
- package/dist/schedule-store.d.ts.map +0 -1
- package/dist/schedule-store.js +0 -156
- package/dist/schedule-store.js.map +0 -1
- package/dist/schedule.d.ts +0 -110
- package/dist/schedule.d.ts.map +0 -1
- package/dist/schedule.js +0 -360
- package/dist/schedule.js.map +0 -1
- package/dist/settings.d.ts +0 -354
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -247
- package/dist/settings.js.map +0 -1
- package/dist/skill-loader.d.ts +0 -25
- package/dist/skill-loader.d.ts.map +0 -1
- package/dist/skill-loader.js +0 -94
- package/dist/skill-loader.js.map +0 -1
- package/dist/status-note.d.ts +0 -62
- package/dist/status-note.d.ts.map +0 -1
- package/dist/status-note.js +0 -86
- package/dist/status-note.js.map +0 -1
- package/dist/structured-output.d.ts +0 -62
- package/dist/structured-output.d.ts.map +0 -1
- package/dist/structured-output.js +0 -113
- package/dist/structured-output.js.map +0 -1
- package/dist/types.d.ts +0 -372
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/ui/agent-mention.d.ts +0 -83
- package/dist/ui/agent-mention.d.ts.map +0 -1
- package/dist/ui/agent-mention.js +0 -188
- package/dist/ui/agent-mention.js.map +0 -1
- package/dist/ui/agent-widget.d.ts +0 -241
- package/dist/ui/agent-widget.d.ts.map +0 -1
- package/dist/ui/agent-widget.js +0 -992
- package/dist/ui/agent-widget.js.map +0 -1
- package/dist/ui/ccstyle/diff/ansi-utils.d.ts +0 -11
- package/dist/ui/ccstyle/diff/ansi-utils.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/ansi-utils.js +0 -145
- package/dist/ui/ccstyle/diff/ansi-utils.js.map +0 -1
- package/dist/ui/ccstyle/diff/diff-presentation.d.ts +0 -12
- package/dist/ui/ccstyle/diff/diff-presentation.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/diff-presentation.js +0 -48
- package/dist/ui/ccstyle/diff/diff-presentation.js.map +0 -1
- package/dist/ui/ccstyle/diff/diff-renderer.d.ts +0 -46
- package/dist/ui/ccstyle/diff/diff-renderer.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/diff-renderer.js +0 -2049
- package/dist/ui/ccstyle/diff/diff-renderer.js.map +0 -1
- package/dist/ui/ccstyle/diff/line-width-safety.d.ts +0 -12
- package/dist/ui/ccstyle/diff/line-width-safety.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/line-width-safety.js +0 -58
- package/dist/ui/ccstyle/diff/line-width-safety.js.map +0 -1
- package/dist/ui/ccstyle/diff/render-utils.d.ts +0 -6
- package/dist/ui/ccstyle/diff/render-utils.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/render-utils.js +0 -25
- package/dist/ui/ccstyle/diff/render-utils.js.map +0 -1
- package/dist/ui/ccstyle/diff/shiki-highlight.d.ts +0 -19
- package/dist/ui/ccstyle/diff/shiki-highlight.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/shiki-highlight.js +0 -85
- package/dist/ui/ccstyle/diff/shiki-highlight.js.map +0 -1
- package/dist/ui/ccstyle/diff/types.d.ts +0 -22
- package/dist/ui/ccstyle/diff/types.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/types.js +0 -10
- package/dist/ui/ccstyle/diff/types.js.map +0 -1
- package/dist/ui/ccstyle/diff/write-display-utils.d.ts +0 -2
- package/dist/ui/ccstyle/diff/write-display-utils.d.ts.map +0 -1
- package/dist/ui/ccstyle/diff/write-display-utils.js +0 -12
- package/dist/ui/ccstyle/diff/write-display-utils.js.map +0 -1
- package/dist/ui/ccstyle/tool-renderer.d.ts +0 -17
- package/dist/ui/ccstyle/tool-renderer.d.ts.map +0 -1
- package/dist/ui/ccstyle/tool-renderer.js +0 -74
- package/dist/ui/ccstyle/tool-renderer.js.map +0 -1
- package/dist/ui/ccstyle/tool-result.d.ts +0 -44
- package/dist/ui/ccstyle/tool-result.d.ts.map +0 -1
- package/dist/ui/ccstyle/tool-result.js +0 -423
- package/dist/ui/ccstyle/tool-result.js.map +0 -1
- package/dist/ui/conversation-blocks.d.ts +0 -46
- package/dist/ui/conversation-blocks.d.ts.map +0 -1
- package/dist/ui/conversation-blocks.js +0 -313
- package/dist/ui/conversation-blocks.js.map +0 -1
- package/dist/ui/conversation-nvim.d.ts +0 -8
- package/dist/ui/conversation-nvim.d.ts.map +0 -1
- package/dist/ui/conversation-nvim.js +0 -117
- package/dist/ui/conversation-nvim.js.map +0 -1
- package/dist/ui/conversation-role.d.ts +0 -13
- package/dist/ui/conversation-role.d.ts.map +0 -1
- package/dist/ui/conversation-role.js +0 -39
- package/dist/ui/conversation-role.js.map +0 -1
- package/dist/ui/conversation-search.d.ts +0 -39
- package/dist/ui/conversation-search.d.ts.map +0 -1
- package/dist/ui/conversation-search.js +0 -124
- package/dist/ui/conversation-search.js.map +0 -1
- package/dist/ui/conversation-timeline.d.ts +0 -102
- package/dist/ui/conversation-timeline.d.ts.map +0 -1
- package/dist/ui/conversation-timeline.js +0 -555
- package/dist/ui/conversation-timeline.js.map +0 -1
- package/dist/ui/conversation-viewer.d.ts +0 -138
- package/dist/ui/conversation-viewer.d.ts.map +0 -1
- package/dist/ui/conversation-viewer.js +0 -1175
- package/dist/ui/conversation-viewer.js.map +0 -1
- package/dist/ui/schedule-menu.d.ts +0 -17
- package/dist/ui/schedule-menu.d.ts.map +0 -1
- package/dist/ui/schedule-menu.js +0 -95
- package/dist/ui/schedule-menu.js.map +0 -1
- package/dist/ui/select-item.d.ts +0 -28
- package/dist/ui/select-item.d.ts.map +0 -1
- package/dist/ui/select-item.js +0 -35
- package/dist/ui/select-item.js.map +0 -1
- package/dist/ui/viewer-keys.d.ts +0 -21
- package/dist/ui/viewer-keys.d.ts.map +0 -1
- package/dist/ui/viewer-keys.js +0 -18
- package/dist/ui/viewer-keys.js.map +0 -1
- package/dist/ui/workflow-card.d.ts +0 -176
- package/dist/ui/workflow-card.d.ts.map +0 -1
- package/dist/ui/workflow-card.js +0 -333
- package/dist/ui/workflow-card.js.map +0 -1
- package/dist/ui/workflow-dialog.d.ts +0 -306
- package/dist/ui/workflow-dialog.d.ts.map +0 -1
- package/dist/ui/workflow-dialog.js +0 -844
- package/dist/ui/workflow-dialog.js.map +0 -1
- package/dist/ui/workflow-menu.d.ts +0 -42
- package/dist/ui/workflow-menu.d.ts.map +0 -1
- package/dist/ui/workflow-menu.js +0 -127
- package/dist/ui/workflow-menu.js.map +0 -1
- package/dist/usage.d.ts +0 -136
- package/dist/usage.d.ts.map +0 -1
- package/dist/usage.js +0 -121
- package/dist/usage.js.map +0 -1
- package/dist/workflow/collisions.d.ts +0 -96
- package/dist/workflow/collisions.d.ts.map +0 -1
- package/dist/workflow/collisions.js +0 -89
- package/dist/workflow/collisions.js.map +0 -1
- package/dist/workflow/entry.d.ts +0 -33
- package/dist/workflow/entry.d.ts.map +0 -1
- package/dist/workflow/entry.js +0 -30
- package/dist/workflow/entry.js.map +0 -1
- package/dist/workflow/host.d.ts +0 -63
- package/dist/workflow/host.d.ts.map +0 -1
- package/dist/workflow/host.js +0 -363
- package/dist/workflow/host.js.map +0 -1
- package/dist/workflow/journal.d.ts +0 -98
- package/dist/workflow/journal.d.ts.map +0 -1
- package/dist/workflow/journal.js +0 -121
- package/dist/workflow/journal.js.map +0 -1
- package/dist/workflow/json-schema.d.ts +0 -52
- package/dist/workflow/json-schema.d.ts.map +0 -1
- package/dist/workflow/json-schema.js +0 -112
- package/dist/workflow/json-schema.js.map +0 -1
- package/dist/workflow/meta.d.ts +0 -68
- package/dist/workflow/meta.d.ts.map +0 -1
- package/dist/workflow/meta.js +0 -318
- package/dist/workflow/meta.js.map +0 -1
- package/dist/workflow/progress.d.ts +0 -225
- package/dist/workflow/progress.d.ts.map +0 -1
- package/dist/workflow/progress.js +0 -362
- package/dist/workflow/progress.js.map +0 -1
- package/dist/workflow/runtime.d.ts +0 -335
- package/dist/workflow/runtime.d.ts.map +0 -1
- package/dist/workflow/runtime.js +0 -831
- package/dist/workflow/runtime.js.map +0 -1
- package/dist/workflow/saved.d.ts +0 -91
- package/dist/workflow/saved.d.ts.map +0 -1
- package/dist/workflow/saved.js +0 -204
- package/dist/workflow/saved.js.map +0 -1
- package/dist/workflow/task.d.ts +0 -137
- package/dist/workflow/task.d.ts.map +0 -1
- package/dist/workflow/task.js +0 -208
- package/dist/workflow/task.js.map +0 -1
- package/dist/workflow/tool-description.d.ts +0 -39
- package/dist/workflow/tool-description.d.ts.map +0 -1
- package/dist/workflow/tool-description.js +0 -200
- package/dist/workflow/tool-description.js.map +0 -1
- package/dist/workflow/worker-source.d.ts +0 -48
- package/dist/workflow/worker-source.d.ts.map +0 -1
- package/dist/workflow/worker-source.js +0 -779
- package/dist/workflow/worker-source.js.map +0 -1
- package/dist/worktree.d.ts +0 -53
- package/dist/worktree.d.ts.map +0 -1
- package/dist/worktree.js +0 -165
- package/dist/worktree.js.map +0 -1
- package/dist/write-execution.d.ts +0 -42
- package/dist/write-execution.d.ts.map +0 -1
- package/dist/write-execution.js +0 -138
- package/dist/write-execution.js.map +0 -1
- package/dist/xml.d.ts +0 -11
- package/dist/xml.d.ts.map +0 -1
- package/dist/xml.js +0 -13
- package/dist/xml.js.map +0 -1
- package/src/abortable.ts +0 -43
- package/src/agent-color.ts +0 -161
- package/src/agent-file-toggle.ts +0 -269
- package/src/child-context.ts +0 -15
- package/src/mention-clone.ts +0 -196
- package/src/mention.ts +0 -141
- package/src/model-scope.ts +0 -70
- package/src/nested-tools.ts +0 -424
- package/src/structured-output.ts +0 -130
- package/src/ui/agent-mention.ts +0 -216
- package/src/ui/select-item.ts +0 -45
- package/src/ui/workflow-card.ts +0 -470
- package/src/ui/workflow-dialog.ts +0 -1115
- package/src/ui/workflow-menu.ts +0 -166
- package/src/workflow/collisions.ts +0 -123
- package/src/workflow/entry.ts +0 -47
- package/src/workflow/host.ts +0 -403
- package/src/workflow/journal.ts +0 -164
- package/src/workflow/json-schema.ts +0 -128
- package/src/workflow/meta.ts +0 -325
- package/src/workflow/progress.ts +0 -550
- package/src/workflow/runtime.ts +0 -1219
- package/src/workflow/saved.ts +0 -217
- package/src/workflow/task.ts +0 -302
- package/src/workflow/tool-description.ts +0 -200
- package/src/workflow/worker-source.ts +0 -781
- package/src/xml.ts +0 -13
package/src/worktree.ts
CHANGED
|
@@ -4,17 +4,13 @@
|
|
|
4
4
|
* Creates a temporary git worktree so the agent works on an isolated copy of the repo.
|
|
5
5
|
* On completion, if no changes were made, the worktree is cleaned up.
|
|
6
6
|
* If changes exist, a branch is created and returned in the result.
|
|
7
|
-
*
|
|
8
|
-
* Every git call goes through `pi.exec` (async) rather than `execFileSync`: a
|
|
9
|
-
* worktree copy can take seconds, and a session that spawns several isolated
|
|
10
|
-
* agents at once would otherwise serialize them all on the TUI's event loop.
|
|
11
7
|
*/
|
|
12
8
|
|
|
9
|
+
import { execFileSync } from "node:child_process";
|
|
13
10
|
import { randomUUID } from "node:crypto";
|
|
14
11
|
import { existsSync, realpathSync } from "node:fs";
|
|
15
12
|
import { tmpdir } from "node:os";
|
|
16
13
|
import { join, relative } from "node:path";
|
|
17
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
18
14
|
|
|
19
15
|
export interface WorktreeInfo {
|
|
20
16
|
/** Absolute path to the worktree directory (the copied repo's root). */
|
|
@@ -32,26 +28,6 @@ export interface WorktreeInfo {
|
|
|
32
28
|
workPath: string;
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
/**
|
|
36
|
-
* Project-wide switch for worktree isolation (`worktreeIsolation` in
|
|
37
|
-
* subagents.json). Default `true` — unchanged behaviour.
|
|
38
|
-
*
|
|
39
|
-
* The `"off"` isolation value gives a model a legal way to decline a worktree,
|
|
40
|
-
* but it still depends on the model choosing it. This is the deterministic half
|
|
41
|
-
* of the same fix: on a large repo where every worktree costs real time and
|
|
42
|
-
* disk (#184), turning it off means no caller can create one, whatever it
|
|
43
|
-
* passes.
|
|
44
|
-
*/
|
|
45
|
-
let worktreeIsolationEnabled = true;
|
|
46
|
-
|
|
47
|
-
export function setWorktreeIsolationEnabled(enabled: boolean): void {
|
|
48
|
-
worktreeIsolationEnabled = enabled;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function isWorktreeIsolationEnabled(): boolean {
|
|
52
|
-
return worktreeIsolationEnabled;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
31
|
export interface WorktreeCleanupResult {
|
|
56
32
|
/** Whether changes were found in the worktree. */
|
|
57
33
|
hasChanges: boolean;
|
|
@@ -61,43 +37,26 @@ export interface WorktreeCleanupResult {
|
|
|
61
37
|
path?: string;
|
|
62
38
|
}
|
|
63
39
|
|
|
64
|
-
/**
|
|
65
|
-
* Run git and return its trimmed stdout, throwing on failure so callers keep
|
|
66
|
-
* the try/catch control flow `execFileSync` gave them.
|
|
67
|
-
*
|
|
68
|
-
* `pi.exec` never rejects — it reports failure in the result — and a command
|
|
69
|
-
* killed by its timeout comes back as `killed` with an exit code of 0, so both
|
|
70
|
-
* have to be checked to reproduce `execFileSync`'s "throws on anything but a
|
|
71
|
-
* clean exit".
|
|
72
|
-
*/
|
|
73
|
-
async function git(pi: ExtensionAPI, cwd: string, args: string[], timeout: number): Promise<string> {
|
|
74
|
-
const result = await pi.exec("git", args, { cwd, timeout });
|
|
75
|
-
if (result.killed || result.code !== 0) {
|
|
76
|
-
throw new Error(result.stderr.trim() || `git ${args.join(" ")} failed (exit ${result.code})`);
|
|
77
|
-
}
|
|
78
|
-
return result.stdout.trim();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
40
|
/**
|
|
82
41
|
* Create a temporary git worktree for an agent.
|
|
83
42
|
* Returns the worktree path, or undefined if not in a git repo.
|
|
84
43
|
*/
|
|
85
|
-
export
|
|
86
|
-
pi: ExtensionAPI,
|
|
87
|
-
cwd: string,
|
|
88
|
-
agentId: string,
|
|
89
|
-
): Promise<WorktreeInfo | undefined> {
|
|
44
|
+
export function createWorktree(cwd: string, agentId: string): WorktreeInfo | undefined {
|
|
90
45
|
// Verify we're in a git repo with at least one commit (HEAD must exist)
|
|
91
46
|
let baseSha: string;
|
|
92
47
|
let subdir: string;
|
|
93
48
|
try {
|
|
94
|
-
|
|
95
|
-
baseSha =
|
|
49
|
+
execFileSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd, stdio: "pipe", timeout: 5000 });
|
|
50
|
+
baseSha = execFileSync("git", ["rev-parse", "HEAD"], { cwd, stdio: "pipe", timeout: 5000 })
|
|
51
|
+
.toString()
|
|
52
|
+
.trim();
|
|
96
53
|
// Where cwd sits inside the repo ("" at the root): the agent must work at
|
|
97
54
|
// the same subdirectory inside the copy, or a monorepo-package cwd would
|
|
98
55
|
// silently widen to the whole repo. realpath both sides — git emits
|
|
99
56
|
// resolved paths while cwd may arrive through a symlink (macOS /tmp).
|
|
100
|
-
const topLevel =
|
|
57
|
+
const topLevel = execFileSync("git", ["rev-parse", "--show-toplevel"], { cwd, stdio: "pipe", timeout: 5000 })
|
|
58
|
+
.toString()
|
|
59
|
+
.trim();
|
|
101
60
|
subdir = relative(realpathSync(topLevel), realpathSync(cwd));
|
|
102
61
|
} catch {
|
|
103
62
|
return undefined;
|
|
@@ -109,7 +68,11 @@ export async function createWorktree(
|
|
|
109
68
|
|
|
110
69
|
try {
|
|
111
70
|
// Create detached worktree at HEAD
|
|
112
|
-
|
|
71
|
+
execFileSync("git", ["worktree", "add", "--detach", worktreePath, "HEAD"], {
|
|
72
|
+
cwd,
|
|
73
|
+
stdio: "pipe",
|
|
74
|
+
timeout: 30000,
|
|
75
|
+
});
|
|
113
76
|
return { path: worktreePath, branch, baseSha, workPath: subdir ? join(worktreePath, subdir) : worktreePath };
|
|
114
77
|
} catch {
|
|
115
78
|
// If worktree creation fails, return undefined (agent runs in normal cwd)
|
|
@@ -122,33 +85,44 @@ export async function createWorktree(
|
|
|
122
85
|
* - If no changes: remove worktree entirely.
|
|
123
86
|
* - If changes exist: create a branch, commit changes, return branch info.
|
|
124
87
|
*/
|
|
125
|
-
export
|
|
126
|
-
pi: ExtensionAPI,
|
|
88
|
+
export function cleanupWorktree(
|
|
127
89
|
cwd: string,
|
|
128
90
|
worktree: WorktreeInfo,
|
|
129
91
|
agentDescription: string,
|
|
130
|
-
):
|
|
92
|
+
): WorktreeCleanupResult {
|
|
131
93
|
if (!existsSync(worktree.path)) {
|
|
132
94
|
return { hasChanges: false };
|
|
133
95
|
}
|
|
134
96
|
|
|
135
97
|
try {
|
|
136
98
|
// Check for uncommitted changes in the worktree
|
|
137
|
-
const status =
|
|
99
|
+
const status = execFileSync("git", ["status", "--porcelain"], {
|
|
100
|
+
cwd: worktree.path,
|
|
101
|
+
stdio: "pipe",
|
|
102
|
+
timeout: 10000,
|
|
103
|
+
}).toString().trim();
|
|
138
104
|
|
|
139
105
|
if (status) {
|
|
140
106
|
// Changes exist — stage, commit, and create a branch
|
|
141
|
-
|
|
142
|
-
// Truncate description for commit message (no shell sanitization needed —
|
|
107
|
+
execFileSync("git", ["add", "-A"], { cwd: worktree.path, stdio: "pipe", timeout: 10000 });
|
|
108
|
+
// Truncate description for commit message (no shell sanitization needed — execFileSync uses argv)
|
|
143
109
|
const safeDesc = agentDescription.slice(0, 200);
|
|
144
110
|
const commitMsg = `pi-agent: ${safeDesc}`;
|
|
145
|
-
|
|
111
|
+
execFileSync("git", ["commit", "--no-verify", "-m", commitMsg], {
|
|
112
|
+
cwd: worktree.path,
|
|
113
|
+
stdio: "pipe",
|
|
114
|
+
timeout: 10000,
|
|
115
|
+
});
|
|
146
116
|
} else {
|
|
147
|
-
const currentSha =
|
|
117
|
+
const currentSha = execFileSync("git", ["rev-parse", "HEAD"], {
|
|
118
|
+
cwd: worktree.path,
|
|
119
|
+
stdio: "pipe",
|
|
120
|
+
timeout: 5000,
|
|
121
|
+
}).toString().trim();
|
|
148
122
|
|
|
149
123
|
if (currentSha === worktree.baseSha) {
|
|
150
124
|
// No changes — remove worktree
|
|
151
|
-
|
|
125
|
+
removeWorktree(cwd, worktree.path);
|
|
152
126
|
return { hasChanges: false };
|
|
153
127
|
}
|
|
154
128
|
}
|
|
@@ -157,17 +131,25 @@ export async function cleanupWorktree(
|
|
|
157
131
|
// If the branch already exists, append a suffix to avoid overwriting previous work.
|
|
158
132
|
let branchName = worktree.branch;
|
|
159
133
|
try {
|
|
160
|
-
|
|
134
|
+
execFileSync("git", ["branch", branchName], {
|
|
135
|
+
cwd: worktree.path,
|
|
136
|
+
stdio: "pipe",
|
|
137
|
+
timeout: 5000,
|
|
138
|
+
});
|
|
161
139
|
} catch {
|
|
162
140
|
// Branch already exists — use a unique suffix
|
|
163
141
|
branchName = `${worktree.branch}-${Date.now()}`;
|
|
164
|
-
|
|
142
|
+
execFileSync("git", ["branch", branchName], {
|
|
143
|
+
cwd: worktree.path,
|
|
144
|
+
stdio: "pipe",
|
|
145
|
+
timeout: 5000,
|
|
146
|
+
});
|
|
165
147
|
}
|
|
166
148
|
// Update branch name in worktree info for the caller
|
|
167
149
|
worktree.branch = branchName;
|
|
168
150
|
|
|
169
151
|
// Remove the worktree (branch persists in main repo)
|
|
170
|
-
|
|
152
|
+
removeWorktree(cwd, worktree.path);
|
|
171
153
|
|
|
172
154
|
return {
|
|
173
155
|
hasChanges: true,
|
|
@@ -176,7 +158,7 @@ export async function cleanupWorktree(
|
|
|
176
158
|
};
|
|
177
159
|
} catch {
|
|
178
160
|
// Best effort cleanup on error
|
|
179
|
-
try {
|
|
161
|
+
try { removeWorktree(cwd, worktree.path); } catch { /* ignore */ }
|
|
180
162
|
return { hasChanges: false };
|
|
181
163
|
}
|
|
182
164
|
}
|
|
@@ -184,13 +166,17 @@ export async function cleanupWorktree(
|
|
|
184
166
|
/**
|
|
185
167
|
* Force-remove a worktree.
|
|
186
168
|
*/
|
|
187
|
-
|
|
169
|
+
function removeWorktree(cwd: string, worktreePath: string): void {
|
|
188
170
|
try {
|
|
189
|
-
|
|
171
|
+
execFileSync("git", ["worktree", "remove", "--force", worktreePath], {
|
|
172
|
+
cwd,
|
|
173
|
+
stdio: "pipe",
|
|
174
|
+
timeout: 10000,
|
|
175
|
+
});
|
|
190
176
|
} catch {
|
|
191
177
|
// If git worktree remove fails, try pruning
|
|
192
178
|
try {
|
|
193
|
-
|
|
179
|
+
execFileSync("git", ["worktree", "prune"], { cwd, stdio: "pipe", timeout: 5000 });
|
|
194
180
|
} catch { /* ignore */ }
|
|
195
181
|
}
|
|
196
182
|
}
|
|
@@ -198,8 +184,8 @@ async function removeWorktree(pi: ExtensionAPI, cwd: string, worktreePath: strin
|
|
|
198
184
|
/**
|
|
199
185
|
* Prune any orphaned worktrees (crash recovery).
|
|
200
186
|
*/
|
|
201
|
-
export
|
|
187
|
+
export function pruneWorktrees(cwd: string): void {
|
|
202
188
|
try {
|
|
203
|
-
|
|
189
|
+
execFileSync("git", ["worktree", "prune"], { cwd, stdio: "pipe", timeout: 5000 });
|
|
204
190
|
} catch { /* ignore */ }
|
|
205
191
|
}
|
package/dist/abortable.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* abortable.ts — race a promise against an AbortSignal without cancelling the
|
|
3
|
-
* underlying work.
|
|
4
|
-
*
|
|
5
|
-
* Used by the `get_subagent_result` wait paths (top-level and nested): pressing
|
|
6
|
-
* Esc cancels only the caller's wait; the background child keeps running and its
|
|
7
|
-
* result stays unconsumed. The listener is removed on every settle path so the
|
|
8
|
-
* signal accumulates no handlers, and a late settlement of the wrapped promise
|
|
9
|
-
* after an abort is absorbed as a no-op (no unhandled rejection).
|
|
10
|
-
*/
|
|
11
|
-
/** Await a promise until it settles or the caller cancels, without aborting the underlying work. */
|
|
12
|
-
export declare function abortable<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
13
|
-
//# sourceMappingURL=abortable.d.ts.map
|
package/dist/abortable.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abortable.d.ts","sourceRoot":"","sources":["../src/abortable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CA8BlF"}
|
package/dist/abortable.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* abortable.ts — race a promise against an AbortSignal without cancelling the
|
|
3
|
-
* underlying work.
|
|
4
|
-
*
|
|
5
|
-
* Used by the `get_subagent_result` wait paths (top-level and nested): pressing
|
|
6
|
-
* Esc cancels only the caller's wait; the background child keeps running and its
|
|
7
|
-
* result stays unconsumed. The listener is removed on every settle path so the
|
|
8
|
-
* signal accumulates no handlers, and a late settlement of the wrapped promise
|
|
9
|
-
* after an abort is absorbed as a no-op (no unhandled rejection).
|
|
10
|
-
*/
|
|
11
|
-
/** Await a promise until it settles or the caller cancels, without aborting the underlying work. */
|
|
12
|
-
export function abortable(promise, signal) {
|
|
13
|
-
if (!signal)
|
|
14
|
-
return promise;
|
|
15
|
-
if (signal.aborted)
|
|
16
|
-
return Promise.reject(signal.reason);
|
|
17
|
-
return new Promise((resolve, reject) => {
|
|
18
|
-
let settled = false;
|
|
19
|
-
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
20
|
-
const onAbort = () => {
|
|
21
|
-
if (settled)
|
|
22
|
-
return;
|
|
23
|
-
settled = true;
|
|
24
|
-
cleanup();
|
|
25
|
-
reject(signal.reason);
|
|
26
|
-
};
|
|
27
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
28
|
-
promise.then((value) => {
|
|
29
|
-
if (settled)
|
|
30
|
-
return;
|
|
31
|
-
settled = true;
|
|
32
|
-
cleanup();
|
|
33
|
-
resolve(value);
|
|
34
|
-
}, (error) => {
|
|
35
|
-
if (settled)
|
|
36
|
-
return;
|
|
37
|
-
settled = true;
|
|
38
|
-
cleanup();
|
|
39
|
-
reject(error);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=abortable.js.map
|
package/dist/abortable.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abortable.js","sourceRoot":"","sources":["../src/abortable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oGAAoG;AACpG,MAAM,UAAU,SAAS,CAAI,OAAmB,EAAE,MAAoB;IACpE,IAAI,CAAC,MAAM;QAAE,OAAO,OAAO,CAAC;IAC5B,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YACjB,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/agent-color.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* agent-color.ts — Claude Code-compatible agent name badges.
|
|
3
|
-
*
|
|
4
|
-
* Claude Code renders a subagent's name as a badge: the configured color is the
|
|
5
|
-
* background, the text an inverse foreground. Its eight named colors are
|
|
6
|
-
* reproduced here, along with six-digit hex and the extra palette names Agency
|
|
7
|
-
* Agents uses, so those definitions render as written.
|
|
8
|
-
*/
|
|
9
|
-
type ColorMode = "truecolor" | "256color";
|
|
10
|
-
export interface AgentNameTheme {
|
|
11
|
-
fg(color: string, text: string): string;
|
|
12
|
-
bold(text: string): string;
|
|
13
|
-
getColorMode?(): ColorMode;
|
|
14
|
-
}
|
|
15
|
-
export interface AgentNameStyle {
|
|
16
|
-
/** Existing theme foreground used when no valid agent color is configured. */
|
|
17
|
-
fallbackColor?: string;
|
|
18
|
-
/** Reapply an enclosing background after the badge instead of resetting it. */
|
|
19
|
-
restoreBackground?: string;
|
|
20
|
-
bold?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/** Resolve Claude Code/Agency Agents color syntax to normalized #RRGGBB. */
|
|
23
|
-
export declare function resolveAgentColor(value: string | undefined): string | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Render one name as a padded background badge when `color` is valid. Claude
|
|
26
|
-
* Code uses one inverse color for every badge's text; black or white is picked
|
|
27
|
-
* by WCAG contrast here instead, so each palette entry stays readable. Invalid
|
|
28
|
-
* or omitted colors preserve the caller's existing theme styling.
|
|
29
|
-
*/
|
|
30
|
-
export declare function renderAgentNameLabel(name: string, color: string | undefined, theme: AgentNameTheme, style?: AgentNameStyle): string;
|
|
31
|
-
/** Whether an agent renders as a badge — i.e. it has a valid configured color. */
|
|
32
|
-
export declare function hasAgentBadge(type: string | undefined): boolean;
|
|
33
|
-
/** Render a registered agent's display name with its configured color. */
|
|
34
|
-
export declare function renderAgentName(type: string | undefined, theme: AgentNameTheme, style?: AgentNameStyle): string;
|
|
35
|
-
export {};
|
|
36
|
-
//# sourceMappingURL=agent-color.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-color.d.ts","sourceRoot":"","sources":["../src/agent-color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsCH,KAAK,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,YAAY,CAAC,IAAI,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAK/E;AAgDD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,cAAc,EACrB,KAAK,GAAE,cAAmB,GACzB,MAAM,CAkBR;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE/D;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,cAAc,EACrB,KAAK,GAAE,cAAmB,GACzB,MAAM,CAIR"}
|
package/dist/agent-color.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* agent-color.ts — Claude Code-compatible agent name badges.
|
|
3
|
-
*
|
|
4
|
-
* Claude Code renders a subagent's name as a badge: the configured color is the
|
|
5
|
-
* background, the text an inverse foreground. Its eight named colors are
|
|
6
|
-
* reproduced here, along with six-digit hex and the extra palette names Agency
|
|
7
|
-
* Agents uses, so those definitions render as written.
|
|
8
|
-
*/
|
|
9
|
-
import { getConfig } from "./agent-types.js";
|
|
10
|
-
const NAMED_AGENT_COLORS = {
|
|
11
|
-
// Claude Code's eight subagent colors, as its default theme renders them.
|
|
12
|
-
red: "#DC2626",
|
|
13
|
-
blue: "#6A9BCC",
|
|
14
|
-
green: "#16A34A",
|
|
15
|
-
yellow: "#CA8A04",
|
|
16
|
-
purple: "#827DBD",
|
|
17
|
-
orange: "#D97757",
|
|
18
|
-
pink: "#C46686",
|
|
19
|
-
cyan: "#0891B2",
|
|
20
|
-
// Agency Agents palette aliases.
|
|
21
|
-
amber: "#F59E0B",
|
|
22
|
-
teal: "#008080",
|
|
23
|
-
indigo: "#6366F1",
|
|
24
|
-
gold: "#EAB308",
|
|
25
|
-
"neon-green": "#10B981",
|
|
26
|
-
"neon-cyan": "#06B6D4",
|
|
27
|
-
"metallic-blue": "#3B82F6",
|
|
28
|
-
violet: "#8B5CF6",
|
|
29
|
-
rose: "#F43F5E",
|
|
30
|
-
lime: "#84CC16",
|
|
31
|
-
gray: "#6B7280",
|
|
32
|
-
grey: "#6B7280",
|
|
33
|
-
fuchsia: "#D946EF",
|
|
34
|
-
slate: "#64748B",
|
|
35
|
-
navy: "#1E3A8A",
|
|
36
|
-
};
|
|
37
|
-
const CUBE_VALUES = [0, 95, 135, 175, 215, 255];
|
|
38
|
-
const GRAY_VALUES = Array.from({ length: 24 }, (_, i) => 8 + i * 10);
|
|
39
|
-
const BLACK = { r: 0, g: 0, b: 0 };
|
|
40
|
-
const WHITE = { r: 255, g: 255, b: 255 };
|
|
41
|
-
/** Resolve Claude Code/Agency Agents color syntax to normalized #RRGGBB. */
|
|
42
|
-
export function resolveAgentColor(value) {
|
|
43
|
-
if (!value)
|
|
44
|
-
return undefined;
|
|
45
|
-
const normalized = value.trim().toLowerCase();
|
|
46
|
-
const resolved = NAMED_AGENT_COLORS[normalized] ?? normalized;
|
|
47
|
-
return /^#[0-9a-f]{6}$/i.test(resolved) ? resolved.toUpperCase() : undefined;
|
|
48
|
-
}
|
|
49
|
-
function parseHex(hex) {
|
|
50
|
-
return {
|
|
51
|
-
r: Number.parseInt(hex.slice(1, 3), 16),
|
|
52
|
-
g: Number.parseInt(hex.slice(3, 5), 16),
|
|
53
|
-
b: Number.parseInt(hex.slice(5, 7), 16),
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/** Index of the entry in `values` closest to `value`. */
|
|
57
|
-
function nearest(values, value) {
|
|
58
|
-
return values.reduce((best, v, i) => (Math.abs(value - v) < Math.abs(value - values[best]) ? i : best), 0);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Quantize to the xterm-256 palette the way pi's own theme does, returning both
|
|
62
|
-
* the index to emit and the color the terminal will actually show — badge
|
|
63
|
-
* contrast is judged against the latter.
|
|
64
|
-
*/
|
|
65
|
-
function rgbTo256({ r, g, b }) {
|
|
66
|
-
const [rIndex, gIndex, bIndex] = [r, g, b].map((channel) => nearest(CUBE_VALUES, channel));
|
|
67
|
-
const distance = ({ r: cr, g: cg, b: cb }) => 0.299 * (r - cr) ** 2 + 0.587 * (g - cg) ** 2 + 0.114 * (b - cb) ** 2;
|
|
68
|
-
const grayIndex = nearest(GRAY_VALUES, Math.round(0.299 * r + 0.587 * g + 0.114 * b));
|
|
69
|
-
const gray = { r: GRAY_VALUES[grayIndex], g: GRAY_VALUES[grayIndex], b: GRAY_VALUES[grayIndex] };
|
|
70
|
-
const cube = { r: CUBE_VALUES[rIndex], g: CUBE_VALUES[gIndex], b: CUBE_VALUES[bIndex] };
|
|
71
|
-
// Only near-neutral colors may take the gray ramp; anything else keeps its tint.
|
|
72
|
-
if (Math.max(r, g, b) - Math.min(r, g, b) < 10 && distance(gray) < distance(cube)) {
|
|
73
|
-
return { index: 232 + grayIndex, rgb: gray };
|
|
74
|
-
}
|
|
75
|
-
return { index: 16 + 36 * rIndex + 6 * gIndex + bIndex, rgb: cube };
|
|
76
|
-
}
|
|
77
|
-
function ansiColor(layer, color) {
|
|
78
|
-
const code = layer === "foreground" ? 38 : 48;
|
|
79
|
-
return typeof color === "number"
|
|
80
|
-
? `\u001b[${code};5;${color}m`
|
|
81
|
-
: `\u001b[${code};2;${color.r};${color.g};${color.b}m`;
|
|
82
|
-
}
|
|
83
|
-
function relativeLuminance({ r, g, b }) {
|
|
84
|
-
const linear = (value) => {
|
|
85
|
-
const channel = value / 255;
|
|
86
|
-
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
87
|
-
};
|
|
88
|
-
return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Render one name as a padded background badge when `color` is valid. Claude
|
|
92
|
-
* Code uses one inverse color for every badge's text; black or white is picked
|
|
93
|
-
* by WCAG contrast here instead, so each palette entry stays readable. Invalid
|
|
94
|
-
* or omitted colors preserve the caller's existing theme styling.
|
|
95
|
-
*/
|
|
96
|
-
export function renderAgentNameLabel(name, color, theme, style = {}) {
|
|
97
|
-
const resolved = resolveAgentColor(color);
|
|
98
|
-
if (!resolved) {
|
|
99
|
-
const text = style.bold ? theme.bold(name) : name;
|
|
100
|
-
return style.fallbackColor ? theme.fg(style.fallbackColor, text) : text;
|
|
101
|
-
}
|
|
102
|
-
const rgb = parseHex(resolved);
|
|
103
|
-
const quantized = (theme.getColorMode?.() ?? "truecolor") === "256color" ? rgbTo256(rgb) : undefined;
|
|
104
|
-
const shown = quantized?.rgb ?? rgb;
|
|
105
|
-
const contrasting = relativeLuminance(shown) > 0.179 ? BLACK : WHITE;
|
|
106
|
-
const label = style.bold ? theme.bold(` ${name} `) : ` ${name} `;
|
|
107
|
-
return ansiColor("background", quantized?.index ?? rgb)
|
|
108
|
-
+ ansiColor("foreground", quantized ? rgbTo256(contrasting).index : contrasting)
|
|
109
|
-
+ label
|
|
110
|
-
+ "\u001b[39m"
|
|
111
|
-
+ (style.restoreBackground ?? "\u001b[49m");
|
|
112
|
-
}
|
|
113
|
-
/** Whether an agent renders as a badge — i.e. it has a valid configured color. */
|
|
114
|
-
export function hasAgentBadge(type) {
|
|
115
|
-
return type !== undefined && resolveAgentColor(getConfig(type).color) !== undefined;
|
|
116
|
-
}
|
|
117
|
-
/** Render a registered agent's display name with its configured color. */
|
|
118
|
-
export function renderAgentName(type, theme, style = {}) {
|
|
119
|
-
if (!type)
|
|
120
|
-
return renderAgentNameLabel("Agent", undefined, theme, style);
|
|
121
|
-
const config = getConfig(type);
|
|
122
|
-
return renderAgentNameLabel(config.displayName, config.color, theme, style);
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=agent-color.js.map
|
package/dist/agent-color.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-color.js","sourceRoot":"","sources":["../src/agent-color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,kBAAkB,GAAqC;IAC3D,0EAA0E;IAC1E,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,iCAAiC;IACjC,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,SAAS;IACtB,eAAe,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toggle.ts — Pure helpers for the `/agents` file-editing operations:
|
|
3
|
-
* locating an agent's .md file, toggling its `enabled:` frontmatter flag, and
|
|
4
|
-
* serializing an AgentConfig back to frontmatter for eject.
|
|
5
|
-
*
|
|
6
|
-
* These live outside src/index.ts so they can be tested directly: the `/agents`
|
|
7
|
-
* command handler is an ~890-line closure reached only through `registerCommand`,
|
|
8
|
-
* which every test mocks.
|
|
9
|
-
*
|
|
10
|
-
* The read side of this data (src/custom-agents.ts) parses frontmatter with a
|
|
11
|
-
* real YAML parser, so it honors `enabled: false` at any position in the block.
|
|
12
|
-
* This module must agree with it, and splits the work accordingly:
|
|
13
|
-
*
|
|
14
|
-
* - Deciding whether a file is disabled is a *read*, so it calls that same parser
|
|
15
|
-
* (`isDisabledContent`) instead of mirroring it. A mirror has to be right about
|
|
16
|
-
* YAML's boolean spellings and about pi's fence scan, and a regex was wrong
|
|
17
|
-
* about both.
|
|
18
|
-
* - *Editing* cannot go through the parser, because re-serializing a parsed
|
|
19
|
-
* document would reformat a file the README tells users to hand-author —
|
|
20
|
-
* discarding their comments, key order, and quoting. So the edits are line-wise
|
|
21
|
-
* and preserve everything they don't touch.
|
|
22
|
-
*
|
|
23
|
-
* That leaves removal best-effort: it recognizes a lowercase bare `false`, and
|
|
24
|
-
* reports `changed: false` for the spellings it cannot rewrite, so the caller
|
|
25
|
-
* refuses honestly rather than announcing a change it did not make.
|
|
26
|
-
*/
|
|
27
|
-
import type { AgentConfig } from "./types.js";
|
|
28
|
-
export type AgentFileLocation = "project" | "workspace" | "personal";
|
|
29
|
-
export declare const projectAgentsDir: (cwd?: string) => string;
|
|
30
|
-
export declare const workspaceAgentsDir: (cwd?: string) => string;
|
|
31
|
-
export declare const personalAgentsDir: () => string;
|
|
32
|
-
/**
|
|
33
|
-
* Find the file path of a custom agent by name, in discovery-precedence order
|
|
34
|
-
* (project, workspace, then global). Mirrors the load-side precedence in
|
|
35
|
-
* src/custom-agents.ts — if the two drift, `/agents` edits a file the loader
|
|
36
|
-
* isn't reading.
|
|
37
|
-
*/
|
|
38
|
-
export declare function findAgentFile(name: string, cwd?: string): {
|
|
39
|
-
path: string;
|
|
40
|
-
location: AgentFileLocation;
|
|
41
|
-
} | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Find the file behind a *loaded* agent, preferring the path the loader
|
|
44
|
-
* actually read (`AgentConfig.sourcePath`) over the `<type>.md` guess.
|
|
45
|
-
*
|
|
46
|
-
* An agent's type comes from its frontmatter `name:` now, so the two can
|
|
47
|
-
* disagree: `reviewer.md` declaring `name: code-reviewer` is loaded as
|
|
48
|
-
* `code-reviewer`, and probing for `code-reviewer.md` finds nothing. That is
|
|
49
|
-
* not a harmless miss — `/agents → Disable` would then take the no-file branch
|
|
50
|
-
* and write a NEW `code-reviewer.md` stub, which loses to `reviewer.md` on
|
|
51
|
-
* load, leaving the agent enabled while reporting success.
|
|
52
|
-
*
|
|
53
|
-
* The probe stays as the fallback: a built-in that was never ejected has no
|
|
54
|
-
* `sourcePath`, and a path can go stale between a load and this call.
|
|
55
|
-
*/
|
|
56
|
-
export declare function locateAgentFile(name: string, sourcePath: string | undefined, cwd?: string): {
|
|
57
|
-
path: string;
|
|
58
|
-
location: AgentFileLocation;
|
|
59
|
-
} | undefined;
|
|
60
|
-
export type DisableOutcome = "disabled" | "already-disabled" | "no-frontmatter";
|
|
61
|
-
/**
|
|
62
|
-
* Does the loader consider this file disabled?
|
|
63
|
-
*
|
|
64
|
-
* Detection is a READ operation, so it asks the same parser the loader uses
|
|
65
|
-
* rather than mirroring it with a regex — that mirror has to be right about
|
|
66
|
-
* YAML's boolean spellings (`False`, `FALSE`, a trailing `# comment`, a quoted
|
|
67
|
-
* key) *and* about pi's fence scan, which closes the block on any line starting
|
|
68
|
-
* `---` and so ends it early on `----`. A throw means the file is already
|
|
69
|
-
* unparseable, which is what the loader sees too: it skips the agent, so there
|
|
70
|
-
* is no "disabled" state to report.
|
|
71
|
-
*/
|
|
72
|
-
export declare function isDisabledContent(content: string): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Add `enabled: false` to a file's frontmatter.
|
|
75
|
-
*
|
|
76
|
-
* `outcome` distinguishes a real edit from a no-op so the caller can report
|
|
77
|
-
* honestly instead of unconditionally claiming success.
|
|
78
|
-
*/
|
|
79
|
-
export declare function disableInContent(content: string): {
|
|
80
|
-
content: string;
|
|
81
|
-
outcome: DisableOutcome;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Remove `enabled: false` from a file's frontmatter, wherever it appears in the
|
|
85
|
-
* block — the loader honors the key at any position, so the two must agree or a
|
|
86
|
-
* hand-authored agent can be disabled and never re-enabled.
|
|
87
|
-
*
|
|
88
|
-
* `changed` is false when the key wasn't found, so the caller can avoid
|
|
89
|
-
* reporting "Enabled <name>" for a write that did nothing.
|
|
90
|
-
*/
|
|
91
|
-
export declare function enableInContent(content: string): {
|
|
92
|
-
content: string;
|
|
93
|
-
changed: boolean;
|
|
94
|
-
};
|
|
95
|
-
/** Is this the empty stub `/agents` writes when disabling a built-in default? */
|
|
96
|
-
export declare function isEmptyStub(content: string): boolean;
|
|
97
|
-
/** The answers `/agents → Create agent → Manual` collects, before serialization. */
|
|
98
|
-
export interface NewAgentInput {
|
|
99
|
-
description: string;
|
|
100
|
-
/** Already-resolved `tools:` value ("none", "all", or a CSV of tool names). */
|
|
101
|
-
tools: string;
|
|
102
|
-
/** `provider/modelId`, or undefined to inherit the parent's model. */
|
|
103
|
-
model?: string;
|
|
104
|
-
/** A pi thinking level, or undefined to inherit. */
|
|
105
|
-
thinking?: string;
|
|
106
|
-
systemPrompt: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Build the .md file the create wizard writes.
|
|
110
|
-
*
|
|
111
|
-
* `description` and `model` come straight from a free-text prompt, so they are
|
|
112
|
-
* quoted rather than interpolated — `serializeAgentFile` above quotes the
|
|
113
|
-
* description for the same reason. An unquoted YAML scalar mishandles ordinary
|
|
114
|
-
* input in two ways, and both are silent: a colon ("Scout: find things") makes
|
|
115
|
-
* the file unparseable, and since #212 an unparseable agent file is *skipped*,
|
|
116
|
-
* so the wizard reports success for an agent that does not exist; a `#`
|
|
117
|
-
* ("audit #security") opens a comment and truncates the value. `model` can
|
|
118
|
-
* carry a colon too — pi accepts a `provider/model:thinking` suffix.
|
|
119
|
-
*
|
|
120
|
-
* `tools` and `thinking` are not quoted: both are chosen from fixed menus, and
|
|
121
|
-
* `tools` is a CSV that must stay a bare scalar for the loader's parser.
|
|
122
|
-
*/
|
|
123
|
-
export declare function buildNewAgentFile(input: NewAgentInput): string;
|
|
124
|
-
/** Serialize an AgentConfig to a full .md file (frontmatter + system prompt) for eject. */
|
|
125
|
-
export declare function serializeAgentFile(cfg: AgentConfig): string;
|
|
126
|
-
//# sourceMappingURL=agent-file-toggle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-file-toggle.d.ts","sourceRoot":"","sources":["../src/agent-file-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAErE,eAAO,MAAM,gBAAgB,GAAI,MAAK,MAAsB,WAA+B,CAAC;AAC5F,eAAO,MAAM,kBAAkB,GAAI,MAAK,MAAsB,WAAmC,CAAC;AAClG,eAAO,MAAM,iBAAiB,cAAsC,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAsB,GAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,GAAG,SAAS,CAQ3D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GAAG,SAA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