@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,8 +1,8 @@
|
|
|
1
|
-
export { C as ConversationMemoryPort, E as EventMappingContext, R as RuntimeEventLifecycleDecision, d as describeRuntimeEventLifecycle, e as eventMapper, g as getRuntimeEventUiProjectionKind, a as isCheckpointHistorySummaryEvent, b as isToolCallDecisionEvent, s as shouldEmitRuntimeEventToSse, c as shouldEnterAgentContext, f as shouldPersistRuntimeEvent, h as shouldReplayRuntimeEventToUi } from '../index-
|
|
1
|
+
export { C as ConversationMemoryPort, E as EventMappingContext, R as RuntimeEventLifecycleDecision, d as describeRuntimeEventLifecycle, e as eventMapper, g as getRuntimeEventUiProjectionKind, a as isCheckpointHistorySummaryEvent, b as isToolCallDecisionEvent, s as shouldEmitRuntimeEventToSse, c as shouldEnterAgentContext, f as shouldPersistRuntimeEvent, h as shouldReplayRuntimeEventToUi } from '../index-wXVAHZ0D.cjs';
|
|
2
2
|
export { A as AnyAgentEvent } from '../agentEvents-DEB7Fy_J.cjs';
|
|
3
3
|
import 'zod';
|
|
4
|
-
import '../todo-
|
|
5
|
-
import '../messages-
|
|
6
|
-
import '../ports-
|
|
7
|
-
import '../toolContracts-
|
|
4
|
+
import '../todo-Ca8llpRQ.cjs';
|
|
5
|
+
import '../messages-Br5SiLD3.cjs';
|
|
6
|
+
import '../ports-Dugizzje.cjs';
|
|
7
|
+
import '../toolContracts-Bm3EZ1UM.cjs';
|
|
8
8
|
import '../sse-vPyrOPa0.cjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { C as ConversationMemoryPort, E as EventMappingContext, R as RuntimeEventLifecycleDecision, d as describeRuntimeEventLifecycle, e as eventMapper, g as getRuntimeEventUiProjectionKind, a as isCheckpointHistorySummaryEvent, b as isToolCallDecisionEvent, s as shouldEmitRuntimeEventToSse, c as shouldEnterAgentContext, f as shouldPersistRuntimeEvent, h as shouldReplayRuntimeEventToUi } from '../index-
|
|
1
|
+
export { C as ConversationMemoryPort, E as EventMappingContext, R as RuntimeEventLifecycleDecision, d as describeRuntimeEventLifecycle, e as eventMapper, g as getRuntimeEventUiProjectionKind, a as isCheckpointHistorySummaryEvent, b as isToolCallDecisionEvent, s as shouldEmitRuntimeEventToSse, c as shouldEnterAgentContext, f as shouldPersistRuntimeEvent, h as shouldReplayRuntimeEventToUi } from '../index-DWGKvssS.js';
|
|
2
2
|
export { A as AnyAgentEvent } from '../agentEvents-DEB7Fy_J.js';
|
|
3
3
|
import 'zod';
|
|
4
|
-
import '../todo-
|
|
5
|
-
import '../messages-
|
|
6
|
-
import '../ports-
|
|
7
|
-
import '../toolContracts-
|
|
4
|
+
import '../todo-Ca8llpRQ.js';
|
|
5
|
+
import '../messages-Br5SiLD3.js';
|
|
6
|
+
import '../ports-fhp84x_C.js';
|
|
7
|
+
import '../toolContracts-f8lzZBNa.js';
|
|
8
8
|
import '../sse-vPyrOPa0.js';
|
|
@@ -56,6 +56,12 @@ z.object({
|
|
|
56
56
|
args: z.record(z.unknown()).optional(),
|
|
57
57
|
tool_call_id: z.string()
|
|
58
58
|
});
|
|
59
|
+
var ObservationTruncationMeta = z.object({
|
|
60
|
+
originalChars: z.number().int().nonnegative(),
|
|
61
|
+
previewChars: z.number().int().nonnegative(),
|
|
62
|
+
originalLines: z.number().int().nonnegative().optional(),
|
|
63
|
+
previewLines: z.number().int().nonnegative().optional()
|
|
64
|
+
});
|
|
59
65
|
var ImageInfoMeta = z.object({
|
|
60
66
|
url: z.string().optional(),
|
|
61
67
|
width: z.number().int().positive().optional(),
|
|
@@ -87,6 +93,7 @@ var PersistentMetadata = z.object({
|
|
|
87
93
|
tool_name: z.string().optional(),
|
|
88
94
|
args: z.record(z.unknown()).optional(),
|
|
89
95
|
tool_call_id: z.string().optional(),
|
|
96
|
+
observationTruncation: ObservationTruncationMeta.optional(),
|
|
90
97
|
raw_output: z.string().optional(),
|
|
91
98
|
image_info: ImageInfoMeta.optional(),
|
|
92
99
|
taskType: z.string().optional(),
|
|
@@ -180,6 +187,7 @@ var AgentSpecBudgetPolicy = z.object({
|
|
|
180
187
|
});
|
|
181
188
|
var AgentSpecToolHistoryPolicy = z.object({
|
|
182
189
|
strategy: z.enum(["per-pair", "per-run", "none"]).optional(),
|
|
190
|
+
retentionMode: z.enum(["drop", "compress"]).optional(),
|
|
183
191
|
keepLatestToolPairs: z.number().int().nonnegative().optional(),
|
|
184
192
|
keepLatestRuns: z.number().int().nonnegative().optional(),
|
|
185
193
|
maxInteractionGroups: z.number().int().nonnegative().optional(),
|
|
@@ -232,7 +240,17 @@ var AgentSpecReasoningRetentionPolicy = z.object({
|
|
|
232
240
|
var AgentSpecTokenEstimationPolicy = z.object({
|
|
233
241
|
encoding: z.string().min(1).optional(),
|
|
234
242
|
avgCharsPerToken: z.number().positive().optional(),
|
|
235
|
-
toolCallOverhead: z.number().int().nonnegative().optional()
|
|
243
|
+
toolCallOverhead: z.number().int().nonnegative().optional(),
|
|
244
|
+
calibration: z.object({
|
|
245
|
+
enabled: z.boolean().optional(),
|
|
246
|
+
minSamples: z.number().int().positive().optional(),
|
|
247
|
+
minCoefficient: z.number().positive().optional(),
|
|
248
|
+
maxCoefficient: z.number().positive().optional()
|
|
249
|
+
}).optional(),
|
|
250
|
+
remoteCount: z.object({
|
|
251
|
+
enabled: z.boolean().optional(),
|
|
252
|
+
failureBehavior: z.enum(["use-local-estimate", "fail-fast"]).optional()
|
|
253
|
+
}).optional()
|
|
236
254
|
});
|
|
237
255
|
var AgentSpecSystemReminderTrigger = z.object({
|
|
238
256
|
kind: z.string().min(1),
|
|
@@ -888,6 +906,189 @@ var createSSEErrorEvent = (id, conversationId, turnId, error, options = {}) => (
|
|
|
888
906
|
error,
|
|
889
907
|
...options
|
|
890
908
|
});
|
|
909
|
+
var TokenCountSource = z.enum([
|
|
910
|
+
"local-estimate",
|
|
911
|
+
"provider-preflight-count",
|
|
912
|
+
"provider-response-usage",
|
|
913
|
+
"host-supplied",
|
|
914
|
+
"test-fixture"
|
|
915
|
+
]);
|
|
916
|
+
var TokenCountConfidence = z.enum([
|
|
917
|
+
"estimate",
|
|
918
|
+
"provider-estimate",
|
|
919
|
+
"actual"
|
|
920
|
+
]);
|
|
921
|
+
var TokenRouteCapabilities = z.object({
|
|
922
|
+
supportsRemoteTokenCount: z.boolean().optional(),
|
|
923
|
+
supportsResponseUsage: z.boolean().optional(),
|
|
924
|
+
supportsImageInput: z.boolean().optional(),
|
|
925
|
+
supportsCachedInputBilling: z.boolean().optional(),
|
|
926
|
+
supportsReasoningTokens: z.boolean().optional()
|
|
927
|
+
});
|
|
928
|
+
var TokenRoute = z.object({
|
|
929
|
+
providerId: z.string().describe("host \u4FA7 provider \u6807\u8BC6\uFF1Aopenai / anthropic / openrouter / siliconflow / zai ..."),
|
|
930
|
+
baseURL: z.string().optional().describe("\u4E2D\u8F6C\u5E73\u53F0\u6216\u79C1\u6709 endpoint\uFF1B\u7528\u4E8E\u533A\u5206\u540C\u540D\u6A21\u578B\u7684\u4E0D\u540C route"),
|
|
931
|
+
modelId: z.string().describe("host \u4FA7\u6A21\u578B id"),
|
|
932
|
+
providerModelId: z.string().optional().describe("provider \u5B9E\u9645\u6A21\u578B\u540D\uFF08\u4E0E host modelId \u53EF\u80FD\u4E0D\u540C\uFF09"),
|
|
933
|
+
capabilities: TokenRouteCapabilities.optional()
|
|
934
|
+
});
|
|
935
|
+
var tokenCount = z.number().int().nonnegative();
|
|
936
|
+
var CanonicalLlmUsage = z.object({
|
|
937
|
+
inputTokens: tokenCount.describe("\u975E\u7F13\u5B58\u666E\u901A\u8F93\u5165 token"),
|
|
938
|
+
outputTokens: tokenCount.describe("\u8F93\u51FA token"),
|
|
939
|
+
reasoningTokens: tokenCount.optional().describe("\u63A8\u7406 token\uFF1Bundefined=\u672A\u5355\u5217\uFF0C0=\u62A5\u544A\u4E3A 0"),
|
|
940
|
+
cacheReadTokens: tokenCount.optional().describe("\u7F13\u5B58\u547D\u4E2D\u8BFB\u53D6 token"),
|
|
941
|
+
cacheWriteTokens: tokenCount.optional().describe("\u7F13\u5B58\u5199\u5165 token"),
|
|
942
|
+
totalTokens: tokenCount.optional().describe("provider \u62A5\u544A\u7684\u603B\u91CF\uFF1B\u53EF\u7F3A\u5931\uFF0C\u4E14\u4E0D\u4FDD\u8BC1\u7B49\u4E8E\u5404\u9879\u4E4B\u548C"),
|
|
943
|
+
source: TokenCountSource,
|
|
944
|
+
confidence: TokenCountConfidence,
|
|
945
|
+
rawUsage: z.unknown().optional().describe("\u539F\u59CB provider usage\uFF0C\u4EC5\u4F9B\u5BA1\u8BA1")
|
|
946
|
+
});
|
|
947
|
+
var tokenCount2 = z.number().int().nonnegative();
|
|
948
|
+
var tokenPrice = z.number().finite().nonnegative();
|
|
949
|
+
z.enum([
|
|
950
|
+
"llm-usage",
|
|
951
|
+
"context-component"
|
|
952
|
+
]);
|
|
953
|
+
var ContextTokenComponentKind = z.enum([
|
|
954
|
+
"system",
|
|
955
|
+
"user",
|
|
956
|
+
"assistant",
|
|
957
|
+
"tool",
|
|
958
|
+
"context-injection",
|
|
959
|
+
"history-summary",
|
|
960
|
+
"working-memory",
|
|
961
|
+
"fence",
|
|
962
|
+
"system-reminder",
|
|
963
|
+
"other"
|
|
964
|
+
]);
|
|
965
|
+
var TokenUsageTotals = z.object({
|
|
966
|
+
inputTokens: tokenCount2,
|
|
967
|
+
outputTokens: tokenCount2,
|
|
968
|
+
reasoningTokens: tokenCount2.optional(),
|
|
969
|
+
cacheReadTokens: tokenCount2.optional(),
|
|
970
|
+
cacheWriteTokens: tokenCount2.optional(),
|
|
971
|
+
totalTokens: tokenCount2.optional(),
|
|
972
|
+
usageCount: z.number().int().nonnegative()
|
|
973
|
+
});
|
|
974
|
+
var ContextTokenComponent = z.object({
|
|
975
|
+
componentId: z.string().min(1),
|
|
976
|
+
kind: ContextTokenComponentKind,
|
|
977
|
+
tokens: tokenCount2,
|
|
978
|
+
source: TokenCountSource,
|
|
979
|
+
confidence: TokenCountConfidence,
|
|
980
|
+
label: z.string().optional(),
|
|
981
|
+
messageId: z.string().optional(),
|
|
982
|
+
role: z.string().optional(),
|
|
983
|
+
action: z.string().optional(),
|
|
984
|
+
kept: z.boolean().optional(),
|
|
985
|
+
truncatedAtExecution: z.boolean().optional(),
|
|
986
|
+
originalTokensEstimate: tokenCount2.optional(),
|
|
987
|
+
droppedTokensEstimate: tokenCount2.optional()
|
|
988
|
+
});
|
|
989
|
+
var TokenLedgerEntryBase = z.object({
|
|
990
|
+
id: z.string().min(1),
|
|
991
|
+
runId: z.string().optional(),
|
|
992
|
+
parentRunId: z.string().optional(),
|
|
993
|
+
conversationId: z.string().optional(),
|
|
994
|
+
turnId: z.string().optional(),
|
|
995
|
+
stepId: z.string().optional(),
|
|
996
|
+
route: TokenRoute.optional(),
|
|
997
|
+
createdAt: z.number().int().nonnegative().optional()
|
|
998
|
+
});
|
|
999
|
+
var LlmUsageTokenLedgerEntry = TokenLedgerEntryBase.extend({
|
|
1000
|
+
kind: z.literal("llm-usage"),
|
|
1001
|
+
modelId: z.string().optional(),
|
|
1002
|
+
usage: CanonicalLlmUsage
|
|
1003
|
+
});
|
|
1004
|
+
var ContextComponentTokenLedgerEntry = TokenLedgerEntryBase.extend({
|
|
1005
|
+
kind: z.literal("context-component"),
|
|
1006
|
+
components: z.array(ContextTokenComponent),
|
|
1007
|
+
totalTokens: tokenCount2
|
|
1008
|
+
});
|
|
1009
|
+
z.discriminatedUnion("kind", [
|
|
1010
|
+
LlmUsageTokenLedgerEntry,
|
|
1011
|
+
ContextComponentTokenLedgerEntry
|
|
1012
|
+
]);
|
|
1013
|
+
var TokenLedgerAggregate = z.object({
|
|
1014
|
+
llmUsage: TokenUsageTotals.optional(),
|
|
1015
|
+
contextTokens: tokenCount2,
|
|
1016
|
+
entryCount: z.number().int().nonnegative(),
|
|
1017
|
+
llmCallCount: z.number().int().nonnegative(),
|
|
1018
|
+
contextComponentCount: z.number().int().nonnegative()
|
|
1019
|
+
});
|
|
1020
|
+
z.object({
|
|
1021
|
+
/**
|
|
1022
|
+
* 父 run 自己产生的 usage;子 run 必须放到 children,避免展示或计费时重复相加。
|
|
1023
|
+
*/
|
|
1024
|
+
own: TokenLedgerAggregate,
|
|
1025
|
+
children: TokenLedgerAggregate.optional()
|
|
1026
|
+
});
|
|
1027
|
+
var TokenCostComponent = z.enum([
|
|
1028
|
+
"input",
|
|
1029
|
+
"output",
|
|
1030
|
+
"reasoning",
|
|
1031
|
+
"cacheRead",
|
|
1032
|
+
"cacheWrite"
|
|
1033
|
+
]);
|
|
1034
|
+
z.object({
|
|
1035
|
+
currency: z.string().min(1),
|
|
1036
|
+
unit: z.literal("per_1m_tokens"),
|
|
1037
|
+
input: tokenPrice.optional(),
|
|
1038
|
+
output: tokenPrice.optional(),
|
|
1039
|
+
reasoning: tokenPrice.optional(),
|
|
1040
|
+
cacheRead: tokenPrice.optional(),
|
|
1041
|
+
cacheWrite: tokenPrice.optional()
|
|
1042
|
+
});
|
|
1043
|
+
z.object({
|
|
1044
|
+
status: z.enum(["computed", "unknown"]),
|
|
1045
|
+
currency: z.string().optional(),
|
|
1046
|
+
inputCost: tokenPrice.optional(),
|
|
1047
|
+
outputCost: tokenPrice.optional(),
|
|
1048
|
+
reasoningCost: tokenPrice.optional(),
|
|
1049
|
+
cacheReadCost: tokenPrice.optional(),
|
|
1050
|
+
cacheWriteCost: tokenPrice.optional(),
|
|
1051
|
+
totalCost: tokenPrice.optional(),
|
|
1052
|
+
missingPriceComponents: z.array(TokenCostComponent).optional()
|
|
1053
|
+
});
|
|
1054
|
+
var tokenCount3 = z.number().int().nonnegative();
|
|
1055
|
+
var actualCalibrationSource = z.enum([
|
|
1056
|
+
"provider-response-usage",
|
|
1057
|
+
"host-supplied",
|
|
1058
|
+
"test-fixture"
|
|
1059
|
+
]);
|
|
1060
|
+
z.object({
|
|
1061
|
+
route: TokenRoute,
|
|
1062
|
+
localEstimateTokens: tokenCount3,
|
|
1063
|
+
actualInputTokens: tokenCount3,
|
|
1064
|
+
source: actualCalibrationSource,
|
|
1065
|
+
confidence: z.literal("actual"),
|
|
1066
|
+
observedAt: z.number().int().nonnegative().optional(),
|
|
1067
|
+
runId: z.string().optional(),
|
|
1068
|
+
ledgerEntryId: z.string().optional()
|
|
1069
|
+
});
|
|
1070
|
+
z.object({
|
|
1071
|
+
enabled: z.boolean(),
|
|
1072
|
+
applied: z.boolean(),
|
|
1073
|
+
route: TokenRoute.optional(),
|
|
1074
|
+
sampleCount: z.number().int().nonnegative(),
|
|
1075
|
+
coefficient: z.number().positive().optional(),
|
|
1076
|
+
minSamples: z.number().int().positive().optional(),
|
|
1077
|
+
minCoefficient: z.number().positive().optional(),
|
|
1078
|
+
maxCoefficient: z.number().positive().optional(),
|
|
1079
|
+
localEstimateTokens: tokenCount3.optional(),
|
|
1080
|
+
calibratedEstimateTokens: tokenCount3.optional(),
|
|
1081
|
+
deltaTokens: z.number().int().optional(),
|
|
1082
|
+
sampleLedgerEntryIds: z.array(z.string()).optional()
|
|
1083
|
+
});
|
|
1084
|
+
z.object({
|
|
1085
|
+
route: TokenRoute.optional(),
|
|
1086
|
+
localEstimateTokens: tokenCount3,
|
|
1087
|
+
calibratedEstimateTokens: tokenCount3,
|
|
1088
|
+
finalTokens: tokenCount3,
|
|
1089
|
+
source: z.literal("local-estimate"),
|
|
1090
|
+
confidence: z.literal("estimate")
|
|
1091
|
+
});
|
|
891
1092
|
|
|
892
1093
|
// src/shared/ids.ts
|
|
893
1094
|
function isoRandomUUID() {
|