@eyeauras/insight-cli 0.5.7 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/.cli-package-build.json +1 -1
  2. package/SKILL.md +1 -1
  3. package/dist/src/artifacts.d.ts +1 -1
  4. package/dist/src/artifacts.js +3 -3
  5. package/dist/src/cli.js +74 -15
  6. package/dist/src/contexts.d.ts +120 -10
  7. package/dist/src/contexts.js +510 -107
  8. package/dist/src/legacy-migration.d.ts +37 -0
  9. package/dist/src/legacy-migration.js +237 -0
  10. package/dist/src/lifecycle.d.ts +16 -5
  11. package/dist/src/lifecycle.js +43 -6
  12. package/dist/src/merge.d.ts +1 -1
  13. package/dist/src/merge.js +2 -2
  14. package/dist/src/model.d.ts +5 -0
  15. package/dist/src/model.js +2 -0
  16. package/dist/src/native-inputs.js +12 -2
  17. package/dist/src/native-merge-patches.d.ts +6 -0
  18. package/dist/src/native-merge-patches.js +100 -0
  19. package/dist/src/persistent-client.d.ts +8 -2
  20. package/dist/src/persistent-client.js +30 -8
  21. package/dist/src/projects.js +5 -4
  22. package/dist/src/research.d.ts +77 -14
  23. package/dist/src/research.js +99 -123
  24. package/dist/src/sdk-files.js +3 -3
  25. package/dist/src/server.d.ts +5 -1
  26. package/dist/src/server.js +46 -6
  27. package/dist/src/storage-gc.d.ts +23 -0
  28. package/dist/src/storage-gc.js +358 -0
  29. package/dist/src/sync-policy.js +4 -2
  30. package/dist/src/version-tracking.js +2 -1
  31. package/dist/src/workspace.d.ts +35 -2
  32. package/dist/src/workspace.js +91 -7
  33. package/package.json +1 -1
  34. package/references/native/APACHE-2.0.txt +202 -0
  35. package/references/native/HeadlessProgramMergeManager.java +86 -0
  36. package/references/native/InsightGuiMain.java +1 -0
  37. package/references/native/InsightHeadlessMain.java +1 -0
  38. package/references/native/InsightImportProgress.java +10 -5
  39. package/references/native/InsightInitialImport.java +1 -1
  40. package/references/native/InsightNativeCheckout.java +214 -0
  41. package/references/native/InsightNativeFingerprint.java +14 -0
  42. package/references/native/InsightNativeMigration.java +147 -0
  43. package/references/native/InsightNativeRead.java +57 -0
  44. package/references/native/InsightNativeView.java +29 -0
  45. package/references/native/InsightOfflineAuthenticator.java +20 -0
  46. package/references/native/InsightSdkFiles.java +4 -0
  47. package/references/native/InsightSnapshotFields.java +17 -11
  48. package/references/native/InsightSnapshotInspect.java +4 -2
  49. package/references/native/NATIVE-MERGE-NOTICE.txt +15 -0
  50. package/references/persistent-client.mjs +30 -8
  51. package/references/persistent.md +47 -7
  52. package/references/recovery.md +58 -12
  53. package/references/research.md +25 -22
  54. package/references/setup.md +13 -3
  55. package/skill-bundle/insight-artifacts/SKILL.md +1 -1
  56. package/skill-bundle/insight-artifacts/references/recovery.md +58 -12
  57. package/skill-bundle/insight-binary/SKILL.md +1 -1
  58. package/skill-bundle/insight-capture/SKILL.md +1 -1
  59. package/skill-bundle/insight-cli/SKILL.md +1 -1
  60. package/skill-bundle/insight-cli/references/persistent-client.mjs +30 -8
  61. package/skill-bundle/insight-cli/references/persistent.md +47 -7
  62. package/skill-bundle/insight-cli/references/recovery.md +58 -12
  63. package/skill-bundle/insight-cli/references/setup.md +13 -3
  64. package/skill-bundle/insight-die/SKILL.md +1 -1
  65. package/skill-bundle/insight-dnspy/SKILL.md +1 -1
  66. package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
  67. package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
  68. package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
  69. package/skill-bundle/insight-frida/SKILL.md +1 -1
  70. package/skill-bundle/insight-ghidra/SKILL.md +8 -1
  71. package/skill-bundle/insight-ghidra/references/persistent-client.mjs +30 -8
  72. package/skill-bundle/insight-ghidra/references/persistent.md +47 -7
  73. package/skill-bundle/insight-ghidra/references/recovery.md +58 -12
  74. package/skill-bundle/insight-ghidra/references/research.md +25 -22
  75. package/skill-bundle/insight-ghidra/references/setup.md +13 -3
  76. package/skill-bundle/insight-ilspy/SKILL.md +1 -1
  77. package/skill-bundle/insight-interop/SKILL.md +1 -1
  78. package/skill-bundle/insight-lldb/SKILL.md +1 -1
  79. package/skill-bundle/insight-llvm/SKILL.md +1 -1
  80. package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
  81. package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
  82. package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
  83. package/skill-bundle/insight-overview/SKILL.md +1 -1
  84. package/skill-bundle/insight-procmon/SKILL.md +1 -1
  85. package/skill-bundle/insight-re/SKILL.md +1 -1
  86. package/skill-bundle/insight-re/references/persistent-client.mjs +30 -8
  87. package/skill-bundle/insight-re/references/persistent.md +47 -7
  88. package/skill-bundle/insight-re/references/recovery.md +58 -12
  89. package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
  90. package/skill-bundle/insight-strace/SKILL.md +1 -1
  91. package/skill-bundle/insight-tshark/SKILL.md +1 -1
  92. package/skill-bundle/insight-windbg/SKILL.md +1 -1
  93. package/skill-bundle/manifest.json +1 -1
  94. package/skills/insight-artifacts/SKILL.md +1 -1
  95. package/skills/insight-artifacts/references/recovery.md +58 -12
  96. package/skills/insight-binary/SKILL.md +1 -1
  97. package/skills/insight-capture/SKILL.md +1 -1
  98. package/skills/insight-die/SKILL.md +1 -1
  99. package/skills/insight-dnspy/SKILL.md +1 -1
  100. package/skills/insight-dotnet-dump/SKILL.md +1 -1
  101. package/skills/insight-dotnet-stack/SKILL.md +1 -1
  102. package/skills/insight-dotnet-trace/SKILL.md +1 -1
  103. package/skills/insight-frida/SKILL.md +1 -1
  104. package/skills/insight-ghidra/SKILL.md +8 -1
  105. package/skills/insight-ghidra/references/persistent-client.mjs +30 -8
  106. package/skills/insight-ghidra/references/persistent.md +47 -7
  107. package/skills/insight-ghidra/references/recovery.md +58 -12
  108. package/skills/insight-ghidra/references/research.md +25 -22
  109. package/skills/insight-ghidra/references/setup.md +13 -3
  110. package/skills/insight-ilspy/SKILL.md +1 -1
  111. package/skills/insight-interop/SKILL.md +1 -1
  112. package/skills/insight-lldb/SKILL.md +1 -1
  113. package/skills/insight-llvm/SKILL.md +1 -1
  114. package/skills/insight-managed-heap/SKILL.md +1 -1
  115. package/skills/insight-managed-metadata/SKILL.md +1 -1
  116. package/skills/insight-mitmproxy/SKILL.md +1 -1
  117. package/skills/insight-overview/SKILL.md +1 -1
  118. package/skills/insight-procmon/SKILL.md +1 -1
  119. package/skills/insight-re/SKILL.md +1 -1
  120. package/skills/insight-re/references/persistent-client.mjs +30 -8
  121. package/skills/insight-re/references/persistent.md +47 -7
  122. package/skills/insight-re/references/recovery.md +58 -12
  123. package/skills/insight-sevenzip/SKILL.md +1 -1
  124. package/skills/insight-strace/SKILL.md +1 -1
  125. package/skills/insight-tshark/SKILL.md +1 -1
  126. package/skills/insight-windbg/SKILL.md +1 -1
@@ -10,12 +10,24 @@ export class InsightCommandError extends Error {
10
10
  }
11
11
  export class InsightTransportError extends Error {
12
12
  dispatched;
13
- constructor(message, dispatched) {
13
+ termination;
14
+ constructor(message, dispatched, termination) {
14
15
  super(message);
15
16
  this.dispatched = dispatched;
17
+ this.termination = termination;
16
18
  this.name = 'InsightTransportError';
17
19
  }
18
20
  }
21
+ const transportDiagnostics = [
22
+ ['host_incompatible', 'Host build/protocol mismatch or closing.', 'Factory rejected the host build/protocol or it is closing.'],
23
+ ['host_incompatible', 'Host build mismatch.', 'Factory rejected the host build.'],
24
+ ['host_incompatible', 'Existing host build mismatch or closing.', 'Factory rejected the host build or it is closing.'],
25
+ ['host_closing', 'Host is closing; no command was sent.', 'Factory reports that the host is closing.'],
26
+ ['host_startup_timeout', 'CLI host startup timed out; no command was sent.', 'Factory host startup timed out.'],
27
+ ['invalid_rpc_launch', 'The --json-rpc transport must be started without a CLI command.', 'Start the JSON-RPC transport without CLI command or profile flags.'],
28
+ ['host_build_invalid', 'CLI host could not validate its build.', 'Factory could not validate the installed build.'],
29
+ ['ipc_disconnected', 'IPC invocation failed; command outcome may be unknown. No replay was attempted.', 'Factory lost the IPC invocation; the command outcome may be unknown.']
30
+ ];
19
31
  /** A thin client of Factory's existing stream, with no reconnect or command replay. */
20
32
  export async function connectInsight(options) {
21
33
  const child = spawn(options.executable, [...(options.arguments ?? []), '--json-rpc'], { cwd: options.cwd, env: options.env, stdio: ['pipe', 'pipe', 'pipe'], shell: false });
@@ -23,15 +35,23 @@ export async function connectInsight(options) {
23
35
  let buffer = '', bytes = 0, sequence = 0, accepting = true, failed = false, ended = false;
24
36
  let closePromise, tail = Promise.resolve();
25
37
  const pending = new Map();
26
- // Drain diagnostics without retaining arbitrary stderr, paths, tokens or unbounded output.
27
- child.stderr.resume();
38
+ // Classify fixed transport diagnostics through a bounded window; never expose raw stderr.
39
+ const diagnosticDecoder = new StringDecoder('utf8');
40
+ let diagnosticWindow = '', recognizedDiagnostic;
41
+ let termination;
42
+ child.stderr.on('data', (chunk) => {
43
+ const text = diagnosticWindow + diagnosticDecoder.write(chunk);
44
+ recognizedDiagnostic ??= transportDiagnostics.find(([, message]) => text.includes(message));
45
+ diagnosticWindow = text.slice(-512);
46
+ });
47
+ const transportError = (message, dispatched) => new InsightTransportError(message + (recognizedDiagnostic ? ' ' + recognizedDiagnostic[2] : '') + (termination ? ' (' + (termination.signal ? 'signal ' + termination.signal : 'exit ' + termination.exitCode) + ').' : ''), dispatched, termination);
28
48
  const fail = (message) => {
29
49
  if (failed)
30
50
  return;
31
51
  failed = true;
32
52
  accepting = false;
33
53
  for (const p of pending.values())
34
- p.reject(new InsightTransportError(message, true));
54
+ p.reject(transportError(message, true));
35
55
  pending.clear();
36
56
  child.stdin.destroy();
37
57
  child.stdout.destroy();
@@ -43,12 +63,14 @@ export async function connectInsight(options) {
43
63
  const exited = new Promise((resolve, reject) => {
44
64
  child.once('close', (code, signal) => {
45
65
  ended = true;
66
+ diagnosticWindow = '';
67
+ termination = Object.freeze({ exitCode: code, signal, ...(recognizedDiagnostic ? { reason: recognizedDiagnostic[0] } : {}) });
46
68
  if (code !== 0 || signal || pending.size || buffer.trim()) {
47
69
  fail('Persistent CLI closed without a complete acknowledged response.');
48
- reject(new InsightTransportError('Persistent CLI transport ended unexpectedly.', false));
70
+ reject(transportError('Persistent CLI transport ended unexpectedly.', false));
49
71
  }
50
72
  else if (failed)
51
- reject(new InsightTransportError('Persistent CLI transport failed.', false));
73
+ reject(transportError('Persistent CLI transport failed.', false));
52
74
  else
53
75
  resolve();
54
76
  });
@@ -97,11 +119,11 @@ export async function connectInsight(options) {
97
119
  if (!Array.isArray(argv) || argv.length > 512 || argv.some(x => typeof x !== 'string' || x.includes('\0')) || Buffer.byteLength(JSON.stringify(argv)) > 1024 ** 2)
98
120
  return Promise.reject(new TypeError('argv must be a bounded array of strings without NUL.'));
99
121
  if (!accepting || failed || ended)
100
- return Promise.reject(new InsightTransportError('Persistent CLI connection is closed.', false));
122
+ return Promise.reject(transportError('Persistent CLI connection is closed.', false));
101
123
  const args = [...argv];
102
124
  const request = tail.then(() => {
103
125
  if (failed || ended)
104
- throw new InsightTransportError('Persistent CLI connection was lost before dispatch.', false);
126
+ throw transportError('Persistent CLI connection was lost before dispatch.', false);
105
127
  const id = ++sequence;
106
128
  return new Promise((resolve, reject) => {
107
129
  pending.set(id, { resolve, reject });
@@ -10,8 +10,15 @@ The package exports a small stdio client, independent of the facade's eager impo
10
10
  import {connectInsight, InsightCommandError, InsightTransportError}
11
11
  from '@eyeauras/insight-cli/persistent';
12
12
 
13
- const cli = await connectInsight({executable: 'insight-cli', cwd: projectDirectory});
13
+ const cli = await connectInsight({
14
+ executable: nodeExecutable,
15
+ arguments: [installedBin],
16
+ cwd: projectDirectory
17
+ });
18
+ // If reporting READY, first await a discovery RPC on this connection.
19
+ await cli.execute(['--profile', profile, 'tools', 'list']);
14
20
  const result = await cli.execute([
21
+ '--profile', profile,
15
22
  'ghidra', 'functions', 'inspect', '--session', session, '--target', target,
16
23
  '--function', 'main', '--fields', 'entry_point', '--include-call-context', 'false'
17
24
  ]);
@@ -22,9 +29,35 @@ When package-name resolution is unavailable in the agent host, dynamically impor
22
29
  [`persistent-client.mjs`](persistent-client.mjs) beside this reference by its absolute file URL.
23
30
  It is generated from the same canonical package module. In a persistent REPL retain `cli` as a
24
31
  binding across tool invocations. A new Node process per query does not retain this connection.
25
- For an explicit installed bin, use `{executable: process.execPath, arguments: [installedBin], cwd}`.
26
- `env` optionally supplies the child environment. There is no shell or separate profile/config.
27
- Use existing `--profile` argv flags when selecting a profile explicitly.
32
+ Here `installedBin` is the absolute installed `dist/src/bin.js` path and `nodeExecutable` is
33
+ the Node executable used for this shared installation. Factory includes the Node version,
34
+ platform and architecture in its build identity. Use the same Node version and installed
35
+ artifact as the existing owner; an agent host's `process.execPath` or `PATH` can select a
36
+ different Node installation. `ipc-server status` reports the owner's build; a matching CLI
37
+ package version alone does not establish compatibility. A shared owner does not need to be
38
+ stopped merely to connect a client through the matching Node runtime. An idle owner may
39
+ exit and a later caller may start a new owner with a different Node installation: a previously
40
+ matching executable is not a permanent profile binding. Use one agreed Node runtime across
41
+ the shared clients, and inspect the current owner again after a compatibility failure.
42
+
43
+ The helper appends `--json-rpc` to its launch arguments. Factory requires that transport
44
+ flag to be the entire CLI invocation: `arguments` contains only the installed bin and any
45
+ Node runtime flags, with Node flags before the bin. Put `--profile <name>` in **every**
46
+ `execute(argv)` call as shown above. Adding profile flags to the frontend launch exits with
47
+ usage error before any request is dispatched. `env` optionally supplies the child environment.
48
+ There is no shell or separate profile/config.
49
+
50
+ A consumer that prints `READY` should first await an acknowledged RPC on that same connection,
51
+ as in the metadata call above. `connectInsight()` alone warrants a `SPAWNED` label. Discovery
52
+ confirms that the frontend reached Factory and returned a result; it does not start Ghidra or
53
+ prove native context readiness. Handle its failure before reporting readiness, preserve
54
+ `name`, `message`, `dispatched` and `termination` in the diagnostic receipt, and do not resend
55
+ research calls automatically. A later transport failure still requires ordinary outcome checks.
56
+
57
+ The helper code comes from the module actually imported by the consumer. Merging a newer
58
+ client into source does not update an older installed package or a long-lived imported module.
59
+ Check the installed version and loaded module when new diagnostic fields are absent; keep
60
+ original failure receipts rather than treating a new connection as recovery evidence.
28
61
 
29
62
  `execute(argv)` returns the CLI result unchanged, without a JSON-RPC envelope. Calls are queued
30
63
  in admission order. Native work can be long: await the original promise through the agent host's
@@ -33,6 +66,12 @@ reconnect/retry. Factory permissions, command validation, IDs and native budgets
33
66
 
34
67
  * `InsightCommandError.rpc` preserves the JSON-RPC error code, message and data, including typed
35
68
  CLI error results. A command failure leaves a healthy connection usable for the next command.
69
+ * `connectInsight()` confirms that the frontend process spawned; it does not perform a
70
+ readiness command or promise compatibility with the current Factory owner.
71
+ * `InsightTransportError.termination`, when the frontend has exited, reports its `exitCode`,
72
+ `signal`, and a recognized `reason` category when available. The error message
73
+ includes the fixed transport explanation and exit information, without raw stderr. These
74
+ observations diagnose transport failure; they do not establish a command's outcome.
36
75
  * `InsightTransportError.dispatched === true` means the request was handed to the stream and its
37
76
  acknowledgment is unavailable; it does not prove execution. Changing commands require their
38
77
  existing request-ID/status recovery. The client never resends them.
@@ -40,9 +79,10 @@ reconnect/retry. Factory permissions, command validation, IDs and native budgets
40
79
  after a transport failure. Reconnection is an explicit new connection, not an implicit replay.
41
80
 
42
81
  The client bounds each response line to four MiB, validates IDs and envelopes, and fails the
43
- connection on malformed, uncorrelated or oversized replies. It drains stderr without retaining
44
- arbitrary native diagnostics in memory. Read command-level diagnostics from their typed results
45
- and the existing profile diagnostic locations.
82
+ connection on malformed, uncorrelated or oversized replies. It classifies recognized Factory
83
+ transport errors from a small rolling stderr window, clears that window on process exit, and
84
+ exposes only fixed explanations and exit metadata. Read command-level diagnostics from their
85
+ typed results and the existing profile diagnostic locations.
46
86
 
47
87
  Finish owned Ghidra contexts with the normal scoped commands, following the project's shared
48
88
  server policy. Then `await cli.close()` drains already admitted requests and ends this stdio
@@ -1,9 +1,17 @@
1
1
  # Continue saved work
2
2
 
3
3
  Retain the session/target returned by initial open. Continue the tuple through
4
- `insight-cli ghidra open --session <id> --target <id> --json`. Saved private snapshots and
5
- pending scalar comparisons persist independently of a backend process. Reopening preserves
6
- private work; it does not silently receive a newer shared version.
4
+ `insight-cli ghidra open --session <id> --target <id> --json`. The native working project, checkout ID/base
5
+ and native change sets persist independently of the worker. Reopening uses that exact project
6
+ without importing a snapshot or silently receiving a newer shared version. Private workers
7
+ have no publisher credentials; service-only Update/check-in temporarily owns the stopped project.
8
+ Legacy detached contexts require explicit migration and remain retained.
9
+
10
+ If native `changes discard` loses its response, retry its original request ID or continue
11
+ the same session/target. Recovery requires a completed native discard journal and matching
12
+ new checkout identity/base and saved buffers, followed by independent server readback.
13
+ It does not repeat discard. An incomplete journal or mismatched checkout stays unknown;
14
+ preserve the project and any `.keep` file.
7
15
 
8
16
  First-import recovery uses the same scoped `ghidra open` or the original request ID/input.
9
17
  Import/analysis writes a private snapshot and completion receipt before any initial publication.
@@ -14,6 +22,14 @@ default one-hour wall-clock budget: after verifying that worker has stopped, use
14
22
  --initial-import-seconds <seconds>` (up to 86400), then continue the same session/target. No partial
15
23
  analysis checkpoint is implied. Terminal progress retains the last native message/counters; a new
16
24
  attempt archives the previous observation as `progress-history-<uuid>.json`. A completed snapshot is reused.
25
+ Progress heartbeat, phase and terminal observation writes are diagnostic. An I/O failure replacing
26
+ `progress.json` cannot invalidate a completed private import or its prepared snapshot receipt.
27
+ A transient failure is cleared after a later successful observation; persistent observation failure
28
+ is reported privately while authoritative import and publication checks still run. Initial intent,
29
+ previous-observation retention and native completion receipts keep their existing validation.
30
+ If an older build reports a progress-persistence failure after preparing its snapshot, continue the
31
+ original scope: its validated prepared receipt reuses that full saved analysis without reimport.
32
+
17
33
  Initial publication first creates a uniquely named staging object. A separate read-only process
18
34
  verifies its complete saved DB buffers before a conditional server move to the absent canonical
19
35
  path. It never checks in a new version of an existing canonical item. Lost promotion replies
@@ -31,12 +47,12 @@ independent readback. The old project, intent and original session/target remain
31
47
  ## Unresponsive headless backend
32
48
 
33
49
  Continue the same session/target with ordinary `ghidra open` or a research read. When the
34
- backend fails its identity preflight, the facade verifies the acknowledged private snapshot
35
- and independently authenticates the exact worker before retiring it and restoring that snapshot.
50
+ backend fails its identity preflight, the facade verifies the saved-view receipt
51
+ and independently authenticates the exact worker before retiring it and reopening the same native project.
36
52
  This automatic retirement is limited to headless contexts without uncertain mutations, active
37
53
  publication or a connected debugger. A failed health preflight is never permission to repeat a
38
54
  script, save or publication. Journals, original projects and acknowledged pending edits remain.
39
- Lifecycle diagnostics record `backend_unresponsive` followed by snapshot restoration.
55
+ Lifecycle diagnostics record `backend_unresponsive` followed by saved-project reopen.
40
56
 
41
57
  On macOS ARM64 the packaged read-only kernel helper checks the same-user process, executable,
42
58
  private root and digest of its unique context token without entering the JVM. It emits no token,
@@ -94,17 +110,17 @@ for adversarial same-JVM Java, and existing unknown script attempts are not recl
94
110
  their exception strings or an unchanged program snapshot. File/Python scripts retain their
95
111
  existing conservative recovery semantics.
96
112
 
97
- An unknown or partial effect retains its request intent, snapshots and native stage. Open the
113
+ An unknown or partial effect retains its request intent, receipts and native project. Open the
98
114
  same tuple to reconcile supported outcomes. A committed merge is verified against its recorded
99
115
  server version and complete saved buffers through independent read authority; it is never
100
116
  checked in again merely because its response was lost. Until verification succeeds, publication
101
117
  for this shared target is blocked across sessions. Saved private work remains retained.
102
118
 
103
119
  Scalar reconciliation observes and saves an already present effect; it does not execute the
104
- setter again. Supported structural/function edits retain a candidate snapshot after an incomplete
105
- response; continuation can verify every requested effect in that immutable snapshot and adopt it
106
- without replay. If the complete result cannot be established, the candidate and previous saved
107
- private view remain retained. An unproved program/script/external outcome remains unresolved. Preserve the profile
120
+ setter again. Supported structural/function edits can retain a saved-view receipt after an incomplete
121
+ response. For native contexts inspection must still match that receipt on the original saved
122
+ project; the receipt cannot recreate an older DB. Continuation adopts only fully verified effects
123
+ without replay. Unproved native work stays blocked and retained. An unproved program/script/external outcome remains unresolved. Preserve the profile
108
124
  storage and credential store. Do not delete another session's project, stop a process by guessed
109
125
  PID/port, or blindly repeat a script/external action to turn uncertainty into success.
110
126
 
@@ -117,7 +133,17 @@ as disconnected and retains saved program work. It does not recreate the old cur
117
133
  a previous prompt policy. Other unproved live UI effects remain retained until their outcome is
118
134
  established or the original process is known to have ended.
119
135
 
120
- ## Abandon an uncertain private program attempt
136
+ ## Native unknown attempts and legacy abandonment
137
+
138
+ For native contexts the snapshot-based `ghidra abandon` rollback is unsupported: replacing the
139
+ DB from a detached snapshot would lose native ancestry and could discard acknowledged private
140
+ work. Preserve the original project/journal and reconcile provable effects. Do not use discard,
141
+ GC, another request ID or a new server checkout as evidence that an unknown script did nothing.
142
+
143
+ The historical snapshot-based abandonment contract below applies only to its retained legacy
144
+ fixtures, not to native contexts admitted by the primary CLI.
145
+
146
+ ### Historical detached abandonment
121
147
 
122
148
  A post-mutation save timeout does not repeat the script or issue another save in the
123
149
  error handler. Status exposes the original request identity and retained phase/budget.
@@ -142,3 +168,23 @@ result. Earlier saved private edits remain pending. The original changing reques
142
168
  execute again. Abandoning never undoes external effects or establishes what an arbitrary
143
169
  script did; the acknowledgement explicitly accepts that uncertainty. Publication recovery,
144
170
  initial import, UI and debugger attempts use their own protocols and cannot use this command.
171
+
172
+ ## Explicit legacy migration
173
+
174
+ Legacy models require `ghidra migrate --target <target> --dry-run`, then the same
175
+ command without `--dry-run` (Destructive permission). Use `--all` for the profile.
176
+ Close selected workers first. Repeating migration resumes its retained journal; it never
177
+ retries an uncertain native check-in. Independent exact-version readback precedes checkout
178
+ release. Existing native models are unchanged. Detached snapshots with unproved native
179
+ ancestry/change sets are explicitly reported and retained, including private work.
180
+ A verified no-work failed open can be recovered without abandoning an arbitrary effect;
181
+ continue its original session/target with an ordinary new open request afterwards.
182
+
183
+ ## Reclaim redundant storage
184
+
185
+ `ghidra gc --dry-run` reports reclaimable and retained copies by category. `ghidra gc`
186
+ (Destructive permission) removes unreferenced snapshots, duplicate exports, stopped detached
187
+ projects and caches, and releases checkouts Ghidra itself verifies as unchanged. Close workers
188
+ first; it never stops one. Pending, conflicted, uncertain and unverified work is retained with
189
+ a reason. Repeat the command after an interruption. Collection is not recovery: resolve an
190
+ unknown operation first.
@@ -7,11 +7,10 @@ resolution, qualified heuristics, supported emulation ABIs and memory/signature
7
7
  separate outcome for each input. It does not publish. A partial result preserves completed saves;
8
8
  repeating the same request ID retrieves those outcomes without another pass.
9
9
 
10
- `ghidra changes discard --session <id> --target <id>` explicitly removes that context's pending
11
- program edits, retains its former private snapshot and restores its own opening base. It requires
12
- Destructive permission. Other sessions and the shared revision remain unchanged; use explicit
13
- refresh to receive a newer shared base afterward. Close a live debugger before discarding static
14
- edits. The saved trace remains separate from the program's opening snapshot.
10
+ `ghidra changes discard --session <id> --target <id>` requires Destructive permission.
11
+ For native contexts it retains Ghidra's `.keep` when work is dirty, releases the old checkout
12
+ and checks out the current server version in the same project. It does not publish. Close a
13
+ live debugger first. Legacy detached contexts require explicit migration and are retained.
15
14
 
16
15
  Open input with `insight-cli ghidra open ./client.exe --session new --json`. Store the returned
17
16
  `session` and `target` as the explicit scope for every later research call. Names are display
@@ -39,23 +38,25 @@ text) represents a null/absent comment. Successful edits are checked by readback
39
38
  `applied`. A later read sees the local result; another session remains independent. These edits
40
39
  do not publish themselves. Use `ghidra merge` to publish the selected context explicitly.
41
40
 
42
- Another session retains its view until `ghidra refresh`. Refresh receives safe shared changes and
43
- preserves local work. An overlapping field retains original/local/shared values; merge publishes
44
- nothing while any conflict remains. Resolve that field with its ordinary setter,
45
- `--resolve-conflict --expect-shared <observed value>` (or `--expect-shared-null` for an absent
46
- comment). A later shared change invalidates the decision and preserves your work.
47
-
48
- Types, signatures and memory edits are saved as complete private program state. They publish
49
- when the shared base is unchanged. After divergence, unproved structural categories remain a
50
- conflict: retain the old session, open a new session on the current target, and transfer the desired
51
- work through ordinary operations. A script is not replayed as a merge algorithm.
52
-
53
- The editing groups include types/categories/layouts, labels/references, properties/bookmarks,
54
- memory flags, functions/variables/tags and batch comments/documentation. Factory's `Destructive`
55
- gate covers deletion and replacement operations separately from ordinary Update. These broader
56
- edits currently use complete saved-state publication; their grouping does not grant scalar merge
57
- semantics. Boolean fields use explicit values; the no-return setter calls its flag `--non-returning`
58
- to keep it distinct from CLI negation syntax.
41
+ Another session retains its saved native checkout until `ghidra refresh`. The service stops the
42
+ worker and calls native Update on that same project: checkout identity survives, the base advances,
43
+ and local changes merge through Ghidra. Native conflicts reject the whole Update and retain the
44
+ original working copy/base. Status reports the native conflict description. The legacy scalar
45
+ `--resolve-conflict` option is unsupported for native decisions; no coordinator winner is invented.
46
+
47
+ Types, signatures, structures and other analysis edits use Ghidra's stock resolvers and native
48
+ checkout change sets. Divergence alone is not a category conflict. `ghidra merge` performs native
49
+ Update, then journaled check-in. Independent read-only history/exact-version buffer verification
50
+ precedes release/drop of the successful native project. Continued work receives a fresh checkout;
51
+ worker/owner restart before publication reopens the same project without packed-snapshot import.
52
+
53
+ Ordinary saves retain the native DB and lightweight saved-view receipts. Full packed exports are
54
+ for initial import and explicit consumers such as export, cross-program comparison and VT.
55
+ `receivedChanges` on native refresh counts a received program revision transition; pending scalar
56
+ and opaque operation records are diagnostic, not merge semantics. Memory layout and language
57
+ changes still require native exclusive access. The editing groups include types/categories/layouts,
58
+ labels/references, properties/bookmarks, memory flags, functions/variables/tags and documentation.
59
+ Factory's Destructive gate remains separate from ordinary Update.
59
60
 
60
61
  `ghidra scripts list` returns stable `installation:` and `context:` script IDs. Pass an exact ID to
61
62
  `ghidra scripts run --script-name <id>`, or source to `ghidra scripts run-inline --code <source>`.
@@ -95,6 +96,8 @@ with unpublished program edits. A truncated result indicates that another page m
95
96
  `ghidra status` verifies the selected tool and reports saved pending work. `ghidra save` retains
96
97
  private changes without publishing. `ghidra close` saves and releases the owned process; continue
97
98
  with the same open selectors to retain local work. Save/close accept the optional request ID.
99
+ Closing a verified unchanged checkout also releases it (`checkout: released`); the next open uses
100
+ the current shared revision. Any pending or unproved work keeps its checkout (`retained`).
98
101
 
99
102
  The `ghidra ui` commands use the same explicit scope. `cursor --type all` reads address, function,
100
103
  selection and focused program; headless facets return null with an explicit reason. `tools` starts
@@ -34,7 +34,17 @@ artifact provenance. Its pinned functionality catalog is from source
34
34
  `f4a9272e911466ed774c8cf73bc1adf1daef6009d895fda57aa0b28522fcdf32`.
35
35
  `mcpJar` optionally selects another copy of those exact verified bytes. Runtime startup needs no
36
36
  bridge/Factory source checkout or Python MCP bridge. Packaged native helper sources compile
37
- against the installed Ghidra/JDK.
37
+ against the installed Ghidra/JDK. Native merge additionally requires that installation's
38
+ unaltered Ghidra 12.1.2 source archives. Six upstream sources are hash-pinned before compiling
39
+ owned headless adapter classes; installed Ghidra JARs are not rewritten. License/provenance
40
+ is retained in `references/native/NATIVE-MERGE-NOTICE.txt` and the generated helper cache.
41
+
42
+ Fresh models use native checkouts/Update/check-in. Existing detached contexts and unmarked
43
+ legacy models are rejected for explicit migration; opening them does not auto-convert or clean
44
+ research. Do not mix an older snapshot writer with a native item. Use explicit `ghidra migrate --target <target> --dry-run`, then the same command
45
+ without `--dry-run` with Destructive permission; `--all` selects the whole profile.
46
+ Repeat execution to resume its journal. Detached private work without provable native
47
+ ancestry is explicitly refused and retained. See [migration](recovery.md#explicit-legacy-migration).
38
48
 
39
49
  Omitting `server` enables owned local startup. The facade creates profile storage, a private
40
50
  repository and distinct read-only/publisher accounts with random credentials in Factory's secret
@@ -62,7 +72,7 @@ Changing those runtime inputs requires stopping the old owner before continuing
62
72
 
63
73
  Native acceptance separates macOS GUI/LLDB workflows from selected headless Windows/Linux
64
74
  SDK, Version Tracking and FID/BSim workflows. Native Windows/Linux debugger/GUI acceptance
65
- remains deferred. The ordinary CI lane stays offline; disposable native CI is explicit.
75
+ remains deferred. CI stays offline and refuses native proofs.
66
76
 
67
77
  On macOS 15+ ARM64, `ghidra install` delivers an owned LLDB/Python debugger backend;
68
78
  OS debugger authorization remains required. Other host profiles need their supported debugger. Its
@@ -81,7 +91,7 @@ defaults to 120 (1–3600 seconds). Configure them with `ghidra budgets set
81
91
  This uses Factory ProfileStore without invalidating research or stopping native contexts.
82
92
  Active requests retain their original budget. Generic `profile set` remains guarded for
83
93
  profiles containing research; initial profile creation also accepts these fields. Both are execution policy, independent
84
- of immutable target/load identity. Save and packed snapshot export use the save budget;
94
+ of immutable target/load identity. Native save, Update/check-in, exact-version verification and explicit packed export use the save budget;
85
95
  discovery and ordinary HTTP queries keep their 30-second budget. Each native request has
86
96
  its own budget, not a total command deadline. Cancellation remains independent.
87
97
 
@@ -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.5.7
6
+ # Insight Artifacts 0.6.0
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
@@ -1,9 +1,17 @@
1
1
  # Continue saved work
2
2
 
3
3
  Retain the session/target returned by initial open. Continue the tuple through
4
- `insight-cli ghidra open --session <id> --target <id> --json`. Saved private snapshots and
5
- pending scalar comparisons persist independently of a backend process. Reopening preserves
6
- private work; it does not silently receive a newer shared version.
4
+ `insight-cli ghidra open --session <id> --target <id> --json`. The native working project, checkout ID/base
5
+ and native change sets persist independently of the worker. Reopening uses that exact project
6
+ without importing a snapshot or silently receiving a newer shared version. Private workers
7
+ have no publisher credentials; service-only Update/check-in temporarily owns the stopped project.
8
+ Legacy detached contexts require explicit migration and remain retained.
9
+
10
+ If native `changes discard` loses its response, retry its original request ID or continue
11
+ the same session/target. Recovery requires a completed native discard journal and matching
12
+ new checkout identity/base and saved buffers, followed by independent server readback.
13
+ It does not repeat discard. An incomplete journal or mismatched checkout stays unknown;
14
+ preserve the project and any `.keep` file.
7
15
 
8
16
  First-import recovery uses the same scoped `ghidra open` or the original request ID/input.
9
17
  Import/analysis writes a private snapshot and completion receipt before any initial publication.
@@ -14,6 +22,14 @@ default one-hour wall-clock budget: after verifying that worker has stopped, use
14
22
  --initial-import-seconds <seconds>` (up to 86400), then continue the same session/target. No partial
15
23
  analysis checkpoint is implied. Terminal progress retains the last native message/counters; a new
16
24
  attempt archives the previous observation as `progress-history-<uuid>.json`. A completed snapshot is reused.
25
+ Progress heartbeat, phase and terminal observation writes are diagnostic. An I/O failure replacing
26
+ `progress.json` cannot invalidate a completed private import or its prepared snapshot receipt.
27
+ A transient failure is cleared after a later successful observation; persistent observation failure
28
+ is reported privately while authoritative import and publication checks still run. Initial intent,
29
+ previous-observation retention and native completion receipts keep their existing validation.
30
+ If an older build reports a progress-persistence failure after preparing its snapshot, continue the
31
+ original scope: its validated prepared receipt reuses that full saved analysis without reimport.
32
+
17
33
  Initial publication first creates a uniquely named staging object. A separate read-only process
18
34
  verifies its complete saved DB buffers before a conditional server move to the absent canonical
19
35
  path. It never checks in a new version of an existing canonical item. Lost promotion replies
@@ -31,12 +47,12 @@ independent readback. The old project, intent and original session/target remain
31
47
  ## Unresponsive headless backend
32
48
 
33
49
  Continue the same session/target with ordinary `ghidra open` or a research read. When the
34
- backend fails its identity preflight, the facade verifies the acknowledged private snapshot
35
- and independently authenticates the exact worker before retiring it and restoring that snapshot.
50
+ backend fails its identity preflight, the facade verifies the saved-view receipt
51
+ and independently authenticates the exact worker before retiring it and reopening the same native project.
36
52
  This automatic retirement is limited to headless contexts without uncertain mutations, active
37
53
  publication or a connected debugger. A failed health preflight is never permission to repeat a
38
54
  script, save or publication. Journals, original projects and acknowledged pending edits remain.
39
- Lifecycle diagnostics record `backend_unresponsive` followed by snapshot restoration.
55
+ Lifecycle diagnostics record `backend_unresponsive` followed by saved-project reopen.
40
56
 
41
57
  On macOS ARM64 the packaged read-only kernel helper checks the same-user process, executable,
42
58
  private root and digest of its unique context token without entering the JVM. It emits no token,
@@ -94,17 +110,17 @@ for adversarial same-JVM Java, and existing unknown script attempts are not recl
94
110
  their exception strings or an unchanged program snapshot. File/Python scripts retain their
95
111
  existing conservative recovery semantics.
96
112
 
97
- An unknown or partial effect retains its request intent, snapshots and native stage. Open the
113
+ An unknown or partial effect retains its request intent, receipts and native project. Open the
98
114
  same tuple to reconcile supported outcomes. A committed merge is verified against its recorded
99
115
  server version and complete saved buffers through independent read authority; it is never
100
116
  checked in again merely because its response was lost. Until verification succeeds, publication
101
117
  for this shared target is blocked across sessions. Saved private work remains retained.
102
118
 
103
119
  Scalar reconciliation observes and saves an already present effect; it does not execute the
104
- setter again. Supported structural/function edits retain a candidate snapshot after an incomplete
105
- response; continuation can verify every requested effect in that immutable snapshot and adopt it
106
- without replay. If the complete result cannot be established, the candidate and previous saved
107
- private view remain retained. An unproved program/script/external outcome remains unresolved. Preserve the profile
120
+ setter again. Supported structural/function edits can retain a saved-view receipt after an incomplete
121
+ response. For native contexts inspection must still match that receipt on the original saved
122
+ project; the receipt cannot recreate an older DB. Continuation adopts only fully verified effects
123
+ without replay. Unproved native work stays blocked and retained. An unproved program/script/external outcome remains unresolved. Preserve the profile
108
124
  storage and credential store. Do not delete another session's project, stop a process by guessed
109
125
  PID/port, or blindly repeat a script/external action to turn uncertainty into success.
110
126
 
@@ -117,7 +133,17 @@ as disconnected and retains saved program work. It does not recreate the old cur
117
133
  a previous prompt policy. Other unproved live UI effects remain retained until their outcome is
118
134
  established or the original process is known to have ended.
119
135
 
120
- ## Abandon an uncertain private program attempt
136
+ ## Native unknown attempts and legacy abandonment
137
+
138
+ For native contexts the snapshot-based `ghidra abandon` rollback is unsupported: replacing the
139
+ DB from a detached snapshot would lose native ancestry and could discard acknowledged private
140
+ work. Preserve the original project/journal and reconcile provable effects. Do not use discard,
141
+ GC, another request ID or a new server checkout as evidence that an unknown script did nothing.
142
+
143
+ The historical snapshot-based abandonment contract below applies only to its retained legacy
144
+ fixtures, not to native contexts admitted by the primary CLI.
145
+
146
+ ### Historical detached abandonment
121
147
 
122
148
  A post-mutation save timeout does not repeat the script or issue another save in the
123
149
  error handler. Status exposes the original request identity and retained phase/budget.
@@ -142,3 +168,23 @@ result. Earlier saved private edits remain pending. The original changing reques
142
168
  execute again. Abandoning never undoes external effects or establishes what an arbitrary
143
169
  script did; the acknowledgement explicitly accepts that uncertainty. Publication recovery,
144
170
  initial import, UI and debugger attempts use their own protocols and cannot use this command.
171
+
172
+ ## Explicit legacy migration
173
+
174
+ Legacy models require `ghidra migrate --target <target> --dry-run`, then the same
175
+ command without `--dry-run` (Destructive permission). Use `--all` for the profile.
176
+ Close selected workers first. Repeating migration resumes its retained journal; it never
177
+ retries an uncertain native check-in. Independent exact-version readback precedes checkout
178
+ release. Existing native models are unchanged. Detached snapshots with unproved native
179
+ ancestry/change sets are explicitly reported and retained, including private work.
180
+ A verified no-work failed open can be recovered without abandoning an arbitrary effect;
181
+ continue its original session/target with an ordinary new open request afterwards.
182
+
183
+ ## Reclaim redundant storage
184
+
185
+ `ghidra gc --dry-run` reports reclaimable and retained copies by category. `ghidra gc`
186
+ (Destructive permission) removes unreferenced snapshots, duplicate exports, stopped detached
187
+ projects and caches, and releases checkouts Ghidra itself verifies as unchanged. Close workers
188
+ first; it never stops one. Pending, conflicted, uncertain and unverified work is retained with
189
+ a reason. Repeat the command after an interruption. Collection is not recovery: resolve an
190
+ unknown operation first.
@@ -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.5.7
6
+ # Insight Binary 0.6.0
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
@@ -3,7 +3,7 @@ name: insight-capture
3
3
  description: Capture one explicitly authorized native program run, exact stdout/stderr and declared file snapshots through insight-cli capture, then inspect or compare retained reports without replay. Use for controlled input/output research, preserving original files and interrupted or unknown outcomes.
4
4
  ---
5
5
 
6
- # Insight Capture 0.5.7
6
+ # Insight Capture 0.6.0
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
@@ -3,7 +3,7 @@ name: insight-cli
3
3
  description: Choose and prepare reverse-engineering capabilities from the insight-cli toolbox for binary, managed-code and runtime investigations. Use to discover the appropriate tool or its packaged skill before installing native runtimes.
4
4
  ---
5
5
 
6
- # insight-cli 0.5.7
6
+ # insight-cli 0.6.0
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