@agentuity/core 2.0.10 → 2.0.12

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 (110) hide show
  1. package/dist/services/api.d.ts +1 -1
  2. package/dist/services/api.d.ts.map +1 -1
  3. package/dist/services/api.js +4 -6
  4. package/dist/services/api.js.map +1 -1
  5. package/dist/services/coder/agents.d.ts +172 -0
  6. package/dist/services/coder/agents.d.ts.map +1 -0
  7. package/dist/services/coder/agents.js +77 -0
  8. package/dist/services/coder/agents.js.map +1 -0
  9. package/dist/services/coder/api-reference.d.ts.map +1 -1
  10. package/dist/services/coder/api-reference.js +459 -39
  11. package/dist/services/coder/api-reference.js.map +1 -1
  12. package/dist/services/coder/client.d.ts +47 -1
  13. package/dist/services/coder/client.d.ts.map +1 -1
  14. package/dist/services/coder/client.js +94 -1
  15. package/dist/services/coder/client.js.map +1 -1
  16. package/dist/services/coder/close-codes.d.ts +76 -0
  17. package/dist/services/coder/close-codes.d.ts.map +1 -0
  18. package/dist/services/coder/close-codes.js +77 -0
  19. package/dist/services/coder/close-codes.js.map +1 -0
  20. package/dist/services/coder/index.d.ts +10 -3
  21. package/dist/services/coder/index.d.ts.map +1 -1
  22. package/dist/services/coder/index.js +6 -1
  23. package/dist/services/coder/index.js.map +1 -1
  24. package/dist/services/coder/protocol.d.ts +2225 -0
  25. package/dist/services/coder/protocol.d.ts.map +1 -0
  26. package/dist/services/coder/protocol.js +1122 -0
  27. package/dist/services/coder/protocol.js.map +1 -0
  28. package/dist/services/coder/sessions.d.ts +31 -0
  29. package/dist/services/coder/sessions.d.ts.map +1 -1
  30. package/dist/services/coder/sessions.js +40 -7
  31. package/dist/services/coder/sessions.js.map +1 -1
  32. package/dist/services/coder/sse.d.ts +255 -0
  33. package/dist/services/coder/sse.d.ts.map +1 -0
  34. package/dist/services/coder/sse.js +788 -0
  35. package/dist/services/coder/sse.js.map +1 -0
  36. package/dist/services/coder/types.d.ts +1578 -0
  37. package/dist/services/coder/types.d.ts.map +1 -1
  38. package/dist/services/coder/types.js +377 -1
  39. package/dist/services/coder/types.js.map +1 -1
  40. package/dist/services/coder/websocket.d.ts +358 -0
  41. package/dist/services/coder/websocket.d.ts.map +1 -0
  42. package/dist/services/coder/websocket.js +863 -0
  43. package/dist/services/coder/websocket.js.map +1 -0
  44. package/dist/services/oauth/types.d.ts +10 -0
  45. package/dist/services/oauth/types.d.ts.map +1 -1
  46. package/dist/services/oauth/types.js +3 -0
  47. package/dist/services/oauth/types.js.map +1 -1
  48. package/dist/services/project/deploy.d.ts +1 -1
  49. package/dist/services/sandbox/api-reference.js +7 -7
  50. package/dist/services/sandbox/api-reference.js.map +1 -1
  51. package/dist/services/sandbox/client.d.ts +3 -2
  52. package/dist/services/sandbox/client.d.ts.map +1 -1
  53. package/dist/services/sandbox/client.js.map +1 -1
  54. package/dist/services/sandbox/create.d.ts +5 -0
  55. package/dist/services/sandbox/create.d.ts.map +1 -1
  56. package/dist/services/sandbox/create.js +8 -0
  57. package/dist/services/sandbox/create.js.map +1 -1
  58. package/dist/services/sandbox/get.d.ts +8 -4
  59. package/dist/services/sandbox/get.d.ts.map +1 -1
  60. package/dist/services/sandbox/get.js +28 -3
  61. package/dist/services/sandbox/get.js.map +1 -1
  62. package/dist/services/sandbox/getStatus.d.ts +2 -0
  63. package/dist/services/sandbox/getStatus.d.ts.map +1 -1
  64. package/dist/services/sandbox/getStatus.js +17 -1
  65. package/dist/services/sandbox/getStatus.js.map +1 -1
  66. package/dist/services/sandbox/index.d.ts +1 -1
  67. package/dist/services/sandbox/index.d.ts.map +1 -1
  68. package/dist/services/sandbox/list.d.ts +3 -0
  69. package/dist/services/sandbox/list.d.ts.map +1 -1
  70. package/dist/services/sandbox/list.js +5 -0
  71. package/dist/services/sandbox/list.js.map +1 -1
  72. package/dist/services/sandbox/pause.d.ts +17 -1
  73. package/dist/services/sandbox/pause.d.ts.map +1 -1
  74. package/dist/services/sandbox/pause.js +21 -3
  75. package/dist/services/sandbox/pause.js.map +1 -1
  76. package/dist/services/sandbox/run.d.ts +3 -2
  77. package/dist/services/sandbox/run.d.ts.map +1 -1
  78. package/dist/services/sandbox/run.js +145 -85
  79. package/dist/services/sandbox/run.js.map +1 -1
  80. package/dist/services/sandbox/types.d.ts +10 -4
  81. package/dist/services/sandbox/types.d.ts.map +1 -1
  82. package/dist/services/sandbox/types.js +10 -0
  83. package/dist/services/sandbox/types.js.map +1 -1
  84. package/dist/services/stream/namespaces.d.ts +2 -2
  85. package/dist/services/stream/namespaces.js +2 -2
  86. package/dist/services/stream/namespaces.js.map +1 -1
  87. package/package.json +2 -2
  88. package/src/services/api.ts +6 -7
  89. package/src/services/coder/agents.ts +148 -0
  90. package/src/services/coder/api-reference.ts +479 -43
  91. package/src/services/coder/client.ts +143 -0
  92. package/src/services/coder/close-codes.ts +83 -0
  93. package/src/services/coder/index.ts +32 -1
  94. package/src/services/coder/protocol.ts +1364 -0
  95. package/src/services/coder/sessions.ts +66 -10
  96. package/src/services/coder/sse.ts +955 -0
  97. package/src/services/coder/types.ts +462 -1
  98. package/src/services/coder/websocket.ts +1042 -0
  99. package/src/services/oauth/types.ts +3 -0
  100. package/src/services/sandbox/api-reference.ts +7 -7
  101. package/src/services/sandbox/client.ts +4 -4
  102. package/src/services/sandbox/create.ts +10 -0
  103. package/src/services/sandbox/get.ts +32 -3
  104. package/src/services/sandbox/getStatus.ts +20 -1
  105. package/src/services/sandbox/index.ts +1 -1
  106. package/src/services/sandbox/list.ts +5 -0
  107. package/src/services/sandbox/pause.ts +38 -4
  108. package/src/services/sandbox/run.ts +202 -108
  109. package/src/services/sandbox/types.ts +15 -2
  110. package/src/services/stream/namespaces.ts +2 -2
@@ -1,19 +1,106 @@
1
- import { CoderCreateSessionRequestSchema, CoderLoopStateResponseSchema } from './types.ts';
1
+ import { z } from 'zod/v4';
2
2
  import {
3
- CoderCreateSessionParamsSchema,
4
- CoderListConnectableSessionsParamsSchema,
5
- CoderListSessionsParamsWithOrgSchema,
6
- CoderSessionIdParamsSchema,
7
- } from './sessions.ts';
8
- import { CoderSessionDataQuerySchema } from './types.ts';
9
- import { CoderListUsersParamsWithOrgSchema } from './users.ts';
3
+ CoderCreateAgentBuilderSessionRequestSchema,
4
+ CoderCreateCustomAgentRequestSchema,
5
+ CoderCreateSessionRequestSchema,
6
+ CoderCustomAgentListResponseSchema,
7
+ CoderCustomAgentVersionListResponseSchema,
8
+ CoderListUsersResponseSchema,
9
+ CoderLoopStateResponseSchema,
10
+ CoderSessionEventSchema,
11
+ CoderSessionListItemSchema,
12
+ CoderSessionParticipantsSchema,
13
+ CoderSessionSchema,
14
+ CoderUpdateCustomAgentRequestSchema,
15
+ CoderUpdateSessionRequestSchema,
16
+ } from './types.ts';
17
+ import { CoderCreateSessionParamsSchema, CoderLifecycleResponseSchema } from './sessions.ts';
10
18
  import type { Service } from '../api-reference.ts';
11
19
 
20
+ // Docs-only wire schemas: the REST reference documents raw hub payloads,
21
+ // while the public Coder client continues to use the schemas from ./types.ts.
22
+ const CoderHubSessionListWireSchema = z.object({
23
+ sessions: z
24
+ .object({
25
+ websocket: z
26
+ .array(CoderSessionListItemSchema)
27
+ .describe('Websocket-backed sessions returned by the hub'),
28
+ sandbox: z
29
+ .array(z.unknown())
30
+ .describe('Non-websocket session entries returned by the hub'),
31
+ })
32
+ .describe('Sessions grouped by transport'),
33
+ total: z.number().describe('Total sessions matching the query'),
34
+ });
35
+
36
+ const CoderSessionReplayWireSchema = z.object({
37
+ sessionId: z.string().describe('Session identifier for replay payload'),
38
+ entriesSource: z
39
+ .enum(['durable_stream', 'session_entries', 'event_history', 'none'])
40
+ .describe('Source used to reconstruct replay entries'),
41
+ sourceCounts: z
42
+ .object({
43
+ durableStream: z.number().describe('Replay entries loaded from durable stream storage'),
44
+ sessionEntries: z.number().describe('Replay entries loaded from session entry storage'),
45
+ eventHistory: z.number().describe('Replay entries synthesized from event history'),
46
+ })
47
+ .optional()
48
+ .describe('Counts of replay entries by source'),
49
+ entries: z.array(z.unknown()).describe('Replay conversation entries for the session'),
50
+ });
51
+
52
+ const CoderSessionEventHistoryWireSchema = z.object({
53
+ sessionId: z.string().describe('Session identifier for event history payload'),
54
+ events: z.array(CoderSessionEventSchema).describe('Event history items for the session'),
55
+ });
56
+
57
+ const CoderCreateSessionResponseWireSchema = z
58
+ .object({
59
+ sessionId: z.string().describe('Created session identifier'),
60
+ sandboxId: z.string().nullable().optional().describe('Associated sandbox identifier'),
61
+ status: z.string().describe('Initial session status'),
62
+ mode: z.string().optional().describe('Session mode'),
63
+ visibility: z.string().optional().describe('Session visibility'),
64
+ })
65
+ .passthrough();
66
+
67
+ const CoderUpdateSessionRequestWireSchema = CoderUpdateSessionRequestSchema.pick({
68
+ label: true,
69
+ agent: true,
70
+ defaultAgent: true,
71
+ enabledAgents: true,
72
+ visibility: true,
73
+ tags: true,
74
+ skills: true,
75
+ metadata: true,
76
+ })
77
+ .extend({
78
+ savedSkillIds: z.array(z.string()).optional().describe('Updated saved skill ids'),
79
+ skillBucketIds: z.array(z.string()).optional().describe('Updated skill bucket ids'),
80
+ })
81
+ .describe('Request body for updating public session metadata over REST');
82
+
83
+ const CoderUpdateSessionResponseWireSchema = z
84
+ .object({
85
+ sessionId: z.string().describe('Updated session identifier'),
86
+ label: z.string().optional().describe('Updated label'),
87
+ visibility: z.string().optional().describe('Updated visibility'),
88
+ tags: z.array(z.string()).optional().describe('Updated tags'),
89
+ skills: z.array(z.unknown()).optional().describe('Updated skills'),
90
+ defaultAgent: z.string().nullable().optional().describe('Updated default agent'),
91
+ enabledAgents: z.array(z.string()).optional().describe('Updated enabled agents'),
92
+ metadata: z
93
+ .record(z.string(), z.unknown())
94
+ .optional()
95
+ .describe('Updated arbitrary metadata associated with the session'),
96
+ })
97
+ .passthrough();
98
+
12
99
  const service: Service = {
13
100
  name: 'Coder',
14
101
  slug: 'coder',
15
102
  description:
16
- 'Manage Coder sessions, session data, loop state, and known users through the HTTP API',
103
+ 'Manage Coder sessions, custom agents, session data, loop state, and known users through the REST API',
17
104
  hasPublicEndpoints: false,
18
105
  endpoints: [
19
106
  {
@@ -51,13 +138,44 @@ const service: Service = {
51
138
  fields: { schema: CoderCreateSessionRequestSchema },
52
139
  },
53
140
  responseDescription: 'Returns the created session.',
141
+ responseFields: { schema: CoderCreateSessionResponseWireSchema, stripRequired: true },
54
142
  statuses: [
55
- { code: 200, description: 'Session created' },
143
+ { code: 201, description: 'Session created' },
56
144
  { code: 401, description: 'Unauthorized — invalid or missing API key' },
57
145
  ],
58
146
  examplePath: '/hub/session',
59
147
  exampleBody: { task: 'Implement feature X', workflowMode: 'standard' },
60
148
  },
149
+ {
150
+ id: 'create-agent-builder-session',
151
+ title: 'Create Agent Builder Session',
152
+ sectionTitle: 'Sessions',
153
+ method: 'POST',
154
+ path: '/hub/session/builder',
155
+ description:
156
+ 'Creates a dedicated Lead + agent-builder session for designing, editing, or publishing a custom agent.',
157
+ pathParams: [],
158
+ queryParams: CoderCreateSessionParamsSchema.shape.orgId
159
+ ? [{ name: 'orgId', type: 'string', description: 'Organization ID', required: false }]
160
+ : [],
161
+ requestBody: {
162
+ description: 'Agent-builder launch payload.',
163
+ fields: { schema: CoderCreateAgentBuilderSessionRequestSchema },
164
+ },
165
+ responseDescription: 'Returns the created builder session.',
166
+ responseFields: { schema: CoderCreateSessionResponseWireSchema, stripRequired: true },
167
+ statuses: [
168
+ { code: 201, description: 'Builder session created' },
169
+ { code: 404, description: 'Source session or target agent not found' },
170
+ ],
171
+ examplePath: '/hub/session/builder',
172
+ exampleBody: {
173
+ mode: 'from_session',
174
+ sourceSessionId: 'codesess_123',
175
+ label: 'Build from release triage',
176
+ prompt: 'Turn the repeated release-triage workflow into a reusable QA agent',
177
+ },
178
+ },
61
179
  {
62
180
  id: 'list-sessions',
63
181
  title: 'List Sessions',
@@ -80,13 +198,127 @@ const service: Service = {
80
198
  ],
81
199
  requestBody: null,
82
200
  responseDescription: 'Returns a session list.',
83
- responseFields: { schema: CoderListSessionsParamsWithOrgSchema, stripRequired: true },
201
+ responseFields: { schema: CoderHubSessionListWireSchema, stripRequired: true },
84
202
  statuses: [
85
203
  { code: 200, description: 'Sessions returned' },
86
204
  { code: 401, description: 'Unauthorized — invalid or missing API key' },
87
205
  ],
88
206
  examplePath: '/hub/sessions?limit=20&offset=0',
89
207
  },
208
+ {
209
+ id: 'get-session',
210
+ title: 'Get Session',
211
+ sectionTitle: 'Sessions',
212
+ method: 'GET',
213
+ path: '/hub/session/{sessionId}',
214
+ description: 'Retrieve a single coder session by ID.',
215
+ pathParams: [
216
+ { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
217
+ ],
218
+ queryParams: [
219
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
220
+ ],
221
+ requestBody: null,
222
+ responseDescription: 'Returns the full session object.',
223
+ responseFields: { schema: CoderSessionSchema, stripRequired: true },
224
+ statuses: [
225
+ { code: 200, description: 'Session returned' },
226
+ { code: 404, description: 'Session not found' },
227
+ ],
228
+ examplePath: '/hub/session/sess_123',
229
+ },
230
+ {
231
+ id: 'update-session',
232
+ title: 'Update Session',
233
+ sectionTitle: 'Sessions',
234
+ method: 'PATCH',
235
+ path: '/hub/session/{sessionId}',
236
+ description: 'Update an existing session.',
237
+ pathParams: [
238
+ { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
239
+ ],
240
+ queryParams: [
241
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
242
+ ],
243
+ requestBody: {
244
+ description: 'Session update payload.',
245
+ fields: { schema: CoderUpdateSessionRequestWireSchema },
246
+ },
247
+ responseDescription: 'Returns the updated session fields.',
248
+ responseFields: { schema: CoderUpdateSessionResponseWireSchema, stripRequired: true },
249
+ statuses: [
250
+ { code: 200, description: 'Session updated' },
251
+ { code: 404, description: 'Session not found' },
252
+ ],
253
+ examplePath: '/hub/session/sess_123',
254
+ exampleBody: { label: 'Updated Session', tags: ['auth', 'phase-2'] },
255
+ },
256
+ {
257
+ id: 'archive-session',
258
+ title: 'Archive Session',
259
+ sectionTitle: 'Sessions',
260
+ method: 'POST',
261
+ path: '/hub/session/{sessionId}/archive',
262
+ description: 'Archives an existing session.',
263
+ pathParams: [
264
+ { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
265
+ ],
266
+ queryParams: [
267
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
268
+ ],
269
+ requestBody: null,
270
+ responseDescription: 'Returns the session identifier and optional updated status.',
271
+ responseFields: { schema: CoderLifecycleResponseSchema, stripRequired: true },
272
+ statuses: [
273
+ { code: 200, description: 'Lifecycle action applied' },
274
+ { code: 404, description: 'Session not found' },
275
+ ],
276
+ examplePath: '/hub/session/sess_123/archive',
277
+ },
278
+ {
279
+ id: 'resume-session',
280
+ title: 'Resume Session',
281
+ sectionTitle: 'Sessions',
282
+ method: 'POST',
283
+ path: '/hub/session/{sessionId}/resume',
284
+ description: 'Resumes a paused session.',
285
+ pathParams: [
286
+ { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
287
+ ],
288
+ queryParams: [
289
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
290
+ ],
291
+ requestBody: null,
292
+ responseDescription: 'Returns the session identifier and optional updated status.',
293
+ responseFields: { schema: CoderLifecycleResponseSchema, stripRequired: true },
294
+ statuses: [
295
+ { code: 200, description: 'Session resume initiated' },
296
+ { code: 404, description: 'Session not found' },
297
+ ],
298
+ examplePath: '/hub/session/sess_123/resume',
299
+ },
300
+ {
301
+ id: 'delete-session',
302
+ title: 'Delete Session',
303
+ sectionTitle: 'Sessions',
304
+ method: 'DELETE',
305
+ path: '/hub/session/{sessionId}',
306
+ description: 'Permanently deletes a session.',
307
+ pathParams: [
308
+ { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
309
+ ],
310
+ queryParams: [
311
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
312
+ ],
313
+ requestBody: null,
314
+ responseDescription: 'Returns the deleted session identifier and status.',
315
+ responseFields: { schema: CoderLifecycleResponseSchema, stripRequired: true },
316
+ statuses: [
317
+ { code: 200, description: 'Session deleted' },
318
+ { code: 404, description: 'Session not found' },
319
+ ],
320
+ examplePath: '/hub/session/sess_123',
321
+ },
90
322
  {
91
323
  id: 'get-loop-state',
92
324
  title: 'Get Loop State',
@@ -125,7 +357,7 @@ const service: Service = {
125
357
  ],
126
358
  requestBody: null,
127
359
  responseDescription: 'Returns known users.',
128
- responseFields: { schema: CoderListUsersParamsWithOrgSchema, stripRequired: true },
360
+ responseFields: { schema: CoderListUsersResponseSchema, stripRequired: true },
129
361
  statuses: [
130
362
  { code: 200, description: 'Users returned' },
131
363
  { code: 401, description: 'Unauthorized — invalid or missing API key' },
@@ -133,73 +365,277 @@ const service: Service = {
133
365
  examplePath: '/hub/users?search=jane',
134
366
  },
135
367
  {
136
- id: 'session-data',
137
- title: 'Session Data Endpoints',
368
+ id: 'get-session-replay',
369
+ title: 'Get Session Replay',
138
370
  sectionTitle: 'Session Data',
139
371
  method: 'GET',
140
- path: '/hub/session/{sessionId}/(replay|participants|events/history)',
141
- description: 'Retrieve replay, participant list, or historical events for a session.',
372
+ path: '/hub/session/{sessionId}/replay',
373
+ description: 'Retrieve replay data for a session.',
142
374
  pathParams: [
143
375
  { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
144
376
  ],
145
377
  queryParams: [
146
- { name: 'limit', type: 'number', description: 'Maximum records', required: false },
147
- { name: 'offset', type: 'number', description: 'Pagination offset', required: false },
148
378
  { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
149
379
  ],
150
380
  requestBody: null,
151
- responseDescription: 'Returns the requested session data payload.',
152
- responseFields: { schema: CoderSessionDataQuerySchema, stripRequired: true },
381
+ responseDescription: 'Returns replay data for the session.',
382
+ responseFields: { schema: CoderSessionReplayWireSchema, stripRequired: true },
153
383
  statuses: [
154
- { code: 200, description: 'Session data returned' },
384
+ { code: 200, description: 'Replay returned' },
155
385
  { code: 404, description: 'Session not found' },
156
386
  ],
157
387
  examplePath: '/hub/session/sess_123/replay',
158
388
  },
159
389
  {
160
- id: 'session-lifecycle',
161
- title: 'Session Lifecycle Endpoints',
162
- sectionTitle: 'Sessions',
163
- method: 'POST',
164
- path: '/hub/session/{sessionId}/archive',
165
- description: 'Archives an existing session.',
390
+ id: 'list-session-participants',
391
+ title: 'List Session Participants',
392
+ sectionTitle: 'Session Data',
393
+ method: 'GET',
394
+ path: '/hub/session/{sessionId}/participants',
395
+ description: 'Retrieve participants for a session.',
166
396
  pathParams: [
167
397
  { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
168
398
  ],
169
399
  queryParams: [
400
+ { name: 'limit', type: 'number', description: 'Maximum records', required: false },
401
+ {
402
+ name: 'includeDisconnected',
403
+ type: 'boolean',
404
+ description: 'Include disconnected participants',
405
+ required: false,
406
+ },
170
407
  { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
171
408
  ],
172
409
  requestBody: null,
173
- responseDescription: 'Returns success and optionally updated session payload.',
174
- responseFields: { schema: CoderSessionIdParamsSchema, stripRequired: true },
410
+ responseDescription: 'Returns participants for the session.',
411
+ responseFields: { schema: CoderSessionParticipantsSchema, stripRequired: true },
175
412
  statuses: [
176
- { code: 200, description: 'Lifecycle action applied' },
413
+ { code: 200, description: 'Participants returned' },
177
414
  { code: 404, description: 'Session not found' },
178
415
  ],
179
- examplePath: '/hub/session/sess_123/archive',
416
+ examplePath: '/hub/session/sess_123/participants?limit=200&includeDisconnected=true',
180
417
  },
181
418
  {
182
- id: 'connectable-sessions',
183
- title: 'List Connectable Sessions',
184
- sectionTitle: 'Sessions',
419
+ id: 'list-session-event-history',
420
+ title: 'List Session Event History',
421
+ sectionTitle: 'Session Data',
185
422
  method: 'GET',
186
- path: '/hub/sessions/connectable',
187
- description: 'Lists sessions the authenticated user can connect to.',
423
+ path: '/hub/session/{sessionId}/events/history',
424
+ description: 'Retrieve historical events for a session.',
425
+ pathParams: [
426
+ { name: 'sessionId', type: 'string', description: 'Session ID', required: true },
427
+ ],
428
+ queryParams: [
429
+ { name: 'limit', type: 'number', description: 'Maximum records', required: false },
430
+ {
431
+ name: 'beforeId',
432
+ type: 'number',
433
+ description: 'Return events before the given event identifier',
434
+ required: false,
435
+ },
436
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
437
+ ],
438
+ requestBody: null,
439
+ responseDescription: 'Returns session event history.',
440
+ responseFields: { schema: CoderSessionEventHistoryWireSchema, stripRequired: true },
441
+ statuses: [
442
+ { code: 200, description: 'Event history returned' },
443
+ { code: 404, description: 'Session not found' },
444
+ ],
445
+ examplePath: '/hub/session/sess_123/events/history?limit=50&beforeId=1234',
446
+ },
447
+ {
448
+ id: 'list-custom-agents',
449
+ title: 'List Custom Agents',
450
+ sectionTitle: 'Agents',
451
+ method: 'GET',
452
+ path: '/hub/agents',
453
+ description: 'Lists custom agents visible to the caller.',
188
454
  pathParams: [],
189
455
  queryParams: [
190
- { name: 'search', type: 'string', description: 'Search query', required: false },
191
- { name: 'limit', type: 'number', description: 'Maximum results', required: false },
192
- { name: 'offset', type: 'number', description: 'Pagination offset', required: false },
456
+ {
457
+ name: 'includeArchived',
458
+ type: 'boolean',
459
+ description: 'Include archived custom agents',
460
+ required: false,
461
+ },
193
462
  { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
194
463
  ],
195
464
  requestBody: null,
196
- responseDescription: 'Returns connectable sessions.',
197
- responseFields: { schema: CoderListConnectableSessionsParamsSchema, stripRequired: true },
465
+ responseDescription: 'Returns custom agents visible to the caller.',
466
+ responseFields: { schema: CoderCustomAgentListResponseSchema, stripRequired: true },
198
467
  statuses: [
199
- { code: 200, description: 'Connectable sessions returned' },
468
+ { code: 200, description: 'Custom agents returned' },
200
469
  { code: 401, description: 'Unauthorized — invalid or missing API key' },
201
470
  ],
202
- examplePath: '/hub/sessions/connectable',
471
+ examplePath: '/hub/agents?includeArchived=true',
472
+ },
473
+ {
474
+ id: 'create-custom-agent',
475
+ title: 'Create Custom Agent',
476
+ sectionTitle: 'Agents',
477
+ method: 'POST',
478
+ path: '/hub/agents',
479
+ description: 'Creates a new custom-agent draft.',
480
+ pathParams: [],
481
+ queryParams: [
482
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
483
+ ],
484
+ requestBody: {
485
+ description: 'Custom-agent creation payload.',
486
+ fields: { schema: CoderCreateCustomAgentRequestSchema },
487
+ },
488
+ responseDescription: 'Returns the created custom agent.',
489
+ statuses: [
490
+ { code: 201, description: 'Custom agent created' },
491
+ { code: 401, description: 'Unauthorized — invalid or missing API key' },
492
+ ],
493
+ examplePath: '/hub/agents',
494
+ exampleBody: {
495
+ slug: 'code-review',
496
+ displayName: 'Code Review',
497
+ instructions: 'Focus on correctness, regressions, and missing tests.',
498
+ tools: ['read', 'grep', 'ls'],
499
+ serviceTools: ['session_todo_list', 'session_todo_update'],
500
+ },
501
+ },
502
+ {
503
+ id: 'get-custom-agent',
504
+ title: 'Get Custom Agent',
505
+ sectionTitle: 'Agents',
506
+ method: 'GET',
507
+ path: '/hub/agents/{agentIdOrSlug}',
508
+ description: 'Fetches a custom agent by id or slug.',
509
+ pathParams: [
510
+ {
511
+ name: 'agentIdOrSlug',
512
+ type: 'string',
513
+ description: 'Custom agent id or slug',
514
+ required: true,
515
+ },
516
+ ],
517
+ queryParams: [
518
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
519
+ ],
520
+ requestBody: null,
521
+ responseDescription: 'Returns the requested custom agent.',
522
+ statuses: [
523
+ { code: 200, description: 'Custom agent returned' },
524
+ { code: 404, description: 'Custom agent not found' },
525
+ ],
526
+ examplePath: '/hub/agents/code-review',
527
+ },
528
+ {
529
+ id: 'update-custom-agent',
530
+ title: 'Update Custom Agent',
531
+ sectionTitle: 'Agents',
532
+ method: 'PATCH',
533
+ path: '/hub/agents/{agentIdOrSlug}',
534
+ description: 'Updates an owned custom-agent draft.',
535
+ pathParams: [
536
+ {
537
+ name: 'agentIdOrSlug',
538
+ type: 'string',
539
+ description: 'Custom agent id or slug',
540
+ required: true,
541
+ },
542
+ ],
543
+ queryParams: [
544
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
545
+ ],
546
+ requestBody: {
547
+ description: 'Custom-agent update payload.',
548
+ fields: { schema: CoderUpdateCustomAgentRequestSchema },
549
+ },
550
+ responseDescription: 'Returns the updated custom agent.',
551
+ statuses: [
552
+ { code: 200, description: 'Custom agent updated' },
553
+ { code: 404, description: 'Custom agent not found' },
554
+ ],
555
+ examplePath: '/hub/agents/code-review',
556
+ exampleBody: { displayName: 'Code Review Draft' },
557
+ },
558
+ {
559
+ id: 'publish-custom-agent',
560
+ title: 'Publish Custom Agent',
561
+ sectionTitle: 'Agents',
562
+ method: 'POST',
563
+ path: '/hub/agents/{agentIdOrSlug}/publish',
564
+ description: 'Publishes an owned custom agent.',
565
+ pathParams: [
566
+ {
567
+ name: 'agentIdOrSlug',
568
+ type: 'string',
569
+ description: 'Custom agent id or slug',
570
+ required: true,
571
+ },
572
+ ],
573
+ queryParams: [
574
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
575
+ ],
576
+ requestBody: null,
577
+ responseDescription: 'Returns the updated custom agent.',
578
+ statuses: [
579
+ { code: 200, description: 'Custom agent published' },
580
+ { code: 404, description: 'Custom agent not found' },
581
+ ],
582
+ examplePath: '/hub/agents/code-review/publish',
583
+ },
584
+ {
585
+ id: 'archive-custom-agent',
586
+ title: 'Archive Custom Agent',
587
+ sectionTitle: 'Agents',
588
+ method: 'POST',
589
+ path: '/hub/agents/{agentIdOrSlug}/archive',
590
+ description: 'Archives an owned custom agent.',
591
+ pathParams: [
592
+ {
593
+ name: 'agentIdOrSlug',
594
+ type: 'string',
595
+ description: 'Custom agent id or slug',
596
+ required: true,
597
+ },
598
+ ],
599
+ queryParams: [
600
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
601
+ ],
602
+ requestBody: null,
603
+ responseDescription: 'Returns the updated custom agent.',
604
+ statuses: [
605
+ { code: 200, description: 'Custom agent archived' },
606
+ { code: 404, description: 'Custom agent not found' },
607
+ ],
608
+ examplePath: '/hub/agents/code-review/archive',
609
+ },
610
+ {
611
+ id: 'list-custom-agent-versions',
612
+ title: 'List Custom Agent Versions',
613
+ sectionTitle: 'Agents',
614
+ method: 'GET',
615
+ path: '/hub/agents/{agentIdOrSlug}/versions',
616
+ description: 'Lists immutable published versions for a custom agent.',
617
+ pathParams: [
618
+ {
619
+ name: 'agentIdOrSlug',
620
+ type: 'string',
621
+ description: 'Custom agent id or slug',
622
+ required: true,
623
+ },
624
+ ],
625
+ queryParams: [
626
+ { name: 'orgId', type: 'string', description: 'Organization ID', required: false },
627
+ ],
628
+ requestBody: null,
629
+ responseDescription: 'Returns published versions for the custom agent.',
630
+ responseFields: {
631
+ schema: CoderCustomAgentVersionListResponseSchema,
632
+ stripRequired: true,
633
+ },
634
+ statuses: [
635
+ { code: 200, description: 'Custom agent versions returned' },
636
+ { code: 404, description: 'Custom agent not found' },
637
+ ],
638
+ examplePath: '/hub/agents/code-review/versions',
203
639
  },
204
640
  ],
205
641
  };