@eyeauras/insight-cli 0.5.8 → 0.6.1

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 (125) 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 +238 -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/InsightInitialImport.java +1 -1
  39. package/references/native/InsightNativeCheckout.java +214 -0
  40. package/references/native/InsightNativeFingerprint.java +53 -0
  41. package/references/native/InsightNativeMigration.java +155 -0
  42. package/references/native/InsightNativeRead.java +57 -0
  43. package/references/native/InsightNativeView.java +29 -0
  44. package/references/native/InsightOfflineAuthenticator.java +20 -0
  45. package/references/native/InsightSdkFiles.java +4 -0
  46. package/references/native/InsightSnapshotFields.java +17 -11
  47. package/references/native/InsightSnapshotInspect.java +4 -2
  48. package/references/native/NATIVE-MERGE-NOTICE.txt +15 -0
  49. package/references/persistent-client.mjs +30 -8
  50. package/references/persistent.md +47 -7
  51. package/references/recovery.md +50 -12
  52. package/references/research.md +25 -22
  53. package/references/setup.md +13 -3
  54. package/skill-bundle/insight-artifacts/SKILL.md +1 -1
  55. package/skill-bundle/insight-artifacts/references/recovery.md +50 -12
  56. package/skill-bundle/insight-binary/SKILL.md +1 -1
  57. package/skill-bundle/insight-capture/SKILL.md +1 -1
  58. package/skill-bundle/insight-cli/SKILL.md +1 -1
  59. package/skill-bundle/insight-cli/references/persistent-client.mjs +30 -8
  60. package/skill-bundle/insight-cli/references/persistent.md +47 -7
  61. package/skill-bundle/insight-cli/references/recovery.md +50 -12
  62. package/skill-bundle/insight-cli/references/setup.md +13 -3
  63. package/skill-bundle/insight-die/SKILL.md +1 -1
  64. package/skill-bundle/insight-dnspy/SKILL.md +1 -1
  65. package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
  66. package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
  67. package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
  68. package/skill-bundle/insight-frida/SKILL.md +1 -1
  69. package/skill-bundle/insight-ghidra/SKILL.md +8 -1
  70. package/skill-bundle/insight-ghidra/references/persistent-client.mjs +30 -8
  71. package/skill-bundle/insight-ghidra/references/persistent.md +47 -7
  72. package/skill-bundle/insight-ghidra/references/recovery.md +50 -12
  73. package/skill-bundle/insight-ghidra/references/research.md +25 -22
  74. package/skill-bundle/insight-ghidra/references/setup.md +13 -3
  75. package/skill-bundle/insight-ilspy/SKILL.md +1 -1
  76. package/skill-bundle/insight-interop/SKILL.md +1 -1
  77. package/skill-bundle/insight-lldb/SKILL.md +1 -1
  78. package/skill-bundle/insight-llvm/SKILL.md +1 -1
  79. package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
  80. package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
  81. package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
  82. package/skill-bundle/insight-overview/SKILL.md +1 -1
  83. package/skill-bundle/insight-procmon/SKILL.md +1 -1
  84. package/skill-bundle/insight-re/SKILL.md +1 -1
  85. package/skill-bundle/insight-re/references/persistent-client.mjs +30 -8
  86. package/skill-bundle/insight-re/references/persistent.md +47 -7
  87. package/skill-bundle/insight-re/references/recovery.md +50 -12
  88. package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
  89. package/skill-bundle/insight-strace/SKILL.md +1 -1
  90. package/skill-bundle/insight-tshark/SKILL.md +1 -1
  91. package/skill-bundle/insight-windbg/SKILL.md +1 -1
  92. package/skill-bundle/manifest.json +1 -1
  93. package/skills/insight-artifacts/SKILL.md +1 -1
  94. package/skills/insight-artifacts/references/recovery.md +50 -12
  95. package/skills/insight-binary/SKILL.md +1 -1
  96. package/skills/insight-capture/SKILL.md +1 -1
  97. package/skills/insight-die/SKILL.md +1 -1
  98. package/skills/insight-dnspy/SKILL.md +1 -1
  99. package/skills/insight-dotnet-dump/SKILL.md +1 -1
  100. package/skills/insight-dotnet-stack/SKILL.md +1 -1
  101. package/skills/insight-dotnet-trace/SKILL.md +1 -1
  102. package/skills/insight-frida/SKILL.md +1 -1
  103. package/skills/insight-ghidra/SKILL.md +8 -1
  104. package/skills/insight-ghidra/references/persistent-client.mjs +30 -8
  105. package/skills/insight-ghidra/references/persistent.md +47 -7
  106. package/skills/insight-ghidra/references/recovery.md +50 -12
  107. package/skills/insight-ghidra/references/research.md +25 -22
  108. package/skills/insight-ghidra/references/setup.md +13 -3
  109. package/skills/insight-ilspy/SKILL.md +1 -1
  110. package/skills/insight-interop/SKILL.md +1 -1
  111. package/skills/insight-lldb/SKILL.md +1 -1
  112. package/skills/insight-llvm/SKILL.md +1 -1
  113. package/skills/insight-managed-heap/SKILL.md +1 -1
  114. package/skills/insight-managed-metadata/SKILL.md +1 -1
  115. package/skills/insight-mitmproxy/SKILL.md +1 -1
  116. package/skills/insight-overview/SKILL.md +1 -1
  117. package/skills/insight-procmon/SKILL.md +1 -1
  118. package/skills/insight-re/SKILL.md +1 -1
  119. package/skills/insight-re/references/persistent-client.mjs +30 -8
  120. package/skills/insight-re/references/persistent.md +47 -7
  121. package/skills/insight-re/references/recovery.md +50 -12
  122. package/skills/insight-sevenzip/SKILL.md +1 -1
  123. package/skills/insight-strace/SKILL.md +1 -1
  124. package/skills/insight-tshark/SKILL.md +1 -1
  125. package/skills/insight-windbg/SKILL.md +1 -1
@@ -1 +1 @@
1
- {"version":1,"artifact":"cd902cbafc843ffbe560de7a03e6a9762e9156acc38a8bc89cd566337ecd3dda"}
1
+ {"version":1,"artifact":"1bbd3adadae00d9157919b14d05601e910962ed6b99358000530c395974e6a6e"}
package/SKILL.md CHANGED
@@ -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.8
6
+ # insight-cli 0.6.1
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,4 +1,4 @@
1
- export type ArtifactKind = 'input' | 'snapshot';
1
+ export type ArtifactKind = 'input' | 'snapshot' | 'native';
2
2
  export interface Artifact {
3
3
  id: string;
4
4
  kind: ArtifactKind;
@@ -11,11 +11,11 @@ export class Artifacts {
11
11
  this.directory = directory;
12
12
  }
13
13
  path(value) {
14
- if (!['input', 'snapshot'].includes(value.kind) || !/^[a-f0-9]{64}$/.test(value.sha256) ||
14
+ if (!['input', 'snapshot', 'native'].includes(value.kind) || !/^[a-f0-9]{64}$/.test(value.sha256) ||
15
15
  value.id !== `${value.kind}:${value.sha256}` || !Number.isSafeInteger(value.size) ||
16
16
  value.size < 1 || value.size > maximumBytes)
17
17
  fail('artifact', 'Saved artifact reference is malformed.');
18
- return join(this.directory, 'artifacts', `${value.sha256}.${value.kind === 'snapshot' ? 'gzf' : 'bin'}`);
18
+ return join(this.directory, 'artifacts', `${value.sha256}.${value.kind === 'snapshot' ? 'gzf' : value.kind === 'native' ? 'json' : 'bin'}`);
19
19
  }
20
20
  async ownedDirectory() {
21
21
  const directory = join(this.directory, 'artifacts');
@@ -63,7 +63,7 @@ export class Artifacts {
63
63
  }
64
64
  }
65
65
  async capture(source, kind) {
66
- if (!['input', 'snapshot'].includes(kind))
66
+ if (!['input', 'snapshot', 'native'].includes(kind))
67
67
  fail('artifact', 'Unsupported artifact kind.');
68
68
  const directory = await this.ownedDirectory();
69
69
  const temporary = join(directory, 'pending-' + randomUUID());
package/dist/src/cli.js CHANGED
@@ -3,6 +3,7 @@ import { captureCommands } from './capture.js';
3
3
  import { binaryCommands } from './binary.js';
4
4
  import { skillCommand, toolboxCommands } from './toolbox.js';
5
5
  import { listProcesses } from './tool-runtime/supervisor.js';
6
+ import { migrationProcessBlockers } from './legacy-migration.js';
6
7
  import { diagnosticsCommands } from './dotnet-diagnostics.js';
7
8
  import { fridaCommands } from './frida.js';
8
9
  import { mitmproxyCommands } from './mitmproxy.js';
@@ -64,6 +65,7 @@ class Owner {
64
65
  storage;
65
66
  profiles = new Map();
66
67
  runtimeChanging = new Set();
68
+ openSequence = 0;
67
69
  async runtime(c, action, quiescent = true) {
68
70
  const directory = c.appArguments.AppDataDirectory;
69
71
  if (this.runtimeChanging.has(directory))
@@ -123,6 +125,55 @@ class Owner {
123
125
  throw new CliError('Automatic synchronization requires the current Factory Update permission.', { code: 'permission.denied', next: [['permissions', 'grant', 'Update']] });
124
126
  }), administration: new Administration(profile.workspace, backend, profile.tasks), lifecycle: new Lifecycle(profile.workspace, research, backend), projects: new Projects(profile.workspace, backend, research, profile.tasks), sdkFiles: new SdkFiles(profile.workspace, research, backend), tracking: new VersionTracking(profile.workspace, research, backend, profile.tasks), ui: new UserInterface(profile.workspace, research, backend), debugger: new Debugger(profile.workspace, research, backend), archive: new Archive(profile.workspace, research, backend, c), backend };
125
127
  }
128
+ async openCommand(c, action) {
129
+ const selected = this.selected(c), tasks = this.profiles.get(c.appArguments.AppDataDirectory).tasks;
130
+ // Register before the first await, including import before a context/task exists.
131
+ const key = 'open-command:' + ++this.openSequence, task = Promise.resolve().then(() => action(selected));
132
+ tasks.set(key, task);
133
+ try {
134
+ return await task;
135
+ }
136
+ finally {
137
+ tasks.delete(key);
138
+ }
139
+ }
140
+ migrate(c, target, dryRun) {
141
+ return this.maintain(c, 'migration', dryRun, async (backend) => {
142
+ if (!backend.migrate)
143
+ fail('unsupported', 'The selected backend cannot migrate native Ghidra models.');
144
+ return backend.migrate(target, dryRun);
145
+ });
146
+ }
147
+ collect(c, dryRun) {
148
+ return this.maintain(c, 'garbage collection', dryRun, async (backend) => {
149
+ if (!backend.collect)
150
+ fail('unsupported', 'The selected backend cannot collect retained storage.');
151
+ return backend.collect(dryRun);
152
+ });
153
+ }
154
+ /** Exclusive maintenance: no research task, native worker or uncertain helper may overlap it. */
155
+ async maintain(c, name, dryRun, action) {
156
+ if (!dryRun) {
157
+ const store = this.options.runtime?.profileStore ?? new ProfileStore({ applicationId: c.appArguments.AppName, appArguments: c.appArguments });
158
+ if (!(await store.getPermissions(c.profile.name))?.includes('Destructive'))
159
+ throw new CliError('Explicit Ghidra ' + name + ' requires Destructive permission.', { code: 'permission.denied', next: [['permissions', 'grant', 'Destructive']] });
160
+ }
161
+ const selected = this.selected(c), profile = this.profiles.get(c.appArguments.AppDataDirectory);
162
+ if (profile.tasks.size)
163
+ fail('busy', 'Finish research operations before ' + name + '.');
164
+ this.runtimeChanging.add(c.appArguments.AppDataDirectory);
165
+ try {
166
+ // A missing private-worker receipt does not prove an interrupted native helper stopped.
167
+ const helpers = await migrationProcessBlockers(c.appArguments.AppDataDirectory);
168
+ const workers = (await runtimeProcesses(analysisDirectory(c))).filter(p => p.kind !== 'server');
169
+ if (helpers.length || workers.length)
170
+ fail('busy', 'Stop or reconcile retained Ghidra workers and native helpers before ' + name + '; no takeover is performed.', { helpers, workers });
171
+ return await action(await selected.backend());
172
+ }
173
+ finally {
174
+ this.runtimeChanging.delete(c.appArguments.AppDataDirectory);
175
+ }
176
+ }
126
177
  async invalidateProfile(app) {
127
178
  const directory = app.AppDataDirectory, profile = this.profiles.get(directory);
128
179
  if (this.storage?.busy(directory))
@@ -172,7 +223,7 @@ const scoped = [
172
223
  ];
173
224
  const at = { flags: '--address <address>', description: 'Explicit hexadecimal address or space:address', required: true };
174
225
  const request = { flags: '--request-id <id>', description: 'Retrieve the same changing intent after a lost response' };
175
- const resolveOptions = [{ flags: '--resolve-conflict', description: 'Resolve the existing field against an explicitly observed shared value' },
226
+ const resolveOptions = [{ flags: '--resolve-conflict', description: 'Legacy scalar resolution only; native conflicts require Ghidra decisions' },
176
227
  { flags: '--expect-shared <value>', description: 'Shared value used for this resolution' },
177
228
  { flags: '--expect-shared-null', description: 'Expect the shared comment to be absent' }];
178
229
  function resolution(options) {
@@ -385,6 +436,12 @@ export function createDefinition(options = {}) {
385
436
  }, { permission: Permission.ReadOnly, options: [{ flags: '--target <id>', description: 'Inspect one target context' }, ...paged] }),
386
437
  ]),
387
438
  command('ghidra', 'Research through an isolated saved context', [
439
+ command('migrate', 'Explicitly migrate retained legacy models; repeat to resume', ({ options: o }, c) => {
440
+ if (Boolean(o.target) === Boolean(o.all))
441
+ fail('invalid', 'Select exactly one --target or --all.');
442
+ return owner.migrate(c, o.target === undefined ? undefined : id(o.target), Boolean(o.dryRun));
443
+ }, { permission: Permission.ReadOnly, options: [{ flags: '--target <id>', description: 'Migrate one immutable target' }, { flags: '--all', description: 'Inspect or migrate every Ghidra target in this profile' }, { flags: '--dry-run', description: 'Inspect without checkout, check-in or context changes' }] }),
444
+ command('gc', 'Reclaim redundant copies: unreferenced snapshots, duplicate exports, stopped detached projects and unchanged checkouts', ({ options: o }, c) => owner.collect(c, Boolean(o.dryRun)), { permission: Permission.ReadOnly, options: [{ flags: '--dry-run', description: 'Report reclaimable and retained storage without changing it' }] }),
388
445
  command('progress', 'Read initial-model import/publication progress without starting Ghidra', async ({ options: o }, c) => {
389
446
  const selected = owner.selected(c), who = scope(o);
390
447
  selected.workspace.context(who);
@@ -411,20 +468,22 @@ export function createDefinition(options = {}) {
411
468
  command('open [input]', 'Start independent work or continue a context', async ({ args, options: o }, c) => {
412
469
  if (Boolean(args.input) === Boolean(o.target))
413
470
  fail('invalid', 'Supply exactly one input path or --target.');
414
- const selected = owner.selected(c), target = args.input ? (await selected.workspace.importTarget(resolve(c.cwd, text(args.input, 4096)))).id : id(o.target);
415
- let previous;
416
- try {
417
- previous = selected.workspace.model(target).settings;
418
- }
419
- catch (error) {
420
- if (!String(error.code).endsWith('.notFound'))
421
- throw error;
422
- }
423
- const settings = { ...previous, autoAnalyze: typeof o.analysis === 'boolean' ? o.analysis : previous?.autoAnalyze ?? false,
424
- ...(o.language ? { language: text(o.language) } : {}), ...(o.compilerSpec ? { compilerSpec: text(o.compilerSpec) } : {}),
425
- ...(o.imageBase ? { imageBase: text(o.imageBase) } : {}), ...(o.loader ? { loader: text(o.loader, 512) } : {}),
426
- ...(o.loaderOptions !== undefined ? { loaderOptions: object(parseDomainJson(text(o.loaderOptions, 16000))) } : {}) };
427
- return selected.research.open(target, text(o.session), settings, o.requestId === undefined ? undefined : id(o.requestId), mode(o.mode));
471
+ return owner.openCommand(c, async (selected) => {
472
+ const target = args.input ? (await selected.workspace.importTarget(resolve(c.cwd, text(args.input, 4096)))).id : id(o.target);
473
+ let previous;
474
+ try {
475
+ previous = selected.workspace.model(target).settings;
476
+ }
477
+ catch (error) {
478
+ if (!String(error.code).endsWith('.notFound'))
479
+ throw error;
480
+ }
481
+ const settings = { ...previous, autoAnalyze: typeof o.analysis === 'boolean' ? o.analysis : previous?.autoAnalyze ?? false,
482
+ ...(o.language ? { language: text(o.language) } : {}), ...(o.compilerSpec ? { compilerSpec: text(o.compilerSpec) } : {}),
483
+ ...(o.imageBase ? { imageBase: text(o.imageBase) } : {}), ...(o.loader ? { loader: text(o.loader, 512) } : {}),
484
+ ...(o.loaderOptions !== undefined ? { loaderOptions: object(parseDomainJson(text(o.loaderOptions, 16000))) } : {}) };
485
+ return selected.research.open(target, text(o.session), settings, o.requestId === undefined ? undefined : id(o.requestId), mode(o.mode));
486
+ });
428
487
  }, { permission: Permission.Update, options: [{ flags: '--session <id>', description: 'Use new for independent work, or an existing session', required: true },
429
488
  { flags: '--target <id>', description: 'Continue existing input instead of supplying a file' }, request,
430
489
  { flags: '--mode <mode>', description: 'Request headless or gui; continuation preserves current mode' },
@@ -2,7 +2,7 @@ import type { CommandContext } from '@eyeauras/cli-factory';
2
2
  import { type ChildProcess } from 'node:child_process';
3
3
  import { type NativeInputs } from './native-inputs.js';
4
4
  import { GhidraServer } from './server.js';
5
- import { Workspace, type Scope, type GhidraContext, type ScalarChange, type Publication, type DebuggerState } from './workspace.js';
5
+ import { Workspace, type Scope, type GhidraContext, type ScalarChange, type Publication, type DebuggerState, type NativeCheckout } from './workspace.js';
6
6
  import { type Artifact } from './artifacts.js';
7
7
  import { HttpBridge } from './transport.js';
8
8
  import type { SelectedTool } from './tool-runtime/installer.js';
@@ -39,6 +39,7 @@ export declare class GhidraContexts {
39
39
  private readonly modelTasks;
40
40
  private readonly ownedServer;
41
41
  private readonly capacity;
42
+ readonly nativeEngine: "native-checkout-v1";
42
43
  constructor(workspace: Workspace, inputs: NativeInputs, c: CommandContext, running?: Map<string, Running>, modelTasks?: Map<string, Promise<void>>, ownedServer?: GhidraServer, capacity?: {
43
44
  slots: Set<string>;
44
45
  inventory?: Promise<void>;
@@ -46,6 +47,22 @@ export declare class GhidraContexts {
46
47
  fork(c: CommandContext): GhidraContexts;
47
48
  private directory;
48
49
  private server;
50
+ migrate(target: string | undefined, dryRun: boolean): Promise<{
51
+ state: string;
52
+ dryRun: boolean;
53
+ items: (Record<string, unknown> | {
54
+ target: string;
55
+ state: string;
56
+ reason: string;
57
+ contexts: never[];
58
+ } | {
59
+ target: string;
60
+ state: string;
61
+ contexts: never[];
62
+ reason?: undefined;
63
+ })[];
64
+ retainedContexts: number;
65
+ }>;
49
66
  administration(operation: string, parameters: Record<string, unknown>): Promise<Record<string, unknown>>;
50
67
  sdkFile(operation: string, parameters: Record<string, unknown>): Promise<Record<string, unknown>>;
51
68
  private prepareRoot;
@@ -56,11 +73,107 @@ export declare class GhidraContexts {
56
73
  private retiredWorker;
57
74
  private debuggerReleased;
58
75
  private capture;
76
+ /** The captured artifact is the only retained copy of an export stage. */
77
+ private captureExport;
78
+ private nativeView;
79
+ private nativeReceipt;
80
+ private serverView;
81
+ private observeNativeShared;
82
+ private nativeOwner;
83
+ private nativeOperation;
59
84
  private shared;
60
85
  private retireLegacyBootstrap;
61
86
  private initialModel;
62
87
  private model;
63
88
  private privateCopy;
89
+ private createNative;
90
+ updateNative(scope: Scope, request: string): Promise<{
91
+ state: "conflict";
92
+ conflict: string;
93
+ revision: number;
94
+ snapshot?: undefined;
95
+ sharedSnapshot?: undefined;
96
+ receivedChanges?: undefined;
97
+ nativeMergeInvocations?: undefined;
98
+ } | {
99
+ state: "ready" | "empty";
100
+ revision: number;
101
+ snapshot: Artifact;
102
+ sharedSnapshot: Artifact;
103
+ receivedChanges: number;
104
+ nativeMergeInvocations: number;
105
+ conflict?: undefined;
106
+ }>;
107
+ private applyNativeUpdate;
108
+ recoverUpdate(scope: Scope, request: string): Promise<{
109
+ state: "conflict";
110
+ conflict: string;
111
+ revision: number;
112
+ snapshot?: undefined;
113
+ sharedSnapshot?: undefined;
114
+ receivedChanges?: undefined;
115
+ nativeMergeInvocations?: undefined;
116
+ } | {
117
+ state: "ready" | "empty";
118
+ revision: number;
119
+ snapshot: Artifact;
120
+ sharedSnapshot: Artifact;
121
+ receivedChanges: number;
122
+ nativeMergeInvocations: number;
123
+ conflict?: undefined;
124
+ } | {
125
+ state: "unknown";
126
+ }>;
127
+ publishNative(publication: Publication): Promise<{
128
+ state: "conflict";
129
+ applied: 0;
130
+ conflict: string;
131
+ revision?: undefined;
132
+ snapshot?: undefined;
133
+ } | {
134
+ state: "published";
135
+ revision: number;
136
+ snapshot: Artifact;
137
+ applied?: undefined;
138
+ conflict?: undefined;
139
+ }>;
140
+ dropNative(scope: Scope): Promise<void>;
141
+ finishEmptyNative(scope: Scope): Promise<void>;
142
+ /** Close and GC drop a working copy only when Ghidra itself reports no private change. */
143
+ releaseUnchanged(scope: Scope): Promise<boolean>;
144
+ /** A missing current receipt means no worker was ever started; any other missing receipt is unproved. */
145
+ private neverStartedOrClosed;
146
+ collect(dryRun: boolean): Promise<{
147
+ retained: {
148
+ path: string;
149
+ reason: string;
150
+ }[];
151
+ id?: `${string}-${string}-${string}-${string}-${string}` | undefined;
152
+ state: string;
153
+ dryRun: boolean;
154
+ bytes: number;
155
+ categories: Record<string, import("./storage-gc.js").Category>;
156
+ retainedCount: number;
157
+ }>;
158
+ recoverEmptyNative(scope: Scope, request: string): Promise<{
159
+ state: "unknown";
160
+ revision?: undefined;
161
+ } | {
162
+ state: "verified";
163
+ revision: number;
164
+ }>;
165
+ discardNative(scope: Scope, request: string): Promise<{
166
+ baseRevision: number;
167
+ retainedKeepFile: string;
168
+ }>;
169
+ recoverDiscardNative(scope: Scope, request: string, original: NativeCheckout): Promise<{
170
+ state: "unknown";
171
+ } | {
172
+ baseRevision: number;
173
+ retainedKeepFile: string;
174
+ state: "verified";
175
+ }>;
176
+ private applyNativeDiscard;
64
177
  open(scope: Scope, request?: string): Promise<GhidraContext>;
65
178
  private retireUnresponsive;
66
179
  private selected;
@@ -81,6 +194,8 @@ export declare class GhidraContexts {
81
194
  saved(scope: Scope): Promise<Artifact>;
82
195
  scripts(scope: Scope, filter: string, limit: number, offset: number): Promise<import("./scripts.js").ScriptPage>;
83
196
  inspect(snapshot: Artifact, parameters: Record<string, unknown>): Promise<Record<string, unknown>>;
197
+ /** Full exports are explicit consumers (cross-program/VT/export/archive), never save/reopen/publication. */
198
+ snapshotFile(snapshot: Artifact): Promise<string>;
84
199
  private removePeer;
85
200
  private reconcilePeers;
86
201
  private withPeer;
@@ -108,23 +223,18 @@ export declare class GhidraContexts {
108
223
  revision: number;
109
224
  snapshot: Artifact;
110
225
  }>;
226
+ private inspectNative;
111
227
  fields(snapshot: Artifact, changes: Pick<ScalarChange, 'address' | 'field'>[]): Promise<Record<string, {
112
228
  value: string | null;
113
229
  dependency: string;
114
230
  exists: boolean;
115
231
  }>>;
116
- private applyField;
117
- candidate(targetId: string, snapshot: Artifact, changes: ScalarChange[]): Promise<Artifact>;
118
- publish(publication: Publication): Promise<{
119
- state: 'published';
120
- revision: number;
121
- } | {
122
- state: 'conflict';
123
- applied: 0;
124
- }>;
232
+ /** Readback only: establishes an interrupted snapshot publication and never issues another check-in. */
233
+ private recoverLegacy;
125
234
  recover(publication: Publication): Promise<{
126
235
  state: 'verified';
127
236
  revision: number;
237
+ snapshot: Artifact;
128
238
  } | {
129
239
  state: 'unknown';
130
240
  }>;