@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/artifacts.d.ts
CHANGED
|
@@ -12,7 +12,11 @@ export declare class Artifacts {
|
|
|
12
12
|
path(value: Artifact): string;
|
|
13
13
|
private ownedDirectory;
|
|
14
14
|
private syncDirectory;
|
|
15
|
+
/** Resolves the saved copy's path; its contents are not re-hashed. */
|
|
15
16
|
verify(value: Artifact): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* `limit` bounds the file as it is opened, so a file replaced after an earlier size check is never retained.
|
|
19
|
+
* The input is hashed first; it is copied only when that content is not saved yet.
|
|
20
|
+
*/
|
|
17
21
|
capture(source: string, kind: ArtifactKind, limit?: number): Promise<Artifact>;
|
|
18
22
|
}
|
package/dist/src/artifacts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { constants } from 'node:fs';
|
|
3
|
-
import { open, mkdir, link, unlink,
|
|
4
|
-
import { join
|
|
3
|
+
import { open, mkdir, link, unlink, lstat } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
5
|
import { fail } from './model.js';
|
|
6
6
|
const maximumBytes = 4 * 1024 * 1024 * 1024;
|
|
7
7
|
/** Immutable, content-addressed copies of the bytes actually consumed by the facade. */
|
|
@@ -11,17 +11,11 @@ export class Artifacts {
|
|
|
11
11
|
this.directory = directory;
|
|
12
12
|
}
|
|
13
13
|
path(value) {
|
|
14
|
-
if (!['input', 'snapshot', 'native'].includes(value.kind) || !/^[a-f0-9]{64}$/.test(value.sha256) ||
|
|
15
|
-
value.id !== `${value.kind}:${value.sha256}` || !Number.isSafeInteger(value.size) ||
|
|
16
|
-
value.size < 1 || value.size > maximumBytes)
|
|
17
|
-
fail('artifact', 'Saved artifact reference is malformed.');
|
|
18
14
|
return join(this.directory, 'artifacts', `${value.sha256}.${value.kind === 'snapshot' ? 'gzf' : value.kind === 'native' ? 'json' : 'bin'}`);
|
|
19
15
|
}
|
|
20
16
|
async ownedDirectory() {
|
|
21
17
|
const directory = join(this.directory, 'artifacts');
|
|
22
18
|
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
23
|
-
if ((await lstat(directory)).isSymbolicLink() || await realpath(directory) !== resolve(directory))
|
|
24
|
-
fail('artifact', 'Artifact directory must remain inside its owned profile storage.');
|
|
25
19
|
return directory;
|
|
26
20
|
}
|
|
27
21
|
async syncDirectory(directory) {
|
|
@@ -36,60 +30,51 @@ export class Artifacts {
|
|
|
36
30
|
await handle.close();
|
|
37
31
|
}
|
|
38
32
|
}
|
|
33
|
+
/** Resolves the saved copy's path; its contents are not re-hashed. */
|
|
39
34
|
async verify(value) {
|
|
40
|
-
|
|
41
|
-
const path = this.path(value);
|
|
42
|
-
if ((await lstat(path)).isSymbolicLink())
|
|
43
|
-
fail('artifact', 'Saved artifact cannot be replaced by a symbolic link.');
|
|
44
|
-
const handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
45
|
-
try {
|
|
46
|
-
const info = await handle.stat();
|
|
47
|
-
if (!info.isFile() || info.size !== value.size)
|
|
48
|
-
fail('artifact', 'Saved artifact size or type changed.');
|
|
49
|
-
const hash = createHash('sha256');
|
|
50
|
-
let size = 0;
|
|
51
|
-
for await (const chunk of handle.createReadStream({ autoClose: false })) {
|
|
52
|
-
size += chunk.length;
|
|
53
|
-
hash.update(chunk);
|
|
54
|
-
if (size > value.size)
|
|
55
|
-
fail('artifact', 'Saved artifact grew during verification.');
|
|
56
|
-
}
|
|
57
|
-
if (size !== value.size || hash.digest('hex') !== value.sha256)
|
|
58
|
-
fail('artifact', 'Saved artifact contents changed; its original copy is required.');
|
|
59
|
-
return path;
|
|
60
|
-
}
|
|
61
|
-
finally {
|
|
62
|
-
await handle.close();
|
|
63
|
-
}
|
|
35
|
+
return this.path(value);
|
|
64
36
|
}
|
|
65
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* `limit` bounds the file as it is opened, so a file replaced after an earlier size check is never retained.
|
|
39
|
+
* The input is hashed first; it is copied only when that content is not saved yet.
|
|
40
|
+
*/
|
|
66
41
|
async capture(source, kind, limit = maximumBytes) {
|
|
67
42
|
if (!['input', 'snapshot', 'native'].includes(kind))
|
|
68
43
|
fail('artifact', 'Unsupported artifact kind.');
|
|
69
|
-
const directory = await this.ownedDirectory();
|
|
70
|
-
const temporary = join(directory, 'pending-' + randomUUID());
|
|
71
44
|
const input = await open(source, constants.O_RDONLY);
|
|
72
|
-
let output;
|
|
45
|
+
let output, temporary;
|
|
73
46
|
try {
|
|
74
47
|
const info = await input.stat({ bigint: true });
|
|
75
48
|
if (!info.isFile() || info.size < 1n || info.size > BigInt(Math.min(limit, maximumBytes)))
|
|
76
49
|
fail('limit', limit < maximumBytes ? `Input must be a nonempty regular file of at most ${limit} bytes.` : 'Input must be a nonempty regular file of at most 4 GiB.');
|
|
77
|
-
output = await open(temporary, 'wx', 0o600);
|
|
78
50
|
const hash = createHash('sha256');
|
|
79
51
|
let size = 0;
|
|
80
|
-
for await (const chunk of input.createReadStream({ autoClose: false })) {
|
|
52
|
+
for await (const chunk of input.createReadStream({ autoClose: false, start: 0 })) {
|
|
81
53
|
size += chunk.length;
|
|
82
54
|
if (size > Math.min(limit, maximumBytes))
|
|
83
55
|
fail('limit', 'Input exceeds its size limit.');
|
|
84
56
|
hash.update(chunk);
|
|
85
|
-
await output.writeFile(chunk);
|
|
86
57
|
}
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
after.
|
|
90
|
-
|
|
58
|
+
const unchanged = async () => {
|
|
59
|
+
const after = await input.stat({ bigint: true });
|
|
60
|
+
if (BigInt(size) !== info.size || after.size !== info.size || after.mtimeNs !== info.mtimeNs ||
|
|
61
|
+
after.ctimeNs !== info.ctimeNs)
|
|
62
|
+
fail('inputChanged', 'Input changed while being copied; retry against a stable file.');
|
|
63
|
+
};
|
|
91
64
|
const sha256 = hash.digest('hex');
|
|
92
65
|
const result = { id: `${kind}:${sha256}`, kind, sha256, size };
|
|
66
|
+
const saved = await lstat(this.path(result)).then(() => true, error => { if (error.code === 'ENOENT')
|
|
67
|
+
return false; throw error; });
|
|
68
|
+
if (saved) {
|
|
69
|
+
await unchanged();
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
const directory = await this.ownedDirectory();
|
|
73
|
+
temporary = join(directory, 'pending-' + randomUUID());
|
|
74
|
+
output = await open(temporary, 'wx', 0o600);
|
|
75
|
+
for await (const chunk of input.createReadStream({ autoClose: false, start: 0 }))
|
|
76
|
+
await output.writeFile(chunk);
|
|
77
|
+
await unchanged();
|
|
93
78
|
await output.chmod(0o400);
|
|
94
79
|
await output.sync();
|
|
95
80
|
await output.close();
|
|
@@ -102,15 +87,15 @@ export class Artifacts {
|
|
|
102
87
|
if (error.code !== 'EEXIST')
|
|
103
88
|
throw error;
|
|
104
89
|
}
|
|
105
|
-
await this.verify(result);
|
|
106
90
|
await this.syncDirectory(directory);
|
|
107
91
|
return result;
|
|
108
92
|
}
|
|
109
93
|
finally {
|
|
110
94
|
await input.close();
|
|
111
95
|
await output?.close();
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
if (temporary)
|
|
97
|
+
await unlink(temporary).catch(error => { if (error.code !== 'ENOENT')
|
|
98
|
+
throw error; });
|
|
114
99
|
}
|
|
115
100
|
}
|
|
116
101
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { type CommandContext, type CommandDefinition, type CommandInput } from '@eyeauras/cli-factory';
|
|
1
|
+
import { type CommandContext, type CommandDefinition, type CommandInput, type IAppArguments } from '@eyeauras/cli-factory';
|
|
2
2
|
import { AuditStore } from './activity-audit.js';
|
|
3
3
|
/** Factory still owns admission, parsing, permissions, I/O and IPC. Only admitted handlers are wrapped. */
|
|
4
4
|
export declare class ActivityAudit {
|
|
5
5
|
private readonly failures;
|
|
6
|
+
/** One store, and so one SQLite connection, per profile for the owner's lifetime. */
|
|
7
|
+
private readonly stores;
|
|
6
8
|
store(c: CommandContext): AuditStore;
|
|
9
|
+
/** Factory deletes a profile's AppData after invalidation; the history connection must not hold it open. */
|
|
10
|
+
invalidateProfile(app: IAppArguments): void;
|
|
11
|
+
dispose(): void;
|
|
7
12
|
run<T>(c: CommandContext, name: string, input: CommandInput, action: () => Promise<T>): Promise<T>;
|
|
8
13
|
wrap(entry: CommandDefinition, parents?: string[]): CommandDefinition;
|
|
9
14
|
commands(): CommandDefinition;
|
|
@@ -40,7 +40,14 @@ function filter(o, max = 200) {
|
|
|
40
40
|
/** Factory still owns admission, parsing, permissions, I/O and IPC. Only admitted handlers are wrapped. */
|
|
41
41
|
export class ActivityAudit {
|
|
42
42
|
failures = new Map();
|
|
43
|
-
store
|
|
43
|
+
/** One store, and so one SQLite connection, per profile for the owner's lifetime. */
|
|
44
|
+
stores = new Map();
|
|
45
|
+
store(c) { const directory = join(c.appArguments.AppDataDirectory, 'audit'); let store = this.stores.get(directory); if (!store)
|
|
46
|
+
this.stores.set(directory, store = new AuditStore(directory)); return store; }
|
|
47
|
+
/** Factory deletes a profile's AppData after invalidation; the history connection must not hold it open. */
|
|
48
|
+
invalidateProfile(app) { const directory = join(app.AppDataDirectory, 'audit'); this.stores.get(directory)?.close(); this.stores.delete(directory); }
|
|
49
|
+
dispose() { for (const store of this.stores.values())
|
|
50
|
+
store.close(); this.stores.clear(); }
|
|
44
51
|
run(c, name, input, action) {
|
|
45
52
|
let warned = false;
|
|
46
53
|
const store = this.store(c);
|
|
@@ -63,7 +70,7 @@ export class ActivityAudit {
|
|
|
63
70
|
commands() {
|
|
64
71
|
return command('audit', 'Inspect the local activity audit without starting tools', [
|
|
65
72
|
command('status', 'Read audit health, retention and attempts lacking a recorded outcome', (_i, c) => ({ schema: 1, path: this.store(c).path, ...this.store(c).status(), lastWriteFailure: this.failures.get(this.store(c).directory) ?? null,
|
|
66
|
-
coverage: { admittedServiceHandlers: true, requestStateTransitions:
|
|
73
|
+
coverage: { admittedServiceHandlers: true, requestStateTransitions: false, gcActions: false, transportFailures: false, authCallbacks: true, factoryParsingAndPermissionRefusals: false, factoryProfileCommands: false, packageMetadata: false }, authority: 'diagnostic history only; never authorizes replay or cleanup' }), { permission: Permission.ReadOnly }),
|
|
67
74
|
command('list', 'Read recent activity with stable sequence pagination', ({ options: o }, c) => this.store(c).list(filter(o)), { permission: Permission.ReadOnly, options: queryOptions }),
|
|
68
75
|
command('show <operation>', 'Read events for one command attempt', ({ args, options: o }, c) => { const operation = String(args.operation); if (!/^[a-f0-9-]{36}$/i.test(operation))
|
|
69
76
|
invalid('Use an operationId from audit list.'); return this.store(c).list({ ...filter(o), operationId: operation }); }, { permission: Permission.ReadOnly, options: queryOptions }),
|
|
@@ -11,34 +11,16 @@ export interface AuditPolicy {
|
|
|
11
11
|
days: number;
|
|
12
12
|
databaseBytes: number;
|
|
13
13
|
}
|
|
14
|
-
export interface RetentionState {
|
|
15
|
-
policy: AuditPolicy;
|
|
16
|
-
lastSweepMs: number;
|
|
17
|
-
runs: number;
|
|
18
|
-
lastRemoved: number;
|
|
19
|
-
}
|
|
20
14
|
export declare function auditUnavailable(): never;
|
|
21
15
|
export declare function auditPolicy(input: {
|
|
22
16
|
events: number;
|
|
23
17
|
days: number;
|
|
24
18
|
databaseBytes?: number;
|
|
25
19
|
}): AuditPolicy;
|
|
26
|
-
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function retentionState(db: DatabaseSync): RetentionState;
|
|
29
|
-
export declare function auditStorageMode(db: DatabaseSync): {
|
|
30
|
-
autoVacuum: number;
|
|
31
|
-
journalMode: string;
|
|
32
|
-
};
|
|
33
|
-
export declare function requireAuditStorageMode(db: DatabaseSync): void;
|
|
34
|
-
export declare const auditAdmissionMs = 3000;
|
|
20
|
+
export declare function liveAuditBytes(db: DatabaseSync): number;
|
|
21
|
+
export declare function metadataNumber(db: DatabaseSync, key: string): number;
|
|
35
22
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* oldest live waiter contends for the lock, and the marker is removed as soon as the lock is held.
|
|
39
|
-
* Retry only a definitely unacquired auxiliary DB lock, never INSERT, COMMIT or a tool action.
|
|
23
|
+
* Retention runs once when a store is opened, and only when a sweep is due: it removes expired events, then the
|
|
24
|
+
* oldest ones above the event or byte budget, and records one `audit.gc` summary when it removed anything.
|
|
40
25
|
*/
|
|
41
|
-
export declare function
|
|
42
|
-
export declare function liveAuditBytes(db: DatabaseSync): number;
|
|
43
|
-
/** The caller holds BEGIN IMMEDIATE. Summary insertion is direct, never another append/GC call. */
|
|
44
|
-
export declare function collectAudit(db: DatabaseSync, now: number, incoming: number, pruned: number, state: RetentionState, summary: (data: Record<string, unknown>) => void): void;
|
|
26
|
+
export declare function collectAudit(db: DatabaseSync, policy: AuditPolicy, now: number): void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { randomBytes } from 'node:crypto';
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
4
2
|
import { CliError } from '@eyeauras/cli-factory';
|
|
5
3
|
export const auditLimits = { events: 20000, days: 30, eventBytes: 4096, databaseBytes: 16 * 1024 * 1024, sweepIntervalMs: 5 * 60000 };
|
|
6
4
|
export function auditUnavailable() { throw new CliError('Audit history is unavailable or incompatible; preserve its files. No history was reset.', { code: 'audit.unavailable' }); }
|
|
@@ -10,158 +8,47 @@ export function auditPolicy(input) {
|
|
|
10
8
|
auditUnavailable();
|
|
11
9
|
return policy;
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
/** Called only in the owned schema initialization/upgrade transaction. Never overwrite unknown metadata. */
|
|
17
|
-
export function initializeRetention(db, policy, now) {
|
|
18
|
-
for (const key of keys)
|
|
19
|
-
if (db.prepare('SELECT value FROM metadata WHERE key=?').get(key))
|
|
20
|
-
auditUnavailable();
|
|
21
|
-
db.exec("ALTER TABLE events ADD COLUMN writer_version INTEGER NOT NULL DEFAULT 1; CREATE TRIGGER audit_writer_v2 BEFORE INSERT ON events WHEN NEW.writer_version IS NOT 2 BEGIN SELECT RAISE(ABORT,'Incompatible audit writer'); END;");
|
|
22
|
-
for (const [key, value] of Object.entries({ retentionEvents: policy.events, retentionDays: policy.days, retentionBytes: policy.databaseBytes, lastSweepMs: now, gcRuns: 0, lastGcRemoved: 0 }))
|
|
23
|
-
set(db, key, value);
|
|
24
|
-
db.exec('PRAGMA user_version=2');
|
|
25
|
-
}
|
|
26
|
-
export function retentionState(db) {
|
|
27
|
-
if (!db.prepare("SELECT name FROM sqlite_master WHERE type='trigger' AND name='audit_writer_v2'").get())
|
|
28
|
-
auditUnavailable();
|
|
29
|
-
const rows = db.prepare("SELECT key,value FROM metadata WHERE key IN ('retentionEvents','retentionDays','retentionBytes','lastSweepMs','gcRuns','lastGcRemoved')").all(), values = {};
|
|
30
|
-
for (const row of rows) {
|
|
31
|
-
if (typeof row.key !== 'string' || typeof row.value !== 'string' || !/^\d+$/.test(row.value) || !Number.isSafeInteger(Number(row.value)))
|
|
32
|
-
auditUnavailable();
|
|
33
|
-
values[row.key] = Number(row.value);
|
|
34
|
-
}
|
|
35
|
-
if (keys.some(key => values[key] === undefined))
|
|
36
|
-
auditUnavailable();
|
|
37
|
-
return { policy: auditPolicy({ events: values.retentionEvents, days: values.retentionDays, databaseBytes: values.retentionBytes }), lastSweepMs: values.lastSweepMs, runs: values.gcRuns, lastRemoved: values.lastGcRemoved };
|
|
38
|
-
}
|
|
39
|
-
export function auditStorageMode(db) { return { autoVacuum: Number(db.prepare('PRAGMA auto_vacuum').get()?.auto_vacuum), journalMode: String(db.prepare('PRAGMA journal_mode').get()?.journal_mode) }; }
|
|
40
|
-
export function requireAuditStorageMode(db) { const mode = auditStorageMode(db); if (mode.autoVacuum !== 1 || mode.journalMode !== 'delete')
|
|
41
|
-
auditUnavailable(); }
|
|
42
|
-
const writerWait = new Int32Array(new SharedArrayBuffer(4));
|
|
43
|
-
const pause = (ms) => { if (ms > 0)
|
|
44
|
-
Atomics.wait(writerWait, 0, 0, ms); };
|
|
45
|
-
const waiterName = /^\.writer-(\d{13})-(\d{13})-(\d+)-([a-f0-9]{16})$/;
|
|
46
|
-
/** Older waiters of live processes, oldest first; stale or foreign entries never block admission. */
|
|
47
|
-
function olderWaiters(directory, own, now) {
|
|
48
|
-
let names;
|
|
49
|
-
try {
|
|
50
|
-
names = readdirSync(directory);
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
return names.filter(name => {
|
|
56
|
-
const match = waiterName.exec(name);
|
|
57
|
-
if (!match || name >= own)
|
|
58
|
-
return false;
|
|
59
|
-
const deadline = Number(match[2]), pid = Number(match[3]);
|
|
60
|
-
// A waiter gives up at its own admission deadline; a marker past it (or of a dead process) is abandoned,
|
|
61
|
-
// so even a reused PID can hold others back no longer than that waiter's own wait.
|
|
62
|
-
if (now > deadline + 1000 || !live(pid)) {
|
|
63
|
-
try {
|
|
64
|
-
unlinkSync(join(directory, name));
|
|
65
|
-
}
|
|
66
|
-
catch { /* Another writer removed it. */ }
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function live(pid) { try {
|
|
73
|
-
process.kill(pid, 0);
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
return error.code === 'EPERM';
|
|
78
|
-
} }
|
|
79
|
-
export const auditAdmissionMs = 3000;
|
|
11
|
+
export function liveAuditBytes(db) { return (Number(db.prepare('PRAGMA page_count').get()?.page_count) - Number(db.prepare('PRAGMA freelist_count').get()?.freelist_count)) * Number(db.prepare('PRAGMA page_size').get()?.page_size); }
|
|
12
|
+
export function metadataNumber(db, key) { const value = Number(db.prepare('SELECT value FROM metadata WHERE key=?').get(key)?.value); return Number.isSafeInteger(value) ? value : 0; }
|
|
13
|
+
function set(db, key, value) { db.prepare('INSERT OR REPLACE INTO metadata(key,value) VALUES(?,?)').run(key, String(value)); }
|
|
80
14
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* oldest live waiter contends for the lock, and the marker is removed as soon as the lock is held.
|
|
84
|
-
* Retry only a definitely unacquired auxiliary DB lock, never INSERT, COMMIT or a tool action.
|
|
15
|
+
* Retention runs once when a store is opened, and only when a sweep is due: it removes expired events, then the
|
|
16
|
+
* oldest ones above the event or byte budget, and records one `audit.gc` summary when it removed anything.
|
|
85
17
|
*/
|
|
86
|
-
export function
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const own = '.writer-' + String(started).padStart(13, '0') + '-' + String(started + admissionMs).padStart(13, '0') + '-' + process.pid + '-' + randomBytes(8).toString('hex'), marker = join(directory, own);
|
|
90
|
-
let registered = false;
|
|
91
|
-
try {
|
|
92
|
-
writeFileSync(marker, '', { flag: 'wx', mode: 0o600 });
|
|
93
|
-
registered = true;
|
|
94
|
-
}
|
|
95
|
-
catch { /* Without a marker this writer contends unordered, as before. */ }
|
|
96
|
-
try {
|
|
97
|
-
for (;;) {
|
|
98
|
-
if (registered && olderWaiters(directory, own, Date.now()).length && performance.now() < deadline) {
|
|
99
|
-
pause(Math.min(2, deadline - performance.now()));
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const remaining = deadline - performance.now();
|
|
103
|
-
db.exec('PRAGMA busy_timeout=' + Math.max(0, Math.min(50, Math.ceil(remaining))));
|
|
104
|
-
try {
|
|
105
|
-
db.exec('BEGIN IMMEDIATE');
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
let busy = false;
|
|
110
|
-
try {
|
|
111
|
-
const e = error;
|
|
112
|
-
busy = e?.code === 'ERR_SQLITE_ERROR' && typeof e.errcode === 'number' && Number.isSafeInteger(e.errcode) && e.errcode > 0 && [5, 6].includes(e.errcode & 255);
|
|
113
|
-
}
|
|
114
|
-
catch { }
|
|
115
|
-
if (!busy || performance.now() >= deadline)
|
|
116
|
-
throw error;
|
|
117
|
-
// SQLite's long busy-handler backoff can repeatedly miss short free intervals; restart it with bounded jitter.
|
|
118
|
-
pause(Math.max(0, Math.min(5 + (process.pid + attempt++ * 13) % 21, deadline - performance.now())));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
finally {
|
|
123
|
-
if (registered)
|
|
124
|
-
try {
|
|
125
|
-
unlinkSync(marker);
|
|
126
|
-
}
|
|
127
|
-
catch { /* Removed by a peer as abandoned. */ }
|
|
128
|
-
// The admitted writer's commit waits for readers as long as its admission did.
|
|
129
|
-
db.exec('PRAGMA busy_timeout=' + Math.max(3000, Math.ceil(admissionMs)));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
export function liveAuditBytes(db) { return (Number(db.prepare('PRAGMA page_count').get()?.page_count) - Number(db.prepare('PRAGMA freelist_count').get()?.freelist_count)) * Number(db.prepare('PRAGMA page_size').get()?.page_size); }
|
|
133
|
-
function count(db) { return Number(db.prepare('SELECT count(*) count FROM events').get().count); }
|
|
134
|
-
/** The caller holds BEGIN IMMEDIATE. Summary insertion is direct, never another append/GC call. */
|
|
135
|
-
export function collectAudit(db, now, incoming, pruned, state, summary) {
|
|
136
|
-
const policy = state.policy, eventsBefore = count(db), liveBytesBefore = liveAuditBytes(db), periodic = now < state.lastSweepMs || now - state.lastSweepMs >= auditLimits.sweepIntervalMs;
|
|
137
|
-
const reserve = 128 * 1024, eventPressure = eventsBefore > policy.events || periodic && eventsBefore + 1 > policy.events, bytePressure = liveBytesBefore > policy.databaseBytes || periodic && liveBytesBefore + reserve > policy.databaseBytes;
|
|
138
|
-
if (!periodic && !eventPressure && !bytePressure)
|
|
18
|
+
export function collectAudit(db, policy, now) {
|
|
19
|
+
const last = metadataNumber(db, 'lastSweepMs');
|
|
20
|
+
if (now >= last && now - last < auditLimits.sweepIntervalMs)
|
|
139
21
|
return;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
22
|
+
db.exec('BEGIN IMMEDIATE');
|
|
23
|
+
try {
|
|
24
|
+
const count = () => Number(db.prepare('SELECT count(*) count FROM events').get().count);
|
|
25
|
+
const drop = (n) => Number(db.prepare('DELETE FROM events WHERE seq IN (SELECT seq FROM events ORDER BY seq LIMIT ?)').run(n).changes);
|
|
26
|
+
const eventsBefore = count(), liveBytesBefore = liveAuditBytes(db);
|
|
27
|
+
const expiredEvents = Number(db.prepare('DELETE FROM events WHERE at_ms<?').run(now - policy.days * 86400000).changes);
|
|
28
|
+
let removed = expiredEvents;
|
|
29
|
+
const target = Math.max(2, Math.floor(policy.events * 0.8));
|
|
30
|
+
if (count() >= policy.events)
|
|
31
|
+
removed += drop(count() - (target - 1));
|
|
32
|
+
const targetBytes = Math.floor(policy.databaseBytes * 0.75);
|
|
33
|
+
for (let n = 0; n < 32 && liveAuditBytes(db) > targetBytes; n++) {
|
|
34
|
+
const changed = drop(Math.max(1, Math.ceil(count() * 0.1)));
|
|
151
35
|
if (!changed)
|
|
152
|
-
|
|
36
|
+
break;
|
|
153
37
|
removed += changed;
|
|
154
38
|
}
|
|
39
|
+
set(db, 'prunedEvents', metadataNumber(db, 'prunedEvents') + removed);
|
|
40
|
+
set(db, 'lastSweepMs', now);
|
|
41
|
+
set(db, 'gcRuns', metadataNumber(db, 'gcRuns') + 1);
|
|
42
|
+
set(db, 'lastGcRemoved', removed);
|
|
43
|
+
if (removed) {
|
|
44
|
+
const data = { schema: 1, operationId: randomUUID(), command: 'audit', event: 'audit.gc', at: new Date(now).toISOString(), automatic: true, state: 'complete', outcome: 'success',
|
|
45
|
+
gcTrigger: eventsBefore >= policy.events ? 'event-limit' : liveBytesBefore > targetBytes ? 'byte-limit' : 'periodic', removedEvents: removed, expiredEvents, eventsBefore, eventsAfter: count() + 1, liveBytesBefore, liveBytesAfterPrune: liveAuditBytes(db), pid: process.pid };
|
|
46
|
+
db.prepare('INSERT INTO events(at_ms,operation_id,event,command,outcome,data) VALUES(?,?,?,?,?,?)').run(now, data.operationId, data.event, data.command, 'success', JSON.stringify(data));
|
|
47
|
+
}
|
|
48
|
+
db.exec('COMMIT');
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
db.exec('ROLLBACK');
|
|
52
|
+
throw error;
|
|
155
53
|
}
|
|
156
|
-
// Account for the maintenance event even if the original pressure was only age.
|
|
157
|
-
if (count(db) + 1 > policy.events)
|
|
158
|
-
removed += drop(Math.max(0, count(db) - (targetEvents - 1)));
|
|
159
|
-
const eventsAfter = count(db) + 1, liveBytesAfterPrune = liveAuditBytes(db);
|
|
160
|
-
set(db, 'prunedEvents', pruned + removed);
|
|
161
|
-
set(db, 'lastSweepMs', now);
|
|
162
|
-
set(db, 'gcRuns', state.runs + 1);
|
|
163
|
-
set(db, 'lastGcRemoved', removed);
|
|
164
|
-
summary({ automatic: true, state: 'complete', outcome: 'success', gcTrigger: eventPressure && trimBytes ? 'multiple' : eventPressure ? 'event-limit' : trimBytes ? 'byte-limit' : 'periodic', removedEvents: removed, expiredEvents, eventsBefore, eventsAfter, liveBytesBefore, liveBytesAfterPrune });
|
|
165
|
-
if (count(db) > policy.events || liveAuditBytes(db) > policy.databaseBytes)
|
|
166
|
-
auditUnavailable();
|
|
167
54
|
}
|
package/dist/src/binary.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { command, Permission, CliError } from '@eyeauras/cli-factory';
|
|
2
2
|
import { join, resolve, dirname } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { mkdir, writeFile, copyFile
|
|
4
|
+
import { mkdir, writeFile, copyFile } from 'node:fs/promises';
|
|
5
5
|
import { constants } from 'node:fs';
|
|
6
6
|
import { release } from 'node:os';
|
|
7
7
|
import { randomUUID } from 'node:crypto';
|
|
8
8
|
import { runTool } from './tool-runtime/run.js';
|
|
9
9
|
import { atomicWrite } from './tool-runtime/store.js';
|
|
10
|
-
import { fileSha256 } from './tool-runtime/archives.js';
|
|
11
10
|
import { fail, text, id } from './model.js';
|
|
12
11
|
import { number } from './research.js';
|
|
13
12
|
const helper = fileURLToPath(new URL('../../runtime/native/binary/insight-binary-darwin-arm64', import.meta.url));
|
|
14
13
|
export function binaryCommands(workspace) {
|
|
15
|
-
const run = (mode) => command(mode + ' [input]', mode === 'query' ? 'Inspect bounded PE, ELF or thin Mach-O metadata without executing the input' : 'Change one expected PE subsystem field in a new copy
|
|
14
|
+
const run = (mode) => command(mode + ' [input]', mode === 'query' ? 'Inspect bounded PE, ELF or thin Mach-O metadata without executing the input' : 'Change one expected PE subsystem field in a new copy', async ({ args, options: o }, c) => {
|
|
16
15
|
if (process.platform !== 'darwin' || process.arch !== 'arm64' || Number(release().split('.')[0]) < 23)
|
|
17
16
|
fail('unsupported', 'The packaged LIEF facade is currently verified on macOS14+ ARM64; input formats are PE, ELF and thin Mach-O.');
|
|
18
17
|
if (Boolean(args.input) === Boolean(o.target))
|
|
@@ -35,7 +34,7 @@ export function binaryCommands(workspace) {
|
|
|
35
34
|
edit = { expectedSubsystem: expected, subsystem: value, output: edited };
|
|
36
35
|
}
|
|
37
36
|
await atomicWrite(plan, { schema: 1, mode, input, view, filter: o.filter === undefined ? undefined : text(o.filter, 4096), limit, offset, ...edit });
|
|
38
|
-
const result = await runTool(c, { tool: 'binary', role: mode, executable: helper, arguments: [plan], timeoutMs: 60000, maxOutputBytes: 8 * 1024 ** 2, nativeDeadline: true, target: target.id, metadata: { view
|
|
37
|
+
const result = await runTool(c, { tool: 'binary', role: mode, executable: helper, arguments: [plan], timeoutMs: 60000, maxOutputBytes: 8 * 1024 ** 2, nativeDeadline: true, target: target.id, metadata: { view } });
|
|
39
38
|
let observation;
|
|
40
39
|
try {
|
|
41
40
|
observation = JSON.parse(result.stdout);
|
|
@@ -45,22 +44,14 @@ export function binaryCommands(workspace) {
|
|
|
45
44
|
}
|
|
46
45
|
if (!['completed', 'partial'].includes(observation?.state) || typeof observation.complete !== 'boolean')
|
|
47
46
|
fail('partial', 'Binary query receipt was not verified.', { process: result.process, diagnostics: result.diagnostics });
|
|
48
|
-
if (await fileSha256(input) !== target.binarySha256)
|
|
49
|
-
fail('binding', 'Immutable binary changed during inspection.');
|
|
50
47
|
const warnings = result.stderr.trim(), value = { ...observation, ...(warnings ? { state: 'partial', complete: false, reason: 'native_parser_diagnostics', warnings: warnings.slice(0, 4096), warningsTruncated: warnings.length > 4096 } : {}), target: target.id, inputSha256: target.binarySha256, process: result.process, elapsedMs: result.elapsedMs, diagnostics: result.diagnostics };
|
|
51
48
|
if (mode === 'edit-subsystem') {
|
|
52
49
|
if (!value.complete)
|
|
53
50
|
fail('partial', 'Native parser diagnostics prevent accepting the copied edit.', value);
|
|
54
|
-
const before = await readFile(input), after = await readFile(edited), at = Number(BigInt(observation.fieldOffset));
|
|
55
|
-
if (after.length !== before.length || !Number.isSafeInteger(at) || at < 0 || at + 2 > before.length)
|
|
56
|
-
fail('binding', 'Copied PE edit did not retain its field bounds.');
|
|
57
|
-
for (let n = 0; n < before.length; n++)
|
|
58
|
-
if (n !== at && n !== at + 1 && before[n] !== after[n])
|
|
59
|
-
fail('binding', 'Copied PE edit changed bytes outside the declared field.');
|
|
60
51
|
const output = resolve(c.cwd, text(o.output, 4096));
|
|
61
52
|
await mkdir(dirname(output), { recursive: true, mode: 0o700 });
|
|
62
53
|
await copyFile(edited, output, constants.COPYFILE_EXCL);
|
|
63
|
-
return { ...value, output,
|
|
54
|
+
return { ...value, output, originalPreserved: true };
|
|
64
55
|
}
|
|
65
56
|
if (o.output) {
|
|
66
57
|
const output = resolve(c.cwd, text(o.output, 4096)), content = JSON.stringify(value, null, 2) + '\n';
|
package/dist/src/budgets.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare function ghidraBudget(values: Record<string, unknown
|
|
1
|
+
/** Initial import/analysis budget in milliseconds: execution policy, deliberately separate from immutable program load settings. */
|
|
2
|
+
export declare function ghidraBudget(values: Record<string, unknown>): number;
|
package/dist/src/budgets.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { fail } from './model.js';
|
|
2
|
-
/**
|
|
3
|
-
export function ghidraBudget(values
|
|
4
|
-
const
|
|
5
|
-
const fallback = phase === 'import' ? 3600 : 120;
|
|
6
|
-
const value = values[field] === undefined ? fallback : values[field];
|
|
2
|
+
/** Initial import/analysis budget in milliseconds: execution policy, deliberately separate from immutable program load settings. */
|
|
3
|
+
export function ghidraBudget(values) {
|
|
4
|
+
const value = values.initialImportSeconds === undefined ? 3600 : values.initialImportSeconds;
|
|
7
5
|
if (typeof value !== 'number' && (typeof value !== 'string' || !/^\d+$/.test(value)))
|
|
8
|
-
fail('configuration',
|
|
9
|
-
const seconds = Number(value)
|
|
10
|
-
if (!Number.isSafeInteger(seconds) || seconds < 1 || seconds >
|
|
11
|
-
fail('configuration',
|
|
6
|
+
fail('configuration', 'initialImportSeconds must be an integer number of seconds.');
|
|
7
|
+
const seconds = Number(value);
|
|
8
|
+
if (!Number.isSafeInteger(seconds) || seconds < 1 || seconds > 86400)
|
|
9
|
+
fail('configuration', 'initialImportSeconds must be between 1 and 86400 seconds.');
|
|
12
10
|
return seconds * 1000;
|
|
13
11
|
}
|