@eyeauras/insight-cli 0.6.4 → 0.6.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 (101) hide show
  1. package/.cli-package-build.json +1 -1
  2. package/SKILL.md +9 -7
  3. package/dist/src/cli.js +1 -1
  4. package/dist/src/contexts.d.ts +29 -8
  5. package/dist/src/contexts.js +455 -90
  6. package/dist/src/cross-peer.d.ts +20 -0
  7. package/dist/src/cross-peer.js +53 -0
  8. package/dist/src/debugger-results.d.ts +2 -1
  9. package/dist/src/debugger-results.js +9 -4
  10. package/dist/src/debugger.js +3 -2
  11. package/dist/src/native-merge-patches.js +20 -2
  12. package/dist/src/research.d.ts +10 -2
  13. package/dist/src/research.js +31 -4
  14. package/dist/src/storage-gc.js +244 -44
  15. package/dist/src/tool-runtime/run.js +24 -11
  16. package/dist/src/tool-runtime/supervisor.js +51 -9
  17. package/dist/src/workspace.d.ts +43 -1
  18. package/dist/src/workspace.js +110 -7
  19. package/package.json +1 -1
  20. package/references/agent-setup.md +11 -3
  21. package/references/debugger.md +5 -3
  22. package/references/extensions-and-sync.md +7 -6
  23. package/references/managed-runtime.md +4 -3
  24. package/references/native/InsightNativeCheckout.java +174 -15
  25. package/references/native/NATIVE-MERGE-NOTICE.txt +5 -1
  26. package/references/native-workflows.md +5 -3
  27. package/references/query-semantics.md +3 -2
  28. package/references/recovery.md +6 -0
  29. package/references/setup.md +9 -2
  30. package/skill-bundle/insight-artifacts/SKILL.md +1 -1
  31. package/skill-bundle/insight-artifacts/references/recovery.md +6 -0
  32. package/skill-bundle/insight-binary/SKILL.md +1 -1
  33. package/skill-bundle/insight-capture/SKILL.md +1 -1
  34. package/skill-bundle/insight-cli/SKILL.md +9 -7
  35. package/skill-bundle/insight-cli/references/agent-setup.md +11 -3
  36. package/skill-bundle/insight-cli/references/managed-runtime.md +4 -3
  37. package/skill-bundle/insight-cli/references/recovery.md +6 -0
  38. package/skill-bundle/insight-cli/references/setup.md +9 -2
  39. package/skill-bundle/insight-die/SKILL.md +1 -1
  40. package/skill-bundle/insight-dnspy/SKILL.md +1 -1
  41. package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
  42. package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
  43. package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
  44. package/skill-bundle/insight-frida/SKILL.md +1 -1
  45. package/skill-bundle/insight-ghidra/SKILL.md +4 -3
  46. package/skill-bundle/insight-ghidra/references/debugger.md +5 -3
  47. package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +7 -6
  48. package/skill-bundle/insight-ghidra/references/managed-runtime.md +4 -3
  49. package/skill-bundle/insight-ghidra/references/native-workflows.md +5 -3
  50. package/skill-bundle/insight-ghidra/references/query-semantics.md +3 -2
  51. package/skill-bundle/insight-ghidra/references/recovery.md +6 -0
  52. package/skill-bundle/insight-ghidra/references/setup.md +9 -2
  53. package/skill-bundle/insight-ilspy/SKILL.md +1 -1
  54. package/skill-bundle/insight-interop/SKILL.md +1 -1
  55. package/skill-bundle/insight-lldb/SKILL.md +1 -1
  56. package/skill-bundle/insight-llvm/SKILL.md +1 -1
  57. package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
  58. package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
  59. package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
  60. package/skill-bundle/insight-overview/SKILL.md +1 -1
  61. package/skill-bundle/insight-procmon/SKILL.md +1 -1
  62. package/skill-bundle/insight-re/SKILL.md +1 -1
  63. package/skill-bundle/insight-re/references/recovery.md +6 -0
  64. package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
  65. package/skill-bundle/insight-strace/SKILL.md +1 -1
  66. package/skill-bundle/insight-tshark/SKILL.md +1 -1
  67. package/skill-bundle/insight-windbg/SKILL.md +1 -1
  68. package/skill-bundle/manifest.json +1 -1
  69. package/skills/insight-artifacts/SKILL.md +1 -1
  70. package/skills/insight-artifacts/references/recovery.md +6 -0
  71. package/skills/insight-binary/SKILL.md +1 -1
  72. package/skills/insight-capture/SKILL.md +1 -1
  73. package/skills/insight-die/SKILL.md +1 -1
  74. package/skills/insight-dnspy/SKILL.md +1 -1
  75. package/skills/insight-dotnet-dump/SKILL.md +1 -1
  76. package/skills/insight-dotnet-stack/SKILL.md +1 -1
  77. package/skills/insight-dotnet-trace/SKILL.md +1 -1
  78. package/skills/insight-frida/SKILL.md +1 -1
  79. package/skills/insight-ghidra/SKILL.md +4 -3
  80. package/skills/insight-ghidra/references/debugger.md +5 -3
  81. package/skills/insight-ghidra/references/extensions-and-sync.md +7 -6
  82. package/skills/insight-ghidra/references/managed-runtime.md +4 -3
  83. package/skills/insight-ghidra/references/native-workflows.md +5 -3
  84. package/skills/insight-ghidra/references/query-semantics.md +3 -2
  85. package/skills/insight-ghidra/references/recovery.md +6 -0
  86. package/skills/insight-ghidra/references/setup.md +9 -2
  87. package/skills/insight-ilspy/SKILL.md +1 -1
  88. package/skills/insight-interop/SKILL.md +1 -1
  89. package/skills/insight-lldb/SKILL.md +1 -1
  90. package/skills/insight-llvm/SKILL.md +1 -1
  91. package/skills/insight-managed-heap/SKILL.md +1 -1
  92. package/skills/insight-managed-metadata/SKILL.md +1 -1
  93. package/skills/insight-mitmproxy/SKILL.md +1 -1
  94. package/skills/insight-overview/SKILL.md +1 -1
  95. package/skills/insight-procmon/SKILL.md +1 -1
  96. package/skills/insight-re/SKILL.md +1 -1
  97. package/skills/insight-re/references/recovery.md +6 -0
  98. package/skills/insight-sevenzip/SKILL.md +1 -1
  99. package/skills/insight-strace/SKILL.md +1 -1
  100. package/skills/insight-tshark/SKILL.md +1 -1
  101. package/skills/insight-windbg/SKILL.md +1 -1
@@ -1,5 +1,5 @@
1
1
  import { DatabaseSync } from 'node:sqlite';
2
- import { chmodSync, mkdirSync, readFileSync, realpathSync } from 'node:fs';
2
+ import { chmodSync, mkdirSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
3
3
  import { basename, join } from 'node:path';
4
4
  import { randomUUID } from 'node:crypto';
5
5
  import { Artifacts } from './artifacts.js';
@@ -323,25 +323,67 @@ export class Workspace {
323
323
  return false;
324
324
  try {
325
325
  const [local, base] = [context.workingSnapshot, context.baseSnapshot].map(value => JSON.parse(readFileSync(this.artifacts.path(value), 'utf8')));
326
- return typeof local.fingerprint === 'string' && local.fingerprint === base.fingerprint;
326
+ return this.unchangedBuffers(context.target, base, local.fingerprint);
327
327
  }
328
328
  catch {
329
329
  return false;
330
330
  }
331
331
  }
332
+ /**
333
+ * Saved buffers hold no private work when they equal the shared base, or equal what Ghidra itself wrote when a
334
+ * worker opened a pristine checkout of that base. Equal bytes are the proof; what Ghidra rewrote is irrelevant.
335
+ */
336
+ unchangedBuffers(target, base, fingerprint) {
337
+ if (typeof fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(fingerprint) || base.source !== 'server' || typeof base.fingerprint !== 'string')
338
+ return false;
339
+ return fingerprint === base.fingerprint || this.openedReferences(target, base).has(fingerprint);
340
+ }
341
+ /** Saved buffers of pristine checkouts of one shared version, as each was left by its worker's own open. */
342
+ openedReferences(target, base) {
343
+ const revision = Number(base.version);
344
+ const found = new Set(), root = join(this.directory, 'ghidra-native', 'shared-views', id(target), 'opened');
345
+ let names;
346
+ try {
347
+ names = readdirSync(root);
348
+ }
349
+ catch {
350
+ return found;
351
+ }
352
+ for (const name of names) {
353
+ const match = /^v(\d+)-([a-f0-9]{64})\.json$/.exec(name);
354
+ if (!match || Number(match[1]) !== revision)
355
+ continue;
356
+ try {
357
+ const row = JSON.parse(readFileSync(join(root, name), 'utf8'));
358
+ // Earlier receipts inferred pristine state from control metadata alone; they cannot authorize deletion.
359
+ if (row.schema === 2 && row.preOpen?.fingerprint === base.fingerprint && row.preOpen.fileId === base.fileId && row.preOpen.baseVersion === revision &&
360
+ Number.isSafeInteger(row.preOpen.checkoutId) && row.preOpen.checkoutId >= 0 && row.target === target && row.version === revision && row.fileId === base.fileId && row.base === base.fingerprint && row.origin === base.origin && row.repository === base.repository && row.opened === match[2])
361
+ found.add(match[2]);
362
+ }
363
+ catch { }
364
+ }
365
+ return found;
366
+ }
332
367
  /** Another context's unresolved operation may still need this checkout's private view. */
333
- checkoutReferenced(context) {
334
- const root = context.nativeCheckout?.root, seen = new Set();
368
+ checkoutReferenced(context, root = context.nativeCheckout?.root) {
369
+ const seen = new Set();
335
370
  if (!root)
336
371
  return false;
337
- for (const row of this.db.prepare("SELECT data FROM requests WHERE context<>? AND state IN ('running','unknown')").all(context.id))
372
+ for (const row of this.db.prepare("SELECT data FROM requests WHERE context<>? AND state IN ('running','unknown','failed')").all(context.id)) {
373
+ const request = JSON.parse(String(row.data));
374
+ if (request.dropped || request.state === 'failed' && request.result?.outcome !== 'unknown')
375
+ continue;
338
376
  for (const match of String(row.data).matchAll(/native:([a-f0-9]{64})/g))
339
377
  seen.add(match[1]);
378
+ }
340
379
  for (const sha of seen)
341
380
  try {
342
381
  const value = JSON.parse(readFileSync(join(this.directory, 'artifacts', sha + '.json'), 'utf8'));
343
- if (value.source === 'checkout' && value.checkout?.root === root)
344
- return true;
382
+ if (value.source === 'checkout') {
383
+ const referenced = value.checkout?.root;
384
+ if (typeof referenced !== 'string' || referenced === root || realpathSync(referenced) === realpathSync(root))
385
+ return true;
386
+ }
345
387
  }
346
388
  catch {
347
389
  return true;
@@ -602,6 +644,24 @@ export class Workspace {
602
644
  return next;
603
645
  });
604
646
  }
647
+ /** Exactly proved native pre-call refusal: settle all journals together, retaining the private view. */
648
+ finishRefusedPublication(publication, observedRevision, sharedSnapshot, result) {
649
+ version(observedRevision);
650
+ this.knownSnapshot(sharedSnapshot);
651
+ return this.transaction(() => {
652
+ const previous = this.publication(publication), context = this.context(previous), request = this.request(previous.request), model = this.model(previous.target);
653
+ if (!['commit_intent', 'unknown'].includes(previous.state) || observedRevision <= previous.expectedRevision ||
654
+ observedRevision < (model.sharedRevision ?? 1) || context.generation !== previous.generation || context.workingSnapshot?.id !== previous.snapshot.id ||
655
+ context.nativeCheckout?.state !== 'active' || request.context !== context.id || request.operation !== 'ghidra.merge' ||
656
+ !['running', 'unknown'].includes(request.state))
657
+ fail('binding', 'Refused native publication no longer matches its retained intent.');
658
+ const next = { ...previous, state: 'conflict', detail: result };
659
+ this.db.prepare('UPDATE ghidra_models SET data=? WHERE target=?').run(stable({ ...model, state: 'ready', sharedRevision: observedRevision, sharedSnapshot }), previous.target);
660
+ this.db.prepare('UPDATE publications SET state=?,data=? WHERE id=?').run(next.state, bounded(next), next.id);
661
+ this.writeRequest(previous.request, 'failed', result);
662
+ return next;
663
+ });
664
+ }
605
665
  publishedSince(target, revision) {
606
666
  this.target(target);
607
667
  version(revision);
@@ -611,6 +671,49 @@ export class Workspace {
611
671
  saveContext(scope, expectedGeneration, patch) {
612
672
  return this.transaction(() => this.writeContext(scope, expectedGeneration, patch));
613
673
  }
674
+ /** Independent release readback and its no-publication request outcome become visible together. */
675
+ retainNativeDisposal(scope, generation, checkout, snapshot, request) {
676
+ return this.transaction(() => {
677
+ const context = this.context(scope);
678
+ if (checkout.state !== 'verified' || stable(context.nativeCheckout) !== stable(checkout))
679
+ fail('binding', 'Native disposal ownership changed before retention.');
680
+ const { opened, ...binding } = checkout, active = { ...binding, state: 'active' };
681
+ this.knownSnapshot(snapshot);
682
+ const saved = object(JSON.parse(readFileSync(this.artifacts.path(snapshot), 'utf8')));
683
+ if (snapshot.kind !== 'native' || saved.engine !== 'native-checkout-v1' || saved.source !== 'checkout' || stable(saved.checkout) !== stable(active) ||
684
+ saved.fileId !== active.fileId || saved.version !== active.baseVersion || typeof saved.fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(saved.fingerprint))
685
+ fail('binding', 'Retained native receipt differs from independently observed checkout ownership.');
686
+ if (request) {
687
+ const pending = this.request(request);
688
+ if (pending.context !== context.id || pending.operation !== 'ghidra.merge' || !['running', 'unknown'].includes(pending.state) || object(pending.execution ?? {}).kind !== 'native-merge')
689
+ fail('binding', 'Retained disposal does not match an unfinished native merge request.');
690
+ if (this.db.prepare('SELECT id FROM publications WHERE id=? OR json_extract(data,\'$.request\')=?').get(request, request) || this.activePublication(scope.target) || this.model(scope.target).state !== 'ready')
691
+ fail('blocked', 'A publication outcome cannot be replaced by retained empty disposal.');
692
+ const journal = object(JSON.parse(readFileSync(join(checkout.root, 'operations', request + '-update.json'), 'utf8'))), q = object(journal.request), updated = object(journal.result), view = object(updated.saved);
693
+ const owner = JSON.parse(readFileSync(join(checkout.root, 'native-owner.json'), 'utf8'));
694
+ if (q.operation !== 'update' || q.request !== request || q.root !== checkout.root || q.fileId !== checkout.fileId || q.checkoutId !== checkout.checkoutId || stable(q.owner) !== stable(owner) ||
695
+ updated.state !== 'updated' || updated.checkoutId !== checkout.checkoutId || updated.baseVersion !== checkout.baseVersion || view.fileId !== checkout.fileId || view.version !== checkout.baseVersion ||
696
+ typeof view.fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(view.fingerprint))
697
+ fail('binding', 'Retained disposal lacks its completed owned native Update.');
698
+ try {
699
+ readFileSync(join(checkout.root, 'operations', request + '-checkin.json'));
700
+ fail('blocked', 'A native check-in intent cannot become retained empty disposal.');
701
+ }
702
+ catch (error) {
703
+ if (error.code !== 'ENOENT')
704
+ throw error;
705
+ }
706
+ }
707
+ else if (this.unresolved(scope).some(pending => pending.operation === 'ghidra.merge'))
708
+ fail('blocked', 'Retained native disposal requires its unfinished merge request identity.');
709
+ const result = { session: scope.session, target: scope.target, state: 'retained', engine: 'ghidra-native', checkout: 'retained',
710
+ retention: { schema: 1, source: 'native-release-status', checkout: active, snapshot, ...(request ? { request } : {}) } };
711
+ this.writeContext(scope, generation, { nativeCheckout: active, workingSnapshot: snapshot, state: 'stopped' });
712
+ if (request)
713
+ this.writeRequest(request, 'failed', result);
714
+ return result;
715
+ });
716
+ }
614
717
  /** Terminal abandonment retains the previous outcome and saved view atomically. */
615
718
  abandonProgramRequest(scope, request, generation) {
616
719
  return this.transaction(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eyeauras/insight-cli",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "type": "module",
5
5
  "description": "Agent-facing durable sessions and isolated Ghidra research contexts",
6
6
  "main": "./dist/src/index.js",
@@ -37,9 +37,17 @@ Codex is the first concrete supported-host gate.
37
37
 
38
38
  ## Execution access
39
39
 
40
- A skill link does not grant filesystem or IPC permissions. Allow the assigned profile's AppData
41
- and the CLI's `.runtime` directory, plus its exact local IPC endpoint. On macOS the application
42
- root is `~/Library/Application Support/insight-cli`; its Unix socket is `.runtime/host.sock`.
40
+ A skill link does not grant filesystem or IPC permissions. Run
41
+ `insight-cli --profile <name> storage show --json` through the selected executable to inspect
42
+ the assigned profile. Its `appData` is the profile directory, not the whole application control root.
43
+ Allow that directory and the shared metadata in its parent: `profiles.json` for profile discovery
44
+ and `.analysis-storage-default.json` for installation defaults. Permit parent traversal and the
45
+ metadata's owned lock/temporary entries when configuration writes need them; keep unrelated
46
+ profile directories outside the grant. Also allow the effective analysis `directory`, which may be elsewhere after
47
+ storage configuration, migration or installation-default selection. Follow the
48
+ [storage workflow](storage.md) for retained compatibility paths. Also allow the CLI's `.runtime`
49
+ directory and exact local IPC endpoint. On macOS the application root is
50
+ `~/Library/Application Support/insight-cli`; its Unix socket is `.runtime/host.sock`.
43
51
  Keep unrelated profiles outside the write scope and pass the assigned `--profile` explicitly.
44
52
  Do not grant broad external network access merely to reach a local socket.
45
53
 
@@ -29,7 +29,7 @@ packed-database readback before acknowledgment. Reopening after process replacem
29
29
  saved trace data as disconnected. It does not restart the debuggee or reconstruct CPU execution.
30
30
  Ordinary static program edits remain private and retain the usual merge/refresh behavior.
31
31
  Static breakpoint bookmarks created by debugger actions also count as pending program changes.
32
- They follow explicit merge/refresh and complex-change conflict rules; CPU execution does not
32
+ They follow native merge/refresh and its conflict handling; CPU execution does not
33
33
  wait for publication, and publishing a program never resumes another session's process.
34
34
 
35
35
  On macOS, launch enforces the selected working directory, including paths with spaces and
@@ -37,9 +37,11 @@ quotes. A GUI backend crash ends the owned live debuggee through its debugger co
37
37
  Verified trace data retained before a lost action response is adopted on disconnected continuation,
38
38
  unless a later observation already saved a newer view. The CPU action itself remains uncertain.
39
39
 
40
- On macOS, use an installed local LLDB and an executable supported by that host. GUI startup
40
+ On macOS 15+ ARM64, GUI uses the private LLDB/Python dependency described in
41
+ [managed runtime](managed-runtime.md#managed-debugger-dependency). Other macOS routes use a
42
+ compatible local LLDB and Python; select an executable supported by that host. GUI startup
41
43
  prepares the Python wheels already supplied with Ghidra in owned storage; it does not install
42
- packages into system Python. A launcher's optional Python executable and Windows debugger
44
+ packages into system Python. System-backend Python overrides and the Windows debugger
43
45
  directory are Factory profile settings. Native Windows/Linux acceptance remains deferred.
44
46
 
45
47
  Use generated help for exact flags. A retained static breakpoint bookmark may remain after its live trace placement is
@@ -88,7 +88,7 @@ insight-cli ghidra sync-policy set --session s_a --target t_exe \
88
88
  | `--publish after-edit` | After a supported program edit has a verified saved acknowledgment, merge all pending work in that context. Also publishes pending work on explicit `ghidra save`. |
89
89
  | `--publish after-save` | Ordinary edits stay private; explicit scoped `ghidra save` merges all pending work after saving. |
90
90
  | `--refresh manual` | No automatic incoming update. |
91
- | `--refresh before-edit` | Refresh before a program-edit command; any returned conflict stops that edit before dispatch. Safe incoming changes from the refresh remain retained. |
91
+ | `--refresh before-edit` | Refresh before a program-edit command. A native conflict receives no incoming changes, retains the original checkout and base, and stops the edit before dispatch. A successful refresh remains saved if the later edit fails. |
92
92
 
93
93
  Supported program-edit commands include ordinary names/comments, types, bytes/assembly,
94
94
  analysis and scripts. Policy excludes control commands (`open`, `close`, `merge`, `refresh`,
@@ -107,11 +107,12 @@ Nothing from that merge is published. An incoming conflict reports `phase: refre
107
107
  `localApplied: false`; the requested edit was not started. Lost local replies may report
108
108
  `localOutcome: unknown`; they do not falsely assert that the local effect failed.
109
109
 
110
- Automatic merge uses exactly the manual contract: any conflict prevents the whole publication;
111
- only verified scalar categories combine after divergence; complex divergence retains both
112
- versions. Use explicit refresh, inspect/resolve scalar conflicts, or transfer complex changes
113
- onto a current base. A failed automatic workflow does not silently retry after resolution;
114
- use a new request or explicit merge for the new intention.
110
+ Automatic merge follows the manual native workflow. Ghidra Update combines local and incoming
111
+ analysis using checkout ancestry and native change sets, including structural edits. A native
112
+ conflict prevents publication and retains the original checkout and base. Inspect scoped status
113
+ and the native conflict details before choosing a deliberate resolution. A failed automatic
114
+ workflow does not silently retry after resolution; use a new request or explicit merge for the
115
+ new intention.
115
116
 
116
117
  Policy survives owner replacement. Optional request IDs (up to 128 characters) bind the local edit, incoming refresh and publication workflow. Repeating the same ID/input
117
118
  retrieves its result or reconciles the original publication; it never replays a check-in or
@@ -139,9 +139,10 @@ Unsupported platforms fail explicitly and may use compatible external profile pa
139
139
  acceptance for this delivery is macOS ARM64; catalog availability is not Windows/Linux native proof.
140
140
 
141
141
  The host provides Node/npm, OS frameworks, display/keychain access and debugger authorization.
142
- macOS LLDB and its embedded Python come from Apple's developer tools; they are OS prerequisites,
143
- not downloaded third-party Python dependencies. `doctor` reports a missing host debugger as a partial
144
- failure even when static analysis/server pass. No root installation, developer-tools installer,
142
+ On macOS 15+ ARM64 the managed debugger below supplies private LLDB/Python; Apple developer
143
+ tools are not prerequisites for that backend. Other macOS system-debugger routes use LLDB and
144
+ its Python from Apple's developer tools. `doctor` probes the selected backend and can report
145
+ partial debugger failure while static analysis/server pass. No root installation, developer-tools installer,
145
146
  Gatekeeper disabling, shell-profile edit or global Java/Python selection is performed. Ghidra GUI
146
147
  agents receive private copies of the Ghidra SDK's pinned debugger Python wheels.
147
148
 
@@ -57,13 +57,131 @@ public final class InsightNativeCheckout {
57
57
  /** Every file with local bytes, at any depth; unmodified server items have none. */
58
58
  static void local(DomainFolder folder,Set<String> names){
59
59
  for(DomainFile f:folder.getFiles())if(!f.isVersioned()||f.isCheckedOut()||f.isHijacked()||f.canRecover())names.add(f.getPathname().substring(1));
60
- for(DomainFolder child:folder.getFolders())if(!child.isLinked())local(child,names);
60
+ for(DomainFolder child:folder.getFolders())if(child.isLinked())names.add(child.getPathname().substring(1)+"/");else local(child,names);
61
+ }
62
+ static String authorized(JsonObject q){return text(q,q.has("opened")?"opened":"fingerprint");}
63
+ static boolean sameRelease(JsonObject receipt,JsonObject q){
64
+ if(!Objects.equals(receipt.get("checkoutId"),q.get("checkoutId"))||!Objects.equals(receipt.get("fingerprint"),q.get("fingerprint"))||
65
+ !Objects.equals(receipt.get("version"),q.get("verifiedVersion")))return false;
66
+ // Completed older receipts already ended the checkout. Preserve their deletion-only recovery.
67
+ if(!receipt.has("savedFingerprint")&&!receipt.has("fileId"))return true;
68
+ return Objects.equals(receipt.get("fileId"),q.get("fileId"))&&Objects.equals(receipt.get("savedFingerprint"),new JsonPrimitive(authorized(q)));
69
+ }
70
+ /** A new intent can prove the local file left between server termination and native undo's local deletion. */
71
+ static boolean survivingRelease(JsonObject receipt,JsonObject q,Map<String,Object> saved){
72
+ return receipt.has("fileId")&&receipt.has("savedFingerprint")&&Objects.equals(receipt.get("state"),new JsonPrimitive("release_intent"))&&sameRelease(receipt,q)&&
73
+ Objects.equals(saved.get("fileId"),text(receipt,"fileId"))&&Objects.equals(saved.get("fingerprint"),text(receipt,"savedFingerprint"));
74
+ }
75
+ static boolean backupName(String program,String name){
76
+ String keep=program+".keep";
77
+ return name.equals(keep)||name.startsWith(keep+".")&&name.substring(keep.length()+1).matches("[1-9][0-9]*");
78
+ }
79
+ /** Include occupied server names too: undoCheckout chooses a name absent from both filesystems. */
80
+ static Map<String,String> backupInventory(Project project,String program){
81
+ Map<String,String> files=new TreeMap<>();
82
+ for(DomainFile file:project.getProjectData().getRootFolder().getFiles())if(backupName(program,file.getName()))files.put(file.getName(),file.getFileID());
83
+ return files;
84
+ }
85
+ static String createdBackup(String program,JsonObject before,JsonObject after){
86
+ require(before!=null&&after!=null,"Native backup creation inventory is missing");
87
+ for(var entry:before.entrySet())require(backupName(program,entry.getKey())&&entry.getValue().equals(after.get(entry.getKey())),"Pre-existing native backup identity changed");
88
+ var added=new TreeSet<>(after.keySet());added.removeAll(before.keySet());
89
+ require(added.size()==1&&backupName(program,added.first()),"Native backup creation is ambiguous");
90
+ JsonElement id=after.get(added.first());require(id!=null&&id.isJsonPrimitive()&&id.getAsJsonPrimitive().isString()&&!id.getAsString().isEmpty(),"Native backup identity is missing");
91
+ return added.first();
92
+ }
93
+ static boolean backupMatches(JsonObject journal,String name,Map<String,Object> saved){try{
94
+ JsonObject files=journal.getAsJsonObject("result").getAsJsonObject("disposableBackups");
95
+ if(files==null||!files.has(name))return false;
96
+ JsonElement proof=files.get(name);
97
+ if(proof.isJsonPrimitive()){
98
+ // Older proofs were recorded only for a before-image-equal backup (not saveAs-created Update copies).
99
+ return name.endsWith(".keep")&&proof.equals(journal.getAsJsonObject("before").get("fingerprint"))&&saved.get("fingerprint").equals(proof.getAsString());
100
+ }
101
+ if(!proof.isJsonObject())return false;
102
+ JsonObject created=proof.getAsJsonObject();
103
+ if(!saved.get("fileId").equals(text(created,"fileId"))||!saved.get("fingerprint").equals(text(created,"fingerprint"))||
104
+ !journal.get("backupExpected").getAsBoolean())return false;
105
+ if(created.get("schema").getAsInt()==2){
106
+ String program=text(journal.getAsJsonObject("request").getAsJsonObject("owner"),"path").substring(1);
107
+ return text(journal.getAsJsonObject("request"),"operation").equals("discard")&&
108
+ name.equals(createdBackup(program,journal.getAsJsonObject("backupFilesBefore"),journal.getAsJsonObject("backupFilesAfter")))&&
109
+ journal.getAsJsonObject("backupFilesAfter").get(name).equals(created.get("fileId"))&&
110
+ name.equals(text(journal.getAsJsonObject("result"),"retainedKeepFile"))&&
111
+ created.get("fingerprint").equals(journal.getAsJsonObject("before").get("fingerprint"));
112
+ }
113
+ boolean newFile=journal.has("backupAbsent")&&(journal.get("backupAbsent").getAsBoolean()||journal.has("backupBeforeFileId")&&!journal.get("backupBeforeFileId").isJsonNull()&&
114
+ !journal.get("backupBeforeFileId").equals(created.get("fileId")));
115
+ return name.endsWith(".keep")&&newFile&&created.get("schema").getAsInt()==1;
116
+ }catch(RuntimeException unproved){return false;}}
117
+ static boolean ownedBackupJournal(String filename,JsonObject journal,JsonObject q,JsonObject owner){try{
118
+ JsonObject request=journal.getAsJsonObject("request"),result=journal.getAsJsonObject("result");
119
+ return request!=null&&result!=null&&owner.equals(request.getAsJsonObject("owner"))&&Objects.equals(request.get("root"),q.get("root"))&&
120
+ Objects.equals(request.get("fileId"),q.get("fileId"))&&text(request,"request").matches("q_[a-f0-9-]{36}")&&
121
+ filename.equals(text(request,"request")+"-"+text(request,"operation")+".json")&&
122
+ (text(request,"operation").equals("update")&&text(result,"state").equals("updated")||text(request,"operation").equals("discard")&&text(result,"state").equals("discarded"))&&
123
+ result.get("baseVersion").getAsInt()<=q.get("verifiedVersion").getAsInt();
124
+ }catch(RuntimeException unproved){return false;}}
125
+ /** A completed discard replaces one checkout in this same project. Incomplete intents never extend the chain. */
126
+ static Set<Long> backupCheckouts(List<JsonObject> journals,JsonObject q){
127
+ Set<Long> ids=new HashSet<>();ids.add(q.get("checkoutId").getAsLong());boolean changed;
128
+ do{changed=false;for(JsonObject journal:journals)try{
129
+ JsonObject request=journal.getAsJsonObject("request"),result=journal.getAsJsonObject("result"),saved=result.getAsJsonObject("saved");
130
+ if(text(request,"operation").equals("discard")&&text(result,"state").equals("discarded")&&ids.contains(result.get("checkoutId").getAsLong())&&
131
+ result.get("modified").getAsBoolean()==false&&Objects.equals(request.get("checkoutId"),journal.get("checkoutId"))&&
132
+ !Objects.equals(request.get("checkoutId"),result.get("checkoutId"))&&request.get("checkoutId").getAsLong()>=0&&
133
+ Objects.equals(saved.get("fileId"),q.get("fileId"))&&Objects.equals(saved.get("version"),result.get("baseVersion"))&&
134
+ text(saved,"fingerprint").matches("[a-f0-9]{64}")&&
135
+ result.get("baseVersion").getAsInt()>=journal.get("baseVersion").getAsInt())changed|=ids.add(request.get("checkoutId").getAsLong());
136
+ }catch(RuntimeException unproved){/* A partial receipt cannot connect checkouts. */}}while(changed);
137
+ return ids;
138
+ }
139
+ /** Only an expected backup newly created by a completed owned native operation, still at its recorded bytes, is disposable. */
140
+ static Map<String,String> backups(Project project,Path operations,JsonObject q,JsonObject owner)throws Exception {
141
+ String name=text(owner,"path").substring(1);Map<String,String> proved=new TreeMap<>();List<JsonObject> journals=new ArrayList<>();
142
+ try(var paths=Files.list(operations)){
143
+ for(Path path:paths.filter(p->p.getFileName().toString().matches("q_[a-f0-9-]{36}-(update|discard)\\.json")).sorted().toList()){
144
+ JsonObject journal=JsonParser.parseString(Files.readString(path)).getAsJsonObject();
145
+ if(ownedBackupJournal(path.getFileName().toString(),journal,q,owner))journals.add(journal);
146
+ }
147
+ }
148
+ Set<Long> checkouts=backupCheckouts(journals,q);
149
+ for(JsonObject journal:journals){
150
+ JsonObject result=journal.getAsJsonObject("result"),files=result.getAsJsonObject("disposableBackups");
151
+ if(files==null||!checkouts.contains(result.get("checkoutId").getAsLong()))continue;
152
+ for(String keep:files.keySet()){
153
+ if(!backupName(name,keep))continue;
154
+ DomainFile backup=project.getProjectData().getFile("/"+keep);
155
+ if(backup==null||backup.isVersioned()||backup.canRecover()||backup.isCheckedOut()||backup.isHijacked())continue;
156
+ try{Map<String,Object> current=saved(backup,owner);if(backupMatches(journal,keep,current))proved.put(keep,current.get("fingerprint").toString());}
157
+ catch(Exception unproved){/* Unreadable or foreign bytes remain private. */}
158
+ }
159
+ }
160
+ return proved;
161
+ }
162
+ /** Update's createKeepFile deletes an existing .keep. Prove that exact file disposable before entering native merge. */
163
+ static boolean replaceableBackup(Project project,Path operations,JsonObject q,JsonObject owner,int base,Map<String,Object> intent){
164
+ JsonObject proof=q.deepCopy();proof.addProperty("verifiedVersion",base);
165
+ try{
166
+ String keep=text(owner,"path").substring(1)+".keep";
167
+ DomainFile backup=project.getProjectData().getFile("/"+keep);
168
+ if(backup==null||!Objects.equals(backup.getFileID(),intent.get("backupBeforeFileId")))return false;
169
+ String fingerprint=backups(project,operations,proof,owner).get(keep);
170
+ if(fingerprint==null)return false;
171
+ intent.put("backupReplacementProof",Map.of("name",keep,"fileId",intent.get("backupBeforeFileId"),"fingerprint",fingerprint));
172
+ return true;
173
+ }catch(Exception unproved){return false;}
174
+ }
175
+ static Map<String,String> releaseFiles(Project project,Path operations,JsonObject q,JsonObject owner,boolean localProgram)throws Exception {
176
+ var files=new TreeSet<String>();local(project.getProjectData().getRootFolder(),files);
177
+ Map<String,String> backups=backups(project,operations,q,owner);var allowed=new TreeSet<>(backups.keySet());
178
+ if(localProgram)allowed.add(text(owner,"path").substring(1));
179
+ require(files.equals(allowed),"Unpublished native project files must be retained");return backups;
61
180
  }
62
181
  static boolean released(Path root,JsonObject q)throws Exception {
63
182
  Path path=root.resolve("released.json");if(!Files.exists(path))return false;
64
183
  var released=JsonParser.parseString(Files.readString(path)).getAsJsonObject();
65
- return text(released,"state").equals("released")&&released.get("checkoutId").equals(q.get("checkoutId"))&&
66
- released.get("fingerprint").equals(q.get("fingerprint"))&&released.get("version").equals(q.get("verifiedVersion"));
184
+ return text(released,"state").equals("released")&&sameRelease(released,q);
67
185
  }
68
186
  static void deleteReleased(Path root,ProjectLocator locator)throws Exception {
69
187
  for(Path target:List.of(locator.getProjectDir().toPath(),locator.getMarkerFile().toPath())){
@@ -164,19 +282,43 @@ public final class InsightNativeCheckout {
164
282
  require(file.isCheckedOut(),"Native checkout missing");
165
283
  var before=saved(file,owner);long checkout=file.getCheckoutStatus().getCheckoutId();int base=file.getCheckoutStatus().getCheckoutVersion(),head=file.getLatestVersion();
166
284
  Map<String,Object> intent=new LinkedHashMap<>();intent.put("request",q);intent.put("before",before);intent.put("checkoutId",checkout);intent.put("baseVersion",base);intent.put("headVersion",head);
285
+ DomainFile priorKeep=project.getProjectData().getFile(path+".keep");boolean keepAbsent=priorKeep==null;
286
+ String priorKeepId=keepAbsent?null:priorKeep.getFileID();
287
+ boolean backupExpected=file.modifiedSinceCheckout()&&(operation.equals("discard")||operation.equals("update")&&head>base);
288
+ intent.put("backupAbsent",keepAbsent);intent.put("backupBeforeFileId",priorKeepId);intent.put("backupExpected",backupExpected);
167
289
  if(operation.equals("discard")){
290
+ var backupsBefore=backupInventory(project,name);intent.put("backupFilesBefore",backupsBefore);
168
291
  write(journal,intent);
169
- boolean dirty=file.modifiedSinceCheckout();file.undoCheckout(dirty);
292
+ file.undoCheckout(backupExpected);
293
+ out.put("state","discarded");out.put("retainedKeepFile","");
294
+ if(backupExpected){
295
+ var backupsAfter=backupInventory(project,name);intent.put("backupFilesAfter",backupsAfter);
296
+ String keep=createdBackup(name,GSON.toJsonTree(backupsBefore).getAsJsonObject(),GSON.toJsonTree(backupsAfter).getAsJsonObject());
297
+ DomainFile created=project.getProjectData().getFile("/"+keep);
298
+ require(created!=null&&!created.isVersioned()&&!created.canRecover()&&!created.isCheckedOut()&&!created.isHijacked(),"Native discard backup is not private");
299
+ var actual=saved(created,owner);
300
+ require(Objects.equals(actual.get("fileId"),backupsAfter.get(keep))&&Objects.equals(actual.get("fingerprint"),before.get("fingerprint")),"Native discard backup differs from saved private buffers");
301
+ out.put("retainedKeepFile",keep);out.put("disposableBackups",Map.of(keep,Map.of("schema",2,"fileId",actual.get("fileId"),"fingerprint",actual.get("fingerprint"))));
302
+ }
170
303
  file=project.getProjectData().getFile(path);require(file.checkout(false,MONITOR),"Native checkout after discard was refused");
171
- out.put("state","discarded");out.put("retainedKeepFile",dirty?name+".keep":"");
172
304
  }else if(operation.equals("update")){
173
305
  write(journal,intent);
174
- try{if(head>base)file.merge(false,MONITOR);
175
- require(file.getCheckoutStatus().getCheckoutId()==checkout&&file.getCheckoutStatus().getCheckoutVersion()>=head,"Native Update did not establish the requested ancestry");
176
- out.put("state","updated");}
177
- catch(HeadlessProgramMergeManager.UnresolvedNativeConflict conflict){
178
- require(before.equals(saved(file,owner))&&file.getCheckoutStatus().getCheckoutId()==checkout&&file.getCheckoutStatus().getCheckoutVersion()==base,"Native conflict did not preserve local state");
179
- out.put("state","conflict");out.put("conflict",conflict.getMessage());
306
+ // Only dirty incoming Update can replace .keep. A refusal is a completed pre-call outcome,
307
+ // carried by the existing conflict/recovery path; incomplete/legacy intents remain unknown.
308
+ if(backupExpected&&!keepAbsent&&!replaceableBackup(project,operations,q,owner,base,intent)){
309
+ require(before.equals(saved(file,owner))&&file.getCheckoutStatus().getCheckoutId()==checkout&&file.getCheckoutStatus().getCheckoutVersion()==base,"Backup refusal did not preserve local state");
310
+ out.put("state","conflict");out.put("conflict","Existing native backup is not proved disposable; retain and inspect this project before Update");
311
+ var refusal=new LinkedHashMap<String,Object>(Map.of("schema",1,"operation","update","invoked",false,"reason","protected_existing_backup"));
312
+ refusal.put("fileId",priorKeepId);out.put("preCallRefusal",refusal);
313
+ }else{
314
+ if(intent.containsKey("backupReplacementProof"))write(journal,intent);
315
+ try{if(head>base)file.merge(false,MONITOR);
316
+ require(file.getCheckoutStatus().getCheckoutId()==checkout&&file.getCheckoutStatus().getCheckoutVersion()>=head,"Native Update did not establish the requested ancestry");
317
+ out.put("state","updated");}
318
+ catch(HeadlessProgramMergeManager.UnresolvedNativeConflict conflict){
319
+ require(before.equals(saved(file,owner))&&file.getCheckoutStatus().getCheckoutId()==checkout&&file.getCheckoutStatus().getCheckoutVersion()==base,"Native conflict did not preserve local state");
320
+ out.put("state","conflict");out.put("conflict",conflict.getMessage());
321
+ }
180
322
  }
181
323
  }else{
182
324
  require(before.get("fingerprint").equals(text(q,"fingerprint")),"Prepared native publication changed");
@@ -198,18 +340,35 @@ public final class InsightNativeCheckout {
198
340
  }
199
341
  out.put("saved",saved(file,owner));out.put("checkoutId",file.getCheckoutStatus().getCheckoutId());out.put("baseVersion",file.getCheckoutStatus().getCheckoutVersion());
200
342
  out.put("modified",file.modifiedSinceCheckout());out.put("nativeMergeInvocations",HeadlessProgramMergeManager.invocations);out.put("nativePhases",HeadlessProgramMergeManager.phases);
343
+ if(backupExpected&&out.get("state").equals("updated")){
344
+ DomainFile keep=project.getProjectData().getFile(path+".keep");
345
+ // Ghidra's dirty Update uses createFile/saveAs, assigning the copy a new DB ID inside the fingerprinted bytes.
346
+ if(keep!=null&&(keepAbsent||priorKeepId!=null&&!priorKeepId.equals(keep.getFileID()))&&!keep.isVersioned()&&!keep.canRecover()&&!keep.isCheckedOut()&&!keep.isHijacked())try{
347
+ var actual=saved(keep,owner);out.put("disposableBackups",Map.of(name+".keep",Map.of("schema",1,"fileId",actual.get("fileId"),"fingerprint",actual.get("fingerprint"))));
348
+ }
349
+ catch(Exception unproved){/* An unreadable backup remains private; it cannot invalidate native completion. */}
350
+ }
201
351
  intent.put("result",out);write(journal,intent);
202
352
  }
203
353
  }else if(operation.equals("release")){
204
354
  Path releaseFile=root.resolve("released.json");
205
- Map<String,Object> release=new LinkedHashMap<>(Map.of("checkoutId",q.get("checkoutId").getAsLong(),"version",q.get("verifiedVersion").getAsInt(),"fingerprint",text(q,"fingerprint")));
355
+ Map<String,Object> release=new LinkedHashMap<>(Map.of("checkoutId",q.get("checkoutId").getAsLong(),"version",q.get("verifiedVersion").getAsInt(),"fingerprint",text(q,"fingerprint"),
356
+ "fileId",text(q,"fileId"),"savedFingerprint",authorized(q)));
206
357
  if(file.isCheckedOut()){
207
- require(!file.modifiedSinceCheckout()&&file.getCheckoutStatus().getCheckoutVersion()==q.get("verifiedVersion").getAsInt(),"Unpublished native work must be retained");
208
- require(saved(file,owner).get("fingerprint").equals(text(q,"fingerprint")),"Verified native buffers changed");
358
+ require(!q.has("opened")||q.has("openedVerified")&&q.get("openedVerified").getAsBoolean(),"Pristine-open proof is unverified; private work must be retained");
359
+ require(file.getCheckoutStatus().getCheckoutVersion()==q.get("verifiedVersion").getAsInt()&&!file.canRecover(),"Unpublished native work must be retained");
360
+ Object local=saved(file,owner).get("fingerprint");
361
+ // Ghidra's own rewrite on open marks a checkout modified; only bytes the coordinator proved to hold no work may carry it.
362
+ require(local.equals(authorized(q)),"Verified native buffers changed");
363
+ require(q.has("opened")||!file.modifiedSinceCheckout(),"Unpublished native work must be retained");
364
+ release.put("disposableBackups",releaseFiles(project,operations,q,owner,true));
209
365
  release.put("state","release_intent");write(releaseFile,release);file.undoCheckout(false);
210
366
  }else{
211
367
  var prior=JsonParser.parseString(Files.readString(releaseFile)).getAsJsonObject();
212
- require(prior.get("checkoutId").equals(q.get("checkoutId"))&&prior.get("version").equals(q.get("verifiedVersion"))&&prior.get("fingerprint").equals(q.get("fingerprint")),"Release intent changed");
368
+ require(text(prior,"state").equals("release_intent")&&sameRelease(prior,q),"Release intent changed");
369
+ boolean surviving=file.isHijacked();
370
+ if(surviving)require(!file.canRecover()&&survivingRelease(prior,q,saved(file,owner)),"Unproved surviving native file must be retained");
371
+ release.put("disposableBackups",releaseFiles(project,operations,q,owner,surviving));
213
372
  }
214
373
  require(Arrays.stream(repository.getCheckouts("/",name)).noneMatch(c->c.getCheckoutId()==q.get("checkoutId").getAsLong()),"Owned checkout remains");
215
374
  release.put("state","released");write(releaseFile,release);out.put("state","released");
@@ -10,6 +10,10 @@ native-merge-patches.ts extracts six SHA-256-pinned upstream source files from
10
10
  the selected Ghidra installation into owned compilation storage. The generated
11
11
  sources retain their original license headers. Headless entry/display assumptions
12
12
  are adapted. A separate native MemoryMergeManager compatibility correction covers
13
- unchanged-null comments and symmetric deletion/update conflicts. The generated
13
+ unchanged-null comments and symmetric deletion/update conflicts. The native Update
14
+ adapter also saves an unchanged merge result through Ghidra's DB save API so its
15
+ cumulative change files exist, then records that result as clean at the exact
16
+ merged version without replacing the checkout or inventing native edits.
17
+ The generated
14
18
  native-merge-provenance.json records upstream and compiled source hashes.
15
19
  Installed Ghidra JARs are not modified. No alternative object merger is provided.
@@ -2,9 +2,11 @@
2
2
 
3
3
  These commands extend the pinned MCP catalog. All program calls select both `--session` and
4
4
  `--target`; API callers use the same Factory command paths. Use generated help for flags.
5
- Programs remain private until explicit `ghidra merge`. Every new program edit is a complex
6
- change: saved-state verification is required, and a diverged shared base retains a conflict.
7
- `refresh` does not silently overwrite either complex version. Program edits require Destructive
5
+ By default, programs remain private until explicit `ghidra merge`; configured automatic policies
6
+ are described in [synchronization](extensions-and-sync.md). Saved-state verification is required.
7
+ Ghidra's native Update receives incoming changes for `merge` and `refresh`, including compatible
8
+ structural changes. Unresolved native conflicts receive no incoming changes and retain the
9
+ original private checkout, saved buffers and base. Program edits in these SDK workflows require Destructive
8
10
  permission. File/database creation and VT decisions require Update; reads require ReadOnly.
9
11
 
10
12
  ## Compare and edit a private program
@@ -104,5 +104,6 @@ the entire initialized-content digest before acknowledgment. `functions set-func
104
104
  also accepts `--calling-convention`; saved signature types and convention are verified.
105
105
 
106
106
  These remain complex private edits. Request IDs retrieve retained outcomes; lost responses are
107
- reconciled from saved effects, never blindly re-created. Publish with explicit merge on the
108
- unchanged shared base; structural divergence still retains a conflict.
107
+ reconciled from saved effects, never blindly re-created. Publish with explicit `ghidra merge`,
108
+ which runs native Update/check-in. Ghidra combines local and incoming analysis using checkout
109
+ ancestry and native change sets. A native conflict retains the original working copy and base.
@@ -7,6 +7,12 @@ without importing a snapshot or silently receiving a newer shared version. Priva
7
7
  have no publisher credentials; service-only Update/check-in temporarily owns the stopped project.
8
8
  Legacy detached contexts require explicit migration and remain retained.
9
9
 
10
+ If final checkout release refuses, saved private work remains retained. When the service
11
+ independently proves that the same checkout survived, reopen the same selectors to inspect
12
+ it. An empty merge can finish as failed/retained; an already published request keeps its
13
+ verified result. An unproved release or check-in outcome stays blocked for journal-based
14
+ recovery. Preserve its project and receipts rather than repeating a mutation with a new ID.
15
+
10
16
  If native `changes discard` loses its response, retry its original request ID or continue
11
17
  the same session/target. Recovery requires a completed native discard journal and matching
12
18
  new checkout identity/base and saved buffers, followed by independent server readback.
@@ -61,8 +61,15 @@ in the selected profile before creating contexts or editing. Research scope is e
61
61
  skill discovery and help require no authentication or native process startup.
62
62
  Deletion and replacement commands also require `permissions grant Destructive`.
63
63
 
64
- All target bytes, snapshots, journals, projects and process receipts derive from the selected
65
- profile's AppData. Stop the owner through `ipc-server stop` before changing its code/runtime
64
+ Inspect `insight-cli --profile <name> storage show --json`: research bytes, snapshots, journals,
65
+ projects, managed runtimes and materials use its effective analysis `directory`. Factory's `appData`
66
+ is the profile directory. Its parent also holds shared control metadata: `profiles.json` and
67
+ `.analysis-storage-default.json`. Grant access to the profile, effective analysis directory and
68
+ those parent metadata files, including parent traversal and owned lock/temporary entries needed
69
+ for configuration writes, while keeping unrelated profile directories outside the grant.
70
+ Credentials remain in the platform secret store. These locations may differ after configuration, migration or installation-default
71
+ selection; use the supported
72
+ [storage workflow](storage.md). Stop the owner through `ipc-server stop` before changing its code/runtime
66
73
  configuration. Restoring a saved context preserves its private view. Server settings and initial
67
74
  loader settings remain bound to the target/workspace, so changing those cannot silently replace
68
75
  retained work. This revision conservatively protects retained profile research state from deletion.
@@ -3,7 +3,7 @@ name: insight-artifacts
3
3
  description: Retain a completed reverse-engineering evidence file or directory as an ordinary checkpoint using insight-cli artifacts save. Use after Ghidra or any external tool; preserve existing project formats and source of truth.
4
4
  ---
5
5
 
6
- # Insight Artifacts 0.6.4
6
+ # Insight Artifacts 0.6.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -7,6 +7,12 @@ without importing a snapshot or silently receiving a newer shared version. Priva
7
7
  have no publisher credentials; service-only Update/check-in temporarily owns the stopped project.
8
8
  Legacy detached contexts require explicit migration and remain retained.
9
9
 
10
+ If final checkout release refuses, saved private work remains retained. When the service
11
+ independently proves that the same checkout survived, reopen the same selectors to inspect
12
+ it. An empty merge can finish as failed/retained; an already published request keeps its
13
+ verified result. An unproved release or check-in outcome stays blocked for journal-based
14
+ recovery. Preserve its project and receipts rather than repeating a mutation with a new ID.
15
+
10
16
  If native `changes discard` loses its response, retry its original request ID or continue
11
17
  the same session/target. Recovery requires a completed native discard journal and matching
12
18
  new checkout identity/base and saved buffers, followed by independent server readback.
@@ -3,7 +3,7 @@ name: insight-binary
3
3
  description: Query structured PE, ELF and thin Mach-O headers, sections, imports and exports, or make an explicitly guarded new PE subsystem copy through insight-cli binary. Use for scoped binary structure, linkage and copy-only header edits without target execution.
4
4
  ---
5
5
 
6
- # Insight Binary 0.6.4
6
+ # Insight Binary 0.6.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized