@agentuity/core 2.0.12 → 2.0.13

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.
@@ -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'),
@@ -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 }
@@ -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: [
@@ -843,6 +843,8 @@ export const SnapshotCreateOptionsSchema = z.object({
843
843
  tag: z.string().optional().describe('Tag for the snapshot (defaults to "latest")'),
844
844
  /** Make the snapshot publicly accessible */
845
845
  public: z.boolean().optional().describe('Make the snapshot publicly accessible'),
846
+ /** Organization ID to use for CLI-authenticated requests */
847
+ orgId: z.string().optional().describe('Organization ID for CLI-authenticated requests'),
846
848
  });
847
849
  export type SnapshotCreateOptions = z.infer<typeof SnapshotCreateOptionsSchema>;
848
850