@agentuity/queue 3.0.11 → 3.1.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.
package/AGENTS.md CHANGED
@@ -13,8 +13,8 @@ Standalone package for the Agentuity Queue service. Provides a simple, ergonomic
13
13
  ## Architecture
14
14
 
15
15
  - **Runtime**: Node.js and Bun compatible
16
- - **Exports**: QueueClient and all types from @agentuity/core/queue
17
- - **Dependencies**: @agentuity/core, zod
16
+ - **Exports**: QueueClient and runtime types from `@agentuity/queue`
17
+ - **Dependencies**: `@agentuity/adapter`, `@agentuity/client`, `@agentuity/config`, zod
18
18
 
19
19
  ## Usage
20
20
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { QueueStorageService, QueueService, type QueuePublishParams, type QueuePublishResult, type QueueCreateParams, type QueueCreateResult, QueuePublishParamsSchema, QueuePublishResultSchema, QueueCreateParamsSchema, QueueCreateResultSchema, QueuePublishError, QueueNotFoundError, QueueValidationError, } from '@agentuity/core/queue';
2
- import { type QueuePublishParams, type QueuePublishResult, type QueueCreateParams, type QueueCreateResult } from '@agentuity/core/queue';
3
- import { type Logger } from '@agentuity/adapter';
1
+ export * from './service.ts';
2
+ import { type QueuePublishParams, type QueuePublishResult, type QueueCreateParams, type QueueCreateResult } from './service.ts';
3
+ import { type Logger } from '@agentuity/client';
4
4
  import { z } from 'zod';
5
5
  export declare const QueueClientOptionsSchema: z.ZodObject<{
6
6
  apiKey: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,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AE1E,qBAAa,WAAW;;IAGvB,YAAY,OAAO,GAAE,kBAAuB,EA+B3C;IAEK,OAAO,CACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAE7B;IAEK,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAE3F;IAEK,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAElD;CACD"}
package/dist/index.js CHANGED
@@ -1,13 +1,9 @@
1
- export { QueueStorageService, QueuePublishParamsSchema, QueuePublishResultSchema, QueueCreateParamsSchema, QueueCreateResultSchema, QueuePublishError, QueueNotFoundError, QueueValidationError, } from '@agentuity/core/queue';
2
- import { QueueStorageService, } from '@agentuity/core/queue';
3
- import { createServerFetchAdapter, buildClientHeaders } from '@agentuity/adapter';
4
- import { createMinimalLogger, StructuredError } from '@agentuity/core';
5
- import { getEnv } from '@agentuity/core';
6
- import { getServiceUrls } from '@agentuity/core/config';
1
+ export * from './service.js';
2
+ import { QueueStorageService, } from './service.js';
3
+ import { StructuredError } from '@agentuity/adapter';
4
+ import { getServiceUrls } from '@agentuity/config';
5
+ import { createServiceAdapter, isLogger, resolveApiKey, resolveRegion, resolveServiceUrl, } from '@agentuity/client';
7
6
  import { z, ZodError } from 'zod';
8
- const isLogger = (val) => typeof val === 'object' &&
9
- val !== null &&
10
- ['info', 'warn', 'error', 'debug', 'trace'].every((m) => typeof val[m] === 'function');
11
7
  const QueueClientValidationError = StructuredError('QueueClientValidationError')();
12
8
  export const QueueClientOptionsSchema = z.object({
13
9
  apiKey: z.string().optional().describe('API key for authentication'),
@@ -36,16 +32,18 @@ export class QueueClient {
36
32
  }
37
33
  throw err;
38
34
  }
39
- const apiKey = validatedOptions.apiKey || getEnv('AGENTUITY_SDK_KEY') || getEnv('AGENTUITY_CLI_KEY');
40
- const region = getEnv('AGENTUITY_REGION') ?? 'usc';
41
- const serviceUrls = getServiceUrls(region);
42
- const url = validatedOptions.url || getEnv('AGENTUITY_QUEUE_URL') || serviceUrls.catalyst;
43
- const logger = validatedOptions.logger ?? createMinimalLogger();
44
- const headers = buildClientHeaders({
35
+ const apiKey = resolveApiKey(validatedOptions.apiKey);
36
+ const serviceUrls = getServiceUrls(resolveRegion());
37
+ const url = resolveServiceUrl({
38
+ url: validatedOptions.url,
39
+ envKey: 'AGENTUITY_QUEUE_URL',
40
+ fallback: serviceUrls.catalyst,
41
+ });
42
+ const { adapter } = createServiceAdapter({
45
43
  apiKey,
46
44
  orgId: validatedOptions.orgId,
45
+ logger: validatedOptions.logger,
47
46
  });
48
- const adapter = createServerFetchAdapter({ headers }, logger);
49
47
  this.#service = new QueueStorageService(url, adapter);
50
48
  }
51
49
  async publish(queueName, payload, params) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EAMnB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACN,mBAAmB,GAKnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAe,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAElC,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAiB,EAAE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B,EAAE,MAA0B;QAC9D,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD"}
@@ -0,0 +1,335 @@
1
+ /**
2
+ * @module queue
3
+ *
4
+ * Queue service for publishing messages to Agentuity queues.
5
+ *
6
+ * Used internally by `@agentuity/queue`'s `QueueClient`. App code should
7
+ * use `QueueClient` directly rather than reaching for these primitives.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { QueueClient } from '@agentuity/queue';
12
+ *
13
+ * const queue = new QueueClient();
14
+ * const result = await queue.publish('order-queue', {
15
+ * orderId: 123,
16
+ * action: 'process',
17
+ * });
18
+ * console.log(`Published message ${result.id}`);
19
+ * ```
20
+ */
21
+ import type { FetchAdapter } from '@agentuity/adapter';
22
+ import { z } from 'zod';
23
+ /**
24
+ * Parameters for publishing a message to a queue.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const params: QueuePublishParams = {
29
+ * metadata: { priority: 'high' },
30
+ * partitionKey: 'customer-123',
31
+ * idempotencyKey: 'order-456-v1',
32
+ * ttl: 3600, // 1 hour
33
+ * };
34
+ * ```
35
+ */
36
+ export declare const QueuePublishParamsSchema: z.ZodObject<{
37
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
38
+ partitionKey: z.ZodOptional<z.ZodString>;
39
+ idempotencyKey: z.ZodOptional<z.ZodString>;
40
+ ttl: z.ZodOptional<z.ZodNumber>;
41
+ projectId: z.ZodOptional<z.ZodString>;
42
+ agentId: z.ZodOptional<z.ZodString>;
43
+ sync: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$strip>;
45
+ export type QueuePublishParams = z.infer<typeof QueuePublishParamsSchema>;
46
+ /**
47
+ * Result of publishing a message to a queue.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const result = await queue.publish('my-queue', payload);
52
+ * console.log(`Message ${result.id} published at offset ${result.offset}`);
53
+ * ```
54
+ */
55
+ export declare const QueuePublishResultSchema: z.ZodObject<{
56
+ id: z.ZodString;
57
+ offset: z.ZodNumber;
58
+ publishedAt: z.ZodString;
59
+ }, z.core.$strip>;
60
+ export type QueuePublishResult = z.infer<typeof QueuePublishResultSchema>;
61
+ /**
62
+ * Parameters for creating a queue.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const result = await queue.createQueue('my-queue', {
67
+ * queueType: 'pubsub',
68
+ * settings: { defaultTtlSeconds: 86400 },
69
+ * });
70
+ * ```
71
+ */
72
+ export declare const QueueCreateParamsSchema: z.ZodObject<{
73
+ queueType: z.ZodOptional<z.ZodEnum<{
74
+ pubsub: "pubsub";
75
+ worker: "worker";
76
+ }>>;
77
+ description: z.ZodOptional<z.ZodString>;
78
+ settings: z.ZodOptional<z.ZodObject<{
79
+ defaultTtlSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ defaultVisibilityTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
81
+ defaultMaxRetries: z.ZodOptional<z.ZodNumber>;
82
+ maxInFlightPerClient: z.ZodOptional<z.ZodNumber>;
83
+ retentionSeconds: z.ZodOptional<z.ZodNumber>;
84
+ }, z.core.$strip>>;
85
+ }, z.core.$strip>;
86
+ export type QueueCreateParams = z.infer<typeof QueueCreateParamsSchema>;
87
+ /**
88
+ * Result of creating a queue.
89
+ */
90
+ export declare const QueueCreateResultSchema: z.ZodObject<{
91
+ name: z.ZodString;
92
+ queueType: z.ZodString;
93
+ }, z.core.$strip>;
94
+ export type QueueCreateResult = z.infer<typeof QueueCreateResultSchema>;
95
+ /**
96
+ * Queue service interface for publishing messages.
97
+ *
98
+ * Provides a simple publish-only surface suitable for app handlers.
99
+ * Implemented by `QueueStorageService` (cloud) and `LocalQueueStorage`
100
+ * (local dev).
101
+ *
102
+ * For full queue management (create queues, consume messages, manage
103
+ * destinations), use the `@agentuity/queue` package directly.
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * import { QueueClient } from '@agentuity/queue';
108
+ *
109
+ * const queue = new QueueClient();
110
+ *
111
+ * await queue.publish('notifications', {
112
+ * type: 'email',
113
+ * to: 'user@example.com',
114
+ * subject: 'Welcome!',
115
+ * });
116
+ * ```
117
+ */
118
+ export interface QueueService {
119
+ /**
120
+ * Publish a message to a queue.
121
+ *
122
+ * The payload can be a string or an object. Objects are automatically
123
+ * JSON-stringified before publishing.
124
+ *
125
+ * @param queueName - The name of the queue to publish to
126
+ * @param payload - The message payload (string or JSON-serializable object)
127
+ * @param params - Optional publish parameters (metadata, TTL, etc.)
128
+ * @returns The publish result with message ID and offset
129
+ * @throws {QueueNotFoundError} If the queue does not exist
130
+ * @throws {QueueValidationError} If validation fails (invalid name, payload too large, etc.)
131
+ * @throws {QueuePublishError} If the publish operation fails
132
+ *
133
+ * @example Publishing a simple message
134
+ * ```typescript
135
+ * const result = await queue.publish('my-queue', 'Hello, World!');
136
+ * ```
137
+ *
138
+ * @example Publishing with options
139
+ * ```typescript
140
+ * const result = await queue.publish('my-queue', { task: 'process' }, {
141
+ * metadata: { priority: 'high' },
142
+ * idempotencyKey: 'task-123',
143
+ * ttl: 3600,
144
+ * });
145
+ * ```
146
+ */
147
+ publish(queueName: string, payload: string | object, params?: QueuePublishParams): Promise<QueuePublishResult>;
148
+ /**
149
+ * Create a queue with idempotent semantics.
150
+ *
151
+ * If the queue already exists, this returns successfully without error.
152
+ * Safe to call multiple times — uses an internal cache to avoid redundant API calls.
153
+ *
154
+ * @param queueName - The name of the queue to create
155
+ * @param params - Optional creation parameters (queue type, settings, etc.)
156
+ * @returns The create result with queue name and type
157
+ * @throws {QueueValidationError} If the queue name is invalid
158
+ *
159
+ * @example Creating a worker queue
160
+ * ```typescript
161
+ * const result = await queue.createQueue('task-queue');
162
+ * ```
163
+ *
164
+ * @example Creating a pubsub queue with settings
165
+ * ```typescript
166
+ * const result = await queue.createQueue('events', {
167
+ * queueType: 'pubsub',
168
+ * settings: { defaultTtlSeconds: 86400 },
169
+ * });
170
+ * ```
171
+ */
172
+ createQueue(queueName: string, params?: QueueCreateParams): Promise<QueueCreateResult>;
173
+ /**
174
+ * Delete a queue.
175
+ *
176
+ * Permanently deletes a queue and all its messages. This action cannot be undone.
177
+ * If the queue has already been deleted or does not exist, a {@link QueueNotFoundError} is thrown.
178
+ *
179
+ * @param queueName - The name of the queue to delete
180
+ * @throws {QueueNotFoundError} If the queue does not exist
181
+ * @throws {QueueValidationError} If the queue name is invalid
182
+ *
183
+ * @example Deleting a queue
184
+ * ```typescript
185
+ * await queue.deleteQueue('old-queue');
186
+ * ```
187
+ */
188
+ deleteQueue(queueName: string): Promise<void>;
189
+ }
190
+ /**
191
+ * Error thrown when a publish operation fails.
192
+ *
193
+ * This is a general error for publish failures that aren't specifically
194
+ * validation or not-found errors.
195
+ */
196
+ export declare const QueuePublishError: {
197
+ new (args?: {
198
+ message?: string;
199
+ cause?: unknown;
200
+ } | undefined): import("@agentuity/adapter").RichError & {
201
+ readonly _tag: "QueuePublishError";
202
+ } & Readonly<Record<string, never>>;
203
+ readonly defaultMessage?: string;
204
+ } & (<Shape extends {
205
+ [x: string]: any;
206
+ } = Record<string, never>>() => {
207
+ new (args?: (Shape extends Record<string, never> ? {
208
+ message?: string;
209
+ cause?: unknown;
210
+ } : Shape & {
211
+ message?: string;
212
+ cause?: unknown;
213
+ }) | undefined): import("@agentuity/adapter").RichError & {
214
+ readonly _tag: "QueuePublishError";
215
+ } & Readonly<Shape>;
216
+ readonly defaultMessage?: string;
217
+ });
218
+ /**
219
+ * Error thrown when a queue creation operation fails.
220
+ *
221
+ * This is a general error for create failures that aren't specifically
222
+ * validation, not-found, or conflict (409) errors.
223
+ */
224
+ export declare const QueueCreateError: {
225
+ new (args?: {
226
+ message?: string;
227
+ cause?: unknown;
228
+ } | undefined): import("@agentuity/adapter").RichError & {
229
+ readonly _tag: "QueueCreateError";
230
+ } & Readonly<Record<string, never>>;
231
+ readonly defaultMessage?: string;
232
+ } & (<Shape extends {
233
+ [x: string]: any;
234
+ } = Record<string, never>>() => {
235
+ new (args?: (Shape extends Record<string, never> ? {
236
+ message?: string;
237
+ cause?: unknown;
238
+ } : Shape & {
239
+ message?: string;
240
+ cause?: unknown;
241
+ }) | undefined): import("@agentuity/adapter").RichError & {
242
+ readonly _tag: "QueueCreateError";
243
+ } & Readonly<Shape>;
244
+ readonly defaultMessage?: string;
245
+ });
246
+ /**
247
+ * Error thrown when a queue is not found.
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * try {
252
+ * await queue.publish('non-existent', 'payload');
253
+ * } catch (error) {
254
+ * if (error instanceof QueueNotFoundError) {
255
+ * console.error('Queue does not exist');
256
+ * }
257
+ * }
258
+ * ```
259
+ */
260
+ export declare const QueueNotFoundError: {
261
+ new (args?: {
262
+ message?: string;
263
+ cause?: unknown;
264
+ } | undefined): import("@agentuity/adapter").RichError & {
265
+ readonly _tag: "QueueNotFoundError";
266
+ } & Readonly<Record<string, never>>;
267
+ readonly defaultMessage?: string;
268
+ } & (<Shape extends {
269
+ [x: string]: any;
270
+ } = Record<string, never>>() => {
271
+ new (args?: (Shape extends Record<string, never> ? {
272
+ message?: string;
273
+ cause?: unknown;
274
+ } : Shape & {
275
+ message?: string;
276
+ cause?: unknown;
277
+ }) | undefined): import("@agentuity/adapter").RichError & {
278
+ readonly _tag: "QueueNotFoundError";
279
+ } & Readonly<Shape>;
280
+ readonly defaultMessage?: string;
281
+ });
282
+ /**
283
+ * Error thrown when validation fails.
284
+ *
285
+ * Contains the field name and optionally the invalid value for debugging.
286
+ */
287
+ export declare const QueueValidationError: {
288
+ new (args?: ({
289
+ /** The field that failed validation */
290
+ field: string;
291
+ /** The invalid value (for debugging) */
292
+ value?: unknown;
293
+ } & {
294
+ message?: string;
295
+ cause?: unknown;
296
+ }) | undefined): import("@agentuity/adapter").RichError & {
297
+ readonly _tag: "QueueValidationError";
298
+ } & Readonly<{
299
+ /** The field that failed validation */
300
+ field: string;
301
+ /** The invalid value (for debugging) */
302
+ value?: unknown;
303
+ }>;
304
+ readonly defaultMessage?: string;
305
+ };
306
+ /**
307
+ * HTTP-based implementation of the {@link QueueService} interface.
308
+ *
309
+ * This service communicates with the Agentuity Queue API to publish
310
+ * messages. App code should use `QueueClient` from `@agentuity/queue`
311
+ * rather than instantiating this class directly.
312
+ */
313
+ export declare class QueueStorageService implements QueueService {
314
+ #private;
315
+ /**
316
+ * Creates a new QueueStorageService.
317
+ *
318
+ * @param baseUrl - The base URL of the Queue API
319
+ * @param adapter - The fetch adapter for making HTTP requests
320
+ */
321
+ constructor(baseUrl: string, adapter: FetchAdapter);
322
+ /**
323
+ * @inheritdoc
324
+ */
325
+ publish(queueName: string, payload: string | object, params?: QueuePublishParams): Promise<QueuePublishResult>;
326
+ /**
327
+ * @inheritdoc
328
+ */
329
+ createQueue(queueName: string, params?: QueueCreateParams): Promise<QueueCreateResult>;
330
+ /**
331
+ * @inheritdoc
332
+ */
333
+ deleteQueue(queueName: string): Promise<void>;
334
+ }
335
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;iBA8CnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB;;;;iBAiBnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,K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