@agentuity/cli 0.1.15 → 0.1.17

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 (255) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +18 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cmd/ai/opencode/install.js +1 -1
  5. package/dist/cmd/ai/opencode/install.js.map +1 -1
  6. package/dist/cmd/build/ast.d.ts.map +1 -1
  7. package/dist/cmd/build/ast.js +68 -2
  8. package/dist/cmd/build/ast.js.map +1 -1
  9. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  10. package/dist/cmd/build/vite/registry-generator.js +112 -23
  11. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  12. package/dist/cmd/build/vite/route-discovery.d.ts +4 -0
  13. package/dist/cmd/build/vite/route-discovery.d.ts.map +1 -1
  14. package/dist/cmd/build/vite/route-discovery.js +4 -0
  15. package/dist/cmd/build/vite/route-discovery.js.map +1 -1
  16. package/dist/cmd/cloud/env/delete.d.ts.map +1 -1
  17. package/dist/cmd/cloud/env/delete.js +93 -34
  18. package/dist/cmd/cloud/env/delete.js.map +1 -1
  19. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  20. package/dist/cmd/cloud/env/get.js +53 -16
  21. package/dist/cmd/cloud/env/get.js.map +1 -1
  22. package/dist/cmd/cloud/env/import.d.ts.map +1 -1
  23. package/dist/cmd/cloud/env/import.js +80 -39
  24. package/dist/cmd/cloud/env/import.js.map +1 -1
  25. package/dist/cmd/cloud/env/index.d.ts.map +1 -1
  26. package/dist/cmd/cloud/env/index.js +6 -2
  27. package/dist/cmd/cloud/env/index.js.map +1 -1
  28. package/dist/cmd/cloud/env/list.d.ts.map +1 -1
  29. package/dist/cmd/cloud/env/list.js +99 -23
  30. package/dist/cmd/cloud/env/list.js.map +1 -1
  31. package/dist/cmd/cloud/env/org-util.d.ts +16 -0
  32. package/dist/cmd/cloud/env/org-util.d.ts.map +1 -0
  33. package/dist/cmd/cloud/env/org-util.js +28 -0
  34. package/dist/cmd/cloud/env/org-util.js.map +1 -0
  35. package/dist/cmd/cloud/env/pull.d.ts.map +1 -1
  36. package/dist/cmd/cloud/env/pull.js +61 -29
  37. package/dist/cmd/cloud/env/pull.js.map +1 -1
  38. package/dist/cmd/cloud/env/push.d.ts.map +1 -1
  39. package/dist/cmd/cloud/env/push.js +70 -30
  40. package/dist/cmd/cloud/env/push.js.map +1 -1
  41. package/dist/cmd/cloud/env/set.d.ts.map +1 -1
  42. package/dist/cmd/cloud/env/set.js +72 -26
  43. package/dist/cmd/cloud/env/set.js.map +1 -1
  44. package/dist/cmd/cloud/index.d.ts.map +1 -1
  45. package/dist/cmd/cloud/index.js +2 -0
  46. package/dist/cmd/cloud/index.js.map +1 -1
  47. package/dist/cmd/cloud/keyvalue/create-namespace.js +1 -1
  48. package/dist/cmd/cloud/keyvalue/create-namespace.js.map +1 -1
  49. package/dist/cmd/cloud/keyvalue/delete-namespace.js +2 -2
  50. package/dist/cmd/cloud/keyvalue/delete-namespace.js.map +1 -1
  51. package/dist/cmd/cloud/keyvalue/delete.js +1 -1
  52. package/dist/cmd/cloud/keyvalue/delete.js.map +1 -1
  53. package/dist/cmd/cloud/keyvalue/get.js +1 -1
  54. package/dist/cmd/cloud/keyvalue/get.js.map +1 -1
  55. package/dist/cmd/cloud/keyvalue/index.js +1 -1
  56. package/dist/cmd/cloud/keyvalue/index.js.map +1 -1
  57. package/dist/cmd/cloud/keyvalue/keys.js +1 -1
  58. package/dist/cmd/cloud/keyvalue/keys.js.map +1 -1
  59. package/dist/cmd/cloud/keyvalue/list-namespaces.js +1 -1
  60. package/dist/cmd/cloud/keyvalue/list-namespaces.js.map +1 -1
  61. package/dist/cmd/cloud/keyvalue/repl.d.ts.map +1 -1
  62. package/dist/cmd/cloud/keyvalue/repl.js +8 -5
  63. package/dist/cmd/cloud/keyvalue/repl.js.map +1 -1
  64. package/dist/cmd/cloud/keyvalue/search.js +1 -1
  65. package/dist/cmd/cloud/keyvalue/search.js.map +1 -1
  66. package/dist/cmd/cloud/keyvalue/set.js +1 -1
  67. package/dist/cmd/cloud/keyvalue/set.js.map +1 -1
  68. package/dist/cmd/cloud/keyvalue/stats.js +1 -1
  69. package/dist/cmd/cloud/keyvalue/stats.js.map +1 -1
  70. package/dist/cmd/cloud/keyvalue/util.d.ts +4 -4
  71. package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
  72. package/dist/cmd/cloud/keyvalue/util.js +4 -9
  73. package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
  74. package/dist/cmd/cloud/queue/ack.d.ts +3 -0
  75. package/dist/cmd/cloud/queue/ack.d.ts.map +1 -0
  76. package/dist/cmd/cloud/queue/ack.js +45 -0
  77. package/dist/cmd/cloud/queue/ack.js.map +1 -0
  78. package/dist/cmd/cloud/queue/create.d.ts +3 -0
  79. package/dist/cmd/cloud/queue/create.d.ts.map +1 -0
  80. package/dist/cmd/cloud/queue/create.js +80 -0
  81. package/dist/cmd/cloud/queue/create.js.map +1 -0
  82. package/dist/cmd/cloud/queue/delete.d.ts +3 -0
  83. package/dist/cmd/cloud/queue/delete.d.ts.map +1 -0
  84. package/dist/cmd/cloud/queue/delete.js +50 -0
  85. package/dist/cmd/cloud/queue/delete.js.map +1 -0
  86. package/dist/cmd/cloud/queue/destinations.d.ts +3 -0
  87. package/dist/cmd/cloud/queue/destinations.d.ts.map +1 -0
  88. package/dist/cmd/cloud/queue/destinations.js +232 -0
  89. package/dist/cmd/cloud/queue/destinations.js.map +1 -0
  90. package/dist/cmd/cloud/queue/dlq.d.ts +3 -0
  91. package/dist/cmd/cloud/queue/dlq.d.ts.map +1 -0
  92. package/dist/cmd/cloud/queue/dlq.js +168 -0
  93. package/dist/cmd/cloud/queue/dlq.js.map +1 -0
  94. package/dist/cmd/cloud/queue/get.d.ts +3 -0
  95. package/dist/cmd/cloud/queue/get.d.ts.map +1 -0
  96. package/dist/cmd/cloud/queue/get.js +130 -0
  97. package/dist/cmd/cloud/queue/get.js.map +1 -0
  98. package/dist/cmd/cloud/queue/index.d.ts +3 -0
  99. package/dist/cmd/cloud/queue/index.d.ts.map +1 -0
  100. package/dist/cmd/cloud/queue/index.js +65 -0
  101. package/dist/cmd/cloud/queue/index.js.map +1 -0
  102. package/dist/cmd/cloud/queue/list.d.ts +3 -0
  103. package/dist/cmd/cloud/queue/list.d.ts.map +1 -0
  104. package/dist/cmd/cloud/queue/list.js +71 -0
  105. package/dist/cmd/cloud/queue/list.js.map +1 -0
  106. package/dist/cmd/cloud/queue/messages.d.ts +3 -0
  107. package/dist/cmd/cloud/queue/messages.d.ts.map +1 -0
  108. package/dist/cmd/cloud/queue/messages.js +137 -0
  109. package/dist/cmd/cloud/queue/messages.js.map +1 -0
  110. package/dist/cmd/cloud/queue/nack.d.ts +3 -0
  111. package/dist/cmd/cloud/queue/nack.d.ts.map +1 -0
  112. package/dist/cmd/cloud/queue/nack.js +45 -0
  113. package/dist/cmd/cloud/queue/nack.js.map +1 -0
  114. package/dist/cmd/cloud/queue/pause.d.ts +3 -0
  115. package/dist/cmd/cloud/queue/pause.d.ts.map +1 -0
  116. package/dist/cmd/cloud/queue/pause.js +36 -0
  117. package/dist/cmd/cloud/queue/pause.js.map +1 -0
  118. package/dist/cmd/cloud/queue/publish.d.ts +3 -0
  119. package/dist/cmd/cloud/queue/publish.d.ts.map +1 -0
  120. package/dist/cmd/cloud/queue/publish.js +76 -0
  121. package/dist/cmd/cloud/queue/publish.js.map +1 -0
  122. package/dist/cmd/cloud/queue/receive.d.ts +3 -0
  123. package/dist/cmd/cloud/queue/receive.d.ts.map +1 -0
  124. package/dist/cmd/cloud/queue/receive.js +67 -0
  125. package/dist/cmd/cloud/queue/receive.js.map +1 -0
  126. package/dist/cmd/cloud/queue/resume.d.ts +3 -0
  127. package/dist/cmd/cloud/queue/resume.d.ts.map +1 -0
  128. package/dist/cmd/cloud/queue/resume.js +35 -0
  129. package/dist/cmd/cloud/queue/resume.js.map +1 -0
  130. package/dist/cmd/cloud/queue/sources.d.ts +3 -0
  131. package/dist/cmd/cloud/queue/sources.d.ts.map +1 -0
  132. package/dist/cmd/cloud/queue/sources.js +290 -0
  133. package/dist/cmd/cloud/queue/sources.js.map +1 -0
  134. package/dist/cmd/cloud/queue/stats.d.ts +3 -0
  135. package/dist/cmd/cloud/queue/stats.d.ts.map +1 -0
  136. package/dist/cmd/cloud/queue/stats.js +239 -0
  137. package/dist/cmd/cloud/queue/stats.js.map +1 -0
  138. package/dist/cmd/cloud/queue/util.d.ts +26 -0
  139. package/dist/cmd/cloud/queue/util.d.ts.map +1 -0
  140. package/dist/cmd/cloud/queue/util.js +19 -0
  141. package/dist/cmd/cloud/queue/util.js.map +1 -0
  142. package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
  143. package/dist/cmd/cloud/sandbox/snapshot/build.js +122 -28
  144. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
  145. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  146. package/dist/cmd/cloud/sandbox/snapshot/create.js +19 -7
  147. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  148. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
  149. package/dist/cmd/cloud/sandbox/snapshot/get.js +16 -0
  150. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  151. package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
  152. package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -0
  153. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  154. package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
  155. package/dist/cmd/cloud/vector/stats.js +8 -0
  156. package/dist/cmd/cloud/vector/stats.js.map +1 -1
  157. package/dist/cmd/project/create.d.ts.map +1 -1
  158. package/dist/cmd/project/create.js +12 -0
  159. package/dist/cmd/project/create.js.map +1 -1
  160. package/dist/cmd/project/template-flow.d.ts +3 -0
  161. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  162. package/dist/cmd/project/template-flow.js +157 -68
  163. package/dist/cmd/project/template-flow.js.map +1 -1
  164. package/dist/cmd/setup/index.d.ts.map +1 -1
  165. package/dist/cmd/setup/index.js +2 -1
  166. package/dist/cmd/setup/index.js.map +1 -1
  167. package/dist/env-util.d.ts +6 -1
  168. package/dist/env-util.d.ts.map +1 -1
  169. package/dist/env-util.js +16 -2
  170. package/dist/env-util.js.map +1 -1
  171. package/dist/errors.d.ts +4 -2
  172. package/dist/errors.d.ts.map +1 -1
  173. package/dist/errors.js +6 -0
  174. package/dist/errors.js.map +1 -1
  175. package/dist/onboarding/agentPrompt.d.ts +8 -0
  176. package/dist/onboarding/agentPrompt.d.ts.map +1 -0
  177. package/dist/onboarding/agentPrompt.js +263 -0
  178. package/dist/onboarding/agentPrompt.js.map +1 -0
  179. package/dist/schema-generator.d.ts +1 -1
  180. package/dist/schema-generator.d.ts.map +1 -1
  181. package/dist/schema-parser.d.ts +1 -1
  182. package/dist/schema-parser.d.ts.map +1 -1
  183. package/dist/schema-parser.js +36 -1
  184. package/dist/schema-parser.js.map +1 -1
  185. package/dist/tui/box.d.ts +4 -0
  186. package/dist/tui/box.d.ts.map +1 -1
  187. package/dist/tui/box.js +39 -0
  188. package/dist/tui/box.js.map +1 -1
  189. package/dist/tui.d.ts +11 -1
  190. package/dist/tui.d.ts.map +1 -1
  191. package/dist/tui.js +33 -15
  192. package/dist/tui.js.map +1 -1
  193. package/dist/types.d.ts.map +1 -1
  194. package/dist/types.js.map +1 -1
  195. package/package.json +6 -6
  196. package/src/cli.ts +19 -2
  197. package/src/cmd/ai/opencode/install.ts +1 -1
  198. package/src/cmd/build/ast.ts +88 -2
  199. package/src/cmd/build/vite/registry-generator.ts +120 -24
  200. package/src/cmd/build/vite/route-discovery.ts +16 -0
  201. package/src/cmd/cloud/env/delete.ts +113 -41
  202. package/src/cmd/cloud/env/get.ts +60 -16
  203. package/src/cmd/cloud/env/import.ts +92 -44
  204. package/src/cmd/cloud/env/index.ts +6 -2
  205. package/src/cmd/cloud/env/list.ts +112 -27
  206. package/src/cmd/cloud/env/org-util.ts +37 -0
  207. package/src/cmd/cloud/env/pull.ts +72 -31
  208. package/src/cmd/cloud/env/push.ts +84 -35
  209. package/src/cmd/cloud/env/set.ts +89 -33
  210. package/src/cmd/cloud/index.ts +2 -0
  211. package/src/cmd/cloud/keyvalue/create-namespace.ts +1 -1
  212. package/src/cmd/cloud/keyvalue/delete-namespace.ts +2 -2
  213. package/src/cmd/cloud/keyvalue/delete.ts +1 -1
  214. package/src/cmd/cloud/keyvalue/get.ts +1 -1
  215. package/src/cmd/cloud/keyvalue/index.ts +1 -1
  216. package/src/cmd/cloud/keyvalue/keys.ts +1 -1
  217. package/src/cmd/cloud/keyvalue/list-namespaces.ts +1 -1
  218. package/src/cmd/cloud/keyvalue/repl.ts +8 -5
  219. package/src/cmd/cloud/keyvalue/search.ts +1 -1
  220. package/src/cmd/cloud/keyvalue/set.ts +1 -1
  221. package/src/cmd/cloud/keyvalue/stats.ts +1 -1
  222. package/src/cmd/cloud/keyvalue/util.ts +8 -17
  223. package/src/cmd/cloud/queue/ack.ts +50 -0
  224. package/src/cmd/cloud/queue/create.ts +91 -0
  225. package/src/cmd/cloud/queue/delete.ts +57 -0
  226. package/src/cmd/cloud/queue/destinations.ts +287 -0
  227. package/src/cmd/cloud/queue/dlq.ts +203 -0
  228. package/src/cmd/cloud/queue/get.ts +158 -0
  229. package/src/cmd/cloud/queue/index.ts +66 -0
  230. package/src/cmd/cloud/queue/list.ts +81 -0
  231. package/src/cmd/cloud/queue/messages.ts +160 -0
  232. package/src/cmd/cloud/queue/nack.ts +50 -0
  233. package/src/cmd/cloud/queue/pause.ts +41 -0
  234. package/src/cmd/cloud/queue/publish.ts +88 -0
  235. package/src/cmd/cloud/queue/receive.ts +76 -0
  236. package/src/cmd/cloud/queue/resume.ts +40 -0
  237. package/src/cmd/cloud/queue/sources.ts +352 -0
  238. package/src/cmd/cloud/queue/stats.ts +297 -0
  239. package/src/cmd/cloud/queue/util.ts +34 -0
  240. package/src/cmd/cloud/sandbox/snapshot/build.ts +146 -29
  241. package/src/cmd/cloud/sandbox/snapshot/create.ts +24 -7
  242. package/src/cmd/cloud/sandbox/snapshot/get.ts +16 -0
  243. package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -0
  244. package/src/cmd/cloud/vector/stats.ts +9 -0
  245. package/src/cmd/project/create.ts +12 -0
  246. package/src/cmd/project/template-flow.ts +181 -69
  247. package/src/cmd/setup/index.ts +2 -1
  248. package/src/env-util.ts +17 -2
  249. package/src/errors.ts +8 -0
  250. package/src/onboarding/agentPrompt.ts +263 -0
  251. package/src/schema-generator.ts +1 -1
  252. package/src/schema-parser.ts +45 -3
  253. package/src/tui/box.ts +52 -0
  254. package/src/tui.ts +47 -17
  255. package/src/types.ts +0 -1
@@ -1,34 +1,25 @@
1
- import { KeyValueStorageService, Logger } from '@agentuity/core';
1
+ import { KeyValueStorageService, type Logger } from '@agentuity/core';
2
2
  import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
3
- import { loadProjectSDKKey } from '../../../config';
4
- import { ErrorCode } from '../../../errors';
5
- import type { Config } from '../../../types';
6
- import * as tui from '../../../tui';
3
+ import { getDefaultRegion } from '../../../config';
4
+ import type { AuthData, Config } from '../../../types';
7
5
 
8
6
  export async function createStorageAdapter(ctx: {
9
7
  logger: Logger;
10
- projectDir: string;
11
8
  config: Config | null;
12
- project: { region: string };
9
+ auth: AuthData;
10
+ project?: { region: string };
13
11
  }) {
14
- const sdkKey = await loadProjectSDKKey(ctx.logger, ctx.projectDir);
15
- if (!sdkKey) {
16
- tui.fatal(
17
- `Couldn't find the AGENTUITY_SDK_KEY in ${ctx.projectDir} .env file`,
18
- ErrorCode.CONFIG_NOT_FOUND
19
- );
20
- }
21
-
22
12
  const adapter = createServerFetchAdapter(
23
13
  {
24
14
  headers: {
25
- Authorization: `Bearer ${sdkKey}`,
15
+ Authorization: `Bearer ${ctx.auth.apiKey}`,
26
16
  },
27
17
  },
28
18
  ctx.logger
29
19
  );
30
20
 
31
- const urls = getServiceUrls(ctx.project.region);
21
+ const region = ctx.project?.region || (await getDefaultRegion(ctx.config?.name, ctx.config));
22
+ const urls = getServiceUrls(region);
32
23
  const baseUrl = urls.catalyst;
33
24
  return new KeyValueStorageService(baseUrl, adapter);
34
25
  }
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { createCommand } from '../../../types';
3
+ import * as tui from '../../../tui';
4
+ import { createQueueAPIClient, getQueueApiOptions } from './util';
5
+ import { getCommand } from '../../../command-prefix';
6
+ import { ackMessage } from '@agentuity/server';
7
+
8
+ const AckResponseSchema = z.object({
9
+ success: z.boolean(),
10
+ queue_name: z.string(),
11
+ message_id: z.string(),
12
+ });
13
+
14
+ export const ackSubcommand = createCommand({
15
+ name: 'ack',
16
+ description: 'Acknowledge a message (mark as processed)',
17
+ tags: ['mutating', 'updates-resource', 'requires-auth'],
18
+ requires: { auth: true },
19
+ examples: [
20
+ {
21
+ command: getCommand('cloud queue ack my-queue msg-123'),
22
+ description: 'Acknowledge a message',
23
+ },
24
+ ],
25
+ schema: {
26
+ args: z.object({
27
+ queue_name: z.string().min(1).describe('Queue name'),
28
+ message_id: z.string().min(1).describe('Message ID'),
29
+ }),
30
+ response: AckResponseSchema,
31
+ },
32
+
33
+ async handler(ctx) {
34
+ const { args, options } = ctx;
35
+ const client = await createQueueAPIClient(ctx);
36
+ await ackMessage(client, args.queue_name, args.message_id, getQueueApiOptions(ctx));
37
+
38
+ if (!options.json) {
39
+ tui.success(`Acknowledged message: ${args.message_id}`);
40
+ }
41
+
42
+ return {
43
+ success: true,
44
+ queue_name: args.queue_name,
45
+ message_id: args.message_id,
46
+ };
47
+ },
48
+ });
49
+
50
+ export default ackSubcommand;
@@ -0,0 +1,91 @@
1
+ import { z } from 'zod';
2
+ import { createCommand } from '../../../types';
3
+ import * as tui from '../../../tui';
4
+ import { createQueueAPIClient, getQueueApiOptions } from './util';
5
+ import { getCommand } from '../../../command-prefix';
6
+ import { createQueue, QueueTypeSchema } from '@agentuity/server';
7
+
8
+ const QueueCreateResponseSchema = z.object({
9
+ id: z.string(),
10
+ name: z.string(),
11
+ queue_type: z.string(),
12
+ created_at: z.string(),
13
+ });
14
+
15
+ export const createSubcommand = createCommand({
16
+ name: 'create',
17
+ description: 'Create a new queue',
18
+ tags: ['mutating', 'creates-resource', 'requires-auth'],
19
+ requires: { auth: true, org: true },
20
+ examples: [
21
+ {
22
+ command: getCommand('cloud queue create worker --name my-tasks'),
23
+ description: 'Create a worker queue named my-tasks',
24
+ },
25
+ {
26
+ command: getCommand('cloud queue create pubsub --name events --ttl 86400'),
27
+ description: 'Create a pubsub queue with 24h TTL',
28
+ },
29
+ ],
30
+ schema: {
31
+ args: z.object({
32
+ queue_type: QueueTypeSchema.describe('Queue type: worker or pubsub'),
33
+ }),
34
+ options: z.object({
35
+ name: z.string().optional().describe('Queue name (auto-generated if not provided)'),
36
+ description: z.string().optional().describe('Queue description'),
37
+ ttl: z.coerce.number().optional().describe('Default message TTL in seconds'),
38
+ visibilityTimeout: z.coerce
39
+ .number()
40
+ .optional()
41
+ .describe('Default visibility timeout in seconds (worker queues)'),
42
+ maxRetries: z.coerce
43
+ .number()
44
+ .optional()
45
+ .describe('Maximum retry attempts for failed messages'),
46
+ }),
47
+ response: QueueCreateResponseSchema,
48
+ },
49
+
50
+ async handler(ctx) {
51
+ const { args, opts, options } = ctx;
52
+ const client = await createQueueAPIClient(ctx);
53
+
54
+ const settings: Record<string, number | undefined> = {};
55
+ if (opts?.ttl !== undefined) {
56
+ settings.default_ttl_seconds = opts.ttl;
57
+ }
58
+ if (opts?.visibilityTimeout !== undefined) {
59
+ settings.default_visibility_timeout_seconds = opts.visibilityTimeout;
60
+ }
61
+ if (opts?.maxRetries !== undefined) {
62
+ settings.default_max_retries = opts.maxRetries;
63
+ }
64
+
65
+ const queue = await createQueue(
66
+ client,
67
+ {
68
+ name: opts?.name,
69
+ description: opts?.description,
70
+ queue_type: args.queue_type,
71
+ settings: Object.keys(settings).length > 0 ? settings : undefined,
72
+ },
73
+ getQueueApiOptions(ctx)
74
+ );
75
+
76
+ if (!options.json) {
77
+ tui.success(`Created queue: ${queue.name}`);
78
+ console.log(` ID: ${queue.id}`);
79
+ console.log(` Type: ${queue.queue_type}`);
80
+ }
81
+
82
+ return {
83
+ id: queue.id,
84
+ name: queue.name,
85
+ queue_type: queue.queue_type,
86
+ created_at: queue.created_at,
87
+ };
88
+ },
89
+ });
90
+
91
+ export default createSubcommand;
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { createCommand } from '../../../types';
3
+ import * as tui from '../../../tui';
4
+ import { createQueueAPIClient, getQueueApiOptions } from './util';
5
+ import { getCommand } from '../../../command-prefix';
6
+ import { deleteQueue } from '@agentuity/server';
7
+ import { ErrorCode } from '../../../errors';
8
+
9
+ const DeleteResponseSchema = z.object({
10
+ success: z.boolean(),
11
+ name: z.string(),
12
+ });
13
+
14
+ export const deleteSubcommand = createCommand({
15
+ name: 'delete',
16
+ aliases: ['rm'],
17
+ description: 'Delete a queue by name',
18
+ tags: ['mutating', 'deletes-resource', 'requires-auth'],
19
+ requires: { auth: true },
20
+ examples: [
21
+ {
22
+ command: getCommand('cloud queue delete my-queue --confirm'),
23
+ description: 'Delete a queue (requires confirmation)',
24
+ },
25
+ ],
26
+ schema: {
27
+ args: z.object({
28
+ name: z.string().min(1).describe('Queue name'),
29
+ }),
30
+ options: z.object({
31
+ confirm: z.boolean().default(false).describe('Skip confirmation prompt'),
32
+ }),
33
+ response: DeleteResponseSchema,
34
+ },
35
+
36
+ async handler(ctx) {
37
+ const { args, opts, options } = ctx;
38
+
39
+ if (!opts.confirm) {
40
+ tui.fatal('Use --confirm to confirm queue deletion', ErrorCode.INVALID_ARGUMENT);
41
+ }
42
+
43
+ const client = await createQueueAPIClient(ctx);
44
+ await deleteQueue(client, args.name, getQueueApiOptions(ctx));
45
+
46
+ if (!options.json) {
47
+ tui.success(`Deleted queue: ${args.name}`);
48
+ }
49
+
50
+ return {
51
+ success: true,
52
+ name: args.name,
53
+ };
54
+ },
55
+ });
56
+
57
+ export default deleteSubcommand;
@@ -0,0 +1,287 @@
1
+ import { z } from 'zod';
2
+ import { createCommand, createSubcommand } from '../../../types';
3
+ import * as tui from '../../../tui';
4
+ import { createQueueAPIClient, getQueueApiOptions } from './util';
5
+ import { getCommand } from '../../../command-prefix';
6
+ import { ErrorCode } from '../../../errors';
7
+ import {
8
+ createDestination,
9
+ listDestinations,
10
+ updateDestination,
11
+ deleteDestination,
12
+ DestinationSchema,
13
+ DestinationAlreadyExistsError,
14
+ type Destination,
15
+ } from '@agentuity/server';
16
+
17
+ const DestinationsListResponseSchema = z.object({
18
+ destinations: z.array(
19
+ z.object({
20
+ id: z.string(),
21
+ destination_type: z.string(),
22
+ url: z.string(),
23
+ enabled: z.boolean(),
24
+ created_at: z.string(),
25
+ })
26
+ ),
27
+ });
28
+
29
+ const listDestinationsSubcommand = createSubcommand({
30
+ name: 'list',
31
+ aliases: ['ls'],
32
+ description: 'List destinations for a queue',
33
+ tags: ['read-only', 'fast', 'requires-auth'],
34
+ requires: { auth: true },
35
+ examples: [
36
+ {
37
+ command: getCommand('cloud queue destinations list my-queue'),
38
+ description: 'List queue destinations',
39
+ },
40
+ ],
41
+ schema: {
42
+ args: z.object({
43
+ queue_name: z.string().min(1).describe('Queue name'),
44
+ }),
45
+ response: DestinationsListResponseSchema,
46
+ },
47
+ idempotent: true,
48
+
49
+ async handler(ctx) {
50
+ const { args, options } = ctx;
51
+ const client = await createQueueAPIClient(ctx);
52
+ const destinations = await listDestinations(client, args.queue_name, getQueueApiOptions(ctx));
53
+
54
+ if (!options.json) {
55
+ if (destinations.length === 0) {
56
+ tui.info('No destinations configured');
57
+ } else {
58
+ const tableData = destinations.map((d: Destination) => ({
59
+ ID: d.id,
60
+ Type: d.destination_type,
61
+ URL: d.config.url,
62
+ Enabled: d.enabled ? 'Yes' : 'No',
63
+ Created: new Date(d.created_at).toLocaleString(),
64
+ }));
65
+ tui.table(tableData, ['ID', 'Type', 'URL', 'Enabled', 'Created']);
66
+ }
67
+ }
68
+
69
+ return {
70
+ destinations: destinations.map((d: Destination) => ({
71
+ id: d.id,
72
+ destination_type: d.destination_type,
73
+ url: d.config.url,
74
+ enabled: d.enabled,
75
+ created_at: d.created_at,
76
+ })),
77
+ };
78
+ },
79
+ });
80
+
81
+ const createDestinationSubcommand = createSubcommand({
82
+ name: 'create',
83
+ description: 'Create a webhook destination for a queue',
84
+ tags: ['mutating', 'creates-resource', 'requires-auth'],
85
+ requires: { auth: true },
86
+ examples: [
87
+ {
88
+ command: getCommand(
89
+ 'cloud queue destinations create my-queue --url https://example.com/webhook'
90
+ ),
91
+ description: 'Create a webhook destination',
92
+ },
93
+ ],
94
+ schema: {
95
+ args: z.object({
96
+ queue_name: z.string().min(1).describe('Queue name'),
97
+ }),
98
+ options: z.object({
99
+ url: z.string().url().describe('Webhook URL'),
100
+ method: z.string().default('POST').optional().describe('HTTP method (default: POST)'),
101
+ timeout: z.coerce.number().optional().describe('Request timeout in milliseconds'),
102
+ }),
103
+ response: DestinationSchema,
104
+ },
105
+
106
+ async handler(ctx) {
107
+ const { args, opts, options } = ctx;
108
+ const client = await createQueueAPIClient(ctx);
109
+
110
+ try {
111
+ const destination = await createDestination(
112
+ client,
113
+ args.queue_name,
114
+ {
115
+ destination_type: 'http',
116
+ config: {
117
+ url: opts.url,
118
+ method: opts.method || 'POST',
119
+ timeout_ms: opts.timeout ?? 30000,
120
+ },
121
+ enabled: true,
122
+ },
123
+ getQueueApiOptions(ctx)
124
+ );
125
+
126
+ if (!options.json) {
127
+ tui.success(`Created destination: ${destination.id}`);
128
+ console.log(` URL: ${destination.config.url}`);
129
+ console.log(` Method: ${destination.config.method}`);
130
+ }
131
+
132
+ return destination;
133
+ } catch (error) {
134
+ if (error instanceof DestinationAlreadyExistsError) {
135
+ tui.fatal(
136
+ `A destination with URL "${opts.url}" already exists for queue "${args.queue_name}". Use a different URL or delete the existing destination first.`,
137
+ ErrorCode.RESOURCE_ALREADY_EXISTS
138
+ );
139
+ }
140
+ throw error;
141
+ }
142
+ },
143
+ });
144
+
145
+ const updateDestinationSubcommand = createSubcommand({
146
+ name: 'update',
147
+ description: 'Update a destination',
148
+ tags: ['mutating', 'requires-auth'],
149
+ requires: { auth: true },
150
+ examples: [
151
+ {
152
+ command: getCommand('cloud queue destinations update my-queue dest_abc123 --disabled'),
153
+ description: 'Disable a destination',
154
+ },
155
+ ],
156
+ schema: {
157
+ args: z.object({
158
+ queue_name: z.string().min(1).describe('Queue name'),
159
+ destination_id: z.string().min(1).describe('Destination ID'),
160
+ }),
161
+ options: z.object({
162
+ url: z.string().url().optional().describe('Webhook URL'),
163
+ method: z.string().optional().describe('HTTP method'),
164
+ timeout: z.coerce.number().optional().describe('Request timeout in milliseconds'),
165
+ enabled: z.boolean().optional().describe('Enable the destination'),
166
+ disabled: z.boolean().optional().describe('Disable the destination'),
167
+ }),
168
+ response: DestinationSchema,
169
+ },
170
+
171
+ async handler(ctx) {
172
+ const { args, opts, options } = ctx;
173
+ const client = await createQueueAPIClient(ctx);
174
+
175
+ const updateParams: {
176
+ config?: { url?: string; method?: string; timeout_ms?: number };
177
+ enabled?: boolean;
178
+ } = {};
179
+
180
+ if (opts.url || opts.method || opts.timeout !== undefined) {
181
+ updateParams.config = {};
182
+ if (opts.url) updateParams.config.url = opts.url;
183
+ if (opts.method) updateParams.config.method = opts.method;
184
+ if (opts.timeout !== undefined) updateParams.config.timeout_ms = opts.timeout;
185
+ }
186
+ if (opts.enabled && opts.disabled) {
187
+ tui.fatal(
188
+ 'Cannot specify both --enabled and --disabled flags',
189
+ ErrorCode.INVALID_ARGUMENT
190
+ );
191
+ }
192
+ if (opts.enabled) updateParams.enabled = true;
193
+ if (opts.disabled) updateParams.enabled = false;
194
+
195
+ const destination = await updateDestination(
196
+ client,
197
+ args.queue_name,
198
+ args.destination_id,
199
+ updateParams,
200
+ getQueueApiOptions(ctx)
201
+ );
202
+
203
+ if (!options.json) {
204
+ tui.success(`Updated destination: ${destination.id}`);
205
+ console.log(` URL: ${destination.config.url}`);
206
+ console.log(` Enabled: ${destination.enabled ? 'Yes' : 'No'}`);
207
+ }
208
+
209
+ return destination;
210
+ },
211
+ });
212
+
213
+ const DeleteDestinationResponseSchema = z.object({
214
+ success: z.boolean(),
215
+ queue_name: z.string(),
216
+ destination_id: z.string(),
217
+ });
218
+
219
+ const deleteDestinationSubcommand = createSubcommand({
220
+ name: 'delete',
221
+ aliases: ['rm'],
222
+ description: 'Delete a destination from a queue',
223
+ tags: ['mutating', 'deletes-resource', 'requires-auth'],
224
+ requires: { auth: true },
225
+ examples: [
226
+ {
227
+ command: getCommand('cloud queue destinations delete my-queue dest-123'),
228
+ description: 'Delete a destination',
229
+ },
230
+ ],
231
+ schema: {
232
+ args: z.object({
233
+ queue_name: z.string().min(1).describe('Queue name'),
234
+ destination_id: z.string().min(1).describe('Destination ID'),
235
+ }),
236
+ response: DeleteDestinationResponseSchema,
237
+ },
238
+
239
+ async handler(ctx) {
240
+ const { args, options } = ctx;
241
+ const client = await createQueueAPIClient(ctx);
242
+ await deleteDestination(
243
+ client,
244
+ args.queue_name,
245
+ args.destination_id,
246
+ getQueueApiOptions(ctx)
247
+ );
248
+
249
+ if (!options.json) {
250
+ tui.success(`Deleted destination: ${args.destination_id}`);
251
+ }
252
+
253
+ return {
254
+ success: true,
255
+ queue_name: args.queue_name,
256
+ destination_id: args.destination_id,
257
+ };
258
+ },
259
+ });
260
+
261
+ export const destinationsSubcommand = createCommand({
262
+ name: 'destinations',
263
+ aliases: ['dest'],
264
+ description: 'Manage queue destinations (webhooks)',
265
+ tags: ['requires-auth'],
266
+ requires: { auth: true },
267
+ examples: [
268
+ {
269
+ command: getCommand('cloud queue destinations list my-queue'),
270
+ description: 'List destinations',
271
+ },
272
+ {
273
+ command: getCommand(
274
+ 'cloud queue destinations create my-queue --url https://example.com/webhook'
275
+ ),
276
+ description: 'Create a webhook destination',
277
+ },
278
+ ],
279
+ subcommands: [
280
+ listDestinationsSubcommand,
281
+ createDestinationSubcommand,
282
+ updateDestinationSubcommand,
283
+ deleteDestinationSubcommand,
284
+ ],
285
+ });
286
+
287
+ export default destinationsSubcommand;