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.
package/dist/main.js CHANGED
@@ -1869,7 +1869,7 @@ var exports_version = {};
1869
1869
  __export(exports_version, {
1870
1870
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
1871
1871
  });
1872
- var NEGOTIUM_VERSION = "0.3.1";
1872
+ var NEGOTIUM_VERSION = "0.3.3";
1873
1873
 
1874
1874
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
1875
1875
  import { spawn } from "child_process";
@@ -11694,7 +11694,7 @@ function buildRuntimeToolSection(opts, extensions) {
11694
11694
  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?: "..." }] }.`;
11695
11695
  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.`;
11696
11696
  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".`;
11697
- 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.`;
11697
+ 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.`;
11698
11698
  const runtimeToolRef = (name) => agentKind === "codex" ? `\`${name}\`` : `"${runtimeNamespace}__${name}"`;
11699
11699
  const spawnSubagentToolLine = `Use ${runtimeToolRef("spawn_subagent")} for self-contained parallel or long-running background work; keep quick work inline.`;
11700
11700
  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\`.`;
@@ -17216,11 +17216,58 @@ function buildMermaidHtml(code, theme, scriptUrl = MERMAID_BROWSER_ASSET_RELATIV
17216
17216
  <script data-otium-mermaid-runtime src="${safeScriptUrl}"></script>
17217
17217
  <script>
17218
17218
  (async () => {
17219
+ // An unrendered document reports itself in more than one voice: Mermaid's
17220
+ // own 0x0 guard, and the browser refusing geometry on a path that was
17221
+ // never laid out. Both mean the same thing, so both are worth one retry
17222
+ // and, if it still fails, the same explanation.
17223
+ const unrendered = (error) => {
17224
+ const message = String(error && error.message ? error.message : error);
17225
+ return message.indexOf("not in render tree") !== -1 || message.indexOf("path is empty") !== -1;
17226
+ };
17219
17227
  try {
17220
17228
  const runtime = globalThis.mermaid;
17221
17229
  if (!runtime) throw new Error("Mermaid renderer failed to load.");
17222
17230
  runtime.initialize({ startOnLoad: false, securityLevel: "strict", theme: ${safeTheme} });
17223
- await runtime.run({ querySelector: ".mermaid" });
17231
+ const host = document.querySelector(".mermaid");
17232
+ // Mermaid sizes every label by appending a probe <svg> to the body and
17233
+ // reading getBBox(), and it throws "svg element not in render tree" the
17234
+ // moment that comes back 0x0. That is what a hidden panel looks like from
17235
+ // in here: the document exists but nothing is in the render tree, so the
17236
+ // measurement has no geometry to report. Ask the same question Mermaid
17237
+ // will ask, and only start once it has an answer.
17238
+ const measurable = () => {
17239
+ const probe = document.createElementNS("http://www.w3.org/2000/svg", "svg");
17240
+ const text = document.createElementNS("http://www.w3.org/2000/svg", "text");
17241
+ text.textContent = "M";
17242
+ probe.appendChild(text);
17243
+ document.body.appendChild(probe);
17244
+ let box = { width: 0, height: 0 };
17245
+ try { box = text.getBBox(); } catch (ignored) {}
17246
+ probe.remove();
17247
+ return box.width > 0 || box.height > 0;
17248
+ };
17249
+ // requestAnimationFrame is the right clock here: a hidden document stops
17250
+ // being animated, so this waits without spinning and resumes on the frame
17251
+ // the panel is shown. The cap counts rendered frames, not wall time.
17252
+ const waitUntilMeasurable = async (maxFrames) => {
17253
+ for (let frame = 0; frame < maxFrames; frame += 1) {
17254
+ if (measurable()) return true;
17255
+ await new Promise((next) => requestAnimationFrame(next));
17256
+ }
17257
+ return measurable();
17258
+ };
17259
+ await waitUntilMeasurable(600);
17260
+ try {
17261
+ await runtime.run({ querySelector: ".mermaid" });
17262
+ } catch (firstAttempt) {
17263
+ if (!unrendered(firstAttempt)) throw firstAttempt;
17264
+ // The panel can be hidden again between the probe and the real measure.
17265
+ // Clear the marker Mermaid leaves behind so the retry is not skipped as
17266
+ // already done, then wait for the render tree once more.
17267
+ host.removeAttribute("data-processed");
17268
+ await waitUntilMeasurable(600);
17269
+ await runtime.run({ querySelector: ".mermaid" });
17270
+ }
17224
17271
  const viewport = document.querySelector(".viewport");
17225
17272
  const svg = document.querySelector(".mermaid svg");
17226
17273
  const value = document.querySelector(".zoom-value");
@@ -17256,6 +17303,8 @@ function buildMermaidHtml(code, theme, scriptUrl = MERMAID_BROWSER_ASSET_RELATIV
17256
17303
  // for a syntax error that does not exist. Say what actually moves it.
17257
17304
  const note = raw.indexOf("Could not find a suitable point") !== -1
17258
17305
  ? "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."
17306
+ : unrendered(error)
17307
+ ? "The panel stayed hidden long enough that there was never a laid-out page to measure the diagram against. Reopening the panel renders it."
17259
17308
  : "This diagram could not be rendered.";
17260
17309
  document.querySelector(".viewport").innerHTML =
17261
17310
  '<div class="failure"><p>' + escape(note) +
@@ -46830,4 +46879,4 @@ switch (command) {
46830
46879
  }
46831
46880
  }
46832
46881
 
46833
- //# debugId=65E123B94EDD2F5C64756E2164756E21
46882
+ //# debugId=17EEFDBC7275753A64756E2164756E21