negotium 0.3.4 → 0.3.6

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.4";
1872
+ var NEGOTIUM_VERSION = "0.3.6";
1873
1873
 
1874
1874
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
1875
1875
  import { spawn } from "child_process";
@@ -18122,39 +18122,30 @@ import { dirname as dirname14, join as join27 } from "path";
18122
18122
  function settingsFile() {
18123
18123
  return join27(resolveStorageDataDir(), "otium-settings.json");
18124
18124
  }
18125
- function ensureSettingsLoaded() {
18125
+ function getGlobalAiName() {
18126
18126
  const path = settingsFile();
18127
- if (loadedSettingsFile === path)
18128
- return path;
18129
- loadedSettingsFile = path;
18130
- aiName = DEFAULT_AI_NAME;
18131
18127
  try {
18132
18128
  if (existsSync18(path)) {
18133
18129
  const data = JSON.parse(readFileSync16(path, "utf8"));
18134
18130
  if (typeof data.aiName === "string" && data.aiName.trim()) {
18135
- aiName = data.aiName.trim();
18131
+ return data.aiName.trim();
18136
18132
  }
18137
18133
  }
18138
18134
  } catch {}
18139
- return path;
18140
- }
18141
- function getGlobalAiName() {
18142
- ensureSettingsLoaded();
18143
- return aiName || DEFAULT_AI_NAME;
18135
+ return DEFAULT_AI_NAME;
18144
18136
  }
18145
18137
  function setGlobalAiName(name) {
18146
- const path = ensureSettingsLoaded();
18147
- aiName = name.trim() || DEFAULT_AI_NAME;
18138
+ const path = settingsFile();
18139
+ const aiName = name.trim() || DEFAULT_AI_NAME;
18148
18140
  try {
18149
18141
  mkdirSync18(dirname14(path), { recursive: true });
18150
18142
  writeFileSync16(path, JSON.stringify({ aiName }, null, 2));
18151
18143
  } catch {}
18152
18144
  return aiName;
18153
18145
  }
18154
- var DEFAULT_AI_NAME = "Otium", aiName, loadedSettingsFile = null;
18146
+ var DEFAULT_AI_NAME = "Otium";
18155
18147
  var init_app_settings = __esm(async () => {
18156
18148
  await init_storage_host();
18157
- aiName = DEFAULT_AI_NAME;
18158
18149
  });
18159
18150
 
18160
18151
  // ../../packages/core/src/runtime/turn-runner.ts
@@ -22672,6 +22663,7 @@ __export(exports_src, {
22672
22663
  setRuntimeBus: () => setRuntimeBus,
22673
22664
  setPlaywrightUnavailableNotifier: () => setPlaywrightUnavailableNotifier,
22674
22665
  setNodeMcpServers: () => setNodeMcpServers,
22666
+ setGlobalAiName: () => setGlobalAiName,
22675
22667
  setFileHooks: () => setFileHooks,
22676
22668
  setDefaultSurfaceScope: () => setDefaultSurfaceScope,
22677
22669
  setBashrsCompletionSink: () => setBashrsCompletionSink,
@@ -22862,6 +22854,7 @@ __export(exports_src, {
22862
22854
  FROM_AUTO_CONTINUE: () => FROM_AUTO_CONTINUE,
22863
22855
  EFFORT_VALUES: () => EFFORT_VALUES,
22864
22856
  DEFAULT_DAEMON_LOG_ROTATE_BYTES: () => DEFAULT_DAEMON_LOG_ROTATE_BYTES,
22857
+ DEFAULT_AI_NAME: () => DEFAULT_AI_NAME,
22865
22858
  DATA_DIR: () => DATA_DIR,
22866
22859
  CODEX_EFFORT_VALUES: () => CODEX_EFFORT_VALUES,
22867
22860
  CLAUDE_EFFORT_VALUES: () => CLAUDE_EFFORT_VALUES,
@@ -23265,6 +23258,7 @@ __export(exports_node_host, {
23265
23258
  startAiTurn: () => startAiTurn,
23266
23259
  setRuntimeMcpPort: () => setRuntimeMcpPort,
23267
23260
  setNodeMcpServers: () => setNodeMcpServers,
23261
+ setGlobalAiName: () => setGlobalAiName,
23268
23262
  setFileHooks: () => setFileHooks,
23269
23263
  setBashrsCompletionSink: () => setBashrsCompletionSink,
23270
23264
  saveVaultEntry: () => saveVaultEntry,
@@ -23291,6 +23285,7 @@ __export(exports_node_host, {
23291
23285
  getVisibleTopics: () => getVisibleTopics,
23292
23286
  getTopicStats: () => getTopicStats,
23293
23287
  getTopic: () => getTopic,
23288
+ getGlobalAiName: () => getGlobalAiName,
23294
23289
  getApiMessage: () => getApiMessage,
23295
23290
  flushBashrsCompletions: () => flushBashrsCompletions,
23296
23291
  executeVaultCommand: () => executeVaultCommand,
@@ -23343,6 +23338,7 @@ var init_node_host = __esm(async () => {
23343
23338
  await init_turn_runner();
23344
23339
  await init_api_messages();
23345
23340
  await init_api_topics();
23341
+ await init_app_settings();
23346
23342
  await init_decisions();
23347
23343
  await init_runtime_events();
23348
23344
  await init_runtime_process_leases();
@@ -30092,6 +30088,7 @@ function createNodeControlHandler(options) {
30092
30088
  v: NODE_RUNTIME_CONTRACT_VERSION,
30093
30089
  nodeVersion: NODE_VERSION,
30094
30090
  nodeId: NODE_ID,
30091
+ aiName: getGlobalAiName(),
30095
30092
  capabilities: [
30096
30093
  "turn-submit-idempotent",
30097
30094
  "turn-events-sse-resume",
@@ -30335,6 +30332,14 @@ function createNodeControlHandler(options) {
30335
30332
  const key = requiredText(url.searchParams.get("key"), "key");
30336
30333
  return Response.json({ ok: true, deleted: deleteVaultEntry(userId, key) });
30337
30334
  }
30335
+ if (req.method === "GET" && path === "/ai-name") {
30336
+ return Response.json({ ok: true, aiName: getGlobalAiName() });
30337
+ }
30338
+ if (req.method === "PATCH" && path === "/ai-name") {
30339
+ const body = await bodyRecord(req);
30340
+ const aiName = requiredText(body.aiName, "aiName");
30341
+ return Response.json({ ok: true, aiName: setGlobalAiName(aiName) });
30342
+ }
30338
30343
  if (req.method === "POST" && path === "/topics") {
30339
30344
  const body = await bodyRecord(req);
30340
30345
  const userId = requiredText(body.userId, "userId");
@@ -46379,6 +46384,43 @@ var init_vault3 = __esm(async () => {
46379
46384
  await init_src();
46380
46385
  });
46381
46386
 
46387
+ // ../cli/src/commands/name.ts
46388
+ var exports_name = {};
46389
+ __export(exports_name, {
46390
+ nameCommand: () => nameCommand
46391
+ });
46392
+ function nameCommand(args) {
46393
+ const [first, ...rest] = args;
46394
+ switch (first) {
46395
+ case undefined:
46396
+ case "get": {
46397
+ console.log(getGlobalAiName());
46398
+ return;
46399
+ }
46400
+ case "reset": {
46401
+ console.log(setGlobalAiName(DEFAULT_AI_NAME));
46402
+ return;
46403
+ }
46404
+ case "set": {
46405
+ const name = rest.join(" ").trim();
46406
+ if (!name) {
46407
+ console.error("usage: negotium name set <name>");
46408
+ process.exitCode = 1;
46409
+ return;
46410
+ }
46411
+ console.log(setGlobalAiName(name));
46412
+ return;
46413
+ }
46414
+ default: {
46415
+ const name = [first, ...rest].join(" ").trim();
46416
+ console.log(setGlobalAiName(name));
46417
+ }
46418
+ }
46419
+ }
46420
+ var init_name = __esm(async () => {
46421
+ await init_src();
46422
+ });
46423
+
46382
46424
  // ../cli/src/commands/cron.ts
46383
46425
  var exports_cron = {};
46384
46426
  __export(exports_cron, {
@@ -46671,6 +46713,12 @@ var CLI_COMMANDS = [
46671
46713
  description: "list/create/inspect/logs/run/pause/resume/restart/kill/reset/delete jobs",
46672
46714
  group: "Workspace"
46673
46715
  },
46716
+ {
46717
+ name: "name",
46718
+ usage: "name [name|reset]",
46719
+ description: "show or set this node's own AI persona name (node-local, never shared)",
46720
+ group: "Workspace"
46721
+ },
46674
46722
  {
46675
46723
  name: "terminal",
46676
46724
  usage: "terminal [--embedded|--connect=URL|--port=N]",
@@ -46850,6 +46898,11 @@ switch (command) {
46850
46898
  vaultCommand2(args);
46851
46899
  break;
46852
46900
  }
46901
+ case "name": {
46902
+ const { nameCommand: nameCommand2 } = await init_name().then(() => exports_name);
46903
+ nameCommand2(args);
46904
+ break;
46905
+ }
46853
46906
  case "cron": {
46854
46907
  const { cronCommand: cronCommand2 } = await init_cron().then(() => exports_cron);
46855
46908
  await cronCommand2(args);
@@ -46879,4 +46932,4 @@ switch (command) {
46879
46932
  }
46880
46933
  }
46881
46934
 
46882
- //# debugId=B9E9E7C43C61BDEE64756E2164756E21
46935
+ //# debugId=40F9E6FE59E5730264756E2164756E21