synabun 2.4.5 → 2.4.6

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 (95) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/docs/whatsapp.md +17 -1
  4. package/hooks/claude-code/session-start.mjs +21 -18
  5. package/lib/claude-global-config.js +214 -0
  6. package/lib/client-config-repair.js +17 -3
  7. package/mcp-server/dist/index.d.ts.map +1 -1
  8. package/mcp-server/dist/index.js +6 -1
  9. package/mcp-server/dist/index.js.map +1 -1
  10. package/mcp-server/dist/services/tool-catalog.js +1 -1
  11. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  12. package/mcp-server/dist/tools/agents.d.ts +2 -0
  13. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  14. package/mcp-server/dist/tools/agents.js +11 -5
  15. package/mcp-server/dist/tools/agents.js.map +1 -1
  16. package/mcp-server/dist/tools/skill-tools.d.ts +24 -5
  17. package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -1
  18. package/mcp-server/dist/tools/skill-tools.js +88 -8
  19. package/mcp-server/dist/tools/skill-tools.js.map +1 -1
  20. package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -1
  21. package/mcp-server/dist/tools/tool-groups.js +19 -4
  22. package/mcp-server/dist/tools/tool-groups.js.map +1 -1
  23. package/mcp-server/package-lock.json +2 -2
  24. package/mcp-server/package.json +1 -1
  25. package/mcp-server/src/index.ts +6 -1
  26. package/mcp-server/src/services/tool-catalog.ts +1 -1
  27. package/mcp-server/src/tools/agents.ts +11 -5
  28. package/mcp-server/src/tools/skill-tools.ts +82 -9
  29. package/mcp-server/src/tools/tool-groups.ts +19 -4
  30. package/neural-interface/i18n/en.json +135 -10
  31. package/neural-interface/i18n/pt-BR.json +135 -10
  32. package/neural-interface/lib/antigravity/panel-bridge.js +7 -3
  33. package/neural-interface/lib/assistant-dispatch.js +15 -1
  34. package/neural-interface/lib/assistant-runtime.js +79 -8
  35. package/neural-interface/lib/assistant-user-context.js +7 -3
  36. package/neural-interface/lib/claude-agent-bridge.js +13 -2
  37. package/neural-interface/lib/codex-thread-history.js +144 -7
  38. package/neural-interface/lib/codex-worker-app-server.js +84 -30
  39. package/neural-interface/lib/db.js +26 -0
  40. package/neural-interface/lib/greeting/sources.js +7 -3
  41. package/neural-interface/lib/jsonl-lines.js +10 -11
  42. package/neural-interface/lib/line-buffer.js +88 -0
  43. package/neural-interface/lib/loop-stall.js +15 -1
  44. package/neural-interface/lib/memory-list-read.js +105 -0
  45. package/neural-interface/lib/memory-timers.js +4 -1
  46. package/neural-interface/lib/native-loop-runtime.js +7 -3
  47. package/neural-interface/lib/provider-panel-api-key-auth.js +33 -6
  48. package/neural-interface/lib/skills/api-v2.js +18 -3
  49. package/neural-interface/lib/skills/bundle.js +2 -2
  50. package/neural-interface/lib/skills/deploy.js +169 -34
  51. package/neural-interface/lib/skills/digest.js +57 -3
  52. package/neural-interface/lib/skills/health.js +55 -1
  53. package/neural-interface/lib/skills/known-bridge-digests.json +12 -0
  54. package/neural-interface/lib/skills/runtime-checks.js +7 -4
  55. package/neural-interface/lib/skills/scan-shell.js +56 -7
  56. package/neural-interface/lib/skills/scan.js +13 -12
  57. package/neural-interface/lib/skills/service.js +7 -2
  58. package/neural-interface/lib/skills/telemetry.js +2 -2
  59. package/neural-interface/lib/teams/README.md +12 -5
  60. package/neural-interface/lib/teams/api.js +15 -4
  61. package/neural-interface/lib/teams/index.js +2 -0
  62. package/neural-interface/lib/teams/landing.js +195 -75
  63. package/neural-interface/lib/teams/scheduler.js +31 -32
  64. package/neural-interface/lib/terminal-token-redaction.js +228 -58
  65. package/neural-interface/lib/terminal-tokens.js +18 -0
  66. package/neural-interface/lib/whatsapp/brain.js +21 -0
  67. package/neural-interface/lib/whatsapp/bridge.js +40 -4
  68. package/neural-interface/package-lock.json +2 -2
  69. package/neural-interface/package.json +1 -1
  70. package/neural-interface/public/index.html +117 -37
  71. package/neural-interface/public/shared/agents/studio/ax-api.js +11 -0
  72. package/neural-interface/public/shared/agents/studio/ax-create-view.js +1 -1
  73. package/neural-interface/public/shared/agents/studio/ax-icons.js +1 -0
  74. package/neural-interface/public/shared/agents/studio/ax-library-view.js +3 -2
  75. package/neural-interface/public/shared/agents/studio/ax-main.js +127 -41
  76. package/neural-interface/public/shared/agents/studio/ax-review-view.js +3 -2
  77. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +137 -39
  78. package/neural-interface/public/shared/agents/studio/ax-teams.js +219 -4
  79. package/neural-interface/public/shared/agents/studio/ax-ui.js +31 -0
  80. package/neural-interface/public/shared/agents/studio/ax-views.js +67 -69
  81. package/neural-interface/public/shared/agents/studio/ax-work-answer.js +86 -0
  82. package/neural-interface/public/shared/agents/studio/ax-work-view.js +305 -0
  83. package/neural-interface/public/shared/agents/studio/ax-work.css +74 -0
  84. package/neural-interface/public/shared/agents/studio/ax-work.js +300 -0
  85. package/neural-interface/public/shared/cdx/cdx-deferred.js +90 -0
  86. package/neural-interface/public/shared/cdx/cdx-render.js +18 -7
  87. package/neural-interface/public/shared/cdx/cdx-tabs.js +2 -1
  88. package/neural-interface/public/shared/loading-diagnostic-entry.js +16 -1
  89. package/neural-interface/public/shared/skills/studio/sx-operations-view.js +5 -0
  90. package/neural-interface/public/shared/skills/studio/sx-plan.js +42 -3
  91. package/neural-interface/public/shared/skills/studio/sx-publish-view.js +20 -4
  92. package/neural-interface/server.js +316 -252
  93. package/npm-shrinkwrap.json +2 -2
  94. package/package.json +2 -1
  95. package/skills/skill-forge/SKILL.md +7 -3
@@ -0,0 +1,105 @@
1
+ // The page's memory list, read without holding the server's thread.
2
+ //
3
+ // GET /api/memories?links=false&offset=…&limit=… used to run, for every page of the list, one statement on the
4
+ // server's own connection: every live memory sorted by creation time, then LIMIT / OFFSET. No index gives that order
5
+ // for the live rows, so SQLite read all of them whole into a sorter, each time: on the owner's store (36,868 memories
6
+ // whose rows start with a vector) 215-296 ms a page on an idle machine and 0.6-7.7 s on a busy one, fifteen pages a
7
+ // load, and nothing else was answered meanwhile (the `[loop-stall]` lines that name
8
+ // `SELECT id, content, category, subcategory, …`; 2026-11-28, when the page could not load its own modules behind it).
9
+ //
10
+ // Here the same answer costs two small reads and one read of the page's own rows, all on the retrieval reader's
11
+ // thread (mcp-server retrieval-reader.ts: a read-only connection of its own):
12
+ // - the order: the id of every live memory (the index on `trashed_at, id, …` holds it) and the creation time of
13
+ // every memory (the index on `created_at` holds it), joined by rowid and sorted here. Neither read touches a
14
+ // row. It is kept for as long as the list's stamp (lib/memory-list-stamp.js) stays the same, so the pages of one
15
+ // load share it;
16
+ // - a page: its 2,500 rows by id (10-30 ms on that store), put back in the order.
17
+ // The rows and their order are exactly the ones `ORDER BY created_at DESC, id DESC` gives (tests/memory-list-read.test.mjs
18
+ // compares them on the real schema). No index is added and nothing is written.
19
+
20
+ /** The id of every live memory, by rowid. */
21
+ export const LIVE_IDS_SQL = 'SELECT rowid AS r, id FROM memories WHERE trashed_at IS NULL';
22
+ /** The creation time of every memory, by rowid. */
23
+ export const CREATED_SQL = 'SELECT rowid AS r, created_at FROM memories';
24
+ /** The columns of a memory in the list: everything but its vector. */
25
+ export const MEMORY_LIST_COLUMNS = 'id, content, category, subcategory, project, tags, importance, source, '
26
+ + 'created_at, updated_at, accessed_at, access_count, related_files, related_memory_ids, file_checksums, trashed_at, source_session_chunks';
27
+ /** Ids in one statement (SQLite takes 32,766 variables; a page is at most 10,000 rows). */
28
+ const IDS_PER_READ = 5000;
29
+
30
+ /**
31
+ * The ids of the live memories, newest first; equal times by id, the greater first: `ORDER BY created_at DESC, id DESC`.
32
+ * @param {Array<{ r: number, id: string }>} live
33
+ * @param {Array<{ r: number, created_at: string }>} created
34
+ * @returns {string[]}
35
+ */
36
+ export function orderLiveIds(live, created) {
37
+ const at = new Map();
38
+ for (const row of created) at.set(row.r, row.created_at);
39
+ const rows = live.map((row) => ({ id: row.id, at: at.get(row.r) ?? '' }));
40
+ rows.sort((a, b) => (a.at < b.at ? 1 : a.at > b.at ? -1 : a.id < b.id ? 1 : a.id > b.id ? -1 : 0));
41
+ return rows.map((row) => row.id);
42
+ }
43
+
44
+ /**
45
+ * @param {object} o
46
+ * @param {(sql: string, params?: unknown[]) => Promise<Array<Record<string, any>>>} o.read one read-only statement,
47
+ * all its rows (readRows of the retrieval reader).
48
+ * @param {(row: Record<string, any>) => object} o.toMemory a row as the list's memory (`{ id, ...payload }`).
49
+ */
50
+ export function createMemoryListReader({ read, toMemory }) {
51
+ /** The order in use: `{ stamp, ids }` once read, with `pending` while it is being read. */
52
+ let kept = null;
53
+
54
+ async function readOrder() {
55
+ // One after the other: the reader has one thread, and the second read is the cheaper one to repeat.
56
+ const live = await read(LIVE_IDS_SQL);
57
+ const created = await read(CREATED_SQL);
58
+ return orderLiveIds(live, created);
59
+ }
60
+
61
+ /** The order for the list as `stamp` names it. A list without a stamp (it could not be read) is ordered each time. */
62
+ async function order(stamp) {
63
+ if (stamp === null || stamp === undefined) return readOrder();
64
+ if (kept?.stamp === stamp) return kept.ids ?? kept.pending;
65
+ const entry = { stamp, ids: null, pending: null };
66
+ entry.pending = readOrder().then((ids) => { entry.ids = ids; entry.pending = null; return ids; }, (error) => {
67
+ if (kept === entry) kept = null; // never keep a failure
68
+ throw error;
69
+ });
70
+ kept = entry;
71
+ return entry.pending;
72
+ }
73
+
74
+ /** The live memories with these ids, in this order. One that was trashed or deleted since the order was read is left out. */
75
+ async function rowsOf(ids) {
76
+ const byId = new Map();
77
+ for (let from = 0; from < ids.length; from += IDS_PER_READ) {
78
+ const slice = ids.slice(from, from + IDS_PER_READ);
79
+ const rows = await read(`SELECT ${MEMORY_LIST_COLUMNS} FROM memories WHERE trashed_at IS NULL AND id IN (${slice.map(() => '?').join(',')})`, slice);
80
+ for (const row of rows) byId.set(row.id, row);
81
+ }
82
+ const out = [];
83
+ for (const id of ids) { const row = byId.get(id); if (row) out.push(toMemory(row)); }
84
+ return out;
85
+ }
86
+
87
+ return {
88
+ /**
89
+ * One page of the live memories and how many there are.
90
+ * @param {{ offset?: number, limit: number }} page
91
+ * @param {{ stamp?: string | null }} [options] the list's stamp, when the caller has it: the order is kept for it.
92
+ * @returns {Promise<{ rows: object[], total: number }>}
93
+ */
94
+ async page({ offset = 0, limit } = {}, { stamp = null } = {}) {
95
+ const ids = await order(stamp);
96
+ return { rows: await rowsOf(ids.slice(offset, offset + limit)), total: ids.length };
97
+ },
98
+ /** Every live memory, newest first. */
99
+ async all({ stamp = null } = {}) {
100
+ return rowsOf(await order(stamp));
101
+ },
102
+ /** Forget the kept order (the store was closed or replaced). */
103
+ forget() { kept = null; },
104
+ };
105
+ }
@@ -38,7 +38,6 @@ let batchInFlight = false;
38
38
  export function startGatedMemoryMaintenance({ intervalMs = 2000, runBatch = runMaintenanceBatch } = {}) {
39
39
  if (maintenanceTimer) return;
40
40
  maintenanceTimer = setInterval(() => {
41
- markActivity('timer:memory-maintenance');
42
41
  if (batchInFlight) return;
43
42
  try {
44
43
  const d = getDb();
@@ -46,6 +45,10 @@ export function startGatedMemoryMaintenance({ intervalMs = 2000, runBatch = runM
46
45
  } catch {
47
46
  return;
48
47
  }
48
+ // Marked only when a batch really runs. Marking every tick made this timer, which fires every 2 s whether or
49
+ // not there is work, the `last:` of nearly every stall line: on 2026-11-29 a 71 s stall in the Codex panel's
50
+ // stdout handler was reported under this name although no job row had changed.
51
+ markActivity('timer:memory-maintenance');
49
52
  batchInFlight = true;
50
53
  const endActivity = beginActivity('memory:maintenance-batch');
51
54
  Promise.resolve()
@@ -5,6 +5,7 @@ import { storedToolList, toolListRecord, readStoredToolListRecord } from './tool
5
5
  import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
6
6
  import { dirname, resolve } from 'node:path';
7
7
  import { redactTerminalSecrets, scrubTokenText } from './terminal-token-redaction.js';
8
+ import { timeBlockingWork } from './loop-stall.js';
8
9
 
9
10
  export const NATIVE_LOOP_PROFILES = new Set(['claude-code', 'codex', 'opencode', 'antigravity']);
10
11
 
@@ -233,9 +234,12 @@ export class NativeLoopRuntime {
233
234
  // Every provider's events (Claude Code, Codex, OpenCode, Antigravity) pass here before anything keeps or shows
234
235
  // them: a run's terminal token or a brain credential an agent printed (its `env`, `ps -E`) never reaches the run's
235
236
  // records, its transcript or a panel (lib/terminal-token-redaction.js).
236
- const message = { type: 'sidepanel:provider-event', run: cleanDescriptor(record), event: redactTerminalSecrets(event) };
237
- try { this.onEvent(message); } catch {}
238
- this._notifyListeners(message);
237
+ // Scrubbed and handed on here, on the server's own thread: timed by name, so a stall of the event loop names it.
238
+ timeBlockingWork('native-run:provider-event', () => {
239
+ const message = { type: 'sidepanel:provider-event', run: cleanDescriptor(record), event: redactTerminalSecrets(event) };
240
+ try { this.onEvent(message); } catch {}
241
+ this._notifyListeners(message);
242
+ });
239
243
  }
240
244
 
241
245
  /**
@@ -1,4 +1,4 @@
1
- import { scrubTokenText } from './terminal-token-redaction.js';
1
+ import { BIG_STRING_CHARS, createScrubMemo, scrubTokenText } from './terminal-token-redaction.js';
2
2
 
3
3
  const API_KEY_ERRORS = {
4
4
  invalid_key: { status: 400, message: "That doesn't look like an API key for this provider." },
@@ -33,12 +33,39 @@ export function validateProviderApiKey(provider, key) {
33
33
  // (a terminal token, a brain's launch credential: lib/terminal-token-redaction.js), first, so a provider-key pattern
34
34
  // inside one never leaves a piece of it: the Claude Code panel's and brain's events and the Codex panel's messages
35
35
  // (and its app-server's output) pass here.
36
+ //
37
+ // A message passes here twice on its way to the page (where a Codex app-server's line is parsed, and where the packet
38
+ // is sent): the long strings of a value this function returned (an inline image is megabytes) are remembered with
39
+ // the object that holds them, and the second pass does not read them again (lib/terminal-token-redaction.js
40
+ // createScrubMemo: only while that very object still holds that very string).
41
+ const scrubMemo = createScrubMemo();
42
+ const CREDENTIAL_FIELD_RE = /^(api_?key|access_?token|refresh_?token|id_?token|authorization)$/i;
43
+ const redactText = (text) => scrubTokenText(text).replace(/sk-[A-Za-z0-9_-]{16,}/g, '[redacted]');
44
+
45
+ /** `source[key]` redacted into `target[key]`; a long string only when `source` was not seen holding it redacted. */
46
+ function redactHeld(source, key, item, target) {
47
+ if (typeof item !== 'string' || item.length < BIG_STRING_CHARS) return redactProviderSecrets(item);
48
+ const next = scrubMemo.seen(source, key, item) ? item : redactText(item);
49
+ scrubMemo.note(target, key, next);
50
+ return next;
51
+ }
52
+
36
53
  export function redactProviderSecrets(value) {
37
- if (typeof value === 'string') return scrubTokenText(value).replace(/sk-[A-Za-z0-9_-]{16,}/g, '[redacted]');
38
- if (Array.isArray(value)) return value.map(redactProviderSecrets);
39
- if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value)
40
- .filter(([key]) => !/^(api_?key|access_?token|refresh_?token|id_?token|authorization)$/i.test(key))
41
- .map(([key, item]) => [key, redactProviderSecrets(item)]));
54
+ if (typeof value === 'string') return redactText(value);
55
+ if (Array.isArray(value)) {
56
+ const out = new Array(value.length);
57
+ for (let i = 0; i < value.length; i++) out[i] = redactHeld(value, i, value[i], out);
58
+ return out;
59
+ }
60
+ if (value && typeof value === 'object') {
61
+ const out = {};
62
+ for (const [key, item] of Object.entries(value)) {
63
+ if (CREDENTIAL_FIELD_RE.test(key)) continue;
64
+ // defineProperty, as Object.fromEntries did: a key named `__proto__` stays a plain property.
65
+ Object.defineProperty(out, key, { value: redactHeld(value, key, item, out), writable: true, enumerable: true, configurable: true });
66
+ }
67
+ return out;
68
+ }
42
69
  return value;
43
70
  }
44
71
 
@@ -11,7 +11,8 @@
11
11
  // carries an agent's headers is refused (403 UI_ONLY) whatever else it says, as is a guest, another
12
12
  // site's page, a request without the page's X-SynaBun-UI header, or one without this boot's page
13
13
  // secret cookie (lib/page-session.js, 403 PAGE_SECRET_REQUIRED). An agent asks for a plan
14
- // (POST /installations/plan) and submits for review; the owner installs.
14
+ // (POST /installations/plan) and submits for review; the owner installs. An agent may re-run the
15
+ // static check of an installation (POST /installations/:id/check), which changes no file.
15
16
  //
16
17
  // Ids in paths are opaque (`skl_`, `rev_`, `drf_`, `rvw_`, `ins_`, `mig_`, `art_`) and checked by shape before
17
18
  // anything is looked up; no id is ever a path. Errors are JSON `{ ok: false, error, code, … }` with 400/422 for
@@ -26,6 +27,7 @@ import { readConfinedFile } from '../confined-fs.js';
26
27
  import { isArtifactId } from './catalog.js';
27
28
  import { checkFolder, folderDigest, isDraftId, isRevisionId, isSkillId } from './library.js';
28
29
  import { bundlePathProblem, collectFolder } from './bundle.js';
30
+ import { executablePaths, keepsExecutableBit } from './digest.js';
29
31
  import { isEditableText } from '../../public/shared/skills/ss-doc.js';
30
32
 
31
33
  /** The largest file of a catalog skill the Studio reads (a SKILL.md's bound, as the P0 routes read one). */
@@ -221,8 +223,12 @@ export function registerSkillsV2Routes(app, { service, isGuestRequest = null, ow
221
223
  if (!isRevisionId(from) || !isArtifactId(artifactId)) return res.status(400).json({ ok: false, error: 'from is a revision id and artifactId a catalog entry.', code: 'invalid_id' });
222
224
  const entry = await service.catalogFind(artifactId);
223
225
  if (!entry || entry.kind !== 'skill') return res.status(404).json({ ok: false, error: 'There is no such skill in the catalog.', code: 'artifact_not_found' });
224
- const { files, dirs } = collectFolder(entry.realPath);
225
- res.json({ ok: true, diff: service.library.diffRevisionFolder(from, { files, dirs }, { path: entry.path }) });
226
+ const read = collectFolder(entry.realPath);
227
+ // Where files keep no executable bit (Windows) the folder cannot say which are: the revision's flags stand, so
228
+ // only bytes, sizes and paths can differ (digest.js intendedDigest).
229
+ const meant = keepsExecutableBit() ? null : executablePaths(service.library.readRevisionFiles(from).files);
230
+ const files = meant ? read.files.map((f) => ({ ...f, executable: meant.has(f.path) })) : read.files;
231
+ res.json({ ok: true, diff: service.library.diffRevisionFolder(from, { files, dirs: read.dirs }, { path: entry.path }) });
226
232
  }));
227
233
  route('post', '/catalog/rescan', json, writer, safe(async (req, res) => { const s = await service.catalogScan({ force: true }); res.json({ ok: true, generation: s.generation, generatedAt: s.generatedAt, entries: s.entries.length, truncated: s.truncated }); }));
228
234
  // The settings, with the assistants on this computer (detected, chosen, in effect): what Publish ticks by default.
@@ -410,6 +416,15 @@ export function registerSkillsV2Routes(app, { service, isGuestRequest = null, ow
410
416
  route('post', '/installations/:installationId/verify', json, owner, ids('installationId'), safe(async (req, res) => {
411
417
  res.json({ ok: true, installation: await service.deployer.verify(req.params.installationId, { probeRuntime: req.body?.probe === true }) });
412
418
  }));
419
+ // The same check for the owner and agents (the MCP `skill` tool's `verify`): static by default (the bytes, the
420
+ // folder rules, each runtime's settings: nothing is started), and it writes only the installation's stored check,
421
+ // never a skill folder, a setting or an install. `probe: true` also asks Codex and OpenCode (Claude Code and
422
+ // Antigravity have no listing) and is the owner's or the Assistant's: a worker gets 403 PROBE_FORBIDDEN.
423
+ route('post', '/installations/:installationId/check', json, writer, ids('installationId'), safe(async (req, res) => {
424
+ const probe = req.body?.probe === true;
425
+ if (probe && req.principal.kind === 'agent') return sendGuardError(res, 403, 'PROBE_FORBIDDEN', 'Asking Codex or OpenCode is the owner\'s or the Assistant\'s: run the static check (no probe).');
426
+ res.json({ ok: true, installation: await service.deployer.verify(req.params.installationId, { probeRuntime: probe, trigger: probe ? 'probe' : 'check' }) });
427
+ }));
413
428
 
414
429
  // ── The old bridges ──
415
430
  // The server moves what is proven SynaBun's by itself at start (migration.js autoMigrate) and leaves a notice; the
@@ -19,7 +19,7 @@ import { randomBytes } from 'node:crypto';
19
19
  import { join } from 'node:path';
20
20
  import { PathConfineError, isInside, isPlainName, realPathOf } from '../path-confine.js';
21
21
  import { canonicalInside, makeConfinedDir, readConfinedFile, writeConfinedFile } from '../confined-fs.js';
22
- import { SYSTEM_NAMES, fileEntry, manifestDigest, readManifest, sha256 } from './digest.js';
22
+ import { SYSTEM_NAMES, fileEntry, manifestDigest, readManifest, sha256, withExecutables } from './digest.js';
23
23
  import { findHiddenChars } from '../../public/shared/skills/ss-unicode.js';
24
24
  import { isEditableText } from '../../public/shared/skills/ss-doc.js';
25
25
 
@@ -373,7 +373,7 @@ export function createImportStaging({ dir, liveRoots = () => [], now = () => Dat
373
373
  const digest = manifestDigest(entries);
374
374
  // What is in staging now must be what was staged (and nothing more).
375
375
  const onDisk = readManifest(filesDir);
376
- const stagedNow = onDisk.entries.map((e) => (e.type === 'file' ? { ...e, executable: !!(record.manifest.find((m) => m.path === e.path) || {}).executable } : e));
376
+ const stagedNow = withExecutables(onDisk.entries, record.manifest);
377
377
  if (digest !== record.digest || manifestDigest(stagedNow) !== record.digest) {
378
378
  throw new BundleError(409, 'The staged files changed since they were checked: import the bundle again.', { code: 'staging_changed' });
379
379
  }