@agentuity/cli 1.0.24 → 1.0.26

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 (152) hide show
  1. package/dist/cache/index.d.ts +1 -0
  2. package/dist/cache/index.d.ts.map +1 -1
  3. package/dist/cache/index.js +1 -0
  4. package/dist/cache/index.js.map +1 -1
  5. package/dist/cache/user-cache.d.ts +20 -0
  6. package/dist/cache/user-cache.d.ts.map +1 -0
  7. package/dist/cache/user-cache.js +79 -0
  8. package/dist/cache/user-cache.js.map +1 -0
  9. package/dist/cmd/auth/logout.d.ts.map +1 -1
  10. package/dist/cmd/auth/logout.js +3 -1
  11. package/dist/cmd/auth/logout.js.map +1 -1
  12. package/dist/cmd/build/entry-generator.d.ts +4 -0
  13. package/dist/cmd/build/entry-generator.d.ts.map +1 -1
  14. package/dist/cmd/build/entry-generator.js +18 -3
  15. package/dist/cmd/build/entry-generator.js.map +1 -1
  16. package/dist/cmd/build/vite/bun-dev-server.d.ts +1 -0
  17. package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
  18. package/dist/cmd/build/vite/bun-dev-server.js +11 -9
  19. package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
  20. package/dist/cmd/cloud/db/stats.d.ts.map +1 -1
  21. package/dist/cmd/cloud/db/stats.js.map +1 -1
  22. package/dist/cmd/cloud/email/create.d.ts.map +1 -1
  23. package/dist/cmd/cloud/email/create.js +2 -7
  24. package/dist/cmd/cloud/email/create.js.map +1 -1
  25. package/dist/cmd/cloud/email/destination/delete.d.ts.map +1 -1
  26. package/dist/cmd/cloud/email/destination/delete.js +5 -1
  27. package/dist/cmd/cloud/email/destination/delete.js.map +1 -1
  28. package/dist/cmd/cloud/email/get.d.ts.map +1 -1
  29. package/dist/cmd/cloud/email/get.js +30 -7
  30. package/dist/cmd/cloud/email/get.js.map +1 -1
  31. package/dist/cmd/cloud/email/list.d.ts.map +1 -1
  32. package/dist/cmd/cloud/email/list.js +0 -6
  33. package/dist/cmd/cloud/email/list.js.map +1 -1
  34. package/dist/cmd/cloud/email/send.d.ts.map +1 -1
  35. package/dist/cmd/cloud/email/send.js +1 -5
  36. package/dist/cmd/cloud/email/send.js.map +1 -1
  37. package/dist/cmd/cloud/email/stats.d.ts.map +1 -1
  38. package/dist/cmd/cloud/email/stats.js.map +1 -1
  39. package/dist/cmd/cloud/email/util.d.ts +0 -1
  40. package/dist/cmd/cloud/email/util.d.ts.map +1 -1
  41. package/dist/cmd/cloud/email/util.js +1 -3
  42. package/dist/cmd/cloud/email/util.js.map +1 -1
  43. package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
  44. package/dist/cmd/cloud/sandbox/snapshot/build.js +4 -1
  45. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
  46. package/dist/cmd/cloud/sandbox/stats.d.ts.map +1 -1
  47. package/dist/cmd/cloud/sandbox/stats.js.map +1 -1
  48. package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -1
  49. package/dist/cmd/cloud/schedule/delete.js +4 -1
  50. package/dist/cmd/cloud/schedule/delete.js.map +1 -1
  51. package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -1
  52. package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -1
  53. package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -1
  54. package/dist/cmd/cloud/schedule/destination/create.js +3 -1
  55. package/dist/cmd/cloud/schedule/destination/create.js.map +1 -1
  56. package/dist/cmd/cloud/schedule/destination/index.d.ts.map +1 -1
  57. package/dist/cmd/cloud/schedule/destination/index.js.map +1 -1
  58. package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -1
  59. package/dist/cmd/cloud/schedule/destination/list.js.map +1 -1
  60. package/dist/cmd/cloud/schedule/get.d.ts.map +1 -1
  61. package/dist/cmd/cloud/schedule/get.js +4 -1
  62. package/dist/cmd/cloud/schedule/get.js.map +1 -1
  63. package/dist/cmd/cloud/schedule/index.d.ts.map +1 -1
  64. package/dist/cmd/cloud/schedule/index.js +4 -1
  65. package/dist/cmd/cloud/schedule/index.js.map +1 -1
  66. package/dist/cmd/cloud/schedule/list.d.ts.map +1 -1
  67. package/dist/cmd/cloud/schedule/list.js.map +1 -1
  68. package/dist/cmd/cloud/schedule/stats.d.ts.map +1 -1
  69. package/dist/cmd/cloud/schedule/stats.js.map +1 -1
  70. package/dist/cmd/cloud/schedule/util.d.ts.map +1 -1
  71. package/dist/cmd/cloud/schedule/util.js +1 -2
  72. package/dist/cmd/cloud/schedule/util.js.map +1 -1
  73. package/dist/cmd/cloud/services/stats.d.ts.map +1 -1
  74. package/dist/cmd/cloud/services/stats.js.map +1 -1
  75. package/dist/cmd/cloud/stream/index.d.ts.map +1 -1
  76. package/dist/cmd/cloud/stream/index.js +7 -1
  77. package/dist/cmd/cloud/stream/index.js.map +1 -1
  78. package/dist/cmd/cloud/stream/stats.d.ts.map +1 -1
  79. package/dist/cmd/cloud/stream/stats.js.map +1 -1
  80. package/dist/cmd/cloud/task/attachment.d.ts +2 -0
  81. package/dist/cmd/cloud/task/attachment.d.ts.map +1 -0
  82. package/dist/cmd/cloud/task/attachment.js +393 -0
  83. package/dist/cmd/cloud/task/attachment.js.map +1 -0
  84. package/dist/cmd/cloud/task/create.d.ts.map +1 -1
  85. package/dist/cmd/cloud/task/create.js +126 -5
  86. package/dist/cmd/cloud/task/create.js.map +1 -1
  87. package/dist/cmd/cloud/task/get.d.ts.map +1 -1
  88. package/dist/cmd/cloud/task/get.js +29 -11
  89. package/dist/cmd/cloud/task/get.js.map +1 -1
  90. package/dist/cmd/cloud/task/index.d.ts.map +1 -1
  91. package/dist/cmd/cloud/task/index.js +13 -1
  92. package/dist/cmd/cloud/task/index.js.map +1 -1
  93. package/dist/cmd/cloud/task/list.d.ts.map +1 -1
  94. package/dist/cmd/cloud/task/list.js +31 -15
  95. package/dist/cmd/cloud/task/list.js.map +1 -1
  96. package/dist/cmd/cloud/task/stats.js +2 -0
  97. package/dist/cmd/cloud/task/stats.js.map +1 -1
  98. package/dist/cmd/cloud/task/util.d.ts.map +1 -1
  99. package/dist/cmd/cloud/task/util.js +2 -4
  100. package/dist/cmd/cloud/task/util.js.map +1 -1
  101. package/dist/cmd/cloud/webhook/create.d.ts.map +1 -1
  102. package/dist/cmd/cloud/webhook/create.js +6 -1
  103. package/dist/cmd/cloud/webhook/create.js.map +1 -1
  104. package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -1
  105. package/dist/cmd/cloud/webhook/deliveries.js +4 -1
  106. package/dist/cmd/cloud/webhook/deliveries.js.map +1 -1
  107. package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -1
  108. package/dist/cmd/cloud/webhook/destinations.js +4 -5
  109. package/dist/cmd/cloud/webhook/destinations.js.map +1 -1
  110. package/dist/cmd/dev/index.d.ts.map +1 -1
  111. package/dist/cmd/dev/index.js +80 -34
  112. package/dist/cmd/dev/index.js.map +1 -1
  113. package/package.json +6 -6
  114. package/src/cache/index.ts +2 -0
  115. package/src/cache/user-cache.ts +93 -0
  116. package/src/cmd/auth/logout.ts +3 -1
  117. package/src/cmd/build/entry-generator.ts +34 -4
  118. package/src/cmd/build/vite/bun-dev-server.ts +21 -9
  119. package/src/cmd/cloud/db/stats.ts +4 -12
  120. package/src/cmd/cloud/email/create.ts +2 -7
  121. package/src/cmd/cloud/email/destination/delete.ts +5 -1
  122. package/src/cmd/cloud/email/get.ts +42 -7
  123. package/src/cmd/cloud/email/list.ts +0 -6
  124. package/src/cmd/cloud/email/send.ts +1 -5
  125. package/src/cmd/cloud/email/stats.ts +2 -6
  126. package/src/cmd/cloud/email/util.ts +1 -3
  127. package/src/cmd/cloud/sandbox/snapshot/build.ts +25 -6
  128. package/src/cmd/cloud/sandbox/stats.ts +2 -6
  129. package/src/cmd/cloud/schedule/delete.ts +4 -1
  130. package/src/cmd/cloud/schedule/delivery/list.ts +15 -13
  131. package/src/cmd/cloud/schedule/destination/create.ts +11 -3
  132. package/src/cmd/cloud/schedule/destination/index.ts +3 -1
  133. package/src/cmd/cloud/schedule/destination/list.ts +19 -17
  134. package/src/cmd/cloud/schedule/get.ts +25 -20
  135. package/src/cmd/cloud/schedule/index.ts +4 -1
  136. package/src/cmd/cloud/schedule/list.ts +18 -16
  137. package/src/cmd/cloud/schedule/stats.ts +1 -3
  138. package/src/cmd/cloud/schedule/util.ts +1 -2
  139. package/src/cmd/cloud/services/stats.ts +13 -39
  140. package/src/cmd/cloud/stream/index.ts +7 -1
  141. package/src/cmd/cloud/stream/stats.ts +2 -6
  142. package/src/cmd/cloud/task/attachment.ts +432 -0
  143. package/src/cmd/cloud/task/create.ts +131 -5
  144. package/src/cmd/cloud/task/get.ts +30 -12
  145. package/src/cmd/cloud/task/index.ts +13 -1
  146. package/src/cmd/cloud/task/list.ts +31 -15
  147. package/src/cmd/cloud/task/stats.ts +3 -3
  148. package/src/cmd/cloud/task/util.ts +2 -4
  149. package/src/cmd/cloud/webhook/create.ts +6 -1
  150. package/src/cmd/cloud/webhook/deliveries.ts +4 -5
  151. package/src/cmd/cloud/webhook/destinations.ts +4 -5
  152. package/src/cmd/dev/index.ts +91 -48
@@ -18,14 +18,27 @@ interface GenerateEntryOptions {
18
18
  workbench?: WorkbenchConfig;
19
19
  analytics?: boolean | AnalyticsConfig;
20
20
  vitePort?: number; // Port of Vite asset server (dev mode only)
21
+ noBundle?: boolean; // Skip bundling — apply runtime patches instead
22
+ /** Pre-discovered routes to avoid redundant route discovery */
23
+ preDiscoveredRoutes?: Awaited<ReturnType<typeof discoverRoutes>>['routeInfoList'];
21
24
  }
22
25
 
23
26
  /**
24
27
  * Generate entry file with clean Vite-native architecture
25
28
  */
26
29
  export async function generateEntryFile(options: GenerateEntryOptions): Promise<void> {
27
- const { rootDir, projectId, deploymentId, logger, mode, workbench, analytics, vitePort } =
28
- options;
30
+ const {
31
+ rootDir,
32
+ projectId,
33
+ deploymentId,
34
+ logger,
35
+ mode,
36
+ workbench,
37
+ analytics,
38
+ vitePort,
39
+ noBundle,
40
+ preDiscoveredRoutes,
41
+ } = options;
29
42
 
30
43
  const srcDir = join(rootDir, 'src');
31
44
  const generatedDir = join(srcDir, 'generated');
@@ -41,8 +54,10 @@ export async function generateEntryFile(options: GenerateEntryOptions): Promise<
41
54
  await generateWebAnalyticsFile({ rootDir, logger, analytics });
42
55
  }
43
56
 
44
- // Discover routes to determine which files need to be imported
45
- const { routeInfoList } = await discoverRoutes(srcDir, projectId, deploymentId, logger);
57
+ // Use pre-discovered routes if available, otherwise discover them
58
+ const routeInfoList =
59
+ preDiscoveredRoutes ??
60
+ (await discoverRoutes(srcDir, projectId, deploymentId, logger)).routeInfoList;
46
61
 
47
62
  // Check for web and workbench
48
63
  const hasWebFrontend =
@@ -87,6 +102,10 @@ export async function generateEntryFile(options: GenerateEntryOptions): Promise<
87
102
  ` runShutdown,`,
88
103
  ];
89
104
 
105
+ if (noBundle) {
106
+ runtimeImports.push(` applyDevPatches,`);
107
+ }
108
+
90
109
  if (hasWebFrontend) {
91
110
  runtimeImports.push(` mimeTypes,`);
92
111
  }
@@ -610,6 +629,15 @@ if (isDevelopment()) {
610
629
  }
611
630
  `;
612
631
 
632
+ const devPatchesStep = noBundle
633
+ ? `
634
+ // Step 0.1: Apply runtime dev patches (--experimental-no-bundle mode)
635
+ // Replaces build-time Bun.build patches for LLM gateway routing, AI SDK telemetry, and OTel spans
636
+ if (isDevelopment()) {
637
+ await applyDevPatches();
638
+ }
639
+ `
640
+ : '';
613
641
  const code = `// @generated
614
642
  // Auto-generated by Agentuity
615
643
  // DO NOT EDIT - This file is regenerated on every build
@@ -626,6 +654,8 @@ if (isDevelopment()) {
626
654
  await bootstrapRuntimeEnv({ projectDir: import.meta.dir + '/../..' });
627
655
  }
628
656
 
657
+ ${devPatchesStep}
658
+
629
659
  // Step 0.25: load our runtime metadata and cache it
630
660
  loadBuildMetadata();
631
661
 
@@ -19,6 +19,7 @@ export interface BunDevServerOptions {
19
19
  inspect?: boolean; // Enable bun debugger
20
20
  inspectWait?: boolean; // Enable bun debugger and wait for connection
21
21
  inspectBrk?: boolean; // Enable bun debugger with breakpoint at first line
22
+ noBundle?: boolean; // Run src/generated/app.ts directly without bundling
22
23
  }
23
24
 
24
25
  export interface BunDevServerResult {
@@ -39,17 +40,28 @@ export interface BunDevServerResult {
39
40
  * as a subprocess to enable passing the debugger CLI flags.
40
41
  */
41
42
  export async function startBunDevServer(options: BunDevServerOptions): Promise<BunDevServerResult> {
42
- const { rootDir, port = 3500, logger, vitePort, inspect, inspectWait, inspectBrk } = options;
43
+ const {
44
+ rootDir,
45
+ port = 3500,
46
+ logger,
47
+ vitePort,
48
+ inspect,
49
+ inspectWait,
50
+ inspectBrk,
51
+ noBundle,
52
+ } = options;
43
53
 
44
54
  logger.debug('Starting Bun dev server (Vite already running on port %d)...', vitePort);
45
55
 
46
- const appPath = `${rootDir}/.agentuity/app.js`;
56
+ const appPath = noBundle ? `${rootDir}/src/generated/app.ts` : `${rootDir}/.agentuity/app.js`;
47
57
 
48
- // Verify bundle exists before attempting to load
58
+ // Verify entry file exists before attempting to load
49
59
  const appFile = Bun.file(appPath);
50
60
  if (!(await appFile.exists())) {
51
61
  throw new Error(
52
- `Dev bundle not found at ${appPath}. The bundle must be generated before starting the dev server.`
62
+ noBundle
63
+ ? `Generated entry not found at ${appPath}. Run the dev command to generate it.`
64
+ : `Dev bundle not found at ${appPath}. The bundle must be generated before starting the dev server.`
53
65
  );
54
66
  }
55
67
 
@@ -126,11 +138,11 @@ export async function startBunDevServer(options: BunDevServerOptions): Promise<B
126
138
  logger.debug(`Bun dev server started on http://127.0.0.1:${port} with debugger enabled`);
127
139
  logger.debug(`Asset requests (/@vite/*, /src/web/*, etc.) proxied to Vite:${vitePort}`);
128
140
  } else {
129
- // Load the bundled app - this will start Bun.serve() internally
130
- // IMPORTANT: We must import the bundled .agentuity/app.js (NOT src/generated/app.ts)
131
- // because the bundled version has LLM provider patches applied that enable AI Gateway routing.
132
- // Importing the source file directly would bypass these patches.
133
- logger.debug('📦 Loading bundled app (Bun server will start)...');
141
+ // Load the app entry - this will start Bun.serve() internally
142
+ // In bundle mode: imports .agentuity/app.js (with build-time LLM patches)
143
+ // In no-bundle mode: imports src/generated/app.ts directly (with runtime patches)
144
+ logger.debug('Loading app from: %s (noBundle: %s)', appPath, !!noBundle);
145
+ logger.debug('📦 Loading app entry (Bun server will start)...');
134
146
 
135
147
  // Import the generated app with cache-busting query parameter.
136
148
  // Bun's module cache is keyed by the full specifier including query string,
@@ -19,18 +19,10 @@ function displayStats(data: ServiceStatsData): void {
19
19
  }
20
20
  tui.header('Database Statistics');
21
21
  tui.newline();
22
- console.log(
23
- ` ${tui.muted('Databases:')} ${formatNumber(svc.databaseCount)}`
24
- );
25
- console.log(
26
- ` ${tui.muted('Tables:')} ${formatNumber(svc.totalTableCount)}`
27
- );
28
- console.log(
29
- ` ${tui.muted('Records:')} ${formatNumber(svc.totalRecordCount)}`
30
- );
31
- console.log(
32
- ` ${tui.muted('Total Size:')} ${tui.formatBytes(svc.totalSizeBytes)}`
33
- );
22
+ console.log(` ${tui.muted('Databases:')} ${formatNumber(svc.databaseCount)}`);
23
+ console.log(` ${tui.muted('Tables:')} ${formatNumber(svc.totalTableCount)}`);
24
+ console.log(` ${tui.muted('Records:')} ${formatNumber(svc.totalRecordCount)}`);
25
+ console.log(` ${tui.muted('Total Size:')} ${tui.formatBytes(svc.totalSizeBytes)}`);
34
26
  }
35
27
 
36
28
  export const statsSubcommand = createCommand({
@@ -14,10 +14,7 @@ export const createSubcommand = createCommand({
14
14
  requires: { auth: true },
15
15
  schema: {
16
16
  options: z.object({
17
- localPart: z
18
- .string()
19
- .optional()
20
- .describe('Local part for the email address (before @)'),
17
+ localPart: z.string().optional().describe('Local part for the email address (before @)'),
21
18
  }),
22
19
  response: EmailAddressSchema,
23
20
  },
@@ -63,12 +60,10 @@ export const createSubcommand = createCommand({
63
60
  {
64
61
  ID: address.id,
65
62
  Email: address.email,
66
- Project: address.project_id ?? '-',
67
- Provider: address.provider ?? '-',
68
63
  Created: new Date(address.created_at).toLocaleString(),
69
64
  },
70
65
  ],
71
- ['ID', 'Email', 'Project', 'Provider', 'Created'],
66
+ ['ID', 'Email', 'Created'],
72
67
  { layout: 'vertical', padStart: ' ' }
73
68
  );
74
69
  }
@@ -43,7 +43,11 @@ export const deleteSubcommand = createCommand({
43
43
  );
44
44
  if (!ok) {
45
45
  tui.info('Cancelled');
46
- return { success: false, address_id: args.address_id, destination_id: args.destination_id };
46
+ return {
47
+ success: false,
48
+ address_id: args.address_id,
49
+ destination_id: args.destination_id,
50
+ };
47
51
  }
48
52
  }
49
53
 
@@ -19,6 +19,7 @@ export const getSubcommand = createCommand({
19
19
  const { args, options } = ctx;
20
20
  const email = await createEmailAdapter(ctx);
21
21
  const address = await email.getAddress(args.id);
22
+ const connection = await email.getConnectionConfig(args.id);
22
23
 
23
24
  if (!address) {
24
25
  tui.fatal(`Email address not found: ${args.id}`);
@@ -26,23 +27,57 @@ export const getSubcommand = createCommand({
26
27
 
27
28
  if (!options.json) {
28
29
  tui.success(`Email Address: ${tui.bold(address.email)}`);
30
+ console.log('');
29
31
  tui.table(
30
32
  [
31
33
  {
32
34
  ID: address.id,
33
35
  Email: address.email,
34
- Project: address.project_id ?? '-',
35
- Provider: address.provider ?? '-',
36
- Config: address.config ? JSON.stringify(address.config) : '-',
37
36
  Created: new Date(address.created_at).toLocaleString(),
38
- Updated: address.updated_at
39
- ? new Date(address.updated_at).toLocaleString()
40
- : '-',
41
37
  },
42
38
  ],
43
- ['ID', 'Email', 'Project', 'Provider', 'Config', 'Created', 'Updated'],
39
+ ['ID', 'Email', 'Created'],
44
40
  { layout: 'vertical', padStart: ' ' }
45
41
  );
42
+
43
+ if (connection) {
44
+ const formatTLS = (tls: string) =>
45
+ tls.length > 0 ? `${tls.charAt(0).toUpperCase()}${tls.slice(1)}` : '-';
46
+
47
+ console.log('');
48
+ console.log(` ${tui.bold('IMAP Connection')}`);
49
+ console.log(` ${tui.muted('─────────────────')}`);
50
+ tui.table(
51
+ [
52
+ {
53
+ Host: connection.imap.host,
54
+ Port: connection.imap.port,
55
+ TLS: formatTLS(connection.imap.tls),
56
+ Username: connection.imap.username,
57
+ Password: connection.imap.password,
58
+ },
59
+ ],
60
+ ['Host', 'Port', 'TLS', 'Username', 'Password'],
61
+ { layout: 'vertical', padStart: ' ' }
62
+ );
63
+
64
+ console.log('');
65
+ console.log(` ${tui.bold('POP3 Connection')}`);
66
+ console.log(` ${tui.muted('─────────────────')}`);
67
+ tui.table(
68
+ [
69
+ {
70
+ Host: connection.pop3.host,
71
+ Port: connection.pop3.port,
72
+ TLS: formatTLS(connection.pop3.tls),
73
+ Username: connection.pop3.username,
74
+ Password: connection.pop3.password,
75
+ },
76
+ ],
77
+ ['Host', 'Port', 'TLS', 'Username', 'Password'],
78
+ { layout: 'vertical', padStart: ' ' }
79
+ );
80
+ }
46
81
  }
47
82
 
48
83
  return address;
@@ -23,15 +23,11 @@ export const listSubcommand = createCommand({
23
23
  addresses.map((item) => ({
24
24
  ID: item.id,
25
25
  Email: item.email,
26
- Project: item.project_id ?? '-',
27
- Provider: item.provider ?? '-',
28
26
  Created: new Date(item.created_at).toLocaleString(),
29
27
  })),
30
28
  [
31
29
  { name: 'ID', alignment: 'left' },
32
30
  { name: 'Email', alignment: 'left' },
33
- { name: 'Project', alignment: 'left' },
34
- { name: 'Provider', alignment: 'left' },
35
31
  { name: 'Created', alignment: 'left' },
36
32
  ]
37
33
  );
@@ -40,8 +36,6 @@ export const listSubcommand = createCommand({
40
36
  return addresses.map((item) => ({
41
37
  id: item.id,
42
38
  email: item.email,
43
- project_id: item.project_id,
44
- provider: item.provider,
45
39
  created_at: item.created_at,
46
40
  updated_at: item.updated_at,
47
41
  }));
@@ -32,11 +32,7 @@ export const sendSubcommand = createCommand({
32
32
  tui.fatal('At least one of --text or --html is required');
33
33
  }
34
34
 
35
- const fileValues = Array.isArray(opts.file)
36
- ? opts.file
37
- : opts.file
38
- ? [opts.file]
39
- : [];
35
+ const fileValues = Array.isArray(opts.file) ? opts.file : opts.file ? [opts.file] : [];
40
36
 
41
37
  const attachments: EmailAttachment[] = [];
42
38
  for (const filePath of fileValues) {
@@ -19,12 +19,8 @@ function displayStats(data: ServiceStatsData): void {
19
19
  }
20
20
  tui.header('Email Statistics');
21
21
  tui.newline();
22
- console.log(
23
- ` ${tui.muted('Addresses:')} ${formatNumber(svc.addressCount)}`
24
- );
25
- console.log(
26
- ` ${tui.muted('Inbound:')} ${formatNumber(svc.inboundCount)}`
27
- );
22
+ console.log(` ${tui.muted('Addresses:')} ${formatNumber(svc.addressCount)}`);
23
+ console.log(` ${tui.muted('Inbound:')} ${formatNumber(svc.inboundCount)}`);
28
24
  console.log(
29
25
  ` ${tui.muted('Outbound:')} ${formatNumber(svc.outboundCount)} (${svc.outboundSuccess} ok, ${svc.outboundFailed} failed)`
30
26
  );
@@ -24,8 +24,7 @@ export interface EmailContext {
24
24
 
25
25
  export function resolveEmailOrgId(ctx: EmailContext): string {
26
26
  const orgId =
27
- ctx.options.orgId ??
28
- (process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
27
+ ctx.options.orgId ?? (process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
29
28
 
30
29
  if (!orgId) {
31
30
  tui.fatal('Organization ID is required. Use --org-id flag or set AGENTUITY_CLOUD_ORG_ID.');
@@ -37,7 +36,6 @@ export function resolveEmailOrgId(ctx: EmailContext): string {
37
36
  export const EmailAddressSchema = z.object({
38
37
  id: z.string(),
39
38
  email: z.string(),
40
- project_id: z.string().optional(),
41
39
  provider: z.string().optional(),
42
40
  config: z.record(z.string(), z.unknown()).optional(),
43
41
  created_at: z.string(),
@@ -358,7 +358,9 @@ export const buildSubcommand = createCommand({
358
358
  description: 'Build using a custom build file',
359
359
  },
360
360
  {
361
- command: getCommand('cloud sandbox snapshot build . --env API_KEY=secret --tag production'),
361
+ command: getCommand(
362
+ 'cloud sandbox snapshot build . --env API_KEY=secret --tag production'
363
+ ),
362
364
  description: 'Build with environment variable substitution and custom tag',
363
365
  },
364
366
  {
@@ -379,7 +381,10 @@ export const buildSubcommand = createCommand({
379
381
  .string()
380
382
  .optional()
381
383
  .describe('Path to build file (defaults to agentuity-snapshot.[json|yaml|yml])'),
382
- env: z.array(z.string()).optional().describe('Environment variable substitution (KEY=VALUE)'),
384
+ env: z
385
+ .array(z.string())
386
+ .optional()
387
+ .describe('Environment variable substitution (KEY=VALUE)'),
383
388
  name: z.string().optional().describe('Snapshot name (overrides build file)'),
384
389
  tag: z.string().optional().describe('Snapshot tag (defaults to "latest")'),
385
390
  description: z.string().optional().describe('Snapshot description (overrides build file)'),
@@ -529,7 +534,9 @@ export const buildSubcommand = createCommand({
529
534
 
530
535
  if (opts.tag) {
531
536
  if (opts.tag.length > MAX_SNAPSHOT_TAG_LENGTH) {
532
- logger.fatal(`Invalid snapshot tag: must be at most ${MAX_SNAPSHOT_TAG_LENGTH} characters`);
537
+ logger.fatal(
538
+ `Invalid snapshot tag: must be at most ${MAX_SNAPSHOT_TAG_LENGTH} characters`
539
+ );
533
540
  }
534
541
  if (!SNAPSHOT_TAG_REGEX.test(opts.tag)) {
535
542
  logger.fatal(
@@ -576,7 +583,12 @@ export const buildSubcommand = createCommand({
576
583
  message: 'Validating apt dependencies...',
577
584
  type: 'simple',
578
585
  callback: async () => {
579
- return await validateAptDependencies(buildConfig.dependencies!, region, config, logger);
586
+ return await validateAptDependencies(
587
+ buildConfig.dependencies!,
588
+ region,
589
+ config,
590
+ logger
591
+ );
580
592
  },
581
593
  });
582
594
 
@@ -890,7 +902,11 @@ export const buildSubcommand = createCommand({
890
902
  clearOnError: true,
891
903
  callback: async (updateProgress) => {
892
904
  const uploadFile = Bun.file(uploadPath);
893
- const progressStream = createProgressStream(uploadFile, uploadSize, updateProgress);
905
+ const progressStream = createProgressStream(
906
+ uploadFile,
907
+ uploadSize,
908
+ updateProgress
909
+ );
894
910
  await snapshotUpload(client, {
895
911
  snapshotId: initResult.snapshotId!,
896
912
  body: progressStream,
@@ -933,7 +949,10 @@ export const buildSubcommand = createCommand({
933
949
  'Malware Detected',
934
950
  `Your snapshot was rejected because it contains malware.\n\nVirus: ${virusName}\n\nPlease remove the infected files and try again.`
935
951
  );
936
- tui.fatal('Snapshot build failed due to malware detection', ErrorCode.MALWARE_DETECTED);
952
+ tui.fatal(
953
+ 'Snapshot build failed due to malware detection',
954
+ ErrorCode.MALWARE_DETECTED
955
+ );
937
956
  }
938
957
 
939
958
  throw err;
@@ -27,13 +27,9 @@ function displayStats(data: ServiceStatsData): void {
27
27
  console.log(
28
28
  ` ${tui.muted('Active:')} ${formatNumber(svc.totalActive)} (${svc.running} running, ${svc.idle} idle, ${svc.creating} creating)`
29
29
  );
30
- console.log(
31
- ` ${tui.muted('Executions:')} ${formatNumber(svc.totalExecutions)}`
32
- );
30
+ console.log(` ${tui.muted('Executions:')} ${formatNumber(svc.totalExecutions)}`);
33
31
  console.log(` ${tui.muted('CPU Time:')} ${formatLatency(svc.totalCpuTimeMs)}`);
34
- console.log(
35
- ` ${tui.muted('Memory:')} ${tui.formatBytes(svc.totalMemoryByteSec)}`
36
- );
32
+ console.log(` ${tui.muted('Memory:')} ${tui.formatBytes(svc.totalMemoryByteSec)}`);
37
33
  console.log(
38
34
  ` ${tui.muted('Network Out:')} ${tui.formatBytes(svc.totalNetworkEgressBytes)}`
39
35
  );
@@ -17,7 +17,10 @@ export const deleteSubcommand = createCommand({
17
17
  requires: { auth: true },
18
18
  idempotent: true,
19
19
  examples: [
20
- { command: getCommand('cloud schedule delete sched_abc123'), description: 'Delete a schedule' },
20
+ {
21
+ command: getCommand('cloud schedule delete sched_abc123'),
22
+ description: 'Delete a schedule',
23
+ },
21
24
  ],
22
25
  schema: {
23
26
  args: z.object({
@@ -56,19 +56,21 @@ export const listSubcommand = createCommand({
56
56
  tui.info('No deliveries found');
57
57
  } else {
58
58
  tui.table(
59
- result.deliveries.map((delivery: {
60
- id: string;
61
- date: string;
62
- status: 'pending' | 'success' | 'failed';
63
- retries: number;
64
- schedule_destination_id: string;
65
- }) => ({
66
- ID: delivery.id,
67
- Date: new Date(delivery.date).toLocaleString(),
68
- Status: delivery.status,
69
- Retries: delivery.retries,
70
- 'Destination ID': delivery.schedule_destination_id,
71
- })),
59
+ result.deliveries.map(
60
+ (delivery: {
61
+ id: string;
62
+ date: string;
63
+ status: 'pending' | 'success' | 'failed';
64
+ retries: number;
65
+ schedule_destination_id: string;
66
+ }) => ({
67
+ ID: delivery.id,
68
+ Date: new Date(delivery.date).toLocaleString(),
69
+ Status: delivery.status,
70
+ Retries: delivery.retries,
71
+ 'Destination ID': delivery.schedule_destination_id,
72
+ })
73
+ ),
72
74
  ['ID', 'Date', 'Status', 'Retries', 'Destination ID']
73
75
  );
74
76
  }
@@ -23,11 +23,15 @@ export const createSubcommand = createCommand({
23
23
  requires: { auth: true },
24
24
  examples: [
25
25
  {
26
- command: getCommand('cloud schedule destination create url sched_abc123 https://example.com'),
26
+ command: getCommand(
27
+ 'cloud schedule destination create url sched_abc123 https://example.com'
28
+ ),
27
29
  description: 'Create URL destination',
28
30
  },
29
31
  {
30
- command: getCommand('cloud schedule destination create url sched_abc123 https://example.com --method POST'),
32
+ command: getCommand(
33
+ 'cloud schedule destination create url sched_abc123 https://example.com --method POST'
34
+ ),
31
35
  description: 'Create URL destination with POST method',
32
36
  },
33
37
  ],
@@ -52,7 +56,11 @@ export const createSubcommand = createCommand({
52
56
  if (args.type === 'sandbox' && !args.target.startsWith('sbx_')) {
53
57
  tui.fatal('Sandbox target must start with "sbx_"');
54
58
  }
55
- if (args.type === 'url' && !args.target.startsWith('http://') && !args.target.startsWith('https://')) {
59
+ if (
60
+ args.type === 'url' &&
61
+ !args.target.startsWith('http://') &&
62
+ !args.target.startsWith('https://')
63
+ ) {
56
64
  tui.fatal('URL target must start with http:// or https://');
57
65
  }
58
66
 
@@ -18,7 +18,9 @@ export const command = createCommand({
18
18
  description: 'List destinations',
19
19
  },
20
20
  {
21
- command: getCommand('cloud schedule destination create url sched_abc123 https://example.com'),
21
+ command: getCommand(
22
+ 'cloud schedule destination create url sched_abc123 https://example.com'
23
+ ),
22
24
  description: 'Create URL destination',
23
25
  },
24
26
  ],
@@ -48,23 +48,25 @@ export const listSubcommand = createCommand({
48
48
  tui.info('No destinations configured');
49
49
  } else {
50
50
  tui.table(
51
- result.destinations.map((destination: {
52
- id: string;
53
- type: 'url' | 'sandbox';
54
- config: Record<string, unknown>;
55
- created_at: string;
56
- }) => {
57
- const configDisplay =
58
- destination.type === 'url' && destination.config?.url
59
- ? String(destination.config.url)
60
- : JSON.stringify(destination.config);
61
- return {
62
- ID: destination.id,
63
- Type: destination.type,
64
- URL: configDisplay,
65
- Created: new Date(destination.created_at).toLocaleString(),
66
- };
67
- }),
51
+ result.destinations.map(
52
+ (destination: {
53
+ id: string;
54
+ type: 'url' | 'sandbox';
55
+ config: Record<string, unknown>;
56
+ created_at: string;
57
+ }) => {
58
+ const configDisplay =
59
+ destination.type === 'url' && destination.config?.url
60
+ ? String(destination.config.url)
61
+ : JSON.stringify(destination.config);
62
+ return {
63
+ ID: destination.id,
64
+ Type: destination.type,
65
+ URL: configDisplay,
66
+ Created: new Date(destination.created_at).toLocaleString(),
67
+ };
68
+ }
69
+ ),
68
70
  ['ID', 'Type', 'URL', 'Created']
69
71
  );
70
72
  }
@@ -34,9 +34,12 @@ export const getSubcommand = createCommand({
34
34
  tags: ['read-only', 'fast', 'requires-auth'],
35
35
  requires: { auth: true },
36
36
  idempotent: true,
37
- examples: [
38
- { command: getCommand('cloud schedule get sched_abc123'), description: 'Get schedule details' },
39
- ],
37
+ examples: [
38
+ {
39
+ command: getCommand('cloud schedule get sched_abc123'),
40
+ description: 'Get schedule details',
41
+ },
42
+ ],
40
43
  schema: {
41
44
  args: z.object({
42
45
  schedule_id: z.string().min(1).describe('Schedule ID'),
@@ -68,23 +71,25 @@ export const getSubcommand = createCommand({
68
71
  tui.info('No destinations configured');
69
72
  } else {
70
73
  tui.table(
71
- result.destinations.map((destination: {
72
- id: string;
73
- type: 'url' | 'sandbox';
74
- config: Record<string, unknown>;
75
- created_at: string;
76
- }) => {
77
- const configDisplay =
78
- destination.type === 'url' && destination.config?.url
79
- ? String(destination.config.url)
80
- : JSON.stringify(destination.config);
81
- return {
82
- ID: destination.id,
83
- Type: destination.type,
84
- URL: configDisplay,
85
- Created: new Date(destination.created_at).toLocaleString(),
86
- };
87
- }),
74
+ result.destinations.map(
75
+ (destination: {
76
+ id: string;
77
+ type: 'url' | 'sandbox';
78
+ config: Record<string, unknown>;
79
+ created_at: string;
80
+ }) => {
81
+ const configDisplay =
82
+ destination.type === 'url' && destination.config?.url
83
+ ? String(destination.config.url)
84
+ : JSON.stringify(destination.config);
85
+ return {
86
+ ID: destination.id,
87
+ Type: destination.type,
88
+ URL: configDisplay,
89
+ Created: new Date(destination.created_at).toLocaleString(),
90
+ };
91
+ }
92
+ ),
88
93
  ['ID', 'Type', 'URL', 'Created']
89
94
  );
90
95
  }
@@ -31,7 +31,10 @@ export const command = createCommand({
31
31
  command: getCommand("cloud schedule create --name nightly --expression '0 0 * * *'"),
32
32
  description: 'Create a schedule',
33
33
  },
34
- { command: getCommand('cloud schedule get sched_abc123'), description: 'Get schedule details' },
34
+ {
35
+ command: getCommand('cloud schedule get sched_abc123'),
36
+ description: 'Get schedule details',
37
+ },
35
38
  ],
36
39
  });
37
40