@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
|
@@ -1,18 +1,27 @@
|
|
|
1
|
+
// `insight-cli work`: the shared reconstruction ledger on the hub. Every command is one hub request;
|
|
2
|
+
// files are uploaded as hub blobs first. There is no local ledger: an unreachable hub fails with hub.unavailable.
|
|
1
3
|
import { command, Permission } from '@eyeauras/cli-factory';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { mkdir, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises';
|
|
6
|
+
import { tmpdir } from 'node:os';
|
|
7
|
+
import { createHash } from 'node:crypto';
|
|
8
|
+
import { Artifacts } from '../artifacts.js';
|
|
9
|
+
import { analysisDirectory } from '../analysis-storage.js';
|
|
10
|
+
import { cacheBase } from '../analysis-default.js';
|
|
11
|
+
import { localPaths } from '../core/layout.js';
|
|
12
|
+
import { connectHub } from '../hub/client.js';
|
|
13
|
+
import { ledgerDigest } from '../hub/ledger-store.js';
|
|
14
|
+
import { array, discoverLimits, discoverScope, fail, identifier, integer, object, parseLease, rva, sha, string } from './model.js';
|
|
5
15
|
import { packageVersion } from '../package-version.js';
|
|
6
|
-
import { WorkStore } from './store.js';
|
|
7
16
|
import { saveDashboard } from './dashboard.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const file = { flags: '--file <path>', description: 'Bounded JSON input
|
|
17
|
+
import { WorkHubs, hubProjectName } from './client.js';
|
|
18
|
+
import { legacyRows } from './legacy.js';
|
|
19
|
+
const project = { flags: '--project <id>', description: 'Work project in the profile hub project', required: true };
|
|
20
|
+
const file = { flags: '--file <path>', description: 'Bounded JSON input, uploaded to the hub before use', required: true };
|
|
12
21
|
const task = { flags: '--task <id>', description: 'Assigned work item', required: true };
|
|
13
22
|
const worker = { flags: '--worker <id>', description: 'Cooperative worker label, not authenticated identity', required: true };
|
|
14
23
|
const fence = { flags: '--fence <n>', description: 'Current monotonic lease fence', required: true };
|
|
15
|
-
const ttl = { flags: '--ttl <seconds>', description: 'Lease lifetime, 30..3600 seconds', defaultValue: 600 };
|
|
24
|
+
const ttl = { flags: '--ttl <seconds>', description: 'Lease lifetime on the hub clock, 30..3600 seconds', defaultValue: 600 };
|
|
16
25
|
const revision = { flags: '--expect-revision <n>', description: 'Observed revision; only intervening planning changes conflict', required: true };
|
|
17
26
|
const epoch = { flags: '--epoch <id>', description: 'Optional project incarnation from brief; a mismatch is rejected' };
|
|
18
27
|
const leaseOption = { flags: '--lease <token>', description: 'Lease token from work next/claim; replaces --task, --worker, --fence and --epoch' };
|
|
@@ -49,32 +58,23 @@ function traversalOf(o) {
|
|
|
49
58
|
return discoverScope(o);
|
|
50
59
|
}
|
|
51
60
|
const pageLimit = { flags: '--limit <n>', description: 'Maximum rows (1..1000)', defaultValue: 100 };
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
fail('limit', `An ordinary nonempty file of at most ${max} bytes is required.`);
|
|
56
|
-
const artifact = await workspace.artifacts.capture(path, 'input', max);
|
|
57
|
-
if (artifact.size > max)
|
|
58
|
-
fail('limit', 'Captured input exceeds this command limit.');
|
|
59
|
-
return { ...artifact, name: basename(path) };
|
|
60
|
-
}
|
|
61
|
-
async function json(workspace, path, max = 8 * 1024 * 1024) {
|
|
62
|
-
const artifact = await capture(workspace, path, max);
|
|
63
|
-
const saved = workspace.artifacts.path({ ...artifact, kind: 'input' });
|
|
64
|
-
let value;
|
|
61
|
+
const list = (value) => value === undefined ? undefined : string(value, 16000).split(',');
|
|
62
|
+
const optionalEpoch = (o) => o.epoch === undefined ? undefined : identifier(o.epoch);
|
|
63
|
+
async function readJson(path) {
|
|
65
64
|
try {
|
|
66
|
-
|
|
65
|
+
return JSON.parse(await readFile(path, 'utf8'));
|
|
67
66
|
}
|
|
68
|
-
catch {
|
|
69
|
-
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (error.code === 'ENOENT')
|
|
69
|
+
fail('notFound', 'Input file does not exist: ' + path);
|
|
70
|
+
return fail('invalid', 'Input must be valid UTF-8 JSON.');
|
|
70
71
|
}
|
|
71
|
-
return { value, artifact };
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Writes a new directory with the retained source/contract of every assigned function and a manifest
|
|
75
75
|
* skeleton whose paths are relative to it. Review manifests leave approved=null; it must be decided.
|
|
76
76
|
*/
|
|
77
|
-
async function materialize(
|
|
77
|
+
async function materialize(ledger, handoff, directory) {
|
|
78
78
|
await mkdir(directory, { recursive: false });
|
|
79
79
|
const task = handoff.task, files = [], rows = [];
|
|
80
80
|
if (task.kind === 'discover') {
|
|
@@ -82,7 +82,7 @@ async function materialize(w, handoff, directory) {
|
|
|
82
82
|
const manifest = resolve(directory, 'discovery-report.json');
|
|
83
83
|
await writeFile(manifest, JSON.stringify({ schema: 1, kind: 'discovery-report', task: task.id, binarySha256: handoff.project.binarySha256,
|
|
84
84
|
discover: task.discover, model: { source: 'ghidra', revision: null },
|
|
85
|
-
visited: handoff.functions.map(fn => ({ function: fn.id, name: fn.name, depth: 0, xrefs: { source: null, complete: null } })),
|
|
85
|
+
visited: handoff.functions.map((fn) => ({ function: fn.id, name: fn.name, depth: 0, xrefs: { source: null, complete: null } })),
|
|
86
86
|
edges: [], frontier: [], summary: null, recommended: [] }, null, 1) + '\n', { flag: 'wx' });
|
|
87
87
|
return { directory, manifest, files: 0, next: 'Fill model, visited, edges, frontier and summary within discover, then: work submit --lease LEASE --file ' + manifest };
|
|
88
88
|
}
|
|
@@ -93,7 +93,7 @@ async function materialize(w, handoff, directory) {
|
|
|
93
93
|
if (!attachment)
|
|
94
94
|
return undefined;
|
|
95
95
|
const target = resolve(folder, name);
|
|
96
|
-
await
|
|
96
|
+
await ledger.download(attachment, target);
|
|
97
97
|
files.push(target);
|
|
98
98
|
return label + '/' + name;
|
|
99
99
|
};
|
|
@@ -127,188 +127,162 @@ async function materialize(w, handoff, directory) {
|
|
|
127
127
|
: 'Write each .cpp and .contract.json named in the manifest (rework: read <rva>/rework-reason.json and previous-review.md first), '
|
|
128
128
|
+ 'then: work submit --lease LEASE --file ' + manifest };
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Uploads the legacy profile ledger's attachments and rows into the profile hub project. The profile workspace is only
|
|
132
|
+
* read: its ledger is opened read-only and its workspace database is not opened at all. Missing attachments refuse the
|
|
133
|
+
* import unless `allowMissing` accepts them.
|
|
134
|
+
*/
|
|
135
|
+
async function importLegacy(ledger, directory, dryRun, allowMissing = false) {
|
|
136
|
+
const source = join(directory, 'work.sqlite'), legacy = legacyRows(source, ledger.project.id), artifacts = new Artifacts(directory);
|
|
137
|
+
const present = [], missing = [];
|
|
138
|
+
for (const a of legacy.attachments) {
|
|
139
|
+
const path = artifacts.path({ id: a.id, kind: 'input', sha256: a.sha256, size: a.size });
|
|
140
|
+
const ok = await stat(path).then(s => s.isFile(), () => false);
|
|
141
|
+
(ok ? present : missing).push(a);
|
|
142
|
+
}
|
|
143
|
+
const counts = Object.fromEntries(Object.entries(legacy.rows).map(([t, r]) => [t, r.length]));
|
|
144
|
+
const summary = { source, hubProject: ledger.project, counts, attachments: { present: present.length, missing: missing.map(a => ({ sha256: a.sha256, size: a.size, name: a.name })) },
|
|
145
|
+
sourceKept: 'The profile ledger file is not changed or removed.' };
|
|
146
|
+
if (dryRun) {
|
|
147
|
+
// Only a dry run compares: the import itself converges or refuses a conflict in the hub.
|
|
148
|
+
const current = await ledger.call('ledger-digest');
|
|
149
|
+
const state = current.empty ? 'import' : current.sha256 === ledgerDigest(legacy.rows) ? 'unchanged' : 'conflict';
|
|
150
|
+
if (state === 'conflict')
|
|
151
|
+
fail('conflict', 'Hub project ' + ledger.project.name + ' already has other ledger data; the profile ledger is not merged into it.', { source, hubProject: ledger.project });
|
|
152
|
+
return { dryRun: true, state, ...summary };
|
|
153
|
+
}
|
|
154
|
+
if (missing.length && !allowMissing)
|
|
155
|
+
fail('notFound', `${missing.length} ledger attachment(s) are missing from ${join(directory, 'artifacts')}: ${missing.map(a => a.name + ' (' + a.sha256 + ')').join(', ')}. Restore them, or import without them with --allow-missing.`, { missing: summary.attachments.missing });
|
|
156
|
+
for (const a of present)
|
|
157
|
+
await ledger.hub.putBlob(a.sha256, artifacts.path({ id: a.id, kind: 'input', sha256: a.sha256, size: a.size }));
|
|
158
|
+
const temporary = await mkdtemp(join(tmpdir(), 'insight-ledger-import-'));
|
|
159
|
+
try {
|
|
160
|
+
const bundle = join(temporary, 'ledger.json');
|
|
161
|
+
await writeFile(bundle, JSON.stringify({ schema: 1, kind: 'insight-ledger', tables: legacy.rows }), { flag: 'wx' });
|
|
162
|
+
const result = await ledger.call('import-ledger', { artifact: await ledger.upload(bundle, 1024 * 1024 * 1024) });
|
|
163
|
+
return { dryRun: false, state: result.state === 'imported' ? 'imported' : 'unchanged', ...summary };
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
await rm(temporary, { recursive: true, force: true });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** `connect` is the hub seam; production uses connectHub. The workspace keeps dashboards and the legacy profile ledger. */
|
|
170
|
+
export function workCommands(access, connect = connectHub) {
|
|
171
|
+
// One hub client and ledger per installation, client user and hub project, kept across the commands of this owner.
|
|
172
|
+
const hubs = new WorkHubs(connect);
|
|
173
|
+
// Reads use an existing hub project only: creating one needs Ghidra Server, which a read must never require.
|
|
174
|
+
const call = (c, operation, body) => hubs.read(c).then(l => l.call(operation, body));
|
|
175
|
+
const read = (name, description, options, body) => command(name, description, ({ options: o }, c) => call(c, name, body(o)), { permission: Permission.ReadOnly, options });
|
|
176
|
+
const changing = (name, description, options, prepare, operation = name) => command(name, description, async ({ options: o }, c) => {
|
|
177
|
+
const ledger = await hubs.open(c), prepared = await prepare(ledger, o, c), result = await ledger.call(operation, prepared.body);
|
|
178
|
+
const projectId = prepared.project ?? result?.task?.project ?? result?.project?.id;
|
|
143
179
|
// Saved workflow state is authoritative even if the derived view cannot be refreshed.
|
|
144
|
-
let dashboard = { state:
|
|
145
|
-
if (o.refreshDashboard)
|
|
180
|
+
let dashboard = { state: 'deferred', project: projectId ?? null };
|
|
181
|
+
if (o.refreshDashboard && projectId)
|
|
146
182
|
try {
|
|
147
|
-
dashboard = await saveDashboard(w,
|
|
183
|
+
dashboard = await access(c, w => saveDashboard(w, () => ledger.call('brief', { project: projectId, limit: 200 }), projectId));
|
|
148
184
|
}
|
|
149
185
|
catch (error) {
|
|
150
186
|
dashboard = { state: 'stale', message: error instanceof Error ? error.message : 'View unavailable; rerun work dashboard' };
|
|
151
187
|
}
|
|
152
188
|
return { result, dashboard };
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
command('timing', 'Measure reconstruction and independent review from recorded
|
|
157
|
-
command('context', 'Identify the CLI, profile and selected project', ({ options: o }, c) =>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}),
|
|
172
|
-
changing('
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
command('
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (reservation.request.state === 'failed')
|
|
189
|
-
s.mutate('restore', intent, identifier(o.requestId), () => { throw Error('retained failure'); });
|
|
190
|
-
if (s.request(identifier(o.requestId)).receipt)
|
|
191
|
-
return { result: s.mutate('restore', intent, identifier(o.requestId), () => { throw Error('receipt must replay'); }), cleanup: { state: 'not-needed' } };
|
|
192
|
-
let prepared;
|
|
193
|
-
try {
|
|
194
|
-
prepared = await prepareWorkRestore(s, w, verified);
|
|
195
|
-
}
|
|
196
|
-
catch (error) {
|
|
197
|
-
w.administrationState(reservation.request.id, 'failed', { metadataCommitted: false, stagedImmutableMaterialsMayRemain: true, message: String(error) });
|
|
198
|
-
throw error;
|
|
199
|
-
}
|
|
200
|
-
let result, cleanup;
|
|
201
|
-
try {
|
|
202
|
-
result = s.mutate('restore', intent, identifier(o.requestId), () => s.restoreState(prepared.stage, prepared.targets, prepared.origin));
|
|
203
|
-
}
|
|
204
|
-
finally {
|
|
205
|
-
try {
|
|
206
|
-
await prepared.cleanup();
|
|
207
|
-
cleanup = { state: 'confirmed' };
|
|
208
|
-
}
|
|
209
|
-
catch (error) {
|
|
210
|
-
cleanup = { state: 'incomplete', message: String(error) };
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return { result, cleanup };
|
|
214
|
-
}, false), { permission: Permission.Update, options: [request, { flags: '--directory <path>', description: 'Verified backup; work storage must be empty', required: true }] }),
|
|
215
|
-
command('brief', 'Current consistent overview with bounded rows and explicit limits', ({ options: o }, c) => run(c, s => s.snapshot(identifier(o.project), integer(o.limit, 1, 1000))), { permission: Permission.ReadOnly, options: [project, pageLimit] }),
|
|
216
|
-
command('request', 'Recover a saved work intent and its local transaction receipt', ({ options: o }, c) => run(c, s => s.request(identifier(o.requestId))), { permission: Permission.ReadOnly, options: [request] }),
|
|
217
|
-
command('events', 'Keyset page of durable project events and originating request references', ({ options: o }, c) => run(c, s => s.events(identifier(o.project), integer(o.after, 0, Number.MAX_SAFE_INTEGER), integer(o.limit, 1, 1000))), { permission: Permission.ReadOnly, options: [project, pageLimit, { flags: '--after <seq>', description: 'Exclusive global event sequence', defaultValue: 0 }] }),
|
|
218
|
-
command('export', 'Stream a consistent project checkpoint to a new JSONL file', ({ options: o }, c) => run(c, s => s.export(identifier(o.project), resolve(c.cwd, string(o.output)))), { permission: Permission.ReadOnly, options: [project, { flags: '--output <path>', description: 'New JSONL checkpoint; immutable artifact payloads stay separate', required: true }] }),
|
|
219
|
-
command('functions', 'Keyset page of functions; retain revision when paging', ({ options: o }, c) => run(c, s => s.functions(identifier(o.project), o.afterRva === undefined ? -1 : rva(o.afterRva), integer(o.limit, 1, 1000))), { permission: Permission.ReadOnly, options: [project, pageLimit, { flags: '--after-rva <hex>', description: 'Exclusive RVA cursor, 0x-prefixed' }] }),
|
|
220
|
-
command('graph', 'Keyset page of dependency nodes or edges', ({ options: o }, c) => run(c, s => {
|
|
221
|
-
if (o.kind !== 'nodes' && o.kind !== 'edges')
|
|
222
|
-
fail('invalid', 'Graph kind is nodes or edges.');
|
|
223
|
-
return s.graph(identifier(o.project), o.after === undefined ? '' : string(o.after, 256), integer(o.limit, 1, 1000), o.kind);
|
|
224
|
-
}), { permission: Permission.ReadOnly, options: [project, pageLimit, { flags: '--kind <kind>', description: 'nodes or edges', defaultValue: 'edges' }, { flags: '--after <id>', description: 'Exclusive ID cursor' }] }),
|
|
189
|
+
}, { permission: Permission.Update, options: [...options, { flags: '--refresh-dashboard', description: 'Also regenerate the profile HTML view' }] });
|
|
190
|
+
const upload = (l, c, path, max) => l.upload(resolve(c.cwd, string(path)), max);
|
|
191
|
+
return [command('work', 'Shared strict-reconstruction ledger on the hub: fenced assignments, packages, review and read-only progress views', [
|
|
192
|
+
command('timing', 'Measure reconstruction and independent review from recorded hub events', ({ options: o }, c) => call(c, 'timing', { project: identifier(o.project), tasks: o.tasks === undefined ? undefined : String(o.tasks).split(',') }), { permission: Permission.ReadOnly, options: [project, { flags: '--tasks <ids>', description: 'Comma-separated reconstruction IDs; default latest ten' }] }),
|
|
193
|
+
command('context', 'Identify the CLI, profile, hub project and selected work project', async ({ options: o }, c) => {
|
|
194
|
+
const { hub, ledger } = await hubs.find(c), selected = o.project === undefined ? undefined : identifier(o.project);
|
|
195
|
+
if (!ledger && selected !== undefined)
|
|
196
|
+
fail('notFound', `Hub project ${hubProjectName(c)} does not exist yet, so work project ${selected} does not either.`);
|
|
197
|
+
// Before the first work create the hub project may not exist: hubProject.id is then null.
|
|
198
|
+
return { cliVersion: packageVersion, profile: c.profile.name, hub: hub.url, client: hub.client, hubProject: { id: ledger?.project.id ?? null, name: ledger?.project.name ?? hubProjectName(c) }, workSchema: 3,
|
|
199
|
+
project: ledger ? await ledger.call('context', { project: selected }) : null, registrationOrder: ['import', 'plan', 'claim'], atomicAssignment: 'next' };
|
|
200
|
+
}, { permission: Permission.ReadOnly, options: [{ ...project, required: false }] }),
|
|
201
|
+
command('projects', 'List work projects in the profile hub project', async (_, c) => {
|
|
202
|
+
const { ledger } = await hubs.find(c);
|
|
203
|
+
return { projects: ledger ? await ledger.call('projects', {}) : [] };
|
|
204
|
+
}, { permission: Permission.ReadOnly }),
|
|
205
|
+
changing('create', 'Bind a work project to a hub target', [project, { flags: '--target <id>', required: true, description: 'Hub target id (ghidra targets list)' },
|
|
206
|
+
{ flags: '--name <name>', required: true, description: 'Display name' }], async (l, o) => ({ project: identifier(o.project), body: { project: o.project, target: o.target, name: o.name } })),
|
|
207
|
+
changing('import', 'Add bounded function definitions; never promote unwind regions', [project, file, epoch], async (l, o, c) => ({ project: identifier(o.project), body: { project: o.project, epoch: o.epoch, artifact: await upload(l, c, o.file) } })),
|
|
208
|
+
changing('import-graph', 'Add dependencies; new evidence conservatively invalidates affected scopes', [project, file, epoch], async (l, o, c) => ({ project: identifier(o.project), body: { project: o.project, epoch: o.epoch, artifact: await upload(l, c, o.file) } })),
|
|
209
|
+
changing('revise-definition', 'Retain a definition revision and invalidate affected assignments', [project, functionId, file, epoch, { flags: '--expect-version <n>', description: 'Current function/package version', required: true }], async (l, o, c) => ({ project: identifier(o.project), body: { project: o.project, function: o.function, expectVersion: o.expectVersion, epoch: o.epoch, artifact: await upload(l, c, o.file) } })),
|
|
210
|
+
read('history', 'Page retained package and definition versions', [project, functionId, pageLimit, { flags: '--after-version <n>', description: 'Exclusive retained version', defaultValue: 0 }], o => ({ project: o.project, function: o.function, afterVersion: o.afterVersion, limit: o.limit })),
|
|
211
|
+
command('import-legacy', 'Copy this profile\'s pre-hub ledger into the profile hub project; ids and fences are kept, the source file is untouched', async ({ options: o }, c) => importLegacy(await hubs.open(c), join(analysisDirectory(c), 'workspace'), o.dryRun === true, o.allowMissing === true), { permission: Permission.Update, options: [{ flags: '--dry-run', description: 'Report what would be imported without writing to the hub' },
|
|
212
|
+
{ flags: '--allow-missing', description: 'Import even though some ledger attachments are missing from the profile (they stay missing on the hub)' }] }),
|
|
213
|
+
read('brief', 'Current consistent overview with bounded rows and explicit limits', [project, pageLimit], o => ({ project: o.project, limit: o.limit })),
|
|
214
|
+
read('events', 'Keyset page of project events', [project, pageLimit, { flags: '--after <seq>', description: 'Exclusive project event sequence', defaultValue: 0 }], o => ({ project: o.project, after: o.after, limit: o.limit })),
|
|
215
|
+
command('export', 'Write a consistent project checkpoint to a new JSONL file', async ({ options: o }, c) => {
|
|
216
|
+
const path = resolve(c.cwd, string(o.output)), exported = await call(c, 'export', { project: identifier(o.project) });
|
|
217
|
+
const text = exported.records.map(r => JSON.stringify(r) + '\n').join('');
|
|
218
|
+
await writeFile(path, text, { flag: 'wx', mode: 0o600 });
|
|
219
|
+
return { path, project: exported.project, revision: exported.revision, records: exported.records.length, sha256: createHash('sha256').update(text).digest('hex'),
|
|
220
|
+
artifacts: 'Attachments stay on the hub; work evidence downloads one.' };
|
|
221
|
+
}, { permission: Permission.ReadOnly, options: [project, { flags: '--output <path>', description: 'New JSONL checkpoint; attachment payloads stay on the hub', required: true }] }),
|
|
222
|
+
read('functions', 'Keyset page of functions; retain revision when paging', [project, pageLimit, { flags: '--after-rva <hex>', description: 'Exclusive RVA cursor, 0x-prefixed' }], o => ({ project: o.project, afterRva: o.afterRva === undefined ? undefined : rva(o.afterRva), limit: o.limit })),
|
|
223
|
+
read('graph', 'Keyset page of dependency nodes or edges', [project, pageLimit, { flags: '--kind <kind>', description: 'nodes or edges', defaultValue: 'edges' }, { flags: '--after <id>', description: 'Exclusive ID cursor' }], o => ({ project: o.project, kind: o.kind, after: o.after, limit: o.limit })),
|
|
225
224
|
changing('reopen-review', 'Withdraw the current approval and require another review; retain its history', [project, functionId, epoch,
|
|
226
225
|
{ flags: '--source-sha256 <sha>', description: 'Exact current reconstruction hash', required: true },
|
|
227
226
|
{ flags: '--expect-version <n>', description: 'Observed package version, including its passport', required: true },
|
|
228
|
-
{ flags: '--reason <text>', description: 'Retained evidence/reason for reopening approval', required: true }], async (
|
|
229
|
-
apply: () => s.reopenReview(identifier(o.project), string(o.function, 256), sha(o.sourceSha256), integer(o.expectVersion, 1, Number.MAX_SAFE_INTEGER), string(o.reason, 2000), o.epoch === undefined ? undefined : identifier(o.epoch)) })),
|
|
227
|
+
{ flags: '--reason <text>', description: 'Retained evidence/reason for reopening approval', required: true }], async (l, o) => ({ project: identifier(o.project), body: { project: o.project, function: o.function, sourceSha256: o.sourceSha256, expectVersion: o.expectVersion, reason: o.reason, epoch: o.epoch } })),
|
|
230
228
|
changing('plan', 'Reserve a small nonoverlapping reconstruction or independent-review slice', [project, revision, epoch,
|
|
231
229
|
{ flags: '--count <n>', description: 'Maximum functions, 1..50', defaultValue: 10 }, kindOption,
|
|
232
230
|
{ flags: '--functions <ids>', description: 'Optional comma-separated exact function IDs; for discover, the roots' },
|
|
233
|
-
{ flags: '--after-rva <hex>', description: 'Continue beyond a bounded frontier' }, ...traversal], async (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}),
|
|
238
|
-
changing('claim', 'Claim queued or expired work and obtain a fresh fence', [task, worker, ttl], async (s, w, o, c) => ({ input: o, project: s.handoff(identifier(o.task)).project.id,
|
|
239
|
-
apply: () => s.claim(identifier(o.task), identifier(o.worker), integer(o.ttl, 30, 3600)) })),
|
|
240
|
-
changing('next', 'Plan and claim the next slice atomically; returns a lease token', [project, epoch,
|
|
241
|
-
{ flags: '--worker <id>', description: 'Cooperative worker label, not authenticated identity', required: true }, ttl,
|
|
231
|
+
{ flags: '--after-rva <hex>', description: 'Continue beyond a bounded frontier' }, ...traversal], async (l, o) => ({ project: identifier(o.project), body: { project: o.project, expectRevision: o.expectRevision, count: o.count, kind: o.kind, functions: list(o.functions),
|
|
232
|
+
afterRva: o.afterRva === undefined ? undefined : rva(o.afterRva), epoch: o.epoch, discover: traversalOf(o) } })),
|
|
233
|
+
changing('claim', 'Claim queued or expired work and obtain a fresh fence; claiming your own current lease returns it', [task, worker, ttl], async (l, o) => ({ body: { task: o.task, worker: o.worker, ttl: o.ttl } })),
|
|
234
|
+
changing('next', 'Plan and claim the next slice atomically; returns a lease token', [project, epoch, worker, ttl,
|
|
242
235
|
{ flags: '--count <n>', description: 'Maximum functions, 1..50', defaultValue: 10 }, kindOption,
|
|
243
|
-
{ flags: '--functions <ids>', description: 'Optional exact function IDs, e.g. the retry list of work.taskCancelled; for discover, the roots' }, ...traversal], async (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
const l = leaseOf(o);
|
|
250
|
-
return { input: o, project: s.handoff(l.task).project.id,
|
|
251
|
-
apply: () => s.heartbeat(l.task, l.worker, l.fence, integer(o.ttl, 30, 3600), l.epoch) };
|
|
252
|
-
}),
|
|
253
|
-
changing('release', 'Return a current lease to the queue, keeping its reserved scope', held, async (s, w, o, c) => {
|
|
254
|
-
const l = leaseOf(o);
|
|
255
|
-
return { input: o, project: s.handoff(l.task).project.id,
|
|
256
|
-
apply: () => s.release(l.task, l.worker, l.fence, l.epoch) };
|
|
257
|
-
}),
|
|
258
|
-
changing('cancel', 'Cancel an outstanding task and fence it off before replanning', [task, revision, epoch, { flags: '--reason <text>', description: 'Retained cancellation reason', required: true }], async (s, w, o, c) => ({ input: o, project: s.handoff(identifier(o.task)).project.id,
|
|
259
|
-
apply: () => s.cancel(identifier(o.task), integer(o.expectRevision, 1, Number.MAX_SAFE_INTEGER), string(o.reason, 2000), o.epoch === undefined ? undefined : identifier(o.epoch)) })),
|
|
260
|
-
command('handoff', 'Exact assigned versions, evidence and lease for a subagent; --materialize writes files and a manifest skeleton', ({ options: o }, c) => run(c, async (s, w) => {
|
|
261
|
-
const result = s.handoff(o.lease !== undefined ? parseLease(o.lease).task : identifier(o.task));
|
|
236
|
+
{ flags: '--functions <ids>', description: 'Optional exact function IDs, e.g. the retry list of work.taskCancelled; for discover, the roots' }, ...traversal], async (l, o) => ({ project: identifier(o.project), body: { project: o.project, worker: o.worker, count: o.count, kind: o.kind, ttl: o.ttl, epoch: o.epoch, functions: list(o.functions), discover: traversalOf(o) } })),
|
|
237
|
+
changing('heartbeat', 'Extend a still-current lease on the hub clock', [...held, ttl], async (l, o) => ({ body: { ...leaseOf(o), ttl: o.ttl } })),
|
|
238
|
+
changing('release', 'Return a current lease to the queue, keeping its reserved scope', held, async (l, o) => ({ body: leaseOf(o) })),
|
|
239
|
+
changing('cancel', 'Cancel an outstanding task and fence it off before replanning', [task, revision, epoch, { flags: '--reason <text>', description: 'Retained cancellation reason', required: true }], async (l, o) => ({ body: { task: o.task, expectRevision: o.expectRevision, reason: o.reason, epoch: o.epoch } })),
|
|
240
|
+
command('handoff', 'Exact assigned versions, evidence and lease for a subagent; --materialize writes files and a manifest skeleton', async ({ options: o }, c) => {
|
|
241
|
+
const ledger = await hubs.read(c), result = await ledger.call('handoff', { task: o.lease !== undefined ? parseLease(o.lease).task : identifier(o.task) });
|
|
262
242
|
if (o.materialize === undefined)
|
|
263
243
|
return result;
|
|
264
|
-
return { ...result, materialized: await materialize(
|
|
265
|
-
}
|
|
244
|
+
return { ...result, materialized: await materialize(ledger, result, resolve(c.cwd, string(o.materialize, 4096))) };
|
|
245
|
+
}, { permission: Permission.ReadOnly, options: [{ ...task, required: false }, leaseOption,
|
|
266
246
|
{ flags: '--materialize <dir>', description: 'New directory: retained source/contract per function plus a ready submission or review manifest' }] }),
|
|
267
|
-
changing('submit', 'Retain exact reconstruction source and passport for the whole leased slice, or the discovery report of a discover task', [...held, file], async (
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return { input: { task: o.task, worker: o.worker, fence: o.fence, epoch: o.epoch, lease: o.lease, report: manifest.artifact }, project: s.handoff(l.task).project.id,
|
|
272
|
-
apply: () => s.submitDiscovery(l.task, l.worker, l.fence, manifest.value, manifest.artifact, l.epoch) };
|
|
273
|
-
}
|
|
247
|
+
changing('submit', 'Retain exact reconstruction source and passport for the whole leased slice, or the discovery report of a discover task', [...held, file], async (l, o, c) => {
|
|
248
|
+
const lease = leaseOf(o), path = resolve(c.cwd, string(o.file)), manifest = object(await readJson(path));
|
|
249
|
+
if (manifest.kind === 'discovery-report')
|
|
250
|
+
return { body: { ...lease, report: await l.upload(path, discoverLimits.reportBytes) } };
|
|
274
251
|
const entries = [];
|
|
275
|
-
for (const
|
|
276
|
-
const row = object(value)
|
|
277
|
-
|
|
278
|
-
entries.push({ id: string(row.id, 256), source, contract: contract.artifact, passport: passport(contract.value, `functions[${index}].contract`) });
|
|
252
|
+
for (const value of array(manifest.functions, 50)) {
|
|
253
|
+
const row = object(value);
|
|
254
|
+
entries.push({ id: string(row.id, 256), source: await l.upload(resolve(dirname(path), string(row.source)), 16 * 1024 * 1024), contract: await l.upload(resolve(dirname(path), string(row.contract))) });
|
|
279
255
|
}
|
|
280
|
-
return {
|
|
281
|
-
apply: () => s.submit(l.task, l.worker, l.fence, entries, l.epoch) };
|
|
256
|
+
return { body: { ...lease, entries } };
|
|
282
257
|
}),
|
|
283
|
-
changing('review', 'Submit a separate reviewer decision bound to current source hashes', [...held, file], async (
|
|
284
|
-
const
|
|
285
|
-
for (const value of array(object(
|
|
258
|
+
changing('review', 'Submit a separate reviewer decision bound to current source hashes', [...held, file], async (l, o, c) => {
|
|
259
|
+
const lease = leaseOf(o), path = resolve(c.cwd, string(o.file)), entries = [];
|
|
260
|
+
for (const value of array(object(await readJson(path)).functions, 50)) {
|
|
286
261
|
const row = object(value);
|
|
287
262
|
if (typeof row.approved !== 'boolean')
|
|
288
263
|
fail('invalid', 'approved must be a JSON boolean (replace the null left by handoff --materialize).', { field: 'functions[].approved', id: row.id });
|
|
289
|
-
entries.push({ id: string(row.id, 256), sourceSha256: sha(row.sourceSha256), approved: row.approved,
|
|
290
|
-
note: await capture(w, resolve(dirname(path), string(row.note)), 2 * 1024 * 1024) });
|
|
264
|
+
entries.push({ id: string(row.id, 256), sourceSha256: sha(row.sourceSha256), approved: row.approved, note: await l.upload(resolve(dirname(path), string(row.note)), 2 * 1024 * 1024) });
|
|
291
265
|
}
|
|
292
|
-
return {
|
|
293
|
-
apply: () => s.review(l.task, l.worker, l.fence, entries, l.epoch) };
|
|
266
|
+
return { body: { ...lease, entries } };
|
|
294
267
|
}),
|
|
295
268
|
changing('compare', 'Compare supplied observation corpora exactly; never certify universal 1:1', [project, epoch,
|
|
296
269
|
{ flags: '--function <id>', description: 'Exact function ID', required: true }, { flags: '--source-sha256 <sha>', description: 'Current reconstruction hash', required: true },
|
|
297
270
|
{ flags: '--original <path>', description: 'Original observations JSON', required: true }, { flags: '--reconstruction <path>', description: 'Reconstruction observations JSON', required: true },
|
|
298
|
-
{ flags: '--layout <path>', description: 'Retained observation-layout JSON named by every outcome hash', required: true }], async (
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
271
|
+
{ flags: '--layout <path>', description: 'Retained observation-layout JSON named by every outcome hash', required: true }], async (l, o, c) => ({ project: identifier(o.project), body: { project: o.project, function: o.function, sourceSha256: o.sourceSha256, epoch: optionalEpoch(o),
|
|
272
|
+
original: await upload(l, c, o.original), reconstruction: await upload(l, c, o.reconstruction), layout: await upload(l, c, o.layout) } })),
|
|
273
|
+
command('certify', 'Fail closed: no supported exhaustive/formal verifier is available', (_, c) => call(c, 'certify', {}), { permission: Permission.Update }),
|
|
274
|
+
command('dashboard', 'Generate a consistent self-contained read-only HTML projection', ({ options: o }, c) => {
|
|
275
|
+
const id = identifier(o.project);
|
|
276
|
+
return access(c, w => saveDashboard(w, () => call(c, 'brief', { project: id, limit: 200 }), id, o.output === undefined ? undefined : resolve(c.cwd, string(o.output))));
|
|
277
|
+
}, { permission: Permission.ReadOnly, options: [project, { flags: '--output <path>', description: 'Optional new snapshot HTML file; existing files are never overwritten' }] }),
|
|
278
|
+
command('evidence', 'Download and locate a retained content-addressed work attachment', async ({ options: o }, c) => {
|
|
279
|
+
const digest = sha(o.sha256), size = integer(o.size, 1, 4 * 1024 * 1024 * 1024);
|
|
280
|
+
const path = localPaths(analysisDirectory(c), cacheBase(c)).blobCache(digest);
|
|
281
|
+
const cached = await stat(path).then(s => s.isFile(), () => false);
|
|
282
|
+
// Blobs belong to the hub, not to a project: no hub project is needed (or created) to download one.
|
|
283
|
+
if (!cached)
|
|
284
|
+
await hubs.download(c, digest, path);
|
|
285
|
+
return { sha256: digest, size, path, hubProject: hubProjectName(c) };
|
|
286
|
+
}, { permission: Permission.ReadOnly, options: [{ flags: '--sha256 <sha>', description: 'Retained attachment hash', required: true }, { flags: '--size <bytes>', description: 'Retained attachment size', required: true }] }),
|
|
313
287
|
])];
|
|
314
288
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Workspace } from '../workspace.js';
|
|
2
2
|
import { type Snapshot } from './model.js';
|
|
3
|
-
import { type WorkStore } from './store.js';
|
|
4
3
|
/** A passive projection: this document has no mutation API, network dependency or evidence promotion. */
|
|
5
4
|
export declare function dashboardHtml(snapshot: Snapshot, live?: boolean): string;
|
|
6
|
-
|
|
5
|
+
/** Writes the hub snapshot of one project into the profile's work-views (machine-local), or to `output`. */
|
|
6
|
+
export declare function saveDashboard(workspace: Workspace, read: () => Promise<Snapshot>, projectId: string, output?: string): Promise<{
|
|
7
7
|
path: string;
|
|
8
8
|
revision: number;
|
|
9
9
|
generatedAt: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join
|
|
1
|
+
import { mkdir, rename, unlink, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import {
|
|
4
|
+
import { identifier } from './model.js';
|
|
5
5
|
const queues = new WeakMap();
|
|
6
6
|
const escape = (value) => value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"');
|
|
7
7
|
/** A passive projection: this document has no mutation API, network dependency or evidence promotion. */
|
|
@@ -17,7 +17,7 @@ export function dashboardHtml(snapshot, live = false) {
|
|
|
17
17
|
@media(max-width:1000px){.content{grid-template-columns:minmax(0,1fr) 270px}.secondary{display:none}.toolbar{flex-wrap:wrap}.scope{display:none}}@media(max-width:760px){.content{display:block}aside{border-left:0;border-top:1px solid var(--line)}.stats{grid-template-columns:repeat(3,1fr)}.stat:nth-child(n+4){border-top:1px solid var(--line)}.stat.strict{border-left:0;padding-left:0}.intro{padding-top:18px}.tabs{gap:22px}.tabs .mode{display:none}header,footer{padding-left:16px;padding-right:16px}header .crumb{display:none}.stats{margin-left:16px;margin-right:16px}.toolbar small{display:none}input{flex:1;width:140px}select{max-width:150px}footer{flex-wrap:wrap}footer span:last-child{margin-left:0}.intro h1{font-size:20px}.app{min-height:700px}}
|
|
18
18
|
</style><div class="app"><header><div class="mark">⌘</div><span class="brand">insight</span><span class="crumb">/ Research ledger</span><span class="rev" id="revision"></span></header>
|
|
19
19
|
<section class="intro"><div><div class="phase">Reverse engineering</div><h1 id="project"></h1><p class="sub" id="identity"></p></div><div class="scope"><div class="eyebrow">Scope</div><p class="sub">Pinned executable<br>Discovery remains open</p></div></section>
|
|
20
|
-
<section class="stats" id="stats"></section><section class="workspace"><nav class="tabs" aria-label="Ledger views"><button data-tab="functions" class="active">Functions</button><button data-tab="tasks">Assignments</button><button data-tab="graph">Dependencies</button><button data-tab="events">
|
|
20
|
+
<section class="stats" id="stats"></section><section class="workspace"><nav class="tabs" aria-label="Ledger views"><button data-tab="functions" class="active">Functions</button><button data-tab="tasks">Assignments</button><button data-tab="graph">Dependencies</button><button data-tab="events">Events</button><span class="mode">READ ONLY</span></nav>
|
|
21
21
|
<div class="content"><main class="main"><div class="toolbar"><input id="search" aria-label="Search functions" placeholder="Search name or RVA…"><select id="stage" aria-label="Filter reconstruction stage"><option value="">All RE stages<option value="discovered">Discovered</option><option value="partial">Partial</option><option value="reconstructed">Reconstructed</option><option value="corpus_match">Corpus match</option><option value="reviewed">Reviewed</option><option value="mismatch">Mismatch</option></select><small id="slice"></small></div><div id="surface"></div></main><aside id="inspector"></aside></div></section>
|
|
22
22
|
<footer><span id="stamp"></span><span>Snapshot of shared state · no edits from this view</span><span>1:1 acceptance is locked</span></footer></div>
|
|
23
23
|
<script type="application/json" id="ledger" nonce="${nonce}">${data}</script><script nonce="${nonce}">
|
|
@@ -68,14 +68,13 @@ document.querySelectorAll('[data-tab]').forEach(b=>b.addEventListener('click',()
|
|
|
68
68
|
if(${live}&&location.protocol==='file:')setTimeout(()=>location.reload(),8000);
|
|
69
69
|
</script></html>`;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
/** Writes the hub snapshot of one project into the profile's work-views (machine-local), or to `output`. */
|
|
72
|
+
export async function saveDashboard(workspace, read, projectId, output) {
|
|
72
73
|
identifier(projectId);
|
|
73
74
|
const previous = queues.get(workspace) ?? Promise.resolve();
|
|
74
75
|
const pending = previous.catch(() => { }).then(async () => {
|
|
75
|
-
const snapshot =
|
|
76
|
+
const snapshot = await read(), directory = join(workspace.directory, 'work-views');
|
|
76
77
|
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
77
|
-
if ((await lstat(directory)).isSymbolicLink() || await realpath(directory) !== resolve(directory))
|
|
78
|
-
fail('storage', 'Dashboard directory is not profile-owned.');
|
|
79
78
|
const path = output ?? join(directory, projectId + '.html');
|
|
80
79
|
if (output)
|
|
81
80
|
await writeFile(path, dashboardHtml(snapshot), { flag: 'wx', mode: 0o600 });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type LedgerRows } from '../hub/ledger-store.js';
|
|
2
|
+
import { type Attachment } from './model.js';
|
|
3
|
+
/** Ledger rows for hub project `scope`, plus every input attachment the ledger references. */
|
|
4
|
+
export declare function legacyRows(path: string, scope: string): {
|
|
5
|
+
rows: LedgerRows;
|
|
6
|
+
attachments: Attachment[];
|
|
7
|
+
userVersion: number;
|
|
8
|
+
};
|