@agentuity/core 3.0.0-alpha.6 → 3.0.0-beta.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 (169) hide show
  1. package/AGENTS.md +0 -1
  2. package/dist/index.d.ts +0 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +0 -3
  5. package/dist/index.js.map +1 -1
  6. package/dist/services/coder/api-reference.d.ts.map +1 -1
  7. package/dist/services/coder/api-reference.js +30 -1
  8. package/dist/services/coder/api-reference.js.map +1 -1
  9. package/dist/services/coder/client.d.ts +17 -1
  10. package/dist/services/coder/client.d.ts.map +1 -1
  11. package/dist/services/coder/client.js +30 -2
  12. package/dist/services/coder/client.js.map +1 -1
  13. package/dist/services/coder/index.d.ts +2 -2
  14. package/dist/services/coder/index.d.ts.map +1 -1
  15. package/dist/services/coder/index.js +1 -1
  16. package/dist/services/coder/index.js.map +1 -1
  17. package/dist/services/coder/protocol.d.ts +186 -5
  18. package/dist/services/coder/protocol.d.ts.map +1 -1
  19. package/dist/services/coder/protocol.js +125 -0
  20. package/dist/services/coder/protocol.js.map +1 -1
  21. package/dist/services/coder/sessions.d.ts +22 -0
  22. package/dist/services/coder/sessions.d.ts.map +1 -1
  23. package/dist/services/coder/sessions.js +10 -1
  24. package/dist/services/coder/sessions.js.map +1 -1
  25. package/dist/services/coder/sse.d.ts +2 -2
  26. package/dist/services/coder/sse.d.ts.map +1 -1
  27. package/dist/services/coder/sse.js +290 -178
  28. package/dist/services/coder/sse.js.map +1 -1
  29. package/dist/services/coder/types.d.ts +627 -0
  30. package/dist/services/coder/types.d.ts.map +1 -1
  31. package/dist/services/coder/types.js +221 -1
  32. package/dist/services/coder/types.js.map +1 -1
  33. package/dist/services/coder/workspaces.d.ts +11 -1
  34. package/dist/services/coder/workspaces.d.ts.map +1 -1
  35. package/dist/services/coder/workspaces.js +34 -1
  36. package/dist/services/coder/workspaces.js.map +1 -1
  37. package/dist/services/index.d.ts +0 -2
  38. package/dist/services/index.d.ts.map +1 -1
  39. package/dist/services/index.js +0 -2
  40. package/dist/services/index.js.map +1 -1
  41. package/dist/services/keyvalue/service.d.ts +9 -3
  42. package/dist/services/keyvalue/service.d.ts.map +1 -1
  43. package/dist/services/keyvalue/service.js +6 -3
  44. package/dist/services/keyvalue/service.js.map +1 -1
  45. package/dist/services/sandbox/api-reference.js +8 -8
  46. package/dist/services/sandbox/api-reference.js.map +1 -1
  47. package/dist/services/sandbox/client.d.ts +3 -2
  48. package/dist/services/sandbox/client.d.ts.map +1 -1
  49. package/dist/services/sandbox/client.js.map +1 -1
  50. package/dist/services/sandbox/create.d.ts +5 -0
  51. package/dist/services/sandbox/create.d.ts.map +1 -1
  52. package/dist/services/sandbox/create.js +8 -0
  53. package/dist/services/sandbox/create.js.map +1 -1
  54. package/dist/services/sandbox/get.d.ts +8 -4
  55. package/dist/services/sandbox/get.d.ts.map +1 -1
  56. package/dist/services/sandbox/get.js +28 -3
  57. package/dist/services/sandbox/get.js.map +1 -1
  58. package/dist/services/sandbox/getStatus.d.ts +3 -0
  59. package/dist/services/sandbox/getStatus.d.ts.map +1 -1
  60. package/dist/services/sandbox/getStatus.js +19 -2
  61. package/dist/services/sandbox/getStatus.js.map +1 -1
  62. package/dist/services/sandbox/index.d.ts +1 -1
  63. package/dist/services/sandbox/index.d.ts.map +1 -1
  64. package/dist/services/sandbox/list.d.ts +3 -0
  65. package/dist/services/sandbox/list.d.ts.map +1 -1
  66. package/dist/services/sandbox/list.js +5 -0
  67. package/dist/services/sandbox/list.js.map +1 -1
  68. package/dist/services/sandbox/pause.d.ts +17 -1
  69. package/dist/services/sandbox/pause.d.ts.map +1 -1
  70. package/dist/services/sandbox/pause.js +21 -3
  71. package/dist/services/sandbox/pause.js.map +1 -1
  72. package/dist/services/sandbox/run.d.ts +3 -2
  73. package/dist/services/sandbox/run.d.ts.map +1 -1
  74. package/dist/services/sandbox/run.js +244 -84
  75. package/dist/services/sandbox/run.js.map +1 -1
  76. package/dist/services/sandbox/types.d.ts +11 -4
  77. package/dist/services/sandbox/types.d.ts.map +1 -1
  78. package/dist/services/sandbox/types.js +12 -0
  79. package/dist/services/sandbox/types.js.map +1 -1
  80. package/dist/services/stream/namespaces.d.ts +2 -2
  81. package/dist/services/stream/namespaces.js +2 -2
  82. package/dist/services/stream/namespaces.js.map +1 -1
  83. package/dist/services/vector/service.d.ts +11 -11
  84. package/dist/services/vector/service.d.ts.map +1 -1
  85. package/dist/services/vector/service.js.map +1 -1
  86. package/package.json +3 -17
  87. package/src/index.ts +0 -15
  88. package/src/services/coder/api-reference.ts +31 -0
  89. package/src/services/coder/client.ts +46 -0
  90. package/src/services/coder/index.ts +3 -0
  91. package/src/services/coder/protocol.ts +133 -0
  92. package/src/services/coder/sessions.ts +26 -0
  93. package/src/services/coder/sse.ts +343 -184
  94. package/src/services/coder/types.ts +273 -1
  95. package/src/services/coder/workspaces.ts +74 -0
  96. package/src/services/index.ts +0 -2
  97. package/src/services/keyvalue/service.ts +16 -7
  98. package/src/services/sandbox/api-reference.ts +8 -8
  99. package/src/services/sandbox/client.ts +4 -4
  100. package/src/services/sandbox/create.ts +10 -0
  101. package/src/services/sandbox/get.ts +32 -3
  102. package/src/services/sandbox/getStatus.ts +23 -2
  103. package/src/services/sandbox/index.ts +1 -1
  104. package/src/services/sandbox/list.ts +5 -0
  105. package/src/services/sandbox/pause.ts +38 -4
  106. package/src/services/sandbox/run.ts +352 -105
  107. package/src/services/sandbox/types.ts +17 -2
  108. package/src/services/stream/namespaces.ts +2 -2
  109. package/src/services/vector/service.ts +11 -21
  110. package/dist/services/auth/index.d.ts +0 -7
  111. package/dist/services/auth/index.d.ts.map +0 -1
  112. package/dist/services/auth/index.js +0 -7
  113. package/dist/services/auth/index.js.map +0 -1
  114. package/dist/services/auth/types.d.ts +0 -192
  115. package/dist/services/auth/types.d.ts.map +0 -1
  116. package/dist/services/auth/types.js +0 -11
  117. package/dist/services/auth/types.js.map +0 -1
  118. package/dist/services/eval/api-reference.d.ts +0 -4
  119. package/dist/services/eval/api-reference.d.ts.map +0 -1
  120. package/dist/services/eval/api-reference.js +0 -121
  121. package/dist/services/eval/api-reference.js.map +0 -1
  122. package/dist/services/eval/events.d.ts +0 -93
  123. package/dist/services/eval/events.d.ts.map +0 -1
  124. package/dist/services/eval/events.js +0 -24
  125. package/dist/services/eval/events.js.map +0 -1
  126. package/dist/services/eval/get.d.ts +0 -36
  127. package/dist/services/eval/get.d.ts.map +0 -1
  128. package/dist/services/eval/get.js +0 -23
  129. package/dist/services/eval/get.js.map +0 -1
  130. package/dist/services/eval/index.d.ts +0 -6
  131. package/dist/services/eval/index.d.ts.map +0 -1
  132. package/dist/services/eval/index.js +0 -6
  133. package/dist/services/eval/index.js.map +0 -1
  134. package/dist/services/eval/list.d.ts +0 -50
  135. package/dist/services/eval/list.d.ts.map +0 -1
  136. package/dist/services/eval/list.js +0 -32
  137. package/dist/services/eval/list.js.map +0 -1
  138. package/dist/services/eval/run-get.d.ts +0 -48
  139. package/dist/services/eval/run-get.d.ts.map +0 -1
  140. package/dist/services/eval/run-get.js +0 -29
  141. package/dist/services/eval/run-get.js.map +0 -1
  142. package/dist/services/eval/run-list.d.ts +0 -70
  143. package/dist/services/eval/run-list.d.ts.map +0 -1
  144. package/dist/services/eval/run-list.js +0 -42
  145. package/dist/services/eval/run-list.js.map +0 -1
  146. package/dist/webrtc.d.ts +0 -243
  147. package/dist/webrtc.d.ts.map +0 -1
  148. package/dist/webrtc.js +0 -5
  149. package/dist/webrtc.js.map +0 -1
  150. package/dist/workbench-config.d.ts +0 -62
  151. package/dist/workbench-config.d.ts.map +0 -1
  152. package/dist/workbench-config.js +0 -58
  153. package/dist/workbench-config.js.map +0 -1
  154. package/dist/workbench.d.ts +0 -2
  155. package/dist/workbench.d.ts.map +0 -1
  156. package/dist/workbench.js +0 -2
  157. package/dist/workbench.js.map +0 -1
  158. package/src/services/auth/index.ts +0 -19
  159. package/src/services/auth/types.ts +0 -223
  160. package/src/services/eval/api-reference.ts +0 -124
  161. package/src/services/eval/events.ts +0 -92
  162. package/src/services/eval/get.ts +0 -33
  163. package/src/services/eval/index.ts +0 -29
  164. package/src/services/eval/list.ts +0 -49
  165. package/src/services/eval/run-get.ts +0 -39
  166. package/src/services/eval/run-list.ts +0 -59
  167. package/src/webrtc.ts +0 -259
  168. package/src/workbench-config.ts +0 -79
  169. package/src/workbench.ts +0 -1
@@ -113,6 +113,33 @@ export const CoderWorkspaceDetailSchema = z
113
113
  ownerUserId: z.string().describe('Owner user ID'),
114
114
  repos: z.array(CoderSessionRepositoryRefSchema).describe('Repositories in workspace'),
115
115
  repoCount: z.number().describe('Number of repositories'),
116
+ dependencies: z
117
+ .array(z.string())
118
+ .optional()
119
+ .default([])
120
+ .describe('APT package dependencies installed into workspace snapshots'),
121
+ setupScript: z
122
+ .string()
123
+ .optional()
124
+ .default('')
125
+ .describe('Shell script run while preparing workspace snapshots'),
126
+ snapshot: z
127
+ .object({
128
+ status: z.string().describe('Workspace snapshot build status'),
129
+ snapshotId: z.string().optional().describe('Created sandbox snapshot ID'),
130
+ snapshotRef: z.string().optional().describe('Snapshot reference used for sessions'),
131
+ baseSnapshotRef: z.string().optional().describe('Base session snapshot reference'),
132
+ baseDriverVersion: z.string().optional().describe('Base driver version stamp'),
133
+ configHash: z.string().optional().describe('Workspace snapshot input hash'),
134
+ buildId: z.string().optional().describe('Workspace snapshot build identifier'),
135
+ requestedAt: z.string().optional().describe('Snapshot build request timestamp'),
136
+ updatedAt: z.string().optional().describe('Snapshot build update timestamp'),
137
+ createdAt: z.string().optional().describe('Snapshot creation timestamp'),
138
+ error: z.string().optional().describe('Snapshot build error message'),
139
+ })
140
+ .passthrough()
141
+ .optional()
142
+ .describe('Workspace snapshot metadata'),
116
143
  savedSkillIds: z.array(z.string()).describe('Saved skill IDs in workspace'),
117
144
  skillBucketIds: z.array(z.string()).describe('Skill bucket IDs in workspace'),
118
145
  enabledAgents: z
@@ -324,12 +351,16 @@ export type CoderWorkspaceListResponse = z.infer<typeof CoderWorkspaceListRespon
324
351
 
325
352
  function hasWorkspaceSelections(input: {
326
353
  repos?: unknown[];
354
+ dependencies?: unknown[];
355
+ setupScript?: string;
327
356
  savedSkillIds?: unknown[];
328
357
  skillBucketIds?: unknown[];
329
358
  enabledAgents?: unknown[];
330
359
  }): boolean {
331
360
  return (
332
361
  (input.repos?.length ?? 0) > 0 ||
362
+ (input.dependencies?.length ?? 0) > 0 ||
363
+ Boolean(input.setupScript?.trim()) ||
333
364
  (input.savedSkillIds?.length ?? 0) > 0 ||
334
365
  (input.skillBucketIds?.length ?? 0) > 0 ||
335
366
  (input.enabledAgents?.length ?? 0) > 0
@@ -342,6 +373,14 @@ export const CoderCreateWorkspaceRequestSchema = z
342
373
  description: z.string().optional().describe('Workspace description'),
343
374
  scope: z.enum(['user', 'org']).optional().describe('Workspace scope'),
344
375
  repos: z.array(CoderSessionRepositoryRefSchema).optional().describe('Repositories'),
376
+ dependencies: z
377
+ .array(z.string())
378
+ .optional()
379
+ .describe('APT package dependencies installed into workspace snapshots'),
380
+ setupScript: z
381
+ .string()
382
+ .optional()
383
+ .describe('Shell script run while preparing workspace snapshots'),
345
384
  savedSkillIds: z.array(z.string()).optional().describe('Saved skill IDs'),
346
385
  skillBucketIds: z.array(z.string()).optional().describe('Skill bucket IDs'),
347
386
  enabledAgents: z
@@ -350,11 +389,65 @@ export const CoderCreateWorkspaceRequestSchema = z
350
389
  .describe('Effective agent roster to store on the workspace'),
351
390
  })
352
391
  .refine(hasWorkspaceSelections, {
353
- message: 'A workspace needs at least one repo, saved skill, skill bucket, or agent',
392
+ message:
393
+ 'A workspace needs at least one repo, dependency, setup script, saved skill, skill bucket, or agent',
354
394
  })
355
395
  .describe('Request body for creating a workspace');
356
396
  export type CoderCreateWorkspaceRequest = z.infer<typeof CoderCreateWorkspaceRequestSchema>;
357
397
 
398
+ export const CoderUpdateWorkspaceRequestSchema = z
399
+ .object({
400
+ name: z.string().optional().describe('Workspace name'),
401
+ description: z.string().optional().describe('Workspace description'),
402
+ scope: z.enum(['user', 'org']).optional().describe('Workspace scope'),
403
+ repos: z.array(CoderSessionRepositoryRefSchema).optional().describe('Repositories'),
404
+ dependencies: z
405
+ .array(z.string())
406
+ .optional()
407
+ .describe('APT package dependencies installed into workspace snapshots'),
408
+ setupScript: z
409
+ .string()
410
+ .optional()
411
+ .describe('Shell script run while preparing workspace snapshots'),
412
+ savedSkillIds: z.array(z.string()).optional().describe('Saved skill IDs'),
413
+ skillBucketIds: z.array(z.string()).optional().describe('Skill bucket IDs'),
414
+ enabledAgents: z
415
+ .array(z.string())
416
+ .optional()
417
+ .describe('Effective agent roster to store on the workspace'),
418
+ })
419
+ .refine((input) => Object.keys(input).length > 0, {
420
+ message: 'At least one workspace field must be provided',
421
+ })
422
+ .describe('Request body for updating a workspace');
423
+ export type CoderUpdateWorkspaceRequest = z.infer<typeof CoderUpdateWorkspaceRequestSchema>;
424
+
425
+ export const CoderWorkspaceDependencyValidationResponseSchema = z
426
+ .object({
427
+ valid: z.array(z.string()).describe('Valid dependency package specs'),
428
+ invalid: z
429
+ .array(
430
+ z
431
+ .object({
432
+ package: z.string().describe('Invalid dependency package spec'),
433
+ error: z.string().describe('Validation error'),
434
+ requestedVersion: z.string().optional().describe('Requested package version'),
435
+ availableVersions: z
436
+ .array(z.string())
437
+ .optional()
438
+ .describe('Available package versions returned by validation'),
439
+ searchUrl: z.string().describe('Package search URL'),
440
+ })
441
+ .passthrough()
442
+ )
443
+ .describe('Invalid dependency package specs'),
444
+ })
445
+ .passthrough()
446
+ .describe('Workspace dependency validation result');
447
+ export type CoderWorkspaceDependencyValidationResponse = z.infer<
448
+ typeof CoderWorkspaceDependencyValidationResponseSchema
449
+ >;
450
+
358
451
  export const CoderCreateCustomAgentRequestSchema = z
359
452
  .object({
360
453
  slug: z.string().describe('Stable custom agent slug'),
@@ -520,6 +613,59 @@ export const CoderCreateSessionRequestSchema = z
520
613
  .describe('Request body for creating a coder session');
521
614
  export type CoderCreateSessionRequest = z.infer<typeof CoderCreateSessionRequestSchema>;
522
615
 
616
+ function inferCoderAgentBuilderSessionMode(input: {
617
+ mode?: 'new' | 'edit' | 'from_session';
618
+ sourceSessionId?: string;
619
+ targetAgentId?: string;
620
+ targetAgentSlug?: string;
621
+ }): 'new' | 'edit' | 'from_session' {
622
+ if (input.mode) return input.mode;
623
+ if (input.sourceSessionId) return 'from_session';
624
+ if (input.targetAgentId || input.targetAgentSlug) return 'edit';
625
+ return 'new';
626
+ }
627
+
628
+ export const CoderCreateAgentBuilderSessionRequestSchema = z
629
+ .object({
630
+ label: z.string().optional().describe('Builder session label override'),
631
+ prompt: z.string().optional().describe('Optional user focus for the builder session kickoff'),
632
+ mode: z
633
+ .enum(['new', 'edit', 'from_session'])
634
+ .optional()
635
+ .describe('Builder launch mode override'),
636
+ visibility: CoderSessionVisibilitySchema.optional().describe('Builder session visibility'),
637
+ sourceSessionId: z
638
+ .string()
639
+ .optional()
640
+ .describe('Source session identifier for build-from-session launches'),
641
+ targetAgentId: z
642
+ .string()
643
+ .optional()
644
+ .describe('Target custom-agent identifier for edit launches'),
645
+ targetAgentSlug: z.string().optional().describe('Target custom-agent slug for edit launches'),
646
+ })
647
+ .superRefine((value, ctx) => {
648
+ const mode = inferCoderAgentBuilderSessionMode(value);
649
+ if (mode === 'from_session' && !value.sourceSessionId?.trim()) {
650
+ ctx.addIssue({
651
+ code: z.ZodIssueCode.custom,
652
+ path: ['sourceSessionId'],
653
+ message: 'sourceSessionId is required for from-session builder launches.',
654
+ });
655
+ }
656
+ if (mode === 'edit' && !value.targetAgentId?.trim() && !value.targetAgentSlug?.trim()) {
657
+ ctx.addIssue({
658
+ code: z.ZodIssueCode.custom,
659
+ path: ['targetAgentId'],
660
+ message: 'targetAgentId or targetAgentSlug is required for edit launches.',
661
+ });
662
+ }
663
+ })
664
+ .describe('Request body for creating an agent-builder session');
665
+ export type CoderCreateAgentBuilderSessionRequest = z.infer<
666
+ typeof CoderCreateAgentBuilderSessionRequestSchema
667
+ >;
668
+
523
669
  export const CoderUpdateSessionRequestSchema = z
524
670
  .object({
525
671
  label: z.string().optional().describe('Updated session label'),
@@ -574,6 +720,126 @@ export const CoderSessionWorkspaceSchema = z
574
720
  .describe('Workspace associated with a coder session');
575
721
  export type CoderSessionWorkspace = z.infer<typeof CoderSessionWorkspaceSchema>;
576
722
 
723
+ export const CoderAgentBuilderSessionModeSchema = z
724
+ .enum(['new', 'edit', 'from_session'])
725
+ .describe('Agent-builder launch mode for a builder session');
726
+ export type CoderAgentBuilderSessionMode = z.infer<typeof CoderAgentBuilderSessionModeSchema>;
727
+
728
+ export const CoderAgentBuilderActionKindSchema = z
729
+ .enum(['create_draft', 'update_draft', 'publish'])
730
+ .describe('Durable builder action emitted by an agent-builder session');
731
+ export type CoderAgentBuilderActionKind = z.infer<typeof CoderAgentBuilderActionKindSchema>;
732
+
733
+ export const CoderAgentBuilderSourceSessionSchema = z
734
+ .object({
735
+ sessionId: z.string().describe('Source session identifier linked to the builder session'),
736
+ label: z.string().optional().describe('Source session label when available'),
737
+ })
738
+ .describe('Source session reference used by agent-builder flows');
739
+ export type CoderAgentBuilderSourceSession = z.infer<typeof CoderAgentBuilderSourceSessionSchema>;
740
+
741
+ export const CoderAgentBuilderTargetAgentSchema = z
742
+ .object({
743
+ agentId: z.string().optional().describe('Target custom-agent identifier when editing'),
744
+ slug: z.string().describe('Target custom-agent slug'),
745
+ displayName: z.string().optional().describe('Target custom-agent display name'),
746
+ })
747
+ .describe('Target custom-agent reference for agent-builder edit flows');
748
+ export type CoderAgentBuilderTargetAgent = z.infer<typeof CoderAgentBuilderTargetAgentSchema>;
749
+
750
+ export const CoderAgentBuilderProposalSchema = z
751
+ .object({
752
+ slug: z.string().optional().describe('Proposed custom-agent slug'),
753
+ displayName: z.string().optional().describe('Proposed custom-agent name'),
754
+ description: z.string().optional().describe('Proposed custom-agent description'),
755
+ instructions: z.string().optional().describe('Proposed custom-agent system prompt'),
756
+ model: z.string().optional().describe('Proposed model override'),
757
+ thinkingLevel: CoderCustomAgentThinkingLevelSchema.optional().describe(
758
+ 'Proposed thinking level override'
759
+ ),
760
+ headlessCompatible: z
761
+ .boolean()
762
+ .optional()
763
+ .describe('Whether the proposed agent is safe for non-interactive callers'),
764
+ tools: z
765
+ .array(CoderCustomAgentToolResponseSchema)
766
+ .default([])
767
+ .describe('Proposed workspace tools for the agent'),
768
+ serviceTools: z
769
+ .array(CoderCustomAgentServiceToolResponseSchema)
770
+ .default([])
771
+ .describe('Proposed service tools for the agent'),
772
+ savedSkills: z
773
+ .array(CoderSkillRefSchema)
774
+ .default([])
775
+ .describe('Proposed frozen skill refs to attach'),
776
+ companionAgents: z
777
+ .array(z.string())
778
+ .default([])
779
+ .describe('Proposed companion agents to auto-include'),
780
+ })
781
+ .passthrough()
782
+ .describe('Session-scoped agent-builder proposal state');
783
+ export type CoderAgentBuilderProposal = z.infer<typeof CoderAgentBuilderProposalSchema>;
784
+
785
+ export const CoderAgentBuilderDurableStateSchema = z
786
+ .object({
787
+ draftAgentId: z.string().optional().describe('Linked draft custom-agent identifier'),
788
+ draftAgentSlug: z.string().optional().describe('Linked draft custom-agent slug'),
789
+ lastPublishedVersion: z
790
+ .number()
791
+ .int()
792
+ .optional()
793
+ .describe('Latest published version created through the builder flow'),
794
+ })
795
+ .describe('Durable agent-library state associated with a builder session');
796
+ export type CoderAgentBuilderDurableState = z.infer<typeof CoderAgentBuilderDurableStateSchema>;
797
+
798
+ export const CoderAgentBuilderActionStateSchema = z
799
+ .object({
800
+ kind: CoderAgentBuilderActionKindSchema.describe('Last durable builder action'),
801
+ status: z.enum(['completed', 'failed']).describe('Result of the last durable builder action'),
802
+ occurredAt: z.string().describe('Timestamp of the last durable builder action'),
803
+ message: z.string().optional().describe('Human-readable builder action result summary'),
804
+ agentId: z.string().optional().describe('Affected custom-agent identifier'),
805
+ agentSlug: z.string().optional().describe('Affected custom-agent slug'),
806
+ publishedVersion: z
807
+ .number()
808
+ .int()
809
+ .optional()
810
+ .describe('Published version number when publish succeeded'),
811
+ })
812
+ .describe('Latest durable action emitted by a builder session');
813
+ export type CoderAgentBuilderActionState = z.infer<typeof CoderAgentBuilderActionStateSchema>;
814
+
815
+ export const CoderAgentBuilderSessionSummarySchema = z
816
+ .object({
817
+ mode: CoderAgentBuilderSessionModeSchema.describe('Builder session mode'),
818
+ sourceSession: CoderAgentBuilderSourceSessionSchema.optional().describe(
819
+ 'Linked source session when the builder was launched from an existing session'
820
+ ),
821
+ targetAgent: CoderAgentBuilderTargetAgentSchema.optional().describe(
822
+ 'Target agent baseline when the builder is editing an existing custom agent'
823
+ ),
824
+ durable: CoderAgentBuilderDurableStateSchema.optional().describe(
825
+ 'Linked durable draft/publish state'
826
+ ),
827
+ lastAction: CoderAgentBuilderActionStateSchema.optional().describe(
828
+ 'Most recent durable builder action'
829
+ ),
830
+ })
831
+ .describe('Projected builder-session summary returned in session listings');
832
+ export type CoderAgentBuilderSessionSummary = z.infer<typeof CoderAgentBuilderSessionSummarySchema>;
833
+
834
+ export const CoderAgentBuilderSessionStateSchema = CoderAgentBuilderSessionSummarySchema.extend({
835
+ proposal: CoderAgentBuilderProposalSchema.optional().describe(
836
+ 'Full builder proposal state projected in session detail responses'
837
+ ),
838
+ })
839
+ .passthrough()
840
+ .describe('Full builder-session state returned in session details');
841
+ export type CoderAgentBuilderSessionState = z.infer<typeof CoderAgentBuilderSessionStateSchema>;
842
+
577
843
  export const CoderSessionListItemSchema = z
578
844
  .object({
579
845
  sessionId: z.string().describe('Unique session identifier'),
@@ -619,6 +885,9 @@ export const CoderSessionListItemSchema = z
619
885
  .optional()
620
886
  .default([])
621
887
  .describe('Enabled agent roster attached to the session'),
888
+ builder: CoderAgentBuilderSessionSummarySchema.optional().describe(
889
+ 'Projected builder-session summary when this session is an agent-builder flow'
890
+ ),
622
891
  defaultAgent: z.string().optional().describe('Default agent assigned to session operations'),
623
892
  bucket: CoderSessionBucketSchema.describe('Derived bucket for session listing'),
624
893
  runtimeAvailable: z.boolean().describe('Whether runtime is currently reachable'),
@@ -650,6 +919,9 @@ export const CoderSessionSchema = CoderSessionListItemSchema.extend({
650
919
  .string()
651
920
  .optional()
652
921
  .describe('Last update timestamp for session metadata (ISO-8601)'),
922
+ builder: CoderAgentBuilderSessionStateSchema.optional().describe(
923
+ 'Full builder-session state when this session is an agent-builder flow'
924
+ ),
653
925
  // These fields are present in list items but may be absent in detail responses
654
926
  lastActivityAt: z.string().optional().describe('Timestamp of most recent activity (ISO-8601)'),
655
927
  taskCount: z.number().optional().describe('Number of tasks associated with the session'),
@@ -2,9 +2,13 @@ import { z } from 'zod/v4';
2
2
  import { type APIClient } from '../api.ts';
3
3
  import {
4
4
  CoderCreateWorkspaceRequestSchema,
5
+ CoderUpdateWorkspaceRequestSchema,
6
+ CoderWorkspaceDependencyValidationResponseSchema,
5
7
  CoderWorkspaceDetailSchema,
6
8
  CoderWorkspaceListResponseSchema,
7
9
  type CoderCreateWorkspaceRequest,
10
+ type CoderUpdateWorkspaceRequest,
11
+ type CoderWorkspaceDependencyValidationResponse,
8
12
  type CoderWorkspaceDetail,
9
13
  type CoderWorkspaceListResponse,
10
14
  } from './types.ts';
@@ -25,6 +29,34 @@ const WorkspaceCreateResponseSchema = z
25
29
  .passthrough()
26
30
  .describe('Wrapped workspace create response from coder hub');
27
31
 
32
+ const WorkspaceUpdateResponseSchema = z
33
+ .object({
34
+ workspace: CoderWorkspaceDetailSchema.describe(
35
+ 'Updated workspace payload returned by coder hub'
36
+ ),
37
+ })
38
+ .passthrough()
39
+ .describe('Wrapped workspace update response from coder hub');
40
+
41
+ const WorkspaceSnapshotRefreshResponseSchema = z
42
+ .object({
43
+ workspace: CoderWorkspaceDetailSchema.describe(
44
+ 'Workspace payload returned after refreshing its snapshot'
45
+ ),
46
+ })
47
+ .passthrough()
48
+ .describe('Wrapped workspace snapshot refresh response from coder hub');
49
+
50
+ const WorkspaceDependencyValidationWrappedResponseSchema = z
51
+ .object({
52
+ success: z.boolean().describe('Validation request success indicator'),
53
+ data: CoderWorkspaceDependencyValidationResponseSchema.describe(
54
+ 'Dependency validation result'
55
+ ),
56
+ })
57
+ .passthrough()
58
+ .describe('Wrapped workspace dependency validation response from coder hub');
59
+
28
60
  const OkResponseSchema = z
29
61
  .object({
30
62
  ok: z.boolean().describe('Operation success indicator'),
@@ -68,6 +100,48 @@ export async function coderCreateWorkspace(
68
100
  return resp.workspace;
69
101
  }
70
102
 
103
+ export async function coderUpdateWorkspace(
104
+ client: APIClient,
105
+ params: { workspaceId: string; body: CoderUpdateWorkspaceRequest }
106
+ ): Promise<CoderWorkspaceDetail> {
107
+ const path = `/hub/workspaces/${encodeURIComponent(params.workspaceId)}`;
108
+ const resp = await client.patch<
109
+ z.infer<typeof WorkspaceUpdateResponseSchema>,
110
+ CoderUpdateWorkspaceRequest
111
+ >(path, params.body, WorkspaceUpdateResponseSchema, CoderUpdateWorkspaceRequestSchema);
112
+
113
+ return resp.workspace;
114
+ }
115
+
116
+ export async function coderRefreshWorkspaceSnapshot(
117
+ client: APIClient,
118
+ params: { workspaceId: string }
119
+ ): Promise<CoderWorkspaceDetail> {
120
+ const path = `/hub/workspaces/${encodeURIComponent(params.workspaceId)}/snapshot/refresh`;
121
+ const resp = await client.post<z.infer<typeof WorkspaceSnapshotRefreshResponseSchema>>(
122
+ path,
123
+ undefined,
124
+ WorkspaceSnapshotRefreshResponseSchema
125
+ );
126
+
127
+ return resp.workspace;
128
+ }
129
+
130
+ export async function coderValidateWorkspaceDependencies(
131
+ client: APIClient,
132
+ params: { dependencies: string[] }
133
+ ): Promise<CoderWorkspaceDependencyValidationResponse> {
134
+ const resp = await client.post<
135
+ z.infer<typeof WorkspaceDependencyValidationWrappedResponseSchema>
136
+ >(
137
+ '/hub/workspaces/dependencies/validate',
138
+ { dependencies: params.dependencies },
139
+ WorkspaceDependencyValidationWrappedResponseSchema
140
+ );
141
+
142
+ return resp.data;
143
+ }
144
+
71
145
  export async function coderDeleteWorkspace(
72
146
  client: APIClient,
73
147
  params: { workspaceId: string }
@@ -1,5 +1,4 @@
1
1
  export * from './adapter.ts';
2
- export * from './auth/index.ts';
3
2
  export * from './email/index.ts';
4
3
  export * from './exception.ts';
5
4
  export * from './keyvalue/index.ts';
@@ -16,7 +15,6 @@ export * from './api.ts';
16
15
 
17
16
  export * from './apikey/index.ts';
18
17
  export * from './db/index.ts';
19
- export * from './eval/index.ts';
20
18
  export * from './machine/index.ts';
21
19
  export * from './monitoring/index.ts';
22
20
  export * from './oauth/index.ts';
@@ -317,12 +317,18 @@ export interface KeyValueStorage {
317
317
  *
318
318
  * @param name - the name of the key value storage
319
319
  * @param keyword - the keyword to search for
320
- * @returns map of keys to items with metadata
320
+ * @returns a Map of keys to items with metadata, in the order returned by the server.
321
+ *
322
+ * @remarks
323
+ * Returns a `Map` (not a plain object) for consistency with other multi-result
324
+ * SDK methods such as `vector.getMany()`. Iterate with `for (const [key, item] of results)`
325
+ * or `results.entries()` / `results.keys()` / `results.values()`. Use `results.size`
326
+ * for the count and `results.get(key)` for direct lookup.
321
327
  */
322
328
  search<T = unknown>(
323
329
  name: string,
324
330
  keyword: string
325
- ): Promise<Record<string, KeyValueItemWithMetadata<T>>>;
331
+ ): Promise<Map<string, KeyValueItemWithMetadata<T>>>;
326
332
 
327
333
  /**
328
334
  * get all keys in a namespace
@@ -361,7 +367,8 @@ function base64ToBytes(base64: string): Uint8Array {
361
367
  }
362
368
 
363
369
  /**
364
- * Deserializes search result values from the server's wire format.
370
+ * Deserializes search result values from the server's wire format and
371
+ * returns them as a Map preserving insertion order.
365
372
  *
366
373
  * The Go server stores values as []byte, which Go's json.Marshal
367
374
  * base64-encodes when embedding in a JSON response. This function
@@ -370,8 +377,9 @@ function base64ToBytes(base64: string): Uint8Array {
370
377
  */
371
378
  function deserializeSearchResults<T>(
372
379
  data: Record<string, KeyValueItemWithMetadata<T>>
373
- ): Record<string, KeyValueItemWithMetadata<T>> {
374
- for (const item of Object.values(data)) {
380
+ ): Map<string, KeyValueItemWithMetadata<T>> {
381
+ const out = new Map<string, KeyValueItemWithMetadata<T>>();
382
+ for (const [key, item] of Object.entries(data)) {
375
383
  if (typeof item.value === 'string') {
376
384
  try {
377
385
  const bytes = base64ToBytes(item.value);
@@ -389,8 +397,9 @@ function deserializeSearchResults<T>(
389
397
  // If base64 decoding or parsing fails, leave value as-is
390
398
  }
391
399
  }
400
+ out.set(key, item);
392
401
  }
393
- return data;
402
+ return out;
394
403
  }
395
404
 
396
405
  export class KeyValueStorageService implements KeyValueStorage {
@@ -601,7 +610,7 @@ export class KeyValueStorageService implements KeyValueStorage {
601
610
  async search<T = unknown>(
602
611
  name: string,
603
612
  keyword: string
604
- ): Promise<Record<string, KeyValueItemWithMetadata<T>>> {
613
+ ): Promise<Map<string, KeyValueItemWithMetadata<T>>> {
605
614
  const url = buildUrl(
606
615
  this.#baseUrl,
607
616
  `/kv/search/${encodeURIComponent(name)}/${encodeURIComponent(keyword)}`
@@ -613,7 +613,7 @@ const service: Service = {
613
613
  ],
614
614
  requestBody: {
615
615
  description: 'Snapshot creation payload.',
616
- fields: { schema: SnapshotCreateOptionsSchema },
616
+ fields: { schema: SnapshotCreateOptionsSchema.omit({ orgId: true }) },
617
617
  },
618
618
  responseDescription: 'Returns the created snapshot.',
619
619
  statuses: [
@@ -887,15 +887,15 @@ const service: Service = {
887
887
  exampleHeaders: { 'Content-Type': 'application/gzip' },
888
888
  exampleBody: '<binary gzip data>',
889
889
  },
890
- // ── Disk Checkpoints ──────────────────────────────────────────────
890
+ // ── Sandbox Checkpoints ───────────────────────────────────────────
891
891
  {
892
892
  id: 'create-checkpoint',
893
893
  title: 'Create Checkpoint',
894
- sectionTitle: 'Disk Checkpoints',
894
+ sectionTitle: 'Sandbox Checkpoints',
895
895
  method: 'POST',
896
896
  path: '/sandbox/{sandboxId}/checkpoint',
897
897
  description:
898
- 'Create a named checkpoint of the sandbox filesystem. Checkpoint names must be unique — creating a checkpoint with a name that already exists returns 409 Conflict. Disk checkpoints are persisted across pause/resume cycles.',
898
+ 'Create a named checkpoint of the sandbox filesystem. Checkpoint names must be unique — creating a checkpoint with a name that already exists returns 409 Conflict. Checkpoints are persisted across pause/resume cycles.',
899
899
  pathParams: [
900
900
  { name: 'sandboxId', type: 'string', description: 'Sandbox ID', required: true },
901
901
  ],
@@ -923,11 +923,11 @@ const service: Service = {
923
923
  {
924
924
  id: 'list-checkpoints',
925
925
  title: 'List Checkpoints',
926
- sectionTitle: 'Disk Checkpoints',
926
+ sectionTitle: 'Sandbox Checkpoints',
927
927
  method: 'GET',
928
928
  path: '/sandbox/checkpoints/{sandboxId}',
929
929
  description:
930
- 'List checkpoints for a specific sandbox. Disk checkpoints are persisted across pause/resume cycles.',
930
+ 'List checkpoints for a specific sandbox. Checkpoints are persisted across pause/resume cycles.',
931
931
  pathParams: [
932
932
  { name: 'sandboxId', type: 'string', description: 'Sandbox ID', required: true },
933
933
  ],
@@ -947,7 +947,7 @@ const service: Service = {
947
947
  {
948
948
  id: 'restore-checkpoint',
949
949
  title: 'Restore Checkpoint',
950
- sectionTitle: 'Disk Checkpoints',
950
+ sectionTitle: 'Sandbox Checkpoints',
951
951
  method: 'POST',
952
952
  path: '/sandbox/{sandboxId}/checkpoint/{checkpointId}/restore',
953
953
  description: 'Restore the sandbox filesystem to a checkpoint state.',
@@ -971,7 +971,7 @@ const service: Service = {
971
971
  {
972
972
  id: 'delete-checkpoint',
973
973
  title: 'Delete Checkpoint',
974
- sectionTitle: 'Disk Checkpoints',
974
+ sectionTitle: 'Sandbox Checkpoints',
975
975
  method: 'DELETE',
976
976
  path: '/sandbox/{sandboxId}/checkpoint/{checkpointId}',
977
977
  description: 'Delete a checkpoint.',
@@ -34,7 +34,7 @@ import {
34
34
  sandboxRmDir,
35
35
  sandboxSetEnv,
36
36
  } from './files.ts';
37
- import { sandboxPause } from './pause.ts';
37
+ import { sandboxPause, type SandboxPauseResult } from './pause.ts';
38
38
  import { sandboxResume } from './resume.ts';
39
39
  import { sandboxRun } from './run.ts';
40
40
  import {
@@ -281,7 +281,7 @@ export interface SandboxInstance {
281
281
  /**
282
282
  * Pause the sandbox, creating a checkpoint of its current state
283
283
  */
284
- pause(): Promise<void>;
284
+ pause(): Promise<SandboxPauseResult>;
285
285
 
286
286
  /**
287
287
  * Resume the sandbox from a paused or evacuated state
@@ -399,7 +399,7 @@ function createSandboxInstanceMethods(
399
399
  return sandboxGet(client, { sandboxId, orgId });
400
400
  },
401
401
 
402
- async pause(): Promise<void> {
402
+ async pause(): Promise<SandboxPauseResult> {
403
403
  return sandboxPause(client, { sandboxId, orgId });
404
404
  },
405
405
 
@@ -725,7 +725,7 @@ export class SandboxClient {
725
725
  *
726
726
  * @param sandboxId - The sandbox ID to pause
727
727
  */
728
- async pause(sandboxId: string): Promise<void> {
728
+ async pause(sandboxId: string): Promise<SandboxPauseResult> {
729
729
  return sandboxPause(this.#client, { sandboxId, orgId: this.#orgId });
730
730
  }
731
731
 
@@ -49,6 +49,12 @@ export const SandboxCreateRequestSchema = z
49
49
  .object({
50
50
  idle: z.string().optional().describe('Idle timeout duration (e.g., "5m", "1h")'),
51
51
  execution: z.string().optional().describe('Maximum execution time (e.g., "30m", "2h")'),
52
+ paused: z
53
+ .string()
54
+ .optional()
55
+ .describe(
56
+ 'Maximum time sandbox can remain paused before termination (e.g., "24h", "0s" for infinite)'
57
+ ),
52
58
  })
53
59
  .optional()
54
60
  .describe('Timeout settings for the sandbox'),
@@ -139,6 +145,10 @@ export const SandboxCreateDataSchema = z
139
145
  'failed',
140
146
  ])
141
147
  .describe('Current status of the sandbox'),
148
+ executionId: z
149
+ .string()
150
+ .optional()
151
+ .describe('Initial execution identifier for oneshot sandbox creation'),
142
152
  url: z
143
153
  .string()
144
154
  .optional()