@copilotkitnext/runtime 1.54.0 → 1.54.1-next.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/dist/endpoints/express-single.cjs.map +1 -1
- package/dist/endpoints/express-single.d.cts +2 -2
- package/dist/endpoints/express-single.d.cts.map +1 -1
- package/dist/endpoints/express-single.d.mts +2 -2
- package/dist/endpoints/express-single.d.mts.map +1 -1
- package/dist/endpoints/express-single.mjs.map +1 -1
- package/dist/endpoints/express.cjs +38 -0
- package/dist/endpoints/express.cjs.map +1 -1
- package/dist/endpoints/express.d.cts +2 -2
- package/dist/endpoints/express.d.cts.map +1 -1
- package/dist/endpoints/express.d.mts +2 -2
- package/dist/endpoints/express.d.mts.map +1 -1
- package/dist/endpoints/express.mjs +38 -0
- package/dist/endpoints/express.mjs.map +1 -1
- package/dist/endpoints/hono-single.cjs.map +1 -1
- package/dist/endpoints/hono-single.d.cts +2 -2
- package/dist/endpoints/hono-single.d.cts.map +1 -1
- package/dist/endpoints/hono-single.d.mts +2 -2
- package/dist/endpoints/hono-single.d.mts.map +1 -1
- package/dist/endpoints/hono-single.mjs.map +1 -1
- package/dist/endpoints/hono.cjs +83 -0
- package/dist/endpoints/hono.cjs.map +1 -1
- package/dist/endpoints/hono.d.cts +3 -3
- package/dist/endpoints/hono.d.cts.map +1 -1
- package/dist/endpoints/hono.d.mts +3 -3
- package/dist/endpoints/hono.d.mts.map +1 -1
- package/dist/endpoints/hono.mjs +83 -0
- package/dist/endpoints/hono.mjs.map +1 -1
- package/dist/handlers/get-runtime-info.cjs +2 -0
- package/dist/handlers/get-runtime-info.cjs.map +1 -1
- package/dist/handlers/get-runtime-info.mjs +3 -1
- package/dist/handlers/get-runtime-info.mjs.map +1 -1
- package/dist/handlers/handle-connect.cjs +18 -80
- package/dist/handlers/handle-connect.cjs.map +1 -1
- package/dist/handlers/handle-connect.mjs +18 -79
- package/dist/handlers/handle-connect.mjs.map +1 -1
- package/dist/handlers/handle-run.cjs +26 -98
- package/dist/handlers/handle-run.cjs.map +1 -1
- package/dist/handlers/handle-run.mjs +26 -97
- package/dist/handlers/handle-run.mjs.map +1 -1
- package/dist/handlers/handle-stop.cjs.map +1 -1
- package/dist/handlers/handle-stop.mjs.map +1 -1
- package/dist/handlers/handle-threads.cjs +1 -0
- package/dist/handlers/handle-threads.mjs +3 -0
- package/dist/handlers/handle-transcribe.cjs.map +1 -1
- package/dist/handlers/handle-transcribe.mjs.map +1 -1
- package/dist/handlers/intelligence/connect.cjs +28 -0
- package/dist/handlers/intelligence/connect.cjs.map +1 -0
- package/dist/handlers/intelligence/connect.mjs +28 -0
- package/dist/handlers/intelligence/connect.mjs.map +1 -0
- package/dist/handlers/intelligence/run.cjs +77 -0
- package/dist/handlers/intelligence/run.cjs.map +1 -0
- package/dist/handlers/intelligence/run.mjs +76 -0
- package/dist/handlers/intelligence/run.mjs.map +1 -0
- package/dist/handlers/intelligence/thread-names.cjs +144 -0
- package/dist/handlers/intelligence/thread-names.cjs.map +1 -0
- package/dist/handlers/intelligence/thread-names.mjs +143 -0
- package/dist/handlers/intelligence/thread-names.mjs.map +1 -0
- package/dist/handlers/intelligence/threads.cjs +133 -0
- package/dist/handlers/intelligence/threads.cjs.map +1 -0
- package/dist/handlers/intelligence/threads.mjs +128 -0
- package/dist/handlers/intelligence/threads.mjs.map +1 -0
- package/dist/handlers/shared/agent-utils.cjs +73 -0
- package/dist/handlers/shared/agent-utils.cjs.map +1 -0
- package/dist/handlers/shared/agent-utils.mjs +69 -0
- package/dist/handlers/shared/agent-utils.mjs.map +1 -0
- package/dist/handlers/shared/intelligence-utils.cjs +20 -0
- package/dist/handlers/shared/intelligence-utils.cjs.map +1 -0
- package/dist/handlers/shared/intelligence-utils.mjs +19 -0
- package/dist/handlers/shared/intelligence-utils.mjs.map +1 -0
- package/dist/handlers/shared/json-response.cjs +7 -0
- package/dist/handlers/shared/json-response.cjs.map +1 -0
- package/dist/handlers/shared/json-response.mjs +6 -0
- package/dist/handlers/shared/json-response.mjs.map +1 -0
- package/dist/handlers/shared/sse-response.cjs +63 -0
- package/dist/handlers/shared/sse-response.cjs.map +1 -0
- package/dist/handlers/shared/sse-response.mjs +62 -0
- package/dist/handlers/shared/sse-response.mjs.map +1 -0
- package/dist/handlers/sse/connect.cjs +17 -0
- package/dist/handlers/sse/connect.cjs.map +1 -0
- package/dist/handlers/sse/connect.mjs +17 -0
- package/dist/handlers/sse/connect.mjs.map +1 -0
- package/dist/handlers/sse/run.cjs +17 -0
- package/dist/handlers/sse/run.cjs.map +1 -0
- package/dist/handlers/sse/run.mjs +17 -0
- package/dist/handlers/sse/run.mjs.map +1 -0
- package/dist/index.cjs +8 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +4 -2
- package/dist/index.mjs +5 -3
- package/dist/intelligence-platform/client.cjs +318 -0
- package/dist/intelligence-platform/client.cjs.map +1 -0
- package/dist/intelligence-platform/client.d.cts +327 -0
- package/dist/intelligence-platform/client.d.cts.map +1 -0
- package/dist/intelligence-platform/client.d.mts +327 -0
- package/dist/intelligence-platform/client.d.mts.map +1 -0
- package/dist/intelligence-platform/client.mjs +316 -0
- package/dist/intelligence-platform/client.mjs.map +1 -0
- package/dist/intelligence-platform/index.cjs +1 -0
- package/dist/intelligence-platform/index.d.mts +1 -0
- package/dist/intelligence-platform/index.mjs +3 -0
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.cts +3 -3
- package/dist/middleware.d.cts.map +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.mts.map +1 -1
- package/dist/middleware.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/runner/agent-runner.cjs.map +1 -1
- package/dist/runner/agent-runner.d.cts +4 -1
- package/dist/runner/agent-runner.d.cts.map +1 -1
- package/dist/runner/agent-runner.d.mts +4 -1
- package/dist/runner/agent-runner.d.mts.map +1 -1
- package/dist/runner/agent-runner.mjs.map +1 -1
- package/dist/runner/in-memory.cjs +1 -1
- package/dist/runner/in-memory.mjs +1 -1
- package/dist/runner/intelligence.cjs +87 -24
- package/dist/runner/intelligence.cjs.map +1 -1
- package/dist/runner/intelligence.d.cts +8 -3
- package/dist/runner/intelligence.d.cts.map +1 -1
- package/dist/runner/intelligence.d.mts +8 -3
- package/dist/runner/intelligence.d.mts.map +1 -1
- package/dist/runner/intelligence.mjs +87 -24
- package/dist/runner/intelligence.mjs.map +1 -1
- package/dist/runtime.cjs +76 -6
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +71 -21
- package/dist/runtime.d.cts.map +1 -1
- package/dist/runtime.d.mts +72 -21
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +73 -7
- package/dist/runtime.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { BaseEvent } from "@ag-ui/client";
|
|
2
|
+
|
|
3
|
+
//#region src/intelligence-platform/client.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Client for the CopilotKit Intelligence Platform REST API.
|
|
6
|
+
*
|
|
7
|
+
* Construct the client once and pass it to any consumers that need it
|
|
8
|
+
* (e.g. `CopilotRuntime`, `IntelligenceAgentRunner`):
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { CopilotKitIntelligence, CopilotRuntime } from "@copilotkitnext/runtime";
|
|
12
|
+
*
|
|
13
|
+
* const intelligence = new CopilotKitIntelligence({
|
|
14
|
+
* apiUrl: "https://api.copilotkit.ai",
|
|
15
|
+
* wsUrl: "wss://api.copilotkit.ai",
|
|
16
|
+
* apiKey: process.env.COPILOTKIT_API_KEY!,
|
|
17
|
+
* tenantId: process.env.COPILOTKIT_TENANT_ID!,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const runtime = new CopilotRuntime({
|
|
21
|
+
* agents,
|
|
22
|
+
* intelligence,
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
/** Payload passed to `onThreadDeleted` listeners. */
|
|
27
|
+
interface ThreadDeletedPayload {
|
|
28
|
+
threadId: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
agentId: string;
|
|
31
|
+
}
|
|
32
|
+
interface CopilotKitIntelligenceConfig {
|
|
33
|
+
/** Base URL of the intelligence platform API, e.g. "https://api.copilotkit.ai" */
|
|
34
|
+
apiUrl: string;
|
|
35
|
+
/** Intelligence websocket base URL. Runner and client socket URLs are derived from this. */
|
|
36
|
+
wsUrl: string;
|
|
37
|
+
/** API key for authenticating with the intelligence platform */
|
|
38
|
+
apiKey: string;
|
|
39
|
+
/** Tenant identifier used for self-hosted Intelligence instances */
|
|
40
|
+
tenantId: string;
|
|
41
|
+
/**
|
|
42
|
+
* Initial listener invoked after a thread is created.
|
|
43
|
+
* Prefer {@link CopilotKitIntelligence.onThreadCreated} for multiple listeners.
|
|
44
|
+
*/
|
|
45
|
+
onThreadCreated?: (thread: ThreadSummary) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Initial listener invoked after a thread is updated.
|
|
48
|
+
* Prefer {@link CopilotKitIntelligence.onThreadUpdated} for multiple listeners.
|
|
49
|
+
*/
|
|
50
|
+
onThreadUpdated?: (thread: ThreadSummary) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Initial listener invoked after a thread is deleted.
|
|
53
|
+
* Prefer {@link CopilotKitIntelligence.onThreadDeleted} for multiple listeners.
|
|
54
|
+
*/
|
|
55
|
+
onThreadDeleted?: (params: ThreadDeletedPayload) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Summary metadata for a single thread returned by the platform.
|
|
59
|
+
*
|
|
60
|
+
* This is the shape returned by list, get, create, and update operations.
|
|
61
|
+
* It does not include the thread's message history — use
|
|
62
|
+
* {@link CopilotKitIntelligence.getThreadMessages} for that.
|
|
63
|
+
*/
|
|
64
|
+
interface ThreadSummary {
|
|
65
|
+
/** Platform-assigned unique identifier. */
|
|
66
|
+
id: string;
|
|
67
|
+
/** Human-readable display name, or `null` if the thread has not been named. */
|
|
68
|
+
name: string | null;
|
|
69
|
+
/** ISO-8601 timestamp of the most recent agent run on this thread. */
|
|
70
|
+
lastRunAt?: string;
|
|
71
|
+
/** ISO-8601 timestamp of the most recent metadata update. */
|
|
72
|
+
lastUpdatedAt?: string;
|
|
73
|
+
/** ISO-8601 timestamp when the thread was created. */
|
|
74
|
+
createdAt?: string;
|
|
75
|
+
/** ISO-8601 timestamp when the thread was last updated. */
|
|
76
|
+
updatedAt?: string;
|
|
77
|
+
/** Whether the thread has been archived. Archived threads are excluded from default list results. */
|
|
78
|
+
archived?: boolean;
|
|
79
|
+
/** The agent that owns this thread. */
|
|
80
|
+
agentId?: string;
|
|
81
|
+
/** The user who created this thread. */
|
|
82
|
+
createdById?: string;
|
|
83
|
+
/** The tenant this thread belongs to. */
|
|
84
|
+
tenantId?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Response from listing threads for a user/agent pair. */
|
|
87
|
+
interface ListThreadsResponse {
|
|
88
|
+
/** The matching threads, sorted by the platform's default ordering. */
|
|
89
|
+
threads: ThreadSummary[];
|
|
90
|
+
/** Join code for subscribing to realtime metadata updates for these threads. */
|
|
91
|
+
joinCode: string;
|
|
92
|
+
/** Short-lived token for authenticating the realtime subscription. */
|
|
93
|
+
joinToken?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Fields that can be updated on a thread via {@link CopilotKitIntelligence.updateThread}.
|
|
97
|
+
*
|
|
98
|
+
* Additional platform-specific fields can be passed as extra keys and will be
|
|
99
|
+
* forwarded to the PATCH request body.
|
|
100
|
+
*/
|
|
101
|
+
interface UpdateThreadRequest {
|
|
102
|
+
/** New human-readable display name for the thread. */
|
|
103
|
+
name?: string;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
106
|
+
/** Parameters for creating a new thread via {@link CopilotKitIntelligence.createThread}. */
|
|
107
|
+
interface CreateThreadRequest {
|
|
108
|
+
/** Client-generated unique identifier for the new thread. */
|
|
109
|
+
threadId: string;
|
|
110
|
+
/** The user creating the thread. Used for authorization and scoping. */
|
|
111
|
+
userId: string;
|
|
112
|
+
/** The agent this thread belongs to. */
|
|
113
|
+
agentId: string;
|
|
114
|
+
/** Optional initial display name. If omitted, the thread is unnamed until explicitly renamed. */
|
|
115
|
+
name?: string;
|
|
116
|
+
}
|
|
117
|
+
/** Credentials returned when locking or joining a thread's realtime channel. */
|
|
118
|
+
interface ThreadConnectionResponse {
|
|
119
|
+
/** Short-lived token for authenticating the Phoenix channel join. */
|
|
120
|
+
joinToken: string;
|
|
121
|
+
/** Optional join code that can be shared with other clients to join the same channel. */
|
|
122
|
+
joinCode?: string;
|
|
123
|
+
}
|
|
124
|
+
interface SubscribeToThreadsRequest {
|
|
125
|
+
userId: string;
|
|
126
|
+
}
|
|
127
|
+
interface SubscribeToThreadsResponse {
|
|
128
|
+
joinToken: string;
|
|
129
|
+
}
|
|
130
|
+
interface ConnectThreadBootstrapResponse {
|
|
131
|
+
mode: "bootstrap";
|
|
132
|
+
latestEventId: string | null;
|
|
133
|
+
events: BaseEvent[];
|
|
134
|
+
}
|
|
135
|
+
interface ConnectThreadLiveResponse {
|
|
136
|
+
mode: "live";
|
|
137
|
+
joinToken: string;
|
|
138
|
+
joinFromEventId: string | null;
|
|
139
|
+
events: BaseEvent[];
|
|
140
|
+
}
|
|
141
|
+
type ConnectThreadResponse = ConnectThreadBootstrapResponse | ConnectThreadLiveResponse | null;
|
|
142
|
+
/** A single message within a thread's persisted history. */
|
|
143
|
+
interface ThreadMessage {
|
|
144
|
+
/** Unique identifier for this message. */
|
|
145
|
+
id: string;
|
|
146
|
+
/** Message role, e.g. `"user"`, `"assistant"`, `"tool"`. */
|
|
147
|
+
role: string;
|
|
148
|
+
/** Text content of the message. May be absent for tool-call-only messages. */
|
|
149
|
+
content?: string;
|
|
150
|
+
/** Tool calls initiated by this message (assistant role only). */
|
|
151
|
+
toolCalls?: Array<{
|
|
152
|
+
id: string;
|
|
153
|
+
name: string; /** JSON-encoded arguments passed to the tool. */
|
|
154
|
+
args: string;
|
|
155
|
+
}>;
|
|
156
|
+
/** For tool-result messages, the ID of the tool call this message responds to. */
|
|
157
|
+
toolCallId?: string;
|
|
158
|
+
}
|
|
159
|
+
/** Response from {@link CopilotKitIntelligence.getThreadMessages}. */
|
|
160
|
+
interface ThreadMessagesResponse {
|
|
161
|
+
messages: ThreadMessage[];
|
|
162
|
+
}
|
|
163
|
+
interface AcquireThreadLockRequest {
|
|
164
|
+
threadId: string;
|
|
165
|
+
runId: string;
|
|
166
|
+
}
|
|
167
|
+
declare class CopilotKitIntelligence {
|
|
168
|
+
#private;
|
|
169
|
+
constructor(config: CopilotKitIntelligenceConfig);
|
|
170
|
+
/**
|
|
171
|
+
* Register a listener invoked whenever a thread is created.
|
|
172
|
+
*
|
|
173
|
+
* Multiple listeners can be registered. Each call returns an unsubscribe
|
|
174
|
+
* function that removes the listener when called.
|
|
175
|
+
*
|
|
176
|
+
* @param callback - Receives the newly created {@link ThreadSummary}.
|
|
177
|
+
* @returns A function that removes this listener when called.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const unsubscribe = intelligence.onThreadCreated((thread) => {
|
|
182
|
+
* console.log("Thread created:", thread.id);
|
|
183
|
+
* });
|
|
184
|
+
* // later…
|
|
185
|
+
* unsubscribe();
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
onThreadCreated(callback: (thread: ThreadSummary) => void): () => void;
|
|
189
|
+
/**
|
|
190
|
+
* Register a listener invoked whenever a thread is updated (including archive).
|
|
191
|
+
*
|
|
192
|
+
* Multiple listeners can be registered. Each call returns an unsubscribe
|
|
193
|
+
* function that removes the listener when called.
|
|
194
|
+
*
|
|
195
|
+
* @param callback - Receives the updated {@link ThreadSummary}.
|
|
196
|
+
* @returns A function that removes this listener when called.
|
|
197
|
+
*/
|
|
198
|
+
onThreadUpdated(callback: (thread: ThreadSummary) => void): () => void;
|
|
199
|
+
/**
|
|
200
|
+
* Register a listener invoked whenever a thread is deleted.
|
|
201
|
+
*
|
|
202
|
+
* Multiple listeners can be registered. Each call returns an unsubscribe
|
|
203
|
+
* function that removes the listener when called.
|
|
204
|
+
*
|
|
205
|
+
* @param callback - Receives the {@link ThreadDeletedPayload} identifying
|
|
206
|
+
* the deleted thread.
|
|
207
|
+
* @returns A function that removes this listener when called.
|
|
208
|
+
*/
|
|
209
|
+
onThreadDeleted(callback: (params: ThreadDeletedPayload) => void): () => void;
|
|
210
|
+
ɵgetApiUrl(): string;
|
|
211
|
+
ɵgetRunnerWsUrl(): string;
|
|
212
|
+
ɵgetClientWsUrl(): string;
|
|
213
|
+
ɵgetTenantId(): string;
|
|
214
|
+
ɵgetRunnerAuthToken(): string;
|
|
215
|
+
/**
|
|
216
|
+
* List all non-archived threads for a given user and agent.
|
|
217
|
+
*
|
|
218
|
+
* @param params.userId - User whose threads to list.
|
|
219
|
+
* @param params.agentId - Agent whose threads to list.
|
|
220
|
+
* @returns The thread list along with realtime subscription credentials.
|
|
221
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
222
|
+
*/
|
|
223
|
+
listThreads(params: {
|
|
224
|
+
userId: string;
|
|
225
|
+
agentId: string;
|
|
226
|
+
}): Promise<ListThreadsResponse>;
|
|
227
|
+
ɵsubscribeToThreads(params: SubscribeToThreadsRequest): Promise<SubscribeToThreadsResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Update thread metadata (e.g. name).
|
|
230
|
+
*
|
|
231
|
+
* Triggers the `onThreadUpdated` lifecycle callback on success.
|
|
232
|
+
*
|
|
233
|
+
* @returns The updated thread summary.
|
|
234
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
235
|
+
*/
|
|
236
|
+
updateThread(params: {
|
|
237
|
+
threadId: string;
|
|
238
|
+
userId: string;
|
|
239
|
+
agentId: string;
|
|
240
|
+
updates: UpdateThreadRequest;
|
|
241
|
+
}): Promise<ThreadSummary>;
|
|
242
|
+
/**
|
|
243
|
+
* Create a new thread on the platform.
|
|
244
|
+
*
|
|
245
|
+
* Triggers the `onThreadCreated` lifecycle callback on success.
|
|
246
|
+
*
|
|
247
|
+
* @returns The newly created thread summary.
|
|
248
|
+
* @throws {@link PlatformRequestError} with status 409 if a thread with the
|
|
249
|
+
* same `threadId` already exists.
|
|
250
|
+
*/
|
|
251
|
+
createThread(params: CreateThreadRequest): Promise<ThreadSummary>;
|
|
252
|
+
/**
|
|
253
|
+
* Fetch a single thread by ID.
|
|
254
|
+
*
|
|
255
|
+
* @returns The thread summary.
|
|
256
|
+
* @throws {@link PlatformRequestError} with status 404 if the thread does
|
|
257
|
+
* not exist.
|
|
258
|
+
*/
|
|
259
|
+
getThread(params: {
|
|
260
|
+
threadId: string;
|
|
261
|
+
}): Promise<ThreadSummary>;
|
|
262
|
+
/**
|
|
263
|
+
* Get an existing thread or create it if it does not exist.
|
|
264
|
+
*
|
|
265
|
+
* Handles the race where a concurrent request creates the thread between
|
|
266
|
+
* the initial 404 and the subsequent `createThread` call by catching the
|
|
267
|
+
* 409 Conflict and retrying the get.
|
|
268
|
+
*
|
|
269
|
+
* Triggers the `onThreadCreated` lifecycle callback when a new thread is
|
|
270
|
+
* created.
|
|
271
|
+
*
|
|
272
|
+
* @returns An object containing the thread and a `created` flag indicating
|
|
273
|
+
* whether the thread was newly created (`true`) or already existed (`false`).
|
|
274
|
+
* @throws {@link PlatformRequestError} on non-2xx responses other than
|
|
275
|
+
* 404 (get) and 409 (create race).
|
|
276
|
+
*/
|
|
277
|
+
getOrCreateThread(params: CreateThreadRequest): Promise<{
|
|
278
|
+
thread: ThreadSummary;
|
|
279
|
+
created: boolean;
|
|
280
|
+
}>;
|
|
281
|
+
/**
|
|
282
|
+
* Fetch the full message history for a thread.
|
|
283
|
+
*
|
|
284
|
+
* @returns All persisted messages in chronological order.
|
|
285
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
286
|
+
*/
|
|
287
|
+
getThreadMessages(params: {
|
|
288
|
+
threadId: string;
|
|
289
|
+
}): Promise<ThreadMessagesResponse>;
|
|
290
|
+
/**
|
|
291
|
+
* Mark a thread as archived.
|
|
292
|
+
*
|
|
293
|
+
* Archived threads are excluded from {@link listThreads} results.
|
|
294
|
+
* Triggers the `onThreadUpdated` lifecycle callback on success.
|
|
295
|
+
*
|
|
296
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
297
|
+
*/
|
|
298
|
+
archiveThread(params: {
|
|
299
|
+
threadId: string;
|
|
300
|
+
userId: string;
|
|
301
|
+
agentId: string;
|
|
302
|
+
}): Promise<void>;
|
|
303
|
+
/**
|
|
304
|
+
* Permanently delete a thread and its message history.
|
|
305
|
+
*
|
|
306
|
+
* This is irreversible. Triggers the `onThreadDeleted` lifecycle callback
|
|
307
|
+
* on success.
|
|
308
|
+
*
|
|
309
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
310
|
+
*/
|
|
311
|
+
deleteThread(params: {
|
|
312
|
+
threadId: string;
|
|
313
|
+
userId: string;
|
|
314
|
+
agentId: string;
|
|
315
|
+
}): Promise<void>;
|
|
316
|
+
ɵacquireThreadLock(params: AcquireThreadLockRequest): Promise<ThreadConnectionResponse>;
|
|
317
|
+
ɵgetActiveJoinCode(params: {
|
|
318
|
+
threadId: string;
|
|
319
|
+
}): Promise<ThreadConnectionResponse>;
|
|
320
|
+
ɵconnectThread(params: {
|
|
321
|
+
threadId: string;
|
|
322
|
+
lastSeenEventId?: string | null;
|
|
323
|
+
}): Promise<ConnectThreadResponse>;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
export { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest };
|
|
327
|
+
//# sourceMappingURL=client.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AAA,CAAkB,MAAA;IACtB,QAAA;EAAA,IACE,OAAA,CAAQ,sBAAA;;;;;;;;;EAeN,aAAA,CAAc,MAAA;IAClB,QAAA;IACA,MAAA;IACA,OAAA;EAAA,IACE,OAAA;;;;;;;;;EAiBE,YAAA,CAAa,MAAA;IACjB,QAAA;IACA,MAAA;IACA,OAAA;EAAA,IACE,OAAA;EAWE,kBAAA,CACJ,MAAA,EAAQ,wBAAA,GACP,OAAA,CAAQ,wBAAA;EAQL,kBAAA,CAAmB,MAAA;IACvB,QAAA;EAAA,IACE,OAAA,CAAQ,wBAAA;EAON,cAAA,CAAe,MAAA;IACnB,QAAA;IACA,eAAA;EAAA,IACE,OAAA,CAAQ,qBAAA;AAAA"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { BaseEvent } from "@ag-ui/client";
|
|
2
|
+
|
|
3
|
+
//#region src/intelligence-platform/client.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Client for the CopilotKit Intelligence Platform REST API.
|
|
6
|
+
*
|
|
7
|
+
* Construct the client once and pass it to any consumers that need it
|
|
8
|
+
* (e.g. `CopilotRuntime`, `IntelligenceAgentRunner`):
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { CopilotKitIntelligence, CopilotRuntime } from "@copilotkitnext/runtime";
|
|
12
|
+
*
|
|
13
|
+
* const intelligence = new CopilotKitIntelligence({
|
|
14
|
+
* apiUrl: "https://api.copilotkit.ai",
|
|
15
|
+
* wsUrl: "wss://api.copilotkit.ai",
|
|
16
|
+
* apiKey: process.env.COPILOTKIT_API_KEY!,
|
|
17
|
+
* tenantId: process.env.COPILOTKIT_TENANT_ID!,
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const runtime = new CopilotRuntime({
|
|
21
|
+
* agents,
|
|
22
|
+
* intelligence,
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
/** Payload passed to `onThreadDeleted` listeners. */
|
|
27
|
+
interface ThreadDeletedPayload {
|
|
28
|
+
threadId: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
agentId: string;
|
|
31
|
+
}
|
|
32
|
+
interface CopilotKitIntelligenceConfig {
|
|
33
|
+
/** Base URL of the intelligence platform API, e.g. "https://api.copilotkit.ai" */
|
|
34
|
+
apiUrl: string;
|
|
35
|
+
/** Intelligence websocket base URL. Runner and client socket URLs are derived from this. */
|
|
36
|
+
wsUrl: string;
|
|
37
|
+
/** API key for authenticating with the intelligence platform */
|
|
38
|
+
apiKey: string;
|
|
39
|
+
/** Tenant identifier used for self-hosted Intelligence instances */
|
|
40
|
+
tenantId: string;
|
|
41
|
+
/**
|
|
42
|
+
* Initial listener invoked after a thread is created.
|
|
43
|
+
* Prefer {@link CopilotKitIntelligence.onThreadCreated} for multiple listeners.
|
|
44
|
+
*/
|
|
45
|
+
onThreadCreated?: (thread: ThreadSummary) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Initial listener invoked after a thread is updated.
|
|
48
|
+
* Prefer {@link CopilotKitIntelligence.onThreadUpdated} for multiple listeners.
|
|
49
|
+
*/
|
|
50
|
+
onThreadUpdated?: (thread: ThreadSummary) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Initial listener invoked after a thread is deleted.
|
|
53
|
+
* Prefer {@link CopilotKitIntelligence.onThreadDeleted} for multiple listeners.
|
|
54
|
+
*/
|
|
55
|
+
onThreadDeleted?: (params: ThreadDeletedPayload) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Summary metadata for a single thread returned by the platform.
|
|
59
|
+
*
|
|
60
|
+
* This is the shape returned by list, get, create, and update operations.
|
|
61
|
+
* It does not include the thread's message history — use
|
|
62
|
+
* {@link CopilotKitIntelligence.getThreadMessages} for that.
|
|
63
|
+
*/
|
|
64
|
+
interface ThreadSummary {
|
|
65
|
+
/** Platform-assigned unique identifier. */
|
|
66
|
+
id: string;
|
|
67
|
+
/** Human-readable display name, or `null` if the thread has not been named. */
|
|
68
|
+
name: string | null;
|
|
69
|
+
/** ISO-8601 timestamp of the most recent agent run on this thread. */
|
|
70
|
+
lastRunAt?: string;
|
|
71
|
+
/** ISO-8601 timestamp of the most recent metadata update. */
|
|
72
|
+
lastUpdatedAt?: string;
|
|
73
|
+
/** ISO-8601 timestamp when the thread was created. */
|
|
74
|
+
createdAt?: string;
|
|
75
|
+
/** ISO-8601 timestamp when the thread was last updated. */
|
|
76
|
+
updatedAt?: string;
|
|
77
|
+
/** Whether the thread has been archived. Archived threads are excluded from default list results. */
|
|
78
|
+
archived?: boolean;
|
|
79
|
+
/** The agent that owns this thread. */
|
|
80
|
+
agentId?: string;
|
|
81
|
+
/** The user who created this thread. */
|
|
82
|
+
createdById?: string;
|
|
83
|
+
/** The tenant this thread belongs to. */
|
|
84
|
+
tenantId?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Response from listing threads for a user/agent pair. */
|
|
87
|
+
interface ListThreadsResponse {
|
|
88
|
+
/** The matching threads, sorted by the platform's default ordering. */
|
|
89
|
+
threads: ThreadSummary[];
|
|
90
|
+
/** Join code for subscribing to realtime metadata updates for these threads. */
|
|
91
|
+
joinCode: string;
|
|
92
|
+
/** Short-lived token for authenticating the realtime subscription. */
|
|
93
|
+
joinToken?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Fields that can be updated on a thread via {@link CopilotKitIntelligence.updateThread}.
|
|
97
|
+
*
|
|
98
|
+
* Additional platform-specific fields can be passed as extra keys and will be
|
|
99
|
+
* forwarded to the PATCH request body.
|
|
100
|
+
*/
|
|
101
|
+
interface UpdateThreadRequest {
|
|
102
|
+
/** New human-readable display name for the thread. */
|
|
103
|
+
name?: string;
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
}
|
|
106
|
+
/** Parameters for creating a new thread via {@link CopilotKitIntelligence.createThread}. */
|
|
107
|
+
interface CreateThreadRequest {
|
|
108
|
+
/** Client-generated unique identifier for the new thread. */
|
|
109
|
+
threadId: string;
|
|
110
|
+
/** The user creating the thread. Used for authorization and scoping. */
|
|
111
|
+
userId: string;
|
|
112
|
+
/** The agent this thread belongs to. */
|
|
113
|
+
agentId: string;
|
|
114
|
+
/** Optional initial display name. If omitted, the thread is unnamed until explicitly renamed. */
|
|
115
|
+
name?: string;
|
|
116
|
+
}
|
|
117
|
+
/** Credentials returned when locking or joining a thread's realtime channel. */
|
|
118
|
+
interface ThreadConnectionResponse {
|
|
119
|
+
/** Short-lived token for authenticating the Phoenix channel join. */
|
|
120
|
+
joinToken: string;
|
|
121
|
+
/** Optional join code that can be shared with other clients to join the same channel. */
|
|
122
|
+
joinCode?: string;
|
|
123
|
+
}
|
|
124
|
+
interface SubscribeToThreadsRequest {
|
|
125
|
+
userId: string;
|
|
126
|
+
}
|
|
127
|
+
interface SubscribeToThreadsResponse {
|
|
128
|
+
joinToken: string;
|
|
129
|
+
}
|
|
130
|
+
interface ConnectThreadBootstrapResponse {
|
|
131
|
+
mode: "bootstrap";
|
|
132
|
+
latestEventId: string | null;
|
|
133
|
+
events: BaseEvent[];
|
|
134
|
+
}
|
|
135
|
+
interface ConnectThreadLiveResponse {
|
|
136
|
+
mode: "live";
|
|
137
|
+
joinToken: string;
|
|
138
|
+
joinFromEventId: string | null;
|
|
139
|
+
events: BaseEvent[];
|
|
140
|
+
}
|
|
141
|
+
type ConnectThreadResponse = ConnectThreadBootstrapResponse | ConnectThreadLiveResponse | null;
|
|
142
|
+
/** A single message within a thread's persisted history. */
|
|
143
|
+
interface ThreadMessage {
|
|
144
|
+
/** Unique identifier for this message. */
|
|
145
|
+
id: string;
|
|
146
|
+
/** Message role, e.g. `"user"`, `"assistant"`, `"tool"`. */
|
|
147
|
+
role: string;
|
|
148
|
+
/** Text content of the message. May be absent for tool-call-only messages. */
|
|
149
|
+
content?: string;
|
|
150
|
+
/** Tool calls initiated by this message (assistant role only). */
|
|
151
|
+
toolCalls?: Array<{
|
|
152
|
+
id: string;
|
|
153
|
+
name: string; /** JSON-encoded arguments passed to the tool. */
|
|
154
|
+
args: string;
|
|
155
|
+
}>;
|
|
156
|
+
/** For tool-result messages, the ID of the tool call this message responds to. */
|
|
157
|
+
toolCallId?: string;
|
|
158
|
+
}
|
|
159
|
+
/** Response from {@link CopilotKitIntelligence.getThreadMessages}. */
|
|
160
|
+
interface ThreadMessagesResponse {
|
|
161
|
+
messages: ThreadMessage[];
|
|
162
|
+
}
|
|
163
|
+
interface AcquireThreadLockRequest {
|
|
164
|
+
threadId: string;
|
|
165
|
+
runId: string;
|
|
166
|
+
}
|
|
167
|
+
declare class CopilotKitIntelligence {
|
|
168
|
+
#private;
|
|
169
|
+
constructor(config: CopilotKitIntelligenceConfig);
|
|
170
|
+
/**
|
|
171
|
+
* Register a listener invoked whenever a thread is created.
|
|
172
|
+
*
|
|
173
|
+
* Multiple listeners can be registered. Each call returns an unsubscribe
|
|
174
|
+
* function that removes the listener when called.
|
|
175
|
+
*
|
|
176
|
+
* @param callback - Receives the newly created {@link ThreadSummary}.
|
|
177
|
+
* @returns A function that removes this listener when called.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const unsubscribe = intelligence.onThreadCreated((thread) => {
|
|
182
|
+
* console.log("Thread created:", thread.id);
|
|
183
|
+
* });
|
|
184
|
+
* // later…
|
|
185
|
+
* unsubscribe();
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
onThreadCreated(callback: (thread: ThreadSummary) => void): () => void;
|
|
189
|
+
/**
|
|
190
|
+
* Register a listener invoked whenever a thread is updated (including archive).
|
|
191
|
+
*
|
|
192
|
+
* Multiple listeners can be registered. Each call returns an unsubscribe
|
|
193
|
+
* function that removes the listener when called.
|
|
194
|
+
*
|
|
195
|
+
* @param callback - Receives the updated {@link ThreadSummary}.
|
|
196
|
+
* @returns A function that removes this listener when called.
|
|
197
|
+
*/
|
|
198
|
+
onThreadUpdated(callback: (thread: ThreadSummary) => void): () => void;
|
|
199
|
+
/**
|
|
200
|
+
* Register a listener invoked whenever a thread is deleted.
|
|
201
|
+
*
|
|
202
|
+
* Multiple listeners can be registered. Each call returns an unsubscribe
|
|
203
|
+
* function that removes the listener when called.
|
|
204
|
+
*
|
|
205
|
+
* @param callback - Receives the {@link ThreadDeletedPayload} identifying
|
|
206
|
+
* the deleted thread.
|
|
207
|
+
* @returns A function that removes this listener when called.
|
|
208
|
+
*/
|
|
209
|
+
onThreadDeleted(callback: (params: ThreadDeletedPayload) => void): () => void;
|
|
210
|
+
ɵgetApiUrl(): string;
|
|
211
|
+
ɵgetRunnerWsUrl(): string;
|
|
212
|
+
ɵgetClientWsUrl(): string;
|
|
213
|
+
ɵgetTenantId(): string;
|
|
214
|
+
ɵgetRunnerAuthToken(): string;
|
|
215
|
+
/**
|
|
216
|
+
* List all non-archived threads for a given user and agent.
|
|
217
|
+
*
|
|
218
|
+
* @param params.userId - User whose threads to list.
|
|
219
|
+
* @param params.agentId - Agent whose threads to list.
|
|
220
|
+
* @returns The thread list along with realtime subscription credentials.
|
|
221
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
222
|
+
*/
|
|
223
|
+
listThreads(params: {
|
|
224
|
+
userId: string;
|
|
225
|
+
agentId: string;
|
|
226
|
+
}): Promise<ListThreadsResponse>;
|
|
227
|
+
ɵsubscribeToThreads(params: SubscribeToThreadsRequest): Promise<SubscribeToThreadsResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Update thread metadata (e.g. name).
|
|
230
|
+
*
|
|
231
|
+
* Triggers the `onThreadUpdated` lifecycle callback on success.
|
|
232
|
+
*
|
|
233
|
+
* @returns The updated thread summary.
|
|
234
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
235
|
+
*/
|
|
236
|
+
updateThread(params: {
|
|
237
|
+
threadId: string;
|
|
238
|
+
userId: string;
|
|
239
|
+
agentId: string;
|
|
240
|
+
updates: UpdateThreadRequest;
|
|
241
|
+
}): Promise<ThreadSummary>;
|
|
242
|
+
/**
|
|
243
|
+
* Create a new thread on the platform.
|
|
244
|
+
*
|
|
245
|
+
* Triggers the `onThreadCreated` lifecycle callback on success.
|
|
246
|
+
*
|
|
247
|
+
* @returns The newly created thread summary.
|
|
248
|
+
* @throws {@link PlatformRequestError} with status 409 if a thread with the
|
|
249
|
+
* same `threadId` already exists.
|
|
250
|
+
*/
|
|
251
|
+
createThread(params: CreateThreadRequest): Promise<ThreadSummary>;
|
|
252
|
+
/**
|
|
253
|
+
* Fetch a single thread by ID.
|
|
254
|
+
*
|
|
255
|
+
* @returns The thread summary.
|
|
256
|
+
* @throws {@link PlatformRequestError} with status 404 if the thread does
|
|
257
|
+
* not exist.
|
|
258
|
+
*/
|
|
259
|
+
getThread(params: {
|
|
260
|
+
threadId: string;
|
|
261
|
+
}): Promise<ThreadSummary>;
|
|
262
|
+
/**
|
|
263
|
+
* Get an existing thread or create it if it does not exist.
|
|
264
|
+
*
|
|
265
|
+
* Handles the race where a concurrent request creates the thread between
|
|
266
|
+
* the initial 404 and the subsequent `createThread` call by catching the
|
|
267
|
+
* 409 Conflict and retrying the get.
|
|
268
|
+
*
|
|
269
|
+
* Triggers the `onThreadCreated` lifecycle callback when a new thread is
|
|
270
|
+
* created.
|
|
271
|
+
*
|
|
272
|
+
* @returns An object containing the thread and a `created` flag indicating
|
|
273
|
+
* whether the thread was newly created (`true`) or already existed (`false`).
|
|
274
|
+
* @throws {@link PlatformRequestError} on non-2xx responses other than
|
|
275
|
+
* 404 (get) and 409 (create race).
|
|
276
|
+
*/
|
|
277
|
+
getOrCreateThread(params: CreateThreadRequest): Promise<{
|
|
278
|
+
thread: ThreadSummary;
|
|
279
|
+
created: boolean;
|
|
280
|
+
}>;
|
|
281
|
+
/**
|
|
282
|
+
* Fetch the full message history for a thread.
|
|
283
|
+
*
|
|
284
|
+
* @returns All persisted messages in chronological order.
|
|
285
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
286
|
+
*/
|
|
287
|
+
getThreadMessages(params: {
|
|
288
|
+
threadId: string;
|
|
289
|
+
}): Promise<ThreadMessagesResponse>;
|
|
290
|
+
/**
|
|
291
|
+
* Mark a thread as archived.
|
|
292
|
+
*
|
|
293
|
+
* Archived threads are excluded from {@link listThreads} results.
|
|
294
|
+
* Triggers the `onThreadUpdated` lifecycle callback on success.
|
|
295
|
+
*
|
|
296
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
297
|
+
*/
|
|
298
|
+
archiveThread(params: {
|
|
299
|
+
threadId: string;
|
|
300
|
+
userId: string;
|
|
301
|
+
agentId: string;
|
|
302
|
+
}): Promise<void>;
|
|
303
|
+
/**
|
|
304
|
+
* Permanently delete a thread and its message history.
|
|
305
|
+
*
|
|
306
|
+
* This is irreversible. Triggers the `onThreadDeleted` lifecycle callback
|
|
307
|
+
* on success.
|
|
308
|
+
*
|
|
309
|
+
* @throws {@link PlatformRequestError} on non-2xx responses.
|
|
310
|
+
*/
|
|
311
|
+
deleteThread(params: {
|
|
312
|
+
threadId: string;
|
|
313
|
+
userId: string;
|
|
314
|
+
agentId: string;
|
|
315
|
+
}): Promise<void>;
|
|
316
|
+
ɵacquireThreadLock(params: AcquireThreadLockRequest): Promise<ThreadConnectionResponse>;
|
|
317
|
+
ɵgetActiveJoinCode(params: {
|
|
318
|
+
threadId: string;
|
|
319
|
+
}): Promise<ThreadConnectionResponse>;
|
|
320
|
+
ɵconnectThread(params: {
|
|
321
|
+
threadId: string;
|
|
322
|
+
lastSeenEventId?: string | null;
|
|
323
|
+
}): Promise<ConnectThreadResponse>;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
export { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest };
|
|
327
|
+
//# sourceMappingURL=client.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/intelligence-platform/client.ts"],"mappings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