@eyeauras/insight-cli 0.8.4 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cli-package-build.json +1 -1
- package/README.md +16 -23
- package/SKILL.md +6 -44
- package/dist/src/activity-audit.d.ts +33 -46
- package/dist/src/activity-audit.js +120 -195
- package/dist/src/analysis-default.d.ts +10 -2
- package/dist/src/analysis-default.js +62 -47
- package/dist/src/analysis-storage.d.ts +13 -13
- package/dist/src/analysis-storage.js +127 -258
- package/dist/src/artifacts.d.ts +5 -1
- package/dist/src/artifacts.js +31 -46
- package/dist/src/audit-commands.d.ts +6 -1
- package/dist/src/audit-commands.js +9 -2
- package/dist/src/audit-retention.d.ts +5 -23
- package/dist/src/audit-retention.js +37 -150
- package/dist/src/binary.js +4 -13
- package/dist/src/budgets.d.ts +2 -2
- package/dist/src/budgets.js +7 -9
- package/dist/src/capture.js +17 -30
- package/dist/src/cli.d.ts +9 -4
- package/dist/src/cli.js +288 -473
- package/dist/src/code-references.d.ts +2 -13
- package/dist/src/code-references.js +7 -99
- package/dist/src/context-diagnostics.d.ts +1 -23
- package/dist/src/context-diagnostics.js +1 -83
- package/dist/src/core/coordinator.d.ts +298 -0
- package/dist/src/core/coordinator.js +591 -0
- package/dist/src/core/layout.d.ts +51 -0
- package/dist/src/core/layout.js +55 -0
- package/dist/src/core/legacy-import.d.ts +55 -0
- package/dist/src/core/legacy-import.js +193 -0
- package/dist/src/cross-results.d.ts +3 -3
- package/dist/src/cross-results.js +4 -42
- package/dist/src/cross.js +2 -3
- package/dist/src/debugger-results.d.ts +1 -6
- package/dist/src/debugger-results.js +21 -153
- package/dist/src/debugger.d.ts +21 -11
- package/dist/src/debugger.js +106 -168
- package/dist/src/decode-results.d.ts +2 -1
- package/dist/src/decode-results.js +4 -20
- package/dist/src/diagnostic-error.d.ts +1 -1
- package/dist/src/diagnostic-error.js +4 -23
- package/dist/src/die.js +1 -23
- package/dist/src/dnspy-runtime.js +5 -12
- package/dist/src/dnspy.js +13 -28
- package/dist/src/dotnet-diagnostics.js +1 -1
- package/dist/src/extensions.d.ts +2 -3
- package/dist/src/extensions.js +14 -91
- package/dist/src/frida-worker.js +0 -20
- package/dist/src/frida.js +3 -26
- package/dist/src/function-boundaries.d.ts +2 -2
- package/dist/src/function-boundaries.js +9 -61
- package/dist/src/function-entries.d.ts +2 -2
- package/dist/src/function-entries.js +6 -36
- package/dist/src/function-inspection.d.ts +2 -2
- package/dist/src/function-inspection.js +17 -33
- package/dist/src/function-results.d.ts +1 -3
- package/dist/src/function-results.js +2 -13
- package/dist/src/hub/admin.d.ts +101 -0
- package/dist/src/hub/admin.js +314 -0
- package/dist/src/hub/autostart.d.ts +111 -0
- package/dist/src/hub/autostart.js +207 -0
- package/dist/src/hub/bundle.d.ts +33 -0
- package/dist/src/hub/bundle.js +25 -0
- package/dist/src/hub/client.d.ts +90 -0
- package/dist/src/hub/client.js +256 -0
- package/dist/src/hub/commands.d.ts +13 -0
- package/dist/src/hub/commands.js +280 -0
- package/dist/src/hub/contract.d.ts +87 -0
- package/dist/src/hub/contract.js +3 -0
- package/dist/src/hub/extensions.d.ts +41 -0
- package/dist/src/hub/extensions.js +3 -0
- package/dist/src/hub/ghidra.d.ts +70 -0
- package/dist/src/hub/ghidra.js +197 -0
- package/dist/src/hub/index.d.ts +6 -0
- package/dist/src/hub/index.js +7 -0
- package/dist/src/{work/store.d.ts → hub/ledger-store.d.ts} +57 -94
- package/dist/src/hub/ledger-store.js +919 -0
- package/dist/src/hub/ledger.d.ts +4 -0
- package/dist/src/hub/ledger.js +173 -0
- package/dist/src/hub/lock.d.ts +7 -0
- package/dist/src/hub/lock.js +53 -0
- package/dist/src/hub/repository.d.ts +45 -0
- package/dist/src/hub/repository.js +130 -0
- package/dist/src/hub/server.d.ts +86 -0
- package/dist/src/hub/server.js +414 -0
- package/dist/src/hub/settings.d.ts +36 -0
- package/dist/src/hub/settings.js +112 -0
- package/dist/src/hub/storage.d.ts +13 -0
- package/dist/src/hub/storage.js +46 -0
- package/dist/src/hub/store.d.ts +75 -0
- package/dist/src/hub/store.js +188 -0
- package/dist/src/ilspy.js +1 -1
- package/dist/src/internal-timing.d.ts +2 -9
- package/dist/src/internal-timing.js +2 -95
- package/dist/src/lldb.js +3 -15
- package/dist/src/llvm.js +0 -9
- package/dist/src/managed-heap.js +3 -7
- package/dist/src/managed-metadata.js +2 -5
- package/dist/src/memory-inputs.d.ts +1 -4
- package/dist/src/memory-inputs.js +10 -40
- package/dist/src/mitmproxy.d.ts +35 -4
- package/dist/src/mitmproxy.js +59 -40
- package/dist/src/model.d.ts +0 -73
- package/dist/src/model.js +0 -45
- package/dist/src/mutations.d.ts +1 -1
- package/dist/src/mutations.js +5 -10
- package/dist/src/native/contract.d.ts +130 -0
- package/dist/src/native/ghidra.d.ts +58 -0
- package/dist/src/native/ghidra.js +77 -0
- package/dist/src/native/host.d.ts +71 -0
- package/dist/src/native/host.js +265 -0
- package/dist/src/native/index.d.ts +13 -0
- package/dist/src/native/index.js +19 -0
- package/dist/src/native/jvm.d.ts +54 -0
- package/dist/src/native/jvm.js +47 -0
- package/dist/src/native/worker.d.ts +70 -0
- package/dist/src/native/worker.js +240 -0
- package/dist/src/native-inputs.d.ts +9 -14
- package/dist/src/native-inputs.js +22 -110
- package/dist/src/native-merge-patches.d.ts +2 -2
- package/dist/src/native-merge-patches.js +14 -14
- package/dist/src/persistent-client.js +53 -25
- package/dist/src/procmon.js +17 -31
- package/dist/src/program-files.d.ts +42 -0
- package/dist/src/program-files.js +148 -0
- package/dist/src/queries.js +2 -15
- package/dist/src/query-policy.d.ts +0 -2
- package/dist/src/query-policy.js +1 -14
- package/dist/src/research.d.ts +59 -238
- package/dist/src/research.js +212 -906
- package/dist/src/runtime-identity.d.ts +8 -0
- package/dist/src/runtime-identity.js +26 -0
- package/dist/src/runtime-manager.d.ts +1 -11
- package/dist/src/runtime-manager.js +10 -145
- package/dist/src/runtime-selection.d.ts +1 -1
- package/dist/src/runtime-selection.js +5 -37
- package/dist/src/saved-materials.js +8 -51
- package/dist/src/scripts.d.ts +1 -1
- package/dist/src/scripts.js +15 -15
- package/dist/src/sdk-contracts.js +2 -2
- package/dist/src/sdk.js +8 -8
- package/dist/src/sevenzip.js +1 -3
- package/dist/src/strace.js +0 -3
- package/dist/src/string-anchors.d.ts +2 -3
- package/dist/src/string-anchors.js +8 -101
- package/dist/src/text-window.d.ts +5 -4
- package/dist/src/text-window.js +4 -4
- package/dist/src/tool-runtime/archives.d.ts +1 -1
- package/dist/src/tool-runtime/archives.js +11 -20
- package/dist/src/tool-runtime/catalog.js +2 -5
- package/dist/src/tool-runtime/commands.js +1 -3
- package/dist/src/tool-runtime/deadline.js +2 -7
- package/dist/src/tool-runtime/definition.js +1 -31
- package/dist/src/tool-runtime/identity.js +6 -87
- package/dist/src/tool-runtime/installer.d.ts +2 -6
- package/dist/src/tool-runtime/installer.js +14 -76
- package/dist/src/tool-runtime/java-arguments.js +4 -10
- package/dist/src/tool-runtime/launch-worker.js +2 -8
- package/dist/src/tool-runtime/run.d.ts +2 -0
- package/dist/src/tool-runtime/run.js +20 -8
- package/dist/src/tool-runtime/store.d.ts +3 -3
- package/dist/src/tool-runtime/store.js +21 -83
- package/dist/src/tool-runtime/supervisor.d.ts +6 -11
- package/dist/src/tool-runtime/supervisor.js +155 -214
- package/dist/src/tool-runtime/windows-helper.d.ts +5 -0
- package/dist/src/tool-runtime/windows-helper.js +13 -0
- package/dist/src/tool-runtime/windows-job.d.ts +5 -5
- package/dist/src/tool-runtime/windows-job.js +13 -31
- package/dist/src/tshark.js +14 -27
- package/dist/src/ui-results.d.ts +3 -2
- package/dist/src/ui-results.js +16 -53
- package/dist/src/ui.d.ts +12 -13
- package/dist/src/ui.js +32 -70
- package/dist/src/version-tracking.d.ts +25 -39
- package/dist/src/version-tracking.js +70 -174
- package/dist/src/windbg.d.ts +1 -1
- package/dist/src/windbg.js +2 -8
- package/dist/src/work/client.d.ts +63 -0
- package/dist/src/work/client.js +163 -0
- package/dist/src/work/commands.d.ts +3 -1
- package/dist/src/work/commands.js +158 -184
- package/dist/src/work/dashboard.d.ts +2 -2
- package/dist/src/work/dashboard.js +7 -8
- package/dist/src/work/legacy.d.ts +8 -0
- package/dist/src/work/legacy.js +70 -0
- package/dist/src/work/model.d.ts +0 -3
- package/dist/src/work/model.js +0 -10
- package/dist/src/work/timing.d.ts +3 -3
- package/dist/src/work/timing.js +21 -25
- package/dist/src/workspace.d.ts +4 -250
- package/dist/src/workspace.js +11 -699
- package/node_modules/@eyeauras/cli-factory/README.md +6 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/cli.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/cli.js +76 -28
- package/node_modules/@eyeauras/cli-factory/dist/src/cli.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/command.d.ts +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/command.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/command.js +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/command.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.d.ts +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.js +18 -6
- package/node_modules/@eyeauras/cli-factory/dist/src/errors.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.d.ts +44 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/{profile-file.js → file-publication.js} +41 -113
- package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.d.ts +5 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.js +17 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/help.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/index.d.ts +9 -4
- package/node_modules/@eyeauras/cli-factory/dist/src/index.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/index.js +5 -2
- package/node_modules/@eyeauras/cli-factory/dist/src/index.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.js +11 -18
- package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.d.ts +10 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.js +69 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output-write.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/output.d.ts +3 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/output.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/output.js +74 -14
- package/node_modules/@eyeauras/cli-factory/dist/src/output.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.d.ts +3 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.js +9 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/pagination.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/permissions.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/permissions.js +3 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/permissions.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.d.ts +16 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.d.ts.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.js +83 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.js.map +1 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/types.d.ts +5 -0
- package/node_modules/@eyeauras/cli-factory/dist/src/types.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/view.d.ts +49 -7
- package/node_modules/@eyeauras/cli-factory/dist/src/view.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/view.js +83 -6
- package/node_modules/@eyeauras/cli-factory/dist/src/view.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory/package.json +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/cli-host.proto +19 -19
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.d.ts +7 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.js +9 -4
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.js +5 -4
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.d.ts +11 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.d.ts.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.js +85 -57
- package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.js.map +1 -1
- package/node_modules/@eyeauras/cli-factory-ipc/package.json +2 -2
- package/package.json +4 -5
- package/references/native/InsightAnalyzerOptions.java +10 -0
- package/references/native/InsightAnchorScan.java +1 -11
- package/references/native/InsightCodeReferences.java +2 -3
- package/references/native/InsightCopyType.java +24 -0
- package/references/native/InsightFunctionBoundaries.java +0 -1
- package/references/native/InsightFunctionDatabases.java +20 -16
- package/references/native/InsightHelperCall.java +17 -0
- package/references/native/InsightHubServer.java +214 -0
- package/references/native/InsightNativeHost.java +112 -0
- package/references/native/InsightPlugins.java +0 -1
- package/references/native/InsightPythonWheels.java +3 -2
- package/references/native/InsightResearchQueries.java +3 -4
- package/references/native/InsightResearchView.java +4 -10
- package/references/native/InsightSdkFiles.java +7 -15
- package/references/native/InsightSdkScript.java +1 -4
- package/references/native/InsightSdkTools.java +36 -97
- package/references/native/InsightSdkTypes.java +13 -43
- package/references/native/InsightStringAnchors.java +1 -3
- package/references/native/InsightTraceState.java +13 -96
- package/references/native/InsightTraceTools.java +3 -5
- package/references/native/InsightVersionTracking.java +0 -6
- package/references/native/{HeadlessProgramMergeManager.java → InsightWcMerge.java} +17 -24
- package/references/native/InsightWcOps.java +449 -0
- package/references/native/InsightWcWorker.java +142 -0
- package/references/native/NATIVE-MERGE-NOTICE.txt +4 -8
- package/runtime/GhidraMCP-7.0.0.jar +0 -0
- package/runtime/managed/insight-heap/README.md +3 -3
- package/runtime/managed/insight-managed/README.md +3 -3
- package/runtime/native/binary/README.md +5 -4
- package/runtime/native/windows/DirectoryAlias.cs +24 -0
- package/runtime/native/windows/Insight.Windows.csproj +27 -0
- package/runtime/native/windows/Native.cs +36 -0
- package/runtime/native/windows/OwnedJob.cs +86 -0
- package/runtime/native/windows/Program.cs +50 -0
- package/runtime/native/windows/RegistryRedirect.cs +42 -0
- package/runtime/native/windows/insight-windows-x64.exe +0 -0
- package/runtime/native/windows/packages.lock.json +35 -0
- package/runtime/native/windows/provenance.json +17 -0
- package/runtime/research-view.provenance.json +6 -7
- package/runtime/toolbox.json +33 -114
- package/skill-bundle/insight-artifacts/SKILL.md +5 -19
- package/skill-bundle/insight-binary/SKILL.md +5 -35
- package/skill-bundle/insight-capture/SKILL.md +5 -45
- package/skill-bundle/insight-cli/SKILL.md +6 -44
- package/skill-bundle/insight-die/SKILL.md +5 -38
- package/skill-bundle/insight-dnspy/SKILL.md +5 -54
- package/skill-bundle/insight-dotnet-dump/SKILL.md +5 -35
- package/skill-bundle/insight-dotnet-stack/SKILL.md +5 -28
- package/skill-bundle/insight-dotnet-trace/SKILL.md +5 -34
- package/skill-bundle/insight-frida/SKILL.md +5 -56
- package/skill-bundle/insight-ghidra/SKILL.md +14 -113
- package/skill-bundle/insight-ilspy/SKILL.md +5 -34
- package/skill-bundle/insight-interop/SKILL.md +5 -43
- package/skill-bundle/insight-lldb/SKILL.md +5 -43
- package/skill-bundle/insight-llvm/SKILL.md +5 -45
- package/skill-bundle/insight-managed-heap/SKILL.md +5 -32
- package/skill-bundle/insight-managed-metadata/SKILL.md +5 -41
- package/skill-bundle/insight-mitmproxy/SKILL.md +5 -51
- package/skill-bundle/insight-overview/SKILL.md +5 -68
- package/skill-bundle/insight-procmon/SKILL.md +5 -38
- package/skill-bundle/insight-re/SKILL.md +10 -127
- package/skill-bundle/insight-sevenzip/SKILL.md +5 -31
- package/skill-bundle/insight-strace/SKILL.md +5 -35
- package/skill-bundle/insight-tshark/SKILL.md +5 -38
- package/skill-bundle/insight-windbg/SKILL.md +5 -35
- package/skill-bundle/manifest.json +1 -1
- package/skills/insight-artifacts/SKILL.md +5 -19
- package/skills/insight-binary/SKILL.md +5 -35
- package/skills/insight-capture/SKILL.md +5 -45
- package/skills/insight-die/SKILL.md +5 -38
- package/skills/insight-dnspy/SKILL.md +5 -54
- package/skills/insight-dotnet-dump/SKILL.md +5 -35
- package/skills/insight-dotnet-stack/SKILL.md +5 -28
- package/skills/insight-dotnet-trace/SKILL.md +5 -34
- package/skills/insight-frida/SKILL.md +5 -56
- package/skills/insight-ghidra/SKILL.md +14 -113
- package/skills/insight-ilspy/SKILL.md +5 -34
- package/skills/insight-interop/SKILL.md +5 -43
- package/skills/insight-lldb/SKILL.md +5 -43
- package/skills/insight-llvm/SKILL.md +5 -45
- package/skills/insight-managed-heap/SKILL.md +5 -32
- package/skills/insight-managed-metadata/SKILL.md +5 -41
- package/skills/insight-mitmproxy/SKILL.md +5 -51
- package/skills/insight-overview/SKILL.md +5 -68
- package/skills/insight-procmon/SKILL.md +5 -38
- package/skills/insight-re/SKILL.md +10 -127
- package/skills/insight-sevenzip/SKILL.md +5 -31
- package/skills/insight-strace/SKILL.md +5 -35
- package/skills/insight-tshark/SKILL.md +5 -38
- package/skills/insight-windbg/SKILL.md +5 -35
- package/dist/src/administration-results.d.ts +0 -1
- package/dist/src/administration-results.js +0 -84
- package/dist/src/administration.d.ts +0 -14
- package/dist/src/administration.js +0 -134
- package/dist/src/archive-contract.d.ts +0 -6
- package/dist/src/archive-contract.js +0 -108
- package/dist/src/archive.d.ts +0 -12
- package/dist/src/archive.js +0 -116
- package/dist/src/comment-effects.d.ts +0 -3
- package/dist/src/comment-effects.js +0 -55
- package/dist/src/context-credential.d.ts +0 -18
- package/dist/src/context-credential.js +0 -44
- package/dist/src/contexts.d.ts +0 -387
- package/dist/src/contexts.js +0 -2805
- package/dist/src/coordinator.d.ts +0 -41
- package/dist/src/coordinator.js +0 -160
- package/dist/src/cross-peer.d.ts +0 -20
- package/dist/src/cross-peer.js +0 -53
- package/dist/src/data-effects.d.ts +0 -3
- package/dist/src/data-effects.js +0 -103
- package/dist/src/debugger-caller.d.ts +0 -17
- package/dist/src/debugger-caller.js +0 -129
- package/dist/src/debugger-launch.d.ts +0 -2
- package/dist/src/debugger-launch.js +0 -17
- package/dist/src/debugger-supervisor.js +0 -179
- package/dist/src/directory-identity.d.ts +0 -6
- package/dist/src/directory-identity.js +0 -45
- package/dist/src/documentation-effects.d.ts +0 -5
- package/dist/src/documentation-effects.js +0 -56
- package/dist/src/function-effects.d.ts +0 -4
- package/dist/src/function-effects.js +0 -112
- package/dist/src/ghidra-processes.d.ts +0 -6
- package/dist/src/ghidra-processes.js +0 -138
- package/dist/src/ghidra.d.ts +0 -50
- package/dist/src/ghidra.js +0 -468
- package/dist/src/initial-model.d.ts +0 -7
- package/dist/src/initial-model.js +0 -115
- package/dist/src/initial-progress.d.ts +0 -4
- package/dist/src/initial-progress.js +0 -74
- package/dist/src/inline-script.d.ts +0 -15
- package/dist/src/inline-script.js +0 -61
- package/dist/src/legacy-migration.d.ts +0 -37
- package/dist/src/legacy-migration.js +0 -238
- package/dist/src/lifecycle.d.ts +0 -77
- package/dist/src/lifecycle.js +0 -315
- package/dist/src/merge.d.ts +0 -29
- package/dist/src/merge.js +0 -66
- package/dist/src/mutation-effects.d.ts +0 -4
- package/dist/src/mutation-effects.js +0 -321
- package/dist/src/native-queries.d.ts +0 -2
- package/dist/src/native-queries.js +0 -24
- package/dist/src/native-service.d.ts +0 -40
- package/dist/src/native-service.js +0 -406
- package/dist/src/projects.d.ts +0 -31
- package/dist/src/projects.js +0 -302
- package/dist/src/prototype-cli.d.ts +0 -8
- package/dist/src/prototype-cli.js +0 -155
- package/dist/src/query-results.d.ts +0 -2
- package/dist/src/query-results.js +0 -224
- package/dist/src/research-view.d.ts +0 -6
- package/dist/src/research-view.js +0 -9
- package/dist/src/sdk-files.d.ts +0 -29
- package/dist/src/sdk-files.js +0 -249
- package/dist/src/server.d.ts +0 -102
- package/dist/src/server.js +0 -663
- package/dist/src/storage-gc.d.ts +0 -23
- package/dist/src/storage-gc.js +0 -600
- package/dist/src/store.d.ts +0 -33
- package/dist/src/store.js +0 -178
- package/dist/src/sync-policy.d.ts +0 -22
- package/dist/src/sync-policy.js +0 -129
- package/dist/src/timed-backend.d.ts +0 -3
- package/dist/src/timed-backend.js +0 -24
- package/dist/src/timing-report.d.ts +0 -32
- package/dist/src/timing-report.js +0 -74
- package/dist/src/tool-runtime/native-process-proof.d.ts +0 -2
- package/dist/src/tool-runtime/native-process-proof.js +0 -26
- package/dist/src/transport.d.ts +0 -60
- package/dist/src/transport.js +0 -223
- package/dist/src/unresolved-guidance.d.ts +0 -46
- package/dist/src/unresolved-guidance.js +0 -55
- package/dist/src/work/backup.d.ts +0 -66
- package/dist/src/work/backup.js +0 -446
- package/dist/src/work/store.js +0 -1107
- package/dist/src/worker-lease.d.ts +0 -17
- package/dist/src/worker-lease.js +0 -50
- package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.d.ts +0 -37
- package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.d.ts.map +0 -1
- package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.js.map +0 -1
- package/references/InsightRepositoryProbe.java +0 -55
- package/references/administration.md +0 -34
- package/references/agent-execution.md +0 -36
- package/references/agent-setup.md +0 -60
- package/references/archive.md +0 -32
- package/references/artifacts.md +0 -52
- package/references/debugger.md +0 -64
- package/references/extensions-and-sync.md +0 -125
- package/references/ilspy.md +0 -33
- package/references/managed-runtime.md +0 -162
- package/references/native/InsightArchivePayloads.java +0 -36
- package/references/native/InsightBlockTransfer.java +0 -57
- package/references/native/InsightGuiMain.java +0 -33
- package/references/native/InsightHeadlessMain.java +0 -18
- package/references/native/InsightImportProgress.java +0 -60
- package/references/native/InsightInitialImport.java +0 -48
- package/references/native/InsightInitialJournal.java +0 -57
- package/references/native/InsightInitialPublication.java +0 -142
- package/references/native/InsightInitialRecovery.java +0 -131
- package/references/native/InsightInlineExecutor.java +0 -143
- package/references/native/InsightInlineScript.java +0 -14
- package/references/native/InsightNativeCheckout.java +0 -487
- package/references/native/InsightNativeFingerprint.java +0 -80
- package/references/native/InsightNativeMigration.java +0 -155
- package/references/native/InsightNativeRead.java +0 -80
- package/references/native/InsightNativeReceipt.java +0 -31
- package/references/native/InsightNativeService.java +0 -43
- package/references/native/InsightNativeView.java +0 -40
- package/references/native/InsightOfflineAuthenticator.java +0 -20
- package/references/native/InsightOwnedScripts.java +0 -170
- package/references/native/InsightProjectFiles.java +0 -92
- package/references/native/InsightPublicationRecovery.java +0 -63
- package/references/native/InsightServerAdministration.java +0 -82
- package/references/native/InsightServerInit.java +0 -62
- package/references/native/InsightServerMain.java +0 -43
- package/references/native/InsightServerProbe.java +0 -29
- package/references/native/InsightSnapshotFields.java +0 -74
- package/references/native/InsightSnapshotInspect.java +0 -191
- package/references/native/InsightSnapshotPublisher.java +0 -123
- package/references/native/InsightStopDebugger.java +0 -20
- package/references/native/InsightTraceInspect.java +0 -24
- package/references/native/InsightWorkerLease.java +0 -132
- package/references/native-workflows.md +0 -124
- package/references/persistent-client.mjs +0 -147
- package/references/persistent.md +0 -90
- package/references/query-semantics.md +0 -109
- package/references/recovery.md +0 -235
- package/references/research.md +0 -296
- package/references/setup.md +0 -135
- package/references/sparse-navigation.md +0 -173
- package/references/storage.md +0 -139
- package/references/work-tracking.md +0 -261
- package/runtime/native/file-version.ps1 +0 -7
- package/runtime/native/mitmproxy/bridge.py +0 -180
- package/runtime/native/windows-job/DirectoryAlias.cs +0 -24
- package/runtime/native/windows-job/Insight.WindowsJob.csproj +0 -1
- package/runtime/native/windows-job/Insight.WindowsJob.dll +0 -0
- package/runtime/native/windows-job/OwnedJob.cs +0 -79
- package/runtime/native/windows-job/RegistryRedirect.cs +0 -45
- package/runtime/native/windows-job/packages.lock.json +0 -21
- package/runtime/native/windows-job/provenance.json +0 -16
- package/runtime/native/windows-job/windows-job.ps1 +0 -8
- package/skill-bundle/insight-artifacts/references/agent-execution.md +0 -36
- package/skill-bundle/insight-artifacts/references/artifacts.md +0 -52
- package/skill-bundle/insight-artifacts/references/recovery.md +0 -235
- package/skill-bundle/insight-artifacts/references/storage.md +0 -139
- package/skill-bundle/insight-binary/references/agent-execution.md +0 -36
- package/skill-bundle/insight-capture/references/agent-execution.md +0 -36
- package/skill-bundle/insight-cli/references/agent-execution.md +0 -36
- package/skill-bundle/insight-cli/references/agent-setup.md +0 -60
- package/skill-bundle/insight-cli/references/archive.md +0 -32
- package/skill-bundle/insight-cli/references/managed-runtime.md +0 -162
- package/skill-bundle/insight-cli/references/persistent-client.mjs +0 -147
- package/skill-bundle/insight-cli/references/persistent.md +0 -90
- package/skill-bundle/insight-cli/references/recovery.md +0 -235
- package/skill-bundle/insight-cli/references/setup.md +0 -135
- package/skill-bundle/insight-cli/references/storage.md +0 -139
- package/skill-bundle/insight-die/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dnspy/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dotnet-dump/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dotnet-stack/references/agent-execution.md +0 -36
- package/skill-bundle/insight-dotnet-trace/references/agent-execution.md +0 -36
- package/skill-bundle/insight-frida/references/agent-execution.md +0 -36
- package/skill-bundle/insight-ghidra/references/administration.md +0 -34
- package/skill-bundle/insight-ghidra/references/agent-execution.md +0 -36
- package/skill-bundle/insight-ghidra/references/archive.md +0 -32
- package/skill-bundle/insight-ghidra/references/artifacts.md +0 -52
- package/skill-bundle/insight-ghidra/references/debugger.md +0 -64
- package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +0 -125
- package/skill-bundle/insight-ghidra/references/managed-runtime.md +0 -162
- package/skill-bundle/insight-ghidra/references/native-workflows.md +0 -124
- package/skill-bundle/insight-ghidra/references/persistent-client.mjs +0 -147
- package/skill-bundle/insight-ghidra/references/persistent.md +0 -90
- package/skill-bundle/insight-ghidra/references/query-semantics.md +0 -109
- package/skill-bundle/insight-ghidra/references/recovery.md +0 -235
- package/skill-bundle/insight-ghidra/references/research.md +0 -296
- package/skill-bundle/insight-ghidra/references/setup.md +0 -135
- package/skill-bundle/insight-ghidra/references/sparse-navigation.md +0 -173
- package/skill-bundle/insight-ghidra/references/storage.md +0 -139
- package/skill-bundle/insight-ilspy/references/agent-execution.md +0 -36
- package/skill-bundle/insight-ilspy/references/ilspy.md +0 -33
- package/skill-bundle/insight-interop/references/agent-execution.md +0 -36
- package/skill-bundle/insight-lldb/references/agent-execution.md +0 -36
- package/skill-bundle/insight-llvm/references/agent-execution.md +0 -36
- package/skill-bundle/insight-managed-heap/references/agent-execution.md +0 -36
- package/skill-bundle/insight-managed-metadata/references/agent-execution.md +0 -36
- package/skill-bundle/insight-mitmproxy/references/agent-execution.md +0 -36
- package/skill-bundle/insight-overview/references/agent-execution.md +0 -36
- package/skill-bundle/insight-procmon/references/agent-execution.md +0 -36
- package/skill-bundle/insight-re/references/agent-execution.md +0 -36
- package/skill-bundle/insight-re/references/artifacts.md +0 -52
- package/skill-bundle/insight-re/references/persistent-client.mjs +0 -147
- package/skill-bundle/insight-re/references/persistent.md +0 -90
- package/skill-bundle/insight-re/references/recovery.md +0 -235
- package/skill-bundle/insight-re/references/storage.md +0 -139
- package/skill-bundle/insight-re/references/work-tracking.md +0 -261
- package/skill-bundle/insight-sevenzip/references/agent-execution.md +0 -36
- package/skill-bundle/insight-strace/references/agent-execution.md +0 -36
- package/skill-bundle/insight-tshark/references/agent-execution.md +0 -36
- package/skill-bundle/insight-windbg/references/agent-execution.md +0 -36
- package/skills/insight-artifacts/references/agent-execution.md +0 -36
- package/skills/insight-artifacts/references/artifacts.md +0 -52
- package/skills/insight-artifacts/references/recovery.md +0 -235
- package/skills/insight-artifacts/references/storage.md +0 -139
- package/skills/insight-binary/references/agent-execution.md +0 -36
- package/skills/insight-capture/references/agent-execution.md +0 -36
- package/skills/insight-die/references/agent-execution.md +0 -36
- package/skills/insight-dnspy/references/agent-execution.md +0 -36
- package/skills/insight-dotnet-dump/references/agent-execution.md +0 -36
- package/skills/insight-dotnet-stack/references/agent-execution.md +0 -36
- package/skills/insight-dotnet-trace/references/agent-execution.md +0 -36
- package/skills/insight-frida/references/agent-execution.md +0 -36
- package/skills/insight-ghidra/references/administration.md +0 -34
- package/skills/insight-ghidra/references/agent-execution.md +0 -36
- package/skills/insight-ghidra/references/archive.md +0 -32
- package/skills/insight-ghidra/references/artifacts.md +0 -52
- package/skills/insight-ghidra/references/debugger.md +0 -64
- package/skills/insight-ghidra/references/extensions-and-sync.md +0 -125
- package/skills/insight-ghidra/references/managed-runtime.md +0 -162
- package/skills/insight-ghidra/references/native-workflows.md +0 -124
- package/skills/insight-ghidra/references/persistent-client.mjs +0 -147
- package/skills/insight-ghidra/references/persistent.md +0 -90
- package/skills/insight-ghidra/references/query-semantics.md +0 -109
- package/skills/insight-ghidra/references/recovery.md +0 -235
- package/skills/insight-ghidra/references/research.md +0 -296
- package/skills/insight-ghidra/references/setup.md +0 -135
- package/skills/insight-ghidra/references/sparse-navigation.md +0 -173
- package/skills/insight-ghidra/references/storage.md +0 -139
- package/skills/insight-ilspy/references/agent-execution.md +0 -36
- package/skills/insight-ilspy/references/ilspy.md +0 -33
- package/skills/insight-interop/references/agent-execution.md +0 -36
- package/skills/insight-lldb/references/agent-execution.md +0 -36
- package/skills/insight-llvm/references/agent-execution.md +0 -36
- package/skills/insight-managed-heap/references/agent-execution.md +0 -36
- package/skills/insight-managed-metadata/references/agent-execution.md +0 -36
- package/skills/insight-mitmproxy/references/agent-execution.md +0 -36
- package/skills/insight-overview/references/agent-execution.md +0 -36
- package/skills/insight-procmon/references/agent-execution.md +0 -36
- package/skills/insight-re/references/agent-execution.md +0 -36
- package/skills/insight-re/references/artifacts.md +0 -52
- package/skills/insight-re/references/persistent-client.mjs +0 -147
- package/skills/insight-re/references/persistent.md +0 -90
- package/skills/insight-re/references/recovery.md +0 -235
- package/skills/insight-re/references/storage.md +0 -139
- package/skills/insight-re/references/work-tracking.md +0 -261
- package/skills/insight-sevenzip/references/agent-execution.md +0 -36
- package/skills/insight-strace/references/agent-execution.md +0 -36
- package/skills/insight-tshark/references/agent-execution.md +0 -36
- package/skills/insight-windbg/references/agent-execution.md +0 -36
- /package/dist/src/{debugger-supervisor.d.ts → native/contract.js} +0 -0
- /package/runtime/native/{windows-job → windows}/NuGet.Config +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/** Internal LLDB child owner. It has no public command or independent product IPC host. */
|
|
2
|
-
import { launchProcess, registerExistingProcess } from './tool-runtime/supervisor.js';
|
|
3
|
-
import { createServer } from 'node:http';
|
|
4
|
-
import { readFile, writeFile, mkdir, open, rename, realpath } from 'node:fs/promises';
|
|
5
|
-
import { join, resolve, delimiter } from 'node:path';
|
|
6
|
-
import { randomUUID } from 'node:crypto';
|
|
7
|
-
import { HttpBridge } from './transport.js';
|
|
8
|
-
import { callerMonitor } from './debugger-caller.js';
|
|
9
|
-
import { debuggerLaunchArguments } from './debugger-launch.js';
|
|
10
|
-
import { verifyManagedInstallation } from './tool-runtime/installer.js';
|
|
11
|
-
async function main() {
|
|
12
|
-
const root = await realpath(process.argv[2]), binding = JSON.parse(await readFile(join(root, 'process.json'), 'utf8'));
|
|
13
|
-
if (root !== resolve(root) || binding.root !== root || binding.mode !== 'gui' || !Number.isSafeInteger(binding.pid))
|
|
14
|
-
throw Error('Invalid GUI owner');
|
|
15
|
-
const token = process.env.GHIDRA_MCP_AUTH_TOKEN;
|
|
16
|
-
if (!token)
|
|
17
|
-
throw Error('Missing GUI authority');
|
|
18
|
-
const url = new URL(binding.endpoint);
|
|
19
|
-
if (url.hostname !== '127.0.0.1' || url.protocol !== 'http:' || !url.port)
|
|
20
|
-
throw Error('Invalid GUI endpoint');
|
|
21
|
-
const info = await new HttpBridge(binding.endpoint, fetch, undefined, token, 5000).instance();
|
|
22
|
-
if (info.pid !== binding.pid || info.tcp_port !== Number(url.port) || !String(info.project_path ?? '').startsWith(root + '/'))
|
|
23
|
-
throw Error('GUI identity changed');
|
|
24
|
-
const launch = JSON.parse(await readFile(join(root, 'debugger-run/current.json'), 'utf8'));
|
|
25
|
-
if (launch.context !== binding.context || launch.target !== binding.target || !String(launch.executable).startsWith(root + '/debugger-run/' + launch.request + '/'))
|
|
26
|
-
throw Error('Launch identity changed');
|
|
27
|
-
const directory = join(root, 'debugger-supervisors');
|
|
28
|
-
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
29
|
-
if (await realpath(directory) !== directory)
|
|
30
|
-
throw Error('Supervisor directory changed');
|
|
31
|
-
const id = randomUUID(), path = join(directory, id + '.json'), resultPath = join(directory, id + '.result.json');
|
|
32
|
-
const receipt = { schema: 1, id, root, guiPid: binding.pid, ownerToken: binding.tokenSecret, context: binding.context, target: binding.target, supervisorPid: process.pid, childPid: 0, state: 'starting', inferiorTerminated: false };
|
|
33
|
-
async function saved() { const temporary = path + '.new', file = await open(temporary, 'w', 0o600); try {
|
|
34
|
-
await file.writeFile(JSON.stringify(receipt));
|
|
35
|
-
await file.sync();
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
await file.close();
|
|
39
|
-
} await rename(temporary, path); const parent = await open(directory, 'r'); try {
|
|
40
|
-
await parent.sync();
|
|
41
|
-
}
|
|
42
|
-
finally {
|
|
43
|
-
await parent.close();
|
|
44
|
-
} }
|
|
45
|
-
const appData = process.env.INSIGHT_TOOL_APPDATA, canonicalAppData = appData ? await realpath(appData) : undefined;
|
|
46
|
-
if (!appData || !canonicalAppData || !root.startsWith(join(canonicalAppData, 'workspace', 'ghidra-native') + '/'))
|
|
47
|
-
throw Error('Invalid tool profile');
|
|
48
|
-
if (binding.debuggerRuntime)
|
|
49
|
-
await verifyManagedInstallation(appData, 'ghidra-debugger', binding.debuggerRuntime);
|
|
50
|
-
const authority = createServer((req, res) => { if (req.url !== '/identity' || req.headers.authorization !== 'Bearer ' + token) {
|
|
51
|
-
res.writeHead(403).end();
|
|
52
|
-
return;
|
|
53
|
-
} res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify({ id, pid: process.pid, childPid: receipt.childPid, state: receipt.state })); });
|
|
54
|
-
await new Promise(ok => authority.listen(0, '127.0.0.1', ok));
|
|
55
|
-
authority.unref();
|
|
56
|
-
const address = authority.address();
|
|
57
|
-
if (!address || typeof address === 'string')
|
|
58
|
-
throw Error('No debugger identity port');
|
|
59
|
-
Object.assign(receipt, { identityPort: address.port });
|
|
60
|
-
const processSpec = { tool: 'ghidra', installation: binding.runtimeFingerprint, target: binding.target, session: binding.session, metadata: { debuggerReceipt: path, debuggerDiagnostics: join(directory, id + '.diagnostic.log'), contextRoot: root, ...(binding.debuggerRuntime ? { debuggerInstallation: binding.debuggerRuntime.id, debuggerFingerprint: binding.debuggerRuntime.fingerprint } : {}) } };
|
|
61
|
-
const helperProcess = await registerExistingProcess(appData, { ...processSpec, role: 'debugger-supervisor' }, process.execPath, process.pid, async () => true);
|
|
62
|
-
await saved();
|
|
63
|
-
const environment = { ...process.env };
|
|
64
|
-
delete environment.GHIDRA_MCP_AUTH_TOKEN;
|
|
65
|
-
delete environment.GHIDRA_SERVER_PASSWORD;
|
|
66
|
-
// Ghidra's launcher prepends its source tree to PYTHONPATH. Restore the owned wheel
|
|
67
|
-
// copy first, including the pinned SBProcess compatibility adapter, before LLDB imports it.
|
|
68
|
-
const python = await realpath(environment.INSIGHT_DEBUGGER_PYTHON ?? '');
|
|
69
|
-
if (!python.startsWith(root + '/debug-python-') || python !== environment.INSIGHT_DEBUGGER_PYTHON)
|
|
70
|
-
throw Error('Owned debugger Python identity changed');
|
|
71
|
-
let debuggerExecutable = '/usr/bin/lldb';
|
|
72
|
-
if (binding.debuggerRuntime) {
|
|
73
|
-
debuggerExecutable = binding.debuggerRuntime.executable;
|
|
74
|
-
Object.assign(environment, binding.debuggerRuntime.environment);
|
|
75
|
-
Object.assign(receipt, { debuggerInstallation: binding.debuggerRuntime.id, debuggerFingerprint: binding.debuggerRuntime.fingerprint });
|
|
76
|
-
}
|
|
77
|
-
environment.PYTHONPATH = python + delimiter + (environment.PYTHONPATH ?? '');
|
|
78
|
-
delete environment.INSIGHT_DEBUGGER_PYTHON;
|
|
79
|
-
let closing = false, finished = false, launchComplete = false;
|
|
80
|
-
process.once('SIGHUP', close);
|
|
81
|
-
process.once('SIGTERM', close);
|
|
82
|
-
// A separate session keeps the GUI terminal's SIGHUP from bypassing our orderly kill.
|
|
83
|
-
const launchArguments = process.argv.slice(3), usesGhidra = launchArguments.includes('script import os, ghidralldb');
|
|
84
|
-
const child = await launchProcess(appData, { ...processSpec, role: 'debugger' }, debuggerExecutable, ['--no-lldbinit', '-o', 'settings set auto-confirm true', '-o', 'settings set target.detach-on-error false', ...debuggerLaunchArguments(launchArguments, launch.stopAtEntry === true, usesGhidra ? python : undefined)], { env: environment, detached: true, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
85
|
-
launchComplete = true;
|
|
86
|
-
const exited = child.toolClosed.then(() => { finished = true; });
|
|
87
|
-
void exited.catch(() => { });
|
|
88
|
-
receipt.childPid = child.pid ?? 0;
|
|
89
|
-
receipt.state = 'running';
|
|
90
|
-
let diagnostics = '';
|
|
91
|
-
const capture = (chunk) => { diagnostics = (diagnostics + chunk.toString()).slice(-65536); };
|
|
92
|
-
child.stdout.on('data', capture);
|
|
93
|
-
child.stderr.on('data', capture);
|
|
94
|
-
process.stdout.on('error', () => { });
|
|
95
|
-
process.stderr.on('error', () => { });
|
|
96
|
-
child.stdin.on('error', () => { });
|
|
97
|
-
child.stdout.pipe(process.stdout, { end: false });
|
|
98
|
-
child.stderr.pipe(process.stderr, { end: false });
|
|
99
|
-
process.stdin.on('data', data => { if (!closing)
|
|
100
|
-
child.stdin.write(data); });
|
|
101
|
-
const code = [
|
|
102
|
-
'import lldb,json,pathlib,os',
|
|
103
|
-
'p=lldb.debugger.GetSelectedTarget().GetProcess()',
|
|
104
|
-
'pid=p.GetProcessID() if p.IsValid() else 0',
|
|
105
|
-
'state=p.GetState() if p.IsValid() else lldb.eStateInvalid',
|
|
106
|
-
'done=state in (lldb.eStateInvalid,lldb.eStateUnloaded,lldb.eStateExited)',
|
|
107
|
-
'error=None',
|
|
108
|
-
'if not done:',
|
|
109
|
-
' e=p.Kill()',
|
|
110
|
-
' done=e.Success() and p.GetState()==lldb.eStateExited',
|
|
111
|
-
' error=None if done else str(e)',
|
|
112
|
-
'path=pathlib.Path(' + JSON.stringify(resultPath) + ')',
|
|
113
|
-
'path.write_text(json.dumps({"id":' + JSON.stringify(id) + ',"pid":pid,"inferiorTerminated":done,"error":error}))',
|
|
114
|
-
'os.chmod(str(path),0o600)',
|
|
115
|
-
].join('\n');
|
|
116
|
-
function close() {
|
|
117
|
-
if (closing || finished)
|
|
118
|
-
return;
|
|
119
|
-
if (!launchComplete) {
|
|
120
|
-
setTimeout(close, 10).unref();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
closing = true;
|
|
124
|
-
process.stdin.pause();
|
|
125
|
-
child.stdout.unpipe(process.stdout);
|
|
126
|
-
child.stderr.unpipe(process.stderr);
|
|
127
|
-
child.stdout.resume();
|
|
128
|
-
child.stderr.resume();
|
|
129
|
-
const commands = 'script exec(' + JSON.stringify(code) + ')\nquit\n';
|
|
130
|
-
child.stdin.write(commands);
|
|
131
|
-
setTimeout(() => { if (!finished) {
|
|
132
|
-
child.kill('SIGINT');
|
|
133
|
-
child.stdin.write(commands);
|
|
134
|
-
} }, 3000).unref();
|
|
135
|
-
}
|
|
136
|
-
process.once('SIGINT', () => { if (!closing)
|
|
137
|
-
child.kill('SIGINT'); });
|
|
138
|
-
process.stdin.once('end', close);
|
|
139
|
-
process.stdin.once('error', close);
|
|
140
|
-
const observeCaller = callerMonitor(python, command => { if (!closing && !finished)
|
|
141
|
-
child.stdin.write(command); });
|
|
142
|
-
let callerDiagnostic = false;
|
|
143
|
-
const monitor = setInterval(() => {
|
|
144
|
-
try {
|
|
145
|
-
process.kill(binding.pid, 0);
|
|
146
|
-
}
|
|
147
|
-
catch (error) {
|
|
148
|
-
if (error.code === 'ESRCH')
|
|
149
|
-
close();
|
|
150
|
-
}
|
|
151
|
-
if (!closing && !finished)
|
|
152
|
-
void observeCaller().catch(() => { if (!callerDiagnostic) {
|
|
153
|
-
callerDiagnostic = true;
|
|
154
|
-
process.stderr.write('Native caller observation failed; its request is retained.\n');
|
|
155
|
-
} });
|
|
156
|
-
}, 250);
|
|
157
|
-
try {
|
|
158
|
-
await saved();
|
|
159
|
-
await exited;
|
|
160
|
-
let result;
|
|
161
|
-
try {
|
|
162
|
-
result = JSON.parse(await readFile(resultPath, 'utf8'));
|
|
163
|
-
}
|
|
164
|
-
catch { }
|
|
165
|
-
receipt.inferiorTerminated = result?.id === id && result.inferiorTerminated === true;
|
|
166
|
-
receipt.state = receipt.inferiorTerminated ? 'closed' : 'failed';
|
|
167
|
-
Object.assign(receipt, { exitCode: child.exitCode, signalCode: child.signalCode });
|
|
168
|
-
await writeFile(join(directory, id + '.diagnostic.log'), diagnostics, { mode: 0o600 });
|
|
169
|
-
await saved();
|
|
170
|
-
}
|
|
171
|
-
finally {
|
|
172
|
-
clearInterval(monitor);
|
|
173
|
-
process.stdin.pause();
|
|
174
|
-
authority.close();
|
|
175
|
-
}
|
|
176
|
-
// Keep a failed child outcome observable; never claim that killing LLDB proves inferior exit.
|
|
177
|
-
process.exitCode = receipt.inferiorTerminated ? 0 : 1;
|
|
178
|
-
}
|
|
179
|
-
await main().catch(() => { process.stderr.write('Owned debugger supervision failed; its context is retained.\n'); process.exitCode = 1; });
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Windows packaged apps can expose one directory through distinct real paths. */
|
|
2
|
-
export declare function sameDirectory(left: string, right: string): boolean;
|
|
3
|
-
/** Resolve inner links before checking the owner: an inner escape is never an alias. */
|
|
4
|
-
export declare function ownedDirectory(path: string, owner: string, parts: string[]): boolean;
|
|
5
|
-
/** A locator may name a not-yet-existing project; its existing parent must be owned. */
|
|
6
|
-
export declare function projectPathWithin(path: unknown, root: string): boolean;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { realpathSync, statSync, lstatSync } from 'node:fs';
|
|
2
|
-
import { dirname, join, resolve, isAbsolute } from 'node:path';
|
|
3
|
-
/** Windows packaged apps can expose one directory through distinct real paths. */
|
|
4
|
-
export function sameDirectory(left, right) {
|
|
5
|
-
const a = realpathSync.native(left), b = realpathSync.native(right);
|
|
6
|
-
if (a === b)
|
|
7
|
-
return true;
|
|
8
|
-
const x = statSync(a, { bigint: true }), y = statSync(b, { bigint: true });
|
|
9
|
-
return x.isDirectory() && y.isDirectory() && x.ino !== 0n && x.dev === y.dev && x.ino === y.ino;
|
|
10
|
-
}
|
|
11
|
-
/** Resolve inner links before checking the owner: an inner escape is never an alias. */
|
|
12
|
-
export function ownedDirectory(path, owner, parts) {
|
|
13
|
-
const physical = realpathSync.native(path);
|
|
14
|
-
let anchor = physical;
|
|
15
|
-
for (const _ of parts)
|
|
16
|
-
anchor = dirname(anchor);
|
|
17
|
-
return physical === join(anchor, ...parts) && sameDirectory(anchor, owner);
|
|
18
|
-
}
|
|
19
|
-
/** A locator may name a not-yet-existing project; its existing parent must be owned. */
|
|
20
|
-
export function projectPathWithin(path, root) {
|
|
21
|
-
if (typeof path !== 'string' || !isAbsolute(path))
|
|
22
|
-
return false;
|
|
23
|
-
try {
|
|
24
|
-
const project = resolve(path);
|
|
25
|
-
let present = true;
|
|
26
|
-
try {
|
|
27
|
-
lstatSync(project);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
if (error.code !== 'ENOENT')
|
|
31
|
-
return false;
|
|
32
|
-
present = false;
|
|
33
|
-
}
|
|
34
|
-
const physical = realpathSync.native(present ? project : dirname(project));
|
|
35
|
-
for (let at = present ? dirname(physical) : physical;; at = dirname(at)) {
|
|
36
|
-
if (sameDirectory(at, root))
|
|
37
|
-
return true;
|
|
38
|
-
if (at === dirname(at))
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ResearchBackend } from './research.js';
|
|
2
|
-
import type { Artifact } from './artifacts.js';
|
|
3
|
-
export declare function verifyDocumentation(backend: ResearchBackend, snapshot: Artifact, p: Record<string, unknown>): Promise<{
|
|
4
|
-
function: Record<string, unknown>;
|
|
5
|
-
}>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { address } from './research.js';
|
|
2
|
-
import { object, fail } from './model.js';
|
|
3
|
-
const equal = (actual, expected, label) => { if (actual !== expected)
|
|
4
|
-
fail('partial', `Saved documentation ${label} differs from the requested effect.`); };
|
|
5
|
-
function offset(at, value) {
|
|
6
|
-
const normalized = address(at), parts = normalized.split(':'), hex = parts.pop(), distance = BigInt(String(value));
|
|
7
|
-
if (distance < 0n || distance > 0x7fffffffffffffffn)
|
|
8
|
-
fail('invalid', 'Documentation offsets must be nonnegative signed 64-bit integers.');
|
|
9
|
-
return (parts.length ? parts[0] + ':' : '') + (BigInt('0x' + hex) + distance).toString(16);
|
|
10
|
-
}
|
|
11
|
-
export async function verifyDocumentation(backend, snapshot, p) {
|
|
12
|
-
if (!backend.inspect)
|
|
13
|
-
fail('configuration', 'Documentation requires saved-state inspection.');
|
|
14
|
-
const document = object(p.json_body), at = address(document.target_address), inspect = (kind, parameters) => backend.inspect(snapshot, { kind, ...parameters });
|
|
15
|
-
const value = await inspect('function', { address: at });
|
|
16
|
-
equal(value.exists, true, 'function presence');
|
|
17
|
-
if (document.function_name)
|
|
18
|
-
equal(value.name, document.function_name, 'function name');
|
|
19
|
-
if (document.calling_convention)
|
|
20
|
-
equal(value.callingConvention, document.calling_convention, 'calling convention');
|
|
21
|
-
const checkType = async (actual, name) => { const wanted = await inspect('resolve_type', { name }); equal(wanted.exists, true, 'type presence'); equal(actual, object(wanted.type).name, 'type'); };
|
|
22
|
-
if (document.return_type)
|
|
23
|
-
await checkType(value.returnType, document.return_type);
|
|
24
|
-
if (document.plate_comment) {
|
|
25
|
-
const comments = await inspect('comments', { address: at });
|
|
26
|
-
equal(comments.plate, document.plate_comment, 'plate comment');
|
|
27
|
-
}
|
|
28
|
-
const requested = document.parameters ?? [];
|
|
29
|
-
if (!Array.isArray(requested) || !Array.isArray(value.parameters))
|
|
30
|
-
fail('partial', 'Documentation parameter inventory is absent.');
|
|
31
|
-
for (const raw of requested) {
|
|
32
|
-
const parameter = object(raw), ordinal = Number(parameter.ordinal);
|
|
33
|
-
if (!Number.isSafeInteger(ordinal) || ordinal < 0 || ordinal >= value.parameters.length)
|
|
34
|
-
fail('partial', 'Documentation parameter ordinal is absent.');
|
|
35
|
-
const saved = object(value.parameters[ordinal]);
|
|
36
|
-
if (parameter.name)
|
|
37
|
-
equal(saved.name, parameter.name, 'parameter name');
|
|
38
|
-
if (parameter.type)
|
|
39
|
-
await checkType(saved.type, parameter.type);
|
|
40
|
-
}
|
|
41
|
-
if (document.comments !== undefined && !Array.isArray(document.comments) || document.labels !== undefined && !Array.isArray(document.labels))
|
|
42
|
-
fail('invalid', 'Documentation comments and labels must be arrays.');
|
|
43
|
-
for (const raw of document.comments ?? []) {
|
|
44
|
-
const comment = object(raw), saved = await inspect('comments', { address: offset(at, comment.relative_offset) });
|
|
45
|
-
if (comment.eol_comment)
|
|
46
|
-
equal(saved.eol, comment.eol_comment, 'EOL comment');
|
|
47
|
-
if (comment.pre_comment)
|
|
48
|
-
equal(saved.pre, comment.pre_comment, 'PRE comment');
|
|
49
|
-
}
|
|
50
|
-
for (const raw of document.labels ?? []) {
|
|
51
|
-
const label = object(raw), saved = await inspect('symbols', { address: offset(at, label.relative_offset) });
|
|
52
|
-
if (!Array.isArray(saved.symbols) || !saved.symbols.some(symbol => object(symbol).name === label.name))
|
|
53
|
-
fail('partial', 'Documented label is absent from saved state.');
|
|
54
|
-
}
|
|
55
|
-
return { function: value };
|
|
56
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ResearchBackend } from './research.js';
|
|
2
|
-
import type { Artifact } from './artifacts.js';
|
|
3
|
-
/** Function edits are verified in the saved private database, including each batch member. */
|
|
4
|
-
export declare function verifyFunctionMutation(backend: ResearchBackend, snapshot: Artifact, path: string, p: Record<string, unknown>, response: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { address } from './research.js';
|
|
2
|
-
import { object, fail } from './model.js';
|
|
3
|
-
import { parseDomainJson } from './json.js';
|
|
4
|
-
const equal = (actual, expected, label) => { if (actual !== expected)
|
|
5
|
-
fail('partial', `Saved ${label} does not match the requested effect.`); };
|
|
6
|
-
const list = (value, label) => { if (!Array.isArray(value))
|
|
7
|
-
fail('partial', `Saved ${label} is absent.`); return value.map(object); };
|
|
8
|
-
const json = (value) => typeof value === 'string' ? parseDomainJson(value) : value;
|
|
9
|
-
/** Function edits are verified in the saved private database, including each batch member. */
|
|
10
|
-
export async function verifyFunctionMutation(backend, snapshot, path, p, response) {
|
|
11
|
-
if (!backend.inspect)
|
|
12
|
-
fail('configuration', 'Function edits require saved-state inspection.');
|
|
13
|
-
const inspect = (kind, parameters = {}) => backend.inspect(snapshot, { kind, ...parameters });
|
|
14
|
-
const functionAt = async (ref, exists = true) => {
|
|
15
|
-
if (typeof ref !== 'string' || !ref)
|
|
16
|
-
fail('invalid', 'A function reference is required.');
|
|
17
|
-
let selector;
|
|
18
|
-
try {
|
|
19
|
-
selector = { address: address(ref) };
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
selector = { name: ref };
|
|
23
|
-
}
|
|
24
|
-
const value = await inspect('function', selector);
|
|
25
|
-
equal(value.exists, exists, 'function presence');
|
|
26
|
-
return value;
|
|
27
|
-
};
|
|
28
|
-
const checkType = async (actual, wanted) => {
|
|
29
|
-
const resolved = await inspect('resolve_type', { name: wanted });
|
|
30
|
-
equal(resolved.exists, true, 'variable type presence');
|
|
31
|
-
equal(actual, object(resolved.type).name, 'variable type');
|
|
32
|
-
};
|
|
33
|
-
if (path === '/create_function' || path === '/delete_function') {
|
|
34
|
-
const value = await functionAt(p.address ?? p.function, path === '/create_function');
|
|
35
|
-
if (path === '/create_function' && p.name)
|
|
36
|
-
equal(value.name, p.name, 'function name');
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
if (path === '/clear_instruction_flow_override' || path === '/disassemble_bytes') {
|
|
40
|
-
const value = await inspect('instructions', { address: p.address ?? p.start_address });
|
|
41
|
-
equal(value.exists, true, 'instruction presence');
|
|
42
|
-
if (path === '/clear_instruction_flow_override')
|
|
43
|
-
equal(value.flowOverride, 'NONE', 'instruction flow override');
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
if (['/add_function_tag', '/remove_function_tag'].includes(path)) {
|
|
47
|
-
const assignments = Array.isArray(p.assignments) && p.assignments.length ? p.assignments : [{ function: p.function, tags: p.tags }];
|
|
48
|
-
const results = [];
|
|
49
|
-
for (const assignment of assignments) {
|
|
50
|
-
const requested = object(assignment), value = await functionAt(requested.function), tags = list(value.tags, 'function tags');
|
|
51
|
-
const names = String(requested.tags ?? '').split(',').map(name => name.trim()).filter(Boolean);
|
|
52
|
-
if (!names.length)
|
|
53
|
-
fail('invalid', 'At least one tag name is required.');
|
|
54
|
-
for (const name of names)
|
|
55
|
-
equal(tags.some(tag => tag.name === name), path === '/add_function_tag', 'function tag ' + name);
|
|
56
|
-
results.push(value);
|
|
57
|
-
}
|
|
58
|
-
return { functions: results };
|
|
59
|
-
}
|
|
60
|
-
if (path === '/delete_function_tag' || path === '/set_function_tag_comment') {
|
|
61
|
-
const value = await inspect('function_tags'), tags = list(value.tags, 'program function tags'), tag = tags.find(tag => tag.name === p.name);
|
|
62
|
-
equal(!!tag, path === '/set_function_tag_comment', 'program tag presence');
|
|
63
|
-
if (tag)
|
|
64
|
-
equal(tag.comment, p.comment, 'program tag comment');
|
|
65
|
-
return value;
|
|
66
|
-
}
|
|
67
|
-
const value = await functionAt(p.function ?? p.function_address), variables = list(value.variables, 'function variables');
|
|
68
|
-
const variable = (name) => { const found = variables.find(item => item.name === name); if (!found)
|
|
69
|
-
fail('partial', 'Requested variable is absent from saved state.'); return found; };
|
|
70
|
-
if (path === '/set_function_no_return') {
|
|
71
|
-
equal(value.noReturn, p.no_return, 'no-return flag');
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
if (path === '/set_variable_type') {
|
|
75
|
-
await checkType(variable(p.variable_name).type, p.new_type);
|
|
76
|
-
return value;
|
|
77
|
-
}
|
|
78
|
-
if (path === '/set_variable_storage') {
|
|
79
|
-
const stored = variable(p.variable_name).storage;
|
|
80
|
-
const canonical = String(stored).replace(/\s+/g, '').toLowerCase(), wanted = String(p.storage).replace(/\s+/g, '').toLowerCase();
|
|
81
|
-
// A size omitted by the caller is inferred from the saved variable type.
|
|
82
|
-
if (canonical !== wanted && !(!wanted.includes(':') && canonical.startsWith(wanted + ':')))
|
|
83
|
-
fail('partial', 'Saved variable storage differs from the requested location.');
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
if (path === '/rename_variables' || path === '/batch_rename_function_components') {
|
|
87
|
-
const maps = path === '/rename_variables' ? [p.variable_renames] : [p.parameter_renames, p.local_renames];
|
|
88
|
-
for (const mapping of maps)
|
|
89
|
-
for (const [oldName, newName] of Object.entries(object(mapping ?? {}))) {
|
|
90
|
-
variable(newName);
|
|
91
|
-
if (oldName !== newName && variables.some(item => item.name === oldName))
|
|
92
|
-
fail('partial', 'Original variable name remains after renaming.');
|
|
93
|
-
}
|
|
94
|
-
if (p.function_name)
|
|
95
|
-
equal(value.name, p.function_name, 'function name');
|
|
96
|
-
if (p.return_type)
|
|
97
|
-
await checkType(value.returnType, p.return_type);
|
|
98
|
-
return value;
|
|
99
|
-
}
|
|
100
|
-
if (path === '/set_variables') {
|
|
101
|
-
for (const [oldName, raw] of Object.entries(object(json(p.variables)))) {
|
|
102
|
-
const spec = typeof raw === 'string' ? { name: raw } : Array.isArray(raw) ? { name: raw[0], type: raw[1] } : object(raw);
|
|
103
|
-
const saved = variable(spec.name || oldName);
|
|
104
|
-
if (spec.type)
|
|
105
|
-
await checkType(saved.type, spec.type);
|
|
106
|
-
if (spec.name && spec.name !== oldName && variables.some(item => item.name === oldName))
|
|
107
|
-
fail('partial', 'Original variable name remains after editing.');
|
|
108
|
-
}
|
|
109
|
-
return value;
|
|
110
|
-
}
|
|
111
|
-
fail('schema', 'Function mutation lacks its saved effect contract.');
|
|
112
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CommandContext } from '@eyeauras/cli-factory';
|
|
2
|
-
import { type ProcessRecord } from './tool-runtime/supervisor.js';
|
|
3
|
-
import type { ToolProcessHooks } from './tool-runtime/commands.js';
|
|
4
|
-
import type { Scope, Workspace } from './workspace.js';
|
|
5
|
-
export declare function verifyGhidraProcess(r: ProcessRecord, c: CommandContext): Promise<boolean | undefined>;
|
|
6
|
-
export declare function ghidraProcessHooks(workspace: (c: CommandContext) => Workspace, close: (scope: Scope, c: CommandContext) => Promise<unknown>): ToolProcessHooks;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { nativeProcessProof } from './tool-runtime/native-process-proof.js';
|
|
2
|
-
import { sameDirectory, ownedDirectory, projectPathWithin } from './directory-identity.js';
|
|
3
|
-
import { runtimeSelection } from './runtime-selection.js';
|
|
4
|
-
import { join, resolve, relative, sep, dirname } from 'node:path';
|
|
5
|
-
import { readFile, readdir, realpath } from 'node:fs/promises';
|
|
6
|
-
import { serverIdentity, stopLocalServer } from './server.js';
|
|
7
|
-
import { HttpBridge } from './transport.js';
|
|
8
|
-
import { registerExistingProcess } from './tool-runtime/supervisor.js';
|
|
9
|
-
import { fail } from './model.js';
|
|
10
|
-
import { analysisDirectory } from './analysis-storage.js';
|
|
11
|
-
async function ownedPath(c, path) {
|
|
12
|
-
if (typeof path !== 'string')
|
|
13
|
-
fail('binding', 'Tool resource moved outside this profile.');
|
|
14
|
-
const supplied = resolve(path), profile = resolve(c.appArguments.AppDataDirectory), canonical = await realpath(profile), analysis = await realpath(analysisDirectory(c));
|
|
15
|
-
let base;
|
|
16
|
-
for (let at = dirname(supplied);; at = dirname(at)) {
|
|
17
|
-
try {
|
|
18
|
-
if (sameDirectory(at, canonical) || sameDirectory(at, analysis)) {
|
|
19
|
-
base = at;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
catch { }
|
|
24
|
-
if (at === dirname(at))
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
if (!base)
|
|
28
|
-
fail('binding', 'Tool resource moved outside this profile.');
|
|
29
|
-
const suffix = relative(base, supplied), analysisTree = ['workspace', 'runtime', 'materials', 'temp'].some(tree => suffix === tree || suffix.startsWith(tree + sep));
|
|
30
|
-
const owner = sameDirectory(base, analysis) && !sameDirectory(base, canonical) || analysisTree ? analysis : canonical;
|
|
31
|
-
if (!ownedDirectory(supplied, owner, suffix.split(sep)))
|
|
32
|
-
fail('binding', 'Tool resource moved outside this profile.');
|
|
33
|
-
return join(owner, suffix);
|
|
34
|
-
}
|
|
35
|
-
export async function verifyGhidraProcess(r, c) {
|
|
36
|
-
try {
|
|
37
|
-
if (r.metadata?.serverDirectory) {
|
|
38
|
-
const directory = await ownedPath(c, r.metadata.serverDirectory), local = JSON.parse(await readFile(join(directory, 'server/local.json'), 'utf8'));
|
|
39
|
-
return Number((await serverIdentity(local, c)).pid) === r.pid;
|
|
40
|
-
}
|
|
41
|
-
if (r.metadata?.debuggerReceipt) {
|
|
42
|
-
const path = await ownedPath(c, r.metadata.debuggerReceipt), row = JSON.parse(await readFile(path, 'utf8')), root = await ownedPath(c, r.metadata.contextRoot), binding = JSON.parse(await readFile(join(root, 'process.json'), 'utf8'));
|
|
43
|
-
if (!sameDirectory(row.root, root) || row.ownerToken !== binding.tokenSecret || row.guiPid !== binding.pid || !Number.isSafeInteger(row.identityPort) || row.identityPort < 1 || row.identityPort > 65535)
|
|
44
|
-
return false;
|
|
45
|
-
const token = await c.secrets.require(binding.tokenSecret), response = await c.fetch('http://127.0.0.1:' + row.identityPort + '/identity', { redirect: 'error', signal: AbortSignal.timeout(1000), headers: { Authorization: 'Bearer ' + token } });
|
|
46
|
-
const body = await response.text();
|
|
47
|
-
if (!response.ok || body.length > 4096)
|
|
48
|
-
return false;
|
|
49
|
-
const info = JSON.parse(body);
|
|
50
|
-
return info.id === row.id && info.pid === row.supervisorPid && (r.role === 'debugger' ? info.childPid === r.pid : info.pid === r.pid);
|
|
51
|
-
}
|
|
52
|
-
if (r.metadata?.contextRoot) {
|
|
53
|
-
const root = await ownedPath(c, r.metadata.contextRoot), binding = JSON.parse(await readFile(join(root, 'process.json'), 'utf8'));
|
|
54
|
-
if (!sameDirectory(binding.root, root) || binding.pid !== r.pid || binding.runtimeFingerprint !== r.installation || binding.target !== r.target)
|
|
55
|
-
return false;
|
|
56
|
-
const token = await c.secrets.require(binding.tokenSecret);
|
|
57
|
-
// A headless JVM may be unable to serve HTTP while the kernel still proves its token, executable and private context root.
|
|
58
|
-
if (binding.mode === 'headless' && await nativeProcessProof(r.pid, r.executable, root, token))
|
|
59
|
-
return true;
|
|
60
|
-
const info = await new HttpBridge(binding.endpoint, c.fetch, undefined, token, 1500).instance();
|
|
61
|
-
return info.pid === r.pid && info.tcp_port === Number(new URL(binding.endpoint).port) && projectPathWithin(info.project_path, binding.root);
|
|
62
|
-
}
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export function ghidraProcessHooks(workspace, close) {
|
|
70
|
-
return {
|
|
71
|
-
verify: verifyGhidraProcess,
|
|
72
|
-
async discover(c) {
|
|
73
|
-
const directory = c.appArguments.AppDataDirectory, executable = runtimeSelection(directory, analysisDirectory(c))?.java ?? String(c.profile.values.java ?? 'unverified-legacy-executable');
|
|
74
|
-
async function walk(path, depth = 0) {
|
|
75
|
-
if (depth > 6)
|
|
76
|
-
return;
|
|
77
|
-
let entries;
|
|
78
|
-
try {
|
|
79
|
-
entries = await readdir(path, { withFileTypes: true });
|
|
80
|
-
}
|
|
81
|
-
catch (e) {
|
|
82
|
-
if (e.code === 'ENOENT')
|
|
83
|
-
return;
|
|
84
|
-
throw e;
|
|
85
|
-
}
|
|
86
|
-
for (const entry of entries) {
|
|
87
|
-
const at = join(path, entry.name);
|
|
88
|
-
if (entry.isDirectory())
|
|
89
|
-
await walk(at, depth + 1);
|
|
90
|
-
else if (entry.name === 'process.json') {
|
|
91
|
-
const b = JSON.parse(await readFile(at, 'utf8'));
|
|
92
|
-
if (b.toolProcessId || !b.pid)
|
|
93
|
-
continue;
|
|
94
|
-
let session;
|
|
95
|
-
if (b.context)
|
|
96
|
-
session = workspace(c).contextById(b.context).session;
|
|
97
|
-
try {
|
|
98
|
-
await registerExistingProcess(directory, { tool: 'ghidra', role: b.mode === 'gui' ? 'gui' : b.kind, installation: b.runtimeFingerprint, target: b.target, session, metadata: { contextRoot: b.root } }, executable, b.pid, r => verifyGhidraProcess(r, c));
|
|
99
|
-
}
|
|
100
|
-
catch { }
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
await walk(join(directory, 'workspace/ghidra-native'));
|
|
105
|
-
try {
|
|
106
|
-
const b = JSON.parse(await readFile(join(directory, 'workspace/server/local.json'), 'utf8'));
|
|
107
|
-
if (!b.toolProcessId && b.pid)
|
|
108
|
-
await registerExistingProcess(directory, { tool: 'ghidra', role: 'server', installation: 'legacy', metadata: { serverDirectory: join(directory, 'workspace') } }, executable, b.pid, r => verifyGhidraProcess(r, c));
|
|
109
|
-
}
|
|
110
|
-
catch { }
|
|
111
|
-
},
|
|
112
|
-
async stop(r, c) {
|
|
113
|
-
if (r.metadata?.contextRoot) {
|
|
114
|
-
if (!r.session || !r.target)
|
|
115
|
-
fail('busy', 'Internal Ghidra task is active; finish it before stopping its process.');
|
|
116
|
-
await close({ session: r.session, target: r.target }, c);
|
|
117
|
-
}
|
|
118
|
-
else if (r.role === 'server') {
|
|
119
|
-
const { runtimeProcesses } = await import('./runtime-manager.js');
|
|
120
|
-
if ((await runtimeProcesses(c.appArguments.AppDataDirectory)).some(p => p.kind !== 'server'))
|
|
121
|
-
fail('busy', 'Close Ghidra contexts before stopping their server.');
|
|
122
|
-
await stopLocalServer(await ownedPath(c, r.metadata?.serverDirectory), c);
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
async beforeKill(r, c) {
|
|
126
|
-
// Save debugger traces and terminate the inferior through the existing authenticated GUI
|
|
127
|
-
// protocol. A generic signal to LLDB cannot establish that its debuggee has exited.
|
|
128
|
-
if (r.role === 'gui' && r.session && r.target) {
|
|
129
|
-
const scope = { session: r.session, target: r.target }, w = workspace(c), context = w.context(scope);
|
|
130
|
-
const debuggerActive = context.debugger?.connected || context.debugger?.traces.some(t => t.connected) || w.unresolved(scope).some(q => q.execution?.kind === 'debugger');
|
|
131
|
-
if (debuggerActive)
|
|
132
|
-
await close(scope, c);
|
|
133
|
-
}
|
|
134
|
-
if (r.role.startsWith('debugger'))
|
|
135
|
-
fail('blocked', 'Close the owning GUI context to verify debugger and inferior cleanup.');
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
}
|
package/dist/src/ghidra.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { type ChildProcess } from 'node:child_process';
|
|
2
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
3
|
-
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
4
|
-
import type { CommandContext } from '@eyeauras/cli-factory';
|
|
5
|
-
import { type Batch, type Binding, type FindingRecord, type Snapshot, type Target } from './model.js';
|
|
6
|
-
import { HttpBridge } from './transport.js';
|
|
7
|
-
import type { Publisher } from './coordinator.js';
|
|
8
|
-
interface ProcessRecord {
|
|
9
|
-
binding: Binding;
|
|
10
|
-
http: HttpBridge;
|
|
11
|
-
child?: ChildProcess;
|
|
12
|
-
client?: Client;
|
|
13
|
-
transport?: StdioClientTransport;
|
|
14
|
-
}
|
|
15
|
-
export declare class GhidraRuntime implements Publisher {
|
|
16
|
-
private directory;
|
|
17
|
-
private context;
|
|
18
|
-
private processes;
|
|
19
|
-
constructor(directory: string, context: CommandContext, processes?: Map<string, ProcessRecord>);
|
|
20
|
-
fork(context: CommandContext): GhidraRuntime;
|
|
21
|
-
private launch;
|
|
22
|
-
open(t: Target, batchId: string): Promise<Binding>;
|
|
23
|
-
private receipt;
|
|
24
|
-
private record;
|
|
25
|
-
private boundIdentity;
|
|
26
|
-
private latest;
|
|
27
|
-
private localVersion;
|
|
28
|
-
checkout(t: Target, b: Binding): Promise<Snapshot>;
|
|
29
|
-
read(t: Target, b: Binding, findings: FindingRecord[]): Promise<Snapshot>;
|
|
30
|
-
apply(t: Target, b: Binding, f: FindingRecord): Promise<void>;
|
|
31
|
-
save(t: Target, b: Binding): Promise<void>;
|
|
32
|
-
checkIn(t: Target, b: Binding, batchId: string): Promise<number>;
|
|
33
|
-
private independent;
|
|
34
|
-
published(t: Target, findings: FindingRecord[]): Promise<Snapshot>;
|
|
35
|
-
private probe;
|
|
36
|
-
history(t: Target, batchId: string): Promise<number[]>;
|
|
37
|
-
released(t: Target): Promise<boolean>;
|
|
38
|
-
complete(t: Target, b: Binding): Promise<void>;
|
|
39
|
-
release(t: Target, b: Binding): Promise<void>;
|
|
40
|
-
abandon(t: Target, batch: Batch): Promise<void>;
|
|
41
|
-
startReader(t: Target, label: string): Promise<Binding>;
|
|
42
|
-
private abortReader;
|
|
43
|
-
inspect(t: Target, b: Binding, functions: string): Promise<{
|
|
44
|
-
binding: Binding;
|
|
45
|
-
functions: Record<string, unknown>;
|
|
46
|
-
}>;
|
|
47
|
-
stop(t: Target, b: Binding): Promise<void>;
|
|
48
|
-
dispose(): Promise<void>;
|
|
49
|
-
}
|
|
50
|
-
export {};
|