@hugex/ai 2.9.1 → 2.9.4
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/chunk-3TXHFKDN.js +1 -0
- package/dist/{chunk-TUI5H3ZB.js → chunk-G3SGJ7XJ.js} +1 -1
- package/dist/chunk-R6EKV3WR.js +1 -0
- package/dist/{chunk-43NDF544.js → chunk-RYHQGPX5.js} +1 -1
- package/dist/client/hooks/useAgent.d.ts +31 -0
- package/dist/client/states/agent-store.d.ts +95 -0
- package/dist/client.d.ts +4 -129
- package/dist/client.js +1 -1
- package/dist/common/constants/ai-models.d.ts +10 -0
- package/dist/common/constants/tools-registry.d.ts +8 -0
- package/dist/common/types/agent-types.d.ts +61 -0
- package/dist/common/types/ai-models-types.d.ts +94 -0
- package/dist/common/types/memory-types.d.ts +28 -0
- package/dist/common/types/node-types.d.ts +9 -0
- package/dist/common/types/user-types.d.ts +11 -0
- package/dist/common/types/var-mapping.d.ts +29 -0
- package/dist/common/types/ws-message.d.ts +58 -0
- package/dist/common/utils/agent-utils.d.ts +0 -0
- package/dist/common/utils/generationParams.d.ts +19 -0
- package/dist/common/utils/logc.d.ts +17 -0
- package/dist/common/utils/reasoning.d.ts +32 -0
- package/dist/common/utils/templateUtils.d.ts +7 -0
- package/dist/common.d.ts +12 -362
- package/dist/common.js +1 -1
- package/dist/{composioTool-EXCSM6F4.js → composioTool-TVURCFXP.js} +1 -1
- package/dist/convertTempMessure-5CAGRLBY.js +1 -0
- package/dist/{httpTool-EU63HPF5.js → httpTool-NTDDXZZE.js} +1 -1
- package/dist/index.d.ts +27 -438
- package/dist/index.js +12 -12
- package/dist/{oraApi-3JWDQQUE.js → oraApi-YIJGMXX7.js} +1 -1
- package/dist/{recall-SD6FENAS.js → recall-IABRCSHY.js} +1 -1
- package/dist/server/api/agents.d.ts +1 -0
- package/dist/server/api/auth.d.ts +1 -0
- package/dist/server/api/commons.d.ts +1 -0
- package/dist/server/api/composio.d.ts +1 -0
- package/dist/server/api/instances.d.ts +1 -0
- package/dist/server/core/AgentDO.d.ts +80 -0
- package/dist/server/core/AgentHTTP.d.ts +2 -0
- package/dist/server/logic/FlowEngine.d.ts +38 -0
- package/dist/server/logic/llm/files.d.ts +2 -0
- package/dist/server/logic/llm/images.d.ts +5 -0
- package/dist/server/logic/serverMessages.d.ts +13 -0
- package/dist/server/runners/answerNodeRunner.d.ts +4 -0
- package/dist/server/runners/apiNodeRunner.d.ts +4 -0
- package/dist/server/runners/classifierNodeRunner.d.ts +6 -0
- package/dist/server/runners/llmNodeRunner.d.ts +6 -0
- package/dist/server/runners/memoNodeRunner.d.ts +4 -0
- package/dist/server/runners/startNodeRunner.d.ts +4 -0
- package/dist/server/sql/agentSQL.d.ts +24 -0
- package/dist/server/tools/composioTool.d.ts +4 -0
- package/dist/server/tools/convertTempMessure.d.ts +15 -0
- package/dist/server/tools/httpTool.d.ts +18 -0
- package/dist/server/tools/recall.d.ts +7 -0
- package/dist/server/tools/skillTool.d.ts +6 -0
- package/dist/server/tools/tempTool.d.ts +4 -0
- package/dist/server/tools/twitter.d.ts +5 -0
- package/dist/server/tools/vectorize.d.ts +6 -0
- package/dist/server/types/node.d.ts +25 -0
- package/dist/server/utils/apiUtils.d.ts +14 -0
- package/dist/server/utils/auth.d.ts +3 -0
- package/dist/server/utils/composio.d.ts +114 -0
- package/dist/server/utils/contextMemory.d.ts +25 -0
- package/dist/server/utils/cookies.d.ts +1 -0
- package/dist/server/utils/coreApi.d.ts +7 -0
- package/dist/server/utils/embeddings.d.ts +3 -0
- package/dist/server/utils/flowRefresh.d.ts +22 -0
- package/dist/server/utils/flowValidation.d.ts +2 -0
- package/dist/server/utils/jsonSchemaToZod.d.ts +12 -0
- package/dist/server/utils/modelProvider.d.ts +20 -0
- package/dist/server/utils/oraApi.d.ts +6 -0
- package/dist/server/utils/oraExtract.d.ts +11 -0
- package/dist/server/utils/secrets.d.ts +2 -0
- package/dist/server/utils/secretsRefs.d.ts +6 -0
- package/dist/server/utils/sessionEnvMemory.d.ts +12 -0
- package/dist/server/utils/sessionIndex.d.ts +16 -0
- package/dist/server/utils/telemetry.d.ts +10 -0
- package/dist/server/utils/templateUtils.d.ts +7 -0
- package/dist/{skillTool-Y5GZ4ZAR.js → skillTool-BSQFKZGK.js} +1 -1
- package/dist/tempTool-2RXAF56M.js +1 -0
- package/dist/{twitter-QNCTAE4E.js → twitter-OMDEG7T2.js} +1 -1
- package/dist/vectorize-UJXIDL2E.js +1 -0
- package/package.json +19 -19
- package/dist/chunk-2JN3IX2Y.js +0 -1
- package/dist/chunk-6BYZCJPP.js +0 -1
- package/dist/convertTempMessure-TT7DIP6C.js +0 -1
- package/dist/magic-string.es-S3C7UPCH.js +0 -13
- package/dist/skillTool.test-6UDHQARG.js +0 -190
- package/dist/tempTool-6Q6C4HEJ.js +0 -1
- package/dist/vectorize-SQROWLSU.js +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,438 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
interface FlowNode {
|
|
31
|
-
id: string;
|
|
32
|
-
type: string;
|
|
33
|
-
data: any;
|
|
34
|
-
}
|
|
35
|
-
interface FlowEdge {
|
|
36
|
-
id: string;
|
|
37
|
-
source: string;
|
|
38
|
-
target: string;
|
|
39
|
-
sourceHandle?: string;
|
|
40
|
-
}
|
|
41
|
-
interface FlowState {
|
|
42
|
-
nodes: FlowNode[];
|
|
43
|
-
edges: FlowEdge[];
|
|
44
|
-
}
|
|
45
|
-
interface FlowData {
|
|
46
|
-
tenant: string;
|
|
47
|
-
flowId: string;
|
|
48
|
-
chatId: string;
|
|
49
|
-
state?: FlowState;
|
|
50
|
-
/** Monotonic version from FlowDO, bumped on every state save. Undefined for flows
|
|
51
|
-
* never re-saved since versioning shipped — treated as "unknown", never stale. */
|
|
52
|
-
stateVersion?: number;
|
|
53
|
-
detail?: Record<string, any>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface TelemetryEvent {
|
|
57
|
-
userId?: string;
|
|
58
|
-
tenant?: string;
|
|
59
|
-
flowId?: string;
|
|
60
|
-
sessionId?: string;
|
|
61
|
-
type: string;
|
|
62
|
-
payload: any;
|
|
63
|
-
timestamp?: string;
|
|
64
|
-
}
|
|
65
|
-
declare const sendEvent: (event: TelemetryEvent, env: Env) => Promise<void>;
|
|
66
|
-
|
|
67
|
-
type FlowEngine = (input?: string | UserMessagePayload) => Promise<void>;
|
|
68
|
-
interface ExecutedNode {
|
|
69
|
-
id: string;
|
|
70
|
-
type: NodeType;
|
|
71
|
-
label?: string;
|
|
72
|
-
}
|
|
73
|
-
interface FlowEngineState {
|
|
74
|
-
flowData?: FlowData;
|
|
75
|
-
executedNodes: ExecutedNode[];
|
|
76
|
-
context?: Record<string, any>;
|
|
77
|
-
results?: Record<string, any>;
|
|
78
|
-
lastNodeId?: string;
|
|
79
|
-
lastUserMessage?: string;
|
|
80
|
-
/** Monotonic flow-run counter for session context memory. */
|
|
81
|
-
cycle?: number;
|
|
82
|
-
tokenUsage?: {
|
|
83
|
-
promptTokens: number;
|
|
84
|
-
completionTokens: number;
|
|
85
|
-
totalTokens: number;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
interface FlowEngineEvent {
|
|
89
|
-
type: string;
|
|
90
|
-
content: any;
|
|
91
|
-
timestamp?: number;
|
|
92
|
-
}
|
|
93
|
-
interface FlowEngineCallbacks {
|
|
94
|
-
onChangeState: (state: FlowEngineState) => void;
|
|
95
|
-
onServerEvent: (event: FlowEngineEvent) => void;
|
|
96
|
-
onTelemetry: (event: TelemetryEvent) => void;
|
|
97
|
-
onError: (error: string) => void;
|
|
98
|
-
}
|
|
99
|
-
declare function startEngine(sessionEnv: SessionEnv, state: FlowEngineState, callbacks?: FlowEngineCallbacks): FlowEngine;
|
|
100
|
-
|
|
101
|
-
type ComposioSessionMeta = {
|
|
102
|
-
sessionId: string;
|
|
103
|
-
userId: string;
|
|
104
|
-
/** Fingerprint of execution config; mismatch forces a new Composio session. */
|
|
105
|
-
configKey?: string;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
type SecretsMap = Readonly<Record<string, string>>;
|
|
109
|
-
|
|
110
|
-
interface SessionEnv {
|
|
111
|
-
env?: Env;
|
|
112
|
-
ctx?: DurableObjectState;
|
|
113
|
-
conn?: Connection;
|
|
114
|
-
getMessages?: () => Promise<Message[]>;
|
|
115
|
-
setMessages?: (msg: Message) => Promise<void>;
|
|
116
|
-
getOraModel?: (modelId: string) => Promise<any>;
|
|
117
|
-
memoryConfig?: MemoryConfig;
|
|
118
|
-
cycle?: number;
|
|
119
|
-
setContext?: (row: ContextUpsertInput) => Promise<void>;
|
|
120
|
-
getContextIndex?: () => Promise<ContextIndexEntry[]>;
|
|
121
|
-
getContextData?: (ref: string) => Promise<string | null>;
|
|
122
|
-
getContext?: (ref: string) => Promise<ContextRow | null>;
|
|
123
|
-
resolveContext?: (ref: string) => Promise<ContextRow | null>;
|
|
124
|
-
pruneContext?: (upToCycle: number) => Promise<void>;
|
|
125
|
-
/** Tenant-scoped secrets resolved at session boot. Server-only — never copy into engineState or any client-bound event. */
|
|
126
|
-
secrets?: SecretsMap;
|
|
127
|
-
/** End-user-supplied ephemeral credentials sent live over WebSocket (`AUT`). DO memory only — never persisted, never copied into engineState/state/telemetry, masked in events. Resolved by `{{ auth.NAME }}`. */
|
|
128
|
-
userAuth?: SecretsMap;
|
|
129
|
-
/** Custom tool definitions for the tenant, lazy-loaded on first custom-tool reference and cached for the session. Keyed by row.id. */
|
|
130
|
-
toolDefs?: Record<string, any>;
|
|
131
|
-
/** In-memory cache for skill references fetched during this session. Keyed by toolId:refName. */
|
|
132
|
-
skillRefCache?: Map<string, string>;
|
|
133
|
-
/** Composio session metadata keyed by composio tool row id — reused within the agent chat session. */
|
|
134
|
-
composioSessions?: Record<string, ComposioSessionMeta>;
|
|
135
|
-
/** Logged-in user from the WebSocket upgrade (fallback when engineState.context.user is missing). */
|
|
136
|
-
user?: UserInterface;
|
|
137
|
-
/** Origin derived from the WebSocket upgrade request (preferred over ORA_PUBLIC_URL for callbacks). */
|
|
138
|
-
publicOrigin?: string;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
interface State {
|
|
142
|
-
user: UserInterface | undefined;
|
|
143
|
-
/** Client-supplied identity fallback when no JWT user (via `UID` frame or HTTP body). */
|
|
144
|
-
injectedUserId?: string | null;
|
|
145
|
-
sessionId: string | null;
|
|
146
|
-
lastUpdated: Date | null;
|
|
147
|
-
engineState?: FlowEngineState;
|
|
148
|
-
error?: string;
|
|
149
|
-
modelsCache?: Record<string, any>;
|
|
150
|
-
}
|
|
151
|
-
declare class AgentDO extends Agent<Env, State> {
|
|
152
|
-
initialState: State;
|
|
153
|
-
/** JWT email wins; explicit client identity is fallback only. */
|
|
154
|
-
private resolveSessionUserId;
|
|
155
|
-
private secrets;
|
|
156
|
-
private userAuth;
|
|
157
|
-
/** Composio tool-router session metadata keyed by composio tool row id — DO memory only. */
|
|
158
|
-
private composioSessions;
|
|
159
|
-
/** In-memory cache for skill references fetched during this session — DO memory only. */
|
|
160
|
-
private skillRefCache;
|
|
161
|
-
/** Public origin from the active socket upgrade (used for OAuth callback URLs). */
|
|
162
|
-
private publicOrigin?;
|
|
163
|
-
/** Throttles the per-turn flow-version KV probe (DO memory only; resets on hibernation,
|
|
164
|
-
* which just means the next turn re-probes — correct, only loses the throttle benefit). */
|
|
165
|
-
private lastFlowVersionCheckTs;
|
|
166
|
-
onRequest(request: Request): Promise<Response>;
|
|
167
|
-
onConnect(connection: Connection, ctx: ConnectionContext): Promise<void>;
|
|
168
|
-
onMessage(connection: Connection, message: WSMessage): Promise<void>;
|
|
169
|
-
onUserMessage(connection: Connection, message: string): Promise<void>;
|
|
170
|
-
/**
|
|
171
|
-
* Store a client-supplied session identity in persisted DO state.
|
|
172
|
-
* Used as `sessions.userId` fallback when no JWT user is present; JWT always wins.
|
|
173
|
-
*/
|
|
174
|
-
onUserIdentity(connection: Connection, content: string): Promise<void>;
|
|
175
|
-
/**
|
|
176
|
-
* Store an end-user-supplied runtime credential in DO memory only.
|
|
177
|
-
* MUST NOT persist to SQL/chat history, touch this.state, or start the engine.
|
|
178
|
-
* Empty value clears that name. ACK carries the NAME only — never the value.
|
|
179
|
-
*/
|
|
180
|
-
onUserAuth(connection: Connection, content: string): Promise<void>;
|
|
181
|
-
onClearHistory(connection?: Connection): Promise<void>;
|
|
182
|
-
onStart(): Promise<void>;
|
|
183
|
-
onClose(connection: Connection, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
184
|
-
onError(error: unknown): Promise<void>;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Temperature conversion tool with static parameter support
|
|
189
|
-
*
|
|
190
|
-
* Usage examples:
|
|
191
|
-
* - Static params (node.tools): { id: 'convertTempMessure', params: { source: 'C', target: 'F' } }
|
|
192
|
-
* - Runtime override: convertTempMessure.execute({ temperature: 25, source: 'C', target: 'K' })
|
|
193
|
-
* - Mixed: Static params set defaults, runtime args can override
|
|
194
|
-
*/
|
|
195
|
-
declare function convertTempMessure(sessionEnv: SessionEnv, engineState: FlowEngineState, opts?: {
|
|
196
|
-
source?: string;
|
|
197
|
-
target?: string;
|
|
198
|
-
}, onServerEvent?: (event: any) => void): ai.Tool<{
|
|
199
|
-
temperature: number;
|
|
200
|
-
source?: string | undefined;
|
|
201
|
-
target?: string | undefined;
|
|
202
|
-
}, {
|
|
203
|
-
input: {
|
|
204
|
-
temperature: number;
|
|
205
|
-
source: string;
|
|
206
|
-
target: string;
|
|
207
|
-
};
|
|
208
|
-
output: {
|
|
209
|
-
value: number;
|
|
210
|
-
unit: string;
|
|
211
|
-
important: string;
|
|
212
|
-
};
|
|
213
|
-
}>;
|
|
214
|
-
|
|
215
|
-
declare const tempTool: (sessionEnv: SessionEnv, engineState: FlowEngineState, opts?: any, onServerEvent?: (event: any) => void) => ai.Tool<{
|
|
216
|
-
location: string;
|
|
217
|
-
}, {
|
|
218
|
-
location: string;
|
|
219
|
-
temperature: number;
|
|
220
|
-
}>;
|
|
221
|
-
|
|
222
|
-
declare function twitter(sessionEnv: SessionEnv, engineState: FlowEngineState, opts?: any, onServerEvent?: (event: any) => void): ai.Tool<any, {
|
|
223
|
-
type: any;
|
|
224
|
-
userId: any;
|
|
225
|
-
userName: any;
|
|
226
|
-
raw: any;
|
|
227
|
-
natural: string;
|
|
228
|
-
result: any;
|
|
229
|
-
tweetId?: undefined;
|
|
230
|
-
query?: undefined;
|
|
231
|
-
queryType?: undefined;
|
|
232
|
-
woeid?: undefined;
|
|
233
|
-
count?: undefined;
|
|
234
|
-
username?: undefined;
|
|
235
|
-
error?: undefined;
|
|
236
|
-
} | {
|
|
237
|
-
type: any;
|
|
238
|
-
userName: any;
|
|
239
|
-
raw: any;
|
|
240
|
-
natural: string;
|
|
241
|
-
result: any;
|
|
242
|
-
userId?: undefined;
|
|
243
|
-
tweetId?: undefined;
|
|
244
|
-
query?: undefined;
|
|
245
|
-
queryType?: undefined;
|
|
246
|
-
woeid?: undefined;
|
|
247
|
-
count?: undefined;
|
|
248
|
-
username?: undefined;
|
|
249
|
-
error?: undefined;
|
|
250
|
-
} | {
|
|
251
|
-
type: any;
|
|
252
|
-
tweetId: any;
|
|
253
|
-
raw: any;
|
|
254
|
-
natural: string;
|
|
255
|
-
result: any;
|
|
256
|
-
userId?: undefined;
|
|
257
|
-
userName?: undefined;
|
|
258
|
-
query?: undefined;
|
|
259
|
-
queryType?: undefined;
|
|
260
|
-
woeid?: undefined;
|
|
261
|
-
count?: undefined;
|
|
262
|
-
username?: undefined;
|
|
263
|
-
error?: undefined;
|
|
264
|
-
} | {
|
|
265
|
-
type: any;
|
|
266
|
-
query: any;
|
|
267
|
-
queryType: any;
|
|
268
|
-
raw: any;
|
|
269
|
-
natural: string;
|
|
270
|
-
result: any;
|
|
271
|
-
userId?: undefined;
|
|
272
|
-
userName?: undefined;
|
|
273
|
-
tweetId?: undefined;
|
|
274
|
-
woeid?: undefined;
|
|
275
|
-
count?: undefined;
|
|
276
|
-
username?: undefined;
|
|
277
|
-
error?: undefined;
|
|
278
|
-
} | {
|
|
279
|
-
type: any;
|
|
280
|
-
woeid: any;
|
|
281
|
-
count: any;
|
|
282
|
-
raw: any;
|
|
283
|
-
natural: string;
|
|
284
|
-
result: any;
|
|
285
|
-
userId?: undefined;
|
|
286
|
-
userName?: undefined;
|
|
287
|
-
tweetId?: undefined;
|
|
288
|
-
query?: undefined;
|
|
289
|
-
queryType?: undefined;
|
|
290
|
-
username?: undefined;
|
|
291
|
-
error?: undefined;
|
|
292
|
-
} | {
|
|
293
|
-
type: any;
|
|
294
|
-
username: any;
|
|
295
|
-
raw: any;
|
|
296
|
-
natural: string;
|
|
297
|
-
result: any;
|
|
298
|
-
userId?: undefined;
|
|
299
|
-
userName?: undefined;
|
|
300
|
-
tweetId?: undefined;
|
|
301
|
-
query?: undefined;
|
|
302
|
-
queryType?: undefined;
|
|
303
|
-
woeid?: undefined;
|
|
304
|
-
count?: undefined;
|
|
305
|
-
error?: undefined;
|
|
306
|
-
} | {
|
|
307
|
-
type: string;
|
|
308
|
-
error: string;
|
|
309
|
-
natural: string;
|
|
310
|
-
userId?: undefined;
|
|
311
|
-
userName?: undefined;
|
|
312
|
-
raw?: undefined;
|
|
313
|
-
result?: undefined;
|
|
314
|
-
tweetId?: undefined;
|
|
315
|
-
query?: undefined;
|
|
316
|
-
queryType?: undefined;
|
|
317
|
-
woeid?: undefined;
|
|
318
|
-
count?: undefined;
|
|
319
|
-
username?: undefined;
|
|
320
|
-
}>;
|
|
321
|
-
|
|
322
|
-
declare function vectorize(sessionEnv: SessionEnv, engineState: FlowEngineState, opts?: {
|
|
323
|
-
namespace?: string;
|
|
324
|
-
}): ai.Tool<{
|
|
325
|
-
query: string;
|
|
326
|
-
topK?: number;
|
|
327
|
-
}, {
|
|
328
|
-
results: never[];
|
|
329
|
-
query?: undefined;
|
|
330
|
-
topK?: undefined;
|
|
331
|
-
matches?: undefined;
|
|
332
|
-
} | {
|
|
333
|
-
query: string;
|
|
334
|
-
topK: number;
|
|
335
|
-
matches: any;
|
|
336
|
-
results?: undefined;
|
|
337
|
-
}>;
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Sends a message to the client over the WebSocket connection.
|
|
341
|
-
*
|
|
342
|
-
* This function formats the message as "type::content" and sends it via the provided connection.
|
|
343
|
-
* It is the primary mechanism for server-to-client communication in the agent system.
|
|
344
|
-
*
|
|
345
|
-
* @param connection - The WebSocket connection instance to send the message over
|
|
346
|
-
* @param type - The message type from the MessageType enum, used to categorize the message
|
|
347
|
-
* @param content - The message content as a string (typically JSON.stringify'd data)
|
|
348
|
-
*/
|
|
349
|
-
declare const serverSend: (connection: Connection, type: MessageType, content: string) => void;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Safely parse JSON string, with fallback to extract JSON-like objects
|
|
353
|
-
* @param s - The string to parse
|
|
354
|
-
* @returns Parsed JSON object or null if parsing fails
|
|
355
|
-
*/
|
|
356
|
-
declare const safeParseJSON: (s: string) => any;
|
|
357
|
-
/**
|
|
358
|
-
* Build a URL with query parameters
|
|
359
|
-
* @param base - Base URL
|
|
360
|
-
* @param path - Path to append
|
|
361
|
-
* @param params - Query parameters object
|
|
362
|
-
* @returns Full URL string
|
|
363
|
-
*/
|
|
364
|
-
declare const buildUrl: (base: string, path: string, params?: Record<string, any>) => string;
|
|
365
|
-
|
|
366
|
-
/** Normalize registry rows that may carry JSON columns as strings (D1 fallback). */
|
|
367
|
-
declare function normalizeModelEntry(entry: ModelEntry): ModelEntry;
|
|
368
|
-
/**
|
|
369
|
-
* Resolves a model by its ID, returning a provider-agnostic handle suitable for `streamText`.
|
|
370
|
-
*/
|
|
371
|
-
declare function resolveModelById(modelId: string, sessionEnv?: SessionEnv, overrides?: EffectiveParams): Promise<ResolvedModel | undefined>;
|
|
372
|
-
/**
|
|
373
|
-
* Registers a custom provider resolver for runtime extension.
|
|
374
|
-
*
|
|
375
|
-
* @param name - The provider name to register.
|
|
376
|
-
* @param resolver - A function that takes a ModelEntry, optional SessionEnv, and optional overrides, returning the model handle.
|
|
377
|
-
*
|
|
378
|
-
* Example usage:
|
|
379
|
-
* ```typescript
|
|
380
|
-
* registerProvider('custom', (entry, sessionEnv, overrides) => customSDK(entry.providerModel, overrides));
|
|
381
|
-
* ```
|
|
382
|
-
*/
|
|
383
|
-
declare function registerProvider(name: string, resolver: (entry: ModelEntry, sessionEnv?: SessionEnv, overrides?: Record<string, any>) => Promise<any> | any): void;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Converts a JSON Schema to a Zod schema.
|
|
387
|
-
* Supports object schemas with properties, arrays, and primitive types.
|
|
388
|
-
* Treats empty object ({}) as z.object({}).
|
|
389
|
-
* Supports nested object properties recursively; respects schema.required (makes properties optional unless required).
|
|
390
|
-
* A property `default` is an overridable fallback: it becomes z.default(...) so an
|
|
391
|
-
* omitted arg is filled (LLM-supplied value still wins). Precedence: default > required > optional.
|
|
392
|
-
* Supports arrays of primitives: { type: 'array', items: { type: 'string' } } -> z.array(z.string()).
|
|
393
|
-
* Returns z.any() for unsupported shapes as fallback.
|
|
394
|
-
*/
|
|
395
|
-
declare function jsonSchemaToZod(schema: any): z.ZodSchema;
|
|
396
|
-
|
|
397
|
-
declare const hashText: (text: string) => Promise<string>;
|
|
398
|
-
declare const embedText: (sessionEnv: SessionEnv, text: string | string[], fallback?: boolean) => Promise<any>;
|
|
399
|
-
|
|
400
|
-
declare function validateFlowStart(flow: FlowData): any;
|
|
401
|
-
|
|
402
|
-
declare function verifyUser(request: Request, env: Env, ctx: ExecutionContext): Promise<boolean | UserInterface | null>;
|
|
403
|
-
declare function verifyToken(env: Env, token?: string | null): Promise<any>;
|
|
404
|
-
|
|
405
|
-
declare function parseCookies(cookieHeader: string | null | undefined): Record<string, string>;
|
|
406
|
-
|
|
407
|
-
declare function handleCommonRoutes(request: Request, env: Env, ctx: ExecutionContext): Promise<Response | undefined>;
|
|
408
|
-
|
|
409
|
-
declare function handleAgentsRoutes(request: Request, env: Env, ctx: ExecutionContext): Promise<Response | undefined>;
|
|
410
|
-
|
|
411
|
-
declare function handleIntancesRoutes(request: Request, env: Env, ctx: ExecutionContext): Promise<Response | undefined>;
|
|
412
|
-
|
|
413
|
-
declare function handleAuthRoutes(request: Request, env: Env, ctx: ExecutionContext): Promise<Response | any>;
|
|
414
|
-
|
|
415
|
-
type SqlContext = {
|
|
416
|
-
sql: any;
|
|
417
|
-
};
|
|
418
|
-
declare function ensureMessagesTable(ctx: SqlContext): Promise<void>;
|
|
419
|
-
declare function setMessage(ctx: SqlContext, msg: Message): Promise<void>;
|
|
420
|
-
declare function getAllMessages(ctx: SqlContext): Promise<Message[]>;
|
|
421
|
-
declare function clearAllMessages(ctx: SqlContext): Promise<void>;
|
|
422
|
-
declare function ensureContextTable(ctx: SqlContext): Promise<void>;
|
|
423
|
-
declare function setContext(ctx: SqlContext, row: ContextUpsertInput): Promise<void>;
|
|
424
|
-
declare function getContextIndex(ctx: SqlContext): Promise<ContextIndexEntry[]>;
|
|
425
|
-
declare function getContext(ctx: SqlContext, ref: string): Promise<ContextRow | null>;
|
|
426
|
-
declare function getContextData(ctx: SqlContext, ref: string): Promise<string | null>;
|
|
427
|
-
/**
|
|
428
|
-
* Resolve a context ref the model echoed back: exact match first, else a unique prefix match
|
|
429
|
-
* (the working-memory block exposes shortened hash tails). Ambiguous prefixes resolve to null.
|
|
430
|
-
*/
|
|
431
|
-
declare function resolveContextRef(ctx: SqlContext, ref: string): Promise<ContextRow | null>;
|
|
432
|
-
/** Evict tool-domain rows up to and including a cycle (used after a summary folds them in). */
|
|
433
|
-
declare function deleteContextToolsUpToCycle(ctx: SqlContext, cycle: number): Promise<void>;
|
|
434
|
-
declare function getMaxContextCycle(ctx: SqlContext): Promise<number>;
|
|
435
|
-
declare function clearAllContext(ctx: SqlContext): Promise<void>;
|
|
436
|
-
declare function ensureAgentTables(ctx: SqlContext): Promise<void>;
|
|
437
|
-
|
|
438
|
-
export { AgentDO, type ComposioSessionMeta, EffectiveParams, type ExecutedNode, type FlowEngine, type FlowEngineCallbacks, type FlowEngineEvent, type FlowEngineState, Message, MessageType, ModelEntry, NodeType, ResolvedModel, type SessionEnv, type SqlContext, type State, type TelemetryEvent, UserInterface, UserMessagePayload, buildUrl, clearAllContext, clearAllMessages, convertTempMessure, deleteContextToolsUpToCycle, embedText, ensureAgentTables, ensureContextTable, ensureMessagesTable, getAllMessages, getContext, getContextData, getContextIndex, getMaxContextCycle, handleAgentsRoutes, handleAuthRoutes, handleCommonRoutes, handleIntancesRoutes, hashText, jsonSchemaToZod, normalizeModelEntry, parseCookies, registerProvider, resolveContextRef, resolveModelById, safeParseJSON, sendEvent, serverSend, setContext, setMessage, startEngine, tempTool, twitter, validateFlowStart, vectorize, verifyToken, verifyUser };
|
|
1
|
+
export * from './server/tools/convertTempMessure';
|
|
2
|
+
export * from './server/tools/tempTool';
|
|
3
|
+
export * from './server/tools/twitter';
|
|
4
|
+
export * from './server/tools/vectorize';
|
|
5
|
+
export * from './server/core/AgentDO';
|
|
6
|
+
export * from './server/logic/serverMessages';
|
|
7
|
+
export * from './server/logic/FlowEngine';
|
|
8
|
+
export * from './server/utils/apiUtils';
|
|
9
|
+
export * from './server/utils/modelProvider';
|
|
10
|
+
export * from './server/utils/jsonSchemaToZod';
|
|
11
|
+
export * from './server/utils/embeddings';
|
|
12
|
+
export * from './server/utils/flowValidation';
|
|
13
|
+
export * from './server/utils/telemetry';
|
|
14
|
+
export * from './server/utils/auth';
|
|
15
|
+
export * from './server/utils/cookies';
|
|
16
|
+
export * from './server/api/commons';
|
|
17
|
+
export * from './server/api/agents';
|
|
18
|
+
export * from './server/api/instances';
|
|
19
|
+
export * from './server/api/auth';
|
|
20
|
+
export * from './server/runners/memoNodeRunner';
|
|
21
|
+
export * from './server/runners/answerNodeRunner';
|
|
22
|
+
export * from './server/runners/startNodeRunner';
|
|
23
|
+
export * from './server/runners/classifierNodeRunner';
|
|
24
|
+
export * from './server/runners/llmNodeRunner';
|
|
25
|
+
export * from './server/sql/agentSQL';
|
|
26
|
+
export * from './index.common';
|
|
27
|
+
export * from './common/utils/logc';
|