@enclave-vm/broker 2.11.1 → 2.13.0
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/broker-session.d.ts +24 -1
- package/broker.d.ts +27 -0
- package/esm/index.mjs +1110 -31
- package/index.d.ts +2 -0
- package/index.js +1107 -30
- package/openapi/catalog-handler.d.ts +63 -0
- package/openapi/hash-utils.d.ts +12 -0
- package/openapi/index.d.ts +13 -0
- package/openapi/openapi-source.d.ts +93 -0
- package/openapi/openapi-spec-poller.d.ts +100 -0
- package/openapi/openapi-tool-loader.d.ts +107 -0
- package/package.json +5 -5
- package/tool-registry.d.ts +5 -0
package/broker-session.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
-
import type { SessionId, StreamEvent, SessionLimits } from '@enclave-vm/types';
|
|
8
|
+
import type { SessionId, StreamEvent, SessionLimits, ErrorPayload } from '@enclave-vm/types';
|
|
9
9
|
import { SessionEmitter } from '@enclave-vm/core';
|
|
10
10
|
import type { SessionStateValue, SessionFinalResult, CreateEnclaveOptions, ExecutionStats } from '@enclave-vm/core';
|
|
11
11
|
import type { ToolRegistry } from './tool-registry';
|
|
@@ -51,6 +51,9 @@ export declare class BrokerSession {
|
|
|
51
51
|
private toolCallCount;
|
|
52
52
|
private stdoutBytes;
|
|
53
53
|
private heartbeatInterval;
|
|
54
|
+
private deadlineTimer;
|
|
55
|
+
private _deadlineExceeded;
|
|
56
|
+
private readonly partialErrors;
|
|
54
57
|
constructor(toolRegistry: ToolRegistry, config?: BrokerSessionConfig);
|
|
55
58
|
/**
|
|
56
59
|
* Get current session state
|
|
@@ -83,10 +86,26 @@ export declare class BrokerSession {
|
|
|
83
86
|
* Run the actual execution
|
|
84
87
|
*/
|
|
85
88
|
private runExecution;
|
|
89
|
+
/**
|
|
90
|
+
* Emit a tool progress event.
|
|
91
|
+
*/
|
|
92
|
+
emitToolProgress(callId: string, phase: 'connecting' | 'sending' | 'receiving' | 'processing', elapsedMs: number, bytesReceived?: number, totalBytes?: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Emit a partial result event.
|
|
95
|
+
*/
|
|
96
|
+
emitPartialResult(path: string[], data?: unknown, error?: ErrorPayload, hasNext?: boolean): void;
|
|
97
|
+
/**
|
|
98
|
+
* Get accumulated partial errors.
|
|
99
|
+
*/
|
|
100
|
+
getPartialErrors(): ErrorPayload[];
|
|
86
101
|
/**
|
|
87
102
|
* Execute a tool call directly
|
|
88
103
|
*/
|
|
89
104
|
private executeTool;
|
|
105
|
+
/**
|
|
106
|
+
* Create a custom event with proper base fields and unique sequence number.
|
|
107
|
+
*/
|
|
108
|
+
private makeCustomEvent;
|
|
90
109
|
/**
|
|
91
110
|
* Build execution stats
|
|
92
111
|
*/
|
|
@@ -115,6 +134,10 @@ export declare class BrokerSession {
|
|
|
115
134
|
* Stop heartbeat timer
|
|
116
135
|
*/
|
|
117
136
|
private stopHeartbeat;
|
|
137
|
+
/**
|
|
138
|
+
* Stop deadline timer
|
|
139
|
+
*/
|
|
140
|
+
private stopDeadline;
|
|
118
141
|
/**
|
|
119
142
|
* Dispose of the session and its resources
|
|
120
143
|
*/
|
package/broker.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import type { ToolDefinition } from './tool-registry';
|
|
|
11
11
|
import type { SessionManagerConfig, SessionInfo } from './session-manager';
|
|
12
12
|
import { BrokerSession } from './broker-session';
|
|
13
13
|
import type { BrokerSessionConfig } from './broker-session';
|
|
14
|
+
import { OpenApiSource } from './openapi/openapi-source';
|
|
15
|
+
import type { OpenApiSourceConfig } from './openapi/openapi-source';
|
|
14
16
|
/**
|
|
15
17
|
* Broker configuration
|
|
16
18
|
*/
|
|
@@ -74,6 +76,7 @@ export declare class Broker {
|
|
|
74
76
|
private readonly toolRegistry;
|
|
75
77
|
private readonly sessionManager;
|
|
76
78
|
private readonly config;
|
|
79
|
+
private readonly openApiSources;
|
|
77
80
|
private disposed;
|
|
78
81
|
constructor(config?: BrokerConfig);
|
|
79
82
|
/**
|
|
@@ -113,6 +116,30 @@ export declare class Broker {
|
|
|
113
116
|
* Unregister a tool
|
|
114
117
|
*/
|
|
115
118
|
removeTool(name: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Register an OpenAPI source for automatic tool generation and polling.
|
|
121
|
+
*
|
|
122
|
+
* @param config - OpenAPI source configuration
|
|
123
|
+
* @returns The created OpenApiSource instance
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const source = broker.openapi({
|
|
128
|
+
* name: 'user-service',
|
|
129
|
+
* url: 'https://api.example.com/openapi.json',
|
|
130
|
+
* baseUrl: 'https://api.example.com',
|
|
131
|
+
* intervalMs: 60000,
|
|
132
|
+
* auth: { type: 'bearer', token: process.env.API_TOKEN },
|
|
133
|
+
* });
|
|
134
|
+
*
|
|
135
|
+
* await source.start();
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
openapi(config: OpenApiSourceConfig): OpenApiSource;
|
|
139
|
+
/**
|
|
140
|
+
* Get all registered OpenAPI sources.
|
|
141
|
+
*/
|
|
142
|
+
getOpenApiSources(): readonly OpenApiSource[];
|
|
116
143
|
/**
|
|
117
144
|
* Set a secret value
|
|
118
145
|
*
|