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.
Files changed (191) hide show
  1. package/README.md +41 -31
  2. package/dist/resources/extensions/claude-code-cli/stream-adapter.js +121 -8
  3. package/dist/resources/extensions/gsd/auto/phases.js +17 -0
  4. package/dist/resources/extensions/gsd/auto/session.js +6 -0
  5. package/dist/resources/extensions/gsd/auto-direct-dispatch.js +12 -0
  6. package/dist/resources/extensions/gsd/auto-start.js +12 -0
  7. package/dist/resources/extensions/gsd/auto.js +27 -0
  8. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +11 -435
  9. package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +1 -4
  10. package/dist/resources/extensions/gsd/bootstrap/query-tools.js +7 -64
  11. package/dist/resources/extensions/gsd/bootstrap/write-gate.js +88 -8
  12. package/dist/resources/extensions/gsd/commands/catalog.js +2 -1
  13. package/dist/resources/extensions/gsd/commands/handlers/core.js +39 -25
  14. package/dist/resources/extensions/gsd/commands/index.js +8 -1
  15. package/dist/resources/extensions/gsd/commands-mcp-status.js +43 -7
  16. package/dist/resources/extensions/gsd/guided-flow.js +16 -0
  17. package/dist/resources/extensions/gsd/init-wizard.js +37 -0
  18. package/dist/resources/extensions/gsd/mcp-project-config.js +83 -0
  19. package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +508 -0
  20. package/dist/resources/extensions/gsd/workflow-logger.js +18 -3
  21. package/dist/resources/extensions/gsd/workflow-mcp.js +261 -0
  22. package/dist/web/standalone/.next/BUILD_ID +1 -1
  23. package/dist/web/standalone/.next/app-path-routes-manifest.json +15 -15
  24. package/dist/web/standalone/.next/build-manifest.json +3 -3
  25. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  26. package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
  27. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  28. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  29. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  30. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  31. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  32. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  33. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  34. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  36. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  37. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  38. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/index.html +1 -1
  44. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  50. package/dist/web/standalone/.next/server/app-paths-manifest.json +15 -15
  51. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  52. package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  53. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  54. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  55. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  56. package/dist/web/standalone/.next/static/chunks/6502.5dcdcf1e1432e20d.js +9 -0
  57. package/dist/web/standalone/.next/static/chunks/{webpack-b49b09f97429b5d0.js → webpack-42a66876b763aa26.js} +1 -1
  58. package/package.json +4 -2
  59. package/packages/mcp-server/README.md +38 -0
  60. package/packages/mcp-server/dist/cli.d.ts +9 -0
  61. package/packages/mcp-server/dist/cli.d.ts.map +1 -0
  62. package/packages/mcp-server/dist/cli.js +58 -0
  63. package/packages/mcp-server/dist/cli.js.map +1 -0
  64. package/packages/mcp-server/dist/index.d.ts +20 -0
  65. package/packages/mcp-server/dist/index.d.ts.map +1 -0
  66. package/packages/mcp-server/dist/index.js +14 -0
  67. package/packages/mcp-server/dist/index.js.map +1 -0
  68. package/packages/mcp-server/dist/readers/captures.d.ts +25 -0
  69. package/packages/mcp-server/dist/readers/captures.d.ts.map +1 -0
  70. package/packages/mcp-server/dist/readers/captures.js +67 -0
  71. package/packages/mcp-server/dist/readers/captures.js.map +1 -0
  72. package/packages/mcp-server/dist/readers/doctor-lite.d.ts +20 -0
  73. package/packages/mcp-server/dist/readers/doctor-lite.d.ts.map +1 -0
  74. package/packages/mcp-server/dist/readers/doctor-lite.js +173 -0
  75. package/packages/mcp-server/dist/readers/doctor-lite.js.map +1 -0
  76. package/packages/mcp-server/dist/readers/index.d.ts +14 -0
  77. package/packages/mcp-server/dist/readers/index.d.ts.map +1 -0
  78. package/packages/mcp-server/dist/readers/index.js +10 -0
  79. package/packages/mcp-server/dist/readers/index.js.map +1 -0
  80. package/packages/mcp-server/dist/readers/knowledge.d.ts +18 -0
  81. package/packages/mcp-server/dist/readers/knowledge.d.ts.map +1 -0
  82. package/packages/mcp-server/dist/readers/knowledge.js +82 -0
  83. package/packages/mcp-server/dist/readers/knowledge.js.map +1 -0
  84. package/packages/mcp-server/dist/readers/metrics.d.ts +32 -0
  85. package/packages/mcp-server/dist/readers/metrics.d.ts.map +1 -0
  86. package/packages/mcp-server/dist/readers/metrics.js +74 -0
  87. package/packages/mcp-server/dist/readers/metrics.js.map +1 -0
  88. package/packages/mcp-server/dist/readers/paths.d.ts +42 -0
  89. package/packages/mcp-server/dist/readers/paths.d.ts.map +1 -0
  90. package/packages/mcp-server/dist/readers/paths.js +199 -0
  91. package/packages/mcp-server/dist/readers/paths.js.map +1 -0
  92. package/packages/mcp-server/dist/readers/roadmap.d.ts +26 -0
  93. package/packages/mcp-server/dist/readers/roadmap.d.ts.map +1 -0
  94. package/packages/mcp-server/dist/readers/roadmap.js +194 -0
  95. package/packages/mcp-server/dist/readers/roadmap.js.map +1 -0
  96. package/packages/mcp-server/dist/readers/state.d.ts +43 -0
  97. package/packages/mcp-server/dist/readers/state.d.ts.map +1 -0
  98. package/packages/mcp-server/dist/readers/state.js +184 -0
  99. package/packages/mcp-server/dist/readers/state.js.map +1 -0
  100. package/packages/mcp-server/dist/server.d.ts +28 -0
  101. package/packages/mcp-server/dist/server.d.ts.map +1 -0
  102. package/packages/mcp-server/dist/server.js +319 -0
  103. package/packages/mcp-server/dist/server.js.map +1 -0
  104. package/packages/mcp-server/dist/session-manager.d.ts +54 -0
  105. package/packages/mcp-server/dist/session-manager.d.ts.map +1 -0
  106. package/packages/mcp-server/dist/session-manager.js +284 -0
  107. package/packages/mcp-server/dist/session-manager.js.map +1 -0
  108. package/packages/mcp-server/dist/types.d.ts +61 -0
  109. package/packages/mcp-server/dist/types.d.ts.map +1 -0
  110. package/packages/mcp-server/dist/types.js +11 -0
  111. package/packages/mcp-server/dist/types.js.map +1 -0
  112. package/packages/mcp-server/dist/workflow-tools.d.ts +9 -0
  113. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -0
  114. package/packages/mcp-server/dist/workflow-tools.js +532 -0
  115. package/packages/mcp-server/dist/workflow-tools.js.map +1 -0
  116. package/packages/mcp-server/src/server.ts +6 -2
  117. package/packages/mcp-server/src/workflow-tools.test.ts +976 -0
  118. package/packages/mcp-server/src/workflow-tools.ts +997 -0
  119. package/packages/mcp-server/tsconfig.json +1 -1
  120. package/packages/pi-agent-core/dist/agent-loop.js +14 -6
  121. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  122. package/packages/pi-agent-core/src/agent-loop.test.ts +53 -0
  123. package/packages/pi-agent-core/src/agent-loop.ts +20 -6
  124. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.d.ts +2 -0
  125. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.d.ts.map +1 -0
  126. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +28 -0
  127. package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -0
  128. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -0
  129. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  130. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +17 -12
  131. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  132. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
  133. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +19 -0
  134. package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
  135. package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +54 -0
  136. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +18 -12
  137. package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +21 -0
  138. package/packages/rpc-client/dist/index.d.ts +10 -0
  139. package/packages/rpc-client/dist/index.d.ts.map +1 -0
  140. package/packages/rpc-client/dist/index.js +9 -0
  141. package/packages/rpc-client/dist/index.js.map +1 -0
  142. package/packages/rpc-client/dist/jsonl.d.ts +17 -0
  143. package/packages/rpc-client/dist/jsonl.d.ts.map +1 -0
  144. package/packages/rpc-client/dist/jsonl.js +54 -0
  145. package/packages/rpc-client/dist/jsonl.js.map +1 -0
  146. package/packages/rpc-client/dist/rpc-client.d.ts +259 -0
  147. package/packages/rpc-client/dist/rpc-client.d.ts.map +1 -0
  148. package/packages/rpc-client/dist/rpc-client.js +541 -0
  149. package/packages/rpc-client/dist/rpc-client.js.map +1 -0
  150. package/packages/rpc-client/dist/rpc-client.test.d.ts +2 -0
  151. package/packages/rpc-client/dist/rpc-client.test.d.ts.map +1 -0
  152. package/packages/rpc-client/dist/rpc-client.test.js +477 -0
  153. package/packages/rpc-client/dist/rpc-client.test.js.map +1 -0
  154. package/packages/rpc-client/dist/rpc-types.d.ts +566 -0
  155. package/packages/rpc-client/dist/rpc-types.d.ts.map +1 -0
  156. package/packages/rpc-client/dist/rpc-types.js +12 -0
  157. package/packages/rpc-client/dist/rpc-types.js.map +1 -0
  158. package/scripts/ensure-workspace-builds.cjs +2 -0
  159. package/scripts/link-workspace-packages.cjs +21 -14
  160. package/src/resources/extensions/claude-code-cli/stream-adapter.ts +157 -8
  161. package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +182 -0
  162. package/src/resources/extensions/gsd/auto/phases.ts +25 -0
  163. package/src/resources/extensions/gsd/auto/session.ts +6 -0
  164. package/src/resources/extensions/gsd/auto-direct-dispatch.ts +20 -0
  165. package/src/resources/extensions/gsd/auto-start.ts +15 -1
  166. package/src/resources/extensions/gsd/auto.ts +29 -1
  167. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +22 -435
  168. package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +1 -5
  169. package/src/resources/extensions/gsd/bootstrap/query-tools.ts +7 -72
  170. package/src/resources/extensions/gsd/bootstrap/write-gate.ts +122 -6
  171. package/src/resources/extensions/gsd/commands/catalog.ts +2 -1
  172. package/src/resources/extensions/gsd/commands/handlers/core.ts +53 -26
  173. package/src/resources/extensions/gsd/commands/index.ts +7 -1
  174. package/src/resources/extensions/gsd/commands-mcp-status.ts +53 -7
  175. package/src/resources/extensions/gsd/guided-flow.ts +24 -0
  176. package/src/resources/extensions/gsd/init-wizard.ts +40 -0
  177. package/src/resources/extensions/gsd/mcp-project-config.ts +128 -0
  178. package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +29 -0
  179. package/src/resources/extensions/gsd/tests/core-overlay-fallback.test.ts +101 -0
  180. package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +66 -0
  181. package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +85 -0
  182. package/src/resources/extensions/gsd/tests/mcp-status.test.ts +15 -0
  183. package/src/resources/extensions/gsd/tests/workflow-logger.test.ts +16 -0
  184. package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +500 -0
  185. package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +625 -0
  186. package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +629 -0
  187. package/src/resources/extensions/gsd/workflow-logger.ts +19 -3
  188. package/src/resources/extensions/gsd/workflow-mcp.ts +320 -0
  189. package/dist/web/standalone/.next/static/chunks/6502.b804e48b7919f55e.js +0 -9
  190. /package/dist/web/standalone/.next/static/{NllX5BEOLdTXS9ypf1i3i → gbSATDX4Jt2ufxzUr5nYm}/_buildManifest.js +0 -0
  191. /package/dist/web/standalone/.next/static/{NllX5BEOLdTXS9ypf1i3i → gbSATDX4Jt2ufxzUr5nYm}/_ssgManifest.js +0 -0
@@ -0,0 +1,566 @@
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
+ /** Thinking budget level (inlined from agent-core) */
12
+ export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
13
+ /** Image attachment (inlined from pi-ai) */
14
+ export interface ImageContent {
15
+ type: "image";
16
+ data: string;
17
+ mimeType: string;
18
+ }
19
+ /** Model descriptor — opaque for SDK consumers */
20
+ export interface ModelInfo {
21
+ provider: string;
22
+ id: string;
23
+ contextWindow?: number;
24
+ reasoning?: boolean;
25
+ [key: string]: unknown;
26
+ }
27
+ /** Session statistics (from agent-session.ts) */
28
+ export interface SessionStats {
29
+ sessionFile: string | undefined;
30
+ sessionId: string;
31
+ userMessages: number;
32
+ assistantMessages: number;
33
+ toolCalls: number;
34
+ toolResults: number;
35
+ totalMessages: number;
36
+ tokens: {
37
+ input: number;
38
+ output: number;
39
+ cacheRead: number;
40
+ cacheWrite: number;
41
+ total: number;
42
+ };
43
+ cost: number;
44
+ }
45
+ /** Bash command result (from bash-executor.ts) */
46
+ export interface BashResult {
47
+ /** Combined stdout + stderr output (sanitized, possibly truncated) */
48
+ output: string;
49
+ /** Process exit code (undefined if killed/cancelled) */
50
+ exitCode: number | undefined;
51
+ /** Whether the command was cancelled via signal */
52
+ cancelled: boolean;
53
+ /** Whether the output was truncated */
54
+ truncated: boolean;
55
+ /** Path to temp file containing full output (if output exceeded truncation threshold) */
56
+ fullOutputPath?: string;
57
+ }
58
+ /** Compaction result (from compaction.ts) */
59
+ export interface CompactionResult<T = unknown> {
60
+ summary: string;
61
+ firstKeptEntryId: string;
62
+ tokensBefore: number;
63
+ /** Extension-specific data (e.g., ArtifactIndex, version markers for structured compaction) */
64
+ details?: T;
65
+ }
66
+ /** Supported protocol versions. v1 is the implicit default; v2 requires an init handshake. */
67
+ export type RpcProtocolVersion = 1 | 2;
68
+ export type RpcCommand = {
69
+ id?: string;
70
+ type: "prompt";
71
+ message: string;
72
+ images?: ImageContent[];
73
+ streamingBehavior?: "steer" | "followUp";
74
+ } | {
75
+ id?: string;
76
+ type: "steer";
77
+ message: string;
78
+ images?: ImageContent[];
79
+ } | {
80
+ id?: string;
81
+ type: "follow_up";
82
+ message: string;
83
+ images?: ImageContent[];
84
+ } | {
85
+ id?: string;
86
+ type: "abort";
87
+ } | {
88
+ id?: string;
89
+ type: "new_session";
90
+ parentSession?: string;
91
+ } | {
92
+ id?: string;
93
+ type: "get_state";
94
+ } | {
95
+ id?: string;
96
+ type: "set_model";
97
+ provider: string;
98
+ modelId: string;
99
+ } | {
100
+ id?: string;
101
+ type: "cycle_model";
102
+ } | {
103
+ id?: string;
104
+ type: "get_available_models";
105
+ } | {
106
+ id?: string;
107
+ type: "set_thinking_level";
108
+ level: ThinkingLevel;
109
+ } | {
110
+ id?: string;
111
+ type: "cycle_thinking_level";
112
+ } | {
113
+ id?: string;
114
+ type: "set_steering_mode";
115
+ mode: "all" | "one-at-a-time";
116
+ } | {
117
+ id?: string;
118
+ type: "set_follow_up_mode";
119
+ mode: "all" | "one-at-a-time";
120
+ } | {
121
+ id?: string;
122
+ type: "compact";
123
+ customInstructions?: string;
124
+ } | {
125
+ id?: string;
126
+ type: "set_auto_compaction";
127
+ enabled: boolean;
128
+ } | {
129
+ id?: string;
130
+ type: "set_auto_retry";
131
+ enabled: boolean;
132
+ } | {
133
+ id?: string;
134
+ type: "abort_retry";
135
+ } | {
136
+ id?: string;
137
+ type: "bash";
138
+ command: string;
139
+ } | {
140
+ id?: string;
141
+ type: "abort_bash";
142
+ } | {
143
+ id?: string;
144
+ type: "get_session_stats";
145
+ } | {
146
+ id?: string;
147
+ type: "export_html";
148
+ outputPath?: string;
149
+ } | {
150
+ id?: string;
151
+ type: "switch_session";
152
+ sessionPath: string;
153
+ } | {
154
+ id?: string;
155
+ type: "fork";
156
+ entryId: string;
157
+ } | {
158
+ id?: string;
159
+ type: "get_fork_messages";
160
+ } | {
161
+ id?: string;
162
+ type: "get_last_assistant_text";
163
+ } | {
164
+ id?: string;
165
+ type: "set_session_name";
166
+ name: string;
167
+ } | {
168
+ id?: string;
169
+ type: "get_messages";
170
+ } | {
171
+ id?: string;
172
+ type: "get_commands";
173
+ } | {
174
+ id?: string;
175
+ type: "terminal_input";
176
+ data: string;
177
+ } | {
178
+ id?: string;
179
+ type: "terminal_resize";
180
+ cols: number;
181
+ rows: number;
182
+ } | {
183
+ id?: string;
184
+ type: "terminal_redraw";
185
+ } | {
186
+ id?: string;
187
+ type: "init";
188
+ protocolVersion: 2;
189
+ clientId?: string;
190
+ } | {
191
+ id?: string;
192
+ type: "shutdown";
193
+ graceful?: boolean;
194
+ } | {
195
+ id?: string;
196
+ type: "subscribe";
197
+ events: string[];
198
+ };
199
+ /** A command available for invocation via prompt */
200
+ export interface RpcSlashCommand {
201
+ /** Command name (without leading slash) */
202
+ name: string;
203
+ /** Human-readable description */
204
+ description?: string;
205
+ /** What kind of command this is */
206
+ source: "extension" | "prompt" | "skill";
207
+ /** Where the command was loaded from (undefined for extensions) */
208
+ location?: "user" | "project" | "path";
209
+ /** File path to the command source */
210
+ path?: string;
211
+ }
212
+ export interface RpcSessionState {
213
+ model?: ModelInfo;
214
+ thinkingLevel: ThinkingLevel;
215
+ isStreaming: boolean;
216
+ isCompacting: boolean;
217
+ steeringMode: "all" | "one-at-a-time";
218
+ followUpMode: "all" | "one-at-a-time";
219
+ sessionFile?: string;
220
+ sessionId: string;
221
+ sessionName?: string;
222
+ autoCompactionEnabled: boolean;
223
+ autoRetryEnabled: boolean;
224
+ retryInProgress: boolean;
225
+ retryAttempt: number;
226
+ messageCount: number;
227
+ pendingMessageCount: number;
228
+ /** Whether extension loading has completed. Commands from `get_commands` may be incomplete until true. */
229
+ extensionsReady: boolean;
230
+ }
231
+ export type RpcResponse = {
232
+ id?: string;
233
+ type: "response";
234
+ command: "prompt";
235
+ success: true;
236
+ runId?: string;
237
+ } | {
238
+ id?: string;
239
+ type: "response";
240
+ command: "steer";
241
+ success: true;
242
+ runId?: string;
243
+ } | {
244
+ id?: string;
245
+ type: "response";
246
+ command: "follow_up";
247
+ success: true;
248
+ runId?: string;
249
+ } | {
250
+ id?: string;
251
+ type: "response";
252
+ command: "abort";
253
+ success: true;
254
+ } | {
255
+ id?: string;
256
+ type: "response";
257
+ command: "new_session";
258
+ success: true;
259
+ data: {
260
+ cancelled: boolean;
261
+ };
262
+ } | {
263
+ id?: string;
264
+ type: "response";
265
+ command: "get_state";
266
+ success: true;
267
+ data: RpcSessionState;
268
+ } | {
269
+ id?: string;
270
+ type: "response";
271
+ command: "set_model";
272
+ success: true;
273
+ data: ModelInfo;
274
+ } | {
275
+ id?: string;
276
+ type: "response";
277
+ command: "cycle_model";
278
+ success: true;
279
+ data: {
280
+ model: ModelInfo;
281
+ thinkingLevel: ThinkingLevel;
282
+ isScoped: boolean;
283
+ } | null;
284
+ } | {
285
+ id?: string;
286
+ type: "response";
287
+ command: "get_available_models";
288
+ success: true;
289
+ data: {
290
+ models: ModelInfo[];
291
+ };
292
+ } | {
293
+ id?: string;
294
+ type: "response";
295
+ command: "set_thinking_level";
296
+ success: true;
297
+ } | {
298
+ id?: string;
299
+ type: "response";
300
+ command: "cycle_thinking_level";
301
+ success: true;
302
+ data: {
303
+ level: ThinkingLevel;
304
+ } | null;
305
+ } | {
306
+ id?: string;
307
+ type: "response";
308
+ command: "set_steering_mode";
309
+ success: true;
310
+ } | {
311
+ id?: string;
312
+ type: "response";
313
+ command: "set_follow_up_mode";
314
+ success: true;
315
+ } | {
316
+ id?: string;
317
+ type: "response";
318
+ command: "compact";
319
+ success: true;
320
+ data: CompactionResult;
321
+ } | {
322
+ id?: string;
323
+ type: "response";
324
+ command: "set_auto_compaction";
325
+ success: true;
326
+ } | {
327
+ id?: string;
328
+ type: "response";
329
+ command: "set_auto_retry";
330
+ success: true;
331
+ } | {
332
+ id?: string;
333
+ type: "response";
334
+ command: "abort_retry";
335
+ success: true;
336
+ } | {
337
+ id?: string;
338
+ type: "response";
339
+ command: "bash";
340
+ success: true;
341
+ data: BashResult;
342
+ } | {
343
+ id?: string;
344
+ type: "response";
345
+ command: "abort_bash";
346
+ success: true;
347
+ } | {
348
+ id?: string;
349
+ type: "response";
350
+ command: "get_session_stats";
351
+ success: true;
352
+ data: SessionStats;
353
+ } | {
354
+ id?: string;
355
+ type: "response";
356
+ command: "export_html";
357
+ success: true;
358
+ data: {
359
+ path: string;
360
+ };
361
+ } | {
362
+ id?: string;
363
+ type: "response";
364
+ command: "switch_session";
365
+ success: true;
366
+ data: {
367
+ cancelled: boolean;
368
+ };
369
+ } | {
370
+ id?: string;
371
+ type: "response";
372
+ command: "fork";
373
+ success: true;
374
+ data: {
375
+ text: string;
376
+ cancelled: boolean;
377
+ };
378
+ } | {
379
+ id?: string;
380
+ type: "response";
381
+ command: "get_fork_messages";
382
+ success: true;
383
+ data: {
384
+ messages: Array<{
385
+ entryId: string;
386
+ text: string;
387
+ }>;
388
+ };
389
+ } | {
390
+ id?: string;
391
+ type: "response";
392
+ command: "get_last_assistant_text";
393
+ success: true;
394
+ data: {
395
+ text: string | null;
396
+ };
397
+ } | {
398
+ id?: string;
399
+ type: "response";
400
+ command: "set_session_name";
401
+ success: true;
402
+ } | {
403
+ id?: string;
404
+ type: "response";
405
+ command: "get_messages";
406
+ success: true;
407
+ data: {
408
+ messages: unknown[];
409
+ };
410
+ } | {
411
+ id?: string;
412
+ type: "response";
413
+ command: "get_commands";
414
+ success: true;
415
+ data: {
416
+ commands: RpcSlashCommand[];
417
+ };
418
+ } | {
419
+ id?: string;
420
+ type: "response";
421
+ command: "terminal_input";
422
+ success: true;
423
+ } | {
424
+ id?: string;
425
+ type: "response";
426
+ command: "terminal_resize";
427
+ success: true;
428
+ } | {
429
+ id?: string;
430
+ type: "response";
431
+ command: "terminal_redraw";
432
+ success: true;
433
+ } | {
434
+ id?: string;
435
+ type: "response";
436
+ command: "init";
437
+ success: true;
438
+ data: RpcInitResult;
439
+ } | {
440
+ id?: string;
441
+ type: "response";
442
+ command: "shutdown";
443
+ success: true;
444
+ } | {
445
+ id?: string;
446
+ type: "response";
447
+ command: "subscribe";
448
+ success: true;
449
+ } | {
450
+ id?: string;
451
+ type: "response";
452
+ command: string;
453
+ success: false;
454
+ error: string;
455
+ };
456
+ /** Result of the init handshake (v2 only) */
457
+ export interface RpcInitResult {
458
+ protocolVersion: 2;
459
+ sessionId: string;
460
+ capabilities: {
461
+ events: string[];
462
+ commands: string[];
463
+ };
464
+ }
465
+ /** v2 execution_complete event — emitted when a prompt/steer/follow_up finishes */
466
+ export interface RpcExecutionCompleteEvent {
467
+ type: "execution_complete";
468
+ runId: string;
469
+ status: "completed" | "error" | "cancelled";
470
+ reason?: string;
471
+ stats: SessionStats;
472
+ }
473
+ /** v2 cost_update event — emitted per-turn with running cost data */
474
+ export interface RpcCostUpdateEvent {
475
+ type: "cost_update";
476
+ runId: string;
477
+ turnCost: number;
478
+ cumulativeCost: number;
479
+ tokens: {
480
+ input: number;
481
+ output: number;
482
+ cacheRead: number;
483
+ cacheWrite: number;
484
+ };
485
+ }
486
+ /** Discriminated union of all v2-only event types */
487
+ export type RpcV2Event = RpcExecutionCompleteEvent | RpcCostUpdateEvent;
488
+ /** Emitted when an extension needs user input */
489
+ export type RpcExtensionUIRequest = {
490
+ type: "extension_ui_request";
491
+ id: string;
492
+ method: "select";
493
+ title: string;
494
+ options: string[];
495
+ timeout?: number;
496
+ allowMultiple?: boolean;
497
+ } | {
498
+ type: "extension_ui_request";
499
+ id: string;
500
+ method: "confirm";
501
+ title: string;
502
+ message: string;
503
+ timeout?: number;
504
+ } | {
505
+ type: "extension_ui_request";
506
+ id: string;
507
+ method: "input";
508
+ title: string;
509
+ placeholder?: string;
510
+ timeout?: number;
511
+ } | {
512
+ type: "extension_ui_request";
513
+ id: string;
514
+ method: "editor";
515
+ title: string;
516
+ prefill?: string;
517
+ } | {
518
+ type: "extension_ui_request";
519
+ id: string;
520
+ method: "notify";
521
+ message: string;
522
+ notifyType?: "info" | "warning" | "error";
523
+ } | {
524
+ type: "extension_ui_request";
525
+ id: string;
526
+ method: "setStatus";
527
+ statusKey: string;
528
+ statusText: string | undefined;
529
+ } | {
530
+ type: "extension_ui_request";
531
+ id: string;
532
+ method: "setWidget";
533
+ widgetKey: string;
534
+ widgetLines: string[] | undefined;
535
+ widgetPlacement?: "aboveEditor" | "belowEditor";
536
+ } | {
537
+ type: "extension_ui_request";
538
+ id: string;
539
+ method: "setTitle";
540
+ title: string;
541
+ } | {
542
+ type: "extension_ui_request";
543
+ id: string;
544
+ method: "set_editor_text";
545
+ text: string;
546
+ };
547
+ /** Response to an extension UI request */
548
+ export type RpcExtensionUIResponse = {
549
+ type: "extension_ui_response";
550
+ id: string;
551
+ value: string;
552
+ } | {
553
+ type: "extension_ui_response";
554
+ id: string;
555
+ values: string[];
556
+ } | {
557
+ type: "extension_ui_response";
558
+ id: string;
559
+ confirmed: boolean;
560
+ } | {
561
+ type: "extension_ui_response";
562
+ id: string;
563
+ cancelled: true;
564
+ };
565
+ export type RpcCommandType = RpcCommand["type"];
566
+ //# sourceMappingURL=rpc-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-types.d.ts","sourceRoot":"","sources":["../src/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,sDAAsD;AACtD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpF,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,YAA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CAAC,CAAC"}
@@ -0,0 +1,12 @@
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
+ export {};
12
+ //# sourceMappingURL=rpc-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../src/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n *\n * This file is self-contained — all types that were previously imported from\n * internal packages are inlined so that this package has zero internal\n * dependencies.\n */\n\n// ============================================================================\n// Inlined types (originally from internal packages)\n// ============================================================================\n\n/** Thinking budget level (inlined from agent-core) */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\";\n\n/** Image attachment (inlined from pi-ai) */\nexport interface ImageContent {\n\ttype: \"image\";\n\tdata: string; // base64 encoded image data\n\tmimeType: string; // e.g., \"image/jpeg\", \"image/png\"\n}\n\n/** Model descriptor — opaque for SDK consumers */\nexport interface ModelInfo {\n\tprovider: string;\n\tid: string;\n\tcontextWindow?: number;\n\treasoning?: boolean;\n\t[key: string]: unknown;\n}\n\n/** Session statistics (from agent-session.ts) */\nexport interface SessionStats {\n\tsessionFile: string | undefined;\n\tsessionId: string;\n\tuserMessages: number;\n\tassistantMessages: number;\n\ttoolCalls: number;\n\ttoolResults: number;\n\ttotalMessages: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t\ttotal: number;\n\t};\n\tcost: number;\n}\n\n/** Bash command result (from bash-executor.ts) */\nexport interface BashResult {\n\t/** Combined stdout + stderr output (sanitized, possibly truncated) */\n\toutput: string;\n\t/** Process exit code (undefined if killed/cancelled) */\n\texitCode: number | undefined;\n\t/** Whether the command was cancelled via signal */\n\tcancelled: boolean;\n\t/** Whether the output was truncated */\n\ttruncated: boolean;\n\t/** Path to temp file containing full output (if output exceeded truncation threshold) */\n\tfullOutputPath?: string;\n}\n\n/** Compaction result (from compaction.ts) */\nexport interface CompactionResult<T = unknown> {\n\tsummary: string;\n\tfirstKeptEntryId: string;\n\ttokensBefore: number;\n\t/** Extension-specific data (e.g., ArtifactIndex, version markers for structured compaction) */\n\tdetails?: T;\n}\n\n// ============================================================================\n// RPC Protocol Versioning\n// ============================================================================\n\n/** Supported protocol versions. v1 is the implicit default; v2 requires an init handshake. */\nexport type RpcProtocolVersion = 1 | 2;\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string }\n\t| { id?: string; type: \"cycle_model\" }\n\t| { id?: string; type: \"get_available_models\" }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\"; customInstructions?: string }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string }\n\t| { id?: string; type: \"abort_bash\" }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionPath: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands (available for invocation via prompt)\n\t| { id?: string; type: \"get_commands\" }\n\n\t// Bridge-hosted native terminal\n\t| { id?: string; type: \"terminal_input\"; data: string }\n\t| { id?: string; type: \"terminal_resize\"; cols: number; rows: number }\n\t| { id?: string; type: \"terminal_redraw\" }\n\n\t// v2 Protocol\n\t| { id?: string; type: \"init\"; protocolVersion: 2; clientId?: string }\n\t| { id?: string; type: \"shutdown\"; graceful?: boolean }\n\t| { id?: string; type: \"subscribe\"; events: string[] };\n\n// ============================================================================\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Where the command was loaded from (undefined for extensions) */\n\tlocation?: \"user\" | \"project\" | \"path\";\n\t/** File path to the command source */\n\tpath?: string;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcSessionState {\n\tmodel?: ModelInfo;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionFile?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\tautoRetryEnabled: boolean;\n\tretryInProgress: boolean;\n\tretryAttempt: number;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\t/** Whether extension loading has completed. Commands from `get_commands` may be incomplete until true. */\n\textensionsReady: boolean;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting (async - events follow)\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true; runId?: string }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true; runId?: string }\n\t| { id?: string; type: \"response\"; command: \"follow_up\"; success: true; runId?: string }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: ModelInfo;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: ModelInfo; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: { models: ModelInfo[] };\n\t }\n\n\t// Thinking\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: CompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\n\t// Messages — AgentMessage is opaque for SDK consumers\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: unknown[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\n\t// Bridge-hosted native terminal\n\t| { id?: string; type: \"response\"; command: \"terminal_input\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"terminal_resize\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"terminal_redraw\"; success: true }\n\n\t// v2 Protocol\n\t| { id?: string; type: \"response\"; command: \"init\"; success: true; data: RpcInitResult }\n\t| { id?: string; type: \"response\"; command: \"shutdown\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"subscribe\"; success: true }\n\n\t// Error response (any command can fail)\n\t| { id?: string; type: \"response\"; command: string; success: false; error: string };\n\n// ============================================================================\n// v2 Protocol Types\n// ============================================================================\n\n/** Result of the init handshake (v2 only) */\nexport interface RpcInitResult {\n\tprotocolVersion: 2;\n\tsessionId: string;\n\tcapabilities: {\n\t\tevents: string[];\n\t\tcommands: string[];\n\t};\n}\n\n/** v2 execution_complete event — emitted when a prompt/steer/follow_up finishes */\nexport interface RpcExecutionCompleteEvent {\n\ttype: \"execution_complete\";\n\trunId: string;\n\tstatus: \"completed\" | \"error\" | \"cancelled\";\n\treason?: string;\n\tstats: SessionStats;\n}\n\n/** v2 cost_update event — emitted per-turn with running cost data */\nexport interface RpcCostUpdateEvent {\n\ttype: \"cost_update\";\n\trunId: string;\n\tturnCost: number;\n\tcumulativeCost: number;\n\ttokens: {\n\t\tinput: number;\n\t\toutput: number;\n\t\tcacheRead: number;\n\t\tcacheWrite: number;\n\t};\n}\n\n/** Discriminated union of all v2-only event types */\nexport type RpcV2Event = RpcExecutionCompleteEvent | RpcCostUpdateEvent;\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\n\n/** Emitted when an extension needs user input */\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number; allowMultiple?: boolean }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string };\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; values: string[] }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
@@ -97,6 +97,8 @@ if (require.main === module) {
97
97
  'pi-ai',
98
98
  'pi-agent-core',
99
99
  'pi-coding-agent',
100
+ 'rpc-client',
101
+ 'mcp-server',
100
102
  ]
101
103
 
102
104
  const stale = detectStalePackages(root, WORKSPACE_PACKAGES)