open-agents-ai 0.179.0 → 0.181.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/dist/index.js +36 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39161,30 +39161,26 @@ async function checkToolSupport(modelName, backendUrl = "http://localhost:11434"
|
|
|
39161
39161
|
if (_toolSupportCache.has(modelName))
|
|
39162
39162
|
return _toolSupportCache.get(modelName);
|
|
39163
39163
|
try {
|
|
39164
|
-
const resp = await fetch(`${backendUrl.replace(/\/+$/, "")}/api/
|
|
39164
|
+
const resp = await fetch(`${backendUrl.replace(/\/+$/, "")}/api/chat`, {
|
|
39165
39165
|
method: "POST",
|
|
39166
39166
|
headers: { "Content-Type": "application/json" },
|
|
39167
|
-
body: JSON.stringify({
|
|
39168
|
-
|
|
39167
|
+
body: JSON.stringify({
|
|
39168
|
+
model: modelName,
|
|
39169
|
+
messages: [{ role: "user", content: "test" }],
|
|
39170
|
+
tools: [{ type: "function", function: { name: "test", description: "test", parameters: { type: "object", properties: {} } } }],
|
|
39171
|
+
stream: false,
|
|
39172
|
+
options: { num_predict: 1 }
|
|
39173
|
+
}),
|
|
39174
|
+
signal: AbortSignal.timeout(1e4)
|
|
39169
39175
|
});
|
|
39170
|
-
|
|
39171
|
-
_toolSupportCache.set(modelName, false);
|
|
39172
|
-
return false;
|
|
39173
|
-
}
|
|
39174
|
-
const data = await resp.json();
|
|
39175
|
-
const template = data.template ?? "";
|
|
39176
|
-
const hasTools = template.includes("{{.Tools}}") || template.includes("{{ .Tools }}");
|
|
39176
|
+
const hasTools = resp.ok;
|
|
39177
39177
|
_toolSupportCache.set(modelName, hasTools);
|
|
39178
39178
|
return hasTools;
|
|
39179
39179
|
} catch {
|
|
39180
|
-
_toolSupportCache.set(modelName,
|
|
39181
|
-
return
|
|
39180
|
+
_toolSupportCache.set(modelName, true);
|
|
39181
|
+
return true;
|
|
39182
39182
|
}
|
|
39183
39183
|
}
|
|
39184
|
-
async function needsTextToolMode(modelName, backendUrl) {
|
|
39185
|
-
const hasTools = await checkToolSupport(modelName, backendUrl);
|
|
39186
|
-
return !hasTools;
|
|
39187
|
-
}
|
|
39188
39184
|
function detectSystemSpecs() {
|
|
39189
39185
|
let totalRamGB = 0;
|
|
39190
39186
|
let availableRamGB = 0;
|
|
@@ -51377,10 +51373,32 @@ var init_stream_renderer = __esm({
|
|
|
51377
51373
|
* Feed a streamed token into the renderer.
|
|
51378
51374
|
* Tokens are buffered per-line and flushed with syntax highlighting.
|
|
51379
51375
|
*/
|
|
51376
|
+
/** Track whether we've shown the thinking indicator */
|
|
51377
|
+
thinkingIndicatorShown = false;
|
|
51378
|
+
thinkingTokenCount = 0;
|
|
51380
51379
|
write(token, kind) {
|
|
51381
51380
|
if (!this.enabled)
|
|
51382
51381
|
return;
|
|
51383
51382
|
this.tokenCount++;
|
|
51383
|
+
if (kind === "thinking") {
|
|
51384
|
+
this.thinkingTokenCount++;
|
|
51385
|
+
if (!this.thinkingIndicatorShown) {
|
|
51386
|
+
this.thinkingIndicatorShown = true;
|
|
51387
|
+
this.writeRaw(dimText(" \u23BF ") + dimItalic("thinking...") + "\n");
|
|
51388
|
+
this.lineStarted = false;
|
|
51389
|
+
}
|
|
51390
|
+
if (this.thinkingTokenCount % 50 === 0) {
|
|
51391
|
+
process.stdout.write(`\x1B[1A\x1B[2K${dimText(" \u23BF ")}${dimItalic(`thinking... (${this.thinkingTokenCount} tokens)`)}
|
|
51392
|
+
`);
|
|
51393
|
+
}
|
|
51394
|
+
return;
|
|
51395
|
+
}
|
|
51396
|
+
if (this.thinkingIndicatorShown && kind === "content") {
|
|
51397
|
+
this.thinkingIndicatorShown = false;
|
|
51398
|
+
process.stdout.write(`\x1B[1A\x1B[2K${dimText(" \u23BF ")}${dimItalic(`thought for ${this.thinkingTokenCount} tokens`)}
|
|
51399
|
+
`);
|
|
51400
|
+
this.thinkingTokenCount = 0;
|
|
51401
|
+
}
|
|
51384
51402
|
if (kind === "tool_args" && !this.inToolArgs) {
|
|
51385
51403
|
this.flushPartial(kind);
|
|
51386
51404
|
this.inToolArgs = true;
|
|
@@ -57431,8 +57449,8 @@ var init_status_bar = __esm({
|
|
|
57431
57449
|
/** Mouse tracking state — disabled when idle to allow native text selection */
|
|
57432
57450
|
_mouseTrackingEnabled = true;
|
|
57433
57451
|
_mouseIdleTimer = null;
|
|
57434
|
-
static MOUSE_IDLE_MS =
|
|
57435
|
-
// disable after
|
|
57452
|
+
static MOUSE_IDLE_MS = 500;
|
|
57453
|
+
// disable after 0.5s idle — fast enough for text selection
|
|
57436
57454
|
/** Text selection state — tracks click-drag selection for copy */
|
|
57437
57455
|
_textSelection = new TextSelection({
|
|
57438
57456
|
getContentLines: () => this._contentLines,
|
|
@@ -60120,12 +60138,6 @@ ${lines.join("\n")}
|
|
|
60120
60138
|
});
|
|
60121
60139
|
runner.setWorkingDirectory(repoRoot);
|
|
60122
60140
|
_activeRunnerRef = runner;
|
|
60123
|
-
needsTextToolMode(config.model, config.backendUrl).then((needsText) => {
|
|
60124
|
-
if (needsText) {
|
|
60125
|
-
runner.options.textToolMode = true;
|
|
60126
|
-
}
|
|
60127
|
-
}).catch(() => {
|
|
60128
|
-
});
|
|
60129
60141
|
const tools = buildTools(repoRoot, config, contextWindowSize);
|
|
60130
60142
|
if (contextWindowSize && contextWindowSize > 0) {
|
|
60131
60143
|
for (const tool of tools) {
|
package/package.json
CHANGED