@agentuity/cli 1.0.45 → 1.0.47

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 (52) hide show
  1. package/dist/cmd/build/vite/agent-discovery.d.ts.map +1 -1
  2. package/dist/cmd/build/vite/agent-discovery.js +21 -0
  3. package/dist/cmd/build/vite/agent-discovery.js.map +1 -1
  4. package/dist/cmd/build/vite/static-renderer.d.ts.map +1 -1
  5. package/dist/cmd/build/vite/static-renderer.js +9 -1
  6. package/dist/cmd/build/vite/static-renderer.js.map +1 -1
  7. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
  8. package/dist/cmd/build/vite/vite-builder.js +10 -2
  9. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  10. package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
  11. package/dist/cmd/cloud/sandbox/exec.js +15 -1
  12. package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
  13. package/dist/cmd/cloud/sandbox/execution/get.d.ts.map +1 -1
  14. package/dist/cmd/cloud/sandbox/execution/get.js +5 -0
  15. package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
  16. package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
  17. package/dist/cmd/cloud/sandbox/execution/list.js +12 -7
  18. package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
  19. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  20. package/dist/cmd/cloud/sandbox/get.js +1 -0
  21. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  22. package/dist/cmd/cloud/sandbox/util.js +1 -1
  23. package/dist/cmd/cloud/sandbox/util.js.map +1 -1
  24. package/dist/cmd/cloud/task/create.js +1 -1
  25. package/dist/cmd/cloud/task/create.js.map +1 -1
  26. package/dist/cmd/cloud/task/delete.js +1 -1
  27. package/dist/cmd/cloud/task/delete.js.map +1 -1
  28. package/dist/cmd/cloud/task/list.js +1 -1
  29. package/dist/cmd/cloud/task/list.js.map +1 -1
  30. package/dist/cmd/cloud/task/update.js +1 -1
  31. package/dist/cmd/cloud/task/update.js.map +1 -1
  32. package/dist/cmd/dev/file-watcher.d.ts.map +1 -1
  33. package/dist/cmd/dev/file-watcher.js +7 -0
  34. package/dist/cmd/dev/file-watcher.js.map +1 -1
  35. package/dist/cmd/dev/index.d.ts.map +1 -1
  36. package/dist/cmd/dev/index.js +13 -5
  37. package/dist/cmd/dev/index.js.map +1 -1
  38. package/package.json +6 -6
  39. package/src/cmd/build/vite/agent-discovery.ts +27 -0
  40. package/src/cmd/build/vite/static-renderer.ts +11 -1
  41. package/src/cmd/build/vite/vite-builder.ts +12 -2
  42. package/src/cmd/cloud/sandbox/exec.ts +19 -1
  43. package/src/cmd/cloud/sandbox/execution/get.ts +5 -0
  44. package/src/cmd/cloud/sandbox/execution/list.ts +13 -14
  45. package/src/cmd/cloud/sandbox/get.ts +1 -0
  46. package/src/cmd/cloud/sandbox/util.ts +1 -1
  47. package/src/cmd/cloud/task/create.ts +1 -1
  48. package/src/cmd/cloud/task/delete.ts +1 -1
  49. package/src/cmd/cloud/task/list.ts +1 -1
  50. package/src/cmd/cloud/task/update.ts +1 -1
  51. package/src/cmd/dev/file-watcher.ts +9 -0
  52. package/src/cmd/dev/index.ts +15 -6
@@ -84,6 +84,16 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
84
84
  profile,
85
85
  } = options;
86
86
 
87
+ const isViteDebug =
88
+ process.env.AGENTUITY_VITE_DEBUG === '1' || process.env.AGENTUITY_VITE_DEBUG === 'true';
89
+ if (isViteDebug) {
90
+ logger.debug('Vite debug logging enabled via AGENTUITY_VITE_DEBUG');
91
+ const existing = process.env.DEBUG || '';
92
+ if (!existing.includes('vite:')) {
93
+ process.env.DEBUG = existing ? `${existing},vite:*` : 'vite:*';
94
+ }
95
+ }
96
+
87
97
  logger.debug(`Running Vite build for mode: ${mode}`);
88
98
 
89
99
  // For server mode, use Bun.build (preserves process.env at runtime)
@@ -245,7 +255,7 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
245
255
  // In dev mode, Vite serves them directly from src/web/public/
246
256
  copyPublicDir: !dev,
247
257
  },
248
- logLevel: 'warn',
258
+ logLevel: isViteDebug ? 'info' : 'warn',
249
259
  };
250
260
  } else if (mode === 'workbench') {
251
261
  const { workbenchRoute = '/workbench' } = options;
@@ -280,7 +290,7 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
280
290
  manifest: true,
281
291
  emptyOutDir: true,
282
292
  },
283
- logLevel: 'warn',
293
+ logLevel: isViteDebug ? 'info' : 'warn',
284
294
  };
285
295
  } else {
286
296
  throw new Error(`Unknown build mode: ${mode}`);
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { Writable } from 'node:stream';
3
+ import { ErrorCode } from '../../../errors';
3
4
  import { createCommand } from '../../../types';
4
5
  import * as tui from '../../../tui';
5
6
  import { createSandboxClient } from './util';
@@ -24,6 +25,10 @@ const SandboxExecResponseSchema = z.object({
24
25
  .optional()
25
26
  .describe('Standard error output (only when separate streams are available)'),
26
27
  output: z.string().optional().describe('Combined stdout/stderr output'),
28
+ outputTruncated: z
29
+ .boolean()
30
+ .optional()
31
+ .describe('Whether the captured output was truncated due to size limits'),
27
32
  autoResumed: z
28
33
  .boolean()
29
34
  .optional()
@@ -66,6 +71,18 @@ export const execSubcommand = createCommand({
66
71
  async handler(ctx) {
67
72
  const { args, opts, options, auth, logger, apiClient } = ctx;
68
73
 
74
+ // Validate timeout format if provided (fail fast before any network calls)
75
+ if (opts.timeout) {
76
+ // Go's time.ParseDuration accepts "0" or one-or-more number+unit tokens.
77
+ // Valid units: ns, us, µs (U+00B5), μs (U+03BC), ms, s, m, h
78
+ if (!/^(?:0|(\d+(\.\d+)?(ns|us|[µμ]s|ms|s|m|h))+)$/.test(opts.timeout)) {
79
+ tui.fatal(
80
+ `Invalid timeout format '${opts.timeout}': expected duration like '5s', '1m', '1h', '300ms'`,
81
+ ErrorCode.INVALID_ARGUMENT
82
+ );
83
+ }
84
+ }
85
+
69
86
  // Resolve sandbox to get region and orgId using CLI API
70
87
  const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
71
88
  const { region, orgId } = sandboxInfo;
@@ -221,7 +238,8 @@ export const execSubcommand = createCommand({
221
238
  stdout: options.json ? stdoutOutput : undefined,
222
239
  stderr: options.json ? stderrOutput : undefined,
223
240
  output: options.json ? output : undefined,
224
- autoResumed: execution.autoResumed || undefined,
241
+ outputTruncated: finalExecution.outputTruncated ?? undefined,
242
+ autoResumed: execution.autoResumed ?? undefined,
225
243
  };
226
244
  } finally {
227
245
  process.off('SIGINT', handleSignal);
@@ -17,6 +17,10 @@ const ExecutionGetResponseSchema = z.object({
17
17
  error: z.string().optional().describe('Error message if failed'),
18
18
  stdoutStreamUrl: z.string().optional().describe('URL to stream stdout'),
19
19
  stderrStreamUrl: z.string().optional().describe('URL to stream stderr'),
20
+ outputTruncated: z
21
+ .boolean()
22
+ .optional()
23
+ .describe('Whether the captured output was truncated due to size limits'),
20
24
  });
21
25
 
22
26
  export const getSubcommand = createCommand({
@@ -108,6 +112,7 @@ export const getSubcommand = createCommand({
108
112
  error: result.error,
109
113
  stdoutStreamUrl: result.stdoutStreamUrl,
110
114
  stderrStreamUrl: result.stderrStreamUrl,
115
+ outputTruncated: result.outputTruncated,
111
116
  };
112
117
  },
113
118
  });
@@ -1,9 +1,9 @@
1
- import { executionList } from '@agentuity/server';
1
+ import { executionList, sandboxResolve } from '@agentuity/server';
2
2
  import { z } from 'zod';
3
3
  import { getCommand } from '../../../../command-prefix';
4
4
  import * as tui from '../../../../tui';
5
5
  import { createCommand } from '../../../../types';
6
- import { createSandboxClient, getSandboxRegion } from '../util';
6
+ import { createSandboxClient } from '../util';
7
7
 
8
8
  const ExecutionInfoSchema = z.object({
9
9
  executionId: z.string().describe('Execution ID'),
@@ -25,7 +25,7 @@ export const listSubcommand = createCommand({
25
25
  aliases: ['ls'],
26
26
  description: 'List executions for a sandbox',
27
27
  tags: ['read-only', 'fast', 'requires-auth'],
28
- requires: { auth: true, org: true },
28
+ requires: { auth: true, apiClient: true },
29
29
  idempotent: true,
30
30
  examples: [
31
31
  {
@@ -43,22 +43,21 @@ export const listSubcommand = createCommand({
43
43
  }),
44
44
  options: z.object({
45
45
  limit: z.number().optional().describe('Maximum number of results (default: 50, max: 100)'),
46
- orgId: z.string().optional().describe('filter by organization id'),
46
+ orgId: z
47
+ .string()
48
+ .optional()
49
+ .describe('Override organization ID (default: resolved from sandbox)'),
47
50
  }),
48
51
  response: ExecutionListResponseSchema,
49
52
  },
50
53
 
51
54
  async handler(ctx) {
52
- const { args, opts, options, auth, logger, orgId: ctxOrgId, config } = ctx;
53
- const effectiveOrgId = opts?.orgId || ctxOrgId;
54
- const region = await getSandboxRegion(
55
- logger,
56
- auth,
57
- config?.name,
58
- args.sandboxId,
59
- effectiveOrgId,
60
- config
61
- );
55
+ const { args, opts, options, auth, logger, apiClient } = ctx;
56
+
57
+ // Resolve sandbox to get region and orgId (like exec.ts does)
58
+ const sandboxInfo = await sandboxResolve(apiClient, args.sandboxId);
59
+ const { region, orgId: resolvedOrgId } = sandboxInfo;
60
+ const effectiveOrgId = opts?.orgId || resolvedOrgId;
62
61
  const client = createSandboxClient(logger, auth, region);
63
62
 
64
63
  const result = await executionList(client, {
@@ -79,6 +79,7 @@ export const getSubcommand = createCommand({
79
79
  const result = await sandboxGet(client, {
80
80
  sandboxId: args.sandboxId,
81
81
  orgId: sandboxInfo.orgId,
82
+ includeDeleted: true,
82
83
  });
83
84
 
84
85
  // Cache the region for future lookups
@@ -41,7 +41,7 @@ export async function getSandboxRegion(
41
41
  config
42
42
  );
43
43
 
44
- const sandbox = await sandboxGet(globalClient, { sandboxId, orgId });
44
+ const sandbox = await sandboxGet(globalClient, { sandboxId, orgId, includeDeleted: true });
45
45
  if (!sandbox.region) {
46
46
  tui.fatal(`Sandbox '${sandboxId}' has no region information`, ErrorCode.RESOURCE_NOT_FOUND);
47
47
  }
@@ -95,7 +95,7 @@ export const createSubcommand = createCommand({
95
95
  .optional()
96
96
  .describe('task priority (default: none)'),
97
97
  status: z
98
- .enum(['open', 'in_progress', 'done', 'cancelled'])
98
+ .enum(['open', 'in_progress', 'started', 'done', 'completed', 'closed', 'cancelled'])
99
99
  .optional()
100
100
  .describe('initial task status (default: open)'),
101
101
  parentId: z.string().optional().describe('parent task ID for subtasks'),
@@ -88,7 +88,7 @@ export const deleteSubcommand = createCommand({
88
88
  }),
89
89
  options: z.object({
90
90
  status: z
91
- .enum(['open', 'in_progress', 'done', 'cancelled'])
91
+ .enum(['open', 'in_progress', 'started', 'done', 'completed', 'closed', 'cancelled'])
92
92
  .optional()
93
93
  .describe('filter batch delete by status'),
94
94
  type: z
@@ -107,7 +107,7 @@ export const listSubcommand = createCommand({
107
107
  schema: {
108
108
  options: z.object({
109
109
  status: z
110
- .enum(['open', 'in_progress', 'done', 'cancelled'])
110
+ .enum(['open', 'in_progress', 'started', 'done', 'completed', 'closed', 'cancelled'])
111
111
  .optional()
112
112
  .describe('filter by status'),
113
113
  type: z
@@ -56,7 +56,7 @@ export const updateSubcommand = createCommand({
56
56
  .optional()
57
57
  .describe('new task type'),
58
58
  status: z
59
- .enum(['open', 'in_progress', 'done', 'cancelled'])
59
+ .enum(['open', 'in_progress', 'started', 'done', 'completed', 'closed', 'cancelled'])
60
60
  .optional()
61
61
  .describe('new task status'),
62
62
  assignedId: z.string().optional().describe('new assigned agent or user ID'),
@@ -409,6 +409,15 @@ export function createFileWatcher(options: FileWatcherOptions): FileWatcherManag
409
409
  */
410
410
  function resume() {
411
411
  paused = false;
412
+
413
+ // Clear any pending build cooldown timer so file changes are detected immediately.
414
+ // Without this, events arriving during the remaining cooldown window after a fast
415
+ // typecheck failure would be silently dropped.
416
+ if (buildCooldownTimer) {
417
+ clearTimeout(buildCooldownTimer);
418
+ buildCooldownTimer = null;
419
+ }
420
+
412
421
  logger.trace('File watchers resumed');
413
422
  }
414
423
 
@@ -1074,6 +1074,10 @@ export const command = createCommand({
1074
1074
  if (shutdownRequested) {
1075
1075
  return;
1076
1076
  }
1077
+ // Re-enter the main loop to re-typecheck and rebuild
1078
+ // Without this, the code falls through and tries to start the server
1079
+ // with the old/stale bundle instead of rebuilding first
1080
+ continue;
1077
1081
  }
1078
1082
  } catch (error) {
1079
1083
  tui.error(`Failed to build dev bundle: ${error}`);
@@ -1082,15 +1086,18 @@ export const command = createCommand({
1082
1086
  // Resume watcher to detect changes for retry
1083
1087
  fileWatcher.resume();
1084
1088
 
1085
- // Wait for next restart trigger
1089
+ // Wait for next restart trigger or shutdown
1086
1090
  await new Promise<void>((resolve) => {
1087
1091
  const checkRestart = setInterval(() => {
1088
- if (shouldRestart) {
1092
+ if (shouldRestart || shutdownRequested) {
1089
1093
  clearInterval(checkRestart);
1090
1094
  resolve();
1091
1095
  }
1092
1096
  }, 100);
1093
1097
  });
1098
+ if (shutdownRequested) {
1099
+ break;
1100
+ }
1094
1101
  continue;
1095
1102
  }
1096
1103
 
@@ -1169,10 +1176,6 @@ export const command = createCommand({
1169
1176
  noBundle: opts.experimentalNoBundle,
1170
1177
  });
1171
1178
 
1172
- // Wait for app.ts to finish loading (Vite is ready but app may still be initializing)
1173
- // Give it 2 seconds to ensure app initialization completes
1174
- await Bun.sleep(2000);
1175
-
1176
1179
  // Check if shutdown was requested during startup
1177
1180
  if (shutdownRequested) {
1178
1181
  break;
@@ -1181,6 +1184,12 @@ export const command = createCommand({
1181
1184
  tui.error(`Failed to start dev server: ${error}`);
1182
1185
  tui.warning('Waiting for file changes to retry...');
1183
1186
 
1187
+ // Clean up any partially started server resources
1188
+ await cleanupForRestart();
1189
+
1190
+ // Resume watcher to detect changes for retry
1191
+ fileWatcher.resume();
1192
+
1184
1193
  // Wait for next restart trigger or shutdown
1185
1194
  await new Promise<void>((resolve) => {
1186
1195
  const checkRestart = setInterval(() => {