negotium 0.1.39 → 0.1.41

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.
@@ -1697,15 +1697,18 @@ function beginRuntimeTopicMaintenance(topicId, options = {}) {
1697
1697
  var TOPIC_MAINTENANCE_STALE_MS = 30000, TOPIC_MAINTENANCE_HEARTBEAT_MS = 1000;
1698
1698
  var init_runtime_topic_state = __esm(async () => {
1699
1699
  await init_forum_db();
1700
- db.exec(`
1701
- CREATE TABLE IF NOT EXISTS runtime_topic_state (
1702
- topic_id TEXT PRIMARY KEY,
1703
- epoch INTEGER NOT NULL DEFAULT 0,
1704
- maintenance INTEGER NOT NULL DEFAULT 0 CHECK (maintenance IN (0, 1)),
1705
- maintenance_owner TEXT,
1706
- heartbeat_at INTEGER
1707
- )
1708
- `);
1700
+ await init_storage_host();
1701
+ registerStorageSchemaInitializer((database) => {
1702
+ database.exec(`
1703
+ CREATE TABLE IF NOT EXISTS runtime_topic_state (
1704
+ topic_id TEXT PRIMARY KEY,
1705
+ epoch INTEGER NOT NULL DEFAULT 0,
1706
+ maintenance INTEGER NOT NULL DEFAULT 0 CHECK (maintenance IN (0, 1)),
1707
+ maintenance_owner TEXT,
1708
+ heartbeat_at INTEGER
1709
+ )
1710
+ `);
1711
+ }, 32);
1709
1712
  });
1710
1713
 
1711
1714
  // ../../packages/core/src/storage/runtime-leases.ts
@@ -1793,20 +1796,23 @@ var RUNTIME_INSTANCE_ID, TURN_LEASE_STALE_MS = 1e4;
1793
1796
  var init_runtime_leases = __esm(async () => {
1794
1797
  await init_forum_db();
1795
1798
  await init_runtime_topic_state();
1799
+ await init_storage_host();
1796
1800
  RUNTIME_INSTANCE_ID = `${process.pid}-${randomUUID3()}`;
1797
- db.exec(`
1798
- CREATE TABLE IF NOT EXISTS runtime_turn_leases (
1799
- topic_id TEXT PRIMARY KEY,
1800
- query_id TEXT NOT NULL UNIQUE,
1801
- owner_id TEXT NOT NULL,
1802
- origin TEXT NOT NULL,
1803
- started_at INTEGER NOT NULL,
1804
- heartbeat_at INTEGER NOT NULL,
1805
- abort_requested INTEGER NOT NULL DEFAULT 0 CHECK (abort_requested IN (0, 1)),
1806
- abort_reason TEXT CHECK (abort_reason IS NULL OR abort_reason IN ('internal', 'external'))
1807
- )
1808
- `);
1809
- db.exec("CREATE INDEX IF NOT EXISTS idx_runtime_turn_leases_heartbeat ON runtime_turn_leases(heartbeat_at)");
1801
+ registerStorageSchemaInitializer((database) => {
1802
+ database.exec(`
1803
+ CREATE TABLE IF NOT EXISTS runtime_turn_leases (
1804
+ topic_id TEXT PRIMARY KEY,
1805
+ query_id TEXT NOT NULL UNIQUE,
1806
+ owner_id TEXT NOT NULL,
1807
+ origin TEXT NOT NULL,
1808
+ started_at INTEGER NOT NULL,
1809
+ heartbeat_at INTEGER NOT NULL,
1810
+ abort_requested INTEGER NOT NULL DEFAULT 0 CHECK (abort_requested IN (0, 1)),
1811
+ abort_reason TEXT CHECK (abort_reason IS NULL OR abort_reason IN ('internal', 'external'))
1812
+ );
1813
+ CREATE INDEX IF NOT EXISTS idx_runtime_turn_leases_heartbeat ON runtime_turn_leases(heartbeat_at);
1814
+ `);
1815
+ }, 33);
1810
1816
  });
1811
1817
 
1812
1818
  // ../../packages/core/src/storage/runtime-turn-requests.ts
@@ -3641,16 +3647,19 @@ var PROCESS_LEASE_STALE_MS = 5000, PROCESS_LEASE_HEARTBEAT_MS = 1000;
3641
3647
  var init_runtime_process_leases = __esm(async () => {
3642
3648
  await init_forum_db();
3643
3649
  await init_runtime_leases();
3644
- db.exec(`
3645
- CREATE TABLE IF NOT EXISTS runtime_process_leases (
3646
- role TEXT PRIMARY KEY,
3647
- owner_id TEXT NOT NULL UNIQUE,
3648
- pid INTEGER NOT NULL,
3649
- started_at INTEGER NOT NULL,
3650
- heartbeat_at INTEGER NOT NULL
3651
- )
3652
- `);
3653
- db.exec("CREATE INDEX IF NOT EXISTS idx_runtime_process_leases_heartbeat ON runtime_process_leases(heartbeat_at)");
3650
+ await init_storage_host();
3651
+ registerStorageSchemaInitializer((database) => {
3652
+ database.exec(`
3653
+ CREATE TABLE IF NOT EXISTS runtime_process_leases (
3654
+ role TEXT PRIMARY KEY,
3655
+ owner_id TEXT NOT NULL UNIQUE,
3656
+ pid INTEGER NOT NULL,
3657
+ started_at INTEGER NOT NULL,
3658
+ heartbeat_at INTEGER NOT NULL
3659
+ );
3660
+ CREATE INDEX IF NOT EXISTS idx_runtime_process_leases_heartbeat ON runtime_process_leases(heartbeat_at);
3661
+ `);
3662
+ }, 34);
3654
3663
  });
3655
3664
 
3656
3665
  // ../../packages/core/src/platform/playwright/browser-processes.ts
@@ -6822,7 +6831,7 @@ var init_claude_provider = __esm(async () => {
6822
6831
  });
6823
6832
 
6824
6833
  // ../../packages/core/src/version.ts
6825
- var NEGOTIUM_VERSION = "0.1.39";
6834
+ var NEGOTIUM_VERSION = "0.1.41";
6826
6835
 
6827
6836
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
6828
6837
  import { spawn as spawn5 } from "child_process";
@@ -8946,7 +8955,8 @@ function buildRuntimeToolSection(opts, extensions) {
8946
8955
  currentModel,
8947
8956
  currentEffort,
8948
8957
  subagentParentTitle,
8949
- subagentReportMode = "auto"
8958
+ subagentReportMode = "auto",
8959
+ scheduleSelf = true
8950
8960
  } = opts;
8951
8961
  const runtimeNamespace = "mcp__runtime";
8952
8962
  const taskNamespace = "mcp__task";
@@ -8994,7 +9004,7 @@ function buildRuntimeToolSection(opts, extensions) {
8994
9004
  askUserToolLine,
8995
9005
  'Do not use provider built-in "AskUserQuestion"; it is disabled or unsupported in this headless chat runtime. Use the runtime ask_user_question tool instead.'
8996
9006
  ],
8997
- scheduleSelfToolLine,
9007
+ ...scheduleSelf ? [scheduleSelfToolLine] : [],
8998
9008
  ...visualTools && extensions.visualDesignGuide ? ["", extensions.visualDesignGuide] : [],
8999
9009
  ...extensions.render("after-runtime-tools"),
9000
9010
  "",
@@ -9065,6 +9075,7 @@ function buildRuntimeToolSection(opts, extensions) {
9065
9075
  }
9066
9076
  function createPromptBuilders(host = {}) {
9067
9077
  const loadTemplate = host.loadTemplate;
9078
+ const scheduleSelf = host.scheduleSelf ?? true;
9068
9079
  const sections = (host.extraSections ?? []).map((section) => {
9069
9080
  const render = section.render;
9070
9081
  const snapshot = {
@@ -9114,7 +9125,8 @@ function createPromptBuilders(host = {}) {
9114
9125
  currentModel: opts.currentModel,
9115
9126
  currentEffort: opts.currentEffort,
9116
9127
  subagentParentTitle: opts.subagentParentTitle,
9117
- subagentReportMode: opts.subagentReportMode
9128
+ subagentReportMode: opts.subagentReportMode,
9129
+ scheduleSelf
9118
9130
  }, {
9119
9131
  render,
9120
9132
  visualDesignGuide: template({
@@ -10352,7 +10364,6 @@ var init_background_sessions = __esm(async () => {
10352
10364
  await init_api_topics();
10353
10365
  await init_runtime_events();
10354
10366
  await init_runtime_leases();
10355
- await init_derive();
10356
10367
  init_background_session_policy();
10357
10368
  providers = new Set;
10358
10369
  transientSessions = new Map;
@@ -13148,7 +13159,7 @@ function createAskUserRuntime(host) {
13148
13159
  function cancelPendingAskUserQuestions(topicId, queryId) {
13149
13160
  defaultAskUserRuntime.cancelPendingQuestions(topicId, queryId);
13150
13161
  }
13151
- var MAX_QUESTION_CHARS = 2000, MAX_CHOICE_LABEL_CHARS = 128, MAX_CHOICE_DESCRIPTION_CHARS = 500, MAX_CHOICES = 12, MAX_IDEMPOTENCY_KEY_CHARS = 200, ASK_GATE_OWNER_ID, ASK_GATE_LEASE_ROLE_PREFIX = "ask-user-gate:", defaultAskUserRuntime;
13162
+ var MAX_QUESTION_CHARS = 2000, MAX_CHOICE_LABEL_CHARS = 128, MAX_CHOICE_DESCRIPTION_CHARS = 500, MAX_CHOICES = 12, MAX_IDEMPOTENCY_KEY_CHARS = 200, ASK_GATE_OWNER_ID, ASK_GATE_LEASE_ROLE_PREFIX = "ask-user-gate:", defaultAskUserDurabilityHost, defaultAskUserRuntime;
13152
13163
  var init_ask_user = __esm(async () => {
13153
13164
  init_common();
13154
13165
  await init_bus();
@@ -13158,6 +13169,21 @@ var init_ask_user = __esm(async () => {
13158
13169
  await init_ask_user_gates();
13159
13170
  await init_runtime_process_leases();
13160
13171
  ASK_GATE_OWNER_ID = `ask-user-${process.pid}-${randomUUID13()}`;
13172
+ defaultAskUserDurabilityHost = {
13173
+ gates: {
13174
+ prepare: prepareAskUserGate,
13175
+ claimAndSelect: claimAskUserGateAndSelect,
13176
+ cancel: cancelAskUserGate,
13177
+ quarantine: quarantineAskUserGate,
13178
+ quarantineForeign: quarantineForeignAskUserGates
13179
+ },
13180
+ processLeases: {
13181
+ acquire: (role, ownerId) => acquireRuntimeProcessLease(role, { ownerId }),
13182
+ list: listRuntimeProcessLeases,
13183
+ isAlive: isRuntimeProcessLeaseAlive,
13184
+ removeDead: removeDeadRuntimeProcessLeases
13185
+ }
13186
+ };
13161
13187
  defaultAskUserRuntime = createAskUserRuntime({
13162
13188
  messaging: {
13163
13189
  persistence: {
@@ -13176,21 +13202,7 @@ var init_ask_user = __esm(async () => {
13176
13202
  getTopic,
13177
13203
  getConfig: getApiTopicConfig
13178
13204
  },
13179
- durability: {
13180
- gates: {
13181
- prepare: prepareAskUserGate,
13182
- claimAndSelect: claimAskUserGateAndSelect,
13183
- cancel: cancelAskUserGate,
13184
- quarantine: quarantineAskUserGate,
13185
- quarantineForeign: quarantineForeignAskUserGates
13186
- },
13187
- processLeases: {
13188
- acquire: (role, ownerId) => acquireRuntimeProcessLease(role, { ownerId }),
13189
- list: listRuntimeProcessLeases,
13190
- isAlive: isRuntimeProcessLeaseAlive,
13191
- removeDead: removeDeadRuntimeProcessLeases
13192
- }
13193
- },
13205
+ durability: defaultAskUserDurabilityHost,
13194
13206
  runtime: {
13195
13207
  ownerId: ASK_GATE_OWNER_ID,
13196
13208
  createId: randomUUID13,
@@ -17794,4 +17806,4 @@ export {
17794
17806
  createSessionCommMcpServer
17795
17807
  };
17796
17808
 
17797
- //# debugId=C65B947E88A4FF4864756E2164756E21
17809
+ //# debugId=25849AEE7308982764756E2164756E21