@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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Shared contract for the hub rewrite (#161). Owned by the integration lead; agents do not edit it.
|
|
2
|
+
// See docs/HUB.md. No journals, receipts, tokens or request ids anywhere in the new code.
|
|
3
|
+
import { hostname, userInfo } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
/** Hub HTTP port. Ghidra Server uses the next three ports (base = port+1, plus base+1 and base+2). */
|
|
6
|
+
export const HUB_DEFAULT_PORT = 13100;
|
|
7
|
+
export const ghidraBasePort = (hubPort) => hubPort + 1;
|
|
8
|
+
export const HUB_API_VERSION = 1;
|
|
9
|
+
/** Idle exit of a hub without an OS autostart registration, and Ghidra Server idle stop. */
|
|
10
|
+
export const HUB_IDLE_EXIT_MS = 30 * 60_000;
|
|
11
|
+
export const GHIDRA_IDLE_STOP_MS = 60 * 60_000;
|
|
12
|
+
export const defaultHubSettings = () => ({ schema: 1, hub: 'local', listen: '127.0.0.1', port: HUB_DEFAULT_PORT });
|
|
13
|
+
/** `roaming` is Factory's appArguments.RoamingAppDataDirectory (installation-level control root). */
|
|
14
|
+
export const hubSettingsPath = (roaming) => join(roaming, 'hub.json');
|
|
15
|
+
/** `storageBase` is the installation storage default base when configured (analysis-default.ts), else undefined. */
|
|
16
|
+
export const defaultHubDataRoot = (roaming, storageBase, appName = 'insight-cli') => storageBase ? join(storageBase, appName, '.hub') : join(roaming, '.hub');
|
|
17
|
+
/** Hub data root layout. */
|
|
18
|
+
export const hubPaths = (dataRoot) => ({
|
|
19
|
+
lock: join(dataRoot, 'hub.lock'),
|
|
20
|
+
db: join(dataRoot, 'hub.db'),
|
|
21
|
+
ghidra: join(dataRoot, 'ghidra'),
|
|
22
|
+
blobs: join(dataRoot, 'blobs'),
|
|
23
|
+
blob: (sha256) => join(dataRoot, 'blobs', sha256.slice(0, 2), sha256),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Machine-local layout. `analysis` is the profile's analysis directory (analysis-storage.ts analysisDirectory); `cacheBase`
|
|
27
|
+
* holds the installation-wide `.cache` (cacheBase in analysis-default.ts: the storage default base, else roaming).
|
|
28
|
+
*/
|
|
29
|
+
export const localPaths = (analysis, cacheBase) => ({
|
|
30
|
+
/** One working copy (Ghidra project) per session and target. */
|
|
31
|
+
context: (session, target) => join(analysis, 'contexts', session, target),
|
|
32
|
+
contexts: join(analysis, 'contexts'),
|
|
33
|
+
/** Installation-wide cache of binaries downloaded from the hub, by sha256. */
|
|
34
|
+
blobCache: (sha256) => join(cacheBase, '.cache', 'blobs', sha256.slice(0, 2), sha256),
|
|
35
|
+
});
|
|
36
|
+
/** Path of a target's program inside its repository (kept from the previous layout). */
|
|
37
|
+
export const programPath = (targetId) => '/' + targetId + '.bin';
|
|
38
|
+
/**
|
|
39
|
+
* Ghidra user name of this client: `<os user>.<machine>`. Ghidra accepts only [A-Za-z0-9][A-Za-z0-9._-]*;
|
|
40
|
+
* other characters become '-'. Every Ghidra JVM started by insight-cli gets -Duser.name=<this>.
|
|
41
|
+
*/
|
|
42
|
+
let osClient;
|
|
43
|
+
export function clientUserName(user, machine) {
|
|
44
|
+
// Explicit override, e.g. several simulated machines on one host in tests.
|
|
45
|
+
const override = process.env.INSIGHT_CLIENT_USER;
|
|
46
|
+
if (override && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(override))
|
|
47
|
+
return override;
|
|
48
|
+
// os.userInfo() costs ~170 ms on Windows; the OS identity does not change within a process.
|
|
49
|
+
if (user === undefined && machine === undefined)
|
|
50
|
+
return osClient ??= clientUserName(userInfo().username, hostname());
|
|
51
|
+
user ??= userInfo().username;
|
|
52
|
+
machine ??= hostname();
|
|
53
|
+
const clean = (value) => value.replace(/[^A-Za-z0-9._-]/g, '-').replace(/^[^A-Za-z0-9]+/, '') || 'x';
|
|
54
|
+
return clean(user) + '.' + clean(machine.split('.')[0] ?? machine);
|
|
55
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HubProject } from '../hub/contract.js';
|
|
2
|
+
export interface LegacyHub {
|
|
3
|
+
projects(): Promise<HubProject[]>;
|
|
4
|
+
admin<T = Record<string, unknown>>(operation: string, body: Record<string, unknown>): Promise<T>;
|
|
5
|
+
}
|
|
6
|
+
export interface LegacyImportOptions {
|
|
7
|
+
/** Profile name; becomes the hub project name. */
|
|
8
|
+
profile: string;
|
|
9
|
+
/** The profile's analysis directory (old workspace below it; new working copies too). */
|
|
10
|
+
analysis: string;
|
|
11
|
+
roaming: string;
|
|
12
|
+
dryRun: boolean;
|
|
13
|
+
/** This installation's hub; called only for a real import. */
|
|
14
|
+
hub: () => Promise<LegacyHub>;
|
|
15
|
+
user?: string;
|
|
16
|
+
osUser?: string;
|
|
17
|
+
/** Fingerprint of the Ghidra runtime the old server ran (the profile's), so the hub's runtime check applies to the bundle. */
|
|
18
|
+
runtimeFingerprint?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function importLegacyProfile(o: LegacyImportOptions): Promise<{
|
|
21
|
+
profile: string;
|
|
22
|
+
project: {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
repository: string;
|
|
26
|
+
};
|
|
27
|
+
user: string;
|
|
28
|
+
targets: {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
sha256: string;
|
|
32
|
+
size: number;
|
|
33
|
+
}[];
|
|
34
|
+
programs: import("../hub/bundle.js").BundleProgram[];
|
|
35
|
+
checkoutOwners: {
|
|
36
|
+
path: string;
|
|
37
|
+
checkout: string;
|
|
38
|
+
from: string;
|
|
39
|
+
to: string;
|
|
40
|
+
}[];
|
|
41
|
+
workingCopies: {
|
|
42
|
+
session: string;
|
|
43
|
+
target: string;
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
checkout: string;
|
|
47
|
+
}[];
|
|
48
|
+
skipped: {
|
|
49
|
+
session: string;
|
|
50
|
+
target: string;
|
|
51
|
+
reason: string;
|
|
52
|
+
}[];
|
|
53
|
+
dryRun: boolean;
|
|
54
|
+
hub: string;
|
|
55
|
+
}>;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// `hub import-legacy` (#161, docs/HUB.md Moving between hubs): one per-profile owned server of the previous model
|
|
2
|
+
// becomes hub project <profile>. The old repository is copied (never moved) into a bundle and imported through the
|
|
3
|
+
// same path as `hub import`; target ids, the repository name (so the project id) and session ids are kept.
|
|
4
|
+
// Old native working copies are copied into localPaths(...).context(session,target). In the copies only, the project
|
|
5
|
+
// OWNER and the server checkout owner become clientUserName(); the first NativeGhidra.checkout re-binds the address.
|
|
6
|
+
// The source profile data is only read.
|
|
7
|
+
import { randomUUID } from 'node:crypto';
|
|
8
|
+
import { copyFile, mkdir, readFile, readdir, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
9
|
+
import { connect as tcp } from 'node:net';
|
|
10
|
+
import { userInfo } from 'node:os';
|
|
11
|
+
import { join, resolve } from 'node:path';
|
|
12
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
13
|
+
import { BUNDLE_FILE, programOf } from '../hub/bundle.js';
|
|
14
|
+
import { copyTree, exists, listFiles, mangle, properties, rewriteCheckouts, scanRepository, setProperty } from '../hub/repository.js';
|
|
15
|
+
import { hubError, invalid } from '../hub/settings.js';
|
|
16
|
+
import { clientUserName, localPaths, programPath } from './layout.js';
|
|
17
|
+
const answers = (port) => new Promise(done => {
|
|
18
|
+
const socket = tcp({ host: '127.0.0.1', port });
|
|
19
|
+
socket.setTimeout(1000);
|
|
20
|
+
const end = (value) => { socket.destroy(); done(value); };
|
|
21
|
+
socket.once('connect', () => end(true));
|
|
22
|
+
socket.once('error', () => end(false));
|
|
23
|
+
socket.once('timeout', () => end(false));
|
|
24
|
+
});
|
|
25
|
+
const alive = (pid) => { if (typeof pid !== 'number' || !Number.isSafeInteger(pid) || pid < 1)
|
|
26
|
+
return false; try {
|
|
27
|
+
process.kill(pid, 0);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
return e.code === 'EPERM';
|
|
32
|
+
} };
|
|
33
|
+
const lockFile = (path) => /(^|\/)[^/]*\.lock~?$/.test(path);
|
|
34
|
+
/** Checkout id held by a local Ghidra project for one program, from the item's property file. */
|
|
35
|
+
async function localCheckout(rep, path) {
|
|
36
|
+
const data = join(rep, 'idata');
|
|
37
|
+
for (const file of await listFiles(data))
|
|
38
|
+
if (file.endsWith('.prp')) {
|
|
39
|
+
const p = properties(await readFile(join(data, file), 'utf8'));
|
|
40
|
+
if (p.NAME && (p.PARENT && p.PARENT !== '/' ? p.PARENT : '') + '/' + p.NAME === path)
|
|
41
|
+
return p.CHECKOUT_ID || undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function projectName(root) {
|
|
45
|
+
const names = (await readdir(root).catch(() => [])).filter(n => n.endsWith('.gpr')).map(n => n.slice(0, -4));
|
|
46
|
+
return names.length === 1 && await exists(join(root, names[0] + '.rep')) ? names[0] : undefined;
|
|
47
|
+
}
|
|
48
|
+
/** Reads the old profile; changes nothing. */
|
|
49
|
+
async function plan(o, temp) {
|
|
50
|
+
const workspace = join(o.analysis, 'workspace'), server = join(workspace, 'server');
|
|
51
|
+
let local;
|
|
52
|
+
try {
|
|
53
|
+
local = JSON.parse(await readFile(join(server, 'local.json'), 'utf8'));
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return invalid(`Profile ${o.profile} has no owned local Ghidra Server (${join(server, 'local.json')}); there is nothing to import.`);
|
|
57
|
+
}
|
|
58
|
+
const repository = String(local.repository ?? ''), port = Number(local.port);
|
|
59
|
+
if (!/^insight_[a-f0-9]{32}$/.test(repository))
|
|
60
|
+
invalid(`The old server of ${o.profile} names repository ${repository}, not insight_<32 hex>.`);
|
|
61
|
+
if (Number.isSafeInteger(port) && port > 0 && await answers(port))
|
|
62
|
+
throw hubError('hub.unavailable', `The old Ghidra Server of profile ${o.profile} still answers on port ${port}; stop it before the import.`);
|
|
63
|
+
if (local.phase === 'running' && alive(local.pid))
|
|
64
|
+
throw hubError('hub.unavailable', `The old Ghidra Server of profile ${o.profile} still runs as process ${String(local.pid)}; stop it before the import.`);
|
|
65
|
+
const source = join(server, 'data', mangle(repository));
|
|
66
|
+
if (!await exists(source))
|
|
67
|
+
invalid(`Repository directory ${source} does not exist.`);
|
|
68
|
+
// The workspace database is read from a copy, so the source stays byte-identical.
|
|
69
|
+
await mkdir(temp, { recursive: true });
|
|
70
|
+
for (const suffix of ['', '-wal', '-shm'])
|
|
71
|
+
if (await exists(join(workspace, 'workspace.sqlite' + suffix)))
|
|
72
|
+
await copyFile(join(workspace, 'workspace.sqlite' + suffix), join(temp, 'workspace.sqlite' + suffix));
|
|
73
|
+
const db = new DatabaseSync(join(temp, 'workspace.sqlite'));
|
|
74
|
+
let targetRows, contextRows;
|
|
75
|
+
try {
|
|
76
|
+
targetRows = db.prepare('SELECT data FROM targets ORDER BY rowid').all().map(r => JSON.parse(String(r.data)));
|
|
77
|
+
contextRows = db.prepare('SELECT data FROM contexts ORDER BY rowid').all().map(r => JSON.parse(String(r.data)));
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
db.close();
|
|
81
|
+
}
|
|
82
|
+
const user = o.user ?? clientUserName(), id = repository.slice('insight_'.length);
|
|
83
|
+
const targets = [], inputs = new Map();
|
|
84
|
+
for (const t of targetRows) {
|
|
85
|
+
const sha256 = String(t.binarySha256 ?? ''), file = join(workspace, 'artifacts', sha256 + '.bin');
|
|
86
|
+
if (!/^t_[a-f0-9]{32}$/.test(String(t.id)) || !/^[a-f0-9]{64}$/.test(sha256))
|
|
87
|
+
invalid(`Old target ${String(t.id)} is malformed.`);
|
|
88
|
+
if (!await exists(file))
|
|
89
|
+
invalid(`Input of target ${String(t.id)} is missing: ${file}.`);
|
|
90
|
+
targets.push({ id: String(t.id), projectId: id, sha256, name: String(t.name), size: (await stat(file)).size, createdAt: String(t.createdAt ?? new Date().toISOString()), createdBy: user });
|
|
91
|
+
inputs.set(sha256, file);
|
|
92
|
+
}
|
|
93
|
+
const items = await scanRepository(source), copies = [], skipped = [];
|
|
94
|
+
const paths = localPaths(o.analysis, o.roaming);
|
|
95
|
+
for (const c of contextRows) {
|
|
96
|
+
const checkout = c.nativeCheckout, session = String(c.session), target = String(c.target);
|
|
97
|
+
if (!checkout)
|
|
98
|
+
continue;
|
|
99
|
+
const skip = (reason) => skipped.push({ session, target, reason });
|
|
100
|
+
if (checkout.state !== 'active') {
|
|
101
|
+
skip(`checkout state ${String(checkout.state)}`);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const root = String(checkout.root ?? ''), project = await projectName(root);
|
|
105
|
+
if (!project) {
|
|
106
|
+
skip(`no Ghidra project in ${root}`);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const held = await localCheckout(join(root, project + '.rep'), programPath(target));
|
|
110
|
+
const item = items.find(i => i.path === programPath(target));
|
|
111
|
+
if (!held || !item?.checkouts.some(x => x.id === held)) {
|
|
112
|
+
skip(`checkout ${held ?? '(none)'} is not held on the old server`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
copies.push({ session, target, source: root, project, destination: paths.context(session, target), checkout: held, openedAt: new Date().toISOString() });
|
|
116
|
+
}
|
|
117
|
+
const from = new Set(['publisher', o.osUser ?? userInfo().username]);
|
|
118
|
+
return { repository, id, source, targets, inputs, items, copies, skipped, user, from };
|
|
119
|
+
}
|
|
120
|
+
export async function importLegacyProfile(o) {
|
|
121
|
+
const temp = join(o.analysis, 'temp', 'hub-legacy-import');
|
|
122
|
+
await rm(temp, { recursive: true, force: true });
|
|
123
|
+
try {
|
|
124
|
+
const p = await plan(o, temp);
|
|
125
|
+
const summary = { profile: o.profile, project: { id: p.id, name: o.profile, repository: p.repository }, user: p.user,
|
|
126
|
+
targets: p.targets.map(t => ({ id: t.id, name: t.name, sha256: t.sha256, size: t.size })), programs: p.items.map(programOf),
|
|
127
|
+
checkoutOwners: p.items.flatMap(i => i.checkouts.filter(c => p.from.has(c.user)).map(c => ({ path: i.path, checkout: c.id, from: c.user, to: p.user }))),
|
|
128
|
+
workingCopies: p.copies.map(c => ({ session: c.session, target: c.target, from: c.source, to: c.destination, checkout: c.checkout })), skipped: p.skipped };
|
|
129
|
+
if (o.dryRun)
|
|
130
|
+
return { dryRun: true, hub: 'not contacted', ...summary };
|
|
131
|
+
const hub = await o.hub(), present = (await hub.projects()).find(x => x.id === p.id || x.name === o.profile);
|
|
132
|
+
if (present && (present.id !== p.id || present.name !== o.profile))
|
|
133
|
+
invalid(`The hub already has project ${present.name} (${present.id}); the legacy profile ${o.profile} is project ${p.id}. Rename or remove the existing project first.`);
|
|
134
|
+
if (!present) {
|
|
135
|
+
// Bundle: the repository copy with rewritten checkouts, the target inputs, the targets with their old ids.
|
|
136
|
+
const bundleDir = join(temp, 'bundle'), repo = join(bundleDir, 'repository');
|
|
137
|
+
await copyTree(p.source, repo);
|
|
138
|
+
for (const item of await scanRepository(repo))
|
|
139
|
+
await rewriteCheckouts(repo, item, c => {
|
|
140
|
+
const copy = p.copies.find(x => programPath(x.target) === item.path && x.checkout === c.id);
|
|
141
|
+
return !copy && !p.from.has(c.user) ? undefined : { user: p.from.has(c.user) || copy ? p.user : c.user, ...(copy ? { project: c.host + '::' + resolve(copy.destination).replace(/\\/g, '/') + '/wc' } : {}) };
|
|
142
|
+
});
|
|
143
|
+
// Owners change, not versions or checkout ids: the programs are the source's.
|
|
144
|
+
const programs = p.items.map(programOf);
|
|
145
|
+
for (const [sha256, file] of p.inputs) {
|
|
146
|
+
await mkdir(join(bundleDir, 'blobs'), { recursive: true });
|
|
147
|
+
await copyFile(file, join(bundleDir, 'blobs', sha256));
|
|
148
|
+
}
|
|
149
|
+
const bundle = { schema: 1, format: 'insight-hub-project', createdAt: new Date().toISOString(), source: { legacyProfile: o.profile }, runtimeFingerprint: o.runtimeFingerprint ?? null,
|
|
150
|
+
project: { id: p.id, name: o.profile, repository: p.repository, createdAt: new Date().toISOString() }, targets: p.targets, programs,
|
|
151
|
+
blobs: [...p.inputs.keys()].map(sha256 => ({ sha256 })), extensions: [] };
|
|
152
|
+
await writeFile(join(bundleDir, BUNDLE_FILE), JSON.stringify(bundle, null, 1));
|
|
153
|
+
await hub.admin('import', { input: bundleDir });
|
|
154
|
+
}
|
|
155
|
+
const copies = [];
|
|
156
|
+
for (const c of p.copies)
|
|
157
|
+
copies.push(await importCopy(c, p.user, p.targets.find(t => t.id === c.target), o));
|
|
158
|
+
return { dryRun: false, ...summary, hub: present ? 'present' : 'imported', workingCopies: copies };
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
await rm(temp, { recursive: true, force: true });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** Copies one old working copy as project `wc` and makes this client its owner; an existing copy is kept. */
|
|
165
|
+
async function importCopy(c, user, target, o) {
|
|
166
|
+
const result = { session: c.session, target: c.target, from: c.source, to: c.destination, checkout: c.checkout };
|
|
167
|
+
if (await exists(join(c.destination, 'wc.gpr'))) {
|
|
168
|
+
const owner = properties(await readFile(join(c.destination, 'wc.rep', 'project.prp'), 'utf8')).OWNER;
|
|
169
|
+
if (owner !== user)
|
|
170
|
+
invalid(`${c.destination} already holds a working copy owned by ${owner}.`);
|
|
171
|
+
return { ...result, state: 'present' };
|
|
172
|
+
}
|
|
173
|
+
if (await exists(c.destination) && (await listFiles(c.destination)).length)
|
|
174
|
+
invalid(`${c.destination} exists and is not a working copy.`);
|
|
175
|
+
const stage = c.destination + '.partial-' + randomUUID().slice(0, 8);
|
|
176
|
+
try {
|
|
177
|
+
await copyTree(join(c.source, c.project + '.rep'), join(stage, 'wc.rep'), lockFile);
|
|
178
|
+
await copyFile(join(c.source, c.project + '.gpr'), join(stage, 'wc.gpr'));
|
|
179
|
+
await setProperty(join(stage, 'wc.rep', 'project.prp'), 'OWNER', user);
|
|
180
|
+
await rm(c.destination, { recursive: true, force: true });
|
|
181
|
+
await rename(stage, c.destination);
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
await rm(stage, { recursive: true, force: true });
|
|
185
|
+
}
|
|
186
|
+
// The coordinator's context record: what was opened (core/coordinator.ts ContextRecord).
|
|
187
|
+
const record = join(localPaths(o.analysis, o.roaming).contexts, c.session, c.target + '.json');
|
|
188
|
+
if (!await exists(record)) {
|
|
189
|
+
await mkdir(join(localPaths(o.analysis, o.roaming).contexts, c.session), { recursive: true });
|
|
190
|
+
await writeFile(record, JSON.stringify({ session: c.session, target: c.target, name: target?.name ?? c.target, sha256: target?.sha256 ?? '', mode: 'headless', openedAt: c.openedAt }, null, 1));
|
|
191
|
+
}
|
|
192
|
+
return { ...result, state: 'copied' };
|
|
193
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Scope } from './
|
|
2
|
-
/**
|
|
3
|
-
export declare function crossResult(
|
|
1
|
+
import type { Scope } from './core/coordinator.js';
|
|
2
|
+
/** A comparison result within the one MiB output bound. */
|
|
3
|
+
export declare function crossResult(_path: string, _parameters: Record<string, unknown>, input: unknown): Record<string, unknown>;
|
|
4
4
|
export declare const transferCategories: readonly ["function_names", "function_signatures", "function_plate_comments", "function_calling_conventions", "function_no_return_flags", "function_tags", "function_locals", "data_types", "data_definitions", "data_plate_comments", "instruction_comments", "data_item_comments", "labels", "globals", "external_locations", "bookmarks", "equates"];
|
|
5
5
|
export declare function transferResult(input: unknown, dryRun: boolean): {
|
|
6
6
|
dryRun: boolean;
|
|
@@ -1,59 +1,21 @@
|
|
|
1
1
|
import { object, fail } from './model.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const scores = (value) => { if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 1)
|
|
5
|
-
fail('partial', 'Cross-target result has an invalid similarity score.'); };
|
|
6
|
-
/** Domain contracts for the pinned comparison leaves, independent of backend acknowledgment. */
|
|
7
|
-
export function crossResult(path, parameters, input) {
|
|
2
|
+
/** A comparison result within the one MiB output bound. */
|
|
3
|
+
export function crossResult(_path, _parameters, input) {
|
|
8
4
|
const value = object(input);
|
|
9
5
|
if (JSON.stringify(value).length > 1048576)
|
|
10
6
|
fail('limit', 'Cross-target result exceeds one MiB; narrow its scope.');
|
|
11
|
-
if (path === '/compare_programs_documentation') {
|
|
12
|
-
if (!Array.isArray(value.programs) || value.programs.length !== 2 || value.count !== 2)
|
|
13
|
-
fail('partial', 'Comparison did not return both selected contexts.');
|
|
14
|
-
for (const item of value.programs) {
|
|
15
|
-
const program = object(item);
|
|
16
|
-
const total = count(program.total_functions);
|
|
17
|
-
if (count(program.documented) + count(program.undocumented) !== total)
|
|
18
|
-
fail('partial', 'Program documentation counts are inconsistent.');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
else if (path === '/diff_functions') {
|
|
22
|
-
const a = object(value.function_a), b = object(value.function_b);
|
|
23
|
-
if (typeof a.name !== 'string' || typeof b.name !== 'string')
|
|
24
|
-
fail('partial', 'Diff omitted its function identities.');
|
|
25
|
-
scores(object(value.summary).similarity_score);
|
|
26
|
-
for (const key of ['body_equal', 'body_added', 'body_removed'])
|
|
27
|
-
count(object(value.summary)[key]);
|
|
28
|
-
for (const key of ['prologue_diff', 'body_diff', 'epilogue_diff'])
|
|
29
|
-
if (!Array.isArray(value[key]))
|
|
30
|
-
fail('partial', 'Diff omitted an instruction section.');
|
|
31
|
-
}
|
|
32
|
-
else if (path === '/bulk_fuzzy_match' || path === '/find_similar_functions_fuzzy') {
|
|
33
|
-
if (!Array.isArray(value.matches) || value.matches.length > Number(parameters.limit ?? (path === '/bulk_fuzzy_match' ? 50 : 20)))
|
|
34
|
-
fail('partial', 'Matching result exceeds its page.');
|
|
35
|
-
if (path === '/bulk_fuzzy_match') {
|
|
36
|
-
count(value.total_source_functions);
|
|
37
|
-
if (value.offset !== parameters.offset || value.limit !== parameters.limit)
|
|
38
|
-
fail('partial', 'Matching page changed its selectors.');
|
|
39
|
-
}
|
|
40
|
-
else
|
|
41
|
-
count(value.total_matches);
|
|
42
|
-
}
|
|
43
|
-
else
|
|
44
|
-
fail('schema', 'Cross-target query lacks a result contract.');
|
|
45
7
|
return value;
|
|
46
8
|
}
|
|
47
9
|
export const transferCategories = ['function_names', 'function_signatures', 'function_plate_comments', 'function_calling_conventions', 'function_no_return_flags',
|
|
48
10
|
'function_tags', 'function_locals', 'data_types', 'data_definitions', 'data_plate_comments', 'instruction_comments', 'data_item_comments', 'labels', 'globals', 'external_locations', 'bookmarks', 'equates'];
|
|
49
11
|
export function transferResult(input, dryRun) {
|
|
50
12
|
const value = object(input);
|
|
51
|
-
if (
|
|
13
|
+
if (Number(value.errors) !== 0)
|
|
52
14
|
fail('partial', 'Documentation transfer reported an incomplete outcome.');
|
|
53
15
|
const categories = {};
|
|
54
16
|
let total = 0;
|
|
55
17
|
for (const key of transferCategories) {
|
|
56
|
-
const item = object(value[key]), planned =
|
|
18
|
+
const item = object(value[key]), planned = Number(item.planned), applied = Number(item.applied);
|
|
57
19
|
if (applied !== planned)
|
|
58
20
|
fail('partial', 'Documentation transfer skipped part of ' + key);
|
|
59
21
|
categories[key] = { planned, applied };
|
package/dist/src/cross.js
CHANGED
|
@@ -34,10 +34,9 @@ export function crossCommands(research) {
|
|
|
34
34
|
const documentation = groups.get('documentation');
|
|
35
35
|
documentation.push(command('transfer', 'Copy documentation into a saved private destination; publish with explicit merge', ({ options: o }, c) => {
|
|
36
36
|
const selected = scope(o), source = { session: o.sourceSession === undefined ? selected.session : id(o.sourceSession), target: id(o.sourceTarget) };
|
|
37
|
-
return research(c).transfer(selected, source, Boolean(o.dryRun)
|
|
37
|
+
return research(c).transfer(selected, source, Boolean(o.dryRun));
|
|
38
38
|
}, { permission: 'Destructive', options: [...selectedOptions, { flags: '--source-target <id>', description: 'Documentation source target', required: true },
|
|
39
39
|
{ flags: '--source-session <id>', description: 'Source context session (defaults to --session)' },
|
|
40
|
-
{ flags: '--dry-run', description: 'Preview transfer counts without applying documentation' }
|
|
41
|
-
{ flags: '--request-id <id>', description: 'Retrieve the prior transfer outcome after a lost response' }] }));
|
|
40
|
+
{ flags: '--dry-run', description: 'Preview transfer counts without applying documentation' }] }));
|
|
42
41
|
return [...groups].map(([name, children]) => command(name, `${name} across two working contexts`, children));
|
|
43
42
|
}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Artifact } from './artifacts.js';
|
|
3
|
-
export declare function debuggerExecutionSettled(operation: string, before: Record<string, unknown>, after: Record<string, unknown>): boolean;
|
|
4
|
-
export declare function debuggerMetadataFingerprint(raw: unknown): string;
|
|
5
|
-
export declare function debuggerProgramMetadata(backend: Pick<ResearchBackend, 'inspect' | 'debuggerMetadata'>, snapshot: Artifact): Promise<string | undefined>;
|
|
6
|
-
export declare function debuggerResult(operation: string, p: Record<string, unknown>, raw: unknown): Record<string, unknown> | Record<string, unknown>[];
|
|
1
|
+
export declare function debuggerResult(operation: string, _p: Record<string, unknown>, raw: unknown): Record<string, unknown> | Record<string, unknown>[];
|
|
@@ -1,164 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return false;
|
|
10
|
-
const advanced = /^\d+$/.test(String(after.snap)) && /^\d+$/.test(String(before.snap)) && BigInt(String(after.snap)) > BigInt(String(before.snap));
|
|
11
|
-
if (operation === 'resume')
|
|
12
|
-
return after.execution_state === 'RUNNING' || after.execution_state === 'STOPPED' && advanced;
|
|
13
|
-
return after.execution_state === 'STOPPED' && (operation !== 'step' || advanced);
|
|
14
|
-
}
|
|
15
|
-
export function debuggerMetadataFingerprint(raw) {
|
|
16
|
-
const value = object(raw);
|
|
17
|
-
if (typeof value.fingerprint !== 'string' || !/^[a-f0-9]{64}$/.test(value.fingerprint))
|
|
18
|
-
fail('partial', 'Debugger program metadata inspection is incomplete.');
|
|
19
|
-
count(value.count);
|
|
20
|
-
return value.fingerprint;
|
|
21
|
-
}
|
|
22
|
-
export async function debuggerProgramMetadata(backend, snapshot) {
|
|
23
|
-
if (backend.debuggerMetadata)
|
|
24
|
-
return backend.debuggerMetadata(snapshot);
|
|
25
|
-
if (!backend.inspect)
|
|
26
|
-
return undefined;
|
|
27
|
-
return debuggerMetadataFingerprint(await backend.inspect(snapshot, { kind: 'debugger_bookmarks' }));
|
|
28
|
-
}
|
|
29
|
-
export function debuggerResult(operation, p, raw) {
|
|
1
|
+
// Maps GhidraMCP debugger answers to public addresses (#161 wave 2).
|
|
2
|
+
import { object, fail } from './model.js';
|
|
3
|
+
import { publicAddress } from './research.js';
|
|
4
|
+
const failure = (raw) => {
|
|
5
|
+
const value = raw && typeof raw === 'object' ? raw : {};
|
|
6
|
+
return 'Debugger operation failed' + (typeof value.error === 'string' ? ': ' + value.error.slice(0, 500) : '.');
|
|
7
|
+
};
|
|
8
|
+
export function debuggerResult(operation, _p, raw) {
|
|
30
9
|
if (['launch_offers', 'traces', 'modules', 'list_breakpoints', 'stack_trace'].includes(operation)) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (operation === 'traces') {
|
|
40
|
-
text(row.name);
|
|
41
|
-
if (typeof row.current !== 'boolean')
|
|
42
|
-
fail('partial', 'Trace selection is absent.');
|
|
43
|
-
count(row.module_count);
|
|
44
|
-
count(row.thread_count);
|
|
45
|
-
}
|
|
46
|
-
if (operation === 'modules') {
|
|
47
|
-
text(row.name);
|
|
10
|
+
if (!Array.isArray(raw))
|
|
11
|
+
fail('partial', failure(raw));
|
|
12
|
+
const rows = raw.map(object);
|
|
13
|
+
for (const row of rows)
|
|
14
|
+
if (row.address !== undefined)
|
|
15
|
+
row.address = publicAddress(row.address);
|
|
16
|
+
if (operation === 'modules')
|
|
17
|
+
for (const row of rows)
|
|
48
18
|
if (row.base !== undefined)
|
|
49
19
|
row.base = publicAddress(row.base);
|
|
50
|
-
if (row.size !== undefined && !/^0x[0-9a-f]+$/i.test(String(row.size)))
|
|
51
|
-
fail('partial', 'Module size is invalid.');
|
|
52
|
-
}
|
|
53
|
-
if (operation === 'list_breakpoints') {
|
|
54
|
-
row.address = publicAddress(row.address);
|
|
55
|
-
count(row.trace_location_count);
|
|
56
|
-
if (typeof row.name !== 'string' || row.name.length > 4096 || row.name.includes('\0'))
|
|
57
|
-
fail('partial', 'Breakpoint name is invalid.');
|
|
58
|
-
text(row.state);
|
|
59
|
-
if (!Array.isArray(row.kinds) || row.kinds.some(kind => typeof kind !== 'string'))
|
|
60
|
-
fail('partial', 'Breakpoint kinds are absent.');
|
|
61
|
-
}
|
|
62
|
-
if (operation === 'stack_trace') {
|
|
63
|
-
count(row.level);
|
|
64
|
-
if (row.address !== undefined)
|
|
65
|
-
row.address = publicAddress(row.address);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
20
|
return rows;
|
|
69
21
|
}
|
|
70
22
|
const value = object(raw);
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (operation === 'write_memory') {
|
|
75
|
-
if (address(value.address) !== address(p.address) || String(value.bytes_hex).toLowerCase() !== String(p.bytes_hex).toLowerCase() || Number(value.size) !== String(p.bytes_hex).length / 2)
|
|
76
|
-
fail('partial', 'Live memory verification differs from the requested bytes.');
|
|
77
|
-
value.address = publicAddress(value.address);
|
|
78
|
-
}
|
|
79
|
-
else if (String(value.register).toLowerCase() !== String(p.register).toLowerCase() || !/^(?:0x)?[a-f0-9]+$/i.test(String(value.value)) || BigInt('0x' + String(value.value).replace(/^0x/i, '')) !== BigInt('0x' + String(p.value).replace(/^0x/i, '')) || !Number.isSafeInteger(value.bits) || Number(value.bits) < 1 || Number(value.bits) > 512)
|
|
80
|
-
fail('partial', 'Live register verification differs from the requested value.');
|
|
81
|
-
}
|
|
82
|
-
else if (['timeline', 'objects', 'object_values'].includes(operation)) {
|
|
83
|
-
if (!Array.isArray(value.items) || typeof value.complete !== 'boolean' || value.items.length > Number(p.limit ?? 1000))
|
|
84
|
-
fail('partial', 'Trace inventory omitted its bounded completion contract.');
|
|
85
|
-
for (const rawRow of value.items) {
|
|
86
|
-
const row = object(rawRow);
|
|
87
|
-
if (operation === 'timeline') {
|
|
88
|
-
if (!/^-?\d+$/.test(String(row.snap)) || typeof row.description !== 'string')
|
|
89
|
-
fail('partial', 'Trace timeline row is incomplete.');
|
|
90
|
-
}
|
|
91
|
-
if (operation === 'objects') {
|
|
92
|
-
if (!/^\d+$/.test(String(row.object_id)) || typeof row.path !== 'string' || typeof row.schema !== 'string' || typeof row.life !== 'string')
|
|
93
|
-
fail('partial', 'Trace object row is incomplete.');
|
|
94
|
-
}
|
|
95
|
-
if (operation === 'object_values') {
|
|
96
|
-
if (row.key !== p.key || typeof row.lifespan !== 'string' || typeof object(row.value).kind !== 'string')
|
|
97
|
-
fail('partial', 'Trace value row differs from the selected key.');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (operation === 'objects' && (!Number.isSafeInteger(value.visited) || Number(value.visited) < 0 || Number(value.visited) > Number(p.max_scan)))
|
|
101
|
-
fail('partial', 'Trace object work budget is inconsistent.');
|
|
102
|
-
if (operation === 'object_values' && String(value.object_id) !== String(p.object_id))
|
|
103
|
-
fail('binding', 'Trace value query selected another object.');
|
|
104
|
-
}
|
|
105
|
-
else if (operation === 'schedule') {
|
|
106
|
-
if (value.validated !== true || value.executed !== false || typeof value.schedule !== 'string' || !/^-?\d+$/.test(String(value.base_snap)) || !/^\d+$/.test(String(value.ticks)) || !/^\d+$/.test(String(value.patches)) || typeof value.snap_only !== 'boolean')
|
|
107
|
-
fail('partial', 'Trace schedule validation is incomplete.');
|
|
108
|
-
}
|
|
109
|
-
else if (operation === 'status') {
|
|
110
|
-
if (value.debugger_active !== true || typeof value.trace_active !== 'boolean')
|
|
111
|
-
fail('partial', 'Debugger status is incomplete.');
|
|
112
|
-
count(value.open_traces);
|
|
113
|
-
if (value.trace_active) {
|
|
114
|
-
if (typeof value.target_connected !== 'boolean')
|
|
115
|
-
fail('partial', 'Trace connection state is absent.');
|
|
116
|
-
count(value.module_count);
|
|
117
|
-
if (value.execution_state !== undefined && !['RUNNING', 'STOPPED', 'ALIVE', 'TERMINATED', 'UNKNOWN', 'INACTIVE'].includes(String(value.execution_state)))
|
|
118
|
-
fail('partial', 'Debugger execution state is invalid.');
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else if (operation === 'registers') {
|
|
122
|
-
for (const [name, register] of Object.entries(value)) {
|
|
123
|
-
text(name, 128);
|
|
124
|
-
if (typeof register !== 'string' || !/^0x[a-f0-9]{1,16}$/i.test(register))
|
|
125
|
-
fail('partial', 'Register result is not an exact hexadecimal value.');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else if (operation === 'read_memory') {
|
|
129
|
-
if (address(value.address) !== address(p.address) || !Number.isSafeInteger(value.size) || Number(value.size) < 0 || Number(value.size) > Number(p.size) || typeof value.hex !== 'string' || !/^(?:[a-f0-9]{2})*$/i.test(value.hex) || value.hex.length !== Number(value.size) * 2 || !Array.isArray(value.dwords) || value.dwords.length !== Math.floor(Number(value.size) / 4))
|
|
130
|
-
fail('partial', 'Debugger memory read is inconsistent.');
|
|
23
|
+
if (value.error !== undefined || value.success === false)
|
|
24
|
+
fail('partial', failure(value));
|
|
25
|
+
if (value.address !== undefined && operation !== 'registers')
|
|
131
26
|
value.address = publicAddress(value.address);
|
|
132
|
-
|
|
133
|
-
const bytes = value.hex.slice(i * 8, i * 8 + 8).match(/../g).reverse().join('');
|
|
134
|
-
if (typeof value.dwords[i] !== 'string' || String(value.dwords[i]).toLowerCase() !== '0x' + bytes.toLowerCase())
|
|
135
|
-
fail('partial', 'Debugger DWORDs differ from its memory bytes.');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else if (operation === 'static_to_dynamic') {
|
|
139
|
-
if (address(value.static_address) !== address(p.address))
|
|
140
|
-
fail('binding', 'Static mapping selected another address.');
|
|
27
|
+
if (operation === 'static_to_dynamic')
|
|
141
28
|
value.static_address = publicAddress(value.static_address);
|
|
29
|
+
if (value.dynamic_address !== undefined)
|
|
142
30
|
value.dynamic_address = publicAddress(value.dynamic_address);
|
|
143
|
-
}
|
|
144
|
-
else if (operation === 'dynamic_to_static') {
|
|
145
|
-
if (address(value.dynamic_address) !== address(p.address) || typeof value.module !== 'string' || !/^0x[0-9a-f]+$/i.test(String(value.offset)))
|
|
146
|
-
fail('partial', 'Dynamic mapping result is incomplete.');
|
|
147
|
-
value.dynamic_address = publicAddress(value.dynamic_address);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
const expected = { launch: 'launched', resume: 'resumed', interrupt: 'interrupted', step: p.kind === 'out' ? 'stepped_out' : 'stepped', set_breakpoint: 'set', remove_breakpoint: 'removed' };
|
|
151
|
-
if (value.status !== expected[operation] || !expected[operation])
|
|
152
|
-
fail('partial', 'Debugger action did not establish its expected result.');
|
|
153
|
-
if (operation === 'launch') {
|
|
154
|
-
text(value.offer_title);
|
|
155
|
-
text(value.trace_name);
|
|
156
|
-
}
|
|
157
|
-
if (operation === 'set_breakpoint' || operation === 'remove_breakpoint') {
|
|
158
|
-
if (address(value.address) !== address(p.address))
|
|
159
|
-
fail('binding', 'Breakpoint action selected another address.');
|
|
160
|
-
value.address = publicAddress(value.address);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
31
|
return value;
|
|
164
32
|
}
|
package/dist/src/debugger.d.ts
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { type CommandContext, type CommandDefinition } from '@eyeauras/cli-factory';
|
|
2
|
-
import {
|
|
3
|
-
import { Research, type ResearchBackend } from './research.js';
|
|
2
|
+
import type { Coordinator, Scope } from './core/coordinator.js';
|
|
4
3
|
export declare function debuggerWriteInputs(operation: string, p: Record<string, unknown>): void;
|
|
5
4
|
export declare class Debugger {
|
|
6
|
-
private readonly
|
|
7
|
-
private readonly
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
private readonly core;
|
|
6
|
+
private readonly profile;
|
|
7
|
+
constructor(core: Coordinator, profile?: Record<string, unknown>);
|
|
8
|
+
/** Switches the context to GUI and starts Ghidra's Debugger tool with the program open, once per GUI worker. */
|
|
10
9
|
private prepared;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
private trace;
|
|
11
|
+
private bridge;
|
|
12
|
+
/**
|
|
13
|
+
* Removes staged launch directories. Called only when no target is connected (a new launch, or a status showing the
|
|
14
|
+
* debugger stopped), so no live process runs from them; a file still in use is left for the next call.
|
|
15
|
+
*/
|
|
16
|
+
private clearRuns;
|
|
17
|
+
/** Copies the target's original binary (hub blob cache, hash verified) into the working copy for one launch; earlier launches' copies are removed. */
|
|
18
|
+
private stage;
|
|
19
|
+
read(s: Scope, operation: string, p: Record<string, unknown>): Promise<{
|
|
14
20
|
value: unknown;
|
|
15
|
-
trace?: string | undefined;
|
|
16
21
|
session: string;
|
|
17
22
|
target: string;
|
|
18
23
|
}>;
|
|
19
|
-
change(
|
|
24
|
+
change(s: Scope, operation: string, p: Record<string, unknown>): Promise<{
|
|
25
|
+
state: string;
|
|
26
|
+
value: Record<string, unknown> | Record<string, unknown>[];
|
|
27
|
+
session: string;
|
|
28
|
+
target: string;
|
|
29
|
+
}>;
|
|
20
30
|
}
|
|
21
31
|
export declare function debuggerCommands(service: (c: CommandContext) => Debugger): CommandDefinition[];
|