sneakoscope 8.0.2 → 8.0.4
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 +150 -37
- package/config/skills-hash-ledger.v1.json +1 -1
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/fast-inline.js +55 -27
- package/dist/bin/install.js +6 -32
- package/dist/bin/sks-dispatch.js +1 -1
- package/dist/cli/args.js +0 -2
- package/dist/cli/cli-theme.js +18 -9
- package/dist/cli/command-manifest-lite.js +6 -6
- package/dist/cli/command-registry.js +6 -6
- package/dist/cli/feature-commands.js +9 -7
- package/dist/cli/install-helpers-codex-lb-chain.js +198 -7
- package/dist/cli/install-helpers-codex-lb-config.js +78 -10
- package/dist/cli/install-helpers-install-support.js +9 -6
- package/dist/cli/install-helpers.js +101 -49
- package/dist/cli/install-tool-helpers.js +2 -82
- package/dist/cli/output.js +6 -1
- package/dist/cli/router.js +101 -2
- package/dist/commands/codex-lb.js +119 -19
- package/dist/commands/doctor-profile.js +1 -1
- package/dist/commands/doctor.js +727 -144
- package/dist/commands/mad-sks.js +1 -5
- package/dist/config/skills-manifest.json +4 -2
- package/dist/core/agents/agent-codex-cockpit.js +0 -3
- package/dist/core/agents/agent-effort-policy.js +5 -5
- package/dist/core/agents/agent-janitor.js +0 -20
- package/dist/core/agents/agent-orchestrator.js +9 -56
- package/dist/core/agents/agent-output-validator.js +2 -3
- package/dist/core/agents/agent-patch-schema.js +2 -2
- package/dist/core/agents/agent-proof-evidence.js +0 -65
- package/dist/core/agents/agent-recursion-guard.js +1 -1
- package/dist/core/agents/agent-runner-codex-exec.js +5 -3
- package/dist/core/agents/agent-scheduler.js +327 -85
- package/dist/core/agents/agent-schema.js +1 -1
- package/dist/core/agents/agent-trust-report.js +0 -36
- package/dist/core/agents/agent-worker-pipeline.js +0 -1
- package/dist/core/agents/fast-mode-policy.js +1 -3
- package/dist/core/agents/native-cli-worker-runtime-proof.js +1 -1
- package/dist/core/agents/native-cli-worker-runtime.js +69 -647
- package/dist/core/agents/native-cli-worker.js +6 -7
- package/dist/core/agents/native-worker-backend-router.js +2 -32
- package/dist/core/agents/no-subagent-scaling-policy.js +1 -1
- package/dist/core/agents/parallel-runtime-proof.js +1 -6
- package/dist/core/agents/runtime-proof-summary.js +1 -35
- package/dist/core/architecture-hardening/contracts/contracts.js +193 -0
- package/dist/core/architecture-hardening/migration/migration.js +111 -0
- package/dist/core/architecture-hardening/state/state-service.js +155 -0
- package/dist/core/artifact-schemas.js +0 -3
- package/dist/core/codex/codex-config-guard.js +238 -52
- package/dist/core/codex-adapter.js +5 -3
- package/dist/core/codex-app/auxiliary-oauth-policy.js +36 -0
- package/dist/core/codex-app/catalog-compat/catalog-service.js +104 -0
- package/dist/core/codex-app/child-policy/child-policy.js +35 -0
- package/dist/core/codex-app/codex-app-handoff.js +0 -1
- package/dist/core/codex-app/codex-hook-lifecycle.js +1 -1
- package/dist/core/codex-app/codex-init-deep.js +1 -1
- package/dist/core/codex-app/menubar/app-bundle.js +2 -0
- package/dist/core/codex-app/menubar/constants.js +14 -1
- package/dist/core/codex-app/menubar/global-install.js +288 -0
- package/dist/core/codex-app/menubar/installer.js +79 -14
- package/dist/core/codex-app/menubar/launch-agent.js +267 -45
- package/dist/core/codex-app/menubar/paths.js +3 -0
- package/dist/core/codex-app/menubar/rollback.js +55 -7
- package/dist/core/codex-app/menubar/status.js +75 -4
- package/dist/core/codex-app/provider-child-policy.js +64 -0
- package/dist/core/codex-app/provider-mode.js +91 -0
- package/dist/core/codex-app/provider-operation-stages.js +20 -0
- package/dist/core/codex-app/provider-session-policy.js +85 -0
- package/dist/core/codex-app/session-policy/session-pinning.js +68 -0
- package/dist/core/codex-app.js +3 -2
- package/dist/core/codex-control/codex-0139-image-path-real-probe.js +3 -1
- package/dist/core/codex-control/codex-0139-web-search-probe.js +3 -1
- package/dist/core/codex-control/codex-app-server-runtime-env.js +13 -4
- package/dist/core/codex-control/codex-app-server-v2-client.js +3 -3
- package/dist/core/codex-control/codex-control-proof.js +0 -1
- package/dist/core/codex-control/codex-task-runner.js +1 -4
- package/dist/core/codex-exec-output-schema.js +4 -1
- package/dist/core/codex-lb/codex-lb-env.js +63 -72
- package/dist/core/codex-lb/codex-lb-setup.js +15 -2
- package/dist/core/codex-lb/desktop-bridge/header-policy.js +6 -0
- package/dist/core/codex-lb/desktop-bridge/http-forward.js +48 -6
- package/dist/core/codex-lb/desktop-bridge/security.js +134 -0
- package/dist/core/codex-lb/desktop-bridge/server.js +9 -3
- package/dist/core/codex-lb/desktop-bridge/state.js +26 -6
- package/dist/core/codex-lb/desktop-bridge/types.js +1 -0
- package/dist/core/codex-lb/desktop-center-credentials.js +517 -58
- package/dist/core/codex-lb/desktop-controller.js +177 -56
- package/dist/core/codex-lb/desktop-service.js +179 -40
- package/dist/core/codex-lb/legacy-migration.js +1 -3
- package/dist/core/codex-lb/native-openai-transport/transport.js +68 -0
- package/dist/core/codex-lb/probes/cli-image-tool-probe.js +1 -1
- package/dist/core/codex-lb/provider-routing/provider-router.js +58 -0
- package/dist/core/codex-lb/routing-truth.js +327 -0
- package/dist/core/codex-native/codex-native-feature-broker.js +4 -0
- package/dist/core/codex-native/codex-native-pattern-analysis.js +1 -2
- package/dist/core/codex-native/core-skill-manifest.js +1 -1
- package/dist/core/codex-plugins/codex-plugin-json.js +26 -6
- package/dist/core/codex-plugins/codex-plugin-repair.js +32 -6
- package/dist/core/commands/basic-cli.js +9 -7
- package/dist/core/commands/computer-use-command.js +1 -1
- package/dist/core/commands/image-ux-review-command.js +16 -9
- package/dist/core/commands/install-package-command.js +105 -0
- package/dist/core/commands/intent-normalization/normalizer.js +96 -0
- package/dist/core/commands/mad-sks-command.js +23 -274
- package/dist/core/commands/mad-sks-headless.js +11 -30
- package/dist/core/commands/naruto-command.js +0 -25
- package/dist/core/commands/qa-loop-command.js +104 -22
- package/dist/core/commands/remote-command.js +2 -2
- package/dist/core/commands/research-command.js +10 -5
- package/dist/core/commands/telegram-command.js +407 -0
- package/dist/core/config-adopt/config-adopt-command.js +35 -0
- package/dist/core/config-adopt/config-adopt.js +346 -0
- package/dist/core/config-adopt/index.js +3 -0
- package/dist/core/doctor/command-alias-cleanup.js +4 -1
- package/dist/core/doctor/current-project-guidance-nested.js +37 -6
- package/dist/core/doctor/current-project-guidance.js +15 -9
- package/dist/core/doctor/doctor-dirty-planner.js +1 -4
- package/dist/core/doctor/doctor-readiness-matrix.js +15 -18
- package/dist/core/doctor/retired-managed-residue-private.js +4 -3
- package/dist/core/doctor/retired-managed-residue-runtime.js +2 -2
- package/dist/core/doctor/skill-legacy-surface.js +11 -10
- package/dist/core/doctor/sks-menubar-doctor.js +4 -0
- package/dist/core/evaluation.js +0 -19
- package/dist/core/evidence/v2/evidence-key.js +105 -0
- package/dist/core/feature-fixtures.js +12 -7
- package/dist/core/feature-registry.js +52 -21
- package/dist/core/hooks-runtime/hook-context.js +9 -0
- package/dist/core/hooks-runtime/managed-skill-admission.js +54 -4
- package/dist/core/hooks-runtime/official-subagent-lifecycle.js +69 -52
- package/dist/core/hooks-runtime/stop-finalization.js +226 -0
- package/dist/core/hooks-runtime/stop-repeat-guard.js +21 -2
- package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +2 -2
- package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +3 -3
- package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +43 -5
- package/dist/core/hooks-runtime/subagent-skill-availability.js +64 -30
- package/dist/core/hooks-runtime/subagent-stop-hook.js +15 -2
- package/dist/core/hooks-runtime.js +179 -212
- package/dist/core/image/reference-evidence/reference-registry.js +145 -0
- package/dist/core/image-ux-review/imagegen-adapter.js +21 -9
- package/dist/core/image-ux-review/reference-policy/reference-policy.js +9 -0
- package/dist/core/imagegen/codex-lb-imagegen-target.js +8 -0
- package/dist/core/imagegen/imagegen-capability.js +59 -2
- package/dist/core/imagegen/require-imagegen.js +2 -2
- package/dist/core/init/skills.js +17 -3
- package/dist/core/init.js +3 -3
- package/dist/core/install/installed-package-smoke.js +23 -5
- package/dist/core/json/canonical.js +9 -0
- package/dist/core/locks/file-lock.js +0 -1
- package/dist/core/loops/loop-continuation-enforcer.js +65 -7
- package/dist/core/loops/loop-decomposer.js +0 -1
- package/dist/core/loops/loop-gate-runner.js +65 -4
- package/dist/core/loops/loop-gate-selector.js +0 -2
- package/dist/core/loops/loop-proof-validation.js +38 -0
- package/dist/core/loops/loop-risk-classifier.js +1 -1
- package/dist/core/loops/loop-runtime.js +14 -2
- package/dist/core/loops/loop-scheduler.js +7 -2
- package/dist/core/loops/loop-worker-runtime.js +0 -15
- package/dist/core/loops/loop-worktree-runtime.js +52 -4
- package/dist/core/managed-assets/managed-assets-manifest.js +14 -14
- package/dist/core/naruto/hardware-capacity-probe.js +9 -6
- package/dist/core/naruto/naruto-active-pool.js +2 -14
- package/dist/core/naruto/naruto-concurrency-governor.js +71 -31
- package/dist/core/naruto/naruto-loop-worker-router.js +0 -2
- package/dist/core/naruto/naruto-verification-dag.js +0 -1
- package/dist/core/naruto/naruto-write-e2e.js +1 -2
- package/dist/core/naruto/resource-pressure-monitor.js +0 -4
- package/dist/core/observability/architecture-hardening/safe-projection.js +65 -0
- package/dist/core/perf/import-graph-budget.js +0 -1
- package/dist/core/perf/release-latency-slo.js +3 -2
- package/dist/core/preflight/parallel-preflight-engine.js +2 -15
- package/dist/core/product-design-app-server.js +13 -1
- package/dist/core/proof/fake-real-proof-policy.js +2 -17
- package/dist/core/proof/route-proof-gate.js +2 -10
- package/dist/core/proof/route-proof-policy.js +1 -1
- package/dist/core/proof/runtime-evidence-policy.js +185 -0
- package/dist/core/proof/runtime-truth-matrix.js +64 -39
- package/dist/core/proof/validation.js +27 -11
- package/dist/core/provider/provider-context.js +18 -2
- package/dist/core/providers/openrouter/openrouter-account.js +3 -2
- package/dist/core/python-tools/python-tool-runner.js +1 -1
- package/dist/core/qa-loop/qa-execution-control.js +57 -0
- package/dist/core/questions.js +1 -1
- package/dist/core/release/extreme-parallel-scheduler.js +0 -3
- package/dist/core/release/gate-manifest.js +3 -7
- package/dist/core/release/gate-pack-manifest.js +3 -7
- package/dist/core/release/package-size-budget.js +2 -2
- package/dist/core/release/physical-release-gates.js +189 -0
- package/dist/core/release/publish-preflight.js +113 -0
- package/dist/core/release/release-gate-affected-selector.js +0 -2
- package/dist/core/release/release-gate-batch-runner.js +1 -1
- package/dist/core/release/release-gate-node.js +0 -1
- package/dist/core/release/release-gate-resource-governor.js +0 -1
- package/dist/core/release/release-pack-receipt.js +5 -8
- package/dist/core/release/release-real-contract.js +0 -6
- package/dist/core/release/resource-class-budget.js +0 -1
- package/dist/core/release/stage-publish.js +178 -36
- package/dist/core/research/research-adversarial-review.js +103 -9
- package/dist/core/research.js +1 -1
- package/dist/core/retention.js +0 -1
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes/diagnostic-allowlist.js +0 -1
- package/dist/core/routes/dollar-manifest-lite.js +1 -1
- package/dist/core/routes.js +46 -15
- package/dist/core/runtime/execution-control.js +226 -0
- package/dist/core/runtime/progress-recovery/progress-recovery.js +89 -0
- package/dist/core/runtime/task-profile.js +10 -4
- package/dist/core/runtime/verification-budget.js +10 -1
- package/dist/core/safety/intent-contract/intent-contract.js +94 -0
- package/dist/core/safety/mutation-guard.js +0 -2
- package/dist/core/safety/mutation-ledger.js +0 -2
- package/dist/core/safety/requested-scope-contract.js +0 -0
- package/dist/core/search-visibility/discovery.js +1 -1
- package/dist/core/search-visibility/index.js +12 -0
- package/dist/core/search-visibility/verifier.js +112 -3
- package/dist/core/security/private-credential-file.js +209 -0
- package/dist/core/session/project-namespace.js +0 -5
- package/dist/core/skills/skill-agent-metadata.js +1 -3
- package/dist/core/strategy/adhd-orchestrating-gate.js +0 -1
- package/dist/core/subagents/agent-catalog.js +19 -34
- package/dist/core/subagents/model-policy.js +65 -24
- package/dist/core/subagents/naruto-help-contract.js +8 -8
- package/dist/core/subagents/naruto-host-credentials.js +13 -0
- package/dist/core/subagents/official-subagent-config.js +16 -6
- package/dist/core/subagents/official-subagent-preparation.js +35 -16
- package/dist/core/subagents/official-subagent-prompt.js +7 -7
- package/dist/core/subagents/official-subagent-runner.js +27 -4
- package/dist/core/subagents/role-model-preferences.js +1 -1
- package/dist/core/subagents/thread-budget.js +19 -12
- package/dist/core/subagents/wave-lifecycle.js +18 -6
- package/dist/core/telegram/access.js +58 -0
- package/dist/core/telegram/client.js +157 -0
- package/dist/core/telegram/confirmation.js +37 -0
- package/dist/core/telegram/doctor.js +154 -0
- package/dist/core/telegram/index.js +9 -0
- package/dist/core/telegram/keychain.js +317 -0
- package/dist/core/telegram/liveness.js +118 -0
- package/dist/core/telegram/poller.js +90 -0
- package/dist/core/telegram/redaction.js +15 -0
- package/dist/core/telegram/state-lock.js +416 -0
- package/dist/core/telegram/types.js +1 -0
- package/dist/core/text/strings.js +3 -0
- package/dist/core/triwiki/context-graph/store/evidence-write-lock.js +29 -0
- package/dist/core/triwiki/context-graph/store/fragment-cache.js +24 -0
- package/dist/core/triwiki/context-graph/store/snapshot-store.js +69 -21
- package/dist/core/triwiki/triwiki-gate-impact-map.js +2 -2
- package/dist/core/triwiki/triwiki-module-card.js +1 -2
- package/dist/core/update/installed-cli-resolution.js +170 -0
- package/dist/core/update/update-diagnostics.js +52 -0
- package/dist/core/update/update-migration-state.js +30 -12
- package/dist/core/update/update-operation.js +2 -1
- package/dist/core/update/update-stage-diagnostics.js +38 -0
- package/dist/core/update/update-status.js +2 -9
- package/dist/core/update-check.js +279 -91
- package/dist/core/version.js +1 -1
- package/dist/native/sks-menubar/Sources/AppDelegate.swift +19 -1
- package/dist/native/sks-menubar/Sources/AppIdentity.swift +7 -0
- package/dist/native/sks-menubar/Sources/ControlCenterWindowController.swift +6 -2
- package/dist/native/sks-menubar/Sources/OperationCoordinator.swift +159 -92
- package/dist/native/sks-menubar/Sources/OperationModels.swift +389 -0
- package/dist/native/sks-menubar/Sources/OverviewViewController.swift +57 -0
- package/dist/native/sks-menubar/Sources/ProcessClient.swift +3 -1
- package/dist/native/sks-menubar/Sources/ProvidersConnectTest.swift +115 -0
- package/dist/native/sks-menubar/Sources/ProvidersFastMode.swift +17 -0
- package/dist/native/sks-menubar/Sources/ProvidersMultiProvider.swift +3 -0
- package/dist/native/sks-menubar/Sources/ProvidersOpenRouter.swift +58 -17
- package/dist/native/sks-menubar/Sources/ProvidersReliability.swift +302 -0
- package/dist/native/sks-menubar/Sources/ProvidersRoleModels.swift +5 -0
- package/dist/native/sks-menubar/Sources/ProvidersRoutingTruth.swift +190 -0
- package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +158 -126
- package/dist/native/sks-menubar/Sources/RemoteCodingViewController.swift +462 -26
- package/dist/native/sks-menubar/Sources/SKSKeychainStore.swift +344 -0
- package/dist/native/sks-menubar/Sources/SecureProcessEnvelope.swift +27 -0
- package/dist/native/sks-menubar/Sources/SingletonInstanceGuard.swift +328 -0
- package/dist/native/sks-menubar/Sources/StatusItemController.swift +10 -2
- package/dist/native/sks-menubar/Sources/TelegramPrivateFileStore.swift +498 -0
- package/dist/native/sks-menubar/Sources/TelegramPrivateFileSupport.swift +236 -0
- package/dist/native/sks-menubar/Sources/TelegramProcessGateway.swift +454 -0
- package/dist/native/sks-menubar/Sources/TelegramRuntimeSupport.swift +56 -0
- package/dist/native/sks-menubar/Sources/TelegramStateLock.swift +448 -0
- package/dist/native/sks-menubar/Sources/TelegramSupport.swift +187 -0
- package/dist/native/sks-menubar/Sources/TelegramTransport.swift +499 -0
- package/dist/native/sks-menubar/Sources/main.swift +15 -1
- package/dist/scripts/all-feature-deep-completion-check.js +5 -1
- package/dist/scripts/check-publish-tag.js +56 -0
- package/dist/scripts/codex-lb-fast-mode-truth-check.js +10 -3
- package/dist/scripts/codex-lb-fast-ui-preservation-check.js +12 -3
- package/dist/scripts/codex-lb-gpt56-fast-profile-check.js +4 -2
- package/dist/scripts/codex-native-agent-role-content-check.js +3 -3
- package/dist/scripts/codex-native-gate-lib.js +14 -7
- package/dist/scripts/current-command-surface-check.js +7 -7
- package/dist/scripts/current-surface-update-e2e-check.js +4 -3
- package/dist/scripts/current-upgrade-matrix-check.js +5 -24
- package/dist/scripts/docs-truthfulness-check.js +17 -13
- package/dist/scripts/gate-lib.js +0 -2
- package/dist/scripts/gate-policy-audit-check.js +3 -2
- package/dist/scripts/harness-benchmark-check.js +1 -1
- package/dist/scripts/init-deep-backup-retention-check.js +1 -1
- package/dist/scripts/lib/codex-sdk-gate-lib.js +1 -2
- package/dist/scripts/loop-directive-check-lib.js +28 -38
- package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +14 -180
- package/dist/scripts/mad-sks-launch-sql-plane-boundary-check.js +2 -11
- package/dist/scripts/official-subagent-workflow-check.js +1 -1
- package/dist/scripts/packlist-performance-check.js +1 -2
- package/dist/scripts/prepublish-release-check-or-fast.js +32 -0
- package/dist/scripts/publish-preflight.js +12 -0
- package/dist/scripts/release-affected-selector-check.js +2 -2
- package/dist/scripts/release-gate-batch-runner-check.js +2 -2
- package/dist/scripts/release-metadata-check.js +8 -12
- package/dist/scripts/release-real-check.js +2 -54
- package/dist/scripts/runtime-domain-gate-lib.js +2 -96
- package/dist/scripts/runtime-proof-summary-check.js +2 -6
- package/dist/scripts/search-visibility-gate-lib.js +0 -1
- package/dist/scripts/sks-cli-gate-lib.js +1 -1
- package/dist/scripts/typed-routing-gate-lib.js +7 -59
- package/docs/demo.tape +1 -1
- package/infra-harness-gates.json +1 -1456
- package/package.json +10 -7
- package/release-gates.v2.json +0 -1
- package/schemas/agents/parallel-runtime-proof.schema.json +0 -2
- package/schemas/codex/agent-result.schema.json +0 -6
- package/schemas/naruto/naruto-concurrency-governor.schema.json +1 -3
- package/schemas/release/release-gate-node.schema.json +1 -1
- package/dist/commands/zellij-lane.js +0 -22
- package/dist/commands/zellij-monitor-pane.js +0 -26
- package/dist/commands/zellij-slot-column-anchor.js +0 -22
- package/dist/commands/zellij-slot-pane.js +0 -80
- package/dist/commands/zellij-viewport-pane.js +0 -57
- package/dist/commands/zellij.js +0 -422
- package/dist/core/agents/agent-runner-zellij.js +0 -164
- package/dist/core/agents/agent-slot-pane-binding-proof.js +0 -96
- package/dist/core/agents/parallel-write-fixture.js +0 -305
- package/dist/core/agents/worker-pane-communication-contract.js +0 -100
- package/dist/core/agents/zellij-lane-supervisor.js +0 -428
- package/dist/core/agents/zellij-right-lane-cockpit.js +0 -66
- package/dist/core/doctor/doctor-zellij-repair.js +0 -40
- package/dist/core/ops/upgrade-migration-fixtures.js +0 -119
- package/dist/core/proof/route-finalizer-fixtures.js +0 -21
- package/dist/core/zellij/homebrew-policy.js +0 -43
- package/dist/core/zellij/zellij-capability.js +0 -126
- package/dist/core/zellij/zellij-clipboard-config.js +0 -52
- package/dist/core/zellij/zellij-command.js +0 -149
- package/dist/core/zellij/zellij-fake-adapter.js +0 -186
- package/dist/core/zellij/zellij-lane-renderer.js +0 -706
- package/dist/core/zellij/zellij-lane-runtime.js +0 -189
- package/dist/core/zellij/zellij-launcher.js +0 -268
- package/dist/core/zellij/zellij-layout-builder.js +0 -191
- package/dist/core/zellij/zellij-monitor-renderer.js +0 -52
- package/dist/core/zellij/zellij-official-subagent-activity.js +0 -526
- package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -258
- package/dist/core/zellij/zellij-pane-proof.js +0 -226
- package/dist/core/zellij/zellij-right-column-manager.js +0 -308
- package/dist/core/zellij/zellij-screen-proof.js +0 -120
- package/dist/core/zellij/zellij-self-heal-types.js +0 -44
- package/dist/core/zellij/zellij-self-heal.js +0 -408
- package/dist/core/zellij/zellij-slot-column-anchor.js +0 -304
- package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -521
- package/dist/core/zellij/zellij-slot-telemetry.js +0 -384
- package/dist/core/zellij/zellij-theme.js +0 -66
- package/dist/core/zellij/zellij-ui-mode.js +0 -34
- package/dist/core/zellij/zellij-update.js +0 -348
- package/dist/core/zellij/zellij-viewport-binder.js +0 -61
- package/dist/core/zellij/zellij-worker-pane-manager.js +0 -881
- package/dist/core/zellij/zellij-worker-pane-summary.js +0 -64
- package/dist/native/sks-menubar/Tests/AppRuntimeTestSupport.swift +0 -26
- package/dist/native/sks-menubar/Tests/OperationCoordinatorTests.swift +0 -174
- package/dist/native/sks-menubar/Tests/ProcessClientTests.swift +0 -20
- package/dist/native/sks-menubar/Tests/ProvidersViewControllerTests.swift +0 -142
- package/dist/scripts/zellij-pane-proof-check.js +0 -88
- package/dist/scripts/zellij-real-session-cleanup-check.js +0 -139
- package/dist/scripts/zellij-real-session-launch-check.js +0 -126
- package/dist/scripts/zellij-screen-proof-check.js +0 -43
- package/schemas/zellij/zellij-right-column-state.schema.json +0 -40
- package/schemas/zellij/zellij-slot-telemetry.schema.json +0 -89
- package/schemas/zellij/zellij-worker-pane.schema.json +0 -53
- package/scripts/build-clean-atomic.mjs +0 -323
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import fsp from 'node:fs/promises';
|
|
3
|
-
import { appendJsonlBounded, ensureDir, nowIso, readJson, readText, writeTextAtomic } from '../fsx.js';
|
|
4
|
-
import { withFileLock } from '../locks/file-lock.js';
|
|
5
|
-
export const ZELLIJ_SLOT_TELEMETRY_EVENT_SCHEMA = 'sks.zellij-slot-telemetry-event.v1';
|
|
6
|
-
export const ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA = 'sks.zellij-slot-telemetry-snapshot.v1';
|
|
7
|
-
export const ZELLIJ_SLOT_TELEMETRY_LOCK_TIMEOUT_MS = 2_000;
|
|
8
|
-
export const ZELLIJ_SLOT_TELEMETRY_LOCK_STALE_MS = 15_000;
|
|
9
|
-
const telemetrySnapshotCache = new Map();
|
|
10
|
-
const telemetrySnapshotWriteCounts = new Map();
|
|
11
|
-
const telemetrySnapshotFlushCounts = new Map();
|
|
12
|
-
const telemetrySnapshotLastFlushMs = new Map();
|
|
13
|
-
const telemetrySnapshotDiskStat = new Map();
|
|
14
|
-
export function slotTelemetryEventPath(root, missionId) {
|
|
15
|
-
return path.join(inferMissionDir(root, missionId), 'zellij', 'slot-telemetry.events.jsonl');
|
|
16
|
-
}
|
|
17
|
-
export function slotTelemetrySnapshotPath(root, missionId) {
|
|
18
|
-
return path.join(inferMissionDir(root, missionId), 'zellij', 'slot-telemetry.snapshot.json');
|
|
19
|
-
}
|
|
20
|
-
export async function appendZellijSlotTelemetry(root, event) {
|
|
21
|
-
const missionId = String(event?.mission_id || '').trim();
|
|
22
|
-
if (!missionId)
|
|
23
|
-
throw new Error('mission_id required for Zellij slot telemetry');
|
|
24
|
-
const normalized = normalizeTelemetryEvent(event);
|
|
25
|
-
const file = slotTelemetryEventPath(root, missionId);
|
|
26
|
-
await ensureDir(path.dirname(file));
|
|
27
|
-
await withFileLock({
|
|
28
|
-
lockPath: `${file}.append.lock`,
|
|
29
|
-
timeoutMs: ZELLIJ_SLOT_TELEMETRY_LOCK_TIMEOUT_MS,
|
|
30
|
-
staleMs: ZELLIJ_SLOT_TELEMETRY_LOCK_STALE_MS
|
|
31
|
-
}, async () => appendJsonlBounded(file, normalized));
|
|
32
|
-
const previous = await readZellijSlotTelemetrySnapshotNoRebuild(root, missionId);
|
|
33
|
-
if (previous) {
|
|
34
|
-
const snapshotPath = slotTelemetrySnapshotPath(root, missionId);
|
|
35
|
-
const next = applyTelemetryEventToSnapshot(previous, normalized);
|
|
36
|
-
telemetrySnapshotCache.set(snapshotPath, next);
|
|
37
|
-
if (shouldFlushTelemetrySnapshot(snapshotPath, normalized))
|
|
38
|
-
await writeTelemetrySnapshotFast(snapshotPath, next);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
await rebuildZellijSlotTelemetrySnapshot(root, missionId);
|
|
42
|
-
}
|
|
43
|
-
export async function readZellijSlotTelemetrySnapshot(root, missionId) {
|
|
44
|
-
const fresh = await readZellijSlotTelemetrySnapshotNoRebuild(root, missionId);
|
|
45
|
-
if (fresh)
|
|
46
|
-
return fresh;
|
|
47
|
-
return rebuildZellijSlotTelemetrySnapshot(root, missionId);
|
|
48
|
-
}
|
|
49
|
-
export async function readZellijSlotTelemetrySnapshotNoRebuild(root, missionId) {
|
|
50
|
-
const snapshotPath = slotTelemetrySnapshotPath(root, missionId);
|
|
51
|
-
const cached = telemetrySnapshotCache.get(snapshotPath);
|
|
52
|
-
const stat = await statTelemetryFile(snapshotPath);
|
|
53
|
-
const recorded = telemetrySnapshotDiskStat.get(snapshotPath);
|
|
54
|
-
const diskChanged = Boolean(stat) && (!recorded || recorded.mtimeMs !== stat.mtimeMs || recorded.size !== stat.size);
|
|
55
|
-
if (!diskChanged && cached?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA)
|
|
56
|
-
return cached;
|
|
57
|
-
const existing = await readJson(snapshotPath, null);
|
|
58
|
-
if (stat)
|
|
59
|
-
telemetrySnapshotDiskStat.set(snapshotPath, stat);
|
|
60
|
-
if (existing?.schema !== ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA) {
|
|
61
|
-
return cached?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA ? cached : null;
|
|
62
|
-
}
|
|
63
|
-
const disk = existing;
|
|
64
|
-
const merged = cached?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA ? mergeTelemetrySnapshots(disk, cached, { updatedAt: 'base' }) : disk;
|
|
65
|
-
telemetrySnapshotCache.set(snapshotPath, merged);
|
|
66
|
-
return merged;
|
|
67
|
-
}
|
|
68
|
-
export function mergeTelemetrySnapshots(base, overlay, opts = {}) {
|
|
69
|
-
const slots = { ...(base.slots || {}) };
|
|
70
|
-
for (const [key, row] of Object.entries(overlay.slots || {})) {
|
|
71
|
-
const existing = slots[key];
|
|
72
|
-
slots[key] = !existing ? row : newerSlotTelemetry(existing, row);
|
|
73
|
-
}
|
|
74
|
-
const baseTs = Date.parse(String(base.updated_at || '')) || 0;
|
|
75
|
-
const overlayTs = Date.parse(String(overlay.updated_at || '')) || 0;
|
|
76
|
-
return {
|
|
77
|
-
schema: ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA,
|
|
78
|
-
mission_id: base.mission_id || overlay.mission_id,
|
|
79
|
-
updated_at: opts.updatedAt === 'base' ? base.updated_at : overlayTs > baseTs ? overlay.updated_at : base.updated_at,
|
|
80
|
-
flush_count: Math.max(Number(base.flush_count || 0), Number(overlay.flush_count || 0)),
|
|
81
|
-
slots,
|
|
82
|
-
counts: countSlotTelemetry(slots)
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function telemetryTsMs(value) {
|
|
86
|
-
const parsed = Date.parse(String(value || ''));
|
|
87
|
-
return Number.isFinite(parsed) ? parsed : 0;
|
|
88
|
-
}
|
|
89
|
-
function newerSlotTelemetry(current, incoming) {
|
|
90
|
-
const currentTs = telemetryTsMs(current.latest_ts);
|
|
91
|
-
const incomingTs = telemetryTsMs(incoming.latest_ts);
|
|
92
|
-
const currentTerminal = isTelemetryTerminalStatus(current.status);
|
|
93
|
-
const incomingTerminal = isTelemetryTerminalStatus(incoming.status);
|
|
94
|
-
if (currentTerminal && !incomingTerminal)
|
|
95
|
-
return current;
|
|
96
|
-
if (!currentTerminal && incomingTerminal)
|
|
97
|
-
return incoming;
|
|
98
|
-
if (incomingTs > currentTs)
|
|
99
|
-
return incoming;
|
|
100
|
-
if (incomingTs < currentTs)
|
|
101
|
-
return current;
|
|
102
|
-
return incoming;
|
|
103
|
-
}
|
|
104
|
-
async function statTelemetryFile(file) {
|
|
105
|
-
try {
|
|
106
|
-
const st = await fsp.stat(file);
|
|
107
|
-
return { mtimeMs: st.mtimeMs, size: st.size };
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export function applyTelemetryEventToSnapshot(snapshot, event) {
|
|
114
|
-
const key = slotTelemetryKey(event.slot_id || event.worker_id, event.generation_index);
|
|
115
|
-
const previous = snapshot.slots?.[key];
|
|
116
|
-
const nextSlot = mergeSlotTelemetry(previous, event);
|
|
117
|
-
const slots = snapshot.slots || {};
|
|
118
|
-
slots[key] = nextSlot;
|
|
119
|
-
return {
|
|
120
|
-
schema: ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA,
|
|
121
|
-
mission_id: event.mission_id || snapshot.mission_id,
|
|
122
|
-
updated_at: nowIso(),
|
|
123
|
-
flush_count: snapshot.flush_count || 0,
|
|
124
|
-
slots,
|
|
125
|
-
counts: adjustSlotTelemetryCounts(snapshot.counts || countSlotTelemetry(snapshot.slots || {}), previous, nextSlot)
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
export async function rebuildZellijSlotTelemetrySnapshot(root, missionId) {
|
|
129
|
-
const eventsPath = slotTelemetryEventPath(root, missionId);
|
|
130
|
-
const rows = await readTelemetryEvents(eventsPath);
|
|
131
|
-
const slots = {};
|
|
132
|
-
for (const row of rows) {
|
|
133
|
-
if (row.mission_id !== missionId)
|
|
134
|
-
continue;
|
|
135
|
-
const key = slotTelemetryKey(row.slot_id || row.worker_id, row.generation_index);
|
|
136
|
-
const previous = slots[key];
|
|
137
|
-
slots[key] = mergeSlotTelemetry(previous, row);
|
|
138
|
-
}
|
|
139
|
-
const snapshot = {
|
|
140
|
-
schema: ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA,
|
|
141
|
-
mission_id: missionId,
|
|
142
|
-
updated_at: nowIso(),
|
|
143
|
-
flush_count: 0,
|
|
144
|
-
slots,
|
|
145
|
-
counts: countSlotTelemetry(slots)
|
|
146
|
-
};
|
|
147
|
-
await writeTelemetrySnapshotFast(slotTelemetrySnapshotPath(root, missionId), snapshot);
|
|
148
|
-
return snapshot;
|
|
149
|
-
}
|
|
150
|
-
async function readTelemetryEvents(file) {
|
|
151
|
-
const text = await readText(file, '');
|
|
152
|
-
return String(text)
|
|
153
|
-
.split(/\r?\n/)
|
|
154
|
-
.map((line) => line.trim())
|
|
155
|
-
.filter(Boolean)
|
|
156
|
-
.map((line) => {
|
|
157
|
-
try {
|
|
158
|
-
return normalizeTelemetryEvent(JSON.parse(line));
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
.filter((row) => Boolean(row));
|
|
165
|
-
}
|
|
166
|
-
function normalizeTelemetryEvent(event) {
|
|
167
|
-
const status = normalizeStatus(event.status);
|
|
168
|
-
return {
|
|
169
|
-
schema: ZELLIJ_SLOT_TELEMETRY_EVENT_SCHEMA,
|
|
170
|
-
ts: event.ts || nowIso(),
|
|
171
|
-
mission_id: String(event.mission_id || ''),
|
|
172
|
-
slot_id: String(event.slot_id || event.worker_id || 'slot-001'),
|
|
173
|
-
generation_index: Math.max(1, Math.floor(Number(event.generation_index) || 1)),
|
|
174
|
-
worker_id: String(event.worker_id || event.slot_id || 'worker'),
|
|
175
|
-
event_type: normalizeEventType(event.event_type),
|
|
176
|
-
status,
|
|
177
|
-
...(event.role ? { role: String(event.role) } : {}),
|
|
178
|
-
...(event.backend ? { backend: String(event.backend) } : {}),
|
|
179
|
-
...(event.provider ? { provider: String(event.provider) } : {}),
|
|
180
|
-
...(event.service_tier ? { service_tier: String(event.service_tier) } : {}),
|
|
181
|
-
...(event.model ? { model: String(event.model) } : {}),
|
|
182
|
-
...(event.reasoning_effort ? { reasoning_effort: String(event.reasoning_effort) } : {}),
|
|
183
|
-
worktree_id: event.worktree_id == null ? null : String(event.worktree_id),
|
|
184
|
-
worktree_path: event.worktree_path == null ? null : String(event.worktree_path),
|
|
185
|
-
...(event.task_id ? { task_id: String(event.task_id) } : {}),
|
|
186
|
-
...(event.task_title ? { task_title: String(event.task_title) } : {}),
|
|
187
|
-
current_file: event.current_file == null ? null : String(event.current_file),
|
|
188
|
-
...(event.spawned_at ? { spawned_at: String(event.spawned_at) } : {}),
|
|
189
|
-
...(event.progress ? (() => {
|
|
190
|
-
const progress = normalizeProgress(event.progress);
|
|
191
|
-
return progress ? { progress } : {};
|
|
192
|
-
})() : {}),
|
|
193
|
-
...(Array.isArray(event.artifact_paths) ? { artifact_paths: event.artifact_paths.map(String).filter(Boolean) } : {}),
|
|
194
|
-
...(event.log_tail ? { log_tail: tail(event.log_tail, 1200) } : {}),
|
|
195
|
-
...(Array.isArray(event.blockers) ? { blockers: event.blockers.map(String).filter(Boolean) } : {}),
|
|
196
|
-
...(event.activity_source ? { activity_source: String(event.activity_source) } : {}),
|
|
197
|
-
...(event.activity_hash ? { activity_hash: String(event.activity_hash) } : {})
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
function mergeSlotTelemetry(previous, event) {
|
|
201
|
-
const previousTs = telemetryTsMs(previous?.latest_ts);
|
|
202
|
-
const eventTs = telemetryTsMs(event.ts);
|
|
203
|
-
const previousTerminal = isTelemetryTerminalStatus(previous?.status);
|
|
204
|
-
const eventTerminal = isTelemetryTerminalStatus(event.status);
|
|
205
|
-
const terminalRegression = Boolean(previous && previousTerminal && !eventTerminal);
|
|
206
|
-
const stale = Boolean(previous && (terminalRegression
|
|
207
|
-
|| (!eventTerminal && eventTs < previousTs)
|
|
208
|
-
|| (previousTerminal && eventTerminal && eventTs < previousTs)));
|
|
209
|
-
return {
|
|
210
|
-
slot_id: stale ? previous.slot_id : event.slot_id,
|
|
211
|
-
generation_index: stale ? previous.generation_index : event.generation_index,
|
|
212
|
-
worker_id: stale ? previous.worker_id : event.worker_id,
|
|
213
|
-
status: stale ? previous.status : event.status,
|
|
214
|
-
role: event.role || previous?.role || 'worker',
|
|
215
|
-
backend: event.backend || previous?.backend || 'unknown',
|
|
216
|
-
provider: event.provider || previous?.provider || 'unknown',
|
|
217
|
-
service_tier: event.service_tier || previous?.service_tier || 'unknown',
|
|
218
|
-
model: event.model || previous?.model || 'unknown',
|
|
219
|
-
reasoning_effort: event.reasoning_effort || previous?.reasoning_effort || 'unknown',
|
|
220
|
-
worktree_id: event.worktree_id ?? previous?.worktree_id ?? null,
|
|
221
|
-
worktree_path: event.worktree_path ?? previous?.worktree_path ?? null,
|
|
222
|
-
task_title: event.task_title || previous?.task_title || event.task_id || 'waiting for task',
|
|
223
|
-
current_file: stale ? previous.current_file ?? (terminalRegression ? null : event.current_file ?? null) : event.current_file ?? previous?.current_file ?? null,
|
|
224
|
-
latest_event_type: stale ? previous.latest_event_type : event.event_type,
|
|
225
|
-
latest_ts: stale ? previous.latest_ts : event.ts,
|
|
226
|
-
started_at: previous?.started_at || event.ts,
|
|
227
|
-
spawned_at: event.spawned_at || previous?.spawned_at || event.ts,
|
|
228
|
-
progress: stale ? previous.progress || (terminalRegression ? null : event.progress || null) : event.progress || previous?.progress || null,
|
|
229
|
-
artifact_paths: unique([...(previous?.artifact_paths || []), ...(event.artifact_paths || [])]),
|
|
230
|
-
blockers: unique([...(previous?.blockers || []), ...(event.blockers || [])]),
|
|
231
|
-
log_tail: stale ? previous.log_tail || (terminalRegression ? '' : event.log_tail || '') : event.log_tail || previous?.log_tail || '',
|
|
232
|
-
activity_source: stale ? previous.activity_source ?? null : event.activity_source || previous?.activity_source || null,
|
|
233
|
-
activity_hash: stale ? previous.activity_hash ?? null : event.activity_hash || previous?.activity_hash || null
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function countSlotTelemetry(slots) {
|
|
237
|
-
const counts = { queued: 0, running: 0, verifying: 0, completed: 0, failed: 0, headless: 0 };
|
|
238
|
-
for (const row of Object.values(slots)) {
|
|
239
|
-
const bucket = slotTelemetryCountBucket(row.status);
|
|
240
|
-
counts[bucket] += 1;
|
|
241
|
-
}
|
|
242
|
-
return counts;
|
|
243
|
-
}
|
|
244
|
-
function adjustSlotTelemetryCounts(current, previous, next) {
|
|
245
|
-
const counts = { ...current };
|
|
246
|
-
const nextBucket = slotTelemetryCountBucket(next.status);
|
|
247
|
-
if (previous) {
|
|
248
|
-
const previousBucket = slotTelemetryCountBucket(previous.status);
|
|
249
|
-
if (previousBucket !== nextBucket) {
|
|
250
|
-
counts[previousBucket] = Math.max(0, Number(counts[previousBucket] || 0) - 1);
|
|
251
|
-
counts[nextBucket] = Number(counts[nextBucket] || 0) + 1;
|
|
252
|
-
}
|
|
253
|
-
return counts;
|
|
254
|
-
}
|
|
255
|
-
counts[nextBucket] = Number(counts[nextBucket] || 0) + 1;
|
|
256
|
-
return counts;
|
|
257
|
-
}
|
|
258
|
-
function slotTelemetryCountBucket(status) {
|
|
259
|
-
const normalized = normalizeStatus(status);
|
|
260
|
-
if (normalized === 'queued' || normalized === 'launching')
|
|
261
|
-
return 'queued';
|
|
262
|
-
if (normalized === 'verifying')
|
|
263
|
-
return 'verifying';
|
|
264
|
-
if (normalized === 'completed' || normalized === 'drained')
|
|
265
|
-
return 'completed';
|
|
266
|
-
if (normalized === 'failed')
|
|
267
|
-
return 'failed';
|
|
268
|
-
if (normalized === 'headless')
|
|
269
|
-
return 'headless';
|
|
270
|
-
return 'running';
|
|
271
|
-
}
|
|
272
|
-
function isTelemetryTerminalStatus(status) {
|
|
273
|
-
const normalized = normalizeStatus(status);
|
|
274
|
-
return normalized === 'completed' || normalized === 'failed' || normalized === 'drained';
|
|
275
|
-
}
|
|
276
|
-
function normalizeStatus(value) {
|
|
277
|
-
const text = String(value || '').toLowerCase();
|
|
278
|
-
if (text === 'closed' || text === 'done' || text === 'passed')
|
|
279
|
-
return 'completed';
|
|
280
|
-
if (text === 'blocked' || text === 'error' || text === 'timed_out')
|
|
281
|
-
return 'failed';
|
|
282
|
-
if (text === 'coding')
|
|
283
|
-
return 'running';
|
|
284
|
-
if (['queued', 'launching', 'running', 'verifying', 'completed', 'failed', 'headless', 'drained'].includes(text))
|
|
285
|
-
return text;
|
|
286
|
-
return 'running';
|
|
287
|
-
}
|
|
288
|
-
function normalizeEventType(value) {
|
|
289
|
-
const text = String(value || '');
|
|
290
|
-
const allowed = new Set([
|
|
291
|
-
'slot_reserved', 'worker_spawned', 'heartbeat', 'task_started', 'task_progress',
|
|
292
|
-
'artifact_written', 'patch_candidate', 'verification_started', 'verification_passed',
|
|
293
|
-
'verification_failed', 'worker_completed', 'worker_failed', 'headless_overflow'
|
|
294
|
-
]);
|
|
295
|
-
return allowed.has(text) ? text : 'heartbeat';
|
|
296
|
-
}
|
|
297
|
-
function normalizeProgress(value) {
|
|
298
|
-
const done = Math.max(0, Math.floor(Number(value?.done) || 0));
|
|
299
|
-
const total = Math.max(0, Math.floor(Number(value?.total) || 0));
|
|
300
|
-
if (total === 0 && done > 0)
|
|
301
|
-
return null;
|
|
302
|
-
return {
|
|
303
|
-
done,
|
|
304
|
-
total,
|
|
305
|
-
label: String(value?.label || 'progress')
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
function unique(values) {
|
|
309
|
-
return [...new Set(values.map((value) => String(value || '').trim()).filter(Boolean))];
|
|
310
|
-
}
|
|
311
|
-
function slotTelemetryKey(slotId, generationIndex) {
|
|
312
|
-
const slot = String(slotId || 'slot-001').trim() || 'slot-001';
|
|
313
|
-
const generation = Math.max(1, Math.floor(Number(generationIndex) || 1));
|
|
314
|
-
return `${slot}:g${generation}`;
|
|
315
|
-
}
|
|
316
|
-
function tail(value, max) {
|
|
317
|
-
const text = String(value || '').replace(/\s+$/g, '');
|
|
318
|
-
return text.length > max ? text.slice(-max) : text;
|
|
319
|
-
}
|
|
320
|
-
async function writeTelemetrySnapshotFast(file, snapshot) {
|
|
321
|
-
await ensureDir(path.dirname(file));
|
|
322
|
-
await withFileLock({
|
|
323
|
-
lockPath: `${file}.lock`,
|
|
324
|
-
timeoutMs: ZELLIJ_SLOT_TELEMETRY_LOCK_TIMEOUT_MS,
|
|
325
|
-
staleMs: ZELLIJ_SLOT_TELEMETRY_LOCK_STALE_MS
|
|
326
|
-
}, async () => {
|
|
327
|
-
const flushCount = Number(telemetrySnapshotFlushCounts.get(file) || 0) + 1;
|
|
328
|
-
telemetrySnapshotFlushCounts.set(file, flushCount);
|
|
329
|
-
telemetrySnapshotLastFlushMs.set(file, Date.now());
|
|
330
|
-
const disk = await readJson(file, null);
|
|
331
|
-
const merged = disk?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA ? mergeTelemetrySnapshots(disk, snapshot) : snapshot;
|
|
332
|
-
const next = { ...merged, flush_count: Math.max(flushCount, Number(merged.flush_count || 0)) };
|
|
333
|
-
if (disk?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA && telemetrySnapshotContentKey(disk) === telemetrySnapshotContentKey(next)) {
|
|
334
|
-
telemetrySnapshotCache.set(file, disk);
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
telemetrySnapshotCache.set(file, next);
|
|
338
|
-
await writeTextAtomic(file, `${JSON.stringify(next)}\n`);
|
|
339
|
-
const stat = await statTelemetryFile(file);
|
|
340
|
-
if (stat)
|
|
341
|
-
telemetrySnapshotDiskStat.set(file, stat);
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
function shouldFlushTelemetrySnapshot(file, event) {
|
|
345
|
-
const next = (telemetrySnapshotWriteCounts.get(file) || 0) + 1;
|
|
346
|
-
telemetrySnapshotWriteCounts.set(file, next);
|
|
347
|
-
const now = Date.now();
|
|
348
|
-
const last = telemetrySnapshotLastFlushMs.get(file) || 0;
|
|
349
|
-
const parsedFlushMs = Number(process.env.SKS_ZELLIJ_SLOT_TELEMETRY_FLUSH_MS || 5000);
|
|
350
|
-
const flushMs = Math.max(1000, Number.isFinite(parsedFlushMs) ? parsedFlushMs : 5000);
|
|
351
|
-
const important = event.event_type === 'task_started'
|
|
352
|
-
|| event.event_type === 'patch_candidate'
|
|
353
|
-
|| event.event_type === 'worker_completed'
|
|
354
|
-
|| event.event_type === 'worker_failed'
|
|
355
|
-
|| event.status === 'completed'
|
|
356
|
-
|| event.status === 'failed'
|
|
357
|
-
|| event.status === 'drained';
|
|
358
|
-
const should = next === 1
|
|
359
|
-
|| important
|
|
360
|
-
|| now - last >= flushMs;
|
|
361
|
-
if (should)
|
|
362
|
-
telemetrySnapshotLastFlushMs.set(file, now);
|
|
363
|
-
return should;
|
|
364
|
-
}
|
|
365
|
-
function telemetrySnapshotContentKey(snapshot) {
|
|
366
|
-
return JSON.stringify({
|
|
367
|
-
schema: snapshot.schema,
|
|
368
|
-
mission_id: snapshot.mission_id,
|
|
369
|
-
slots: snapshot.slots || {},
|
|
370
|
-
counts: snapshot.counts || {}
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
function inferMissionDir(root, missionId) {
|
|
374
|
-
const resolved = path.resolve(root);
|
|
375
|
-
if (path.basename(resolved) === 'agents' && path.basename(path.dirname(resolved)) === missionId)
|
|
376
|
-
return path.dirname(resolved);
|
|
377
|
-
if (path.basename(resolved) === missionId && path.basename(path.dirname(resolved)) === 'missions')
|
|
378
|
-
return resolved;
|
|
379
|
-
const marker = `${path.sep}.sneakoscope${path.sep}missions${path.sep}${missionId}${path.sep}`;
|
|
380
|
-
const index = resolved.indexOf(marker);
|
|
381
|
-
if (index >= 0)
|
|
382
|
-
return resolved.slice(0, index + marker.length - 1);
|
|
383
|
-
return path.join(resolved, '.sneakoscope', 'missions', missionId);
|
|
384
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const ANSI = {
|
|
2
|
-
reset: '\x1b[0m',
|
|
3
|
-
dim: '\x1b[2m',
|
|
4
|
-
bold: '\x1b[1m',
|
|
5
|
-
red: '\x1b[31m',
|
|
6
|
-
green: '\x1b[32m',
|
|
7
|
-
yellow: '\x1b[33m',
|
|
8
|
-
cyan: '\x1b[36m',
|
|
9
|
-
magenta: '\x1b[35m',
|
|
10
|
-
gray: '\x1b[90m'
|
|
11
|
-
};
|
|
12
|
-
export function resolveZellijTheme() {
|
|
13
|
-
const noColor = process.env.NO_COLOR === '1' || process.env.SKS_ZELLIJ_COLOR === '0';
|
|
14
|
-
return {
|
|
15
|
-
color: !noColor && process.stdout.isTTY !== false,
|
|
16
|
-
width: Math.min(Math.max(Number(process.stdout.columns) || 100, 60), 140),
|
|
17
|
-
statusIcon: {
|
|
18
|
-
running: '●',
|
|
19
|
-
verifying: '◍',
|
|
20
|
-
queued: '◌',
|
|
21
|
-
launching: '◌',
|
|
22
|
-
done: '✔',
|
|
23
|
-
completed: '✔',
|
|
24
|
-
failed: '✖',
|
|
25
|
-
blocked: '■',
|
|
26
|
-
timed_out: '⏱',
|
|
27
|
-
headless: '·',
|
|
28
|
-
drained: '✔'
|
|
29
|
-
},
|
|
30
|
-
statusColor: {
|
|
31
|
-
running: ANSI.green,
|
|
32
|
-
verifying: ANSI.cyan,
|
|
33
|
-
queued: ANSI.gray,
|
|
34
|
-
launching: ANSI.gray,
|
|
35
|
-
done: ANSI.green,
|
|
36
|
-
completed: ANSI.green,
|
|
37
|
-
failed: ANSI.red,
|
|
38
|
-
blocked: ANSI.yellow,
|
|
39
|
-
timed_out: ANSI.red,
|
|
40
|
-
headless: ANSI.gray,
|
|
41
|
-
drained: ANSI.green
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export function paint(theme, code, text) {
|
|
46
|
-
return theme.color && code ? `${code}${text}${ANSI.reset}` : text;
|
|
47
|
-
}
|
|
48
|
-
export function statusBadge(theme, status) {
|
|
49
|
-
const s = String(status || 'queued').toLowerCase();
|
|
50
|
-
const icon = theme.statusIcon[s] || '●';
|
|
51
|
-
return paint(theme, theme.statusColor[s] || '', `${icon} ${s}`);
|
|
52
|
-
}
|
|
53
|
-
export function progressBar(theme, done, total, width = 10) {
|
|
54
|
-
if (!Number.isFinite(total) || total <= 0)
|
|
55
|
-
return '';
|
|
56
|
-
const filled = Math.max(0, Math.min(width, Math.round((done / total) * width)));
|
|
57
|
-
return `${paint(theme, ANSI.green, '▉'.repeat(filled))}${paint(theme, ANSI.gray, '▁'.repeat(width - filled))} ${done}/${total}`;
|
|
58
|
-
}
|
|
59
|
-
export function elapsed(sinceIso) {
|
|
60
|
-
const t = Date.parse(String(sinceIso || ''));
|
|
61
|
-
if (!Number.isFinite(t))
|
|
62
|
-
return '';
|
|
63
|
-
const s = Math.max(0, Math.floor((Date.now() - t) / 1000));
|
|
64
|
-
return `${String(Math.floor(s / 60)).padStart(2, '0')}:${String(s % 60).padStart(2, '0')}`;
|
|
65
|
-
}
|
|
66
|
-
export const ANSI_CODES = ANSI;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export function resolveZellijUiConfig(args = [], env = process.env) {
|
|
2
|
-
return {
|
|
3
|
-
mode: resolveZellijUiMode(args, env),
|
|
4
|
-
color: env.SKS_ZELLIJ_COLOR !== '0' && env.NO_COLOR !== '1',
|
|
5
|
-
visiblePanes: Number(env.SKS_ZELLIJ_VISIBLE_PANES) || null,
|
|
6
|
-
viewports: boundedInt(env.SKS_ZELLIJ_VIEWPORTS, 1, 0, 3),
|
|
7
|
-
monitorRows: Math.max(4, Number(env.SKS_ZELLIJ_MONITOR_ROWS || 12)),
|
|
8
|
-
monitor: env.SKS_ZELLIJ_MONITOR_PANE !== '0',
|
|
9
|
-
intervalMs: Math.max(500, Number(env.SKS_ZELLIJ_REFRESH_MS) || 1000)
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function resolveZellijUiMode(args = [], env = process.env) {
|
|
13
|
-
return resolveExplicitZellijUiMode(args, env) || 'compact-slots';
|
|
14
|
-
}
|
|
15
|
-
export function resolveZellijWorkerPaneUiMode(args = [], env = process.env) {
|
|
16
|
-
return resolveExplicitZellijUiMode(args, env) || 'compact-slots';
|
|
17
|
-
}
|
|
18
|
-
function resolveExplicitZellijUiMode(args = [], env = process.env) {
|
|
19
|
-
const fromEnv = String(env.SKS_ZELLIJ_UI_MODE || '').trim();
|
|
20
|
-
if (fromEnv === 'compact-slots')
|
|
21
|
-
return 'compact-slots';
|
|
22
|
-
if (fromEnv === 'full-debug')
|
|
23
|
-
return 'full-debug';
|
|
24
|
-
if (args.includes('--zellij-compact-slots'))
|
|
25
|
-
return 'compact-slots';
|
|
26
|
-
if (args.includes('--zellij-full-debug'))
|
|
27
|
-
return 'full-debug';
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
function boundedInt(value, fallback, min, max) {
|
|
31
|
-
const parsed = Math.floor(Number(value ?? fallback));
|
|
32
|
-
const n = Number.isFinite(parsed) ? parsed : fallback;
|
|
33
|
-
return Math.max(min, Math.min(n, max));
|
|
34
|
-
}
|