negotium 0.3.0 → 0.3.2

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.
Files changed (61) hide show
  1. package/dist/agent-helpers.js +107 -6
  2. package/dist/agent-helpers.js.map +11 -11
  3. package/dist/background-bash.js +3 -2
  4. package/dist/background-bash.js.map +4 -4
  5. package/dist/browser-runtime.js +3 -2
  6. package/dist/browser-runtime.js.map +4 -4
  7. package/dist/chunk-s2gez3wg.js.map +1 -1
  8. package/dist/{chunk-1y2xw0xe.js → chunk-vvfwqxnh.js} +33 -3
  9. package/dist/{chunk-1y2xw0xe.js.map → chunk-vvfwqxnh.js.map} +8 -8
  10. package/dist/hosted-agent.js +34 -4
  11. package/dist/hosted-agent.js.map +8 -8
  12. package/dist/main.js +1179 -366
  13. package/dist/main.js.map +24 -21
  14. package/dist/mcp-catalog.js +2 -1
  15. package/dist/mcp-catalog.js.map +3 -3
  16. package/dist/mcp-factories.js +635 -256
  17. package/dist/mcp-factories.js.map +15 -13
  18. package/dist/mcp-servers.js +3 -1
  19. package/dist/mcp-servers.js.map +3 -3
  20. package/dist/prompts.js +8 -2
  21. package/dist/prompts.js.map +5 -5
  22. package/dist/query-runtime.js +3 -2
  23. package/dist/query-runtime.js.map +4 -4
  24. package/dist/registry.js +3 -3
  25. package/dist/registry.js.map +2 -2
  26. package/dist/rollout.js +1 -1
  27. package/dist/runtime/src/mcp/canonical-bridge-config.ts +1 -1
  28. package/dist/runtime/src/mcp/canonical-proxy-server.ts +74 -1
  29. package/dist/runtime/src/mcp/decision-server.ts +21 -0
  30. package/dist/runtime/src/mcp/factories/decision.ts +178 -0
  31. package/dist/runtime/src/mcp/factories/index.ts +6 -0
  32. package/dist/runtime/src/mcp/runtime-spec.ts +1 -0
  33. package/dist/runtime/src/node-host.ts +1 -0
  34. package/dist/runtime/src/platform/config.ts +2 -1
  35. package/dist/runtime/src/platform/mcp-catalog-policy.ts +1 -0
  36. package/dist/runtime/src/platform/mcp-config.ts +31 -1
  37. package/dist/runtime/src/prompts/builders.ts +5 -0
  38. package/dist/runtime/src/runtime/visual-html.ts +68 -2
  39. package/dist/runtime/src/storage/decisions.ts +231 -0
  40. package/dist/runtime/src/storage/storage-public.ts +2 -0
  41. package/dist/runtime/src/types.ts +13 -0
  42. package/dist/runtime/src/version.ts +1 -1
  43. package/dist/runtime-helpers.js +71 -4
  44. package/dist/runtime-helpers.js.map +5 -5
  45. package/dist/storage.js +261 -56
  46. package/dist/storage.js.map +5 -4
  47. package/dist/types/apps/negotium/src/mcp-servers.d.ts +1 -1
  48. package/dist/types/packages/core/src/mcp/canonical-bridge-config.d.ts +1 -1
  49. package/dist/types/packages/core/src/mcp/factories/decision.d.ts +16 -0
  50. package/dist/types/packages/core/src/mcp/factories/index.d.ts +1 -0
  51. package/dist/types/packages/core/src/mcp/runtime-spec.d.ts +1 -1
  52. package/dist/types/packages/core/src/platform/config.d.ts +2 -1
  53. package/dist/types/packages/core/src/platform/mcp-catalog-policy.d.ts +4 -0
  54. package/dist/types/packages/core/src/storage/decisions.d.ts +45 -0
  55. package/dist/types/packages/core/src/storage/storage-public.d.ts +2 -0
  56. package/dist/types/packages/core/src/types.d.ts +12 -0
  57. package/dist/types/packages/core/src/version.d.ts +1 -1
  58. package/dist/vault.js +3 -2
  59. package/dist/vault.js.map +4 -4
  60. package/install-browser-rs.mjs +3 -3
  61. package/package.json +2 -2
@@ -10,6 +10,7 @@ var MCP_SERVER_NAMES = [
10
10
  "session-comm",
11
11
  "system-health",
12
12
  "task",
13
+ "decision",
13
14
  "token-stats",
14
15
  "vault",
15
16
  "wiki"
@@ -23,6 +24,7 @@ var MCP_SERVER_FILES = Object.freeze({
23
24
  "session-comm": runtimeFile("src/mcp/session-comm/server.ts"),
24
25
  "system-health": runtimeFile("src/mcp/system-health-server.ts"),
25
26
  task: runtimeFile("src/mcp/task-server.ts"),
27
+ decision: runtimeFile("src/mcp/decision-server.ts"),
26
28
  "token-stats": runtimeFile("src/mcp/token-stats-server.ts"),
27
29
  vault: runtimeFile("src/mcp/vault-server.ts"),
28
30
  wiki: runtimeFile("src/mcp/wiki-server.ts")
@@ -43,4 +45,4 @@ export {
43
45
  MCP_SERVER_FILES
44
46
  };
45
47
 
46
- //# debugId=F69D3A3446858BCF64756E2164756E21
48
+ //# debugId=F00E45198019E1FA64756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/mcp-servers.ts"],
4
4
  "sourcesContent": [
5
- "import { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport const MCP_SERVER_NAMES = [\n \"agent-health\",\n \"background-bash\",\n \"canonical-proxy\",\n \"cron-manager\",\n \"session-comm\",\n \"system-health\",\n \"task\",\n \"token-stats\",\n \"vault\",\n \"wiki\",\n] as const;\n\nexport type McpServerName = (typeof MCP_SERVER_NAMES)[number];\n\n/**\n * Servers that are a TypeScript entry file a host can spawn. `background-bash`\n * is still an MCP server name, but it is served by the bash-rs binary over\n * HTTP, so asking for its file is a mistake the type system should catch.\n */\nexport type McpServerFileName = Exclude<McpServerName, \"background-bash\">;\n\n/**\n * The subset of `MCP_SERVER_NAMES` that resolves to a file. Iterate this, not\n * `MCP_SERVER_NAMES`, when you mean \"every server with an entry file\" — the\n * two diverged when background-bash moved to the bash-rs binary, and a\n * consumer walking the full list gets a name `resolveMcpServerFile` rejects.\n */\nexport const MCP_SERVER_FILE_NAMES = MCP_SERVER_NAMES.filter(\n (name): name is McpServerFileName => name !== \"background-bash\",\n);\n\nconst runtimeFile = (relativePath: string): string =>\n fileURLToPath(new URL(`./runtime/${relativePath}`, import.meta.url));\n\n/** Absolute executable TypeScript entry files for Negotium's STDIO MCP servers. */\nexport const MCP_SERVER_FILES: Readonly<Record<McpServerFileName, string>> = Object.freeze({\n \"agent-health\": runtimeFile(\"src/mcp/agent-health-server.ts\"),\n \"canonical-proxy\": runtimeFile(\"src/mcp/canonical-proxy-server.ts\"),\n \"cron-manager\": runtimeFile(\"cron/mcp-server.ts\"),\n \"session-comm\": runtimeFile(\"src/mcp/session-comm/server.ts\"),\n \"system-health\": runtimeFile(\"src/mcp/system-health-server.ts\"),\n task: runtimeFile(\"src/mcp/task-server.ts\"),\n \"token-stats\": runtimeFile(\"src/mcp/token-stats-server.ts\"),\n vault: runtimeFile(\"src/mcp/vault-server.ts\"),\n wiki: runtimeFile(\"src/mcp/wiki-server.ts\"),\n});\n\nexport function resolveMcpServerFile(name: McpServerFileName): string {\n return MCP_SERVER_FILES[name];\n}\n\n/** tsconfig used when a host launches the TypeScript server through node + tsx. */\nexport function resolveMcpServerTsconfig(name: McpServerFileName): string {\n const file = resolveMcpServerFile(name);\n const levels = name === \"cron-manager\" ? \"..\" : name === \"session-comm\" ? \"../../..\" : \"../..\";\n return resolve(dirname(file), levels, \"tsconfig.json\");\n}\n"
5
+ "import { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport const MCP_SERVER_NAMES = [\n \"agent-health\",\n \"background-bash\",\n \"canonical-proxy\",\n \"cron-manager\",\n \"session-comm\",\n \"system-health\",\n \"task\",\n \"decision\",\n \"token-stats\",\n \"vault\",\n \"wiki\",\n] as const;\n\nexport type McpServerName = (typeof MCP_SERVER_NAMES)[number];\n\n/**\n * Servers that are a TypeScript entry file a host can spawn. `background-bash`\n * is still an MCP server name, but it is served by the bash-rs binary over\n * HTTP, so asking for its file is a mistake the type system should catch.\n */\nexport type McpServerFileName = Exclude<McpServerName, \"background-bash\">;\n\n/**\n * The subset of `MCP_SERVER_NAMES` that resolves to a file. Iterate this, not\n * `MCP_SERVER_NAMES`, when you mean \"every server with an entry file\" — the\n * two diverged when background-bash moved to the bash-rs binary, and a\n * consumer walking the full list gets a name `resolveMcpServerFile` rejects.\n */\nexport const MCP_SERVER_FILE_NAMES = MCP_SERVER_NAMES.filter(\n (name): name is McpServerFileName => name !== \"background-bash\",\n);\n\nconst runtimeFile = (relativePath: string): string =>\n fileURLToPath(new URL(`./runtime/${relativePath}`, import.meta.url));\n\n/** Absolute executable TypeScript entry files for Negotium's STDIO MCP servers. */\nexport const MCP_SERVER_FILES: Readonly<Record<McpServerFileName, string>> = Object.freeze({\n \"agent-health\": runtimeFile(\"src/mcp/agent-health-server.ts\"),\n \"canonical-proxy\": runtimeFile(\"src/mcp/canonical-proxy-server.ts\"),\n \"cron-manager\": runtimeFile(\"cron/mcp-server.ts\"),\n \"session-comm\": runtimeFile(\"src/mcp/session-comm/server.ts\"),\n \"system-health\": runtimeFile(\"src/mcp/system-health-server.ts\"),\n task: runtimeFile(\"src/mcp/task-server.ts\"),\n decision: runtimeFile(\"src/mcp/decision-server.ts\"),\n \"token-stats\": runtimeFile(\"src/mcp/token-stats-server.ts\"),\n vault: runtimeFile(\"src/mcp/vault-server.ts\"),\n wiki: runtimeFile(\"src/mcp/wiki-server.ts\"),\n});\n\nexport function resolveMcpServerFile(name: McpServerFileName): string {\n return MCP_SERVER_FILES[name];\n}\n\n/** tsconfig used when a host launches the TypeScript server through node + tsx. */\nexport function resolveMcpServerTsconfig(name: McpServerFileName): string {\n const file = resolveMcpServerFile(name);\n const levels = name === \"cron-manager\" ? \"..\" : name === \"session-comm\" ? \"../../..\" : \"../..\";\n return resolve(dirname(file), levels, \"tsconfig.json\");\n}\n"
6
6
  ],
7
- "mappings": ";;AAAA;AACA;AAEO,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiBO,IAAM,wBAAwB,iBAAiB,OACpD,CAAC,SAAoC,SAAS,iBAChD;AAEA,IAAM,cAAc,CAAC,iBACnB,cAAc,IAAI,IAAI,aAAa,gBAAgB,YAAY,GAAG,CAAC;AAG9D,IAAM,mBAAgE,OAAO,OAAO;AAAA,EACzF,gBAAgB,YAAY,gCAAgC;AAAA,EAC5D,mBAAmB,YAAY,mCAAmC;AAAA,EAClE,gBAA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AwB;AAC5C,CAAC;AAEM,SAAS,oBAAoB,CAAC,MAAiC;AAAA,EACpE,OAAO,iBAAiB;AAAA;AAInB,SAAS,wBAAwB,CAAC,MAAiC;AAAA,EACxE,MAAM,OAAO,qBAAqB,IAAI;AAAA,EACtC,MAAM,SAAS,SAAS,iBAAiB,OAAO,SAAS,iBAAiB,aAAa;AAAA,EACvF,OAAO,QAAQ,QAAQ,IAAI,GAAG,QAAQ,eAAe;AAAA;",
8
+ "debugId": "F00E45198019E1FA64756E2164756E21",
9
9
  "names": []
10
10
  }
package/dist/prompts.js CHANGED
@@ -113,7 +113,7 @@ function resolveOutputLanguage() {
113
113
  const raw = envText("NEGOTIUM_LANG")?.trim();
114
114
  return raw && raw.length > 0 ? raw : DEFAULT_OUTPUT_LANGUAGE;
115
115
  }
116
- var BROWSER_RS_VERSION = "v0.1.19";
116
+ var BROWSER_RS_VERSION = "v0.1.21";
117
117
  var BROWSER_RS_MIN_SECURE_VERSION = "0.1.15";
118
118
  function versionAtLeast(actualVersion, minimumVersion) {
119
119
  const actual = actualVersion.split(".").map(Number);
@@ -183,6 +183,7 @@ var TSX_LOADER = createRequire(import.meta.url).resolve("tsx");
183
183
  var TSCONFIG_PATH = resolve(PROJECT_ROOT, "tsconfig.json");
184
184
  var SESSION_COMM_SERVER = resolve(PROJECT_ROOT, "src/mcp/session-comm/server.ts");
185
185
  var TASK_SERVER = resolve(PROJECT_ROOT, "src/mcp/task-server.ts");
186
+ var DECISION_SERVER = resolve(PROJECT_ROOT, "src/mcp/decision-server.ts");
186
187
  var BROWSER_MCP_SSE_PROXY_SERVER = resolve(PROJECT_ROOT, "src/mcp/browser-sse-proxy-server.ts");
187
188
  var CANONICAL_MCP_PROXY_SERVER = resolve(PROJECT_ROOT, "src/mcp/canonical-proxy-server.ts");
188
189
  var WIKI_SERVER = resolve(PROJECT_ROOT, "src/mcp/wiki-server.ts");
@@ -536,6 +537,7 @@ function buildRuntimeToolSection(opts, extensions) {
536
537
  } = opts;
537
538
  const runtimeNamespace = "mcp__runtime";
538
539
  const taskNamespace = "mcp__task";
540
+ const decisionNamespace = "mcp__decision";
539
541
  const visualToolLine = agentKind === "codex" ? `To display charts, tables, or interactive HTML results to the user, call the \`show_html\` function in the \`${runtimeNamespace}\` namespace with { html: "<complete HTML string>", title?: "optional title" }.` : `To display charts, tables, or interactive HTML results to the user, call the MCP tool "${runtimeNamespace}__show_html" with { html: "<complete HTML string>", title?: "optional title" }.`;
540
542
  const mermaidToolLine = agentKind === "codex" ? `For diagrams that Mermaid supports, prefer the \`show_mermaid\` function in the \`${runtimeNamespace}\` namespace with { code: "<Mermaid DSL without markdown fences>", title?: "...", theme?: "neutral" }.` : `For diagrams that Mermaid supports, prefer the MCP tool "${runtimeNamespace}__show_mermaid" with { code: "<Mermaid DSL without markdown fences>", title?: "...", theme?: "neutral" }.`;
541
543
  const mediaToolLine = agentKind === "codex" ? `To display an existing image or video in the visual panel, use \`show_image\` or \`show_video\` in the \`${runtimeNamespace}\` namespace with either { file_path: "...", title?: "..." } for a topic-workspace file or { file_id: "...", title?: "..." } for an uploaded file already attached in this topic.` : `To display an existing image or video in the visual panel, use MCP tool "${runtimeNamespace}__show_image" or "${runtimeNamespace}__show_video" with either { file_path: "...", title?: "..." } for a topic-workspace file or { file_id: "...", title?: "..." } for an uploaded file already attached in this topic.`;
@@ -543,6 +545,7 @@ function buildRuntimeToolSection(opts, extensions) {
543
545
  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?: "..." }] }.`;
544
546
  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.`;
545
547
  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".`;
548
+ 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.`;
546
549
  const runtimeToolRef = (name) => agentKind === "codex" ? `\`${name}\`` : `"${runtimeNamespace}__${name}"`;
547
550
  const spawnSubagentToolLine = `Use ${runtimeToolRef("spawn_subagent")} for self-contained parallel or long-running background work; keep quick work inline.`;
548
551
  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\`.`;
@@ -589,6 +592,9 @@ function buildRuntimeToolSection(opts, extensions) {
589
592
  taskToolLine,
590
593
  "Use this shared task store for plans, progress, and checklist updates; it is visible across claude/codex/maestro turns.",
591
594
  nativeTaskPolicyLine,
595
+ "",
596
+ "## Shared Decisions",
597
+ decisionToolLine,
592
598
  ...extensions.render("after-shared-tasks"),
593
599
  ...fileDeliverySection,
594
600
  ...extensions.render("before-session-communication"),
@@ -786,4 +792,4 @@ export {
786
792
  buildChannelSystemPrompt
787
793
  };
788
794
 
789
- //# debugId=CB86374C891CABC064756E2164756E21
795
+ //# debugId=F5381CCD046EC6D364756E2164756E21