negotium 0.2.21 → 0.2.22
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/agent-helpers.js +2 -2
- package/dist/agent-helpers.js.map +2 -2
- package/dist/hosted-agent.js +2 -2
- package/dist/hosted-agent.js.map +2 -2
- package/dist/main.js +77 -3
- package/dist/main.js.map +8 -7
- package/dist/mcp-factories.js +2 -2
- package/dist/mcp-factories.js.map +2 -2
- package/dist/registry.js +2 -2
- package/dist/registry.js.map +2 -2
- package/dist/runtime/src/node-host.ts +1 -1
- package/dist/runtime/src/version.ts +1 -1
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1867,7 +1867,7 @@ var exports_version = {};
|
|
|
1867
1867
|
__export(exports_version, {
|
|
1868
1868
|
NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
|
|
1869
1869
|
});
|
|
1870
|
-
var NEGOTIUM_VERSION = "0.2.
|
|
1870
|
+
var NEGOTIUM_VERSION = "0.2.22";
|
|
1871
1871
|
|
|
1872
1872
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
1873
1873
|
import { spawn } from "child_process";
|
|
@@ -22842,6 +22842,7 @@ __export(exports_node_host, {
|
|
|
22842
22842
|
killOwnedCodexTreesForShutdown: () => killOwnedCodexTreesForShutdown,
|
|
22843
22843
|
killAllPlaywright: () => killAllPlaywright,
|
|
22844
22844
|
killAllBgBash: () => killAllBgBash,
|
|
22845
|
+
isTopicShared: () => isTopicShared,
|
|
22845
22846
|
isParticipant: () => isParticipant,
|
|
22846
22847
|
getVisibleTopics: () => getVisibleTopics,
|
|
22847
22848
|
getTopicStats: () => getTopicStats,
|
|
@@ -29440,7 +29441,8 @@ function createNodeControlHandler(options) {
|
|
|
29440
29441
|
"turn-submit-idempotent",
|
|
29441
29442
|
"turn-events-sse-resume",
|
|
29442
29443
|
"canonical-topic-read",
|
|
29443
|
-
"canonical-message-read"
|
|
29444
|
+
"canonical-message-read",
|
|
29445
|
+
"canonical-topic-list"
|
|
29444
29446
|
],
|
|
29445
29447
|
cursor: latestRuntimeEventSeq()
|
|
29446
29448
|
});
|
|
@@ -29504,6 +29506,19 @@ function createNodeControlHandler(options) {
|
|
|
29504
29506
|
});
|
|
29505
29507
|
return Response.json({ ok: true, v: NODE_RUNTIME_CONTRACT_VERSION, ...result });
|
|
29506
29508
|
}
|
|
29509
|
+
if (req.method === "GET" && runtimePath === "/topics") {
|
|
29510
|
+
const accessMode = url.searchParams.get("accessMode")?.trim();
|
|
29511
|
+
if (accessMode && accessMode !== "shared" && accessMode !== "private") {
|
|
29512
|
+
return jsonError(400, "accessMode must be 'shared' or 'private'");
|
|
29513
|
+
}
|
|
29514
|
+
const topics = getVisibleTopics().filter((topic) => accessMode === "shared" ? isTopicShared(topic) : accessMode === "private" ? !isTopicShared(topic) : true);
|
|
29515
|
+
return Response.json({
|
|
29516
|
+
ok: true,
|
|
29517
|
+
v: NODE_RUNTIME_CONTRACT_VERSION,
|
|
29518
|
+
topics,
|
|
29519
|
+
cursor: latestRuntimeEventSeq()
|
|
29520
|
+
});
|
|
29521
|
+
}
|
|
29507
29522
|
const runtimeTopicMatch = runtimePath.match(/^\/topics\/([^/]+)$/);
|
|
29508
29523
|
if (runtimeTopicMatch && req.method === "GET") {
|
|
29509
29524
|
const topic = getTopic(decodeURIComponent(runtimeTopicMatch[1]));
|
|
@@ -44850,6 +44865,48 @@ var init_enrollment = __esm(async () => {
|
|
|
44850
44865
|
INFO = Buffer.from("otium-node-enrollment-v1", "utf8");
|
|
44851
44866
|
});
|
|
44852
44867
|
|
|
44868
|
+
// ../../adapters/otium/src/gateway-forward.ts
|
|
44869
|
+
function allowedRuntimePath(path, method) {
|
|
44870
|
+
if (method === "GET") {
|
|
44871
|
+
if (path === "/health" || path === "/events" || path === "/topics")
|
|
44872
|
+
return true;
|
|
44873
|
+
return /^\/topics\/[^/]+(\/messages)?$/.test(path);
|
|
44874
|
+
}
|
|
44875
|
+
if (method === "POST")
|
|
44876
|
+
return path === "/turns";
|
|
44877
|
+
return false;
|
|
44878
|
+
}
|
|
44879
|
+
async function forwardGatewayRequest(req, options) {
|
|
44880
|
+
const url = new URL(req.url);
|
|
44881
|
+
if (!url.pathname.startsWith(OTIUM_GATEWAY_FORWARD_PREFIX))
|
|
44882
|
+
return null;
|
|
44883
|
+
const runtimePath = url.pathname.slice(OTIUM_GATEWAY_FORWARD_PREFIX.length) || "/";
|
|
44884
|
+
if (!allowedRuntimePath(runtimePath, req.method)) {
|
|
44885
|
+
return Response.json({ ok: false, error: "gateway route not forwarded" }, { status: 404 });
|
|
44886
|
+
}
|
|
44887
|
+
const target = new URL(`${options.nodeOrigin.replace(/\/+$/, "")}${RUNTIME_CONTRACT_PATH}${runtimePath}`);
|
|
44888
|
+
target.search = url.search;
|
|
44889
|
+
const headers = new Headers(req.headers);
|
|
44890
|
+
headers.set("authorization", `Bearer ${NODE_CONTROL_TOKEN}`);
|
|
44891
|
+
headers.delete("transfer-encoding");
|
|
44892
|
+
headers.delete("content-length");
|
|
44893
|
+
headers.delete("host");
|
|
44894
|
+
const body = req.method === "GET" || req.method === "HEAD" ? undefined : await req.arrayBuffer();
|
|
44895
|
+
if (body)
|
|
44896
|
+
headers.set("content-length", String(body.byteLength));
|
|
44897
|
+
const fetchRequest = options.fetch ?? fetch;
|
|
44898
|
+
return fetchRequest(new Request(target.toString(), {
|
|
44899
|
+
method: req.method,
|
|
44900
|
+
headers,
|
|
44901
|
+
body,
|
|
44902
|
+
signal: req.signal
|
|
44903
|
+
}));
|
|
44904
|
+
}
|
|
44905
|
+
var RUNTIME_CONTRACT_PATH = "/api/v1/control/runtime/v1", OTIUM_GATEWAY_FORWARD_PREFIX = "/api/v1/peer/runtime";
|
|
44906
|
+
var init_gateway_forward = __esm(async () => {
|
|
44907
|
+
await init_src();
|
|
44908
|
+
});
|
|
44909
|
+
|
|
44853
44910
|
// ../../adapters/otium/src/turn-bridge.ts
|
|
44854
44911
|
import { randomUUID as randomUUID32 } from "crypto";
|
|
44855
44912
|
function executionFor(payload) {
|
|
@@ -45649,6 +45706,22 @@ async function handleOtiumPeerRequest(req) {
|
|
|
45649
45706
|
}
|
|
45650
45707
|
if (!path.startsWith("/api/v1/peer/"))
|
|
45651
45708
|
return null;
|
|
45709
|
+
if (path.startsWith(OTIUM_GATEWAY_FORWARD_PREFIX)) {
|
|
45710
|
+
const peer = await requirePeer(req);
|
|
45711
|
+
if (!peer.ok)
|
|
45712
|
+
return peer.response;
|
|
45713
|
+
const notPrimary = requirePrimaryOrigin(peer);
|
|
45714
|
+
if (notPrimary)
|
|
45715
|
+
return notPrimary;
|
|
45716
|
+
const { inspectNodeDaemon: inspectNodeDaemon2 } = await init_src5().then(() => exports_src3);
|
|
45717
|
+
const node = await inspectNodeDaemon2();
|
|
45718
|
+
if (!node.running || !node.info) {
|
|
45719
|
+
return jsonError2("canonical Negotium node is unavailable", 503);
|
|
45720
|
+
}
|
|
45721
|
+
return forwardGatewayRequest(req, {
|
|
45722
|
+
nodeOrigin: `http://127.0.0.1:${node.info.port}`
|
|
45723
|
+
});
|
|
45724
|
+
}
|
|
45652
45725
|
if (req.method === "GET") {
|
|
45653
45726
|
if (path === "/api/v1/peer/capabilities") {
|
|
45654
45727
|
const peer = await requirePeer(req);
|
|
@@ -45702,6 +45775,7 @@ var init_peer_server = __esm(async () => {
|
|
|
45702
45775
|
await init_src();
|
|
45703
45776
|
await init_bindings();
|
|
45704
45777
|
await init_central();
|
|
45778
|
+
await init_gateway_forward();
|
|
45705
45779
|
await init_peer_files();
|
|
45706
45780
|
init_protocol();
|
|
45707
45781
|
await init_session_bridge();
|
|
@@ -47010,4 +47084,4 @@ switch (command) {
|
|
|
47010
47084
|
}
|
|
47011
47085
|
}
|
|
47012
47086
|
|
|
47013
|
-
//# debugId=
|
|
47087
|
+
//# debugId=31C48E669F9A292A64756E2164756E21
|