negotium 0.3.1 → 0.3.3

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.
@@ -2429,7 +2429,7 @@ var init_claude_registry = __esm(() => {
2429
2429
  });
2430
2430
 
2431
2431
  // ../../packages/core/src/version.ts
2432
- var NEGOTIUM_VERSION = "0.3.1";
2432
+ var NEGOTIUM_VERSION = "0.3.3";
2433
2433
 
2434
2434
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2435
2435
  import { spawn as spawn2 } from "child_process";
@@ -6631,7 +6631,7 @@ function buildRuntimeToolSection(opts, extensions) {
6631
6631
  const askUserToolLine = agentKind === "codex" ? `When you need a blocking user choice, call the \`ask_user_question\` function in the \`${runtimeNamespace}\` namespace with { question: "...", choices: [{ label: "...", description?: "..." }] }.` : `When you need a blocking user choice, call the MCP tool "${runtimeNamespace}__ask_user_question" with { question: "...", choices: [{ label: "...", description?: "..." }] }.`;
6632
6632
  const scheduleSelfToolLine = agentKind === "codex" ? `For a one-shot delayed continuation within 24 hours, call the \`schedule_self\` function in the \`${runtimeNamespace}\` namespace with { delay_seconds: number, message: "self-contained future instruction" }. Only one pending self-schedule is allowed per topic; use \`get_self_schedule\`, \`update_self_schedule\`, or \`cancel_self_schedule\` in that namespace to manage it. Use cron-manager for recurring schedules.` : `For a one-shot delayed continuation within 24 hours, call the MCP tool "${runtimeNamespace}__schedule_self" with { delay_seconds: number, message: "self-contained future instruction" }. Only one pending self-schedule is allowed per topic; manage it with "${runtimeNamespace}__get_self_schedule", "${runtimeNamespace}__update_self_schedule", or "${runtimeNamespace}__cancel_self_schedule". Use cron-manager for recurring schedules.`;
6633
6633
  const taskToolLine = agentKind === "codex" ? `For task tracking, use \`task_create\`, \`task_update\`, \`task_list\`, \`task_get\`, and \`task_delete\` functions in the \`${taskNamespace}\` namespace.` : `For task tracking, use MCP tools "${taskNamespace}__task_create", "${taskNamespace}__task_update", "${taskNamespace}__task_list", "${taskNamespace}__task_get", and "${taskNamespace}__task_delete".`;
6634
- const decisionToolLine = `Use the shared Decision tools in the \`${decisionNamespace}\` namespace when an architectural, product, or operational choice establishes or changes a durable direction or constraint. Do not record routine task progress or temporary implementation details; link causal predecessors when relevant.`;
6634
+ const decisionToolLine = `Record a decision with the shared Decision tools in the \`${decisionNamespace}\` namespace whenever you pick between real alternatives and the choice will constrain later work: which layer or repository owns a fix, what a version number claims, which dependency version to pin, what an interface promises, which of two diagnoses you are acting on. Write it at the moment you choose, not as a summary at the end of the turn, and link the decision it follows from or supersedes. Do not record routine task progress or temporary implementation details.`;
6635
6635
  const runtimeToolRef = (name) => agentKind === "codex" ? `\`${name}\`` : `"${runtimeNamespace}__${name}"`;
6636
6636
  const spawnSubagentToolLine = `Use ${runtimeToolRef("spawn_subagent")} for self-contained parallel or long-running background work; keep quick work inline.`;
6637
6637
  const lifecycleToolLine = `For staged work, call ${runtimeToolRef("create_subagent")} then ${runtimeToolRef("start_subagent")}. Create fixes \`task\` and \`report_mode\`; start takes only the room ID, so create after inputs are known unless preparing a \`tell_session\` receiver. Manage descendants with ${runtimeToolRef("list_subagents")} and ${runtimeToolRef("delete_subagent")}, and non-parent tell routes with ${runtimeToolRef("grant_subagent_tell")} and ${runtimeToolRef("revoke_subagent_tell")}. Direct-parent reporting needs no grant. Use ${runtimeToolRef("list_memory_topics")} to select \`memory_topic\`.`;
@@ -14814,11 +14814,58 @@ function buildMermaidHtml(code, theme, scriptUrl = MERMAID_BROWSER_ASSET_RELATIV
14814
14814
  <script data-otium-mermaid-runtime src="${safeScriptUrl}"></script>
14815
14815
  <script>
14816
14816
  (async () => {
14817
+ // An unrendered document reports itself in more than one voice: Mermaid's
14818
+ // own 0x0 guard, and the browser refusing geometry on a path that was
14819
+ // never laid out. Both mean the same thing, so both are worth one retry
14820
+ // and, if it still fails, the same explanation.
14821
+ const unrendered = (error) => {
14822
+ const message = String(error && error.message ? error.message : error);
14823
+ return message.indexOf("not in render tree") !== -1 || message.indexOf("path is empty") !== -1;
14824
+ };
14817
14825
  try {
14818
14826
  const runtime = globalThis.mermaid;
14819
14827
  if (!runtime) throw new Error("Mermaid renderer failed to load.");
14820
14828
  runtime.initialize({ startOnLoad: false, securityLevel: "strict", theme: ${safeTheme} });
14821
- await runtime.run({ querySelector: ".mermaid" });
14829
+ const host = document.querySelector(".mermaid");
14830
+ // Mermaid sizes every label by appending a probe <svg> to the body and
14831
+ // reading getBBox(), and it throws "svg element not in render tree" the
14832
+ // moment that comes back 0x0. That is what a hidden panel looks like from
14833
+ // in here: the document exists but nothing is in the render tree, so the
14834
+ // measurement has no geometry to report. Ask the same question Mermaid
14835
+ // will ask, and only start once it has an answer.
14836
+ const measurable = () => {
14837
+ const probe = document.createElementNS("http://www.w3.org/2000/svg", "svg");
14838
+ const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
14839
+ text.textContent = "M";
14840
+ probe.appendChild(text);
14841
+ document.body.appendChild(probe);
14842
+ let box = { width: 0, height: 0 };
14843
+ try { box = text.getBBox(); } catch (ignored) {}
14844
+ probe.remove();
14845
+ return box.width > 0 || box.height > 0;
14846
+ };
14847
+ // requestAnimationFrame is the right clock here: a hidden document stops
14848
+ // being animated, so this waits without spinning and resumes on the frame
14849
+ // the panel is shown. The cap counts rendered frames, not wall time.
14850
+ const waitUntilMeasurable = async (maxFrames) => {
14851
+ for (let frame = 0; frame < maxFrames; frame += 1) {
14852
+ if (measurable()) return true;
14853
+ await new Promise((next) => requestAnimationFrame(next));
14854
+ }
14855
+ return measurable();
14856
+ };
14857
+ await waitUntilMeasurable(600);
14858
+ try {
14859
+ await runtime.run({ querySelector: ".mermaid" });
14860
+ } catch (firstAttempt) {
14861
+ if (!unrendered(firstAttempt)) throw firstAttempt;
14862
+ // The panel can be hidden again between the probe and the real measure.
14863
+ // Clear the marker Mermaid leaves behind so the retry is not skipped as
14864
+ // already done, then wait for the render tree once more.
14865
+ host.removeAttribute("data-processed");
14866
+ await waitUntilMeasurable(600);
14867
+ await runtime.run({ querySelector: ".mermaid" });
14868
+ }
14822
14869
  const viewport = document.querySelector(".viewport");
14823
14870
  const svg = document.querySelector(".mermaid svg");
14824
14871
  const value = document.querySelector(".zoom-value");
@@ -14854,6 +14901,8 @@ function buildMermaidHtml(code, theme, scriptUrl = MERMAID_BROWSER_ASSET_RELATIV
14854
14901
  // for a syntax error that does not exist. Say what actually moves it.
14855
14902
  const note = raw.indexOf("Could not find a suitable point") !== -1
14856
14903
  ? "Two nodes ended up too close together for Mermaid to fit a label on the edge between them. Renaming a node, adding another, or setting an explicit direction usually spreads the layout enough to render."
14904
+ : unrendered(error)
14905
+ ? "The panel stayed hidden long enough that there was never a laid-out page to measure the diagram against. Reopening the panel renders it."
14857
14906
  : "This diagram could not be rendered.";
14858
14907
  document.querySelector(".viewport").innerHTML =
14859
14908
  '<div class="failure"><p>' + escape(note) +
@@ -18947,4 +18996,4 @@ export {
18947
18996
  DEFAULT_SELF_CONFIG_PRODUCT
18948
18997
  };
18949
18998
 
18950
- //# debugId=04D3635C24297EC864756E2164756E21
18999
+ //# debugId=61680723727EBBF564756E2164756E21