@sanqianx/claude-ai-workbench 0.11.0

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 (90) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +129 -0
  3. package/apps/agent-terminal/app.css +567 -0
  4. package/apps/agent-terminal/app.js +2392 -0
  5. package/apps/agent-terminal/index.html +158 -0
  6. package/apps/ai-profile-settings-host/index.html +25 -0
  7. package/apps/ai-profile-settings-host/page.css +1 -0
  8. package/apps/ai-profile-settings-host/page.js +113 -0
  9. package/apps/minimal-test-host/README.md +15 -0
  10. package/apps/minimal-test-host/host.css +2 -0
  11. package/apps/minimal-test-host/host.js +35 -0
  12. package/apps/minimal-test-host/index.html +58 -0
  13. package/apps/minimal-test-host/optional-mock/fault-injection.js +15 -0
  14. package/docs/sdk/FILE_LAYOUT.md +31 -0
  15. package/docs/sdk/INTEGRATION.md +126 -0
  16. package/docs/sdk/README.md +21 -0
  17. package/docs/sdk/openapi.yaml +760 -0
  18. package/package.json +51 -0
  19. package/packages/client/README.md +11 -0
  20. package/packages/client/index.d.ts +81 -0
  21. package/packages/client/index.js +198 -0
  22. package/packages/client/package.json +29 -0
  23. package/packages/contracts/README.md +9 -0
  24. package/packages/contracts/index.d.ts +252 -0
  25. package/packages/contracts/index.js +295 -0
  26. package/packages/contracts/package.json +24 -0
  27. package/packages/core/README.md +8 -0
  28. package/packages/core/index.d.ts +76 -0
  29. package/packages/core/index.js +214 -0
  30. package/packages/core/package.json +29 -0
  31. package/packages/server/README.md +17 -0
  32. package/packages/server/bin/agent-terminal-server.js +36 -0
  33. package/packages/server/bin/claude-workbench-server.js +46 -0
  34. package/packages/server/bin/claude-workbench.js +225 -0
  35. package/packages/server/index.d.ts +145 -0
  36. package/packages/server/index.js +183 -0
  37. package/packages/server/lib/agent-discovery.js +112 -0
  38. package/packages/server/lib/agent-registry.js +98 -0
  39. package/packages/server/lib/attachment-store.js +78 -0
  40. package/packages/server/lib/bridges/app-server-bridge.js +372 -0
  41. package/packages/server/lib/bridges/opencode-server-bridge.js +490 -0
  42. package/packages/server/lib/capture-settings-store.js +34 -0
  43. package/packages/server/lib/context-resolver.js +40 -0
  44. package/packages/server/lib/drivers/cli-json-runner.js +960 -0
  45. package/packages/server/lib/drivers/codex-driver.js +1413 -0
  46. package/packages/server/lib/drivers/opencode-driver.js +1527 -0
  47. package/packages/server/lib/drivers/zcode-driver.js +1167 -0
  48. package/packages/server/lib/event-stream.js +35 -0
  49. package/packages/server/lib/folder-picker.js +623 -0
  50. package/packages/server/lib/http-handler.js +254 -0
  51. package/packages/server/lib/json-file.js +19 -0
  52. package/packages/server/lib/model-detection.js +295 -0
  53. package/packages/server/lib/profile-store.js +149 -0
  54. package/packages/server/lib/project-store.js +102 -0
  55. package/packages/server/lib/session-archive-store.js +53 -0
  56. package/packages/server/lib/system-doctor.js +119 -0
  57. package/packages/server/lib/ui-preferences-store.js +48 -0
  58. package/packages/server/lib/workbench-service.js +620 -0
  59. package/packages/server/package.json +34 -0
  60. package/packages/ui/README.md +30 -0
  61. package/packages/ui/ai-profile-settings.d.ts +45 -0
  62. package/packages/ui/ai-profile-settings.js +283 -0
  63. package/packages/ui/claude-terminal.d.ts +31 -0
  64. package/packages/ui/claude-terminal.js +343 -0
  65. package/packages/ui/index.d.ts +18 -0
  66. package/packages/ui/index.js +51 -0
  67. package/packages/ui/package.json +42 -0
  68. package/packages/ui/theme.css +13 -0
  69. package/src/assets/claude-prompts.json +21 -0
  70. package/src/backend/http/ai-profile-routes.js +61 -0
  71. package/src/backend/http/claude-routes.js +170 -0
  72. package/src/backend/http/node-helpers.js +45 -0
  73. package/src/backend/index.js +21 -0
  74. package/src/backend/lib/ai-adapter.js +144 -0
  75. package/src/backend/lib/ai-profile-store.js +259 -0
  76. package/src/backend/lib/ai-vendor-presets.js +83 -0
  77. package/src/backend/lib/ai-workspace.js +140 -0
  78. package/src/backend/lib/automation-config.js +253 -0
  79. package/src/backend/lib/claude-cli-runner.js +1749 -0
  80. package/src/backend/lib/data-dir.js +169 -0
  81. package/src/backend/lib/llm-client.js +176 -0
  82. package/src/backend/lib/model-context-windows.js +82 -0
  83. package/src/backend/lib/prompt-registry.js +166 -0
  84. package/src/backend/lib/runtime-config.js +121 -0
  85. package/src/index.js +7 -0
  86. package/src/sdk-wave-a.ts +1 -0
  87. package/src/sdk-wave-b.ts +1 -0
  88. package/src/sdk-wave-c.ts +1 -0
  89. package/src/sdk-wave-d.ts +1 -0
  90. package/src/sdk-wave-e.ts +1 -0
@@ -0,0 +1,760 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Claude AI Workbench API
4
+ version: 0.11.0
5
+ description: Versioned local API for AI Profile, credential and Claude Code session management.
6
+ servers:
7
+ - url: http://127.0.0.1:5760/api/claude-workbench/v1
8
+ tags:
9
+ - name: System
10
+ - name: Agents
11
+ - name: Projects
12
+ - name: Profiles
13
+ - name: Sessions
14
+ paths:
15
+ /health:
16
+ get:
17
+ tags: [System]
18
+ operationId: getHealth
19
+ responses:
20
+ "200":
21
+ description: Server health
22
+ content:
23
+ application/json:
24
+ schema: { $ref: "#/components/schemas/Health" }
25
+ /runtime:
26
+ get:
27
+ tags: [System]
28
+ operationId: getRuntime
29
+ responses:
30
+ "200":
31
+ description: Claude Code runtime availability
32
+ content:
33
+ application/json:
34
+ schema: { $ref: "#/components/schemas/RuntimeInfo" }
35
+ /agents:
36
+ get:
37
+ tags: [Agents]
38
+ operationId: listAgents
39
+ responses:
40
+ "200":
41
+ description: Known agents with their capability matrix
42
+ content:
43
+ application/json:
44
+ schema:
45
+ type: object
46
+ required: [agents]
47
+ properties:
48
+ agents:
49
+ type: array
50
+ items: { $ref: "#/components/schemas/AgentInfo" }
51
+ /projects:
52
+ get:
53
+ tags: [Projects]
54
+ operationId: listProjects
55
+ responses:
56
+ "200":
57
+ description: User-created workspace projects
58
+ content:
59
+ application/json:
60
+ schema:
61
+ type: object
62
+ required: [projects]
63
+ properties:
64
+ projects:
65
+ type: array
66
+ items: { $ref: "#/components/schemas/Project" }
67
+ post:
68
+ tags: [Projects]
69
+ operationId: createProject
70
+ requestBody:
71
+ required: true
72
+ content:
73
+ application/json:
74
+ schema: { $ref: "#/components/schemas/ProjectInput" }
75
+ responses:
76
+ "201":
77
+ description: Created project
78
+ content:
79
+ application/json:
80
+ schema: { $ref: "#/components/schemas/Project" }
81
+ "400": { $ref: "#/components/responses/Error" }
82
+ /projects/{projectId}:
83
+ parameters:
84
+ - $ref: "#/components/parameters/ProjectId"
85
+ get:
86
+ tags: [Projects]
87
+ operationId: getProject
88
+ responses:
89
+ "200":
90
+ description: Single project
91
+ content:
92
+ application/json:
93
+ schema: { $ref: "#/components/schemas/Project" }
94
+ "404": { $ref: "#/components/responses/Error" }
95
+ patch:
96
+ tags: [Projects]
97
+ operationId: updateProject
98
+ requestBody:
99
+ required: true
100
+ content:
101
+ application/json:
102
+ schema:
103
+ type: object
104
+ properties:
105
+ name: { type: string, maxLength: 128 }
106
+ defaultAiProfileId: { type: [string, "null"], description: Default provider; null selects the agent's own login. }
107
+ defaultModel: { type: [string, "null"] }
108
+ defaultAgentId: { type: string, enum: [claude-code, codex, opencode, zcode] }
109
+ responses:
110
+ "200":
111
+ description: Updated project name or defaults
112
+ content:
113
+ application/json:
114
+ schema: { $ref: "#/components/schemas/Project" }
115
+ "400": { $ref: "#/components/responses/Error" }
116
+ "404": { $ref: "#/components/responses/Error" }
117
+ delete:
118
+ tags: [Projects]
119
+ operationId: removeProject
120
+ description: Removes the project together with all of its sessions.
121
+ responses:
122
+ "204": { description: Removed }
123
+ "404": { $ref: "#/components/responses/Error" }
124
+ /profiles:
125
+ get:
126
+ tags: [Profiles]
127
+ operationId: listProfiles
128
+ responses:
129
+ "200":
130
+ description: Public profiles; never contains a plaintext credential
131
+ content:
132
+ application/json:
133
+ schema:
134
+ type: object
135
+ required: [profiles]
136
+ properties:
137
+ profiles:
138
+ type: array
139
+ items: { $ref: "#/components/schemas/AiProfile" }
140
+ post:
141
+ tags: [Profiles]
142
+ operationId: createProfile
143
+ requestBody:
144
+ required: true
145
+ content:
146
+ application/json:
147
+ schema: { $ref: "#/components/schemas/AiProfileInput" }
148
+ responses:
149
+ "201":
150
+ description: Created profile
151
+ content:
152
+ application/json:
153
+ schema: { $ref: "#/components/schemas/AiProfile" }
154
+ "400": { $ref: "#/components/responses/Error" }
155
+ /profiles/test:
156
+ post:
157
+ tags: [Profiles]
158
+ operationId: testProfileDraft
159
+ description: Tests the submitted draft without saving the profile or credential.
160
+ requestBody:
161
+ required: true
162
+ content:
163
+ application/json:
164
+ schema:
165
+ type: object
166
+ required: [profile]
167
+ properties:
168
+ profile: { $ref: "#/components/schemas/AiProfileInput" }
169
+ credential:
170
+ type: string
171
+ writeOnly: true
172
+ description: Temporary credential. If omitted, an existing stored credential for the same profile id is used.
173
+ responses:
174
+ "200":
175
+ description: Verified by the Claude Code runtime
176
+ content:
177
+ application/json:
178
+ schema: { $ref: "#/components/schemas/ProfileTestResult" }
179
+ "400": { $ref: "#/components/responses/Error" }
180
+ /profiles/{profileId}:
181
+ parameters:
182
+ - $ref: "#/components/parameters/ProfileId"
183
+ get:
184
+ tags: [Profiles]
185
+ operationId: getProfile
186
+ responses:
187
+ "200":
188
+ description: Public profile
189
+ content:
190
+ application/json:
191
+ schema: { $ref: "#/components/schemas/AiProfile" }
192
+ "404": { $ref: "#/components/responses/Error" }
193
+ put:
194
+ tags: [Profiles]
195
+ operationId: updateProfile
196
+ requestBody:
197
+ required: true
198
+ content:
199
+ application/json:
200
+ schema: { $ref: "#/components/schemas/AiProfileInput" }
201
+ responses:
202
+ "200":
203
+ description: Updated profile
204
+ content:
205
+ application/json:
206
+ schema: { $ref: "#/components/schemas/AiProfile" }
207
+ "400": { $ref: "#/components/responses/Error" }
208
+ delete:
209
+ tags: [Profiles]
210
+ operationId: deleteProfile
211
+ responses:
212
+ "204": { description: Profile and its credential were deleted }
213
+ "404": { $ref: "#/components/responses/Error" }
214
+ /profiles/{profileId}/credential:
215
+ parameters:
216
+ - $ref: "#/components/parameters/ProfileId"
217
+ put:
218
+ tags: [Profiles]
219
+ operationId: setProfileCredential
220
+ requestBody:
221
+ required: true
222
+ content:
223
+ application/json:
224
+ schema:
225
+ type: object
226
+ required: [secret]
227
+ properties:
228
+ secret: { type: string, minLength: 1, writeOnly: true }
229
+ responses:
230
+ "204": { description: Credential stored separately from the public profile }
231
+ "400": { $ref: "#/components/responses/Error" }
232
+ "404": { $ref: "#/components/responses/Error" }
233
+ /profiles/{profileId}/test:
234
+ parameters:
235
+ - $ref: "#/components/parameters/ProfileId"
236
+ post:
237
+ tags: [Profiles]
238
+ operationId: testSavedProfile
239
+ responses:
240
+ "200":
241
+ description: Verified by the Claude Code runtime
242
+ content:
243
+ application/json:
244
+ schema: { $ref: "#/components/schemas/ProfileTestResult" }
245
+ "400": { $ref: "#/components/responses/Error" }
246
+ "404": { $ref: "#/components/responses/Error" }
247
+ /sessions:
248
+ get:
249
+ tags: [Sessions]
250
+ operationId: listSessions
251
+ parameters:
252
+ - in: query
253
+ name: contextId
254
+ required: true
255
+ schema: { type: string }
256
+ - in: query
257
+ name: archived
258
+ required: false
259
+ description: Set to 1 or true to include archived sessions
260
+ schema: { type: string, enum: ["", "1", "true"] }
261
+ responses:
262
+ "200":
263
+ description: Sessions for a context
264
+ content:
265
+ application/json:
266
+ schema:
267
+ type: object
268
+ properties:
269
+ sessions:
270
+ type: array
271
+ items: { $ref: "#/components/schemas/SessionSummary" }
272
+ post:
273
+ tags: [Sessions]
274
+ operationId: startSession
275
+ requestBody:
276
+ required: true
277
+ content:
278
+ application/json:
279
+ schema:
280
+ type: object
281
+ required: [context]
282
+ properties:
283
+ context: { $ref: "#/components/schemas/WorkbenchContext" }
284
+ aiProfileId: { type: [string, "null"], description: Session provider override; omitted inherits the project default; null selects agent-owned login. }
285
+ model: { type: [string, "null"], description: Session model override. }
286
+ permissionMode: { $ref: "#/components/schemas/PermissionMode" }
287
+ agentId:
288
+ type: string
289
+ enum: [claude-code, codex, opencode, zcode]
290
+ description: Omitted inherits the project default, then claude-code.
291
+ effort:
292
+ type: string
293
+ enum: [low, medium, high, max]
294
+ description: Reasoning effort slot; only agents whose capabilities include "effort" accept it.
295
+ responses:
296
+ "201":
297
+ description: Session created
298
+ content:
299
+ application/json:
300
+ schema:
301
+ type: object
302
+ properties:
303
+ session: { $ref: "#/components/schemas/SessionSummary" }
304
+ "400": { $ref: "#/components/responses/Error" }
305
+ /sessions/{sessionId}:
306
+ parameters:
307
+ - $ref: "#/components/parameters/SessionId"
308
+ get:
309
+ tags: [Sessions]
310
+ operationId: getSession
311
+ responses:
312
+ "200": { description: Session snapshot }
313
+ "404": { $ref: "#/components/responses/Error" }
314
+ /sessions/{sessionId}/events:
315
+ parameters:
316
+ - $ref: "#/components/parameters/SessionId"
317
+ get:
318
+ tags: [Sessions]
319
+ operationId: subscribeSessionEvents
320
+ parameters:
321
+ - in: header
322
+ name: Last-Event-ID
323
+ schema: { type: integer, minimum: 0 }
324
+ responses:
325
+ "200":
326
+ description: Normalized Server-Sent Events
327
+ content:
328
+ text/event-stream:
329
+ schema: { type: string }
330
+ /sessions/{sessionId}/input:
331
+ parameters:
332
+ - $ref: "#/components/parameters/SessionId"
333
+ post:
334
+ tags: [Sessions]
335
+ operationId: sendSessionInput
336
+ requestBody:
337
+ required: true
338
+ content:
339
+ application/json:
340
+ schema:
341
+ type: object
342
+ description: At least one of text or attachments must be supplied.
343
+ properties:
344
+ text: { type: string }
345
+ attachments:
346
+ type: array
347
+ maxItems: 20
348
+ description: Images and UTF-8 text files; maximum combined decoded payload is 20 MiB.
349
+ items: { $ref: "#/components/schemas/AttachmentInput" }
350
+ options: { type: object, additionalProperties: true }
351
+ responses:
352
+ "202": { description: Input accepted }
353
+ "400": { $ref: "#/components/responses/Error" }
354
+ "413": { $ref: "#/components/responses/Error" }
355
+ "415": { $ref: "#/components/responses/Error" }
356
+ /sessions/{sessionId}/commands:
357
+ parameters:
358
+ - $ref: "#/components/parameters/SessionId"
359
+ get:
360
+ tags: [Sessions]
361
+ operationId: listSessionCommands
362
+ description: Returns commands discovered from the active Claude Code runtime, including installed skills and plugins.
363
+ responses:
364
+ "200":
365
+ description: Commands supported by this session
366
+ content:
367
+ application/json:
368
+ schema:
369
+ type: object
370
+ required: [commands]
371
+ properties:
372
+ commands:
373
+ type: array
374
+ items: { $ref: "#/components/schemas/SlashCommand" }
375
+ "400": { $ref: "#/components/responses/Error" }
376
+ "404": { $ref: "#/components/responses/Error" }
377
+ /sessions/{sessionId}/attachments/{attachmentId}:
378
+ parameters:
379
+ - $ref: "#/components/parameters/SessionId"
380
+ - $ref: "#/components/parameters/AttachmentId"
381
+ get:
382
+ tags: [Sessions]
383
+ operationId: getSessionAttachment
384
+ responses:
385
+ "200":
386
+ description: Persisted image or text attachment. Text files are served as downloads with content sniffing disabled.
387
+ content:
388
+ image/jpeg: { schema: { type: string, format: binary } }
389
+ image/png: { schema: { type: string, format: binary } }
390
+ image/gif: { schema: { type: string, format: binary } }
391
+ image/webp: { schema: { type: string, format: binary } }
392
+ text/plain: { schema: { type: string } }
393
+ text/markdown: { schema: { type: string } }
394
+ application/json: { schema: { type: string } }
395
+ text/csv: { schema: { type: string } }
396
+ "404": { $ref: "#/components/responses/Error" }
397
+ /sessions/{sessionId}/permissions/{requestId}/resolve:
398
+ parameters:
399
+ - $ref: "#/components/parameters/SessionId"
400
+ - in: path
401
+ name: requestId
402
+ required: true
403
+ schema: { type: string }
404
+ post:
405
+ tags: [Sessions]
406
+ operationId: resolvePermission
407
+ requestBody:
408
+ required: true
409
+ content:
410
+ application/json:
411
+ schema:
412
+ type: object
413
+ required: [allow]
414
+ properties:
415
+ allow: { type: boolean }
416
+ message: { type: string }
417
+ responses:
418
+ "200": { description: Permission resolved }
419
+ /sessions/{sessionId}/abort:
420
+ parameters:
421
+ - $ref: "#/components/parameters/SessionId"
422
+ post:
423
+ tags: [Sessions]
424
+ operationId: abortSession
425
+ responses:
426
+ "202": { description: Abort accepted }
427
+ /sessions/{sessionId}/permission-mode:
428
+ parameters:
429
+ - $ref: "#/components/parameters/SessionId"
430
+ put:
431
+ tags: [Sessions]
432
+ operationId: setPermissionMode
433
+ requestBody:
434
+ required: true
435
+ content:
436
+ application/json:
437
+ schema:
438
+ type: object
439
+ required: [mode]
440
+ properties:
441
+ mode: { $ref: "#/components/schemas/PermissionMode" }
442
+ responses:
443
+ "200": { description: Permission mode updated }
444
+ /sessions/{sessionId}/archive:
445
+ parameters:
446
+ - $ref: "#/components/parameters/SessionId"
447
+ put:
448
+ tags: [Sessions]
449
+ operationId: archiveSession
450
+ responses:
451
+ "200":
452
+ description: Session archived
453
+ content:
454
+ application/json:
455
+ schema:
456
+ type: object
457
+ properties:
458
+ sessionId: { type: string }
459
+ archivedAt: { type: string, format: date-time }
460
+ "404": { $ref: "#/components/responses/Error" }
461
+ delete:
462
+ tags: [Sessions]
463
+ operationId: restoreSession
464
+ responses:
465
+ "204": { description: Session restored }
466
+ "404": { $ref: "#/components/responses/Error" }
467
+ /sessions/{sessionId}/context-usage:
468
+ parameters:
469
+ - $ref: "#/components/parameters/SessionId"
470
+ get:
471
+ tags: [Sessions]
472
+ operationId: getSessionContextUsage
473
+ description: Approximate context occupancy for the capacity indicator.
474
+ responses:
475
+ "200":
476
+ description: Context usage snapshot
477
+ content:
478
+ application/json:
479
+ schema:
480
+ type: object
481
+ properties:
482
+ sessionId: { type: string }
483
+ agentId: { type: string }
484
+ model: { type: [string, "null"] }
485
+ contextWindow: { type: integer }
486
+ used: { type: integer }
487
+ percent: { type: [number, "null"] }
488
+ inputTokens: { type: integer }
489
+ outputTokens: { type: integer }
490
+ breakdown:
491
+ type: object
492
+ properties:
493
+ messages: { type: integer }
494
+ tools: { type: integer }
495
+ other: { type: integer }
496
+ estimated: { type: boolean }
497
+ "404": { $ref: "#/components/responses/Error" }
498
+ components:
499
+ parameters:
500
+ ProfileId:
501
+ in: path
502
+ name: profileId
503
+ required: true
504
+ schema: { type: string, pattern: "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$" }
505
+ SessionId:
506
+ in: path
507
+ name: sessionId
508
+ required: true
509
+ schema: { type: string }
510
+ AttachmentId:
511
+ in: path
512
+ name: attachmentId
513
+ required: true
514
+ schema: { type: string }
515
+ ProjectId:
516
+ in: path
517
+ name: projectId
518
+ required: true
519
+ schema: { type: string, pattern: "^prj-[a-zA-Z0-9._:-]+$" }
520
+ responses:
521
+ Error:
522
+ description: Request failed
523
+ content:
524
+ application/json:
525
+ schema: { $ref: "#/components/schemas/ErrorResponse" }
526
+ schemas:
527
+ PermissionMode:
528
+ type: string
529
+ enum: [default, acceptEdits, plan, bypassPermissions]
530
+ AgentInfo:
531
+ type: object
532
+ required: [id, label, transport, authModes, capabilities, available]
533
+ properties:
534
+ id: { type: string, enum: [claude-code, codex, opencode, zcode] }
535
+ label: { type: string }
536
+ transport: { type: string }
537
+ authModes: { type: array, items: { type: string } }
538
+ available: { type: boolean }
539
+ version: { type: [string, "null"] }
540
+ capabilities:
541
+ type: object
542
+ required: [thinking, permissions, toolStream, images, resume, modelOverride, generationParams]
543
+ properties:
544
+ thinking: { type: boolean }
545
+ permissions: { type: boolean }
546
+ toolStream: { type: boolean }
547
+ images: { type: boolean }
548
+ resume: { type: boolean }
549
+ modelOverride: { type: boolean }
550
+ generationParams: { type: array, items: { type: string } }
551
+ Project:
552
+ type: object
553
+ required: [id, name, rootPath, createdAt, updatedAt]
554
+ properties:
555
+ id: { type: string }
556
+ name: { type: string }
557
+ rootPath: { type: string, description: Absolute local directory that must exist }
558
+ createdAt: { type: string, format: date-time }
559
+ updatedAt: { type: string, format: date-time }
560
+ defaultAiProfileId: { type: [string, "null"] }
561
+ defaultModel: { type: [string, "null"] }
562
+ defaultAgentId: { type: string, enum: [claude-code, codex, opencode, zcode] }
563
+ ProjectInput:
564
+ type: object
565
+ required: [name, rootPath]
566
+ properties:
567
+ name: { type: string, minLength: 1, maxLength: 128 }
568
+ rootPath: { type: string, minLength: 1 }
569
+ defaultAiProfileId: { type: [string, "null"] }
570
+ defaultModel: { type: [string, "null"] }
571
+ defaultAgentId: { type: string, enum: [claude-code, codex, opencode, zcode] }
572
+ WorkbenchContext:
573
+ type: object
574
+ required: [contextId]
575
+ properties:
576
+ contextId: { type: string }
577
+ contextType: { type: string }
578
+ displayName: { type: string }
579
+ workspaceRef: { type: string }
580
+ aiProfileId: { type: [string, "null"] }
581
+ model: { type: [string, "null"] }
582
+ metadata: { type: object, additionalProperties: true }
583
+ AiProfileModels:
584
+ type: object
585
+ required: [default]
586
+ properties:
587
+ default: { type: string, minLength: 1 }
588
+ fast: { type: string }
589
+ reasoning: { type: string }
590
+ coding: { type: string }
591
+ largeContext: { type: string }
592
+ list:
593
+ type: array
594
+ maxItems: 100
595
+ items: { $ref: "#/components/schemas/ModelListEntry" }
596
+ additionalProperties: { type: string }
597
+ ModelListEntry:
598
+ type: object
599
+ required: [id]
600
+ properties:
601
+ id: { type: string, minLength: 1, maxLength: 128 }
602
+ openaiId: { type: string, maxLength: 128, description: "OpenAI protocol model id; defaults to id with a trailing '[1m]' removed." }
603
+ label: { type: string, maxLength: 128 }
604
+ tags: { type: array, maxItems: 8, items: { type: string, maxLength: 32 } }
605
+ AiProfileInput:
606
+ type: object
607
+ required: [id, provider, baseUrl, models]
608
+ properties:
609
+ id: { type: string }
610
+ name: { type: string }
611
+ provider: { type: string }
612
+ runtime: { type: string, const: claude-code }
613
+ protocol: { type: string, default: anthropic-compatible }
614
+ baseUrl: { type: string, format: uri }
615
+ openaiBaseUrl:
616
+ type: string
617
+ description: OpenAI-compatible endpoint used by Codex and OpenCode. MiniMax China defaults to https://api.minimaxi.com/v1; MiniMax global defaults to https://api.minimax.io/v1.
618
+ credentialRef: { type: string }
619
+ models: { $ref: "#/components/schemas/AiProfileModels" }
620
+ contextWindow: { type: integer, minimum: 1, default: 200000 }
621
+ timeoutMs: { type: integer, minimum: 1, default: 300000 }
622
+ permissionMode: { $ref: "#/components/schemas/PermissionMode" }
623
+ systemPrompt: { type: object, additionalProperties: true }
624
+ enabled: { type: boolean, default: true }
625
+ AiProfile:
626
+ allOf:
627
+ - $ref: "#/components/schemas/AiProfileInput"
628
+ - type: object
629
+ required: [name, runtime, protocol, credentialRef, credentialConfigured, enabled]
630
+ properties:
631
+ credentialConfigured: { type: boolean, readOnly: true }
632
+ credentialMasked:
633
+ type: string
634
+ readOnly: true
635
+ description: Masked preview only; never the plaintext secret.
636
+ ProfileTestResult:
637
+ type: object
638
+ required: [ok, runtime, runtimeVerified, profileId, model, firstEventMs, durationMs, resultPreview]
639
+ properties:
640
+ ok: { type: boolean, const: true }
641
+ runtime: { type: string, const: claude-code }
642
+ runtimeVerified: { type: boolean, const: true }
643
+ profileId: { type: string }
644
+ model: { type: string }
645
+ firstEventMs: { type: integer, minimum: 0 }
646
+ durationMs: { type: integer, minimum: 0 }
647
+ resultPreview: { type: string }
648
+ Health:
649
+ type: object
650
+ required: [status, version, apiVersion, activeProcesses, sessions, time]
651
+ properties:
652
+ status: { type: string, const: ok }
653
+ version: { type: string }
654
+ apiVersion: { type: string }
655
+ activeProcesses: { type: integer }
656
+ sessions: { type: integer }
657
+ time: { type: string, format: date-time }
658
+ RuntimeInfo:
659
+ type: object
660
+ required: [runtime, available, transport]
661
+ properties:
662
+ runtime: { type: string, const: claude-code }
663
+ available: { type: boolean }
664
+ executable: { type: [string, "null"] }
665
+ transport: { type: string }
666
+ SessionSummary:
667
+ type: object
668
+ required: [sessionId, contextId, state]
669
+ properties:
670
+ sessionId: { type: string }
671
+ contextId: { type: string }
672
+ projectId: { type: string }
673
+ agentId: { type: string, enum: [claude-code, codex, opencode, zcode] }
674
+ title: { type: string }
675
+ active: { type: boolean }
676
+ state: { type: string }
677
+ model: { type: [string, "null"] }
678
+ aiProfileId: { type: [string, "null"] }
679
+ providerName: { type: [string, "null"] }
680
+ authSource: { type: string, enum: [profile-injected, agent-owned] }
681
+ selectedModel: { type: [string, "null"] }
682
+ archived: { type: boolean }
683
+ permissionMode: { $ref: "#/components/schemas/PermissionMode" }
684
+ turns: { type: integer }
685
+ startedAt: { type: string }
686
+ updatedAt: { type: string }
687
+ connectionState: { type: string }
688
+ AttachmentInput:
689
+ oneOf:
690
+ - $ref: "#/components/schemas/ImageAttachmentInput"
691
+ - $ref: "#/components/schemas/TextAttachmentInput"
692
+ TextAttachmentInput:
693
+ type: object
694
+ required: [name, mediaType, data]
695
+ properties:
696
+ id: { type: string }
697
+ name:
698
+ type: string
699
+ pattern: '\.([tT][xX][tT]|[mM][dD]|[jJ][sS][oO][nN]|[cC][sS][vV])$'
700
+ description: File name with a supported text extension (case-insensitive).
701
+ mediaType: { type: string, enum: [text/plain, text/markdown, application/json, text/csv] }
702
+ data:
703
+ type: string
704
+ format: byte
705
+ description: Base64-encoded UTF-8 text, at most 512 KiB decoded. Text is included in the agent prompt inside attachment boundary blocks. Events expose metadata and a URL only.
706
+ size: { type: integer, minimum: 1, maximum: 524288 }
707
+ Attachment:
708
+ type: object
709
+ required: [id, name, mediaType, size, url]
710
+ properties:
711
+ id: { type: string }
712
+ name: { type: string }
713
+ mediaType: { type: string, enum: [image/jpeg, image/png, image/gif, image/webp, text/plain, text/markdown, application/json, text/csv] }
714
+ size: { type: integer }
715
+ width: { type: integer }
716
+ height: { type: integer }
717
+ url: { type: string }
718
+ ImageAttachmentInput:
719
+ type: object
720
+ required: [name, mediaType, data]
721
+ properties:
722
+ id: { type: string }
723
+ name: { type: string, minLength: 1 }
724
+ mediaType:
725
+ type: string
726
+ enum: [image/jpeg, image/png, image/gif, image/webp]
727
+ data:
728
+ type: string
729
+ format: byte
730
+ description: Base64-encoded image data. Each decoded image is limited to 10 MiB.
731
+ size: { type: integer, minimum: 1, maximum: 10485760 }
732
+ width: { type: integer, minimum: 1 }
733
+ height: { type: integer, minimum: 1 }
734
+ ImageAttachment:
735
+ type: object
736
+ required: [id, name, mediaType, size, url]
737
+ properties:
738
+ id: { type: string }
739
+ name: { type: string }
740
+ mediaType: { type: string }
741
+ size: { type: integer }
742
+ width: { type: integer }
743
+ height: { type: integer }
744
+ url: { type: string }
745
+ SlashCommand:
746
+ type: object
747
+ required: [name]
748
+ properties:
749
+ name: { type: string }
750
+ description: { type: string }
751
+ argumentHint: { type: string }
752
+ aliases:
753
+ type: array
754
+ items: { type: string }
755
+ ErrorResponse:
756
+ type: object
757
+ required: [ok, error]
758
+ properties:
759
+ ok: { type: boolean, const: false }
760
+ error: { type: string }