sneakoscope 7.1.0 → 7.3.0
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/README.md +9 -1
- package/config/architecture-budgets.v1.json +1 -8
- package/crates/sks-core/Cargo.lock +225 -1
- package/crates/sks-core/Cargo.toml +8 -1
- package/crates/sks-core/src/main.rs +7 -1
- package/crates/sks-core/src/search/files.rs +114 -0
- package/crates/sks-core/src/search/mod.rs +274 -0
- package/crates/sks-core/src/search/text.rs +175 -0
- package/dist/bin/sks-dispatch.js +4 -3
- package/dist/cli/command-manifest-lite.js +177 -6
- package/dist/cli/command-registry.js +42 -8
- package/dist/cli/help.js +30 -0
- package/dist/cli/install-helpers-codex-lb-config.js +9 -6
- package/dist/cli/install-helpers-codex-lb-selftest-chain.js +1 -1
- package/dist/cli/install-helpers-install-support.js +1 -1
- package/dist/cli/install-helpers.js +19 -9
- package/dist/cli/router.js +16 -3
- package/dist/commands/codex-app.js +40 -5
- package/dist/commands/doctor-profile.js +78 -0
- package/dist/commands/doctor.js +29 -69
- package/dist/commands/search.js +4 -0
- package/dist/config/skills-manifest.json +53 -60
- package/dist/core/agent-bridge/agent-manifest.js +22 -26
- package/dist/core/agent-bridge/host-capability-policy.js +109 -8
- package/dist/core/agent-bridge/host-capability-runtime.js +178 -50
- package/dist/core/agent-guidance/directive-registry.js +123 -0
- package/dist/core/agents/agent-effort-policy.js +45 -6
- package/dist/core/agents/agent-worker-pipeline.js +1 -3
- package/dist/core/agents/native-worker-backend-router.js +43 -19
- package/dist/core/auto-review.js +1 -3
- package/dist/core/code-structure.js +282 -19
- package/dist/core/codex/codex-config-guard.js +14 -4
- package/dist/core/codex/codex-config-toml.js +1 -3
- package/dist/core/codex-app/codex-agent-role-sync.js +1 -3
- package/dist/core/codex-app/codex-app-fast-ui-repair.js +14 -1
- package/dist/core/codex-app/codex-app-types.js +2 -3
- package/dist/core/codex-app/codex-desktop-routing-ownership.js +91 -0
- package/dist/core/codex-app/codex-hook-approval-probe.js +1 -3
- package/dist/core/codex-app/codex-hook-lifecycle.js +1 -3
- package/dist/core/codex-app/codex-init-deep.js +22 -10
- package/dist/core/codex-app/codex-model-catalog.js +384 -0
- package/dist/core/codex-app/codex-models-cache.js +160 -0
- package/dist/core/codex-app/desktop-routing-snapshot.js +233 -0
- package/dist/core/codex-app/glm-profile-installer.js +1 -3
- package/dist/core/codex-app/mcp-manager.js +1 -3
- package/dist/core/codex-app/menubar/constants.js +3 -0
- package/dist/core/codex-app/menubar/installer.js +11 -1
- package/dist/core/codex-app/multi-provider-router-support.js +202 -0
- package/dist/core/codex-app/multi-provider-router.js +379 -0
- package/dist/core/codex-app/openrouter-activate.js +189 -26
- package/dist/core/codex-app/openrouter-base-instructions.js +1 -0
- package/dist/core/codex-app/openrouter-model-catalog.js +217 -0
- package/dist/core/codex-app/role-model-catalog-priority.js +61 -0
- package/dist/core/codex-app.js +30 -6
- package/dist/core/codex-compat/codex-hook-semantic-validator.js +1 -3
- package/dist/core/codex-control/codex-app-server-v2-client.js +39 -2
- package/dist/core/codex-lb/codex-lb-env.js +1 -3
- package/dist/core/codex-lb/codex-lb-tool-catalog.js +6 -1
- package/dist/core/codex-native/codex-native-feature-broker.js +2 -6
- package/dist/core/codex-native/codex-native-interop-policy.js +1 -3
- package/dist/core/codex-native/codex-native-reference-cache.js +1 -3
- package/dist/core/codex-native/codex-native-reference-source.js +1 -3
- package/dist/core/codex-native/codex-native-repair-transaction.js +1 -3
- package/dist/core/codex-native/core-skill-manifest.js +3 -2
- package/dist/core/codex-native/native-capability-repair-matrix.js +1 -3
- package/dist/core/codex-plugins/codex-plugin-repair.js +1 -3
- package/dist/core/codex-runtime/codex-desktop-config-policy.js +4 -4
- package/dist/core/commands/agent-bridge-command.js +24 -3
- package/dist/core/commands/image-ux-review-command.js +5 -11
- package/dist/core/commands/menubar-command.js +1 -1
- package/dist/core/commands/naruto-command.js +40 -13
- package/dist/core/commands/pipeline-command.js +5 -2
- package/dist/core/commands/release-command.js +63 -1
- package/dist/core/commands/remote-command.js +18 -0
- package/dist/core/commands/search-command.js +151 -0
- package/dist/core/commands/telegram-command.js +251 -108
- package/dist/core/commands/uninstall-command.js +1 -1
- package/dist/core/config/secret-preservation.js +1 -3
- package/dist/core/context7-client.js +2 -1
- package/dist/core/db-review.js +704 -0
- package/dist/core/db-safety.js +17 -23
- package/dist/core/doctor/browser-use-repair.js +1 -3
- package/dist/core/doctor/codex-startup-config-repair.js +1 -3
- package/dist/core/doctor/computer-use-repair.js +1 -3
- package/dist/core/doctor/context7-mcp-repair.js +1 -3
- package/dist/core/doctor/current-project-guidance.js +1 -3
- package/dist/core/doctor/doctor-codex-startup-repair.js +1 -3
- package/dist/core/doctor/doctor-dirty-planner.js +2 -2
- package/dist/core/doctor/doctor-native-capability-repair.js +1 -3
- package/dist/core/doctor/doctor-transaction.js +1 -3
- package/dist/core/doctor/imagegen-repair.js +1 -3
- package/dist/core/doctor/legacy-global-hook-cleanup.js +1 -3
- package/dist/core/doctor/mcp-transport-collision-repair.js +1 -3
- package/dist/core/doctor/retired-managed-residue-private.js +1 -3
- package/dist/core/doctor/supabase-mcp-repair.js +1 -3
- package/dist/core/engineering-sanity-review.js +186 -0
- package/dist/core/errors/message.js +3 -0
- package/dist/core/evidence/evidence-schema.js +1 -3
- package/dist/core/feature-fixtures.js +1 -0
- package/dist/core/feature-registry.js +1 -3
- package/dist/core/fsx.js +13 -0
- package/dist/core/git-hygiene/shared-memory-publish.js +1 -3
- package/dist/core/git-hygiene/validators.js +1 -3
- package/dist/core/harness-guard.js +21 -3
- package/dist/core/hooks-runtime/hook-context.js +2 -2
- package/dist/core/image-ux-review/imagegen-adapter.js +52 -56
- package/dist/core/image-ux-review/real-callout-extractor.js +6 -1
- package/dist/core/image-ux-review.js +3 -5
- package/dist/core/imagegen/codex-lb-imagegen-target.js +70 -0
- package/dist/core/imagegen/imagegen-capability.js +11 -11
- package/dist/core/imagegen/imagegen-evidence.js +32 -0
- package/dist/core/init/skills.js +9 -11
- package/dist/core/init.js +4 -6
- package/dist/core/json/records.js +9 -0
- package/dist/core/json-schema-validator.js +1 -3
- package/dist/core/lean-engineering-policy.js +54 -0
- package/dist/core/loops/loop-continuation-enforcer.js +1 -3
- package/dist/core/mad-sks/sql-plane/mcp-executor.js +2 -1
- package/dist/core/mad-sks/sql-plane/policy.js +2 -1
- package/dist/core/managed-assets/managed-assets-manifest.js +4 -3
- package/dist/core/mcp-config/codex-cli-adapter.js +1 -3
- package/dist/core/mcp-config/config-reader.js +2 -3
- package/dist/core/mcp-config/guarded-patch.js +1 -1
- package/dist/core/mcp-config/health-check.js +2 -1
- package/dist/core/mcp-config/mutation.js +1 -1
- package/dist/core/mcp-config/restore.js +1 -1
- package/dist/core/mcp-config/secret-policy.js +1 -3
- package/dist/core/migration/migration-transaction-journal.js +3 -3
- package/dist/core/naruto/naruto-concurrency-governor.js +2 -2
- package/dist/core/perf/import-graph-budget.js +91 -1
- package/dist/core/pipeline/pipeline-plan-writer.js +1 -1
- package/dist/core/pipeline-internals/runtime-core.js +121 -23
- package/dist/core/pipeline-internals/runtime-gates.js +193 -4
- package/dist/core/pipeline.js +1 -1
- package/dist/core/ppt-review/slide-imagegen-review.js +7 -7
- package/dist/core/ppt.js +3 -3
- package/dist/core/product-design-app-server.js +2 -1
- package/dist/core/proof/fake-real-proof-policy.js +1 -3
- package/dist/core/proof/root-cause-policy.js +1 -3
- package/dist/core/proof/validation.js +1 -3
- package/dist/core/provider/model-router.js +4 -0
- package/dist/core/provider/provider-context.js +1 -3
- package/dist/core/providers/openrouter/openrouter-account.js +1 -3
- package/dist/core/quality/helper-dedup.js +0 -0
- package/dist/core/recallpulse.js +1 -1
- package/dist/core/release/file-ownership.js +26 -17
- package/dist/core/release/macos-menubar-proof.js +59 -1
- package/dist/core/release/main-push-guard.js +288 -24
- package/dist/core/release/main-push-receipt.js +10 -45
- package/dist/core/release/package-size-budget.js +1 -1
- package/dist/core/release/release-gate-contract.js +2 -0
- package/dist/core/release/release-pack-receipt.js +1 -1
- package/dist/core/release/release-proof-io.js +33 -0
- package/dist/core/release/release-upgrade-baseline.js +9 -0
- package/dist/core/release/runtime-script-pack-closure.js +153 -4
- package/dist/core/release/stage-publish.js +194 -0
- package/dist/core/remote/index.js +2 -0
- package/dist/core/remote/local-worker-client.js +35 -0
- package/dist/core/remote/machine-registry.js +18 -13
- package/dist/core/remote/owner-proof.js +1 -3
- package/dist/core/remote/protocol.js +1 -3
- package/dist/core/remote/readiness.js +1 -3
- package/dist/core/remote/session-binding.js +153 -0
- package/dist/core/remote/session-index.js +1 -3
- package/dist/core/remote/types.js +1 -0
- package/dist/core/remote/worker.js +228 -14
- package/dist/core/responses-stream.js +151 -0
- package/dist/core/routes/dollar-manifest-lite.js +1 -1
- package/dist/core/routes.js +8 -8
- package/dist/core/rust-accelerator.js +12 -2
- package/dist/core/safety/ssot-guard.js +1 -3
- package/dist/core/search/benchmark.js +358 -0
- package/dist/core/search/cache.js +65 -0
- package/dist/core/search/context.js +144 -0
- package/dist/core/search/doctor.js +74 -0
- package/dist/core/search/files.js +192 -0
- package/dist/core/search/index.js +5 -0
- package/dist/core/search/ipc.js +64 -0
- package/dist/core/search/provider.js +142 -0
- package/dist/core/search/rust-bridge.js +24 -0
- package/dist/core/search/structure.js +230 -0
- package/dist/core/search/symbol.js +272 -0
- package/dist/core/search/text.js +146 -0
- package/dist/core/search/types.js +22 -0
- package/dist/core/search/typescript-ls.js +215 -0
- package/dist/core/search-visibility/discovery.js +1 -3
- package/dist/core/skill-forge.js +1 -1
- package/dist/core/stop-gate/gate-evaluator.js +3 -3
- package/dist/core/stop-gate/stop-gate-check.js +1 -3
- package/dist/core/structured-output-adapter.js +62 -2
- package/dist/core/subagents/agent-catalog.js +56 -43
- package/dist/core/subagents/model-policy.js +17 -7
- package/dist/core/subagents/naruto-proof-projection.js +2 -6
- package/dist/core/subagents/official-subagent-config.js +1 -3
- package/dist/core/subagents/official-subagent-preparation.js +73 -10
- package/dist/core/subagents/official-subagent-prompt.js +85 -18
- package/dist/core/subagents/official-subagent-runner.js +10 -5
- package/dist/core/subagents/role-model-preferences.js +202 -44
- package/dist/core/subagents/subagent-evidence.js +1 -3
- package/dist/core/subagents/thread-budget.js +1 -1
- package/dist/core/subagents/triwiki-attention.js +1 -5
- package/dist/core/telegram/config.js +29 -12
- package/dist/core/telegram/hub.js +8 -2
- package/dist/core/telegram/index.js +2 -0
- package/dist/core/telegram/messages.js +8 -2
- package/dist/core/telegram/runtime-projection.js +8 -5
- package/dist/core/telegram/runtime.js +19 -9
- package/dist/core/telegram/service.js +181 -0
- package/dist/core/telegram/setup.js +220 -0
- package/dist/core/text/regex.js +3 -0
- package/dist/core/text/strings.js +6 -0
- package/dist/core/triwiki-wrongness/image-wrongness.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-ledger.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-proof-linker.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-retrieval.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-schema.js +1 -3
- package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +1 -3
- package/dist/core/trust-kernel/completion-contract.js +1 -3
- package/dist/core/trust-kernel/route-contract.js +1 -3
- package/dist/core/update/update-migration-state.js +1 -3
- package/dist/core/update-check.js +20 -6
- package/dist/core/verification/diff-quality.js +3 -4
- package/dist/core/verification/impact-scan.js +36 -89
- package/dist/core/verification/mistake-rule-compiler.js +17 -4
- package/dist/core/version-manager.js +3 -20
- package/dist/core/version.js +1 -1
- package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +23 -3
- package/dist/native/sks-menubar/Sources/ControlKit.swift +102 -0
- package/dist/native/sks-menubar/Sources/DiagnosticsViewController.swift +23 -11
- package/dist/native/sks-menubar/Sources/MCPServersViewController.swift +7 -3
- package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +17 -1
- package/dist/native/sks-menubar/Sources/OverviewViewController.swift +22 -15
- package/dist/native/sks-menubar/Sources/ProcessClient.swift +15 -5
- package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +324 -0
- package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +154 -214
- package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +252 -0
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +77 -71
- package/dist/native/sks-menubar/Sources/RemoteTelegramViewController.swift +167 -51
- package/dist/native/sks-menubar/Sources/SettingsViewController.swift +14 -5
- package/dist/native/sks-menubar/Sources/SidebarItem.swift +15 -1
- package/dist/native/sks-menubar/Sources/StatusItemController.swift +2 -2
- package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +16 -12
- package/dist/scripts/agent-guidance-dedup-check.js +23 -0
- package/dist/scripts/agent-message-bus-reader-check.js +1 -1
- package/dist/scripts/all-feature-deep-completion-check.js +1 -1
- package/dist/scripts/appshots-thread-attachment-discovery-check.js +1 -1
- package/dist/scripts/architecture-guard-check.js +1 -2
- package/dist/scripts/certificate-sla-check.js +1 -1
- package/dist/scripts/cli-output-consistency-check.js +1 -1
- package/dist/scripts/codex-0-134-runner-truth-check.js +1 -1
- package/dist/scripts/codex-0138-capability-artifact-check.js +1 -1
- package/dist/scripts/codex-0138-capability-check.js +1 -1
- package/dist/scripts/codex-0138-doctor-check.js +1 -1
- package/dist/scripts/codex-0138-feature-probes-check.js +1 -1
- package/dist/scripts/codex-0144-app-server-v2-check.js +1 -1
- package/dist/scripts/codex-0144-binary-identity-check.js +1 -1
- package/dist/scripts/codex-0144-capability-check.js +1 -1
- package/dist/scripts/codex-0144-core-real-probes-check.js +1 -1
- package/dist/scripts/codex-0144-manifest-check.js +1 -1
- package/dist/scripts/codex-0144-policy-check.js +1 -1
- package/dist/scripts/codex-0144-thread-store-check.js +1 -1
- package/dist/scripts/codex-agent-role-rich-content-check.js +2 -2
- package/dist/scripts/codex-agent-role-sync-check.js +2 -2
- package/dist/scripts/codex-agent-type-routing-check.js +2 -2
- package/dist/scripts/codex-app-execution-profile-check.js +2 -2
- package/dist/scripts/codex-app-handoff-check.js +1 -1
- package/dist/scripts/codex-app-handoff-launch-check.js +1 -1
- package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +1 -1
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +1 -3
- package/dist/scripts/codex-native-feature-broker-blackbox.js +2 -2
- package/dist/scripts/codex-native-feature-broker-check.js +2 -2
- package/dist/scripts/{sks-3-1-6-directive-check-lib.js → codex-native-gate-lib.js} +5 -5
- package/dist/scripts/codex-native-harness-compat-check.js +2 -2
- package/dist/scripts/codex-native-hook-lifecycle-proof-check.js +2 -2
- package/dist/scripts/codex-plugin-app-template-policy-check.js +1 -1
- package/dist/scripts/codex-sdk-backend-router-check.js +1 -1
- package/dist/scripts/codex-sdk-capability-check.js +1 -1
- package/dist/scripts/context7-evidence-dedupe-check.js +1 -1
- package/dist/scripts/core-skill-card-schema-check.js +1 -1
- package/dist/scripts/core-skill-deployment-snapshot-check.js +1 -1
- package/dist/scripts/core-skill-heldout-validation-check.js +1 -1
- package/dist/scripts/core-skill-no-inference-optimizer-check.js +1 -1
- package/dist/scripts/core-skill-patch-check.js +1 -1
- package/dist/scripts/core-skill-route-runtime-integration-check.js +1 -1
- package/dist/scripts/current-command-surface-check.js +1 -1
- package/dist/scripts/current-surface-update-e2e-check.js +4 -1
- package/dist/scripts/current-upgrade-matrix-check.js +1 -1
- package/dist/scripts/dfix-fixture-check.js +1 -1
- package/dist/scripts/dfix-patch-handoff-check.js +1 -1
- package/dist/scripts/dfix-verification-check.js +1 -1
- package/dist/scripts/dfix-verification-recommendation-check.js +1 -1
- package/dist/scripts/docs-truthfulness-check.js +16 -3
- package/dist/scripts/doctor-codex-app-harness-check.js +2 -2
- package/dist/scripts/evidence-flagship-coverage-check.js +1 -1
- package/dist/scripts/{sks-1-18-gate-lib.js → gate-lib.js} +1 -1
- package/dist/scripts/gate-policy-audit-check.js +4 -1
- package/dist/scripts/git-worktree-checkpoint-check.js +1 -1
- package/dist/scripts/git-worktree-cross-rebase-check.js +1 -1
- package/dist/scripts/git-worktree-diff-envelope-check.js +1 -1
- package/dist/scripts/git-worktree-dirty-lock-check.js +1 -1
- package/dist/scripts/git-worktree-dirty-main-detection-check.js +1 -1
- package/dist/scripts/git-worktree-integration-primary-check.js +1 -1
- package/dist/scripts/git-worktree-manifest-append-check.js +1 -1
- package/dist/scripts/git-worktree-untracked-diff-check.js +1 -1
- package/dist/scripts/harness-benchmark-check.js +1 -1
- package/dist/scripts/helper-dedup-check.js +62 -0
- package/dist/scripts/hook-latency-budget-check.js +1 -1
- package/dist/scripts/image-artifact-path-contract-check.js +1 -1
- package/dist/scripts/imagegen-real-smoke-check.js +2 -5
- package/dist/scripts/installed-package-smoke-check.js +1 -1
- package/dist/scripts/legacy-gate-inventory-check.js +1 -1
- package/dist/scripts/legacy-gate-purge-check.js +1 -1
- package/dist/scripts/legacy-strong-inventory-check.js +1 -1
- package/dist/scripts/lib/codex-sdk-gate-lib.js +1 -1
- package/dist/scripts/mad-sks-launch-sql-plane-boundary-check.js +1 -1
- package/dist/scripts/mad-sks-sql-plane-capability-check.js +1 -1
- package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +1 -1
- package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +1 -1
- package/dist/scripts/managed-config-merge-check.js +1 -1
- package/dist/scripts/mcp-plugin-inventory-check.js +1 -1
- package/dist/scripts/model-call-concurrency-check.js +1 -1
- package/dist/scripts/mutation-callsite-coverage-check.js +1 -1
- package/dist/scripts/naruto-ssot-gate-aliases-check.js +1 -1
- package/dist/scripts/naruto-ssot-pipeline-default-check.js +1 -1
- package/dist/scripts/naruto-ssot-route-normalization-check.js +1 -1
- package/dist/scripts/naruto-ssot-routing-check.js +1 -1
- package/dist/scripts/naruto-worktree-coding-blackbox.js +1 -1
- package/dist/scripts/native-capability-repair-matrix-check.js +1 -1
- package/dist/scripts/native-image-generation-repair-check.js +1 -1
- package/dist/scripts/official-subagent-workflow-check.js +3 -3
- package/dist/scripts/package-published-contract-check.js +37 -4
- package/dist/scripts/packlist-performance-check.js +17 -1
- package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +1 -3
- package/dist/scripts/ppt-real-export-adapter-check.js +1 -1
- package/dist/scripts/ppt-real-imagegen-wiring-check.js +1 -1
- package/dist/scripts/ppt-reexport-rereview-check.js +1 -1
- package/dist/scripts/prepublish-fast-check.js +1 -1
- package/dist/scripts/probe-memoization-check.js +2 -2
- package/dist/scripts/prompt-placeholder-guard-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-capability-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-cli-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-launch-check.js +1 -1
- package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +1 -1
- package/dist/scripts/qa-loop-budget-policy-check.js +1 -1
- package/dist/scripts/qa-loop-effort-escalation-check.js +1 -1
- package/dist/scripts/qa-loop-execution-profile-routing-check.js +2 -2
- package/dist/scripts/qa-loop-image-path-exposure-check.js +1 -1
- package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +1 -1
- package/dist/scripts/{sks-1-12-real-execution-check-lib.js → real-execution-check-lib.js} +1 -1
- package/dist/scripts/release-affected-selector-check.js +1 -1
- package/dist/scripts/release-aggressive-resource-governor-check.js +1 -1
- package/dist/scripts/release-cache-glob-hashing-check.js +1 -1
- package/dist/scripts/release-cache-input-classifier-check.js +1 -1
- package/dist/scripts/release-cache-neutralization-report-check.js +1 -1
- package/dist/scripts/release-cache-version-neutral-fixture-check.js +1 -1
- package/dist/scripts/release-dynamic-presets-check.js +2 -2
- package/dist/scripts/release-full-parallelism-blackbox.js +1 -1
- package/dist/scripts/release-gate-batch-runner-check.js +1 -1
- package/dist/scripts/release-gate-budget-check.js +1 -1
- package/dist/scripts/release-gate-dag-runner-check.js +1 -1
- package/dist/scripts/release-latency-slo-check.js +1 -1
- package/dist/scripts/release-metadata-check.js +256 -2
- package/dist/scripts/release-parallel-speed-budget-check.js +1 -1
- package/dist/scripts/release-proof-truth-check.js +1 -1
- package/dist/scripts/release-provenance-check.js +4 -2
- package/dist/scripts/release-runtime-truth-matrix-check.js +1 -1
- package/dist/scripts/research-blueprint-densifier-check.js +1 -1
- package/dist/scripts/research-claim-builder-check.js +1 -1
- package/dist/scripts/research-complete-package-fixture-check.js +1 -1
- package/dist/scripts/research-execution-profile-routing-check.js +2 -2
- package/dist/scripts/research-final-reviewer-blackbox.js +1 -1
- package/dist/scripts/{sks-3-1-4-directive-check-lib.js → runtime-domain-gate-lib.js} +2 -2
- package/dist/scripts/runtime-proof-summary-check.js +1 -1
- package/dist/scripts/runtime-script-pack-closure-check.js +7 -1
- package/dist/scripts/scheduler-batch-dispatch-check.js +1 -1
- package/dist/scripts/scheduler-parallel-proof-consistency-check.js +1 -1
- package/dist/scripts/scheduler-utilization-integral-check.js +1 -1
- package/dist/scripts/search-visibility-gate-lib.js +1 -1
- package/dist/scripts/secret-preservation-check.js +1 -1
- package/dist/scripts/seo-geo-geo-disambiguation-check.js +1 -1
- package/dist/scripts/seo-geo-skill-rich-content-check.js +1 -1
- package/dist/scripts/side-effect-runtime-report-check.js +1 -1
- package/dist/scripts/{sks-3-1-8-check-lib.js → skill-fixture-check-lib.js} +1 -1
- package/dist/scripts/skill-name-canonicalizer-check.js +1 -1
- package/dist/scripts/skills-manifest-continuity-check.js +1 -1
- package/dist/scripts/sks-uninstall-regression-check.js +1 -1
- package/dist/scripts/sksd-daemon-check.js +1 -1
- package/dist/scripts/super-search-provider-interface-check.js +1 -1
- package/dist/scripts/triwiki-cache-key-check.js +1 -1
- package/dist/scripts/triwiki-proof-bank-blackbox.js +2 -2
- package/dist/scripts/triwiki-proof-bank-check.js +1 -1
- package/dist/scripts/triwiki-proof-card-check.js +1 -1
- package/dist/scripts/type-surface-codex-app-check.js +2 -2
- package/dist/scripts/{sks-3-1-5-directive-check-lib.js → typed-routing-gate-lib.js} +2 -2
- package/dist/scripts/ultra-router-auto-router-check.js +1 -1
- package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +1 -1
- package/dist/scripts/ux-review-patch-diff-recheck-check.js +1 -1
- package/dist/scripts/ux-review-run-wires-imagegen-check.js +9 -2
- package/package.json +5 -7
- package/release-gates.v2.json +66 -11
- package/runtime-required-scripts.json +138 -14
- package/config/bench-baseline.json +0 -7
- package/dist/core/codex-app/sks-menubar.js +0 -1
- package/dist/core/release/release-closure-contract.js +0 -30
- package/dist/core/release/release-closure-helpers.js +0 -293
- package/dist/core/release/release-closure-validation.js +0 -284
- package/dist/core/release/release-closure.js +0 -163
- package/dist/scripts/build-dist.js +0 -124
- package/dist/scripts/build-once-runner-check.js +0 -6
- package/dist/scripts/canonical-test-runner.js +0 -234
- package/dist/scripts/changelog-check.js +0 -45
- package/dist/scripts/check-architecture.js +0 -295
- package/dist/scripts/check-cli-entrypoint.js +0 -41
- package/dist/scripts/check-command-module-budget.js +0 -77
- package/dist/scripts/check-feature-quality.js +0 -51
- package/dist/scripts/check-legacy-free.js +0 -64
- package/dist/scripts/check-pipeline-budget.js +0 -49
- package/dist/scripts/check-pipeline-runtime.js +0 -16
- package/dist/scripts/check-publish-tag.js +0 -56
- package/dist/scripts/check-route-modularity.js +0 -72
- package/dist/scripts/codex-0140-capability-check.js +0 -14
- package/dist/scripts/codex-0140-feature-probes-check.js +0 -23
- package/dist/scripts/codex-permission-profiles-check.js +0 -34
- package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -49
- package/dist/scripts/competitor-scorecard-check.js +0 -24
- package/dist/scripts/core-skill-no-drift-check.js +0 -23
- package/dist/scripts/db-route-materialization-check.js +0 -32
- package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +0 -15
- package/dist/scripts/doctor-fastpath-check.js +0 -25
- package/dist/scripts/doctor-fix-production-blackbox.js +0 -35
- package/dist/scripts/doctor-idempotence-check.js +0 -6
- package/dist/scripts/doctor-ops-semantics-check.js +0 -83
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +0 -18
- package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +0 -13
- package/dist/scripts/ensure-bin-executable.js +0 -16
- package/dist/scripts/fsx-hotpath-check.js +0 -9
- package/dist/scripts/high-risk-contracts-check.js +0 -183
- package/dist/scripts/hook-latency-quantum-check.js +0 -120
- package/dist/scripts/import-graph-budget-check.js +0 -9
- package/dist/scripts/mcp-tool-naming-parity-check.js +0 -14
- package/dist/scripts/naruto-codex-e2e-check.js +0 -105
- package/dist/scripts/naruto-write-e2e-check.js +0 -31
- package/dist/scripts/native-capability-postcheck-check.js +0 -16
- package/dist/scripts/ops-diagnostics-bundle-check.js +0 -11
- package/dist/scripts/parallel-production-smoke-check.js +0 -20
- package/dist/scripts/perf-budget-check.js +0 -12
- package/dist/scripts/project-skill-dedupe-blackbox.js +0 -62
- package/dist/scripts/release-dag-full-coverage-check.js +0 -98
- package/dist/scripts/release-dist-freshness-check.js +0 -6
- package/dist/scripts/release-file-ownership-check.js +0 -35
- package/dist/scripts/release-gate-script-parity-check.js +0 -148
- package/dist/scripts/release-macos-menubar-proof.js +0 -167
- package/dist/scripts/release-main-push-guard.js +0 -37
- package/dist/scripts/release-main-push-receipt.js +0 -43
- package/dist/scripts/release-metadata-1-19-check.js +0 -257
- package/dist/scripts/release-version-truth-check.js +0 -138
- package/dist/scripts/retention-apply-smoke-check.js +0 -19
- package/dist/scripts/retention-budget-check.js +0 -6
- package/dist/scripts/retention-dry-run-check.js +0 -8
- package/dist/scripts/rollback-recovery-smoke-check.js +0 -70
- package/dist/scripts/route-intent-regression-check.js +0 -42
- package/dist/scripts/runtime-current-terminal-check.js +0 -108
- package/dist/scripts/runtime-dist-parity-check.js +0 -76
- package/dist/scripts/runtime-no-src-mjs-check.js +0 -30
- package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -58
- package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -53
- package/dist/scripts/secret-preservation-guard-check.js +0 -36
- package/dist/scripts/seo-marketing-truthfulness-check.js +0 -98
- package/dist/scripts/seo-metadata-sync-check.js +0 -60
- package/dist/scripts/sizecheck.js +0 -148
- package/dist/scripts/sks-menubar-install-check.js +0 -333
- package/dist/scripts/supabase-secret-preservation-blackbox.js +0 -28
- package/dist/scripts/super-search-live-smoke-check.js +0 -115
- package/dist/scripts/super-search-local-http-smoke-check.js +0 -16
- package/dist/scripts/super-search-offline-contract-check.js +0 -43
- package/dist/scripts/update-fastpath-check.js +0 -28
- package/dist/scripts/update-preserves-supabase-keys-blackbox.js +0 -26
- package/dist/scripts/upgrade-migration-matrix-check.js +0 -351
- package/dist/scripts/write-build-manifest.js +0 -70
- package/dist/scripts/zellij-capability-check.js +0 -13
- package/dist/scripts/zellij-developer-controls-check.js +0 -16
- package/dist/scripts/zellij-doctor-readiness-check.js +0 -49
- package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -19
- package/dist/scripts/zellij-fake-adapter-check.js +0 -31
- package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -20
- package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -348
- package/dist/scripts/zellij-homebrew-policy-check.js +0 -3
- package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -21
- package/dist/scripts/zellij-lane-renderer-check.js +0 -78
- package/dist/scripts/zellij-launch-command-truth-check.js +0 -62
- package/dist/scripts/zellij-layout-valid-check.js +0 -120
- package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -10
- package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -78
- package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -12
- package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -134
- package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -7
- package/dist/scripts/zellij-right-column-geometry-proof.js +0 -158
- package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -20
- package/dist/scripts/zellij-right-column-manager-check.js +0 -24
- package/dist/scripts/zellij-self-heal-check.js +0 -3
- package/dist/scripts/zellij-self-heal-dry-run-check.js +0 -3
- package/dist/scripts/zellij-self-heal-status-contract-check.js +0 -3
- package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -3
- package/dist/scripts/zellij-slot-column-anchor-check.js +0 -65
- package/dist/scripts/zellij-slot-column-anchor-telemetry-check.js +0 -8
- package/dist/scripts/zellij-slot-only-ui-check.js +0 -29
- package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -149
- package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -65
- package/dist/scripts/zellij-slot-pane-telemetry-renderer-check.js +0 -11
- package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +0 -58
- package/dist/scripts/zellij-slot-telemetry-check.js +0 -38
- package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -46
- package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -55
- package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -32
- package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -19
- package/dist/scripts/zellij-slot-telemetry-renderer-check.js +0 -11
- package/dist/scripts/zellij-slot-telemetry-runtime-check.js +0 -23
- package/dist/scripts/zellij-spawn-on-demand-layout-check.js +0 -45
- package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -9
- package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -78
- package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -29
- package/dist/scripts/zellij-stacked-version-parser-check.js +0 -19
- package/dist/scripts/zellij-ui-design-check.js +0 -92
- package/dist/scripts/zellij-update-missing-self-heal-check.js +0 -3
- package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -16
- package/dist/scripts/zellij-update-prompt-mode-check.js +0 -18
- package/dist/scripts/zellij-update-prompt-safety-check.js +0 -8
- package/dist/scripts/zellij-worker-pane-manager-check.js +0 -108
- package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +0 -47
- package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -199
- /package/dist/scripts/{sks-1-11-gate-lib.js → sks-cli-gate-lib.js} +0 -0
|
@@ -5,13 +5,37 @@ import { flag } from '../../cli/args.js';
|
|
|
5
5
|
import { printJson } from '../../cli/output.js';
|
|
6
6
|
import { exists, projectRoot, readJson, writeJsonAtomic, writeTextAtomic } from '../fsx.js';
|
|
7
7
|
import { createMission } from '../mission.js';
|
|
8
|
+
import { stagePublish } from '../release/stage-publish.js';
|
|
9
|
+
export function usage() {
|
|
10
|
+
return [
|
|
11
|
+
'Usage: sks release affected|full|background|stage [--json]',
|
|
12
|
+
'',
|
|
13
|
+
'Run affected release proof, full release proof, or background release proof explicitly.',
|
|
14
|
+
'',
|
|
15
|
+
'Subcommands:',
|
|
16
|
+
' affected Changed-scope release proof (default)',
|
|
17
|
+
' full Full foreground release gate graph',
|
|
18
|
+
' background Full release gate graph, detached logs',
|
|
19
|
+
' stage Drive the staged npm publish up to the human approval step',
|
|
20
|
+
'',
|
|
21
|
+
'Options for stage:',
|
|
22
|
+
' --confirm Perform the outward steps: push main, dispatch the',
|
|
23
|
+
' stage workflow, wait, download and verify the tarball.',
|
|
24
|
+
' Without it, stage only reports what it would do.',
|
|
25
|
+
' --version <semver> Version to stage (defaults to package.json).',
|
|
26
|
+
'',
|
|
27
|
+
'stage never runs `npm stage approve`; that approval is a human 2FA step.'
|
|
28
|
+
].join('\n');
|
|
29
|
+
}
|
|
8
30
|
export async function releaseCommand(args = []) {
|
|
9
31
|
const root = await projectRoot();
|
|
10
32
|
const sub = args[0] && !args[0].startsWith('-') ? args[0] : 'affected';
|
|
11
33
|
const json = flag(args, '--json');
|
|
34
|
+
if (sub === 'stage')
|
|
35
|
+
return runStageSubcommand(root, args, json);
|
|
12
36
|
const command = commandForSubcommand(sub);
|
|
13
37
|
if (!command) {
|
|
14
|
-
console.error(
|
|
38
|
+
console.error(usage());
|
|
15
39
|
process.exitCode = 1;
|
|
16
40
|
return null;
|
|
17
41
|
}
|
|
@@ -63,6 +87,44 @@ export async function releaseCommand(args = []) {
|
|
|
63
87
|
process.stderr.write(result.stderr);
|
|
64
88
|
return report;
|
|
65
89
|
}
|
|
90
|
+
async function runStageSubcommand(root, args, json) {
|
|
91
|
+
const report = stagePublish({
|
|
92
|
+
root,
|
|
93
|
+
confirm: flag(args, '--confirm'),
|
|
94
|
+
run: spawnRunner(root),
|
|
95
|
+
...(readOption(args, '--version') ? { version: readOption(args, '--version') } : {})
|
|
96
|
+
});
|
|
97
|
+
await writeJsonAtomic(path.join(root, '.sneakoscope', 'reports', 'release-stage-publish.json'), report).catch(() => { });
|
|
98
|
+
if (!report.ok)
|
|
99
|
+
process.exitCode = 1;
|
|
100
|
+
if (json)
|
|
101
|
+
return printJson(report);
|
|
102
|
+
for (const step of report.steps) {
|
|
103
|
+
const mark = step.blocker ? '✖' : step.attempted ? '✔' : '·';
|
|
104
|
+
console.log(`${mark} ${step.id}${step.detail ? ` — ${step.detail}` : ''}${step.blocker ? ` (${step.blocker})` : ''}`);
|
|
105
|
+
}
|
|
106
|
+
if (report.stage_id)
|
|
107
|
+
console.log(`\nStage id: ${report.stage_id}`);
|
|
108
|
+
for (const action of report.next_actions)
|
|
109
|
+
console.log(`- ${action}`);
|
|
110
|
+
return report;
|
|
111
|
+
}
|
|
112
|
+
function spawnRunner(root) {
|
|
113
|
+
return (command, commandArgs, opts = {}) => {
|
|
114
|
+
const result = spawnSync(command, [...commandArgs], {
|
|
115
|
+
cwd: root,
|
|
116
|
+
encoding: 'utf8',
|
|
117
|
+
maxBuffer: 1024 * 1024 * 20,
|
|
118
|
+
...(opts.timeoutMs ? { timeout: opts.timeoutMs } : {})
|
|
119
|
+
});
|
|
120
|
+
return { status: result.status, stdout: String(result.stdout || ''), stderr: String(result.stderr || '') };
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function readOption(args, name) {
|
|
124
|
+
const index = args.indexOf(name);
|
|
125
|
+
const value = index >= 0 ? args[index + 1] : null;
|
|
126
|
+
return value && !value.startsWith('-') ? value : null;
|
|
127
|
+
}
|
|
66
128
|
async function findReleaseReadinessReport(root) {
|
|
67
129
|
const candidates = [
|
|
68
130
|
path.join(root, 'release-readiness-report.json'),
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { isHelpRequest } from '../../cli/help.js';
|
|
2
3
|
import { globalSksRoot, projectRoot, readJson, sha256 } from '../fsx.js';
|
|
3
4
|
import { findRemoteMachine, loadRemoteMachineRegistry, remoteMachineRegistryPath, remoteReadiness, RemoteWorker, resolveAllowedProjectRoot, runRemoteWorkerJsonl, selectWorkerMachine, validateRemoteMachineRegistry } from '../remote/index.js';
|
|
4
5
|
export async function remoteCommand(args = []) {
|
|
6
|
+
if (isHelpRequest(args)) {
|
|
7
|
+
printRemoteUsage();
|
|
8
|
+
return { schema: 'sks.remote-command.v1', ok: true, action: 'help' };
|
|
9
|
+
}
|
|
5
10
|
const action = args[0] ?? 'readiness';
|
|
6
11
|
const rest = args.slice(1);
|
|
7
12
|
const json = args.includes('--json');
|
|
@@ -90,6 +95,19 @@ function readOption(args, name) {
|
|
|
90
95
|
const index = args.indexOf(name);
|
|
91
96
|
return index >= 0 && args[index + 1] ? String(args[index + 1]) : null;
|
|
92
97
|
}
|
|
98
|
+
function printRemoteUsage() {
|
|
99
|
+
console.log(`SKS Remote — local machine registry and worker transport
|
|
100
|
+
|
|
101
|
+
Usage:
|
|
102
|
+
sks remote readiness [--json]
|
|
103
|
+
sks remote machines list [--json]
|
|
104
|
+
sks remote machines validate [--json]
|
|
105
|
+
sks remote worker --stdio
|
|
106
|
+
|
|
107
|
+
The machine registry and session targets are written by \`sks telegram setup\`;
|
|
108
|
+
see docs/telegram-and-center.md for the end-to-end pairing flow.
|
|
109
|
+
`);
|
|
110
|
+
}
|
|
93
111
|
function fail(error, supported, json) {
|
|
94
112
|
process.exitCode = 2;
|
|
95
113
|
return print({ schema: 'sks.remote-command.v1', ok: false, error, supported }, json);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { flag } from '../../cli/args.js';
|
|
2
|
+
import { printJson } from '../../cli/output.js';
|
|
3
|
+
import { projectRoot } from '../fsx.js';
|
|
4
|
+
import { buildSearchDoctorReport, printSearchDoctorReport, runSearchEngineBenchmark, search, searchCapabilities, SEARCH_SCHEMA_VERSION } from '../search/index.js';
|
|
5
|
+
export async function searchCommand(subcommand = 'status', args = []) {
|
|
6
|
+
const action = subcommand || 'status';
|
|
7
|
+
if (action === 'status')
|
|
8
|
+
return statusCommand(args);
|
|
9
|
+
if (action === 'files')
|
|
10
|
+
return modeCommand('files', args);
|
|
11
|
+
if (action === 'text')
|
|
12
|
+
return modeCommand('text', args);
|
|
13
|
+
if (action === 'structure')
|
|
14
|
+
return modeCommand('structure', args);
|
|
15
|
+
if (action === 'symbol')
|
|
16
|
+
return modeCommand('symbol', args);
|
|
17
|
+
if (action === 'context')
|
|
18
|
+
return modeCommand('context', args);
|
|
19
|
+
if (action === 'benchmark' || action === 'bench')
|
|
20
|
+
return benchmarkCommand(args);
|
|
21
|
+
if (action === 'doctor')
|
|
22
|
+
return doctorCommand(args);
|
|
23
|
+
if (action === 'help')
|
|
24
|
+
return helpCommand();
|
|
25
|
+
return helpCommand();
|
|
26
|
+
}
|
|
27
|
+
async function statusCommand(args) {
|
|
28
|
+
const root = await projectRoot(process.cwd());
|
|
29
|
+
const caps = await searchCapabilities(root);
|
|
30
|
+
if (flag(args, '--json') || args.includes('--json'))
|
|
31
|
+
return printJson(caps);
|
|
32
|
+
console.log(`Search engines schemaVersion=${caps.schemaVersion}`);
|
|
33
|
+
for (const [mode, info] of Object.entries(caps.modes)) {
|
|
34
|
+
console.log(`- ${mode}: ${info.available ? 'available' : 'unavailable'} via ${info.provider}/${info.engine}`);
|
|
35
|
+
}
|
|
36
|
+
console.log(`Rust: ${caps.rust.available ? caps.rust.version : 'js_fallback'}`);
|
|
37
|
+
if (caps.warnings.length)
|
|
38
|
+
console.log(`Warnings: ${caps.warnings.join(', ')}`);
|
|
39
|
+
return caps;
|
|
40
|
+
}
|
|
41
|
+
async function modeCommand(mode, args) {
|
|
42
|
+
const root = readOption(args, '--root') || (await projectRoot(process.cwd()));
|
|
43
|
+
const pattern = readOption(args, '--pattern') || positional(args).join(' ').trim();
|
|
44
|
+
const language = readOption(args, '--language') || undefined;
|
|
45
|
+
const include = readMulti(args, '--include');
|
|
46
|
+
const exclude = readMulti(args, '--exclude');
|
|
47
|
+
const json = flag(args, '--json') || args.includes('--json');
|
|
48
|
+
if (!pattern && mode !== 'files') {
|
|
49
|
+
throw new Error(`Usage: sks search ${mode} <pattern> [--json] [--include glob] [--exclude glob]`);
|
|
50
|
+
}
|
|
51
|
+
const request = {
|
|
52
|
+
schemaVersion: SEARCH_SCHEMA_VERSION,
|
|
53
|
+
mode,
|
|
54
|
+
root,
|
|
55
|
+
caseSensitive: !args.includes('--ignore-case'),
|
|
56
|
+
limits: {
|
|
57
|
+
maxMatches: numOption(args, '--max-matches', 500),
|
|
58
|
+
timeoutMs: numOption(args, '--timeout-ms', 30_000)
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
if (mode === 'files' || mode === 'symbol' || mode === 'context')
|
|
62
|
+
request.query = pattern;
|
|
63
|
+
if (mode === 'text' || mode === 'structure')
|
|
64
|
+
request.pattern = pattern;
|
|
65
|
+
if (language)
|
|
66
|
+
request.language = language;
|
|
67
|
+
if (include.length)
|
|
68
|
+
request.include = include;
|
|
69
|
+
if (exclude.length)
|
|
70
|
+
request.exclude = exclude;
|
|
71
|
+
const why = readOption(args, '--why');
|
|
72
|
+
if (why)
|
|
73
|
+
request.why = why;
|
|
74
|
+
const result = await search(request);
|
|
75
|
+
if (json)
|
|
76
|
+
return printJson(result);
|
|
77
|
+
console.log(`${mode}: ${result.ok ? 'ok' : 'failed'} provider=${result.provider} matches=${result.matches.length} spawns=${result.processSpawns}`);
|
|
78
|
+
for (const m of result.matches.slice(0, 30)) {
|
|
79
|
+
const loc = m.line ? `:${m.line}${m.column ? `:${m.column}` : ''}` : '';
|
|
80
|
+
console.log(` ${m.path}${loc} [${m.confidence}] ${m.text || ''}`.trim());
|
|
81
|
+
}
|
|
82
|
+
if (result.matches.length > 30)
|
|
83
|
+
console.log(` ... ${result.matches.length - 30} more`);
|
|
84
|
+
if (result.errors.length)
|
|
85
|
+
console.log(`Errors: ${result.errors.join(', ')}`);
|
|
86
|
+
if (!result.ok)
|
|
87
|
+
process.exitCode = 1;
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
async function benchmarkCommand(args) {
|
|
91
|
+
const report = await runSearchEngineBenchmark({ writeArtifacts: true });
|
|
92
|
+
if (flag(args, '--json') || args.includes('--json'))
|
|
93
|
+
return printJson(report);
|
|
94
|
+
console.log(`Benchmark: ${report.summary.ok_count}/${report.summary.scenario_count} ok`);
|
|
95
|
+
console.log(`Artifacts: .sneakoscope/reports/search-engine-benchmark.json, docs/performance/search-engine-benchmark.md`);
|
|
96
|
+
return report;
|
|
97
|
+
}
|
|
98
|
+
async function doctorCommand(args) {
|
|
99
|
+
const report = await buildSearchDoctorReport(args);
|
|
100
|
+
printSearchDoctorReport(report, flag(args, '--json') || args.includes('--json'));
|
|
101
|
+
if (!report.ok)
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
return report;
|
|
104
|
+
}
|
|
105
|
+
function helpCommand() {
|
|
106
|
+
console.log(`sks search status --json
|
|
107
|
+
sks search files <query> [--json]
|
|
108
|
+
sks search text <pattern> [--json] [--ignore-case]
|
|
109
|
+
sks search structure <kind> [name] --language typescript [--json]
|
|
110
|
+
sks search symbol <ident> [--json]
|
|
111
|
+
sks search context <query> [--why reason] [--json]
|
|
112
|
+
sks search benchmark --json
|
|
113
|
+
sks search doctor --json`);
|
|
114
|
+
}
|
|
115
|
+
function readOption(args, name) {
|
|
116
|
+
const idx = args.indexOf(name);
|
|
117
|
+
if (idx < 0)
|
|
118
|
+
return null;
|
|
119
|
+
return args[idx + 1] || null;
|
|
120
|
+
}
|
|
121
|
+
function readMulti(args, name) {
|
|
122
|
+
const out = [];
|
|
123
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
124
|
+
if (args[i] === name && args[i + 1]) {
|
|
125
|
+
out.push(args[i + 1]);
|
|
126
|
+
i += 1;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
function numOption(args, name, fallback) {
|
|
132
|
+
const raw = readOption(args, name);
|
|
133
|
+
if (!raw)
|
|
134
|
+
return fallback;
|
|
135
|
+
const n = Number(raw);
|
|
136
|
+
return Number.isFinite(n) ? n : fallback;
|
|
137
|
+
}
|
|
138
|
+
function positional(args) {
|
|
139
|
+
const out = [];
|
|
140
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
141
|
+
const a = args[i];
|
|
142
|
+
if (a.startsWith('--')) {
|
|
143
|
+
if (a === '--json' || a === '--ignore-case')
|
|
144
|
+
continue;
|
|
145
|
+
i += 1;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
out.push(a);
|
|
149
|
+
}
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
@@ -1,125 +1,257 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { isHelpRequest } from '../../cli/help.js';
|
|
3
|
+
import { globalSksRoot, projectRoot, readJson, readStdin } from '../fsx.js';
|
|
4
|
+
import { RemoteCodexSessionBindingStore, loadRemoteMachineRegistry, loadRemoteSessionIndex, remoteCodexSessionBindingsPath, remoteMachineRegistryPath, remoteSessionIndexPath, validateRemoteMachineRegistry, validateRemoteSessionIndex } from '../remote/index.js';
|
|
5
|
+
import { loadTelegramConfig, resolveTelegramBotToken, TelegramActionBroker, TelegramAuditLedger, TelegramBotApiClient, TelegramHubRouter, TelegramHubRuntime, TelegramIdempotencyLedger, TelegramOwnerLock, TelegramMessageProjector, TelegramPollingHub, TelegramTopicRegistry, installAndStartTelegramHubService, restartTelegramHubService, setupTelegramLocalCoding, stopTelegramHubService, telegramHubPaths, telegramHubServiceStatus, telegramTokenFingerprint, validateTelegramConfig, validateTelegramPrivatePairing } from '../telegram/index.js';
|
|
5
6
|
export async function telegramCommand(args = []) {
|
|
7
|
+
if (isHelpRequest(args)) {
|
|
8
|
+
printTelegramUsage();
|
|
9
|
+
return { schema: 'sks.telegram-command.v1', ok: true, action: 'help' };
|
|
10
|
+
}
|
|
6
11
|
const action = args[0] ?? 'status';
|
|
7
12
|
const root = globalSksRoot();
|
|
8
13
|
const paths = telegramHubPaths(root);
|
|
9
14
|
const configPath = readOption(args, '--config') ?? paths.config;
|
|
10
15
|
const json = args.includes('--json');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const validation = validateTelegramConfig(await readJson(configPath, null));
|
|
44
|
-
return print({ schema: 'sks.telegram-config-validation.v1', ...validation, config: validation.config ? redactConfig(validation.config) : null }, json);
|
|
45
|
-
}
|
|
46
|
-
if (action === 'hub') {
|
|
47
|
-
const config = await loadTelegramConfig(configPath);
|
|
48
|
-
const controllingRoot = path.resolve(readOption(args, '--project-root') ?? await projectRoot());
|
|
49
|
-
const machineRegistry = await loadRemoteMachineRegistry(readOption(args, '--machines') ?? remoteMachineRegistryPath(root));
|
|
50
|
-
const sessionIndex = await loadRemoteSessionIndex(readOption(args, '--session-index') ?? remoteSessionIndexPath(controllingRoot), machineRegistry);
|
|
51
|
-
const token = await resolveTelegramBotToken(config.bot_token_ref);
|
|
52
|
-
const fingerprint = telegramTokenFingerprint(token);
|
|
53
|
-
const owner = new TelegramOwnerLock({
|
|
54
|
-
lockPath: paths.owner,
|
|
55
|
-
tokenFingerprint: fingerprint,
|
|
56
|
-
...(config.owner_stale_ms === undefined ? {} : { staleMs: config.owner_stale_ms })
|
|
57
|
-
});
|
|
58
|
-
await owner.acquire();
|
|
59
|
-
const topics = new TelegramTopicRegistry(paths.topics);
|
|
60
|
-
const actions = new TelegramActionBroker(paths.actions);
|
|
61
|
-
const audit = new TelegramAuditLedger(paths.audit, fingerprint);
|
|
62
|
-
const router = new TelegramHubRouter({
|
|
63
|
-
config,
|
|
64
|
-
topics,
|
|
65
|
-
idempotency: new TelegramIdempotencyLedger(paths.idempotency),
|
|
66
|
-
actions,
|
|
67
|
-
audit
|
|
68
|
-
});
|
|
69
|
-
const api = new TelegramBotApiClient(token, { timeoutMs: (config.long_poll_timeout_sec ?? 25) * 1000 + 5_000 });
|
|
70
|
-
const runtime = new TelegramHubRuntime({
|
|
71
|
-
config,
|
|
72
|
-
router,
|
|
73
|
-
topics,
|
|
74
|
-
actions,
|
|
75
|
-
audit,
|
|
76
|
-
projector: new TelegramMessageProjector(api, {
|
|
77
|
-
rich_message: true,
|
|
78
|
-
rich_draft: true,
|
|
79
|
-
plain_draft: true,
|
|
80
|
-
reactions: true
|
|
81
|
-
}, {
|
|
82
|
-
protectContent: config.protect_content !== false,
|
|
83
|
-
silent: config.silent_notifications === true
|
|
84
|
-
}),
|
|
85
|
-
machineRegistry,
|
|
86
|
-
sessionIndex,
|
|
87
|
-
projectionStatePath: paths.projection
|
|
88
|
-
});
|
|
89
|
-
const polling = new TelegramPollingHub(api, runtime, owner, config.long_poll_timeout_sec ?? 25);
|
|
90
|
-
try {
|
|
91
|
-
await polling.ensureLongPollingAllowed();
|
|
92
|
-
const sync = await runtime.initialize();
|
|
93
|
-
if (args.includes('--once')) {
|
|
94
|
-
const result = await polling.pollOnce();
|
|
95
|
-
return print({ schema: 'sks.telegram-hub-run.v1', ...result, sync }, json);
|
|
16
|
+
try {
|
|
17
|
+
if (action === 'status') {
|
|
18
|
+
return print(await telegramStatus(args, root, paths, configPath), json);
|
|
19
|
+
}
|
|
20
|
+
if (action === 'setup') {
|
|
21
|
+
if (!args.includes('--bot-token-stdin'))
|
|
22
|
+
return fail('bot_token_stdin_required', ['setup --bot-token-stdin --project-root <path>'], json);
|
|
23
|
+
const token = (await readStdin()).trim();
|
|
24
|
+
const controllingRoot = path.resolve(readOption(args, '--project-root') ?? await projectRoot());
|
|
25
|
+
const result = await setupTelegramLocalCoding({
|
|
26
|
+
token,
|
|
27
|
+
projectRoot: controllingRoot,
|
|
28
|
+
pairedChatId: readOption(args, '--paired-chat-id'),
|
|
29
|
+
pairedUserId: readOption(args, '--paired-user-id'),
|
|
30
|
+
resetSession: args.includes('--new-session'),
|
|
31
|
+
globalRoot: root
|
|
32
|
+
});
|
|
33
|
+
return print(result, json);
|
|
34
|
+
}
|
|
35
|
+
if (action === 'validate-config') {
|
|
36
|
+
const validation = validateTelegramConfig(await readJson(configPath, null));
|
|
37
|
+
return print({ schema: 'sks.telegram-config-validation.v1', ...validation, config: validation.config ? redactConfig(validation.config) : null }, json);
|
|
38
|
+
}
|
|
39
|
+
if (action === 'hub') {
|
|
40
|
+
const hubAction = args[1] && !String(args[1]).startsWith('-') ? String(args[1]) : 'run';
|
|
41
|
+
const controllingRoot = path.resolve(readOption(args, '--project-root') ?? await projectRoot());
|
|
42
|
+
if (hubAction === 'start') {
|
|
43
|
+
await assertHubSetupReady(controllingRoot, root, configPath);
|
|
44
|
+
return print(await installAndStartTelegramHubService({ projectRoot: controllingRoot, globalRoot: root }), json);
|
|
45
|
+
}
|
|
46
|
+
if (hubAction === 'stop') {
|
|
47
|
+
return print(await stopTelegramHubService({ projectRoot: controllingRoot, globalRoot: root }), json);
|
|
96
48
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
process.once('SIGTERM', stop);
|
|
101
|
-
try {
|
|
102
|
-
const result = await polling.run(controller.signal);
|
|
103
|
-
return print({ schema: 'sks.telegram-hub-run.v1', ...result, sync }, json);
|
|
49
|
+
if (hubAction === 'restart') {
|
|
50
|
+
await assertHubSetupReady(controllingRoot, root, configPath);
|
|
51
|
+
return print(await restartTelegramHubService({ projectRoot: controllingRoot, globalRoot: root }), json);
|
|
104
52
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
process.off('SIGTERM', stop);
|
|
53
|
+
if (hubAction === 'status') {
|
|
54
|
+
return print(await telegramHubServiceStatus({ projectRoot: controllingRoot, globalRoot: root }), json);
|
|
108
55
|
}
|
|
56
|
+
if (hubAction !== 'run')
|
|
57
|
+
return fail('unknown_hub_action', ['hub run', 'hub start', 'hub stop', 'hub restart', 'hub status'], json);
|
|
58
|
+
return runHub(args, root, paths, configPath, json);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
return print({
|
|
64
|
+
schema: 'sks.telegram-command-error.v1',
|
|
65
|
+
ok: false,
|
|
66
|
+
error: publicError(err)
|
|
67
|
+
}, json);
|
|
68
|
+
}
|
|
69
|
+
return fail('unknown_action', [
|
|
70
|
+
'status',
|
|
71
|
+
'setup --bot-token-stdin --project-root <path>',
|
|
72
|
+
'validate-config',
|
|
73
|
+
'hub run|start|stop|restart|status'
|
|
74
|
+
], json);
|
|
75
|
+
}
|
|
76
|
+
async function telegramStatus(args, root, paths, configPath) {
|
|
77
|
+
const rawConfig = await readJson(configPath, null);
|
|
78
|
+
const validation = validateTelegramConfig(rawConfig);
|
|
79
|
+
const owner = await readJson(paths.owner, null);
|
|
80
|
+
const topics = await new TelegramTopicRegistry(paths.topics).list();
|
|
81
|
+
const controllingRoot = path.resolve(readOption(args, '--project-root') ?? await projectRoot());
|
|
82
|
+
const machineRegistryRaw = await readJson(readOption(args, '--machines') ?? remoteMachineRegistryPath(root), null);
|
|
83
|
+
const machineValidation = validateRemoteMachineRegistry(machineRegistryRaw);
|
|
84
|
+
const sessionIndexRaw = await readJson(readOption(args, '--session-index') ?? remoteSessionIndexPath(controllingRoot), null);
|
|
85
|
+
const sessionValidation = machineValidation.registry
|
|
86
|
+
? validateRemoteSessionIndex(sessionIndexRaw, machineValidation.registry)
|
|
87
|
+
: { ok: false, issues: ['remote_machine_registry_invalid'], index: null };
|
|
88
|
+
const bindings = await new RemoteCodexSessionBindingStore(remoteCodexSessionBindingsPath(controllingRoot)).list().catch(() => []);
|
|
89
|
+
const targets = sessionValidation.index?.targets ?? [];
|
|
90
|
+
const registered = bindings.filter((binding) => targets.some((target) => (binding.machine_id === target.machine_id
|
|
91
|
+
&& binding.project_id === target.project_id
|
|
92
|
+
&& path.resolve(binding.project_root) === path.resolve(target.project_root))));
|
|
93
|
+
const service = await telegramHubServiceStatus({ projectRoot: controllingRoot, globalRoot: root });
|
|
94
|
+
let tokenConfigured = false;
|
|
95
|
+
if (validation.config) {
|
|
96
|
+
tokenConfigured = await resolveTelegramBotToken(validation.config.bot_token_ref).then(() => true).catch(() => false);
|
|
97
|
+
}
|
|
98
|
+
const pairing = telegramPairingReadiness(rawConfig);
|
|
99
|
+
const blockers = [
|
|
100
|
+
...validation.issues.map((issue) => `config:${issue}`),
|
|
101
|
+
...machineValidation.issues.map((issue) => `machine:${issue}`),
|
|
102
|
+
...sessionValidation.issues.map((issue) => `target:${issue}`),
|
|
103
|
+
...(tokenConfigured ? [] : ['telegram_token_not_available']),
|
|
104
|
+
...(pairing.blocker ? [pairing.blocker] : []),
|
|
105
|
+
...(registered.length ? [] : ['no_registered_codex_session']),
|
|
106
|
+
...(service.running ? [] : ['telegram_hub_not_running'])
|
|
107
|
+
];
|
|
108
|
+
return {
|
|
109
|
+
schema: 'sks.telegram-status.v1',
|
|
110
|
+
ok: blockers.length === 0,
|
|
111
|
+
configured: rawConfig !== null,
|
|
112
|
+
token_configured: tokenConfigured,
|
|
113
|
+
pairing_valid: pairing.pairing_valid,
|
|
114
|
+
pairing_issues: pairing.pairing_issues,
|
|
115
|
+
hub_running: service.running,
|
|
116
|
+
service,
|
|
117
|
+
config_issues: validation.issues,
|
|
118
|
+
owner: owner ? {
|
|
119
|
+
pid: owner.pid,
|
|
120
|
+
host: owner.host,
|
|
121
|
+
process_start_time: owner.process_start_time,
|
|
122
|
+
bot_token_fingerprint: owner.bot_token_fingerprint,
|
|
123
|
+
heartbeat_at: owner.heartbeat_at
|
|
124
|
+
} : null,
|
|
125
|
+
topic_count: topics.length,
|
|
126
|
+
machine_count: machineValidation.registry?.machines.length ?? 0,
|
|
127
|
+
target_count: sessionValidation.index?.targets.length ?? 0,
|
|
128
|
+
registered_session_count: registered.length,
|
|
129
|
+
registered_sessions: registered.map((binding) => ({
|
|
130
|
+
session_id: binding.session_id,
|
|
131
|
+
machine_id: binding.machine_id,
|
|
132
|
+
project_id: binding.project_id,
|
|
133
|
+
codex_thread_id: binding.codex_thread_id,
|
|
134
|
+
last_turn_status: binding.last_turn_status ?? null,
|
|
135
|
+
updated_at: binding.updated_at
|
|
136
|
+
})),
|
|
137
|
+
remote_config_issues: [...machineValidation.issues, ...sessionValidation.issues],
|
|
138
|
+
blockers
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function printTelegramUsage() {
|
|
142
|
+
console.log(`SKS Telegram Hub — private, local, single-operator remote coding
|
|
143
|
+
|
|
144
|
+
Usage:
|
|
145
|
+
sks telegram status [--project-root <path>] [--json]
|
|
146
|
+
sks telegram setup --bot-token-stdin --project-root <path> [--paired-chat-id <id>]
|
|
147
|
+
[--paired-user-id <id>] [--new-session] [--json]
|
|
148
|
+
sks telegram validate-config [--config <path>] [--json]
|
|
149
|
+
sks telegram hub start|stop|restart|status [--project-root <path>] [--json]
|
|
150
|
+
sks telegram hub run [--project-root <path>] [--json]
|
|
151
|
+
|
|
152
|
+
Pairing (do these first):
|
|
153
|
+
1. Create a private bot with @BotFather in Telegram and copy its token.
|
|
154
|
+
2. Send /start to that bot from the Telegram account you want to pair.
|
|
155
|
+
3. printf '%s' "<token>" | sks telegram setup --bot-token-stdin --project-root "$PWD" --json
|
|
156
|
+
The token is read from stdin only and stored in the macOS Keychain.
|
|
157
|
+
4. sks telegram hub start --project-root "$PWD" --json
|
|
158
|
+
|
|
159
|
+
The same flow is available in SKS Center → Remote & Telegram.
|
|
160
|
+
See docs/telegram-and-center.md for the full guide and troubleshooting.
|
|
161
|
+
`);
|
|
162
|
+
}
|
|
163
|
+
export function telegramPairingReadiness(value) {
|
|
164
|
+
const pairing = validateTelegramPrivatePairing(value);
|
|
165
|
+
return {
|
|
166
|
+
pairing_valid: pairing.ok,
|
|
167
|
+
pairing_issues: pairing.issues,
|
|
168
|
+
blocker: pairing.ok
|
|
169
|
+
? null
|
|
170
|
+
: pairing.missing
|
|
171
|
+
? 'telegram_pairing_missing'
|
|
172
|
+
: `telegram_pairing_invalid:${pairing.issues.join(',')}`
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async function runHub(args, root, paths, configPath, json) {
|
|
176
|
+
const config = await loadTelegramConfig(configPath);
|
|
177
|
+
const controllingRoot = path.resolve(readOption(args, '--project-root') ?? await projectRoot());
|
|
178
|
+
const machineRegistry = await loadRemoteMachineRegistry(readOption(args, '--machines') ?? remoteMachineRegistryPath(root));
|
|
179
|
+
const sessionIndex = await loadRemoteSessionIndex(readOption(args, '--session-index') ?? remoteSessionIndexPath(controllingRoot), machineRegistry);
|
|
180
|
+
const token = await resolveTelegramBotToken(config.bot_token_ref);
|
|
181
|
+
const fingerprint = telegramTokenFingerprint(token);
|
|
182
|
+
const owner = new TelegramOwnerLock({
|
|
183
|
+
lockPath: paths.owner,
|
|
184
|
+
tokenFingerprint: fingerprint,
|
|
185
|
+
...(config.owner_stale_ms === undefined ? {} : { staleMs: config.owner_stale_ms })
|
|
186
|
+
});
|
|
187
|
+
await owner.acquire();
|
|
188
|
+
const topics = new TelegramTopicRegistry(paths.topics);
|
|
189
|
+
const actions = new TelegramActionBroker(paths.actions);
|
|
190
|
+
const audit = new TelegramAuditLedger(paths.audit, fingerprint);
|
|
191
|
+
const router = new TelegramHubRouter({
|
|
192
|
+
config,
|
|
193
|
+
topics,
|
|
194
|
+
idempotency: new TelegramIdempotencyLedger(paths.idempotency),
|
|
195
|
+
actions,
|
|
196
|
+
audit
|
|
197
|
+
});
|
|
198
|
+
const api = new TelegramBotApiClient(token, { timeoutMs: (config.long_poll_timeout_sec ?? 25) * 1000 + 5_000 });
|
|
199
|
+
const runtime = new TelegramHubRuntime({
|
|
200
|
+
config,
|
|
201
|
+
router,
|
|
202
|
+
topics,
|
|
203
|
+
actions,
|
|
204
|
+
audit,
|
|
205
|
+
projector: new TelegramMessageProjector(api, {
|
|
206
|
+
rich_message: true,
|
|
207
|
+
rich_draft: true,
|
|
208
|
+
plain_draft: true,
|
|
209
|
+
reactions: true
|
|
210
|
+
}, {
|
|
211
|
+
protectContent: config.protect_content !== false,
|
|
212
|
+
silent: config.silent_notifications === true
|
|
213
|
+
}),
|
|
214
|
+
machineRegistry,
|
|
215
|
+
sessionIndex,
|
|
216
|
+
projectionStatePath: paths.projection
|
|
217
|
+
});
|
|
218
|
+
const polling = new TelegramPollingHub(api, runtime, owner, config.long_poll_timeout_sec ?? 25);
|
|
219
|
+
try {
|
|
220
|
+
await polling.ensureLongPollingAllowed();
|
|
221
|
+
const sync = await runtime.initialize();
|
|
222
|
+
if (args.includes('--once')) {
|
|
223
|
+
const result = await polling.pollOnce();
|
|
224
|
+
return print({ schema: 'sks.telegram-hub-run.v1', ...result, sync }, json);
|
|
225
|
+
}
|
|
226
|
+
const controller = new AbortController();
|
|
227
|
+
const stop = () => controller.abort();
|
|
228
|
+
process.once('SIGINT', stop);
|
|
229
|
+
process.once('SIGTERM', stop);
|
|
230
|
+
try {
|
|
231
|
+
const result = await polling.run(controller.signal);
|
|
232
|
+
return print({ schema: 'sks.telegram-hub-run.v1', ...result, sync }, json);
|
|
109
233
|
}
|
|
110
234
|
finally {
|
|
111
|
-
|
|
112
|
-
|
|
235
|
+
process.off('SIGINT', stop);
|
|
236
|
+
process.off('SIGTERM', stop);
|
|
113
237
|
}
|
|
114
238
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
239
|
+
finally {
|
|
240
|
+
await runtime.close();
|
|
241
|
+
await owner.release();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async function assertHubSetupReady(controllingRoot, globalRoot, configPath) {
|
|
245
|
+
const config = await loadTelegramConfig(configPath);
|
|
246
|
+
await resolveTelegramBotToken(config.bot_token_ref);
|
|
247
|
+
const registry = await loadRemoteMachineRegistry(remoteMachineRegistryPath(globalRoot));
|
|
248
|
+
const index = await loadRemoteSessionIndex(remoteSessionIndexPath(controllingRoot), registry);
|
|
249
|
+
const bindings = await new RemoteCodexSessionBindingStore(remoteCodexSessionBindingsPath(controllingRoot)).list();
|
|
250
|
+
if (!bindings.some((binding) => index.targets.some((target) => (target.machine_id === binding.machine_id
|
|
251
|
+
&& target.project_id === binding.project_id
|
|
252
|
+
&& path.resolve(target.project_root) === path.resolve(binding.project_root))))) {
|
|
253
|
+
throw new Error('no_registered_codex_session');
|
|
254
|
+
}
|
|
123
255
|
}
|
|
124
256
|
function readOption(args, name) {
|
|
125
257
|
const index = args.indexOf(name);
|
|
@@ -141,3 +273,14 @@ function print(value, json) {
|
|
|
141
273
|
console.log(JSON.stringify(value, null, 2));
|
|
142
274
|
return value;
|
|
143
275
|
}
|
|
276
|
+
function fail(error, supported, json) {
|
|
277
|
+
process.exitCode = 2;
|
|
278
|
+
return print({ schema: 'sks.telegram-command.v1', ok: false, error, supported }, json);
|
|
279
|
+
}
|
|
280
|
+
function publicError(err) {
|
|
281
|
+
const value = err instanceof Error ? err.message : String(err);
|
|
282
|
+
return value
|
|
283
|
+
.replace(/\b\d{5,}:[A-Za-z0-9_-]{20,}\b/g, '[redacted]')
|
|
284
|
+
.replace(/(?:\/Users|\/home)\/[^\s]+/g, '[path-redacted]')
|
|
285
|
+
.slice(0, 500);
|
|
286
|
+
}
|
|
@@ -5,7 +5,7 @@ import readline from 'node:readline/promises';
|
|
|
5
5
|
import { stdin as input, stdout as output } from 'node:process';
|
|
6
6
|
import { ensureDir, exists, readJson, readText, runProcess, writeJsonAtomic } from '../fsx.js';
|
|
7
7
|
import { ui as cliUi } from '../../cli/cli-theme.js';
|
|
8
|
-
import { uninstallSksMenuBar } from '../codex-app/
|
|
8
|
+
import { uninstallSksMenuBar } from '../codex-app/menubar/index.js';
|
|
9
9
|
import { writeCodexConfigGuarded } from '../codex/codex-config-guard.js';
|
|
10
10
|
import { sweepSksTempDirs } from '../retention.js';
|
|
11
11
|
import { reconcileSkills } from '../init/skills.js';
|