@wrongstack/tools 0.281.3 → 0.282.1
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/audit.js +34 -13
- package/dist/audit.js.map +1 -1
- package/dist/bash.js +41 -23
- package/dist/bash.js.map +1 -1
- package/dist/builtin.d.ts +4 -4
- package/dist/builtin.js +864 -72
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.js +61 -2
- package/dist/codebase-index/index.js.map +1 -1
- package/dist/codebase-index/worker.js +61 -2
- package/dist/codebase-index/worker.js.map +1 -1
- package/dist/exec.js +34 -13
- package/dist/exec.js.map +1 -1
- package/dist/format.js +34 -13
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +278 -192
- package/dist/index.js +12872 -12082
- package/dist/index.js.map +1 -1
- package/dist/install.js +34 -13
- package/dist/install.js.map +1 -1
- package/dist/lint.js +34 -13
- package/dist/lint.js.map +1 -1
- package/dist/pack.js +863 -72
- package/dist/pack.js.map +1 -1
- package/dist/process-registry.d.ts +16 -3
- package/dist/process-registry.js +34 -13
- package/dist/process-registry.js.map +1 -1
- package/dist/test.js +34 -13
- package/dist/test.js.map +1 -1
- package/dist/typecheck.js +34 -13
- package/dist/typecheck.js.map +1 -1
- package/dist/write.js +65 -46
- package/dist/write.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
export { readTool } from './read.js';
|
|
2
|
-
export { writeTool } from './write.js';
|
|
3
|
-
export { editTool } from './edit.js';
|
|
4
|
-
export { replaceTool } from './replace.js';
|
|
5
|
-
export { globTool } from './glob.js';
|
|
6
|
-
export { grepTool } from './grep.js';
|
|
7
|
-
export { bashTool } from './bash.js';
|
|
8
1
|
export { D as DangerAssessment, a as DangerLevel, c as configureDangerBypass, b as configureExecPolicy, d as detectDanger, e as execTool, g as getDangerBypass, f as getExecAllowlist, i as isExecCommandAllowed, r as resetDangerBypass, h as resetExecPolicy } from './exec-Ca3fnpUh.js';
|
|
2
|
+
export { auditTool } from './audit.js';
|
|
3
|
+
export { bashTool } from './bash.js';
|
|
4
|
+
export { batchToolUseTool } from './batch-tool-use.js';
|
|
5
|
+
export { OPTIONAL_TOOLS, TIER1_TOOLS, TIER2_TOOLS, TIER3_TOOLS, builtinTools } from './builtin.js';
|
|
6
|
+
export { CircuitBreaker, CircuitBreakerConfig, CircuitBreakerSnapshot } from './circuit-breaker.js';
|
|
7
|
+
export { C as CircuitOpenError, e as CircuitSnapshot, f as CircuitState, h as IndexCircuitBreaker, i as IndexTimeoutError, k as cancelPendingReindexes, l as codebaseIndexStats, m as codebaseIndexTool, n as codebaseSearchTool, o as codebaseStatsTool, p as enqueueReindex, q as getIndexState, r as indexCircuitBreaker, s as isIndexReady, t as isIndexableFile, u as isIndexing, v as onIndexStateChange, w as resetIndexCircuitBreaker, x as runStartupIndex, y as searchCodebaseIndex, z as shutdownCodebaseIndexHost } from './background-indexer-BeDBxfSh.js';
|
|
8
|
+
import { Tool, AssignKanbanTaskInput, KanbanTaskPriority, KanbanTaskStatus, KanbanAgentRunStatus, KanbanBoard, KanbanBoardSummary, KanbanTask, KanbanSearchResult, KanbanOrchestrationSnapshot, SerializedTaskGraph, SkillLoader } from '@wrongstack/core';
|
|
9
|
+
export { diffTool } from './diff.js';
|
|
10
|
+
export { documentTool } from './document.js';
|
|
11
|
+
export { editTool } from './edit.js';
|
|
9
12
|
export { fetchTool } from './fetch.js';
|
|
10
|
-
export {
|
|
11
|
-
export { todoTool } from './todo.js';
|
|
12
|
-
import { Tool, SkillLoader } from '@wrongstack/core';
|
|
13
|
+
export { formatTool } from './format.js';
|
|
13
14
|
export { gitTool } from './git.js';
|
|
14
|
-
export {
|
|
15
|
+
export { globTool } from './glob.js';
|
|
16
|
+
export { grepTool } from './grep.js';
|
|
17
|
+
export { installTool } from './install.js';
|
|
15
18
|
export { jsonTool } from './json.js';
|
|
16
|
-
export { diffTool } from './diff.js';
|
|
17
|
-
export { treeTool } from './tree.js';
|
|
18
19
|
export { lintTool } from './lint.js';
|
|
19
|
-
export { formatTool } from './format.js';
|
|
20
|
-
export { typecheckTool } from './typecheck.js';
|
|
21
|
-
export { testTool } from './test.js';
|
|
22
|
-
export { installTool } from './install.js';
|
|
23
|
-
export { auditTool } from './audit.js';
|
|
24
|
-
export { outdatedTool } from './outdated.js';
|
|
25
20
|
export { logsTool } from './logs.js';
|
|
26
|
-
export { documentTool } from './document.js';
|
|
27
|
-
export { scaffoldTool } from './scaffold.js';
|
|
28
|
-
export { toolSearchTool } from './tool-search.js';
|
|
29
|
-
export { toolUseTool } from './tool-use.js';
|
|
30
|
-
export { batchToolUseTool } from './batch-tool-use.js';
|
|
31
|
-
export { toolHelpTool } from './tool-help.js';
|
|
32
21
|
export { forgetTool, relatedMemoryTool, rememberTool, searchMemoryTool } from './memory.js';
|
|
33
22
|
export { createModeTool } from './mode.js';
|
|
23
|
+
export { outdatedTool } from './outdated.js';
|
|
24
|
+
export { builtinToolsPack } from './pack.js';
|
|
25
|
+
export { patchTool } from './patch.js';
|
|
34
26
|
import { ProcessRegistryImpl } from './process-registry.js';
|
|
35
27
|
export { BreakerCountdown, KillOpts, RegistryStats, TrackedProcess, _resetProcessRegistry, getProcessRegistry } from './process-registry.js';
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
28
|
+
export { readTool } from './read.js';
|
|
29
|
+
export { replaceTool } from './replace.js';
|
|
30
|
+
export { scaffoldTool } from './scaffold.js';
|
|
31
|
+
export { searchTool } from './search.js';
|
|
32
|
+
export { testTool } from './test.js';
|
|
33
|
+
export { todoTool } from './todo.js';
|
|
34
|
+
export { toolHelpTool } from './tool-help.js';
|
|
35
|
+
export { toolSearchTool } from './tool-search.js';
|
|
36
|
+
export { toolUseTool } from './tool-use.js';
|
|
37
|
+
export { treeTool } from './tree.js';
|
|
38
|
+
export { typecheckTool } from './typecheck.js';
|
|
39
|
+
export { writeTool } from './write.js';
|
|
40
40
|
import 'node:child_process';
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -148,6 +148,128 @@ interface EnsureSessionShellOptions {
|
|
|
148
148
|
*/
|
|
149
149
|
declare function ensureSessionShell(opts?: EnsureSessionShellOptions): BashShell | undefined;
|
|
150
150
|
|
|
151
|
+
type Overrides = Record<string, string>;
|
|
152
|
+
interface DesignInput {
|
|
153
|
+
action?: 'list' | 'use' | 'foundations' | 'set' | 'materialize' | 'verify' | undefined;
|
|
154
|
+
kit?: string | undefined;
|
|
155
|
+
stack?: string | undefined;
|
|
156
|
+
/** action "set" / "use": token overrides, e.g. { primary: "oklch(...)", "dark.bg": "#111" }. */
|
|
157
|
+
set?: Overrides | undefined;
|
|
158
|
+
/** action "materialize": output path (project-relative); defaults per stack. */
|
|
159
|
+
out?: string | undefined;
|
|
160
|
+
/** action "materialize": overwrite an existing file. */
|
|
161
|
+
force?: boolean | undefined;
|
|
162
|
+
/** action "verify": explicit files to scan (project-relative). Defaults to a UI-file walk. */
|
|
163
|
+
files?: string[] | undefined;
|
|
164
|
+
}
|
|
165
|
+
interface DesignOutput {
|
|
166
|
+
action: string;
|
|
167
|
+
kit?: string | undefined;
|
|
168
|
+
stack?: string | undefined;
|
|
169
|
+
output: string;
|
|
170
|
+
/** action "materialize": where the theme file was (or would be) written. */
|
|
171
|
+
path?: string | undefined;
|
|
172
|
+
/** action "verify": adherence score 0..1 and violation count. */
|
|
173
|
+
score?: number | undefined;
|
|
174
|
+
violations?: number | undefined;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Design Studio tool — progressive disclosure + token enforcement.
|
|
178
|
+
*
|
|
179
|
+
* `list`/`use`/`foundations` browse and pin kits. `set` records structured color
|
|
180
|
+
* overrides (these win over kit tokens). `materialize` writes the active kit's
|
|
181
|
+
* (override-applied) tokens to a real, stack-appropriate theme file so the
|
|
182
|
+
* palette becomes the codebase's source of truth — not just a prompt hint.
|
|
183
|
+
* `verify` scans UI files for off-palette drift.
|
|
184
|
+
*/
|
|
185
|
+
declare const designTool: Tool<DesignInput, DesignOutput>;
|
|
186
|
+
|
|
187
|
+
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' | 'add_dependency' | 'add_goal_metric' | 'update_goal_metric' | 'add_check' | 'update_check' | 'add_note' | 'add_link';
|
|
188
|
+
interface KanbanToolInput extends Omit<AssignKanbanTaskInput, 'status'> {
|
|
189
|
+
action: KanbanAction;
|
|
190
|
+
boardId?: string | undefined;
|
|
191
|
+
taskId?: string | undefined;
|
|
192
|
+
columnId?: string | undefined;
|
|
193
|
+
targetBoardId?: string | undefined;
|
|
194
|
+
taskIds?: string[] | undefined;
|
|
195
|
+
chainId?: string | undefined;
|
|
196
|
+
title?: string | undefined;
|
|
197
|
+
description?: string | undefined;
|
|
198
|
+
tags?: string[] | undefined;
|
|
199
|
+
labels?: string[] | undefined;
|
|
200
|
+
priority?: KanbanTaskPriority | undefined;
|
|
201
|
+
status?: KanbanTaskStatus | undefined;
|
|
202
|
+
order?: number | undefined;
|
|
203
|
+
targetColumnId?: string | undefined;
|
|
204
|
+
moveTasksToColumnId?: string | undefined;
|
|
205
|
+
query?: string | undefined;
|
|
206
|
+
limit?: number | undefined;
|
|
207
|
+
dependencyTaskId?: string | undefined;
|
|
208
|
+
enforceDependencies?: boolean | undefined;
|
|
209
|
+
childTitles?: string[] | undefined;
|
|
210
|
+
inheritAssignment?: boolean | undefined;
|
|
211
|
+
inheritLabels?: boolean | undefined;
|
|
212
|
+
inheritSuccessCriteria?: boolean | undefined;
|
|
213
|
+
inheritGoalMetrics?: boolean | undefined;
|
|
214
|
+
inheritDependencies?: boolean | undefined;
|
|
215
|
+
chainChildren?: boolean | undefined;
|
|
216
|
+
rewireDependents?: boolean | undefined;
|
|
217
|
+
closeSourceTasks?: boolean | undefined;
|
|
218
|
+
metricId?: string | undefined;
|
|
219
|
+
metricName?: string | undefined;
|
|
220
|
+
metricTarget?: string | number | undefined;
|
|
221
|
+
metricCurrent?: string | number | undefined;
|
|
222
|
+
metricUnit?: string | undefined;
|
|
223
|
+
metricStatus?: 'pending' | 'met' | 'missed' | 'waived' | undefined;
|
|
224
|
+
metricNotes?: string | undefined;
|
|
225
|
+
checkId?: string | undefined;
|
|
226
|
+
checkDescription?: string | undefined;
|
|
227
|
+
checkStatus?: 'pending' | 'passed' | 'failed' | 'skipped' | undefined;
|
|
228
|
+
note?: string | undefined;
|
|
229
|
+
author?: string | undefined;
|
|
230
|
+
url?: string | undefined;
|
|
231
|
+
linkTitle?: string | undefined;
|
|
232
|
+
linkType?: 'issue' | 'pr' | 'doc' | 'commit' | 'design' | 'file' | 'url' | 'other' | undefined;
|
|
233
|
+
context?: string | undefined;
|
|
234
|
+
columns?: string[] | undefined;
|
|
235
|
+
generatedBy?: string | undefined;
|
|
236
|
+
includeTasks?: boolean | undefined;
|
|
237
|
+
includeCompletedTasks?: boolean | undefined;
|
|
238
|
+
preserveAssignment?: boolean | undefined;
|
|
239
|
+
preserveDependencies?: boolean | undefined;
|
|
240
|
+
subagentId?: string | undefined;
|
|
241
|
+
runTaskId?: string | undefined;
|
|
242
|
+
lastResult?: string | undefined;
|
|
243
|
+
error?: string | undefined;
|
|
244
|
+
assignmentStatus?: KanbanAgentRunStatus | undefined;
|
|
245
|
+
releaseStatus?: 'pending' | 'ready' | 'blocked' | undefined;
|
|
246
|
+
releaseReason?: string | undefined;
|
|
247
|
+
clearAssignee?: boolean | undefined;
|
|
248
|
+
taskGraph?: unknown;
|
|
249
|
+
graphId?: string | undefined;
|
|
250
|
+
specId?: string | undefined;
|
|
251
|
+
sourceSystem?: string | undefined;
|
|
252
|
+
phaseId?: string | undefined;
|
|
253
|
+
preserveOriginTaskIds?: boolean | undefined;
|
|
254
|
+
includeArchived?: boolean | undefined;
|
|
255
|
+
archiveMissingTasks?: boolean | undefined;
|
|
256
|
+
preserveManualDependencies?: boolean | undefined;
|
|
257
|
+
}
|
|
258
|
+
interface KanbanToolOutput {
|
|
259
|
+
ok: boolean;
|
|
260
|
+
message: string;
|
|
261
|
+
board?: KanbanBoard | undefined;
|
|
262
|
+
boards?: KanbanBoardSummary[] | undefined;
|
|
263
|
+
task?: KanbanTask | undefined;
|
|
264
|
+
tasks?: KanbanSearchResult[] | undefined;
|
|
265
|
+
children?: KanbanTask[] | undefined;
|
|
266
|
+
chain?: KanbanTask[] | undefined;
|
|
267
|
+
snapshot?: KanbanOrchestrationSnapshot | undefined;
|
|
268
|
+
taskGraph?: SerializedTaskGraph | undefined;
|
|
269
|
+
markdown?: string | undefined;
|
|
270
|
+
}
|
|
271
|
+
declare const kanbanTool: Tool<KanbanToolInput, KanbanToolOutput>;
|
|
272
|
+
|
|
151
273
|
/**
|
|
152
274
|
* `planTool` — the LLM-callable counterpart to the `/plan` slash command.
|
|
153
275
|
*
|
|
@@ -201,84 +323,95 @@ interface PlanOutput {
|
|
|
201
323
|
}
|
|
202
324
|
declare const planTool: Tool<PlanInput, PlanOutput>;
|
|
203
325
|
|
|
204
|
-
type Overrides = Record<string, string>;
|
|
205
|
-
interface DesignInput {
|
|
206
|
-
action?: 'list' | 'use' | 'foundations' | 'set' | 'materialize' | 'verify' | undefined;
|
|
207
|
-
kit?: string | undefined;
|
|
208
|
-
stack?: string | undefined;
|
|
209
|
-
/** action "set" / "use": token overrides, e.g. { primary: "oklch(...)", "dark.bg": "#111" }. */
|
|
210
|
-
set?: Overrides | undefined;
|
|
211
|
-
/** action "materialize": output path (project-relative); defaults per stack. */
|
|
212
|
-
out?: string | undefined;
|
|
213
|
-
/** action "materialize": overwrite an existing file. */
|
|
214
|
-
force?: boolean | undefined;
|
|
215
|
-
/** action "verify": explicit files to scan (project-relative). Defaults to a UI-file walk. */
|
|
216
|
-
files?: string[] | undefined;
|
|
217
|
-
}
|
|
218
|
-
interface DesignOutput {
|
|
219
|
-
action: string;
|
|
220
|
-
kit?: string | undefined;
|
|
221
|
-
stack?: string | undefined;
|
|
222
|
-
output: string;
|
|
223
|
-
/** action "materialize": where the theme file was (or would be) written. */
|
|
224
|
-
path?: string | undefined;
|
|
225
|
-
/** action "verify": adherence score 0..1 and violation count. */
|
|
226
|
-
score?: number | undefined;
|
|
227
|
-
violations?: number | undefined;
|
|
228
|
-
}
|
|
229
326
|
/**
|
|
230
|
-
*
|
|
327
|
+
* Process Guardian — Protects WrongStack processes from being killed via
|
|
328
|
+
* bash/kill commands. Runs as a watchdog that:
|
|
231
329
|
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
330
|
+
* 1. Registers the main process and all children with persistent registry
|
|
331
|
+
* 2. Monitors for kill attempts against protected PIDs
|
|
332
|
+
* 3. Provides recovery mechanisms when killed processes are detected
|
|
333
|
+
* 4. Coordinates protection across multiple WrongStack instances
|
|
334
|
+
*
|
|
335
|
+
* This is NOT a security mechanism against intentional root-level kills.
|
|
336
|
+
* A user with sudo/root can still kill any process. This is a guardrail
|
|
337
|
+
* to prevent accidental kills from the WrongStack agent itself.
|
|
237
338
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
path: string;
|
|
248
|
-
bytes: number;
|
|
249
|
-
}
|
|
250
|
-
interface LoadedResource {
|
|
251
|
-
rel: string;
|
|
252
|
-
absPath: string;
|
|
253
|
-
content: string;
|
|
254
|
-
bytes: number;
|
|
255
|
-
truncated: boolean;
|
|
256
|
-
}
|
|
257
|
-
interface SkillToolOutput {
|
|
258
|
-
name: string;
|
|
259
|
-
description: string;
|
|
260
|
-
/** Frontmatter-stripped SKILL.md body (capped). */
|
|
261
|
-
body: string;
|
|
262
|
-
/** All bundled resource files (recursive), when no specific resource was requested. */
|
|
263
|
-
resources: SkillResource[];
|
|
264
|
-
/** Absolute directory of the skill — run scripts via bash using paths under here. */
|
|
265
|
-
dir: string;
|
|
266
|
-
/** When `resource` was requested: the loaded file. */
|
|
267
|
-
loadedResource?: LoadedResource | undefined;
|
|
339
|
+
interface ProcessGuardianConfig {
|
|
340
|
+
/** Interval for heartbeat in ms */
|
|
341
|
+
heartbeatIntervalMs?: number;
|
|
342
|
+
/** Enable automatic process resurrection */
|
|
343
|
+
autoResurrect?: boolean;
|
|
344
|
+
/** Maximum resurrection attempts */
|
|
345
|
+
maxResurrectionAttempts?: number;
|
|
346
|
+
/** Custom protection patterns */
|
|
347
|
+
protectedPatterns?: string[];
|
|
268
348
|
}
|
|
269
349
|
/**
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* - `skill({ name })` → SKILL.md body + a recursive listing of every bundled
|
|
273
|
-
* resource file (scripts/ references/ assets/ templates/ … any subdir).
|
|
274
|
-
* - `skill({ name, resource })` → the content of that one resource file.
|
|
275
|
-
*
|
|
276
|
-
* Use this (not the `read` tool) to load skill resources: it works for foreign
|
|
277
|
-
* skills that live outside the project root (e.g. `~/.claude/skills/…`), which
|
|
278
|
-
* a project-root-restricted `read` tool may refuse. Scripts are returned with
|
|
279
|
-
* their absolute path so the agent can run them via `bash`.
|
|
350
|
+
* Process Guardian watches over WrongStack processes and prevents accidental kills.
|
|
280
351
|
*/
|
|
281
|
-
declare
|
|
352
|
+
declare class ProcessGuardian {
|
|
353
|
+
private readonly registry;
|
|
354
|
+
private readonly config;
|
|
355
|
+
private readonly protectedProcesses;
|
|
356
|
+
private heartbeatTimer;
|
|
357
|
+
private isRunning;
|
|
358
|
+
private instanceId;
|
|
359
|
+
constructor(config?: ProcessGuardianConfig);
|
|
360
|
+
/**
|
|
361
|
+
* Start the guardian - begins monitoring and registration.
|
|
362
|
+
*/
|
|
363
|
+
start(): void;
|
|
364
|
+
/**
|
|
365
|
+
* Stop the guardian gracefully.
|
|
366
|
+
*/
|
|
367
|
+
stop(): void;
|
|
368
|
+
/**
|
|
369
|
+
* Register a process with the guardian.
|
|
370
|
+
*/
|
|
371
|
+
registerProcess(pid: number, name: string): void;
|
|
372
|
+
/**
|
|
373
|
+
* Unregister a process (e.g., when it exits normally).
|
|
374
|
+
*/
|
|
375
|
+
unregisterProcess(pid: number): void;
|
|
376
|
+
/**
|
|
377
|
+
* Register all child processes that already exist.
|
|
378
|
+
*/
|
|
379
|
+
private registerExistingChildren;
|
|
380
|
+
/**
|
|
381
|
+
* Sync protected processes with the base ProcessRegistry.
|
|
382
|
+
*/
|
|
383
|
+
private syncWithProcessRegistry;
|
|
384
|
+
/**
|
|
385
|
+
* Heartbeat - updates timestamps and checks for anomalies.
|
|
386
|
+
*/
|
|
387
|
+
private heartbeat;
|
|
388
|
+
/**
|
|
389
|
+
* Set up process-level event handlers.
|
|
390
|
+
*/
|
|
391
|
+
private setupProcessHandlers;
|
|
392
|
+
/**
|
|
393
|
+
* Check if a PID is protected by this guardian.
|
|
394
|
+
*/
|
|
395
|
+
isProtected(pid: number): boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Get all PIDs protected by this guardian.
|
|
398
|
+
*/
|
|
399
|
+
getProtectedPids(): number[];
|
|
400
|
+
/**
|
|
401
|
+
* Get status information for monitoring.
|
|
402
|
+
*/
|
|
403
|
+
getStatus(): {
|
|
404
|
+
instanceId: string;
|
|
405
|
+
mainPid: number;
|
|
406
|
+
protectedCount: number;
|
|
407
|
+
platform: string;
|
|
408
|
+
hostname: string;
|
|
409
|
+
uptime: number;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
declare function getProcessGuardian(): ProcessGuardian;
|
|
413
|
+
declare function startProcessGuardian(config?: ProcessGuardianConfig): ProcessGuardian;
|
|
414
|
+
declare function stopProcessGuardian(): void;
|
|
282
415
|
|
|
283
416
|
/**
|
|
284
417
|
* PersistentProcessRegistry — filesystem-backed process registry that survives
|
|
@@ -401,96 +534,6 @@ declare class PersistentProcessRegistry {
|
|
|
401
534
|
declare function getPersistentProcessRegistry(): PersistentProcessRegistry;
|
|
402
535
|
declare function resetPersistentProcessRegistry(): void;
|
|
403
536
|
|
|
404
|
-
/**
|
|
405
|
-
* Process Guardian — Protects WrongStack processes from being killed via
|
|
406
|
-
* bash/kill commands. Runs as a watchdog that:
|
|
407
|
-
*
|
|
408
|
-
* 1. Registers the main process and all children with persistent registry
|
|
409
|
-
* 2. Monitors for kill attempts against protected PIDs
|
|
410
|
-
* 3. Provides recovery mechanisms when killed processes are detected
|
|
411
|
-
* 4. Coordinates protection across multiple WrongStack instances
|
|
412
|
-
*
|
|
413
|
-
* This is NOT a security mechanism against intentional root-level kills.
|
|
414
|
-
* A user with sudo/root can still kill any process. This is a guardrail
|
|
415
|
-
* to prevent accidental kills from the WrongStack agent itself.
|
|
416
|
-
*/
|
|
417
|
-
interface ProcessGuardianConfig {
|
|
418
|
-
/** Interval for heartbeat in ms */
|
|
419
|
-
heartbeatIntervalMs?: number;
|
|
420
|
-
/** Enable automatic process resurrection */
|
|
421
|
-
autoResurrect?: boolean;
|
|
422
|
-
/** Maximum resurrection attempts */
|
|
423
|
-
maxResurrectionAttempts?: number;
|
|
424
|
-
/** Custom protection patterns */
|
|
425
|
-
protectedPatterns?: string[];
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Process Guardian watches over WrongStack processes and prevents accidental kills.
|
|
429
|
-
*/
|
|
430
|
-
declare class ProcessGuardian {
|
|
431
|
-
private readonly registry;
|
|
432
|
-
private readonly config;
|
|
433
|
-
private readonly protectedProcesses;
|
|
434
|
-
private heartbeatTimer;
|
|
435
|
-
private isRunning;
|
|
436
|
-
private instanceId;
|
|
437
|
-
constructor(config?: ProcessGuardianConfig);
|
|
438
|
-
/**
|
|
439
|
-
* Start the guardian - begins monitoring and registration.
|
|
440
|
-
*/
|
|
441
|
-
start(): void;
|
|
442
|
-
/**
|
|
443
|
-
* Stop the guardian gracefully.
|
|
444
|
-
*/
|
|
445
|
-
stop(): void;
|
|
446
|
-
/**
|
|
447
|
-
* Register a process with the guardian.
|
|
448
|
-
*/
|
|
449
|
-
registerProcess(pid: number, name: string): void;
|
|
450
|
-
/**
|
|
451
|
-
* Unregister a process (e.g., when it exits normally).
|
|
452
|
-
*/
|
|
453
|
-
unregisterProcess(pid: number): void;
|
|
454
|
-
/**
|
|
455
|
-
* Register all child processes that already exist.
|
|
456
|
-
*/
|
|
457
|
-
private registerExistingChildren;
|
|
458
|
-
/**
|
|
459
|
-
* Sync protected processes with the base ProcessRegistry.
|
|
460
|
-
*/
|
|
461
|
-
private syncWithProcessRegistry;
|
|
462
|
-
/**
|
|
463
|
-
* Heartbeat - updates timestamps and checks for anomalies.
|
|
464
|
-
*/
|
|
465
|
-
private heartbeat;
|
|
466
|
-
/**
|
|
467
|
-
* Set up process-level event handlers.
|
|
468
|
-
*/
|
|
469
|
-
private setupProcessHandlers;
|
|
470
|
-
/**
|
|
471
|
-
* Check if a PID is protected by this guardian.
|
|
472
|
-
*/
|
|
473
|
-
isProtected(pid: number): boolean;
|
|
474
|
-
/**
|
|
475
|
-
* Get all PIDs protected by this guardian.
|
|
476
|
-
*/
|
|
477
|
-
getProtectedPids(): number[];
|
|
478
|
-
/**
|
|
479
|
-
* Get status information for monitoring.
|
|
480
|
-
*/
|
|
481
|
-
getStatus(): {
|
|
482
|
-
instanceId: string;
|
|
483
|
-
mainPid: number;
|
|
484
|
-
protectedCount: number;
|
|
485
|
-
platform: string;
|
|
486
|
-
hostname: string;
|
|
487
|
-
uptime: number;
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
declare function getProcessGuardian(): ProcessGuardian;
|
|
491
|
-
declare function startProcessGuardian(config?: ProcessGuardianConfig): ProcessGuardian;
|
|
492
|
-
declare function stopProcessGuardian(): void;
|
|
493
|
-
|
|
494
537
|
/**
|
|
495
538
|
* Global Process Registry - Cross-Instance Process Tracking
|
|
496
539
|
*
|
|
@@ -593,6 +636,49 @@ declare function createGlobalPsSlashCommand(): {
|
|
|
593
636
|
}>;
|
|
594
637
|
};
|
|
595
638
|
|
|
639
|
+
interface SkillToolInput {
|
|
640
|
+
name: string;
|
|
641
|
+
/** Optional relative path of a bundled resource to load (e.g. `references/REF.md`, `scripts/extract.py`, `assets/template.html`). Omit to list resources. */
|
|
642
|
+
resource?: string | undefined;
|
|
643
|
+
}
|
|
644
|
+
interface SkillResource {
|
|
645
|
+
/** Path relative to the skill directory (e.g. `scripts/extract.py`). */
|
|
646
|
+
path: string;
|
|
647
|
+
bytes: number;
|
|
648
|
+
}
|
|
649
|
+
interface LoadedResource {
|
|
650
|
+
rel: string;
|
|
651
|
+
absPath: string;
|
|
652
|
+
content: string;
|
|
653
|
+
bytes: number;
|
|
654
|
+
truncated: boolean;
|
|
655
|
+
}
|
|
656
|
+
interface SkillToolOutput {
|
|
657
|
+
name: string;
|
|
658
|
+
description: string;
|
|
659
|
+
/** Frontmatter-stripped SKILL.md body (capped). */
|
|
660
|
+
body: string;
|
|
661
|
+
/** All bundled resource files (recursive), when no specific resource was requested. */
|
|
662
|
+
resources: SkillResource[];
|
|
663
|
+
/** Absolute directory of the skill — run scripts via bash using paths under here. */
|
|
664
|
+
dir: string;
|
|
665
|
+
/** When `resource` was requested: the loaded file. */
|
|
666
|
+
loadedResource?: LoadedResource | undefined;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Skill tool — the agentskills.io progressive-disclosure primitive.
|
|
670
|
+
*
|
|
671
|
+
* - `skill({ name })` → SKILL.md body + a recursive listing of every bundled
|
|
672
|
+
* resource file (scripts/ references/ assets/ templates/ … any subdir).
|
|
673
|
+
* - `skill({ name, resource })` → the content of that one resource file.
|
|
674
|
+
*
|
|
675
|
+
* Use this (not the `read` tool) to load skill resources: it works for foreign
|
|
676
|
+
* skills that live outside the project root (e.g. `~/.claude/skills/…`), which
|
|
677
|
+
* a project-root-restricted `read` tool may refuse. Scripts are returned with
|
|
678
|
+
* their absolute path so the agent can run them via `bash`.
|
|
679
|
+
*/
|
|
680
|
+
declare function makeSkillTool(skillLoader: SkillLoader): Tool<SkillToolInput, SkillToolOutput>;
|
|
681
|
+
|
|
596
682
|
/**
|
|
597
683
|
* Shared tool icon mapping for all WrongStack UIs (WebUI, TUI, REPL).
|
|
598
684
|
*
|
|
@@ -638,4 +724,4 @@ declare const TOOL_ICON_CONFIG: Record<ToolIconId, ToolIconConfig>;
|
|
|
638
724
|
*/
|
|
639
725
|
declare const FALLBACK_ICON: ToolIconId;
|
|
640
726
|
|
|
641
|
-
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, listInstances, makeSkillTool, normalizeShell, planTool, resetPersistentProcessRegistry, resolveSessionShell, startProcessGuardian, stopProcessGuardian };
|
|
727
|
+
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 };
|