open-agents-ai 0.138.67 → 0.138.69
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 +69 -5
- package/package.json +1 -1
- package/prompts/agentic/system-small.md +6 -0
package/dist/index.js
CHANGED
|
@@ -21985,6 +21985,17 @@ var init_agenticRunner = __esm({
|
|
|
21985
21985
|
tokenEstimate: Math.ceil(personalitySuffix.length / 4)
|
|
21986
21986
|
});
|
|
21987
21987
|
}
|
|
21988
|
+
if (this.options.identityInjection) {
|
|
21989
|
+
sections.push({
|
|
21990
|
+
label: "c_identity",
|
|
21991
|
+
content: `
|
|
21992
|
+
|
|
21993
|
+
<identity-state>
|
|
21994
|
+
${this.options.identityInjection}
|
|
21995
|
+
</identity-state>`,
|
|
21996
|
+
tokenEstimate: Math.ceil(this.options.identityInjection.length / 4)
|
|
21997
|
+
});
|
|
21998
|
+
}
|
|
21988
21999
|
if (this.options.dynamicContext) {
|
|
21989
22000
|
sections.push({
|
|
21990
22001
|
label: "c_know",
|
|
@@ -22353,6 +22364,35 @@ This task has multiple parts. Do them one at a time:
|
|
|
22353
22364
|
Start with step 1 \u2014 read the relevant files NOW.`
|
|
22354
22365
|
});
|
|
22355
22366
|
}
|
|
22367
|
+
const isGreenfield = /\bcreate\b.*\bnew\b|\bimplement\b.*\bclass\b|\bwrite\b.*\bfrom scratch\b|\bbuild\b.*\bmodule\b/i.test(goal);
|
|
22368
|
+
if (isGreenfield && !isComplex) {
|
|
22369
|
+
messages.push({
|
|
22370
|
+
role: "user",
|
|
22371
|
+
content: `[GREENFIELD TASK \u2014 Write code immediately]
|
|
22372
|
+
|
|
22373
|
+
MANDATORY: Your FIRST tool call MUST be file_write.
|
|
22374
|
+
Write a skeleton with method signatures and inline comments describing each method's logic.
|
|
22375
|
+
Use placeholder implementations (e.g., \`throw new Error("not implemented")\` or empty bodies).
|
|
22376
|
+
|
|
22377
|
+
Do NOT plan. Do NOT explain. Call file_write NOW with the skeleton.
|
|
22378
|
+
After writing the skeleton, fill in each method one at a time, testing after each.
|
|
22379
|
+
|
|
22380
|
+
Example structure:
|
|
22381
|
+
\`\`\`
|
|
22382
|
+
class MyClass {
|
|
22383
|
+
// Store data in a Map
|
|
22384
|
+
private data = new Map();
|
|
22385
|
+
|
|
22386
|
+
// Add an item \u2014 validates input, stores in map
|
|
22387
|
+
add(key: string, value: any): void {
|
|
22388
|
+
this.data.set(key, value);
|
|
22389
|
+
}
|
|
22390
|
+
}
|
|
22391
|
+
\`\`\`
|
|
22392
|
+
|
|
22393
|
+
Now call file_write with YOUR skeleton for this task.`
|
|
22394
|
+
});
|
|
22395
|
+
}
|
|
22356
22396
|
}
|
|
22357
22397
|
const turnBudget = turnTier === "small" ? 5 : turnTier === "medium" ? 8 : 0;
|
|
22358
22398
|
if (turnBudget > 0 && turn > 0 && turn % turnBudget === 0) {
|
|
@@ -54012,7 +54052,7 @@ async function runSelfImprovementCycle(repoRoot) {
|
|
|
54012
54052
|
const { ReflectionIntegrityTool: ReflectionIntegrityTool2 } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
54013
54053
|
const ik = new IdentityKernelTool2(repoRoot);
|
|
54014
54054
|
const reflect = new ReflectionIntegrityTool2(repoRoot);
|
|
54015
|
-
const state = await ik.execute({
|
|
54055
|
+
const state = await ik.execute({ op: "hydrate" });
|
|
54016
54056
|
if (!state.success)
|
|
54017
54057
|
return;
|
|
54018
54058
|
const diagnosis = await reflect.execute({
|
|
@@ -54022,7 +54062,7 @@ async function runSelfImprovementCycle(repoRoot) {
|
|
|
54022
54062
|
if (diagnosis.success && diagnosis.output) {
|
|
54023
54063
|
const diagText = String(diagnosis.output).slice(0, 500);
|
|
54024
54064
|
await ik.execute({
|
|
54025
|
-
|
|
54065
|
+
op: "propose_update",
|
|
54026
54066
|
field: "narrative_summary",
|
|
54027
54067
|
value: diagText,
|
|
54028
54068
|
justification: "Self-improvement cycle: reflection diagnostic after " + SELF_IMPROVE_INTERVAL + " tasks"
|
|
@@ -54170,6 +54210,29 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
54170
54210
|
} catch {
|
|
54171
54211
|
}
|
|
54172
54212
|
const compactionThreshold = modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
54213
|
+
let identityInjection = "";
|
|
54214
|
+
try {
|
|
54215
|
+
const ikStateFile = join59(repoRoot, ".oa", "identity", "self-state.json");
|
|
54216
|
+
if (existsSync43(ikStateFile)) {
|
|
54217
|
+
const selfState = JSON.parse(readFileSync32(ikStateFile, "utf8"));
|
|
54218
|
+
const lines = [
|
|
54219
|
+
`[Identity State v${selfState.version}]`,
|
|
54220
|
+
`Self: ${selfState.narrative_summary}`,
|
|
54221
|
+
`Values: ${(selfState.values_stack || []).join(", ")}`,
|
|
54222
|
+
`Style: ${selfState.interaction_style?.tone || "collaborative"}, ${selfState.interaction_style?.depth_default || "balanced"} depth`
|
|
54223
|
+
];
|
|
54224
|
+
if (selfState.active_commitments?.length > 0)
|
|
54225
|
+
lines.push(`Commitments: ${selfState.active_commitments.join("; ")}`);
|
|
54226
|
+
if (selfState.active_goals?.length > 0)
|
|
54227
|
+
lines.push(`Goals: ${selfState.active_goals.join("; ")}`);
|
|
54228
|
+
const h = selfState.homeostasis;
|
|
54229
|
+
if (h && (h.uncertainty > 0.3 || h.coherence < 0.7 || h.goal_tension > 0.3)) {
|
|
54230
|
+
lines.push(`Homeostasis: uncertainty=${h.uncertainty.toFixed(1)} coherence=${h.coherence.toFixed(1)} tension=${h.goal_tension.toFixed(1)}`);
|
|
54231
|
+
}
|
|
54232
|
+
identityInjection = lines.join("\n");
|
|
54233
|
+
}
|
|
54234
|
+
} catch {
|
|
54235
|
+
}
|
|
54173
54236
|
const runner = new AgenticRunner(backend, {
|
|
54174
54237
|
maxTurns: 60,
|
|
54175
54238
|
maxTokens: 16384,
|
|
@@ -54188,7 +54251,8 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
54188
54251
|
// effectively unlimited — no hard timeout, agent runs until complete or aborted
|
|
54189
54252
|
contextWindowSize: contextWindowSize ?? 0,
|
|
54190
54253
|
personality: personality ? getPreset(personality) : void 0,
|
|
54191
|
-
personalityName: personality ?? void 0
|
|
54254
|
+
personalityName: personality ?? void 0,
|
|
54255
|
+
identityInjection
|
|
54192
54256
|
});
|
|
54193
54257
|
runner.setWorkingDirectory(repoRoot);
|
|
54194
54258
|
const tools = buildTools(repoRoot, config, contextWindowSize);
|
|
@@ -54790,7 +54854,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
54790
54854
|
Promise.resolve().then(() => (init_dist2(), dist_exports)).then(({ IdentityKernelTool: IdentityKernelTool2 }) => {
|
|
54791
54855
|
const ik = new IdentityKernelTool2(repoRoot);
|
|
54792
54856
|
ik.execute({
|
|
54793
|
-
|
|
54857
|
+
op: "observe",
|
|
54794
54858
|
event: `Task completed: ${result.summary.slice(0, 200)}`,
|
|
54795
54859
|
context: JSON.stringify({ turns: result.turns, toolCalls: result.toolCalls, durationMs: result.durationMs, model: config.model, completed: true })
|
|
54796
54860
|
}).catch(() => {
|
|
@@ -54807,7 +54871,7 @@ When done, either call task_complete with your answer, or use FINAL_VAR(variable
|
|
|
54807
54871
|
Promise.resolve().then(() => (init_dist2(), dist_exports)).then(({ IdentityKernelTool: IdentityKernelTool2 }) => {
|
|
54808
54872
|
const ik = new IdentityKernelTool2(repoRoot);
|
|
54809
54873
|
ik.execute({
|
|
54810
|
-
|
|
54874
|
+
op: "observe",
|
|
54811
54875
|
event: `Task incomplete after ${result.turns} turns`,
|
|
54812
54876
|
context: JSON.stringify({ turns: result.turns, toolCalls: result.toolCalls, durationMs: result.durationMs, completed: false })
|
|
54813
54877
|
}).catch(() => {
|
package/package.json
CHANGED
|
@@ -38,6 +38,12 @@ When a test fails — TWO-STEP debug:
|
|
|
38
38
|
2. PATCH: Based on what you SAW (not guessed), edit ONLY the failing line(s). Re-run test.
|
|
39
39
|
Do NOT rewrite whole functions. Patch the specific fault.
|
|
40
40
|
|
|
41
|
+
Creating new files — WRITE FIRST, refine later:
|
|
42
|
+
- Your FIRST tool call MUST be file_write with a skeleton (class + method signatures + comments).
|
|
43
|
+
- Do NOT plan or explain before writing. Write the skeleton immediately.
|
|
44
|
+
- After writing: fill in each method, test after each one.
|
|
45
|
+
- A bad first draft you can fix is better than no draft at all.
|
|
46
|
+
|
|
41
47
|
Complex tasks — DECOMPOSE first:
|
|
42
48
|
1. LOCATE: Find and read the relevant file(s).
|
|
43
49
|
2. UNDERSTAND: Describe current behavior in one sentence.
|