@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
package/dist/src/debugger.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
// Debugger of a working copy (#161 wave 2): Ghidra's Debugger tool in the context's GUI worker. The target binary
|
|
2
|
+
// comes from the hub blob cache (hash verified) and is staged inside the working copy for each launch. Live state
|
|
3
|
+
// is Ghidra's; nothing about a launch or trace is stored by insight-cli.
|
|
1
4
|
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { failUnresolved } from './unresolved-guidance.js';
|
|
5
|
+
import { randomBytes } from 'node:crypto';
|
|
6
|
+
import { copyFile, mkdir, readdir, rm } from 'node:fs/promises';
|
|
7
|
+
import { join, resolve } from 'node:path';
|
|
6
8
|
import { selectedOptions } from './arguments.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
const lists = ['launch_offers', 'modules', 'list_breakpoints', 'stack_trace'];
|
|
9
|
+
import { address, helperScript, markedLine, number, scope } from './research.js';
|
|
10
|
+
import { fail, object, text } from './model.js';
|
|
11
|
+
import { debuggerResult } from './debugger-results.js';
|
|
12
|
+
const lists = ['launch_offers', 'modules', 'list_breakpoints', 'stack_trace', 'traces'];
|
|
11
13
|
const liveWrites = new Set(['write_memory', 'write_register']);
|
|
14
|
+
const traceOperations = new Set(['write_memory', 'write_register', 'timeline', 'objects', 'object_values', 'schedule']);
|
|
15
|
+
const changing = new Set(['launch', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint', ...liveWrites]);
|
|
12
16
|
function traceInteger(value) {
|
|
13
17
|
const encoded = text(String(value), 32);
|
|
14
18
|
if (!/^-?\d+$/.test(encoded))
|
|
@@ -31,179 +35,119 @@ export function debuggerWriteInputs(operation, p) {
|
|
|
31
35
|
if (!/^(?:0x)?[a-f0-9]{1,128}$/i.test(String(p[key])))
|
|
32
36
|
fail('invalid', 'Register values must be exact unsigned hex integers.');
|
|
33
37
|
}
|
|
38
|
+
/** GUI workers whose Debugger tool InsightStartDebugger has started. */
|
|
39
|
+
const debuggerStarted = new WeakSet();
|
|
34
40
|
export class Debugger {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
this.research = research;
|
|
41
|
-
this.backend = backend;
|
|
41
|
+
core;
|
|
42
|
+
profile;
|
|
43
|
+
constructor(core, profile = {}) {
|
|
44
|
+
this.core = core;
|
|
45
|
+
this.profile = profile;
|
|
42
46
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
/** Switches the context to GUI and starts Ghidra's Debugger tool with the program open, once per GUI worker. */
|
|
48
|
+
async prepared(s, action) {
|
|
49
|
+
await this.core.setMode(s, 'gui');
|
|
50
|
+
return this.core.withWorker(s, async (worker) => {
|
|
51
|
+
if (!debuggerStarted.has(worker)) {
|
|
52
|
+
const ready = await helperScript(worker, 'InsightStartDebugger');
|
|
53
|
+
if (ready.success !== true || !String(ready.console_output ?? '').includes('INSIGHT_DEBUGGER_READY'))
|
|
54
|
+
fail('partial', 'Ghidra\'s Debugger tool did not start' + (typeof ready.error === 'string' ? ': ' + ready.error.slice(0, 500) : '.'), { ...s });
|
|
55
|
+
debuggerStarted.add(worker);
|
|
56
|
+
}
|
|
57
|
+
return action(worker);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
trace(s, worker, p) {
|
|
61
|
+
return helperScript(worker, 'InsightTraceState', Buffer.from(JSON.stringify({ ...p, owned_root: this.core.copyRoot(s) })).toString('base64'))
|
|
62
|
+
.then(result => markedLine(result, 'INSIGHT_TRACE_STATE '));
|
|
63
|
+
}
|
|
64
|
+
async bridge(s, worker, operation, p = {}) {
|
|
65
|
+
if (traceOperations.has(operation))
|
|
66
|
+
return this.trace(s, worker, { ...p, operation });
|
|
67
|
+
if (operation === 'list_breakpoints')
|
|
68
|
+
return (await this.trace(s, worker, { operation: 'breakpoints' })).items;
|
|
69
|
+
if (['resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint'].includes(operation))
|
|
70
|
+
await this.trace(s, worker, { operation: 'focus' });
|
|
71
|
+
if (operation === 'read_memory')
|
|
72
|
+
await this.trace(s, worker, { operation: 'read_memory', address: p.address, size: p.size });
|
|
73
|
+
const raw = await worker.request(['launch', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint'].includes(operation) ? 'POST' : 'GET', '/debugger/' + operation, { ...p, ...(['launch', 'launch_offers', 'static_to_dynamic'].includes(operation) && worker.program ? { program: worker.program } : {}) });
|
|
74
|
+
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
75
|
+
const { program: _p, executable_path: _e, target_description: _d, ...rest } = object(raw);
|
|
76
|
+
return rest;
|
|
60
77
|
}
|
|
61
|
-
return
|
|
78
|
+
return raw;
|
|
62
79
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Removes staged launch directories. Called only when no target is connected (a new launch, or a status showing the
|
|
82
|
+
* debugger stopped), so no live process runs from them; a file still in use is left for the next call.
|
|
83
|
+
*/
|
|
84
|
+
async clearRuns(s) {
|
|
85
|
+
const runs = join(this.core.copyRoot(s), 'debugger-run');
|
|
86
|
+
for (const name of (await readdir(runs).catch(() => [])).filter(n => /^r_[a-f0-9]{12}$/.test(n)))
|
|
87
|
+
await rm(join(runs, name), { recursive: true, force: true }).catch(() => { });
|
|
88
|
+
}
|
|
89
|
+
/** Copies the target's original binary (hub blob cache, hash verified) into the working copy for one launch; earlier launches' copies are removed. */
|
|
90
|
+
async stage(s) {
|
|
91
|
+
await this.clearRuns(s);
|
|
92
|
+
const source = await this.core.targetFile(s.target), root = join(this.core.copyRoot(s), 'debugger-run', 'r_' + randomBytes(6).toString('hex'));
|
|
93
|
+
await mkdir(root, { recursive: true });
|
|
94
|
+
const executable = join(root, process.platform === 'win32' ? 'image.exe' : 'image');
|
|
95
|
+
await copyFile(source, executable);
|
|
96
|
+
return { root, executable };
|
|
97
|
+
}
|
|
98
|
+
async read(s, operation, p) {
|
|
99
|
+
return this.prepared(s, async (worker) => {
|
|
100
|
+
const { limit, offset, ...rest } = p;
|
|
101
|
+
let value = await this.bridge(s, worker, operation, rest);
|
|
67
102
|
if (operation !== 'traces')
|
|
68
|
-
value = debuggerResult(operation, p,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (operation === 'traces')
|
|
75
|
-
value = saved.traces.map(row => ({ trace: row.id, name: this.workspace.target(selected.target).name, current: row.id === saved.active, snap: row.snap, module_count: row.modules, thread_count: row.threads, connected: row.connected }));
|
|
76
|
-
if (operation === 'traces' || lists.includes(operation)) {
|
|
77
|
-
const rows = value, offset = Number(p.offset ?? 0), limit = Number(p.limit ?? 50);
|
|
78
|
-
value = { items: rows.slice(offset, offset + limit), total: rows.length, offset, limit, truncated: offset + limit < rows.length };
|
|
103
|
+
value = debuggerResult(operation, p, value);
|
|
104
|
+
if (operation === 'status' && object(value).target_connected !== true)
|
|
105
|
+
await this.clearRuns(s);
|
|
106
|
+
if (lists.includes(operation)) {
|
|
107
|
+
const rows = value, from = Number(offset ?? 0), size = Number(limit ?? 50);
|
|
108
|
+
value = { items: rows.slice(from, from + size), total: rows.length, offset: from, limit: size, truncated: from + size < rows.length };
|
|
79
109
|
}
|
|
80
|
-
return { ...
|
|
110
|
+
return { ...s, value };
|
|
81
111
|
});
|
|
82
112
|
}
|
|
83
|
-
async change(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (request.state === 'failed' && result.reason === 'disconnected')
|
|
92
|
-
fail('disconnected', 'Selected trace has no live target.', result);
|
|
93
|
-
if (request.state === 'failed' && result.reason === 'busy')
|
|
94
|
-
fail('busy', 'This context still has a connected debugger; close/reopen it or use another session before a new launch.', result);
|
|
95
|
-
if (request.state === 'failed' && result.reason === 'native_precondition')
|
|
96
|
-
fail('rejected', 'The native live precondition failed; the target write was not started.', result);
|
|
97
|
-
fail('unknown', 'Debugger action is retained and is not repeated.', request.result);
|
|
98
|
-
}
|
|
99
|
-
const backend = await this.prepared(selected, trace), context = this.workspace.context(selected);
|
|
100
|
-
if (operation === 'launch' && (await backend.debuggerSaved(selected)).connected) {
|
|
101
|
-
const result = { ...selected, state: 'not_started', reason: 'busy' };
|
|
102
|
-
this.workspace.recordRequest(request.id, 'failed', result);
|
|
103
|
-
fail('busy', 'This context still has a connected debugger; close/reopen it or use another session before a new launch.', result);
|
|
104
|
-
}
|
|
105
|
-
const before = debuggerResult('status', {}, await backend.debuggerCall(selected, 'status'));
|
|
106
|
-
if (operation !== 'launch' && object(before).target_connected !== true) {
|
|
107
|
-
const result = { ...selected, state: 'not_started', reason: 'disconnected' };
|
|
108
|
-
this.workspace.recordRequest(request.id, 'failed', result);
|
|
109
|
-
fail('disconnected', 'Selected trace has no live target.', result);
|
|
110
|
-
}
|
|
111
|
-
const beforeMetadata = context.workingSnapshot ? await metadata(backend, context.workingSnapshot) : undefined;
|
|
112
|
-
this.workspace.startRequest(request.id, { kind: 'debugger', operation, generation: context.generation, before });
|
|
113
|
-
let saved, savedSnapshot, metadataChanged = false;
|
|
114
|
-
try {
|
|
115
|
-
let raw;
|
|
116
|
-
if (operation === 'launch') {
|
|
117
|
-
if (!backend.debuggerLaunch)
|
|
118
|
-
fail('configuration', 'Owned target staging is unavailable.');
|
|
119
|
-
raw = await backend.debuggerLaunch(selected, p, request.id);
|
|
120
|
-
}
|
|
121
|
-
else
|
|
122
|
-
raw = await backend.debuggerCall(selected, operation, p);
|
|
123
|
-
if (liveWrites.has(operation) && object(raw).status === 'rejected' && object(raw).target_effect_started === false) {
|
|
124
|
-
const result = { ...selected, state: 'not_started', reason: 'native_precondition', value: raw };
|
|
125
|
-
this.workspace.recordRequest(request.id, 'failed', result);
|
|
126
|
-
fail('rejected', 'Native live preconditions rejected the write before target dispatch.', result);
|
|
127
|
-
}
|
|
128
|
-
const value = debuggerResult(operation, p, raw);
|
|
129
|
-
if (['resume', 'interrupt', 'step'].includes(operation)) {
|
|
130
|
-
let observed = false;
|
|
131
|
-
for (let attempt = 0; attempt < 40; attempt++) {
|
|
132
|
-
const status = object(debuggerResult('status', {}, await backend.debuggerCall(selected, 'status')));
|
|
133
|
-
if (debuggerExecutionSettled(operation, object(before), status)) {
|
|
134
|
-
observed = true;
|
|
135
|
-
break;
|
|
136
|
-
}
|
|
137
|
-
await delay(100);
|
|
138
|
-
}
|
|
139
|
-
if (!observed)
|
|
140
|
-
fail('partial', 'Debugger execution state did not settle after the action.');
|
|
141
|
-
}
|
|
142
|
-
if (operation === 'set_breakpoint' || operation === 'remove_breakpoint') {
|
|
143
|
-
let observed = false;
|
|
144
|
-
for (let attempt = 0; attempt < 50; attempt++) {
|
|
145
|
-
const rows = debuggerResult('list_breakpoints', {}, await backend.debuggerCall(selected, 'list_breakpoints'));
|
|
146
|
-
if (rows.some(row => address(row.address) === address(p.address) && Number(row.trace_location_count) > 0) === (operation === 'set_breakpoint')) {
|
|
147
|
-
observed = true;
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
await delay(100);
|
|
151
|
-
}
|
|
152
|
-
if (!observed)
|
|
153
|
-
fail('partial', 'Breakpoint inventory did not verify the action.');
|
|
154
|
-
}
|
|
155
|
-
if (operation === 'launch' && p.stop_at_entry === true) {
|
|
156
|
-
const stopped = object(debuggerResult('status', {}, await backend.debuggerCall(selected, 'status')));
|
|
157
|
-
if (stopped.target_connected !== true || stopped.execution_state !== 'STOPPED')
|
|
158
|
-
fail('partial', 'Entry-stop launch did not verify a stopped live target.');
|
|
159
|
-
}
|
|
160
|
-
saved = await backend.debuggerSaved(selected);
|
|
161
|
-
savedSnapshot = await backend.saved(selected);
|
|
162
|
-
metadataChanged = beforeMetadata !== undefined && beforeMetadata !== await metadata(backend, savedSnapshot);
|
|
163
|
-
const complexChanges = metadataChanged ? [...context.complexChanges, request.id] : context.complexChanges;
|
|
164
|
-
const result = { ...selected, state: 'applied', ...(operation === 'launch' && p.stop_at_entry === true ? { stoppedAtEntry: true } : {}), ...(saved.active ? { trace: saved.active } : {}), pendingChanges: context.scalars.length + complexChanges.length, sharedState: context.scalars.length || complexChanges.length ? 'pending' : 'shared', value };
|
|
165
|
-
this.workspace.completeSavedRequest(selected, request.id, context.generation, { debugger: saved, workingSnapshot: savedSnapshot, complexChanges }, result);
|
|
166
|
-
return result;
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
if (this.workspace.request(request.id).state === 'failed')
|
|
170
|
-
throw error;
|
|
171
|
-
try {
|
|
172
|
-
saved ??= await backend.debuggerSaved(selected);
|
|
173
|
-
}
|
|
174
|
-
catch { }
|
|
175
|
-
try {
|
|
176
|
-
savedSnapshot ??= await backend.saved(selected);
|
|
177
|
-
metadataChanged = beforeMetadata !== undefined && beforeMetadata !== await metadata(backend, savedSnapshot);
|
|
178
|
-
}
|
|
179
|
-
catch { }
|
|
180
|
-
this.workspace.recordRequest(request.id, 'unknown', { ...selected, state: 'unknown', operation, ...(saved ? { savedDebugger: saved } : {}), ...(savedSnapshot ? { savedSnapshot, metadataChanged } : {}) });
|
|
181
|
-
throw error;
|
|
113
|
+
async change(s, operation, p) {
|
|
114
|
+
return this.prepared(s, async (worker) => {
|
|
115
|
+
let raw;
|
|
116
|
+
if (operation === 'launch') {
|
|
117
|
+
const { root, executable } = await this.stage(s), { stop_at_entry: _, ...parameters } = p;
|
|
118
|
+
raw = await this.bridge(s, worker, 'launch', { ...parameters, executable_path: executable, cwd: p.cwd ?? root,
|
|
119
|
+
...(typeof this.profile.debuggerPython === 'string' ? { python_executable: this.profile.debuggerPython } : {}),
|
|
120
|
+
...(typeof this.profile.windbgDir === 'string' ? { windbg_dir: this.profile.windbgDir } : {}) });
|
|
182
121
|
}
|
|
122
|
+
else
|
|
123
|
+
raw = await this.bridge(s, worker, operation, p);
|
|
124
|
+
if (liveWrites.has(operation) && object(raw).status === 'rejected' && object(raw).target_effect_started === false)
|
|
125
|
+
fail('rejected', 'The live precondition did not hold; nothing was written to the target.', { ...s, value: raw });
|
|
126
|
+
return { ...s, state: 'applied', value: debuggerResult(operation, p, raw) };
|
|
183
127
|
});
|
|
184
128
|
}
|
|
185
129
|
}
|
|
186
130
|
export function debuggerCommands(service) {
|
|
187
|
-
const leaves = []
|
|
131
|
+
const leaves = [];
|
|
188
132
|
const operations = ['launch', 'launch_offers', 'status', 'traces', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint', 'list_breakpoints', 'registers', 'read_memory', 'stack_trace', 'modules', 'static_to_dynamic', 'dynamic_to_static', 'write_memory', 'write_register', 'timeline', 'objects', 'object_values', 'schedule'];
|
|
189
133
|
for (const operation of operations) {
|
|
190
|
-
const
|
|
191
|
-
const options = [...selectedOptions, ...(
|
|
134
|
+
const at = ['set_breakpoint', 'remove_breakpoint', 'read_memory', 'static_to_dynamic', 'dynamic_to_static', 'write_memory'].includes(operation), paged = lists.includes(operation);
|
|
135
|
+
const options = [...selectedOptions, ...(at ? [{ flags: '--address <address>', description: 'Explicit static or trace address', required: true }] : []),
|
|
192
136
|
...(operation === 'read_memory' ? [{ flags: '--size <bytes>', description: 'Read 1–4096 bytes', defaultValue: 64 }] : []), ...(operation === 'stack_trace' ? [{ flags: '--depth <count>', description: 'Maximum frames 1–1000', defaultValue: 20 }] : []),
|
|
193
|
-
...(operation === 'write_memory' ? [{ flags: '--expect-hex <hex>', description: 'Exact current bytes before
|
|
194
|
-
...(operation === 'write_register' ? [{ flags: '--register <name>', description: 'Exact target
|
|
137
|
+
...(operation === 'write_memory' ? [{ flags: '--expect-hex <hex>', description: 'Exact current bytes before the write', required: true }, { flags: '--bytes-hex <hex>', description: 'Equal-length replacement bytes, at most 4096', required: true }] : []),
|
|
138
|
+
...(operation === 'write_register' ? [{ flags: '--register <name>', description: 'Exact target register', required: true }, { flags: '--expect-value <hex>', description: 'Exact current unsigned hex value', required: true }, { flags: '--value <hex>', description: 'Replacement unsigned hex value', required: true }] : []),
|
|
195
139
|
...(['timeline', 'objects'].includes(operation) ? [{ flags: '--limit <count>', description: 'Maximum returned rows 1–1000', defaultValue: 100 }] : []),
|
|
196
|
-
...(operation === 'timeline' ? [{ flags: '--before-snap <integer>', description: 'Latest included snapshot key; result gives next-before-snap' }] : []),
|
|
197
|
-
...(operation === 'objects' ? [{ flags: '--path-prefix <text>', description: 'Literal canonical path prefix
|
|
140
|
+
...(operation === 'timeline' ? [{ flags: '--before-snap <integer>', description: 'Latest included snapshot key; the result gives next-before-snap' }] : []),
|
|
141
|
+
...(operation === 'objects' ? [{ flags: '--path-prefix <text>', description: 'Literal canonical path prefix', defaultValue: '' }, { flags: '--max-scan <count>', description: 'Maximum visited objects 1–200000', defaultValue: 10000 }] : []),
|
|
198
142
|
...(['objects', 'object_values'].includes(operation) ? [{ flags: '--snap <integer>', description: 'Snapshot key (default selected time)' }] : []),
|
|
199
|
-
...(operation === 'object_values' ? [{ flags: '--object-id <integer>', description: 'Object ID returned by objects
|
|
143
|
+
...(operation === 'object_values' ? [{ flags: '--object-id <integer>', description: 'Object ID returned by objects', required: true }, { flags: '--key <name>', description: 'Exact native attribute/element key', required: true },
|
|
200
144
|
{ flags: '--from-snap <integer>', description: 'Start of a bounded history range' }, { flags: '--to-snap <integer>', description: 'End of a range of at most 1000 snaps' }] : []),
|
|
201
145
|
...(operation === 'schedule' ? [{ flags: '--schedule <time>', description: 'Parse and validate a native time schedule without executing it', required: true }] : []),
|
|
202
146
|
...(paged ? [{ flags: '--limit <count>', description: 'Page size 1–100', defaultValue: 50 }, { flags: '--offset <count>', description: 'Page offset', defaultValue: 0 }] : []),
|
|
203
147
|
...(operation === 'step' ? [{ flags: '--kind <kind>', description: 'into, over or out', defaultValue: 'into' }] : []),
|
|
204
|
-
...(operation === 'launch' ? [{ flags: '--
|
|
205
|
-
{ flags: '--offer <name>', description: 'Launch offer title or configuration name', defaultValue: process.platform === 'win32' ? 'dbgeng' : process.platform === 'darwin' ? 'lldb' : 'gdb' }, { flags: '--timeout-seconds <count>', description: 'Launch wait 1–300 seconds', defaultValue: 60 }] : [])
|
|
206
|
-
leaves.push(command(operation.replaceAll('_', '-'), 'Use the
|
|
148
|
+
...(operation === 'launch' ? [{ flags: '--args <text>', description: 'Target command-line arguments', defaultValue: '' }, { flags: '--cwd <directory>', description: 'Target working directory (default: the staging folder in the working copy)' },
|
|
149
|
+
{ flags: '--offer <name>', description: 'Launch offer title or configuration name', defaultValue: process.platform === 'win32' ? 'dbgeng' : process.platform === 'darwin' ? 'lldb' : 'gdb' }, { flags: '--timeout-seconds <count>', description: 'Launch wait 1–300 seconds', defaultValue: 60 }] : [])];
|
|
150
|
+
leaves.push(command(operation.replaceAll('_', '-'), 'Use the context debugger (switches the context to GUI mode)', ({ options: o }, c) => {
|
|
207
151
|
const p = {};
|
|
208
152
|
if (at)
|
|
209
153
|
p.address = address(o.address);
|
|
@@ -254,11 +198,6 @@ export function debuggerCommands(service) {
|
|
|
254
198
|
fail('invalid', 'Step kind must be into, over or out.');
|
|
255
199
|
}
|
|
256
200
|
if (operation === 'launch') {
|
|
257
|
-
if (o.stopAtEntry === true) {
|
|
258
|
-
if (process.platform !== 'darwin' || o.offer !== 'lldb')
|
|
259
|
-
fail('unsupported', '--stop-at-entry requires the local macOS lldb offer.');
|
|
260
|
-
p.stop_at_entry = true;
|
|
261
|
-
}
|
|
262
201
|
if (typeof o.args !== 'string' || o.args.length > 8192 || o.args.includes('\0'))
|
|
263
202
|
fail('invalid', 'Arguments must be bounded text.');
|
|
264
203
|
p.args = o.args;
|
|
@@ -270,9 +209,8 @@ export function debuggerCommands(service) {
|
|
|
270
209
|
fail('invalid', 'Debugger working directory must be a single filesystem path.');
|
|
271
210
|
}
|
|
272
211
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}, { permission: operation === 'remove_breakpoint' || liveWrites.has(operation) ? 'Destructive' : changing ? Permission.Update : Permission.ReadOnly, options }));
|
|
212
|
+
return changing.has(operation) ? service(c).change(scope(o), operation, p) : service(c).read(scope(o), operation, p);
|
|
213
|
+
}, { permission: operation === 'remove_breakpoint' || liveWrites.has(operation) ? 'Destructive' : changing.has(operation) ? Permission.Update : Permission.ReadOnly, options }));
|
|
276
214
|
}
|
|
277
|
-
return [command('debugger', 'Debug the
|
|
215
|
+
return [command('debugger', 'Debug the target in the context\'s GUI worker', leaves)];
|
|
278
216
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** Ghidra's bounded linear decode, as returned. */
|
|
2
|
+
export declare function decodedInstructions(raw: unknown, _at: string, _maxBytes: number, _maxInstructions: number): Record<string, unknown>;
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const value = object(raw), input = value.input_bytes;
|
|
6
|
-
if (typeof input !== 'string' || !/^(?:[a-f0-9]{2})+$/.test(input) || input.length > maxBytes * 2 || value.input_sha256 !== createHash('sha256').update(Buffer.from(input, 'hex')).digest('hex') || address(value.address) !== at || !Array.isArray(value.instructions) || value.instructions.length > maxInstructions || typeof value.language !== 'string' || typeof value.stop_reason !== 'string' || !['byte_limit', 'instruction_limit', 'truncated_instruction', 'executable_block_end', 'terminal_flow', 'control_flow', 'context_unavailable', 'undecodable'].includes(value.stop_reason))
|
|
7
|
-
fail('partial', 'Malformed bounded instruction result.');
|
|
8
|
-
let consumed = 0;
|
|
9
|
-
for (const raw of value.instructions) {
|
|
10
|
-
const row = object(raw);
|
|
11
|
-
if (!Number.isSafeInteger(row.length) || Number(row.length) < 1 || typeof row.bytes !== 'string' || row.bytes !== input.slice(consumed * 2, (consumed + Number(row.length)) * 2) || row.bytes.length !== Number(row.length) * 2 || typeof row.mnemonic !== 'string' || !Array.isArray(row.operands) || row.operands.some(v => typeof v !== 'string') || !Array.isArray(row.direct_targets) || row.direct_targets.some(v => typeof v !== 'string') || typeof row.computed_flow !== 'boolean' || row.computed_flow && row.direct_targets.length)
|
|
12
|
-
fail('partial', 'Decoded instruction does not match input bytes or flow.');
|
|
13
|
-
const [space, offset] = at.includes(':') ? at.split(':') : [undefined, at];
|
|
14
|
-
if (address(row.address) !== (space ? space + ':' : '') + (BigInt('0x' + offset) + BigInt(consumed)).toString(16))
|
|
15
|
-
fail('partial', 'Decoded instruction address changed.');
|
|
16
|
-
consumed += Number(row.length);
|
|
17
|
-
}
|
|
18
|
-
if (value.consumed_bytes !== consumed || object(value.read_only ?? {}).modification_unchanged !== true)
|
|
19
|
-
fail('partial', 'Decoder omitted consumed bytes or read-only proof.');
|
|
20
|
-
return value;
|
|
1
|
+
import { object } from './model.js';
|
|
2
|
+
/** Ghidra's bounded linear decode, as returned. */
|
|
3
|
+
export function decodedInstructions(raw, _at, _maxBytes, _maxInstructions) {
|
|
4
|
+
return object(raw);
|
|
21
5
|
}
|
|
@@ -8,5 +8,5 @@ export declare function transportDiagnostic(error: unknown, phase: TransportPhas
|
|
|
8
8
|
method: string;
|
|
9
9
|
port: number;
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
11
|
+
/** The code and transport diagnostic (built by transportDiagnostic) of one of our own errors, for the audit. */
|
|
12
12
|
export declare function diagnosticFailure(error: unknown): Record<string, unknown> | undefined;
|
|
@@ -54,29 +54,10 @@ export function transportDiagnostic(error, phase, method, port, status) {
|
|
|
54
54
|
const name = field(error, 'name');
|
|
55
55
|
return { phase, method, port, ...(typeof name === 'string' && names.has(name) ? { errorName: name } : {}), causeCodes: [...codes], ...(status !== undefined ? { httpStatus: status } : {}) };
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
57
|
+
/** The code and transport diagnostic (built by transportDiagnostic) of one of our own errors, for the audit. */
|
|
58
58
|
export function diagnosticFailure(error) {
|
|
59
|
-
|
|
60
|
-
if (!(error instanceof CliError) || !errorCodes.has(error.code))
|
|
61
|
-
return undefined;
|
|
62
|
-
const result = { code: error.code }, raw = field(error.result, 'transport') ?? field(field(error.result, 'detail'), 'transport');
|
|
63
|
-
const phase = field(raw, 'phase'), method = field(raw, 'method'), port = field(raw, 'port');
|
|
64
|
-
if (typeof phase !== 'string' || !['fetch', 'body', 'status'].includes(phase) || typeof method !== 'string' || !['GET', 'POST'].includes(method) || !Number.isSafeInteger(port) || Number(port) < 0 || Number(port) > 65535)
|
|
65
|
-
return result;
|
|
66
|
-
const name = field(raw, 'errorName'), codes = field(raw, 'causeCodes'), status = field(raw, 'httpStatus'), safeCodes = [];
|
|
67
|
-
const length = field(codes, 'length');
|
|
68
|
-
if (array(codes) && typeof length === 'number')
|
|
69
|
-
for (let i = 0; i < 4 && i < length; i++) {
|
|
70
|
-
const code = field(codes, String(i));
|
|
71
|
-
if (typeof code === 'string' && networkCodes.has(code))
|
|
72
|
-
safeCodes.push(code);
|
|
73
|
-
}
|
|
74
|
-
result.transport = { phase, method, port, ...(typeof name === 'string' && names.has(name) ? { errorName: name } : {}),
|
|
75
|
-
causeCodes: safeCodes,
|
|
76
|
-
...(Number.isInteger(status) && Number(status) >= 100 && Number(status) <= 599 ? { httpStatus: status } : {}) };
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
59
|
+
if (!(error instanceof CliError) || !errorCodes.has(error.code))
|
|
80
60
|
return undefined;
|
|
81
|
-
|
|
61
|
+
const transport = field(error.result, 'transport') ?? field(field(error.result, 'detail'), 'transport');
|
|
62
|
+
return { code: error.code, ...(transport && typeof transport === 'object' ? { transport } : {}) };
|
|
82
63
|
}
|
package/dist/src/die.js
CHANGED
|
@@ -3,40 +3,18 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
3
3
|
import { release } from 'node:os';
|
|
4
4
|
import { mkdir, writeFile, stat } from 'node:fs/promises';
|
|
5
5
|
import { ToolInstaller } from './tool-runtime/installer.js';
|
|
6
|
-
import { treeFingerprint } from './tool-runtime/store.js';
|
|
7
6
|
import { defineTool, lifecycleCommands } from './tool-runtime/definition.js';
|
|
8
7
|
import { catalogArtifact } from './tool-runtime/catalog.js';
|
|
9
8
|
import { runTool } from './tool-runtime/run.js';
|
|
10
|
-
import { fileSha256 } from './tool-runtime/archives.js';
|
|
11
9
|
import { fail, text, id } from './model.js';
|
|
12
10
|
import { number } from './research.js';
|
|
13
|
-
const frameworks = ['QtConcurrent', 'QtCore', 'QtCore5Compat', 'QtNetwork', 'QtQml'];
|
|
14
11
|
const contents = (executable) => dirname(dirname(executable));
|
|
15
12
|
export function dieInstaller(c) {
|
|
16
13
|
return new ToolInstaller(c, { id: 'die', primary: 'die', components: () => {
|
|
17
14
|
if (process.platform !== 'darwin' || process.arch !== 'arm64' || Number(release().split('.')[0]) < 22)
|
|
18
15
|
fail('unsupported', 'Managed DiE requires macOS 13+ ARM64.');
|
|
19
16
|
return { die: catalogArtifact('5fc9f1d870b4c791ae688a07ccbae0dcdf677eedeeb6ae732bbc83eac61148af') };
|
|
20
|
-
}, launch: roots => ({ executable: join(roots.die, 'MacOS/diec'), arguments: [], environment: {} }),
|
|
21
|
-
const root = contents(executable), inputs = {};
|
|
22
|
-
// The database is executable signature code: fingerprint it as part of the external tool.
|
|
23
|
-
for (const name of ['db', 'db_custom'])
|
|
24
|
-
inputs['Resources/' + name] = await treeFingerprint(join(root, 'Resources', name));
|
|
25
|
-
inputs['Resources/qt.conf'] = await fileSha256(join(root, 'Resources/qt.conf'));
|
|
26
|
-
for (const path of ['MacOS/qt.conf', 'Info.plist', 'PlugIns'])
|
|
27
|
-
try {
|
|
28
|
-
const at = join(root, path);
|
|
29
|
-
inputs[path] = (await stat(at)).isDirectory() ? await treeFingerprint(at) : await fileSha256(at);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
if (error.code !== 'ENOENT')
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
if (process.platform === 'darwin')
|
|
36
|
-
for (const name of frameworks)
|
|
37
|
-
inputs[name] = await treeFingerprint(join(root, 'Frameworks', name + '.framework'));
|
|
38
|
-
return inputs;
|
|
39
|
-
}, probe: async (launch, context) => {
|
|
17
|
+
}, launch: roots => ({ executable: join(roots.die, 'MacOS/diec'), arguments: [], environment: {} }), probe: async (launch, context) => {
|
|
40
18
|
const root = contents(launch.executable);
|
|
41
19
|
await stat(join(root, 'Resources/db/_init'));
|
|
42
20
|
const r = await runTool(context, { tool: 'die', role: 'version', executable: launch.executable, arguments: ['--version'], maxOutputBytes: 65536, timeoutMs: 30000 });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { join, dirname } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { mkdir, copyFile, rename
|
|
3
|
+
import { mkdir, copyFile, rename } from 'node:fs/promises';
|
|
4
4
|
import { constants } from 'node:fs';
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
6
6
|
import { atomicWrite, readJson } from './tool-runtime/store.js';
|
|
7
|
-
import { fileSha256
|
|
7
|
+
import { fileSha256 } from './tool-runtime/archives.js';
|
|
8
8
|
import { runTool } from './tool-runtime/run.js';
|
|
9
9
|
import { fail } from './model.js';
|
|
10
10
|
export const dnspyNative = fileURLToPath(new URL('../../runtime/native/dnspy-extension/', import.meta.url));
|
|
@@ -20,26 +20,19 @@ export async function prepareDnspy(root, c) {
|
|
|
20
20
|
await atomicWrite(plan, { Schema: 1, Nonce: nonce, Mode: 'patch-engine', Input: input, Output: output, BuildKey: join(dnspyNative, 'upstream-public-build.snk'), Result: result });
|
|
21
21
|
await runTool(c, { tool: 'dnspy', role: 'prepare-unicode-loader', executable: join(root, 'dnSpy.exe'), arguments: ['--multiple', '--no-activate', '--settings-file', join(directory, 'settings.xml'), '--extension-directory', extension, '--insight-plan:' + plan], nativeDeadline: true, timeoutMs: 60000, maxOutputBytes: 65536 });
|
|
22
22
|
const receipt = await readJson(result);
|
|
23
|
-
if (receipt?.
|
|
23
|
+
if (receipt?.data?.state !== 'completed' || !receipt.data.unicodeLoader || !receipt.data.strongNameIdentityPreserved)
|
|
24
24
|
fail('binding', 'Owned dnSpy Unicode-loader preparation was not verified.', { diagnostics: directory });
|
|
25
25
|
// The one-shot process has exited and the native Job has closed before replacing any mapped engine.
|
|
26
26
|
await rename(output, input);
|
|
27
27
|
await atomicWrite(join(root, 'insight-unicode-loader.json'), receipt.data);
|
|
28
28
|
}
|
|
29
29
|
export async function prepareExternalDnspy(executable, stage, c) {
|
|
30
|
-
const manifest = await readJson(join(dnspyNative, 'vendor-files.json'));
|
|
31
|
-
if (manifest?.schema !== 1 || manifest.files.length !== 867)
|
|
32
|
-
fail('binding', 'Pinned dnSpy file inventory is missing.');
|
|
30
|
+
const manifest = (await readJson(join(dnspyNative, 'vendor-files.json')));
|
|
33
31
|
const originalRoot = dirname(executable), owned = join(stage, 'execution');
|
|
34
32
|
for (const entry of manifest.files) {
|
|
35
|
-
|
|
36
|
-
const source = join(originalRoot, entry.path), destination = join(owned, entry.path), info = await lstat(source);
|
|
37
|
-
if (!info.isFile() || info.size !== entry.size || await fileSha256(source) !== entry.sha256)
|
|
38
|
-
fail('binding', 'External dnSpy component differs from the pinned vendor bundle.', { component: entry.path });
|
|
33
|
+
const source = join(originalRoot, entry.path), destination = join(owned, entry.path);
|
|
39
34
|
await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
|
|
40
35
|
await copyFile(source, destination, constants.COPYFILE_EXCL);
|
|
41
|
-
if (await fileSha256(destination) !== entry.sha256)
|
|
42
|
-
fail('binding', 'Copied dnSpy component differs from the pinned vendor bundle.');
|
|
43
36
|
}
|
|
44
37
|
await prepareDnspy(owned, c);
|
|
45
38
|
return { executable: join(owned, 'dnSpy.exe'), arguments: [], environment: {} };
|