@fevex/core 0.1.0-alpha.3 → 0.1.0-alpha.4
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/README.md +16 -0
- package/dist/agents/index.d.mts +1 -1
- package/dist/channels/index.d.mts +2 -2
- package/dist/channels/index.mjs +70 -28
- package/dist/evals/index.d.mts +2 -2
- package/dist/{fevex-Ddyi6z6L.d.mts → fevex-BoPbZ-Tw.d.mts} +5 -5
- package/dist/http/index.d.mts +2 -2
- package/dist/{index-Bg9rr8Qe.d.mts → index-C-IFfCNw.d.mts} +2 -2
- package/dist/{index-Dx_LotWZ.d.mts → index-CaE864Kz.d.mts} +4 -1
- package/dist/{index-DviHtsLo.d.mts → index-CknU-glw.d.mts} +1 -1
- package/dist/{index-Bgcxgy66.d.mts → index-DyyNLuwO.d.mts} +31 -10
- package/dist/{index-DeXUtyd9.d.mts → index-hhbgvfIt.d.mts} +1 -1
- package/dist/{index-B4PIkqOU.d.mts → index-voIZhQXB.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +21 -9
- package/dist/knowledge/index.d.mts +1 -1
- package/dist/observability/index.d.mts +1 -1
- package/dist/runtime/index.d.mts +1 -1
- package/dist/sandbox/index.mjs +41 -16
- package/dist/teams/index.d.mts +1 -1
- package/dist/testing/index.d.mts +8 -3
- package/dist/testing/index.mjs +4 -0
- package/dist/workflows/index.d.mts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -961,3 +961,19 @@ controls progress, so a slow consumer retains at most one page plus the stream's
|
|
|
961
961
|
single queued frame, rather than buffering the run's entire history. Disconnecting
|
|
962
962
|
cancels polling. This bounds event counts, not the byte size of an individual event;
|
|
963
963
|
per-event payload limits and data retention remain host responsibilities.
|
|
964
|
+
|
|
965
|
+
### Run model identity
|
|
966
|
+
|
|
967
|
+
Agent runs retain the effective `modelName` and a `modelMetadata` snapshot when
|
|
968
|
+
the gateway supplies metadata. Traces and cost calculators use this identity,
|
|
969
|
+
including per-request model overrides, after terminal checkpoint cleanup and
|
|
970
|
+
across pause/resume. These fields are optional for older stored runs; resuming
|
|
971
|
+
an older run fills them from its checkpoint's resolved model.
|
|
972
|
+
|
|
973
|
+
### Local sandbox limits
|
|
974
|
+
|
|
975
|
+
The local development sandbox sends `SIGTERM` on timeout or cancellation, then
|
|
976
|
+
`SIGKILL` after 100 ms if the process has not closed. Cancellation rejects with
|
|
977
|
+
the caller's reason after process cleanup. Output limits apply separately to
|
|
978
|
+
stdout and stderr in UTF-8 bytes, omitting an incomplete trailing character.
|
|
979
|
+
This subprocess control does not provide operating-system isolation.
|
package/dist/agents/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AgentLimits, r as defineAgent, t as AgentDefinition } from "../index-
|
|
1
|
+
import { n as AgentLimits, r as defineAgent, t as AgentDefinition } from "../index-CaE864Kz.mjs";
|
|
2
2
|
export { AgentDefinition, AgentLimits, defineAgent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { ChannelAdapter, ChannelContext, ChannelError, ChannelEvent, ChannelEventType, ChannelFailurePhase, ChannelMessage, ChannelOutput, ChannelRunEvent, ChannelRunOptions, ChannelRunResult, handleChannelInput };
|
|
1
|
+
import { a as ChannelDeliveryOptions, c as ChannelEvent, d as ChannelMessage, f as ChannelOutput, h as ChannelRunResult, i as ChannelContext, l as ChannelEventType, m as ChannelRunOptions, n as handleChannelInput, o as ChannelElicitationContext, p as ChannelRunEvent, r as ChannelAdapter, s as ChannelError, t as deliverChannelRun, u as ChannelFailurePhase } from "../index-DyyNLuwO.mjs";
|
|
2
|
+
export { ChannelAdapter, ChannelContext, ChannelDeliveryOptions, ChannelElicitationContext, ChannelError, ChannelEvent, ChannelEventType, ChannelFailurePhase, ChannelMessage, ChannelOutput, ChannelRunEvent, ChannelRunOptions, ChannelRunResult, deliverChannelRun, handleChannelInput };
|
package/dist/channels/index.mjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { n as RunPausedError } from "../run-error-Cr17wPGH.mjs";
|
|
1
2
|
//#region src/channels/channel.ts
|
|
2
3
|
var ChannelError = class extends Error {
|
|
3
4
|
code;
|
|
4
5
|
safeMessage;
|
|
5
6
|
name = "ChannelError";
|
|
7
|
+
runId;
|
|
6
8
|
constructor(code, safeMessage, options) {
|
|
7
9
|
super(safeMessage, options);
|
|
8
10
|
this.code = code;
|
|
9
11
|
this.safeMessage = safeMessage;
|
|
12
|
+
this.runId = options?.runId;
|
|
10
13
|
}
|
|
11
14
|
};
|
|
12
15
|
//#endregion
|
|
13
16
|
//#region src/channels/handle-channel-input.ts
|
|
14
|
-
/** Parses one channel input, runs the configured agent, and delivers its
|
|
17
|
+
/** Parses one channel input, runs the configured agent, and delivers its result or elicitation. */
|
|
15
18
|
async function handleChannelInput(input, options) {
|
|
16
19
|
const channelEvents = [];
|
|
17
20
|
const emit = (event) => {
|
|
@@ -32,57 +35,92 @@ async function handleChannelInput(input, options) {
|
|
|
32
35
|
};
|
|
33
36
|
const message = parsed;
|
|
34
37
|
emit(received(options.adapter.name, message));
|
|
35
|
-
let
|
|
38
|
+
let runId;
|
|
36
39
|
try {
|
|
37
40
|
const sessionId = await options.resolveSessionId?.(message);
|
|
38
|
-
|
|
41
|
+
runId = (await options.fevex.runAgent(options.agentName, {
|
|
39
42
|
input: message.content,
|
|
40
43
|
...sessionId ? { sessionId } : {},
|
|
41
44
|
context: channelContext(options.adapter.name, message),
|
|
42
45
|
signal: options.signal
|
|
43
|
-
});
|
|
46
|
+
})).runId;
|
|
44
47
|
} catch (cause) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
if (cause instanceof RunPausedError && cause.pause.type === "elicitation") runId = cause.runId;
|
|
49
|
+
else {
|
|
50
|
+
const error = channelError("CHANNEL_RUN_FAILED", "Channel run failed", cause);
|
|
51
|
+
emit(failed(options.adapter.name, "run", error, message));
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const delivered = await deliverChannelRun(runId, message, options);
|
|
56
|
+
return {
|
|
57
|
+
...delivered,
|
|
58
|
+
events: [channelEvents[0], ...delivered.events]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Delivers a stored agent result or elicitation without executing the agent again. */
|
|
62
|
+
async function deliverChannelRun(runId, message, options) {
|
|
63
|
+
options.signal?.throwIfAborted();
|
|
64
|
+
const run = await options.fevex.getRun(runId);
|
|
65
|
+
const elicitation = run?.status === "paused" && run.pause?.type === "elicitation" ? run.pause.request : void 0;
|
|
66
|
+
if (!run || run.kind === "workflow" || run.kind === "team" || run.status !== "completed" && !elicitation) {
|
|
67
|
+
const error = channelError("CHANNEL_RUN_FAILED", "Channel run is not ready for delivery", void 0, runId);
|
|
68
|
+
options.onEvent?.(failed(options.adapter.name, "run", error, message));
|
|
53
69
|
throw error;
|
|
54
70
|
}
|
|
55
71
|
const output = {
|
|
56
|
-
deliveryId: message.deliveryId,
|
|
72
|
+
deliveryId: elicitation ? `elicitation:${runId}:${elicitation.id}` : message.deliveryId,
|
|
57
73
|
conversationId: message.conversationId,
|
|
58
74
|
...message.threadId ? { threadId: message.threadId } : {},
|
|
59
|
-
content: stringifyOutput(
|
|
75
|
+
content: elicitation ? elicitation.prompt : stringifyOutput(run.output ?? null),
|
|
60
76
|
metadata: {
|
|
61
|
-
runId
|
|
62
|
-
sessionId:
|
|
77
|
+
runId,
|
|
78
|
+
sessionId: run.sessionId,
|
|
79
|
+
...elicitation ? { requestId: elicitation.id } : {}
|
|
63
80
|
}
|
|
64
81
|
};
|
|
65
82
|
let delivery;
|
|
66
83
|
try {
|
|
67
|
-
|
|
84
|
+
if (elicitation) {
|
|
85
|
+
if (!options.adapter.deliverElicitation) throw channelError("CHANNEL_ELICITATION_UNSUPPORTED", "Channel does not support elicitation delivery", void 0, runId);
|
|
86
|
+
if (elicitation.expiresAt && Date.now() > Date.parse(elicitation.expiresAt)) throw channelError("CHANNEL_ELICITATION_EXPIRED", "Channel elicitation has expired", void 0, runId);
|
|
87
|
+
delivery = await options.adapter.deliverElicitation(elicitation, {
|
|
88
|
+
signal: options.signal,
|
|
89
|
+
deliveryId: output.deliveryId,
|
|
90
|
+
runId,
|
|
91
|
+
sessionId: run.sessionId,
|
|
92
|
+
conversationId: message.conversationId,
|
|
93
|
+
...message.threadId ? { threadId: message.threadId } : {}
|
|
94
|
+
});
|
|
95
|
+
} else delivery = await options.adapter.deliver(output, { signal: options.signal });
|
|
68
96
|
} catch (cause) {
|
|
69
|
-
const error = channelError("CHANNEL_DELIVERY_FAILED", "Channel delivery failed", cause);
|
|
70
|
-
|
|
97
|
+
const error = cause instanceof ChannelError ? channelError(cause.code, cause.safeMessage, cause, runId) : channelError("CHANNEL_DELIVERY_FAILED", "Channel delivery failed", cause, runId);
|
|
98
|
+
options.onEvent?.({
|
|
99
|
+
...failed(options.adapter.name, "deliver", error, {
|
|
100
|
+
...message,
|
|
101
|
+
deliveryId: output.deliveryId
|
|
102
|
+
}),
|
|
103
|
+
...elicitation ? { requestId: elicitation.id } : {}
|
|
104
|
+
});
|
|
71
105
|
throw error;
|
|
72
106
|
}
|
|
73
|
-
const deliveredEvent =
|
|
74
|
-
|
|
107
|
+
const deliveredEvent = {
|
|
108
|
+
...delivered(options.adapter.name, {
|
|
109
|
+
...message,
|
|
110
|
+
deliveryId: output.deliveryId
|
|
111
|
+
}),
|
|
112
|
+
runId,
|
|
113
|
+
...elicitation ? { requestId: elicitation.id } : {}
|
|
114
|
+
};
|
|
115
|
+
options.onEvent?.(deliveredEvent);
|
|
75
116
|
return {
|
|
76
117
|
ignored: false,
|
|
77
118
|
message,
|
|
78
119
|
run,
|
|
79
120
|
output,
|
|
80
121
|
delivery,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
...result.events ?? [],
|
|
84
|
-
deliveredEvent
|
|
85
|
-
]
|
|
122
|
+
...elicitation ? { elicitation } : {},
|
|
123
|
+
events: [...await options.fevex.listEvents(runId), deliveredEvent]
|
|
86
124
|
};
|
|
87
125
|
}
|
|
88
126
|
function channelContext(adapter, message) {
|
|
@@ -132,6 +170,7 @@ function failed(adapter, phase, error, message) {
|
|
|
132
170
|
adapter,
|
|
133
171
|
phase,
|
|
134
172
|
error: error.safeMessage,
|
|
173
|
+
...error.runId ? { runId: error.runId } : {},
|
|
135
174
|
...message ? {
|
|
136
175
|
messageId: message.id,
|
|
137
176
|
deliveryId: message.deliveryId,
|
|
@@ -140,11 +179,14 @@ function failed(adapter, phase, error, message) {
|
|
|
140
179
|
} : {}
|
|
141
180
|
};
|
|
142
181
|
}
|
|
143
|
-
function channelError(code, safeMessage, cause) {
|
|
144
|
-
return new ChannelError(code, safeMessage,
|
|
182
|
+
function channelError(code, safeMessage, cause, runId) {
|
|
183
|
+
return new ChannelError(code, safeMessage, {
|
|
184
|
+
...cause === void 0 ? {} : { cause },
|
|
185
|
+
...runId ? { runId } : {}
|
|
186
|
+
});
|
|
145
187
|
}
|
|
146
188
|
function stringifyOutput(value) {
|
|
147
189
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
148
190
|
}
|
|
149
191
|
//#endregion
|
|
150
|
-
export { ChannelError, handleChannelInput };
|
|
192
|
+
export { ChannelError, deliverChannelRun, handleChannelInput };
|
package/dist/evals/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as JsonValue, o as ExecutionContext, t as AgentEvent } from "../types-CuoRx12Q.mjs";
|
|
2
2
|
import { r as ModelMetadata, s as ModelUsage } from "../index-CTIwrVf9.mjs";
|
|
3
|
-
import { l as TraceCost, t as CostCalculator } from "../index-
|
|
4
|
-
import { t as Fevex } from "../fevex-
|
|
3
|
+
import { l as TraceCost, t as CostCalculator } from "../index-voIZhQXB.mjs";
|
|
4
|
+
import { t as Fevex } from "../fevex-BoPbZ-Tw.mjs";
|
|
5
5
|
//#region src/evals/canonical-json.d.ts
|
|
6
6
|
/** Serializes JSON-like data with stable object-key ordering. */
|
|
7
7
|
declare function serializeCanonical(value: unknown): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { f as RunId, t as AgentEvent } from "./types-CuoRx12Q.mjs";
|
|
2
2
|
import { t as ModelGateway } from "./index-CTIwrVf9.mjs";
|
|
3
|
-
import { A as RunStore, D as RunRequest, E as RunRecord, F as TeamRun, M as SessionId, O as RunResult, S as ResumeRunResolution, U as WorkflowRun, a as AgentRun, b as ListEventsOptions, f as CredentialStore, j as Session, t as AgentDefinition } from "./index-
|
|
4
|
-
import { r as ContextProvider, s as MemoryStore } from "./index-
|
|
5
|
-
import { r as ObservabilityOptions } from "./index-
|
|
3
|
+
import { A as RunStore, D as RunRequest, E as RunRecord, F as TeamRun, M as SessionId, O as RunResult, S as ResumeRunResolution, U as WorkflowRun, a as AgentRun, b as ListEventsOptions, f as CredentialStore, j as Session, t as AgentDefinition } from "./index-CaE864Kz.mjs";
|
|
4
|
+
import { r as ContextProvider, s as MemoryStore } from "./index-hhbgvfIt.mjs";
|
|
5
|
+
import { r as ObservabilityOptions } from "./index-voIZhQXB.mjs";
|
|
6
6
|
import { r as Sandbox } from "./index-CrOId2px.mjs";
|
|
7
7
|
import { g as ToolDefinition, s as ConnectionDefinition } from "./index-CqOjvtQ9.mjs";
|
|
8
8
|
import { r as PolicyDefinition } from "./index-dkFyTNh4.mjs";
|
|
9
|
-
import { n as WorkflowDefinition } from "./index-
|
|
10
|
-
import { t as TeamDefinition } from "./index-
|
|
9
|
+
import { n as WorkflowDefinition } from "./index-CknU-glw.mjs";
|
|
10
|
+
import { t as TeamDefinition } from "./index-C-IFfCNw.mjs";
|
|
11
11
|
//#region src/fevex.d.ts
|
|
12
12
|
/** Provider-neutral definitions and adapters used to create one Fevex runtime. */
|
|
13
13
|
interface FevexConfig {
|
package/dist/http/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as JsonValue, o as ExecutionContext, t as AgentEvent } from "../types-CuoRx12Q.mjs";
|
|
2
2
|
import { c as ReasoningEffort } from "../index-CTIwrVf9.mjs";
|
|
3
|
-
import { E as RunRecord, F as TeamRun, M as SessionId, U as WorkflowRun, a as AgentRun } from "../index-
|
|
4
|
-
import { t as Fevex } from "../fevex-
|
|
3
|
+
import { E as RunRecord, F as TeamRun, M as SessionId, U as WorkflowRun, a as AgentRun } from "../index-CaE864Kz.mjs";
|
|
4
|
+
import { t as Fevex } from "../fevex-BoPbZ-Tw.mjs";
|
|
5
5
|
//#region src/http/protocol.d.ts
|
|
6
6
|
declare const FEVEX_HTTP_PROTOCOL_VERSION = "3";
|
|
7
7
|
declare const FEVEX_HTTP_PROTOCOL_VERSION_HEADER = "Fevex-Protocol-Version";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
|
|
2
2
|
import { o as ExecutionContext } from "./types-CuoRx12Q.mjs";
|
|
3
|
-
import { n as AgentLimits } from "./index-
|
|
4
|
-
import { t as WorkflowAgentResult } from "./index-
|
|
3
|
+
import { n as AgentLimits } from "./index-CaE864Kz.mjs";
|
|
4
|
+
import { t as WorkflowAgentResult } from "./index-CknU-glw.mjs";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
6
|
//#region src/teams/team.d.ts
|
|
7
7
|
interface TeamMember {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
|
|
2
2
|
import { f as RunId, i as AgentMessage, l as JsonValue, o as ExecutionContext, s as JsonObject, t as AgentEvent } from "./types-CuoRx12Q.mjs";
|
|
3
|
-
import { c as ReasoningEffort, i as ModelRef, l as ToolChoice, s as ModelUsage } from "./index-CTIwrVf9.mjs";
|
|
3
|
+
import { c as ReasoningEffort, i as ModelRef, l as ToolChoice, r as ModelMetadata, s as ModelUsage } from "./index-CTIwrVf9.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
//#region src/runtime/run-store.d.ts
|
|
6
6
|
/** Stable identifier for conversation history shared across runs. */
|
|
@@ -115,6 +115,9 @@ interface AgentRun<TOutput = JsonValue> {
|
|
|
115
115
|
id: RunId;
|
|
116
116
|
sessionId: SessionId;
|
|
117
117
|
agentName: string;
|
|
118
|
+
/** Effective model identity retained after checkpoint cleanup. Absent on older runs. */
|
|
119
|
+
modelName?: string;
|
|
120
|
+
modelMetadata?: ModelMetadata;
|
|
118
121
|
status: RunStatus;
|
|
119
122
|
revision: number;
|
|
120
123
|
pause?: RunPause;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ExactDefinition } from "./exact-definition-NHBBFlFR.mjs";
|
|
2
2
|
import { f as RunId, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CuoRx12Q.mjs";
|
|
3
|
-
import { D as RunRequest, M as SessionId, O as RunResult, n as AgentLimits } from "./index-
|
|
3
|
+
import { D as RunRequest, M as SessionId, O as RunResult, n as AgentLimits } from "./index-CaE864Kz.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
5
|
//#region src/workflows/workflow.d.ts
|
|
6
6
|
/** Context shared with workflow steps and compensation handlers. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as ExecutionContext, s as JsonObject, t as AgentEvent } from "./types-CuoRx12Q.mjs";
|
|
2
|
-
import { M as SessionId, a as AgentRun, h as ElicitationRequest } from "./index-
|
|
3
|
-
import { t as Fevex } from "./fevex-
|
|
1
|
+
import { f as RunId, o as ExecutionContext, s as JsonObject, t as AgentEvent } from "./types-CuoRx12Q.mjs";
|
|
2
|
+
import { M as SessionId, a as AgentRun, h as ElicitationRequest } from "./index-CaE864Kz.mjs";
|
|
3
|
+
import { t as Fevex } from "./fevex-BoPbZ-Tw.mjs";
|
|
4
4
|
//#region src/channels/channel.d.ts
|
|
5
5
|
interface ChannelMessage {
|
|
6
6
|
id: string;
|
|
@@ -21,11 +21,19 @@ interface ChannelOutput {
|
|
|
21
21
|
interface ChannelContext {
|
|
22
22
|
signal?: AbortSignal;
|
|
23
23
|
}
|
|
24
|
+
interface ChannelElicitationContext extends ChannelContext {
|
|
25
|
+
/** Stable key for transport-level idempotency, preserved across delivery retries. */
|
|
26
|
+
deliveryId: string;
|
|
27
|
+
runId: RunId;
|
|
28
|
+
sessionId: SessionId;
|
|
29
|
+
conversationId: string;
|
|
30
|
+
threadId?: string;
|
|
31
|
+
}
|
|
24
32
|
interface ChannelAdapter<TInput = unknown, TOutput = unknown> {
|
|
25
33
|
name: string;
|
|
26
34
|
parse(input: TInput, context: ChannelContext): Promise<ChannelMessage | null>;
|
|
27
35
|
deliver(output: ChannelOutput, context: ChannelContext): Promise<TOutput>;
|
|
28
|
-
deliverElicitation?(request: ElicitationRequest, context:
|
|
36
|
+
deliverElicitation?(request: ElicitationRequest, context: ChannelElicitationContext): Promise<TOutput>;
|
|
29
37
|
}
|
|
30
38
|
type ChannelEventType = 'channel.received' | 'channel.delivered' | 'channel.failed';
|
|
31
39
|
type ChannelFailurePhase = 'parse' | 'run' | 'deliver';
|
|
@@ -37,6 +45,8 @@ interface ChannelEventBase {
|
|
|
37
45
|
deliveryId?: string;
|
|
38
46
|
conversationId?: string;
|
|
39
47
|
threadId?: string;
|
|
48
|
+
runId?: RunId;
|
|
49
|
+
requestId?: string;
|
|
40
50
|
}
|
|
41
51
|
type ChannelEvent = (ChannelEventBase & {
|
|
42
52
|
type: 'channel.received';
|
|
@@ -53,16 +63,21 @@ declare class ChannelError extends Error {
|
|
|
53
63
|
readonly code: string;
|
|
54
64
|
readonly safeMessage: string;
|
|
55
65
|
readonly name = "ChannelError";
|
|
56
|
-
|
|
66
|
+
readonly runId?: RunId;
|
|
67
|
+
constructor(code: string, safeMessage: string, options?: ErrorOptions & {
|
|
68
|
+
runId?: RunId;
|
|
69
|
+
});
|
|
57
70
|
}
|
|
58
|
-
interface
|
|
71
|
+
interface ChannelDeliveryOptions<TInput = unknown, TDelivery = unknown> {
|
|
59
72
|
fevex: Fevex;
|
|
60
73
|
adapter: ChannelAdapter<TInput, TDelivery>;
|
|
61
|
-
agentName: string;
|
|
62
|
-
resolveSessionId?: (message: ChannelMessage) => SessionId | undefined | Promise<SessionId | undefined>;
|
|
63
74
|
onEvent?: (event: ChannelEvent) => void;
|
|
64
75
|
signal?: AbortSignal;
|
|
65
76
|
}
|
|
77
|
+
interface ChannelRunOptions<TInput = unknown, TDelivery = unknown> extends ChannelDeliveryOptions<TInput, TDelivery> {
|
|
78
|
+
agentName: string;
|
|
79
|
+
resolveSessionId?: (message: ChannelMessage) => SessionId | undefined | Promise<SessionId | undefined>;
|
|
80
|
+
}
|
|
66
81
|
type ChannelRunResult<TDelivery = unknown> = {
|
|
67
82
|
ignored: true;
|
|
68
83
|
events: ChannelRunEvent[];
|
|
@@ -72,11 +87,17 @@ type ChannelRunResult<TDelivery = unknown> = {
|
|
|
72
87
|
run: AgentRun;
|
|
73
88
|
output: ChannelOutput;
|
|
74
89
|
delivery: TDelivery;
|
|
90
|
+
/** Present when the agent is waiting for external information. */
|
|
91
|
+
elicitation?: ElicitationRequest;
|
|
75
92
|
events: ChannelRunEvent[];
|
|
76
93
|
};
|
|
77
94
|
//#endregion
|
|
78
95
|
//#region src/channels/handle-channel-input.d.ts
|
|
79
|
-
/** Parses one channel input, runs the configured agent, and delivers its
|
|
96
|
+
/** Parses one channel input, runs the configured agent, and delivers its result or elicitation. */
|
|
80
97
|
declare function handleChannelInput<TInput, TDelivery>(input: TInput, options: ChannelRunOptions<TInput, TDelivery>): Promise<ChannelRunResult<TDelivery>>;
|
|
98
|
+
/** Delivers a stored agent result or elicitation without executing the agent again. */
|
|
99
|
+
declare function deliverChannelRun<TInput, TDelivery>(runId: RunId, message: ChannelMessage, options: ChannelDeliveryOptions<TInput, TDelivery>): Promise<Exclude<ChannelRunResult<TDelivery>, {
|
|
100
|
+
ignored: true;
|
|
101
|
+
}>>;
|
|
81
102
|
//#endregion
|
|
82
|
-
export {
|
|
103
|
+
export { ChannelDeliveryOptions as a, ChannelEvent as c, ChannelMessage as d, ChannelOutput as f, ChannelRunResult as h, ChannelContext as i, ChannelEventType as l, ChannelRunOptions as m, handleChannelInput as n, ChannelElicitationContext as o, ChannelRunEvent as p, ChannelAdapter as r, ChannelError as s, deliverChannelRun as t, ChannelFailurePhase as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CuoRx12Q.mjs";
|
|
2
|
-
import { M as SessionId } from "./index-
|
|
2
|
+
import { M as SessionId } from "./index-CaE864Kz.mjs";
|
|
3
3
|
//#region src/knowledge/knowledge.d.ts
|
|
4
4
|
/** Runtime context supplied to knowledge providers and memory stores. */
|
|
5
5
|
interface KnowledgeContext {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as RunId, l as JsonValue, s as JsonObject } from "./types-CuoRx12Q.mjs";
|
|
2
2
|
import { r as ModelMetadata, s as ModelUsage } from "./index-CTIwrVf9.mjs";
|
|
3
|
-
import { M as SessionId } from "./index-
|
|
3
|
+
import { M as SessionId } from "./index-CaE864Kz.mjs";
|
|
4
4
|
//#region src/observability/trace.d.ts
|
|
5
5
|
/** Final state represented by an exported run trace. */
|
|
6
6
|
type TraceStatus = 'completed' | 'failed' | 'cancelled';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a as AgentMessageRole, c as JsonPrimitive, d as PROVIDER_SCHEMA_UNSUPPORTED, f as RunId, g as ToolSpec, h as ToolEventSource, i as AgentMessage, l as JsonValue, m as ToolCall, n as AgentEventPayloads, o as ExecutionContext, p as SCHEMA_NOT_TRANSPORTABLE, r as AgentEventType, s as JsonObject, t as AgentEvent, u as PROVIDER_REASONING_UNSUPPORTED } from "./types-CuoRx12Q.mjs";
|
|
2
2
|
import { a as ModelResult, c as ReasoningEffort, i as ModelRef, l as ToolChoice, n as ModelInput, o as ModelStreamEvent, r as ModelMetadata, s as ModelUsage, t as ModelGateway } from "./index-CTIwrVf9.mjs";
|
|
3
|
-
import { A as RunStore, B as WorkflowBudgetUsage, C as RunCheckpoint, D as RunRequest, E as RunRecord, F as TeamRun, G as WorkflowWaitRecord, H as WorkflowCompensationRecord, I as TimerResolution, K as isDurableRunStore, L as ToolExecutionRecord, M as SessionId, N as StoredRunCheckpoint, O as RunResult, P as TeamCheckpoint, R as ToolExecutionResolution, S as ResumeRunResolution, T as RunPause, U as WorkflowRun, V as WorkflowCheckpoint, W as WorkflowStepRecord, _ as EventResolution, a as AgentRun, b as ListEventsOptions, c as ApprovalRequest, d as CoordinatorRun, f as CredentialStore, g as ElicitationResolution, h as ElicitationRequest, i as InMemoryRunStore, j as Session, k as RunStatus, l as ApprovalResolution, m as ElicitationMode, n as AgentLimits, o as AgentRunPause, p as DurableRunStore, q as validateListEventsOptions, r as defineAgent, s as ApprovalMode, t as AgentDefinition, u as CoordinatorCheckpoint, v as ExecutionCommit, w as RunLease, x as PendingToolExecution, y as ExecutionCreate, z as ToolExecutionStatus } from "./index-
|
|
4
|
-
import { a as MemoryQuery, c as MemoryWrite, d as defineContextProvider, f as defineSkill, i as KnowledgeContext, l as SkillDefinition, n as ContextBlock, o as MemoryRecord, r as ContextProvider, s as MemoryStore, t as InMemoryMemoryStore, u as createMemoryContextProvider } from "./index-
|
|
3
|
+
import { A as RunStore, B as WorkflowBudgetUsage, C as RunCheckpoint, D as RunRequest, E as RunRecord, F as TeamRun, G as WorkflowWaitRecord, H as WorkflowCompensationRecord, I as TimerResolution, K as isDurableRunStore, L as ToolExecutionRecord, M as SessionId, N as StoredRunCheckpoint, O as RunResult, P as TeamCheckpoint, R as ToolExecutionResolution, S as ResumeRunResolution, T as RunPause, U as WorkflowRun, V as WorkflowCheckpoint, W as WorkflowStepRecord, _ as EventResolution, a as AgentRun, b as ListEventsOptions, c as ApprovalRequest, d as CoordinatorRun, f as CredentialStore, g as ElicitationResolution, h as ElicitationRequest, i as InMemoryRunStore, j as Session, k as RunStatus, l as ApprovalResolution, m as ElicitationMode, n as AgentLimits, o as AgentRunPause, p as DurableRunStore, q as validateListEventsOptions, r as defineAgent, s as ApprovalMode, t as AgentDefinition, u as CoordinatorCheckpoint, v as ExecutionCommit, w as RunLease, x as PendingToolExecution, y as ExecutionCreate, z as ToolExecutionStatus } from "./index-CaE864Kz.mjs";
|
|
4
|
+
import { a as MemoryQuery, c as MemoryWrite, d as defineContextProvider, f as defineSkill, i as KnowledgeContext, l as SkillDefinition, n as ContextBlock, o as MemoryRecord, r as ContextProvider, s as MemoryStore, t as InMemoryMemoryStore, u as createMemoryContextProvider } from "./index-hhbgvfIt.mjs";
|
|
5
5
|
import { a as SandboxError, c as sandboxResultToJson, i as SandboxCapabilities, n as createLocalSandbox, o as SandboxRunRequest, r as Sandbox, s as SandboxRunResult, t as LocalSandboxOptions } from "./index-CrOId2px.mjs";
|
|
6
6
|
import { C as toToolSpec, S as defineTool, _ as ToolExecutionContext, a as compileFevexJsonSchema, b as ToolRetryPolicy, c as ConnectionToolPolicy, d as ToolProvider, f as ToolProviderContext, g as ToolDefinition, h as ToolApproval, i as FevexJsonSchemaValidator, l as IntegrationError, m as defineConnection, n as FevexJsonSchemaProfileLimits, o as validateFevexJsonSchemaProfile, p as ToolProviderTool, r as FevexJsonSchemaProfileOptions, s as ConnectionDefinition, t as FEVEX_JSON_SCHEMA_PROFILE_VERSION, u as IntegrationErrorCategory, v as ToolIdempotency, x as ToolRisk, y as ToolResult } from "./index-CqOjvtQ9.mjs";
|
|
7
7
|
import { i as definePolicy, n as PolicyDecision, r as PolicyDefinition, t as PolicyAuthorization } from "./index-dkFyTNh4.mjs";
|
|
8
|
-
import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "./index-
|
|
9
|
-
import { a as TeamMember, c as defineTeam, i as TeamLimits, n as TeamDelegation, o as TeamStep, r as TeamHandoff, s as TeamTaskResult, t as TeamDefinition } from "./index-
|
|
10
|
-
import { n as FevexConfig, r as createFevex, t as Fevex } from "./fevex-
|
|
11
|
-
import { a as
|
|
8
|
+
import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "./index-CknU-glw.mjs";
|
|
9
|
+
import { a as TeamMember, c as defineTeam, i as TeamLimits, n as TeamDelegation, o as TeamStep, r as TeamHandoff, s as TeamTaskResult, t as TeamDefinition } from "./index-C-IFfCNw.mjs";
|
|
10
|
+
import { n as FevexConfig, r as createFevex, t as Fevex } from "./fevex-BoPbZ-Tw.mjs";
|
|
11
|
+
import { a as ChannelDeliveryOptions, c as ChannelEvent, d as ChannelMessage, f as ChannelOutput, h as ChannelRunResult, i as ChannelContext, l as ChannelEventType, m as ChannelRunOptions, n as handleChannelInput, o as ChannelElicitationContext, p as ChannelRunEvent, r as ChannelAdapter, s as ChannelError, t as deliverChannelRun, u as ChannelFailurePhase } from "./index-DyyNLuwO.mjs";
|
|
12
12
|
//#region src/configuration-error.d.ts
|
|
13
13
|
/**
|
|
14
14
|
* Composition error codes.
|
|
@@ -39,4 +39,4 @@ declare class RunPausedError extends FevexRunError {
|
|
|
39
39
|
constructor(runId: RunId, pause: RunPause);
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
|
-
export { AgentDefinition, AgentEvent, AgentEventPayloads, AgentEventType, AgentLimits, AgentMessage, AgentMessageRole, AgentRun, AgentRunPause, ApprovalMode, ApprovalRequest, ApprovalResolution, ChannelAdapter, ChannelContext, ChannelError, ChannelEvent, ChannelEventType, ChannelFailurePhase, ChannelMessage, ChannelOutput, ChannelRunEvent, ChannelRunOptions, ChannelRunResult, ConnectionDefinition, ConnectionToolPolicy, ContextBlock, ContextProvider, CoordinatorCheckpoint, CoordinatorRun, CredentialStore, DurableRunStore, ElicitationMode, ElicitationRequest, ElicitationResolution, EventResolution, ExecutionCommit, ExecutionContext, ExecutionCreate, FEVEX_JSON_SCHEMA_PROFILE_VERSION, Fevex, FevexConfig, FevexConfigurationError, FevexConfigurationErrorCode, FevexJsonSchemaProfileLimits, FevexJsonSchemaProfileOptions, FevexJsonSchemaValidator, FevexRunError, FevexRunErrorCode, InMemoryMemoryStore, InMemoryRunStore, IntegrationError, IntegrationErrorCategory, JsonObject, JsonPrimitive, JsonValue, KnowledgeContext, ListEventsOptions, LocalSandboxOptions, MemoryQuery, MemoryRecord, MemoryStore, MemoryWrite, ModelGateway, ModelInput, ModelMetadata, ModelRef, ModelResult, ModelStreamEvent, ModelUsage, PROVIDER_REASONING_UNSUPPORTED, PROVIDER_SCHEMA_UNSUPPORTED, PendingToolExecution, PolicyAuthorization, PolicyDecision, PolicyDefinition, ReasoningEffort, ResumeRunResolution, RunCheckpoint, RunId, RunLease, RunPause, RunPausedError, RunRecord, RunRequest, RunResult, RunStatus, RunStore, SCHEMA_NOT_TRANSPORTABLE, Sandbox, SandboxCapabilities, SandboxError, SandboxRunRequest, SandboxRunResult, Session, SessionId, SkillDefinition, StoredRunCheckpoint, TeamCheckpoint, type TeamDefinition, type TeamDelegation, type TeamHandoff, type TeamLimits, type TeamMember, TeamRun, type TeamStep, type TeamTaskResult, TimerResolution, ToolApproval, ToolCall, ToolChoice, ToolDefinition, ToolEventSource, ToolExecutionContext, ToolExecutionRecord, ToolExecutionResolution, ToolExecutionStatus, ToolIdempotency, ToolProvider, ToolProviderContext, ToolProviderTool, ToolResult, ToolRetryPolicy, ToolRisk, ToolSpec, WorkflowAgentResult, WorkflowBudgetUsage, WorkflowCheckpoint, WorkflowCompensationRecord, WorkflowDefinition, WorkflowEventDefinition, WorkflowEventResult, WorkflowRun, WorkflowStep, WorkflowStepContext, WorkflowStepOptions, WorkflowStepRecord, WorkflowWaitRecord, compileFevexJsonSchema, createFevex, createLocalSandbox, createMemoryContextProvider, defineAgent, defineConnection, defineContextProvider, definePolicy, defineSkill, defineTeam, defineTool, defineWorkflow, handleChannelInput, isDurableRunStore, sandboxResultToJson, toToolSpec, validateFevexJsonSchemaProfile, validateListEventsOptions };
|
|
42
|
+
export { AgentDefinition, AgentEvent, AgentEventPayloads, AgentEventType, AgentLimits, AgentMessage, AgentMessageRole, AgentRun, AgentRunPause, ApprovalMode, ApprovalRequest, ApprovalResolution, ChannelAdapter, ChannelContext, ChannelDeliveryOptions, ChannelElicitationContext, ChannelError, ChannelEvent, ChannelEventType, ChannelFailurePhase, ChannelMessage, ChannelOutput, ChannelRunEvent, ChannelRunOptions, ChannelRunResult, ConnectionDefinition, ConnectionToolPolicy, ContextBlock, ContextProvider, CoordinatorCheckpoint, CoordinatorRun, CredentialStore, DurableRunStore, ElicitationMode, ElicitationRequest, ElicitationResolution, EventResolution, ExecutionCommit, ExecutionContext, ExecutionCreate, FEVEX_JSON_SCHEMA_PROFILE_VERSION, Fevex, FevexConfig, FevexConfigurationError, FevexConfigurationErrorCode, FevexJsonSchemaProfileLimits, FevexJsonSchemaProfileOptions, FevexJsonSchemaValidator, FevexRunError, FevexRunErrorCode, InMemoryMemoryStore, InMemoryRunStore, IntegrationError, IntegrationErrorCategory, JsonObject, JsonPrimitive, JsonValue, KnowledgeContext, ListEventsOptions, LocalSandboxOptions, MemoryQuery, MemoryRecord, MemoryStore, MemoryWrite, ModelGateway, ModelInput, ModelMetadata, ModelRef, ModelResult, ModelStreamEvent, ModelUsage, PROVIDER_REASONING_UNSUPPORTED, PROVIDER_SCHEMA_UNSUPPORTED, PendingToolExecution, PolicyAuthorization, PolicyDecision, PolicyDefinition, ReasoningEffort, ResumeRunResolution, RunCheckpoint, RunId, RunLease, RunPause, RunPausedError, RunRecord, RunRequest, RunResult, RunStatus, RunStore, SCHEMA_NOT_TRANSPORTABLE, Sandbox, SandboxCapabilities, SandboxError, SandboxRunRequest, SandboxRunResult, Session, SessionId, SkillDefinition, StoredRunCheckpoint, TeamCheckpoint, type TeamDefinition, type TeamDelegation, type TeamHandoff, type TeamLimits, type TeamMember, TeamRun, type TeamStep, type TeamTaskResult, TimerResolution, ToolApproval, ToolCall, ToolChoice, ToolDefinition, ToolEventSource, ToolExecutionContext, ToolExecutionRecord, ToolExecutionResolution, ToolExecutionStatus, ToolIdempotency, ToolProvider, ToolProviderContext, ToolProviderTool, ToolResult, ToolRetryPolicy, ToolRisk, ToolSpec, WorkflowAgentResult, WorkflowBudgetUsage, WorkflowCheckpoint, WorkflowCompensationRecord, WorkflowDefinition, WorkflowEventDefinition, WorkflowEventResult, WorkflowRun, WorkflowStep, WorkflowStepContext, WorkflowStepOptions, WorkflowStepRecord, WorkflowWaitRecord, compileFevexJsonSchema, createFevex, createLocalSandbox, createMemoryContextProvider, defineAgent, defineConnection, defineContextProvider, definePolicy, defineSkill, defineTeam, defineTool, defineWorkflow, deliverChannelRun, handleChannelInput, isDurableRunStore, sandboxResultToJson, toToolSpec, validateFevexJsonSchemaProfile, validateListEventsOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineAgent } from "./agents/index.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as RunPausedError, t as FevexRunError } from "./run-error-Cr17wPGH.mjs";
|
|
3
|
+
import { ChannelError, deliverChannelRun, handleChannelInput } from "./channels/index.mjs";
|
|
3
4
|
import { InMemoryMemoryStore, createMemoryContextProvider, defineContextProvider, defineSkill } from "./knowledge/index.mjs";
|
|
4
5
|
import { n as teamAsWorkflow, t as defineTeam } from "./teams-Ctz676G4.mjs";
|
|
5
|
-
import { n as RunPausedError, t as FevexRunError } from "./run-error-Cr17wPGH.mjs";
|
|
6
6
|
import { InMemoryRunStore, isDurableRunStore, validateListEventsOptions } from "./runtime/index.mjs";
|
|
7
7
|
import { FEVEX_JSON_SCHEMA_PROFILE_VERSION, IntegrationError, compileFevexJsonSchema, defineConnection, defineTool, toToolSpec, validateFevexJsonSchemaProfile } from "./tools/index.mjs";
|
|
8
8
|
import { a as assertTokenBudget, c as remainingOutputTokens, d as serializeValue, f as toJsonValue, i as assertContinuationBudget, l as toErrorMessage, n as abortable, o as cancellationReason, r as addUsage, s as eventUsage, t as readModelStream, u as serializeJsonValue } from "./model-stream-u2xMsEaf.mjs";
|
|
@@ -871,7 +871,7 @@ function createAgentEngine(composition, core) {
|
|
|
871
871
|
const prepareExecution = async (name, request) => {
|
|
872
872
|
const agent = agents.get(name);
|
|
873
873
|
if (!agent) throw new FevexRunError("AGENT_NOT_FOUND", `Agent "${name}" is not registered`);
|
|
874
|
-
const { modelName } = resolveModel(agent, request.model);
|
|
874
|
+
const { modelName, model } = resolveModel(agent, request.model);
|
|
875
875
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
876
876
|
let session;
|
|
877
877
|
const newSession = request.sessionId === void 0;
|
|
@@ -894,6 +894,8 @@ function createAgentEngine(composition, core) {
|
|
|
894
894
|
id: crypto.randomUUID(),
|
|
895
895
|
sessionId: session.id,
|
|
896
896
|
agentName: name,
|
|
897
|
+
modelName,
|
|
898
|
+
...model.metadata === void 0 ? {} : { modelMetadata: structuredClone(model.metadata) },
|
|
897
899
|
status: "running",
|
|
898
900
|
revision: 0,
|
|
899
901
|
createdAt: now,
|
|
@@ -1675,6 +1677,10 @@ function createAgentEngine(composition, core) {
|
|
|
1675
1677
|
const checkpointModel = await resolveCheckpointModel(run.agentName, agent, checkpoint);
|
|
1676
1678
|
if (!checkpointModel) throw new FevexRunError("RUN_DEFINITION_CHANGED", `Definition for agent "${run.agentName}" changed`, runId);
|
|
1677
1679
|
const { modelName, model } = checkpointModel;
|
|
1680
|
+
if (run.modelName === void 0) {
|
|
1681
|
+
run.modelName = modelName;
|
|
1682
|
+
run.modelMetadata = model.metadata === void 0 ? void 0 : structuredClone(model.metadata);
|
|
1683
|
+
}
|
|
1678
1684
|
if (checkpoint.providerState !== void 0 && !model.stateCodec) throw new FevexRunError("RUN_NOT_RESUMABLE", "ModelGateway no longer provides its stateCodec", runId);
|
|
1679
1685
|
const session = await runStore.getSession(run.sessionId);
|
|
1680
1686
|
if (!session) throw new Error(`Session "${run.sessionId}" does not exist`);
|
|
@@ -2271,11 +2277,17 @@ function createRunCore({ models, agents, tools, runStore, policies, onEvent, obs
|
|
|
2271
2277
|
if (!run) throw new Error(`Run "${event.runId}" does not exist`);
|
|
2272
2278
|
if (isCoordinatorRun(run)) return;
|
|
2273
2279
|
const agentRun = run;
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2280
|
+
let modelRegistryName = agentRun.modelName;
|
|
2281
|
+
let modelMetadata = agentRun.modelMetadata;
|
|
2282
|
+
if (modelRegistryName === void 0) {
|
|
2283
|
+
const agent = agents.get(agentRun.agentName);
|
|
2284
|
+
if (!agent) throw new Error(`Agent "${agentRun.agentName}" is not registered`);
|
|
2285
|
+
const checkpoint = isDurableRunStore(runStore) ? await runStore.getCheckpoint(agentRun.id) : void 0;
|
|
2286
|
+
const resolved = resolveModel(agent, checkpoint?.modelName);
|
|
2287
|
+
modelRegistryName = resolved.modelName;
|
|
2288
|
+
modelMetadata = resolved.model.metadata;
|
|
2289
|
+
}
|
|
2290
|
+
const trace = buildRunTrace(agentRun, await runStore.listEvents(agentRun.id), modelRegistryName, modelMetadata, observability);
|
|
2279
2291
|
const failures = (await Promise.allSettled(observability.exporters.map((exporter) => Promise.resolve().then(() => exporter.export(trace))))).filter((result) => result.status === "rejected").map(({ reason }) => reason);
|
|
2280
2292
|
if (failures.length) throw new AggregateError(failures, "Trace export failed");
|
|
2281
2293
|
})().catch((error) => {
|
|
@@ -3581,4 +3593,4 @@ function createFevex(config) {
|
|
|
3581
3593
|
return createRuntime(createComposition(config));
|
|
3582
3594
|
}
|
|
3583
3595
|
//#endregion
|
|
3584
|
-
export { ChannelError, FEVEX_JSON_SCHEMA_PROFILE_VERSION, FevexConfigurationError, FevexRunError, InMemoryMemoryStore, InMemoryRunStore, IntegrationError, PROVIDER_REASONING_UNSUPPORTED, PROVIDER_SCHEMA_UNSUPPORTED, RunPausedError, SCHEMA_NOT_TRANSPORTABLE, SandboxError, compileFevexJsonSchema, createFevex, createLocalSandbox, createMemoryContextProvider, defineAgent, defineConnection, defineContextProvider, definePolicy, defineSkill, defineTeam, defineTool, defineWorkflow, handleChannelInput, isDurableRunStore, sandboxResultToJson, toToolSpec, validateFevexJsonSchemaProfile, validateListEventsOptions };
|
|
3596
|
+
export { ChannelError, FEVEX_JSON_SCHEMA_PROFILE_VERSION, FevexConfigurationError, FevexRunError, InMemoryMemoryStore, InMemoryRunStore, IntegrationError, PROVIDER_REASONING_UNSUPPORTED, PROVIDER_SCHEMA_UNSUPPORTED, RunPausedError, SCHEMA_NOT_TRANSPORTABLE, SandboxError, compileFevexJsonSchema, createFevex, createLocalSandbox, createMemoryContextProvider, defineAgent, defineConnection, defineContextProvider, definePolicy, defineSkill, defineTeam, defineTool, defineWorkflow, deliverChannelRun, handleChannelInput, isDurableRunStore, sandboxResultToJson, toToolSpec, validateFevexJsonSchemaProfile, validateListEventsOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MemoryQuery, c as MemoryWrite, d as defineContextProvider, f as defineSkill, i as KnowledgeContext, l as SkillDefinition, n as ContextBlock, o as MemoryRecord, r as ContextProvider, s as MemoryStore, t as InMemoryMemoryStore, u as createMemoryContextProvider } from "../index-
|
|
1
|
+
import { a as MemoryQuery, c as MemoryWrite, d as defineContextProvider, f as defineSkill, i as KnowledgeContext, l as SkillDefinition, n as ContextBlock, o as MemoryRecord, r as ContextProvider, s as MemoryStore, t as InMemoryMemoryStore, u as createMemoryContextProvider } from "../index-hhbgvfIt.mjs";
|
|
2
2
|
export { ContextBlock, ContextProvider, InMemoryMemoryStore, KnowledgeContext, MemoryQuery, MemoryRecord, MemoryStore, MemoryWrite, SkillDefinition, createMemoryContextProvider, defineContextProvider, defineSkill };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TraceAnnotation, c as TraceContentPolicy, d as TraceRedactor, f as TraceRedactorInput, h as TraceStatus, i as RunTrace, l as TraceCost, m as TraceSpanKind, n as CostCalculatorInput, o as TraceContent, p as TraceSpan, r as ObservabilityOptions, s as TraceContentKind, t as CostCalculator, u as TraceExporter } from "../index-
|
|
1
|
+
import { a as TraceAnnotation, c as TraceContentPolicy, d as TraceRedactor, f as TraceRedactorInput, h as TraceStatus, i as RunTrace, l as TraceCost, m as TraceSpanKind, n as CostCalculatorInput, o as TraceContent, p as TraceSpan, r as ObservabilityOptions, s as TraceContentKind, t as CostCalculator, u as TraceExporter } from "../index-voIZhQXB.mjs";
|
|
2
2
|
export { CostCalculator, CostCalculatorInput, ObservabilityOptions, RunTrace, TraceAnnotation, TraceContent, TraceContentKind, TraceContentPolicy, TraceCost, TraceExporter, TraceRedactor, TraceRedactorInput, TraceSpan, TraceSpanKind, TraceStatus };
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as RunStore, B as WorkflowBudgetUsage, C as RunCheckpoint, D as RunRequest, E as RunRecord, F as TeamRun, G as WorkflowWaitRecord, H as WorkflowCompensationRecord, I as TimerResolution, K as isDurableRunStore, L as ToolExecutionRecord, M as SessionId, N as StoredRunCheckpoint, O as RunResult, P as TeamCheckpoint, R as ToolExecutionResolution, S as ResumeRunResolution, T as RunPause, U as WorkflowRun, V as WorkflowCheckpoint, W as WorkflowStepRecord, _ as EventResolution, a as AgentRun, b as ListEventsOptions, c as ApprovalRequest, d as CoordinatorRun, f as CredentialStore, g as ElicitationResolution, h as ElicitationRequest, i as InMemoryRunStore, j as Session, k as RunStatus, l as ApprovalResolution, m as ElicitationMode, o as AgentRunPause, p as DurableRunStore, q as validateListEventsOptions, s as ApprovalMode, u as CoordinatorCheckpoint, v as ExecutionCommit, w as RunLease, x as PendingToolExecution, y as ExecutionCreate, z as ToolExecutionStatus } from "../index-
|
|
1
|
+
import { A as RunStore, B as WorkflowBudgetUsage, C as RunCheckpoint, D as RunRequest, E as RunRecord, F as TeamRun, G as WorkflowWaitRecord, H as WorkflowCompensationRecord, I as TimerResolution, K as isDurableRunStore, L as ToolExecutionRecord, M as SessionId, N as StoredRunCheckpoint, O as RunResult, P as TeamCheckpoint, R as ToolExecutionResolution, S as ResumeRunResolution, T as RunPause, U as WorkflowRun, V as WorkflowCheckpoint, W as WorkflowStepRecord, _ as EventResolution, a as AgentRun, b as ListEventsOptions, c as ApprovalRequest, d as CoordinatorRun, f as CredentialStore, g as ElicitationResolution, h as ElicitationRequest, i as InMemoryRunStore, j as Session, k as RunStatus, l as ApprovalResolution, m as ElicitationMode, o as AgentRunPause, p as DurableRunStore, q as validateListEventsOptions, s as ApprovalMode, u as CoordinatorCheckpoint, v as ExecutionCommit, w as RunLease, x as PendingToolExecution, y as ExecutionCreate, z as ToolExecutionStatus } from "../index-CaE864Kz.mjs";
|
|
2
2
|
export { AgentRun, AgentRunPause, ApprovalMode, ApprovalRequest, ApprovalResolution, CoordinatorCheckpoint, CoordinatorRun, CredentialStore, DurableRunStore, ElicitationMode, ElicitationRequest, ElicitationResolution, EventResolution, ExecutionCommit, ExecutionCreate, InMemoryRunStore, ListEventsOptions, PendingToolExecution, ResumeRunResolution, RunCheckpoint, RunLease, RunPause, RunRecord, RunRequest, RunResult, RunStatus, RunStore, Session, SessionId, StoredRunCheckpoint, TeamCheckpoint, TeamRun, TimerResolution, ToolExecutionRecord, ToolExecutionResolution, ToolExecutionStatus, WorkflowBudgetUsage, WorkflowCheckpoint, WorkflowCompensationRecord, WorkflowRun, WorkflowStepRecord, WorkflowWaitRecord, isDurableRunStore, validateListEventsOptions };
|
package/dist/sandbox/index.mjs
CHANGED
|
@@ -59,8 +59,14 @@ function createLocalSandbox(options) {
|
|
|
59
59
|
async function runProcess(options) {
|
|
60
60
|
const started = Date.now();
|
|
61
61
|
let timedOut = false;
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const stdout = {
|
|
63
|
+
text: "",
|
|
64
|
+
bytes: 0
|
|
65
|
+
};
|
|
66
|
+
const stderr = {
|
|
67
|
+
text: "",
|
|
68
|
+
bytes: 0
|
|
69
|
+
};
|
|
64
70
|
return await new Promise((resolvePromise, reject) => {
|
|
65
71
|
options.signal?.throwIfAborted();
|
|
66
72
|
const child = spawn(options.command, [...options.args], {
|
|
@@ -73,35 +79,51 @@ async function runProcess(options) {
|
|
|
73
79
|
"pipe"
|
|
74
80
|
]
|
|
75
81
|
});
|
|
76
|
-
|
|
82
|
+
let aborted = false;
|
|
83
|
+
let killTimer;
|
|
84
|
+
const terminate = () => {
|
|
85
|
+
if (killTimer !== void 0) return;
|
|
77
86
|
child.kill("SIGTERM");
|
|
78
|
-
|
|
87
|
+
killTimer = setTimeout(() => child.kill("SIGKILL"), 100);
|
|
88
|
+
};
|
|
89
|
+
const abort = () => {
|
|
90
|
+
aborted = true;
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
terminate();
|
|
79
93
|
};
|
|
80
94
|
const timer = setTimeout(() => {
|
|
81
95
|
timedOut = true;
|
|
82
|
-
|
|
96
|
+
terminate();
|
|
83
97
|
}, options.timeoutMs);
|
|
98
|
+
const cleanup = () => {
|
|
99
|
+
clearTimeout(timer);
|
|
100
|
+
clearTimeout(killTimer);
|
|
101
|
+
options.signal?.removeEventListener("abort", abort);
|
|
102
|
+
};
|
|
84
103
|
options.signal?.addEventListener("abort", abort, { once: true });
|
|
104
|
+
if (options.signal?.aborted) abort();
|
|
85
105
|
child.stdout.setEncoding("utf8");
|
|
86
106
|
child.stderr.setEncoding("utf8");
|
|
87
107
|
child.stdout.on("data", (chunk) => {
|
|
88
|
-
|
|
108
|
+
appendLimited(stdout, String(chunk), options.maxOutputBytes);
|
|
89
109
|
});
|
|
90
110
|
child.stderr.on("data", (chunk) => {
|
|
91
|
-
|
|
111
|
+
appendLimited(stderr, String(chunk), options.maxOutputBytes);
|
|
92
112
|
});
|
|
93
113
|
child.on("error", (error) => {
|
|
94
|
-
|
|
95
|
-
options.signal?.removeEventListener("abort", abort);
|
|
114
|
+
cleanup();
|
|
96
115
|
reject(new SandboxError("SANDBOX_PROCESS_ERROR", "Sandbox process failed", { cause: error }));
|
|
97
116
|
});
|
|
98
117
|
child.on("close", (exitCode) => {
|
|
99
|
-
|
|
100
|
-
|
|
118
|
+
cleanup();
|
|
119
|
+
if (aborted) {
|
|
120
|
+
reject(options.signal?.reason ?? new DOMException("Sandbox aborted", "AbortError"));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
101
123
|
resolvePromise({
|
|
102
124
|
exitCode,
|
|
103
|
-
stdout,
|
|
104
|
-
stderr,
|
|
125
|
+
stdout: stdout.text,
|
|
126
|
+
stderr: stderr.text,
|
|
105
127
|
durationMs: Date.now() - started,
|
|
106
128
|
timedOut
|
|
107
129
|
});
|
|
@@ -110,9 +132,12 @@ async function runProcess(options) {
|
|
|
110
132
|
else child.stdin.end();
|
|
111
133
|
});
|
|
112
134
|
}
|
|
113
|
-
function appendLimited(
|
|
114
|
-
const
|
|
115
|
-
|
|
135
|
+
function appendLimited(output, chunk, maxBytes) {
|
|
136
|
+
const remaining = maxBytes - output.bytes;
|
|
137
|
+
if (remaining <= 0) return;
|
|
138
|
+
const bytes = Buffer.from(chunk).subarray(0, remaining);
|
|
139
|
+
output.bytes += bytes.length;
|
|
140
|
+
output.text += new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes, { stream: true });
|
|
116
141
|
}
|
|
117
142
|
function isInside(rootDir, value) {
|
|
118
143
|
const path = relative(rootDir, value);
|
package/dist/teams/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TeamMember, c as defineTeam, i as TeamLimits, n as TeamDelegation, o as TeamStep, r as TeamHandoff, s as TeamTaskResult, t as TeamDefinition } from "../index-
|
|
1
|
+
import { a as TeamMember, c as defineTeam, i as TeamLimits, n as TeamDelegation, o as TeamStep, r as TeamHandoff, s as TeamTaskResult, t as TeamDefinition } from "../index-C-IFfCNw.mjs";
|
|
2
2
|
export { type TeamDefinition, type TeamDelegation, type TeamHandoff, type TeamLimits, type TeamMember, type TeamStep, type TeamTaskResult, defineTeam };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { m as ToolCall } from "../types-CuoRx12Q.mjs";
|
|
2
2
|
import { a as ModelResult, n as ModelInput, t as ModelGateway } from "../index-CTIwrVf9.mjs";
|
|
3
|
-
import { p as DurableRunStore } from "../index-
|
|
4
|
-
import { s as MemoryStore } from "../index-
|
|
3
|
+
import { h as ElicitationRequest, p as DurableRunStore } from "../index-CaE864Kz.mjs";
|
|
4
|
+
import { s as MemoryStore } from "../index-hhbgvfIt.mjs";
|
|
5
5
|
import { d as ToolProvider } from "../index-CqOjvtQ9.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { d as ChannelMessage, f as ChannelOutput, o as ChannelElicitationContext, r as ChannelAdapter } from "../index-DyyNLuwO.mjs";
|
|
7
7
|
//#region src/testing/contracts.d.ts
|
|
8
8
|
interface ModelGatewayContract {
|
|
9
9
|
output?: unknown;
|
|
@@ -17,6 +17,11 @@ interface ChannelAdapterContract<TInput, TOutput> {
|
|
|
17
17
|
output: ChannelOutput;
|
|
18
18
|
delivered: TOutput;
|
|
19
19
|
ignoredInput?: TInput;
|
|
20
|
+
elicitation?: {
|
|
21
|
+
request: ElicitationRequest;
|
|
22
|
+
context: ChannelElicitationContext;
|
|
23
|
+
delivered: TOutput;
|
|
24
|
+
};
|
|
20
25
|
}
|
|
21
26
|
interface ToolProviderContract {
|
|
22
27
|
allowedTool: string;
|
package/dist/testing/index.mjs
CHANGED
|
@@ -126,6 +126,10 @@ async function testChannelAdapter(adapter, contract) {
|
|
|
126
126
|
if (contract.output.threadId !== void 0) assert(contract.output.threadId.trim(), "ChannelOutput threadId cannot be empty");
|
|
127
127
|
if (contract.output.metadata !== void 0) JSON.stringify(contract.output.metadata);
|
|
128
128
|
assert(JSON.stringify(await adapter.deliver(contract.output, {})) === JSON.stringify(contract.delivered), "ChannelAdapter returned an unexpected delivery");
|
|
129
|
+
if (contract.elicitation) {
|
|
130
|
+
assert(adapter.deliverElicitation, "ChannelAdapter must support elicitation delivery");
|
|
131
|
+
for (let attempt = 0; attempt < 2; attempt += 1) assert(JSON.stringify(await adapter.deliverElicitation(structuredClone(contract.elicitation.request), { ...contract.elicitation.context })) === JSON.stringify(contract.elicitation.delivered), "ChannelAdapter returned an unexpected elicitation delivery or retry receipt");
|
|
132
|
+
}
|
|
129
133
|
}
|
|
130
134
|
async function testModelGateway(model, contract = {}) {
|
|
131
135
|
const output = contract.output ?? { answer: "ok" };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "../index-
|
|
1
|
+
import { a as WorkflowStep, c as defineWorkflow, i as WorkflowEventResult, n as WorkflowDefinition, o as WorkflowStepContext, r as WorkflowEventDefinition, s as WorkflowStepOptions, t as WorkflowAgentResult } from "../index-CknU-glw.mjs";
|
|
2
2
|
export { WorkflowAgentResult, WorkflowDefinition, WorkflowEventDefinition, WorkflowEventResult, WorkflowStep, WorkflowStepContext, WorkflowStepOptions, defineWorkflow };
|