wheems 0.0.1 → 0.0.3

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.
@@ -1,3 +1,4 @@
1
+ import { NODE_SUPPORTED } from './node-support.js';
1
2
  let loaded;
2
3
  /**
3
4
  * Node's built-in SQLite, loaded without its "experimental" warning, which would otherwise
@@ -39,4 +40,38 @@ export async function openDatabase(file, options = {}) {
39
40
  db.exec('PRAGMA journal_mode = WAL');
40
41
  return db;
41
42
  }
43
+ /**
44
+ * Why this SQLite can't do full-text search (FTS5), which search needs, or null when it can.
45
+ * `open` makes a scratch database; by default an in-memory one from `node:sqlite`.
46
+ */
47
+ export async function fullTextSearchProblem(open) {
48
+ let db;
49
+ try {
50
+ db = open ? await open() : new (await sqlite()).DatabaseSync(':memory:');
51
+ }
52
+ catch (error) {
53
+ return `Node's SQLite isn't available: ${describe(error)}. Use ${NODE_SUPPORTED}.`;
54
+ }
55
+ try {
56
+ db.exec('CREATE VIRTUAL TABLE probe USING fts5(text)');
57
+ return null;
58
+ }
59
+ catch (error) {
60
+ return `This Node.js (${process.versions.node}, ${process.execPath}) has SQLite without full-text search (FTS5), which Wheems's search needs (${describe(error)}). Use ${NODE_SUPPORTED}, from nodejs.org or a package that bundles Node's own SQLite.`;
61
+ }
62
+ finally {
63
+ db.close();
64
+ }
65
+ }
66
+ let checked;
67
+ /** Throws a plain explanation when this Node's SQLite has no full-text search. Checks once. */
68
+ export async function requireFullTextSearch() {
69
+ checked ??= fullTextSearchProblem();
70
+ const problem = await checked;
71
+ if (problem !== null)
72
+ throw new Error(problem);
73
+ }
74
+ function describe(error) {
75
+ return error instanceof Error ? error.message : String(error);
76
+ }
42
77
  //# sourceMappingURL=sqlite.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wheems",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "An opinionated framework for running teams of AI agents, on Herdr core",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://wheems.dev",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "type": "module",
26
26
  "engines": {
27
- "node": ">=22.13.0"
27
+ "node": "^22.16.0 || >=24"
28
28
  },
29
29
  "bin": {
30
30
  "wheems": "dist/cli/main.js"
@@ -48,7 +48,7 @@
48
48
  "CHANGELOG.md"
49
49
  ],
50
50
  "scripts": {
51
- "build": "tsc -p tsconfig.build.json",
51
+ "build": "tsc -p tsconfig.build.json && tsx scripts/make-executable.ts",
52
52
  "typecheck": "tsc -p tsconfig.json --noEmit",
53
53
  "lint": "eslint . && prettier --check .",
54
54
  "format": "prettier --write .",