@eyeauras/insight-cli 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli-package-build.json +1 -1
- package/SKILL.md +9 -7
- package/dist/src/cli.js +1 -1
- package/dist/src/contexts.d.ts +29 -8
- package/dist/src/contexts.js +455 -90
- package/dist/src/cross-peer.d.ts +20 -0
- package/dist/src/cross-peer.js +53 -0
- package/dist/src/debugger-results.d.ts +2 -1
- package/dist/src/debugger-results.js +9 -4
- package/dist/src/debugger.js +3 -2
- package/dist/src/native-merge-patches.js +20 -2
- package/dist/src/research.d.ts +10 -2
- package/dist/src/research.js +31 -4
- package/dist/src/storage-gc.js +244 -44
- package/dist/src/tool-runtime/run.js +24 -11
- package/dist/src/tool-runtime/supervisor.js +51 -9
- package/dist/src/workspace.d.ts +43 -1
- package/dist/src/workspace.js +110 -7
- package/package.json +1 -1
- package/references/agent-setup.md +11 -3
- package/references/debugger.md +5 -3
- package/references/extensions-and-sync.md +7 -6
- package/references/managed-runtime.md +4 -3
- package/references/native/InsightNativeCheckout.java +174 -15
- package/references/native/NATIVE-MERGE-NOTICE.txt +5 -1
- package/references/native-workflows.md +5 -3
- package/references/query-semantics.md +3 -2
- package/references/recovery.md +6 -0
- package/references/setup.md +9 -2
- package/skill-bundle/insight-artifacts/SKILL.md +1 -1
- package/skill-bundle/insight-artifacts/references/recovery.md +6 -0
- package/skill-bundle/insight-binary/SKILL.md +1 -1
- package/skill-bundle/insight-capture/SKILL.md +1 -1
- package/skill-bundle/insight-cli/SKILL.md +9 -7
- package/skill-bundle/insight-cli/references/agent-setup.md +11 -3
- package/skill-bundle/insight-cli/references/managed-runtime.md +4 -3
- package/skill-bundle/insight-cli/references/recovery.md +6 -0
- package/skill-bundle/insight-cli/references/setup.md +9 -2
- package/skill-bundle/insight-die/SKILL.md +1 -1
- package/skill-bundle/insight-dnspy/SKILL.md +1 -1
- package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
- package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
- package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
- package/skill-bundle/insight-frida/SKILL.md +1 -1
- package/skill-bundle/insight-ghidra/SKILL.md +4 -3
- package/skill-bundle/insight-ghidra/references/debugger.md +5 -3
- package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +7 -6
- package/skill-bundle/insight-ghidra/references/managed-runtime.md +4 -3
- package/skill-bundle/insight-ghidra/references/native-workflows.md +5 -3
- package/skill-bundle/insight-ghidra/references/query-semantics.md +3 -2
- package/skill-bundle/insight-ghidra/references/recovery.md +6 -0
- package/skill-bundle/insight-ghidra/references/setup.md +9 -2
- package/skill-bundle/insight-ilspy/SKILL.md +1 -1
- package/skill-bundle/insight-interop/SKILL.md +1 -1
- package/skill-bundle/insight-lldb/SKILL.md +1 -1
- package/skill-bundle/insight-llvm/SKILL.md +1 -1
- package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
- package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
- package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
- package/skill-bundle/insight-overview/SKILL.md +1 -1
- package/skill-bundle/insight-procmon/SKILL.md +1 -1
- package/skill-bundle/insight-re/SKILL.md +1 -1
- package/skill-bundle/insight-re/references/recovery.md +6 -0
- package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
- package/skill-bundle/insight-strace/SKILL.md +1 -1
- package/skill-bundle/insight-tshark/SKILL.md +1 -1
- package/skill-bundle/insight-windbg/SKILL.md +1 -1
- package/skill-bundle/manifest.json +1 -1
- package/skills/insight-artifacts/SKILL.md +1 -1
- package/skills/insight-artifacts/references/recovery.md +6 -0
- package/skills/insight-binary/SKILL.md +1 -1
- package/skills/insight-capture/SKILL.md +1 -1
- package/skills/insight-die/SKILL.md +1 -1
- package/skills/insight-dnspy/SKILL.md +1 -1
- package/skills/insight-dotnet-dump/SKILL.md +1 -1
- package/skills/insight-dotnet-stack/SKILL.md +1 -1
- package/skills/insight-dotnet-trace/SKILL.md +1 -1
- package/skills/insight-frida/SKILL.md +1 -1
- package/skills/insight-ghidra/SKILL.md +4 -3
- package/skills/insight-ghidra/references/debugger.md +5 -3
- package/skills/insight-ghidra/references/extensions-and-sync.md +7 -6
- package/skills/insight-ghidra/references/managed-runtime.md +4 -3
- package/skills/insight-ghidra/references/native-workflows.md +5 -3
- package/skills/insight-ghidra/references/query-semantics.md +3 -2
- package/skills/insight-ghidra/references/recovery.md +6 -0
- package/skills/insight-ghidra/references/setup.md +9 -2
- package/skills/insight-ilspy/SKILL.md +1 -1
- package/skills/insight-interop/SKILL.md +1 -1
- package/skills/insight-lldb/SKILL.md +1 -1
- package/skills/insight-llvm/SKILL.md +1 -1
- package/skills/insight-managed-heap/SKILL.md +1 -1
- package/skills/insight-managed-metadata/SKILL.md +1 -1
- package/skills/insight-mitmproxy/SKILL.md +1 -1
- package/skills/insight-overview/SKILL.md +1 -1
- package/skills/insight-procmon/SKILL.md +1 -1
- package/skills/insight-re/SKILL.md +1 -1
- package/skills/insight-re/references/recovery.md +6 -0
- package/skills/insight-sevenzip/SKILL.md +1 -1
- package/skills/insight-strace/SKILL.md +1 -1
- package/skills/insight-tshark/SKILL.md +1 -1
- package/skills/insight-windbg/SKILL.md +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface PeerOwner {
|
|
2
|
+
target: string;
|
|
3
|
+
context?: string;
|
|
4
|
+
}
|
|
5
|
+
interface PeerReceipt extends PeerOwner {
|
|
6
|
+
path: string;
|
|
7
|
+
state: 'preparing' | 'closed';
|
|
8
|
+
}
|
|
9
|
+
type PeerStage = {
|
|
10
|
+
folder: string;
|
|
11
|
+
reason: string;
|
|
12
|
+
} | {
|
|
13
|
+
folder: string;
|
|
14
|
+
receipt: PeerReceipt;
|
|
15
|
+
input?: string;
|
|
16
|
+
};
|
|
17
|
+
/** Only the generated input of an exactly owned stage is disposable; its receipt stays. */
|
|
18
|
+
export declare function peerStage(root: string, name: string, owner: PeerOwner): Promise<PeerStage>;
|
|
19
|
+
export declare function peerStages(root: string, owner: PeerOwner): Promise<PeerStage[]>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { lstat, readFile, readdir, realpath } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const peerName = /^__insight_peer_[a-f0-9]{32}$/;
|
|
4
|
+
const missing = (error) => error.code === 'ENOENT';
|
|
5
|
+
/** Only the generated input of an exactly owned stage is disposable; its receipt stays. */
|
|
6
|
+
export async function peerStage(root, name, owner) {
|
|
7
|
+
const parent = join(root, 'cross-peer'), folder = join(parent, name), keep = (reason) => ({ folder, reason });
|
|
8
|
+
if (!peerName.test(name))
|
|
9
|
+
return keep('Unrecognized cross-target stage.');
|
|
10
|
+
try {
|
|
11
|
+
const parentStat = await lstat(parent), stageStat = await lstat(folder);
|
|
12
|
+
if (parentStat.isSymbolicLink() || !parentStat.isDirectory() || stageStat.isSymbolicLink() || !stageStat.isDirectory() ||
|
|
13
|
+
await realpath(folder) !== join(await realpath(root), 'cross-peer', name))
|
|
14
|
+
return keep('Cross-target stage left its owned directory or is a link.');
|
|
15
|
+
let input;
|
|
16
|
+
for (const entry of await readdir(folder, { withFileTypes: true })) {
|
|
17
|
+
if (!['receipt.json', 'input.gzf'].includes(entry.name))
|
|
18
|
+
return keep('Cross-target stage holds unrecognized files.');
|
|
19
|
+
if (!entry.isFile())
|
|
20
|
+
return keep('Cross-target stage holds links or special entries.');
|
|
21
|
+
if (entry.name === 'input.gzf')
|
|
22
|
+
input = join(folder, entry.name);
|
|
23
|
+
}
|
|
24
|
+
const receipt = JSON.parse(await readFile(join(folder, 'receipt.json'), 'utf8'));
|
|
25
|
+
if (!receipt || typeof receipt !== 'object' || !owner.context || receipt.path !== '/' + name || receipt.target !== owner.target || receipt.context !== owner.context)
|
|
26
|
+
return keep('Cross-target cleanup receipt belongs to another context or is malformed.');
|
|
27
|
+
if (receipt.state !== 'closed' && receipt.state !== 'preparing')
|
|
28
|
+
return keep('Unknown cross-target cleanup stage.');
|
|
29
|
+
return { folder, receipt, ...(input ? { input } : {}) };
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (missing(error) || error instanceof SyntaxError)
|
|
33
|
+
return keep('Cross-target cleanup receipt or stage is missing or malformed.');
|
|
34
|
+
return keep('Cross-target stage could not be verified: ' + String(error.code ?? 'unavailable'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export async function peerStages(root, owner) {
|
|
38
|
+
const parent = join(root, 'cross-peer');
|
|
39
|
+
try {
|
|
40
|
+
const st = await lstat(parent);
|
|
41
|
+
if (st.isSymbolicLink() || !st.isDirectory())
|
|
42
|
+
return [{ folder: parent, reason: 'Cross-target stage inventory is a link or special entry.' }];
|
|
43
|
+
const stages = [];
|
|
44
|
+
for (const name of await readdir(parent))
|
|
45
|
+
stages.push(await peerStage(root, name, owner));
|
|
46
|
+
return stages;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (missing(error))
|
|
50
|
+
return [];
|
|
51
|
+
return [{ folder: parent, reason: 'Cross-target stage inventory could not be verified: ' + String(error.code ?? 'unavailable') }];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ResearchBackend } from './research.js';
|
|
2
2
|
import type { Artifact } from './artifacts.js';
|
|
3
3
|
export declare function debuggerExecutionSettled(operation: string, before: Record<string, unknown>, after: Record<string, unknown>): boolean;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function debuggerMetadataFingerprint(raw: unknown): string;
|
|
5
|
+
export declare function debuggerProgramMetadata(backend: Pick<ResearchBackend, 'inspect' | 'debuggerMetadata'>, snapshot: Artifact): Promise<string | undefined>;
|
|
5
6
|
export declare function debuggerResult(operation: string, p: Record<string, unknown>, raw: unknown): Record<string, unknown> | Record<string, unknown>[];
|
|
@@ -12,15 +12,20 @@ export function debuggerExecutionSettled(operation, before, after) {
|
|
|
12
12
|
return after.execution_state === 'RUNNING' || after.execution_state === 'STOPPED' && advanced;
|
|
13
13
|
return after.execution_state === 'STOPPED' && (operation !== 'step' || advanced);
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
return undefined;
|
|
18
|
-
const value = object(await backend.inspect(snapshot, { kind: 'debugger_bookmarks' }));
|
|
15
|
+
export function debuggerMetadataFingerprint(raw) {
|
|
16
|
+
const value = object(raw);
|
|
19
17
|
if (typeof value.fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(value.fingerprint))
|
|
20
18
|
fail('partial', 'Debugger program metadata inspection is incomplete.');
|
|
21
19
|
count(value.count);
|
|
22
20
|
return value.fingerprint;
|
|
23
21
|
}
|
|
22
|
+
export async function debuggerProgramMetadata(backend, snapshot) {
|
|
23
|
+
if (backend.debuggerMetadata)
|
|
24
|
+
return backend.debuggerMetadata(snapshot);
|
|
25
|
+
if (!backend.inspect)
|
|
26
|
+
return undefined;
|
|
27
|
+
return debuggerMetadataFingerprint(await backend.inspect(snapshot, { kind: 'debugger_bookmarks' }));
|
|
28
|
+
}
|
|
24
29
|
export function debuggerResult(operation, p, raw) {
|
|
25
30
|
if (['launch_offers', 'traces', 'modules', 'list_breakpoints', 'stack_trace'].includes(operation)) {
|
|
26
31
|
const rows = array(raw);
|
package/dist/src/debugger.js
CHANGED
|
@@ -65,8 +65,9 @@ export class Debugger {
|
|
|
65
65
|
let value;
|
|
66
66
|
if (operation !== 'traces')
|
|
67
67
|
value = debuggerResult(operation, p, await backend.debuggerCall(selected, operation, Object.fromEntries(Object.entries(p).filter(([key]) => !['limit', 'offset'].includes(key)))));
|
|
68
|
-
const
|
|
69
|
-
const
|
|
68
|
+
const current = this.workspace.context(selected), beforeMetadata = current.workingSnapshot ? await metadata(backend, current.workingSnapshot) : undefined;
|
|
69
|
+
const saved = await backend.debuggerSaved(selected), snapshot = await backend.saved(selected);
|
|
70
|
+
const changed = beforeMetadata !== undefined && beforeMetadata !== await metadata(backend, snapshot);
|
|
70
71
|
const complexChanges = changed ? [...current.complexChanges, 'debugger-metadata-' + randomUUID()] : current.complexChanges;
|
|
71
72
|
this.workspace.saveContext(selected, current.generation, { debugger: saved, workingSnapshot: snapshot, complexChanges });
|
|
72
73
|
if (operation === 'traces')
|
|
@@ -2,7 +2,7 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import * as zip from 'yauzl';
|
|
4
4
|
import { fail } from './model.js';
|
|
5
|
-
/** Version-pinned upstream display/entry adapters
|
|
5
|
+
/** Version-pinned upstream display/entry adapters and native compatibility fixes.
|
|
6
6
|
* Ghidra still creates/orders every resolver. No coordinator object merge lives here. */
|
|
7
7
|
const pins = [
|
|
8
8
|
['Features/Base', 'ghidra/app/merge/listing/ListingMergeManager.java', '3b6ce2e22fd414d6cc63ce2a3be6c533f13524b9513767b932f6da8f2d9326d6'],
|
|
@@ -61,8 +61,26 @@ export async function nativeMergeSources(home) {
|
|
|
61
61
|
for (const method of ['setListingViewsToEntireProgram', 'emptyListingViewForPrograms'])
|
|
62
62
|
source = replace(source, 'private void ' + method + '() {', 'private void ' + method + '() {\n\t\tif (mergePanel == null) return;');
|
|
63
63
|
}
|
|
64
|
-
else if (name.endsWith('/GhidraFileData.java'))
|
|
64
|
+
else if (name.endsWith('/GhidraFileData.java')) {
|
|
65
65
|
source = replace(source, 'if (SystemUtilities.isInHeadlessMode()) {', 'if (false /* Insight native headless merge adapter installed */) {', 2);
|
|
66
|
+
source = replace(source, 'DomainObject latestObj = null; // TODO: Is there some way to leverage the buffer file we already copied into tmpItem? Missing required change set', 'boolean mergeChanged = true;\n\t\t\t\tDomainObject latestObj = null; // TODO: Is there some way to leverage the buffer file we already copied into tmpItem? Missing required change set');
|
|
67
|
+
source = replace(source, 'mergeObj.save("Merge with version " + mergeVer, monitor);', `// A native merge can leave the latest-version result unchanged, even when
|
|
68
|
+
// the source checkout has local saves (e.g. Ghidra's open-time rewrite).
|
|
69
|
+
// save() otherwise skips it, leaving no cumulative change files for
|
|
70
|
+
// updateCheckoutFrom. Let the native save create those files, without
|
|
71
|
+
// adding an edit or synthesizing a change set.
|
|
72
|
+
mergeChanged = ((DomainObjectAdapterDB) mergeObj).getDBHandle().isChanged();
|
|
73
|
+
((DomainObjectAdapterDB) mergeObj).setChanged(true);
|
|
74
|
+
mergeObj.save("Merge with version " + mergeVer, monitor);`);
|
|
75
|
+
source = replace(source, 'tmpItem = null; // update removes temporary file if successful', `tmpItem = null; // update removes temporary file if successful
|
|
76
|
+
if (!mergeChanged) {
|
|
77
|
+
// The native result had no buffer changes relative to mergeVer.
|
|
78
|
+
// Record its new local version as clean, keeping the same checkout
|
|
79
|
+
// and the exact version merged, even if the server advances again.
|
|
80
|
+
folderItem.setCheckout(checkoutId, folderItem.isCheckedOutExclusive(), mergeVer,
|
|
81
|
+
folderItem.getCurrentVersion());
|
|
82
|
+
}`);
|
|
83
|
+
}
|
|
66
84
|
else if (name.endsWith('/ProgramContextMergeManager.java'))
|
|
67
85
|
source = replace(source, 'mergePanel.setTopComponent(conflictInfoPanel);', 'if (mergePanel != null) mergePanel.setTopComponent(conflictInfoPanel);');
|
|
68
86
|
else if (name.endsWith('/ExternalFunctionMerger.java'))
|
package/dist/src/research.d.ts
CHANGED
|
@@ -52,8 +52,8 @@ export interface ResearchBackend {
|
|
|
52
52
|
applied: 0;
|
|
53
53
|
conflict?: string;
|
|
54
54
|
}>;
|
|
55
|
-
dropNative?(scope: Scope): Promise<void>;
|
|
56
|
-
finishEmptyNative?(scope: Scope): Promise<void>;
|
|
55
|
+
dropNative?(scope: Scope, request?: string): Promise<void>;
|
|
56
|
+
finishEmptyNative?(scope: Scope, request?: string): Promise<void>;
|
|
57
57
|
recoverEmptyNative?(scope: Scope, request: string): Promise<{
|
|
58
58
|
state: 'verified';
|
|
59
59
|
revision: number;
|
|
@@ -109,9 +109,16 @@ export interface ResearchBackend {
|
|
|
109
109
|
state: 'verified';
|
|
110
110
|
revision: number;
|
|
111
111
|
snapshot?: Artifact;
|
|
112
|
+
} | {
|
|
113
|
+
state: 'refused';
|
|
114
|
+
revision: number;
|
|
115
|
+
snapshot: Artifact;
|
|
116
|
+
conflict: string;
|
|
112
117
|
} | {
|
|
113
118
|
state: 'unknown';
|
|
114
119
|
}>;
|
|
120
|
+
/** Immutable debugger metadata witness; native checkout receipts cannot reconstruct older buffers. */
|
|
121
|
+
debuggerMetadata?(snapshot: Artifact): Promise<string>;
|
|
115
122
|
recoverModel?(target: string): Promise<boolean>;
|
|
116
123
|
scripts?(scope: Scope, filter: string, limit: number, offset: number): Promise<ScriptPage>;
|
|
117
124
|
inspect?(snapshot: Artifact, parameters: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -131,6 +138,7 @@ export declare class Research {
|
|
|
131
138
|
private readonly backend;
|
|
132
139
|
private readonly tasks;
|
|
133
140
|
constructor(workspace: Workspace, backend: () => Promise<ResearchBackend>, tasks?: Map<string, Promise<unknown>>);
|
|
141
|
+
private retainedDisposal;
|
|
134
142
|
ordered<T>(selected: Scope, action: () => Promise<T>): Promise<T>;
|
|
135
143
|
boundary<T>(selected: Scope, action: () => Promise<T>): Promise<T>;
|
|
136
144
|
status(selected: Scope): {
|
package/dist/src/research.js
CHANGED
|
@@ -68,6 +68,15 @@ export class Research {
|
|
|
68
68
|
this.backend = backend;
|
|
69
69
|
this.tasks = tasks;
|
|
70
70
|
}
|
|
71
|
+
retainedDisposal(selected, request, error) {
|
|
72
|
+
if (!error || typeof error !== 'object')
|
|
73
|
+
return;
|
|
74
|
+
const failure = error, proof = failure.result?.retention, current = this.workspace.context(selected), outcome = this.workspace.request(request);
|
|
75
|
+
if (failure.code === 'coordinator.conflict' && failure.result?.state === 'retained' && proof?.schema === 1 && proof.source === 'native-release-status' &&
|
|
76
|
+
proof.request === request && proof.snapshot?.id === current.workingSnapshot?.id && outcome.context === current.id && outcome.state === 'failed' && digest(outcome.result) === digest(failure.result) &&
|
|
77
|
+
proof.checkout && current.nativeCheckout?.state === 'active' && digest(proof.checkout) === digest(current.nativeCheckout))
|
|
78
|
+
return failure.result;
|
|
79
|
+
}
|
|
71
80
|
async ordered(selected, action) {
|
|
72
81
|
const key = this.workspace.context(selected).id, previous = this.tasks.get(key);
|
|
73
82
|
const task = timed('facade.queue', 'research', async () => { await previous?.catch(() => { }); }).then(action);
|
|
@@ -248,12 +257,15 @@ export class Research {
|
|
|
248
257
|
}
|
|
249
258
|
const backend = await this.backend();
|
|
250
259
|
await backend.open(source);
|
|
251
|
-
const
|
|
260
|
+
const sourceView = await backend.saved(source);
|
|
261
|
+
if (sourceView.kind === 'native' && !backend.snapshotFile)
|
|
262
|
+
fail('configuration', 'Selected backend cannot retain an immutable documentation source.');
|
|
263
|
+
const sourceSnapshot = sourceView.kind === 'native' ? await this.workspace.captureSnapshot(await backend.snapshotFile(sourceView)) : sourceView;
|
|
252
264
|
await backend.open(selected);
|
|
253
265
|
if (!backend.transfer || !backend.transferCheck)
|
|
254
266
|
fail('configuration', 'Selected backend cannot verify documentation transfer.');
|
|
255
267
|
const context = this.workspace.context(selected);
|
|
256
|
-
this.workspace.startRequest(request.id, { kind: 'transfer', generation: context.generation, workingSnapshot: context.workingSnapshot, source, sourceSnapshot, dryRun });
|
|
268
|
+
this.workspace.startRequest(request.id, { kind: 'transfer', generation: context.generation, workingSnapshot: context.workingSnapshot, source, sourceView, sourceSnapshot, dryRun });
|
|
257
269
|
try {
|
|
258
270
|
const value = transferResult(await backend.transfer(selected, sourceSnapshot, dryRun), dryRun);
|
|
259
271
|
const snapshot = await backend.saved(selected);
|
|
@@ -495,6 +507,10 @@ export class Research {
|
|
|
495
507
|
state: 'merged', sharedRevision: revision(observed.revision), applied: active.scalars.length + (active.complexChanges?.length ?? Number(active.complex)), pendingChanges: 0 }, observed.snapshot);
|
|
496
508
|
if (observed.state === 'verified' && backend.dropNative)
|
|
497
509
|
await backend.dropNative(active);
|
|
510
|
+
if (observed.state === 'refused')
|
|
511
|
+
this.workspace.finishRefusedPublication(active.id, observed.revision, observed.snapshot, { session: active.session, target: active.target, state: 'conflict', reason: 'shared_changed', applied: 0,
|
|
512
|
+
pendingChanges: active.scalars.length + (active.complexChanges?.length ?? Number(active.complex)),
|
|
513
|
+
conflicts: [{ engine: 'ghidra', message: observed.conflict }], reconciled: true });
|
|
498
514
|
}
|
|
499
515
|
}
|
|
500
516
|
for (const request of this.workspace.unresolved(selected)) {
|
|
@@ -508,7 +524,16 @@ export class Research {
|
|
|
508
524
|
throw error;
|
|
509
525
|
}
|
|
510
526
|
if (!publication) {
|
|
511
|
-
|
|
527
|
+
let empty;
|
|
528
|
+
try {
|
|
529
|
+
empty = await backend.recoverEmptyNative?.(selected, request.id);
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
const retained = this.retainedDisposal(selected, request.id, error);
|
|
533
|
+
if (!retained)
|
|
534
|
+
throw error;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
512
537
|
if (empty?.state === 'verified') {
|
|
513
538
|
const current = this.workspace.context(selected);
|
|
514
539
|
this.workspace.completeSavedRequest(selected, request.id, current.generation, {}, { ...selected, state: 'empty', applied: 0, pendingChanges: 0, sharedRevision: revision(empty.revision), engine: 'ghidra-native' });
|
|
@@ -744,7 +769,7 @@ export class Research {
|
|
|
744
769
|
fail('conflict', 'Native conflict preserves the original working copy and checkout.', result);
|
|
745
770
|
}
|
|
746
771
|
if (update.state === 'empty') {
|
|
747
|
-
await backend.finishEmptyNative(selected);
|
|
772
|
+
await backend.finishEmptyNative(selected, request.id);
|
|
748
773
|
const current = this.workspace.context(selected);
|
|
749
774
|
const result = { ...selected, state: count(context) ? 'merged' : 'empty', applied: 0, pendingChanges: 0, sharedRevision: revision(update.revision), engine: 'ghidra-native' };
|
|
750
775
|
this.workspace.completeSavedRequest(selected, request.id, current.generation, {}, result);
|
|
@@ -771,6 +796,8 @@ export class Research {
|
|
|
771
796
|
catch (error) {
|
|
772
797
|
const state = this.workspace.request(request.id).state;
|
|
773
798
|
if (state !== 'applied' && state !== 'failed') {
|
|
799
|
+
// Proved empty-disposal retention already committed its terminal request atomically above.
|
|
800
|
+
// An uncertain release or any publication still follows the unknown-outcome path below.
|
|
774
801
|
if (publication && ['commit_intent', 'unknown'].includes(this.workspace.publication(publication.id).state))
|
|
775
802
|
this.workspace.unknownPublication(publication.id, { state: 'unknown', engine: 'ghidra-native' });
|
|
776
803
|
this.workspace.recordRequest(request.id, 'unknown', { ...selected, state: 'unknown', engine: 'ghidra-native' });
|