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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import fsp from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { ensureDir, exists, globalSksRoot, runProcess, writeTextAtomic } from '../fsx.js';
|
|
5
|
+
export const TELEGRAM_HUB_LAUNCH_LABEL = 'com.sneakoscope.telegram-hub';
|
|
6
|
+
export function telegramHubServicePaths(globalRoot = globalSksRoot(), home = process.env.HOME || os.homedir()) {
|
|
7
|
+
const root = path.resolve(globalRoot);
|
|
8
|
+
const logs = path.join(root, 'telegram', 'logs');
|
|
9
|
+
return {
|
|
10
|
+
global_root: root,
|
|
11
|
+
launch_agent_path: path.join(path.resolve(home), 'Library', 'LaunchAgents', `${TELEGRAM_HUB_LAUNCH_LABEL}.plist`),
|
|
12
|
+
stdout_log_path: path.join(logs, 'hub.out.log'),
|
|
13
|
+
stderr_log_path: path.join(logs, 'hub.err.log')
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function telegramHubLaunchAgentSource(input) {
|
|
17
|
+
const args = [
|
|
18
|
+
'/usr/bin/caffeinate',
|
|
19
|
+
'-i',
|
|
20
|
+
input.nodeBin,
|
|
21
|
+
input.sksEntry,
|
|
22
|
+
'telegram',
|
|
23
|
+
'hub',
|
|
24
|
+
'run',
|
|
25
|
+
'--project-root',
|
|
26
|
+
path.resolve(input.projectRoot),
|
|
27
|
+
'--json'
|
|
28
|
+
];
|
|
29
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
30
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
31
|
+
<plist version="1.0"><dict>
|
|
32
|
+
<key>Label</key><string>${TELEGRAM_HUB_LAUNCH_LABEL}</string>
|
|
33
|
+
<key>ProgramArguments</key><array>${args.map((value) => `<string>${xml(value)}</string>`).join('')}</array>
|
|
34
|
+
<key>RunAtLoad</key><true/>
|
|
35
|
+
<key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
|
|
36
|
+
<key>ProcessType</key><string>Background</string>
|
|
37
|
+
<key>ThrottleInterval</key><integer>5</integer>
|
|
38
|
+
<key>StandardOutPath</key><string>${xml(input.paths.stdout_log_path)}</string>
|
|
39
|
+
<key>StandardErrorPath</key><string>${xml(input.paths.stderr_log_path)}</string>
|
|
40
|
+
</dict></plist>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
export async function installAndStartTelegramHubService(options) {
|
|
44
|
+
const platform = options.platform ?? process.platform;
|
|
45
|
+
const paths = telegramHubServicePaths(options.globalRoot, options.home);
|
|
46
|
+
if (platform !== 'darwin')
|
|
47
|
+
return unsupportedStatus(paths, 'telegram_launch_agent_requires_macos', options.uid);
|
|
48
|
+
const nodeBin = path.resolve(options.nodeBin ?? process.execPath);
|
|
49
|
+
const sksEntry = path.resolve(options.sksEntry ?? process.argv[1] ?? '');
|
|
50
|
+
if (!await exists(nodeBin) || !await exists(sksEntry))
|
|
51
|
+
throw new Error('telegram_launch_agent_runtime_missing');
|
|
52
|
+
await ensureDir(path.dirname(paths.launch_agent_path));
|
|
53
|
+
await ensureDir(path.dirname(paths.stdout_log_path));
|
|
54
|
+
const plist = telegramHubLaunchAgentSource({
|
|
55
|
+
nodeBin,
|
|
56
|
+
sksEntry,
|
|
57
|
+
projectRoot: options.projectRoot,
|
|
58
|
+
paths
|
|
59
|
+
});
|
|
60
|
+
await writeTextAtomic(paths.launch_agent_path, plist, { mode: 0o644 });
|
|
61
|
+
const run = options.run ?? runProcess;
|
|
62
|
+
const launchctl = options.launchctl ?? '/bin/launchctl';
|
|
63
|
+
const domain = launchDomain(options.uid);
|
|
64
|
+
const service = `${domain}/${TELEGRAM_HUB_LAUNCH_LABEL}`;
|
|
65
|
+
await run(launchctl, ['bootout', service], { timeoutMs: 5_000, maxOutputBytes: 16 * 1024 }).catch(() => undefined);
|
|
66
|
+
const bootstrap = await run(launchctl, ['bootstrap', domain, paths.launch_agent_path], {
|
|
67
|
+
timeoutMs: 10_000,
|
|
68
|
+
maxOutputBytes: 32 * 1024
|
|
69
|
+
});
|
|
70
|
+
if (bootstrap.code !== 0 && !bootstrap.timedOut) {
|
|
71
|
+
return {
|
|
72
|
+
...(await telegramHubServiceStatus({ ...options, run, launchctl })),
|
|
73
|
+
ok: false,
|
|
74
|
+
error: boundedError(bootstrap.stderr || bootstrap.stdout || 'launchctl_bootstrap_failed')
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
await run(launchctl, ['kickstart', '-k', service], { timeoutMs: 10_000, maxOutputBytes: 32 * 1024 }).catch(() => undefined);
|
|
78
|
+
return waitForTelegramHubService({ ...options, run, launchctl });
|
|
79
|
+
}
|
|
80
|
+
export async function stopTelegramHubService(options) {
|
|
81
|
+
const paths = telegramHubServicePaths(options.globalRoot, options.home);
|
|
82
|
+
const platform = options.platform ?? process.platform;
|
|
83
|
+
if (platform !== 'darwin')
|
|
84
|
+
return unsupportedStatus(paths, 'telegram_launch_agent_requires_macos', options.uid);
|
|
85
|
+
const run = options.run ?? runProcess;
|
|
86
|
+
const launchctl = options.launchctl ?? '/bin/launchctl';
|
|
87
|
+
const service = `${launchDomain(options.uid)}/${TELEGRAM_HUB_LAUNCH_LABEL}`;
|
|
88
|
+
const stopped = await run(launchctl, ['bootout', service], { timeoutMs: 8_000, maxOutputBytes: 32 * 1024 });
|
|
89
|
+
const status = await telegramHubServiceStatus({ ...options, run, launchctl });
|
|
90
|
+
if (!status.running)
|
|
91
|
+
return { ...status, ok: true, loaded: false, error: null };
|
|
92
|
+
return {
|
|
93
|
+
...status,
|
|
94
|
+
ok: false,
|
|
95
|
+
error: boundedError(stopped.stderr || stopped.stdout || 'launchctl_bootout_failed')
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export async function restartTelegramHubService(options) {
|
|
99
|
+
await stopTelegramHubService(options).catch(() => undefined);
|
|
100
|
+
return installAndStartTelegramHubService(options);
|
|
101
|
+
}
|
|
102
|
+
export async function telegramHubServiceStatus(options) {
|
|
103
|
+
const paths = telegramHubServicePaths(options.globalRoot, options.home);
|
|
104
|
+
const service = `${launchDomain(options.uid)}/${TELEGRAM_HUB_LAUNCH_LABEL}`;
|
|
105
|
+
if ((options.platform ?? process.platform) !== 'darwin') {
|
|
106
|
+
return unsupportedStatus(paths, 'telegram_launch_agent_requires_macos', options.uid);
|
|
107
|
+
}
|
|
108
|
+
const installed = await exists(paths.launch_agent_path);
|
|
109
|
+
const run = options.run ?? runProcess;
|
|
110
|
+
const launchctl = options.launchctl ?? '/bin/launchctl';
|
|
111
|
+
const result = await run(launchctl, ['print', service], { timeoutMs: 3_000, maxOutputBytes: 32 * 1024 })
|
|
112
|
+
.catch((error) => ({
|
|
113
|
+
code: 1,
|
|
114
|
+
stdout: '',
|
|
115
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
116
|
+
timedOut: false
|
|
117
|
+
}));
|
|
118
|
+
const text = `${result.stdout || ''}\n${result.stderr || ''}`;
|
|
119
|
+
const state = text.match(/^[ \t]*state = ([^\n]+)/m)?.[1]?.trim() ?? null;
|
|
120
|
+
const pidText = text.match(/^[ \t]*pid = (\d+)/m)?.[1] ?? null;
|
|
121
|
+
const pid = pidText ? Number(pidText) : null;
|
|
122
|
+
const loaded = result.code === 0;
|
|
123
|
+
const running = loaded && state === 'running' && Boolean(pid);
|
|
124
|
+
return {
|
|
125
|
+
schema: 'sks.telegram-hub-service.v1',
|
|
126
|
+
ok: running,
|
|
127
|
+
supported: true,
|
|
128
|
+
installed,
|
|
129
|
+
loaded,
|
|
130
|
+
running,
|
|
131
|
+
state,
|
|
132
|
+
pid,
|
|
133
|
+
service,
|
|
134
|
+
launch_agent_path: paths.launch_agent_path,
|
|
135
|
+
error: running ? null : loaded ? 'telegram_hub_not_running' : boundedError(result.stderr || result.stdout || 'telegram_hub_not_loaded')
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export async function removeTelegramHubService(options) {
|
|
139
|
+
await stopTelegramHubService(options).catch(() => undefined);
|
|
140
|
+
const paths = telegramHubServicePaths(options.globalRoot, options.home);
|
|
141
|
+
await fsp.unlink(paths.launch_agent_path).catch(() => undefined);
|
|
142
|
+
const status = await telegramHubServiceStatus(options);
|
|
143
|
+
return { ...status, installed: false, ok: !status.running };
|
|
144
|
+
}
|
|
145
|
+
function unsupportedStatus(paths, error, uid) {
|
|
146
|
+
return {
|
|
147
|
+
schema: 'sks.telegram-hub-service.v1',
|
|
148
|
+
ok: false,
|
|
149
|
+
supported: false,
|
|
150
|
+
installed: false,
|
|
151
|
+
loaded: false,
|
|
152
|
+
running: false,
|
|
153
|
+
state: null,
|
|
154
|
+
pid: null,
|
|
155
|
+
service: `${launchDomain(uid)}/${TELEGRAM_HUB_LAUNCH_LABEL}`,
|
|
156
|
+
launch_agent_path: paths.launch_agent_path,
|
|
157
|
+
error
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
async function waitForTelegramHubService(options) {
|
|
161
|
+
let status = await telegramHubServiceStatus(options);
|
|
162
|
+
for (let attempt = 0; attempt < 25 && !status.running; attempt += 1) {
|
|
163
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
164
|
+
status = await telegramHubServiceStatus(options);
|
|
165
|
+
}
|
|
166
|
+
return status;
|
|
167
|
+
}
|
|
168
|
+
function launchDomain(uid = typeof process.getuid === 'function' ? process.getuid() : 0) {
|
|
169
|
+
return `gui/${uid}`;
|
|
170
|
+
}
|
|
171
|
+
function boundedError(value) {
|
|
172
|
+
return String(value || '').replace(/(?:\/Users|\/home)\/[^\s]+/g, '[path-redacted]').slice(0, 500);
|
|
173
|
+
}
|
|
174
|
+
function xml(value) {
|
|
175
|
+
return value
|
|
176
|
+
.replace(/&/g, '&')
|
|
177
|
+
.replace(/</g, '<')
|
|
178
|
+
.replace(/>/g, '>')
|
|
179
|
+
.replace(/"/g, '"')
|
|
180
|
+
.replace(/'/g, ''');
|
|
181
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { ensureDir, globalSksRoot, nowIso, readJson, runProcess, sha256, which, writeJsonAtomic } from '../fsx.js';
|
|
4
|
+
import { REMOTE_MACHINE_REGISTRY_SCHEMA, REMOTE_SESSION_INDEX_SCHEMA, RemoteCodexSessionBindingStore, remoteCodexSessionBindingsPath, remoteMachineRegistryPath, remoteSessionIndexPath, validateAllowedRoot, validateRemoteMachineRegistry, validateRemoteSessionIndex } from '../remote/index.js';
|
|
5
|
+
import { TelegramBotApiClient } from './bot-api.js';
|
|
6
|
+
import { isPositiveTelegramId, validateTelegramBotToken } from './config.js';
|
|
7
|
+
import { telegramHubPaths } from './hub.js';
|
|
8
|
+
const KEYCHAIN_SERVICE = 'com.sneakoscope.telegram.bot';
|
|
9
|
+
const KEYCHAIN_WRITER_SWIFT = `import Foundation
|
|
10
|
+
import Security
|
|
11
|
+
let a=CommandLine.arguments[1],s=CommandLine.arguments[2]
|
|
12
|
+
guard let k=String(data:FileHandle.standardInput.readDataToEndOfFile(),encoding:.utf8)?.trimmingCharacters(in:.whitespacesAndNewlines),!k.isEmpty else{exit(64)}
|
|
13
|
+
let q:[String:Any]=[kSecClass as String:kSecClassGenericPassword,kSecAttrAccount as String:a,kSecAttrService as String:s]
|
|
14
|
+
let v:[String:Any]=[kSecValueData as String:Data(k.utf8)]
|
|
15
|
+
var r=SecItemUpdate(q as CFDictionary,v as CFDictionary)
|
|
16
|
+
if r==errSecItemNotFound{var n=q;n[kSecValueData as String]=Data(k.utf8);r=SecItemAdd(n as CFDictionary,nil)}
|
|
17
|
+
if r != errSecSuccess{FileHandle.standardError.write(Data("keychain_status=\\(r)\\n".utf8));exit(1)}`;
|
|
18
|
+
export async function setupTelegramLocalCoding(input) {
|
|
19
|
+
const token = validateTelegramBotToken(input.token.trim());
|
|
20
|
+
const explicitPair = normalizeExplicitPair(input.pairedChatId, input.pairedUserId);
|
|
21
|
+
const projectRoot = await canonicalProjectRoot(input.projectRoot);
|
|
22
|
+
const rootIssue = validateAllowedRoot(projectRoot);
|
|
23
|
+
if (rootIssue)
|
|
24
|
+
throw new Error(`telegram_project_root_invalid:${rootIssue}`);
|
|
25
|
+
const globalRoot = path.resolve(input.globalRoot ?? globalSksRoot());
|
|
26
|
+
const api = input.api ?? new TelegramBotApiClient(token, { timeoutMs: 12_000, maxRetries: 0 });
|
|
27
|
+
const bot = await api.call('getMe', {});
|
|
28
|
+
const pairing = explicitPair ?? await detectPrivateStart(api);
|
|
29
|
+
const account = input.account?.trim() || process.env.USER || os.userInfo().username || 'sks';
|
|
30
|
+
await (input.keychainWriter ?? writeTelegramKeychain)(token, KEYCHAIN_SERVICE, account);
|
|
31
|
+
const hostname = input.hostname ?? os.hostname();
|
|
32
|
+
const machineId = `local-${sha256(hostname).slice(0, 12)}`;
|
|
33
|
+
const projectId = `project-${sha256(projectRoot).slice(0, 12)}`;
|
|
34
|
+
const sessionId = `telegram-${sha256(`${machineId}:${projectId}`).slice(0, 12)}`;
|
|
35
|
+
const bindingStore = new RemoteCodexSessionBindingStore(remoteCodexSessionBindingsPath(projectRoot));
|
|
36
|
+
const existingBinding = await bindingStore.find(sessionId);
|
|
37
|
+
const binding = existingBinding && input.resetSession !== true
|
|
38
|
+
? existingBinding
|
|
39
|
+
: await bindingStore.upsert({
|
|
40
|
+
session_id: sessionId,
|
|
41
|
+
machine_id: machineId,
|
|
42
|
+
project_id: projectId,
|
|
43
|
+
project_root: projectRoot,
|
|
44
|
+
codex_thread_id: null,
|
|
45
|
+
last_turn_id: null,
|
|
46
|
+
last_turn_status: null
|
|
47
|
+
});
|
|
48
|
+
const machinePath = remoteMachineRegistryPath(globalRoot);
|
|
49
|
+
const registry = await upsertLocalMachine(machinePath, {
|
|
50
|
+
id: machineId,
|
|
51
|
+
display_name: `This Mac (${hostname})`.slice(0, 120),
|
|
52
|
+
transport: 'local',
|
|
53
|
+
allowed_roots: [projectRoot],
|
|
54
|
+
enabled: true
|
|
55
|
+
});
|
|
56
|
+
const indexPath = remoteSessionIndexPath(projectRoot);
|
|
57
|
+
await upsertLocalTarget(indexPath, registry, {
|
|
58
|
+
machine_id: machineId,
|
|
59
|
+
project_id: projectId,
|
|
60
|
+
project_root: projectRoot
|
|
61
|
+
});
|
|
62
|
+
const config = {
|
|
63
|
+
schema: 'sks.telegram-config.v1',
|
|
64
|
+
bot_token_ref: { type: 'keychain', service: KEYCHAIN_SERVICE, account },
|
|
65
|
+
paired_chat_ids: [pairing.chatId],
|
|
66
|
+
paired_user_ids: [pairing.userId],
|
|
67
|
+
long_poll_timeout_sec: 25,
|
|
68
|
+
owner_stale_ms: 60_000,
|
|
69
|
+
protect_content: true,
|
|
70
|
+
silent_notifications: false
|
|
71
|
+
};
|
|
72
|
+
const configPath = telegramHubPaths(globalRoot).config;
|
|
73
|
+
await writeJsonAtomic(configPath, config);
|
|
74
|
+
return {
|
|
75
|
+
schema: 'sks.telegram-setup.v1',
|
|
76
|
+
ok: true,
|
|
77
|
+
bot: {
|
|
78
|
+
id: bot?.id === undefined ? null : String(bot.id),
|
|
79
|
+
username: bot?.username ? String(bot.username) : null
|
|
80
|
+
},
|
|
81
|
+
pairing: {
|
|
82
|
+
chat_id: pairing.chatId,
|
|
83
|
+
user_id: pairing.userId,
|
|
84
|
+
detected: explicitPair === null
|
|
85
|
+
},
|
|
86
|
+
machine_id: machineId,
|
|
87
|
+
project_id: projectId,
|
|
88
|
+
project_root: projectRoot,
|
|
89
|
+
session_id: sessionId,
|
|
90
|
+
codex_thread_id: binding.codex_thread_id,
|
|
91
|
+
codex_thread_state: binding.codex_thread_id ? 'ready' : 'pending_first_turn',
|
|
92
|
+
token_storage: 'macos-keychain',
|
|
93
|
+
config_path: configPath,
|
|
94
|
+
machine_registry_path: machinePath,
|
|
95
|
+
session_index_path: indexPath
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export async function detectPrivateStart(api) {
|
|
99
|
+
const updates = await api.getUpdates({ timeout: 0, allowed_updates: ['message'] });
|
|
100
|
+
const match = [...updates].reverse().find(isPrivateStart);
|
|
101
|
+
if (!match?.message?.from) {
|
|
102
|
+
throw new Error('telegram_pairing_start_not_found:send_/start_to_the_bot_then_retry');
|
|
103
|
+
}
|
|
104
|
+
await api.getUpdates({
|
|
105
|
+
offset: match.update_id + 1,
|
|
106
|
+
timeout: 0,
|
|
107
|
+
allowed_updates: ['message']
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
chatId: String(match.message.chat.id),
|
|
111
|
+
userId: String(match.message.from.id)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export async function writeTelegramKeychain(token, service, account) {
|
|
115
|
+
if (process.platform !== 'darwin')
|
|
116
|
+
throw new Error('telegram_keychain_requires_macos');
|
|
117
|
+
const swift = await which('swift').catch(() => null) || '/usr/bin/swift';
|
|
118
|
+
const result = await runProcess(swift, ['-e', KEYCHAIN_WRITER_SWIFT, account, service], {
|
|
119
|
+
input: `${token}\n`,
|
|
120
|
+
timeoutMs: 30_000,
|
|
121
|
+
maxOutputBytes: 8 * 1024
|
|
122
|
+
});
|
|
123
|
+
if (result.code !== 0 || result.timedOut)
|
|
124
|
+
throw new Error('telegram_keychain_store_failed');
|
|
125
|
+
}
|
|
126
|
+
async function upsertLocalMachine(file, machine) {
|
|
127
|
+
await ensureDir(path.dirname(file));
|
|
128
|
+
const raw = await readJson(file, null);
|
|
129
|
+
let registry;
|
|
130
|
+
if (raw === null) {
|
|
131
|
+
registry = { schema: REMOTE_MACHINE_REGISTRY_SCHEMA, machines: [] };
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const validated = validateRemoteMachineRegistry(raw);
|
|
135
|
+
if (!validated.ok || !validated.registry) {
|
|
136
|
+
throw new Error(`remote_machine_registry_invalid:${validated.issues.join(',')}`);
|
|
137
|
+
}
|
|
138
|
+
registry = validated.registry;
|
|
139
|
+
}
|
|
140
|
+
const machines = [...registry.machines];
|
|
141
|
+
const index = machines.findIndex((candidate) => candidate.id === machine.id);
|
|
142
|
+
if (index >= 0) {
|
|
143
|
+
const current = machines[index];
|
|
144
|
+
if (current.transport !== 'local')
|
|
145
|
+
throw new Error('remote_local_machine_id_conflict');
|
|
146
|
+
machines[index] = {
|
|
147
|
+
...machine,
|
|
148
|
+
allowed_roots: [...new Set([...current.allowed_roots, ...machine.allowed_roots])]
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
machines.push(machine);
|
|
153
|
+
const next = { schema: REMOTE_MACHINE_REGISTRY_SCHEMA, machines };
|
|
154
|
+
const validation = validateRemoteMachineRegistry(next);
|
|
155
|
+
if (!validation.ok || !validation.registry)
|
|
156
|
+
throw new Error(`remote_machine_registry_invalid:${validation.issues.join(',')}`);
|
|
157
|
+
await writeJsonAtomic(file, validation.registry);
|
|
158
|
+
return validation.registry;
|
|
159
|
+
}
|
|
160
|
+
async function upsertLocalTarget(file, registry, target) {
|
|
161
|
+
await ensureDir(path.dirname(file));
|
|
162
|
+
const raw = await readJson(file, null);
|
|
163
|
+
let index;
|
|
164
|
+
if (raw === null) {
|
|
165
|
+
index = { schema: REMOTE_SESSION_INDEX_SCHEMA, targets: [] };
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const validated = validateRemoteSessionIndex(raw, registry);
|
|
169
|
+
if (!validated.ok || !validated.index) {
|
|
170
|
+
throw new Error(`remote_session_index_invalid:${validated.issues.join(',')}`);
|
|
171
|
+
}
|
|
172
|
+
index = validated.index;
|
|
173
|
+
}
|
|
174
|
+
const targets = [...index.targets];
|
|
175
|
+
const found = targets.findIndex((candidate) => candidate.machine_id === target.machine_id && candidate.project_id === target.project_id);
|
|
176
|
+
if (found >= 0)
|
|
177
|
+
targets[found] = target;
|
|
178
|
+
else
|
|
179
|
+
targets.push(target);
|
|
180
|
+
const next = { schema: REMOTE_SESSION_INDEX_SCHEMA, targets };
|
|
181
|
+
const validation = validateRemoteSessionIndex(next, registry);
|
|
182
|
+
if (!validation.ok || !validation.index)
|
|
183
|
+
throw new Error(`remote_session_index_invalid:${validation.issues.join(',')}`);
|
|
184
|
+
await writeJsonAtomic(file, validation.index);
|
|
185
|
+
return validation.index;
|
|
186
|
+
}
|
|
187
|
+
async function canonicalProjectRoot(value) {
|
|
188
|
+
if (!path.isAbsolute(value))
|
|
189
|
+
throw new Error('telegram_project_root_must_be_absolute');
|
|
190
|
+
const fsp = await import('node:fs/promises');
|
|
191
|
+
const resolved = await fsp.realpath(path.resolve(value)).catch(() => null);
|
|
192
|
+
if (!resolved)
|
|
193
|
+
throw new Error('telegram_project_root_unreadable');
|
|
194
|
+
const stat = await fsp.stat(resolved).catch(() => null);
|
|
195
|
+
if (!stat?.isDirectory())
|
|
196
|
+
throw new Error('telegram_project_root_not_directory');
|
|
197
|
+
return resolved;
|
|
198
|
+
}
|
|
199
|
+
function normalizeExplicitPair(chatId, userId) {
|
|
200
|
+
const chat = String(chatId ?? '').trim();
|
|
201
|
+
const user = String(userId ?? '').trim();
|
|
202
|
+
if (!chat && !user)
|
|
203
|
+
return null;
|
|
204
|
+
if (!isPositiveTelegramId(chat) || !isPositiveTelegramId(user)) {
|
|
205
|
+
throw new Error('telegram_pairing_ids_must_be_positive_private_ids');
|
|
206
|
+
}
|
|
207
|
+
return { chatId: chat, userId: user };
|
|
208
|
+
}
|
|
209
|
+
function isPrivateStart(update) {
|
|
210
|
+
const message = update.message;
|
|
211
|
+
if (!message || message.chat.type !== 'private' || !message.from)
|
|
212
|
+
return false;
|
|
213
|
+
return /^\/start(?:@\w+)?(?:\s|$)/i.test(String(message.text || '').trim());
|
|
214
|
+
}
|
|
215
|
+
export function telegramSetupKeychainReference(account = process.env.USER || os.userInfo().username || 'sks') {
|
|
216
|
+
return { type: 'keychain', service: KEYCHAIN_SERVICE, account };
|
|
217
|
+
}
|
|
218
|
+
export function telegramSetupTimestamp() {
|
|
219
|
+
return nowIso();
|
|
220
|
+
}
|
|
@@ -3,6 +3,7 @@ import { ensureDir, nowIso, readJson, writeJsonAtomic } from '../fsx.js';
|
|
|
3
3
|
import { missionDir } from '../mission.js';
|
|
4
4
|
import { addWrongnessRecord } from './wrongness-ledger.js';
|
|
5
5
|
import { deterministicWrongnessId } from './wrongness-schema.js';
|
|
6
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
6
7
|
export const IMAGE_WRONGNESS_RECORD_SCHEMA = 'sks.image-wrongness.v1';
|
|
7
8
|
export const IMAGE_WRONGNESS_INDEX_SCHEMA = 'sks.image-wrongness-index.v1';
|
|
8
9
|
export function imageWrongnessIndexPath(root) {
|
|
@@ -133,9 +134,6 @@ function anchorIdFromIssue(issue) {
|
|
|
133
134
|
const match = issue.match(/anchor(?:_id|_bbox|_image_ref)?:([^:\s]+)/i);
|
|
134
135
|
return match?.[1] || null;
|
|
135
136
|
}
|
|
136
|
-
function asRecord(value) {
|
|
137
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
138
|
-
}
|
|
139
137
|
function stringOrNull(value) {
|
|
140
138
|
return typeof value === 'string' && value.trim() ? value.trim() : null;
|
|
141
139
|
}
|
|
@@ -6,6 +6,7 @@ import { withFileLock } from '../locks/file-lock.js';
|
|
|
6
6
|
import { findLatestMission, missionsDir } from '../mission.js';
|
|
7
7
|
import { codexSchemaPath, runCodexExecResumeWithOutputSchema } from '../codex-exec-output-schema.js';
|
|
8
8
|
import { WRONGNESS_INDEX_SCHEMA, WRONGNESS_LEDGER_SCHEMA, createWrongnessRecord, deterministicWrongnessId, emptyWrongnessLedger, normalizeRootCauseKind, normalizeSeverity, normalizeWrongnessKind, severityForRecord, validateWrongnessLedger } from './wrongness-schema.js';
|
|
9
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
9
10
|
const CANONICAL_MISSION_ID_RE = /^M-[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
10
11
|
export function projectWrongnessLedgerPath(root) {
|
|
11
12
|
return path.join(safeWrongnessWikiDir(root), 'wrongness-ledger.json');
|
|
@@ -588,9 +589,6 @@ function countBy(records, key) {
|
|
|
588
589
|
out[key(record)] = Number(out[key(record)] || 0) + 1;
|
|
589
590
|
return out;
|
|
590
591
|
}
|
|
591
|
-
function asRecord(value) {
|
|
592
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
593
|
-
}
|
|
594
592
|
export function highSeverityActive(records) {
|
|
595
593
|
return records.filter((record) => record.status === 'active' && ['high', 'critical'].includes(severityForRecord(record)));
|
|
596
594
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { nowIso } from '../fsx.js';
|
|
2
2
|
import { readCombinedWrongnessRecords, summarizeWrongnessRecords } from './wrongness-ledger.js';
|
|
3
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
3
4
|
export async function wrongnessProofEvidence(root, missionId = null, opts = {}) {
|
|
4
5
|
const records = await readCombinedWrongnessRecords(root, missionId);
|
|
5
6
|
const summary = summarizeWrongnessRecords(records);
|
|
@@ -43,9 +44,6 @@ export function claimReferencesActiveWrongness(claim, evidence) {
|
|
|
43
44
|
return false;
|
|
44
45
|
return asStringList(wrongness).some((id) => ids.has(id));
|
|
45
46
|
}
|
|
46
|
-
function asRecord(value) {
|
|
47
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
48
|
-
}
|
|
49
47
|
function asStringList(value) {
|
|
50
48
|
return Array.isArray(value) ? value.map((item) => String(item || '')).filter(Boolean) : [];
|
|
51
49
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { nowIso } from '../fsx.js';
|
|
2
2
|
import { readCombinedWrongnessRecords, summarizeWrongnessRecords } from './wrongness-ledger.js';
|
|
3
3
|
import { WRONGNESS_CONTEXT_SCHEMA } from './wrongness-schema.js';
|
|
4
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
4
5
|
export async function wrongnessContextForRoute(root, opts = {}) {
|
|
5
6
|
const missionId = opts.missionId ?? null;
|
|
6
7
|
const route = opts.route ?? null;
|
|
@@ -75,6 +76,3 @@ function severityRank(value) {
|
|
|
75
76
|
return 2;
|
|
76
77
|
return 1;
|
|
77
78
|
}
|
|
78
|
-
function asRecord(value) {
|
|
79
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
80
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { nowIso, randomId, sha256 } from '../fsx.js';
|
|
2
2
|
import { moduleIdsForPath } from '../triwiki/triwiki-module-card.js';
|
|
3
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
3
4
|
export const WRONGNESS_RECORD_SCHEMA = 'sks.triwiki-wrongness.v1';
|
|
4
5
|
export const WRONGNESS_LEDGER_SCHEMA = 'sks.triwiki-wrongness-ledger.v1';
|
|
5
6
|
export const WRONGNESS_INDEX_SCHEMA = 'sks.triwiki-wrongness-index.v1';
|
|
@@ -378,9 +379,6 @@ function severityForKind(kind) {
|
|
|
378
379
|
return 'medium';
|
|
379
380
|
return 'medium';
|
|
380
381
|
}
|
|
381
|
-
function asRecord(value) {
|
|
382
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
383
|
-
}
|
|
384
382
|
function asList(value) {
|
|
385
383
|
return Array.isArray(value) ? value : [];
|
|
386
384
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
1
2
|
export function evaluateWrongnessTrust(input = {}) {
|
|
2
3
|
const row = asRecord(input);
|
|
3
4
|
const proof = asRecord(row.proof ?? input);
|
|
@@ -71,9 +72,6 @@ function claimLinksActiveWrongness(proof, evidence) {
|
|
|
71
72
|
return wrongness.some((id) => activeIds.has(id));
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
|
-
function asRecord(value) {
|
|
75
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
76
|
-
}
|
|
77
75
|
function asStringList(value) {
|
|
78
76
|
return Array.isArray(value) ? value.map((item) => String(item || '')).filter(Boolean) : [];
|
|
79
77
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { validateCompletionProof } from '../proof/validation.js';
|
|
2
2
|
import { rootCauseAnalysisIssue } from '../proof/root-cause-policy.js';
|
|
3
|
-
|
|
4
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
5
|
-
}
|
|
3
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
6
4
|
function asList(value) {
|
|
7
5
|
return Array.isArray(value) ? value : [];
|
|
8
6
|
}
|
|
@@ -5,9 +5,7 @@ import { routeRequiresCompletionProof, routeRequiresImageVoxelAnchors } from '..
|
|
|
5
5
|
import { rootCauseAnalysisRequired } from '../proof/root-cause-policy.js';
|
|
6
6
|
import { ROUTE_COMPLETION_CONTRACT_SCHEMA, normalizeTrustStatus, trustKernelMetadata } from './trust-kernel-schema.js';
|
|
7
7
|
import { validateCompletionContract } from './completion-contract.js';
|
|
8
|
-
|
|
9
|
-
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
10
|
-
}
|
|
8
|
+
import { asRecordOrEmpty as asRecord } from '../json/records.js';
|
|
11
9
|
function asList(value) {
|
|
12
10
|
return Array.isArray(value) ? value : [];
|
|
13
11
|
}
|
|
@@ -9,6 +9,7 @@ import { reconcileSkills } from '../init/skills.js';
|
|
|
9
9
|
import { codexHookTrustDoctor } from '../codex-hooks/codex-hook-trust-doctor.js';
|
|
10
10
|
import { writeCodexConfigGuarded } from '../codex/codex-config-guard.js';
|
|
11
11
|
import { compareSemVer } from './semver.js';
|
|
12
|
+
import { escapeRegExp } from '../text/regex.js';
|
|
12
13
|
export const UPDATE_MIGRATION_SCHEMA = 'sks.project-migration-receipt.v2';
|
|
13
14
|
export const INSTALLATION_EPOCH_SCHEMA = 'sks.installation-epoch.v1';
|
|
14
15
|
export function installationEpochPath() {
|
|
@@ -715,9 +716,6 @@ function tomlLineKey(line) {
|
|
|
715
716
|
function ensureTrailingNewline(text) {
|
|
716
717
|
return `${String(text || '').trim()}\n`;
|
|
717
718
|
}
|
|
718
|
-
function escapeRegExp(value) {
|
|
719
|
-
return String(value || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
720
|
-
}
|
|
721
719
|
export async function ensureCurrentMigrationBeforeCommand(input) {
|
|
722
720
|
const env = input.env || process.env;
|
|
723
721
|
const command = input.command;
|
|
@@ -5,7 +5,7 @@ import { PACKAGE_VERSION, packageRoot, readJson, runProcess, throttleLines, whic
|
|
|
5
5
|
import { createRequestedScopeContract } from './safety/requested-scope-contract.js';
|
|
6
6
|
import { guardedPackageInstall, guardContextForRoute } from './safety/mutation-guard.js';
|
|
7
7
|
import { isUpdateMigrationReceiptCurrent, projectUpdateMigrationReceiptPath, resolveInstalledSksEntrypoint, runPackageLocalDoctor, writeProjectUpdateMigrationReceipt } from './update/update-migration-state.js';
|
|
8
|
-
import { inspectSksMenuBarStatus, installSksMenuBar, sksMenuBarPaths } from './codex-app/
|
|
8
|
+
import { inspectSksMenuBarStatus, installSksMenuBar, sksMenuBarPaths } from './codex-app/menubar/index.js';
|
|
9
9
|
import { inspectCodexCliUpdate } from './codex/codex-cli-update.js';
|
|
10
10
|
import { reconcileSkills } from './init/skills.js';
|
|
11
11
|
import { codexHookTrustDoctor } from './codex-hooks/codex-hook-trust-doctor.js';
|
|
@@ -234,6 +234,7 @@ export const UPDATE_STAGE_ORDER = [
|
|
|
234
234
|
'version_probe',
|
|
235
235
|
'new_version_doctor',
|
|
236
236
|
'hook_trust_repair',
|
|
237
|
+
'project_receipt',
|
|
237
238
|
'global_skills_reconcile',
|
|
238
239
|
'native_capability_setup',
|
|
239
240
|
'menubar_rebuild',
|
|
@@ -241,6 +242,13 @@ export const UPDATE_STAGE_ORDER = [
|
|
|
241
242
|
'final_self_verification',
|
|
242
243
|
'snapshot_refresh'
|
|
243
244
|
];
|
|
245
|
+
export function updateNestedProcessEnvironment(env) {
|
|
246
|
+
return {
|
|
247
|
+
...env,
|
|
248
|
+
SKS_UPDATE_DEFER_MENUBAR_RESTART: '1',
|
|
249
|
+
SKS_SKIP_SKS_MENUBAR_LAUNCH: '1'
|
|
250
|
+
};
|
|
251
|
+
}
|
|
244
252
|
export async function runSksUpdateReview(options = {}) {
|
|
245
253
|
const packageName = options.packageName || 'sneakoscope';
|
|
246
254
|
const registry = options.registry || DEFAULT_REGISTRY;
|
|
@@ -323,6 +331,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
323
331
|
const packageName = options.packageName || 'sneakoscope';
|
|
324
332
|
const registry = options.registry || DEFAULT_REGISTRY;
|
|
325
333
|
const env = options.env || process.env;
|
|
334
|
+
const nestedProcessEnv = updateNestedProcessEnvironment(env);
|
|
326
335
|
const npmBin = options.npmBin === undefined ? await which('npm') : options.npmBin;
|
|
327
336
|
const cwd = env.HOME || os.homedir();
|
|
328
337
|
const check = await runSksUpdateCheck({
|
|
@@ -472,6 +481,10 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
472
481
|
recordRegistryStage();
|
|
473
482
|
stage('temporary_install_smoke', true, 'skipped_current', { current: check.current });
|
|
474
483
|
stage('global_install', true, 'skipped_current', { current: check.current });
|
|
484
|
+
stage('resolve_new_binary', true, 'skipped_current', { current: check.current });
|
|
485
|
+
stage('version_probe', true, 'skipped_current', { current: check.current });
|
|
486
|
+
stage('new_version_doctor', true, 'skipped_current', { current: check.current });
|
|
487
|
+
stage('hook_trust_repair', true, 'skipped_current', { current: check.current });
|
|
475
488
|
const receipt = await writeProjectUpdateMigrationReceipt({
|
|
476
489
|
root: projectReceiptRoot,
|
|
477
490
|
source: 'update-now-current',
|
|
@@ -482,6 +495,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
482
495
|
const migrationCurrent = isUpdateMigrationReceiptCurrent(receipt);
|
|
483
496
|
stage('project_receipt', migrationCurrent, migrationCurrent ? 'current' : 'failed', { root: projectReceiptRoot });
|
|
484
497
|
await runUpdateGlobalSkillsReconcile(stage, { quiet: machineOutput, env });
|
|
498
|
+
stage('native_capability_setup', true, 'skipped_current', { reason: 'package_already_current' });
|
|
485
499
|
const sksMenuBar = migrationCurrent
|
|
486
500
|
? await installUpdateSksMenuBar({ root: projectReceiptRoot, env, stage, quiet: machineOutput })
|
|
487
501
|
: null;
|
|
@@ -543,7 +557,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
543
557
|
root: projectReceiptRoot,
|
|
544
558
|
args: ['doctor', '--fix', '--yes', '--profile', 'migration', '--machine-only', '--report-file', path.join(projectReceiptRoot, '.sneakoscope', 'update', 'old-version-doctor.json')],
|
|
545
559
|
env: {
|
|
546
|
-
...
|
|
560
|
+
...nestedProcessEnv,
|
|
547
561
|
...(env.SKS_TEST_OLD_DOCTOR_FAIL === '1' ? { SKS_TEST_DOCTOR_FAIL: '1' } : {})
|
|
548
562
|
},
|
|
549
563
|
timeoutMs: oldDoctorTimeoutMs,
|
|
@@ -563,7 +577,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
563
577
|
packageName,
|
|
564
578
|
version: installVersion,
|
|
565
579
|
registry,
|
|
566
|
-
env,
|
|
580
|
+
env: nestedProcessEnv,
|
|
567
581
|
...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
|
|
568
582
|
...(options.maxOutputBytes === undefined ? {} : { maxOutputBytes: options.maxOutputBytes })
|
|
569
583
|
});
|
|
@@ -615,7 +629,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
615
629
|
command: npmBin,
|
|
616
630
|
args: npmArgs,
|
|
617
631
|
cwd,
|
|
618
|
-
env,
|
|
632
|
+
env: nestedProcessEnv,
|
|
619
633
|
timeoutMs: options.timeoutMs ?? 10 * 60 * 1000,
|
|
620
634
|
maxOutputBytes: options.maxOutputBytes ?? 128 * 1024
|
|
621
635
|
};
|
|
@@ -660,7 +674,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
660
674
|
root: projectReceiptRoot,
|
|
661
675
|
entrypoint: newBinary,
|
|
662
676
|
args: ['doctor', '--fix', '--yes', '--profile', 'migration', '--machine-only', '--report-file', path.join(projectReceiptRoot, '.sneakoscope', 'update', 'new-version-doctor.json')],
|
|
663
|
-
env,
|
|
677
|
+
env: nestedProcessEnv,
|
|
664
678
|
timeoutMs: updateDoctorTimeoutMs(env),
|
|
665
679
|
maxOutputBytes: 32 * 1024
|
|
666
680
|
}), 60_000);
|
|
@@ -683,7 +697,7 @@ export async function runSksUpdateNow(options = {}) {
|
|
|
683
697
|
doctor: newVersionDoctor,
|
|
684
698
|
updateStages: stages,
|
|
685
699
|
fromVersion: check.current,
|
|
686
|
-
env
|
|
700
|
+
env: nestedProcessEnv
|
|
687
701
|
});
|
|
688
702
|
projectReceipt = receiptResult.receipt;
|
|
689
703
|
migrationCurrent = isUpdateMigrationReceiptCurrent(projectReceipt, installVersion);
|