@linnlabs/linnkit 0.9.0 → 0.21.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/CHANGELOG.md +168 -0
- package/bin/linnkit.cjs +7 -0
- package/dist/{agent-invocation-BHcNfrBV.d.cts → agent-invocation-CAlm9qOw.d.cts} +1 -1
- package/dist/{agent-invocation-BznDaXDs.d.ts → agent-invocation-DKoEDLkl.d.ts} +1 -1
- package/dist/{ai-engine.types-vZRnQcJa.d.ts → ai-engine.types-CeLoM624.d.cts} +9 -1
- package/dist/{ai-engine.types-BpeU_XQG.d.cts → ai-engine.types-LqmnfR2W.d.ts} +9 -1
- package/dist/{audit-CtcfART1.d.ts → audit-BuWHoMEr.d.ts} +4 -2
- package/dist/{audit-LeOrm2hX.d.cts → audit-DnzNQzwq.d.cts} +4 -2
- package/dist/cli.cjs +682 -258
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +682 -258
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +823 -57
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.d.cts +132 -18
- package/dist/context-manager.d.ts +132 -18
- package/dist/context-manager.js +823 -58
- package/dist/context-manager.js.map +1 -1
- package/dist/{context-trace-HE2qY5Q-.d.cts → context-trace-DrtvKac4.d.cts} +37 -4
- package/dist/{context-trace-DRi5M4lX.d.ts → context-trace-WV1HAZeB.d.ts} +37 -4
- package/dist/contracts.cjs +225 -2
- package/dist/contracts.cjs.map +1 -1
- package/dist/contracts.d.cts +6 -4
- package/dist/contracts.d.ts +6 -4
- package/dist/contracts.js +205 -3
- package/dist/contracts.js.map +1 -1
- package/dist/{defaultGraphExecutor-BIjJj7WF.d.cts → defaultGraphExecutor-L1ri3oij.d.cts} +48 -19
- package/dist/{defaultGraphExecutor-BBswR8wn.d.ts → defaultGraphExecutor-QzzdudLQ.d.ts} +48 -19
- package/dist/{index-BanRABEt.d.cts → index-BeQO0rx2.d.cts} +345 -268
- package/dist/{index-Cvr23YCl.d.cts → index-CDofGr_4.d.ts} +24 -6
- package/dist/{index-Dl5PLgAv.d.cts → index-Crl5E4eF.d.cts} +27 -4
- package/dist/{index-CJeWHopy.d.ts → index-DWGKvssS.d.ts} +3 -3
- package/dist/{index-CHqwkvGp.d.ts → index-X5lYU1Lj.d.ts} +27 -4
- package/dist/{index-DDzuSb0n.d.ts → index-uCNCpJBg.d.cts} +24 -6
- package/dist/{index-Z8NXKNwI.d.ts → index-wOZD-p2-.d.ts} +345 -268
- package/dist/{index-DO4dQgf2.d.cts → index-wXVAHZ0D.d.cts} +3 -3
- package/dist/index.cjs +1011 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -16
- package/dist/index.d.ts +19 -16
- package/dist/index.js +1011 -329
- package/dist/index.js.map +1 -1
- package/dist/{messages-XthmnHZ3.d.cts → messages-Br5SiLD3.d.cts} +706 -1
- package/dist/{messages-XthmnHZ3.d.ts → messages-Br5SiLD3.d.ts} +706 -1
- package/dist/{ports-DnLuKfpE.d.ts → ports-Dugizzje.d.cts} +6 -2
- package/dist/{ports-DaatKJXp.d.cts → ports-fhp84x_C.d.ts} +6 -2
- package/dist/ports.d.cts +8 -5
- package/dist/ports.d.ts +8 -5
- package/dist/quickstart.cjs +683 -258
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.d.cts +11 -10
- package/dist/quickstart.d.ts +11 -10
- package/dist/quickstart.js +683 -258
- package/dist/quickstart.js.map +1 -1
- package/dist/{runAgent-CPj_9e58.d.ts → runAgent-BmMSju8I.d.ts} +6 -6
- package/dist/{runAgent-HYKlXbVr.d.cts → runAgent-CKgcRSRH.d.cts} +6 -6
- package/dist/{runHandle-D3gPsD7B.d.cts → runHandle-DH4VmQx6.d.cts} +6 -4
- package/dist/{runHandle-CyXvzgzk.d.ts → runHandle-o3p06Nva.d.ts} +6 -4
- package/dist/runtime-kernel/events.cjs +202 -1
- package/dist/runtime-kernel/events.cjs.map +1 -1
- package/dist/runtime-kernel/events.d.cts +5 -5
- package/dist/runtime-kernel/events.d.ts +5 -5
- package/dist/runtime-kernel/events.js +202 -1
- package/dist/runtime-kernel/events.js.map +1 -1
- package/dist/runtime-kernel.cjs +999 -340
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.d.cts +16 -14
- package/dist/runtime-kernel.d.ts +16 -14
- package/dist/runtime-kernel.js +990 -341
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +1003 -321
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.d.cts +16 -14
- package/dist/testkit.d.ts +16 -14
- package/dist/testkit.js +1003 -321
- package/dist/testkit.js.map +1 -1
- package/dist/{todo-B1PmDlp3.d.cts → todo-Ca8llpRQ.d.cts} +1 -1
- package/dist/{todo-B1PmDlp3.d.ts → todo-Ca8llpRQ.d.ts} +1 -1
- package/dist/{agentSpec-EkmviZjy.d.cts → token-accounting-CwpSPg4y.d.cts} +1280 -1
- package/dist/{agentSpec-EkmviZjy.d.ts → token-accounting-CwpSPg4y.d.ts} +1280 -1
- package/dist/token-calibration-Cxv6dDYF.d.cts +327 -0
- package/dist/token-calibration-Cxv6dDYF.d.ts +327 -0
- package/dist/token-counter-CFfP8PQb.d.cts +26 -0
- package/dist/token-counter-SFyyTeaG.d.ts +26 -0
- package/dist/token-usage-CqwT7-5K.d.cts +133 -0
- package/dist/token-usage-CqwT7-5K.d.ts +133 -0
- package/dist/{tokenizer-DFL4I7-I.d.ts → tokenizer-BFJNCHFX.d.ts} +1 -1
- package/dist/{tokenizer-DH_JXv-H.d.cts → tokenizer-DoGsBE3A.d.cts} +1 -1
- package/dist/{toolContracts-CLkQmhTG.d.cts → toolContracts-Bm3EZ1UM.d.cts} +13 -2
- package/dist/{toolContracts-Blll0241.d.ts → toolContracts-f8lzZBNa.d.ts} +13 -2
- package/docs/README.md +1 -1
- package/docs/integration/README.md +3 -3
- package/docs/integration/agent-registration-guide.md +3 -1
- package/docs/integration/child-runs.md +4 -1
- package/docs/integration/context-engineering.md +83 -16
- package/docs/integration/context-fences.md +44 -3
- package/docs/integration/llm-provider.md +1 -1
- package/docs/integration/persistence.md +1 -0
- package/docs/integration/run-supervisor.md +3 -0
- package/docs/integration/tool-development-guide.md +7 -5
- package/docs/integration/tool-history.md +43 -17
- package/package.json +4 -3
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
import { a as EventStore, P as PersistedEvent, E as EventRangeOptions, m as RunRegistryStore, l as RunRecord, L as ListRunsFilter, n as RunRequestSnapshot, b as EventBus, f as RunCostCollector, h as RunHandle, k as RunObserveFilter, C as CancelOpts,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { A as AgentAiEngine, b as AuditPort } from './audit-
|
|
5
|
-
import { A as AgentInvocationRequest } from './agent-invocation-
|
|
1
|
+
import { a as EventStore, P as PersistedEvent, E as EventRangeOptions, m as RunRegistryStore, l as RunRecord, L as ListRunsFilter, n as RunRequestSnapshot, b as EventBus, f as RunCostCollector, h as RunHandle, k as RunObserveFilter, C as CancelOpts, e as RunAwaitingUserPatch, j as RunMeta } from './runHandle-DH4VmQx6.cjs';
|
|
2
|
+
import { L as LlmUsageTokenLedgerEntry, C as ContextTokenComponent, w as ContextComponentTokenLedgerEntry, e as AgentSpecSystemReminderPolicy, u as AgentSpecToolObservationGovernancePolicy, f as AgentSpec } from './token-accounting-CwpSPg4y.cjs';
|
|
3
|
+
import { R as RuntimeEvent } from './todo-Ca8llpRQ.cjs';
|
|
4
|
+
import { A as AgentAiEngine, b as AuditPort } from './audit-DnzNQzwq.cjs';
|
|
5
|
+
import { A as AgentInvocationRequest } from './agent-invocation-CAlm9qOw.cjs';
|
|
6
6
|
import { A as AnyAgentEvent } from './agentEvents-DEB7Fy_J.cjs';
|
|
7
|
-
import { T as ToolCall, c as LlmRetryConfig, a as LlmRequestMessage, L as LlmCallOptions, e as ToolCallExtraContent } from './ai-engine.types-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { T as ToolCall, c as LlmRetryConfig, a as LlmRequestMessage, L as LlmCallOptions, e as ToolCallExtraContent } from './ai-engine.types-CeLoM624.cjs';
|
|
8
|
+
import { C as CanonicalLlmUsage } from './token-usage-CqwT7-5K.cjs';
|
|
9
|
+
import { a as ToolExecutionContext } from './toolContracts-Bm3EZ1UM.cjs';
|
|
10
|
+
import { h as ToolRuntimePort, O as ObservationPreviewPort } from './ports-Dugizzje.cjs';
|
|
11
|
+
import { C as ContextBuildTokenEstimate } from './token-calibration-Cxv6dDYF.cjs';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @file src/agent/shared/llmTelemetryContext.ts
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* LLM Telemetry 上下文(用于审计/统计,不进入模型上下文,不落库到 EventStore)。
|
|
18
|
+
*
|
|
19
|
+
* 中文备注(设计约束):
|
|
20
|
+
* - 某些“多阶段/多子任务”的审计需要一个可聚合的数据源;
|
|
21
|
+
* - 这些数据不适合塞进 RuntimeEvent(会污染主时间轴、跨端联动成本高);
|
|
22
|
+
* - 因此这里用 AsyncLocalStorage 提供“同一条异步链路内可写入/可聚合”的基础设施;
|
|
23
|
+
* - 默认不启用:只有当业务侧显式用 `withLLMTelemetryContext(...)` 包裹执行链路时才会收集。
|
|
24
|
+
*/
|
|
10
25
|
|
|
11
26
|
type NormalizedLlmUsage = {
|
|
12
27
|
promptTokens: number;
|
|
13
28
|
completionTokens: number;
|
|
14
29
|
totalTokens: number;
|
|
30
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
15
31
|
};
|
|
16
32
|
type LLMTelemetryContext = {
|
|
17
33
|
/**
|
|
@@ -35,13 +51,14 @@ type LlmCallTelemetry = {
|
|
|
35
51
|
startedAt: number;
|
|
36
52
|
durationMs: number;
|
|
37
53
|
usage?: NormalizedLlmUsage;
|
|
54
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
38
55
|
};
|
|
39
56
|
declare function withLLMTelemetryContext<T>(ctx: LLMTelemetryContext, fn: () => Promise<T>): Promise<{
|
|
40
57
|
value: T;
|
|
41
58
|
calls: LlmCallTelemetry[];
|
|
42
59
|
}>;
|
|
43
60
|
|
|
44
|
-
declare const TELEMETRY_EVENT_KINDS: readonly ["llm_call", "tool_call", "graph_node", "run_lifecycle"];
|
|
61
|
+
declare const TELEMETRY_EVENT_KINDS: readonly ["llm_call", "tool_call", "context_build", "graph_node", "run_lifecycle"];
|
|
45
62
|
type TelemetryEventKind = (typeof TELEMETRY_EVENT_KINDS)[number];
|
|
46
63
|
|
|
47
64
|
type TelemetryScope = {
|
|
@@ -57,6 +74,8 @@ type TelemetryEvent = {
|
|
|
57
74
|
stream: boolean;
|
|
58
75
|
durationMs: number;
|
|
59
76
|
usage?: NormalizedLlmUsage;
|
|
77
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
78
|
+
tokenLedgerEntry?: LlmUsageTokenLedgerEntry;
|
|
60
79
|
scope: TelemetryScope;
|
|
61
80
|
} | {
|
|
62
81
|
kind: Extract<TelemetryEventKind, 'tool_call'>;
|
|
@@ -65,6 +84,14 @@ type TelemetryEvent = {
|
|
|
65
84
|
ok: boolean;
|
|
66
85
|
errorCode?: string;
|
|
67
86
|
scope: TelemetryScope;
|
|
87
|
+
} | {
|
|
88
|
+
kind: Extract<TelemetryEventKind, 'context_build'>;
|
|
89
|
+
modelId: string;
|
|
90
|
+
mode: 'agent' | 'chat';
|
|
91
|
+
tokenEstimate: ContextBuildTokenEstimate;
|
|
92
|
+
tokenComponents?: ContextTokenComponent[];
|
|
93
|
+
tokenLedgerEntry?: ContextComponentTokenLedgerEntry;
|
|
94
|
+
scope: TelemetryScope;
|
|
68
95
|
} | {
|
|
69
96
|
kind: Extract<TelemetryEventKind, 'graph_node'>;
|
|
70
97
|
nodeId: string;
|
|
@@ -227,6 +254,7 @@ type LlmCallResult = string | {
|
|
|
227
254
|
tool_calls?: ToolCall[];
|
|
228
255
|
reasoning_details?: unknown[];
|
|
229
256
|
usage?: unknown;
|
|
257
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
230
258
|
};
|
|
231
259
|
|
|
232
260
|
/**
|
|
@@ -373,7 +401,7 @@ interface StandardToolCall {
|
|
|
373
401
|
*/
|
|
374
402
|
|
|
375
403
|
type CheckpointMeta = {
|
|
376
|
-
|
|
404
|
+
checkpointKey: string;
|
|
377
405
|
schemaVersion: number;
|
|
378
406
|
savedAt: number;
|
|
379
407
|
currentNode?: string;
|
|
@@ -387,13 +415,13 @@ type CheckpointListFilter = {
|
|
|
387
415
|
};
|
|
388
416
|
type CheckpointSummary = CheckpointMeta;
|
|
389
417
|
interface Checkpointer {
|
|
390
|
-
load(
|
|
391
|
-
save(
|
|
392
|
-
clear(
|
|
393
|
-
peekMeta?(
|
|
418
|
+
load(checkpointKey: string): Promise<EngineState | null>;
|
|
419
|
+
save(checkpointKey: string, state: EngineState): Promise<void>;
|
|
420
|
+
clear(checkpointKey: string): Promise<void>;
|
|
421
|
+
peekMeta?(checkpointKey: string): Promise<CheckpointMeta | null>;
|
|
394
422
|
list?(filter?: CheckpointListFilter): Promise<CheckpointSummary[]>;
|
|
395
423
|
}
|
|
396
|
-
declare function summarizeCheckpoint(
|
|
424
|
+
declare function summarizeCheckpoint(checkpointKey: string, state: EngineState, savedAt: number): CheckpointSummary;
|
|
397
425
|
|
|
398
426
|
interface GraphExecutorConfig {
|
|
399
427
|
maxSteps?: number;
|
|
@@ -412,15 +440,16 @@ declare class GraphExecutor {
|
|
|
412
440
|
private readonly telemetryPort;
|
|
413
441
|
constructor(checkpointer: Checkpointer, config?: GraphExecutorConfig);
|
|
414
442
|
registerNode(node: GraphNode): void;
|
|
415
|
-
peekCheckpoint(
|
|
443
|
+
peekCheckpoint(checkpointKey: string): Promise<EngineState | null>;
|
|
416
444
|
private sanitize;
|
|
417
|
-
prime(
|
|
418
|
-
setNode(
|
|
419
|
-
runUntilYield(
|
|
445
|
+
prime(checkpointKey: string, local: Record<string, unknown>, nodeId?: string): Promise<void>;
|
|
446
|
+
setNode(checkpointKey: string, nodeId: string, localPatch?: Record<string, unknown>): Promise<void>;
|
|
447
|
+
runUntilYield(checkpointKey: string): Promise<{
|
|
420
448
|
events: RuntimeEvent[];
|
|
421
449
|
checkpoint: EngineState;
|
|
422
450
|
stepCount: number;
|
|
423
451
|
}>;
|
|
452
|
+
private loadInitialState;
|
|
424
453
|
private runUntilYieldInternal;
|
|
425
454
|
}
|
|
426
455
|
|
|
@@ -1,17 +1,33 @@
|
|
|
1
|
-
import { a as EventStore, P as PersistedEvent, E as EventRangeOptions, m as RunRegistryStore, l as RunRecord, L as ListRunsFilter, n as RunRequestSnapshot, b as EventBus, f as RunCostCollector, h as RunHandle, k as RunObserveFilter, C as CancelOpts,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { A as AgentAiEngine, b as AuditPort } from './audit-
|
|
5
|
-
import { A as AgentInvocationRequest } from './agent-invocation-
|
|
1
|
+
import { a as EventStore, P as PersistedEvent, E as EventRangeOptions, m as RunRegistryStore, l as RunRecord, L as ListRunsFilter, n as RunRequestSnapshot, b as EventBus, f as RunCostCollector, h as RunHandle, k as RunObserveFilter, C as CancelOpts, e as RunAwaitingUserPatch, j as RunMeta } from './runHandle-o3p06Nva.js';
|
|
2
|
+
import { L as LlmUsageTokenLedgerEntry, C as ContextTokenComponent, w as ContextComponentTokenLedgerEntry, e as AgentSpecSystemReminderPolicy, u as AgentSpecToolObservationGovernancePolicy, f as AgentSpec } from './token-accounting-CwpSPg4y.js';
|
|
3
|
+
import { R as RuntimeEvent } from './todo-Ca8llpRQ.js';
|
|
4
|
+
import { A as AgentAiEngine, b as AuditPort } from './audit-BuWHoMEr.js';
|
|
5
|
+
import { A as AgentInvocationRequest } from './agent-invocation-DKoEDLkl.js';
|
|
6
6
|
import { A as AnyAgentEvent } from './agentEvents-DEB7Fy_J.js';
|
|
7
|
-
import { T as ToolCall, c as LlmRetryConfig, a as LlmRequestMessage, L as LlmCallOptions, e as ToolCallExtraContent } from './ai-engine.types-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { T as ToolCall, c as LlmRetryConfig, a as LlmRequestMessage, L as LlmCallOptions, e as ToolCallExtraContent } from './ai-engine.types-LqmnfR2W.js';
|
|
8
|
+
import { C as CanonicalLlmUsage } from './token-usage-CqwT7-5K.js';
|
|
9
|
+
import { a as ToolExecutionContext } from './toolContracts-f8lzZBNa.js';
|
|
10
|
+
import { h as ToolRuntimePort, O as ObservationPreviewPort } from './ports-fhp84x_C.js';
|
|
11
|
+
import { C as ContextBuildTokenEstimate } from './token-calibration-Cxv6dDYF.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @file src/agent/shared/llmTelemetryContext.ts
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* LLM Telemetry 上下文(用于审计/统计,不进入模型上下文,不落库到 EventStore)。
|
|
18
|
+
*
|
|
19
|
+
* 中文备注(设计约束):
|
|
20
|
+
* - 某些“多阶段/多子任务”的审计需要一个可聚合的数据源;
|
|
21
|
+
* - 这些数据不适合塞进 RuntimeEvent(会污染主时间轴、跨端联动成本高);
|
|
22
|
+
* - 因此这里用 AsyncLocalStorage 提供“同一条异步链路内可写入/可聚合”的基础设施;
|
|
23
|
+
* - 默认不启用:只有当业务侧显式用 `withLLMTelemetryContext(...)` 包裹执行链路时才会收集。
|
|
24
|
+
*/
|
|
10
25
|
|
|
11
26
|
type NormalizedLlmUsage = {
|
|
12
27
|
promptTokens: number;
|
|
13
28
|
completionTokens: number;
|
|
14
29
|
totalTokens: number;
|
|
30
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
15
31
|
};
|
|
16
32
|
type LLMTelemetryContext = {
|
|
17
33
|
/**
|
|
@@ -35,13 +51,14 @@ type LlmCallTelemetry = {
|
|
|
35
51
|
startedAt: number;
|
|
36
52
|
durationMs: number;
|
|
37
53
|
usage?: NormalizedLlmUsage;
|
|
54
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
38
55
|
};
|
|
39
56
|
declare function withLLMTelemetryContext<T>(ctx: LLMTelemetryContext, fn: () => Promise<T>): Promise<{
|
|
40
57
|
value: T;
|
|
41
58
|
calls: LlmCallTelemetry[];
|
|
42
59
|
}>;
|
|
43
60
|
|
|
44
|
-
declare const TELEMETRY_EVENT_KINDS: readonly ["llm_call", "tool_call", "graph_node", "run_lifecycle"];
|
|
61
|
+
declare const TELEMETRY_EVENT_KINDS: readonly ["llm_call", "tool_call", "context_build", "graph_node", "run_lifecycle"];
|
|
45
62
|
type TelemetryEventKind = (typeof TELEMETRY_EVENT_KINDS)[number];
|
|
46
63
|
|
|
47
64
|
type TelemetryScope = {
|
|
@@ -57,6 +74,8 @@ type TelemetryEvent = {
|
|
|
57
74
|
stream: boolean;
|
|
58
75
|
durationMs: number;
|
|
59
76
|
usage?: NormalizedLlmUsage;
|
|
77
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
78
|
+
tokenLedgerEntry?: LlmUsageTokenLedgerEntry;
|
|
60
79
|
scope: TelemetryScope;
|
|
61
80
|
} | {
|
|
62
81
|
kind: Extract<TelemetryEventKind, 'tool_call'>;
|
|
@@ -65,6 +84,14 @@ type TelemetryEvent = {
|
|
|
65
84
|
ok: boolean;
|
|
66
85
|
errorCode?: string;
|
|
67
86
|
scope: TelemetryScope;
|
|
87
|
+
} | {
|
|
88
|
+
kind: Extract<TelemetryEventKind, 'context_build'>;
|
|
89
|
+
modelId: string;
|
|
90
|
+
mode: 'agent' | 'chat';
|
|
91
|
+
tokenEstimate: ContextBuildTokenEstimate;
|
|
92
|
+
tokenComponents?: ContextTokenComponent[];
|
|
93
|
+
tokenLedgerEntry?: ContextComponentTokenLedgerEntry;
|
|
94
|
+
scope: TelemetryScope;
|
|
68
95
|
} | {
|
|
69
96
|
kind: Extract<TelemetryEventKind, 'graph_node'>;
|
|
70
97
|
nodeId: string;
|
|
@@ -227,6 +254,7 @@ type LlmCallResult = string | {
|
|
|
227
254
|
tool_calls?: ToolCall[];
|
|
228
255
|
reasoning_details?: unknown[];
|
|
229
256
|
usage?: unknown;
|
|
257
|
+
canonicalUsage?: CanonicalLlmUsage;
|
|
230
258
|
};
|
|
231
259
|
|
|
232
260
|
/**
|
|
@@ -373,7 +401,7 @@ interface StandardToolCall {
|
|
|
373
401
|
*/
|
|
374
402
|
|
|
375
403
|
type CheckpointMeta = {
|
|
376
|
-
|
|
404
|
+
checkpointKey: string;
|
|
377
405
|
schemaVersion: number;
|
|
378
406
|
savedAt: number;
|
|
379
407
|
currentNode?: string;
|
|
@@ -387,13 +415,13 @@ type CheckpointListFilter = {
|
|
|
387
415
|
};
|
|
388
416
|
type CheckpointSummary = CheckpointMeta;
|
|
389
417
|
interface Checkpointer {
|
|
390
|
-
load(
|
|
391
|
-
save(
|
|
392
|
-
clear(
|
|
393
|
-
peekMeta?(
|
|
418
|
+
load(checkpointKey: string): Promise<EngineState | null>;
|
|
419
|
+
save(checkpointKey: string, state: EngineState): Promise<void>;
|
|
420
|
+
clear(checkpointKey: string): Promise<void>;
|
|
421
|
+
peekMeta?(checkpointKey: string): Promise<CheckpointMeta | null>;
|
|
394
422
|
list?(filter?: CheckpointListFilter): Promise<CheckpointSummary[]>;
|
|
395
423
|
}
|
|
396
|
-
declare function summarizeCheckpoint(
|
|
424
|
+
declare function summarizeCheckpoint(checkpointKey: string, state: EngineState, savedAt: number): CheckpointSummary;
|
|
397
425
|
|
|
398
426
|
interface GraphExecutorConfig {
|
|
399
427
|
maxSteps?: number;
|
|
@@ -412,15 +440,16 @@ declare class GraphExecutor {
|
|
|
412
440
|
private readonly telemetryPort;
|
|
413
441
|
constructor(checkpointer: Checkpointer, config?: GraphExecutorConfig);
|
|
414
442
|
registerNode(node: GraphNode): void;
|
|
415
|
-
peekCheckpoint(
|
|
443
|
+
peekCheckpoint(checkpointKey: string): Promise<EngineState | null>;
|
|
416
444
|
private sanitize;
|
|
417
|
-
prime(
|
|
418
|
-
setNode(
|
|
419
|
-
runUntilYield(
|
|
445
|
+
prime(checkpointKey: string, local: Record<string, unknown>, nodeId?: string): Promise<void>;
|
|
446
|
+
setNode(checkpointKey: string, nodeId: string, localPatch?: Record<string, unknown>): Promise<void>;
|
|
447
|
+
runUntilYield(checkpointKey: string): Promise<{
|
|
420
448
|
events: RuntimeEvent[];
|
|
421
449
|
checkpoint: EngineState;
|
|
422
450
|
stepCount: number;
|
|
423
451
|
}>;
|
|
452
|
+
private loadInitialState;
|
|
424
453
|
private runUntilYieldInternal;
|
|
425
454
|
}
|
|
426
455
|
|