@eyeauras/insight-cli 0.6.3 → 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 (103) 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 +32 -8
  5. package/dist/src/contexts.js +532 -92
  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/lifecycle.d.ts +2 -0
  12. package/dist/src/lifecycle.js +49 -2
  13. package/dist/src/native-merge-patches.js +20 -2
  14. package/dist/src/research.d.ts +14 -2
  15. package/dist/src/research.js +31 -4
  16. package/dist/src/storage-gc.js +244 -44
  17. package/dist/src/tool-runtime/run.js +24 -11
  18. package/dist/src/tool-runtime/supervisor.js +51 -9
  19. package/dist/src/workspace.d.ts +47 -1
  20. package/dist/src/workspace.js +128 -13
  21. package/package.json +1 -1
  22. package/references/agent-setup.md +11 -3
  23. package/references/debugger.md +5 -3
  24. package/references/extensions-and-sync.md +7 -6
  25. package/references/managed-runtime.md +4 -3
  26. package/references/native/InsightNativeCheckout.java +203 -16
  27. package/references/native/NATIVE-MERGE-NOTICE.txt +5 -1
  28. package/references/native-workflows.md +5 -3
  29. package/references/query-semantics.md +3 -2
  30. package/references/recovery.md +6 -0
  31. package/references/setup.md +9 -2
  32. package/skill-bundle/insight-artifacts/SKILL.md +1 -1
  33. package/skill-bundle/insight-artifacts/references/recovery.md +6 -0
  34. package/skill-bundle/insight-binary/SKILL.md +1 -1
  35. package/skill-bundle/insight-capture/SKILL.md +1 -1
  36. package/skill-bundle/insight-cli/SKILL.md +9 -7
  37. package/skill-bundle/insight-cli/references/agent-setup.md +11 -3
  38. package/skill-bundle/insight-cli/references/managed-runtime.md +4 -3
  39. package/skill-bundle/insight-cli/references/recovery.md +6 -0
  40. package/skill-bundle/insight-cli/references/setup.md +9 -2
  41. package/skill-bundle/insight-die/SKILL.md +1 -1
  42. package/skill-bundle/insight-dnspy/SKILL.md +1 -1
  43. package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
  44. package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
  45. package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
  46. package/skill-bundle/insight-frida/SKILL.md +1 -1
  47. package/skill-bundle/insight-ghidra/SKILL.md +4 -3
  48. package/skill-bundle/insight-ghidra/references/debugger.md +5 -3
  49. package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +7 -6
  50. package/skill-bundle/insight-ghidra/references/managed-runtime.md +4 -3
  51. package/skill-bundle/insight-ghidra/references/native-workflows.md +5 -3
  52. package/skill-bundle/insight-ghidra/references/query-semantics.md +3 -2
  53. package/skill-bundle/insight-ghidra/references/recovery.md +6 -0
  54. package/skill-bundle/insight-ghidra/references/setup.md +9 -2
  55. package/skill-bundle/insight-ilspy/SKILL.md +1 -1
  56. package/skill-bundle/insight-interop/SKILL.md +1 -1
  57. package/skill-bundle/insight-lldb/SKILL.md +1 -1
  58. package/skill-bundle/insight-llvm/SKILL.md +1 -1
  59. package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
  60. package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
  61. package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
  62. package/skill-bundle/insight-overview/SKILL.md +1 -1
  63. package/skill-bundle/insight-procmon/SKILL.md +1 -1
  64. package/skill-bundle/insight-re/SKILL.md +1 -1
  65. package/skill-bundle/insight-re/references/recovery.md +6 -0
  66. package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
  67. package/skill-bundle/insight-strace/SKILL.md +1 -1
  68. package/skill-bundle/insight-tshark/SKILL.md +1 -1
  69. package/skill-bundle/insight-windbg/SKILL.md +1 -1
  70. package/skill-bundle/manifest.json +1 -1
  71. package/skills/insight-artifacts/SKILL.md +1 -1
  72. package/skills/insight-artifacts/references/recovery.md +6 -0
  73. package/skills/insight-binary/SKILL.md +1 -1
  74. package/skills/insight-capture/SKILL.md +1 -1
  75. package/skills/insight-die/SKILL.md +1 -1
  76. package/skills/insight-dnspy/SKILL.md +1 -1
  77. package/skills/insight-dotnet-dump/SKILL.md +1 -1
  78. package/skills/insight-dotnet-stack/SKILL.md +1 -1
  79. package/skills/insight-dotnet-trace/SKILL.md +1 -1
  80. package/skills/insight-frida/SKILL.md +1 -1
  81. package/skills/insight-ghidra/SKILL.md +4 -3
  82. package/skills/insight-ghidra/references/debugger.md +5 -3
  83. package/skills/insight-ghidra/references/extensions-and-sync.md +7 -6
  84. package/skills/insight-ghidra/references/managed-runtime.md +4 -3
  85. package/skills/insight-ghidra/references/native-workflows.md +5 -3
  86. package/skills/insight-ghidra/references/query-semantics.md +3 -2
  87. package/skills/insight-ghidra/references/recovery.md +6 -0
  88. package/skills/insight-ghidra/references/setup.md +9 -2
  89. package/skills/insight-ilspy/SKILL.md +1 -1
  90. package/skills/insight-interop/SKILL.md +1 -1
  91. package/skills/insight-lldb/SKILL.md +1 -1
  92. package/skills/insight-llvm/SKILL.md +1 -1
  93. package/skills/insight-managed-heap/SKILL.md +1 -1
  94. package/skills/insight-managed-metadata/SKILL.md +1 -1
  95. package/skills/insight-mitmproxy/SKILL.md +1 -1
  96. package/skills/insight-overview/SKILL.md +1 -1
  97. package/skills/insight-procmon/SKILL.md +1 -1
  98. package/skills/insight-re/SKILL.md +1 -1
  99. package/skills/insight-re/references/recovery.md +6 -0
  100. package/skills/insight-sevenzip/SKILL.md +1 -1
  101. package/skills/insight-strace/SKILL.md +1 -1
  102. package/skills/insight-tshark/SKILL.md +1 -1
  103. package/skills/insight-windbg/SKILL.md +1 -1
@@ -62,6 +62,8 @@ export interface NativeCheckout {
62
62
  request: string;
63
63
  message: string;
64
64
  };
65
+ /** Saved buffers proved to hold no private work although Ghidra rewrote them on open; the release accepts only these. */
66
+ opened?: string;
65
67
  }
66
68
  export interface GhidraContext extends Scope {
67
69
  /** Internal storage key, never a caller's backend selector. */
@@ -139,6 +141,7 @@ export interface OpenReservation {
139
141
  }
140
142
  type ContextPatch = Partial<Pick<GhidraContext, 'state' | 'baseRevision' | 'baseSnapshot' | 'workingSnapshot' | 'viewEpoch' | 'scalars' | 'complexChanges' | 'debugger' | 'syncPolicy' | 'nativeCheckout'>>;
141
143
  /** Profile root state, deliberately separate from the earlier coordinator.sqlite journals. */
144
+ export declare const missingDiscardOperation = "ghidra.changes.discard-missing";
142
145
  export declare const legacyDiscardOperation = "ghidra.changes.discard-legacy";
143
146
  export declare class Workspace {
144
147
  readonly profile: string;
@@ -180,12 +183,22 @@ export declare class Workspace {
180
183
  * a native checkout, and exactly those non-applied rows stop owning evidence. Their own outcomes stay readable.
181
184
  */
182
185
  discardLegacy(scope: Scope, request: string, generation: number, result: Record<string, unknown>): unknown;
186
+ /** The same for a native checkout whose project is gone and whose server checkout was ended. */
187
+ discardMissing(scope: Scope, request: string, generation: number, result: Record<string, unknown>): unknown;
188
+ private giveUp;
183
189
  /** An abandoned or otherwise unknown terminal effect keeps all of its native evidence. */
184
190
  uncertainOutcome(scope: Scope): boolean;
185
191
  /** Receipt-only comparison; native state is verified separately before any release. */
186
192
  unchangedNative(context: GhidraContext): boolean;
193
+ /**
194
+ * Saved buffers hold no private work when they equal the shared base, or equal what Ghidra itself wrote when a
195
+ * worker opened a pristine checkout of that base. Equal bytes are the proof; what Ghidra rewrote is irrelevant.
196
+ */
197
+ unchangedBuffers(target: string, base: Record<string, unknown>, fingerprint: unknown): boolean;
198
+ /** Saved buffers of pristine checkouts of one shared version, as each was left by its worker's own open. */
199
+ openedReferences(target: string, base: Record<string, unknown>): Set<string>;
187
200
  /** Another context's unresolved operation may still need this checkout's private view. */
188
- checkoutReferenced(context: GhidraContext): boolean;
201
+ checkoutReferenced(context: GhidraContext, root?: string | undefined): boolean;
189
202
  /** Applied requests keep their results; their superseded before-images are not recovery inputs. */
190
203
  artifactRoots(): Set<string>;
191
204
  forgetArtifact(artifact: string): void;
@@ -233,8 +246,41 @@ export declare class Workspace {
233
246
  };
234
247
  finishPublication(publication: string, publishedRevision: number, result: unknown, sharedSnapshot?: Artifact): Publication;
235
248
  rejectPublication(publication: string, result: unknown): Publication;
249
+ /** Exactly proved native pre-call refusal: settle all journals together, retaining the private view. */
250
+ finishRefusedPublication(publication: string, observedRevision: number, sharedSnapshot: Artifact, result: unknown): Publication;
236
251
  publishedSince(target: string, revision: number): Publication[];
237
252
  saveContext(scope: Scope, expectedGeneration: number, patch: ContextPatch): GhidraContext;
253
+ /** Independent release readback and its no-publication request outcome become visible together. */
254
+ retainNativeDisposal(scope: Scope, generation: number, checkout: NativeCheckout, snapshot: Artifact, request?: string): {
255
+ session: string;
256
+ target: string;
257
+ state: "retained";
258
+ engine: "ghidra-native";
259
+ checkout: "retained";
260
+ retention: {
261
+ request?: string | undefined;
262
+ schema: 1;
263
+ source: "native-release-status";
264
+ checkout: {
265
+ state: "active";
266
+ schema: 1;
267
+ context: string;
268
+ root: string;
269
+ fileId: string;
270
+ checkoutId: number;
271
+ baseVersion: number;
272
+ origin: string;
273
+ repository: string;
274
+ path: string;
275
+ runtimeFingerprint: string;
276
+ conflict?: {
277
+ request: string;
278
+ message: string;
279
+ };
280
+ };
281
+ snapshot: Artifact;
282
+ };
283
+ };
238
284
  /** Terminal abandonment retains the previous outcome and saved view atomically. */
239
285
  abandonProgramRequest(scope: Scope, request: string, generation: number): {
240
286
  state: string;
@@ -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';
@@ -48,6 +48,7 @@ function page(limit, offset) {
48
48
  fail('invalid', 'Pagination requires a limit of 1–100 and a nonnegative offset.');
49
49
  }
50
50
  /** Profile root state, deliberately separate from the earlier coordinator.sqlite journals. */
51
+ export const missingDiscardOperation = 'ghidra.changes.discard-missing';
51
52
  export const legacyDiscardOperation = 'ghidra.changes.discard-legacy';
52
53
  export class Workspace {
53
54
  profile;
@@ -283,18 +284,29 @@ export class Workspace {
283
284
  * a native checkout, and exactly those non-applied rows stop owning evidence. Their own outcomes stay readable.
284
285
  */
285
286
  discardLegacy(scope, request, generation, result) {
287
+ return this.giveUp(scope, request, generation, result, legacyDiscardOperation);
288
+ }
289
+ /** The same for a native checkout whose project is gone and whose server checkout was ended. */
290
+ discardMissing(scope, request, generation, result) {
291
+ return this.giveUp(scope, request, generation, result, missingDiscardOperation);
292
+ }
293
+ giveUp(scope, request, generation, result, operation) {
286
294
  return this.transaction(() => {
287
295
  const context = this.context(scope), intent = this.request(request), model = this.model(scope.target);
288
- if (context.generation !== generation || context.nativeCheckout || this.activePublication(scope.target) || context.debugger?.connected || model.state !== 'ready' ||
289
- intent.context !== context.id || intent.operation !== legacyDiscardOperation || intent.state !== 'running')
290
- fail('blocked', 'Only an unchanged, stopped detached context can be discarded.');
296
+ const checkout = context.nativeCheckout, missing = operation === missingDiscardOperation;
297
+ if (context.generation !== generation || missing !== Boolean(checkout) || checkout?.state === 'dropped' || this.activePublication(scope.target) || context.debugger?.connected || model.state !== 'ready' ||
298
+ intent.context !== context.id || intent.operation !== operation || intent.state !== 'running')
299
+ fail('blocked', 'Only an unchanged, stopped context can be discarded.');
291
300
  for (const pending of this.unfinished(scope))
292
301
  if (pending.id !== request)
293
- this.writeRequest(pending.id, 'failed', { ...scope, state: 'discarded', reason: 'explicit_legacy_discard' });
302
+ this.writeRequest(pending.id, 'failed', { ...scope, state: 'discarded', reason: missing ? 'explicit_missing_discard' : 'explicit_legacy_discard' });
294
303
  for (const row of this.db.prepare("SELECT id,data FROM requests WHERE context=? AND state='failed'").all(context.id))
295
304
  this.db.prepare('UPDATE requests SET data=? WHERE id=?').run(bounded({ ...JSON.parse(String(row.data)), dropped: true }), String(row.id));
296
- this.writeContext(scope, generation, { state: 'stopped', workingSnapshot: undefined, baseSnapshot: undefined, baseRevision: undefined, debugger: undefined,
297
- scalars: [], complexChanges: [], viewEpoch: (context.viewEpoch ?? 0) + 1 });
305
+ this.writeContext(scope, generation, { state: 'stopped', workingSnapshot: undefined, baseSnapshot: undefined, baseRevision: undefined,
306
+ // Saved traces of a native context live outside its project.
307
+ ...(missing ? {} : { debugger: undefined }),
308
+ scalars: [], complexChanges: [], viewEpoch: (context.viewEpoch ?? 0) + 1,
309
+ ...(checkout ? { nativeCheckout: (({ conflict, ...rest }) => ({ ...rest, state: 'dropped' }))(checkout) } : {}) });
298
310
  return this.writeRequest(request, 'applied', result).result;
299
311
  });
300
312
  }
@@ -311,25 +323,67 @@ export class Workspace {
311
323
  return false;
312
324
  try {
313
325
  const [local, base] = [context.workingSnapshot, context.baseSnapshot].map(value => JSON.parse(readFileSync(this.artifacts.path(value), 'utf8')));
314
- return typeof local.fingerprint === 'string' && local.fingerprint === base.fingerprint;
326
+ return this.unchangedBuffers(context.target, base, local.fingerprint);
315
327
  }
316
328
  catch {
317
329
  return false;
318
330
  }
319
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
+ }
320
367
  /** Another context's unresolved operation may still need this checkout's private view. */
321
- checkoutReferenced(context) {
322
- const root = context.nativeCheckout?.root, seen = new Set();
368
+ checkoutReferenced(context, root = context.nativeCheckout?.root) {
369
+ const seen = new Set();
323
370
  if (!root)
324
371
  return false;
325
- 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;
326
376
  for (const match of String(row.data).matchAll(/native:([a-f0-9]{64})/g))
327
377
  seen.add(match[1]);
378
+ }
328
379
  for (const sha of seen)
329
380
  try {
330
381
  const value = JSON.parse(readFileSync(join(this.directory, 'artifacts', sha + '.json'), 'utf8'));
331
- if (value.source === 'checkout' && value.checkout?.root === root)
332
- 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
+ }
333
387
  }
334
388
  catch {
335
389
  return true;
@@ -590,6 +644,24 @@ export class Workspace {
590
644
  return next;
591
645
  });
592
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
+ }
593
665
  publishedSince(target, revision) {
594
666
  this.target(target);
595
667
  version(revision);
@@ -599,6 +671,49 @@ export class Workspace {
599
671
  saveContext(scope, expectedGeneration, patch) {
600
672
  return this.transaction(() => this.writeContext(scope, expectedGeneration, patch));
601
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
+ }
602
717
  /** Terminal abandonment retains the previous outcome and saved view atomically. */
603
718
  abandonProgramRequest(scope, request, generation) {
604
719
  return this.transaction(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eyeauras/insight-cli",
3
- "version": "0.6.3",
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