negotium 0.1.12 → 0.1.13

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 (137) hide show
  1. package/dist/canonical-mcp-bridge.js +2 -3
  2. package/dist/canonical-mcp-bridge.js.map +1 -1
  3. package/dist/chunk-a9y2rwxf.js.map +1 -1
  4. package/dist/{chunk-j0kjscb7.js → chunk-s2gez3wg.js} +20 -2
  5. package/dist/{chunk-j0kjscb7.js.map → chunk-s2gez3wg.js.map} +2 -2
  6. package/dist/cron.js +49 -25
  7. package/dist/cron.js.map +15 -14
  8. package/dist/hosted-agent.js +3012 -17
  9. package/dist/hosted-agent.js.map +30 -3
  10. package/dist/main.js +31323 -36
  11. package/dist/main.js.map +198 -3
  12. package/dist/prompts.js +11 -8
  13. package/dist/prompts.js.map +4 -4
  14. package/dist/runtime/src/application/submit-user-message.ts +3 -0
  15. package/dist/runtime/src/index.ts +7 -0
  16. package/dist/runtime/src/mcp/runtime-spec.ts +3 -0
  17. package/dist/runtime/src/mcp/session-comm/server.ts +1 -1
  18. package/dist/runtime/src/platform/mcp-config.ts +13 -0
  19. package/dist/runtime/src/prompts/builders.ts +20 -6
  20. package/dist/runtime/src/query/active-rooms.ts +2 -0
  21. package/dist/runtime/src/runtime/delivery-ack.ts +112 -0
  22. package/dist/runtime/src/runtime/errors.ts +12 -12
  23. package/dist/runtime/src/runtime/turn-runner.ts +12 -0
  24. package/dist/runtime/src/storage/runtime-turn-requests.ts +1 -0
  25. package/dist/runtime/src/types/api.ts +2 -0
  26. package/dist/runtime/src/types.ts +2 -0
  27. package/dist/runtime/src/version.ts +1 -1
  28. package/dist/runtime-helpers.js.map +1 -1
  29. package/dist/storage.js.map +1 -1
  30. package/dist/types/packages/core/src/mcp/runtime-spec.d.ts +2 -0
  31. package/dist/types/packages/core/src/platform/mcp-config.d.ts +4 -0
  32. package/dist/types/packages/core/src/prompts/builders.d.ts +2 -0
  33. package/dist/types/packages/core/src/types/api.d.ts +2 -0
  34. package/dist/types/packages/core/src/types.d.ts +2 -0
  35. package/dist/types/packages/core/src/version.d.ts +1 -1
  36. package/dist/vault.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-00q25k7p.js +0 -2387
  39. package/dist/chunk-00q25k7p.js.map +0 -26
  40. package/dist/chunk-03kv7mvj.js +0 -2152
  41. package/dist/chunk-03kv7mvj.js.map +0 -15
  42. package/dist/chunk-05pm51dh.js +0 -589
  43. package/dist/chunk-05pm51dh.js.map +0 -11
  44. package/dist/chunk-0eh16bk1.js +0 -2936
  45. package/dist/chunk-0eh16bk1.js.map +0 -20
  46. package/dist/chunk-0yfqyv88.js +0 -108
  47. package/dist/chunk-0yfqyv88.js.map +0 -10
  48. package/dist/chunk-1k7t7bnx.js +0 -97
  49. package/dist/chunk-1k7t7bnx.js.map +0 -10
  50. package/dist/chunk-3gkfr9vb.js +0 -431
  51. package/dist/chunk-3gkfr9vb.js.map +0 -11
  52. package/dist/chunk-5akd1gbj.js +0 -281
  53. package/dist/chunk-5akd1gbj.js.map +0 -10
  54. package/dist/chunk-7k19pcg8.js +0 -577
  55. package/dist/chunk-7k19pcg8.js.map +0 -14
  56. package/dist/chunk-81tbfbmt.js +0 -10
  57. package/dist/chunk-81tbfbmt.js.map +0 -10
  58. package/dist/chunk-82qhv1mq.js +0 -512
  59. package/dist/chunk-82qhv1mq.js.map +0 -13
  60. package/dist/chunk-8dy7e2a9.js +0 -103
  61. package/dist/chunk-8dy7e2a9.js.map +0 -10
  62. package/dist/chunk-8f2sqmrj.js +0 -1712
  63. package/dist/chunk-8f2sqmrj.js.map +0 -18
  64. package/dist/chunk-9hjeemfz.js +0 -372
  65. package/dist/chunk-9hjeemfz.js.map +0 -10
  66. package/dist/chunk-a4aa2ccv.js +0 -141
  67. package/dist/chunk-a4aa2ccv.js.map +0 -10
  68. package/dist/chunk-bsg215q3.js +0 -3536
  69. package/dist/chunk-bsg215q3.js.map +0 -20
  70. package/dist/chunk-bxnfsc7w.js +0 -58
  71. package/dist/chunk-bxnfsc7w.js.map +0 -10
  72. package/dist/chunk-c500xe9z.js +0 -33
  73. package/dist/chunk-c500xe9z.js.map +0 -10
  74. package/dist/chunk-cngrf7ab.js +0 -149
  75. package/dist/chunk-cngrf7ab.js.map +0 -10
  76. package/dist/chunk-d7tprf06.js +0 -53
  77. package/dist/chunk-d7tprf06.js.map +0 -10
  78. package/dist/chunk-ddnrmkrv.js +0 -61
  79. package/dist/chunk-ddnrmkrv.js.map +0 -10
  80. package/dist/chunk-edb07sjp.js +0 -567
  81. package/dist/chunk-edb07sjp.js.map +0 -14
  82. package/dist/chunk-ejcm6zx8.js +0 -591
  83. package/dist/chunk-ejcm6zx8.js.map +0 -11
  84. package/dist/chunk-ezs352qs.js +0 -237
  85. package/dist/chunk-ezs352qs.js.map +0 -11
  86. package/dist/chunk-f5xgprg1.js +0 -59
  87. package/dist/chunk-f5xgprg1.js.map +0 -10
  88. package/dist/chunk-fbtb3v0s.js +0 -1339
  89. package/dist/chunk-fbtb3v0s.js.map +0 -16
  90. package/dist/chunk-ffefbd3r.js +0 -17
  91. package/dist/chunk-ffefbd3r.js.map +0 -10
  92. package/dist/chunk-gaknyw04.js +0 -708
  93. package/dist/chunk-gaknyw04.js.map +0 -14
  94. package/dist/chunk-gxmny6tq.js +0 -1637
  95. package/dist/chunk-gxmny6tq.js.map +0 -15
  96. package/dist/chunk-h7bj5zwb.js +0 -3069
  97. package/dist/chunk-h7bj5zwb.js.map +0 -32
  98. package/dist/chunk-hp4g7wx7.js +0 -46
  99. package/dist/chunk-hp4g7wx7.js.map +0 -10
  100. package/dist/chunk-hwy3n31w.js +0 -21
  101. package/dist/chunk-hwy3n31w.js.map +0 -9
  102. package/dist/chunk-jzz91jwh.js +0 -70
  103. package/dist/chunk-jzz91jwh.js.map +0 -10
  104. package/dist/chunk-k778y16p.js +0 -153
  105. package/dist/chunk-k778y16p.js.map +0 -11
  106. package/dist/chunk-mh5mexsf.js +0 -147
  107. package/dist/chunk-mh5mexsf.js.map +0 -11
  108. package/dist/chunk-mnwaext5.js +0 -318
  109. package/dist/chunk-mnwaext5.js.map +0 -10
  110. package/dist/chunk-nkgs40ch.js +0 -23
  111. package/dist/chunk-nkgs40ch.js.map +0 -10
  112. package/dist/chunk-pz57vwsm.js +0 -250
  113. package/dist/chunk-pz57vwsm.js.map +0 -11
  114. package/dist/chunk-r6kdp7gn.js +0 -252
  115. package/dist/chunk-r6kdp7gn.js.map +0 -10
  116. package/dist/chunk-rkvrkcgx.js +0 -117
  117. package/dist/chunk-rkvrkcgx.js.map +0 -10
  118. package/dist/chunk-s74rdyqe.js +0 -117
  119. package/dist/chunk-s74rdyqe.js.map +0 -12
  120. package/dist/chunk-sa874j5c.js +0 -9
  121. package/dist/chunk-sa874j5c.js.map +0 -10
  122. package/dist/chunk-sffqdkvq.js +0 -122
  123. package/dist/chunk-sffqdkvq.js.map +0 -10
  124. package/dist/chunk-tcs9qjps.js +0 -64
  125. package/dist/chunk-tcs9qjps.js.map +0 -10
  126. package/dist/chunk-wx83ep8e.js +0 -131
  127. package/dist/chunk-wx83ep8e.js.map +0 -10
  128. package/dist/chunk-xag86ng3.js +0 -122
  129. package/dist/chunk-xag86ng3.js.map +0 -10
  130. package/dist/chunk-xfdkep71.js +0 -371
  131. package/dist/chunk-xfdkep71.js.map +0 -11
  132. package/dist/chunk-xhm1rfpt.js +0 -2907
  133. package/dist/chunk-xhm1rfpt.js.map +0 -24
  134. package/dist/chunk-xpcps28p.js +0 -2138
  135. package/dist/chunk-xpcps28p.js.map +0 -29
  136. package/dist/chunk-yb4rbev9.js +0 -214
  137. package/dist/chunk-yb4rbev9.js.map +0 -10
@@ -1,58 +0,0 @@
1
- // @bun
2
- import"./chunk-h7bj5zwb.js";
3
- import {
4
- checkAgentAuth
5
- } from "./chunk-tcs9qjps.js";
6
- import"./chunk-7k19pcg8.js";
7
- import"./chunk-8dy7e2a9.js";
8
- import"./chunk-9hjeemfz.js";
9
- import"./chunk-1k7t7bnx.js";
10
- import"./chunk-xhm1rfpt.js";
11
- import"./chunk-mnwaext5.js";
12
- import"./chunk-xpcps28p.js";
13
- import"./chunk-fbtb3v0s.js";
14
- import"./chunk-ejcm6zx8.js";
15
- import"./chunk-hp4g7wx7.js";
16
- import"./chunk-s74rdyqe.js";
17
- import"./chunk-k778y16p.js";
18
- import"./chunk-xag86ng3.js";
19
- import"./chunk-wx83ep8e.js";
20
- import"./chunk-00q25k7p.js";
21
- import"./chunk-gaknyw04.js";
22
- import"./chunk-mh5mexsf.js";
23
- import {
24
- DATA_DIR,
25
- RUN_DIR,
26
- STATE_DIR,
27
- SUPPORTED_AGENTS,
28
- WORKSPACE_DIR
29
- } from "./chunk-ezs352qs.js";
30
- import"./chunk-j0kjscb7.js";
31
- import"./chunk-82qhv1mq.js";
32
- import"./chunk-ffefbd3r.js";
33
- import"./chunk-81tbfbmt.js";
34
- import"./chunk-sffqdkvq.js";
35
- import"./chunk-f5xgprg1.js";
36
- import"./chunk-hwy3n31w.js";
37
-
38
- // ../cli/src/commands/init.ts
39
- function initCommand() {
40
- console.log(`negotium node initialized
41
- `);
42
- console.log(` state: ${STATE_DIR}`);
43
- console.log(` data: ${DATA_DIR}`);
44
- console.log(` run: ${RUN_DIR}`);
45
- console.log(` workspace: ${WORKSPACE_DIR}
46
- `);
47
- console.log("agents:");
48
- for (const agent of SUPPORTED_AGENTS) {
49
- const auth = checkAgentAuth(agent);
50
- console.log(` ${agent.padEnd(8)} ${auth.ok ? "ready" : `unavailable \u2014 ${auth.error}`}`);
51
- }
52
- console.log("\nnext: `negotium chat` or `negotium serve`");
53
- }
54
- export {
55
- initCommand
56
- };
57
-
58
- //# debugId=96DD4A657C12258464756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../cli/src/commands/init.ts"],
4
- "sourcesContent": [
5
- "/** `negotium init` — bootstrap the node state dir and report agent auth. */\n\nimport {\n checkAgentAuth,\n DATA_DIR,\n RUN_DIR,\n STATE_DIR,\n SUPPORTED_AGENTS,\n WORKSPACE_DIR,\n} from \"@negotium/core\";\n\nexport function initCommand(): void {\n // Importing core already created the layout — this command makes it visible.\n console.log(\"negotium node initialized\\n\");\n console.log(` state: ${STATE_DIR}`);\n console.log(` data: ${DATA_DIR}`);\n console.log(` run: ${RUN_DIR}`);\n console.log(` workspace: ${WORKSPACE_DIR}\\n`);\n\n console.log(\"agents:\");\n for (const agent of SUPPORTED_AGENTS) {\n const auth = checkAgentAuth(agent);\n console.log(` ${agent.padEnd(8)} ${auth.ok ? \"ready\" : `unavailable — ${auth.error}`}`);\n }\n console.log(\"\\nnext: `negotium chat` or `negotium serve`\");\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,WAAW,GAAS;AAAA,EAElC,QAAQ,IAAI;AAAA,CAA6B;AAAA,EACzC,QAAQ,IAAI,gBAAgB,WAAW;AAAA,EACvC,QAAQ,IAAI,gBAAgB,UAAU;AAAA,EACtC,QAAQ,IAAI,gBAAgB,SAAS;AAAA,EACrC,QAAQ,IAAI,gBAAgB;AAAA,CAAiB;AAAA,EAE7C,QAAQ,IAAI,SAAS;AAAA,EACrB,WAAW,SAAS,kBAAkB;AAAA,IACpC,MAAM,OAAO,eAAe,KAAK;AAAA,IACjC,QAAQ,IAAI,KAAK,MAAM,OAAO,CAAC,KAAK,KAAK,KAAK,UAAU,sBAAgB,KAAK,SAAS;AAAA,EACxF;AAAA,EACA,QAAQ,IAAI,6CAA6C;AAAA;",
8
- "debugId": "96DD4A657C12258464756E2164756E21",
9
- "names": []
10
- }
@@ -1,33 +0,0 @@
1
- // ../../adapters/otium/src/protocol.ts
2
- var PEER_PROTOCOL_VERSION = 1;
3
- var MAX_PEER_MESSAGE_LENGTH = 1e4;
4
- var MAX_PEER_INPUT_FILE_BYTES = 2 * 1024 * 1024 * 1024;
5
- var MAX_PEER_INPUT_REQUEST_BYTES = MAX_PEER_INPUT_FILE_BYTES + 8 * 1024 * 1024;
6
- function str(body, field) {
7
- const value = body[field];
8
- return typeof value === "string" && value.trim() ? value : null;
9
- }
10
- function parseExecutionSpec(value) {
11
- if (!value || typeof value !== "object" || Array.isArray(value))
12
- return null;
13
- const raw = value;
14
- const agent = str(raw, "agent");
15
- const model = str(raw, "model");
16
- const effort = str(raw, "effort");
17
- const rawMcp = raw.mcp;
18
- if (!agent || !model || !effort || !Array.isArray(rawMcp) || !rawMcp.every((entry) => typeof entry === "string" && entry.trim().length > 0) || typeof raw.canSpawnSubagents !== "boolean") {
19
- return null;
20
- }
21
- return {
22
- agent,
23
- model,
24
- effort,
25
- ...str(raw, "description") ? { description: str(raw, "description") } : {},
26
- mcp: [...new Set(rawMcp.map((entry) => entry.trim()))],
27
- canSpawnSubagents: raw.canSpawnSubagents
28
- };
29
- }
30
-
31
- export { PEER_PROTOCOL_VERSION, MAX_PEER_MESSAGE_LENGTH, MAX_PEER_INPUT_FILE_BYTES, MAX_PEER_INPUT_REQUEST_BYTES, parseExecutionSpec };
32
-
33
- //# debugId=536F85318EA03AF964756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../adapters/otium/src/protocol.ts"],
4
- "sourcesContent": [
5
- "/**\n * otium peer protocol — payload shapes exchanged between workspace runtime\n * nodes. Field-for-field copy of otium's\n * `apps/runtime-api/src/peer/protocol.ts` (PEER_PROTOCOL_VERSION 1): the hub\n * trusts these shapes without schema validation, so this file must track the\n * otium side exactly.\n */\n\nexport const PEER_PROTOCOL_VERSION = 1;\n\nexport interface PeerFeatureCapabilities {\n remoteAsk: boolean;\n inputFiles: boolean;\n outputFiles: boolean;\n visualBridge: boolean;\n}\n\nexport const MAX_PEER_MESSAGE_LENGTH = 10_000;\nexport const MAX_PEER_INPUT_FILE_BYTES = 2 * 1024 * 1024 * 1024;\nexport const MAX_PEER_INPUT_REQUEST_BYTES = MAX_PEER_INPUT_FILE_BYTES + 8 * 1024 * 1024;\n\nexport interface PeerSessionEntry {\n topicId: string;\n name: string;\n agent: string | null;\n hasSession: boolean;\n description?: string;\n}\n\n/** Fully-resolved room configuration pinned by the hub for one worker turn.\n * The worker must not re-resolve these values from its hidden mirror topic. */\nexport interface PlacedTopicExecutionSpec {\n agent: string;\n model: string;\n effort: string;\n description?: string;\n /** Optional MCP whitelist after hub-side topic override resolution. */\n mcp: string[];\n /** Preserves the host room's real top-level delegation capability. */\n canSpawnSubagents: boolean;\n}\n\n/** Hub → worker: run one turn of a hub-hosted agent room. */\nexport interface PeerTurnRequest {\n v: number;\n requestId: string;\n userId: string;\n /** The hub's canonical topic id — the worker keys its hidden topic on it. */\n hostTopicId: string;\n /** Room title, mirrored onto the hidden topic so tell/ask by title works. */\n topicTitle: string;\n execution?: PlacedTopicExecutionSpec;\n /** Legacy additive fields accepted during rolling upgrades. */\n agent?: string;\n model?: string;\n effort?: string;\n /** File ids already copied into the worker hidden topic's upload store. */\n attachments?: string[];\n message: string;\n}\n\n/** Hub → worker: create/update the hidden mirror before the first turn. */\nexport interface PeerProvisionRequest {\n v: number;\n userId: string;\n hostTopicId: string;\n topicTitle: string;\n execution: PlacedTopicExecutionSpec;\n}\n\n/** Worker → hub: one coarse turn event, ordered by seq per requestId. */\nexport interface PeerEventRequest {\n v: number;\n requestId: string;\n seq: number;\n event: Record<string, unknown>;\n}\n\nfunction str(body: Record<string, unknown>, field: string): string | null {\n const value = body[field];\n return typeof value === \"string\" && value.trim() ? value : null;\n}\n\n/** Parse and normalize an inbound execution spec (mirrors otium routes.ts). */\nexport function parseExecutionSpec(value: unknown): PlacedTopicExecutionSpec | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n const raw = value as Record<string, unknown>;\n const agent = str(raw, \"agent\");\n const model = str(raw, \"model\");\n const effort = str(raw, \"effort\");\n const rawMcp = raw.mcp;\n if (\n !agent ||\n !model ||\n !effort ||\n !Array.isArray(rawMcp) ||\n !rawMcp.every((entry) => typeof entry === \"string\" && entry.trim().length > 0) ||\n typeof raw.canSpawnSubagents !== \"boolean\"\n ) {\n return null;\n }\n return {\n agent,\n model,\n effort,\n ...(str(raw, \"description\") ? { description: str(raw, \"description\") as string } : {}),\n mcp: [...new Set(rawMcp.map((entry) => entry.trim()))],\n canSpawnSubagents: raw.canSpawnSubagents,\n };\n}\n"
6
- ],
7
- "mappings": ";AAQO,IAAM,wBAAwB;AAS9B,IAAM,0BAA0B;AAChC,IAAM,4BAA4B,IAAI,OAAO,OAAO;AACpD,IAAM,+BAA+B,4BAA4B,IAAI,OAAO;AA2DnF,SAAS,GAAG,CAAC,MAA+B,OAA8B;AAAA,EACxE,MAAM,QAAQ,KAAK;AAAA,EACnB,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,IAAI,QAAQ;AAAA;AAItD,SAAS,kBAAkB,CAAC,OAAiD;AAAA,EAClF,KAAK,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK;AAAA,IAAG,OAAO;AAAA,EACxE,MAAM,MAAM;AAAA,EACZ,MAAM,QAAQ,IAAI,KAAK,OAAO;AAAA,EAC9B,MAAM,QAAQ,IAAI,KAAK,OAAO;AAAA,EAC9B,MAAM,SAAS,IAAI,KAAK,QAAQ;AAAA,EAChC,MAAM,SAAS,IAAI;AAAA,EACnB,KACG,UACA,UACA,WACA,MAAM,QAAQ,MAAM,MACpB,OAAO,MAAM,CAAC,UAAU,OAAO,UAAU,YAAY,MAAM,KAAK,EAAE,SAAS,CAAC,KAC7E,OAAO,IAAI,sBAAsB,WACjC;AAAA,IACA,OAAO;AAAA,EACT;AAAA,EACA,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,OACI,IAAI,KAAK,aAAa,IAAI,EAAE,aAAa,IAAI,KAAK,aAAa,EAAY,IAAI,CAAC;AAAA,IACpF,KAAK,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,CAAC,UAAU,MAAM,KAAK,CAAC,CAAC,CAAC;AAAA,IACrD,mBAAmB,IAAI;AAAA,EACzB;AAAA;",
8
- "debugId": "536F85318EA03AF964756E2164756E21",
9
- "names": []
10
- }
@@ -1,149 +0,0 @@
1
- // @bun
2
- import"./chunk-h7bj5zwb.js";
3
- import"./chunk-tcs9qjps.js";
4
- import"./chunk-7k19pcg8.js";
5
- import"./chunk-8dy7e2a9.js";
6
- import"./chunk-9hjeemfz.js";
7
- import"./chunk-1k7t7bnx.js";
8
- import"./chunk-xhm1rfpt.js";
9
- import"./chunk-mnwaext5.js";
10
- import"./chunk-xpcps28p.js";
11
- import"./chunk-fbtb3v0s.js";
12
- import"./chunk-ejcm6zx8.js";
13
- import"./chunk-hp4g7wx7.js";
14
- import"./chunk-s74rdyqe.js";
15
- import"./chunk-k778y16p.js";
16
- import"./chunk-xag86ng3.js";
17
- import"./chunk-wx83ep8e.js";
18
- import"./chunk-00q25k7p.js";
19
- import"./chunk-gaknyw04.js";
20
- import"./chunk-mh5mexsf.js";
21
- import"./chunk-ezs352qs.js";
22
- import"./chunk-j0kjscb7.js";
23
- import"./chunk-82qhv1mq.js";
24
- import {
25
- logger
26
- } from "./chunk-ffefbd3r.js";
27
- import"./chunk-81tbfbmt.js";
28
- import"./chunk-sffqdkvq.js";
29
- import"./chunk-f5xgprg1.js";
30
- import"./chunk-hwy3n31w.js";
31
-
32
- // ../../adapters/otium/src/central.ts
33
- var NODES_CACHE_MS = 30000;
34
- var VERIFY_CACHE_MS = 30000;
35
- var joinConfig = null;
36
- var nodesCache = null;
37
- var verifyCache = new Map;
38
- var tokenCache = new Map;
39
- function configureOtiumCentral(join) {
40
- joinConfig = join;
41
- resetPeerCentralCaches();
42
- }
43
- function otiumCentralConfig() {
44
- return joinConfig;
45
- }
46
- function centralFetch(path, init) {
47
- if (!joinConfig)
48
- throw new Error("otium: join credentials missing");
49
- return fetch(`${joinConfig.central}${path}`, {
50
- ...init,
51
- headers: {
52
- authorization: `Bearer ${joinConfig.secret}`,
53
- "content-type": "application/json",
54
- ...init.headers ?? {}
55
- },
56
- signal: AbortSignal.timeout(5000)
57
- });
58
- }
59
- async function listPeerNodes(opts = {}) {
60
- if (!opts.fresh && nodesCache && Date.now() - nodesCache.at < NODES_CACHE_MS) {
61
- return nodesCache.nodes;
62
- }
63
- const response = await centralFetch("/peer/nodes", { method: "GET" });
64
- const body = await response.json();
65
- if (!response.ok || !body.ok || !Array.isArray(body.nodes)) {
66
- throw new Error(`otium: node discovery failed: ${body.error ?? response.status}`);
67
- }
68
- nodesCache = { nodes: body.nodes, workspaceId: body.workspaceId ?? "", at: Date.now() };
69
- return body.nodes;
70
- }
71
- async function selfPeerNode() {
72
- const nodes = await listPeerNodes();
73
- return nodes.find((node) => node.self) ?? null;
74
- }
75
- async function resolvePeerNodeByCellId(cellId) {
76
- const find = (nodes) => nodes.find((node) => node.cellId === cellId) ?? null;
77
- const cached = find(await listPeerNodes());
78
- if (cached)
79
- return cached;
80
- return find(await listPeerNodes({ fresh: true }));
81
- }
82
- async function mintPeerToken(toCellId) {
83
- const cached = tokenCache.get(toCellId);
84
- if (cached && cached.expiresAtMs - Date.now() > 30000)
85
- return cached.token;
86
- const response = await centralFetch("/peer/token", {
87
- method: "POST",
88
- body: JSON.stringify({ toCellId })
89
- });
90
- const body = await response.json();
91
- if (!response.ok || !body.ok || !body.token) {
92
- throw new Error(`otium: peer token mint failed: ${body.error ?? response.status}`);
93
- }
94
- tokenCache.set(toCellId, {
95
- token: body.token,
96
- expiresAtMs: Date.parse(body.expiresAt ?? "") || Date.now() + 60000
97
- });
98
- return body.token;
99
- }
100
- async function verifyPeerToken(token) {
101
- const cached = verifyCache.get(token);
102
- if (cached && Date.now() - cached.at < VERIFY_CACHE_MS)
103
- return cached.verified;
104
- let response;
105
- try {
106
- response = await centralFetch("/peer/verify", {
107
- method: "POST",
108
- body: JSON.stringify({ token })
109
- });
110
- } catch (err) {
111
- logger.warn({ err }, "otium: central verify unreachable");
112
- return null;
113
- }
114
- const body = await response.json().catch(() => null);
115
- if (!response.ok || !body?.ok)
116
- return null;
117
- const verified = {
118
- workspaceId: body.workspaceId,
119
- fromCellId: body.fromCellId,
120
- fromNodeName: body.fromNodeName,
121
- fromIsPrimary: body.fromIsPrimary,
122
- expiresAt: body.expiresAt
123
- };
124
- verifyCache.set(token, { verified, at: Date.now() });
125
- for (const [key, entry] of verifyCache) {
126
- if (Date.now() - entry.at > VERIFY_CACHE_MS)
127
- verifyCache.delete(key);
128
- }
129
- return verified;
130
- }
131
- function resetPeerCentralCaches() {
132
- nodesCache = null;
133
- verifyCache.clear();
134
- tokenCache.clear();
135
- }
136
- export {
137
- verifyPeerToken,
138
- selfPeerNode,
139
- resolvePeerNodeByCellId,
140
- resetPeerCentralCaches,
141
- otiumCentralConfig,
142
- mintPeerToken,
143
- listPeerNodes,
144
- configureOtiumCentral
145
- };
146
-
147
- export { configureOtiumCentral, otiumCentralConfig, listPeerNodes, selfPeerNode, resolvePeerNodeByCellId, mintPeerToken, verifyPeerToken, resetPeerCentralCaches };
148
-
149
- //# debugId=FC91852260C865A864756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../adapters/otium/src/central.ts"],
4
- "sourcesContent": [
5
- "/**\n * Central peer API client — token mint/verify and node discovery for this\n * cell. Port of otium's `apps/runtime-api/src/peer/central.ts` (identical\n * cache policy) with `hostedRuntimeConfig()` replaced by the adapter's join\n * credentials. The cell secret never leaves this process; peers only ever see\n * the short-lived `ptk_…` tokens central mints here.\n */\n\nimport { logger } from \"@negotium/core\";\nimport type { OtiumJoin } from \"@/join\";\n\nexport interface PeerNode {\n cellId: string;\n nodeName: string | null;\n isPrimary: boolean;\n baseUrl: string;\n self: boolean;\n}\n\nexport interface VerifiedPeer {\n workspaceId: string;\n fromCellId: string;\n fromNodeName: string | null;\n fromIsPrimary: boolean;\n expiresAt: string;\n}\n\nconst NODES_CACHE_MS = 30_000;\n/** Positive verify cache — deliberately short so assignment revocation bites\n * within seconds, not the token TTL. */\nconst VERIFY_CACHE_MS = 30_000;\n\nlet joinConfig: OtiumJoin | null = null;\nlet nodesCache: { nodes: PeerNode[]; workspaceId: string; at: number } | null = null;\nconst verifyCache = new Map<string, { verified: VerifiedPeer; at: number }>();\nconst tokenCache = new Map<string, { token: string; expiresAtMs: number }>();\n\n/** Install (or clear) the join credentials every central call authenticates with. */\nexport function configureOtiumCentral(join: OtiumJoin | null): void {\n joinConfig = join;\n resetPeerCentralCaches();\n}\n\nexport function otiumCentralConfig(): OtiumJoin | null {\n return joinConfig;\n}\n\nfunction centralFetch(path: string, init: RequestInit): Promise<Response> {\n if (!joinConfig) throw new Error(\"otium: join credentials missing\");\n return fetch(`${joinConfig.central}${path}`, {\n ...init,\n headers: {\n authorization: `Bearer ${joinConfig.secret}`,\n \"content-type\": \"application/json\",\n ...(init.headers ?? {}),\n },\n signal: AbortSignal.timeout(5000),\n });\n}\n\n/** Active nodes of this cell's workspace (30s cache; pass fresh=true after a\n * resolution miss so a just-attached node is visible). */\nexport async function listPeerNodes(opts: { fresh?: boolean } = {}): Promise<PeerNode[]> {\n if (!opts.fresh && nodesCache && Date.now() - nodesCache.at < NODES_CACHE_MS) {\n return nodesCache.nodes;\n }\n const response = await centralFetch(\"/peer/nodes\", { method: \"GET\" });\n const body = (await response.json()) as {\n ok: boolean;\n error?: string;\n workspaceId?: string;\n nodes?: PeerNode[];\n };\n if (!response.ok || !body.ok || !Array.isArray(body.nodes)) {\n throw new Error(`otium: node discovery failed: ${body.error ?? response.status}`);\n }\n nodesCache = { nodes: body.nodes, workspaceId: body.workspaceId ?? \"\", at: Date.now() };\n return body.nodes;\n}\n\nexport async function selfPeerNode(): Promise<PeerNode | null> {\n const nodes = await listPeerNodes();\n return nodes.find((node) => node.self) ?? null;\n}\n\nexport async function resolvePeerNodeByCellId(cellId: string): Promise<PeerNode | null> {\n const find = (nodes: PeerNode[]) => nodes.find((node) => node.cellId === cellId) ?? null;\n const cached = find(await listPeerNodes());\n if (cached) return cached;\n return find(await listPeerNodes({ fresh: true }));\n}\n\n/** Mint (or reuse a still-fresh) peer token for one target cell. Tokens are\n * reusable within their TTL, so cache until shortly before expiry. */\nexport async function mintPeerToken(toCellId: string): Promise<string> {\n const cached = tokenCache.get(toCellId);\n if (cached && cached.expiresAtMs - Date.now() > 30_000) return cached.token;\n const response = await centralFetch(\"/peer/token\", {\n method: \"POST\",\n body: JSON.stringify({ toCellId }),\n });\n const body = (await response.json()) as {\n ok: boolean;\n error?: string;\n token?: string;\n expiresAt?: string;\n };\n if (!response.ok || !body.ok || !body.token) {\n throw new Error(`otium: peer token mint failed: ${body.error ?? response.status}`);\n }\n tokenCache.set(toCellId, {\n token: body.token,\n expiresAtMs: Date.parse(body.expiresAt ?? \"\") || Date.now() + 60_000,\n });\n return body.token;\n}\n\n/** Verify an inbound peer token against central (fail-closed on outages). */\nexport async function verifyPeerToken(token: string): Promise<VerifiedPeer | null> {\n const cached = verifyCache.get(token);\n if (cached && Date.now() - cached.at < VERIFY_CACHE_MS) return cached.verified;\n let response: Response;\n try {\n response = await centralFetch(\"/peer/verify\", {\n method: \"POST\",\n body: JSON.stringify({ token }),\n });\n } catch (err) {\n logger.warn({ err }, \"otium: central verify unreachable\");\n return null;\n }\n const body = (await response.json().catch(() => null)) as (VerifiedPeer & { ok: boolean }) | null;\n if (!response.ok || !body?.ok) return null;\n const verified: VerifiedPeer = {\n workspaceId: body.workspaceId,\n fromCellId: body.fromCellId,\n fromNodeName: body.fromNodeName,\n fromIsPrimary: body.fromIsPrimary,\n expiresAt: body.expiresAt,\n };\n verifyCache.set(token, { verified, at: Date.now() });\n // Opportunistic sweep — the cache only ever holds a handful of live tokens.\n for (const [key, entry] of verifyCache) {\n if (Date.now() - entry.at > VERIFY_CACHE_MS) verifyCache.delete(key);\n }\n return verified;\n}\n\n/** Test hook — caches are module singletons. */\nexport function resetPeerCentralCaches(): void {\n nodesCache = null;\n verifyCache.clear();\n tokenCache.clear();\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAA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AAAA,IACD,OAAO,KAAK;AAAA,IACZ,OAAO,KAAK,EAAE,IAAI,GAAG,mCAAmC;AAAA,IACxD,OAAO;AAAA;AAAA,EAET,MAAM,OAAQ,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AAAA,EACpD,KAAK,SAAS,OAAO,MAAM;AAAA,IAAI,OAAO;AAAA,EACtC,MAAM,WAAyB;AAAA,IAC7B,aAAa,KAAK;AAAA,IAClB,YAAY,KAAK;AAAA,IACjB,cAAc,KAAK;AAAA,IACnB,eAAe,KAAK;AAAA,IACpB,WAAW,KAAK;AAAA,EAClB;AAAA,EACA,YAAY,IAAI,OAAO,EAAE,UAAU,IAAI,KAAK,IAAI,EAAE,CAAC;AAAA,EAEnD,YAAY,KAAK,UAAU,aAAa;AAAA,IACtC,IAAI,KAAK,IAAI,IAAI,MAAM,KAAK;AAAA,MAAiB,YAAY,OAAO,GAAG;AAAA,EACrE;AAAA,EACA,OAAO;AAAA;AAIF,SAAS,sBAAsB,GAAS;AAAA,EAC7C,aAAa;AAAA,EACb,YAAY,MAAM;AAAA,EAClB,WAAW,MAAM;AAAA;",
8
- "debugId": "FC91852260C865A864756E2164756E21",
9
- "names": []
10
- }
@@ -1,53 +0,0 @@
1
- // @bun
2
- import"./chunk-h7bj5zwb.js";
3
- import"./chunk-tcs9qjps.js";
4
- import"./chunk-7k19pcg8.js";
5
- import"./chunk-8dy7e2a9.js";
6
- import"./chunk-9hjeemfz.js";
7
- import"./chunk-1k7t7bnx.js";
8
- import"./chunk-xhm1rfpt.js";
9
- import {
10
- getVisibleTopics
11
- } from "./chunk-mnwaext5.js";
12
- import"./chunk-xpcps28p.js";
13
- import"./chunk-fbtb3v0s.js";
14
- import"./chunk-ejcm6zx8.js";
15
- import"./chunk-hp4g7wx7.js";
16
- import"./chunk-s74rdyqe.js";
17
- import"./chunk-k778y16p.js";
18
- import"./chunk-xag86ng3.js";
19
- import"./chunk-wx83ep8e.js";
20
- import"./chunk-00q25k7p.js";
21
- import"./chunk-gaknyw04.js";
22
- import"./chunk-mh5mexsf.js";
23
- import"./chunk-ezs352qs.js";
24
- import"./chunk-j0kjscb7.js";
25
- import"./chunk-82qhv1mq.js";
26
- import"./chunk-ffefbd3r.js";
27
- import"./chunk-81tbfbmt.js";
28
- import"./chunk-sffqdkvq.js";
29
- import"./chunk-f5xgprg1.js";
30
- import"./chunk-hwy3n31w.js";
31
-
32
- // ../cli/src/commands/topics.ts
33
- function topicsCommand() {
34
- const topics = getVisibleTopics();
35
- if (topics.length === 0) {
36
- console.log("no topics yet \u2014 `negotium chat <name>` creates one");
37
- return;
38
- }
39
- for (const t of topics) {
40
- const model = t.effectiveModel ?? t.defaultModel;
41
- const flags = [
42
- t.accessMode ?? "private",
43
- t.isSubagent ? "subagent" : null,
44
- t.isFork ? "fork" : null
45
- ].filter(Boolean).join(",");
46
- console.log(`${t.title} ${t.agent ?? "no-ai"}${model ? `/${model}` : ""}` + `${flags ? ` [${flags}]` : ""} ${t.id}`);
47
- }
48
- }
49
- export {
50
- topicsCommand
51
- };
52
-
53
- //# debugId=8E6DF411A239125A64756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../cli/src/commands/topics.ts"],
4
- "sourcesContent": [
5
- "/** `negotium topics` — list topics on this node. */\n\nimport { getVisibleTopics } from \"@negotium/core\";\n\nexport function topicsCommand(): void {\n const topics = getVisibleTopics();\n if (topics.length === 0) {\n console.log(\"no topics yet — `negotium chat <name>` creates one\");\n return;\n }\n for (const t of topics) {\n const model = t.effectiveModel ?? t.defaultModel;\n const flags = [\n t.accessMode ?? \"private\",\n t.isSubagent ? \"subagent\" : null,\n t.isFork ? \"fork\" : null,\n ]\n .filter(Boolean)\n .join(\",\");\n console.log(\n `${t.title} ${t.agent ?? \"no-ai\"}${model ? `/${model}` : \"\"}` +\n `${flags ? ` [${flags}]` : \"\"} ${t.id}`,\n );\n }\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,aAAa,GAAS;AAAA,EACpC,MAAM,SAAS,iBAAiB;AAAA,EAChC,IAAI,OAAO,WAAW,GAAG;AAAA,IACvB,QAAQ,IAAI,yDAAmD;AAAA,IAC/D;AAAA,EACF;AAAA,EACA,WAAW,KAAK,QAAQ;AAAA,IACtB,MAAM,QAAQ,EAAE,kBAAkB,EAAE;AAAA,IACpC,MAAM,QAAQ;AAAA,MACZ,EAAE,cAAc;AAAA,MAChB,EAAE,aAAa,aAAa;AAAA,MAC5B,EAAE,SAAS,SAAS;AAAA,IACtB,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,IACX,QAAQ,IACN,GAAG,EAAE,UAAU,EAAE,SAAS,UAAU,QAAQ,IAAI,UAAU,OACxD,GAAG,QAAQ,MAAM,WAAW,OAAO,EAAE,IACzC;AAAA,EACF;AAAA;",
8
- "debugId": "8E6DF411A239125A64756E2164756E21",
9
- "names": []
10
- }
@@ -1,61 +0,0 @@
1
- // @bun
2
- import {
3
- loadOtiumCli,
4
- loadTelegramCli,
5
- loadTerminalCli
6
- } from "./chunk-nkgs40ch.js";
7
- import"./chunk-hwy3n31w.js";
8
-
9
- // ../cli/src/commands/adapters.ts
10
- function selectedAdapter(args) {
11
- const withArg = args.find((arg) => arg.startsWith("--with="))?.slice("--with=".length);
12
- const requested = [
13
- ...withArg?.split(",") ?? [],
14
- ...args.filter((arg) => !arg.startsWith("--"))
15
- ].filter(Boolean);
16
- if (requested.includes("all") || requested.length > 1) {
17
- throw new Error("adapters run as independent processes; start terminal, telegram, and otium in separate shells");
18
- }
19
- const requestedName = requested[0];
20
- if (requestedName === "terminal" || requestedName === "telegram" || requestedName === "otium") {
21
- return requestedName;
22
- }
23
- if (requestedName)
24
- throw new Error(`unknown adapter: ${requestedName}`);
25
- if (process.stdin.isTTY && process.stdout.isTTY)
26
- return "terminal";
27
- if (process.env.TELEGRAM_BOT_TOKEN?.trim())
28
- return "telegram";
29
- if (process.env.OTIUM_CENTRAL_URL?.trim() || process.env.OTIUM_CELL_ID?.trim() || process.env.OTIUM_CELL_SECRET?.trim()) {
30
- return "otium";
31
- }
32
- throw new Error("no adapter selected; pass terminal, telegram, or otium");
33
- }
34
- function terminalArgs(args) {
35
- return args.filter((arg) => arg !== "terminal" && !arg.startsWith("--with="));
36
- }
37
- async function adaptersCommand(args) {
38
- const adapter = selectedAdapter(args);
39
- switch (adapter) {
40
- case "terminal": {
41
- const { runTerminalCli } = await loadTerminalCli();
42
- await runTerminalCli(terminalArgs(args));
43
- break;
44
- }
45
- case "telegram": {
46
- const { runTelegramCli } = await loadTelegramCli();
47
- await runTelegramCli();
48
- break;
49
- }
50
- case "otium": {
51
- const { runOtiumCli } = await loadOtiumCli();
52
- await runOtiumCli(["serve"]);
53
- break;
54
- }
55
- }
56
- }
57
- export {
58
- adaptersCommand
59
- };
60
-
61
- //# debugId=A8A2C31BC0A3B00D64756E2164756E21
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../cli/src/commands/adapters.ts"],
4
- "sourcesContent": [
5
- "type AdapterName = \"terminal\" | \"telegram\" | \"otium\";\n\nimport { loadOtiumCli, loadTelegramCli, loadTerminalCli } from \"@/adapter-loader\";\n\nfunction selectedAdapter(args: string[]): AdapterName {\n const withArg = args.find((arg) => arg.startsWith(\"--with=\"))?.slice(\"--with=\".length);\n const requested = [\n ...(withArg?.split(\",\") ?? []),\n ...args.filter((arg) => !arg.startsWith(\"--\")),\n ].filter(Boolean);\n\n if (requested.includes(\"all\") || requested.length > 1) {\n throw new Error(\n \"adapters run as independent processes; start terminal, telegram, and otium in separate shells\",\n );\n }\n\n const requestedName = requested[0];\n if (requestedName === \"terminal\" || requestedName === \"telegram\" || requestedName === \"otium\") {\n return requestedName;\n }\n if (requestedName) throw new Error(`unknown adapter: ${requestedName}`);\n\n if (process.stdin.isTTY && process.stdout.isTTY) return \"terminal\";\n if (process.env.TELEGRAM_BOT_TOKEN?.trim()) return \"telegram\";\n if (\n process.env.OTIUM_CENTRAL_URL?.trim() ||\n process.env.OTIUM_CELL_ID?.trim() ||\n process.env.OTIUM_CELL_SECRET?.trim()\n ) {\n return \"otium\";\n }\n throw new Error(\"no adapter selected; pass terminal, telegram, or otium\");\n}\n\nfunction terminalArgs(args: string[]): string[] {\n return args.filter((arg) => arg !== \"terminal\" && !arg.startsWith(\"--with=\"));\n}\n\n/**\n * Start one channel in this process. Terminal is a short-lived client of the\n * state directory's long-lived node; the other adapters retain their own host\n * lifecycle until they migrate to the same control boundary.\n */\nexport async function adaptersCommand(args: string[]): Promise<void> {\n const adapter = selectedAdapter(args);\n switch (adapter) {\n case \"terminal\": {\n const { runTerminalCli } = await loadTerminalCli();\n await runTerminalCli(terminalArgs(args));\n break;\n }\n case \"telegram\": {\n const { runTelegramCli } = await loadTelegramCli();\n await runTelegramCli();\n break;\n }\n case \"otium\": {\n const { runOtiumCli } = await loadOtiumCli();\n await runOtiumCli([\"serve\"]);\n break;\n }\n }\n}\n"
6
- ],
7
- "mappings": ";;;;;;;;;AAIA,SAAS,eAAe,CAAC,MAA6B;AAAA,EACpD,MAAM,UAAU,KAAK,KAAK,CAAC,QAAQ,IAAI,WAAW,SAAS,CAAC,GAAG,MAAM,UAAU,MAAM;AAAA,EACrF,MAAM,YAAY;AAAA,IAChB,GAAI,SAAS,MAAM,GAAG,KAAK,CAAC;AAAA,IAC5B,GAAG,KAAK,OAAO,CAAC,SAAS,IAAI,WAAW,IAAI,CAAC;AAAA,EAC/C,EAAE,OAAO,OAAO;AAAA,EAEhB,IAAI,UAAU,SAAS,KAAK,KAAK,UAAU,SAAS,GAAG;AAAA,IACrD,MAAM,IAAI,MACR,+FACF;AAAA,EACF;AAAA,EAEA,MAAM,gBAAgB,UAAU;AAAA,EAChC,IAAI,kBAAkB,cAAc,kBAAkB,cAAc,kBAAkB,SAAS;AAAA,IAC7F,OAAO;AAAA,EACT;AAAA,EACA,IAAI;AAAA,IAAe,MAAM,IAAI,MAAM,oBAAo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