@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/sdk.js
CHANGED
|
@@ -3,7 +3,7 @@ import { sdkOperations } from './sdk-contracts.js';
|
|
|
3
3
|
import { option, key, parsed, selectedOptions } from './arguments.js';
|
|
4
4
|
import { scope, address, number } from './research.js';
|
|
5
5
|
import { id, fail, object, text } from './model.js';
|
|
6
|
-
import {
|
|
6
|
+
import { stat } from 'node:fs/promises';
|
|
7
7
|
import { resolve } from 'node:path';
|
|
8
8
|
export function sdkInputs(operation, p) {
|
|
9
9
|
if (['type-structure', 'type-layout', 'type-settings'].includes(operation) && !/^\/(?:[^/\0]+\/)*[^/\0]+$/.test(String(p.path)))
|
|
@@ -104,22 +104,22 @@ export function sdkCommands(research) {
|
|
|
104
104
|
sdkInputs(entry.operation, p);
|
|
105
105
|
const api = research(c), operation = '/sdk/' + entry.operation;
|
|
106
106
|
if (entry.operation === 'type-archive-import') {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
107
|
+
const input = resolve(c.cwd, String(p.input));
|
|
108
|
+
if ((await stat(input)).size > 67108864)
|
|
109
109
|
fail('limit', 'Type archive exceeds 64 MiB.');
|
|
110
110
|
delete p.input;
|
|
111
|
-
p.
|
|
111
|
+
p.input_path = input;
|
|
112
112
|
}
|
|
113
113
|
if (entry.write)
|
|
114
|
-
return api.mutate(selected, operation, p
|
|
115
|
-
|
|
114
|
+
return api.mutate(selected, operation, p);
|
|
115
|
+
// Without --other-target a comparison uses the version this working copy is based on.
|
|
116
|
+
const other = entry.pair ? o.otherTarget === undefined ? 'base' : { session: o.otherSession === undefined ? selected.session : id(o.otherSession), target: id(o.otherTarget) } : undefined;
|
|
116
117
|
const value = object(other ? await api.crossRead(selected, other, operation, p) : await api.read(selected, operation, p));
|
|
117
118
|
if (Buffer.byteLength(JSON.stringify(value)) > 1048576)
|
|
118
119
|
fail('limit', 'SDK result exceeds 1 MiB; narrow the operation.');
|
|
119
120
|
return { ...selected, ...(other ? { other } : {}), value };
|
|
120
121
|
}, { permission: entry.write ? 'Destructive' : Permission.ReadOnly, options: [...selectedOptions, ...entry.params.map(option),
|
|
121
|
-
...(entry.pair ? [{ flags: '--other-target <id>', description: 'Second
|
|
122
|
-
...(entry.write ? [{ flags: '--request-id <id>', description: 'Retrieve this changing intent without repeating it' }] : [])] }));
|
|
122
|
+
...(entry.pair ? [{ flags: '--other-target <id>', description: 'Second context target (default: compare with the base version of this working copy)' }, { flags: '--other-session <id>', description: 'Second session (default selected session)' }] : [])] }));
|
|
123
123
|
}
|
|
124
124
|
return [...groups].map(([name, children]) => command(name, name + ' native SDK workflows', children));
|
|
125
125
|
}
|
package/dist/src/sevenzip.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
2
|
import { join, resolve, dirname } from 'node:path';
|
|
3
|
-
import { mkdir
|
|
3
|
+
import { mkdir } from 'node:fs/promises';
|
|
4
4
|
import { ToolInstaller } from './tool-runtime/installer.js';
|
|
5
5
|
import { defineTool, lifecycleCommands } from './tool-runtime/definition.js';
|
|
6
6
|
import { catalogArtifact } from './tool-runtime/catalog.js';
|
|
@@ -108,8 +108,6 @@ export function sevenzipCommands(workspace) {
|
|
|
108
108
|
}
|
|
109
109
|
await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
|
|
110
110
|
const result = await invoke('recover', ['x', '-so', '-spd', '-bd', '-y', '-p', '--', input, entry.path], { maxOutputBytes: Math.max(65536, entry.size + 65536), outputFile: destination });
|
|
111
|
-
if ((await lstat(destination)).size !== entry.size)
|
|
112
|
-
fail('binding', 'Recovered file size differs from the inventory; retained partial output requires inspection.');
|
|
113
111
|
files.push({ path: entry.path, size: entry.size, process: result.process });
|
|
114
112
|
}
|
|
115
113
|
return { ...base, state: 'extracted', outputDirectory: output, files, bytes, publication: 'ordinary files; no shared analysis merge' };
|
package/dist/src/strace.js
CHANGED
|
@@ -7,7 +7,6 @@ import { ToolInstaller } from './tool-runtime/installer.js';
|
|
|
7
7
|
import { defineTool, lifecycleCommands } from './tool-runtime/definition.js';
|
|
8
8
|
import { catalogArtifact } from './tool-runtime/catalog.js';
|
|
9
9
|
import { runTool } from './tool-runtime/run.js';
|
|
10
|
-
import { fileSha256 } from './tool-runtime/archives.js';
|
|
11
10
|
import { fail, text, id } from './model.js';
|
|
12
11
|
import { number } from './research.js';
|
|
13
12
|
// Exact binary from the reviewed reproducible Linux source build.
|
|
@@ -54,8 +53,6 @@ export function straceCommands(workspace) {
|
|
|
54
53
|
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
55
54
|
await copyFile(input, subject, constants.COPYFILE_EXCL);
|
|
56
55
|
await chmod(subject, 0o700);
|
|
57
|
-
if (await fileSha256(subject) !== target.binarySha256)
|
|
58
|
-
fail('binding', 'Owned ELF bytes differ from the immutable target.');
|
|
59
56
|
return straceInstaller(c).use(async (selected) => {
|
|
60
57
|
const result = await runTool(c, { tool: 'strace', role: 'trace', installation: selected.id, executable: selected.executable, arguments: [...plan.arguments, '--', subject, ...plan.programArguments], cwd: c.cwd, target: target.id, timeoutMs, nativeDeadline: true, metadata: { inputSha256: target.binarySha256, events: plan.events } }), lines = result.stderr.trimEnd().split(/\r?\n/);
|
|
61
58
|
const base = { state: 'completed', target: target.id, inputSha256: target.binarySha256, process: result.process, elapsedMs: result.elapsedMs, diagnostics: result.diagnostics, events: plan.events, programStdout: result.stdout, coverage: 'Observed syscalls from one owned launch and its traced descendants. Native trace and program stderr share the stderr stream. Strings and category/path filters are bounded; unobserved operations are unknown. Application side effects require authorization; adjacent executable sidecars are not copied.' };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CommandContext } from '@eyeauras/cli-factory';
|
|
2
2
|
import { type Research, type ResearchBackend } from './research.js';
|
|
3
|
-
import type { Scope } from './
|
|
3
|
+
import type { Scope } from './core/coordinator.js';
|
|
4
4
|
export declare const anchorAlgorithm = "raw-string-anchors-v1";
|
|
5
5
|
export declare const anchorEncodings: readonly ["ascii", "utf16le"];
|
|
6
6
|
type Encoding = typeof anchorEncodings[number];
|
|
@@ -28,8 +28,7 @@ export interface AnchorRequest {
|
|
|
28
28
|
expectedView?: string;
|
|
29
29
|
}
|
|
30
30
|
export declare function anchorRequest(o: Record<string, unknown>, who: Scope): AnchorRequest;
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function inspectAnchors(backend: ResearchBackend, who: Scope, r: AnchorRequest, view: string, observation: unknown, observe: () => Promise<unknown>): Promise<{
|
|
31
|
+
export declare function inspectAnchors(backend: ResearchBackend, who: Scope, r: AnchorRequest, view: string): Promise<{
|
|
33
32
|
value: {
|
|
34
33
|
view: {
|
|
35
34
|
identity: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
2
|
import { scope, number, address } from './research.js';
|
|
3
3
|
import { selectedOptions } from './arguments.js';
|
|
4
|
-
import { fail, object,
|
|
5
|
-
import { parseDomainJson } from './json.js';
|
|
4
|
+
import { fail, object, stable } from './model.js';
|
|
6
5
|
export const anchorAlgorithm = 'raw-string-anchors-v1';
|
|
7
6
|
export const anchorEncodings = ['ascii', 'utf16le'];
|
|
8
7
|
const defaults = { max_bytes: 4194304, max_candidates: 10000, timeout_seconds: 5, limit: 100 };
|
|
@@ -40,122 +39,30 @@ function query(raw) {
|
|
|
40
39
|
return { text, encodings, start, end, cap };
|
|
41
40
|
}
|
|
42
41
|
function budgets(o, base = defaults) { return { max_bytes: number(o.maxBytes ?? base.max_bytes, 16777216, 32768), max_candidates: number(o.maxCandidates ?? base.max_candidates, 100000, 1), timeout_seconds: number(o.timeoutSeconds ?? base.timeout_seconds, 30, 1), limit: number(o.limit ?? base.limit, 1000, 1) }; }
|
|
43
|
-
function frontier(raw, q) {
|
|
44
|
-
const f = object(raw), at = hex(f.address);
|
|
45
|
-
if (big(at) < big(q.start) || big(at) > big(q.end) || !q.encodings.includes(f.encoding))
|
|
46
|
-
fail('invalid', 'String-anchor frontier is outside the query.');
|
|
47
|
-
return { address: at, encoding: f.encoding };
|
|
48
|
-
}
|
|
49
|
-
function ordinal(f, q) { return big(f.address) * BigInt(q.encodings.length) + BigInt(q.encodings.indexOf(f.encoding)); }
|
|
50
42
|
export function anchorRequest(o, who) {
|
|
51
43
|
if (o.cursor !== undefined) {
|
|
52
44
|
if (['text', 'encodings', 'scanFrom', 'scanThrough', 'maxStringBytes'].some(k => o[k] !== undefined))
|
|
53
45
|
fail('invalid', 'Cursor excludes text, encodings, range and context-cap selectors.');
|
|
54
|
-
if (typeof o.cursor !== 'string' || o.cursor.length > 16384 || !/^sa1\.[A-Za-z0-9_-]+$/.test(o.cursor))
|
|
55
|
-
fail('invalid', 'Malformed string-anchor cursor.');
|
|
56
46
|
let c;
|
|
57
47
|
try {
|
|
58
|
-
|
|
59
|
-
if (b.toString('base64url') !== encoded)
|
|
60
|
-
throw Error();
|
|
61
|
-
c = object(parseDomainJson(b.toString('utf8')));
|
|
48
|
+
c = object(JSON.parse(Buffer.from(String(o.cursor).slice(4), 'base64url').toString('utf8')));
|
|
62
49
|
}
|
|
63
50
|
catch {
|
|
64
51
|
fail('invalid', 'Malformed string-anchor cursor.');
|
|
65
52
|
}
|
|
66
|
-
|
|
67
|
-
fail('invalid', 'Cursor scope, algorithm or view is incompatible.');
|
|
68
|
-
const q = query(c.query), b = object(c.budgets);
|
|
69
|
-
if (['max_bytes', 'max_candidates', 'timeout_seconds', 'limit'].some(k => !Number.isSafeInteger(b[k])))
|
|
70
|
-
fail('invalid', 'Malformed cursor budgets.');
|
|
71
|
-
return { query: q, from: frontier(c.next, q), expectedView: c.view, budgets: budgets(o, budgets({ maxBytes: b.max_bytes, maxCandidates: b.max_candidates, timeoutSeconds: b.timeout_seconds, limit: b.limit })) };
|
|
53
|
+
return { query: c.query, from: c.next, expectedView: String(c.view), budgets: budgets(o, object(c.budgets)) };
|
|
72
54
|
}
|
|
73
55
|
if (typeof o.text !== 'string' || typeof o.encodings !== 'string' || typeof o.scanFrom !== 'string' || typeof o.scanThrough !== 'string')
|
|
74
56
|
fail('invalid', 'Supply --text, --encodings, --scan-from and --scan-through, or --cursor.');
|
|
75
|
-
const q = query({ text: o.text, encodings: o.encodings.split(',').map(x => x.trim()), start: o.scanFrom, end: o.scanThrough, cap: o.maxStringBytes ?? 1024 });
|
|
57
|
+
const q = query({ text: o.text, encodings: o.encodings.trim() === 'both' ? ['ascii', 'utf16le'] : o.encodings.split(',').map(x => x.trim()), start: o.scanFrom, end: o.scanThrough, cap: o.maxStringBytes ?? 1024 });
|
|
76
58
|
return { query: q, from: { address: q.start, encoding: q.encodings[0] }, budgets: budgets(o) };
|
|
77
59
|
}
|
|
78
|
-
function
|
|
79
|
-
if (e === 'ascii')
|
|
80
|
-
return raw.some(x => x > 127) ? null : raw.toString('ascii');
|
|
81
|
-
try {
|
|
82
|
-
return new TextDecoder('utf-16le', { fatal: true, ignoreBOM: true }).decode(raw);
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
export function anchorResult(raw, r, modification) {
|
|
89
|
-
const v = object(raw), s = object(v.scan), q = r.query, b = r.budgets;
|
|
90
|
-
if (v.algorithm !== anchorAlgorithm || stable(v.encodings) !== stable(q.encodings) || v.modification !== modification) {
|
|
91
|
-
if (typeof v.modification === 'string' && v.modification !== modification)
|
|
92
|
-
fail('binding', 'Native view changed during string-anchor scan.', { reason: 'changed_view' });
|
|
93
|
-
fail('partial', 'Malformed string-anchor protocol facts.');
|
|
94
|
-
}
|
|
95
|
-
if (!Array.isArray(v.matches) || v.matches.length > b.limit || stable(s.from) !== stable(r.from) || s.through !== q.end || typeof s.complete !== 'boolean' || s.complete !== (s.reason === 'exhausted') || !['exhausted', 'byte_limit', 'candidate_limit', 'timeout', 'result_limit'].includes(String(s.reason)))
|
|
96
|
-
fail('partial', 'Malformed string-anchor coverage.');
|
|
97
|
-
for (const k of ['bytesRead', 'testedPairs', 'candidates'])
|
|
98
|
-
if (!Number.isSafeInteger(s[k]) || Number(s[k]) < 0)
|
|
99
|
-
fail('partial', 'Malformed string-anchor counters.');
|
|
100
|
-
if (Number(s.bytesRead) > b.max_bytes || Number(s.testedPairs) > Number(s.bytesRead) * q.encodings.length || Number(s.candidates) > b.max_candidates || Number(s.candidates) < v.matches.length || Number(s.candidates) > Number(s.testedPairs) + 1 || !Number.isFinite(s.elapsedMs) || Number(s.elapsedMs) < 0)
|
|
101
|
-
fail('partial', 'Inconsistent string-anchor budgets.');
|
|
102
|
-
const next = s.complete ? null : frontier(s.next, q);
|
|
103
|
-
if (s.complete && s.next !== null || next && ordinal(next, q) < ordinal(r.from, q) || next && BigInt(Number(s.testedPairs)) > ordinal(next, q) - ordinal(r.from, q))
|
|
104
|
-
fail('partial', 'String-anchor frontier changed.');
|
|
105
|
-
if (next && ordinal(next, q) === ordinal(r.from, q) && s.reason !== 'timeout')
|
|
106
|
-
fail('partial', 'String-anchor scan made no progress despite its minimum work budget.');
|
|
107
|
-
let previous = ordinal(r.from, q) - 1n;
|
|
108
|
-
for (const item of v.matches) {
|
|
109
|
-
const row = object(item), at = hex(row.matchAddress), encoding = row.encoding;
|
|
110
|
-
if (!q.encodings.includes(encoding))
|
|
111
|
-
fail('partial', 'Unknown string-anchor encoding.');
|
|
112
|
-
const pair = { address: at, encoding }, order = ordinal(pair, q), needle = bytes(q.text, encoding), unit = encoding === 'ascii' ? 1 : 2, l = object(row.literalCandidate);
|
|
113
|
-
if (order <= previous || order < ordinal(r.from, q) || next && order >= ordinal(next, q) || big(at) + BigInt(needle.length - 1) > big(q.end) || row.matchByteLength !== needle.length)
|
|
114
|
-
fail('partial', 'String-anchor pair/order changed.');
|
|
115
|
-
previous = order;
|
|
116
|
-
if (typeof l.textBytes !== 'string' || !/^(?:[a-f0-9]{2})+$/.test(l.textBytes) || l.textBytes.length > q.cap * 2)
|
|
117
|
-
fail('partial', 'String-anchor context bytes are missing or unbounded.');
|
|
118
|
-
const data = Buffer.from(l.textBytes, 'hex'), from = hex(l.textFrom), offset = big(at) - big(from), left = l.start === null ? null : hex(l.start), right = l.terminatorAddress === null ? null : hex(l.terminatorAddress);
|
|
119
|
-
if (offset < 0n || offset > BigInt(q.cap) || Number(offset) % unit || data.length % unit || l.textByteLength !== data.length || big(from) < big(q.start) || big(from) + BigInt(data.length - 1) > big(q.end) || !data.subarray(Number(offset), Number(offset) + needle.length).equals(needle))
|
|
120
|
-
fail('partial', 'String-anchor preview does not contain its byte match.');
|
|
121
|
-
for (let i = 0; i < data.length; i += unit)
|
|
122
|
-
if (data[i] === 0 && (unit === 1 || data[i + 1] === 0))
|
|
123
|
-
fail('partial', 'String-anchor preview crossed a NUL boundary.');
|
|
124
|
-
const boundaries = ['nul', 'range_edge', 'memory_edge', 'string_limit'];
|
|
125
|
-
if (!boundaries.includes(String(l.leftBoundary)) || !boundaries.includes(String(l.rightBoundary)) || (l.leftBoundary === 'nul') !== (left !== null) || (l.rightBoundary === 'nul') !== (right !== null))
|
|
126
|
-
fail('partial', 'String-anchor boundary facts changed.');
|
|
127
|
-
if (left !== null && (big(left) > big(at) || big(left) < big(q.start) + BigInt(unit) || big(left) > big(from) || row.matchOffsetBytes !== Number(big(at) - big(left)) || Number(big(at) - big(left)) % unit || Number(big(at) - big(left)) > q.cap - needle.length) || left === null && row.matchOffsetBytes !== null)
|
|
128
|
-
fail('partial', 'Invalid candidate start/offset.');
|
|
129
|
-
if (right !== null && (big(right) < big(at) + BigInt(needle.length) || big(right) + BigInt(unit - 1) > big(q.end) || big(right) < big(from) + BigInt(data.length) || Number(big(right) - big(at) - BigInt(needle.length)) % unit || Number(big(right) - big(at) - BigInt(needle.length)) > q.cap - needle.length))
|
|
130
|
-
fail('partial', 'Invalid candidate terminator.');
|
|
131
|
-
const bounded = left !== null && right !== null, total = bounded ? Number(big(right) - big(left)) : null, text = decoded(data, encoding), complete = bounded && total <= q.cap && text !== null;
|
|
132
|
-
const reason = complete ? 'complete' : total !== null && total > q.cap || l.leftBoundary === 'string_limit' || l.rightBoundary === 'string_limit' ? 'string_limit' : !bounded ? 'missing_boundary' : 'invalid_encoding';
|
|
133
|
-
if (l.boundariesComplete !== bounded || l.byteLength !== total || l.text !== text || l.decoding !== (text === null ? 'invalid' : 'valid') || l.complete !== complete || l.reason !== reason || complete && (from !== left || data.length !== total))
|
|
134
|
-
fail('partial', 'Inconsistent string-anchor context/decoding facts.');
|
|
135
|
-
}
|
|
136
|
-
if (Buffer.byteLength(JSON.stringify(v)) > 1000000)
|
|
137
|
-
fail('limit', 'String-anchor native response exceeds its envelope reserve.');
|
|
138
|
-
return v;
|
|
139
|
-
}
|
|
140
|
-
export async function inspectAnchors(backend, who, r, view, observation, observe) {
|
|
60
|
+
export async function inspectAnchors(backend, who, r, view) {
|
|
141
61
|
if (r.expectedView !== undefined && r.expectedView !== view)
|
|
142
62
|
fail('binding', 'String-anchor continuation view changed.', { reason: 'changed_view' });
|
|
143
|
-
const modification = object(observation).modification;
|
|
144
|
-
if (typeof modification !== 'string')
|
|
145
|
-
fail('unsupported', 'String anchors require guarded native observations.');
|
|
146
63
|
const q = r.query;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
raw = await backend.call(who, '/insight/string-anchors/v1', { text: q.text, encodings: q.encodings.join(','), scan_from: q.start, scan_through: q.end, resume_address: r.from.address, resume_encoding: r.from.encoding, max_string_bytes: q.cap, ...r.budgets });
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
if (digest(observation) !== digest(await observe()))
|
|
153
|
-
fail('binding', 'Native view changed during string-anchor scan.', { reason: 'changed_view' });
|
|
154
|
-
throw error;
|
|
155
|
-
}
|
|
156
|
-
if (digest(observation) !== digest(await observe()))
|
|
157
|
-
fail('binding', 'Native view changed during string-anchor scan.', { reason: 'changed_view' });
|
|
158
|
-
const value = anchorResult(raw, r, modification), cursor = value.scan && object(value.scan).complete ? null : 'sa1.' + Buffer.from(stable({ version: 1, algorithm: anchorAlgorithm, scope: who, query: q, next: object(value.scan).next, view, budgets: r.budgets })).toString('base64url');
|
|
64
|
+
const raw = await backend.call(who, '/insight/string-anchors/v1', { text: q.text, encodings: q.encodings.join(','), scan_from: q.start, scan_through: q.end, resume_address: r.from.address, resume_encoding: r.from.encoding, max_string_bytes: q.cap, ...r.budgets });
|
|
65
|
+
const value = object(raw), cursor = object(value.scan).complete ? null : 'sa1.' + Buffer.from(stable({ version: 1, algorithm: anchorAlgorithm, scope: who, query: q, next: object(value.scan).next, view, budgets: r.budgets })).toString('base64url');
|
|
159
66
|
const result = { ...who, value: { ...value, view: { identity: view }, cursor } };
|
|
160
67
|
if (Buffer.byteLength(JSON.stringify(result)) > 1048576)
|
|
161
68
|
fail('limit', 'String-anchor response exceeds one MiB.');
|
|
@@ -164,7 +71,7 @@ export async function inspectAnchors(backend, who, r, view, observation, observe
|
|
|
164
71
|
export function stringAnchorCommands(research) {
|
|
165
72
|
return [command('strings', 'String research', [command('anchors', 'Find raw literal byte hits and separate bounded NUL-delimited candidate context', ({ options: o }, c) => { const who = scope(o); return research(c).stringAnchors(who, anchorRequest(o, who)); }, { permission: Permission.ReadOnly, options: [...selectedOptions,
|
|
166
73
|
{ flags: '--text <literal>', description: 'Case-sensitive literal, 1–256 UTF-16 units, no NUL' },
|
|
167
|
-
{ flags: '--encodings <encodings>', description:
|
|
74
|
+
{ flags: '--encodings <encodings>', description: "ascii, utf16le, ascii,utf16le or 'both'; no alignment assumption" },
|
|
168
75
|
{ flags: '--scan-from <address>', description: 'Inclusive range start; context stays inside the range' },
|
|
169
76
|
{ flags: '--scan-through <address>', description: 'Inclusive range end; the whole needle must fit' },
|
|
170
77
|
{ flags: '--max-string-bytes <count>', description: 'Even candidate/preview payload cap 16–8192, default 1024' },
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
/** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. */
|
|
2
|
-
export declare function textWindow(source: string, limit: number, offset: number, sourceTruncated?: boolean): {
|
|
3
|
-
content: string;
|
|
4
|
-
textSha256: string;
|
|
1
|
+
/** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. `hash` adds the text's SHA-256 (saved-file names). */
|
|
2
|
+
export declare function textWindow(source: string, limit: number, offset: number, sourceTruncated?: boolean, hash?: boolean): {
|
|
5
3
|
totalCharacters: number;
|
|
6
4
|
limit: number;
|
|
7
5
|
offset: number;
|
|
8
6
|
sourceTruncated: boolean;
|
|
9
7
|
truncated: boolean;
|
|
10
8
|
coordinates: string;
|
|
9
|
+
textSha256?: string | undefined;
|
|
10
|
+
content: string;
|
|
11
|
+
returnedCharacters: number;
|
|
11
12
|
};
|
package/dist/src/text-window.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
/** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. */
|
|
3
|
-
export function textWindow(source, limit, offset, sourceTruncated = false) {
|
|
4
|
-
const characters = Array.from(source);
|
|
5
|
-
return { content:
|
|
2
|
+
/** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. `hash` adds the text's SHA-256 (saved-file names). */
|
|
3
|
+
export function textWindow(source, limit, offset, sourceTruncated = false, hash = true) {
|
|
4
|
+
const characters = Array.from(source), selected = characters.slice(offset, offset + limit);
|
|
5
|
+
return { content: selected.join(''), returnedCharacters: selected.length, ...(hash ? { textSha256: createHash('sha256').update(source).digest('hex') } : {}), totalCharacters: characters.length, limit, offset, sourceTruncated, truncated: sourceTruncated || offset + limit < characters.length, coordinates: 'Unicode characters in the returned native text' + (hash ? '; hash binds that text,' : ',') + ' which may itself be a truncated prefix' };
|
|
6
6
|
}
|
|
@@ -4,7 +4,7 @@ export declare function archiveName(name: string): string;
|
|
|
4
4
|
export declare function extractArchive(file: string, destination: string, format: 'tgz' | 'zip', signal?: AbortSignal): Promise<void>;
|
|
5
5
|
export declare function cacheArtifact(artifact: ToolArtifact, cache: string, fetcher: typeof fetch, signal: AbortSignal, offline?: boolean, vendorDirect?: boolean): Promise<string>;
|
|
6
6
|
/** Consume local input once; extraction never races later edits to the caller's archive. */
|
|
7
|
-
export declare function consumeArchive(path: string, cache: string, artifact: ToolArtifact,
|
|
7
|
+
export declare function consumeArchive(path: string, cache: string, artifact: ToolArtifact, signal?: AbortSignal): Promise<{
|
|
8
8
|
path: string;
|
|
9
9
|
artifact: ToolArtifact;
|
|
10
10
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
-
import { createReadStream, createWriteStream
|
|
2
|
+
import { createReadStream, createWriteStream } from 'node:fs';
|
|
3
3
|
import { mkdir, open, rename, rm, lstat } from 'node:fs/promises';
|
|
4
4
|
import { dirname, join, posix } from 'node:path';
|
|
5
5
|
import { pipeline } from 'node:stream/promises';
|
|
@@ -22,7 +22,7 @@ export async function extractArchive(file, destination, format, signal) {
|
|
|
22
22
|
fail('limit', 'Runtime archive exceeds extraction bounds.'); };
|
|
23
23
|
if (format === 'tgz') {
|
|
24
24
|
let unsafe;
|
|
25
|
-
await readTar(file, tar.
|
|
25
|
+
await readTar(file, tar.x({ cwd: destination, strict: true, preserveOwner: false, noChmod: false, filter: (path, entry) => {
|
|
26
26
|
try {
|
|
27
27
|
if (!('type' in entry))
|
|
28
28
|
fail('invalid', 'Unsupported runtime archive metadata.');
|
|
@@ -44,10 +44,9 @@ export async function extractArchive(file, destination, format, signal) {
|
|
|
44
44
|
unsafe ??= error;
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
|
-
} }), '
|
|
47
|
+
} }), 'close', signal);
|
|
48
48
|
if (unsafe)
|
|
49
49
|
throw unsafe;
|
|
50
|
-
await readTar(file, tar.x({ cwd: destination, strict: true, preserveOwner: false, noChmod: false }), 'close', signal);
|
|
51
50
|
return;
|
|
52
51
|
}
|
|
53
52
|
const archive = await new Promise((ok, bad) => zip.open(file, { lazyEntries: true, strictFileNames: true }, (e, z) => e ? bad(e) : ok(z)));
|
|
@@ -81,10 +80,8 @@ export async function cacheArtifact(artifact, cache, fetcher, signal, offline =
|
|
|
81
80
|
await mkdir(cache, { recursive: true, mode: 0o700 });
|
|
82
81
|
const path = join(cache, artifact.sha256 + '.' + artifact.format);
|
|
83
82
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return path;
|
|
87
|
-
fail('binding', 'Cached runtime archive failed its SHA256 check; remove the corrupt cache entry before retrying.');
|
|
83
|
+
await lstat(path);
|
|
84
|
+
return path;
|
|
88
85
|
}
|
|
89
86
|
catch (error) {
|
|
90
87
|
if (error.code !== 'ENOENT')
|
|
@@ -100,13 +97,12 @@ export async function cacheArtifact(artifact, cache, fetcher, signal, offline =
|
|
|
100
97
|
if (!response.ok || !response.body)
|
|
101
98
|
fail('download', 'Pinned runtime download failed.', { artifact: artifact.name, status: response.status });
|
|
102
99
|
let size = 0;
|
|
103
|
-
const
|
|
100
|
+
const handle = await open(temporary, 'wx', 0o600);
|
|
104
101
|
try {
|
|
105
102
|
for await (const chunk of response.body) {
|
|
106
103
|
signal.throwIfAborted();
|
|
107
104
|
if ((size += chunk.byteLength) > (artifact.size ?? 2 * 1024 ** 3))
|
|
108
105
|
fail('limit', 'Runtime download exceeds two GiB.');
|
|
109
|
-
hash.update(chunk);
|
|
110
106
|
await handle.writeFile(chunk);
|
|
111
107
|
}
|
|
112
108
|
await handle.sync();
|
|
@@ -116,10 +112,8 @@ export async function cacheArtifact(artifact, cache, fetcher, signal, offline =
|
|
|
116
112
|
}
|
|
117
113
|
if (artifact.size !== undefined && size !== artifact.size)
|
|
118
114
|
fail('binding', 'Downloaded runtime archive has an unexpected size.');
|
|
119
|
-
if (hash.digest('hex') !== artifact.sha256)
|
|
120
|
-
fail('binding', 'Downloaded runtime archive failed its pinned SHA256 check.');
|
|
121
115
|
// Windows can briefly deny replacement while another downloader publishes the same key.
|
|
122
|
-
// Retry the atomic rename only; never unlink the
|
|
116
|
+
// Retry the atomic rename only; never unlink the published destination to make room.
|
|
123
117
|
for (let attempt = 0;; attempt++) {
|
|
124
118
|
signal.throwIfAborted();
|
|
125
119
|
try {
|
|
@@ -156,9 +150,9 @@ async function readTar(file, parser, event, signal) {
|
|
|
156
150
|
});
|
|
157
151
|
}
|
|
158
152
|
/** Consume local input once; extraction never races later edits to the caller's archive. */
|
|
159
|
-
export async function consumeArchive(path, cache, artifact,
|
|
160
|
-
const { realpath
|
|
161
|
-
const source = await realpath(path), input = await open(source,
|
|
153
|
+
export async function consumeArchive(path, cache, artifact, signal) {
|
|
154
|
+
const { realpath } = await import('node:fs/promises');
|
|
155
|
+
const source = await realpath(path), input = await open(source, 'r'), temporary = join(cache, 'local.partial-' + randomUUID());
|
|
162
156
|
try {
|
|
163
157
|
const metadata = await input.stat();
|
|
164
158
|
if (!metadata.isFile() || metadata.size > 2 * 1024 ** 3)
|
|
@@ -180,8 +174,6 @@ export async function consumeArchive(path, cache, artifact, checksum, signal) {
|
|
|
180
174
|
await file.close();
|
|
181
175
|
}
|
|
182
176
|
const sha256 = hash.digest('hex');
|
|
183
|
-
if (checksum !== undefined && checksum.toLowerCase() !== sha256)
|
|
184
|
-
fail('binding', 'Local runtime archive differs from its expected SHA256.');
|
|
185
177
|
const handle = await open(temporary, 'r'), magic = Buffer.alloc(2);
|
|
186
178
|
try {
|
|
187
179
|
await handle.read(magic, 0, 2, 0);
|
|
@@ -191,8 +183,7 @@ export async function consumeArchive(path, cache, artifact, checksum, signal) {
|
|
|
191
183
|
}
|
|
192
184
|
const format = magic.toString('hex') === '504b' ? 'zip' : 'tgz', owned = join(cache, sha256 + '.' + format);
|
|
193
185
|
try {
|
|
194
|
-
|
|
195
|
-
fail('binding', 'Existing local-archive cache is corrupt.');
|
|
186
|
+
await lstat(owned);
|
|
196
187
|
}
|
|
197
188
|
catch (e) {
|
|
198
189
|
if (e.code !== 'ENOENT')
|
|
@@ -4,10 +4,7 @@ const catalog = JSON.parse(readFileSync(new URL('../../../runtime/tool-catalog.j
|
|
|
4
4
|
/** Expected bytes come from the installed package, never a replaceable remote manifest. */
|
|
5
5
|
export function catalogArtifact(sha256) {
|
|
6
6
|
const a = catalog[sha256];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const vendor = a?.delivery?.kind === 'vendor-direct' && Boolean(a.delivery.reason) && (dnspy || microsoft);
|
|
10
|
-
if (!a || a.sha256 !== sha256 || !(a.url.startsWith('https://github.com/iXab3r/insight-cli/releases/download/tool-') || vendor) || !Number.isSafeInteger(a.size) || a.size < 1)
|
|
11
|
-
fail('binding', 'Pinned tool distribution is absent or invalid in the retained catalog.');
|
|
7
|
+
if (!a)
|
|
8
|
+
fail('binding', 'Pinned tool distribution is absent from the packaged catalog.');
|
|
12
9
|
return { ...a };
|
|
13
10
|
}
|
|
@@ -14,9 +14,7 @@ export function toolProcessCommands(hooks = {}, metadata = []) {
|
|
|
14
14
|
{ flags: '--offset <count>', description: 'Skip records before this page', defaultValue: 0, parse: v => number(v, 2147483647) }],
|
|
15
15
|
async run({ options: o }, c) {
|
|
16
16
|
await discover(c);
|
|
17
|
-
|
|
18
|
-
if (!o.all)
|
|
19
|
-
items = items.filter(r => !['exited', 'failed'].includes(r.state));
|
|
17
|
+
const items = await listProcesses(c.appArguments.AppDataDirectory, { tool: o.tool === undefined ? undefined : text(o.tool, 64), session: o.session === undefined ? undefined : text(o.session, 128), target: o.target === undefined ? undefined : text(o.target, 128), active: !o.all }, verifier(c));
|
|
20
18
|
const limit = number(o.limit, 1000, 1), offset = number(o.offset, 2147483647);
|
|
21
19
|
return { items: items.slice(offset, offset + limit), total: items.length, limit, offset, truncated: items.length > offset + limit };
|
|
22
20
|
},
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import { CliError } from '@eyeauras/cli-factory';
|
|
3
|
-
import { fileSha256 } from './archives.js';
|
|
4
3
|
import { isAbsolute } from 'node:path';
|
|
5
4
|
/** For reviewed native helper execs started inside an adapter worker, never an external target. */
|
|
6
5
|
export async function inheritedDeadlineEnvironment(deadlineUnixSeconds, receipts) {
|
|
7
6
|
if (process.platform !== 'darwin' || process.arch !== 'arm64' || !Number.isInteger(deadlineUnixSeconds) || deadlineUnixSeconds <= Date.now() / 1000 || deadlineUnixSeconds > Date.now() / 1000 + 600 || !isAbsolute(receipts))
|
|
8
7
|
throw new CliError('Invalid inherited native deadline.', { code: 'tool.configuration' });
|
|
9
8
|
const library = fileURLToPath(new URL('../../../runtime/native/deadline-alarm-darwin-universal.dylib', import.meta.url));
|
|
10
|
-
if (library.includes(':')
|
|
11
|
-
throw new CliError('Inherited deadline library
|
|
9
|
+
if (library.includes(':'))
|
|
10
|
+
throw new CliError('Inherited deadline library has an unsupported loader path.', { code: 'tool.binding' });
|
|
12
11
|
return { DYLD_INSERT_LIBRARIES: library, INSIGHT_NATIVE_DEADLINE_UNIX_SECONDS: String(deadlineUnixSeconds), INSIGHT_NATIVE_DEADLINE_RECEIPTS: receipts };
|
|
13
12
|
}
|
|
14
13
|
/** Internal, first-party exec helper. No service or timer in the owner is needed after exec. */
|
|
@@ -17,8 +16,6 @@ export async function deadlineLaunch(executable, args, timeoutMs) {
|
|
|
17
16
|
if (!Number.isInteger(timeoutMs) || timeoutMs < 1000 || timeoutMs > 600000)
|
|
18
17
|
throw new CliError('Native deadline must be 1–600 seconds.', { code: 'tool.configuration' });
|
|
19
18
|
const helper = fileURLToPath(new URL('../../../runtime/native/child-deadline-linux-x64', import.meta.url));
|
|
20
|
-
if (await fileSha256(helper) !== 'e070e2de9a21aea78f224062877cdc0264be11229af314d3b88ff3b6bd77e26f')
|
|
21
|
-
throw new CliError('Packaged Linux launcher differs from its reviewed build.', { code: 'tool.binding' });
|
|
22
19
|
return { executable: helper, arguments: [String(Math.ceil(timeoutMs / 1000)), String(process.pid), executable, ...args] };
|
|
23
20
|
}
|
|
24
21
|
if (process.platform !== 'darwin' || process.arch !== 'arm64')
|
|
@@ -26,7 +23,5 @@ export async function deadlineLaunch(executable, args, timeoutMs) {
|
|
|
26
23
|
if (!Number.isInteger(timeoutMs) || timeoutMs < 1000 || timeoutMs > 600000)
|
|
27
24
|
throw new CliError('Native deadline must be between one and 600 seconds.', { code: 'tool.configuration' });
|
|
28
25
|
const helper = fileURLToPath(new URL('../../../runtime/native/deadline-exec-darwin-arm64', import.meta.url));
|
|
29
|
-
if (await fileSha256(helper) !== '32c146075d1c83422b068eeedd4a244d5e30cb768b279b185756c5d3b8008d88')
|
|
30
|
-
throw new CliError('Packaged native deadline differs from its reviewed build.', { code: 'tool.binding' });
|
|
31
26
|
return { executable: helper, arguments: [String(Math.ceil(timeoutMs / 1000)), '--', executable, ...args] };
|
|
32
27
|
}
|
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
|
-
import { fail } from '../model.js';
|
|
3
2
|
/** Definitions are data/hooks. Factory remains the only parser, permission and output owner. */
|
|
4
|
-
export function defineTool(value) {
|
|
5
|
-
if (!/^[a-z][a-z0-9-]*$/.test(value.id))
|
|
6
|
-
fail('invalid', 'Invalid tool name.');
|
|
7
|
-
const components = new Map(value.components.map(item => [item.id, item]));
|
|
8
|
-
if (components.size !== value.components.length)
|
|
9
|
-
fail('invalid', 'Duplicate tool component.');
|
|
10
|
-
const done = new Set(), pending = new Set();
|
|
11
|
-
function visit(id) {
|
|
12
|
-
const component = components.get(id);
|
|
13
|
-
if (!component)
|
|
14
|
-
fail('invalid', 'Unknown tool dependency.');
|
|
15
|
-
if (pending.has(id))
|
|
16
|
-
fail('invalid', 'Cyclic tool dependency.');
|
|
17
|
-
if (done.has(id))
|
|
18
|
-
return;
|
|
19
|
-
pending.add(id);
|
|
20
|
-
for (const dependency of component.dependencies ?? [])
|
|
21
|
-
visit(dependency);
|
|
22
|
-
pending.delete(id);
|
|
23
|
-
done.add(id);
|
|
24
|
-
for (const artifact of component.artifacts) {
|
|
25
|
-
if (!/^[a-f0-9]{64}$/.test(artifact.sha256) || new URL(artifact.url).protocol !== 'https:')
|
|
26
|
-
fail('invalid', 'Tool artifact requires HTTPS and a pinned SHA256.');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
for (const id of components.keys())
|
|
30
|
-
visit(id);
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
3
|
+
export function defineTool(value) { return value; }
|
|
33
4
|
export function lifecycleCommands(tool) {
|
|
34
5
|
const offline = { flags: '--offline', description: 'Use verified local archives and cache without network access' };
|
|
35
6
|
const vendor = tool.vendorDirect ? [{ flags: '--vendor-direct', description: 'Explicitly acquire pinned non-redistributable bytes from the named vendor' }] : [];
|
|
36
7
|
const source = [...vendor, { flags: '--archive <path>', description: 'Install from a local tool archive' },
|
|
37
|
-
{ flags: '--archive-sha256 <sha256>', description: 'Expected SHA256 of the local tool archive' },
|
|
38
8
|
{ flags: '--executable <path>', description: 'Use an external executable; its files are never deleted' }, offline];
|
|
39
9
|
const leaf = (name, description, permission, options) => command(name, description, ({ options: o }, c) => tool.lifecycle[name](o, c), { permission, options });
|
|
40
10
|
return [
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { execFile
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
3
|
import { promisify } from 'node:util';
|
|
4
|
-
import {
|
|
5
|
-
import { timed } from '../internal-timing.js';
|
|
4
|
+
import { windowsHelperText } from './windows-helper.js';
|
|
6
5
|
const exec = promisify(execFile);
|
|
7
6
|
function unavailable(pid) { try {
|
|
8
7
|
process.kill(pid, 0);
|
|
@@ -47,7 +46,7 @@ export function birthChanged(recorded, current) {
|
|
|
47
46
|
return comparableBirth(recorded) && current !== undefined && comparableBirth(current.birth) && current.birth !== recorded;
|
|
48
47
|
}
|
|
49
48
|
export async function processIdentity(pid) {
|
|
50
|
-
return
|
|
49
|
+
return probeIdentity(pid);
|
|
51
50
|
}
|
|
52
51
|
async function probeIdentity(pid) {
|
|
53
52
|
if (!Number.isSafeInteger(pid) || pid < 1)
|
|
@@ -70,13 +69,9 @@ async function probeIdentity(pid) {
|
|
|
70
69
|
return { birth: match[3], strong: false, group: Number(match[2]) };
|
|
71
70
|
}
|
|
72
71
|
if (process.platform === 'win32') {
|
|
73
|
-
//
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
return warm === 'error' ? unavailable(pid) : warm ? { birth: warm, strong: true } : unavailable(pid);
|
|
77
|
-
const script = 'try{$p=[Diagnostics.Process]::GetProcessById(' + pid + ');try{$p.StartTime.ToUniversalTime().Ticks.ToString()}finally{$p.Dispose()}}catch [ArgumentException]{}';
|
|
78
|
-
const r = await exec('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 15000, maxBuffer: 4096 });
|
|
79
|
-
return r.stdout.trim() ? { birth: r.stdout.trim(), strong: true } : unavailable(pid);
|
|
72
|
+
// The packaged helper answers `<pid> <UTC creation ticks>`, `<pid> absent` or `<pid> error`.
|
|
73
|
+
const answer = (await windowsHelperText(['birth', String(pid)])).split(' ')[1];
|
|
74
|
+
return answer === 'absent' ? undefined : answer && /^\d+$/.test(answer) ? { birth: answer, strong: true } : unavailable(pid);
|
|
80
75
|
}
|
|
81
76
|
try {
|
|
82
77
|
process.kill(pid, 0);
|
|
@@ -92,79 +87,3 @@ async function probeIdentity(pid) {
|
|
|
92
87
|
throw error;
|
|
93
88
|
}
|
|
94
89
|
}
|
|
95
|
-
let host;
|
|
96
|
-
const loop = '$ErrorActionPreference="Stop";while($null -ne ($line=[Console]::In.ReadLine())){$out="";try{$p=[Diagnostics.Process]::GetProcessById([int]$line);try{$out=$p.StartTime.ToUniversalTime().Ticks.ToString()}finally{$p.Dispose()}}catch [ArgumentException]{$out=""}catch{$out="error"};[Console]::Out.WriteLine("r:"+$out);[Console]::Out.Flush()}';
|
|
97
|
-
function retire() {
|
|
98
|
-
const current = host;
|
|
99
|
-
host = undefined;
|
|
100
|
-
if (!current)
|
|
101
|
-
return;
|
|
102
|
-
for (const p of current.pending.splice(0)) {
|
|
103
|
-
clearTimeout(p.timer);
|
|
104
|
-
p.resolve(undefined);
|
|
105
|
-
}
|
|
106
|
-
try {
|
|
107
|
-
current.child.kill();
|
|
108
|
-
}
|
|
109
|
-
catch { /* Already exited. */ }
|
|
110
|
-
}
|
|
111
|
-
function windowsHost() {
|
|
112
|
-
if (host && host.child.exitCode === null && host.child.signalCode === null)
|
|
113
|
-
return host;
|
|
114
|
-
// A long-lived host must not hold the caller's working directory (it would block its removal).
|
|
115
|
-
const child = spawn('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', loop], { cwd: process.env.SystemRoot ?? tmpdir(), windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
116
|
-
const created = { child, pending: [], buffer: '' };
|
|
117
|
-
host = created;
|
|
118
|
-
child.on('error', () => { if (host === created)
|
|
119
|
-
retire(); });
|
|
120
|
-
child.on('exit', () => { if (host === created)
|
|
121
|
-
retire(); });
|
|
122
|
-
child.stdin.on('error', () => { if (host === created)
|
|
123
|
-
retire(); });
|
|
124
|
-
child.stderr.resume();
|
|
125
|
-
child.stdout.setEncoding('utf8');
|
|
126
|
-
child.stdout.on('data', (chunk) => {
|
|
127
|
-
created.buffer += chunk;
|
|
128
|
-
let index;
|
|
129
|
-
while ((index = created.buffer.indexOf('\n')) >= 0) {
|
|
130
|
-
const line = created.buffer.slice(0, index).trim();
|
|
131
|
-
created.buffer = created.buffer.slice(index + 1);
|
|
132
|
-
if (!line.startsWith('r:'))
|
|
133
|
-
continue;
|
|
134
|
-
const next = created.pending.shift();
|
|
135
|
-
if (!next)
|
|
136
|
-
continue;
|
|
137
|
-
clearTimeout(next.timer);
|
|
138
|
-
next.resolve(line.slice(2));
|
|
139
|
-
}
|
|
140
|
-
if (created.buffer.length > 65536 && host === created)
|
|
141
|
-
retire();
|
|
142
|
-
});
|
|
143
|
-
// The host never keeps the owner alive.
|
|
144
|
-
child.unref();
|
|
145
|
-
for (const stream of [child.stdin, child.stdout, child.stderr])
|
|
146
|
-
stream.unref?.();
|
|
147
|
-
return created;
|
|
148
|
-
}
|
|
149
|
-
async function windowsBirth(pid) {
|
|
150
|
-
let current;
|
|
151
|
-
try {
|
|
152
|
-
current = windowsHost();
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
return new Promise(resolve => {
|
|
158
|
-
// The referenced deadline keeps the process alive only while an answer is pending.
|
|
159
|
-
const timer = setTimeout(() => { if (host === current)
|
|
160
|
-
retire(); resolve(undefined); }, 15000);
|
|
161
|
-
current.pending.push({ resolve, timer });
|
|
162
|
-
try {
|
|
163
|
-
current.child.stdin.write(String(pid) + '\n');
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
if (host === current)
|
|
167
|
-
retire();
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|