@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
package/dist/index.js
CHANGED
|
@@ -5031,7 +5031,6 @@ var tickPipelineContextKeys = [
|
|
|
5031
5031
|
"runtimeEventCommitPort",
|
|
5032
5032
|
"modelId",
|
|
5033
5033
|
"toolSchemas",
|
|
5034
|
-
"toolModelInputRequirement",
|
|
5035
5034
|
"toolCallStreamingPolicies",
|
|
5036
5035
|
"llmOptions",
|
|
5037
5036
|
"toolDefinitionTokens",
|
|
@@ -6152,7 +6151,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
6152
6151
|
"outputProcessor",
|
|
6153
6152
|
"modelId",
|
|
6154
6153
|
"llmMessages",
|
|
6155
|
-
"toolModelInputRequirement",
|
|
6156
6154
|
"toolCallStreamingPolicies",
|
|
6157
6155
|
"imageInputAdmissionEvidence",
|
|
6158
6156
|
"llmOptions",
|
|
@@ -6211,7 +6209,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
6211
6209
|
},
|
|
6212
6210
|
{
|
|
6213
6211
|
imageInputAdmissionEvidence: ctx.imageInputAdmissionEvidence,
|
|
6214
|
-
additionalModelInputRequirement: ctx.toolModelInputRequirement,
|
|
6215
6212
|
toolCallStreamingPolicies: ctx.toolCallStreamingPolicies,
|
|
6216
6213
|
...promptBudget && promptUsageMeasurementPolicy ? {
|
|
6217
6214
|
measurePromptUsage: async (activeModelId, messages) => {
|
|
@@ -7196,29 +7193,6 @@ function createCommitContextCompactionStage() {
|
|
|
7196
7193
|
});
|
|
7197
7194
|
}
|
|
7198
7195
|
|
|
7199
|
-
// src/runtime-kernel/graph-engine/functions/prepareModelCompatibleTools.ts
|
|
7200
|
-
function prepareModelCompatibleTools(input) {
|
|
7201
|
-
const schemas = [];
|
|
7202
|
-
const requirements = [];
|
|
7203
|
-
for (const schema of input.schemas) {
|
|
7204
|
-
const definition = input.getToolDefinition(schema.function.name);
|
|
7205
|
-
const requirement = definition?.modelInputRequirement;
|
|
7206
|
-
const delivery = definition?.modelInputDelivery ?? "required";
|
|
7207
|
-
const isRequired = delivery === "required";
|
|
7208
|
-
if (requirement && isRequired && !evaluateModelInputCompatibility(input.model, requirement).compatible) {
|
|
7209
|
-
continue;
|
|
7210
|
-
}
|
|
7211
|
-
schemas.push(schema);
|
|
7212
|
-
if (requirement && isRequired) {
|
|
7213
|
-
requirements.push(requirement);
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
|
-
return {
|
|
7217
|
-
schemas: Object.freeze(schemas),
|
|
7218
|
-
requirement: requirements.length > 0 ? mergeModelInputRequirements(...requirements) : EMPTY_MODEL_INPUT_REQUIREMENT
|
|
7219
|
-
};
|
|
7220
|
-
}
|
|
7221
|
-
|
|
7222
7196
|
// src/runtime-kernel/graph-engine/tick-pipeline/stages/prepareCallStage.ts
|
|
7223
7197
|
function createPrepareCallStage(dependencies) {
|
|
7224
7198
|
return defineTickStage({
|
|
@@ -7236,7 +7210,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
7236
7210
|
writes: [
|
|
7237
7211
|
"modelId",
|
|
7238
7212
|
"toolSchemas",
|
|
7239
|
-
"toolModelInputRequirement",
|
|
7240
7213
|
"toolCallStreamingPolicies",
|
|
7241
7214
|
"llmOptions",
|
|
7242
7215
|
"toolDefinitionTokens"
|
|
@@ -7276,12 +7249,7 @@ function createPrepareCallStage(dependencies) {
|
|
|
7276
7249
|
invocation: ctx.request
|
|
7277
7250
|
});
|
|
7278
7251
|
const modelConfig = dependencies.modelCatalog.getModelById(modelId);
|
|
7279
|
-
const
|
|
7280
|
-
schemas: candidateToolSchemas,
|
|
7281
|
-
model: modelConfig,
|
|
7282
|
-
getToolDefinition: (toolName) => dependencies.toolCatalog.getToolDefinition(toolName)
|
|
7283
|
-
});
|
|
7284
|
-
const toolSchemas = [...toolPreparation.schemas];
|
|
7252
|
+
const toolSchemas = [...candidateToolSchemas];
|
|
7285
7253
|
const toolCallStreamingPolicies = deriveToolCallStreamingPolicies(
|
|
7286
7254
|
toolSchemas,
|
|
7287
7255
|
dependencies.toolCatalog
|
|
@@ -7325,7 +7293,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
7325
7293
|
return {
|
|
7326
7294
|
modelId,
|
|
7327
7295
|
toolSchemas,
|
|
7328
|
-
toolModelInputRequirement: toolPreparation.requirement,
|
|
7329
7296
|
toolCallStreamingPolicies,
|
|
7330
7297
|
llmOptions,
|
|
7331
7298
|
toolDefinitionTokens
|
|
@@ -7499,7 +7466,6 @@ var GraphAgentExecutor = class {
|
|
|
7499
7466
|
modelId: "",
|
|
7500
7467
|
toolSchemas: [],
|
|
7501
7468
|
toolCallStreamingPolicies: {},
|
|
7502
|
-
toolModelInputRequirement: void 0,
|
|
7503
7469
|
llmOptions: {},
|
|
7504
7470
|
toolDefinitionTokens: 0,
|
|
7505
7471
|
llmMessages: [],
|
|
@@ -8751,10 +8717,6 @@ function parseToolModelInputDeclaration(value) {
|
|
|
8751
8717
|
}
|
|
8752
8718
|
|
|
8753
8719
|
// src/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.ts
|
|
8754
|
-
var TOOL_RESULT_IMAGE_REQUIREMENT = {
|
|
8755
|
-
requires_image_input: true,
|
|
8756
|
-
placements: ["tool_result_image"]
|
|
8757
|
-
};
|
|
8758
8720
|
async function resolveToolModelInput(input) {
|
|
8759
8721
|
if (!input.selections) {
|
|
8760
8722
|
return void 0;
|
|
@@ -8775,16 +8737,6 @@ async function resolveToolModelInput(input) {
|
|
|
8775
8737
|
if (parsed.data.some((reference, index) => reference.id !== input.selections?.[index]?.id)) {
|
|
8776
8738
|
throw new ToolModelInputResolutionError("Tool model input resolver changed attachment identity or order.");
|
|
8777
8739
|
}
|
|
8778
|
-
if (!input.activeModelId) {
|
|
8779
|
-
throw new ToolModelInputResolutionError("Missing successful LLM model for tool input validation.");
|
|
8780
|
-
}
|
|
8781
|
-
if (!input.capabilityValidator) {
|
|
8782
|
-
throw new ToolModelInputResolutionError("Tool model input validator is not configured.");
|
|
8783
|
-
}
|
|
8784
|
-
input.capabilityValidator.assertCompatible({
|
|
8785
|
-
activeModelId: input.activeModelId,
|
|
8786
|
-
requirement: TOOL_RESULT_IMAGE_REQUIREMENT
|
|
8787
|
-
});
|
|
8788
8740
|
return Object.freeze(parsed.data.map((reference) => Object.freeze(reference)));
|
|
8789
8741
|
}
|
|
8790
8742
|
|
|
@@ -9249,8 +9201,7 @@ var TOOL_CONTEXT_RUNTIME_RESERVED_KEYS = [
|
|
|
9249
9201
|
"parentRunId",
|
|
9250
9202
|
"childRunDepth",
|
|
9251
9203
|
"childRunContextInjections",
|
|
9252
|
-
"parentToolCallId"
|
|
9253
|
-
"modelInputAdmission"
|
|
9204
|
+
"parentToolCallId"
|
|
9254
9205
|
];
|
|
9255
9206
|
var TOOL_CONTEXT_RUNTIME_BINDINGS_KEY = /* @__PURE__ */ Symbol.for(
|
|
9256
9207
|
"@linnlabs/linnkit/tool-context-runtime-bindings/v1"
|
|
@@ -9551,7 +9502,6 @@ var ToolNodeEventBridge = class {
|
|
|
9551
9502
|
|
|
9552
9503
|
// src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
|
|
9553
9504
|
var logger10 = new Logger("ToolNode");
|
|
9554
|
-
var MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR = "tool.model_input.requirement_resolution_failed: Tool model input requirement could not be resolved";
|
|
9555
9505
|
function parseToolArgs(call) {
|
|
9556
9506
|
const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
|
|
9557
9507
|
if (!rawArguments.trim()) {
|
|
@@ -9655,12 +9605,6 @@ function prepareToolExecution(params) {
|
|
|
9655
9605
|
toolArgs,
|
|
9656
9606
|
idempotencyKey
|
|
9657
9607
|
});
|
|
9658
|
-
const modelInputRequirement = resolveModelInputRequirement({
|
|
9659
|
-
toolDefinition,
|
|
9660
|
-
toolArgs,
|
|
9661
|
-
hasProtocolError: protocolError !== void 0,
|
|
9662
|
-
toolName
|
|
9663
|
-
});
|
|
9664
9608
|
return {
|
|
9665
9609
|
call: params.call,
|
|
9666
9610
|
toolName,
|
|
@@ -9669,30 +9613,9 @@ function prepareToolExecution(params) {
|
|
|
9669
9613
|
toolArgs,
|
|
9670
9614
|
protocolError,
|
|
9671
9615
|
idempotencyKey,
|
|
9672
|
-
...modelInputRequirement.requirement ? { modelInputRequirement: modelInputRequirement.requirement } : {},
|
|
9673
|
-
modelInputDelivery: toolDefinition?.modelInputDelivery ?? "required",
|
|
9674
|
-
...modelInputRequirement.error ? { modelInputRequirementError: modelInputRequirement.error } : {},
|
|
9675
9616
|
bridge
|
|
9676
9617
|
};
|
|
9677
9618
|
}
|
|
9678
|
-
function resolveModelInputRequirement(params) {
|
|
9679
|
-
if (params.hasProtocolError) {
|
|
9680
|
-
return {};
|
|
9681
|
-
}
|
|
9682
|
-
if (!params.toolDefinition?.resolveModelInputRequirement) {
|
|
9683
|
-
return params.toolDefinition?.modelInputRequirement ? { requirement: params.toolDefinition.modelInputRequirement } : {};
|
|
9684
|
-
}
|
|
9685
|
-
try {
|
|
9686
|
-
const requirement = params.toolDefinition.resolveModelInputRequirement(params.toolArgs);
|
|
9687
|
-
return requirement ? { requirement } : {};
|
|
9688
|
-
} catch (error) {
|
|
9689
|
-
logger10.warn("dynamic model input requirement resolution failed", {
|
|
9690
|
-
toolName: params.toolName,
|
|
9691
|
-
errorName: error instanceof Error ? error.name : "UnknownError"
|
|
9692
|
-
});
|
|
9693
|
-
return { error: MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR };
|
|
9694
|
-
}
|
|
9695
|
-
}
|
|
9696
9619
|
function attachWorkingHistoryView(params) {
|
|
9697
9620
|
const historyEvents = parseRuntimeEvents(
|
|
9698
9621
|
params.state.local?.history ?? []
|
|
@@ -9931,14 +9854,6 @@ function readToolObservationPolicy(local) {
|
|
|
9931
9854
|
function readHistoryEvents(local) {
|
|
9932
9855
|
return parseRuntimeEvents(local.history ?? []);
|
|
9933
9856
|
}
|
|
9934
|
-
function readLastSuccessfulLlmModelId(local) {
|
|
9935
|
-
const executorLocal = local.executorLocal;
|
|
9936
|
-
if (!isRecord9(executorLocal)) {
|
|
9937
|
-
return void 0;
|
|
9938
|
-
}
|
|
9939
|
-
const value = executorLocal.lastSuccessfulLlmModelId;
|
|
9940
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
9941
|
-
}
|
|
9942
9857
|
function formatCapabilityError(error) {
|
|
9943
9858
|
if (isRecord9(error)) {
|
|
9944
9859
|
const codeValue = error.errorCode ?? error.code;
|
|
@@ -9950,29 +9865,12 @@ function formatCapabilityError(error) {
|
|
|
9950
9865
|
}
|
|
9951
9866
|
return error instanceof Error ? error.message : String(error);
|
|
9952
9867
|
}
|
|
9953
|
-
function bindModelInputAdmission(input) {
|
|
9954
|
-
input.context.modelInputAdmission = Object.freeze({
|
|
9955
|
-
requirement: Object.freeze({
|
|
9956
|
-
...input.requirement,
|
|
9957
|
-
placements: Object.freeze([...input.requirement.placements])
|
|
9958
|
-
}),
|
|
9959
|
-
delivery: input.delivery,
|
|
9960
|
-
admitted: input.admitted
|
|
9961
|
-
});
|
|
9962
|
-
}
|
|
9963
|
-
function isOptionalImageInputIncompatibility(reason) {
|
|
9964
|
-
return reason === "image_input_unsupported" || reason === "placement_unsupported";
|
|
9965
|
-
}
|
|
9966
|
-
function shouldDeliverToolModelInput(input) {
|
|
9967
|
-
return input.delivery === "required" || input.context.modelInputAdmission?.admitted === true;
|
|
9968
|
-
}
|
|
9969
9868
|
var ToolNode = class {
|
|
9970
9869
|
id = "tool";
|
|
9971
9870
|
toolRuntime;
|
|
9972
9871
|
observationPreview;
|
|
9973
9872
|
telemetryPort;
|
|
9974
9873
|
auditPort;
|
|
9975
|
-
modelInputCapabilityValidator;
|
|
9976
9874
|
modelInputResolver;
|
|
9977
9875
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
9978
9876
|
constructor(dependencies) {
|
|
@@ -9980,7 +9878,6 @@ var ToolNode = class {
|
|
|
9980
9878
|
this.observationPreview = dependencies.observationPreview;
|
|
9981
9879
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
9982
9880
|
this.auditPort = dependencies.auditPort ?? noopAudit;
|
|
9983
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
9984
9881
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
9985
9882
|
}
|
|
9986
9883
|
/**
|
|
@@ -10146,7 +10043,6 @@ var ToolNode = class {
|
|
|
10146
10043
|
logger11.warn("no tool name found in call");
|
|
10147
10044
|
return { kind: "yield", events: [] };
|
|
10148
10045
|
}
|
|
10149
|
-
delete prepared.toolContext.modelInputAdmission;
|
|
10150
10046
|
if (typeof execution.protocolError === "string") {
|
|
10151
10047
|
return this.handleError({
|
|
10152
10048
|
...prepared,
|
|
@@ -10164,88 +10060,6 @@ var ToolNode = class {
|
|
|
10164
10060
|
bridge: execution.bridge
|
|
10165
10061
|
});
|
|
10166
10062
|
}
|
|
10167
|
-
if (typeof execution.modelInputRequirementError === "string") {
|
|
10168
|
-
return this.handleError({
|
|
10169
|
-
...prepared,
|
|
10170
|
-
calls,
|
|
10171
|
-
call,
|
|
10172
|
-
toolName: execution.toolName,
|
|
10173
|
-
toolCallId: execution.toolCallId,
|
|
10174
|
-
toolArgs: execution.toolArgs,
|
|
10175
|
-
exec: {
|
|
10176
|
-
success: false,
|
|
10177
|
-
error: execution.modelInputRequirementError,
|
|
10178
|
-
errorKind: "capability",
|
|
10179
|
-
durationMs: 0
|
|
10180
|
-
},
|
|
10181
|
-
bridge: execution.bridge
|
|
10182
|
-
});
|
|
10183
|
-
}
|
|
10184
|
-
if (execution.modelInputRequirement?.requires_image_input === true) {
|
|
10185
|
-
const activeModelId = readLastSuccessfulLlmModelId(prepared.local);
|
|
10186
|
-
let capabilityError;
|
|
10187
|
-
let admitted = true;
|
|
10188
|
-
if (!activeModelId) {
|
|
10189
|
-
capabilityError = "llm.unsupported_capability: missing successful LLM model for tool input validation";
|
|
10190
|
-
} else if (!this.modelInputCapabilityValidator) {
|
|
10191
|
-
capabilityError = "llm.unsupported_capability: tool model input validator is not configured";
|
|
10192
|
-
} else {
|
|
10193
|
-
const validationInput = {
|
|
10194
|
-
activeModelId,
|
|
10195
|
-
requirement: execution.modelInputRequirement
|
|
10196
|
-
};
|
|
10197
|
-
if (execution.modelInputDelivery === "when_supported") {
|
|
10198
|
-
try {
|
|
10199
|
-
const compatibility = this.modelInputCapabilityValidator.evaluate(validationInput);
|
|
10200
|
-
if (!compatibility.compatible) {
|
|
10201
|
-
if (isOptionalImageInputIncompatibility(compatibility.reason)) {
|
|
10202
|
-
admitted = false;
|
|
10203
|
-
logger11.debug("optional tool model input omitted for incompatible active model", {
|
|
10204
|
-
toolName: execution.toolName,
|
|
10205
|
-
activeModelId,
|
|
10206
|
-
reason: compatibility.reason,
|
|
10207
|
-
placements: execution.modelInputRequirement.placements
|
|
10208
|
-
});
|
|
10209
|
-
} else {
|
|
10210
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
10211
|
-
capabilityError = "llm.unsupported_capability: active model is not eligible";
|
|
10212
|
-
}
|
|
10213
|
-
}
|
|
10214
|
-
} catch (error) {
|
|
10215
|
-
capabilityError = formatCapabilityError(error);
|
|
10216
|
-
}
|
|
10217
|
-
} else {
|
|
10218
|
-
try {
|
|
10219
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
10220
|
-
} catch (error) {
|
|
10221
|
-
capabilityError = formatCapabilityError(error);
|
|
10222
|
-
}
|
|
10223
|
-
}
|
|
10224
|
-
}
|
|
10225
|
-
if (capabilityError) {
|
|
10226
|
-
return this.handleError({
|
|
10227
|
-
...prepared,
|
|
10228
|
-
calls,
|
|
10229
|
-
call,
|
|
10230
|
-
toolName: execution.toolName,
|
|
10231
|
-
toolCallId: execution.toolCallId,
|
|
10232
|
-
toolArgs: execution.toolArgs,
|
|
10233
|
-
exec: {
|
|
10234
|
-
success: false,
|
|
10235
|
-
error: capabilityError,
|
|
10236
|
-
errorKind: "capability",
|
|
10237
|
-
durationMs: 0
|
|
10238
|
-
},
|
|
10239
|
-
bridge: execution.bridge
|
|
10240
|
-
});
|
|
10241
|
-
}
|
|
10242
|
-
bindModelInputAdmission({
|
|
10243
|
-
context: prepared.toolContext,
|
|
10244
|
-
requirement: execution.modelInputRequirement,
|
|
10245
|
-
delivery: execution.modelInputDelivery,
|
|
10246
|
-
admitted
|
|
10247
|
-
});
|
|
10248
|
-
}
|
|
10249
10063
|
await this.emitToolDecisionAudit({
|
|
10250
10064
|
action: "tool.allow",
|
|
10251
10065
|
toolName: execution.toolName,
|
|
@@ -10297,21 +10111,15 @@ var ToolNode = class {
|
|
|
10297
10111
|
bridge: execution.bridge
|
|
10298
10112
|
});
|
|
10299
10113
|
}
|
|
10300
|
-
|
|
10301
|
-
context: prepared.toolContext,
|
|
10302
|
-
delivery: execution.modelInputDelivery
|
|
10303
|
-
});
|
|
10304
|
-
let attachments = deliverModelInput ? exec.cachedAttachments : void 0;
|
|
10114
|
+
let attachments = exec.cachedAttachments;
|
|
10305
10115
|
try {
|
|
10306
|
-
if (
|
|
10116
|
+
if (!attachments) {
|
|
10307
10117
|
attachments = await resolveToolModelInput({
|
|
10308
|
-
activeModelId: readLastSuccessfulLlmModelId(prepared.local),
|
|
10309
10118
|
toolName: execution.toolName,
|
|
10310
10119
|
toolCallId: execution.toolCallId,
|
|
10311
10120
|
selections: contract.modelInputAttachments,
|
|
10312
10121
|
context: prepared.toolContext,
|
|
10313
|
-
resolver: this.modelInputResolver
|
|
10314
|
-
capabilityValidator: this.modelInputCapabilityValidator
|
|
10122
|
+
resolver: this.modelInputResolver
|
|
10315
10123
|
});
|
|
10316
10124
|
}
|
|
10317
10125
|
} catch (error) {
|
|
@@ -11020,10 +10828,6 @@ function formatUnknownToolArguments(fields, allowedFields) {
|
|
|
11020
10828
|
// src/runtime-kernel/tools/toolContracts.ts
|
|
11021
10829
|
var BaseTool = class {
|
|
11022
10830
|
idempotency;
|
|
11023
|
-
modelInputRequirement;
|
|
11024
|
-
/** 模型输入是工具成功的必要结果,还是仅在当前模型支持时提供的增强反馈。 */
|
|
11025
|
-
modelInputDelivery;
|
|
11026
|
-
resolveModelInputRequirement;
|
|
11027
10831
|
streaming;
|
|
11028
10832
|
getExecutionSummary(output) {
|
|
11029
10833
|
const FULL_CONTENT_THRESHOLD = 200;
|
|
@@ -13301,7 +13105,6 @@ var ChildRunInvoker = class {
|
|
|
13301
13105
|
createLlmNode;
|
|
13302
13106
|
toolRuntime;
|
|
13303
13107
|
observationPreview;
|
|
13304
|
-
modelInputCapabilityValidator;
|
|
13305
13108
|
modelInputResolver;
|
|
13306
13109
|
eventToMessageConverter;
|
|
13307
13110
|
defaultJudgeToolName;
|
|
@@ -13312,7 +13115,6 @@ var ChildRunInvoker = class {
|
|
|
13312
13115
|
this.createLlmNode = dependencies.createLlmNode;
|
|
13313
13116
|
this.toolRuntime = dependencies.toolRuntime;
|
|
13314
13117
|
this.observationPreview = dependencies.observationPreview;
|
|
13315
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
13316
13118
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
13317
13119
|
this.eventToMessageConverter = dependencies.eventToMessageConverter;
|
|
13318
13120
|
this.defaultJudgeToolName = dependencies.defaultJudgeToolName;
|
|
@@ -13575,7 +13377,6 @@ var ChildRunInvoker = class {
|
|
|
13575
13377
|
observationPreview: this.observationPreview,
|
|
13576
13378
|
telemetryPort: this.telemetryPort,
|
|
13577
13379
|
auditPort: this.auditPort,
|
|
13578
|
-
modelInputCapabilityValidator: this.modelInputCapabilityValidator,
|
|
13579
13380
|
modelInputResolver: this.modelInputResolver
|
|
13580
13381
|
}));
|
|
13581
13382
|
graph.registerNode(new WaitUserNode({ auditPort: this.auditPort }));
|
|
@@ -15685,7 +15486,6 @@ function createDefaultGraphExecutor(options) {
|
|
|
15685
15486
|
observationPreview: options.observationPreview,
|
|
15686
15487
|
auditPort: options.auditPort,
|
|
15687
15488
|
telemetryPort: options.telemetryPort,
|
|
15688
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
15689
15489
|
modelInputResolver: options.modelInputResolver
|
|
15690
15490
|
}));
|
|
15691
15491
|
executor2.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
|
|
@@ -15724,7 +15524,6 @@ function createGraphLoopHarness(options) {
|
|
|
15724
15524
|
maxSteps,
|
|
15725
15525
|
auditPort: options.auditPort,
|
|
15726
15526
|
telemetryPort: options.telemetryPort,
|
|
15727
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
15728
15527
|
modelInputResolver: options.modelInputResolver
|
|
15729
15528
|
});
|
|
15730
15529
|
const local = {
|
|
@@ -15998,11 +15797,7 @@ var QuickstartMemoryToolRuntime = class {
|
|
|
15998
15797
|
return {
|
|
15999
15798
|
parameters: tool.parameters,
|
|
16000
15799
|
validateArguments: (args) => tool["validateArguments"](args),
|
|
16001
|
-
idempotency: tool.idempotency
|
|
16002
|
-
modelInputRequirement: tool.modelInputRequirement,
|
|
16003
|
-
...tool.resolveModelInputRequirement ? {
|
|
16004
|
-
resolveModelInputRequirement: (args) => tool.resolveModelInputRequirement?.(args)
|
|
16005
|
-
} : {}
|
|
15800
|
+
idempotency: tool.idempotency
|
|
16006
15801
|
};
|
|
16007
15802
|
}
|
|
16008
15803
|
async executeTool(toolName, args, context) {
|