create-principles-disciple 1.156.2 → 1.157.2
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/_release/product-identity.json +2 -2
- package/codex-adapter/dist/worker/workspace-worker.d.ts +11 -3
- package/codex-adapter/dist/worker/workspace-worker.js +30 -16
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/models/OwnerDecisionConsoleModel.js +33 -1
- package/console/dist/web/assets/app.js +3 -3
- package/core/dist/runtime/adversarial-loop.d.ts +8 -0
- package/core/dist/runtime/adversarial-loop.d.ts.map +1 -1
- package/core/dist/runtime/adversarial-loop.js +420 -45
- package/core/dist/runtime/adversarial-loop.js.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +3 -3
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/core/dist/runtime/feature-flags/plugin-surface-registry.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/plugin-surface-registry.js +0 -16
- package/core/dist/runtime/feature-flags/plugin-surface-registry.js.map +1 -1
- package/core/dist/runtime/index.d.ts +4 -0
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +10 -0
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/internalization/artificer-runner.d.ts +9 -0
- package/core/dist/runtime/internalization/artificer-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/artificer-runner.js +52 -0
- package/core/dist/runtime/internalization/artificer-runner.js.map +1 -1
- package/core/dist/runtime/internalization/correlation-lineage.d.ts +16 -3
- package/core/dist/runtime/internalization/correlation-lineage.d.ts.map +1 -1
- package/core/dist/runtime/internalization/correlation-lineage.js +4 -4
- package/core/dist/runtime/internalization/correlation-lineage.js.map +1 -1
- package/core/dist/runtime/internalization/evaluator-runner.d.ts +35 -0
- package/core/dist/runtime/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/evaluator-runner.js +390 -91
- package/core/dist/runtime/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +40 -13
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.js +520 -199
- package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
- package/core/dist/runtime/internalization/internalization-transition-decision.js +1 -1
- package/core/dist/runtime/internalization/internalization-transition-decision.js.map +1 -1
- package/core/dist/runtime/internalization/owner-resolution-service.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-resolution-service.js +10 -8
- package/core/dist/runtime/internalization/owner-resolution-service.js.map +1 -1
- package/core/dist/runtime/internalization/owner-review.d.ts +2 -0
- package/core/dist/runtime/internalization/owner-review.d.ts.map +1 -1
- package/core/dist/runtime/internalization/owner-review.js +17 -11
- package/core/dist/runtime/internalization/owner-review.js.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts +2 -0
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.js.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts +36 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.js +23 -2
- package/core/dist/runtime/internalization/pitask-metadata.js.map +1 -1
- package/core/dist/runtime/internalization/repair-create.d.ts +73 -0
- package/core/dist/runtime/internalization/repair-create.d.ts.map +1 -0
- package/core/dist/runtime/internalization/repair-create.js +200 -0
- package/core/dist/runtime/internalization/repair-create.js.map +1 -0
- package/core/dist/runtime/internalization/repair-lineage-backfill.d.ts +94 -0
- package/core/dist/runtime/internalization/repair-lineage-backfill.d.ts.map +1 -0
- package/core/dist/runtime/internalization/repair-lineage-backfill.js +123 -0
- package/core/dist/runtime/internalization/repair-lineage-backfill.js.map +1 -0
- package/core/dist/runtime/internalization/repair-task-identity.d.ts +99 -4
- package/core/dist/runtime/internalization/repair-task-identity.d.ts.map +1 -1
- package/core/dist/runtime/internalization/repair-task-identity.js +225 -7
- package/core/dist/runtime/internalization/repair-task-identity.js.map +1 -1
- package/core/dist/runtime/internalization/revision-reopen.d.ts +56 -1
- package/core/dist/runtime/internalization/revision-reopen.d.ts.map +1 -1
- package/core/dist/runtime/internalization/revision-reopen.js +82 -39
- package/core/dist/runtime/internalization/revision-reopen.js.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-runner.d.ts +0 -7
- package/core/dist/runtime/internalization/rollout-reviewer-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-runner.js +13 -68
- package/core/dist/runtime/internalization/rollout-reviewer-runner.js.map +1 -1
- package/core/dist/runtime/internalization/successor-create.d.ts +69 -0
- package/core/dist/runtime/internalization/successor-create.d.ts.map +1 -0
- package/core/dist/runtime/internalization/successor-create.js +173 -0
- package/core/dist/runtime/internalization/successor-create.js.map +1 -0
- package/core/dist/runtime/internalization/successor-lookup.d.ts +50 -0
- package/core/dist/runtime/internalization/successor-lookup.d.ts.map +1 -0
- package/core/dist/runtime/internalization/successor-lookup.js +213 -0
- package/core/dist/runtime/internalization/successor-lookup.js.map +1 -0
- package/core/dist/runtime/runner/succeeded-result-recovery.d.ts +58 -0
- package/core/dist/runtime/runner/succeeded-result-recovery.d.ts.map +1 -0
- package/core/dist/runtime/runner/succeeded-result-recovery.js +117 -0
- package/core/dist/runtime/runner/succeeded-result-recovery.js.map +1 -0
- package/core/dist/runtime/store/runtime-state-manager.d.ts +1 -0
- package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.js +4 -0
- package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.d.ts +3 -3
- package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.js +52 -0
- package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts +3 -0
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.js +204 -135
- package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/task-store.d.ts +17 -0
- package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
- package/core/dist/telemetry-event.d.ts +2 -2
- package/core/dist/telemetry-event.d.ts.map +1 -1
- package/core/dist/telemetry-event.js +4 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +69 -11
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +432 -120
- package/dist/installer.js.map +1 -1
- package/dist/service-host-bridge.d.ts +0 -5
- package/dist/service-host-bridge.d.ts.map +1 -1
- package/dist/service-host-bridge.js.map +1 -1
- package/dist/service-host-provisioning.d.ts +123 -18
- package/dist/service-host-provisioning.d.ts.map +1 -1
- package/dist/service-host-provisioning.js +645 -77
- package/dist/service-host-provisioning.js.map +1 -1
- package/dist/utils/env.d.ts +9 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +269 -49
- package/dist/utils/env.js.map +1 -1
- package/host-runtime/dist/codex-worker-status.d.ts +6 -4
- package/host-runtime/dist/codex-worker-status.js +7 -5
- package/host-runtime/dist/diagnostician-auto-run.js +2 -2
- package/host-runtime/dist/governance-signal-admission.d.ts +2 -1
- package/host-runtime/dist/governance-signal-admission.js +2 -1
- package/host-runtime/dist/index.d.ts +4 -2
- package/host-runtime/dist/index.js +6 -2
- package/host-runtime/dist/internalization-consumer-cycle.d.ts +13 -106
- package/host-runtime/dist/internalization-consumer-cycle.js +21 -99
- package/host-runtime/dist/internalization-consumer-governance.d.ts +3 -3
- package/host-runtime/dist/internalization-consumer-governance.js +17 -96
- package/host-runtime/dist/internalization-task-executor.d.ts +127 -0
- package/host-runtime/dist/internalization-task-executor.js +121 -0
- package/host-runtime/dist/workbuddy-worker-status.d.ts +6 -3
- package/host-runtime/dist/workbuddy-worker-status.js +7 -4
- package/host-runtime/dist/workspace-telemetry-emitter.js +1 -1
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/background-execution-transition.d.ts +25 -29
- package/install-layout/dist/background-execution-transition.js +90 -138
- package/install-layout/dist/index.d.ts +45 -33
- package/install-layout/dist/index.js +24 -18
- package/install-layout/package.json +1 -1
- package/package.json +5 -4
- package/pd-cli/dist/commands/codex-worker.d.ts +7 -3
- package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-worker.js +125 -101
- package/pd-cli/dist/commands/codex-worker.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +148 -130
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +4 -0
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/pd-cli/dist/commands/service-run-once.d.ts +12 -27
- package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/service-run-once.js +15 -206
- package/pd-cli/dist/commands/service-run-once.js.map +1 -1
- package/pd-cli/dist/commands/workbuddy-worker.d.ts +7 -2
- package/pd-cli/dist/commands/workbuddy-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/workbuddy-worker.js +133 -99
- package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
- package/pd-cli/dist/commands/worker-service-host-gate.d.ts +38 -0
- package/pd-cli/dist/commands/worker-service-host-gate.d.ts.map +1 -0
- package/pd-cli/dist/commands/worker-service-host-gate.js +110 -0
- package/pd-cli/dist/commands/worker-service-host-gate.js.map +1 -0
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +20 -84
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.js +198 -142
- package/pd-cli/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/pd-cli/dist/services/service-host/coordinator-common.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/coordinator-common.js +4 -5
- package/pd-cli/dist/services/service-host/coordinator-common.js.map +1 -1
- package/pd-cli/dist/services/service-host/index.d.ts +7 -10
- package/pd-cli/dist/services/service-host/index.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/index.js +8 -11
- package/pd-cli/dist/services/service-host/index.js.map +1 -1
- package/pd-cli/dist/services/service-host/install-identity.d.ts +5 -5
- package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/managed-run.js +19 -22
- package/pd-cli/dist/services/service-host/managed-run.js.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/linux.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/linux.js +21 -2
- package/pd-cli/dist/services/service-host/scheduler/linux.js.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +1 -1
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/service-status.js +0 -2
- package/pd-cli/dist/services/service-host/scheduler/service-status.js.map +1 -1
- package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +7 -51
- package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js +3 -3
- package/pd-cli/dist/services/service-host/worker-adapter.d.ts +0 -10
- package/pd-cli/dist/services/service-host/worker-adapter.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/worker-adapter.js +4 -12
- package/pd-cli/dist/services/service-host/worker-adapter.js.map +1 -1
- package/pd-cli/dist/services/service-host/worker-env.d.ts +1 -1
- package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts +5 -7
- package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/workspace-dispatch.js +1 -3
- package/pd-cli/dist/services/service-host/workspace-dispatch.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +616 -1319
- package/plugin/dist/core/openclaw-tool-declaration.d.ts +13 -0
- package/plugin/dist/index.d.ts +0 -9
- package/plugin/dist/openclaw-worker.d.ts +21 -8
- package/plugin/dist/openclaw-worker.js +267 -267
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/dist/installer.js +432 -120
- package/release-manager/dist/service-host-provisioning.js +645 -77
- package/release-manager/dist/utils/env.js +269 -49
- package/release-manager/package.json +3 -2
- package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +9 -1
- package/workbuddy-adapter/dist/worker/workspace-worker.js +21 -9
- package/workbuddy-adapter/package.json +1 -1
- package/pd-cli/dist/commands/service-handover.d.ts +0 -12
- package/pd-cli/dist/commands/service-handover.d.ts.map +0 -1
- package/pd-cli/dist/commands/service-handover.js +0 -117
- package/pd-cli/dist/commands/service-handover.js.map +0 -1
- package/pd-cli/dist/commands/worker-drain.d.ts +0 -7
- package/pd-cli/dist/commands/worker-drain.d.ts.map +0 -1
- package/pd-cli/dist/commands/worker-drain.js +0 -51
- package/pd-cli/dist/commands/worker-drain.js.map +0 -1
- package/pd-cli/dist/services/service-host/handover-claims.d.ts +0 -14
- package/pd-cli/dist/services/service-host/handover-claims.d.ts.map +0 -1
- package/pd-cli/dist/services/service-host/handover-claims.js +0 -50
- package/pd-cli/dist/services/service-host/handover-claims.js.map +0 -1
- package/pd-cli/dist/services/service-host/shadow-run.d.ts +0 -87
- package/pd-cli/dist/services/service-host/shadow-run.d.ts.map +0 -1
- package/pd-cli/dist/services/service-host/shadow-run.js +0 -549
- package/pd-cli/dist/services/service-host/shadow-run.js.map +0 -1
- package/pd-cli/dist/services/service-host/workspace-handover.d.ts +0 -190
- package/pd-cli/dist/services/service-host/workspace-handover.d.ts.map +0 -1
- package/pd-cli/dist/services/service-host/workspace-handover.js +0 -1393
- package/pd-cli/dist/services/service-host/workspace-handover.js.map +0 -1
- package/plugin/dist/service/gateway-consumer-lease.d.ts +0 -142
- package/plugin/dist/service/gateway-quiesce-ack.d.ts +0 -40
- package/plugin/dist/service/internalization-auto-consumer-service.d.ts +0 -100
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Workspace background-execution
|
|
3
|
-
*
|
|
2
|
+
* Workspace background-execution provisioning — the CAS write path for the
|
|
3
|
+
* Service-Host-only runtime model (PRI-1278 consolidation).
|
|
4
4
|
*
|
|
5
5
|
* The manifest schema (`backgroundExecutions`, `BackgroundExecutionRecord`)
|
|
6
|
-
* lives in `index.ts`; this module owns the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* with monotonic-generation fencing and operationId idempotency.
|
|
6
|
+
* lives in `index.ts`; this module owns the single live write transition,
|
|
7
|
+
* `provision_fresh_install`, together with the cross-process critical
|
|
8
|
+
* section, monotonic-generation fencing and idempotent terminal replay.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* Current ownership model:
|
|
11
|
+
* - `service_host_owned` is the ONLY live ownership state. Consumption
|
|
12
|
+
* admission is binary: a consumer is admitted when the projection is
|
|
13
|
+
* `service_host_owned`, and is paused/fail-closed otherwise.
|
|
14
|
+
* - `legacy_owned`, `handover_preparing` and `rollback_pending` remain in
|
|
15
|
+
* the persisted schema only so pre-consolidation manifests stay parseable.
|
|
16
|
+
* They are historical residue; no code path may WRITE them anymore.
|
|
17
|
+
* - An absent record means "not yet provisioned". It is not proof that any
|
|
18
|
+
* legacy runtime owns the workspace.
|
|
19
|
+
*
|
|
20
|
+
* Why provisioning may flip every persisted state directly: the legacy
|
|
21
|
+
* consumer implementation is deleted repo-wide, so a pre-existing record —
|
|
22
|
+
* including interrupted handover/rollback residue — cannot prove a live
|
|
23
|
+
* consumer that this CAS must quiesce. Migration safety is owned by the
|
|
24
|
+
* installer's one-time stop-old-entries sequencing BEFORE provisioning is
|
|
25
|
+
* invoked, not by this state machine; lease fencing remains the task-level
|
|
26
|
+
* backstop. This primitive's narrower job is to serialize the write, fence
|
|
27
|
+
* stale generations, and converge each workspace exactly once.
|
|
15
28
|
*
|
|
16
29
|
* Concurrency model:
|
|
17
30
|
* - physical exclusion: one lock directory next to the manifest
|
|
@@ -27,17 +40,16 @@
|
|
|
27
40
|
* reclaim's check and its recreate, and a release deletes only the
|
|
28
41
|
* lock whose owner token it verified inside the same transaction;
|
|
29
42
|
* - logical fencing: inside the critical section the writer re-reads the
|
|
30
|
-
* current record; a stale observed `generation`
|
|
31
|
-
*
|
|
43
|
+
* current record; a stale observed `generation` loses and nothing is
|
|
44
|
+
* written;
|
|
32
45
|
* - durability: the manifest lands via temp file + atomic rename, so a crash
|
|
33
46
|
* mid-write leaves either the previous or the complete new document —
|
|
34
47
|
* never a partial one.
|
|
35
48
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* handover/rollback commands.
|
|
49
|
+
* Process liveness is NEVER ownership proof: PID, startup order and delays
|
|
50
|
+
* are not proof. The persisted record is the only authority;
|
|
51
|
+
* `readWorkspaceBackgroundOwnership` is its read-side projection for
|
|
52
|
+
* provisioning and consumer-admission readers.
|
|
41
53
|
*/
|
|
42
54
|
import * as crypto from 'node:crypto';
|
|
43
55
|
import * as fs from 'node:fs';
|
|
@@ -523,11 +535,15 @@ function resolveOwnershipIdentity(args) {
|
|
|
523
535
|
}
|
|
524
536
|
const OWNER_ALIAS_CONFLICT_NEXT_ACTION = 'Two registered path spellings of the same directory carry DIFFERENT ownership records; a writer must reconcile ~/.pd/install.json (remove the duplicate workspace entry / record) before background execution decisions.';
|
|
525
537
|
/**
|
|
526
|
-
* The single read-side projection
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
538
|
+
* The single read-side ownership projection for ONE workspace in the
|
|
539
|
+
* Service-Host-only model. `service_host_owned` is the only state that may
|
|
540
|
+
* admit consumption; every other persisted state is historical residue, and
|
|
541
|
+
* an absent record means not-yet-provisioned. For projection compatibility
|
|
542
|
+
* the absent case is still represented as `legacy_owned`/`no_record`/
|
|
543
|
+
* generation 0 — readers must interpret that as un-provisioned, never as a
|
|
544
|
+
* living legacy consumer. Fail-closed: an unreadable or malformed manifest
|
|
545
|
+
* is `manifest_unreadable`; "cannot decide" is NEVER collapsed into an
|
|
546
|
+
* admission decision for a consumer that is about to act.
|
|
531
547
|
*/
|
|
532
548
|
export function readWorkspaceBackgroundOwnership(options) {
|
|
533
549
|
const fsOps = options.fsOps ?? realFsOps;
|
|
@@ -588,46 +604,26 @@ export function readWorkspaceBackgroundOwnership(options) {
|
|
|
588
604
|
// ─── Transitions ────────────────────────────────────────────────────────────
|
|
589
605
|
export const BACKGROUND_EXECUTION_TRANSITIONS = [
|
|
590
606
|
'provision_fresh_install',
|
|
591
|
-
'begin_handover',
|
|
592
|
-
'abort_handover',
|
|
593
|
-
'complete_handover',
|
|
594
|
-
'begin_rollback',
|
|
595
|
-
'complete_rollback',
|
|
596
|
-
'abort_rollback',
|
|
597
607
|
];
|
|
598
608
|
const TRANSITION_SPECS = {
|
|
599
|
-
//
|
|
600
|
-
//
|
|
601
|
-
//
|
|
602
|
-
//
|
|
603
|
-
|
|
604
|
-
//
|
|
605
|
-
//
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
complete_rollback: { from: ['rollback_pending'], to: 'legacy_owned', needsOperationId: false },
|
|
611
|
-
abort_rollback: { from: ['rollback_pending'], to: 'service_host_owned', needsOperationId: false },
|
|
609
|
+
// Service-Host-only provisioning is a direct convergence write from ANY
|
|
610
|
+
// persisted state. All three non-service states are parse-only residue in
|
|
611
|
+
// the new model: the legacy consumer implementation has been deleted
|
|
612
|
+
// repo-wide, so there is no consumer left for a handover/rollback machine
|
|
613
|
+
// to quiesce. The installer's stop-old-entries sequencing owns migration
|
|
614
|
+
// safety before it calls this primitive; the CAS only guarantees that the
|
|
615
|
+
// convergence write itself is serialized, generation-fenced and atomic.
|
|
616
|
+
provision_fresh_install: {
|
|
617
|
+
from: ['legacy_owned', 'handover_preparing', 'rollback_pending', 'service_host_owned'],
|
|
618
|
+
to: 'service_host_owned',
|
|
619
|
+
},
|
|
612
620
|
};
|
|
613
621
|
function buildTargetRecord(context) {
|
|
614
622
|
const generation = context.currentGeneration + 1;
|
|
615
|
-
const {
|
|
623
|
+
const { nowIso } = context;
|
|
616
624
|
switch (context.kind) {
|
|
617
625
|
case 'provision_fresh_install':
|
|
618
626
|
return { state: 'service_host_owned', effectiveOwner: 'service_host', generation, operationId: null, previousOwner: null, targetOwner: null, updatedAt: nowIso };
|
|
619
|
-
case 'begin_handover':
|
|
620
|
-
return { state: 'handover_preparing', effectiveOwner: 'legacy', generation, operationId, previousOwner: 'legacy', targetOwner: 'service_host', updatedAt: nowIso };
|
|
621
|
-
case 'abort_handover':
|
|
622
|
-
return { state: 'legacy_owned', effectiveOwner: 'legacy', generation, operationId: null, previousOwner: null, targetOwner: null, updatedAt: nowIso };
|
|
623
|
-
case 'complete_handover':
|
|
624
|
-
return { state: 'service_host_owned', effectiveOwner: 'service_host', generation, operationId: null, previousOwner: null, targetOwner: null, updatedAt: nowIso };
|
|
625
|
-
case 'begin_rollback':
|
|
626
|
-
return { state: 'rollback_pending', effectiveOwner: 'service_host', generation, operationId, previousOwner: 'service_host', targetOwner: 'legacy', updatedAt: nowIso };
|
|
627
|
-
case 'complete_rollback':
|
|
628
|
-
return { state: 'legacy_owned', effectiveOwner: 'legacy', generation, operationId: null, previousOwner: null, targetOwner: null, updatedAt: nowIso };
|
|
629
|
-
case 'abort_rollback':
|
|
630
|
-
return { state: 'service_host_owned', effectiveOwner: 'service_host', generation, operationId: null, previousOwner: null, targetOwner: null, updatedAt: nowIso };
|
|
631
627
|
}
|
|
632
628
|
}
|
|
633
629
|
function projectOwnership(state, generation, record) {
|
|
@@ -635,19 +631,19 @@ function projectOwnership(state, generation, record) {
|
|
|
635
631
|
return { status: 'legacy_owned', source: record !== undefined ? 'record' : 'no_record', generation, record };
|
|
636
632
|
}
|
|
637
633
|
if (record === undefined) {
|
|
638
|
-
// Unreachable for
|
|
634
|
+
// Unreachable for persisted non-legacy states (a record must exist), kept total.
|
|
639
635
|
return { status: 'legacy_owned', source: 'no_record', generation };
|
|
640
636
|
}
|
|
641
637
|
return { status: state, generation, record };
|
|
642
638
|
}
|
|
643
639
|
/**
|
|
644
|
-
* Execute one
|
|
645
|
-
* critical section. The manifest is
|
|
646
|
-
* (unknown top-level fields survive
|
|
647
|
-
* `autoCheck` / `releaseMetadataUrl`),
|
|
648
|
-
* atomic rename. A legacy single-key
|
|
649
|
-
* migrated to the per-Workspace map in the
|
|
650
|
-
* the write would be a parse conflict).
|
|
640
|
+
* Execute the one live ownership transition — provision this Workspace into
|
|
641
|
+
* `service_host_owned` — under the CAS critical section. The manifest is
|
|
642
|
+
* read, validated, mutated as a RAW object (unknown top-level fields survive
|
|
643
|
+
* — the update side owns `channel` / `autoCheck` / `releaseMetadataUrl`),
|
|
644
|
+
* re-validated, and landed with an atomic rename. A legacy single-key
|
|
645
|
+
* `backgroundExecution` spelling is migrated to the per-Workspace map in the
|
|
646
|
+
* same write (both spellings after the write would be a parse conflict).
|
|
651
647
|
*/
|
|
652
648
|
export function transitionWorkspaceBackgroundExecution(input) {
|
|
653
649
|
if (input.operationId.length === 0) {
|
|
@@ -712,19 +708,19 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
712
708
|
nextAction: OWNER_ALIAS_CONFLICT_NEXT_ACTION,
|
|
713
709
|
};
|
|
714
710
|
}
|
|
715
|
-
// Workspace registration:
|
|
716
|
-
//
|
|
717
|
-
//
|
|
718
|
-
//
|
|
711
|
+
// Workspace registration: provisioning may register the workspace in the
|
|
712
|
+
// same atomic write when the caller explicitly asks for it. Otherwise the
|
|
713
|
+
// workspace must already be a member because a record key outside
|
|
714
|
+
// `workspaces[]` cannot parse back. An alias registration for the same
|
|
715
|
+
// real directory counts as registered.
|
|
719
716
|
const registered = identity.registeredAliases.length > 0;
|
|
720
|
-
const mayRegister =
|
|
721
|
-
&& input.registerWorkspace === true;
|
|
717
|
+
const mayRegister = input.registerWorkspace === true;
|
|
722
718
|
if (!registered && !mayRegister) {
|
|
723
719
|
return {
|
|
724
720
|
ok: false,
|
|
725
721
|
reason: 'workspace_not_registered',
|
|
726
722
|
message: `workspace ${canonical} is not in the manifest workspaces list`,
|
|
727
|
-
nextAction: 'Register the workspace through
|
|
723
|
+
nextAction: 'Register the workspace through installer provisioning or the installer bind path.',
|
|
728
724
|
};
|
|
729
725
|
}
|
|
730
726
|
const spec = TRANSITION_SPECS[input.kind];
|
|
@@ -733,39 +729,25 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
733
729
|
const currentRecord = identity.records[0]?.record;
|
|
734
730
|
const currentState = currentRecord?.state ?? 'legacy_owned';
|
|
735
731
|
const currentGeneration = currentRecord?.generation ?? 0;
|
|
736
|
-
//
|
|
737
|
-
//
|
|
738
|
-
//
|
|
739
|
-
//
|
|
740
|
-
//
|
|
741
|
-
//
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
//
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
&& currentState === 'service_host_owned'
|
|
756
|
-
&& currentRecord.effectiveOwner === 'service_host';
|
|
757
|
-
if (alreadyOwned) {
|
|
758
|
-
return { ok: true, changed: false, record: currentRecord, previous: currentRecord };
|
|
759
|
-
}
|
|
760
|
-
if (currentRecord !== undefined) {
|
|
761
|
-
return {
|
|
762
|
-
ok: false,
|
|
763
|
-
reason: 'unexpected_state',
|
|
764
|
-
message: `workspace already carries a background-execution record (${currentState}, generation ${currentGeneration}); fresh-install provisioning refuses to overwrite history`,
|
|
765
|
-
nextAction: 'Use pd service handover (with legacy consumer quiesce) to move this workspace to the Service Host.',
|
|
766
|
-
current: projectOwnership(currentState, currentGeneration, currentRecord),
|
|
767
|
-
};
|
|
768
|
-
}
|
|
732
|
+
// `service_host_owned` is the converged terminal state. Replaying a
|
|
733
|
+
// provision onto a canonical terminal record is a no-op and must never
|
|
734
|
+
// mint another generation: concurrent installers/retries are allowed to
|
|
735
|
+
// converge exactly once. The persisted steady-state record carries
|
|
736
|
+
// `operationId: null` by schema, so terminal idempotency is state-based
|
|
737
|
+
// rather than a second write keyed by the caller's operation id. A no-op
|
|
738
|
+
// does not consult the generation fence because no write is attempted.
|
|
739
|
+
//
|
|
740
|
+
// Exception: an alias-keyed terminal record still needs the realpath
|
|
741
|
+
// pinning repair below. With no later transition kinds left, provisioning
|
|
742
|
+
// is the only remaining write opportunity that can move that historical
|
|
743
|
+
// record onto the real directory. That repair rewrites the SAME record
|
|
744
|
+
// (same generation); it is not a new ownership transition.
|
|
745
|
+
const terminalRecord = currentRecord !== undefined && currentState === spec.to ? currentRecord : undefined;
|
|
746
|
+
const terminalNeedsRealpathPinning = terminalRecord !== undefined
|
|
747
|
+
&& priorKey !== undefined
|
|
748
|
+
&& priorKey !== recordKey;
|
|
749
|
+
if (terminalRecord !== undefined && !terminalNeedsRealpathPinning) {
|
|
750
|
+
return { ok: true, changed: false, record: terminalRecord, previous: terminalRecord };
|
|
769
751
|
}
|
|
770
752
|
if (input.expectedGeneration !== undefined && input.expectedGeneration !== currentGeneration) {
|
|
771
753
|
return {
|
|
@@ -776,21 +758,6 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
776
758
|
current: projectOwnership(currentState, currentGeneration, currentRecord),
|
|
777
759
|
};
|
|
778
760
|
}
|
|
779
|
-
if (currentRecord !== undefined && currentState === spec.to && spec.needsOperationId) {
|
|
780
|
-
// Idempotent begin replay: same operationId onto the same transition
|
|
781
|
-
// state is a no-op; a different id means another operation owns it.
|
|
782
|
-
const holderOp = currentRecord.operationId ?? '';
|
|
783
|
-
if (holderOp === input.operationId) {
|
|
784
|
-
return { ok: true, changed: false, record: currentRecord, previous: currentRecord };
|
|
785
|
-
}
|
|
786
|
-
return {
|
|
787
|
-
ok: false,
|
|
788
|
-
reason: 'operation_in_progress',
|
|
789
|
-
message: `workspace is ${currentState} under operationId ${holderOp || '(none)'}; refusing to start ${input.operationId}`,
|
|
790
|
-
nextAction: 'Wait for the in-flight operation to finish or abort it explicitly; one transition operation per workspace.',
|
|
791
|
-
current: projectOwnership(currentState, currentGeneration, currentRecord),
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
761
|
if (!spec.from.includes(currentState)) {
|
|
795
762
|
return {
|
|
796
763
|
ok: false,
|
|
@@ -800,23 +767,12 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
800
767
|
current: projectOwnership(currentState, currentGeneration, currentRecord),
|
|
801
768
|
};
|
|
802
769
|
}
|
|
803
|
-
//
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
if (holderOp !== input.operationId) {
|
|
807
|
-
return {
|
|
808
|
-
ok: false,
|
|
809
|
-
reason: 'operation_mismatch',
|
|
810
|
-
message: `${input.kind} addresses operationId ${input.operationId} but the transition record holds ${holderOp || '(none)'}`,
|
|
811
|
-
nextAction: 'Use the persisted operationId, or abort the in-flight operation first.',
|
|
812
|
-
current: projectOwnership(currentState, currentGeneration, currentRecord),
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
}
|
|
770
|
+
// Historical handover/rollback operationIds are deliberately NOT matched
|
|
771
|
+
// here. Those records are residue from a deleted migration machine, not
|
|
772
|
+
// live operations; provisioning supersedes them directly.
|
|
816
773
|
const target = buildTargetRecord({
|
|
817
774
|
kind: input.kind,
|
|
818
775
|
currentGeneration,
|
|
819
|
-
operationId: input.operationId,
|
|
820
776
|
nowIso: now().toISOString(),
|
|
821
777
|
});
|
|
822
778
|
// Mutate the RAW object (unknown top-level fields survive) using the same
|
|
@@ -837,19 +793,15 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
837
793
|
// Migrate the legacy single-key spelling away in the same write.
|
|
838
794
|
delete raw.backgroundExecution;
|
|
839
795
|
// The record key MUST be a workspaces[] member or it cannot parse back:
|
|
840
|
-
//
|
|
841
|
-
//
|
|
842
|
-
// record (PRI-1282 review).
|
|
796
|
+
// once provisioning has been admitted, the real directory registers in
|
|
797
|
+
// the same CAS. This covers both first-time registration and migration of
|
|
798
|
+
// an alias-keyed record onto the real directory (PRI-1282 review).
|
|
843
799
|
const registeredKeys = manifest.workspaces ?? [];
|
|
844
800
|
const recordKeyRegistered = registeredKeys.some((entry) => pathApi.resolve(entry) === recordKey);
|
|
845
801
|
if (!recordKeyRegistered) {
|
|
846
802
|
raw.workspaces = mergeInstallManifestWorkspaces(manifest, recordKey, platform);
|
|
847
803
|
raw.hosts = installManifestHostsForPersist(manifest);
|
|
848
804
|
}
|
|
849
|
-
else if (input.kind === 'begin_handover' && input.registerWorkspace === true && !registered) {
|
|
850
|
-
raw.workspaces = mergeInstallManifestWorkspaces(manifest, recordKey, platform);
|
|
851
|
-
raw.hosts = installManifestHostsForPersist(manifest);
|
|
852
|
-
}
|
|
853
805
|
// Re-validate the exact bytes we are about to land.
|
|
854
806
|
const revalidated = parseInstallManifest(raw, input.platform);
|
|
855
807
|
if (!revalidated.manifest || revalidated.manifest.backgroundExecutions?.[recordKey] === undefined) {
|
|
@@ -28,45 +28,55 @@ export interface InstallManifest {
|
|
|
28
28
|
* Canonical absolute paths of Workspaces the install serves (PRI-624 Slice C).
|
|
29
29
|
* Optional so pre-PRI-624 manifests stay valid; always normalized to
|
|
30
30
|
* resolved absolute paths and deduped. The installer merges the install
|
|
31
|
-
* Workspace in; the
|
|
32
|
-
*
|
|
31
|
+
* Workspace in; the Service Host discovers the Workspaces it serves from
|
|
32
|
+
* this list.
|
|
33
33
|
*/
|
|
34
34
|
workspaces?: readonly string[];
|
|
35
35
|
/**
|
|
36
|
-
* Per-Workspace background-execution OWNERSHIP records
|
|
37
|
-
* narrow scope / SPEC-PD-SERVICE-HOST-001 §8.4), keyed by canonical
|
|
36
|
+
* Per-Workspace background-execution OWNERSHIP records keyed by canonical
|
|
38
37
|
* absolute workspace path — the same identity `workspaces` carries.
|
|
39
|
-
* Optional so pre-record manifests stay valid; a Workspace with no entry
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* never touches another key, so Workspace A can be `service_host_owned`
|
|
43
|
-
* while Workspace B is still `legacy_owned` or mid-`handover_preparing`.
|
|
38
|
+
* Optional so pre-record manifests stay valid; a Workspace with no entry is
|
|
39
|
+
* simply not-yet-provisioned. It does NOT mean a legacy consumer owns that
|
|
40
|
+
* Workspace: the legacy consumer implementation has been deleted repo-wide.
|
|
44
41
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
42
|
+
* `service_host_owned` is the only live ownership state. `legacy_owned`,
|
|
43
|
+
* `handover_preparing` and `rollback_pending` remain parseable solely as
|
|
44
|
+
* historical residue in pre-consolidation manifests; no writer may create
|
|
45
|
+
* them anymore. Consumption admission is binary — service-host-owned or
|
|
46
|
+
* not — and each Workspace converges independently: one entry's provision
|
|
47
|
+
* never touches another key.
|
|
48
|
+
*
|
|
49
|
+
* This is the Service Host provisioning contract: only
|
|
50
|
+
* `provision_fresh_install` may advance an entry, every write is a
|
|
51
|
+
* monotonic-generation compare-and-set, and PID / delays / startup order
|
|
52
|
+
* are NEVER ownership proof — this record is. Migration safety belongs to
|
|
53
|
+
* the installer's one-time stop-old-entries sequencing before provisioning;
|
|
54
|
+
* the CAS write path and read projection live in
|
|
55
|
+
* `background-execution-transition.ts`.
|
|
51
56
|
*/
|
|
52
57
|
backgroundExecutions?: Readonly<Record<string, BackgroundExecutionRecord>>;
|
|
53
58
|
}
|
|
59
|
+
/** `legacy` remains only so historical records remain parseable; new records are always `service_host`. */
|
|
54
60
|
export declare const BACKGROUND_EXECUTION_OWNERS: readonly ['legacy', 'service_host'];
|
|
55
61
|
export type BackgroundExecutionOwner = (typeof BACKGROUND_EXECUTION_OWNERS)[number];
|
|
62
|
+
/** All four states remain parseable historical schema; only `service_host_owned` is writable/live. */
|
|
56
63
|
export declare const BACKGROUND_EXECUTION_STATES: readonly ['legacy_owned', 'handover_preparing', 'service_host_owned', 'rollback_pending'];
|
|
57
64
|
export type BackgroundExecutionState = (typeof BACKGROUND_EXECUTION_STATES)[number];
|
|
58
65
|
/**
|
|
59
|
-
* The persisted ownership fact for background execution
|
|
60
|
-
* - `state`/`effectiveOwner`:
|
|
61
|
-
*
|
|
62
|
-
*
|
|
66
|
+
* The persisted ownership fact for background execution.
|
|
67
|
+
* - `state`/`effectiveOwner`: the persisted ownership projection. In the
|
|
68
|
+
* Service-Host-only model only `service_host_owned`/`service_host` is a
|
|
69
|
+
* live admission fact; other combinations are parse-only historical
|
|
70
|
+
* residue and never admission proof;
|
|
71
|
+
* - `generation`: strictly monotonic per accepted write — the CAS key
|
|
63
72
|
* (a writer must observe `generation` then write `generation+1` under the
|
|
64
73
|
* manifest write lock; a stale observed generation loses);
|
|
65
|
-
* - `operationId`:
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
74
|
+
* - `operationId`: operation attribution on historical in-flight records.
|
|
75
|
+
* Steady states persist null; terminal provisioning replay is a no-op
|
|
76
|
+
* rather than another generation;
|
|
77
|
+
* - `previousOwner`/`targetOwner`: the two parties of a historical
|
|
78
|
+
* migration record (both null in a steady state);
|
|
79
|
+
* - `updatedAt`: ISO-8601 timestamp of the last accepted write.
|
|
70
80
|
*/
|
|
71
81
|
export interface BackgroundExecutionRecord {
|
|
72
82
|
state: BackgroundExecutionState;
|
|
@@ -158,10 +168,12 @@ export declare function mergeInstallManifestWorkspaces(current: InstallManifest
|
|
|
158
168
|
export declare function installManifestHostsForPersist(manifest: InstallManifest | undefined): string[];
|
|
159
169
|
/**
|
|
160
170
|
* Set or clear ONE Workspace's ownership record, preserving every other
|
|
161
|
-
* Workspace's entry — the write-side half of "one
|
|
162
|
-
* another Workspace's state". `record` must already satisfy
|
|
163
|
-
* contract
|
|
164
|
-
*
|
|
171
|
+
* Workspace's entry — the write-side half of "one workspace's provisioning
|
|
172
|
+
* never overwrites another Workspace's state". `record` must already satisfy
|
|
173
|
+
* the semantic contract; production writers build it through
|
|
174
|
+
* `transitionWorkspaceBackgroundExecution`, whose only live target is
|
|
175
|
+
* `service_host_owned`. Passing undefined removes the entry, returning that
|
|
176
|
+
* Workspace to the not-yet-provisioned absent-record shape.
|
|
165
177
|
*/
|
|
166
178
|
export declare function setInstallManifestBackgroundExecution(manifest: InstallManifest | undefined, target: {
|
|
167
179
|
workspaceDir: string;
|
|
@@ -293,10 +305,10 @@ export declare function selectCodexMcpBindingPath(codexHome: string, pluginRoot:
|
|
|
293
305
|
*/
|
|
294
306
|
export { MCP_BINDING_SCHEMA_VERSION, MCP_BINDING_HOSTS, MCP_BINDING_SERVER_ENTRY_SEGMENTS, MCP_BINDING_SHAPE_CODES, MCP_BINDING_LAUNCHER_ONLY_REASONS, MCP_BINDING_FIXTURES, getCanonicalMcpServerEntry, getHostDefaultWorkspaceDirs, findForeignWorkspaceHost, collectHostWorkspaceClaims, findForeignWorkspaceOwner, isSameMcpBindingPath, validateMcpBinding, buildMcpBindingFixture, isMcpBindingHost, isSupportedBindingSchemaVersion, isSemverVersion, type McpBindingHost, type McpHostWorkspaceOptions, type McpBindingRecord, type McpBindingVerdict, type McpBindingShapeCode, type McpBindingFixture, type McpBindingFixtureId, type McpBindingFixtureContext, type HostWorkspaceClaim, type HostWorkspaceClaimVia, type HostClaimReaders, type HostClaimOptions, type JsonFileReadStatus, type BindingReadDiagnostic, type DirReadStatus, type ForeignWorkspaceOwnerVerdict, } from './mcp-binding-contract.js';
|
|
295
307
|
/**
|
|
296
|
-
* Workspace background-execution
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
308
|
+
* Workspace background-execution provisioning in the Service-Host-only model:
|
|
309
|
+
* a cross-process lock, a generation-fenced single live transition
|
|
310
|
+
* (`provision_fresh_install` → `service_host_owned`), and the read-side
|
|
311
|
+
* ownership projection. Historical legacy/handover/rollback states remain
|
|
312
|
+
* parseable residue only; consumption admission is binary.
|
|
301
313
|
*/
|
|
302
314
|
export { DEFAULT_CAS_LOCK_STALE_MS, BACKGROUND_EXECUTION_TRANSITIONS, acquireBackgroundExecutionCasLock, defaultCasFsOps, readWorkspaceBackgroundOwnership, transitionWorkspaceBackgroundExecution, withInstallManifestWriteLock, type BackgroundExecutionTransitionKind, type TransitionBackgroundExecutionFailure, type TransitionBackgroundExecutionSuccess, type CasFsOps, type CasLockAcquireOptions, type CasLockAcquireResult, type CasLockHandle, type CasLockOwner, type ReadOwnershipOptions, type TransitionBackgroundExecutionInput, type WithManifestWriteLockOptions, type WithManifestWriteLockResult, type WorkspaceBackgroundOwnership, } from './background-execution-transition.js';
|
|
@@ -4,7 +4,9 @@ import { resolvePdHome } from './pd-home.js';
|
|
|
4
4
|
export const INSTALL_LAYOUT_VERSION = 1;
|
|
5
5
|
export const INSTALL_LAYOUT_MODES = ['canonical', 'legacy'];
|
|
6
6
|
export const INSTALL_HOSTS = ['codex', 'openclaw', 'workbuddy'];
|
|
7
|
+
/** `legacy` remains only so historical records remain parseable; new records are always `service_host`. */
|
|
7
8
|
export const BACKGROUND_EXECUTION_OWNERS = ['legacy', 'service_host'];
|
|
9
|
+
/** All four states remain parseable historical schema; only `service_host_owned` is writable/live. */
|
|
8
10
|
export const BACKGROUND_EXECUTION_STATES = [
|
|
9
11
|
'legacy_owned',
|
|
10
12
|
'handover_preparing',
|
|
@@ -90,21 +92,23 @@ function isNullableOwner(value) {
|
|
|
90
92
|
}
|
|
91
93
|
/**
|
|
92
94
|
* Fail-closed semantic check for one ownership record. Absent is fine
|
|
93
|
-
* (
|
|
95
|
+
* (not-yet-provisioned); present-but-malformed is structural damage — an
|
|
94
96
|
* ownership fact that cannot be trusted must not be honored.
|
|
95
97
|
*
|
|
96
98
|
* Field types alone are NOT enough: the legal combination of
|
|
97
99
|
* state/effectiveOwner/previousOwner/targetOwner/operationId/generation is
|
|
98
|
-
* part of the
|
|
99
|
-
*
|
|
100
|
+
* part of the persisted schema. Illegal combinations are refused at parse
|
|
101
|
+
* time so a corrupt marker can never be honored as ownership proof:
|
|
100
102
|
* - legacy_owned: effectiveOwner=legacy, prev/target/operationId=null, generation>=0;
|
|
101
103
|
* - service_host_owned: effectiveOwner=service_host, prev/target/operationId=null, generation>=1;
|
|
102
|
-
* - handover_preparing: effectiveOwner=legacy
|
|
103
|
-
*
|
|
104
|
-
* - rollback_pending: effectiveOwner=service_host
|
|
105
|
-
*
|
|
106
|
-
* A transition state implies at least one accepted
|
|
107
|
-
* happened, so generation 0 there is unreachable and rejected.
|
|
104
|
+
* - handover_preparing: effectiveOwner=legacy, prev=legacy, target=service_host,
|
|
105
|
+
* operationId set, generation>=1 (historical residue only);
|
|
106
|
+
* - rollback_pending: effectiveOwner=service_host, prev=service_host, target=legacy,
|
|
107
|
+
* operationId set, generation>=1 (historical residue only).
|
|
108
|
+
* A historical transition state implies at least one accepted migration write
|
|
109
|
+
* already happened, so generation 0 there is unreachable and rejected. Only
|
|
110
|
+
* `service_host_owned` is writable or consumption-admitting in the current
|
|
111
|
+
* model; the other combinations remain readable for old manifests.
|
|
108
112
|
*/
|
|
109
113
|
function parseBackgroundExecutionRecord(value) {
|
|
110
114
|
if (value === undefined)
|
|
@@ -214,10 +218,12 @@ function parseBackgroundExecutions(value, workspaces, platform) {
|
|
|
214
218
|
}
|
|
215
219
|
/**
|
|
216
220
|
* Set or clear ONE Workspace's ownership record, preserving every other
|
|
217
|
-
* Workspace's entry — the write-side half of "one
|
|
218
|
-
* another Workspace's state". `record` must already satisfy
|
|
219
|
-
* contract
|
|
220
|
-
*
|
|
221
|
+
* Workspace's entry — the write-side half of "one workspace's provisioning
|
|
222
|
+
* never overwrites another Workspace's state". `record` must already satisfy
|
|
223
|
+
* the semantic contract; production writers build it through
|
|
224
|
+
* `transitionWorkspaceBackgroundExecution`, whose only live target is
|
|
225
|
+
* `service_host_owned`. Passing undefined removes the entry, returning that
|
|
226
|
+
* Workspace to the not-yet-provisioned absent-record shape.
|
|
221
227
|
*/
|
|
222
228
|
export function setInstallManifestBackgroundExecution(manifest, target, record) {
|
|
223
229
|
const api = workspacePathApi(target.platform ?? process.platform);
|
|
@@ -557,10 +563,10 @@ export function selectCodexMcpBindingPath(codexHome, pluginRoot) {
|
|
|
557
563
|
*/
|
|
558
564
|
export { MCP_BINDING_SCHEMA_VERSION, MCP_BINDING_HOSTS, MCP_BINDING_SERVER_ENTRY_SEGMENTS, MCP_BINDING_SHAPE_CODES, MCP_BINDING_LAUNCHER_ONLY_REASONS, MCP_BINDING_FIXTURES, getCanonicalMcpServerEntry, getHostDefaultWorkspaceDirs, findForeignWorkspaceHost, collectHostWorkspaceClaims, findForeignWorkspaceOwner, isSameMcpBindingPath, validateMcpBinding, buildMcpBindingFixture, isMcpBindingHost, isSupportedBindingSchemaVersion, isSemverVersion, } from './mcp-binding-contract.js';
|
|
559
565
|
/**
|
|
560
|
-
* Workspace background-execution
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
566
|
+
* Workspace background-execution provisioning in the Service-Host-only model:
|
|
567
|
+
* a cross-process lock, a generation-fenced single live transition
|
|
568
|
+
* (`provision_fresh_install` → `service_host_owned`), and the read-side
|
|
569
|
+
* ownership projection. Historical legacy/handover/rollback states remain
|
|
570
|
+
* parseable residue only; consumption admission is binary.
|
|
565
571
|
*/
|
|
566
572
|
export { DEFAULT_CAS_LOCK_STALE_MS, BACKGROUND_EXECUTION_TRANSITIONS, acquireBackgroundExecutionCasLock, defaultCasFsOps, readWorkspaceBackgroundOwnership, transitionWorkspaceBackgroundExecution, withInstallManifestWriteLock, } from './background-execution-transition.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-principles-disciple",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.157.2",
|
|
4
4
|
"description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@earendil-works/pi-agent-core": "1.6.0",
|
|
67
67
|
"@earendil-works/pi-ai": "1.6.0",
|
|
68
|
-
"@principles/install-layout": "^0.
|
|
68
|
+
"@principles/install-layout": "^0.12.0",
|
|
69
69
|
"@sinclair/typebox": "^0.34.52",
|
|
70
70
|
"@tufjs/models": "3.0.1",
|
|
71
71
|
"@inquirer/prompts": "^8.8.0",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"commander": "^15.1.0",
|
|
74
74
|
"fs-extra": "^11.4.1",
|
|
75
75
|
"js-yaml": "^5.4.3",
|
|
76
|
+
"json5": "2.2.3",
|
|
76
77
|
"micromatch": "^4.0.8",
|
|
77
78
|
"ora": "^10.0.0",
|
|
78
79
|
"picocolors": "^1.0.0",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"directory": "packages/create-principles-disciple"
|
|
102
103
|
},
|
|
103
104
|
"pd": {
|
|
104
|
-
"bundledPluginVersion": "4.
|
|
105
|
+
"bundledPluginVersion": "4.4.1"
|
|
105
106
|
},
|
|
106
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "ff62137821c993773cc7df104a01625310776c51"
|
|
107
108
|
}
|
|
@@ -2,19 +2,23 @@ interface CodexWorkerOptions {
|
|
|
2
2
|
workspace?: string;
|
|
3
3
|
json?: boolean;
|
|
4
4
|
once?: boolean;
|
|
5
|
-
intervalMs?: number;
|
|
6
5
|
status?: boolean;
|
|
7
6
|
}
|
|
8
7
|
export interface CodexWorkerStatusReport {
|
|
9
8
|
generatedAt: string;
|
|
10
9
|
host: 'codex';
|
|
11
10
|
workspace: string;
|
|
12
|
-
mode: 'ready' | '
|
|
11
|
+
mode: 'ready' | 'paused' | 'degraded';
|
|
13
12
|
registeredInInstallManifest: boolean;
|
|
13
|
+
serviceHostManaged: boolean;
|
|
14
|
+
ownership: {
|
|
15
|
+
state: string;
|
|
16
|
+
generation?: number;
|
|
17
|
+
source?: string;
|
|
18
|
+
};
|
|
14
19
|
reason?: string;
|
|
15
20
|
nextAction?: string;
|
|
16
21
|
}
|
|
17
22
|
export declare function handleCodexWorker(options: CodexWorkerOptions): Promise<void>;
|
|
18
23
|
export {};
|
|
19
|
-
/** SPEC §15 worker mode, evaluated without executing anything. */
|
|
20
24
|
//# sourceMappingURL=codex-worker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-worker.d.ts","sourceRoot":"","sources":["../../src/commands/codex-worker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex-worker.d.ts","sourceRoot":"","sources":["../../src/commands/codex-worker.ts"],"names":[],"mappings":"AAoDA,UAAU,kBAAkB;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACtC,2BAA2B,EAAE,OAAO,CAAC;IACrC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkMD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BlF"}
|