@linnlabs/linnkit 0.41.0 → 0.42.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 +25 -0
- package/dist/cli.cjs +5 -201
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +5 -201
- 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/index.cjs +6 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -211
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +5 -201
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +5 -201
- 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/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 +5 -206
- 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 +5 -206
- 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 +5 -206
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +5 -206
- package/dist/testkit.js.map +1 -1
- package/docs/integration/tool-development-guide.md +7 -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
|
@@ -3,8 +3,8 @@ import { ProviderContinuation } from '../../contracts/provider-continuation.cjs'
|
|
|
3
3
|
import { CanonicalInferenceRequest, CanonicalInferenceFinishReason } from '../../ports/canonical-inference.cjs';
|
|
4
4
|
import { LlmCallOptions } from '../../ports/llm-call.cjs';
|
|
5
5
|
import { LlmInputMaterializerPort } from '../../ports/llm-input-materialization.cjs';
|
|
6
|
-
import { ModelCatalogLike } from '../../runtime-kernel/llm/modelCatalog.cjs';
|
|
7
6
|
import { LlmCaller } from '../../runtime-kernel/llm/caller.cjs';
|
|
7
|
+
import { ModelCatalogLike } from '../../runtime-kernel/llm/modelCatalog.cjs';
|
|
8
8
|
|
|
9
9
|
type ScriptedLlmCaller = LlmCaller;
|
|
10
10
|
interface ScriptedLlmCall {
|
|
@@ -3,8 +3,8 @@ import { ProviderContinuation } from '../../contracts/provider-continuation.js';
|
|
|
3
3
|
import { CanonicalInferenceRequest, CanonicalInferenceFinishReason } from '../../ports/canonical-inference.js';
|
|
4
4
|
import { LlmCallOptions } from '../../ports/llm-call.js';
|
|
5
5
|
import { LlmInputMaterializerPort } from '../../ports/llm-input-materialization.js';
|
|
6
|
-
import { ModelCatalogLike } from '../../runtime-kernel/llm/modelCatalog.js';
|
|
7
6
|
import { LlmCaller } from '../../runtime-kernel/llm/caller.js';
|
|
7
|
+
import { ModelCatalogLike } from '../../runtime-kernel/llm/modelCatalog.js';
|
|
8
8
|
|
|
9
9
|
type ScriptedLlmCaller = LlmCaller;
|
|
10
10
|
interface ScriptedLlmCall {
|
package/dist/testkit.cjs
CHANGED
|
@@ -4198,7 +4198,6 @@ var tickPipelineContextKeys = [
|
|
|
4198
4198
|
"runtimeEventCommitPort",
|
|
4199
4199
|
"modelId",
|
|
4200
4200
|
"toolSchemas",
|
|
4201
|
-
"toolModelInputRequirement",
|
|
4202
4201
|
"toolCallStreamingPolicies",
|
|
4203
4202
|
"llmOptions",
|
|
4204
4203
|
"toolDefinitionTokens",
|
|
@@ -5319,7 +5318,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5319
5318
|
"outputProcessor",
|
|
5320
5319
|
"modelId",
|
|
5321
5320
|
"llmMessages",
|
|
5322
|
-
"toolModelInputRequirement",
|
|
5323
5321
|
"toolCallStreamingPolicies",
|
|
5324
5322
|
"imageInputAdmissionEvidence",
|
|
5325
5323
|
"llmOptions",
|
|
@@ -5378,7 +5376,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5378
5376
|
},
|
|
5379
5377
|
{
|
|
5380
5378
|
imageInputAdmissionEvidence: ctx.imageInputAdmissionEvidence,
|
|
5381
|
-
additionalModelInputRequirement: ctx.toolModelInputRequirement,
|
|
5382
5379
|
toolCallStreamingPolicies: ctx.toolCallStreamingPolicies,
|
|
5383
5380
|
...promptBudget && promptUsageMeasurementPolicy ? {
|
|
5384
5381
|
measurePromptUsage: async (activeModelId, messages) => {
|
|
@@ -6363,29 +6360,6 @@ function createCommitContextCompactionStage() {
|
|
|
6363
6360
|
});
|
|
6364
6361
|
}
|
|
6365
6362
|
|
|
6366
|
-
// src/runtime-kernel/graph-engine/functions/prepareModelCompatibleTools.ts
|
|
6367
|
-
function prepareModelCompatibleTools(input) {
|
|
6368
|
-
const schemas = [];
|
|
6369
|
-
const requirements = [];
|
|
6370
|
-
for (const schema of input.schemas) {
|
|
6371
|
-
const definition = input.getToolDefinition(schema.function.name);
|
|
6372
|
-
const requirement = definition?.modelInputRequirement;
|
|
6373
|
-
const delivery = definition?.modelInputDelivery ?? "required";
|
|
6374
|
-
const isRequired = delivery === "required";
|
|
6375
|
-
if (requirement && isRequired && !evaluateModelInputCompatibility(input.model, requirement).compatible) {
|
|
6376
|
-
continue;
|
|
6377
|
-
}
|
|
6378
|
-
schemas.push(schema);
|
|
6379
|
-
if (requirement && isRequired) {
|
|
6380
|
-
requirements.push(requirement);
|
|
6381
|
-
}
|
|
6382
|
-
}
|
|
6383
|
-
return {
|
|
6384
|
-
schemas: Object.freeze(schemas),
|
|
6385
|
-
requirement: requirements.length > 0 ? mergeModelInputRequirements(...requirements) : EMPTY_MODEL_INPUT_REQUIREMENT
|
|
6386
|
-
};
|
|
6387
|
-
}
|
|
6388
|
-
|
|
6389
6363
|
// src/runtime-kernel/graph-engine/tick-pipeline/stages/prepareCallStage.ts
|
|
6390
6364
|
function createPrepareCallStage(dependencies) {
|
|
6391
6365
|
return defineTickStage({
|
|
@@ -6403,7 +6377,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6403
6377
|
writes: [
|
|
6404
6378
|
"modelId",
|
|
6405
6379
|
"toolSchemas",
|
|
6406
|
-
"toolModelInputRequirement",
|
|
6407
6380
|
"toolCallStreamingPolicies",
|
|
6408
6381
|
"llmOptions",
|
|
6409
6382
|
"toolDefinitionTokens"
|
|
@@ -6443,12 +6416,7 @@ function createPrepareCallStage(dependencies) {
|
|
|
6443
6416
|
invocation: ctx.request
|
|
6444
6417
|
});
|
|
6445
6418
|
const modelConfig = dependencies.modelCatalog.getModelById(modelId);
|
|
6446
|
-
const
|
|
6447
|
-
schemas: candidateToolSchemas,
|
|
6448
|
-
model: modelConfig,
|
|
6449
|
-
getToolDefinition: (toolName) => dependencies.toolCatalog.getToolDefinition(toolName)
|
|
6450
|
-
});
|
|
6451
|
-
const toolSchemas = [...toolPreparation.schemas];
|
|
6419
|
+
const toolSchemas = [...candidateToolSchemas];
|
|
6452
6420
|
const toolCallStreamingPolicies = deriveToolCallStreamingPolicies(
|
|
6453
6421
|
toolSchemas,
|
|
6454
6422
|
dependencies.toolCatalog
|
|
@@ -6492,7 +6460,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6492
6460
|
return {
|
|
6493
6461
|
modelId,
|
|
6494
6462
|
toolSchemas,
|
|
6495
|
-
toolModelInputRequirement: toolPreparation.requirement,
|
|
6496
6463
|
toolCallStreamingPolicies,
|
|
6497
6464
|
llmOptions,
|
|
6498
6465
|
toolDefinitionTokens
|
|
@@ -6666,7 +6633,6 @@ var GraphAgentExecutor = class {
|
|
|
6666
6633
|
modelId: "",
|
|
6667
6634
|
toolSchemas: [],
|
|
6668
6635
|
toolCallStreamingPolicies: {},
|
|
6669
|
-
toolModelInputRequirement: void 0,
|
|
6670
6636
|
llmOptions: {},
|
|
6671
6637
|
toolDefinitionTokens: 0,
|
|
6672
6638
|
llmMessages: [],
|
|
@@ -7918,10 +7884,6 @@ function parseToolModelInputDeclaration(value) {
|
|
|
7918
7884
|
}
|
|
7919
7885
|
|
|
7920
7886
|
// src/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.ts
|
|
7921
|
-
var TOOL_RESULT_IMAGE_REQUIREMENT = {
|
|
7922
|
-
requires_image_input: true,
|
|
7923
|
-
placements: ["tool_result_image"]
|
|
7924
|
-
};
|
|
7925
7887
|
async function resolveToolModelInput(input) {
|
|
7926
7888
|
if (!input.selections) {
|
|
7927
7889
|
return void 0;
|
|
@@ -7942,16 +7904,6 @@ async function resolveToolModelInput(input) {
|
|
|
7942
7904
|
if (parsed.data.some((reference, index) => reference.id !== input.selections?.[index]?.id)) {
|
|
7943
7905
|
throw new ToolModelInputResolutionError("Tool model input resolver changed attachment identity or order.");
|
|
7944
7906
|
}
|
|
7945
|
-
if (!input.activeModelId) {
|
|
7946
|
-
throw new ToolModelInputResolutionError("Missing successful LLM model for tool input validation.");
|
|
7947
|
-
}
|
|
7948
|
-
if (!input.capabilityValidator) {
|
|
7949
|
-
throw new ToolModelInputResolutionError("Tool model input validator is not configured.");
|
|
7950
|
-
}
|
|
7951
|
-
input.capabilityValidator.assertCompatible({
|
|
7952
|
-
activeModelId: input.activeModelId,
|
|
7953
|
-
requirement: TOOL_RESULT_IMAGE_REQUIREMENT
|
|
7954
|
-
});
|
|
7955
7907
|
return Object.freeze(parsed.data.map((reference) => Object.freeze(reference)));
|
|
7956
7908
|
}
|
|
7957
7909
|
|
|
@@ -8416,8 +8368,7 @@ var TOOL_CONTEXT_RUNTIME_RESERVED_KEYS = [
|
|
|
8416
8368
|
"parentRunId",
|
|
8417
8369
|
"childRunDepth",
|
|
8418
8370
|
"childRunContextInjections",
|
|
8419
|
-
"parentToolCallId"
|
|
8420
|
-
"modelInputAdmission"
|
|
8371
|
+
"parentToolCallId"
|
|
8421
8372
|
];
|
|
8422
8373
|
var TOOL_CONTEXT_RUNTIME_BINDINGS_KEY = /* @__PURE__ */ Symbol.for(
|
|
8423
8374
|
"@linnlabs/linnkit/tool-context-runtime-bindings/v1"
|
|
@@ -8718,7 +8669,6 @@ var ToolNodeEventBridge = class {
|
|
|
8718
8669
|
|
|
8719
8670
|
// src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
|
|
8720
8671
|
var logger10 = new Logger("ToolNode");
|
|
8721
|
-
var MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR = "tool.model_input.requirement_resolution_failed: Tool model input requirement could not be resolved";
|
|
8722
8672
|
function parseToolArgs(call) {
|
|
8723
8673
|
const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
|
|
8724
8674
|
if (!rawArguments.trim()) {
|
|
@@ -8822,12 +8772,6 @@ function prepareToolExecution(params) {
|
|
|
8822
8772
|
toolArgs,
|
|
8823
8773
|
idempotencyKey
|
|
8824
8774
|
});
|
|
8825
|
-
const modelInputRequirement = resolveModelInputRequirement({
|
|
8826
|
-
toolDefinition,
|
|
8827
|
-
toolArgs,
|
|
8828
|
-
hasProtocolError: protocolError !== void 0,
|
|
8829
|
-
toolName
|
|
8830
|
-
});
|
|
8831
8775
|
return {
|
|
8832
8776
|
call: params.call,
|
|
8833
8777
|
toolName,
|
|
@@ -8836,30 +8780,9 @@ function prepareToolExecution(params) {
|
|
|
8836
8780
|
toolArgs,
|
|
8837
8781
|
protocolError,
|
|
8838
8782
|
idempotencyKey,
|
|
8839
|
-
...modelInputRequirement.requirement ? { modelInputRequirement: modelInputRequirement.requirement } : {},
|
|
8840
|
-
modelInputDelivery: toolDefinition?.modelInputDelivery ?? "required",
|
|
8841
|
-
...modelInputRequirement.error ? { modelInputRequirementError: modelInputRequirement.error } : {},
|
|
8842
8783
|
bridge
|
|
8843
8784
|
};
|
|
8844
8785
|
}
|
|
8845
|
-
function resolveModelInputRequirement(params) {
|
|
8846
|
-
if (params.hasProtocolError) {
|
|
8847
|
-
return {};
|
|
8848
|
-
}
|
|
8849
|
-
if (!params.toolDefinition?.resolveModelInputRequirement) {
|
|
8850
|
-
return params.toolDefinition?.modelInputRequirement ? { requirement: params.toolDefinition.modelInputRequirement } : {};
|
|
8851
|
-
}
|
|
8852
|
-
try {
|
|
8853
|
-
const requirement = params.toolDefinition.resolveModelInputRequirement(params.toolArgs);
|
|
8854
|
-
return requirement ? { requirement } : {};
|
|
8855
|
-
} catch (error) {
|
|
8856
|
-
logger10.warn("dynamic model input requirement resolution failed", {
|
|
8857
|
-
toolName: params.toolName,
|
|
8858
|
-
errorName: error instanceof Error ? error.name : "UnknownError"
|
|
8859
|
-
});
|
|
8860
|
-
return { error: MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR };
|
|
8861
|
-
}
|
|
8862
|
-
}
|
|
8863
8786
|
function attachWorkingHistoryView(params) {
|
|
8864
8787
|
const historyEvents = parseRuntimeEvents(
|
|
8865
8788
|
params.state.local?.history ?? []
|
|
@@ -9091,14 +9014,6 @@ function readToolObservationPolicy(local) {
|
|
|
9091
9014
|
function readHistoryEvents(local) {
|
|
9092
9015
|
return parseRuntimeEvents(local.history ?? []);
|
|
9093
9016
|
}
|
|
9094
|
-
function readLastSuccessfulLlmModelId(local) {
|
|
9095
|
-
const executorLocal = local.executorLocal;
|
|
9096
|
-
if (!isRecord9(executorLocal)) {
|
|
9097
|
-
return void 0;
|
|
9098
|
-
}
|
|
9099
|
-
const value = executorLocal.lastSuccessfulLlmModelId;
|
|
9100
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
9101
|
-
}
|
|
9102
9017
|
function formatCapabilityError(error) {
|
|
9103
9018
|
if (isRecord9(error)) {
|
|
9104
9019
|
const codeValue = error.errorCode ?? error.code;
|
|
@@ -9110,29 +9025,12 @@ function formatCapabilityError(error) {
|
|
|
9110
9025
|
}
|
|
9111
9026
|
return error instanceof Error ? error.message : String(error);
|
|
9112
9027
|
}
|
|
9113
|
-
function bindModelInputAdmission(input) {
|
|
9114
|
-
input.context.modelInputAdmission = Object.freeze({
|
|
9115
|
-
requirement: Object.freeze({
|
|
9116
|
-
...input.requirement,
|
|
9117
|
-
placements: Object.freeze([...input.requirement.placements])
|
|
9118
|
-
}),
|
|
9119
|
-
delivery: input.delivery,
|
|
9120
|
-
admitted: input.admitted
|
|
9121
|
-
});
|
|
9122
|
-
}
|
|
9123
|
-
function isOptionalImageInputIncompatibility(reason) {
|
|
9124
|
-
return reason === "image_input_unsupported" || reason === "placement_unsupported";
|
|
9125
|
-
}
|
|
9126
|
-
function shouldDeliverToolModelInput(input) {
|
|
9127
|
-
return input.delivery === "required" || input.context.modelInputAdmission?.admitted === true;
|
|
9128
|
-
}
|
|
9129
9028
|
var ToolNode = class {
|
|
9130
9029
|
id = "tool";
|
|
9131
9030
|
toolRuntime;
|
|
9132
9031
|
observationPreview;
|
|
9133
9032
|
telemetryPort;
|
|
9134
9033
|
auditPort;
|
|
9135
|
-
modelInputCapabilityValidator;
|
|
9136
9034
|
modelInputResolver;
|
|
9137
9035
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
9138
9036
|
constructor(dependencies) {
|
|
@@ -9140,7 +9038,6 @@ var ToolNode = class {
|
|
|
9140
9038
|
this.observationPreview = dependencies.observationPreview;
|
|
9141
9039
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
9142
9040
|
this.auditPort = dependencies.auditPort ?? noopAudit;
|
|
9143
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
9144
9041
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
9145
9042
|
}
|
|
9146
9043
|
/**
|
|
@@ -9306,7 +9203,6 @@ var ToolNode = class {
|
|
|
9306
9203
|
logger11.warn("no tool name found in call");
|
|
9307
9204
|
return { kind: "yield", events: [] };
|
|
9308
9205
|
}
|
|
9309
|
-
delete prepared.toolContext.modelInputAdmission;
|
|
9310
9206
|
if (typeof execution.protocolError === "string") {
|
|
9311
9207
|
return this.handleError({
|
|
9312
9208
|
...prepared,
|
|
@@ -9324,88 +9220,6 @@ var ToolNode = class {
|
|
|
9324
9220
|
bridge: execution.bridge
|
|
9325
9221
|
});
|
|
9326
9222
|
}
|
|
9327
|
-
if (typeof execution.modelInputRequirementError === "string") {
|
|
9328
|
-
return this.handleError({
|
|
9329
|
-
...prepared,
|
|
9330
|
-
calls,
|
|
9331
|
-
call,
|
|
9332
|
-
toolName: execution.toolName,
|
|
9333
|
-
toolCallId: execution.toolCallId,
|
|
9334
|
-
toolArgs: execution.toolArgs,
|
|
9335
|
-
exec: {
|
|
9336
|
-
success: false,
|
|
9337
|
-
error: execution.modelInputRequirementError,
|
|
9338
|
-
errorKind: "capability",
|
|
9339
|
-
durationMs: 0
|
|
9340
|
-
},
|
|
9341
|
-
bridge: execution.bridge
|
|
9342
|
-
});
|
|
9343
|
-
}
|
|
9344
|
-
if (execution.modelInputRequirement?.requires_image_input === true) {
|
|
9345
|
-
const activeModelId = readLastSuccessfulLlmModelId(prepared.local);
|
|
9346
|
-
let capabilityError;
|
|
9347
|
-
let admitted = true;
|
|
9348
|
-
if (!activeModelId) {
|
|
9349
|
-
capabilityError = "llm.unsupported_capability: missing successful LLM model for tool input validation";
|
|
9350
|
-
} else if (!this.modelInputCapabilityValidator) {
|
|
9351
|
-
capabilityError = "llm.unsupported_capability: tool model input validator is not configured";
|
|
9352
|
-
} else {
|
|
9353
|
-
const validationInput = {
|
|
9354
|
-
activeModelId,
|
|
9355
|
-
requirement: execution.modelInputRequirement
|
|
9356
|
-
};
|
|
9357
|
-
if (execution.modelInputDelivery === "when_supported") {
|
|
9358
|
-
try {
|
|
9359
|
-
const compatibility = this.modelInputCapabilityValidator.evaluate(validationInput);
|
|
9360
|
-
if (!compatibility.compatible) {
|
|
9361
|
-
if (isOptionalImageInputIncompatibility(compatibility.reason)) {
|
|
9362
|
-
admitted = false;
|
|
9363
|
-
logger11.debug("optional tool model input omitted for incompatible active model", {
|
|
9364
|
-
toolName: execution.toolName,
|
|
9365
|
-
activeModelId,
|
|
9366
|
-
reason: compatibility.reason,
|
|
9367
|
-
placements: execution.modelInputRequirement.placements
|
|
9368
|
-
});
|
|
9369
|
-
} else {
|
|
9370
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
9371
|
-
capabilityError = "llm.unsupported_capability: active model is not eligible";
|
|
9372
|
-
}
|
|
9373
|
-
}
|
|
9374
|
-
} catch (error) {
|
|
9375
|
-
capabilityError = formatCapabilityError(error);
|
|
9376
|
-
}
|
|
9377
|
-
} else {
|
|
9378
|
-
try {
|
|
9379
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
9380
|
-
} catch (error) {
|
|
9381
|
-
capabilityError = formatCapabilityError(error);
|
|
9382
|
-
}
|
|
9383
|
-
}
|
|
9384
|
-
}
|
|
9385
|
-
if (capabilityError) {
|
|
9386
|
-
return this.handleError({
|
|
9387
|
-
...prepared,
|
|
9388
|
-
calls,
|
|
9389
|
-
call,
|
|
9390
|
-
toolName: execution.toolName,
|
|
9391
|
-
toolCallId: execution.toolCallId,
|
|
9392
|
-
toolArgs: execution.toolArgs,
|
|
9393
|
-
exec: {
|
|
9394
|
-
success: false,
|
|
9395
|
-
error: capabilityError,
|
|
9396
|
-
errorKind: "capability",
|
|
9397
|
-
durationMs: 0
|
|
9398
|
-
},
|
|
9399
|
-
bridge: execution.bridge
|
|
9400
|
-
});
|
|
9401
|
-
}
|
|
9402
|
-
bindModelInputAdmission({
|
|
9403
|
-
context: prepared.toolContext,
|
|
9404
|
-
requirement: execution.modelInputRequirement,
|
|
9405
|
-
delivery: execution.modelInputDelivery,
|
|
9406
|
-
admitted
|
|
9407
|
-
});
|
|
9408
|
-
}
|
|
9409
9223
|
await this.emitToolDecisionAudit({
|
|
9410
9224
|
action: "tool.allow",
|
|
9411
9225
|
toolName: execution.toolName,
|
|
@@ -9457,21 +9271,15 @@ var ToolNode = class {
|
|
|
9457
9271
|
bridge: execution.bridge
|
|
9458
9272
|
});
|
|
9459
9273
|
}
|
|
9460
|
-
|
|
9461
|
-
context: prepared.toolContext,
|
|
9462
|
-
delivery: execution.modelInputDelivery
|
|
9463
|
-
});
|
|
9464
|
-
let attachments = deliverModelInput ? exec.cachedAttachments : void 0;
|
|
9274
|
+
let attachments = exec.cachedAttachments;
|
|
9465
9275
|
try {
|
|
9466
|
-
if (
|
|
9276
|
+
if (!attachments) {
|
|
9467
9277
|
attachments = await resolveToolModelInput({
|
|
9468
|
-
activeModelId: readLastSuccessfulLlmModelId(prepared.local),
|
|
9469
9278
|
toolName: execution.toolName,
|
|
9470
9279
|
toolCallId: execution.toolCallId,
|
|
9471
9280
|
selections: contract.modelInputAttachments,
|
|
9472
9281
|
context: prepared.toolContext,
|
|
9473
|
-
resolver: this.modelInputResolver
|
|
9474
|
-
capabilityValidator: this.modelInputCapabilityValidator
|
|
9282
|
+
resolver: this.modelInputResolver
|
|
9475
9283
|
});
|
|
9476
9284
|
}
|
|
9477
9285
|
} catch (error) {
|
|
@@ -10180,10 +9988,6 @@ function formatUnknownToolArguments(fields, allowedFields) {
|
|
|
10180
9988
|
// src/runtime-kernel/tools/toolContracts.ts
|
|
10181
9989
|
var BaseTool = class {
|
|
10182
9990
|
idempotency;
|
|
10183
|
-
modelInputRequirement;
|
|
10184
|
-
/** 模型输入是工具成功的必要结果,还是仅在当前模型支持时提供的增强反馈。 */
|
|
10185
|
-
modelInputDelivery;
|
|
10186
|
-
resolveModelInputRequirement;
|
|
10187
9991
|
streaming;
|
|
10188
9992
|
getExecutionSummary(output) {
|
|
10189
9993
|
const FULL_CONTENT_THRESHOLD = 200;
|
|
@@ -12461,7 +12265,6 @@ var ChildRunInvoker = class {
|
|
|
12461
12265
|
createLlmNode;
|
|
12462
12266
|
toolRuntime;
|
|
12463
12267
|
observationPreview;
|
|
12464
|
-
modelInputCapabilityValidator;
|
|
12465
12268
|
modelInputResolver;
|
|
12466
12269
|
eventToMessageConverter;
|
|
12467
12270
|
defaultJudgeToolName;
|
|
@@ -12472,7 +12275,6 @@ var ChildRunInvoker = class {
|
|
|
12472
12275
|
this.createLlmNode = dependencies.createLlmNode;
|
|
12473
12276
|
this.toolRuntime = dependencies.toolRuntime;
|
|
12474
12277
|
this.observationPreview = dependencies.observationPreview;
|
|
12475
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
12476
12278
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
12477
12279
|
this.eventToMessageConverter = dependencies.eventToMessageConverter;
|
|
12478
12280
|
this.defaultJudgeToolName = dependencies.defaultJudgeToolName;
|
|
@@ -12735,7 +12537,6 @@ var ChildRunInvoker = class {
|
|
|
12735
12537
|
observationPreview: this.observationPreview,
|
|
12736
12538
|
telemetryPort: this.telemetryPort,
|
|
12737
12539
|
auditPort: this.auditPort,
|
|
12738
|
-
modelInputCapabilityValidator: this.modelInputCapabilityValidator,
|
|
12739
12540
|
modelInputResolver: this.modelInputResolver
|
|
12740
12541
|
}));
|
|
12741
12542
|
graph.registerNode(new WaitUserNode({ auditPort: this.auditPort }));
|
|
@@ -14845,7 +14646,6 @@ function createDefaultGraphExecutor(options) {
|
|
|
14845
14646
|
observationPreview: options.observationPreview,
|
|
14846
14647
|
auditPort: options.auditPort,
|
|
14847
14648
|
telemetryPort: options.telemetryPort,
|
|
14848
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
14849
14649
|
modelInputResolver: options.modelInputResolver
|
|
14850
14650
|
}));
|
|
14851
14651
|
executor2.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
|
|
@@ -14884,7 +14684,6 @@ function createGraphLoopHarness(options) {
|
|
|
14884
14684
|
maxSteps,
|
|
14885
14685
|
auditPort: options.auditPort,
|
|
14886
14686
|
telemetryPort: options.telemetryPort,
|
|
14887
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
14888
14687
|
modelInputResolver: options.modelInputResolver
|
|
14889
14688
|
});
|
|
14890
14689
|
const local = {
|