gsd-pi 2.53.0 → 2.54.0-dev.e1efc1a
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/headless-ui.d.ts +2 -2
- package/dist/headless-ui.js +18 -15
- package/dist/headless.d.ts +11 -0
- package/dist/headless.js +178 -38
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +19 -19
- 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/required-server-files.json +4 -4
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
- 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/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +19 -19
- package/dist/web/standalone/.next/server/chunks/2229.js +1 -1
- package/dist/web/standalone/.next/server/chunks/7471.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +2 -2
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-b950e4e384cc62b3.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/package.json +1 -1
- package/packages/mcp-server/README.md +6 -6
- package/packages/mcp-server/package.json +14 -4
- package/packages/mcp-server/src/cli.ts +1 -1
- package/packages/mcp-server/src/index.ts +1 -1
- package/packages/mcp-server/src/mcp-server.test.ts +2 -2
- package/packages/mcp-server/src/session-manager.ts +2 -2
- package/packages/mcp-server/src/types.ts +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/rpc-client/README.md +125 -0
- package/packages/rpc-client/examples/basic-usage.ts +13 -0
- package/packages/rpc-client/package.json +17 -3
- package/packages/rpc-client/src/index.ts +10 -0
- package/packages/rpc-client/src/jsonl.ts +64 -0
- package/packages/rpc-client/src/rpc-client.test.ts +568 -0
- package/packages/rpc-client/src/rpc-client.ts +666 -0
- package/packages/rpc-client/src/rpc-types.ts +399 -0
- package/packages/rpc-client/tsconfig.examples.json +17 -0
- package/packages/rpc-client/tsconfig.json +24 -0
- package/pkg/package.json +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-fbecd1237e2d6d1f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- /package/dist/web/standalone/.next/static/{mWBOLPnUoeaTGiD-vhu5O → nISuDzAIpGYC-DVTvs4Po}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{mWBOLPnUoeaTGiD-vhu5O → nISuDzAIpGYC-DVTvs4Po}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC protocol types for headless operation.
|
|
3
|
+
*
|
|
4
|
+
* Commands are sent as JSON lines on stdin.
|
|
5
|
+
* Responses and events are emitted as JSON lines on stdout.
|
|
6
|
+
*
|
|
7
|
+
* This file is self-contained — all types that were previously imported from
|
|
8
|
+
* internal packages are inlined so that this package has zero internal
|
|
9
|
+
* dependencies.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Inlined types (originally from internal packages)
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
/** Thinking budget level (inlined from agent-core) */
|
|
17
|
+
export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
18
|
+
|
|
19
|
+
/** Image attachment (inlined from pi-ai) */
|
|
20
|
+
export interface ImageContent {
|
|
21
|
+
type: "image";
|
|
22
|
+
data: string; // base64 encoded image data
|
|
23
|
+
mimeType: string; // e.g., "image/jpeg", "image/png"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Model descriptor — opaque for SDK consumers */
|
|
27
|
+
export interface ModelInfo {
|
|
28
|
+
provider: string;
|
|
29
|
+
id: string;
|
|
30
|
+
contextWindow?: number;
|
|
31
|
+
reasoning?: boolean;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Session statistics (from agent-session.ts) */
|
|
36
|
+
export interface SessionStats {
|
|
37
|
+
sessionFile: string | undefined;
|
|
38
|
+
sessionId: string;
|
|
39
|
+
userMessages: number;
|
|
40
|
+
assistantMessages: number;
|
|
41
|
+
toolCalls: number;
|
|
42
|
+
toolResults: number;
|
|
43
|
+
totalMessages: number;
|
|
44
|
+
tokens: {
|
|
45
|
+
input: number;
|
|
46
|
+
output: number;
|
|
47
|
+
cacheRead: number;
|
|
48
|
+
cacheWrite: number;
|
|
49
|
+
total: number;
|
|
50
|
+
};
|
|
51
|
+
cost: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Bash command result (from bash-executor.ts) */
|
|
55
|
+
export interface BashResult {
|
|
56
|
+
/** Combined stdout + stderr output (sanitized, possibly truncated) */
|
|
57
|
+
output: string;
|
|
58
|
+
/** Process exit code (undefined if killed/cancelled) */
|
|
59
|
+
exitCode: number | undefined;
|
|
60
|
+
/** Whether the command was cancelled via signal */
|
|
61
|
+
cancelled: boolean;
|
|
62
|
+
/** Whether the output was truncated */
|
|
63
|
+
truncated: boolean;
|
|
64
|
+
/** Path to temp file containing full output (if output exceeded truncation threshold) */
|
|
65
|
+
fullOutputPath?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Compaction result (from compaction.ts) */
|
|
69
|
+
export interface CompactionResult<T = unknown> {
|
|
70
|
+
summary: string;
|
|
71
|
+
firstKeptEntryId: string;
|
|
72
|
+
tokensBefore: number;
|
|
73
|
+
/** Extension-specific data (e.g., ArtifactIndex, version markers for structured compaction) */
|
|
74
|
+
details?: T;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// RPC Protocol Versioning
|
|
79
|
+
// ============================================================================
|
|
80
|
+
|
|
81
|
+
/** Supported protocol versions. v1 is the implicit default; v2 requires an init handshake. */
|
|
82
|
+
export type RpcProtocolVersion = 1 | 2;
|
|
83
|
+
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// RPC Commands (stdin)
|
|
86
|
+
// ============================================================================
|
|
87
|
+
|
|
88
|
+
export type RpcCommand =
|
|
89
|
+
// Prompting
|
|
90
|
+
| { id?: string; type: "prompt"; message: string; images?: ImageContent[]; streamingBehavior?: "steer" | "followUp" }
|
|
91
|
+
| { id?: string; type: "steer"; message: string; images?: ImageContent[] }
|
|
92
|
+
| { id?: string; type: "follow_up"; message: string; images?: ImageContent[] }
|
|
93
|
+
| { id?: string; type: "abort" }
|
|
94
|
+
| { id?: string; type: "new_session"; parentSession?: string }
|
|
95
|
+
|
|
96
|
+
// State
|
|
97
|
+
| { id?: string; type: "get_state" }
|
|
98
|
+
|
|
99
|
+
// Model
|
|
100
|
+
| { id?: string; type: "set_model"; provider: string; modelId: string }
|
|
101
|
+
| { id?: string; type: "cycle_model" }
|
|
102
|
+
| { id?: string; type: "get_available_models" }
|
|
103
|
+
|
|
104
|
+
// Thinking
|
|
105
|
+
| { id?: string; type: "set_thinking_level"; level: ThinkingLevel }
|
|
106
|
+
| { id?: string; type: "cycle_thinking_level" }
|
|
107
|
+
|
|
108
|
+
// Queue modes
|
|
109
|
+
| { id?: string; type: "set_steering_mode"; mode: "all" | "one-at-a-time" }
|
|
110
|
+
| { id?: string; type: "set_follow_up_mode"; mode: "all" | "one-at-a-time" }
|
|
111
|
+
|
|
112
|
+
// Compaction
|
|
113
|
+
| { id?: string; type: "compact"; customInstructions?: string }
|
|
114
|
+
| { id?: string; type: "set_auto_compaction"; enabled: boolean }
|
|
115
|
+
|
|
116
|
+
// Retry
|
|
117
|
+
| { id?: string; type: "set_auto_retry"; enabled: boolean }
|
|
118
|
+
| { id?: string; type: "abort_retry" }
|
|
119
|
+
|
|
120
|
+
// Bash
|
|
121
|
+
| { id?: string; type: "bash"; command: string }
|
|
122
|
+
| { id?: string; type: "abort_bash" }
|
|
123
|
+
|
|
124
|
+
// Session
|
|
125
|
+
| { id?: string; type: "get_session_stats" }
|
|
126
|
+
| { id?: string; type: "export_html"; outputPath?: string }
|
|
127
|
+
| { id?: string; type: "switch_session"; sessionPath: string }
|
|
128
|
+
| { id?: string; type: "fork"; entryId: string }
|
|
129
|
+
| { id?: string; type: "get_fork_messages" }
|
|
130
|
+
| { id?: string; type: "get_last_assistant_text" }
|
|
131
|
+
| { id?: string; type: "set_session_name"; name: string }
|
|
132
|
+
|
|
133
|
+
// Messages
|
|
134
|
+
| { id?: string; type: "get_messages" }
|
|
135
|
+
|
|
136
|
+
// Commands (available for invocation via prompt)
|
|
137
|
+
| { id?: string; type: "get_commands" }
|
|
138
|
+
|
|
139
|
+
// Bridge-hosted native terminal
|
|
140
|
+
| { id?: string; type: "terminal_input"; data: string }
|
|
141
|
+
| { id?: string; type: "terminal_resize"; cols: number; rows: number }
|
|
142
|
+
| { id?: string; type: "terminal_redraw" }
|
|
143
|
+
|
|
144
|
+
// v2 Protocol
|
|
145
|
+
| { id?: string; type: "init"; protocolVersion: 2; clientId?: string }
|
|
146
|
+
| { id?: string; type: "shutdown"; graceful?: boolean }
|
|
147
|
+
| { id?: string; type: "subscribe"; events: string[] };
|
|
148
|
+
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// RPC Slash Command (for get_commands response)
|
|
151
|
+
// ============================================================================
|
|
152
|
+
|
|
153
|
+
/** A command available for invocation via prompt */
|
|
154
|
+
export interface RpcSlashCommand {
|
|
155
|
+
/** Command name (without leading slash) */
|
|
156
|
+
name: string;
|
|
157
|
+
/** Human-readable description */
|
|
158
|
+
description?: string;
|
|
159
|
+
/** What kind of command this is */
|
|
160
|
+
source: "extension" | "prompt" | "skill";
|
|
161
|
+
/** Where the command was loaded from (undefined for extensions) */
|
|
162
|
+
location?: "user" | "project" | "path";
|
|
163
|
+
/** File path to the command source */
|
|
164
|
+
path?: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ============================================================================
|
|
168
|
+
// RPC State
|
|
169
|
+
// ============================================================================
|
|
170
|
+
|
|
171
|
+
export interface RpcSessionState {
|
|
172
|
+
model?: ModelInfo;
|
|
173
|
+
thinkingLevel: ThinkingLevel;
|
|
174
|
+
isStreaming: boolean;
|
|
175
|
+
isCompacting: boolean;
|
|
176
|
+
steeringMode: "all" | "one-at-a-time";
|
|
177
|
+
followUpMode: "all" | "one-at-a-time";
|
|
178
|
+
sessionFile?: string;
|
|
179
|
+
sessionId: string;
|
|
180
|
+
sessionName?: string;
|
|
181
|
+
autoCompactionEnabled: boolean;
|
|
182
|
+
autoRetryEnabled: boolean;
|
|
183
|
+
retryInProgress: boolean;
|
|
184
|
+
retryAttempt: number;
|
|
185
|
+
messageCount: number;
|
|
186
|
+
pendingMessageCount: number;
|
|
187
|
+
/** Whether extension loading has completed. Commands from `get_commands` may be incomplete until true. */
|
|
188
|
+
extensionsReady: boolean;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// ============================================================================
|
|
192
|
+
// RPC Responses (stdout)
|
|
193
|
+
// ============================================================================
|
|
194
|
+
|
|
195
|
+
// Success responses with data
|
|
196
|
+
export type RpcResponse =
|
|
197
|
+
// Prompting (async - events follow)
|
|
198
|
+
| { id?: string; type: "response"; command: "prompt"; success: true; runId?: string }
|
|
199
|
+
| { id?: string; type: "response"; command: "steer"; success: true; runId?: string }
|
|
200
|
+
| { id?: string; type: "response"; command: "follow_up"; success: true; runId?: string }
|
|
201
|
+
| { id?: string; type: "response"; command: "abort"; success: true }
|
|
202
|
+
| { id?: string; type: "response"; command: "new_session"; success: true; data: { cancelled: boolean } }
|
|
203
|
+
|
|
204
|
+
// State
|
|
205
|
+
| { id?: string; type: "response"; command: "get_state"; success: true; data: RpcSessionState }
|
|
206
|
+
|
|
207
|
+
// Model
|
|
208
|
+
| {
|
|
209
|
+
id?: string;
|
|
210
|
+
type: "response";
|
|
211
|
+
command: "set_model";
|
|
212
|
+
success: true;
|
|
213
|
+
data: ModelInfo;
|
|
214
|
+
}
|
|
215
|
+
| {
|
|
216
|
+
id?: string;
|
|
217
|
+
type: "response";
|
|
218
|
+
command: "cycle_model";
|
|
219
|
+
success: true;
|
|
220
|
+
data: { model: ModelInfo; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;
|
|
221
|
+
}
|
|
222
|
+
| {
|
|
223
|
+
id?: string;
|
|
224
|
+
type: "response";
|
|
225
|
+
command: "get_available_models";
|
|
226
|
+
success: true;
|
|
227
|
+
data: { models: ModelInfo[] };
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Thinking
|
|
231
|
+
| { id?: string; type: "response"; command: "set_thinking_level"; success: true }
|
|
232
|
+
| {
|
|
233
|
+
id?: string;
|
|
234
|
+
type: "response";
|
|
235
|
+
command: "cycle_thinking_level";
|
|
236
|
+
success: true;
|
|
237
|
+
data: { level: ThinkingLevel } | null;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Queue modes
|
|
241
|
+
| { id?: string; type: "response"; command: "set_steering_mode"; success: true }
|
|
242
|
+
| { id?: string; type: "response"; command: "set_follow_up_mode"; success: true }
|
|
243
|
+
|
|
244
|
+
// Compaction
|
|
245
|
+
| { id?: string; type: "response"; command: "compact"; success: true; data: CompactionResult }
|
|
246
|
+
| { id?: string; type: "response"; command: "set_auto_compaction"; success: true }
|
|
247
|
+
|
|
248
|
+
// Retry
|
|
249
|
+
| { id?: string; type: "response"; command: "set_auto_retry"; success: true }
|
|
250
|
+
| { id?: string; type: "response"; command: "abort_retry"; success: true }
|
|
251
|
+
|
|
252
|
+
// Bash
|
|
253
|
+
| { id?: string; type: "response"; command: "bash"; success: true; data: BashResult }
|
|
254
|
+
| { id?: string; type: "response"; command: "abort_bash"; success: true }
|
|
255
|
+
|
|
256
|
+
// Session
|
|
257
|
+
| { id?: string; type: "response"; command: "get_session_stats"; success: true; data: SessionStats }
|
|
258
|
+
| { id?: string; type: "response"; command: "export_html"; success: true; data: { path: string } }
|
|
259
|
+
| { id?: string; type: "response"; command: "switch_session"; success: true; data: { cancelled: boolean } }
|
|
260
|
+
| { id?: string; type: "response"; command: "fork"; success: true; data: { text: string; cancelled: boolean } }
|
|
261
|
+
| {
|
|
262
|
+
id?: string;
|
|
263
|
+
type: "response";
|
|
264
|
+
command: "get_fork_messages";
|
|
265
|
+
success: true;
|
|
266
|
+
data: { messages: Array<{ entryId: string; text: string }> };
|
|
267
|
+
}
|
|
268
|
+
| {
|
|
269
|
+
id?: string;
|
|
270
|
+
type: "response";
|
|
271
|
+
command: "get_last_assistant_text";
|
|
272
|
+
success: true;
|
|
273
|
+
data: { text: string | null };
|
|
274
|
+
}
|
|
275
|
+
| { id?: string; type: "response"; command: "set_session_name"; success: true }
|
|
276
|
+
|
|
277
|
+
// Messages — AgentMessage is opaque for SDK consumers
|
|
278
|
+
| { id?: string; type: "response"; command: "get_messages"; success: true; data: { messages: unknown[] } }
|
|
279
|
+
|
|
280
|
+
// Commands
|
|
281
|
+
| {
|
|
282
|
+
id?: string;
|
|
283
|
+
type: "response";
|
|
284
|
+
command: "get_commands";
|
|
285
|
+
success: true;
|
|
286
|
+
data: { commands: RpcSlashCommand[] };
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Bridge-hosted native terminal
|
|
290
|
+
| { id?: string; type: "response"; command: "terminal_input"; success: true }
|
|
291
|
+
| { id?: string; type: "response"; command: "terminal_resize"; success: true }
|
|
292
|
+
| { id?: string; type: "response"; command: "terminal_redraw"; success: true }
|
|
293
|
+
|
|
294
|
+
// v2 Protocol
|
|
295
|
+
| { id?: string; type: "response"; command: "init"; success: true; data: RpcInitResult }
|
|
296
|
+
| { id?: string; type: "response"; command: "shutdown"; success: true }
|
|
297
|
+
| { id?: string; type: "response"; command: "subscribe"; success: true }
|
|
298
|
+
|
|
299
|
+
// Error response (any command can fail)
|
|
300
|
+
| { id?: string; type: "response"; command: string; success: false; error: string };
|
|
301
|
+
|
|
302
|
+
// ============================================================================
|
|
303
|
+
// v2 Protocol Types
|
|
304
|
+
// ============================================================================
|
|
305
|
+
|
|
306
|
+
/** Result of the init handshake (v2 only) */
|
|
307
|
+
export interface RpcInitResult {
|
|
308
|
+
protocolVersion: 2;
|
|
309
|
+
sessionId: string;
|
|
310
|
+
capabilities: {
|
|
311
|
+
events: string[];
|
|
312
|
+
commands: string[];
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** v2 execution_complete event — emitted when a prompt/steer/follow_up finishes */
|
|
317
|
+
export interface RpcExecutionCompleteEvent {
|
|
318
|
+
type: "execution_complete";
|
|
319
|
+
runId: string;
|
|
320
|
+
status: "completed" | "error" | "cancelled";
|
|
321
|
+
reason?: string;
|
|
322
|
+
stats: SessionStats;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** v2 cost_update event — emitted per-turn with running cost data */
|
|
326
|
+
export interface RpcCostUpdateEvent {
|
|
327
|
+
type: "cost_update";
|
|
328
|
+
runId: string;
|
|
329
|
+
turnCost: number;
|
|
330
|
+
cumulativeCost: number;
|
|
331
|
+
tokens: {
|
|
332
|
+
input: number;
|
|
333
|
+
output: number;
|
|
334
|
+
cacheRead: number;
|
|
335
|
+
cacheWrite: number;
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** Discriminated union of all v2-only event types */
|
|
340
|
+
export type RpcV2Event = RpcExecutionCompleteEvent | RpcCostUpdateEvent;
|
|
341
|
+
|
|
342
|
+
// ============================================================================
|
|
343
|
+
// Extension UI Events (stdout)
|
|
344
|
+
// ============================================================================
|
|
345
|
+
|
|
346
|
+
/** Emitted when an extension needs user input */
|
|
347
|
+
export type RpcExtensionUIRequest =
|
|
348
|
+
| { type: "extension_ui_request"; id: string; method: "select"; title: string; options: string[]; timeout?: number; allowMultiple?: boolean }
|
|
349
|
+
| { type: "extension_ui_request"; id: string; method: "confirm"; title: string; message: string; timeout?: number }
|
|
350
|
+
| {
|
|
351
|
+
type: "extension_ui_request";
|
|
352
|
+
id: string;
|
|
353
|
+
method: "input";
|
|
354
|
+
title: string;
|
|
355
|
+
placeholder?: string;
|
|
356
|
+
timeout?: number;
|
|
357
|
+
}
|
|
358
|
+
| { type: "extension_ui_request"; id: string; method: "editor"; title: string; prefill?: string }
|
|
359
|
+
| {
|
|
360
|
+
type: "extension_ui_request";
|
|
361
|
+
id: string;
|
|
362
|
+
method: "notify";
|
|
363
|
+
message: string;
|
|
364
|
+
notifyType?: "info" | "warning" | "error";
|
|
365
|
+
}
|
|
366
|
+
| {
|
|
367
|
+
type: "extension_ui_request";
|
|
368
|
+
id: string;
|
|
369
|
+
method: "setStatus";
|
|
370
|
+
statusKey: string;
|
|
371
|
+
statusText: string | undefined;
|
|
372
|
+
}
|
|
373
|
+
| {
|
|
374
|
+
type: "extension_ui_request";
|
|
375
|
+
id: string;
|
|
376
|
+
method: "setWidget";
|
|
377
|
+
widgetKey: string;
|
|
378
|
+
widgetLines: string[] | undefined;
|
|
379
|
+
widgetPlacement?: "aboveEditor" | "belowEditor";
|
|
380
|
+
}
|
|
381
|
+
| { type: "extension_ui_request"; id: string; method: "setTitle"; title: string }
|
|
382
|
+
| { type: "extension_ui_request"; id: string; method: "set_editor_text"; text: string };
|
|
383
|
+
|
|
384
|
+
// ============================================================================
|
|
385
|
+
// Extension UI Commands (stdin)
|
|
386
|
+
// ============================================================================
|
|
387
|
+
|
|
388
|
+
/** Response to an extension UI request */
|
|
389
|
+
export type RpcExtensionUIResponse =
|
|
390
|
+
| { type: "extension_ui_response"; id: string; value: string }
|
|
391
|
+
| { type: "extension_ui_response"; id: string; values: string[] }
|
|
392
|
+
| { type: "extension_ui_response"; id: string; confirmed: boolean }
|
|
393
|
+
| { type: "extension_ui_response"; id: string; cancelled: true };
|
|
394
|
+
|
|
395
|
+
// ============================================================================
|
|
396
|
+
// Helper type for extracting command types
|
|
397
|
+
// ============================================================================
|
|
398
|
+
|
|
399
|
+
export type RpcCommandType = RpcCommand["type"];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2024",
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"lib": ["ES2024"],
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"moduleResolution": "Node16",
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"types": ["node"],
|
|
12
|
+
"paths": {
|
|
13
|
+
"@gsd-build/rpc-client": ["./src/index.ts"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"include": ["examples/**/*.ts"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2024",
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"lib": ["ES2024"],
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"declarationMap": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"inlineSources": true,
|
|
14
|
+
"inlineSourceMap": false,
|
|
15
|
+
"moduleResolution": "Node16",
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"allowImportingTsExtensions": false,
|
|
18
|
+
"types": ["node"],
|
|
19
|
+
"outDir": "./dist",
|
|
20
|
+
"rootDir": "./src"
|
|
21
|
+
},
|
|
22
|
+
"include": ["src/**/*.ts"],
|
|
23
|
+
"exclude": ["node_modules", "dist", "**/*.d.ts", "src/**/*.d.ts"]
|
|
24
|
+
}
|
package/pkg/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{5214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},15726:(e,t,n)=>{Promise.resolve().then(n.bind(n,66919))},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},21957:(e,t,n)=>{"use strict";function r({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(5214),n(2451),n(53887)},37206:(e,t,n)=>{"use strict";n.d(t,{default:()=>u.a});var r=n(75707),u=n.n(r)},41112:(e,t,n)=>{"use strict";function r({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(1980)},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={bindSnapshot:function(){return s},createAsyncLocalStorage:function(){return a},createSnapshot:function(){return i}};for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:n[r]});let u=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class l{disable(){throw u}getStore(){}run(){throw u}exit(){throw u}enterWith(){throw u}static bind(e){return e}}let o="u">typeof globalThis&&globalThis.AsyncLocalStorage;function a(){return o?new o:new l}function s(e){return o?o.bind(e):l.bind(e)}function i(){return o?o.snapshot():function(e,...t){return e(...t)}}},66919:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>l});var r=n(95155);let u=(0,n(37206).default)(()=>Promise.all([n.e(1838),n.e(6079),n.e(4986),n.e(2008),n.e(4024)]).then(n.bind(n,4024)).then(e=>e.GSDAppShell),{loadableGenerated:{webpack:()=>[4024]},ssr:!1,loading:()=>(0,r.jsx)("div",{className:"flex h-screen items-center justify-center bg-background text-sm text-muted-foreground",children:"Loading workspace…"})});function l(){return(0,r.jsx)(u,{})}},68635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(95155),u=n(12115),l=n(41112);function o(e){return{default:e&&"default"in e?e.default:e}}n(21957);let a={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},s=function(e){let t={...a,...e},n=(0,u.lazy)(()=>t.loader().then(o)),s=t.loading;function i(e){let o=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,a=!t.ssr||!!t.loading,i=a?u.Suspense:u.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(i,{...a?{fallback:o}:{},children:c})}return i.displayName="LoadableComponent",i}},75707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(73623)._(n(68635));function u(e,t){let n={};"function"==typeof e&&(n.loader=e);let u={...n,...t};return(0,r.default)({...u,modules:u.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},e=>{e.O(0,[8441,3794,7358],()=>e(e.s=15726)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7358],{2852:(e,s,n)=>{Promise.resolve().then(n.t.bind(n,27123,23)),Promise.resolve().then(n.t.bind(n,61304,23)),Promise.resolve().then(n.t.bind(n,78616,23)),Promise.resolve().then(n.t.bind(n,64777,23)),Promise.resolve().then(n.t.bind(n,57121,23)),Promise.resolve().then(n.t.bind(n,74581,23)),Promise.resolve().then(n.t.bind(n,90484,23)),Promise.resolve().then(n.bind(n,86869))},19393:()=>{}},e=>{var s=s=>e(e.s=s);e.O(0,[8441,3794],()=>(s(83861),s(2852))),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9337],{52560:(e,s,_)=>{Promise.resolve().then(_.t.bind(_,27123,23))}},e=>{e.O(0,[8441,3794,7358],()=>e(e.s=52560)),_N_E=e.O()}]);
|
|
File without changes
|
|
File without changes
|