@robota-sdk/agent-core 3.0.0-beta.83 → 3.0.0-beta.85
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/CHANGELOG.md +103 -0
- package/README.md +154 -116
- package/dist/browser/bounded-output-Bgx2Cgkx.js +2 -0
- package/dist/browser/bounded-output-Bgx2Cgkx.js.map +1 -0
- package/dist/browser/{command-executor-cI7XJ374.js → command-executor-C0XXfBnt.js} +2 -2
- package/dist/browser/{command-executor-cI7XJ374.js.map → command-executor-C0XXfBnt.js.map} +1 -1
- package/dist/browser/{http-executor-CHy6UeBU.js → http-executor-B4YgCJg7.js} +2 -2
- package/dist/browser/{http-executor-CHy6UeBU.js.map → http-executor-B4YgCJg7.js.map} +1 -1
- package/dist/browser/index.d.ts +1251 -918
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +10 -10
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/{verdict-decoder-Dk_w2NG9.js → verdict-decoder-Dz_rjoIZ.js} +2 -2
- package/dist/browser/verdict-decoder-Dz_rjoIZ.js.map +1 -0
- package/dist/node/bounded-output-Bgx2Cgkx.js +2 -0
- package/dist/node/bounded-output-Bgx2Cgkx.js.map +1 -0
- package/dist/node/{command-executor-Aat_q7P2.cjs → command-executor-CqAFpB-X.cjs} +1 -1
- package/dist/node/{command-executor-DV-H2oD6.js → command-executor-d6DdfUTD.js} +2 -2
- package/dist/node/{command-executor-DV-H2oD6.js.map → command-executor-d6DdfUTD.js.map} +1 -1
- package/dist/node/{http-executor-cWzI2svn.js → http-executor-ADn4locH.js} +2 -2
- package/dist/node/{http-executor-cWzI2svn.js.map → http-executor-ADn4locH.js.map} +1 -1
- package/dist/node/{http-executor-71JiIdFP.cjs → http-executor-BFtXs8FP.cjs} +1 -1
- package/dist/node/{index-D1_Mak-n.d.cts → index-CPwJEiFl.d.cts} +1251 -917
- package/dist/node/index-CPwJEiFl.d.cts.map +1 -0
- package/dist/node/{index-D4iJ5IsN.d.ts → index-DQrmrFn9.d.ts} +1251 -917
- package/dist/node/index-DQrmrFn9.d.ts.map +1 -0
- package/dist/node/index.cjs +10 -10
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +11 -11
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.cjs +1 -1
- package/dist/node/node.d.cts +1 -1
- package/dist/node/node.d.ts +1 -1
- package/dist/node/node.js +1 -1
- package/dist/node/testing/index.d.cts +1 -1
- package/dist/node/testing/index.d.ts +1 -1
- package/dist/node/{types-gNrckgFE.d.ts → types-Ge2XB-y-.d.cts} +4 -5
- package/dist/node/types-Ge2XB-y-.d.cts.map +1 -0
- package/dist/node/{types-gNrckgFE.d.cts → types-Ge2XB-y-.d.ts} +4 -5
- package/dist/node/types-Ge2XB-y-.d.ts.map +1 -0
- package/dist/node/verdict-decoder-DIHay1ul.cjs +1 -0
- package/dist/node/{verdict-decoder-Dk_w2NG9.js → verdict-decoder-Dz_rjoIZ.js} +2 -2
- package/dist/node/verdict-decoder-Dz_rjoIZ.js.map +1 -0
- package/package.json +3 -3
- package/dist/browser/bounded-output-DpjpS98g.js +0 -2
- package/dist/browser/bounded-output-DpjpS98g.js.map +0 -1
- package/dist/browser/verdict-decoder-Dk_w2NG9.js.map +0 -1
- package/dist/node/bounded-output-DpjpS98g.js +0 -2
- package/dist/node/bounded-output-DpjpS98g.js.map +0 -1
- package/dist/node/index-D1_Mak-n.d.cts.map +0 -1
- package/dist/node/index-D4iJ5IsN.d.ts.map +0 -1
- package/dist/node/types-gNrckgFE.d.cts.map +0 -1
- package/dist/node/types-gNrckgFE.d.ts.map +0 -1
- package/dist/node/verdict-decoder-Dk_w2NG9.js.map +0 -1
- package/dist/node/verdict-decoder-Estx9MtY.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as IModelEffortResolution, F as IUniversalObjectValue, I as TPrimitiveValue, L as TUniversalArrayValue, R as TUniversalValue, S as IModelEffortOutcome, _ as IOutboundTraceContext, a as IHookErrorOutcome, b as TSubprocessTraceClass, c as IHookTypeExecutor, d as TGuardrail, f as THookDefinition, h as THooksConfig, j as TModelEffortSelection, k as TModelEffortOutcomeCallback, m as THookOutcome, p as THookEvent, s as IHookInput, v as IRunTraceContext, w as IProviderModelEffortTable, y as ISubprocessTraceEnv } from "./types-
|
|
1
|
+
import { C as IModelEffortResolution, F as IUniversalObjectValue, I as TPrimitiveValue, L as TUniversalArrayValue, R as TUniversalValue, S as IModelEffortOutcome, _ as IOutboundTraceContext, a as IHookErrorOutcome, b as TSubprocessTraceClass, c as IHookTypeExecutor, d as TGuardrail, f as THookDefinition, h as THooksConfig, j as TModelEffortSelection, k as TModelEffortOutcomeCallback, m as THookOutcome, p as THookEvent, s as IHookInput, v as IRunTraceContext, w as IProviderModelEffortTable, y as ISubprocessTraceEnv } from "./types-Ge2XB-y-.js";
|
|
2
2
|
import { TypeOf, ZodType } from "zod";
|
|
3
3
|
//#region src/interfaces/types.d.ts
|
|
4
4
|
/**
|
|
@@ -38,146 +38,37 @@ declare const TypeUtils: {
|
|
|
38
38
|
isUniversalValue: (value: TUniversalValue) => value is TUniversalValue;
|
|
39
39
|
};
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region src/interfaces/
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
model: string;
|
|
50
|
-
/** Provider name */
|
|
51
|
-
provider: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Cached LLM response entry
|
|
55
|
-
*/
|
|
56
|
-
interface ICacheEntry {
|
|
57
|
-
/** Cache key that produced this entry */
|
|
58
|
-
key: ICacheKey;
|
|
59
|
-
/** Cached response content */
|
|
60
|
-
response: string;
|
|
61
|
-
/** When the entry was cached */
|
|
62
|
-
timestamp: number;
|
|
63
|
-
/** SHA-256 integrity hash of the response */
|
|
64
|
-
integrityHash: string;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Cache storage interface for pluggable backends
|
|
68
|
-
*/
|
|
69
|
-
interface ICacheStorage {
|
|
70
|
-
/** Retrieve a cached entry by key hash */
|
|
71
|
-
get(hash: string): ICacheEntry | undefined;
|
|
72
|
-
/** Store a cache entry */
|
|
73
|
-
set(entry: ICacheEntry): void;
|
|
74
|
-
/** Delete a cached entry by key hash */
|
|
75
|
-
delete(hash: string): boolean;
|
|
76
|
-
/** Clear all cached entries */
|
|
77
|
-
clear(): void;
|
|
78
|
-
/** Get cache statistics */
|
|
79
|
-
getStats(): ICacheStats;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Cache performance statistics
|
|
83
|
-
*/
|
|
84
|
-
interface ICacheStats {
|
|
85
|
-
/** Number of cache hits */
|
|
86
|
-
hits: number;
|
|
87
|
-
/** Number of cache misses */
|
|
88
|
-
misses: number;
|
|
89
|
-
/** Current number of cached entries */
|
|
90
|
-
entries: number;
|
|
91
|
-
/** Hit rate (hits / (hits + misses)), 0 if no lookups */
|
|
92
|
-
hitRate: number;
|
|
41
|
+
//#region src/interfaces/tool-continuation.d.ts
|
|
42
|
+
/** Core-owned identity, independent of a provider's reusable tool-call identifier. */
|
|
43
|
+
interface IToolActionIdentity {
|
|
44
|
+
executionId: string;
|
|
45
|
+
actionId: string;
|
|
46
|
+
parentCallId: string;
|
|
47
|
+
toolCallId: string;
|
|
48
|
+
toolName: string;
|
|
93
49
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
interface ICacheOptions {
|
|
98
|
-
/** Whether caching is enabled */
|
|
99
|
-
enabled: boolean;
|
|
100
|
-
/** Maximum number of cached entries */
|
|
101
|
-
maxEntries: number;
|
|
102
|
-
/** Time-to-live in milliseconds */
|
|
103
|
-
ttlMs: number;
|
|
50
|
+
interface IToolContinuationPrompt {
|
|
51
|
+
kind: string;
|
|
52
|
+
data: TToolParameters;
|
|
104
53
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* UI-agnostic "ask the user" contract (CMD-004).
|
|
109
|
-
*
|
|
110
|
-
* The SSOT for the interaction action lives in agent-core so every interaction *source* can reach it:
|
|
111
|
-
* command execution (`ICommandHostContext`, agent-framework) AND tool execution
|
|
112
|
-
* (`IToolExecutionContext`, agent-core, for model-issued questions — CMD-005). These are pure types
|
|
113
|
-
* with no runtime dependency, so the contract crosses a serialization/transport boundary unchanged
|
|
114
|
-
* (no function-valued fields).
|
|
115
|
-
*
|
|
116
|
-
* A single shape covers every interaction kind, parameterised by fields rather than split into
|
|
117
|
-
* variants:
|
|
118
|
-
* - confirm → two options, `maxSelect` 1
|
|
119
|
-
* - single → options, `maxSelect` 1
|
|
120
|
-
* - multi → options, `maxSelect` > 1
|
|
121
|
-
* - free text → no options, `allowFreeText` true
|
|
122
|
-
* - secret → free text with `masked` true
|
|
123
|
-
*/
|
|
124
|
-
/** One predefined option the user can choose. */
|
|
125
|
-
interface IActionOption {
|
|
126
|
-
value: string;
|
|
127
|
-
label: string;
|
|
128
|
-
description?: string;
|
|
54
|
+
interface IToolWaitRequest extends IToolActionIdentity, IToolContinuationPrompt {
|
|
55
|
+
requestId: string;
|
|
129
56
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
57
|
+
interface IToolWaitResponse {
|
|
58
|
+
requestId: string;
|
|
59
|
+
responseId: string;
|
|
60
|
+
response: TToolParameters;
|
|
134
61
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
id: string;
|
|
139
|
-
title: string;
|
|
140
|
-
description?: string;
|
|
141
|
-
/** Predefined options. Empty/omitted ⇒ pure free-text entry. */
|
|
142
|
-
options?: readonly IActionOption[];
|
|
143
|
-
/** Minimum selections required (default 1). */
|
|
144
|
-
minSelect?: number;
|
|
145
|
-
/** Maximum selections allowed (default 1 ⇒ single; > 1 ⇒ multi). */
|
|
146
|
-
maxSelect?: number;
|
|
147
|
-
/** Allow a typed custom answer in addition to / instead of the options. */
|
|
148
|
-
allowFreeText?: boolean;
|
|
149
|
-
/** Free-text entry is masked (secret entry such as an API key); the renderer hides input. */
|
|
150
|
-
masked?: boolean;
|
|
151
|
-
/** Allow submitting empty free text. */
|
|
152
|
-
allowEmpty?: boolean;
|
|
153
|
-
/** Placeholder shown in the free-text field. */
|
|
154
|
-
placeholder?: string;
|
|
155
|
-
/** Maximum options shown before scrolling (renderer hint). */
|
|
156
|
-
maxVisible?: number;
|
|
157
|
-
/** Pre-selected option values and/or prefilled free text. */
|
|
158
|
-
default?: IActionDefault;
|
|
62
|
+
interface IToolWaitState {
|
|
63
|
+
request: IToolWaitRequest;
|
|
64
|
+
response?: IToolWaitResponse;
|
|
159
65
|
}
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
type: 'answer';
|
|
167
|
-
values: readonly string[];
|
|
168
|
-
text?: string;
|
|
169
|
-
} | {
|
|
170
|
-
type: 'cancelled';
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* The injected "ask the user" port — a single seam reachable by every interaction source (command
|
|
174
|
-
* execution now; tool execution for model-issued questions later) and rendered per-environment by each
|
|
175
|
-
* transport. The concurrency model (broadcast to attached interactive channels, first answer wins,
|
|
176
|
-
* later answers for an already-resolved `id` ignored) is owned by the port implementation, not the
|
|
177
|
-
* contract.
|
|
178
|
-
*/
|
|
179
|
-
interface IUserInteraction {
|
|
180
|
-
ask(request: IActionRequest): Promise<TActionResponse>;
|
|
66
|
+
/** Available before effect admission. The runtime owns interpretation and authorization. */
|
|
67
|
+
interface IToolContinuation {
|
|
68
|
+
readonly action: IToolActionIdentity;
|
|
69
|
+
readonly waits: readonly IToolWaitState[];
|
|
70
|
+
/** Return a saved response or persist a request and suspend this execution. */
|
|
71
|
+
request(prompt: IToolContinuationPrompt): Promise<TToolParameters>;
|
|
181
72
|
}
|
|
182
73
|
//#endregion
|
|
183
74
|
//#region src/interfaces/messages.d.ts
|
|
@@ -529,10 +420,14 @@ declare class RateLimitError extends RobotaError {
|
|
|
529
420
|
*/
|
|
530
421
|
declare class NetworkError extends RobotaError {
|
|
531
422
|
readonly originalError?: Error | undefined;
|
|
423
|
+
/** `undefined` for a network failure with no provider context (e.g. a generic timeout). */
|
|
424
|
+
readonly provider?: string | undefined;
|
|
532
425
|
readonly code = "NETWORK_ERROR";
|
|
533
426
|
readonly category: "system";
|
|
534
427
|
readonly recoverable = true;
|
|
535
|
-
constructor(message: string, originalError?: Error | undefined, context?: TErrorContextData
|
|
428
|
+
constructor(message: string, originalError?: Error | undefined, context?: TErrorContextData,
|
|
429
|
+
/** `undefined` for a network failure with no provider context (e.g. a generic timeout). */
|
|
430
|
+
provider?: string | undefined);
|
|
536
431
|
}
|
|
537
432
|
/**
|
|
538
433
|
* Tool execution errors
|
|
@@ -569,15 +464,50 @@ declare class SameToolInputLoopError extends RobotaError {
|
|
|
569
464
|
readonly recoverable = true;
|
|
570
465
|
constructor(toolName: string, callCount: number, maxSameToolInputs: number, context?: TErrorContextData);
|
|
571
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* A turn ended with neither a tool result nor a final text response while `allowToolOnlyCompletion`
|
|
469
|
+
* was set.
|
|
470
|
+
*
|
|
471
|
+
* `allowToolOnlyCompletion` only WIDENS what counts as a valid finish (a tool call alone, with no
|
|
472
|
+
* final text after it); it never narrows the ordinary case. Without the flag, a round that produces
|
|
473
|
+
* neither is recovered by one more provider call asking for a summary (`forceSummaryCall`). Setting
|
|
474
|
+
* the flag is what turns that rescue off — a decision agent wants exactly one provider call, never a
|
|
475
|
+
* follow-up — so a round that produces neither has nothing left to recover it. That is a genuinely
|
|
476
|
+
* unanswered turn, not the internal `[STRICT-POLICY]` result-shape violation an actually malformed
|
|
477
|
+
* execution result trips; a caller must be able to catch this by type instead of parsing that message.
|
|
478
|
+
*
|
|
479
|
+
* `recoverable` is TRUE: like `SameToolInputLoopError`, this is a property of this turn's prompt and
|
|
480
|
+
* model response, not of the system, and a caller that varies either can reasonably try again.
|
|
481
|
+
*/
|
|
482
|
+
declare class EmptyCompletionError extends RobotaError {
|
|
483
|
+
readonly round: number;
|
|
484
|
+
readonly code = "EMPTY_COMPLETION";
|
|
485
|
+
readonly category: "provider";
|
|
486
|
+
readonly recoverable = true;
|
|
487
|
+
constructor(round: number, context?: TErrorContextData);
|
|
488
|
+
}
|
|
572
489
|
/**
|
|
573
490
|
* Model not available errors
|
|
574
491
|
*/
|
|
575
492
|
declare class ModelNotAvailableError extends RobotaError {
|
|
493
|
+
/** `undefined` when the failure names no model — a provider adapter classifying a raw HTTP
|
|
494
|
+
* response by status alone does not always know which model the vendor meant. */
|
|
495
|
+
readonly model: string | undefined;
|
|
496
|
+
readonly provider: string;
|
|
576
497
|
readonly availableModels?: string[] | undefined;
|
|
577
498
|
readonly code = "MODEL_NOT_AVAILABLE";
|
|
578
499
|
readonly category: "user";
|
|
579
500
|
readonly recoverable = false;
|
|
580
|
-
constructor(
|
|
501
|
+
constructor(
|
|
502
|
+
/** `undefined` when the failure names no model — a provider adapter classifying a raw HTTP
|
|
503
|
+
* response by status alone does not always know which model the vendor meant. */
|
|
504
|
+
model: string | undefined, provider: string, availableModels?: string[] | undefined,
|
|
505
|
+
/**
|
|
506
|
+
* `context.originalMessage`, when given, is the vendor's own text (already scrubbed of any
|
|
507
|
+
* credential by the caller) — folded into `message` so a "Details" disclosure built from
|
|
508
|
+
* `message` alone still shows the real cause instead of just this class's fixed sentence.
|
|
509
|
+
*/
|
|
510
|
+
context?: TErrorContextData);
|
|
581
511
|
}
|
|
582
512
|
/**
|
|
583
513
|
* Circuit breaker open error
|
|
@@ -618,6 +548,25 @@ declare class CacheIntegrityError extends RobotaError {
|
|
|
618
548
|
}
|
|
619
549
|
//#endregion
|
|
620
550
|
//#region src/utils/provider-failure.d.ts
|
|
551
|
+
/**
|
|
552
|
+
* Strip anything that reads like a credential out of vendor text before it is kept on a typed error.
|
|
553
|
+
* A vendor's error body is not supposed to echo request headers, but a misconfigured self-hosted
|
|
554
|
+
* gateway can bounce the raw request back (an `Authorization` header, a `Bearer` token, an `api_key=`
|
|
555
|
+
* query parameter, or the whole request re-serialized as JSON) — this runs once, ahead of every
|
|
556
|
+
* classification below, so nothing built from `message` (the wire frame's `message`, a GUI "Details"
|
|
557
|
+
* disclosure) can leak one.
|
|
558
|
+
*
|
|
559
|
+
* Each pattern gets its own fixed replacement, bounded to the credential token — never a shared
|
|
560
|
+
* callback keyed on "does this match have a capture group", which for a pattern with none receives
|
|
561
|
+
* the match's numeric offset instead of `undefined` and silently prints that number.
|
|
562
|
+
*
|
|
563
|
+
* The key-name and value quotes are each optional and captured (`(")?`) rather than matched and
|
|
564
|
+
* dropped: JSON re-serializes a header as `"Authorization": "Bearer sk-..."`, and the closing quote
|
|
565
|
+
* right after the key name breaks a match that only expects `\s*[:=]` next — capturing it lets the
|
|
566
|
+
* replacement echo it back (`Authorization$1: $2[REDACTED]`) so quoted and unquoted text both read
|
|
567
|
+
* naturally, and `SECRET_VALUE` excluding `"` leaves a closing value quote alone to survive untouched.
|
|
568
|
+
*/
|
|
569
|
+
declare function scrubSecrets(text: string): string;
|
|
621
570
|
/** Why a provider call failed, as far as switching models is concerned. */
|
|
622
571
|
type TProviderFailureReason = 'overloaded' | 'service-unavailable' | 'server-error' | 'model-unavailable' | 'authentication' | 'billing' | 'rate-limit' | 'invalid-request' | 'network' | 'aborted' | 'unknown';
|
|
623
572
|
interface IProviderFailureClassification {
|
|
@@ -637,9 +586,15 @@ declare function readProviderFailureDetails(error: unknown): IProviderFailureDet
|
|
|
637
586
|
/**
|
|
638
587
|
* Turn whatever an adapter caught into a typed provider failure.
|
|
639
588
|
*
|
|
640
|
-
* Aborts and errors already in the taxonomy pass through unchanged
|
|
641
|
-
*
|
|
642
|
-
*
|
|
589
|
+
* Aborts and errors already in the taxonomy pass through unchanged. Everything else is classified by
|
|
590
|
+
* the same status/type rules `classifyLayer` uses to decide switchability — a rate limit, an
|
|
591
|
+
* authentication failure, a model the vendor does not serve, and a transport failure each become
|
|
592
|
+
* their own typed error (so `AuthenticationError`/`ModelNotAvailableError`/`NetworkError` are actually
|
|
593
|
+
* thrown, not just recognized after the fact); anything left over becomes a `ProviderError` carrying
|
|
594
|
+
* the status and type the vendor reported, with the original kept as `originalError`. Every branch
|
|
595
|
+
* keeps the vendor's own (scrubbed) message and status/type — as the text baked into `message` for
|
|
596
|
+
* the types that already carry a free-form one, and as `context` alongside it — so a "Details"
|
|
597
|
+
* disclosure built from `message` downstream never has less to say than the vendor did.
|
|
643
598
|
*/
|
|
644
599
|
declare function toProviderError(error: unknown, provider: string, operation: string): Error;
|
|
645
600
|
/**
|
|
@@ -1146,227 +1101,306 @@ type TProviderOptionValueBase = string | number | boolean | undefined | null | T
|
|
|
1146
1101
|
[key: string]: TProviderOptionValueBase;
|
|
1147
1102
|
};
|
|
1148
1103
|
//#endregion
|
|
1149
|
-
//#region src/interfaces
|
|
1104
|
+
//#region src/event-service/interfaces.d.ts
|
|
1150
1105
|
/**
|
|
1151
|
-
*
|
|
1106
|
+
* @fileoverview Event service interface definitions.
|
|
1107
|
+
*
|
|
1108
|
+
* These interfaces are the single source of truth for event-related contracts
|
|
1109
|
+
* within @robota-sdk/agent-core.
|
|
1152
1110
|
*/
|
|
1153
|
-
interface IResponseFormatConfig {
|
|
1154
|
-
type?: 'text' | 'json_object' | 'json_schema';
|
|
1155
|
-
/** JSON schema payload; required when `type` is `'json_schema'` (CORE-015). */
|
|
1156
|
-
schema?: Record<string, TConfigValue>;
|
|
1157
|
-
/** Schema name forwarded to provider native structured-output surfaces. */
|
|
1158
|
-
name?: string;
|
|
1159
|
-
}
|
|
1160
1111
|
/**
|
|
1161
|
-
*
|
|
1112
|
+
* Primitive value types for event payloads.
|
|
1162
1113
|
*/
|
|
1163
|
-
|
|
1164
|
-
category: string;
|
|
1165
|
-
threshold: string;
|
|
1166
|
-
[key: string]: TConfigValue;
|
|
1167
|
-
}
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region src/schema/zod-schema-types.d.ts
|
|
1170
|
-
interface IZodParseResult {
|
|
1171
|
-
success: boolean;
|
|
1172
|
-
data?: unknown;
|
|
1173
|
-
error?: unknown;
|
|
1174
|
-
}
|
|
1175
|
-
interface IZodSchemaDef {
|
|
1176
|
-
typeName?: string;
|
|
1177
|
-
innerType?: IZodSchema;
|
|
1178
|
-
valueType?: IZodSchema;
|
|
1179
|
-
checks?: Array<{
|
|
1180
|
-
kind: string;
|
|
1181
|
-
value?: TUniversalValue;
|
|
1182
|
-
}>;
|
|
1183
|
-
shape?: () => Record<string, IZodSchema>;
|
|
1184
|
-
type?: IZodSchema;
|
|
1185
|
-
/**
|
|
1186
|
-
* `ZodEnum` holds an ARRAY here; `ZodNativeEnum` holds the enum OBJECT itself (CORE-041). One Zod
|
|
1187
|
-
* field name, two shapes — the converter narrows before reading it.
|
|
1188
|
-
*/
|
|
1189
|
-
values?: TUniversalValue[] | Record<string, TUniversalValue>;
|
|
1190
|
-
description?: string;
|
|
1191
|
-
unknownKeys?: 'passthrough' | 'strip' | 'strict';
|
|
1192
|
-
/** `ZodEffects` (`.refine()` / `.transform()`) holds the schema it wraps here. */
|
|
1193
|
-
schema?: IZodSchema;
|
|
1194
|
-
/** `ZodUnion` / `ZodDiscriminatedUnion` members. */
|
|
1195
|
-
options?: IZodSchema[];
|
|
1196
|
-
/** `ZodLiteral` value. */
|
|
1197
|
-
value?: TUniversalValue;
|
|
1198
|
-
}
|
|
1199
|
-
interface IZodSchema {
|
|
1200
|
-
parse(value: unknown): unknown;
|
|
1201
|
-
safeParse(value: unknown): IZodParseResult;
|
|
1202
|
-
_def?: IZodSchemaDef;
|
|
1203
|
-
}
|
|
1114
|
+
type TEventPrimitiveValue = string | number | boolean | null | undefined;
|
|
1204
1115
|
/**
|
|
1205
|
-
*
|
|
1116
|
+
* Recursive universal value type for event payloads (JSON-like + Date).
|
|
1206
1117
|
*/
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
allowAdditionalProperties?: boolean;
|
|
1211
|
-
}
|
|
1212
|
-
//#endregion
|
|
1213
|
-
//#region src/schema/structured-output.d.ts
|
|
1214
|
-
/** Explicit raw-JSON-schema form of `IRunOptions.output`. */
|
|
1215
|
-
interface IJsonSchemaOutput {
|
|
1216
|
-
/** JSON Schema (object root, universal subset) the response must match. */
|
|
1217
|
-
jsonSchema: IToolSchema['parameters'];
|
|
1218
|
-
/** Optional schema name forwarded to provider native surfaces. */
|
|
1219
|
-
name?: string;
|
|
1220
|
-
}
|
|
1221
|
-
/** Accepted `IRunOptions.output` values: a Zod schema or an explicit JSON-schema wrapper. */
|
|
1222
|
-
type TStructuredOutputSchema = IZodSchema | IJsonSchemaOutput;
|
|
1223
|
-
type TStructuredOutputValidation = {
|
|
1224
|
-
success: true;
|
|
1225
|
-
value: unknown;
|
|
1226
|
-
} | {
|
|
1227
|
-
success: false;
|
|
1228
|
-
issues: string[];
|
|
1229
|
-
};
|
|
1230
|
-
/** Internal SSOT representation every `output` value normalizes to. */
|
|
1231
|
-
interface IStructuredOutputSpec {
|
|
1232
|
-
name: string;
|
|
1233
|
-
jsonSchema: IToolSchema['parameters'];
|
|
1234
|
-
validate(value: unknown): TStructuredOutputValidation;
|
|
1118
|
+
type TEventUniversalValue = TEventPrimitiveValue | Date | TEventUniversalValue[] | IEventObjectValue;
|
|
1119
|
+
interface IEventObjectValue {
|
|
1120
|
+
[key: string]: TEventUniversalValue;
|
|
1235
1121
|
}
|
|
1236
|
-
/** Normalize an accepted `output` value into the internal spec. */
|
|
1237
|
-
declare function normalizeStructuredOutput(output: TStructuredOutputSchema): IStructuredOutputSpec;
|
|
1238
1122
|
/**
|
|
1239
|
-
*
|
|
1240
|
-
* required, enum, items, nested properties, unions and numeric bounds — the full expressible
|
|
1241
|
-
* surface of the subset, at every level.
|
|
1242
|
-
*
|
|
1243
|
-
* CORE-039: this is the ONE complete walk. `parameter-validator` delegates its depth here rather
|
|
1244
|
-
* than keeping a second, shallower copy, and the two must therefore agree by construction.
|
|
1123
|
+
* Logger data type for event metadata.
|
|
1245
1124
|
*/
|
|
1246
|
-
|
|
1125
|
+
type TEventLoggerData = Record<string, TEventUniversalValue | Date | Error>;
|
|
1247
1126
|
/**
|
|
1248
|
-
*
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1127
|
+
* A single segment in an explicit ownerPath.
|
|
1128
|
+
*
|
|
1129
|
+
* Path-only rule:
|
|
1130
|
+
* - Relationships must be derived from these explicit segments, not from parsing IDs.
|
|
1251
1131
|
*/
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1132
|
+
interface IOwnerPathSegment {
|
|
1133
|
+
type: string;
|
|
1134
|
+
id: string;
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Event context that accompanies an emitted event.
|
|
1138
|
+
* This is the single source of truth for deterministic linking in subscribers.
|
|
1139
|
+
*/
|
|
1140
|
+
interface IEventContext {
|
|
1141
|
+
ownerType: string;
|
|
1142
|
+
ownerId: string;
|
|
1143
|
+
ownerPath: IOwnerPathSegment[];
|
|
1144
|
+
/** Depth of the current execution in the hierarchy (0 = root) */
|
|
1145
|
+
depth?: number;
|
|
1146
|
+
/** Unique span identifier for distributed tracing correlation */
|
|
1147
|
+
spanId?: string;
|
|
1148
|
+
/** Optional structured metadata for debugging/observability */
|
|
1149
|
+
metadata?: TEventLoggerData;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Allowed extension values for event payloads.
|
|
1153
|
+
*/
|
|
1154
|
+
type TEventExtensionValue = TEventUniversalValue | TEventLoggerData | Error | IEventContext | IOwnerPathSegment[];
|
|
1155
|
+
/**
|
|
1156
|
+
* Base event payload shape.
|
|
1157
|
+
* Emitters may add additional fields, but MUST keep linkage information explicit.
|
|
1158
|
+
*/
|
|
1159
|
+
interface IBaseEventData {
|
|
1160
|
+
/** Timestamp when the event was emitted. This is required for deterministic ordering. */
|
|
1161
|
+
timestamp: Date;
|
|
1162
|
+
/** Optional structured metadata */
|
|
1163
|
+
metadata?: TEventLoggerData;
|
|
1164
|
+
/** Extensible fields for event-specific payloads */
|
|
1165
|
+
[key: string]: TEventExtensionValue | undefined;
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Execution-related event payload.
|
|
1169
|
+
*/
|
|
1170
|
+
interface IExecutionEventData extends IBaseEventData {}
|
|
1171
|
+
/**
|
|
1172
|
+
* Tool-related event payload.
|
|
1173
|
+
*/
|
|
1174
|
+
interface IToolEventData extends IBaseEventData {
|
|
1175
|
+
toolName?: string;
|
|
1176
|
+
parameters?: Record<string, TEventUniversalValue>;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Agent-related event payload.
|
|
1180
|
+
*/
|
|
1181
|
+
interface IAgentEventData extends IBaseEventData {
|
|
1182
|
+
agentId?: string;
|
|
1183
|
+
}
|
|
1184
|
+
type TEventListener = (eventType: string, data: IBaseEventData, context?: IEventContext) => void;
|
|
1185
|
+
/**
|
|
1186
|
+
* Minimal EventService contract for emitting events.
|
|
1187
|
+
*/
|
|
1188
|
+
interface IEventService {
|
|
1189
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1190
|
+
subscribe(listener: TEventListener): void;
|
|
1191
|
+
unsubscribe(listener: TEventListener): void;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Explicit owner binding information used for scoped event emission.
|
|
1195
|
+
*/
|
|
1196
|
+
interface IEventServiceOwnerBinding {
|
|
1197
|
+
ownerType: string;
|
|
1198
|
+
ownerId: string;
|
|
1199
|
+
ownerPath: IOwnerPathSegment[];
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/event-service/event-service.d.ts
|
|
1203
|
+
/**
|
|
1204
|
+
* Abstract base for event services.
|
|
1205
|
+
* Concrete implementations decide how events are delivered.
|
|
1206
|
+
*/
|
|
1207
|
+
declare abstract class AbstractEventService implements IEventService {
|
|
1208
|
+
private listeners;
|
|
1209
|
+
abstract emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1210
|
+
subscribe(listener: TEventListener): void;
|
|
1211
|
+
unsubscribe(listener: TEventListener): void;
|
|
1212
|
+
protected notifyListeners(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Default no-op event service (production-safe).
|
|
1216
|
+
* When injected, emit() intentionally does nothing.
|
|
1217
|
+
*/
|
|
1218
|
+
declare class DefaultEventService extends AbstractEventService {
|
|
1219
|
+
emit(_eventType: string, _data: IBaseEventData, _context?: IEventContext): void;
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Singleton default event service instance.
|
|
1223
|
+
*/
|
|
1224
|
+
declare const DEFAULT_ABSTRACT_EVENT_SERVICE: IEventService;
|
|
1225
|
+
/**
|
|
1226
|
+
* Check if a given service is the default no-op implementation.
|
|
1227
|
+
*/
|
|
1228
|
+
declare function isDefaultEventService(service: IEventService): boolean;
|
|
1229
|
+
/**
|
|
1230
|
+
* Compose a full event name from owner prefix and local name.
|
|
1231
|
+
* Local names must not contain dots.
|
|
1232
|
+
*/
|
|
1233
|
+
declare function composeEventName(ownerType: string, localName: string): string;
|
|
1234
|
+
/**
|
|
1235
|
+
* Generate a unique span ID for distributed tracing correlation. Exported so a per-operation timing
|
|
1236
|
+
* source (SELFHOST-004) can mint a span id it puts on BOTH the event payload and the event context.
|
|
1237
|
+
*/
|
|
1238
|
+
declare function generateSpanId(): string;
|
|
1239
|
+
/**
|
|
1240
|
+
* A scoped event service that always emits with an owner binding applied.
|
|
1241
|
+
*/
|
|
1242
|
+
declare class StructuredEventService extends AbstractEventService {
|
|
1243
|
+
private readonly base;
|
|
1244
|
+
private readonly binding;
|
|
1245
|
+
constructor(base: IEventService, binding: IEventServiceOwnerBinding);
|
|
1246
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1247
|
+
subscribe(listener: TEventListener): void;
|
|
1248
|
+
unsubscribe(listener: TEventListener): void;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Bind an EventService to an explicit owner path.
|
|
1252
|
+
* This is the standard entry point for scoped emission (path-only architecture).
|
|
1253
|
+
*/
|
|
1254
|
+
declare function bindWithOwnerPath(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
1255
|
+
/**
|
|
1256
|
+
* Alias for bindWithOwnerPath for historical call sites.
|
|
1257
|
+
* Intentionally forwards to the single authoritative implementation.
|
|
1258
|
+
*/
|
|
1259
|
+
declare function bindEventServiceOwner(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
1260
|
+
/**
|
|
1261
|
+
* Observable EventService that notifies subscribed listeners.
|
|
1262
|
+
*/
|
|
1263
|
+
declare class ObservableEventService extends AbstractEventService {
|
|
1264
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1265
|
+
}
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region src/event-service/task-events.d.ts
|
|
1268
|
+
declare const TASK_EVENTS: {
|
|
1269
|
+
readonly ASSIGNED: "assigned";
|
|
1270
|
+
readonly COMPLETED: "completed";
|
|
1258
1271
|
};
|
|
1272
|
+
declare const TASK_EVENT_PREFIX: "task";
|
|
1259
1273
|
//#endregion
|
|
1260
|
-
//#region src/
|
|
1274
|
+
//#region src/event-service/user-events.d.ts
|
|
1275
|
+
declare const USER_EVENTS: {
|
|
1276
|
+
readonly MESSAGE: "message";
|
|
1277
|
+
readonly INPUT: "input";
|
|
1278
|
+
};
|
|
1279
|
+
declare const USER_EVENT_PREFIX: "user";
|
|
1280
|
+
type TUserEvent = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
|
|
1281
|
+
//#endregion
|
|
1282
|
+
//#region src/event-service/span-events.d.ts
|
|
1261
1283
|
/**
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
1264
|
-
*
|
|
1265
|
-
* Split out of `agent.ts` when PEER-007 added `driverId`. That file sits at a frozen size baseline,
|
|
1266
|
-
* and the anti-monolith rule asks for a split rather than one more field on a file already at its
|
|
1267
|
-
* limit. The two execution-event types come along because `onExecutionEvent` is their only consumer
|
|
1268
|
-
* — leaving them behind would have made this module import back from `agent.ts`.
|
|
1284
|
+
* SELFHOST-004: per-operation span lifecycle event names. Mirrors the `TASK_EVENTS`/`USER_EVENTS`
|
|
1285
|
+
* pattern (a const name set + a prefix). The local name is distinctive (`span_completed`, not a bare
|
|
1286
|
+
* `completed`) so a consumer can identify a span-completion regardless of the emitting owner's prefix.
|
|
1269
1287
|
*/
|
|
1270
|
-
|
|
1271
|
-
|
|
1288
|
+
declare const SPAN_EVENTS: {
|
|
1289
|
+
readonly COMPLETED: "span_completed";
|
|
1290
|
+
};
|
|
1291
|
+
/** Content-free completion of one provider round, separate from legacy tool timing events. */
|
|
1292
|
+
declare const PROVIDER_CALL_EVENTS: {
|
|
1293
|
+
readonly COMPLETED: "provider_call_completed";
|
|
1294
|
+
};
|
|
1295
|
+
/** A provider request moved to another model after the one it was on failed. */
|
|
1296
|
+
declare const PROVIDER_FALLBACK_EVENTS: {
|
|
1297
|
+
readonly SWITCHED: "provider_fallback";
|
|
1298
|
+
};
|
|
1299
|
+
/** The notice a `provider_fallback` event carries, or `undefined` when the payload is malformed. */
|
|
1300
|
+
declare function readModelFallbackNotice(data: Readonly<Record<string, unknown>>): IModelFallbackNotice | undefined;
|
|
1301
|
+
/** Content-free completion of the body actually awaited by one permitted tool call. */
|
|
1302
|
+
declare const TOOL_BODY_EVENTS: {
|
|
1303
|
+
readonly COMPLETED: "tool_body_completed";
|
|
1304
|
+
};
|
|
1305
|
+
/** Content-free decision reached for one tool call before any body runs. */
|
|
1306
|
+
declare const TOOL_PERMISSION_EVENTS: {
|
|
1307
|
+
readonly DECIDED: "tool_permission_decided";
|
|
1308
|
+
};
|
|
1309
|
+
declare const SPAN_EVENT_PREFIX: "span";
|
|
1310
|
+
type TSpanEvent = (typeof SPAN_EVENTS)[keyof typeof SPAN_EVENTS];
|
|
1272
1311
|
/**
|
|
1273
|
-
*
|
|
1312
|
+
* SELFHOST-004: span-completion event payload — JOINS the span id with its measured duration and the
|
|
1313
|
+
* operation name (raw scalars ONLY; references no transport type). Emitted by the per-operation timing
|
|
1314
|
+
* source (e.g. `FunctionTool`) so a consuming layer (`agent-framework`) can build a record span entry
|
|
1315
|
+
* WITHOUT `agent-core` depending on `agent-interface-transport` (no cycle). The payload `spanId` is the
|
|
1316
|
+
* AUTHORITATIVE id a consumer reads; owner/turn correlation is applied by the event service's binding
|
|
1317
|
+
* (`ownerPath` on the emitted `IEventContext`). Note the context's own auto-minted `spanId` is a
|
|
1318
|
+
* separate scope tag and need not equal this payload id — always read the payload id for the span.
|
|
1274
1319
|
*/
|
|
1275
|
-
interface
|
|
1276
|
-
/**
|
|
1277
|
-
|
|
1278
|
-
/**
|
|
1279
|
-
|
|
1280
|
-
/**
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
/**
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
/**
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
* exists, and the final response is always parsed and validated core-side; a violation triggers
|
|
1360
|
-
* a bounded retry with the validation issues fed back as the next turn's input. Every attempt is
|
|
1361
|
-
* a real conversation turn (history stays append-only). Exhausted retries throw
|
|
1362
|
-
* `StructuredOutputError`.
|
|
1363
|
-
*/
|
|
1364
|
-
output?: TStructuredOutputSchema;
|
|
1365
|
-
/**
|
|
1366
|
-
* Retry budget for structured output validation failures — the number of additional attempts
|
|
1367
|
-
* after the first (default 2). Only meaningful with `output` set.
|
|
1368
|
-
*/
|
|
1369
|
-
outputRetries?: number;
|
|
1320
|
+
interface ISpanCompletionEventData extends IBaseEventData {
|
|
1321
|
+
/** The span id (equals the emitted event's context `spanId`). */
|
|
1322
|
+
spanId: string;
|
|
1323
|
+
/** Measured wall-clock duration of the operation, in milliseconds. */
|
|
1324
|
+
durationMs: number;
|
|
1325
|
+
/** The operation name (e.g. the tool name). */
|
|
1326
|
+
op: string;
|
|
1327
|
+
}
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region src/interfaces/interaction.d.ts
|
|
1330
|
+
/**
|
|
1331
|
+
* UI-agnostic "ask the user" contract (CMD-004).
|
|
1332
|
+
*
|
|
1333
|
+
* The SSOT for the interaction action lives in agent-core so every interaction *source* can reach it:
|
|
1334
|
+
* command execution (`ICommandHostContext`, agent-framework) AND tool execution
|
|
1335
|
+
* (`IToolExecutionContext`, agent-core, for model-issued questions — CMD-005). These are pure types
|
|
1336
|
+
* with no runtime dependency, so the contract crosses a serialization/transport boundary unchanged
|
|
1337
|
+
* (no function-valued fields).
|
|
1338
|
+
*
|
|
1339
|
+
* A single shape covers every interaction kind, parameterised by fields rather than split into
|
|
1340
|
+
* variants:
|
|
1341
|
+
* - confirm → two options, `maxSelect` 1
|
|
1342
|
+
* - single → options, `maxSelect` 1
|
|
1343
|
+
* - multi → options, `maxSelect` > 1
|
|
1344
|
+
* - free text → no options, `allowFreeText` true
|
|
1345
|
+
* - secret → free text with `masked` true
|
|
1346
|
+
*/
|
|
1347
|
+
/** One predefined option the user can choose. */
|
|
1348
|
+
interface IActionOption {
|
|
1349
|
+
value: string;
|
|
1350
|
+
label: string;
|
|
1351
|
+
description?: string;
|
|
1352
|
+
}
|
|
1353
|
+
/** Pre-selected option values and/or prefilled free text for an action request. */
|
|
1354
|
+
interface IActionDefault {
|
|
1355
|
+
values?: readonly string[];
|
|
1356
|
+
text?: string;
|
|
1357
|
+
}
|
|
1358
|
+
/** One request for the user to answer. See the module doc for how the fields encode each kind. */
|
|
1359
|
+
interface IActionRequest {
|
|
1360
|
+
/** Correlation key; the ask port resolves a given id exactly once (idempotent, first-answer wins). */
|
|
1361
|
+
id: string;
|
|
1362
|
+
title: string;
|
|
1363
|
+
description?: string;
|
|
1364
|
+
/** Predefined options. Empty/omitted ⇒ pure free-text entry. */
|
|
1365
|
+
options?: readonly IActionOption[];
|
|
1366
|
+
/** Minimum selections required (default 1). */
|
|
1367
|
+
minSelect?: number;
|
|
1368
|
+
/** Maximum selections allowed (default 1 ⇒ single; > 1 ⇒ multi). */
|
|
1369
|
+
maxSelect?: number;
|
|
1370
|
+
/** Allow a typed custom answer in addition to / instead of the options. */
|
|
1371
|
+
allowFreeText?: boolean;
|
|
1372
|
+
/** Free-text entry is masked (secret entry such as an API key); the renderer hides input. */
|
|
1373
|
+
masked?: boolean;
|
|
1374
|
+
/** Allow submitting empty free text. */
|
|
1375
|
+
allowEmpty?: boolean;
|
|
1376
|
+
/** Placeholder shown in the free-text field. */
|
|
1377
|
+
placeholder?: string;
|
|
1378
|
+
/** Maximum options shown before scrolling (renderer hint). */
|
|
1379
|
+
maxVisible?: number;
|
|
1380
|
+
/** Pre-selected option values and/or prefilled free text. */
|
|
1381
|
+
default?: IActionDefault;
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* The user's answer to an {@link IActionRequest}. `answer` carries the selected option values and/or
|
|
1385
|
+
* the typed text; `cancelled` means the user dismissed the request, or no interactive renderer was
|
|
1386
|
+
* available to answer it.
|
|
1387
|
+
*/
|
|
1388
|
+
type TActionResponse = {
|
|
1389
|
+
type: 'answer';
|
|
1390
|
+
values: readonly string[];
|
|
1391
|
+
text?: string;
|
|
1392
|
+
} | {
|
|
1393
|
+
type: 'cancelled';
|
|
1394
|
+
};
|
|
1395
|
+
/**
|
|
1396
|
+
* The injected "ask the user" port — a single seam reachable by every interaction source (command
|
|
1397
|
+
* execution now; tool execution for model-issued questions later) and rendered per-environment by each
|
|
1398
|
+
* transport. The concurrency model (broadcast to attached interactive channels, first answer wins,
|
|
1399
|
+
* later answers for an already-resolved `id` ignored) is owned by the port implementation, not the
|
|
1400
|
+
* contract.
|
|
1401
|
+
*/
|
|
1402
|
+
interface IUserInteraction {
|
|
1403
|
+
ask(request: IActionRequest): Promise<TActionResponse>;
|
|
1370
1404
|
}
|
|
1371
1405
|
//#endregion
|
|
1372
1406
|
//#region src/interfaces/tool-search.d.ts
|
|
@@ -1404,654 +1438,888 @@ interface IDeferredToolCatalog {
|
|
|
1404
1438
|
loadDeferredTools(names: readonly string[]): IToolSchema[];
|
|
1405
1439
|
}
|
|
1406
1440
|
//#endregion
|
|
1407
|
-
//#region src/
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
readonly ERROR: "execution.error";
|
|
1412
|
-
};
|
|
1413
|
-
declare const TOOL_EVENT_NAMES: {
|
|
1414
|
-
readonly CALL_START: "tool.call_start";
|
|
1415
|
-
readonly CALL_COMPLETE: "tool.call_complete";
|
|
1416
|
-
readonly CALL_ERROR: "tool.call_error";
|
|
1417
|
-
};
|
|
1418
|
-
declare const AGENT_EVENT_NAMES: {
|
|
1419
|
-
readonly EXECUTION_START: "agent.execution_start";
|
|
1420
|
-
readonly EXECUTION_COMPLETE: "agent.execution_complete";
|
|
1421
|
-
readonly EXECUTION_ERROR: "agent.execution_error";
|
|
1422
|
-
readonly CREATED: "agent.created";
|
|
1423
|
-
};
|
|
1424
|
-
type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
|
|
1425
|
-
type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
|
|
1426
|
-
type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
|
|
1427
|
-
/**
|
|
1428
|
-
* Event types that can be emitted.
|
|
1429
|
-
*
|
|
1430
|
-
* IMPORTANT:
|
|
1431
|
-
* - Do not use string literals for event names outside this module.
|
|
1432
|
-
* - Import and use EVENT_EMITTER_EVENTS instead.
|
|
1433
|
-
*/
|
|
1434
|
-
declare const EVENT_EMITTER_EVENTS: {
|
|
1435
|
-
readonly EXECUTION_START: "execution.start";
|
|
1436
|
-
readonly EXECUTION_COMPLETE: "execution.complete";
|
|
1437
|
-
readonly EXECUTION_ERROR: "execution.error";
|
|
1438
|
-
readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
|
|
1439
|
-
readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
|
|
1440
|
-
readonly TOOL_SUCCESS: "tool.success";
|
|
1441
|
-
readonly TOOL_ERROR: "tool.call_error";
|
|
1442
|
-
readonly CONVERSATION_START: "conversation.start";
|
|
1443
|
-
readonly CONVERSATION_COMPLETE: "conversation.complete";
|
|
1444
|
-
readonly CONVERSATION_ERROR: "conversation.error";
|
|
1445
|
-
readonly AGENT_EXECUTION_START: "agent.execution_start";
|
|
1446
|
-
readonly AGENT_EXECUTION_COMPLETE: "agent.execution_complete";
|
|
1447
|
-
readonly AGENT_EXECUTION_ERROR: "agent.execution_error";
|
|
1448
|
-
readonly AGENT_CREATED: "agent.created";
|
|
1449
|
-
readonly AGENT_DESTROYED: "agent.destroyed";
|
|
1450
|
-
readonly PLUGIN_LOADED: "plugin.loaded";
|
|
1451
|
-
readonly PLUGIN_UNLOADED: "plugin.unloaded";
|
|
1452
|
-
readonly PLUGIN_ERROR: "plugin.error";
|
|
1453
|
-
readonly ERROR_OCCURRED: "error.occurred";
|
|
1454
|
-
readonly WARNING_OCCURRED: "warning.occurred";
|
|
1455
|
-
readonly MODULE_INITIALIZE_START: "module.initialize.start";
|
|
1456
|
-
readonly MODULE_INITIALIZE_COMPLETE: "module.initialize.complete";
|
|
1457
|
-
readonly MODULE_INITIALIZE_ERROR: "module.initialize.error";
|
|
1458
|
-
readonly MODULE_EXECUTION_START: "module.execution.start";
|
|
1459
|
-
readonly MODULE_EXECUTION_COMPLETE: "module.execution.complete";
|
|
1460
|
-
readonly MODULE_EXECUTION_ERROR: "module.execution.error";
|
|
1461
|
-
readonly MODULE_DISPOSE_START: "module.dispose.start";
|
|
1462
|
-
readonly MODULE_DISPOSE_COMPLETE: "module.dispose.complete";
|
|
1463
|
-
readonly MODULE_DISPOSE_ERROR: "module.dispose.error";
|
|
1464
|
-
readonly MODULE_REGISTERED: "module.registered";
|
|
1465
|
-
readonly MODULE_UNREGISTERED: "module.unregistered";
|
|
1466
|
-
readonly EXECUTION_HIERARCHY: "execution.hierarchy";
|
|
1467
|
-
readonly EXECUTION_REALTIME: "execution.realtime";
|
|
1468
|
-
readonly TOOL_REALTIME: "tool.realtime";
|
|
1469
|
-
readonly CUSTOM: "custom";
|
|
1470
|
-
};
|
|
1471
|
-
type TEventName = TExecutionEventName | TToolEventName | TAgentEventName | 'tool.beforeExecute' | 'tool.afterExecute' | 'tool.success' | 'conversation.start' | 'conversation.complete' | 'conversation.error' | 'agent.destroyed' | 'plugin.loaded' | 'plugin.unloaded' | 'plugin.error' | 'error.occurred' | 'warning.occurred' | 'module.initialize.start' | 'module.initialize.complete' | 'module.initialize.error' | 'module.execution.start' | 'module.execution.complete' | 'module.execution.error' | 'module.dispose.start' | 'module.dispose.complete' | 'module.dispose.error' | 'module.registered' | 'module.unregistered' | 'execution.hierarchy' | 'execution.realtime' | 'tool.realtime' | 'custom';
|
|
1472
|
-
/**
|
|
1473
|
-
* Valid event data value types
|
|
1474
|
-
*/
|
|
1475
|
-
type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
|
|
1476
|
-
[key: string]: TEventDataValue;
|
|
1477
|
-
};
|
|
1478
|
-
/**
|
|
1479
|
-
* Event data structure
|
|
1480
|
-
*/
|
|
1481
|
-
interface IEventEmitterEventData {
|
|
1482
|
-
type: TEventName;
|
|
1483
|
-
timestamp: Date;
|
|
1484
|
-
executionId?: string;
|
|
1485
|
-
sessionId?: string;
|
|
1486
|
-
userId?: string;
|
|
1487
|
-
data?: Record<string, TEventDataValue>;
|
|
1488
|
-
error?: Error;
|
|
1489
|
-
metadata?: Record<string, TEventDataValue>;
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Event listener function
|
|
1493
|
-
*/
|
|
1494
|
-
type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
|
|
1441
|
+
//#region src/interfaces/tool.d.ts
|
|
1442
|
+
/** Awaited host admission for effective parameters, immediately before a tool body. */
|
|
1443
|
+
type TToolEffectAdmission<TParameters = TToolParameters> = (parameters: TParameters) => Promise<void>;
|
|
1444
|
+
type TToolContextExtensionValue = TUniversalValue | Date | Error | TLoggerData | TContextData | TToolParameters | TToolMetadata;
|
|
1495
1445
|
/**
|
|
1496
|
-
*
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
*/
|
|
1500
|
-
interface IEventEmitterPlugin {
|
|
1501
|
-
on(eventType: TEventName, listener: TEventEmitterListener, options?: {
|
|
1502
|
-
once?: boolean;
|
|
1503
|
-
filter?: (event: IEventEmitterEventData) => boolean;
|
|
1504
|
-
}): string;
|
|
1505
|
-
once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
|
|
1506
|
-
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
1507
|
-
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
1508
|
-
}
|
|
1509
|
-
//#endregion
|
|
1510
|
-
//#region src/abstracts/abstract-module-types.d.ts
|
|
1511
|
-
/** Module execution context */
|
|
1512
|
-
interface IModuleExecutionContext {
|
|
1513
|
-
executionId?: string;
|
|
1514
|
-
sessionId?: string;
|
|
1515
|
-
userId?: string;
|
|
1516
|
-
agentName?: string;
|
|
1517
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
1518
|
-
[key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
|
|
1519
|
-
}
|
|
1520
|
-
/** Module execution result */
|
|
1521
|
-
interface IModuleExecutionResult {
|
|
1522
|
-
success: boolean;
|
|
1523
|
-
data?: IModuleResultData;
|
|
1524
|
-
error?: Error;
|
|
1525
|
-
duration?: number;
|
|
1526
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
1527
|
-
}
|
|
1528
|
-
/** Module result data */
|
|
1529
|
-
interface IModuleResultData {
|
|
1530
|
-
[key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
|
|
1531
|
-
}
|
|
1532
|
-
/** Base module options */
|
|
1533
|
-
interface IBaseModuleOptions {
|
|
1534
|
-
enabled?: boolean;
|
|
1535
|
-
config?: Record<string, string | number | boolean>;
|
|
1536
|
-
}
|
|
1537
|
-
/** Module capabilities */
|
|
1538
|
-
interface IModuleCapabilities {
|
|
1539
|
-
capabilities: string[];
|
|
1540
|
-
dependencies?: string[];
|
|
1541
|
-
optionalDependencies?: string[];
|
|
1542
|
-
}
|
|
1543
|
-
/** Module type descriptor */
|
|
1544
|
-
interface IModuleDescriptor {
|
|
1545
|
-
type: string;
|
|
1546
|
-
category: ModuleCategory;
|
|
1547
|
-
layer: ModuleLayer;
|
|
1548
|
-
dependencies?: string[];
|
|
1549
|
-
capabilities?: string[];
|
|
1550
|
-
}
|
|
1551
|
-
/** Module categories */
|
|
1552
|
-
declare enum ModuleCategory {
|
|
1553
|
-
CORE = "core",
|
|
1554
|
-
STORAGE = "storage",
|
|
1555
|
-
PROCESSING = "processing",
|
|
1556
|
-
INTEGRATION = "integration",
|
|
1557
|
-
INTERFACE = "interface",
|
|
1558
|
-
CAPABILITY = "capability"
|
|
1559
|
-
}
|
|
1560
|
-
/** Module layers */
|
|
1561
|
-
declare enum ModuleLayer {
|
|
1562
|
-
INFRASTRUCTURE = "infrastructure",
|
|
1563
|
-
CORE = "core",
|
|
1564
|
-
APPLICATION = "application",
|
|
1565
|
-
DOMAIN = "domain",
|
|
1566
|
-
PRESENTATION = "presentation"
|
|
1567
|
-
}
|
|
1568
|
-
/** Module data for introspection */
|
|
1569
|
-
interface IModuleData {
|
|
1570
|
-
name: string;
|
|
1571
|
-
version: string;
|
|
1572
|
-
type: string;
|
|
1573
|
-
enabled: boolean;
|
|
1574
|
-
initialized: boolean;
|
|
1575
|
-
capabilities: IModuleCapabilities;
|
|
1576
|
-
metadata?: Record<string, string | number | boolean>;
|
|
1577
|
-
}
|
|
1578
|
-
/** Module statistics */
|
|
1579
|
-
interface IModuleStats {
|
|
1580
|
-
enabled: boolean;
|
|
1581
|
-
initialized: boolean;
|
|
1582
|
-
executionCount: number;
|
|
1583
|
-
errorCount: number;
|
|
1584
|
-
lastActivity?: Date;
|
|
1585
|
-
averageExecutionTime?: number;
|
|
1586
|
-
[key: string]: string | number | boolean | Date | undefined;
|
|
1587
|
-
}
|
|
1588
|
-
/** Type-safe module interface */
|
|
1589
|
-
interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
|
|
1590
|
-
name: string;
|
|
1591
|
-
version: string;
|
|
1592
|
-
enabled: boolean;
|
|
1593
|
-
initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
|
|
1594
|
-
dispose?(): Promise<void>;
|
|
1595
|
-
execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
|
|
1596
|
-
getModuleType(): IModuleDescriptor;
|
|
1597
|
-
getCapabilities(): IModuleCapabilities;
|
|
1598
|
-
getData?(): IModuleData;
|
|
1599
|
-
getStats?(): TStats;
|
|
1600
|
-
isEnabled(): boolean;
|
|
1601
|
-
isInitialized(): boolean;
|
|
1602
|
-
}
|
|
1603
|
-
//#endregion
|
|
1604
|
-
//#region src/event-service/interfaces.d.ts
|
|
1446
|
+
* Tool metadata structure - specific type definition
|
|
1447
|
+
*/
|
|
1448
|
+
type TToolMetadata = Record<string, string | number | boolean | string[] | number[] | boolean[] | TToolParameters>;
|
|
1605
1449
|
/**
|
|
1606
|
-
*
|
|
1450
|
+
* Tool execution data - domain payload for tool results.
|
|
1607
1451
|
*
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1452
|
+
* IMPORTANT:
|
|
1453
|
+
* - This must support structured tool outputs without resorting to `any`.
|
|
1454
|
+
* - Prefer `ToolResultData` (derived from the canonical `UniversalValue` axis).
|
|
1610
1455
|
*/
|
|
1611
1456
|
/**
|
|
1612
|
-
*
|
|
1457
|
+
* Tool execution result - extended for ToolExecutionData compatibility
|
|
1613
1458
|
*/
|
|
1614
|
-
|
|
1459
|
+
interface IToolResult {
|
|
1460
|
+
success: boolean;
|
|
1461
|
+
data?: TUniversalValue;
|
|
1462
|
+
error?: string;
|
|
1463
|
+
metadata?: TToolMetadata;
|
|
1464
|
+
[key: string]: TToolContextExtensionValue | undefined;
|
|
1465
|
+
}
|
|
1615
1466
|
/**
|
|
1616
|
-
*
|
|
1467
|
+
* Enhanced tool execution result with additional metadata
|
|
1617
1468
|
*/
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1469
|
+
interface IToolExecutionResult {
|
|
1470
|
+
/** Whether execution was successful */
|
|
1471
|
+
success: boolean;
|
|
1472
|
+
/** Tool name that was executed */
|
|
1473
|
+
toolName?: string;
|
|
1474
|
+
/** Execution result or data */
|
|
1475
|
+
result?: TUniversalValue;
|
|
1476
|
+
/** Error message if execution failed */
|
|
1477
|
+
error?: string;
|
|
1478
|
+
/** Execution duration in milliseconds */
|
|
1479
|
+
duration?: number;
|
|
1480
|
+
/** Unique execution ID */
|
|
1481
|
+
executionId?: string;
|
|
1482
|
+
/** Additional metadata */
|
|
1483
|
+
metadata?: TToolMetadata;
|
|
1621
1484
|
}
|
|
1622
1485
|
/**
|
|
1623
|
-
*
|
|
1486
|
+
* Tool execution context - type-safe context for tool execution
|
|
1487
|
+
* Enhanced with hierarchical execution tracking support
|
|
1624
1488
|
*/
|
|
1625
|
-
|
|
1489
|
+
interface IToolExecutionContext {
|
|
1490
|
+
toolName: string;
|
|
1491
|
+
parameters: TToolParameters;
|
|
1492
|
+
/** Runtime-owned barrier, consumed after permission and before entering the tool. */
|
|
1493
|
+
beforeToolEffect?: TToolEffectAdmission;
|
|
1494
|
+
/** Journaled pre-effect request/response port for admission-aware runtime wrappers. */
|
|
1495
|
+
continuation?: IToolContinuation;
|
|
1496
|
+
/**
|
|
1497
|
+
* Run-scoped cancellation signal (CORE-018). Long-running tools MUST honor it: terminate
|
|
1498
|
+
* the underlying work (kill the child process, abort the network request) and return an
|
|
1499
|
+
* interrupted/failed result. Completing silently after an abort is a contract violation.
|
|
1500
|
+
*/
|
|
1501
|
+
signal?: AbortSignal;
|
|
1502
|
+
/** Direct remote calls deny decisions that would require human interaction. */
|
|
1503
|
+
permissionInteraction?: 'interactive' | 'deny';
|
|
1504
|
+
executionId?: string;
|
|
1505
|
+
userId?: string;
|
|
1506
|
+
sessionId?: string;
|
|
1507
|
+
metadata?: TToolMetadata;
|
|
1508
|
+
/** Parent execution ID for hierarchical tool execution tracking */
|
|
1509
|
+
parentExecutionId?: string;
|
|
1510
|
+
/** Root execution ID (Team/Agent level) for complete execution tree tracking */
|
|
1511
|
+
rootExecutionId?: string;
|
|
1512
|
+
/** Execution depth level (0: Team, 1: Agent, 2: Tool, etc.) */
|
|
1513
|
+
executionLevel?: number;
|
|
1514
|
+
/** Execution path array showing the complete execution hierarchy */
|
|
1515
|
+
executionPath?: string[];
|
|
1516
|
+
/** Real-time execution data for accurate tracking (no simulation) */
|
|
1517
|
+
realTimeData?: {
|
|
1518
|
+
/** Actual execution start time */
|
|
1519
|
+
startTime: Date;
|
|
1520
|
+
/** Actual input parameters passed to the tool */
|
|
1521
|
+
actualParameters: TToolParameters;
|
|
1522
|
+
/** Tool-provided estimated duration (optional) */
|
|
1523
|
+
estimatedDuration?: number;
|
|
1524
|
+
};
|
|
1525
|
+
/**
|
|
1526
|
+
* Additional tool execution context extensions.
|
|
1527
|
+
*
|
|
1528
|
+
* IMPORTANT:
|
|
1529
|
+
* - Avoid ad-hoc top-level fields to keep the contract stable.
|
|
1530
|
+
* - Use this map for forward-compatible extra data with constrained value types.
|
|
1531
|
+
*/
|
|
1532
|
+
extensions?: Record<string, TToolContextExtensionValue>;
|
|
1533
|
+
/** Owner context propagated from EventService */
|
|
1534
|
+
ownerType?: string;
|
|
1535
|
+
ownerId?: string;
|
|
1536
|
+
ownerPath?: IOwnerPathSegment[];
|
|
1537
|
+
sourceId?: string;
|
|
1538
|
+
/**
|
|
1539
|
+
* Tool-call scoped EventService instance.
|
|
1540
|
+
* Caller (ExecutionService/ToolExecutionService) is responsible for providing
|
|
1541
|
+
* an ownerPath-bound EventService for this tool call.
|
|
1542
|
+
*/
|
|
1543
|
+
eventService?: IEventService;
|
|
1544
|
+
/**
|
|
1545
|
+
* Unbound base EventService instance.
|
|
1546
|
+
*
|
|
1547
|
+
* Required when a tool needs to create another owner-bound EventService
|
|
1548
|
+
* for a different owner (e.g., creating an agent from a tool call).
|
|
1549
|
+
*
|
|
1550
|
+
* NOTE: Do not wrap an already owner-bound EventService to bind a different owner.
|
|
1551
|
+
* Owner-bound instances must not be layered across different owners.
|
|
1552
|
+
*/
|
|
1553
|
+
baseEventService?: IEventService;
|
|
1554
|
+
/**
|
|
1555
|
+
* The service this call's caller would give the tool with `setEventService`, carried with the
|
|
1556
|
+
* call instead. One tool instance can serve several agents, and the service set on it is
|
|
1557
|
+
* whichever agent set one last; a tool that emits events of its own (the `FunctionTool` span)
|
|
1558
|
+
* emits them here when present, so they reach the agent that made the call. The no-op default
|
|
1559
|
+
* service means that caller wants none.
|
|
1560
|
+
*/
|
|
1561
|
+
instanceEventService?: IEventService;
|
|
1562
|
+
/**
|
|
1563
|
+
* Injected "ask the user" port (CMD-004). Present when an interactive renderer is attached, letting
|
|
1564
|
+
* a tool solicit a structured answer from the user (the model-issued question seam consumed by
|
|
1565
|
+
* CMD-005). Absent in non-interactive contexts; a tool that asks must treat absence as "no human
|
|
1566
|
+
* available" (never a silent guess).
|
|
1567
|
+
*/
|
|
1568
|
+
ask?: IUserInteraction['ask'];
|
|
1569
|
+
/**
|
|
1570
|
+
* CLI-1990: the deferred-tool catalog the runtime injects (`ToolExecutionService`), so a search
|
|
1571
|
+
* tool can list what is withheld and load it for the rest of the session. Present on every tool
|
|
1572
|
+
* call the execution loop issues; a tool other than the search tool has no reason to read it.
|
|
1573
|
+
*/
|
|
1574
|
+
deferredTools?: IDeferredToolCatalog;
|
|
1575
|
+
/**
|
|
1576
|
+
* The ID core mints for this one tool body, unique even when a vendor reuses its tool call ID.
|
|
1577
|
+
* The body's exported span is derived from it, so it is also what a propagated parent names.
|
|
1578
|
+
*/
|
|
1579
|
+
toolBodyId?: string;
|
|
1580
|
+
/**
|
|
1581
|
+
* Present only when the run carries trusted trace context: the `traceparent` naming this body's
|
|
1582
|
+
* span and the exact origins it may be sent to. A tool that makes outbound requests sends it only
|
|
1583
|
+
* to a listed origin.
|
|
1584
|
+
*/
|
|
1585
|
+
outboundTraceContext?: IOutboundTraceContext;
|
|
1586
|
+
/**
|
|
1587
|
+
* Present only when the host lets shell children inherit the trace: the environment naming this
|
|
1588
|
+
* body's span. Only the foreground shell tool applies it, to its own child.
|
|
1589
|
+
*/
|
|
1590
|
+
shellTraceEnv?: ISubprocessTraceEnv;
|
|
1591
|
+
/**
|
|
1592
|
+
* Present only when the host lets command hooks inherit the trace: the environment naming the
|
|
1593
|
+
* prompt root, for the hooks fired around this body. Separate from {@link shellTraceEnv}, whose
|
|
1594
|
+
* span is the body's own.
|
|
1595
|
+
*/
|
|
1596
|
+
hookTraceEnv?: ISubprocessTraceEnv;
|
|
1597
|
+
}
|
|
1626
1598
|
/**
|
|
1627
|
-
*
|
|
1628
|
-
*
|
|
1629
|
-
* Path-only rule:
|
|
1630
|
-
* - Relationships must be derived from these explicit segments, not from parsing IDs.
|
|
1599
|
+
* Parameter validation result
|
|
1631
1600
|
*/
|
|
1632
|
-
interface
|
|
1633
|
-
|
|
1634
|
-
|
|
1601
|
+
interface IParameterValidationResult {
|
|
1602
|
+
/** Whether parameters are valid */
|
|
1603
|
+
isValid: boolean;
|
|
1604
|
+
/** Validation error messages */
|
|
1605
|
+
errors: string[];
|
|
1635
1606
|
}
|
|
1636
1607
|
/**
|
|
1637
|
-
*
|
|
1638
|
-
* This is the single source of truth for deterministic linking in subscribers.
|
|
1608
|
+
* Generic tool executor function
|
|
1639
1609
|
*/
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1610
|
+
type TToolExecutor<TParams = TToolParameters, TResult = TUniversalValue> = (parameters: TParams, context?: IToolExecutionContext) => Promise<TResult>;
|
|
1611
|
+
/**
|
|
1612
|
+
* Base tool interface
|
|
1613
|
+
*/
|
|
1614
|
+
interface ITool {
|
|
1615
|
+
/** Tool schema */
|
|
1616
|
+
schema: IToolSchema;
|
|
1617
|
+
/**
|
|
1618
|
+
* Execute the tool with given parameters
|
|
1619
|
+
*/
|
|
1620
|
+
execute(parameters: TToolParameters, context?: IToolExecutionContext): Promise<IToolResult>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Validate tool parameters
|
|
1623
|
+
*/
|
|
1624
|
+
validate(parameters: TToolParameters): boolean;
|
|
1625
|
+
/**
|
|
1626
|
+
* Validate tool parameters with detailed result
|
|
1627
|
+
*/
|
|
1628
|
+
validateParameters(parameters: TToolParameters): IParameterValidationResult;
|
|
1629
|
+
/**
|
|
1630
|
+
* Get tool description
|
|
1631
|
+
*/
|
|
1632
|
+
getDescription(): string;
|
|
1650
1633
|
}
|
|
1651
1634
|
/**
|
|
1652
|
-
*
|
|
1635
|
+
* Function tool implementation
|
|
1653
1636
|
*/
|
|
1654
|
-
|
|
1637
|
+
interface IFunctionTool extends ITool {
|
|
1638
|
+
/** Function to execute */
|
|
1639
|
+
fn: TToolExecutor;
|
|
1640
|
+
}
|
|
1655
1641
|
/**
|
|
1656
|
-
*
|
|
1657
|
-
* Emitters may add additional fields, but MUST keep linkage information explicit.
|
|
1642
|
+
* Tool registry interface
|
|
1658
1643
|
*/
|
|
1659
|
-
interface
|
|
1660
|
-
/**
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
/**
|
|
1665
|
-
|
|
1644
|
+
interface IToolRegistry {
|
|
1645
|
+
/**
|
|
1646
|
+
* Register a tool
|
|
1647
|
+
*/
|
|
1648
|
+
register(tool: ITool): void;
|
|
1649
|
+
/**
|
|
1650
|
+
* Unregister a tool
|
|
1651
|
+
*/
|
|
1652
|
+
unregister(name: string): void;
|
|
1653
|
+
/**
|
|
1654
|
+
* Get tool by name
|
|
1655
|
+
*/
|
|
1656
|
+
get(name: string): ITool | undefined;
|
|
1657
|
+
/**
|
|
1658
|
+
* Get all registered tools
|
|
1659
|
+
*/
|
|
1660
|
+
getAll(): ITool[];
|
|
1661
|
+
/**
|
|
1662
|
+
* Get tool schemas
|
|
1663
|
+
*/
|
|
1664
|
+
getSchemas(): IToolSchema[];
|
|
1665
|
+
/**
|
|
1666
|
+
* Check if tool exists
|
|
1667
|
+
*/
|
|
1668
|
+
has(name: string): boolean;
|
|
1669
|
+
/**
|
|
1670
|
+
* Clear all tools
|
|
1671
|
+
*/
|
|
1672
|
+
clear(): void;
|
|
1673
|
+
}
|
|
1674
|
+
//#endregion
|
|
1675
|
+
//#region src/interfaces/execution-journal.d.ts
|
|
1676
|
+
/** Data-only provider options; callbacks, signals, tracing and adapter credentials are excluded. */
|
|
1677
|
+
type TJournalModelOptions = Pick<IChatOptions, 'model' | 'tools' | 'maxTokens' | 'temperature' | 'effort' | 'toolChoice' | 'nativeWebTools' | 'responseFormat'>;
|
|
1678
|
+
interface IJournalIdentity {
|
|
1679
|
+
recordId: string;
|
|
1680
|
+
executionId: string;
|
|
1681
|
+
}
|
|
1682
|
+
interface IJournalModelIdentity {
|
|
1683
|
+
callId: string;
|
|
1684
|
+
providerId: string;
|
|
1685
|
+
modelId: string;
|
|
1686
|
+
}
|
|
1687
|
+
interface IJournalActionIdentity {
|
|
1688
|
+
actionId: string;
|
|
1689
|
+
parentCallId: string;
|
|
1690
|
+
toolCallId: string;
|
|
1691
|
+
toolName: string;
|
|
1692
|
+
}
|
|
1693
|
+
interface IExecutionContinuationState {
|
|
1694
|
+
version: 1;
|
|
1695
|
+
kind: 'round' | 'summary';
|
|
1696
|
+
startedAt: string;
|
|
1697
|
+
turnMessageId: string;
|
|
1698
|
+
model: Pick<IChatOptions, 'maxTokens' | 'temperature' | 'effort' | 'toolChoice'> & {
|
|
1699
|
+
provider: string;
|
|
1700
|
+
model: string;
|
|
1701
|
+
topP?: number;
|
|
1702
|
+
};
|
|
1703
|
+
timeout?: number;
|
|
1704
|
+
toolSearch?: TToolSearchSetting;
|
|
1705
|
+
structuredOutput: boolean;
|
|
1706
|
+
/** Versioned data contract; runtime callbacks and signals are supplied by the recovering host. */
|
|
1707
|
+
options: Pick<IChatOptions, 'maxTokens' | 'temperature' | 'toolChoice'> & {
|
|
1708
|
+
maxExecutionRounds: number;
|
|
1709
|
+
maxSameToolInputs?: number;
|
|
1710
|
+
allowToolOnlyCompletion: boolean;
|
|
1711
|
+
withholdHostedTools: boolean;
|
|
1712
|
+
ephemeralSystemContext?: string;
|
|
1713
|
+
sessionId?: string;
|
|
1714
|
+
userId?: string;
|
|
1715
|
+
metadata?: TMetadata;
|
|
1716
|
+
};
|
|
1717
|
+
toolsExecuted: string[];
|
|
1718
|
+
consecutiveUnknownToolFailureRounds: number;
|
|
1719
|
+
forcedSummaryInstruction?: string;
|
|
1720
|
+
loadedDeferredTools?: string[];
|
|
1721
|
+
}
|
|
1722
|
+
/** Canonical private history, separate from transformed/ephemeral provider input. */
|
|
1723
|
+
interface IExecutionRoundCheckpoint {
|
|
1724
|
+
version: 1;
|
|
1725
|
+
effectAdmission: 'required';
|
|
1726
|
+
messages: TUniversalMessage[];
|
|
1727
|
+
round: number;
|
|
1728
|
+
contextLimit: number;
|
|
1729
|
+
cumulativeInputTokens: number;
|
|
1730
|
+
sameToolInputCounts: Array<[string, number]>;
|
|
1731
|
+
maxSameToolInputs?: number;
|
|
1732
|
+
continuation?: IExecutionContinuationState;
|
|
1733
|
+
/** Versioned state belonging to a runtime wrapper, never inferred from transcript text. */
|
|
1734
|
+
owner?: {
|
|
1735
|
+
kind: string;
|
|
1736
|
+
version: number;
|
|
1737
|
+
state: TToolParameters;
|
|
1738
|
+
};
|
|
1666
1739
|
}
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1740
|
+
type TExecutionJournalRecord = IJournalIdentity & ((IJournalModelIdentity & {
|
|
1741
|
+
kind: 'model-request';
|
|
1742
|
+
messages: TUniversalMessage[];
|
|
1743
|
+
options: TJournalModelOptions;
|
|
1744
|
+
checkpoint?: IExecutionRoundCheckpoint;
|
|
1745
|
+
}) | (IJournalModelIdentity & {
|
|
1746
|
+
kind: 'model-response';
|
|
1747
|
+
response: TUniversalMessage;
|
|
1748
|
+
}) | (IJournalModelIdentity & {
|
|
1749
|
+
kind: 'model-cache-hit';
|
|
1750
|
+
response: TUniversalMessage;
|
|
1751
|
+
checkpoint?: IExecutionRoundCheckpoint;
|
|
1752
|
+
}) | (IJournalModelIdentity & {
|
|
1753
|
+
kind: 'model-failure';
|
|
1754
|
+
error: {
|
|
1755
|
+
name: string;
|
|
1756
|
+
message: string;
|
|
1757
|
+
};
|
|
1758
|
+
}) | (IJournalActionIdentity & {
|
|
1759
|
+
kind: 'tool-intent';
|
|
1760
|
+
parameters: TToolParameters;
|
|
1761
|
+
}) | (IJournalActionIdentity & {
|
|
1762
|
+
kind: 'tool-dispatch';
|
|
1763
|
+
}) | (IJournalActionIdentity & {
|
|
1764
|
+
kind: 'tool-effect-start';
|
|
1765
|
+
parameters: TToolParameters;
|
|
1766
|
+
}) | (IJournalActionIdentity & {
|
|
1767
|
+
kind: 'tool-wait';
|
|
1768
|
+
request: IToolContinuationPrompt & {
|
|
1769
|
+
requestId: string;
|
|
1770
|
+
};
|
|
1771
|
+
}) | (IJournalActionIdentity & {
|
|
1772
|
+
kind: 'tool-response';
|
|
1773
|
+
response: IToolWaitResponse;
|
|
1774
|
+
}) | (IJournalActionIdentity & {
|
|
1775
|
+
kind: 'tool-result';
|
|
1776
|
+
result: IToolExecutionResult;
|
|
1777
|
+
loadedDeferredTools?: string[];
|
|
1778
|
+
}));
|
|
1779
|
+
/**
|
|
1780
|
+
* Awaited, fail-closed execution boundary. Rejection stops this run before further dispatch.
|
|
1781
|
+
* The host owns storage, serialization of message dates, idempotency and recovery decisions.
|
|
1782
|
+
* Model records describe an adapter invocation, not its opaque retries or network requests.
|
|
1783
|
+
* Only a supported mandatory-effect checkpoint can prove an unstarted action; an intent alone cannot.
|
|
1784
|
+
*/
|
|
1785
|
+
interface IExecutionJournal {
|
|
1786
|
+
append(record: TExecutionJournalRecord): Promise<void>;
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Reads the complete, ordered, current prefix from the same authority used for append.
|
|
1790
|
+
* The host must hold exclusive fenced ownership and drain the old runtime before recovery.
|
|
1791
|
+
* Appending an identical recordId is idempotent; conflicting content must be rejected.
|
|
1792
|
+
*/
|
|
1793
|
+
interface IRecoverableExecutionJournal extends IExecutionJournal {
|
|
1794
|
+
read(executionId: string): Promise<readonly TExecutionJournalRecord[]>;
|
|
1795
|
+
}
|
|
1796
|
+
interface IResumeToolCallsOptions {
|
|
1797
|
+
executionId: string;
|
|
1798
|
+
callId: string;
|
|
1799
|
+
journal: IRecoverableExecutionJournal;
|
|
1800
|
+
/** Exact replies to saved requests; receipts are persisted before further execution. */
|
|
1801
|
+
toolResponses?: readonly IToolWaitResponse[];
|
|
1802
|
+
signal?: AbortSignal;
|
|
1803
|
+
/** Observe newly committed recovery history using the ordinary history-mutation contract. */
|
|
1804
|
+
onExecutionEvent?: (event: string, data: Record<string, unknown>) => void;
|
|
1677
1805
|
}
|
|
1678
1806
|
/**
|
|
1679
|
-
*
|
|
1807
|
+
* Continue the latest settled invocation on the original provider/model under exclusive host ownership.
|
|
1808
|
+
* Structured-output validators and unknown effects require reconciliation rather than automatic replay.
|
|
1809
|
+
* Turn-level lifecycle hooks are omitted because their effects have no durable receipts;
|
|
1810
|
+
* hosts requiring those effects must settle them separately. Recovered history remains available.
|
|
1680
1811
|
*/
|
|
1681
|
-
interface
|
|
1682
|
-
|
|
1812
|
+
interface IResumeExecutionOptions extends Omit<IResumeToolCallsOptions, 'callId'> {
|
|
1813
|
+
onTextDelta?: IChatOptions['onTextDelta'];
|
|
1814
|
+
traceContext?: IRunTraceContext;
|
|
1683
1815
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
interface IEventService {
|
|
1689
|
-
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1690
|
-
subscribe(listener: TEventListener): void;
|
|
1691
|
-
unsubscribe(listener: TEventListener): void;
|
|
1816
|
+
interface IResumeToolCallsResult {
|
|
1817
|
+
executionId: string;
|
|
1818
|
+
callId: string;
|
|
1819
|
+
messages: TUniversalMessage[];
|
|
1692
1820
|
}
|
|
1693
|
-
/**
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1821
|
+
/** Host-owned identity for a journaled provider invocation, including routing changes. */
|
|
1822
|
+
interface IModelJournalContext {
|
|
1823
|
+
journal: IExecutionJournal;
|
|
1824
|
+
executionId: string;
|
|
1825
|
+
callId: string;
|
|
1826
|
+
checkpoint?: IExecutionRoundCheckpoint;
|
|
1827
|
+
route(): {
|
|
1828
|
+
providerId: string;
|
|
1829
|
+
modelId: string;
|
|
1830
|
+
};
|
|
1700
1831
|
}
|
|
1701
1832
|
//#endregion
|
|
1702
|
-
//#region src/
|
|
1833
|
+
//#region src/interfaces/cache.d.ts
|
|
1703
1834
|
/**
|
|
1704
|
-
*
|
|
1705
|
-
* Concrete implementations decide how events are delivered.
|
|
1835
|
+
* Cache key identifying a unique LLM execution request
|
|
1706
1836
|
*/
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1837
|
+
interface ICacheKey {
|
|
1838
|
+
/** SHA-256 hash of the serialized request */
|
|
1839
|
+
hash: string;
|
|
1840
|
+
/** Model identifier */
|
|
1841
|
+
model: string;
|
|
1842
|
+
/** Provider name */
|
|
1843
|
+
provider: string;
|
|
1713
1844
|
}
|
|
1714
1845
|
/**
|
|
1715
|
-
*
|
|
1716
|
-
* When injected, emit() intentionally does nothing.
|
|
1846
|
+
* Cached LLM response entry
|
|
1717
1847
|
*/
|
|
1718
|
-
|
|
1719
|
-
|
|
1848
|
+
interface ICacheEntry {
|
|
1849
|
+
/** Cache key that produced this entry */
|
|
1850
|
+
key: ICacheKey;
|
|
1851
|
+
/** Cached response content */
|
|
1852
|
+
response: string;
|
|
1853
|
+
/** When the entry was cached */
|
|
1854
|
+
timestamp: number;
|
|
1855
|
+
/** SHA-256 integrity hash of the response */
|
|
1856
|
+
integrityHash: string;
|
|
1720
1857
|
}
|
|
1721
1858
|
/**
|
|
1722
|
-
*
|
|
1723
|
-
*/
|
|
1724
|
-
declare const DEFAULT_ABSTRACT_EVENT_SERVICE: IEventService;
|
|
1725
|
-
/**
|
|
1726
|
-
* Check if a given service is the default no-op implementation.
|
|
1727
|
-
*/
|
|
1728
|
-
declare function isDefaultEventService(service: IEventService): boolean;
|
|
1729
|
-
/**
|
|
1730
|
-
* Compose a full event name from owner prefix and local name.
|
|
1731
|
-
* Local names must not contain dots.
|
|
1732
|
-
*/
|
|
1733
|
-
declare function composeEventName(ownerType: string, localName: string): string;
|
|
1734
|
-
/**
|
|
1735
|
-
* Generate a unique span ID for distributed tracing correlation. Exported so a per-operation timing
|
|
1736
|
-
* source (SELFHOST-004) can mint a span id it puts on BOTH the event payload and the event context.
|
|
1859
|
+
* Cache storage interface for pluggable backends
|
|
1737
1860
|
*/
|
|
1738
|
-
|
|
1861
|
+
interface ICacheStorage {
|
|
1862
|
+
/** Retrieve a cached entry by key hash */
|
|
1863
|
+
get(hash: string): ICacheEntry | undefined;
|
|
1864
|
+
/** Store a cache entry */
|
|
1865
|
+
set(entry: ICacheEntry): void;
|
|
1866
|
+
/** Delete a cached entry by key hash */
|
|
1867
|
+
delete(hash: string): boolean;
|
|
1868
|
+
/** Clear all cached entries */
|
|
1869
|
+
clear(): void;
|
|
1870
|
+
/** Get cache statistics */
|
|
1871
|
+
getStats(): ICacheStats;
|
|
1872
|
+
}
|
|
1739
1873
|
/**
|
|
1740
|
-
*
|
|
1874
|
+
* Cache performance statistics
|
|
1741
1875
|
*/
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1876
|
+
interface ICacheStats {
|
|
1877
|
+
/** Number of cache hits */
|
|
1878
|
+
hits: number;
|
|
1879
|
+
/** Number of cache misses */
|
|
1880
|
+
misses: number;
|
|
1881
|
+
/** Current number of cached entries */
|
|
1882
|
+
entries: number;
|
|
1883
|
+
/** Hit rate (hits / (hits + misses)), 0 if no lookups */
|
|
1884
|
+
hitRate: number;
|
|
1749
1885
|
}
|
|
1750
1886
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
* This is the standard entry point for scoped emission (path-only architecture).
|
|
1887
|
+
* Configuration options for execution caching
|
|
1753
1888
|
*/
|
|
1754
|
-
|
|
1889
|
+
interface ICacheOptions {
|
|
1890
|
+
/** Whether caching is enabled */
|
|
1891
|
+
enabled: boolean;
|
|
1892
|
+
/** Maximum number of cached entries */
|
|
1893
|
+
maxEntries: number;
|
|
1894
|
+
/** Time-to-live in milliseconds */
|
|
1895
|
+
ttlMs: number;
|
|
1896
|
+
}
|
|
1897
|
+
//#endregion
|
|
1898
|
+
//#region src/interfaces/response-format.d.ts
|
|
1755
1899
|
/**
|
|
1756
|
-
*
|
|
1757
|
-
* Intentionally forwards to the single authoritative implementation.
|
|
1900
|
+
* Response format configuration
|
|
1758
1901
|
*/
|
|
1759
|
-
|
|
1902
|
+
interface IResponseFormatConfig {
|
|
1903
|
+
type?: 'text' | 'json_object' | 'json_schema';
|
|
1904
|
+
/** JSON schema payload; required when `type` is `'json_schema'` (CORE-015). */
|
|
1905
|
+
schema?: Record<string, TConfigValue>;
|
|
1906
|
+
/** Schema name forwarded to provider native structured-output surfaces. */
|
|
1907
|
+
name?: string;
|
|
1908
|
+
}
|
|
1760
1909
|
/**
|
|
1761
|
-
*
|
|
1910
|
+
* Safety setting configuration
|
|
1762
1911
|
*/
|
|
1763
|
-
|
|
1764
|
-
|
|
1912
|
+
interface ISafetySetting {
|
|
1913
|
+
category: string;
|
|
1914
|
+
threshold: string;
|
|
1915
|
+
[key: string]: TConfigValue;
|
|
1765
1916
|
}
|
|
1766
1917
|
//#endregion
|
|
1767
|
-
//#region src/
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
/**
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
declare const TOOL_BODY_EVENTS: {
|
|
1803
|
-
readonly COMPLETED: "tool_body_completed";
|
|
1804
|
-
};
|
|
1805
|
-
/** Content-free decision reached for one tool call before any body runs. */
|
|
1806
|
-
declare const TOOL_PERMISSION_EVENTS: {
|
|
1807
|
-
readonly DECIDED: "tool_permission_decided";
|
|
1808
|
-
};
|
|
1809
|
-
declare const SPAN_EVENT_PREFIX: "span";
|
|
1810
|
-
type TSpanEvent = (typeof SPAN_EVENTS)[keyof typeof SPAN_EVENTS];
|
|
1918
|
+
//#region src/schema/zod-schema-types.d.ts
|
|
1919
|
+
interface IZodParseResult {
|
|
1920
|
+
success: boolean;
|
|
1921
|
+
data?: unknown;
|
|
1922
|
+
error?: unknown;
|
|
1923
|
+
}
|
|
1924
|
+
interface IZodSchemaDef {
|
|
1925
|
+
typeName?: string;
|
|
1926
|
+
innerType?: IZodSchema;
|
|
1927
|
+
valueType?: IZodSchema;
|
|
1928
|
+
checks?: Array<{
|
|
1929
|
+
kind: string;
|
|
1930
|
+
value?: TUniversalValue;
|
|
1931
|
+
}>;
|
|
1932
|
+
shape?: () => Record<string, IZodSchema>;
|
|
1933
|
+
type?: IZodSchema;
|
|
1934
|
+
/**
|
|
1935
|
+
* `ZodEnum` holds an ARRAY here; `ZodNativeEnum` holds the enum OBJECT itself (CORE-041). One Zod
|
|
1936
|
+
* field name, two shapes — the converter narrows before reading it.
|
|
1937
|
+
*/
|
|
1938
|
+
values?: TUniversalValue[] | Record<string, TUniversalValue>;
|
|
1939
|
+
description?: string;
|
|
1940
|
+
unknownKeys?: 'passthrough' | 'strip' | 'strict';
|
|
1941
|
+
/** `ZodEffects` (`.refine()` / `.transform()`) holds the schema it wraps here. */
|
|
1942
|
+
schema?: IZodSchema;
|
|
1943
|
+
/** `ZodUnion` / `ZodDiscriminatedUnion` members. */
|
|
1944
|
+
options?: IZodSchema[];
|
|
1945
|
+
/** `ZodLiteral` value. */
|
|
1946
|
+
value?: TUniversalValue;
|
|
1947
|
+
}
|
|
1948
|
+
interface IZodSchema {
|
|
1949
|
+
parse(value: unknown): unknown;
|
|
1950
|
+
safeParse(value: unknown): IZodParseResult;
|
|
1951
|
+
_def?: IZodSchemaDef;
|
|
1952
|
+
}
|
|
1811
1953
|
/**
|
|
1812
|
-
*
|
|
1813
|
-
* operation name (raw scalars ONLY; references no transport type). Emitted by the per-operation timing
|
|
1814
|
-
* source (e.g. `FunctionTool`) so a consuming layer (`agent-framework`) can build a record span entry
|
|
1815
|
-
* WITHOUT `agent-core` depending on `agent-interface-transport` (no cycle). The payload `spanId` is the
|
|
1816
|
-
* AUTHORITATIVE id a consumer reads; owner/turn correlation is applied by the event service's binding
|
|
1817
|
-
* (`ownerPath` on the emitted `IEventContext`). Note the context's own auto-minted `spanId` is a
|
|
1818
|
-
* separate scope tag and need not equal this payload id — always read the payload id for the span.
|
|
1954
|
+
* Schema conversion options
|
|
1819
1955
|
*/
|
|
1820
|
-
interface
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1956
|
+
interface ISchemaConversionOptions {
|
|
1957
|
+
includeDescription?: boolean;
|
|
1958
|
+
strictTypes?: boolean;
|
|
1959
|
+
allowAdditionalProperties?: boolean;
|
|
1960
|
+
}
|
|
1961
|
+
//#endregion
|
|
1962
|
+
//#region src/schema/structured-output.d.ts
|
|
1963
|
+
/** Explicit raw-JSON-schema form of `IRunOptions.output`. */
|
|
1964
|
+
interface IJsonSchemaOutput {
|
|
1965
|
+
/** JSON Schema (object root, universal subset) the response must match. */
|
|
1966
|
+
jsonSchema: IToolSchema['parameters'];
|
|
1967
|
+
/** Optional schema name forwarded to provider native surfaces. */
|
|
1968
|
+
name?: string;
|
|
1827
1969
|
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
type
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1970
|
+
/** Accepted `IRunOptions.output` values: a Zod schema or an explicit JSON-schema wrapper. */
|
|
1971
|
+
type TStructuredOutputSchema = IZodSchema | IJsonSchemaOutput;
|
|
1972
|
+
type TStructuredOutputValidation = {
|
|
1973
|
+
success: true;
|
|
1974
|
+
value: unknown;
|
|
1975
|
+
} | {
|
|
1976
|
+
success: false;
|
|
1977
|
+
issues: string[];
|
|
1978
|
+
};
|
|
1979
|
+
/** Internal SSOT representation every `output` value normalizes to. */
|
|
1980
|
+
interface IStructuredOutputSpec {
|
|
1981
|
+
name: string;
|
|
1982
|
+
jsonSchema: IToolSchema['parameters'];
|
|
1983
|
+
validate(value: unknown): TStructuredOutputValidation;
|
|
1984
|
+
}
|
|
1985
|
+
/** Normalize an accepted `output` value into the internal spec. */
|
|
1986
|
+
declare function normalizeStructuredOutput(output: TStructuredOutputSchema): IStructuredOutputSpec;
|
|
1835
1987
|
/**
|
|
1836
|
-
*
|
|
1988
|
+
* Validate a value against the universal JSON-schema subset (`IParameterSchema`). Covers type,
|
|
1989
|
+
* required, enum, items, nested properties, unions and numeric bounds — the full expressible
|
|
1990
|
+
* surface of the subset, at every level.
|
|
1837
1991
|
*
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1840
|
-
* - Prefer `ToolResultData` (derived from the canonical `UniversalValue` axis).
|
|
1992
|
+
* CORE-039: this is the ONE complete walk. `parameter-validator` delegates its depth here rather
|
|
1993
|
+
* than keeping a second, shallower copy, and the two must therefore agree by construction.
|
|
1841
1994
|
*/
|
|
1995
|
+
declare function validateAgainstJsonSchema(schema: IParameterSchema, value: unknown, path: string): string[];
|
|
1842
1996
|
/**
|
|
1843
|
-
*
|
|
1997
|
+
* Parse the model's final text into a JSON value. Tolerates a fenced
|
|
1998
|
+
* ```json code block wrapper (providers without native enforcement commonly
|
|
1999
|
+
* emit one); the parsed value is still strictly schema-validated afterwards.
|
|
1844
2000
|
*/
|
|
1845
|
-
|
|
1846
|
-
success:
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
}
|
|
2001
|
+
declare function parseStructuredResponseText(text: string): {
|
|
2002
|
+
success: true;
|
|
2003
|
+
value: unknown;
|
|
2004
|
+
} | {
|
|
2005
|
+
success: false;
|
|
2006
|
+
issue: string;
|
|
2007
|
+
};
|
|
2008
|
+
//#endregion
|
|
2009
|
+
//#region src/interfaces/run-options.d.ts
|
|
1852
2010
|
/**
|
|
1853
|
-
*
|
|
2011
|
+
* The per-RUN contract: what one `run()` may override or observe, as distinct from the agent's
|
|
2012
|
+
* standing configuration in `IAgentConfig`.
|
|
2013
|
+
*
|
|
2014
|
+
* Split out of `agent.ts` when PEER-007 added `driverId`. That file sits at a frozen size baseline,
|
|
2015
|
+
* and the anti-monolith rule asks for a split rather than one more field on a file already at its
|
|
2016
|
+
* limit. The two execution-event types come along because `onExecutionEvent` is their only consumer
|
|
2017
|
+
* — leaving them behind would have made this module import back from `agent.ts`.
|
|
1854
2018
|
*/
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
success: boolean;
|
|
1858
|
-
/** Tool name that was executed */
|
|
1859
|
-
toolName?: string;
|
|
1860
|
-
/** Execution result or data */
|
|
1861
|
-
result?: TUniversalValue;
|
|
1862
|
-
/** Error message if execution failed */
|
|
1863
|
-
error?: string;
|
|
1864
|
-
/** Execution duration in milliseconds */
|
|
1865
|
-
duration?: number;
|
|
1866
|
-
/** Unique execution ID */
|
|
1867
|
-
executionId?: string;
|
|
1868
|
-
/** Additional metadata */
|
|
1869
|
-
metadata?: TToolMetadata;
|
|
1870
|
-
}
|
|
2019
|
+
type TExecutionEventData = Record<string, unknown>;
|
|
2020
|
+
type TExecutionEventCallback = (event: string, data: TExecutionEventData) => void;
|
|
1871
2021
|
/**
|
|
1872
|
-
*
|
|
1873
|
-
* Enhanced with hierarchical execution tracking support
|
|
2022
|
+
* Agent run options - type-safe interface for all agent execution options
|
|
1874
2023
|
*/
|
|
1875
|
-
interface
|
|
1876
|
-
|
|
1877
|
-
|
|
2024
|
+
interface IRunOptions {
|
|
2025
|
+
/** Run-scoped temperature override — wins over `defaultModel.temperature` (CORE-016). */
|
|
2026
|
+
temperature?: number;
|
|
2027
|
+
/** Run-scoped max output tokens override — wins over `defaultModel.maxTokens` (CORE-016). */
|
|
2028
|
+
maxTokens?: number;
|
|
1878
2029
|
/**
|
|
1879
|
-
* Run-scoped
|
|
1880
|
-
*
|
|
1881
|
-
*
|
|
2030
|
+
* Run-scoped tool-invocation directive — wins over `defaultModel.toolChoice` (CORE-017).
|
|
2031
|
+
* `'auto'` (model decides), `'none'` (suppress tool calls), `'required'` (must call some
|
|
2032
|
+
* tool), or `{ tool: name }` (must call the named tool; the name is validated against the
|
|
2033
|
+
* run's tool list and a miss throws). Forcing applies to the run's first model call only;
|
|
2034
|
+
* rounds after tool results revert to `'auto'` (see `TToolChoice`).
|
|
1882
2035
|
*/
|
|
1883
|
-
|
|
1884
|
-
/** Direct remote calls deny decisions that would require human interaction. */
|
|
1885
|
-
permissionInteraction?: 'interactive' | 'deny';
|
|
1886
|
-
executionId?: string;
|
|
1887
|
-
userId?: string;
|
|
1888
|
-
sessionId?: string;
|
|
1889
|
-
metadata?: TToolMetadata;
|
|
1890
|
-
/** Parent execution ID for hierarchical tool execution tracking */
|
|
1891
|
-
parentExecutionId?: string;
|
|
1892
|
-
/** Root execution ID (Team/Agent level) for complete execution tree tracking */
|
|
1893
|
-
rootExecutionId?: string;
|
|
1894
|
-
/** Execution depth level (0: Team, 1: Agent, 2: Tool, etc.) */
|
|
1895
|
-
executionLevel?: number;
|
|
1896
|
-
/** Execution path array showing the complete execution hierarchy */
|
|
1897
|
-
executionPath?: string[];
|
|
1898
|
-
/** Real-time execution data for accurate tracking (no simulation) */
|
|
1899
|
-
realTimeData?: {
|
|
1900
|
-
/** Actual execution start time */
|
|
1901
|
-
startTime: Date;
|
|
1902
|
-
/** Actual input parameters passed to the tool */
|
|
1903
|
-
actualParameters: TToolParameters;
|
|
1904
|
-
/** Tool-provided estimated duration (optional) */
|
|
1905
|
-
estimatedDuration?: number;
|
|
1906
|
-
};
|
|
2036
|
+
toolChoice?: TToolChoice;
|
|
1907
2037
|
/**
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
1910
|
-
*
|
|
1911
|
-
* - Avoid ad-hoc top-level fields to keep the contract stable.
|
|
1912
|
-
* - Use this map for forward-compatible extra data with constrained value types.
|
|
2038
|
+
* Leave a provider's own hosted tools (a vendor-run web search) out of this run's requests. They
|
|
2039
|
+
* run at the vendor and never pass the permission gate, so a run whose tools a policy restricts
|
|
2040
|
+
* must not reach them.
|
|
1913
2041
|
*/
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
ownerId?: string;
|
|
1918
|
-
ownerPath?: IOwnerPathSegment[];
|
|
1919
|
-
sourceId?: string;
|
|
2042
|
+
withholdHostedTools?: boolean;
|
|
2043
|
+
sessionId?: string;
|
|
2044
|
+
userId?: string;
|
|
1920
2045
|
/**
|
|
1921
|
-
*
|
|
1922
|
-
*
|
|
1923
|
-
* an ownerPath-bound EventService for this tool call.
|
|
2046
|
+
* PEER-007 (issue #1915): who this run is attributed to, for display. Per-run because it changes
|
|
2047
|
+
* per turn — one session serves the operator and any peer addressing it. Never authorization.
|
|
1924
2048
|
*/
|
|
1925
|
-
|
|
2049
|
+
driverId?: string;
|
|
1926
2050
|
/**
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
* for a different owner (e.g., creating an agent from a tool call).
|
|
1931
|
-
*
|
|
1932
|
-
* NOTE: Do not wrap an already owner-bound EventService to bind a different owner.
|
|
1933
|
-
* Owner-bound instances must not be layered across different owners.
|
|
2051
|
+
* Where this run's turn came from (a peer's message, an external event, an agent wake-up), stored
|
|
2052
|
+
* beside `driverId` on the user message so a transcript carried elsewhere still says it. Display
|
|
2053
|
+
* only, like `driverId`; absent for the operator's own turn.
|
|
1934
2054
|
*/
|
|
1935
|
-
|
|
2055
|
+
turnSource?: string;
|
|
2056
|
+
metadata?: TMetadata;
|
|
1936
2057
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1939
|
-
*
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
2058
|
+
* Run-scoped EPHEMERAL system context (SELFHOST-008 P3). A transient system-role block included in THIS
|
|
2059
|
+
* run's provider request(s) only — it is **never written to the conversation store**. An explicitly
|
|
2060
|
+
* configured execution journal records it as request/recovery state. It does not bloat conversation
|
|
2061
|
+
* history or force a static-system-prompt rebuild. Content-free neutral channel: the
|
|
2062
|
+
* caller decides what to put here (e.g. per-turn recalled memory). Absent ⇒ no change.
|
|
1942
2063
|
*/
|
|
1943
|
-
|
|
2064
|
+
ephemeralSystemContext?: string;
|
|
1944
2065
|
/**
|
|
1945
|
-
*
|
|
1946
|
-
*
|
|
1947
|
-
*
|
|
1948
|
-
* available" (never a silent guess).
|
|
2066
|
+
* Host-owned trace context for this run's provider calls. Each invoked call — forced summary
|
|
2067
|
+
* included, cache hits excluded — gets a `traceparent` whose parent is that call's own span, and
|
|
2068
|
+
* only an adapter whose origin is listed sends it. Never recorded in execution events.
|
|
1949
2069
|
*/
|
|
1950
|
-
|
|
2070
|
+
traceContext?: IRunTraceContext;
|
|
1951
2071
|
/**
|
|
1952
|
-
*
|
|
1953
|
-
*
|
|
1954
|
-
*
|
|
2072
|
+
* AbortSignal for cancelling execution. Aborting an in-flight run does not throw: `run()` resolves
|
|
2073
|
+
* (and `runStream()` returns) the last assistant text the turn committed before the abort, possibly
|
|
2074
|
+
* `''`; a reply cut off mid-stream is kept in history with `state: 'interrupted'`. Read
|
|
2075
|
+
* `signal.aborted` to tell an interrupted run from a completed one.
|
|
1955
2076
|
*/
|
|
1956
|
-
|
|
2077
|
+
signal?: AbortSignal;
|
|
2078
|
+
/** Join an aborted/timed-out provider call before completing; an uncooperative call may remain pending. */
|
|
2079
|
+
awaitProviderSettlement?: boolean;
|
|
2080
|
+
/** Per-run streaming text callback. Prefer this over mutating provider callback state. */
|
|
2081
|
+
onTextDelta?: TTextDeltaCallback;
|
|
2082
|
+
/** Per-run replay event callback for provider/tool execution boundaries. */
|
|
2083
|
+
onExecutionEvent?: TExecutionEventCallback;
|
|
2084
|
+
/** Awaited model/tool admission and result records. Failures terminate this run. */
|
|
2085
|
+
executionJournal?: IExecutionJournal;
|
|
1957
2086
|
/**
|
|
1958
|
-
*
|
|
1959
|
-
*
|
|
2087
|
+
* Maximum execution rounds for this run. A **round** is one provider (model) call plus the
|
|
2088
|
+
* execution of every tool call that reply requested; a reply with no tool calls ends the loop,
|
|
2089
|
+
* so a plain Q&A turn is exactly 1 round. This caps model/tool cycles within ONE `run()` — it is
|
|
2090
|
+
* not a tool-count limit and not a multi-turn conversation limit. When the cap is hit the run
|
|
2091
|
+
* stops after the current round. Use 0 for no core round cap. Defaults to
|
|
2092
|
+
* `IAgentConfig.maxExecutionRounds`.
|
|
1960
2093
|
*/
|
|
1961
|
-
|
|
2094
|
+
maxExecutionRounds?: number;
|
|
2095
|
+
/** Max times the same tool may be called with identical input before aborting. Unset = no limit. */
|
|
2096
|
+
maxSameToolInputs?: number;
|
|
1962
2097
|
/**
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
1965
|
-
*
|
|
2098
|
+
* Treat a turn that ends in tool calls (no trailing text) as a valid completion instead of
|
|
2099
|
+
* forcing one extra provider call to generate a summary (CORE-011). For decision-agent patterns
|
|
2100
|
+
* (router/orchestrator/classifier) the tool call IS the answer — this removes the one-call tax.
|
|
2101
|
+
* The summary call is the one made when the round cap ends the loop on a tool round; before the cap
|
|
2102
|
+
* the model is called again after tool results as usual, so a decision agent sets
|
|
2103
|
+
* `maxExecutionRounds` too (e.g. `1`). The run resolves with the turn's text, or `''` when it
|
|
2104
|
+
* ended in tool results (consumers read the outcome from those results), and rejects with
|
|
2105
|
+
* `EmptyCompletionError` when it produced neither text nor a tool result.
|
|
1966
2106
|
*/
|
|
1967
|
-
|
|
2107
|
+
allowToolOnlyCompletion?: boolean;
|
|
1968
2108
|
/**
|
|
1969
|
-
*
|
|
1970
|
-
*
|
|
2109
|
+
* Schema-enforced structured output (CORE-015). Accepts a Zod schema or an explicit
|
|
2110
|
+
* `{ jsonSchema }` wrapper. `run` then resolves to the validated, typed object instead of a
|
|
2111
|
+
* string: the schema is forwarded to the provider's native structured-output surface where one
|
|
2112
|
+
* exists, and the final response is always parsed and validated core-side; a violation triggers
|
|
2113
|
+
* a bounded retry with the validation issues fed back as the next turn's input. Every attempt is
|
|
2114
|
+
* a real conversation turn (history stays append-only). Exhausted retries throw
|
|
2115
|
+
* `StructuredOutputError`.
|
|
1971
2116
|
*/
|
|
1972
|
-
|
|
2117
|
+
output?: TStructuredOutputSchema;
|
|
1973
2118
|
/**
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
* span is the body's own.
|
|
2119
|
+
* Retry budget for structured output validation failures — the number of additional attempts
|
|
2120
|
+
* after the first (default 2). Only meaningful with `output` set.
|
|
1977
2121
|
*/
|
|
1978
|
-
|
|
2122
|
+
outputRetries?: number;
|
|
1979
2123
|
}
|
|
2124
|
+
//#endregion
|
|
2125
|
+
//#region src/plugins/event-emitter/types.d.ts
|
|
2126
|
+
declare const EXECUTION_EVENT_NAMES: {
|
|
2127
|
+
readonly START: "execution.start";
|
|
2128
|
+
readonly COMPLETE: "execution.complete";
|
|
2129
|
+
readonly ERROR: "execution.error";
|
|
2130
|
+
};
|
|
2131
|
+
declare const TOOL_EVENT_NAMES: {
|
|
2132
|
+
readonly CALL_START: "tool.call_start";
|
|
2133
|
+
readonly CALL_COMPLETE: "tool.call_complete";
|
|
2134
|
+
readonly CALL_ERROR: "tool.call_error";
|
|
2135
|
+
};
|
|
2136
|
+
declare const AGENT_EVENT_NAMES: {
|
|
2137
|
+
readonly EXECUTION_START: "agent.execution_start";
|
|
2138
|
+
readonly EXECUTION_COMPLETE: "agent.execution_complete";
|
|
2139
|
+
readonly EXECUTION_ERROR: "agent.execution_error";
|
|
2140
|
+
readonly CREATED: "agent.created";
|
|
2141
|
+
};
|
|
2142
|
+
type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
|
|
2143
|
+
type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
|
|
2144
|
+
type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
|
|
1980
2145
|
/**
|
|
1981
|
-
*
|
|
2146
|
+
* Event types that can be emitted.
|
|
2147
|
+
*
|
|
2148
|
+
* IMPORTANT:
|
|
2149
|
+
* - Do not use string literals for event names outside this module.
|
|
2150
|
+
* - Import and use EVENT_EMITTER_EVENTS instead.
|
|
1982
2151
|
*/
|
|
1983
|
-
|
|
1984
|
-
/**
|
|
1985
|
-
|
|
1986
|
-
/**
|
|
1987
|
-
|
|
1988
|
-
|
|
2152
|
+
declare const EVENT_EMITTER_EVENTS: {
|
|
2153
|
+
/** @deprecated Not emitted by a run; a run emits `AGENT_EXECUTION_START`. */
|
|
2154
|
+
readonly EXECUTION_START: "execution.start";
|
|
2155
|
+
/** @deprecated Not emitted by a run; a run emits `AGENT_EXECUTION_COMPLETE`. */
|
|
2156
|
+
readonly EXECUTION_COMPLETE: "execution.complete";
|
|
2157
|
+
/** @deprecated Not emitted by a run; a run emits `AGENT_EXECUTION_ERROR`. */
|
|
2158
|
+
readonly EXECUTION_ERROR: "execution.error";
|
|
2159
|
+
readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
|
|
2160
|
+
readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
|
|
2161
|
+
readonly TOOL_SUCCESS: "tool.success";
|
|
2162
|
+
readonly TOOL_ERROR: "tool.call_error";
|
|
2163
|
+
readonly CONVERSATION_START: "conversation.start";
|
|
2164
|
+
readonly CONVERSATION_COMPLETE: "conversation.complete";
|
|
2165
|
+
readonly CONVERSATION_ERROR: "conversation.error";
|
|
2166
|
+
readonly AGENT_EXECUTION_START: "agent.execution_start";
|
|
2167
|
+
readonly AGENT_EXECUTION_COMPLETE: "agent.execution_complete";
|
|
2168
|
+
readonly AGENT_EXECUTION_ERROR: "agent.execution_error";
|
|
2169
|
+
readonly AGENT_CREATED: "agent.created";
|
|
2170
|
+
readonly AGENT_DESTROYED: "agent.destroyed";
|
|
2171
|
+
readonly PLUGIN_LOADED: "plugin.loaded";
|
|
2172
|
+
readonly PLUGIN_UNLOADED: "plugin.unloaded";
|
|
2173
|
+
readonly PLUGIN_ERROR: "plugin.error";
|
|
2174
|
+
readonly ERROR_OCCURRED: "error.occurred";
|
|
2175
|
+
readonly WARNING_OCCURRED: "warning.occurred";
|
|
2176
|
+
readonly MODULE_INITIALIZE_START: "module.initialize.start";
|
|
2177
|
+
readonly MODULE_INITIALIZE_COMPLETE: "module.initialize.complete";
|
|
2178
|
+
readonly MODULE_INITIALIZE_ERROR: "module.initialize.error";
|
|
2179
|
+
readonly MODULE_EXECUTION_START: "module.execution.start";
|
|
2180
|
+
readonly MODULE_EXECUTION_COMPLETE: "module.execution.complete";
|
|
2181
|
+
readonly MODULE_EXECUTION_ERROR: "module.execution.error";
|
|
2182
|
+
readonly MODULE_DISPOSE_START: "module.dispose.start";
|
|
2183
|
+
readonly MODULE_DISPOSE_COMPLETE: "module.dispose.complete";
|
|
2184
|
+
readonly MODULE_DISPOSE_ERROR: "module.dispose.error";
|
|
2185
|
+
readonly MODULE_REGISTERED: "module.registered";
|
|
2186
|
+
readonly MODULE_UNREGISTERED: "module.unregistered";
|
|
2187
|
+
readonly EXECUTION_HIERARCHY: "execution.hierarchy";
|
|
2188
|
+
readonly EXECUTION_REALTIME: "execution.realtime";
|
|
2189
|
+
readonly TOOL_REALTIME: "tool.realtime";
|
|
2190
|
+
readonly CUSTOM: "custom";
|
|
2191
|
+
};
|
|
2192
|
+
type TEventName = TExecutionEventName | TToolEventName | TAgentEventName | 'tool.beforeExecute' | 'tool.afterExecute' | 'tool.success' | 'conversation.start' | 'conversation.complete' | 'conversation.error' | 'agent.destroyed' | 'plugin.loaded' | 'plugin.unloaded' | 'plugin.error' | 'error.occurred' | 'warning.occurred' | 'module.initialize.start' | 'module.initialize.complete' | 'module.initialize.error' | 'module.execution.start' | 'module.execution.complete' | 'module.execution.error' | 'module.dispose.start' | 'module.dispose.complete' | 'module.dispose.error' | 'module.registered' | 'module.unregistered' | 'execution.hierarchy' | 'execution.realtime' | 'tool.realtime' | 'custom';
|
|
1989
2193
|
/**
|
|
1990
|
-
*
|
|
2194
|
+
* Valid event data value types
|
|
1991
2195
|
*/
|
|
1992
|
-
type
|
|
2196
|
+
type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
|
|
2197
|
+
[key: string]: TEventDataValue;
|
|
2198
|
+
};
|
|
1993
2199
|
/**
|
|
1994
|
-
*
|
|
2200
|
+
* Event data structure
|
|
1995
2201
|
*/
|
|
1996
|
-
interface
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
*/
|
|
2006
|
-
validate(parameters: TToolParameters): boolean;
|
|
2007
|
-
/**
|
|
2008
|
-
* Validate tool parameters with detailed result
|
|
2009
|
-
*/
|
|
2010
|
-
validateParameters(parameters: TToolParameters): IParameterValidationResult;
|
|
2011
|
-
/**
|
|
2012
|
-
* Get tool description
|
|
2013
|
-
*/
|
|
2014
|
-
getDescription(): string;
|
|
2202
|
+
interface IEventEmitterEventData {
|
|
2203
|
+
type: TEventName;
|
|
2204
|
+
timestamp: Date;
|
|
2205
|
+
executionId?: string;
|
|
2206
|
+
sessionId?: string;
|
|
2207
|
+
userId?: string;
|
|
2208
|
+
data?: Record<string, TEventDataValue>;
|
|
2209
|
+
error?: Error;
|
|
2210
|
+
metadata?: Record<string, TEventDataValue>;
|
|
2015
2211
|
}
|
|
2016
2212
|
/**
|
|
2017
|
-
*
|
|
2213
|
+
* Event listener function
|
|
2018
2214
|
*/
|
|
2019
|
-
|
|
2020
|
-
/** Function to execute */
|
|
2021
|
-
fn: TToolExecutor;
|
|
2022
|
-
}
|
|
2215
|
+
type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
|
|
2023
2216
|
/**
|
|
2024
|
-
*
|
|
2217
|
+
* Console-like interface for the EventEmitterPlugin.
|
|
2218
|
+
*
|
|
2219
|
+
* Use this interface for typing instead of the concrete EventEmitterPlugin class.
|
|
2025
2220
|
*/
|
|
2026
|
-
interface
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2221
|
+
interface IEventEmitterPlugin {
|
|
2222
|
+
on(eventType: TEventName, listener: TEventEmitterListener, options?: {
|
|
2223
|
+
once?: boolean;
|
|
2224
|
+
filter?: (event: IEventEmitterEventData) => boolean;
|
|
2225
|
+
}): string;
|
|
2226
|
+
once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
|
|
2227
|
+
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
2228
|
+
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
2229
|
+
}
|
|
2230
|
+
//#endregion
|
|
2231
|
+
//#region src/abstracts/abstract-module-types.d.ts
|
|
2232
|
+
/** Module execution context */
|
|
2233
|
+
interface IModuleExecutionContext {
|
|
2234
|
+
executionId?: string;
|
|
2235
|
+
sessionId?: string;
|
|
2236
|
+
userId?: string;
|
|
2237
|
+
agentName?: string;
|
|
2238
|
+
metadata?: Record<string, string | number | boolean | Date>;
|
|
2239
|
+
[key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
|
|
2240
|
+
}
|
|
2241
|
+
/** Module execution result */
|
|
2242
|
+
interface IModuleExecutionResult {
|
|
2243
|
+
success: boolean;
|
|
2244
|
+
data?: IModuleResultData;
|
|
2245
|
+
error?: Error;
|
|
2246
|
+
duration?: number;
|
|
2247
|
+
metadata?: Record<string, string | number | boolean | Date>;
|
|
2248
|
+
}
|
|
2249
|
+
/** Module result data */
|
|
2250
|
+
interface IModuleResultData {
|
|
2251
|
+
[key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
|
|
2252
|
+
}
|
|
2253
|
+
/** Base module options */
|
|
2254
|
+
interface IBaseModuleOptions {
|
|
2255
|
+
enabled?: boolean;
|
|
2256
|
+
config?: Record<string, string | number | boolean>;
|
|
2257
|
+
}
|
|
2258
|
+
/** Module capabilities */
|
|
2259
|
+
interface IModuleCapabilities {
|
|
2260
|
+
capabilities: string[];
|
|
2261
|
+
dependencies?: string[];
|
|
2262
|
+
optionalDependencies?: string[];
|
|
2263
|
+
}
|
|
2264
|
+
/** Module type descriptor */
|
|
2265
|
+
interface IModuleDescriptor {
|
|
2266
|
+
type: string;
|
|
2267
|
+
category: ModuleCategory;
|
|
2268
|
+
layer: ModuleLayer;
|
|
2269
|
+
dependencies?: string[];
|
|
2270
|
+
capabilities?: string[];
|
|
2271
|
+
}
|
|
2272
|
+
/** Module categories */
|
|
2273
|
+
declare enum ModuleCategory {
|
|
2274
|
+
CORE = "core",
|
|
2275
|
+
STORAGE = "storage",
|
|
2276
|
+
PROCESSING = "processing",
|
|
2277
|
+
INTEGRATION = "integration",
|
|
2278
|
+
INTERFACE = "interface",
|
|
2279
|
+
CAPABILITY = "capability"
|
|
2280
|
+
}
|
|
2281
|
+
/** Module layers */
|
|
2282
|
+
declare enum ModuleLayer {
|
|
2283
|
+
INFRASTRUCTURE = "infrastructure",
|
|
2284
|
+
CORE = "core",
|
|
2285
|
+
APPLICATION = "application",
|
|
2286
|
+
DOMAIN = "domain",
|
|
2287
|
+
PRESENTATION = "presentation"
|
|
2288
|
+
}
|
|
2289
|
+
/** Module data for introspection */
|
|
2290
|
+
interface IModuleData {
|
|
2291
|
+
name: string;
|
|
2292
|
+
version: string;
|
|
2293
|
+
type: string;
|
|
2294
|
+
enabled: boolean;
|
|
2295
|
+
initialized: boolean;
|
|
2296
|
+
capabilities: IModuleCapabilities;
|
|
2297
|
+
metadata?: Record<string, string | number | boolean>;
|
|
2298
|
+
}
|
|
2299
|
+
/** Module statistics */
|
|
2300
|
+
interface IModuleStats {
|
|
2301
|
+
enabled: boolean;
|
|
2302
|
+
initialized: boolean;
|
|
2303
|
+
executionCount: number;
|
|
2304
|
+
errorCount: number;
|
|
2305
|
+
lastActivity?: Date;
|
|
2306
|
+
averageExecutionTime?: number;
|
|
2307
|
+
[key: string]: string | number | boolean | Date | undefined;
|
|
2308
|
+
}
|
|
2309
|
+
/** Type-safe module interface */
|
|
2310
|
+
interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
|
|
2311
|
+
name: string;
|
|
2312
|
+
version: string;
|
|
2313
|
+
enabled: boolean;
|
|
2314
|
+
initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
|
|
2315
|
+
dispose?(): Promise<void>;
|
|
2316
|
+
execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
|
|
2317
|
+
getModuleType(): IModuleDescriptor;
|
|
2318
|
+
getCapabilities(): IModuleCapabilities;
|
|
2319
|
+
getData?(): IModuleData;
|
|
2320
|
+
getStats?(): TStats;
|
|
2321
|
+
isEnabled(): boolean;
|
|
2322
|
+
isInitialized(): boolean;
|
|
2055
2323
|
}
|
|
2056
2324
|
//#endregion
|
|
2057
2325
|
//#region src/abstracts/abstract-plugin-types.d.ts
|
|
@@ -2117,6 +2385,8 @@ interface IPluginExecutionResult {
|
|
|
2117
2385
|
* above, which lives at this abstracts layer.
|
|
2118
2386
|
*/
|
|
2119
2387
|
interface IPluginContext {
|
|
2388
|
+
toolData?: IToolExecutionContext;
|
|
2389
|
+
toolResult?: IToolExecutionResult;
|
|
2120
2390
|
input?: string;
|
|
2121
2391
|
response?: string;
|
|
2122
2392
|
messages?: TUniversalMessage[];
|
|
@@ -2126,7 +2396,10 @@ interface IPluginContext {
|
|
|
2126
2396
|
executionContext?: TContextData;
|
|
2127
2397
|
/** PLG-020 (issue #2460): the run's result, for `afterExecution` / `afterConversation` / `afterToolExecution`. */
|
|
2128
2398
|
executionResult?: IPluginExecutionResult;
|
|
2129
|
-
/**
|
|
2399
|
+
/**
|
|
2400
|
+
* The message just appended to the conversation, for `onMessageAdded`, or the streamed text
|
|
2401
|
+
* chunk, for `onStreamingChunk`.
|
|
2402
|
+
*/
|
|
2130
2403
|
message?: TUniversalMessage;
|
|
2131
2404
|
}
|
|
2132
2405
|
/** Error context for plugin error handling */
|
|
@@ -2206,7 +2479,7 @@ interface IPluginHooks {
|
|
|
2206
2479
|
afterExecution?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void> | void;
|
|
2207
2480
|
beforeConversation?(context: IPluginExecutionContext): Promise<void> | void;
|
|
2208
2481
|
afterConversation?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void> | void;
|
|
2209
|
-
beforeToolCall?(toolName: string, parameters: TToolParameters): Promise<void> | void;
|
|
2482
|
+
beforeToolCall?(toolName: string, parameters: TToolParameters, context?: IToolExecutionContext): Promise<void> | void;
|
|
2210
2483
|
beforeToolExecution?(context: IPluginExecutionContext, toolData: IToolExecutionContext): Promise<void> | void;
|
|
2211
2484
|
afterToolCall?(toolName: string, parameters: TToolParameters, result: IToolExecutionResult): Promise<void> | void;
|
|
2212
2485
|
afterToolExecution?(context: IPluginExecutionContext, toolResults: IPluginExecutionResult): Promise<void> | void;
|
|
@@ -2385,6 +2658,11 @@ interface IAbstractTool<TParams = TToolParameters, TResult = IToolResult> {
|
|
|
2385
2658
|
interface IToolContract<TParameters = TToolParameters, TResult = IToolResult> {
|
|
2386
2659
|
readonly schema: IToolSchema;
|
|
2387
2660
|
execute(parameters: TParameters, context: IToolExecutionContext): Promise<TResult>;
|
|
2661
|
+
/**
|
|
2662
|
+
* Wrappers await admission exactly once with final canonical arguments after preconditions and before
|
|
2663
|
+
* the body. Denial returns without admission. Admission failures propagate unchanged.
|
|
2664
|
+
*/
|
|
2665
|
+
executeWithAdmission?(parameters: TParameters, context: IToolExecutionContext, admit: TToolEffectAdmission<TParameters>): Promise<TResult>;
|
|
2388
2666
|
validate(parameters: TParameters): boolean;
|
|
2389
2667
|
validateParameters(parameters: TParameters): IParameterValidationResult;
|
|
2390
2668
|
getDescription(): string;
|
|
@@ -2716,7 +2994,7 @@ interface IProviderDefinition {
|
|
|
2716
2994
|
* LLM nodes' single `COST_PER_TOKEN_USD` scalar. The correct long-term home is the per-model
|
|
2717
2995
|
* {@link IProviderModelCatalogEntry.costPerInputToken}/`costPerOutputToken`; this flat scalar is a
|
|
2718
2996
|
* fidelity-preserving interim used only while model catalogs are `status:'unavailable'` (no per-model
|
|
2719
|
-
* entries to attach cost to). Consumed by the collapsed `llm-text` node's
|
|
2997
|
+
* entries to attach cost to). Consumed by the collapsed `llm-text` node's cost estimate. Absent
|
|
2720
2998
|
* means cost is unknown for this provider and estimators must degrade explicitly.
|
|
2721
2999
|
*/
|
|
2722
3000
|
costPerTokenUsd?: number;
|
|
@@ -2995,6 +3273,8 @@ interface IToolManager {
|
|
|
2995
3273
|
* deferral is not engaged. The same member `IDeferredToolCatalog` declares.
|
|
2996
3274
|
*/
|
|
2997
3275
|
listDeferredTools(): IToolSchema[];
|
|
3276
|
+
/** Loaded residency for compatible execution checkpoints. */
|
|
3277
|
+
getLoadedDeferredTools?(): string[];
|
|
2998
3278
|
/**
|
|
2999
3279
|
* CLI-1990: mark deferred tools loaded for the rest of the session and return their schemas; an
|
|
3000
3280
|
* unknown name throws, naming it, before anything is loaded. The same member
|
|
@@ -3384,14 +3664,9 @@ type TExecutorStreamEvent = IExecutorStreamMessageEvent | IExecutorStreamTermina
|
|
|
3384
3664
|
/**
|
|
3385
3665
|
* Interface for executing AI provider operations
|
|
3386
3666
|
*
|
|
3387
|
-
* Executors abstract the execution mechanism,
|
|
3388
|
-
*
|
|
3389
|
-
*
|
|
3390
|
-
* Implementation patterns:
|
|
3391
|
-
* - LocalExecutor: Direct API calls using provider SDKs
|
|
3392
|
-
* - RemoteExecutor: HTTP/WebSocket calls to remote server
|
|
3393
|
-
* - CacheExecutor: Cached responses with explicit error propagation
|
|
3394
|
-
* - HybridExecutor: Conditional local/remote execution
|
|
3667
|
+
* Executors abstract the execution mechanism, so a provider can call its API directly or hand the
|
|
3668
|
+
* call to something else (a server of your own, a cache). `LocalExecutor` is the in-process one;
|
|
3669
|
+
* any other is yours to implement.
|
|
3395
3670
|
*/
|
|
3396
3671
|
interface IExecutor {
|
|
3397
3672
|
/**
|
|
@@ -3469,7 +3744,10 @@ interface ILocalExecutorConfig {
|
|
|
3469
3744
|
enableLogging?: boolean;
|
|
3470
3745
|
}
|
|
3471
3746
|
/**
|
|
3472
|
-
* Configuration options for remote executor
|
|
3747
|
+
* Configuration options for a remote executor.
|
|
3748
|
+
*
|
|
3749
|
+
* @deprecated Robota ships no remote executor, so nothing reads this type. It stays exported only
|
|
3750
|
+
* so existing imports keep compiling; describe your own executor's options instead.
|
|
3473
3751
|
*/
|
|
3474
3752
|
interface IRemoteExecutorConfig {
|
|
3475
3753
|
/** Remote server URL */
|
|
@@ -4017,7 +4295,7 @@ declare abstract class AbstractPlugin<TOptions extends IPluginOptions = IPluginO
|
|
|
4017
4295
|
afterExecution?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
|
|
4018
4296
|
beforeConversation?(context: IPluginExecutionContext): Promise<void>;
|
|
4019
4297
|
afterConversation?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
|
|
4020
|
-
beforeToolCall?(toolName: string, parameters: TToolParameters): Promise<void>;
|
|
4298
|
+
beforeToolCall?(toolName: string, parameters: TToolParameters, context?: IToolExecutionContext): Promise<void>;
|
|
4021
4299
|
beforeToolExecution?(context: IPluginExecutionContext, toolData: IToolExecutionContext): Promise<void>;
|
|
4022
4300
|
afterToolCall?(toolName: string, parameters: TToolParameters, result: IToolExecutionResult): Promise<void>;
|
|
4023
4301
|
afterToolExecution?(context: IPluginExecutionContext, toolResults: IPluginExecutionResult): Promise<void>;
|
|
@@ -4319,6 +4597,35 @@ declare class ErrorUtils {
|
|
|
4319
4597
|
static wrapProviderError(error: TErrorExternalInput, provider: string, operation: string): ProviderError;
|
|
4320
4598
|
}
|
|
4321
4599
|
//#endregion
|
|
4600
|
+
//#region src/utils/execution-journal-error.d.ts
|
|
4601
|
+
/** A persistence/admission failure must never become a model-visible, retryable tool failure. */
|
|
4602
|
+
declare class ExecutionJournalError extends Error {
|
|
4603
|
+
readonly code = "EXECUTION_JOURNAL_FAILED";
|
|
4604
|
+
readonly recordId: string;
|
|
4605
|
+
readonly kind: TExecutionJournalRecord['kind'];
|
|
4606
|
+
constructor(record: TExecutionJournalRecord, cause: unknown);
|
|
4607
|
+
}
|
|
4608
|
+
//#endregion
|
|
4609
|
+
//#region src/utils/execution-suspended-error.d.ts
|
|
4610
|
+
/** A persisted wait is control flow, never a failed tool result or semantic completion. */
|
|
4611
|
+
declare class ExecutionSuspendedError extends Error {
|
|
4612
|
+
readonly code = "EXECUTION_SUSPENDED";
|
|
4613
|
+
readonly requests: readonly IToolWaitRequest[];
|
|
4614
|
+
constructor(requests: readonly IToolWaitRequest[]);
|
|
4615
|
+
}
|
|
4616
|
+
//#endregion
|
|
4617
|
+
//#region src/utils/execution-recovery-error.d.ts
|
|
4618
|
+
type TExecutionRecoveryErrorCode = 'EXECUTION_RECOVERY_INVALID' | 'EXECUTION_RECOVERY_REQUIRED' | 'EXECUTION_RECOVERY_CONFLICT';
|
|
4619
|
+
/** Recovery refuses unproven effects or history instead of guessing whether to replay them. */
|
|
4620
|
+
declare class ExecutionRecoveryError extends Error {
|
|
4621
|
+
readonly code: TExecutionRecoveryErrorCode;
|
|
4622
|
+
readonly actionIds: readonly string[];
|
|
4623
|
+
constructor(code: TExecutionRecoveryErrorCode, message: string, actionIds?: readonly string[]);
|
|
4624
|
+
}
|
|
4625
|
+
//#endregion
|
|
4626
|
+
//#region src/utils/execution-control-error.d.ts
|
|
4627
|
+
declare function isExecutionControlError(error: unknown): error is ExecutionJournalError | ExecutionRecoveryError | ExecutionSuspendedError;
|
|
4628
|
+
//#endregion
|
|
4322
4629
|
//#region src/utils/timer-types.d.ts
|
|
4323
4630
|
/**
|
|
4324
4631
|
* Cross-platform timer identifier type.
|
|
@@ -4426,6 +4733,9 @@ declare function subprocessTraceEnvironment(base: Readonly<Record<string, string
|
|
|
4426
4733
|
*/
|
|
4427
4734
|
declare function traceHeadersFor(baseUrl: string | undefined, traceContext: IOutboundTraceContext | undefined): Readonly<Record<string, string>>;
|
|
4428
4735
|
//#endregion
|
|
4736
|
+
//#region src/services/execution-journal.d.ts
|
|
4737
|
+
declare function callJournaledProvider(chat: (messages: TUniversalMessage[], options: IChatOptions) => Promise<TUniversalMessage>, messages: TUniversalMessage[], options: IChatOptions, context?: IModelJournalContext): Promise<TUniversalMessage>;
|
|
4738
|
+
//#endregion
|
|
4429
4739
|
//#region src/schema/zod-to-json-schema.d.ts
|
|
4430
4740
|
/**
|
|
4431
4741
|
* Convert a Zod schema to the universal JSON-schema subset.
|
|
@@ -5356,6 +5666,7 @@ declare class Tools extends AbstractManager implements IToolManager {
|
|
|
5356
5666
|
/** Whether a call to this tool would execute now: registered, and offered by the projection. */
|
|
5357
5667
|
isToolOffered(name: string): boolean;
|
|
5358
5668
|
/** Deferred tools not yet loaded — the population a search discovers. Empty while deferral is off. */
|
|
5669
|
+
getLoadedDeferredTools(): string[];
|
|
5359
5670
|
listDeferredTools(): IToolSchema[];
|
|
5360
5671
|
/**
|
|
5361
5672
|
* Mark deferred tools loaded for the rest of the session. Every name is resolved before any is
|
|
@@ -5495,6 +5806,16 @@ declare class Robota extends RobotaBase implements IAgent<IAgentConfig, IRunOpti
|
|
|
5495
5806
|
listRuntimeTools(): Promise<IToolSchema[]>;
|
|
5496
5807
|
/** Explicit tool invocation through the same executor used by model turns. */
|
|
5497
5808
|
invokeRuntimeTool(name: string, parameters: TToolParameters, context: IToolExecutionContext): Promise<IToolExecutionResult>;
|
|
5809
|
+
/**
|
|
5810
|
+
* Resume a compatible journaled execution without adding input or repeating settled calls.
|
|
5811
|
+
* Retain restored history for the host to checkpoint or discard, including on interruption.
|
|
5812
|
+
*/
|
|
5813
|
+
resume(value: IResumeExecutionOptions): Promise<string>;
|
|
5814
|
+
/**
|
|
5815
|
+
* Restore the latest journaled tool batch without a model call or new user input.
|
|
5816
|
+
* The host must own the journal exclusively and settle the previous runtime first.
|
|
5817
|
+
*/
|
|
5818
|
+
resumeToolCalls(value: IResumeToolCallsOptions): Promise<IResumeToolCallsResult>;
|
|
5498
5819
|
/**
|
|
5499
5820
|
* Concurrency contract (CORE-012): a Robota instance owns ONE conversation history, so
|
|
5500
5821
|
* concurrent `run`/`runStream` calls on the same instance are serialized on an internal queue —
|
|
@@ -5875,6 +6196,19 @@ declare function isRegistryTransactionError(error: unknown): error is IRegistryT
|
|
|
5875
6196
|
*/
|
|
5876
6197
|
declare function runRegistryTransaction(steps: readonly IRegistryTransactionStep[]): Promise<void>;
|
|
5877
6198
|
//#endregion
|
|
6199
|
+
//#region src/services/provider-call-usage.d.ts
|
|
6200
|
+
type TProviderUsageProvenance = 'complete' | 'partial' | 'absent';
|
|
6201
|
+
interface IVerifiedProviderCallUsage {
|
|
6202
|
+
readonly provenance: TProviderUsageProvenance;
|
|
6203
|
+
readonly promptTokens?: number;
|
|
6204
|
+
readonly completionTokens?: number;
|
|
6205
|
+
readonly totalTokens?: number;
|
|
6206
|
+
/** The part of `promptTokens` served from the provider's prompt cache, when it was reported. */
|
|
6207
|
+
readonly cacheReadTokens?: number;
|
|
6208
|
+
}
|
|
6209
|
+
/** Keep billing/telemetry stricter than context-window heuristics: only adapter-attested totals count. */
|
|
6210
|
+
declare function verifiedProviderCallUsage(message: TUniversalMessage | undefined): IVerifiedProviderCallUsage;
|
|
6211
|
+
//#endregion
|
|
5878
6212
|
//#region src/services/execution-usage.d.ts
|
|
5879
6213
|
/**
|
|
5880
6214
|
* Aggregate token totals over a whole session/sub-session history.
|
|
@@ -6109,9 +6443,9 @@ interface IOrchestrationStepResult {
|
|
|
6109
6443
|
output: string;
|
|
6110
6444
|
/**
|
|
6111
6445
|
* Optional token usage of the step's subagent run (the {@link ITokenUsage} SSOT triple;
|
|
6112
|
-
* TYPE-003). Present
|
|
6113
|
-
*
|
|
6114
|
-
*
|
|
6446
|
+
* TYPE-003). Present when the underlying runner reported it — `SubagentManager.wait` already
|
|
6447
|
+
* threads a completed job's `usage` straight through its result; this is `undefined` only when
|
|
6448
|
+
* the runner itself never reported any.
|
|
6115
6449
|
*/
|
|
6116
6450
|
usage?: ITokenUsage;
|
|
6117
6451
|
}
|
|
@@ -6963,5 +7297,5 @@ declare function decodeHookVerdict(raw: string, source: THookDefinition['type'],
|
|
|
6963
7297
|
/** Does a hook that reached no verdict block at this event? */
|
|
6964
7298
|
declare function isEnforcing(event: THookEvent): boolean;
|
|
6965
7299
|
//#endregion
|
|
6966
|
-
export { parseParameterRule as $, IAgent as $a, IProviderCapabilityTable as $c, confirmAction as $i, IMediaProviderOverrides as $n, TASK_EVENTS as $o, IToolSchemaProjectionChange as $r, IProviderRequest as $s, isRegistryTransactionError as $t, allowRulesForAutoMode as A, isVideoGenerationProvider as Aa, readProviderFailureDetails as Ac, ILocalExecutorConfig as Ai, IUserInteraction as Al, IEventEmitterMetrics as An, PluginCategory as Ao, stopPeriodicTask as Ar, IDeferredToolCatalog as As, IHandoffOrchestrationSpec as At, IPermissionPolicyProjection as B, IProviderProbeResult as Ba, ProviderError as Bc, IToolExecutionRequest as Bi, TContextData as Bl, hasUsableSecretReference as Bn, TToolMetadata as Bo, MessageConverter as Br, TStructuredOutputValidation as Bs, AGENT_EVENTS as Bt, IContextTokenEstimate as C, IVideoGenerationProvider as Ca, assertProviderNativeWebToolsAvailable as Cc, IEventHistoryRecord as Ci, isSystemMessage as Cl, DEFERRED_WITHOUT_LOADER_MESSAGE as Cn, IPluginData as Co, traceHeadersFor as Cr, TEventUniversalValue as Cs, createExecutionProxy as Ct, estimateToolSchemaTokens as D, TImageInputSource as Da, IProviderFailureClassification as Dc, IExecutorChatResult as Di, IActionDefault as Dl, EventEmitterPlugin as Dn, IPluginHooks as Do, UnsupportedShellError as Dr, TEventEmitterListener as Ds, ORCHESTRATION_EVENT_PREFIX as Dt, estimateSerializedContextTokens as E, IVideoJobSnapshot as Ea, TModelFallbackCallback as Ec, IExecutor as Ei, messageToHistoryEntry as El, ToolRegistry as En, IPluginExecutionResult as Eo, TShellKind as Er, IEventEmitterPlugin as Es, ORCHESTRATION_EVENTS as Et, IPermissionPatternProblem as F, IProviderDefinition as Fa, ConfigurationError as Fc, IConversationContext as Fi, ICacheStats as Fl, IBoundedOutputOptions as Fn, IToolExecutionContext as Fo, validateAgentConfig as Fr, TExecutionEventCallback as Fs, IOrchestrationStep as Ft, IToolPermissionArgument as G, TProviderCredentialField as Ga, StructuredOutputError as Gc, IToolExecutionStep as Gi, TypeUtils as Gl, ConversationHistory as Gn, SPAN_EVENT_PREFIX as Go, AbstractTool as Gr, IZodParseResult as Gs, IAssistantUsageMetadata as Gt, IParameterRule as H, IProviderProfileDefaults as Ha, RobotaError as Hc, TResponseMetadata as Hi, TMetadata as Hl, resolveEnvReference as Hn, PROVIDER_CALL_EVENTS as Ho, TMessageFormatConverter as Hr, parseStructuredResponseText as Hs, peerDriverOf as Ht, findInvalidPermissionPatterns as I, IProviderDefinitionConfig as Ia, IProviderFailureDetails as Ic, IConversationResponse as Ii, ICacheStorage as Il, TOutputRetention as In, IToolExecutionResult as Io, validateApiKey as Ir, TExecutionEventData as Is, IOrchestrationStepResult as It, clearRegisteredToolProfiles as J, TProviderSetupField as Ja, ToolExecutionError as Jc, getToolExecutionSteps as Ji, createToolMessage as Jn, TSpanEvent as Jo, AbstractAIProvider as Jr, IResponseFormatConfig as Js, sumHistoryUsage as Jt, IToolPermissionProfile as K, TProviderModelCatalogStatus as Ka, TErrorContextData as Kc, TToolProgressCallback as Ki, createAssistantMessage as Kn, TOOL_BODY_EVENTS as Ko, AbstractExecutor as Kr, IZodSchema as Ks, ISessionUsageTotals as Kt, findPermissionPatternWarnings as L, IProviderEndpoint as La, ModelNotAvailableError as Lc, IConversationService as Li, TComplexConfigValue as Ll, createBoundedOutput as Ln, IToolRegistry as Lo, validateModelName as Lr, IJsonSchemaOutput as Ls, IParallelOrchestrationSpec as Lt, splitCommandSegments as M, TStructuredOutputMechanism as Ma, AuthenticationError as Mc, IStreamExecutionRequest as Mi, ICacheEntry as Ml, InMemoryEventEmitterMetrics as Mn, IFunctionTool as Mo, ErrorUtils as Mr, TToolSearchMode as Ms, IOrchestrationDelegation as Mt, applyPresetToolLists as N, TStructuredOutputProvenance as Na, CacheIntegrityError as Nc, TExecutorStreamEvent as Ni, ICacheKey as Nl, shellArgumentForDisplay as Nn, IParameterValidationResult as No, ISimpleValidationResult as Nr, TToolSearchSetting as Ns, IOrchestrationEventData as Nt, IContextTokenUsage as O, TProviderMediaResult as Oa, TProviderFailureReason as Oc, IExecutorStreamMessageEvent as Oi, IActionOption as Ol, IEventEmitterHierarchicalEventData as On, IPluginOptions as Oo, resolvePlatformShell as Or, TEventName as Os, TOrchestrationEvent as Ot, toolNamesToPatterns as P, IProviderCredentialRequirement as Pa, CircuitBreakerOpenError as Pc, IContextOptions as Pi, ICacheOptions as Pl, IBoundedOutput as Pn, ITool as Po, Validator as Pr, IRunOptions as Ps, IOrchestrationRunResult as Pt, matchesAnyPattern as Q, getProviderCredentialRequirement as Qa, IModelCapabilityDeviation as Qc, CONFIRM_YES as Qi, normalizeProviderConfig as Qn, USER_EVENT_PREFIX as Qo, IToolSchemaProjection as Qr, IProviderOptions as Qs, IRegistryTransactionStep as Qt, validatePermissionPattern as R, IProviderModelCatalog as Ra, NetworkError as Rc, IConversationServiceOptions as Ri, TConfigData as Rl, ENV_REFERENCE_PREFIX as Rn, IToolResult as Ro, validateProviderName as Rr, IStructuredOutputSpec as Rs, ISequentialOrchestrationSpec as Rt, CONTEXT_ESTIMATE_CHARS_PER_TOKEN as S, IUriImageInputSource as Sa, IProviderNativeWebToolRequest as Sc, IEventHistoryModule as Si, isChatEntry as Sl, TOOL_EVENT_PREFIX as Sn, IPluginContract as So, traceEnvFor as Sr, TEventLoggerData as Ss, ExecutionProxy as St, estimateContextTokensFromMessages as T, IVideoJobAccepted as Ta, IModelFallbackNotice as Tc, IChatExecutionRequest as Ti, isUserMessage as Tl, FunctionTool as Tn, IPluginExecutionContext as To, IPlatformShellResolutionRequest as Tr, IEventEmitterEventData as Ts, IExecutionProxyConfig as Tt, IPermissionEvaluationContext as U, IProviderSetupHelpLink as Ua, SameToolInputLoopError as Uc, TToolExecutionParameters as Ui, TMetadataValue as Ul, IAIProviderInstance as Un, PROVIDER_FALLBACK_EVENTS as Uo, TProviderMessage as Ur, validateAgainstJsonSchema as Us, printablePeerDriver as Ut, projectPermissionPolicy as V, IProviderProfileConfig as Va, RateLimitError as Vc, TConversationContextMetadata as Vi, TLoggerData as Vl, isEnvReference as Vn, ISpanCompletionEventData as Vo, TMessageConverterRegistry as Vr, normalizeStructuredOutput as Vs, AGENT_EVENT_PREFIX as Vt, IPermissionLists as W, IProviderSetupStepDefinition as Wa, StorageError as Wc, IProgressReportingTool as Wi, TToolParameters as Wl, LocalExecutor as Wn, SPAN_EVENTS as Wo, isAbortFailure as Wr, ISchemaConversionOptions as Ws, EventHistoryModule as Wt, getToolPermissionProfile as X, findProviderDefinition as Xa, IModelRef as Xc, setToolProgressCallback as Xi, ConversationStore as Xn, TUserEvent as Xo, IProviderRuntimeConfig as Xr, IChatOptions as Xs, IRegistryOwnedLifecycle as Xt, evaluatePermission as Y, TProviderSetupHelpLinkKind as Ya, ValidationError as Yc, isProgressReportingTool as Yi, createUserMessage as Yn, readModelFallbackNotice as Yo, IExecutorAwareProviderConfig as Yr, IAIProvider as Ys, sumMessagesUsage as Yt, isToolDeniedOutright as Z, formatSupportedProviderTypes as Za, TRoleModelMap as Zc, CONFIRM_NO as Zi, createProviderFromConfig as Zn, USER_EVENTS as Zo, TProviderLoggingData as Zr, IProviderNativeRawPayloadEvent as Zs, IRegistryTransactionError as Zt, getModelName as _, IImageGenerationRequest as _a, IProviderSpecificOptions as _c, IFileSystemAsync as _i, TUniversalMessagePart as _l, Robota as _n, setGlobalLogLevel as _o, outboundTraceContextFor as _r, IExecutionEventData as _s, TBackgroundPermissionPolicy as _t, IModelPrice as a, IToolFactory as aa, TProviderNativeRawPayloadCallback as ac, TOOL_SCHEMA_PROJECTION_MAX_NODES as ai, IBaseMessage as al, IAgentCreationStats as an, IToolWithEventService as ao, processEnvResolver as ar, StructuredEventService as as, PROTECTED_FILE_NAMES as at, readTokenUsageFromMessage as b, IMediaOutputRef as ba, IProviderNativeWebToolCapabilities as bc, ISpinner as bi, getMessagesForAPI as bl, EXECUTION_EVENT_PREFIX as bn, IPluginConfig as bo, subprocessTraceEnvironment as br, TEventExtensionValue as bs, TRUST_TO_MODE as bt, estimateBlendedCostPer1000 as c, TManagerToolParameters as ca, TTextDeltaCallback as cc, hashToolSchema as ci, ISystemMessage as cl, DEFAULT_TOOL_RESULT_HARD_CHARS as cn, ILogger as co, extractEnumValues as cr, composeEventName as cs, RISK_CLASS_POLICY as ct, DEFAULT_MAX_OUTPUT as d, IMediaProviderDefinition as da, IObjectParameterSchema as dc, IManagerLifecycleOptions as di, IToolMessage as dl, IToolResultSpillStore as dn, SilentLogger as do, ISchemaClosureChange as dr, IAgentEventData as ds, TArgumentKind as dt, isConfirmed as ea, IRawProviderResponse as ec, IToolSchemaProjectionProfile as ei, modelDeclaresCapability as el, lifecycleOf as en, IAgentConfig as eo, createImageProviderFromDefinition as er, TASK_EVENT_PREFIX as es, registerToolPermissionProfile as et, IModelDefinition as f, findMediaProviderDefinition as fa, IParameterSchema as fc, AbstractAgent as fi, IUriImageMessagePart as fl, MAX_TOOL_RESULT_CHARS as fn, TUtilLogLevel as fo, ISchemaClosureOptions as fr, IBaseEventData as fs, TMatchDirection as ft, getModelMaxOutput as g, IImageGenerationProvider as ga, TParameterDefaultValue as gc, IFileSystem as gi, TUniversalMessageMetadata as gl, wasToolResultAdmitted as gn, logger as go, isMintedSpanId as gr, IEventServiceOwnerBinding as gs, DEFAULT_BACKGROUND_PERMISSION_POLICY as gt, getModelContextWindow as h, IImageEditRequest as ha, TJSONSchemaKind as hc, IDirent as hi, TUniversalMessage as hl, admitToolResult as hn, getGlobalLoggerSink as ho, buildTraceparent as hr, IEventService as hs, isReadOnlyCommandLine as ht, runHooks as i, IOpenAPIToolConfig as ia, TProviderNativeRawPayload as ic, TOOL_SCHEMA_PROJECTION_MAX_DEPTH as ii, IAssistantMessage as il, ITemplateApplicationResult as in, IToolContract as io, createRecordEnvResolver as ir, ObservableEventService as is, PROTECTED_DIRECTORY_NAMES as it, isBroadExecutionAllowRule as j, IProviderStructuredOutputCapability as ja, toProviderError as jc, IRemoteExecutorConfig as ji, TActionResponse as jl, IEventEmitterMetricsSnapshot as jn, PluginPriority as jo, TTimerId as jr, TOOL_SEARCH_TOOL_NAME as js, IHierarchicalOrchestrationSpec as jt, IContextWindowState as k, isImageGenerationProvider as ka, classifyProviderFailure as kc, IExecutorStreamTerminalEvent as ki, IActionRequest as kl, IEventEmitterPluginOptions as kn, IPluginStats as ko, startPeriodicTask as kr, TExecutionEventName as ks, IGroupChatOrchestrationSpec as kt, lookupModelPrice as l, IMediaProviderConfig as la, TToolChoice as lc, projectToolSchema as li, ITextMessagePart as ll, DEFAULT_TOOL_RESULT_WARNING_CHARS as ln, ILoggerOptions as lo, getSchemaTypeName as lr, generateSpanId as ls, TToolRiskClass as lt, formatTokenCount as m, IImageComposeRequest as ma, TJSONSchemaEnum as mc, ICredentialStore as mi, TMessageState as ml, ToolResultAdmissionError as mn, getGlobalLogLevel as mo, zodToJsonSchema as mr, IEventObjectValue as ms, TResolveInWorkspace as mt, decodeHookVerdict as n, selectAction as na, ITokenUsageWithCacheRead as nc, PERMISSIVE_TOOL_SCHEMA_PROFILE as ni, resolveModelCapability as nl, AgentFactory as nn, IAbstractTool as no, resolveMediaProviderConfig as nr, DEFAULT_ABSTRACT_EVENT_SERVICE as ns, toolNameMatches as nt, MODEL_PRICES as o, IAIProviderManager as oa, TProviderNativeRawPayloadKind as oc, TToolSchemaProjectionOutcome as oi, IHistoryEntry as ol, IAgentFactoryOptions as on, TToolExecutionFunction as oo, IStructuredOutputResolutionInput as or, bindEventServiceOwner as os, isProtectedPath as ot, findModelDefinition as p, isMediaProviderDefinition as pa, IToolSchema as pc, ICredentialKey as pi, IUserMessage as pl, TToolResultAdmissionErrorCode as pn, createLogger as po, closeObjectSchemas as pr, IEventContext as ps, IReadOnlyCommandContext as pt, TToolArgs as q, TProviderModelLifecycle as qa, TErrorExternalInput as qc, getToolEstimatedDuration as qi, createSystemMessage as qn, TOOL_PERMISSION_EVENTS as qo, AbstractPlugin as qr, IZodSchemaDef as qs, collectAssistantUsageMetadata as qt, GuardrailExecutor as r, textAction as ra, TProviderConfigValue as rc, STRICT_TOOL_SCHEMA_PROFILE as ri, TProviderModelCapability as rl, AgentTemplates as rn, IAbstractToolOptions as ro, TEnvResolver as rr, DefaultEventService as rs, ICriticalPathContext as rt, calculateModelCost as s, IToolManager as sa, TProviderOptionValueBase as sc, TToolSchemaProjectionProfileBase as si, IInlineImageMessagePart as sl, IAgentLifecycleEvents as sn, ConsoleLogger as so, resolveStructuredOutputCapability as sr, bindWithOwnerPath as ss, removesCriticalPath as st, isEnforcing as t, multiSelectAction as ta, ITokenUsage as tc, PARAMETER_SCHEMA_KEYWORDS as ti, resolveModelCapabilities as tl, runRegistryTransaction as tn, IAgentTemplate as to, createVideoProviderFromDefinition as tr, AbstractEventService as ts, requiresFreshApproval as tt, DEFAULT_CONTEXT_WINDOW as u, IMediaProviderCredentialRequirement as ua, getProviderCapabilities as uc, AbstractManager as ui, IToolCall as ul, IToolResultAdmissionOptions as un, IUtilLogEntry as uo, hasValidationConstraints as ur, isDefaultEventService as us, UNCLASSIFIED_TOOL_FALLBACK as ut, registerModelMetadata as v, IImageGenerationResult as va, IProviderCapabilities as vc, IStats as vi, TUniversalMessageRole as vl, IDestroyResult as vn, setGlobalLoggerSink as vo, providerCallSpanId as vr, IOwnerPathSegment as vs, TPermissionDecision$1 as vt, IContextTokenEstimateOptions as w, IVideoGenerationRequest as wa, createDefaultProviderCapabilities as wc, IEventHistorySnapshot as wi, isToolMessage as wl, assertResidentToolRemains as wn, IPluginErrorContext as wo, IPlatformShell as wr, EVENT_EMITTER_EVENTS as ws, withEventEmission as wt, readTokenUsageFromMetadata as x, IProviderMediaError as xa, IProviderNativeWebToolCapability as xc, ITerminalOutput as xi, isAssistantMessage as xl, TOOL_EVENTS as xn, IPluginContext as xo, toolTraceContextFor as xr, TEventListener as xs, TTrustLevel as xt, IMessageTokenUsage as y, IInlineImageInputSource as ya, IProviderFunctionCallingCapability as yc, ISession as yi, chatEntryToMessage as yl, EXECUTION_EVENTS as yn, IPlugin as yo, spanIdFromMintedId as yr, IToolEventData as ys, TPermissionMode as yt, IPermissionPolicyContext as z, IProviderModelCatalogEntry as za, PluginError as zc, IStreamingChunk as zi, TConfigValue as zl, formatEnvReference as zn, TToolExecutor as zo, validateUserInput as zr, TStructuredOutputSchema as zs, TOrchestrationPrimitive as zt };
|
|
6967
|
-
//# sourceMappingURL=index-
|
|
7300
|
+
export { parseParameterRule as $, IProviderSetupStepDefinition as $a, assertProviderNativeWebToolsAvailable as $c, IProgressReportingTool as $i, isAssistantMessage as $l, ConversationStore as $n, TStructuredOutputValidation as $o, isAbortFailure as $r, USER_EVENT_PREFIX as $s, IRegistryOwnedLifecycle as $t, allowRulesForAutoMode as A, IProviderMediaError as Aa, IRawProviderResponse as Ac, ITerminalOutput as Ai, IModelCapabilityDeviation as Al, EventEmitterPlugin as An, IPluginContext as Ao, TShellKind as Ar, TToolEffectAdmission as As, IHandoffOrchestrationSpec as At, IPermissionPolicyProjection as B, IProviderStructuredOutputCapability as Ba, getProviderCapabilities as Bc, IRemoteExecutorConfig as Bi, ISystemMessage as Bl, createBoundedOutput as Bn, PluginPriority as Bo, ExecutionJournalError as Br, IUserInteraction as Bs, AGENT_EVENTS as Bt, IContextTokenEstimate as C, IImageComposeRequest as Ca, TEventLoggerData as Cc, ICredentialStore as Ci, StructuredOutputError as Cl, EXECUTION_EVENT_PREFIX as Cn, getGlobalLogLevel as Co, spanIdFromMintedId as Cr, IFunctionTool as Cs, createExecutionProxy as Ct, estimateToolSchemaTokens as D, IImageGenerationResult as Da, IProviderNativeRawPayloadEvent as Dc, IStats as Di, ValidationError as Dl, assertResidentToolRemains as Dn, setGlobalLoggerSink as Do, traceHeadersFor as Dr, IToolExecutionResult as Ds, ORCHESTRATION_EVENT_PREFIX as Dt, estimateSerializedContextTokens as E, IImageGenerationRequest as Ea, IChatOptions as Ec, IFileSystemAsync as Ei, ToolExecutionError as El, DEFERRED_WITHOUT_LOADER_MESSAGE as En, setGlobalLogLevel as Eo, traceEnvFor as Er, IToolExecutionContext as Es, ORCHESTRATION_EVENTS as Et, IPermissionPatternProblem as F, IVideoJobSnapshot as Fa, TProviderNativeRawPayloadCallback as Fc, IExecutor as Fi, TProviderModelCapability as Fl, InMemoryEventEmitterMetrics as Fn, IPluginExecutionResult as Fo, TTimerId as Fr, TToolSearchMode as Fs, IOrchestrationStep as Ft, IToolPermissionArgument as G, IProviderDefinitionConfig as Ga, TJSONSchemaKind as Gc, IConversationResponse as Gi, IUserMessage as Gl, resolveEnvReference as Gn, TEventName as Go, validateApiKey as Gr, SPAN_EVENTS as Gs, IAssistantUsageMetadata as Gt, IParameterRule as H, TStructuredOutputProvenance as Ha, IParameterSchema as Hc, TExecutorStreamEvent as Hi, IToolCall as Hl, formatEnvReference as Hn, IEventEmitterEventData as Ho, ISimpleValidationResult as Hr, ISpanCompletionEventData as Hs, peerDriverOf as Ht, findInvalidPermissionPatterns as I, TImageInputSource as Ia, TProviderNativeRawPayloadKind as Ic, IExecutorChatResult as Ii, IAssistantMessage as Il, shellArgumentForDisplay as In, IPluginHooks as Io, isExecutionControlError as Ir, TToolSearchSetting as Is, IOrchestrationStepResult as It, clearRegisteredToolProfiles as J, IProviderModelCatalogEntry as Ja, IProviderCapabilities as Jc, IStreamingChunk as Ji, TUniversalMessageMetadata as Jl, ConversationHistory as Jn, TExecutionEventCallback as Jo, validateUserInput as Jr, TOOL_PERMISSION_EVENTS as Js, sumHistoryUsage as Jt, IToolPermissionProfile as K, IProviderEndpoint as Ka, TParameterDefaultValue as Kc, IConversationService as Ki, TMessageState as Kl, IAIProviderInstance as Kn, TExecutionEventName as Ko, validateModelName as Kr, SPAN_EVENT_PREFIX as Ks, ISessionUsageTotals as Kt, findPermissionPatternWarnings as L, TProviderMediaResult as La, TProviderOptionValueBase as Lc, IExecutorStreamMessageEvent as Li, IBaseMessage as Ll, IBoundedOutput as Ln, IPluginOptions as Lo, ExecutionRecoveryError as Lr, IActionDefault as Ls, IParallelOrchestrationSpec as Lt, splitCommandSegments as M, IVideoGenerationProvider as Ma, ITokenUsageWithCacheRead as Mc, IEventHistoryRecord as Mi, modelDeclaresCapability as Ml, IEventEmitterPluginOptions as Mn, IPluginData as Mo, resolvePlatformShell as Mr, TToolMetadata as Ms, IOrchestrationDelegation as Mt, applyPresetToolLists as N, IVideoGenerationRequest as Na, TProviderConfigValue as Nc, IEventHistorySnapshot as Ni, resolveModelCapabilities as Nl, IEventEmitterMetrics as Nn, IPluginErrorContext as No, startPeriodicTask as Nr, IDeferredToolCatalog as Ns, IOrchestrationEventData as Nt, IContextTokenUsage as O, IInlineImageInputSource as Oa, IProviderOptions as Oc, ISession as Oi, IModelRef as Ol, FunctionTool as On, IPlugin as Oo, IPlatformShell as Or, IToolRegistry as Os, TOrchestrationEvent as Ot, toolNamesToPatterns as P, IVideoJobAccepted as Pa, TProviderNativeRawPayload as Pc, IChatExecutionRequest as Pi, resolveModelCapability as Pl, IEventEmitterMetricsSnapshot as Pn, IPluginExecutionContext as Po, stopPeriodicTask as Pr, TOOL_SEARCH_TOOL_NAME as Ps, IOrchestrationRunResult as Pt, matchesAnyPattern as Q, IProviderSetupHelpLink as Qa, IProviderNativeWebToolRequest as Qc, TToolExecutionParameters as Qi, getMessagesForAPI as Ql, createUserMessage as Qn, TStructuredOutputSchema as Qo, TProviderMessage as Qr, USER_EVENTS as Qs, verifiedProviderCallUsage as Qt, validatePermissionPattern as R, isImageGenerationProvider as Ra, TTextDeltaCallback as Rc, IExecutorStreamTerminalEvent as Ri, IHistoryEntry as Rl, IBoundedOutputOptions as Rn, IPluginStats as Ro, TExecutionRecoveryErrorCode as Rr, IActionOption as Rs, ISequentialOrchestrationSpec as Rt, CONTEXT_ESTIMATE_CHARS_PER_TOKEN as S, isMediaProviderDefinition as Sa, TEventListener as Sc, ICredentialKey as Si, StorageError as Sl, EXECUTION_EVENTS as Sn, createLogger as So, providerCallSpanId as Sr, TJournalModelOptions as Ss, ExecutionProxy as St, estimateContextTokensFromMessages as T, IImageGenerationProvider as Ta, IAIProvider as Tc, IFileSystem as Ti, TErrorExternalInput as Tl, TOOL_EVENT_PREFIX as Tn, logger as To, toolTraceContextFor as Tr, ITool as Ts, IExecutionProxyConfig as Tt, IPermissionEvaluationContext as U, IProviderCredentialRequirement as Ua, IToolSchema as Uc, IContextOptions as Ui, IToolMessage as Ul, hasUsableSecretReference as Un, IEventEmitterPlugin as Uo, Validator as Ur, PROVIDER_CALL_EVENTS as Us, printablePeerDriver as Ut, projectPermissionPolicy as V, TStructuredOutputMechanism as Va, IObjectParameterSchema as Vc, IStreamExecutionRequest as Vi, ITextMessagePart as Vl, ENV_REFERENCE_PREFIX as Vn, EVENT_EMITTER_EVENTS as Vo, ErrorUtils as Vr, TActionResponse as Vs, AGENT_EVENT_PREFIX as Vt, IPermissionLists as W, IProviderDefinition as Wa, TJSONSchemaEnum as Wc, IConversationContext as Wi, IUriImageMessagePart as Wl, isEnvReference as Wn, TEventEmitterListener as Wo, validateAgentConfig as Wr, PROVIDER_FALLBACK_EVENTS as Ws, EventHistoryModule as Wt, getToolPermissionProfile as X, IProviderProfileConfig as Xa, IProviderNativeWebToolCapabilities as Xc, TConversationContextMetadata as Xi, TUniversalMessageRole as Xl, createSystemMessage as Xn, IJsonSchemaOutput as Xo, TMessageConverterRegistry as Xr, readModelFallbackNotice as Xs, IVerifiedProviderCallUsage as Xt, evaluatePermission as Y, IProviderProbeResult as Ya, IProviderFunctionCallingCapability as Yc, IToolExecutionRequest as Yi, TUniversalMessagePart as Yl, createAssistantMessage as Yn, TExecutionEventData as Yo, MessageConverter as Yr, TSpanEvent as Ys, sumMessagesUsage as Yt, isToolDeniedOutright as Z, IProviderProfileDefaults as Za, IProviderNativeWebToolCapability as Zc, TResponseMetadata as Zi, chatEntryToMessage as Zl, createToolMessage as Zn, IStructuredOutputSpec as Zo, TMessageFormatConverter as Zr, TUserEvent as Zs, TProviderUsageProvenance as Zt, getModelName as _, TManagerToolParameters as _a, IEventServiceOwnerBinding as _c, hashToolSchema as _i, PluginError as _l, ToolResultAdmissionError as _n, ILogger as _o, zodToJsonSchema as _r, IRecoverableExecutionJournal as _s, TBackgroundPermissionPolicy as _t, TMetadataValue as _u, IModelPrice as a, setToolProgressCallback as aa, ObservableEventService as ac, IProviderRuntimeConfig as ai, classifyProviderFailure as al, AgentFactory as an, findProviderDefinition as ao, resolveMediaProviderConfig as ar, IZodSchema as as, PROTECTED_FILE_NAMES as at, IToolActionIdentity as au, readTokenUsageFromMessage as b, IMediaProviderDefinition as ba, IToolEventData as bc, IManagerLifecycleOptions as bi, RobotaError as bl, Robota as bn, SilentLogger as bo, isMintedSpanId as br, IResumeToolCallsResult as bs, TRUST_TO_MODE as bt, estimateBlendedCostPer1000 as c, confirmAction as ca, bindWithOwnerPath as cc, IToolSchemaProjectionChange as ci, toProviderError as cl, IAgentCreationStats as cn, IAgent as co, processEnvResolver as cr, ICacheEntry as cs, RISK_CLASS_POLICY as ct, IToolWaitRequest as cu, DEFAULT_MAX_OUTPUT as d, selectAction as da, isDefaultEventService as dc, PERMISSIVE_TOOL_SCHEMA_PROFILE as di, CircuitBreakerOpenError as dl, DEFAULT_TOOL_RESULT_HARD_CHARS as dn, IAbstractTool as do, extractEnumValues as dr, ICacheStats as ds, TArgumentKind as dt, TComplexConfigValue as du, IToolExecutionStep as ea, TASK_EVENTS as ec, AbstractTool as ei, createDefaultProviderCapabilities as el, IRegistryTransactionError as en, TProviderCredentialField as eo, createProviderFromConfig as er, normalizeStructuredOutput as es, registerToolPermissionProfile as et, isChatEntry as eu, IModelDefinition as f, textAction as fa, IAgentEventData as fc, STRICT_TOOL_SCHEMA_PROFILE as fi, ConfigurationError as fl, DEFAULT_TOOL_RESULT_WARNING_CHARS as fn, IAbstractToolOptions as fo, getSchemaTypeName as fr, ICacheStorage as fs, TMatchDirection as ft, TConfigData as fu, getModelMaxOutput as g, IToolManager as ga, IEventService as gc, TToolSchemaProjectionProfileBase as gi, NetworkError as gl, TToolResultAdmissionErrorCode as gn, ConsoleLogger as go, closeObjectSchemas as gr, IModelJournalContext as gs, DEFAULT_BACKGROUND_PERMISSION_POLICY as gt, TMetadata as gu, getModelContextWindow as h, IAIProviderManager as ha, IEventObjectValue as hc, TToolSchemaProjectionOutcome as hi, ModelNotAvailableError as hl, MAX_TOOL_RESULT_CHARS as hn, TToolExecutionFunction as ho, ISchemaClosureOptions as hr, IExecutionRoundCheckpoint as hs, isReadOnlyCommandLine as ht, TLoggerData as hu, runHooks as i, isProgressReportingTool as ia, DefaultEventService as ic, IExecutorAwareProviderConfig as ii, TProviderFailureReason as il, runRegistryTransaction as in, TProviderSetupHelpLinkKind as io, createVideoProviderFromDefinition as ir, IZodParseResult as is, PROTECTED_DIRECTORY_NAMES as it, messageToHistoryEntry as iu, isBroadExecutionAllowRule as j, IUriImageInputSource as ja, ITokenUsage as jc, IEventHistoryModule as ji, IProviderCapabilityTable as jl, IEventEmitterHierarchicalEventData as jn, IPluginContract as jo, UnsupportedShellError as jr, TToolExecutor as js, IHierarchicalOrchestrationSpec as jt, IContextWindowState as k, IMediaOutputRef as ka, IProviderRequest as kc, ISpinner as ki, TRoleModelMap as kl, ToolRegistry as kn, IPluginConfig as ko, IPlatformShellResolutionRequest as kr, IToolResult as ks, IGroupChatOrchestrationSpec as kt, lookupModelPrice as l, isConfirmed as la, composeEventName as lc, IToolSchemaProjectionProfile as li, AuthenticationError as ll, IAgentFactoryOptions as ln, IAgentConfig as lo, IStructuredOutputResolutionInput as lr, ICacheKey as ls, TToolRiskClass as lt, IToolWaitResponse as lu, formatTokenCount as m, IToolFactory as ma, IEventContext as mc, TOOL_SCHEMA_PROJECTION_MAX_NODES as mi, IProviderFailureDetails as ml, IToolResultSpillStore as mn, IToolWithEventService as mo, ISchemaClosureChange as mr, IExecutionJournal as ms, TResolveInWorkspace as mt, TContextData as mu, decodeHookVerdict as n, getToolEstimatedDuration as na, AbstractEventService as nc, AbstractPlugin as ni, TModelFallbackCallback as nl, isRegistryTransactionError as nn, TProviderModelLifecycle as no, IMediaProviderOverrides as nr, validateAgainstJsonSchema as ns, toolNameMatches as nt, isToolMessage as nu, MODEL_PRICES as o, CONFIRM_NO as oa, StructuredEventService as oc, TProviderLoggingData as oi, readProviderFailureDetails as ol, AgentTemplates as on, formatSupportedProviderTypes as oo, TEnvResolver as or, IZodSchemaDef as os, isProtectedPath as ot, IToolContinuation as ou, findModelDefinition as p, IOpenAPIToolConfig as pa, IBaseEventData as pc, TOOL_SCHEMA_PROJECTION_MAX_DEPTH as pi, EmptyCompletionError as pl, IToolResultAdmissionOptions as pn, IToolContract as po, hasValidationConstraints as pr, IExecutionContinuationState as ps, IReadOnlyCommandContext as pt, TConfigValue as pu, TToolArgs as q, IProviderModelCatalog as qa, IProviderSpecificOptions as qc, IConversationServiceOptions as qi, TUniversalMessage as ql, LocalExecutor as qn, IRunOptions as qo, validateProviderName as qr, TOOL_BODY_EVENTS as qs, collectAssistantUsageMetadata as qt, GuardrailExecutor as r, getToolExecutionSteps as ra, DEFAULT_ABSTRACT_EVENT_SERVICE as rc, AbstractAIProvider as ri, IProviderFailureClassification as rl, lifecycleOf as rn, TProviderSetupField as ro, createImageProviderFromDefinition as rr, ISchemaConversionOptions as rs, ICriticalPathContext as rt, isUserMessage as ru, calculateModelCost as s, CONFIRM_YES as sa, bindEventServiceOwner as sc, IToolSchemaProjection as si, scrubSecrets as sl, ITemplateApplicationResult as sn, getProviderCredentialRequirement as so, createRecordEnvResolver as sr, IResponseFormatConfig as ss, removesCriticalPath as st, IToolContinuationPrompt as su, isEnforcing as t, TToolProgressCallback as ta, TASK_EVENT_PREFIX as tc, AbstractExecutor as ti, IModelFallbackNotice as tl, IRegistryTransactionStep as tn, TProviderModelCatalogStatus as to, normalizeProviderConfig as tr, parseStructuredResponseText as ts, requiresFreshApproval as tt, isSystemMessage as tu, DEFAULT_CONTEXT_WINDOW as u, multiSelectAction as ua, generateSpanId as uc, PARAMETER_SCHEMA_KEYWORDS as ui, CacheIntegrityError as ul, IAgentLifecycleEvents as un, IAgentTemplate as uo, resolveStructuredOutputCapability as ur, ICacheOptions as us, UNCLASSIFIED_TOOL_FALLBACK as ut, IToolWaitState as uu, registerModelMetadata as v, IMediaProviderConfig as va, IExecutionEventData as vc, projectToolSchema as vi, ProviderError as vl, admitToolResult as vn, ILoggerOptions as vo, callJournaledProvider as vr, IResumeExecutionOptions as vs, TPermissionDecision$1 as vt, TToolParameters as vu, IContextTokenEstimateOptions as w, IImageEditRequest as wa, TEventUniversalValue as wc, IDirent as wi, TErrorContextData as wl, TOOL_EVENTS as wn, getGlobalLoggerSink as wo, subprocessTraceEnvironment as wr, IParameterValidationResult as ws, withEventEmission as wt, readTokenUsageFromMetadata as x, findMediaProviderDefinition as xa, TEventExtensionValue as xc, AbstractAgent as xi, SameToolInputLoopError as xl, IDestroyResult as xn, TUtilLogLevel as xo, outboundTraceContextFor as xr, TExecutionJournalRecord as xs, TTrustLevel as xt, IMessageTokenUsage as y, IMediaProviderCredentialRequirement as ya, IOwnerPathSegment as yc, AbstractManager as yi, RateLimitError as yl, wasToolResultAdmitted as yn, IUtilLogEntry as yo, buildTraceparent as yr, IResumeToolCallsOptions as ys, TPermissionMode as yt, TypeUtils as yu, IPermissionPolicyContext as z, isVideoGenerationProvider as za, TToolChoice as zc, ILocalExecutorConfig as zi, IInlineImageMessagePart as zl, TOutputRetention as zn, PluginCategory as zo, ExecutionSuspendedError as zr, IActionRequest as zs, TOrchestrationPrimitive as zt };
|
|
7301
|
+
//# sourceMappingURL=index-DQrmrFn9.d.ts.map
|