@forgeax/engine-tool-runtime 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +72 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +849 -472
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +35 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
export type ToolRealm = 'build' | 'host' | 'engine';
|
|
2
|
+
/**
|
|
3
|
+
* Trusted identity of the plugin fiber that owns a callable contribution.
|
|
4
|
+
*
|
|
5
|
+
* This is deliberately data shaped: it may cross a Host transport and never
|
|
6
|
+
* contains a Context, Fiber, executor, or other live runtime handle.
|
|
7
|
+
*/
|
|
8
|
+
export interface ToolExecutionOwner {
|
|
9
|
+
readonly providerId: string;
|
|
10
|
+
readonly sourceId: string;
|
|
11
|
+
readonly generation: number;
|
|
12
|
+
readonly realm: ToolRealm;
|
|
13
|
+
readonly fiberId?: string | number;
|
|
14
|
+
readonly module?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Identity attached by a Host connection, rather than supplied in payload. */
|
|
17
|
+
export interface ToolCallerIdentity {
|
|
18
|
+
readonly connectionId: string;
|
|
19
|
+
readonly kind?: 'in-process' | 'websocket' | 'cli' | 'frontend' | 'unknown';
|
|
20
|
+
readonly sourceId?: string;
|
|
21
|
+
readonly sourceGeneration?: number;
|
|
22
|
+
}
|
|
2
23
|
export type ToolEvidenceKind = 'rhi-tape' | 'profile-capture' | 'png';
|
|
3
24
|
/** Stable subject identity carried by a domain contribution, never a live handle. */
|
|
4
25
|
export interface ToolSubjectRef {
|
|
@@ -98,6 +119,10 @@ export interface ToolSnapshotInput {
|
|
|
98
119
|
export interface ToolExecutionContext {
|
|
99
120
|
readonly runId: string;
|
|
100
121
|
readonly signal: AbortSignal;
|
|
122
|
+
/** Trusted owner assigned by the API capability, never client input. */
|
|
123
|
+
readonly owner?: ToolExecutionOwner;
|
|
124
|
+
/** Trusted caller attached by Host transport or an explicit local owner. */
|
|
125
|
+
readonly caller?: ToolCallerIdentity;
|
|
101
126
|
readonly snapshot?: SnapshotRef;
|
|
102
127
|
readonly emit: (event: ToolRunEvent) => void;
|
|
103
128
|
readonly addCleanup: (cleanup: () => void | Promise<void>) => void;
|
|
@@ -137,6 +162,14 @@ export interface ToolRunOptions extends ToolSnapshotInput {
|
|
|
137
162
|
readonly deadlineMs?: number;
|
|
138
163
|
readonly evidence?: readonly ToolEvidenceKind[];
|
|
139
164
|
readonly capabilityResolver?: ToolCapabilityResolver;
|
|
165
|
+
/** Explicit provider route used when one operation has multiple owners. */
|
|
166
|
+
readonly providerId?: string;
|
|
167
|
+
readonly sourceId?: string;
|
|
168
|
+
readonly generation?: number;
|
|
169
|
+
/** Internal owner context supplied by ToolApiRegistry. */
|
|
170
|
+
readonly owner?: ToolExecutionOwner;
|
|
171
|
+
/** Trusted caller context supplied by a Host or local execution owner. */
|
|
172
|
+
readonly caller?: ToolCallerIdentity;
|
|
140
173
|
}
|
|
141
174
|
export type ToolRunEvent = {
|
|
142
175
|
readonly kind: 'started';
|
|
@@ -162,6 +195,8 @@ export interface ToolRun<TResult> {
|
|
|
162
195
|
readonly id: string;
|
|
163
196
|
readonly events: AsyncIterable<ToolRunEvent>;
|
|
164
197
|
readonly terminal: Promise<ToolTerminal<TResult>>;
|
|
198
|
+
/** Resolves only after the executor promise has actually returned or thrown. */
|
|
199
|
+
readonly executorExited: Promise<void>;
|
|
165
200
|
readonly cancel: (reason?: string) => void;
|
|
166
201
|
readonly disconnect: (transport?: string) => void;
|
|
167
202
|
readonly providerExit: (provider?: string) => void;
|