negotium 0.1.13 → 0.1.15

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/cron.js CHANGED
@@ -3054,7 +3054,7 @@ var init_claude_provider = __esm(async () => {
3054
3054
  });
3055
3055
 
3056
3056
  // ../../packages/core/src/version.ts
3057
- var NEGOTIUM_VERSION = "0.1.13";
3057
+ var NEGOTIUM_VERSION = "0.1.15";
3058
3058
 
3059
3059
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
3060
3060
  import { spawn as spawn2 } from "child_process";
@@ -4247,6 +4247,8 @@ function initializeApiMessagesSchema() {
4247
4247
  parent_id TEXT,
4248
4248
  author_id TEXT NOT NULL,
4249
4249
  source_adapter TEXT,
4250
+ source_node TEXT,
4251
+ source_message_id TEXT,
4250
4252
  text TEXT NOT NULL,
4251
4253
  query_id TEXT,
4252
4254
  agent_type TEXT,
@@ -4266,6 +4268,12 @@ function initializeApiMessagesSchema() {
4266
4268
  try {
4267
4269
  db.exec("ALTER TABLE api_messages ADD COLUMN source_adapter TEXT");
4268
4270
  } catch {}
4271
+ try {
4272
+ db.exec("ALTER TABLE api_messages ADD COLUMN source_node TEXT");
4273
+ } catch {}
4274
+ try {
4275
+ db.exec("ALTER TABLE api_messages ADD COLUMN source_message_id TEXT");
4276
+ } catch {}
4269
4277
  try {
4270
4278
  db.exec("ALTER TABLE api_messages ADD COLUMN deleted INTEGER NOT NULL DEFAULT 0");
4271
4279
  } catch {}
@@ -4311,6 +4319,8 @@ function rowToDto(r) {
4311
4319
  parentId: r.parent_id ?? undefined,
4312
4320
  authorId: r.author_id,
4313
4321
  sourceAdapter: r.source_adapter ?? undefined,
4322
+ sourceNode: r.source_node ?? undefined,
4323
+ sourceMessageId: r.source_message_id ?? undefined,
4314
4324
  text: r.text,
4315
4325
  queryId: r.query_id ?? undefined,
4316
4326
  agentType: r.agent_type ?? undefined,
@@ -4344,9 +4354,9 @@ function appendApiMessage(msg, options = {}) {
4344
4354
  let inserted = false;
4345
4355
  db.transaction(() => {
4346
4356
  const result = db.query(`INSERT INTO api_messages
4347
- (id, topic_id, parent_id, author_id, source_adapter, text, query_id, agent_type, model, attachments, usage, deleted, edited_at, reactions, kind, ask_user_question, subagent_card, mentions, thread_root_id, created_at)
4348
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4349
- ON CONFLICT(id) DO NOTHING`).run(msg.id, msg.topicId, msg.parentId ?? null, msg.authorId, msg.sourceAdapter ?? null, msg.text, msg.queryId ?? null, msg.agentType ?? null, msg.model ?? null, msg.attachments ? JSON.stringify(msg.attachments) : null, msg.usage ? JSON.stringify(msg.usage) : null, msg.deleted ? 1 : 0, msg.editedAt ?? null, msg.reactions?.length ? JSON.stringify(msg.reactions) : null, msg.kind ?? null, msg.askUserQuestion ? JSON.stringify(msg.askUserQuestion) : null, msg.subagentCard ? JSON.stringify(msg.subagentCard) : null, msg.mentions?.length ? JSON.stringify(msg.mentions) : null, msg.threadRootId ?? null, msg.createdAt);
4357
+ (id, topic_id, parent_id, author_id, source_adapter, source_node, source_message_id, text, query_id, agent_type, model, attachments, usage, deleted, edited_at, reactions, kind, ask_user_question, subagent_card, mentions, thread_root_id, created_at)
4358
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4359
+ ON CONFLICT(id) DO NOTHING`).run(msg.id, msg.topicId, msg.parentId ?? null, msg.authorId, msg.sourceAdapter ?? null, msg.sourceNode ?? null, msg.sourceMessageId ?? null, msg.text, msg.queryId ?? null, msg.agentType ?? null, msg.model ?? null, msg.attachments ? JSON.stringify(msg.attachments) : null, msg.usage ? JSON.stringify(msg.usage) : null, msg.deleted ? 1 : 0, msg.editedAt ?? null, msg.reactions?.length ? JSON.stringify(msg.reactions) : null, msg.kind ?? null, msg.askUserQuestion ? JSON.stringify(msg.askUserQuestion) : null, msg.subagentCard ? JSON.stringify(msg.subagentCard) : null, msg.mentions?.length ? JSON.stringify(msg.mentions) : null, msg.threadRootId ?? null, msg.createdAt);
4350
4360
  inserted = Number(result.changes ?? 0) > 0;
4351
4361
  if (inserted && updateTopicLastMessageAt && !msg.deleted) {
4352
4362
  db.query(`UPDATE api_topics
@@ -9413,6 +9423,7 @@ async function streamAgentEvents(topicId, topicTitle, queryId, events, control,
9413
9423
  queryId,
9414
9424
  agentType,
9415
9425
  model,
9426
+ sourceNode: execution?.sourceNode,
9416
9427
  usage,
9417
9428
  createdAt: new Date().toISOString()
9418
9429
  };
@@ -9889,6 +9900,7 @@ function redispatchInject(inject) {
9889
9900
  bridgeSessionFromHistory: inject.bridgeSessionFromHistory,
9890
9901
  onSettled: inject.onSettled,
9891
9902
  peerBridge: inject.peerBridge,
9903
+ sourceNode: inject.sourceNode,
9892
9904
  askReplySources: inject.askReplySources,
9893
9905
  _runtimeEpoch: inject.runtimeEpoch,
9894
9906
  _sessionRetried: inject._sessionRetried,
@@ -10215,6 +10227,7 @@ function startAiTurn(params) {
10215
10227
  let sessionId = sessionResolution.sessionId;
10216
10228
  const deferredSessionId = params.sessionId === undefined && !sessionResolution.isolated ? undefined : sessionId;
10217
10229
  const origin = params.origin ?? "user";
10230
+ const sourceNode = params.sourceNode;
10218
10231
  const topicId = topic.id;
10219
10232
  const requestId = params.requestId;
10220
10233
  const depth = params.depth;
@@ -10264,6 +10277,7 @@ function startAiTurn(params) {
10264
10277
  userId,
10265
10278
  prompt,
10266
10279
  origin,
10280
+ sourceNode,
10267
10281
  requestId,
10268
10282
  depth,
10269
10283
  silent,
@@ -10655,7 +10669,7 @@ ${playwrightNote}`;
10655
10669
  WsHub.get().broadcastTyping(topicId, "ai");
10656
10670
  WsHub.get().broadcastAiActive(topicId, queryId);
10657
10671
  }
10658
- streamAgentEvents(topicId, topic.title, queryId, events, control, agentKind, resolvedModel, resolvedEffort, userId, !sessionRetried, onSessionId, { silent, peerBridge }).then(async (outcome) => {
10672
+ streamAgentEvents(topicId, topic.title, queryId, events, control, agentKind, resolvedModel, resolvedEffort, userId, !sessionRetried, onSessionId, { silent, peerBridge, sourceNode }).then(async (outcome) => {
10659
10673
  if (outcome.kind === "session-expired") {
10660
10674
  if (!silent)
10661
10675
  WsHub.get().broadcastAborted(topicId, queryId, "stopped");
@@ -10800,6 +10814,8 @@ function triggerTopicAiTurn(topicId, userId, prompt, agentType, opts) {
10800
10814
  topicId,
10801
10815
  authorId: opts?.injectAuthorId ?? userId,
10802
10816
  sourceAdapter: opts?.injectSourceAdapter,
10817
+ sourceNode: opts?.injectSourceNode,
10818
+ sourceMessageId: opts?.injectSourceMessageId,
10803
10819
  authorName: execution.agent,
10804
10820
  text: prompt,
10805
10821
  agentType: execution.agent,
@@ -10839,6 +10855,7 @@ function triggerTopicAiTurn(topicId, userId, prompt, agentType, opts) {
10839
10855
  bridgeSessionFromHistory: opts?.bridgeSessionFromHistory,
10840
10856
  onSettled: opts?.onSettled,
10841
10857
  peerBridge: opts?.peerBridge,
10858
+ sourceNode: opts?.injectSourceNode,
10842
10859
  askReplySources: opts?.askReplySources,
10843
10860
  from: opts?.from
10844
10861
  });
@@ -11303,6 +11320,9 @@ await init_turn_runner();
11303
11320
  await init_bus();
11304
11321
  await init_turn_runner();
11305
11322
  await init_api_messages();
11323
+ // ../../packages/core/src/application/switch-topic-access-mode.ts
11324
+ await init_bus();
11325
+ await init_api_topics();
11306
11326
  // ../../packages/core/src/application/switch-topic-effort.ts
11307
11327
  await init_registry();
11308
11328
  await init_bus();
@@ -13217,4 +13237,4 @@ export {
13217
13237
  CRON_CONTEXT_RETAIN_TURNS
13218
13238
  };
13219
13239
 
13220
- //# debugId=4523810F2A196B5864756E2164756E21
13240
+ //# debugId=F031CC384D6799EC64756E2164756E21