@bendyline/gezel 1.0.6 → 1.1.0

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.
@@ -292,7 +292,7 @@ declare function recordLlamaQuarantine(home: string, input: {
292
292
  * (`win32-x64`, `darwin-arm64`, `linux-x64`, `linux-arm64`).
293
293
  */
294
294
 
295
- type NativeBinaryName = 'llama-server' | 'ds4-server' | 'sd-server' | 'whisper-server' | 'device-health' | 'uv';
295
+ type NativeBinaryName = 'llama-server' | 'ds4-server' | 'sd-server' | 'whisper-server' | 'device-health' | 'uv' | 'duckdb';
296
296
  interface DiscoverInput {
297
297
  /** GEZEL_HOME — backend cache file lives at `<home>/engines/llama-cpp/`. */
298
298
  home: string;
@@ -360,13 +360,6 @@ interface DiscoverResult {
360
360
  quarantined?: LlamaBackend[];
361
361
  };
362
362
  }
363
- /**
364
- * Resolve a single bundled binary under `<root>/<subdir>/<file>`. The
365
- * `subdir` is `<platform>[-<variant>]`; the file is `<name>[.exe]`.
366
- *
367
- * Returns `null` when the file isn't on disk. Caller decides whether
368
- * to fall through to a variant-less subdir or surface "not found."
369
- */
370
363
  declare function resolveNativeBinaryUnder(root: string, name: NativeBinaryName, subdir: string, platform?: NodeJS.Platform, fileExists?: (p: string) => boolean): string | null;
371
364
  /**
372
365
  * Discover bundled native binaries and stamp the matching env vars on
@@ -418,8 +411,14 @@ declare function windowsDetachedSpawnOptions(platform?: NodeJS.Platform): {
418
411
  * discovery) write/read the same cache file at
419
412
  * `<home>/engines/llama-cpp/backend.json`. A mismatch between the two
420
413
  * would cause cache thrash; keep them in one constant.
414
+ *
415
+ * Mirrors the `tag=` line of that file, so it followed upstream from the
416
+ * rolling `b####` build tags to semver stable releases (`v0.3.0`). Nothing
417
+ * compares these values for order — the cache is keyed on equality alone,
418
+ * so a scheme change simply misses once and re-probes, which is the same
419
+ * thing any bump does.
421
420
  */
422
- declare const LLAMA_ENGINE_VERSION = "b10353";
421
+ declare const LLAMA_ENGINE_VERSION = "v0.3.0";
423
422
 
424
423
  /**
425
424
  * Map a (platform, arch) pair to the subdirectory name used under
@@ -486,6 +485,9 @@ type DeviceGpuProcessOwner = 'machine-engine' | 'app-engine' | 'development-engi
486
485
  interface DeviceGpuProcess {
487
486
  pid: number;
488
487
  name?: string;
488
+ /** Windows adapter identity parsed from the PDH instance, when available. */
489
+ adapterLuid?: string;
490
+ /** Historical wire name; Windows reports resident local bytes in this field. */
489
491
  dedicatedBytes: number;
490
492
  owner: DeviceGpuProcessOwner;
491
493
  }
@@ -493,7 +495,7 @@ interface DeviceHealthSample {
493
495
  sampledAt: string;
494
496
  sources: string[];
495
497
  readings: DeviceHealthReading[];
496
- /** Dedicated GPU-memory owners when the platform exposes process counters. */
498
+ /** GPU-memory process samples when the platform exposes trustworthy counters. */
497
499
  processes?: DeviceGpuProcess[];
498
500
  errors: string[];
499
501
  }
@@ -641,4 +643,112 @@ interface FindGpuPanicOptions {
641
643
  */
642
644
  declare function findRecentGpuPanics(opts?: FindGpuPanicOptions): GpuPanicRecord[];
643
645
 
644
- export { type CommandResult, DEFAULT_DEVICE_SAFETY_POLICY, type DetectInput, type DetectResult, type DeviceHealthCommandRunner, type DeviceHealthDecision, DeviceHealthGate, type DeviceHealthGateOptions, type DeviceHealthProbe, type DeviceHealthReading, type DeviceHealthSample, type DeviceHealthState, type DeviceHealthStatusSnapshot, type DeviceSafetyMode, type DeviceSafetyPolicyInput, type DeviceTelemetryFailurePolicy, type DeviceVendor, type DiscoverInput, type DiscoverResult, type FindGpuPanicOptions, GPU_PANIC_RE, type GpuPanicRecord, type GpuVendorHint, LLAMA_ENGINE_VERSION, type LlamaBackend, type LlamaQuarantineEntry, type NativeBinaryName, type QuarantineIo, type ResolvedDeviceSafetyPolicy, type ResolvedLlamaBinary, type SystemDeviceHealthProbeOptions, binaryFingerprint, createSystemDeviceHealthProbe, detectLlamaBackend, discoverNativeBinaries, evaluateDeviceHealth, findRecentGpuPanics, isBinaryQuarantined, llamaQuarantinePath, parseAmdSmiJson, parseNvidiaSmiCsv, readLlamaQuarantine, recordLlamaQuarantine, resolveAvailableLlamaBinary, resolveDeviceSafetyPolicy, resolveNativeBinaryUnder, resolvePlatformKey, windowsDetachedSpawnOptions, windowsHeadlessSpawnOptions };
646
+ /**
647
+ * Pinned DuckDB CLI release, and the one place its identity lives.
648
+ *
649
+ * DuckDB is **vendored, not built**. The DuckDB Foundation publishes a
650
+ * precompiled single-file CLI per platform, already Developer ID signed and
651
+ * notarized on macOS and Authenticode signed on Windows, so Gezel
652
+ * redistributes those exact bytes rather than compiling or re-signing them.
653
+ * That is the same provenance rule the bundled Node runtime follows (see the
654
+ * `signIgnore` block in `packages/app/electron-builder.yml`): when a vendor
655
+ * already ships a binary that satisfies the platform's own trust model,
656
+ * putting our signature on it replaces their attestation with ours and
657
+ * destroys the "hash-comparable against the vendor's manifest" property.
658
+ *
659
+ * Two consumers read this module, which is why it lives in core rather than
660
+ * in `packages/app`:
661
+ *
662
+ * - `packages/app/scripts/fetch-duckdb.mjs` stages the binary into the
663
+ * Electron installer at build time.
664
+ * - `packages/service/src/engines/resolver.ts` downloads it at runtime for
665
+ * npm / CLI installs that have no Electron payload.
666
+ *
667
+ * Both verify against {@link DUCKDB_ARCHIVE_SHA256} (the published archive)
668
+ * and {@link DUCKDB_BINARY_SHA256} (the executable inside it), and both land
669
+ * the result in the same versioned directory — see {@link duckdbInstallDir} —
670
+ * so a machine with both a desktop install and an npm `gezeld` shares one
671
+ * verified copy.
672
+ *
673
+ * ── Why two digests ──────────────────────────────────────────────────────
674
+ *
675
+ * The archive digest is what the download path can check before it unpacks
676
+ * anything, and it is the value comparable against a digest a user computes
677
+ * from DuckDB's own release page. The binary digest is what the *bundle*
678
+ * path checks, because the Electron installer ships the extracted executable
679
+ * with no archive around it. Recording only one would leave one of the two
680
+ * paths verifying nothing.
681
+ *
682
+ * ── Bumping ──────────────────────────────────────────────────────────────
683
+ *
684
+ * Run `node scripts/bump-duckdb.mjs <version>`. It downloads every platform
685
+ * archive, computes both digests, confirms the CLI reports the pinned commit,
686
+ * and rewrites this file. The PR diff is the audit trail. Never hand-edit a
687
+ * digest.
688
+ *
689
+ * A version bump is a security review, not a chore: `DuckRunner`'s
690
+ * configuration prelude and `statement-guard`'s use of `json_serialize_sql`
691
+ * are behavioural contracts measured against a specific engine build. Re-run
692
+ * the sandbox matrix in `docs/observation-corpora.md` before landing one.
693
+ *
694
+ * License: MIT — https://github.com/duckdb/duckdb
695
+ */
696
+ /** Upstream release tag, without the leading `v`. */
697
+ declare const DUCKDB_VERSION = "1.5.5";
698
+ /**
699
+ * The commit the tag points at. `duckdb --version` echoes its first ten
700
+ * characters, which is how the fetch and bump scripts prove they unpacked the
701
+ * build this file claims rather than whatever the URL happened to serve.
702
+ */
703
+ declare const DUCKDB_COMMIT = "d8cdaa33fda8df955cc76ef58a280f68f4cd43fa";
704
+ /**
705
+ * sha256 of DuckDB's `LICENSE` at {@link DUCKDB_COMMIT}. Pinned for the same
706
+ * reason the binary is: we redistribute the text, so a silent upstream change
707
+ * to the terms should fail the build rather than ship unnoticed.
708
+ */
709
+ declare const DUCKDB_LICENSE_SHA256 = "7e17fd31249fa875cb3b1c5e05c6c3e99b75509f6a2804ca176c217834de1dcb";
710
+ /** Platform keys this pin covers — the platforms Gezel ships a daemon for. */
711
+ type DuckdbPlatformKey = 'darwin-arm64' | 'linux-x64' | 'linux-arm64' | 'win32-x64';
712
+ /**
713
+ * Release asset per platform. The glibc archives are pinned over the `-musl`
714
+ * variants to match the rest of the native tree.
715
+ */
716
+ declare const DUCKDB_ASSET: Record<DuckdbPlatformKey, string>;
717
+ /** sha256 of each published archive, as served by duckdb/duckdb's releases. */
718
+ declare const DUCKDB_ARCHIVE_SHA256: Record<DuckdbPlatformKey, string>;
719
+ /** sha256 of the `duckdb[.exe]` executable inside each archive. */
720
+ declare const DUCKDB_BINARY_SHA256: Record<DuckdbPlatformKey, string>;
721
+ /**
722
+ * The DuckDB Foundation's Apple Developer Team ID. macOS verification asserts
723
+ * *this* identity rather than Bendyline's — the whole point of vendoring the
724
+ * signed binary is that the vendor's attestation is the one that travels with
725
+ * it. Asserting the vendor's team is strictly stronger than the Windows
726
+ * precedent, which today asserts no publisher at all for vendored binaries.
727
+ */
728
+ declare const DUCKDB_APPLE_TEAM_ID = "7NCTQWA3HA";
729
+ /** Authenticode subject common name on the Windows build. */
730
+ declare const DUCKDB_WINDOWS_PUBLISHER = "Stichting DuckDB Foundation";
731
+ /** Base URL for the pinned release's assets. */
732
+ declare function duckdbAssetUrl(key: DuckdbPlatformKey, version?: string): string;
733
+ /**
734
+ * Map `(process.platform, process.arch)` to a pin key, or `null` where DuckDB
735
+ * publishes no build we ship. Callers treat `null` as "no bundled query
736
+ * engine on this host" and fall back to a system install.
737
+ */
738
+ declare function duckdbPlatformKey(platform: NodeJS.Platform, arch: string): DuckdbPlatformKey | null;
739
+ /** Executable name on this platform. */
740
+ declare function duckdbBinaryName(platform?: NodeJS.Platform): string;
741
+ /**
742
+ * Versioned install directory: `<home>/engines/duckdb/<version>/`.
743
+ *
744
+ * Versioned so a pin bump installs alongside the old copy rather than
745
+ * mutating a binary a running query may be executing, and so the discovery
746
+ * ladder can ask for exactly the build whose sandbox behaviour we measured.
747
+ * Shared by the Electron bundle installer and the CLI downloader on purpose:
748
+ * one machine, one verified copy, whichever install path put it there.
749
+ */
750
+ declare function duckdbInstallDir(home: string, version?: string): string;
751
+ /** Absolute path to the pinned executable inside {@link duckdbInstallDir}. */
752
+ declare function duckdbInstalledBinary(home: string, platform?: NodeJS.Platform, version?: string): string;
753
+
754
+ export { type CommandResult, DEFAULT_DEVICE_SAFETY_POLICY, DUCKDB_APPLE_TEAM_ID, DUCKDB_ARCHIVE_SHA256, DUCKDB_ASSET, DUCKDB_BINARY_SHA256, DUCKDB_COMMIT, DUCKDB_LICENSE_SHA256, DUCKDB_VERSION, DUCKDB_WINDOWS_PUBLISHER, type DetectInput, type DetectResult, type DeviceHealthCommandRunner, type DeviceHealthDecision, DeviceHealthGate, type DeviceHealthGateOptions, type DeviceHealthProbe, type DeviceHealthReading, type DeviceHealthSample, type DeviceHealthState, type DeviceHealthStatusSnapshot, type DeviceSafetyMode, type DeviceSafetyPolicyInput, type DeviceTelemetryFailurePolicy, type DeviceVendor, type DiscoverInput, type DiscoverResult, type DuckdbPlatformKey, type FindGpuPanicOptions, GPU_PANIC_RE, type GpuPanicRecord, type GpuVendorHint, LLAMA_ENGINE_VERSION, type LlamaBackend, type LlamaQuarantineEntry, type NativeBinaryName, type QuarantineIo, type ResolvedDeviceSafetyPolicy, type ResolvedLlamaBinary, type SystemDeviceHealthProbeOptions, binaryFingerprint, createSystemDeviceHealthProbe, detectLlamaBackend, discoverNativeBinaries, duckdbAssetUrl, duckdbBinaryName, duckdbInstallDir, duckdbInstalledBinary, duckdbPlatformKey, evaluateDeviceHealth, findRecentGpuPanics, isBinaryQuarantined, llamaQuarantinePath, parseAmdSmiJson, parseNvidiaSmiCsv, readLlamaQuarantine, recordLlamaQuarantine, resolveAvailableLlamaBinary, resolveDeviceSafetyPolicy, resolveNativeBinaryUnder, resolvePlatformKey, windowsDetachedSpawnOptions, windowsHeadlessSpawnOptions };
@@ -305,10 +305,55 @@ function isEntry(value) {
305
305
 
306
306
  // src/native/discover.ts
307
307
  import { existsSync } from "fs";
308
+ import { join as join4 } from "path";
309
+
310
+ // src/native/duckdb-pin.ts
308
311
  import { join as join3 } from "path";
312
+ var DUCKDB_VERSION = "1.5.5";
313
+ var DUCKDB_COMMIT = "d8cdaa33fda8df955cc76ef58a280f68f4cd43fa";
314
+ var DUCKDB_LICENSE_SHA256 = "7e17fd31249fa875cb3b1c5e05c6c3e99b75509f6a2804ca176c217834de1dcb";
315
+ var DUCKDB_ASSET = {
316
+ "darwin-arm64": "duckdb_cli-osx-arm64.zip",
317
+ "linux-x64": "duckdb_cli-linux-amd64.zip",
318
+ "linux-arm64": "duckdb_cli-linux-arm64.zip",
319
+ "win32-x64": "duckdb_cli-windows-amd64.zip"
320
+ };
321
+ var DUCKDB_ARCHIVE_SHA256 = {
322
+ "darwin-arm64": "da5177b8869c4ed8c65d514fb47a8ed0f6fa7427f103304932d5e83851e46abd",
323
+ "linux-x64": "08c0ca117111fcede14239d0093792352befdc174218c344d232c13279643d05",
324
+ "linux-arm64": "02163197027a42149147364d31fa67cac82108517a4be43304a1cc226eaef07a",
325
+ "win32-x64": "e1428b7114a841626b5054723731cbf45c6df91b42ae1a6c355f88fad1f6dc4c"
326
+ };
327
+ var DUCKDB_BINARY_SHA256 = {
328
+ "darwin-arm64": "d0610710dd30667aa6c76709299b6822e55dc9199803350aa2e1b06e3346943b",
329
+ "linux-x64": "3d33b1df037cb049155c393778df7853fafb23e9d49d7c9cacdde4dd67155788",
330
+ "linux-arm64": "9882c99a9804407de82c0edb1816d7667733d37d771a98eb23ad5f6a8d37acb1",
331
+ "win32-x64": "fde737c7749075f6b54e14772a4e6b33a5fa0201075d03640aca358074ea4554"
332
+ };
333
+ var DUCKDB_APPLE_TEAM_ID = "7NCTQWA3HA";
334
+ var DUCKDB_WINDOWS_PUBLISHER = "Stichting DuckDB Foundation";
335
+ function duckdbAssetUrl(key, version = DUCKDB_VERSION) {
336
+ return `https://github.com/duckdb/duckdb/releases/download/v${version}/${DUCKDB_ASSET[key]}`;
337
+ }
338
+ function duckdbPlatformKey(platform, arch) {
339
+ if (platform === "darwin" && arch === "arm64") return "darwin-arm64";
340
+ if (platform === "linux" && arch === "x64") return "linux-x64";
341
+ if (platform === "linux" && arch === "arm64") return "linux-arm64";
342
+ if (platform === "win32" && arch === "x64") return "win32-x64";
343
+ return null;
344
+ }
345
+ function duckdbBinaryName(platform = process.platform) {
346
+ return platform === "win32" ? "duckdb.exe" : "duckdb";
347
+ }
348
+ function duckdbInstallDir(home, version = DUCKDB_VERSION) {
349
+ return join3(home, "engines", "duckdb", version);
350
+ }
351
+ function duckdbInstalledBinary(home, platform = process.platform, version = DUCKDB_VERSION) {
352
+ return join3(duckdbInstallDir(home, version), duckdbBinaryName(platform));
353
+ }
309
354
 
310
355
  // src/native/llama-engine-version.ts
311
- var LLAMA_ENGINE_VERSION = "b10353";
356
+ var LLAMA_ENGINE_VERSION = "v0.3.0";
312
357
 
313
358
  // src/native/platform-key.ts
314
359
  function resolvePlatformKey(platform = process.platform, arch = process.arch) {
@@ -326,11 +371,12 @@ function resolvePlatformKey(platform = process.platform, arch = process.arch) {
326
371
  }
327
372
 
328
373
  // src/native/discover.ts
374
+ var UNPREFIXED_BINARIES = /* @__PURE__ */ new Set(["uv"]);
329
375
  function resolveNativeBinaryUnder(root, name, subdir, platform = process.platform, fileExists = existsSync) {
330
376
  const ext = platform === "win32" ? ".exe" : "";
331
- const candidates = name === "uv" ? [`uv${ext}`] : [`gezel-${name}${ext}`, `${name}${ext}`];
377
+ const candidates = UNPREFIXED_BINARIES.has(name) ? [`${name}${ext}`] : [`gezel-${name}${ext}`, `${name}${ext}`];
332
378
  for (const file of candidates) {
333
- const p = join3(root, subdir, file);
379
+ const p = join4(root, subdir, file);
334
380
  if (fileExists(p)) return p;
335
381
  }
336
382
  return null;
@@ -351,7 +397,8 @@ function discoverNativeBinaries(input) {
351
397
  "sd-server",
352
398
  "whisper-server",
353
399
  "device-health",
354
- "uv"
400
+ "uv",
401
+ "duckdb"
355
402
  ]) {
356
403
  binaries.push({ name, source: "no-platform-key" });
357
404
  }
@@ -438,6 +485,18 @@ function discoverNativeBinaries(input) {
438
485
  }
439
486
  }
440
487
  }
488
+ if (process.env.GEZEL_DUCKDB_BIN) {
489
+ binaries.push({ name: "duckdb", source: "pre-set", path: process.env.GEZEL_DUCKDB_BIN });
490
+ } else {
491
+ const duckBin = duckdbInstalledBinary(input.home, platform);
492
+ if (fileExists(duckBin)) {
493
+ process.env.GEZEL_DUCKDB_BIN = duckBin;
494
+ binaries.push({ name: "duckdb", source: "discovered", path: duckBin });
495
+ log?.info?.(`[native] duckdb: ${duckBin}`);
496
+ } else {
497
+ binaries.push({ name: "duckdb", source: "not-found" });
498
+ }
499
+ }
441
500
  const subdirFor = (name) => name === "ds4-server" && platform === "linux" ? `${platformKey}-cuda` : platformKey;
442
501
  for (const { name, envVar } of [
443
502
  { name: "ds4-server", envVar: "GEZEL_DS4_SERVER_BIN" },
@@ -703,6 +762,7 @@ function parseDeviceHealthHelperJson(stdout) {
703
762
  processes.push({
704
763
  pid,
705
764
  ...typeof process2.name === "string" ? { name: process2.name } : {},
765
+ ...typeof process2.adapterLuid === "string" && process2.adapterLuid.length > 0 ? { adapterLuid: process2.adapterLuid } : {},
706
766
  dedicatedBytes,
707
767
  owner
708
768
  });
@@ -1060,10 +1120,10 @@ var DeviceHealthGate = class {
1060
1120
  // src/native/gpu-panic.ts
1061
1121
  import { readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2 } from "fs";
1062
1122
  import { homedir } from "os";
1063
- import { join as join4 } from "path";
1123
+ import { join as join5 } from "path";
1064
1124
  var PANIC_DIRS = [
1065
1125
  "/Library/Logs/DiagnosticReports",
1066
- join4(homedir(), "Library", "Logs", "DiagnosticReports")
1126
+ join5(homedir(), "Library", "Logs", "DiagnosticReports")
1067
1127
  ];
1068
1128
  var GPU_PANIC_RE = /IOGPUMemory|IOAccelerator|AGXAccelerator|AGXG\d|completeMemory\(\)\s+prepare\s+count\s+underflow|IOGPUFamily/i;
1069
1129
  function findRecentGpuPanics(opts = {}) {
@@ -1079,7 +1139,7 @@ function findRecentGpuPanics(opts = {}) {
1079
1139
  continue;
1080
1140
  }
1081
1141
  for (const name of names) {
1082
- const path = join4(dir, name);
1142
+ const path = join5(dir, name);
1083
1143
  let mtimeMs;
1084
1144
  try {
1085
1145
  mtimeMs = statSync2(path).mtimeMs;
@@ -1102,6 +1162,14 @@ function findRecentGpuPanics(opts = {}) {
1102
1162
  export {
1103
1163
  DEFAULT_DEVICE_SAFETY_POLICY,
1104
1164
  DEVICE_HARD_TEMPERATURE_C,
1165
+ DUCKDB_APPLE_TEAM_ID,
1166
+ DUCKDB_ARCHIVE_SHA256,
1167
+ DUCKDB_ASSET,
1168
+ DUCKDB_BINARY_SHA256,
1169
+ DUCKDB_COMMIT,
1170
+ DUCKDB_LICENSE_SHA256,
1171
+ DUCKDB_VERSION,
1172
+ DUCKDB_WINDOWS_PUBLISHER,
1105
1173
  DeviceHealthGate,
1106
1174
  GPU_PANIC_RE,
1107
1175
  LLAMA_ENGINE_VERSION,
@@ -1109,6 +1177,11 @@ export {
1109
1177
  createSystemDeviceHealthProbe,
1110
1178
  detectLlamaBackend,
1111
1179
  discoverNativeBinaries,
1180
+ duckdbAssetUrl,
1181
+ duckdbBinaryName,
1182
+ duckdbInstallDir,
1183
+ duckdbInstalledBinary,
1184
+ duckdbPlatformKey,
1112
1185
  evaluateDeviceHealth,
1113
1186
  findRecentGpuPanics,
1114
1187
  isBinaryQuarantined,
package/dist/paths.d.ts CHANGED
@@ -33,6 +33,12 @@ declare function userProjectDir(root: string, projectId: string): string;
33
33
  * continues to resolve the canonical definition from the machine-shared root.
34
34
  */
35
35
  declare function projectPrivateDir(root: string, projectId: string): string;
36
+ /**
37
+ * Daemon-owned record of the seed files the applied project type deployed
38
+ * into the workspace (the "overlay manifest"). Per-machine by design — it
39
+ * lives in the private sidecar, never in the possibly-synced workspace.
40
+ */
41
+ declare function projectTypeOverlayFile(root: string, projectId: string): string;
36
42
  declare function machineSharedGezelDir(gezelId: string): string | null;
37
43
  declare function machineSharedProjectDir(projectId: string): string | null;
38
44
  /**
@@ -211,6 +217,8 @@ declare function projectFindingLifecycleFile(root: string, projectId: string): s
211
217
  declare function projectBoekwachterIssuesFile(root: string, projectId: string): string;
212
218
  /** Durable per-project code-review records for this account. */
213
219
  declare function projectCodeReviewsFile(root: string, projectId: string): string;
220
+ /** Durable per-project diffpack records for this account. */
221
+ declare function projectDiffpacksFile(root: string, projectId: string): string;
214
222
  /** Durable per-account report-action lifecycle records. */
215
223
  declare function projectReportActionsFile(root: string, projectId: string): string;
216
224
  /** Per-project documents folder — holds about.md, missionObjectives.md, etc. */
@@ -227,6 +235,73 @@ declare function projectArtifactsDir(root: string, projectId: string, external?:
227
235
  declare const PROJECT_SHADOW_DIR_NAME = "shadow";
228
236
  /** Per-project `artifacts/shadow/` root. */
229
237
  declare function projectShadowDir(root: string, projectId: string, external?: ExternalFolders): string;
238
+ /**
239
+ * Reserved artifacts subtree holding tables derived from tabular files that
240
+ * live in the project *workspace* — a CSV too large to read, a spreadsheet a
241
+ * gezel cannot open at all. Sibling to `shadow/`, and derived the same way:
242
+ * regenerable from the source file, write-denied to gezels and users, safe to
243
+ * delete.
244
+ *
245
+ * Distinct from a connector corpus under `data/`, because the two have
246
+ * different lifecycles. A connector corpus is an append-only stream that grows
247
+ * forever and needs sealing, compaction and retention; a workspace table is a
248
+ * *snapshot of one file*, rebuilt wholesale when the file's content hash moves
249
+ * and swept when the file goes.
250
+ *
251
+ * Companion directories keep the source's full basename (`sales.xlsx_tables`),
252
+ * so `X_tables` → source `X` is a lossless reverse map for orphan collection
253
+ * and `a.csv` cannot collide with `a.xlsx` — the same reasoning as the shadow
254
+ * tree's `_files` convention.
255
+ */
256
+ declare const PROJECT_TABULAR_DIR_NAME = "tabular";
257
+ /** Suffix marking one source file's companion directory under `tabular/`. */
258
+ declare const TABULAR_COMPANION_SUFFIX = "_tables";
259
+ /** Per-project `artifacts/tabular/` root. */
260
+ declare function projectTabularDir(root: string, projectId: string, external?: ExternalFolders): string;
261
+ /**
262
+ * Directory level inside a connector corpus that holds observation tables:
263
+ * `artifacts/data/<corpus>/tables/<table>/`. Deliberately NOT underscore-
264
+ * prefixed. Inside a corpus the underscore prefix marks the *mutable* surface
265
+ * (`_meta.json`, `_actions/`), and `isProtectedConnectorCorpusPath` denies
266
+ * gezel writes to everything else under `data/`. Keeping `tables` bare
267
+ * therefore inherits the existing read-only guard rather than needing a
268
+ * second one.
269
+ */
270
+ declare const CONNECTOR_TABLES_DIR_NAME = "tables";
271
+ /**
272
+ * Where a table's materialized rollups live, under its own directory. Kept
273
+ * separate from the raw partitions because retention deletes raw data and
274
+ * never deletes rollups.
275
+ */
276
+ declare const CONNECTOR_ROLLUPS_DIR_NAME = "rollups";
277
+ /** Filename of a table's semantic layer, beside its data. */
278
+ declare const OBSERVATION_TABLE_MANIFEST_FILE = "manifest.json";
279
+ /** Filename of a table's writer/compaction/rollup bookkeeping. */
280
+ declare const OBSERVATION_TABLE_STATE_FILE = "state.json";
281
+ /**
282
+ * Reserved artifacts subtree holding diffpacks: proposed change sets a gezel
283
+ * drafted but never applied. Each pack owns `after/` (the copy-on-write draft
284
+ * tree), `files/` (the sealed single-file unified diffs), `notes.md` and
285
+ * `manifest.json`. Lives under artifacts — never the workspace, which is the
286
+ * whole point: the gezel proposes, the user applies.
287
+ */
288
+ declare const PROJECT_DIFFPACKS_DIR_NAME = "diffpacks";
289
+ /** Per-project `artifacts/diffpacks/` root. */
290
+ declare function projectDiffpacksDir(root: string, projectId: string, external?: ExternalFolders): string;
291
+ /** One pack's folder: `artifacts/diffpacks/<packId>/`. */
292
+ declare function projectDiffpackDir(root: string, projectId: string, packId: string, external?: ExternalFolders): string;
293
+ /**
294
+ * Reserved artifacts subtree holding the user's chat prompt drafts. Each draft
295
+ * owns `message.md` (the prompt markdown), `message_files/` (its uploads,
296
+ * referenced document-relatively while editing) and `draft.json` (thread
297
+ * association, status, sent stamps). Lives under artifacts so a draft is an
298
+ * ordinary inspectable file the user can open, back up, and grep.
299
+ */
300
+ declare const PROJECT_PROMPTS_DIR_NAME = "prompts";
301
+ /** Per-project `artifacts/prompts/` root. */
302
+ declare function projectPromptsDir(root: string, projectId: string, external?: ExternalFolders): string;
303
+ /** One draft's folder: `artifacts/prompts/<draftId>/`. */
304
+ declare function projectPromptDraftDir(root: string, projectId: string, draftId: string, external?: ExternalFolders): string;
230
305
  /** Per-project memories folder (daily markdown + summary + vectra index). */
231
306
  declare function projectMemoriesDir(root: string, projectId: string, external?: ExternalFolders): string;
232
307
  /**
@@ -283,6 +358,13 @@ declare function projectTerminalsDir(root: string, projectId: string): string;
283
358
  declare function projectTerminalFile(root: string, projectId: string, threadId: string): string;
284
359
  /** JSONL file holding events that aren't scoped to any project. */
285
360
  declare function globalHistoryFile(root: string): string;
361
+ /**
362
+ * Gezel-to-gezel messages that were accepted but not yet dispatched — a
363
+ * handoff parks while the sender is mid-turn, and that park is a closure in
364
+ * one process's memory. Written when the park happens, dropped when the
365
+ * dispatch fires, replayed at boot.
366
+ */
367
+ declare function pendingHandoffsFile(root: string): string;
286
368
  /**
287
369
  * Home-scoped index directory for cross-project derived caches (session
288
370
  * transcripts, history mirror, documents library). Always local: it's a
@@ -293,6 +375,22 @@ declare function globalIndexDir(root: string): string;
293
375
  declare function globalIndexDbFile(root: string): string;
294
376
  /** Per-project JSONL holding events scoped to that project. Always local. */
295
377
  declare function projectHistoryFile(root: string, projectId: string): string;
378
+ /** Root of the user-private knowledge tier. Owned by the knowledge manager. */
379
+ declare function knowledgeDir(root: string): string;
380
+ /** The authoritative per-user registry of installed/enabled catalogs. */
381
+ declare function knowledgeRegistryFile(root: string): string;
382
+ /** User-private extracted catalog versions live under this tree. */
383
+ declare function knowledgeCatalogsDir(root: string): string;
384
+ /**
385
+ * One immutable extracted catalog version:
386
+ * `knowledge/catalogs/<publisherId>/<catalogId>/<version>/<digest16>/`.
387
+ * The digest segment makes re-publishing the same version string with
388
+ * different bytes land in a different directory instead of silently
389
+ * shadowing the installed one.
390
+ */
391
+ declare function knowledgeCatalogVersionDir(root: string, publisherId: string, catalogId: string, version: string, contentDigest: string): string;
392
+ /** Resumable download staging for catalog archives. */
393
+ declare function knowledgeDownloadsDir(root: string): string;
296
394
  /**
297
395
  * Single per-project file holding the array of structured Q&A
298
396
  * (`Question` records) created by the `ask_user_question` MCP tool.
@@ -378,12 +476,18 @@ declare function craftbookTemplateScriptsDir(root: string, prefix: string, id: s
378
476
  declare function craftbookTemplateScriptFile(root: string, prefix: string, id: string, version: string, name: string): string;
379
477
  /** First two lowercased chars of a craftbook id — the catalog's shard prefix. */
380
478
  declare function craftbookShardPrefix(id: string): string;
479
+ /** Installed AI App packages, kept as versioned catalog slices. */
480
+ declare function aiAppsRoot(root: string): string;
481
+ /** Active-version registry for installed AI Apps. */
482
+ declare function aiAppsRegistryFile(root: string): string;
483
+ declare function aiAppVersionDir(root: string, appId: string, version: string): string;
484
+ declare function aiAppItemsDir(root: string, appId: string, version: string): string;
485
+ declare function aiAppReceiptFile(root: string, appId: string, version: string): string;
381
486
  /**
382
487
  * Local catalog source for user-installed / imported project types. Mirrors
383
488
  * the bundled catalog layout under
384
- * `~/.gezel/project-types/{prefix}/{id}/versions/{version}/`. A `.gzl`
385
- * import or a "install from gilde" action copies items here so they browse
386
- * next to the bundled ones. See docs/project-types.md.
489
+ * `~/.gezel/project-types/{prefix}/{id}/versions/{version}/`. Manually
490
+ * authored local items browse next to bundled and mounted `.gezapp` items.
387
491
  */
388
492
  declare function projectTypesRoot(root: string): string;
389
493
  declare function projectTypeDir(root: string, prefix: string, id: string): string;
@@ -634,4 +738,4 @@ declare function binRuntimeRoot(root: string): string;
634
738
  */
635
739
  declare function readConfigRaw(root: string): Promise<Record<string, unknown>>;
636
740
 
637
- export { type ExternalFolders, type GezelPaths, MACHINE_SHARED_MARKER, type MachineStorageScope, PROJECT_SHADOW_DIR_NAME, activeMachineSharedHome, ambientDashboardLatestFile, ambientDashboardStateFile, ambientDir, ambientDisplayStateFile, backupsDir, binRuntimeRoot, channelsDir, craftbookShardPrefix, craftbookTemplateDir, craftbookTemplateManifestFile, craftbookTemplateScriptFile, craftbookTemplateScriptsDir, craftbookTemplateVersionDir, craftbookTemplateVersionManifestFile, craftbookTemplatesRoot, daemonTransactionsRoot, deviceIdentityFile, enginesRoot, fallbackProjectIndexDir, fallbackProjectVillageFile, foldersStateDir, gezelDir, gezelGrowthPath, gezelHome, gezelLocalDir, gezelMemoriesDir, gezelPaths, gezelPoppetjePath, gezelSessionFile, gezelSessionsDir, gezelStorageScope, gezelToolsPath, gezelToolsetsFile, gezelToolsetsInstallDir, gildeLiveRoot, gildeLiveStateFile, gildeLiveVersionDir, gildeLiveVersionsDir, globalHistoryFile, globalIndexDbFile, globalIndexDir, keurmeesterCasesDir, keurmeesterDigestStatePath, keurmeesterDigestsDir, keurmeesterDir, machineSharedGezelDir, machineSharedHome, machineSharedMarkerFile, machineSharedProjectDir, meesterStatusDir, meesterStatusFile, meesterStatusStateFile, pendingGrantsFile, playwrightBrowsersDir, projectActivityFile, projectArtifactsDir, projectArtifactsIndexDbFile, projectBoekwachterIssuesFile, projectCodeReviewsFile, projectContentIndexDbFile, projectCreateTransactionsRoot, projectDir, projectDocsDir, projectFindingLifecycleFile, projectHistoryFile, projectIndexDir, projectInternalGithubDir, projectLocalConfigFile, projectLocalCraftbookDir, projectLocalCraftbooksRoot, projectLocalDir, projectLocalFilesDir, projectLocalGezelDir, projectLocalGezelsRoot, projectLocalImportsFile, projectLocalIndexDbFile, projectLocalIndexDir, projectLocalPendingImportsFile, projectLocalQuarantineDir, projectLocalRoot, projectLocalVillageFile, projectMemoriesDir, projectMemoryIndexDir, projectMetaFile, projectPrivateDir, projectQuestionsFile, projectReportActionsFile, projectScriptFile, projectScriptRunFile, projectScriptRunsDir, projectScriptsDir, projectShadowDir, projectStorageDir, projectStorageScope, projectTaskAboutFile, projectTaskDir, projectTaskFile, projectTaskNextIdFile, projectTaskNotesFile, projectTasksDir, projectTerminalFile, projectTerminalsDir, projectToolsetsFile, projectToolsetsInstallDir, projectTypeDir, projectTypeManifestFile, projectTypeShardPrefix, projectTypeVersionDir, projectTypeVersionManifestFile, projectTypesRoot, readConfigRaw, remotesFile, secretsFile, secretsKeyFile, sharedCloneDir, sharedClonesRoot, sharedToolsetsFile, sharedToolsetsInstallDir, systemInstalledToolsetsFile, systemToolsetsFile, systemToolsetsInstallDir, tokensFile, toolsetConfigFile, toolsetConfigsDir, userGezelDir, userProjectDir, userScriptFile, userScriptsDir };
741
+ export { CONNECTOR_ROLLUPS_DIR_NAME, CONNECTOR_TABLES_DIR_NAME, type ExternalFolders, type GezelPaths, MACHINE_SHARED_MARKER, type MachineStorageScope, OBSERVATION_TABLE_MANIFEST_FILE, OBSERVATION_TABLE_STATE_FILE, PROJECT_DIFFPACKS_DIR_NAME, PROJECT_PROMPTS_DIR_NAME, PROJECT_SHADOW_DIR_NAME, PROJECT_TABULAR_DIR_NAME, TABULAR_COMPANION_SUFFIX, activeMachineSharedHome, aiAppItemsDir, aiAppReceiptFile, aiAppVersionDir, aiAppsRegistryFile, aiAppsRoot, ambientDashboardLatestFile, ambientDashboardStateFile, ambientDir, ambientDisplayStateFile, backupsDir, binRuntimeRoot, channelsDir, craftbookShardPrefix, craftbookTemplateDir, craftbookTemplateManifestFile, craftbookTemplateScriptFile, craftbookTemplateScriptsDir, craftbookTemplateVersionDir, craftbookTemplateVersionManifestFile, craftbookTemplatesRoot, daemonTransactionsRoot, deviceIdentityFile, enginesRoot, fallbackProjectIndexDir, fallbackProjectVillageFile, foldersStateDir, gezelDir, gezelGrowthPath, gezelHome, gezelLocalDir, gezelMemoriesDir, gezelPaths, gezelPoppetjePath, gezelSessionFile, gezelSessionsDir, gezelStorageScope, gezelToolsPath, gezelToolsetsFile, gezelToolsetsInstallDir, gildeLiveRoot, gildeLiveStateFile, gildeLiveVersionDir, gildeLiveVersionsDir, globalHistoryFile, globalIndexDbFile, globalIndexDir, keurmeesterCasesDir, keurmeesterDigestStatePath, keurmeesterDigestsDir, keurmeesterDir, knowledgeCatalogVersionDir, knowledgeCatalogsDir, knowledgeDir, knowledgeDownloadsDir, knowledgeRegistryFile, machineSharedGezelDir, machineSharedHome, machineSharedMarkerFile, machineSharedProjectDir, meesterStatusDir, meesterStatusFile, meesterStatusStateFile, pendingGrantsFile, pendingHandoffsFile, playwrightBrowsersDir, projectActivityFile, projectArtifactsDir, projectArtifactsIndexDbFile, projectBoekwachterIssuesFile, projectCodeReviewsFile, projectContentIndexDbFile, projectCreateTransactionsRoot, projectDiffpackDir, projectDiffpacksDir, projectDiffpacksFile, projectDir, projectDocsDir, projectFindingLifecycleFile, projectHistoryFile, projectIndexDir, projectInternalGithubDir, projectLocalConfigFile, projectLocalCraftbookDir, projectLocalCraftbooksRoot, projectLocalDir, projectLocalFilesDir, projectLocalGezelDir, projectLocalGezelsRoot, projectLocalImportsFile, projectLocalIndexDbFile, projectLocalIndexDir, projectLocalPendingImportsFile, projectLocalQuarantineDir, projectLocalRoot, projectLocalVillageFile, projectMemoriesDir, projectMemoryIndexDir, projectMetaFile, projectPrivateDir, projectPromptDraftDir, projectPromptsDir, projectQuestionsFile, projectReportActionsFile, projectScriptFile, projectScriptRunFile, projectScriptRunsDir, projectScriptsDir, projectShadowDir, projectStorageDir, projectStorageScope, projectTabularDir, projectTaskAboutFile, projectTaskDir, projectTaskFile, projectTaskNextIdFile, projectTaskNotesFile, projectTasksDir, projectTerminalFile, projectTerminalsDir, projectToolsetsFile, projectToolsetsInstallDir, projectTypeDir, projectTypeManifestFile, projectTypeOverlayFile, projectTypeShardPrefix, projectTypeVersionDir, projectTypeVersionManifestFile, projectTypesRoot, readConfigRaw, remotesFile, secretsFile, secretsKeyFile, sharedCloneDir, sharedClonesRoot, sharedToolsetsFile, sharedToolsetsInstallDir, systemInstalledToolsetsFile, systemToolsetsFile, systemToolsetsInstallDir, tokensFile, toolsetConfigFile, toolsetConfigsDir, userGezelDir, userProjectDir, userScriptFile, userScriptsDir };