omnius 1.0.382 → 1.0.383

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 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(stage) {
20361
- return { ...STAGE_THRESHOLDS[stage] };
20397
+ function thresholdsForStage(stage2) {
20398
+ return { ...STAGE_THRESHOLDS[stage2] };
20362
20399
  }
20363
- function characteristicsForStage(stage) {
20364
- return { ...STAGE_CHARACTERISTICS[stage] };
20400
+ function characteristicsForStage(stage2) {
20401
+ return { ...STAGE_CHARACTERISTICS[stage2] };
20365
20402
  }
20366
20403
  function report(metrics2) {
20367
- const stage = detectStage(metrics2);
20368
- const thresholds = thresholdsForStage(stage);
20369
- const characteristics = characteristicsForStage(stage);
20370
- const nextStage = computeNextStage(stage, metrics2);
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 stage = options2.initialStage ?? "exploration";
21855
+ const stage2 = options2.initialStage ?? "exploration";
21819
21856
  this.current = {
21820
- stage,
21821
- thresholds: thresholdsForStage(stage),
21822
- characteristics: characteristicsForStage(stage),
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 stage = String(parsed["stage"] ?? "process");
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, stage) => {
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 stage = String(parsed["stage"] ?? "process");
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, stage, message2, percent) {
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 subagentType = String(args["subagent_type"] ?? "general");
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) {
@@ -572960,11 +573025,11 @@ ${parts.join("\n")}
572960
573025
  }
572961
573026
  return "unknown";
572962
573027
  }
572963
- _recordContextWindowDump(stage, request, turn, attempt) {
573028
+ _recordContextWindowDump(stage2, request, turn, attempt) {
572964
573029
  const agentType = this.options.artifactMode === "internal" ? "internal" : this.options.subAgent || this.options.recursionDepth > 0 ? "sub-agent" : "main";
572965
573030
  const record = recordContextWindowDump({
572966
573031
  source: "agenticRunner",
572967
- stage,
573032
+ stage: stage2,
572968
573033
  agentType,
572969
573034
  sessionId: this._sessionId,
572970
573035
  runId: this._sessionId,
@@ -592957,6 +593022,565 @@ var init_agent_types = __esm({
592957
593022
  }
592958
593023
  });
592959
593024
 
593025
+ // packages/orchestrator/dist/agent-patterns.js
593026
+ function stage(input) {
593027
+ return { required: true, ...input };
593028
+ }
593029
+ function buildDeploymentPatternInstructions(def, stages, task) {
593030
+ const lines = [
593031
+ "[Sub-Agent Deployment Pattern]",
593032
+ `pattern: ${def.pattern}`,
593033
+ `topology: ${def.topology}`,
593034
+ `task: ${task}`,
593035
+ `coordinator_required: ${def.coordinatorRequired}`,
593036
+ `max_agents: ${def.maxAgents}`,
593037
+ "",
593038
+ "Use this pattern only because the task needs specialization, isolation, parallelism, critique, or dynamic decomposition.",
593039
+ def.systemPromptAddition,
593040
+ "",
593041
+ "Stages:"
593042
+ ];
593043
+ for (const s2 of stages) {
593044
+ lines.push(`${s2.order}. ${s2.id} — ${s2.label}`, ` agent_type: ${s2.agentType}`, ` mode: ${s2.mode}${s2.parallelGroup ? ` (${s2.parallelGroup})` : ""}`, ` purpose: ${s2.purpose}`);
593045
+ if (s2.dependsOn?.length)
593046
+ lines.push(` depends_on: ${s2.dependsOn.join(", ")}`);
593047
+ lines.push(" output_contract:");
593048
+ for (const item of s2.outputContract)
593049
+ lines.push(` - ${item}`);
593050
+ }
593051
+ 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.");
593052
+ return lines.join("\n");
593053
+ }
593054
+ function getAgentDeploymentPatternRegistry() {
593055
+ return _patternRegistry;
593056
+ }
593057
+ function registerAgentDeploymentPattern(def) {
593058
+ _patternRegistry.register(def);
593059
+ }
593060
+ function getAgentDeploymentPattern(pattern) {
593061
+ return _patternRegistry.get(pattern);
593062
+ }
593063
+ function planAgentDeploymentPattern(pattern, task) {
593064
+ return _patternRegistry.plan(pattern, task);
593065
+ }
593066
+ function buildAgentDeploymentPatternSummary() {
593067
+ return _patternRegistry.buildPatternSummary();
593068
+ }
593069
+ var BUILT_INS, AgentDeploymentPatternRegistry, _patternRegistry;
593070
+ var init_agent_patterns = __esm({
593071
+ "packages/orchestrator/dist/agent-patterns.js"() {
593072
+ "use strict";
593073
+ init_agent_types();
593074
+ BUILT_INS = [
593075
+ {
593076
+ pattern: "single_worker",
593077
+ aliases: ["single", "direct_worker"],
593078
+ description: "One bounded worker owns the delegated task.",
593079
+ topology: "single",
593080
+ useWhen: ["The task is narrow enough for one context window."],
593081
+ avoidWhen: ["Independent critique, parallel search, or separate permissions are required."],
593082
+ coordinatorRequired: false,
593083
+ maxAgents: 1,
593084
+ systemPromptAddition: "Use the least autonomous design: one focused worker, scoped evidence, then task_complete.",
593085
+ stages: [
593086
+ stage({
593087
+ id: "worker",
593088
+ label: "Focused worker",
593089
+ agentType: "general",
593090
+ purpose: "Complete the delegated task inside one scoped context.",
593091
+ order: 1,
593092
+ mode: "sequential",
593093
+ outputContract: ["Summary of changes or findings", "Verification evidence", "Open blockers"]
593094
+ })
593095
+ ]
593096
+ },
593097
+ {
593098
+ pattern: "sequential_pipeline",
593099
+ aliases: ["pipeline", "planner_executor_reporter"],
593100
+ description: "Fixed-order handoff where each stage validates and passes compact output forward.",
593101
+ topology: "sequential",
593102
+ useWhen: ["The workflow order is known and each handoff can be validated."],
593103
+ avoidWhen: ["Stages are independent and should run in parallel."],
593104
+ coordinatorRequired: true,
593105
+ maxAgents: 3,
593106
+ systemPromptAddition: "Run a fixed sequence. Do not skip handoff validation between stages.",
593107
+ stages: [
593108
+ stage({
593109
+ id: "plan",
593110
+ label: "Planner",
593111
+ agentType: "plan",
593112
+ purpose: "Produce a compact implementation or investigation plan.",
593113
+ order: 1,
593114
+ mode: "sequential",
593115
+ outputContract: ["Concrete steps", "Files or systems to inspect", "Verification plan"]
593116
+ }),
593117
+ stage({
593118
+ id: "execute",
593119
+ label: "Executor",
593120
+ agentType: "general",
593121
+ purpose: "Execute the approved plan.",
593122
+ order: 2,
593123
+ mode: "sequential",
593124
+ dependsOn: ["plan"],
593125
+ outputContract: ["Work performed", "Files modified", "Commands/tests run"]
593126
+ }),
593127
+ stage({
593128
+ id: "report",
593129
+ label: "Reporter",
593130
+ agentType: "explore",
593131
+ purpose: "Check resulting evidence and summarize final state.",
593132
+ order: 3,
593133
+ mode: "review",
593134
+ dependsOn: ["execute"],
593135
+ outputContract: ["Evidence-backed result", "Residual risks", "Suggested next steps"]
593136
+ })
593137
+ ]
593138
+ },
593139
+ {
593140
+ pattern: "parallel_analysis",
593141
+ aliases: ["concurrent_analysis", "sectioning"],
593142
+ description: "Run independent specialists in parallel and aggregate disagreements explicitly.",
593143
+ topology: "parallel",
593144
+ useWhen: ["Independent perspectives or code regions can be analyzed separately."],
593145
+ avoidWhen: ["Workers must mutate the same files without a merge owner."],
593146
+ coordinatorRequired: true,
593147
+ maxAgents: 5,
593148
+ systemPromptAddition: "Launch independent read-only or scoped workers in parallel, then aggregate explicitly.",
593149
+ stages: [
593150
+ stage({
593151
+ id: "explorer_a",
593152
+ label: "Explorer A",
593153
+ agentType: "explore",
593154
+ purpose: "Inspect the first region or perspective.",
593155
+ order: 1,
593156
+ mode: "parallel",
593157
+ parallelGroup: "analysis",
593158
+ outputContract: ["Findings", "Source paths", "Confidence"]
593159
+ }),
593160
+ stage({
593161
+ id: "explorer_b",
593162
+ label: "Explorer B",
593163
+ agentType: "explore",
593164
+ purpose: "Inspect the second region or perspective.",
593165
+ order: 1,
593166
+ mode: "parallel",
593167
+ parallelGroup: "analysis",
593168
+ outputContract: ["Findings", "Source paths", "Confidence"]
593169
+ }),
593170
+ stage({
593171
+ id: "aggregate",
593172
+ label: "Aggregator",
593173
+ agentType: "plan",
593174
+ purpose: "Merge findings, preserve disagreements, and recommend next action.",
593175
+ order: 2,
593176
+ mode: "aggregate",
593177
+ dependsOn: ["explorer_a", "explorer_b"],
593178
+ outputContract: ["Merged conclusion", "Disagreements", "Evidence list"]
593179
+ })
593180
+ ]
593181
+ },
593182
+ {
593183
+ pattern: "scatter_gather",
593184
+ aliases: ["map_reduce", "fanout_reduce"],
593185
+ description: "Fan out over many files/regions, then reduce into one compact result.",
593186
+ topology: "scatter_gather",
593187
+ useWhen: ["The input corpus is too large for one context window."],
593188
+ avoidWhen: ["Only one or two files are relevant."],
593189
+ coordinatorRequired: true,
593190
+ maxAgents: 8,
593191
+ systemPromptAddition: "Partition by source/region, require provenance from every mapper, then reduce deterministically.",
593192
+ stages: [
593193
+ stage({
593194
+ id: "map",
593195
+ label: "Mapper workers",
593196
+ agentType: "explore",
593197
+ purpose: "Process assigned partitions independently.",
593198
+ order: 1,
593199
+ mode: "parallel",
593200
+ parallelGroup: "map",
593201
+ outputContract: ["Partition id", "Relevant paths", "Distilled findings"]
593202
+ }),
593203
+ stage({
593204
+ id: "reduce",
593205
+ label: "Reducer",
593206
+ agentType: "plan",
593207
+ purpose: "Dedupe and synthesize mapper outputs.",
593208
+ order: 2,
593209
+ mode: "aggregate",
593210
+ dependsOn: ["map"],
593211
+ outputContract: ["Deduped paths", "Synthesis", "Empty partitions"]
593212
+ })
593213
+ ]
593214
+ },
593215
+ {
593216
+ pattern: "orchestrator_workers",
593217
+ aliases: ["manager_workers", "manager_agents_as_tools"],
593218
+ description: "A coordinator decomposes unknown subtasks and owns final synthesis.",
593219
+ topology: "orchestrator_workers",
593220
+ useWhen: ["Subtasks are not fully known upfront."],
593221
+ avoidWhen: ["The task can be expressed as a fixed sequence."],
593222
+ coordinatorRequired: true,
593223
+ maxAgents: 6,
593224
+ systemPromptAddition: "The coordinator owns decomposition, worker scope, progress ledger, and final synthesis.",
593225
+ stages: [
593226
+ stage({
593227
+ id: "coordinate",
593228
+ label: "Coordinator",
593229
+ agentType: "coordinator",
593230
+ purpose: "Maintain task ledger and dispatch narrow workers.",
593231
+ order: 1,
593232
+ mode: "coordinate",
593233
+ outputContract: ["Task ledger", "Worker assignments", "Completion criteria"]
593234
+ }),
593235
+ stage({
593236
+ id: "workers",
593237
+ label: "Workers",
593238
+ agentType: "general",
593239
+ purpose: "Execute scoped subtasks assigned by the coordinator.",
593240
+ order: 2,
593241
+ mode: "parallel",
593242
+ dependsOn: ["coordinate"],
593243
+ outputContract: ["Scoped result", "Files touched", "Verification evidence"]
593244
+ })
593245
+ ]
593246
+ },
593247
+ {
593248
+ pattern: "maker_checker",
593249
+ aliases: ["make_check", "generator_reviewer"],
593250
+ description: "One worker produces, an independent checker validates before completion.",
593251
+ topology: "maker_checker",
593252
+ useWhen: ["Quality, policy, or correctness needs an independent review."],
593253
+ avoidWhen: ["There is no clear checkable output."],
593254
+ coordinatorRequired: true,
593255
+ maxAgents: 2,
593256
+ systemPromptAddition: "Keep maker and checker independent. Prefer deterministic tests over model judgment when available.",
593257
+ stages: [
593258
+ stage({
593259
+ id: "maker",
593260
+ label: "Maker",
593261
+ agentType: "general",
593262
+ purpose: "Implement or draft the requested artifact.",
593263
+ order: 1,
593264
+ mode: "sequential",
593265
+ outputContract: ["Produced artifact", "Implementation notes", "Verification run"]
593266
+ }),
593267
+ stage({
593268
+ id: "checker",
593269
+ label: "Checker",
593270
+ agentType: "explore",
593271
+ purpose: "Validate the maker output without sharing the maker prompt as hidden state.",
593272
+ order: 2,
593273
+ mode: "review",
593274
+ dependsOn: ["maker"],
593275
+ outputContract: ["Pass/fail", "Findings with evidence", "Required fixes"]
593276
+ })
593277
+ ]
593278
+ },
593279
+ {
593280
+ pattern: "debate_review",
593281
+ aliases: ["adversarial_review", "debate"],
593282
+ description: "Assign competing positions, then synthesize with evidence.",
593283
+ topology: "debate",
593284
+ useWhen: ["The decision is ambiguous or confirmation bias is likely."],
593285
+ avoidWhen: ["The task is a straightforward implementation with objective tests."],
593286
+ coordinatorRequired: true,
593287
+ maxAgents: 4,
593288
+ systemPromptAddition: "Assign explicit positions, require evidence for claims, then synthesize neutrally.",
593289
+ stages: [
593290
+ stage({
593291
+ id: "pro",
593292
+ label: "Pro advocate",
593293
+ agentType: "plan",
593294
+ purpose: "Argue for the proposed approach using evidence.",
593295
+ order: 1,
593296
+ mode: "parallel",
593297
+ parallelGroup: "debate",
593298
+ outputContract: ["Argument", "Evidence", "Assumptions"]
593299
+ }),
593300
+ stage({
593301
+ id: "con",
593302
+ label: "Risk advocate",
593303
+ agentType: "plan",
593304
+ purpose: "Argue against the proposed approach and surface risks.",
593305
+ order: 1,
593306
+ mode: "parallel",
593307
+ parallelGroup: "debate",
593308
+ outputContract: ["Counterargument", "Evidence", "Risks"]
593309
+ }),
593310
+ stage({
593311
+ id: "synthesis",
593312
+ label: "Neutral synthesizer",
593313
+ agentType: "plan",
593314
+ purpose: "Resolve the debate and state the decision criteria.",
593315
+ order: 2,
593316
+ mode: "aggregate",
593317
+ dependsOn: ["pro", "con"],
593318
+ outputContract: ["Decision", "Tradeoffs", "Dissent preserved"]
593319
+ })
593320
+ ]
593321
+ },
593322
+ {
593323
+ pattern: "specialist_committee",
593324
+ aliases: ["committee", "aggregator"],
593325
+ description: "Domain specialists produce findings; an aggregator preserves evidence and dissent.",
593326
+ topology: "committee",
593327
+ useWhen: ["The problem spans multiple domains or risk lenses."],
593328
+ avoidWhen: ["The domain is singular and objective tests are available."],
593329
+ coordinatorRequired: true,
593330
+ maxAgents: 6,
593331
+ systemPromptAddition: "Specialists must state assumptions, evidence, uncertainty, and dissent.",
593332
+ stages: [
593333
+ stage({
593334
+ id: "technical",
593335
+ label: "Technical specialist",
593336
+ agentType: "general",
593337
+ purpose: "Assess implementation feasibility and constraints.",
593338
+ order: 1,
593339
+ mode: "parallel",
593340
+ parallelGroup: "committee",
593341
+ outputContract: ["Technical findings", "Evidence", "Uncertainty"]
593342
+ }),
593343
+ stage({
593344
+ id: "risk",
593345
+ label: "Risk specialist",
593346
+ agentType: "explore",
593347
+ purpose: "Assess safety, operational, or regression risks.",
593348
+ order: 1,
593349
+ mode: "parallel",
593350
+ parallelGroup: "committee",
593351
+ outputContract: ["Risks", "Evidence", "Mitigations"]
593352
+ }),
593353
+ stage({
593354
+ id: "aggregate",
593355
+ label: "Aggregator",
593356
+ agentType: "plan",
593357
+ purpose: "Synthesize specialist findings and preserve disagreements.",
593358
+ order: 2,
593359
+ mode: "aggregate",
593360
+ dependsOn: ["technical", "risk"],
593361
+ outputContract: ["Synthesis", "Dissent", "Recommendation"]
593362
+ })
593363
+ ]
593364
+ },
593365
+ {
593366
+ pattern: "hierarchical_crew",
593367
+ aliases: ["crew", "multi_team"],
593368
+ description: "A coordinator manages subcrews for large multi-domain work.",
593369
+ topology: "hierarchical",
593370
+ useWhen: ["The task is large, multi-domain, and decomposable."],
593371
+ avoidWhen: ["A flat worker set is enough."],
593372
+ coordinatorRequired: true,
593373
+ maxAgents: 10,
593374
+ systemPromptAddition: "Define hierarchy, responsibilities, checkpoints, and stop conditions before spawning subcrews.",
593375
+ stages: [
593376
+ stage({
593377
+ id: "lead",
593378
+ label: "Crew lead",
593379
+ agentType: "coordinator",
593380
+ purpose: "Own hierarchy, checkpoints, and final integration.",
593381
+ order: 1,
593382
+ mode: "coordinate",
593383
+ outputContract: ["Hierarchy", "Responsibilities", "Checkpoints"]
593384
+ }),
593385
+ stage({
593386
+ id: "subcrews",
593387
+ label: "Subcrew workers",
593388
+ agentType: "general",
593389
+ purpose: "Execute scoped domain work under the lead.",
593390
+ order: 2,
593391
+ mode: "parallel",
593392
+ dependsOn: ["lead"],
593393
+ outputContract: ["Domain result", "Verification", "Blockers"]
593394
+ })
593395
+ ]
593396
+ },
593397
+ {
593398
+ pattern: "blackboard",
593399
+ aliases: ["shared_workspace"],
593400
+ description: "Workers coordinate through a structured shared artifact.",
593401
+ topology: "blackboard",
593402
+ useWhen: ["Multiple agents must update a common evolving state."],
593403
+ avoidWhen: ["Workers can return independent final outputs without coordination."],
593404
+ coordinatorRequired: true,
593405
+ maxAgents: 6,
593406
+ systemPromptAddition: "Use a structured blackboard with author, timestamp, source, confidence, and conflict fields.",
593407
+ stages: [
593408
+ stage({
593409
+ id: "board_init",
593410
+ label: "Board initializer",
593411
+ agentType: "plan",
593412
+ purpose: "Create the shared artifact schema and initial task lanes.",
593413
+ order: 1,
593414
+ mode: "sequential",
593415
+ outputContract: ["Board schema", "Task lanes", "Conflict policy"]
593416
+ }),
593417
+ stage({
593418
+ id: "contributors",
593419
+ label: "Contributors",
593420
+ agentType: "general",
593421
+ purpose: "Write structured entries to the board without conflicting writes.",
593422
+ order: 2,
593423
+ mode: "parallel",
593424
+ dependsOn: ["board_init"],
593425
+ outputContract: ["Board entries", "Sources", "Confidence"]
593426
+ })
593427
+ ]
593428
+ },
593429
+ {
593430
+ pattern: "task_swarm",
593431
+ aliases: ["swarm"],
593432
+ description: "Many small stateless workers process granular queued tasks.",
593433
+ topology: "swarm",
593434
+ useWhen: ["The workload is large, partitionable, and homogeneous."],
593435
+ avoidWhen: ["Workers need shared mutable state or nuanced coordination."],
593436
+ coordinatorRequired: true,
593437
+ maxAgents: 12,
593438
+ systemPromptAddition: "Keep swarm workers stateless, cap fan-out, aggregate deterministically, and monitor cost.",
593439
+ stages: [
593440
+ stage({
593441
+ id: "queue",
593442
+ label: "Queue planner",
593443
+ agentType: "plan",
593444
+ purpose: "Partition work into small independent units.",
593445
+ order: 1,
593446
+ mode: "sequential",
593447
+ outputContract: ["Queue entries", "Unit success criteria", "Fan-out cap"]
593448
+ }),
593449
+ stage({
593450
+ id: "workers",
593451
+ label: "Swarm workers",
593452
+ agentType: "explore",
593453
+ purpose: "Process assigned units independently.",
593454
+ order: 2,
593455
+ mode: "parallel",
593456
+ dependsOn: ["queue"],
593457
+ outputContract: ["Unit id", "Result", "Failure reason"]
593458
+ })
593459
+ ]
593460
+ },
593461
+ {
593462
+ pattern: "dynamic_task_ledger",
593463
+ aliases: ["magentic", "dynamic_ledger", "replan_ledger"],
593464
+ description: "Maintain a visible task ledger while planning, executing, observing, and replanning.",
593465
+ topology: "dynamic_ledger",
593466
+ useWhen: ["The solution path is unknown and must adapt to observations."],
593467
+ avoidWhen: ["A fixed pipeline or one worker can solve the task."],
593468
+ coordinatorRequired: true,
593469
+ maxAgents: 8,
593470
+ systemPromptAddition: "Maintain a visible task/progress ledger with success criteria, completed work, blockers, and replan reasons.",
593471
+ stages: [
593472
+ stage({
593473
+ id: "ledger",
593474
+ label: "Ledger coordinator",
593475
+ agentType: "coordinator",
593476
+ purpose: "Maintain task decomposition and reconfigure subtasks as evidence arrives.",
593477
+ order: 1,
593478
+ mode: "coordinate",
593479
+ outputContract: ["Current ledger", "Success criteria", "Replan reasons"]
593480
+ }),
593481
+ stage({
593482
+ id: "workers",
593483
+ label: "Adaptive workers",
593484
+ agentType: "general",
593485
+ purpose: "Execute current ledger items and return evidence.",
593486
+ order: 2,
593487
+ mode: "parallel",
593488
+ dependsOn: ["ledger"],
593489
+ outputContract: ["Ledger item id", "Evidence", "Blockers"]
593490
+ }),
593491
+ stage({
593492
+ id: "verify",
593493
+ label: "Verifier",
593494
+ agentType: "explore",
593495
+ purpose: "Verify completed ledger items before final synthesis.",
593496
+ order: 3,
593497
+ mode: "review",
593498
+ dependsOn: ["workers"],
593499
+ outputContract: ["Verified items", "Rejected claims", "Remaining work"]
593500
+ })
593501
+ ]
593502
+ }
593503
+ ];
593504
+ AgentDeploymentPatternRegistry = class {
593505
+ patterns = /* @__PURE__ */ new Map();
593506
+ aliases = /* @__PURE__ */ new Map();
593507
+ constructor() {
593508
+ for (const def of BUILT_INS)
593509
+ this.register(def);
593510
+ }
593511
+ register(def) {
593512
+ this.validate(def);
593513
+ this.patterns.set(def.pattern, def);
593514
+ this.aliases.set(def.pattern, def.pattern);
593515
+ for (const alias of def.aliases ?? [])
593516
+ this.aliases.set(alias, def.pattern);
593517
+ }
593518
+ get(pattern) {
593519
+ const canonical = this.aliases.get(pattern) ?? pattern;
593520
+ return this.patterns.get(canonical);
593521
+ }
593522
+ listPatterns() {
593523
+ return Array.from(this.patterns.keys());
593524
+ }
593525
+ listDefinitions() {
593526
+ return Array.from(this.patterns.values());
593527
+ }
593528
+ plan(pattern, task) {
593529
+ const def = this.get(pattern);
593530
+ if (!def)
593531
+ return void 0;
593532
+ const typeRegistry = getAgentTypeRegistry();
593533
+ const stages = def.stages.slice().sort((a2, b) => a2.order - b.order || a2.id.localeCompare(b.id)).map((s2) => ({
593534
+ ...s2,
593535
+ agentTypeDescription: typeRegistry.get(s2.agentType)?.description ?? "Unknown agent type"
593536
+ }));
593537
+ return {
593538
+ pattern: def.pattern,
593539
+ topology: def.topology,
593540
+ description: def.description,
593541
+ coordinatorRequired: def.coordinatorRequired,
593542
+ task,
593543
+ stages,
593544
+ instructions: buildDeploymentPatternInstructions(def, stages, task)
593545
+ };
593546
+ }
593547
+ buildPatternSummary() {
593548
+ const lines = ["Available sub-agent deployment patterns:"];
593549
+ for (const def of this.patterns.values()) {
593550
+ lines.push(`- ${def.pattern} (${def.topology}): ${def.description} Use when: ${def.useWhen[0] ?? "structurally justified"}`);
593551
+ }
593552
+ return lines.join("\n");
593553
+ }
593554
+ validate(def) {
593555
+ if (!def.pattern.trim())
593556
+ throw new Error("pattern id is required");
593557
+ if (!def.stages.length)
593558
+ throw new Error(`pattern ${def.pattern} must define at least one stage`);
593559
+ const typeRegistry = getAgentTypeRegistry();
593560
+ const ids = /* @__PURE__ */ new Set();
593561
+ for (const s2 of def.stages) {
593562
+ if (!s2.id.trim())
593563
+ throw new Error(`pattern ${def.pattern} has a stage without id`);
593564
+ if (ids.has(s2.id))
593565
+ throw new Error(`pattern ${def.pattern} repeats stage id ${s2.id}`);
593566
+ ids.add(s2.id);
593567
+ if (!typeRegistry.get(s2.agentType)) {
593568
+ throw new Error(`pattern ${def.pattern} references unknown agent type ${s2.agentType}`);
593569
+ }
593570
+ for (const dep of s2.dependsOn ?? []) {
593571
+ if (!def.stages.some((candidate) => candidate.id === dep)) {
593572
+ throw new Error(`pattern ${def.pattern} stage ${s2.id} depends on unknown stage ${dep}`);
593573
+ }
593574
+ }
593575
+ }
593576
+ if (def.maxAgents < 1)
593577
+ throw new Error(`pattern ${def.pattern} maxAgents must be positive`);
593578
+ }
593579
+ };
593580
+ _patternRegistry = new AgentDeploymentPatternRegistry();
593581
+ }
593582
+ });
593583
+
592960
593584
  // packages/orchestrator/dist/agent-task.js
592961
593585
  function isTerminalTaskStatus(status) {
592962
593586
  return status === "completed" || status === "failed" || status === "killed";
@@ -596208,6 +596832,7 @@ var init_conversational_scrutiny = __esm({
596208
596832
  var dist_exports3 = {};
596209
596833
  __export(dist_exports3, {
596210
596834
  AGENT_DISALLOWED_TOOLS: () => AGENT_DISALLOWED_TOOLS,
596835
+ AgentDeploymentPatternRegistry: () => AgentDeploymentPatternRegistry,
596211
596836
  AgentLoop: () => AgentLoop,
596212
596837
  AgentTaskManager: () => AgentTaskManager,
596213
596838
  AgentTypeRegistry: () => AgentTypeRegistry,
@@ -596263,6 +596888,7 @@ __export(dist_exports3, {
596263
596888
  arcSummary: () => arcSummary,
596264
596889
  auditCompletionClaims: () => auditCompletionClaims,
596265
596890
  auditPerceptionClaims: () => auditPerceptionClaims,
596891
+ buildAgentDeploymentPatternSummary: () => buildAgentDeploymentPatternSummary,
596266
596892
  buildAgentNotification: () => buildAgentNotification,
596267
596893
  buildAgentTypeSummary: () => buildAgentTypeSummary,
596268
596894
  buildCompletionScenarioDecomposition: () => buildCompletionScenarioDecomposition,
@@ -596342,6 +596968,8 @@ __export(dist_exports3, {
596342
596968
  generateUserTestingResult: () => generateUserTestingResult,
596343
596969
  generateUserTestingValidatorSkill: () => generateUserTestingValidatorSkill,
596344
596970
  generateWorkerSkillTemplate: () => generateWorkerSkillTemplate,
596971
+ getAgentDeploymentPattern: () => getAgentDeploymentPattern,
596972
+ getAgentDeploymentPatternRegistry: () => getAgentDeploymentPatternRegistry,
596345
596973
  getAgentType: () => getAgentType,
596346
596974
  getAgentTypeRegistry: () => getAgentTypeRegistry,
596347
596975
  getAllDefaultPricing: () => getAllDefaultPricing,
@@ -596394,6 +597022,7 @@ __export(dist_exports3, {
596394
597022
  parseTextToolCalls: () => parseTextToolCalls,
596395
597023
  partitionToolCalls: () => partitionToolCalls,
596396
597024
  persistAgentTaskSidecar: () => persistAgentTaskSidecar,
597025
+ planAgentDeploymentPattern: () => planAgentDeploymentPattern,
596397
597026
  planConsolidation: () => planConsolidation,
596398
597027
  preprocessContextReferences: () => preprocessContextReferences,
596399
597028
  pressureCheck: () => pressureCheck,
@@ -596421,6 +597050,7 @@ __export(dist_exports3, {
596421
597050
  recordToolDecision: () => recordToolDecision,
596422
597051
  recordToolEvidence: () => recordToolEvidence,
596423
597052
  recordToolExecution: () => recordToolExecution,
597053
+ registerAgentDeploymentPattern: () => registerAgentDeploymentPattern,
596424
597054
  registerAgentType: () => registerAgentType,
596425
597055
  registerCommand: () => registerCommand,
596426
597056
  registerHookHandler: () => registerHookHandler,
@@ -596515,6 +597145,7 @@ var init_dist8 = __esm({
596515
597145
  init_stability_tracker();
596516
597146
  init_render_decision();
596517
597147
  init_agent_types();
597148
+ init_agent_patterns();
596518
597149
  init_agent_task();
596519
597150
  init_task_recovery();
596520
597151
  init_coordinator();
@@ -596653,7 +597284,7 @@ function generationKindForToolName(toolName) {
596653
597284
  function formatGenerativeProgress(kind, event, options2 = {}) {
596654
597285
  const width = Math.max(8, Math.min(32, options2.width ?? (options2.surface === "telegram" ? 12 : 20)));
596655
597286
  const label = kindLabel2(kind);
596656
- const stage = stageLabel(event.stage);
597287
+ const stage2 = stageLabel(event.stage);
596657
597288
  const pct = finitePercent(event.percent);
596658
597289
  const bytes = formatProgressBytes(event);
596659
597290
  const elapsed = formatElapsed(event.elapsedMs);
@@ -596661,17 +597292,17 @@ function formatGenerativeProgress(kind, event, options2 = {}) {
596661
597292
  if (typeof pct === "number") {
596662
597293
  const filled = Math.max(0, Math.min(width, Math.round(pct / 100 * width)));
596663
597294
  const bar = `${"#".repeat(filled)}${"-".repeat(width - filled)}`;
596664
- return `${label} ${stage}: [${bar}] ${pct}% ${message2}${bytes}${elapsed}`;
597295
+ return `${label} ${stage2}: [${bar}] ${pct}% ${message2}${bytes}${elapsed}`;
596665
597296
  }
596666
- return `${label} ${stage}: ${message2}${bytes}${elapsed}`;
597297
+ return `${label} ${stage2}: ${message2}${bytes}${elapsed}`;
596667
597298
  }
596668
597299
  function kindLabel2(kind) {
596669
597300
  if (kind === "tts") return "TTS";
596670
597301
  if (kind === "model") return "3D/CAD";
596671
597302
  return kind.slice(0, 1).toUpperCase() + kind.slice(1);
596672
597303
  }
596673
- function stageLabel(stage) {
596674
- const normalized = String(stage || "process").trim().toLowerCase();
597304
+ function stageLabel(stage2) {
597305
+ const normalized = String(stage2 || "process").trim().toLowerCase();
596675
597306
  if (normalized === "setup") return "setup";
596676
597307
  if (normalized === "download") return "download";
596677
597308
  if (normalized === "load") return "load";
@@ -658503,23 +659134,23 @@ ${sections.join("\n\n")}`;
658503
659134
  function adaptTool3(tool) {
658504
659135
  return adaptExecutionTool(tool);
658505
659136
  }
658506
- function buildDreamPrompt(mode, stage, cycleNum, totalCycles, previousFindings, dreamsDir) {
659137
+ function buildDreamPrompt(mode, stage2, cycleNum, totalCycles, previousFindings, dreamsDir) {
658507
659138
  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
659139
  const stageInstruction = {
658509
659140
  "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
659141
  "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
659142
  "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
659143
  "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
- }[stage.name];
659144
+ }[stage2.name];
658514
659145
  return loadPrompt3("tui/dream-stages.md", {
658515
659146
  modeDesc,
658516
659147
  cycleNum: String(cycleNum),
658517
659148
  totalCycles: String(totalCycles),
658518
- stageName: stage.name,
658519
- stageLabel: stage.label,
658520
- stageDescription: stage.description,
659149
+ stageName: stage2.name,
659150
+ stageLabel: stage2.label,
659151
+ stageDescription: stage2.description,
658521
659152
  stageInstruction: stageInstruction || "",
658522
- stageNameLower: stage.name.toLowerCase(),
659153
+ stageNameLower: stage2.name.toLowerCase(),
658523
659154
  previousFindings: previousFindings ? `PREVIOUS FINDINGS FROM EARLIER STAGES:
658524
659155
  ${previousFindings}
658525
659156
  ` : ""
@@ -658560,9 +659191,9 @@ function renderDreamStage(name10, label, description) {
658560
659191
  `);
658561
659192
  });
658562
659193
  }
658563
- function renderDreamStageComplete(stage, durationMs) {
659194
+ function renderDreamStageComplete(stage2, durationMs) {
658564
659195
  const secs = (durationMs / 1e3).toFixed(1);
658565
- dreamWrite(() => process.stdout.write(` ${c3.green("✔")} ${stage} complete ${c3.dim(`(${secs}s)`)}
659196
+ dreamWrite(() => process.stdout.write(` ${c3.green("✔")} ${stage2} complete ${c3.dim(`(${secs}s)`)}
658566
659197
  `));
658567
659198
  }
658568
659199
  function renderDreamContraction(cycle) {
@@ -658909,12 +659540,12 @@ var init_dream_engine = __esm({
658909
659540
  let previousFindings = "";
658910
659541
  const cycleResults = [];
658911
659542
  const modelTier2 = getModelTier(this.config.model);
658912
- for (const stage of SLEEP_STAGES) {
659543
+ for (const stage2 of SLEEP_STAGES) {
658913
659544
  if (this.abortController.signal.aborted) break;
658914
- renderDreamStage(stage.name, stage.label, stage.description);
659545
+ renderDreamStage(stage2.name, stage2.label, stage2.description);
658915
659546
  const startMs = Date.now();
658916
659547
  let result;
658917
- if (stage.name === "REM" && modelTier2 === "large" && detectSystemSpecs().gpuVramGB > 0) {
659548
+ if (stage2.name === "REM" && modelTier2 === "large" && detectSystemSpecs().gpuVramGB > 0) {
658918
659549
  renderInfo("REM: Autoresearch swarm — 5-agent GPU experiment loop (Researcher + Monitor + Evaluator + Critic + Flow Maintainer)");
658919
659550
  const swarmResult = await this.runAutoresearchSwarm(
658920
659551
  cycle,
@@ -658922,7 +659553,7 @@ var init_dream_engine = __esm({
658922
659553
  onEvent
658923
659554
  );
658924
659555
  result = { summary: swarmResult.summary, turns: 0, toolCalls: 0 };
658925
- } else if (stage.name === "REM" && modelTier2 === "large") {
659556
+ } else if (stage2.name === "REM" && modelTier2 === "large") {
658926
659557
  renderInfo("REM: Multi-agent creative mode — parallel Visionary + Pragmatist + Cross-Pollinator");
658927
659558
  const remResult = await this.runMultiAgentREM(
658928
659559
  cycle,
@@ -658935,7 +659566,7 @@ var init_dream_engine = __esm({
658935
659566
  } else {
658936
659567
  const prompt = buildDreamPrompt(
658937
659568
  mode,
658938
- stage,
659569
+ stage2,
658939
659570
  cycle,
658940
659571
  totalCycles,
658941
659572
  previousFindings,
@@ -658950,7 +659581,7 @@ var init_dream_engine = __esm({
658950
659581
  const durationMs = Date.now() - startMs;
658951
659582
  const cycleResult = {
658952
659583
  cycle,
658953
- stage: stage.name,
659584
+ stage: stage2.name,
658954
659585
  ideas: [],
658955
659586
  proposals: [],
658956
659587
  filesGenerated: [],
@@ -658958,12 +659589,12 @@ var init_dream_engine = __esm({
658958
659589
  };
658959
659590
  previousFindings += `
658960
659591
 
658961
- ### ${stage.label} findings:
659592
+ ### ${stage2.label} findings:
658962
659593
  ${result.summary}`;
658963
659594
  cycleResult.ideas.push(result.summary);
658964
659595
  cycleResults.push(cycleResult);
658965
659596
  this.state.results.push(cycleResult);
658966
- renderDreamStageComplete(stage.name, durationMs);
659597
+ renderDreamStageComplete(stage2.name, durationMs);
658967
659598
  }
658968
659599
  if (mode !== "default" || cycle === totalCycles) {
658969
659600
  renderDreamContraction(cycle);
@@ -666816,19 +667447,19 @@ function deriveVisualEvidencePlan(request) {
666816
667447
  }
666817
667448
  async function executeVisualEvidencePlan(resolution, plan, executor) {
666818
667449
  const stages = [];
666819
- for (const stage of plan.stages) {
667450
+ for (const stage2 of plan.stages) {
666820
667451
  const start2 = Date.now();
666821
667452
  try {
666822
- const result = await executor(stage.kind, resolution.path, "auto");
666823
- stages.push({ ...stage, completed: true, output: result.output, durationMs: result.durationMs });
667453
+ const result = await executor(stage2.kind, resolution.path, "auto");
667454
+ stages.push({ ...stage2, completed: true, output: result.output, durationMs: result.durationMs });
666824
667455
  } catch (err) {
666825
667456
  stages.push({
666826
- ...stage,
667457
+ ...stage2,
666827
667458
  completed: false,
666828
667459
  error: err instanceof Error ? err.message : String(err),
666829
667460
  durationMs: Date.now() - start2
666830
667461
  });
666831
- if (stage.required) break;
667462
+ if (stage2.required) break;
666832
667463
  }
666833
667464
  }
666834
667465
  const succeeded = stages.filter((s2) => s2.completed);
@@ -678194,13 +678825,13 @@ ${TELEGRAM_PUBLIC_ORCHESTRATOR_CONTRACT}`
678194
678825
  if (!html) return;
678195
678826
  const state = stateFor(toolName);
678196
678827
  const now2 = Date.now();
678197
- const stage = String(event.stage || "process");
678828
+ const stage2 = String(event.stage || "process");
678198
678829
  const percent = typeof event.percent === "number" && Number.isFinite(event.percent) ? Math.round(event.percent) : void 0;
678199
- const terminalStage = stage === "save" || stage === "thumbnail" || stage === "hf_token_required";
678200
- const shouldRender = state.lastRenderedAt === 0 || stage !== state.lastStage || typeof percent === "number" && (state.lastPercent === void 0 || Math.abs(percent - state.lastPercent) >= 5) || now2 - state.lastRenderedAt >= 3500 || terminalStage;
678830
+ const terminalStage = stage2 === "save" || stage2 === "thumbnail" || stage2 === "hf_token_required";
678831
+ 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
678832
  if (!shouldRender) return;
678202
678833
  state.lastRenderedAt = now2;
678203
- state.lastStage = stage;
678834
+ state.lastStage = stage2;
678204
678835
  state.lastPercent = percent;
678205
678836
  enqueue(state, html);
678206
678837
  },
@@ -690308,7 +690939,7 @@ async function tunnelViaTor(req3) {
690308
690939
  function openSocks5(targetHost, targetPort, timeoutMs) {
690309
690940
  return new Promise((resolve74, reject) => {
690310
690941
  const sock = createConnection3({ host: DEFAULT_SOCKS_HOST, port: DEFAULT_SOCKS_PORT });
690311
- let stage = "greet";
690942
+ let stage2 = "greet";
690312
690943
  const timer = setTimeout(() => {
690313
690944
  try {
690314
690945
  sock.destroy(new Error(`Tor SOCKS5 timeout (${timeoutMs}ms)`));
@@ -690324,7 +690955,7 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
690324
690955
  sock.write(Buffer.from([5, 1, 0]));
690325
690956
  });
690326
690957
  sock.on("data", (chunk) => {
690327
- if (stage === "greet") {
690958
+ if (stage2 === "greet") {
690328
690959
  if (chunk.length < 2 || chunk[0] !== 5 || chunk[1] !== 0) {
690329
690960
  clearTimeout(timer);
690330
690961
  reject(new Error("Tor SOCKS5: greeting rejected (auth required?)"));
@@ -690344,10 +690975,10 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
690344
690975
  hostBuf.copy(buf, 5);
690345
690976
  buf.writeUInt16BE(targetPort, 5 + hostBuf.length);
690346
690977
  sock.write(buf);
690347
- stage = "connect";
690978
+ stage2 = "connect";
690348
690979
  return;
690349
690980
  }
690350
- if (stage === "connect") {
690981
+ if (stage2 === "connect") {
690351
690982
  if (chunk.length < 2 || chunk[0] !== 5) {
690352
690983
  clearTimeout(timer);
690353
690984
  reject(new Error("Tor SOCKS5: malformed CONNECT reply"));
@@ -690368,7 +690999,7 @@ function openSocks5(targetHost, targetPort, timeoutMs) {
690368
690999
  return;
690369
691000
  }
690370
691001
  clearTimeout(timer);
690371
- stage = "ready";
691002
+ stage2 = "ready";
690372
691003
  resolve74(sock);
690373
691004
  }
690374
691005
  });
@@ -717159,6 +717790,7 @@ Bypass for special cases: set env OMNIUS_DISABLE_TASK_COMPLETE_BUILD_GUARD=1 (no
717159
717790
  }
717160
717791
  function wireAgentToolMinimal(tool, config, repoRoot) {
717161
717792
  const typeRegistry = getAgentTypeRegistry();
717793
+ const patternRegistry = getAgentDeploymentPatternRegistry();
717162
717794
  const allToolNames = [
717163
717795
  "file_read",
717164
717796
  "file_write",
@@ -717192,6 +717824,27 @@ function wireAgentToolMinimal(tool, config, repoRoot) {
717192
717824
  };
717193
717825
  },
717194
717826
  listTypes: () => typeRegistry.listTypes(),
717827
+ resolveDeploymentPattern: (patternName, task) => {
717828
+ const plan = patternRegistry.plan(patternName, task);
717829
+ if (!plan) return void 0;
717830
+ return {
717831
+ pattern: plan.pattern,
717832
+ topology: plan.topology,
717833
+ description: plan.description,
717834
+ coordinatorRequired: plan.coordinatorRequired,
717835
+ instructions: plan.instructions,
717836
+ stages: plan.stages.map((stage2) => ({
717837
+ id: stage2.id,
717838
+ label: stage2.label,
717839
+ agentType: stage2.agentType,
717840
+ mode: stage2.mode,
717841
+ order: stage2.order,
717842
+ ...stage2.parallelGroup ? { parallelGroup: stage2.parallelGroup } : {},
717843
+ ...stage2.dependsOn ? { dependsOn: stage2.dependsOn } : {}
717844
+ }))
717845
+ };
717846
+ },
717847
+ listDeploymentPatterns: () => patternRegistry.listPatterns(),
717195
717848
  spawnInProcess: async (opts) => {
717196
717849
  let backend;
717197
717850
  if (config.backendType === "nexus") {
@@ -721260,6 +721913,7 @@ Review its full output via sub_agent(action='output', id='${id}')`
721260
721913
  };
721261
721914
  _wireAgentToolCallbacks = (tool) => {
721262
721915
  const typeRegistry = getAgentTypeRegistry();
721916
+ const patternRegistry = getAgentDeploymentPatternRegistry();
721263
721917
  const allToolNames = [
721264
721918
  "file_read",
721265
721919
  "file_write",
@@ -721299,6 +721953,27 @@ Review its full output via sub_agent(action='output', id='${id}')`
721299
721953
  };
721300
721954
  },
721301
721955
  listTypes: () => typeRegistry.listTypes(),
721956
+ resolveDeploymentPattern: (patternName, task) => {
721957
+ const plan = patternRegistry.plan(patternName, task);
721958
+ if (!plan) return void 0;
721959
+ return {
721960
+ pattern: plan.pattern,
721961
+ topology: plan.topology,
721962
+ description: plan.description,
721963
+ coordinatorRequired: plan.coordinatorRequired,
721964
+ instructions: plan.instructions,
721965
+ stages: plan.stages.map((stage2) => ({
721966
+ id: stage2.id,
721967
+ label: stage2.label,
721968
+ agentType: stage2.agentType,
721969
+ mode: stage2.mode,
721970
+ order: stage2.order,
721971
+ ...stage2.parallelGroup ? { parallelGroup: stage2.parallelGroup } : {},
721972
+ ...stage2.dependsOn ? { dependsOn: stage2.dependsOn } : {}
721973
+ }))
721974
+ };
721975
+ },
721976
+ listDeploymentPatterns: () => patternRegistry.listPatterns(),
721302
721977
  spawnInProcess: async (opts) => {
721303
721978
  let backend;
721304
721979
  if (config.backendType === "nexus") {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.382",
3
+ "version": "1.0.383",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.382",
9
+ "version": "1.0.383",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.382",
3
+ "version": "1.0.383",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",