negotium 0.3.10 → 0.3.12
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 +53 -17
- package/dist/main.js.map +5 -5
- 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/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
|
@@ -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.
|
|
1872
|
+
var NEGOTIUM_VERSION = "0.3.12";
|
|
1873
1873
|
|
|
1874
1874
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
1875
1875
|
import { spawn } from "child_process";
|
|
@@ -46086,10 +46086,14 @@ function option2(args, name) {
|
|
|
46086
46086
|
const index = args.indexOf(`--${name}`);
|
|
46087
46087
|
return index >= 0 ? args[index + 1]?.trim() : undefined;
|
|
46088
46088
|
}
|
|
46089
|
-
function
|
|
46090
|
-
const normalized =
|
|
46089
|
+
function normalizeNodeNameCandidate(raw) {
|
|
46090
|
+
const normalized = raw.trim().toLowerCase().replace(/\.local$/, "").replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "").slice(0, 32).replace(/[-._]+$/g, "");
|
|
46091
46091
|
return normalized || undefined;
|
|
46092
46092
|
}
|
|
46093
|
+
function localNodeNameDefault() {
|
|
46094
|
+
const configured = process.env.NEGOTIUM_NODE_NAME?.trim();
|
|
46095
|
+
return configured && normalizeNodeNameCandidate(configured) || normalizeNodeNameCandidate(hostname2());
|
|
46096
|
+
}
|
|
46093
46097
|
async function confirmEnrollment(message) {
|
|
46094
46098
|
if (!process.stdin.isTTY)
|
|
46095
46099
|
return false;
|
|
@@ -46190,8 +46194,30 @@ var init_join_cli = __esm(async () => {
|
|
|
46190
46194
|
var exports_sidecar = {};
|
|
46191
46195
|
__export(exports_sidecar, {
|
|
46192
46196
|
runOtiumSidecar: () => runOtiumSidecar,
|
|
46197
|
+
resolveTunnelTargets: () => resolveTunnelTargets,
|
|
46193
46198
|
proxyOtiumPeerRequest: () => proxyOtiumPeerRequest
|
|
46194
46199
|
});
|
|
46200
|
+
function withCellId(base, cellId) {
|
|
46201
|
+
return {
|
|
46202
|
+
info: (obj, msg) => base.info({ ...obj, cellId }, msg),
|
|
46203
|
+
warn: (obj, msg) => base.warn({ ...obj, cellId }, msg),
|
|
46204
|
+
error: (obj, msg) => base.error({ ...obj, cellId }, msg)
|
|
46205
|
+
};
|
|
46206
|
+
}
|
|
46207
|
+
function resolveTunnelTargets(joins, relayOverride) {
|
|
46208
|
+
const targets = [];
|
|
46209
|
+
const skippedNoRelay = [];
|
|
46210
|
+
const envRelay = process.env.OTIUM_RELAY_URL?.trim();
|
|
46211
|
+
for (const join44 of joins) {
|
|
46212
|
+
const relayUrl = relayOverride?.trim() || join44.relay || envRelay;
|
|
46213
|
+
if (!relayUrl) {
|
|
46214
|
+
skippedNoRelay.push(join44.cellId);
|
|
46215
|
+
continue;
|
|
46216
|
+
}
|
|
46217
|
+
targets.push({ cellId: join44.cellId, relayUrl, secret: join44.secret });
|
|
46218
|
+
}
|
|
46219
|
+
return { targets, skippedNoRelay };
|
|
46220
|
+
}
|
|
46195
46221
|
function isPublicPeerPath(pathname) {
|
|
46196
46222
|
return pathname === "/ready" || pathname.startsWith("/api/v1/peer/");
|
|
46197
46223
|
}
|
|
@@ -46225,8 +46251,8 @@ async function proxyOtiumPeerRequest(req, dependencies = {}) {
|
|
|
46225
46251
|
}
|
|
46226
46252
|
}
|
|
46227
46253
|
async function runOtiumSidecar(options) {
|
|
46228
|
-
const
|
|
46229
|
-
if (
|
|
46254
|
+
const joins = loadJoins();
|
|
46255
|
+
if (joins.length === 0) {
|
|
46230
46256
|
throw new Error("not joined to an Otium workspace \u2014 run `negotium otium join <code>` first");
|
|
46231
46257
|
}
|
|
46232
46258
|
const initialNode = await inspectNodeDaemon();
|
|
@@ -46258,24 +46284,34 @@ async function runOtiumSidecar(options) {
|
|
|
46258
46284
|
lease.stop();
|
|
46259
46285
|
throw error2;
|
|
46260
46286
|
}
|
|
46261
|
-
const
|
|
46262
|
-
const
|
|
46263
|
-
|
|
46264
|
-
|
|
46265
|
-
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46269
|
-
|
|
46287
|
+
const { targets, skippedNoRelay } = resolveTunnelTargets(joins, options.relayUrl);
|
|
46288
|
+
const tunnels = new Map;
|
|
46289
|
+
for (const target of targets) {
|
|
46290
|
+
tunnels.set(target.cellId, new TunnelClient({
|
|
46291
|
+
relayUrl: target.relayUrl,
|
|
46292
|
+
token: target.secret,
|
|
46293
|
+
targetOrigin: `http://127.0.0.1:${server.port}`,
|
|
46294
|
+
nodeVersion: `negotium@${NEGOTIUM_VERSION}`,
|
|
46295
|
+
logger: withCellId(logger, target.cellId)
|
|
46296
|
+
}));
|
|
46297
|
+
}
|
|
46298
|
+
if (skippedNoRelay.length > 0) {
|
|
46299
|
+
logger.warn({ cellIds: skippedNoRelay }, "otium sidecar: no relay URL for these joined workspaces; they have no tunnel and will not be reachable");
|
|
46300
|
+
}
|
|
46301
|
+
for (const tunnel of tunnels.values())
|
|
46302
|
+
tunnel.start();
|
|
46270
46303
|
let resolveCompleted;
|
|
46271
46304
|
const completed = new Promise((resolve27) => {
|
|
46272
46305
|
resolveCompleted = resolve27;
|
|
46273
46306
|
});
|
|
46274
46307
|
onShutdown("otium-sidecar-server", 130, () => server?.stop(true));
|
|
46275
|
-
onShutdown("otium-sidecar-tunnel", 120, () =>
|
|
46308
|
+
onShutdown("otium-sidecar-tunnel", 120, () => {
|
|
46309
|
+
for (const tunnel of tunnels.values())
|
|
46310
|
+
tunnel.stop();
|
|
46311
|
+
});
|
|
46276
46312
|
onShutdown("otium-sidecar-lease", 110, () => lease.stop());
|
|
46277
46313
|
onShutdown("otium-sidecar-completed", -100, resolveCompleted);
|
|
46278
|
-
process.stdout.write(`negotium Otium adapter listening on 127.0.0.1:${server.port} (canonical node pid ${initialNode.info?.pid})
|
|
46314
|
+
process.stdout.write(`negotium Otium adapter listening on 127.0.0.1:${server.port} (canonical node pid ${initialNode.info?.pid}, ${tunnels.size}/${joins.length} workspace tunnel${joins.length === 1 ? "" : "s"} started)
|
|
46279
46315
|
`);
|
|
46280
46316
|
await completed;
|
|
46281
46317
|
}
|
|
@@ -47195,4 +47231,4 @@ switch (command) {
|
|
|
47195
47231
|
}
|
|
47196
47232
|
}
|
|
47197
47233
|
|
|
47198
|
-
//# debugId=
|
|
47234
|
+
//# debugId=555568B5D7BF77D064756E2164756E21
|