negotium 0.6.4 → 0.6.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.
@@ -2980,7 +2980,7 @@ var init_codex = __esm(async () => {
2980
2980
  });
2981
2981
 
2982
2982
  // ../../packages/core/src/version.ts
2983
- var NEGOTIUM_VERSION = "0.6.4";
2983
+ var NEGOTIUM_VERSION = "0.6.6";
2984
2984
 
2985
2985
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2986
2986
  import { spawn as spawn2 } from "child_process";
@@ -3670,6 +3670,16 @@ var init_task_events = __esm(async () => {
3670
3670
  defaultTaskEventHost = { readTasks, taskFileMtimeNs, taskScopeKey };
3671
3671
  });
3672
3672
 
3673
+ // ../../packages/core/src/platform/constants.ts
3674
+ var FROM_AUTO_CONTINUE = "auto-continue", FROM_SELF_SCHEDULE = "self-schedule", RESERVED_TOPIC_NAMES, GENERAL_TOPIC_ID = "general", MANAGER_TOPIC_LOG_NAME = "general", NODE_LOCAL_USER_ID = "local";
3675
+ var init_constants = __esm(() => {
3676
+ RESERVED_TOPIC_NAMES = new Set([
3677
+ FROM_AUTO_CONTINUE,
3678
+ FROM_SELF_SCHEDULE,
3679
+ "general"
3680
+ ]);
3681
+ });
3682
+
3673
3683
  // ../../packages/core/src/storage/conversations.ts
3674
3684
  import {
3675
3685
  existsSync as existsSync9,
@@ -3683,12 +3693,15 @@ import { dirname as dirname8, join as join11 } from "path";
3683
3693
  function conversationDir(_userId) {
3684
3694
  return join11(resolveStorageDataDir(), "conversations");
3685
3695
  }
3686
- function topicFilename(topicName) {
3696
+ function topicFilename(userId, topicName) {
3687
3697
  const t = sanitizeTopicName(topicName, true);
3688
- return `${t}.jsonl`;
3698
+ const owner = String(userId);
3699
+ if (t !== MANAGER_TOPIC_LOG_NAME || owner === NODE_LOCAL_USER_ID)
3700
+ return `${t}.jsonl`;
3701
+ return `${t}.${sanitizeId(owner)}.jsonl`;
3689
3702
  }
3690
3703
  function getConversationPath(userId, topicName) {
3691
- return join11(conversationDir(userId), topicFilename(topicName));
3704
+ return join11(conversationDir(userId), topicFilename(userId, topicName));
3692
3705
  }
3693
3706
  function getActiveConversationPath(userId, topicName) {
3694
3707
  const rawPath = getConversationPath(userId, topicName);
@@ -3789,6 +3802,7 @@ function findLastSessionIdForAgent(entries, agent) {
3789
3802
  }
3790
3803
  var ConversationLogDivergedError;
3791
3804
  var init_conversations = __esm(async () => {
3805
+ init_constants();
3792
3806
  init_jsonl();
3793
3807
  init_logger();
3794
3808
  await init_storage_host();
@@ -7458,16 +7472,6 @@ var init_wiki = __esm(async () => {
7458
7472
  await init_storage_host();
7459
7473
  });
7460
7474
 
7461
- // ../../packages/core/src/platform/constants.ts
7462
- var FROM_AUTO_CONTINUE = "auto-continue", FROM_SELF_SCHEDULE = "self-schedule", RESERVED_TOPIC_NAMES, GENERAL_TOPIC_ID = "general";
7463
- var init_constants = __esm(() => {
7464
- RESERVED_TOPIC_NAMES = new Set([
7465
- FROM_AUTO_CONTINUE,
7466
- FROM_SELF_SCHEDULE,
7467
- "general"
7468
- ]);
7469
- });
7470
-
7471
7475
  // ../../packages/core/src/storage/api-topic-config.ts
7472
7476
  function tableColumns(table) {
7473
7477
  const rows = db.query(`PRAGMA table_info(${table})`).all();
@@ -8367,12 +8371,15 @@ function createArchiverRuntime(host) {
8367
8371
  const agent = params.agent ?? "claude";
8368
8372
  const model = params.model;
8369
8373
  const outputLanguage = resolveMemoryLanguage();
8374
+ const generalReplyInstruction = `Reply with a short completion message in ${outputLanguage} for display in #General. ` + "Do not include tool-call logs or raw transcripts \u2014 just briefly name the summary / brief / articles you saved.";
8370
8375
  const prompt = mode === "active-topic" ? [
8371
8376
  `Recent idle conversation snapshot of session "${topicTitle}". Extract durable memory from the archive below and save it into this topic's wiki.`,
8372
8377
  `archive_path: ${archivePath}`,
8373
8378
  ...rawArchivePaths.map((path) => `raw_archive_path: ${path}`),
8374
8379
  `wiki_dir: ${wikiDir}`,
8375
- `output_language: ${outputLanguage}`
8380
+ `output_language: ${outputLanguage}`,
8381
+ "",
8382
+ generalReplyInstruction
8376
8383
  ].join(`
8377
8384
  `) : [
8378
8385
  `Session "${topicTitle}" was deleted. Extract durable memory from the archive below and save it into the wiki.`,
@@ -8381,7 +8388,7 @@ function createArchiverRuntime(host) {
8381
8388
  `wiki_dir: ${wikiDir}`,
8382
8389
  `output_language: ${outputLanguage}`,
8383
8390
  "",
8384
- `Reply with a short completion message in ${outputLanguage} for display in #General. ` + "Do not include tool-call logs or raw transcripts \u2014 just briefly name the summary / brief / articles you saved."
8391
+ generalReplyInstruction
8385
8392
  ].join(`
8386
8393
  `);
8387
8394
  const activeSessionId = `memory:${host.config.createId()}`;
@@ -8509,10 +8516,8 @@ function createArchiverRuntime(host) {
8509
8516
  host.config.warn({ err, userId, topicTitle }, "archiver: settlement callback failed");
8510
8517
  }
8511
8518
  }
8512
- if (mode === "deleted-topic") {
8513
- const text = finalText.trimEnd();
8514
- finalizeGeneralMemory(host, userId, topicTitle, messageCount, startMs, ok, topicId, ok && text ? { text, agent, model, usage } : undefined);
8515
- }
8519
+ const text = finalText.trimEnd();
8520
+ finalizeGeneralMemory(host, userId, topicTitle, messageCount, startMs, ok, mode, topicId, ok && text ? { text, agent, model, usage } : undefined);
8516
8521
  });
8517
8522
  topicQueues.set(safeTopic, work);
8518
8523
  work.finally(() => {
@@ -8558,7 +8563,7 @@ function findSummaryFile(storage, topicTitle, date, sinceMs, topicId) {
8558
8563
  }
8559
8564
  return best?.path ?? null;
8560
8565
  }
8561
- function finalizeGeneralMemory(host, userId, topicTitle, messageCount, startMs, ok, topicId, generalReply) {
8566
+ function finalizeGeneralMemory(host, userId, topicTitle, messageCount, startMs, ok, mode, topicId, generalReply) {
8562
8567
  const generalTopicId = host.storage.getGeneralTopicId(userId);
8563
8568
  const date = host.config.now().toISOString().slice(0, 10);
8564
8569
  try {
@@ -8575,7 +8580,7 @@ function finalizeGeneralMemory(host, userId, topicTitle, messageCount, startMs,
8575
8580
  ].slice(0, MAX_BRIEF_ENTRIES);
8576
8581
  const briefMd = `# Workspace Memory Hub
8577
8582
 
8578
- Recent memory digest distilled from deleted topics. Use \`wiki_query\` for details.
8583
+ Recent memory digest distilled from archived topics (deletions and idle/session-reset snapshots). Use \`wiki_query\` for details.
8579
8584
 
8580
8585
  ## Recent Archives
8581
8586
  ${rolled.join(`
@@ -8590,7 +8595,7 @@ ${rolled.join(`
8590
8595
  }
8591
8596
  try {
8592
8597
  const replyText = generalReply?.text.trim();
8593
- const text = replyText || (ok ? `\uD83D\uDDC2 Topic "${topicTitle}" was deleted and archived into #General memory.` : `\uD83D\uDDC2 Archived topic "${topicTitle}" (summary extraction failed \u2014 raw log preserved in wiki/archive).`);
8598
+ const text = replyText || (mode === "deleted-topic" ? ok ? `\uD83D\uDDC2 Topic "${topicTitle}" was deleted and archived into #General memory.` : `\uD83D\uDDC2 Archived topic "${topicTitle}" (summary extraction failed \u2014 raw log preserved in wiki/archive).` : ok ? `\uD83D\uDDC2 Session "${topicTitle}" was snapshotted and archived into #General memory.` : `\uD83D\uDDC2 Archived a snapshot of "${topicTitle}" (summary extraction failed \u2014 raw log preserved in wiki/archive).`);
8594
8599
  const replyMeta = generalReply && replyText ? {
8595
8600
  authorId: "ai",
8596
8601
  agentType: generalReply.agent,
@@ -19294,4 +19299,4 @@ export {
19294
19299
  DEFAULT_SELF_CONFIG_PRODUCT
19295
19300
  };
19296
19301
 
19297
- //# debugId=6BFDBF463059259E64756E2164756E21
19302
+ //# debugId=FE024E0414DA725F64756E2164756E21