@fevex/core 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +49 -0
- package/dist/agents/index.d.mts +2 -2
- package/dist/artifacts/index.d.mts +1 -1
- package/dist/channels/index.d.mts +1 -1
- package/dist/evals/index.d.mts +4 -4
- package/dist/{fevex-CVMLnZsk.d.mts → fevex-WBvRWSpy.d.mts} +20 -10
- package/dist/http/index.d.mts +4 -4
- package/dist/{index-CzAi2Y_Z.d.mts → index-3bFNzCiY.d.mts} +154 -4
- package/dist/{index-CbACw6xZ.d.mts → index-BLgiXQK4.d.mts} +2 -2
- package/dist/{index-5p3q2yIp.d.mts → index-BbwT5XxQ.d.mts} +94 -4
- package/dist/{index-Df84VWmN.d.mts → index-CL7mu_x9.d.mts} +1 -1
- package/dist/{index-BTD1c4Ys.d.mts → index-CmFBB4Px.d.mts} +3 -3
- package/dist/{index-B0AdFbgr.d.mts → index-D4mWV2zG.d.mts} +2 -2
- package/dist/{index-CpLDt6Rw.d.mts → index-D7FoZ7aQ.d.mts} +3 -3
- package/dist/{index-BgKFd9yw.d.mts → index-D7r0puBi.d.mts} +15 -2
- package/dist/{index-1cHr7KB_.d.mts → index-D8lCFkc7.d.mts} +4 -4
- package/dist/{index-CseuTR-F.d.mts → index-DgSxJZo4.d.mts} +3 -3
- package/dist/index.d.mts +13 -13
- package/dist/index.mjs +655 -78
- package/dist/knowledge/index.d.mts +1 -1
- package/dist/models/index.d.mts +2 -2
- package/dist/observability/index.d.mts +1 -1
- package/dist/policies/index.d.mts +1 -1
- package/dist/runtime/index.d.mts +2 -2
- package/dist/runtime/index.mjs +172 -1
- package/dist/sandbox/index.d.mts +1 -1
- package/dist/teams/index.d.mts +1 -1
- package/dist/testing/index.d.mts +6 -6
- package/dist/tools/index.d.mts +3 -3
- package/dist/tools/index.mjs +221 -1
- package/dist/{types-B8laW1hM.d.mts → types-CckDlhYo.d.mts} +15 -1
- package/dist/workflows/index.d.mts +1 -1
- package/package.json +1 -1
- package/dist/exact-definition-NHBBFlFR.d.mts +0 -4
package/README.md
CHANGED
|
@@ -430,6 +430,7 @@ run.started
|
|
|
430
430
|
model.started
|
|
431
431
|
model.output.delta
|
|
432
432
|
model.completed
|
|
433
|
+
context.compacted
|
|
433
434
|
tool.started
|
|
434
435
|
tool.completed
|
|
435
436
|
tool.failed
|
|
@@ -500,6 +501,28 @@ summary when needed:
|
|
|
500
501
|
await app.compactSession(first.sessionId, 'Account 42 is active.');
|
|
501
502
|
```
|
|
502
503
|
|
|
504
|
+
Automatic compaction is opt-in through a context budget:
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
const support = defineAgent({
|
|
508
|
+
name: 'support',
|
|
509
|
+
instructions: 'Answer clearly.',
|
|
510
|
+
contextBudget: { contextWindow: 128_000, reserveOutputTokens: 8_000 },
|
|
511
|
+
});
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
Before each model call, Fevex estimates the prompt. Above 80% of the usable
|
|
515
|
+
window it replaces older completed turns with a summary, keeps system
|
|
516
|
+
instructions, the current request and the latest tool batch intact, and emits
|
|
517
|
+
`context.compacted`. The summary is cached on the session and reused across
|
|
518
|
+
runs; the original history is not rewritten. Use `compaction.compactor` to
|
|
519
|
+
inject a summarizer; the default is a deterministic digest and
|
|
520
|
+
`createModelContextCompactor` provides a model-backed option. Redact event
|
|
521
|
+
summaries with `compaction.redactSummary` and read counters with
|
|
522
|
+
`app.getCompactionStats()`.
|
|
523
|
+
`limits.maxInputTokens` is still the cumulative spend cap, while
|
|
524
|
+
`contextBudget.contextWindow` is the model context window.
|
|
525
|
+
|
|
503
526
|
Use `startAgent` when execution must continue without consuming a stream:
|
|
504
527
|
|
|
505
528
|
```ts
|
|
@@ -896,6 +919,32 @@ JSON request/response bodies. It rejects unsupported JSON Schema keywords,
|
|
|
896
919
|
remote refs, YAML, OpenAPI 3.0/3.2 and non-JSON payloads instead of silently
|
|
897
920
|
dropping constraints.
|
|
898
921
|
|
|
922
|
+
## Tool search and large results
|
|
923
|
+
|
|
924
|
+
Agents with large tool catalogs can expose `fevex__search_tools` instead of
|
|
925
|
+
sending every schema on every turn:
|
|
926
|
+
|
|
927
|
+
```ts
|
|
928
|
+
defineAgent({
|
|
929
|
+
name: 'support',
|
|
930
|
+
instructions: 'Answer with the available tools.',
|
|
931
|
+
tools: [...],
|
|
932
|
+
toolSearch: { mode: 'auto', threshold: 30, pinned: ['accounts_get'] },
|
|
933
|
+
});
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
`auto` enables search above the threshold, `on` always does and `off` exposes
|
|
937
|
+
every tool. Search only indexes the agent's own tools; allowlists, policies and
|
|
938
|
+
approvals still apply when a loaded tool executes. Add `semantic.embeddings` to
|
|
939
|
+
fuse lexical and vector candidates with Reciprocal Rank Fusion; failures fall
|
|
940
|
+
back to lexical. An optional `semantic.reranker` can reorder the fused top
|
|
941
|
+
candidates.
|
|
942
|
+
|
|
943
|
+
Tools can cap serialized results with `maxResultBytes`, or an agent/run can set
|
|
944
|
+
`limits.maxToolResultBytes`. The default cap is 1 MiB; use `false` to disable it.
|
|
945
|
+
Store larger outputs through `context.artifacts` and return the descriptor;
|
|
946
|
+
otherwise the run fails with `TOOL_RESULT_TOO_LARGE`.
|
|
947
|
+
|
|
899
948
|
## Channels
|
|
900
949
|
|
|
901
950
|
`@fevex/core/channels` provides a small adapter contract and `handleChannelInput`
|
package/dist/agents/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AgentLimits, r as defineAgent, t as AgentDefinition } from "../index-
|
|
2
|
-
export { AgentDefinition, AgentLimits, defineAgent };
|
|
1
|
+
import { a as ToolSearchOptions, i as ToolSearchCheckpointOptions, n as AgentLimits, o as ToolSearchSemanticOptions, r as ContextBudget, s as defineAgent, t as AgentDefinition } from "../index-3bFNzCiY.mjs";
|
|
2
|
+
export { AgentDefinition, AgentLimits, ContextBudget, ToolSearchCheckpointOptions, ToolSearchOptions, ToolSearchSemanticOptions, defineAgent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ArtifactError, C as FileSystemArtifactStore, D as ArtifactCatalog, E as CatalogedArtifactStoreOptions, F as ArtifactStore, I as ArtifactStoreContext, L as ArtifactWrite, M as ArtifactId, N as ArtifactQuery, O as ArtifactContent, P as ArtifactRecord, R as artifactTenantId, S as InMemoryArtifactCatalog, T as CatalogedArtifactStore, _ as S3ArtifactStore, b as InMemoryArtifactStore, j as ArtifactErrorCode, k as ArtifactDescriptor, v as S3ArtifactStoreOptions, w as FileSystemArtifactStoreOptions, x as InMemoryArtifactStoreOptions, y as S3ObjectClient, z as assertArtifactId } from "../types-
|
|
1
|
+
import { A as ArtifactError, C as FileSystemArtifactStore, D as ArtifactCatalog, E as CatalogedArtifactStoreOptions, F as ArtifactStore, I as ArtifactStoreContext, L as ArtifactWrite, M as ArtifactId, N as ArtifactQuery, O as ArtifactContent, P as ArtifactRecord, R as artifactTenantId, S as InMemoryArtifactCatalog, T as CatalogedArtifactStore, _ as S3ArtifactStore, b as InMemoryArtifactStore, j as ArtifactErrorCode, k as ArtifactDescriptor, v as S3ArtifactStoreOptions, w as FileSystemArtifactStoreOptions, x as InMemoryArtifactStoreOptions, y as S3ObjectClient, z as assertArtifactId } from "../types-CckDlhYo.mjs";
|
|
2
2
|
export { ArtifactCatalog, ArtifactContent, ArtifactDescriptor, ArtifactError, ArtifactErrorCode, ArtifactId, ArtifactQuery, ArtifactRecord, ArtifactStore, ArtifactStoreContext, ArtifactWrite, CatalogedArtifactStore, CatalogedArtifactStoreOptions, FileSystemArtifactStore, FileSystemArtifactStoreOptions, InMemoryArtifactCatalog, InMemoryArtifactStore, InMemoryArtifactStoreOptions, S3ArtifactStore, S3ArtifactStoreOptions, S3ObjectClient, artifactTenantId, assertArtifactId };
|
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-CmFBB4Px.mjs";
|
|
2
2
|
export { ChannelAdapter, ChannelContext, ChannelDeliveryOptions, ChannelElicitationContext, ChannelError, ChannelEvent, ChannelEventType, ChannelFailurePhase, ChannelMessage, ChannelOutput, ChannelRunEvent, ChannelRunOptions, ChannelRunResult, deliverChannelRun, handleChannelInput };
|
package/dist/evals/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as CostCalculator, u as TraceCost } from "../index-
|
|
4
|
-
import { t as Fevex } from "../fevex-
|
|
1
|
+
import { r as ModelMetadata, s as ModelUsage } from "../index-D7r0puBi.mjs";
|
|
2
|
+
import { l as JsonValue, o as ExecutionContext, t as AgentEvent } from "../types-CckDlhYo.mjs";
|
|
3
|
+
import { t as CostCalculator, u as TraceCost } from "../index-D7FoZ7aQ.mjs";
|
|
4
|
+
import { t as Fevex } from "../fevex-WBvRWSpy.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
|
-
import {
|
|
2
|
-
import { t as ModelGateway } from "./index-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { r as PolicyDefinition } from "./index-
|
|
9
|
-
import { n as WorkflowDefinition } from "./index-
|
|
10
|
-
import { t as TeamDefinition } from "./index-
|
|
1
|
+
import { S as ConnectionDefinition, j as ToolDefinition, o as ToolEmbeddingCache } from "./index-BbwT5XxQ.mjs";
|
|
2
|
+
import { t as ModelGateway } from "./index-D7r0puBi.mjs";
|
|
3
|
+
import { F as ArtifactStore, f as RunId, o as ExecutionContext, t as AgentEvent } from "./types-CckDlhYo.mjs";
|
|
4
|
+
import { r as Sandbox } from "./index-CL7mu_x9.mjs";
|
|
5
|
+
import { B as ResumeRunResolution, I as ListEventsOptions, J as RunRequest, O as CredentialStore, Q as Session, R as PurgeRunsOptions, Y as RunResult, Z as RunStore, a as ToolSearchOptions, d as ContextCompactionStats, dt as WorkflowRun, et as SessionId, q as RunRecord, r as ContextBudget, rt as TeamRun, t as AgentDefinition, u as ContextCompactionOptions, x as AgentRun, z as PurgeRunsResult } from "./index-3bFNzCiY.mjs";
|
|
6
|
+
import { c as ContextProvider, f as MemoryStore } from "./index-D4mWV2zG.mjs";
|
|
7
|
+
import { i as ObservabilityStats, r as ObservabilityOptions } from "./index-D7FoZ7aQ.mjs";
|
|
8
|
+
import { r as PolicyDefinition } from "./index-BLgiXQK4.mjs";
|
|
9
|
+
import { n as WorkflowDefinition } from "./index-DgSxJZo4.mjs";
|
|
10
|
+
import { t as TeamDefinition } from "./index-D8lCFkc7.mjs";
|
|
11
11
|
//#region src/fevex.d.ts
|
|
12
12
|
interface FevexAdmissionRequest {
|
|
13
13
|
kind: 'agent' | 'workflow' | 'team';
|
|
@@ -62,6 +62,14 @@ interface FevexConfig {
|
|
|
62
62
|
tools?: ToolDefinition[];
|
|
63
63
|
connections?: ConnectionDefinition[];
|
|
64
64
|
contextProviders?: ContextProvider[];
|
|
65
|
+
/** Default context budget for agents that do not declare one. */
|
|
66
|
+
contextBudget?: ContextBudget;
|
|
67
|
+
/** Optional context compactor and token estimator. */
|
|
68
|
+
compaction?: ContextCompactionOptions;
|
|
69
|
+
/** Default on-demand tool search for agents that do not declare one. */
|
|
70
|
+
toolSearch?: ToolSearchOptions;
|
|
71
|
+
/** Optional durable cache for semantic tool embeddings. */
|
|
72
|
+
toolSearchCache?: ToolEmbeddingCache;
|
|
65
73
|
memoryStore?: MemoryStore;
|
|
66
74
|
runStore?: RunStore;
|
|
67
75
|
credentialStore?: CredentialStore;
|
|
@@ -102,6 +110,8 @@ interface Fevex {
|
|
|
102
110
|
}): Promise<void>;
|
|
103
111
|
/** Cumulative trace export counters for this runtime. */
|
|
104
112
|
getObservabilityStats(): ObservabilityStats;
|
|
113
|
+
/** Cumulative context compaction counters for this runtime. */
|
|
114
|
+
getCompactionStats(): ContextCompactionStats;
|
|
105
115
|
/**
|
|
106
116
|
* Stops admitting new work, drains or cancels active runs, and flushes trace
|
|
107
117
|
* exports. The host still owns closing its stores and external adapters.
|
package/dist/http/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as Fevex } from "../fevex-
|
|
1
|
+
import { c as ReasoningEffort } from "../index-D7r0puBi.mjs";
|
|
2
|
+
import { D as ArtifactCatalog, F as ArtifactStore, f as RunId, k as ArtifactDescriptor, l as JsonValue, o as ExecutionContext, t as AgentEvent } from "../types-CckDlhYo.mjs";
|
|
3
|
+
import { dt as WorkflowRun, et as SessionId, q as RunRecord, rt as TeamRun, x as AgentRun } from "../index-3bFNzCiY.mjs";
|
|
4
|
+
import { t as Fevex } from "../fevex-WBvRWSpy.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,6 +1,6 @@
|
|
|
1
|
-
import { t as ExactDefinition } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { o as ToolEmbeddingCache, t as ToolReranker, z as ExactDefinition } from "./index-BbwT5XxQ.mjs";
|
|
2
|
+
import { c as ReasoningEffort, i as ModelRef, l as ToolChoice, r as ModelMetadata, s as ModelUsage, t as ModelGateway, u as EmbeddingModel } from "./index-D7r0puBi.mjs";
|
|
3
|
+
import { f as RunId, g as ToolSpec, i as AgentMessage, l as JsonValue, o as ExecutionContext, s as JsonObject, t as AgentEvent } from "./types-CckDlhYo.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. */
|
|
@@ -170,11 +170,19 @@ interface TeamRun<TOutput = JsonValue> extends RunCorrelation {
|
|
|
170
170
|
}
|
|
171
171
|
type CoordinatorRun<TOutput = JsonValue> = WorkflowRun<TOutput> | TeamRun<TOutput>;
|
|
172
172
|
type RunRecord<TOutput = unknown> = AgentRun<TOutput> | WorkflowRun<TOutput> | TeamRun<TOutput>;
|
|
173
|
+
interface SessionCompaction {
|
|
174
|
+
/** Derived summary for the first `coveredMessages` history entries. */
|
|
175
|
+
summary: string;
|
|
176
|
+
coveredMessages: number;
|
|
177
|
+
updatedAt: string;
|
|
178
|
+
}
|
|
173
179
|
interface Session {
|
|
174
180
|
/** Optimistic history revision. Missing on legacy sessions means zero. Store-managed. */
|
|
175
181
|
revision?: number;
|
|
176
182
|
id: SessionId;
|
|
177
183
|
history: AgentMessage[];
|
|
184
|
+
/** Reusable summary; the original history remains the source of truth. */
|
|
185
|
+
compaction?: SessionCompaction;
|
|
178
186
|
createdAt: string;
|
|
179
187
|
updatedAt: string;
|
|
180
188
|
}
|
|
@@ -246,6 +254,9 @@ interface RunCheckpoint {
|
|
|
246
254
|
reasoning?: ReasoningEffort;
|
|
247
255
|
definitionHash: string;
|
|
248
256
|
limits?: AgentLimits;
|
|
257
|
+
contextBudget?: ContextBudget;
|
|
258
|
+
toolSearch?: ToolSearchCheckpointOptions;
|
|
259
|
+
loadedTools?: string[];
|
|
249
260
|
messages: AgentMessage[];
|
|
250
261
|
inputContent: string;
|
|
251
262
|
context?: ExecutionContext;
|
|
@@ -392,6 +403,8 @@ interface RunRequest<TInput = unknown, TOutput = unknown> {
|
|
|
392
403
|
reasoning?: ReasoningEffort;
|
|
393
404
|
context?: ExecutionContext;
|
|
394
405
|
limits?: AgentLimits;
|
|
406
|
+
contextBudget?: ContextBudget;
|
|
407
|
+
toolSearch?: ToolSearchOptions;
|
|
395
408
|
elicitation?: ElicitationMode;
|
|
396
409
|
approvalMode?: ApprovalMode;
|
|
397
410
|
toolChoice?: ToolChoice;
|
|
@@ -408,6 +421,94 @@ interface RunResult<TOutput = unknown> {
|
|
|
408
421
|
usage?: ModelUsage;
|
|
409
422
|
}
|
|
410
423
|
//#endregion
|
|
424
|
+
//#region src/runtime/compaction.d.ts
|
|
425
|
+
/** Estimates the input tokens of messages and tool definitions. */
|
|
426
|
+
type ContextTokenEstimator = (input: {
|
|
427
|
+
messages: AgentMessage[];
|
|
428
|
+
tools?: ToolSpec[];
|
|
429
|
+
}) => number;
|
|
430
|
+
interface ContextCompactionInput {
|
|
431
|
+
agentName: string;
|
|
432
|
+
sessionId: SessionId;
|
|
433
|
+
/** Older turns and earlier tool batches; system prefix, current request and latest batch are preserved. */
|
|
434
|
+
messages: AgentMessage[];
|
|
435
|
+
tools?: ToolSpec[];
|
|
436
|
+
/** Estimated tokens of the whole prompt before compaction. */
|
|
437
|
+
estimatedTokens: number;
|
|
438
|
+
/** Soft budget for the messages returned by the compactor. */
|
|
439
|
+
targetTokens: number;
|
|
440
|
+
/** Hard model context window. */
|
|
441
|
+
contextWindow: number;
|
|
442
|
+
step: number;
|
|
443
|
+
context?: ExecutionContext;
|
|
444
|
+
signal?: AbortSignal;
|
|
445
|
+
/** Estimates messages with the runtime's configured estimator. */
|
|
446
|
+
estimateTokens(messages: AgentMessage[]): number;
|
|
447
|
+
}
|
|
448
|
+
/** Returns the replacement for the older conversation messages. */
|
|
449
|
+
interface ContextCompactor {
|
|
450
|
+
compact(input: ContextCompactionInput): AgentMessage[] | Promise<AgentMessage[]>;
|
|
451
|
+
}
|
|
452
|
+
interface ContextCompactionOptions {
|
|
453
|
+
/** Defaults to a deterministic digest compactor. */
|
|
454
|
+
compactor?: ContextCompactor;
|
|
455
|
+
/** Defaults to a character-based estimate. */
|
|
456
|
+
estimateTokens?: ContextTokenEstimator;
|
|
457
|
+
/** Redacts the summary before it enters the context.compacted event. */
|
|
458
|
+
redactSummary?: (summary: string) => string;
|
|
459
|
+
}
|
|
460
|
+
/** Cumulative runtime counters for automatic context compaction. */
|
|
461
|
+
interface ContextCompactionStats {
|
|
462
|
+
compactions: number;
|
|
463
|
+
removedMessages: number;
|
|
464
|
+
estimatedTokens: number;
|
|
465
|
+
compactedTokens: number;
|
|
466
|
+
savedTokens: number;
|
|
467
|
+
}
|
|
468
|
+
interface ResolvedContextBudget {
|
|
469
|
+
contextWindow: number;
|
|
470
|
+
reserveOutputTokens: number;
|
|
471
|
+
compactAt: number;
|
|
472
|
+
targetTokens: number;
|
|
473
|
+
safetyFactor: number;
|
|
474
|
+
}
|
|
475
|
+
/** Validates a context budget and fills in defaults. */
|
|
476
|
+
declare function resolveContextBudget(budget: ContextBudget | undefined, label: string): ResolvedContextBudget | undefined;
|
|
477
|
+
/**
|
|
478
|
+
* Rough provider-neutral estimate: about four characters per token plus
|
|
479
|
+
* message and tool framing. Hosts can inject a real tokenizer instead.
|
|
480
|
+
*/
|
|
481
|
+
declare function estimateContextTokens(input: {
|
|
482
|
+
messages: AgentMessage[];
|
|
483
|
+
tools?: ToolSpec[];
|
|
484
|
+
}): number;
|
|
485
|
+
interface ModelContextCompactorOptions {
|
|
486
|
+
/** Model used only to summarize older context. */
|
|
487
|
+
model: ModelGateway;
|
|
488
|
+
/** Overrides the built-in summarization instructions. */
|
|
489
|
+
systemPrompt?: string;
|
|
490
|
+
/** Maximum output tokens for the summary. Defaults to 1,024. */
|
|
491
|
+
maxOutputTokens?: number;
|
|
492
|
+
/** Maximum characters sent to one summarization call. Defaults to 120,000. */
|
|
493
|
+
maxInputChars?: number;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Creates a semantic compactor backed by a model. Use a cheap, fast model and
|
|
497
|
+
* keep it separate from the agent model when possible. Large transcripts are
|
|
498
|
+
* summarized in chunks and then merged.
|
|
499
|
+
*/
|
|
500
|
+
declare function createModelContextCompactor(options: ModelContextCompactorOptions): ContextCompactor;
|
|
501
|
+
interface DigestContextCompactorOptions {
|
|
502
|
+
/** Maximum characters kept from one message. Defaults to 400. */
|
|
503
|
+
maxCharsPerMessage?: number;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Deterministic compactor used when the host does not inject one. It keeps
|
|
507
|
+
* role-aware excerpts of older messages and drops the oldest excerpts first.
|
|
508
|
+
* It never calls a model.
|
|
509
|
+
*/
|
|
510
|
+
declare function createDigestContextCompactor(options?: DigestContextCompactorOptions): ContextCompactor;
|
|
511
|
+
//#endregion
|
|
411
512
|
//#region src/runtime/in-memory-run-store.d.ts
|
|
412
513
|
/**
|
|
413
514
|
* In-process durable store intended for development and tests.
|
|
@@ -440,7 +541,54 @@ interface AgentLimits {
|
|
|
440
541
|
maxToolCalls?: number;
|
|
441
542
|
maxInputTokens?: number | false;
|
|
442
543
|
maxOutputTokens?: number | false;
|
|
544
|
+
/** Maximum serialized bytes for one tool result. Use `false` to disable the default cap. */
|
|
545
|
+
maxToolResultBytes?: number | false;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Per-request model context budget. It is separate from
|
|
549
|
+
* {@link AgentLimits.maxInputTokens}, which caps cumulative spend for a run.
|
|
550
|
+
*/
|
|
551
|
+
interface ContextBudget {
|
|
552
|
+
/** Model context window in tokens. */
|
|
553
|
+
contextWindow: number;
|
|
554
|
+
/** Tokens reserved for the next model output. Defaults to 0. */
|
|
555
|
+
reserveOutputTokens?: number;
|
|
556
|
+
/** Fraction of the usable window that triggers compaction. Defaults to 0.8. */
|
|
557
|
+
compactAt?: number;
|
|
558
|
+
/** Target tokens after compaction. Defaults below the compaction threshold. */
|
|
559
|
+
targetTokens?: number;
|
|
560
|
+
/** Multiplier applied to estimates to leave headroom. Defaults to 1.1. */
|
|
561
|
+
safetyFactor?: number;
|
|
562
|
+
}
|
|
563
|
+
interface ToolSearchSemanticOptions {
|
|
564
|
+
/** Embedding model used to index tools and queries. */
|
|
565
|
+
embeddings: EmbeddingModel;
|
|
566
|
+
/** Cache for tool vectors. Defaults to the runtime cache. */
|
|
567
|
+
cache?: ToolEmbeddingCache;
|
|
568
|
+
/** Vector candidates considered before fusion. Defaults to 20. */
|
|
569
|
+
topK?: number;
|
|
570
|
+
/** Minimum cosine score for vector candidates. Defaults to 0. */
|
|
571
|
+
minScore?: number;
|
|
572
|
+
/** Optional second-stage reranker over the fused candidates. */
|
|
573
|
+
reranker?: ToolReranker;
|
|
574
|
+
}
|
|
575
|
+
/** On-demand tool discovery for agents with large tool catalogs. */
|
|
576
|
+
interface ToolSearchOptions {
|
|
577
|
+
/** `auto` enables search above the configured thresholds. Defaults to `auto`. */
|
|
578
|
+
mode?: 'auto' | 'on' | 'off';
|
|
579
|
+
/** Tool-count threshold for `auto`. Defaults to 30. */
|
|
580
|
+
threshold?: number;
|
|
581
|
+
/** Estimated tool-token threshold for `auto`. */
|
|
582
|
+
tokenThreshold?: number;
|
|
583
|
+
/** Maximum tools returned by one search. Defaults to 5. */
|
|
584
|
+
limit?: number;
|
|
585
|
+
/** Tool names exposed without a search. */
|
|
586
|
+
pinned?: string[];
|
|
587
|
+
/** Optional hybrid lexical + vector retrieval. */
|
|
588
|
+
semantic?: ToolSearchSemanticOptions;
|
|
443
589
|
}
|
|
590
|
+
/** Serializable tool-search options stored in a run checkpoint. */
|
|
591
|
+
type ToolSearchCheckpointOptions = Omit<ToolSearchOptions, 'semantic'>;
|
|
444
592
|
interface AgentDefinition<TInput = unknown, TOutput = unknown> {
|
|
445
593
|
name: string;
|
|
446
594
|
instructions: string;
|
|
@@ -461,7 +609,9 @@ interface AgentDefinition<TInput = unknown, TOutput = unknown> {
|
|
|
461
609
|
inputSchema?: StandardSchemaV1<unknown, TInput>;
|
|
462
610
|
outputSchema?: StandardSchemaV1<unknown, TOutput>;
|
|
463
611
|
limits?: AgentLimits;
|
|
612
|
+
contextBudget?: ContextBudget;
|
|
613
|
+
toolSearch?: ToolSearchOptions;
|
|
464
614
|
}
|
|
465
615
|
declare function defineAgent<T extends AgentDefinition>(agent: ExactDefinition<T, AgentDefinition>): T;
|
|
466
616
|
//#endregion
|
|
467
|
-
export {
|
|
617
|
+
export { SessionCompaction as $, ElicitationMode as A, ResumeRunResolution as B, ApprovalMode as C, CoordinatorRun as D, CoordinatorCheckpoint as E, ExecutionCreate as F, RunLease as G, RetainableRunStore as H, ListEventsOptions as I, RunRequest as J, RunPause as K, PendingToolExecution as L, ElicitationResolution as M, EventResolution as N, CredentialStore as O, ExecutionCommit as P, Session as Q, PurgeRunsOptions as R, AgentRunPause as S, ApprovalResolution as T, RunCheckpoint as U, RetainableRunStatus as V, RunCorrelation as W, RunStatus as X, RunResult as Y, RunStore as Z, createDigestContextCompactor as _, validatePurgeRunsOptions as _t, ToolSearchOptions as a, ToolExecutionRecord as at, resolveContextBudget as b, InMemoryRunStore as c, WorkflowBudgetUsage as ct, ContextCompactionStats as d, WorkflowRun as dt, SessionId as et, ContextCompactor as f, WorkflowStepRecord as ft, ResolvedContextBudget as g, validateListEventsOptions as gt, ModelContextCompactorOptions as h, isRetainableRunStore as ht, ToolSearchCheckpointOptions as i, TimerResolution as it, ElicitationRequest as j, DurableRunStore as k, ContextCompactionInput as l, WorkflowCheckpoint as lt, DigestContextCompactorOptions as m, isDurableRunStore as mt, AgentLimits as n, TeamCheckpoint as nt, ToolSearchSemanticOptions as o, ToolExecutionResolution as ot, ContextTokenEstimator as p, WorkflowWaitRecord as pt, RunRecord as q, ContextBudget as r, TeamRun as rt, defineAgent as s, ToolExecutionStatus as st, AgentDefinition as t, StoredRunCheckpoint as tt, ContextCompactionOptions as u, WorkflowCompensationRecord as ut, createModelContextCompactor as v, ApprovalRequest as w, AgentRun as x, estimateContextTokens as y, PurgeRunsResult as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { I as ToolRisk } from "./index-BbwT5XxQ.mjs";
|
|
2
|
+
import { f as RunId, l as JsonValue, o as ExecutionContext } from "./types-CckDlhYo.mjs";
|
|
3
3
|
//#region src/policies/policy.d.ts
|
|
4
4
|
/** Authorization outcome returned by a policy. */
|
|
5
5
|
type PolicyDecision = 'allow' | 'deny' | 'require_approval';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as ArtifactStore, f as RunId, g as ToolSpec, h as ToolEventSource, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-
|
|
3
|
-
import { i as SandboxCapabilities, r as Sandbox } from "./index-
|
|
1
|
+
import { u as EmbeddingModel } from "./index-D7r0puBi.mjs";
|
|
2
|
+
import { F as ArtifactStore, f as RunId, g as ToolSpec, h as ToolEventSource, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CckDlhYo.mjs";
|
|
3
|
+
import { i as SandboxCapabilities, r as Sandbox } from "./index-CL7mu_x9.mjs";
|
|
4
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
|
+
//#region src/internal/exact-definition.d.ts
|
|
6
|
+
type ExactDefinition<TInput, TShape> = TInput & { readonly [TKey in Exclude<keyof TInput, keyof TShape>]: never; };
|
|
7
|
+
//#endregion
|
|
5
8
|
//#region src/tools/tool.d.ts
|
|
6
9
|
interface ToolExecutionContext {
|
|
7
10
|
runId: RunId;
|
|
@@ -37,6 +40,8 @@ interface ToolDefinition<TInput = unknown, TOutput = unknown> {
|
|
|
37
40
|
retry?: ToolRetryPolicy;
|
|
38
41
|
credentials?: string[];
|
|
39
42
|
sandbox?: SandboxCapabilities;
|
|
43
|
+
/** Maximum serialized bytes for one result. Use an artifact or `false` to opt out of the default cap. */
|
|
44
|
+
maxResultBytes?: number | false;
|
|
40
45
|
source?: ToolEventSource;
|
|
41
46
|
resolve?: (context?: ToolProviderContext) => Promise<ToolProviderTool | undefined>;
|
|
42
47
|
execute(input: TInput, context: ToolExecutionContext): TOutput | Promise<TOutput>;
|
|
@@ -99,6 +104,7 @@ interface ConnectionToolPolicy {
|
|
|
99
104
|
idempotency?: ToolIdempotency;
|
|
100
105
|
retry?: ToolRetryPolicy;
|
|
101
106
|
credentials?: string[];
|
|
107
|
+
maxResultBytes?: number | false;
|
|
102
108
|
}
|
|
103
109
|
interface ConnectionDefinition {
|
|
104
110
|
name: string;
|
|
@@ -131,4 +137,88 @@ interface FevexJsonSchemaValidator {
|
|
|
131
137
|
declare function validateFevexJsonSchemaProfile(schema: JsonObject, options?: FevexJsonSchemaProfileOptions): JsonObject;
|
|
132
138
|
declare function compileFevexJsonSchema(schema: JsonObject, options?: FevexJsonSchemaProfileOptions): FevexJsonSchemaValidator;
|
|
133
139
|
//#endregion
|
|
134
|
-
|
|
140
|
+
//#region src/tools/tool-index.d.ts
|
|
141
|
+
/** Cache of tool embedding vectors keyed by content hash. */
|
|
142
|
+
interface ToolEmbeddingCache {
|
|
143
|
+
get(key: string): number[] | undefined | Promise<number[] | undefined>;
|
|
144
|
+
set(key: string, vector: number[]): void | Promise<void>;
|
|
145
|
+
/** Optional batch read for durable caches with network/database latency. */
|
|
146
|
+
getMany?(keys: readonly string[]): Array<number[] | undefined> | Promise<Array<number[] | undefined>>;
|
|
147
|
+
/** Optional batch write for durable caches with network/database latency. */
|
|
148
|
+
setMany?(entries: ReadonlyArray<{
|
|
149
|
+
key: string;
|
|
150
|
+
vector: number[];
|
|
151
|
+
}>): void | Promise<void>;
|
|
152
|
+
}
|
|
153
|
+
interface InMemoryToolEmbeddingCacheOptions {
|
|
154
|
+
/** Maximum cached vectors. Defaults to 1,000. */
|
|
155
|
+
maxEntries?: number;
|
|
156
|
+
}
|
|
157
|
+
/** Bounded LRU cache for tool embeddings. */
|
|
158
|
+
declare class InMemoryToolEmbeddingCache implements ToolEmbeddingCache {
|
|
159
|
+
#private;
|
|
160
|
+
constructor(options?: InMemoryToolEmbeddingCacheOptions);
|
|
161
|
+
get size(): number;
|
|
162
|
+
get(key: string): number[] | undefined;
|
|
163
|
+
set(key: string, vector: number[]): void;
|
|
164
|
+
getMany(keys: readonly string[]): Array<number[] | undefined>;
|
|
165
|
+
setMany(entries: ReadonlyArray<{
|
|
166
|
+
key: string;
|
|
167
|
+
vector: number[];
|
|
168
|
+
}>): void;
|
|
169
|
+
}
|
|
170
|
+
interface ToolEmbeddingIndexEntry {
|
|
171
|
+
tool: ToolSpec;
|
|
172
|
+
vector: number[];
|
|
173
|
+
}
|
|
174
|
+
interface ToolEmbeddingIndex {
|
|
175
|
+
modelId: string;
|
|
176
|
+
dimensions: number;
|
|
177
|
+
entries: ToolEmbeddingIndexEntry[];
|
|
178
|
+
}
|
|
179
|
+
interface BuildToolEmbeddingIndexOptions {
|
|
180
|
+
tools: readonly ToolSpec[];
|
|
181
|
+
embeddings: EmbeddingModel;
|
|
182
|
+
cache?: ToolEmbeddingCache;
|
|
183
|
+
/** Texts per embedding request. Defaults to 64. */
|
|
184
|
+
batchSize?: number;
|
|
185
|
+
signal?: AbortSignal;
|
|
186
|
+
}
|
|
187
|
+
interface ToolEmbeddingMatch {
|
|
188
|
+
tool: ToolSpec;
|
|
189
|
+
score: number;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Builds or refreshes a semantic index for a tool catalog. The content key is
|
|
193
|
+
* `sha256(embeddingModel.id + text)`, so changing the model or the tool text
|
|
194
|
+
* invalidates the cached vector.
|
|
195
|
+
*/
|
|
196
|
+
declare function buildToolEmbeddingIndex(options: BuildToolEmbeddingIndexOptions): Promise<ToolEmbeddingIndex>;
|
|
197
|
+
/** Returns cosine matches above `minScore`, ordered by score. */
|
|
198
|
+
declare function searchToolEmbeddingIndex(index: ToolEmbeddingIndex, query: readonly number[], limit: number, minScore?: number): ToolEmbeddingMatch[];
|
|
199
|
+
/** Canonical text indexed for one tool: name, description and schema keywords. */
|
|
200
|
+
declare function toolEmbeddingText(tool: ToolSpec): string;
|
|
201
|
+
/** Extracts property names, descriptions, titles, required fields and enum values. */
|
|
202
|
+
declare function schemaKeywords(schema: JsonObject | undefined): string;
|
|
203
|
+
/** Stable content key for one embedding model and tool text. */
|
|
204
|
+
declare function toolEmbeddingKey(modelId: string, text: string): Promise<string>;
|
|
205
|
+
declare function cosineSimilarity(left: readonly number[], right: readonly number[]): number;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/tools/tool-reranker.d.ts
|
|
208
|
+
/** One tool candidate passed to a reranker. */
|
|
209
|
+
interface ToolSearchCandidate {
|
|
210
|
+
tool: ToolSpec;
|
|
211
|
+
/** Lexical/vector fusion score. Rerankers may ignore it. */
|
|
212
|
+
score: number;
|
|
213
|
+
}
|
|
214
|
+
/** Optional second-stage ranking over the top lexical/vector candidates. */
|
|
215
|
+
interface ToolReranker {
|
|
216
|
+
rerank(input: {
|
|
217
|
+
query: string;
|
|
218
|
+
tools: ToolSearchCandidate[];
|
|
219
|
+
limit: number;
|
|
220
|
+
signal?: AbortSignal;
|
|
221
|
+
}): Promise<ToolSearchCandidate[]>;
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
224
|
+
export { ToolApproval as A, ConnectionToolPolicy as C, ToolProviderContext as D, ToolProvider as E, ToolRetryPolicy as F, ToolRisk as I, defineTool as L, ToolExecutionContext as M, ToolIdempotency as N, ToolProviderTool as O, ToolResult as P, toToolSpec as R, ConnectionDefinition as S, IntegrationErrorCategory as T, FevexJsonSchemaProfileLimits as _, InMemoryToolEmbeddingCacheOptions as a, compileFevexJsonSchema as b, ToolEmbeddingIndexEntry as c, cosineSimilarity as d, schemaKeywords as f, FEVEX_JSON_SCHEMA_PROFILE_VERSION as g, toolEmbeddingText as h, InMemoryToolEmbeddingCache as i, ToolDefinition as j, defineConnection as k, ToolEmbeddingMatch as l, toolEmbeddingKey as m, ToolSearchCandidate as n, ToolEmbeddingCache as o, searchToolEmbeddingIndex as p, BuildToolEmbeddingIndexOptions as r, ToolEmbeddingIndex as s, ToolReranker as t, buildToolEmbeddingIndex as u, FevexJsonSchemaProfileOptions as v, IntegrationError as w, validateFevexJsonSchemaProfile as x, FevexJsonSchemaValidator as y, ExactDefinition as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { f as RunId, o as ExecutionContext, s as JsonObject, t as AgentEvent } from "./types-
|
|
2
|
-
import {
|
|
3
|
-
import { t as Fevex } from "./fevex-
|
|
1
|
+
import { f as RunId, o as ExecutionContext, s as JsonObject, t as AgentEvent } from "./types-CckDlhYo.mjs";
|
|
2
|
+
import { et as SessionId, j as ElicitationRequest, x as AgentRun } from "./index-3bFNzCiY.mjs";
|
|
3
|
+
import { t as Fevex } from "./fevex-WBvRWSpy.mjs";
|
|
4
4
|
//#region src/channels/channel.d.ts
|
|
5
5
|
interface ChannelMessage {
|
|
6
6
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CckDlhYo.mjs";
|
|
2
|
+
import { et as SessionId } from "./index-3bFNzCiY.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
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { r as ModelMetadata, s as ModelUsage } from "./index-D7r0puBi.mjs";
|
|
2
|
+
import { f as RunId, l as JsonValue, s as JsonObject } from "./types-CckDlhYo.mjs";
|
|
3
|
+
import { et as SessionId } from "./index-3bFNzCiY.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';
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import { g as ToolSpec, i as AgentMessage, l as JsonValue, m as ToolCall, s as JsonObject } from "./types-
|
|
1
|
+
import { g as ToolSpec, i as AgentMessage, l as JsonValue, m as ToolCall, s as JsonObject } from "./types-CckDlhYo.mjs";
|
|
2
|
+
//#region src/models/embedding.d.ts
|
|
3
|
+
/** Provider-neutral embedding model used to index tools and queries. */
|
|
4
|
+
interface EmbeddingModel {
|
|
5
|
+
/** Stable identity: provider, model and dimensions. Used in cache keys. */
|
|
6
|
+
readonly id: string;
|
|
7
|
+
/** Expected vector dimensions. Optional; inferred from the first result. */
|
|
8
|
+
readonly dimensions?: number;
|
|
9
|
+
embed(input: {
|
|
10
|
+
texts: string[];
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
}): Promise<number[][]>;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
2
15
|
//#region src/models/model.d.ts
|
|
3
16
|
/** Provider-neutral reasoning levels accepted by model gateways. */
|
|
4
17
|
type ReasoningEffort = 'provider-default' | 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
@@ -48,4 +61,4 @@ type ModelStreamEvent<TOutput = unknown> = {
|
|
|
48
61
|
};
|
|
49
62
|
type ModelRef = string | ModelGateway;
|
|
50
63
|
//#endregion
|
|
51
|
-
export { ModelResult as a, ReasoningEffort as c, ModelRef as i, ToolChoice as l, ModelInput as n, ModelStreamEvent as o, ModelMetadata as r, ModelUsage as s, ModelGateway as t };
|
|
64
|
+
export { ModelResult as a, ReasoningEffort as c, ModelRef as i, ToolChoice as l, ModelInput as n, ModelStreamEvent as o, ModelMetadata as r, ModelUsage as s, ModelGateway as t, EmbeddingModel as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as ExecutionContext } from "./types-
|
|
3
|
-
import { n as AgentLimits } from "./index-
|
|
4
|
-
import { t as WorkflowAgentResult } from "./index-
|
|
1
|
+
import { z as ExactDefinition } from "./index-BbwT5XxQ.mjs";
|
|
2
|
+
import { o as ExecutionContext } from "./types-CckDlhYo.mjs";
|
|
3
|
+
import { n as AgentLimits } from "./index-3bFNzCiY.mjs";
|
|
4
|
+
import { t as WorkflowAgentResult } from "./index-DgSxJZo4.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
|
-
import {
|
|
2
|
-
import { f as RunId, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-
|
|
3
|
-
import {
|
|
1
|
+
import { z as ExactDefinition } from "./index-BbwT5XxQ.mjs";
|
|
2
|
+
import { f as RunId, l as JsonValue, o as ExecutionContext, s as JsonObject } from "./types-CckDlhYo.mjs";
|
|
3
|
+
import { J as RunRequest, Y as RunResult, et as SessionId, n as AgentLimits } from "./index-3bFNzCiY.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. */
|