@robota-sdk/agent-core 3.0.0-beta.82 → 3.0.0-beta.84
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 +122 -0
- package/README.md +160 -110
- package/dist/browser/bounded-output-D3cgiOrh.js +2 -0
- package/dist/browser/bounded-output-D3cgiOrh.js.map +1 -0
- package/dist/browser/{command-executor-cI7XJ374.js → command-executor-BsBTcghZ.js} +2 -2
- package/dist/browser/{command-executor-cI7XJ374.js.map → command-executor-BsBTcghZ.js.map} +1 -1
- package/dist/browser/index.d.ts +1265 -892
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +11 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/node/bounded-output-D3cgiOrh.js +2 -0
- package/dist/node/bounded-output-D3cgiOrh.js.map +1 -0
- package/dist/node/{command-executor-DV-H2oD6.js → command-executor-BdE1zg3q.js} +2 -2
- package/dist/node/{command-executor-DV-H2oD6.js.map → command-executor-BdE1zg3q.js.map} +1 -1
- package/dist/node/{command-executor-Aat_q7P2.cjs → command-executor-CPGK8I8l.cjs} +1 -1
- package/dist/node/{http-executor-71JiIdFP.cjs → http-executor-BYiKn8h3.cjs} +1 -1
- package/dist/node/{index-BhfNtQJk.d.cts → index-DXZ-pyEr.d.ts} +1267 -893
- package/dist/node/index-DXZ-pyEr.d.ts.map +1 -0
- package/dist/node/{index-D2rky0wZ.d.ts → index-gEUh4G-t.d.cts} +1267 -893
- package/dist/node/index-gEUh4G-t.d.cts.map +1 -0
- package/dist/node/index.cjs +9 -9
- package/dist/node/index.d.cts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +9 -9
- 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-BQ-sKCQS.d.cts} +3 -4
- package/dist/node/types-BQ-sKCQS.d.cts.map +1 -0
- package/dist/node/{types-gNrckgFE.d.cts → types-BQ-sKCQS.d.ts} +3 -4
- package/dist/node/types-BQ-sKCQS.d.ts.map +1 -0
- package/dist/node/verdict-decoder-D412SAGd.cjs +1 -0
- package/package.json +8 -4
- package/dist/browser/bounded-output-DpjpS98g.js +0 -2
- package/dist/browser/bounded-output-DpjpS98g.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-BhfNtQJk.d.cts.map +0 -1
- package/dist/node/index-D2rky0wZ.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-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-BQ-sKCQS.cjs";
|
|
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
|
|
@@ -573,11 +468,24 @@ declare class SameToolInputLoopError extends RobotaError {
|
|
|
573
468
|
* Model not available errors
|
|
574
469
|
*/
|
|
575
470
|
declare class ModelNotAvailableError extends RobotaError {
|
|
471
|
+
/** `undefined` when the failure names no model — a provider adapter classifying a raw HTTP
|
|
472
|
+
* response by status alone does not always know which model the vendor meant. */
|
|
473
|
+
readonly model: string | undefined;
|
|
474
|
+
readonly provider: string;
|
|
576
475
|
readonly availableModels?: string[] | undefined;
|
|
577
476
|
readonly code = "MODEL_NOT_AVAILABLE";
|
|
578
477
|
readonly category: "user";
|
|
579
478
|
readonly recoverable = false;
|
|
580
|
-
constructor(
|
|
479
|
+
constructor(
|
|
480
|
+
/** `undefined` when the failure names no model — a provider adapter classifying a raw HTTP
|
|
481
|
+
* response by status alone does not always know which model the vendor meant. */
|
|
482
|
+
model: string | undefined, provider: string, availableModels?: string[] | undefined,
|
|
483
|
+
/**
|
|
484
|
+
* `context.originalMessage`, when given, is the vendor's own text (already scrubbed of any
|
|
485
|
+
* credential by the caller) — folded into `message` so a "Details" disclosure built from
|
|
486
|
+
* `message` alone still shows the real cause instead of just this class's fixed sentence.
|
|
487
|
+
*/
|
|
488
|
+
context?: TErrorContextData);
|
|
581
489
|
}
|
|
582
490
|
/**
|
|
583
491
|
* Circuit breaker open error
|
|
@@ -618,6 +526,25 @@ declare class CacheIntegrityError extends RobotaError {
|
|
|
618
526
|
}
|
|
619
527
|
//#endregion
|
|
620
528
|
//#region src/utils/provider-failure.d.ts
|
|
529
|
+
/**
|
|
530
|
+
* Strip anything that reads like a credential out of vendor text before it is kept on a typed error.
|
|
531
|
+
* A vendor's error body is not supposed to echo request headers, but a misconfigured self-hosted
|
|
532
|
+
* gateway can bounce the raw request back (an `Authorization` header, a `Bearer` token, an `api_key=`
|
|
533
|
+
* query parameter, or the whole request re-serialized as JSON) — this runs once, ahead of every
|
|
534
|
+
* classification below, so nothing built from `message` (the wire frame's `message`, a GUI "Details"
|
|
535
|
+
* disclosure) can leak one.
|
|
536
|
+
*
|
|
537
|
+
* Each pattern gets its own fixed replacement, bounded to the credential token — never a shared
|
|
538
|
+
* callback keyed on "does this match have a capture group", which for a pattern with none receives
|
|
539
|
+
* the match's numeric offset instead of `undefined` and silently prints that number.
|
|
540
|
+
*
|
|
541
|
+
* The key-name and value quotes are each optional and captured (`(")?`) rather than matched and
|
|
542
|
+
* dropped: JSON re-serializes a header as `"Authorization": "Bearer sk-..."`, and the closing quote
|
|
543
|
+
* right after the key name breaks a match that only expects `\s*[:=]` next — capturing it lets the
|
|
544
|
+
* replacement echo it back (`Authorization$1: $2[REDACTED]`) so quoted and unquoted text both read
|
|
545
|
+
* naturally, and `SECRET_VALUE` excluding `"` leaves a closing value quote alone to survive untouched.
|
|
546
|
+
*/
|
|
547
|
+
declare function scrubSecrets(text: string): string;
|
|
621
548
|
/** Why a provider call failed, as far as switching models is concerned. */
|
|
622
549
|
type TProviderFailureReason = 'overloaded' | 'service-unavailable' | 'server-error' | 'model-unavailable' | 'authentication' | 'billing' | 'rate-limit' | 'invalid-request' | 'network' | 'aborted' | 'unknown';
|
|
623
550
|
interface IProviderFailureClassification {
|
|
@@ -637,9 +564,15 @@ declare function readProviderFailureDetails(error: unknown): IProviderFailureDet
|
|
|
637
564
|
/**
|
|
638
565
|
* Turn whatever an adapter caught into a typed provider failure.
|
|
639
566
|
*
|
|
640
|
-
* Aborts and errors already in the taxonomy pass through unchanged
|
|
641
|
-
*
|
|
642
|
-
*
|
|
567
|
+
* Aborts and errors already in the taxonomy pass through unchanged. Everything else is classified by
|
|
568
|
+
* the same status/type rules `classifyLayer` uses to decide switchability — a rate limit, an
|
|
569
|
+
* authentication failure, a model the vendor does not serve, and a transport failure each become
|
|
570
|
+
* their own typed error (so `AuthenticationError`/`ModelNotAvailableError`/`NetworkError` are actually
|
|
571
|
+
* thrown, not just recognized after the fact); anything left over becomes a `ProviderError` carrying
|
|
572
|
+
* the status and type the vendor reported, with the original kept as `originalError`. Every branch
|
|
573
|
+
* keeps the vendor's own (scrubbed) message and status/type — as the text baked into `message` for
|
|
574
|
+
* the types that already carry a free-form one, and as `context` alongside it — so a "Details"
|
|
575
|
+
* disclosure built from `message` downstream never has less to say than the vendor did.
|
|
643
576
|
*/
|
|
644
577
|
declare function toProviderError(error: unknown, provider: string, operation: string): Error;
|
|
645
578
|
/**
|
|
@@ -871,6 +804,19 @@ interface ITokenUsage {
|
|
|
871
804
|
completionTokens: number;
|
|
872
805
|
totalTokens: number;
|
|
873
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* The usage triple ({@link ITokenUsage}) plus the prompt-cache read a provider reported for it.
|
|
809
|
+
*
|
|
810
|
+
* Derived from the triple rather than widening it: the triple is also the persisted and wired usage
|
|
811
|
+
* shape (background-task results, subagent IPC), whose decoders declare exactly its three keys.
|
|
812
|
+
*/
|
|
813
|
+
interface ITokenUsageWithCacheRead extends ITokenUsage {
|
|
814
|
+
/**
|
|
815
|
+
* The part of `promptTokens` the provider served from its prompt cache — a subset of
|
|
816
|
+
* `promptTokens`, not an addition to it. Present only when the provider reported it.
|
|
817
|
+
*/
|
|
818
|
+
cacheReadTokens?: number;
|
|
819
|
+
}
|
|
874
820
|
/**
|
|
875
821
|
* Raw provider response interface
|
|
876
822
|
*/
|
|
@@ -1133,213 +1079,306 @@ type TProviderOptionValueBase = string | number | boolean | undefined | null | T
|
|
|
1133
1079
|
[key: string]: TProviderOptionValueBase;
|
|
1134
1080
|
};
|
|
1135
1081
|
//#endregion
|
|
1136
|
-
//#region src/interfaces
|
|
1082
|
+
//#region src/event-service/interfaces.d.ts
|
|
1137
1083
|
/**
|
|
1138
|
-
*
|
|
1084
|
+
* @fileoverview Event service interface definitions.
|
|
1085
|
+
*
|
|
1086
|
+
* These interfaces are the single source of truth for event-related contracts
|
|
1087
|
+
* within @robota-sdk/agent-core.
|
|
1139
1088
|
*/
|
|
1140
|
-
interface IResponseFormatConfig {
|
|
1141
|
-
type?: 'text' | 'json_object' | 'json_schema';
|
|
1142
|
-
/** JSON schema payload; required when `type` is `'json_schema'` (CORE-015). */
|
|
1143
|
-
schema?: Record<string, TConfigValue>;
|
|
1144
|
-
/** Schema name forwarded to provider native structured-output surfaces. */
|
|
1145
|
-
name?: string;
|
|
1146
|
-
}
|
|
1147
1089
|
/**
|
|
1148
|
-
*
|
|
1090
|
+
* Primitive value types for event payloads.
|
|
1149
1091
|
*/
|
|
1150
|
-
|
|
1151
|
-
category: string;
|
|
1152
|
-
threshold: string;
|
|
1153
|
-
[key: string]: TConfigValue;
|
|
1154
|
-
}
|
|
1155
|
-
//#endregion
|
|
1156
|
-
//#region src/schema/zod-schema-types.d.ts
|
|
1157
|
-
interface IZodParseResult {
|
|
1158
|
-
success: boolean;
|
|
1159
|
-
data?: unknown;
|
|
1160
|
-
error?: unknown;
|
|
1161
|
-
}
|
|
1162
|
-
interface IZodSchemaDef {
|
|
1163
|
-
typeName?: string;
|
|
1164
|
-
innerType?: IZodSchema;
|
|
1165
|
-
valueType?: IZodSchema;
|
|
1166
|
-
checks?: Array<{
|
|
1167
|
-
kind: string;
|
|
1168
|
-
value?: TUniversalValue;
|
|
1169
|
-
}>;
|
|
1170
|
-
shape?: () => Record<string, IZodSchema>;
|
|
1171
|
-
type?: IZodSchema;
|
|
1172
|
-
/**
|
|
1173
|
-
* `ZodEnum` holds an ARRAY here; `ZodNativeEnum` holds the enum OBJECT itself (CORE-041). One Zod
|
|
1174
|
-
* field name, two shapes — the converter narrows before reading it.
|
|
1175
|
-
*/
|
|
1176
|
-
values?: TUniversalValue[] | Record<string, TUniversalValue>;
|
|
1177
|
-
description?: string;
|
|
1178
|
-
unknownKeys?: 'passthrough' | 'strip' | 'strict';
|
|
1179
|
-
/** `ZodEffects` (`.refine()` / `.transform()`) holds the schema it wraps here. */
|
|
1180
|
-
schema?: IZodSchema;
|
|
1181
|
-
/** `ZodUnion` / `ZodDiscriminatedUnion` members. */
|
|
1182
|
-
options?: IZodSchema[];
|
|
1183
|
-
/** `ZodLiteral` value. */
|
|
1184
|
-
value?: TUniversalValue;
|
|
1185
|
-
}
|
|
1186
|
-
interface IZodSchema {
|
|
1187
|
-
parse(value: unknown): unknown;
|
|
1188
|
-
safeParse(value: unknown): IZodParseResult;
|
|
1189
|
-
_def?: IZodSchemaDef;
|
|
1190
|
-
}
|
|
1092
|
+
type TEventPrimitiveValue = string | number | boolean | null | undefined;
|
|
1191
1093
|
/**
|
|
1192
|
-
*
|
|
1094
|
+
* Recursive universal value type for event payloads (JSON-like + Date).
|
|
1193
1095
|
*/
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
allowAdditionalProperties?: boolean;
|
|
1198
|
-
}
|
|
1199
|
-
//#endregion
|
|
1200
|
-
//#region src/schema/structured-output.d.ts
|
|
1201
|
-
/** Explicit raw-JSON-schema form of `IRunOptions.output`. */
|
|
1202
|
-
interface IJsonSchemaOutput {
|
|
1203
|
-
/** JSON Schema (object root, universal subset) the response must match. */
|
|
1204
|
-
jsonSchema: IToolSchema['parameters'];
|
|
1205
|
-
/** Optional schema name forwarded to provider native surfaces. */
|
|
1206
|
-
name?: string;
|
|
1207
|
-
}
|
|
1208
|
-
/** Accepted `IRunOptions.output` values: a Zod schema or an explicit JSON-schema wrapper. */
|
|
1209
|
-
type TStructuredOutputSchema = IZodSchema | IJsonSchemaOutput;
|
|
1210
|
-
type TStructuredOutputValidation = {
|
|
1211
|
-
success: true;
|
|
1212
|
-
value: unknown;
|
|
1213
|
-
} | {
|
|
1214
|
-
success: false;
|
|
1215
|
-
issues: string[];
|
|
1216
|
-
};
|
|
1217
|
-
/** Internal SSOT representation every `output` value normalizes to. */
|
|
1218
|
-
interface IStructuredOutputSpec {
|
|
1219
|
-
name: string;
|
|
1220
|
-
jsonSchema: IToolSchema['parameters'];
|
|
1221
|
-
validate(value: unknown): TStructuredOutputValidation;
|
|
1096
|
+
type TEventUniversalValue = TEventPrimitiveValue | Date | TEventUniversalValue[] | IEventObjectValue;
|
|
1097
|
+
interface IEventObjectValue {
|
|
1098
|
+
[key: string]: TEventUniversalValue;
|
|
1222
1099
|
}
|
|
1223
|
-
/** Normalize an accepted `output` value into the internal spec. */
|
|
1224
|
-
declare function normalizeStructuredOutput(output: TStructuredOutputSchema): IStructuredOutputSpec;
|
|
1225
1100
|
/**
|
|
1226
|
-
*
|
|
1227
|
-
* required, enum, items, nested properties, unions and numeric bounds — the full expressible
|
|
1228
|
-
* surface of the subset, at every level.
|
|
1229
|
-
*
|
|
1230
|
-
* CORE-039: this is the ONE complete walk. `parameter-validator` delegates its depth here rather
|
|
1231
|
-
* than keeping a second, shallower copy, and the two must therefore agree by construction.
|
|
1101
|
+
* Logger data type for event metadata.
|
|
1232
1102
|
*/
|
|
1233
|
-
|
|
1103
|
+
type TEventLoggerData = Record<string, TEventUniversalValue | Date | Error>;
|
|
1234
1104
|
/**
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1105
|
+
* A single segment in an explicit ownerPath.
|
|
1106
|
+
*
|
|
1107
|
+
* Path-only rule:
|
|
1108
|
+
* - Relationships must be derived from these explicit segments, not from parsing IDs.
|
|
1238
1109
|
*/
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1110
|
+
interface IOwnerPathSegment {
|
|
1111
|
+
type: string;
|
|
1112
|
+
id: string;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Event context that accompanies an emitted event.
|
|
1116
|
+
* This is the single source of truth for deterministic linking in subscribers.
|
|
1117
|
+
*/
|
|
1118
|
+
interface IEventContext {
|
|
1119
|
+
ownerType: string;
|
|
1120
|
+
ownerId: string;
|
|
1121
|
+
ownerPath: IOwnerPathSegment[];
|
|
1122
|
+
/** Depth of the current execution in the hierarchy (0 = root) */
|
|
1123
|
+
depth?: number;
|
|
1124
|
+
/** Unique span identifier for distributed tracing correlation */
|
|
1125
|
+
spanId?: string;
|
|
1126
|
+
/** Optional structured metadata for debugging/observability */
|
|
1127
|
+
metadata?: TEventLoggerData;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Allowed extension values for event payloads.
|
|
1131
|
+
*/
|
|
1132
|
+
type TEventExtensionValue = TEventUniversalValue | TEventLoggerData | Error | IEventContext | IOwnerPathSegment[];
|
|
1133
|
+
/**
|
|
1134
|
+
* Base event payload shape.
|
|
1135
|
+
* Emitters may add additional fields, but MUST keep linkage information explicit.
|
|
1136
|
+
*/
|
|
1137
|
+
interface IBaseEventData {
|
|
1138
|
+
/** Timestamp when the event was emitted. This is required for deterministic ordering. */
|
|
1139
|
+
timestamp: Date;
|
|
1140
|
+
/** Optional structured metadata */
|
|
1141
|
+
metadata?: TEventLoggerData;
|
|
1142
|
+
/** Extensible fields for event-specific payloads */
|
|
1143
|
+
[key: string]: TEventExtensionValue | undefined;
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Execution-related event payload.
|
|
1147
|
+
*/
|
|
1148
|
+
interface IExecutionEventData extends IBaseEventData {}
|
|
1149
|
+
/**
|
|
1150
|
+
* Tool-related event payload.
|
|
1151
|
+
*/
|
|
1152
|
+
interface IToolEventData extends IBaseEventData {
|
|
1153
|
+
toolName?: string;
|
|
1154
|
+
parameters?: Record<string, TEventUniversalValue>;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Agent-related event payload.
|
|
1158
|
+
*/
|
|
1159
|
+
interface IAgentEventData extends IBaseEventData {
|
|
1160
|
+
agentId?: string;
|
|
1161
|
+
}
|
|
1162
|
+
type TEventListener = (eventType: string, data: IBaseEventData, context?: IEventContext) => void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Minimal EventService contract for emitting events.
|
|
1165
|
+
*/
|
|
1166
|
+
interface IEventService {
|
|
1167
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1168
|
+
subscribe(listener: TEventListener): void;
|
|
1169
|
+
unsubscribe(listener: TEventListener): void;
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Explicit owner binding information used for scoped event emission.
|
|
1173
|
+
*/
|
|
1174
|
+
interface IEventServiceOwnerBinding {
|
|
1175
|
+
ownerType: string;
|
|
1176
|
+
ownerId: string;
|
|
1177
|
+
ownerPath: IOwnerPathSegment[];
|
|
1178
|
+
}
|
|
1179
|
+
//#endregion
|
|
1180
|
+
//#region src/event-service/event-service.d.ts
|
|
1181
|
+
/**
|
|
1182
|
+
* Abstract base for event services.
|
|
1183
|
+
* Concrete implementations decide how events are delivered.
|
|
1184
|
+
*/
|
|
1185
|
+
declare abstract class AbstractEventService implements IEventService {
|
|
1186
|
+
private listeners;
|
|
1187
|
+
abstract emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1188
|
+
subscribe(listener: TEventListener): void;
|
|
1189
|
+
unsubscribe(listener: TEventListener): void;
|
|
1190
|
+
protected notifyListeners(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Default no-op event service (production-safe).
|
|
1194
|
+
* When injected, emit() intentionally does nothing.
|
|
1195
|
+
*/
|
|
1196
|
+
declare class DefaultEventService extends AbstractEventService {
|
|
1197
|
+
emit(_eventType: string, _data: IBaseEventData, _context?: IEventContext): void;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Singleton default event service instance.
|
|
1201
|
+
*/
|
|
1202
|
+
declare const DEFAULT_ABSTRACT_EVENT_SERVICE: IEventService;
|
|
1203
|
+
/**
|
|
1204
|
+
* Check if a given service is the default no-op implementation.
|
|
1205
|
+
*/
|
|
1206
|
+
declare function isDefaultEventService(service: IEventService): boolean;
|
|
1207
|
+
/**
|
|
1208
|
+
* Compose a full event name from owner prefix and local name.
|
|
1209
|
+
* Local names must not contain dots.
|
|
1210
|
+
*/
|
|
1211
|
+
declare function composeEventName(ownerType: string, localName: string): string;
|
|
1212
|
+
/**
|
|
1213
|
+
* Generate a unique span ID for distributed tracing correlation. Exported so a per-operation timing
|
|
1214
|
+
* source (SELFHOST-004) can mint a span id it puts on BOTH the event payload and the event context.
|
|
1215
|
+
*/
|
|
1216
|
+
declare function generateSpanId(): string;
|
|
1217
|
+
/**
|
|
1218
|
+
* A scoped event service that always emits with an owner binding applied.
|
|
1219
|
+
*/
|
|
1220
|
+
declare class StructuredEventService extends AbstractEventService {
|
|
1221
|
+
private readonly base;
|
|
1222
|
+
private readonly binding;
|
|
1223
|
+
constructor(base: IEventService, binding: IEventServiceOwnerBinding);
|
|
1224
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1225
|
+
subscribe(listener: TEventListener): void;
|
|
1226
|
+
unsubscribe(listener: TEventListener): void;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Bind an EventService to an explicit owner path.
|
|
1230
|
+
* This is the standard entry point for scoped emission (path-only architecture).
|
|
1231
|
+
*/
|
|
1232
|
+
declare function bindWithOwnerPath(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
1233
|
+
/**
|
|
1234
|
+
* Alias for bindWithOwnerPath for historical call sites.
|
|
1235
|
+
* Intentionally forwards to the single authoritative implementation.
|
|
1236
|
+
*/
|
|
1237
|
+
declare function bindEventServiceOwner(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
1238
|
+
/**
|
|
1239
|
+
* Observable EventService that notifies subscribed listeners.
|
|
1240
|
+
*/
|
|
1241
|
+
declare class ObservableEventService extends AbstractEventService {
|
|
1242
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
1243
|
+
}
|
|
1244
|
+
//#endregion
|
|
1245
|
+
//#region src/event-service/task-events.d.ts
|
|
1246
|
+
declare const TASK_EVENTS: {
|
|
1247
|
+
readonly ASSIGNED: "assigned";
|
|
1248
|
+
readonly COMPLETED: "completed";
|
|
1245
1249
|
};
|
|
1250
|
+
declare const TASK_EVENT_PREFIX: "task";
|
|
1246
1251
|
//#endregion
|
|
1247
|
-
//#region src/
|
|
1252
|
+
//#region src/event-service/user-events.d.ts
|
|
1253
|
+
declare const USER_EVENTS: {
|
|
1254
|
+
readonly MESSAGE: "message";
|
|
1255
|
+
readonly INPUT: "input";
|
|
1256
|
+
};
|
|
1257
|
+
declare const USER_EVENT_PREFIX: "user";
|
|
1258
|
+
type TUserEvent = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
|
|
1259
|
+
//#endregion
|
|
1260
|
+
//#region src/event-service/span-events.d.ts
|
|
1248
1261
|
/**
|
|
1249
|
-
*
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
* Split out of `agent.ts` when PEER-007 added `driverId`. That file sits at a frozen size baseline,
|
|
1253
|
-
* and the anti-monolith rule asks for a split rather than one more field on a file already at its
|
|
1254
|
-
* limit. The two execution-event types come along because `onExecutionEvent` is their only consumer
|
|
1255
|
-
* — leaving them behind would have made this module import back from `agent.ts`.
|
|
1262
|
+
* SELFHOST-004: per-operation span lifecycle event names. Mirrors the `TASK_EVENTS`/`USER_EVENTS`
|
|
1263
|
+
* pattern (a const name set + a prefix). The local name is distinctive (`span_completed`, not a bare
|
|
1264
|
+
* `completed`) so a consumer can identify a span-completion regardless of the emitting owner's prefix.
|
|
1256
1265
|
*/
|
|
1257
|
-
|
|
1258
|
-
|
|
1266
|
+
declare const SPAN_EVENTS: {
|
|
1267
|
+
readonly COMPLETED: "span_completed";
|
|
1268
|
+
};
|
|
1269
|
+
/** Content-free completion of one provider round, separate from legacy tool timing events. */
|
|
1270
|
+
declare const PROVIDER_CALL_EVENTS: {
|
|
1271
|
+
readonly COMPLETED: "provider_call_completed";
|
|
1272
|
+
};
|
|
1273
|
+
/** A provider request moved to another model after the one it was on failed. */
|
|
1274
|
+
declare const PROVIDER_FALLBACK_EVENTS: {
|
|
1275
|
+
readonly SWITCHED: "provider_fallback";
|
|
1276
|
+
};
|
|
1277
|
+
/** The notice a `provider_fallback` event carries, or `undefined` when the payload is malformed. */
|
|
1278
|
+
declare function readModelFallbackNotice(data: Readonly<Record<string, unknown>>): IModelFallbackNotice | undefined;
|
|
1279
|
+
/** Content-free completion of the body actually awaited by one permitted tool call. */
|
|
1280
|
+
declare const TOOL_BODY_EVENTS: {
|
|
1281
|
+
readonly COMPLETED: "tool_body_completed";
|
|
1282
|
+
};
|
|
1283
|
+
/** Content-free decision reached for one tool call before any body runs. */
|
|
1284
|
+
declare const TOOL_PERMISSION_EVENTS: {
|
|
1285
|
+
readonly DECIDED: "tool_permission_decided";
|
|
1286
|
+
};
|
|
1287
|
+
declare const SPAN_EVENT_PREFIX: "span";
|
|
1288
|
+
type TSpanEvent = (typeof SPAN_EVENTS)[keyof typeof SPAN_EVENTS];
|
|
1259
1289
|
/**
|
|
1260
|
-
*
|
|
1290
|
+
* SELFHOST-004: span-completion event payload — JOINS the span id with its measured duration and the
|
|
1291
|
+
* operation name (raw scalars ONLY; references no transport type). Emitted by the per-operation timing
|
|
1292
|
+
* source (e.g. `FunctionTool`) so a consuming layer (`agent-framework`) can build a record span entry
|
|
1293
|
+
* WITHOUT `agent-core` depending on `agent-interface-transport` (no cycle). The payload `spanId` is the
|
|
1294
|
+
* AUTHORITATIVE id a consumer reads; owner/turn correlation is applied by the event service's binding
|
|
1295
|
+
* (`ownerPath` on the emitted `IEventContext`). Note the context's own auto-minted `spanId` is a
|
|
1296
|
+
* separate scope tag and need not equal this payload id — always read the payload id for the span.
|
|
1261
1297
|
*/
|
|
1262
|
-
interface
|
|
1263
|
-
/**
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
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
|
-
|
|
1298
|
+
interface ISpanCompletionEventData extends IBaseEventData {
|
|
1299
|
+
/** The span id (equals the emitted event's context `spanId`). */
|
|
1300
|
+
spanId: string;
|
|
1301
|
+
/** Measured wall-clock duration of the operation, in milliseconds. */
|
|
1302
|
+
durationMs: number;
|
|
1303
|
+
/** The operation name (e.g. the tool name). */
|
|
1304
|
+
op: string;
|
|
1305
|
+
}
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/interfaces/interaction.d.ts
|
|
1308
|
+
/**
|
|
1309
|
+
* UI-agnostic "ask the user" contract (CMD-004).
|
|
1310
|
+
*
|
|
1311
|
+
* The SSOT for the interaction action lives in agent-core so every interaction *source* can reach it:
|
|
1312
|
+
* command execution (`ICommandHostContext`, agent-framework) AND tool execution
|
|
1313
|
+
* (`IToolExecutionContext`, agent-core, for model-issued questions — CMD-005). These are pure types
|
|
1314
|
+
* with no runtime dependency, so the contract crosses a serialization/transport boundary unchanged
|
|
1315
|
+
* (no function-valued fields).
|
|
1316
|
+
*
|
|
1317
|
+
* A single shape covers every interaction kind, parameterised by fields rather than split into
|
|
1318
|
+
* variants:
|
|
1319
|
+
* - confirm → two options, `maxSelect` 1
|
|
1320
|
+
* - single → options, `maxSelect` 1
|
|
1321
|
+
* - multi → options, `maxSelect` > 1
|
|
1322
|
+
* - free text → no options, `allowFreeText` true
|
|
1323
|
+
* - secret → free text with `masked` true
|
|
1324
|
+
*/
|
|
1325
|
+
/** One predefined option the user can choose. */
|
|
1326
|
+
interface IActionOption {
|
|
1327
|
+
value: string;
|
|
1328
|
+
label: string;
|
|
1329
|
+
description?: string;
|
|
1330
|
+
}
|
|
1331
|
+
/** Pre-selected option values and/or prefilled free text for an action request. */
|
|
1332
|
+
interface IActionDefault {
|
|
1333
|
+
values?: readonly string[];
|
|
1334
|
+
text?: string;
|
|
1335
|
+
}
|
|
1336
|
+
/** One request for the user to answer. See the module doc for how the fields encode each kind. */
|
|
1337
|
+
interface IActionRequest {
|
|
1338
|
+
/** Correlation key; the ask port resolves a given id exactly once (idempotent, first-answer wins). */
|
|
1339
|
+
id: string;
|
|
1340
|
+
title: string;
|
|
1341
|
+
description?: string;
|
|
1342
|
+
/** Predefined options. Empty/omitted ⇒ pure free-text entry. */
|
|
1343
|
+
options?: readonly IActionOption[];
|
|
1344
|
+
/** Minimum selections required (default 1). */
|
|
1345
|
+
minSelect?: number;
|
|
1346
|
+
/** Maximum selections allowed (default 1 ⇒ single; > 1 ⇒ multi). */
|
|
1347
|
+
maxSelect?: number;
|
|
1348
|
+
/** Allow a typed custom answer in addition to / instead of the options. */
|
|
1349
|
+
allowFreeText?: boolean;
|
|
1350
|
+
/** Free-text entry is masked (secret entry such as an API key); the renderer hides input. */
|
|
1351
|
+
masked?: boolean;
|
|
1352
|
+
/** Allow submitting empty free text. */
|
|
1353
|
+
allowEmpty?: boolean;
|
|
1354
|
+
/** Placeholder shown in the free-text field. */
|
|
1355
|
+
placeholder?: string;
|
|
1356
|
+
/** Maximum options shown before scrolling (renderer hint). */
|
|
1357
|
+
maxVisible?: number;
|
|
1358
|
+
/** Pre-selected option values and/or prefilled free text. */
|
|
1359
|
+
default?: IActionDefault;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* The user's answer to an {@link IActionRequest}. `answer` carries the selected option values and/or
|
|
1363
|
+
* the typed text; `cancelled` means the user dismissed the request, or no interactive renderer was
|
|
1364
|
+
* available to answer it.
|
|
1365
|
+
*/
|
|
1366
|
+
type TActionResponse = {
|
|
1367
|
+
type: 'answer';
|
|
1368
|
+
values: readonly string[];
|
|
1369
|
+
text?: string;
|
|
1370
|
+
} | {
|
|
1371
|
+
type: 'cancelled';
|
|
1372
|
+
};
|
|
1373
|
+
/**
|
|
1374
|
+
* The injected "ask the user" port — a single seam reachable by every interaction source (command
|
|
1375
|
+
* execution now; tool execution for model-issued questions later) and rendered per-environment by each
|
|
1376
|
+
* transport. The concurrency model (broadcast to attached interactive channels, first answer wins,
|
|
1377
|
+
* later answers for an already-resolved `id` ignored) is owned by the port implementation, not the
|
|
1378
|
+
* contract.
|
|
1379
|
+
*/
|
|
1380
|
+
interface IUserInteraction {
|
|
1381
|
+
ask(request: IActionRequest): Promise<TActionResponse>;
|
|
1343
1382
|
}
|
|
1344
1383
|
//#endregion
|
|
1345
1384
|
//#region src/interfaces/tool-search.d.ts
|
|
@@ -1363,660 +1402,898 @@ type TToolSearchMode = 'on' | 'off';
|
|
|
1363
1402
|
*
|
|
1364
1403
|
* Narrow on purpose: a tool that can list and load must not be able to register, remove or execute.
|
|
1365
1404
|
*/
|
|
1366
|
-
interface IDeferredToolCatalog {
|
|
1367
|
-
/**
|
|
1368
|
-
* Deferred tools not yet loaded — the population a search can still discover. Empty while
|
|
1369
|
-
* deferral is not engaged, because nothing is withheld then.
|
|
1370
|
-
*/
|
|
1371
|
-
listDeferredTools(): IToolSchema[];
|
|
1372
|
-
/**
|
|
1373
|
-
* Mark the named deferred tools loaded for the rest of the session and return their schemas. A
|
|
1374
|
-
* resident name is returned as it is (it was never withheld); an unknown name throws, naming the
|
|
1375
|
-
* entry, and then nothing is loaded — the check runs over every name before the first load.
|
|
1376
|
-
*/
|
|
1377
|
-
loadDeferredTools(names: readonly string[]): IToolSchema[];
|
|
1378
|
-
}
|
|
1379
|
-
//#endregion
|
|
1380
|
-
//#region src/plugins/event-emitter/types.d.ts
|
|
1381
|
-
declare const EXECUTION_EVENT_NAMES: {
|
|
1382
|
-
readonly START: "execution.start";
|
|
1383
|
-
readonly COMPLETE: "execution.complete";
|
|
1384
|
-
readonly ERROR: "execution.error";
|
|
1385
|
-
};
|
|
1386
|
-
declare const TOOL_EVENT_NAMES: {
|
|
1387
|
-
readonly CALL_START: "tool.call_start";
|
|
1388
|
-
readonly CALL_COMPLETE: "tool.call_complete";
|
|
1389
|
-
readonly CALL_ERROR: "tool.call_error";
|
|
1390
|
-
};
|
|
1391
|
-
declare const AGENT_EVENT_NAMES: {
|
|
1392
|
-
readonly EXECUTION_START: "agent.execution_start";
|
|
1393
|
-
readonly EXECUTION_COMPLETE: "agent.execution_complete";
|
|
1394
|
-
readonly EXECUTION_ERROR: "agent.execution_error";
|
|
1395
|
-
readonly CREATED: "agent.created";
|
|
1396
|
-
};
|
|
1397
|
-
type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
|
|
1398
|
-
type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
|
|
1399
|
-
type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
|
|
1400
|
-
/**
|
|
1401
|
-
* Event types that can be emitted.
|
|
1402
|
-
*
|
|
1403
|
-
* IMPORTANT:
|
|
1404
|
-
* - Do not use string literals for event names outside this module.
|
|
1405
|
-
* - Import and use EVENT_EMITTER_EVENTS instead.
|
|
1406
|
-
*/
|
|
1407
|
-
declare const EVENT_EMITTER_EVENTS: {
|
|
1408
|
-
readonly EXECUTION_START: "execution.start";
|
|
1409
|
-
readonly EXECUTION_COMPLETE: "execution.complete";
|
|
1410
|
-
readonly EXECUTION_ERROR: "execution.error";
|
|
1411
|
-
readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
|
|
1412
|
-
readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
|
|
1413
|
-
readonly TOOL_SUCCESS: "tool.success";
|
|
1414
|
-
readonly TOOL_ERROR: "tool.call_error";
|
|
1415
|
-
readonly CONVERSATION_START: "conversation.start";
|
|
1416
|
-
readonly CONVERSATION_COMPLETE: "conversation.complete";
|
|
1417
|
-
readonly CONVERSATION_ERROR: "conversation.error";
|
|
1418
|
-
readonly AGENT_EXECUTION_START: "agent.execution_start";
|
|
1419
|
-
readonly AGENT_EXECUTION_COMPLETE: "agent.execution_complete";
|
|
1420
|
-
readonly AGENT_EXECUTION_ERROR: "agent.execution_error";
|
|
1421
|
-
readonly AGENT_CREATED: "agent.created";
|
|
1422
|
-
readonly AGENT_DESTROYED: "agent.destroyed";
|
|
1423
|
-
readonly PLUGIN_LOADED: "plugin.loaded";
|
|
1424
|
-
readonly PLUGIN_UNLOADED: "plugin.unloaded";
|
|
1425
|
-
readonly PLUGIN_ERROR: "plugin.error";
|
|
1426
|
-
readonly ERROR_OCCURRED: "error.occurred";
|
|
1427
|
-
readonly WARNING_OCCURRED: "warning.occurred";
|
|
1428
|
-
readonly MODULE_INITIALIZE_START: "module.initialize.start";
|
|
1429
|
-
readonly MODULE_INITIALIZE_COMPLETE: "module.initialize.complete";
|
|
1430
|
-
readonly MODULE_INITIALIZE_ERROR: "module.initialize.error";
|
|
1431
|
-
readonly MODULE_EXECUTION_START: "module.execution.start";
|
|
1432
|
-
readonly MODULE_EXECUTION_COMPLETE: "module.execution.complete";
|
|
1433
|
-
readonly MODULE_EXECUTION_ERROR: "module.execution.error";
|
|
1434
|
-
readonly MODULE_DISPOSE_START: "module.dispose.start";
|
|
1435
|
-
readonly MODULE_DISPOSE_COMPLETE: "module.dispose.complete";
|
|
1436
|
-
readonly MODULE_DISPOSE_ERROR: "module.dispose.error";
|
|
1437
|
-
readonly MODULE_REGISTERED: "module.registered";
|
|
1438
|
-
readonly MODULE_UNREGISTERED: "module.unregistered";
|
|
1439
|
-
readonly EXECUTION_HIERARCHY: "execution.hierarchy";
|
|
1440
|
-
readonly EXECUTION_REALTIME: "execution.realtime";
|
|
1441
|
-
readonly TOOL_REALTIME: "tool.realtime";
|
|
1442
|
-
readonly CUSTOM: "custom";
|
|
1443
|
-
};
|
|
1444
|
-
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';
|
|
1445
|
-
/**
|
|
1446
|
-
* Valid event data value types
|
|
1447
|
-
*/
|
|
1448
|
-
type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
|
|
1449
|
-
[key: string]: TEventDataValue;
|
|
1450
|
-
};
|
|
1451
|
-
/**
|
|
1452
|
-
* Event data structure
|
|
1453
|
-
*/
|
|
1454
|
-
interface IEventEmitterEventData {
|
|
1455
|
-
type: TEventName;
|
|
1456
|
-
timestamp: Date;
|
|
1457
|
-
executionId?: string;
|
|
1458
|
-
sessionId?: string;
|
|
1459
|
-
userId?: string;
|
|
1460
|
-
data?: Record<string, TEventDataValue>;
|
|
1461
|
-
error?: Error;
|
|
1462
|
-
metadata?: Record<string, TEventDataValue>;
|
|
1463
|
-
}
|
|
1464
|
-
/**
|
|
1465
|
-
* Event listener function
|
|
1466
|
-
*/
|
|
1467
|
-
type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
|
|
1468
|
-
/**
|
|
1469
|
-
* Console-like interface for the EventEmitterPlugin.
|
|
1470
|
-
*
|
|
1471
|
-
* Use this interface for typing instead of the concrete EventEmitterPlugin class.
|
|
1472
|
-
*/
|
|
1473
|
-
interface IEventEmitterPlugin {
|
|
1474
|
-
on(eventType: TEventName, listener: TEventEmitterListener, options?: {
|
|
1475
|
-
once?: boolean;
|
|
1476
|
-
filter?: (event: IEventEmitterEventData) => boolean;
|
|
1477
|
-
}): string;
|
|
1478
|
-
once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
|
|
1479
|
-
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
1480
|
-
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
1481
|
-
}
|
|
1482
|
-
//#endregion
|
|
1483
|
-
//#region src/abstracts/abstract-module-types.d.ts
|
|
1484
|
-
/** Module execution context */
|
|
1485
|
-
interface IModuleExecutionContext {
|
|
1486
|
-
executionId?: string;
|
|
1487
|
-
sessionId?: string;
|
|
1488
|
-
userId?: string;
|
|
1489
|
-
agentName?: string;
|
|
1490
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
1491
|
-
[key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
|
|
1492
|
-
}
|
|
1493
|
-
/** Module execution result */
|
|
1494
|
-
interface IModuleExecutionResult {
|
|
1495
|
-
success: boolean;
|
|
1496
|
-
data?: IModuleResultData;
|
|
1497
|
-
error?: Error;
|
|
1498
|
-
duration?: number;
|
|
1499
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
1500
|
-
}
|
|
1501
|
-
/** Module result data */
|
|
1502
|
-
interface IModuleResultData {
|
|
1503
|
-
[key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
|
|
1504
|
-
}
|
|
1505
|
-
/** Base module options */
|
|
1506
|
-
interface IBaseModuleOptions {
|
|
1507
|
-
enabled?: boolean;
|
|
1508
|
-
config?: Record<string, string | number | boolean>;
|
|
1509
|
-
}
|
|
1510
|
-
/** Module capabilities */
|
|
1511
|
-
interface IModuleCapabilities {
|
|
1512
|
-
capabilities: string[];
|
|
1513
|
-
dependencies?: string[];
|
|
1514
|
-
optionalDependencies?: string[];
|
|
1515
|
-
}
|
|
1516
|
-
/** Module type descriptor */
|
|
1517
|
-
interface IModuleDescriptor {
|
|
1518
|
-
type: string;
|
|
1519
|
-
category: ModuleCategory;
|
|
1520
|
-
layer: ModuleLayer;
|
|
1521
|
-
dependencies?: string[];
|
|
1522
|
-
capabilities?: string[];
|
|
1523
|
-
}
|
|
1524
|
-
/** Module categories */
|
|
1525
|
-
declare enum ModuleCategory {
|
|
1526
|
-
CORE = "core",
|
|
1527
|
-
STORAGE = "storage",
|
|
1528
|
-
PROCESSING = "processing",
|
|
1529
|
-
INTEGRATION = "integration",
|
|
1530
|
-
INTERFACE = "interface",
|
|
1531
|
-
CAPABILITY = "capability"
|
|
1532
|
-
}
|
|
1533
|
-
/** Module layers */
|
|
1534
|
-
declare enum ModuleLayer {
|
|
1535
|
-
INFRASTRUCTURE = "infrastructure",
|
|
1536
|
-
CORE = "core",
|
|
1537
|
-
APPLICATION = "application",
|
|
1538
|
-
DOMAIN = "domain",
|
|
1539
|
-
PRESENTATION = "presentation"
|
|
1540
|
-
}
|
|
1541
|
-
/** Module data for introspection */
|
|
1542
|
-
interface IModuleData {
|
|
1543
|
-
name: string;
|
|
1544
|
-
version: string;
|
|
1545
|
-
type: string;
|
|
1546
|
-
enabled: boolean;
|
|
1547
|
-
initialized: boolean;
|
|
1548
|
-
capabilities: IModuleCapabilities;
|
|
1549
|
-
metadata?: Record<string, string | number | boolean>;
|
|
1550
|
-
}
|
|
1551
|
-
/** Module statistics */
|
|
1552
|
-
interface IModuleStats {
|
|
1553
|
-
enabled: boolean;
|
|
1554
|
-
initialized: boolean;
|
|
1555
|
-
executionCount: number;
|
|
1556
|
-
errorCount: number;
|
|
1557
|
-
lastActivity?: Date;
|
|
1558
|
-
averageExecutionTime?: number;
|
|
1559
|
-
[key: string]: string | number | boolean | Date | undefined;
|
|
1560
|
-
}
|
|
1561
|
-
/** Type-safe module interface */
|
|
1562
|
-
interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
|
|
1563
|
-
name: string;
|
|
1564
|
-
version: string;
|
|
1565
|
-
enabled: boolean;
|
|
1566
|
-
initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
|
|
1567
|
-
dispose?(): Promise<void>;
|
|
1568
|
-
execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
|
|
1569
|
-
getModuleType(): IModuleDescriptor;
|
|
1570
|
-
getCapabilities(): IModuleCapabilities;
|
|
1571
|
-
getData?(): IModuleData;
|
|
1572
|
-
getStats?(): TStats;
|
|
1573
|
-
isEnabled(): boolean;
|
|
1574
|
-
isInitialized(): boolean;
|
|
1405
|
+
interface IDeferredToolCatalog {
|
|
1406
|
+
/**
|
|
1407
|
+
* Deferred tools not yet loaded — the population a search can still discover. Empty while
|
|
1408
|
+
* deferral is not engaged, because nothing is withheld then.
|
|
1409
|
+
*/
|
|
1410
|
+
listDeferredTools(): IToolSchema[];
|
|
1411
|
+
/**
|
|
1412
|
+
* Mark the named deferred tools loaded for the rest of the session and return their schemas. A
|
|
1413
|
+
* resident name is returned as it is (it was never withheld); an unknown name throws, naming the
|
|
1414
|
+
* entry, and then nothing is loaded — the check runs over every name before the first load.
|
|
1415
|
+
*/
|
|
1416
|
+
loadDeferredTools(names: readonly string[]): IToolSchema[];
|
|
1575
1417
|
}
|
|
1576
1418
|
//#endregion
|
|
1577
|
-
//#region src/
|
|
1419
|
+
//#region src/interfaces/tool.d.ts
|
|
1420
|
+
/** Awaited host admission for effective parameters, immediately before a tool body. */
|
|
1421
|
+
type TToolEffectAdmission<TParameters = TToolParameters> = (parameters: TParameters) => Promise<void>;
|
|
1422
|
+
type TToolContextExtensionValue = TUniversalValue | Date | Error | TLoggerData | TContextData | TToolParameters | TToolMetadata;
|
|
1578
1423
|
/**
|
|
1579
|
-
*
|
|
1424
|
+
* Tool metadata structure - specific type definition
|
|
1425
|
+
*/
|
|
1426
|
+
type TToolMetadata = Record<string, string | number | boolean | string[] | number[] | boolean[] | TToolParameters>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Tool execution data - domain payload for tool results.
|
|
1580
1429
|
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1430
|
+
* IMPORTANT:
|
|
1431
|
+
* - This must support structured tool outputs without resorting to `any`.
|
|
1432
|
+
* - Prefer `ToolResultData` (derived from the canonical `UniversalValue` axis).
|
|
1583
1433
|
*/
|
|
1584
1434
|
/**
|
|
1585
|
-
*
|
|
1435
|
+
* Tool execution result - extended for ToolExecutionData compatibility
|
|
1586
1436
|
*/
|
|
1587
|
-
|
|
1437
|
+
interface IToolResult {
|
|
1438
|
+
success: boolean;
|
|
1439
|
+
data?: TUniversalValue;
|
|
1440
|
+
error?: string;
|
|
1441
|
+
metadata?: TToolMetadata;
|
|
1442
|
+
[key: string]: TToolContextExtensionValue | undefined;
|
|
1443
|
+
}
|
|
1588
1444
|
/**
|
|
1589
|
-
*
|
|
1445
|
+
* Enhanced tool execution result with additional metadata
|
|
1590
1446
|
*/
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1447
|
+
interface IToolExecutionResult {
|
|
1448
|
+
/** Whether execution was successful */
|
|
1449
|
+
success: boolean;
|
|
1450
|
+
/** Tool name that was executed */
|
|
1451
|
+
toolName?: string;
|
|
1452
|
+
/** Execution result or data */
|
|
1453
|
+
result?: TUniversalValue;
|
|
1454
|
+
/** Error message if execution failed */
|
|
1455
|
+
error?: string;
|
|
1456
|
+
/** Execution duration in milliseconds */
|
|
1457
|
+
duration?: number;
|
|
1458
|
+
/** Unique execution ID */
|
|
1459
|
+
executionId?: string;
|
|
1460
|
+
/** Additional metadata */
|
|
1461
|
+
metadata?: TToolMetadata;
|
|
1594
1462
|
}
|
|
1595
1463
|
/**
|
|
1596
|
-
*
|
|
1464
|
+
* Tool execution context - type-safe context for tool execution
|
|
1465
|
+
* Enhanced with hierarchical execution tracking support
|
|
1597
1466
|
*/
|
|
1598
|
-
|
|
1467
|
+
interface IToolExecutionContext {
|
|
1468
|
+
toolName: string;
|
|
1469
|
+
parameters: TToolParameters;
|
|
1470
|
+
/** Runtime-owned barrier, consumed after permission and before entering the tool. */
|
|
1471
|
+
beforeToolEffect?: TToolEffectAdmission;
|
|
1472
|
+
/** Journaled pre-effect request/response port for admission-aware runtime wrappers. */
|
|
1473
|
+
continuation?: IToolContinuation;
|
|
1474
|
+
/**
|
|
1475
|
+
* Run-scoped cancellation signal (CORE-018). Long-running tools MUST honor it: terminate
|
|
1476
|
+
* the underlying work (kill the child process, abort the network request) and return an
|
|
1477
|
+
* interrupted/failed result. Completing silently after an abort is a contract violation.
|
|
1478
|
+
*/
|
|
1479
|
+
signal?: AbortSignal;
|
|
1480
|
+
/** Direct remote calls deny decisions that would require human interaction. */
|
|
1481
|
+
permissionInteraction?: 'interactive' | 'deny';
|
|
1482
|
+
executionId?: string;
|
|
1483
|
+
userId?: string;
|
|
1484
|
+
sessionId?: string;
|
|
1485
|
+
metadata?: TToolMetadata;
|
|
1486
|
+
/** Parent execution ID for hierarchical tool execution tracking */
|
|
1487
|
+
parentExecutionId?: string;
|
|
1488
|
+
/** Root execution ID (Team/Agent level) for complete execution tree tracking */
|
|
1489
|
+
rootExecutionId?: string;
|
|
1490
|
+
/** Execution depth level (0: Team, 1: Agent, 2: Tool, etc.) */
|
|
1491
|
+
executionLevel?: number;
|
|
1492
|
+
/** Execution path array showing the complete execution hierarchy */
|
|
1493
|
+
executionPath?: string[];
|
|
1494
|
+
/** Real-time execution data for accurate tracking (no simulation) */
|
|
1495
|
+
realTimeData?: {
|
|
1496
|
+
/** Actual execution start time */
|
|
1497
|
+
startTime: Date;
|
|
1498
|
+
/** Actual input parameters passed to the tool */
|
|
1499
|
+
actualParameters: TToolParameters;
|
|
1500
|
+
/** Tool-provided estimated duration (optional) */
|
|
1501
|
+
estimatedDuration?: number;
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Additional tool execution context extensions.
|
|
1505
|
+
*
|
|
1506
|
+
* IMPORTANT:
|
|
1507
|
+
* - Avoid ad-hoc top-level fields to keep the contract stable.
|
|
1508
|
+
* - Use this map for forward-compatible extra data with constrained value types.
|
|
1509
|
+
*/
|
|
1510
|
+
extensions?: Record<string, TToolContextExtensionValue>;
|
|
1511
|
+
/** Owner context propagated from EventService */
|
|
1512
|
+
ownerType?: string;
|
|
1513
|
+
ownerId?: string;
|
|
1514
|
+
ownerPath?: IOwnerPathSegment[];
|
|
1515
|
+
sourceId?: string;
|
|
1516
|
+
/**
|
|
1517
|
+
* Tool-call scoped EventService instance.
|
|
1518
|
+
* Caller (ExecutionService/ToolExecutionService) is responsible for providing
|
|
1519
|
+
* an ownerPath-bound EventService for this tool call.
|
|
1520
|
+
*/
|
|
1521
|
+
eventService?: IEventService;
|
|
1522
|
+
/**
|
|
1523
|
+
* Unbound base EventService instance.
|
|
1524
|
+
*
|
|
1525
|
+
* Required when a tool needs to create another owner-bound EventService
|
|
1526
|
+
* for a different owner (e.g., creating an agent from a tool call).
|
|
1527
|
+
*
|
|
1528
|
+
* NOTE: Do not wrap an already owner-bound EventService to bind a different owner.
|
|
1529
|
+
* Owner-bound instances must not be layered across different owners.
|
|
1530
|
+
*/
|
|
1531
|
+
baseEventService?: IEventService;
|
|
1532
|
+
/**
|
|
1533
|
+
* The service this call's caller would give the tool with `setEventService`, carried with the
|
|
1534
|
+
* call instead. One tool instance can serve several agents, and the service set on it is
|
|
1535
|
+
* whichever agent set one last; a tool that emits events of its own (the `FunctionTool` span)
|
|
1536
|
+
* emits them here when present, so they reach the agent that made the call. The no-op default
|
|
1537
|
+
* service means that caller wants none.
|
|
1538
|
+
*/
|
|
1539
|
+
instanceEventService?: IEventService;
|
|
1540
|
+
/**
|
|
1541
|
+
* Injected "ask the user" port (CMD-004). Present when an interactive renderer is attached, letting
|
|
1542
|
+
* a tool solicit a structured answer from the user (the model-issued question seam consumed by
|
|
1543
|
+
* CMD-005). Absent in non-interactive contexts; a tool that asks must treat absence as "no human
|
|
1544
|
+
* available" (never a silent guess).
|
|
1545
|
+
*/
|
|
1546
|
+
ask?: IUserInteraction['ask'];
|
|
1547
|
+
/**
|
|
1548
|
+
* CLI-1990: the deferred-tool catalog the runtime injects (`ToolExecutionService`), so a search
|
|
1549
|
+
* tool can list what is withheld and load it for the rest of the session. Present on every tool
|
|
1550
|
+
* call the execution loop issues; a tool other than the search tool has no reason to read it.
|
|
1551
|
+
*/
|
|
1552
|
+
deferredTools?: IDeferredToolCatalog;
|
|
1553
|
+
/**
|
|
1554
|
+
* The ID core mints for this one tool body, unique even when a vendor reuses its tool call ID.
|
|
1555
|
+
* The body's exported span is derived from it, so it is also what a propagated parent names.
|
|
1556
|
+
*/
|
|
1557
|
+
toolBodyId?: string;
|
|
1558
|
+
/**
|
|
1559
|
+
* Present only when the run carries trusted trace context: the `traceparent` naming this body's
|
|
1560
|
+
* span and the exact origins it may be sent to. A tool that makes outbound requests sends it only
|
|
1561
|
+
* to a listed origin.
|
|
1562
|
+
*/
|
|
1563
|
+
outboundTraceContext?: IOutboundTraceContext;
|
|
1564
|
+
/**
|
|
1565
|
+
* Present only when the host lets shell children inherit the trace: the environment naming this
|
|
1566
|
+
* body's span. Only the foreground shell tool applies it, to its own child.
|
|
1567
|
+
*/
|
|
1568
|
+
shellTraceEnv?: ISubprocessTraceEnv;
|
|
1569
|
+
/**
|
|
1570
|
+
* Present only when the host lets command hooks inherit the trace: the environment naming the
|
|
1571
|
+
* prompt root, for the hooks fired around this body. Separate from {@link shellTraceEnv}, whose
|
|
1572
|
+
* span is the body's own.
|
|
1573
|
+
*/
|
|
1574
|
+
hookTraceEnv?: ISubprocessTraceEnv;
|
|
1575
|
+
}
|
|
1599
1576
|
/**
|
|
1600
|
-
*
|
|
1601
|
-
*
|
|
1602
|
-
* Path-only rule:
|
|
1603
|
-
* - Relationships must be derived from these explicit segments, not from parsing IDs.
|
|
1577
|
+
* Parameter validation result
|
|
1604
1578
|
*/
|
|
1605
|
-
interface
|
|
1606
|
-
|
|
1607
|
-
|
|
1579
|
+
interface IParameterValidationResult {
|
|
1580
|
+
/** Whether parameters are valid */
|
|
1581
|
+
isValid: boolean;
|
|
1582
|
+
/** Validation error messages */
|
|
1583
|
+
errors: string[];
|
|
1608
1584
|
}
|
|
1609
1585
|
/**
|
|
1610
|
-
*
|
|
1611
|
-
* This is the single source of truth for deterministic linking in subscribers.
|
|
1586
|
+
* Generic tool executor function
|
|
1612
1587
|
*/
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1588
|
+
type TToolExecutor<TParams = TToolParameters, TResult = TUniversalValue> = (parameters: TParams, context?: IToolExecutionContext) => Promise<TResult>;
|
|
1589
|
+
/**
|
|
1590
|
+
* Base tool interface
|
|
1591
|
+
*/
|
|
1592
|
+
interface ITool {
|
|
1593
|
+
/** Tool schema */
|
|
1594
|
+
schema: IToolSchema;
|
|
1595
|
+
/**
|
|
1596
|
+
* Execute the tool with given parameters
|
|
1597
|
+
*/
|
|
1598
|
+
execute(parameters: TToolParameters, context?: IToolExecutionContext): Promise<IToolResult>;
|
|
1599
|
+
/**
|
|
1600
|
+
* Validate tool parameters
|
|
1601
|
+
*/
|
|
1602
|
+
validate(parameters: TToolParameters): boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Validate tool parameters with detailed result
|
|
1605
|
+
*/
|
|
1606
|
+
validateParameters(parameters: TToolParameters): IParameterValidationResult;
|
|
1607
|
+
/**
|
|
1608
|
+
* Get tool description
|
|
1609
|
+
*/
|
|
1610
|
+
getDescription(): string;
|
|
1623
1611
|
}
|
|
1624
1612
|
/**
|
|
1625
|
-
*
|
|
1613
|
+
* Function tool implementation
|
|
1626
1614
|
*/
|
|
1627
|
-
|
|
1615
|
+
interface IFunctionTool extends ITool {
|
|
1616
|
+
/** Function to execute */
|
|
1617
|
+
fn: TToolExecutor;
|
|
1618
|
+
}
|
|
1628
1619
|
/**
|
|
1629
|
-
*
|
|
1630
|
-
* Emitters may add additional fields, but MUST keep linkage information explicit.
|
|
1620
|
+
* Tool registry interface
|
|
1631
1621
|
*/
|
|
1632
|
-
interface
|
|
1633
|
-
/**
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
/**
|
|
1638
|
-
|
|
1622
|
+
interface IToolRegistry {
|
|
1623
|
+
/**
|
|
1624
|
+
* Register a tool
|
|
1625
|
+
*/
|
|
1626
|
+
register(tool: ITool): void;
|
|
1627
|
+
/**
|
|
1628
|
+
* Unregister a tool
|
|
1629
|
+
*/
|
|
1630
|
+
unregister(name: string): void;
|
|
1631
|
+
/**
|
|
1632
|
+
* Get tool by name
|
|
1633
|
+
*/
|
|
1634
|
+
get(name: string): ITool | undefined;
|
|
1635
|
+
/**
|
|
1636
|
+
* Get all registered tools
|
|
1637
|
+
*/
|
|
1638
|
+
getAll(): ITool[];
|
|
1639
|
+
/**
|
|
1640
|
+
* Get tool schemas
|
|
1641
|
+
*/
|
|
1642
|
+
getSchemas(): IToolSchema[];
|
|
1643
|
+
/**
|
|
1644
|
+
* Check if tool exists
|
|
1645
|
+
*/
|
|
1646
|
+
has(name: string): boolean;
|
|
1647
|
+
/**
|
|
1648
|
+
* Clear all tools
|
|
1649
|
+
*/
|
|
1650
|
+
clear(): void;
|
|
1651
|
+
}
|
|
1652
|
+
//#endregion
|
|
1653
|
+
//#region src/interfaces/execution-journal.d.ts
|
|
1654
|
+
/** Data-only provider options; callbacks, signals, tracing and adapter credentials are excluded. */
|
|
1655
|
+
type TJournalModelOptions = Pick<IChatOptions, 'model' | 'tools' | 'maxTokens' | 'temperature' | 'effort' | 'toolChoice' | 'nativeWebTools' | 'responseFormat'>;
|
|
1656
|
+
interface IJournalIdentity {
|
|
1657
|
+
recordId: string;
|
|
1658
|
+
executionId: string;
|
|
1659
|
+
}
|
|
1660
|
+
interface IJournalModelIdentity {
|
|
1661
|
+
callId: string;
|
|
1662
|
+
providerId: string;
|
|
1663
|
+
modelId: string;
|
|
1664
|
+
}
|
|
1665
|
+
interface IJournalActionIdentity {
|
|
1666
|
+
actionId: string;
|
|
1667
|
+
parentCallId: string;
|
|
1668
|
+
toolCallId: string;
|
|
1669
|
+
toolName: string;
|
|
1639
1670
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1671
|
+
interface IExecutionContinuationState {
|
|
1672
|
+
version: 1;
|
|
1673
|
+
kind: 'round' | 'summary';
|
|
1674
|
+
startedAt: string;
|
|
1675
|
+
turnMessageId: string;
|
|
1676
|
+
model: Pick<IChatOptions, 'maxTokens' | 'temperature' | 'effort' | 'toolChoice'> & {
|
|
1677
|
+
provider: string;
|
|
1678
|
+
model: string;
|
|
1679
|
+
topP?: number;
|
|
1680
|
+
};
|
|
1681
|
+
timeout?: number;
|
|
1682
|
+
toolSearch?: TToolSearchSetting;
|
|
1683
|
+
structuredOutput: boolean;
|
|
1684
|
+
/** Versioned data contract; runtime callbacks and signals are supplied by the recovering host. */
|
|
1685
|
+
options: Pick<IChatOptions, 'maxTokens' | 'temperature' | 'toolChoice'> & {
|
|
1686
|
+
maxExecutionRounds: number;
|
|
1687
|
+
maxSameToolInputs?: number;
|
|
1688
|
+
allowToolOnlyCompletion: boolean;
|
|
1689
|
+
withholdHostedTools: boolean;
|
|
1690
|
+
ephemeralSystemContext?: string;
|
|
1691
|
+
sessionId?: string;
|
|
1692
|
+
userId?: string;
|
|
1693
|
+
metadata?: TMetadata;
|
|
1694
|
+
};
|
|
1695
|
+
toolsExecuted: string[];
|
|
1696
|
+
consecutiveUnknownToolFailureRounds: number;
|
|
1697
|
+
forcedSummaryInstruction?: string;
|
|
1698
|
+
loadedDeferredTools?: string[];
|
|
1699
|
+
}
|
|
1700
|
+
/** Canonical private history, separate from transformed/ephemeral provider input. */
|
|
1701
|
+
interface IExecutionRoundCheckpoint {
|
|
1702
|
+
version: 1;
|
|
1703
|
+
effectAdmission: 'required';
|
|
1704
|
+
messages: TUniversalMessage[];
|
|
1705
|
+
round: number;
|
|
1706
|
+
contextLimit: number;
|
|
1707
|
+
cumulativeInputTokens: number;
|
|
1708
|
+
sameToolInputCounts: Array<[string, number]>;
|
|
1709
|
+
maxSameToolInputs?: number;
|
|
1710
|
+
continuation?: IExecutionContinuationState;
|
|
1711
|
+
/** Versioned state belonging to a runtime wrapper, never inferred from transcript text. */
|
|
1712
|
+
owner?: {
|
|
1713
|
+
kind: string;
|
|
1714
|
+
version: number;
|
|
1715
|
+
state: TToolParameters;
|
|
1716
|
+
};
|
|
1650
1717
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1718
|
+
type TExecutionJournalRecord = IJournalIdentity & ((IJournalModelIdentity & {
|
|
1719
|
+
kind: 'model-request';
|
|
1720
|
+
messages: TUniversalMessage[];
|
|
1721
|
+
options: TJournalModelOptions;
|
|
1722
|
+
checkpoint?: IExecutionRoundCheckpoint;
|
|
1723
|
+
}) | (IJournalModelIdentity & {
|
|
1724
|
+
kind: 'model-response';
|
|
1725
|
+
response: TUniversalMessage;
|
|
1726
|
+
}) | (IJournalModelIdentity & {
|
|
1727
|
+
kind: 'model-cache-hit';
|
|
1728
|
+
response: TUniversalMessage;
|
|
1729
|
+
checkpoint?: IExecutionRoundCheckpoint;
|
|
1730
|
+
}) | (IJournalModelIdentity & {
|
|
1731
|
+
kind: 'model-failure';
|
|
1732
|
+
error: {
|
|
1733
|
+
name: string;
|
|
1734
|
+
message: string;
|
|
1735
|
+
};
|
|
1736
|
+
}) | (IJournalActionIdentity & {
|
|
1737
|
+
kind: 'tool-intent';
|
|
1738
|
+
parameters: TToolParameters;
|
|
1739
|
+
}) | (IJournalActionIdentity & {
|
|
1740
|
+
kind: 'tool-dispatch';
|
|
1741
|
+
}) | (IJournalActionIdentity & {
|
|
1742
|
+
kind: 'tool-effect-start';
|
|
1743
|
+
parameters: TToolParameters;
|
|
1744
|
+
}) | (IJournalActionIdentity & {
|
|
1745
|
+
kind: 'tool-wait';
|
|
1746
|
+
request: IToolContinuationPrompt & {
|
|
1747
|
+
requestId: string;
|
|
1748
|
+
};
|
|
1749
|
+
}) | (IJournalActionIdentity & {
|
|
1750
|
+
kind: 'tool-response';
|
|
1751
|
+
response: IToolWaitResponse;
|
|
1752
|
+
}) | (IJournalActionIdentity & {
|
|
1753
|
+
kind: 'tool-result';
|
|
1754
|
+
result: IToolExecutionResult;
|
|
1755
|
+
loadedDeferredTools?: string[];
|
|
1756
|
+
}));
|
|
1757
|
+
/**
|
|
1758
|
+
* Awaited, fail-closed execution boundary. Rejection stops this run before further dispatch.
|
|
1759
|
+
* The host owns storage, serialization of message dates, idempotency and recovery decisions.
|
|
1760
|
+
* Model records describe an adapter invocation, not its opaque retries or network requests.
|
|
1761
|
+
* Only a supported mandatory-effect checkpoint can prove an unstarted action; an intent alone cannot.
|
|
1762
|
+
*/
|
|
1763
|
+
interface IExecutionJournal {
|
|
1764
|
+
append(record: TExecutionJournalRecord): Promise<void>;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Reads the complete, ordered, current prefix from the same authority used for append.
|
|
1768
|
+
* The host must hold exclusive fenced ownership and drain the old runtime before recovery.
|
|
1769
|
+
* Appending an identical recordId is idempotent; conflicting content must be rejected.
|
|
1770
|
+
*/
|
|
1771
|
+
interface IRecoverableExecutionJournal extends IExecutionJournal {
|
|
1772
|
+
read(executionId: string): Promise<readonly TExecutionJournalRecord[]>;
|
|
1773
|
+
}
|
|
1774
|
+
interface IResumeToolCallsOptions {
|
|
1775
|
+
executionId: string;
|
|
1776
|
+
callId: string;
|
|
1777
|
+
journal: IRecoverableExecutionJournal;
|
|
1778
|
+
/** Exact replies to saved requests; receipts are persisted before further execution. */
|
|
1779
|
+
toolResponses?: readonly IToolWaitResponse[];
|
|
1780
|
+
signal?: AbortSignal;
|
|
1781
|
+
/** Observe newly committed recovery history using the ordinary history-mutation contract. */
|
|
1782
|
+
onExecutionEvent?: (event: string, data: Record<string, unknown>) => void;
|
|
1656
1783
|
}
|
|
1657
|
-
type TEventListener = (eventType: string, data: IBaseEventData, context?: IEventContext) => void;
|
|
1658
1784
|
/**
|
|
1659
|
-
*
|
|
1785
|
+
* Continue the latest settled invocation on the original provider/model under exclusive host ownership.
|
|
1786
|
+
* Structured-output validators and unknown effects require reconciliation rather than automatic replay.
|
|
1787
|
+
* Turn-level lifecycle hooks are omitted because their effects have no durable receipts;
|
|
1788
|
+
* hosts requiring those effects must settle them separately. Recovered history remains available.
|
|
1660
1789
|
*/
|
|
1661
|
-
interface
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
unsubscribe(listener: TEventListener): void;
|
|
1790
|
+
interface IResumeExecutionOptions extends Omit<IResumeToolCallsOptions, 'callId'> {
|
|
1791
|
+
onTextDelta?: IChatOptions['onTextDelta'];
|
|
1792
|
+
traceContext?: IRunTraceContext;
|
|
1665
1793
|
}
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1794
|
+
interface IResumeToolCallsResult {
|
|
1795
|
+
executionId: string;
|
|
1796
|
+
callId: string;
|
|
1797
|
+
messages: TUniversalMessage[];
|
|
1798
|
+
}
|
|
1799
|
+
/** Host-owned identity for a journaled provider invocation, including routing changes. */
|
|
1800
|
+
interface IModelJournalContext {
|
|
1801
|
+
journal: IExecutionJournal;
|
|
1802
|
+
executionId: string;
|
|
1803
|
+
callId: string;
|
|
1804
|
+
checkpoint?: IExecutionRoundCheckpoint;
|
|
1805
|
+
route(): {
|
|
1806
|
+
providerId: string;
|
|
1807
|
+
modelId: string;
|
|
1808
|
+
};
|
|
1673
1809
|
}
|
|
1674
1810
|
//#endregion
|
|
1675
|
-
//#region src/
|
|
1811
|
+
//#region src/interfaces/cache.d.ts
|
|
1676
1812
|
/**
|
|
1677
|
-
*
|
|
1678
|
-
* Concrete implementations decide how events are delivered.
|
|
1813
|
+
* Cache key identifying a unique LLM execution request
|
|
1679
1814
|
*/
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1815
|
+
interface ICacheKey {
|
|
1816
|
+
/** SHA-256 hash of the serialized request */
|
|
1817
|
+
hash: string;
|
|
1818
|
+
/** Model identifier */
|
|
1819
|
+
model: string;
|
|
1820
|
+
/** Provider name */
|
|
1821
|
+
provider: string;
|
|
1686
1822
|
}
|
|
1687
1823
|
/**
|
|
1688
|
-
*
|
|
1689
|
-
* When injected, emit() intentionally does nothing.
|
|
1824
|
+
* Cached LLM response entry
|
|
1690
1825
|
*/
|
|
1691
|
-
|
|
1692
|
-
|
|
1826
|
+
interface ICacheEntry {
|
|
1827
|
+
/** Cache key that produced this entry */
|
|
1828
|
+
key: ICacheKey;
|
|
1829
|
+
/** Cached response content */
|
|
1830
|
+
response: string;
|
|
1831
|
+
/** When the entry was cached */
|
|
1832
|
+
timestamp: number;
|
|
1833
|
+
/** SHA-256 integrity hash of the response */
|
|
1834
|
+
integrityHash: string;
|
|
1693
1835
|
}
|
|
1694
1836
|
/**
|
|
1695
|
-
*
|
|
1696
|
-
*/
|
|
1697
|
-
declare const DEFAULT_ABSTRACT_EVENT_SERVICE: IEventService;
|
|
1698
|
-
/**
|
|
1699
|
-
* Check if a given service is the default no-op implementation.
|
|
1700
|
-
*/
|
|
1701
|
-
declare function isDefaultEventService(service: IEventService): boolean;
|
|
1702
|
-
/**
|
|
1703
|
-
* Compose a full event name from owner prefix and local name.
|
|
1704
|
-
* Local names must not contain dots.
|
|
1705
|
-
*/
|
|
1706
|
-
declare function composeEventName(ownerType: string, localName: string): string;
|
|
1707
|
-
/**
|
|
1708
|
-
* Generate a unique span ID for distributed tracing correlation. Exported so a per-operation timing
|
|
1709
|
-
* source (SELFHOST-004) can mint a span id it puts on BOTH the event payload and the event context.
|
|
1710
|
-
*/
|
|
1711
|
-
declare function generateSpanId(): string;
|
|
1712
|
-
/**
|
|
1713
|
-
* A scoped event service that always emits with an owner binding applied.
|
|
1837
|
+
* Cache storage interface for pluggable backends
|
|
1714
1838
|
*/
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1839
|
+
interface ICacheStorage {
|
|
1840
|
+
/** Retrieve a cached entry by key hash */
|
|
1841
|
+
get(hash: string): ICacheEntry | undefined;
|
|
1842
|
+
/** Store a cache entry */
|
|
1843
|
+
set(entry: ICacheEntry): void;
|
|
1844
|
+
/** Delete a cached entry by key hash */
|
|
1845
|
+
delete(hash: string): boolean;
|
|
1846
|
+
/** Clear all cached entries */
|
|
1847
|
+
clear(): void;
|
|
1848
|
+
/** Get cache statistics */
|
|
1849
|
+
getStats(): ICacheStats;
|
|
1722
1850
|
}
|
|
1723
1851
|
/**
|
|
1724
|
-
*
|
|
1725
|
-
* This is the standard entry point for scoped emission (path-only architecture).
|
|
1726
|
-
*/
|
|
1727
|
-
declare function bindWithOwnerPath(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
1728
|
-
/**
|
|
1729
|
-
* Alias for bindWithOwnerPath for historical call sites.
|
|
1730
|
-
* Intentionally forwards to the single authoritative implementation.
|
|
1852
|
+
* Cache performance statistics
|
|
1731
1853
|
*/
|
|
1732
|
-
|
|
1854
|
+
interface ICacheStats {
|
|
1855
|
+
/** Number of cache hits */
|
|
1856
|
+
hits: number;
|
|
1857
|
+
/** Number of cache misses */
|
|
1858
|
+
misses: number;
|
|
1859
|
+
/** Current number of cached entries */
|
|
1860
|
+
entries: number;
|
|
1861
|
+
/** Hit rate (hits / (hits + misses)), 0 if no lookups */
|
|
1862
|
+
hitRate: number;
|
|
1863
|
+
}
|
|
1733
1864
|
/**
|
|
1734
|
-
*
|
|
1865
|
+
* Configuration options for execution caching
|
|
1735
1866
|
*/
|
|
1736
|
-
|
|
1737
|
-
|
|
1867
|
+
interface ICacheOptions {
|
|
1868
|
+
/** Whether caching is enabled */
|
|
1869
|
+
enabled: boolean;
|
|
1870
|
+
/** Maximum number of cached entries */
|
|
1871
|
+
maxEntries: number;
|
|
1872
|
+
/** Time-to-live in milliseconds */
|
|
1873
|
+
ttlMs: number;
|
|
1738
1874
|
}
|
|
1739
1875
|
//#endregion
|
|
1740
|
-
//#region src/
|
|
1741
|
-
declare const TASK_EVENTS: {
|
|
1742
|
-
readonly ASSIGNED: "assigned";
|
|
1743
|
-
readonly COMPLETED: "completed";
|
|
1744
|
-
};
|
|
1745
|
-
declare const TASK_EVENT_PREFIX: "task";
|
|
1746
|
-
//#endregion
|
|
1747
|
-
//#region src/event-service/user-events.d.ts
|
|
1748
|
-
declare const USER_EVENTS: {
|
|
1749
|
-
readonly MESSAGE: "message";
|
|
1750
|
-
readonly INPUT: "input";
|
|
1751
|
-
};
|
|
1752
|
-
declare const USER_EVENT_PREFIX: "user";
|
|
1753
|
-
type TUserEvent = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
|
|
1754
|
-
//#endregion
|
|
1755
|
-
//#region src/event-service/span-events.d.ts
|
|
1876
|
+
//#region src/interfaces/response-format.d.ts
|
|
1756
1877
|
/**
|
|
1757
|
-
*
|
|
1758
|
-
* pattern (a const name set + a prefix). The local name is distinctive (`span_completed`, not a bare
|
|
1759
|
-
* `completed`) so a consumer can identify a span-completion regardless of the emitting owner's prefix.
|
|
1878
|
+
* Response format configuration
|
|
1760
1879
|
*/
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
}
|
|
1768
|
-
/** A provider request moved to another model after the one it was on failed. */
|
|
1769
|
-
declare const PROVIDER_FALLBACK_EVENTS: {
|
|
1770
|
-
readonly SWITCHED: "provider_fallback";
|
|
1771
|
-
};
|
|
1772
|
-
/** The notice a `provider_fallback` event carries, or `undefined` when the payload is malformed. */
|
|
1773
|
-
declare function readModelFallbackNotice(data: Readonly<Record<string, unknown>>): IModelFallbackNotice | undefined;
|
|
1774
|
-
/** Content-free completion of the body actually awaited by one permitted tool call. */
|
|
1775
|
-
declare const TOOL_BODY_EVENTS: {
|
|
1776
|
-
readonly COMPLETED: "tool_body_completed";
|
|
1777
|
-
};
|
|
1778
|
-
/** Content-free decision reached for one tool call before any body runs. */
|
|
1779
|
-
declare const TOOL_PERMISSION_EVENTS: {
|
|
1780
|
-
readonly DECIDED: "tool_permission_decided";
|
|
1781
|
-
};
|
|
1782
|
-
declare const SPAN_EVENT_PREFIX: "span";
|
|
1783
|
-
type TSpanEvent = (typeof SPAN_EVENTS)[keyof typeof SPAN_EVENTS];
|
|
1880
|
+
interface IResponseFormatConfig {
|
|
1881
|
+
type?: 'text' | 'json_object' | 'json_schema';
|
|
1882
|
+
/** JSON schema payload; required when `type` is `'json_schema'` (CORE-015). */
|
|
1883
|
+
schema?: Record<string, TConfigValue>;
|
|
1884
|
+
/** Schema name forwarded to provider native structured-output surfaces. */
|
|
1885
|
+
name?: string;
|
|
1886
|
+
}
|
|
1784
1887
|
/**
|
|
1785
|
-
*
|
|
1786
|
-
* operation name (raw scalars ONLY; references no transport type). Emitted by the per-operation timing
|
|
1787
|
-
* source (e.g. `FunctionTool`) so a consuming layer (`agent-framework`) can build a record span entry
|
|
1788
|
-
* WITHOUT `agent-core` depending on `agent-interface-transport` (no cycle). The payload `spanId` is the
|
|
1789
|
-
* AUTHORITATIVE id a consumer reads; owner/turn correlation is applied by the event service's binding
|
|
1790
|
-
* (`ownerPath` on the emitted `IEventContext`). Note the context's own auto-minted `spanId` is a
|
|
1791
|
-
* separate scope tag and need not equal this payload id — always read the payload id for the span.
|
|
1888
|
+
* Safety setting configuration
|
|
1792
1889
|
*/
|
|
1793
|
-
interface
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1890
|
+
interface ISafetySetting {
|
|
1891
|
+
category: string;
|
|
1892
|
+
threshold: string;
|
|
1893
|
+
[key: string]: TConfigValue;
|
|
1894
|
+
}
|
|
1895
|
+
//#endregion
|
|
1896
|
+
//#region src/schema/zod-schema-types.d.ts
|
|
1897
|
+
interface IZodParseResult {
|
|
1898
|
+
success: boolean;
|
|
1899
|
+
data?: unknown;
|
|
1900
|
+
error?: unknown;
|
|
1901
|
+
}
|
|
1902
|
+
interface IZodSchemaDef {
|
|
1903
|
+
typeName?: string;
|
|
1904
|
+
innerType?: IZodSchema;
|
|
1905
|
+
valueType?: IZodSchema;
|
|
1906
|
+
checks?: Array<{
|
|
1907
|
+
kind: string;
|
|
1908
|
+
value?: TUniversalValue;
|
|
1909
|
+
}>;
|
|
1910
|
+
shape?: () => Record<string, IZodSchema>;
|
|
1911
|
+
type?: IZodSchema;
|
|
1912
|
+
/**
|
|
1913
|
+
* `ZodEnum` holds an ARRAY here; `ZodNativeEnum` holds the enum OBJECT itself (CORE-041). One Zod
|
|
1914
|
+
* field name, two shapes — the converter narrows before reading it.
|
|
1915
|
+
*/
|
|
1916
|
+
values?: TUniversalValue[] | Record<string, TUniversalValue>;
|
|
1917
|
+
description?: string;
|
|
1918
|
+
unknownKeys?: 'passthrough' | 'strip' | 'strict';
|
|
1919
|
+
/** `ZodEffects` (`.refine()` / `.transform()`) holds the schema it wraps here. */
|
|
1920
|
+
schema?: IZodSchema;
|
|
1921
|
+
/** `ZodUnion` / `ZodDiscriminatedUnion` members. */
|
|
1922
|
+
options?: IZodSchema[];
|
|
1923
|
+
/** `ZodLiteral` value. */
|
|
1924
|
+
value?: TUniversalValue;
|
|
1925
|
+
}
|
|
1926
|
+
interface IZodSchema {
|
|
1927
|
+
parse(value: unknown): unknown;
|
|
1928
|
+
safeParse(value: unknown): IZodParseResult;
|
|
1929
|
+
_def?: IZodSchemaDef;
|
|
1800
1930
|
}
|
|
1801
|
-
//#endregion
|
|
1802
|
-
//#region src/interfaces/tool.d.ts
|
|
1803
|
-
type TToolContextExtensionValue = TUniversalValue | Date | Error | TLoggerData | TContextData | TToolParameters | TToolMetadata;
|
|
1804
1931
|
/**
|
|
1805
|
-
*
|
|
1932
|
+
* Schema conversion options
|
|
1806
1933
|
*/
|
|
1807
|
-
|
|
1934
|
+
interface ISchemaConversionOptions {
|
|
1935
|
+
includeDescription?: boolean;
|
|
1936
|
+
strictTypes?: boolean;
|
|
1937
|
+
allowAdditionalProperties?: boolean;
|
|
1938
|
+
}
|
|
1939
|
+
//#endregion
|
|
1940
|
+
//#region src/schema/structured-output.d.ts
|
|
1941
|
+
/** Explicit raw-JSON-schema form of `IRunOptions.output`. */
|
|
1942
|
+
interface IJsonSchemaOutput {
|
|
1943
|
+
/** JSON Schema (object root, universal subset) the response must match. */
|
|
1944
|
+
jsonSchema: IToolSchema['parameters'];
|
|
1945
|
+
/** Optional schema name forwarded to provider native surfaces. */
|
|
1946
|
+
name?: string;
|
|
1947
|
+
}
|
|
1948
|
+
/** Accepted `IRunOptions.output` values: a Zod schema or an explicit JSON-schema wrapper. */
|
|
1949
|
+
type TStructuredOutputSchema = IZodSchema | IJsonSchemaOutput;
|
|
1950
|
+
type TStructuredOutputValidation = {
|
|
1951
|
+
success: true;
|
|
1952
|
+
value: unknown;
|
|
1953
|
+
} | {
|
|
1954
|
+
success: false;
|
|
1955
|
+
issues: string[];
|
|
1956
|
+
};
|
|
1957
|
+
/** Internal SSOT representation every `output` value normalizes to. */
|
|
1958
|
+
interface IStructuredOutputSpec {
|
|
1959
|
+
name: string;
|
|
1960
|
+
jsonSchema: IToolSchema['parameters'];
|
|
1961
|
+
validate(value: unknown): TStructuredOutputValidation;
|
|
1962
|
+
}
|
|
1963
|
+
/** Normalize an accepted `output` value into the internal spec. */
|
|
1964
|
+
declare function normalizeStructuredOutput(output: TStructuredOutputSchema): IStructuredOutputSpec;
|
|
1808
1965
|
/**
|
|
1809
|
-
*
|
|
1966
|
+
* Validate a value against the universal JSON-schema subset (`IParameterSchema`). Covers type,
|
|
1967
|
+
* required, enum, items, nested properties, unions and numeric bounds — the full expressible
|
|
1968
|
+
* surface of the subset, at every level.
|
|
1810
1969
|
*
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1813
|
-
* - Prefer `ToolResultData` (derived from the canonical `UniversalValue` axis).
|
|
1970
|
+
* CORE-039: this is the ONE complete walk. `parameter-validator` delegates its depth here rather
|
|
1971
|
+
* than keeping a second, shallower copy, and the two must therefore agree by construction.
|
|
1814
1972
|
*/
|
|
1973
|
+
declare function validateAgainstJsonSchema(schema: IParameterSchema, value: unknown, path: string): string[];
|
|
1815
1974
|
/**
|
|
1816
|
-
*
|
|
1975
|
+
* Parse the model's final text into a JSON value. Tolerates a fenced
|
|
1976
|
+
* ```json code block wrapper (providers without native enforcement commonly
|
|
1977
|
+
* emit one); the parsed value is still strictly schema-validated afterwards.
|
|
1817
1978
|
*/
|
|
1818
|
-
|
|
1819
|
-
success:
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
}
|
|
1979
|
+
declare function parseStructuredResponseText(text: string): {
|
|
1980
|
+
success: true;
|
|
1981
|
+
value: unknown;
|
|
1982
|
+
} | {
|
|
1983
|
+
success: false;
|
|
1984
|
+
issue: string;
|
|
1985
|
+
};
|
|
1986
|
+
//#endregion
|
|
1987
|
+
//#region src/interfaces/run-options.d.ts
|
|
1825
1988
|
/**
|
|
1826
|
-
*
|
|
1989
|
+
* The per-RUN contract: what one `run()` may override or observe, as distinct from the agent's
|
|
1990
|
+
* standing configuration in `IAgentConfig`.
|
|
1991
|
+
*
|
|
1992
|
+
* Split out of `agent.ts` when PEER-007 added `driverId`. That file sits at a frozen size baseline,
|
|
1993
|
+
* and the anti-monolith rule asks for a split rather than one more field on a file already at its
|
|
1994
|
+
* limit. The two execution-event types come along because `onExecutionEvent` is their only consumer
|
|
1995
|
+
* — leaving them behind would have made this module import back from `agent.ts`.
|
|
1827
1996
|
*/
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
success: boolean;
|
|
1831
|
-
/** Tool name that was executed */
|
|
1832
|
-
toolName?: string;
|
|
1833
|
-
/** Execution result or data */
|
|
1834
|
-
result?: TUniversalValue;
|
|
1835
|
-
/** Error message if execution failed */
|
|
1836
|
-
error?: string;
|
|
1837
|
-
/** Execution duration in milliseconds */
|
|
1838
|
-
duration?: number;
|
|
1839
|
-
/** Unique execution ID */
|
|
1840
|
-
executionId?: string;
|
|
1841
|
-
/** Additional metadata */
|
|
1842
|
-
metadata?: TToolMetadata;
|
|
1843
|
-
}
|
|
1997
|
+
type TExecutionEventData = Record<string, unknown>;
|
|
1998
|
+
type TExecutionEventCallback = (event: string, data: TExecutionEventData) => void;
|
|
1844
1999
|
/**
|
|
1845
|
-
*
|
|
1846
|
-
* Enhanced with hierarchical execution tracking support
|
|
2000
|
+
* Agent run options - type-safe interface for all agent execution options
|
|
1847
2001
|
*/
|
|
1848
|
-
interface
|
|
1849
|
-
|
|
1850
|
-
|
|
2002
|
+
interface IRunOptions {
|
|
2003
|
+
/** Run-scoped temperature override — wins over `defaultModel.temperature` (CORE-016). */
|
|
2004
|
+
temperature?: number;
|
|
2005
|
+
/** Run-scoped max output tokens override — wins over `defaultModel.maxTokens` (CORE-016). */
|
|
2006
|
+
maxTokens?: number;
|
|
1851
2007
|
/**
|
|
1852
|
-
* Run-scoped
|
|
1853
|
-
*
|
|
1854
|
-
*
|
|
2008
|
+
* Run-scoped tool-invocation directive — wins over `defaultModel.toolChoice` (CORE-017).
|
|
2009
|
+
* `'auto'` (model decides), `'none'` (suppress tool calls), `'required'` (must call some
|
|
2010
|
+
* tool), or `{ tool: name }` (must call the named tool; the name is validated against the
|
|
2011
|
+
* run's tool list and a miss throws). Forcing applies to the run's first model call only;
|
|
2012
|
+
* rounds after tool results revert to `'auto'` (see `TToolChoice`).
|
|
1855
2013
|
*/
|
|
1856
|
-
|
|
1857
|
-
/**
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2014
|
+
toolChoice?: TToolChoice;
|
|
2015
|
+
/**
|
|
2016
|
+
* Leave a provider's own hosted tools (a vendor-run web search) out of this run's requests. They
|
|
2017
|
+
* run at the vendor and never pass the permission gate, so a run whose tools a policy restricts
|
|
2018
|
+
* must not reach them.
|
|
2019
|
+
*/
|
|
2020
|
+
withholdHostedTools?: boolean;
|
|
1861
2021
|
sessionId?: string;
|
|
1862
|
-
|
|
1863
|
-
/** Parent execution ID for hierarchical tool execution tracking */
|
|
1864
|
-
parentExecutionId?: string;
|
|
1865
|
-
/** Root execution ID (Team/Agent level) for complete execution tree tracking */
|
|
1866
|
-
rootExecutionId?: string;
|
|
1867
|
-
/** Execution depth level (0: Team, 1: Agent, 2: Tool, etc.) */
|
|
1868
|
-
executionLevel?: number;
|
|
1869
|
-
/** Execution path array showing the complete execution hierarchy */
|
|
1870
|
-
executionPath?: string[];
|
|
1871
|
-
/** Real-time execution data for accurate tracking (no simulation) */
|
|
1872
|
-
realTimeData?: {
|
|
1873
|
-
/** Actual execution start time */
|
|
1874
|
-
startTime: Date;
|
|
1875
|
-
/** Actual input parameters passed to the tool */
|
|
1876
|
-
actualParameters: TToolParameters;
|
|
1877
|
-
/** Tool-provided estimated duration (optional) */
|
|
1878
|
-
estimatedDuration?: number;
|
|
1879
|
-
};
|
|
2022
|
+
userId?: string;
|
|
1880
2023
|
/**
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
1883
|
-
* IMPORTANT:
|
|
1884
|
-
* - Avoid ad-hoc top-level fields to keep the contract stable.
|
|
1885
|
-
* - Use this map for forward-compatible extra data with constrained value types.
|
|
2024
|
+
* PEER-007 (issue #1915): who this run is attributed to, for display. Per-run because it changes
|
|
2025
|
+
* per turn — one session serves the operator and any peer addressing it. Never authorization.
|
|
1886
2026
|
*/
|
|
1887
|
-
|
|
1888
|
-
/** Owner context propagated from EventService */
|
|
1889
|
-
ownerType?: string;
|
|
1890
|
-
ownerId?: string;
|
|
1891
|
-
ownerPath?: IOwnerPathSegment[];
|
|
1892
|
-
sourceId?: string;
|
|
2027
|
+
driverId?: string;
|
|
1893
2028
|
/**
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
1896
|
-
*
|
|
2029
|
+
* Where this run's turn came from (a peer's message, an external event, an agent wake-up), stored
|
|
2030
|
+
* beside `driverId` on the user message so a transcript carried elsewhere still says it. Display
|
|
2031
|
+
* only, like `driverId`; absent for the operator's own turn.
|
|
1897
2032
|
*/
|
|
1898
|
-
|
|
2033
|
+
turnSource?: string;
|
|
2034
|
+
metadata?: TMetadata;
|
|
1899
2035
|
/**
|
|
1900
|
-
*
|
|
1901
|
-
*
|
|
1902
|
-
*
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
1905
|
-
* NOTE: Do not wrap an already owner-bound EventService to bind a different owner.
|
|
1906
|
-
* Owner-bound instances must not be layered across different owners.
|
|
2036
|
+
* Run-scoped EPHEMERAL system context (SELFHOST-008 P3). A transient system-role block included in THIS
|
|
2037
|
+
* run's provider request(s) only — it is **never written to the conversation store**. An explicitly
|
|
2038
|
+
* configured execution journal records it as request/recovery state. It does not bloat conversation
|
|
2039
|
+
* history or force a static-system-prompt rebuild. Content-free neutral channel: the
|
|
2040
|
+
* caller decides what to put here (e.g. per-turn recalled memory). Absent ⇒ no change.
|
|
1907
2041
|
*/
|
|
1908
|
-
|
|
2042
|
+
ephemeralSystemContext?: string;
|
|
1909
2043
|
/**
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
* available" (never a silent guess).
|
|
2044
|
+
* Host-owned trace context for this run's provider calls. Each invoked call — forced summary
|
|
2045
|
+
* included, cache hits excluded — gets a `traceparent` whose parent is that call's own span, and
|
|
2046
|
+
* only an adapter whose origin is listed sends it. Never recorded in execution events.
|
|
1914
2047
|
*/
|
|
1915
|
-
|
|
2048
|
+
traceContext?: IRunTraceContext;
|
|
1916
2049
|
/**
|
|
1917
|
-
*
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
2050
|
+
* AbortSignal for cancelling execution. Aborting an in-flight run does not throw: `run()` resolves
|
|
2051
|
+
* (and `runStream()` returns) the last assistant text the turn committed before the abort, possibly
|
|
2052
|
+
* `''`; a reply cut off mid-stream is kept in history with `state: 'interrupted'`. Read
|
|
2053
|
+
* `signal.aborted` to tell an interrupted run from a completed one.
|
|
1920
2054
|
*/
|
|
1921
|
-
|
|
2055
|
+
signal?: AbortSignal;
|
|
2056
|
+
/** Join an aborted/timed-out provider call before completing; an uncooperative call may remain pending. */
|
|
2057
|
+
awaitProviderSettlement?: boolean;
|
|
2058
|
+
/** Per-run streaming text callback. Prefer this over mutating provider callback state. */
|
|
2059
|
+
onTextDelta?: TTextDeltaCallback;
|
|
2060
|
+
/** Per-run replay event callback for provider/tool execution boundaries. */
|
|
2061
|
+
onExecutionEvent?: TExecutionEventCallback;
|
|
2062
|
+
/** Awaited model/tool admission and result records. Failures terminate this run. */
|
|
2063
|
+
executionJournal?: IExecutionJournal;
|
|
1922
2064
|
/**
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
2065
|
+
* Maximum execution rounds for this run. A **round** is one provider (model) call plus the
|
|
2066
|
+
* execution of every tool call that reply requested; a reply with no tool calls ends the loop,
|
|
2067
|
+
* so a plain Q&A turn is exactly 1 round. This caps model/tool cycles within ONE `run()` — it is
|
|
2068
|
+
* not a tool-count limit and not a multi-turn conversation limit. When the cap is hit the run
|
|
2069
|
+
* stops after the current round. Use 0 for no core round cap. Defaults to
|
|
2070
|
+
* `IAgentConfig.maxExecutionRounds`.
|
|
1925
2071
|
*/
|
|
1926
|
-
|
|
2072
|
+
maxExecutionRounds?: number;
|
|
2073
|
+
/** Max times the same tool may be called with identical input before aborting. Unset = no limit. */
|
|
2074
|
+
maxSameToolInputs?: number;
|
|
1927
2075
|
/**
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
2076
|
+
* Treat a turn that ends in tool calls (no trailing text) as a valid completion instead of
|
|
2077
|
+
* forcing one extra provider call to generate a summary (CORE-011). For decision-agent patterns
|
|
2078
|
+
* (router/orchestrator/classifier) the tool call IS the answer — this removes the one-call tax.
|
|
2079
|
+
* The summary call is the one made when the round cap ends the loop on a tool round; before the cap
|
|
2080
|
+
* the model is called again after tool results as usual, so a decision agent sets
|
|
2081
|
+
* `maxExecutionRounds` too (e.g. `1`). The run resolves with the turn's text, or `''` when it
|
|
2082
|
+
* produced none; consumers read the outcome from the tool results.
|
|
1931
2083
|
*/
|
|
1932
|
-
|
|
2084
|
+
allowToolOnlyCompletion?: boolean;
|
|
1933
2085
|
/**
|
|
1934
|
-
*
|
|
1935
|
-
*
|
|
2086
|
+
* Schema-enforced structured output (CORE-015). Accepts a Zod schema or an explicit
|
|
2087
|
+
* `{ jsonSchema }` wrapper. `run` then resolves to the validated, typed object instead of a
|
|
2088
|
+
* string: the schema is forwarded to the provider's native structured-output surface where one
|
|
2089
|
+
* exists, and the final response is always parsed and validated core-side; a violation triggers
|
|
2090
|
+
* a bounded retry with the validation issues fed back as the next turn's input. Every attempt is
|
|
2091
|
+
* a real conversation turn (history stays append-only). Exhausted retries throw
|
|
2092
|
+
* `StructuredOutputError`.
|
|
1936
2093
|
*/
|
|
1937
|
-
|
|
2094
|
+
output?: TStructuredOutputSchema;
|
|
1938
2095
|
/**
|
|
1939
|
-
*
|
|
1940
|
-
*
|
|
1941
|
-
* span is the body's own.
|
|
2096
|
+
* Retry budget for structured output validation failures — the number of additional attempts
|
|
2097
|
+
* after the first (default 2). Only meaningful with `output` set.
|
|
1942
2098
|
*/
|
|
1943
|
-
|
|
2099
|
+
outputRetries?: number;
|
|
1944
2100
|
}
|
|
2101
|
+
//#endregion
|
|
2102
|
+
//#region src/plugins/event-emitter/types.d.ts
|
|
2103
|
+
declare const EXECUTION_EVENT_NAMES: {
|
|
2104
|
+
readonly START: "execution.start";
|
|
2105
|
+
readonly COMPLETE: "execution.complete";
|
|
2106
|
+
readonly ERROR: "execution.error";
|
|
2107
|
+
};
|
|
2108
|
+
declare const TOOL_EVENT_NAMES: {
|
|
2109
|
+
readonly CALL_START: "tool.call_start";
|
|
2110
|
+
readonly CALL_COMPLETE: "tool.call_complete";
|
|
2111
|
+
readonly CALL_ERROR: "tool.call_error";
|
|
2112
|
+
};
|
|
2113
|
+
declare const AGENT_EVENT_NAMES: {
|
|
2114
|
+
readonly EXECUTION_START: "agent.execution_start";
|
|
2115
|
+
readonly EXECUTION_COMPLETE: "agent.execution_complete";
|
|
2116
|
+
readonly EXECUTION_ERROR: "agent.execution_error";
|
|
2117
|
+
readonly CREATED: "agent.created";
|
|
2118
|
+
};
|
|
2119
|
+
type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
|
|
2120
|
+
type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
|
|
2121
|
+
type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
|
|
1945
2122
|
/**
|
|
1946
|
-
*
|
|
2123
|
+
* Event types that can be emitted.
|
|
2124
|
+
*
|
|
2125
|
+
* IMPORTANT:
|
|
2126
|
+
* - Do not use string literals for event names outside this module.
|
|
2127
|
+
* - Import and use EVENT_EMITTER_EVENTS instead.
|
|
1947
2128
|
*/
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
2129
|
+
declare const EVENT_EMITTER_EVENTS: {
|
|
2130
|
+
readonly EXECUTION_START: "execution.start";
|
|
2131
|
+
readonly EXECUTION_COMPLETE: "execution.complete";
|
|
2132
|
+
readonly EXECUTION_ERROR: "execution.error";
|
|
2133
|
+
readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
|
|
2134
|
+
readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
|
|
2135
|
+
readonly TOOL_SUCCESS: "tool.success";
|
|
2136
|
+
readonly TOOL_ERROR: "tool.call_error";
|
|
2137
|
+
readonly CONVERSATION_START: "conversation.start";
|
|
2138
|
+
readonly CONVERSATION_COMPLETE: "conversation.complete";
|
|
2139
|
+
readonly CONVERSATION_ERROR: "conversation.error";
|
|
2140
|
+
readonly AGENT_EXECUTION_START: "agent.execution_start";
|
|
2141
|
+
readonly AGENT_EXECUTION_COMPLETE: "agent.execution_complete";
|
|
2142
|
+
readonly AGENT_EXECUTION_ERROR: "agent.execution_error";
|
|
2143
|
+
readonly AGENT_CREATED: "agent.created";
|
|
2144
|
+
readonly AGENT_DESTROYED: "agent.destroyed";
|
|
2145
|
+
readonly PLUGIN_LOADED: "plugin.loaded";
|
|
2146
|
+
readonly PLUGIN_UNLOADED: "plugin.unloaded";
|
|
2147
|
+
readonly PLUGIN_ERROR: "plugin.error";
|
|
2148
|
+
readonly ERROR_OCCURRED: "error.occurred";
|
|
2149
|
+
readonly WARNING_OCCURRED: "warning.occurred";
|
|
2150
|
+
readonly MODULE_INITIALIZE_START: "module.initialize.start";
|
|
2151
|
+
readonly MODULE_INITIALIZE_COMPLETE: "module.initialize.complete";
|
|
2152
|
+
readonly MODULE_INITIALIZE_ERROR: "module.initialize.error";
|
|
2153
|
+
readonly MODULE_EXECUTION_START: "module.execution.start";
|
|
2154
|
+
readonly MODULE_EXECUTION_COMPLETE: "module.execution.complete";
|
|
2155
|
+
readonly MODULE_EXECUTION_ERROR: "module.execution.error";
|
|
2156
|
+
readonly MODULE_DISPOSE_START: "module.dispose.start";
|
|
2157
|
+
readonly MODULE_DISPOSE_COMPLETE: "module.dispose.complete";
|
|
2158
|
+
readonly MODULE_DISPOSE_ERROR: "module.dispose.error";
|
|
2159
|
+
readonly MODULE_REGISTERED: "module.registered";
|
|
2160
|
+
readonly MODULE_UNREGISTERED: "module.unregistered";
|
|
2161
|
+
readonly EXECUTION_HIERARCHY: "execution.hierarchy";
|
|
2162
|
+
readonly EXECUTION_REALTIME: "execution.realtime";
|
|
2163
|
+
readonly TOOL_REALTIME: "tool.realtime";
|
|
2164
|
+
readonly CUSTOM: "custom";
|
|
2165
|
+
};
|
|
2166
|
+
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';
|
|
1954
2167
|
/**
|
|
1955
|
-
*
|
|
2168
|
+
* Valid event data value types
|
|
1956
2169
|
*/
|
|
1957
|
-
type
|
|
2170
|
+
type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
|
|
2171
|
+
[key: string]: TEventDataValue;
|
|
2172
|
+
};
|
|
1958
2173
|
/**
|
|
1959
|
-
*
|
|
2174
|
+
* Event data structure
|
|
1960
2175
|
*/
|
|
1961
|
-
interface
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
*/
|
|
1971
|
-
validate(parameters: TToolParameters): boolean;
|
|
1972
|
-
/**
|
|
1973
|
-
* Validate tool parameters with detailed result
|
|
1974
|
-
*/
|
|
1975
|
-
validateParameters(parameters: TToolParameters): IParameterValidationResult;
|
|
1976
|
-
/**
|
|
1977
|
-
* Get tool description
|
|
1978
|
-
*/
|
|
1979
|
-
getDescription(): string;
|
|
2176
|
+
interface IEventEmitterEventData {
|
|
2177
|
+
type: TEventName;
|
|
2178
|
+
timestamp: Date;
|
|
2179
|
+
executionId?: string;
|
|
2180
|
+
sessionId?: string;
|
|
2181
|
+
userId?: string;
|
|
2182
|
+
data?: Record<string, TEventDataValue>;
|
|
2183
|
+
error?: Error;
|
|
2184
|
+
metadata?: Record<string, TEventDataValue>;
|
|
1980
2185
|
}
|
|
1981
2186
|
/**
|
|
1982
|
-
*
|
|
2187
|
+
* Event listener function
|
|
1983
2188
|
*/
|
|
1984
|
-
|
|
1985
|
-
/** Function to execute */
|
|
1986
|
-
fn: TToolExecutor;
|
|
1987
|
-
}
|
|
2189
|
+
type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
|
|
1988
2190
|
/**
|
|
1989
|
-
*
|
|
2191
|
+
* Console-like interface for the EventEmitterPlugin.
|
|
2192
|
+
*
|
|
2193
|
+
* Use this interface for typing instead of the concrete EventEmitterPlugin class.
|
|
1990
2194
|
*/
|
|
1991
|
-
interface
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2195
|
+
interface IEventEmitterPlugin {
|
|
2196
|
+
on(eventType: TEventName, listener: TEventEmitterListener, options?: {
|
|
2197
|
+
once?: boolean;
|
|
2198
|
+
filter?: (event: IEventEmitterEventData) => boolean;
|
|
2199
|
+
}): string;
|
|
2200
|
+
once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
|
|
2201
|
+
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
2202
|
+
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
2203
|
+
}
|
|
2204
|
+
//#endregion
|
|
2205
|
+
//#region src/abstracts/abstract-module-types.d.ts
|
|
2206
|
+
/** Module execution context */
|
|
2207
|
+
interface IModuleExecutionContext {
|
|
2208
|
+
executionId?: string;
|
|
2209
|
+
sessionId?: string;
|
|
2210
|
+
userId?: string;
|
|
2211
|
+
agentName?: string;
|
|
2212
|
+
metadata?: Record<string, string | number | boolean | Date>;
|
|
2213
|
+
[key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
|
|
2214
|
+
}
|
|
2215
|
+
/** Module execution result */
|
|
2216
|
+
interface IModuleExecutionResult {
|
|
2217
|
+
success: boolean;
|
|
2218
|
+
data?: IModuleResultData;
|
|
2219
|
+
error?: Error;
|
|
2220
|
+
duration?: number;
|
|
2221
|
+
metadata?: Record<string, string | number | boolean | Date>;
|
|
2222
|
+
}
|
|
2223
|
+
/** Module result data */
|
|
2224
|
+
interface IModuleResultData {
|
|
2225
|
+
[key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
|
|
2226
|
+
}
|
|
2227
|
+
/** Base module options */
|
|
2228
|
+
interface IBaseModuleOptions {
|
|
2229
|
+
enabled?: boolean;
|
|
2230
|
+
config?: Record<string, string | number | boolean>;
|
|
2231
|
+
}
|
|
2232
|
+
/** Module capabilities */
|
|
2233
|
+
interface IModuleCapabilities {
|
|
2234
|
+
capabilities: string[];
|
|
2235
|
+
dependencies?: string[];
|
|
2236
|
+
optionalDependencies?: string[];
|
|
2237
|
+
}
|
|
2238
|
+
/** Module type descriptor */
|
|
2239
|
+
interface IModuleDescriptor {
|
|
2240
|
+
type: string;
|
|
2241
|
+
category: ModuleCategory;
|
|
2242
|
+
layer: ModuleLayer;
|
|
2243
|
+
dependencies?: string[];
|
|
2244
|
+
capabilities?: string[];
|
|
2245
|
+
}
|
|
2246
|
+
/** Module categories */
|
|
2247
|
+
declare enum ModuleCategory {
|
|
2248
|
+
CORE = "core",
|
|
2249
|
+
STORAGE = "storage",
|
|
2250
|
+
PROCESSING = "processing",
|
|
2251
|
+
INTEGRATION = "integration",
|
|
2252
|
+
INTERFACE = "interface",
|
|
2253
|
+
CAPABILITY = "capability"
|
|
2254
|
+
}
|
|
2255
|
+
/** Module layers */
|
|
2256
|
+
declare enum ModuleLayer {
|
|
2257
|
+
INFRASTRUCTURE = "infrastructure",
|
|
2258
|
+
CORE = "core",
|
|
2259
|
+
APPLICATION = "application",
|
|
2260
|
+
DOMAIN = "domain",
|
|
2261
|
+
PRESENTATION = "presentation"
|
|
2262
|
+
}
|
|
2263
|
+
/** Module data for introspection */
|
|
2264
|
+
interface IModuleData {
|
|
2265
|
+
name: string;
|
|
2266
|
+
version: string;
|
|
2267
|
+
type: string;
|
|
2268
|
+
enabled: boolean;
|
|
2269
|
+
initialized: boolean;
|
|
2270
|
+
capabilities: IModuleCapabilities;
|
|
2271
|
+
metadata?: Record<string, string | number | boolean>;
|
|
2272
|
+
}
|
|
2273
|
+
/** Module statistics */
|
|
2274
|
+
interface IModuleStats {
|
|
2275
|
+
enabled: boolean;
|
|
2276
|
+
initialized: boolean;
|
|
2277
|
+
executionCount: number;
|
|
2278
|
+
errorCount: number;
|
|
2279
|
+
lastActivity?: Date;
|
|
2280
|
+
averageExecutionTime?: number;
|
|
2281
|
+
[key: string]: string | number | boolean | Date | undefined;
|
|
2282
|
+
}
|
|
2283
|
+
/** Type-safe module interface */
|
|
2284
|
+
interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
|
|
2285
|
+
name: string;
|
|
2286
|
+
version: string;
|
|
2287
|
+
enabled: boolean;
|
|
2288
|
+
initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
|
|
2289
|
+
dispose?(): Promise<void>;
|
|
2290
|
+
execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
|
|
2291
|
+
getModuleType(): IModuleDescriptor;
|
|
2292
|
+
getCapabilities(): IModuleCapabilities;
|
|
2293
|
+
getData?(): IModuleData;
|
|
2294
|
+
getStats?(): TStats;
|
|
2295
|
+
isEnabled(): boolean;
|
|
2296
|
+
isInitialized(): boolean;
|
|
2020
2297
|
}
|
|
2021
2298
|
//#endregion
|
|
2022
2299
|
//#region src/abstracts/abstract-plugin-types.d.ts
|
|
@@ -2350,6 +2627,11 @@ interface IAbstractTool<TParams = TToolParameters, TResult = IToolResult> {
|
|
|
2350
2627
|
interface IToolContract<TParameters = TToolParameters, TResult = IToolResult> {
|
|
2351
2628
|
readonly schema: IToolSchema;
|
|
2352
2629
|
execute(parameters: TParameters, context: IToolExecutionContext): Promise<TResult>;
|
|
2630
|
+
/**
|
|
2631
|
+
* Wrappers await admission exactly once with final canonical arguments after preconditions and before
|
|
2632
|
+
* the body. Denial returns without admission. Admission failures propagate unchanged.
|
|
2633
|
+
*/
|
|
2634
|
+
executeWithAdmission?(parameters: TParameters, context: IToolExecutionContext, admit: TToolEffectAdmission<TParameters>): Promise<TResult>;
|
|
2353
2635
|
validate(parameters: TParameters): boolean;
|
|
2354
2636
|
validateParameters(parameters: TParameters): IParameterValidationResult;
|
|
2355
2637
|
getDescription(): string;
|
|
@@ -2960,6 +3242,8 @@ interface IToolManager {
|
|
|
2960
3242
|
* deferral is not engaged. The same member `IDeferredToolCatalog` declares.
|
|
2961
3243
|
*/
|
|
2962
3244
|
listDeferredTools(): IToolSchema[];
|
|
3245
|
+
/** Loaded residency for compatible execution checkpoints. */
|
|
3246
|
+
getLoadedDeferredTools?(): string[];
|
|
2963
3247
|
/**
|
|
2964
3248
|
* CLI-1990: mark deferred tools loaded for the rest of the session and return their schemas; an
|
|
2965
3249
|
* unknown name throws, naming it, before anything is loaded. The same member
|
|
@@ -4284,6 +4568,35 @@ declare class ErrorUtils {
|
|
|
4284
4568
|
static wrapProviderError(error: TErrorExternalInput, provider: string, operation: string): ProviderError;
|
|
4285
4569
|
}
|
|
4286
4570
|
//#endregion
|
|
4571
|
+
//#region src/utils/execution-journal-error.d.ts
|
|
4572
|
+
/** A persistence/admission failure must never become a model-visible, retryable tool failure. */
|
|
4573
|
+
declare class ExecutionJournalError extends Error {
|
|
4574
|
+
readonly code = "EXECUTION_JOURNAL_FAILED";
|
|
4575
|
+
readonly recordId: string;
|
|
4576
|
+
readonly kind: TExecutionJournalRecord['kind'];
|
|
4577
|
+
constructor(record: TExecutionJournalRecord, cause: unknown);
|
|
4578
|
+
}
|
|
4579
|
+
//#endregion
|
|
4580
|
+
//#region src/utils/execution-suspended-error.d.ts
|
|
4581
|
+
/** A persisted wait is control flow, never a failed tool result or semantic completion. */
|
|
4582
|
+
declare class ExecutionSuspendedError extends Error {
|
|
4583
|
+
readonly code = "EXECUTION_SUSPENDED";
|
|
4584
|
+
readonly requests: readonly IToolWaitRequest[];
|
|
4585
|
+
constructor(requests: readonly IToolWaitRequest[]);
|
|
4586
|
+
}
|
|
4587
|
+
//#endregion
|
|
4588
|
+
//#region src/utils/execution-recovery-error.d.ts
|
|
4589
|
+
type TExecutionRecoveryErrorCode = 'EXECUTION_RECOVERY_INVALID' | 'EXECUTION_RECOVERY_REQUIRED' | 'EXECUTION_RECOVERY_CONFLICT';
|
|
4590
|
+
/** Recovery refuses unproven effects or history instead of guessing whether to replay them. */
|
|
4591
|
+
declare class ExecutionRecoveryError extends Error {
|
|
4592
|
+
readonly code: TExecutionRecoveryErrorCode;
|
|
4593
|
+
readonly actionIds: readonly string[];
|
|
4594
|
+
constructor(code: TExecutionRecoveryErrorCode, message: string, actionIds?: readonly string[]);
|
|
4595
|
+
}
|
|
4596
|
+
//#endregion
|
|
4597
|
+
//#region src/utils/execution-control-error.d.ts
|
|
4598
|
+
declare function isExecutionControlError(error: unknown): error is ExecutionJournalError | ExecutionRecoveryError | ExecutionSuspendedError;
|
|
4599
|
+
//#endregion
|
|
4287
4600
|
//#region src/utils/timer-types.d.ts
|
|
4288
4601
|
/**
|
|
4289
4602
|
* Cross-platform timer identifier type.
|
|
@@ -4391,6 +4704,9 @@ declare function subprocessTraceEnvironment(base: Readonly<Record<string, string
|
|
|
4391
4704
|
*/
|
|
4392
4705
|
declare function traceHeadersFor(baseUrl: string | undefined, traceContext: IOutboundTraceContext | undefined): Readonly<Record<string, string>>;
|
|
4393
4706
|
//#endregion
|
|
4707
|
+
//#region src/services/execution-journal.d.ts
|
|
4708
|
+
declare function callJournaledProvider(chat: (messages: TUniversalMessage[], options: IChatOptions) => Promise<TUniversalMessage>, messages: TUniversalMessage[], options: IChatOptions, context?: IModelJournalContext): Promise<TUniversalMessage>;
|
|
4709
|
+
//#endregion
|
|
4394
4710
|
//#region src/schema/zod-to-json-schema.d.ts
|
|
4395
4711
|
/**
|
|
4396
4712
|
* Convert a Zod schema to the universal JSON-schema subset.
|
|
@@ -5037,6 +5353,7 @@ declare class FunctionTool implements IFunctionTool {
|
|
|
5037
5353
|
* Set EventService for post-construction injection.
|
|
5038
5354
|
* Accepts EventService as-is without transformation.
|
|
5039
5355
|
* Caller is responsible for providing properly configured EventService.
|
|
5356
|
+
* A call whose context carries `instanceEventService` emits there instead.
|
|
5040
5357
|
*/
|
|
5041
5358
|
setEventService(eventService: IEventService | undefined): void;
|
|
5042
5359
|
/**
|
|
@@ -5320,6 +5637,7 @@ declare class Tools extends AbstractManager implements IToolManager {
|
|
|
5320
5637
|
/** Whether a call to this tool would execute now: registered, and offered by the projection. */
|
|
5321
5638
|
isToolOffered(name: string): boolean;
|
|
5322
5639
|
/** Deferred tools not yet loaded — the population a search discovers. Empty while deferral is off. */
|
|
5640
|
+
getLoadedDeferredTools(): string[];
|
|
5323
5641
|
listDeferredTools(): IToolSchema[];
|
|
5324
5642
|
/**
|
|
5325
5643
|
* Mark deferred tools loaded for the rest of the session. Every name is resolved before any is
|
|
@@ -5459,6 +5777,16 @@ declare class Robota extends RobotaBase implements IAgent<IAgentConfig, IRunOpti
|
|
|
5459
5777
|
listRuntimeTools(): Promise<IToolSchema[]>;
|
|
5460
5778
|
/** Explicit tool invocation through the same executor used by model turns. */
|
|
5461
5779
|
invokeRuntimeTool(name: string, parameters: TToolParameters, context: IToolExecutionContext): Promise<IToolExecutionResult>;
|
|
5780
|
+
/**
|
|
5781
|
+
* Resume a compatible journaled execution without adding input or repeating settled calls.
|
|
5782
|
+
* Retain restored history for the host to checkpoint or discard, including on interruption.
|
|
5783
|
+
*/
|
|
5784
|
+
resume(value: IResumeExecutionOptions): Promise<string>;
|
|
5785
|
+
/**
|
|
5786
|
+
* Restore the latest journaled tool batch without a model call or new user input.
|
|
5787
|
+
* The host must own the journal exclusively and settle the previous runtime first.
|
|
5788
|
+
*/
|
|
5789
|
+
resumeToolCalls(value: IResumeToolCallsOptions): Promise<IResumeToolCallsResult>;
|
|
5462
5790
|
/**
|
|
5463
5791
|
* Concurrency contract (CORE-012): a Robota instance owns ONE conversation history, so
|
|
5464
5792
|
* concurrent `run`/`runStream` calls on the same instance are serialized on an internal queue —
|
|
@@ -5839,6 +6167,19 @@ declare function isRegistryTransactionError(error: unknown): error is IRegistryT
|
|
|
5839
6167
|
*/
|
|
5840
6168
|
declare function runRegistryTransaction(steps: readonly IRegistryTransactionStep[]): Promise<void>;
|
|
5841
6169
|
//#endregion
|
|
6170
|
+
//#region src/services/provider-call-usage.d.ts
|
|
6171
|
+
type TProviderUsageProvenance = 'complete' | 'partial' | 'absent';
|
|
6172
|
+
interface IVerifiedProviderCallUsage {
|
|
6173
|
+
readonly provenance: TProviderUsageProvenance;
|
|
6174
|
+
readonly promptTokens?: number;
|
|
6175
|
+
readonly completionTokens?: number;
|
|
6176
|
+
readonly totalTokens?: number;
|
|
6177
|
+
/** The part of `promptTokens` served from the provider's prompt cache, when it was reported. */
|
|
6178
|
+
readonly cacheReadTokens?: number;
|
|
6179
|
+
}
|
|
6180
|
+
/** Keep billing/telemetry stricter than context-window heuristics: only adapter-attested totals count. */
|
|
6181
|
+
declare function verifiedProviderCallUsage(message: TUniversalMessage | undefined): IVerifiedProviderCallUsage;
|
|
6182
|
+
//#endregion
|
|
5842
6183
|
//#region src/services/execution-usage.d.ts
|
|
5843
6184
|
/**
|
|
5844
6185
|
* Aggregate token totals over a whole session/sub-session history.
|
|
@@ -5847,19 +6188,43 @@ declare function runRegistryTransaction(steps: readonly IRegistryTransactionStep
|
|
|
5847
6188
|
* same triple by definition, so it is derived rather than re-declared.
|
|
5848
6189
|
*/
|
|
5849
6190
|
type ISessionUsageTotals = ITokenUsage;
|
|
6191
|
+
/**
|
|
6192
|
+
* Sum the token usage the provider reported on the assistant messages of `messages`.
|
|
6193
|
+
*
|
|
6194
|
+
* `promptTokens` sums each message's input tokens, `completionTokens` its output tokens, and
|
|
6195
|
+
* `totalTokens` is their sum — which can differ from the totals providers reported (a thinking
|
|
6196
|
+
* model's total also counts thought tokens). `cacheReadTokens` — the part of `promptTokens` served
|
|
6197
|
+
* from the provider's prompt cache — is present only when at least one message reported it, and is a
|
|
6198
|
+
* lower bound when only some did. Returns undefined when no assistant message reported usage.
|
|
6199
|
+
*
|
|
6200
|
+
* One run's usage (every provider call it made, tool rounds and a forced summary included):
|
|
6201
|
+
*
|
|
6202
|
+
* ```ts
|
|
6203
|
+
* const before = agent.getHistory().length;
|
|
6204
|
+
* await agent.run(prompt);
|
|
6205
|
+
* const usage = sumMessagesUsage(agent.getHistory().slice(before));
|
|
6206
|
+
* ```
|
|
6207
|
+
*/
|
|
6208
|
+
declare function sumMessagesUsage(messages: readonly TUniversalMessage[]): ITokenUsageWithCacheRead | undefined;
|
|
5850
6209
|
/**
|
|
5851
6210
|
* ANALYTICS-001 (Phase 2): sum assistant token usage across a history timeline — used to capture a
|
|
5852
6211
|
* subagent / background task's total usage so it can be attributed to its source in the parent log.
|
|
5853
6212
|
* Returns undefined when no usage was reported (so callers can skip recording an empty entry).
|
|
6213
|
+
*
|
|
6214
|
+
* The result is exactly the usage triple: it is persisted as a background task's usage, whose record
|
|
6215
|
+
* declares no other key. Use {@link sumMessagesUsage} for the prompt-cache read as well.
|
|
5854
6216
|
*/
|
|
5855
6217
|
declare function sumHistoryUsage(history: readonly IHistoryEntry[]): ISessionUsageTotals | undefined;
|
|
5856
6218
|
interface IAssistantUsageMetadata {
|
|
5857
6219
|
inputTokens: number;
|
|
5858
6220
|
outputTokens: number;
|
|
6221
|
+
/** The part of `inputTokens` served from the provider's prompt cache, when it was reported. */
|
|
6222
|
+
cacheReadTokens?: number;
|
|
5859
6223
|
usage: {
|
|
5860
6224
|
totalTokens: number;
|
|
5861
6225
|
inputTokens: number;
|
|
5862
6226
|
outputTokens: number;
|
|
6227
|
+
cacheReadTokens?: number;
|
|
5863
6228
|
};
|
|
5864
6229
|
}
|
|
5865
6230
|
declare function collectAssistantUsageMetadata(message: TUniversalMessage): IAssistantUsageMetadata | undefined;
|
|
@@ -6682,6 +7047,10 @@ interface IContextTokenUsage {
|
|
|
6682
7047
|
inputTokens: number;
|
|
6683
7048
|
outputTokens: number;
|
|
6684
7049
|
cacheCreationTokens?: number;
|
|
7050
|
+
/**
|
|
7051
|
+
* Anthropic-style: cache reads counted in addition to `inputTokens`. Not the message-usage
|
|
7052
|
+
* `cacheReadTokens` (`IMessageTokenUsage`), which is a part of the input.
|
|
7053
|
+
*/
|
|
6685
7054
|
cacheReadTokens?: number;
|
|
6686
7055
|
}
|
|
6687
7056
|
/** Context window state snapshot */
|
|
@@ -6721,6 +7090,11 @@ interface IMessageTokenUsage {
|
|
|
6721
7090
|
readonly inputTokens: number;
|
|
6722
7091
|
readonly outputTokens: number;
|
|
6723
7092
|
readonly totalTokens?: number;
|
|
7093
|
+
/**
|
|
7094
|
+
* The part of `inputTokens` the provider served from its prompt cache (a subset of `inputTokens`).
|
|
7095
|
+
* Present only when the provider reported it.
|
|
7096
|
+
*/
|
|
7097
|
+
readonly cacheReadTokens?: number;
|
|
6724
7098
|
}
|
|
6725
7099
|
/** Read normalized provider usage from a universal message when present. */
|
|
6726
7100
|
declare function readTokenUsageFromMessage(message: TUniversalMessage): IMessageTokenUsage | undefined;
|
|
@@ -6894,5 +7268,5 @@ declare function decodeHookVerdict(raw: string, source: THookDefinition['type'],
|
|
|
6894
7268
|
/** Does a hook that reached no verdict block at this event? */
|
|
6895
7269
|
declare function isEnforcing(event: THookEvent): boolean;
|
|
6896
7270
|
//#endregion
|
|
6897
|
-
export { parseParameterRule as $, IAgentConfig as $a, resolveModelCapabilities as $c, isConfirmed as $i, createImageProviderFromDefinition as $n, TASK_EVENT_PREFIX as $o, IToolSchemaProjectionProfile as $r, IRawProviderResponse as $s, lifecycleOf as $t, allowRulesForAutoMode as A, IProviderStructuredOutputCapability as Aa, AuthenticationError as Ac, IRemoteExecutorConfig as Ai, ICacheEntry as Al, IEventEmitterMetricsSnapshot as An, PluginPriority as Ao, TTimerId as Ar, TOOL_SEARCH_TOOL_NAME as As, IHandoffOrchestrationSpec as At, IPermissionPolicyProjection as B, IProviderProfileConfig as Ba, RobotaError as Bc, TConversationContextMetadata as Bi, TMetadata as Bl, isEnvReference as Bn, ISpanCompletionEventData as Bo, TMessageConverterRegistry as Br, normalizeStructuredOutput as Bs, AGENT_EVENTS as Bt, IContextTokenEstimate as C, IVideoGenerationRequest as Ca, IModelFallbackNotice as Cc, IEventHistorySnapshot as Ci, isUserMessage as Cl, assertResidentToolRemains as Cn, IPluginErrorContext as Co, IPlatformShell as Cr, EVENT_EMITTER_EVENTS as Cs, createExecutionProxy as Ct, estimateToolSchemaTokens as D, TProviderMediaResult as Da, classifyProviderFailure as Dc, IExecutorStreamMessageEvent as Di, IActionRequest as Dl, IEventEmitterHierarchicalEventData as Dn, IPluginOptions as Do, resolvePlatformShell as Dr, TEventName as Ds, ORCHESTRATION_EVENT_PREFIX as Dt, estimateSerializedContextTokens as E, TImageInputSource as Ea, TProviderFailureReason as Ec, IExecutorChatResult as Ei, IActionOption as El, EventEmitterPlugin as En, IPluginHooks as Eo, UnsupportedShellError as Er, TEventEmitterListener as Es, ORCHESTRATION_EVENTS as Et, IPermissionPatternProblem as F, IProviderDefinitionConfig as Fa, ModelNotAvailableError as Fc, IConversationResponse as Fi, TComplexConfigValue as Fl, TOutputRetention as Fn, IToolExecutionResult as Fo, validateApiKey as Fr, TExecutionEventData as Fs, IOrchestrationStep as Ft, IToolPermissionArgument as G, TProviderModelCatalogStatus as Ga, TErrorExternalInput as Gc, TToolProgressCallback as Gi, createAssistantMessage as Gn, TOOL_BODY_EVENTS as Go, AbstractExecutor as Gr, IZodSchema as Gs, IAssistantUsageMetadata as Gt, IParameterRule as H, IProviderSetupHelpLink as Ha, StorageError as Hc, TToolExecutionParameters as Hi, TToolParameters as Hl, IAIProviderInstance as Hn, PROVIDER_FALLBACK_EVENTS as Ho, TProviderMessage as Hr, validateAgainstJsonSchema as Hs, peerDriverOf as Ht, findInvalidPermissionPatterns as I, IProviderEndpoint as Ia, NetworkError as Ic, IConversationService as Ii, TConfigData as Il, createBoundedOutput as In, IToolRegistry as Io, validateModelName as Ir, IJsonSchemaOutput as Is, IOrchestrationStepResult as It, clearRegisteredToolProfiles as J, TProviderSetupHelpLinkKind as Ja, IModelRef as Jc, isProgressReportingTool as Ji, createUserMessage as Jn, readModelFallbackNotice as Jo, IExecutorAwareProviderConfig as Jr, IAIProvider as Js, sumHistoryUsage as Jt, IToolPermissionProfile as K, TProviderModelLifecycle as Ka, ToolExecutionError as Kc, getToolEstimatedDuration as Ki, createSystemMessage as Kn, TOOL_PERMISSION_EVENTS as Ko, AbstractPlugin as Kr, IZodSchemaDef as Ks, ISessionUsageTotals as Kt, findPermissionPatternWarnings as L, IProviderModelCatalog as La, PluginError as Lc, IConversationServiceOptions as Li, TConfigValue as Ll, ENV_REFERENCE_PREFIX as Ln, IToolResult as Lo, validateProviderName as Lr, IStructuredOutputSpec as Ls, IParallelOrchestrationSpec as Lt, splitCommandSegments as M, TStructuredOutputProvenance as Ma, CircuitBreakerOpenError as Mc, TExecutorStreamEvent as Mi, ICacheOptions as Ml, shellArgumentForDisplay as Mn, IParameterValidationResult as Mo, ISimpleValidationResult as Mr, TToolSearchSetting as Ms, IOrchestrationDelegation as Mt, applyPresetToolLists as N, IProviderCredentialRequirement as Na, ConfigurationError as Nc, IContextOptions as Ni, ICacheStats as Nl, IBoundedOutput as Nn, ITool as No, Validator as Nr, IRunOptions as Ns, IOrchestrationEventData as Nt, IContextTokenUsage as O, isImageGenerationProvider as Oa, readProviderFailureDetails as Oc, IExecutorStreamTerminalEvent as Oi, IUserInteraction as Ol, IEventEmitterPluginOptions as On, IPluginStats as Oo, startPeriodicTask as Or, TExecutionEventName as Os, TOrchestrationEvent as Ot, toolNamesToPatterns as P, IProviderDefinition as Pa, IProviderFailureDetails as Pc, IConversationContext as Pi, ICacheStorage as Pl, IBoundedOutputOptions as Pn, IToolExecutionContext as Po, validateAgentConfig as Pr, TExecutionEventCallback as Ps, IOrchestrationRunResult as Pt, matchesAnyPattern as Q, IAgent as Qa, modelDeclaresCapability as Qc, confirmAction as Qi, IMediaProviderOverrides as Qn, TASK_EVENTS as Qo, IToolSchemaProjectionChange as Qr, IProviderRequest as Qs, isRegistryTransactionError as Qt, validatePermissionPattern as R, IProviderModelCatalogEntry as Ra, ProviderError as Rc, IStreamingChunk as Ri, TContextData as Rl, formatEnvReference as Rn, TToolExecutor as Ro, validateUserInput as Rr, TStructuredOutputSchema as Rs, ISequentialOrchestrationSpec as Rt, CONTEXT_ESTIMATE_CHARS_PER_TOKEN as S, IVideoGenerationProvider as Sa, createDefaultProviderCapabilities as Sc, IEventHistoryRecord as Si, isToolMessage as Sl, DEFERRED_WITHOUT_LOADER_MESSAGE as Sn, IPluginData as So, traceHeadersFor as Sr, TEventUniversalValue as Ss, ExecutionProxy as St, estimateContextTokensFromMessages as T, IVideoJobSnapshot as Ta, IProviderFailureClassification as Tc, IExecutor as Ti, IActionDefault as Tl, ToolRegistry as Tn, IPluginExecutionResult as To, TShellKind as Tr, IEventEmitterPlugin as Ts, IExecutionProxyConfig as Tt, IPermissionEvaluationContext as U, IProviderSetupStepDefinition as Ua, StructuredOutputError as Uc, IProgressReportingTool as Ui, TypeUtils as Ul, LocalExecutor as Un, SPAN_EVENTS as Uo, isAbortFailure as Ur, ISchemaConversionOptions as Us, printablePeerDriver as Ut, projectPermissionPolicy as V, IProviderProfileDefaults as Va, SameToolInputLoopError as Vc, TResponseMetadata as Vi, TMetadataValue as Vl, resolveEnvReference as Vn, PROVIDER_CALL_EVENTS as Vo, TMessageFormatConverter as Vr, parseStructuredResponseText as Vs, AGENT_EVENT_PREFIX as Vt, IPermissionLists as W, TProviderCredentialField as Wa, TErrorContextData as Wc, IToolExecutionStep as Wi, ConversationHistory as Wn, SPAN_EVENT_PREFIX as Wo, AbstractTool as Wr, IZodParseResult as Ws, EventHistoryModule as Wt, getToolPermissionProfile as X, formatSupportedProviderTypes as Xa, IModelCapabilityDeviation as Xc, CONFIRM_NO as Xi, createProviderFromConfig as Xn, USER_EVENTS as Xo, TProviderLoggingData as Xr, IProviderNativeRawPayloadEvent as Xs, IRegistryTransactionError as Xt, evaluatePermission as Y, findProviderDefinition as Ya, TRoleModelMap as Yc, setToolProgressCallback as Yi, ConversationStore as Yn, TUserEvent as Yo, IProviderRuntimeConfig as Yr, IChatOptions as Ys, IRegistryOwnedLifecycle as Yt, isToolDeniedOutright as Z, getProviderCredentialRequirement as Za, IProviderCapabilityTable as Zc, CONFIRM_YES as Zi, normalizeProviderConfig as Zn, USER_EVENT_PREFIX as Zo, IToolSchemaProjection as Zr, IProviderOptions as Zs, IRegistryTransactionStep as Zt, getModelName as _, IImageGenerationResult as _a, IProviderFunctionCallingCapability as _c, IStats as _i, chatEntryToMessage as _l, IDestroyResult as _n, setGlobalLoggerSink as _o, providerCallSpanId as _r, IOwnerPathSegment as _s, TBackgroundPermissionPolicy as _t, IModelPrice as a, IAIProviderManager as aa, TProviderOptionValueBase as ac, TToolSchemaProjectionOutcome as ai, IInlineImageMessagePart as al, IAgentFactoryOptions as an, TToolExecutionFunction as ao, IStructuredOutputResolutionInput as ar, bindEventServiceOwner as as, PROTECTED_FILE_NAMES as at, readTokenUsageFromMessage as b, IProviderMediaError as ba, IProviderNativeWebToolRequest as bc, ITerminalOutput as bi, isChatEntry as bl, TOOL_EVENTS as bn, IPluginContext as bo, toolTraceContextFor as br, TEventListener as bs, TRUST_TO_MODE as bt, estimateBlendedCostPer1000 as c, IMediaProviderConfig as ca, getProviderCapabilities as cc, projectToolSchema as ci, IToolCall as cl, DEFAULT_TOOL_RESULT_WARNING_CHARS as cn, ILoggerOptions as co, getSchemaTypeName as cr, generateSpanId as cs, RISK_CLASS_POLICY as ct, DEFAULT_MAX_OUTPUT as d, findMediaProviderDefinition as da, IToolSchema as dc, AbstractAgent as di, IUserMessage as dl, MAX_TOOL_RESULT_CHARS as dn, TUtilLogLevel as do, ISchemaClosureOptions as dr, IBaseEventData as ds, TArgumentKind as dt, multiSelectAction as ea, ITokenUsage as ec, PARAMETER_SCHEMA_KEYWORDS as ei, resolveModelCapability as el, runRegistryTransaction as en, IAgentTemplate as eo, createVideoProviderFromDefinition as er, AbstractEventService as es, registerToolPermissionProfile as et, IModelDefinition as f, isMediaProviderDefinition as fa, TJSONSchemaEnum as fc, ICredentialKey as fi, TMessageState as fl, TToolResultAdmissionErrorCode as fn, createLogger as fo, closeObjectSchemas as fr, IEventContext as fs, TMatchDirection as ft, getModelMaxOutput as g, IImageGenerationRequest as ga, IProviderCapabilities as gc, IFileSystemAsync as gi, TUniversalMessageRole as gl, Robota as gn, setGlobalLogLevel as go, outboundTraceContextFor as gr, IExecutionEventData as gs, DEFAULT_BACKGROUND_PERMISSION_POLICY as gt, getModelContextWindow as h, IImageGenerationProvider as ha, IProviderSpecificOptions as hc, IFileSystem as hi, TUniversalMessagePart as hl, wasToolResultAdmitted as hn, logger as ho, isMintedSpanId as hr, IEventServiceOwnerBinding as hs, isReadOnlyCommandLine as ht, runHooks as i, IToolFactory as ia, TProviderNativeRawPayloadKind as ic, TOOL_SCHEMA_PROJECTION_MAX_NODES as ii, IHistoryEntry as il, IAgentCreationStats as in, IToolWithEventService as io, processEnvResolver as ir, StructuredEventService as is, PROTECTED_DIRECTORY_NAMES as it, isBroadExecutionAllowRule as j, TStructuredOutputMechanism as ja, CacheIntegrityError as jc, IStreamExecutionRequest as ji, ICacheKey as jl, InMemoryEventEmitterMetrics as jn, IFunctionTool as jo, ErrorUtils as jr, TToolSearchMode as js, IHierarchicalOrchestrationSpec as jt, IContextWindowState as k, isVideoGenerationProvider as ka, toProviderError as kc, ILocalExecutorConfig as ki, TActionResponse as kl, IEventEmitterMetrics as kn, PluginCategory as ko, stopPeriodicTask as kr, IDeferredToolCatalog as ks, IGroupChatOrchestrationSpec as kt, lookupModelPrice as l, IMediaProviderCredentialRequirement as la, IObjectParameterSchema as lc, AbstractManager as li, IToolMessage as ll, IToolResultAdmissionOptions as ln, IUtilLogEntry as lo, hasValidationConstraints as lr, isDefaultEventService as ls, TToolRiskClass as lt, formatTokenCount as m, IImageEditRequest as ma, TParameterDefaultValue as mc, IDirent as mi, TUniversalMessageMetadata as ml, admitToolResult as mn, getGlobalLoggerSink as mo, buildTraceparent as mr, IEventService as ms, TResolveInWorkspace as mt, decodeHookVerdict as n, textAction as na, TProviderNativeRawPayload as nc, STRICT_TOOL_SCHEMA_PROFILE as ni, IAssistantMessage as nl, AgentTemplates as nn, IAbstractToolOptions as no, TEnvResolver as nr, DefaultEventService as ns, toolNameMatches as nt, MODEL_PRICES as o, IToolManager as oa, TTextDeltaCallback as oc, TToolSchemaProjectionProfileBase as oi, ISystemMessage as ol, IAgentLifecycleEvents as on, ConsoleLogger as oo, resolveStructuredOutputCapability as or, bindWithOwnerPath as os, isProtectedPath as ot, findModelDefinition as p, IImageComposeRequest as pa, TJSONSchemaKind as pc, ICredentialStore as pi, TUniversalMessage as pl, ToolResultAdmissionError as pn, getGlobalLogLevel as po, zodToJsonSchema as pr, IEventObjectValue as ps, IReadOnlyCommandContext as pt, TToolArgs as q, TProviderSetupField as qa, ValidationError as qc, getToolExecutionSteps as qi, createToolMessage as qn, TSpanEvent as qo, AbstractAIProvider as qr, IResponseFormatConfig as qs, collectAssistantUsageMetadata as qt, GuardrailExecutor as r, IOpenAPIToolConfig as ra, TProviderNativeRawPayloadCallback as rc, TOOL_SCHEMA_PROJECTION_MAX_DEPTH as ri, IBaseMessage as rl, ITemplateApplicationResult as rn, IToolContract as ro, createRecordEnvResolver as rr, ObservableEventService as rs, ICriticalPathContext as rt, calculateModelCost as s, TManagerToolParameters as sa, TToolChoice as sc, hashToolSchema as si, ITextMessagePart as sl, DEFAULT_TOOL_RESULT_HARD_CHARS as sn, ILogger as so, extractEnumValues as sr, composeEventName as ss, removesCriticalPath as st, isEnforcing as t, selectAction as ta, TProviderConfigValue as tc, PERMISSIVE_TOOL_SCHEMA_PROFILE as ti, TProviderModelCapability as tl, AgentFactory as tn, IAbstractTool as to, resolveMediaProviderConfig as tr, DEFAULT_ABSTRACT_EVENT_SERVICE as ts, requiresFreshApproval as tt, DEFAULT_CONTEXT_WINDOW as u, IMediaProviderDefinition as ua, IParameterSchema as uc, IManagerLifecycleOptions as ui, IUriImageMessagePart as ul, IToolResultSpillStore as un, SilentLogger as uo, ISchemaClosureChange as ur, IAgentEventData as us, UNCLASSIFIED_TOOL_FALLBACK as ut, registerModelMetadata as v, IInlineImageInputSource as va, IProviderNativeWebToolCapabilities as vc, ISession as vi, getMessagesForAPI as vl, EXECUTION_EVENTS as vn, IPlugin as vo, spanIdFromMintedId as vr, IToolEventData as vs, TPermissionDecision$1 as vt, IContextTokenEstimateOptions as w, IVideoJobAccepted as wa, TModelFallbackCallback as wc, IChatExecutionRequest as wi, messageToHistoryEntry as wl, FunctionTool as wn, IPluginExecutionContext as wo, IPlatformShellResolutionRequest as wr, IEventEmitterEventData as ws, withEventEmission as wt, readTokenUsageFromMetadata as x, IUriImageInputSource as xa, assertProviderNativeWebToolsAvailable as xc, IEventHistoryModule as xi, isSystemMessage as xl, TOOL_EVENT_PREFIX as xn, IPluginContract as xo, traceEnvFor as xr, TEventLoggerData as xs, TTrustLevel as xt, IMessageTokenUsage as y, IMediaOutputRef as ya, IProviderNativeWebToolCapability as yc, ISpinner as yi, isAssistantMessage as yl, EXECUTION_EVENT_PREFIX as yn, IPluginConfig as yo, subprocessTraceEnvironment as yr, TEventExtensionValue as ys, TPermissionMode as yt, IPermissionPolicyContext as z, IProviderProbeResult as za, RateLimitError as zc, IToolExecutionRequest as zi, TLoggerData as zl, hasUsableSecretReference as zn, TToolMetadata as zo, MessageConverter as zr, TStructuredOutputValidation as zs, TOrchestrationPrimitive as zt };
|
|
6898
|
-
//# sourceMappingURL=index-
|
|
7271
|
+
export { parseParameterRule as $, IProviderSetupStepDefinition as $a, assertProviderNativeWebToolsAvailable as $c, IProgressReportingTool as $i, isChatEntry 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, IProviderCapabilityTable 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, ITextMessagePart 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, TErrorContextData 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, IModelRef 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, ValidationError 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, IAssistantMessage 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, TMessageState 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, IToolMessage 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, IBaseMessage 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, TUniversalMessagePart 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, TUniversalMessage 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, IHistoryEntry 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, resolveModelCapabilities 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, resolveModelCapability 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, TRoleModelMap 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, TProviderModelCapability 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, isAssistantMessage 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, IInlineImageMessagePart 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, StructuredOutputError 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, ToolExecutionError 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, IUriImageMessagePart 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, IToolCall 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, IUserMessage 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, chatEntryToMessage 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, TUniversalMessageRole 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, getMessagesForAPI 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, ProviderError as _l, ToolResultAdmissionError as _n, ILogger as _o, zodToJsonSchema as _r, IRecoverableExecutionJournal as _s, TBackgroundPermissionPolicy as _t, TToolParameters 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, IToolContinuation as au, readTokenUsageFromMessage as b, IMediaProviderDefinition as ba, IToolEventData as bc, IManagerLifecycleOptions as bi, SameToolInputLoopError 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, IToolWaitResponse 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, TConfigData 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, isSystemMessage 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, TConfigValue as fu, getModelMaxOutput as g, IToolManager as ga, IEventService as gc, TToolSchemaProjectionProfileBase as gi, PluginError as gl, TToolResultAdmissionErrorCode as gn, ConsoleLogger as go, closeObjectSchemas as gr, IModelJournalContext as gs, DEFAULT_BACKGROUND_PERMISSION_POLICY as gt, TMetadataValue as gu, getModelContextWindow as h, IAIProviderManager as ha, IEventObjectValue as hc, TToolSchemaProjectionOutcome as hi, NetworkError as hl, MAX_TOOL_RESULT_CHARS as hn, TToolExecutionFunction as ho, ISchemaClosureOptions as hr, IExecutionRoundCheckpoint as hs, isReadOnlyCommandLine as ht, TMetadata 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, IToolActionIdentity as iu, isBroadExecutionAllowRule as j, IUriImageInputSource as ja, ITokenUsage as jc, IEventHistoryModule as ji, modelDeclaresCapability 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, IModelCapabilityDeviation 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, IToolWaitState as lu, formatTokenCount as m, IToolFactory as ma, IEventContext as mc, TOOL_SCHEMA_PROJECTION_MAX_NODES as mi, ModelNotAvailableError as ml, IToolResultSpillStore as mn, IToolWithEventService as mo, ISchemaClosureChange as mr, IExecutionJournal as ms, TResolveInWorkspace as mt, TLoggerData 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, isUserMessage 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, IToolContinuationPrompt as ou, findModelDefinition as p, IOpenAPIToolConfig as pa, IBaseEventData as pc, TOOL_SCHEMA_PROJECTION_MAX_DEPTH as pi, IProviderFailureDetails as pl, IToolResultAdmissionOptions as pn, IToolContract as po, hasValidationConstraints as pr, IExecutionContinuationState as ps, IReadOnlyCommandContext as pt, TContextData as pu, TToolArgs as q, IProviderModelCatalog as qa, IProviderSpecificOptions as qc, IConversationServiceOptions as qi, TUniversalMessageMetadata 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, messageToHistoryEntry 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, IToolWaitRequest 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, isToolMessage 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, TComplexConfigValue as uu, registerModelMetadata as v, IMediaProviderConfig as va, IExecutionEventData as vc, projectToolSchema as vi, RateLimitError as vl, admitToolResult as vn, ILoggerOptions as vo, callJournaledProvider as vr, IResumeExecutionOptions as vs, TPermissionDecision$1 as vt, TypeUtils as vu, IContextTokenEstimateOptions as w, IImageEditRequest as wa, TEventUniversalValue as wc, IDirent as wi, TErrorExternalInput 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, StorageError 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, RobotaError as yl, wasToolResultAdmitted as yn, IUtilLogEntry as yo, buildTraceparent as yr, IResumeToolCallsOptions as ys, TPermissionMode as yt, IPermissionPolicyContext as z, isVideoGenerationProvider as za, TToolChoice as zc, ILocalExecutorConfig as zi, ISystemMessage as zl, TOutputRetention as zn, PluginCategory as zo, ExecutionSuspendedError as zr, IActionRequest as zs, TOrchestrationPrimitive as zt };
|
|
7272
|
+
//# sourceMappingURL=index-gEUh4G-t.d.cts.map
|