@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
|
@@ -11,10 +11,7 @@ export interface SelectedTool extends ToolInstallation, ToolLaunch {
|
|
|
11
11
|
externalInputs?: Record<string, string>;
|
|
12
12
|
noticeDigest?: string;
|
|
13
13
|
execution?: ToolLaunch;
|
|
14
|
-
executionFingerprint?: string;
|
|
15
14
|
}
|
|
16
|
-
/** Read-only verification used by an owned child after the command owner has staged a runtime. */
|
|
17
|
-
export declare function verifyManagedInstallation(directory: string, tool: string, selected: SelectedTool): Promise<void>;
|
|
18
15
|
export interface InstallDescriptor {
|
|
19
16
|
id: string;
|
|
20
17
|
primary: string;
|
|
@@ -29,7 +26,7 @@ export interface InstallDescriptor {
|
|
|
29
26
|
/** Known sibling executables/data files needed by an external tool family. */
|
|
30
27
|
externalInputs?: (executable: string, c: CommandContext) => Promise<Record<string, string>>;
|
|
31
28
|
/** Full retained notices copied into owned installation storage, including external selections. */
|
|
32
|
-
noticeFiles?: Record<string, string>;
|
|
29
|
+
noticeFiles?: () => Record<string, string>;
|
|
33
30
|
}
|
|
34
31
|
/** Standard archive-based tools supply layout and a real probe; exceptional tools reuse the stage primitives. */
|
|
35
32
|
export declare class ToolInstaller {
|
|
@@ -74,7 +71,7 @@ export declare class ToolInstaller {
|
|
|
74
71
|
install(o: Record<string, unknown>): Promise<{
|
|
75
72
|
tool: string;
|
|
76
73
|
state: string;
|
|
77
|
-
mode: "
|
|
74
|
+
mode: "managed" | "external";
|
|
78
75
|
installation: string;
|
|
79
76
|
executable: string;
|
|
80
77
|
components: {
|
|
@@ -82,7 +79,6 @@ export declare class ToolInstaller {
|
|
|
82
79
|
};
|
|
83
80
|
checks: Record<string, unknown>;
|
|
84
81
|
}>;
|
|
85
|
-
private verify;
|
|
86
82
|
use<T>(action: (selection: SelectedTool) => Promise<T>): Promise<T>;
|
|
87
83
|
selected(): Promise<SelectedTool>;
|
|
88
84
|
doctor(): Promise<{
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { analysisDirectory } from '../analysis-storage.js';
|
|
2
|
-
import { mkdir, stat, rm, readdir, writeFile
|
|
3
|
-
import { join, resolve,
|
|
4
|
-
import { cacheArtifact, consumeArchive, extractArchive, fileSha256
|
|
5
|
-
import { atomicWrite, readJson, toolRoot, withToolLock, installationStage, removeInstallation,
|
|
2
|
+
import { mkdir, stat, rm, readdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join, resolve, dirname } from 'node:path';
|
|
4
|
+
import { cacheArtifact, consumeArchive, extractArchive, fileSha256 } from './archives.js';
|
|
5
|
+
import { atomicWrite, readJson, toolRoot, withToolLock, installationStage, removeInstallation, assertUnused, withToolUse } from './store.js';
|
|
6
6
|
import { listProcesses } from './supervisor.js';
|
|
7
7
|
import { digest, fail, text } from '../model.js';
|
|
8
|
-
/** Read-only verification used by an owned child after the command owner has staged a runtime. */
|
|
9
|
-
export async function verifyManagedInstallation(directory, tool, selected) {
|
|
10
|
-
const root = join(toolRoot(directory, tool), 'installations', selected.id);
|
|
11
|
-
if (selected.schema !== 1 || selected.tool !== tool || selected.mode !== 'managed' || selected.uninstalledAt || !/^[a-f0-9]{64}$/.test(selected.id) || await realpath(selected.root) !== await realpath(root) || !(await realpath(selected.executable)).startsWith(await realpath(root) + sep))
|
|
12
|
-
fail('binding', 'Invalid managed tool installation receipt.');
|
|
13
|
-
const ready = await readJson(join(root, 'ready.json'));
|
|
14
|
-
const binding = (v) => { const { selectedAt, uninstalledAt, ...rest } = v; return rest; };
|
|
15
|
-
if (!ready || digest(binding(ready)) !== digest(binding(selected)))
|
|
16
|
-
fail('binding', 'Managed tool receipt differs from its verified installation.');
|
|
17
|
-
if (await treeFingerprint(root) !== selected.fingerprint)
|
|
18
|
-
fail('binding', 'Managed tool code differs from its verified installation.');
|
|
19
|
-
}
|
|
20
8
|
/** Standard archive-based tools supply layout and a real probe; exceptional tools reuse the stage primitives. */
|
|
21
9
|
export class ToolInstaller {
|
|
22
10
|
c;
|
|
@@ -45,7 +33,7 @@ export class ToolInstaller {
|
|
|
45
33
|
}
|
|
46
34
|
const stages = await readdir(join(this.root, 'stages')).catch(e => { if (e.code === 'ENOENT')
|
|
47
35
|
return []; throw e; });
|
|
48
|
-
const processes =
|
|
36
|
+
const processes = await listProcesses(this.directory, { tool: this.descriptor.id, active: true });
|
|
49
37
|
return { retainedStages: stages.slice(0, 100), processes, tool: this.descriptor.id, state: present ? 'installed' : 'not_ready', mode: selected?.mode ?? 'unconfigured', installation: selected?.id, executable: selected?.executable, components: selected?.components ?? {}, lastProbe: selected?.lastProbe, recommended: 'managed' };
|
|
50
38
|
}
|
|
51
39
|
async download(offline = false, vendorDirect = false) {
|
|
@@ -61,82 +49,36 @@ export class ToolInstaller {
|
|
|
61
49
|
fail('invalid', 'Choose --executable or --archive.');
|
|
62
50
|
const external = o.executable ? resolve(this.c.cwd, text(o.executable, 4096)) : undefined, parts = external ? {} : this.descriptor.components(), consumed = {};
|
|
63
51
|
for (const [id, artifact] of Object.entries(parts)) {
|
|
64
|
-
const key = id === this.descriptor.primary ? 'archive' : id + 'Archive'
|
|
65
|
-
|
|
66
|
-
fail('invalid', 'Archive checksum requires its archive path.');
|
|
67
|
-
consumed[id] = o[key] ? await consumeArchive(resolve(this.c.cwd, text(o[key], 4096)), this.cache, artifact, o[checksum] === undefined ? undefined : text(o[checksum], 64), this.c.signal) : { path: await cacheArtifact(artifact, this.cache, this.c.fetch, this.c.signal, Boolean(o.offline), Boolean(o.vendorDirect)), artifact };
|
|
52
|
+
const key = id === this.descriptor.primary ? 'archive' : id + 'Archive';
|
|
53
|
+
consumed[id] = o[key] ? await consumeArchive(resolve(this.c.cwd, text(o[key], 4096)), this.cache, artifact, this.c.signal) : { path: await cacheArtifact(artifact, this.cache, this.c.fetch, this.c.signal, Boolean(o.offline), Boolean(o.vendorDirect)), artifact };
|
|
68
54
|
}
|
|
69
55
|
const components = Object.fromEntries(Object.entries(consumed).map(([id, v]) => [id, v.artifact.sha256]));
|
|
70
56
|
const externalDigest = external ? await fileSha256(external, this.c.signal) : undefined;
|
|
71
57
|
const externalInputs = external && this.descriptor.externalInputs ? await this.descriptor.externalInputs(external, this.c) : undefined;
|
|
72
|
-
const
|
|
58
|
+
const notices = this.descriptor.noticeFiles?.(), noticeDigest = notices ? digest(notices) : undefined;
|
|
73
59
|
const id = digest({ tool: this.descriptor.id, schema: 1, platform: process.platform, architecture: process.arch, external, externalDigest, components, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(this.descriptor.preparationId ? { preparationId: this.descriptor.preparationId } : {}) });
|
|
74
|
-
const rootsAt = (directory) => Object.fromEntries(Object.entries(consumed).map(([part, v]) =>
|
|
60
|
+
const rootsAt = (directory) => Object.fromEntries(Object.entries(consumed).map(([part, v]) => [part, join(directory, part, v.artifact.root)]));
|
|
75
61
|
const selected = await installationStage(this.root, id, async (stage, installed) => {
|
|
76
62
|
for (const [part, v] of Object.entries(consumed))
|
|
77
63
|
await extractArchive(v.path, join(stage, part), v.artifact.format, this.c.signal);
|
|
78
64
|
if (!external)
|
|
79
65
|
await this.descriptor.prepare?.(rootsAt(stage), this.c);
|
|
80
66
|
const execution = external ? await this.descriptor.prepareExternal?.(external, stage, this.c) : undefined;
|
|
81
|
-
|
|
82
|
-
fail('binding', 'Prepared external execution must use owned staging.');
|
|
83
|
-
for (const [name, body] of Object.entries(this.descriptor.noticeFiles ?? {})) {
|
|
84
|
-
archiveName(name);
|
|
85
|
-
if (!name || Buffer.byteLength(body) > 1024 ** 2)
|
|
86
|
-
fail('configuration', 'Invalid bundled license notice.');
|
|
67
|
+
for (const [name, body] of Object.entries(notices ?? {})) {
|
|
87
68
|
const destination = join(stage, name);
|
|
88
69
|
await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
|
|
89
70
|
await writeFile(destination, body, { flag: 'wx', mode: 0o600 });
|
|
90
71
|
}
|
|
91
72
|
const stageLaunch = external ? { executable: external, arguments: [], environment: {} } : this.descriptor.launch(rootsAt(stage));
|
|
92
73
|
const lastProbe = await this.descriptor.probe(execution ?? stageLaunch, this.c), launch = external ? stageLaunch : this.descriptor.launch(rootsAt(installed));
|
|
93
|
-
const fingerprint =
|
|
94
|
-
if (external && fingerprint !== externalDigest)
|
|
95
|
-
fail('binding', 'External tool changed during installation.');
|
|
96
|
-
if (externalInputs && digest(await this.descriptor.externalInputs(external, this.c)) !== digest(externalInputs))
|
|
97
|
-
fail('binding', 'External tool family changed during installation.');
|
|
74
|
+
const fingerprint = externalDigest ?? id;
|
|
98
75
|
const installedExecution = execution ? { ...execution, executable: join(installed, execution.executable.slice(stage.length + 1)) } : undefined;
|
|
99
|
-
return { schema: 1, tool: this.descriptor.id, id, mode: external ? 'external' : 'managed', root: installed, ...launch, roots: rootsAt(installed), components, fingerprint, lastProbe, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(installedExecution ? { execution: installedExecution
|
|
100
|
-
},
|
|
76
|
+
return { schema: 1, tool: this.descriptor.id, id, mode: external ? 'external' : 'managed', root: installed, ...launch, roots: rootsAt(installed), components, fingerprint, lastProbe, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(installedExecution ? { execution: installedExecution } : {}), selectedAt: new Date().toISOString() };
|
|
77
|
+
}, undefined, this.c.signal);
|
|
101
78
|
await atomicWrite(join(this.root, 'selection.json'), { ...selected, selectedAt: new Date().toISOString() });
|
|
102
79
|
return { tool: this.descriptor.id, state: 'installed', mode: selected.mode, installation: id, executable: selected.executable, components, checks: selected.lastProbe };
|
|
103
80
|
}, this.c.signal);
|
|
104
81
|
}
|
|
105
|
-
async verify(selected) {
|
|
106
|
-
if (selected.schema !== 1 || selected.tool !== this.descriptor.id || !/^[a-f0-9]{64}$/.test(selected.id))
|
|
107
|
-
fail('binding', 'Invalid tool installation receipt.');
|
|
108
|
-
const root = join(this.root, 'installations', selected.id);
|
|
109
|
-
if (await realpath(selected.root) !== await realpath(root) || selected.mode === 'managed' && !(await realpath(selected.executable)).startsWith(await realpath(root) + sep))
|
|
110
|
-
fail('binding', 'Selected tool points outside its owned installation.');
|
|
111
|
-
const ready = await readJson(join(root, 'ready.json'));
|
|
112
|
-
const binding = (v) => { const { selectedAt, uninstalledAt, ...rest } = v; return rest; };
|
|
113
|
-
if (!ready || digest(binding(ready)) !== digest(binding(selected)))
|
|
114
|
-
fail('binding', 'Selected tool receipt differs from its verified installation.');
|
|
115
|
-
if (this.descriptor.noticeFiles) {
|
|
116
|
-
if (selected.noticeDigest !== digest(this.descriptor.noticeFiles))
|
|
117
|
-
fail('binding', 'Bundled license notices changed; reinstall the selected tool.');
|
|
118
|
-
for (const [name, body] of Object.entries(this.descriptor.noticeFiles)) {
|
|
119
|
-
archiveName(name);
|
|
120
|
-
try {
|
|
121
|
-
if (await readFile(join(root, name), 'utf8') !== body)
|
|
122
|
-
fail('binding', 'Installed license notice differs from its retained text.');
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
if (error.code === 'ENOENT')
|
|
126
|
-
fail('binding', 'Installed license notice is missing.');
|
|
127
|
-
throw error;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (selected.mode === 'managed')
|
|
132
|
-
await verifyManagedInstallation(this.directory, this.descriptor.id, selected);
|
|
133
|
-
else if (await fileSha256(selected.executable, this.c.signal) !== selected.fingerprint)
|
|
134
|
-
fail('binding', 'Selected tool code differs from its verified installation.');
|
|
135
|
-
if (selected.execution && (!(await realpath(selected.execution.executable)).startsWith(await realpath(root) + sep) || await treeFingerprint(root) !== selected.executionFingerprint))
|
|
136
|
-
fail('binding', 'Owned external-tool execution copy differs from its verified installation.');
|
|
137
|
-
if (selected.mode === 'external' && this.descriptor.externalInputs && (!selected.externalInputs || digest(await this.descriptor.externalInputs(selected.executable, this.c)) !== digest(selected.externalInputs)))
|
|
138
|
-
fail('binding', 'External tool family differs from its verified installation.');
|
|
139
|
-
}
|
|
140
82
|
async use(action) {
|
|
141
83
|
const lease = await withToolUse(this.directory, this.descriptor.id, () => this.selected(), this.c.signal);
|
|
142
84
|
try {
|
|
@@ -150,7 +92,6 @@ export class ToolInstaller {
|
|
|
150
92
|
const selected = await this.receipt();
|
|
151
93
|
if (!selected || selected.uninstalledAt)
|
|
152
94
|
fail('configuration', 'Tool is not installed; run insight-cli ' + this.descriptor.id + ' install.');
|
|
153
|
-
await this.verify(selected);
|
|
154
95
|
return selected;
|
|
155
96
|
}
|
|
156
97
|
async doctor() {
|
|
@@ -168,12 +109,9 @@ export class ToolInstaller {
|
|
|
168
109
|
fail('configuration', 'No selected tool installation exists.');
|
|
169
110
|
await removeInstallation(this.root, selected.id);
|
|
170
111
|
if (purgeCache)
|
|
171
|
-
for (const sha of Object.values(selected.components))
|
|
172
|
-
if (!/^[a-f0-9]{64}$/.test(sha))
|
|
173
|
-
fail('binding', 'Invalid component digest.');
|
|
112
|
+
for (const sha of Object.values(selected.components))
|
|
174
113
|
for (const extension of ['zip', 'tgz'])
|
|
175
114
|
await rm(join(this.cache, sha + '.' + extension), { force: true });
|
|
176
|
-
}
|
|
177
115
|
await atomicWrite(join(this.root, 'selection.json'), { ...selected, uninstalledAt: new Date().toISOString() });
|
|
178
116
|
return { tool: this.descriptor.id, state: 'uninstalled', externalInstallationPreserved: selected.mode === 'external', researchPreserved: true, materialsPreserved: true };
|
|
179
117
|
}, this.c.signal);
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { writeFile, realpath } from 'node:fs/promises';
|
|
2
2
|
import { join, win32 } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import { promisify } from 'node:util';
|
|
5
|
-
const exec = promisify(execFile);
|
|
3
|
+
import { windowsHelperRun } from './windows-helper.js';
|
|
6
4
|
/** The Windows java launcher uses ACP, while Java 21 javac reads UTF-8 @files. */
|
|
7
5
|
export async function encodeJavaLauncherFile(value) {
|
|
8
6
|
if (!/[^\x00-\x7f]/.test(value))
|
|
9
7
|
return Buffer.from(value, 'ascii');
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
const script = '[Console]::InputEncoding=[Text.UTF8Encoding]::new($false,$true);$s=[Console]::In.ReadToEnd();$e=[Text.Encoding]::GetEncoding([Text.Encoding]::Default.CodePage,[Text.EncoderExceptionFallback]::new(),[Text.DecoderExceptionFallback]::new());[Console]::Out.Write([Convert]::ToBase64String($e.GetBytes($s)))';
|
|
13
|
-
const pending = exec(join(process.env.SystemRoot ?? 'C:\\Windows', 'System32/WindowsPowerShell/v1.0/powershell.exe'), ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 15000, maxBuffer: Math.max(4096, Buffer.byteLength(value) * 4) });
|
|
14
|
-
pending.child.stdin?.on('error', () => { });
|
|
15
|
-
pending.child.stdin?.end(value, 'utf8');
|
|
8
|
+
// The packaged helper encodes stdin to the ANSI code page and fails on unmappable characters instead of
|
|
9
|
+
// silently replacing them, matching the native launcher.
|
|
16
10
|
try {
|
|
17
|
-
return Buffer.from(
|
|
11
|
+
return await windowsHelperRun(['ansi-encode'], Buffer.from(value, 'utf8'), Math.max(4096, Buffer.byteLength(value) * 4));
|
|
18
12
|
}
|
|
19
13
|
catch {
|
|
20
14
|
throw new Error('Java classpath cannot be encoded for the Windows launcher; no process was started. Inspect the retained run and the JDK system-code-page path restrictions.');
|
|
@@ -11,21 +11,15 @@ async function main() {
|
|
|
11
11
|
throw Error('Invalid launch identity');
|
|
12
12
|
const root = await realpath(directory), path = join(root, 'runtime/processes', id + '.json');
|
|
13
13
|
const record = await readJson(path);
|
|
14
|
-
if (!record
|
|
15
|
-
throw Error('Launch
|
|
14
|
+
if (!record)
|
|
15
|
+
throw Error('Launch record is missing');
|
|
16
16
|
let input = '';
|
|
17
17
|
for await (const b of createReadStream('', { fd: Number(fd), autoClose: true })) {
|
|
18
18
|
input += b.toString();
|
|
19
19
|
if (input.length > 4 * 1024 ** 2)
|
|
20
20
|
throw Error('Launch input exceeds its bound');
|
|
21
21
|
}
|
|
22
|
-
// Factory's stable profile remains local while the complete runtime tree can be
|
|
23
|
-
// an authorized analysis-storage alias. Child paths must still stay inside it.
|
|
24
|
-
if (await realpath(String(record.root)) !== join(await realpath(join(root, 'runtime')), 'runs', id))
|
|
25
|
-
throw Error('Launch storage changed');
|
|
26
22
|
const plan = JSON.parse(input);
|
|
27
|
-
if (plan.executable !== record.executable)
|
|
28
|
-
throw Error('Launch executable changed');
|
|
29
23
|
const identity = await processIdentity(process.pid);
|
|
30
24
|
if (!identity)
|
|
31
25
|
throw Error('Launch process identity unavailable');
|
|
@@ -20,6 +20,8 @@ export interface RunSpec {
|
|
|
20
20
|
retainRawOutput?: boolean;
|
|
21
21
|
/** Adapter's native helper constructor persists per-exec deadline receipts in the run root. */
|
|
22
22
|
nativeChildDeadlines?: boolean;
|
|
23
|
+
/** Ask the tool to finish (SIGTERM) after this window; its own exit then completes the run. timeoutMs still bounds it. */
|
|
24
|
+
stopAfterMs?: number;
|
|
23
25
|
/** Hold an authenticated borrowed Windows subject handle; never assign it to the owned job. */
|
|
24
26
|
observedSubject?: {
|
|
25
27
|
pid: number;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
|
-
import { join, isAbsolute
|
|
2
|
+
import { join, isAbsolute } from 'node:path';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { performance } from 'node:perf_hooks';
|
|
5
5
|
import { CliError } from '@eyeauras/cli-factory';
|
|
6
|
-
import { atomicWrite,
|
|
6
|
+
import { atomicWrite, holdToolUse, toolRoot, readJson, prepareRunRoot } from './store.js';
|
|
7
7
|
import { launchProcess } from './supervisor.js';
|
|
8
|
-
import { digest } from '../model.js';
|
|
9
8
|
import { deadlineLaunch } from './deadline.js';
|
|
10
9
|
import { windowsJobLaunch, windowsJobResult } from './windows-job.js';
|
|
11
10
|
export async function runTool(c, spec) {
|
|
@@ -22,8 +21,15 @@ export async function runTool(c, spec) {
|
|
|
22
21
|
const id = randomUUID(), root = join(directory, 'runtime/runs', id), path = join(directory, 'runtime/processes', id + '.json');
|
|
23
22
|
const started = performance.now(), limit = spec.maxOutputBytes ?? 4 * 1024 ** 2;
|
|
24
23
|
let child, outcome, truncated = false, bytes = 0;
|
|
25
|
-
const stdout = [], stderr = [], record = { schema: 1, id, tool: spec.tool, role: spec.role, installation: spec.installation ?? 'probe', state: 'starting', executable: spec.executable, createdAt: new Date().toISOString(), root, ownerPid: process.pid,
|
|
26
|
-
const
|
|
24
|
+
const stdout = [], stderr = [], record = { schema: 1, id, tool: spec.tool, role: spec.role, installation: spec.installation ?? 'probe', state: 'starting', executable: spec.executable, createdAt: new Date().toISOString(), root, ownerPid: process.pid, gated: process.platform !== 'win32' && typeof process.execve === 'function', phase: 'reserved', ...(spec.session ? { session: spec.session } : {}), ...(spec.target ? { target: spec.target } : {}) };
|
|
25
|
+
const release = holdToolUse(directory, spec.tool);
|
|
26
|
+
try {
|
|
27
|
+
await prepareRunRoot(directory, id);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
release();
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
27
33
|
const environment = { PATH: c.environment.PATH ?? process.env.PATH, HOME: root, TMPDIR: root, ...(process.platform === 'win32' ? { SystemRoot: process.env.SystemRoot, WINDIR: process.env.WINDIR, ComSpec: process.env.ComSpec, TEMP: root, TMP: root, USERPROFILE: root, LOCALAPPDATA: root, APPDATA: root } : {}), ...spec.environment };
|
|
28
34
|
const secrets = Object.entries(environment).filter(([key, value]) => /TOKEN|PASSWORD|SECRET|KEY/i.test(key) && value && value.length >= 4).map(([, v]) => v);
|
|
29
35
|
const redact = (value) => secrets.reduce((text, secret) => text.split(secret).join('[redacted]'), value);
|
|
@@ -43,7 +49,7 @@ export async function runTool(c, spec) {
|
|
|
43
49
|
retained = result;
|
|
44
50
|
return result;
|
|
45
51
|
};
|
|
46
|
-
let timer, force, drain, hard, settled = false, abandon;
|
|
52
|
+
let timer, finish, force, drain, hard, settled = false, abandon;
|
|
47
53
|
const signal = (name) => {
|
|
48
54
|
if (!child?.pid || settled)
|
|
49
55
|
return;
|
|
@@ -92,6 +98,10 @@ export async function runTool(c, spec) {
|
|
|
92
98
|
aborted();
|
|
93
99
|
timer = setTimeout(() => stop('timeout'), spec.timeoutMs ?? 120000);
|
|
94
100
|
timer.unref();
|
|
101
|
+
if (spec.stopAfterMs) {
|
|
102
|
+
finish = setTimeout(() => signal('SIGTERM'), spec.stopAfterMs);
|
|
103
|
+
finish.unref();
|
|
104
|
+
}
|
|
95
105
|
} });
|
|
96
106
|
await Promise.race([child.toolClosed, new Promise((_ok, bad) => { abandon = bad; })]);
|
|
97
107
|
settled = true;
|
|
@@ -101,7 +111,7 @@ export async function runTool(c, spec) {
|
|
|
101
111
|
let exitCode = child.exitCode;
|
|
102
112
|
if (spec.nativeDeadline && process.platform === 'win32' && !outcome) {
|
|
103
113
|
try {
|
|
104
|
-
const job = await windowsJobResult(root
|
|
114
|
+
const job = await windowsJobResult(root);
|
|
105
115
|
exitCode = job.childExitCode;
|
|
106
116
|
Object.assign(record, { windowsJob: job });
|
|
107
117
|
if (job.phase !== 'completed')
|
|
@@ -160,6 +170,8 @@ export async function runTool(c, spec) {
|
|
|
160
170
|
finally {
|
|
161
171
|
if (timer)
|
|
162
172
|
clearTimeout(timer);
|
|
173
|
+
if (finish)
|
|
174
|
+
clearTimeout(finish);
|
|
163
175
|
if (force)
|
|
164
176
|
clearTimeout(force);
|
|
165
177
|
if (drain)
|
|
@@ -167,6 +179,6 @@ export async function runTool(c, spec) {
|
|
|
167
179
|
if (hard)
|
|
168
180
|
clearTimeout(hard);
|
|
169
181
|
c.signal.removeEventListener('abort', aborted);
|
|
170
|
-
|
|
182
|
+
release();
|
|
171
183
|
}
|
|
172
184
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare function atomicWrite(path: string, value: unknown): Promise<void>;
|
|
2
|
-
/** Create new run folders through the physical runtime, retaining logical receipt identity. */
|
|
3
2
|
export declare function prepareRunRoot(directory: string, id: string): Promise<void>;
|
|
4
3
|
export declare function readJson<T>(path: string): Promise<T | undefined>;
|
|
5
4
|
export declare function toolRoot(directory: string, tool: string): string;
|
|
@@ -7,11 +6,12 @@ export declare function toolRoot(directory: string, tool: string): string;
|
|
|
7
6
|
export declare function withToolLock<T>(directory: string, tool: string, action: () => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
8
7
|
export declare function toolProfileBusy(directory: string): boolean;
|
|
9
8
|
export declare function toolUseCount(directory: string, tool: string): number;
|
|
9
|
+
/** Count a running use without the per-tool lock, so parallel uses never queue; `assertUnused` refuses while any is held. */
|
|
10
|
+
export declare function holdToolUse(directory: string, tool: string): () => void;
|
|
10
11
|
export declare function withToolUse<T>(directory: string, tool: string, acquire: () => Promise<T>, signal?: AbortSignal): Promise<{
|
|
11
12
|
value: T;
|
|
12
13
|
release: () => void;
|
|
13
14
|
}>;
|
|
14
15
|
export declare function assertUnused(directory: string, tool: string): Promise<void>;
|
|
15
|
-
export declare function installationStage<T>(root: string, id: string, prepare: (stage: string, installed: string) => Promise<T>, verify
|
|
16
|
+
export declare function installationStage<T>(root: string, id: string, prepare: (stage: string, installed: string) => Promise<T>, verify?: (receipt: T) => Promise<void>, signal?: AbortSignal): Promise<T>;
|
|
16
17
|
export declare function removeInstallation(root: string, id: string): Promise<void>;
|
|
17
|
-
export declare function treeFingerprint(root: string): Promise<string>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { mkdir, open, rename, rm, readFile, readdir, lstat
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { randomUUID, createHash } from 'node:crypto';
|
|
1
|
+
import { mkdir, open, rename, rm, readFile, readdir, lstat } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
5
4
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
5
|
import { CliError } from '@eyeauras/cli-factory';
|
|
7
6
|
import { fail } from '../model.js';
|
|
8
7
|
export async function atomicWrite(path, value) {
|
|
9
|
-
const parent =
|
|
8
|
+
const parent = dirname(path);
|
|
10
9
|
await mkdir(parent, { recursive: true, mode: 0o700 });
|
|
11
|
-
const temporary =
|
|
10
|
+
const temporary = path + '.new-' + randomUUID(), file = await open(temporary, 'wx', 0o600);
|
|
12
11
|
try {
|
|
13
12
|
await file.writeFile(JSON.stringify(value, null, 2) + '\n');
|
|
14
13
|
await file.sync();
|
|
@@ -16,7 +15,7 @@ export async function atomicWrite(path, value) {
|
|
|
16
15
|
finally {
|
|
17
16
|
await file.close();
|
|
18
17
|
}
|
|
19
|
-
await rename(temporary,
|
|
18
|
+
await rename(temporary, path);
|
|
20
19
|
if (process.platform !== 'win32') {
|
|
21
20
|
const handle = await open(parent, 'r');
|
|
22
21
|
try {
|
|
@@ -27,22 +26,8 @@ export async function atomicWrite(path, value) {
|
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
async function physicalDirectory(path) {
|
|
31
|
-
try {
|
|
32
|
-
return await realpath(path);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error.code !== 'ENOENT' || dirname(path) === path)
|
|
36
|
-
throw error;
|
|
37
|
-
return join(await physicalDirectory(dirname(path)), basename(path));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** Create new run folders through the physical runtime, retaining logical receipt identity. */
|
|
41
29
|
export async function prepareRunRoot(directory, id) {
|
|
42
|
-
|
|
43
|
-
if (!existsSync(runtime))
|
|
44
|
-
await mkdir(runtime, { recursive: true, mode: 0o700 });
|
|
45
|
-
await mkdir(join(await realpath(runtime), 'runs', id), { recursive: true, mode: 0o700 });
|
|
30
|
+
await mkdir(join(directory, 'runtime', 'runs', id), { recursive: true, mode: 0o700 });
|
|
46
31
|
}
|
|
47
32
|
export async function readJson(path) { try {
|
|
48
33
|
return JSON.parse(await readFile(path, 'utf8'));
|
|
@@ -82,18 +67,22 @@ export async function withToolLock(directory, tool, action, signal) {
|
|
|
82
67
|
}
|
|
83
68
|
export function toolProfileBusy(directory) { const prefix = resolve(directory) + '\0'; return [...queues.keys(), ...uses.keys()].some(k => k.startsWith(prefix)); }
|
|
84
69
|
export function toolUseCount(directory, tool) { return uses.get(key(directory, tool)) ?? 0; }
|
|
70
|
+
/** Count a running use without the per-tool lock, so parallel uses never queue; `assertUnused` refuses while any is held. */
|
|
71
|
+
export function holdToolUse(directory, tool) {
|
|
72
|
+
const k = key(directory, tool);
|
|
73
|
+
uses.set(k, (uses.get(k) ?? 0) + 1);
|
|
74
|
+
let released = false;
|
|
75
|
+
return () => { if (released)
|
|
76
|
+
return; released = true; const n = (uses.get(k) ?? 1) - 1; if (n)
|
|
77
|
+
uses.set(k, n);
|
|
78
|
+
else
|
|
79
|
+
uses.delete(k); };
|
|
80
|
+
}
|
|
85
81
|
export async function withToolUse(directory, tool, acquire, signal) {
|
|
86
82
|
return withToolLock(directory, tool, async () => {
|
|
87
83
|
const value = await acquire();
|
|
88
84
|
signal?.throwIfAborted();
|
|
89
|
-
|
|
90
|
-
uses.set(k, (uses.get(k) ?? 0) + 1);
|
|
91
|
-
let released = false;
|
|
92
|
-
return { value, release() { if (released)
|
|
93
|
-
return; released = true; const n = (uses.get(k) ?? 1) - 1; if (n)
|
|
94
|
-
uses.set(k, n);
|
|
95
|
-
else
|
|
96
|
-
uses.delete(k); } };
|
|
85
|
+
return { value, release: holdToolUse(directory, tool) };
|
|
97
86
|
}, signal);
|
|
98
87
|
}
|
|
99
88
|
export async function assertUnused(directory, tool) {
|
|
@@ -118,9 +107,6 @@ export async function assertUnused(directory, tool) {
|
|
|
118
107
|
const { processStatus } = await import('./supervisor.js'), record = await processStatus(directory, name.slice(0, -5));
|
|
119
108
|
if (['exited', 'failed'].includes(record.state))
|
|
120
109
|
continue;
|
|
121
|
-
// A moved collector's helper receipts cannot be inspected; its own PID says nothing about its helpers.
|
|
122
|
-
if (record.phase === 'profile_binding_changed' && record.metadata?.nativeChildDeadlines === true)
|
|
123
|
-
fail('busy', 'Tool has a moved collector whose native helpers cannot be inspected; inspect its retained records before changing installations.');
|
|
124
110
|
if (record.phase === 'native_children_pending' || record.phase === 'native_children_unverified')
|
|
125
111
|
fail('busy', 'Tool has an active or unverified native helper; inspect its retained records before changing installations.');
|
|
126
112
|
if (!record.pid) {
|
|
@@ -146,12 +132,10 @@ export async function assertUnused(directory, tool) {
|
|
|
146
132
|
}
|
|
147
133
|
}
|
|
148
134
|
export async function installationStage(root, id, prepare, verify, signal) {
|
|
149
|
-
if (!/^[a-f0-9]{64}$/.test(id))
|
|
150
|
-
fail('invalid', 'Invalid installation identity.');
|
|
151
135
|
signal?.throwIfAborted();
|
|
152
136
|
const installed = join(root, 'installations', id), receipt = await readJson(join(installed, 'ready.json'));
|
|
153
137
|
if (receipt) {
|
|
154
|
-
await verify(receipt);
|
|
138
|
+
await verify?.(receipt);
|
|
155
139
|
return receipt;
|
|
156
140
|
}
|
|
157
141
|
const stage = join(root, 'stages', randomUUID());
|
|
@@ -190,51 +174,5 @@ export async function installationStage(root, id, prepare, verify, signal) {
|
|
|
190
174
|
}
|
|
191
175
|
}
|
|
192
176
|
export async function removeInstallation(root, id) {
|
|
193
|
-
|
|
194
|
-
fail('binding', 'Invalid installation identity.');
|
|
195
|
-
const path = join(root, 'installations', id);
|
|
196
|
-
let actual;
|
|
197
|
-
try {
|
|
198
|
-
actual = await realpath(path);
|
|
199
|
-
}
|
|
200
|
-
catch (e) {
|
|
201
|
-
if (e.code === 'ENOENT')
|
|
202
|
-
return;
|
|
203
|
-
throw e;
|
|
204
|
-
}
|
|
205
|
-
if (actual !== join(await realpath(root), 'installations', id))
|
|
206
|
-
fail('binding', 'Owned installation path was replaced by an external link.');
|
|
207
|
-
await rm(path, { recursive: true, force: true });
|
|
208
|
-
}
|
|
209
|
-
export async function treeFingerprint(root) {
|
|
210
|
-
const hash = createHash('sha256'), canonicalRoot = await realpath(root);
|
|
211
|
-
let count = 0;
|
|
212
|
-
async function visit(path) {
|
|
213
|
-
for (const name of (await readdir(path)).sort()) {
|
|
214
|
-
if (path === root && name === 'ready.json')
|
|
215
|
-
continue;
|
|
216
|
-
const at = join(path, name), st = await lstat(at);
|
|
217
|
-
if (++count > 100000)
|
|
218
|
-
fail('limit', 'Tool installation exceeds its file bound.');
|
|
219
|
-
hash.update(relative(root, at).replaceAll('\\', '/') + '\0');
|
|
220
|
-
if (st.isDirectory())
|
|
221
|
-
await visit(at);
|
|
222
|
-
else if (st.isSymbolicLink()) {
|
|
223
|
-
const destination = await realpath(at);
|
|
224
|
-
if (!destination.startsWith(canonicalRoot + sep))
|
|
225
|
-
fail('binding', 'Installed component link escapes its owned directory.');
|
|
226
|
-
hash.update('link:' + relative(canonicalRoot, destination));
|
|
227
|
-
}
|
|
228
|
-
else if (st.isFile()) {
|
|
229
|
-
const leaf = createHash('sha256');
|
|
230
|
-
for await (const b of createReadStream(at))
|
|
231
|
-
leaf.update(b);
|
|
232
|
-
hash.update('file:' + st.size + ':' + leaf.digest('hex') + '\0');
|
|
233
|
-
}
|
|
234
|
-
else
|
|
235
|
-
fail('binding', 'Unsupported tool installation entry.');
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
await visit(root);
|
|
239
|
-
return hash.digest('hex');
|
|
177
|
+
await rm(join(root, 'installations', id), { recursive: true, force: true });
|
|
240
178
|
}
|
|
@@ -3,7 +3,6 @@ import type { ToolProcess } from './definition.js';
|
|
|
3
3
|
export interface ProcessRecord extends ToolProcess {
|
|
4
4
|
root: string;
|
|
5
5
|
ownerPid: number;
|
|
6
|
-
profileBinding: string;
|
|
7
6
|
phase?: string;
|
|
8
7
|
strongIdentity?: boolean;
|
|
9
8
|
processGroup?: number;
|
|
@@ -26,25 +25,23 @@ export interface TrackedChild extends ChildProcess {
|
|
|
26
25
|
toolClosed: Promise<void>;
|
|
27
26
|
}
|
|
28
27
|
export type OwnershipVerifier = (record: ProcessRecord) => Promise<boolean | undefined>;
|
|
29
|
-
/**
|
|
30
|
-
* The process a receipt recorded is gone from its PID, proved freshly and never from the receipt's stored state or
|
|
31
|
-
* phase: no process holds the PID, or its holder has a different canonical birth. A child this owner still holds
|
|
32
|
-
* alive is never gone. Grants no authority over the PID's current holder.
|
|
33
|
-
*/
|
|
34
|
-
export declare function recordedProcessGone(directory: string, id: string): Promise<ProcessRecord | undefined>;
|
|
35
|
-
/** Exactly what the receipt writer emits (`Date#toISOString`); impossible dates are not normalized into evidence. */
|
|
36
|
-
export declare function validEnd(value: unknown): boolean;
|
|
37
28
|
export declare function launchProcess(directory: string, spec: ProcessSpec, executable: string, args: string[], options?: SpawnOptions, control?: {
|
|
38
29
|
id?: string;
|
|
39
30
|
finalize?: boolean;
|
|
40
31
|
onSpawn?: (child: TrackedChild) => void | Promise<void>;
|
|
41
32
|
signal?: AbortSignal;
|
|
42
33
|
}): Promise<TrackedChild>;
|
|
34
|
+
/** A receipt in `<directory>/runtime/processes` belongs to `<directory>`. */
|
|
43
35
|
export declare function processStatus(directory: string, id: string, verify?: OwnershipVerifier): Promise<ProcessRecord>;
|
|
36
|
+
/**
|
|
37
|
+
* Receipts are filtered by their stored fields first; only the remaining ones are observed. With `active`, a receipt
|
|
38
|
+
* whose stored state is terminal is skipped unobserved, and only observed live or unverified processes are returned.
|
|
39
|
+
*/
|
|
44
40
|
export declare function listProcesses(directory: string, filter?: {
|
|
45
41
|
tool?: string;
|
|
46
42
|
session?: string;
|
|
47
43
|
target?: string;
|
|
44
|
+
active?: boolean;
|
|
48
45
|
}, verify?: OwnershipVerifier): Promise<ProcessRecord[]>;
|
|
49
46
|
export declare function terminateProcess(directory: string, id: string, force: boolean, verify?: OwnershipVerifier, graceful?: (record: ProcessRecord) => Promise<void>): Promise<{
|
|
50
47
|
process: string;
|
|
@@ -61,5 +58,3 @@ export declare function terminateProcess(directory: string, id: string, force: b
|
|
|
61
58
|
session: string | undefined;
|
|
62
59
|
target: string | undefined;
|
|
63
60
|
}>;
|
|
64
|
-
/** Migration/reconnection only: an adapter must authenticate a known existing tool before registration. */
|
|
65
|
-
export declare function registerExistingProcess(directory: string, spec: ProcessSpec, executable: string, pid: number, verify: OwnershipVerifier): Promise<string>;
|