claude-code-session-manager 0.97.0 → 0.100.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 +3 -3
- package/bin/cli.cjs +16 -4
- package/bin/node-floor.cjs +41 -0
- package/dist/assets/{DataModel-D93FoaOm.js → DataModel-HdR0AxFq.js} +1 -1
- package/dist/assets/{History-CXxxqNP1.js → History-Dr4Jr_5z.js} +2 -2
- package/dist/assets/{Hooks-CzeYFQjq.js → Hooks-NhrvH3JP.js} +3 -3
- package/dist/assets/{Library-D2zPkwOC.js → Library-Dv_EtIMr.js} +1 -1
- package/dist/assets/{MarkdownEditor-DbinP78A.js → MarkdownEditor-DTKDWV_n.js} +1 -1
- package/dist/assets/{McpServers-Bu_sVGLr.js → McpServers-M034G9B3.js} +2 -2
- package/dist/assets/{Memory-BgiI6LZ_.js → Memory-DzF1B4gx.js} +6 -6
- package/dist/assets/{Permissions-C1MMzZRm.js → Permissions-DrgbSGWl.js} +3 -3
- package/dist/assets/{Plugins-Dhu6wAZi.js → Plugins-Bd3ef35w.js} +2 -2
- package/dist/assets/{ProvenanceBadge-C3AcWKMG.js → ProvenanceBadge-DcBHT1Iy.js} +1 -1
- package/dist/assets/{SaveBar-plwYm0iO.js → SaveBar-rimJem-Y.js} +1 -1
- package/dist/assets/Scheduler-DjgFJl2w.js +16 -0
- package/dist/assets/{ScopeSwitcher-DFy0vv_o.js → ScopeSwitcher-CnAzTBrl.js} +1 -1
- package/dist/assets/Settings-Dc1F_sSg.js +3 -0
- package/dist/assets/{SkillReferenceGraph-DsI7hRPB.js → SkillReferenceGraph-B9aZDecM.js} +1 -1
- package/dist/assets/{Skills-3E748UfB.js → Skills-DRXd18gu.js} +2 -2
- package/dist/assets/{SystemPrompt-BqmfUJOd.js → SystemPrompt-ahy5-Fwe.js} +1 -1
- package/dist/assets/{TagLibrary-CPz6fO8Q.js → TagLibrary-C_tToDeL.js} +1 -1
- package/dist/assets/{TiptapBody-D9EoBQ1P.js → TiptapBody-DvdefS6K.js} +1 -1
- package/dist/assets/{Toggle-BHAmZNDn.js → Toggle-6Jl5Njc6.js} +1 -1
- package/dist/assets/{index-CKH5Uxik.css → index-Bta-hwud.css} +1 -1
- package/dist/assets/{index-tn5JIVPj.js → index-vx8O73l8.js} +497 -502
- package/dist/assets/{settingsSchema-Crqy_aNz.js → settingsSchema-D6iRguNV.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +26 -29
- package/plugins/CLAUDE.md +6 -6
- package/plugins/session-manager-dev/skills/builder/4-manual/SKILL.md +23 -19
- package/plugins/session-manager-dev/skills/builder/SKILL.md +3 -3
- package/plugins/session-manager-dev/skills/develop/SKILL.md +254 -510
- package/plugins/session-manager-dev/skills/develop/standards.md +17 -22
- package/scripts/README.md +3 -11
- package/scripts/audit-ops-hygiene.cjs +3 -3
- package/scripts/hooks/lib/guard-prd-writes-policy.cjs +1 -1
- package/scripts/hooks/lib/guard-self-schedule-policy.cjs +1 -1
- package/scripts/mint-epic.cjs +2 -3
- package/scripts/scheduler-mcp-server.cjs +36 -7
- package/src/main/agentLibrary.cjs +22 -2
- package/src/main/build-info.json +4 -4
- package/src/main/config.cjs +41 -38
- package/src/main/docEdit.cjs +4 -1
- package/src/main/files.cjs +2 -5
- package/src/main/health.cjs +1 -1
- package/src/main/index.cjs +23 -10
- package/src/main/ipcSchemas.cjs +28 -35
- package/src/main/lib/agentPersonaSchema.cjs +13 -2
- package/src/main/lib/atomicFs.cjs +116 -0
- package/src/main/lib/branchSweep.cjs +13 -12
- package/src/main/lib/buildTarget.cjs +3 -3
- package/src/main/lib/claudeCliCaps.cjs +129 -0
- package/src/main/lib/credentials.cjs +2 -4
- package/src/main/lib/crossProjectFeedback.cjs +3 -3
- package/src/main/lib/cwdClassify.cjs +15 -3
- package/src/main/lib/definitionOfDone.cjs +207 -125
- package/src/main/lib/dodDrainHook.cjs +11 -5
- package/src/main/lib/epicMint.cjs +2 -4
- package/src/main/lib/epicStatusMirror.cjs +8 -10
- package/src/main/lib/epicWorktreeProjectConfig.cjs +2 -4
- package/src/main/lib/gateAuthority.cjs +96 -0
- package/src/main/lib/gitExec.cjs +69 -0
- package/src/main/lib/gitWorktree.cjs +656 -92
- package/src/main/lib/instanceLock.cjs +5 -8
- package/src/main/lib/launchFailure.cjs +2 -3
- package/src/main/lib/macroLibrary.cjs +386 -0
- package/src/main/lib/mcpToolCatalog.cjs +26 -17
- package/src/main/lib/needsReviewLedger.cjs +1 -1
- package/src/main/lib/opsErrorLog.cjs +11 -1
- package/src/main/lib/opsOwnership.cjs +0 -5
- package/src/main/lib/pidAlive.cjs +32 -0
- package/src/main/lib/prdCreate.cjs +153 -19
- package/src/main/lib/prdDisposition.cjs +2 -2
- package/src/main/lib/prdGateFiles.cjs +284 -0
- package/src/main/lib/prdLocations.cjs +61 -0
- package/src/main/lib/prdMigration.cjs +2 -3
- package/src/main/lib/prdSizing.cjs +2 -1
- package/src/main/lib/promptSessionSchema.cjs +10 -2
- package/src/main/lib/rcaReport.cjs +4 -6
- package/src/main/lib/reaperHelpers.cjs +8 -1
- package/src/main/lib/reservationExpiry.cjs +6 -1
- package/src/main/lib/reviewNotice.cjs +263 -0
- package/src/main/lib/runClaudeP.cjs +4 -1
- package/src/main/lib/schedulerPaths.cjs +22 -2
- package/src/main/lib/sessionSlots.cjs +2 -4
- package/src/main/lib/shippedPersonaSeeds.cjs +179 -0
- package/src/main/lib/timeoutShim.cjs +123 -0
- package/src/main/lib/timeoutShimScript.cjs +275 -0
- package/src/main/lib/upgradeDrain.cjs +4 -10
- package/src/main/lib/watchdogHelpers.cjs +33 -30
- package/src/main/lib/workTypeLibrary.cjs +7 -1
- package/src/main/promptSessionEvents.cjs +37 -13
- package/src/main/queueOps.cjs +17 -6
- package/src/main/scheduler.cjs +975 -203
- package/src/main/seedAgentPersonas.cjs +278 -23
- package/src/main/supervisor.cjs +4 -1
- package/src/main/templates/PRD_AUTHORING.md +126 -406
- package/src/preload/__tests__/preload-surface.test.cjs +68 -0
- package/src/preload/api.d.ts +41 -94
- package/src/preload/index.cjs +14 -9
- package/src/seed/agents/architect.md +1 -0
- package/src/seed/agents/dev-lead.md +17 -18
- package/src/seed/agents/project-home-builder.md +1 -0
- package/src/seed/agents/validator.md +10 -4
- package/dist/assets/HostBilko-nESrTRIg.js +0 -1
- package/dist/assets/Scheduler-BVYTeh39.js +0 -16
- package/dist/assets/Settings-DIhGgdfs.js +0 -3
- package/src/main/__tests__/activeIndexMerge.test.cjs +0 -235
- package/src/main/__tests__/agentEffortResolve.test.cjs +0 -117
- package/src/main/__tests__/agentLibrary.test.cjs +0 -276
- package/src/main/__tests__/agentModelResolve.test.cjs +0 -311
- package/src/main/__tests__/agentOverlayWrite.test.cjs +0 -95
- package/src/main/__tests__/bilkoHost-deriveSlug.test.cjs +0 -26
- package/src/main/__tests__/bilkoHost-integration.test.cjs +0 -118
- package/src/main/__tests__/bilkoHostCore.test.cjs +0 -72
- package/src/main/__tests__/broadcastCoalescer.test.cjs +0 -122
- package/src/main/__tests__/chat-cancel-terminal.test.cjs +0 -120
- package/src/main/__tests__/chat-dead-channels.test.cjs +0 -63
- package/src/main/__tests__/chat-exit-close-race.test.cjs +0 -146
- package/src/main/__tests__/chat-mcp-consent-notice.test.cjs +0 -139
- package/src/main/__tests__/chat-preamble-anchors.test.cjs +0 -100
- package/src/main/__tests__/chat-queue.test.cjs +0 -97
- package/src/main/__tests__/chat-stop-signal.test.cjs +0 -89
- package/src/main/__tests__/chatRunner-epic-worktree-execcwd.test.cjs +0 -125
- package/src/main/__tests__/chatRunner-session-flag-retry.test.cjs +0 -252
- package/src/main/__tests__/classifyPromptTicket.test.cjs +0 -101
- package/src/main/__tests__/classifyTranscriptLine.test.cjs +0 -201
- package/src/main/__tests__/computeDepHistorySatisfaction.test.cjs +0 -66
- package/src/main/__tests__/config-readText-bounded.test.cjs +0 -84
- package/src/main/__tests__/configWriteBoundaryOwners.test.cjs +0 -59
- package/src/main/__tests__/crossProjectFeedback.test.cjs +0 -334
- package/src/main/__tests__/crossProjectFeedbackRoutes.test.cjs +0 -161
- package/src/main/__tests__/dep-orphan-archive-health.test.cjs +0 -77
- package/src/main/__tests__/develop-skill-failure-modes.test.cjs +0 -70
- package/src/main/__tests__/docEdit.test.cjs +0 -244
- package/src/main/__tests__/dod-batchkey.test.cjs +0 -183
- package/src/main/__tests__/dod-drain-hook.test.cjs +0 -302
- package/src/main/__tests__/dod-report.test.cjs +0 -304
- package/src/main/__tests__/dod-reverify.test.cjs +0 -285
- package/src/main/__tests__/epicContextDigest.test.cjs +0 -174
- package/src/main/__tests__/epicMint.test.cjs +0 -332
- package/src/main/__tests__/epicMintTelemetryTap.test.cjs +0 -64
- package/src/main/__tests__/epicStatusMirror.test.cjs +0 -110
- package/src/main/__tests__/epicValidationHook.test.cjs +0 -291
- package/src/main/__tests__/exchanges.test.cjs +0 -122
- package/src/main/__tests__/exchangesPromptId.test.cjs +0 -61
- package/src/main/__tests__/extractJson.test.cjs +0 -51
- package/src/main/__tests__/files-reject-credentials.test.cjs +0 -40
- package/src/main/__tests__/fixtures/1218-fo-01-move-scripts-lib-into-src-main-lib.log +0 -556
- package/src/main/__tests__/flatPrdTickSweep.test.cjs +0 -110
- package/src/main/__tests__/health-build-freshness.test.cjs +0 -39
- package/src/main/__tests__/health-claude-md-budget.test.cjs +0 -57
- package/src/main/__tests__/health-credentials.test.cjs +0 -81
- package/src/main/__tests__/health-delegation-chain.test.cjs +0 -124
- package/src/main/__tests__/health-per-project-stall.test.cjs +0 -84
- package/src/main/__tests__/health-prd-migration.test.cjs +0 -37
- package/src/main/__tests__/health-queue-dispatch.test.cjs +0 -135
- package/src/main/__tests__/health-starve-escalation.test.cjs +0 -94
- package/src/main/__tests__/health-tick-liveness.test.cjs +0 -179
- package/src/main/__tests__/health-usage-poller.test.cjs +0 -144
- package/src/main/__tests__/health-worktree-cap-blocked.test.cjs +0 -65
- package/src/main/__tests__/heapSnapshot.test.cjs +0 -121
- package/src/main/__tests__/historyAggregatorIntraday.test.cjs +0 -313
- package/src/main/__tests__/historyDashboard.test.cjs +0 -163
- package/src/main/__tests__/historyRollup.test.cjs +0 -333
- package/src/main/__tests__/intradayRefresh.test.cjs +0 -39
- package/src/main/__tests__/ipcSchemas-dependsOn.test.cjs +0 -39
- package/src/main/__tests__/kg-augment.test.cjs +0 -195
- package/src/main/__tests__/loadGateDetailTick.test.cjs +0 -31
- package/src/main/__tests__/machineProfile.test.cjs +0 -152
- package/src/main/__tests__/mcpStatus.test.cjs +0 -61
- package/src/main/__tests__/memoryAggregate.test.cjs +0 -109
- package/src/main/__tests__/memoryStale.test.cjs +0 -88
- package/src/main/__tests__/needsReviewLedger.test.cjs +0 -162
- package/src/main/__tests__/openExternalApp-spawn-error.test.cjs +0 -25
- package/src/main/__tests__/opsErrorLog.test.cjs +0 -109
- package/src/main/__tests__/opsErrorLogTelemetryTap.test.cjs +0 -173
- package/src/main/__tests__/personaMerge.test.cjs +0 -169
- package/src/main/__tests__/planValidator.test.cjs +0 -125
- package/src/main/__tests__/pollLoop-dispatch-on-failure.test.cjs +0 -176
- package/src/main/__tests__/prd-group-allocator.test.cjs +0 -119
- package/src/main/__tests__/prdAdminRouteParity.test.cjs +0 -70
- package/src/main/__tests__/prdAdminRoutes.test.cjs +0 -718
- package/src/main/__tests__/prdAgentType.test.cjs +0 -103
- package/src/main/__tests__/prdAuthoringSeed.test.cjs +0 -39
- package/src/main/__tests__/prdCreate.test.cjs +0 -979
- package/src/main/__tests__/prdCreateDisposition.test.cjs +0 -201
- package/src/main/__tests__/prdCreatePlanId.test.cjs +0 -132
- package/src/main/__tests__/prdFrontmatterAgentType.test.cjs +0 -117
- package/src/main/__tests__/prdFrontmatterDependsOn.test.cjs +0 -136
- package/src/main/__tests__/prdFrontmatterDisposition.test.cjs +0 -125
- package/src/main/__tests__/prdFrontmatterQuietMachine.test.cjs +0 -108
- package/src/main/__tests__/prdLocations.test.cjs +0 -195
- package/src/main/__tests__/prdLocationsArchived.test.cjs +0 -201
- package/src/main/__tests__/prdMigration.test.cjs +0 -349
- package/src/main/__tests__/prdMigrationLegacyAdopt.test.cjs +0 -91
- package/src/main/__tests__/prdParserHighWater.test.cjs +0 -74
- package/src/main/__tests__/prdParserSourcePromptId.test.cjs +0 -65
- package/src/main/__tests__/prdSetDisposition.test.cjs +0 -222
- package/src/main/__tests__/prdSizing.test.cjs +0 -106
- package/src/main/__tests__/prdSourcePromptIdBackfill.test.cjs +0 -118
- package/src/main/__tests__/prdUpdateDependsOn.test.cjs +0 -160
- package/src/main/__tests__/proc-role-env.test.cjs +0 -125
- package/src/main/__tests__/procname-claude-spawn-sites.test.cjs +0 -304
- package/src/main/__tests__/procname-sm-processes.test.cjs +0 -127
- package/src/main/__tests__/projectHomeAdminRoutes.test.cjs +0 -177
- package/src/main/__tests__/projectPages.test.cjs +0 -137
- package/src/main/__tests__/promptSessionEvents.test.cjs +0 -234
- package/src/main/__tests__/promptSessionSchema.test.cjs +0 -101
- package/src/main/__tests__/promptSessionTranscript.test.cjs +0 -0
- package/src/main/__tests__/promptSessionsCreateEpicHandler.test.cjs +0 -159
- package/src/main/__tests__/pty-epic-worktree-spawn-cwd.test.cjs +0 -282
- package/src/main/__tests__/pty-session-open-telemetry.test.cjs +0 -96
- package/src/main/__tests__/pty-write-result.test.cjs +0 -46
- package/src/main/__tests__/queue-health-verdict.test.cjs +0 -170
- package/src/main/__tests__/queue-starvation-dispatch-driver.test.cjs +0 -286
- package/src/main/__tests__/queue-starvation-per-project.test.cjs +0 -147
- package/src/main/__tests__/queueHistory.test.cjs +0 -355
- package/src/main/__tests__/queueOps-interactive-ac-lint.test.cjs +0 -65
- package/src/main/__tests__/queueOpsArchiveDestination.test.cjs +0 -65
- package/src/main/__tests__/queueOpsAutoArchive.test.cjs +0 -154
- package/src/main/__tests__/rateLimitPollerStreak.test.cjs +0 -128
- package/src/main/__tests__/rcaReport.test.cjs +0 -266
- package/src/main/__tests__/reconcileFlatPrdSweep.test.cjs +0 -119
- package/src/main/__tests__/reconcileTiming.test.cjs +0 -135
- package/src/main/__tests__/runLogRetention.test.cjs +0 -489
- package/src/main/__tests__/runVerify-atomic-verdicts.test.cjs +0 -26
- package/src/main/__tests__/runVerify-blocked-by-foreign-wip.test.cjs +0 -58
- package/src/main/__tests__/runVerify-landed-commit-outranks.test.cjs +0 -191
- package/src/main/__tests__/runVerify-policy-denial.test.cjs +0 -89
- package/src/main/__tests__/runVerify-transcript-commit-evidence.test.cjs +0 -225
- package/src/main/__tests__/runVerify.test.cjs +0 -1784
- package/src/main/__tests__/scheduleJobSchema.test.cjs +0 -127
- package/src/main/__tests__/scheduleJobStatusDrift.test.cjs +0 -65
- package/src/main/__tests__/scheduleJobTransitions.test.cjs +0 -277
- package/src/main/__tests__/scheduleJobTransitionsGrep.test.cjs +0 -59
- package/src/main/__tests__/scheduleJobTransitionsTelemetryTap.test.cjs +0 -72
- package/src/main/__tests__/scheduler-admin-routes.test.cjs +0 -199
- package/src/main/__tests__/scheduler-adopted-run-supervision.test.cjs +0 -143
- package/src/main/__tests__/scheduler-already-satisfied-on-main.test.cjs +0 -105
- package/src/main/__tests__/scheduler-archive-completed-prd.test.cjs +0 -102
- package/src/main/__tests__/scheduler-archived-twin-guard.test.cjs +0 -155
- package/src/main/__tests__/scheduler-autofix-outcome.test.cjs +0 -188
- package/src/main/__tests__/scheduler-autofix-select.test.cjs +0 -439
- package/src/main/__tests__/scheduler-autopromote.test.cjs +0 -51
- package/src/main/__tests__/scheduler-bash-timeout-env.test.cjs +0 -101
- package/src/main/__tests__/scheduler-blocked-by-foreign-wip.test.cjs +0 -107
- package/src/main/__tests__/scheduler-boot-orphans.test.cjs +0 -153
- package/src/main/__tests__/scheduler-broadcast-reconcile.test.cjs +0 -121
- package/src/main/__tests__/scheduler-clear-queue-history.test.cjs +0 -134
- package/src/main/__tests__/scheduler-commit-guard-noop.test.cjs +0 -244
- package/src/main/__tests__/scheduler-committed-in-window.test.cjs +0 -182
- package/src/main/__tests__/scheduler-cross-project-batch.test.cjs +0 -43
- package/src/main/__tests__/scheduler-default-eligible-heal.test.cjs +0 -168
- package/src/main/__tests__/scheduler-dispatch-loop.test.cjs +0 -58
- package/src/main/__tests__/scheduler-effective-concurrency.test.cjs +0 -81
- package/src/main/__tests__/scheduler-epic-digest.test.cjs +0 -227
- package/src/main/__tests__/scheduler-failed-autoreset.test.cjs +0 -121
- package/src/main/__tests__/scheduler-finalize-dispatch-guards.test.cjs +0 -229
- package/src/main/__tests__/scheduler-find-prd-dir.test.cjs +0 -75
- package/src/main/__tests__/scheduler-fix-plan-path.test.cjs +0 -119
- package/src/main/__tests__/scheduler-force-tick-outcome.test.cjs +0 -46
- package/src/main/__tests__/scheduler-foreign-wip-manifest.test.cjs +0 -78
- package/src/main/__tests__/scheduler-gate-shadow.test.cjs +0 -119
- package/src/main/__tests__/scheduler-guard-verdict-autoresolve.test.cjs +0 -390
- package/src/main/__tests__/scheduler-heal-refusal.test.cjs +0 -61
- package/src/main/__tests__/scheduler-heartbeat-payload.test.cjs +0 -80
- package/src/main/__tests__/scheduler-inplace-salvage.test.cjs +0 -323
- package/src/main/__tests__/scheduler-integration-failure-stamp.test.cjs +0 -41
- package/src/main/__tests__/scheduler-investigation-clean-skip.test.cjs +0 -63
- package/src/main/__tests__/scheduler-investigation-prompt.test.cjs +0 -123
- package/src/main/__tests__/scheduler-job-budget.test.cjs +0 -172
- package/src/main/__tests__/scheduler-job-overrun.test.cjs +0 -175
- package/src/main/__tests__/scheduler-launch-failure.test.cjs +0 -199
- package/src/main/__tests__/scheduler-leftover-fields.test.cjs +0 -52
- package/src/main/__tests__/scheduler-leftover-quarantine.test.cjs +0 -199
- package/src/main/__tests__/scheduler-looks-done.test.cjs +0 -537
- package/src/main/__tests__/scheduler-manual-pause.test.cjs +0 -118
- package/src/main/__tests__/scheduler-mechanical-recovery.test.cjs +0 -245
- package/src/main/__tests__/scheduler-meta-code-sha.test.cjs +0 -46
- package/src/main/__tests__/scheduler-needs-review-autoresolve.test.cjs +0 -197
- package/src/main/__tests__/scheduler-never-stop.test.cjs +0 -157
- package/src/main/__tests__/scheduler-no-dead-end-status.test.cjs +0 -152
- package/src/main/__tests__/scheduler-no-orphan-run-dir.test.cjs +0 -81
- package/src/main/__tests__/scheduler-notify-originating-tab-transcript.test.cjs +0 -87
- package/src/main/__tests__/scheduler-notify-originating-tab.test.cjs +0 -343
- package/src/main/__tests__/scheduler-periodic-reverify-guard.test.cjs +0 -217
- package/src/main/__tests__/scheduler-porcelain-rename.test.cjs +0 -164
- package/src/main/__tests__/scheduler-prd-missing-skip.test.cjs +0 -161
- package/src/main/__tests__/scheduler-prd-persona-spawn.test.cjs +0 -178
- package/src/main/__tests__/scheduler-quarantine-autoresolve.test.cjs +0 -165
- package/src/main/__tests__/scheduler-quiet-machine-lease.test.cjs +0 -257
- package/src/main/__tests__/scheduler-rate-limit-cooldown-freshness.test.cjs +0 -123
- package/src/main/__tests__/scheduler-rate-limit-pause.test.cjs +0 -152
- package/src/main/__tests__/scheduler-rate-limit-spin-guard.test.cjs +0 -156
- package/src/main/__tests__/scheduler-reap-dead-running-jobs.test.cjs +0 -754
- package/src/main/__tests__/scheduler-reaper-helpers-basics.test.cjs +0 -87
- package/src/main/__tests__/scheduler-reconcile-cwd-preserve.test.cjs +0 -100
- package/src/main/__tests__/scheduler-reconcile-history-backfill.test.cjs +0 -105
- package/src/main/__tests__/scheduler-reconcile-invalid-repair.test.cjs +0 -203
- package/src/main/__tests__/scheduler-reconcile-quarantine.test.cjs +0 -247
- package/src/main/__tests__/scheduler-reset-job-fields-guard.test.cjs +0 -77
- package/src/main/__tests__/scheduler-resume-recovery.test.cjs +0 -254
- package/src/main/__tests__/scheduler-shard-quarantine.test.cjs +0 -115
- package/src/main/__tests__/scheduler-shared-tree-guard.test.cjs +0 -380
- package/src/main/__tests__/scheduler-sigterm-commit.test.cjs +0 -43
- package/src/main/__tests__/scheduler-stall-per-project.test.cjs +0 -126
- package/src/main/__tests__/scheduler-starve-escalation.test.cjs +0 -154
- package/src/main/__tests__/scheduler-stranded-autofix-park.test.cjs +0 -252
- package/src/main/__tests__/scheduler-stranded-investigation.test.cjs +0 -185
- package/src/main/__tests__/scheduler-stuck-failed-escalation.test.cjs +0 -136
- package/src/main/__tests__/scheduler-supervisor-record.test.cjs +0 -81
- package/src/main/__tests__/scheduler-tick-cancel-token.test.cjs +0 -54
- package/src/main/__tests__/scheduler-tick-wedge.test.cjs +0 -172
- package/src/main/__tests__/scheduler-transient-failure.test.cjs +0 -141
- package/src/main/__tests__/scheduler-unreadable-queue-guard.test.cjs +0 -62
- package/src/main/__tests__/scheduler-utilization-hold.test.cjs +0 -89
- package/src/main/__tests__/scheduler-verify-prd-path.test.cjs +0 -109
- package/src/main/__tests__/scheduler-worktree-cap-defer.test.cjs +0 -234
- package/src/main/__tests__/scheduler-worktree-exec-cwd.test.cjs +0 -120
- package/src/main/__tests__/scheduler-writeprd-epic-rollback.test.cjs +0 -105
- package/src/main/__tests__/schedulerBatchRootBlocker.test.cjs +0 -117
- package/src/main/__tests__/schedulerStateSidecarRestore.test.cjs +0 -110
- package/src/main/__tests__/seedAgentPersonas.test.cjs +0 -184
- package/src/main/__tests__/seedSchedulerMcp.test.cjs +0 -211
- package/src/main/__tests__/seedStatus.test.cjs +0 -100
- package/src/main/__tests__/seedValidatorPersona.test.cjs +0 -116
- package/src/main/__tests__/stop-signal-anchor.test.cjs +0 -75
- package/src/main/__tests__/telemetryClient.test.cjs +0 -1055
- package/src/main/__tests__/telemetryContract.test.cjs +0 -930
- package/src/main/__tests__/telemetrySettings.test.cjs +0 -210
- package/src/main/__tests__/transcripts-batch-flush.test.cjs +0 -249
- package/src/main/__tests__/transcripts-doFlush-array.test.cjs +0 -124
- package/src/main/__tests__/transcripts-paged-reads.test.cjs +0 -241
- package/src/main/__tests__/transcripts-worktree-epic-path.test.cjs +0 -154
- package/src/main/__tests__/transcriptsUsageFor.test.cjs +0 -206
- package/src/main/__tests__/uniquePrdNumbers.test.cjs +0 -153
- package/src/main/__tests__/usageSingleFlight.test.cjs +0 -169
- package/src/main/__tests__/validationSentinels.test.cjs +0 -84
- package/src/main/__tests__/workTypeLibrary.test.cjs +0 -89
- package/src/main/bilkoHost.cjs +0 -314
- package/src/main/bilkoHostCore.cjs +0 -89
- package/src/main/lib/__tests__/active-sessions.test.cjs +0 -251
- package/src/main/lib/__tests__/activeIndexRebuild.test.cjs +0 -179
- package/src/main/lib/__tests__/agentPersonaSchema.test.cjs +0 -67
- package/src/main/lib/__tests__/auditLog.test.cjs +0 -38
- package/src/main/lib/__tests__/bootSelfHeal.test.cjs +0 -107
- package/src/main/lib/__tests__/branchSweep.test.cjs +0 -164
- package/src/main/lib/__tests__/buildIdentity.test.cjs +0 -121
- package/src/main/lib/__tests__/buildTarget.test.cjs +0 -52
- package/src/main/lib/__tests__/childWithLog.test.cjs +0 -321
- package/src/main/lib/__tests__/coldBootPromptSessionsWrite.test.cjs +0 -87
- package/src/main/lib/__tests__/crashTelemetry.test.cjs +0 -103
- package/src/main/lib/__tests__/credentials-futile-refresh.test.cjs +0 -115
- package/src/main/lib/__tests__/cwdClassify.test.cjs +0 -111
- package/src/main/lib/__tests__/definitionOfDoneSequence.test.cjs +0 -95
- package/src/main/lib/__tests__/delegationReadiness.test.cjs +0 -1175
- package/src/main/lib/__tests__/dispatchLoop.test.cjs +0 -63
- package/src/main/lib/__tests__/effectiveModelInfo.test.cjs +0 -244
- package/src/main/lib/__tests__/ephemeralCwd.test.cjs +0 -91
- package/src/main/lib/__tests__/epicDelegationStats.test.cjs +0 -137
- package/src/main/lib/__tests__/epicSpawnCwd.test.cjs +0 -283
- package/src/main/lib/__tests__/epicSpawnPlan.test.cjs +0 -196
- package/src/main/lib/__tests__/epicTranscriptPath.test.cjs +0 -163
- package/src/main/lib/__tests__/epicWorktreeBoot.test.cjs +0 -136
- package/src/main/lib/__tests__/epicWorktreeMerge.test.cjs +0 -130
- package/src/main/lib/__tests__/epicWorktreeMint.test.cjs +0 -117
- package/src/main/lib/__tests__/epicWorktreeProjectConfig.test.cjs +0 -137
- package/src/main/lib/__tests__/fixChainDepth.test.cjs +0 -40
- package/src/main/lib/__tests__/fixtures/204-mercury-steam-horse.log.txt +0 -13
- package/src/main/lib/__tests__/fixtures/scheduler-machine.json.corrupt-1789147548 +0 -34
- package/src/main/lib/__tests__/gateFixtures.json +0 -20
- package/src/main/lib/__tests__/gitCacheBound.test.cjs +0 -69
- package/src/main/lib/__tests__/gitWorktree.test.cjs +0 -1478
- package/src/main/lib/__tests__/gitWorktreeSalvage.test.cjs +0 -107
- package/src/main/lib/__tests__/gitWorktreeSalvageDelta.test.cjs +0 -153
- package/src/main/lib/__tests__/guardShims.test.cjs +0 -158
- package/src/main/lib/__tests__/importReferences.spec.cjs +0 -56
- package/src/main/lib/__tests__/instanceLock.test.cjs +0 -173
- package/src/main/lib/__tests__/jobSupervisorRecord.test.cjs +0 -78
- package/src/main/lib/__tests__/jobWorktree.test.cjs +0 -199
- package/src/main/lib/__tests__/jobWorktreeBootLive.test.cjs +0 -82
- package/src/main/lib/__tests__/landedSinceRun.test.cjs +0 -133
- package/src/main/lib/__tests__/launchFailure.test.cjs +0 -220
- package/src/main/lib/__tests__/loadGate.test.cjs +0 -303
- package/src/main/lib/__tests__/localAdminHttp.test.cjs +0 -214
- package/src/main/lib/__tests__/loopDelay.test.cjs +0 -68
- package/src/main/lib/__tests__/mcpToolCatalog.test.cjs +0 -107
- package/src/main/lib/__tests__/modelCatalog.test.cjs +0 -202
- package/src/main/lib/__tests__/opsOwnership.test.cjs +0 -113
- package/src/main/lib/__tests__/opsRootAbsoluteCwd.test.cjs +0 -328
- package/src/main/lib/__tests__/opsRootNestedWrite.test.cjs +0 -51
- package/src/main/lib/__tests__/opsRootResolve.test.cjs +0 -149
- package/src/main/lib/__tests__/prdDeclaredPaths.test.cjs +0 -82
- package/src/main/lib/__tests__/prdDisposition.test.cjs +0 -224
- package/src/main/lib/__tests__/procIdentity.test.cjs +0 -119
- package/src/main/lib/__tests__/procName.test.cjs +0 -92
- package/src/main/lib/__tests__/projectBriefCore.test.cjs +0 -216
- package/src/main/lib/__tests__/projectRootResolve.test.cjs +0 -148
- package/src/main/lib/__tests__/queueHealth.test.cjs +0 -58
- package/src/main/lib/__tests__/queueStoreAtomicWrite.test.cjs +0 -88
- package/src/main/lib/__tests__/queueStoreMachineStateRecovery.test.cjs +0 -190
- package/src/main/lib/__tests__/quietMachineLease.test.cjs +0 -39
- package/src/main/lib/__tests__/rateLimitWindow.test.cjs +0 -88
- package/src/main/lib/__tests__/reaperHelpers.test.cjs +0 -577
- package/src/main/lib/__tests__/schedulerBatchDepends.test.cjs +0 -312
- package/src/main/lib/__tests__/schedulerBatchFairness.test.cjs +0 -213
- package/src/main/lib/__tests__/schedulerBatchLaunchHold.test.cjs +0 -125
- package/src/main/lib/__tests__/schedulerBatchProjectCap.test.cjs +0 -127
- package/src/main/lib/__tests__/schedulerBatchQuietMachine.test.cjs +0 -109
- package/src/main/lib/__tests__/schedulerMcpServerHeadlessRefusal.test.cjs +0 -71
- package/src/main/lib/__tests__/schedulerMcpServerHelp.test.cjs +0 -216
- package/src/main/lib/__tests__/schedulerMcpServerProjectHome.test.cjs +0 -183
- package/src/main/lib/__tests__/schedulerPaths.test.cjs +0 -226
- package/src/main/lib/__tests__/schedulerPathsWorktree.test.cjs +0 -133
- package/src/main/lib/__tests__/schedulerRuntimeState.test.cjs +0 -56
- package/src/main/lib/__tests__/sessionSlots.test.cjs +0 -144
- package/src/main/lib/__tests__/telemetryBacklog.test.cjs +0 -626
- package/src/main/lib/__tests__/telemetryBoot.test.cjs +0 -134
- package/src/main/lib/__tests__/telemetryConsent.test.cjs +0 -136
- package/src/main/lib/__tests__/telemetryCounters.test.cjs +0 -57
- package/src/main/lib/__tests__/telemetryCountersMetadataColumn.test.cjs +0 -98
- package/src/main/lib/__tests__/terminalRunOutcome.test.cjs +0 -200
- package/src/main/lib/__tests__/toolUseClassify.test.cjs +0 -53
- package/src/main/lib/__tests__/updateCheck.test.cjs +0 -63
- package/src/main/lib/__tests__/upgradeDrain.test.cjs +0 -130
- package/src/main/lib/__tests__/usageCircuit.test.cjs +0 -354
- package/src/main/lib/__tests__/watchdog-helpers.test.cjs +0 -375
- package/src/main/lib/__tests__/watchdog-relaunch.test.cjs +0 -266
- package/src/main/lib/kgExchangePairing.cjs +0 -75
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// PRD 1123 — a single row parked in `needs_review` (or `failed`/`skipped`)
|
|
4
|
-
// several dependsOn hops down used to read as generic starvation: the picker
|
|
5
|
-
// only ever named a held job's IMMEDIATE dep, which is very often just
|
|
6
|
-
// another `pending` row, not the actual cause. These tests pin the root-
|
|
7
|
-
// blocker walk: the reason must name the transitive ancestor that is itself
|
|
8
|
-
// not blocked by anything, plus the count of jobs held behind it and its
|
|
9
|
-
// status — and must terminate (not hang) on a dependsOn cycle.
|
|
10
|
-
//
|
|
11
|
-
// Run: timeout 120 npx vitest run src/main/__tests__/schedulerBatchRootBlocker.test.cjs
|
|
12
|
-
|
|
13
|
-
const assert = require('node:assert/strict');
|
|
14
|
-
const { pickForProject, DEFAULT_PROJECT_CWD } = require('../lib/schedulerBatch.cjs');
|
|
15
|
-
|
|
16
|
-
const CWD = DEFAULT_PROJECT_CWD;
|
|
17
|
-
|
|
18
|
-
function job(slug, status, extra = {}) {
|
|
19
|
-
return { slug, status, cwd: CWD, dependsOn: [], ...extra };
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
test('a 3-deep chain rooted at a needs_review row names the ROOT, not the middle link', () => {
|
|
23
|
-
const jobs = [
|
|
24
|
-
job('100-root', 'needs_review'),
|
|
25
|
-
job('101-middle', 'pending', { dependsOn: ['100-root'] }),
|
|
26
|
-
job('102-leaf', 'pending', { dependsOn: ['101-middle'] }),
|
|
27
|
-
];
|
|
28
|
-
const { batch, reason, holds } = pickForProject(jobs, new Set(), 3);
|
|
29
|
-
assert.deepEqual(batch, []);
|
|
30
|
-
assert.match(reason, /depends-gate/);
|
|
31
|
-
// Names the root, not the immediate (middle) dep as the cause.
|
|
32
|
-
assert.match(reason, /root blocker 100-root/);
|
|
33
|
-
assert.match(reason, /needs_review/);
|
|
34
|
-
assert.match(reason, /is a QUESTION awaiting a human/);
|
|
35
|
-
// Both downstream jobs are counted as held behind the root.
|
|
36
|
-
assert.match(reason, /holding 2 job\(s\)/);
|
|
37
|
-
assert.match(reason, /101-middle/);
|
|
38
|
-
assert.match(reason, /102-leaf/);
|
|
39
|
-
|
|
40
|
-
const leafHold = holds.find((h) => h.slug === '102-leaf');
|
|
41
|
-
assert.equal(leafHold.dep, '101-middle'); // immediate dep still recorded
|
|
42
|
-
assert.equal(leafHold.rootSlug, '100-root'); // but the row also knows the root
|
|
43
|
-
assert.equal(leafHold.rootStatus, 'needs_review');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('the same 3-deep chain rooted at a FAILED row names the root, not the middle link', () => {
|
|
47
|
-
const jobs = [
|
|
48
|
-
job('200-root', 'failed'),
|
|
49
|
-
job('201-middle', 'pending', { dependsOn: ['200-root'] }),
|
|
50
|
-
job('202-leaf', 'pending', { dependsOn: ['201-middle'] }),
|
|
51
|
-
];
|
|
52
|
-
const { batch, reason, holds } = pickForProject(jobs, new Set(), 3);
|
|
53
|
-
assert.deepEqual(batch, []);
|
|
54
|
-
assert.match(reason, /root blocker 200-root/);
|
|
55
|
-
assert.match(reason, /\(failed\)/);
|
|
56
|
-
assert.match(reason, /holding 1 job\(s\)/); // only 202-leaf: 201-middle is caught by the shallow failed-dep bucket
|
|
57
|
-
assert.match(reason, /Reset or archive 200-root/);
|
|
58
|
-
|
|
59
|
-
const leafHold = holds.find((h) => h.slug === '202-leaf');
|
|
60
|
-
assert.equal(leafHold.rootSlug, '200-root');
|
|
61
|
-
assert.equal(leafHold.rootStatus, 'failed');
|
|
62
|
-
const middleHold = holds.find((h) => h.slug === '201-middle');
|
|
63
|
-
assert.equal(middleHold.rootSlug, '200-root');
|
|
64
|
-
assert.equal(middleHold.rootStatus, 'failed');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('a 2-node dependsOn cycle is reported as its own reason, not a hang', () => {
|
|
68
|
-
const jobs = [
|
|
69
|
-
job('300-a', 'pending', { dependsOn: ['301-b'] }),
|
|
70
|
-
job('301-b', 'pending', { dependsOn: ['300-a'] }),
|
|
71
|
-
];
|
|
72
|
-
const start = Date.now();
|
|
73
|
-
const { batch, reason } = pickForProject(jobs, new Set(), 3);
|
|
74
|
-
assert.ok(Date.now() - start < 5000, 'must terminate quickly, not hang');
|
|
75
|
-
assert.deepEqual(batch, []);
|
|
76
|
-
assert.match(reason, /CYCLE/);
|
|
77
|
-
assert.match(reason, /300-a/);
|
|
78
|
-
assert.match(reason, /301-b/);
|
|
79
|
-
// Reported exactly once, not once per member.
|
|
80
|
-
assert.equal((reason.match(/CYCLE/g) || []).length, 1);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('no false stall reported when the gate is not the reason the batch is empty (slots exhausted)', () => {
|
|
84
|
-
const jobs = [job('400-a', 'pending'), job('401-b', 'pending')];
|
|
85
|
-
const { batch, reason } = pickForProject(jobs, new Set(), 0);
|
|
86
|
-
assert.deepEqual(batch, []);
|
|
87
|
-
assert.match(reason, /no slots free/);
|
|
88
|
-
assert.doesNotMatch(reason, /root blocker/);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('no false stall reported when the gate is not the reason the batch is empty (project cap)', () => {
|
|
92
|
-
const prevCap = process.env.SM_PROJECT_JOB_CAP;
|
|
93
|
-
process.env.SM_PROJECT_JOB_CAP = '1';
|
|
94
|
-
try {
|
|
95
|
-
const jobs = [
|
|
96
|
-
job('402-running', 'running'),
|
|
97
|
-
job('403-pending', 'pending'),
|
|
98
|
-
];
|
|
99
|
-
const { batch, reason } = pickForProject(jobs, new Set(['402-running']), 3);
|
|
100
|
-
assert.deepEqual(batch, []);
|
|
101
|
-
assert.match(reason, /project-cap/);
|
|
102
|
-
assert.doesNotMatch(reason, /root blocker/);
|
|
103
|
-
} finally {
|
|
104
|
-
if (prevCap === undefined) delete process.env.SM_PROJECT_JOB_CAP;
|
|
105
|
-
else process.env.SM_PROJECT_JOB_CAP = prevCap;
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test('a running/pending-rooted chain reports no stall reason (expected to clear on its own)', () => {
|
|
110
|
-
const jobs = [
|
|
111
|
-
job('500-root', 'running'),
|
|
112
|
-
job('501-dependent', 'pending', { dependsOn: ['500-root'] }),
|
|
113
|
-
];
|
|
114
|
-
const { batch, reason } = pickForProject(jobs, new Set(['500-root']), 3);
|
|
115
|
-
assert.deepEqual(batch, []);
|
|
116
|
-
assert.equal(reason, null);
|
|
117
|
-
});
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* schedulerStateSidecarRestore.test.cjs — covers PRD 1392: scheduler-state.json
|
|
3
|
-
* previously left lastPollOk, lastFailureKind, backoffNextAt, cachedUtilization and
|
|
4
|
-
* cachedBindingWindowName memory-only, so a fresh boot showed misleading footer/KPI
|
|
5
|
-
* placeholders (a healthy poller reading "failed", a still-rate-limited state
|
|
6
|
-
* un-showable, utilization stuck at "—") until the next post-boot billing poll
|
|
7
|
-
* overwrote them. Proves loadSchedulerState() restores all five from disk instead of
|
|
8
|
-
* leaving the hardcoded defaults (false / null / null / null / null) in place.
|
|
9
|
-
*
|
|
10
|
-
* scheduler.cjs is a plain CJS require (like rateLimitPollerStreak.test.cjs's), so its
|
|
11
|
-
* module-level `let`s are a singleton for this test file's process — the first test
|
|
12
|
-
* below captures the pre-load snapshot itself (the hardcoded defaults) rather than
|
|
13
|
-
* assuming a fresh module per test, so the proof doesn't depend on test ordering.
|
|
14
|
-
*
|
|
15
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/schedulerStateSidecarRestore.test.cjs
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
import { test, expect, beforeEach } from 'vitest';
|
|
21
|
-
import fs from 'node:fs';
|
|
22
|
-
import path from 'node:path';
|
|
23
|
-
|
|
24
|
-
const { loadSchedulerState, persistSchedulerState, getSchedulerStateSnapshot } = require('../scheduler.cjs');
|
|
25
|
-
const schedulerPaths = require('../lib/schedulerPaths.cjs');
|
|
26
|
-
|
|
27
|
-
function writeSidecar(data) {
|
|
28
|
-
fs.mkdirSync(path.dirname(schedulerPaths.schedulerStatePath()), { recursive: true });
|
|
29
|
-
fs.writeFileSync(schedulerPaths.schedulerStatePath(), JSON.stringify(data));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
try { fs.unlinkSync(schedulerPaths.schedulerStatePath()); } catch { /* no sidecar yet */ }
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('loadSchedulerState restores lastPollOk/lastFailureKind/backoffNextAt/cachedUtilization/cachedBindingWindowName from the sidecar, not the hardcoded defaults', () => {
|
|
37
|
-
// Before a restore, the module starts (or was left, by whatever ran before this test
|
|
38
|
-
// in-process) at whatever it was — capture it so the assertion below is a genuine
|
|
39
|
-
// "changed to match the file" proof, not an assumption about fresh-module defaults.
|
|
40
|
-
const before = getSchedulerStateSnapshot();
|
|
41
|
-
|
|
42
|
-
const written = {
|
|
43
|
-
version: 1,
|
|
44
|
-
lastPollOk: true,
|
|
45
|
-
lastFailureKind: 'meter_rate_limited',
|
|
46
|
-
backoffNextAt: 1_726_000_000_000,
|
|
47
|
-
cachedUtilization: 42,
|
|
48
|
-
cachedBindingWindowName: 'five_hour',
|
|
49
|
-
};
|
|
50
|
-
writeSidecar(written);
|
|
51
|
-
|
|
52
|
-
// Simulate a restart: a fresh process starts from the hardcoded module defaults
|
|
53
|
-
// (false / null / null / null / null) until loadSchedulerState() runs.
|
|
54
|
-
loadSchedulerState();
|
|
55
|
-
|
|
56
|
-
const after = getSchedulerStateSnapshot();
|
|
57
|
-
expect(after).toEqual({
|
|
58
|
-
lastPollOk: true,
|
|
59
|
-
lastFailureKind: 'meter_rate_limited',
|
|
60
|
-
backoffNextAt: 1_726_000_000_000,
|
|
61
|
-
cachedUtilization: 42,
|
|
62
|
-
cachedBindingWindowName: 'five_hour',
|
|
63
|
-
});
|
|
64
|
-
// The restore must have actually changed something relative to the pre-load
|
|
65
|
-
// snapshot — proves this run exercised the restore path, not a no-op.
|
|
66
|
-
expect(after).not.toEqual(before);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('persistSchedulerState writes the same five fields back out, round-tripping through the sidecar', () => {
|
|
70
|
-
writeSidecar({
|
|
71
|
-
version: 1,
|
|
72
|
-
lastPollOk: false,
|
|
73
|
-
lastFailureKind: 'auth',
|
|
74
|
-
backoffNextAt: 1_726_100_000_000,
|
|
75
|
-
cachedUtilization: 87.5,
|
|
76
|
-
cachedBindingWindowName: 'weekly_all',
|
|
77
|
-
});
|
|
78
|
-
loadSchedulerState();
|
|
79
|
-
|
|
80
|
-
persistSchedulerState();
|
|
81
|
-
|
|
82
|
-
const onDisk = JSON.parse(fs.readFileSync(schedulerPaths.schedulerStatePath(), 'utf8'));
|
|
83
|
-
expect(onDisk.lastPollOk).toBe(false);
|
|
84
|
-
expect(onDisk.lastFailureKind).toBe('auth');
|
|
85
|
-
expect(onDisk.backoffNextAt).toBe(1_726_100_000_000);
|
|
86
|
-
expect(onDisk.cachedUtilization).toBe(87.5);
|
|
87
|
-
expect(onDisk.cachedBindingWindowName).toBe('weekly_all');
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test('loadSchedulerState against a sidecar missing the five fields leaves the in-memory values unchanged (pre-PRD-1392 file)', () => {
|
|
91
|
-
// Establish a known non-default in-memory state first.
|
|
92
|
-
writeSidecar({
|
|
93
|
-
version: 1,
|
|
94
|
-
lastPollOk: true,
|
|
95
|
-
lastFailureKind: 'transient',
|
|
96
|
-
backoffNextAt: 5000,
|
|
97
|
-
cachedUtilization: 10,
|
|
98
|
-
cachedBindingWindowName: 'seven_day',
|
|
99
|
-
});
|
|
100
|
-
loadSchedulerState();
|
|
101
|
-
const established = getSchedulerStateSnapshot();
|
|
102
|
-
|
|
103
|
-
// A sidecar written before PRD 1392 (or first-boot with only the older fields) has
|
|
104
|
-
// none of the five new keys — loadSchedulerState's per-field `typeof` guards must
|
|
105
|
-
// leave whatever was already in memory alone, not stomp it back to a hardcoded default.
|
|
106
|
-
writeSidecar({ version: 1, lastPollAt: 123 });
|
|
107
|
-
loadSchedulerState();
|
|
108
|
-
|
|
109
|
-
expect(getSchedulerStateSnapshot()).toEqual(established);
|
|
110
|
-
});
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* seedAgentPersonas.test.cjs — unit tests for src/main/seedAgentPersonas.cjs.
|
|
3
|
-
*
|
|
4
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/seedAgentPersonas.test.cjs
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
import { test, expect, beforeEach, afterEach } from 'vitest';
|
|
10
|
-
const fs = require('node:fs');
|
|
11
|
-
const os = require('node:os');
|
|
12
|
-
const path = require('node:path');
|
|
13
|
-
|
|
14
|
-
let tmpHome;
|
|
15
|
-
let realHome;
|
|
16
|
-
let seedAgentPersonas;
|
|
17
|
-
|
|
18
|
-
// config.cjs bakes os.homedir() into top-level consts at first require
|
|
19
|
-
// (allowedRoots/WRITE_PREFIXES, used by writeJsonSync) — must be purged
|
|
20
|
-
// alongside seedAgentPersonas.cjs so each test's tmpHome takes effect.
|
|
21
|
-
const MODULES_TO_RELOAD = ['../seedAgentPersonas.cjs', '../config.cjs'];
|
|
22
|
-
|
|
23
|
-
function purgeRequireCache() {
|
|
24
|
-
for (const m of MODULES_TO_RELOAD) {
|
|
25
|
-
try { delete require.cache[require.resolve(m)]; } catch { /* not loaded yet */ }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
realHome = process.env.HOME;
|
|
31
|
-
tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'seed-agent-personas-test-'));
|
|
32
|
-
process.env.HOME = tmpHome;
|
|
33
|
-
delete process.env.SM_SEED_AGENT_PERSONAS_DISABLE;
|
|
34
|
-
purgeRequireCache();
|
|
35
|
-
({ seedAgentPersonas } = require('../seedAgentPersonas.cjs'));
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
afterEach(() => {
|
|
39
|
-
process.env.HOME = realHome;
|
|
40
|
-
delete process.env.SM_SEED_AGENT_PERSONAS_DISABLE;
|
|
41
|
-
fs.rmSync(tmpHome, { recursive: true, force: true });
|
|
42
|
-
purgeRequireCache();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function agentsDir() {
|
|
46
|
-
return path.join(tmpHome, '.claude', 'agents');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function markerPath() {
|
|
50
|
-
return path.join(tmpHome, '.claude', 'session-manager', '.agent-personas-seeded');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function silentLogger() {
|
|
54
|
-
return { log: () => {}, warn: () => {} };
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const ALL_PERSONAS = ['architect', 'dev-lead', 'project-home-builder', 'validator'];
|
|
58
|
-
|
|
59
|
-
test('fresh seed writes every persona file', async () => {
|
|
60
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
61
|
-
|
|
62
|
-
for (const name of ALL_PERSONAS) {
|
|
63
|
-
const dest = path.join(agentsDir(), `${name}.md`);
|
|
64
|
-
expect(fs.existsSync(dest)).toBe(true);
|
|
65
|
-
const bundled = fs.readFileSync(path.join(__dirname, '..', '..', 'seed', 'agents', `${name}.md`), 'utf8');
|
|
66
|
-
expect(fs.readFileSync(dest, 'utf8')).toBe(bundled);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const marker = JSON.parse(fs.readFileSync(markerPath(), 'utf8'));
|
|
70
|
-
expect(marker.seeded.sort()).toEqual([...ALL_PERSONAS].sort());
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test('a pre-existing persona file is left byte-identical', async () => {
|
|
74
|
-
fs.mkdirSync(agentsDir(), { recursive: true });
|
|
75
|
-
const architect = path.join(agentsDir(), 'architect.md');
|
|
76
|
-
const customContent = '# My custom architect\nnever overwrite me\n';
|
|
77
|
-
fs.writeFileSync(architect, customContent);
|
|
78
|
-
|
|
79
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
80
|
-
|
|
81
|
-
expect(fs.readFileSync(architect, 'utf8')).toBe(customContent);
|
|
82
|
-
// dev-lead and project-home-builder had no pre-existing file, so they should still be seeded.
|
|
83
|
-
expect(fs.existsSync(path.join(agentsDir(), 'dev-lead.md'))).toBe(true);
|
|
84
|
-
expect(fs.existsSync(path.join(agentsDir(), 'project-home-builder.md'))).toBe(true);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('a machine already fully seeded under the old done:true marker only picks up a newly added persona', async () => {
|
|
88
|
-
const mPath = markerPath();
|
|
89
|
-
fs.mkdirSync(path.dirname(mPath), { recursive: true });
|
|
90
|
-
// Legacy marker shape from before the seeded-set change — no `seeded` array.
|
|
91
|
-
fs.writeFileSync(mPath, JSON.stringify({ done: true, attempts: 1, ts: '2026-01-01T00:00:00.000Z' }));
|
|
92
|
-
fs.mkdirSync(agentsDir(), { recursive: true });
|
|
93
|
-
fs.writeFileSync(path.join(agentsDir(), 'architect.md'), 'old architect content\n');
|
|
94
|
-
fs.writeFileSync(path.join(agentsDir(), 'dev-lead.md'), 'old dev-lead content\n');
|
|
95
|
-
|
|
96
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
97
|
-
|
|
98
|
-
// Pre-existing files from the old run are untouched...
|
|
99
|
-
expect(fs.readFileSync(path.join(agentsDir(), 'architect.md'), 'utf8')).toBe('old architect content\n');
|
|
100
|
-
expect(fs.readFileSync(path.join(agentsDir(), 'dev-lead.md'), 'utf8')).toBe('old dev-lead content\n');
|
|
101
|
-
// ...but the newly added persona is delivered.
|
|
102
|
-
expect(fs.existsSync(path.join(agentsDir(), 'project-home-builder.md'))).toBe(true);
|
|
103
|
-
|
|
104
|
-
const marker = JSON.parse(fs.readFileSync(mPath, 'utf8'));
|
|
105
|
-
expect(marker.seeded.sort()).toEqual([...ALL_PERSONAS].sort());
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('a machine already seeded under the new seeded-set marker picks up a newly added persona', async () => {
|
|
109
|
-
const mPath = markerPath();
|
|
110
|
-
fs.mkdirSync(path.dirname(mPath), { recursive: true });
|
|
111
|
-
fs.writeFileSync(mPath, JSON.stringify({ seeded: ['architect', 'dev-lead'], attempts: 0, ts: '2026-01-01T00:00:00.000Z' }));
|
|
112
|
-
|
|
113
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
114
|
-
|
|
115
|
-
expect(fs.existsSync(path.join(agentsDir(), 'project-home-builder.md'))).toBe(true);
|
|
116
|
-
const marker = JSON.parse(fs.readFileSync(mPath, 'utf8'));
|
|
117
|
-
expect(marker.seeded.sort()).toEqual([...ALL_PERSONAS].sort());
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test('a machine with every known persona already in the seeded set short-circuits without touching agents dir', async () => {
|
|
121
|
-
const mPath = markerPath();
|
|
122
|
-
fs.mkdirSync(path.dirname(mPath), { recursive: true });
|
|
123
|
-
fs.writeFileSync(mPath, JSON.stringify({ seeded: ALL_PERSONAS, attempts: 0, ts: '2026-01-01T00:00:00.000Z' }));
|
|
124
|
-
|
|
125
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
126
|
-
|
|
127
|
-
expect(fs.existsSync(agentsDir())).toBe(false);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test('a corrupt/unparseable marker file still seeds correctly', async () => {
|
|
131
|
-
const mPath = markerPath();
|
|
132
|
-
fs.mkdirSync(path.dirname(mPath), { recursive: true });
|
|
133
|
-
fs.writeFileSync(mPath, '{ not valid json');
|
|
134
|
-
|
|
135
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
136
|
-
|
|
137
|
-
for (const name of ALL_PERSONAS) {
|
|
138
|
-
expect(fs.existsSync(path.join(agentsDir(), `${name}.md`))).toBe(true);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test('the bundled project-home-builder persona contains no session-manager-repo paths', () => {
|
|
143
|
-
const content = fs.readFileSync(
|
|
144
|
-
path.join(__dirname, '..', '..', 'seed', 'agents', 'project-home-builder.md'),
|
|
145
|
-
'utf8'
|
|
146
|
-
);
|
|
147
|
-
const forbidden = [
|
|
148
|
-
'session-manager-operations/architecture/',
|
|
149
|
-
'.claude/agents/',
|
|
150
|
-
'session-manager-operations/design-mocks/',
|
|
151
|
-
'scripts/',
|
|
152
|
-
'npm run build:project-pages',
|
|
153
|
-
];
|
|
154
|
-
for (const substr of forbidden) {
|
|
155
|
-
expect(content).not.toContain(substr);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('seeded dev-lead persona pins an executor-tier model', () => {
|
|
160
|
-
const { splitFrontmatter } = require('../lib/prdFrontmatter.cjs');
|
|
161
|
-
const raw = fs.readFileSync(path.join(__dirname, '..', '..', 'seed', 'agents', 'dev-lead.md'), 'utf8');
|
|
162
|
-
const { fm } = splitFrontmatter(raw);
|
|
163
|
-
expect(fm.model).toBe('sonnet');
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
test('seeded dev-lead body fits AGENT_BODY_CHAR_CAP and carries the run contract', () => {
|
|
167
|
-
const { splitFrontmatter } = require('../lib/prdFrontmatter.cjs');
|
|
168
|
-
const { AGENT_BODY_CHAR_CAP } = require('../lib/agentModelResolve.cjs');
|
|
169
|
-
const raw = fs.readFileSync(path.join(__dirname, '..', '..', 'seed', 'agents', 'dev-lead.md'), 'utf8');
|
|
170
|
-
const { body } = splitFrontmatter(raw);
|
|
171
|
-
const trimmed = body.trim();
|
|
172
|
-
expect(trimmed.length).toBeLessThan(AGENT_BODY_CHAR_CAP);
|
|
173
|
-
expect(trimmed).toContain('## Run contract');
|
|
174
|
-
expect(trimmed).toContain('SCHEDULER_VERDICT: PASS');
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test('SM_SEED_AGENT_PERSONAS_DISABLE=1 short-circuits', async () => {
|
|
178
|
-
process.env.SM_SEED_AGENT_PERSONAS_DISABLE = '1';
|
|
179
|
-
|
|
180
|
-
await seedAgentPersonas({ logger: silentLogger() });
|
|
181
|
-
|
|
182
|
-
expect(fs.existsSync(agentsDir())).toBe(false);
|
|
183
|
-
expect(fs.existsSync(markerPath())).toBe(false);
|
|
184
|
-
});
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* seedSchedulerMcp.test.cjs — unit tests for src/main/seedSchedulerMcp.cjs.
|
|
3
|
-
*
|
|
4
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/seedSchedulerMcp.test.cjs
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
import { test, expect, beforeEach, afterEach } from 'vitest';
|
|
10
|
-
const fs = require('node:fs');
|
|
11
|
-
const os = require('node:os');
|
|
12
|
-
const path = require('node:path');
|
|
13
|
-
|
|
14
|
-
let tmpHome;
|
|
15
|
-
let realHome;
|
|
16
|
-
let seedSchedulerMcp;
|
|
17
|
-
|
|
18
|
-
// config.cjs bakes os.homedir() into top-level consts at first require
|
|
19
|
-
// (allowedRoots/WRITE_PREFIXES, used by writeJsonSync) — must be purged
|
|
20
|
-
// alongside seedSchedulerMcp.cjs so each test's tmpHome takes effect.
|
|
21
|
-
const MODULES_TO_RELOAD = ['../seedSchedulerMcp.cjs', '../config.cjs'];
|
|
22
|
-
|
|
23
|
-
function purgeRequireCache() {
|
|
24
|
-
for (const m of MODULES_TO_RELOAD) {
|
|
25
|
-
try { delete require.cache[require.resolve(m)]; } catch { /* not loaded yet */ }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
realHome = process.env.HOME;
|
|
31
|
-
tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'seed-scheduler-mcp-test-'));
|
|
32
|
-
process.env.HOME = tmpHome;
|
|
33
|
-
delete process.env.SM_SEED_SCHEDULER_MCP_DISABLE;
|
|
34
|
-
purgeRequireCache();
|
|
35
|
-
({ seedSchedulerMcp } = require('../seedSchedulerMcp.cjs'));
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
afterEach(() => {
|
|
39
|
-
process.env.HOME = realHome;
|
|
40
|
-
delete process.env.SM_SEED_SCHEDULER_MCP_DISABLE;
|
|
41
|
-
fs.rmSync(tmpHome, { recursive: true, force: true });
|
|
42
|
-
purgeRequireCache();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function markerPath() {
|
|
46
|
-
return path.join(tmpHome, '.claude', 'session-manager', '.scheduler-mcp-seeded');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function claudeJsonPath() {
|
|
50
|
-
return path.join(tmpHome, '.claude.json');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function silentLogger() {
|
|
54
|
-
return { log: () => {}, warn: () => {} };
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function readMarker() {
|
|
58
|
-
return JSON.parse(fs.readFileSync(markerPath(), 'utf8'));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
test('fresh registration calls addFn with the absolute server path and writes done marker', async () => {
|
|
62
|
-
const calls = [];
|
|
63
|
-
const addFn = async (serverPath) => {
|
|
64
|
-
calls.push(serverPath);
|
|
65
|
-
return { ok: true, exitCode: 0 };
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
69
|
-
|
|
70
|
-
expect(calls).toHaveLength(1);
|
|
71
|
-
expect(path.isAbsolute(calls[0])).toBe(true);
|
|
72
|
-
expect(calls[0].endsWith(path.join('scripts', 'scheduler-mcp-server.cjs'))).toBe(true);
|
|
73
|
-
|
|
74
|
-
const marker = readMarker();
|
|
75
|
-
expect(marker.done).toBe(true);
|
|
76
|
-
expect(marker.attempts).toBe(0);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('already-registered at user scope short-circuits without calling addFn', async () => {
|
|
80
|
-
fs.writeFileSync(
|
|
81
|
-
claudeJsonPath(),
|
|
82
|
-
JSON.stringify({
|
|
83
|
-
mcpServers: {
|
|
84
|
-
'session-manager-scheduler': { type: 'stdio', command: 'node', args: ['/some/path/scheduler-mcp-server.cjs'] },
|
|
85
|
-
fetch: { type: 'stdio', command: 'uvx', args: ['mcp-server-fetch'] },
|
|
86
|
-
},
|
|
87
|
-
})
|
|
88
|
-
);
|
|
89
|
-
let called = false;
|
|
90
|
-
const addFn = async () => { called = true; return { ok: true }; };
|
|
91
|
-
|
|
92
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
93
|
-
|
|
94
|
-
expect(called).toBe(false);
|
|
95
|
-
const marker = readMarker();
|
|
96
|
-
expect(marker.done).toBe(true);
|
|
97
|
-
|
|
98
|
-
// Untouched — the pre-existing registration (and sibling entries) stay as-is.
|
|
99
|
-
const claudeJson = JSON.parse(fs.readFileSync(claudeJsonPath(), 'utf8'));
|
|
100
|
-
expect(claudeJson.mcpServers['session-manager-scheduler'].args).toEqual(['/some/path/scheduler-mcp-server.cjs']);
|
|
101
|
-
expect(claudeJson.mcpServers.fetch).toBeDefined();
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('done:true marker short-circuits without calling addFn', async () => {
|
|
105
|
-
fs.mkdirSync(path.dirname(markerPath()), { recursive: true });
|
|
106
|
-
fs.writeFileSync(markerPath(), JSON.stringify({ done: true, attempts: 1, ts: '2026-01-01T00:00:00.000Z' }));
|
|
107
|
-
let called = false;
|
|
108
|
-
const addFn = async () => { called = true; return { ok: true }; };
|
|
109
|
-
|
|
110
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
111
|
-
|
|
112
|
-
expect(called).toBe(false);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
test('SM_SEED_SCHEDULER_MCP_DISABLE=1 short-circuits', async () => {
|
|
116
|
-
process.env.SM_SEED_SCHEDULER_MCP_DISABLE = '1';
|
|
117
|
-
let called = false;
|
|
118
|
-
const addFn = async () => { called = true; return { ok: true }; };
|
|
119
|
-
|
|
120
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
121
|
-
|
|
122
|
-
expect(called).toBe(false);
|
|
123
|
-
expect(fs.existsSync(markerPath())).toBe(false);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test('a failed attempt bumps the counter and stops after MAX_ATTEMPTS', async () => {
|
|
127
|
-
const addFn = async () => ({ ok: false, error: 'boom' });
|
|
128
|
-
|
|
129
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
130
|
-
expect(readMarker()).toMatchObject({ done: false, attempts: 1 });
|
|
131
|
-
|
|
132
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
133
|
-
expect(readMarker()).toMatchObject({ done: false, attempts: 2 });
|
|
134
|
-
|
|
135
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn });
|
|
136
|
-
expect(readMarker()).toMatchObject({ done: false, attempts: 3 });
|
|
137
|
-
|
|
138
|
-
// MAX_ATTEMPTS reached — a 4th run must not call addFn again or bump further.
|
|
139
|
-
let called = false;
|
|
140
|
-
const trackedAddFn = async () => { called = true; return { ok: false, error: 'boom' }; };
|
|
141
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn: trackedAddFn });
|
|
142
|
-
|
|
143
|
-
expect(called).toBe(false);
|
|
144
|
-
expect(readMarker()).toMatchObject({ done: false, attempts: 3 });
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// ─────────────────────────────── repair: marker done, script path stale
|
|
148
|
-
|
|
149
|
-
test('marker done + user-scope script path missing -> removes then re-adds, marker stays done', async () => {
|
|
150
|
-
fs.mkdirSync(path.dirname(markerPath()), { recursive: true });
|
|
151
|
-
fs.writeFileSync(markerPath(), JSON.stringify({ done: true, attempts: 0, ts: '2026-01-01T00:00:00.000Z' }));
|
|
152
|
-
fs.writeFileSync(
|
|
153
|
-
claudeJsonPath(),
|
|
154
|
-
JSON.stringify({
|
|
155
|
-
mcpServers: {
|
|
156
|
-
'session-manager-scheduler': { type: 'stdio', command: 'node', args: ['/definitely/does/not/exist.cjs'] },
|
|
157
|
-
},
|
|
158
|
-
})
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const removeCalls = [];
|
|
162
|
-
const removeFn = async () => { removeCalls.push(1); return { ok: true }; };
|
|
163
|
-
const addCalls = [];
|
|
164
|
-
const addFn = async (serverPath) => { addCalls.push(serverPath); return { ok: true, exitCode: 0 }; };
|
|
165
|
-
|
|
166
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn, removeFn });
|
|
167
|
-
|
|
168
|
-
expect(removeCalls).toHaveLength(1);
|
|
169
|
-
expect(addCalls).toHaveLength(1);
|
|
170
|
-
expect(path.isAbsolute(addCalls[0])).toBe(true);
|
|
171
|
-
expect(readMarker().done).toBe(true);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test('marker done + user-scope entry ABSENT (deliberate remove) stays removed, no repair attempted', async () => {
|
|
175
|
-
fs.mkdirSync(path.dirname(markerPath()), { recursive: true });
|
|
176
|
-
fs.writeFileSync(markerPath(), JSON.stringify({ done: true, attempts: 0, ts: '2026-01-01T00:00:00.000Z' }));
|
|
177
|
-
// No ~/.claude.json at all — same as a deliberate `claude mcp remove`.
|
|
178
|
-
|
|
179
|
-
let removeCalled = false;
|
|
180
|
-
let addCalled = false;
|
|
181
|
-
const removeFn = async () => { removeCalled = true; return { ok: true }; };
|
|
182
|
-
const addFn = async () => { addCalled = true; return { ok: true }; };
|
|
183
|
-
|
|
184
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn, removeFn });
|
|
185
|
-
|
|
186
|
-
expect(removeCalled).toBe(false);
|
|
187
|
-
expect(addCalled).toBe(false);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test('marker done + user-scope script path exists -> healthy, no repair attempted', async () => {
|
|
191
|
-
fs.mkdirSync(path.dirname(markerPath()), { recursive: true });
|
|
192
|
-
fs.writeFileSync(markerPath(), JSON.stringify({ done: true, attempts: 0, ts: '2026-01-01T00:00:00.000Z' }));
|
|
193
|
-
fs.writeFileSync(
|
|
194
|
-
claudeJsonPath(),
|
|
195
|
-
JSON.stringify({
|
|
196
|
-
mcpServers: {
|
|
197
|
-
'session-manager-scheduler': { type: 'stdio', command: 'node', args: [markerPath()] }, // any existing file
|
|
198
|
-
},
|
|
199
|
-
})
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
let removeCalled = false;
|
|
203
|
-
let addCalled = false;
|
|
204
|
-
const removeFn = async () => { removeCalled = true; return { ok: true }; };
|
|
205
|
-
const addFn = async () => { addCalled = true; return { ok: true }; };
|
|
206
|
-
|
|
207
|
-
await seedSchedulerMcp({ logger: silentLogger(), addFn, removeFn });
|
|
208
|
-
|
|
209
|
-
expect(removeCalled).toBe(false);
|
|
210
|
-
expect(addCalled).toBe(false);
|
|
211
|
-
});
|