@linnlabs/linnkit 0.46.0 → 0.47.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 +29 -0
- package/dist/cli.cjs +64 -246
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +64 -246
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +7 -7
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js +7 -7
- package/dist/context-manager.js.map +1 -1
- package/dist/index.cjs +74 -257
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +74 -257
- package/dist/index.js.map +1 -1
- package/dist/ports/llm-call.d.cts +2 -16
- package/dist/ports/llm-call.d.ts +2 -16
- package/dist/quickstart.cjs +64 -246
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +64 -246
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/graph-engine/executor.d.cts +0 -2
- package/dist/runtime-kernel/graph-engine/executor.d.ts +0 -2
- package/dist/runtime-kernel/graph-engine/types.d.cts +1 -2
- package/dist/runtime-kernel/graph-engine/types.d.ts +1 -2
- package/dist/runtime-kernel/llm/definitions/llmFallbackObserver.d.cts +1 -2
- package/dist/runtime-kernel/llm/definitions/llmFallbackObserver.d.ts +1 -2
- package/dist/runtime-kernel/llm/modelCatalog.d.cts +2 -3
- package/dist/runtime-kernel/llm/modelCatalog.d.ts +2 -3
- package/dist/runtime-kernel/tools/toolContextRuntime.d.cts +1 -1
- package/dist/runtime-kernel/tools/toolContextRuntime.d.ts +1 -1
- package/dist/runtime-kernel/tools/toolExecutionContext.d.cts +0 -10
- package/dist/runtime-kernel/tools/toolExecutionContext.d.ts +0 -10
- package/dist/runtime-kernel.cjs +74 -257
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +74 -257
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +82 -265
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +82 -265
- package/dist/testkit.js.map +1 -1
- package/docs/integration/llm-provider.md +1 -1
- package/docs/integration/tool-development-guide.md +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,6 @@ export { AgentStepDecision } from './tick-pipeline/types.cjs';
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
interface GraphAgentExecutorOptions {
|
|
21
|
-
cloudQuotaFallbackModelId?: string;
|
|
22
21
|
modelCatalog?: ModelCatalogLike;
|
|
23
22
|
modelResolver?: Pick<ModelResolverLike, 'resolveModelId'>;
|
|
24
23
|
}
|
|
@@ -43,7 +42,6 @@ declare class GraphAgentExecutor {
|
|
|
43
42
|
private readonly llmCaller;
|
|
44
43
|
private readonly toolRuntime;
|
|
45
44
|
private readonly contextBuilder;
|
|
46
|
-
private readonly cloudQuotaFallbackModelId?;
|
|
47
45
|
private readonly modelResolver;
|
|
48
46
|
private readonly modelCatalog;
|
|
49
47
|
private readonly telemetryPort;
|
|
@@ -18,7 +18,6 @@ export { AgentStepDecision } from './tick-pipeline/types.js';
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
interface GraphAgentExecutorOptions {
|
|
21
|
-
cloudQuotaFallbackModelId?: string;
|
|
22
21
|
modelCatalog?: ModelCatalogLike;
|
|
23
22
|
modelResolver?: Pick<ModelResolverLike, 'resolveModelId'>;
|
|
24
23
|
}
|
|
@@ -43,7 +42,6 @@ declare class GraphAgentExecutor {
|
|
|
43
42
|
private readonly llmCaller;
|
|
44
43
|
private readonly toolRuntime;
|
|
45
44
|
private readonly contextBuilder;
|
|
46
|
-
private readonly cloudQuotaFallbackModelId?;
|
|
47
45
|
private readonly modelResolver;
|
|
48
46
|
private readonly modelCatalog;
|
|
49
47
|
private readonly telemetryPort;
|
|
@@ -20,7 +20,6 @@ interface ExecutorLocalState {
|
|
|
20
20
|
lastStepsHintThreshold?: number;
|
|
21
21
|
systemReminderPolicy?: AgentSpecSystemReminderPolicy;
|
|
22
22
|
toolObservationPolicy?: AgentSpecToolObservationGovernancePolicy;
|
|
23
|
-
runLockedModelId?: string;
|
|
24
23
|
/**
|
|
25
24
|
* 当前这一次 LLM 调用的业务来源。
|
|
26
25
|
*
|
|
@@ -53,7 +52,7 @@ interface ExecutorLocalState {
|
|
|
53
52
|
lastCommittedFingerprint?: string;
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
|
-
type ExecutorLocalPatch = Partial<Pick<ExecutorLocalState, '
|
|
55
|
+
type ExecutorLocalPatch = Partial<Pick<ExecutorLocalState, 'contextCompaction'>>;
|
|
57
56
|
interface EngineLocalState extends Record<string, unknown> {
|
|
58
57
|
runId?: RunId;
|
|
59
58
|
parentRunId?: RunId;
|
|
@@ -20,7 +20,6 @@ interface ExecutorLocalState {
|
|
|
20
20
|
lastStepsHintThreshold?: number;
|
|
21
21
|
systemReminderPolicy?: AgentSpecSystemReminderPolicy;
|
|
22
22
|
toolObservationPolicy?: AgentSpecToolObservationGovernancePolicy;
|
|
23
|
-
runLockedModelId?: string;
|
|
24
23
|
/**
|
|
25
24
|
* 当前这一次 LLM 调用的业务来源。
|
|
26
25
|
*
|
|
@@ -53,7 +52,7 @@ interface ExecutorLocalState {
|
|
|
53
52
|
lastCommittedFingerprint?: string;
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
|
-
type ExecutorLocalPatch = Partial<Pick<ExecutorLocalState, '
|
|
55
|
+
type ExecutorLocalPatch = Partial<Pick<ExecutorLocalState, 'contextCompaction'>>;
|
|
57
56
|
interface EngineLocalState extends Record<string, unknown> {
|
|
58
57
|
runId?: RunId;
|
|
59
58
|
parentRunId?: RunId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModelInputPlacement } from '../input-capabilities/definitions/modelInputCapability.cjs';
|
|
2
2
|
import { ContextUsageSnapshot } from '../../../contracts/token-usage.cjs';
|
|
3
3
|
|
|
4
|
-
type ModelFallbackPolicy = 'policy-switch'
|
|
4
|
+
type ModelFallbackPolicy = 'policy-switch';
|
|
5
5
|
interface ModelFallbackAppliedInfo {
|
|
6
6
|
readonly fromModelId: string;
|
|
7
7
|
readonly toModelId: string;
|
|
@@ -18,7 +18,6 @@ interface ModelFallbackRejectedInfo {
|
|
|
18
18
|
interface LlmFallbackObserver {
|
|
19
19
|
/** 每次调用只在最终真实 provider attempt 成功后触发一次。 */
|
|
20
20
|
readonly onLlmAttemptSucceeded?: (activeModelId: string, contextUsage?: ContextUsageSnapshot) => void;
|
|
21
|
-
readonly onCloudQuotaFallbackApplied?: (fallbackModelId: string) => void;
|
|
22
21
|
readonly onModelFallbackApplied?: (info: ModelFallbackAppliedInfo) => void;
|
|
23
22
|
readonly onModelFallbackRejected?: (info: ModelFallbackRejectedInfo) => void;
|
|
24
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModelInputPlacement } from '../input-capabilities/definitions/modelInputCapability.js';
|
|
2
2
|
import { ContextUsageSnapshot } from '../../../contracts/token-usage.js';
|
|
3
3
|
|
|
4
|
-
type ModelFallbackPolicy = 'policy-switch'
|
|
4
|
+
type ModelFallbackPolicy = 'policy-switch';
|
|
5
5
|
interface ModelFallbackAppliedInfo {
|
|
6
6
|
readonly fromModelId: string;
|
|
7
7
|
readonly toModelId: string;
|
|
@@ -18,7 +18,6 @@ interface ModelFallbackRejectedInfo {
|
|
|
18
18
|
interface LlmFallbackObserver {
|
|
19
19
|
/** 每次调用只在最终真实 provider attempt 成功后触发一次。 */
|
|
20
20
|
readonly onLlmAttemptSucceeded?: (activeModelId: string, contextUsage?: ContextUsageSnapshot) => void;
|
|
21
|
-
readonly onCloudQuotaFallbackApplied?: (fallbackModelId: string) => void;
|
|
22
21
|
readonly onModelFallbackApplied?: (info: ModelFallbackAppliedInfo) => void;
|
|
23
22
|
readonly onModelFallbackRejected?: (info: ModelFallbackRejectedInfo) => void;
|
|
24
23
|
}
|
|
@@ -14,13 +14,12 @@ interface ModelCatalogEntry {
|
|
|
14
14
|
id: string;
|
|
15
15
|
enabled?: boolean;
|
|
16
16
|
api_key?: string;
|
|
17
|
-
billing_mode?: 'byok' | 'cloud';
|
|
18
17
|
/**
|
|
19
18
|
* 是否允许客户端侧重试。
|
|
20
19
|
*
|
|
21
20
|
* 说明:
|
|
22
|
-
* -
|
|
23
|
-
* -
|
|
21
|
+
* - 每次请求都会单独计费、或由服务端自行重试的模型,Host 应设为 false;
|
|
22
|
+
* - 计费方式等产品概念由 Host 自己换算成这个开关,runtime-kernel 不解释。
|
|
24
23
|
*/
|
|
25
24
|
enable_client_retry?: boolean;
|
|
26
25
|
model_name?: string;
|
|
@@ -14,13 +14,12 @@ interface ModelCatalogEntry {
|
|
|
14
14
|
id: string;
|
|
15
15
|
enabled?: boolean;
|
|
16
16
|
api_key?: string;
|
|
17
|
-
billing_mode?: 'byok' | 'cloud';
|
|
18
17
|
/**
|
|
19
18
|
* 是否允许客户端侧重试。
|
|
20
19
|
*
|
|
21
20
|
* 说明:
|
|
22
|
-
* -
|
|
23
|
-
* -
|
|
21
|
+
* - 每次请求都会单独计费、或由服务端自行重试的模型,Host 应设为 false;
|
|
22
|
+
* - 计费方式等产品概念由 Host 自己换算成这个开关,runtime-kernel 不解释。
|
|
24
23
|
*/
|
|
25
24
|
enable_client_retry?: boolean;
|
|
26
25
|
model_name?: string;
|
|
@@ -20,7 +20,7 @@ interface ToolContextRuntimeBinding {
|
|
|
20
20
|
bindExecutionMeta(meta: ToolContextExecutionMeta): void;
|
|
21
21
|
readExecutionMeta(): Readonly<ToolContextExecutionMeta>;
|
|
22
22
|
}
|
|
23
|
-
declare const TOOL_CONTEXT_RUNTIME_RESERVED_KEYS: readonly ["conversationView", "userQuery", "modelId", "
|
|
23
|
+
declare const TOOL_CONTEXT_RUNTIME_RESERVED_KEYS: readonly ["conversationView", "userQuery", "modelId", "conversationId", "turnId", "runId", "parentRunId", "childRunDepth", "childRunContextInjections", "parentToolCallId"];
|
|
24
24
|
declare function ensureToolContextRuntimeCapability(params: {
|
|
25
25
|
context: ToolExecutionContext;
|
|
26
26
|
persistedHistory?: ReadonlyArray<RuntimeEvent> | RuntimeEventSource;
|
|
@@ -20,7 +20,7 @@ interface ToolContextRuntimeBinding {
|
|
|
20
20
|
bindExecutionMeta(meta: ToolContextExecutionMeta): void;
|
|
21
21
|
readExecutionMeta(): Readonly<ToolContextExecutionMeta>;
|
|
22
22
|
}
|
|
23
|
-
declare const TOOL_CONTEXT_RUNTIME_RESERVED_KEYS: readonly ["conversationView", "userQuery", "modelId", "
|
|
23
|
+
declare const TOOL_CONTEXT_RUNTIME_RESERVED_KEYS: readonly ["conversationView", "userQuery", "modelId", "conversationId", "turnId", "runId", "parentRunId", "childRunDepth", "childRunContextInjections", "parentToolCallId"];
|
|
24
24
|
declare function ensureToolContextRuntimeCapability(params: {
|
|
25
25
|
context: ToolExecutionContext;
|
|
26
26
|
persistedHistory?: ReadonlyArray<RuntimeEvent> | RuntimeEventSource;
|
|
@@ -17,16 +17,6 @@ interface ToolExecutionContext {
|
|
|
17
17
|
userQuery?: string;
|
|
18
18
|
/** 当前 run 已选定的模型 ID;需要继承模型的 child-run 从这里读取。 */
|
|
19
19
|
modelId?: string;
|
|
20
|
-
/**
|
|
21
|
-
* 工具结果接下来交给的模型 ID(由 ToolNode 在执行工具前注入)。
|
|
22
|
-
*
|
|
23
|
-
* 中文备注:
|
|
24
|
-
* - 平时等于 `modelId`;云端额度兜底后 run 锁定到兜底模型,此时是兜底模型;
|
|
25
|
-
* - 决定工具结果里放什么给模型看(如是否附图)时按它判断,不能按 `modelId`,
|
|
26
|
-
* 否则会给不能看图的兜底模型附图,下一次请求在输入预检被拒;
|
|
27
|
-
* - child-run 继承模型仍读 `modelId`。
|
|
28
|
-
*/
|
|
29
|
-
activeModelId?: string;
|
|
30
20
|
/**
|
|
31
21
|
* 当前对话 run 的唯一标识(由 host admission 注入)。
|
|
32
22
|
* 说明:工具不得把 runId 当作业务数据身份;它只服务运行链路追踪和关联。
|
|
@@ -17,16 +17,6 @@ interface ToolExecutionContext {
|
|
|
17
17
|
userQuery?: string;
|
|
18
18
|
/** 当前 run 已选定的模型 ID;需要继承模型的 child-run 从这里读取。 */
|
|
19
19
|
modelId?: string;
|
|
20
|
-
/**
|
|
21
|
-
* 工具结果接下来交给的模型 ID(由 ToolNode 在执行工具前注入)。
|
|
22
|
-
*
|
|
23
|
-
* 中文备注:
|
|
24
|
-
* - 平时等于 `modelId`;云端额度兜底后 run 锁定到兜底模型,此时是兜底模型;
|
|
25
|
-
* - 决定工具结果里放什么给模型看(如是否附图)时按它判断,不能按 `modelId`,
|
|
26
|
-
* 否则会给不能看图的兜底模型附图,下一次请求在输入预检被拒;
|
|
27
|
-
* - child-run 继承模型仍读 `modelId`。
|
|
28
|
-
*/
|
|
29
|
-
activeModelId?: string;
|
|
30
20
|
/**
|
|
31
21
|
* 当前对话 run 的唯一标识(由 host admission 注入)。
|
|
32
22
|
* 说明:工具不得把 runId 当作业务数据身份;它只服务运行链路追踪和关联。
|