@wrongstack/tools 0.284.0 → 0.285.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/dist/_concurrency.d.ts +16 -0
- package/dist/_concurrency.d.ts.map +1 -0
- package/dist/_danger-detect.d.ts +54 -0
- package/dist/_danger-detect.d.ts.map +1 -0
- package/dist/_edit-match.d.ts +86 -0
- package/dist/_edit-match.d.ts.map +1 -0
- package/dist/_env.d.ts +6 -0
- package/dist/_env.d.ts.map +1 -0
- package/dist/_fetch-guard.d.ts +31 -0
- package/dist/_fetch-guard.d.ts.map +1 -0
- package/dist/_output-spool.d.ts +38 -0
- package/dist/_output-spool.d.ts.map +1 -0
- package/dist/_redact-command.d.ts +6 -0
- package/dist/_redact-command.d.ts.map +1 -0
- package/dist/_regex.d.ts +39 -0
- package/dist/_regex.d.ts.map +1 -0
- package/dist/_session-shell.d.ts +73 -0
- package/dist/_session-shell.d.ts.map +1 -0
- package/dist/_shell-pick.d.ts +158 -0
- package/dist/_shell-pick.d.ts.map +1 -0
- package/dist/_spawn-stream.d.ts +32 -0
- package/dist/_spawn-stream.d.ts.map +1 -0
- package/dist/_syntax-check.d.ts +16 -0
- package/dist/_syntax-check.d.ts.map +1 -0
- package/dist/_util.d.ts +68 -0
- package/dist/_util.d.ts.map +1 -0
- package/dist/_win32-resolve.d.ts +42 -0
- package/dist/_win32-resolve.d.ts.map +1 -0
- package/dist/audit.d.ts +4 -5
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +2743 -28
- package/dist/audit.js.map +7 -1
- package/dist/bash-kill-guard.d.ts +62 -0
- package/dist/bash-kill-guard.d.ts.map +1 -0
- package/dist/bash.d.ts +4 -5
- package/dist/bash.d.ts.map +1 -0
- package/dist/bash.js +59 -30
- package/dist/bash.js.map +7 -1
- package/dist/batch-tool-use.d.ts +4 -5
- package/dist/batch-tool-use.d.ts.map +1 -0
- package/dist/batch-tool-use.js +3 -3
- package/dist/batch-tool-use.js.map +7 -1
- package/dist/builtin.d.ts +7 -9
- package/dist/builtin.d.ts.map +1 -0
- package/dist/builtin.js +5282 -1019
- package/dist/builtin.js.map +7 -1
- package/dist/circuit-breaker.d.ts +4 -5
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/circuit-breaker.js +3 -3
- package/dist/circuit-breaker.js.map +7 -1
- package/dist/codebase-index/background-indexer.d.ts +116 -0
- package/dist/codebase-index/background-indexer.d.ts.map +1 -0
- package/dist/codebase-index/bm25.d.ts +40 -0
- package/dist/codebase-index/bm25.d.ts.map +1 -0
- package/dist/codebase-index/circuit-breaker.d.ts +94 -0
- package/dist/codebase-index/circuit-breaker.d.ts.map +1 -0
- package/dist/codebase-index/codebase-index-tool.d.ts +17 -0
- package/dist/codebase-index/codebase-index-tool.d.ts.map +1 -0
- package/dist/codebase-index/codebase-search-tool.d.ts +43 -0
- package/dist/codebase-index/codebase-search-tool.d.ts.map +1 -0
- package/dist/codebase-index/codebase-stats-tool.d.ts +23 -0
- package/dist/codebase-index/codebase-stats-tool.d.ts.map +1 -0
- package/dist/codebase-index/gitignore.d.ts +22 -0
- package/dist/codebase-index/gitignore.d.ts.map +1 -0
- package/dist/codebase-index/go-parser.d.ts +16 -0
- package/dist/codebase-index/go-parser.d.ts.map +1 -0
- package/dist/codebase-index/index-service.d.ts +25 -0
- package/dist/codebase-index/index-service.d.ts.map +1 -0
- package/dist/codebase-index/index.d.ts +23 -271
- package/dist/codebase-index/index.d.ts.map +1 -0
- package/dist/codebase-index/index.js +136 -68
- package/dist/codebase-index/index.js.map +7 -1
- package/dist/codebase-index/indexer.d.ts +28 -0
- package/dist/codebase-index/indexer.d.ts.map +1 -0
- package/dist/codebase-index/json-parser.d.ts +8 -0
- package/dist/codebase-index/json-parser.d.ts.map +1 -0
- package/dist/codebase-index/lsp-kind.d.ts +53 -0
- package/dist/codebase-index/lsp-kind.d.ts.map +1 -0
- package/dist/codebase-index/py-parser.d.ts +16 -0
- package/dist/codebase-index/py-parser.d.ts.map +1 -0
- package/dist/codebase-index/refs-extractor.d.ts +25 -0
- package/dist/codebase-index/refs-extractor.d.ts.map +1 -0
- package/dist/codebase-index/rs-parser.d.ts +8 -0
- package/dist/codebase-index/rs-parser.d.ts.map +1 -0
- package/dist/codebase-index/schema.d.ts +82 -0
- package/dist/codebase-index/schema.d.ts.map +1 -0
- package/dist/codebase-index/ts-parser.d.ts +30 -0
- package/dist/codebase-index/ts-parser.d.ts.map +1 -0
- package/dist/codebase-index/worker-protocol.d.ts +77 -0
- package/dist/codebase-index/worker-protocol.d.ts.map +1 -0
- package/dist/codebase-index/worker.d.ts +16 -2
- package/dist/codebase-index/worker.d.ts.map +1 -0
- package/dist/codebase-index/worker.js +103 -65
- package/dist/codebase-index/worker.js.map +7 -1
- package/dist/codebase-index/writer.d.ts +189 -0
- package/dist/codebase-index/writer.d.ts.map +1 -0
- package/dist/codebase-index/yaml-parser.d.ts +8 -0
- package/dist/codebase-index/yaml-parser.d.ts.map +1 -0
- package/dist/design.d.ts +38 -0
- package/dist/design.d.ts.map +1 -0
- package/dist/design.js +270 -0
- package/dist/design.js.map +7 -0
- package/dist/diff.d.ts +4 -5
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +14 -12
- package/dist/diff.js.map +7 -1
- package/dist/document.d.ts +4 -5
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +8 -7
- package/dist/document.js.map +7 -1
- package/dist/edit.d.ts +5 -36
- package/dist/edit.d.ts.map +1 -0
- package/dist/edit.js +28 -16
- package/dist/edit.js.map +7 -1
- package/dist/exec.d.ts +67 -2
- package/dist/exec.d.ts.map +1 -0
- package/dist/exec.js +50 -25
- package/dist/exec.js.map +7 -1
- package/dist/fetch.d.ts +4 -32
- package/dist/fetch.d.ts.map +1 -0
- package/dist/fetch.js +89 -77
- package/dist/fetch.js.map +7 -1
- package/dist/format.d.ts +4 -5
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +2415 -28
- package/dist/format.js.map +7 -1
- package/dist/git.d.ts +4 -5
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +10 -9
- package/dist/git.js.map +7 -1
- package/dist/glob.d.ts +4 -5
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +15 -12
- package/dist/glob.js.map +7 -1
- package/dist/grep.d.ts +4 -5
- package/dist/grep.d.ts.map +1 -0
- package/dist/grep.js +13 -10
- package/dist/grep.js.map +7 -1
- package/dist/index.d.ts +19 -724
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6088 -1690
- package/dist/index.js.map +7 -1
- package/dist/install.d.ts +4 -5
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +2680 -31
- package/dist/install.js.map +7 -1
- package/dist/json.d.ts +4 -5
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +13 -11
- package/dist/json.js.map +7 -1
- package/dist/kanban.d.ts +107 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.js +845 -0
- package/dist/kanban.js.map +7 -0
- package/dist/languages/detect.d.ts +3 -0
- package/dist/languages/detect.d.ts.map +1 -0
- package/dist/languages/diagnostics.d.ts +15 -0
- package/dist/languages/diagnostics.d.ts.map +1 -0
- package/dist/languages/execute-tool.d.ts +34 -0
- package/dist/languages/execute-tool.d.ts.map +1 -0
- package/dist/languages/execute.d.ts +18 -0
- package/dist/languages/execute.d.ts.map +1 -0
- package/dist/languages/index.d.ts +12 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +4457 -0
- package/dist/languages/index.js.map +7 -0
- package/dist/languages/legacy-bridge.d.ts +29 -0
- package/dist/languages/legacy-bridge.d.ts.map +1 -0
- package/dist/languages/package-tool.d.ts +29 -0
- package/dist/languages/package-tool.d.ts.map +1 -0
- package/dist/languages/plan.d.ts +4 -0
- package/dist/languages/plan.d.ts.map +1 -0
- package/dist/languages/profile-helpers.d.ts +14 -0
- package/dist/languages/profile-helpers.d.ts.map +1 -0
- package/dist/languages/profiles/additional.d.ts +3 -0
- package/dist/languages/profiles/additional.d.ts.map +1 -0
- package/dist/languages/profiles/primary.d.ts +3 -0
- package/dist/languages/profiles/primary.d.ts.map +1 -0
- package/dist/languages/registry.d.ts +11 -0
- package/dist/languages/registry.d.ts.map +1 -0
- package/dist/languages/tool.d.ts +32 -0
- package/dist/languages/tool.d.ts.map +1 -0
- package/dist/languages/types.d.ts +207 -0
- package/dist/languages/types.d.ts.map +1 -0
- package/dist/lint.d.ts +4 -5
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +2415 -27
- package/dist/lint.js.map +7 -1
- package/dist/logs.d.ts +4 -5
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +16 -10
- package/dist/logs.js.map +7 -1
- package/dist/memory.d.ts +7 -8
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +7 -5
- package/dist/memory.js.map +7 -1
- package/dist/mode.d.ts +4 -5
- package/dist/mode.d.ts.map +1 -0
- package/dist/mode.js +3 -3
- package/dist/mode.js.map +7 -1
- package/dist/next-steps.d.ts +5 -6
- package/dist/next-steps.d.ts.map +1 -0
- package/dist/next-steps.js +5 -4
- package/dist/next-steps.js.map +7 -1
- package/dist/outdated.d.ts +4 -5
- package/dist/outdated.d.ts.map +1 -0
- package/dist/outdated.js +4777 -68
- package/dist/outdated.js.map +7 -1
- package/dist/pack.d.ts +3 -6
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +5275 -1019
- package/dist/pack.js.map +7 -1
- package/dist/patch.d.ts +4 -5
- package/dist/patch.d.ts.map +1 -0
- package/dist/patch.js +18 -16
- package/dist/patch.js.map +7 -1
- package/dist/plan.d.ts +55 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +280 -0
- package/dist/plan.js.map +7 -0
- package/dist/process-guardian.d.ts +100 -0
- package/dist/process-guardian.d.ts.map +1 -0
- package/dist/process-registry-persistent.d.ts +121 -0
- package/dist/process-registry-persistent.d.ts.map +1 -0
- package/dist/process-registry.d.ts +13 -17
- package/dist/process-registry.d.ts.map +1 -0
- package/dist/process-registry.js +15 -9
- package/dist/process-registry.js.map +7 -1
- package/dist/ps-slash.d.ts +106 -0
- package/dist/ps-slash.d.ts.map +1 -0
- package/dist/ps-slash.js +1291 -0
- package/dist/ps-slash.js.map +7 -0
- package/dist/read.d.ts +4 -5
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +13 -11
- package/dist/read.js.map +7 -1
- package/dist/replace.d.ts +4 -5
- package/dist/replace.d.ts.map +1 -0
- package/dist/replace.js +26 -13
- package/dist/replace.js.map +7 -1
- package/dist/scaffold.d.ts +4 -5
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +16 -14
- package/dist/scaffold.js.map +7 -1
- package/dist/search.d.ts +5 -6
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +24 -25
- package/dist/search.js.map +7 -1
- package/dist/set-working-dir.d.ts +18 -0
- package/dist/set-working-dir.d.ts.map +1 -0
- package/dist/shim/node-sqlite.d.ts +3 -0
- package/dist/shim/node-sqlite.d.ts.map +1 -0
- package/dist/skill.d.ts +45 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +175 -0
- package/dist/skill.js.map +7 -0
- package/dist/spawn-background.d.ts +80 -0
- package/dist/spawn-background.d.ts.map +1 -0
- package/dist/task.d.ts +35 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +380 -0
- package/dist/task.js.map +7 -0
- package/dist/test.d.ts +4 -5
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +2419 -27
- package/dist/test.js.map +7 -1
- package/dist/todo.d.ts +4 -5
- package/dist/todo.d.ts.map +1 -0
- package/dist/todo.js +5 -5
- package/dist/todo.js.map +7 -1
- package/dist/tool-diff.d.ts +16 -17
- package/dist/tool-diff.d.ts.map +1 -0
- package/dist/tool-diff.js +11 -3
- package/dist/tool-diff.js.map +7 -1
- package/dist/tool-help.d.ts +4 -5
- package/dist/tool-help.d.ts.map +1 -0
- package/dist/tool-help.js +3 -3
- package/dist/tool-help.js.map +7 -1
- package/dist/tool-icon-map.d.ts +45 -0
- package/dist/tool-icon-map.d.ts.map +1 -0
- package/dist/tool-icons.d.ts +5 -6
- package/dist/tool-icons.d.ts.map +1 -0
- package/dist/tool-icons.js +16 -4
- package/dist/tool-icons.js.map +7 -1
- package/dist/tool-search.d.ts +4 -5
- package/dist/tool-search.d.ts.map +1 -0
- package/dist/tool-search.js +3 -3
- package/dist/tool-search.js.map +7 -1
- package/dist/tool-summary.d.ts +4 -5
- package/dist/tool-summary.d.ts.map +1 -0
- package/dist/tool-summary.js +5 -3
- package/dist/tool-summary.js.map +7 -1
- package/dist/tool-use.d.ts +4 -5
- package/dist/tool-use.d.ts.map +1 -0
- package/dist/tool-use.js +3 -3
- package/dist/tool-use.js.map +7 -1
- package/dist/tree.d.ts +4 -5
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +11 -9
- package/dist/tree.js.map +7 -1
- package/dist/typecheck.d.ts +4 -5
- package/dist/typecheck.d.ts.map +1 -0
- package/dist/typecheck.js +2416 -28
- package/dist/typecheck.js.map +7 -1
- package/dist/write.d.ts +4 -5
- package/dist/write.d.ts.map +1 -0
- package/dist/write.js +21 -16
- package/dist/write.js.map +7 -1
- package/package.json +34 -6
- package/dist/background-indexer-BeDBxfSh.d.ts +0 -371
- package/dist/exec-2OKoT6tk.d.ts +0 -121
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type DangerAssessment, type DangerLevel, detectDanger } from './_danger-detect.js';
|
|
2
|
+
export { type EnsureSessionShellOptions, ensureSessionShell, normalizeShell, type ResolveSessionShellDeps, resolveSessionShell, } from './_session-shell.js';
|
|
3
|
+
export type { BashShell } from './_shell-pick.js';
|
|
2
4
|
export { auditTool } from './audit.js';
|
|
3
5
|
export { bashTool } from './bash.js';
|
|
4
6
|
export { batchToolUseTool } from './batch-tool-use.js';
|
|
5
|
-
export { OPTIONAL_TOOLS, TIER1_TOOLS, TIER2_TOOLS, TIER3_TOOLS
|
|
6
|
-
export { CircuitBreaker, CircuitBreakerConfig, CircuitBreakerSnapshot } from './circuit-breaker.js';
|
|
7
|
-
export {
|
|
8
|
-
|
|
7
|
+
export { builtinTools, OPTIONAL_TOOLS, TIER1_TOOLS, TIER2_TOOLS, TIER3_TOOLS } from './builtin.js';
|
|
8
|
+
export { CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerSnapshot, } from './circuit-breaker.js';
|
|
9
|
+
export type { CircuitSnapshot, CircuitState } from './codebase-index/index.js';
|
|
10
|
+
export { CircuitOpenError, cancelPendingReindexes, codebaseIndexStats, codebaseIndexTool, codebaseSearchTool, codebaseStatsTool, enqueueReindex, getIndexState, IndexCircuitBreaker, IndexTimeoutError, indexCircuitBreaker, isIndexableFile, isIndexing, isIndexReady, onIndexStateChange, resetIndexCircuitBreaker, runStartupIndex, searchCodebaseIndex, shutdownCodebaseIndexHost, } from './codebase-index/index.js';
|
|
11
|
+
export { designTool } from './design.js';
|
|
9
12
|
export { diffTool } from './diff.js';
|
|
10
13
|
export { documentTool } from './document.js';
|
|
11
14
|
export { editTool } from './edit.js';
|
|
15
|
+
export { configureDangerBypass, configureExecPolicy, execTool, getDangerBypass, getExecAllowlist, isExecCommandAllowed, resetDangerBypass, resetExecPolicy, } from './exec.js';
|
|
12
16
|
export { fetchTool } from './fetch.js';
|
|
13
17
|
export { formatTool } from './format.js';
|
|
14
18
|
export { gitTool } from './git.js';
|
|
@@ -16,7 +20,8 @@ export { globTool } from './glob.js';
|
|
|
16
20
|
export { grepTool } from './grep.js';
|
|
17
21
|
export { installTool } from './install.js';
|
|
18
22
|
export { jsonTool } from './json.js';
|
|
19
|
-
|
|
23
|
+
export { kanbanTool } from './kanban.js';
|
|
24
|
+
export * from './languages/index.js';
|
|
20
25
|
export { lintTool } from './lint.js';
|
|
21
26
|
export { logsTool } from './logs.js';
|
|
22
27
|
export { forgetTool, relatedMemoryTool, rememberTool, searchMemoryTool } from './memory.js';
|
|
@@ -24,733 +29,23 @@ export { createModeTool } from './mode.js';
|
|
|
24
29
|
export { outdatedTool } from './outdated.js';
|
|
25
30
|
export { builtinToolsPack } from './pack.js';
|
|
26
31
|
export { patchTool } from './patch.js';
|
|
27
|
-
|
|
28
|
-
export {
|
|
32
|
+
export { planTool } from './plan.js';
|
|
33
|
+
export { getProcessGuardian, type ProcessGuardianConfig, startProcessGuardian, stopProcessGuardian, } from './process-guardian.js';
|
|
34
|
+
export { _resetProcessRegistry, type BreakerCountdown, getProcessRegistry, type KillOpts, type ProcessRegistryImpl, type RegistryStats, type TrackedProcess, } from './process-registry.js';
|
|
35
|
+
export { getPersistentProcessRegistry, type PersistentProcessEntry, type PersistentRegistryData, resetPersistentProcessRegistry, } from './process-registry-persistent.js';
|
|
36
|
+
export { createGlobalPsSlashCommand, formatGlobalStatus, formatInstanceList, formatInstanceSummary, type GlobalProcessStatus, getInstanceCount, type InstanceInfo, type InstanceListOptions, listInstances, } from './ps-slash.js';
|
|
29
37
|
export { readTool } from './read.js';
|
|
30
38
|
export { replaceTool } from './replace.js';
|
|
31
39
|
export { scaffoldTool } from './scaffold.js';
|
|
32
40
|
export { searchTool } from './search.js';
|
|
41
|
+
export { makeSkillTool } from './skill.js';
|
|
33
42
|
export { testTool } from './test.js';
|
|
34
43
|
export { todoTool } from './todo.js';
|
|
35
44
|
export { toolHelpTool } from './tool-help.js';
|
|
45
|
+
export { FALLBACK_ICON, getToolIcon, TOOL_ICON_CONFIG, TOOL_ICON_MAP, type ToolIconConfig, type ToolIconId, } from './tool-icon-map.js';
|
|
36
46
|
export { toolSearchTool } from './tool-search.js';
|
|
37
47
|
export { toolUseTool } from './tool-use.js';
|
|
38
48
|
export { treeTool } from './tree.js';
|
|
39
49
|
export { typecheckTool } from './typecheck.js';
|
|
40
50
|
export { writeTool } from './write.js';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Shell picker for the `bash` tool on Windows.
|
|
45
|
-
*
|
|
46
|
-
* Historically the bash tool always fell back to `cmd.exe` on Windows — a
|
|
47
|
-
* reasonable default for the small set of POSIX-style commands the tool was
|
|
48
|
-
* built around (`echo`, `dir`, `cd`, `set`, etc.). That breaks when the
|
|
49
|
-
* caller emits PowerShell-style commands (e.g. Codex on Windows routinely
|
|
50
|
-
* emits `Get-Content`, `Get-ChildItem`, `Set-Location`, …), which `cmd.exe`
|
|
51
|
-
* rejects with "'Get-Content' is not recognized as an internal or external
|
|
52
|
-
* command, operable program or batch file." This module decides — purely from
|
|
53
|
-
* the command string and a few well-known env vars — which shell should run
|
|
54
|
-
* the command. It returns a tagged value; bash.ts does the actual spawn.
|
|
55
|
-
*
|
|
56
|
-
* The picker never spawns anything itself, so it is safe to unit-test in
|
|
57
|
-
* isolation. Shell *resolution* (finding the actual binary on PATH) lives in
|
|
58
|
-
* `_win32-resolve.ts` and runs at spawn time.
|
|
59
|
-
* @see {@link ../../docs/configuration.md#windows-shell-selection-wrongstackshell} for user-facing documentation of the WRONGSTACK_SHELL env var and auto-detection behavior.
|
|
60
|
-
*
|
|
61
|
-
* Selection precedence (Windows only):
|
|
62
|
-
* 1. `WRONGSTACK_SHELL` env var, if it names a known shell (cmd | powershell
|
|
63
|
-
* | pwsh). This is the override for users who want a fixed shell.
|
|
64
|
-
* 2. Auto-detect: if the command "looks like" PowerShell — i.e. uses cmdlet
|
|
65
|
-
* verb-noun syntax, $-variables, subexpressions, here-strings, etc. —
|
|
66
|
-
* route to PowerShell. Prefers `pwsh` (PowerShell 7+) and falls back to
|
|
67
|
-
* `powershell` (Windows PowerShell 5.1) at spawn time.
|
|
68
|
-
* 3. Default: `cmd.exe` (preserves legacy behavior).
|
|
69
|
-
*
|
|
70
|
-
* On non-Windows the picker is a no-op — bash.ts already routes through
|
|
71
|
-
* `/bin/bash -c`. We return `'cmd'` as a sentinel value that means "the
|
|
72
|
-
* platform default"; bash.ts maps it to the right binary.
|
|
73
|
-
*
|
|
74
|
-
* See docs/configuration.md § "Windows shell selection (WRONGSTACK_SHELL)" for
|
|
75
|
-
* user-facing documentation of the env var and auto-detection behaviour.
|
|
76
|
-
*/
|
|
77
|
-
type BashShell = 'cmd' | 'powershell' | 'pwsh';
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Session-shell resolution for Windows.
|
|
81
|
-
*
|
|
82
|
-
* `pickShell` (`_shell-pick.ts`) decides the shell *per command* — it inspects
|
|
83
|
-
* each command string and routes PowerShell-looking work to PowerShell, else
|
|
84
|
-
* `cmd.exe`. That keeps individual commands working, but it means the shell the
|
|
85
|
-
* model is *told* about (the system-prompt Environment block) and the shell that
|
|
86
|
-
* actually runs a given command can disagree, and a plain command like
|
|
87
|
-
* `git status` silently lands in `cmd.exe` while `Get-ChildItem` lands in
|
|
88
|
-
* PowerShell. The model has no stable target to write syntax for.
|
|
89
|
-
*
|
|
90
|
-
* This module resolves ONE shell for the whole session and pins it via the
|
|
91
|
-
* `WRONGSTACK_SHELL` env var. Because `WRONGSTACK_SHELL` is already the top
|
|
92
|
-
* precedence in `pickShell`, pinning it makes every command route to the same
|
|
93
|
-
* shell with zero changes to `bash.ts` — and the system-prompt builder can read
|
|
94
|
-
* the same env var to tell the model exactly which shell + syntax to use.
|
|
95
|
-
*
|
|
96
|
-
* Resolution (Windows only — POSIX has no fixed session shell here; `bash.ts`
|
|
97
|
-
* routes through `/bin/bash -c` and honours an explicit `WRONGSTACK_SHELL` as a
|
|
98
|
-
* binary path):
|
|
99
|
-
* 1. A valid user-set `WRONGSTACK_SHELL` (cmd | powershell | pwsh) wins and is
|
|
100
|
-
* left untouched.
|
|
101
|
-
* 2. Otherwise prefer `pwsh` (PowerShell 7+) when `pwsh.exe` is on PATH.
|
|
102
|
-
* 3. Otherwise `powershell` (Windows PowerShell 5.1).
|
|
103
|
-
* 4. Otherwise `cmd` (only when no PowerShell is installed — effectively never
|
|
104
|
-
* on a real Windows box).
|
|
105
|
-
*
|
|
106
|
-
* @see {@link ../../docs/configuration.md#windows-shell-selection-wrongstackshell}
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Map a raw `WRONGSTACK_SHELL` value (which may carry a `.exe` suffix or odd
|
|
111
|
-
* casing) to a canonical {@link BashShell}, or `undefined` when it is unset /
|
|
112
|
-
* not a known shell. Mirrors the override parsing in `pickShell`.
|
|
113
|
-
*/
|
|
114
|
-
declare function normalizeShell(value: string | undefined): BashShell | undefined;
|
|
115
|
-
interface ResolveSessionShellDeps {
|
|
116
|
-
/**
|
|
117
|
-
* Returns true when `bin` (e.g. `'pwsh.exe'`) resolves on PATH. Injectable so
|
|
118
|
-
* the resolver is unit-testable off-Windows; defaults to `resolveWin32Command`
|
|
119
|
-
* (which itself short-circuits to "not found" when `process.platform` is not
|
|
120
|
-
* win32).
|
|
121
|
-
*/
|
|
122
|
-
hasBinary?: ((bin: string) => boolean) | undefined;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Pure decision: which single shell should the session use on `platform`?
|
|
126
|
-
* Returns `undefined` on non-win32 (no fixed session shell). Does not mutate
|
|
127
|
-
* anything.
|
|
128
|
-
*/
|
|
129
|
-
declare function resolveSessionShell(platform: NodeJS.Platform, env: {
|
|
130
|
-
get(key: string): string | undefined;
|
|
131
|
-
}, deps?: ResolveSessionShellDeps): BashShell | undefined;
|
|
132
|
-
interface EnsureSessionShellOptions {
|
|
133
|
-
/** Env to read/mutate. Defaults to `process.env`. */
|
|
134
|
-
env?: NodeJS.ProcessEnv | undefined;
|
|
135
|
-
/** Platform override (tests). Defaults to `process.platform`. */
|
|
136
|
-
platform?: NodeJS.Platform | undefined;
|
|
137
|
-
/** Binary-presence probe (tests). Forwarded to {@link resolveSessionShell}. */
|
|
138
|
-
hasBinary?: ((bin: string) => boolean) | undefined;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Resolve the session shell and pin it into `WRONGSTACK_SHELL` so the bash tool
|
|
142
|
-
* and the system-prompt builder agree on one stable value. Idempotent:
|
|
143
|
-
*
|
|
144
|
-
* - non-win32 → no-op, returns `undefined`.
|
|
145
|
-
* - a valid user-set `WRONGSTACK_SHELL` → returned as-is, env left untouched.
|
|
146
|
-
* - otherwise → resolves, writes the canonical value into the env, returns it.
|
|
147
|
-
*
|
|
148
|
-
* Call this once at process boot, before the system-prompt builder is built.
|
|
149
|
-
*/
|
|
150
|
-
declare function ensureSessionShell(opts?: EnsureSessionShellOptions): BashShell | undefined;
|
|
151
|
-
|
|
152
|
-
type Overrides = Record<string, string>;
|
|
153
|
-
interface DesignInput {
|
|
154
|
-
action?: 'list' | 'use' | 'foundations' | 'set' | 'materialize' | 'verify' | undefined;
|
|
155
|
-
kit?: string | undefined;
|
|
156
|
-
stack?: string | undefined;
|
|
157
|
-
/** action "set" / "use": token overrides, e.g. { primary: "oklch(...)", "dark.bg": "#111" }. */
|
|
158
|
-
set?: Overrides | undefined;
|
|
159
|
-
/** action "materialize": output path (project-relative); defaults per stack. */
|
|
160
|
-
out?: string | undefined;
|
|
161
|
-
/** action "materialize": overwrite an existing file. */
|
|
162
|
-
force?: boolean | undefined;
|
|
163
|
-
/** action "verify": explicit files to scan (project-relative). Defaults to a UI-file walk. */
|
|
164
|
-
files?: string[] | undefined;
|
|
165
|
-
}
|
|
166
|
-
interface DesignOutput {
|
|
167
|
-
action: string;
|
|
168
|
-
kit?: string | undefined;
|
|
169
|
-
stack?: string | undefined;
|
|
170
|
-
output: string;
|
|
171
|
-
/** action "materialize": where the theme file was (or would be) written. */
|
|
172
|
-
path?: string | undefined;
|
|
173
|
-
/** action "verify": adherence score 0..1 and violation count. */
|
|
174
|
-
score?: number | undefined;
|
|
175
|
-
violations?: number | undefined;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Design Studio tool — progressive disclosure + token enforcement.
|
|
179
|
-
*
|
|
180
|
-
* `list`/`use`/`foundations` browse and pin kits. `set` records structured color
|
|
181
|
-
* overrides (these win over kit tokens). `materialize` writes the active kit's
|
|
182
|
-
* (override-applied) tokens to a real, stack-appropriate theme file so the
|
|
183
|
-
* palette becomes the codebase's source of truth — not just a prompt hint.
|
|
184
|
-
* `verify` scans UI files for off-palette drift.
|
|
185
|
-
*/
|
|
186
|
-
declare const designTool: Tool<DesignInput, DesignOutput>;
|
|
187
|
-
|
|
188
|
-
type KanbanAction = 'list_boards' | 'get_board' | 'create_board' | 'duplicate_board' | 'update_board' | 'delete_board' | 'generate_board' | 'export_markdown' | 'export_task_graph' | 'sync_task_graph' | 'search_tasks' | 'ready_tasks' | 'snapshot' | 'add_column' | 'update_column' | 'delete_column' | 'add_task' | 'split_task' | 'merge_tasks' | 'copy_task' | 'transfer_task' | 'get_task' | 'update_task' | 'move_task' | 'delete_task' | 'set_chain' | 'get_chain' | 'claim_task' | 'release_task' | 'assign_task' | 'mark_assignment' | 'heartbeat_assignment' | 'recover_stale' | 'events' | 'queue_health' | 'add_dependency' | 'add_goal_metric' | 'update_goal_metric' | 'add_check' | 'update_check' | 'add_note' | 'add_link';
|
|
189
|
-
interface KanbanToolInput extends Omit<AssignKanbanTaskInput, 'status'> {
|
|
190
|
-
action: KanbanAction;
|
|
191
|
-
boardId?: string | undefined;
|
|
192
|
-
taskId?: string | undefined;
|
|
193
|
-
columnId?: string | undefined;
|
|
194
|
-
targetBoardId?: string | undefined;
|
|
195
|
-
taskIds?: string[] | undefined;
|
|
196
|
-
chainId?: string | undefined;
|
|
197
|
-
title?: string | undefined;
|
|
198
|
-
description?: string | undefined;
|
|
199
|
-
tags?: string[] | undefined;
|
|
200
|
-
labels?: string[] | undefined;
|
|
201
|
-
priority?: KanbanTaskPriority | undefined;
|
|
202
|
-
status?: KanbanTaskStatus | undefined;
|
|
203
|
-
order?: number | undefined;
|
|
204
|
-
targetColumnId?: string | undefined;
|
|
205
|
-
moveTasksToColumnId?: string | undefined;
|
|
206
|
-
query?: string | undefined;
|
|
207
|
-
limit?: number | undefined;
|
|
208
|
-
dependencyTaskId?: string | undefined;
|
|
209
|
-
enforceDependencies?: boolean | undefined;
|
|
210
|
-
childTitles?: string[] | undefined;
|
|
211
|
-
inheritAssignment?: boolean | undefined;
|
|
212
|
-
inheritLabels?: boolean | undefined;
|
|
213
|
-
inheritSuccessCriteria?: boolean | undefined;
|
|
214
|
-
inheritGoalMetrics?: boolean | undefined;
|
|
215
|
-
inheritDependencies?: boolean | undefined;
|
|
216
|
-
chainChildren?: boolean | undefined;
|
|
217
|
-
rewireDependents?: boolean | undefined;
|
|
218
|
-
closeSourceTasks?: boolean | undefined;
|
|
219
|
-
metricId?: string | undefined;
|
|
220
|
-
metricName?: string | undefined;
|
|
221
|
-
metricTarget?: string | number | undefined;
|
|
222
|
-
metricCurrent?: string | number | undefined;
|
|
223
|
-
metricUnit?: string | undefined;
|
|
224
|
-
metricStatus?: 'pending' | 'met' | 'missed' | 'waived' | undefined;
|
|
225
|
-
metricNotes?: string | undefined;
|
|
226
|
-
checkId?: string | undefined;
|
|
227
|
-
checkDescription?: string | undefined;
|
|
228
|
-
checkStatus?: 'pending' | 'passed' | 'failed' | 'skipped' | undefined;
|
|
229
|
-
note?: string | undefined;
|
|
230
|
-
author?: string | undefined;
|
|
231
|
-
url?: string | undefined;
|
|
232
|
-
linkTitle?: string | undefined;
|
|
233
|
-
linkType?: 'issue' | 'pr' | 'doc' | 'commit' | 'design' | 'file' | 'url' | 'other' | undefined;
|
|
234
|
-
context?: string | undefined;
|
|
235
|
-
columns?: string[] | undefined;
|
|
236
|
-
generatedBy?: string | undefined;
|
|
237
|
-
includeTasks?: boolean | undefined;
|
|
238
|
-
includeCompletedTasks?: boolean | undefined;
|
|
239
|
-
preserveAssignment?: boolean | undefined;
|
|
240
|
-
preserveDependencies?: boolean | undefined;
|
|
241
|
-
leaseId?: string | undefined;
|
|
242
|
-
claimedAt?: string | undefined;
|
|
243
|
-
heartbeatAt?: string | undefined;
|
|
244
|
-
leaseExpiresAt?: string | undefined;
|
|
245
|
-
attempt?: number | undefined;
|
|
246
|
-
maxAttempts?: number | undefined;
|
|
247
|
-
costCeilingUsd?: number | undefined;
|
|
248
|
-
retryPolicy?: 'off' | 'incremental' | 'exponential' | undefined;
|
|
249
|
-
lastFailureKind?: string | undefined;
|
|
250
|
-
subagentId?: string | undefined;
|
|
251
|
-
runTaskId?: string | undefined;
|
|
252
|
-
lastResult?: string | undefined;
|
|
253
|
-
error?: string | undefined;
|
|
254
|
-
assignmentStatus?: KanbanAgentRunStatus | undefined;
|
|
255
|
-
releaseStatus?: 'pending' | 'ready' | 'blocked' | undefined;
|
|
256
|
-
releaseReason?: string | undefined;
|
|
257
|
-
clearAssignee?: boolean | undefined;
|
|
258
|
-
recoveryMode?: 'auto' | 'release' | 'retry' | 'fail' | undefined;
|
|
259
|
-
recoveryNow?: string | undefined;
|
|
260
|
-
recoveryPolicyFailOnCostCeiling?: boolean | undefined;
|
|
261
|
-
recoveryPolicyReleaseOnFailureKinds?: string[] | undefined;
|
|
262
|
-
recoveryPolicyReleaseOnHeartbeatDue?: boolean | undefined;
|
|
263
|
-
recoveryPolicyRetryPolicyOverride?: 'off' | 'incremental' | 'exponential' | undefined;
|
|
264
|
-
taskGraph?: unknown;
|
|
265
|
-
graphId?: string | undefined;
|
|
266
|
-
specId?: string | undefined;
|
|
267
|
-
sourceSystem?: string | undefined;
|
|
268
|
-
phaseId?: string | undefined;
|
|
269
|
-
preserveOriginTaskIds?: boolean | undefined;
|
|
270
|
-
includeArchived?: boolean | undefined;
|
|
271
|
-
archiveMissingTasks?: boolean | undefined;
|
|
272
|
-
preserveManualDependencies?: boolean | undefined;
|
|
273
|
-
}
|
|
274
|
-
interface KanbanToolOutput {
|
|
275
|
-
ok: boolean;
|
|
276
|
-
message: string;
|
|
277
|
-
board?: KanbanBoard | undefined;
|
|
278
|
-
boards?: KanbanBoardSummary[] | undefined;
|
|
279
|
-
task?: KanbanTask | undefined;
|
|
280
|
-
tasks?: KanbanSearchResult[] | undefined;
|
|
281
|
-
recoveredTasks?: KanbanTask[] | undefined;
|
|
282
|
-
events?: KanbanEvent[] | undefined;
|
|
283
|
-
queueHealth?: KanbanQueueHealth | undefined;
|
|
284
|
-
children?: KanbanTask[] | undefined;
|
|
285
|
-
chain?: KanbanTask[] | undefined;
|
|
286
|
-
snapshot?: KanbanOrchestrationSnapshot | undefined;
|
|
287
|
-
taskGraph?: SerializedTaskGraph | undefined;
|
|
288
|
-
markdown?: string | undefined;
|
|
289
|
-
}
|
|
290
|
-
declare const kanbanTool: Tool<KanbanToolInput, KanbanToolOutput>;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* `planTool` — the LLM-callable counterpart to the `/plan` slash command.
|
|
294
|
-
*
|
|
295
|
-
* Plans capture strategic, multi-step approaches that survive across
|
|
296
|
-
* session resumes (unlike todos, which are tactical and per-turn).
|
|
297
|
-
* Storage path comes from `ctx.meta['plan.path']` — the CLI seeds this
|
|
298
|
-
* during startup so the tool always knows where to read/write.
|
|
299
|
-
*
|
|
300
|
-
* One tool, multiple actions, JSON in/out. The action discriminates the
|
|
301
|
-
* operation so the LLM can do show / add / start / done / remove / promote /
|
|
302
|
-
* derive / template_use / clear via a single tool registration instead of
|
|
303
|
-
* bloating the surface with nine near-identical tools.
|
|
304
|
-
*/
|
|
305
|
-
interface PlanInput {
|
|
306
|
-
action: 'show' | 'add' | 'start' | 'done' | 'remove' | 'promote' | 'template_use' | 'clear' | 'taskify';
|
|
307
|
-
/** Required for add. */
|
|
308
|
-
title?: string | undefined;
|
|
309
|
-
/** Optional detail line for add. */
|
|
310
|
-
details?: string | undefined;
|
|
311
|
-
/** Required for start/done/remove/promote — accepts plan item id OR 1-based index OR title substring. */
|
|
312
|
-
target?: string | undefined;
|
|
313
|
-
/** Optional subtasks for promote. If omitted, a single todo is created from the plan item title. */
|
|
314
|
-
subtasks?: string[] | undefined;
|
|
315
|
-
/** Required for template_use — the template name (e.g. "new-feature", "bug-fix"). */
|
|
316
|
-
template?: string | undefined;
|
|
317
|
-
/**
|
|
318
|
-
* Storage scope. Default (unset): uses the session-scoped path — isolated to this
|
|
319
|
-
* session, survives resume within the same session.
|
|
320
|
-
* `scope: 'project'`: uses a shared project-level path, visible to all sessions
|
|
321
|
-
* for this project. Useful for a shared roadmap that outlasts any single session.
|
|
322
|
-
*/
|
|
323
|
-
scope?: 'session' | 'project';
|
|
324
|
-
}
|
|
325
|
-
interface PlanOutput {
|
|
326
|
-
ok: boolean;
|
|
327
|
-
message: string;
|
|
328
|
-
/** Formatted plan after the operation. Same string the user sees from `/plan show`. */
|
|
329
|
-
plan: string;
|
|
330
|
-
/** Total item count after the operation. */
|
|
331
|
-
count: number;
|
|
332
|
-
/** Number of items not in 'done' status. */
|
|
333
|
-
open: number;
|
|
334
|
-
/** When promote/derive succeed, the generated todo items so the caller can inspect them. */
|
|
335
|
-
todos?: Array<{
|
|
336
|
-
id: string;
|
|
337
|
-
content: string;
|
|
338
|
-
status: string;
|
|
339
|
-
activeForm?: string | undefined;
|
|
340
|
-
promotedFromPlan?: string | undefined;
|
|
341
|
-
}>;
|
|
342
|
-
}
|
|
343
|
-
declare const planTool: Tool<PlanInput, PlanOutput>;
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Process Guardian — Protects WrongStack processes from being killed via
|
|
347
|
-
* bash/kill commands. Runs as a watchdog that:
|
|
348
|
-
*
|
|
349
|
-
* 1. Registers the main process and all children with persistent registry
|
|
350
|
-
* 2. Monitors for kill attempts against protected PIDs
|
|
351
|
-
* 3. Provides recovery mechanisms when killed processes are detected
|
|
352
|
-
* 4. Coordinates protection across multiple WrongStack instances
|
|
353
|
-
*
|
|
354
|
-
* This is NOT a security mechanism against intentional root-level kills.
|
|
355
|
-
* A user with sudo/root can still kill any process. This is a guardrail
|
|
356
|
-
* to prevent accidental kills from the WrongStack agent itself.
|
|
357
|
-
*/
|
|
358
|
-
interface ProcessGuardianConfig {
|
|
359
|
-
/** Interval for heartbeat in ms */
|
|
360
|
-
heartbeatIntervalMs?: number;
|
|
361
|
-
/** Enable automatic process resurrection */
|
|
362
|
-
autoResurrect?: boolean;
|
|
363
|
-
/** Maximum resurrection attempts */
|
|
364
|
-
maxResurrectionAttempts?: number;
|
|
365
|
-
/** Custom protection patterns */
|
|
366
|
-
protectedPatterns?: string[];
|
|
367
|
-
/**
|
|
368
|
-
* How many SIGTERM signals to tolerate before exiting.
|
|
369
|
-
* The first N-1 are ignored to protect against accidental `kill` from the
|
|
370
|
-
* AI agent; the Nth triggers graceful shutdown via `stop()` + `process.exit(0)`.
|
|
371
|
-
* Default 3 — balances AI guardrail vs container orchestration (Docker,
|
|
372
|
-
* systemd repeat SIGTERM up to StopTimeout ~10s, then SIGKILL).
|
|
373
|
-
* Set to 0 to always exit on the first SIGTERM, or Infinity to never exit.
|
|
374
|
-
*/
|
|
375
|
-
sigtermThreshold?: number;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Process Guardian watches over WrongStack processes and prevents accidental kills.
|
|
379
|
-
*/
|
|
380
|
-
declare class ProcessGuardian {
|
|
381
|
-
private readonly registry;
|
|
382
|
-
private readonly config;
|
|
383
|
-
private readonly protectedProcesses;
|
|
384
|
-
private heartbeatTimer;
|
|
385
|
-
private isRunning;
|
|
386
|
-
private instanceId;
|
|
387
|
-
private sigtermCount;
|
|
388
|
-
constructor(config?: ProcessGuardianConfig);
|
|
389
|
-
/**
|
|
390
|
-
* Start the guardian - begins monitoring and registration.
|
|
391
|
-
*/
|
|
392
|
-
start(): void;
|
|
393
|
-
/**
|
|
394
|
-
* Stop the guardian gracefully.
|
|
395
|
-
*/
|
|
396
|
-
stop(): void;
|
|
397
|
-
/**
|
|
398
|
-
* Register a process with the guardian.
|
|
399
|
-
*/
|
|
400
|
-
registerProcess(pid: number, name: string): void;
|
|
401
|
-
/**
|
|
402
|
-
* Unregister a process (e.g., when it exits normally).
|
|
403
|
-
*/
|
|
404
|
-
unregisterProcess(pid: number): void;
|
|
405
|
-
/**
|
|
406
|
-
* Register all child processes that already exist.
|
|
407
|
-
*/
|
|
408
|
-
private registerExistingChildren;
|
|
409
|
-
/**
|
|
410
|
-
* Sync protected processes with the base ProcessRegistry.
|
|
411
|
-
*/
|
|
412
|
-
private syncWithProcessRegistry;
|
|
413
|
-
/**
|
|
414
|
-
* Heartbeat - updates timestamps and checks for anomalies.
|
|
415
|
-
*/
|
|
416
|
-
private heartbeat;
|
|
417
|
-
/**
|
|
418
|
-
* Set up process-level event handlers.
|
|
419
|
-
*/
|
|
420
|
-
private setupProcessHandlers;
|
|
421
|
-
/**
|
|
422
|
-
* Check if a PID is protected by this guardian.
|
|
423
|
-
*/
|
|
424
|
-
isProtected(pid: number): boolean;
|
|
425
|
-
/**
|
|
426
|
-
* Get all PIDs protected by this guardian.
|
|
427
|
-
*/
|
|
428
|
-
getProtectedPids(): number[];
|
|
429
|
-
/**
|
|
430
|
-
* Get status information for monitoring.
|
|
431
|
-
*/
|
|
432
|
-
getStatus(): {
|
|
433
|
-
instanceId: string;
|
|
434
|
-
mainPid: number;
|
|
435
|
-
protectedCount: number;
|
|
436
|
-
platform: string;
|
|
437
|
-
hostname: string;
|
|
438
|
-
uptime: number;
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
declare function getProcessGuardian(): ProcessGuardian;
|
|
442
|
-
declare function startProcessGuardian(config?: ProcessGuardianConfig): ProcessGuardian;
|
|
443
|
-
declare function stopProcessGuardian(): void;
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* PersistentProcessRegistry — filesystem-backed process registry that survives
|
|
447
|
-
* process restarts and coordinates protection across multiple WrongStack instances
|
|
448
|
-
* running in different terminals.
|
|
449
|
-
*
|
|
450
|
-
* Key features:
|
|
451
|
-
* - PIDs stored in ~/.wrongstack/process-registry.json
|
|
452
|
-
* - File locking for cross-instance coordination
|
|
453
|
-
* - Heartbeat mechanism to detect stale entries
|
|
454
|
-
* - Protection whitelist that blocks kill commands targeting WrongStack processes
|
|
455
|
-
* - Multi-instance awareness: all instances share the same protection state
|
|
456
|
-
*/
|
|
457
|
-
|
|
458
|
-
interface PersistentProcessEntry {
|
|
459
|
-
pid: number;
|
|
460
|
-
name: string;
|
|
461
|
-
command: string;
|
|
462
|
-
startedAt: number;
|
|
463
|
-
lastHeartbeat: number;
|
|
464
|
-
sessionId?: string;
|
|
465
|
-
instanceId: string;
|
|
466
|
-
/** Hostname where this process is running */
|
|
467
|
-
hostname: string;
|
|
468
|
-
protected: boolean;
|
|
469
|
-
/** How this process was spawned: 'fork' (child_process.fork), 'spawn' (child_process.spawn), 'main' (the main WrongStack process itself) */
|
|
470
|
-
spawnMode: 'fork' | 'spawn' | 'main';
|
|
471
|
-
/** Parent PID if spawned via fork/spawn */
|
|
472
|
-
parentPid?: number;
|
|
473
|
-
/** OS platform where this entry was created */
|
|
474
|
-
platform: string;
|
|
475
|
-
}
|
|
476
|
-
interface PersistentRegistryData {
|
|
477
|
-
version: 1;
|
|
478
|
-
instances: Map<string, PersistentProcessEntry>;
|
|
479
|
-
protectedPatterns: string[];
|
|
480
|
-
lastCleanup: number;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* PersistentProcessRegistry wraps the in-memory ProcessRegistryImpl and
|
|
484
|
-
* synchronizes entries to a filesystem-backed store for cross-instance coordination.
|
|
485
|
-
*/
|
|
486
|
-
declare class PersistentProcessRegistry {
|
|
487
|
-
private readonly instanceId;
|
|
488
|
-
private readonly registryPath;
|
|
489
|
-
private readonly lockPath;
|
|
490
|
-
private readonly baseRegistry;
|
|
491
|
-
private heartbeatInterval;
|
|
492
|
-
private isShuttingDown;
|
|
493
|
-
constructor(baseRegistry?: ProcessRegistryImpl);
|
|
494
|
-
private ensureDirectory;
|
|
495
|
-
/**
|
|
496
|
-
* Start the heartbeat and periodic cleanup tasks.
|
|
497
|
-
*/
|
|
498
|
-
start(): void;
|
|
499
|
-
/**
|
|
500
|
-
* Stop the heartbeat and clean up.
|
|
501
|
-
*/
|
|
502
|
-
stop(): void;
|
|
503
|
-
/**
|
|
504
|
-
* Register the main WrongStack process as protected.
|
|
505
|
-
*/
|
|
506
|
-
registerMainProcess(): void;
|
|
507
|
-
/**
|
|
508
|
-
* Register a spawned child process with the persistent registry.
|
|
509
|
-
*/
|
|
510
|
-
registerChildProcess(pid: number, name: string, command: string, sessionId?: string, spawnMode?: 'spawn' | 'fork'): void;
|
|
511
|
-
/**
|
|
512
|
-
* Update or add an entry in the persistent registry.
|
|
513
|
-
*/
|
|
514
|
-
private updatePersistentEntry;
|
|
515
|
-
/**
|
|
516
|
-
* Unregister a process from the persistent registry.
|
|
517
|
-
*/
|
|
518
|
-
unregister(pid: number): Promise<void>;
|
|
519
|
-
/**
|
|
520
|
-
* Send heartbeat to mark all this instance's processes as alive.
|
|
521
|
-
*/
|
|
522
|
-
private heartbeat;
|
|
523
|
-
/**
|
|
524
|
-
* Sync this instance's processes to the persistent registry.
|
|
525
|
-
*/
|
|
526
|
-
private syncToPersistent;
|
|
527
|
-
/**
|
|
528
|
-
* Remove entries for processes that are no longer running.
|
|
529
|
-
*/
|
|
530
|
-
private cleanupStaleEntries;
|
|
531
|
-
/**
|
|
532
|
-
* Check if a PID belongs to a WrongStack process and should be protected.
|
|
533
|
-
*/
|
|
534
|
-
isProtectedPid(pid: number): Promise<boolean>;
|
|
535
|
-
/**
|
|
536
|
-
* Get all protected PIDs from all WrongStack instances.
|
|
537
|
-
*/
|
|
538
|
-
getAllProtectedPids(): Promise<number[]>;
|
|
539
|
-
/**
|
|
540
|
-
* Get complete status of all tracked processes across all instances.
|
|
541
|
-
*/
|
|
542
|
-
getGlobalStatus(): Promise<{
|
|
543
|
-
instances: Map<string, PersistentProcessEntry[]>;
|
|
544
|
-
totalProcesses: number;
|
|
545
|
-
protectedCount: number;
|
|
546
|
-
staleCount: number;
|
|
547
|
-
}>;
|
|
548
|
-
/**
|
|
549
|
-
* Get the instance ID for this process.
|
|
550
|
-
*/
|
|
551
|
-
getInstanceId(): string;
|
|
552
|
-
/**
|
|
553
|
-
* Check if a kill command should be blocked.
|
|
554
|
-
* Returns true if the kill should be blocked (target is a WrongStack process).
|
|
555
|
-
*/
|
|
556
|
-
shouldBlockKill(pid: number): Promise<boolean>;
|
|
557
|
-
/**
|
|
558
|
-
* Add a pattern-based protection rule.
|
|
559
|
-
* Processes whose command matches any protected pattern are protected.
|
|
560
|
-
*/
|
|
561
|
-
addProtectedPattern(pattern: string): Promise<void>;
|
|
562
|
-
}
|
|
563
|
-
declare function getPersistentProcessRegistry(): PersistentProcessRegistry;
|
|
564
|
-
declare function resetPersistentProcessRegistry(): void;
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Global Process Registry - Cross-Instance Process Tracking
|
|
568
|
-
*
|
|
569
|
-
* Provides functionality to list all WrongStack instances running on the system,
|
|
570
|
-
* track their processes, and display detailed status information.
|
|
571
|
-
*/
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Represents a WrongStack instance's aggregated information.
|
|
575
|
-
*/
|
|
576
|
-
interface InstanceInfo {
|
|
577
|
-
instanceId: string;
|
|
578
|
-
hostname: string;
|
|
579
|
-
mainPid: number;
|
|
580
|
-
startedAt: number;
|
|
581
|
-
lastActivity: number;
|
|
582
|
-
status: 'active' | 'idle' | 'stale';
|
|
583
|
-
processCount: number;
|
|
584
|
-
processes: PersistentProcessEntry[];
|
|
585
|
-
sessionIds: Set<string>;
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* Counts of instances by status.
|
|
589
|
-
*/
|
|
590
|
-
interface InstanceCounts {
|
|
591
|
-
total: number;
|
|
592
|
-
active: number;
|
|
593
|
-
idle: number;
|
|
594
|
-
stale: number;
|
|
595
|
-
byHostname: Map<string, number>;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Global process status encompassing all instances.
|
|
599
|
-
*/
|
|
600
|
-
interface GlobalProcessStatus {
|
|
601
|
-
localInstance: {
|
|
602
|
-
instanceId: string;
|
|
603
|
-
mainPid: number;
|
|
604
|
-
protectedCount: number;
|
|
605
|
-
platform: string;
|
|
606
|
-
hostname: string;
|
|
607
|
-
uptime: number;
|
|
608
|
-
};
|
|
609
|
-
allInstances: Array<{
|
|
610
|
-
instanceId: string;
|
|
611
|
-
hostname: string;
|
|
612
|
-
mainPid: number;
|
|
613
|
-
processes: PersistentProcessEntry[];
|
|
614
|
-
startedAt: number;
|
|
615
|
-
lastActivity: number;
|
|
616
|
-
}>;
|
|
617
|
-
summary: {
|
|
618
|
-
totalProcesses: number;
|
|
619
|
-
protectedCount: number;
|
|
620
|
-
staleCount: number;
|
|
621
|
-
instanceCount: number;
|
|
622
|
-
activeInstanceCount: number;
|
|
623
|
-
};
|
|
624
|
-
timestamp: number;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Options for filtering instance listings.
|
|
628
|
-
*/
|
|
629
|
-
interface InstanceListOptions {
|
|
630
|
-
/** Include stale instances in the list */
|
|
631
|
-
includeStale?: boolean;
|
|
632
|
-
/** Filter by hostname pattern (supports glob patterns) */
|
|
633
|
-
hostname?: string;
|
|
634
|
-
/** Filter by instance status */
|
|
635
|
-
status?: 'active' | 'idle' | 'stale' | 'all';
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Get list of all known instances (from persistent registry).
|
|
639
|
-
*/
|
|
640
|
-
declare function listInstances(options?: InstanceListOptions): Promise<InstanceInfo[]>;
|
|
641
|
-
/**
|
|
642
|
-
* Get counts of instances by status.
|
|
643
|
-
*/
|
|
644
|
-
declare function getInstanceCount(): Promise<InstanceCounts>;
|
|
645
|
-
/**
|
|
646
|
-
* Format the global status as a human-readable string for display.
|
|
647
|
-
*/
|
|
648
|
-
declare function formatGlobalStatus(): Promise<string>;
|
|
649
|
-
/**
|
|
650
|
-
* Format a clean instance list suitable for display.
|
|
651
|
-
*/
|
|
652
|
-
declare function formatInstanceList(options?: InstanceListOptions): Promise<string>;
|
|
653
|
-
/**
|
|
654
|
-
* Format instance details as a compact summary string.
|
|
655
|
-
*/
|
|
656
|
-
declare function formatInstanceSummary(): Promise<string>;
|
|
657
|
-
/**
|
|
658
|
-
* Create the global /ps slash command.
|
|
659
|
-
*/
|
|
660
|
-
declare function createGlobalPsSlashCommand(): {
|
|
661
|
-
name: "ps";
|
|
662
|
-
description: string;
|
|
663
|
-
handler(input: string): Promise<{
|
|
664
|
-
message: string;
|
|
665
|
-
}>;
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
interface SkillToolInput {
|
|
669
|
-
name: string;
|
|
670
|
-
/** Optional relative path of a bundled resource to load (e.g. `references/REF.md`, `scripts/extract.py`, `assets/template.html`). Omit to list resources. */
|
|
671
|
-
resource?: string | undefined;
|
|
672
|
-
}
|
|
673
|
-
interface SkillResource {
|
|
674
|
-
/** Path relative to the skill directory (e.g. `scripts/extract.py`). */
|
|
675
|
-
path: string;
|
|
676
|
-
bytes: number;
|
|
677
|
-
}
|
|
678
|
-
interface LoadedResource {
|
|
679
|
-
rel: string;
|
|
680
|
-
absPath: string;
|
|
681
|
-
content: string;
|
|
682
|
-
bytes: number;
|
|
683
|
-
truncated: boolean;
|
|
684
|
-
}
|
|
685
|
-
interface SkillToolOutput {
|
|
686
|
-
name: string;
|
|
687
|
-
description: string;
|
|
688
|
-
/** Frontmatter-stripped SKILL.md body (capped). */
|
|
689
|
-
body: string;
|
|
690
|
-
/** All bundled resource files (recursive), when no specific resource was requested. */
|
|
691
|
-
resources: SkillResource[];
|
|
692
|
-
/** Absolute directory of the skill — run scripts via bash using paths under here. */
|
|
693
|
-
dir: string;
|
|
694
|
-
/** When `resource` was requested: the loaded file. */
|
|
695
|
-
loadedResource?: LoadedResource | undefined;
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* Skill tool — the agentskills.io progressive-disclosure primitive.
|
|
699
|
-
*
|
|
700
|
-
* - `skill({ name })` → SKILL.md body + a recursive listing of every bundled
|
|
701
|
-
* resource file (scripts/ references/ assets/ templates/ … any subdir).
|
|
702
|
-
* - `skill({ name, resource })` → the content of that one resource file.
|
|
703
|
-
*
|
|
704
|
-
* Use this (not the `read` tool) to load skill resources: it works for foreign
|
|
705
|
-
* skills that live outside the project root (e.g. `~/.claude/skills/…`), which
|
|
706
|
-
* a project-root-restricted `read` tool may refuse. Scripts are returned with
|
|
707
|
-
* their absolute path so the agent can run them via `bash`.
|
|
708
|
-
*/
|
|
709
|
-
declare function makeSkillTool(skillLoader: SkillLoader): Tool<SkillToolInput, SkillToolOutput>;
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
* Shared tool icon mapping for all WrongStack UIs (WebUI, TUI, REPL).
|
|
713
|
-
*
|
|
714
|
-
* Each UI renders icons using its own library:
|
|
715
|
-
* - WebUI: lucide-react
|
|
716
|
-
* - TUI: ink icons or text characters
|
|
717
|
-
* - REPL: unicode characters or ASCII art
|
|
718
|
-
*
|
|
719
|
-
* This module exports the canonical tool → icon-name mapping.
|
|
720
|
-
* Add new tools here, never hardcode icon names in UI components.
|
|
721
|
-
*/
|
|
722
|
-
/**
|
|
723
|
-
* Icon identifiers — each UI maps these to its own icon library.
|
|
724
|
-
* Using a common set of identifiers ensures consistency across all surfaces.
|
|
725
|
-
*/
|
|
726
|
-
type ToolIconId = 'file' | 'edit' | 'search' | 'folder' | 'terminal' | 'web' | 'git' | 'tree' | 'code' | 'test' | 'package' | 'document' | 'scaffold' | 'todo' | 'plan' | 'task' | 'meta' | 'index' | 'json' | 'diff' | 'logs' | 'settings' | 'brain' | 'fallback';
|
|
727
|
-
/**
|
|
728
|
-
* Canonical mapping of WrongStack tool names to icon identifiers.
|
|
729
|
-
* Coverage: all 37 built-in tools + common aliases.
|
|
730
|
-
*/
|
|
731
|
-
declare const TOOL_ICON_MAP: Record<string, ToolIconId>;
|
|
732
|
-
/**
|
|
733
|
-
* Get the icon identifier for a tool name.
|
|
734
|
-
* Returns 'fallback' for unknown tools.
|
|
735
|
-
*/
|
|
736
|
-
declare function getToolIcon(toolName: string): ToolIconId;
|
|
737
|
-
/**
|
|
738
|
-
* Icon configuration including color for rendering.
|
|
739
|
-
*/
|
|
740
|
-
interface ToolIconConfig {
|
|
741
|
-
icon: ToolIconId;
|
|
742
|
-
/** CSS color string, e.g. '#6366f1' or 'var(--tool-file)' */
|
|
743
|
-
color: string;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Icon configurations — icon id -> { icon, color }.
|
|
747
|
-
* Each UI applies its own icon library (lucide-react, ink, unicode, etc.)
|
|
748
|
-
* but uses these canonical color values.
|
|
749
|
-
*/
|
|
750
|
-
declare const TOOL_ICON_CONFIG: Record<ToolIconId, ToolIconConfig>;
|
|
751
|
-
/**
|
|
752
|
-
* Default fallback icon for unknown tools.
|
|
753
|
-
*/
|
|
754
|
-
declare const FALLBACK_ICON: ToolIconId;
|
|
755
|
-
|
|
756
|
-
export { type BashShell, type EnsureSessionShellOptions, FALLBACK_ICON, type GlobalProcessStatus, type InstanceInfo, type InstanceListOptions, type PersistentProcessEntry, type PersistentRegistryData, type ProcessGuardianConfig, ProcessRegistryImpl, type ResolveSessionShellDeps, TOOL_ICON_CONFIG, TOOL_ICON_MAP, type ToolIconConfig, type ToolIconId, createGlobalPsSlashCommand, designTool, ensureSessionShell, formatGlobalStatus, formatInstanceList, formatInstanceSummary, getInstanceCount, getPersistentProcessRegistry, getProcessGuardian, getToolIcon, kanbanTool, listInstances, makeSkillTool, normalizeShell, planTool, resetPersistentProcessRegistry, resolveSessionShell, startProcessGuardian, stopProcessGuardian };
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|