open-agents-ai 0.187.526 → 0.187.527
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 +225 -5
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4842,10 +4842,10 @@ Try broader terms or use memory_read with a specific topic.`,
|
|
|
4842
4842
|
const data = JSON.parse(raw);
|
|
4843
4843
|
const topic = basename(file, ".json");
|
|
4844
4844
|
for (const [key, entry] of Object.entries(data)) {
|
|
4845
|
-
const
|
|
4846
|
-
if (seen.has(
|
|
4845
|
+
const dedup2 = `${topic}:${key}`;
|
|
4846
|
+
if (seen.has(dedup2))
|
|
4847
4847
|
continue;
|
|
4848
|
-
seen.add(
|
|
4848
|
+
seen.add(dedup2);
|
|
4849
4849
|
if (entry?.value) {
|
|
4850
4850
|
entries.push({
|
|
4851
4851
|
topic,
|
|
@@ -524388,6 +524388,174 @@ var init_streaming_executor = __esm({
|
|
|
524388
524388
|
}
|
|
524389
524389
|
});
|
|
524390
524390
|
|
|
524391
|
+
// packages/orchestrator/dist/specDecomposer.js
|
|
524392
|
+
function isSourceModule(path8) {
|
|
524393
|
+
if (!path8 || path8.includes(".."))
|
|
524394
|
+
return false;
|
|
524395
|
+
const cleaned = path8.trim().replace(/[`"',]+$/, "").replace(/\s+#.*$/, "");
|
|
524396
|
+
if (!cleaned)
|
|
524397
|
+
return false;
|
|
524398
|
+
const dot = cleaned.lastIndexOf(".");
|
|
524399
|
+
if (dot < 0)
|
|
524400
|
+
return false;
|
|
524401
|
+
const ext = cleaned.slice(dot).toLowerCase();
|
|
524402
|
+
if (!SOURCE_EXTENSIONS.has(ext))
|
|
524403
|
+
return false;
|
|
524404
|
+
for (const re of EXCLUDE_PATTERNS) {
|
|
524405
|
+
if (re.test(cleaned))
|
|
524406
|
+
return false;
|
|
524407
|
+
}
|
|
524408
|
+
return true;
|
|
524409
|
+
}
|
|
524410
|
+
function extractFromTree(text) {
|
|
524411
|
+
const lineRe = /^([ \t│]*)([├└])──\s+(\S+)/gm;
|
|
524412
|
+
const out = [];
|
|
524413
|
+
const parents = [];
|
|
524414
|
+
let m2;
|
|
524415
|
+
while ((m2 = lineRe.exec(text)) !== null) {
|
|
524416
|
+
const prefix = m2[1];
|
|
524417
|
+
const token = m2[3].replace(/\/+$/, "");
|
|
524418
|
+
const depth = Math.floor(prefix.length / 4);
|
|
524419
|
+
parents.length = depth;
|
|
524420
|
+
const originalEndedWithSlash = m2[3].endsWith("/");
|
|
524421
|
+
const hasExtension = token.includes(".") && !token.endsWith(".");
|
|
524422
|
+
const isDir2 = originalEndedWithSlash || !hasExtension;
|
|
524423
|
+
if (isDir2) {
|
|
524424
|
+
parents[depth] = token;
|
|
524425
|
+
continue;
|
|
524426
|
+
}
|
|
524427
|
+
const segments = parents.filter((p2) => p2 && p2.length > 0);
|
|
524428
|
+
const fullPath = segments.length > 0 ? segments.join("/") + "/" + token : token;
|
|
524429
|
+
if (isSourceModule(fullPath)) {
|
|
524430
|
+
out.push({ path: fullPath });
|
|
524431
|
+
}
|
|
524432
|
+
}
|
|
524433
|
+
return out;
|
|
524434
|
+
}
|
|
524435
|
+
function extractFromModuleSections(text) {
|
|
524436
|
+
const re = /^#{2,4}\s+(?:Module|File):\s*[`"']?([^\s`"'\n]+)/gm;
|
|
524437
|
+
const out = [];
|
|
524438
|
+
let m2;
|
|
524439
|
+
while ((m2 = re.exec(text)) !== null) {
|
|
524440
|
+
const raw = m2[1].replace(/\/+$/, "");
|
|
524441
|
+
if (isSourceModule(raw)) {
|
|
524442
|
+
out.push({ path: raw });
|
|
524443
|
+
}
|
|
524444
|
+
}
|
|
524445
|
+
return out;
|
|
524446
|
+
}
|
|
524447
|
+
function extractFromHeaderList(text) {
|
|
524448
|
+
const re = /^#{3,4}\s+(?:Module:\s+)?[`"']?(src\/[^\s`"'\n]+\.[A-Za-z0-9]+)[`"']?/gm;
|
|
524449
|
+
const out = [];
|
|
524450
|
+
let m2;
|
|
524451
|
+
while ((m2 = re.exec(text)) !== null) {
|
|
524452
|
+
const raw = m2[1].replace(/\/+$/, "");
|
|
524453
|
+
if (isSourceModule(raw)) {
|
|
524454
|
+
out.push({ path: raw });
|
|
524455
|
+
}
|
|
524456
|
+
}
|
|
524457
|
+
return out;
|
|
524458
|
+
}
|
|
524459
|
+
function decomposeSpec(taskText) {
|
|
524460
|
+
if (!taskText || typeof taskText !== "string") {
|
|
524461
|
+
return { modules: [], strategy: "none" };
|
|
524462
|
+
}
|
|
524463
|
+
const tree2 = dedup(extractFromTree(taskText));
|
|
524464
|
+
if (tree2.length >= 3)
|
|
524465
|
+
return { modules: tree2, strategy: "tree" };
|
|
524466
|
+
const modSections = dedup(extractFromModuleSections(taskText));
|
|
524467
|
+
if (modSections.length >= 3)
|
|
524468
|
+
return { modules: modSections, strategy: "module-sections" };
|
|
524469
|
+
const headers = dedup(extractFromHeaderList(taskText));
|
|
524470
|
+
if (headers.length >= 3)
|
|
524471
|
+
return { modules: headers, strategy: "module-headers" };
|
|
524472
|
+
return { modules: [], strategy: "none" };
|
|
524473
|
+
}
|
|
524474
|
+
function dedup(items) {
|
|
524475
|
+
const seen = /* @__PURE__ */ new Set();
|
|
524476
|
+
const out = [];
|
|
524477
|
+
for (const e2 of items) {
|
|
524478
|
+
if (seen.has(e2.path))
|
|
524479
|
+
continue;
|
|
524480
|
+
seen.add(e2.path);
|
|
524481
|
+
out.push(e2);
|
|
524482
|
+
}
|
|
524483
|
+
return out;
|
|
524484
|
+
}
|
|
524485
|
+
function buildDecompositionDirective(modules, strategy) {
|
|
524486
|
+
const moduleList = modules.slice(0, 30).map((m2, i2) => ` ${i2 + 1}. ${m2.path}`).join("\n");
|
|
524487
|
+
const more = modules.length > 30 ? `
|
|
524488
|
+
... +${modules.length - 30} more` : "";
|
|
524489
|
+
return [
|
|
524490
|
+
`[SPEC DECOMPOSED — ${modules.length} modules detected via ${strategy}]`,
|
|
524491
|
+
``,
|
|
524492
|
+
`Your task spec contains a clear module structure. To stay within context budget on a multi-module implementation, complete each module via sub_agent rather than in main context.`,
|
|
524493
|
+
``,
|
|
524494
|
+
`Detected modules:`,
|
|
524495
|
+
moduleList,
|
|
524496
|
+
more,
|
|
524497
|
+
``,
|
|
524498
|
+
`Recommended workflow:`,
|
|
524499
|
+
` 1. Call todo_write with one todo per module (the orchestrator pre-populated this for you).`,
|
|
524500
|
+
` 2. For EACH module, mark its todo in_progress, then call:`,
|
|
524501
|
+
` sub_agent({ subagent_type: "general", prompt: "Implement <module-path> per spec",`,
|
|
524502
|
+
` relevantFiles: [{path:"<module-path>", content:"<existing or empty>"}], ... })`,
|
|
524503
|
+
` 3. When sub_agent returns, mark the todo completed.`,
|
|
524504
|
+
` 4. After ALL module todos are done, run the project's build/tests in main context.`,
|
|
524505
|
+
` 5. If build/tests pass: call task_complete. If they fail: dispatch fix-up sub_agents for the failing module(s).`,
|
|
524506
|
+
``,
|
|
524507
|
+
`Why this matters: implementing N modules in one context burns token budget linearly with N. sub_agent gives each module its own context window so the main context stays small for orchestration + integration verification.`,
|
|
524508
|
+
``,
|
|
524509
|
+
`If you genuinely cannot use sub_agent for a module (e.g. it's a 3-line config file), inline editing in main context is fine — but for substantive modules, delegate.`
|
|
524510
|
+
].filter(Boolean).join("\n");
|
|
524511
|
+
}
|
|
524512
|
+
function buildDecompositionTodos(modules) {
|
|
524513
|
+
return modules.map((m2, i2) => ({
|
|
524514
|
+
id: `decomp-mod-${i2 + 1}`,
|
|
524515
|
+
content: `Implement ${m2.path} (use sub_agent for focused context)`,
|
|
524516
|
+
status: "pending"
|
|
524517
|
+
}));
|
|
524518
|
+
}
|
|
524519
|
+
var SOURCE_EXTENSIONS, EXCLUDE_PATTERNS;
|
|
524520
|
+
var init_specDecomposer = __esm({
|
|
524521
|
+
"packages/orchestrator/dist/specDecomposer.js"() {
|
|
524522
|
+
"use strict";
|
|
524523
|
+
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
524524
|
+
".ts",
|
|
524525
|
+
".tsx",
|
|
524526
|
+
".js",
|
|
524527
|
+
".jsx",
|
|
524528
|
+
".mjs",
|
|
524529
|
+
".cjs",
|
|
524530
|
+
".py",
|
|
524531
|
+
".pyi",
|
|
524532
|
+
".rs",
|
|
524533
|
+
".go",
|
|
524534
|
+
".java",
|
|
524535
|
+
".kt",
|
|
524536
|
+
".c",
|
|
524537
|
+
".cc",
|
|
524538
|
+
".cpp",
|
|
524539
|
+
".h",
|
|
524540
|
+
".hpp",
|
|
524541
|
+
".rb",
|
|
524542
|
+
".php",
|
|
524543
|
+
".swift",
|
|
524544
|
+
".scala",
|
|
524545
|
+
".clj",
|
|
524546
|
+
".lua"
|
|
524547
|
+
]);
|
|
524548
|
+
EXCLUDE_PATTERNS = [
|
|
524549
|
+
// Excluded directories — match anywhere in path (start-or-slash boundary).
|
|
524550
|
+
/(^|\/)(node_modules|dist|build|out|target|\.git|\.next|coverage|__pycache__|venv|\.venv)\//,
|
|
524551
|
+
// Test fixtures + samples — keep src/ tests but drop fixture/sample dirs.
|
|
524552
|
+
/(^|\/)(fixtures|samples)\//,
|
|
524553
|
+
// Package metadata / config — caller doesn't want decomposition for these.
|
|
524554
|
+
/(^|\/)(package\.json|package-lock\.json|yarn\.lock|pnpm-lock\.yaml|tsconfig\.json|jest\.config\.[jt]s|vitest\.config\.[jt]s|\.eslintrc\.[a-z]+|Cargo\.toml|Cargo\.lock|go\.mod|go\.sum|pyproject\.toml|requirements\.txt|setup\.py|\.gitignore|\.npmignore|README\.md|LICENSE)$/
|
|
524555
|
+
];
|
|
524556
|
+
}
|
|
524557
|
+
});
|
|
524558
|
+
|
|
524391
524559
|
// packages/orchestrator/dist/preflightSnapshot.js
|
|
524392
524560
|
var preflightSnapshot_exports = {};
|
|
524393
524561
|
__export(preflightSnapshot_exports, {
|
|
@@ -525432,7 +525600,7 @@ RECOVERY: cd to the directory containing '${file}', run a plain install with no
|
|
|
525432
525600
|
});
|
|
525433
525601
|
|
|
525434
525602
|
// packages/orchestrator/dist/agenticRunner.js
|
|
525435
|
-
import { existsSync as _fsExistsSync, readFileSync as _fsReadFileSync } from "node:fs";
|
|
525603
|
+
import { existsSync as _fsExistsSync, readFileSync as _fsReadFileSync, writeFileSync as _fsWriteFileSync, mkdirSync as _fsMkdirSync } from "node:fs";
|
|
525436
525604
|
import { join as _pathJoin } from "node:path";
|
|
525437
525605
|
import { homedir as _osHomedir } from "node:os";
|
|
525438
525606
|
import { z as z15 } from "zod";
|
|
@@ -525665,6 +525833,7 @@ var init_agenticRunner = __esm({
|
|
|
525665
525833
|
init_hooks();
|
|
525666
525834
|
init_app_state();
|
|
525667
525835
|
init_streaming_executor();
|
|
525836
|
+
init_specDecomposer();
|
|
525668
525837
|
TOOL_SUBSETS = {
|
|
525669
525838
|
web: ["web_search", "web_fetch", "web_crawl"],
|
|
525670
525839
|
code: ["file_patch", "file_explore", "batch_edit", "file_read", "file_write", "file_edit"],
|
|
@@ -528474,6 +528643,46 @@ TASK: ${task}` : task;
|
|
|
528474
528643
|
{ role: "system", content: systemPrompt },
|
|
528475
528644
|
{ role: "user", content: userContent }
|
|
528476
528645
|
];
|
|
528646
|
+
if (process.env["OA_DISABLE_DECOMP1"] !== "1") {
|
|
528647
|
+
try {
|
|
528648
|
+
const _taskBodyForDecomp = typeof userContent === "string" ? userContent : "";
|
|
528649
|
+
const _decomp = decomposeSpec(_taskBodyForDecomp);
|
|
528650
|
+
if (_decomp.modules.length > 0) {
|
|
528651
|
+
const _directive = buildDecompositionDirective(_decomp.modules, _decomp.strategy);
|
|
528652
|
+
messages2.push({ role: "system", content: _directive });
|
|
528653
|
+
const _todos = buildDecompositionTodos(_decomp.modules);
|
|
528654
|
+
try {
|
|
528655
|
+
const sid = process.env["OA_SESSION_ID"] || this._sessionId || "default";
|
|
528656
|
+
const safe = sid.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
528657
|
+
const fp = _pathJoin(_osHomedir(), ".open-agents", "todos", `${safe}.json`);
|
|
528658
|
+
const dir = _pathJoin(_osHomedir(), ".open-agents", "todos");
|
|
528659
|
+
try {
|
|
528660
|
+
_fsMkdirSync(dir, { recursive: true });
|
|
528661
|
+
} catch {
|
|
528662
|
+
}
|
|
528663
|
+
let _existing = [];
|
|
528664
|
+
try {
|
|
528665
|
+
if (_fsExistsSync(fp)) {
|
|
528666
|
+
const _parsed = JSON.parse(_fsReadFileSync(fp, "utf-8"));
|
|
528667
|
+
if (Array.isArray(_parsed))
|
|
528668
|
+
_existing = _parsed;
|
|
528669
|
+
}
|
|
528670
|
+
} catch {
|
|
528671
|
+
}
|
|
528672
|
+
if (_existing.length === 0) {
|
|
528673
|
+
_fsWriteFileSync(fp, JSON.stringify(_todos, null, 2), "utf-8");
|
|
528674
|
+
}
|
|
528675
|
+
} catch {
|
|
528676
|
+
}
|
|
528677
|
+
this.emit({
|
|
528678
|
+
type: "status",
|
|
528679
|
+
content: `DECOMP-1 SPEC DECOMPOSED — ${_decomp.modules.length} modules detected via ${_decomp.strategy}; directive injected + todos pre-populated`,
|
|
528680
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
528681
|
+
});
|
|
528682
|
+
}
|
|
528683
|
+
} catch {
|
|
528684
|
+
}
|
|
528685
|
+
}
|
|
528477
528686
|
try {
|
|
528478
528687
|
if (this.options.subAgent)
|
|
528479
528688
|
throw "skip-handoff-subagent";
|
|
@@ -530379,7 +530588,18 @@ ${memoryLines.join("\n")}`
|
|
|
530379
530588
|
// agents used to ignore REG-61.
|
|
530380
530589
|
"web_search",
|
|
530381
530590
|
"task_complete",
|
|
530382
|
-
"ask_user"
|
|
530591
|
+
"ask_user",
|
|
530592
|
+
// DECOMP-1: sub-agent dispatch is productive work (it spawns
|
|
530593
|
+
// a focused-context implementation worker). Block-listing
|
|
530594
|
+
// sub_agent here would defeat the spec-decomposition pattern
|
|
530595
|
+
// — agents would be forced into main-context edits even when
|
|
530596
|
+
// delegation is the right move. sub_agent calls do NOT clear
|
|
530597
|
+
// the gate (we want the agent to also produce direct edits
|
|
530598
|
+
// for orchestration glue / integration), but they're allowed
|
|
530599
|
+
// through.
|
|
530600
|
+
"sub_agent",
|
|
530601
|
+
"priority_delegate",
|
|
530602
|
+
"background_run"
|
|
530383
530603
|
]);
|
|
530384
530604
|
if (REG61_EDIT_TOOLS.has(tc.name) && this._reg61PerpetualGateActive) {
|
|
530385
530605
|
this._reg61PerpetualGateActive = false;
|
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.527",
|
|
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.527",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED