@eyeauras/insight-cli 0.8.2 → 0.8.4
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/README.md +53 -7
- package/SKILL.md +4 -8
- package/dist/src/administration.js +1 -1
- package/dist/src/archive.js +1 -1
- package/dist/src/artifacts.d.ts +2 -1
- package/dist/src/artifacts.js +6 -5
- package/dist/src/binary.js +1 -1
- package/dist/src/capture.js +3 -3
- package/dist/src/cli.js +17 -16
- package/dist/src/contexts.js +14 -17
- package/dist/src/cross.js +1 -1
- package/dist/src/debugger.js +1 -1
- package/dist/src/die.js +1 -1
- package/dist/src/dnspy.js +1 -1
- package/dist/src/dotnet-diagnostics.js +1 -1
- package/dist/src/ilspy.js +1 -1
- package/dist/src/lifecycle.js +5 -5
- package/dist/src/lldb.js +1 -1
- package/dist/src/llvm.js +1 -1
- package/dist/src/managed-heap.js +1 -1
- package/dist/src/managed-metadata.js +1 -1
- package/dist/src/mitmproxy.js +1 -1
- package/dist/src/model.d.ts +6 -1
- package/dist/src/model.js +9 -2
- package/dist/src/mutations.js +1 -1
- package/dist/src/projects.js +3 -3
- package/dist/src/prototype-cli.js +4 -4
- package/dist/src/research.js +1 -1
- package/dist/src/runtime-manager.d.ts +2 -2
- package/dist/src/runtime-manager.js +28 -4
- package/dist/src/sdk-files.js +3 -3
- package/dist/src/sdk.js +1 -1
- package/dist/src/server.d.ts +1 -0
- package/dist/src/server.js +17 -7
- package/dist/src/sevenzip.js +1 -1
- package/dist/src/strace.js +1 -1
- package/dist/src/sync-policy.js +4 -4
- package/dist/src/tool-runtime/identity.d.ts +7 -0
- package/dist/src/tool-runtime/identity.js +35 -0
- package/dist/src/tool-runtime/store.js +3 -0
- package/dist/src/tool-runtime/supervisor.d.ts +8 -0
- package/dist/src/tool-runtime/supervisor.js +58 -10
- package/dist/src/tshark.js +1 -1
- package/dist/src/ui.js +3 -3
- package/dist/src/version-tracking.js +2 -2
- package/dist/src/windbg.js +1 -1
- package/dist/src/work/backup.js +17 -5
- package/dist/src/work/commands.js +51 -14
- package/dist/src/work/model.d.ts +43 -1
- package/dist/src/work/model.js +128 -0
- package/dist/src/work/store.d.ts +34 -3
- package/dist/src/work/store.js +78 -21
- package/dist/src/work/timing.d.ts +9 -0
- package/dist/src/work/timing.js +10 -1
- package/package.json +1 -1
- package/references/agent-setup.md +2 -11
- package/references/debugger.md +1 -1
- package/references/managed-runtime.md +1 -2
- package/references/native/InsightNativeCheckout.java +24 -8
- package/references/recovery.md +2 -34
- package/references/research.md +5 -5
- package/references/setup.md +0 -4
- package/references/work-tracking.md +61 -3
- package/skill-bundle/insight-artifacts/SKILL.md +3 -7
- package/skill-bundle/insight-artifacts/references/recovery.md +2 -34
- package/skill-bundle/insight-binary/SKILL.md +3 -7
- package/skill-bundle/insight-capture/SKILL.md +3 -7
- package/skill-bundle/insight-cli/SKILL.md +4 -8
- package/skill-bundle/insight-cli/references/agent-setup.md +2 -11
- package/skill-bundle/insight-cli/references/managed-runtime.md +1 -2
- package/skill-bundle/insight-cli/references/recovery.md +2 -34
- package/skill-bundle/insight-cli/references/setup.md +0 -4
- package/skill-bundle/insight-die/SKILL.md +3 -7
- package/skill-bundle/insight-dnspy/SKILL.md +3 -7
- package/skill-bundle/insight-dotnet-dump/SKILL.md +3 -7
- package/skill-bundle/insight-dotnet-stack/SKILL.md +3 -7
- package/skill-bundle/insight-dotnet-trace/SKILL.md +3 -7
- package/skill-bundle/insight-frida/SKILL.md +3 -7
- package/skill-bundle/insight-ghidra/SKILL.md +13 -36
- package/skill-bundle/insight-ghidra/references/debugger.md +1 -1
- package/skill-bundle/insight-ghidra/references/managed-runtime.md +1 -2
- package/skill-bundle/insight-ghidra/references/recovery.md +2 -34
- package/skill-bundle/insight-ghidra/references/research.md +5 -5
- package/skill-bundle/insight-ghidra/references/setup.md +0 -4
- package/skill-bundle/insight-ilspy/SKILL.md +3 -7
- package/skill-bundle/insight-interop/SKILL.md +3 -7
- package/skill-bundle/insight-lldb/SKILL.md +3 -7
- package/skill-bundle/insight-llvm/SKILL.md +3 -7
- package/skill-bundle/insight-managed-heap/SKILL.md +3 -7
- package/skill-bundle/insight-managed-metadata/SKILL.md +3 -7
- package/skill-bundle/insight-mitmproxy/SKILL.md +3 -7
- package/skill-bundle/insight-overview/SKILL.md +3 -7
- package/skill-bundle/insight-procmon/SKILL.md +3 -7
- package/skill-bundle/insight-re/SKILL.md +4 -8
- package/skill-bundle/insight-re/references/recovery.md +2 -34
- package/skill-bundle/insight-re/references/work-tracking.md +61 -3
- package/skill-bundle/insight-sevenzip/SKILL.md +3 -7
- package/skill-bundle/insight-strace/SKILL.md +3 -7
- package/skill-bundle/insight-tshark/SKILL.md +3 -7
- package/skill-bundle/insight-windbg/SKILL.md +3 -7
- package/skill-bundle/manifest.json +1 -1
- package/skills/insight-artifacts/SKILL.md +3 -7
- package/skills/insight-artifacts/references/recovery.md +2 -34
- package/skills/insight-binary/SKILL.md +3 -7
- package/skills/insight-capture/SKILL.md +3 -7
- package/skills/insight-die/SKILL.md +3 -7
- package/skills/insight-dnspy/SKILL.md +3 -7
- package/skills/insight-dotnet-dump/SKILL.md +3 -7
- package/skills/insight-dotnet-stack/SKILL.md +3 -7
- package/skills/insight-dotnet-trace/SKILL.md +3 -7
- package/skills/insight-frida/SKILL.md +3 -7
- package/skills/insight-ghidra/SKILL.md +13 -36
- package/skills/insight-ghidra/references/debugger.md +1 -1
- package/skills/insight-ghidra/references/managed-runtime.md +1 -2
- package/skills/insight-ghidra/references/recovery.md +2 -34
- package/skills/insight-ghidra/references/research.md +5 -5
- package/skills/insight-ghidra/references/setup.md +0 -4
- package/skills/insight-ilspy/SKILL.md +3 -7
- package/skills/insight-interop/SKILL.md +3 -7
- package/skills/insight-lldb/SKILL.md +3 -7
- package/skills/insight-llvm/SKILL.md +3 -7
- package/skills/insight-managed-heap/SKILL.md +3 -7
- package/skills/insight-managed-metadata/SKILL.md +3 -7
- package/skills/insight-mitmproxy/SKILL.md +3 -7
- package/skills/insight-overview/SKILL.md +3 -7
- package/skills/insight-procmon/SKILL.md +3 -7
- package/skills/insight-re/SKILL.md +4 -8
- package/skills/insight-re/references/recovery.md +2 -34
- package/skills/insight-re/references/work-tracking.md +61 -3
- package/skills/insight-sevenzip/SKILL.md +3 -7
- package/skills/insight-strace/SKILL.md +3 -7
- package/skills/insight-tshark/SKILL.md +3 -7
- package/skills/insight-windbg/SKILL.md +3 -7
package/dist/src/work/store.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { id as checkedId } from '../model.js';
|
|
1
2
|
import { timingReport } from './timing.js';
|
|
2
3
|
import { DatabaseSync } from 'node:sqlite';
|
|
3
4
|
import { chmodSync, existsSync, lstatSync } from 'node:fs';
|
|
@@ -5,7 +6,7 @@ import { join } from 'node:path';
|
|
|
5
6
|
import { randomUUID } from 'node:crypto';
|
|
6
7
|
import { createHash } from 'node:crypto';
|
|
7
8
|
import { openSync, writeSync, fsyncSync, closeSync, unlinkSync } from 'node:fs';
|
|
8
|
-
import { archivedOutcomes, array, definition, digest, fail, leaseToken, identifier, integer, object, passport, sha, stable, string, reviewState } from './model.js';
|
|
9
|
+
import { discoverLimits, discoveryReport, taskKinds, archivedOutcomes, array, definition, digest, fail, leaseToken, identifier, integer, object, passport, sha, stable, string, reviewState } from './model.js';
|
|
9
10
|
export const workTableColumns = {
|
|
10
11
|
projects: ['id', 'data'], functions: ['project', 'id', 'rva', 'stage', 'data'], tasks: ['id', 'project', 'status', 'data'],
|
|
11
12
|
locks: ['project', 'resource', 'task'], events: ['seq', 'project', 'revision', 'kind', 'data'], receipts: ['id', 'result'],
|
|
@@ -111,7 +112,7 @@ export class WorkStore {
|
|
|
111
112
|
affected.add(project);
|
|
112
113
|
}
|
|
113
114
|
for (const id of affected) {
|
|
114
|
-
const project = this.project(id), reason = '
|
|
115
|
+
const project = this.project(id), reason = 'Migration added direct graph reservations; legacy scopes require replanning.';
|
|
115
116
|
const cancelledTasks = this.invalidateTasks(project, reason).length;
|
|
116
117
|
this.invalidatePackages(project, reason);
|
|
117
118
|
this.event(project, 'resources.migrated', { reason, cancelledTasks });
|
|
@@ -140,10 +141,12 @@ export class WorkStore {
|
|
|
140
141
|
const active = this.db.prepare("SELECT data FROM tasks WHERE status IN ('queued','leased')").all();
|
|
141
142
|
for (const row of active) {
|
|
142
143
|
const task = JSON.parse(String(row.data));
|
|
144
|
+
if (task.kind === 'discover')
|
|
145
|
+
continue;
|
|
143
146
|
const held = new Set(task.resources);
|
|
144
147
|
const missing = task.functions.filter(fn => this.derivedResources(task.project, fn, 10001).some(key => !held.has(key)));
|
|
145
148
|
if (missing.length)
|
|
146
|
-
this.invalidateTasks(this.project(task.project), 'New writer evidence expanded the reserved scope', new Set(missing));
|
|
149
|
+
this.invalidateTasks(this.project(task.project), 'New writer evidence expanded the reserved scope', new Set(missing), true);
|
|
147
150
|
}
|
|
148
151
|
this.db.prepare("INSERT INTO work_metadata VALUES('writer_scope_check','1')").run();
|
|
149
152
|
}, true);
|
|
@@ -213,7 +216,8 @@ export class WorkStore {
|
|
|
213
216
|
fail('staleEpoch', 'This epoch belongs to another work incarnation; read a fresh brief.');
|
|
214
217
|
}
|
|
215
218
|
cancelled(task) {
|
|
216
|
-
fail('taskCancelled', 'Task was cancelled and cannot be resumed; request new work with work next.', { task: task.id, reason: task.result, functions: task.functions, retry: `work next --kind ${task.kind} --functions ${task.functions.join(',')}`
|
|
219
|
+
fail('taskCancelled', 'Task was cancelled and cannot be resumed; request new work with work next.', { task: task.id, reason: task.result, functions: task.functions, retry: `work next --kind ${task.kind} --functions ${task.functions.join(',')}` + (task.discover ?
|
|
220
|
+
` --strategy ${task.discover.strategy} --direction ${task.discover.direction} --max-depth ${task.discover.maxDepth} --max-functions ${task.discover.maxFunctions}` : '') });
|
|
217
221
|
}
|
|
218
222
|
planning(project, expected, epoch) {
|
|
219
223
|
this.checkEpoch(project, epoch);
|
|
@@ -232,17 +236,22 @@ export class WorkStore {
|
|
|
232
236
|
if (task.status !== 'leased' || task.worker !== identifier(worker) || task.fence !== integer(fence, 1, Number.MAX_SAFE_INTEGER)
|
|
233
237
|
|| task.leaseUntil <= this.clock())
|
|
234
238
|
fail('staleLease', 'Lease is expired, reclaimed or belongs to another worker.');
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
// A discovery changes no function: reconstruction of its roots meanwhile does not make it stale.
|
|
240
|
+
if (task.kind !== 'discover')
|
|
241
|
+
for (const id of task.functions)
|
|
242
|
+
if (this.function(task.project, id).version !== task.versions[id])
|
|
243
|
+
fail('staleFunction', 'Assigned function changed since planning; preserve work and re-plan.');
|
|
238
244
|
return task;
|
|
239
245
|
}
|
|
240
|
-
|
|
246
|
+
/** `reservations`: the cause concerns reserved packages or resources only, which a discovery never holds. */
|
|
247
|
+
invalidateTasks(project, reason, functionIds, reservations = false) {
|
|
241
248
|
const ids = [];
|
|
242
249
|
for (const row of this.db.prepare("SELECT data FROM tasks WHERE project=? AND status IN ('queued','leased') ORDER BY id").all(project.id)) {
|
|
243
250
|
const task = JSON.parse(String(row.data));
|
|
244
251
|
if (functionIds && !task.functions.some(id => functionIds.has(id)))
|
|
245
252
|
continue;
|
|
253
|
+
if (reservations && task.kind === 'discover')
|
|
254
|
+
continue;
|
|
246
255
|
const previous = { ...task };
|
|
247
256
|
task.status = 'cancelled';
|
|
248
257
|
task.fence = integer(task.fence + 1, 1, Number.MAX_SAFE_INTEGER);
|
|
@@ -330,7 +339,7 @@ export class WorkStore {
|
|
|
330
339
|
.all(project.id, functionId, integer(after, 0, Number.MAX_SAFE_INTEGER), integer(limit, 1, 1000) + 1);
|
|
331
340
|
return { project: project.id, function: functionId, items: rows.slice(0, limit).map(row => ({ version: Number(row.version), data: JSON.parse(String(row.data)),
|
|
332
341
|
reason: String(row.reason), at: Number(row.at), request: row.request === null ? null : String(row.request) })),
|
|
333
|
-
nextAfterVersion: rows.length > limit ? Number(rows[limit - 1].version) : null, historyScope: 'Retained
|
|
342
|
+
nextAfterVersion: rows.length > limit ? Number(rows[limit - 1].version) : null, historyScope: 'Retained ledger versions; earlier package history is available only where legacy events captured it.' };
|
|
334
343
|
});
|
|
335
344
|
}
|
|
336
345
|
/** Explicitly withdraw a current approval without inventing a definition/source change. */
|
|
@@ -396,7 +405,7 @@ export class WorkStore {
|
|
|
396
405
|
}
|
|
397
406
|
}
|
|
398
407
|
create(projectId, targetId, name) {
|
|
399
|
-
const id = identifier(projectId), target = this.workspace.target(targetId);
|
|
408
|
+
const id = identifier(projectId), target = this.workspace.target(checkedId(targetId, '--target'));
|
|
400
409
|
if (this.db.prepare('SELECT 1 FROM projects WHERE id=?').get(id))
|
|
401
410
|
fail('conflict', 'Project ID already exists.');
|
|
402
411
|
const project = { id, target: target.id, binarySha256: target.binarySha256, name: string(name), revision: 1, planningRevision: 1, epoch: this.incarnation,
|
|
@@ -453,14 +462,18 @@ export class WorkStore {
|
|
|
453
462
|
}
|
|
454
463
|
static reworkSql = `(stage IN ('discovered','mismatch') OR stage='partial' AND (json_extract(data,'$.source') IS NULL
|
|
455
464
|
OR json_extract(data,'$.invalidated') IS NOT NULL OR json_extract(data,'$.review.approved')=0))`;
|
|
456
|
-
plan(projectId, expectedRevision, count, kind, selected, afterRva = -1, epoch, excludeAuthor) {
|
|
465
|
+
plan(projectId, expectedRevision, count, kind, selected, afterRva = -1, epoch, excludeAuthor, discover) {
|
|
457
466
|
const project = this.project(projectId);
|
|
458
467
|
this.planning(project, expectedRevision, epoch);
|
|
459
468
|
count = integer(count, 1, 50);
|
|
460
|
-
if (!
|
|
461
|
-
fail('invalid', 'Task kind is reconstruct or
|
|
469
|
+
if (!taskKinds.includes(kind))
|
|
470
|
+
fail('invalid', 'Task kind is reconstruct, review or discover.');
|
|
462
471
|
if (selected && (!selected.length || selected.length > count || new Set(selected).size !== selected.length))
|
|
463
472
|
fail('scope', 'Explicit function selection must contain 1..count unique IDs.');
|
|
473
|
+
if (kind === 'discover')
|
|
474
|
+
return this.planDiscovery(project, selected, discover);
|
|
475
|
+
if (discover)
|
|
476
|
+
fail('invalid', 'Traversal options apply only to --kind discover.');
|
|
464
477
|
// Explicit reconstruct selection may rework any package that is not reviewed/reconstructed;
|
|
465
478
|
// automatic selection serves new functions first, then packages that need rework.
|
|
466
479
|
const eligible = (fn) => kind === 'review' ? WorkStore.reviewable(fn)
|
|
@@ -547,6 +560,25 @@ export class WorkStore {
|
|
|
547
560
|
this.event(project, 'task.planned', { task });
|
|
548
561
|
return { task, revision: project.revision };
|
|
549
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* A discovery task reads the call graph around explicit roots and changes no function, so it reserves nothing:
|
|
565
|
+
* reconstruction and review of the same functions continue meanwhile.
|
|
566
|
+
*/
|
|
567
|
+
planDiscovery(project, roots, scope) {
|
|
568
|
+
if (!roots)
|
|
569
|
+
fail('invalid', 'Discovery needs explicit root function IDs: --functions.');
|
|
570
|
+
if (!scope)
|
|
571
|
+
fail('invalid', 'Discovery needs its traversal scope.');
|
|
572
|
+
if (roots.length > scope.maxFunctions)
|
|
573
|
+
fail('scope', 'Every root is visited: --max-functions must be at least the number of roots.');
|
|
574
|
+
const functions = roots.map(id => this.function(project.id, id));
|
|
575
|
+
const task = { id: 'w_' + randomUUID(), project: project.id, kind: 'discover', status: 'queued',
|
|
576
|
+
functions: functions.map(f => f.id), versions: Object.fromEntries(functions.map(f => [f.id, f.version])),
|
|
577
|
+
resources: [], fence: 0, leaseUntil: 0, createdAt: this.clock(), epoch: project.epoch, discover: scope };
|
|
578
|
+
this.db.prepare('INSERT INTO tasks VALUES(?,?,?,?)').run(task.id, project.id, task.status, stable(task));
|
|
579
|
+
this.event(project, 'task.planned', { task });
|
|
580
|
+
return { task, revision: project.revision };
|
|
581
|
+
}
|
|
550
582
|
claim(taskId, worker, ttl) {
|
|
551
583
|
const task = this.task(taskId), project = this.project(task.project);
|
|
552
584
|
worker = identifier(worker);
|
|
@@ -557,9 +589,10 @@ export class WorkStore {
|
|
|
557
589
|
fail('alreadyClaimed', 'Task is submitted or has an active lease.');
|
|
558
590
|
if (task.kind === 'review' && task.functions.some(id => this.function(task.project, id).author === worker))
|
|
559
591
|
fail('selfReview', 'Reviewer must differ from every reconstruction author in this slice.');
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
592
|
+
if (task.kind !== 'discover')
|
|
593
|
+
for (const id of task.functions)
|
|
594
|
+
if (this.function(task.project, id).version !== task.versions[id])
|
|
595
|
+
fail('staleFunction', 'Task inputs changed. Cancel this reservation and plan a fresh task.');
|
|
563
596
|
task.status = 'leased';
|
|
564
597
|
task.worker = worker;
|
|
565
598
|
task.fence = integer(task.fence + 1, 1, Number.MAX_SAFE_INTEGER);
|
|
@@ -569,7 +602,7 @@ export class WorkStore {
|
|
|
569
602
|
return { task, revision: project.revision, lease: leaseToken(task) };
|
|
570
603
|
}
|
|
571
604
|
/** Plan and claim one slice atomically at the current state; no observed revision is needed. */
|
|
572
|
-
next(projectId, worker, count, kind, ttl, epoch, selected) {
|
|
605
|
+
next(projectId, worker, count, kind, ttl, epoch, selected, discover) {
|
|
573
606
|
const project = this.project(projectId);
|
|
574
607
|
worker = identifier(worker);
|
|
575
608
|
if (selected)
|
|
@@ -579,7 +612,7 @@ export class WorkStore {
|
|
|
579
612
|
for (const id of selected)
|
|
580
613
|
if (!WorkStore.needsRework(this.function(project.id, id)))
|
|
581
614
|
fail('conflict', 'Function no longer needs rework (already resubmitted or awaiting review); take plain work next.', { function: id });
|
|
582
|
-
const planned = this.plan(project.id, project.revision, count, kind, selected, -1, epoch, worker);
|
|
615
|
+
const planned = this.plan(project.id, project.revision, count, kind, selected, -1, epoch, worker, discover);
|
|
583
616
|
return this.claim(planned.task.id, worker, ttl);
|
|
584
617
|
}
|
|
585
618
|
heartbeat(taskId, worker, fence, ttl, epoch) {
|
|
@@ -615,7 +648,7 @@ export class WorkStore {
|
|
|
615
648
|
submit(taskId, worker, fence, entries, epoch) {
|
|
616
649
|
const task = this.lease(taskId, worker, fence, epoch), project = this.project(task.project);
|
|
617
650
|
if (task.kind !== 'reconstruct')
|
|
618
|
-
fail('invalid', 'Use review for a review assignment.');
|
|
651
|
+
fail('invalid', task.kind === 'review' ? 'Use review for a review assignment.' : 'A discover assignment takes a discovery report.');
|
|
619
652
|
if (entries.length !== task.functions.length || new Set(entries.map(e => e.id)).size !== entries.length
|
|
620
653
|
|| entries.some(e => !task.functions.includes(e.id)))
|
|
621
654
|
fail('scope', 'Submission must cover exactly the assigned slice.');
|
|
@@ -642,6 +675,24 @@ export class WorkStore {
|
|
|
642
675
|
this.event(project, 'reconstruction.submitted', { task: task.id, worker, functions: entries.map(e => e.id) });
|
|
643
676
|
return { task, revision: project.revision, accepted1to1: false };
|
|
644
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Retains the discovery report of a leased discover task and completes it. Function stages and packages are
|
|
680
|
+
* untouched; newly found functions are registered only through an explicit work import.
|
|
681
|
+
*/
|
|
682
|
+
submitDiscovery(taskId, worker, fence, report, artifact, epoch) {
|
|
683
|
+
const task = this.lease(taskId, worker, fence, epoch), project = this.project(task.project);
|
|
684
|
+
if (task.kind !== 'discover' || !task.discover)
|
|
685
|
+
fail('invalid', 'Only a discover assignment takes a discovery report.');
|
|
686
|
+
if (integer(artifact.size, 1, Number.MAX_SAFE_INTEGER) > discoverLimits.reportBytes)
|
|
687
|
+
fail('limit', `A discovery report is at most ${discoverLimits.reportBytes} bytes.`);
|
|
688
|
+
const summary = discoveryReport(report, { task: task.id, binarySha256: project.binarySha256, roots: task.functions, scope: task.discover });
|
|
689
|
+
task.status = 'submitted';
|
|
690
|
+
task.leaseUntil = 0;
|
|
691
|
+
task.result = { report: artifact, ...summary, submittedAt: this.clock(), accepted1to1: false };
|
|
692
|
+
this.putTask(task);
|
|
693
|
+
this.event(project, 'discovery.submitted', { task: task.id, worker, report: artifact.sha256, visited: summary.visited, edges: summary.edges, frontier: summary.frontier });
|
|
694
|
+
return { task, revision: project.revision, accepted1to1: false };
|
|
695
|
+
}
|
|
645
696
|
review(taskId, worker, fence, decisions, epoch) {
|
|
646
697
|
const task = this.lease(taskId, worker, fence, epoch), project = this.project(task.project);
|
|
647
698
|
if (task.kind !== 'review')
|
|
@@ -789,7 +840,7 @@ export class WorkStore {
|
|
|
789
840
|
// assignments that froze those packages are cancelled. Nodes and rejected edges invalidate nothing.
|
|
790
841
|
const invalidated = affected.size ? this.invalidatePackages(project, 'Dependency graph changed at this function', affected) : new Set();
|
|
791
842
|
const replan = new Set([...invalidated, ...expanded]);
|
|
792
|
-
const cancelled = replan.size ? this.invalidateTasks(project, 'Dependency evidence changed the package or its exclusive reservations', replan) : [];
|
|
843
|
+
const cancelled = replan.size ? this.invalidateTasks(project, 'Dependency evidence changed the package or its exclusive reservations', replan, true) : [];
|
|
793
844
|
// Counts are exact; ID lists are bounded to the first 100 and say so.
|
|
794
845
|
const ids = (values) => { const all = [...values].sort(); return { ids: all.slice(0, 100), truncated: all.length > 100 }; };
|
|
795
846
|
const impact = { affectedFunctionIds: ids(affected), invalidatedPackageIds: ids(invalidated), cancelledTaskIds: ids(cancelled) };
|
|
@@ -906,6 +957,12 @@ export class WorkStore {
|
|
|
906
957
|
handoff(taskId) {
|
|
907
958
|
return this.tx(() => {
|
|
908
959
|
const task = this.task(taskId), project = this.project(task.project);
|
|
960
|
+
if (task.kind === 'discover')
|
|
961
|
+
return { project, task, functions: task.functions.map(id => this.function(project.id, id)), discover: task.discover,
|
|
962
|
+
instructions: ['Walk the call graph from these roots yourself, through Ghidra xrefs or a pinned graph inventory, within discover.',
|
|
963
|
+
'Visit each function once (module hash + RVA); roots are depth 0. Record calls you cannot resolve or that leave the depth/function limit as frontier.',
|
|
964
|
+
'State for every visited function where its xrefs came from and whether that observation was complete: empty xrefs do not prove no calls.',
|
|
965
|
+
'Submit one discovery-report with work submit. Register new functions only with work import. Another scope or strategy is a new task.'] };
|
|
909
966
|
return { project, task, functions: task.functions.map(id => this.function(project.id, id)),
|
|
910
967
|
instructions: ['Reconstruct only this assigned slice. Do not implement game/subsystems.',
|
|
911
968
|
'Preserve ABI, exact effects, errors, ordering, unknowns and source evidence.',
|
|
@@ -936,7 +993,7 @@ export class WorkStore {
|
|
|
936
993
|
const line = (value) => {
|
|
937
994
|
const data = Buffer.from(stable(value) + '\n');
|
|
938
995
|
if (data.length > 16 * 1024 * 1024 || bytes + data.length > 2 * 1024 * 1024 * 1024)
|
|
939
|
-
fail('limit', 'Work backup metadata exceeds the
|
|
996
|
+
fail('limit', 'Work backup metadata exceeds the record/total budget.');
|
|
940
997
|
let offset = 0;
|
|
941
998
|
while (offset < data.length)
|
|
942
999
|
offset += writeSync(fd, data, offset);
|
|
@@ -23,4 +23,13 @@ export declare function timingReport(db: DatabaseSync, project: string, selected
|
|
|
23
23
|
firstApprovalAt: number | null;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
+
discovery: {
|
|
27
|
+
task: string;
|
|
28
|
+
status: "queued" | "cancelled" | "leased" | "submitted";
|
|
29
|
+
roots: number;
|
|
30
|
+
scope: import("./model.js").DiscoverScope | undefined;
|
|
31
|
+
discoverMs: number | null;
|
|
32
|
+
visited: {} | null;
|
|
33
|
+
frontier: {} | null;
|
|
34
|
+
}[];
|
|
26
35
|
};
|
package/dist/src/work/timing.js
CHANGED
|
@@ -76,5 +76,14 @@ export function timingReport(db, project, selected) {
|
|
|
76
76
|
byFunction.set(row.function, summary);
|
|
77
77
|
}
|
|
78
78
|
const queue = db.prepare("SELECT json_extract(data,'$.kind') AS kind,status,count(*) AS count FROM tasks WHERE project=? AND status IN ('queued','leased') GROUP BY kind,status ORDER BY kind,status").all(project);
|
|
79
|
-
|
|
79
|
+
// Discovery is timed on its own: it has no review and changes no function. Its claim comes from the indexed events
|
|
80
|
+
// above (the predicate stays equal to the partial index); its end is the time retained with its report.
|
|
81
|
+
const discovery = db.prepare("SELECT data FROM tasks WHERE project=? AND json_extract(data,'$.kind')='discover' ORDER BY rowid DESC LIMIT 10")
|
|
82
|
+
.all(project).reverse().map(row => {
|
|
83
|
+
const task = JSON.parse(String(row.data)), clock = taskClock(task.id), result = (task.result ?? {});
|
|
84
|
+
const submittedAt = typeof result.submittedAt === 'number' ? result.submittedAt : undefined;
|
|
85
|
+
return { task: task.id, status: task.status, roots: task.functions.length, scope: task.discover, discoverMs: elapsed(clock.claim, submittedAt),
|
|
86
|
+
visited: result.visited ?? null, frontier: result.frontier ?? null };
|
|
87
|
+
});
|
|
88
|
+
return { rows, queue, selectedTasks: authors.length, batchToDecisionMs: complete ? elapsed(start, end) : null, byFunction: Object.fromEntries(byFunction), discovery };
|
|
80
89
|
}
|
package/package.json
CHANGED
|
@@ -52,17 +52,8 @@ Keep unrelated profiles outside the write scope and pass the assigned `--profile
|
|
|
52
52
|
Do not grant broad external network access merely to reach a local socket.
|
|
53
53
|
|
|
54
54
|
An inaccessible profile means readiness is unknown. Inspect access failures; stopping a shared
|
|
55
|
-
owner does not grant access to it.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## Behavioral acceptance
|
|
59
|
-
|
|
60
|
-
Give a fresh agent an input and business question without commands/tool names. Verify startup
|
|
61
|
-
metadata, implicit skill selection, intended public-tool use, correct findings, saved ordinary
|
|
62
|
-
project files and cleanup. Ghidra edits additionally require merge and independent readback.
|
|
63
|
-
Repeat cold-runtime and prepared-runtime cases; retain failures and distinguish an external-tool
|
|
64
|
-
fallback from acceptance of the intended adapter. Package/skill existence is structural evidence,
|
|
65
|
-
not proof that a model completed research.
|
|
55
|
+
owner does not grant access to it. A successful metadata call or filesystem grant alone does not
|
|
56
|
+
show that research commands will work.
|
|
66
57
|
|
|
67
58
|
The project bundle is a symlink. A plain `find` does not follow it and can misleadingly
|
|
68
59
|
show no files. Use the host skill inventory, a named `.../<skill>/SKILL.md` path, or
|
package/references/debugger.md
CHANGED
|
@@ -42,7 +42,7 @@ On macOS 15+ ARM64, GUI uses the private LLDB/Python dependency described in
|
|
|
42
42
|
compatible local LLDB and Python; select an executable supported by that host. GUI startup
|
|
43
43
|
prepares the Python wheels already supplied with Ghidra in owned storage; it does not install
|
|
44
44
|
packages into system Python. System-backend Python overrides and the Windows debugger
|
|
45
|
-
directory are Factory profile settings.
|
|
45
|
+
directory are Factory profile settings.
|
|
46
46
|
|
|
47
47
|
Use generated help for exact flags. A retained static breakpoint bookmark may remain after its live trace placement is
|
|
48
48
|
removed; `trace_location_count` distinguishes current placements from that static metadata.
|
|
@@ -135,8 +135,7 @@ bottles with native components (macOS 14+, ARM64 or x64); no installed Homebrew
|
|
|
135
135
|
and Windows x64 use the official Ghidra zip and Temurin archive. The installed `runtime/tool-catalog.json` pins mirror assets; repository
|
|
136
136
|
`scripts/tool-distributions/` recipes retain upstream provenance. Published tool releases include
|
|
137
137
|
original licenses/notices and required source/build companions, independent of CLI releases.
|
|
138
|
-
Unsupported platforms fail explicitly and may use compatible external profile paths.
|
|
139
|
-
acceptance for this delivery is macOS ARM64; catalog availability is not Windows/Linux native proof.
|
|
138
|
+
Unsupported platforms fail explicitly and may use compatible external profile paths.
|
|
140
139
|
|
|
141
140
|
The host provides Node/npm, OS frameworks, display/keychain access and debugger authorization.
|
|
142
141
|
On macOS 15+ ARM64 the managed debugger below supplies private LLDB/Python; Apple developer
|
|
@@ -46,6 +46,9 @@ public final class InsightNativeCheckout {
|
|
|
46
46
|
Files.move(temporary,path,StandardCopyOption.ATOMIC_MOVE,StandardCopyOption.REPLACE_EXISTING);
|
|
47
47
|
if(!System.getProperty("os.name").startsWith("Windows"))try(var channel=FileChannel.open(path.getParent(),StandardOpenOption.READ)){channel.force(true);}
|
|
48
48
|
}
|
|
49
|
+
/** Set before the first operation-journal write of the current request; after it, no refusal is "not sent". */
|
|
50
|
+
private static boolean intentStarted;
|
|
51
|
+
static void intent(Path journal,Object value)throws Exception {intentStarted=true;write(journal,value);}
|
|
49
52
|
static void source(Program p,JsonObject owner){
|
|
50
53
|
require(p.getExecutableSHA256().equals(text(owner,"sourceSha")),"Native source identity changed");
|
|
51
54
|
if(!p.getOptions("Insight").getString("Publication Engine","").equals("native-checkout-v1"))throw new InsightNativeMigration.Required();
|
|
@@ -262,6 +265,9 @@ public final class InsightNativeCheckout {
|
|
|
262
265
|
/** One native checkout operation. Per-request state is reset, so a long-lived service handles requests independently. */
|
|
263
266
|
static Map<String,Object> handle(Path requestFile){
|
|
264
267
|
Project project=null;GhidraServerManager server=null;
|
|
268
|
+
// The journal of an Update or check-in is written right before Ghidra is called. A refusal before this call began
|
|
269
|
+
// writing it, while the journal was positively absent when the request started, called nothing: "not sent".
|
|
270
|
+
boolean preCall=false;intentStarted=false;
|
|
265
271
|
Map<String,Object> out=new LinkedHashMap<>();
|
|
266
272
|
permitMerge=true;HeadlessProgramMergeManager.invocations=0;HeadlessProgramMergeManager.phases.clear();
|
|
267
273
|
try {
|
|
@@ -272,6 +278,8 @@ public final class InsightNativeCheckout {
|
|
|
272
278
|
require(owner.equals(q.getAsJsonObject("owner")),"Native owner receipt changed");
|
|
273
279
|
require(text(owner,"protocol").equals("native-checkout-v1")&&text(owner,"path").equals("/"+text(owner,"target")+".bin"),"Malformed native binding");
|
|
274
280
|
String operation=text(q,"operation"),path=text(owner,"path"),name=path.substring(1);
|
|
281
|
+
if(!abandoning&&(operation.equals("update")||operation.equals("checkin"))&&q.has("request")&&text(q,"request").matches("q_[a-f0-9-]{36}"))
|
|
282
|
+
preCall=Files.notExists(root.resolve("operations").resolve(text(q,"request")+"-"+operation+".json"),LinkOption.NOFOLLOW_LINKS);
|
|
275
283
|
server=new GhidraServerManager();server.connect();require(server.isConnected(),"Native repository disconnected");
|
|
276
284
|
RepositoryAdapter repository=server.server().getRepository(text(owner,"repository"));repository.connect();
|
|
277
285
|
require(repository.getUser().hasWritePermission()&&repository.getUser().getName().equals(System.getenv("GHIDRA_SERVER_USER")),"Publisher authority required");
|
|
@@ -289,7 +297,11 @@ public final class InsightNativeCheckout {
|
|
|
289
297
|
else project=manager.openProject(locator,false,false);
|
|
290
298
|
require(locator.getProjectDir().toPath().toRealPath().getParent().equals(root),"Native project moved outside owned storage");
|
|
291
299
|
var bound=project.getProjectData().getRepository();
|
|
292
|
-
|
|
300
|
+
// The binding is compared first: a reconnect synchronizes the project with whatever repository it names.
|
|
301
|
+
require(bound!=null&&bound.getName().equals(repository.getName())&&bound.getServerInfo().equals(repository.getServerInfo()),"Saved native repository binding changed");
|
|
302
|
+
// A saved project's connection can be inactive under load; it reconnects once to its own, verified repository.
|
|
303
|
+
if(!bound.isConnected())try{bound.connect();}catch(Exception reconnect){reconnect.printStackTrace(System.err);}
|
|
304
|
+
require(bound.isConnected(),"Saved native repository is not connected");
|
|
293
305
|
DomainFile file=project.getProjectData().getFile(path);require(file!=null,"Native file missing");
|
|
294
306
|
if(operation.equals("create")&&!file.isCheckedOut()){
|
|
295
307
|
String projectPath=ghidra.framework.store.ItemCheckoutStatus.getProjectPath(locator.toString(),false);
|
|
@@ -345,7 +357,7 @@ public final class InsightNativeCheckout {
|
|
|
345
357
|
intent.put("backupAbsent",keepAbsent);intent.put("backupBeforeFileId",priorKeepId);intent.put("backupExpected",backupExpected);
|
|
346
358
|
if(operation.equals("discard")){
|
|
347
359
|
var backupsBefore=backupInventory(project,name);intent.put("backupFilesBefore",backupsBefore);
|
|
348
|
-
|
|
360
|
+
intent(journal,intent);
|
|
349
361
|
file.undoCheckout(backupExpected);
|
|
350
362
|
out.put("state","discarded");out.put("retainedKeepFile","");
|
|
351
363
|
if(backupExpected){
|
|
@@ -360,7 +372,7 @@ public final class InsightNativeCheckout {
|
|
|
360
372
|
}
|
|
361
373
|
file=project.getProjectData().getFile(path);require(file.checkout(false,MONITOR),"Native checkout after discard was refused");
|
|
362
374
|
}else if(operation.equals("update")){
|
|
363
|
-
|
|
375
|
+
intent(journal,intent);
|
|
364
376
|
// Only dirty incoming Update can replace .keep. A refusal is a completed pre-call outcome,
|
|
365
377
|
// carried by the existing conflict/recovery path; incomplete/legacy intents remain unknown.
|
|
366
378
|
if(backupExpected&&!keepAbsent&&!replaceableBackup(project,operations,q,owner,base,intent)){
|
|
@@ -369,7 +381,7 @@ public final class InsightNativeCheckout {
|
|
|
369
381
|
var refusal=new LinkedHashMap<String,Object>(Map.of("schema",1,"operation","update","invoked",false,"reason","protected_existing_backup"));
|
|
370
382
|
refusal.put("fileId",priorKeepId);out.put("preCallRefusal",refusal);
|
|
371
383
|
}else{
|
|
372
|
-
if(intent.containsKey("backupReplacementProof"))
|
|
384
|
+
if(intent.containsKey("backupReplacementProof"))intent(journal,intent);
|
|
373
385
|
try{if(head>base)file.merge(false,MONITOR);
|
|
374
386
|
require(file.getCheckoutStatus().getCheckoutId()==checkout&&file.getCheckoutStatus().getCheckoutVersion()>=head,"Native Update did not establish the requested ancestry");
|
|
375
387
|
out.put("state","updated");}
|
|
@@ -382,11 +394,11 @@ public final class InsightNativeCheckout {
|
|
|
382
394
|
if(head!=base||head!=q.get("expectedVersion").getAsInt()){
|
|
383
395
|
// A known pre-call head race is not an unknown check-in: none was issued.
|
|
384
396
|
out.put("state","conflict");out.put("conflict","Shared head changed before native check-in");
|
|
385
|
-
intent.put("result",out);
|
|
397
|
+
intent.put("result",out);intent(journal,intent);
|
|
386
398
|
}else if(!file.modifiedSinceCheckout()){
|
|
387
|
-
intent.put("marker","insight native "+request);
|
|
399
|
+
intent.put("marker","insight native "+request);intent(journal,intent);out.put("state","empty");
|
|
388
400
|
}else{
|
|
389
|
-
intent.put("marker","insight native "+request);
|
|
401
|
+
intent.put("marker","insight native "+request);intent(journal,intent);
|
|
390
402
|
permitMerge=false;
|
|
391
403
|
try{file.checkin(new DefaultCheckinHandler("insight native "+request,true,false),MONITOR);out.put("state","checked_in");}
|
|
392
404
|
catch(HeadChanged changed){
|
|
@@ -405,7 +417,7 @@ public final class InsightNativeCheckout {
|
|
|
405
417
|
}
|
|
406
418
|
catch(Exception unproved){/* An unreadable backup remains private; it cannot invalidate native completion. */}
|
|
407
419
|
}
|
|
408
|
-
intent.put("result",out);
|
|
420
|
+
intent.put("result",out);intent(journal,intent);
|
|
409
421
|
}
|
|
410
422
|
}else if(operation.equals("release")){
|
|
411
423
|
Path releaseFile=root.resolve("released.json");
|
|
@@ -466,6 +478,10 @@ public final class InsightNativeCheckout {
|
|
|
466
478
|
try{if(project!=null)project.close();}catch(Throwable cleanup){poisoned=true;}
|
|
467
479
|
try{if(server!=null)server.disconnect();}catch(Throwable cleanup){poisoned=true;}
|
|
468
480
|
if(java.awt.Window.getWindows().length>0)poisoned=true;
|
|
481
|
+
// A migration requirement keeps its own diagnosis.
|
|
482
|
+
if(preCall&&!intentStarted&&!(failure instanceof Error)&&!(failure instanceof InsightNativeMigration.Required)){
|
|
483
|
+
var refused=new LinkedHashMap<String,Object>(unknown(failure));refused.put("code","not-sent");return refused;
|
|
484
|
+
}
|
|
469
485
|
return unknown(failure);}
|
|
470
486
|
}
|
|
471
487
|
}
|
package/references/recovery.md
CHANGED
|
@@ -27,7 +27,7 @@ preserve the project and any `.keep` file.
|
|
|
27
27
|
|
|
28
28
|
A Ghidra session that ends abruptly can leave unsaved changes as Ghidra recovery data in the
|
|
29
29
|
working copy. Opening the program would delete them, so `ghidra open` and every native
|
|
30
|
-
operation refuse with `blocked` and name the two ways out
|
|
30
|
+
operation refuse with `blocked` and name the two ways out; run either with the context closed:
|
|
31
31
|
`ghidra changes recover-unsaved --session <id> --target <id>` has Ghidra restore those changes
|
|
32
32
|
and save them into the working copy; `ghidra changes discard-unsaved --session <id> --target <id>`
|
|
33
33
|
(Destructive) has Ghidra delete them. Saved work stays in both cases, nothing is published, and
|
|
@@ -201,51 +201,19 @@ without replay. Unproved native work stays blocked and retained. An unproved pro
|
|
|
201
201
|
storage and credential store. Do not delete another session's project, stop a process by guessed
|
|
202
202
|
PID/port, or blindly repeat a script/external action to turn uncertainty into success.
|
|
203
203
|
|
|
204
|
-
The older prototype's `workers`, `findings`, `integrate` and batch `recover` commands are not the
|
|
205
|
-
public facade API. Its coordinator journals remain separate and are never silently migrated.
|
|
206
|
-
|
|
207
204
|
A lost UI navigation response can be verified from the live authenticated cursor without another
|
|
208
205
|
goto. If its original owned GUI process has exited, continuation reports the uncertain UI action
|
|
209
206
|
as disconnected and retains saved program work. It does not recreate the old cursor or re-enable
|
|
210
207
|
a previous prompt policy. Other unproved live UI effects remain retained until their outcome is
|
|
211
208
|
established or the original process is known to have ended.
|
|
212
209
|
|
|
213
|
-
## Native unknown attempts
|
|
210
|
+
## Native unknown attempts
|
|
214
211
|
|
|
215
212
|
For native contexts the snapshot-based `ghidra abandon` rollback is unsupported: replacing the
|
|
216
213
|
DB from a detached snapshot would lose native ancestry and could discard acknowledged private
|
|
217
214
|
work. Preserve the original project/journal and reconcile provable effects. Do not use discard,
|
|
218
215
|
GC, another request ID or a new server checkout as evidence that an unknown script did nothing.
|
|
219
216
|
|
|
220
|
-
The historical snapshot-based abandonment contract below applies only to its retained legacy
|
|
221
|
-
fixtures, not to native contexts admitted by the primary CLI.
|
|
222
|
-
|
|
223
|
-
### Historical detached abandonment
|
|
224
|
-
|
|
225
|
-
A post-mutation save timeout does not repeat the script or issue another save in the
|
|
226
|
-
error handler. Status exposes the original request identity and retained phase/budget.
|
|
227
|
-
Arbitrary script effects are never inferred from metadata or from an unverified DB.
|
|
228
|
-
After inspecting the retained attempt, explicitly stop only its verified owned worker
|
|
229
|
-
(`tools processes`, then `tools processes kill <process>` if required). Resume the
|
|
230
|
-
last acknowledged private snapshot with:
|
|
231
|
-
|
|
232
|
-
```sh
|
|
233
|
-
insight-cli permissions grant Destructive
|
|
234
|
-
insight-cli ghidra abandon --session <session> --target <target> \
|
|
235
|
-
--request-id <original-request> --acknowledge-unknown-effects --json
|
|
236
|
-
insight-cli ghidra open --session <session> --target <target> --json
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
Abandon requires exactly one unresolved private program operation, an unchanged verified
|
|
240
|
-
previous snapshot/generation, a stopped original worker and no active publication or live
|
|
241
|
-
debugger. It retains the native project, candidate artifacts, original intent/execution and
|
|
242
|
-
previous diagnostic result. Its terminal request is `failed` / `state: abandoned` with
|
|
243
|
-
`outcome: unknown`; no effect is marked applied. Repeating abandonment retrieves the same
|
|
244
|
-
result. Earlier saved private edits remain pending. The original changing request ID cannot
|
|
245
|
-
execute again. Abandoning never undoes external effects or establishes what an arbitrary
|
|
246
|
-
script did; the acknowledgement explicitly accepts that uncertainty. Publication recovery,
|
|
247
|
-
initial import, UI and debugger attempts use their own protocols and cannot use this command.
|
|
248
|
-
|
|
249
217
|
## Explicit legacy migration
|
|
250
218
|
|
|
251
219
|
Legacy models require `ghidra migrate --target <target> --dry-run`, then the same
|
package/references/research.md
CHANGED
|
@@ -40,23 +40,23 @@ text) represents a null/absent comment. Successful edits are checked by readback
|
|
|
40
40
|
`applied`. A later read sees the local result; another session remains independent. These edits
|
|
41
41
|
do not publish themselves. Use `ghidra merge` to publish the selected context explicitly.
|
|
42
42
|
|
|
43
|
-
Another session retains its saved native checkout until `ghidra refresh`. The service
|
|
44
|
-
worker and calls native Update on that same project: checkout identity survives, the base advances,
|
|
43
|
+
Another session retains its saved native checkout until `ghidra refresh`. The service closes the
|
|
44
|
+
worker's project (keeping its JVM when possible) and calls native Update on that same project: checkout identity survives, the base advances,
|
|
45
45
|
and local changes merge through Ghidra. Native conflicts reject the whole Update and retain the
|
|
46
46
|
original working copy/base. Status reports the native conflict description. The legacy scalar
|
|
47
47
|
`--resolve-conflict` option is unsupported for native decisions; no coordinator winner is invented.
|
|
48
48
|
|
|
49
49
|
Types, signatures, structures and other analysis edits use Ghidra's stock resolvers and native
|
|
50
50
|
checkout change sets. Divergence alone is not a category conflict. `ghidra merge` performs native
|
|
51
|
-
Update, then journaled check-in
|
|
52
|
-
|
|
51
|
+
Update, then journaled check-in; Ghidra's check-in result establishes the publication, and only a
|
|
52
|
+
lost check-in reply is settled from repository history. By default the context then stays open: check-in keeps the checkout, and
|
|
53
53
|
the context continues in it at the published version, so an agent can merge repeatedly during one
|
|
54
54
|
long session without reopening. Backups that Update left and its journals prove disposable are
|
|
55
55
|
removed. `ghidra merge --close` (or a kept checkout that cannot be proved unchanged) releases and
|
|
56
56
|
drops the project instead; continued work then receives a fresh checkout. During Update/check-in the
|
|
57
57
|
warm worker only closes its project and reopens it afterwards at the new base, so the next command
|
|
58
58
|
needs no new JVM (a worker that ran agent scripts, or whose project cannot be proved released or
|
|
59
|
-
reopened, restarts
|
|
59
|
+
reopened, restarts); worker/owner restart before publication reopens the same project without packed-snapshot
|
|
60
60
|
import.
|
|
61
61
|
|
|
62
62
|
Ordinary saves retain the native DB and lightweight saved-view receipts. Full packed exports are
|
package/references/setup.md
CHANGED
|
@@ -81,10 +81,6 @@ reason `runtime_changed` when its context is next used, and an unused one stops
|
|
|
81
81
|
`contextIdleMinutes` (default 15, range 1–1440). `maxContexts` (default 4, range 1–16) bounds the
|
|
82
82
|
workers kept at once; at that limit the longest-idle one is stopped first.
|
|
83
83
|
|
|
84
|
-
Native acceptance separates macOS GUI/LLDB workflows from selected headless Windows/Linux
|
|
85
|
-
SDK, Version Tracking and FID/BSim workflows. Native Windows/Linux debugger/GUI acceptance
|
|
86
|
-
remains deferred. CI stays offline and refuses native proofs.
|
|
87
|
-
|
|
88
84
|
On macOS 15+ ARM64, `ghidra install` delivers an owned LLDB/Python debugger backend;
|
|
89
85
|
OS debugger authorization remains required. Other host profiles need their supported debugger. Its
|
|
90
86
|
Ghidra Python dependencies are prepared from the installed SDK wheels into owned GUI storage.
|
|
@@ -11,9 +11,15 @@ insight-cli -p RE work create --project client --target TARGET --name Client --r
|
|
|
11
11
|
insight-cli -p RE work context --project client --json
|
|
12
12
|
insight-cli -p RE work import --project client --file functions.json --request-id import-page-1 --json
|
|
13
13
|
insight-cli -p RE work next --project client --worker agent-a --count 10 --request-id agent-a-next-1 --json
|
|
14
|
-
insight-cli -p RE work handoff --lease LEASE --json
|
|
14
|
+
insight-cli -p RE work handoff --lease LEASE --materialize task-a --json
|
|
15
|
+
# write each <rva>/<rva>.cpp and <rva>/<rva>.contract.json named in task-a/submission.json
|
|
15
16
|
insight-cli -p RE work heartbeat --lease LEASE --request-id agent-a-renew-1 --json
|
|
16
|
-
insight-cli -p RE work submit --lease LEASE --file submission.json --request-id agent-a-submit-1 --json
|
|
17
|
+
insight-cli -p RE work submit --lease LEASE --file task-a/submission.json --request-id agent-a-submit-1 --json
|
|
18
|
+
insight-cli -p RE work next --project client --worker agent-b --kind review --request-id agent-b-next-1 --json
|
|
19
|
+
insight-cli -p RE work handoff --lease LEASE --materialize review-b --json
|
|
20
|
+
# decide "approved" and write the note for every entry of review-b/review-manifest.json
|
|
21
|
+
insight-cli -p RE work review --lease LEASE --file review-b/review-manifest.json --request-id agent-b-review-1 --json
|
|
22
|
+
insight-cli -p RE work brief --project client --json
|
|
17
23
|
insight-cli -p RE work dashboard --project client --json
|
|
18
24
|
```
|
|
19
25
|
|
|
@@ -145,7 +151,7 @@ revision, including functions, dependency records, assignments, events and origi
|
|
|
145
151
|
Its final record and returned SHA identify the complete export; artifact payloads remain external.
|
|
146
152
|
This is a checkpoint projection, not automatic restore or a whole-profile backup.
|
|
147
153
|
|
|
148
|
-
|
|
154
|
+
The ledger separates event `revision` from the latest planning barrier `planningRevision`. `next` does not
|
|
149
155
|
need an observed revision. The existing
|
|
150
156
|
`--expect-revision` accepts an observation between that barrier and the current revision.
|
|
151
157
|
Heartbeat/claim/release do not change the barrier; structural changes and competing plans do.
|
|
@@ -178,6 +184,58 @@ local receipt after a lost ACK. No native context is restored and strict accepte
|
|
|
178
184
|
If a caller label has outcomes from several incarnations, `work request` marks it ambiguous and
|
|
179
185
|
returns `histories`; every outcome is retained and none authorizes a new mutation.
|
|
180
186
|
|
|
187
|
+
## Discovery
|
|
188
|
+
|
|
189
|
+
A `discover` task asks one worker to map the call graph around explicit roots of the project's
|
|
190
|
+
module. Work stores the assignment and the report; the worker walks the graph itself, through Ghidra
|
|
191
|
+
xrefs or a pinned graph inventory. Work starts no agent and no native traversal.
|
|
192
|
+
|
|
193
|
+
```text
|
|
194
|
+
insight-cli -p RE work next --project client --worker agent-c --kind discover --functions fn:SHA:00401000,fn:SHA:00402000 --strategy breadth --direction callees --max-depth 2 --max-functions 50 --request-id agent-c-next-1 --json
|
|
195
|
+
insight-cli -p RE work handoff --lease LEASE --materialize discover-c --json
|
|
196
|
+
# fill discover-c/discovery-report.json: model, visited, edges, frontier, summary
|
|
197
|
+
insight-cli -p RE work submit --lease LEASE --file discover-c/discovery-report.json --request-id agent-c-submit-1 --json
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`--strategy` is `breadth` (BFS, default) or `depth` (DFS); `--direction` is `callees` (default),
|
|
201
|
+
`callers` or `both`; `--max-depth` counts the roots as 0 (default 2, at most 16); `--max-functions`
|
|
202
|
+
counts every visited function including the roots (default 50, at most 500), so it is at least the
|
|
203
|
+
number of roots. Up to 50 roots fit `--count`. A discovery reserves nothing: reconstruction and review of the same functions continue,
|
|
204
|
+
and their new versions do not make it stale; new writer evidence does not cancel it, a revised root
|
|
205
|
+
definition does. A cancelled discovery's `result.retry` repeats its traversal options. Leases, fences, heartbeat, release and cancel work as
|
|
206
|
+
for other tasks. Another scope, strategy or depth is a new task.
|
|
207
|
+
|
|
208
|
+
The report (`discovery-report.json`, at most 2 MiB) names its task, module and the model it reads:
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{"schema":1,"kind":"discovery-report","task":"w_…","binarySha256":"<module sha256>",
|
|
212
|
+
"model":{"source":"ghidra","revision":"R387"},
|
|
213
|
+
"visited":[{"function":"fn:<sha>:00401000","name":"root","depth":0,"xrefs":{"source":"ghidra references-from","complete":true}},
|
|
214
|
+
{"function":"fn:<sha>:00403000","depth":1,"xrefs":{"source":"ghidra references-from","complete":false}}],
|
|
215
|
+
"edges":[{"source":"fn:<sha>:00401000","target":"fn:<sha>:00403000","kind":"direct","evidence":"CALL at 0x401020"}],
|
|
216
|
+
"frontier":[{"reason":"unresolved-indirect","from":"fn:<sha>:00403000","evidence":"CALL [RAX+0x18] at 0x403044"}],
|
|
217
|
+
"summary":"Two levels of callees from the network dispatcher.",
|
|
218
|
+
"recommended":["fn:<sha>:00403000"]}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- `visited`: each function once, by full module hash and RVA. The assigned roots, and only they, sit at
|
|
222
|
+
depth 0; depths stay within `--max-depth` and the list within `--max-functions`.
|
|
223
|
+
- `xrefs` on every visited function states where its references came from and whether that
|
|
224
|
+
observation was complete. An empty or incomplete xref list does not prove that a function calls
|
|
225
|
+
nothing.
|
|
226
|
+
- `edges`: `direct` or `indirect`, with evidence; each touches a visited function, none repeats. Every
|
|
227
|
+
non-root visit at depth N is reached by an edge from depth N-1 in the assigned direction: caller →
|
|
228
|
+
callee for `callees`, callee → caller for `callers`, either for `both`.
|
|
229
|
+
- `frontier`: why the walk stopped there: `depth-limit` or `function-limit` (with the next
|
|
230
|
+
`function`), `unresolved-indirect`, or `external` (a call into another module, named in
|
|
231
|
+
`function` as text). `from` is a visited function.
|
|
232
|
+
- `recommended`: up to 50 functions worth taking next.
|
|
233
|
+
|
|
234
|
+
Submit retains the report as an artifact of the task and completes it; `handoff --task ID`,
|
|
235
|
+
`work events` and `work export` show it, and `work evidence` verifies its payload. Function stages
|
|
236
|
+
and packages do not change: register newly found functions with `work import`. `work timing`
|
|
237
|
+
lists the latest ten discoveries separately.
|
|
238
|
+
|
|
181
239
|
## Context, migration and timing
|
|
182
240
|
|
|
183
241
|
Start with `work context` to read the CLI version, profile and Work schema. Add
|