create-principles-disciple 1.155.3 → 1.156.1
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/ingestion/pain-receipt-fallback.d.ts +28 -1
- package/codex-adapter/dist/ingestion/pain-receipt-fallback.js +55 -18
- package/codex-adapter/dist/worker/workspace-worker.js +122 -67
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/index.d.ts +11 -1
- package/console/dist/server/index.js +84 -19
- package/console/dist/server/release-handover.d.ts +256 -0
- package/console/dist/server/release-handover.js +402 -0
- package/console/dist/server/routes/onboarding.js +1 -0
- package/console/dist/server/routes/update-transaction.js +37 -3
- package/console/dist/server/routes/update.js +21 -1
- package/console/dist/server/successor.d.ts +46 -0
- package/console/dist/server/successor.js +128 -0
- package/console/dist/web/assets/app.css +18 -0
- package/console/dist/web/assets/app.js +32 -31
- package/console/package.json +1 -1
- package/core/dist/runtime/candidate-intake-service.d.ts +1 -1
- package/core/dist/runtime/candidate-intake-service.d.ts.map +1 -1
- package/core/dist/runtime/candidate-intake-service.js +89 -12
- package/core/dist/runtime/candidate-intake-service.js.map +1 -1
- package/core/dist/runtime/context-payload.d.ts +11 -0
- package/core/dist/runtime/context-payload.d.ts.map +1 -1
- package/core/dist/runtime/context-payload.js +27 -0
- package/core/dist/runtime/context-payload.js.map +1 -1
- package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-candidate.js +6 -4
- package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
- package/core/dist/runtime/host-submission-context.d.ts +13 -6
- package/core/dist/runtime/host-submission-context.d.ts.map +1 -1
- package/core/dist/runtime/host-submission-context.js +77 -8
- package/core/dist/runtime/host-submission-context.js.map +1 -1
- package/core/dist/runtime/index.d.ts +4 -2
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +10 -1
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/intent/intent-doc.d.ts +30 -0
- package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-doc.js +47 -0
- package/core/dist/runtime/intent/intent-doc.js.map +1 -1
- package/core/dist/runtime/intent/intent-snapshot.d.ts +12 -0
- package/core/dist/runtime/intent/intent-snapshot.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-snapshot.js +20 -0
- package/core/dist/runtime/intent/intent-snapshot.js.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +18 -0
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.js +53 -15
- package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js +4 -0
- package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
- package/core/dist/runtime/pain-admission-disposition.d.ts +8 -4
- package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -1
- package/core/dist/runtime/pain-admission-disposition.js +8 -4
- package/core/dist/runtime/pain-admission-disposition.js.map +1 -1
- package/core/dist/runtime/pain-ingress.d.ts +8 -0
- package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress.js +8 -1
- package/core/dist/runtime/pain-ingress.js.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.d.ts +72 -0
- package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.js +46 -21
- package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
- package/core/dist/runtime/pain-receipt-recovery.d.ts +39 -8
- package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -1
- package/core/dist/runtime/pain-receipt-recovery.js +290 -36
- package/core/dist/runtime/pain-receipt-recovery.js.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.d.ts +38 -23
- package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.js +533 -182
- package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts +68 -13
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js +396 -167
- package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime/pain-submit-capability.d.ts +14 -3
- package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
- package/core/dist/runtime/pain-submit-capability.js +21 -9
- package/core/dist/runtime/pain-submit-capability.js.map +1 -1
- package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +115 -6
- package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -1
- package/core/dist/runtime/pain-target-evidence-reconcile.js +446 -49
- package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -1
- package/core/dist/runtime/pain-to-principle-service.d.ts +28 -10
- package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime/pain-to-principle-service.js +63 -52
- package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime/store/candidate/admission-document.d.ts +43 -0
- package/core/dist/runtime/store/candidate/admission-document.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/admission-document.js +130 -0
- package/core/dist/runtime/store/candidate/admission-document.js.map +1 -1
- package/core/dist/runtime/store/candidate/candidate-store.d.ts +3 -1
- package/core/dist/runtime/store/candidate/candidate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts +2 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.js +27 -1
- package/core/dist/runtime/store/candidate/memory-candidate-store.js.map +1 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts +2 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.js +59 -2
- package/core/dist/runtime/store/candidate/sqlite-candidate-store.js.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.js +18 -3
- package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts +4 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.js +22 -0
- package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.js +20 -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.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.js +9 -0
- package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/task-store.d.ts +10 -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 +5 -0
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +72 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +145 -35
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +149 -9
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +542 -31
- package/dist/installer.js.map +1 -1
- package/dist/installers/codex-host-installer.js +1 -1
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/dist/installers/index.d.ts +10 -0
- package/dist/installers/index.d.ts.map +1 -1
- package/dist/installers/index.js +4 -0
- package/dist/installers/index.js.map +1 -1
- package/dist/mvp-config.js +1 -1
- package/dist/mvp-config.js.map +1 -1
- package/dist/prompts.d.ts +36 -12
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +102 -30
- package/dist/prompts.js.map +1 -1
- package/dist/service-host-bridge.d.ts +71 -12
- package/dist/service-host-bridge.d.ts.map +1 -1
- package/dist/service-host-bridge.js +228 -48
- package/dist/service-host-bridge.js.map +1 -1
- package/dist/service-host-provisioning.d.ts +102 -0
- package/dist/service-host-provisioning.d.ts.map +1 -0
- package/dist/service-host-provisioning.js +595 -0
- package/dist/service-host-provisioning.js.map +1 -0
- package/dist/uninstaller.js +1 -1
- package/dist/uninstaller.js.map +1 -1
- package/dist/update/apply-payload.d.ts +9 -0
- package/dist/update/apply-payload.d.ts.map +1 -1
- package/dist/update/apply-payload.js +44 -2
- package/dist/update/apply-payload.js.map +1 -1
- package/dist/update/console-surface.d.ts +2 -1
- package/dist/update/console-surface.d.ts.map +1 -1
- package/dist/update/console-surface.js +6 -1
- package/dist/update/console-surface.js.map +1 -1
- package/dist/update/install-layout.d.ts +12 -0
- package/dist/update/install-layout.d.ts.map +1 -1
- package/dist/update/install-layout.js +49 -7
- package/dist/update/install-layout.js.map +1 -1
- package/dist/update/release-manager-authority.d.ts +16 -0
- package/dist/update/release-manager-authority.d.ts.map +1 -1
- package/dist/update/release-manager-authority.js +45 -3
- package/dist/update/release-manager-authority.js.map +1 -1
- package/dist/update/release-manager.d.ts +8 -3
- package/dist/update/release-manager.d.ts.map +1 -1
- package/dist/update/release-manager.js +29 -1
- package/dist/update/release-manager.js.map +1 -1
- package/dist/update/transaction-progress.d.ts +63 -0
- package/dist/update/transaction-progress.d.ts.map +1 -0
- package/dist/update/transaction-progress.js +207 -0
- package/dist/update/transaction-progress.js.map +1 -0
- package/dist/utils/env.d.ts +16 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +55 -43
- package/dist/utils/env.js.map +1 -1
- package/host-runtime/dist/diagnostician-auto-run.js +46 -34
- package/host-runtime/dist/governance-observation-store.d.ts +38 -0
- package/host-runtime/dist/governance-observation-store.js +41 -0
- package/host-runtime/dist/governance-trajectory-turn-reader.js +26 -33
- package/host-runtime/dist/index.d.ts +1 -0
- package/host-runtime/dist/index.js +4 -0
- package/host-runtime/dist/intent-doc-reader.js +1 -1
- package/host-runtime/dist/workspace-pipeline-host-deps.d.ts +65 -0
- package/host-runtime/dist/workspace-pipeline-host-deps.js +94 -0
- package/host-runtime/dist/workspace-telemetry-emitter.js +14 -0
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/background-execution-transition.d.ts +11 -1
- package/install-layout/dist/background-execution-transition.js +45 -1
- package/install-layout/dist/index.d.ts +4 -3
- package/install-layout/dist/index.js +11 -4
- package/install-layout/dist/openclaw-config-path.d.ts +9 -0
- package/install-layout/dist/openclaw-config-path.js +64 -0
- package/install-layout/dist/pd-home.d.ts +12 -0
- package/install-layout/dist/pd-home.js +6 -1
- package/install-layout/package.json +1 -1
- package/package.json +7 -7
- package/pd-cli/dist/commands/candidate.d.ts +15 -0
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +449 -93
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/codex-worker.js +2 -2
- package/pd-cli/dist/commands/codex-worker.js.map +1 -1
- package/pd-cli/dist/commands/console.d.ts.map +1 -1
- package/pd-cli/dist/commands/console.js +10 -0
- package/pd-cli/dist/commands/console.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +301 -233
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/intake-outcome-guidance.d.ts +57 -0
- package/pd-cli/dist/commands/intake-outcome-guidance.d.ts.map +1 -0
- package/pd-cli/dist/commands/intake-outcome-guidance.js +206 -0
- package/pd-cli/dist/commands/intake-outcome-guidance.js.map +1 -0
- package/pd-cli/dist/commands/mcp-probe.d.ts.map +1 -1
- package/pd-cli/dist/commands/mcp-probe.js +1 -0
- package/pd-cli/dist/commands/mcp-probe.js.map +1 -1
- package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-record.js +22 -16
- package/pd-cli/dist/commands/pain-record.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +139 -85
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-uat.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-uat.js +1 -0
- package/pd-cli/dist/commands/runtime-uat.js.map +1 -1
- package/pd-cli/dist/commands/service-lifecycle.js +1 -1
- package/pd-cli/dist/commands/service-lifecycle.js.map +1 -1
- package/pd-cli/dist/commands/service-run-once.d.ts +1 -1
- package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/service-run-once.js +9 -5
- package/pd-cli/dist/commands/service-run-once.js.map +1 -1
- package/pd-cli/dist/commands/workbuddy-worker.js +2 -2
- package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +14 -3
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts +4 -0
- package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.js +50 -48
- package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
- package/pd-cli/dist/services/config-doctor.d.ts.map +1 -1
- package/pd-cli/dist/services/config-doctor.js +7 -4
- package/pd-cli/dist/services/config-doctor.js.map +1 -1
- package/pd-cli/dist/services/console-launcher.js +3 -3
- package/pd-cli/dist/services/console-launcher.js.map +1 -1
- package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/managed-run.js +25 -8
- package/pd-cli/dist/services/service-host/managed-run.js.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +12 -0
- 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 +16 -7
- 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 -5
- 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 +1 -1
- package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/pd-mcp-server/dist/server.d.ts +7 -0
- package/pd-mcp-server/dist/server.js +12 -1
- package/pd-mcp-server/dist/submit-assembly.js +63 -19
- package/pd-mcp-server/dist/version.d.ts +1 -1
- package/pd-mcp-server/dist/version.js +1 -1
- package/pd-mcp-server/package.json +1 -1
- package/plugin/dist/bundle.js +539 -503
- package/plugin/dist/core/config-health.d.ts +6 -0
- package/plugin/dist/core/openclaw-config-loader.d.ts +14 -0
- package/plugin/dist/core/pain-service.d.ts +26 -0
- package/plugin/dist/hooks/openclaw-run-turn-correlation.d.ts +30 -0
- package/plugin/dist/hooks/openclaw-target-turn-capture.d.ts +13 -0
- package/plugin/dist/hooks/pain-receipt-fallback.d.ts +107 -0
- package/plugin/dist/openclaw-sdk.d.ts +15 -0
- package/plugin/dist/openclaw-worker.d.ts +3 -0
- package/plugin/dist/openclaw-worker.js +288 -287
- 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/i18n.js +72 -0
- package/release-manager/dist/installer.js +542 -31
- package/release-manager/dist/installers/codex-host-installer.js +1 -1
- package/release-manager/dist/installers/index.js +4 -0
- package/release-manager/dist/mvp-config.js +1 -1
- package/release-manager/dist/service-host-bridge.js +228 -48
- package/release-manager/dist/service-host-provisioning.js +595 -0
- package/release-manager/dist/update/apply-payload.js +44 -2
- package/release-manager/dist/update/console-surface.js +6 -1
- package/release-manager/dist/update/install-layout.js +49 -7
- package/release-manager/dist/update/release-manager-authority.js +45 -3
- package/release-manager/dist/update/release-manager.js +29 -1
- package/release-manager/dist/update/transaction-progress.js +207 -0
- package/release-manager/dist/utils/env.js +55 -43
- package/release-manager/package.json +5 -5
- package/workbuddy-adapter/dist/codec/input-decoder.d.ts +21 -0
- package/workbuddy-adapter/dist/codec/input-decoder.js +50 -1
- package/workbuddy-adapter/dist/ingestion/pain-receipt-fallback.d.ts +68 -0
- package/workbuddy-adapter/dist/ingestion/pain-receipt-fallback.js +226 -0
- package/workbuddy-adapter/dist/pd-hook.js +60 -0
- package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +3 -0
- package/workbuddy-adapter/dist/worker/workspace-worker.js +82 -47
- package/workbuddy-adapter/package.json +1 -1
- package/console/dist/server/utils/gateway.d.ts +0 -29
- package/console/dist/server/utils/gateway.js +0 -175
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPEC-PD-PIPELINE-SPINE-001 §4.2 — the single workspace pipeline host
|
|
3
|
+
* collaborator assembly point (PRI-1292 Phase 2A).
|
|
4
|
+
*
|
|
5
|
+
* Before this module, eight entry points each assembled the five host
|
|
6
|
+
* collaborators by hand, and the diagnostician entries created TWO separate
|
|
7
|
+
* `createConsentLedgerSourceMaterialAuthorization` instances per call — one
|
|
8
|
+
* inside the governance trajectory reader, one passed to the bridge — so the
|
|
9
|
+
* trajectory read and the source-material gate could observe different consent
|
|
10
|
+
* states within a single assembly. This resolver guarantees:
|
|
11
|
+
*
|
|
12
|
+
* 1. All five collaborators are REQUIRED on the returned object (no `?`),
|
|
13
|
+
* so a new entry cannot compile with a silently missing sink or probe.
|
|
14
|
+
* 2. The default `trajectoryTurnReader` and the returned
|
|
15
|
+
* `sourceMaterialAuthorization` share ONE consent-ledger authorization
|
|
16
|
+
* instance — trajectory reads and gate decisions are always consistent.
|
|
17
|
+
* 3. A host that already holds an in-process trajectory reader (OpenClaw
|
|
18
|
+
* Gateway `WorkspaceContext.trajectory`) passes it as
|
|
19
|
+
* `trajectoryTurnReaderOverride` instead of rebuilding one; the resolver
|
|
20
|
+
* wraps that reader in a live authorization probe rather than returning
|
|
21
|
+
* it as an unguarded pass-through.
|
|
22
|
+
*
|
|
23
|
+
* The resolver performs NO I/O beyond the collaborators' own lazy probes —
|
|
24
|
+
* the authorization, the intent reader (flag-first) and the auto-submission
|
|
25
|
+
* probe all consult the workspace consent ledger / config per call, so a
|
|
26
|
+
* long-lived host keeps observing the latest Owner decisions.
|
|
27
|
+
*/
|
|
28
|
+
import { type EffectivePdConfig, type IntentDocReader, type SourceMaterialAuthorizationPort, type SourceMaterialHostKind, type TelemetryEvent, type TrajectoryTurnReader } from '@principles/core/runtime';
|
|
29
|
+
/** The five host collaborators a workspace pipeline entry must carry. */
|
|
30
|
+
export interface WorkspacePipelineHostDeps {
|
|
31
|
+
/** PRI-1230 / SPEC §9.2: neutral INTENT.md reader, flag-first on the entry-provided config. */
|
|
32
|
+
readonly intentDocReader: IntentDocReader;
|
|
33
|
+
/** PRI-1265: consent-tiered trajectory turns (default governance reader or the host override). */
|
|
34
|
+
readonly trajectoryTurnReader: TrajectoryTurnReader;
|
|
35
|
+
/** PRI-1283 R2: the SAME authorization instance the default trajectory reader was built with. */
|
|
36
|
+
readonly sourceMaterialAuthorization: SourceMaterialAuthorizationPort;
|
|
37
|
+
/** PRI-939 Option A: workspace-scoped sink (allowlist persistence + singleton forwarding). */
|
|
38
|
+
readonly telemetrySink: {
|
|
39
|
+
emitTelemetry: (event: TelemetryEvent) => void;
|
|
40
|
+
};
|
|
41
|
+
/** Pain Ingress SPEC §9.6: lazy `automatic_pain_submission` probe (revocation-safe). */
|
|
42
|
+
readonly isAutoPainSubmissionAuthorized: () => boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ResolveWorkspacePipelineHostDepsInput {
|
|
45
|
+
readonly workspaceDir: string;
|
|
46
|
+
/** The CURRENT entry's effective config — the intent reader's flag authority (SPEC §13.1). */
|
|
47
|
+
readonly effectiveConfig: EffectivePdConfig;
|
|
48
|
+
/**
|
|
49
|
+
* OpenClaw Gateway hook / command processes already hold
|
|
50
|
+
* `WorkspaceContext.trajectory`; pass it here to replace the default
|
|
51
|
+
* governance reader. The resolver wraps it in live authorization checks;
|
|
52
|
+
* the authorization instance is still created and returned for gate consumers.
|
|
53
|
+
*/
|
|
54
|
+
readonly trajectoryTurnReaderOverride?: TrajectoryTurnReader;
|
|
55
|
+
/** Host whose consent governs the override's conversation material. Required with an override. */
|
|
56
|
+
readonly trajectoryTurnReaderOverrideHostKind?: SourceMaterialHostKind;
|
|
57
|
+
/**
|
|
58
|
+
* Host-specific LIVE access probe for a legacy/in-process reader. Called on
|
|
59
|
+
* every read; omitting it uses the consent-ledger port for hostKind.
|
|
60
|
+
*/
|
|
61
|
+
readonly trajectoryTurnReaderOverrideAuthorization?: () => boolean;
|
|
62
|
+
/** Optional host-specific observable channel for critical-event persistence failures. */
|
|
63
|
+
readonly telemetryPersistenceFailureHandler?: (detail: string) => void;
|
|
64
|
+
}
|
|
65
|
+
export declare function resolveWorkspacePipelineHostDeps(input: ResolveWorkspacePipelineHostDepsInput): WorkspacePipelineHostDeps;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SPEC-PD-PIPELINE-SPINE-001 §4.2 — the single workspace pipeline host
|
|
3
|
+
* collaborator assembly point (PRI-1292 Phase 2A).
|
|
4
|
+
*
|
|
5
|
+
* Before this module, eight entry points each assembled the five host
|
|
6
|
+
* collaborators by hand, and the diagnostician entries created TWO separate
|
|
7
|
+
* `createConsentLedgerSourceMaterialAuthorization` instances per call — one
|
|
8
|
+
* inside the governance trajectory reader, one passed to the bridge — so the
|
|
9
|
+
* trajectory read and the source-material gate could observe different consent
|
|
10
|
+
* states within a single assembly. This resolver guarantees:
|
|
11
|
+
*
|
|
12
|
+
* 1. All five collaborators are REQUIRED on the returned object (no `?`),
|
|
13
|
+
* so a new entry cannot compile with a silently missing sink or probe.
|
|
14
|
+
* 2. The default `trajectoryTurnReader` and the returned
|
|
15
|
+
* `sourceMaterialAuthorization` share ONE consent-ledger authorization
|
|
16
|
+
* instance — trajectory reads and gate decisions are always consistent.
|
|
17
|
+
* 3. A host that already holds an in-process trajectory reader (OpenClaw
|
|
18
|
+
* Gateway `WorkspaceContext.trajectory`) passes it as
|
|
19
|
+
* `trajectoryTurnReaderOverride` instead of rebuilding one; the resolver
|
|
20
|
+
* wraps that reader in a live authorization probe rather than returning
|
|
21
|
+
* it as an unguarded pass-through.
|
|
22
|
+
*
|
|
23
|
+
* The resolver performs NO I/O beyond the collaborators' own lazy probes —
|
|
24
|
+
* the authorization, the intent reader (flag-first) and the auto-submission
|
|
25
|
+
* probe all consult the workspace consent ledger / config per call, so a
|
|
26
|
+
* long-lived host keeps observing the latest Owner decisions.
|
|
27
|
+
*/
|
|
28
|
+
import { storeEmitter, } from '@principles/core/runtime';
|
|
29
|
+
import { isAutomaticPainSubmissionAuthorized } from './auto-pain-authorization.js';
|
|
30
|
+
import { createGovernanceTrajectoryTurnReader } from './governance-trajectory-turn-reader.js';
|
|
31
|
+
import { createHostIntentDocReader } from './intent-doc-reader.js';
|
|
32
|
+
import { createConsentLedgerSourceMaterialAuthorization } from './source-material-authorization.js';
|
|
33
|
+
import { WorkspaceTelemetryEmitter } from './workspace-telemetry-emitter.js';
|
|
34
|
+
function emptyExactTurns() {
|
|
35
|
+
return { userTurns: [], assistantTurns: [] };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A host-provided reader is still conversation-material access. Wrap it in
|
|
39
|
+
* the same live consent decision as the default governance reader; every
|
|
40
|
+
* method re-checks the ledger per call, so revocation takes effect immediately.
|
|
41
|
+
*/
|
|
42
|
+
function authorizeTrajectoryTurnReaderOverride(input) {
|
|
43
|
+
const authorized = () => input.overrideAuthorization?.() ?? input.authorization.isHostSourceMaterialAuthorized(input.hostKind).authorized;
|
|
44
|
+
const wrapped = {
|
|
45
|
+
listUserTurnsForSession: (sessionId) => authorized() ? input.reader.listUserTurnsForSession(sessionId) : [],
|
|
46
|
+
listAssistantTurns: (sessionId) => authorized() ? input.reader.listAssistantTurns(sessionId) : [],
|
|
47
|
+
};
|
|
48
|
+
if (input.reader.listTurnTextsForHostTurnId !== undefined) {
|
|
49
|
+
wrapped.listTurnTextsForHostTurnId = (sessionId, hostTurnId, hostKindArg) => authorized()
|
|
50
|
+
? input.reader.listTurnTextsForHostTurnId?.(sessionId, hostTurnId, hostKindArg) ?? emptyExactTurns()
|
|
51
|
+
: emptyExactTurns();
|
|
52
|
+
}
|
|
53
|
+
return wrapped;
|
|
54
|
+
}
|
|
55
|
+
export function resolveWorkspacePipelineHostDeps(input) {
|
|
56
|
+
// ONE authorization instance per assembly: the default governance
|
|
57
|
+
// trajectory reader and every gate consumer returned to the caller observe
|
|
58
|
+
// the SAME latest-consent state (the double-instance defect this module
|
|
59
|
+
// exists to remove).
|
|
60
|
+
const sourceMaterialAuthorization = createConsentLedgerSourceMaterialAuthorization(input.workspaceDir);
|
|
61
|
+
const overrideHostKind = input.trajectoryTurnReaderOverrideHostKind;
|
|
62
|
+
if (input.trajectoryTurnReaderOverride !== undefined && overrideHostKind === undefined) {
|
|
63
|
+
throw new Error('trajectoryTurnReaderOverrideHostKind is required when trajectoryTurnReaderOverride is provided');
|
|
64
|
+
}
|
|
65
|
+
const trajectoryTurnReader = input.trajectoryTurnReaderOverride !== undefined && overrideHostKind !== undefined
|
|
66
|
+
? authorizeTrajectoryTurnReaderOverride({
|
|
67
|
+
reader: input.trajectoryTurnReaderOverride,
|
|
68
|
+
authorization: sourceMaterialAuthorization,
|
|
69
|
+
hostKind: overrideHostKind,
|
|
70
|
+
...(input.trajectoryTurnReaderOverrideAuthorization === undefined
|
|
71
|
+
? {}
|
|
72
|
+
: { overrideAuthorization: input.trajectoryTurnReaderOverrideAuthorization }),
|
|
73
|
+
})
|
|
74
|
+
: createGovernanceTrajectoryTurnReader({
|
|
75
|
+
workspaceDir: input.workspaceDir,
|
|
76
|
+
sourceMaterialAuthorization,
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
intentDocReader: createHostIntentDocReader({
|
|
80
|
+
workspaceDir: input.workspaceDir,
|
|
81
|
+
effectiveConfig: input.effectiveConfig,
|
|
82
|
+
}),
|
|
83
|
+
trajectoryTurnReader,
|
|
84
|
+
sourceMaterialAuthorization,
|
|
85
|
+
// Same workspace-scoped semantics as the CLI wrapper: allowlisted critical
|
|
86
|
+
// events persist to <workspace>/.pd/telemetry/critical-events.jsonl and
|
|
87
|
+
// every event still forwards to the storeEmitter singleton. Persist
|
|
88
|
+
// failures degrade to stderr — never break the caller (PRI-634 contract).
|
|
89
|
+
telemetrySink: new WorkspaceTelemetryEmitter(storeEmitter, input.workspaceDir, input.telemetryPersistenceFailureHandler ?? ((detail) => {
|
|
90
|
+
process.stderr.write(`[PD:telemetry] WARNING: critical event persistence failed: ${detail}\n`);
|
|
91
|
+
})),
|
|
92
|
+
isAutoPainSubmissionAuthorized: () => isAutomaticPainSubmissionAuthorized(input.workspaceDir),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -43,6 +43,10 @@ import { StoreEventEmitter } from '@principles/core/runtime';
|
|
|
43
43
|
* (PRI-1146 P1-01:低频 skip/degradation 取证 — 前者记录 ledger 不可证明
|
|
44
44
|
* 时 canonical association 为何保持 unresolved,后者是 replay review skip
|
|
45
45
|
* 的唯一持久记录;见 Set 内注释)
|
|
46
|
+
* - diag_rootcause_intent_doc_template_only / diag_rootcause_intent_doc_read_failed
|
|
47
|
+
* (PRI-1287:Intent 链降级到 not_configured 的唯一可取证记录 — 无快照时
|
|
48
|
+
* relevance 恒为 not_configured;reason 区分「标题从未被识别」与「模板未
|
|
49
|
+
* 填写」,两者需要完全相反的 Owner 动作)
|
|
46
50
|
*
|
|
47
51
|
* 落点 `<workspaceDir>/.pd/telemetry/critical-events.jsonl`(JSONL,一行一
|
|
48
52
|
* 事件,含完整 TelemetryEvent)。同步 append:事件量小(allowlist 限流),
|
|
@@ -72,6 +76,16 @@ const CRITICAL_EVENT_ALLOWLIST = new Set([
|
|
|
72
76
|
// (its only durable record — the candidate row itself carries no skip reason).
|
|
73
77
|
'diag_router_trusted_context_unavailable',
|
|
74
78
|
'replay_review_source_invalid',
|
|
79
|
+
// PRI-1287 (rc-9): the Intent chain's degradation evidence. Stage A has been
|
|
80
|
+
// emitting these since #2663, but production runners ride the unsubscribed
|
|
81
|
+
// storeEmitter singleton and the events were absent from this allowlist — an
|
|
82
|
+
// emitted degradation and a silent one looked identical to the Owner. That is
|
|
83
|
+
// how an entire Intent chain could degrade to `not_configured` for weeks
|
|
84
|
+
// (found by PRI-1284) with nothing to inspect afterwards. Low frequency: at
|
|
85
|
+
// most one line per diagnosis that could not anchor, plus its reason
|
|
86
|
+
// (`no_parsed_section` vs `placeholder_only`) and nextAction.
|
|
87
|
+
'diag_rootcause_intent_doc_template_only',
|
|
88
|
+
'diag_rootcause_intent_doc_read_failed',
|
|
75
89
|
]);
|
|
76
90
|
export class WorkspaceTelemetryEmitter extends StoreEventEmitter {
|
|
77
91
|
upstream;
|
|
@@ -206,7 +206,7 @@ export interface ReadOwnershipOptions {
|
|
|
206
206
|
* collapsed into "legacy by default" for a consumer that is about to act.
|
|
207
207
|
*/
|
|
208
208
|
export declare function readWorkspaceBackgroundOwnership(options: ReadOwnershipOptions): WorkspaceBackgroundOwnership;
|
|
209
|
-
export declare const BACKGROUND_EXECUTION_TRANSITIONS: readonly ['begin_handover', 'abort_handover', 'complete_handover', 'begin_rollback', 'complete_rollback', 'abort_rollback'];
|
|
209
|
+
export declare const BACKGROUND_EXECUTION_TRANSITIONS: readonly ['provision_fresh_install', 'begin_handover', 'abort_handover', 'complete_handover', 'begin_rollback', 'complete_rollback', 'abort_rollback'];
|
|
210
210
|
export type BackgroundExecutionTransitionKind = (typeof BACKGROUND_EXECUTION_TRANSITIONS)[number];
|
|
211
211
|
export interface TransitionBackgroundExecutionInput {
|
|
212
212
|
manifestPath: string;
|
|
@@ -222,6 +222,16 @@ export interface TransitionBackgroundExecutionInput {
|
|
|
222
222
|
expectedGeneration?: number;
|
|
223
223
|
/** begin_handover only: also merge the workspace into `workspaces[]`. */
|
|
224
224
|
registerWorkspace?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* provision_fresh_install ONLY: the caller's proof that this Workspace has
|
|
227
|
+
* no historical background consumer (a brand-new PD install created it in
|
|
228
|
+
* this run). A legacy upgrade NEVER passes this — it must use
|
|
229
|
+
* begin_handover so the old consumer is stopped and verified first.
|
|
230
|
+
* The proof is enforced structurally below: the manifest must hold NO
|
|
231
|
+
* ownership record for the workspace (absence of history), not merely a
|
|
232
|
+
* `legacy_owned` record.
|
|
233
|
+
*/
|
|
234
|
+
freshInstall?: boolean;
|
|
225
235
|
platform?: string;
|
|
226
236
|
now?: () => Date;
|
|
227
237
|
staleMs?: number;
|
|
@@ -587,6 +587,7 @@ export function readWorkspaceBackgroundOwnership(options) {
|
|
|
587
587
|
}
|
|
588
588
|
// ─── Transitions ────────────────────────────────────────────────────────────
|
|
589
589
|
export const BACKGROUND_EXECUTION_TRANSITIONS = [
|
|
590
|
+
'provision_fresh_install',
|
|
590
591
|
'begin_handover',
|
|
591
592
|
'abort_handover',
|
|
592
593
|
'complete_handover',
|
|
@@ -595,6 +596,11 @@ export const BACKGROUND_EXECUTION_TRANSITIONS = [
|
|
|
595
596
|
'abort_rollback',
|
|
596
597
|
];
|
|
597
598
|
const TRANSITION_SPECS = {
|
|
599
|
+
// Fresh-install provisioning: a brand-new Workspace is born Service-Host
|
|
600
|
+
// owned in ONE atomic write (generation 0 → 1). There is no old consumer
|
|
601
|
+
// to quiesce, so the handover_preparing staging is not used; the caller
|
|
602
|
+
// still has to prove absence of history through the manifest itself.
|
|
603
|
+
provision_fresh_install: { from: ['legacy_owned'], to: 'service_host_owned', needsOperationId: false },
|
|
598
604
|
// legacy_owned -> handover_preparing; effectiveOwner stays legacy (SPEC §8.4-3:
|
|
599
605
|
// PREPARING grants no new rights — the old consumer remains the only one).
|
|
600
606
|
begin_handover: { from: ['legacy_owned', 'handover_preparing'], to: 'handover_preparing', needsOperationId: true },
|
|
@@ -608,6 +614,8 @@ function buildTargetRecord(context) {
|
|
|
608
614
|
const generation = context.currentGeneration + 1;
|
|
609
615
|
const { operationId, nowIso } = context;
|
|
610
616
|
switch (context.kind) {
|
|
617
|
+
case 'provision_fresh_install':
|
|
618
|
+
return { state: 'service_host_owned', effectiveOwner: 'service_host', generation, operationId: null, previousOwner: null, targetOwner: null, updatedAt: nowIso };
|
|
611
619
|
case 'begin_handover':
|
|
612
620
|
return { state: 'handover_preparing', effectiveOwner: 'legacy', generation, operationId, previousOwner: 'legacy', targetOwner: 'service_host', updatedAt: nowIso };
|
|
613
621
|
case 'abort_handover':
|
|
@@ -709,7 +717,9 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
709
717
|
// because a marker key outside `workspaces[]` cannot parse back. An alias
|
|
710
718
|
// registration for the same real directory counts as registered.
|
|
711
719
|
const registered = identity.registeredAliases.length > 0;
|
|
712
|
-
|
|
720
|
+
const mayRegister = (input.kind === 'begin_handover' || input.kind === 'provision_fresh_install')
|
|
721
|
+
&& input.registerWorkspace === true;
|
|
722
|
+
if (!registered && !mayRegister) {
|
|
713
723
|
return {
|
|
714
724
|
ok: false,
|
|
715
725
|
reason: 'workspace_not_registered',
|
|
@@ -723,6 +733,40 @@ export function transitionWorkspaceBackgroundExecution(input) {
|
|
|
723
733
|
const currentRecord = identity.records[0]?.record;
|
|
724
734
|
const currentState = currentRecord?.state ?? 'legacy_owned';
|
|
725
735
|
const currentGeneration = currentRecord?.generation ?? 0;
|
|
736
|
+
// Fresh-install provisioning is the ONE transition that skips the legacy
|
|
737
|
+
// handover staging, so its authorization must be proven here rather than
|
|
738
|
+
// trusted from the caller:
|
|
739
|
+
// - `freshInstall` must be explicitly asserted (a legacy upgrade that
|
|
740
|
+
// forgot it can never flip ownership silently);
|
|
741
|
+
// - the manifest must hold NO ownership record at all for this
|
|
742
|
+
// workspace (a `legacy_owned` RECORD is history — that workspace has
|
|
743
|
+
// been managed before and must go through begin_handover);
|
|
744
|
+
// - an already-provisioned workspace is an idempotent replay.
|
|
745
|
+
if (input.kind === 'provision_fresh_install') {
|
|
746
|
+
if (input.freshInstall !== true) {
|
|
747
|
+
return {
|
|
748
|
+
ok: false,
|
|
749
|
+
reason: 'invalid_input',
|
|
750
|
+
message: 'provision_fresh_install requires freshInstall=true; upgrades must use begin_handover so the legacy consumer is stopped and verified first',
|
|
751
|
+
nextAction: 'Use pd service handover for an existing workspace; fresh-install provisioning is install-time only.',
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
const alreadyOwned = currentRecord !== undefined
|
|
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
|
+
}
|
|
769
|
+
}
|
|
726
770
|
if (input.expectedGeneration !== undefined && input.expectedGeneration !== currentGeneration) {
|
|
727
771
|
return {
|
|
728
772
|
ok: false,
|
|
@@ -46,8 +46,8 @@ export interface InstallManifest {
|
|
|
46
46
|
* Host: only the state machine defined in the SPEC may advance an entry,
|
|
47
47
|
* every transition is a monotonic-generation compare-and-set, and PID /
|
|
48
48
|
* delays / startup order are NEVER ownership proof — this record is.
|
|
49
|
-
* The
|
|
50
|
-
*
|
|
49
|
+
* The CAS write path and the state machine live in
|
|
50
|
+
* `background-execution-transition.ts` (Phase 4/5).
|
|
51
51
|
*/
|
|
52
52
|
backgroundExecutions?: Readonly<Record<string, BackgroundExecutionRecord>>;
|
|
53
53
|
}
|
|
@@ -259,7 +259,8 @@ export declare function getPdCliEntry(paths: InstallLayoutPaths, mode: InstallLa
|
|
|
259
259
|
* authority for "which PD home does this process own" — components must not
|
|
260
260
|
* re-derive it locally.
|
|
261
261
|
*/
|
|
262
|
-
export { PD_EXPERIMENT_ROOT_ENV, PD_OPENCLAW_HOME_ENV, PD_OPENCLAW_STATE_DIR_ENV, PD_CODEX_HOME_ENV, PD_WORKBUDDY_CONFIG_DIR_ENV, PD_HOST_WORKSPACE_DIR_NAME, PD_HOME_MODES, PD_HOME_FAILURE_REASONS, resolvePdHome, resolveRealUserHome, isPathWithinRoot, type PdHomeMode, type PdHomePaths, type PdHomeFailure, type PdHomeFailureReason, type PdHomeSuccess, type PdHomeResolution, type ResolvePdHomeOptions, } from './pd-home.js';
|
|
262
|
+
export { PD_EXPERIMENT_ROOT_ENV, PD_OPENCLAW_HOME_ENV, PD_OPENCLAW_STATE_DIR_ENV, PD_CODEX_HOME_ENV, PD_WORKBUDDY_CONFIG_DIR_ENV, PD_HOST_WORKSPACE_DIR_NAME, PD_HOME_MODES, PD_HOME_FAILURE_REASONS, resolvePdHome, resolveRealUserHome, isPathWithinRoot, canonicalizeDeepestExisting, type PdHomeMode, type PdHomePaths, type PdHomeFailure, type PdHomeFailureReason, type PdHomeSuccess, type PdHomeResolution, type ResolvePdHomeOptions, } from './pd-home.js';
|
|
263
|
+
export { resolveOpenClawConfigPath, type OpenClawConfigPathResolution } from './openclaw-config-path.js';
|
|
263
264
|
export { ACTIVE_RELEASE_SCHEMA_VERSION, activeReleaseRecordPath, parseActiveReleaseRecord, readActiveReleaseRecord, type ActiveReleaseFailureReason, type ActiveReleaseRecord, type ActiveReleaseVerdict, } from './active-release.js';
|
|
264
265
|
/**
|
|
265
266
|
* Codex host-persistent binding location. The versioned payload directory is
|
|
@@ -254,9 +254,6 @@ export function parseInstallManifest(value, platform = process.platform) {
|
|
|
254
254
|
}
|
|
255
255
|
carriedUnknownHosts = value.unknownHosts.filter((host) => !isHost(host));
|
|
256
256
|
}
|
|
257
|
-
if (value.hosts.length === 0 && carriedUnknownHosts.length === 0) {
|
|
258
|
-
return { error: 'install_manifest_malformed: hosts must contain at least one host' };
|
|
259
|
-
}
|
|
260
257
|
const hosts = [];
|
|
261
258
|
const unknownHosts = [];
|
|
262
259
|
const warnings = [];
|
|
@@ -277,6 +274,15 @@ export function parseInstallManifest(value, platform = process.platform) {
|
|
|
277
274
|
const workspaces = parseWorkspaceList(value.workspaces, platform);
|
|
278
275
|
if (workspaces.error)
|
|
279
276
|
return { error: workspaces.error };
|
|
277
|
+
// A Service-Host-only install has NO host adapter (PRI-1278 Phase 5): the
|
|
278
|
+
// manifest legitimately carries `hosts: []` while declaring the workspaces
|
|
279
|
+
// the Service Host owns. An empty manifest with neither hosts nor
|
|
280
|
+
// workspaces is still structural damage — "no host AND no workspace" is
|
|
281
|
+
// indistinguishable from a truncated file, and every consumer would read
|
|
282
|
+
// it as a healthy empty install.
|
|
283
|
+
if (hosts.length === 0 && unknownHosts.length === 0 && (workspaces.workspaces ?? []).length === 0) {
|
|
284
|
+
return { error: 'install_manifest_malformed: hosts must contain at least one host or the manifest must declare at least one workspace' };
|
|
285
|
+
}
|
|
280
286
|
const backgroundExecutions = parseBackgroundExecutions({ backgroundExecution: value.backgroundExecution, backgroundExecutions: value.backgroundExecutions }, workspaces.workspaces ?? [], platform);
|
|
281
287
|
if (backgroundExecutions.error)
|
|
282
288
|
return { error: backgroundExecutions.error };
|
|
@@ -484,7 +490,8 @@ export function getPdCliEntry(paths, mode) {
|
|
|
484
490
|
* authority for "which PD home does this process own" — components must not
|
|
485
491
|
* re-derive it locally.
|
|
486
492
|
*/
|
|
487
|
-
export { PD_EXPERIMENT_ROOT_ENV, PD_OPENCLAW_HOME_ENV, PD_OPENCLAW_STATE_DIR_ENV, PD_CODEX_HOME_ENV, PD_WORKBUDDY_CONFIG_DIR_ENV, PD_HOST_WORKSPACE_DIR_NAME, PD_HOME_MODES, PD_HOME_FAILURE_REASONS, resolvePdHome, resolveRealUserHome, isPathWithinRoot, } from './pd-home.js';
|
|
493
|
+
export { PD_EXPERIMENT_ROOT_ENV, PD_OPENCLAW_HOME_ENV, PD_OPENCLAW_STATE_DIR_ENV, PD_CODEX_HOME_ENV, PD_WORKBUDDY_CONFIG_DIR_ENV, PD_HOST_WORKSPACE_DIR_NAME, PD_HOME_MODES, PD_HOME_FAILURE_REASONS, resolvePdHome, resolveRealUserHome, isPathWithinRoot, canonicalizeDeepestExisting, } from './pd-home.js';
|
|
494
|
+
export { resolveOpenClawConfigPath } from './openclaw-config-path.js';
|
|
488
495
|
export { ACTIVE_RELEASE_SCHEMA_VERSION, activeReleaseRecordPath, parseActiveReleaseRecord, readActiveReleaseRecord, } from './active-release.js';
|
|
489
496
|
/**
|
|
490
497
|
* Codex host-persistent binding location. The versioned payload directory is
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type OpenClawConfigPathResolution = {
|
|
2
|
+
readonly ok: true;
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly source: 'config_path' | 'state_dir' | 'profile' | 'openclaw_home' | 'default';
|
|
5
|
+
} | {
|
|
6
|
+
readonly ok: false;
|
|
7
|
+
readonly reason: 'home_unavailable';
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveOpenClawConfigPath(env?: Readonly<Record<string, string | undefined>>, homeDir?: string, cwd?: string): OpenClawConfigPathResolution;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw effective config path resolution, mirrored from OpenClaw
|
|
3
|
+
* 2026.11.5 (`src/config/paths.ts`, `state-dir.ts`, `home-dir.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Host precedence: OPENCLAW_CONFIG_PATH > OPENCLAW_STATE_DIR >
|
|
6
|
+
* profile/home-derived state dir. OPENCLAW_HOME is the host's HOME substitute
|
|
7
|
+
* (not the `.openclaw` directory itself); a valid non-default OPENCLAW_PROFILE
|
|
8
|
+
* selects `.openclaw-<profile>`. User-supplied paths support leading `~` and
|
|
9
|
+
* host-style relative resolution. This module resolves paths only; config
|
|
10
|
+
* content parsing belongs to the OpenClaw plugin layer.
|
|
11
|
+
*/
|
|
12
|
+
import os from 'node:os';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
const PROFILE_NAME_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
|
|
15
|
+
function normalizeProfileName(value) {
|
|
16
|
+
const trimmed = value?.trim();
|
|
17
|
+
if (!trimmed || trimmed.toLowerCase() === 'default' || !PROFILE_NAME_RE.test(trimmed))
|
|
18
|
+
return null;
|
|
19
|
+
return trimmed;
|
|
20
|
+
}
|
|
21
|
+
function expandUserPath(value, rawHomeDir, cwd) {
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (!trimmed)
|
|
24
|
+
return trimmed;
|
|
25
|
+
let expanded = trimmed;
|
|
26
|
+
if ((trimmed === '~' || trimmed.startsWith('~/') || trimmed.startsWith('~\\')) && rawHomeDir) {
|
|
27
|
+
expanded = rawHomeDir + trimmed.slice(1);
|
|
28
|
+
}
|
|
29
|
+
// OpenClaw resolves non-absolute user paths through resolveUserPath; absent
|
|
30
|
+
// its internal user-path base directory, that is process cwd semantics.
|
|
31
|
+
return path.resolve(cwd, expanded);
|
|
32
|
+
}
|
|
33
|
+
function effectiveHomeDir(env, rawHomeDir, cwd) {
|
|
34
|
+
const openclawHome = env.OPENCLAW_HOME?.trim();
|
|
35
|
+
if (openclawHome)
|
|
36
|
+
return expandUserPath(openclawHome, rawHomeDir, cwd);
|
|
37
|
+
// OpenClaw resolveRequiredHomeDir falls back to the process cwd when no
|
|
38
|
+
// home source exists. Mirroring that behavior keeps PD aligned with the
|
|
39
|
+
// config the host actually loads instead of inventing a different policy.
|
|
40
|
+
return rawHomeDir ? path.resolve(cwd, rawHomeDir) : path.resolve(cwd);
|
|
41
|
+
}
|
|
42
|
+
export function resolveOpenClawConfigPath(env = process.env, homeDir = os.homedir(), cwd = process.cwd()) {
|
|
43
|
+
const rawHomeDir = homeDir.trim() || undefined;
|
|
44
|
+
const explicitConfig = env.OPENCLAW_CONFIG_PATH?.trim();
|
|
45
|
+
if (explicitConfig) {
|
|
46
|
+
return { ok: true, path: expandUserPath(explicitConfig, rawHomeDir, cwd), source: 'config_path' };
|
|
47
|
+
}
|
|
48
|
+
const explicitStateDir = env.OPENCLAW_STATE_DIR?.trim();
|
|
49
|
+
if (explicitStateDir) {
|
|
50
|
+
return { ok: true, path: path.join(expandUserPath(explicitStateDir, rawHomeDir, cwd), 'openclaw.json'), source: 'state_dir' };
|
|
51
|
+
}
|
|
52
|
+
const effectiveHome = effectiveHomeDir(env, rawHomeDir, cwd);
|
|
53
|
+
if (!effectiveHome)
|
|
54
|
+
return { ok: false, reason: 'home_unavailable' };
|
|
55
|
+
const profile = normalizeProfileName(env.OPENCLAW_PROFILE);
|
|
56
|
+
if (profile) {
|
|
57
|
+
return { ok: true, path: path.join(effectiveHome, `.openclaw-${profile}`, 'openclaw.json'), source: 'profile' };
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
ok: true,
|
|
61
|
+
path: path.join(effectiveHome, '.openclaw', 'openclaw.json'),
|
|
62
|
+
source: env.OPENCLAW_HOME?.trim() ? 'openclaw_home' : 'default',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -85,6 +85,18 @@ export declare function resolveRealUserHome(env?: Readonly<Record<string, string
|
|
|
85
85
|
* to hand-roll a `startsWith` prefix check.
|
|
86
86
|
*/
|
|
87
87
|
export declare function isPathWithinRoot(root: string, candidate: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Realpath the deepest EXISTING ancestor of `target`, then re-append the
|
|
90
|
+
* missing tail. Unlike `realpathSync(target)` this also answers for paths that
|
|
91
|
+
* do not exist yet (PD creates its own directories), while still resolving any
|
|
92
|
+
* link that already sits on the path.
|
|
93
|
+
*
|
|
94
|
+
* Exported for test-harness sandbox guards: an escape check done on
|
|
95
|
+
* `path.resolve()` strings alone misses a junction/symlink sitting on an
|
|
96
|
+
* existing ancestor. Pair with `isPathWithinRoot` for a real-path boundary
|
|
97
|
+
* judgment (the same semantics resolvePdHome applies to experiment roots).
|
|
98
|
+
*/
|
|
99
|
+
export declare function canonicalizeDeepestExisting(target: string): string | null;
|
|
88
100
|
/**
|
|
89
101
|
* Resolve the PD home for this process. Callers must treat `ok: false` as a
|
|
90
102
|
* startup refusal — there is no degraded mode.
|
|
@@ -93,8 +93,13 @@ export function isPathWithinRoot(root, candidate) {
|
|
|
93
93
|
* missing tail. Unlike `realpathSync(target)` this also answers for paths that
|
|
94
94
|
* do not exist yet (PD creates its own directories), while still resolving any
|
|
95
95
|
* link that already sits on the path.
|
|
96
|
+
*
|
|
97
|
+
* Exported for test-harness sandbox guards: an escape check done on
|
|
98
|
+
* `path.resolve()` strings alone misses a junction/symlink sitting on an
|
|
99
|
+
* existing ancestor. Pair with `isPathWithinRoot` for a real-path boundary
|
|
100
|
+
* judgment (the same semantics resolvePdHome applies to experiment roots).
|
|
96
101
|
*/
|
|
97
|
-
function canonicalizeDeepestExisting(target) {
|
|
102
|
+
export function canonicalizeDeepestExisting(target) {
|
|
98
103
|
const missing = [];
|
|
99
104
|
let current = path.resolve(target);
|
|
100
105
|
for (;;) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-principles-disciple",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.156.1",
|
|
4
4
|
"description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"author": "csuzngjh",
|
|
64
64
|
"license": "Apache-2.0",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@earendil-works/pi-agent-core": "1.
|
|
67
|
-
"@earendil-works/pi-ai": "1.
|
|
68
|
-
"@principles/install-layout": "^0.
|
|
66
|
+
"@earendil-works/pi-agent-core": "1.6.0",
|
|
67
|
+
"@earendil-works/pi-ai": "1.6.0",
|
|
68
|
+
"@principles/install-layout": "^0.11.1",
|
|
69
69
|
"@sinclair/typebox": "^0.34.52",
|
|
70
70
|
"@tufjs/models": "3.0.1",
|
|
71
71
|
"@inquirer/prompts": "^8.8.0",
|
|
72
72
|
"better-sqlite3": "^13.0.3",
|
|
73
73
|
"commander": "^15.1.0",
|
|
74
|
-
"fs-extra": "^11.4.
|
|
74
|
+
"fs-extra": "^11.4.1",
|
|
75
75
|
"js-yaml": "^5.4.3",
|
|
76
76
|
"micromatch": "^4.0.8",
|
|
77
|
-
"ora": "^
|
|
77
|
+
"ora": "^10.0.0",
|
|
78
78
|
"picocolors": "^1.0.0",
|
|
79
79
|
"semver": "^7.8.6",
|
|
80
80
|
"tar": "^7.5.22",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"pd": {
|
|
104
104
|
"bundledPluginVersion": "4.2.1"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "16f7e15c5832284db3836b8babed2b7980bca8c9"
|
|
107
107
|
}
|
|
@@ -24,6 +24,13 @@ interface CandidateRepairOptions {
|
|
|
24
24
|
workspace?: string;
|
|
25
25
|
json?: boolean;
|
|
26
26
|
}
|
|
27
|
+
interface CandidatePostProcessingRecoveryOptions {
|
|
28
|
+
candidateId: string;
|
|
29
|
+
workspace?: string;
|
|
30
|
+
reason: string;
|
|
31
|
+
confirm?: boolean;
|
|
32
|
+
json?: boolean;
|
|
33
|
+
}
|
|
27
34
|
/**
|
|
28
35
|
* Resolve `sourcePainId` from the canonical diagnostician task chain.
|
|
29
36
|
*
|
|
@@ -112,6 +119,14 @@ export declare function handleCandidateAudit(opts: CandidateAuditOptions): Promi
|
|
|
112
119
|
* Fills consumed_at if empty.
|
|
113
120
|
*/
|
|
114
121
|
export declare function handleCandidateRepair(opts: CandidateRepairOptions): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Resume only a candidate whose post-processing was parked by an invalid RAW
|
|
124
|
+
* recommendation kind. The data repair is performed separately; this command
|
|
125
|
+
* is an explicit, ADR-0022-verified Owner authorization that appends an audit
|
|
126
|
+
* record and moves the existing processing state to in_progress. It never
|
|
127
|
+
* creates a Dreamer task directly and never releases a genuine Owner park.
|
|
128
|
+
*/
|
|
129
|
+
export declare function handleCandidatePostProcessingRecovery(opts: CandidatePostProcessingRecoveryOptions): Promise<void>;
|
|
115
130
|
interface CandidateBackfillOptions {
|
|
116
131
|
workspace?: string;
|
|
117
132
|
json?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../../src/commands/candidate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"candidate.d.ts","sourceRoot":"","sources":["../../src/commands/candidate.ts"],"names":[],"mappings":"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"}
|