@eyeauras/insight-cli 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.cli-package-build.json +1 -1
  2. package/SKILL.md +1 -1
  3. package/dist/src/analysis-storage.d.ts +2 -1
  4. package/dist/src/analysis-storage.js +71 -7
  5. package/dist/src/context-diagnostics.d.ts +1 -1
  6. package/dist/src/context-diagnostics.js +1 -1
  7. package/dist/src/contexts.d.ts +1 -0
  8. package/dist/src/contexts.js +63 -5
  9. package/dist/src/ghidra-processes.js +6 -1
  10. package/dist/src/initial-model.d.ts +3 -2
  11. package/dist/src/initial-model.js +23 -15
  12. package/dist/src/server.d.ts +1 -0
  13. package/dist/src/server.js +5 -2
  14. package/dist/src/tool-runtime/java-arguments.js +2 -2
  15. package/dist/src/tool-runtime/native-process-proof.d.ts +2 -0
  16. package/dist/src/tool-runtime/native-process-proof.js +26 -0
  17. package/dist/src/tool-runtime/run.js +3 -3
  18. package/dist/src/tool-runtime/store.d.ts +2 -0
  19. package/dist/src/tool-runtime/store.js +26 -8
  20. package/dist/src/tool-runtime/supervisor.js +4 -4
  21. package/package.json +1 -1
  22. package/references/native/InsightInitialImport.java +2 -2
  23. package/references/native/InsightInitialJournal.java +9 -0
  24. package/references/native/InsightInitialPublication.java +1 -1
  25. package/references/native/InsightInitialRecovery.java +131 -0
  26. package/references/recovery.md +25 -0
  27. package/references/storage.md +11 -0
  28. package/runtime/native/process-identity-darwin-arm64 +0 -0
  29. package/runtime/native/process-identity-darwin.c +47 -0
  30. package/runtime/native/process-identity.provenance.json +18 -0
  31. package/skill-bundle/insight-artifacts/SKILL.md +1 -1
  32. package/skill-bundle/insight-artifacts/references/recovery.md +25 -0
  33. package/skill-bundle/insight-artifacts/references/storage.md +11 -0
  34. package/skill-bundle/insight-binary/SKILL.md +1 -1
  35. package/skill-bundle/insight-capture/SKILL.md +1 -1
  36. package/skill-bundle/insight-cli/SKILL.md +1 -1
  37. package/skill-bundle/insight-cli/references/recovery.md +25 -0
  38. package/skill-bundle/insight-cli/references/storage.md +11 -0
  39. package/skill-bundle/insight-die/SKILL.md +1 -1
  40. package/skill-bundle/insight-dnspy/SKILL.md +1 -1
  41. package/skill-bundle/insight-dotnet-dump/SKILL.md +1 -1
  42. package/skill-bundle/insight-dotnet-stack/SKILL.md +1 -1
  43. package/skill-bundle/insight-dotnet-trace/SKILL.md +1 -1
  44. package/skill-bundle/insight-frida/SKILL.md +1 -1
  45. package/skill-bundle/insight-ghidra/SKILL.md +4 -1
  46. package/skill-bundle/insight-ghidra/references/recovery.md +25 -0
  47. package/skill-bundle/insight-ghidra/references/storage.md +11 -0
  48. package/skill-bundle/insight-ilspy/SKILL.md +1 -1
  49. package/skill-bundle/insight-interop/SKILL.md +1 -1
  50. package/skill-bundle/insight-lldb/SKILL.md +1 -1
  51. package/skill-bundle/insight-llvm/SKILL.md +1 -1
  52. package/skill-bundle/insight-managed-heap/SKILL.md +1 -1
  53. package/skill-bundle/insight-managed-metadata/SKILL.md +1 -1
  54. package/skill-bundle/insight-mitmproxy/SKILL.md +1 -1
  55. package/skill-bundle/insight-overview/SKILL.md +1 -1
  56. package/skill-bundle/insight-procmon/SKILL.md +1 -1
  57. package/skill-bundle/insight-re/SKILL.md +1 -1
  58. package/skill-bundle/insight-re/references/recovery.md +25 -0
  59. package/skill-bundle/insight-re/references/storage.md +11 -0
  60. package/skill-bundle/insight-sevenzip/SKILL.md +1 -1
  61. package/skill-bundle/insight-strace/SKILL.md +1 -1
  62. package/skill-bundle/insight-tshark/SKILL.md +1 -1
  63. package/skill-bundle/insight-windbg/SKILL.md +1 -1
  64. package/skill-bundle/manifest.json +1 -1
  65. package/skills/insight-artifacts/SKILL.md +1 -1
  66. package/skills/insight-artifacts/references/recovery.md +25 -0
  67. package/skills/insight-artifacts/references/storage.md +11 -0
  68. package/skills/insight-binary/SKILL.md +1 -1
  69. package/skills/insight-capture/SKILL.md +1 -1
  70. package/skills/insight-die/SKILL.md +1 -1
  71. package/skills/insight-dnspy/SKILL.md +1 -1
  72. package/skills/insight-dotnet-dump/SKILL.md +1 -1
  73. package/skills/insight-dotnet-stack/SKILL.md +1 -1
  74. package/skills/insight-dotnet-trace/SKILL.md +1 -1
  75. package/skills/insight-frida/SKILL.md +1 -1
  76. package/skills/insight-ghidra/SKILL.md +4 -1
  77. package/skills/insight-ghidra/references/recovery.md +25 -0
  78. package/skills/insight-ghidra/references/storage.md +11 -0
  79. package/skills/insight-ilspy/SKILL.md +1 -1
  80. package/skills/insight-interop/SKILL.md +1 -1
  81. package/skills/insight-lldb/SKILL.md +1 -1
  82. package/skills/insight-llvm/SKILL.md +1 -1
  83. package/skills/insight-managed-heap/SKILL.md +1 -1
  84. package/skills/insight-managed-metadata/SKILL.md +1 -1
  85. package/skills/insight-mitmproxy/SKILL.md +1 -1
  86. package/skills/insight-overview/SKILL.md +1 -1
  87. package/skills/insight-procmon/SKILL.md +1 -1
  88. package/skills/insight-re/SKILL.md +1 -1
  89. package/skills/insight-re/references/recovery.md +25 -0
  90. package/skills/insight-re/references/storage.md +11 -0
  91. package/skills/insight-sevenzip/SKILL.md +1 -1
  92. package/skills/insight-strace/SKILL.md +1 -1
  93. package/skills/insight-tshark/SKILL.md +1 -1
  94. package/skills/insight-windbg/SKILL.md +1 -1
@@ -11,7 +11,7 @@ class InsightInitialImport {
11
11
  public static void main(String[] args){var out=System.out;System.setOut(System.err);
12
12
  try{
13
13
  Path root=Path.of(args[0]);JsonObject p=InsightInitialJournal.intent(root);
14
- try(var channel=FileChannel.open(root.resolve("lock"),StandardOpenOption.CREATE,StandardOpenOption.WRITE);var lock=channel.tryLock()){
14
+ try(var channel=FileChannel.open(InsightInitialJournal.lockRoot(root).resolve("lock"),StandardOpenOption.CREATE,StandardOpenOption.WRITE);var lock=channel.tryLock()){
15
15
  if(lock==null){out.println("{\"state\":\"busy\"}");System.exit(0);}
16
16
  Path journal=root.resolve("import.json");
17
17
  if(Files.exists(journal)&&InsightInitialJournal.text(InsightInitialJournal.read(journal),"phase").equals("prepared")){
@@ -23,7 +23,7 @@ class InsightInitialImport {
23
23
  JsonObject s=new JsonObject();s.addProperty("intentHash",InsightInitialJournal.hash(root.resolve("intent.json")));
24
24
  s.addProperty("phase","importing");s.addProperty("pid",ProcessHandle.current().pid());s.addProperty("snapshot","attempt-"+UUID.randomUUID()+".gzf");
25
25
  Path attempt=root.resolve(InsightInitialJournal.text(s,"snapshot")+".json");InsightInitialJournal.write(attempt,s);InsightInitialJournal.write(journal,s);
26
- try(var progress=new InsightImportProgress(root,InsightInitialJournal.text(p,"target"))){
26
+ try(var progress=new InsightImportProgress(InsightInitialJournal.lockRoot(root),InsightInitialJournal.text(p,"target"))){
27
27
  progress.phase("runtime-initialization");
28
28
  Application.initializeApplication(new GhidraApplicationLayout(),new HeadlessGhidraApplicationConfiguration());
29
29
  JsonObject settings=p.getAsJsonObject("settings"),request=new JsonObject();
@@ -31,6 +31,15 @@ public class InsightInitialJournal {
31
31
  if(p.get("schema").getAsInt()!=1||!text(p,"target").matches("t_[a-f0-9]{32}")||!text(p,"id").matches("[a-f0-9-]{36}")||!text(p,"sha256").matches("[a-f0-9]{64}"))throw new SecurityException("Invalid initial-model identity");
32
32
  return p;
33
33
  }
34
+ /** Upgraded preparations share the original attempt's native lock. */
35
+ public static Path lockRoot(Path root)throws Exception{
36
+ JsonObject p=intent(root);if(!p.has("recoveryOf"))return root;
37
+ Path parent=root.getParent();JsonObject original=intent(parent);
38
+ if(!root.getFileName().toString().equals("runtime-"+text(p,"runtimeFingerprint"))||!text(p,"recoveryOf").equals(hash(parent.resolve("intent.json"))))throw new SecurityException("Recovery ancestry changed");
39
+ JsonObject expected=original.deepCopy();expected.add("id",p.get("id"));expected.add("runtimeFingerprint",p.get("runtimeFingerprint"));expected.add("recoveryOf",p.get("recoveryOf"));
40
+ if(!expected.equals(p))throw new SecurityException("Recovery immutable identity changed");
41
+ return parent;
42
+ }
34
43
  public static JsonObject prepared(Path root)throws Exception{
35
44
  JsonObject p=intent(root),s=read(root.resolve("import.json"));
36
45
  if(!text(s,"intentHash").equals(hash(root.resolve("intent.json")))||!text(s,"phase").equals("prepared"))throw new SecurityException("Import is not prepared");
@@ -54,7 +54,7 @@ class InsightInitialPublication {
54
54
  public static void main(String[] args){var out=System.out;System.setOut(System.err);
55
55
  try{
56
56
  Path root=Path.of(args[0]);String operation=args[1];boolean readOnly=operation.startsWith("verify");JsonObject p=InsightInitialJournal.intent(root);
57
- try(var channel=FileChannel.open(root.resolve("lock"),StandardOpenOption.CREATE,StandardOpenOption.WRITE);var lock=channel.tryLock()){
57
+ try(var channel=FileChannel.open(InsightInitialJournal.lockRoot(root).resolve("lock"),StandardOpenOption.CREATE,StandardOpenOption.WRITE);var lock=channel.tryLock()){
58
58
  if(lock==null){out.println("{\"state\":\"busy\"}");System.exit(0);}
59
59
  JsonObject saved=InsightInitialJournal.prepared(root);Path snapshot=root.resolve(text(saved,"snapshot")),journalPath=root.resolve("publication.json");
60
60
  JsonObject j=Files.exists(journalPath)?InsightInitialJournal.read(journalPath):null;
@@ -0,0 +1,131 @@
1
+ package db;
2
+
3
+ import com.google.gson.*;
4
+ import com.xebyte.headless.GhidraServerManager;
5
+ import db.buffers.InsightBlockTransfer;
6
+ import db.buffers.LocalBufferFile;
7
+ import ghidra.framework.store.local.ItemSerializer;
8
+ import ghidra.GhidraApplicationLayout;
9
+ import ghidra.framework.*;
10
+ import ghidra.framework.client.RepositoryAdapter;
11
+ import ghidra.framework.data.OpenMode;
12
+ import ghidra.framework.store.db.PackedDatabase;
13
+ import ghidra.program.database.ProgramDB;
14
+ import ghidra.util.task.TaskMonitor;
15
+ import insight.InsightInitialJournal;
16
+ import java.nio.file.*;
17
+ import java.nio.channels.*;
18
+ import java.util.*;
19
+
20
+ /** Read-only canonical recovery; only local preparation journals may be created here. */
21
+ class InsightInitialRecovery {
22
+ static String text(JsonObject p,String key){return InsightInitialJournal.text(p,key);}
23
+ static void stopped(Path root)throws Exception{
24
+ for(String name:List.of("import.json","publication.json"))if(Files.exists(root.resolve(name))){
25
+ var j=InsightInitialJournal.read(root.resolve(name));
26
+ if(j.has("pid")&&ProcessHandle.of(j.get("pid").getAsLong()).map(ProcessHandle::isAlive).orElse(false))
27
+ throw new IllegalStateException("Retained initial worker is live; no takeover");
28
+ }
29
+ }
30
+ static void quiescent(RepositoryAdapter repo,String name,String id,int revision)throws Exception{
31
+ var item=repo.getItem("/",name);
32
+ if(item==null||!id.equals(item.getFileID())||item.getVersion()!=revision||repo.isCheckinActive("/",name)||repo.getCheckouts("/",name).length!=0)
33
+ throw new IllegalStateException("Canonical revision or ownership changed");
34
+ var history=repo.getVersions("/",name);
35
+ if(Arrays.stream(history).noneMatch(v->v.getVersion()==revision)||
36
+ Arrays.stream(history).noneMatch(v->v.getVersion()==1&&("insight target "+name.substring(0,name.length()-4)).equals(v.getComment())))
37
+ throw new SecurityException("Canonical initial provenance is unproved");
38
+ }
39
+ static void buffers(RepositoryAdapter repo,String name,int version,Path path,String sha)throws Exception{
40
+ DBHandle saved=PackedDatabase.getPackedDatabase(path.toFile(),true,TaskMonitor.DUMMY).open(TaskMonitor.DUMMY);
41
+ DBHandle observed=new DBHandle(repo.openDatabase("/",name,version,-1));
42
+ try{
43
+ if(saved.getDatabaseId()!=observed.getDatabaseId()||!InsightBlockTransfer.fingerprint(saved.getBufferMgr().getSourceFile()).equals(InsightBlockTransfer.fingerprint(observed.getBufferMgr().getSourceFile())))
44
+ throw new SecurityException("Exact canonical buffers differ");
45
+ Object consumer=new Object();ProgramDB program=new ProgramDB(observed,OpenMode.IMMUTABLE,TaskMonitor.DUMMY,consumer);
46
+ try{if(!sha.equals(program.getExecutableSHA256()))throw new SecurityException("Canonical target changed");}finally{program.release(consumer);}
47
+ }finally{saved.close();observed.close();}
48
+ }
49
+ static void packExact(DBHandle db,Path path,String name)throws Exception{
50
+ // Program.saveToPackedFile / PackedDatabase.packDatabase allocate a fresh DB identity.
51
+ // Preserve the exact committed identity before serializing the same GZF container format.
52
+ Path raw=path.resolveSibling(path.getFileName()+".db");
53
+ LocalBufferFile file=new LocalBufferFile(raw.toFile(),db.getBufferSize());
54
+ try{db.saveAs(file,Long.valueOf(db.getDatabaseId()),false,TaskMonitor.DUMMY);}finally{file.dispose();}
55
+ try(var input=Files.newInputStream(raw)){
56
+ ItemSerializer.outputItem(name,"Program",0,Files.size(raw),input,path.toFile(),TaskMonitor.DUMMY);
57
+ }
58
+ Files.delete(raw);
59
+ }
60
+ static void settings(ProgramDB program,JsonObject p)throws Exception{
61
+ if(!program.getExecutableSHA256().equals(text(p,"sha256")))throw new SecurityException("Canonical source changed");
62
+ JsonObject settings=p.getAsJsonObject("settings");
63
+ if(settings.has("language")&&!program.getLanguageID().toString().equals(text(settings,"language"))||
64
+ settings.has("compilerSpec")&&!program.getCompilerSpec().getCompilerSpecID().toString().equals(text(settings,"compilerSpec"))||
65
+ settings.has("imageBase")&&!program.getImageBase().toString().replaceFirst("^0+(?!$)","").equals(text(settings,"imageBase")))
66
+ throw new SecurityException("Canonical load settings changed");
67
+ }
68
+ public static void main(String[] args){var out=System.out;System.setOut(System.err);
69
+ try{
70
+ Path root=Path.of(args[0]);String fingerprint=args[1],receipt=args[2];
71
+ if(!fingerprint.matches("[a-f0-9]{64}"))throw new SecurityException("Invalid runtime fingerprint");
72
+ JsonObject p=InsightInitialJournal.intent(root);String intentHash=InsightInitialJournal.hash(root.resolve("intent.json"));
73
+ try(var channel=FileChannel.open(root.resolve("lock"),StandardOpenOption.CREATE,StandardOpenOption.WRITE);var lock=channel.tryLock()){
74
+ if(lock==null){out.println("{\"state\":\"busy\"}");System.exit(0);}
75
+ stopped(root);
76
+ try(var children=Files.newDirectoryStream(root,"runtime-*")){for(Path child:children){
77
+ if(!Files.isDirectory(child,LinkOption.NOFOLLOW_LINKS)||!child.toRealPath().equals(child.toAbsolutePath().normalize()))throw new SecurityException();
78
+ stopped(child);
79
+ }}
80
+ Application.initializeApplication(new GhidraApplicationLayout(),new HeadlessGhidraApplicationConfiguration());
81
+ var manager=new GhidraServerManager();manager.connect();var repo=manager.server().getRepository(text(p,"repository"));repo.connect();
82
+ var user=repo.getUser();
83
+ if(user==null||!user.isReadOnly()||!user.getName().equals(text(p,"readerUser"))||!user.getName().equals(System.getenv("GHIDRA_SERVER_USER")))throw new SecurityException();
84
+ String name=text(p,"target")+".bin";var item=repo.getItem("/",name);
85
+ if(item==null){
86
+ if(!receipt.isEmpty()||repo.fileExists("/",name)||Files.exists(root.resolve("publication.json")))throw new SecurityException("Canonical absence or prior publication remains unproved");
87
+ // All earlier preparations remain retained; none may have a pending publication.
88
+ try(var children=Files.newDirectoryStream(root,"runtime-*")){for(Path child:children)if(!child.getFileName().toString().equals("runtime-"+fingerprint)&&Files.exists(child.resolve("publication.json")))throw new SecurityException("Earlier runtime publication requires reconciliation");}
89
+ Path next=root.resolve("runtime-"+fingerprint);Files.createDirectories(next);
90
+ if(!next.toRealPath().equals(next.toAbsolutePath().normalize()))throw new SecurityException();
91
+ Path intent=next.resolve("intent.json");
92
+ JsonObject expected=p.deepCopy();expected.addProperty("runtimeFingerprint",fingerprint);expected.addProperty("recoveryOf",intentHash);
93
+ if(Files.exists(intent)){
94
+ JsonObject actual=InsightInitialJournal.intent(next);expected.add("id",actual.get("id"));
95
+ if(!expected.equals(actual))throw new SecurityException("Runtime recovery intent changed");
96
+ }else{expected.addProperty("id",UUID.randomUUID().toString());InsightInitialJournal.write(intent,expected);}
97
+ out.println(new Gson().toJson(Map.of("state","absent","root",next.getFileName().toString())));System.exit(0);
98
+ }
99
+ String id=item.getFileID();int revision=item.getVersion();quiescent(repo,name,id,revision);
100
+ // A lost initial publication is reconciled against its exact R1, never inferred from latest alone.
101
+ List<Path> attempts=new ArrayList<>();attempts.add(root);
102
+ try(var children=Files.newDirectoryStream(root,"runtime-*")){for(Path child:children)attempts.add(child);}
103
+ for(Path attempt:attempts)if(Files.exists(attempt.resolve("publication.json"))){
104
+ var j=InsightInitialJournal.read(attempt.resolve("publication.json"));var saved=InsightInitialJournal.prepared(attempt);
105
+ if(!text(j,"intentHash").equals(InsightInitialJournal.hash(attempt.resolve("intent.json")))||!id.equals(j.has("fileId")?text(j,"fileId"):text(InsightInitialJournal.intent(attempt),"id"))||
106
+ !text(j,"snapshotSha256").equals(text(saved,"snapshotSha256")))throw new SecurityException("Prior publication identity remains unknown");
107
+ buffers(repo,name,1,attempt.resolve(text(saved,"snapshot")),text(p,"sha256"));
108
+ }
109
+ if(receipt.isEmpty()){
110
+ String token=UUID.randomUUID().toString(),snapshot="canonical-"+token+".gzf";Path path=root.resolve(snapshot);
111
+ DBHandle db=new DBHandle(repo.openDatabase("/",name,revision,-1));Object consumer=new Object();
112
+ try{ProgramDB program=new ProgramDB(db,OpenMode.IMMUTABLE,TaskMonitor.DUMMY,consumer);
113
+ try{settings(program,p);packExact(db,path,name);}finally{program.release(consumer);}
114
+ }finally{db.close();}
115
+ InsightInitialJournal.sync(path);quiescent(repo,name,id,revision);
116
+ JsonObject journal=new JsonObject();journal.addProperty("intentHash",intentHash);journal.addProperty("runtimeFingerprint",fingerprint);
117
+ journal.addProperty("fileId",id);journal.addProperty("version",revision);journal.addProperty("snapshot",snapshot);journal.addProperty("snapshotSha256",InsightInitialJournal.hash(path));
118
+ receipt="canonical-"+token+".json";InsightInitialJournal.write(root.resolve(receipt),journal);
119
+ journal.addProperty("receipt",receipt);journal.addProperty("state","candidate");out.println(journal);System.exit(0);
120
+ }
121
+ if(!receipt.matches("canonical-[a-f0-9-]{36}\\.json"))throw new SecurityException();
122
+ JsonObject proof=InsightInitialJournal.read(root.resolve(receipt));String snapshot=text(proof,"snapshot");
123
+ if(!snapshot.matches("canonical-[a-f0-9-]{36}\\.gzf")||!intentHash.equals(text(proof,"intentHash"))||!fingerprint.equals(text(proof,"runtimeFingerprint"))||
124
+ !id.equals(text(proof,"fileId"))||revision!=proof.get("version").getAsInt()||!text(proof,"snapshotSha256").equals(InsightInitialJournal.hash(root.resolve(snapshot))))throw new SecurityException("Canonical recovery receipt changed");
125
+ buffers(repo,name,revision,root.resolve(snapshot),text(p,"sha256"));quiescent(repo,name,id,revision);
126
+ proof.addProperty("state","verified");proof.addProperty("snapshotBuffersVerified",true);out.println(proof);
127
+ }
128
+ System.exit(0);
129
+ }catch(Throwable failure){failure.printStackTrace(System.err);out.println("{\"state\":\"unknown\"}");System.exit(0);}
130
+ }
131
+ }
@@ -24,6 +24,31 @@ establishes that the old owned bootstrap worker has ended, then uses an authorit
24
24
  probe. An absent canonical item permits private preparation; an existing first version requires
25
25
  independent readback. The old project, intent and original session/target remain preserved.
26
26
 
27
+ ## Unresponsive headless backend
28
+
29
+ Continue the same session/target with ordinary `ghidra open` or a research read. When the
30
+ backend fails its identity preflight, the facade verifies the acknowledged private snapshot
31
+ and independently authenticates the exact worker before retiring it and restoring that snapshot.
32
+ This automatic retirement is limited to headless contexts without uncertain mutations, active
33
+ publication or a connected debugger. A failed health preflight is never permission to repeat a
34
+ script, save or publication. Journals, original projects and acknowledged pending edits remain.
35
+ Lifecycle diagnostics record `backend_unresponsive` followed by snapshot restoration.
36
+
37
+ On macOS ARM64 the packaged read-only kernel helper checks the same-user process, executable,
38
+ private root and digest of its unique context token without entering the JVM. It emits no token,
39
+ argument list or environment values. PID birth and profile bindings remain independently checked.
40
+ A missing/unreadable/mismatched proof stays blocked; never kill by port, basename or guessed PID.
41
+ Other platforms retain their existing ownership authentication; this does not claim equivalent
42
+ hang recovery where no independent proof is available. No compiler is required on installation.
43
+
44
+ A bridge/runtime upgrade can also be continued in the original scope. The old immutable
45
+ intent remains retained. Recovery checks input/settings/authority, stopped native ownership
46
+ and publication journals first. Existing canonical research is recovered from its latest
47
+ committed revision through independent exact-version/full-buffer readback; private pending
48
+ edits stay private. A revision change or live checkout blocks adoption. Only an authoritative
49
+ absent path permits a separately journaled preparation under the current verified runtime,
50
+ using the original lock and conditional creation. An unknown publication still freezes recovery.
51
+
27
52
  ## Interrupted save or close
28
53
 
29
54
  After restoring profile storage, inspect the selected session and target with
@@ -84,6 +84,17 @@ those links or their profile/source ancestors manually after migrating.
84
84
 
85
85
  ## Interruptions, uncertainty and retention
86
86
 
87
+ If a completed migration no longer agrees with the Factory profile setting, ordinary
88
+ commands and `storage resume` fail. After inspecting `storage show`, explicitly restore
89
+ the setting with `storage resume --repair-profile --json`. This Update operation verifies
90
+ the journal, source/destination identities, destination ownership and every compatibility
91
+ link before changing only `analysisDirectory`. Later destination research is preserved;
92
+ the old migration manifest is not used to roll it back. A different selected location,
93
+ missing volume or replaced compatibility path blocks repair. Preserve conflicting paths
94
+ and restore the recorded links before retrying; repair never deletes or merges them.
95
+ Process-inventory failures are reported as `storage.inventory` with the original cause
96
+ available under `--verbose`. A terminal unavailable migration is never a successful resume.
97
+
87
98
  ```sh
88
99
  insight-cli storage resume --json
89
100
  insight-cli storage rollback --json
@@ -0,0 +1,47 @@
1
+ /* MIT; first-party read-only process proof. Never prints argv or environment values. */
2
+ #include <libproc.h>
3
+ #include <sys/sysctl.h>
4
+ #include <sys/proc_info.h>
5
+ #include <sys/proc.h>
6
+ #include <CommonCrypto/CommonDigest.h>
7
+ #include <unistd.h>
8
+ #include <stdio.h>
9
+ #include <stdlib.h>
10
+ #include <string.h>
11
+ #include <errno.h>
12
+ static void json(const char *s) {
13
+ putchar('"'); for(const unsigned char *p=(const unsigned char *)s;*p;p++) {
14
+ if(*p=='"'||*p=='\\')printf("\\%c",*p); else if(*p<32)printf("\\u%04x",*p);else putchar(*p);
15
+ } putchar('"');
16
+ }
17
+ int main(int argc,char **argv) {
18
+ if(argc==2&&!strcmp(argv[1],"--version")){puts("insight-process-identity 1");return 0;}
19
+ char *end=NULL;errno=0;long value=argc==2?strtol(argv[1],&end,10):0;
20
+ if(errno||!end||*end||value<1||value>2147483647)return 64;
21
+ int pid=(int)value;struct proc_bsdinfo before,after;char executable[PROC_PIDPATHINFO_MAXSIZE];
22
+ if(proc_pidinfo(pid,PROC_PIDTBSDINFO,0,&before,sizeof before)!=sizeof before||before.pbi_uid!=geteuid()||before.pbi_status==SZOMB)return 11;
23
+ memset(executable,0,sizeof executable);int has_path=proc_pidpath(pid,executable,sizeof executable)>0;
24
+ char owned_root[PROC_PIDPATHINFO_MAXSIZE]={0};
25
+ int mib[3]={CTL_KERN,KERN_PROCARGS2,pid};size_t size=0;
26
+ if(sysctl(mib,3,NULL,&size,NULL,0)||size<sizeof(int)||size>2*1024*1024)return 13;
27
+ char *data=calloc(size+1,1);if(!data)return 70;
28
+ if(sysctl(mib,3,data,&size,NULL,0)){free(data);return 14;}
29
+ int nargs;memcpy(&nargs,data,sizeof nargs);if(nargs<1||nargs>65536){free(data);return 1;}
30
+ char *p=data+sizeof(int),*limit=data+size;size_t executable_length=strnlen(p,(size_t)(limit-p));
31
+ if(executable_length>=sizeof executable||p+executable_length>=limit){free(data);return 1;}
32
+ if(!has_path)memcpy(executable,p,executable_length+1);
33
+ while(p<limit&&*p)p++;while(p<limit&&!*p)p++;
34
+ for(int i=0;i<nargs&&p<limit;i++){while(p<limit&&*p)p++;if(p<limit)p++;}
35
+ unsigned char digest[CC_SHA256_DIGEST_LENGTH];int found=0;const char key[]="GHIDRA_MCP_AUTH_TOKEN=";
36
+ while(p<limit&&!*p)p++;
37
+ while(p<limit&&*p){size_t n=strnlen(p,(size_t)(limit-p));
38
+ if(n>sizeof(key)-1&&!memcmp(p,key,sizeof(key)-1)){if(found){free(data);return 1;}CC_SHA256(p+sizeof(key)-1,(CC_LONG)(n-sizeof(key)+1),digest);found=1;}
39
+ const char root_key[]="GHIDRA_MCP_FILE_ROOT=";
40
+ if(n>sizeof(root_key)-1&&!memcmp(p,root_key,sizeof(root_key)-1)){size_t length=n-sizeof(root_key)+1;if(owned_root[0]||length>=sizeof owned_root){free(data);return 1;}memcpy(owned_root,p+sizeof(root_key)-1,length);}
41
+ p+=n+1;
42
+ }
43
+ memset(data,0,size);free(data);
44
+ if(!found||!owned_root[0]||proc_pidinfo(pid,PROC_PIDTBSDINFO,0,&after,sizeof after)!=sizeof after||before.pbi_start_tvsec!=after.pbi_start_tvsec||before.pbi_start_tvusec!=after.pbi_start_tvusec||before.pbi_uid!=after.pbi_uid)return 15;
45
+ printf("{\"pid\":%d,\"uid\":%u,\"birthSeconds\":%llu,\"birthMicroseconds\":%llu,\"executable\":",pid,before.pbi_uid,before.pbi_start_tvsec,before.pbi_start_tvusec);json(executable);
46
+ printf(",\"root\":");json(owned_root);printf(",\"tokenSha256\":\"");for(size_t i=0;i<sizeof digest;i++)printf("%02x",digest[i]);puts("\"}");return 0;
47
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "schema": 1,
3
+ "license": "MIT",
4
+ "platform": "darwin",
5
+ "architecture": "arm64",
6
+ "compiler": "Apple clang version 17.0.0 (clang-1700.3.19.1)\nTarget: arm64-apple-darwin25.6.0\nThread model: posix\nInstalledDir: /Library/Developer/CommandLineTools/usr/bin",
7
+ "sourceSha256": "f147da90168123783593f06461c78aea9e4b6ac326b7bdd003da1b0765a06265",
8
+ "sha256": "8d7a15c925ba49b8bea5280c94c03c5a9e39ac33f408ad6dcc068af095e796f4",
9
+ "flags": [
10
+ "-arch",
11
+ "arm64",
12
+ "-mmacosx-version-min=13.0",
13
+ "-O2",
14
+ "-g0",
15
+ "-Werror",
16
+ "-Wno-deprecated-declarations"
17
+ ]
18
+ }
@@ -3,7 +3,7 @@ name: insight-artifacts
3
3
  description: Retain a completed reverse-engineering evidence file or directory as an ordinary checkpoint using insight-cli artifacts save. Use after Ghidra or any external tool; preserve existing project formats and source of truth.
4
4
  ---
5
5
 
6
- # Insight Artifacts 0.5.4
6
+ # Insight Artifacts 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -24,6 +24,31 @@ establishes that the old owned bootstrap worker has ended, then uses an authorit
24
24
  probe. An absent canonical item permits private preparation; an existing first version requires
25
25
  independent readback. The old project, intent and original session/target remain preserved.
26
26
 
27
+ ## Unresponsive headless backend
28
+
29
+ Continue the same session/target with ordinary `ghidra open` or a research read. When the
30
+ backend fails its identity preflight, the facade verifies the acknowledged private snapshot
31
+ and independently authenticates the exact worker before retiring it and restoring that snapshot.
32
+ This automatic retirement is limited to headless contexts without uncertain mutations, active
33
+ publication or a connected debugger. A failed health preflight is never permission to repeat a
34
+ script, save or publication. Journals, original projects and acknowledged pending edits remain.
35
+ Lifecycle diagnostics record `backend_unresponsive` followed by snapshot restoration.
36
+
37
+ On macOS ARM64 the packaged read-only kernel helper checks the same-user process, executable,
38
+ private root and digest of its unique context token without entering the JVM. It emits no token,
39
+ argument list or environment values. PID birth and profile bindings remain independently checked.
40
+ A missing/unreadable/mismatched proof stays blocked; never kill by port, basename or guessed PID.
41
+ Other platforms retain their existing ownership authentication; this does not claim equivalent
42
+ hang recovery where no independent proof is available. No compiler is required on installation.
43
+
44
+ A bridge/runtime upgrade can also be continued in the original scope. The old immutable
45
+ intent remains retained. Recovery checks input/settings/authority, stopped native ownership
46
+ and publication journals first. Existing canonical research is recovered from its latest
47
+ committed revision through independent exact-version/full-buffer readback; private pending
48
+ edits stay private. A revision change or live checkout blocks adoption. Only an authoritative
49
+ absent path permits a separately journaled preparation under the current verified runtime,
50
+ using the original lock and conditional creation. An unknown publication still freezes recovery.
51
+
27
52
  ## Interrupted save or close
28
53
 
29
54
  After restoring profile storage, inspect the selected session and target with
@@ -84,6 +84,17 @@ those links or their profile/source ancestors manually after migrating.
84
84
 
85
85
  ## Interruptions, uncertainty and retention
86
86
 
87
+ If a completed migration no longer agrees with the Factory profile setting, ordinary
88
+ commands and `storage resume` fail. After inspecting `storage show`, explicitly restore
89
+ the setting with `storage resume --repair-profile --json`. This Update operation verifies
90
+ the journal, source/destination identities, destination ownership and every compatibility
91
+ link before changing only `analysisDirectory`. Later destination research is preserved;
92
+ the old migration manifest is not used to roll it back. A different selected location,
93
+ missing volume or replaced compatibility path blocks repair. Preserve conflicting paths
94
+ and restore the recorded links before retrying; repair never deletes or merges them.
95
+ Process-inventory failures are reported as `storage.inventory` with the original cause
96
+ available under `--verbose`. A terminal unavailable migration is never a successful resume.
97
+
87
98
  ```sh
88
99
  insight-cli storage resume --json
89
100
  insight-cli storage rollback --json
@@ -3,7 +3,7 @@ name: insight-binary
3
3
  description: Query structured PE, ELF and thin Mach-O headers, sections, imports and exports, or make an explicitly guarded new PE subsystem copy through insight-cli binary. Use for scoped binary structure, linkage and copy-only header edits without target execution.
4
4
  ---
5
5
 
6
- # Insight Binary 0.5.4
6
+ # Insight Binary 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-capture
3
3
  description: Capture one explicitly authorized native program run, exact stdout/stderr and declared file snapshots through insight-cli capture, then inspect or compare retained reports without replay. Use for controlled input/output research, preserving original files and interrupted or unknown outcomes.
4
4
  ---
5
5
 
6
- # Insight Capture 0.5.4
6
+ # Insight Capture 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-cli
3
3
  description: Choose and prepare reverse-engineering capabilities from the insight-cli toolbox for binary, managed-code and runtime investigations. Use to discover the appropriate tool or its packaged skill before installing native runtimes.
4
4
  ---
5
5
 
6
- # insight-cli 0.5.4
6
+ # insight-cli 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -24,6 +24,31 @@ establishes that the old owned bootstrap worker has ended, then uses an authorit
24
24
  probe. An absent canonical item permits private preparation; an existing first version requires
25
25
  independent readback. The old project, intent and original session/target remain preserved.
26
26
 
27
+ ## Unresponsive headless backend
28
+
29
+ Continue the same session/target with ordinary `ghidra open` or a research read. When the
30
+ backend fails its identity preflight, the facade verifies the acknowledged private snapshot
31
+ and independently authenticates the exact worker before retiring it and restoring that snapshot.
32
+ This automatic retirement is limited to headless contexts without uncertain mutations, active
33
+ publication or a connected debugger. A failed health preflight is never permission to repeat a
34
+ script, save or publication. Journals, original projects and acknowledged pending edits remain.
35
+ Lifecycle diagnostics record `backend_unresponsive` followed by snapshot restoration.
36
+
37
+ On macOS ARM64 the packaged read-only kernel helper checks the same-user process, executable,
38
+ private root and digest of its unique context token without entering the JVM. It emits no token,
39
+ argument list or environment values. PID birth and profile bindings remain independently checked.
40
+ A missing/unreadable/mismatched proof stays blocked; never kill by port, basename or guessed PID.
41
+ Other platforms retain their existing ownership authentication; this does not claim equivalent
42
+ hang recovery where no independent proof is available. No compiler is required on installation.
43
+
44
+ A bridge/runtime upgrade can also be continued in the original scope. The old immutable
45
+ intent remains retained. Recovery checks input/settings/authority, stopped native ownership
46
+ and publication journals first. Existing canonical research is recovered from its latest
47
+ committed revision through independent exact-version/full-buffer readback; private pending
48
+ edits stay private. A revision change or live checkout blocks adoption. Only an authoritative
49
+ absent path permits a separately journaled preparation under the current verified runtime,
50
+ using the original lock and conditional creation. An unknown publication still freezes recovery.
51
+
27
52
  ## Interrupted save or close
28
53
 
29
54
  After restoring profile storage, inspect the selected session and target with
@@ -84,6 +84,17 @@ those links or their profile/source ancestors manually after migrating.
84
84
 
85
85
  ## Interruptions, uncertainty and retention
86
86
 
87
+ If a completed migration no longer agrees with the Factory profile setting, ordinary
88
+ commands and `storage resume` fail. After inspecting `storage show`, explicitly restore
89
+ the setting with `storage resume --repair-profile --json`. This Update operation verifies
90
+ the journal, source/destination identities, destination ownership and every compatibility
91
+ link before changing only `analysisDirectory`. Later destination research is preserved;
92
+ the old migration manifest is not used to roll it back. A different selected location,
93
+ missing volume or replaced compatibility path blocks repair. Preserve conflicting paths
94
+ and restore the recorded links before retrying; repair never deletes or merges them.
95
+ Process-inventory failures are reported as `storage.inventory` with the original cause
96
+ available under `--verbose`. A terminal unavailable migration is never a successful resume.
97
+
87
98
  ```sh
88
99
  insight-cli storage resume --json
89
100
  insight-cli storage rollback --json
@@ -3,7 +3,7 @@ name: insight-die
3
3
  description: Classify unknown executable or container inputs by format, architecture and compiler/runtime/packer signatures with Detect It Easy before choosing managed or native analysis. Use insight-cli die for static triage and preserve scan uncertainty.
4
4
  ---
5
5
 
6
- # Insight Detect It Easy 0.5.4
6
+ # Insight Detect It Easy 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-dnspy
3
3
  description: Debug a managed Windows EXE at an IL breakpoint and read primitive arguments, or change one expected IL Int32 constant in a new assembly copy through insight-cli dnspy. Use when C# decompilation needs observed execution or a controlled binary edit.
4
4
  ---
5
5
 
6
- # Insight dnSpyEx 0.5.4
6
+ # Insight dnSpyEx 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-dotnet-dump
3
3
  description: Capture a managed heap dump or inspect compatible .NET dumps with SOS to recover waiting stacks, objects, fields and retention evidence.
4
4
  ---
5
5
 
6
- # Insight .NET Dump 0.5.4
6
+ # Insight .NET Dump 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-dotnet-stack
3
3
  description: Inspect live managed thread stacks to identify active or waiting work in an explicitly selected .NET process without taking a dump.
4
4
  ---
5
5
 
6
- # Insight .NET Stack 0.5.4
6
+ # Insight .NET Stack 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-dotnet-trace
3
3
  description: Collect and inspect bounded .NET EventPipe traces to identify sampled thread work, waits or runtime activity; distinguish wall-clock samples from CPU consumption.
4
4
  ---
5
5
 
6
- # Insight .NET Trace 0.5.4
6
+ # Insight .NET Trace 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-frida
3
3
  description: Observe native call arguments/results or inspect runtime modules and exports in an explicitly selected authorized process with bounded Frida scripts. Use insight-cli frida to corroborate static findings with actual execution on macOS ARM64.
4
4
  ---
5
5
 
6
- # Insight Frida 0.5.4
6
+ # Insight Frida 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-ghidra
3
3
  description: Inspect or edit native binaries with Ghidra through insight-cli; use isolated contexts, multi-agent merge/refresh, server, GUI or debugger workflows. Choose this for static native behavior and references, not C# recovery from managed IL.
4
4
  ---
5
5
 
6
- # Insight Ghidra 0.5.4
6
+ # Insight Ghidra 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -48,6 +48,9 @@ session context can still be opening. Inspect `sessions status` for context read
48
48
 
49
49
  Use `ghidra status` to inspect runtime readiness; `ghidra install` delivers the pinned runtime.
50
50
  For static managed C#/IL research, locate `insight-cli skill insight-ilspy`.
51
+ For an unresponsive headless backend, continue the same session/target with `ghidra open`;
52
+ the facade authenticates and retires eligible hung workers, restoring acknowledged private work.
53
+ Uncertain mutation/publication outcomes remain blocked; see [recovery](references/recovery.md).
51
54
  For owned process inventory use `tools processes`; `stop` saves Ghidra contexts, while
52
55
  `kill` explicitly interrupts verified owned work and preserves its journals.
53
56
  For archives, external launchers, server lifecycle or removal, read [managed runtime](references/managed-runtime.md).
@@ -24,6 +24,31 @@ establishes that the old owned bootstrap worker has ended, then uses an authorit
24
24
  probe. An absent canonical item permits private preparation; an existing first version requires
25
25
  independent readback. The old project, intent and original session/target remain preserved.
26
26
 
27
+ ## Unresponsive headless backend
28
+
29
+ Continue the same session/target with ordinary `ghidra open` or a research read. When the
30
+ backend fails its identity preflight, the facade verifies the acknowledged private snapshot
31
+ and independently authenticates the exact worker before retiring it and restoring that snapshot.
32
+ This automatic retirement is limited to headless contexts without uncertain mutations, active
33
+ publication or a connected debugger. A failed health preflight is never permission to repeat a
34
+ script, save or publication. Journals, original projects and acknowledged pending edits remain.
35
+ Lifecycle diagnostics record `backend_unresponsive` followed by snapshot restoration.
36
+
37
+ On macOS ARM64 the packaged read-only kernel helper checks the same-user process, executable,
38
+ private root and digest of its unique context token without entering the JVM. It emits no token,
39
+ argument list or environment values. PID birth and profile bindings remain independently checked.
40
+ A missing/unreadable/mismatched proof stays blocked; never kill by port, basename or guessed PID.
41
+ Other platforms retain their existing ownership authentication; this does not claim equivalent
42
+ hang recovery where no independent proof is available. No compiler is required on installation.
43
+
44
+ A bridge/runtime upgrade can also be continued in the original scope. The old immutable
45
+ intent remains retained. Recovery checks input/settings/authority, stopped native ownership
46
+ and publication journals first. Existing canonical research is recovered from its latest
47
+ committed revision through independent exact-version/full-buffer readback; private pending
48
+ edits stay private. A revision change or live checkout blocks adoption. Only an authoritative
49
+ absent path permits a separately journaled preparation under the current verified runtime,
50
+ using the original lock and conditional creation. An unknown publication still freezes recovery.
51
+
27
52
  ## Interrupted save or close
28
53
 
29
54
  After restoring profile storage, inspect the selected session and target with
@@ -84,6 +84,17 @@ those links or their profile/source ancestors manually after migrating.
84
84
 
85
85
  ## Interruptions, uncertainty and retention
86
86
 
87
+ If a completed migration no longer agrees with the Factory profile setting, ordinary
88
+ commands and `storage resume` fail. After inspecting `storage show`, explicitly restore
89
+ the setting with `storage resume --repair-profile --json`. This Update operation verifies
90
+ the journal, source/destination identities, destination ownership and every compatibility
91
+ link before changing only `analysisDirectory`. Later destination research is preserved;
92
+ the old migration manifest is not used to roll it back. A different selected location,
93
+ missing volume or replaced compatibility path blocks repair. Preserve conflicting paths
94
+ and restore the recorded links before retrying; repair never deletes or merges them.
95
+ Process-inventory failures are reported as `storage.inventory` with the original cause
96
+ available under `--verbose`. A terminal unavailable migration is never a successful resume.
97
+
87
98
  ```sh
88
99
  insight-cli storage resume --json
89
100
  insight-cli storage rollback --json
@@ -3,7 +3,7 @@ name: insight-ilspy
3
3
  description: Recover C#, inspect IL/types/metadata, extract resources or export projects from managed .NET assemblies through insight-cli ILSpy. Choose native analysis for NativeAOT or ordinary PE machine code.
4
4
  ---
5
5
 
6
- # Insight ILSpy 0.5.4
6
+ # Insight ILSpy 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-interop
3
3
  description: Trace a .NET P/Invoke declaration to an explicitly supplied native library export and Ghidra function through insight-cli ilspy query, binary query and scoped ghidra APIs. Use for managed/native linkage evidence while keeping static correspondence separate from observed loading or execution.
4
4
  ---
5
5
 
6
- # Insight Interop 0.5.4
6
+ # Insight Interop 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized
@@ -3,7 +3,7 @@ name: insight-lldb
3
3
  description: Observe native runtime arguments, return values, registers, stacks and bounded memory at a selected breakpoint using an owned LLDB launch. Use insight-cli lldb on macOS ARM64 when static findings need a concrete execution check.
4
4
  ---
5
5
 
6
- # Insight LLDB 0.5.4
6
+ # Insight LLDB 0.5.6
7
7
 
8
8
  If local help/status reports AppData or IPC access denied, retry that **read-only probe**
9
9
  with the agent host's normal permission escalation, then use that route for later authorized