@hasna/instructions 0.4.36 → 0.4.39

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 (52) hide show
  1. package/README.md +9 -8
  2. package/assets/skills/inbox/SKILL.md +86 -0
  3. package/dashboard/README.md +34 -70
  4. package/dist/cli/index.js +1839 -721
  5. package/dist/cli/raw-store-root.test.d.ts +2 -0
  6. package/dist/cli/raw-store-root.test.d.ts.map +1 -0
  7. package/dist/data/config-store.d.ts +4 -4
  8. package/dist/data/config-store.d.ts.map +1 -1
  9. package/dist/db/configs.d.ts.map +1 -1
  10. package/dist/db/database.d.ts.map +1 -1
  11. package/dist/generated/storage-kit/backend.d.ts +20 -0
  12. package/dist/generated/storage-kit/backend.d.ts.map +1 -0
  13. package/dist/generated/storage-kit/index.d.ts +2 -2
  14. package/dist/generated/storage-kit/index.d.ts.map +1 -1
  15. package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
  16. package/dist/generated/storage-kit/own.d.ts +11 -0
  17. package/dist/generated/storage-kit/own.d.ts.map +1 -0
  18. package/dist/generated/storage-kit/pool.d.ts +7 -6
  19. package/dist/generated/storage-kit/pool.d.ts.map +1 -1
  20. package/dist/generated/storage-kit/tls.d.ts +30 -3
  21. package/dist/generated/storage-kit/tls.d.ts.map +1 -1
  22. package/dist/index.d.ts +4 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1237 -704
  25. package/dist/lib/managed-skill-runtimes.d.ts +80 -0
  26. package/dist/lib/managed-skill-runtimes.d.ts.map +1 -0
  27. package/dist/lib/managed-skill-runtimes.test.d.ts +2 -0
  28. package/dist/lib/managed-skill-runtimes.test.d.ts.map +1 -0
  29. package/dist/lib/raw-store-root.d.ts +17 -0
  30. package/dist/lib/raw-store-root.d.ts.map +1 -0
  31. package/dist/lib/retired-storage-mode.d.ts +8 -0
  32. package/dist/lib/retired-storage-mode.d.ts.map +1 -0
  33. package/dist/lib/session-apply.d.ts.map +1 -1
  34. package/dist/lib/session-authority.d.ts +27 -0
  35. package/dist/lib/session-authority.d.ts.map +1 -0
  36. package/dist/lib/session-authority.test.d.ts +2 -0
  37. package/dist/lib/session-authority.test.d.ts.map +1 -0
  38. package/dist/lib/session-render.d.ts +5 -3
  39. package/dist/lib/session-render.d.ts.map +1 -1
  40. package/dist/mcp/index.js +303 -246
  41. package/dist/server/cloud.d.ts +2 -2
  42. package/dist/server/cloud.d.ts.map +1 -1
  43. package/dist/server/index.d.ts +1 -1
  44. package/dist/server/index.js +875 -496
  45. package/dist/status.d.ts +11 -1
  46. package/dist/status.d.ts.map +1 -1
  47. package/dist/storage/cloud-store.d.ts.map +1 -1
  48. package/dist/storage/cloud-store.test.d.ts +2 -0
  49. package/dist/storage/cloud-store.test.d.ts.map +1 -0
  50. package/package.json +10 -7
  51. package/dist/generated/storage-kit/mode.d.ts +0 -48
  52. package/dist/generated/storage-kit/mode.d.ts.map +0 -1
package/dist/mcp/index.js CHANGED
@@ -73,19 +73,51 @@ var init_types = __esm(() => {
73
73
  };
74
74
  });
75
75
 
76
+ // src/lib/retired-storage-mode.ts
77
+ function firstDefinedEnvKey(env, keys) {
78
+ for (const key of keys) {
79
+ if (Object.hasOwn(env, key) && env[key] !== undefined)
80
+ return key;
81
+ }
82
+ return null;
83
+ }
84
+ function assertNoLegacyStorageMode(env = process.env) {
85
+ const legacyKey = firstDefinedEnvKey(env, LEGACY_STORAGE_MODE_KEYS);
86
+ if (!legacyKey)
87
+ return;
88
+ throw new Error(`${legacyKey} was removed. Deployment modes no longer exist: delete the storage-mode variable. ` + `The client uses the local SQLite store, or the HTTP API selected by ` + `HASNA_INSTRUCTIONS_API_URL + HASNA_INSTRUCTIONS_API_KEY. ` + `On the server, set HASNA_INSTRUCTIONS_DATABASE_URL to select the postgresql backend, ` + `or leave it unset for sqlite.`);
89
+ }
90
+ var LEGACY_STORAGE_MODE_KEYS;
91
+ var init_retired_storage_mode = __esm(() => {
92
+ LEGACY_STORAGE_MODE_KEYS = [
93
+ "HASNA_INSTRUCTIONS_STORAGE_MODE",
94
+ "HASNA_INSTRUCTIONS_MODE",
95
+ "INSTRUCTIONS_STORAGE_MODE",
96
+ "INSTRUCTIONS_MODE"
97
+ ];
98
+ });
99
+
100
+ // src/lib/raw-store-root.ts
101
+ import { homedir } from "os";
102
+ import { join, resolve } from "path";
103
+ function getRawStoreRoot() {
104
+ return resolve(process.env[RAW_STORE_ROOT_ENV] || join(process.env["HOME"] || homedir(), ".hasna", "instructions"));
105
+ }
106
+ var RAW_STORE_ROOT_ENV = "HASNA_CONFIGS_HOME";
107
+ var init_raw_store_root = () => {};
108
+
76
109
  // src/db/database.ts
77
110
  import { Database } from "bun:sqlite";
78
111
  import { existsSync, mkdirSync, rmSync } from "fs";
79
- import { join } from "path";
112
+ import { join as join2 } from "path";
80
113
  import { randomUUID } from "crypto";
81
114
  function getDbPath() {
82
115
  if (process.env["HASNA_INSTRUCTIONS_DB_PATH"]) {
83
116
  return process.env["HASNA_INSTRUCTIONS_DB_PATH"];
84
117
  }
85
- const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
86
- const dir = join(home, ".hasna", "instructions");
118
+ const dir = getRawStoreRoot();
87
119
  mkdirSync(dir, { recursive: true });
88
- return join(dir, "instructions.db");
120
+ return join2(dir, "instructions.db");
89
121
  }
90
122
  function uuid() {
91
123
  return randomUUID();
@@ -99,8 +131,9 @@ function slugify(name) {
99
131
  function getDatabase(path) {
100
132
  if (_db)
101
133
  return _db;
134
+ assertNoLegacyStorageMode();
102
135
  if (!path && process.env["HASNA_INSTRUCTIONS_API_URL"] && process.env["HASNA_INSTRUCTIONS_API_KEY"]) {
103
- throw new Error("instructions is in self_hosted (cloud) mode: this command is not wired to the cloud API yet. " + "Unset HASNA_INSTRUCTIONS_API_URL / HASNA_INSTRUCTIONS_API_KEY to use it against the local store.");
136
+ throw new Error("instructions is using the HTTP API transport (HASNA_INSTRUCTIONS_API_URL set): this command is not wired to the API yet. " + "Unset HASNA_INSTRUCTIONS_API_URL / HASNA_INSTRUCTIONS_API_KEY to use it against the local store.");
104
137
  }
105
138
  const dbPath = path || getDbPath();
106
139
  const db = new Database(dbPath);
@@ -181,6 +214,8 @@ function insertFeedback(input, db) {
181
214
  }
182
215
  var MIGRATIONS, _db = null;
183
216
  var init_database = __esm(() => {
217
+ init_retired_storage_mode();
218
+ init_raw_store_root();
184
219
  MIGRATIONS = [
185
220
  `
186
221
  CREATE TABLE IF NOT EXISTS configs (
@@ -265,6 +300,37 @@ var init_database = __esm(() => {
265
300
  ];
266
301
  });
267
302
 
303
+ // src/db/snapshots.ts
304
+ function createSnapshot(configId, content, version, db) {
305
+ const d = db || getDatabase();
306
+ const id = uuid();
307
+ const ts = now();
308
+ d.run("INSERT INTO config_snapshots (id, config_id, content, version, created_at) VALUES (?, ?, ?, ?, ?)", [id, configId, content, version, ts]);
309
+ return { id, config_id: configId, content, version, created_at: ts };
310
+ }
311
+ function listSnapshots(configId, db) {
312
+ const d = db || getDatabase();
313
+ return d.query("SELECT * FROM config_snapshots WHERE config_id = ? ORDER BY version DESC").all(configId);
314
+ }
315
+ function getSnapshot(id, db) {
316
+ const d = db || getDatabase();
317
+ return d.query("SELECT * FROM config_snapshots WHERE id = ?").get(id);
318
+ }
319
+ function getSnapshotByVersion(configId, version, db) {
320
+ const d = db || getDatabase();
321
+ return d.query("SELECT * FROM config_snapshots WHERE config_id = ? AND version = ?").get(configId, version);
322
+ }
323
+ function pruneSnapshots(configId, keep = 10, db) {
324
+ const d = db || getDatabase();
325
+ const result = d.run(`DELETE FROM config_snapshots WHERE config_id = ? AND id NOT IN (
326
+ SELECT id FROM config_snapshots WHERE config_id = ? ORDER BY version DESC LIMIT ?
327
+ )`, [configId, configId, keep]);
328
+ return result.changes;
329
+ }
330
+ var init_snapshots = __esm(() => {
331
+ init_database();
332
+ });
333
+
268
334
  // src/db/configs.ts
269
335
  function rowToConfig(row) {
270
336
  let outputs = [];
@@ -303,25 +369,28 @@ function createConfig(input, db) {
303
369
  const slug = uniqueSlug(input.name, d);
304
370
  const tags = JSON.stringify(input.tags || []);
305
371
  const outputs = JSON.stringify(input.outputs || []);
306
- d.run(`INSERT INTO configs (id, name, slug, kind, category, agent, target_path, outputs, format, content, description, tags, is_template, version, created_at, updated_at, synced_at)
307
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, NULL)`, [
308
- id,
309
- input.name,
310
- slug,
311
- input.kind ?? "file",
312
- input.category,
313
- input.agent ?? "global",
314
- input.target_path ?? null,
315
- outputs,
316
- input.format ?? "text",
317
- input.content,
318
- input.description ?? null,
319
- tags,
320
- input.is_template ? 1 : 0,
321
- ts,
322
- ts
323
- ]);
324
- return getConfig(id, d);
372
+ return d.transaction(() => {
373
+ d.run(`INSERT INTO configs (id, name, slug, kind, category, agent, target_path, outputs, format, content, description, tags, is_template, version, created_at, updated_at, synced_at)
374
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, NULL)`, [
375
+ id,
376
+ input.name,
377
+ slug,
378
+ input.kind ?? "file",
379
+ input.category,
380
+ input.agent ?? "global",
381
+ input.target_path ?? null,
382
+ outputs,
383
+ input.format ?? "text",
384
+ input.content,
385
+ input.description ?? null,
386
+ tags,
387
+ input.is_template ? 1 : 0,
388
+ ts,
389
+ ts
390
+ ]);
391
+ createSnapshot(id, input.content, 1, d);
392
+ return getConfig(id, d);
393
+ })();
325
394
  }
326
395
  function getConfig(idOrSlug, db) {
327
396
  const d = db || getDatabase();
@@ -426,9 +495,13 @@ function updateConfig(idOrSlug, input, db) {
426
495
  updates.push("synced_at = ?");
427
496
  params.push(input.synced_at);
428
497
  }
429
- params.push(existing.id);
430
- d.run(`UPDATE configs SET ${updates.join(", ")} WHERE id = ?`, params);
431
- return getConfigById(existing.id, d);
498
+ return d.transaction(() => {
499
+ params.push(existing.id);
500
+ d.run(`UPDATE configs SET ${updates.join(", ")} WHERE id = ?`, params);
501
+ const updated = getConfigById(existing.id, d);
502
+ createSnapshot(updated.id, updated.content, updated.version, d);
503
+ return updated;
504
+ })();
432
505
  }
433
506
  function deleteConfig(idOrSlug, db) {
434
507
  const d = db || getDatabase();
@@ -448,16 +521,17 @@ function getConfigStats(db) {
448
521
  var init_configs = __esm(() => {
449
522
  init_types();
450
523
  init_database();
524
+ init_snapshots();
451
525
  });
452
526
 
453
527
  // src/lib/template.ts
454
528
  var exports_template = {};
455
529
  __export(exports_template, {
456
- renderTemplatePreview: () => renderTemplatePreview,
457
- renderTemplate: () => renderTemplate,
458
- parseTemplateVars: () => parseTemplateVars,
530
+ extractTemplateVars: () => extractTemplateVars,
459
531
  isTemplate: () => isTemplate,
460
- extractTemplateVars: () => extractTemplateVars
532
+ parseTemplateVars: () => parseTemplateVars,
533
+ renderTemplate: () => renderTemplate,
534
+ renderTemplatePreview: () => renderTemplatePreview
461
535
  });
462
536
  function parseTemplateVars(content) {
463
537
  const names = new Set;
@@ -521,9 +595,9 @@ var init_template = __esm(() => {
521
595
  });
522
596
 
523
597
  // src/lib/machine.ts
524
- import { arch as currentArch, homedir, hostname as currentHostname, type as currentOsType } from "os";
598
+ import { arch as currentArch, homedir as homedir2, hostname as currentHostname, type as currentOsType } from "os";
525
599
  import { existsSync as existsSync2 } from "fs";
526
- import { join as join2 } from "path";
600
+ import { join as join3 } from "path";
527
601
  function normalizeOsFamily(os) {
528
602
  const value = (os ?? "").trim().toLowerCase();
529
603
  if (value === "darwin" || value === "macos" || value === "mac" || value === "osx")
@@ -535,11 +609,11 @@ function normalizeOsFamily(os) {
535
609
  return value || "unknown";
536
610
  }
537
611
  function detectMachineContext(overrides = {}) {
538
- const homeDir = overrides.home_dir ?? process.env["CONFIGS_HOME"] ?? process.env["HOME"] ?? homedir();
612
+ const homeDir = overrides.home_dir ?? process.env["CONFIGS_HOME"] ?? process.env["HOME"] ?? homedir2();
539
613
  const os = overrides.os ?? currentOsType();
540
614
  const osFamily = normalizeOsFamily(os);
541
- const bunBinDir = overrides.bun_bin_dir ?? join2(homeDir, ".bun", "bin");
542
- const defaultBunPath = osFamily === "macos" && existsSync2(BREW_BUN_PATH) ? BREW_BUN_PATH : join2(bunBinDir, "bun");
615
+ const bunBinDir = overrides.bun_bin_dir ?? join3(homeDir, ".bun", "bin");
616
+ const defaultBunPath = osFamily === "macos" && existsSync2(BREW_BUN_PATH) ? BREW_BUN_PATH : join3(bunBinDir, "bun");
543
617
  return {
544
618
  id: "current-machine",
545
619
  hostname: overrides.hostname ?? currentHostname(),
@@ -549,10 +623,10 @@ function detectMachineContext(overrides = {}) {
549
623
  created_at: "",
550
624
  os_family: osFamily,
551
625
  home_dir: homeDir,
552
- workspace_root: overrides.workspace_root ?? join2(homeDir, osFamily === "macos" ? "Workspace" : "workspace"),
626
+ workspace_root: overrides.workspace_root ?? join3(homeDir, osFamily === "macos" ? "Workspace" : "workspace"),
553
627
  bun_bin_dir: bunBinDir,
554
628
  bun_path: overrides.bun_path ?? defaultBunPath,
555
- path_prefix: overrides.path_prefix ?? (osFamily === "macos" ? `${join2("/opt", "homebrew", "bin")}:${bunBinDir}` : bunBinDir)
629
+ path_prefix: overrides.path_prefix ?? (osFamily === "macos" ? `${join3("/opt", "homebrew", "bin")}:${bunBinDir}` : bunBinDir)
556
630
  };
557
631
  }
558
632
  function machineContextToVariables(machine) {
@@ -860,7 +934,7 @@ Policy reference: \`${CODEWITH_SHARED_TODOS_STORAGE_POLICY_REFERENCE}\`
860
934
  `;
861
935
  });
862
936
 
863
- // node_modules/zod/v3/helpers/util.js
937
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
864
938
  var util, objectUtil, ZodParsedType, getParsedType = (data) => {
865
939
  const t = typeof data;
866
940
  switch (t) {
@@ -991,7 +1065,7 @@ var init_util = __esm(() => {
991
1065
  ]);
992
1066
  });
993
1067
 
994
- // node_modules/zod/v3/ZodError.js
1068
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
995
1069
  var ZodIssueCode, quotelessJson = (obj) => {
996
1070
  const json = JSON.stringify(obj, null, 2);
997
1071
  return json.replace(/"([^"]+)":/g, "$1:");
@@ -1112,7 +1186,7 @@ var init_ZodError = __esm(() => {
1112
1186
  };
1113
1187
  });
1114
1188
 
1115
- // node_modules/zod/v3/locales/en.js
1189
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
1116
1190
  var errorMap = (issue, _ctx) => {
1117
1191
  let message;
1118
1192
  switch (issue.code) {
@@ -1219,7 +1293,7 @@ var init_en = __esm(() => {
1219
1293
  en_default = errorMap;
1220
1294
  });
1221
1295
 
1222
- // node_modules/zod/v3/errors.js
1296
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
1223
1297
  function setErrorMap(map) {
1224
1298
  overrideErrorMap = map;
1225
1299
  }
@@ -1232,7 +1306,7 @@ var init_errors = __esm(() => {
1232
1306
  overrideErrorMap = en_default;
1233
1307
  });
1234
1308
 
1235
- // node_modules/zod/v3/helpers/parseUtil.js
1309
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
1236
1310
  function addIssueToContext(ctx, issueData) {
1237
1311
  const overrideMap = getErrorMap();
1238
1312
  const issue = makeIssue({
@@ -1337,10 +1411,10 @@ var init_parseUtil = __esm(() => {
1337
1411
  });
1338
1412
  });
1339
1413
 
1340
- // node_modules/zod/v3/helpers/typeAliases.js
1414
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
1341
1415
  var init_typeAliases = () => {};
1342
1416
 
1343
- // node_modules/zod/v3/helpers/errorUtil.js
1417
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
1344
1418
  var errorUtil;
1345
1419
  var init_errorUtil = __esm(() => {
1346
1420
  (function(errorUtil2) {
@@ -1349,7 +1423,7 @@ var init_errorUtil = __esm(() => {
1349
1423
  })(errorUtil || (errorUtil = {}));
1350
1424
  });
1351
1425
 
1352
- // node_modules/zod/v3/types.js
1426
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
1353
1427
  class ParseInputLazyPath {
1354
1428
  constructor(parent, value, path, key) {
1355
1429
  this._cachedPath = [];
@@ -4700,116 +4774,116 @@ var init_types2 = __esm(() => {
4700
4774
  NEVER = INVALID;
4701
4775
  });
4702
4776
 
4703
- // node_modules/zod/v3/external.js
4777
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
4704
4778
  var exports_external = {};
4705
4779
  __export(exports_external, {
4706
- void: () => voidType,
4707
- util: () => util,
4708
- unknown: () => unknownType,
4709
- union: () => unionType,
4710
- undefined: () => undefinedType,
4711
- tuple: () => tupleType,
4712
- transformer: () => effectsType,
4713
- symbol: () => symbolType,
4714
- string: () => stringType,
4715
- strictObject: () => strictObjectType,
4716
- setErrorMap: () => setErrorMap,
4717
- set: () => setType,
4718
- record: () => recordType,
4719
- quotelessJson: () => quotelessJson,
4720
- promise: () => promiseType,
4721
- preprocess: () => preprocessType,
4722
- pipeline: () => pipelineType,
4723
- ostring: () => ostring,
4724
- optional: () => optionalType,
4725
- onumber: () => onumber,
4726
- oboolean: () => oboolean,
4727
- objectUtil: () => objectUtil,
4728
- object: () => objectType,
4729
- number: () => numberType,
4730
- nullable: () => nullableType,
4731
- null: () => nullType,
4732
- never: () => neverType,
4733
- nativeEnum: () => nativeEnumType,
4734
- nan: () => nanType,
4735
- map: () => mapType,
4736
- makeIssue: () => makeIssue,
4737
- literal: () => literalType,
4738
- lazy: () => lazyType,
4739
- late: () => late,
4740
- isValid: () => isValid,
4741
- isDirty: () => isDirty,
4742
- isAsync: () => isAsync,
4743
- isAborted: () => isAborted,
4744
- intersection: () => intersectionType,
4745
- instanceof: () => instanceOfType,
4746
- getParsedType: () => getParsedType,
4747
- getErrorMap: () => getErrorMap,
4748
- function: () => functionType,
4749
- enum: () => enumType,
4750
- effect: () => effectsType,
4751
- discriminatedUnion: () => discriminatedUnionType,
4752
- defaultErrorMap: () => en_default,
4753
- datetimeRegex: () => datetimeRegex,
4754
- date: () => dateType,
4755
- custom: () => custom,
4756
- coerce: () => coerce,
4757
- boolean: () => booleanType,
4758
- bigint: () => bigIntType,
4759
- array: () => arrayType,
4760
- any: () => anyType,
4761
- addIssueToContext: () => addIssueToContext,
4762
- ZodVoid: () => ZodVoid,
4763
- ZodUnknown: () => ZodUnknown,
4764
- ZodUnion: () => ZodUnion,
4765
- ZodUndefined: () => ZodUndefined,
4766
- ZodType: () => ZodType,
4767
- ZodTuple: () => ZodTuple,
4768
- ZodTransformer: () => ZodEffects,
4769
- ZodSymbol: () => ZodSymbol,
4770
- ZodString: () => ZodString,
4771
- ZodSet: () => ZodSet,
4772
- ZodSchema: () => ZodType,
4773
- ZodRecord: () => ZodRecord,
4774
- ZodReadonly: () => ZodReadonly,
4775
- ZodPromise: () => ZodPromise,
4776
- ZodPipeline: () => ZodPipeline,
4777
- ZodParsedType: () => ZodParsedType,
4778
- ZodOptional: () => ZodOptional,
4779
- ZodObject: () => ZodObject,
4780
- ZodNumber: () => ZodNumber,
4781
- ZodNullable: () => ZodNullable,
4782
- ZodNull: () => ZodNull,
4783
- ZodNever: () => ZodNever,
4784
- ZodNativeEnum: () => ZodNativeEnum,
4785
- ZodNaN: () => ZodNaN,
4786
- ZodMap: () => ZodMap,
4787
- ZodLiteral: () => ZodLiteral,
4788
- ZodLazy: () => ZodLazy,
4789
- ZodIssueCode: () => ZodIssueCode,
4790
- ZodIntersection: () => ZodIntersection,
4791
- ZodFunction: () => ZodFunction,
4792
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
4793
- ZodError: () => ZodError,
4794
- ZodEnum: () => ZodEnum,
4795
- ZodEffects: () => ZodEffects,
4796
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
4797
- ZodDefault: () => ZodDefault,
4798
- ZodDate: () => ZodDate,
4799
- ZodCatch: () => ZodCatch,
4800
- ZodBranded: () => ZodBranded,
4801
- ZodBoolean: () => ZodBoolean,
4802
- ZodBigInt: () => ZodBigInt,
4803
- ZodArray: () => ZodArray,
4804
- ZodAny: () => ZodAny,
4805
- Schema: () => ZodType,
4806
- ParseStatus: () => ParseStatus,
4807
- OK: () => OK,
4808
- NEVER: () => NEVER,
4809
- INVALID: () => INVALID,
4810
- EMPTY_PATH: () => EMPTY_PATH,
4780
+ BRAND: () => BRAND,
4811
4781
  DIRTY: () => DIRTY,
4812
- BRAND: () => BRAND
4782
+ EMPTY_PATH: () => EMPTY_PATH,
4783
+ INVALID: () => INVALID,
4784
+ NEVER: () => NEVER,
4785
+ OK: () => OK,
4786
+ ParseStatus: () => ParseStatus,
4787
+ Schema: () => ZodType,
4788
+ ZodAny: () => ZodAny,
4789
+ ZodArray: () => ZodArray,
4790
+ ZodBigInt: () => ZodBigInt,
4791
+ ZodBoolean: () => ZodBoolean,
4792
+ ZodBranded: () => ZodBranded,
4793
+ ZodCatch: () => ZodCatch,
4794
+ ZodDate: () => ZodDate,
4795
+ ZodDefault: () => ZodDefault,
4796
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
4797
+ ZodEffects: () => ZodEffects,
4798
+ ZodEnum: () => ZodEnum,
4799
+ ZodError: () => ZodError,
4800
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
4801
+ ZodFunction: () => ZodFunction,
4802
+ ZodIntersection: () => ZodIntersection,
4803
+ ZodIssueCode: () => ZodIssueCode,
4804
+ ZodLazy: () => ZodLazy,
4805
+ ZodLiteral: () => ZodLiteral,
4806
+ ZodMap: () => ZodMap,
4807
+ ZodNaN: () => ZodNaN,
4808
+ ZodNativeEnum: () => ZodNativeEnum,
4809
+ ZodNever: () => ZodNever,
4810
+ ZodNull: () => ZodNull,
4811
+ ZodNullable: () => ZodNullable,
4812
+ ZodNumber: () => ZodNumber,
4813
+ ZodObject: () => ZodObject,
4814
+ ZodOptional: () => ZodOptional,
4815
+ ZodParsedType: () => ZodParsedType,
4816
+ ZodPipeline: () => ZodPipeline,
4817
+ ZodPromise: () => ZodPromise,
4818
+ ZodReadonly: () => ZodReadonly,
4819
+ ZodRecord: () => ZodRecord,
4820
+ ZodSchema: () => ZodType,
4821
+ ZodSet: () => ZodSet,
4822
+ ZodString: () => ZodString,
4823
+ ZodSymbol: () => ZodSymbol,
4824
+ ZodTransformer: () => ZodEffects,
4825
+ ZodTuple: () => ZodTuple,
4826
+ ZodType: () => ZodType,
4827
+ ZodUndefined: () => ZodUndefined,
4828
+ ZodUnion: () => ZodUnion,
4829
+ ZodUnknown: () => ZodUnknown,
4830
+ ZodVoid: () => ZodVoid,
4831
+ addIssueToContext: () => addIssueToContext,
4832
+ any: () => anyType,
4833
+ array: () => arrayType,
4834
+ bigint: () => bigIntType,
4835
+ boolean: () => booleanType,
4836
+ coerce: () => coerce,
4837
+ custom: () => custom,
4838
+ date: () => dateType,
4839
+ datetimeRegex: () => datetimeRegex,
4840
+ defaultErrorMap: () => en_default,
4841
+ discriminatedUnion: () => discriminatedUnionType,
4842
+ effect: () => effectsType,
4843
+ enum: () => enumType,
4844
+ function: () => functionType,
4845
+ getErrorMap: () => getErrorMap,
4846
+ getParsedType: () => getParsedType,
4847
+ instanceof: () => instanceOfType,
4848
+ intersection: () => intersectionType,
4849
+ isAborted: () => isAborted,
4850
+ isAsync: () => isAsync,
4851
+ isDirty: () => isDirty,
4852
+ isValid: () => isValid,
4853
+ late: () => late,
4854
+ lazy: () => lazyType,
4855
+ literal: () => literalType,
4856
+ makeIssue: () => makeIssue,
4857
+ map: () => mapType,
4858
+ nan: () => nanType,
4859
+ nativeEnum: () => nativeEnumType,
4860
+ never: () => neverType,
4861
+ null: () => nullType,
4862
+ nullable: () => nullableType,
4863
+ number: () => numberType,
4864
+ object: () => objectType,
4865
+ objectUtil: () => objectUtil,
4866
+ oboolean: () => oboolean,
4867
+ onumber: () => onumber,
4868
+ optional: () => optionalType,
4869
+ ostring: () => ostring,
4870
+ pipeline: () => pipelineType,
4871
+ preprocess: () => preprocessType,
4872
+ promise: () => promiseType,
4873
+ quotelessJson: () => quotelessJson,
4874
+ record: () => recordType,
4875
+ set: () => setType,
4876
+ setErrorMap: () => setErrorMap,
4877
+ strictObject: () => strictObjectType,
4878
+ string: () => stringType,
4879
+ symbol: () => symbolType,
4880
+ transformer: () => effectsType,
4881
+ tuple: () => tupleType,
4882
+ undefined: () => undefinedType,
4883
+ union: () => unionType,
4884
+ unknown: () => unknownType,
4885
+ util: () => util,
4886
+ void: () => voidType
4813
4887
  });
4814
4888
  var init_external = __esm(() => {
4815
4889
  init_errors();
@@ -4820,7 +4894,7 @@ var init_external = __esm(() => {
4820
4894
  init_ZodError();
4821
4895
  });
4822
4896
 
4823
- // node_modules/zod/index.js
4897
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/index.js
4824
4898
  var init_zod = __esm(() => {
4825
4899
  init_external();
4826
4900
  init_external();
@@ -4829,11 +4903,11 @@ var init_zod = __esm(() => {
4829
4903
  // src/lib/redact.ts
4830
4904
  var exports_redact = {};
4831
4905
  __export(exports_redact, {
4832
- scanSecrets: () => scanSecrets,
4833
- redactFormatForTarget: () => redactFormatForTarget,
4834
- redactContent: () => redactContent,
4906
+ hasSecrets: () => hasSecrets,
4835
4907
  isSecretVarName: () => isSecretVarName,
4836
- hasSecrets: () => hasSecrets
4908
+ redactContent: () => redactContent,
4909
+ redactFormatForTarget: () => redactFormatForTarget,
4910
+ scanSecrets: () => scanSecrets
4837
4911
  });
4838
4912
  function redactShell(content) {
4839
4913
  const redacted = [];
@@ -5023,7 +5097,7 @@ var init_redact = __esm(() => {
5023
5097
  VALUE_PATTERNS = [
5024
5098
  { re: /npm_[A-Za-z0-9]{36,}/, reason: "npm token" },
5025
5099
  { re: /gh[pousr]_[A-Za-z0-9_]{36,}/, reason: "GitHub token" },
5026
- { re: /sk-ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
5100
+ { re: /sk[-]ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
5027
5101
  { re: /sk-[A-Za-z0-9]{48,}/, reason: "OpenAI API key" },
5028
5102
  { re: /xoxb-[0-9]+-[A-Za-z0-9\-]+/, reason: "Slack bot token" },
5029
5103
  { re: /AIza[0-9A-Za-z\-_]{35}/, reason: "Google API key" },
@@ -5041,7 +5115,7 @@ var init_session_render_contract = __esm(() => {
5041
5115
  });
5042
5116
 
5043
5117
  // src/lib/project-context.ts
5044
- import { basename, dirname, isAbsolute, join as join3, parse, relative, resolve } from "path";
5118
+ import { basename, dirname, isAbsolute, join as join4, parse, relative, resolve as resolve2 } from "path";
5045
5119
  function revisionKey(value) {
5046
5120
  const sequence = value.match(/^(?:rev-)?([0-9]+)$/);
5047
5121
  if (sequence)
@@ -5603,16 +5677,16 @@ var init_asset_plan = __esm(() => {
5603
5677
 
5604
5678
  // src/lib/cursor-authority.ts
5605
5679
  import { createHash } from "crypto";
5606
- import { homedir as homedir2 } from "os";
5607
- import { join as join4, resolve as resolve2 } from "path";
5680
+ import { homedir as homedir3 } from "os";
5681
+ import { join as join5, resolve as resolve3 } from "path";
5608
5682
  function sha256(content) {
5609
5683
  return createHash("sha256").update(content).digest("hex");
5610
5684
  }
5611
5685
  function homeDir() {
5612
- return process.env["HOME"] || homedir2();
5686
+ return process.env["HOME"] || homedir3();
5613
5687
  }
5614
5688
  function isCursorGlobalAuthorityPath(path) {
5615
- return resolve2(path) === resolve2(join4(homeDir(), CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH));
5689
+ return resolve3(path) === resolve3(join5(homeDir(), CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH));
5616
5690
  }
5617
5691
  function stampCursorGlobalAuthorityMarker(content) {
5618
5692
  if (CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN.test(content))
@@ -5634,6 +5708,12 @@ var init_cursor_authority = __esm(() => {
5634
5708
  CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN = /^---\n[\s\S]*?\n---(?:\n|$)/;
5635
5709
  });
5636
5710
 
5711
+ // src/lib/session-authority.ts
5712
+ var CLAUDE_LEGACY_AUTHORITY_MAX_BYTES;
5713
+ var init_session_authority = __esm(() => {
5714
+ CLAUDE_LEGACY_AUTHORITY_MAX_BYTES = 256 * 1024;
5715
+ });
5716
+
5637
5717
  // src/lib/session-render.ts
5638
5718
  var ANTIGRAVITY_RULE_FILE_CHAR_LIMIT = 12000, SESSION_RENDERER_OWNER_ID = "instructions-session-renderer", SESSION_RENDER_PROFILE_ENTRYPOINTS, SESSION_RENDER_OWNED_CONFIG_TARGETS, IDENTITY_EXPORT_AUTHORITY, CODEWITH_PROTECTED_REPLACEMENT_TARGETS, CODEWITH_FLATTENED_ADAPTER, CODEWITH_NATIVE_ADAPTER, SESSION_TOOL_ADAPTERS, SESSION_RENDER_MANAGED_DIRS, SESSION_RENDER_SHARED_MANAGED_DIRS, SESSION_RENDER_EXCLUSIVE_MANAGED_PATHS, CANONICAL_IDENTITY_EXPORT_PACKAGES;
5639
5719
  var init_session_render = __esm(() => {
@@ -5644,8 +5724,11 @@ var init_session_render = __esm(() => {
5644
5724
  init_transforms();
5645
5725
  init_asset_plan();
5646
5726
  init_cursor_authority();
5727
+ init_session_authority();
5647
5728
  init_session_render_contract();
5648
5729
  init_session_render_contract();
5730
+ init_raw_store_root();
5731
+ init_raw_store_root();
5649
5732
  SESSION_RENDER_PROFILE_ENTRYPOINTS = [
5650
5733
  ".claude/CLAUDE.md",
5651
5734
  ".codex/AGENTS.md",
@@ -6218,37 +6301,6 @@ var init_profiles = __esm(() => {
6218
6301
  init_asset_plan();
6219
6302
  });
6220
6303
 
6221
- // src/db/snapshots.ts
6222
- function createSnapshot(configId, content, version, db) {
6223
- const d = db || getDatabase();
6224
- const id = uuid();
6225
- const ts = now();
6226
- d.run("INSERT INTO config_snapshots (id, config_id, content, version, created_at) VALUES (?, ?, ?, ?, ?)", [id, configId, content, version, ts]);
6227
- return { id, config_id: configId, content, version, created_at: ts };
6228
- }
6229
- function listSnapshots(configId, db) {
6230
- const d = db || getDatabase();
6231
- return d.query("SELECT * FROM config_snapshots WHERE config_id = ? ORDER BY version DESC").all(configId);
6232
- }
6233
- function getSnapshot(id, db) {
6234
- const d = db || getDatabase();
6235
- return d.query("SELECT * FROM config_snapshots WHERE id = ?").get(id);
6236
- }
6237
- function getSnapshotByVersion(configId, version, db) {
6238
- const d = db || getDatabase();
6239
- return d.query("SELECT * FROM config_snapshots WHERE config_id = ? AND version = ?").get(configId, version);
6240
- }
6241
- function pruneSnapshots(configId, keep = 10, db) {
6242
- const d = db || getDatabase();
6243
- const result = d.run(`DELETE FROM config_snapshots WHERE config_id = ? AND id NOT IN (
6244
- SELECT id FROM config_snapshots WHERE config_id = ? ORDER BY version DESC LIMIT ?
6245
- )`, [configId, configId, keep]);
6246
- return result.changes;
6247
- }
6248
- var init_snapshots = __esm(() => {
6249
- init_database();
6250
- });
6251
-
6252
6304
  // src/db/machines.ts
6253
6305
  import { arch, hostname, type } from "os";
6254
6306
  function currentHostname2() {
@@ -6320,12 +6372,13 @@ function parseBoundedOrLegacyPage(value, legacyItems, options, label) {
6320
6372
  return { ...page, source_bounded: false };
6321
6373
  }
6322
6374
  function resolveCloudConfig(env = process.env) {
6375
+ assertNoLegacyStorageMode(env);
6323
6376
  const apiUrl = env[API_URL_ENV]?.trim();
6324
6377
  const apiKey = env[API_KEY_ENV]?.trim();
6325
6378
  if (!apiUrl && !apiKey)
6326
6379
  return null;
6327
6380
  if (!apiUrl || !apiKey) {
6328
- throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the cloud API, ` + `or unset both to use the local store.`);
6381
+ throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the HTTP API, ` + `or unset both to use the local store.`);
6329
6382
  }
6330
6383
  return { apiUrl, apiKey };
6331
6384
  }
@@ -6812,6 +6865,7 @@ var init_config_store = __esm(() => {
6812
6865
  init_types();
6813
6866
  init_bounded_read();
6814
6867
  init_instruction_graph();
6868
+ init_retired_storage_mode();
6815
6869
  CloudHttpError = class CloudHttpError extends Error {
6816
6870
  status;
6817
6871
  body;
@@ -6826,7 +6880,7 @@ var init_config_store = __esm(() => {
6826
6880
 
6827
6881
  // src/lib/session-render-ownership.ts
6828
6882
  import { existsSync as existsSync3, readFileSync, statSync } from "fs";
6829
- import { dirname as dirname2, join as join5, parse as parse2, relative as relative2, sep } from "path";
6883
+ import { dirname as dirname2, join as join6, parse as parse2, relative as relative2, sep } from "path";
6830
6884
  function toSegments(absolutePath2) {
6831
6885
  return absolutePath2.replaceAll("\\", "/").split("/").filter(Boolean);
6832
6886
  }
@@ -6874,7 +6928,7 @@ function sessionRenderManifestClaimsPath(absolutePath2) {
6874
6928
  const root = parse2(absolutePath2).root;
6875
6929
  let home = dirname2(absolutePath2);
6876
6930
  for (let depth = 0;depth < MANIFEST_ANCESTOR_LIMIT; depth += 1) {
6877
- const manifestPath = join5(home, ...SESSION_RENDER_MANIFEST_RELATIVE_PATH.split("/"));
6931
+ const manifestPath = join6(home, ...SESSION_RENDER_MANIFEST_RELATIVE_PATH.split("/"));
6878
6932
  const relativePaths = readManifestRelativePaths(manifestPath);
6879
6933
  if (relativePaths) {
6880
6934
  const claimed = relative2(home, absolutePath2).split(sep).join("/");
@@ -6901,25 +6955,25 @@ var init_session_render_ownership = __esm(() => {
6901
6955
  // src/lib/apply.ts
6902
6956
  var exports_apply = {};
6903
6957
  __export(exports_apply, {
6904
- previewConfigs: () => previewConfigs,
6905
- normalizeTargetPath: () => normalizeTargetPath,
6906
- getConfigHome: () => getConfigHome,
6907
- expandPath: () => expandPath,
6908
- applyConfigsWithReport: () => applyConfigsWithReport,
6958
+ applyConfig: () => applyConfig,
6909
6959
  applyConfigs: () => applyConfigs,
6910
- applyConfig: () => applyConfig
6960
+ applyConfigsWithReport: () => applyConfigsWithReport,
6961
+ expandPath: () => expandPath,
6962
+ getConfigHome: () => getConfigHome,
6963
+ normalizeTargetPath: () => normalizeTargetPath,
6964
+ previewConfigs: () => previewConfigs
6911
6965
  });
6912
6966
  import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, realpathSync, writeFileSync } from "fs";
6913
- import { basename as basename3, dirname as dirname3, join as join6, resolve as resolve3 } from "path";
6914
- import { homedir as homedir3 } from "os";
6967
+ import { basename as basename3, dirname as dirname3, join as join7, resolve as resolve4 } from "path";
6968
+ import { homedir as homedir4 } from "os";
6915
6969
  function getConfigHome() {
6916
- return process.env["CONFIGS_HOME"] || process.env["HOME"] || homedir3();
6970
+ return process.env["CONFIGS_HOME"] || process.env["HOME"] || homedir4();
6917
6971
  }
6918
6972
  function expandPath(p) {
6919
6973
  if (p.startsWith("~/")) {
6920
- return resolve3(getConfigHome(), p.slice(2));
6974
+ return resolve4(getConfigHome(), p.slice(2));
6921
6975
  }
6922
- return resolve3(p);
6976
+ return resolve4(p);
6923
6977
  }
6924
6978
  function normalizeTargetPath(p) {
6925
6979
  const expanded = expandPath(p);
@@ -6931,7 +6985,7 @@ function normalizeTargetPath(p) {
6931
6985
  while (true) {
6932
6986
  if (existsSync4(current)) {
6933
6987
  try {
6934
- return resolve3(realpathSync(current), ...missingSegments);
6988
+ return resolve4(realpathSync(current), ...missingSegments);
6935
6989
  } catch {
6936
6990
  return expanded;
6937
6991
  }
@@ -7324,7 +7378,7 @@ function sessionRendererOwnsCanonicalTarget(normalized, opts) {
7324
7378
  getConfigHome(),
7325
7379
  opts.vars?.["HOME_DIR"]
7326
7380
  ].filter((home) => typeof home === "string" && home.length > 0));
7327
- if ([...homes].some((home) => SESSION_RENDER_OWNED_CONFIG_TARGETS.some((relativePath) => normalized === normalizeTargetPath(join6(home, ...relativePath.split("/"))))))
7381
+ if ([...homes].some((home) => SESSION_RENDER_OWNED_CONFIG_TARGETS.some((relativePath) => normalized === normalizeTargetPath(join7(home, ...relativePath.split("/"))))))
7328
7382
  return true;
7329
7383
  return sessionRenderOwnsPath(normalized);
7330
7384
  }
@@ -7344,21 +7398,21 @@ var init_apply = __esm(() => {
7344
7398
  // src/lib/sync.ts
7345
7399
  var exports_sync = {};
7346
7400
  __export(exports_sync, {
7347
- syncToDisk: () => syncToDisk,
7348
- syncToDir: () => syncToDir,
7349
- syncProject: () => syncProject,
7350
- syncKnown: () => syncKnown,
7351
- syncFromDir: () => syncFromDir,
7352
- diffConfig: () => diffConfig,
7353
- detectFormat: () => detectFormat,
7354
- detectCategory: () => detectCategory,
7355
- detectAgent: () => detectAgent,
7356
- PROJECT_CONFIG_FILES: () => PROJECT_CONFIG_FILES,
7401
+ CLAUDE_PROMPT_OUTPUTS: () => CLAUDE_PROMPT_OUTPUTS,
7357
7402
  KNOWN_CONFIGS: () => KNOWN_CONFIGS,
7358
- CLAUDE_PROMPT_OUTPUTS: () => CLAUDE_PROMPT_OUTPUTS
7403
+ PROJECT_CONFIG_FILES: () => PROJECT_CONFIG_FILES,
7404
+ detectAgent: () => detectAgent,
7405
+ detectCategory: () => detectCategory,
7406
+ detectFormat: () => detectFormat,
7407
+ diffConfig: () => diffConfig,
7408
+ syncFromDir: () => syncFromDir,
7409
+ syncKnown: () => syncKnown,
7410
+ syncProject: () => syncProject,
7411
+ syncToDir: () => syncToDir,
7412
+ syncToDisk: () => syncToDisk
7359
7413
  });
7360
7414
  import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync3 } from "fs";
7361
- import { basename as basename4, extname as extname2, join as join7 } from "path";
7415
+ import { basename as basename4, extname as extname2, join as join8 } from "path";
7362
7416
  function claudeRuleOutputs(fileName) {
7363
7417
  const stem = basename4(fileName, extname2(fileName));
7364
7418
  return [
@@ -7422,7 +7476,7 @@ async function syncProject(opts) {
7422
7476
  const allConfigs = await store.listConfigs();
7423
7477
  const machine = detectMachineContext();
7424
7478
  for (const pf of PROJECT_CONFIG_FILES) {
7425
- const abs = join7(absDir, pf.file);
7479
+ const abs = join8(absDir, pf.file);
7426
7480
  if (!existsSync5(abs))
7427
7481
  continue;
7428
7482
  try {
@@ -7455,19 +7509,19 @@ async function syncProject(opts) {
7455
7509
  }
7456
7510
  }
7457
7511
  for (const ruleDir of [
7458
- { dir: join7(absDir, ".claude", "rules"), agent: "claude", namePrefix: "rules" },
7459
- { dir: join7(absDir, ".agents", "rules"), agent: "antigravity", namePrefix: "antigravity-rules" },
7460
- { dir: join7(absDir, ".cursor", "rules"), agent: "cursor", namePrefix: "cursor-rules" },
7461
- { dir: join7(absDir, ".github", "instructions"), agent: "copilot", namePrefix: "copilot-instructions" },
7462
- { dir: join7(absDir, ".devin", "rules"), agent: "devin", namePrefix: "devin-rules" },
7463
- { dir: join7(absDir, ".windsurf", "rules"), agent: "windsurf-legacy", namePrefix: "windsurf-rules" },
7464
- { dir: join7(absDir, ".clinerules"), agent: "cline", namePrefix: "cline-rules" }
7512
+ { dir: join8(absDir, ".claude", "rules"), agent: "claude", namePrefix: "rules" },
7513
+ { dir: join8(absDir, ".agents", "rules"), agent: "antigravity", namePrefix: "antigravity-rules" },
7514
+ { dir: join8(absDir, ".cursor", "rules"), agent: "cursor", namePrefix: "cursor-rules" },
7515
+ { dir: join8(absDir, ".github", "instructions"), agent: "copilot", namePrefix: "copilot-instructions" },
7516
+ { dir: join8(absDir, ".devin", "rules"), agent: "devin", namePrefix: "devin-rules" },
7517
+ { dir: join8(absDir, ".windsurf", "rules"), agent: "windsurf-legacy", namePrefix: "windsurf-rules" },
7518
+ { dir: join8(absDir, ".clinerules"), agent: "cline", namePrefix: "cline-rules" }
7465
7519
  ]) {
7466
7520
  if (!existsSync5(ruleDir.dir))
7467
7521
  continue;
7468
7522
  const mdFiles = readdirSync(ruleDir.dir).filter((f) => f.endsWith(".md") || f.endsWith(".mdc"));
7469
7523
  for (const f of mdFiles) {
7470
- const abs = join7(ruleDir.dir, f);
7524
+ const abs = join8(ruleDir.dir, f);
7471
7525
  const raw = readFileSync3(abs, "utf-8");
7472
7526
  const redacted = redactContent(raw, "markdown");
7473
7527
  const machineAware = templateizeMachineContent(redacted.content, machine);
@@ -7514,7 +7568,7 @@ async function syncKnown(opts = {}) {
7514
7568
  const extensions = known.rulesExtensions ?? [".md", ".mdc"];
7515
7569
  const ruleFiles = readdirSync(absDir).filter((f) => extensions.some((ext) => f.endsWith(ext)));
7516
7570
  for (const f of ruleFiles) {
7517
- const abs2 = join7(absDir, f);
7571
+ const abs2 = join8(absDir, f);
7518
7572
  const targetPath = abs2.replace(home, "~");
7519
7573
  if (existingOutputOwners.has(normalizeTargetPath(targetPath)) || isKnownGeneratedTargetPath(targetPath)) {
7520
7574
  result.skipped.push(`${targetPath} (generated output)`);
@@ -7885,8 +7939,8 @@ var init_sync = __esm(() => {
7885
7939
 
7886
7940
  // src/lib/sync-dir.ts
7887
7941
  import { existsSync as existsSync6, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2 } from "fs";
7888
- import { join as join8, relative as relative3 } from "path";
7889
- import { homedir as homedir4 } from "os";
7942
+ import { join as join9, relative as relative3 } from "path";
7943
+ import { homedir as homedir5 } from "os";
7890
7944
  function shouldSkip(p) {
7891
7945
  return SKIP.some((s) => p.includes(s));
7892
7946
  }
@@ -7895,9 +7949,9 @@ async function syncFromDir(dir, opts = {}) {
7895
7949
  const absDir = expandPath(dir);
7896
7950
  if (!existsSync6(absDir))
7897
7951
  return { added: 0, updated: 0, unchanged: 0, skipped: [`Not found: ${absDir}`] };
7898
- const files = opts.recursive !== false ? walkDir(absDir) : readdirSync2(absDir).map((f) => join8(absDir, f)).filter((f) => statSync2(f).isFile());
7952
+ const files = opts.recursive !== false ? walkDir(absDir) : readdirSync2(absDir).map((f) => join9(absDir, f)).filter((f) => statSync2(f).isFile());
7899
7953
  const result = { added: 0, updated: 0, unchanged: 0, skipped: [] };
7900
- const home = homedir4();
7954
+ const home = homedir5();
7901
7955
  const allConfigs = await store.listConfigs();
7902
7956
  for (const file of files) {
7903
7957
  if (shouldSkip(file)) {
@@ -7931,7 +7985,7 @@ async function syncFromDir(dir, opts = {}) {
7931
7985
  }
7932
7986
  async function syncToDir(dir, opts = {}) {
7933
7987
  const store = opts.store ?? resolveConfigStore();
7934
- const home = homedir4();
7988
+ const home = homedir5();
7935
7989
  const absDir = expandPath(dir);
7936
7990
  const normalized = dir.startsWith("~/") ? dir : absDir.replace(home, "~");
7937
7991
  const configs = (await store.listConfigs()).filter((c) => c.target_path && (c.target_path.startsWith(normalized) || c.target_path.startsWith(absDir)));
@@ -7955,7 +8009,7 @@ async function syncToDir(dir, opts = {}) {
7955
8009
  }
7956
8010
  function walkDir(dir, files = []) {
7957
8011
  for (const entry of readdirSync2(dir, { withFileTypes: true })) {
7958
- const full = join8(dir, entry.name);
8012
+ const full = join9(dir, entry.name);
7959
8013
  if (shouldSkip(full))
7960
8014
  continue;
7961
8015
  if (entry.isDirectory())
@@ -7974,10 +8028,10 @@ var init_sync_dir = __esm(() => {
7974
8028
  });
7975
8029
 
7976
8030
  // package.json
7977
- var require_package = __commonJS((exports, module) => {
8031
+ var require_package = __commonJS(function(exports, module) {
7978
8032
  module.exports = {
7979
8033
  name: "@hasna/instructions",
7980
- version: "0.4.36",
8034
+ version: "0.4.39",
7981
8035
  description: "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
7982
8036
  type: "module",
7983
8037
  main: "dist/index.js",
@@ -7997,6 +8051,7 @@ var require_package = __commonJS((exports, module) => {
7997
8051
  },
7998
8052
  files: [
7999
8053
  "dist",
8054
+ "assets/skills/inbox/SKILL.md",
8000
8055
  "dashboard/dist",
8001
8056
  "LICENSE",
8002
8057
  "README.md"
@@ -8010,14 +8065,15 @@ var require_package = __commonJS((exports, module) => {
8010
8065
  "generate:sdk": "bun run scripts/generate-sdk.ts",
8011
8066
  "kit:check": "bunx @hasna/contracts vendor-kit --check",
8012
8067
  typecheck: "tsc --noEmit",
8013
- test: "bun test",
8014
- "check:package-secrets": "bun run src/cli/index.tsx package-manager-scan --fail-on-findings --home .",
8068
+ test: "env -u HASNA_INSTRUCTIONS_API_URL -u HASNA_INSTRUCTIONS_API_KEY bun test",
8069
+ "check:package-secrets": "bun run src/cli/index.tsx package-manager-scan --fail-on-findings .",
8015
8070
  "dev:cli": "bun run src/cli/index.tsx",
8016
8071
  "dev:mcp": "bun run src/mcp/index.ts",
8017
8072
  "dev:serve": "bun run src/server/index.ts",
8018
8073
  seed: "bun run scripts/seed.ts",
8019
8074
  prepublishOnly: "bun run scripts/check-publish-hold.ts && bun run build",
8020
- postinstall: "mkdir -p $HOME/.hasna/instructions $HOME/.hasna/instructions/backups 2>/dev/null || true"
8075
+ postinstall: "mkdir -p $HOME/.hasna/instructions $HOME/.hasna/instructions/backups 2>/dev/null || true",
8076
+ prepack: "bun run build"
8021
8077
  },
8022
8078
  keywords: [
8023
8079
  "instructions",
@@ -8051,8 +8107,8 @@ var require_package = __commonJS((exports, module) => {
8051
8107
  author: "Andrei Hasna <andrei@hasna.com>",
8052
8108
  license: "Apache-2.0",
8053
8109
  dependencies: {
8054
- "@hasna/contracts": "0.4.2",
8055
- "@hasna/events": "^0.1.6",
8110
+ "@hasna/contracts": "0.13.1",
8111
+ "@hasna/events": "^0.1.16",
8056
8112
  "@modelcontextprotocol/sdk": "^1.12.1",
8057
8113
  chalk: "^5.4.1",
8058
8114
  commander: "^13.1.0",
@@ -8066,6 +8122,7 @@ var require_package = __commonJS((exports, module) => {
8066
8122
  "@types/bun": "^1.2.4",
8067
8123
  "@types/pg": "^8.11.11",
8068
8124
  "@types/react": "^18.3.18",
8125
+ "bun-types": "1.3.14",
8069
8126
  typescript: "^5.7.3"
8070
8127
  }
8071
8128
  };