@agentuity/core 0.1.16 → 0.1.18
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/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/services/keyvalue.d.ts +94 -6
- package/dist/services/keyvalue.d.ts.map +1 -1
- package/dist/services/keyvalue.js +56 -5
- package/dist/services/keyvalue.js.map +1 -1
- package/dist/services/queue.d.ts +257 -0
- package/dist/services/queue.d.ts.map +1 -0
- package/dist/services/queue.js +207 -0
- package/dist/services/queue.js.map +1 -0
- package/dist/services/sandbox.d.ts +8 -0
- package/dist/services/sandbox.d.ts.map +1 -1
- package/dist/services/sandbox.js.map +1 -1
- package/dist/services/vector.d.ts +53 -12
- package/dist/services/vector.d.ts.map +1 -1
- package/dist/services/vector.js +24 -4
- package/dist/services/vector.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +17 -0
- package/src/services/keyvalue.ts +130 -10
- package/src/services/queue.ts +384 -0
- package/src/services/sandbox.ts +10 -0
- package/src/services/vector.ts +79 -18
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ export { safeStringify } from './json';
|
|
|
3
3
|
export type { Logger, LogLevel } from './logger';
|
|
4
4
|
export type { FetchAdapter, FetchRequest, FetchResponse, FetchSuccessResponse, FetchErrorResponse, Body, HttpMethod, } from './services/adapter';
|
|
5
5
|
export { ServiceException } from './services/exception';
|
|
6
|
-
export { type DataResult, type DataResultFound, type DataResultNotFound, type KeyValueStorage, type KeyValueStorageSetParams, type KeyValueStats, type KeyValueItemWithMetadata, KeyValueStorageService, } from './services/keyvalue';
|
|
6
|
+
export { type DataResult, type DataResultFound, type DataResultNotFound, type KeyValueStorage, type KeyValueStorageSetParams, type KeyValueStats, type KeyValueItemWithMetadata, type CreateNamespaceParams, type GetAllStatsParams, type KeyValueStatsPaginated, KV_MIN_TTL_SECONDS, KV_MAX_TTL_SECONDS, KV_DEFAULT_TTL_SECONDS, KeyValueStorageService, } from './services/keyvalue';
|
|
7
7
|
export { type SessionEventProvider, SessionStartEventSchema, SessionCompleteEventSchema, SessionStartEventDelayedSchema, SessionCompleteEventDelayedSchema, type SessionStartEvent, type SessionCompleteEvent, } from './services/session';
|
|
8
8
|
export { type CreateStreamProps, type ListStreamsParams, type StreamInfo, type ListStreamsResponse, type Stream, type StreamStorage, StreamStorageService, } from './services/stream';
|
|
9
|
-
export { type VectorUpsertBase, type VectorUpsertEmbeddings, type VectorUpsertText, type VectorUpsertParams, type VectorSearchParams, type VectorSearchResult, type VectorSearchResultWithDocument, type VectorUpsertResult, type VectorResultFound, type VectorResultNotFound, type VectorResult, type VectorNamespaceStats, type VectorItemStats, type VectorNamespaceStatsWithSamples, type VectorStorage, VectorStorageService, } from './services/vector';
|
|
9
|
+
export { type VectorUpsertBase, type VectorUpsertEmbeddings, type VectorUpsertText, type VectorUpsertParams, type VectorSearchParams, type VectorSearchResult, type VectorSearchResultWithDocument, type VectorUpsertResult, type VectorResultFound, type VectorResultNotFound, type VectorResult, type VectorNamespaceStats, type VectorItemStats, type VectorNamespaceStatsWithSamples, type VectorGetAllStatsParams, type VectorStatsPaginated, type VectorStorage, VectorStorageService, } from './services/vector';
|
|
10
|
+
export { type QueueService, type QueuePublishParams, type QueuePublishResult, QueueStorageService, QueuePublishError, QueueNotFoundError, QueueValidationError, } from './services/queue';
|
|
10
11
|
export { type EvalRunEventProvider, EvalRunStartEventSchema, EvalRunCompleteEventSchema, EvalRunStartEventDelayedSchema, EvalRunCompleteEventDelayedSchema, type EvalRunStartEvent, type EvalRunCompleteEvent, } from './services/evalrun';
|
|
11
12
|
export { type SandboxResources, type SandboxStatus, type SandboxRuntimeRequirements, type SandboxRuntime, type ExecutionStatus, type StreamReader, type SandboxStreamConfig, type SandboxCommand, type SandboxNetworkConfig, type SandboxTimeoutConfig, type SandboxCreateOptions, type Sandbox, type SandboxInfo, type SandboxUserInfo, type SandboxAgentInfo, type SandboxProjectInfo, type SandboxOrgInfo, type ListSandboxesParams, type ListSandboxesResponse, type ListRuntimesParams, type ListRuntimesResponse, type ExecuteOptions, type Execution, type SandboxRunOptions, type SandboxRunResult, type SandboxService, type FileToWrite, SandboxError, } from './services/sandbox';
|
|
12
13
|
export { buildUrl, toServiceException, toPayload, fromResponse } from './services/_util';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAGvC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGjD,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,IAAI,EACJ,UAAU,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,EACjC,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AA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B,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGzF,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGrD,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,eAAe,GACpB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,11 @@ export { RichError, StructuredError, isStructuredError } from './error';
|
|
|
3
3
|
// json.ts exports
|
|
4
4
|
export { safeStringify } from './json';
|
|
5
5
|
export { ServiceException } from './services/exception';
|
|
6
|
-
export { KeyValueStorageService, } from './services/keyvalue';
|
|
6
|
+
export { KV_MIN_TTL_SECONDS, KV_MAX_TTL_SECONDS, KV_DEFAULT_TTL_SECONDS, KeyValueStorageService, } from './services/keyvalue';
|
|
7
7
|
export { SessionStartEventSchema, SessionCompleteEventSchema, SessionStartEventDelayedSchema, SessionCompleteEventDelayedSchema, } from './services/session';
|
|
8
8
|
export { StreamStorageService, } from './services/stream';
|
|
9
9
|
export { VectorStorageService, } from './services/vector';
|
|
10
|
+
export { QueueStorageService, QueuePublishError, QueueNotFoundError, QueueValidationError, } from './services/queue';
|
|
10
11
|
export { EvalRunStartEventSchema, EvalRunCompleteEventSchema, EvalRunStartEventDelayedSchema, EvalRunCompleteEventDelayedSchema, } from './services/evalrun';
|
|
11
12
|
export { SandboxError, } from './services/sandbox';
|
|
12
13
|
export { buildUrl, toServiceException, toPayload, fromResponse } from './services/_util';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAExE,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAevC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAExE,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAevC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAWN,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,GAGjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAON,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAkBN,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIN,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,iCAAiC,GAGjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EA4BN,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKzF,oBAAoB;AACpB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKrD,oBAAoB;AACpB,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,GAElB,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { FetchAdapter } from './adapter';
|
|
2
|
+
/**
|
|
3
|
+
* Minimum TTL value in seconds (1 minute)
|
|
4
|
+
*/
|
|
5
|
+
export declare const KV_MIN_TTL_SECONDS = 60;
|
|
6
|
+
/**
|
|
7
|
+
* Maximum TTL value in seconds (90 days)
|
|
8
|
+
*/
|
|
9
|
+
export declare const KV_MAX_TTL_SECONDS = 7776000;
|
|
10
|
+
/**
|
|
11
|
+
* Default TTL value in seconds (7 days) - used when namespace is auto-created or no TTL specified
|
|
12
|
+
*/
|
|
13
|
+
export declare const KV_DEFAULT_TTL_SECONDS = 604800;
|
|
2
14
|
/**
|
|
3
15
|
* the result of a data operation when the data is found
|
|
4
16
|
*/
|
|
@@ -40,6 +52,22 @@ export interface KeyValueStorageSetParams {
|
|
|
40
52
|
*/
|
|
41
53
|
contentType?: string;
|
|
42
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Parameters for creating a namespace
|
|
57
|
+
*/
|
|
58
|
+
export interface CreateNamespaceParams {
|
|
59
|
+
/**
|
|
60
|
+
* Default TTL for keys in this namespace (in seconds).
|
|
61
|
+
* - If undefined/omitted: uses server default (7 days / 604,800 seconds)
|
|
62
|
+
* - If 0: keys will not expire by default
|
|
63
|
+
* - If 60-7,776,000: custom TTL in seconds (1 minute to 90 days)
|
|
64
|
+
*
|
|
65
|
+
* Keys can override this default by specifying TTL in the set() call.
|
|
66
|
+
* Active keys are automatically extended (sliding expiration) when read
|
|
67
|
+
* if their remaining TTL is less than 50% of the original TTL.
|
|
68
|
+
*/
|
|
69
|
+
defaultTTLSeconds?: number;
|
|
70
|
+
}
|
|
43
71
|
/**
|
|
44
72
|
* Statistics for a key-value store namespace
|
|
45
73
|
*/
|
|
@@ -59,6 +87,44 @@ export interface KeyValueItemWithMetadata<T = unknown> {
|
|
|
59
87
|
created_at: string;
|
|
60
88
|
updated_at: string;
|
|
61
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Parameters for getting all namespace statistics with optional pagination
|
|
92
|
+
*/
|
|
93
|
+
export interface GetAllStatsParams {
|
|
94
|
+
/**
|
|
95
|
+
* Maximum number of namespaces to return (default: 100, max: 1000)
|
|
96
|
+
*/
|
|
97
|
+
limit?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Number of namespaces to skip for pagination (default: 0)
|
|
100
|
+
*/
|
|
101
|
+
offset?: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Paginated response for namespace statistics
|
|
105
|
+
*/
|
|
106
|
+
export interface KeyValueStatsPaginated {
|
|
107
|
+
/**
|
|
108
|
+
* Map of namespace names to their statistics
|
|
109
|
+
*/
|
|
110
|
+
namespaces: Record<string, KeyValueStats>;
|
|
111
|
+
/**
|
|
112
|
+
* Total number of namespaces across all pages
|
|
113
|
+
*/
|
|
114
|
+
total: number;
|
|
115
|
+
/**
|
|
116
|
+
* Number of namespaces requested per page
|
|
117
|
+
*/
|
|
118
|
+
limit: number;
|
|
119
|
+
/**
|
|
120
|
+
* Number of namespaces skipped
|
|
121
|
+
*/
|
|
122
|
+
offset: number;
|
|
123
|
+
/**
|
|
124
|
+
* Whether there are more namespaces available
|
|
125
|
+
*/
|
|
126
|
+
hasMore: boolean;
|
|
127
|
+
}
|
|
62
128
|
export interface KeyValueStorage {
|
|
63
129
|
/**
|
|
64
130
|
* get a value from the key value storage
|
|
@@ -94,13 +160,19 @@ export interface KeyValueStorage {
|
|
|
94
160
|
/**
|
|
95
161
|
* get statistics for all namespaces
|
|
96
162
|
*
|
|
97
|
-
* @
|
|
163
|
+
* @param params - optional pagination parameters
|
|
164
|
+
* @returns map of namespace names to statistics, or paginated response if params provided
|
|
98
165
|
*/
|
|
99
|
-
getAllStats(): Promise<Record<string, KeyValueStats
|
|
166
|
+
getAllStats(params?: GetAllStatsParams): Promise<Record<string, KeyValueStats> | KeyValueStatsPaginated>;
|
|
100
167
|
/**
|
|
101
168
|
* get all namespace names
|
|
102
169
|
*
|
|
103
|
-
* @returns array of namespace names
|
|
170
|
+
* @returns array of namespace names (up to 1000)
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* This method returns a maximum of 1000 namespace names.
|
|
174
|
+
* If you have more than 1000 namespaces, only the first 1000
|
|
175
|
+
* (ordered by creation date, most recent first) will be returned.
|
|
104
176
|
*/
|
|
105
177
|
getNamespaces(): Promise<string[]>;
|
|
106
178
|
/**
|
|
@@ -128,21 +200,37 @@ export interface KeyValueStorage {
|
|
|
128
200
|
* create a new namespace
|
|
129
201
|
*
|
|
130
202
|
* @param name - the name of the key value storage to create
|
|
203
|
+
* @param params - optional parameters including default TTL
|
|
131
204
|
*/
|
|
132
|
-
createNamespace(name: string): Promise<void>;
|
|
205
|
+
createNamespace(name: string, params?: CreateNamespaceParams): Promise<void>;
|
|
133
206
|
}
|
|
134
207
|
export declare class KeyValueStorageService implements KeyValueStorage {
|
|
135
208
|
#private;
|
|
136
209
|
constructor(baseUrl: string, adapter: FetchAdapter);
|
|
137
210
|
get<T>(name: string, key: string): Promise<DataResult<T>>;
|
|
211
|
+
/**
|
|
212
|
+
* set a value in the key value storage
|
|
213
|
+
*
|
|
214
|
+
* @param name - the name of the key value storage
|
|
215
|
+
* @param key - the key to set the value of
|
|
216
|
+
* @param value - the value to set in any of the supported data types
|
|
217
|
+
* @param params - the KeyValueStorageSetParams
|
|
218
|
+
*
|
|
219
|
+
* @remarks
|
|
220
|
+
* TTL behavior:
|
|
221
|
+
* - If TTL is not specified, the key inherits the namespace's default TTL
|
|
222
|
+
* - TTL values below 60 seconds are clamped to 60 seconds
|
|
223
|
+
* - TTL values above 7,776,000 seconds (90 days) are clamped to 90 days
|
|
224
|
+
* - If the namespace doesn't exist, it is auto-created with a 7-day default TTL
|
|
225
|
+
*/
|
|
138
226
|
set<T = unknown>(name: string, key: string, value: T, params?: KeyValueStorageSetParams): Promise<void>;
|
|
139
227
|
delete(name: string, key: string): Promise<void>;
|
|
140
228
|
getStats(name: string): Promise<KeyValueStats>;
|
|
141
|
-
getAllStats(): Promise<Record<string, KeyValueStats
|
|
229
|
+
getAllStats(params?: GetAllStatsParams): Promise<Record<string, KeyValueStats> | KeyValueStatsPaginated>;
|
|
142
230
|
getNamespaces(): Promise<string[]>;
|
|
143
231
|
search<T = unknown>(name: string, keyword: string): Promise<Record<string, KeyValueItemWithMetadata<T>>>;
|
|
144
232
|
getKeys(name: string): Promise<string[]>;
|
|
145
233
|
deleteNamespace(name: string): Promise<void>;
|
|
146
|
-
createNamespace(name: string): Promise<void>;
|
|
234
|
+
createNamespace(name: string, params?: CreateNamespaceParams): Promise<void>;
|
|
147
235
|
}
|
|
148
236
|
//# sourceMappingURL=keyvalue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyvalue.d.ts","sourceRoot":"","sources":["../../src/services/keyvalue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,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b,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;IAoBjD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAiBxC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5C,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAsBlF"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { buildUrl, toServiceException, toPayload } from './_util';
|
|
2
2
|
import { StructuredError } from '../error';
|
|
3
|
+
/**
|
|
4
|
+
* Minimum TTL value in seconds (1 minute)
|
|
5
|
+
*/
|
|
6
|
+
export const KV_MIN_TTL_SECONDS = 60;
|
|
7
|
+
/**
|
|
8
|
+
* Maximum TTL value in seconds (90 days)
|
|
9
|
+
*/
|
|
10
|
+
export const KV_MAX_TTL_SECONDS = 7776000;
|
|
11
|
+
/**
|
|
12
|
+
* Default TTL value in seconds (7 days) - used when namespace is auto-created or no TTL specified
|
|
13
|
+
*/
|
|
14
|
+
export const KV_DEFAULT_TTL_SECONDS = 604800;
|
|
3
15
|
const KeyValueInvalidTTLError = StructuredError('KeyValueInvalidTTLError');
|
|
4
16
|
export class KeyValueStorageService {
|
|
5
17
|
#adapter;
|
|
@@ -34,6 +46,21 @@ export class KeyValueStorageService {
|
|
|
34
46
|
}
|
|
35
47
|
throw await toServiceException('GET', url, res.response);
|
|
36
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* set a value in the key value storage
|
|
51
|
+
*
|
|
52
|
+
* @param name - the name of the key value storage
|
|
53
|
+
* @param key - the key to set the value of
|
|
54
|
+
* @param value - the value to set in any of the supported data types
|
|
55
|
+
* @param params - the KeyValueStorageSetParams
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* TTL behavior:
|
|
59
|
+
* - If TTL is not specified, the key inherits the namespace's default TTL
|
|
60
|
+
* - TTL values below 60 seconds are clamped to 60 seconds
|
|
61
|
+
* - TTL values above 7,776,000 seconds (90 days) are clamped to 90 days
|
|
62
|
+
* - If the namespace doesn't exist, it is auto-created with a 7-day default TTL
|
|
63
|
+
*/
|
|
37
64
|
async set(name, key, value, params) {
|
|
38
65
|
let ttlstr = '';
|
|
39
66
|
if (params?.ttl) {
|
|
@@ -101,8 +128,16 @@ export class KeyValueStorageService {
|
|
|
101
128
|
}
|
|
102
129
|
throw await toServiceException('GET', url, res.response);
|
|
103
130
|
}
|
|
104
|
-
async getAllStats() {
|
|
105
|
-
const
|
|
131
|
+
async getAllStats(params) {
|
|
132
|
+
const queryParams = new URLSearchParams();
|
|
133
|
+
if (params?.limit !== undefined) {
|
|
134
|
+
queryParams.set('limit', String(params.limit));
|
|
135
|
+
}
|
|
136
|
+
if (params?.offset !== undefined) {
|
|
137
|
+
queryParams.set('offset', String(params.offset));
|
|
138
|
+
}
|
|
139
|
+
const queryString = queryParams.toString();
|
|
140
|
+
const url = buildUrl(this.#baseUrl, `/kv/2025-03-17/stats${queryString ? `?${queryString}` : ''}`);
|
|
106
141
|
const signal = AbortSignal.timeout(10_000);
|
|
107
142
|
const res = await this.#adapter.invoke(url, {
|
|
108
143
|
method: 'GET',
|
|
@@ -118,8 +153,20 @@ export class KeyValueStorageService {
|
|
|
118
153
|
throw await toServiceException('GET', url, res.response);
|
|
119
154
|
}
|
|
120
155
|
async getNamespaces() {
|
|
121
|
-
const
|
|
122
|
-
|
|
156
|
+
const url = buildUrl(this.#baseUrl, '/kv/2025-03-17/namespaces');
|
|
157
|
+
const signal = AbortSignal.timeout(10_000);
|
|
158
|
+
const res = await this.#adapter.invoke(url, {
|
|
159
|
+
method: 'GET',
|
|
160
|
+
signal,
|
|
161
|
+
telemetry: {
|
|
162
|
+
name: 'agentuity.keyvalue.getNamespaces',
|
|
163
|
+
attributes: {},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
if (res.ok) {
|
|
167
|
+
return res.data;
|
|
168
|
+
}
|
|
169
|
+
throw await toServiceException('GET', url, res.response);
|
|
123
170
|
}
|
|
124
171
|
async search(name, keyword) {
|
|
125
172
|
const url = buildUrl(this.#baseUrl, `/kv/2025-03-17/search/${encodeURIComponent(name)}/${encodeURIComponent(keyword)}`);
|
|
@@ -169,12 +216,16 @@ export class KeyValueStorageService {
|
|
|
169
216
|
}
|
|
170
217
|
throw await toServiceException('DELETE', url, res.response);
|
|
171
218
|
}
|
|
172
|
-
async createNamespace(name) {
|
|
219
|
+
async createNamespace(name, params) {
|
|
173
220
|
const url = buildUrl(this.#baseUrl, `/kv/2025-03-17/${encodeURIComponent(name)}`);
|
|
174
221
|
const signal = AbortSignal.timeout(10_000);
|
|
222
|
+
const body = params?.defaultTTLSeconds !== undefined
|
|
223
|
+
? JSON.stringify({ default_ttl_seconds: params.defaultTTLSeconds })
|
|
224
|
+
: undefined;
|
|
175
225
|
const res = await this.#adapter.invoke(url, {
|
|
176
226
|
method: 'POST',
|
|
177
227
|
signal,
|
|
228
|
+
...(body && { body, contentType: 'application/json' }),
|
|
178
229
|
telemetry: {
|
|
179
230
|
name: 'agentuity.keyvalue.createNamespace',
|
|
180
231
|
attributes: { name },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyvalue.js","sourceRoot":"","sources":["../../src/services/keyvalue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"keyvalue.js","sourceRoot":"","sources":["../../src/services/keyvalue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C;;GA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C,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAAY,EAAE,MAA8B;QACjE,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE3C,MAAM,IAAI,GAAG,MAAM,EAAE,iBAAiB,KAAK,SAAS;YACnD,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC;YACnE,CAAC,CAAC,SAAS,CAAC;QAEb,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE;YAC3C,MAAM,EAAE,MAAM;YACd,MAAM;YACN,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;YACtD,SAAS,EAAE;gBACV,IAAI,EAAE,oCAAoC;gBAC1C,UAAU,EAAE,EAAE,IAAI,EAAE;aACpB;SACD,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,OAAO;QACR,CAAC;QACD,MAAM,MAAM,kBAAkB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC;CACD"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module queue
|
|
3
|
+
*
|
|
4
|
+
* Queue service for publishing messages to Agentuity queues.
|
|
5
|
+
*
|
|
6
|
+
* This module provides a simplified interface for agents to publish messages
|
|
7
|
+
* to queues. For full queue management (CRUD, consume, acknowledge), use
|
|
8
|
+
* the `@agentuity/server` package.
|
|
9
|
+
*
|
|
10
|
+
* @example Publishing from an agent
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Inside an agent handler
|
|
13
|
+
* const result = await ctx.queue.publish('order-queue', {
|
|
14
|
+
* orderId: 123,
|
|
15
|
+
* action: 'process',
|
|
16
|
+
* });
|
|
17
|
+
* console.log(`Published message ${result.id}`);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import { FetchAdapter } from './adapter';
|
|
21
|
+
/**
|
|
22
|
+
* Parameters for publishing a message to a queue.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const params: QueuePublishParams = {
|
|
27
|
+
* metadata: { priority: 'high' },
|
|
28
|
+
* partitionKey: 'customer-123',
|
|
29
|
+
* idempotencyKey: 'order-456-v1',
|
|
30
|
+
* ttl: 3600, // 1 hour
|
|
31
|
+
* };
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export interface QueuePublishParams {
|
|
35
|
+
/**
|
|
36
|
+
* Optional metadata to attach to the message.
|
|
37
|
+
* Can contain any JSON-serializable data for message routing or filtering.
|
|
38
|
+
*/
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* Optional partition key for message ordering.
|
|
42
|
+
* Messages with the same partition key are guaranteed to be processed in order.
|
|
43
|
+
*/
|
|
44
|
+
partitionKey?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Optional idempotency key for deduplication.
|
|
47
|
+
* If a message with the same key was recently published, it will be deduplicated.
|
|
48
|
+
*/
|
|
49
|
+
idempotencyKey?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional time-to-live in seconds.
|
|
52
|
+
* Messages will expire and be removed after this duration.
|
|
53
|
+
*/
|
|
54
|
+
ttl?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Optional project ID for cross-project publishing.
|
|
57
|
+
* If not specified, uses the current project context.
|
|
58
|
+
*/
|
|
59
|
+
projectId?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional agent ID for attribution.
|
|
62
|
+
* If not specified, uses the current agent context.
|
|
63
|
+
*/
|
|
64
|
+
agentId?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Result of publishing a message to a queue.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const result = await queue.publish('my-queue', payload);
|
|
72
|
+
* console.log(`Message ${result.id} published at offset ${result.offset}`);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export interface QueuePublishResult {
|
|
76
|
+
/**
|
|
77
|
+
* The unique message ID (prefixed with msg_).
|
|
78
|
+
* Use this ID to track, acknowledge, or delete the message.
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
/**
|
|
82
|
+
* The sequential offset of the message in the queue.
|
|
83
|
+
* Offsets are monotonically increasing and can be used for log-style consumption.
|
|
84
|
+
*/
|
|
85
|
+
offset: number;
|
|
86
|
+
/**
|
|
87
|
+
* ISO 8601 timestamp when the message was published.
|
|
88
|
+
*/
|
|
89
|
+
publishedAt: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Queue service interface for publishing messages.
|
|
93
|
+
*
|
|
94
|
+
* This is the interface available to agents via `ctx.queue`. It provides
|
|
95
|
+
* a simple publish-only interface suitable for agent workflows.
|
|
96
|
+
*
|
|
97
|
+
* For full queue management (create queues, consume messages, manage destinations),
|
|
98
|
+
* use the `@agentuity/server` package.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* // In an agent handler
|
|
103
|
+
* export default createAgent('my-agent', {
|
|
104
|
+
* handler: async (ctx, input) => {
|
|
105
|
+
* // Publish a message to a queue
|
|
106
|
+
* await ctx.queue.publish('notifications', {
|
|
107
|
+
* type: 'email',
|
|
108
|
+
* to: input.email,
|
|
109
|
+
* subject: 'Welcome!',
|
|
110
|
+
* });
|
|
111
|
+
* return { success: true };
|
|
112
|
+
* },
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export interface QueueService {
|
|
117
|
+
/**
|
|
118
|
+
* Publish a message to a queue.
|
|
119
|
+
*
|
|
120
|
+
* The payload can be a string or an object. Objects are automatically
|
|
121
|
+
* JSON-stringified before publishing.
|
|
122
|
+
*
|
|
123
|
+
* @param queueName - The name of the queue to publish to
|
|
124
|
+
* @param payload - The message payload (string or JSON-serializable object)
|
|
125
|
+
* @param params - Optional publish parameters (metadata, TTL, etc.)
|
|
126
|
+
* @returns The publish result with message ID and offset
|
|
127
|
+
* @throws {QueueNotFoundError} If the queue does not exist
|
|
128
|
+
* @throws {QueueValidationError} If validation fails (invalid name, payload too large, etc.)
|
|
129
|
+
* @throws {QueuePublishError} If the publish operation fails
|
|
130
|
+
*
|
|
131
|
+
* @example Publishing a simple message
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const result = await ctx.queue.publish('my-queue', 'Hello, World!');
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @example Publishing with options
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const result = await ctx.queue.publish('my-queue', { task: 'process' }, {
|
|
139
|
+
* metadata: { priority: 'high' },
|
|
140
|
+
* idempotencyKey: 'task-123',
|
|
141
|
+
* ttl: 3600,
|
|
142
|
+
* });
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
publish(queueName: string, payload: string | object, params?: QueuePublishParams): Promise<QueuePublishResult>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Error thrown when a publish operation fails.
|
|
149
|
+
*
|
|
150
|
+
* This is a general error for publish failures that aren't specifically
|
|
151
|
+
* validation or not-found errors.
|
|
152
|
+
*/
|
|
153
|
+
export declare const QueuePublishError: {
|
|
154
|
+
new (args?: {
|
|
155
|
+
message?: string;
|
|
156
|
+
cause?: unknown;
|
|
157
|
+
} | undefined): import("..").RichError & {
|
|
158
|
+
readonly _tag: "QueuePublishError";
|
|
159
|
+
} & Readonly<Record<string, never>>;
|
|
160
|
+
readonly defaultMessage?: string;
|
|
161
|
+
} & (<Shape extends {
|
|
162
|
+
[x: string]: any;
|
|
163
|
+
} = Record<string, never>>() => {
|
|
164
|
+
new (args?: (Shape extends Record<string, never> ? {
|
|
165
|
+
message?: string;
|
|
166
|
+
cause?: unknown;
|
|
167
|
+
} : Shape & {
|
|
168
|
+
message?: string;
|
|
169
|
+
cause?: unknown;
|
|
170
|
+
}) | undefined): import("..").RichError & {
|
|
171
|
+
readonly _tag: "QueuePublishError";
|
|
172
|
+
} & Readonly<Shape>;
|
|
173
|
+
readonly defaultMessage?: string;
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* Error thrown when a queue is not found.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* try {
|
|
181
|
+
* await ctx.queue.publish('non-existent', 'payload');
|
|
182
|
+
* } catch (error) {
|
|
183
|
+
* if (error instanceof QueueNotFoundError) {
|
|
184
|
+
* console.error('Queue does not exist');
|
|
185
|
+
* }
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export declare const QueueNotFoundError: {
|
|
190
|
+
new (args?: {
|
|
191
|
+
message?: string;
|
|
192
|
+
cause?: unknown;
|
|
193
|
+
} | undefined): import("..").RichError & {
|
|
194
|
+
readonly _tag: "QueueNotFoundError";
|
|
195
|
+
} & Readonly<Record<string, never>>;
|
|
196
|
+
readonly defaultMessage?: string;
|
|
197
|
+
} & (<Shape extends {
|
|
198
|
+
[x: string]: any;
|
|
199
|
+
} = Record<string, never>>() => {
|
|
200
|
+
new (args?: (Shape extends Record<string, never> ? {
|
|
201
|
+
message?: string;
|
|
202
|
+
cause?: unknown;
|
|
203
|
+
} : Shape & {
|
|
204
|
+
message?: string;
|
|
205
|
+
cause?: unknown;
|
|
206
|
+
}) | undefined): import("..").RichError & {
|
|
207
|
+
readonly _tag: "QueueNotFoundError";
|
|
208
|
+
} & Readonly<Shape>;
|
|
209
|
+
readonly defaultMessage?: string;
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* Error thrown when validation fails.
|
|
213
|
+
*
|
|
214
|
+
* Contains the field name and optionally the invalid value for debugging.
|
|
215
|
+
*/
|
|
216
|
+
export declare const QueueValidationError: {
|
|
217
|
+
new (args?: ({
|
|
218
|
+
/** The field that failed validation */
|
|
219
|
+
field: string;
|
|
220
|
+
/** The invalid value (for debugging) */
|
|
221
|
+
value?: unknown;
|
|
222
|
+
} & {
|
|
223
|
+
message?: string;
|
|
224
|
+
cause?: unknown;
|
|
225
|
+
}) | undefined): import("..").RichError & {
|
|
226
|
+
readonly _tag: "QueueValidationError";
|
|
227
|
+
} & Readonly<{
|
|
228
|
+
/** The field that failed validation */
|
|
229
|
+
field: string;
|
|
230
|
+
/** The invalid value (for debugging) */
|
|
231
|
+
value?: unknown;
|
|
232
|
+
}>;
|
|
233
|
+
readonly defaultMessage?: string;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* HTTP-based implementation of the QueueService interface.
|
|
237
|
+
*
|
|
238
|
+
* This service communicates with the Agentuity Queue API to publish messages.
|
|
239
|
+
* It is automatically configured and available via `ctx.queue` in agent handlers.
|
|
240
|
+
*
|
|
241
|
+
* @internal This class is instantiated by the runtime; use `ctx.queue` instead.
|
|
242
|
+
*/
|
|
243
|
+
export declare class QueueStorageService implements QueueService {
|
|
244
|
+
#private;
|
|
245
|
+
/**
|
|
246
|
+
* Creates a new QueueStorageService.
|
|
247
|
+
*
|
|
248
|
+
* @param baseUrl - The base URL of the Queue API
|
|
249
|
+
* @param adapter - The fetch adapter for making HTTP requests
|
|
250
|
+
*/
|
|
251
|
+
constructor(baseUrl: string, adapter: FetchAdapter);
|
|
252
|
+
/**
|
|
253
|
+
* @inheritdoc
|
|
254
|
+
*/
|
|
255
|
+
publish(queueName: string, payload: string | object, params?: QueuePublishParams): Promise<QueuePublishResult>;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@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