@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/quickstart.js
CHANGED
|
@@ -3216,6 +3216,16 @@ function mergeResumeSessionLocal(persistedLocal, localPatch) {
|
|
|
3216
3216
|
}
|
|
3217
3217
|
};
|
|
3218
3218
|
}
|
|
3219
|
+
function resolveResumeNodeId(local, requested) {
|
|
3220
|
+
const pending = local?.pendingToolCalls;
|
|
3221
|
+
if (!Array.isArray(pending) || pending.length === 0) return requested ?? "llm";
|
|
3222
|
+
if (requested !== void 0 && requested !== "tool") {
|
|
3223
|
+
throw new Error(
|
|
3224
|
+
`Graph resume must first run ${pending.length} pending tool call(s) from the interrupted batch: requested node=${requested}`
|
|
3225
|
+
);
|
|
3226
|
+
}
|
|
3227
|
+
return "tool";
|
|
3228
|
+
}
|
|
3219
3229
|
var GraphExecutor = class {
|
|
3220
3230
|
constructor(checkpointer, config = {}) {
|
|
3221
3231
|
this.checkpointer = checkpointer;
|
|
@@ -3328,13 +3338,14 @@ var GraphExecutor = class {
|
|
|
3328
3338
|
);
|
|
3329
3339
|
}
|
|
3330
3340
|
const resumedLocal = mergeResumeSessionLocal(current.local, input.localPatch);
|
|
3341
|
+
const nodeId = resolveResumeNodeId(resumedLocal, input.nodeId);
|
|
3331
3342
|
if (this.executionCheckpointPort && current.local?.executorLocal) {
|
|
3332
3343
|
resumedLocal.executorLocal = { ...current.local.executorLocal };
|
|
3333
3344
|
}
|
|
3334
3345
|
this.ephemeralLocals.set(checkpointKey, resumedLocal);
|
|
3335
3346
|
await this.commitCheckpoint(checkpointKey, {
|
|
3336
3347
|
...current,
|
|
3337
|
-
nodeId
|
|
3348
|
+
nodeId,
|
|
3338
3349
|
...this.executionCheckpointPort ? { executionStatus: "ready" } : {},
|
|
3339
3350
|
revision: currentRevision + 1,
|
|
3340
3351
|
local: sanitizeCheckpointLocal(resumedLocal)
|
|
@@ -4215,7 +4226,6 @@ var tickPipelineContextKeys = [
|
|
|
4215
4226
|
"runtimeEventCommitPort",
|
|
4216
4227
|
"modelId",
|
|
4217
4228
|
"toolSchemas",
|
|
4218
|
-
"toolModelInputRequirement",
|
|
4219
4229
|
"toolCallStreamingPolicies",
|
|
4220
4230
|
"llmOptions",
|
|
4221
4231
|
"toolDefinitionTokens",
|
|
@@ -5118,7 +5128,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5118
5128
|
"outputProcessor",
|
|
5119
5129
|
"modelId",
|
|
5120
5130
|
"llmMessages",
|
|
5121
|
-
"toolModelInputRequirement",
|
|
5122
5131
|
"toolCallStreamingPolicies",
|
|
5123
5132
|
"imageInputAdmissionEvidence",
|
|
5124
5133
|
"llmOptions",
|
|
@@ -5177,7 +5186,6 @@ function createExecuteLlmStage(dependencies) {
|
|
|
5177
5186
|
},
|
|
5178
5187
|
{
|
|
5179
5188
|
imageInputAdmissionEvidence: ctx.imageInputAdmissionEvidence,
|
|
5180
|
-
additionalModelInputRequirement: ctx.toolModelInputRequirement,
|
|
5181
5189
|
toolCallStreamingPolicies: ctx.toolCallStreamingPolicies,
|
|
5182
5190
|
...promptBudget && promptUsageMeasurementPolicy ? {
|
|
5183
5191
|
measurePromptUsage: async (activeModelId, messages) => {
|
|
@@ -6162,29 +6170,6 @@ function createCommitContextCompactionStage() {
|
|
|
6162
6170
|
});
|
|
6163
6171
|
}
|
|
6164
6172
|
|
|
6165
|
-
// src/runtime-kernel/graph-engine/functions/prepareModelCompatibleTools.ts
|
|
6166
|
-
function prepareModelCompatibleTools(input) {
|
|
6167
|
-
const schemas = [];
|
|
6168
|
-
const requirements = [];
|
|
6169
|
-
for (const schema of input.schemas) {
|
|
6170
|
-
const definition = input.getToolDefinition(schema.function.name);
|
|
6171
|
-
const requirement = definition?.modelInputRequirement;
|
|
6172
|
-
const delivery = definition?.modelInputDelivery ?? "required";
|
|
6173
|
-
const isRequired = delivery === "required";
|
|
6174
|
-
if (requirement && isRequired && !evaluateModelInputCompatibility(input.model, requirement).compatible) {
|
|
6175
|
-
continue;
|
|
6176
|
-
}
|
|
6177
|
-
schemas.push(schema);
|
|
6178
|
-
if (requirement && isRequired) {
|
|
6179
|
-
requirements.push(requirement);
|
|
6180
|
-
}
|
|
6181
|
-
}
|
|
6182
|
-
return {
|
|
6183
|
-
schemas: Object.freeze(schemas),
|
|
6184
|
-
requirement: requirements.length > 0 ? mergeModelInputRequirements(...requirements) : EMPTY_MODEL_INPUT_REQUIREMENT
|
|
6185
|
-
};
|
|
6186
|
-
}
|
|
6187
|
-
|
|
6188
6173
|
// src/runtime-kernel/graph-engine/tick-pipeline/stages/prepareCallStage.ts
|
|
6189
6174
|
function createPrepareCallStage(dependencies) {
|
|
6190
6175
|
return defineTickStage({
|
|
@@ -6202,7 +6187,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6202
6187
|
writes: [
|
|
6203
6188
|
"modelId",
|
|
6204
6189
|
"toolSchemas",
|
|
6205
|
-
"toolModelInputRequirement",
|
|
6206
6190
|
"toolCallStreamingPolicies",
|
|
6207
6191
|
"llmOptions",
|
|
6208
6192
|
"toolDefinitionTokens"
|
|
@@ -6242,12 +6226,7 @@ function createPrepareCallStage(dependencies) {
|
|
|
6242
6226
|
invocation: ctx.request
|
|
6243
6227
|
});
|
|
6244
6228
|
const modelConfig = dependencies.modelCatalog.getModelById(modelId);
|
|
6245
|
-
const
|
|
6246
|
-
schemas: candidateToolSchemas,
|
|
6247
|
-
model: modelConfig,
|
|
6248
|
-
getToolDefinition: (toolName) => dependencies.toolCatalog.getToolDefinition(toolName)
|
|
6249
|
-
});
|
|
6250
|
-
const toolSchemas = [...toolPreparation.schemas];
|
|
6229
|
+
const toolSchemas = [...candidateToolSchemas];
|
|
6251
6230
|
const toolCallStreamingPolicies = deriveToolCallStreamingPolicies(
|
|
6252
6231
|
toolSchemas,
|
|
6253
6232
|
dependencies.toolCatalog
|
|
@@ -6291,7 +6270,6 @@ function createPrepareCallStage(dependencies) {
|
|
|
6291
6270
|
return {
|
|
6292
6271
|
modelId,
|
|
6293
6272
|
toolSchemas,
|
|
6294
|
-
toolModelInputRequirement: toolPreparation.requirement,
|
|
6295
6273
|
toolCallStreamingPolicies,
|
|
6296
6274
|
llmOptions,
|
|
6297
6275
|
toolDefinitionTokens
|
|
@@ -6465,7 +6443,6 @@ var GraphAgentExecutor = class {
|
|
|
6465
6443
|
modelId: "",
|
|
6466
6444
|
toolSchemas: [],
|
|
6467
6445
|
toolCallStreamingPolicies: {},
|
|
6468
|
-
toolModelInputRequirement: void 0,
|
|
6469
6446
|
llmOptions: {},
|
|
6470
6447
|
toolDefinitionTokens: 0,
|
|
6471
6448
|
llmMessages: [],
|
|
@@ -7717,10 +7694,6 @@ function parseToolModelInputDeclaration(value) {
|
|
|
7717
7694
|
}
|
|
7718
7695
|
|
|
7719
7696
|
// src/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.ts
|
|
7720
|
-
var TOOL_RESULT_IMAGE_REQUIREMENT = {
|
|
7721
|
-
requires_image_input: true,
|
|
7722
|
-
placements: ["tool_result_image"]
|
|
7723
|
-
};
|
|
7724
7697
|
async function resolveToolModelInput(input) {
|
|
7725
7698
|
if (!input.selections) {
|
|
7726
7699
|
return void 0;
|
|
@@ -7741,16 +7714,6 @@ async function resolveToolModelInput(input) {
|
|
|
7741
7714
|
if (parsed.data.some((reference, index) => reference.id !== input.selections?.[index]?.id)) {
|
|
7742
7715
|
throw new ToolModelInputResolutionError("Tool model input resolver changed attachment identity or order.");
|
|
7743
7716
|
}
|
|
7744
|
-
if (!input.activeModelId) {
|
|
7745
|
-
throw new ToolModelInputResolutionError("Missing successful LLM model for tool input validation.");
|
|
7746
|
-
}
|
|
7747
|
-
if (!input.capabilityValidator) {
|
|
7748
|
-
throw new ToolModelInputResolutionError("Tool model input validator is not configured.");
|
|
7749
|
-
}
|
|
7750
|
-
input.capabilityValidator.assertCompatible({
|
|
7751
|
-
activeModelId: input.activeModelId,
|
|
7752
|
-
requirement: TOOL_RESULT_IMAGE_REQUIREMENT
|
|
7753
|
-
});
|
|
7754
7717
|
return Object.freeze(parsed.data.map((reference) => Object.freeze(reference)));
|
|
7755
7718
|
}
|
|
7756
7719
|
|
|
@@ -8456,7 +8419,6 @@ var ToolNodeEventBridge = class {
|
|
|
8456
8419
|
|
|
8457
8420
|
// src/runtime-kernel/graph-engine/nodes/toolNode.executionSetup.ts
|
|
8458
8421
|
var logger10 = new Logger("ToolNode");
|
|
8459
|
-
var MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR = "tool.model_input.requirement_resolution_failed: Tool model input requirement could not be resolved";
|
|
8460
8422
|
function parseToolArgs(call) {
|
|
8461
8423
|
const rawArguments = typeof call.function?.arguments === "string" ? call.function.arguments : "";
|
|
8462
8424
|
if (!rawArguments.trim()) {
|
|
@@ -8560,12 +8522,6 @@ function prepareToolExecution(params) {
|
|
|
8560
8522
|
toolArgs,
|
|
8561
8523
|
idempotencyKey
|
|
8562
8524
|
});
|
|
8563
|
-
const modelInputRequirement = resolveModelInputRequirement({
|
|
8564
|
-
toolDefinition,
|
|
8565
|
-
toolArgs,
|
|
8566
|
-
hasProtocolError: protocolError !== void 0,
|
|
8567
|
-
toolName
|
|
8568
|
-
});
|
|
8569
8525
|
return {
|
|
8570
8526
|
call: params.call,
|
|
8571
8527
|
toolName,
|
|
@@ -8574,30 +8530,9 @@ function prepareToolExecution(params) {
|
|
|
8574
8530
|
toolArgs,
|
|
8575
8531
|
protocolError,
|
|
8576
8532
|
idempotencyKey,
|
|
8577
|
-
...modelInputRequirement.requirement ? { modelInputRequirement: modelInputRequirement.requirement } : {},
|
|
8578
|
-
modelInputDelivery: toolDefinition?.modelInputDelivery ?? "required",
|
|
8579
|
-
...modelInputRequirement.error ? { modelInputRequirementError: modelInputRequirement.error } : {},
|
|
8580
8533
|
bridge
|
|
8581
8534
|
};
|
|
8582
8535
|
}
|
|
8583
|
-
function resolveModelInputRequirement(params) {
|
|
8584
|
-
if (params.hasProtocolError) {
|
|
8585
|
-
return {};
|
|
8586
|
-
}
|
|
8587
|
-
if (!params.toolDefinition?.resolveModelInputRequirement) {
|
|
8588
|
-
return params.toolDefinition?.modelInputRequirement ? { requirement: params.toolDefinition.modelInputRequirement } : {};
|
|
8589
|
-
}
|
|
8590
|
-
try {
|
|
8591
|
-
const requirement = params.toolDefinition.resolveModelInputRequirement(params.toolArgs);
|
|
8592
|
-
return requirement ? { requirement } : {};
|
|
8593
|
-
} catch (error) {
|
|
8594
|
-
logger10.warn("dynamic model input requirement resolution failed", {
|
|
8595
|
-
toolName: params.toolName,
|
|
8596
|
-
errorName: error instanceof Error ? error.name : "UnknownError"
|
|
8597
|
-
});
|
|
8598
|
-
return { error: MODEL_INPUT_REQUIREMENT_RESOLUTION_ERROR };
|
|
8599
|
-
}
|
|
8600
|
-
}
|
|
8601
8536
|
function attachWorkingHistoryView(params) {
|
|
8602
8537
|
const historyEvents = parseRuntimeEvents(
|
|
8603
8538
|
params.state.local?.history ?? []
|
|
@@ -8829,14 +8764,6 @@ function readToolObservationPolicy(local) {
|
|
|
8829
8764
|
function readHistoryEvents(local) {
|
|
8830
8765
|
return parseRuntimeEvents(local.history ?? []);
|
|
8831
8766
|
}
|
|
8832
|
-
function readLastSuccessfulLlmModelId(local) {
|
|
8833
|
-
const executorLocal = local.executorLocal;
|
|
8834
|
-
if (!isRecord9(executorLocal)) {
|
|
8835
|
-
return void 0;
|
|
8836
|
-
}
|
|
8837
|
-
const value = executorLocal.lastSuccessfulLlmModelId;
|
|
8838
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
8839
|
-
}
|
|
8840
8767
|
function formatCapabilityError(error) {
|
|
8841
8768
|
if (isRecord9(error)) {
|
|
8842
8769
|
const codeValue = error.errorCode ?? error.code;
|
|
@@ -8848,29 +8775,12 @@ function formatCapabilityError(error) {
|
|
|
8848
8775
|
}
|
|
8849
8776
|
return error instanceof Error ? error.message : String(error);
|
|
8850
8777
|
}
|
|
8851
|
-
function bindModelInputAdmission(input) {
|
|
8852
|
-
input.context.modelInputAdmission = Object.freeze({
|
|
8853
|
-
requirement: Object.freeze({
|
|
8854
|
-
...input.requirement,
|
|
8855
|
-
placements: Object.freeze([...input.requirement.placements])
|
|
8856
|
-
}),
|
|
8857
|
-
delivery: input.delivery,
|
|
8858
|
-
admitted: input.admitted
|
|
8859
|
-
});
|
|
8860
|
-
}
|
|
8861
|
-
function isOptionalImageInputIncompatibility(reason) {
|
|
8862
|
-
return reason === "image_input_unsupported" || reason === "placement_unsupported";
|
|
8863
|
-
}
|
|
8864
|
-
function shouldDeliverToolModelInput(input) {
|
|
8865
|
-
return input.delivery === "required" || input.context.modelInputAdmission?.admitted === true;
|
|
8866
|
-
}
|
|
8867
8778
|
var ToolNode = class {
|
|
8868
8779
|
id = "tool";
|
|
8869
8780
|
toolRuntime;
|
|
8870
8781
|
observationPreview;
|
|
8871
8782
|
telemetryPort;
|
|
8872
8783
|
auditPort;
|
|
8873
|
-
modelInputCapabilityValidator;
|
|
8874
8784
|
modelInputResolver;
|
|
8875
8785
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
8876
8786
|
constructor(dependencies) {
|
|
@@ -8878,7 +8788,6 @@ var ToolNode = class {
|
|
|
8878
8788
|
this.observationPreview = dependencies.observationPreview;
|
|
8879
8789
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
8880
8790
|
this.auditPort = dependencies.auditPort ?? noopAudit;
|
|
8881
|
-
this.modelInputCapabilityValidator = dependencies.modelInputCapabilityValidator;
|
|
8882
8791
|
this.modelInputResolver = dependencies.modelInputResolver;
|
|
8883
8792
|
}
|
|
8884
8793
|
/**
|
|
@@ -9044,7 +8953,6 @@ var ToolNode = class {
|
|
|
9044
8953
|
logger11.warn("no tool name found in call");
|
|
9045
8954
|
return { kind: "yield", events: [] };
|
|
9046
8955
|
}
|
|
9047
|
-
delete prepared.toolContext.modelInputAdmission;
|
|
9048
8956
|
if (typeof execution.protocolError === "string") {
|
|
9049
8957
|
return this.handleError({
|
|
9050
8958
|
...prepared,
|
|
@@ -9062,88 +8970,6 @@ var ToolNode = class {
|
|
|
9062
8970
|
bridge: execution.bridge
|
|
9063
8971
|
});
|
|
9064
8972
|
}
|
|
9065
|
-
if (typeof execution.modelInputRequirementError === "string") {
|
|
9066
|
-
return this.handleError({
|
|
9067
|
-
...prepared,
|
|
9068
|
-
calls,
|
|
9069
|
-
call,
|
|
9070
|
-
toolName: execution.toolName,
|
|
9071
|
-
toolCallId: execution.toolCallId,
|
|
9072
|
-
toolArgs: execution.toolArgs,
|
|
9073
|
-
exec: {
|
|
9074
|
-
success: false,
|
|
9075
|
-
error: execution.modelInputRequirementError,
|
|
9076
|
-
errorKind: "capability",
|
|
9077
|
-
durationMs: 0
|
|
9078
|
-
},
|
|
9079
|
-
bridge: execution.bridge
|
|
9080
|
-
});
|
|
9081
|
-
}
|
|
9082
|
-
if (execution.modelInputRequirement?.requires_image_input === true) {
|
|
9083
|
-
const activeModelId = readLastSuccessfulLlmModelId(prepared.local);
|
|
9084
|
-
let capabilityError;
|
|
9085
|
-
let admitted = true;
|
|
9086
|
-
if (!activeModelId) {
|
|
9087
|
-
capabilityError = "llm.unsupported_capability: missing successful LLM model for tool input validation";
|
|
9088
|
-
} else if (!this.modelInputCapabilityValidator) {
|
|
9089
|
-
capabilityError = "llm.unsupported_capability: tool model input validator is not configured";
|
|
9090
|
-
} else {
|
|
9091
|
-
const validationInput = {
|
|
9092
|
-
activeModelId,
|
|
9093
|
-
requirement: execution.modelInputRequirement
|
|
9094
|
-
};
|
|
9095
|
-
if (execution.modelInputDelivery === "when_supported") {
|
|
9096
|
-
try {
|
|
9097
|
-
const compatibility = this.modelInputCapabilityValidator.evaluate(validationInput);
|
|
9098
|
-
if (!compatibility.compatible) {
|
|
9099
|
-
if (isOptionalImageInputIncompatibility(compatibility.reason)) {
|
|
9100
|
-
admitted = false;
|
|
9101
|
-
logger11.debug("optional tool model input omitted for incompatible active model", {
|
|
9102
|
-
toolName: execution.toolName,
|
|
9103
|
-
activeModelId,
|
|
9104
|
-
reason: compatibility.reason,
|
|
9105
|
-
placements: execution.modelInputRequirement.placements
|
|
9106
|
-
});
|
|
9107
|
-
} else {
|
|
9108
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
9109
|
-
capabilityError = "llm.unsupported_capability: active model is not eligible";
|
|
9110
|
-
}
|
|
9111
|
-
}
|
|
9112
|
-
} catch (error) {
|
|
9113
|
-
capabilityError = formatCapabilityError(error);
|
|
9114
|
-
}
|
|
9115
|
-
} else {
|
|
9116
|
-
try {
|
|
9117
|
-
this.modelInputCapabilityValidator.assertCompatible(validationInput);
|
|
9118
|
-
} catch (error) {
|
|
9119
|
-
capabilityError = formatCapabilityError(error);
|
|
9120
|
-
}
|
|
9121
|
-
}
|
|
9122
|
-
}
|
|
9123
|
-
if (capabilityError) {
|
|
9124
|
-
return this.handleError({
|
|
9125
|
-
...prepared,
|
|
9126
|
-
calls,
|
|
9127
|
-
call,
|
|
9128
|
-
toolName: execution.toolName,
|
|
9129
|
-
toolCallId: execution.toolCallId,
|
|
9130
|
-
toolArgs: execution.toolArgs,
|
|
9131
|
-
exec: {
|
|
9132
|
-
success: false,
|
|
9133
|
-
error: capabilityError,
|
|
9134
|
-
errorKind: "capability",
|
|
9135
|
-
durationMs: 0
|
|
9136
|
-
},
|
|
9137
|
-
bridge: execution.bridge
|
|
9138
|
-
});
|
|
9139
|
-
}
|
|
9140
|
-
bindModelInputAdmission({
|
|
9141
|
-
context: prepared.toolContext,
|
|
9142
|
-
requirement: execution.modelInputRequirement,
|
|
9143
|
-
delivery: execution.modelInputDelivery,
|
|
9144
|
-
admitted
|
|
9145
|
-
});
|
|
9146
|
-
}
|
|
9147
8973
|
await this.emitToolDecisionAudit({
|
|
9148
8974
|
action: "tool.allow",
|
|
9149
8975
|
toolName: execution.toolName,
|
|
@@ -9195,21 +9021,15 @@ var ToolNode = class {
|
|
|
9195
9021
|
bridge: execution.bridge
|
|
9196
9022
|
});
|
|
9197
9023
|
}
|
|
9198
|
-
|
|
9199
|
-
context: prepared.toolContext,
|
|
9200
|
-
delivery: execution.modelInputDelivery
|
|
9201
|
-
});
|
|
9202
|
-
let attachments = deliverModelInput ? exec.cachedAttachments : void 0;
|
|
9024
|
+
let attachments = exec.cachedAttachments;
|
|
9203
9025
|
try {
|
|
9204
|
-
if (
|
|
9026
|
+
if (!attachments) {
|
|
9205
9027
|
attachments = await resolveToolModelInput({
|
|
9206
|
-
activeModelId: readLastSuccessfulLlmModelId(prepared.local),
|
|
9207
9028
|
toolName: execution.toolName,
|
|
9208
9029
|
toolCallId: execution.toolCallId,
|
|
9209
9030
|
selections: contract.modelInputAttachments,
|
|
9210
9031
|
context: prepared.toolContext,
|
|
9211
|
-
resolver: this.modelInputResolver
|
|
9212
|
-
capabilityValidator: this.modelInputCapabilityValidator
|
|
9032
|
+
resolver: this.modelInputResolver
|
|
9213
9033
|
});
|
|
9214
9034
|
}
|
|
9215
9035
|
} catch (error) {
|
|
@@ -13234,7 +13054,6 @@ function createDefaultGraphExecutor(options) {
|
|
|
13234
13054
|
observationPreview: options.observationPreview,
|
|
13235
13055
|
auditPort: options.auditPort,
|
|
13236
13056
|
telemetryPort: options.telemetryPort,
|
|
13237
|
-
modelInputCapabilityValidator: options.modelInputCapabilityValidator,
|
|
13238
13057
|
modelInputResolver: options.modelInputResolver
|
|
13239
13058
|
}));
|
|
13240
13059
|
executor2.registerNode(new WaitUserNode({ auditPort: options.auditPort }));
|
|
@@ -13358,11 +13177,7 @@ var QuickstartMemoryToolRuntime = class {
|
|
|
13358
13177
|
return {
|
|
13359
13178
|
parameters: tool.parameters,
|
|
13360
13179
|
validateArguments: (args) => tool["validateArguments"](args),
|
|
13361
|
-
idempotency: tool.idempotency
|
|
13362
|
-
modelInputRequirement: tool.modelInputRequirement,
|
|
13363
|
-
...tool.resolveModelInputRequirement ? {
|
|
13364
|
-
resolveModelInputRequirement: (args) => tool.resolveModelInputRequirement?.(args)
|
|
13365
|
-
} : {}
|
|
13180
|
+
idempotency: tool.idempotency
|
|
13366
13181
|
};
|
|
13367
13182
|
}
|
|
13368
13183
|
async executeTool(toolName, args, context) {
|