@rowan-agent/agent 0.9.5 → 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.d.ts +1 -1
- package/dist/index.js +36 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
2
2
|
import { LlmContentPart, ContentBlock, ModelRef, ModelConfig, StreamFn } from '@rowan-agent/models';
|
|
3
|
-
export { ModelConfig, ModelRef, StreamFn } from '@rowan-agent/models';
|
|
3
|
+
export { ModelConfig, ModelRef, StreamFn, ThinkingLevel } from '@rowan-agent/models';
|
|
4
4
|
import Type from 'typebox';
|
|
5
5
|
|
|
6
6
|
type AgentMessage = {
|
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
|
}
|
|
@@ -4010,11 +4042,12 @@ function applyProviderRegistration(config) {
|
|
|
4010
4042
|
baseUrl: config.baseUrl,
|
|
4011
4043
|
apiKey: config.apiKey,
|
|
4012
4044
|
reasoning: modelConfig.reasoning,
|
|
4045
|
+
...modelConfig.thinkingLevel !== void 0 ? { thinkingLevel: modelConfig.thinkingLevel } : {},
|
|
4013
4046
|
input: modelConfig.input,
|
|
4014
4047
|
cost: modelConfig.cost,
|
|
4015
4048
|
contextWindow: modelConfig.contextWindow,
|
|
4016
4049
|
maxTokens: modelConfig.maxTokens,
|
|
4017
|
-
...config.headers ? { headers: config.headers } : {},
|
|
4050
|
+
...config.headers || modelConfig.headers ? { headers: { ...config.headers, ...modelConfig.headers } } : {},
|
|
4018
4051
|
...config.timeoutMs !== void 0 ? { timeoutMs: config.timeoutMs } : {},
|
|
4019
4052
|
...config.maxRetries !== void 0 ? { maxRetries: config.maxRetries } : {},
|
|
4020
4053
|
...config.retryDelayMs !== void 0 ? { retryDelayMs: config.retryDelayMs } : {}
|
|
@@ -5504,6 +5537,7 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
5504
5537
|
...run.metadata === void 0 ? {} : { runMetadata: run.metadata }
|
|
5505
5538
|
},
|
|
5506
5539
|
model,
|
|
5540
|
+
thinkingLevel: thinkingLevelFromMessages(executionContext.messages),
|
|
5507
5541
|
stream,
|
|
5508
5542
|
maxAttempts: config.maxAttempts,
|
|
5509
5543
|
checkpoint: claim.run.checkpoint,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowan-agent/agent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"build": "tsup && bun scripts/check-public-interface.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@rowan-agent/models": "0.6.
|
|
26
|
+
"@rowan-agent/models": "0.6.5",
|
|
27
27
|
"jiti": "2.7.0",
|
|
28
28
|
"typebox": "^1.0.0",
|
|
29
29
|
"yaml": "^2.7.0"
|