omnius 1.0.382 → 1.0.384
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 +768 -78
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4820,6 +4820,17 @@ var init_shell = __esm({
|
|
|
4820
4820
|
return lines.join("\n");
|
|
4821
4821
|
}
|
|
4822
4822
|
async finalizeResult(command, timeout2, start2, result) {
|
|
4823
|
+
const reportedExitCode = this.reportedExitCodeFromOutput(`${result.output ?? ""}
|
|
4824
|
+
${result.llmContent ?? ""}`);
|
|
4825
|
+
if (result.success && reportedExitCode !== null && reportedExitCode !== 0) {
|
|
4826
|
+
const error = `Command reported non-zero exit marker ${reportedExitCode} despite wrapper exit 0.`;
|
|
4827
|
+
result = {
|
|
4828
|
+
...result,
|
|
4829
|
+
success: false,
|
|
4830
|
+
error,
|
|
4831
|
+
llmContent: this.markTranscriptFailure(result.llmContent ?? result.output ?? "", reportedExitCode, error)
|
|
4832
|
+
};
|
|
4833
|
+
}
|
|
4823
4834
|
if (this.isBenignPipePreviewSigpipe(command, result)) {
|
|
4824
4835
|
const note = "[NOTE — preview pipe closed after producing output]\nA downstream preview command such as `head`/`tail`/`sed -n` closed the pipe early, producing SIGPIPE exit 141 upstream. Captured output is usable as a preview; rerun without the preview pipe if the full output is needed.";
|
|
4825
4836
|
const output = result.output ? `${result.output}
|
|
@@ -4901,6 +4912,32 @@ ${elevatedResult.stderr}` : ""),
|
|
|
4901
4912
|
}
|
|
4902
4913
|
return result;
|
|
4903
4914
|
}
|
|
4915
|
+
reportedExitCodeFromOutput(text2) {
|
|
4916
|
+
const matches = text2.matchAll(/(?:^|\n)\s*(?:__)?EXIT_CODE\s*=\s*(\d+)\s*(?:\n|$)/g);
|
|
4917
|
+
let found = null;
|
|
4918
|
+
for (const match of matches) {
|
|
4919
|
+
const value2 = Number(match[1]);
|
|
4920
|
+
if (Number.isInteger(value2))
|
|
4921
|
+
found = value2;
|
|
4922
|
+
}
|
|
4923
|
+
return found;
|
|
4924
|
+
}
|
|
4925
|
+
markTranscriptFailure(text2, exitCode, error) {
|
|
4926
|
+
if (!text2)
|
|
4927
|
+
return error;
|
|
4928
|
+
let next = text2;
|
|
4929
|
+
next = next.replace(/status: success/g, "status: failure");
|
|
4930
|
+
next = next.replace(/exit_code: 0/g, `exit_code: ${exitCode}`);
|
|
4931
|
+
if (!next.includes(`exit_code: ${exitCode}`)) {
|
|
4932
|
+
next = `${next}
|
|
4933
|
+
exit_code: ${exitCode}`;
|
|
4934
|
+
}
|
|
4935
|
+
if (!next.includes(error)) {
|
|
4936
|
+
next = `${next}
|
|
4937
|
+
error: ${error}`;
|
|
4938
|
+
}
|
|
4939
|
+
return next;
|
|
4940
|
+
}
|
|
4904
4941
|
isBenignPipePreviewSigpipe(command, result) {
|
|
4905
4942
|
if (result.success !== false)
|
|
4906
4943
|
return false;
|
|
@@ -20357,18 +20394,18 @@ function detectStage(metrics2) {
|
|
|
20357
20394
|
return "specialization";
|
|
20358
20395
|
return "exploration";
|
|
20359
20396
|
}
|
|
20360
|
-
function thresholdsForStage(
|
|
20361
|
-
return { ...STAGE_THRESHOLDS[
|
|
20397
|
+
function thresholdsForStage(stage2) {
|
|
20398
|
+
return { ...STAGE_THRESHOLDS[stage2] };
|
|
20362
20399
|
}
|
|
20363
|
-
function characteristicsForStage(
|
|
20364
|
-
return { ...STAGE_CHARACTERISTICS[
|
|
20400
|
+
function characteristicsForStage(stage2) {
|
|
20401
|
+
return { ...STAGE_CHARACTERISTICS[stage2] };
|
|
20365
20402
|
}
|
|
20366
20403
|
function report(metrics2) {
|
|
20367
|
-
const
|
|
20368
|
-
const thresholds = thresholdsForStage(
|
|
20369
|
-
const characteristics = characteristicsForStage(
|
|
20370
|
-
const nextStage = computeNextStage(
|
|
20371
|
-
return { stage, metrics: metrics2, thresholds, characteristics, nextStage };
|
|
20404
|
+
const stage2 = detectStage(metrics2);
|
|
20405
|
+
const thresholds = thresholdsForStage(stage2);
|
|
20406
|
+
const characteristics = characteristicsForStage(stage2);
|
|
20407
|
+
const nextStage = computeNextStage(stage2, metrics2);
|
|
20408
|
+
return { stage: stage2, metrics: metrics2, thresholds, characteristics, nextStage };
|
|
20372
20409
|
}
|
|
20373
20410
|
function computeNextStage(current, m2) {
|
|
20374
20411
|
const next = current === "exploration" ? "specialization" : current === "specialization" ? "integration" : current === "integration" ? "wisdom" : null;
|
|
@@ -21815,11 +21852,11 @@ var init_memoryStageContext = __esm({
|
|
|
21815
21852
|
current;
|
|
21816
21853
|
onStageChange;
|
|
21817
21854
|
constructor(options2 = {}) {
|
|
21818
|
-
const
|
|
21855
|
+
const stage2 = options2.initialStage ?? "exploration";
|
|
21819
21856
|
this.current = {
|
|
21820
|
-
stage,
|
|
21821
|
-
thresholds: thresholdsForStage(
|
|
21822
|
-
characteristics: characteristicsForStage(
|
|
21857
|
+
stage: stage2,
|
|
21858
|
+
thresholds: thresholdsForStage(stage2),
|
|
21859
|
+
characteristics: characteristicsForStage(stage2),
|
|
21823
21860
|
computedAt: Date.now()
|
|
21824
21861
|
};
|
|
21825
21862
|
this.onStageChange = options2.onStageChange;
|
|
@@ -274668,12 +274705,12 @@ function parseStructuredProgress(text2) {
|
|
|
274668
274705
|
const parsed = JSON.parse(trimmed);
|
|
274669
274706
|
if (parsed["omnius_progress"] !== true)
|
|
274670
274707
|
return null;
|
|
274671
|
-
const
|
|
274708
|
+
const stage2 = String(parsed["stage"] ?? "process");
|
|
274672
274709
|
const message2 = String(parsed["message"] ?? "").trim();
|
|
274673
274710
|
const percent = typeof parsed["percent"] === "number" ? parsed["percent"] : void 0;
|
|
274674
274711
|
if (!message2)
|
|
274675
274712
|
return null;
|
|
274676
|
-
return { stage, message: message2, percent };
|
|
274713
|
+
return { stage: stage2, message: message2, percent };
|
|
274677
274714
|
} catch {
|
|
274678
274715
|
return null;
|
|
274679
274716
|
}
|
|
@@ -277260,12 +277297,12 @@ async function runProcess3(command, args, options2) {
|
|
|
277260
277297
|
}, 5e3);
|
|
277261
277298
|
sigkillTimer.unref();
|
|
277262
277299
|
};
|
|
277263
|
-
const abortWithMessage = (message2,
|
|
277300
|
+
const abortWithMessage = (message2, stage2) => {
|
|
277264
277301
|
stderr += stderr.endsWith("\n") || stderr.length === 0 ? `${message2}
|
|
277265
277302
|
` : `
|
|
277266
277303
|
${message2}
|
|
277267
277304
|
`;
|
|
277268
|
-
options2.onProgress?.({ stage, message: message2, elapsedMs: Date.now() - startedAt2 });
|
|
277305
|
+
options2.onProgress?.({ stage: stage2, message: message2, elapsedMs: Date.now() - startedAt2 });
|
|
277269
277306
|
terminateChild();
|
|
277270
277307
|
finish({ code: 124, stdout, stderr }, { preserveSigkillTimer: true });
|
|
277271
277308
|
};
|
|
@@ -281041,12 +281078,12 @@ function parseStructuredProgress2(text2) {
|
|
|
281041
281078
|
const parsed = JSON.parse(trimmed);
|
|
281042
281079
|
if (parsed["omnius_progress"] !== true)
|
|
281043
281080
|
return null;
|
|
281044
|
-
const
|
|
281081
|
+
const stage2 = String(parsed["stage"] ?? "process");
|
|
281045
281082
|
const message2 = String(parsed["message"] ?? "").trim();
|
|
281046
281083
|
const percent = typeof parsed["percent"] === "number" ? parsed["percent"] : void 0;
|
|
281047
281084
|
if (!message2)
|
|
281048
281085
|
return null;
|
|
281049
|
-
return { stage, message: message2, percent };
|
|
281086
|
+
return { stage: stage2, message: message2, percent };
|
|
281050
281087
|
} catch {
|
|
281051
281088
|
return null;
|
|
281052
281089
|
}
|
|
@@ -284867,9 +284904,9 @@ No artifact created: provide prompt and/or input_image for ${kindLabel(kind)} ge
|
|
|
284867
284904
|
brokerDecision
|
|
284868
284905
|
};
|
|
284869
284906
|
}
|
|
284870
|
-
emit(start2,
|
|
284907
|
+
emit(start2, stage2, message2, percent) {
|
|
284871
284908
|
this.progressCallback?.({
|
|
284872
|
-
stage,
|
|
284909
|
+
stage: stage2,
|
|
284873
284910
|
message: message2,
|
|
284874
284911
|
percent,
|
|
284875
284912
|
elapsedMs: performance.now() - start2
|
|
@@ -549127,7 +549164,7 @@ var init_agent_tool = __esm({
|
|
|
549127
549164
|
_idCounter = 0;
|
|
549128
549165
|
AgentTool = class {
|
|
549129
549166
|
name = "agent";
|
|
549130
|
-
description = "Spawn a sub-agent to handle a task autonomously. Sub-agents have their own context window and tool set, controlled by the agent type.\n\nAgent types:\n- general: Full tool access (minus agent spawning). For complex multi-step tasks.\n- explore: Read-only. Fast codebase search and analysis.\n- plan: Read-only. Returns structured implementation plans.\n- coordinator: Orchestrates teams of agents. Cannot edit files directly.\n\nUse run_in_background=true for parallel work. Check results via task_status/task_output.";
|
|
549167
|
+
description = "Spawn a sub-agent to handle a task autonomously. Sub-agents have their own context window and tool set, controlled by the agent type.\n\nAgent types:\n- general: Full tool access (minus agent spawning). For complex multi-step tasks.\n- explore: Read-only. Fast codebase search and analysis.\n- plan: Read-only. Returns structured implementation plans.\n- coordinator: Orchestrates teams of agents. Cannot edit files directly.\n\nDeployment patterns: optional named orchestration contracts such as sequential_pipeline, parallel_analysis, scatter_gather, maker_checker, debate_review, specialist_committee, hierarchical_crew, blackboard, task_swarm, and dynamic_task_ledger. Use them only when specialization, context isolation, parallelism, critique, or dynamic decomposition is structurally needed.\n\nUse run_in_background=true for parallel work. Check results via task_status/task_output.";
|
|
549131
549168
|
parameters = {
|
|
549132
549169
|
type: "object",
|
|
549133
549170
|
properties: {
|
|
@@ -549140,6 +549177,14 @@ var init_agent_tool = __esm({
|
|
|
549140
549177
|
enum: ["general", "explore", "plan", "coordinator"],
|
|
549141
549178
|
description: "Agent type determining tool access and behavior (default: general)"
|
|
549142
549179
|
},
|
|
549180
|
+
deployment_pattern: {
|
|
549181
|
+
type: "string",
|
|
549182
|
+
description: "Optional named sub-agent deployment pattern. Examples: single_worker, sequential_pipeline, parallel_analysis, scatter_gather, orchestrator_workers, maker_checker, debate_review, specialist_committee, hierarchical_crew, blackboard, task_swarm, dynamic_task_ledger. Multi-stage patterns auto-select coordinator when subagent_type is omitted."
|
|
549183
|
+
},
|
|
549184
|
+
pattern: {
|
|
549185
|
+
type: "string",
|
|
549186
|
+
description: "Compatibility alias for deployment_pattern. Prefer deployment_pattern."
|
|
549187
|
+
},
|
|
549143
549188
|
run_in_background: {
|
|
549144
549189
|
type: "boolean",
|
|
549145
549190
|
description: "Run asynchronously, return task ID immediately (default: false)"
|
|
@@ -549184,7 +549229,8 @@ var init_agent_tool = __esm({
|
|
|
549184
549229
|
async execute(args) {
|
|
549185
549230
|
const start2 = performance.now();
|
|
549186
549231
|
const prompt = String(args["prompt"] ?? "");
|
|
549187
|
-
const
|
|
549232
|
+
const rawPattern = String(args["deployment_pattern"] ?? args["pattern"] ?? "").trim();
|
|
549233
|
+
let subagentType = String(args["subagent_type"] ?? "general");
|
|
549188
549234
|
const runInBackground = Boolean(args["run_in_background"] ?? false);
|
|
549189
549235
|
const modelOverride = args["model"] ? String(args["model"]) : void 0;
|
|
549190
549236
|
const isolation = args["isolation"] ? String(args["isolation"]) : void 0;
|
|
@@ -549202,6 +549248,19 @@ var init_agent_tool = __esm({
|
|
|
549202
549248
|
durationMs: performance.now() - start2
|
|
549203
549249
|
};
|
|
549204
549250
|
}
|
|
549251
|
+
const deploymentPattern = rawPattern ? this.callbacks.resolveDeploymentPattern?.(rawPattern, prompt) : void 0;
|
|
549252
|
+
if (rawPattern && !deploymentPattern) {
|
|
549253
|
+
const available = this.callbacks.listDeploymentPatterns?.().join(", ") || "(pattern registry unavailable)";
|
|
549254
|
+
return {
|
|
549255
|
+
success: false,
|
|
549256
|
+
output: "",
|
|
549257
|
+
error: `Unknown deployment pattern: ${rawPattern}. Available: ${available}`,
|
|
549258
|
+
durationMs: performance.now() - start2
|
|
549259
|
+
};
|
|
549260
|
+
}
|
|
549261
|
+
if (deploymentPattern?.coordinatorRequired && args["subagent_type"] === void 0) {
|
|
549262
|
+
subagentType = "coordinator";
|
|
549263
|
+
}
|
|
549205
549264
|
const resolved = this.callbacks.resolveType(subagentType);
|
|
549206
549265
|
if (!resolved) {
|
|
549207
549266
|
const available = this.callbacks.listTypes().join(", ");
|
|
@@ -549260,11 +549319,15 @@ var init_agent_tool = __esm({
|
|
|
549260
549319
|
}
|
|
549261
549320
|
}
|
|
549262
549321
|
const composedPrompt = (() => {
|
|
549263
|
-
if (preloadedFiles.length === 0 && constraints.length === 0)
|
|
549322
|
+
if (preloadedFiles.length === 0 && constraints.length === 0 && !deploymentPattern)
|
|
549264
549323
|
return prompt;
|
|
549265
549324
|
const lines = [];
|
|
549266
549325
|
lines.push("[Sub-Agent Handoff — parent has provided this scoped context]");
|
|
549267
549326
|
lines.push("");
|
|
549327
|
+
if (deploymentPattern) {
|
|
549328
|
+
lines.push(deploymentPattern.instructions);
|
|
549329
|
+
lines.push("");
|
|
549330
|
+
}
|
|
549268
549331
|
if (preloadedFiles.length > 0) {
|
|
549269
549332
|
lines.push("## Pre-loaded files");
|
|
549270
549333
|
lines.push("These files have already been read for you. Reference them directly without calling file_read.");
|
|
@@ -549319,6 +549382,7 @@ var init_agent_tool = __esm({
|
|
|
549319
549382
|
systemPromptAddition: resolved.systemPromptAddition,
|
|
549320
549383
|
relevantFiles: preloadedFiles,
|
|
549321
549384
|
constraints,
|
|
549385
|
+
deploymentPattern: deploymentPattern?.pattern,
|
|
549322
549386
|
subAgentMode: true
|
|
549323
549387
|
}).then((result) => {
|
|
549324
549388
|
this.callbacks?.onViewStatus?.(agentId, result.completed ? "completed" : "failed");
|
|
@@ -549349,6 +549413,7 @@ var init_agent_tool = __esm({
|
|
|
549349
549413
|
systemPromptAddition: resolved.systemPromptAddition,
|
|
549350
549414
|
relevantFiles: preloadedFiles,
|
|
549351
549415
|
constraints,
|
|
549416
|
+
deploymentPattern: deploymentPattern?.pattern,
|
|
549352
549417
|
subAgentMode: true
|
|
549353
549418
|
});
|
|
549354
549419
|
if (result.completed) {
|
|
@@ -569456,8 +569521,8 @@ var init_focusSupervisor = __esm({
|
|
|
569456
569521
|
const directive = this.setDirective({
|
|
569457
569522
|
turn: input.turn,
|
|
569458
569523
|
state: ignoredManyTimes ? "verify_or_block" : "single_next_action",
|
|
569459
|
-
reason: ignoredManyTimes ? `model ignored ${this.ignoredDirectiveStreak} focus directives;
|
|
569460
|
-
requiredNextAction:
|
|
569524
|
+
reason: ignoredManyTimes ? `model ignored ${this.ignoredDirectiveStreak} focus directives; take the required recovery action before trying another variant` : `model ignored prior directive ${prior.id}; ${prior.reason}`,
|
|
569525
|
+
requiredNextAction: prior.requiredNextAction,
|
|
569461
569526
|
forbiddenActionFamilies: unique2([
|
|
569462
569527
|
...prior.forbiddenActionFamilies,
|
|
569463
569528
|
family
|
|
@@ -569561,7 +569626,7 @@ var init_focusSupervisor = __esm({
|
|
|
569561
569626
|
turn: input.turn,
|
|
569562
569627
|
state: "forced_replan",
|
|
569563
569628
|
reason: `same ${input.toolName} failure family repeated ${next.count} times: ${next.sample}`,
|
|
569564
|
-
requiredNextAction: input.toolName === "shell" ? "
|
|
569629
|
+
requiredNextAction: input.toolName === "shell" ? "edit_different_target" : "update_todos",
|
|
569565
569630
|
forbiddenActionFamilies: [actionFamily(input.toolName, input.args)]
|
|
569566
569631
|
});
|
|
569567
569632
|
}
|
|
@@ -572886,6 +572951,7 @@ ${parts.join("\n")}
|
|
|
572886
572951
|
memoryPrefix: options2?.memoryPrefix ?? "",
|
|
572887
572952
|
memoryPrefixHash: options2?.memoryPrefixHash ?? "",
|
|
572888
572953
|
stateDir: options2?.stateDir ?? "",
|
|
572954
|
+
surface: options2?.surface ?? "tui",
|
|
572889
572955
|
artifactMode: options2?.artifactMode ?? "user-task",
|
|
572890
572956
|
disablePersistentMemory: options2?.disablePersistentMemory ?? false,
|
|
572891
572957
|
disableCodebaseMap: options2?.disableCodebaseMap ?? false,
|
|
@@ -572960,11 +573026,11 @@ ${parts.join("\n")}
|
|
|
572960
573026
|
}
|
|
572961
573027
|
return "unknown";
|
|
572962
573028
|
}
|
|
572963
|
-
_recordContextWindowDump(
|
|
573029
|
+
_recordContextWindowDump(stage2, request, turn, attempt) {
|
|
572964
573030
|
const agentType = this.options.artifactMode === "internal" ? "internal" : this.options.subAgent || this.options.recursionDepth > 0 ? "sub-agent" : "main";
|
|
572965
573031
|
const record = recordContextWindowDump({
|
|
572966
573032
|
source: "agenticRunner",
|
|
572967
|
-
stage,
|
|
573033
|
+
stage: stage2,
|
|
572968
573034
|
agentType,
|
|
572969
573035
|
sessionId: this._sessionId,
|
|
572970
573036
|
runId: this._sessionId,
|
|
@@ -573237,16 +573303,21 @@ ${parts.join("\n")}
|
|
|
573237
573303
|
// -------------------------------------------------------------------------
|
|
573238
573304
|
/** Infer the surface identifier from runner configuration and dynamic context. */
|
|
573239
573305
|
_inferSurface() {
|
|
573240
|
-
|
|
573241
|
-
|
|
573242
|
-
|
|
573243
|
-
|
|
573244
|
-
|
|
573245
|
-
|
|
573246
|
-
|
|
573247
|
-
if (
|
|
573248
|
-
return "
|
|
573249
|
-
|
|
573306
|
+
return this.options.surface;
|
|
573307
|
+
}
|
|
573308
|
+
_isTelegramSurface() {
|
|
573309
|
+
return this.options.surface === "telegram-public" || this.options.surface === "telegram-admin";
|
|
573310
|
+
}
|
|
573311
|
+
stickyDynamicContextForActiveSurface() {
|
|
573312
|
+
const ctx3 = this._stickyDynamicContext.trim();
|
|
573313
|
+
if (!ctx3)
|
|
573314
|
+
return "";
|
|
573315
|
+
if (this._isTelegramSurface())
|
|
573316
|
+
return ctx3;
|
|
573317
|
+
const voiceSoul = this.extractDynamicMarkdownBlock(ctx3, "## Voice Soul Context", 6e3);
|
|
573318
|
+
if (!voiceSoul)
|
|
573319
|
+
return "";
|
|
573320
|
+
return /Telegram|telegram|Public Telegram|Admin Capability/i.test(voiceSoul) ? "" : voiceSoul;
|
|
573250
573321
|
}
|
|
573251
573322
|
/**
|
|
573252
573323
|
* Build structured context via the context engine.
|
|
@@ -587007,10 +587078,11 @@ ${postCompactRestore.join("\n")}`);
|
|
|
587007
587078
|
[Ephemeral skill-pack restore — current run only, do not persist]
|
|
587008
587079
|
${this._ephemeralSkillPackContext}
|
|
587009
587080
|
Use skill_extract for targeted skill unpacking; do not load full skills into the main context unless necessary.` : "";
|
|
587010
|
-
const
|
|
587081
|
+
const scopedStickyDynamicContext = this.stickyDynamicContextForActiveSurface();
|
|
587082
|
+
const stickyDynamicContextReminder = scopedStickyDynamicContext ? `
|
|
587011
587083
|
|
|
587012
587084
|
[Sticky dynamic context restore — surface/persona anchors]
|
|
587013
|
-
${
|
|
587085
|
+
${scopedStickyDynamicContext}` : "";
|
|
587014
587086
|
const compactionMsg = {
|
|
587015
587087
|
role: "system",
|
|
587016
587088
|
// WO-CE-03: XML tags for structural clarity on small/medium models
|
|
@@ -587027,7 +587099,7 @@ ${fullSummary}
|
|
|
587027
587099
|
this.persistCheckpoint(fullSummary);
|
|
587028
587100
|
let narrowedHead = [...head];
|
|
587029
587101
|
const EVIDENCE_RULE_COMPACT = `EVIDENCE RULE (PRIORITY 0): never claim something works or is true unless a tool result you saw this turn proves it. A command succeeding only means it ran — not that the intended effect happened; verify the end-state directly before claiming it. A negative, empty, or error result means failed or absent — report it, never explain it away with an untested theory. Never describe how you got a result (tool, command, or source) unless you actually used it. Do not assert relationships the output does not show. Say "I could not verify X" when it is unproven — that is the correct answer, not a guess.`;
|
|
587030
|
-
const telegramPersonaHead = /Telegram|Voice Soul Context|Public Telegram voice profile/.test(
|
|
587102
|
+
const telegramPersonaHead = this._isTelegramSurface() && /Telegram|Voice Soul Context|Public Telegram voice profile/.test(scopedStickyDynamicContext) ? `You are Omnius replying through Telegram. Your visible assistant text is sent to Telegram; keep it concise, scoped, and user-facing. Do not emit scratch notes, router decisions, internal status, or no_reply text. Use available tools when needed and call task_complete when the Telegram run is complete.
|
|
587031
587103
|
|
|
587032
587104
|
${EVIDENCE_RULE_COMPACT}
|
|
587033
587105
|
|
|
@@ -587182,7 +587254,12 @@ ${content.slice(0, 8e3)}
|
|
|
587182
587254
|
while (trimmedRecent.length > 1 && trimmedRecent[0]?.role === "tool") {
|
|
587183
587255
|
trimmedRecent = trimmedRecent.slice(1);
|
|
587184
587256
|
}
|
|
587185
|
-
result = [
|
|
587257
|
+
result = [
|
|
587258
|
+
...narrowedHead,
|
|
587259
|
+
compactionMsg,
|
|
587260
|
+
...stickyToKeep,
|
|
587261
|
+
...trimmedRecent
|
|
587262
|
+
];
|
|
587186
587263
|
}
|
|
587187
587264
|
if (trimmedRecent.length < filteredRecent.length) {
|
|
587188
587265
|
this.emit({
|
|
@@ -592957,6 +593034,565 @@ var init_agent_types = __esm({
|
|
|
592957
593034
|
}
|
|
592958
593035
|
});
|
|
592959
593036
|
|
|
593037
|
+
// packages/orchestrator/dist/agent-patterns.js
|
|
593038
|
+
function stage(input) {
|
|
593039
|
+
return { required: true, ...input };
|
|
593040
|
+
}
|
|
593041
|
+
function buildDeploymentPatternInstructions(def, stages, task) {
|
|
593042
|
+
const lines = [
|
|
593043
|
+
"[Sub-Agent Deployment Pattern]",
|
|
593044
|
+
`pattern: ${def.pattern}`,
|
|
593045
|
+
`topology: ${def.topology}`,
|
|
593046
|
+
`task: ${task}`,
|
|
593047
|
+
`coordinator_required: ${def.coordinatorRequired}`,
|
|
593048
|
+
`max_agents: ${def.maxAgents}`,
|
|
593049
|
+
"",
|
|
593050
|
+
"Use this pattern only because the task needs specialization, isolation, parallelism, critique, or dynamic decomposition.",
|
|
593051
|
+
def.systemPromptAddition,
|
|
593052
|
+
"",
|
|
593053
|
+
"Stages:"
|
|
593054
|
+
];
|
|
593055
|
+
for (const s2 of stages) {
|
|
593056
|
+
lines.push(`${s2.order}. ${s2.id} — ${s2.label}`, ` agent_type: ${s2.agentType}`, ` mode: ${s2.mode}${s2.parallelGroup ? ` (${s2.parallelGroup})` : ""}`, ` purpose: ${s2.purpose}`);
|
|
593057
|
+
if (s2.dependsOn?.length)
|
|
593058
|
+
lines.push(` depends_on: ${s2.dependsOn.join(", ")}`);
|
|
593059
|
+
lines.push(" output_contract:");
|
|
593060
|
+
for (const item of s2.outputContract)
|
|
593061
|
+
lines.push(` - ${item}`);
|
|
593062
|
+
}
|
|
593063
|
+
lines.push("", "Coordinator contract:", "- Keep worker prompts narrow and self-contained.", "- Run independent stages in parallel only when their write sets do not overlap.", "- Validate each handoff before starting dependent stages.", "- Preserve dissent, failures, and unresolved blockers in the final synthesis.", "- Complete only with evidence from worker outputs and verification.");
|
|
593064
|
+
return lines.join("\n");
|
|
593065
|
+
}
|
|
593066
|
+
function getAgentDeploymentPatternRegistry() {
|
|
593067
|
+
return _patternRegistry;
|
|
593068
|
+
}
|
|
593069
|
+
function registerAgentDeploymentPattern(def) {
|
|
593070
|
+
_patternRegistry.register(def);
|
|
593071
|
+
}
|
|
593072
|
+
function getAgentDeploymentPattern(pattern) {
|
|
593073
|
+
return _patternRegistry.get(pattern);
|
|
593074
|
+
}
|
|
593075
|
+
function planAgentDeploymentPattern(pattern, task) {
|
|
593076
|
+
return _patternRegistry.plan(pattern, task);
|
|
593077
|
+
}
|
|
593078
|
+
function buildAgentDeploymentPatternSummary() {
|
|
593079
|
+
return _patternRegistry.buildPatternSummary();
|
|
593080
|
+
}
|
|
593081
|
+
var BUILT_INS, AgentDeploymentPatternRegistry, _patternRegistry;
|
|
593082
|
+
var init_agent_patterns = __esm({
|
|
593083
|
+
"packages/orchestrator/dist/agent-patterns.js"() {
|
|
593084
|
+
"use strict";
|
|
593085
|
+
init_agent_types();
|
|
593086
|
+
BUILT_INS = [
|
|
593087
|
+
{
|
|
593088
|
+
pattern: "single_worker",
|
|
593089
|
+
aliases: ["single", "direct_worker"],
|
|
593090
|
+
description: "One bounded worker owns the delegated task.",
|
|
593091
|
+
topology: "single",
|
|
593092
|
+
useWhen: ["The task is narrow enough for one context window."],
|
|
593093
|
+
avoidWhen: ["Independent critique, parallel search, or separate permissions are required."],
|
|
593094
|
+
coordinatorRequired: false,
|
|
593095
|
+
maxAgents: 1,
|
|
593096
|
+
systemPromptAddition: "Use the least autonomous design: one focused worker, scoped evidence, then task_complete.",
|
|
593097
|
+
stages: [
|
|
593098
|
+
stage({
|
|
593099
|
+
id: "worker",
|
|
593100
|
+
label: "Focused worker",
|
|
593101
|
+
agentType: "general",
|
|
593102
|
+
purpose: "Complete the delegated task inside one scoped context.",
|
|
593103
|
+
order: 1,
|
|
593104
|
+
mode: "sequential",
|
|
593105
|
+
outputContract: ["Summary of changes or findings", "Verification evidence", "Open blockers"]
|
|
593106
|
+
})
|
|
593107
|
+
]
|
|
593108
|
+
},
|
|
593109
|
+
{
|
|
593110
|
+
pattern: "sequential_pipeline",
|
|
593111
|
+
aliases: ["pipeline", "planner_executor_reporter"],
|
|
593112
|
+
description: "Fixed-order handoff where each stage validates and passes compact output forward.",
|
|
593113
|
+
topology: "sequential",
|
|
593114
|
+
useWhen: ["The workflow order is known and each handoff can be validated."],
|
|
593115
|
+
avoidWhen: ["Stages are independent and should run in parallel."],
|
|
593116
|
+
coordinatorRequired: true,
|
|
593117
|
+
maxAgents: 3,
|
|
593118
|
+
systemPromptAddition: "Run a fixed sequence. Do not skip handoff validation between stages.",
|
|
593119
|
+
stages: [
|
|
593120
|
+
stage({
|
|
593121
|
+
id: "plan",
|
|
593122
|
+
label: "Planner",
|
|
593123
|
+
agentType: "plan",
|
|
593124
|
+
purpose: "Produce a compact implementation or investigation plan.",
|
|
593125
|
+
order: 1,
|
|
593126
|
+
mode: "sequential",
|
|
593127
|
+
outputContract: ["Concrete steps", "Files or systems to inspect", "Verification plan"]
|
|
593128
|
+
}),
|
|
593129
|
+
stage({
|
|
593130
|
+
id: "execute",
|
|
593131
|
+
label: "Executor",
|
|
593132
|
+
agentType: "general",
|
|
593133
|
+
purpose: "Execute the approved plan.",
|
|
593134
|
+
order: 2,
|
|
593135
|
+
mode: "sequential",
|
|
593136
|
+
dependsOn: ["plan"],
|
|
593137
|
+
outputContract: ["Work performed", "Files modified", "Commands/tests run"]
|
|
593138
|
+
}),
|
|
593139
|
+
stage({
|
|
593140
|
+
id: "report",
|
|
593141
|
+
label: "Reporter",
|
|
593142
|
+
agentType: "explore",
|
|
593143
|
+
purpose: "Check resulting evidence and summarize final state.",
|
|
593144
|
+
order: 3,
|
|
593145
|
+
mode: "review",
|
|
593146
|
+
dependsOn: ["execute"],
|
|
593147
|
+
outputContract: ["Evidence-backed result", "Residual risks", "Suggested next steps"]
|
|
593148
|
+
})
|
|
593149
|
+
]
|
|
593150
|
+
},
|
|
593151
|
+
{
|
|
593152
|
+
pattern: "parallel_analysis",
|
|
593153
|
+
aliases: ["concurrent_analysis", "sectioning"],
|
|
593154
|
+
description: "Run independent specialists in parallel and aggregate disagreements explicitly.",
|
|
593155
|
+
topology: "parallel",
|
|
593156
|
+
useWhen: ["Independent perspectives or code regions can be analyzed separately."],
|
|
593157
|
+
avoidWhen: ["Workers must mutate the same files without a merge owner."],
|
|
593158
|
+
coordinatorRequired: true,
|
|
593159
|
+
maxAgents: 5,
|
|
593160
|
+
systemPromptAddition: "Launch independent read-only or scoped workers in parallel, then aggregate explicitly.",
|
|
593161
|
+
stages: [
|
|
593162
|
+
stage({
|
|
593163
|
+
id: "explorer_a",
|
|
593164
|
+
label: "Explorer A",
|
|
593165
|
+
agentType: "explore",
|
|
593166
|
+
purpose: "Inspect the first region or perspective.",
|
|
593167
|
+
order: 1,
|
|
593168
|
+
mode: "parallel",
|
|
593169
|
+
parallelGroup: "analysis",
|
|
593170
|
+
outputContract: ["Findings", "Source paths", "Confidence"]
|
|
593171
|
+
}),
|
|
593172
|
+
stage({
|
|
593173
|
+
id: "explorer_b",
|
|
593174
|
+
label: "Explorer B",
|
|
593175
|
+
agentType: "explore",
|
|
593176
|
+
purpose: "Inspect the second region or perspective.",
|
|
593177
|
+
order: 1,
|
|
593178
|
+
mode: "parallel",
|
|
593179
|
+
parallelGroup: "analysis",
|
|
593180
|
+
outputContract: ["Findings", "Source paths", "Confidence"]
|
|
593181
|
+
}),
|
|
593182
|
+
stage({
|
|
593183
|
+
id: "aggregate",
|
|
593184
|
+
label: "Aggregator",
|
|
593185
|
+
agentType: "plan",
|
|
593186
|
+
purpose: "Merge findings, preserve disagreements, and recommend next action.",
|
|
593187
|
+
order: 2,
|
|
593188
|
+
mode: "aggregate",
|
|
593189
|
+
dependsOn: ["explorer_a", "explorer_b"],
|
|
593190
|
+
outputContract: ["Merged conclusion", "Disagreements", "Evidence list"]
|
|
593191
|
+
})
|
|
593192
|
+
]
|
|
593193
|
+
},
|
|
593194
|
+
{
|
|
593195
|
+
pattern: "scatter_gather",
|
|
593196
|
+
aliases: ["map_reduce", "fanout_reduce"],
|
|
593197
|
+
description: "Fan out over many files/regions, then reduce into one compact result.",
|
|
593198
|
+
topology: "scatter_gather",
|
|
593199
|
+
useWhen: ["The input corpus is too large for one context window."],
|
|
593200
|
+
avoidWhen: ["Only one or two files are relevant."],
|
|
593201
|
+
coordinatorRequired: true,
|
|
593202
|
+
maxAgents: 8,
|
|
593203
|
+
systemPromptAddition: "Partition by source/region, require provenance from every mapper, then reduce deterministically.",
|
|
593204
|
+
stages: [
|
|
593205
|
+
stage({
|
|
593206
|
+
id: "map",
|
|
593207
|
+
label: "Mapper workers",
|
|
593208
|
+
agentType: "explore",
|
|
593209
|
+
purpose: "Process assigned partitions independently.",
|
|
593210
|
+
order: 1,
|
|
593211
|
+
mode: "parallel",
|
|
593212
|
+
parallelGroup: "map",
|
|
593213
|
+
outputContract: ["Partition id", "Relevant paths", "Distilled findings"]
|
|
593214
|
+
}),
|
|
593215
|
+
stage({
|
|
593216
|
+
id: "reduce",
|
|
593217
|
+
label: "Reducer",
|
|
593218
|
+
agentType: "plan",
|
|
593219
|
+
purpose: "Dedupe and synthesize mapper outputs.",
|
|
593220
|
+
order: 2,
|
|
593221
|
+
mode: "aggregate",
|
|
593222
|
+
dependsOn: ["map"],
|
|
593223
|
+
outputContract: ["Deduped paths", "Synthesis", "Empty partitions"]
|
|
593224
|
+
})
|
|
593225
|
+
]
|
|
593226
|
+
},
|
|
593227
|
+
{
|
|
593228
|
+
pattern: "orchestrator_workers",
|
|
593229
|
+
aliases: ["manager_workers", "manager_agents_as_tools"],
|
|
593230
|
+
description: "A coordinator decomposes unknown subtasks and owns final synthesis.",
|
|
593231
|
+
topology: "orchestrator_workers",
|
|
593232
|
+
useWhen: ["Subtasks are not fully known upfront."],
|
|
593233
|
+
avoidWhen: ["The task can be expressed as a fixed sequence."],
|
|
593234
|
+
coordinatorRequired: true,
|
|
593235
|
+
maxAgents: 6,
|
|
593236
|
+
systemPromptAddition: "The coordinator owns decomposition, worker scope, progress ledger, and final synthesis.",
|
|
593237
|
+
stages: [
|
|
593238
|
+
stage({
|
|
593239
|
+
id: "coordinate",
|
|
593240
|
+
label: "Coordinator",
|
|
593241
|
+
agentType: "coordinator",
|
|
593242
|
+
purpose: "Maintain task ledger and dispatch narrow workers.",
|
|
593243
|
+
order: 1,
|
|
593244
|
+
mode: "coordinate",
|
|
593245
|
+
outputContract: ["Task ledger", "Worker assignments", "Completion criteria"]
|
|
593246
|
+
}),
|
|
593247
|
+
stage({
|
|
593248
|
+
id: "workers",
|
|
593249
|
+
label: "Workers",
|
|
593250
|
+
agentType: "general",
|
|
593251
|
+
purpose: "Execute scoped subtasks assigned by the coordinator.",
|
|
593252
|
+
order: 2,
|
|
593253
|
+
mode: "parallel",
|
|
593254
|
+
dependsOn: ["coordinate"],
|
|
593255
|
+
outputContract: ["Scoped result", "Files touched", "Verification evidence"]
|
|
593256
|
+
})
|
|
593257
|
+
]
|
|
593258
|
+
},
|
|
593259
|
+
{
|
|
593260
|
+
pattern: "maker_checker",
|
|
593261
|
+
aliases: ["make_check", "generator_reviewer"],
|
|
593262
|
+
description: "One worker produces, an independent checker validates before completion.",
|
|
593263
|
+
topology: "maker_checker",
|
|
593264
|
+
useWhen: ["Quality, policy, or correctness needs an independent review."],
|
|
593265
|
+
avoidWhen: ["There is no clear checkable output."],
|
|
593266
|
+
coordinatorRequired: true,
|
|
593267
|
+
maxAgents: 2,
|
|
593268
|
+
systemPromptAddition: "Keep maker and checker independent. Prefer deterministic tests over model judgment when available.",
|
|
593269
|
+
stages: [
|
|
593270
|
+
stage({
|
|
593271
|
+
id: "maker",
|
|
593272
|
+
label: "Maker",
|
|
593273
|
+
agentType: "general",
|
|
593274
|
+
purpose: "Implement or draft the requested artifact.",
|
|
593275
|
+
order: 1,
|
|
593276
|
+
mode: "sequential",
|
|
593277
|
+
outputContract: ["Produced artifact", "Implementation notes", "Verification run"]
|
|
593278
|
+
}),
|
|
593279
|
+
stage({
|
|
593280
|
+
id: "checker",
|
|
593281
|
+
label: "Checker",
|
|
593282
|
+
agentType: "explore",
|
|
593283
|
+
purpose: "Validate the maker output without sharing the maker prompt as hidden state.",
|
|
593284
|
+
order: 2,
|
|
593285
|
+
mode: "review",
|
|
593286
|
+
dependsOn: ["maker"],
|
|
593287
|
+
outputContract: ["Pass/fail", "Findings with evidence", "Required fixes"]
|
|
593288
|
+
})
|
|
593289
|
+
]
|
|
593290
|
+
},
|
|
593291
|
+
{
|
|
593292
|
+
pattern: "debate_review",
|
|
593293
|
+
aliases: ["adversarial_review", "debate"],
|
|
593294
|
+
description: "Assign competing positions, then synthesize with evidence.",
|
|
593295
|
+
topology: "debate",
|
|
593296
|
+
useWhen: ["The decision is ambiguous or confirmation bias is likely."],
|
|
593297
|
+
avoidWhen: ["The task is a straightforward implementation with objective tests."],
|
|
593298
|
+
coordinatorRequired: true,
|
|
593299
|
+
maxAgents: 4,
|
|
593300
|
+
systemPromptAddition: "Assign explicit positions, require evidence for claims, then synthesize neutrally.",
|
|
593301
|
+
stages: [
|
|
593302
|
+
stage({
|
|
593303
|
+
id: "pro",
|
|
593304
|
+
label: "Pro advocate",
|
|
593305
|
+
agentType: "plan",
|
|
593306
|
+
purpose: "Argue for the proposed approach using evidence.",
|
|
593307
|
+
order: 1,
|
|
593308
|
+
mode: "parallel",
|
|
593309
|
+
parallelGroup: "debate",
|
|
593310
|
+
outputContract: ["Argument", "Evidence", "Assumptions"]
|
|
593311
|
+
}),
|
|
593312
|
+
stage({
|
|
593313
|
+
id: "con",
|
|
593314
|
+
label: "Risk advocate",
|
|
593315
|
+
agentType: "plan",
|
|
593316
|
+
purpose: "Argue against the proposed approach and surface risks.",
|
|
593317
|
+
order: 1,
|
|
593318
|
+
mode: "parallel",
|
|
593319
|
+
parallelGroup: "debate",
|
|
593320
|
+
outputContract: ["Counterargument", "Evidence", "Risks"]
|
|
593321
|
+
}),
|
|
593322
|
+
stage({
|
|
593323
|
+
id: "synthesis",
|
|
593324
|
+
label: "Neutral synthesizer",
|
|
593325
|
+
agentType: "plan",
|
|
593326
|
+
purpose: "Resolve the debate and state the decision criteria.",
|
|
593327
|
+
order: 2,
|
|
593328
|
+
mode: "aggregate",
|
|
593329
|
+
dependsOn: ["pro", "con"],
|
|
593330
|
+
outputContract: ["Decision", "Tradeoffs", "Dissent preserved"]
|
|
593331
|
+
})
|
|
593332
|
+
]
|
|
593333
|
+
},
|
|
593334
|
+
{
|
|
593335
|
+
pattern: "specialist_committee",
|
|
593336
|
+
aliases: ["committee", "aggregator"],
|
|
593337
|
+
description: "Domain specialists produce findings; an aggregator preserves evidence and dissent.",
|
|
593338
|
+
topology: "committee",
|
|
593339
|
+
useWhen: ["The problem spans multiple domains or risk lenses."],
|
|
593340
|
+
avoidWhen: ["The domain is singular and objective tests are available."],
|
|
593341
|
+
coordinatorRequired: true,
|
|
593342
|
+
maxAgents: 6,
|
|
593343
|
+
systemPromptAddition: "Specialists must state assumptions, evidence, uncertainty, and dissent.",
|
|
593344
|
+
stages: [
|
|
593345
|
+
stage({
|
|
593346
|
+
id: "technical",
|
|
593347
|
+
label: "Technical specialist",
|
|
593348
|
+
agentType: "general",
|
|
593349
|
+
purpose: "Assess implementation feasibility and constraints.",
|
|
593350
|
+
order: 1,
|
|
593351
|
+
mode: "parallel",
|
|
593352
|
+
parallelGroup: "committee",
|
|
593353
|
+
outputContract: ["Technical findings", "Evidence", "Uncertainty"]
|
|
593354
|
+
}),
|
|
593355
|
+
stage({
|
|
593356
|
+
id: "risk",
|
|
593357
|
+
label: "Risk specialist",
|
|
593358
|
+
agentType: "explore",
|
|
593359
|
+
purpose: "Assess safety, operational, or regression risks.",
|
|
593360
|
+
order: 1,
|
|
593361
|
+
mode: "parallel",
|
|
593362
|
+
parallelGroup: "committee",
|
|
593363
|
+
outputContract: ["Risks", "Evidence", "Mitigations"]
|
|
593364
|
+
}),
|
|
593365
|
+
stage({
|
|
593366
|
+
id: "aggregate",
|
|
593367
|
+
label: "Aggregator",
|
|
593368
|
+
agentType: "plan",
|
|
593369
|
+
purpose: "Synthesize specialist findings and preserve disagreements.",
|
|
593370
|
+
order: 2,
|
|
593371
|
+
mode: "aggregate",
|
|
593372
|
+
dependsOn: ["technical", "risk"],
|
|
593373
|
+
outputContract: ["Synthesis", "Dissent", "Recommendation"]
|
|
593374
|
+
})
|
|
593375
|
+
]
|
|
593376
|
+
},
|
|
593377
|
+
{
|
|
593378
|
+
pattern: "hierarchical_crew",
|
|
593379
|
+
aliases: ["crew", "multi_team"],
|
|
593380
|
+
description: "A coordinator manages subcrews for large multi-domain work.",
|
|
593381
|
+
topology: "hierarchical",
|
|
593382
|
+
useWhen: ["The task is large, multi-domain, and decomposable."],
|
|
593383
|
+
avoidWhen: ["A flat worker set is enough."],
|
|
593384
|
+
coordinatorRequired: true,
|
|
593385
|
+
maxAgents: 10,
|
|
593386
|
+
systemPromptAddition: "Define hierarchy, responsibilities, checkpoints, and stop conditions before spawning subcrews.",
|
|
593387
|
+
stages: [
|
|
593388
|
+
stage({
|
|
593389
|
+
id: "lead",
|
|
593390
|
+
label: "Crew lead",
|
|
593391
|
+
agentType: "coordinator",
|
|
593392
|
+
purpose: "Own hierarchy, checkpoints, and final integration.",
|
|
593393
|
+
order: 1,
|
|
593394
|
+
mode: "coordinate",
|
|
593395
|
+
outputContract: ["Hierarchy", "Responsibilities", "Checkpoints"]
|
|
593396
|
+
}),
|
|
593397
|
+
stage({
|
|
593398
|
+
id: "subcrews",
|
|
593399
|
+
label: "Subcrew workers",
|
|
593400
|
+
agentType: "general",
|
|
593401
|
+
purpose: "Execute scoped domain work under the lead.",
|
|
593402
|
+
order: 2,
|
|
593403
|
+
mode: "parallel",
|
|
593404
|
+
dependsOn: ["lead"],
|
|
593405
|
+
outputContract: ["Domain result", "Verification", "Blockers"]
|
|
593406
|
+
})
|
|
593407
|
+
]
|
|
593408
|
+
},
|
|
593409
|
+
{
|
|
593410
|
+
pattern: "blackboard",
|
|
593411
|
+
aliases: ["shared_workspace"],
|
|
593412
|
+
description: "Workers coordinate through a structured shared artifact.",
|
|
593413
|
+
topology: "blackboard",
|
|
593414
|
+
useWhen: ["Multiple agents must update a common evolving state."],
|
|
593415
|
+
avoidWhen: ["Workers can return independent final outputs without coordination."],
|
|
593416
|
+
coordinatorRequired: true,
|
|
593417
|
+
maxAgents: 6,
|
|
593418
|
+
systemPromptAddition: "Use a structured blackboard with author, timestamp, source, confidence, and conflict fields.",
|
|
593419
|
+
stages: [
|
|
593420
|
+
stage({
|
|
593421
|
+
id: "board_init",
|
|
593422
|
+
label: "Board initializer",
|
|
593423
|
+
agentType: "plan",
|
|
593424
|
+
purpose: "Create the shared artifact schema and initial task lanes.",
|
|
593425
|
+
order: 1,
|
|
593426
|
+
mode: "sequential",
|
|
593427
|
+
outputContract: ["Board schema", "Task lanes", "Conflict policy"]
|
|
593428
|
+
}),
|
|
593429
|
+
stage({
|
|
593430
|
+
id: "contributors",
|
|
593431
|
+
label: "Contributors",
|
|
593432
|
+
agentType: "general",
|
|
593433
|
+
purpose: "Write structured entries to the board without conflicting writes.",
|
|
593434
|
+
order: 2,
|
|
593435
|
+
mode: "parallel",
|
|
593436
|
+
dependsOn: ["board_init"],
|
|
593437
|
+
outputContract: ["Board entries", "Sources", "Confidence"]
|
|
593438
|
+
})
|
|
593439
|
+
]
|
|
593440
|
+
},
|
|
593441
|
+
{
|
|
593442
|
+
pattern: "task_swarm",
|
|
593443
|
+
aliases: ["swarm"],
|
|
593444
|
+
description: "Many small stateless workers process granular queued tasks.",
|
|
593445
|
+
topology: "swarm",
|
|
593446
|
+
useWhen: ["The workload is large, partitionable, and homogeneous."],
|
|
593447
|
+
avoidWhen: ["Workers need shared mutable state or nuanced coordination."],
|
|
593448
|
+
coordinatorRequired: true,
|
|
593449
|
+
maxAgents: 12,
|
|
593450
|
+
systemPromptAddition: "Keep swarm workers stateless, cap fan-out, aggregate deterministically, and monitor cost.",
|
|
593451
|
+
stages: [
|
|
593452
|
+
stage({
|
|
593453
|
+
id: "queue",
|
|
593454
|
+
label: "Queue planner",
|
|
593455
|
+
agentType: "plan",
|
|
593456
|
+
purpose: "Partition work into small independent units.",
|
|
593457
|
+
order: 1,
|
|
593458
|
+
mode: "sequential",
|
|
593459
|
+
outputContract: ["Queue entries", "Unit success criteria", "Fan-out cap"]
|
|
593460
|
+
}),
|
|
593461
|
+
stage({
|
|
593462
|
+
id: "workers",
|
|
593463
|
+
label: "Swarm workers",
|
|
593464
|
+
agentType: "explore",
|
|
593465
|
+
purpose: "Process assigned units independently.",
|
|
593466
|
+
order: 2,
|
|
593467
|
+
mode: "parallel",
|
|
593468
|
+
dependsOn: ["queue"],
|
|
593469
|
+
outputContract: ["Unit id", "Result", "Failure reason"]
|
|
593470
|
+
})
|
|
593471
|
+
]
|
|
593472
|
+
},
|
|
593473
|
+
{
|
|
593474
|
+
pattern: "dynamic_task_ledger",
|
|
593475
|
+
aliases: ["magentic", "dynamic_ledger", "replan_ledger"],
|
|
593476
|
+
description: "Maintain a visible task ledger while planning, executing, observing, and replanning.",
|
|
593477
|
+
topology: "dynamic_ledger",
|
|
593478
|
+
useWhen: ["The solution path is unknown and must adapt to observations."],
|
|
593479
|
+
avoidWhen: ["A fixed pipeline or one worker can solve the task."],
|
|
593480
|
+
coordinatorRequired: true,
|
|
593481
|
+
maxAgents: 8,
|
|
593482
|
+
systemPromptAddition: "Maintain a visible task/progress ledger with success criteria, completed work, blockers, and replan reasons.",
|
|
593483
|
+
stages: [
|
|
593484
|
+
stage({
|
|
593485
|
+
id: "ledger",
|
|
593486
|
+
label: "Ledger coordinator",
|
|
593487
|
+
agentType: "coordinator",
|
|
593488
|
+
purpose: "Maintain task decomposition and reconfigure subtasks as evidence arrives.",
|
|
593489
|
+
order: 1,
|
|
593490
|
+
mode: "coordinate",
|
|
593491
|
+
outputContract: ["Current ledger", "Success criteria", "Replan reasons"]
|
|
593492
|
+
}),
|
|
593493
|
+
stage({
|
|
593494
|
+
id: "workers",
|
|
593495
|
+
label: "Adaptive workers",
|
|
593496
|
+
agentType: "general",
|
|
593497
|
+
purpose: "Execute current ledger items and return evidence.",
|
|
593498
|
+
order: 2,
|
|
593499
|
+
mode: "parallel",
|
|
593500
|
+
dependsOn: ["ledger"],
|
|
593501
|
+
outputContract: ["Ledger item id", "Evidence", "Blockers"]
|
|
593502
|
+
}),
|
|
593503
|
+
stage({
|
|
593504
|
+
id: "verify",
|
|
593505
|
+
label: "Verifier",
|
|
593506
|
+
agentType: "explore",
|
|
593507
|
+
purpose: "Verify completed ledger items before final synthesis.",
|
|
593508
|
+
order: 3,
|
|
593509
|
+
mode: "review",
|
|
593510
|
+
dependsOn: ["workers"],
|
|
593511
|
+
outputContract: ["Verified items", "Rejected claims", "Remaining work"]
|
|
593512
|
+
})
|
|
593513
|
+
]
|
|
593514
|
+
}
|
|
593515
|
+
];
|
|
593516
|
+
AgentDeploymentPatternRegistry = class {
|
|
593517
|
+
patterns = /* @__PURE__ */ new Map();
|
|
593518
|
+
aliases = /* @__PURE__ */ new Map();
|
|
593519
|
+
constructor() {
|
|
593520
|
+
for (const def of BUILT_INS)
|
|
593521
|
+
this.register(def);
|
|
593522
|
+
}
|
|
593523
|
+
register(def) {
|
|
593524
|
+
this.validate(def);
|
|
593525
|
+
this.patterns.set(def.pattern, def);
|
|
593526
|
+
this.aliases.set(def.pattern, def.pattern);
|
|
593527
|
+
for (const alias of def.aliases ?? [])
|
|
593528
|
+
this.aliases.set(alias, def.pattern);
|
|
593529
|
+
}
|
|
593530
|
+
get(pattern) {
|
|
593531
|
+
const canonical = this.aliases.get(pattern) ?? pattern;
|
|
593532
|
+
return this.patterns.get(canonical);
|
|
593533
|
+
}
|
|
593534
|
+
listPatterns() {
|
|
593535
|
+
return Array.from(this.patterns.keys());
|
|
593536
|
+
}
|
|
593537
|
+
listDefinitions() {
|
|
593538
|
+
return Array.from(this.patterns.values());
|
|
593539
|
+
}
|
|
593540
|
+
plan(pattern, task) {
|
|
593541
|
+
const def = this.get(pattern);
|
|
593542
|
+
if (!def)
|
|
593543
|
+
return void 0;
|
|
593544
|
+
const typeRegistry = getAgentTypeRegistry();
|
|
593545
|
+
const stages = def.stages.slice().sort((a2, b) => a2.order - b.order || a2.id.localeCompare(b.id)).map((s2) => ({
|
|
593546
|
+
...s2,
|
|
593547
|
+
agentTypeDescription: typeRegistry.get(s2.agentType)?.description ?? "Unknown agent type"
|
|
593548
|
+
}));
|
|
593549
|
+
return {
|
|
593550
|
+
pattern: def.pattern,
|
|
593551
|
+
topology: def.topology,
|
|
593552
|
+
description: def.description,
|
|
593553
|
+
coordinatorRequired: def.coordinatorRequired,
|
|
593554
|
+
task,
|
|
593555
|
+
stages,
|
|
593556
|
+
instructions: buildDeploymentPatternInstructions(def, stages, task)
|
|
593557
|
+
};
|
|
593558
|
+
}
|
|
593559
|
+
buildPatternSummary() {
|
|
593560
|
+
const lines = ["Available sub-agent deployment patterns:"];
|
|
593561
|
+
for (const def of this.patterns.values()) {
|
|
593562
|
+
lines.push(`- ${def.pattern} (${def.topology}): ${def.description} Use when: ${def.useWhen[0] ?? "structurally justified"}`);
|
|
593563
|
+
}
|
|
593564
|
+
return lines.join("\n");
|
|
593565
|
+
}
|
|
593566
|
+
validate(def) {
|
|
593567
|
+
if (!def.pattern.trim())
|
|
593568
|
+
throw new Error("pattern id is required");
|
|
593569
|
+
if (!def.stages.length)
|
|
593570
|
+
throw new Error(`pattern ${def.pattern} must define at least one stage`);
|
|
593571
|
+
const typeRegistry = getAgentTypeRegistry();
|
|
593572
|
+
const ids = /* @__PURE__ */ new Set();
|
|
593573
|
+
for (const s2 of def.stages) {
|
|
593574
|
+
if (!s2.id.trim())
|
|
593575
|
+
throw new Error(`pattern ${def.pattern} has a stage without id`);
|
|
593576
|
+
if (ids.has(s2.id))
|
|
593577
|
+
throw new Error(`pattern ${def.pattern} repeats stage id ${s2.id}`);
|
|
593578
|
+
ids.add(s2.id);
|
|
593579
|
+
if (!typeRegistry.get(s2.agentType)) {
|
|
593580
|
+
throw new Error(`pattern ${def.pattern} references unknown agent type ${s2.agentType}`);
|
|
593581
|
+
}
|
|
593582
|
+
for (const dep of s2.dependsOn ?? []) {
|
|
593583
|
+
if (!def.stages.some((candidate) => candidate.id === dep)) {
|
|
593584
|
+
throw new Error(`pattern ${def.pattern} stage ${s2.id} depends on unknown stage ${dep}`);
|
|
593585
|
+
}
|
|
593586
|
+
}
|
|
593587
|
+
}
|
|
593588
|
+
if (def.maxAgents < 1)
|
|
593589
|
+
throw new Error(`pattern ${def.pattern} maxAgents must be positive`);
|
|
593590
|
+
}
|
|
593591
|
+
};
|
|
593592
|
+
_patternRegistry = new AgentDeploymentPatternRegistry();
|
|
593593
|
+
}
|
|
593594
|
+
});
|
|
593595
|
+
|
|
592960
593596
|
// packages/orchestrator/dist/agent-task.js
|
|
592961
593597
|
function isTerminalTaskStatus(status) {
|
|
592962
593598
|
return status === "completed" || status === "failed" || status === "killed";
|
|
@@ -596208,6 +596844,7 @@ var init_conversational_scrutiny = __esm({
|
|
|
596208
596844
|
var dist_exports3 = {};
|
|
596209
596845
|
__export(dist_exports3, {
|
|
596210
596846
|
AGENT_DISALLOWED_TOOLS: () => AGENT_DISALLOWED_TOOLS,
|
|
596847
|
+
AgentDeploymentPatternRegistry: () => AgentDeploymentPatternRegistry,
|
|
596211
596848
|
AgentLoop: () => AgentLoop,
|
|
596212
596849
|
AgentTaskManager: () => AgentTaskManager,
|
|
596213
596850
|
AgentTypeRegistry: () => AgentTypeRegistry,
|
|
@@ -596263,6 +596900,7 @@ __export(dist_exports3, {
|
|
|
596263
596900
|
arcSummary: () => arcSummary,
|
|
596264
596901
|
auditCompletionClaims: () => auditCompletionClaims,
|
|
596265
596902
|
auditPerceptionClaims: () => auditPerceptionClaims,
|
|
596903
|
+
buildAgentDeploymentPatternSummary: () => buildAgentDeploymentPatternSummary,
|
|
596266
596904
|
buildAgentNotification: () => buildAgentNotification,
|
|
596267
596905
|
buildAgentTypeSummary: () => buildAgentTypeSummary,
|
|
596268
596906
|
buildCompletionScenarioDecomposition: () => buildCompletionScenarioDecomposition,
|
|
@@ -596342,6 +596980,8 @@ __export(dist_exports3, {
|
|
|
596342
596980
|
generateUserTestingResult: () => generateUserTestingResult,
|
|
596343
596981
|
generateUserTestingValidatorSkill: () => generateUserTestingValidatorSkill,
|
|
596344
596982
|
generateWorkerSkillTemplate: () => generateWorkerSkillTemplate,
|
|
596983
|
+
getAgentDeploymentPattern: () => getAgentDeploymentPattern,
|
|
596984
|
+
getAgentDeploymentPatternRegistry: () => getAgentDeploymentPatternRegistry,
|
|
596345
596985
|
getAgentType: () => getAgentType,
|
|
596346
596986
|
getAgentTypeRegistry: () => getAgentTypeRegistry,
|
|
596347
596987
|
getAllDefaultPricing: () => getAllDefaultPricing,
|
|
@@ -596394,6 +597034,7 @@ __export(dist_exports3, {
|
|
|
596394
597034
|
parseTextToolCalls: () => parseTextToolCalls,
|
|
596395
597035
|
partitionToolCalls: () => partitionToolCalls,
|
|
596396
597036
|
persistAgentTaskSidecar: () => persistAgentTaskSidecar,
|
|
597037
|
+
planAgentDeploymentPattern: () => planAgentDeploymentPattern,
|
|
596397
597038
|
planConsolidation: () => planConsolidation,
|
|
596398
597039
|
preprocessContextReferences: () => preprocessContextReferences,
|
|
596399
597040
|
pressureCheck: () => pressureCheck,
|
|
@@ -596421,6 +597062,7 @@ __export(dist_exports3, {
|
|
|
596421
597062
|
recordToolDecision: () => recordToolDecision,
|
|
596422
597063
|
recordToolEvidence: () => recordToolEvidence,
|
|
596423
597064
|
recordToolExecution: () => recordToolExecution,
|
|
597065
|
+
registerAgentDeploymentPattern: () => registerAgentDeploymentPattern,
|
|
596424
597066
|
registerAgentType: () => registerAgentType,
|
|
596425
597067
|
registerCommand: () => registerCommand,
|
|
596426
597068
|
registerHookHandler: () => registerHookHandler,
|
|
@@ -596515,6 +597157,7 @@ var init_dist8 = __esm({
|
|
|
596515
597157
|
init_stability_tracker();
|
|
596516
597158
|
init_render_decision();
|
|
596517
597159
|
init_agent_types();
|
|
597160
|
+
init_agent_patterns();
|
|
596518
597161
|
init_agent_task();
|
|
596519
597162
|
init_task_recovery();
|
|
596520
597163
|
init_coordinator();
|
|
@@ -596653,7 +597296,7 @@ function generationKindForToolName(toolName) {
|
|
|
596653
597296
|
function formatGenerativeProgress(kind, event, options2 = {}) {
|
|
596654
597297
|
const width = Math.max(8, Math.min(32, options2.width ?? (options2.surface === "telegram" ? 12 : 20)));
|
|
596655
597298
|
const label = kindLabel2(kind);
|
|
596656
|
-
const
|
|
597299
|
+
const stage2 = stageLabel(event.stage);
|
|
596657
597300
|
const pct = finitePercent(event.percent);
|
|
596658
597301
|
const bytes = formatProgressBytes(event);
|
|
596659
597302
|
const elapsed = formatElapsed(event.elapsedMs);
|
|
@@ -596661,17 +597304,17 @@ function formatGenerativeProgress(kind, event, options2 = {}) {
|
|
|
596661
597304
|
if (typeof pct === "number") {
|
|
596662
597305
|
const filled = Math.max(0, Math.min(width, Math.round(pct / 100 * width)));
|
|
596663
597306
|
const bar = `${"#".repeat(filled)}${"-".repeat(width - filled)}`;
|
|
596664
|
-
return `${label} ${
|
|
597307
|
+
return `${label} ${stage2}: [${bar}] ${pct}% ${message2}${bytes}${elapsed}`;
|
|
596665
597308
|
}
|
|
596666
|
-
return `${label} ${
|
|
597309
|
+
return `${label} ${stage2}: ${message2}${bytes}${elapsed}`;
|
|
596667
597310
|
}
|
|
596668
597311
|
function kindLabel2(kind) {
|
|
596669
597312
|
if (kind === "tts") return "TTS";
|
|
596670
597313
|
if (kind === "model") return "3D/CAD";
|
|
596671
597314
|
return kind.slice(0, 1).toUpperCase() + kind.slice(1);
|
|
596672
597315
|
}
|
|
596673
|
-
function stageLabel(
|
|
596674
|
-
const normalized = String(
|
|
597316
|
+
function stageLabel(stage2) {
|
|
597317
|
+
const normalized = String(stage2 || "process").trim().toLowerCase();
|
|
596675
597318
|
if (normalized === "setup") return "setup";
|
|
596676
597319
|
if (normalized === "download") return "download";
|
|
596677
597320
|
if (normalized === "load") return "load";
|
|
@@ -658503,23 +659146,23 @@ ${sections.join("\n\n")}`;
|
|
|
658503
659146
|
function adaptTool3(tool) {
|
|
658504
659147
|
return adaptExecutionTool(tool);
|
|
658505
659148
|
}
|
|
658506
|
-
function buildDreamPrompt(mode,
|
|
659149
|
+
function buildDreamPrompt(mode, stage2, cycleNum, totalCycles, previousFindings, dreamsDir) {
|
|
658507
659150
|
const modeDesc = mode === "lucid" ? "LUCID DREAM MODE: You have full implementation capability. After ideation, you will implement, test, and evaluate changes." : mode === "deep" ? "DEEP DREAM MODE: Explore deeply with multiple expansion/contraction cycles. All proposals go in .omnius/dreams/." : "DREAM MODE: Creative exploration only. All output must be written to .omnius/dreams/ directory using file_write.";
|
|
658508
659151
|
const stageInstruction = {
|
|
658509
659152
|
"NREM-1": `LIGHT SCAN (Stage 1/${SLEEP_STAGES.length}): Do a quick scan of the codebase structure. Identify the main files, architecture patterns, and surface-level observations. Note areas that catch your attention. Write a brief scan report.`,
|
|
658510
659153
|
"NREM-2": `PATTERN DETECTION (Stage 2/${SLEEP_STAGES.length}): Look deeper at the patterns you noticed. Identify: technical debt, missing tests, code duplication, potential optimizations, missing features, security concerns, DX improvements. Categorize findings by priority.`,
|
|
658511
659154
|
"NREM-3": `DEEP CONSOLIDATION (Stage 3/${SLEEP_STAGES.length}): Synthesize your findings into concrete, actionable proposals. For each proposal, write: (1) problem statement, (2) proposed solution with implementation plan, (3) estimated effort, (4) expected impact. Create clean entrypoint files.`,
|
|
658512
659155
|
"REM": `CREATIVE EXPANSION (Stage 4/${SLEEP_STAGES.length}): Think boldly and creatively. What novel features could transform this project? Cross-domain inspiration? Unconventional approaches? Generate at least 3 wild ideas alongside 3 practical innovations. Write detailed vision documents.`
|
|
658513
|
-
}[
|
|
659156
|
+
}[stage2.name];
|
|
658514
659157
|
return loadPrompt3("tui/dream-stages.md", {
|
|
658515
659158
|
modeDesc,
|
|
658516
659159
|
cycleNum: String(cycleNum),
|
|
658517
659160
|
totalCycles: String(totalCycles),
|
|
658518
|
-
stageName:
|
|
658519
|
-
stageLabel:
|
|
658520
|
-
stageDescription:
|
|
659161
|
+
stageName: stage2.name,
|
|
659162
|
+
stageLabel: stage2.label,
|
|
659163
|
+
stageDescription: stage2.description,
|
|
658521
659164
|
stageInstruction: stageInstruction || "",
|
|
658522
|
-
stageNameLower:
|
|
659165
|
+
stageNameLower: stage2.name.toLowerCase(),
|
|
658523
659166
|
previousFindings: previousFindings ? `PREVIOUS FINDINGS FROM EARLIER STAGES:
|
|
658524
659167
|
${previousFindings}
|
|
658525
659168
|
` : ""
|
|
@@ -658560,9 +659203,9 @@ function renderDreamStage(name10, label, description) {
|
|
|
658560
659203
|
`);
|
|
658561
659204
|
});
|
|
658562
659205
|
}
|
|
658563
|
-
function renderDreamStageComplete(
|
|
659206
|
+
function renderDreamStageComplete(stage2, durationMs) {
|
|
658564
659207
|
const secs = (durationMs / 1e3).toFixed(1);
|
|
658565
|
-
dreamWrite(() => process.stdout.write(` ${c3.green("✔")} ${
|
|
659208
|
+
dreamWrite(() => process.stdout.write(` ${c3.green("✔")} ${stage2} complete ${c3.dim(`(${secs}s)`)}
|
|
658566
659209
|
`));
|
|
658567
659210
|
}
|
|
658568
659211
|
function renderDreamContraction(cycle) {
|
|
@@ -658909,12 +659552,12 @@ var init_dream_engine = __esm({
|
|
|
658909
659552
|
let previousFindings = "";
|
|
658910
659553
|
const cycleResults = [];
|
|
658911
659554
|
const modelTier2 = getModelTier(this.config.model);
|
|
658912
|
-
for (const
|
|
659555
|
+
for (const stage2 of SLEEP_STAGES) {
|
|
658913
659556
|
if (this.abortController.signal.aborted) break;
|
|
658914
|
-
renderDreamStage(
|
|
659557
|
+
renderDreamStage(stage2.name, stage2.label, stage2.description);
|
|
658915
659558
|
const startMs = Date.now();
|
|
658916
659559
|
let result;
|
|
658917
|
-
if (
|
|
659560
|
+
if (stage2.name === "REM" && modelTier2 === "large" && detectSystemSpecs().gpuVramGB > 0) {
|
|
658918
659561
|
renderInfo("REM: Autoresearch swarm — 5-agent GPU experiment loop (Researcher + Monitor + Evaluator + Critic + Flow Maintainer)");
|
|
658919
659562
|
const swarmResult = await this.runAutoresearchSwarm(
|
|
658920
659563
|
cycle,
|
|
@@ -658922,7 +659565,7 @@ var init_dream_engine = __esm({
|
|
|
658922
659565
|
onEvent
|
|
658923
659566
|
);
|
|
658924
659567
|
result = { summary: swarmResult.summary, turns: 0, toolCalls: 0 };
|
|
658925
|
-
} else if (
|
|
659568
|
+
} else if (stage2.name === "REM" && modelTier2 === "large") {
|
|
658926
659569
|
renderInfo("REM: Multi-agent creative mode — parallel Visionary + Pragmatist + Cross-Pollinator");
|
|
658927
659570
|
const remResult = await this.runMultiAgentREM(
|
|
658928
659571
|
cycle,
|
|
@@ -658935,7 +659578,7 @@ var init_dream_engine = __esm({
|
|
|
658935
659578
|
} else {
|
|
658936
659579
|
const prompt = buildDreamPrompt(
|
|
658937
659580
|
mode,
|
|
658938
|
-
|
|
659581
|
+
stage2,
|
|
658939
659582
|
cycle,
|
|
658940
659583
|
totalCycles,
|
|
658941
659584
|
previousFindings,
|
|
@@ -658950,7 +659593,7 @@ var init_dream_engine = __esm({
|
|
|
658950
659593
|
const durationMs = Date.now() - startMs;
|
|
658951
659594
|
const cycleResult = {
|
|
658952
659595
|
cycle,
|
|
658953
|
-
stage:
|
|
659596
|
+
stage: stage2.name,
|
|
658954
659597
|
ideas: [],
|
|
658955
659598
|
proposals: [],
|
|
658956
659599
|
filesGenerated: [],
|
|
@@ -658958,12 +659601,12 @@ var init_dream_engine = __esm({
|
|
|
658958
659601
|
};
|
|
658959
659602
|
previousFindings += `
|
|
658960
659603
|
|
|
658961
|
-
### ${
|
|
659604
|
+
### ${stage2.label} findings:
|
|
658962
659605
|
${result.summary}`;
|
|
658963
659606
|
cycleResult.ideas.push(result.summary);
|
|
658964
659607
|
cycleResults.push(cycleResult);
|
|
658965
659608
|
this.state.results.push(cycleResult);
|
|
658966
|
-
renderDreamStageComplete(
|
|
659609
|
+
renderDreamStageComplete(stage2.name, durationMs);
|
|
658967
659610
|
}
|
|
658968
659611
|
if (mode !== "default" || cycle === totalCycles) {
|
|
658969
659612
|
renderDreamContraction(cycle);
|
|
@@ -666816,19 +667459,19 @@ function deriveVisualEvidencePlan(request) {
|
|
|
666816
667459
|
}
|
|
666817
667460
|
async function executeVisualEvidencePlan(resolution, plan, executor) {
|
|
666818
667461
|
const stages = [];
|
|
666819
|
-
for (const
|
|
667462
|
+
for (const stage2 of plan.stages) {
|
|
666820
667463
|
const start2 = Date.now();
|
|
666821
667464
|
try {
|
|
666822
|
-
const result = await executor(
|
|
666823
|
-
stages.push({ ...
|
|
667465
|
+
const result = await executor(stage2.kind, resolution.path, "auto");
|
|
667466
|
+
stages.push({ ...stage2, completed: true, output: result.output, durationMs: result.durationMs });
|
|
666824
667467
|
} catch (err) {
|
|
666825
667468
|
stages.push({
|
|
666826
|
-
...
|
|
667469
|
+
...stage2,
|
|
666827
667470
|
completed: false,
|
|
666828
667471
|
error: err instanceof Error ? err.message : String(err),
|
|
666829
667472
|
durationMs: Date.now() - start2
|
|
666830
667473
|
});
|
|
666831
|
-
if (
|
|
667474
|
+
if (stage2.required) break;
|
|
666832
667475
|
}
|
|
666833
667476
|
}
|
|
666834
667477
|
const succeeded = stages.filter((s2) => s2.completed);
|
|
@@ -678194,13 +678837,13 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
|
|
|
678194
678837
|
if (!html) return;
|
|
678195
678838
|
const state = stateFor(toolName);
|
|
678196
678839
|
const now2 = Date.now();
|
|
678197
|
-
const
|
|
678840
|
+
const stage2 = String(event.stage || "process");
|
|
678198
678841
|
const percent = typeof event.percent === "number" && Number.isFinite(event.percent) ? Math.round(event.percent) : void 0;
|
|
678199
|
-
const terminalStage =
|
|
678200
|
-
const shouldRender = state.lastRenderedAt === 0 ||
|
|
678842
|
+
const terminalStage = stage2 === "save" || stage2 === "thumbnail" || stage2 === "hf_token_required";
|
|
678843
|
+
const shouldRender = state.lastRenderedAt === 0 || stage2 !== state.lastStage || typeof percent === "number" && (state.lastPercent === void 0 || Math.abs(percent - state.lastPercent) >= 5) || now2 - state.lastRenderedAt >= 3500 || terminalStage;
|
|
678201
678844
|
if (!shouldRender) return;
|
|
678202
678845
|
state.lastRenderedAt = now2;
|
|
678203
|
-
state.lastStage =
|
|
678846
|
+
state.lastStage = stage2;
|
|
678204
678847
|
state.lastPercent = percent;
|
|
678205
678848
|
enqueue(state, html);
|
|
678206
678849
|
},
|
|
@@ -680203,6 +680846,7 @@ ${conversationStream}`
|
|
|
680203
680846
|
);
|
|
680204
680847
|
const requestTimeoutMs = config.timeoutMs ?? 3e5;
|
|
680205
680848
|
const runner = new AgenticRunner(backend, {
|
|
680849
|
+
surface: isAdminDM || isAdminGroup ? "telegram-admin" : "telegram-public",
|
|
680206
680850
|
// Admin DMs are operator-directed work sessions. A hard turn cap turns
|
|
680207
680851
|
// active tool progress into a false "completed" Telegram panel when the
|
|
680208
680852
|
// model has not reached task_complete yet. Public/group runs stay bounded.
|
|
@@ -690308,7 +690952,7 @@ async function tunnelViaTor(req3) {
|
|
|
690308
690952
|
function openSocks5(targetHost, targetPort, timeoutMs) {
|
|
690309
690953
|
return new Promise((resolve74, reject) => {
|
|
690310
690954
|
const sock = createConnection3({ host: DEFAULT_SOCKS_HOST, port: DEFAULT_SOCKS_PORT });
|
|
690311
|
-
let
|
|
690955
|
+
let stage2 = "greet";
|
|
690312
690956
|
const timer = setTimeout(() => {
|
|
690313
690957
|
try {
|
|
690314
690958
|
sock.destroy(new Error(`Tor SOCKS5 timeout (${timeoutMs}ms)`));
|
|
@@ -690324,7 +690968,7 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
|
|
|
690324
690968
|
sock.write(Buffer.from([5, 1, 0]));
|
|
690325
690969
|
});
|
|
690326
690970
|
sock.on("data", (chunk) => {
|
|
690327
|
-
if (
|
|
690971
|
+
if (stage2 === "greet") {
|
|
690328
690972
|
if (chunk.length < 2 || chunk[0] !== 5 || chunk[1] !== 0) {
|
|
690329
690973
|
clearTimeout(timer);
|
|
690330
690974
|
reject(new Error("Tor SOCKS5: greeting rejected (auth required?)"));
|
|
@@ -690344,10 +690988,10 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
|
|
|
690344
690988
|
hostBuf.copy(buf, 5);
|
|
690345
690989
|
buf.writeUInt16BE(targetPort, 5 + hostBuf.length);
|
|
690346
690990
|
sock.write(buf);
|
|
690347
|
-
|
|
690991
|
+
stage2 = "connect";
|
|
690348
690992
|
return;
|
|
690349
690993
|
}
|
|
690350
|
-
if (
|
|
690994
|
+
if (stage2 === "connect") {
|
|
690351
690995
|
if (chunk.length < 2 || chunk[0] !== 5) {
|
|
690352
690996
|
clearTimeout(timer);
|
|
690353
690997
|
reject(new Error("Tor SOCKS5: malformed CONNECT reply"));
|
|
@@ -690368,7 +691012,7 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
|
|
|
690368
691012
|
return;
|
|
690369
691013
|
}
|
|
690370
691014
|
clearTimeout(timer);
|
|
690371
|
-
|
|
691015
|
+
stage2 = "ready";
|
|
690372
691016
|
resolve74(sock);
|
|
690373
691017
|
}
|
|
690374
691018
|
});
|
|
@@ -717159,6 +717803,7 @@ Bypass for special cases: set env OMNIUS_DISABLE_TASK_COMPLETE_BUILD_GUARD=1 (no
|
|
|
717159
717803
|
}
|
|
717160
717804
|
function wireAgentToolMinimal(tool, config, repoRoot) {
|
|
717161
717805
|
const typeRegistry = getAgentTypeRegistry();
|
|
717806
|
+
const patternRegistry = getAgentDeploymentPatternRegistry();
|
|
717162
717807
|
const allToolNames = [
|
|
717163
717808
|
"file_read",
|
|
717164
717809
|
"file_write",
|
|
@@ -717192,6 +717837,27 @@ function wireAgentToolMinimal(tool, config, repoRoot) {
|
|
|
717192
717837
|
};
|
|
717193
717838
|
},
|
|
717194
717839
|
listTypes: () => typeRegistry.listTypes(),
|
|
717840
|
+
resolveDeploymentPattern: (patternName, task) => {
|
|
717841
|
+
const plan = patternRegistry.plan(patternName, task);
|
|
717842
|
+
if (!plan) return void 0;
|
|
717843
|
+
return {
|
|
717844
|
+
pattern: plan.pattern,
|
|
717845
|
+
topology: plan.topology,
|
|
717846
|
+
description: plan.description,
|
|
717847
|
+
coordinatorRequired: plan.coordinatorRequired,
|
|
717848
|
+
instructions: plan.instructions,
|
|
717849
|
+
stages: plan.stages.map((stage2) => ({
|
|
717850
|
+
id: stage2.id,
|
|
717851
|
+
label: stage2.label,
|
|
717852
|
+
agentType: stage2.agentType,
|
|
717853
|
+
mode: stage2.mode,
|
|
717854
|
+
order: stage2.order,
|
|
717855
|
+
...stage2.parallelGroup ? { parallelGroup: stage2.parallelGroup } : {},
|
|
717856
|
+
...stage2.dependsOn ? { dependsOn: stage2.dependsOn } : {}
|
|
717857
|
+
}))
|
|
717858
|
+
};
|
|
717859
|
+
},
|
|
717860
|
+
listDeploymentPatterns: () => patternRegistry.listPatterns(),
|
|
717195
717861
|
spawnInProcess: async (opts) => {
|
|
717196
717862
|
let backend;
|
|
717197
717863
|
if (config.backendType === "nexus") {
|
|
@@ -719068,6 +719734,7 @@ Only tools allowed by this profile are visible and executable.`
|
|
|
719068
719734
|
].filter(Boolean).join("");
|
|
719069
719735
|
}
|
|
719070
719736
|
const runner = new AgenticRunner(backend, {
|
|
719737
|
+
surface: "tui",
|
|
719071
719738
|
maxTurns: realtimeEnabled ? Math.min(effectiveMaxTurns, 8) : effectiveMaxTurns,
|
|
719072
719739
|
maxTokens: realtimeEnabled ? 512 : 16384,
|
|
719073
719740
|
temperature: realtimeEnabled ? 0.6 : 0,
|
|
@@ -721260,6 +721927,7 @@ Review its full output via sub_agent(action='output', id='${id}')`
|
|
|
721260
721927
|
};
|
|
721261
721928
|
_wireAgentToolCallbacks = (tool) => {
|
|
721262
721929
|
const typeRegistry = getAgentTypeRegistry();
|
|
721930
|
+
const patternRegistry = getAgentDeploymentPatternRegistry();
|
|
721263
721931
|
const allToolNames = [
|
|
721264
721932
|
"file_read",
|
|
721265
721933
|
"file_write",
|
|
@@ -721299,6 +721967,27 @@ Review its full output via sub_agent(action='output', id='${id}')`
|
|
|
721299
721967
|
};
|
|
721300
721968
|
},
|
|
721301
721969
|
listTypes: () => typeRegistry.listTypes(),
|
|
721970
|
+
resolveDeploymentPattern: (patternName, task) => {
|
|
721971
|
+
const plan = patternRegistry.plan(patternName, task);
|
|
721972
|
+
if (!plan) return void 0;
|
|
721973
|
+
return {
|
|
721974
|
+
pattern: plan.pattern,
|
|
721975
|
+
topology: plan.topology,
|
|
721976
|
+
description: plan.description,
|
|
721977
|
+
coordinatorRequired: plan.coordinatorRequired,
|
|
721978
|
+
instructions: plan.instructions,
|
|
721979
|
+
stages: plan.stages.map((stage2) => ({
|
|
721980
|
+
id: stage2.id,
|
|
721981
|
+
label: stage2.label,
|
|
721982
|
+
agentType: stage2.agentType,
|
|
721983
|
+
mode: stage2.mode,
|
|
721984
|
+
order: stage2.order,
|
|
721985
|
+
...stage2.parallelGroup ? { parallelGroup: stage2.parallelGroup } : {},
|
|
721986
|
+
...stage2.dependsOn ? { dependsOn: stage2.dependsOn } : {}
|
|
721987
|
+
}))
|
|
721988
|
+
};
|
|
721989
|
+
},
|
|
721990
|
+
listDeploymentPatterns: () => patternRegistry.listPatterns(),
|
|
721302
721991
|
spawnInProcess: async (opts) => {
|
|
721303
721992
|
let backend;
|
|
721304
721993
|
if (config.backendType === "nexus") {
|
|
@@ -722040,6 +722729,7 @@ Respond to the scoped Telegram target when complete.`
|
|
|
722040
722729
|
}
|
|
722041
722730
|
const modelTier2 = getModelTier(currentConfig.model);
|
|
722042
722731
|
const runner = new AgenticRunner(backend, {
|
|
722732
|
+
surface: "background",
|
|
722043
722733
|
// 0 = unlimited; halt only on task_complete or abort. Background
|
|
722044
722734
|
// prompts may legitimately need many turns; an arbitrary cap stalls
|
|
722045
722735
|
// them mid-task.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.384",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.384",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED