@snrraptopack/auwgent-sdk 0.1.0-alpha.21 → 0.1.0-alpha.22

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/auwgent.ts CHANGED
@@ -14,6 +14,8 @@ export { AuwgentNative };
14
14
 
15
15
  import {
16
16
  AuwgentToolError,
17
+ AuwgentWarning,
18
+ AuwgentWarningSource,
17
19
  } from './types.js';
18
20
 
19
21
  import type {
@@ -71,6 +73,8 @@ export class TypedAuwgent<
71
73
  private lastTurnRawBlock: string | undefined = undefined;
72
74
  private agentStack: string[] = [];
73
75
  private helperSessions = new Map<string, SessionState>();
76
+ private warnings: AuwgentWarning[] = [];
77
+ private warningHandler: ((warning: AuwgentWarning) => void) | null = null;
74
78
 
75
79
  constructor(ir: IR, config: AuwgentConfig<IR>) {
76
80
  this.ir = ir;
@@ -236,10 +240,11 @@ export class TypedAuwgent<
236
240
  }
237
241
 
238
242
  private async handleMiddlewareEvent(eventJson: string): Promise<string | undefined> {
239
- const event = JSON.parse(eventJson);
240
- const ctx = this.buildContextFromRuntimeEvent(event);
243
+ try {
244
+ const event = JSON.parse(eventJson);
245
+ const ctx = this.buildContextFromRuntimeEvent(event);
241
246
 
242
- switch (event?.type) {
247
+ switch (event?.type) {
243
248
  case 'intent': {
244
249
  const value = event?.value && typeof event.value === 'object'
245
250
  ? { ...event.value }
@@ -251,9 +256,13 @@ export class TypedAuwgent<
251
256
 
252
257
  for (const m of this.getMiddleware(ctx)) {
253
258
  if (m.onIntent) {
254
- const control = await (m.onIntent as any)(event.name, value, ctx);
255
- if (control !== undefined && control !== null) {
256
- return JSON.stringify(control);
259
+ try {
260
+ const control = await (m.onIntent as any)(event.name, value, ctx);
261
+ if (control !== undefined && control !== null) {
262
+ return JSON.stringify(control);
263
+ }
264
+ } catch (error) {
265
+ this.reportWarning('middleware', 'middleware onIntent threw', error, ctx.activeAgent as string);
257
266
  }
258
267
  }
259
268
  }
@@ -265,9 +274,13 @@ export class TypedAuwgent<
265
274
 
266
275
  for (const m of this.getMiddleware(ctx)) {
267
276
  if (m.onLLMStart) {
268
- const modified = await (m.onLLMStart as any)(currentPrompt, ctx);
269
- if (typeof modified === 'string') {
270
- currentPrompt = modified;
277
+ try {
278
+ const modified = await (m.onLLMStart as any)(currentPrompt, ctx);
279
+ if (typeof modified === 'string') {
280
+ currentPrompt = modified;
281
+ }
282
+ } catch (error) {
283
+ this.reportWarning('middleware', 'middleware onLLMStart threw', error, ctx.activeAgent as string);
271
284
  }
272
285
  }
273
286
  }
@@ -280,7 +293,11 @@ export class TypedAuwgent<
280
293
  case 'llm_end': {
281
294
  for (const m of this.getMiddleware(ctx)) {
282
295
  if (m.onLLMEnd) {
283
- await (m.onLLMEnd as any)(event.response ?? {}, ctx);
296
+ try {
297
+ await (m.onLLMEnd as any)(event.response ?? {}, ctx);
298
+ } catch (error) {
299
+ this.reportWarning('middleware', 'middleware onLLMEnd threw', error, ctx.activeAgent as string);
300
+ }
284
301
  }
285
302
  }
286
303
 
@@ -291,7 +308,11 @@ export class TypedAuwgent<
291
308
 
292
309
  for (const m of this.getMiddleware(ctx)) {
293
310
  if (m.onRunStart) {
294
- session = await (m.onRunStart as any)(session, ctx);
311
+ try {
312
+ session = await (m.onRunStart as any)(session, ctx);
313
+ } catch (error) {
314
+ this.reportWarning('middleware', 'middleware onRunStart threw', error, ctx.activeAgent as string);
315
+ }
295
316
  }
296
317
  }
297
318
 
@@ -307,7 +328,11 @@ export class TypedAuwgent<
307
328
 
308
329
  for (const m of this.getMiddleware(ctx)) {
309
330
  if (m.onRunComplete) {
310
- await (m.onRunComplete as any)(session, ctx);
331
+ try {
332
+ await (m.onRunComplete as any)(session, ctx);
333
+ } catch (error) {
334
+ this.reportWarning('middleware', 'middleware onRunComplete threw', error, ctx.activeAgent as string);
335
+ }
311
336
  }
312
337
  }
313
338
 
@@ -322,9 +347,13 @@ export class TypedAuwgent<
322
347
 
323
348
  for (const m of this.getMiddleware(ctx)) {
324
349
  if (m.onError) {
325
- const shouldSwallow = await (m.onError as any)(error, session, ctx);
326
- if (shouldSwallow) {
327
- return JSON.stringify({ swallow: true });
350
+ try {
351
+ const shouldSwallow = await (m.onError as any)(error, session, ctx);
352
+ if (shouldSwallow) {
353
+ return JSON.stringify({ swallow: true });
354
+ }
355
+ } catch (middlewareError) {
356
+ this.reportWarning('middleware', 'middleware onError threw', middlewareError, ctx.activeAgent as string);
328
357
  }
329
358
  }
330
359
  }
@@ -333,6 +362,10 @@ export class TypedAuwgent<
333
362
  }
334
363
  default:
335
364
  return undefined;
365
+ }
366
+ } catch (error) {
367
+ this.reportWarning('onMiddlewareEvent', 'failed to handle middleware event', error);
368
+ return undefined;
336
369
  }
337
370
  }
338
371
 
@@ -340,11 +373,49 @@ export class TypedAuwgent<
340
373
  const ctx = this.getBuildContext();
341
374
  for (const m of this.getMiddleware(ctx)) {
342
375
  if (m.onError) {
343
- await (m as any).onError(error, undefined, ctx);
376
+ try {
377
+ await (m as any).onError(error, undefined, ctx);
378
+ } catch (middlewareError) {
379
+ this.reportWarning('middleware', 'middleware onError handler threw', middlewareError);
380
+ }
344
381
  }
345
382
  }
346
383
  }
347
384
 
385
+ private reportWarning(source: AuwgentWarningSource, message: string, error?: unknown, agentName?: string): void {
386
+ const warning: AuwgentWarning = {
387
+ timestamp: new Date().toISOString(),
388
+ source,
389
+ message,
390
+ detail: error instanceof Error ? error.message : (error != null ? String(error) : undefined),
391
+ agentName,
392
+ };
393
+
394
+ this.warnings.push(warning);
395
+
396
+ try {
397
+ this.warningHandler?.(warning);
398
+ } catch {
399
+ // Keep warning flow non-fatal.
400
+ }
401
+
402
+ const detailSuffix = warning.detail ? `: ${warning.detail}` : '';
403
+ const agentSuffix = warning.agentName ? ` [agent=${warning.agentName}]` : '';
404
+ console.warn(`[auwgent][${warning.source}]${agentSuffix} ${warning.message}${detailSuffix}`);
405
+ }
406
+
407
+ onWarning(handler: (warning: AuwgentWarning) => void): void {
408
+ this.warningHandler = handler;
409
+ }
410
+
411
+ getWarnings(): AuwgentWarning[] {
412
+ return [...this.warnings];
413
+ }
414
+
415
+ clearWarnings(): void {
416
+ this.warnings = [];
417
+ }
418
+
348
419
  /** Generate an embedding for the given text using the configured model */
349
420
  async embed(text: string): Promise<number[]> {
350
421
  try {
@@ -375,42 +446,89 @@ export class TypedAuwgent<
375
446
  const userHandler = this.storedIntentHandler;
376
447
 
377
448
  this.native.onIntent(async (name: string, value: any, agentName: string) => {
378
- const intentCtx = this.getBuildContext();
379
- intentCtx.activeAgent = agentName as any;
449
+ try {
450
+ const intentCtx = this.getBuildContext();
451
+ intentCtx.activeAgent = agentName as any;
380
452
 
381
- if (value && typeof value === 'object' && '_raw' in value) {
382
- intentCtx.rawBlock = value._raw;
383
- this.lastTurnRawBlock = value._raw;
384
- delete value._raw;
385
- }
453
+ if (value && typeof value === 'object' && '_raw' in value) {
454
+ intentCtx.rawBlock = value._raw;
455
+ this.lastTurnRawBlock = value._raw;
456
+ delete value._raw;
457
+ }
386
458
 
387
- if (userHandler) {
388
- const result = await (userHandler as any)(name, value, agentName);
389
- return result ?? null;
459
+ if (userHandler) {
460
+ const result = await (userHandler as any)(name, value, agentName);
461
+ return result ?? null;
462
+ }
463
+ } catch (error) {
464
+ this.reportWarning('onIntent', 'intent callback failed', error, agentName);
390
465
  }
391
466
  });
392
467
 
393
- if (this.storedPartialHandler) {
394
- const partialHandler = this.storedPartialHandler;
395
- this.native.onIntentPartial((name: string, value: any, agentName: string) => {
396
- (partialHandler as any)(name, value, agentName);
468
+ const partialHandler = this.storedPartialHandler;
469
+ this.native.onIntentPartial((name: string, value: any, agentName: string) => {
470
+ const partialCtx = this.getBuildContext();
471
+ partialCtx.activeAgent = agentName as any;
472
+
473
+ if (partialHandler) {
474
+ try {
475
+ const maybePromise = (partialHandler as any)(name, value, agentName);
476
+ if (maybePromise && typeof maybePromise.then === 'function') {
477
+ (maybePromise as Promise<unknown>).catch((error: unknown) => {
478
+ this.reportWarning('onIntentPartial', 'partial intent async callback rejected', error, agentName);
479
+ });
480
+ }
481
+ } catch (error) {
482
+ this.reportWarning('onIntentPartial', 'partial intent callback failed', error, agentName);
483
+ }
484
+ }
485
+
486
+ for (const m of this.getMiddleware(partialCtx)) {
487
+ if (m.onIntentPartial) {
488
+ try {
489
+ const maybePromise = (m.onIntentPartial as any)(name, value, partialCtx);
490
+ if (maybePromise && typeof maybePromise.then === 'function') {
491
+ (maybePromise as Promise<unknown>).catch((error: unknown) => {
492
+ this.reportWarning('middleware', 'middleware onIntentPartial threw', error, agentName);
493
+ });
494
+ }
495
+ } catch (error) {
496
+ this.reportWarning('middleware', 'middleware onIntentPartial threw', error, agentName);
497
+ }
498
+ }
499
+ }
397
500
  });
398
- }
399
- this.native.onMiddlewareEvent((eventJson: string) => this.handleMiddlewareEvent(eventJson));
501
+ this.native.onMiddlewareEvent(async (eventJson: string) => {
502
+ try {
503
+ return await this.handleMiddlewareEvent(eventJson);
504
+ } catch (error) {
505
+ this.reportWarning('onMiddlewareEvent', 'middleware event callback failed', error);
506
+ return undefined;
507
+ }
508
+ });
400
509
 
401
510
  this.native.onSubEngineStart(async (helperName: string, emptySessionJson: string) => {
402
- const session = this.helperSessions.get(helperName) || (JSON.parse(emptySessionJson) as SessionState);
403
- if (session.stack) {
404
- this.agentStack = [...session.stack];
511
+ try {
512
+ const session = this.helperSessions.get(helperName) || (JSON.parse(emptySessionJson) as SessionState);
513
+ if (session.stack) {
514
+ this.agentStack = [...session.stack];
515
+ }
516
+ return JSON.stringify(session);
517
+ } catch (error) {
518
+ this.reportWarning('onSubEngineStart', 'sub-engine start callback failed', error, helperName);
519
+ return emptySessionJson;
405
520
  }
406
- return JSON.stringify(session);
407
521
  });
408
522
 
409
523
  this.native.onSubEngineComplete(async (helperName: string, completedSessionJson: string) => {
410
- const session = JSON.parse(completedSessionJson) as SessionState;
411
- this.helperSessions.set(helperName, session);
412
- if (session.stack) {
413
- this.agentStack = [...session.stack];
524
+ try {
525
+ const session = JSON.parse(completedSessionJson) as SessionState;
526
+ this.helperSessions.set(helperName, session);
527
+ if (session.stack) {
528
+ this.agentStack = [...session.stack];
529
+ }
530
+ } catch (error) {
531
+ this.reportWarning('onSubEngineComplete', 'sub-engine complete callback failed', error, helperName);
414
532
  }
415
533
  });
416
534
  }
@@ -445,6 +563,9 @@ export class TypedAuwgent<
445
563
  }
446
564
 
447
565
  return currentSession;
566
+ } catch (error) {
567
+ this.reportWarning('run', 'native run failed', error);
568
+ throw error;
448
569
  } finally {
449
570
  // Deactivate listeners after run to release the TSFN ref
450
571
  // and allow the Node.js process to exit gracefully.
package/bun.lock CHANGED
@@ -9,10 +9,10 @@
9
9
  "@types/bun": "latest",
10
10
  },
11
11
  "optionalDependencies": {
12
- "@snrraptopack/auwgent-sdk-darwin-arm64": "0.1.0-alpha.21",
13
- "@snrraptopack/auwgent-sdk-darwin-x64": "0.1.0-alpha.21",
14
- "@snrraptopack/auwgent-sdk-linux-x64-gnu": "0.1.0-alpha.21",
15
- "@snrraptopack/auwgent-sdk-win32-x64-msvc": "0.1.0-alpha.21",
12
+ "@snrraptopack/auwgent-sdk-darwin-arm64": "0.1.0-alpha.22",
13
+ "@snrraptopack/auwgent-sdk-darwin-x64": "0.1.0-alpha.22",
14
+ "@snrraptopack/auwgent-sdk-linux-x64-gnu": "0.1.0-alpha.22",
15
+ "@snrraptopack/auwgent-sdk-win32-x64-msvc": "0.1.0-alpha.22",
16
16
  },
17
17
  "peerDependencies": {
18
18
  "typescript": "^5",
package/middleware.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AgentIRShape, IntentControl, SessionState, AuwgentIntent, AuwgentModelIntent, AuwgentModelValue, AuwgentResponseValue, AuwgentTargetedResponseValue } from './types.js';
1
+ import type { AgentIRShape, IntentControl, SessionState, AuwgentIntent, AuwgentModelIntent, AuwgentModelValue, AuwgentResponseValue, AuwgentTargetedResponseValue, PartialTextIntentValue, PartialStructuredIntentValue } from './types.js';
2
2
 
3
3
  // ── Middleware Types ───────────────────────────────────────────────────────
4
4
 
@@ -31,7 +31,7 @@ export type MiddlewareContext<IR extends AgentIRShape = any> = (
31
31
  */
32
32
  interface _MiddlewareHooks<
33
33
  IR extends AgentIRShape = any,
34
- CustomIntents = never,
34
+ CustomIntents extends { name: string; value: any } = never,
35
35
  Output = any,
36
36
  Tools = any,
37
37
  T extends MiddlewareContext<IR>['activeAgent'] = any
@@ -61,14 +61,31 @@ interface _MiddlewareHooks<
61
61
  */
62
62
  onIntent?: (
63
63
  ...args: {
64
- [K in AuwgentIntent<IR, CustomIntents, Output, Tools>['name']]: [
64
+ [K in AuwgentIntent<IR, CustomIntents, Output, Tools>['name'] & string]: [
65
65
  name: K,
66
66
  value: Extract<AuwgentIntent<IR, CustomIntents, Output, Tools>, { name: K }>['value'],
67
67
  ctx: Extract<MiddlewareContext<IR>, { activeAgent: T }>
68
68
  ];
69
- }[AuwgentIntent<IR, CustomIntents, Output, Tools>['name']]
69
+ }[AuwgentIntent<IR, CustomIntents, Output, Tools>['name'] & string]
70
70
  ) => IntentControl | Promise<IntentControl>;
71
71
 
72
+ /**
73
+ * Fired for streaming partial intent updates.
74
+ * Observational only; cannot return control signals.
75
+ */
76
+ onIntentPartial?: (
77
+ ...args: {
78
+ [K in AuwgentIntent<IR, CustomIntents, Output, Tools>['name'] & string]: [
79
+ name: K,
80
+ value:
81
+ | Extract<AuwgentIntent<IR, CustomIntents, Output, Tools>, { name: K }>['value']
82
+ | PartialTextIntentValue
83
+ | PartialStructuredIntentValue<any>,
84
+ ctx: Extract<MiddlewareContext<IR>, { activeAgent: T }>
85
+ ];
86
+ }[AuwgentIntent<IR, CustomIntents, Output, Tools>['name'] & string]
87
+ ) => void | Promise<void>;
88
+
72
89
  /**
73
90
  * Fired when the model emits a terminal response (text or schema).
74
91
  */
@@ -105,7 +122,7 @@ interface _MiddlewareHooks<
105
122
  */
106
123
  export type Middleware<
107
124
  IR extends AgentIRShape = any,
108
- CustomIntents = never,
125
+ CustomIntents extends { name: string; value: any } = never,
109
126
  Output = any,
110
127
  Tools = any,
111
128
  Target extends MiddlewareContext<IR>['activeAgent'] = MiddlewareContext<IR>['activeAgent']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snrraptopack/auwgent-sdk",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
4
4
  "description": "Auwgent IR Runtime — Rust-powered agent engine with type-safe TypeScript bindings",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,9 +45,9 @@
45
45
  "typescript": "^5"
46
46
  },
47
47
  "optionalDependencies": {
48
- "@snrraptopack/auwgent-sdk-win32-x64-msvc": "0.1.0-alpha.21",
49
- "@snrraptopack/auwgent-sdk-darwin-x64": "0.1.0-alpha.21",
50
- "@snrraptopack/auwgent-sdk-darwin-arm64": "0.1.0-alpha.21",
51
- "@snrraptopack/auwgent-sdk-linux-x64-gnu": "0.1.0-alpha.21"
48
+ "@snrraptopack/auwgent-sdk-win32-x64-msvc": "0.1.0-alpha.22",
49
+ "@snrraptopack/auwgent-sdk-darwin-x64": "0.1.0-alpha.22",
50
+ "@snrraptopack/auwgent-sdk-darwin-arm64": "0.1.0-alpha.22",
51
+ "@snrraptopack/auwgent-sdk-linux-x64-gnu": "0.1.0-alpha.22"
52
52
  }
53
53
  }
package/types.ts CHANGED
@@ -53,6 +53,25 @@ export class AuwgentToolError extends Error {
53
53
  }
54
54
  }
55
55
 
56
+ export type AuwgentWarningSource =
57
+ | 'onIntent'
58
+ | 'onIntentPartial'
59
+ | 'onMiddlewareEvent'
60
+ | 'onSubEngineStart'
61
+ | 'onSubEngineComplete'
62
+ | 'middleware'
63
+ | 'run'
64
+ | 'embed'
65
+ | 'embedBatch';
66
+
67
+ export interface AuwgentWarning {
68
+ timestamp: string;
69
+ source: AuwgentWarningSource;
70
+ message: string;
71
+ detail?: string;
72
+ agentName?: string;
73
+ }
74
+
56
75
  export interface AgentIRShape {
57
76
  name: string;
58
77
  input: any; // Now mandatory in IR for type extraction
@@ -60,6 +79,7 @@ export interface AgentIRShape {
60
79
  tools: readonly IRToolDef[];
61
80
  workflows?: readonly IRWorkflowDef[];
62
81
  helpers?: readonly IRHelperDef[];
82
+ types?: Record<string, any>;
63
83
  output?: any;
64
84
  modelConfig?: IRModelConfigEntry[];
65
85
  customIntents?: readonly IRCustomIntentDef[];
@@ -259,10 +279,10 @@ export type GetToolArgs<T> = T extends (args: infer A) => any ? A : Record<strin
259
279
  export type IsAny<T> = 0 extends (1 & T) ? true : false;
260
280
  export type GetToolResult<T> = T extends (args: any) => Promise<infer R> ? R : any;
261
281
 
262
- export interface ToolCallIntent<K = string, A = any> { name: 'tool_call'; value: { type: K; args: A } }
263
- export interface ToolResultIntent<K = string, R = any> { name: 'tool_result'; value: { name: K; result: R; overridden?: boolean } }
264
- export interface ToolErrorIntent<K = string> { name: 'tool_error'; value: { tool: K; message: string } }
265
- export interface ToolSkippedIntent<K = string, A = any> { name: 'tool_skipped'; value: { type: K; args: A } }
282
+ export interface ToolCallIntent<K extends string = string, A = any> { name: 'tool_call'; value: { type: K; args: A } }
283
+ export interface ToolResultIntent<K extends string = string, R = any> { name: 'tool_result'; value: { name: K; result: R; overridden?: boolean } }
284
+ export interface ToolErrorIntent<K extends string = string> { name: 'tool_error'; value: { tool: K; message: string } }
285
+ export interface ToolSkippedIntent<K extends string = string, A = any> { name: 'tool_skipped'; value: { type: K; args: A } }
266
286
 
267
287
  export interface WorkflowCallIntent<K = string, A = any> { name: 'workflow_call'; value: { type: K; args: A } }
268
288
  export interface WorkflowResultIntent<K = string, R = any> { name: 'workflow_result'; value: { name: K; result: R } }
@@ -271,7 +291,34 @@ export interface HelperCallIntent<K = string, A = any> { name: 'helper_call'; va
271
291
  export interface HelperResultIntent<K = string, R = any> { name: 'helper_result'; value: { name: K; result: R } }
272
292
 
273
293
  export interface ResponseTextIntent { name: 'response_text'; value: { text: string } }
274
- export interface ResponseSchemaIntent<Output = any> { name: 'response_schema'; value: Output }
294
+
295
+ type RootOutputSchemaName<IR extends AgentIRShape> =
296
+ string extends IR['name'] ? never : `${IR['name']}Output`;
297
+
298
+ type HelperOutputSchemaNames<IR extends AgentIRShape> =
299
+ IR['helpers'] extends readonly any[]
300
+ ? IR['helpers'][number] extends { name: infer N extends string }
301
+ ? `${N}Output`
302
+ : never
303
+ : never;
304
+
305
+ type DeclaredSchemaNames<IR extends AgentIRShape> =
306
+ IR['types'] extends Record<string, any>
307
+ ? keyof IR['types'] & string
308
+ : never;
309
+
310
+ type ResponseSchemaTypeName<IR extends AgentIRShape> =
311
+ string extends IR['name']
312
+ ? string
313
+ : RootOutputSchemaName<IR> | HelperOutputSchemaNames<IR> | DeclaredSchemaNames<IR>;
314
+
315
+ export interface ResponseSchemaIntent<Output = any, SchemaType extends string = string> {
316
+ name: 'response_schema';
317
+ value: {
318
+ type: SchemaType;
319
+ response: Output;
320
+ };
321
+ }
275
322
  export interface PendingStreamValue { $state: 'pending' }
276
323
  export interface PartialIntentEnvelope<Snapshot = unknown> {
277
324
  partial: true
@@ -298,12 +345,12 @@ export type ToolIntents<Tools> =
298
345
  string extends keyof Tools
299
346
  ? (ToolCallIntent | ToolResultIntent | ToolErrorIntent | ToolSkippedIntent)
300
347
  : {
301
- [K in keyof Tools]:
348
+ [K in keyof Tools & string]:
302
349
  | ToolCallIntent<K, GetToolArgs<Tools[K]>>
303
350
  | ToolResultIntent<K, GetToolResult<Tools[K]>>
304
351
  | ToolErrorIntent<K>
305
352
  | ToolSkippedIntent<K, GetToolArgs<Tools[K]>>
306
- }[keyof Tools];
353
+ }[keyof Tools & string];
307
354
 
308
355
  export type WorkflowIntents<IR extends AgentIRShape> =
309
356
  IR['workflows'] extends readonly any[]
@@ -331,8 +378,8 @@ export type CoreIntents<IR extends AgentIRShape, Output = any, Tools = any> = (
331
378
  | ToolIntents<Tools>
332
379
  | WorkflowIntents<IR>
333
380
  | HelperIntents<IR>
334
- | (IsAny<Output> extends true ? (ResponseTextIntent | ResponseSchemaIntent) :
335
- [Output] extends [never] ? ResponseTextIntent : (ResponseTextIntent | ResponseSchemaIntent<Output>))
381
+ | (IsAny<Output> extends true ? (ResponseTextIntent | ResponseSchemaIntent<any, ResponseSchemaTypeName<IR>>) :
382
+ [Output] extends [never] ? ResponseTextIntent : (ResponseTextIntent | ResponseSchemaIntent<Output, ResponseSchemaTypeName<IR>>))
336
383
  | ErrorIntent
337
384
  );
338
385
 
@@ -447,7 +494,7 @@ export type PartialIntentHandler<
447
494
  : PartialStructuredIntentValue<Extract<AuwgentIntent<IR, Custom, Output, Tools>, { name: K }>['value']>,
448
495
  agentName: string,
449
496
  ];
450
- }[AuwgentIntent<IR, Custom, Output, Tools>['name']]
497
+ }[AuwgentIntent<IR, Custom, Output, Tools>['name'] & string]
451
498
  ) => void;
452
499
 
453
500
  // ── Session Types ────────────────────────────────────────────────────────