@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/store.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import { mkdirSync, chmodSync, existsSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { randomUUID } from 'node:crypto';
|
|
5
|
-
import { assertIdentity, digest, fail, finding, identity, stable } from './model.js';
|
|
6
|
-
export class Store {
|
|
7
|
-
directory;
|
|
8
|
-
profile;
|
|
9
|
-
server;
|
|
10
|
-
static pending(directory) {
|
|
11
|
-
const path = join(directory, 'coordinator.sqlite');
|
|
12
|
-
if (!existsSync(path))
|
|
13
|
-
return false;
|
|
14
|
-
const db = new DatabaseSync(path, { readOnly: true });
|
|
15
|
-
try {
|
|
16
|
-
return Number(db.prepare("SELECT COUNT(*) AS count FROM findings WHERE state != 'published_verified'").get()?.count) > 0;
|
|
17
|
-
}
|
|
18
|
-
finally {
|
|
19
|
-
db.close();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
db;
|
|
23
|
-
constructor(directory, profile, server) {
|
|
24
|
-
this.directory = directory;
|
|
25
|
-
this.profile = profile;
|
|
26
|
-
this.server = server;
|
|
27
|
-
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
28
|
-
const path = join(directory, 'coordinator.sqlite');
|
|
29
|
-
this.db = new DatabaseSync(path);
|
|
30
|
-
chmodSync(path, 0o600);
|
|
31
|
-
this.db.exec(`PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; PRAGMA foreign_keys=ON; PRAGMA busy_timeout=5000;
|
|
32
|
-
CREATE TABLE IF NOT EXISTS targets(id TEXT PRIMARY KEY, lane TEXT NOT NULL UNIQUE, data TEXT NOT NULL);
|
|
33
|
-
CREATE TABLE IF NOT EXISTS findings(id TEXT PRIMARY KEY, request_id TEXT NOT NULL UNIQUE, hash TEXT NOT NULL, target_id TEXT NOT NULL REFERENCES targets(id), state TEXT NOT NULL, batch_id TEXT, data TEXT NOT NULL, conflict TEXT);
|
|
34
|
-
CREATE TABLE IF NOT EXISTS batches(id TEXT PRIMARY KEY, target_id TEXT NOT NULL REFERENCES targets(id), state TEXT NOT NULL, owner_pid INTEGER NOT NULL, data TEXT NOT NULL);
|
|
35
|
-
CREATE UNIQUE INDEX IF NOT EXISTS active_lane ON batches(target_id) WHERE state IN ('applying','staged','checking_in','publication_unknown','failed');
|
|
36
|
-
CREATE TABLE IF NOT EXISTS events(seq INTEGER PRIMARY KEY AUTOINCREMENT, batch_id TEXT NOT NULL, state TEXT NOT NULL, data TEXT NOT NULL);
|
|
37
|
-
CREATE TABLE IF NOT EXISTS workers(id TEXT PRIMARY KEY, target_id TEXT NOT NULL, data TEXT NOT NULL);
|
|
38
|
-
PRAGMA user_version=1;`);
|
|
39
|
-
}
|
|
40
|
-
close() { this.db.close(); }
|
|
41
|
-
transaction(action) {
|
|
42
|
-
this.db.exec('BEGIN IMMEDIATE');
|
|
43
|
-
try {
|
|
44
|
-
const result = action();
|
|
45
|
-
this.db.exec('COMMIT');
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
this.db.exec('ROLLBACK');
|
|
50
|
-
throw error;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
register(value) {
|
|
54
|
-
const selected = identity(value);
|
|
55
|
-
if (selected.profile !== this.profile || selected.server !== this.server)
|
|
56
|
-
fail('binding', 'Target must match the selected profile and server.');
|
|
57
|
-
const lane = digest([selected.profile, selected.server, selected.repository, selected.programPath]);
|
|
58
|
-
const target = { ...selected, id: 't-' + digest(selected).slice(0, 24), lane };
|
|
59
|
-
return this.transaction(() => {
|
|
60
|
-
const existing = this.db.prepare('SELECT data FROM targets WHERE lane=?').get(lane);
|
|
61
|
-
if (existing) {
|
|
62
|
-
const t = JSON.parse(String(existing.data));
|
|
63
|
-
assertIdentity(t, target);
|
|
64
|
-
return t;
|
|
65
|
-
}
|
|
66
|
-
this.db.prepare('INSERT INTO targets VALUES(?,?,?)').run(target.id, lane, stable(target));
|
|
67
|
-
return target;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
target(id) {
|
|
71
|
-
const row = this.db.prepare('SELECT data FROM targets WHERE id=?').get(id);
|
|
72
|
-
if (!row)
|
|
73
|
-
fail('notFound', 'Target was not found in the selected profile.');
|
|
74
|
-
const target = JSON.parse(String(row.data));
|
|
75
|
-
if (target.profile !== this.profile || target.server !== this.server)
|
|
76
|
-
fail('binding', 'Registered target belongs to a different profile or server.');
|
|
77
|
-
return target;
|
|
78
|
-
}
|
|
79
|
-
targets() { return this.db.prepare('SELECT data FROM targets ORDER BY id LIMIT 100').all().map(r => this.target(JSON.parse(String(r.data)).id)); }
|
|
80
|
-
submit(value) {
|
|
81
|
-
const f = finding(value);
|
|
82
|
-
assertIdentity(f.identity, this.target(f.targetId));
|
|
83
|
-
return this.transaction(() => {
|
|
84
|
-
const previous = this.db.prepare('SELECT id,hash FROM findings WHERE request_id=? OR id=?').all(f.requestId, f.findingId);
|
|
85
|
-
if (previous.length) {
|
|
86
|
-
if (previous.length !== 1 || previous[0]?.hash !== digest(f))
|
|
87
|
-
fail('idempotency', 'Request or finding ID was already used with different content.');
|
|
88
|
-
return this.getFinding(String(previous[0].id));
|
|
89
|
-
}
|
|
90
|
-
const worker = this.worker(f.workerId);
|
|
91
|
-
assertIdentity(worker.identity, f.identity);
|
|
92
|
-
if (worker.role !== 'reader' || worker.version !== f.baselineVersion)
|
|
93
|
-
fail('binding', 'Finding does not match its registered reader baseline.');
|
|
94
|
-
if (f.resolves) {
|
|
95
|
-
const previous = this.getFinding(f.resolves);
|
|
96
|
-
if (previous.state !== 'conflict_pending' || previous.targetId !== f.targetId || previous.address !== f.address || previous.kind !== f.kind)
|
|
97
|
-
fail('conflict', 'Resolution must reference a conflicting finding for the same scoped comment.');
|
|
98
|
-
}
|
|
99
|
-
this.db.prepare('INSERT INTO findings(id,request_id,hash,target_id,state,data) VALUES(?,?,?,?,?,?)').run(f.findingId, f.requestId, digest(f), f.targetId, 'queued', stable(f));
|
|
100
|
-
return this.getFinding(f.findingId);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
getFinding(id) {
|
|
104
|
-
const row = this.db.prepare('SELECT * FROM findings WHERE id=?').get(id);
|
|
105
|
-
if (!row)
|
|
106
|
-
fail('notFound', 'Finding was not found.');
|
|
107
|
-
return { ...JSON.parse(String(row.data)), state: row.state, ...(row.batch_id ? { batchId: row.batch_id } : {}), ...(row.conflict ? { conflict: JSON.parse(String(row.conflict)) } : {}) };
|
|
108
|
-
}
|
|
109
|
-
findings(targetId) {
|
|
110
|
-
if (targetId)
|
|
111
|
-
this.target(targetId);
|
|
112
|
-
const rows = targetId ? this.db.prepare('SELECT id FROM findings WHERE target_id=? ORDER BY rowid LIMIT 100').all(targetId) : this.db.prepare('SELECT id FROM findings ORDER BY rowid LIMIT 100').all();
|
|
113
|
-
return rows.map(r => this.getFinding(String(r.id)));
|
|
114
|
-
}
|
|
115
|
-
begin(targetId) {
|
|
116
|
-
this.target(targetId);
|
|
117
|
-
return this.transaction(() => {
|
|
118
|
-
const active = this.db.prepare("SELECT id FROM batches WHERE target_id=? AND state IN ('applying','staged','checking_in','publication_unknown','failed')").get(targetId);
|
|
119
|
-
if (active)
|
|
120
|
-
fail('blocked', 'Publication lane requires recovery before new integration.', this.batch(String(active.id)));
|
|
121
|
-
const rows = this.db.prepare("SELECT id FROM findings WHERE target_id=? AND state='queued' ORDER BY rowid LIMIT 100").all(targetId);
|
|
122
|
-
if (!rows.length)
|
|
123
|
-
return undefined;
|
|
124
|
-
const id = 'b-' + randomUUID();
|
|
125
|
-
const batch = { id, targetId, state: 'applying', ownerPid: process.pid, findings: rows.map(r => this.getFinding(String(r.id))) };
|
|
126
|
-
this.db.prepare('INSERT INTO batches VALUES(?,?,?,?,?)').run(id, targetId, batch.state, process.pid, stable({}));
|
|
127
|
-
for (const row of rows)
|
|
128
|
-
this.db.prepare("UPDATE findings SET state='applying',batch_id=? WHERE id=?").run(id, row.id);
|
|
129
|
-
this.event(id, 'applying', {});
|
|
130
|
-
return this.batch(id);
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
batch(id) {
|
|
134
|
-
const row = this.db.prepare('SELECT * FROM batches WHERE id=?').get(id);
|
|
135
|
-
if (!row)
|
|
136
|
-
fail('notFound', 'Publication batch was not found.');
|
|
137
|
-
this.target(String(row.target_id));
|
|
138
|
-
return { ...JSON.parse(String(row.data)), id: String(row.id), targetId: String(row.target_id), state: String(row.state), ownerPid: Number(row.owner_pid), findings: this.db.prepare('SELECT id FROM findings WHERE batch_id=? ORDER BY rowid').all(id).map(r => this.getFinding(String(r.id))) };
|
|
139
|
-
}
|
|
140
|
-
batches() { return this.db.prepare('SELECT id FROM batches ORDER BY rowid DESC LIMIT 100').all().map(r => this.batch(String(r.id))); }
|
|
141
|
-
update(id, state, patch = {}) {
|
|
142
|
-
return this.transaction(() => {
|
|
143
|
-
const current = this.batch(id);
|
|
144
|
-
const { findings: _findings, id: _id, targetId: _targetId, ...data } = { ...current, ...patch, state };
|
|
145
|
-
this.db.prepare('UPDATE batches SET state=?,data=? WHERE id=?').run(state, stable(data), id);
|
|
146
|
-
this.db.prepare('UPDATE findings SET state=? WHERE batch_id=?').run(state, id);
|
|
147
|
-
this.event(id, state, patch);
|
|
148
|
-
return this.batch(id);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
conflicts(id, conflicts) {
|
|
152
|
-
this.db.prepare('UPDATE findings SET conflict=? WHERE batch_id=?').run(stable(conflicts), id);
|
|
153
|
-
}
|
|
154
|
-
event(id, state, data) { this.db.prepare('INSERT INTO events(batch_id,state,data) VALUES(?,?,?)').run(id, state, stable(data)); }
|
|
155
|
-
events(id) { return this.db.prepare('SELECT seq,state,data FROM events WHERE batch_id=? ORDER BY seq').all(id).map(r => ({ seq: r.seq, state: r.state, data: JSON.parse(String(r.data)) })); }
|
|
156
|
-
worker(id) {
|
|
157
|
-
const row = this.db.prepare('SELECT data,target_id FROM workers WHERE id=?').get(id);
|
|
158
|
-
if (!row)
|
|
159
|
-
fail('notFound', 'Worker was not found.');
|
|
160
|
-
this.target(String(row.target_id));
|
|
161
|
-
return JSON.parse(String(row.data));
|
|
162
|
-
}
|
|
163
|
-
putWorker(id, targetId, binding) {
|
|
164
|
-
assertIdentity(binding.identity, this.target(targetId));
|
|
165
|
-
if (this.db.prepare('SELECT id FROM workers WHERE id=?').get(id))
|
|
166
|
-
fail('workerExists', 'Worker ID is already registered.');
|
|
167
|
-
this.db.prepare('INSERT INTO workers VALUES(?,?,?)').run(id, targetId, stable(binding));
|
|
168
|
-
}
|
|
169
|
-
updateReader(id, binding) {
|
|
170
|
-
const previous = this.worker(id);
|
|
171
|
-
assertIdentity(binding.identity, previous.identity);
|
|
172
|
-
if (previous.pid !== binding.pid || previous.endpoint !== binding.endpoint || previous.version !== binding.version || previous.projectDirectory !== binding.projectDirectory || previous.role !== 'reader' || binding.role !== 'reader' || previous.readEpoch && previous.readEpoch !== binding.readEpoch)
|
|
173
|
-
fail('binding', 'Reader update changed its immutable binding.');
|
|
174
|
-
this.db.prepare('UPDATE workers SET data=? WHERE id=?').run(stable(binding), id);
|
|
175
|
-
}
|
|
176
|
-
workers() { return this.db.prepare('SELECT id,target_id,data FROM workers ORDER BY id LIMIT 100').all().map(r => ({ id: r.id, targetId: r.target_id, ...JSON.parse(String(r.data)) })); }
|
|
177
|
-
removeWorker(id) { this.db.prepare('DELETE FROM workers WHERE id=?').run(id); }
|
|
178
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type CommandDefinition, type CommandContext } from '@eyeauras/cli-factory';
|
|
2
|
-
import { Research } from './research.js';
|
|
3
|
-
import { Workspace, type Scope, type SyncPolicy } from './workspace.js';
|
|
4
|
-
export declare const manualPolicy: SyncPolicy;
|
|
5
|
-
export declare function syncPolicy(value: unknown): SyncPolicy;
|
|
6
|
-
export declare class Synchronization {
|
|
7
|
-
readonly workspace: Workspace;
|
|
8
|
-
readonly research: Research;
|
|
9
|
-
private readonly authorize;
|
|
10
|
-
constructor(workspace: Workspace, research: Research, authorize?: () => Promise<void>);
|
|
11
|
-
get(selected: Scope): {
|
|
12
|
-
publish: "manual" | "after-edit" | "after-save";
|
|
13
|
-
refresh: "manual" | "before-edit";
|
|
14
|
-
session: string;
|
|
15
|
-
target: string;
|
|
16
|
-
};
|
|
17
|
-
set(selected: Scope, policy: SyncPolicy, callerId?: string): Promise<unknown>;
|
|
18
|
-
/** The outer command queue spans refresh, the durable local intent and publication. Inner
|
|
19
|
-
* research queues remain unchanged, including their cross-context ordering and shared lane. */
|
|
20
|
-
execute(selected: Scope, path: string, input: Record<string, unknown>, run: (requestId: string) => Promise<unknown>): Promise<unknown>;
|
|
21
|
-
}
|
|
22
|
-
export declare function synchronizationCommands(service: (c: CommandContext) => Synchronization): CommandDefinition[];
|
package/dist/src/sync-policy.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
|
-
import { scope } from './research.js';
|
|
3
|
-
import { fail, id, object, text } from './model.js';
|
|
4
|
-
import { failUnresolved } from './unresolved-guidance.js';
|
|
5
|
-
import { selectedOptions } from './arguments.js';
|
|
6
|
-
export const manualPolicy = { publish: 'manual', refresh: 'manual' };
|
|
7
|
-
export function syncPolicy(value) {
|
|
8
|
-
const p = object(value);
|
|
9
|
-
if (Object.keys(p).some(k => !['publish', 'refresh'].includes(k)) || !['manual', 'after-edit', 'after-save'].includes(String(p.publish)) || !['manual', 'before-edit'].includes(String(p.refresh)))
|
|
10
|
-
fail('invalid', 'Policy requires publish manual/after-edit/after-save and refresh manual/before-edit.');
|
|
11
|
-
return { publish: p.publish, refresh: p.refresh };
|
|
12
|
-
}
|
|
13
|
-
export class Synchronization {
|
|
14
|
-
workspace;
|
|
15
|
-
research;
|
|
16
|
-
authorize;
|
|
17
|
-
constructor(workspace, research, authorize = async () => { }) {
|
|
18
|
-
this.workspace = workspace;
|
|
19
|
-
this.research = research;
|
|
20
|
-
this.authorize = authorize;
|
|
21
|
-
}
|
|
22
|
-
get(selected) { return { ...selected, ...(this.workspace.context(selected).syncPolicy ?? manualPolicy) }; }
|
|
23
|
-
async set(selected, policy, callerId) {
|
|
24
|
-
const reserved = this.workspace.reserveRequest(selected, 'ghidra.sync-policy.set', policy, callerId);
|
|
25
|
-
return this.research.ordered(selected, async () => {
|
|
26
|
-
const request = this.workspace.request(reserved.request.id);
|
|
27
|
-
if (reserved.replay && request.state === 'applied')
|
|
28
|
-
return request.result;
|
|
29
|
-
if (request.state !== 'accepted')
|
|
30
|
-
fail('unknown', 'Policy change has a retained outcome.');
|
|
31
|
-
if (this.workspace.unresolved(selected).length)
|
|
32
|
-
failUnresolved(this.workspace, selected, 'The context outcome is unresolved; its synchronization policy cannot change yet.');
|
|
33
|
-
const current = this.workspace.context(selected), result = { ...selected, state: 'configured', ...policy };
|
|
34
|
-
this.workspace.startRequest(request.id);
|
|
35
|
-
this.workspace.completeSavedRequest(selected, request.id, current.generation, { syncPolicy: policy }, result);
|
|
36
|
-
return result;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/** The outer command queue spans refresh, the durable local intent and publication. Inner
|
|
40
|
-
* research queues remain unchanged, including their cross-context ordering and shared lane. */
|
|
41
|
-
async execute(selected, path, input, run) {
|
|
42
|
-
const configured = this.workspace.context(selected).syncPolicy ?? manualPolicy;
|
|
43
|
-
const caller = input.requestId === undefined ? undefined : id(input.requestId, '--request-id');
|
|
44
|
-
const recorded = caller ? this.workspace.scopedRequest(selected, caller) : undefined;
|
|
45
|
-
if (caller && recorded?.id === caller)
|
|
46
|
-
return run(caller);
|
|
47
|
-
const previous = caller ? this.workspace.administrationByCaller(caller) : undefined;
|
|
48
|
-
if (!previous && (configured.publish === 'manual' && configured.refresh === 'manual' || input.requestId !== undefined && this.workspace.requestByCaller(id(input.requestId, '--request-id'))))
|
|
49
|
-
return run(input.requestId === undefined ? '' : id(input.requestId, '--request-id'));
|
|
50
|
-
if (previous && previous.operation !== 'ghidra.automatic')
|
|
51
|
-
fail('idempotency', 'Request ID already identifies another profile administration operation.');
|
|
52
|
-
const policy = previous ? syncPolicy(object(object(previous.intent).parameters).policy) : configured;
|
|
53
|
-
const reserved = this.workspace.reserveAdministration('ghidra.automatic', { ...selected, path, input, policy }, caller);
|
|
54
|
-
const request = this.workspace.administration(reserved.request.id), requestId = 'auto-local-' + request.id;
|
|
55
|
-
if (reserved.replay && request.state === 'applied')
|
|
56
|
-
return request.result;
|
|
57
|
-
if (reserved.replay && request.state === 'failed')
|
|
58
|
-
fail(String(object(request.result ?? {}).failureCode ?? 'coordinator.conflict').replace(/^coordinator\./, ''), 'This automatic workflow retains its original failed result.', request.result);
|
|
59
|
-
if (policy.refresh === 'before-edit' && path !== 'ghidra save' || policy.publish === 'after-edit' || policy.publish === 'after-save' && path === 'ghidra save')
|
|
60
|
-
await this.authorize();
|
|
61
|
-
let progress = object(request.result ?? { phase: 'accepted' });
|
|
62
|
-
const remember = (patch) => { progress = { ...progress, ...patch }; this.workspace.administrationState(request.id, 'unknown', progress); };
|
|
63
|
-
try {
|
|
64
|
-
// Re-entering a dispatched local command always uses its original request identity.
|
|
65
|
-
// A lost merge reply is reconciled by merge itself; no check-in is re-dispatched.
|
|
66
|
-
if (progress.phase === 'accepted' && policy.refresh === 'before-edit' && path !== 'ghidra save') {
|
|
67
|
-
remember({ phase: 'refresh' });
|
|
68
|
-
const incoming = object(await this.research.refresh(selected, 'auto-refresh-' + request.id));
|
|
69
|
-
remember({ incoming, phase: 'ready' });
|
|
70
|
-
if (incoming.state === 'conflict') {
|
|
71
|
-
const result = { ...selected, state: 'conflict', phase: 'refresh', localApplied: false, automatic: { refresh: incoming } };
|
|
72
|
-
this.workspace.administrationState(request.id, 'failed', result);
|
|
73
|
-
fail('conflict', 'Automatic refresh retained conflicts; the requested edit was not started.', result);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else if (progress.phase === 'refresh') {
|
|
77
|
-
// Refresh's candidate/context commit is already durable or explicitly unresolved.
|
|
78
|
-
const incoming = object(await this.research.refresh(selected, 'auto-refresh-' + request.id));
|
|
79
|
-
remember({ incoming, phase: 'ready' });
|
|
80
|
-
if (incoming.state === 'conflict')
|
|
81
|
-
fail('conflict', 'Automatic refresh retained conflicts; the edit was not started.', { ...selected, state: 'conflict', localApplied: false, automatic: { refresh: incoming } });
|
|
82
|
-
}
|
|
83
|
-
let local = progress.local === undefined ? undefined : object(progress.local);
|
|
84
|
-
if (!local) {
|
|
85
|
-
remember({ phase: 'local' });
|
|
86
|
-
local = object(await run(requestId));
|
|
87
|
-
if (!['applied', 'saved', 'preview'].includes(String(local.state)))
|
|
88
|
-
fail('unknown', 'The local command has no verified saved acknowledgment.', local);
|
|
89
|
-
remember({ local, phase: 'saved' });
|
|
90
|
-
}
|
|
91
|
-
const automatic = { ...(progress.incoming ? { refresh: progress.incoming } : {}) };
|
|
92
|
-
// Native buffers decide whether there is work to publish. GUI/native edits need not
|
|
93
|
-
// create scalar/opaque CLI diagnostics, and an unchanged checkout is safely empty.
|
|
94
|
-
const publish = (policy.publish === 'after-save' && path === 'ghidra save' || policy.publish === 'after-edit') &&
|
|
95
|
-
local.state !== 'preview' && (path === 'ghidra save' || local.sharedState === 'pending' || this.workspace.context(selected).nativeCheckout?.state === 'active');
|
|
96
|
-
if (publish) {
|
|
97
|
-
remember({ phase: 'publish' });
|
|
98
|
-
automatic.publication = await this.research.merge(selected, 'auto-merge-' + request.id);
|
|
99
|
-
}
|
|
100
|
-
const current = this.workspace.context(selected), result = { ...local, pendingChanges: current.scalars.length + current.complexChanges.length,
|
|
101
|
-
...(local.sharedState !== undefined ? { sharedState: current.scalars.length || current.complexChanges.length ? 'pending' : 'shared' } : {}), automatic };
|
|
102
|
-
this.workspace.administrationState(request.id, 'applied', result);
|
|
103
|
-
return result;
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
if (this.workspace.administration(request.id).state === 'failed')
|
|
107
|
-
throw error;
|
|
108
|
-
const code = String(error.code ?? 'coordinator.unknown'), detail = error.result, child = this.workspace.requestByCaller(requestId);
|
|
109
|
-
const notStarted = progress.phase === 'local' && (!child || child.state === 'accepted'), rejected = progress.phase === 'local' && child?.state === 'failed' && object(child.result ?? {}).state === 'rejected';
|
|
110
|
-
const knownRejection = rejected || notStarted && code.endsWith('.invalid');
|
|
111
|
-
// Retain the local acknowledgment alongside a failed/uncertain publication. Its caller
|
|
112
|
-
// can distinguish successful editing from a publication that needs intervention.
|
|
113
|
-
const result = { ...selected, state: code.endsWith('.conflict') ? 'conflict' : knownRejection ? 'rejected' : 'unknown', failureCode: code, phase: progress.phase,
|
|
114
|
-
...(progress.local ? { localApplied: true, local: progress.local } : notStarted || rejected || progress.phase === 'refresh' ? { localApplied: false } : { localOutcome: progress.phase === 'local' ? 'unknown' : 'not_started' }), automatic: { ...(progress.incoming ? { refresh: progress.incoming } : {}), ...(detail ? { outcome: detail } : {}) } };
|
|
115
|
-
if (code.endsWith('.conflict') || knownRejection)
|
|
116
|
-
this.workspace.administrationState(request.id, 'failed', result);
|
|
117
|
-
else
|
|
118
|
-
this.workspace.administrationState(request.id, 'unknown', { ...progress, outcome: result });
|
|
119
|
-
fail(code.endsWith('.conflict') ? 'conflict' : knownRejection ? code.replace(/^coordinator\./, '') : 'unknown', 'Automatic synchronization did not complete; retained local effects are not replayed.', result);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
export function synchronizationCommands(service) {
|
|
124
|
-
return [command('sync-policy', 'Configure opt-in synchronization for one saved tool context', [
|
|
125
|
-
command('get', 'Read the persisted policy; default is manual', ({ options: o }, c) => service(c).get(scope(o)), { permission: Permission.ReadOnly, options: selectedOptions }),
|
|
126
|
-
command('set', 'Choose manual, publication after edit/save and optional refresh before edit', ({ options: o }, c) => service(c).set(scope(o), syncPolicy({ publish: text(o.publish), refresh: text(o.refresh) }), o.requestId === undefined ? undefined : id(o.requestId, '--request-id')), { permission: Permission.Update, options: [...selectedOptions,
|
|
127
|
-
{ flags: '--publish <mode>', description: 'manual, after-edit or after-save', required: true }, { flags: '--refresh <mode>', description: 'manual or before-edit', required: true }, { flags: '--request-id <id>', description: 'Retrieve the recorded policy change' }] }),
|
|
128
|
-
])];
|
|
129
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { timed } from './internal-timing.js';
|
|
2
|
-
/** Lifecycle boundaries whose duration is attributed in timings and lifecycle `--json` results. */
|
|
3
|
-
const lifecycle = {
|
|
4
|
-
close: 'context.close', capture: 'context.capture', releaseUnchanged: 'context.release', updateNative: 'native.update', publishNative: 'native.publish',
|
|
5
|
-
dropNative: 'native.drop', finishEmptyNative: 'native.finish-empty', recoverUpdate: 'native.recover-update', recoverEmptyNative: 'native.recover-empty',
|
|
6
|
-
discardNative: 'native.discard', settleUnsaved: 'native.unsaved', recover: 'native.recover-publication', collect: 'storage.collect',
|
|
7
|
-
};
|
|
8
|
-
/** Observe existing boundaries; retain original method receivers and domain behavior. */
|
|
9
|
-
export function timedBackend(backend) {
|
|
10
|
-
return new Proxy(backend, { get(target, key) {
|
|
11
|
-
const member = Reflect.get(target, key);
|
|
12
|
-
if (typeof member !== 'function')
|
|
13
|
-
return member;
|
|
14
|
-
if (key === 'open')
|
|
15
|
-
return (...args) => timed('context.open', 'open', async () => Reflect.apply(member, target, args));
|
|
16
|
-
if (key === 'saved')
|
|
17
|
-
return (...args) => timed('context.save', 'saved', async () => Reflect.apply(member, target, args));
|
|
18
|
-
if (key === 'call')
|
|
19
|
-
return (...args) => timed('backend.operation', String(args[1]), async () => Reflect.apply(member, target, args));
|
|
20
|
-
if (typeof key === 'string' && Object.hasOwn(lifecycle, key))
|
|
21
|
-
return (...args) => timed(lifecycle[key], key, async () => Reflect.apply(member, target, args));
|
|
22
|
-
return member.bind(target);
|
|
23
|
-
} });
|
|
24
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Scope } from './workspace.js';
|
|
2
|
-
/**
|
|
3
|
-
* Summarizes retained timing spans per command attempt. Phases are aggregated by phase/operation; nested
|
|
4
|
-
* spans are reported separately and must not be added to their parents. `unattributedMs` is the root time
|
|
5
|
-
* not covered by any direct child span (sequential children assumed).
|
|
6
|
-
*/
|
|
7
|
-
export declare function timingDiagnostic(workspaceDirectory: string, selected: Scope, options: {
|
|
8
|
-
command?: string;
|
|
9
|
-
limit: number;
|
|
10
|
-
}): Promise<{
|
|
11
|
-
traces: {
|
|
12
|
-
traceId: string;
|
|
13
|
-
command: string;
|
|
14
|
-
startedAt: string;
|
|
15
|
-
outcome: string;
|
|
16
|
-
totalMs: number;
|
|
17
|
-
unattributedMs: number;
|
|
18
|
-
droppedSpans: number;
|
|
19
|
-
phases: {
|
|
20
|
-
totalMs: number;
|
|
21
|
-
maximumMs: number;
|
|
22
|
-
phase: string;
|
|
23
|
-
operation: string;
|
|
24
|
-
count: number;
|
|
25
|
-
failures: number;
|
|
26
|
-
}[];
|
|
27
|
-
}[];
|
|
28
|
-
limit: number;
|
|
29
|
-
coverage: string;
|
|
30
|
-
session: string;
|
|
31
|
-
target: string;
|
|
32
|
-
}>;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { open } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
const maximumBytes = 16 * 1024 ** 2;
|
|
4
|
-
async function rows(path) {
|
|
5
|
-
let text;
|
|
6
|
-
try {
|
|
7
|
-
const handle = await open(path, 'r');
|
|
8
|
-
try {
|
|
9
|
-
const size = (await handle.stat()).size, length = Math.min(size, maximumBytes), buffer = Buffer.alloc(length);
|
|
10
|
-
await handle.read(buffer, 0, length, size - length);
|
|
11
|
-
text = buffer.toString('utf8');
|
|
12
|
-
}
|
|
13
|
-
finally {
|
|
14
|
-
await handle.close();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
if (error.code === 'ENOENT')
|
|
19
|
-
return [];
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
const out = [];
|
|
23
|
-
for (const line of text.split('\n')) {
|
|
24
|
-
if (!line.startsWith('{'))
|
|
25
|
-
continue;
|
|
26
|
-
try {
|
|
27
|
-
const row = JSON.parse(line);
|
|
28
|
-
if (typeof row.trace === 'string' && typeof row.span === 'string' && typeof row.phase === 'string' && Number.isFinite(row.durationMs))
|
|
29
|
-
out.push(row);
|
|
30
|
-
}
|
|
31
|
-
catch { /* A partially written or rotated line is not evidence. */ }
|
|
32
|
-
}
|
|
33
|
-
return out;
|
|
34
|
-
}
|
|
35
|
-
const ms = (value) => Math.round(value);
|
|
36
|
-
/**
|
|
37
|
-
* Summarizes retained timing spans per command attempt. Phases are aggregated by phase/operation; nested
|
|
38
|
-
* spans are reported separately and must not be added to their parents. `unattributedMs` is the root time
|
|
39
|
-
* not covered by any direct child span (sequential children assumed).
|
|
40
|
-
*/
|
|
41
|
-
export async function timingDiagnostic(workspaceDirectory, selected, options) {
|
|
42
|
-
const directory = join(workspaceDirectory, 'diagnostics');
|
|
43
|
-
const all = [...await rows(join(directory, 'timings.jsonl.previous')), ...await rows(join(directory, 'timings.jsonl'))];
|
|
44
|
-
const traces = new Map();
|
|
45
|
-
for (const row of all) {
|
|
46
|
-
if (row.session !== selected.session || row.target !== selected.target)
|
|
47
|
-
continue;
|
|
48
|
-
if (options.command && row.command !== options.command)
|
|
49
|
-
continue;
|
|
50
|
-
const list = traces.get(row.trace);
|
|
51
|
-
if (list)
|
|
52
|
-
list.push(row);
|
|
53
|
-
else
|
|
54
|
-
traces.set(row.trace, [row]);
|
|
55
|
-
}
|
|
56
|
-
const items = [...traces.values()].filter(list => list.some(row => row.parent === null)).sort((a, b) => String(a[0].at).localeCompare(String(b[0].at))).slice(-options.limit).reverse().map(list => {
|
|
57
|
-
const root = list.find(row => row.parent === null), phases = new Map();
|
|
58
|
-
for (const row of list) {
|
|
59
|
-
if (row === root)
|
|
60
|
-
continue;
|
|
61
|
-
const key = row.phase + '\0' + row.operation, entry = phases.get(key) ?? { phase: row.phase, operation: row.operation, count: 0, totalMs: 0, maximumMs: 0, failures: 0 };
|
|
62
|
-
entry.count++;
|
|
63
|
-
entry.totalMs += row.durationMs;
|
|
64
|
-
entry.maximumMs = Math.max(entry.maximumMs, row.durationMs);
|
|
65
|
-
if (row.outcome !== 'success')
|
|
66
|
-
entry.failures++;
|
|
67
|
-
phases.set(key, entry);
|
|
68
|
-
}
|
|
69
|
-
const direct = list.filter(row => row.parent === root.span).reduce((n, row) => n + row.durationMs, 0);
|
|
70
|
-
return { traceId: root.trace, command: root.command, startedAt: root.at, outcome: root.outcome, totalMs: ms(root.durationMs), unattributedMs: ms(Math.max(0, root.durationMs - direct)),
|
|
71
|
-
droppedSpans: root.droppedSpans ?? 0, phases: [...phases.values()].sort((a, b) => b.totalMs - a.totalMs).map(p => ({ ...p, totalMs: ms(p.totalMs), maximumMs: ms(p.maximumMs) })) };
|
|
72
|
-
});
|
|
73
|
-
return { ...selected, traces: items, limit: options.limit, coverage: 'Retained internal timing spans of the current and previous segment; nested phases overlap their parents. Reading does not start or probe Ghidra.' };
|
|
74
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readFile, realpath } from 'node:fs/promises';
|
|
2
|
-
import { execFile } from 'node:child_process';
|
|
3
|
-
import { promisify } from 'node:util';
|
|
4
|
-
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
const exec = promisify(execFile);
|
|
7
|
-
/** Independent kernel observation; no request enters the possibly wedged JVM. */
|
|
8
|
-
export async function nativeProcessProof(pid, executable, cwd, token) {
|
|
9
|
-
if (process.platform !== 'darwin' || !Number.isSafeInteger(pid) || pid < 1)
|
|
10
|
-
return false;
|
|
11
|
-
try {
|
|
12
|
-
const base = new URL('../../../runtime/native/', import.meta.url), path = fileURLToPath(new URL('process-identity-darwin-' + process.arch, base));
|
|
13
|
-
const provenance = JSON.parse(await readFile(new URL('process-identity.provenance.json', base), 'utf8'));
|
|
14
|
-
if (provenance.platform !== 'darwin' || provenance.architecture !== process.arch || createHash('sha256').update(await readFile(path)).digest('hex') !== provenance.sha256)
|
|
15
|
-
return false;
|
|
16
|
-
const result = await exec(path, [String(pid)], { timeout: 3000, maxBuffer: 16384, env: { PATH: '/usr/bin:/bin' } }), row = JSON.parse(result.stdout);
|
|
17
|
-
if (row.pid !== pid || row.uid !== process.geteuid?.() || !Number.isSafeInteger(row.birthSeconds) || row.birthSeconds <= 0 || !Number.isSafeInteger(row.birthMicroseconds) || row.birthMicroseconds < 0 || row.birthMicroseconds >= 1000000 || typeof row.tokenSha256 !== 'string' || !/^[a-f0-9]{64}$/.test(row.tokenSha256))
|
|
18
|
-
return false;
|
|
19
|
-
if (await realpath(row.executable) !== await realpath(executable) || await realpath(row.root) !== await realpath(cwd))
|
|
20
|
-
return false;
|
|
21
|
-
return timingSafeEqual(Buffer.from(row.tokenSha256, 'hex'), createHash('sha256').update(token).digest());
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
package/dist/src/transport.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { CliError } from '@eyeauras/cli-factory';
|
|
2
|
-
/** Replies that were too large to read: the request ran, unlike a capacity refusal with the same code. */
|
|
3
|
-
export declare const oversizedReplies: WeakSet<object>;
|
|
4
|
-
export interface Descriptor {
|
|
5
|
-
path: string;
|
|
6
|
-
method: string;
|
|
7
|
-
params: {
|
|
8
|
-
name: string;
|
|
9
|
-
source: string;
|
|
10
|
-
}[];
|
|
11
|
-
}
|
|
12
|
-
/** The pinned GhidraMCP HTTP side of a dedicated bridge. No discovery by project name. */
|
|
13
|
-
export declare class HttpBridge {
|
|
14
|
-
readonly endpoint: string;
|
|
15
|
-
private fetch;
|
|
16
|
-
private signal?;
|
|
17
|
-
private token?;
|
|
18
|
-
private timeoutMilliseconds?;
|
|
19
|
-
private saveTimeoutMilliseconds;
|
|
20
|
-
private schema?;
|
|
21
|
-
/**
|
|
22
|
-
* In-process helper listener of a leased headless worker: its loopback port and the compiled helper sources
|
|
23
|
-
* the worker must have been started with. Absent for GUI and unleased workers.
|
|
24
|
-
*/
|
|
25
|
-
owned?: {
|
|
26
|
-
port: number;
|
|
27
|
-
helpers: string;
|
|
28
|
-
};
|
|
29
|
-
constructor(endpoint: string, fetch?: typeof globalThis.fetch, signal?: AbortSignal | undefined, token?: string | undefined, timeoutMilliseconds?: number | undefined, saveTimeoutMilliseconds?: number);
|
|
30
|
-
private request;
|
|
31
|
-
private requestBody;
|
|
32
|
-
instance(): Promise<Record<string, unknown>>;
|
|
33
|
-
descriptor(path: string): Promise<Descriptor>;
|
|
34
|
-
/**
|
|
35
|
-
* Run a fixed helper script of this package for an open program. A leased worker runs its precompiled class
|
|
36
|
-
* in-process. When it cannot serve the script and says so before running anything (an older worker, other
|
|
37
|
-
* helper sources), and for GUI or unleased workers, the pinned inline provider compiles the same source as
|
|
38
|
-
* before. A retiring or saturated worker gets nothing more: the command fails as busy with nothing run.
|
|
39
|
-
* A lost reply is never retried: the script may have run.
|
|
40
|
-
*/
|
|
41
|
-
script(program: string, base: string, args?: string): Promise<unknown>;
|
|
42
|
-
/** One request to the worker's own listener; undefined when it said, before doing anything, that it cannot serve it. */
|
|
43
|
-
ownedRequest(path: string, body: Record<string, unknown>): Promise<unknown>;
|
|
44
|
-
call(path: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
45
|
-
}
|
|
46
|
-
/** The refusal of every command that would open a checkout holding Ghidra recovery data; `scope` adds the two ways out. */
|
|
47
|
-
export declare function unsavedChanges(scope?: {
|
|
48
|
-
session: string;
|
|
49
|
-
target: string;
|
|
50
|
-
}): CliError;
|
|
51
|
-
/**
|
|
52
|
-
* Open the working program of a worker's project. A leased worker opens it and writes nothing; the bridge's own open
|
|
53
|
-
* also clears the analysis prompt and saves, so that Ghidra would report an untouched checkout as modified. A worker
|
|
54
|
-
* without that listener (GUI, unleased or of an earlier build) uses the bridge's open as before.
|
|
55
|
-
*/
|
|
56
|
-
export declare function openWorkerProgram(http: Pick<HttpBridge, 'call'> & Partial<Pick<HttpBridge, 'owned' | 'ownedRequest'>>, path: string, scope?: {
|
|
57
|
-
session: string;
|
|
58
|
-
target: string;
|
|
59
|
-
}): Promise<unknown>;
|
|
60
|
-
export declare function decodeMcp(result: unknown): unknown;
|