open-agents-ai 0.39.0 → 0.40.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/README.md +30 -7
- package/dist/index.js +143 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ Long conversations consume context window tokens. Open Agents uses progressive c
|
|
|
109
109
|
|
|
110
110
|
### How It Works
|
|
111
111
|
|
|
112
|
-
Compaction triggers automatically when estimated token usage reaches
|
|
112
|
+
Compaction triggers automatically when estimated token usage reaches a tier-proportional threshold of the model's context window. The system:
|
|
113
113
|
|
|
114
114
|
1. **Preserves** the system prompt and initial user task (head messages)
|
|
115
115
|
2. **Summarizes** middle messages (tool calls, results, exploration) into a structured digest
|
|
@@ -131,13 +131,36 @@ Six strategies are available via `/compact <strategy>`:
|
|
|
131
131
|
|
|
132
132
|
### Automatic Compaction
|
|
133
133
|
|
|
134
|
-
Compaction thresholds scale
|
|
134
|
+
Compaction thresholds scale **proportionally** with the model's actual context window size:
|
|
135
135
|
|
|
136
|
-
| Model Tier |
|
|
137
|
-
|
|
138
|
-
| Large (30B+) |
|
|
139
|
-
| Medium (8-29B) |
|
|
140
|
-
| Small (≤7B) |
|
|
136
|
+
| Model Tier | Normal Mode | Deep Context Mode | Recent Messages Kept |
|
|
137
|
+
|------------|-------------|-------------------|---------------------|
|
|
138
|
+
| Large (30B+) | 75% of context window | 85% of context window | 4-12 (normal) / 4-24 (deep) |
|
|
139
|
+
| Medium (8-29B) | 70% of context window | 85% of context window | 4-12 (normal) / 4-24 (deep) |
|
|
140
|
+
| Small (≤7B) | 65% of context window | 85% of context window | 4-12 (normal) / 4-24 (deep) |
|
|
141
|
+
|
|
142
|
+
For example, a 128K-context large model compacts at ~96K tokens in normal mode (75%) or ~109K tokens in deep mode (85%) — instead of the previous fixed 40K threshold that wasted 69% of available context.
|
|
143
|
+
|
|
144
|
+
### Deep Context Mode (`/deep`)
|
|
145
|
+
|
|
146
|
+
Toggle with `/deep` — relaxes compaction so large models leverage more of their context window for complex multi-step reasoning.
|
|
147
|
+
|
|
148
|
+
When deep context is active:
|
|
149
|
+
- **Compaction fires at 85%** of context instead of 65-75% — the model retains much more working memory
|
|
150
|
+
- **Double the recent messages** (up to 24 instead of 12) preserved after compaction
|
|
151
|
+
- **Richer summaries** — compression budget increased from 20% to 30% of context
|
|
152
|
+
- **Larger tool outputs** — cap raised from 8K to 16K chars per tool result
|
|
153
|
+
- **Relaxed output folding** — more head/tail lines preserved (50/25 instead of 20/10 for large models)
|
|
154
|
+
|
|
155
|
+
This mirrors how human cognition works during deep problem-solving: situationally-relevant memories are transiently activated to occupy a larger portion of working memory, with the most relevant details in high-attention positions while supporting context backs them up. LLM attention mechanisms work similarly — earlier relevant context still influences generation even at lower positional weight.
|
|
156
|
+
|
|
157
|
+
Use deep context for:
|
|
158
|
+
- Complex multi-file refactoring or debugging
|
|
159
|
+
- Architecture analysis across many files
|
|
160
|
+
- Long debugging sessions where error context from earlier is critical
|
|
161
|
+
- Tasks where the agent needs to reason about patterns across many files
|
|
162
|
+
|
|
163
|
+
The setting persists to `.oa/settings.json`. Deep context is particularly valuable for models with 64K+ context windows (Qwen3.5-122B, Llama 3.1 70B, etc.) where the default thresholds were leaving significant capacity unused.
|
|
141
164
|
|
|
142
165
|
### Status Bar Context Tracking (`Ctx:`)
|
|
143
166
|
|
package/dist/index.js
CHANGED
|
@@ -13180,6 +13180,7 @@ Rules:
|
|
|
13180
13180
|
taskTimeoutMs: options?.taskTimeoutMs ?? 36e5,
|
|
13181
13181
|
// 60 min
|
|
13182
13182
|
compactionThreshold: options?.compactionThreshold ?? 4e4,
|
|
13183
|
+
deepContext: options?.deepContext ?? false,
|
|
13183
13184
|
dynamicContext: options?.dynamicContext ?? "",
|
|
13184
13185
|
streamEnabled: options?.streamEnabled ?? false,
|
|
13185
13186
|
bruteForce: options?.bruteForce ?? true,
|
|
@@ -13225,19 +13226,47 @@ Rules:
|
|
|
13225
13226
|
/**
|
|
13226
13227
|
* Compute all context-dependent limits from the current contextWindowSize
|
|
13227
13228
|
* and modelTier. Returns sensible defaults when contextWindowSize is 0.
|
|
13229
|
+
*
|
|
13230
|
+
* Key insight: LLM attention is most effective when the most relevant content
|
|
13231
|
+
* sits in high-attention positions (start and end of context). Rather than
|
|
13232
|
+
* compacting aggressively and losing detail, we scale thresholds proportionally
|
|
13233
|
+
* to the model's actual context window so larger models can leverage more of
|
|
13234
|
+
* their capacity. The deepContext flag further relaxes limits for complex
|
|
13235
|
+
* multi-step reasoning where earlier context carries critical signal.
|
|
13236
|
+
*
|
|
13237
|
+
* Context utilization targets:
|
|
13238
|
+
* - Small models: compact at ~65% (limited attention span, aggressive helps)
|
|
13239
|
+
* - Medium models: compact at ~70% (balanced)
|
|
13240
|
+
* - Large models: compact at ~75% (plenty of room, let attention work)
|
|
13241
|
+
* - Deep context: compact at ~85% (trust the model's full attention window)
|
|
13228
13242
|
*/
|
|
13229
13243
|
contextLimits() {
|
|
13230
13244
|
const ctx = this.options.contextWindowSize;
|
|
13231
13245
|
const tier = this.options.modelTier ?? "large";
|
|
13232
|
-
const
|
|
13233
|
-
|
|
13234
|
-
|
|
13246
|
+
const deep = this.options.deepContext ?? false;
|
|
13247
|
+
let compactionThreshold;
|
|
13248
|
+
if (ctx > 0) {
|
|
13249
|
+
const factor = deep ? 0.85 : tier === "small" ? 0.65 : tier === "medium" ? 0.7 : 0.75;
|
|
13250
|
+
compactionThreshold = Math.floor(ctx * factor);
|
|
13251
|
+
} else {
|
|
13252
|
+
compactionThreshold = deep ? 8e4 : this.options.compactionThreshold;
|
|
13253
|
+
}
|
|
13254
|
+
const keepRecentMax = deep ? 24 : 12;
|
|
13255
|
+
let keepRecent;
|
|
13256
|
+
if (ctx > 0) {
|
|
13257
|
+
const keepRecentDivisor = tier === "small" ? 2e3 : tier === "medium" ? 3e3 : 4e3;
|
|
13258
|
+
keepRecent = Math.max(4, Math.min(keepRecentMax, Math.floor(ctx / keepRecentDivisor)));
|
|
13259
|
+
} else {
|
|
13260
|
+
keepRecent = deep ? 20 : 12;
|
|
13261
|
+
}
|
|
13235
13262
|
const maxOutputTokens = ctx > 0 ? Math.min(this.options.maxTokens, Math.max(2048, Math.floor(ctx * 0.25))) : this.options.maxTokens;
|
|
13236
|
-
const
|
|
13237
|
-
const
|
|
13238
|
-
const
|
|
13239
|
-
const
|
|
13240
|
-
const
|
|
13263
|
+
const toolOutputCeiling = deep ? 16e3 : 8e3;
|
|
13264
|
+
const toolOutputMaxChars = ctx > 0 ? Math.max(2e3, Math.min(toolOutputCeiling, Math.floor(ctx * (deep ? 0.8 : 0.5)))) : toolOutputCeiling;
|
|
13265
|
+
const foldLineThreshold = deep ? tier === "small" ? 50 : tier === "medium" ? 80 : 120 : tier === "small" ? 30 : tier === "medium" ? 35 : 40;
|
|
13266
|
+
const foldHeadLines = deep ? tier === "small" ? 20 : tier === "medium" ? 30 : 50 : tier === "small" ? 12 : tier === "medium" ? 16 : 20;
|
|
13267
|
+
const foldTailLines = deep ? tier === "small" ? 10 : tier === "medium" ? 15 : 25 : tier === "small" ? 5 : tier === "medium" ? 8 : 10;
|
|
13268
|
+
const maxSummaryCeiling = deep ? 16e3 : 8e3;
|
|
13269
|
+
const maxSummaryChars = ctx > 0 ? Math.max(2e3, Math.min(maxSummaryCeiling, Math.floor(ctx * (deep ? 0.3 : 0.2)))) : deep ? 8e3 : 4e3;
|
|
13241
13270
|
const repetitionWindow = tier === "small" ? 6 : tier === "medium" ? 8 : 10;
|
|
13242
13271
|
return {
|
|
13243
13272
|
compactionThreshold,
|
|
@@ -16914,6 +16943,7 @@ function renderSlashHelp() {
|
|
|
16914
16943
|
["/compact", "Force context compaction now (default strategy)"],
|
|
16915
16944
|
["/compact <strategy>", "Compact with strategy: aggressive, decisions, errors, summary, structured"],
|
|
16916
16945
|
["/bruteforce", "Toggle brute-force mode (auto re-engage on turn limit)"],
|
|
16946
|
+
["/deep", "Toggle deep context \u2014 relaxes compaction so large models use 85% of context"],
|
|
16917
16947
|
["/tools", "List agent-created custom tools"],
|
|
16918
16948
|
["/skills", "List available AIWG skills"],
|
|
16919
16949
|
["/skills <keyword>", "Filter skills by name or trigger"],
|
|
@@ -19451,6 +19481,18 @@ async function handleSlashCommand(input, ctx) {
|
|
|
19451
19481
|
renderInfo(`Brute-force mode: ${isOn ? "on" : "off"}${hasLocal ? " (project-local)" : ""}` + (isOn ? " \u2014 agent will auto re-engage when turn limit is hit, reassess and try creative strategies" : ""));
|
|
19452
19482
|
return "handled";
|
|
19453
19483
|
}
|
|
19484
|
+
case "deep":
|
|
19485
|
+
case "deep-context": {
|
|
19486
|
+
if (!ctx.deepContextToggle) {
|
|
19487
|
+
renderWarning("Deep context not available");
|
|
19488
|
+
return "handled";
|
|
19489
|
+
}
|
|
19490
|
+
const isOn = ctx.deepContextToggle();
|
|
19491
|
+
const save = hasLocal ? ctx.saveLocalSettings.bind(ctx) : ctx.saveSettings.bind(ctx);
|
|
19492
|
+
save({ deepContext: isOn });
|
|
19493
|
+
renderInfo(`Deep context mode: ${isOn ? "ON" : "OFF"}${hasLocal ? " (project-local)" : ""}` + (isOn ? " \u2014 compaction relaxed to 85% of context window. Large models will retain more working memory for complex reasoning." : " \u2014 compaction restored to default thresholds."));
|
|
19494
|
+
return "handled";
|
|
19495
|
+
}
|
|
19454
19496
|
case "emojis":
|
|
19455
19497
|
case "emoji": {
|
|
19456
19498
|
const current = ctx.getEmojis?.() ?? true;
|
|
@@ -23580,7 +23622,12 @@ var init_bless_engine = __esm({
|
|
|
23580
23622
|
// packages/cli/dist/tui/dmn-engine.js
|
|
23581
23623
|
import { existsSync as existsSync26, readFileSync as readFileSync19, writeFileSync as writeFileSync11, mkdirSync as mkdirSync12, readdirSync as readdirSync11, unlinkSync as unlinkSync5 } from "node:fs";
|
|
23582
23624
|
import { join as join36, basename as basename13 } from "node:path";
|
|
23583
|
-
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities) {
|
|
23625
|
+
function buildDMNGatherPrompt(recentTaskSummaries, dueReminders, attentionItems, memoryTopics, capabilities, competence, reflectionBuffer) {
|
|
23626
|
+
const competenceReport = competence.length > 0 ? competence.map((c3) => {
|
|
23627
|
+
const rate = c3.attempts > 0 ? Math.round(c3.successes / c3.attempts * 100) : 0;
|
|
23628
|
+
return ` - ${c3.taskType}: ${c3.attempts} attempts, ${rate}% success`;
|
|
23629
|
+
}).join("\n") : " (no data yet \u2014 this is a fresh start)";
|
|
23630
|
+
const reflectionsText = reflectionBuffer.length > 0 ? reflectionBuffer.map((r, i) => ` ${i + 1}. ${r}`).join("\n") : " (none)";
|
|
23584
23631
|
return `DEFAULT MODE NETWORK \u2014 SELF-REFLECTION CYCLE
|
|
23585
23632
|
|
|
23586
23633
|
You are the agent's Default Mode Network. You activate between tasks to reflect,
|
|
@@ -23594,16 +23641,28 @@ task to pursue next. Think like a brain at rest: consolidating, planning, connec
|
|
|
23594
23641
|
|
|
23595
23642
|
PHASE 1: GATHER CONTEXT
|
|
23596
23643
|
|
|
23597
|
-
Use memory_search and memory_read to explore
|
|
23644
|
+
Use memory_search and memory_read to explore ALL stored knowledge. Be thorough.
|
|
23645
|
+
Look for:
|
|
23598
23646
|
- Standing directives ("always do X", "seek Y", "monitor Z")
|
|
23599
23647
|
- Unfinished goals or partially completed missions
|
|
23600
23648
|
- Knowledge gaps that could be filled
|
|
23601
23649
|
- Patterns in recent task history that suggest momentum direction
|
|
23602
23650
|
- Environmental signals (reminders, attention items)
|
|
23603
23651
|
|
|
23652
|
+
IMPORTANT: Start by searching memory broadly. Use memory_search with terms like
|
|
23653
|
+
"goal", "directive", "plan", "todo", "important" to find standing orders. Then
|
|
23654
|
+
read specific topics that seem relevant. The richness of your reasoning depends
|
|
23655
|
+
on how well you explore what you already know.
|
|
23656
|
+
|
|
23604
23657
|
Recent task history (last completed tasks):
|
|
23605
23658
|
${recentTaskSummaries.length > 0 ? recentTaskSummaries.map((s, i) => ` ${i + 1}. ${s}`).join("\n") : " (no recent tasks)"}
|
|
23606
23659
|
|
|
23660
|
+
Recent failures (Reflexion buffer \u2014 learn from these):
|
|
23661
|
+
${reflectionsText}
|
|
23662
|
+
|
|
23663
|
+
Competence tracker (attempts and success rate by category):
|
|
23664
|
+
${competenceReport}
|
|
23665
|
+
|
|
23607
23666
|
Due reminders:
|
|
23608
23667
|
${dueReminders.length > 0 ? dueReminders.map((r) => ` - ${r}`).join("\n") : " (none)"}
|
|
23609
23668
|
|
|
@@ -23618,36 +23677,53 @@ ${capabilities.map((c3) => ` - ${c3}`).join("\n")}
|
|
|
23618
23677
|
|
|
23619
23678
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
23620
23679
|
|
|
23621
|
-
PHASE 2: REFLECT & REASON
|
|
23680
|
+
PHASE 2: REFLECT, CONSOLIDATE & REASON (Generative Agents + Reflexion)
|
|
23681
|
+
|
|
23682
|
+
After gathering context, consolidate and reason:
|
|
23622
23683
|
|
|
23623
|
-
|
|
23684
|
+
Memory consolidation:
|
|
23685
|
+
- Are there overlapping or redundant memories that should be merged?
|
|
23686
|
+
- Are there new insights from recent tasks worth writing to memory?
|
|
23687
|
+
- Write any new insights to memory NOW using memory_write.
|
|
23688
|
+
|
|
23689
|
+
Self-evaluation (answer these questions in your reasoning):
|
|
23624
23690
|
1. What directives or goals have been set that still need work?
|
|
23625
23691
|
2. What was the momentum of recent tasks \u2014 what logically comes next?
|
|
23626
23692
|
3. Are there capabilities I haven't exercised that could be valuable?
|
|
23627
23693
|
4. What knowledge gaps exist that exploration could fill?
|
|
23628
23694
|
5. Are there environmental signals (reminders, attention items) to address?
|
|
23695
|
+
6. What can I learn from recent failures? (Check the Reflexion buffer above)
|
|
23696
|
+
7. Where is my learning progress fastest? (Check competence tracker \u2014 pursue
|
|
23697
|
+
categories where success rate is RISING, avoid categories where it's flat)
|
|
23629
23698
|
|
|
23630
23699
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
23631
23700
|
|
|
23632
|
-
PHASE 3: GENERATE CANDIDATES
|
|
23701
|
+
PHASE 3: GENERATE CANDIDATES (Voyager-style curriculum)
|
|
23702
|
+
|
|
23703
|
+
Propose 2-4 candidate next tasks. Use the "Goldilocks" principle from Voyager:
|
|
23704
|
+
propose tasks at the FRONTIER of current capabilities \u2014 neither too easy
|
|
23705
|
+
(already mastered) nor too hard (no chance of success). Check the competence
|
|
23706
|
+
tracker to calibrate difficulty.
|
|
23633
23707
|
|
|
23634
|
-
|
|
23635
|
-
- The task description (specific, actionable)
|
|
23708
|
+
For each candidate, specify:
|
|
23709
|
+
- The task description (specific, actionable, measurable)
|
|
23636
23710
|
- Rationale (why this task, what led you to it)
|
|
23637
23711
|
- Provenance (which memories, directives, or signals informed this)
|
|
23638
23712
|
- Category: directive | exploration | capability | maintenance | social
|
|
23639
|
-
- Confidence (0-1)
|
|
23713
|
+
- Confidence (0-1, calibrated against competence data)
|
|
23640
23714
|
|
|
23641
23715
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
23642
23716
|
|
|
23643
|
-
PHASE 4: ADVERSARIAL CHALLENGE
|
|
23717
|
+
PHASE 4: ADVERSARIAL CHALLENGE (Self-Rewarding + Constitutional AI)
|
|
23644
23718
|
|
|
23645
|
-
For each candidate,
|
|
23719
|
+
For each candidate, run a rigorous adversarial review:
|
|
23646
23720
|
- Is this actually useful or just busywork?
|
|
23647
23721
|
- Does it align with stored directives and goals?
|
|
23648
|
-
- Is it achievable with available tools?
|
|
23722
|
+
- Is it achievable with available tools and current competence?
|
|
23649
23723
|
- Could it cause harm or waste resources?
|
|
23650
23724
|
- Is there a higher-priority alternative?
|
|
23725
|
+
- Would this task help or hinder the agent's long-term growth?
|
|
23726
|
+
- Challenge your own confidence rating \u2014 are you overconfident?
|
|
23651
23727
|
|
|
23652
23728
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
23653
23729
|
|
|
@@ -23677,9 +23753,9 @@ Or if nothing is worth doing:
|
|
|
23677
23753
|
"reasoning": "why no task is worth pursuing right now"
|
|
23678
23754
|
}
|
|
23679
23755
|
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
|
|
23756
|
+
REMEMBER: Use memory_read, memory_write, and memory_search EXTENSIVELY.
|
|
23757
|
+
Write consolidation insights and new reflections to memory before selecting a task.
|
|
23758
|
+
The next DMN cycle (and the main agent) will benefit from anything you store now.
|
|
23683
23759
|
`;
|
|
23684
23760
|
}
|
|
23685
23761
|
function adaptTool2(tool) {
|
|
@@ -23746,7 +23822,9 @@ var init_dmn_engine = __esm({
|
|
|
23746
23822
|
totalCycles: 0,
|
|
23747
23823
|
lastCycleAt: null,
|
|
23748
23824
|
tasksGenerated: 0,
|
|
23749
|
-
consecutiveNulls: 0
|
|
23825
|
+
consecutiveNulls: 0,
|
|
23826
|
+
competence: [],
|
|
23827
|
+
reflectionBuffer: []
|
|
23750
23828
|
};
|
|
23751
23829
|
stateDir;
|
|
23752
23830
|
historyDir;
|
|
@@ -23766,11 +23844,41 @@ var init_dmn_engine = __esm({
|
|
|
23766
23844
|
return { ...this.state };
|
|
23767
23845
|
}
|
|
23768
23846
|
/** Record a completed task summary for context in future DMN cycles */
|
|
23769
|
-
recordTaskCompletion(summary) {
|
|
23847
|
+
recordTaskCompletion(summary, category) {
|
|
23770
23848
|
this.recentTaskSummaries.push(summary);
|
|
23771
23849
|
if (this.recentTaskSummaries.length > 10) {
|
|
23772
23850
|
this.recentTaskSummaries.shift();
|
|
23773
23851
|
}
|
|
23852
|
+
if (category) {
|
|
23853
|
+
this.updateCompetence(category, true);
|
|
23854
|
+
}
|
|
23855
|
+
this.saveState();
|
|
23856
|
+
}
|
|
23857
|
+
/** Record a task failure for Reflexion-style learning */
|
|
23858
|
+
recordTaskFailure(summary, errorContext, category) {
|
|
23859
|
+
const reflection = errorContext ? `FAILED: ${summary.slice(0, 200)} \u2014 Error: ${errorContext.slice(0, 300)}` : `FAILED: ${summary.slice(0, 500)}`;
|
|
23860
|
+
this.state.reflectionBuffer.push(reflection);
|
|
23861
|
+
if (this.state.reflectionBuffer.length > 5) {
|
|
23862
|
+
this.state.reflectionBuffer.shift();
|
|
23863
|
+
}
|
|
23864
|
+
if (category) {
|
|
23865
|
+
this.updateCompetence(category, false);
|
|
23866
|
+
}
|
|
23867
|
+
this.saveState();
|
|
23868
|
+
}
|
|
23869
|
+
/** Update competence tracker for a task category */
|
|
23870
|
+
updateCompetence(category, success) {
|
|
23871
|
+
let entry = this.state.competence.find((c3) => c3.taskType === category);
|
|
23872
|
+
if (!entry) {
|
|
23873
|
+
entry = { taskType: category, attempts: 0, successes: 0, failures: 0, lastAttempt: "" };
|
|
23874
|
+
this.state.competence.push(entry);
|
|
23875
|
+
}
|
|
23876
|
+
entry.attempts++;
|
|
23877
|
+
if (success)
|
|
23878
|
+
entry.successes++;
|
|
23879
|
+
else
|
|
23880
|
+
entry.failures++;
|
|
23881
|
+
entry.lastAttempt = (/* @__PURE__ */ new Date()).toISOString();
|
|
23774
23882
|
}
|
|
23775
23883
|
/**
|
|
23776
23884
|
* Run a DMN cycle — the core self-reflection loop.
|
|
@@ -23805,7 +23913,7 @@ var init_dmn_engine = __esm({
|
|
|
23805
23913
|
"codebase_map, diagnostic, git_info \u2014 project analysis",
|
|
23806
23914
|
"sub_agent \u2014 delegate subtasks to independent agents"
|
|
23807
23915
|
];
|
|
23808
|
-
const prompt = buildDMNGatherPrompt(this.recentTaskSummaries, reminders, attention, memoryTopics, capabilities);
|
|
23916
|
+
const prompt = buildDMNGatherPrompt(this.recentTaskSummaries, reminders, attention, memoryTopics, capabilities, this.state.competence, this.state.reflectionBuffer);
|
|
23809
23917
|
const result = await this.runDMNAgent(prompt, onEvent);
|
|
23810
23918
|
const durationMs = Date.now() - startMs;
|
|
23811
23919
|
const proposal = this.parseProposal(result.summary);
|
|
@@ -25486,7 +25594,7 @@ Use task_status("${taskId}") or task_output("${taskId}") to check progress.`
|
|
|
25486
25594
|
}
|
|
25487
25595
|
};
|
|
25488
25596
|
}
|
|
25489
|
-
function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce, statusBar, sudoCallback, costTracker, onComplete, taskType, contextWindowSize, modelCaps, personality) {
|
|
25597
|
+
function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce, statusBar, sudoCallback, costTracker, onComplete, taskType, contextWindowSize, modelCaps, personality, deepContext) {
|
|
25490
25598
|
const voiceStyleMap = {
|
|
25491
25599
|
concise: 1,
|
|
25492
25600
|
balanced: 3,
|
|
@@ -25510,6 +25618,7 @@ function startTask(task, config, repoRoot, voice, stream, taskStores, bruteForce
|
|
|
25510
25618
|
taskTimeoutMs: 36e5,
|
|
25511
25619
|
// 60 minutes — never give up prematurely
|
|
25512
25620
|
compactionThreshold,
|
|
25621
|
+
deepContext: deepContext ?? false,
|
|
25513
25622
|
dynamicContext,
|
|
25514
25623
|
modelTier,
|
|
25515
25624
|
streamEnabled: stream?.enabled ?? false,
|
|
@@ -25858,6 +25967,7 @@ async function startInteractive(config, repoPath) {
|
|
|
25858
25967
|
let streamEnabled = savedSettings.stream ?? false;
|
|
25859
25968
|
let bruteForceEnabled = savedSettings.bruteforce ?? true;
|
|
25860
25969
|
let currentStyle = PRESET_NAMES.includes(savedSettings.style) ? savedSettings.style : "balanced";
|
|
25970
|
+
let deepContextEnabled = savedSettings.deepContext ?? false;
|
|
25861
25971
|
if (savedSettings.emojis !== void 0)
|
|
25862
25972
|
setEmojisEnabled(savedSettings.emojis);
|
|
25863
25973
|
if (savedSettings.colors !== void 0)
|
|
@@ -26109,6 +26219,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
26109
26219
|
"/telegram",
|
|
26110
26220
|
"/compact",
|
|
26111
26221
|
"/gc",
|
|
26222
|
+
"/deep",
|
|
26112
26223
|
"/style",
|
|
26113
26224
|
"/personality"
|
|
26114
26225
|
];
|
|
@@ -26270,6 +26381,10 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
26270
26381
|
bruteForceEnabled = !bruteForceEnabled;
|
|
26271
26382
|
return bruteForceEnabled;
|
|
26272
26383
|
},
|
|
26384
|
+
deepContextToggle() {
|
|
26385
|
+
deepContextEnabled = !deepContextEnabled;
|
|
26386
|
+
return deepContextEnabled;
|
|
26387
|
+
},
|
|
26273
26388
|
setStyle(preset) {
|
|
26274
26389
|
currentStyle = preset;
|
|
26275
26390
|
},
|
|
@@ -26809,7 +26924,7 @@ Execute this skill now. Follow the behavioral guidance above.`;
|
|
|
26809
26924
|
toolPatternStore: toolPatternStore ?? void 0
|
|
26810
26925
|
}, bruteForceEnabled, statusBar, handleSudoRequest, costTracker, (summary) => {
|
|
26811
26926
|
lastCompletedSummary = summary;
|
|
26812
|
-
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle);
|
|
26927
|
+
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled);
|
|
26813
26928
|
activeTask = task;
|
|
26814
26929
|
showPrompt();
|
|
26815
26930
|
await task.promise;
|
|
@@ -26921,7 +27036,7 @@ NEW TASK: ${fullInput}`;
|
|
|
26921
27036
|
toolPatternStore: toolPatternStore ?? void 0
|
|
26922
27037
|
}, bruteForceEnabled, statusBar, handleSudoRequest, costTracker, (summary) => {
|
|
26923
27038
|
lastCompletedSummary = summary;
|
|
26924
|
-
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle);
|
|
27039
|
+
}, currentTaskType, resolvedContextWindowSize, resolvedCaps, currentStyle, deepContextEnabled);
|
|
26925
27040
|
activeTask = task;
|
|
26926
27041
|
showPrompt();
|
|
26927
27042
|
await task.promise;
|
package/package.json
CHANGED