open-agents-ai 0.138.64 → 0.138.66
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 +156 -4
- package/package.json +1 -1
- package/prompts/agentic/system-medium.md +8 -0
- package/prompts/agentic/system-small.md +21 -0
package/dist/index.js
CHANGED
|
@@ -7246,7 +7246,8 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
7246
7246
|
if (!pid) {
|
|
7247
7247
|
try {
|
|
7248
7248
|
await this.doConnect({
|
|
7249
|
-
agent_name: "
|
|
7249
|
+
agent_name: "",
|
|
7250
|
+
// will use mnemonic generator in doConnect
|
|
7250
7251
|
agent_type: "general"
|
|
7251
7252
|
});
|
|
7252
7253
|
pid = this.getDaemonPid();
|
|
@@ -7486,7 +7487,18 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
7486
7487
|
await this.ensureWallet();
|
|
7487
7488
|
const daemonPath = join12(this.nexusDir, "nexus-daemon.mjs");
|
|
7488
7489
|
await writeFile6(daemonPath, DAEMON_SCRIPT);
|
|
7489
|
-
const agentName = args.agent_name ||
|
|
7490
|
+
const agentName = args.agent_name || (() => {
|
|
7491
|
+
const ADJ = ["swift", "bright", "calm", "deep", "bold", "keen", "warm", "clear", "soft", "sharp", "quick", "cool", "fair", "free", "kind", "pure", "sage", "true", "wild", "wise", "dark", "gold", "iron", "jade", "ruby", "silk", "void", "dawn", "dusk", "rain", "star", "moon", "wave", "fire", "snow", "leaf", "oak", "pine", "ash", "elm"];
|
|
7492
|
+
const NOUN = ["hawk", "wolf", "bear", "deer", "hare", "lynx", "crow", "wren", "dove", "swan", "pike", "bass", "carp", "reef", "tide", "vale", "glen", "peak", "mesa", "ford", "arch", "gate", "node", "core", "link", "mesh", "flux", "grid", "cell", "hub", "bolt", "gear", "coil", "ring", "lens", "orb", "cube", "dome", "shard", "rune"];
|
|
7493
|
+
const seed = `${hostname()}:${userInfo().username}`;
|
|
7494
|
+
let h = 2166136261;
|
|
7495
|
+
for (let i = 0; i < seed.length; i++) {
|
|
7496
|
+
h ^= seed.charCodeAt(i);
|
|
7497
|
+
h = Math.imul(h, 16777619);
|
|
7498
|
+
}
|
|
7499
|
+
h = h >>> 0;
|
|
7500
|
+
return `${ADJ[h % ADJ.length]}-${NOUN[(h >>> 8) % NOUN.length]}-${((h >>> 16) % 100).toString().padStart(2, "0")}`;
|
|
7501
|
+
})();
|
|
7490
7502
|
const agentType = args.agent_type || "general";
|
|
7491
7503
|
const nodePaths = [nodeModulesDir];
|
|
7492
7504
|
try {
|
|
@@ -22320,6 +22332,28 @@ Integrate this guidance into your current approach. Continue working on the task
|
|
|
22320
22332
|
});
|
|
22321
22333
|
}
|
|
22322
22334
|
const turnTier = this.options.modelTier ?? "large";
|
|
22335
|
+
if (turn === 1 && (turnTier === "small" || turnTier === "medium")) {
|
|
22336
|
+
const goal = this._taskState.goal || "";
|
|
22337
|
+
const wordCount = goal.split(/\s+/).length;
|
|
22338
|
+
const hasMultipleActions = /\band\b.*\band\b|then.*then|also.*also/i.test(goal);
|
|
22339
|
+
const hasMultipleFiles = /files?.*files?|\.ts.*\.ts|create.*write|modify.*create/i.test(goal);
|
|
22340
|
+
const isComplex = wordCount > 40 || hasMultipleActions || hasMultipleFiles;
|
|
22341
|
+
if (isComplex) {
|
|
22342
|
+
messages.push({
|
|
22343
|
+
role: "user",
|
|
22344
|
+
content: `[TASK DECOMPOSITION \u2014 Complete these steps IN ORDER]
|
|
22345
|
+
|
|
22346
|
+
This task has multiple parts. Do them one at a time:
|
|
22347
|
+
1. LOCATE: Find and read the relevant file(s). List what you found.
|
|
22348
|
+
2. UNDERSTAND: Describe the current behavior in one sentence.
|
|
22349
|
+
3. PLAN: State exactly what changes you'll make (file, function, change).
|
|
22350
|
+
4. IMPLEMENT: Make the changes one file at a time. Test after each file.
|
|
22351
|
+
5. COMPLETE: Call task_complete only after ALL parts are verified.
|
|
22352
|
+
|
|
22353
|
+
Start with step 1 \u2014 read the relevant files NOW.`
|
|
22354
|
+
});
|
|
22355
|
+
}
|
|
22356
|
+
}
|
|
22323
22357
|
const turnBudget = turnTier === "small" ? 5 : turnTier === "medium" ? 8 : 0;
|
|
22324
22358
|
if (turnBudget > 0 && turn > 0 && turn % turnBudget === 0) {
|
|
22325
22359
|
const repetitionRatio = this.detectRepetition(toolCallLog);
|
|
@@ -23594,7 +23628,10 @@ ${trimmedNew}`;
|
|
|
23594
23628
|
return `The path "${lastFilePath}" does not exist. Call list_directory(".") to find correct paths, then try again.`;
|
|
23595
23629
|
}
|
|
23596
23630
|
if (/FAIL|test.*fail|assert/i.test(lastError)) {
|
|
23597
|
-
return `Tests are failing.
|
|
23631
|
+
return `Tests are failing. Do these TWO steps in order:
|
|
23632
|
+
STEP 1: Write a 5-line script isolating JUST the failing case, run it with shell, and observe the actual output.
|
|
23633
|
+
STEP 2: Based on what you observed (not assumed), edit ONLY the specific line(s) causing the failure.
|
|
23634
|
+
Do NOT rewrite the entire function. Patch the specific fault, then re-run tests.`;
|
|
23598
23635
|
}
|
|
23599
23636
|
if (/permission denied/i.test(lastError)) {
|
|
23600
23637
|
return `Permission denied on "${lastFilePath}". Try a different approach or check file permissions.`;
|
|
@@ -23602,6 +23639,11 @@ ${trimmedNew}`;
|
|
|
23602
23639
|
return `Your last ${lastToolName} call failed: ${lastError.slice(0, 100)}. Fix the issue and try a different approach.`;
|
|
23603
23640
|
}
|
|
23604
23641
|
if (lastToolName === "file_read") {
|
|
23642
|
+
const taskGoal = (this._taskState.goal || "").toLowerCase();
|
|
23643
|
+
const isDebugging = /bug|fix|debug|broken|wrong|fail|error|issue|refactor|extract/i.test(taskGoal);
|
|
23644
|
+
if (isDebugging) {
|
|
23645
|
+
return `You just read "${lastFilePath}". Before changing anything, WRITE A QUICK TEST to observe the current behavior: shell(command="node -e \\"...\\""") or repl_exec. See what actually happens \u2014 don't guess. Then fix based on what you observed.`;
|
|
23646
|
+
}
|
|
23605
23647
|
return `You just read "${lastFilePath}". Now make the needed changes with file_edit, or if exploring, decide what to modify.`;
|
|
23606
23648
|
}
|
|
23607
23649
|
if (lastToolName === "file_edit" || lastToolName === "file_write") {
|
|
@@ -45478,6 +45520,26 @@ var init_carousel = __esm({
|
|
|
45478
45520
|
});
|
|
45479
45521
|
|
|
45480
45522
|
// packages/cli/dist/tui/banner.js
|
|
45523
|
+
function generateMnemonic(seed) {
|
|
45524
|
+
let h = 2166136261;
|
|
45525
|
+
for (let i = 0; i < seed.length; i++) {
|
|
45526
|
+
h ^= seed.charCodeAt(i);
|
|
45527
|
+
h = Math.imul(h, 16777619);
|
|
45528
|
+
}
|
|
45529
|
+
h = h >>> 0;
|
|
45530
|
+
const adj = MNEMONIC_ADJECTIVES[h % MNEMONIC_ADJECTIVES.length];
|
|
45531
|
+
const noun = MNEMONIC_NOUNS[(h >>> 8) % MNEMONIC_NOUNS.length];
|
|
45532
|
+
const num = ((h >>> 16) % 100).toString().padStart(2, "0");
|
|
45533
|
+
return `${adj}-${noun}-${num}`;
|
|
45534
|
+
}
|
|
45535
|
+
function getNodeMnemonic() {
|
|
45536
|
+
try {
|
|
45537
|
+
const { hostname: hostname2, userInfo: userInfo2 } = __require("node:os");
|
|
45538
|
+
return generateMnemonic(`${hostname2()}:${userInfo2().username}`);
|
|
45539
|
+
} catch {
|
|
45540
|
+
return generateMnemonic("unknown-node");
|
|
45541
|
+
}
|
|
45542
|
+
}
|
|
45481
45543
|
function createDefaultBanner(version = "0.120.0") {
|
|
45482
45544
|
const width = process.stdout.columns ?? 80;
|
|
45483
45545
|
const rows = 3;
|
|
@@ -45514,10 +45576,16 @@ function createDefaultBanner(version = "0.120.0") {
|
|
|
45514
45576
|
}
|
|
45515
45577
|
grid.push(row);
|
|
45516
45578
|
}
|
|
45579
|
+
const mnemonic = getNodeMnemonic();
|
|
45517
45580
|
const versionText = ` OA v${version}`;
|
|
45581
|
+
const mnemonicSuffix = ` \xB7 ${mnemonic}`;
|
|
45518
45582
|
for (let i = 0; i < versionText.length && i < width; i++) {
|
|
45519
45583
|
grid[0][i] = { char: versionText[i], fg: yellow, bg: bgDark, bold: true };
|
|
45520
45584
|
}
|
|
45585
|
+
const mnemonicStart = versionText.length;
|
|
45586
|
+
for (let i = 0; i < mnemonicSuffix.length && mnemonicStart + i < Math.floor(width * 0.44); i++) {
|
|
45587
|
+
grid[0][mnemonicStart + i] = { char: mnemonicSuffix[i], fg: 240, bg: bgDark, bold: false };
|
|
45588
|
+
}
|
|
45521
45589
|
const cwd4 = process.cwd();
|
|
45522
45590
|
const shortCwd = cwd4.length > 40 ? "..." + cwd4.slice(-37) : cwd4;
|
|
45523
45591
|
const infoText = ` ${shortCwd}`;
|
|
@@ -45575,11 +45643,95 @@ function createCohereBanner() {
|
|
|
45575
45643
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
45576
45644
|
};
|
|
45577
45645
|
}
|
|
45578
|
-
var isTTY7, BannerRenderer;
|
|
45646
|
+
var isTTY7, MNEMONIC_ADJECTIVES, MNEMONIC_NOUNS, BannerRenderer;
|
|
45579
45647
|
var init_banner = __esm({
|
|
45580
45648
|
"packages/cli/dist/tui/banner.js"() {
|
|
45581
45649
|
"use strict";
|
|
45582
45650
|
isTTY7 = process.stdout.isTTY ?? false;
|
|
45651
|
+
MNEMONIC_ADJECTIVES = [
|
|
45652
|
+
"swift",
|
|
45653
|
+
"bright",
|
|
45654
|
+
"calm",
|
|
45655
|
+
"deep",
|
|
45656
|
+
"bold",
|
|
45657
|
+
"keen",
|
|
45658
|
+
"warm",
|
|
45659
|
+
"clear",
|
|
45660
|
+
"soft",
|
|
45661
|
+
"sharp",
|
|
45662
|
+
"quick",
|
|
45663
|
+
"cool",
|
|
45664
|
+
"fair",
|
|
45665
|
+
"free",
|
|
45666
|
+
"kind",
|
|
45667
|
+
"pure",
|
|
45668
|
+
"sage",
|
|
45669
|
+
"true",
|
|
45670
|
+
"wild",
|
|
45671
|
+
"wise",
|
|
45672
|
+
"dark",
|
|
45673
|
+
"gold",
|
|
45674
|
+
"iron",
|
|
45675
|
+
"jade",
|
|
45676
|
+
"ruby",
|
|
45677
|
+
"silk",
|
|
45678
|
+
"void",
|
|
45679
|
+
"dawn",
|
|
45680
|
+
"dusk",
|
|
45681
|
+
"rain",
|
|
45682
|
+
"star",
|
|
45683
|
+
"moon",
|
|
45684
|
+
"wave",
|
|
45685
|
+
"fire",
|
|
45686
|
+
"snow",
|
|
45687
|
+
"leaf",
|
|
45688
|
+
"oak",
|
|
45689
|
+
"pine",
|
|
45690
|
+
"ash",
|
|
45691
|
+
"elm"
|
|
45692
|
+
];
|
|
45693
|
+
MNEMONIC_NOUNS = [
|
|
45694
|
+
"hawk",
|
|
45695
|
+
"wolf",
|
|
45696
|
+
"bear",
|
|
45697
|
+
"deer",
|
|
45698
|
+
"hare",
|
|
45699
|
+
"lynx",
|
|
45700
|
+
"crow",
|
|
45701
|
+
"wren",
|
|
45702
|
+
"dove",
|
|
45703
|
+
"swan",
|
|
45704
|
+
"pike",
|
|
45705
|
+
"bass",
|
|
45706
|
+
"carp",
|
|
45707
|
+
"reef",
|
|
45708
|
+
"tide",
|
|
45709
|
+
"vale",
|
|
45710
|
+
"glen",
|
|
45711
|
+
"peak",
|
|
45712
|
+
"mesa",
|
|
45713
|
+
"ford",
|
|
45714
|
+
"arch",
|
|
45715
|
+
"gate",
|
|
45716
|
+
"node",
|
|
45717
|
+
"core",
|
|
45718
|
+
"link",
|
|
45719
|
+
"mesh",
|
|
45720
|
+
"flux",
|
|
45721
|
+
"grid",
|
|
45722
|
+
"cell",
|
|
45723
|
+
"hub",
|
|
45724
|
+
"bolt",
|
|
45725
|
+
"gear",
|
|
45726
|
+
"coil",
|
|
45727
|
+
"ring",
|
|
45728
|
+
"lens",
|
|
45729
|
+
"orb",
|
|
45730
|
+
"cube",
|
|
45731
|
+
"dome",
|
|
45732
|
+
"shard",
|
|
45733
|
+
"rune"
|
|
45734
|
+
];
|
|
45583
45735
|
BannerRenderer = class {
|
|
45584
45736
|
currentDesign = null;
|
|
45585
45737
|
currentFrame = 0;
|
package/package.json
CHANGED
|
@@ -78,3 +78,11 @@ You are **Open Agent** (open-agents-ai), an autonomous AI coding agent running o
|
|
|
78
78
|
- Custom tools: create reusable tools from repeated workflows
|
|
79
79
|
|
|
80
80
|
When asked "how do you work?" or "what can you do?", answer from this list and use explore_tools() or skill_list() to provide specifics. Do NOT hallucinate capabilities — use tools to discover concrete information.
|
|
81
|
+
|
|
82
|
+
## Debugging — Observe Before Reasoning
|
|
83
|
+
|
|
84
|
+
When uncertain about runtime behavior (types, return values, edge cases), run a quick test instead of guessing:
|
|
85
|
+
- `shell(command="node -e \"...\"")` to check JavaScript behavior
|
|
86
|
+
- `repl_exec` to run Python experiments with persistent state
|
|
87
|
+
- Write existing behavior as a test BEFORE refactoring. If the test breaks after your change, your refactor is wrong.
|
|
88
|
+
- Don't reason about 10+ lines of code in your head — execute and observe.
|
|
@@ -24,3 +24,24 @@ Rules:
|
|
|
24
24
|
- You are **Open Agent** (open-agents-ai) — an AI coding agent running locally via Ollama/vLLM. No cloud APIs.
|
|
25
25
|
- Core: code editing, shell commands, web search, memory, 250+ skills (skill_list), P2P mesh (nexus — call connect FIRST), background tasks.
|
|
26
26
|
- When asked "what can you do?", use explore_tools() and skill_list() to discover and report your actual capabilities. Do NOT hallucinate.
|
|
27
|
+
|
|
28
|
+
Debugging — OBSERVE before reasoning:
|
|
29
|
+
- When unsure how code behaves at runtime, DO NOT guess. Write a short test script and RUN it:
|
|
30
|
+
shell(command="node -e \"console.log(JSON.parse(JSON.stringify({d: new Date()})))\"")
|
|
31
|
+
- Look at actual output. Then fix based on what you observed, not what you assumed.
|
|
32
|
+
- For type questions: run `typeof x` or `x instanceof Date` in shell to check.
|
|
33
|
+
- For refactoring: before changing code, write the existing behavior as a test. Run it. Then change code. Run test again. If it breaks, your refactor has a bug.
|
|
34
|
+
- NEVER reason about 10+ lines of code in your head. Use shell to execute and observe instead.
|
|
35
|
+
|
|
36
|
+
When a test fails — TWO-STEP debug:
|
|
37
|
+
1. ISOLATE: Write a 5-line script reproducing JUST the failing case. Run it. Read the output.
|
|
38
|
+
2. PATCH: Based on what you SAW (not guessed), edit ONLY the failing line(s). Re-run test.
|
|
39
|
+
Do NOT rewrite whole functions. Patch the specific fault.
|
|
40
|
+
|
|
41
|
+
Complex tasks — DECOMPOSE first:
|
|
42
|
+
1. LOCATE: Find and read the relevant file(s).
|
|
43
|
+
2. UNDERSTAND: Describe current behavior in one sentence.
|
|
44
|
+
3. PLAN: State what changes you'll make (which file, which function, what change).
|
|
45
|
+
4. IMPLEMENT: Make changes one at a time.
|
|
46
|
+
5. TEST: Run tests after each change.
|
|
47
|
+
6. COMPLETE: Call task_complete when ALL parts are done.
|