@ouro.bot/cli 0.1.0-alpha.1069 → 0.1.0-alpha.1070

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1070",
6
+ "changes": [
7
+ "One SQLite seam: better-sqlite3 loads with the first database, not at startup"
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1069",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1069",
2
+ "runtimeVersion": "0.1.0-alpha.1070",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1069</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1070</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.ApprovalStoreError = void 0;
40
37
  exports.canonicalApprovalArguments = canonicalApprovalArguments;
@@ -44,7 +41,7 @@ exports.readApprovalsByScenarioHandleDigest = readApprovalsByScenarioHandleDiges
44
41
  const node_crypto_1 = require("node:crypto");
45
42
  const fs = __importStar(require("node:fs"));
46
43
  const path = __importStar(require("node:path"));
47
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
44
+ const sqlite_1 = require("./sqlite");
48
45
  const runtime_1 = require("../nerves/runtime");
49
46
  class ApprovalStoreError extends Error {
50
47
  code;
@@ -473,7 +470,7 @@ function observeClose(operation) {
473
470
  }
474
471
  function openApprovalStore(options) {
475
472
  fs.mkdirSync(path.dirname(options.databasePath), { recursive: true });
476
- const database = new better_sqlite3_1.default(options.databasePath);
473
+ const database = (0, sqlite_1.openDatabase)(options.databasePath);
477
474
  database.pragma("journal_mode = WAL");
478
475
  database.pragma("busy_timeout = 5000");
479
476
  database.exec(`
@@ -934,7 +931,7 @@ function openApprovalStore(options) {
934
931
  }
935
932
  function readApprovalsByScenarioHandleDigest(databasePath, scenarioHandleDigest) {
936
933
  assertHash(scenarioHandleDigest, "invalid_scenario_handle_digest");
937
- const database = new better_sqlite3_1.default(databasePath, { readonly: true, fileMustExist: true });
934
+ const database = (0, sqlite_1.openDatabase)(databasePath, { readonly: true, fileMustExist: true });
938
935
  try {
939
936
  const rows = database.prepare(`
940
937
  SELECT a.record_json, c.owner_id, c.owner_pid, c.epoch AS continuation_epoch, c.state AS continuation_state,
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.proveAttemptedRecoveryWithoutRetry = void 0;
40
37
  exports.evaluateSanctuaryProviderReadinessContract = evaluateSanctuaryProviderReadinessContract;
@@ -61,7 +58,7 @@ const node_fs_1 = require("node:fs");
61
58
  const node_net_1 = require("node:net");
62
59
  const path = __importStar(require("node:path"));
63
60
  const node_util_1 = require("node:util");
64
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
61
+ const sqlite_1 = require("../sqlite");
65
62
  const friends_1 = require("@ouro.bot/friends");
66
63
  const runtime_1 = require("../../nerves/runtime");
67
64
  const sanctuary_authority_resident_1 = require("../../senses/sanctuary-authority-resident");
@@ -1973,7 +1970,7 @@ function callbackUpdate(value) {
1973
1970
  function withCallbackPlaybackJournal(agentRoot, operation) {
1974
1971
  const databasePath = path.join(agentRoot, CALLBACK_PLAYBACK_JOURNAL);
1975
1972
  (0, node_fs_1.mkdirSync)(path.dirname(databasePath), { recursive: true, mode: 0o700 });
1976
- const database = new better_sqlite3_1.default(databasePath);
1973
+ const database = (0, sqlite_1.openDatabase)(databasePath);
1977
1974
  try {
1978
1975
  (0, node_fs_1.chmodSync)(databasePath, 0o600);
1979
1976
  database.pragma("journal_mode = DELETE");
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.HabitLifecycleError = exports.HABIT_LIFECYCLE_TIMEOUT_MS = exports.HABIT_LIFECYCLE_POLL_MS = void 0;
40
37
  exports.serializeHabitLifecycleJson = serializeHabitLifecycleJson;
@@ -66,7 +63,7 @@ const node_child_process_1 = require("node:child_process");
66
63
  const fs = __importStar(require("node:fs"));
67
64
  const os = __importStar(require("node:os"));
68
65
  const path = __importStar(require("node:path"));
69
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
66
+ const sqlite_1 = require("../sqlite");
70
67
  const runtime_1 = require("../../nerves/runtime");
71
68
  exports.HABIT_LIFECYCLE_POLL_MS = 50;
72
69
  exports.HABIT_LIFECYCLE_TIMEOUT_MS = 5_000;
@@ -938,7 +935,7 @@ function withCoordination(paths, busyTimeoutMs, operation) {
938
935
  fs.mkdirSync(paths.root, { recursive: true });
939
936
  let database;
940
937
  try {
941
- database = new better_sqlite3_1.default(paths.coordination);
938
+ database = (0, sqlite_1.openDatabase)(paths.coordination);
942
939
  database.pragma(`busy_timeout = ${busyTimeoutMs}`);
943
940
  }
944
941
  catch (error) {
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.openDatabase = openDatabase;
4
+ const runtime_1 = require("../nerves/runtime");
5
+ let Sqlite = null;
6
+ /**
7
+ * The one place the harness opens a SQLite database. The native driver loads
8
+ * with the first database opened, not with every process that imports a store,
9
+ * so the CLI and an idle daemon never load it. One seam also means a different
10
+ * driver (such as `node:sqlite`) can replace it in one place.
11
+ */
12
+ function openDatabase(filename, options) {
13
+ if (!Sqlite) {
14
+ Sqlite = require("better-sqlite3");
15
+ (0, runtime_1.emitNervesEvent)({ component: "engine", event: "engine.sqlite_driver_loaded", message: "sqlite driver loaded on first use", meta: {} });
16
+ }
17
+ return new Sqlite(filename, options);
18
+ }
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.SessionTransactionError = exports.SessionTurnBusyError = void 0;
40
37
  exports.admitSessionActivity = admitSessionActivity;
@@ -50,7 +47,7 @@ const node_async_hooks_1 = require("node:async_hooks");
50
47
  const node_crypto_1 = require("node:crypto");
51
48
  const fs = __importStar(require("node:fs"));
52
49
  const path = __importStar(require("node:path"));
53
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
50
+ const sqlite_1 = require("../heart/sqlite");
54
51
  const runtime_1 = require("../nerves/runtime");
55
52
  const habit_lifecycle_1 = require("../heart/habits/habit-lifecycle");
56
53
  class SessionTurnBusyError extends Error {
@@ -176,7 +173,7 @@ function checkTemporary(pin, filePath, identity) {
176
173
  }
177
174
  function openLeaseDatabase(lockPath, busyTimeoutMs = 0, confinement = null) {
178
175
  checkConfinement(confinement);
179
- const database = new better_sqlite3_1.default(lockPath);
176
+ const database = (0, sqlite_1.openDatabase)(lockPath);
180
177
  try {
181
178
  database.pragma(`busy_timeout = ${busyTimeoutMs}`);
182
179
  database.transaction(() => {
@@ -64,7 +64,7 @@ const os = __importStar(require("node:os"));
64
64
  const path = __importStar(require("node:path"));
65
65
  const node_child_process_1 = require("node:child_process");
66
66
  const node_crypto_1 = require("node:crypto");
67
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
67
+ const sqlite_1 = require("../../heart/sqlite");
68
68
  const ws_1 = __importDefault(require("ws"));
69
69
  const runtime_1 = require("../../nerves/runtime");
70
70
  const copilot_app_1 = require("../shepherd/copilot-app");
@@ -110,7 +110,7 @@ function withDatabase(stateDir, read) {
110
110
  const file = path.join(stateDir, "data.db");
111
111
  if (!fs.existsSync(file))
112
112
  throw new Error(`no GitHub Copilot app database at ${file}`);
113
- const db = new better_sqlite3_1.default(file, { readonly: true, fileMustExist: true, timeout: 3_000 });
113
+ const db = (0, sqlite_1.openDatabase)(file, { readonly: true, fileMustExist: true, timeout: 3_000 });
114
114
  try {
115
115
  return read(db);
116
116
  }
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.getBlueBubblesSemanticPaths = getBlueBubblesSemanticPaths;
40
37
  exports.getBlueBubblesSemanticPathsAtRoot = getBlueBubblesSemanticPathsAtRoot;
@@ -66,7 +63,7 @@ const node_child_process_1 = require("node:child_process");
66
63
  const fs = __importStar(require("node:fs"));
67
64
  const os = __importStar(require("node:os"));
68
65
  const path = __importStar(require("node:path"));
69
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
66
+ const sqlite_1 = require("../../heart/sqlite");
70
67
  const identity_1 = require("../../heart/identity");
71
68
  const runtime_1 = require("../../nerves/runtime");
72
69
  const UUID_V4_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
@@ -1198,7 +1195,7 @@ function withExclusiveSemanticOwnership(ownershipPath, deps, operation) {
1198
1195
  storeFs.mkdirSync(path.dirname(ownershipPath), { recursive: true });
1199
1196
  let database = null;
1200
1197
  try {
1201
- database = new better_sqlite3_1.default(ownershipPath, { timeout: 0 });
1198
+ database = (0, sqlite_1.openDatabase)(ownershipPath, { timeout: 0 });
1202
1199
  database.pragma("busy_timeout = 0");
1203
1200
  database.pragma("journal_mode = DELETE");
1204
1201
  database.pragma("synchronous = FULL");
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.refuseCustody = refuseCustody;
40
37
  exports.validCustodyInputReceipt = validCustodyInputReceipt;
@@ -54,7 +51,7 @@ exports.openCheckInStore = openCheckInStore;
54
51
  const node_crypto_1 = require("node:crypto");
55
52
  const fs = __importStar(require("node:fs"));
56
53
  const path = __importStar(require("node:path"));
57
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
54
+ const sqlite_1 = require("../../heart/sqlite");
58
55
  const runtime_1 = require("../../nerves/runtime");
59
56
  const returns_1 = require("./returns");
60
57
  const MAX_ROW = 4096;
@@ -226,7 +223,7 @@ function openCustodyDatabase(file, mode) {
226
223
  for (const suffix of ["-journal", "-wal", "-shm"])
227
224
  if (fs.lstatSync(`${file}${suffix}`, { throwIfNoEntry: false }))
228
225
  privateFile(`${file}${suffix}`);
229
- const database = new better_sqlite3_1.default(file, { fileMustExist: true, readonly });
226
+ const database = (0, sqlite_1.openDatabase)(file, { fileMustExist: true, readonly });
230
227
  try {
231
228
  const version = database.pragma("user_version", { simple: true });
232
229
  if (![0, 1, 2].includes(Number(version)) || version === 0 && readonly)
@@ -32,16 +32,13 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.feedbackStorePath = feedbackStorePath;
40
37
  exports.openFeedbackStore = openFeedbackStore;
41
38
  const node_crypto_1 = require("node:crypto");
42
39
  const fs = __importStar(require("node:fs"));
43
40
  const path = __importStar(require("node:path"));
44
- const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
41
+ const sqlite_1 = require("../../heart/sqlite");
45
42
  const runtime_1 = require("../../nerves/runtime");
46
43
  const redact_1 = require("./redact");
47
44
  const returns_1 = require("./returns");
@@ -158,7 +155,7 @@ function openFeedbackStore(file) {
158
155
  throw error;
159
156
  }
160
157
  privateFile(file);
161
- const database = new better_sqlite3_1.default(file);
158
+ const database = (0, sqlite_1.openDatabase)(file);
162
159
  try {
163
160
  const version = database.pragma("user_version", { simple: true });
164
161
  if (version !== 0 && version !== 1)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1069",
3
+ "version": "0.1.0-alpha.1070",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1069",
9
+ "version": "0.1.0-alpha.1070",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.78.0",
12
12
  "@ouro.bot/friends": "0.1.0-alpha.18",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1069",
3
+ "version": "0.1.0-alpha.1070",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },