@eyeauras/insight-cli 0.6.4 → 0.7.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.
- package/.cli-package-build.json +1 -1
- package/SKILL.md +9 -7
- package/dist/src/activity-audit.d.ts +123 -0
- package/dist/src/activity-audit.js +310 -0
- package/dist/src/audit-commands.d.ts +10 -0
- package/dist/src/audit-commands.js +85 -0
- package/dist/src/audit-retention.d.ts +38 -0
- package/dist/src/audit-retention.js +106 -0
- package/dist/src/cli.js +11 -3
- 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/diagnostic-error.d.ts +12 -0
- package/dist/src/diagnostic-error.js +82 -0
- package/dist/src/internal-timing.d.ts +8 -2
- package/dist/src/internal-timing.js +50 -7
- package/dist/src/lifecycle.d.ts +1 -1
- package/dist/src/native-merge-patches.js +20 -2
- package/dist/src/research.d.ts +11 -3
- package/dist/src/research.js +31 -4
- package/dist/src/storage-gc.js +429 -196
- package/dist/src/tool-runtime/run.js +24 -11
- package/dist/src/tool-runtime/supervisor.js +51 -9
- package/dist/src/transport.js +19 -10
- package/dist/src/workspace.d.ts +45 -1
- package/dist/src/workspace.js +135 -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/research.md +33 -2
- 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/research.md +33 -2
- 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 +7 -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/research.md +33 -2
- 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 +7 -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
|
@@ -27,6 +27,22 @@ export async function runTool(c, spec) {
|
|
|
27
27
|
const environment = { PATH: c.environment.PATH ?? process.env.PATH, HOME: root, TMPDIR: root, ...(process.platform === 'win32' ? { SystemRoot: process.env.SystemRoot, WINDIR: process.env.WINDIR, ComSpec: process.env.ComSpec, TEMP: root, TMP: root, USERPROFILE: root, LOCALAPPDATA: root, APPDATA: root } : {}), ...spec.environment };
|
|
28
28
|
const secrets = Object.entries(environment).filter(([key, value]) => /TOKEN|PASSWORD|SECRET|KEY/i.test(key) && value && value.length >= 4).map(([, v]) => v);
|
|
29
29
|
const redact = (value) => secrets.reduce((text, secret) => text.split(secret).join('[redacted]'), value);
|
|
30
|
+
let retained;
|
|
31
|
+
const retainOutput = async (exitCode = child?.exitCode ?? null) => {
|
|
32
|
+
if (retained)
|
|
33
|
+
return retained;
|
|
34
|
+
const result = { process: id, stdout: redact(Buffer.concat(stdout).toString('utf8')), stderr: redact(Buffer.concat(stderr).toString('utf8')), exitCode, signal: child?.signalCode ?? null, elapsedMs: Math.round(performance.now() - started), truncated, diagnostics: root };
|
|
35
|
+
if (spec.retainRawOutput) {
|
|
36
|
+
result.rawStdout = join(root, 'stdout.bin');
|
|
37
|
+
result.rawStderr = join(root, 'stderr.bin');
|
|
38
|
+
await writeFile(result.rawStdout, Buffer.concat(stdout), { mode: 0o600 });
|
|
39
|
+
await writeFile(result.rawStderr, Buffer.concat(stderr), { mode: 0o600 });
|
|
40
|
+
}
|
|
41
|
+
await writeFile(join(root, 'stdout.log'), result.stdout, { mode: 0o600 });
|
|
42
|
+
await writeFile(join(root, 'stderr.log'), result.stderr, { mode: 0o600 });
|
|
43
|
+
retained = result;
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
30
46
|
let timer, force, drain, hard, settled = false, abandon;
|
|
31
47
|
const signal = (name) => {
|
|
32
48
|
if (!child?.pid || settled)
|
|
@@ -59,15 +75,17 @@ export async function runTool(c, spec) {
|
|
|
59
75
|
child = await launchProcess(directory, { tool: spec.tool, role: spec.role, installation: spec.installation ?? 'probe', session: spec.session, target: spec.target, ...(spec.metadata || spec.nativeDeadline ? { metadata: { ...spec.metadata, ...(spec.observedSubject ? { observedSubject: spec.observedSubject } : {}), ...(spec.nativeMutex ? { nativeMutex: spec.nativeMutex } : {}), ...(spec.nativeRegistry ? { nativeRegistry: spec.nativeRegistry } : {}), ...(spec.nativeDeadline ? { nativeDeadlineSeconds: Math.ceil((spec.timeoutMs ?? 120000) / 1000), nativeExecutable: spec.executable, ...(spec.nativeChildDeadlines ? { nativeChildDeadlines: true } : {}) } : {}) } } : {}) }, launch.executable, launch.arguments, { cwd: spec.cwd ?? root, env: environment, windowsHide: true, detached: process.platform !== 'win32', stdio: ['pipe', 'pipe', 'pipe'] }, { id, finalize: false, signal: c.signal, onSpawn: launched => {
|
|
60
76
|
child = launched;
|
|
61
77
|
child.once('close', () => { settled = true; });
|
|
78
|
+
child.on('error', () => stop('launch_failed'));
|
|
62
79
|
child.once('exit', () => { drain = setTimeout(() => stop('background_output'), 300); drain.unref(); });
|
|
63
80
|
const capture = (chunks, b) => { const available = Math.max(0, limit - bytes); if (available)
|
|
64
81
|
chunks.push(Buffer.from(b.subarray(0, available))); bytes += b.length; if (bytes > limit) {
|
|
65
82
|
truncated = true;
|
|
66
83
|
stop('output_limit');
|
|
67
84
|
} };
|
|
85
|
+
child.stdout.on('error', () => stop('launch_failed'));
|
|
86
|
+
child.stderr.on('error', () => stop('launch_failed'));
|
|
68
87
|
child.stdout.on('data', b => capture(stdout, b));
|
|
69
88
|
child.stderr.on('data', b => capture(stderr, b));
|
|
70
|
-
child.stdin.on('error', () => { });
|
|
71
89
|
child.stdin.end(spec.input);
|
|
72
90
|
c.signal.addEventListener('abort', aborted, { once: true });
|
|
73
91
|
if (c.signal.aborted)
|
|
@@ -97,15 +115,7 @@ export async function runTool(c, spec) {
|
|
|
97
115
|
outcome = 'timeout';
|
|
98
116
|
if (!outcome && (exitCode === null || !(spec.acceptedCodes ?? [0]).includes(exitCode)))
|
|
99
117
|
outcome = 'exit_code';
|
|
100
|
-
const result =
|
|
101
|
-
if (spec.retainRawOutput) {
|
|
102
|
-
result.rawStdout = join(root, 'stdout.bin');
|
|
103
|
-
result.rawStderr = join(root, 'stderr.bin');
|
|
104
|
-
await writeFile(result.rawStdout, Buffer.concat(stdout), { mode: 0o600 });
|
|
105
|
-
await writeFile(result.rawStderr, Buffer.concat(stderr), { mode: 0o600 });
|
|
106
|
-
}
|
|
107
|
-
await writeFile(join(root, 'stdout.log'), result.stdout, { mode: 0o600 });
|
|
108
|
-
await writeFile(join(root, 'stderr.log'), result.stderr, { mode: 0o600 });
|
|
118
|
+
const result = await retainOutput(exitCode);
|
|
109
119
|
Object.assign(record, { state: outcome ? 'failed' : 'exited', outcome: outcome ?? 'completed', exitCode: result.exitCode, signal: result.signal, elapsedMs: result.elapsedMs, endedAt: new Date().toISOString() });
|
|
110
120
|
await atomicWrite(path, record);
|
|
111
121
|
if (outcome)
|
|
@@ -121,7 +131,6 @@ export async function runTool(c, spec) {
|
|
|
121
131
|
}
|
|
122
132
|
catch (error) {
|
|
123
133
|
const failure = error;
|
|
124
|
-
await atomicWrite(join(root, 'error.json'), { name: failure.name, code: failure.code, message: redact(failure.message ?? String(error)), ...(failure.cause ? { cause: { name: failure.cause.name, message: redact(failure.cause.message) } } : {}) });
|
|
125
134
|
if (child && !settled && record.state !== 'unverified') {
|
|
126
135
|
stop('failed');
|
|
127
136
|
await new Promise(ok => { if (settled) {
|
|
@@ -132,12 +141,16 @@ export async function runTool(c, spec) {
|
|
|
132
141
|
Object.assign(record, await readJson(path));
|
|
133
142
|
if (c.signal.aborted && !outcome)
|
|
134
143
|
outcome = 'cancelled';
|
|
144
|
+
if (child?.pid && !settled && child.exitCode === null && child.signalCode === null)
|
|
145
|
+
record.state = 'unverified';
|
|
135
146
|
if (record.state === 'starting' || record.state === 'running' || record.state === 'failed') {
|
|
136
147
|
Object.assign(record, { state: 'failed', outcome: outcome ?? 'launch_failed', endedAt: new Date().toISOString(), elapsedMs: Math.round(performance.now() - started) });
|
|
137
148
|
await atomicWrite(path, record);
|
|
138
149
|
}
|
|
139
150
|
if (record.state === 'unverified')
|
|
140
151
|
await atomicWrite(path, record);
|
|
152
|
+
await atomicWrite(join(root, 'error.json'), { name: failure.name, code: failure.code, message: redact(failure.message ?? String(error)), ...(failure.cause ? { cause: { name: failure.cause.name, message: redact(failure.cause.message) } } : {}) });
|
|
153
|
+
await retainOutput();
|
|
141
154
|
if (error instanceof CliError)
|
|
142
155
|
throw error;
|
|
143
156
|
if (record.state === 'unverified')
|
|
@@ -81,22 +81,49 @@ export async function launchProcess(directory, spec, executable, args, options =
|
|
|
81
81
|
await atomicWrite(path, record);
|
|
82
82
|
throw error;
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Node can emit errors on the pipes as well as on the child (including a failed
|
|
85
|
+
// Windows spawn with no PID). Observe them before any adapter/identity await.
|
|
86
|
+
let childError, streamError, didSpawn = false, didClose = false, startupSucceeded = false, startupError;
|
|
87
|
+
const failure = () => childError ?? streamError;
|
|
88
|
+
const spawned = new Promise((ok, bad) => {
|
|
89
|
+
child.once('spawn', () => { didSpawn = true; ok(); });
|
|
90
|
+
child.on('error', error => { childError ??= error; if (!didSpawn)
|
|
91
|
+
bad(error); });
|
|
92
|
+
});
|
|
93
|
+
for (const stream of child.stdio)
|
|
94
|
+
stream?.on('error', error => {
|
|
95
|
+
// A tool may close its input without consuming it; retain the existing EPIPE policy.
|
|
96
|
+
if (stream !== child.stdin || error.code !== 'EPIPE')
|
|
97
|
+
streamError ??= error;
|
|
98
|
+
});
|
|
99
|
+
const closed = new Promise((ok, bad) => { child.once('close', () => { didClose = true; const error = failure(); if (error)
|
|
100
|
+
bad(error);
|
|
101
|
+
else
|
|
102
|
+
ok(); }); });
|
|
86
103
|
void closed.catch(() => { });
|
|
104
|
+
let finishLaunch;
|
|
105
|
+
const launchFinished = new Promise(ok => finishLaunch = ok);
|
|
87
106
|
const handle = { child, closed, record };
|
|
88
107
|
owned.set(ownedKey(directory, id), handle);
|
|
89
|
-
const finalized = control.finalize === false ? closed : closed.then(async () => {
|
|
108
|
+
const finalized = control.finalize === false ? closed : closed.catch(() => { }).then(async () => {
|
|
109
|
+
// A fast exit must not finalize a reservation while startup is still writing it.
|
|
110
|
+
await launchFinished;
|
|
90
111
|
const current = await readJson(path) ?? record;
|
|
112
|
+
const failed = !startupSucceeded || Boolean(failure()), error = failure() ?? startupError;
|
|
91
113
|
if (current.state !== 'failed' && current.state !== 'unverified')
|
|
92
|
-
Object.assign(current, { state: 'exited', exitCode: child.exitCode, signal: child.signalCode, endedAt: new Date().toISOString(), outcome: current.requestedStop === 'kill' ? 'killed' : current.requestedStop === 'stop' ? 'stopped' : 'completed' });
|
|
114
|
+
Object.assign(current, { state: failed ? 'failed' : 'exited', exitCode: child.exitCode, signal: child.signalCode, endedAt: new Date().toISOString(), outcome: failed ? 'launch_failed' : current.requestedStop === 'kill' ? 'killed' : current.requestedStop === 'stop' ? 'stopped' : 'completed', ...(failed ? { phase: 'launch_failed', launchError: error?.code ?? (failure() ? 'stdio' : 'launch') } : {}) });
|
|
93
115
|
await atomicWrite(path, current);
|
|
94
|
-
}
|
|
116
|
+
});
|
|
95
117
|
handle.closed = finalized.finally(() => { owned.delete(ownedKey(directory, id)); });
|
|
96
118
|
void handle.closed.catch(() => { });
|
|
97
119
|
Object.assign(child, { toolProcessId: id, toolClosed: handle.closed });
|
|
98
120
|
try {
|
|
121
|
+
await spawned;
|
|
122
|
+
if (failure())
|
|
123
|
+
throw failure();
|
|
99
124
|
await control.onSpawn?.(child);
|
|
125
|
+
if (failure())
|
|
126
|
+
throw failure();
|
|
100
127
|
if (!child.pid)
|
|
101
128
|
throw Error('Owned tool spawn did not obtain a PID');
|
|
102
129
|
if (gated) {
|
|
@@ -106,6 +133,8 @@ export async function launchProcess(directory, spec, executable, args, options =
|
|
|
106
133
|
let armed = false;
|
|
107
134
|
for (let i = 0; i < 400; i++) {
|
|
108
135
|
control.signal?.throwIfAborted();
|
|
136
|
+
if (failure())
|
|
137
|
+
throw failure();
|
|
109
138
|
const ready = await readJson(join(root, 'armed.json'));
|
|
110
139
|
if (ready && ready.pid === child.pid && ready.nonce === nonce) {
|
|
111
140
|
armed = true;
|
|
@@ -117,8 +146,12 @@ export async function launchProcess(directory, spec, executable, args, options =
|
|
|
117
146
|
}
|
|
118
147
|
if (!armed)
|
|
119
148
|
throw Error('Owned launch did not become armed');
|
|
149
|
+
if (failure())
|
|
150
|
+
throw failure();
|
|
120
151
|
Object.assign(record, await readJson(path), { state: 'running', phase: 'exec_authorized' });
|
|
121
152
|
await atomicWrite(path, record);
|
|
153
|
+
if (failure())
|
|
154
|
+
throw failure();
|
|
122
155
|
await atomicWrite(join(root, 'go.json'), { nonce });
|
|
123
156
|
}
|
|
124
157
|
else {
|
|
@@ -128,18 +161,27 @@ export async function launchProcess(directory, spec, executable, args, options =
|
|
|
128
161
|
Object.assign(record, { pid: child.pid, identity: identity?.birth, strongIdentity: identity?.strong, processGroup: identity?.group, state: 'running', phase: 'direct_child_only' });
|
|
129
162
|
await atomicWrite(path, record);
|
|
130
163
|
}
|
|
164
|
+
if (failure())
|
|
165
|
+
throw failure();
|
|
166
|
+
startupSucceeded = true;
|
|
131
167
|
return child;
|
|
132
168
|
}
|
|
133
169
|
catch (error) {
|
|
134
|
-
|
|
170
|
+
// Keep rejection independent of the failure receipt: its atomic write may fail.
|
|
171
|
+
startupError = error;
|
|
172
|
+
if (child.pid && child.exitCode === null && child.signalCode === null)
|
|
135
173
|
try {
|
|
136
174
|
child.kill('SIGKILL');
|
|
137
175
|
}
|
|
138
176
|
catch { }
|
|
139
|
-
await Promise.race([
|
|
140
|
-
|
|
177
|
+
await Promise.race([closed.catch(() => { }), delay(2000)]);
|
|
178
|
+
const ended = didClose || child.exitCode !== null || child.signalCode !== null || !child.pid && Boolean(childError);
|
|
179
|
+
Object.assign(record, await readJson(path), { state: ended ? 'failed' : 'unverified', phase: 'launch_failed', launchError: (failure() ?? error)?.code ?? 'launch', ...(ended ? { endedAt: new Date().toISOString(), exitCode: child.exitCode, signal: child.signalCode, outcome: 'launch_failed' } : {}) });
|
|
141
180
|
await atomicWrite(path, record);
|
|
142
|
-
throw error;
|
|
181
|
+
throw failure() ?? error;
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
finishLaunch();
|
|
143
185
|
}
|
|
144
186
|
}, control.signal);
|
|
145
187
|
}
|
package/dist/src/transport.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { fail, object } from './model.js';
|
|
2
2
|
import { parseDomainJson } from './json.js';
|
|
3
|
-
import { timed } from './internal-timing.js';
|
|
3
|
+
import { timed, currentTraceId } from './internal-timing.js';
|
|
4
|
+
import { auditEvent } from './activity-audit.js';
|
|
4
5
|
import { CliError } from '@eyeauras/cli-factory';
|
|
6
|
+
import { transportDiagnostic } from './diagnostic-error.js';
|
|
5
7
|
/** The pinned GhidraMCP HTTP side of a dedicated bridge. No discovery by project name. */
|
|
6
8
|
export class HttpBridge {
|
|
7
9
|
endpoint;
|
|
@@ -27,7 +29,13 @@ export class HttpBridge {
|
|
|
27
29
|
fail('invalid', 'Bridge timeout is outside the supported bound.');
|
|
28
30
|
}
|
|
29
31
|
async request(path, method, query, body) {
|
|
30
|
-
return timed('native.http', path, () =>
|
|
32
|
+
return timed('native.http', path, async () => { try {
|
|
33
|
+
return await this.requestBody(path, method, query, body);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
auditEvent('transport.failed', { error, outcome: 'failure', traceId: currentTraceId() });
|
|
37
|
+
throw error;
|
|
38
|
+
} });
|
|
31
39
|
}
|
|
32
40
|
async requestBody(path, method, query, body) {
|
|
33
41
|
const url = new URL(path, this.endpoint);
|
|
@@ -36,12 +44,13 @@ export class HttpBridge {
|
|
|
36
44
|
const saving = path === '/save_program' || path === '/export_program';
|
|
37
45
|
const timeoutMilliseconds = this.timeoutMilliseconds ?? (saving ? this.saveTimeoutMilliseconds : path === '/import_file' ? 600000 : 30000);
|
|
38
46
|
const signal = this.signal ? AbortSignal.any([this.signal, AbortSignal.timeout(timeoutMilliseconds)]) : AbortSignal.timeout(timeoutMilliseconds);
|
|
39
|
-
const transportFailure = () => {
|
|
47
|
+
const transportFailure = (error, phase) => {
|
|
48
|
+
const detail = { operation: path, transport: transportDiagnostic(error, phase, method, Number(url.port)) };
|
|
40
49
|
if (this.signal?.aborted)
|
|
41
|
-
fail('cancelled', `Ghidra request ${path} was cancelled; its outcome may require reconciliation.`,
|
|
50
|
+
fail('cancelled', `Ghidra request ${path} was cancelled; its outcome may require reconciliation.`, detail);
|
|
42
51
|
if (signal.aborted)
|
|
43
|
-
fail('timeout', `Ghidra request ${path} exceeded ${timeoutMilliseconds / 1000} seconds; its outcome may require reconciliation.${saving ? ' Configure profile saveSeconds before future work; inspect sessions status and never replay an uncertain script.' : ''}`, {
|
|
44
|
-
fail('transport', `Ghidra request ${path} did not complete; its outcome may require reconciliation.`,
|
|
52
|
+
fail('timeout', `Ghidra request ${path} exceeded ${timeoutMilliseconds / 1000} seconds; its outcome may require reconciliation.${saving ? ' Configure profile saveSeconds before future work; inspect sessions status and never replay an uncertain script.' : ''}`, { ...detail, timeoutMilliseconds, ...(saving ? { phase: 'save', budgetSetting: 'saveSeconds', outcome: 'unknown' } : {}) });
|
|
53
|
+
fail('transport', `Ghidra request ${path} did not complete; its outcome may require reconciliation.`, detail);
|
|
45
54
|
};
|
|
46
55
|
for (const [name, value] of Object.entries(query))
|
|
47
56
|
url.searchParams.set(name, String(value));
|
|
@@ -49,11 +58,11 @@ export class HttpBridge {
|
|
|
49
58
|
try {
|
|
50
59
|
response = await this.fetch(url, { method, redirect: 'error', signal, headers: { ...(this.token ? { Authorization: 'Bearer ' + this.token } : {}), ...(method === 'POST' ? { 'Content-Type': 'application/json' } : {}) }, ...(method === 'POST' ? { body: JSON.stringify(body) } : {}) });
|
|
51
60
|
}
|
|
52
|
-
catch {
|
|
53
|
-
return transportFailure();
|
|
61
|
+
catch (error) {
|
|
62
|
+
return transportFailure(error, 'fetch');
|
|
54
63
|
}
|
|
55
64
|
if (!response.ok)
|
|
56
|
-
fail('remote', 'Ghidra bridge rejected the operation.');
|
|
65
|
+
fail('remote', 'Ghidra bridge rejected the operation.', { operation: path, transport: transportDiagnostic(undefined, 'status', method, Number(url.port), response.status) });
|
|
57
66
|
// Bound even a chunked/malformed service response; never persist raw payloads as logs.
|
|
58
67
|
const reader = response.body?.getReader();
|
|
59
68
|
if (!reader)
|
|
@@ -74,7 +83,7 @@ export class HttpBridge {
|
|
|
74
83
|
catch (error) {
|
|
75
84
|
if (error instanceof CliError)
|
|
76
85
|
throw error;
|
|
77
|
-
return transportFailure();
|
|
86
|
+
return transportFailure(error, 'body');
|
|
78
87
|
}
|
|
79
88
|
finally {
|
|
80
89
|
await reader.cancel().catch(() => { });
|
package/dist/src/workspace.d.ts
CHANGED
|
@@ -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. */
|
|
@@ -147,6 +149,8 @@ export declare class Workspace {
|
|
|
147
149
|
readonly artifacts: Artifacts;
|
|
148
150
|
private readonly db;
|
|
149
151
|
private namespace;
|
|
152
|
+
private auditPending;
|
|
153
|
+
private auditRequest;
|
|
150
154
|
constructor(directory: string, profile: string);
|
|
151
155
|
close(): void;
|
|
152
156
|
private transaction;
|
|
@@ -188,8 +192,15 @@ export declare class Workspace {
|
|
|
188
192
|
uncertainOutcome(scope: Scope): boolean;
|
|
189
193
|
/** Receipt-only comparison; native state is verified separately before any release. */
|
|
190
194
|
unchangedNative(context: GhidraContext): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Saved buffers hold no private work when they equal the shared base, or equal what Ghidra itself wrote when a
|
|
197
|
+
* worker opened a pristine checkout of that base. Equal bytes are the proof; what Ghidra rewrote is irrelevant.
|
|
198
|
+
*/
|
|
199
|
+
unchangedBuffers(target: string, base: Record<string, unknown>, fingerprint: unknown): boolean;
|
|
200
|
+
/** Saved buffers of pristine checkouts of one shared version, as each was left by its worker's own open. */
|
|
201
|
+
openedReferences(target: string, base: Record<string, unknown>): Set<string>;
|
|
191
202
|
/** Another context's unresolved operation may still need this checkout's private view. */
|
|
192
|
-
checkoutReferenced(context: GhidraContext): boolean;
|
|
203
|
+
checkoutReferenced(context: GhidraContext, root?: string | undefined): boolean;
|
|
193
204
|
/** Applied requests keep their results; their superseded before-images are not recovery inputs. */
|
|
194
205
|
artifactRoots(): Set<string>;
|
|
195
206
|
forgetArtifact(artifact: string): void;
|
|
@@ -237,8 +248,41 @@ export declare class Workspace {
|
|
|
237
248
|
};
|
|
238
249
|
finishPublication(publication: string, publishedRevision: number, result: unknown, sharedSnapshot?: Artifact): Publication;
|
|
239
250
|
rejectPublication(publication: string, result: unknown): Publication;
|
|
251
|
+
/** Exactly proved native pre-call refusal: settle all journals together, retaining the private view. */
|
|
252
|
+
finishRefusedPublication(publication: string, observedRevision: number, sharedSnapshot: Artifact, result: unknown): Publication;
|
|
240
253
|
publishedSince(target: string, revision: number): Publication[];
|
|
241
254
|
saveContext(scope: Scope, expectedGeneration: number, patch: ContextPatch): GhidraContext;
|
|
255
|
+
/** Independent release readback and its no-publication request outcome become visible together. */
|
|
256
|
+
retainNativeDisposal(scope: Scope, generation: number, checkout: NativeCheckout, snapshot: Artifact, request?: string): {
|
|
257
|
+
session: string;
|
|
258
|
+
target: string;
|
|
259
|
+
state: "retained";
|
|
260
|
+
engine: "ghidra-native";
|
|
261
|
+
checkout: "retained";
|
|
262
|
+
retention: {
|
|
263
|
+
request?: string | undefined;
|
|
264
|
+
schema: 1;
|
|
265
|
+
source: "native-release-status";
|
|
266
|
+
checkout: {
|
|
267
|
+
state: "active";
|
|
268
|
+
schema: 1;
|
|
269
|
+
context: string;
|
|
270
|
+
root: string;
|
|
271
|
+
fileId: string;
|
|
272
|
+
checkoutId: number;
|
|
273
|
+
baseVersion: number;
|
|
274
|
+
origin: string;
|
|
275
|
+
repository: string;
|
|
276
|
+
path: string;
|
|
277
|
+
runtimeFingerprint: string;
|
|
278
|
+
conflict?: {
|
|
279
|
+
request: string;
|
|
280
|
+
message: string;
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
snapshot: Artifact;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
242
286
|
/** Terminal abandonment retains the previous outcome and saved view atomically. */
|
|
243
287
|
abandonProgramRequest(scope: Scope, request: string, generation: number): {
|
|
244
288
|
state: string;
|
package/dist/src/workspace.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import {
|
|
2
|
+
import { auditEvent, bindAudit, auditHash } from './activity-audit.js';
|
|
3
|
+
import { chmodSync, mkdirSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
|
|
3
4
|
import { basename, join } from 'node:path';
|
|
4
5
|
import { randomUUID } from 'node:crypto';
|
|
5
6
|
import { Artifacts } from './artifacts.js';
|
|
@@ -56,6 +57,19 @@ export class Workspace {
|
|
|
56
57
|
artifacts;
|
|
57
58
|
db;
|
|
58
59
|
namespace;
|
|
60
|
+
auditPending;
|
|
61
|
+
auditRequest(request) {
|
|
62
|
+
const data = { request: request.id, state: request.state, ...(request.callerId ? { callerHash: auditHash(request.callerId) } : {}), ...(request.context ? { context: request.context } : {}), ...(['unknown', 'failed'].includes(request.state) ? { outcome: 'failure' } : request.state === 'applied' ? { outcome: 'success' } : {}) };
|
|
63
|
+
const emit = () => { bindAudit(data); if (request.context)
|
|
64
|
+
try {
|
|
65
|
+
bindAudit(this.contextById(request.context));
|
|
66
|
+
}
|
|
67
|
+
catch { } auditEvent('request.state', data); };
|
|
68
|
+
if (this.auditPending)
|
|
69
|
+
this.auditPending.push(emit);
|
|
70
|
+
else
|
|
71
|
+
emit();
|
|
72
|
+
}
|
|
59
73
|
constructor(directory, profile) {
|
|
60
74
|
this.profile = profile;
|
|
61
75
|
text(profile);
|
|
@@ -107,12 +121,18 @@ export class Workspace {
|
|
|
107
121
|
close() { this.db.close(); }
|
|
108
122
|
transaction(action) {
|
|
109
123
|
this.db.exec('BEGIN IMMEDIATE');
|
|
124
|
+
const previous = this.auditPending, events = [];
|
|
125
|
+
this.auditPending = events;
|
|
110
126
|
try {
|
|
111
127
|
const result = action();
|
|
112
128
|
this.db.exec('COMMIT');
|
|
129
|
+
this.auditPending = previous;
|
|
130
|
+
for (const emit of events)
|
|
131
|
+
emit();
|
|
113
132
|
return result;
|
|
114
133
|
}
|
|
115
134
|
catch (error) {
|
|
135
|
+
this.auditPending = previous;
|
|
116
136
|
this.db.exec('ROLLBACK');
|
|
117
137
|
throw error;
|
|
118
138
|
}
|
|
@@ -216,6 +236,7 @@ export class Workspace {
|
|
|
216
236
|
const request = { id: 'q_' + randomUUID(), operation: text(operation, 128), intent,
|
|
217
237
|
context, state: 'accepted', ...(callerId === undefined ? {} : { callerId: id(callerId) }), createdAt: now(), updatedAt: now() };
|
|
218
238
|
this.db.prepare('INSERT INTO requests VALUES(?,?,?,?,?,?)').run(request.id, callerId ?? null, hash, context, request.state, bounded(request));
|
|
239
|
+
this.auditRequest(request);
|
|
219
240
|
return request;
|
|
220
241
|
}
|
|
221
242
|
reserveOpen(target, session, settings, callerId, mode) {
|
|
@@ -323,25 +344,67 @@ export class Workspace {
|
|
|
323
344
|
return false;
|
|
324
345
|
try {
|
|
325
346
|
const [local, base] = [context.workingSnapshot, context.baseSnapshot].map(value => JSON.parse(readFileSync(this.artifacts.path(value), 'utf8')));
|
|
326
|
-
return
|
|
347
|
+
return this.unchangedBuffers(context.target, base, local.fingerprint);
|
|
327
348
|
}
|
|
328
349
|
catch {
|
|
329
350
|
return false;
|
|
330
351
|
}
|
|
331
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Saved buffers hold no private work when they equal the shared base, or equal what Ghidra itself wrote when a
|
|
355
|
+
* worker opened a pristine checkout of that base. Equal bytes are the proof; what Ghidra rewrote is irrelevant.
|
|
356
|
+
*/
|
|
357
|
+
unchangedBuffers(target, base, fingerprint) {
|
|
358
|
+
if (typeof fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(fingerprint) || base.source !== 'server' || typeof base.fingerprint !== 'string')
|
|
359
|
+
return false;
|
|
360
|
+
return fingerprint === base.fingerprint || this.openedReferences(target, base).has(fingerprint);
|
|
361
|
+
}
|
|
362
|
+
/** Saved buffers of pristine checkouts of one shared version, as each was left by its worker's own open. */
|
|
363
|
+
openedReferences(target, base) {
|
|
364
|
+
const revision = Number(base.version);
|
|
365
|
+
const found = new Set(), root = join(this.directory, 'ghidra-native', 'shared-views', id(target), 'opened');
|
|
366
|
+
let names;
|
|
367
|
+
try {
|
|
368
|
+
names = readdirSync(root);
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
return found;
|
|
372
|
+
}
|
|
373
|
+
for (const name of names) {
|
|
374
|
+
const match = /^v(\d+)-([a-f0-9]{64})\.json$/.exec(name);
|
|
375
|
+
if (!match || Number(match[1]) !== revision)
|
|
376
|
+
continue;
|
|
377
|
+
try {
|
|
378
|
+
const row = JSON.parse(readFileSync(join(root, name), 'utf8'));
|
|
379
|
+
// Earlier receipts inferred pristine state from control metadata alone; they cannot authorize deletion.
|
|
380
|
+
if (row.schema === 2 && row.preOpen?.fingerprint === base.fingerprint && row.preOpen.fileId === base.fileId && row.preOpen.baseVersion === revision &&
|
|
381
|
+
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])
|
|
382
|
+
found.add(match[2]);
|
|
383
|
+
}
|
|
384
|
+
catch { }
|
|
385
|
+
}
|
|
386
|
+
return found;
|
|
387
|
+
}
|
|
332
388
|
/** Another context's unresolved operation may still need this checkout's private view. */
|
|
333
|
-
checkoutReferenced(context) {
|
|
334
|
-
const
|
|
389
|
+
checkoutReferenced(context, root = context.nativeCheckout?.root) {
|
|
390
|
+
const seen = new Set();
|
|
335
391
|
if (!root)
|
|
336
392
|
return false;
|
|
337
|
-
for (const row of this.db.prepare("SELECT data FROM requests WHERE context<>? AND state IN ('running','unknown')").all(context.id))
|
|
393
|
+
for (const row of this.db.prepare("SELECT data FROM requests WHERE context<>? AND state IN ('running','unknown','failed')").all(context.id)) {
|
|
394
|
+
const request = JSON.parse(String(row.data));
|
|
395
|
+
if (request.dropped || request.state === 'failed' && request.result?.outcome !== 'unknown')
|
|
396
|
+
continue;
|
|
338
397
|
for (const match of String(row.data).matchAll(/native:([a-f0-9]{64})/g))
|
|
339
398
|
seen.add(match[1]);
|
|
399
|
+
}
|
|
340
400
|
for (const sha of seen)
|
|
341
401
|
try {
|
|
342
402
|
const value = JSON.parse(readFileSync(join(this.directory, 'artifacts', sha + '.json'), 'utf8'));
|
|
343
|
-
if (value.source === 'checkout'
|
|
344
|
-
|
|
403
|
+
if (value.source === 'checkout') {
|
|
404
|
+
const referenced = value.checkout?.root;
|
|
405
|
+
if (typeof referenced !== 'string' || referenced === root || realpathSync(referenced) === realpathSync(root))
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
345
408
|
}
|
|
346
409
|
catch {
|
|
347
410
|
return true;
|
|
@@ -407,6 +470,7 @@ export class Workspace {
|
|
|
407
470
|
}
|
|
408
471
|
const request = { id: 'a_' + randomUUID(), operation, intent, state: 'accepted', ...(callerId ? { callerId } : {}), createdAt: now(), updatedAt: now() };
|
|
409
472
|
this.db.prepare('INSERT INTO administration_requests VALUES(?,?,?,?,?)').run(request.id, callerId ?? null, hash, request.state, bounded(request));
|
|
473
|
+
this.auditRequest(request);
|
|
410
474
|
return { request, replay: false };
|
|
411
475
|
});
|
|
412
476
|
}
|
|
@@ -449,6 +513,7 @@ export class Workspace {
|
|
|
449
513
|
fail('blocked', 'Administration operation already started; do not replay it.');
|
|
450
514
|
const next = { ...previous, state, ...(result === undefined ? {} : { result }), updatedAt: now() };
|
|
451
515
|
this.db.prepare('UPDATE administration_requests SET state=?,data=? WHERE id=?').run(state, bounded(next), request);
|
|
516
|
+
this.auditRequest(next);
|
|
452
517
|
return next;
|
|
453
518
|
});
|
|
454
519
|
}
|
|
@@ -464,6 +529,7 @@ export class Workspace {
|
|
|
464
529
|
fail('blocked', 'Request already started; reconcile its recorded outcome before continuing.');
|
|
465
530
|
const next = { ...previous, state: 'running', ...(execution === undefined ? {} : { execution }), updatedAt: now() };
|
|
466
531
|
this.db.prepare('UPDATE requests SET state=?,data=? WHERE id=?').run(next.state, bounded(next), next.id);
|
|
532
|
+
this.auditRequest(next);
|
|
467
533
|
return next;
|
|
468
534
|
});
|
|
469
535
|
}
|
|
@@ -481,6 +547,7 @@ export class Workspace {
|
|
|
481
547
|
fail('binding', 'Request must start before an effect can be acknowledged.');
|
|
482
548
|
const next = { ...previous, state, result, updatedAt: now() };
|
|
483
549
|
this.db.prepare('UPDATE requests SET state=?,data=? WHERE id=?').run(next.state, bounded(next), next.id);
|
|
550
|
+
this.auditRequest(next);
|
|
484
551
|
return next;
|
|
485
552
|
}
|
|
486
553
|
establishModel(target, revision, snapshot) {
|
|
@@ -602,6 +669,24 @@ export class Workspace {
|
|
|
602
669
|
return next;
|
|
603
670
|
});
|
|
604
671
|
}
|
|
672
|
+
/** Exactly proved native pre-call refusal: settle all journals together, retaining the private view. */
|
|
673
|
+
finishRefusedPublication(publication, observedRevision, sharedSnapshot, result) {
|
|
674
|
+
version(observedRevision);
|
|
675
|
+
this.knownSnapshot(sharedSnapshot);
|
|
676
|
+
return this.transaction(() => {
|
|
677
|
+
const previous = this.publication(publication), context = this.context(previous), request = this.request(previous.request), model = this.model(previous.target);
|
|
678
|
+
if (!['commit_intent', 'unknown'].includes(previous.state) || observedRevision <= previous.expectedRevision ||
|
|
679
|
+
observedRevision < (model.sharedRevision ?? 1) || context.generation !== previous.generation || context.workingSnapshot?.id !== previous.snapshot.id ||
|
|
680
|
+
context.nativeCheckout?.state !== 'active' || request.context !== context.id || request.operation !== 'ghidra.merge' ||
|
|
681
|
+
!['running', 'unknown'].includes(request.state))
|
|
682
|
+
fail('binding', 'Refused native publication no longer matches its retained intent.');
|
|
683
|
+
const next = { ...previous, state: 'conflict', detail: result };
|
|
684
|
+
this.db.prepare('UPDATE ghidra_models SET data=? WHERE target=?').run(stable({ ...model, state: 'ready', sharedRevision: observedRevision, sharedSnapshot }), previous.target);
|
|
685
|
+
this.db.prepare('UPDATE publications SET state=?,data=? WHERE id=?').run(next.state, bounded(next), next.id);
|
|
686
|
+
this.writeRequest(previous.request, 'failed', result);
|
|
687
|
+
return next;
|
|
688
|
+
});
|
|
689
|
+
}
|
|
605
690
|
publishedSince(target, revision) {
|
|
606
691
|
this.target(target);
|
|
607
692
|
version(revision);
|
|
@@ -611,6 +696,49 @@ export class Workspace {
|
|
|
611
696
|
saveContext(scope, expectedGeneration, patch) {
|
|
612
697
|
return this.transaction(() => this.writeContext(scope, expectedGeneration, patch));
|
|
613
698
|
}
|
|
699
|
+
/** Independent release readback and its no-publication request outcome become visible together. */
|
|
700
|
+
retainNativeDisposal(scope, generation, checkout, snapshot, request) {
|
|
701
|
+
return this.transaction(() => {
|
|
702
|
+
const context = this.context(scope);
|
|
703
|
+
if (checkout.state !== 'verified' || stable(context.nativeCheckout) !== stable(checkout))
|
|
704
|
+
fail('binding', 'Native disposal ownership changed before retention.');
|
|
705
|
+
const { opened, ...binding } = checkout, active = { ...binding, state: 'active' };
|
|
706
|
+
this.knownSnapshot(snapshot);
|
|
707
|
+
const saved = object(JSON.parse(readFileSync(this.artifacts.path(snapshot), 'utf8')));
|
|
708
|
+
if (snapshot.kind !== 'native' || saved.engine !== 'native-checkout-v1' || saved.source !== 'checkout' || stable(saved.checkout) !== stable(active) ||
|
|
709
|
+
saved.fileId !== active.fileId || saved.version !== active.baseVersion || typeof saved.fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(saved.fingerprint))
|
|
710
|
+
fail('binding', 'Retained native receipt differs from independently observed checkout ownership.');
|
|
711
|
+
if (request) {
|
|
712
|
+
const pending = this.request(request);
|
|
713
|
+
if (pending.context !== context.id || pending.operation !== 'ghidra.merge' || !['running', 'unknown'].includes(pending.state) || object(pending.execution ?? {}).kind !== 'native-merge')
|
|
714
|
+
fail('binding', 'Retained disposal does not match an unfinished native merge request.');
|
|
715
|
+
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')
|
|
716
|
+
fail('blocked', 'A publication outcome cannot be replaced by retained empty disposal.');
|
|
717
|
+
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);
|
|
718
|
+
const owner = JSON.parse(readFileSync(join(checkout.root, 'native-owner.json'), 'utf8'));
|
|
719
|
+
if (q.operation !== 'update' || q.request !== request || q.root !== checkout.root || q.fileId !== checkout.fileId || q.checkoutId !== checkout.checkoutId || stable(q.owner) !== stable(owner) ||
|
|
720
|
+
updated.state !== 'updated' || updated.checkoutId !== checkout.checkoutId || updated.baseVersion !== checkout.baseVersion || view.fileId !== checkout.fileId || view.version !== checkout.baseVersion ||
|
|
721
|
+
typeof view.fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(view.fingerprint))
|
|
722
|
+
fail('binding', 'Retained disposal lacks its completed owned native Update.');
|
|
723
|
+
try {
|
|
724
|
+
readFileSync(join(checkout.root, 'operations', request + '-checkin.json'));
|
|
725
|
+
fail('blocked', 'A native check-in intent cannot become retained empty disposal.');
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
if (error.code !== 'ENOENT')
|
|
729
|
+
throw error;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
else if (this.unresolved(scope).some(pending => pending.operation === 'ghidra.merge'))
|
|
733
|
+
fail('blocked', 'Retained native disposal requires its unfinished merge request identity.');
|
|
734
|
+
const result = { session: scope.session, target: scope.target, state: 'retained', engine: 'ghidra-native', checkout: 'retained',
|
|
735
|
+
retention: { schema: 1, source: 'native-release-status', checkout: active, snapshot, ...(request ? { request } : {}) } };
|
|
736
|
+
this.writeContext(scope, generation, { nativeCheckout: active, workingSnapshot: snapshot, state: 'stopped' });
|
|
737
|
+
if (request)
|
|
738
|
+
this.writeRequest(request, 'failed', result);
|
|
739
|
+
return result;
|
|
740
|
+
});
|
|
741
|
+
}
|
|
614
742
|
/** Terminal abandonment retains the previous outcome and saved view atomically. */
|
|
615
743
|
abandonProgramRequest(scope, request, generation) {
|
|
616
744
|
return this.transaction(() => {
|
package/package.json
CHANGED
|
@@ -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.
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
package/references/debugger.md
CHANGED
|
@@ -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
|
|
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,
|
|
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.
|
|
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
|