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