@codegraff/relay 0.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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/index.cjs +1071 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1088 -0
- package/dist/index.d.ts +1088 -0
- package/dist/index.js +1019 -0
- package/dist/index.js.map +1 -0
- package/openapi/relay.yaml +835 -0
- package/package.json +56 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1088 @@
|
|
|
1
|
+
type AuthToken = string | undefined;
|
|
2
|
+
interface Auth {
|
|
3
|
+
/**
|
|
4
|
+
* Which part of the request do we use to send the auth?
|
|
5
|
+
*
|
|
6
|
+
* @default 'header'
|
|
7
|
+
*/
|
|
8
|
+
in?: 'header' | 'query' | 'cookie';
|
|
9
|
+
/**
|
|
10
|
+
* Header or query parameter name.
|
|
11
|
+
*
|
|
12
|
+
* @default 'Authorization'
|
|
13
|
+
*/
|
|
14
|
+
name?: string;
|
|
15
|
+
scheme?: 'basic' | 'bearer';
|
|
16
|
+
type: 'apiKey' | 'http';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface SerializerOptions<T> {
|
|
20
|
+
/**
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
explode: boolean;
|
|
24
|
+
style: T;
|
|
25
|
+
}
|
|
26
|
+
type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
27
|
+
type ObjectStyle = 'form' | 'deepObject';
|
|
28
|
+
|
|
29
|
+
type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
30
|
+
type BodySerializer = (body: unknown) => unknown;
|
|
31
|
+
type QuerySerializerOptionsObject = {
|
|
32
|
+
allowReserved?: boolean;
|
|
33
|
+
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
34
|
+
object?: Partial<SerializerOptions<ObjectStyle>>;
|
|
35
|
+
};
|
|
36
|
+
type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
37
|
+
/**
|
|
38
|
+
* Per-parameter serialization overrides. When provided, these settings
|
|
39
|
+
* override the global array/object settings for specific parameter names.
|
|
40
|
+
*/
|
|
41
|
+
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
45
|
+
type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
46
|
+
/**
|
|
47
|
+
* Returns the final request URL.
|
|
48
|
+
*/
|
|
49
|
+
buildUrl: BuildUrlFn;
|
|
50
|
+
getConfig: () => Config;
|
|
51
|
+
request: RequestFn;
|
|
52
|
+
setConfig: (config: Config) => Config;
|
|
53
|
+
} & {
|
|
54
|
+
[K in HttpMethod]: MethodFn;
|
|
55
|
+
} & ([SseFn] extends [never] ? {
|
|
56
|
+
sse?: never;
|
|
57
|
+
} : {
|
|
58
|
+
sse: {
|
|
59
|
+
[K in HttpMethod]: SseFn;
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
interface Config$1 {
|
|
63
|
+
/**
|
|
64
|
+
* Auth token or a function returning auth token. The resolved value will be
|
|
65
|
+
* added to the request payload as defined by its `security` array.
|
|
66
|
+
*/
|
|
67
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
68
|
+
/**
|
|
69
|
+
* A function for serializing request body parameter. By default,
|
|
70
|
+
* {@link JSON.stringify()} will be used.
|
|
71
|
+
*/
|
|
72
|
+
bodySerializer?: BodySerializer | null;
|
|
73
|
+
/**
|
|
74
|
+
* An object containing any HTTP headers that you want to pre-populate your
|
|
75
|
+
* `Headers` object with.
|
|
76
|
+
*
|
|
77
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
78
|
+
*/
|
|
79
|
+
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
80
|
+
/**
|
|
81
|
+
* The request method.
|
|
82
|
+
*
|
|
83
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
84
|
+
*/
|
|
85
|
+
method?: Uppercase<HttpMethod>;
|
|
86
|
+
/**
|
|
87
|
+
* A function for serializing request query parameters. By default, arrays
|
|
88
|
+
* will be exploded in form style, objects will be exploded in deepObject
|
|
89
|
+
* style, and reserved characters are percent-encoded.
|
|
90
|
+
*
|
|
91
|
+
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
92
|
+
* API function is used.
|
|
93
|
+
*
|
|
94
|
+
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
95
|
+
*/
|
|
96
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
97
|
+
/**
|
|
98
|
+
* A function validating request data. This is useful if you want to ensure
|
|
99
|
+
* the request conforms to the desired shape, so it can be safely sent to
|
|
100
|
+
* the server.
|
|
101
|
+
*/
|
|
102
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
103
|
+
/**
|
|
104
|
+
* A function transforming response data before it's returned. This is useful
|
|
105
|
+
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
106
|
+
*/
|
|
107
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
108
|
+
/**
|
|
109
|
+
* A function validating response data. This is useful if you want to ensure
|
|
110
|
+
* the response conforms to the desired shape, so it can be safely passed to
|
|
111
|
+
* the transformers and returned to the user.
|
|
112
|
+
*/
|
|
113
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
117
|
+
/**
|
|
118
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
119
|
+
* fetch instance.
|
|
120
|
+
*
|
|
121
|
+
* @default globalThis.fetch
|
|
122
|
+
*/
|
|
123
|
+
fetch?: typeof fetch;
|
|
124
|
+
/**
|
|
125
|
+
* Implementing clients can call request interceptors inside this hook.
|
|
126
|
+
*/
|
|
127
|
+
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
128
|
+
/**
|
|
129
|
+
* Callback invoked when a network or parsing error occurs during streaming.
|
|
130
|
+
*
|
|
131
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
132
|
+
*
|
|
133
|
+
* @param error The error that occurred.
|
|
134
|
+
*/
|
|
135
|
+
onSseError?: (error: unknown) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Callback invoked when an event is streamed from the server.
|
|
138
|
+
*
|
|
139
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
140
|
+
*
|
|
141
|
+
* @param event Event streamed from the server.
|
|
142
|
+
* @returns Nothing (void).
|
|
143
|
+
*/
|
|
144
|
+
onSseEvent?: (event: StreamEvent<TData>) => void;
|
|
145
|
+
serializedBody?: RequestInit['body'];
|
|
146
|
+
/**
|
|
147
|
+
* Default retry delay in milliseconds.
|
|
148
|
+
*
|
|
149
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
150
|
+
*
|
|
151
|
+
* @default 3000
|
|
152
|
+
*/
|
|
153
|
+
sseDefaultRetryDelay?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Maximum number of retry attempts before giving up.
|
|
156
|
+
*/
|
|
157
|
+
sseMaxRetryAttempts?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Maximum retry delay in milliseconds.
|
|
160
|
+
*
|
|
161
|
+
* Applies only when exponential backoff is used.
|
|
162
|
+
*
|
|
163
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
164
|
+
*
|
|
165
|
+
* @default 30000
|
|
166
|
+
*/
|
|
167
|
+
sseMaxRetryDelay?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Optional sleep function for retry backoff.
|
|
170
|
+
*
|
|
171
|
+
* Defaults to using `setTimeout`.
|
|
172
|
+
*/
|
|
173
|
+
sseSleepFn?: (ms: number) => Promise<void>;
|
|
174
|
+
url: string;
|
|
175
|
+
};
|
|
176
|
+
interface StreamEvent<TData = unknown> {
|
|
177
|
+
data: TData;
|
|
178
|
+
event?: string;
|
|
179
|
+
id?: string;
|
|
180
|
+
retry?: number;
|
|
181
|
+
}
|
|
182
|
+
type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
183
|
+
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
|
|
187
|
+
/** response may be undefined due to a network error where no response object is produced */
|
|
188
|
+
response: Res | undefined,
|
|
189
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
190
|
+
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
191
|
+
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
192
|
+
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
193
|
+
declare class Interceptors<Interceptor> {
|
|
194
|
+
fns: Array<Interceptor | null>;
|
|
195
|
+
clear(): void;
|
|
196
|
+
eject(id: number | Interceptor): void;
|
|
197
|
+
exists(id: number | Interceptor): boolean;
|
|
198
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
199
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
200
|
+
use(fn: Interceptor): number;
|
|
201
|
+
}
|
|
202
|
+
interface Middleware<Req, Res, Err, Options> {
|
|
203
|
+
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
204
|
+
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
205
|
+
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
type ResponseStyle = 'data' | 'fields';
|
|
209
|
+
interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
|
|
210
|
+
/**
|
|
211
|
+
* Base URL for all requests made by this client.
|
|
212
|
+
*/
|
|
213
|
+
baseUrl?: T['baseUrl'];
|
|
214
|
+
/**
|
|
215
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
216
|
+
* fetch instance.
|
|
217
|
+
*
|
|
218
|
+
* @default globalThis.fetch
|
|
219
|
+
*/
|
|
220
|
+
fetch?: typeof fetch;
|
|
221
|
+
/**
|
|
222
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
223
|
+
* options won't have any effect.
|
|
224
|
+
*
|
|
225
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
226
|
+
*/
|
|
227
|
+
next?: never;
|
|
228
|
+
/**
|
|
229
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
230
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
231
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
232
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
233
|
+
*
|
|
234
|
+
* @default 'auto'
|
|
235
|
+
*/
|
|
236
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
237
|
+
/**
|
|
238
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
239
|
+
*
|
|
240
|
+
* @default 'fields'
|
|
241
|
+
*/
|
|
242
|
+
responseStyle?: ResponseStyle;
|
|
243
|
+
/**
|
|
244
|
+
* Throw an error instead of returning it in the response?
|
|
245
|
+
*
|
|
246
|
+
* @default false
|
|
247
|
+
*/
|
|
248
|
+
throwOnError?: T['throwOnError'];
|
|
249
|
+
}
|
|
250
|
+
interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
251
|
+
responseStyle: TResponseStyle;
|
|
252
|
+
throwOnError: ThrowOnError;
|
|
253
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
254
|
+
/**
|
|
255
|
+
* Any body that you want to add to your request.
|
|
256
|
+
*
|
|
257
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
258
|
+
*/
|
|
259
|
+
body?: unknown;
|
|
260
|
+
path?: Record<string, unknown>;
|
|
261
|
+
query?: Record<string, unknown>;
|
|
262
|
+
/**
|
|
263
|
+
* Security mechanism(s) to use for the request.
|
|
264
|
+
*/
|
|
265
|
+
security?: ReadonlyArray<Auth>;
|
|
266
|
+
url: Url;
|
|
267
|
+
}
|
|
268
|
+
interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
269
|
+
headers: Headers;
|
|
270
|
+
serializedBody?: string;
|
|
271
|
+
}
|
|
272
|
+
type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
273
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
274
|
+
request: Request;
|
|
275
|
+
response: Response;
|
|
276
|
+
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
277
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
278
|
+
error: undefined;
|
|
279
|
+
} | {
|
|
280
|
+
data: undefined;
|
|
281
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
282
|
+
}) & {
|
|
283
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
284
|
+
request?: Request;
|
|
285
|
+
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
286
|
+
response?: Response;
|
|
287
|
+
}>;
|
|
288
|
+
interface ClientOptions$1 {
|
|
289
|
+
baseUrl?: string;
|
|
290
|
+
responseStyle?: ResponseStyle;
|
|
291
|
+
throwOnError?: boolean;
|
|
292
|
+
}
|
|
293
|
+
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
294
|
+
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
295
|
+
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
296
|
+
type BuildUrlFn = <TData extends {
|
|
297
|
+
body?: unknown;
|
|
298
|
+
path?: Record<string, unknown>;
|
|
299
|
+
query?: Record<string, unknown>;
|
|
300
|
+
url: string;
|
|
301
|
+
}>(options: TData & Options$1<TData>) => string;
|
|
302
|
+
type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
303
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
304
|
+
};
|
|
305
|
+
interface TDataShape {
|
|
306
|
+
body?: unknown;
|
|
307
|
+
headers?: unknown;
|
|
308
|
+
path?: unknown;
|
|
309
|
+
query?: unknown;
|
|
310
|
+
url: string;
|
|
311
|
+
}
|
|
312
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
313
|
+
type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
314
|
+
|
|
315
|
+
type ClientOptions = {
|
|
316
|
+
baseUrl: 'https://yapper.codegraff.com/api/v1' | 'https://staging.yapper.codegraff.com/api/v1' | 'http://localhost:8787/api/v1' | (string & {});
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* RFC 7807-ish error.
|
|
320
|
+
*/
|
|
321
|
+
type Problem = {
|
|
322
|
+
type?: string;
|
|
323
|
+
title?: string;
|
|
324
|
+
status?: number;
|
|
325
|
+
detail?: string;
|
|
326
|
+
instance?: string;
|
|
327
|
+
};
|
|
328
|
+
type AgentKind = 'user' | 'service' | 'run';
|
|
329
|
+
type AgentStatus = 'active' | 'revoked';
|
|
330
|
+
type RoomStatus = 'active' | 'archived';
|
|
331
|
+
type MessageKind = 'text' | 'tool_call' | 'task_ref' | 'summary';
|
|
332
|
+
type Identity = {
|
|
333
|
+
agentId: string;
|
|
334
|
+
userId?: string;
|
|
335
|
+
orgId: string;
|
|
336
|
+
kind: AgentKind;
|
|
337
|
+
scopes: Array<string>;
|
|
338
|
+
machineId?: string;
|
|
339
|
+
};
|
|
340
|
+
type Agent = {
|
|
341
|
+
id: string;
|
|
342
|
+
orgId: string;
|
|
343
|
+
userId?: string;
|
|
344
|
+
name: string;
|
|
345
|
+
kind: AgentKind;
|
|
346
|
+
machineId?: string;
|
|
347
|
+
scopes: Array<string>;
|
|
348
|
+
status: AgentStatus;
|
|
349
|
+
lastSeen?: number;
|
|
350
|
+
createdAt: number;
|
|
351
|
+
};
|
|
352
|
+
type AgentCreate = {
|
|
353
|
+
name: string;
|
|
354
|
+
kind?: AgentKind;
|
|
355
|
+
scopes: Array<string>;
|
|
356
|
+
machineId?: string;
|
|
357
|
+
};
|
|
358
|
+
type Token = {
|
|
359
|
+
/**
|
|
360
|
+
* Bearer JWT. Returned exactly once.
|
|
361
|
+
*/
|
|
362
|
+
token: string;
|
|
363
|
+
expiresAt: number;
|
|
364
|
+
};
|
|
365
|
+
type AgentWithToken = {
|
|
366
|
+
agent: Agent;
|
|
367
|
+
token: Token;
|
|
368
|
+
};
|
|
369
|
+
type RoomBinding = {
|
|
370
|
+
kind: 'manual';
|
|
371
|
+
} | {
|
|
372
|
+
kind: 'project';
|
|
373
|
+
repo: string;
|
|
374
|
+
} | {
|
|
375
|
+
kind: 'branch';
|
|
376
|
+
repo: string;
|
|
377
|
+
branch: string;
|
|
378
|
+
base?: string;
|
|
379
|
+
};
|
|
380
|
+
type Outcome = {
|
|
381
|
+
commitSha?: string;
|
|
382
|
+
prNumber?: number;
|
|
383
|
+
prUrl?: string;
|
|
384
|
+
mergedAt?: number;
|
|
385
|
+
revertedAt?: number;
|
|
386
|
+
testsPassed?: boolean;
|
|
387
|
+
releaseTag?: string;
|
|
388
|
+
releaseUrl?: string;
|
|
389
|
+
releasedAt?: number;
|
|
390
|
+
};
|
|
391
|
+
type Room = {
|
|
392
|
+
id: string;
|
|
393
|
+
orgId: string;
|
|
394
|
+
name: string;
|
|
395
|
+
topic?: string;
|
|
396
|
+
binding: RoomBinding;
|
|
397
|
+
envBucket?: string;
|
|
398
|
+
parentRoomId?: string;
|
|
399
|
+
status: RoomStatus;
|
|
400
|
+
coordinatorAgentId?: string;
|
|
401
|
+
memberAgentIds?: Array<string>;
|
|
402
|
+
latestSeq: number;
|
|
403
|
+
outcome?: Outcome;
|
|
404
|
+
createdAt: number;
|
|
405
|
+
};
|
|
406
|
+
type RoomBootstrap = {
|
|
407
|
+
room: Room;
|
|
408
|
+
latestSummary?: {
|
|
409
|
+
content?: string;
|
|
410
|
+
uptoSeq?: number;
|
|
411
|
+
};
|
|
412
|
+
recent: Array<Message>;
|
|
413
|
+
cursor: number;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Cheap filters used by discover.ambient/ask. Fields are optional —
|
|
417
|
+
* whatever the caller can produce. Indexed alongside the message.
|
|
418
|
+
*
|
|
419
|
+
*/
|
|
420
|
+
type Fingerprint = {
|
|
421
|
+
envHash?: string;
|
|
422
|
+
toolCallSignature?: string;
|
|
423
|
+
errorSig?: string;
|
|
424
|
+
filePaths?: Array<string>;
|
|
425
|
+
taskIntent?: string;
|
|
426
|
+
};
|
|
427
|
+
type Message = {
|
|
428
|
+
id: string;
|
|
429
|
+
roomId: string;
|
|
430
|
+
seq: number;
|
|
431
|
+
authorAgentId: string;
|
|
432
|
+
kind: MessageKind;
|
|
433
|
+
content: string;
|
|
434
|
+
refs?: Array<string>;
|
|
435
|
+
fingerprint?: Fingerprint;
|
|
436
|
+
createdAt: number;
|
|
437
|
+
};
|
|
438
|
+
type MessagePage = {
|
|
439
|
+
messages: Array<Message>;
|
|
440
|
+
nextCursor: number;
|
|
441
|
+
};
|
|
442
|
+
type WaitResult = {
|
|
443
|
+
messages: Array<Message>;
|
|
444
|
+
nextCursor: number;
|
|
445
|
+
timedOut: boolean;
|
|
446
|
+
};
|
|
447
|
+
type Memory = {
|
|
448
|
+
id: string;
|
|
449
|
+
orgId: string;
|
|
450
|
+
scope: 'agent' | 'room' | 'team' | 'org';
|
|
451
|
+
scopeId: string;
|
|
452
|
+
kind: string;
|
|
453
|
+
content: string;
|
|
454
|
+
tags?: Array<string>;
|
|
455
|
+
createdBy: string;
|
|
456
|
+
ttl?: number;
|
|
457
|
+
createdAt: number;
|
|
458
|
+
};
|
|
459
|
+
type MemoryCreate = {
|
|
460
|
+
scope: 'agent' | 'room' | 'team' | 'org';
|
|
461
|
+
scopeId: string;
|
|
462
|
+
kind: string;
|
|
463
|
+
content: string;
|
|
464
|
+
tags?: Array<string>;
|
|
465
|
+
ttl?: number;
|
|
466
|
+
};
|
|
467
|
+
type MemorySearch = {
|
|
468
|
+
scope?: 'agent' | 'room' | 'team' | 'org';
|
|
469
|
+
scopeId?: string;
|
|
470
|
+
envBucket?: string;
|
|
471
|
+
query: string;
|
|
472
|
+
k?: number;
|
|
473
|
+
};
|
|
474
|
+
type MemoryHit = {
|
|
475
|
+
memory: Memory;
|
|
476
|
+
score: number;
|
|
477
|
+
};
|
|
478
|
+
type Task = {
|
|
479
|
+
id: string;
|
|
480
|
+
orgId: string;
|
|
481
|
+
roomId?: string;
|
|
482
|
+
spec: string;
|
|
483
|
+
targetScope: string;
|
|
484
|
+
status: 'open' | 'claimed' | 'complete' | 'failed';
|
|
485
|
+
claimedBy?: string;
|
|
486
|
+
result?: string;
|
|
487
|
+
parentTaskId?: string;
|
|
488
|
+
createdAt: number;
|
|
489
|
+
};
|
|
490
|
+
type AmbientQuery = {
|
|
491
|
+
envBucket: string;
|
|
492
|
+
taskIntent?: string;
|
|
493
|
+
filePaths?: Array<string>;
|
|
494
|
+
k?: number;
|
|
495
|
+
};
|
|
496
|
+
type AskQuery = {
|
|
497
|
+
errorSig?: string;
|
|
498
|
+
toolCallSignature?: string;
|
|
499
|
+
recentTrajectory?: Array<{
|
|
500
|
+
[key: string]: unknown;
|
|
501
|
+
}>;
|
|
502
|
+
envBucket?: string;
|
|
503
|
+
k?: number;
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* Verified prior resolution returned by discover.ambient/ask. Capped at
|
|
507
|
+
* ~400 tokens combined per page so the agent can fold these in without
|
|
508
|
+
* bloating its context.
|
|
509
|
+
*
|
|
510
|
+
*/
|
|
511
|
+
type Resolution = {
|
|
512
|
+
captureId: string;
|
|
513
|
+
summary: string;
|
|
514
|
+
diff?: string;
|
|
515
|
+
verification?: {
|
|
516
|
+
replayStatus?: 'clean_replay_passed' | 'replay_diverged' | 'unreplayable' | 'unverified';
|
|
517
|
+
testOutcome?: 'pass' | 'fail' | 'none';
|
|
518
|
+
mergeStatus?: 'merged' | 'merged_then_reverted' | 'abandoned' | 'unknown';
|
|
519
|
+
humanSignal?: 'applied_clean' | 'edited_after' | 'rewritten' | 'none';
|
|
520
|
+
inProduction?: boolean;
|
|
521
|
+
};
|
|
522
|
+
score: number;
|
|
523
|
+
provenance?: {
|
|
524
|
+
agentId?: string;
|
|
525
|
+
repo?: string;
|
|
526
|
+
branch?: string;
|
|
527
|
+
commitSha?: string;
|
|
528
|
+
releaseTag?: string;
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
type ResolutionPage = {
|
|
532
|
+
resolutions: Array<Resolution>;
|
|
533
|
+
};
|
|
534
|
+
type IdentityWhoamiData = {
|
|
535
|
+
body?: never;
|
|
536
|
+
path?: never;
|
|
537
|
+
query?: never;
|
|
538
|
+
url: '/identity/whoami';
|
|
539
|
+
};
|
|
540
|
+
type IdentityWhoamiErrors = {
|
|
541
|
+
/**
|
|
542
|
+
* Missing or invalid Bearer token.
|
|
543
|
+
*/
|
|
544
|
+
401: Problem;
|
|
545
|
+
};
|
|
546
|
+
type IdentityWhoamiError = IdentityWhoamiErrors[keyof IdentityWhoamiErrors];
|
|
547
|
+
type IdentityWhoamiResponses = {
|
|
548
|
+
/**
|
|
549
|
+
* Identity context
|
|
550
|
+
*/
|
|
551
|
+
200: Identity;
|
|
552
|
+
};
|
|
553
|
+
type IdentityWhoamiResponse = IdentityWhoamiResponses[keyof IdentityWhoamiResponses];
|
|
554
|
+
type ListAgentsData = {
|
|
555
|
+
body?: never;
|
|
556
|
+
path?: never;
|
|
557
|
+
query?: {
|
|
558
|
+
status?: AgentStatus;
|
|
559
|
+
kind?: AgentKind;
|
|
560
|
+
};
|
|
561
|
+
url: '/agents';
|
|
562
|
+
};
|
|
563
|
+
type ListAgentsResponses = {
|
|
564
|
+
/**
|
|
565
|
+
* Agents
|
|
566
|
+
*/
|
|
567
|
+
200: {
|
|
568
|
+
agents: Array<Agent>;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
type ListAgentsResponse = ListAgentsResponses[keyof ListAgentsResponses];
|
|
572
|
+
type CreateAgentData = {
|
|
573
|
+
body: AgentCreate;
|
|
574
|
+
path?: never;
|
|
575
|
+
query?: never;
|
|
576
|
+
url: '/agents';
|
|
577
|
+
};
|
|
578
|
+
type CreateAgentResponses = {
|
|
579
|
+
/**
|
|
580
|
+
* Created agent + bearer token (returned exactly once).
|
|
581
|
+
*/
|
|
582
|
+
201: AgentWithToken;
|
|
583
|
+
};
|
|
584
|
+
type CreateAgentResponse = CreateAgentResponses[keyof CreateAgentResponses];
|
|
585
|
+
type RevokeAgentData = {
|
|
586
|
+
body?: never;
|
|
587
|
+
path: {
|
|
588
|
+
agentId: string;
|
|
589
|
+
};
|
|
590
|
+
query?: never;
|
|
591
|
+
url: '/agents/{agentId}';
|
|
592
|
+
};
|
|
593
|
+
type RevokeAgentResponses = {
|
|
594
|
+
/**
|
|
595
|
+
* Revoked
|
|
596
|
+
*/
|
|
597
|
+
204: void;
|
|
598
|
+
};
|
|
599
|
+
type RevokeAgentResponse = RevokeAgentResponses[keyof RevokeAgentResponses];
|
|
600
|
+
type MintRunTokenData = {
|
|
601
|
+
body: {
|
|
602
|
+
ttlHours?: number;
|
|
603
|
+
scopes: Array<string>;
|
|
604
|
+
};
|
|
605
|
+
path: {
|
|
606
|
+
agentId: string;
|
|
607
|
+
};
|
|
608
|
+
query?: never;
|
|
609
|
+
url: '/agents/{agentId}/run-tokens';
|
|
610
|
+
};
|
|
611
|
+
type MintRunTokenResponses = {
|
|
612
|
+
/**
|
|
613
|
+
* Token
|
|
614
|
+
*/
|
|
615
|
+
201: Token;
|
|
616
|
+
};
|
|
617
|
+
type MintRunTokenResponse = MintRunTokenResponses[keyof MintRunTokenResponses];
|
|
618
|
+
type CreateServiceTokenData = {
|
|
619
|
+
body: {
|
|
620
|
+
/**
|
|
621
|
+
* Display name (e.g. `cursor-bg-acme`)
|
|
622
|
+
*/
|
|
623
|
+
name: string;
|
|
624
|
+
scopes: Array<string>;
|
|
625
|
+
machineId?: string;
|
|
626
|
+
};
|
|
627
|
+
path?: never;
|
|
628
|
+
query?: never;
|
|
629
|
+
url: '/service-tokens';
|
|
630
|
+
};
|
|
631
|
+
type CreateServiceTokenResponses = {
|
|
632
|
+
/**
|
|
633
|
+
* Service agent + token (token returned exactly once).
|
|
634
|
+
*/
|
|
635
|
+
201: AgentWithToken;
|
|
636
|
+
};
|
|
637
|
+
type CreateServiceTokenResponse = CreateServiceTokenResponses[keyof CreateServiceTokenResponses];
|
|
638
|
+
type ListRoomsData = {
|
|
639
|
+
body?: never;
|
|
640
|
+
path?: never;
|
|
641
|
+
query?: {
|
|
642
|
+
status?: RoomStatus;
|
|
643
|
+
repo?: string;
|
|
644
|
+
branch?: string;
|
|
645
|
+
releaseTag?: string;
|
|
646
|
+
};
|
|
647
|
+
url: '/rooms';
|
|
648
|
+
};
|
|
649
|
+
type ListRoomsResponses = {
|
|
650
|
+
/**
|
|
651
|
+
* Rooms
|
|
652
|
+
*/
|
|
653
|
+
200: {
|
|
654
|
+
rooms: Array<Room>;
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
type ListRoomsResponse = ListRoomsResponses[keyof ListRoomsResponses];
|
|
658
|
+
type CreateRoomData = {
|
|
659
|
+
body: {
|
|
660
|
+
name: string;
|
|
661
|
+
topic?: string;
|
|
662
|
+
memberAgentIds?: Array<string>;
|
|
663
|
+
};
|
|
664
|
+
path?: never;
|
|
665
|
+
query?: never;
|
|
666
|
+
url: '/rooms';
|
|
667
|
+
};
|
|
668
|
+
type CreateRoomResponses = {
|
|
669
|
+
/**
|
|
670
|
+
* Created
|
|
671
|
+
*/
|
|
672
|
+
201: Room;
|
|
673
|
+
};
|
|
674
|
+
type CreateRoomResponse = CreateRoomResponses[keyof CreateRoomResponses];
|
|
675
|
+
type RoomForBranchData = {
|
|
676
|
+
body: {
|
|
677
|
+
repo: string;
|
|
678
|
+
branch: string;
|
|
679
|
+
base?: string;
|
|
680
|
+
};
|
|
681
|
+
path?: never;
|
|
682
|
+
query?: never;
|
|
683
|
+
url: '/rooms/branch';
|
|
684
|
+
};
|
|
685
|
+
type RoomForBranchResponses = {
|
|
686
|
+
/**
|
|
687
|
+
* Existing or freshly created
|
|
688
|
+
*/
|
|
689
|
+
200: Room;
|
|
690
|
+
};
|
|
691
|
+
type RoomForBranchResponse = RoomForBranchResponses[keyof RoomForBranchResponses];
|
|
692
|
+
type BootstrapRoomData = {
|
|
693
|
+
body?: never;
|
|
694
|
+
path: {
|
|
695
|
+
roomId: string;
|
|
696
|
+
};
|
|
697
|
+
query?: never;
|
|
698
|
+
url: '/rooms/{roomId}/bootstrap';
|
|
699
|
+
};
|
|
700
|
+
type BootstrapRoomResponses = {
|
|
701
|
+
/**
|
|
702
|
+
* Bootstrap payload
|
|
703
|
+
*/
|
|
704
|
+
200: RoomBootstrap;
|
|
705
|
+
};
|
|
706
|
+
type BootstrapRoomResponse = BootstrapRoomResponses[keyof BootstrapRoomResponses];
|
|
707
|
+
type ReadMessagesData = {
|
|
708
|
+
body?: never;
|
|
709
|
+
path: {
|
|
710
|
+
roomId: string;
|
|
711
|
+
};
|
|
712
|
+
query: {
|
|
713
|
+
since: number;
|
|
714
|
+
limit?: number;
|
|
715
|
+
};
|
|
716
|
+
url: '/rooms/{roomId}/messages';
|
|
717
|
+
};
|
|
718
|
+
type ReadMessagesResponses = {
|
|
719
|
+
/**
|
|
720
|
+
* Messages
|
|
721
|
+
*/
|
|
722
|
+
200: MessagePage;
|
|
723
|
+
};
|
|
724
|
+
type ReadMessagesResponse = ReadMessagesResponses[keyof ReadMessagesResponses];
|
|
725
|
+
type PostMessageData = {
|
|
726
|
+
body: {
|
|
727
|
+
content: string;
|
|
728
|
+
kind?: MessageKind;
|
|
729
|
+
refs?: Array<string>;
|
|
730
|
+
fingerprint?: Fingerprint;
|
|
731
|
+
};
|
|
732
|
+
path: {
|
|
733
|
+
roomId: string;
|
|
734
|
+
};
|
|
735
|
+
query?: never;
|
|
736
|
+
url: '/rooms/{roomId}/messages';
|
|
737
|
+
};
|
|
738
|
+
type PostMessageResponses = {
|
|
739
|
+
/**
|
|
740
|
+
* Posted
|
|
741
|
+
*/
|
|
742
|
+
201: Message;
|
|
743
|
+
};
|
|
744
|
+
type PostMessageResponse = PostMessageResponses[keyof PostMessageResponses];
|
|
745
|
+
type WaitForMessagesData = {
|
|
746
|
+
body?: never;
|
|
747
|
+
path: {
|
|
748
|
+
roomId: string;
|
|
749
|
+
};
|
|
750
|
+
query: {
|
|
751
|
+
since: number;
|
|
752
|
+
timeoutMs?: number;
|
|
753
|
+
};
|
|
754
|
+
url: '/rooms/{roomId}/wait';
|
|
755
|
+
};
|
|
756
|
+
type WaitForMessagesResponses = {
|
|
757
|
+
/**
|
|
758
|
+
* Wait result
|
|
759
|
+
*/
|
|
760
|
+
200: WaitResult;
|
|
761
|
+
};
|
|
762
|
+
type WaitForMessagesResponse = WaitForMessagesResponses[keyof WaitForMessagesResponses];
|
|
763
|
+
type DeclareRoomDoneData = {
|
|
764
|
+
body: {
|
|
765
|
+
reason: string;
|
|
766
|
+
outcome?: Outcome;
|
|
767
|
+
};
|
|
768
|
+
path: {
|
|
769
|
+
roomId: string;
|
|
770
|
+
};
|
|
771
|
+
query?: never;
|
|
772
|
+
url: '/rooms/{roomId}/declare-done';
|
|
773
|
+
};
|
|
774
|
+
type DeclareRoomDoneResponses = {
|
|
775
|
+
/**
|
|
776
|
+
* OK
|
|
777
|
+
*/
|
|
778
|
+
200: unknown;
|
|
779
|
+
};
|
|
780
|
+
type DeclareRoomBlockedData = {
|
|
781
|
+
body: {
|
|
782
|
+
reason: string;
|
|
783
|
+
needsHuman?: boolean;
|
|
784
|
+
};
|
|
785
|
+
path: {
|
|
786
|
+
roomId: string;
|
|
787
|
+
};
|
|
788
|
+
query?: never;
|
|
789
|
+
url: '/rooms/{roomId}/declare-blocked';
|
|
790
|
+
};
|
|
791
|
+
type DeclareRoomBlockedResponses = {
|
|
792
|
+
/**
|
|
793
|
+
* OK
|
|
794
|
+
*/
|
|
795
|
+
200: unknown;
|
|
796
|
+
};
|
|
797
|
+
type GetRoomStateData = {
|
|
798
|
+
body?: never;
|
|
799
|
+
path: {
|
|
800
|
+
roomId: string;
|
|
801
|
+
};
|
|
802
|
+
query?: never;
|
|
803
|
+
url: '/rooms/{roomId}/state';
|
|
804
|
+
};
|
|
805
|
+
type GetRoomStateResponses = {
|
|
806
|
+
/**
|
|
807
|
+
* State
|
|
808
|
+
*/
|
|
809
|
+
200: {
|
|
810
|
+
[key: string]: unknown;
|
|
811
|
+
};
|
|
812
|
+
};
|
|
813
|
+
type GetRoomStateResponse = GetRoomStateResponses[keyof GetRoomStateResponses];
|
|
814
|
+
type PatchRoomStateData = {
|
|
815
|
+
body: {
|
|
816
|
+
[key: string]: unknown;
|
|
817
|
+
};
|
|
818
|
+
path: {
|
|
819
|
+
roomId: string;
|
|
820
|
+
};
|
|
821
|
+
query?: never;
|
|
822
|
+
url: '/rooms/{roomId}/state';
|
|
823
|
+
};
|
|
824
|
+
type PatchRoomStateResponses = {
|
|
825
|
+
/**
|
|
826
|
+
* Updated state
|
|
827
|
+
*/
|
|
828
|
+
200: {
|
|
829
|
+
[key: string]: unknown;
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
type PatchRoomStateResponse = PatchRoomStateResponses[keyof PatchRoomStateResponses];
|
|
833
|
+
type SearchMemoryData = {
|
|
834
|
+
body: MemorySearch;
|
|
835
|
+
path?: never;
|
|
836
|
+
query?: never;
|
|
837
|
+
url: '/memory/search';
|
|
838
|
+
};
|
|
839
|
+
type SearchMemoryResponses = {
|
|
840
|
+
/**
|
|
841
|
+
* Hits
|
|
842
|
+
*/
|
|
843
|
+
200: {
|
|
844
|
+
hits: Array<MemoryHit>;
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
type SearchMemoryResponse = SearchMemoryResponses[keyof SearchMemoryResponses];
|
|
848
|
+
type WriteMemoryData = {
|
|
849
|
+
body: MemoryCreate;
|
|
850
|
+
path?: never;
|
|
851
|
+
query?: never;
|
|
852
|
+
url: '/memory';
|
|
853
|
+
};
|
|
854
|
+
type WriteMemoryResponses = {
|
|
855
|
+
/**
|
|
856
|
+
* Written
|
|
857
|
+
*/
|
|
858
|
+
201: Memory;
|
|
859
|
+
};
|
|
860
|
+
type WriteMemoryResponse = WriteMemoryResponses[keyof WriteMemoryResponses];
|
|
861
|
+
type ForgetMemoryData = {
|
|
862
|
+
body?: never;
|
|
863
|
+
path: {
|
|
864
|
+
id: string;
|
|
865
|
+
};
|
|
866
|
+
query?: never;
|
|
867
|
+
url: '/memory/{id}';
|
|
868
|
+
};
|
|
869
|
+
type ForgetMemoryResponses = {
|
|
870
|
+
/**
|
|
871
|
+
* Forgotten
|
|
872
|
+
*/
|
|
873
|
+
204: void;
|
|
874
|
+
};
|
|
875
|
+
type ForgetMemoryResponse = ForgetMemoryResponses[keyof ForgetMemoryResponses];
|
|
876
|
+
type CreateTaskData = {
|
|
877
|
+
body: {
|
|
878
|
+
spec: string;
|
|
879
|
+
/**
|
|
880
|
+
* e.g. agent:abc123, team:eng, role:reviewer
|
|
881
|
+
*/
|
|
882
|
+
targetScope: string;
|
|
883
|
+
roomId?: string;
|
|
884
|
+
parentTaskId?: string;
|
|
885
|
+
};
|
|
886
|
+
path?: never;
|
|
887
|
+
query?: never;
|
|
888
|
+
url: '/tasks';
|
|
889
|
+
};
|
|
890
|
+
type CreateTaskResponses = {
|
|
891
|
+
/**
|
|
892
|
+
* Created
|
|
893
|
+
*/
|
|
894
|
+
201: Task;
|
|
895
|
+
};
|
|
896
|
+
type CreateTaskResponse = CreateTaskResponses[keyof CreateTaskResponses];
|
|
897
|
+
type NextTaskData = {
|
|
898
|
+
body?: never;
|
|
899
|
+
path?: never;
|
|
900
|
+
query?: never;
|
|
901
|
+
url: '/tasks/next';
|
|
902
|
+
};
|
|
903
|
+
type NextTaskResponses = {
|
|
904
|
+
/**
|
|
905
|
+
* Task or null
|
|
906
|
+
*/
|
|
907
|
+
200: Task | null;
|
|
908
|
+
};
|
|
909
|
+
type NextTaskResponse = NextTaskResponses[keyof NextTaskResponses];
|
|
910
|
+
type CompleteTaskData = {
|
|
911
|
+
body: {
|
|
912
|
+
result: string;
|
|
913
|
+
ok?: boolean;
|
|
914
|
+
};
|
|
915
|
+
path: {
|
|
916
|
+
taskId: string;
|
|
917
|
+
};
|
|
918
|
+
query?: never;
|
|
919
|
+
url: '/tasks/{taskId}/complete';
|
|
920
|
+
};
|
|
921
|
+
type CompleteTaskResponses = {
|
|
922
|
+
/**
|
|
923
|
+
* OK
|
|
924
|
+
*/
|
|
925
|
+
200: unknown;
|
|
926
|
+
};
|
|
927
|
+
type DiscoverAmbientData = {
|
|
928
|
+
body: AmbientQuery;
|
|
929
|
+
path?: never;
|
|
930
|
+
query?: never;
|
|
931
|
+
url: '/discover/ambient';
|
|
932
|
+
};
|
|
933
|
+
type DiscoverAmbientResponses = {
|
|
934
|
+
/**
|
|
935
|
+
* Resolutions
|
|
936
|
+
*/
|
|
937
|
+
200: ResolutionPage;
|
|
938
|
+
};
|
|
939
|
+
type DiscoverAmbientResponse = DiscoverAmbientResponses[keyof DiscoverAmbientResponses];
|
|
940
|
+
type DiscoverAskData = {
|
|
941
|
+
body: AskQuery;
|
|
942
|
+
path?: never;
|
|
943
|
+
query?: never;
|
|
944
|
+
url: '/discover/ask';
|
|
945
|
+
};
|
|
946
|
+
type DiscoverAskResponses = {
|
|
947
|
+
/**
|
|
948
|
+
* Resolutions
|
|
949
|
+
*/
|
|
950
|
+
200: ResolutionPage;
|
|
951
|
+
};
|
|
952
|
+
type DiscoverAskResponse = DiscoverAskResponses[keyof DiscoverAskResponses];
|
|
953
|
+
|
|
954
|
+
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
|
|
955
|
+
/**
|
|
956
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
957
|
+
* individual options. This might be also useful if you want to implement a
|
|
958
|
+
* custom client.
|
|
959
|
+
*/
|
|
960
|
+
client?: Client;
|
|
961
|
+
/**
|
|
962
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
963
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
964
|
+
*/
|
|
965
|
+
meta?: Record<string, unknown>;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* Return the calling agent's identity, scopes, and org.
|
|
969
|
+
*/
|
|
970
|
+
declare const identityWhoami: <ThrowOnError extends boolean = false>(options?: Options<IdentityWhoamiData, ThrowOnError>) => RequestResult<IdentityWhoamiResponses, IdentityWhoamiErrors, ThrowOnError, "fields">;
|
|
971
|
+
/**
|
|
972
|
+
* List agents in the calling org.
|
|
973
|
+
*/
|
|
974
|
+
declare const listAgents: <ThrowOnError extends boolean = false>(options?: Options<ListAgentsData, ThrowOnError>) => RequestResult<ListAgentsResponses, unknown, ThrowOnError, "fields">;
|
|
975
|
+
/**
|
|
976
|
+
* Register a new agent under the calling user/service.
|
|
977
|
+
*/
|
|
978
|
+
declare const createAgent: <ThrowOnError extends boolean = false>(options: Options<CreateAgentData, ThrowOnError>) => RequestResult<CreateAgentResponses, unknown, ThrowOnError, "fields">;
|
|
979
|
+
/**
|
|
980
|
+
* Revoke an agent — its tokens stop working within ~60s.
|
|
981
|
+
*/
|
|
982
|
+
declare const revokeAgent: <ThrowOnError extends boolean = false>(options: Options<RevokeAgentData, ThrowOnError>) => RequestResult<RevokeAgentResponses, unknown, ThrowOnError, "fields">;
|
|
983
|
+
/**
|
|
984
|
+
* Mint a short-lived run-scoped token for a single agent run.
|
|
985
|
+
*/
|
|
986
|
+
declare const mintRunToken: <ThrowOnError extends boolean = false>(options: Options<MintRunTokenData, ThrowOnError>) => RequestResult<MintRunTokenResponses, unknown, ThrowOnError, "fields">;
|
|
987
|
+
/**
|
|
988
|
+
* Issue a service-derived agent token (no human user). Org admin only.
|
|
989
|
+
* Used for cloud agents, CI runs, and platform-managed background workers.
|
|
990
|
+
*
|
|
991
|
+
*/
|
|
992
|
+
declare const createServiceToken: <ThrowOnError extends boolean = false>(options: Options<CreateServiceTokenData, ThrowOnError>) => RequestResult<CreateServiceTokenResponses, unknown, ThrowOnError, "fields">;
|
|
993
|
+
declare const listRooms: <ThrowOnError extends boolean = false>(options?: Options<ListRoomsData, ThrowOnError>) => RequestResult<ListRoomsResponses, unknown, ThrowOnError, "fields">;
|
|
994
|
+
/**
|
|
995
|
+
* Create a manual (non-branch) room.
|
|
996
|
+
*/
|
|
997
|
+
declare const createRoom: <ThrowOnError extends boolean = false>(options: Options<CreateRoomData, ThrowOnError>) => RequestResult<CreateRoomResponses, unknown, ThrowOnError, "fields">;
|
|
998
|
+
/**
|
|
999
|
+
* Find or create the branch-scoped room for (repo, branch).
|
|
1000
|
+
*/
|
|
1001
|
+
declare const roomForBranch: <ThrowOnError extends boolean = false>(options: Options<RoomForBranchData, ThrowOnError>) => RequestResult<RoomForBranchResponses, unknown, ThrowOnError, "fields">;
|
|
1002
|
+
/**
|
|
1003
|
+
* Join a room. Returns latest summary, recent messages, and a cursor.
|
|
1004
|
+
*/
|
|
1005
|
+
declare const bootstrapRoom: <ThrowOnError extends boolean = false>(options: Options<BootstrapRoomData, ThrowOnError>) => RequestResult<BootstrapRoomResponses, unknown, ThrowOnError, "fields">;
|
|
1006
|
+
/**
|
|
1007
|
+
* Read messages strictly past `since`.
|
|
1008
|
+
*/
|
|
1009
|
+
declare const readMessages: <ThrowOnError extends boolean = false>(options: Options<ReadMessagesData, ThrowOnError>) => RequestResult<ReadMessagesResponses, unknown, ThrowOnError, "fields">;
|
|
1010
|
+
/**
|
|
1011
|
+
* Post a message to the room.
|
|
1012
|
+
*/
|
|
1013
|
+
declare const postMessage: <ThrowOnError extends boolean = false>(options: Options<PostMessageData, ThrowOnError>) => RequestResult<PostMessageResponses, unknown, ThrowOnError, "fields">;
|
|
1014
|
+
/**
|
|
1015
|
+
* Long-poll. Resolves as soon as a message lands past `since`, or after
|
|
1016
|
+
* `timeoutMs` (capped at 28s by the Worker). Cursor is the last seq
|
|
1017
|
+
* observed. Caller owns the cursor across calls.
|
|
1018
|
+
*
|
|
1019
|
+
*/
|
|
1020
|
+
declare const waitForMessages: <ThrowOnError extends boolean = false>(options: Options<WaitForMessagesData, ThrowOnError>) => RequestResult<WaitForMessagesResponses, unknown, ThrowOnError, "fields">;
|
|
1021
|
+
/**
|
|
1022
|
+
* Mark the room's task as complete with verification artifacts.
|
|
1023
|
+
*/
|
|
1024
|
+
declare const declareRoomDone: <ThrowOnError extends boolean = false>(options: Options<DeclareRoomDoneData, ThrowOnError>) => RequestResult<DeclareRoomDoneResponses, unknown, ThrowOnError, "fields">;
|
|
1025
|
+
/**
|
|
1026
|
+
* Mark the room as blocked, optionally requesting human attention.
|
|
1027
|
+
*/
|
|
1028
|
+
declare const declareRoomBlocked: <ThrowOnError extends boolean = false>(options: Options<DeclareRoomBlockedData, ThrowOnError>) => RequestResult<DeclareRoomBlockedResponses, unknown, ThrowOnError, "fields">;
|
|
1029
|
+
/**
|
|
1030
|
+
* Get the room's structured state blob (decisions, open questions, artifacts).
|
|
1031
|
+
*/
|
|
1032
|
+
declare const getRoomState: <ThrowOnError extends boolean = false>(options: Options<GetRoomStateData, ThrowOnError>) => RequestResult<GetRoomStateResponses, unknown, ThrowOnError, "fields">;
|
|
1033
|
+
/**
|
|
1034
|
+
* JSON-merge-patch the room state.
|
|
1035
|
+
*/
|
|
1036
|
+
declare const patchRoomState: <ThrowOnError extends boolean = false>(options: Options<PatchRoomStateData, ThrowOnError>) => RequestResult<PatchRoomStateResponses, unknown, ThrowOnError, "fields">;
|
|
1037
|
+
/**
|
|
1038
|
+
* Filter-then-rank search over org memory. Either `scope` (with optional
|
|
1039
|
+
* `scopeId`) or `envBucket` is required — pure vector queries are
|
|
1040
|
+
* intentionally rejected.
|
|
1041
|
+
*
|
|
1042
|
+
*/
|
|
1043
|
+
declare const searchMemory: <ThrowOnError extends boolean = false>(options: Options<SearchMemoryData, ThrowOnError>) => RequestResult<SearchMemoryResponses, unknown, ThrowOnError, "fields">;
|
|
1044
|
+
/**
|
|
1045
|
+
* Write a new memory record.
|
|
1046
|
+
*/
|
|
1047
|
+
declare const writeMemory: <ThrowOnError extends boolean = false>(options: Options<WriteMemoryData, ThrowOnError>) => RequestResult<WriteMemoryResponses, unknown, ThrowOnError, "fields">;
|
|
1048
|
+
declare const forgetMemory: <ThrowOnError extends boolean = false>(options: Options<ForgetMemoryData, ThrowOnError>) => RequestResult<ForgetMemoryResponses, unknown, ThrowOnError, "fields">;
|
|
1049
|
+
declare const createTask: <ThrowOnError extends boolean = false>(options: Options<CreateTaskData, ThrowOnError>) => RequestResult<CreateTaskResponses, unknown, ThrowOnError, "fields">;
|
|
1050
|
+
/**
|
|
1051
|
+
* Atomically claim the next task targeted at the calling agent's scopes.
|
|
1052
|
+
*/
|
|
1053
|
+
declare const nextTask: <ThrowOnError extends boolean = false>(options?: Options<NextTaskData, ThrowOnError>) => RequestResult<NextTaskResponses, unknown, ThrowOnError, "fields">;
|
|
1054
|
+
declare const completeTask: <ThrowOnError extends boolean = false>(options: Options<CompleteTaskData, ThrowOnError>) => RequestResult<CompleteTaskResponses, unknown, ThrowOnError, "fields">;
|
|
1055
|
+
/**
|
|
1056
|
+
* Pre-retrieval at session start. Filters by env_hash + file paths +
|
|
1057
|
+
* intent embedding before semantic ranking. Returns ≤3 resolutions.
|
|
1058
|
+
*
|
|
1059
|
+
*/
|
|
1060
|
+
declare const discoverAmbient: <ThrowOnError extends boolean = false>(options: Options<DiscoverAmbientData, ThrowOnError>) => RequestResult<DiscoverAmbientResponses, unknown, ThrowOnError, "fields">;
|
|
1061
|
+
/**
|
|
1062
|
+
* On-demand mid-trajectory retrieval. Filters by error_signature +
|
|
1063
|
+
* tool_call_signature first, then ranks. Returns ≤3 resolutions.
|
|
1064
|
+
*
|
|
1065
|
+
*/
|
|
1066
|
+
declare const discoverAsk: <ThrowOnError extends boolean = false>(options: Options<DiscoverAskData, ThrowOnError>) => RequestResult<DiscoverAskResponses, unknown, ThrowOnError, "fields">;
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* relay SDK client. Hand-written wrapper around the generated OpenAPI
|
|
1070
|
+
* client so we own the public surface — `./generated/` is regenerated
|
|
1071
|
+
* by `bun run codegen` against `./openapi/relay.yaml`.
|
|
1072
|
+
*
|
|
1073
|
+
* @example
|
|
1074
|
+
* import { createClient, identityWhoami } from "@codegraff/relay";
|
|
1075
|
+
*
|
|
1076
|
+
* const relay = createClient({
|
|
1077
|
+
* baseUrl: "https://relay.codegraff.com/api/v1",
|
|
1078
|
+
* token: process.env.RELAY_TOKEN,
|
|
1079
|
+
* });
|
|
1080
|
+
* const { data: me } = await identityWhoami({ client: relay });
|
|
1081
|
+
*/
|
|
1082
|
+
declare function createClient(opts: {
|
|
1083
|
+
baseUrl: string;
|
|
1084
|
+
token?: string;
|
|
1085
|
+
} & ClientOptions$1): Client;
|
|
1086
|
+
type RelayClient = ReturnType<typeof createClient>;
|
|
1087
|
+
|
|
1088
|
+
export { type Agent, type AgentCreate, type AgentKind, type AgentStatus, type AgentWithToken, type AmbientQuery, type AskQuery, type BootstrapRoomData, type BootstrapRoomResponse, type BootstrapRoomResponses, type ClientOptions, type CompleteTaskData, type CompleteTaskResponses, type CreateAgentData, type CreateAgentResponse, type CreateAgentResponses, type CreateRoomData, type CreateRoomResponse, type CreateRoomResponses, type CreateServiceTokenData, type CreateServiceTokenResponse, type CreateServiceTokenResponses, type CreateTaskData, type CreateTaskResponse, type CreateTaskResponses, type DeclareRoomBlockedData, type DeclareRoomBlockedResponses, type DeclareRoomDoneData, type DeclareRoomDoneResponses, type DiscoverAmbientData, type DiscoverAmbientResponse, type DiscoverAmbientResponses, type DiscoverAskData, type DiscoverAskResponse, type DiscoverAskResponses, type Fingerprint, type ForgetMemoryData, type ForgetMemoryResponse, type ForgetMemoryResponses, type GetRoomStateData, type GetRoomStateResponse, type GetRoomStateResponses, type Identity, type IdentityWhoamiData, type IdentityWhoamiError, type IdentityWhoamiErrors, type IdentityWhoamiResponse, type IdentityWhoamiResponses, type ListAgentsData, type ListAgentsResponse, type ListAgentsResponses, type ListRoomsData, type ListRoomsResponse, type ListRoomsResponses, type Memory, type MemoryCreate, type MemoryHit, type MemorySearch, type Message, type MessageKind, type MessagePage, type MintRunTokenData, type MintRunTokenResponse, type MintRunTokenResponses, type NextTaskData, type NextTaskResponse, type NextTaskResponses, type Options, type Outcome, type PatchRoomStateData, type PatchRoomStateResponse, type PatchRoomStateResponses, type PostMessageData, type PostMessageResponse, type PostMessageResponses, type Problem, type ReadMessagesData, type ReadMessagesResponse, type ReadMessagesResponses, type RelayClient, type Resolution, type ResolutionPage, type RevokeAgentData, type RevokeAgentResponse, type RevokeAgentResponses, type Room, type RoomBinding, type RoomBootstrap, type RoomForBranchData, type RoomForBranchResponse, type RoomForBranchResponses, type RoomStatus, type SearchMemoryData, type SearchMemoryResponse, type SearchMemoryResponses, type Task, type Token, type WaitForMessagesData, type WaitForMessagesResponse, type WaitForMessagesResponses, type WaitResult, type WriteMemoryData, type WriteMemoryResponse, type WriteMemoryResponses, bootstrapRoom, completeTask, createAgent, createClient, createRoom, createServiceToken, createTask, declareRoomBlocked, declareRoomDone, discoverAmbient, discoverAsk, forgetMemory, getRoomState, identityWhoami, listAgents, listRooms, mintRunToken, nextTask, patchRoomState, postMessage, readMessages, revokeAgent, roomForBranch, searchMemory, waitForMessages, writeMemory };
|