@linnlabs/linnkit 0.41.0 → 0.43.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 +45 -0
- package/dist/cli.cjs +17 -202
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +17 -202
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +0 -1
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js +0 -1
- package/dist/context-manager.js.map +1 -1
- package/dist/contracts/agentSpec.d.cts +5 -5
- package/dist/contracts/agentSpec.d.ts +5 -5
- package/dist/contracts/audit.d.cts +10 -10
- package/dist/contracts/audit.d.ts +10 -10
- package/dist/contracts/contextPolicy.d.cts +14 -14
- package/dist/contracts/contextPolicy.d.ts +14 -14
- package/dist/contracts/events.d.cts +117 -117
- package/dist/contracts/events.d.ts +117 -117
- package/dist/contracts/execution.d.cts +2 -2
- package/dist/contracts/execution.d.ts +2 -2
- package/dist/contracts/llm-retry.d.cts +2 -2
- package/dist/contracts/llm-retry.d.ts +2 -2
- package/dist/contracts/messages.d.cts +32 -32
- package/dist/contracts/messages.d.ts +32 -32
- package/dist/contracts/sse.d.cts +97 -97
- package/dist/contracts/sse.d.ts +97 -97
- package/dist/contracts/sub-run-trace-payload.d.cts +8 -8
- package/dist/contracts/sub-run-trace-payload.d.ts +8 -8
- package/dist/contracts/token-accounting.d.cts +12 -12
- package/dist/contracts/token-accounting.d.ts +12 -12
- package/dist/index.cjs +18 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -212
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +17 -202
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +17 -202
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/child-runs/childRunInvoker.d.cts +1 -3
- package/dist/runtime-kernel/child-runs/childRunInvoker.d.ts +1 -3
- package/dist/runtime-kernel/events/agentEvents.d.cts +2 -2
- package/dist/runtime-kernel/events/agentEvents.d.ts +2 -2
- package/dist/runtime-kernel/graph-engine/engine.d.cts +1 -0
- package/dist/runtime-kernel/graph-engine/engine.d.ts +1 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.cts +1 -3
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.ts +1 -3
- package/dist/runtime-kernel/testkit/defaultGraphExecutor.d.cts +1 -2
- package/dist/runtime-kernel/testkit/defaultGraphExecutor.d.ts +1 -2
- package/dist/runtime-kernel/testkit/graphLoopHarness.d.cts +1 -2
- package/dist/runtime-kernel/testkit/graphLoopHarness.d.ts +1 -2
- package/dist/runtime-kernel/tools/index.d.cts +1 -2
- package/dist/runtime-kernel/tools/index.d.ts +1 -2
- package/dist/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.d.cts +4 -3
- package/dist/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.d.ts +4 -3
- package/dist/runtime-kernel/tools/ports.d.cts +1 -28
- package/dist/runtime-kernel/tools/ports.d.ts +1 -28
- 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/toolContracts.d.cts +0 -6
- package/dist/runtime-kernel/tools/toolContracts.d.ts +0 -6
- package/dist/runtime-kernel/tools/toolExecutionContext.d.cts +0 -7
- package/dist/runtime-kernel/tools/toolExecutionContext.d.ts +0 -7
- package/dist/runtime-kernel.cjs +17 -207
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.d.cts +1 -2
- package/dist/runtime-kernel.d.ts +1 -2
- package/dist/runtime-kernel.js +17 -207
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit/agent-harness/scriptedInferenceHarness.d.cts +1 -1
- package/dist/testkit/agent-harness/scriptedInferenceHarness.d.ts +1 -1
- package/dist/testkit.cjs +17 -207
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +17 -207
- package/dist/testkit.js.map +1 -1
- package/docs/integration/tool-development-guide.md +8 -23
- package/docs/integration/tools.md +2 -5
- package/package.json +2 -2
- package/dist/runtime-kernel/tools/model-input/definitions/toolModelInputPolicy.d.cts +0 -17
- package/dist/runtime-kernel/tools/model-input/definitions/toolModelInputPolicy.d.ts +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## [0.43.0] - 2026-11-12
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- `GraphExecutor.resumeSession` now finishes the tool batch that an
|
|
20
|
+
interactive (`requireUser`) tool interrupted before returning to the model.
|
|
21
|
+
Previously a resume always went to `llm`, so calls queued after the
|
|
22
|
+
interactive tool in the same batch never ran. The batch was left with calls
|
|
23
|
+
that had no results, context building dropped the whole group — including
|
|
24
|
+
the user's answer — and the model asked the same question again.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Without `nodeId`, `resumeSession` starts at `tool` when the waiting
|
|
29
|
+
checkpoint still has pending tool calls, and at `llm` otherwise. Passing a
|
|
30
|
+
`nodeId` other than `tool` while calls are pending now throws. Hosts that
|
|
31
|
+
passed `nodeId: 'llm'` should drop it.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [0.42.0] - 2026-11-11
|
|
36
|
+
|
|
37
|
+
### Breaking
|
|
38
|
+
|
|
39
|
+
- Remove the tool model-input requirement protocol. `ToolRuntimeDefinition`
|
|
40
|
+
and `BaseTool` no longer accept `modelInputRequirement`,
|
|
41
|
+
`modelInputDelivery` or `resolveModelInputRequirement`;
|
|
42
|
+
`ToolExecutionContext.modelInputAdmission`, `ToolModelInputAdmission`,
|
|
43
|
+
`ToolModelInputDelivery` and `ToolModelInputCapabilityValidatorPort` are
|
|
44
|
+
gone, and `ToolNode`, `ChildRunInvoker` and the testkit no longer take a
|
|
45
|
+
`modelInputCapabilityValidator`. Whether a tool returns images is the
|
|
46
|
+
Host's decision: the caller may be a model or a Host-originated call with no
|
|
47
|
+
model, and only the Host knows which.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- `ToolNode` no longer checks the last successful model before running a tool
|
|
52
|
+
and no longer rejects Host-originated calls that have no model. Attachments a
|
|
53
|
+
tool declares are always passed to `ToolModelInputResolverPort`; cache hits
|
|
54
|
+
reuse the attachments resolved at the time.
|
|
55
|
+
- The LLM prepare stage exposes the tool schemas the Host provides without
|
|
56
|
+
filtering them by model image support or adding tool image requirements to
|
|
57
|
+
the request. The input preflight still validates images actually present in
|
|
58
|
+
the request against the active route.
|
|
59
|
+
|
|
15
60
|
## [0.41.0] - 2026-10-30
|
|
16
61
|
|
|
17
62
|
### Breaking
|
package/dist/cli.cjs
CHANGED
|
@@ -3105,6 +3105,16 @@ function mergeResumeSessionLocal(persistedLocal, localPatch) {
|
|
|
3105
3105
|
}
|
|
3106
3106
|
};
|
|
3107
3107
|
}
|
|
3108
|
+
function resolveResumeNodeId(local, requested) {
|
|
3109
|
+
const pending = local?.pendingToolCalls;
|
|
3110
|
+
if (!Array.isArray(pending) || pending.length === 0) return requested ?? "llm";
|
|
3111
|
+
if (requested !== void 0 && requested !== "tool") {
|
|
3112
|
+
throw new Error(
|
|
3113
|
+
`Graph resume must first run ${pending.length} pending tool call(s) from the interrupted batch: requested node=${requested}`
|
|
3114
|
+
);
|
|
3115
|
+
}
|
|
3116
|
+
return "tool";
|
|
3117
|
+
}
|
|
3108
3118
|
var GraphExecutor = class {
|
|
3109
3119
|
constructor(checkpointer, config = {}) {
|
|
3110
3120
|
this.checkpointer = checkpointer;
|
|
@@ -3217,13 +3227,14 @@ var GraphExecutor = class {
|
|
|
3217
3227
|
);
|
|
3218
3228
|
}
|
|
3219
3229
|
const resumedLocal = mergeResumeSessionLocal(current.local, input.localPatch);
|
|
3230
|
+
const nodeId = resolveResumeNodeId(resumedLocal, input.nodeId);
|
|
3220
3231
|
if (this.executionCheckpointPort && current.local?.executorLocal) {
|
|
3221
3232
|
resumedLocal.executorLocal = { ...current.local.executorLocal };
|
|
3222
3233
|
}
|
|
3223
3234
|
this.ephemeralLocals.set(checkpointKey, resumedLocal);
|
|
3224
3235
|
await this.commitCheckpoint(checkpointKey, {
|
|
3225
3236
|
...current,
|
|
3226
|
-
nodeId
|
|
3237
|
+
nodeId,
|
|
3227
3238
|
...this.executionCheckpointPort ? { executionStatus: "ready" } : {},
|
|
3228
3239
|
revision: currentRevision + 1,
|
|
3229
3240
|
local: sanitizeCheckpointLocal(resumedLocal)
|
|
@@ -4104,7 +4115,6 @@ var tickPipelineContextKeys = [
|
|
|
4104
4115
|
"runtimeEventCommitPort",
|
|
4105
4116
|
"modelId",
|
|
4106
4117
|
"toolSchemas",
|
|
4107
|
-
"toolModelInputRequirement",
|
|
4108
4118
|
"toolCallStreamingPolicies",
|
|
4109
4119
|
"llmOptions",
|
|
4110
4120
|
"toolDefinitionTokens",
|
|
@@ -5007,7 +5017,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5007
5017
|
"outputProcessor",
|
|
5008
5018
|
"modelId",
|
|
5009
5019
|
"llmMessages",
|
|
5010
|
-
"toolModelInputRequirement",
|
|
5011
5020
|
"toolCallStreamingPolicies",
|
|
5012
5021
|
"imageInputAdmissionEvidence",
|
|
5013
5022
|
"llmOptions",
|
|
@@ -5066,7 +5075,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5066
5075
|
},
|
|
5067
5076
|
{
|
|
5068
5077
|
imageInputAdmissionEvidence: ctx.imageInputAdmissionEvidence,
|
|
5069
|
-
additionalModelInputRequirement: ctx.toolModelInputRequirement,
|
|
5070
5078
|
toolCallStreamingPolicies: ctx.toolCallStreamingPolicies,
|
|
5071
5079
|
...promptBudget && promptUsageMeasurementPolicy ? {
|
|
5072
5080
|
measurePromptUsage: async (activeModelId, messages) => {
|
|
@@ -6051,29 +6059,6 @@ function createCommitContextCompactionStage() {
|
|
|
6051
6059
|
});
|
|
6052
6060
|
}
|
|
6053
6061
|
|
|
6054
|
-
// src/runtime-kernel/graph-engine/functions/prepareModelCompatibleTools.ts
|
|
6055
|
-
function prepareModelCompatibleTools(input) {
|
|
6056
|
-
const schemas = [];
|
|
6057
|
-
const requirements = [];
|
|
6058
|
-
for (const schema of input.schemas) {
|
|
6059
|
-
const definition = input.getToolDefinition(schema.function.name);
|
|
6060
|
-
const requirement = definition?.modelInputRequirement;
|
|
6061
|
-
const delivery = definition?.modelInputDelivery ?? "required";
|
|
6062
|
-
const isRequired = delivery === "required";
|
|
6063
|
-
if (requirement && isRequired && !evaluateModelInputCompatibility(input.model, requirement).compatible) {
|
|
6064
|
-
continue;
|
|
6065
|
-
}
|
|
6066
|
-
schemas.push(schema);
|
|
6067
|
-
if (requirement && isRequired) {
|
|
6068
|
-
requirements.push(requirement);
|
|
6069
|
-
}
|
|
6070
|
-
}
|
|
6071
|
-
return {
|
|
6072
|
-
schemas: Object.freeze(schemas),
|
|
6073
|
-
requirement: requirements.length > 0 ? mergeModelInputRequirements(...requirements) : EMPTY_MODEL_INPUT_REQUIREMENT
|
|
6074
|
-
};
|
|
6075
|
-
}
|
|
6076
|
-
|
|
6077
6062
|
// src/runtime-kernel/graph-engine/tick-pipeline/stages/prepareCallStage.ts
|
|
6078
6063
|
function createPrepareCallStage(dependencies) {
|
|
6079
6064
|
return defineTickStage({
|
|
@@ -6091,7 +6076,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6091
6076
|
writes: [
|
|
6092
6077
|
"modelId",
|
|
6093
6078
|
"toolSchemas",
|
|
6094
|
-
"toolModelInputRequirement",
|
|
6095
6079
|
"toolCallStreamingPolicies",
|
|
6096
6080
|
"llmOptions",
|
|
6097
6081
|
"toolDefinitionTokens"
|
|
@@ -6131,12 +6115,7 @@ function createPrepareCallStage(dependencies) {
|
|
|
6131
6115
|
invocation: ctx.request
|
|
6132
6116
|
});
|
|
6133
6117
|
const modelConfig = dependencies.modelCatalog.getModelById(modelId);
|
|
6134
|
-
const
|
|
6135
|
-
schemas: candidateToolSchemas,
|
|
6136
|
-
model: modelConfig,
|
|
6137
|
-
getToolDefinition: (toolName) => dependencies.toolCatalog.getToolDefinition(toolName)
|
|
6138
|
-
});
|
|
6139
|
-
const toolSchemas = [...toolPreparation.schemas];
|
|
6118
|
+
const toolSchemas = [...candidateToolSchemas];
|
|
6140
6119
|
const toolCallStreamingPolicies = deriveToolCallStreamingPolicies(
|
|
6141
6120
|
toolSchemas,
|
|
6142
6121
|
dependencies.toolCatalog
|
|
@@ -6180,7 +6159,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6180
6159
|
return {
|
|
6181
6160
|
modelId,
|
|
6182
6161
|
toolSchemas,
|
|
6183
|
-
toolModelInputRequirement: toolPreparation.requirement,
|
|
6184
6162
|
toolCallStreamingPolicies,
|
|
6185
6163
|
llmOptions,
|
|
6186
6164
|
toolDefinitionTokens
|
|
@@ -6354,7 +6332,6 @@ var GraphAgentExecutor = class {
|
|
|
6354
6332
|
modelId: "",
|
|
6355
6333
|
toolSchemas: [],
|
|
6356
6334
|
toolCallStreamingPolicies: {},
|
|
6357
|
-
toolModelInputRequirement: void 0,
|
|
6358
6335
|
llmOptions: {},
|
|
6359
6336
|
toolDefinitionTokens: 0,
|
|
6360
6337
|
llmMessages: [],
|
|
@@ -7606,10 +7583,6 @@ function parseToolModelInputDeclaration(value) {
|
|
|
7606
7583
|
}
|
|
7607
7584
|
|
|
7608
7585
|
// src/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.ts
|
|
7609
|
-
var TOOL_RESULT_IMAGE_REQUIREMENT = {
|
|
7610
|
-
requires_image_input: true,
|
|
7611
|
-
placements: ["tool_result_image"]
|
|
7612
|
-
};
|
|
7613
7586
|
async function resolveToolModelInput(input) {
|
|
7614
7587
|
if (!input.selections) {
|
|
7615
7588
|
return void 0;
|
|
@@ -7630,16 +7603,6 @@ async function resolveToolModelInput(input) {
|
|
|
7630
7603
|
if (parsed.data.some((reference, index) => reference.id !== input.selections?.[index]?.id)) {
|
|
7631
7604
|
throw new ToolModelInputResolutionError("Tool model input resolver changed attachment identity or order.");
|
|
7632
7605
|
}
|
|
7633
|
-
if (!input.activeModelId) {
|
|
7634
|
-
throw new ToolModelInputResolutionError("Missing successful LLM model for tool input validation.");
|
|
7635
|
-
}
|
|
7636
|
-
if (!input.capabilityValidator) {
|
|
7637
|
-
throw new ToolModelInputResolutionError("Tool model input validator is not configured.");
|
|
7638
|
-
}
|
|
7639
|
-
input.capabilityValidator.assertCompatible({
|
|
7640
|
-
activeModelId: input.activeModelId,
|
|
7641
|
-
requirement: TOOL_RESULT_IMAGE_REQUIREMENT
|
|
7642
|
-
});
|
|
7643
7606
|
return Object.freeze(parsed.data.map((reference) => Object.freeze(reference)));
|
|
7644
7607
|
}
|
|
7645
7608
|
|
|
@@ -8345,7 +8308,6 @@ var ToolNodeEventBridge = class {
|
|
|
8345
8308
|
|
|
8346
8309
|
// src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
|
|
8347
8310
|
var logger10 = new Logger("ToolNode");
|
|
8348
|
-
var MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR = "tool.model_input.requirement_resolution_failed: Tool model input requirement could not be resolved";
|
|
8349
8311
|
function parseToolArgs(call) {
|
|
8350
8312
|
const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
|
|
8351
8313
|
if (!rawArguments.trim()) {
|
|
@@ -8449,12 +8411,6 @@ function prepareToolExecution(params) {
|
|
|
8449
8411
|
toolArgs,
|
|
8450
8412
|
idempotencyKey
|
|
8451
8413
|
});
|
|
8452
|
-
const modelInputRequirement = resolveModelInputRequirement({
|
|
8453
|
-
toolDefinition,
|
|
8454
|
-
toolArgs,
|
|
8455
|
-
hasProtocolError: protocolError !== void 0,
|
|
8456
|
-
toolName
|
|
8457
|
-
});
|
|
8458
8414
|
return {
|
|
8459
8415
|
call: params.call,
|
|
8460
8416
|
toolName,
|
|
@@ -8463,30 +8419,9 @@ function prepareToolExecution(params) {
|
|
|
8463
8419
|
toolArgs,
|
|
8464
8420
|
protocolError,
|
|
8465
8421
|
idempotencyKey,
|
|
8466
|
-
...modelInputRequirement.requirement ? { modelInputRequirement: modelInputRequirement.requirement } : {},
|
|
8467
|
-
modelInputDelivery: toolDefinition?.modelInputDelivery ?? "required",
|
|
8468
|
-
...modelInputRequirement.error ? { modelInputRequirementError: modelInputRequirement.error } : {},
|
|
8469
8422
|
bridge
|
|
8470
8423
|
};
|
|
8471
8424
|
}
|
|
8472
|
-
function resolveModelInputRequirement(params) {
|
|
8473
|
-
if (params.hasProtocolError) {
|
|
8474
|
-
return {};
|
|
8475
|
-
}
|
|
8476
|
-
if (!params.toolDefinition?.resolveModelInputRequirement) {
|
|
8477
|
-
return params.toolDefinition?.modelInputRequirement ? { requirement: params.toolDefinition.modelInputRequirement } : {};
|
|
8478
|
-
}
|
|
8479
|
-
try {
|
|
8480
|
-
const requirement = params.toolDefinition.resolveModelInputRequirement(params.toolArgs);
|
|
8481
|
-
return requirement ? { requirement } : {};
|
|
8482
|
-
} catch (error) {
|
|
8483
|
-
logger10.warn("dynamic model input requirement resolution failed", {
|
|
8484
|
-
toolName: params.toolName,
|
|
8485
|
-
errorName: error instanceof Error ? error.name : "UnknownError"
|
|
8486
|
-
});
|
|
8487
|
-
return { error: MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR };
|
|
8488
|
-
}
|
|
8489
|
-
}
|
|
8490
8425
|
function attachWorkingHistoryView(params) {
|
|
8491
8426
|
const historyEvents = parseRuntimeEvents(
|
|
8492
8427
|
params.state.local?.history ?? []
|
|
@@ -8718,14 +8653,6 @@ function readToolObservationPolicy(local) {
|
|
|
8718
8653
|
function readHistoryEvents(local) {
|
|
8719
8654
|
return parseRuntimeEvents(local.history ?? []);
|
|
8720
8655
|
}
|
|
8721
|
-
function readLastSuccessfulLlmModelId(local) {
|
|
8722
|
-
const executorLocal = local.executorLocal;
|
|
8723
|
-
if (!isRecord9(executorLocal)) {
|
|
8724
|
-
return void 0;
|
|
8725
|
-
}
|
|
8726
|
-
const value = executorLocal.lastSuccessfulLlmModelId;
|
|
8727
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
8728
|
-
}
|
|
8729
8656
|
function formatCapabilityError(error) {
|
|
8730
8657
|
if (isRecord9(error)) {
|
|
8731
8658
|
const codeValue = error.errorCode ?? error.code;
|
|
@@ -8737,29 +8664,12 @@ function formatCapabilityError(error) {
|
|
|
8737
8664
|
}
|
|
8738
8665
|
return error instanceof Error ? error.message : String(error);
|
|
8739
8666
|
}
|
|
8740
|
-
function bindModelInputAdmission(input) {
|
|
8741
|
-
input.context.modelInputAdmission = Object.freeze({
|
|
8742
|
-
requirement: Object.freeze({
|
|
8743
|
-
...input.requirement,
|
|
8744
|
-
placements: Object.freeze([...input.requirement.placements])
|
|
8745
|
-
}),
|
|
8746
|
-
delivery: input.delivery,
|
|
8747
|
-
admitted: input.admitted
|
|
8748
|
-
});
|
|
8749
|
-
}
|
|
8750
|
-
function isOptionalImageInputIncompatibility(reason) {
|
|
8751
|
-
return reason === "image_input_unsupported" || reason === "placement_unsupported";
|
|
8752
|
-
}
|
|
8753
|
-
function shouldDeliverToolModelInput(input) {
|
|
8754
|
-
return input.delivery === "required" || input.context.modelInputAdmission?.admitted === true;
|
|
8755
|
-
}
|
|
8756
8667
|
var ToolNode = class {
|
|
8757
8668
|
id = "tool";
|
|
8758
8669
|
toolRuntime;
|
|
8759
8670
|
observationPreview;
|
|
8760
8671
|
telemetryPort;
|
|
8761
8672
|
auditPort;
|
|
8762
|
-
modelInputCapabilityValidator;
|
|
8763
8673
|
modelInputResolver;
|
|
8764
8674
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
8765
8675
|
constructor(dependencies) {
|
|
@@ -8767,7 +8677,6 @@ var ToolNode = class {
|
|
|
8767
8677
|
this.observationPreview = dependencies.observationPreview;
|
|
8768
8678
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
8769
8679
|
this.auditPort = dependencies.auditPort ?? noopAudit;
|
|
8770
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
8771
8680
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
8772
8681
|
}
|
|
8773
8682
|
/**
|
|
@@ -8933,7 +8842,6 @@ var ToolNode = class {
|
|
|
8933
8842
|
logger11.warn("no tool name found in call");
|
|
8934
8843
|
return { kind: "yield", events: [] };
|
|
8935
8844
|
}
|
|
8936
|
-
delete prepared.toolContext.modelInputAdmission;
|
|
8937
8845
|
if (typeof execution.protocolError === "string") {
|
|
8938
8846
|
return this.handleError({
|
|
8939
8847
|
...prepared,
|
|
@@ -8951,88 +8859,6 @@ var ToolNode = class {
|
|
|
8951
8859
|
bridge: execution.bridge
|
|
8952
8860
|
});
|
|
8953
8861
|
}
|
|
8954
|
-
if (typeof execution.modelInputRequirementError === "string") {
|
|
8955
|
-
return this.handleError({
|
|
8956
|
-
...prepared,
|
|
8957
|
-
calls,
|
|
8958
|
-
call,
|
|
8959
|
-
toolName: execution.toolName,
|
|
8960
|
-
toolCallId: execution.toolCallId,
|
|
8961
|
-
toolArgs: execution.toolArgs,
|
|
8962
|
-
exec: {
|
|
8963
|
-
success: false,
|
|
8964
|
-
error: execution.modelInputRequirementError,
|
|
8965
|
-
errorKind: "capability",
|
|
8966
|
-
durationMs: 0
|
|
8967
|
-
},
|
|
8968
|
-
bridge: execution.bridge
|
|
8969
|
-
});
|
|
8970
|
-
}
|
|
8971
|
-
if (execution.modelInputRequirement?.requires_image_input === true) {
|
|
8972
|
-
const activeModelId = readLastSuccessfulLlmModelId(prepared.local);
|
|
8973
|
-
let capabilityError;
|
|
8974
|
-
let admitted = true;
|
|
8975
|
-
if (!activeModelId) {
|
|
8976
|
-
capabilityError = "llm.unsupported_capability: missing successful LLM model for tool input validation";
|
|
8977
|
-
} else if (!this.modelInputCapabilityValidator) {
|
|
8978
|
-
capabilityError = "llm.unsupported_capability: tool model input validator is not configured";
|
|
8979
|
-
} else {
|
|
8980
|
-
const validationInput = {
|
|
8981
|
-
activeModelId,
|
|
8982
|
-
requirement: execution.modelInputRequirement
|
|
8983
|
-
};
|
|
8984
|
-
if (execution.modelInputDelivery === "when_supported") {
|
|
8985
|
-
try {
|
|
8986
|
-
const compatibility = this.modelInputCapabilityValidator.evaluate(validationInput);
|
|
8987
|
-
if (!compatibility.compatible) {
|
|
8988
|
-
if (isOptionalImageInputIncompatibility(compatibility.reason)) {
|
|
8989
|
-
admitted = false;
|
|
8990
|
-
logger11.debug("optional tool model input omitted for incompatible active model", {
|
|
8991
|
-
toolName: execution.toolName,
|
|
8992
|
-
activeModelId,
|
|
8993
|
-
reason: compatibility.reason,
|
|
8994
|
-
placements: execution.modelInputRequirement.placements
|
|
8995
|
-
});
|
|
8996
|
-
} else {
|
|
8997
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
8998
|
-
capabilityError = "llm.unsupported_capability: active model is not eligible";
|
|
8999
|
-
}
|
|
9000
|
-
}
|
|
9001
|
-
} catch (error) {
|
|
9002
|
-
capabilityError = formatCapabilityError(error);
|
|
9003
|
-
}
|
|
9004
|
-
} else {
|
|
9005
|
-
try {
|
|
9006
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
9007
|
-
} catch (error) {
|
|
9008
|
-
capabilityError = formatCapabilityError(error);
|
|
9009
|
-
}
|
|
9010
|
-
}
|
|
9011
|
-
}
|
|
9012
|
-
if (capabilityError) {
|
|
9013
|
-
return this.handleError({
|
|
9014
|
-
...prepared,
|
|
9015
|
-
calls,
|
|
9016
|
-
call,
|
|
9017
|
-
toolName: execution.toolName,
|
|
9018
|
-
toolCallId: execution.toolCallId,
|
|
9019
|
-
toolArgs: execution.toolArgs,
|
|
9020
|
-
exec: {
|
|
9021
|
-
success: false,
|
|
9022
|
-
error: capabilityError,
|
|
9023
|
-
errorKind: "capability",
|
|
9024
|
-
durationMs: 0
|
|
9025
|
-
},
|
|
9026
|
-
bridge: execution.bridge
|
|
9027
|
-
});
|
|
9028
|
-
}
|
|
9029
|
-
bindModelInputAdmission({
|
|
9030
|
-
context: prepared.toolContext,
|
|
9031
|
-
requirement: execution.modelInputRequirement,
|
|
9032
|
-
delivery: execution.modelInputDelivery,
|
|
9033
|
-
admitted
|
|
9034
|
-
});
|
|
9035
|
-
}
|
|
9036
8862
|
await this.emitToolDecisionAudit({
|
|
9037
8863
|
action: "tool.allow",
|
|
9038
8864
|
toolName: execution.toolName,
|
|
@@ -9084,21 +8910,15 @@ var ToolNode = class {
|
|
|
9084
8910
|
bridge: execution.bridge
|
|
9085
8911
|
});
|
|
9086
8912
|
}
|
|
9087
|
-
|
|
9088
|
-
context: prepared.toolContext,
|
|
9089
|
-
delivery: execution.modelInputDelivery
|
|
9090
|
-
});
|
|
9091
|
-
let attachments = deliverModelInput ? exec.cachedAttachments : void 0;
|
|
8913
|
+
let attachments = exec.cachedAttachments;
|
|
9092
8914
|
try {
|
|
9093
|
-
if (
|
|
8915
|
+
if (!attachments) {
|
|
9094
8916
|
attachments = await resolveToolModelInput({
|
|
9095
|
-
activeModelId: readLastSuccessfulLlmModelId(prepared.local),
|
|
9096
8917
|
toolName: execution.toolName,
|
|
9097
8918
|
toolCallId: execution.toolCallId,
|
|
9098
8919
|
selections: contract.modelInputAttachments,
|
|
9099
8920
|
context: prepared.toolContext,
|
|
9100
|
-
resolver: this.modelInputResolver
|
|
9101
|
-
capabilityValidator: this.modelInputCapabilityValidator
|
|
8921
|
+
resolver: this.modelInputResolver
|
|
9102
8922
|
});
|
|
9103
8923
|
}
|
|
9104
8924
|
} catch (error) {
|
|
@@ -13123,7 +12943,6 @@ function createDefaultGraphExecutor(options) {
|
|
|
13123
12943
|
observationPreview: options.observationPreview,
|
|
13124
12944
|
auditPort: options.auditPort,
|
|
13125
12945
|
telemetryPort: options.telemetryPort,
|
|
13126
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
13127
12946
|
modelInputResolver: options.modelInputResolver
|
|
13128
12947
|
}));
|
|
13129
12948
|
executor2.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
|
|
@@ -13247,11 +13066,7 @@ var QuickstartMemoryToolRuntime = class {
|
|
|
13247
13066
|
return {
|
|
13248
13067
|
parameters: tool.parameters,
|
|
13249
13068
|
validateArguments: (args) => tool["validateArguments"](args),
|
|
13250
|
-
idempotency: tool.idempotency
|
|
13251
|
-
modelInputRequirement: tool.modelInputRequirement,
|
|
13252
|
-
...tool.resolveModelInputRequirement ? {
|
|
13253
|
-
resolveModelInputRequirement: (args) => tool.resolveModelInputRequirement?.(args)
|
|
13254
|
-
} : {}
|
|
13069
|
+
idempotency: tool.idempotency
|
|
13255
13070
|
};
|
|
13256
13071
|
}
|
|
13257
13072
|
async executeTool(toolName, args, context) {
|