@signetai/connector-forge 0.227.1 → 0.228.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.
Files changed (2) hide show
  1. package/dist/index.js +467 -191
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  // src/index.ts
2
2
  import {
3
3
  existsSync as existsSync2,
4
- lstatSync as lstatSync2,
4
+ lstatSync,
5
5
  mkdirSync,
6
6
  readFileSync as readFileSync2,
7
7
  readdirSync,
8
8
  readlinkSync,
9
- rmSync as rmSync2,
9
+ rmSync,
10
10
  unlinkSync as unlinkSync3,
11
11
  writeFileSync as writeFileSync2
12
12
  } from "node:fs";
13
13
  import { homedir as homedir3 } from "node:os";
14
- import { join as join6, resolve as resolve6 } from "node:path";
14
+ import { join as join6, resolve as resolve5 } from "node:path";
15
15
 
16
16
  // ../../../libs/connector-base/dist/index.js
17
17
  import { randomBytes } from "node:crypto";
@@ -19,7 +19,7 @@ import { existsSync, readFileSync, realpathSync, renameSync, statSync, unlinkSyn
19
19
  import { homedir } from "node:os";
20
20
  import { dirname as dirname2, isAbsolute, join as join3, relative, sep } from "node:path";
21
21
  import { createRequire } from "node:module";
22
- import { dirname, join } from "node:path";
22
+ import { dirname, join, resolve } from "node:path";
23
23
  import { fileURLToPath } from "node:url";
24
24
  import {
25
25
  execFile as nodeExecFile,
@@ -31,29 +31,30 @@ import {
31
31
  import { promisify } from "node:util";
32
32
  import { createHash } from "node:crypto";
33
33
  import { homedir as homedir2 } from "node:os";
34
- import { join as join2, resolve } from "node:path";
34
+ import { join as join2, resolve as resolve2 } from "node:path";
35
+ import { constants as fsConstants } from "node:fs";
35
36
  import {
36
- closeSync as closeSync2,
37
- existsSync as existsSync7,
37
+ closeSync as closeSync3,
38
+ existsSync as existsSync12,
38
39
  fsyncSync as fsyncSync2,
39
- mkdirSync as mkdirSync3,
40
- openSync as openSync2,
41
- readFileSync as readFileSync5,
42
- renameSync as renameSync2,
43
- rmSync,
44
- statSync as statSync3,
40
+ mkdirSync as mkdirSync6,
41
+ openSync as openSync3,
42
+ readFileSync as readFileSync9,
43
+ renameSync as renameSync3,
44
+ rmSync as rmSync3,
45
+ statSync as statSync5,
45
46
  writeSync
46
47
  } from "node:fs";
47
48
  import { homedir as homedir4 } from "node:os";
48
- import { dirname as dirname4, join as join8, resolve as resolve2 } from "node:path";
49
+ import { dirname as dirname5, join as join13, resolve as resolve7 } from "node:path";
49
50
  import { createRequire as createRequire2 } from "node:module";
50
51
  import { homedir as homedir5 } from "node:os";
51
- import { dirname as dirname5, join as join9, resolve as resolve3 } from "node:path";
52
+ import { dirname as dirname6, join as join14, resolve as resolve8 } from "node:path";
52
53
  import { homedir as homedir6, platform as platform2 } from "node:os";
53
- import { basename, dirname as dirname6, resolve as resolve5 } from "node:path";
54
+ import { basename, dirname as dirname7, resolve as resolve9 } from "node:path";
54
55
  import { homedir as homedir8 } from "node:os";
55
- import { existsSync as existsSync14, lstatSync, mkdirSync as mkdirSync8, readdirSync as readdirSync6, symlinkSync, unlinkSync as unlinkSync2 } from "node:fs";
56
- import { join as join14 } from "node:path";
56
+ import { existsSync as existsSync18, lstatSync as lstatSync3, mkdirSync as mkdirSync10, readdirSync as readdirSync9, symlinkSync as symlinkSync2, unlinkSync as unlinkSync2 } from "node:fs";
57
+ import { join as join18 } from "node:path";
57
58
  var __create2 = Object.create;
58
59
  var __getProtoOf2 = Object.getPrototypeOf;
59
60
  var __defProp2 = Object.defineProperty;
@@ -15920,6 +15921,102 @@ function up159(db) {
15920
15921
  ON memories(agent_id, memory_kind);
15921
15922
  `);
15922
15923
  }
15924
+ var ledgerColumns = [
15925
+ "key",
15926
+ "agent_id",
15927
+ "workspace_id",
15928
+ "file_name",
15929
+ "status",
15930
+ "original_path",
15931
+ "sha256",
15932
+ "size_bytes",
15933
+ "request_fingerprint",
15934
+ "source_id",
15935
+ "lease_token",
15936
+ "lease_expires_at",
15937
+ "attempt_count",
15938
+ "error",
15939
+ "created_at",
15940
+ "updated_at"
15941
+ ];
15942
+ function columns(db, table) {
15943
+ return new Set(db.prepare(`PRAGMA table_info(${table})`).all().map((row) => String(row.name)));
15944
+ }
15945
+ function addMissingColumns(db, table, definitions) {
15946
+ const present = columns(db, table);
15947
+ for (const definition of definitions) {
15948
+ const name = definition.split(" ", 1)[0];
15949
+ if (!present.has(name))
15950
+ db.exec(`ALTER TABLE ${table} ADD COLUMN ${definition}`);
15951
+ }
15952
+ }
15953
+ function rebuildLedgerWithoutGlobalKeyPrimaryKey(db) {
15954
+ const keyInfo = db.prepare("PRAGMA table_info(import_admission_ledger)").all().find((row) => row.name === "key");
15955
+ if (!keyInfo || Number(keyInfo.pk) === 0)
15956
+ return;
15957
+ const savepoint = "migration_158_rebuild_ledger";
15958
+ db.exec(`SAVEPOINT ${savepoint}`);
15959
+ try {
15960
+ db.exec(`
15961
+ CREATE TABLE import_admission_ledger_v158 (
15962
+ key TEXT NOT NULL, agent_id TEXT NOT NULL DEFAULT '', workspace_id TEXT NOT NULL DEFAULT '',
15963
+ file_name TEXT NOT NULL, status TEXT NOT NULL CHECK (status IN ('pending','processing','imported','duplicate','failed','quarantined','original_unavailable')),
15964
+ original_path TEXT NOT NULL, sha256 TEXT NOT NULL, size_bytes INTEGER NOT NULL,
15965
+ request_fingerprint TEXT NOT NULL DEFAULT '', source_id TEXT, lease_token TEXT, lease_expires_at TEXT,
15966
+ attempt_count INTEGER NOT NULL DEFAULT 0, error TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL
15967
+ );
15968
+ INSERT INTO import_admission_ledger_v158 (${ledgerColumns.join(",")})
15969
+ SELECT ${ledgerColumns.join(",")} FROM import_admission_ledger;
15970
+ DROP TABLE import_admission_ledger;
15971
+ ALTER TABLE import_admission_ledger_v158 RENAME TO import_admission_ledger;
15972
+ `);
15973
+ db.exec(`RELEASE ${savepoint}`);
15974
+ } catch (error) {
15975
+ try {
15976
+ db.exec(`ROLLBACK TO SAVEPOINT ${savepoint}`);
15977
+ } finally {
15978
+ try {
15979
+ db.exec(`RELEASE ${savepoint}`);
15980
+ } catch {}
15981
+ }
15982
+ throw error;
15983
+ }
15984
+ }
15985
+ function up160(db) {
15986
+ db.exec(`
15987
+ CREATE TABLE IF NOT EXISTS import_admission_ledger (
15988
+ key TEXT NOT NULL, agent_id TEXT NOT NULL, workspace_id TEXT NOT NULL DEFAULT '', file_name TEXT NOT NULL,
15989
+ status TEXT NOT NULL CHECK (status IN ('pending','processing','imported','duplicate','failed','quarantined','original_unavailable')),
15990
+ original_path TEXT NOT NULL, sha256 TEXT NOT NULL, size_bytes INTEGER NOT NULL,
15991
+ request_fingerprint TEXT NOT NULL DEFAULT '', source_id TEXT, lease_token TEXT, lease_expires_at TEXT,
15992
+ attempt_count INTEGER NOT NULL DEFAULT 0, error TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL
15993
+ );
15994
+ CREATE TABLE IF NOT EXISTS import_admission_events (
15995
+ id INTEGER PRIMARY KEY AUTOINCREMENT, admission_key TEXT NOT NULL, agent_id TEXT NOT NULL DEFAULT '',
15996
+ workspace_id TEXT NOT NULL DEFAULT '', event TEXT NOT NULL, created_at TEXT NOT NULL
15997
+ );
15998
+ `);
15999
+ addMissingColumns(db, "import_admission_ledger", [
16000
+ "agent_id TEXT NOT NULL DEFAULT ''",
16001
+ "workspace_id TEXT NOT NULL DEFAULT ''",
16002
+ "request_fingerprint TEXT NOT NULL DEFAULT ''",
16003
+ "source_id TEXT",
16004
+ "lease_token TEXT",
16005
+ "lease_expires_at TEXT",
16006
+ "attempt_count INTEGER NOT NULL DEFAULT 0",
16007
+ "error TEXT"
16008
+ ]);
16009
+ addMissingColumns(db, "import_admission_events", [
16010
+ "agent_id TEXT NOT NULL DEFAULT ''",
16011
+ "workspace_id TEXT NOT NULL DEFAULT ''"
16012
+ ]);
16013
+ rebuildLedgerWithoutGlobalKeyPrimaryKey(db);
16014
+ db.exec(`
16015
+ CREATE UNIQUE INDEX IF NOT EXISTS uq_import_admission_scope_key ON import_admission_ledger(key, agent_id, workspace_id);
16016
+ CREATE INDEX IF NOT EXISTS idx_import_admission_status ON import_admission_ledger(agent_id, workspace_id, status, updated_at);
16017
+ CREATE INDEX IF NOT EXISTS idx_import_admission_events_key ON import_admission_events(admission_key, agent_id, workspace_id, id);
16018
+ `);
16019
+ }
15923
16020
  var MIGRATIONS = [
15924
16021
  {
15925
16022
  version: 1,
@@ -17208,6 +17305,18 @@ var MIGRATIONS = [
17208
17305
  version: 159,
17209
17306
  name: "retire-obsolete-invocation-ledger",
17210
17307
  up: up5
17308
+ },
17309
+ {
17310
+ version: 160,
17311
+ name: "import-admission-ledger",
17312
+ up: up160,
17313
+ artifacts: {
17314
+ tables: ["import_admission_ledger", "import_admission_events"],
17315
+ indexes: ["idx_import_admission_status", "idx_import_admission_events_key"],
17316
+ columns: [
17317
+ ...["workspace_id", "request_fingerprint", "source_id", "lease_token", "lease_expires_at", "attempt_count"].map((column) => ({ table: "import_admission_ledger", column }))
17318
+ ]
17319
+ }
17211
17320
  }
17212
17321
  ];
17213
17322
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -17222,6 +17331,98 @@ function expandHome(p2, home = homedir2()) {
17222
17331
  return join2(home, p2.slice(2));
17223
17332
  return p2;
17224
17333
  }
17334
+ var SIGNET_SOURCE_CHECKOUT_DIRNAME = "signetai";
17335
+ var SIGNET_GIT_ALLOWED_DIRECTORIES = ["skills", "tools", "dreaming"];
17336
+ var SIGNET_GIT_PROTECTED_PATHS = [
17337
+ ".daemon",
17338
+ ".secrets",
17339
+ ".shadow",
17340
+ "cache",
17341
+ "data",
17342
+ "files",
17343
+ "runtime",
17344
+ "workspace-layout.json",
17345
+ "node_modules",
17346
+ ":(glob)**/node_modules/**",
17347
+ `${SIGNET_SOURCE_CHECKOUT_DIRNAME}`,
17348
+ "memory/backups",
17349
+ "memory/memories.db",
17350
+ ":(glob)memory/memories.db*",
17351
+ ":(glob)memory/**/*.db",
17352
+ ":(glob)memory/**/*.db-*",
17353
+ ":(glob)memory/**/*.db-journal",
17354
+ ":(glob)memory/**/*.db-shm",
17355
+ ":(glob)memory/**/*.db-wal",
17356
+ ":(glob)memory/**/*.sqlite",
17357
+ ":(glob)memory/**/*.sqlite3",
17358
+ ":(glob)**/*.db",
17359
+ ":(glob)**/*.db-*",
17360
+ ":(glob)**/*.db-journal",
17361
+ ":(glob)**/*.db-shm",
17362
+ ":(glob)**/*.db-wal",
17363
+ ":(glob)**/*.sqlite",
17364
+ ":(glob)**/*.sqlite3"
17365
+ ];
17366
+ var SIGNET_GIT_TRACKED_PATHS = [
17367
+ "*.md",
17368
+ ":(glob)**/*.md",
17369
+ "*.json",
17370
+ ":(glob)**/*.json",
17371
+ "*.jsonl",
17372
+ ":(glob)**/*.jsonl",
17373
+ "*.html",
17374
+ ":(glob)**/*.html",
17375
+ "*.yaml",
17376
+ ":(glob)**/*.yaml",
17377
+ "*.yml",
17378
+ ":(glob)**/*.yml",
17379
+ ...SIGNET_GIT_ALLOWED_DIRECTORIES
17380
+ ];
17381
+ var SIGNET_GITIGNORE_PROTECTED_PATTERNS = [
17382
+ ".daemon/",
17383
+ ".secrets/",
17384
+ ".shadow/",
17385
+ "cache/",
17386
+ "data/",
17387
+ "files/",
17388
+ "runtime/",
17389
+ "workspace-layout.json",
17390
+ "node_modules/",
17391
+ `${SIGNET_SOURCE_CHECKOUT_DIRNAME}/`,
17392
+ "memory/memories.db*",
17393
+ "memory/**/*.db",
17394
+ "memory/**/*.db-*",
17395
+ "memory/**/*.db-journal",
17396
+ "memory/**/*.db-shm",
17397
+ "memory/**/*.db-wal",
17398
+ "memory/**/*.sqlite",
17399
+ "memory/**/*.sqlite3",
17400
+ "memory/backups/",
17401
+ "*.db",
17402
+ "*.db-*",
17403
+ "*.db-journal",
17404
+ "*.db-shm",
17405
+ "*.db-wal",
17406
+ "*.sqlite",
17407
+ "*.sqlite3"
17408
+ ];
17409
+ var DESCRIPTOR_ROOT = process.platform === "linux" ? "/proc/self/fd" : process.platform === "darwin" ? "/dev/fd" : undefined;
17410
+ var DIRECTORY_FLAGS = fsConstants.O_RDONLY | (fsConstants.O_DIRECTORY ?? 0) | (fsConstants.O_NOFOLLOW ?? 0);
17411
+ var FILE_FLAGS = fsConstants.O_RDONLY | (fsConstants.O_NOFOLLOW ?? 0) | (fsConstants.O_NONBLOCK ?? 0);
17412
+ var NOFOLLOW = fsConstants.O_NOFOLLOW ?? 0;
17413
+ var PROTECTION_COMPONENT_IDS = [
17414
+ "root-authored",
17415
+ "skills",
17416
+ "managed-originals",
17417
+ "sqlite",
17418
+ "transcripts",
17419
+ "external-sources",
17420
+ "runtime",
17421
+ "filesystem-cache",
17422
+ "secrets"
17423
+ ];
17424
+ var ORDER = new Map(PROTECTION_COMPONENT_IDS.map((id, index) => [id, index]));
17425
+ var BLOCKING = new Set(["missing", "stale", "degraded"]);
17225
17426
  var STATES = new Set([
17226
17427
  "found",
17227
17428
  "missing",
@@ -17318,7 +17519,7 @@ function resolveSignetDaemonUrl(opts = {}) {
17318
17519
  var WORKSPACE_ENV_KEYS = ["SIGNET_PATH", "SIGNET_WORKSPACE"];
17319
17520
  var DEFAULT_AGENTS_DIRNAME = ".agents";
17320
17521
  function normalizeWorkspacePath(pathValue, home = homedir4()) {
17321
- return resolve2(expandHome(pathValue.trim(), home));
17522
+ return resolve7(expandHome(pathValue.trim(), home));
17322
17523
  }
17323
17524
  function readTrimmedEnv(env, name) {
17324
17525
  const value = env[name];
@@ -17330,13 +17531,13 @@ function readTrimmedEnv(env, name) {
17330
17531
  function readConfigHome(env, home) {
17331
17532
  const raw = env.XDG_CONFIG_HOME;
17332
17533
  if (typeof raw !== "string")
17333
- return join8(home, ".config");
17534
+ return join13(home, ".config");
17334
17535
  const trimmed = raw.trim();
17335
- return trimmed.length > 0 ? normalizeWorkspacePath(trimmed, home) : join8(home, ".config");
17536
+ return trimmed.length > 0 ? normalizeWorkspacePath(trimmed, home) : join13(home, ".config");
17336
17537
  }
17337
17538
  function isExistingDirectory(path) {
17338
17539
  try {
17339
- return statSync3(path).isDirectory();
17540
+ return statSync5(path).isDirectory();
17340
17541
  } catch {
17341
17542
  return false;
17342
17543
  }
@@ -17345,16 +17546,16 @@ function isRecord5(value) {
17345
17546
  return typeof value === "object" && value !== null && !Array.isArray(value);
17346
17547
  }
17347
17548
  function getWorkspaceConfigPath(env = process.env, home = homedir4()) {
17348
- return join8(readConfigHome(env, home), "signet", "workspace.json");
17549
+ return join13(readConfigHome(env, home), "signet", "workspace.json");
17349
17550
  }
17350
17551
  function readConfiguredWorkspacePath(env = process.env, home = homedir4(), options = {}) {
17351
17552
  const strict = options.strict ?? true;
17352
17553
  const configPath = getWorkspaceConfigPath(env, home);
17353
- if (!existsSync7(configPath))
17554
+ if (!existsSync12(configPath))
17354
17555
  return null;
17355
17556
  let raw;
17356
17557
  try {
17357
- raw = JSON.parse(readFileSync5(configPath, "utf-8"));
17558
+ raw = JSON.parse(readFileSync9(configPath, "utf-8"));
17358
17559
  } catch (err) {
17359
17560
  if (!strict)
17360
17561
  return null;
@@ -17399,7 +17600,7 @@ function resolveWorkspacePath(options = {}) {
17399
17600
  };
17400
17601
  }
17401
17602
  return {
17402
- path: join8(home, DEFAULT_AGENTS_DIRNAME),
17603
+ path: join13(home, DEFAULT_AGENTS_DIRNAME),
17403
17604
  source: "default",
17404
17605
  configPath,
17405
17606
  configuredPath: configValue
@@ -17422,81 +17623,18 @@ try {
17422
17623
  const esmRequire = createRequire2(import.meta.url);
17423
17624
  native = esmRequire("@signet/native");
17424
17625
  } catch {}
17425
- var GRAPHIQ_DEFAULT_INSTALL_DIR = join9(homedir5(), ".local", "bin");
17426
- var SIGNET_SOURCE_CHECKOUT_DIRNAME = "signetai";
17427
- var SIGNET_GIT_ALLOWED_DIRECTORIES = ["skills", "tools", "dreaming"];
17428
- var SIGNET_GIT_PROTECTED_PATHS = [
17429
- ".daemon",
17430
- ".shadow",
17431
- "node_modules",
17432
- ":(glob)**/node_modules/**",
17433
- `${SIGNET_SOURCE_CHECKOUT_DIRNAME}`,
17434
- "memory/backups",
17435
- "memory/memories.db",
17436
- ":(glob)memory/memories.db*",
17437
- ":(glob)memory/**/*.db",
17438
- ":(glob)memory/**/*.db-*",
17439
- ":(glob)memory/**/*.db-journal",
17440
- ":(glob)memory/**/*.db-shm",
17441
- ":(glob)memory/**/*.db-wal",
17442
- ":(glob)memory/**/*.sqlite",
17443
- ":(glob)memory/**/*.sqlite3",
17444
- ":(glob)**/*.db",
17445
- ":(glob)**/*.db-*",
17446
- ":(glob)**/*.db-journal",
17447
- ":(glob)**/*.db-shm",
17448
- ":(glob)**/*.db-wal",
17449
- ":(glob)**/*.sqlite",
17450
- ":(glob)**/*.sqlite3"
17451
- ];
17452
- var SIGNET_GIT_TRACKED_PATHS = [
17453
- "*.md",
17454
- ":(glob)**/*.md",
17455
- "*.json",
17456
- ":(glob)**/*.json",
17457
- "*.jsonl",
17458
- ":(glob)**/*.jsonl",
17459
- "*.html",
17460
- ":(glob)**/*.html",
17461
- "*.yaml",
17462
- ":(glob)**/*.yaml",
17463
- "*.yml",
17464
- ":(glob)**/*.yml",
17465
- ...SIGNET_GIT_ALLOWED_DIRECTORIES
17466
- ];
17467
- var SIGNET_GITIGNORE_PROTECTED_PATTERNS = [
17468
- ".daemon/",
17469
- ".shadow/",
17470
- "node_modules/",
17471
- `${SIGNET_SOURCE_CHECKOUT_DIRNAME}/`,
17472
- "memory/memories.db*",
17473
- "memory/**/*.db",
17474
- "memory/**/*.db-*",
17475
- "memory/**/*.db-journal",
17476
- "memory/**/*.db-shm",
17477
- "memory/**/*.db-wal",
17478
- "memory/**/*.sqlite",
17479
- "memory/**/*.sqlite3",
17480
- "memory/backups/",
17481
- "*.db",
17482
- "*.db-*",
17483
- "*.db-journal",
17484
- "*.db-shm",
17485
- "*.db-wal",
17486
- "*.sqlite",
17487
- "*.sqlite3"
17488
- ];
17626
+ var GRAPHIQ_DEFAULT_INSTALL_DIR = join14(homedir5(), ".local", "bin");
17489
17627
  var DEFAULT_DISCORD_DESKTOP_CACHE_PATH = defaultDiscordDesktopCachePath();
17490
17628
  var DEFAULT_GITHUB_RESOURCE_TYPES = ["issues", "pulls", "discussions", "docs"];
17491
17629
  var VALID_GITHUB_RESOURCE_TYPES = new Set(DEFAULT_GITHUB_RESOURCE_TYPES);
17492
17630
  function defaultDiscordDesktopCachePath() {
17493
17631
  switch (platform2()) {
17494
17632
  case "darwin":
17495
- return resolve5(homedir6(), "Library", "Application Support", "discord");
17633
+ return resolve9(homedir6(), "Library", "Application Support", "discord");
17496
17634
  case "win32":
17497
- return resolve5(process.env.APPDATA || resolve5(homedir6(), "AppData", "Roaming"), "discord");
17635
+ return resolve9(process.env.APPDATA || resolve9(homedir6(), "AppData", "Roaming"), "discord");
17498
17636
  default:
17499
- return resolve5(process.env.XDG_CONFIG_HOME || resolve5(homedir6(), ".config"), "discord");
17637
+ return resolve9(process.env.XDG_CONFIG_HOME || resolve9(homedir6(), ".config"), "discord");
17500
17638
  }
17501
17639
  }
17502
17640
  var IDENTITY_FILES = {
@@ -17556,7 +17694,7 @@ var REQUIRED_IDENTITY_KEYS = Object.entries(IDENTITY_FILES).filter(([, spec]) =>
17556
17694
  var OPTIONAL_IDENTITY_KEYS = Object.entries(IDENTITY_FILES).filter(([, spec]) => spec.optional).map(([key]) => key);
17557
17695
  function linkDirSync(target, path) {
17558
17696
  const type = process.platform === "win32" ? "junction" : "dir";
17559
- symlinkSync(target, path, type);
17697
+ symlinkSync2(target, path, type);
17560
17698
  }
17561
17699
  function symlinkSkills(sourceDir, targetDir, options = {}) {
17562
17700
  const result = {
@@ -17564,19 +17702,19 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
17564
17702
  skipped: [],
17565
17703
  errors: []
17566
17704
  };
17567
- if (!existsSync14(sourceDir)) {
17705
+ if (!existsSync18(sourceDir)) {
17568
17706
  return result;
17569
17707
  }
17570
- const targetParent = join14(targetDir, "..");
17571
- if (!existsSync14(targetParent)) {
17572
- mkdirSync8(targetParent, { recursive: true });
17708
+ const targetParent = join18(targetDir, "..");
17709
+ if (!existsSync18(targetParent)) {
17710
+ mkdirSync10(targetParent, { recursive: true });
17573
17711
  }
17574
- if (!existsSync14(targetDir)) {
17575
- mkdirSync8(targetDir, { recursive: true });
17712
+ if (!existsSync18(targetDir)) {
17713
+ mkdirSync10(targetDir, { recursive: true });
17576
17714
  }
17577
17715
  let entries;
17578
17716
  try {
17579
- entries = readdirSync6(sourceDir);
17717
+ entries = readdirSync9(sourceDir);
17580
17718
  } catch (e) {
17581
17719
  result.errors.push({
17582
17720
  path: sourceDir,
@@ -17585,10 +17723,10 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
17585
17723
  return result;
17586
17724
  }
17587
17725
  for (const entry of entries) {
17588
- const srcPath = join14(sourceDir, entry);
17589
- const destPath = join14(targetDir, entry);
17726
+ const srcPath = join18(sourceDir, entry);
17727
+ const destPath = join18(targetDir, entry);
17590
17728
  try {
17591
- const src = lstatSync(srcPath);
17729
+ const src = lstatSync3(srcPath);
17592
17730
  if (src.isSymbolicLink() || !src.isDirectory()) {
17593
17731
  result.skipped.push(srcPath);
17594
17732
  continue;
@@ -17601,7 +17739,7 @@ function symlinkSkills(sourceDir, targetDir, options = {}) {
17601
17739
  continue;
17602
17740
  }
17603
17741
  try {
17604
- const destStat = lstatSync(destPath);
17742
+ const destStat = lstatSync3(destPath);
17605
17743
  if (destStat.isSymbolicLink()) {
17606
17744
  if (!options.dryRun) {
17607
17745
  unlinkSync2(destPath);
@@ -17830,7 +17968,7 @@ function resolveRemoteDaemonUrl() {
17830
17968
 
17831
17969
  // ../../../platform/core/dist/index.js
17832
17970
  import { createRequire as createRequire3 } from "node:module";
17833
- import { dirname as dirname3, join as join4 } from "node:path";
17971
+ import { dirname as dirname3, join as join4, resolve as resolve3 } from "node:path";
17834
17972
  import { fileURLToPath as fileURLToPath2 } from "node:url";
17835
17973
  import {
17836
17974
  execFile as nodeExecFile2,
@@ -17842,14 +17980,15 @@ import {
17842
17980
  import { promisify as promisify2 } from "node:util";
17843
17981
  import { createHash as createHash2 } from "node:crypto";
17844
17982
  import { homedir as homedir22 } from "node:os";
17845
- import { join as join22, resolve as resolve4 } from "node:path";
17983
+ import { join as join22, resolve as resolve22 } from "node:path";
17984
+ import { constants as fsConstants2 } from "node:fs";
17846
17985
  import { createRequire as createRequire22 } from "node:module";
17847
17986
  import { homedir as homedir52 } from "node:os";
17848
- import { dirname as dirname52, join as join92, resolve as resolve32 } from "node:path";
17987
+ import { dirname as dirname62, join as join142, resolve as resolve82 } from "node:path";
17849
17988
  import { homedir as homedir62, platform as platform22 } from "node:os";
17850
- import { basename as basename2, dirname as dirname62, resolve as resolve52 } from "node:path";
17851
- import { existsSync as existsSync12, readFileSync as readFileSync9, realpathSync as realpathSync2, statSync as statSync7 } from "node:fs";
17852
- import { dirname as dirname7, join as join12 } from "node:path";
17989
+ import { basename as basename2, dirname as dirname72, resolve as resolve92 } from "node:path";
17990
+ import { existsSync as existsSync16, readFileSync as readFileSync13, realpathSync as realpathSync2, statSync as statSync8 } from "node:fs";
17991
+ import { dirname as dirname8, join as join16 } from "node:path";
17853
17992
  import { homedir as homedir82 } from "node:os";
17854
17993
  var __create = Object.create;
17855
17994
  var __getProtoOf = Object.getPrototypeOf;
@@ -28416,7 +28555,7 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
28416
28555
  "checkpoint",
28417
28556
  "dreaming"
28418
28557
  ];
28419
- function up160(db) {
28558
+ function up161(db) {
28420
28559
  const hasColumn26 = (table, column) => {
28421
28560
  const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
28422
28561
  try {
@@ -28483,8 +28622,8 @@ function up210(db) {
28483
28622
  `);
28484
28623
  }
28485
28624
  function addColumnIfMissing30(db, column, definition) {
28486
- const columns = db.prepare("PRAGMA table_info(transcript_capture_jobs)").all();
28487
- if (columns.some((row) => row.name === column))
28625
+ const columns2 = db.prepare("PRAGMA table_info(transcript_capture_jobs)").all();
28626
+ if (columns2.some((row) => row.name === column))
28488
28627
  return;
28489
28628
  db.exec(`ALTER TABLE transcript_capture_jobs ADD COLUMN ${column} ${definition}`);
28490
28629
  }
@@ -29365,8 +29504,8 @@ function up252(db) {
29365
29504
  addColumnIfMissing82(db, "session_memories", "structural_density", "INTEGER");
29366
29505
  }
29367
29506
  function up262(db) {
29368
- const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
29369
- const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
29507
+ const columns2 = db.prepare("PRAGMA table_info(session_checkpoints)").all();
29508
+ const columnNames = new Set(columns2.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
29370
29509
  if (!columnNames.has("focal_entity_ids")) {
29371
29510
  db.exec("ALTER TABLE session_checkpoints ADD COLUMN focal_entity_ids TEXT");
29372
29511
  }
@@ -31678,8 +31817,8 @@ function up972(db) {
31678
31817
  `);
31679
31818
  }
31680
31819
  function up982(db) {
31681
- const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
31682
- if (!columns.some((column) => column.name === "evidence_cursor")) {
31820
+ const columns2 = db.prepare("PRAGMA table_info(dreaming_state)").all();
31821
+ if (!columns2.some((column) => column.name === "evidence_cursor")) {
31683
31822
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
31684
31823
  }
31685
31824
  }
@@ -31723,8 +31862,8 @@ function up1012(db) {
31723
31862
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
31724
31863
  }
31725
31864
  function up1022(db) {
31726
- const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
31727
- if (!columns.some((column) => column.name === "last_failure_at")) {
31865
+ const columns2 = db.prepare("PRAGMA table_info(dreaming_state)").all();
31866
+ if (!columns2.some((column) => column.name === "last_failure_at")) {
31728
31867
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
31729
31868
  }
31730
31869
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
@@ -31767,11 +31906,11 @@ function up1042(db) {
31767
31906
  `);
31768
31907
  }
31769
31908
  function up1052(db) {
31770
- const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
31771
- if (!columns.some((column) => column.name === "evidence_window_json")) {
31909
+ const columns2 = db.prepare("PRAGMA table_info(dreaming_passes)").all();
31910
+ if (!columns2.some((column) => column.name === "evidence_window_json")) {
31772
31911
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
31773
31912
  }
31774
- if (!columns.some((column) => column.name === "runbook_json")) {
31913
+ if (!columns2.some((column) => column.name === "runbook_json")) {
31775
31914
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
31776
31915
  }
31777
31916
  }
@@ -32210,8 +32349,8 @@ function hasTable42(db, table) {
32210
32349
  return db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
32211
32350
  }
32212
32351
  function addColumnIfMissing262(db, table, column, definition) {
32213
- const columns = db.prepare(`PRAGMA table_info(${table})`).all();
32214
- if (columns.some((row) => row.name === column))
32352
+ const columns2 = db.prepare(`PRAGMA table_info(${table})`).all();
32353
+ if (columns2.some((row) => row.name === column))
32215
32354
  return;
32216
32355
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32217
32356
  }
@@ -32223,8 +32362,8 @@ function hashTranscript2(content) {
32223
32362
  return createHash2("sha256").update(content, "utf8").digest("hex");
32224
32363
  }
32225
32364
  function backfillTranscriptHashes2(db) {
32226
- const columns = tableColumns2(db, "session_transcripts");
32227
- if (!columns.has("content_hash") || !columns.has("content"))
32365
+ const columns2 = tableColumns2(db, "session_transcripts");
32366
+ if (!columns2.has("content_hash") || !columns2.has("content"))
32228
32367
  return;
32229
32368
  const rows = db.prepare("SELECT session_key, agent_id, content FROM session_transcripts WHERE content_hash IS NULL").all();
32230
32369
  const update = db.prepare("UPDATE session_transcripts SET content_hash = ? WHERE agent_id = ? AND session_key = ? AND content_hash IS NULL");
@@ -32250,8 +32389,8 @@ function laterTimestamp2(current, candidate) {
32250
32389
  }
32251
32390
  return candidate > current ? candidate : current;
32252
32391
  }
32253
- function isCompletionBoundary2(job, columns) {
32254
- return columns.has("trigger") && job.trigger === "session_end" || columns.has("boundary_reason") && COMPLETION_BOUNDARY_REASONS2.has(job.boundary_reason ?? "");
32392
+ function isCompletionBoundary2(job, columns2) {
32393
+ return columns2.has("trigger") && job.trigger === "session_end" || columns2.has("boundary_reason") && COMPLETION_BOUNDARY_REASONS2.has(job.boundary_reason ?? "");
32255
32394
  }
32256
32395
  function mergeTranscriptContent2(current, next) {
32257
32396
  if (current.length === 0)
@@ -32499,8 +32638,8 @@ function up1262(db) {
32499
32638
  `);
32500
32639
  }
32501
32640
  function up1272(db) {
32502
- const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
32503
- const names = new Set(columns.map((column) => column.name));
32641
+ const columns2 = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
32642
+ const names = new Set(columns2.map((column) => column.name));
32504
32643
  if (!names.has("failure_class")) {
32505
32644
  db.exec("ALTER TABLE dreaming_evidence_exclusions ADD COLUMN failure_class TEXT NOT NULL DEFAULT 'unknown' CHECK (failure_class IN ('incomplete_transcript', 'source_projection', 'scope_mismatch', 'quote_mismatch', 'unknown'))");
32506
32645
  }
@@ -32912,8 +33051,8 @@ function up1382(db) {
32912
33051
  CREATE INDEX IF NOT EXISTS idx_memory_head_revision_entries_entry
32913
33052
  ON memory_head_revision_entries(agent_id, entry_id, revision DESC);
32914
33053
  `);
32915
- const columns = db.prepare("PRAGMA table_info(memory_md_heads)").all();
32916
- const names = new Set(columns.map((column) => String(column.name)));
33054
+ const columns2 = db.prepare("PRAGMA table_info(memory_md_heads)").all();
33055
+ const names = new Set(columns2.map((column) => String(column.name)));
32917
33056
  if (!names.has("revision_id"))
32918
33057
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN revision_id TEXT");
32919
33058
  if (!names.has("pass_id"))
@@ -33339,13 +33478,13 @@ function up1462(db) {
33339
33478
  `);
33340
33479
  }
33341
33480
  function up1472(db) {
33342
- const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
33343
- if (!columns.some((column) => column.name === "frontier")) {
33481
+ const columns2 = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
33482
+ if (!columns2.some((column) => column.name === "frontier")) {
33344
33483
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
33345
33484
  }
33346
33485
  }
33347
33486
  function up1482(db) {
33348
- const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
33487
+ const columns2 = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
33349
33488
  const additions = [
33350
33489
  ["migration_phase", "TEXT"],
33351
33490
  ["progress_staged", "INTEGER NOT NULL DEFAULT 0"],
@@ -33356,7 +33495,7 @@ function up1482(db) {
33356
33495
  ["provider_endpoint", "TEXT"]
33357
33496
  ];
33358
33497
  for (const [name, definition] of additions) {
33359
- if (!columns.has(name))
33498
+ if (!columns2.has(name))
33360
33499
  db.exec(`ALTER TABLE embedding_index_state ADD COLUMN ${name} ${definition}`);
33361
33500
  }
33362
33501
  db.exec(`
@@ -33380,8 +33519,8 @@ function up1482(db) {
33380
33519
  }
33381
33520
  }
33382
33521
  function up1492(db) {
33383
- const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
33384
- if (!columns.has("lease_token")) {
33522
+ const columns2 = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
33523
+ if (!columns2.has("lease_token")) {
33385
33524
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
33386
33525
  }
33387
33526
  }
@@ -33474,8 +33613,8 @@ function up1522(db) {
33474
33613
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
33475
33614
  }
33476
33615
  function up1532(db) {
33477
- const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
33478
- if (!columns.some((column) => column.name === "source_id")) {
33616
+ const columns2 = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
33617
+ if (!columns2.some((column) => column.name === "source_id")) {
33479
33618
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
33480
33619
  }
33481
33620
  }
@@ -33496,8 +33635,8 @@ function up1542(db) {
33496
33635
  addColumn("source_import_files", "error", "TEXT");
33497
33636
  }
33498
33637
  function addColumnIfMissing292(db, table, column, definition) {
33499
- const columns = db.prepare(`PRAGMA table_info(${table})`).all();
33500
- if (!columns.some((row) => row.name === column))
33638
+ const columns2 = db.prepare(`PRAGMA table_info(${table})`).all();
33639
+ if (!columns2.some((row) => row.name === column))
33501
33640
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33502
33641
  }
33503
33642
  function up1552(db) {
@@ -33697,8 +33836,8 @@ function up1572(db) {
33697
33836
  `);
33698
33837
  }
33699
33838
  function up1582(db) {
33700
- const columns = new Set(db.prepare("PRAGMA table_info(embedding_repair_checkpoints)").all().map((row) => row.name));
33701
- if (!columns.has("profile_fingerprint")) {
33839
+ const columns2 = new Set(db.prepare("PRAGMA table_info(embedding_repair_checkpoints)").all().map((row) => row.name));
33840
+ if (!columns2.has("profile_fingerprint")) {
33702
33841
  db.exec("ALTER TABLE embedding_repair_checkpoints ADD COLUMN profile_fingerprint TEXT");
33703
33842
  }
33704
33843
  db.exec(`
@@ -33717,6 +33856,102 @@ function up1592(db) {
33717
33856
  ON memories(agent_id, memory_kind);
33718
33857
  `);
33719
33858
  }
33859
+ var ledgerColumns2 = [
33860
+ "key",
33861
+ "agent_id",
33862
+ "workspace_id",
33863
+ "file_name",
33864
+ "status",
33865
+ "original_path",
33866
+ "sha256",
33867
+ "size_bytes",
33868
+ "request_fingerprint",
33869
+ "source_id",
33870
+ "lease_token",
33871
+ "lease_expires_at",
33872
+ "attempt_count",
33873
+ "error",
33874
+ "created_at",
33875
+ "updated_at"
33876
+ ];
33877
+ function columns2(db, table) {
33878
+ return new Set(db.prepare(`PRAGMA table_info(${table})`).all().map((row) => String(row.name)));
33879
+ }
33880
+ function addMissingColumns2(db, table, definitions) {
33881
+ const present = columns2(db, table);
33882
+ for (const definition of definitions) {
33883
+ const name = definition.split(" ", 1)[0];
33884
+ if (!present.has(name))
33885
+ db.exec(`ALTER TABLE ${table} ADD COLUMN ${definition}`);
33886
+ }
33887
+ }
33888
+ function rebuildLedgerWithoutGlobalKeyPrimaryKey2(db) {
33889
+ const keyInfo = db.prepare("PRAGMA table_info(import_admission_ledger)").all().find((row) => row.name === "key");
33890
+ if (!keyInfo || Number(keyInfo.pk) === 0)
33891
+ return;
33892
+ const savepoint = "migration_158_rebuild_ledger";
33893
+ db.exec(`SAVEPOINT ${savepoint}`);
33894
+ try {
33895
+ db.exec(`
33896
+ CREATE TABLE import_admission_ledger_v158 (
33897
+ key TEXT NOT NULL, agent_id TEXT NOT NULL DEFAULT '', workspace_id TEXT NOT NULL DEFAULT '',
33898
+ file_name TEXT NOT NULL, status TEXT NOT NULL CHECK (status IN ('pending','processing','imported','duplicate','failed','quarantined','original_unavailable')),
33899
+ original_path TEXT NOT NULL, sha256 TEXT NOT NULL, size_bytes INTEGER NOT NULL,
33900
+ request_fingerprint TEXT NOT NULL DEFAULT '', source_id TEXT, lease_token TEXT, lease_expires_at TEXT,
33901
+ attempt_count INTEGER NOT NULL DEFAULT 0, error TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL
33902
+ );
33903
+ INSERT INTO import_admission_ledger_v158 (${ledgerColumns2.join(",")})
33904
+ SELECT ${ledgerColumns2.join(",")} FROM import_admission_ledger;
33905
+ DROP TABLE import_admission_ledger;
33906
+ ALTER TABLE import_admission_ledger_v158 RENAME TO import_admission_ledger;
33907
+ `);
33908
+ db.exec(`RELEASE ${savepoint}`);
33909
+ } catch (error) {
33910
+ try {
33911
+ db.exec(`ROLLBACK TO SAVEPOINT ${savepoint}`);
33912
+ } finally {
33913
+ try {
33914
+ db.exec(`RELEASE ${savepoint}`);
33915
+ } catch {}
33916
+ }
33917
+ throw error;
33918
+ }
33919
+ }
33920
+ function up1602(db) {
33921
+ db.exec(`
33922
+ CREATE TABLE IF NOT EXISTS import_admission_ledger (
33923
+ key TEXT NOT NULL, agent_id TEXT NOT NULL, workspace_id TEXT NOT NULL DEFAULT '', file_name TEXT NOT NULL,
33924
+ status TEXT NOT NULL CHECK (status IN ('pending','processing','imported','duplicate','failed','quarantined','original_unavailable')),
33925
+ original_path TEXT NOT NULL, sha256 TEXT NOT NULL, size_bytes INTEGER NOT NULL,
33926
+ request_fingerprint TEXT NOT NULL DEFAULT '', source_id TEXT, lease_token TEXT, lease_expires_at TEXT,
33927
+ attempt_count INTEGER NOT NULL DEFAULT 0, error TEXT, created_at TEXT NOT NULL, updated_at TEXT NOT NULL
33928
+ );
33929
+ CREATE TABLE IF NOT EXISTS import_admission_events (
33930
+ id INTEGER PRIMARY KEY AUTOINCREMENT, admission_key TEXT NOT NULL, agent_id TEXT NOT NULL DEFAULT '',
33931
+ workspace_id TEXT NOT NULL DEFAULT '', event TEXT NOT NULL, created_at TEXT NOT NULL
33932
+ );
33933
+ `);
33934
+ addMissingColumns2(db, "import_admission_ledger", [
33935
+ "agent_id TEXT NOT NULL DEFAULT ''",
33936
+ "workspace_id TEXT NOT NULL DEFAULT ''",
33937
+ "request_fingerprint TEXT NOT NULL DEFAULT ''",
33938
+ "source_id TEXT",
33939
+ "lease_token TEXT",
33940
+ "lease_expires_at TEXT",
33941
+ "attempt_count INTEGER NOT NULL DEFAULT 0",
33942
+ "error TEXT"
33943
+ ]);
33944
+ addMissingColumns2(db, "import_admission_events", [
33945
+ "agent_id TEXT NOT NULL DEFAULT ''",
33946
+ "workspace_id TEXT NOT NULL DEFAULT ''"
33947
+ ]);
33948
+ rebuildLedgerWithoutGlobalKeyPrimaryKey2(db);
33949
+ db.exec(`
33950
+ CREATE UNIQUE INDEX IF NOT EXISTS uq_import_admission_scope_key ON import_admission_ledger(key, agent_id, workspace_id);
33951
+ CREATE INDEX IF NOT EXISTS idx_import_admission_status ON import_admission_ledger(agent_id, workspace_id, status, updated_at);
33952
+ CREATE INDEX IF NOT EXISTS idx_import_admission_events_key ON import_admission_events(admission_key, agent_id, workspace_id, id);
33953
+ `);
33954
+ }
33720
33955
  var MIGRATIONS2 = [
33721
33956
  {
33722
33957
  version: 1,
@@ -34921,7 +35156,7 @@ var MIGRATIONS2 = [
34921
35156
  {
34922
35157
  version: 151,
34923
35158
  name: "transcript-import-bytes",
34924
- up: up160,
35159
+ up: up161,
34925
35160
  artifacts: {
34926
35161
  tables: [
34927
35162
  "source_import_chunks",
@@ -35005,6 +35240,18 @@ var MIGRATIONS2 = [
35005
35240
  version: 159,
35006
35241
  name: "retire-obsolete-invocation-ledger",
35007
35242
  up: up510
35243
+ },
35244
+ {
35245
+ version: 160,
35246
+ name: "import-admission-ledger",
35247
+ up: up1602,
35248
+ artifacts: {
35249
+ tables: ["import_admission_ledger", "import_admission_events"],
35250
+ indexes: ["idx_import_admission_status", "idx_import_admission_events_key"],
35251
+ columns: [
35252
+ ...["workspace_id", "request_fingerprint", "source_id", "lease_token", "lease_expires_at", "attempt_count"].map((column) => ({ table: "import_admission_ledger", column }))
35253
+ ]
35254
+ }
35008
35255
  }
35009
35256
  ];
35010
35257
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;
@@ -35019,38 +35266,17 @@ function expandHome2(p3, home2 = homedir22()) {
35019
35266
  return join22(home2, p3.slice(2));
35020
35267
  return p3;
35021
35268
  }
35022
- var STATES2 = new Set([
35023
- "found",
35024
- "missing",
35025
- "locked",
35026
- "unavailable",
35027
- "permission-denied",
35028
- "corrupt",
35029
- "unsupported"
35030
- ]);
35031
- var mutation2 = Promise.resolve();
35032
- var LOOPBACK_HOST2 = "127.0.0.1";
35033
- var LOCAL_BINDS2 = new Set([LOOPBACK_HOST2, "localhost", "::1", "::ffff:127.0.0.1"]);
35034
- var import_yaml22 = __toESM(require_dist2(), 1);
35035
- function parseSimpleYaml(text) {
35036
- try {
35037
- const parsed = import_yaml22.default.parse(text);
35038
- return typeof parsed === "object" && parsed !== null ? parsed : {};
35039
- } catch {
35040
- return {};
35041
- }
35042
- }
35043
- var native2 = null;
35044
- try {
35045
- const esmRequire = createRequire22(import.meta.url);
35046
- native2 = esmRequire("@signet/native");
35047
- } catch {}
35048
- var GRAPHIQ_DEFAULT_INSTALL_DIR2 = join92(homedir52(), ".local", "bin");
35049
35269
  var SIGNET_SOURCE_CHECKOUT_DIRNAME2 = "signetai";
35050
35270
  var SIGNET_GIT_ALLOWED_DIRECTORIES2 = ["skills", "tools", "dreaming"];
35051
35271
  var SIGNET_GIT_PROTECTED_PATHS2 = [
35052
35272
  ".daemon",
35273
+ ".secrets",
35053
35274
  ".shadow",
35275
+ "cache",
35276
+ "data",
35277
+ "files",
35278
+ "runtime",
35279
+ "workspace-layout.json",
35054
35280
  "node_modules",
35055
35281
  ":(glob)**/node_modules/**",
35056
35282
  `${SIGNET_SOURCE_CHECKOUT_DIRNAME2}`,
@@ -35089,7 +35315,13 @@ var SIGNET_GIT_TRACKED_PATHS2 = [
35089
35315
  ];
35090
35316
  var SIGNET_GITIGNORE_PROTECTED_PATTERNS2 = [
35091
35317
  ".daemon/",
35318
+ ".secrets/",
35092
35319
  ".shadow/",
35320
+ "cache/",
35321
+ "data/",
35322
+ "files/",
35323
+ "runtime/",
35324
+ "workspace-layout.json",
35093
35325
  "node_modules/",
35094
35326
  `${SIGNET_SOURCE_CHECKOUT_DIRNAME2}/`,
35095
35327
  "memory/memories.db*",
@@ -35109,17 +35341,61 @@ var SIGNET_GITIGNORE_PROTECTED_PATTERNS2 = [
35109
35341
  "*.sqlite",
35110
35342
  "*.sqlite3"
35111
35343
  ];
35344
+ var DESCRIPTOR_ROOT2 = process.platform === "linux" ? "/proc/self/fd" : process.platform === "darwin" ? "/dev/fd" : undefined;
35345
+ var DIRECTORY_FLAGS2 = fsConstants2.O_RDONLY | (fsConstants2.O_DIRECTORY ?? 0) | (fsConstants2.O_NOFOLLOW ?? 0);
35346
+ var FILE_FLAGS2 = fsConstants2.O_RDONLY | (fsConstants2.O_NOFOLLOW ?? 0) | (fsConstants2.O_NONBLOCK ?? 0);
35347
+ var NOFOLLOW2 = fsConstants2.O_NOFOLLOW ?? 0;
35348
+ var PROTECTION_COMPONENT_IDS2 = [
35349
+ "root-authored",
35350
+ "skills",
35351
+ "managed-originals",
35352
+ "sqlite",
35353
+ "transcripts",
35354
+ "external-sources",
35355
+ "runtime",
35356
+ "filesystem-cache",
35357
+ "secrets"
35358
+ ];
35359
+ var ORDER2 = new Map(PROTECTION_COMPONENT_IDS2.map((id, index) => [id, index]));
35360
+ var BLOCKING2 = new Set(["missing", "stale", "degraded"]);
35361
+ var STATES2 = new Set([
35362
+ "found",
35363
+ "missing",
35364
+ "locked",
35365
+ "unavailable",
35366
+ "permission-denied",
35367
+ "corrupt",
35368
+ "unsupported"
35369
+ ]);
35370
+ var mutation2 = Promise.resolve();
35371
+ var LOOPBACK_HOST2 = "127.0.0.1";
35372
+ var LOCAL_BINDS2 = new Set([LOOPBACK_HOST2, "localhost", "::1", "::ffff:127.0.0.1"]);
35373
+ var import_yaml22 = __toESM(require_dist2(), 1);
35374
+ function parseSimpleYaml(text) {
35375
+ try {
35376
+ const parsed = import_yaml22.default.parse(text);
35377
+ return typeof parsed === "object" && parsed !== null ? parsed : {};
35378
+ } catch {
35379
+ return {};
35380
+ }
35381
+ }
35382
+ var native2 = null;
35383
+ try {
35384
+ const esmRequire = createRequire22(import.meta.url);
35385
+ native2 = esmRequire("@signet/native");
35386
+ } catch {}
35387
+ var GRAPHIQ_DEFAULT_INSTALL_DIR2 = join142(homedir52(), ".local", "bin");
35112
35388
  var DEFAULT_DISCORD_DESKTOP_CACHE_PATH2 = defaultDiscordDesktopCachePath2();
35113
35389
  var DEFAULT_GITHUB_RESOURCE_TYPES2 = ["issues", "pulls", "discussions", "docs"];
35114
35390
  var VALID_GITHUB_RESOURCE_TYPES2 = new Set(DEFAULT_GITHUB_RESOURCE_TYPES2);
35115
35391
  function defaultDiscordDesktopCachePath2() {
35116
35392
  switch (platform22()) {
35117
35393
  case "darwin":
35118
- return resolve52(homedir62(), "Library", "Application Support", "discord");
35394
+ return resolve92(homedir62(), "Library", "Application Support", "discord");
35119
35395
  case "win32":
35120
- return resolve52(process.env.APPDATA || resolve52(homedir62(), "AppData", "Roaming"), "discord");
35396
+ return resolve92(process.env.APPDATA || resolve92(homedir62(), "AppData", "Roaming"), "discord");
35121
35397
  default:
35122
- return resolve52(process.env.XDG_CONFIG_HOME || resolve52(homedir62(), ".config"), "discord");
35398
+ return resolve92(process.env.XDG_CONFIG_HOME || resolve92(homedir62(), ".config"), "discord");
35123
35399
  }
35124
35400
  }
35125
35401
  var IDENTITY_MODES = ["managed", "off"];
@@ -35222,7 +35498,7 @@ function hasValidIdentity(basePath) {
35222
35498
  if (mode !== "managed")
35223
35499
  return true;
35224
35500
  for (const path of resolveRequiredIdentityPaths(basePath)) {
35225
- if (!existsSync12(join12(basePath, path))) {
35501
+ if (!existsSync16(join16(basePath, path))) {
35226
35502
  return false;
35227
35503
  }
35228
35504
  }
@@ -35230,11 +35506,11 @@ function hasValidIdentity(basePath) {
35230
35506
  }
35231
35507
  function resolveRequiredIdentityPaths(basePath) {
35232
35508
  const legacyRequired = () => REQUIRED_IDENTITY_KEYS2.map((key) => IDENTITY_FILES2[key].path);
35233
- const agentYaml = join12(basePath, "agent.yaml");
35234
- if (!existsSync12(agentYaml))
35509
+ const agentYaml = join16(basePath, "agent.yaml");
35510
+ if (!existsSync16(agentYaml))
35235
35511
  return legacyRequired();
35236
35512
  try {
35237
- const config = parseSimpleYaml(readFileSync9(agentYaml, "utf-8"));
35513
+ const config = parseSimpleYaml(readFileSync13(agentYaml, "utf-8"));
35238
35514
  const identity = readRecord(readRecord(config).identity);
35239
35515
  const configured = readIdentityEntryList(readRecord(identity.startup).load);
35240
35516
  if (configured.length > 0)
@@ -35277,11 +35553,11 @@ function resolveIdentityModeFromConfig(config) {
35277
35553
  return "managed";
35278
35554
  }
35279
35555
  function loadIdentityMode(agentsDir) {
35280
- const agentYaml = join12(agentsDir, "agent.yaml");
35281
- if (!existsSync12(agentYaml))
35556
+ const agentYaml = join16(agentsDir, "agent.yaml");
35557
+ if (!existsSync16(agentYaml))
35282
35558
  return "managed";
35283
35559
  try {
35284
- return resolveIdentityModeFromConfig(parseSimpleYaml(readFileSync9(agentYaml, "utf-8")));
35560
+ return resolveIdentityModeFromConfig(parseSimpleYaml(readFileSync13(agentYaml, "utf-8")));
35285
35561
  } catch {
35286
35562
  return "managed";
35287
35563
  }
@@ -35356,7 +35632,7 @@ class ForgeConnector extends BaseConnector {
35356
35632
  getForgeHome() {
35357
35633
  const configured = readTrimmedEnv2("FORGE_CONFIG");
35358
35634
  if (configured)
35359
- return resolve6(expandHome2(configured));
35635
+ return resolve5(expandHome2(configured));
35360
35636
  const legacyPath = join6(getHomeDir(), "forge");
35361
35637
  if (existsSync2(legacyPath))
35362
35638
  return legacyPath;
@@ -35405,7 +35681,7 @@ class ForgeConnector extends BaseConnector {
35405
35681
  try {
35406
35682
  const raw = readFileSync2(staleAgentsPath, "utf-8");
35407
35683
  if (isSignetGeneratedFile(raw) || raw.includes(SIGNET_FORGE_MARKER))
35408
- rmSync2(staleAgentsPath);
35684
+ rmSync(staleAgentsPath);
35409
35685
  } catch {}
35410
35686
  }
35411
35687
  }
@@ -35441,7 +35717,7 @@ class ForgeConnector extends BaseConnector {
35441
35717
  try {
35442
35718
  const raw = readFileSync2(agentsPath, "utf-8");
35443
35719
  if (isSignetGeneratedFile(raw) || raw.includes(SIGNET_FORGE_MARKER)) {
35444
- rmSync2(agentsPath, { force: true });
35720
+ rmSync(agentsPath, { force: true });
35445
35721
  filesRemoved.push(agentsPath);
35446
35722
  }
35447
35723
  } catch {}
@@ -35461,7 +35737,7 @@ class ForgeConnector extends BaseConnector {
35461
35737
  const patched = this.removeMcpServer(config);
35462
35738
  if (patched) {
35463
35739
  if (Object.keys(config).length === 0) {
35464
- rmSync2(this.getMcpConfigPath(), { force: true });
35740
+ rmSync(this.getMcpConfigPath(), { force: true });
35465
35741
  filesRemoved.push(this.getMcpConfigPath());
35466
35742
  } else {
35467
35743
  atomicWriteJson(this.getMcpConfigPath(), config);
@@ -35542,7 +35818,7 @@ ${header}${body}
35542
35818
  const skillsDir = this.getSkillsPath();
35543
35819
  if (!existsSync2(skillsDir))
35544
35820
  return;
35545
- const skillsSource = resolve6(signetPath ?? resolveSignetWorkspacePath(), "skills");
35821
+ const skillsSource = resolve5(signetPath ?? resolveSignetWorkspacePath(), "skills");
35546
35822
  let entries;
35547
35823
  try {
35548
35824
  entries = readdirSync(skillsDir);
@@ -35552,10 +35828,10 @@ ${header}${body}
35552
35828
  for (const entry of entries) {
35553
35829
  const entryPath = join6(skillsDir, entry);
35554
35830
  try {
35555
- if (!lstatSync2(entryPath).isSymbolicLink())
35831
+ if (!lstatSync(entryPath).isSymbolicLink())
35556
35832
  continue;
35557
35833
  const rawTarget = readlinkSync(entryPath);
35558
- const target = resolve6(skillsDir, rawTarget);
35834
+ const target = resolve5(skillsDir, rawTarget);
35559
35835
  if (!isChildOf(target, skillsSource))
35560
35836
  continue;
35561
35837
  unlinkSync3(entryPath);
@@ -35564,7 +35840,7 @@ ${header}${body}
35564
35840
  }
35565
35841
  try {
35566
35842
  if (readdirSync(skillsDir).length === 0)
35567
- rmSync2(skillsDir, { recursive: true, force: true });
35843
+ rmSync(skillsDir, { recursive: true, force: true });
35568
35844
  } catch {}
35569
35845
  }
35570
35846
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-forge",
3
- "version": "0.227.1",
3
+ "version": "0.228.0",
4
4
  "description": "Signet connector for ForgeCode - installs MCP, identity, and skills integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,8 +24,8 @@
24
24
  "typecheck": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
- "@signetai/connector-base": "0.227.1",
28
- "@signetai/core": "0.227.1"
27
+ "@signetai/connector-base": "0.228.0",
28
+ "@signetai/core": "0.228.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.0.0",