@kilocode/protocol 0.0.0-stage → 0.0.0-v2-9

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 (76) hide show
  1. package/dist/api.d.ts +58 -0
  2. package/dist/api.js +77 -0
  3. package/dist/client.d.ts +63 -0
  4. package/dist/client.js +55 -0
  5. package/dist/errors.d.ts +193 -0
  6. package/dist/errors.js +152 -0
  7. package/dist/groups/agent.d.ts +225 -0
  8. package/dist/groups/agent.js +30 -0
  9. package/dist/groups/command.d.ts +15 -0
  10. package/dist/groups/command.js +20 -0
  11. package/dist/groups/config.d.ts +14 -0
  12. package/dist/groups/config.js +32 -0
  13. package/dist/groups/credential.d.ts +93 -0
  14. package/dist/groups/credential.js +50 -0
  15. package/dist/groups/debug.d.ts +22 -0
  16. package/dist/groups/debug.js +49 -0
  17. package/dist/groups/event.d.ts +14853 -0
  18. package/dist/groups/event.js +51 -0
  19. package/dist/groups/form.d.ts +138 -0
  20. package/dist/groups/form.js +18 -0
  21. package/dist/groups/fs.d.ts +48 -0
  22. package/dist/groups/fs.js +73 -0
  23. package/dist/groups/generate.d.ts +33 -0
  24. package/dist/groups/generate.js +23 -0
  25. package/dist/groups/integration.d.ts +1724 -0
  26. package/dist/groups/integration.js +169 -0
  27. package/dist/groups/location.d.ts +23 -0
  28. package/dist/groups/location.js +45 -0
  29. package/dist/groups/mcp.d.ts +103 -0
  30. package/dist/groups/mcp.js +114 -0
  31. package/dist/groups/message.d.ts +1416 -0
  32. package/dist/groups/message.js +77 -0
  33. package/dist/groups/migration.d.ts +28 -0
  34. package/dist/groups/migration.js +21 -0
  35. package/dist/groups/model.d.ts +399 -0
  36. package/dist/groups/model.js +33 -0
  37. package/dist/groups/permission.d.ts +175 -0
  38. package/dist/groups/permission.js +110 -0
  39. package/dist/groups/persistent-pty.d.ts +242 -0
  40. package/dist/groups/persistent-pty.js +92 -0
  41. package/dist/groups/plugin.d.ts +86 -0
  42. package/dist/groups/plugin.js +45 -0
  43. package/dist/groups/project.d.ts +83 -0
  44. package/dist/groups/project.js +33 -0
  45. package/dist/groups/provider.d.ts +231 -0
  46. package/dist/groups/provider.js +34 -0
  47. package/dist/groups/pty.d.ts +151 -0
  48. package/dist/groups/pty.js +112 -0
  49. package/dist/groups/reference.d.ts +25 -0
  50. package/dist/groups/reference.js +33 -0
  51. package/dist/groups/rpc.d.ts +21 -0
  52. package/dist/groups/rpc.js +24 -0
  53. package/dist/groups/server.d.ts +44 -0
  54. package/dist/groups/server.js +53 -0
  55. package/dist/groups/session.d.ts +11380 -0
  56. package/dist/groups/session.js +611 -0
  57. package/dist/groups/shell.d.ts +125 -0
  58. package/dist/groups/shell.js +64 -0
  59. package/dist/groups/skill.d.ts +19 -0
  60. package/dist/groups/skill.js +20 -0
  61. package/dist/groups/vcs.d.ts +87 -0
  62. package/dist/groups/vcs.js +93 -0
  63. package/dist/groups/voice.d.ts +93 -0
  64. package/dist/groups/voice.js +89 -0
  65. package/dist/groups/websearch.d.ts +29 -0
  66. package/dist/groups/websearch.js +34 -0
  67. package/dist/groups/worktree.d.ts +41 -0
  68. package/dist/groups/worktree.js +52 -0
  69. package/dist/middleware/authorization.d.ts +13 -0
  70. package/dist/middleware/authorization.js +6 -0
  71. package/dist/middleware/schema-error.d.ts +13 -0
  72. package/dist/middleware/schema-error.js +4 -0
  73. package/dist/simulation.d.ts +1830 -0
  74. package/dist/simulation.js +497 -0
  75. package/package.json +45 -4
  76. package/README.md +0 -3
@@ -0,0 +1,497 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { Rpc, RpcGroup } from "effect/rpc";
3
+ const JsonRpcID = Schema.Union([Schema.String, Schema.Number, Schema.Null]);
4
+ const decodeJson = Schema.decodeUnknownSync(Schema.Json);
5
+ export var JsonRpc;
6
+ (function (JsonRpc) {
7
+ JsonRpc.RequestFields = {
8
+ jsonrpc: Schema.Literal("2.0"),
9
+ id: Schema.optional(JsonRpcID),
10
+ };
11
+ JsonRpc.Request = Schema.Struct({
12
+ ...JsonRpc.RequestFields,
13
+ method: Schema.String,
14
+ params: Schema.optional(Schema.Json),
15
+ });
16
+ JsonRpc.ErrorObject = Schema.Struct({
17
+ code: Schema.Number,
18
+ message: Schema.String,
19
+ data: Schema.optional(Schema.Json),
20
+ });
21
+ JsonRpc.Response = Schema.Union([
22
+ Schema.Struct({
23
+ jsonrpc: Schema.Literal("2.0"),
24
+ id: JsonRpcID,
25
+ result: Schema.Json,
26
+ error: Schema.optionalKey(Schema.Never),
27
+ }),
28
+ Schema.Struct({
29
+ jsonrpc: Schema.Literal("2.0"),
30
+ id: JsonRpcID,
31
+ result: Schema.optionalKey(Schema.Never),
32
+ error: JsonRpc.ErrorObject,
33
+ }),
34
+ ], { mode: "oneOf" });
35
+ JsonRpc.decodeRequest = Schema.decodeUnknownSync(JsonRpc.Request);
36
+ function success(id, result) {
37
+ if (id === undefined)
38
+ return undefined;
39
+ return { jsonrpc: "2.0", id, result: decodeJson(result) };
40
+ }
41
+ JsonRpc.success = success;
42
+ function failure(id, error) {
43
+ return {
44
+ jsonrpc: "2.0",
45
+ id: id ?? null,
46
+ error: {
47
+ code: -32000,
48
+ message: error instanceof Error ? error.message : String(error),
49
+ },
50
+ };
51
+ }
52
+ JsonRpc.failure = failure;
53
+ })(JsonRpc || (JsonRpc = {}));
54
+ export class SimulationRequestError extends Schema.TaggedError()("SimulationRequestError", {
55
+ method: Schema.String,
56
+ code: Schema.Number,
57
+ message: Schema.String,
58
+ data: Schema.optionalKey(Schema.Json),
59
+ }) {
60
+ }
61
+ const request = (tag, options) => Rpc.make(tag, { ...options, error: SimulationRequestError });
62
+ export var Handshake;
63
+ (function (Handshake) {
64
+ Handshake.ProtocolVersion = Schema.Literal(1);
65
+ Handshake.Capability = Schema.NonEmptyString;
66
+ Handshake.EndpointRole = Schema.Literals(["ui", "backend"]);
67
+ Handshake.Identity = Schema.Struct({
68
+ name: Schema.NonEmptyString,
69
+ version: Schema.NonEmptyString,
70
+ });
71
+ Handshake.Params = Schema.Struct({
72
+ client: Handshake.Identity,
73
+ expectedRole: Handshake.EndpointRole,
74
+ offeredVersions: Schema.Array(Schema.Int.check(Schema.isGreaterThan(0))).check(Schema.isMinLength(1), Schema.isUnique()),
75
+ requiredCapabilities: Schema.Array(Handshake.Capability).check(Schema.isUnique()),
76
+ optionalCapabilities: Schema.Array(Handshake.Capability).check(Schema.isUnique()),
77
+ });
78
+ Handshake.Response = Schema.Struct({
79
+ protocolVersion: Handshake.ProtocolVersion,
80
+ role: Handshake.EndpointRole,
81
+ server: Handshake.Identity,
82
+ capabilities: Schema.Array(Handshake.Capability).check(Schema.isUnique()),
83
+ });
84
+ Handshake.Request = Schema.Struct({
85
+ ...JsonRpc.RequestFields,
86
+ method: Schema.Literal("simulation.handshake"),
87
+ params: Handshake.Params,
88
+ });
89
+ class RoleMismatchError extends Schema.TaggedError()("SimulationHandshake.RoleMismatchError", {
90
+ expected: Handshake.EndpointRole,
91
+ actual: Handshake.EndpointRole,
92
+ message: Schema.String,
93
+ }) {
94
+ }
95
+ Handshake.RoleMismatchError = RoleMismatchError;
96
+ class UnsupportedProtocolError extends Schema.TaggedError()("SimulationHandshake.UnsupportedProtocolError", {
97
+ offered: Schema.Array(Schema.Number),
98
+ supported: Schema.Array(Handshake.ProtocolVersion),
99
+ message: Schema.String,
100
+ }) {
101
+ }
102
+ Handshake.UnsupportedProtocolError = UnsupportedProtocolError;
103
+ class MissingCapabilityError extends Schema.TaggedError()("SimulationHandshake.MissingCapabilityError", {
104
+ missing: Schema.Array(Handshake.Capability),
105
+ message: Schema.String,
106
+ }) {
107
+ }
108
+ Handshake.MissingCapabilityError = MissingCapabilityError;
109
+ function dispatch(action, params) {
110
+ return Effect.gen(function* () {
111
+ if (params.expectedRole !== action.role) {
112
+ return yield* Effect.fail(new RoleMismatchError({
113
+ expected: params.expectedRole,
114
+ actual: action.role,
115
+ message: `Expected simulation endpoint role ${params.expectedRole}, received ${action.role}`,
116
+ }));
117
+ }
118
+ if (!params.offeredVersions.includes(1)) {
119
+ return yield* Effect.fail(new UnsupportedProtocolError({
120
+ offered: params.offeredVersions,
121
+ supported: [1],
122
+ message: "No mutually supported simulation protocol version",
123
+ }));
124
+ }
125
+ const installed = new Set(action.capabilities);
126
+ const missing = params.requiredCapabilities.filter((capability) => !installed.has(capability));
127
+ if (missing.length > 0) {
128
+ return yield* Effect.fail(new MissingCapabilityError({
129
+ missing,
130
+ message: `Simulation endpoint is missing required capabilities: ${missing.join(", ")}`,
131
+ }));
132
+ }
133
+ return {
134
+ protocolVersion: 1,
135
+ role: action.role,
136
+ server: action.server,
137
+ capabilities: Array.from(installed),
138
+ };
139
+ });
140
+ }
141
+ Handshake.dispatch = dispatch;
142
+ })(Handshake || (Handshake = {}));
143
+ export var Frontend;
144
+ (function (Frontend) {
145
+ Frontend.Capabilities = [
146
+ "ui.type",
147
+ "ui.press",
148
+ "ui.enter",
149
+ "ui.arrow",
150
+ "ui.focus",
151
+ "ui.click",
152
+ "ui.click.semantic",
153
+ "ui.mouse",
154
+ "ui.recording.pointer",
155
+ "ui.resize",
156
+ "ui.matches",
157
+ "ui.state",
158
+ "ui.snapshot",
159
+ "ui.capture",
160
+ "ui.recording.finish",
161
+ ];
162
+ Frontend.KeyModifiers = Schema.Struct({
163
+ ctrl: Schema.optional(Schema.Boolean),
164
+ shift: Schema.optional(Schema.Boolean),
165
+ meta: Schema.optional(Schema.Boolean),
166
+ super: Schema.optional(Schema.Boolean),
167
+ hyper: Schema.optional(Schema.Boolean),
168
+ });
169
+ Frontend.SemanticClickTarget = Schema.Struct({
170
+ id: Schema.NonEmptyString,
171
+ instance: Schema.optionalKey(Schema.NonEmptyString),
172
+ element: Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0)),
173
+ });
174
+ const MousePosition = {
175
+ x: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
176
+ y: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
177
+ modifiers: Schema.optionalKey(Schema.Struct({
178
+ shift: Schema.optionalKey(Schema.Boolean),
179
+ alt: Schema.optionalKey(Schema.Boolean),
180
+ ctrl: Schema.optionalKey(Schema.Boolean),
181
+ })),
182
+ };
183
+ Frontend.MouseParams = Schema.Union([
184
+ Schema.Struct({ ...MousePosition, action: Schema.Literal("move") }),
185
+ Schema.Struct({
186
+ ...MousePosition,
187
+ action: Schema.Literals(["down", "up"]),
188
+ button: Schema.optionalKey(Schema.Literals(["left", "middle", "right"])),
189
+ }),
190
+ Schema.Struct({
191
+ ...MousePosition,
192
+ action: Schema.Literal("scroll"),
193
+ direction: Schema.Literals(["up", "down", "left", "right"]),
194
+ }),
195
+ ]);
196
+ Frontend.Action = Schema.Union([
197
+ Schema.Struct({ type: Schema.Literal("ui.type"), text: Schema.String }),
198
+ Schema.Struct({ type: Schema.Literal("ui.press"), key: Schema.String, modifiers: Schema.optional(Frontend.KeyModifiers) }),
199
+ Schema.Struct({ type: Schema.Literal("ui.enter") }),
200
+ Schema.Struct({ type: Schema.Literal("ui.arrow"), direction: Schema.Literals(["up", "down", "left", "right"]) }),
201
+ Schema.Struct({ type: Schema.Literal("ui.focus"), target: Schema.Number }),
202
+ Schema.Struct({ type: Schema.Literal("ui.mouse"), params: Frontend.MouseParams }),
203
+ Schema.Struct({
204
+ type: Schema.Literal("ui.click"),
205
+ target: Schema.Number,
206
+ x: Schema.Number,
207
+ y: Schema.Number,
208
+ semantic: Schema.optionalKey(Frontend.SemanticClickTarget),
209
+ }),
210
+ Schema.Struct({ type: Schema.Literal("ui.resize"), cols: Schema.Number, rows: Schema.Number }),
211
+ ]);
212
+ Frontend.Element = Schema.Struct({
213
+ id: Schema.String,
214
+ num: Schema.Number,
215
+ x: Schema.Number,
216
+ y: Schema.Number,
217
+ width: Schema.Number,
218
+ height: Schema.Number,
219
+ focusable: Schema.Boolean,
220
+ focused: Schema.Boolean,
221
+ clickable: Schema.Boolean,
222
+ editor: Schema.Boolean,
223
+ });
224
+ Frontend.State = Schema.Struct({
225
+ focused: Schema.Struct({
226
+ renderable: Schema.optional(Schema.Number),
227
+ editor: Schema.Boolean,
228
+ }),
229
+ elements: Schema.Array(Frontend.Element),
230
+ });
231
+ Frontend.SemanticNode = Schema.Struct({
232
+ id: Schema.NonEmptyString,
233
+ instance: Schema.optionalKey(Schema.NonEmptyString),
234
+ parent: Schema.optionalKey(Schema.NonEmptyString),
235
+ role: Schema.NonEmptyString,
236
+ label: Schema.optionalKey(Schema.NonEmptyString),
237
+ element: Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0)),
238
+ focused: Schema.optionalKey(Schema.Boolean),
239
+ selected: Schema.optionalKey(Schema.Boolean),
240
+ expanded: Schema.optionalKey(Schema.Boolean),
241
+ disabled: Schema.optionalKey(Schema.Boolean),
242
+ });
243
+ Frontend.SemanticSnapshot = Schema.Struct({
244
+ format: Schema.Literal("opencode-ui-snapshot-v1"),
245
+ nodes: Schema.Array(Frontend.SemanticNode).check(Schema.makeFilter((nodes) => {
246
+ const ids = new Set(nodes.map((node) => node.id));
247
+ if (ids.size !== nodes.length)
248
+ return "semantic node ids must be unique";
249
+ if (new Set(nodes.map((node) => node.element)).size !== nodes.length)
250
+ return "semantic node elements must be unique";
251
+ if (nodes.some((node) => node.parent !== undefined && !ids.has(node.parent)))
252
+ return "semantic node parents must reference another node";
253
+ const parents = new Map(nodes.map((node) => [node.id, node.parent]));
254
+ for (const node of nodes) {
255
+ const visited = new Set();
256
+ let current = node.id;
257
+ while (current !== undefined) {
258
+ if (visited.has(current))
259
+ return "semantic node hierarchy must be acyclic";
260
+ visited.add(current);
261
+ current = parents.get(current);
262
+ }
263
+ }
264
+ return undefined;
265
+ })),
266
+ });
267
+ Frontend.Color = Schema.Tuple([Schema.Number, Schema.Number, Schema.Number, Schema.Number]);
268
+ Frontend.CapturedImage = Schema.Struct({
269
+ x: Schema.Number,
270
+ y: Schema.Number,
271
+ width: Schema.Number,
272
+ height: Schema.Number,
273
+ pixelWidth: Schema.Number,
274
+ pixelHeight: Schema.Number,
275
+ rgba: Schema.String.check(Schema.isBase64()),
276
+ });
277
+ Frontend.CapturedFrame = Schema.Struct({
278
+ cols: Schema.Number,
279
+ rows: Schema.Number,
280
+ cursor: Schema.Tuple([Schema.Number, Schema.Number]),
281
+ lines: Schema.Array(Schema.Struct({
282
+ spans: Schema.Array(Schema.Struct({
283
+ text: Schema.String,
284
+ fg: Frontend.Color,
285
+ bg: Frontend.Color,
286
+ attributes: Schema.Number,
287
+ width: Schema.Number,
288
+ })),
289
+ })),
290
+ images: Schema.optionalKey(Schema.Array(Frontend.CapturedImage)),
291
+ });
292
+ Frontend.RecordingFinish = Schema.String;
293
+ Frontend.Matches = Schema.Boolean;
294
+ Frontend.TypeParams = Schema.Struct({ text: Schema.String });
295
+ Frontend.MatchesParams = Schema.Struct({ text: Schema.String });
296
+ Frontend.PressParams = Schema.Struct({ key: Schema.String, modifiers: Schema.optional(Frontend.KeyModifiers) });
297
+ Frontend.pressParams = (key, modifiers) => ({
298
+ key,
299
+ ...(modifiers === undefined ? {} : { modifiers }),
300
+ });
301
+ Frontend.ArrowParams = Schema.Struct({ direction: Schema.Literals(["up", "down", "left", "right"]) });
302
+ Frontend.FocusParams = Schema.Struct({ target: Schema.Number });
303
+ Frontend.ClickParams = Schema.Struct({
304
+ target: Schema.Number,
305
+ x: Schema.Number,
306
+ y: Schema.Number,
307
+ semantic: Schema.optionalKey(Frontend.SemanticClickTarget),
308
+ });
309
+ Frontend.ResizeParams = Schema.Struct({ cols: Schema.Number, rows: Schema.Number });
310
+ Frontend.Request = Schema.Union([
311
+ Handshake.Request,
312
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.type"), params: Frontend.TypeParams }),
313
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.press"), params: Frontend.PressParams }),
314
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.arrow"), params: Frontend.ArrowParams }),
315
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.focus"), params: Frontend.FocusParams }),
316
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.click"), params: Frontend.ClickParams }),
317
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.mouse"), params: Frontend.MouseParams }),
318
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.resize"), params: Frontend.ResizeParams }),
319
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.matches"), params: Frontend.MatchesParams }),
320
+ Schema.Struct({
321
+ ...JsonRpc.RequestFields,
322
+ method: Schema.Literals(["ui.enter", "ui.state", "ui.snapshot", "ui.recording.finish"]),
323
+ }),
324
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("ui.capture") }),
325
+ ]);
326
+ Frontend.decodeRequest = Schema.decodeUnknownSync(Frontend.Request);
327
+ Frontend.decodeRequestEffect = Schema.decodeUnknownEffect(Schema.fromJsonString(Frontend.Request));
328
+ })(Frontend || (Frontend = {}));
329
+ export var Backend;
330
+ (function (Backend) {
331
+ Backend.Capabilities = [
332
+ "llm.attach",
333
+ "llm.chunk",
334
+ "llm.finish",
335
+ "llm.disconnect",
336
+ "llm.pending",
337
+ "llm.request",
338
+ "llm.tool-input-delta",
339
+ "tool.attach",
340
+ "tool.update",
341
+ "tool.finish",
342
+ "tool.fail",
343
+ "tool.invocation",
344
+ "tool.cancel",
345
+ ];
346
+ Backend.Item = Schema.Union([
347
+ Schema.Struct({ type: Schema.Literal("textDelta"), text: Schema.String }),
348
+ Schema.Struct({ type: Schema.Literal("reasoningDelta"), text: Schema.String }),
349
+ Schema.Struct({
350
+ type: Schema.Literal("toolInputStart"),
351
+ index: Schema.Number,
352
+ id: Schema.String,
353
+ name: Schema.String,
354
+ }),
355
+ Schema.Struct({
356
+ type: Schema.Literal("toolInputDelta"),
357
+ index: Schema.Number,
358
+ text: Schema.String,
359
+ }),
360
+ Schema.Struct({
361
+ type: Schema.Literal("toolCall"),
362
+ index: Schema.Number,
363
+ id: Schema.String,
364
+ name: Schema.String,
365
+ input: Schema.Json,
366
+ }),
367
+ Schema.Struct({ type: Schema.Literal("raw"), chunk: Schema.Json }),
368
+ ]);
369
+ Backend.FinishReason = Schema.Literals(["stop", "tool-calls", "length", "content-filter"]);
370
+ Backend.ToolContent = Schema.Union([
371
+ Schema.Struct({ type: Schema.Literal("text"), text: Schema.String }),
372
+ Schema.Struct({
373
+ type: Schema.Literal("file"),
374
+ data: Schema.String,
375
+ mime: Schema.NonEmptyString,
376
+ name: Schema.optionalKey(Schema.String),
377
+ }),
378
+ ]);
379
+ const ProviderSafeName = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
380
+ const ToolName = Schema.NonEmptyString.check(Schema.makeFilter((name) => ProviderSafeName.test(name) ? undefined : "simulated tool names must be provider-safe"));
381
+ const ToolNamespace = Schema.NonEmptyString.check(Schema.makeFilter((namespace) => namespace.split(".").every((segment) => ProviderSafeName.test(segment))
382
+ ? undefined
383
+ : "simulated tool namespaces must contain provider-safe segments"));
384
+ Backend.ToolRegistration = Schema.Struct({
385
+ name: ToolName,
386
+ description: Schema.String,
387
+ inputSchema: Schema.Record(Schema.String, Schema.Json),
388
+ outputSchema: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),
389
+ permission: Schema.optionalKey(Schema.NonEmptyString),
390
+ options: Schema.optionalKey(Schema.Struct({
391
+ namespace: Schema.optionalKey(ToolNamespace),
392
+ codemode: Schema.optionalKey(Schema.Boolean),
393
+ })),
394
+ });
395
+ Backend.ToolAttachParams = Schema.Struct({
396
+ tools: Schema.Array(Backend.ToolRegistration).check(Schema.makeFilter((tools) => {
397
+ const names = tools.map(exposedToolName);
398
+ if (names.some((name) => !ProviderSafeName.test(name)))
399
+ return "simulated tool names including namespaces must be provider-safe";
400
+ if (new Set(names).size !== names.length)
401
+ return "simulated tool registrations must have unique exposed names";
402
+ if (tools.some((tool) => tool.name === "execute" && tool.options?.namespace === undefined && tool.options?.codemode === false))
403
+ return 'direct simulated tool name "execute" is reserved';
404
+ return undefined;
405
+ })),
406
+ });
407
+ function exposedToolName(registration) {
408
+ return registration.options?.namespace === undefined
409
+ ? registration.name
410
+ : `${registration.options.namespace.replaceAll(".", "_")}_${registration.name}`;
411
+ }
412
+ Backend.exposedToolName = exposedToolName;
413
+ Backend.ToolProgress = Schema.Record(Schema.String, Schema.Json);
414
+ Backend.ToolOutput = Schema.Struct({
415
+ structured: Schema.Json,
416
+ content: Schema.Array(Backend.ToolContent),
417
+ });
418
+ Backend.ToolUpdateParams = Schema.Struct({
419
+ id: Schema.String,
420
+ sequence: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
421
+ update: Backend.ToolProgress,
422
+ });
423
+ Backend.ToolFinishParams = Schema.Struct({ id: Schema.String, output: Backend.ToolOutput });
424
+ Backend.ToolFailParams = Schema.Struct({ id: Schema.String, message: Schema.String });
425
+ Backend.ToolInvocation = Schema.Struct({
426
+ id: Schema.String,
427
+ name: Schema.String,
428
+ input: Schema.Json,
429
+ context: Schema.Struct({
430
+ sessionID: Schema.String,
431
+ agent: Schema.String,
432
+ messageID: Schema.String,
433
+ id: Schema.String,
434
+ }),
435
+ });
436
+ Backend.ToolCancellation = Schema.Struct({
437
+ id: Schema.String,
438
+ reason: Schema.Literal("interrupted"),
439
+ });
440
+ Backend.Attached = Schema.Struct({ attached: Schema.Literal(true) });
441
+ Backend.Ok = Schema.Struct({ ok: Schema.Literal(true) });
442
+ Backend.ChunkParams = Schema.Struct({ id: Schema.String, items: Schema.Array(Backend.Item) });
443
+ Backend.FinishParams = Schema.Struct({
444
+ id: Schema.String,
445
+ reason: Backend.FinishReason.pipe(Schema.withDecodingDefault(Effect.succeed("stop"))),
446
+ });
447
+ Backend.FinishPayload = Schema.Struct({
448
+ id: Schema.String,
449
+ reason: Schema.optionalKey(Backend.FinishReason),
450
+ });
451
+ Backend.DisconnectParams = Schema.Struct({ id: Schema.String });
452
+ Backend.Request = Schema.Union([
453
+ Handshake.Request,
454
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("llm.chunk"), params: Backend.ChunkParams }),
455
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("llm.finish"), params: Backend.FinishParams }),
456
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("llm.disconnect"), params: Backend.DisconnectParams }),
457
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("tool.attach"), params: Backend.ToolAttachParams }),
458
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("tool.update"), params: Backend.ToolUpdateParams }),
459
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("tool.finish"), params: Backend.ToolFinishParams }),
460
+ Schema.Struct({ ...JsonRpc.RequestFields, method: Schema.Literal("tool.fail"), params: Backend.ToolFailParams }),
461
+ Schema.Struct({
462
+ ...JsonRpc.RequestFields,
463
+ method: Schema.Literals(["llm.attach", "llm.pending"]),
464
+ }),
465
+ ]);
466
+ Backend.decodeRequest = Schema.decodeUnknownSync(Backend.Request);
467
+ Backend.decodeRequestEffect = Schema.decodeUnknownEffect(Schema.fromJsonString(Backend.Request));
468
+ Backend.ProviderInvocation = Schema.Struct({ id: Schema.String, url: Schema.String, body: Schema.Json });
469
+ Backend.Pending = Schema.Struct({ invocations: Schema.Array(Backend.ProviderInvocation) });
470
+ Backend.NetworkLogEntry = Schema.Struct({
471
+ time: Schema.Number,
472
+ method: Schema.String,
473
+ url: Schema.String,
474
+ matched: Schema.Boolean,
475
+ });
476
+ Backend.Notification = Schema.Union([
477
+ Schema.Struct({
478
+ jsonrpc: Schema.Literal("2.0"),
479
+ method: Schema.Literal("llm.request"),
480
+ params: Backend.ProviderInvocation,
481
+ }),
482
+ Schema.Struct({
483
+ jsonrpc: Schema.Literal("2.0"),
484
+ method: Schema.Literal("tool.invocation"),
485
+ params: Backend.ToolInvocation,
486
+ }),
487
+ Schema.Struct({
488
+ jsonrpc: Schema.Literal("2.0"),
489
+ method: Schema.Literal("tool.cancel"),
490
+ params: Backend.ToolCancellation,
491
+ }),
492
+ ]);
493
+ Backend.decodeNotification = Schema.decodeUnknownSync(Backend.Notification);
494
+ Backend.decodeNotificationEffect = Schema.decodeUnknownEffect(Schema.fromJsonString(Backend.Notification));
495
+ })(Backend || (Backend = {}));
496
+ export const UiRpcs = RpcGroup.make(request("simulation.handshake", { payload: Handshake.Params, success: Handshake.Response }), request("ui.state", { success: Frontend.State }), request("ui.snapshot", { success: Frontend.SemanticSnapshot }), request("ui.capture", { success: Frontend.CapturedFrame }), request("ui.matches", { payload: Frontend.MatchesParams, success: Frontend.Matches }), request("ui.recording.finish", { success: Frontend.RecordingFinish }), request("ui.type", { payload: Frontend.TypeParams, success: Frontend.State }), request("ui.press", { payload: Frontend.PressParams, success: Frontend.State }), request("ui.enter", { success: Frontend.State }), request("ui.arrow", { payload: Frontend.ArrowParams, success: Frontend.State }), request("ui.focus", { payload: Frontend.FocusParams, success: Frontend.State }), request("ui.click", { payload: Frontend.ClickParams, success: Frontend.State }), request("ui.mouse", { payload: Frontend.MouseParams, success: Frontend.State }), request("ui.resize", { payload: Frontend.ResizeParams, success: Frontend.State }));
497
+ export const BackendRpcs = RpcGroup.make(request("simulation.handshake", { payload: Handshake.Params, success: Handshake.Response }), request("llm.attach", { success: Backend.Attached }), request("llm.pending", { success: Backend.Pending }), request("llm.chunk", { payload: Backend.ChunkParams, success: Backend.Ok }), request("llm.finish", { payload: Backend.FinishPayload, success: Backend.Ok }), request("llm.disconnect", { payload: Backend.DisconnectParams, success: Backend.Ok }), request("tool.attach", { payload: Backend.ToolAttachParams, success: Backend.Attached }), request("tool.update", { payload: Backend.ToolUpdateParams, success: Backend.Ok }), request("tool.finish", { payload: Backend.ToolFinishParams, success: Backend.Ok }), request("tool.fail", { payload: Backend.ToolFailParams, success: Backend.Ok }));
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package.json",
2
3
  "name": "@kilocode/protocol",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
4
+ "version": "0.0.0-v2-9",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Kilo-Org/kilocode.git",
10
+ "directory": "packages/protocol"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "exports": {
19
+ "./simulation": {
20
+ "import": "./dist/simulation.js",
21
+ "types": "./dist/simulation.d.ts"
22
+ },
23
+ "./*": {
24
+ "import": "./dist/*.js",
25
+ "types": "./dist/*.d.ts"
26
+ }
27
+ },
28
+ "scripts": {
29
+ "build": "bun run script/build.ts",
30
+ "generate": "bun run script/generate-openapi.ts",
31
+ "check:generated": "bun run script/generate-openapi.ts --check",
32
+ "test": "bun test --only-failures",
33
+ "typecheck": "bun check --no-script",
34
+ "typecheck:tsc": "tsc --noEmit"
35
+ },
36
+ "dependencies": {
37
+ "@opencode/schema": "npm:@kilocode/schema@0.0.0-v2-9",
38
+ "effect": "4.0.1"
39
+ },
40
+ "devDependencies": {
41
+ "@tsconfig/bun": "1.0.9",
42
+ "@types/bun": "1.4.3",
43
+ "@typescript/native": "npm:typescript@7.1.0-beta",
44
+ "prettier": "3.6.2",
45
+ "typescript": "npm:@typescript/typescript6@6.0.2"
46
+ }
47
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.