gsd-pi 2.67.0-dev.a5b1d8f → 2.67.0-dev.fe39184
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 +41 -31
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +121 -8
- package/dist/resources/extensions/gsd/auto/phases.js +17 -0
- package/dist/resources/extensions/gsd/auto/session.js +6 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +12 -0
- package/dist/resources/extensions/gsd/auto-start.js +12 -0
- package/dist/resources/extensions/gsd/auto.js +27 -0
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +11 -435
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +1 -4
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +7 -64
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +88 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +2 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +39 -25
- package/dist/resources/extensions/gsd/commands/index.js +8 -1
- package/dist/resources/extensions/gsd/commands-mcp-status.js +43 -7
- package/dist/resources/extensions/gsd/guided-flow.js +16 -0
- package/dist/resources/extensions/gsd/init-wizard.js +37 -0
- package/dist/resources/extensions/gsd/mcp-project-config.js +83 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +508 -0
- package/dist/resources/extensions/gsd/workflow-logger.js +18 -3
- package/dist/resources/extensions/gsd/workflow-mcp.js +261 -0
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/6502.5dcdcf1e1432e20d.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-b49b09f97429b5d0.js → webpack-42a66876b763aa26.js} +1 -1
- package/package.json +4 -2
- package/packages/mcp-server/README.md +38 -0
- package/packages/mcp-server/dist/cli.d.ts +9 -0
- package/packages/mcp-server/dist/cli.d.ts.map +1 -0
- package/packages/mcp-server/dist/cli.js +58 -0
- package/packages/mcp-server/dist/cli.js.map +1 -0
- package/packages/mcp-server/dist/index.d.ts +20 -0
- package/packages/mcp-server/dist/index.d.ts.map +1 -0
- package/packages/mcp-server/dist/index.js +14 -0
- package/packages/mcp-server/dist/index.js.map +1 -0
- package/packages/mcp-server/dist/readers/captures.d.ts +25 -0
- package/packages/mcp-server/dist/readers/captures.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/captures.js +67 -0
- package/packages/mcp-server/dist/readers/captures.js.map +1 -0
- package/packages/mcp-server/dist/readers/doctor-lite.d.ts +20 -0
- package/packages/mcp-server/dist/readers/doctor-lite.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/doctor-lite.js +173 -0
- package/packages/mcp-server/dist/readers/doctor-lite.js.map +1 -0
- package/packages/mcp-server/dist/readers/index.d.ts +14 -0
- package/packages/mcp-server/dist/readers/index.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/index.js +10 -0
- package/packages/mcp-server/dist/readers/index.js.map +1 -0
- package/packages/mcp-server/dist/readers/knowledge.d.ts +18 -0
- package/packages/mcp-server/dist/readers/knowledge.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/knowledge.js +82 -0
- package/packages/mcp-server/dist/readers/knowledge.js.map +1 -0
- package/packages/mcp-server/dist/readers/metrics.d.ts +32 -0
- package/packages/mcp-server/dist/readers/metrics.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/metrics.js +74 -0
- package/packages/mcp-server/dist/readers/metrics.js.map +1 -0
- package/packages/mcp-server/dist/readers/paths.d.ts +42 -0
- package/packages/mcp-server/dist/readers/paths.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/paths.js +199 -0
- package/packages/mcp-server/dist/readers/paths.js.map +1 -0
- package/packages/mcp-server/dist/readers/roadmap.d.ts +26 -0
- package/packages/mcp-server/dist/readers/roadmap.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/roadmap.js +194 -0
- package/packages/mcp-server/dist/readers/roadmap.js.map +1 -0
- package/packages/mcp-server/dist/readers/state.d.ts +43 -0
- package/packages/mcp-server/dist/readers/state.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/state.js +184 -0
- package/packages/mcp-server/dist/readers/state.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts +28 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -0
- package/packages/mcp-server/dist/server.js +319 -0
- package/packages/mcp-server/dist/server.js.map +1 -0
- package/packages/mcp-server/dist/session-manager.d.ts +54 -0
- package/packages/mcp-server/dist/session-manager.d.ts.map +1 -0
- package/packages/mcp-server/dist/session-manager.js +284 -0
- package/packages/mcp-server/dist/session-manager.js.map +1 -0
- package/packages/mcp-server/dist/types.d.ts +61 -0
- package/packages/mcp-server/dist/types.d.ts.map +1 -0
- package/packages/mcp-server/dist/types.js +11 -0
- package/packages/mcp-server/dist/types.js.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts +9 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.js +532 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -0
- package/packages/mcp-server/src/server.ts +6 -2
- package/packages/mcp-server/src/workflow-tools.test.ts +976 -0
- package/packages/mcp-server/src/workflow-tools.ts +997 -0
- package/packages/mcp-server/tsconfig.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +14 -6
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +53 -0
- package/packages/pi-agent-core/src/agent-loop.ts +20 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +28 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +17 -12
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +19 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +54 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +18 -12
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +21 -0
- package/packages/rpc-client/dist/index.d.ts +10 -0
- package/packages/rpc-client/dist/index.d.ts.map +1 -0
- package/packages/rpc-client/dist/index.js +9 -0
- package/packages/rpc-client/dist/index.js.map +1 -0
- package/packages/rpc-client/dist/jsonl.d.ts +17 -0
- package/packages/rpc-client/dist/jsonl.d.ts.map +1 -0
- package/packages/rpc-client/dist/jsonl.js +54 -0
- package/packages/rpc-client/dist/jsonl.js.map +1 -0
- package/packages/rpc-client/dist/rpc-client.d.ts +259 -0
- package/packages/rpc-client/dist/rpc-client.d.ts.map +1 -0
- package/packages/rpc-client/dist/rpc-client.js +541 -0
- package/packages/rpc-client/dist/rpc-client.js.map +1 -0
- package/packages/rpc-client/dist/rpc-client.test.d.ts +2 -0
- package/packages/rpc-client/dist/rpc-client.test.d.ts.map +1 -0
- package/packages/rpc-client/dist/rpc-client.test.js +477 -0
- package/packages/rpc-client/dist/rpc-client.test.js.map +1 -0
- package/packages/rpc-client/dist/rpc-types.d.ts +566 -0
- package/packages/rpc-client/dist/rpc-types.d.ts.map +1 -0
- package/packages/rpc-client/dist/rpc-types.js +12 -0
- package/packages/rpc-client/dist/rpc-types.js.map +1 -0
- package/scripts/ensure-workspace-builds.cjs +2 -0
- package/scripts/link-workspace-packages.cjs +21 -14
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +157 -8
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +182 -0
- package/src/resources/extensions/gsd/auto/phases.ts +25 -0
- package/src/resources/extensions/gsd/auto/session.ts +6 -0
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +20 -0
- package/src/resources/extensions/gsd/auto-start.ts +15 -1
- package/src/resources/extensions/gsd/auto.ts +29 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +22 -435
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +1 -5
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +7 -72
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +122 -6
- package/src/resources/extensions/gsd/commands/catalog.ts +2 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +53 -26
- package/src/resources/extensions/gsd/commands/index.ts +7 -1
- package/src/resources/extensions/gsd/commands-mcp-status.ts +53 -7
- package/src/resources/extensions/gsd/guided-flow.ts +24 -0
- package/src/resources/extensions/gsd/init-wizard.ts +40 -0
- package/src/resources/extensions/gsd/mcp-project-config.ts +128 -0
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/core-overlay-fallback.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +500 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +625 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +629 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +19 -3
- package/src/resources/extensions/gsd/workflow-mcp.ts +320 -0
- package/dist/web/standalone/.next/static/chunks/6502.b804e48b7919f55e.js +0 -9
- /package/dist/web/standalone/.next/static/{NllX5BEOLdTXS9ypf1i3i → gbSATDX4Jt2ufxzUr5nYm}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{NllX5BEOLdTXS9ypf1i3i → gbSATDX4Jt2ufxzUr5nYm}/_ssgManifest.js +0 -0
|
@@ -97,6 +97,10 @@ export class ToolExecutionComponent extends Container {
|
|
|
97
97
|
// When true, this component intentionally renders no lines
|
|
98
98
|
private hideComponent = false;
|
|
99
99
|
|
|
100
|
+
private get normalizedToolName(): string {
|
|
101
|
+
return typeof this.toolName === "string" ? this.toolName.toLowerCase() : "";
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
constructor(
|
|
101
105
|
toolName: string,
|
|
102
106
|
args: any,
|
|
@@ -121,7 +125,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
121
125
|
|
|
122
126
|
// Use contentBox for bash (visual truncation) or custom tools with custom renderers
|
|
123
127
|
// Use contentText for built-in tools (including overrides without custom renderers)
|
|
124
|
-
if (
|
|
128
|
+
if (this.normalizedToolName === "bash" || (toolDefinition && !this.shouldUseBuiltInRenderer())) {
|
|
125
129
|
this.addChild(this.contentBox);
|
|
126
130
|
} else {
|
|
127
131
|
this.addChild(this.contentText);
|
|
@@ -136,7 +140,8 @@ export class ToolExecutionComponent extends Container {
|
|
|
136
140
|
* or the toolDefinition doesn't provide custom renderers.
|
|
137
141
|
*/
|
|
138
142
|
private shouldUseBuiltInRenderer(): boolean {
|
|
139
|
-
const
|
|
143
|
+
const normalizedToolName = this.normalizedToolName;
|
|
144
|
+
const isBuiltInName = normalizedToolName in allTools;
|
|
140
145
|
const hasCustomRenderers = this.toolDefinition?.renderCall || this.toolDefinition?.renderResult;
|
|
141
146
|
return isBuiltInName && !hasCustomRenderers;
|
|
142
147
|
}
|
|
@@ -152,7 +157,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
152
157
|
|
|
153
158
|
updateArgs(args: any): void {
|
|
154
159
|
this.args = args;
|
|
155
|
-
if (this.
|
|
160
|
+
if (this.normalizedToolName === "write" && this.isPartial) {
|
|
156
161
|
this.updateWriteHighlightCacheIncremental();
|
|
157
162
|
}
|
|
158
163
|
this.updateDisplay();
|
|
@@ -308,7 +313,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
308
313
|
): void {
|
|
309
314
|
this.result = result;
|
|
310
315
|
this.isPartial = isPartial;
|
|
311
|
-
if (this.
|
|
316
|
+
if (this.normalizedToolName === "write" && !isPartial) {
|
|
312
317
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
313
318
|
const fileContent = str(this.args?.content);
|
|
314
319
|
if (rawPath !== null && fileContent !== null) {
|
|
@@ -387,7 +392,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
387
392
|
|
|
388
393
|
// Use built-in rendering for built-in tools (or overrides without custom renderers)
|
|
389
394
|
if (useBuiltInRenderer) {
|
|
390
|
-
if (this.
|
|
395
|
+
if (this.normalizedToolName === "bash") {
|
|
391
396
|
// Bash uses Box with visual line truncation
|
|
392
397
|
this.contentBox.setBgFn(bgFn);
|
|
393
398
|
this.contentBox.clear();
|
|
@@ -629,8 +634,9 @@ export class ToolExecutionComponent extends Container {
|
|
|
629
634
|
private formatToolExecution(): string {
|
|
630
635
|
let text = "";
|
|
631
636
|
const invalidArg = theme.fg("error", "[invalid arg]");
|
|
637
|
+
const normalizedToolName = this.normalizedToolName;
|
|
632
638
|
|
|
633
|
-
if (
|
|
639
|
+
if (normalizedToolName === "read") {
|
|
634
640
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
635
641
|
const path = rawPath !== null ? shortenPath(rawPath) : null;
|
|
636
642
|
const offset = this.args?.offset;
|
|
@@ -692,7 +698,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
692
698
|
}
|
|
693
699
|
}
|
|
694
700
|
}
|
|
695
|
-
} else if (
|
|
701
|
+
} else if (normalizedToolName === "write") {
|
|
696
702
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
697
703
|
const fileContent = str(this.args?.content);
|
|
698
704
|
const path = rawPath !== null ? shortenPath(rawPath) : null;
|
|
@@ -751,7 +757,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
751
757
|
text += `\n\n${theme.fg("error", errorText)}`;
|
|
752
758
|
}
|
|
753
759
|
}
|
|
754
|
-
} else if (
|
|
760
|
+
} else if (normalizedToolName === "edit") {
|
|
755
761
|
const rawPath = str(this.args?.file_path ?? this.args?.path);
|
|
756
762
|
const path = rawPath !== null ? shortenPath(rawPath) : null;
|
|
757
763
|
|
|
@@ -787,7 +793,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
787
793
|
text += `\n\n${renderDiff(this.editDiffPreview.diff, { filePath: rawPath ?? undefined })}`;
|
|
788
794
|
}
|
|
789
795
|
}
|
|
790
|
-
} else if (
|
|
796
|
+
} else if (normalizedToolName === "ls") {
|
|
791
797
|
const rawPath = str(this.args?.path);
|
|
792
798
|
const path = rawPath !== null ? shortenPath(rawPath || ".") : null;
|
|
793
799
|
const limit = this.args?.limit;
|
|
@@ -824,7 +830,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
824
830
|
text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
|
|
825
831
|
}
|
|
826
832
|
}
|
|
827
|
-
} else if (
|
|
833
|
+
} else if (normalizedToolName === "find") {
|
|
828
834
|
const pattern = str(this.args?.pattern);
|
|
829
835
|
const rawPath = str(this.args?.path);
|
|
830
836
|
const path = rawPath !== null ? shortenPath(rawPath || ".") : null;
|
|
@@ -866,7 +872,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
866
872
|
text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
|
|
867
873
|
}
|
|
868
874
|
}
|
|
869
|
-
} else if (
|
|
875
|
+
} else if (normalizedToolName === "grep") {
|
|
870
876
|
const pattern = str(this.args?.pattern);
|
|
871
877
|
const rawPath = str(this.args?.path);
|
|
872
878
|
const path = rawPath !== null ? shortenPath(rawPath || ".") : null;
|
|
@@ -916,7 +922,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
916
922
|
text += `\n${theme.fg("warning", `[Truncated: ${warnings.join(", ")}]`)}`;
|
|
917
923
|
}
|
|
918
924
|
}
|
|
919
|
-
} else if (
|
|
925
|
+
} else if (normalizedToolName === "web_search") {
|
|
920
926
|
// Server-side Anthropic web search
|
|
921
927
|
text = theme.fg("toolTitle", theme.bold("web search"));
|
|
922
928
|
|
|
@@ -121,6 +121,27 @@ export async function handleAgentEvent(host: InteractiveModeStateHost & {
|
|
|
121
121
|
if (host.streamingComponent && event.message.role === "assistant") {
|
|
122
122
|
host.streamingMessage = event.message;
|
|
123
123
|
host.streamingComponent.updateContent(host.streamingMessage);
|
|
124
|
+
|
|
125
|
+
// When the stream adapter signals a completed tool call with an
|
|
126
|
+
// external result (from Claude Code SDK), update the pending
|
|
127
|
+
// ToolExecutionComponent immediately so output is visible in
|
|
128
|
+
// real-time instead of waiting for the session to end.
|
|
129
|
+
const innerEvent = event.assistantMessageEvent;
|
|
130
|
+
if (innerEvent.type === "toolcall_end" && innerEvent.toolCall) {
|
|
131
|
+
const tc = innerEvent.toolCall as any;
|
|
132
|
+
const externalResult = tc.externalResult;
|
|
133
|
+
if (externalResult) {
|
|
134
|
+
const component = host.pendingTools.get(tc.id);
|
|
135
|
+
if (component) {
|
|
136
|
+
component.updateResult({
|
|
137
|
+
content: externalResult.content ?? [{ type: "text", text: "" }],
|
|
138
|
+
details: externalResult.details ?? {},
|
|
139
|
+
isError: externalResult.isError ?? false,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
124
145
|
const contentBlocks = host.streamingMessage.content;
|
|
125
146
|
for (let i = lastProcessedContentIndex; i < contentBlocks.length; i++) {
|
|
126
147
|
const content = contentBlocks[i];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @gsd-build/rpc-client — standalone RPC client SDK for GSD.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all types, JSONL utilities, and the RpcClient class.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./rpc-types.js";
|
|
7
|
+
export { serializeJsonLine, attachJsonlLineReader } from "./jsonl.js";
|
|
8
|
+
export { RpcClient } from "./rpc-client.js";
|
|
9
|
+
export type { RpcClientOptions, RpcEventListener, SdkAgentEvent } from "./rpc-client.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @gsd-build/rpc-client — standalone RPC client SDK for GSD.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all types, JSONL utilities, and the RpcClient class.
|
|
5
|
+
*/
|
|
6
|
+
export * from "./rpc-types.js";
|
|
7
|
+
export { serializeJsonLine, attachJsonlLineReader } from "./jsonl.js";
|
|
8
|
+
export { RpcClient } from "./rpc-client.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/**\n * @gsd-build/rpc-client — standalone RPC client SDK for GSD.\n *\n * Re-exports all types, JSONL utilities, and the RpcClient class.\n */\n\nexport * from \"./rpc-types.js\";\nexport { serializeJsonLine, attachJsonlLineReader } from \"./jsonl.js\";\nexport { RpcClient } from \"./rpc-client.js\";\nexport type { RpcClientOptions, RpcEventListener, SdkAgentEvent } from \"./rpc-client.js\";\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
/**
|
|
3
|
+
* Serialize a single strict JSONL record.
|
|
4
|
+
*
|
|
5
|
+
* Framing is LF-only. Payload strings may contain other Unicode separators such as
|
|
6
|
+
* U+2028 and U+2029. Clients must split records on `\n` only.
|
|
7
|
+
*/
|
|
8
|
+
export declare function serializeJsonLine(value: unknown): string;
|
|
9
|
+
/**
|
|
10
|
+
* Attach an LF-only JSONL reader to a stream.
|
|
11
|
+
*
|
|
12
|
+
* This intentionally does not use Node readline. Readline splits on additional
|
|
13
|
+
* Unicode separators that are valid inside JSON strings and therefore does not
|
|
14
|
+
* implement strict JSONL framing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function attachJsonlLineReader(stream: Readable, onLine: (line: string) => void): () => void;
|
|
17
|
+
//# sourceMappingURL=jsonl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../src/jsonl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CA2ClG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { StringDecoder } from "node:string_decoder";
|
|
2
|
+
/**
|
|
3
|
+
* Serialize a single strict JSONL record.
|
|
4
|
+
*
|
|
5
|
+
* Framing is LF-only. Payload strings may contain other Unicode separators such as
|
|
6
|
+
* U+2028 and U+2029. Clients must split records on `\n` only.
|
|
7
|
+
*/
|
|
8
|
+
export function serializeJsonLine(value) {
|
|
9
|
+
return `${JSON.stringify(value)}\n`;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Attach an LF-only JSONL reader to a stream.
|
|
13
|
+
*
|
|
14
|
+
* This intentionally does not use Node readline. Readline splits on additional
|
|
15
|
+
* Unicode separators that are valid inside JSON strings and therefore does not
|
|
16
|
+
* implement strict JSONL framing.
|
|
17
|
+
*/
|
|
18
|
+
export function attachJsonlLineReader(stream, onLine) {
|
|
19
|
+
const decoder = new StringDecoder("utf8");
|
|
20
|
+
let buffer = "";
|
|
21
|
+
const emitLine = (line) => {
|
|
22
|
+
onLine(line.endsWith("\r") ? line.slice(0, -1) : line);
|
|
23
|
+
};
|
|
24
|
+
const onData = (chunk) => {
|
|
25
|
+
buffer += typeof chunk === "string" ? chunk : decoder.write(chunk);
|
|
26
|
+
while (true) {
|
|
27
|
+
const newlineIndex = buffer.indexOf("\n");
|
|
28
|
+
if (newlineIndex === -1) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
emitLine(buffer.slice(0, newlineIndex));
|
|
32
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const onEnd = () => {
|
|
36
|
+
buffer += decoder.end();
|
|
37
|
+
if (buffer.length > 0) {
|
|
38
|
+
emitLine(buffer);
|
|
39
|
+
buffer = "";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const onError = (_err) => {
|
|
43
|
+
// Stream errors are non-fatal for JSONL reading
|
|
44
|
+
};
|
|
45
|
+
stream.on("data", onData);
|
|
46
|
+
stream.on("end", onEnd);
|
|
47
|
+
stream.on("error", onError);
|
|
48
|
+
return () => {
|
|
49
|
+
stream.off("data", onData);
|
|
50
|
+
stream.off("end", onEnd);
|
|
51
|
+
stream.off("error", onError);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=jsonl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl.js","sourceRoot":"","sources":["../src/jsonl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC/C,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAgB,EAAE,MAA8B;IACrF,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE;QACjC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,KAAsB,EAAE,EAAE;QACzC,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEnE,OAAO,IAAI,EAAE,CAAC;YACb,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;gBACzB,OAAO;YACR,CAAC;YAED,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;YACxC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACzC,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,GAAG,EAAE;QAClB,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACxB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,QAAQ,CAAC,MAAM,CAAC,CAAC;YACjB,MAAM,GAAG,EAAE,CAAC;QACb,CAAC;IACF,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,IAAW,EAAE,EAAE;QAC/B,gDAAgD;IACjD,CAAC,CAAC;IAEF,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE5B,OAAO,GAAG,EAAE;QACX,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type { Readable } from \"node:stream\";\nimport { StringDecoder } from \"node:string_decoder\";\n\n/**\n * Serialize a single strict JSONL record.\n *\n * Framing is LF-only. Payload strings may contain other Unicode separators such as\n * U+2028 and U+2029. Clients must split records on `\\n` only.\n */\nexport function serializeJsonLine(value: unknown): string {\n\treturn `${JSON.stringify(value)}\\n`;\n}\n\n/**\n * Attach an LF-only JSONL reader to a stream.\n *\n * This intentionally does not use Node readline. Readline splits on additional\n * Unicode separators that are valid inside JSON strings and therefore does not\n * implement strict JSONL framing.\n */\nexport function attachJsonlLineReader(stream: Readable, onLine: (line: string) => void): () => void {\n\tconst decoder = new StringDecoder(\"utf8\");\n\tlet buffer = \"\";\n\n\tconst emitLine = (line: string) => {\n\t\tonLine(line.endsWith(\"\\r\") ? line.slice(0, -1) : line);\n\t};\n\n\tconst onData = (chunk: string | Buffer) => {\n\t\tbuffer += typeof chunk === \"string\" ? chunk : decoder.write(chunk);\n\n\t\twhile (true) {\n\t\t\tconst newlineIndex = buffer.indexOf(\"\\n\");\n\t\t\tif (newlineIndex === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\temitLine(buffer.slice(0, newlineIndex));\n\t\t\tbuffer = buffer.slice(newlineIndex + 1);\n\t\t}\n\t};\n\n\tconst onEnd = () => {\n\t\tbuffer += decoder.end();\n\t\tif (buffer.length > 0) {\n\t\t\temitLine(buffer);\n\t\t\tbuffer = \"\";\n\t\t}\n\t};\n\n\tconst onError = (_err: Error) => {\n\t\t// Stream errors are non-fatal for JSONL reading\n\t};\n\n\tstream.on(\"data\", onData);\n\tstream.on(\"end\", onEnd);\n\tstream.on(\"error\", onError);\n\n\treturn () => {\n\t\tstream.off(\"data\", onData);\n\t\tstream.off(\"end\", onEnd);\n\t\tstream.off(\"error\", onError);\n\t};\n}\n"]}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC Client for programmatic access to the coding agent.
|
|
3
|
+
*
|
|
4
|
+
* Spawns the agent in RPC mode and provides a typed API for all operations.
|
|
5
|
+
* This is a standalone SDK client — all types are inlined with zero internal
|
|
6
|
+
* package dependencies.
|
|
7
|
+
*/
|
|
8
|
+
import type { BashResult, CompactionResult, ImageContent, ModelInfo, RpcInitResult, RpcSessionState, RpcSlashCommand, ThinkingLevel, SessionStats } from "./rpc-types.js";
|
|
9
|
+
/** Agent event — a loosely-typed record from the server. The `type` field is always present. */
|
|
10
|
+
export interface SdkAgentEvent {
|
|
11
|
+
type: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface RpcClientOptions {
|
|
15
|
+
/** Path to the CLI entry point (default: searches for dist/cli.js) */
|
|
16
|
+
cliPath?: string;
|
|
17
|
+
/** Working directory for the agent */
|
|
18
|
+
cwd?: string;
|
|
19
|
+
/** Environment variables */
|
|
20
|
+
env?: Record<string, string>;
|
|
21
|
+
/** Provider to use */
|
|
22
|
+
provider?: string;
|
|
23
|
+
/** Model ID to use */
|
|
24
|
+
model?: string;
|
|
25
|
+
/** Additional CLI arguments */
|
|
26
|
+
args?: string[];
|
|
27
|
+
}
|
|
28
|
+
export type RpcEventListener = (event: SdkAgentEvent) => void;
|
|
29
|
+
export declare class RpcClient {
|
|
30
|
+
private options;
|
|
31
|
+
private process;
|
|
32
|
+
private stopReadingStdout;
|
|
33
|
+
private _stderrHandler?;
|
|
34
|
+
private eventListeners;
|
|
35
|
+
private pendingRequests;
|
|
36
|
+
private requestId;
|
|
37
|
+
private stderr;
|
|
38
|
+
private _stopped;
|
|
39
|
+
constructor(options?: RpcClientOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Start the RPC agent process.
|
|
42
|
+
*/
|
|
43
|
+
start(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Stop the RPC agent process.
|
|
46
|
+
*/
|
|
47
|
+
stop(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Subscribe to agent events via callback.
|
|
50
|
+
*/
|
|
51
|
+
onEvent(listener: RpcEventListener): () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Async generator that yields agent events as they arrive.
|
|
54
|
+
*
|
|
55
|
+
* Usage:
|
|
56
|
+
* ```ts
|
|
57
|
+
* for await (const event of client.events()) {
|
|
58
|
+
* console.log(event.type, event);
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* The generator terminates when:
|
|
63
|
+
* - `stop()` is called
|
|
64
|
+
* - The agent process exits
|
|
65
|
+
* - The consumer breaks out of the loop
|
|
66
|
+
*/
|
|
67
|
+
events(): AsyncGenerator<SdkAgentEvent, void, undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* Get collected stderr output (useful for debugging).
|
|
70
|
+
*/
|
|
71
|
+
getStderr(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Send a prompt to the agent.
|
|
74
|
+
* Returns immediately after sending; use onEvent() or events() to receive streaming events.
|
|
75
|
+
* Use waitForIdle() to wait for completion.
|
|
76
|
+
*/
|
|
77
|
+
prompt(message: string, images?: ImageContent[]): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Queue a steering message to interrupt the agent mid-run.
|
|
80
|
+
*/
|
|
81
|
+
steer(message: string, images?: ImageContent[]): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Queue a follow-up message to be processed after the agent finishes.
|
|
84
|
+
*/
|
|
85
|
+
followUp(message: string, images?: ImageContent[]): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Abort current operation.
|
|
88
|
+
*/
|
|
89
|
+
abort(): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Start a new session, optionally with parent tracking.
|
|
92
|
+
* @param parentSession - Optional parent session path for lineage tracking
|
|
93
|
+
* @returns Object with `cancelled: true` if an extension cancelled the new session
|
|
94
|
+
*/
|
|
95
|
+
newSession(parentSession?: string): Promise<{
|
|
96
|
+
cancelled: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Get current session state.
|
|
100
|
+
*/
|
|
101
|
+
getState(): Promise<RpcSessionState>;
|
|
102
|
+
/**
|
|
103
|
+
* Set model by provider and ID.
|
|
104
|
+
*/
|
|
105
|
+
setModel(provider: string, modelId: string): Promise<{
|
|
106
|
+
provider: string;
|
|
107
|
+
id: string;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Cycle to next model.
|
|
111
|
+
*/
|
|
112
|
+
cycleModel(): Promise<{
|
|
113
|
+
model: {
|
|
114
|
+
provider: string;
|
|
115
|
+
id: string;
|
|
116
|
+
};
|
|
117
|
+
thinkingLevel: ThinkingLevel;
|
|
118
|
+
isScoped: boolean;
|
|
119
|
+
} | null>;
|
|
120
|
+
/**
|
|
121
|
+
* Get list of available models.
|
|
122
|
+
*/
|
|
123
|
+
getAvailableModels(): Promise<ModelInfo[]>;
|
|
124
|
+
/**
|
|
125
|
+
* Set thinking level.
|
|
126
|
+
*/
|
|
127
|
+
setThinkingLevel(level: ThinkingLevel): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Cycle thinking level.
|
|
130
|
+
*/
|
|
131
|
+
cycleThinkingLevel(): Promise<{
|
|
132
|
+
level: ThinkingLevel;
|
|
133
|
+
} | null>;
|
|
134
|
+
/**
|
|
135
|
+
* Set steering mode.
|
|
136
|
+
*/
|
|
137
|
+
setSteeringMode(mode: "all" | "one-at-a-time"): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Set follow-up mode.
|
|
140
|
+
*/
|
|
141
|
+
setFollowUpMode(mode: "all" | "one-at-a-time"): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Compact session context.
|
|
144
|
+
*/
|
|
145
|
+
compact(customInstructions?: string): Promise<CompactionResult>;
|
|
146
|
+
/**
|
|
147
|
+
* Set auto-compaction enabled/disabled.
|
|
148
|
+
*/
|
|
149
|
+
setAutoCompaction(enabled: boolean): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Set auto-retry enabled/disabled.
|
|
152
|
+
*/
|
|
153
|
+
setAutoRetry(enabled: boolean): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Abort in-progress retry.
|
|
156
|
+
*/
|
|
157
|
+
abortRetry(): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Execute a bash command.
|
|
160
|
+
*/
|
|
161
|
+
bash(command: string): Promise<BashResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Abort running bash command.
|
|
164
|
+
*/
|
|
165
|
+
abortBash(): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Get session statistics.
|
|
168
|
+
*/
|
|
169
|
+
getSessionStats(): Promise<SessionStats>;
|
|
170
|
+
/**
|
|
171
|
+
* Export session to HTML.
|
|
172
|
+
*/
|
|
173
|
+
exportHtml(outputPath?: string): Promise<{
|
|
174
|
+
path: string;
|
|
175
|
+
}>;
|
|
176
|
+
/**
|
|
177
|
+
* Switch to a different session file.
|
|
178
|
+
* @returns Object with `cancelled: true` if an extension cancelled the switch
|
|
179
|
+
*/
|
|
180
|
+
switchSession(sessionPath: string): Promise<{
|
|
181
|
+
cancelled: boolean;
|
|
182
|
+
}>;
|
|
183
|
+
/**
|
|
184
|
+
* Fork from a specific message.
|
|
185
|
+
* @returns Object with `text` (the message text) and `cancelled` (if extension cancelled)
|
|
186
|
+
*/
|
|
187
|
+
fork(entryId: string): Promise<{
|
|
188
|
+
text: string;
|
|
189
|
+
cancelled: boolean;
|
|
190
|
+
}>;
|
|
191
|
+
/**
|
|
192
|
+
* Get messages available for forking.
|
|
193
|
+
*/
|
|
194
|
+
getForkMessages(): Promise<Array<{
|
|
195
|
+
entryId: string;
|
|
196
|
+
text: string;
|
|
197
|
+
}>>;
|
|
198
|
+
/**
|
|
199
|
+
* Get text of last assistant message.
|
|
200
|
+
*/
|
|
201
|
+
getLastAssistantText(): Promise<string | null>;
|
|
202
|
+
/**
|
|
203
|
+
* Set the session display name.
|
|
204
|
+
*/
|
|
205
|
+
setSessionName(name: string): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Get all messages in the session.
|
|
208
|
+
* Messages are returned as opaque objects — the internal structure may vary.
|
|
209
|
+
*/
|
|
210
|
+
getMessages(): Promise<unknown[]>;
|
|
211
|
+
/**
|
|
212
|
+
* Get available commands (extension commands, prompt templates, skills).
|
|
213
|
+
*/
|
|
214
|
+
getCommands(): Promise<RpcSlashCommand[]>;
|
|
215
|
+
/**
|
|
216
|
+
* Send a UI response to a pending extension_ui_request.
|
|
217
|
+
* Fire-and-forget — no request/response correlation.
|
|
218
|
+
*/
|
|
219
|
+
sendUIResponse(id: string, response: {
|
|
220
|
+
value?: string;
|
|
221
|
+
values?: string[];
|
|
222
|
+
confirmed?: boolean;
|
|
223
|
+
cancelled?: boolean;
|
|
224
|
+
}): void;
|
|
225
|
+
/**
|
|
226
|
+
* Initialize a v2 protocol session. Must be sent as the first command.
|
|
227
|
+
* Returns the negotiated protocol version, session ID, and server capabilities.
|
|
228
|
+
*/
|
|
229
|
+
init(options?: {
|
|
230
|
+
clientId?: string;
|
|
231
|
+
}): Promise<RpcInitResult>;
|
|
232
|
+
/**
|
|
233
|
+
* Request a graceful shutdown of the agent process.
|
|
234
|
+
* Waits for the response before the process exits.
|
|
235
|
+
*/
|
|
236
|
+
shutdown(): Promise<void>;
|
|
237
|
+
/**
|
|
238
|
+
* Subscribe to specific event types (v2 only).
|
|
239
|
+
* Pass ["*"] to receive all events, or a list of event type strings to filter.
|
|
240
|
+
*/
|
|
241
|
+
subscribe(events: string[]): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Wait for agent to become idle (no streaming).
|
|
244
|
+
* Resolves when agent_end event is received.
|
|
245
|
+
*/
|
|
246
|
+
waitForIdle(timeout?: number): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Collect events until agent becomes idle.
|
|
249
|
+
*/
|
|
250
|
+
collectEvents(timeout?: number): Promise<SdkAgentEvent[]>;
|
|
251
|
+
/**
|
|
252
|
+
* Send prompt and wait for completion, returning all events.
|
|
253
|
+
*/
|
|
254
|
+
promptAndWait(message: string, images?: ImageContent[], timeout?: number): Promise<SdkAgentEvent[]>;
|
|
255
|
+
private handleLine;
|
|
256
|
+
private send;
|
|
257
|
+
private getData;
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=rpc-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../src/rpc-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,SAAS,EAET,aAAa,EAEb,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,MAAM,gBAAgB,CAAC;AAYxB,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAChC,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAM9D,qBAAa,SAAS;IAWT,OAAO,CAAC,OAAO;IAV3B,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,cAAc,CAAC,CAAyB;IAChD,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,eAAe,CACZ;IACX,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,QAAQ,CAAS;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