open-agents-ai 0.187.449 → 0.187.451
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 +308 -9
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -505795,12 +505795,16 @@ var init_agent_tool = __esm({
|
|
|
505795
505795
|
subAgentMode: true
|
|
505796
505796
|
});
|
|
505797
505797
|
if (result.completed) {
|
|
505798
|
+
const filesLine = result.filesModified && result.filesModified.length > 0 ? `
|
|
505799
|
+
Files modified: ${result.filesModified.slice(0, 8).join(", ")}${result.filesModified.length > 8 ? ` (+${result.filesModified.length - 8} more)` : ""}` : "";
|
|
505800
|
+
const artifactLine = result.artifactIds && result.artifactIds.length > 0 ? `
|
|
505801
|
+
Artifacts: ${result.artifactIds.join(", ")} (call memex_retrieve to view full sub-agent transcript)` : "";
|
|
505798
505802
|
return {
|
|
505799
505803
|
success: true,
|
|
505800
505804
|
output: `Agent completed: ${result.summary}
|
|
505801
505805
|
Type: ${subagentType}
|
|
505802
505806
|
Turns: ${result.turns}, Tool calls: ${result.toolCalls}
|
|
505803
|
-
Duration: ${(result.durationMs / 1e3).toFixed(1)}s
|
|
505807
|
+
Duration: ${(result.durationMs / 1e3).toFixed(1)}s` + filesLine + artifactLine,
|
|
505804
505808
|
durationMs: performance.now() - start2
|
|
505805
505809
|
};
|
|
505806
505810
|
}
|
|
@@ -516588,6 +516592,13 @@ var init_contextTree = __esm({
|
|
|
516588
516592
|
* Contract the named phase: extract anchors, generate a stub summary,
|
|
516589
516593
|
* mark the node `contracted`. The caller may then archive via the
|
|
516590
516594
|
* archive callback (Phase 1 hands off to memex).
|
|
516595
|
+
*
|
|
516596
|
+
* `summarizer` may be sync (returns string) or async (returns Promise<string>).
|
|
516597
|
+
* When async, the node is contracted IMMEDIATELY with the default stub
|
|
516598
|
+
* summary; the real summary lands later via the returned promise's
|
|
516599
|
+
* resolution updating `node.summary` in place. The next compactMessages
|
|
516600
|
+
* render therefore picks up the LLM summary without blocking the turn
|
|
516601
|
+
* loop on it.
|
|
516591
516602
|
*/
|
|
516592
516603
|
contract(phase, turn, summarizer) {
|
|
516593
516604
|
const node = this.snapshot.phases[phase];
|
|
@@ -516595,9 +516606,24 @@ var init_contextTree = __esm({
|
|
|
516595
516606
|
return null;
|
|
516596
516607
|
const anchors = extractAnchorsFromMessages(node.messages, turn).slice(0, this.opts.maxAnchorsPerNode);
|
|
516597
516608
|
node.anchors = [...node.anchors, ...anchors].slice(-this.opts.maxAnchorsPerNode);
|
|
516598
|
-
node.summary =
|
|
516609
|
+
node.summary = this.defaultSummary(phase, node.messages);
|
|
516599
516610
|
node.status = "contracted";
|
|
516600
516611
|
node.contractedAtTurn = turn;
|
|
516612
|
+
if (summarizer) {
|
|
516613
|
+
try {
|
|
516614
|
+
const result = summarizer(node.messages);
|
|
516615
|
+
if (result && typeof result.then === "function") {
|
|
516616
|
+
result.then((s2) => {
|
|
516617
|
+
if (typeof s2 === "string" && s2.length > 0)
|
|
516618
|
+
node.summary = s2;
|
|
516619
|
+
}).catch(() => {
|
|
516620
|
+
});
|
|
516621
|
+
} else if (typeof result === "string") {
|
|
516622
|
+
node.summary = result;
|
|
516623
|
+
}
|
|
516624
|
+
} catch {
|
|
516625
|
+
}
|
|
516626
|
+
}
|
|
516601
516627
|
this.snapshot.history.push({ ...node, phase });
|
|
516602
516628
|
if (this.snapshot.history.length > 32) {
|
|
516603
516629
|
this.snapshot.history = this.snapshot.history.slice(-32);
|
|
@@ -517726,6 +517752,11 @@ var init_agenticRunner = __esm({
|
|
|
517726
517752
|
// by keyword. Initialized lazily in run() because the system-prompt hash
|
|
517727
517753
|
// depends on the actual prompt resolved at run time.
|
|
517728
517754
|
_contextTree = null;
|
|
517755
|
+
// Phase 1 — index in `messages` where the current phase's slice begins.
|
|
517756
|
+
// On phase transition we capture messages[_phaseMessageStartIdx..now]
|
|
517757
|
+
// as the OUTGOING phase's owned slice (via tree.observePhaseMessages),
|
|
517758
|
+
// then advance the cursor so the new phase starts fresh.
|
|
517759
|
+
_phaseMessageStartIdx = 0;
|
|
517729
517760
|
// Phase 6 — last-surface guard so we don't re-inject the same anchor on
|
|
517730
517761
|
// consecutive turns when its keywords still match.
|
|
517731
517762
|
_lastSurfacedAnchorIds = /* @__PURE__ */ new Set();
|
|
@@ -517816,6 +517847,32 @@ var init_agenticRunner = __esm({
|
|
|
517816
517847
|
return this._fileRegistry;
|
|
517817
517848
|
}
|
|
517818
517849
|
/** Get a Memex archive entry by ID (for the dereference tool) */
|
|
517850
|
+
/**
|
|
517851
|
+
* Phase 4 (Task C) — public read access to the runner's TaskState. Used
|
|
517852
|
+
* by the CLI's spawnInProcess wiring to extract `modifiedFiles` from a
|
|
517853
|
+
* sub-agent run and surface them on the parent's `InProcessResult`. The
|
|
517854
|
+
* caller treats the returned object as read-only.
|
|
517855
|
+
*/
|
|
517856
|
+
getTaskState() {
|
|
517857
|
+
return this._taskState;
|
|
517858
|
+
}
|
|
517859
|
+
/**
|
|
517860
|
+
* Phase 4 (Task C) — direct memex archive helper for parent runners
|
|
517861
|
+
* that want to file a sub-agent's verbose result under a known id.
|
|
517862
|
+
* Returns the assigned id so the caller can surface it on the result.
|
|
517863
|
+
*/
|
|
517864
|
+
archiveToMemex(opts) {
|
|
517865
|
+
const id = opts.id ?? this.quickHash(`${opts.toolName}|${opts.summary}|${Date.now()}`);
|
|
517866
|
+
this._memexArchive.set(id, {
|
|
517867
|
+
id,
|
|
517868
|
+
toolName: opts.toolName,
|
|
517869
|
+
summary: opts.summary,
|
|
517870
|
+
fullContent: opts.fullContent,
|
|
517871
|
+
turn: opts.turn ?? this._taskState.toolCallCount,
|
|
517872
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
517873
|
+
});
|
|
517874
|
+
return id;
|
|
517875
|
+
}
|
|
517819
517876
|
getMemexEntry(id) {
|
|
517820
517877
|
return this._memexArchive.get(id);
|
|
517821
517878
|
}
|
|
@@ -518326,6 +518383,59 @@ ${body}`;
|
|
|
518326
518383
|
});
|
|
518327
518384
|
}
|
|
518328
518385
|
}
|
|
518386
|
+
/**
|
|
518387
|
+
* Phase 1 (Task B) — build an async LLM summarizer for ContextTree.contract().
|
|
518388
|
+
*
|
|
518389
|
+
* Returns a function that takes a phase's owned message slice and asks the
|
|
518390
|
+
* backend for a 2-3 sentence summary of what the phase accomplished. Hard
|
|
518391
|
+
* caps the messages slice at ~3000 chars (≈750 tokens) of representative
|
|
518392
|
+
* content to keep the cost bounded. Never blocks the turn loop — the
|
|
518393
|
+
* returned promise updates ContextNode.summary in place when it resolves.
|
|
518394
|
+
*
|
|
518395
|
+
* Returns null when the disable knob is set or the backend is missing the
|
|
518396
|
+
* chatCompletion method.
|
|
518397
|
+
*/
|
|
518398
|
+
makePhaseSummarizer() {
|
|
518399
|
+
if (process.env["OA_DISABLE_PHASE_SUMMARIZER"] === "1")
|
|
518400
|
+
return null;
|
|
518401
|
+
if (!this.backend || typeof this.backend.chatCompletion !== "function")
|
|
518402
|
+
return null;
|
|
518403
|
+
return async (phase, msgs) => {
|
|
518404
|
+
const tail = msgs.slice(-8);
|
|
518405
|
+
const blob = tail.map((m2) => {
|
|
518406
|
+
const role = m2.role;
|
|
518407
|
+
const content = typeof m2.content === "string" ? m2.content.slice(0, 400) : "";
|
|
518408
|
+
if (m2.role === "assistant" && m2.tool_calls && m2.tool_calls.length > 0) {
|
|
518409
|
+
const calls = m2.tool_calls.map((tc) => `${tc.function.name}(${(tc.function.arguments || "").slice(0, 80)})`).join(", ");
|
|
518410
|
+
return `[${role}] ${content || ""} | tool_calls: ${calls}`.slice(0, 500);
|
|
518411
|
+
}
|
|
518412
|
+
return `[${role}] ${content}`.slice(0, 500);
|
|
518413
|
+
}).join("\n");
|
|
518414
|
+
const prompt = `You are summarizing the "${phase}" phase of an agent's task. Below is the message slice owned by this phase. Write a 2-3 sentence summary focused on WHAT was done and any KEY FINDINGS. No fluff. No "the agent did X" framing — just the facts.
|
|
518415
|
+
|
|
518416
|
+
=== ${phase} phase messages ===
|
|
518417
|
+
${blob}
|
|
518418
|
+
=== end ===`;
|
|
518419
|
+
try {
|
|
518420
|
+
const response = await this.backend.chatCompletion({
|
|
518421
|
+
messages: [
|
|
518422
|
+
{ role: "system", content: "You write extremely concise phase summaries for agent context management." },
|
|
518423
|
+
{ role: "user", content: prompt }
|
|
518424
|
+
],
|
|
518425
|
+
tools: [],
|
|
518426
|
+
temperature: 0,
|
|
518427
|
+
maxTokens: 256,
|
|
518428
|
+
timeoutMs: 3e4
|
|
518429
|
+
});
|
|
518430
|
+
const text = response.choices?.[0]?.message?.content;
|
|
518431
|
+
if (typeof text === "string" && text.length > 0) {
|
|
518432
|
+
return `${phase}: ${text.replace(/\s+/g, " ").trim().slice(0, 600)}`;
|
|
518433
|
+
}
|
|
518434
|
+
} catch {
|
|
518435
|
+
}
|
|
518436
|
+
return "";
|
|
518437
|
+
};
|
|
518438
|
+
}
|
|
518329
518439
|
/**
|
|
518330
518440
|
* Phase 6 — Anchor Surfacing.
|
|
518331
518441
|
*
|
|
@@ -518857,6 +518967,7 @@ Respond with your assessment, then take action.`;
|
|
|
518857
518967
|
const contextComposition = await this.assembleContext(task, context2);
|
|
518858
518968
|
const systemPrompt = contextComposition.assembled;
|
|
518859
518969
|
this._contextTree = new ContextTree(`sys-${systemPrompt.length}`, cleanedTask.slice(0, 200));
|
|
518970
|
+
this._phaseMessageStartIdx = 2;
|
|
518860
518971
|
this.emit({
|
|
518861
518972
|
type: "status",
|
|
518862
518973
|
content: `Context assembled: ${contextComposition.sections.map((s2) => `${s2.label}(${s2.tokenEstimate}t)`).join(" + ")} = ~${contextComposition.totalTokenEstimate}t`,
|
|
@@ -519610,19 +519721,28 @@ ${memoryLines.join("\n")}`
|
|
|
519610
519721
|
this._contextTree.observeToolCall(tc.name, argsKey, turn);
|
|
519611
519722
|
const transition = this._contextTree.maybeTransition(turn);
|
|
519612
519723
|
if (transition) {
|
|
519724
|
+
const phaseSlice = messages2.slice(this._phaseMessageStartIdx);
|
|
519725
|
+
if (phaseSlice.length > 0) {
|
|
519726
|
+
const fromNode = this._contextTree.getSnapshot().phases[transition.from];
|
|
519727
|
+
if (fromNode) {
|
|
519728
|
+
fromNode.messages = phaseSlice;
|
|
519729
|
+
}
|
|
519730
|
+
}
|
|
519613
519731
|
this.emit({
|
|
519614
519732
|
type: "status",
|
|
519615
519733
|
content: `Phase: ${transition.from} → ${transition.to}`,
|
|
519616
519734
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
519617
519735
|
});
|
|
519618
|
-
const
|
|
519736
|
+
const summarizer = this.makePhaseSummarizer();
|
|
519737
|
+
const contracted = this._contextTree.contractInactive(turn, summarizer ? ((msgs) => summarizer(transition.from, msgs)) : void 0);
|
|
519619
519738
|
if (contracted.length > 0) {
|
|
519620
519739
|
this.emit({
|
|
519621
519740
|
type: "status",
|
|
519622
|
-
content: `Phase contraction: ${contracted.join(", ")} → contracted (anchors retained)`,
|
|
519741
|
+
content: `Phase contraction: ${contracted.join(", ")} → contracted (${summarizer ? "LLM-summarized" : "stub-summarized"}, anchors retained)`,
|
|
519623
519742
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
519624
519743
|
});
|
|
519625
519744
|
}
|
|
519745
|
+
this._phaseMessageStartIdx = messages2.length;
|
|
519626
519746
|
this._taskState.phase = transition.to;
|
|
519627
519747
|
this._taskState.phaseSince = turn;
|
|
519628
519748
|
}
|
|
@@ -520715,7 +520835,39 @@ Integrate this guidance into your current approach. Continue working on the task
|
|
|
520715
520835
|
if (this.aborted)
|
|
520716
520836
|
break;
|
|
520717
520837
|
toolCallCount++;
|
|
520718
|
-
|
|
520838
|
+
const bfArgsKey = Object.entries(tc.arguments ?? {}).sort(([a2], [b]) => a2.localeCompare(b)).map(([k, v]) => `${k}=${typeof v === "string" ? v.slice(0, 160) : JSON.stringify(v).slice(0, 160)}`).join(",");
|
|
520839
|
+
toolCallLog.push({ name: tc.name, argsKey: bfArgsKey });
|
|
520840
|
+
this._toolLastUsedTurn.set(tc.name, turn);
|
|
520841
|
+
if (this._contextTree) {
|
|
520842
|
+
this._contextTree.observeToolCall(tc.name, bfArgsKey, turn);
|
|
520843
|
+
const transition = this._contextTree.maybeTransition(turn);
|
|
520844
|
+
if (transition) {
|
|
520845
|
+
const phaseSlice = messages2.slice(this._phaseMessageStartIdx);
|
|
520846
|
+
if (phaseSlice.length > 0) {
|
|
520847
|
+
const fromNode = this._contextTree.getSnapshot().phases[transition.from];
|
|
520848
|
+
if (fromNode) {
|
|
520849
|
+
fromNode.messages = phaseSlice;
|
|
520850
|
+
}
|
|
520851
|
+
}
|
|
520852
|
+
this.emit({
|
|
520853
|
+
type: "status",
|
|
520854
|
+
content: `Phase: ${transition.from} → ${transition.to} (brute-force cycle)`,
|
|
520855
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
520856
|
+
});
|
|
520857
|
+
const summarizer = this.makePhaseSummarizer();
|
|
520858
|
+
const contracted = this._contextTree.contractInactive(turn, summarizer ? ((msgs) => summarizer(transition.from, msgs)) : void 0);
|
|
520859
|
+
if (contracted.length > 0) {
|
|
520860
|
+
this.emit({
|
|
520861
|
+
type: "status",
|
|
520862
|
+
content: `Phase contraction: ${contracted.join(", ")} → contracted (${summarizer ? "LLM-summarized" : "stub-summarized"}, anchors retained, brute-force)`,
|
|
520863
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
520864
|
+
});
|
|
520865
|
+
}
|
|
520866
|
+
this._phaseMessageStartIdx = messages2.length;
|
|
520867
|
+
this._taskState.phase = transition.to;
|
|
520868
|
+
this._taskState.phaseSince = turn;
|
|
520869
|
+
}
|
|
520870
|
+
}
|
|
520719
520871
|
this.emit({ type: "tool_call", toolName: tc.name, toolArgs: tc.arguments, turn, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
520720
520872
|
const tool = this.tools.get(tc.name);
|
|
520721
520873
|
let result;
|
|
@@ -584803,6 +584955,119 @@ ${incompleteList}${more}
|
|
|
584803
584955
|
}
|
|
584804
584956
|
};
|
|
584805
584957
|
}
|
|
584958
|
+
function wireAgentToolMinimal(tool, config, repoRoot) {
|
|
584959
|
+
const typeRegistry = getAgentTypeRegistry();
|
|
584960
|
+
const allToolNames = [
|
|
584961
|
+
"file_read",
|
|
584962
|
+
"file_write",
|
|
584963
|
+
"file_edit",
|
|
584964
|
+
"shell",
|
|
584965
|
+
"grep",
|
|
584966
|
+
"glob",
|
|
584967
|
+
"list_directory",
|
|
584968
|
+
"web_fetch",
|
|
584969
|
+
"web_search",
|
|
584970
|
+
"memory_read",
|
|
584971
|
+
"memory_write",
|
|
584972
|
+
"task_complete",
|
|
584973
|
+
"batch_edit",
|
|
584974
|
+
"file_patch",
|
|
584975
|
+
"git_info",
|
|
584976
|
+
"agent",
|
|
584977
|
+
"send_message"
|
|
584978
|
+
];
|
|
584979
|
+
tool.setCallbacks({
|
|
584980
|
+
resolveType: (typeName) => {
|
|
584981
|
+
const def = typeRegistry.get(typeName);
|
|
584982
|
+
if (!def) return void 0;
|
|
584983
|
+
const resolvedNames = typeRegistry.resolveTools(typeName, allToolNames);
|
|
584984
|
+
return {
|
|
584985
|
+
type: def.type,
|
|
584986
|
+
maxTurns: def.maxTurns,
|
|
584987
|
+
toolNames: resolvedNames,
|
|
584988
|
+
systemPromptAddition: def.systemPromptAddition,
|
|
584989
|
+
canSpawnAgents: def.canSpawnAgents
|
|
584990
|
+
};
|
|
584991
|
+
},
|
|
584992
|
+
listTypes: () => typeRegistry.listTypes(),
|
|
584993
|
+
spawnInProcess: async (opts) => {
|
|
584994
|
+
let backend;
|
|
584995
|
+
if (config.backendType === "nexus") {
|
|
584996
|
+
const nexusTool = new NexusTool(repoRoot);
|
|
584997
|
+
backend = new NexusAgenticBackend(nexusTool.sendCommand.bind(nexusTool), opts.model, void 0, config.apiKey);
|
|
584998
|
+
} else {
|
|
584999
|
+
backend = new OllamaAgenticBackend(config.backendUrl, opts.model, config.apiKey);
|
|
585000
|
+
}
|
|
585001
|
+
const subTier = getModelTier(opts.model);
|
|
585002
|
+
const subCompaction = subTier === "small" ? 12e3 : subTier === "medium" ? 24e3 : 4e4;
|
|
585003
|
+
const subRunner = new AgenticRunner(backend, {
|
|
585004
|
+
maxTurns: opts.maxTurns,
|
|
585005
|
+
maxTokens: 16384,
|
|
585006
|
+
temperature: 0,
|
|
585007
|
+
requestTimeoutMs: config.timeoutMs,
|
|
585008
|
+
taskTimeoutMs: config.timeoutMs * 2,
|
|
585009
|
+
compactionThreshold: subCompaction,
|
|
585010
|
+
contextWindowSize: 0,
|
|
585011
|
+
modelTier: subTier,
|
|
585012
|
+
subAgent: opts.subAgentMode === true
|
|
585013
|
+
});
|
|
585014
|
+
subRunner.setWorkingDirectory(repoRoot);
|
|
585015
|
+
const allSafe = buildSubAgentTools(repoRoot, config);
|
|
585016
|
+
const nameSet = new Set(opts.toolNames || []);
|
|
585017
|
+
const subToolInstances = nameSet.size > 0 ? allSafe.filter((t2) => nameSet.has(t2.name)) : allSafe.slice();
|
|
585018
|
+
const nameOf = (t2) => t2.name;
|
|
585019
|
+
if (!subToolInstances.some((t2) => nameOf(t2) === "todo_write")) subToolInstances.push(new TodoWriteTool());
|
|
585020
|
+
if (!subToolInstances.some((t2) => nameOf(t2) === "todo_read")) subToolInstances.push(new TodoReadTool());
|
|
585021
|
+
subRunner.registerTools(subToolInstances.map(adaptTool6));
|
|
585022
|
+
subRunner.registerTool(createTaskCompleteTool(subTier));
|
|
585023
|
+
const systemCtx = opts.systemPromptAddition ? `Working directory: ${repoRoot}
|
|
585024
|
+
|
|
585025
|
+
${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
|
|
585026
|
+
const result = await subRunner.run(opts.task, systemCtx);
|
|
585027
|
+
const subState = subRunner.getTaskState();
|
|
585028
|
+
const filesModified = Array.from(subState.modifiedFiles.keys());
|
|
585029
|
+
const artifactIds = [];
|
|
585030
|
+
if (_parentRunnerForArchive && result.summary && result.summary.length > 0) {
|
|
585031
|
+
const artifactId = `subagent-${opts.id}-result`;
|
|
585032
|
+
try {
|
|
585033
|
+
_parentRunnerForArchive.archiveToMemex({
|
|
585034
|
+
id: artifactId,
|
|
585035
|
+
toolName: "agent",
|
|
585036
|
+
summary: `Sub-agent ${opts.id}: ${result.summary.slice(0, 120)}`,
|
|
585037
|
+
fullContent: `Sub-agent task: ${opts.task.slice(0, 1e3)}
|
|
585038
|
+
|
|
585039
|
+
Completed: ${result.completed}
|
|
585040
|
+
Turns: ${result.turns}, Tool calls: ${result.toolCalls}
|
|
585041
|
+
Files modified: ${filesModified.join(", ") || "(none)"}
|
|
585042
|
+
|
|
585043
|
+
Summary:
|
|
585044
|
+
${result.summary}`
|
|
585045
|
+
});
|
|
585046
|
+
artifactIds.push(artifactId);
|
|
585047
|
+
} catch {
|
|
585048
|
+
}
|
|
585049
|
+
}
|
|
585050
|
+
return {
|
|
585051
|
+
completed: result.completed,
|
|
585052
|
+
summary: result.summary,
|
|
585053
|
+
turns: result.turns,
|
|
585054
|
+
toolCalls: result.toolCalls,
|
|
585055
|
+
durationMs: result.durationMs,
|
|
585056
|
+
filesModified,
|
|
585057
|
+
artifactIds
|
|
585058
|
+
};
|
|
585059
|
+
},
|
|
585060
|
+
spawnSubprocess: (opts) => {
|
|
585061
|
+
const entry = spawnFullSubAgent(
|
|
585062
|
+
opts.task,
|
|
585063
|
+
{ model: opts.model, backendUrl: config.backendUrl, workingDir: opts.workingDir }
|
|
585064
|
+
);
|
|
585065
|
+
return { id: entry.id, pid: entry.pid ?? 0 };
|
|
585066
|
+
},
|
|
585067
|
+
trackTask: () => {
|
|
585068
|
+
}
|
|
585069
|
+
});
|
|
585070
|
+
}
|
|
584806
585071
|
function buildSubAgentTools(repoRoot, config) {
|
|
584807
585072
|
return [
|
|
584808
585073
|
// File + search
|
|
@@ -585684,7 +585949,8 @@ RULES:
|
|
|
585684
585949
|
}
|
|
585685
585950
|
} catch {
|
|
585686
585951
|
}
|
|
585687
|
-
const
|
|
585952
|
+
const envOverride = Number.parseInt(process.env["OA_COMPACTION_THRESHOLD"] ?? "", 10);
|
|
585953
|
+
const compactionThreshold = Number.isFinite(envOverride) && envOverride > 0 ? envOverride : modelTier === "small" ? 12e3 : modelTier === "medium" ? 24e3 : 4e4;
|
|
585688
585954
|
let identityInjection = "";
|
|
585689
585955
|
try {
|
|
585690
585956
|
const ikStateFile = join109(repoRoot, ".oa", "identity", "self-state.json");
|
|
@@ -585706,8 +585972,10 @@ RULES:
|
|
|
585706
585972
|
}
|
|
585707
585973
|
} catch {
|
|
585708
585974
|
}
|
|
585975
|
+
const envMaxTurns = Number.parseInt(process.env["OA_MAX_TURNS"] ?? "", 10);
|
|
585976
|
+
const effectiveMaxTurns = Number.isFinite(envMaxTurns) && envMaxTurns > 0 ? envMaxTurns : 60;
|
|
585709
585977
|
const runner = new AgenticRunner(backend, {
|
|
585710
|
-
maxTurns:
|
|
585978
|
+
maxTurns: effectiveMaxTurns,
|
|
585711
585979
|
maxTokens: 16384,
|
|
585712
585980
|
temperature: 0,
|
|
585713
585981
|
requestTimeoutMs: config.timeoutMs,
|
|
@@ -585732,6 +586000,7 @@ RULES:
|
|
|
585732
586000
|
});
|
|
585733
586001
|
runner.setWorkingDirectory(repoRoot);
|
|
585734
586002
|
_activeRunnerRef = runner;
|
|
586003
|
+
_parentRunnerForArchive = runner;
|
|
585735
586004
|
let _checkinPoller = null;
|
|
585736
586005
|
try {
|
|
585737
586006
|
const oaSessionId = process.env["OA_SESSION_ID"];
|
|
@@ -587218,12 +587487,38 @@ Review its full output in the [${id}] tab or via sub_agent(action='output', id='
|
|
|
587218
587487
|
|
|
587219
587488
|
${opts.systemPromptAddition}` : `Working directory: ${repoRoot}`;
|
|
587220
587489
|
const result = await subRunner.run(opts.task, systemCtx);
|
|
587490
|
+
const subState = subRunner.getTaskState();
|
|
587491
|
+
const filesModified = Array.from(subState.modifiedFiles.keys());
|
|
587492
|
+
const artifactIds = [];
|
|
587493
|
+
if (_parentRunnerForArchive && result.summary && result.summary.length > 0) {
|
|
587494
|
+
const artifactId = `subagent-${opts.id}-result`;
|
|
587495
|
+
try {
|
|
587496
|
+
_parentRunnerForArchive.archiveToMemex({
|
|
587497
|
+
id: artifactId,
|
|
587498
|
+
toolName: "agent",
|
|
587499
|
+
summary: `Sub-agent ${opts.id}: ${result.summary.slice(0, 120)}`,
|
|
587500
|
+
fullContent: `Sub-agent task: ${opts.task.slice(0, 1e3)}
|
|
587501
|
+
|
|
587502
|
+
Completed: ${result.completed}
|
|
587503
|
+
Turns: ${result.turns}, Tool calls: ${result.toolCalls}
|
|
587504
|
+
Duration: ${result.durationMs}ms
|
|
587505
|
+
Files modified: ${filesModified.join(", ") || "(none)"}
|
|
587506
|
+
|
|
587507
|
+
Summary:
|
|
587508
|
+
${result.summary}`
|
|
587509
|
+
});
|
|
587510
|
+
artifactIds.push(artifactId);
|
|
587511
|
+
} catch {
|
|
587512
|
+
}
|
|
587513
|
+
}
|
|
587221
587514
|
return {
|
|
587222
587515
|
completed: result.completed,
|
|
587223
587516
|
summary: result.summary,
|
|
587224
587517
|
turns: result.turns,
|
|
587225
587518
|
toolCalls: result.toolCalls,
|
|
587226
|
-
durationMs: result.durationMs
|
|
587519
|
+
durationMs: result.durationMs,
|
|
587520
|
+
filesModified,
|
|
587521
|
+
artifactIds
|
|
587227
587522
|
};
|
|
587228
587523
|
},
|
|
587229
587524
|
spawnSubprocess: (opts) => {
|
|
@@ -590841,6 +591136,9 @@ async function runWithTUI(task, config, repoPath, callbacks) {
|
|
|
590841
591136
|
renderCompactHeader(config.model);
|
|
590842
591137
|
renderUserMessage(task);
|
|
590843
591138
|
setTerminalTitle(task.slice(0, 60), getVersion4());
|
|
591139
|
+
if (!_wireAgentToolCallbacks) {
|
|
591140
|
+
_wireAgentToolCallbacks = (tool) => wireAgentToolMinimal(tool, config, repoRoot);
|
|
591141
|
+
}
|
|
590844
591142
|
try {
|
|
590845
591143
|
const handle2 = startTask(task, config, repoRoot);
|
|
590846
591144
|
await handle2.promise;
|
|
@@ -591106,7 +591404,7 @@ Rules:
|
|
|
591106
591404
|
process.exit(1);
|
|
591107
591405
|
}
|
|
591108
591406
|
}
|
|
591109
|
-
var _interactiveSessionActive, _interactiveSessionReason, _voiceChatSession, taskManager, _apiCallbacks, _shellToolRef, _replToolRef, _fullSubAgentToolRef, _agentToolRef, _sendMessageToolRef, _agentLifecycleMgr, _activeRunnerRef, _wireSubAgentCallbacks, _wireAgentToolCallbacks, _wireSubAgentToolCallbacks, _autoUpdatedThisSession, _mcpManager, _pluginManager, _mcpTools, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
|
|
591407
|
+
var _interactiveSessionActive, _interactiveSessionReason, _voiceChatSession, taskManager, _apiCallbacks, _shellToolRef, _replToolRef, _fullSubAgentToolRef, _agentToolRef, _sendMessageToolRef, _agentLifecycleMgr, _activeRunnerRef, _parentRunnerForArchive, _wireSubAgentCallbacks, _wireAgentToolCallbacks, _wireSubAgentToolCallbacks, _autoUpdatedThisSession, _mcpManager, _pluginManager, _mcpTools, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
|
|
591110
591408
|
var init_interactive = __esm({
|
|
591111
591409
|
"packages/cli/src/tui/interactive.ts"() {
|
|
591112
591410
|
"use strict";
|
|
@@ -591164,6 +591462,7 @@ var init_interactive = __esm({
|
|
|
591164
591462
|
_sendMessageToolRef = null;
|
|
591165
591463
|
_agentLifecycleMgr = getSharedTaskManager();
|
|
591166
591464
|
_activeRunnerRef = null;
|
|
591465
|
+
_parentRunnerForArchive = null;
|
|
591167
591466
|
_wireSubAgentCallbacks = null;
|
|
591168
591467
|
_wireAgentToolCallbacks = null;
|
|
591169
591468
|
_wireSubAgentToolCallbacks = null;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agents-ai",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.451",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "open-agents-ai",
|
|
9
|
-
"version": "0.187.
|
|
9
|
+
"version": "0.187.451",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED