@collective-intelligence/external-apps-client-sdk 0.5.0 → 0.6.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 +8 -3
- package/README.md +165 -10
- package/dist/chat.d.ts +65 -3
- package/dist/chat.js +224 -20
- package/dist/{index-BwHhPzAs.d.ts → client-NsqWRz1M.d.ts} +655 -61
- package/dist/effect.d.ts +5 -7
- package/dist/effect.js +4 -4
- package/dist/index.d.ts +3 -5
- package/dist/index.js +74 -12
- package/dist/{proxy-B4MA1pat.d.ts → resources-D_PdfDpJ.d.ts} +1034 -12
- package/dist/{resources-DCOTahAB.js → resources-Vd7ESXEA.js} +2 -2
- package/dist/resources.d.ts +2 -2
- package/dist/resources.js +2 -2
- package/dist/{service-w6n_gspU.js → service-B0QOswoK.js} +59 -5
- package/dist/{service-CM4fS7mV.js → service-DCSU2Gqc.js} +125 -12
- package/docs/chat.md +18 -0
- package/docs/effect.md +4 -0
- package/docs/errors.md +5 -0
- package/docs/guide/platform/entrypoints.md +9 -6
- package/package.json +4 -4
- package/dist/client-C-o7Az4B.d.ts +0 -424
- package/dist/resources-Du03G6Wo.d.ts +0 -582
- package/dist/{errors-B4-Jo4j3.js → errors-DRzZfurr.js} +1 -1
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
import { C as OperationExecutionOptions, D as CiError, P as CiResult, S as ClientOperationOutput, V as ExternalApplicationChatOperationId, b as ClientOperationInput, i as ClientFetch, k as CiTransportError, n as ProxyTransportOptions, w as TypedOperationExecutor, x as ClientOperationMap, y as ClientOperationId } from "./proxy-B4MA1pat.js";
|
|
2
|
-
import "effect/Clock";
|
|
3
|
-
import * as Config from "effect/Config";
|
|
4
|
-
import * as Context from "effect/Context";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
|
-
import * as Layer from "effect/Layer";
|
|
7
|
-
import "effect/ManagedRuntime";
|
|
8
|
-
type DirectTransportOptions = Readonly<{
|
|
9
|
-
auth: Readonly<{
|
|
10
|
-
getAccessToken: () => Promise<string> | string;
|
|
11
|
-
}>;
|
|
12
|
-
fetch?: ClientFetch;
|
|
13
|
-
tenantUrl: string;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* The Vanilla Facade of `CiClient.layerDirect`, in a runtime of its own;
|
|
17
|
-
* `close` disposes it. A bad `tenantUrl` throws `TypeError`.
|
|
18
|
-
*/
|
|
19
|
-
declare const createDirectTransport: <Operations extends ClientOperationMap>(options: DirectTransportOptions) => TypedOperationExecutor<Operations> & Readonly<{
|
|
20
|
-
close: () => Promise<void>;
|
|
21
|
-
}>;
|
|
22
|
-
type Input<Id extends ClientOperationId> = ClientOperationMap[Id]["input"];
|
|
23
|
-
type Output<Id extends ClientOperationId> = ClientOperationMap[Id]["output"];
|
|
24
|
-
/** One CI operation as its `CiResult` envelope; only a transport failure fails. */
|
|
25
|
-
type ExecuteResult<R = never> = <Id extends ClientOperationId>(operationId: Id, input: Input<Id>, options: OperationExecutionOptions) => Effect.Effect<CiResult<Output<Id>>, CiTransportError, R>;
|
|
26
|
-
type CiClientValue = Readonly<{
|
|
27
|
-
/**
|
|
28
|
-
* The result of one operation. An Expected Error of CI fails with
|
|
29
|
-
* `CiError`; a request that does not reach CI fails with
|
|
30
|
-
* `CiTransportError`. Interruption cancels the request.
|
|
31
|
-
*/
|
|
32
|
-
execute: <Id extends ClientOperationId>(operationId: Id, input: Input<Id>, options: OperationExecutionOptions) => Effect.Effect<Output<Id>, CiError | CiTransportError>;
|
|
33
|
-
/** The same call as its envelope, which keeps the correlation id of CI. */
|
|
34
|
-
executeResult: ExecuteResult;
|
|
35
|
-
}>;
|
|
36
|
-
declare const CiClient_base: Context.ServiceClass<CiClient, "@collective-intelligence/external-apps-client-sdk/CiClient", Readonly<{
|
|
37
|
-
/**
|
|
38
|
-
* The result of one operation. An Expected Error of CI fails with
|
|
39
|
-
* `CiError`; a request that does not reach CI fails with
|
|
40
|
-
* `CiTransportError`. Interruption cancels the request.
|
|
41
|
-
*/
|
|
42
|
-
execute: <Id extends ClientOperationId>(operationId: Id, input: Input<Id>, options: OperationExecutionOptions) => Effect.Effect<Output<Id>, CiError | CiTransportError>;
|
|
43
|
-
/** The same call as its envelope, which keeps the correlation id of CI. */
|
|
44
|
-
executeResult: ExecuteResult;
|
|
45
|
-
}>>;
|
|
46
|
-
declare class CiClient extends CiClient_base {}
|
|
47
|
-
/** `CiClient` over the tenant Application HTTP API; a bad `tenantUrl` dies with `TypeError`. */
|
|
48
|
-
declare const layerDirect: (options: DirectTransportOptions) => Layer.Layer<CiClient, never, never>;
|
|
49
|
-
/** `CiClient` over the app's protocol proxy; a bad `serverUrl` or `path` dies with `TypeError`. */
|
|
50
|
-
declare const layerProxy: (options: ProxyTransportOptions) => Layer.Layer<CiClient, never, never>;
|
|
51
|
-
/** `CiClient` over a `TypedOperationExecutor`, such as the transport of `createClient`. */
|
|
52
|
-
declare const layerFromExecutor: <Operations extends ClientOperationMap>(executor: TypedOperationExecutor<Operations>) => Layer.Layer<CiClient, never, never>;
|
|
53
|
-
/** `layerDirect` with options that Effect `Config` reads. */
|
|
54
|
-
declare const layerDirectConfig: (config: Config.Wrap<DirectTransportOptions>) => Layer.Layer<CiClient, Config.ConfigError, never>;
|
|
55
|
-
/** `layerProxy` with options that Effect `Config` reads. */
|
|
56
|
-
declare const layerProxyConfig: (config: Config.Wrap<ProxyTransportOptions>) => Layer.Layer<CiClient, Config.ConfigError, never>;
|
|
57
|
-
/** The `chat_*` operation of each method of the chat domain. */
|
|
58
|
-
declare const chatOperations: {
|
|
59
|
-
readonly agentConversations: {
|
|
60
|
-
readonly cancelTurn: "chat_agent_conversations_cancel_turn";
|
|
61
|
-
readonly close: "chat_agent_conversations_close";
|
|
62
|
-
readonly submitTurn: "chat_agent_conversations_submit_turn";
|
|
63
|
-
};
|
|
64
|
-
readonly agents: {
|
|
65
|
-
readonly list: "chat_agents_list";
|
|
66
|
-
};
|
|
67
|
-
readonly approvals: {
|
|
68
|
-
readonly decide: "chat_approvals_decide";
|
|
69
|
-
readonly get: "chat_approvals_get";
|
|
70
|
-
readonly reject: "chat_approvals_reject";
|
|
71
|
-
readonly search: "chat_approvals_search";
|
|
72
|
-
readonly searchRequests: "chat_approvals_search_requests";
|
|
73
|
-
readonly withdraw: "chat_approvals_withdraw";
|
|
74
|
-
};
|
|
75
|
-
readonly artifacts: {
|
|
76
|
-
readonly progress: "chat_artifacts_progress";
|
|
77
|
-
};
|
|
78
|
-
readonly attachments: {
|
|
79
|
-
readonly capabilities: "chat_attachments_capabilities";
|
|
80
|
-
readonly downloadUrl: "chat_attachments_download_url";
|
|
81
|
-
readonly upload: "chat_attachments_upload";
|
|
82
|
-
};
|
|
83
|
-
readonly compaction: {
|
|
84
|
-
readonly compact: "chat_compaction_compact";
|
|
85
|
-
readonly get: "chat_compaction_get";
|
|
86
|
-
readonly regenerate: "chat_compaction_regenerate";
|
|
87
|
-
readonly reset: "chat_compaction_reset";
|
|
88
|
-
};
|
|
89
|
-
readonly conversations: {
|
|
90
|
-
readonly create: "chat_conversations_create";
|
|
91
|
-
readonly delete: "chat_conversations_delete";
|
|
92
|
-
readonly get: "chat_conversations_get";
|
|
93
|
-
readonly list: "chat_conversations_list";
|
|
94
|
-
readonly transcript: "chat_conversations_transcript";
|
|
95
|
-
readonly update: "chat_conversations_update";
|
|
96
|
-
};
|
|
97
|
-
readonly evidence: {
|
|
98
|
-
readonly resolve: "chat_evidence_resolve";
|
|
99
|
-
};
|
|
100
|
-
readonly feedback: {
|
|
101
|
-
readonly clear: "chat_feedback_clear";
|
|
102
|
-
readonly upsert: "chat_feedback_upsert";
|
|
103
|
-
};
|
|
104
|
-
readonly interactions: {
|
|
105
|
-
readonly respond: "chat_interactions_respond";
|
|
106
|
-
readonly stream: "chat_interactions_stream";
|
|
107
|
-
};
|
|
108
|
-
readonly permissions: {
|
|
109
|
-
readonly decideWait: "chat_permissions_decide_wait";
|
|
110
|
-
readonly list: "chat_permissions_list";
|
|
111
|
-
readonly revoke: "chat_permissions_revoke";
|
|
112
|
-
readonly update: "chat_permissions_update";
|
|
113
|
-
};
|
|
114
|
-
readonly placeContext: {
|
|
115
|
-
readonly get: "chat_place_context_get";
|
|
116
|
-
};
|
|
117
|
-
readonly presentation: {
|
|
118
|
-
readonly get: "chat_presentation_get";
|
|
119
|
-
readonly stream: "chat_presentation_stream";
|
|
120
|
-
};
|
|
121
|
-
readonly projects: {
|
|
122
|
-
readonly create: "chat_projects_create";
|
|
123
|
-
readonly delete: "chat_projects_delete";
|
|
124
|
-
readonly deleteFile: "chat_projects_delete_file";
|
|
125
|
-
readonly fileDownloadUrl: "chat_projects_file_download_url";
|
|
126
|
-
readonly list: "chat_projects_list";
|
|
127
|
-
readonly listFiles: "chat_projects_list_files";
|
|
128
|
-
readonly update: "chat_projects_update";
|
|
129
|
-
readonly uploadFile: "chat_projects_upload_file";
|
|
130
|
-
};
|
|
131
|
-
readonly queuedMessages: {
|
|
132
|
-
readonly create: "chat_queued_messages_create";
|
|
133
|
-
readonly delete: "chat_queued_messages_delete";
|
|
134
|
-
readonly list: "chat_queued_messages_list";
|
|
135
|
-
readonly update: "chat_queued_messages_update";
|
|
136
|
-
};
|
|
137
|
-
readonly skills: {
|
|
138
|
-
readonly list: "chat_skills_list";
|
|
139
|
-
};
|
|
140
|
-
readonly speech: {
|
|
141
|
-
readonly availability: "chat_speech_availability";
|
|
142
|
-
readonly createClip: "chat_speech_create_clip";
|
|
143
|
-
readonly readAloudPart: "chat_speech_read_aloud_part";
|
|
144
|
-
readonly transcribe: "chat_speech_transcribe";
|
|
145
|
-
};
|
|
146
|
-
readonly steeringMessages: {
|
|
147
|
-
readonly send: "chat_steering_messages_send";
|
|
148
|
-
};
|
|
149
|
-
readonly tools: {
|
|
150
|
-
readonly list: "chat_tools_list";
|
|
151
|
-
};
|
|
152
|
-
readonly turns: {
|
|
153
|
-
readonly cancel: "chat_turns_cancel";
|
|
154
|
-
readonly stream: "chat_turns_stream";
|
|
155
|
-
readonly submit: "chat_turns_submit";
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
type ChatOperations = typeof chatOperations;
|
|
159
|
-
/** The `chat_*` operation id of one method of the chat domain. */
|
|
160
|
-
type ChatOperationOf<Group extends keyof ChatOperations, Method extends keyof ChatOperations[Group]> = Extract<ChatOperations[Group][Method], ExternalApplicationChatOperationId>;
|
|
161
|
-
type ChatEffect<Id extends ExternalApplicationChatOperationId> = (input: ClientOperationMap[Id]["input"], options: OperationExecutionOptions) => Effect.Effect<ClientOperationMap[Id]["output"], CiError | CiTransportError>;
|
|
162
|
-
type ChatValue = Readonly<{ [Group in keyof ChatOperations]: Readonly<{ [Method in keyof ChatOperations[Group]]: ChatEffect<ChatOperationOf<Group, Method>>; }>; }>;
|
|
163
|
-
declare const Chat_base: Context.ServiceClass<Chat, "@collective-intelligence/external-apps-client-sdk/Chat", Readonly<{
|
|
164
|
-
readonly agentConversations: Readonly<{
|
|
165
|
-
readonly cancelTurn: ChatEffect<"chat_agent_conversations_cancel_turn">;
|
|
166
|
-
readonly close: ChatEffect<"chat_agent_conversations_close">;
|
|
167
|
-
readonly submitTurn: ChatEffect<"chat_agent_conversations_submit_turn">;
|
|
168
|
-
}>;
|
|
169
|
-
readonly agents: Readonly<{
|
|
170
|
-
readonly list: ChatEffect<"chat_agents_list">;
|
|
171
|
-
}>;
|
|
172
|
-
readonly approvals: Readonly<{
|
|
173
|
-
readonly decide: ChatEffect<"chat_approvals_decide">;
|
|
174
|
-
readonly get: ChatEffect<"chat_approvals_get">;
|
|
175
|
-
readonly reject: ChatEffect<"chat_approvals_reject">;
|
|
176
|
-
readonly search: ChatEffect<"chat_approvals_search">;
|
|
177
|
-
readonly searchRequests: ChatEffect<"chat_approvals_search_requests">;
|
|
178
|
-
readonly withdraw: ChatEffect<"chat_approvals_withdraw">;
|
|
179
|
-
}>;
|
|
180
|
-
readonly artifacts: Readonly<{
|
|
181
|
-
readonly progress: ChatEffect<"chat_artifacts_progress">;
|
|
182
|
-
}>;
|
|
183
|
-
readonly attachments: Readonly<{
|
|
184
|
-
readonly capabilities: ChatEffect<"chat_attachments_capabilities">;
|
|
185
|
-
readonly downloadUrl: ChatEffect<"chat_attachments_download_url">;
|
|
186
|
-
readonly upload: ChatEffect<"chat_attachments_upload">;
|
|
187
|
-
}>;
|
|
188
|
-
readonly compaction: Readonly<{
|
|
189
|
-
readonly compact: ChatEffect<"chat_compaction_compact">;
|
|
190
|
-
readonly get: ChatEffect<"chat_compaction_get">;
|
|
191
|
-
readonly regenerate: ChatEffect<"chat_compaction_regenerate">;
|
|
192
|
-
readonly reset: ChatEffect<"chat_compaction_reset">;
|
|
193
|
-
}>;
|
|
194
|
-
readonly conversations: Readonly<{
|
|
195
|
-
readonly create: ChatEffect<"chat_conversations_create">;
|
|
196
|
-
readonly delete: ChatEffect<"chat_conversations_delete">;
|
|
197
|
-
readonly get: ChatEffect<"chat_conversations_get">;
|
|
198
|
-
readonly list: ChatEffect<"chat_conversations_list">;
|
|
199
|
-
readonly transcript: ChatEffect<"chat_conversations_transcript">;
|
|
200
|
-
readonly update: ChatEffect<"chat_conversations_update">;
|
|
201
|
-
}>;
|
|
202
|
-
readonly evidence: Readonly<{
|
|
203
|
-
readonly resolve: ChatEffect<"chat_evidence_resolve">;
|
|
204
|
-
}>;
|
|
205
|
-
readonly feedback: Readonly<{
|
|
206
|
-
readonly clear: ChatEffect<"chat_feedback_clear">;
|
|
207
|
-
readonly upsert: ChatEffect<"chat_feedback_upsert">;
|
|
208
|
-
}>;
|
|
209
|
-
readonly interactions: Readonly<{
|
|
210
|
-
readonly respond: ChatEffect<"chat_interactions_respond">;
|
|
211
|
-
readonly stream: ChatEffect<"chat_interactions_stream">;
|
|
212
|
-
}>;
|
|
213
|
-
readonly permissions: Readonly<{
|
|
214
|
-
readonly decideWait: ChatEffect<"chat_permissions_decide_wait">;
|
|
215
|
-
readonly list: ChatEffect<"chat_permissions_list">;
|
|
216
|
-
readonly revoke: ChatEffect<"chat_permissions_revoke">;
|
|
217
|
-
readonly update: ChatEffect<"chat_permissions_update">;
|
|
218
|
-
}>;
|
|
219
|
-
readonly placeContext: Readonly<{
|
|
220
|
-
readonly get: ChatEffect<"chat_place_context_get">;
|
|
221
|
-
}>;
|
|
222
|
-
readonly presentation: Readonly<{
|
|
223
|
-
readonly get: ChatEffect<"chat_presentation_get">;
|
|
224
|
-
readonly stream: ChatEffect<"chat_presentation_stream">;
|
|
225
|
-
}>;
|
|
226
|
-
readonly projects: Readonly<{
|
|
227
|
-
readonly create: ChatEffect<"chat_projects_create">;
|
|
228
|
-
readonly delete: ChatEffect<"chat_projects_delete">;
|
|
229
|
-
readonly deleteFile: ChatEffect<"chat_projects_delete_file">;
|
|
230
|
-
readonly fileDownloadUrl: ChatEffect<"chat_projects_file_download_url">;
|
|
231
|
-
readonly list: ChatEffect<"chat_projects_list">;
|
|
232
|
-
readonly listFiles: ChatEffect<"chat_projects_list_files">;
|
|
233
|
-
readonly update: ChatEffect<"chat_projects_update">;
|
|
234
|
-
readonly uploadFile: ChatEffect<"chat_projects_upload_file">;
|
|
235
|
-
}>;
|
|
236
|
-
readonly queuedMessages: Readonly<{
|
|
237
|
-
readonly create: ChatEffect<"chat_queued_messages_create">;
|
|
238
|
-
readonly delete: ChatEffect<"chat_queued_messages_delete">;
|
|
239
|
-
readonly list: ChatEffect<"chat_queued_messages_list">;
|
|
240
|
-
readonly update: ChatEffect<"chat_queued_messages_update">;
|
|
241
|
-
}>;
|
|
242
|
-
readonly skills: Readonly<{
|
|
243
|
-
readonly list: ChatEffect<"chat_skills_list">;
|
|
244
|
-
}>;
|
|
245
|
-
readonly speech: Readonly<{
|
|
246
|
-
readonly availability: ChatEffect<"chat_speech_availability">;
|
|
247
|
-
readonly createClip: ChatEffect<"chat_speech_create_clip">;
|
|
248
|
-
readonly readAloudPart: ChatEffect<"chat_speech_read_aloud_part">;
|
|
249
|
-
readonly transcribe: ChatEffect<"chat_speech_transcribe">;
|
|
250
|
-
}>;
|
|
251
|
-
readonly steeringMessages: Readonly<{
|
|
252
|
-
readonly send: ChatEffect<"chat_steering_messages_send">;
|
|
253
|
-
}>;
|
|
254
|
-
readonly tools: Readonly<{
|
|
255
|
-
readonly list: ChatEffect<"chat_tools_list">;
|
|
256
|
-
}>;
|
|
257
|
-
readonly turns: Readonly<{
|
|
258
|
-
readonly cancel: ChatEffect<"chat_turns_cancel">;
|
|
259
|
-
readonly stream: ChatEffect<"chat_turns_stream">;
|
|
260
|
-
readonly submit: ChatEffect<"chat_turns_submit">;
|
|
261
|
-
}>;
|
|
262
|
-
}>>;
|
|
263
|
-
declare class Chat extends Chat_base {}
|
|
264
|
-
/** `Chat` over the `CiClient` of the context. */
|
|
265
|
-
declare const layer$1: Layer.Layer<Chat, never, CiClient>;
|
|
266
|
-
type ChatClient<Operations extends ClientOperationMap, Scoped extends boolean> = Readonly<{ [Group in keyof ChatOperations]: Readonly<{ [Method in keyof ChatOperations[Group]]: DomainOperation<Operations, ChatOperationOf<Group, Method>, Scoped>; }>; }>;
|
|
267
|
-
type CiStreamPage = ClientOperationOutput<ClientOperationMap, "runs_stream">;
|
|
268
|
-
type CiStreamEvent = CiStreamPage["events"][number];
|
|
269
|
-
type CiRunCancellation = ClientOperationOutput<ClientOperationMap, "runs_cancel">;
|
|
270
|
-
declare const nextStreamCursor: (page: CiStreamPage) => string | null;
|
|
271
|
-
type RunFollowOptions = Readonly<{
|
|
272
|
-
/** Total wait before the follow fails with `CiError` `unavailable`. */
|
|
273
|
-
deadlineMs?: number;
|
|
274
|
-
/**
|
|
275
|
-
* First wait between polls in milliseconds (default 50). It doubles while
|
|
276
|
-
* no new event arrives, up to one second or `idleMs` if larger.
|
|
277
|
-
*/
|
|
278
|
-
idleMs?: number;
|
|
279
|
-
runId: string;
|
|
280
|
-
}>;
|
|
281
|
-
/**
|
|
282
|
-
* Ten minutes: a skill run's five-minute AI deadline plus queueing and
|
|
283
|
-
* delivery slack. Long runs return a `runId` immediately; follow is how
|
|
284
|
-
* callers wait for their outcome.
|
|
285
|
-
*/
|
|
286
|
-
declare const DEFAULT_FOLLOW_RUN_DEADLINE_MS = 600000;
|
|
287
|
-
type RunsValue = Readonly<{
|
|
288
|
-
/**
|
|
289
|
-
* Follows a run of `organizationId` until it finishes, and succeeds with
|
|
290
|
-
* its last event page. A failed read fails with its `CiError`; a run that
|
|
291
|
-
* does not finish before the deadline fails with `CiError` `unavailable`.
|
|
292
|
-
*/
|
|
293
|
-
follow: (options: RunFollowOptions & Readonly<{
|
|
294
|
-
organizationId: string;
|
|
295
|
-
}>) => Effect.Effect<CiStreamPage, CiError | CiTransportError>;
|
|
296
|
-
}>;
|
|
297
|
-
declare const Runs_base: Context.ServiceClass<Runs, "@collective-intelligence/external-apps-client-sdk/Runs", Readonly<{
|
|
298
|
-
/**
|
|
299
|
-
* Follows a run of `organizationId` until it finishes, and succeeds with
|
|
300
|
-
* its last event page. A failed read fails with its `CiError`; a run that
|
|
301
|
-
* does not finish before the deadline fails with `CiError` `unavailable`.
|
|
302
|
-
*/
|
|
303
|
-
follow: (options: RunFollowOptions & Readonly<{
|
|
304
|
-
organizationId: string;
|
|
305
|
-
}>) => Effect.Effect<CiStreamPage, CiError | CiTransportError>;
|
|
306
|
-
}>>;
|
|
307
|
-
declare class Runs extends Runs_base {}
|
|
308
|
-
/** `Runs` over the `CiClient` of the context. */
|
|
309
|
-
declare const layer: Layer.Layer<Runs, never, CiClient>;
|
|
310
|
-
type FollowRunSource = Readonly<{
|
|
311
|
-
get: (input: Readonly<{
|
|
312
|
-
runId: string;
|
|
313
|
-
}>) => Promise<CiResult<unknown>>;
|
|
314
|
-
stream: (input: Readonly<{
|
|
315
|
-
afterCursor?: string;
|
|
316
|
-
runId: string;
|
|
317
|
-
}>) => Promise<CiResult<CiStreamPage>>;
|
|
318
|
-
}>;
|
|
319
|
-
type FollowRunOptions = Readonly<{
|
|
320
|
-
/**
|
|
321
|
-
* Total wait before `followRun` rejects with `CiError` `unavailable`
|
|
322
|
-
* ("Run did not finish"). Defaults to
|
|
323
|
-
* {@link DEFAULT_FOLLOW_RUN_DEADLINE_MS}.
|
|
324
|
-
*/
|
|
325
|
-
deadlineMs?: number;
|
|
326
|
-
/**
|
|
327
|
-
* First wait between polls in milliseconds (default 50). It doubles while
|
|
328
|
-
* no new event arrives, up to one second or `idleMs` if larger.
|
|
329
|
-
*/
|
|
330
|
-
idleMs?: number;
|
|
331
|
-
now?: () => number;
|
|
332
|
-
runId: string;
|
|
333
|
-
/** Stops following and cancels in-flight requests made by `runs.follow`. */
|
|
334
|
-
signal?: AbortSignal;
|
|
335
|
-
sleep?: (ms: number) => Promise<void>;
|
|
336
|
-
}>;
|
|
337
|
-
/**
|
|
338
|
-
* Follows dedicated run events until a terminal event or snapshot status.
|
|
339
|
-
* Resolves with the last event page read. A failed read rejects with its
|
|
340
|
-
* `CiError`; a source that rejects gives `CiTransportError`; an abort
|
|
341
|
-
* rejects with `signal.reason`.
|
|
342
|
-
*/
|
|
343
|
-
declare const followRun: (runs: FollowRunSource, options: FollowRunOptions) => Promise<CiStreamPage>;
|
|
344
|
-
declare const clientSdkProtocolVersion: "v1";
|
|
345
|
-
type SignalOptions = Readonly<{
|
|
346
|
-
signal?: AbortSignal;
|
|
347
|
-
}>;
|
|
348
|
-
type FollowRunCall<Scoped extends boolean> = Scoped extends true ? (options: FollowRunOptions) => Promise<CiStreamPage> : (options: FollowRunOptions & Readonly<{
|
|
349
|
-
organizationId: string;
|
|
350
|
-
}>) => Promise<CiStreamPage>;
|
|
351
|
-
type ScopedOperation<Operations extends ClientOperationMap, Id extends ClientOperationId> = (input: ClientOperationInput<Operations, Id>, options?: SignalOptions) => Promise<CiResult<ClientOperationOutput<Operations, Id>>>;
|
|
352
|
-
type RootOperation<Operations extends ClientOperationMap, Id extends ClientOperationId> = (input: ClientOperationInput<Operations, Id> & Readonly<{
|
|
353
|
-
organizationId: string;
|
|
354
|
-
}>, options?: SignalOptions) => Promise<CiResult<ClientOperationOutput<Operations, Id>>>;
|
|
355
|
-
/** Internal. One domain method: organization-bound when `Scoped`. */
|
|
356
|
-
type DomainOperation<Operations extends ClientOperationMap, Id extends ClientOperationId, Scoped extends boolean> = Scoped extends true ? ScopedOperation<Operations, Id> : RootOperation<Operations, Id>;
|
|
357
|
-
type ClientDomains<Operations extends ClientOperationMap, Scoped extends boolean> = Readonly<{
|
|
358
|
-
agents: Readonly<{
|
|
359
|
-
invoke: DomainOperation<Operations, "agents_invoke", Scoped>;
|
|
360
|
-
list: DomainOperation<Operations, "agents_list", Scoped>;
|
|
361
|
-
}>;
|
|
362
|
-
attachments: Readonly<{
|
|
363
|
-
downloadUrl: DomainOperation<Operations, "attachments_download_url", Scoped>;
|
|
364
|
-
upload: DomainOperation<Operations, "attachments_upload", Scoped>;
|
|
365
|
-
}>;
|
|
366
|
-
/** The External App chat (`/chat/...`), for a signed-in app user. */
|
|
367
|
-
chat: ChatClient<Operations, Scoped>;
|
|
368
|
-
context: Readonly<{
|
|
369
|
-
get: DomainOperation<Operations, "context_get", Scoped>;
|
|
370
|
-
}>;
|
|
371
|
-
knowledge: Readonly<{
|
|
372
|
-
autocomplete: DomainOperation<Operations, "knowledge_autocomplete", Scoped>;
|
|
373
|
-
createEntity: DomainOperation<Operations, "knowledge_create_entity", Scoped>;
|
|
374
|
-
deleteEntity: DomainOperation<Operations, "knowledge_delete_entity", Scoped>;
|
|
375
|
-
facets: DomainOperation<Operations, "knowledge_facets", Scoped>;
|
|
376
|
-
getEntity: DomainOperation<Operations, "knowledge_get_entity", Scoped>;
|
|
377
|
-
getEntitySchemaSnapshot: DomainOperation<Operations, "knowledge_get_entity_schema_snapshot", Scoped>;
|
|
378
|
-
getSchemaQueryContext: DomainOperation<Operations, "knowledge_get_schema_query_context", Scoped>;
|
|
379
|
-
query: DomainOperation<Operations, "knowledge_query", Scoped>;
|
|
380
|
-
searchEntities: DomainOperation<Operations, "knowledge_search_entities", Scoped>;
|
|
381
|
-
updateEntity: DomainOperation<Operations, "knowledge_update_entity", Scoped>;
|
|
382
|
-
upsertEntity: DomainOperation<Operations, "knowledge_upsert_entity", Scoped>;
|
|
383
|
-
}>;
|
|
384
|
-
runs: Readonly<{
|
|
385
|
-
cancel: DomainOperation<Operations, "runs_cancel", Scoped>;
|
|
386
|
-
follow: FollowRunCall<Scoped>;
|
|
387
|
-
get: DomainOperation<Operations, "runs_get", Scoped>;
|
|
388
|
-
stream: DomainOperation<Operations, "runs_stream", Scoped>;
|
|
389
|
-
}>;
|
|
390
|
-
skills: Readonly<{
|
|
391
|
-
invoke: DomainOperation<Operations, "skills_invoke", Scoped>;
|
|
392
|
-
list: DomainOperation<Operations, "skills_list", Scoped>;
|
|
393
|
-
}>;
|
|
394
|
-
workflows: Readonly<{
|
|
395
|
-
invoke: DomainOperation<Operations, "workflows_invoke", Scoped>;
|
|
396
|
-
list: DomainOperation<Operations, "workflows_list", Scoped>;
|
|
397
|
-
}>;
|
|
398
|
-
}>;
|
|
399
|
-
type OrganizationClient<Operations extends ClientOperationMap> = ClientDomains<Operations, true> & Readonly<{
|
|
400
|
-
organizationId: string;
|
|
401
|
-
}>;
|
|
402
|
-
type ClientSdkClient<Operations extends ClientOperationMap> = Omit<ClientDomains<Operations, false>, "context"> & TypedOperationExecutor<Operations> & Readonly<{
|
|
403
|
-
context: ClientDomains<Operations, false>["context"] & Readonly<{
|
|
404
|
-
forOrganization: (organizationId: string) => OrganizationClient<Operations>;
|
|
405
|
-
}>;
|
|
406
|
-
forOrganization: (organizationId: string) => OrganizationClient<Operations>;
|
|
407
|
-
protocolVersion: typeof clientSdkProtocolVersion;
|
|
408
|
-
}>;
|
|
409
|
-
type ClientSdkEntrypoint = Readonly<{
|
|
410
|
-
protocolVersion: typeof clientSdkProtocolVersion;
|
|
411
|
-
}>;
|
|
412
|
-
/**
|
|
413
|
-
* The Vanilla Facade of `CiClient` and `Runs` over `transport`, in one
|
|
414
|
-
* runtime; `close` disposes it. A CI error answer resolves
|
|
415
|
-
* `{ ok: false, error }` with a `CiError`; `runs.follow` rejects with it. A
|
|
416
|
-
* transport failure rejects with `CiTransportError`, an abort with
|
|
417
|
-
* `signal.reason`.
|
|
418
|
-
*/
|
|
419
|
-
declare const createClient: <Operations extends ClientOperationMap>(options: {
|
|
420
|
-
readonly transport: TypedOperationExecutor<Operations>;
|
|
421
|
-
}) => ClientSdkClient<Operations> & Readonly<{
|
|
422
|
-
close: () => Promise<void>;
|
|
423
|
-
}>;
|
|
424
|
-
export { layerProxyConfig as A, CiClient as C, layerDirectConfig as D, layerDirect as E, createDirectTransport as M, layerFromExecutor as O, layer$1 as S, ExecuteResult as T, CiStreamPage as _, clientSdkProtocolVersion as a, Chat as b, FollowRunSource as c, RunFollowOptions as d, Runs as f, CiStreamEvent as g, CiRunCancellation as h, OrganizationClient as i, DirectTransportOptions as j, layerProxy as k, followRun as l, layer as m, ClientSdkClient as n, createClient as o, RunsValue as p, ClientSdkEntrypoint as r, FollowRunOptions as s, ClientDomains as t, DEFAULT_FOLLOW_RUN_DEADLINE_MS as u, nextStreamCursor as v, CiClientValue as w, ChatValue as x, ChatClient as y };
|