negotium 0.6.12 → 0.6.13

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/registry.js CHANGED
@@ -133,7 +133,7 @@ var codexRegistryOperations = {
133
133
  return { sessionId: threadId, rolloutPath };
134
134
  },
135
135
  async forkSession({ parentSessionId }) {
136
- const { forkCodexSession } = await import("./chunk-h7a68nd9.js");
136
+ const { forkCodexSession } = await import("./chunk-sr48tc2c.js");
137
137
  return await forkCodexSession(parentSessionId);
138
138
  },
139
139
  async cleanupRollouts({ sessionIds }) {
@@ -21,7 +21,21 @@ import {
21
21
  listRuntimeEventsAfter,
22
22
  } from "#storage/runtime-events";
23
23
  import type { AgentKind } from "#types";
24
- import type { MessageDto } from "#types/api";
24
+ import type { MessageDto, TopicSurface } from "#types/api";
25
+
26
+ /**
27
+ * Scope a `topic-deleted` event carries about the room it just removed.
28
+ *
29
+ * A delete event fires after the topic row is already gone, so any consumer
30
+ * that filters events by re-querying `getTopic(topicId)` (the node gateway's
31
+ * SSE stream) would find nothing and drop the event. Carrying the scope the
32
+ * room had right before deletion lets that filtering happen from the event
33
+ * itself instead of a lookup that is guaranteed to miss.
34
+ */
35
+ export interface TopicDeletedMeta {
36
+ surface?: TopicSurface;
37
+ surfaceScope?: string | null;
38
+ }
25
39
 
26
40
  export interface RuntimeBusEvent {
27
41
  type:
@@ -50,7 +64,7 @@ export interface RuntimeBus {
50
64
  broadcastAiStatus(topicId: string, status: Record<string, unknown>): void;
51
65
  broadcastTopicCreated(topic: { id: string }): void;
52
66
  broadcastTopicUpdated(topicId: string): void;
53
- broadcastTopicDeleted(topicId: string): void;
67
+ broadcastTopicDeleted(topicId: string, meta?: TopicDeletedMeta): void;
54
68
  // ── AI turn lifecycle (otium WsHub-compatible surface used by the turn runner) ──
55
69
  /** Announce a just-started AI turn so every subscriber learns its queryId. */
56
70
  broadcastAiActive(topicId: string, queryId: string): void;
@@ -204,8 +218,8 @@ export class SqliteRuntimeBus implements RuntimeBus {
204
218
  this.emit({ type: "topic-updated", topicId, payload: null });
205
219
  }
206
220
 
207
- broadcastTopicDeleted(topicId: string): void {
208
- this.emit({ type: "topic-deleted", topicId, payload: null });
221
+ broadcastTopicDeleted(topicId: string, meta?: TopicDeletedMeta): void {
222
+ this.emit({ type: "topic-deleted", topicId, payload: meta ?? null });
209
223
  }
210
224
 
211
225
  // The turn-lifecycle methods all flow through the "ai-status" channel with a
@@ -94,7 +94,7 @@ export {
94
94
  VAULT_COMMAND_HELP,
95
95
  } from "#application/vault-command";
96
96
  // ── Host boundary ───────────────────────────────────────────────────
97
- export type { RuntimeBus, RuntimeBusEvent, RuntimeBusListener } from "#bus";
97
+ export type { RuntimeBus, RuntimeBusEvent, RuntimeBusListener, TopicDeletedMeta } from "#bus";
98
98
  export { runtimeBus, setRuntimeBus, WsHub } from "#bus";
99
99
  export type {
100
100
  PeerRuntimeAskUserRequest,
@@ -20,7 +20,7 @@ export {
20
20
  listVaultEntries,
21
21
  saveVaultEntry,
22
22
  } from "#application/vault-command";
23
- export type { RuntimeBusEvent } from "#bus";
23
+ export type { RuntimeBusEvent, TopicDeletedMeta } from "#bus";
24
24
  export { runtimeBus, WsHub } from "#bus";
25
25
  export { setRuntimeMcpPort } from "#mcp/runtime-spec";
26
26
  export { killAllBgBash } from "#platform/background-bash/manager";
@@ -349,8 +349,14 @@ async function deleteTopicCascadeImpl(
349
349
  }
350
350
  deleted = true;
351
351
  // Mirror the deletion onto the bus so channel adapters (Telegram forum
352
- // threads, web clients, …) can drop their bindings for the topic.
353
- WsHub.get().broadcastTopicDeleted(topicId);
352
+ // threads, web clients, …) can drop their bindings for the topic. The
353
+ // gateway's SSE filter needs this room's pre-delete surface/scope: by the
354
+ // time it runs, `getTopic(topicId)` already returns nothing to look it
355
+ // up from.
356
+ WsHub.get().broadcastTopicDeleted(topicId, {
357
+ surface: topic.surface,
358
+ surfaceScope: topic.surfaceScope,
359
+ });
354
360
  for (const childId of reparentedChildIds) WsHub.get().broadcastTopicUpdated(childId);
355
361
  } finally {
356
362
  if (deleted) {
@@ -1 +1 @@
1
- export const NEGOTIUM_VERSION = "0.6.12";
1
+ export const NEGOTIUM_VERSION = "0.6.13";
@@ -14,7 +14,20 @@
14
14
  */
15
15
  import type { ToolCallSummaryInput } from "./agents/tool-format";
16
16
  import type { AgentKind } from "./types";
17
- import type { MessageDto } from "./types/api";
17
+ import type { MessageDto, TopicSurface } from "./types/api";
18
+ /**
19
+ * Scope a `topic-deleted` event carries about the room it just removed.
20
+ *
21
+ * A delete event fires after the topic row is already gone, so any consumer
22
+ * that filters events by re-querying `getTopic(topicId)` (the node gateway's
23
+ * SSE stream) would find nothing and drop the event. Carrying the scope the
24
+ * room had right before deletion lets that filtering happen from the event
25
+ * itself instead of a lookup that is guaranteed to miss.
26
+ */
27
+ export interface TopicDeletedMeta {
28
+ surface?: TopicSurface;
29
+ surfaceScope?: string | null;
30
+ }
18
31
  export interface RuntimeBusEvent {
19
32
  type: "message" | "message-updated" | "ai-status" | "topic-created" | "topic-updated" | "topic-deleted";
20
33
  topicId: string;
@@ -32,7 +45,7 @@ export interface RuntimeBus {
32
45
  id: string;
33
46
  }): void;
34
47
  broadcastTopicUpdated(topicId: string): void;
35
- broadcastTopicDeleted(topicId: string): void;
48
+ broadcastTopicDeleted(topicId: string, meta?: TopicDeletedMeta): void;
36
49
  /** Announce a just-started AI turn so every subscriber learns its queryId. */
37
50
  broadcastAiActive(topicId: string, queryId: string): void;
38
51
  broadcastDone(topicId: string, queryId: string, usage?: NonNullable<MessageDto["usage"]>, meta?: {
@@ -80,7 +93,7 @@ export declare class SqliteRuntimeBus implements RuntimeBus {
80
93
  id: string;
81
94
  }): void;
82
95
  broadcastTopicUpdated(topicId: string): void;
83
- broadcastTopicDeleted(topicId: string): void;
96
+ broadcastTopicDeleted(topicId: string, meta?: TopicDeletedMeta): void;
84
97
  broadcastAiActive(topicId: string, queryId: string): void;
85
98
  broadcastDone(topicId: string, queryId: string, usage?: NonNullable<MessageDto["usage"]>, meta?: {
86
99
  agent?: AgentKind;
@@ -1 +1 @@
1
- export declare const NEGOTIUM_VERSION = "0.6.12";
1
+ export declare const NEGOTIUM_VERSION = "0.6.13";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "negotium",
3
- "version": "0.6.12",
3
+ "version": "0.6.13",
4
4
  "type": "module",
5
5
  "description": "Install the Negotium multi-agent runtime and CLI with one package",
6
6
  "license": "Apache-2.0",