@rowan-agent/agent 0.9.6 → 0.9.7
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/dist/index.js +34 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1648,6 +1648,7 @@ function buildModelRequest(input, options) {
|
|
|
1648
1648
|
}));
|
|
1649
1649
|
return {
|
|
1650
1650
|
model: options?.model ?? { provider: "", id: "" },
|
|
1651
|
+
...options?.thinkingLevel === void 0 ? {} : { thinkingLevel: options.thinkingLevel },
|
|
1651
1652
|
system: systemText,
|
|
1652
1653
|
messages,
|
|
1653
1654
|
tools: modelTools.length > 0 ? modelTools : void 0
|
|
@@ -2566,7 +2567,10 @@ function createPhaseExecution(config, state, phase, messageManager, toolExecutio
|
|
|
2566
2567
|
skills: phaseContext.skills,
|
|
2567
2568
|
promptGuidelines: phaseContext.promptGuidelines,
|
|
2568
2569
|
appendSystemPrompt: phaseContext.appendSystemPrompt
|
|
2569
|
-
}, {
|
|
2570
|
+
}, {
|
|
2571
|
+
model: phase.model ?? config.model,
|
|
2572
|
+
...config.thinkingLevel === void 0 ? {} : { thinkingLevel: config.thinkingLevel }
|
|
2573
|
+
});
|
|
2570
2574
|
if (!request.tools) {
|
|
2571
2575
|
if (phaseContext.tools.length > 0) {
|
|
2572
2576
|
request.tools = phaseContext.tools.map((t) => ({
|
|
@@ -2869,6 +2873,7 @@ async function executeOnce(input) {
|
|
|
2869
2873
|
context,
|
|
2870
2874
|
execution: input.execution,
|
|
2871
2875
|
model: input.model,
|
|
2876
|
+
...input.thinkingLevel === void 0 ? {} : { thinkingLevel: input.thinkingLevel },
|
|
2872
2877
|
stream: input.stream,
|
|
2873
2878
|
maxAttempts: input.maxAttempts,
|
|
2874
2879
|
signal: input.signal,
|
|
@@ -2941,6 +2946,33 @@ function isContinuation(value) {
|
|
|
2941
2946
|
}
|
|
2942
2947
|
|
|
2943
2948
|
// src/runtime/contracts.ts
|
|
2949
|
+
var THINKING_LEVELS = [
|
|
2950
|
+
"off",
|
|
2951
|
+
"minimal",
|
|
2952
|
+
"low",
|
|
2953
|
+
"medium",
|
|
2954
|
+
"high",
|
|
2955
|
+
"xhigh",
|
|
2956
|
+
"max"
|
|
2957
|
+
];
|
|
2958
|
+
function thinkingLevelFromMetadata(metadata) {
|
|
2959
|
+
const record = isRecord3(metadata) ? metadata : void 0;
|
|
2960
|
+
const everyield = record?.everyield;
|
|
2961
|
+
if (!isRecord3(everyield)) return void 0;
|
|
2962
|
+
const level = everyield.thinkingLevel;
|
|
2963
|
+
return typeof level === "string" && THINKING_LEVELS.includes(level) ? level : void 0;
|
|
2964
|
+
}
|
|
2965
|
+
function thinkingLevelFromMessages(messages) {
|
|
2966
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
2967
|
+
const message = messages[index];
|
|
2968
|
+
if (message?.role !== "user") continue;
|
|
2969
|
+
const metadata = message.metadata;
|
|
2970
|
+
const kind = isRecord3(metadata) && typeof metadata.kind === "string" ? metadata.kind : void 0;
|
|
2971
|
+
if (kind === "phase_prompt" || kind === "phase_input") continue;
|
|
2972
|
+
return thinkingLevelFromMetadata(metadata);
|
|
2973
|
+
}
|
|
2974
|
+
return void 0;
|
|
2975
|
+
}
|
|
2944
2976
|
function isAgentConfiguration(config) {
|
|
2945
2977
|
return !("resources" in config);
|
|
2946
2978
|
}
|
|
@@ -5505,6 +5537,7 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
5505
5537
|
...run.metadata === void 0 ? {} : { runMetadata: run.metadata }
|
|
5506
5538
|
},
|
|
5507
5539
|
model,
|
|
5540
|
+
thinkingLevel: thinkingLevelFromMessages(executionContext.messages),
|
|
5508
5541
|
stream,
|
|
5509
5542
|
maxAttempts: config.maxAttempts,
|
|
5510
5543
|
checkpoint: claim.run.checkpoint,
|