@cleocode/core 2026.10.1 → 2026.10.3
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/dist/build-provenance.json +2 -2
- package/dist/cloud/http.d.ts +2 -0
- package/dist/cloud/http.d.ts.map +1 -1
- package/dist/cloud/http.js +3 -0
- package/dist/cloud/http.js.map +1 -1
- package/dist/cloud/journal.d.ts +9 -5
- package/dist/cloud/journal.d.ts.map +1 -1
- package/dist/cloud/journal.js +29 -8
- package/dist/cloud/journal.js.map +1 -1
- package/dist/cloud/manifest-check.d.ts +140 -4
- package/dist/cloud/manifest-check.d.ts.map +1 -1
- package/dist/cloud/manifest-check.js +322 -10
- package/dist/cloud/manifest-check.js.map +1 -1
- package/dist/cloud/nexus-attach.d.ts +25 -0
- package/dist/cloud/nexus-attach.d.ts.map +1 -1
- package/dist/cloud/nexus-attach.js +81 -6
- package/dist/cloud/nexus-attach.js.map +1 -1
- package/dist/cloud/nexus-cloud-activity.d.ts +37 -0
- package/dist/cloud/nexus-cloud-activity.d.ts.map +1 -0
- package/dist/cloud/nexus-cloud-activity.js +79 -0
- package/dist/cloud/nexus-cloud-activity.js.map +1 -0
- package/dist/cloud/nexus-cloud-status.d.ts.map +1 -1
- package/dist/cloud/nexus-cloud-status.js +36 -0
- package/dist/cloud/nexus-cloud-status.js.map +1 -1
- package/dist/cloud/nexus-device.d.ts +1 -1
- package/dist/cloud/nexus-enrol.d.ts.map +1 -1
- package/dist/cloud/nexus-enrol.js +5 -0
- package/dist/cloud/nexus-enrol.js.map +1 -1
- package/dist/cloud/nexus-home.d.ts +74 -0
- package/dist/cloud/nexus-home.d.ts.map +1 -0
- package/dist/cloud/nexus-home.js +97 -0
- package/dist/cloud/nexus-home.js.map +1 -0
- package/dist/cloud/nexus-vault-keys.d.ts +130 -0
- package/dist/cloud/nexus-vault-keys.d.ts.map +1 -0
- package/dist/cloud/nexus-vault-keys.js +347 -0
- package/dist/cloud/nexus-vault-keys.js.map +1 -0
- package/dist/cloud/nexus-vault-state.d.ts +121 -0
- package/dist/cloud/nexus-vault-state.d.ts.map +1 -0
- package/dist/cloud/nexus-vault-state.js +274 -0
- package/dist/cloud/nexus-vault-state.js.map +1 -0
- package/dist/cloud/nexus-vault.d.ts +160 -0
- package/dist/cloud/nexus-vault.d.ts.map +1 -0
- package/dist/cloud/nexus-vault.js +1745 -0
- package/dist/cloud/nexus-vault.js.map +1 -0
- package/dist/cloud/signing.d.ts +24 -8
- package/dist/cloud/signing.d.ts.map +1 -1
- package/dist/cloud/signing.js +61 -15
- package/dist/cloud/signing.js.map +1 -1
- package/dist/docs/export-document.js +8137 -3318
- package/dist/docs/export-document.js.map +3 -3
- package/dist/doctor/migrations.d.ts +75 -0
- package/dist/doctor/migrations.d.ts.map +1 -0
- package/dist/doctor/migrations.js +136 -0
- package/dist/doctor/migrations.js.map +1 -0
- package/dist/doctor/sync-sealer.d.ts +48 -0
- package/dist/doctor/sync-sealer.d.ts.map +1 -0
- package/dist/doctor/sync-sealer.js +109 -0
- package/dist/doctor/sync-sealer.js.map +1 -0
- package/dist/doctor/sync-triggers.d.ts +53 -0
- package/dist/doctor/sync-triggers.d.ts.map +1 -0
- package/dist/doctor/sync-triggers.js +157 -0
- package/dist/doctor/sync-triggers.js.map +1 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +5 -1
- package/dist/init.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/llm/plugin-facade.js +8442 -3623
- package/dist/llm/plugin-facade.js.map +3 -3
- package/dist/nexus/projects-clean.d.ts +3 -0
- package/dist/nexus/projects-clean.d.ts.map +1 -1
- package/dist/nexus/projects-clean.js +9 -3
- package/dist/nexus/projects-clean.js.map +1 -1
- package/dist/nexus/registry-roots.d.ts +3 -1
- package/dist/nexus/registry-roots.d.ts.map +1 -1
- package/dist/nexus/registry-roots.js +5 -2
- package/dist/nexus/registry-roots.js.map +1 -1
- package/dist/nexus/registry.d.ts +8 -1
- package/dist/nexus/registry.d.ts.map +1 -1
- package/dist/nexus/registry.js +24 -10
- package/dist/nexus/registry.js.map +1 -1
- package/dist/nexus/workspace.d.ts +4 -1
- package/dist/nexus/workspace.d.ts.map +1 -1
- package/dist/nexus/workspace.js +10 -4
- package/dist/nexus/workspace.js.map +1 -1
- package/dist/orchestrate/spawn-ops.d.ts.map +1 -1
- package/dist/orchestrate/spawn-ops.js +7 -2
- package/dist/orchestrate/spawn-ops.js.map +1 -1
- package/dist/orchestrate/worker-verify.d.ts +121 -12
- package/dist/orchestrate/worker-verify.d.ts.map +1 -1
- package/dist/orchestrate/worker-verify.js +172 -21
- package/dist/orchestrate/worker-verify.js.map +1 -1
- package/dist/orchestration/spawn-prompt.d.ts.map +1 -1
- package/dist/orchestration/spawn-prompt.js +15 -9
- package/dist/orchestration/spawn-prompt.js.map +1 -1
- package/dist/release/ci-evidence.d.ts +9 -0
- package/dist/release/ci-evidence.d.ts.map +1 -1
- package/dist/release/ci-evidence.js +9 -2
- package/dist/release/ci-evidence.js.map +1 -1
- package/dist/resources/backend.d.ts +15 -3
- package/dist/resources/backend.d.ts.map +1 -1
- package/dist/resources/backend.js +7 -3
- package/dist/resources/backend.js.map +1 -1
- package/dist/resources/darwin-backend.d.ts +142 -0
- package/dist/resources/darwin-backend.d.ts.map +1 -0
- package/dist/resources/darwin-backend.js +288 -0
- package/dist/resources/darwin-backend.js.map +1 -0
- package/dist/resources/governor.d.ts +44 -1
- package/dist/resources/governor.d.ts.map +1 -1
- package/dist/resources/governor.js +100 -36
- package/dist/resources/governor.js.map +1 -1
- package/dist/resources/heavy-command.d.ts +132 -0
- package/dist/resources/heavy-command.d.ts.map +1 -0
- package/dist/resources/heavy-command.js +768 -0
- package/dist/resources/heavy-command.js.map +1 -0
- package/dist/resources/monitor.d.ts +50 -1
- package/dist/resources/monitor.d.ts.map +1 -1
- package/dist/resources/monitor.js +83 -1
- package/dist/resources/monitor.js.map +1 -1
- package/dist/resources/run-admission.d.ts +303 -0
- package/dist/resources/run-admission.d.ts.map +1 -0
- package/dist/resources/run-admission.js +648 -0
- package/dist/resources/run-admission.js.map +1 -0
- package/dist/resources/run-class.d.ts +111 -0
- package/dist/resources/run-class.d.ts.map +1 -0
- package/dist/resources/run-class.js +658 -0
- package/dist/resources/run-class.js.map +1 -0
- package/dist/resources/run-governed.d.ts +158 -0
- package/dist/resources/run-governed.d.ts.map +1 -0
- package/dist/resources/run-governed.js +406 -0
- package/dist/resources/run-governed.js.map +1 -0
- package/dist/resources/slot-holder.d.ts +267 -0
- package/dist/resources/slot-holder.d.ts.map +1 -0
- package/dist/resources/slot-holder.js +505 -0
- package/dist/resources/slot-holder.js.map +1 -0
- package/dist/resources/tool-groups.d.ts +74 -0
- package/dist/resources/tool-groups.d.ts.map +1 -0
- package/dist/resources/tool-groups.js +118 -0
- package/dist/resources/tool-groups.js.map +1 -0
- package/dist/routing/build-command-groups.d.ts.map +1 -1
- package/dist/routing/build-command-groups.js +1 -0
- package/dist/routing/build-command-groups.js.map +1 -1
- package/dist/selfimprove/fix-gen.js +8446 -3627
- package/dist/selfimprove/fix-gen.js.map +3 -3
- package/dist/sentient/cross-project-hygiene.d.ts +3 -2
- package/dist/sentient/cross-project-hygiene.d.ts.map +1 -1
- package/dist/sentient/cross-project-hygiene.js +5 -2
- package/dist/sentient/cross-project-hygiene.js.map +1 -1
- package/dist/sentient/state.d.ts +7 -0
- package/dist/sentient/state.d.ts.map +1 -1
- package/dist/sentient/state.js.map +1 -1
- package/dist/sentient/tick.d.ts +14 -2
- package/dist/sentient/tick.d.ts.map +1 -1
- package/dist/sentient/tick.js +63 -4
- package/dist/sentient/tick.js.map +1 -1
- package/dist/store/backup-recover.d.ts.map +1 -1
- package/dist/store/backup-recover.js +5 -0
- package/dist/store/backup-recover.js.map +1 -1
- package/dist/store/data-accessor.d.ts +1 -0
- package/dist/store/data-accessor.d.ts.map +1 -1
- package/dist/store/data-accessor.js +7 -0
- package/dist/store/data-accessor.js.map +1 -1
- package/dist/store/dual-scope-db.d.ts +23 -1
- package/dist/store/dual-scope-db.d.ts.map +1 -1
- package/dist/store/dual-scope-db.js +126 -36
- package/dist/store/dual-scope-db.js.map +1 -1
- package/dist/store/exodus/recovery.d.ts.map +1 -1
- package/dist/store/exodus/recovery.js +15 -0
- package/dist/store/exodus/recovery.js.map +1 -1
- package/dist/store/legacy-tasks-lineage.d.ts.map +1 -1
- package/dist/store/legacy-tasks-lineage.js +5 -0
- package/dist/store/legacy-tasks-lineage.js.map +1 -1
- package/dist/store/lock.d.ts +8 -1
- package/dist/store/lock.d.ts.map +1 -1
- package/dist/store/lock.js +10 -2
- package/dist/store/lock.js.map +1 -1
- package/dist/store/migration-manager.d.ts +5 -0
- package/dist/store/migration-manager.d.ts.map +1 -1
- package/dist/store/migration-manager.js +11 -0
- package/dist/store/migration-manager.js.map +1 -1
- package/dist/store/migration-runner.d.ts +158 -0
- package/dist/store/migration-runner.d.ts.map +1 -0
- package/dist/store/migration-runner.js +493 -0
- package/dist/store/migration-runner.js.map +1 -0
- package/dist/store/portable-bundle-import.d.ts +15 -1
- package/dist/store/portable-bundle-import.d.ts.map +1 -1
- package/dist/store/portable-bundle-import.js +24 -4
- package/dist/store/portable-bundle-import.js.map +1 -1
- package/dist/store/portable-bundle-relocate.d.ts +43 -0
- package/dist/store/portable-bundle-relocate.d.ts.map +1 -1
- package/dist/store/portable-bundle-relocate.js +79 -5
- package/dist/store/portable-bundle-relocate.js.map +1 -1
- package/dist/store/portable-bundle-scan.d.ts +42 -0
- package/dist/store/portable-bundle-scan.d.ts.map +1 -1
- package/dist/store/portable-bundle-scan.js +132 -25
- package/dist/store/portable-bundle-scan.js.map +1 -1
- package/dist/store/portable-bundle.d.ts +40 -0
- package/dist/store/portable-bundle.d.ts.map +1 -1
- package/dist/store/portable-bundle.js +43 -7
- package/dist/store/portable-bundle.js.map +1 -1
- package/dist/store/row-identity-registry.d.ts +137 -7
- package/dist/store/row-identity-registry.d.ts.map +1 -1
- package/dist/store/row-identity-registry.js +364 -9
- package/dist/store/row-identity-registry.js.map +1 -1
- package/dist/store/row-identity.d.ts.map +1 -1
- package/dist/store/row-identity.js +9 -10
- package/dist/store/row-identity.js.map +1 -1
- package/dist/store/sqlite-data-accessor.d.ts.map +1 -1
- package/dist/store/sqlite-data-accessor.js +10 -0
- package/dist/store/sqlite-data-accessor.js.map +1 -1
- package/dist/store/sqlite.d.ts +31 -0
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +5 -1
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/sync/capture.d.ts +203 -0
- package/dist/store/sync/capture.d.ts.map +1 -0
- package/dist/store/sync/capture.js +562 -0
- package/dist/store/sync/capture.js.map +1 -0
- package/dist/store/sync/clock-store.d.ts.map +1 -1
- package/dist/store/sync/clock-store.js +2 -0
- package/dist/store/sync/clock-store.js.map +1 -1
- package/dist/store/sync/fk-orphans.d.ts +133 -0
- package/dist/store/sync/fk-orphans.d.ts.map +1 -0
- package/dist/store/sync/fk-orphans.js +265 -0
- package/dist/store/sync/fk-orphans.js.map +1 -0
- package/dist/store/sync/flags.d.ts +7 -0
- package/dist/store/sync/flags.d.ts.map +1 -1
- package/dist/store/sync/flags.js +16 -0
- package/dist/store/sync/flags.js.map +1 -1
- package/dist/store/sync/hlc.d.ts.map +1 -1
- package/dist/store/sync/hlc.js +4 -0
- package/dist/store/sync/hlc.js.map +1 -1
- package/dist/store/sync/identity-fill.d.ts +45 -0
- package/dist/store/sync/identity-fill.d.ts.map +1 -0
- package/dist/store/sync/identity-fill.js +85 -0
- package/dist/store/sync/identity-fill.js.map +1 -0
- package/dist/store/sync/machinery.d.ts +27 -0
- package/dist/store/sync/machinery.d.ts.map +1 -0
- package/dist/store/sync/machinery.js +44 -0
- package/dist/store/sync/machinery.js.map +1 -0
- package/dist/store/sync/netting.d.ts +120 -0
- package/dist/store/sync/netting.d.ts.map +1 -0
- package/dist/store/sync/netting.js +336 -0
- package/dist/store/sync/netting.js.map +1 -0
- package/dist/store/sync/replica.d.ts +27 -2
- package/dist/store/sync/replica.d.ts.map +1 -1
- package/dist/store/sync/replica.js +47 -3
- package/dist/store/sync/replica.js.map +1 -1
- package/dist/store/sync/schema.d.ts +12 -0
- package/dist/store/sync/schema.d.ts.map +1 -1
- package/dist/store/sync/schema.js +21 -0
- package/dist/store/sync/schema.js.map +1 -1
- package/dist/store/sync/seal-backlog.d.ts +21 -0
- package/dist/store/sync/seal-backlog.d.ts.map +1 -0
- package/dist/store/sync/seal-backlog.js +24 -0
- package/dist/store/sync/seal-backlog.js.map +1 -0
- package/dist/store/sync/sealer-values.d.ts +34 -0
- package/dist/store/sync/sealer-values.d.ts.map +1 -0
- package/dist/store/sync/sealer-values.js +53 -0
- package/dist/store/sync/sealer-values.js.map +1 -0
- package/dist/store/sync/sealer.d.ts +145 -0
- package/dist/store/sync/sealer.d.ts.map +1 -0
- package/dist/store/sync/sealer.js +906 -0
- package/dist/store/sync/sealer.js.map +1 -0
- package/dist/store/sync/structural.d.ts +63 -0
- package/dist/store/sync/structural.d.ts.map +1 -0
- package/dist/store/sync/structural.js +180 -0
- package/dist/store/sync/structural.js.map +1 -0
- package/dist/store/sync/timestamps.d.ts +92 -0
- package/dist/store/sync/timestamps.d.ts.map +1 -0
- package/dist/store/sync/timestamps.js +228 -0
- package/dist/store/sync/timestamps.js.map +1 -0
- package/dist/store/sync/tombstones.d.ts +75 -0
- package/dist/store/sync/tombstones.d.ts.map +1 -0
- package/dist/store/sync/tombstones.js +103 -0
- package/dist/store/sync/tombstones.js.map +1 -0
- package/dist/store/sync/trigger-classes.d.ts +221 -0
- package/dist/store/sync/trigger-classes.d.ts.map +1 -0
- package/dist/store/sync/trigger-classes.js +441 -0
- package/dist/store/sync/trigger-classes.js.map +1 -0
- package/dist/store/sync/trigger-suspend-at-path.d.ts +23 -0
- package/dist/store/sync/trigger-suspend-at-path.d.ts.map +1 -0
- package/dist/store/sync/trigger-suspend-at-path.js +44 -0
- package/dist/store/sync/trigger-suspend-at-path.js.map +1 -0
- package/dist/store/sync/writer-version.d.ts +43 -0
- package/dist/store/sync/writer-version.d.ts.map +1 -0
- package/dist/store/sync/writer-version.js +90 -0
- package/dist/store/sync/writer-version.js.map +1 -0
- package/dist/store/table-classification.d.ts.map +1 -1
- package/dist/store/table-classification.js +102 -0
- package/dist/store/table-classification.js.map +1 -1
- package/dist/store/trigger-suspend-schema.d.ts +44 -0
- package/dist/store/trigger-suspend-schema.d.ts.map +1 -0
- package/dist/store/trigger-suspend-schema.js +25 -0
- package/dist/store/trigger-suspend-schema.js.map +1 -0
- package/dist/store/vault-manifest.d.ts +365 -0
- package/dist/store/vault-manifest.d.ts.map +1 -0
- package/dist/store/vault-manifest.js +812 -0
- package/dist/store/vault-manifest.js.map +1 -0
- package/dist/store/writer-lease.d.ts +31 -0
- package/dist/store/writer-lease.d.ts.map +1 -1
- package/dist/store/writer-lease.js +65 -2
- package/dist/store/writer-lease.js.map +1 -1
- package/dist/system/health.d.ts.map +1 -1
- package/dist/system/health.js +21 -0
- package/dist/system/health.js.map +1 -1
- package/dist/system/project-health.d.ts.map +1 -1
- package/dist/system/project-health.js +3 -1
- package/dist/system/project-health.js.map +1 -1
- package/dist/tasks/affected-packages.d.ts +58 -0
- package/dist/tasks/affected-packages.d.ts.map +1 -1
- package/dist/tasks/affected-packages.js +75 -6
- package/dist/tasks/affected-packages.js.map +1 -1
- package/dist/tasks/affected-scope.d.ts +150 -23
- package/dist/tasks/affected-scope.d.ts.map +1 -1
- package/dist/tasks/affected-scope.js +320 -32
- package/dist/tasks/affected-scope.js.map +1 -1
- package/dist/tasks/change-set.d.ts +96 -0
- package/dist/tasks/change-set.d.ts.map +1 -1
- package/dist/tasks/change-set.js +169 -4
- package/dist/tasks/change-set.js.map +1 -1
- package/dist/tasks/complete-ci.d.ts +115 -0
- package/dist/tasks/complete-ci.d.ts.map +1 -0
- package/dist/tasks/complete-ci.js +171 -0
- package/dist/tasks/complete-ci.js.map +1 -0
- package/dist/tasks/complete.d.ts.map +1 -1
- package/dist/tasks/complete.js +50 -17
- package/dist/tasks/complete.js.map +1 -1
- package/dist/tasks/compute-task-view.d.ts.map +1 -1
- package/dist/tasks/compute-task-view.js +7 -0
- package/dist/tasks/compute-task-view.js.map +1 -1
- package/dist/tasks/done-plan.d.ts.map +1 -1
- package/dist/tasks/done-plan.js +51 -30
- package/dist/tasks/done-plan.js.map +1 -1
- package/dist/tasks/done-record.d.ts +6 -0
- package/dist/tasks/done-record.d.ts.map +1 -1
- package/dist/tasks/done-record.js +9 -3
- package/dist/tasks/done-record.js.map +1 -1
- package/dist/tasks/evidence.d.ts +3 -2
- package/dist/tasks/evidence.d.ts.map +1 -1
- package/dist/tasks/evidence.js +143 -12
- package/dist/tasks/evidence.js.map +1 -1
- package/dist/tasks/gate-notes.d.ts +22 -0
- package/dist/tasks/gate-notes.d.ts.map +1 -0
- package/dist/tasks/gate-notes.js +33 -0
- package/dist/tasks/gate-notes.js.map +1 -0
- package/dist/tasks/index.d.ts +2 -1
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +2 -1
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/test-run-binding.d.ts +117 -0
- package/dist/tasks/test-run-binding.d.ts.map +1 -0
- package/dist/tasks/test-run-binding.js +365 -0
- package/dist/tasks/test-run-binding.js.map +1 -0
- package/dist/tasks/tool-cache-env.d.ts +123 -0
- package/dist/tasks/tool-cache-env.d.ts.map +1 -0
- package/dist/tasks/tool-cache-env.js +287 -0
- package/dist/tasks/tool-cache-env.js.map +1 -0
- package/dist/tasks/tool-cache-failed-first.d.ts +155 -0
- package/dist/tasks/tool-cache-failed-first.d.ts.map +1 -0
- package/dist/tasks/tool-cache-failed-first.js +285 -0
- package/dist/tasks/tool-cache-failed-first.js.map +1 -0
- package/dist/tasks/tool-cache.d.ts +375 -55
- package/dist/tasks/tool-cache.d.ts.map +1 -1
- package/dist/tasks/tool-cache.js +912 -303
- package/dist/tasks/tool-cache.js.map +1 -1
- package/dist/tasks/tool-resolver.d.ts +4 -3
- package/dist/tasks/tool-resolver.d.ts.map +1 -1
- package/dist/tasks/tool-resolver.js +15 -4
- package/dist/tasks/tool-resolver.js.map +1 -1
- package/dist/tasks/tool-semaphore.d.ts +67 -7
- package/dist/tasks/tool-semaphore.d.ts.map +1 -1
- package/dist/tasks/tool-semaphore.js +134 -56
- package/dist/tasks/tool-semaphore.js.map +1 -1
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +4 -0
- package/dist/upgrade.js.map +1 -1
- package/dist/validation/engine-ops.d.ts +6 -0
- package/dist/validation/engine-ops.d.ts.map +1 -1
- package/dist/validation/engine-ops.js +8 -0
- package/dist/validation/engine-ops.js.map +1 -1
- package/migrations/drizzle-cleo-project/20260930170000_t12819-trigger-suspend-clause/migration.sql +367 -0
- package/migrations/sync-journal/20260930120000_t12343-capture/migration.sql +47 -0
- package/migrations/sync-journal/20261001170000_t12984-sealer/migration.sql +101 -0
- package/package.json +13 -13
- package/templates/CLEO-INJECTION.md +5 -5
- package/templates/CLEO-REFERENCE.md +8 -4
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Holder records for local lock slots: the governor's class slots and the
|
|
3
|
+
* tool semaphore's per-tool slots (T12963, gh#1222).
|
|
4
|
+
*
|
|
5
|
+
* `proper-lockfile` frees a slot whose holder died only after
|
|
6
|
+
* {@link SLOT_LOCK_STALE_MS} (10 min) of mtime staleness. With a one-slot
|
|
7
|
+
* `test-run` budget, a SIGKILLed `cleo verify tool:test` blocked every later
|
|
8
|
+
* heavy run for ten minutes, and the deferral named no one. Each slot carries
|
|
9
|
+
* a `<slot>.holder.json` record: the holder's pid and process start time, the
|
|
10
|
+
* lock directory it describes, and the process groups of the tools it started.
|
|
11
|
+
* A slot is reaped only when the holder pid is provably gone (or recycled) AND
|
|
12
|
+
* every one of those tool groups is gone too: a tool started detached outlives
|
|
13
|
+
* a SIGKILLed cleo, and it is the tool that uses the machine.
|
|
14
|
+
*
|
|
15
|
+
* Start times are `ps -o lstart=` strings rendered under `PS_STABLE_ENV` (UTC,
|
|
16
|
+
* C locale), so a string written by one process compares equal to the same
|
|
17
|
+
* process's start time read by another, whatever either one's `TZ` or locale.
|
|
18
|
+
*
|
|
19
|
+
* @task T12963
|
|
20
|
+
*/
|
|
21
|
+
import type { ResourceClass } from '@cleocode/contracts';
|
|
22
|
+
/**
|
|
23
|
+
* A slot lock older than this may be stolen (its holder presumed dead): the
|
|
24
|
+
* `proper-lockfile` stale window of every governor slot, and the default of
|
|
25
|
+
* every tool-semaphore slot.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SLOT_LOCK_STALE_MS = 600000;
|
|
28
|
+
/**
|
|
29
|
+
* How often a governor slot holder refreshes its lock. Short, so a holder
|
|
30
|
+
* frozen by a job pause keeps its slot for nearly the whole stale window
|
|
31
|
+
* (#1777 round 6).
|
|
32
|
+
*/
|
|
33
|
+
export declare const SLOT_LOCK_UPDATE_MS = 15000;
|
|
34
|
+
/**
|
|
35
|
+
* The liveness fields every slot holder record carries.
|
|
36
|
+
*
|
|
37
|
+
* @task T12963
|
|
38
|
+
*/
|
|
39
|
+
export interface SlotHolderIdentity {
|
|
40
|
+
/** OS process id of the holder. */
|
|
41
|
+
pid: number;
|
|
42
|
+
/** Host the pid belongs to. Liveness is only judged on this host. */
|
|
43
|
+
host: string;
|
|
44
|
+
/**
|
|
45
|
+
* The holder's process start time (`ps -o lstart=` under `PS_STABLE_ENV`),
|
|
46
|
+
* or `null` when `ps` could not say. A live process at `pid` with a
|
|
47
|
+
* different start time is not the holder: the pid was recycled. Absent from
|
|
48
|
+
* records written before T12963.
|
|
49
|
+
*/
|
|
50
|
+
startedAt?: string | null;
|
|
51
|
+
/**
|
|
52
|
+
* The lock directory this record describes (`<ino>:<birthtimeMs>`), or
|
|
53
|
+
* `null` when it has no usable identity. A record whose lock was since
|
|
54
|
+
* replaced, or that has no identity, never authorises a reap.
|
|
55
|
+
*/
|
|
56
|
+
lockId?: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Process groups of the tools the holder started while holding the slot.
|
|
59
|
+
* The slot stays held while any of them has a member.
|
|
60
|
+
*/
|
|
61
|
+
toolGroups?: readonly number[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Who holds a local governor slot, written to `<slot>.holder.json` once the
|
|
65
|
+
* lock is taken.
|
|
66
|
+
*
|
|
67
|
+
* @task T12963
|
|
68
|
+
*/
|
|
69
|
+
export interface GovernorSlotHolder extends SlotHolderIdentity {
|
|
70
|
+
/** The holder's process start time, or `null` when `ps` could not say. */
|
|
71
|
+
startedAt: string | null;
|
|
72
|
+
/** The lock directory this record describes, or `null` when it has none. */
|
|
73
|
+
lockId: string | null;
|
|
74
|
+
/** Class the slot belongs to. */
|
|
75
|
+
cls: ResourceClass;
|
|
76
|
+
/** Wall-clock acquisition time (epoch ms), for deferral messages. */
|
|
77
|
+
acquiredAtMs: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* How a holder's pid and tool groups are probed. Tests inject one; production
|
|
81
|
+
* uses `kill(pid, 0)`, `kill(-pgid, 0)` and `ps`.
|
|
82
|
+
*
|
|
83
|
+
* @task T12963
|
|
84
|
+
*/
|
|
85
|
+
export interface PidProbe {
|
|
86
|
+
/** `gone` (no such process), `alive`, or `unknown` when the probe itself failed. */
|
|
87
|
+
liveness(pid: number): 'gone' | 'alive' | 'unknown';
|
|
88
|
+
/** The process start time as `ps -o lstart=` prints it, or `null` when it cannot be read. */
|
|
89
|
+
startedAt(pid: number): string | null;
|
|
90
|
+
/** `gone` (no member left), `alive`, or `unknown` when the probe failed. */
|
|
91
|
+
groupLiveness(pgid: number): 'gone' | 'alive' | 'unknown';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Verdict on a slot's recorded holder. Only `dead` frees the slot; `unknown`
|
|
95
|
+
* keeps it held, because reaping a live holder would admit two heavy runs
|
|
96
|
+
* against one budget.
|
|
97
|
+
*
|
|
98
|
+
* @task T12963
|
|
99
|
+
*/
|
|
100
|
+
export type GovernorHolderState = 'alive' | 'dead' | 'unknown';
|
|
101
|
+
/**
|
|
102
|
+
* This process's start time (`ps -o lstart=` under `PS_STABLE_ENV`), read once
|
|
103
|
+
* per process, or `null` when `ps` could not say.
|
|
104
|
+
*
|
|
105
|
+
* @returns The start time, or `null`.
|
|
106
|
+
*
|
|
107
|
+
* @task T12963
|
|
108
|
+
*/
|
|
109
|
+
export declare function ownProcessStartedAt(): string | null;
|
|
110
|
+
/**
|
|
111
|
+
* A lock directory's identity: `<ino>:<birthtimeMs>`, or `null` when the
|
|
112
|
+
* filesystem reports no birth time (NFS, FUSE, older kernels report 0). An
|
|
113
|
+
* inode alone can be reused by the next lock, so such a lock has no identity
|
|
114
|
+
* and is never reaped (T12963 re-review F3).
|
|
115
|
+
*
|
|
116
|
+
* @param ino - The lock directory's inode.
|
|
117
|
+
* @param birthtimeMs - Its birth time, as `fs.Stats.birthtimeMs`.
|
|
118
|
+
* @returns The identity, or `null`.
|
|
119
|
+
*
|
|
120
|
+
* @internal Exported for tests.
|
|
121
|
+
* @task T12963
|
|
122
|
+
*/
|
|
123
|
+
export declare function lockIdentity(ino: number, birthtimeMs: number): string | null;
|
|
124
|
+
/**
|
|
125
|
+
* The identity of a slot's current lock directory, for a holder record's
|
|
126
|
+
* `lockId`, or `null` when there is no lock or it has no usable identity.
|
|
127
|
+
*
|
|
128
|
+
* @param slotPath - Slot lock file path.
|
|
129
|
+
* @returns The lock identity, or `null`.
|
|
130
|
+
*
|
|
131
|
+
* @task T12963
|
|
132
|
+
*/
|
|
133
|
+
export declare function currentLockId(slotPath: string): string | null;
|
|
134
|
+
/**
|
|
135
|
+
* Write a slot's holder record. Best-effort: a failed write leaves the slot
|
|
136
|
+
* unreapable (it waits out the stale timeout), never unheld.
|
|
137
|
+
*
|
|
138
|
+
* @param slotPath - Slot lock file path.
|
|
139
|
+
* @param record - The record to write.
|
|
140
|
+
*
|
|
141
|
+
* @task T12963
|
|
142
|
+
*/
|
|
143
|
+
export declare function writeHolderRecord(slotPath: string, record: SlotHolderIdentity): void;
|
|
144
|
+
/**
|
|
145
|
+
* Keep a held slot's record listing every tool group this process starts
|
|
146
|
+
* while it holds the slot. Rewrites only while the slot's lock is still the
|
|
147
|
+
* one the record describes.
|
|
148
|
+
*
|
|
149
|
+
* @param slotPath - Slot lock file path.
|
|
150
|
+
* @param record - The record as first written (its `toolGroups` are replaced).
|
|
151
|
+
* @returns The groups already running (put them in the first record) and `stop`.
|
|
152
|
+
*
|
|
153
|
+
* @task T12963
|
|
154
|
+
*/
|
|
155
|
+
export declare function recordToolGroupsWhileHeld<T extends SlotHolderIdentity>(slotPath: string, record: () => T): {
|
|
156
|
+
groups: readonly number[];
|
|
157
|
+
stop: () => void;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Write the holder record for a governor slot whose lock is held, stamping it
|
|
161
|
+
* with the current lock's identity.
|
|
162
|
+
*
|
|
163
|
+
* @param slotPath - Slot lock file path.
|
|
164
|
+
* @param holder - Who holds it.
|
|
165
|
+
* @returns The record as written.
|
|
166
|
+
*
|
|
167
|
+
* @internal Exported so tests can plant a foreign holder.
|
|
168
|
+
* @task T12963
|
|
169
|
+
*/
|
|
170
|
+
export declare function writeGovernorHolder(slotPath: string, holder: Omit<GovernorSlotHolder, 'lockId'>): GovernorSlotHolder;
|
|
171
|
+
/**
|
|
172
|
+
* Read a governor slot's holder record, or `null` when absent or malformed.
|
|
173
|
+
*
|
|
174
|
+
* @param slotPath - Slot lock file path.
|
|
175
|
+
* @returns The record, or `null`.
|
|
176
|
+
*
|
|
177
|
+
* @task T12963
|
|
178
|
+
*/
|
|
179
|
+
export declare function readGovernorHolder(slotPath: string): GovernorSlotHolder | null;
|
|
180
|
+
/**
|
|
181
|
+
* Decide whether a slot's recorded holder still holds it.
|
|
182
|
+
*
|
|
183
|
+
* - `dead`: the holder pid is gone, or alive with a different start time
|
|
184
|
+
* than the record's (a recycled pid), AND every tool group it started is
|
|
185
|
+
* gone.
|
|
186
|
+
* - `unknown`: no record, another host's pid, a pid of 1 or below, a record
|
|
187
|
+
* that does not describe the current lock (or a lock with no identity), or
|
|
188
|
+
* a probe that failed. Never treated as dead.
|
|
189
|
+
* - `alive`: otherwise, including a live pid whose start time was never
|
|
190
|
+
* recorded, and a dead holder whose tool is still running.
|
|
191
|
+
*
|
|
192
|
+
* A live holder's `proper-lockfile` timer refreshes the lock mtime (governor
|
|
193
|
+
* slots every 15 s, tool slots every 5 min). While the mtime is within
|
|
194
|
+
* {@link LOCK_REFRESH_WINDOW_MS} a live pid is taken as the holder without
|
|
195
|
+
* asking `ps`, so a contended acquire spawns nothing. A pid recycled inside that window therefore reads as alive until
|
|
196
|
+
* the refresh lapses; that is the safe direction.
|
|
197
|
+
*
|
|
198
|
+
* @param holder - The slot's record, or `null`.
|
|
199
|
+
* @param slotPath - Slot lock file path. Without it the lock identity and
|
|
200
|
+
* mtime are not consulted, so a live pid is always `alive` (report-only).
|
|
201
|
+
* @param probe - Pid probe; tests inject one.
|
|
202
|
+
* @returns The verdict.
|
|
203
|
+
*
|
|
204
|
+
* @task T12963
|
|
205
|
+
*/
|
|
206
|
+
export declare function assessSlotHolder(holder: SlotHolderIdentity | null, slotPath?: string, probe?: PidProbe): GovernorHolderState;
|
|
207
|
+
/**
|
|
208
|
+
* {@link assessSlotHolder} for a governor slot's record.
|
|
209
|
+
*
|
|
210
|
+
* @param holder - The slot's record, or `null`.
|
|
211
|
+
* @param slotPath - Slot lock file path.
|
|
212
|
+
* @param probe - Pid probe; tests inject one.
|
|
213
|
+
* @returns The verdict.
|
|
214
|
+
*
|
|
215
|
+
* @task T12963
|
|
216
|
+
*/
|
|
217
|
+
export declare function assessGovernorHolder(holder: GovernorSlotHolder | null, slotPath: string, probe?: PidProbe): GovernorHolderState;
|
|
218
|
+
/**
|
|
219
|
+
* Free a held slot whose holder is provably dead: its pid gone or recycled
|
|
220
|
+
* and every tool group it started gone.
|
|
221
|
+
*
|
|
222
|
+
* Runs under a per-slot guard and re-checks the holder inside it. The holder
|
|
223
|
+
* record is removed with the lock, so a second reaper that takes the guard
|
|
224
|
+
* afterwards finds no record (or the next holder's) and stands down. A lock
|
|
225
|
+
* within {@link STALE_TAKEOVER_MARGIN_MS} of `staleMs` is left to
|
|
226
|
+
* `proper-lockfile`, and the lock identity is re-read immediately before the
|
|
227
|
+
* `rm`, so a concurrent stale takeover's fresh lock is never removed.
|
|
228
|
+
*
|
|
229
|
+
* @param slotPath - Slot lock file path.
|
|
230
|
+
* @param readHolder - Reads the slot's record (the governor's or the tool semaphore's).
|
|
231
|
+
* @param opts - The slot's `proper-lockfile` stale threshold, and a probe (tests).
|
|
232
|
+
* @returns `true` when the slot was reaped; the caller then takes it.
|
|
233
|
+
*
|
|
234
|
+
* @task T12963
|
|
235
|
+
*/
|
|
236
|
+
export declare function reapSlotIfHolderDead(slotPath: string, readHolder: (slotPath: string) => SlotHolderIdentity | null, opts?: {
|
|
237
|
+
staleMs?: number;
|
|
238
|
+
probe?: PidProbe;
|
|
239
|
+
}): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Name every held governor slot and its holder, for a deferral reason.
|
|
242
|
+
*
|
|
243
|
+
* @param slots - Slot lock file paths of one class.
|
|
244
|
+
* @returns `; held by …`, or `''` when no slot is held.
|
|
245
|
+
*
|
|
246
|
+
* @task T12963
|
|
247
|
+
*/
|
|
248
|
+
export declare function describeSlotHolders(slots: readonly string[]): string;
|
|
249
|
+
/**
|
|
250
|
+
* Take a slot without waiting: free, or freed by reaping a dead holder.
|
|
251
|
+
*
|
|
252
|
+
* @param slotPath - Slot lock file path.
|
|
253
|
+
* @param cls - Class the slot belongs to.
|
|
254
|
+
* @returns The grant's release (drops the holder record, then the lock), or
|
|
255
|
+
* `null` when the slot is held.
|
|
256
|
+
* @throws Any lock error other than `ELOCKED` (an unwritable slot directory),
|
|
257
|
+
* for the governor's fail-open path.
|
|
258
|
+
*
|
|
259
|
+
* @task T12963
|
|
260
|
+
*/
|
|
261
|
+
export declare function lockSlot(slotPath: string, cls: ResourceClass): Promise<(() => Promise<void>) | null>;
|
|
262
|
+
/**
|
|
263
|
+
* Forget cached start times, this process's included. Tests only.
|
|
264
|
+
* @internal
|
|
265
|
+
*/
|
|
266
|
+
export declare function _resetSlotHolderStateForTest(): void;
|
|
267
|
+
//# sourceMappingURL=slot-holder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-holder.d.ts","sourceRoot":"","sources":["../../src/resources/slot-holder.ts"],"names":[],"mappings":"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"}
|