@sudocode-ai/local-server 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/errors/agent-errors.d.ts +43 -0
- package/dist/errors/agent-errors.d.ts.map +1 -0
- package/dist/errors/agent-errors.js +69 -0
- package/dist/errors/agent-errors.js.map +1 -0
- package/dist/execution/adapters/claude-adapter.d.ts +63 -0
- package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/claude-adapter.js +82 -0
- package/dist/execution/adapters/claude-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-adapter.d.ts +67 -0
- package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/codex-adapter.js +183 -0
- package/dist/execution/adapters/codex-adapter.js.map +1 -0
- package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
- package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/codex-config-builder.js +110 -0
- package/dist/execution/adapters/codex-config-builder.js.map +1 -0
- package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
- package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-adapter.js +163 -0
- package/dist/execution/adapters/copilot-adapter.js.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
- package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/copilot-config-builder.js +125 -0
- package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
- package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
- package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-adapter.js +121 -0
- package/dist/execution/adapters/cursor-adapter.js.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
- package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
- package/dist/execution/adapters/cursor-config-builder.js +49 -0
- package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
- package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
- package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-presets.js +205 -0
- package/dist/execution/adapters/shared/config-presets.js.map +1 -0
- package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
- package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
- package/dist/execution/adapters/shared/config-utils.js +163 -0
- package/dist/execution/adapters/shared/config-utils.js.map +1 -0
- package/dist/execution/adapters/shared/index.d.ts +8 -0
- package/dist/execution/adapters/shared/index.d.ts.map +1 -0
- package/dist/execution/adapters/shared/index.js +8 -0
- package/dist/execution/adapters/shared/index.js.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
- package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
- package/dist/execution/executors/agent-executor-wrapper.js +652 -0
- package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
- package/dist/execution/executors/executor-factory.d.ts +95 -0
- package/dist/execution/executors/executor-factory.d.ts.map +1 -0
- package/dist/execution/executors/executor-factory.js +120 -0
- package/dist/execution/executors/executor-factory.js.map +1 -0
- package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
- package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
- package/dist/execution/output/ag-ui-adapter.js +0 -2
- package/dist/execution/output/ag-ui-adapter.js.map +1 -1
- package/dist/execution/output/index.d.ts +0 -3
- package/dist/execution/output/index.d.ts.map +1 -1
- package/dist/execution/output/index.js +0 -2
- package/dist/execution/output/index.js.map +1 -1
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
- package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
- package/dist/execution/process/builders/claude.d.ts +24 -57
- package/dist/execution/process/builders/claude.d.ts.map +1 -1
- package/dist/execution/process/builders/claude.js +153 -19
- package/dist/execution/process/builders/claude.js.map +1 -1
- package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
- package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
- package/dist/execution/transport/ipc-transport-manager.js +104 -0
- package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
- package/dist/execution/transport/transport-manager.d.ts.map +1 -1
- package/dist/execution/transport/transport-manager.js +3 -0
- package/dist/execution/transport/transport-manager.js.map +1 -1
- package/dist/execution/worktree/conflict-detector.d.ts +85 -0
- package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
- package/dist/execution/worktree/conflict-detector.js +129 -0
- package/dist/execution/worktree/conflict-detector.js.map +1 -0
- package/dist/execution/worktree/git-cli.d.ts +9 -0
- package/dist/execution/worktree/git-cli.d.ts.map +1 -1
- package/dist/execution/worktree/git-cli.js +10 -0
- package/dist/execution/worktree/git-cli.js.map +1 -1
- package/dist/execution/worktree/git-sync-cli.d.ts +187 -0
- package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
- package/dist/execution/worktree/git-sync-cli.js +350 -0
- package/dist/execution/worktree/git-sync-cli.js.map +1 -0
- package/dist/execution/worktree/manager.d.ts +18 -0
- package/dist/execution/worktree/manager.d.ts.map +1 -1
- package/dist/execution/worktree/manager.js +9 -3
- package/dist/execution/worktree/manager.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +132 -211
- package/dist/index.js.map +1 -1
- package/dist/middleware/project-context.d.ts +37 -0
- package/dist/middleware/project-context.d.ts.map +1 -0
- package/dist/middleware/project-context.js +91 -0
- package/dist/middleware/project-context.js.map +1 -0
- package/dist/public/assets/index-Bb_W5bUr.css +1 -0
- package/dist/public/assets/index-CFKL113G.js +710 -0
- package/dist/public/assets/index-CFKL113G.js.map +1 -0
- package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
- package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
- package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
- package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
- package/dist/public/index.html +4 -4
- package/dist/routes/agents.d.ts +3 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/agents.js +62 -0
- package/dist/routes/agents.js.map +1 -0
- package/dist/routes/config.d.ts +3 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +25 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/editors.d.ts +15 -0
- package/dist/routes/editors.d.ts.map +1 -0
- package/dist/routes/editors.js +98 -0
- package/dist/routes/editors.js.map +1 -0
- package/dist/routes/executions-stream.d.ts +8 -5
- package/dist/routes/executions-stream.d.ts.map +1 -1
- package/dist/routes/executions-stream.js +10 -6
- package/dist/routes/executions-stream.js.map +1 -1
- package/dist/routes/executions.d.ts +6 -10
- package/dist/routes/executions.d.ts.map +1 -1
- package/dist/routes/executions.js +506 -54
- package/dist/routes/executions.js.map +1 -1
- package/dist/routes/feedback.d.ts +3 -2
- package/dist/routes/feedback.d.ts.map +1 -1
- package/dist/routes/feedback.js +12 -10
- package/dist/routes/feedback.js.map +1 -1
- package/dist/routes/files.d.ts +18 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +89 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/issues.d.ts +3 -2
- package/dist/routes/issues.d.ts.map +1 -1
- package/dist/routes/issues.js +19 -18
- package/dist/routes/issues.js.map +1 -1
- package/dist/routes/projects.d.ts +11 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +447 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/relationships.d.ts +3 -2
- package/dist/routes/relationships.d.ts.map +1 -1
- package/dist/routes/relationships.js +12 -10
- package/dist/routes/relationships.js.map +1 -1
- package/dist/routes/repo-info.d.ts +3 -0
- package/dist/routes/repo-info.d.ts.map +1 -0
- package/dist/routes/repo-info.js +126 -0
- package/dist/routes/repo-info.js.map +1 -0
- package/dist/routes/specs.d.ts +3 -2
- package/dist/routes/specs.d.ts.map +1 -1
- package/dist/routes/specs.js +19 -18
- package/dist/routes/specs.js.map +1 -1
- package/dist/services/agent-registry.d.ts +140 -0
- package/dist/services/agent-registry.d.ts.map +1 -0
- package/dist/services/agent-registry.js +272 -0
- package/dist/services/agent-registry.js.map +1 -0
- package/dist/services/editor-service.d.ts +57 -0
- package/dist/services/editor-service.d.ts.map +1 -0
- package/dist/services/editor-service.js +204 -0
- package/dist/services/editor-service.js.map +1 -0
- package/dist/services/execution-changes-service.d.ts +92 -0
- package/dist/services/execution-changes-service.d.ts.map +1 -0
- package/dist/services/execution-changes-service.js +546 -0
- package/dist/services/execution-changes-service.js.map +1 -0
- package/dist/services/execution-lifecycle.d.ts +1 -0
- package/dist/services/execution-lifecycle.d.ts.map +1 -1
- package/dist/services/execution-lifecycle.js +37 -7
- package/dist/services/execution-lifecycle.js.map +1 -1
- package/dist/services/execution-logs-store.d.ts +75 -0
- package/dist/services/execution-logs-store.d.ts.map +1 -1
- package/dist/services/execution-logs-store.js +142 -2
- package/dist/services/execution-logs-store.js.map +1 -1
- package/dist/services/execution-service.d.ts +50 -58
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +433 -469
- package/dist/services/execution-service.js.map +1 -1
- package/dist/services/execution-worker-pool.d.ts +116 -0
- package/dist/services/execution-worker-pool.d.ts.map +1 -0
- package/dist/services/execution-worker-pool.js +326 -0
- package/dist/services/execution-worker-pool.js.map +1 -0
- package/dist/services/executions.d.ts +3 -0
- package/dist/services/executions.d.ts.map +1 -1
- package/dist/services/executions.js +11 -17
- package/dist/services/executions.js.map +1 -1
- package/dist/services/export.d.ts +8 -2
- package/dist/services/export.d.ts.map +1 -1
- package/dist/services/export.js +29 -23
- package/dist/services/export.js.map +1 -1
- package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
- package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
- package/dist/services/file-search/git-ls-files-strategy.js +176 -0
- package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
- package/dist/services/file-search/index.d.ts +9 -0
- package/dist/services/file-search/index.d.ts.map +1 -0
- package/dist/services/file-search/index.js +10 -0
- package/dist/services/file-search/index.js.map +1 -0
- package/dist/services/file-search/registry.d.ts +97 -0
- package/dist/services/file-search/registry.d.ts.map +1 -0
- package/dist/services/file-search/registry.js +140 -0
- package/dist/services/file-search/registry.js.map +1 -0
- package/dist/services/file-search/strategy.d.ts +58 -0
- package/dist/services/file-search/strategy.d.ts.map +1 -0
- package/dist/services/file-search/strategy.js +8 -0
- package/dist/services/file-search/strategy.js.map +1 -0
- package/dist/services/project-context.d.ts +69 -0
- package/dist/services/project-context.d.ts.map +1 -0
- package/dist/services/project-context.js +113 -0
- package/dist/services/project-context.js.map +1 -0
- package/dist/services/project-manager.d.ts +95 -0
- package/dist/services/project-manager.d.ts.map +1 -0
- package/dist/services/project-manager.js +388 -0
- package/dist/services/project-manager.js.map +1 -0
- package/dist/services/project-registry.d.ts +98 -0
- package/dist/services/project-registry.d.ts.map +1 -0
- package/dist/services/project-registry.js +289 -0
- package/dist/services/project-registry.js.map +1 -0
- package/dist/services/prompt-resolver.d.ts +97 -0
- package/dist/services/prompt-resolver.d.ts.map +1 -0
- package/dist/services/prompt-resolver.js +377 -0
- package/dist/services/prompt-resolver.js.map +1 -0
- package/dist/services/repo-info.d.ts +12 -0
- package/dist/services/repo-info.d.ts.map +1 -1
- package/dist/services/repo-info.js +46 -0
- package/dist/services/repo-info.js.map +1 -1
- package/dist/services/watcher.d.ts +3 -4
- package/dist/services/watcher.d.ts.map +1 -1
- package/dist/services/watcher.js +18 -35
- package/dist/services/watcher.js.map +1 -1
- package/dist/services/websocket.d.ts +30 -16
- package/dist/services/websocket.d.ts.map +1 -1
- package/dist/services/websocket.js +102 -37
- package/dist/services/websocket.js.map +1 -1
- package/dist/services/worktree-sync-service.d.ts +228 -0
- package/dist/services/worktree-sync-service.d.ts.map +1 -0
- package/dist/services/worktree-sync-service.js +563 -0
- package/dist/services/worktree-sync-service.js.map +1 -0
- package/dist/types/editor.d.ts +49 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/editor.js +50 -0
- package/dist/types/editor.js.map +1 -0
- package/dist/types/project.d.ts +58 -0
- package/dist/types/project.d.ts.map +1 -0
- package/dist/types/project.js +10 -0
- package/dist/types/project.js.map +1 -0
- package/dist/utils/executable-check.d.ts +36 -0
- package/dist/utils/executable-check.d.ts.map +1 -0
- package/dist/utils/executable-check.js +79 -0
- package/dist/utils/executable-check.js.map +1 -0
- package/dist/workers/execution-worker.d.ts +18 -0
- package/dist/workers/execution-worker.d.ts.map +1 -0
- package/dist/workers/execution-worker.js +340 -0
- package/dist/workers/execution-worker.js.map +1 -0
- package/dist/workers/worker-ipc.d.ts +84 -0
- package/dist/workers/worker-ipc.d.ts.map +1 -0
- package/dist/workers/worker-ipc.js +29 -0
- package/dist/workers/worker-ipc.js.map +1 -0
- package/package.json +6 -5
- package/dist/execution/output/ag-ui-integration.d.ts +0 -96
- package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
- package/dist/execution/output/ag-ui-integration.js +0 -96
- package/dist/execution/output/ag-ui-integration.js.map +0 -1
- package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
- package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
- package/dist/execution/output/claude-code-output-processor.js +0 -769
- package/dist/execution/output/claude-code-output-processor.js.map +0 -1
- package/dist/public/assets/index-B3SEMufD.js +0 -580
- package/dist/public/assets/index-B3SEMufD.js.map +0 -1
- package/dist/public/assets/index-D2YGL3gX.css +0 -1
- package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
- package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPC Message Type Definitions for Worker Pool
|
|
3
|
+
*
|
|
4
|
+
* Defines the message protocol for bidirectional communication between
|
|
5
|
+
* main server process and worker processes.
|
|
6
|
+
*
|
|
7
|
+
* @module workers/worker-ipc
|
|
8
|
+
*/
|
|
9
|
+
import type { ExecutionStatus } from "@sudocode-ai/types";
|
|
10
|
+
/**
|
|
11
|
+
* Output event from worker (logs, status updates)
|
|
12
|
+
*/
|
|
13
|
+
export interface OutputEvent {
|
|
14
|
+
type: "stdout" | "stderr" | "log";
|
|
15
|
+
data: string;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Execution result upon completion
|
|
20
|
+
*/
|
|
21
|
+
export interface ExecutionResult {
|
|
22
|
+
status: ExecutionStatus;
|
|
23
|
+
exitCode?: number;
|
|
24
|
+
error?: string;
|
|
25
|
+
completedAt: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Messages sent from Worker → Main Process
|
|
29
|
+
*/
|
|
30
|
+
export type WorkerToMainMessage = {
|
|
31
|
+
type: "ready";
|
|
32
|
+
executionId: string;
|
|
33
|
+
workerId: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: "log";
|
|
36
|
+
executionId: string;
|
|
37
|
+
data: OutputEvent;
|
|
38
|
+
} | {
|
|
39
|
+
type: "agui-event";
|
|
40
|
+
executionId: string;
|
|
41
|
+
event: any;
|
|
42
|
+
} | {
|
|
43
|
+
type: "status";
|
|
44
|
+
executionId: string;
|
|
45
|
+
status: ExecutionStatus;
|
|
46
|
+
} | {
|
|
47
|
+
type: "complete";
|
|
48
|
+
executionId: string;
|
|
49
|
+
result: ExecutionResult;
|
|
50
|
+
} | {
|
|
51
|
+
type: "error";
|
|
52
|
+
executionId: string;
|
|
53
|
+
error: string;
|
|
54
|
+
fatal?: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Messages sent from Main Process → Worker
|
|
58
|
+
*/
|
|
59
|
+
export type MainToWorkerMessage = {
|
|
60
|
+
type: "cancel";
|
|
61
|
+
executionId: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "ping";
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Worker environment configuration
|
|
67
|
+
*/
|
|
68
|
+
export interface WorkerEnv {
|
|
69
|
+
EXECUTION_ID: string;
|
|
70
|
+
PROJECT_ID: string;
|
|
71
|
+
REPO_PATH: string;
|
|
72
|
+
DB_PATH: string;
|
|
73
|
+
MAX_MEMORY_MB?: string;
|
|
74
|
+
WORKER_ID: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Type guard for WorkerToMainMessage
|
|
78
|
+
*/
|
|
79
|
+
export declare function isWorkerMessage(msg: any): msg is WorkerToMainMessage;
|
|
80
|
+
/**
|
|
81
|
+
* Type guard for MainToWorkerMessage
|
|
82
|
+
*/
|
|
83
|
+
export declare function isMainMessage(msg: any): msg is MainToWorkerMessage;
|
|
84
|
+
//# sourceMappingURL=worker-ipc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-ipc.d.ts","sourceRoot":"","sources":["../../src/workers/worker-ipc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI1D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;CACnB,GAED;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;CACZ,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;CACzB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;CACzB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAUpE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAQlE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPC Message Type Definitions for Worker Pool
|
|
3
|
+
*
|
|
4
|
+
* Defines the message protocol for bidirectional communication between
|
|
5
|
+
* main server process and worker processes.
|
|
6
|
+
*
|
|
7
|
+
* @module workers/worker-ipc
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Type guard for WorkerToMainMessage
|
|
11
|
+
*/
|
|
12
|
+
export function isWorkerMessage(msg) {
|
|
13
|
+
return (msg &&
|
|
14
|
+
typeof msg === "object" &&
|
|
15
|
+
"type" in msg &&
|
|
16
|
+
typeof msg.type === "string" &&
|
|
17
|
+
["ready", "log", "agui-event", "status", "complete", "error"].includes(msg.type));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Type guard for MainToWorkerMessage
|
|
21
|
+
*/
|
|
22
|
+
export function isMainMessage(msg) {
|
|
23
|
+
return (msg &&
|
|
24
|
+
typeof msg === "object" &&
|
|
25
|
+
"type" in msg &&
|
|
26
|
+
typeof msg.type === "string" &&
|
|
27
|
+
["cancel", "ping"].includes(msg.type));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=worker-ipc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-ipc.js","sourceRoot":"","sources":["../../src/workers/worker-ipc.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAsFH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAQ;IACtC,OAAO,CACL,GAAG;QACH,OAAO,GAAG,KAAK,QAAQ;QACvB,MAAM,IAAI,GAAG;QACb,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;QAC5B,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,CACpE,GAAG,CAAC,IAAI,CACT,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAQ;IACpC,OAAO,CACL,GAAG;QACH,OAAO,GAAG,KAAK,QAAQ;QACvB,MAAM,IAAI,GAAG;QACb,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;QAC5B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CACtC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudocode-ai/local-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Local backend server for sudocode - provides REST API and WebSocket endpoints",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@ag-ui/core": "^0.0.39",
|
|
44
|
-
"@sudocode-ai/cli": "^0.1.
|
|
45
|
-
"@sudocode-ai/types": "^0.1.
|
|
44
|
+
"@sudocode-ai/cli": "^0.1.8",
|
|
45
|
+
"@sudocode-ai/types": "^0.1.8",
|
|
46
46
|
"@types/ws": "^8.18.1",
|
|
47
|
-
"agent-execution-engine": "^0.0.
|
|
47
|
+
"agent-execution-engine": "^0.0.12",
|
|
48
48
|
"async-mutex": "^0.5.0",
|
|
49
49
|
"better-sqlite3": "^11.10.0",
|
|
50
50
|
"cors": "^2.8.5",
|
|
51
|
-
"dotenv": "^16.4.5",
|
|
52
51
|
"express": "^4.18.2",
|
|
53
52
|
"glob": "^10.4.5",
|
|
54
53
|
"node-fetch": "^2.7.0",
|
|
54
|
+
"which": "^6.0.0",
|
|
55
55
|
"ws": "^8.18.3",
|
|
56
56
|
"zod": "^3.22.4"
|
|
57
57
|
},
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"@types/express": "^4.17.21",
|
|
62
62
|
"@types/node": "^20.11.19",
|
|
63
63
|
"@types/supertest": "^6.0.3",
|
|
64
|
+
"@types/which": "^3.0.4",
|
|
64
65
|
"esbuild": "^0.27.0",
|
|
65
66
|
"supertest": "^7.1.4",
|
|
66
67
|
"tsx": "^4.7.1",
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AG-UI Integration Helpers
|
|
3
|
-
*
|
|
4
|
-
* Factory functions and helpers to wire SPEC-007 output processing with SPEC-009 AG-UI streaming.
|
|
5
|
-
* Simplifies the integration between ClaudeCodeOutputProcessor and AgUiEventAdapter.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/output/ag-ui-integration
|
|
8
|
-
*/
|
|
9
|
-
import { AgUiEventAdapter } from './ag-ui-adapter.js';
|
|
10
|
-
import type { IOutputProcessor } from './types.js';
|
|
11
|
-
/**
|
|
12
|
-
* AG-UI System containing processor and adapter
|
|
13
|
-
*
|
|
14
|
-
* The processor handles parsing Claude Code output and emitting events.
|
|
15
|
-
* The adapter transforms those events into AG-UI protocol events.
|
|
16
|
-
*/
|
|
17
|
-
export interface AgUiSystem {
|
|
18
|
-
/** Output processor for parsing Claude Code stream-json */
|
|
19
|
-
processor: IOutputProcessor;
|
|
20
|
-
/** AG-UI event adapter for broadcasting events */
|
|
21
|
-
adapter: AgUiEventAdapter;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Create a complete AG-UI system with processor and adapter pre-wired
|
|
25
|
-
*
|
|
26
|
-
* This is the recommended way to create an AG-UI streaming system.
|
|
27
|
-
* It automatically:
|
|
28
|
-
* - Creates a ClaudeCodeOutputProcessor
|
|
29
|
-
* - Creates an AgUiEventAdapter with the provided runId
|
|
30
|
-
* - Wires the processor to emit events through the adapter
|
|
31
|
-
*
|
|
32
|
-
* @param runId - Unique identifier for this execution run
|
|
33
|
-
* @param threadId - Optional thread ID (defaults to runId)
|
|
34
|
-
* @returns Complete AG-UI system ready to process output
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* const { processor, adapter } = createAgUiSystem('run-123');
|
|
39
|
-
*
|
|
40
|
-
* // Wire adapter to transport for SSE streaming
|
|
41
|
-
* transportManager.connectAdapter(adapter, 'run-123');
|
|
42
|
-
*
|
|
43
|
-
* // Process Claude Code output
|
|
44
|
-
* await processor.processLine('{"type":"assistant",...}');
|
|
45
|
-
*
|
|
46
|
-
* // Events automatically flow: processor -> adapter -> transport -> SSE clients
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function createAgUiSystem(runId: string, threadId?: string): AgUiSystem;
|
|
50
|
-
/**
|
|
51
|
-
* Manually wire an output processor to an AG-UI adapter
|
|
52
|
-
*
|
|
53
|
-
* Use this when you need more control over processor/adapter creation.
|
|
54
|
-
* This function handles all the event handler registration.
|
|
55
|
-
*
|
|
56
|
-
* @param processor - Output processor to wire
|
|
57
|
-
* @param adapter - AG-UI adapter to receive events
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* const processor = new ClaudeCodeOutputProcessor();
|
|
62
|
-
* const adapter = new AgUiEventAdapter('run-123');
|
|
63
|
-
*
|
|
64
|
-
* // Manually wire them together
|
|
65
|
-
* wireManually(processor, adapter);
|
|
66
|
-
*
|
|
67
|
-
* // Now processor events will flow to adapter
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
export declare function wireManually(processor: IOutputProcessor, adapter: AgUiEventAdapter): void;
|
|
71
|
-
/**
|
|
72
|
-
* Create an AG-UI system with custom processor implementation
|
|
73
|
-
*
|
|
74
|
-
* Use this when you have a custom output processor that implements IOutputProcessor.
|
|
75
|
-
* The processor will be wired to a new AgUiEventAdapter.
|
|
76
|
-
*
|
|
77
|
-
* @param processor - Custom output processor implementation
|
|
78
|
-
* @param runId - Unique identifier for this execution run
|
|
79
|
-
* @param threadId - Optional thread ID (defaults to runId)
|
|
80
|
-
* @returns AG-UI system with your custom processor
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* ```typescript
|
|
84
|
-
* class CustomProcessor implements IOutputProcessor {
|
|
85
|
-
* // ... your implementation
|
|
86
|
-
* }
|
|
87
|
-
*
|
|
88
|
-
* const processor = new CustomProcessor();
|
|
89
|
-
* const { processor, adapter } = createAgUiSystemWithProcessor(
|
|
90
|
-
* processor,
|
|
91
|
-
* 'run-123'
|
|
92
|
-
* );
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export declare function createAgUiSystemWithProcessor(processor: IOutputProcessor, runId: string, threadId?: string): AgUiSystem;
|
|
96
|
-
//# sourceMappingURL=ag-ui-integration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ag-ui-integration.d.ts","sourceRoot":"","sources":["../../../src/execution/output/ag-ui-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,2DAA2D;IAC3D,SAAS,EAAE,gBAAgB,CAAC;IAC5B,kDAAkD;IAClD,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,UAAU,CAQZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,GAChB,UAAU,CAKZ"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AG-UI Integration Helpers
|
|
3
|
-
*
|
|
4
|
-
* Factory functions and helpers to wire SPEC-007 output processing with SPEC-009 AG-UI streaming.
|
|
5
|
-
* Simplifies the integration between ClaudeCodeOutputProcessor and AgUiEventAdapter.
|
|
6
|
-
*
|
|
7
|
-
* @module execution/output/ag-ui-integration
|
|
8
|
-
*/
|
|
9
|
-
import { ClaudeCodeOutputProcessor } from './claude-code-output-processor.js';
|
|
10
|
-
import { AgUiEventAdapter } from './ag-ui-adapter.js';
|
|
11
|
-
/**
|
|
12
|
-
* Create a complete AG-UI system with processor and adapter pre-wired
|
|
13
|
-
*
|
|
14
|
-
* This is the recommended way to create an AG-UI streaming system.
|
|
15
|
-
* It automatically:
|
|
16
|
-
* - Creates a ClaudeCodeOutputProcessor
|
|
17
|
-
* - Creates an AgUiEventAdapter with the provided runId
|
|
18
|
-
* - Wires the processor to emit events through the adapter
|
|
19
|
-
*
|
|
20
|
-
* @param runId - Unique identifier for this execution run
|
|
21
|
-
* @param threadId - Optional thread ID (defaults to runId)
|
|
22
|
-
* @returns Complete AG-UI system ready to process output
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const { processor, adapter } = createAgUiSystem('run-123');
|
|
27
|
-
*
|
|
28
|
-
* // Wire adapter to transport for SSE streaming
|
|
29
|
-
* transportManager.connectAdapter(adapter, 'run-123');
|
|
30
|
-
*
|
|
31
|
-
* // Process Claude Code output
|
|
32
|
-
* await processor.processLine('{"type":"assistant",...}');
|
|
33
|
-
*
|
|
34
|
-
* // Events automatically flow: processor -> adapter -> transport -> SSE clients
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export function createAgUiSystem(runId, threadId) {
|
|
38
|
-
const processor = new ClaudeCodeOutputProcessor();
|
|
39
|
-
const adapter = new AgUiEventAdapter(runId, threadId);
|
|
40
|
-
// Wire processor events to adapter
|
|
41
|
-
adapter.connectToProcessor(processor);
|
|
42
|
-
return { processor, adapter };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Manually wire an output processor to an AG-UI adapter
|
|
46
|
-
*
|
|
47
|
-
* Use this when you need more control over processor/adapter creation.
|
|
48
|
-
* This function handles all the event handler registration.
|
|
49
|
-
*
|
|
50
|
-
* @param processor - Output processor to wire
|
|
51
|
-
* @param adapter - AG-UI adapter to receive events
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* const processor = new ClaudeCodeOutputProcessor();
|
|
56
|
-
* const adapter = new AgUiEventAdapter('run-123');
|
|
57
|
-
*
|
|
58
|
-
* // Manually wire them together
|
|
59
|
-
* wireManually(processor, adapter);
|
|
60
|
-
*
|
|
61
|
-
* // Now processor events will flow to adapter
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
export function wireManually(processor, adapter) {
|
|
65
|
-
adapter.connectToProcessor(processor);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Create an AG-UI system with custom processor implementation
|
|
69
|
-
*
|
|
70
|
-
* Use this when you have a custom output processor that implements IOutputProcessor.
|
|
71
|
-
* The processor will be wired to a new AgUiEventAdapter.
|
|
72
|
-
*
|
|
73
|
-
* @param processor - Custom output processor implementation
|
|
74
|
-
* @param runId - Unique identifier for this execution run
|
|
75
|
-
* @param threadId - Optional thread ID (defaults to runId)
|
|
76
|
-
* @returns AG-UI system with your custom processor
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* class CustomProcessor implements IOutputProcessor {
|
|
81
|
-
* // ... your implementation
|
|
82
|
-
* }
|
|
83
|
-
*
|
|
84
|
-
* const processor = new CustomProcessor();
|
|
85
|
-
* const { processor, adapter } = createAgUiSystemWithProcessor(
|
|
86
|
-
* processor,
|
|
87
|
-
* 'run-123'
|
|
88
|
-
* );
|
|
89
|
-
* ```
|
|
90
|
-
*/
|
|
91
|
-
export function createAgUiSystemWithProcessor(processor, runId, threadId) {
|
|
92
|
-
const adapter = new AgUiEventAdapter(runId, threadId);
|
|
93
|
-
adapter.connectToProcessor(processor);
|
|
94
|
-
return { processor, adapter };
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=ag-ui-integration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ag-ui-integration.js","sourceRoot":"","sources":["../../../src/execution/output/ag-ui-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAgBtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,QAAiB;IAEjB,MAAM,SAAS,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAEtD,mCAAmC;IACnC,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEtC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAC1B,SAA2B,EAC3B,OAAyB;IAEzB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,SAA2B,EAC3B,KAAa,EACb,QAAiB;IAEjB,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEtC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Code Output Processor
|
|
3
|
-
*
|
|
4
|
-
* Implements the IOutputProcessor interface specifically for parsing
|
|
5
|
-
* Claude Code's stream-json output format in real-time.
|
|
6
|
-
*
|
|
7
|
-
* This processor is tailored to Claude Code's CLI output and handles its
|
|
8
|
-
* specific message structure, tool calling patterns, and metadata format.
|
|
9
|
-
*
|
|
10
|
-
* @module execution/output/claude-code-output-processor
|
|
11
|
-
*/
|
|
12
|
-
import type { IOutputProcessor, ProcessingMetrics, ToolCall, FileChange, ToolCallHandler, FileChangeHandler, ProgressHandler, ErrorHandler } from "./types.js";
|
|
13
|
-
/**
|
|
14
|
-
* ClaudeCodeOutputProcessor - Parses Claude Code's stream-json output
|
|
15
|
-
*
|
|
16
|
-
* This processor is specifically designed for Claude Code's output format.
|
|
17
|
-
* It handles line-by-line parsing of Claude's stream-json messages,
|
|
18
|
-
* extracting tool calls, file changes, and usage metrics in real-time.
|
|
19
|
-
*
|
|
20
|
-
* **Claude Code Specific Features:**
|
|
21
|
-
* - Parses Claude's message.content array structure
|
|
22
|
-
* - Handles tool_use and tool_result content types
|
|
23
|
-
* - Extracts usage metrics from result messages
|
|
24
|
-
* - Processes Claude-specific error formats
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const processor = new ClaudeCodeOutputProcessor();
|
|
29
|
-
*
|
|
30
|
-
* processor.onToolCall((toolCall) => {
|
|
31
|
-
* console.log(`Claude called tool: ${toolCall.name}`, toolCall.input);
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // Process Claude Code's stream-json output
|
|
35
|
-
* await processor.processLine('{"type":"assistant","message":{"content":[...]}}');
|
|
36
|
-
* const metrics = processor.getMetrics();
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare class ClaudeCodeOutputProcessor implements IOutputProcessor {
|
|
40
|
-
private _metrics;
|
|
41
|
-
private _toolCalls;
|
|
42
|
-
private _fileChanges;
|
|
43
|
-
private _toolCallHandlers;
|
|
44
|
-
private _fileChangeHandlers;
|
|
45
|
-
private _progressHandlers;
|
|
46
|
-
private _errorHandlers;
|
|
47
|
-
private _messageHandlers;
|
|
48
|
-
private _usageHandlers;
|
|
49
|
-
private _lineNumber;
|
|
50
|
-
constructor();
|
|
51
|
-
/**
|
|
52
|
-
* Process a single line of Claude Code's stream-json output
|
|
53
|
-
*
|
|
54
|
-
* Parses the JSON line and routes to appropriate handler based on message type.
|
|
55
|
-
* Handles malformed JSON gracefully and skips empty lines.
|
|
56
|
-
*
|
|
57
|
-
* @param line - Raw JSON line from Claude Code CLI output
|
|
58
|
-
*/
|
|
59
|
-
processLine(line: string): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Get current processing metrics
|
|
62
|
-
*
|
|
63
|
-
* @returns Current aggregate metrics
|
|
64
|
-
*/
|
|
65
|
-
getMetrics(): ProcessingMetrics;
|
|
66
|
-
/**
|
|
67
|
-
* Get all tool calls recorded during processing
|
|
68
|
-
*
|
|
69
|
-
* @returns Array of all tool calls
|
|
70
|
-
*/
|
|
71
|
-
getToolCalls(): ToolCall[];
|
|
72
|
-
/**
|
|
73
|
-
* Get all file changes detected during processing
|
|
74
|
-
*
|
|
75
|
-
* @returns Array of all file changes
|
|
76
|
-
*/
|
|
77
|
-
getFileChanges(): FileChange[];
|
|
78
|
-
/**
|
|
79
|
-
* Register a callback for tool call events
|
|
80
|
-
*
|
|
81
|
-
* @param handler - Function to call when a tool is invoked
|
|
82
|
-
*/
|
|
83
|
-
onToolCall(handler: ToolCallHandler): void;
|
|
84
|
-
/**
|
|
85
|
-
* Register a callback for file change events
|
|
86
|
-
*
|
|
87
|
-
* @param handler - Function to call when a file is modified
|
|
88
|
-
*/
|
|
89
|
-
onFileChange(handler: FileChangeHandler): void;
|
|
90
|
-
/**
|
|
91
|
-
* Register a callback for progress update events
|
|
92
|
-
*
|
|
93
|
-
* @param handler - Function to call when metrics are updated
|
|
94
|
-
*/
|
|
95
|
-
onProgress(handler: ProgressHandler): void;
|
|
96
|
-
/**
|
|
97
|
-
* Register a callback for error events
|
|
98
|
-
*
|
|
99
|
-
* @param handler - Function to call when an error occurs
|
|
100
|
-
*/
|
|
101
|
-
onError(handler: ErrorHandler): void;
|
|
102
|
-
/**
|
|
103
|
-
* Register a callback for message events
|
|
104
|
-
*
|
|
105
|
-
* @param handler - Function to call when a text message is received
|
|
106
|
-
*/
|
|
107
|
-
onMessage(handler: import("./types.js").MessageHandler): void;
|
|
108
|
-
/**
|
|
109
|
-
* Register a callback for usage metric updates
|
|
110
|
-
*
|
|
111
|
-
* @param handler - Function to call when usage metrics are updated
|
|
112
|
-
*/
|
|
113
|
-
onUsage(handler: import("./types.js").UsageHandler): void;
|
|
114
|
-
/**
|
|
115
|
-
* Get tool calls filtered by tool name
|
|
116
|
-
*
|
|
117
|
-
* @param toolName - Name of the tool to filter by (e.g., 'Bash', 'Read', 'Write')
|
|
118
|
-
* @returns Array of tool calls matching the tool name
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```typescript
|
|
122
|
-
* const bashCalls = processor.getToolCallsByName('Bash');
|
|
123
|
-
* console.log(`Executed ${bashCalls.length} bash commands`);
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
getToolCallsByName(toolName: string): ToolCall[];
|
|
127
|
-
/**
|
|
128
|
-
* Get file changes filtered by file path
|
|
129
|
-
*
|
|
130
|
-
* @param path - File path to filter by (exact match)
|
|
131
|
-
* @returns Array of file changes to the specified path
|
|
132
|
-
*
|
|
133
|
-
* @example
|
|
134
|
-
* ```typescript
|
|
135
|
-
* const changes = processor.getFileChangesByPath('src/index.ts');
|
|
136
|
-
* console.log(`File modified ${changes.length} times`);
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
getFileChangesByPath(path: string): FileChange[];
|
|
140
|
-
/**
|
|
141
|
-
* Get file changes filtered by operation type
|
|
142
|
-
*
|
|
143
|
-
* @param operation - Operation type to filter by ('read', 'write', 'edit')
|
|
144
|
-
* @returns Array of file changes with the specified operation
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* const writes = processor.getFileChangesByOperation('write');
|
|
149
|
-
* console.log(`Wrote to ${writes.length} files`);
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
getFileChangesByOperation(operation: "read" | "write" | "edit"): FileChange[];
|
|
153
|
-
/**
|
|
154
|
-
* Get only failed tool calls
|
|
155
|
-
*
|
|
156
|
-
* @returns Array of tool calls with status='error'
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```typescript
|
|
160
|
-
* const failures = processor.getFailedToolCalls();
|
|
161
|
-
* failures.forEach(call => {
|
|
162
|
-
* console.error(`${call.name} failed:`, call.error);
|
|
163
|
-
* });
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
getFailedToolCalls(): ToolCall[];
|
|
167
|
-
/**
|
|
168
|
-
* Get only successful tool calls
|
|
169
|
-
*
|
|
170
|
-
* @returns Array of tool calls with status='success'
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ```typescript
|
|
174
|
-
* const successes = processor.getSuccessfulToolCalls();
|
|
175
|
-
* console.log(`${successes.length} tool calls succeeded`);
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
getSuccessfulToolCalls(): ToolCall[];
|
|
179
|
-
/**
|
|
180
|
-
* Get total cost of execution in USD
|
|
181
|
-
*
|
|
182
|
-
* @returns Total cost based on token usage
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```typescript
|
|
186
|
-
* const cost = processor.getTotalCost();
|
|
187
|
-
* console.log(`Execution cost: $${cost.toFixed(2)}`);
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
getTotalCost(): number;
|
|
191
|
-
/**
|
|
192
|
-
* Get execution summary with aggregate statistics
|
|
193
|
-
*
|
|
194
|
-
* Provides a high-level overview of the execution including:
|
|
195
|
-
* - Tool call counts by type
|
|
196
|
-
* - File operation counts by type
|
|
197
|
-
* - Success rates
|
|
198
|
-
* - Token usage and costs
|
|
199
|
-
* - Duration
|
|
200
|
-
*
|
|
201
|
-
* @returns Complete execution summary
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ```typescript
|
|
205
|
-
* const summary = processor.getExecutionSummary();
|
|
206
|
-
* console.log('Execution Summary:', {
|
|
207
|
-
* duration: `${summary.duration}ms`,
|
|
208
|
-
* cost: `$${summary.totalCost.toFixed(2)}`,
|
|
209
|
-
* successRate: `${summary.successRate.toFixed(1)}%`,
|
|
210
|
-
* toolCalls: summary.toolCallsByType,
|
|
211
|
-
* });
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
getExecutionSummary(): import("./types.js").ExecutionSummary;
|
|
215
|
-
/**
|
|
216
|
-
* Handle tool_use message from Claude Code
|
|
217
|
-
*
|
|
218
|
-
* Creates a new ToolCall entry with pending status and emits onToolCall event.
|
|
219
|
-
* Also detects potential file operations based on tool name.
|
|
220
|
-
*
|
|
221
|
-
* @param message - Parsed tool_use message
|
|
222
|
-
*/
|
|
223
|
-
private _handleToolUse;
|
|
224
|
-
/**
|
|
225
|
-
* Handle tool_result message from Claude Code
|
|
226
|
-
*
|
|
227
|
-
* Updates the corresponding ToolCall with result/error status.
|
|
228
|
-
* Detects file changes from Read/Write/Edit tools and emits onFileChange event.
|
|
229
|
-
*
|
|
230
|
-
* @param message - Parsed tool_result message
|
|
231
|
-
*/
|
|
232
|
-
private _handleToolResult;
|
|
233
|
-
/**
|
|
234
|
-
* Handle text message from Claude Code
|
|
235
|
-
*
|
|
236
|
-
* Emits message events to registered handlers.
|
|
237
|
-
*
|
|
238
|
-
* @param message - Parsed text message
|
|
239
|
-
*/
|
|
240
|
-
private _handleText;
|
|
241
|
-
/**
|
|
242
|
-
* Handle usage message from Claude Code
|
|
243
|
-
*
|
|
244
|
-
* Updates usage metrics with token counts and calculates cost.
|
|
245
|
-
* Emits usage events to registered handlers.
|
|
246
|
-
*
|
|
247
|
-
* @param message - Parsed usage message
|
|
248
|
-
*/
|
|
249
|
-
private _handleUsage;
|
|
250
|
-
/**
|
|
251
|
-
* Handle error message from Claude Code
|
|
252
|
-
*
|
|
253
|
-
* Tracks error in metrics and emits onError event.
|
|
254
|
-
*
|
|
255
|
-
* @param message - Parsed error message
|
|
256
|
-
*/
|
|
257
|
-
private _handleError;
|
|
258
|
-
/**
|
|
259
|
-
* Detect file change from a tool call
|
|
260
|
-
*
|
|
261
|
-
* Analyzes tool calls to file operation tools (Read/Write/Edit) and
|
|
262
|
-
* extracts file change information.
|
|
263
|
-
*
|
|
264
|
-
* @param toolCall - The completed tool call
|
|
265
|
-
* @param message - The tool result message
|
|
266
|
-
* @returns FileChange object if file operation detected, null otherwise
|
|
267
|
-
*/
|
|
268
|
-
private _detectFileChange;
|
|
269
|
-
/**
|
|
270
|
-
* Detect the type of message from parsed Claude Code JSON data
|
|
271
|
-
*
|
|
272
|
-
* Claude Code uses a specific structure with type and message.content fields.
|
|
273
|
-
* This method understands Claude's output format.
|
|
274
|
-
*
|
|
275
|
-
* @param data - Parsed JSON object from Claude Code
|
|
276
|
-
* @returns Message type
|
|
277
|
-
*/
|
|
278
|
-
private _detectMessageType;
|
|
279
|
-
/**
|
|
280
|
-
* Parse raw Claude Code JSON data into an OutputMessage
|
|
281
|
-
*
|
|
282
|
-
* @param data - Parsed JSON object from Claude Code
|
|
283
|
-
* @param type - Detected message type
|
|
284
|
-
* @returns Structured OutputMessage
|
|
285
|
-
*/
|
|
286
|
-
private _parseMessage;
|
|
287
|
-
/**
|
|
288
|
-
* Extract text content from Claude Code message data
|
|
289
|
-
*
|
|
290
|
-
* Claude can return content as a string or an array of content blocks.
|
|
291
|
-
* This method handles both formats.
|
|
292
|
-
*/
|
|
293
|
-
private _extractTextContent;
|
|
294
|
-
/**
|
|
295
|
-
* Extract tool use information from Claude Code message data
|
|
296
|
-
*
|
|
297
|
-
* Claude includes tool_use blocks in the message.content array.
|
|
298
|
-
*/
|
|
299
|
-
private _extractToolUse;
|
|
300
|
-
/**
|
|
301
|
-
* Extract tool result information from Claude Code message data
|
|
302
|
-
*
|
|
303
|
-
* Claude includes tool_result blocks with execution results.
|
|
304
|
-
*/
|
|
305
|
-
private _extractToolResult;
|
|
306
|
-
/**
|
|
307
|
-
* Extract usage information from Claude Code result message
|
|
308
|
-
*
|
|
309
|
-
* Claude provides token usage in result messages with detailed breakdowns.
|
|
310
|
-
*/
|
|
311
|
-
private _extractUsage;
|
|
312
|
-
/**
|
|
313
|
-
* Emit progress event to all registered handlers
|
|
314
|
-
*/
|
|
315
|
-
private _emitProgress;
|
|
316
|
-
/**
|
|
317
|
-
* Emit error event to all registered handlers
|
|
318
|
-
*/
|
|
319
|
-
private _emitError;
|
|
320
|
-
}
|
|
321
|
-
//# sourceMappingURL=claude-code-output-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code-output-processor.d.ts","sourceRoot":"","sources":["../../../src/execution/output/claude-code-output-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAEhB,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,YAAY,EAIb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IAEhE,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,YAAY,CAAe;IAGnC,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,mBAAmB,CAA2B;IACtD,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,cAAc,CAAsB;IAG5C,OAAO,CAAC,WAAW,CAAK;;IA0BxB;;;;;;;OAOG;IACG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkE9C;;;;OAIG;IACH,UAAU,IAAI,iBAAiB;IAU/B;;;;OAIG;IACH,YAAY,IAAI,QAAQ,EAAE;IAI1B;;;;OAIG;IACH,cAAc,IAAI,UAAU,EAAE;IAI9B;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAI1C;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAI9C;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAI1C;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAIpC;;;;OAIG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,YAAY,EAAE,cAAc,GAAG,IAAI;IAI7D;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,YAAY,EAAE,YAAY,GAAG,IAAI;IAQzD;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE;IAIhD;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE;IAIhD;;;;;;;;;;;OAWG;IACH,yBAAyB,CACvB,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GACnC,UAAU,EAAE;IAMf;;;;;;;;;;;;OAYG;IACH,kBAAkB,IAAI,QAAQ,EAAE;IAIhC;;;;;;;;;;OAUG;IACH,sBAAsB,IAAI,QAAQ,EAAE;IAIpC;;;;;;;;;;OAUG;IACH,YAAY,IAAI,MAAM;IAItB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,mBAAmB,IAAI,OAAO,YAAY,EAAE,gBAAgB;IAsD5D;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IA2BtB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAoCzB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAanB;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IA2BpB;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAmBpB;;;;;;;;;OASG;IACH,OAAO,CAAC,iBAAiB;IA2CzB;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAoC1B;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAsErB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAgBvB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACH,OAAO,CAAC,aAAa;IAYrB;;OAEG;IACH,OAAO,CAAC,UAAU;CAcnB"}
|