latticesql 4.2.3 → 4.2.4

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/index.cjs CHANGED
@@ -729,14 +729,177 @@ var init_sqlite = __esm({
729
729
  }
730
730
  });
731
731
 
732
+ // src/db/sqlite-deno.ts
733
+ function runtimeRequire2() {
734
+ const importMetaUrl = import_meta2.url;
735
+ return importMetaUrl ? (0, import_node_module2.createRequire)(importMetaUrl) : require;
736
+ }
737
+ function loadNodeSqlite() {
738
+ if (_ctor2) return _ctor2;
739
+ const mod = runtimeRequire2()("node:sqlite");
740
+ if (!mod.DatabaseSync) {
741
+ throw new Error(
742
+ "node:sqlite is unavailable in this runtime \u2014 cannot open the Deno SQLite adapter"
743
+ );
744
+ }
745
+ _ctor2 = mod.DatabaseSync;
746
+ return _ctor2;
747
+ }
748
+ var import_node_module2, import_meta2, _ctor2, DenoSqliteAdapter;
749
+ var init_sqlite_deno = __esm({
750
+ "src/db/sqlite-deno.ts"() {
751
+ "use strict";
752
+ import_node_module2 = require("module");
753
+ import_meta2 = {};
754
+ _ctor2 = null;
755
+ DenoSqliteAdapter = class {
756
+ dialect = "sqlite";
757
+ _db = null;
758
+ _path;
759
+ _wal;
760
+ _busyTimeout;
761
+ constructor(path3, options) {
762
+ this._path = path3;
763
+ this._wal = options?.wal ?? true;
764
+ this._busyTimeout = options?.busyTimeout ?? 5e3;
765
+ }
766
+ get db() {
767
+ if (!this._db) throw new Error("DenoSqliteAdapter: not open \u2014 call open() first");
768
+ return this._db;
769
+ }
770
+ open() {
771
+ const Ctor = loadNodeSqlite();
772
+ this._db = new Ctor(this._path);
773
+ this._db.exec(`PRAGMA busy_timeout = ${this._busyTimeout.toString()}`);
774
+ if (this._wal) {
775
+ this._db.exec("PRAGMA journal_mode = WAL");
776
+ }
777
+ }
778
+ close() {
779
+ this._db?.close();
780
+ this._db = null;
781
+ }
782
+ run(sql, params = []) {
783
+ this.db.prepare(sql).run(...params);
784
+ }
785
+ get(sql, params = []) {
786
+ return this.db.prepare(sql).get(...params);
787
+ }
788
+ all(sql, params = []) {
789
+ return this.db.prepare(sql).all(...params);
790
+ }
791
+ prepare(sql) {
792
+ const stmt = this.db.prepare(sql);
793
+ return {
794
+ run: (...params) => {
795
+ const info = stmt.run(...params);
796
+ return {
797
+ changes: Number(info.changes),
798
+ lastInsertRowid: info.lastInsertRowid
799
+ };
800
+ },
801
+ get: (...params) => stmt.get(...params),
802
+ all: (...params) => stmt.all(...params)
803
+ };
804
+ }
805
+ introspectColumns(table) {
806
+ const rows = this.all(`PRAGMA table_info("${table}")`);
807
+ return rows.map((r6) => r6.name);
808
+ }
809
+ /** Mirror of SQLiteAdapter.addColumn — SQLite ALTER quirks are binding-agnostic. */
810
+ addColumn(table, column, typeSpec) {
811
+ const upperType = typeSpec.toUpperCase();
812
+ if (upperType.includes("PRIMARY KEY")) return;
813
+ const hasNonConstantDefault = upperType.includes("CURRENT_TIMESTAMP") || /DATETIME\s*\(\s*'NOW'\s*\)/i.test(typeSpec) || upperType.includes("RANDOM()");
814
+ if (hasNonConstantDefault) {
815
+ const safeType = typeSpec.replace(/\bNOT\s+NULL\b/gi, "").replace(/\bDEFAULT\s+\(?\s*CURRENT_TIMESTAMP\s*\)?/gi, "").replace(/\bDEFAULT\s+\(?\s*datetime\([^)]*\)\s*\)?/gi, "").replace(/\bDEFAULT\s+\(?\s*RANDOM\(\)\s*\)?/gi, "").replace(/\s+/g, " ").trim();
816
+ this.run(`ALTER TABLE "${table}" ADD COLUMN "${column}" ${safeType || "TEXT"}`);
817
+ this.run(`UPDATE "${table}" SET "${column}" = CURRENT_TIMESTAMP WHERE "${column}" IS NULL`);
818
+ } else {
819
+ this.run(`ALTER TABLE "${table}" ADD COLUMN "${column}" ${typeSpec}`);
820
+ }
821
+ }
822
+ /**
823
+ * O(1) watch-loop change-probe — same composition as SQLiteAdapter, but
824
+ * `data_version` is read with a plain prepared statement because node:sqlite
825
+ * has no `.pragma(name, { simple: true })` scalar helper.
826
+ */
827
+ changeProbe() {
828
+ const dataVersion = this.db.prepare("PRAGMA data_version").get().data_version;
829
+ const totalChanges = this.db.prepare("SELECT total_changes() AS n").get().n;
830
+ return `${String(dataVersion)}:${String(totalChanges)}`;
831
+ }
832
+ // ── Async surface (sync under the hood; mirrors SQLiteAdapter) ──────────
833
+ // eslint-disable-next-line @typescript-eslint/require-await
834
+ async runAsync(sql, params) {
835
+ this.run(sql, params);
836
+ }
837
+ // eslint-disable-next-line @typescript-eslint/require-await
838
+ async getAsync(sql, params) {
839
+ return this.get(sql, params);
840
+ }
841
+ // eslint-disable-next-line @typescript-eslint/require-await
842
+ async allAsync(sql, params) {
843
+ return this.all(sql, params);
844
+ }
845
+ // eslint-disable-next-line @typescript-eslint/require-await
846
+ async introspectColumnsAsync(table) {
847
+ return this.introspectColumns(table);
848
+ }
849
+ // eslint-disable-next-line @typescript-eslint/require-await
850
+ async introspectAllColumns(tables) {
851
+ const map = /* @__PURE__ */ new Map();
852
+ for (const t8 of tables) {
853
+ try {
854
+ const cols = this.introspectColumns(t8);
855
+ if (cols.length > 0) map.set(t8, new Set(cols));
856
+ } catch {
857
+ }
858
+ }
859
+ return map;
860
+ }
861
+ // eslint-disable-next-line @typescript-eslint/require-await
862
+ async addColumnAsync(table, column, typeSpec) {
863
+ this.addColumn(table, column, typeSpec);
864
+ }
865
+ /** BEGIN/COMMIT around an awaited fn; ROLLBACK on throw. Mirror of SQLiteAdapter. */
866
+ async withClient(fn) {
867
+ const dbRef = this.db;
868
+ const getSync = this.get.bind(this);
869
+ const allSync = this.all.bind(this);
870
+ const tx = {
871
+ run: (sql, params) => {
872
+ const info = dbRef.prepare(sql).run(...params ?? []);
873
+ return Promise.resolve({ changes: Number(info.changes) });
874
+ },
875
+ get: (sql, params) => Promise.resolve(getSync(sql, params ?? [])),
876
+ all: (sql, params) => Promise.resolve(allSync(sql, params ?? []))
877
+ };
878
+ this.run("BEGIN");
879
+ try {
880
+ const result = await fn(tx);
881
+ this.run("COMMIT");
882
+ return result;
883
+ } catch (err) {
884
+ try {
885
+ this.run("ROLLBACK");
886
+ } catch {
887
+ }
888
+ throw err;
889
+ }
890
+ }
891
+ };
892
+ }
893
+ });
894
+
732
895
  // src/db/postgres.ts
733
896
  function moduleContext() {
734
897
  if (_moduleContext) return _moduleContext;
735
- const importMetaUrl = import_meta2.url;
898
+ const importMetaUrl = import_meta3.url;
736
899
  if (importMetaUrl) {
737
900
  _moduleContext = {
738
901
  dir: import_node_path4.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl)),
739
- require: (0, import_node_module2.createRequire)(importMetaUrl)
902
+ require: (0, import_node_module3.createRequire)(importMetaUrl)
740
903
  };
741
904
  } else {
742
905
  _moduleContext = { dir: __dirname, require };
@@ -994,14 +1157,14 @@ function rewriteParams(sql) {
994
1157
  function rewrite(sql) {
995
1158
  return rewriteParams(translateDialect(sql));
996
1159
  }
997
- var import_node_path4, import_node_url, import_node_module2, import_meta2, _moduleContext, SYNC_NOT_SUPPORTED_MSG, PostgresAdapter, POSTGRES_POLYFILLS;
1160
+ var import_node_path4, import_node_url, import_node_module3, import_meta3, _moduleContext, SYNC_NOT_SUPPORTED_MSG, PostgresAdapter, POSTGRES_POLYFILLS;
998
1161
  var init_postgres = __esm({
999
1162
  "src/db/postgres.ts"() {
1000
1163
  "use strict";
1001
1164
  import_node_path4 = __toESM(require("path"), 1);
1002
1165
  import_node_url = require("url");
1003
- import_node_module2 = require("module");
1004
- import_meta2 = {};
1166
+ import_node_module3 = require("module");
1167
+ import_meta3 = {};
1005
1168
  _moduleContext = null;
1006
1169
  SYNC_NOT_SUPPORTED_MSG = "PostgresAdapter: synchronous adapter methods (run/get/all/prepare/introspectColumns/addColumn) are no longer supported on Postgres as of latticesql 1.10.0. Use the async surface (runAsync/getAsync/allAsync/prepareAsync/introspectColumnsAsync/addColumnAsync/withClient) instead. Lattice core methods (Lattice.query, .insert, .update, .render, etc.) already route through the async surface \u2014 only consumer code that escapes into adapter.run/get/all directly needs migrating.";
1007
1170
  PostgresAdapter = class {
@@ -9928,6 +10091,9 @@ function buildAdapter(dbPath, options) {
9928
10091
  const adapterOpts = {};
9929
10092
  if (options.wal !== void 0) adapterOpts.wal = options.wal;
9930
10093
  if (options.busyTimeout !== void 0) adapterOpts.busyTimeout = options.busyTimeout;
10094
+ if (typeof globalThis.Deno !== "undefined") {
10095
+ return new DenoSqliteAdapter(sqlitePath, adapterOpts);
10096
+ }
9931
10097
  return new SQLiteAdapter(sqlitePath, adapterOpts);
9932
10098
  }
9933
10099
  function _resolveTemplateName(render) {
@@ -9949,6 +10115,7 @@ var init_lattice = __esm({
9949
10115
  import_node_fs12 = require("fs");
9950
10116
  init_adapter();
9951
10117
  init_sqlite();
10118
+ init_sqlite_deno();
9952
10119
  init_postgres();
9953
10120
  init_pk();
9954
10121
  init_manager();
@@ -52484,11 +52651,11 @@ var init_table_policy = __esm({
52484
52651
  });
52485
52652
 
52486
52653
  // src/ai/llm-client.ts
52487
- var import_node_module3, DEFAULT_MODEL, CHEAPEST_MODEL;
52654
+ var import_node_module4, DEFAULT_MODEL, CHEAPEST_MODEL;
52488
52655
  var init_llm_client = __esm({
52489
52656
  "src/ai/llm-client.ts"() {
52490
52657
  "use strict";
52491
- import_node_module3 = require("module");
52658
+ import_node_module4 = require("module");
52492
52659
  DEFAULT_MODEL = "claude-haiku-4-5";
52493
52660
  CHEAPEST_MODEL = "claude-haiku-4-5";
52494
52661
  }
@@ -52900,8 +53067,8 @@ async function sniffMime(body) {
52900
53067
  async function renderViaPlaywright(url, timeoutMs, warnIfMissing = false) {
52901
53068
  let chromium;
52902
53069
  try {
52903
- const importMetaUrl = import_meta3.url;
52904
- const req = importMetaUrl ? (0, import_node_module4.createRequire)(importMetaUrl) : require;
53070
+ const importMetaUrl = import_meta4.url;
53071
+ const req = importMetaUrl ? (0, import_node_module5.createRequire)(importMetaUrl) : require;
52905
53072
  const pw = req("playwright");
52906
53073
  chromium = pw.chromium;
52907
53074
  } catch {
@@ -52925,16 +53092,16 @@ async function renderViaPlaywright(url, timeoutMs, warnIfMissing = false) {
52925
53092
  if (browser) await browser.close().catch(() => void 0);
52926
53093
  }
52927
53094
  }
52928
- var import_jsdom, import_readability, import_node_path27, import_node_module4, import_meta3, DEFAULT_MAX_BYTES2, DEFAULT_TIMEOUT_MS, DEFAULT_UA, DOMAIN_EXTRACTORS, warnedPlaywrightMissing;
53095
+ var import_jsdom, import_readability, import_node_path27, import_node_module5, import_meta4, DEFAULT_MAX_BYTES2, DEFAULT_TIMEOUT_MS, DEFAULT_UA, DOMAIN_EXTRACTORS, warnedPlaywrightMissing;
52929
53096
  var init_crawl = __esm({
52930
53097
  "src/ai/crawl.ts"() {
52931
53098
  "use strict";
52932
53099
  import_jsdom = require("jsdom");
52933
53100
  import_readability = require("@mozilla/readability");
52934
53101
  import_node_path27 = require("path");
52935
- import_node_module4 = require("module");
53102
+ import_node_module5 = require("module");
52936
53103
  init_url_safety();
52937
- import_meta3 = {};
53104
+ import_meta4 = {};
52938
53105
  DEFAULT_MAX_BYTES2 = 25 * 1024 * 1024;
52939
53106
  DEFAULT_TIMEOUT_MS = 3e4;
52940
53107
  DEFAULT_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
@@ -54106,9 +54273,6 @@ async function resolveClaudeAuth(db) {
54106
54273
  const apiKey = await resolveAnthropicKey(db);
54107
54274
  return apiKey ? { apiKey } : null;
54108
54275
  }
54109
- async function hasClaudeAuth(db) {
54110
- return Boolean(await readMachineCredential(db, CLAUDE_OAUTH_KIND)) || await hasCredential(db, "anthropic", "ANTHROPIC_API_KEY");
54111
- }
54112
54276
  async function claudeAuthKind(db) {
54113
54277
  if (await readMachineCredential(db, CLAUDE_OAUTH_KIND)) return "oauth";
54114
54278
  if (await hasCredential(db, "anthropic", "ANTHROPIC_API_KEY")) return "key";
@@ -54136,7 +54300,6 @@ async function dispatchAssistantRoute(req, res, ctx) {
54136
54300
  hasAnthropicKey,
54137
54301
  hasOpenaiKey,
54138
54302
  hasElevenlabsKey,
54139
- hasClaudeAuth: await hasClaudeAuth(db),
54140
54303
  claudeAuthKind: await claudeAuthKind(db),
54141
54304
  hasVoiceKey: voice !== null,
54142
54305
  sttProvider: voice?.provider ?? null,
@@ -54264,13 +54427,17 @@ async function dispatchAssistantRoute(req, res, ctx) {
54264
54427
  const verifier = generatePkceVerifier();
54265
54428
  const state2 = generateState();
54266
54429
  const cookieOpts = "HttpOnly; Path=/; Max-Age=600; SameSite=Lax";
54267
- res.writeHead(302, {
54268
- Location: buildAuthorizeUrl(cfg, state2, pkceChallengeFor(verifier)),
54269
- "Set-Cookie": [
54270
- `lat_oauth_verifier=${verifier}; ${cookieOpts}`,
54271
- `lat_oauth_state=${state2}; ${cookieOpts}`
54272
- ]
54273
- });
54430
+ const setCookie = [
54431
+ `lat_oauth_verifier=${verifier}; ${cookieOpts}`,
54432
+ `lat_oauth_state=${state2}; ${cookieOpts}`
54433
+ ];
54434
+ const authorizeUrl = buildAuthorizeUrl(cfg, state2, pkceChallengeFor(verifier));
54435
+ if ((req.headers.accept ?? "").includes("application/json")) {
54436
+ res.writeHead(200, { "Content-Type": "application/json", "Set-Cookie": setCookie });
54437
+ res.end(JSON.stringify({ authorizeUrl }));
54438
+ return true;
54439
+ }
54440
+ res.writeHead(302, { Location: authorizeUrl, "Set-Cookie": setCookie });
54274
54441
  res.end();
54275
54442
  return true;
54276
54443
  }
@@ -54846,7 +55013,7 @@ function findDocsDir() {
54846
55013
  if (_docsDir !== void 0) return _docsDir;
54847
55014
  let dir;
54848
55015
  try {
54849
- dir = (0, import_node_path29.dirname)((0, import_node_url2.fileURLToPath)(import_meta6.url));
55016
+ dir = (0, import_node_path29.dirname)((0, import_node_url2.fileURLToPath)(import_meta7.url));
54850
55017
  } catch {
54851
55018
  dir = process.cwd();
54852
55019
  }
@@ -54941,14 +55108,14 @@ function searchLatticeDocs(query, limit = 4) {
54941
55108
  }))
54942
55109
  };
54943
55110
  }
54944
- var import_node_fs27, import_node_path29, import_node_url2, import_meta6, _docsDir, MAX_SECTION_CHARS, _cache;
55111
+ var import_node_fs27, import_node_path29, import_node_url2, import_meta7, _docsDir, MAX_SECTION_CHARS, _cache;
54945
55112
  var init_lattice_docs = __esm({
54946
55113
  "src/gui/ai/lattice-docs.ts"() {
54947
55114
  "use strict";
54948
55115
  import_node_fs27 = require("fs");
54949
55116
  import_node_path29 = require("path");
54950
55117
  import_node_url2 = require("url");
54951
- import_meta6 = {};
55118
+ import_meta7 = {};
54952
55119
  MAX_SECTION_CHARS = 2400;
54953
55120
  _cache = /* @__PURE__ */ new Map();
54954
55121
  }
@@ -57815,8 +57982,8 @@ async function* runChat(opts) {
57815
57982
  }
57816
57983
  function loadSdk() {
57817
57984
  if (!_sdk) {
57818
- const importMetaUrl = import_meta7.url;
57819
- const req = importMetaUrl ? (0, import_node_module7.createRequire)(importMetaUrl) : require;
57985
+ const importMetaUrl = import_meta8.url;
57986
+ const req = importMetaUrl ? (0, import_node_module8.createRequire)(importMetaUrl) : require;
57820
57987
  try {
57821
57988
  _sdk = req("@anthropic-ai/sdk");
57822
57989
  } catch (err) {
@@ -57873,15 +58040,15 @@ function createAnthropicClient(auth) {
57873
58040
  }
57874
58041
  };
57875
58042
  }
57876
- var import_node_module7, import_meta7, DEFAULT_MODEL2, MAX_TOOL_LOOPS, MAX_CONSECUTIVE_TOOL_FAILURES, MAX_TOKENS, MAX_TOOL_RESULT_CHARS, MAX_TOOL_RESULT_SKIP, MAX_TOOL_INPUT_CHARS, LIVE_TOOL_RESULT_CHARS, MAX_CONTEXT_RECOVERY_TRIMS, TRIMMED_PLACEHOLDER, BASE_SYSTEM_PROMPT, LOCAL_GUI_RECORD_RE, _sdk;
58043
+ var import_node_module8, import_meta8, DEFAULT_MODEL2, MAX_TOOL_LOOPS, MAX_CONSECUTIVE_TOOL_FAILURES, MAX_TOKENS, MAX_TOOL_RESULT_CHARS, MAX_TOOL_RESULT_SKIP, MAX_TOOL_INPUT_CHARS, LIVE_TOOL_RESULT_CHARS, MAX_CONTEXT_RECOVERY_TRIMS, TRIMMED_PLACEHOLDER, BASE_SYSTEM_PROMPT, LOCAL_GUI_RECORD_RE, _sdk;
57877
58044
  var init_chat = __esm({
57878
58045
  "src/gui/ai/chat.ts"() {
57879
58046
  "use strict";
57880
- import_node_module7 = require("module");
58047
+ import_node_module8 = require("module");
57881
58048
  init_dispatch();
57882
58049
  init_tools();
57883
58050
  init_column_descriptions();
57884
- import_meta7 = {};
58051
+ import_meta8 = {};
57885
58052
  DEFAULT_MODEL2 = "claude-haiku-4-5";
57886
58053
  MAX_TOOL_LOOPS = 16;
57887
58054
  MAX_CONSECUTIVE_TOOL_FAILURES = 3;
@@ -57927,6 +58094,7 @@ __export(index_exports, {
57927
58094
  DEFAULT_ENTRY_TYPES: () => DEFAULT_ENTRY_TYPES,
57928
58095
  DEFAULT_MAX_NODES: () => DEFAULT_MAX_NODES,
57929
58096
  DEFAULT_TYPE_ALIASES: () => DEFAULT_TYPE_ALIASES,
58097
+ DenoSqliteAdapter: () => DenoSqliteAdapter,
57930
58098
  EMBEDDINGS_TABLE: () => EMBEDDINGS_TABLE,
57931
58099
  EmbeddingDimensionMismatchError: () => EmbeddingDimensionMismatchError,
57932
58100
  EmbeddingScanTooLargeError: () => EmbeddingScanTooLargeError,
@@ -58685,6 +58853,7 @@ async function autoUpdate(opts) {
58685
58853
 
58686
58854
  // src/index.ts
58687
58855
  init_sqlite();
58856
+ init_sqlite_deno();
58688
58857
  init_postgres();
58689
58858
  init_computed();
58690
58859
  init_governance();
@@ -60007,10 +60176,10 @@ function isBetter(next, prev) {
60007
60176
  }
60008
60177
 
60009
60178
  // src/ai/vision.ts
60010
- var import_node_module5 = require("module");
60179
+ var import_node_module6 = require("module");
60011
60180
  var import_promises7 = require("fs/promises");
60012
60181
  init_llm_client();
60013
- var import_meta4 = {};
60182
+ var import_meta5 = {};
60014
60183
  var DEFAULT_PROMPT = "Describe this image for a knowledge base in 2-4 factual sentences: what it shows, any visible text, and notable details. No preamble.";
60015
60184
  var MAX_DIM = 1568;
60016
60185
  async function describeImage(auth, path3, opts = {}) {
@@ -60070,8 +60239,8 @@ function buildVisionAnthropicConfig(auth) {
60070
60239
  }
60071
60240
  function defaultSender(auth) {
60072
60241
  return async (input) => {
60073
- const importMetaUrl = import_meta4.url;
60074
- const req = importMetaUrl ? (0, import_node_module5.createRequire)(importMetaUrl) : require;
60242
+ const importMetaUrl = import_meta5.url;
60243
+ const req = importMetaUrl ? (0, import_node_module6.createRequire)(importMetaUrl) : require;
60075
60244
  const sdk = req("@anthropic-ai/sdk");
60076
60245
  const Anthropic = sdk.Anthropic ?? sdk.default;
60077
60246
  if (!Anthropic) throw new Error("Could not resolve Anthropic from '@anthropic-ai/sdk'");
@@ -60097,8 +60266,8 @@ function defaultSender(auth) {
60097
60266
  }
60098
60267
  function defaultPdfSender(auth) {
60099
60268
  return async (input) => {
60100
- const importMetaUrl = import_meta4.url;
60101
- const req = importMetaUrl ? (0, import_node_module5.createRequire)(importMetaUrl) : require;
60269
+ const importMetaUrl = import_meta5.url;
60270
+ const req = importMetaUrl ? (0, import_node_module6.createRequire)(importMetaUrl) : require;
60102
60271
  const sdk = req("@anthropic-ai/sdk");
60103
60272
  const Anthropic = sdk.Anthropic ?? sdk.default;
60104
60273
  if (!Anthropic) throw new Error("Could not resolve Anthropic from '@anthropic-ai/sdk'");
@@ -60409,13 +60578,13 @@ init_postgres();
60409
60578
 
60410
60579
  // src/gui/realtime.ts
60411
60580
  var import_node_events = require("events");
60412
- var import_node_module6 = require("module");
60413
- var import_meta5 = {};
60581
+ var import_node_module7 = require("module");
60582
+ var import_meta6 = {};
60414
60583
  var _pgModule = null;
60415
60584
  function loadPg() {
60416
60585
  if (_pgModule) return _pgModule;
60417
- const importMetaUrl = import_meta5.url;
60418
- const requireFromHere = importMetaUrl ? (0, import_node_module6.createRequire)(importMetaUrl) : (
60586
+ const importMetaUrl = import_meta6.url;
60587
+ const requireFromHere = importMetaUrl ? (0, import_node_module7.createRequire)(importMetaUrl) : (
60419
60588
  // CJS fallback — Node provides `require` on every CJS module scope.
60420
60589
  require
60421
60590
  );
@@ -63774,6 +63943,20 @@ var displayConfigJs = `
63774
63943
  });
63775
63944
  }
63776
63945
 
63946
+ // SINGLE SOURCE OF TRUTH for the assistant's Claude connection state, derived
63947
+ // from /api/assistant/config's claudeAuthKind (oauth | key | null). EVERY
63948
+ // place that shows "Connected with Claude" / opens the API-key panel / gates
63949
+ // on "the assistant has auth" MUST go through this \u2014 never re-derive from raw
63950
+ // fields, or the signals disagree (a stray "or hasAnthropicKey" once made
63951
+ // onboarding show "Connected with Claude" for an API-key-only setup while the
63952
+ // settings panel showed not-connected).
63953
+ // .oauth -> a Claude SUBSCRIPTION is connected ("Connected with Claude")
63954
+ // .any -> some working auth exists (subscription OR API key)
63955
+ function claudeAuth(cfg) {
63956
+ var kind = (cfg && cfg.claudeAuthKind) || null; // 'oauth' | 'key' | null
63957
+ return { kind: kind, oauth: kind === 'oauth', any: kind != null };
63958
+ }
63959
+
63777
63960
  // Disable a button + show an inline spinner for the duration of an
63778
63961
  // async action so a slow server round-trip can't be double-clicked.
63779
63962
  // The fn arg should return a Promise; the button is restored on settle.
@@ -64564,7 +64747,12 @@ var offlineEditQueueJs = ` // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
64564
64747
  if (eventStreamClosed) return;
64565
64748
  // Unexpected drop: show the disconnect on the pill and auto-reconnect with
64566
64749
  // backoff (the server replays state + render snapshot on reconnect).
64567
- setStatusPill('cloud', 'disconnected');
64750
+ // Preserve the KNOWN mode (cloudMode is the single source of truth, set
64751
+ // from the server's realtime-state message) \u2014 never hardcode 'cloud',
64752
+ // which on a LOCAL (SQLite) workspace would flip cloudMode=true and divert
64753
+ // writes into the offline queue with a bogus "will sync when cloud
64754
+ // reconnects" toast against a workspace that has no cloud.
64755
+ setStatusPill(cloudMode ? 'cloud' : 'local', 'disconnected');
64568
64756
  scheduleEventStreamReconnect();
64569
64757
  };
64570
64758
  }
@@ -68472,7 +68660,7 @@ var rowContextJs = ` // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
68472
68660
  var cfg = res[1];
68473
68661
  st.name = (id && id.display_name) || '';
68474
68662
  st.email = (id && id.email) || '';
68475
- st.connected = !!(cfg && (cfg.claudeAuthKind === 'oauth' || cfg.hasAnthropicKey));
68663
+ st.connected = claudeAuth(cfg).oauth;
68476
68664
  if (!st.wsName && st.name) st.wsName = st.name + "'s Workspace";
68477
68665
  render();
68478
68666
  });
@@ -69133,7 +69321,7 @@ var dataModelJs = ` // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
69133
69321
  '</p>' +
69134
69322
  // Connect-with-Claude is the primary path (use your subscription, no
69135
69323
  // API key). A pasted API key is demoted to an "Advanced" disclosure.
69136
- (cfg.claudeAuthKind === 'oauth'
69324
+ (claudeAuth(cfg).oauth
69137
69325
  ? '<div style="display:flex;align-items:center;gap:10px;margin-bottom:10px">' +
69138
69326
  '<span class="feed-source" style="background:var(--accent-soft);color:var(--accent)">Connected with Claude</span>' +
69139
69327
  '<button id="asst-oauth-disconnect" class="btn">Disconnect</button>' +
@@ -69155,7 +69343,7 @@ var dataModelJs = ` // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
69155
69343
  '</div>' +
69156
69344
  '<div id="connect-claude-msg" style="margin-top:6px;font-size:12px;color:var(--text-muted)"></div>' +
69157
69345
  '</div>') +
69158
- '<details style="margin-bottom:12px"' + (cfg.claudeAuthKind === 'key' ? ' open' : '') + '>' +
69346
+ '<details style="margin-bottom:12px"' + (claudeAuth(cfg).kind === 'key' ? ' open' : '') + '>' +
69159
69347
  '<summary style="cursor:pointer;font-size:12px;color:var(--text-muted)">Advanced \u2014 use an API key instead</summary>' +
69160
69348
  '<div style="margin-top:8px">' +
69161
69349
  rowHtml('asst-anthropic', 'Claude API token (chat)', !!cfg.hasAnthropicKey, 'sk-ant-\u2026') +
@@ -71147,7 +71335,7 @@ var createDatabaseWizardJs = ` // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\
71147
71335
  function renderComposer() {
71148
71336
  var host = document.getElementById('rail-composer'); if (!host) return;
71149
71337
  fetchJson('/api/assistant/config').then(function (cfg) {
71150
- if (cfg && cfg.hasClaudeAuth) {
71338
+ if (claudeAuth(cfg).any) {
71151
71339
  var micHtml = cfg.hasVoiceKey
71152
71340
  ? '<button class="composer-mic" id="chat-mic" title="Record voice">\u{1F399}</button>'
71153
71341
  : '';
@@ -77491,6 +77679,7 @@ async function startGuiServer(options) {
77491
77679
  }
77492
77680
  const autoRender = options.autoRender ?? false;
77493
77681
  const guiVersion = options.version ?? "";
77682
+ const desktopOpenExternal = options.desktopOpenExternal;
77494
77683
  const sessionId = crypto.randomUUID();
77495
77684
  let updateService = null;
77496
77685
  let activeRef = bootConfigPath && bootOutputDir ? await openConfig(bootConfigPath, bootOutputDir, autoRender, options.realtimeWatchdogMs) : null;
@@ -77673,6 +77862,20 @@ async function startGuiServer(options) {
77673
77862
  sendJson(res, { version: guiVersion });
77674
77863
  return;
77675
77864
  }
77865
+ if (method === "GET" && pathname === "/api/desktop/open") {
77866
+ if (!desktopOpenExternal) {
77867
+ sendJson(res, { error: "not found" }, 404);
77868
+ return;
77869
+ }
77870
+ const target = new URL(req.url ?? "", "http://localhost").searchParams.get("url");
77871
+ if (!target || !/^https?:\/\//i.test(target)) {
77872
+ sendJson(res, { error: "url must be http(s)" }, 400);
77873
+ return;
77874
+ }
77875
+ desktopOpenExternal(target);
77876
+ sendJson(res, { ok: true });
77877
+ return;
77878
+ }
77676
77879
  if (method === "GET" && pathname === "/api/update/status") {
77677
77880
  sendJson(
77678
77881
  res,
@@ -78241,6 +78444,7 @@ var FileSourceKeyStore = class {
78241
78444
  DEFAULT_ENTRY_TYPES,
78242
78445
  DEFAULT_MAX_NODES,
78243
78446
  DEFAULT_TYPE_ALIASES,
78447
+ DenoSqliteAdapter,
78244
78448
  EMBEDDINGS_TABLE,
78245
78449
  EmbeddingDimensionMismatchError,
78246
78450
  EmbeddingScanTooLargeError,
package/dist/index.d.cts CHANGED
@@ -4764,6 +4764,74 @@ declare class SQLiteAdapter implements StorageAdapter {
4764
4764
  withClient<T>(fn: (tx: TxClient) => Promise<T>): Promise<T>;
4765
4765
  }
4766
4766
 
4767
+ /**
4768
+ * SQLite adapter backed by the runtime's built-in `node:sqlite` `DatabaseSync`
4769
+ * (synchronous) instead of the `better-sqlite3` native addon. This exists so
4770
+ * Lattice can run under a runtime that ships `node:sqlite` but cannot load
4771
+ * native N-API addons (the desktop build). The surface is a 1:1 mirror of the
4772
+ * better-sqlite3 adapter — same StorageAdapter contract, same SQL — with three
4773
+ * substitutions where the two SQLite bindings differ:
4774
+ *
4775
+ * 1. pragmas are issued via `exec()` (no `.pragma()` helper);
4776
+ * 2. the `data_version` half of changeProbe is read with a plain
4777
+ * `PRAGMA data_version` statement (no `{ simple: true }` option);
4778
+ * 3. BLOB columns read back as `Uint8Array` rather than `Buffer`. Lattice's
4779
+ * own file storage is disk-based (content-addressed blobs), so the core
4780
+ * never round-trips file bytes through a BLOB column; a user-defined
4781
+ * `blob` column consumed specifically as a Node `Buffer` is the only place
4782
+ * the difference is observable. `Buffer` is itself a `Uint8Array`, so byte
4783
+ * access is identical; only Buffer-only methods would differ.
4784
+ */
4785
+ interface NodeSqliteRunResult {
4786
+ changes: number | bigint;
4787
+ lastInsertRowid: number | bigint;
4788
+ }
4789
+ interface NodeStatementSync {
4790
+ run(...params: unknown[]): NodeSqliteRunResult;
4791
+ get(...params: unknown[]): Row | undefined;
4792
+ all(...params: unknown[]): Row[];
4793
+ }
4794
+ interface NodeDatabaseSync {
4795
+ exec(sql: string): void;
4796
+ prepare(sql: string): NodeStatementSync;
4797
+ close(): void;
4798
+ }
4799
+ declare class DenoSqliteAdapter implements StorageAdapter {
4800
+ readonly dialect: "sqlite";
4801
+ private _db;
4802
+ private readonly _path;
4803
+ private readonly _wal;
4804
+ private readonly _busyTimeout;
4805
+ constructor(path: string, options?: {
4806
+ wal?: boolean;
4807
+ busyTimeout?: number;
4808
+ });
4809
+ get db(): NodeDatabaseSync;
4810
+ open(): void;
4811
+ close(): void;
4812
+ run(sql: string, params?: unknown[]): void;
4813
+ get(sql: string, params?: unknown[]): Row | undefined;
4814
+ all(sql: string, params?: unknown[]): Row[];
4815
+ prepare(sql: string): PreparedStatement;
4816
+ introspectColumns(table: string): string[];
4817
+ /** Mirror of SQLiteAdapter.addColumn — SQLite ALTER quirks are binding-agnostic. */
4818
+ addColumn(table: string, column: string, typeSpec: string): void;
4819
+ /**
4820
+ * O(1) watch-loop change-probe — same composition as SQLiteAdapter, but
4821
+ * `data_version` is read with a plain prepared statement because node:sqlite
4822
+ * has no `.pragma(name, { simple: true })` scalar helper.
4823
+ */
4824
+ changeProbe(): string;
4825
+ runAsync(sql: string, params?: unknown[]): Promise<void>;
4826
+ getAsync(sql: string, params?: unknown[]): Promise<Row | undefined>;
4827
+ allAsync(sql: string, params?: unknown[]): Promise<Row[]>;
4828
+ introspectColumnsAsync(table: string): Promise<string[]>;
4829
+ introspectAllColumns(tables: string[]): Promise<Map<string, Set<string>>>;
4830
+ addColumnAsync(table: string, column: string, typeSpec: string): Promise<void>;
4831
+ /** BEGIN/COMMIT around an awaited fn; ROLLBACK on throw. Mirror of SQLiteAdapter. */
4832
+ withClient<T>(fn: (tx: TxClient) => Promise<T>): Promise<T>;
4833
+ }
4834
+
4767
4835
  /**
4768
4836
  * Pluggable Postgres backend for Lattice.
4769
4837
  *
@@ -6707,6 +6775,13 @@ interface StartGuiServerOptions {
6707
6775
  * it overrides `selfUpdate`'s default factory.
6708
6776
  */
6709
6777
  updateServiceFactory?: (emit: (type: string, data: unknown) => void) => UpdateService;
6778
+ /**
6779
+ * Desktop shell only: open an external URL in the OS default browser. The
6780
+ * embedded desktop webview has no tabs, so `target="_blank"` links are routed
6781
+ * to `GET /api/desktop/open` which calls this. Omitted for the web/CLI GUI —
6782
+ * the route then 404s, so a browser-served GUI can never trigger an OS open.
6783
+ */
6784
+ desktopOpenExternal?: (url: string) => void;
6710
6785
  }
6711
6786
  interface GuiServerHandle {
6712
6787
  server: Server;
@@ -7117,4 +7192,4 @@ declare function dedupeAndDetectViews(plan: ProposedSchema, data: Record<string,
7117
7192
  views: DetectedView[];
7118
7193
  };
7119
7194
 
7120
- export { ALL_PROVENANCE_FIELDS, type AddWorkspaceOptions, type AdoptNativeOptions, type AdoptResult, type AggregateFunction, type AggregateHaving, type AggregateOptions, type AggregateResult, type AggregateSpec, type ApplyWriteResult, type AsOfCandidate, type AsOfColumnCandidate, type AsOfInputs, type AudienceRowCtx, type AuditEvent, type AutoUpdateResult, type BacklinkSignal, type BelongsToRelation, type BelongsToSource, type BenchmarkOptions, type BenchmarkReport, type BenchmarkScale, type BlobMetadata, BoundedReadError, type BuiltinTemplateName, CLOUD_SETTING_SYSTEM_PROMPT, CLOUD_SETTING_WORKSPACE_LOGO, CLOUD_SETTING_WORKSPACE_LOGO_ETAG, CONFIG_SUBDIR, type CatalogEntity, type CatalogRecord, type ChangeEntry, type ChangelogOptions, type ChunkedMigrationOptions, type ChunkedMigrationResult, type ChunkerFn, type ClassifyMatch, type CleanupOptions, type CleanupResult, type CloudProbeResult, type CloudS3Secret, ComputedColumnCycleError, type ComputedColumnSpec, type CountOptions, type CrawlOptions, type CrawlResult, type CustomSignal, type CustomSource, DEFAULT_ENTRY_TYPES, DEFAULT_MAX_NODES, DEFAULT_TYPE_ALIASES, type DetectedView, type DiagnoseOptions, type DiscoveredTable, EMBEDDINGS_TABLE, EmbeddingDimensionMismatchError, type EmbeddingRefreshResult, EmbeddingScanTooLargeError, type EmbeddingsConfig, type EnrichOptions, type EnrichResult, type EnrichedSource, type EnrichmentLookup, type EntityContextDefinition, type EntityContextManifestEntry, type EntityFileManifestInfo, type EntityFileSource, type EntityFileSpec, type EntityMatch, type EntityProfileField, type EntityProfileSection, type EntityProfileTemplate, type EntityRenderSpec, type EntityRenderTemplate, type EntitySectionPerRow, type EntitySectionsTemplate, type EntityTableColumn, type EntityTableTemplate, type EvalQuery, type EvalRegression, type ExistingTable, type ExtensionAvailability, type ExtractEdgesSpec, type ExtractedObject, FileSourceKeyStore, type FileSourceKeyStoreOptions, type FilesRow, type Filter, type FilterAnd, type FilterExpr, type FilterOp, type FilterOr, FoldCache, type FtsConfig, type FtsGroup, type FtsHit, type FtsOptions, type FtsResult, type GraphBoostOptions, type GraphBoostResult, type GraphEdge, type GraphNode, type GraphTraversalResult, type GuiServerHandle, type HasManyRelation, type HasManySource, type HealthIssueKind, type HealthSeverity, type HybridScoreBreakdown, type HybridSearchOptions, type HybridSearchResult, type ImportMode, type ImportProgress, InMemorySourceKeyStore, InMemoryStateStore, type InferredColumn, type InferredDimension, type InferredEntity, type InferredLinkage, type InferredType, type InitOptions, LEGACY_MEMBER_GROUP, LOCAL_DB_RELPATH, type LatencyStats, Lattice, type LatticeConfig, type LatticeConfigInput, type LatticeEntityDef, type LatticeEntityRenderSpec, type LatticeFieldDef, type LatticeFieldType, type LatticeManifest, type LatticeOptions, type LinkOptions, type LlmClient, type LlmMessage, MAX_TRAVERSAL_DEPTH, type ManyToManySource, type MarkdownTableColumn, type MaterializeCtx, type MaterializeOptions, type MaterializeResult, type MaterializedRollupSpec, type MigrateResult, type Migration, type MigrationCheckpoint, type MigrationOptions, type MigrationProgress, type MigrationResult, type MigrationStatus, type MultiTableDefinition, NATIVE_ENTITY_DEFS, NATIVE_ENTITY_NAMES, NATIVE_REGISTRY_TABLE, type Observation, type OrderBySpec, type OrganizeOptions, type OrganizeResult, type OrganizedCreation, type OrganizedLink, type ParseError, type ParseResult, type ParsedConfig, type PdfOptions, type PdfSenderInput, type PerQueryEval, type PkLookup, PostgresAdapter, type PostgresAdapterOptions, type PreparedStatement, type PrimaryKey, ProgressThrottle, type ProposedSchema, type ProvenanceConfig, type ProvenanceField, ProvenanceImmutableError, type QueryOptions, type QueryPageOptions, type QueryPageResult, type QueryProjection, READ_ONLY_HEADER, ROOT_DIRNAME, type RankingOptions, type ReadOnlyHeaderOptions, type RecencySignal, type ReconcileOptions, type ReconcileResult, type RefKind, type RefProvider, type ReferenceMetadata, ReferenceUnavailableError, type RefreshEmbeddingsOptions, type Relation, type RelevanceLabel, type RemoteBlobStore, type RenderHooks, type RenderOptions, type RenderProgress, type RenderProgressCallback, type RenderProgressKind, type RenderResult, type RenderSpec, type ReportConfig, type ReportResult, type ReportSection, type ReportSectionResult, type RerankCandidate, type RerankScore, type RerankerFn, type ResolveOptions, type RetrievalEvalOptions, type RetrievalEvalSummary, type RetrievalHealthIssue, type RetrievalHealthReport, type RetrievalHealthSpec, type RetrievalSlo, type Retriever, type RetryOptions, type ReverseSeedDetection, type ReverseSeedResult, type ReverseSeedTableResult, type ReverseSyncError, type ReverseSyncResult, type ReverseSyncUpdate, type RewardScores, type RewardSignal, type RollupFunction, type Row, type RowVisibilityDefault, type S3Config, type S3StoreConfig, S3UnavailableError, S3_SECRET_TABLE, SQLiteAdapter, type SchemaEntity, type SchemaMatch, type SearchOptions, type SearchResult, type SecurityOptions, type SeedConfig, type SeedLinkSpec, SeedReconciliationError, type SeedResult, type SelfSource, type SemanticChunkerOptions, type SessionEntry, type SessionParseOptions, type SessionWriteEntry, type SessionWriteOp, type SessionWriteParseResult, type SloViolation, type SourceHandle, type SourceKeyStore, type SourceMetadata, type SourceQueryOptions, SourceShreddedError, type StartGuiServerOptions, type StopFn, type StorageAdapter, type SyncResult, TRUST_COLUMNS, type TableDefinition, type TableHealth, type TablePolicy, type TemplateRenderSpec, type TextChunk, type TraversalDirection, type TraversalNode, type TraversalOptions, type TrustConfig, type TrustState, type TurnParams, type TurnResult, type UnresolvedLink, type UpsertByNaturalKeyOptions, type UserIdentity, type UserPreferences, type VectorHit, type Viewer, type VisionOptions, type VisionSenderInput, WORKSPACES_SUBDIR, type WatchOptions, type WorkspacePaths, type WorkspaceRecord, type WorkspaceRegistry, type WriteHook, type WriteHookContext, type WritebackDefinition, type WritebackStateStore, type WritebackValidationResult, activeWorkspaceLabel, addEdge, addEdges, addWorkspace, adoptNativeEntities, allComputedDeps, analyticsEnabled, applyChunkedMigration, applyReranker, applyTokenBudget, applyWriteEntry, archiveLocalSqlite, assertSafeUrl, attachBlob, audiencePredicate, audienceViewSql, autoFtsColumns, autoUpdate, backfillOwnership, backlinkBoost, benchmarkRetrieval, buildVectorIndex, canManageRoles, checkSlos, chunkText, classifyLinks, cloudRlsInstalled, computeColumns, computedColumnDdl, computedColumnOrder, concatRowText, configDir, contentHash, cosineSimilarity, crawlUrl, createReadOnlyHeader, createS3Store, createSQLiteStateStore, decrypt, dedupeAndDetectViews, defaultWorkspaceYaml, deleteDbCredential, deleteToken, deriveCanonicalContexts, deriveKey, describeImage, describePdf, detectAsOf, detectAsOfCandidates, detectAsOfColumns, detectRetrievalRegressions, diagnoseRetrieval, discoverCloudTables, dropVectorIndex, enableAudienceView, enableChangelogRls, enableRlsForTable, encrypt, enrichKnowledge, ensureCheckpointTable, ensureEdgesTable, ensureEmbeddingsTable, ensureFtsIndex, ensureLatticeRoot, entityFileNames, estimateTokens, evaluateRetrieval, excelToRecords, extractEdgesFromColumn, extractObjects, filePresignSql, findLatticeRoot, fixSchemaConflicts, foldEntity, formatHealthReport, frontmatter, ftsTableName, fullTextSearch, generateEntryId, generateMemberPassword, generateWriteEntryId, getActiveWorkspace, getCloudSetting, getDbCredential, getMigrationCheckpoint, getOrCreateMasterKey, getTablePolicy, getWorkspace, grantPresignerToMemberGroup, graphAdjacencyBoost, hasFilePresigner, hasFtsIndex, hasVectorIndex, hashFile, hybridSearch, importLegacyUserConfig, inferFieldType, inferSchema, installCloudRls, installCloudSettings, installFilePresigner, isEncrypted, isNativeEntity, isPostgresUrl, isPrivateIp, isRetryableDbError, isRowAudience, latencyStats, listDbCredentials, listMigrationCheckpoints, listNativeBindings, listTokens, listWorkspaces, loadColumnPolicy, manifestPath, markdownTable, matchSchemaToExisting, materializeImport, memberGroupFor, memberRoleName, migrateLatticeData, neighbors, normalizeName, observationVisible, observationsFromChange, openTargetLatticeForMigration, openUnderSource, organizeSource, parseCellDate, parseConfigFile, parseConfigString, parseMarkdownEntries, parseMatches, parseObjects, parseSessionMD, parseSessionWrites, percentile, probeCloud, provenanceColumns, providerForUrl, provisionMemberRole, rankingBoost, readIdentity, readManifest, readPreferences, readRegistry, readToken, recencyBoost, referenceLocalFile, referenceUrl, refreshEmbeddings, regenerateAudienceViewFromDb, registerNativeEntities, registryPath, removeEdge, removeEmbedding, renameEntities, resolveActiveS3Config, resolveLatticeRoot, resolveProvenanceFields, resolveSource, resolveTrustDefault, resolveWorkspacePaths, resumeMigration, revertMigration, revokeMemberRole, rewardBoost, rollupColumnDdl, rootConfigDir, s3Key, saveDbCredential, saveDbCredentialForTeam, sealUnderSource, searchByEmbedding, searchVectorIndex, secureCloud, seedColumnPolicyFromYaml, semanticChunker, setActiveWorkspace, setCloudS3Secret, setCloudSetting, setColumnAudience, setRowVisibility, setTableDefaultVisibility, setTableNeverShare, shredSource, slugify, sourceRecords, startGuiServer, storeEmbedding, summarizeText, tableNeedsAudienceView, toSafeDirName, traverse, truncate, validateEntryId, vectorIndexAvailable, vectorIndexName, withRetry, workspaceBlobsDir, workspaceConfigPath, workspaceContextDir, workspaceDataDir, workspaceDbPath, workspaceDir, workspacesDir, writeIdentity, writeManifest, writePreferences, writeRegistry, writeToken };
7195
+ export { ALL_PROVENANCE_FIELDS, type AddWorkspaceOptions, type AdoptNativeOptions, type AdoptResult, type AggregateFunction, type AggregateHaving, type AggregateOptions, type AggregateResult, type AggregateSpec, type ApplyWriteResult, type AsOfCandidate, type AsOfColumnCandidate, type AsOfInputs, type AudienceRowCtx, type AuditEvent, type AutoUpdateResult, type BacklinkSignal, type BelongsToRelation, type BelongsToSource, type BenchmarkOptions, type BenchmarkReport, type BenchmarkScale, type BlobMetadata, BoundedReadError, type BuiltinTemplateName, CLOUD_SETTING_SYSTEM_PROMPT, CLOUD_SETTING_WORKSPACE_LOGO, CLOUD_SETTING_WORKSPACE_LOGO_ETAG, CONFIG_SUBDIR, type CatalogEntity, type CatalogRecord, type ChangeEntry, type ChangelogOptions, type ChunkedMigrationOptions, type ChunkedMigrationResult, type ChunkerFn, type ClassifyMatch, type CleanupOptions, type CleanupResult, type CloudProbeResult, type CloudS3Secret, ComputedColumnCycleError, type ComputedColumnSpec, type CountOptions, type CrawlOptions, type CrawlResult, type CustomSignal, type CustomSource, DEFAULT_ENTRY_TYPES, DEFAULT_MAX_NODES, DEFAULT_TYPE_ALIASES, DenoSqliteAdapter, type DetectedView, type DiagnoseOptions, type DiscoveredTable, EMBEDDINGS_TABLE, EmbeddingDimensionMismatchError, type EmbeddingRefreshResult, EmbeddingScanTooLargeError, type EmbeddingsConfig, type EnrichOptions, type EnrichResult, type EnrichedSource, type EnrichmentLookup, type EntityContextDefinition, type EntityContextManifestEntry, type EntityFileManifestInfo, type EntityFileSource, type EntityFileSpec, type EntityMatch, type EntityProfileField, type EntityProfileSection, type EntityProfileTemplate, type EntityRenderSpec, type EntityRenderTemplate, type EntitySectionPerRow, type EntitySectionsTemplate, type EntityTableColumn, type EntityTableTemplate, type EvalQuery, type EvalRegression, type ExistingTable, type ExtensionAvailability, type ExtractEdgesSpec, type ExtractedObject, FileSourceKeyStore, type FileSourceKeyStoreOptions, type FilesRow, type Filter, type FilterAnd, type FilterExpr, type FilterOp, type FilterOr, FoldCache, type FtsConfig, type FtsGroup, type FtsHit, type FtsOptions, type FtsResult, type GraphBoostOptions, type GraphBoostResult, type GraphEdge, type GraphNode, type GraphTraversalResult, type GuiServerHandle, type HasManyRelation, type HasManySource, type HealthIssueKind, type HealthSeverity, type HybridScoreBreakdown, type HybridSearchOptions, type HybridSearchResult, type ImportMode, type ImportProgress, InMemorySourceKeyStore, InMemoryStateStore, type InferredColumn, type InferredDimension, type InferredEntity, type InferredLinkage, type InferredType, type InitOptions, LEGACY_MEMBER_GROUP, LOCAL_DB_RELPATH, type LatencyStats, Lattice, type LatticeConfig, type LatticeConfigInput, type LatticeEntityDef, type LatticeEntityRenderSpec, type LatticeFieldDef, type LatticeFieldType, type LatticeManifest, type LatticeOptions, type LinkOptions, type LlmClient, type LlmMessage, MAX_TRAVERSAL_DEPTH, type ManyToManySource, type MarkdownTableColumn, type MaterializeCtx, type MaterializeOptions, type MaterializeResult, type MaterializedRollupSpec, type MigrateResult, type Migration, type MigrationCheckpoint, type MigrationOptions, type MigrationProgress, type MigrationResult, type MigrationStatus, type MultiTableDefinition, NATIVE_ENTITY_DEFS, NATIVE_ENTITY_NAMES, NATIVE_REGISTRY_TABLE, type Observation, type OrderBySpec, type OrganizeOptions, type OrganizeResult, type OrganizedCreation, type OrganizedLink, type ParseError, type ParseResult, type ParsedConfig, type PdfOptions, type PdfSenderInput, type PerQueryEval, type PkLookup, PostgresAdapter, type PostgresAdapterOptions, type PreparedStatement, type PrimaryKey, ProgressThrottle, type ProposedSchema, type ProvenanceConfig, type ProvenanceField, ProvenanceImmutableError, type QueryOptions, type QueryPageOptions, type QueryPageResult, type QueryProjection, READ_ONLY_HEADER, ROOT_DIRNAME, type RankingOptions, type ReadOnlyHeaderOptions, type RecencySignal, type ReconcileOptions, type ReconcileResult, type RefKind, type RefProvider, type ReferenceMetadata, ReferenceUnavailableError, type RefreshEmbeddingsOptions, type Relation, type RelevanceLabel, type RemoteBlobStore, type RenderHooks, type RenderOptions, type RenderProgress, type RenderProgressCallback, type RenderProgressKind, type RenderResult, type RenderSpec, type ReportConfig, type ReportResult, type ReportSection, type ReportSectionResult, type RerankCandidate, type RerankScore, type RerankerFn, type ResolveOptions, type RetrievalEvalOptions, type RetrievalEvalSummary, type RetrievalHealthIssue, type RetrievalHealthReport, type RetrievalHealthSpec, type RetrievalSlo, type Retriever, type RetryOptions, type ReverseSeedDetection, type ReverseSeedResult, type ReverseSeedTableResult, type ReverseSyncError, type ReverseSyncResult, type ReverseSyncUpdate, type RewardScores, type RewardSignal, type RollupFunction, type Row, type RowVisibilityDefault, type S3Config, type S3StoreConfig, S3UnavailableError, S3_SECRET_TABLE, SQLiteAdapter, type SchemaEntity, type SchemaMatch, type SearchOptions, type SearchResult, type SecurityOptions, type SeedConfig, type SeedLinkSpec, SeedReconciliationError, type SeedResult, type SelfSource, type SemanticChunkerOptions, type SessionEntry, type SessionParseOptions, type SessionWriteEntry, type SessionWriteOp, type SessionWriteParseResult, type SloViolation, type SourceHandle, type SourceKeyStore, type SourceMetadata, type SourceQueryOptions, SourceShreddedError, type StartGuiServerOptions, type StopFn, type StorageAdapter, type SyncResult, TRUST_COLUMNS, type TableDefinition, type TableHealth, type TablePolicy, type TemplateRenderSpec, type TextChunk, type TraversalDirection, type TraversalNode, type TraversalOptions, type TrustConfig, type TrustState, type TurnParams, type TurnResult, type UnresolvedLink, type UpsertByNaturalKeyOptions, type UserIdentity, type UserPreferences, type VectorHit, type Viewer, type VisionOptions, type VisionSenderInput, WORKSPACES_SUBDIR, type WatchOptions, type WorkspacePaths, type WorkspaceRecord, type WorkspaceRegistry, type WriteHook, type WriteHookContext, type WritebackDefinition, type WritebackStateStore, type WritebackValidationResult, activeWorkspaceLabel, addEdge, addEdges, addWorkspace, adoptNativeEntities, allComputedDeps, analyticsEnabled, applyChunkedMigration, applyReranker, applyTokenBudget, applyWriteEntry, archiveLocalSqlite, assertSafeUrl, attachBlob, audiencePredicate, audienceViewSql, autoFtsColumns, autoUpdate, backfillOwnership, backlinkBoost, benchmarkRetrieval, buildVectorIndex, canManageRoles, checkSlos, chunkText, classifyLinks, cloudRlsInstalled, computeColumns, computedColumnDdl, computedColumnOrder, concatRowText, configDir, contentHash, cosineSimilarity, crawlUrl, createReadOnlyHeader, createS3Store, createSQLiteStateStore, decrypt, dedupeAndDetectViews, defaultWorkspaceYaml, deleteDbCredential, deleteToken, deriveCanonicalContexts, deriveKey, describeImage, describePdf, detectAsOf, detectAsOfCandidates, detectAsOfColumns, detectRetrievalRegressions, diagnoseRetrieval, discoverCloudTables, dropVectorIndex, enableAudienceView, enableChangelogRls, enableRlsForTable, encrypt, enrichKnowledge, ensureCheckpointTable, ensureEdgesTable, ensureEmbeddingsTable, ensureFtsIndex, ensureLatticeRoot, entityFileNames, estimateTokens, evaluateRetrieval, excelToRecords, extractEdgesFromColumn, extractObjects, filePresignSql, findLatticeRoot, fixSchemaConflicts, foldEntity, formatHealthReport, frontmatter, ftsTableName, fullTextSearch, generateEntryId, generateMemberPassword, generateWriteEntryId, getActiveWorkspace, getCloudSetting, getDbCredential, getMigrationCheckpoint, getOrCreateMasterKey, getTablePolicy, getWorkspace, grantPresignerToMemberGroup, graphAdjacencyBoost, hasFilePresigner, hasFtsIndex, hasVectorIndex, hashFile, hybridSearch, importLegacyUserConfig, inferFieldType, inferSchema, installCloudRls, installCloudSettings, installFilePresigner, isEncrypted, isNativeEntity, isPostgresUrl, isPrivateIp, isRetryableDbError, isRowAudience, latencyStats, listDbCredentials, listMigrationCheckpoints, listNativeBindings, listTokens, listWorkspaces, loadColumnPolicy, manifestPath, markdownTable, matchSchemaToExisting, materializeImport, memberGroupFor, memberRoleName, migrateLatticeData, neighbors, normalizeName, observationVisible, observationsFromChange, openTargetLatticeForMigration, openUnderSource, organizeSource, parseCellDate, parseConfigFile, parseConfigString, parseMarkdownEntries, parseMatches, parseObjects, parseSessionMD, parseSessionWrites, percentile, probeCloud, provenanceColumns, providerForUrl, provisionMemberRole, rankingBoost, readIdentity, readManifest, readPreferences, readRegistry, readToken, recencyBoost, referenceLocalFile, referenceUrl, refreshEmbeddings, regenerateAudienceViewFromDb, registerNativeEntities, registryPath, removeEdge, removeEmbedding, renameEntities, resolveActiveS3Config, resolveLatticeRoot, resolveProvenanceFields, resolveSource, resolveTrustDefault, resolveWorkspacePaths, resumeMigration, revertMigration, revokeMemberRole, rewardBoost, rollupColumnDdl, rootConfigDir, s3Key, saveDbCredential, saveDbCredentialForTeam, sealUnderSource, searchByEmbedding, searchVectorIndex, secureCloud, seedColumnPolicyFromYaml, semanticChunker, setActiveWorkspace, setCloudS3Secret, setCloudSetting, setColumnAudience, setRowVisibility, setTableDefaultVisibility, setTableNeverShare, shredSource, slugify, sourceRecords, startGuiServer, storeEmbedding, summarizeText, tableNeedsAudienceView, toSafeDirName, traverse, truncate, validateEntryId, vectorIndexAvailable, vectorIndexName, withRetry, workspaceBlobsDir, workspaceConfigPath, workspaceContextDir, workspaceDataDir, workspaceDbPath, workspaceDir, workspacesDir, writeIdentity, writeManifest, writePreferences, writeRegistry, writeToken };