@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/dist/cli.js
CHANGED
|
@@ -3102,6 +3102,16 @@ function mergeResumeSessionLocal(persistedLocal, localPatch) {
|
|
|
3102
3102
|
}
|
|
3103
3103
|
};
|
|
3104
3104
|
}
|
|
3105
|
+
function resolveResumeNodeId(local, requested) {
|
|
3106
|
+
const pending = local?.pendingToolCalls;
|
|
3107
|
+
if (!Array.isArray(pending) || pending.length === 0) return requested ?? "llm";
|
|
3108
|
+
if (requested !== void 0 && requested !== "tool") {
|
|
3109
|
+
throw new Error(
|
|
3110
|
+
`Graph resume must first run ${pending.length} pending tool call(s) from the interrupted batch: requested node=${requested}`
|
|
3111
|
+
);
|
|
3112
|
+
}
|
|
3113
|
+
return "tool";
|
|
3114
|
+
}
|
|
3105
3115
|
var GraphExecutor = class {
|
|
3106
3116
|
constructor(checkpointer, config = {}) {
|
|
3107
3117
|
this.checkpointer = checkpointer;
|
|
@@ -3214,13 +3224,14 @@ var GraphExecutor = class {
|
|
|
3214
3224
|
);
|
|
3215
3225
|
}
|
|
3216
3226
|
const resumedLocal = mergeResumeSessionLocal(current.local, input.localPatch);
|
|
3227
|
+
const nodeId = resolveResumeNodeId(resumedLocal, input.nodeId);
|
|
3217
3228
|
if (this.executionCheckpointPort && current.local?.executorLocal) {
|
|
3218
3229
|
resumedLocal.executorLocal = { ...current.local.executorLocal };
|
|
3219
3230
|
}
|
|
3220
3231
|
this.ephemeralLocals.set(checkpointKey, resumedLocal);
|
|
3221
3232
|
await this.commitCheckpoint(checkpointKey, {
|
|
3222
3233
|
...current,
|
|
3223
|
-
nodeId
|
|
3234
|
+
nodeId,
|
|
3224
3235
|
...this.executionCheckpointPort ? { executionStatus: "ready" } : {},
|
|
3225
3236
|
revision: currentRevision + 1,
|
|
3226
3237
|
local: sanitizeCheckpointLocal(resumedLocal)
|
|
@@ -4101,7 +4112,6 @@ var tickPipelineContextKeys = [
|
|
|
4101
4112
|
"runtimeEventCommitPort",
|
|
4102
4113
|
"modelId",
|
|
4103
4114
|
"toolSchemas",
|
|
4104
|
-
"toolModelInputRequirement",
|
|
4105
4115
|
"toolCallStreamingPolicies",
|
|
4106
4116
|
"llmOptions",
|
|
4107
4117
|
"toolDefinitionTokens",
|
|
@@ -5004,7 +5014,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5004
5014
|
"outputProcessor",
|
|
5005
5015
|
"modelId",
|
|
5006
5016
|
"llmMessages",
|
|
5007
|
-
"toolModelInputRequirement",
|
|
5008
5017
|
"toolCallStreamingPolicies",
|
|
5009
5018
|
"imageInputAdmissionEvidence",
|
|
5010
5019
|
"llmOptions",
|
|
@@ -5063,7 +5072,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5063
5072
|
},
|
|
5064
5073
|
{
|
|
5065
5074
|
imageInputAdmissionEvidence: ctx.imageInputAdmissionEvidence,
|
|
5066
|
-
additionalModelInputRequirement: ctx.toolModelInputRequirement,
|
|
5067
5075
|
toolCallStreamingPolicies: ctx.toolCallStreamingPolicies,
|
|
5068
5076
|
...promptBudget && promptUsageMeasurementPolicy ? {
|
|
5069
5077
|
measurePromptUsage: async (activeModelId, messages) => {
|
|
@@ -6048,29 +6056,6 @@ function createCommitContextCompactionStage() {
|
|
|
6048
6056
|
});
|
|
6049
6057
|
}
|
|
6050
6058
|
|
|
6051
|
-
// src/runtime-kernel/graph-engine/functions/prepareModelCompatibleTools.ts
|
|
6052
|
-
function prepareModelCompatibleTools(input) {
|
|
6053
|
-
const schemas = [];
|
|
6054
|
-
const requirements = [];
|
|
6055
|
-
for (const schema of input.schemas) {
|
|
6056
|
-
const definition = input.getToolDefinition(schema.function.name);
|
|
6057
|
-
const requirement = definition?.modelInputRequirement;
|
|
6058
|
-
const delivery = definition?.modelInputDelivery ?? "required";
|
|
6059
|
-
const isRequired = delivery === "required";
|
|
6060
|
-
if (requirement && isRequired && !evaluateModelInputCompatibility(input.model, requirement).compatible) {
|
|
6061
|
-
continue;
|
|
6062
|
-
}
|
|
6063
|
-
schemas.push(schema);
|
|
6064
|
-
if (requirement && isRequired) {
|
|
6065
|
-
requirements.push(requirement);
|
|
6066
|
-
}
|
|
6067
|
-
}
|
|
6068
|
-
return {
|
|
6069
|
-
schemas: Object.freeze(schemas),
|
|
6070
|
-
requirement: requirements.length > 0 ? mergeModelInputRequirements(...requirements) : EMPTY_MODEL_INPUT_REQUIREMENT
|
|
6071
|
-
};
|
|
6072
|
-
}
|
|
6073
|
-
|
|
6074
6059
|
// src/runtime-kernel/graph-engine/tick-pipeline/stages/prepareCallStage.ts
|
|
6075
6060
|
function createPrepareCallStage(dependencies) {
|
|
6076
6061
|
return defineTickStage({
|
|
@@ -6088,7 +6073,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6088
6073
|
writes: [
|
|
6089
6074
|
"modelId",
|
|
6090
6075
|
"toolSchemas",
|
|
6091
|
-
"toolModelInputRequirement",
|
|
6092
6076
|
"toolCallStreamingPolicies",
|
|
6093
6077
|
"llmOptions",
|
|
6094
6078
|
"toolDefinitionTokens"
|
|
@@ -6128,12 +6112,7 @@ function createPrepareCallStage(dependencies) {
|
|
|
6128
6112
|
invocation: ctx.request
|
|
6129
6113
|
});
|
|
6130
6114
|
const modelConfig = dependencies.modelCatalog.getModelById(modelId);
|
|
6131
|
-
const
|
|
6132
|
-
schemas: candidateToolSchemas,
|
|
6133
|
-
model: modelConfig,
|
|
6134
|
-
getToolDefinition: (toolName) => dependencies.toolCatalog.getToolDefinition(toolName)
|
|
6135
|
-
});
|
|
6136
|
-
const toolSchemas = [...toolPreparation.schemas];
|
|
6115
|
+
const toolSchemas = [...candidateToolSchemas];
|
|
6137
6116
|
const toolCallStreamingPolicies = deriveToolCallStreamingPolicies(
|
|
6138
6117
|
toolSchemas,
|
|
6139
6118
|
dependencies.toolCatalog
|
|
@@ -6177,7 +6156,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6177
6156
|
return {
|
|
6178
6157
|
modelId,
|
|
6179
6158
|
toolSchemas,
|
|
6180
|
-
toolModelInputRequirement: toolPreparation.requirement,
|
|
6181
6159
|
toolCallStreamingPolicies,
|
|
6182
6160
|
llmOptions,
|
|
6183
6161
|
toolDefinitionTokens
|
|
@@ -6351,7 +6329,6 @@ var GraphAgentExecutor = class {
|
|
|
6351
6329
|
modelId: "",
|
|
6352
6330
|
toolSchemas: [],
|
|
6353
6331
|
toolCallStreamingPolicies: {},
|
|
6354
|
-
toolModelInputRequirement: void 0,
|
|
6355
6332
|
llmOptions: {},
|
|
6356
6333
|
toolDefinitionTokens: 0,
|
|
6357
6334
|
llmMessages: [],
|
|
@@ -7603,10 +7580,6 @@ function parseToolModelInputDeclaration(value) {
|
|
|
7603
7580
|
}
|
|
7604
7581
|
|
|
7605
7582
|
// src/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.ts
|
|
7606
|
-
var TOOL_RESULT_IMAGE_REQUIREMENT = {
|
|
7607
|
-
requires_image_input: true,
|
|
7608
|
-
placements: ["tool_result_image"]
|
|
7609
|
-
};
|
|
7610
7583
|
async function resolveToolModelInput(input) {
|
|
7611
7584
|
if (!input.selections) {
|
|
7612
7585
|
return void 0;
|
|
@@ -7627,16 +7600,6 @@ async function resolveToolModelInput(input) {
|
|
|
7627
7600
|
if (parsed.data.some((reference, index) => reference.id !== input.selections?.[index]?.id)) {
|
|
7628
7601
|
throw new ToolModelInputResolutionError("Tool model input resolver changed attachment identity or order.");
|
|
7629
7602
|
}
|
|
7630
|
-
if (!input.activeModelId) {
|
|
7631
|
-
throw new ToolModelInputResolutionError("Missing successful LLM model for tool input validation.");
|
|
7632
|
-
}
|
|
7633
|
-
if (!input.capabilityValidator) {
|
|
7634
|
-
throw new ToolModelInputResolutionError("Tool model input validator is not configured.");
|
|
7635
|
-
}
|
|
7636
|
-
input.capabilityValidator.assertCompatible({
|
|
7637
|
-
activeModelId: input.activeModelId,
|
|
7638
|
-
requirement: TOOL_RESULT_IMAGE_REQUIREMENT
|
|
7639
|
-
});
|
|
7640
7603
|
return Object.freeze(parsed.data.map((reference) => Object.freeze(reference)));
|
|
7641
7604
|
}
|
|
7642
7605
|
|
|
@@ -8342,7 +8305,6 @@ var ToolNodeEventBridge = class {
|
|
|
8342
8305
|
|
|
8343
8306
|
// src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
|
|
8344
8307
|
var logger10 = new Logger("ToolNode");
|
|
8345
|
-
var MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR = "tool.model_input.requirement_resolution_failed: Tool model input requirement could not be resolved";
|
|
8346
8308
|
function parseToolArgs(call) {
|
|
8347
8309
|
const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
|
|
8348
8310
|
if (!rawArguments.trim()) {
|
|
@@ -8446,12 +8408,6 @@ function prepareToolExecution(params) {
|
|
|
8446
8408
|
toolArgs,
|
|
8447
8409
|
idempotencyKey
|
|
8448
8410
|
});
|
|
8449
|
-
const modelInputRequirement = resolveModelInputRequirement({
|
|
8450
|
-
toolDefinition,
|
|
8451
|
-
toolArgs,
|
|
8452
|
-
hasProtocolError: protocolError !== void 0,
|
|
8453
|
-
toolName
|
|
8454
|
-
});
|
|
8455
8411
|
return {
|
|
8456
8412
|
call: params.call,
|
|
8457
8413
|
toolName,
|
|
@@ -8460,30 +8416,9 @@ function prepareToolExecution(params) {
|
|
|
8460
8416
|
toolArgs,
|
|
8461
8417
|
protocolError,
|
|
8462
8418
|
idempotencyKey,
|
|
8463
|
-
...modelInputRequirement.requirement ? { modelInputRequirement: modelInputRequirement.requirement } : {},
|
|
8464
|
-
modelInputDelivery: toolDefinition?.modelInputDelivery ?? "required",
|
|
8465
|
-
...modelInputRequirement.error ? { modelInputRequirementError: modelInputRequirement.error } : {},
|
|
8466
8419
|
bridge
|
|
8467
8420
|
};
|
|
8468
8421
|
}
|
|
8469
|
-
function resolveModelInputRequirement(params) {
|
|
8470
|
-
if (params.hasProtocolError) {
|
|
8471
|
-
return {};
|
|
8472
|
-
}
|
|
8473
|
-
if (!params.toolDefinition?.resolveModelInputRequirement) {
|
|
8474
|
-
return params.toolDefinition?.modelInputRequirement ? { requirement: params.toolDefinition.modelInputRequirement } : {};
|
|
8475
|
-
}
|
|
8476
|
-
try {
|
|
8477
|
-
const requirement = params.toolDefinition.resolveModelInputRequirement(params.toolArgs);
|
|
8478
|
-
return requirement ? { requirement } : {};
|
|
8479
|
-
} catch (error) {
|
|
8480
|
-
logger10.warn("dynamic model input requirement resolution failed", {
|
|
8481
|
-
toolName: params.toolName,
|
|
8482
|
-
errorName: error instanceof Error ? error.name : "UnknownError"
|
|
8483
|
-
});
|
|
8484
|
-
return { error: MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR };
|
|
8485
|
-
}
|
|
8486
|
-
}
|
|
8487
8422
|
function attachWorkingHistoryView(params) {
|
|
8488
8423
|
const historyEvents = parseRuntimeEvents(
|
|
8489
8424
|
params.state.local?.history ?? []
|
|
@@ -8715,14 +8650,6 @@ function readToolObservationPolicy(local) {
|
|
|
8715
8650
|
function readHistoryEvents(local) {
|
|
8716
8651
|
return parseRuntimeEvents(local.history ?? []);
|
|
8717
8652
|
}
|
|
8718
|
-
function readLastSuccessfulLlmModelId(local) {
|
|
8719
|
-
const executorLocal = local.executorLocal;
|
|
8720
|
-
if (!isRecord9(executorLocal)) {
|
|
8721
|
-
return void 0;
|
|
8722
|
-
}
|
|
8723
|
-
const value = executorLocal.lastSuccessfulLlmModelId;
|
|
8724
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
8725
|
-
}
|
|
8726
8653
|
function formatCapabilityError(error) {
|
|
8727
8654
|
if (isRecord9(error)) {
|
|
8728
8655
|
const codeValue = error.errorCode ?? error.code;
|
|
@@ -8734,29 +8661,12 @@ function formatCapabilityError(error) {
|
|
|
8734
8661
|
}
|
|
8735
8662
|
return error instanceof Error ? error.message : String(error);
|
|
8736
8663
|
}
|
|
8737
|
-
function bindModelInputAdmission(input) {
|
|
8738
|
-
input.context.modelInputAdmission = Object.freeze({
|
|
8739
|
-
requirement: Object.freeze({
|
|
8740
|
-
...input.requirement,
|
|
8741
|
-
placements: Object.freeze([...input.requirement.placements])
|
|
8742
|
-
}),
|
|
8743
|
-
delivery: input.delivery,
|
|
8744
|
-
admitted: input.admitted
|
|
8745
|
-
});
|
|
8746
|
-
}
|
|
8747
|
-
function isOptionalImageInputIncompatibility(reason) {
|
|
8748
|
-
return reason === "image_input_unsupported" || reason === "placement_unsupported";
|
|
8749
|
-
}
|
|
8750
|
-
function shouldDeliverToolModelInput(input) {
|
|
8751
|
-
return input.delivery === "required" || input.context.modelInputAdmission?.admitted === true;
|
|
8752
|
-
}
|
|
8753
8664
|
var ToolNode = class {
|
|
8754
8665
|
id = "tool";
|
|
8755
8666
|
toolRuntime;
|
|
8756
8667
|
observationPreview;
|
|
8757
8668
|
telemetryPort;
|
|
8758
8669
|
auditPort;
|
|
8759
|
-
modelInputCapabilityValidator;
|
|
8760
8670
|
modelInputResolver;
|
|
8761
8671
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
8762
8672
|
constructor(dependencies) {
|
|
@@ -8764,7 +8674,6 @@ var ToolNode = class {
|
|
|
8764
8674
|
this.observationPreview = dependencies.observationPreview;
|
|
8765
8675
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
8766
8676
|
this.auditPort = dependencies.auditPort ?? noopAudit;
|
|
8767
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
8768
8677
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
8769
8678
|
}
|
|
8770
8679
|
/**
|
|
@@ -8930,7 +8839,6 @@ var ToolNode = class {
|
|
|
8930
8839
|
logger11.warn("no tool name found in call");
|
|
8931
8840
|
return { kind: "yield", events: [] };
|
|
8932
8841
|
}
|
|
8933
|
-
delete prepared.toolContext.modelInputAdmission;
|
|
8934
8842
|
if (typeof execution.protocolError === "string") {
|
|
8935
8843
|
return this.handleError({
|
|
8936
8844
|
...prepared,
|
|
@@ -8948,88 +8856,6 @@ var ToolNode = class {
|
|
|
8948
8856
|
bridge: execution.bridge
|
|
8949
8857
|
});
|
|
8950
8858
|
}
|
|
8951
|
-
if (typeof execution.modelInputRequirementError === "string") {
|
|
8952
|
-
return this.handleError({
|
|
8953
|
-
...prepared,
|
|
8954
|
-
calls,
|
|
8955
|
-
call,
|
|
8956
|
-
toolName: execution.toolName,
|
|
8957
|
-
toolCallId: execution.toolCallId,
|
|
8958
|
-
toolArgs: execution.toolArgs,
|
|
8959
|
-
exec: {
|
|
8960
|
-
success: false,
|
|
8961
|
-
error: execution.modelInputRequirementError,
|
|
8962
|
-
errorKind: "capability",
|
|
8963
|
-
durationMs: 0
|
|
8964
|
-
},
|
|
8965
|
-
bridge: execution.bridge
|
|
8966
|
-
});
|
|
8967
|
-
}
|
|
8968
|
-
if (execution.modelInputRequirement?.requires_image_input === true) {
|
|
8969
|
-
const activeModelId = readLastSuccessfulLlmModelId(prepared.local);
|
|
8970
|
-
let capabilityError;
|
|
8971
|
-
let admitted = true;
|
|
8972
|
-
if (!activeModelId) {
|
|
8973
|
-
capabilityError = "llm.unsupported_capability: missing successful LLM model for tool input validation";
|
|
8974
|
-
} else if (!this.modelInputCapabilityValidator) {
|
|
8975
|
-
capabilityError = "llm.unsupported_capability: tool model input validator is not configured";
|
|
8976
|
-
} else {
|
|
8977
|
-
const validationInput = {
|
|
8978
|
-
activeModelId,
|
|
8979
|
-
requirement: execution.modelInputRequirement
|
|
8980
|
-
};
|
|
8981
|
-
if (execution.modelInputDelivery === "when_supported") {
|
|
8982
|
-
try {
|
|
8983
|
-
const compatibility = this.modelInputCapabilityValidator.evaluate(validationInput);
|
|
8984
|
-
if (!compatibility.compatible) {
|
|
8985
|
-
if (isOptionalImageInputIncompatibility(compatibility.reason)) {
|
|
8986
|
-
admitted = false;
|
|
8987
|
-
logger11.debug("optional tool model input omitted for incompatible active model", {
|
|
8988
|
-
toolName: execution.toolName,
|
|
8989
|
-
activeModelId,
|
|
8990
|
-
reason: compatibility.reason,
|
|
8991
|
-
placements: execution.modelInputRequirement.placements
|
|
8992
|
-
});
|
|
8993
|
-
} else {
|
|
8994
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
8995
|
-
capabilityError = "llm.unsupported_capability: active model is not eligible";
|
|
8996
|
-
}
|
|
8997
|
-
}
|
|
8998
|
-
} catch (error) {
|
|
8999
|
-
capabilityError = formatCapabilityError(error);
|
|
9000
|
-
}
|
|
9001
|
-
} else {
|
|
9002
|
-
try {
|
|
9003
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
9004
|
-
} catch (error) {
|
|
9005
|
-
capabilityError = formatCapabilityError(error);
|
|
9006
|
-
}
|
|
9007
|
-
}
|
|
9008
|
-
}
|
|
9009
|
-
if (capabilityError) {
|
|
9010
|
-
return this.handleError({
|
|
9011
|
-
...prepared,
|
|
9012
|
-
calls,
|
|
9013
|
-
call,
|
|
9014
|
-
toolName: execution.toolName,
|
|
9015
|
-
toolCallId: execution.toolCallId,
|
|
9016
|
-
toolArgs: execution.toolArgs,
|
|
9017
|
-
exec: {
|
|
9018
|
-
success: false,
|
|
9019
|
-
error: capabilityError,
|
|
9020
|
-
errorKind: "capability",
|
|
9021
|
-
durationMs: 0
|
|
9022
|
-
},
|
|
9023
|
-
bridge: execution.bridge
|
|
9024
|
-
});
|
|
9025
|
-
}
|
|
9026
|
-
bindModelInputAdmission({
|
|
9027
|
-
context: prepared.toolContext,
|
|
9028
|
-
requirement: execution.modelInputRequirement,
|
|
9029
|
-
delivery: execution.modelInputDelivery,
|
|
9030
|
-
admitted
|
|
9031
|
-
});
|
|
9032
|
-
}
|
|
9033
8859
|
await this.emitToolDecisionAudit({
|
|
9034
8860
|
action: "tool.allow",
|
|
9035
8861
|
toolName: execution.toolName,
|
|
@@ -9081,21 +8907,15 @@ var ToolNode = class {
|
|
|
9081
8907
|
bridge: execution.bridge
|
|
9082
8908
|
});
|
|
9083
8909
|
}
|
|
9084
|
-
|
|
9085
|
-
context: prepared.toolContext,
|
|
9086
|
-
delivery: execution.modelInputDelivery
|
|
9087
|
-
});
|
|
9088
|
-
let attachments = deliverModelInput ? exec.cachedAttachments : void 0;
|
|
8910
|
+
let attachments = exec.cachedAttachments;
|
|
9089
8911
|
try {
|
|
9090
|
-
if (
|
|
8912
|
+
if (!attachments) {
|
|
9091
8913
|
attachments = await resolveToolModelInput({
|
|
9092
|
-
activeModelId: readLastSuccessfulLlmModelId(prepared.local),
|
|
9093
8914
|
toolName: execution.toolName,
|
|
9094
8915
|
toolCallId: execution.toolCallId,
|
|
9095
8916
|
selections: contract.modelInputAttachments,
|
|
9096
8917
|
context: prepared.toolContext,
|
|
9097
|
-
resolver: this.modelInputResolver
|
|
9098
|
-
capabilityValidator: this.modelInputCapabilityValidator
|
|
8918
|
+
resolver: this.modelInputResolver
|
|
9099
8919
|
});
|
|
9100
8920
|
}
|
|
9101
8921
|
} catch (error) {
|
|
@@ -13120,7 +12940,6 @@ function createDefaultGraphExecutor(options) {
|
|
|
13120
12940
|
observationPreview: options.observationPreview,
|
|
13121
12941
|
auditPort: options.auditPort,
|
|
13122
12942
|
telemetryPort: options.telemetryPort,
|
|
13123
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
13124
12943
|
modelInputResolver: options.modelInputResolver
|
|
13125
12944
|
}));
|
|
13126
12945
|
executor2.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
|
|
@@ -13244,11 +13063,7 @@ var QuickstartMemoryToolRuntime = class {
|
|
|
13244
13063
|
return {
|
|
13245
13064
|
parameters: tool.parameters,
|
|
13246
13065
|
validateArguments: (args) => tool["validateArguments"](args),
|
|
13247
|
-
idempotency: tool.idempotency
|
|
13248
|
-
modelInputRequirement: tool.modelInputRequirement,
|
|
13249
|
-
...tool.resolveModelInputRequirement ? {
|
|
13250
|
-
resolveModelInputRequirement: (args) => tool.resolveModelInputRequirement?.(args)
|
|
13251
|
-
} : {}
|
|
13066
|
+
idempotency: tool.idempotency
|
|
13252
13067
|
};
|
|
13253
13068
|
}
|
|
13254
13069
|
async executeTool(toolName, args, context) {
|