@meetsmore-oss/use-ai-server 1.9.3 → 1.9.5
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/agents/AISDKAgent.d.ts +53 -0
- package/dist/agents/AISDKAgent.d.ts.map +1 -1
- package/dist/agents/AISDKAgent.perStepEvents.test.d.ts +2 -0
- package/dist/agents/AISDKAgent.perStepEvents.test.d.ts.map +1 -0
- package/dist/index.js +397 -266
- package/dist/src/agents/AISDKAgent.d.ts +53 -0
- package/dist/src/agents/AISDKAgent.d.ts.map +1 -1
- package/dist/src/agents/AISDKAgent.perStepEvents.test.d.ts +2 -0
- package/dist/src/agents/AISDKAgent.perStepEvents.test.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -230,6 +230,53 @@ export declare class AISDKAgent implements Agent {
|
|
|
230
230
|
*/
|
|
231
231
|
flushTelemetry(): Promise<void>;
|
|
232
232
|
run(input: AgentInput, events: EventEmitter): Promise<AgentResult>;
|
|
233
|
+
/**
|
|
234
|
+
* Creates the RunContext for a single run() invocation.
|
|
235
|
+
* Resolves system prompt and initializes all mutable state.
|
|
236
|
+
*/
|
|
237
|
+
private createRunContext;
|
|
238
|
+
/**
|
|
239
|
+
* Emits initial lifecycle events: RUN_STARTED, MESSAGES_SNAPSHOT, STATE_SNAPSHOT.
|
|
240
|
+
*/
|
|
241
|
+
private emitRunStartEvents;
|
|
242
|
+
/**
|
|
243
|
+
* Creates a telemetry span and sets input from the last user message.
|
|
244
|
+
*/
|
|
245
|
+
private startTelemetrySpan;
|
|
246
|
+
/**
|
|
247
|
+
* Logs the start of a run with message/tool counts and previews.
|
|
248
|
+
*/
|
|
249
|
+
private logRunStart;
|
|
250
|
+
/**
|
|
251
|
+
* Runs step-by-step model invocations, refreshing tools/state between steps.
|
|
252
|
+
* Each step runs ONE model invocation, then checks for updated tools/state.
|
|
253
|
+
*/
|
|
254
|
+
private executeStepLoop;
|
|
255
|
+
/**
|
|
256
|
+
* Detects incomplete tool calls caused by maxOutputTokens truncation and injects
|
|
257
|
+
* synthetic error tool_results into ctx so the model can retry with shorter arguments.
|
|
258
|
+
*
|
|
259
|
+
* When the stream is cut mid-tool-input, tool-input-start fires but tool-call never fires.
|
|
260
|
+
*
|
|
261
|
+
* Mutates ctx.allResponseMessages and ctx.currentMessages as a side effect.
|
|
262
|
+
* @returns true if recovery messages were injected (caller should continue to next step)
|
|
263
|
+
*/
|
|
264
|
+
private handleIncompleteToolCalls;
|
|
265
|
+
/**
|
|
266
|
+
* Processes a single stream chunk, emitting the appropriate AG-UI events.
|
|
267
|
+
* Mutates stepCtx.stepHadToolCalls when a tool call is detected.
|
|
268
|
+
*/
|
|
269
|
+
private processStreamChunk;
|
|
270
|
+
/**
|
|
271
|
+
* Finalizes a successful run: emits TEXT_MESSAGE_END, checks for empty response,
|
|
272
|
+
* emits RUN_FINISHED, and returns the AgentResult.
|
|
273
|
+
*/
|
|
274
|
+
private finalizeRun;
|
|
275
|
+
/**
|
|
276
|
+
* Handles errors during a run: classifies the error, records telemetry,
|
|
277
|
+
* emits RUN_ERROR, and returns the AgentResult.
|
|
278
|
+
*/
|
|
279
|
+
private handleRunError;
|
|
233
280
|
/**
|
|
234
281
|
* Resolves the systemPrompt configuration value.
|
|
235
282
|
* Handles string, sync function, and async function cases.
|
|
@@ -254,6 +301,12 @@ export declare class AISDKAgent implements Agent {
|
|
|
254
301
|
* @returns A SystemModelMessage with the state, or undefined if no state
|
|
255
302
|
*/
|
|
256
303
|
private buildStateMessage;
|
|
304
|
+
/**
|
|
305
|
+
* When maxSteps is exhausted mid-tool-call chain, overrides step config
|
|
306
|
+
* to strip tools and inject a summary prompt so the model can summarize progress.
|
|
307
|
+
* No-ops when isGracefulSummaryStep is false.
|
|
308
|
+
*/
|
|
309
|
+
private applyGracefulSummaryOverrides;
|
|
257
310
|
/**
|
|
258
311
|
* Filters tools using the configured filter function.
|
|
259
312
|
* If no filter is configured, returns all tools.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AISDKAgent.d.ts","sourceRoot":"","sources":["../../../src/agents/AISDKAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,aAAa,
|
|
1
|
+
{"version":3,"file":"AISDKAgent.d.ts","sourceRoot":"","sources":["../../../src/agents/AISDKAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,aAAa,EAA8G,MAAM,IAAI,CAAC;AAMvK,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,UAAU,CAAC;AA0BpE,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAoGjF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,EAAE,aAAa,CAAC;IAErB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC;IAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IAEpC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;C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