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
|
@@ -2,6 +2,12 @@ import * as fs from 'node:fs';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { sendSuccess, sendMethodNotAllowed, sendNotFound, errorMessage } from '../utils/response.js';
|
|
4
4
|
import { getPdHome } from '../utils/pd-home.js';
|
|
5
|
+
import { releaseHandoverOwner } from '../release-handover.js';
|
|
6
|
+
/**
|
|
7
|
+
* A progress observation older than this describes a stage nobody is in any
|
|
8
|
+
* more (an executor that was killed never removed its sidecar).
|
|
9
|
+
*/
|
|
10
|
+
const PROGRESS_STALE_AFTER_MS = 120_000;
|
|
5
11
|
/** Transaction ids are installer/console-generated (`<word>-<ts>-<hex>`); this
|
|
6
12
|
* pattern doubles as the path-traversal guard for the journal file name (rc-1). */
|
|
7
13
|
const TRANSACTION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
|
|
@@ -29,21 +35,47 @@ function factFromTransitions(journal, transactionId, read) {
|
|
|
29
35
|
function readJournalFact(journal, journalPath, transactionId) {
|
|
30
36
|
return factFromTransitions(journal, transactionId, journal.readTransactionJournalForRecovery(journalPath));
|
|
31
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* The Console process that answered. A page tracking an update compares its
|
|
40
|
+
* pid across polls to tell "the same console" from "its successor" — the
|
|
41
|
+
* release handover replaces the process underneath the page without changing
|
|
42
|
+
* the URL. `handover` says who will do that replacing, so the page knows
|
|
43
|
+
* whether to wait for it, and for how long.
|
|
44
|
+
*/
|
|
45
|
+
function serverIdentity() {
|
|
46
|
+
return { serverPid: process.pid, handover: releaseHandoverOwner() };
|
|
47
|
+
}
|
|
48
|
+
function readProgressFact(seam, transactionsDir, transactionId) {
|
|
49
|
+
// `hasOwn`, not property access: an older or mocked module may not carry
|
|
50
|
+
// the export at all, and reading a missing export is not "no progress".
|
|
51
|
+
const read = Object.hasOwn(seam, 'readTransactionProgress') ? seam.readTransactionProgress : undefined;
|
|
52
|
+
if (read === undefined)
|
|
53
|
+
return null;
|
|
54
|
+
const progress = read(transactionsDir, transactionId);
|
|
55
|
+
if (progress === null)
|
|
56
|
+
return null;
|
|
57
|
+
return Math.abs(Date.now() - Date.parse(progress.at)) <= PROGRESS_STALE_AFTER_MS ? progress : null;
|
|
58
|
+
}
|
|
32
59
|
async function transactionStatus(res, transactionId) {
|
|
33
60
|
if (!TRANSACTION_ID_PATTERN.test(transactionId)) {
|
|
34
|
-
sendSuccess(res, { transactionId, exists: false, reason: 'invalid_transaction_id' });
|
|
61
|
+
sendSuccess(res, { transactionId, exists: false, reason: 'invalid_transaction_id', ...serverIdentity() });
|
|
35
62
|
return;
|
|
36
63
|
}
|
|
37
64
|
const journal = await import('create-principles-disciple/update-console');
|
|
65
|
+
const seam = journal;
|
|
38
66
|
const layout = journal;
|
|
39
67
|
const paths = layout.resolvePdHomePaths(getPdHome().pdHome);
|
|
40
68
|
const journalPath = path.join(paths.transactionsDir, `${transactionId}.jsonl`);
|
|
41
69
|
if (!fs.existsSync(journalPath)) {
|
|
42
|
-
sendSuccess(res, { transactionId, exists: false });
|
|
70
|
+
sendSuccess(res, { transactionId, exists: false, ...serverIdentity() });
|
|
43
71
|
return;
|
|
44
72
|
}
|
|
45
73
|
try {
|
|
46
|
-
sendSuccess(res,
|
|
74
|
+
sendSuccess(res, {
|
|
75
|
+
...readJournalFact(journal, journalPath, transactionId),
|
|
76
|
+
...serverIdentity(),
|
|
77
|
+
progress: readProgressFact(seam, paths.transactionsDir, transactionId),
|
|
78
|
+
});
|
|
47
79
|
}
|
|
48
80
|
catch (error) {
|
|
49
81
|
// A broken journal is exactly the kind of fact recovery presentation needs —
|
|
@@ -58,6 +90,8 @@ async function transactionStatus(res, transactionId) {
|
|
|
58
90
|
lastAt: null,
|
|
59
91
|
productVersion: null,
|
|
60
92
|
transitions: [],
|
|
93
|
+
...serverIdentity(),
|
|
94
|
+
progress: null,
|
|
61
95
|
reason: errorMessage(error),
|
|
62
96
|
});
|
|
63
97
|
}
|
|
@@ -127,6 +127,12 @@ async function applyFullUpdate(authority, res, workspaceDir) {
|
|
|
127
127
|
success: true,
|
|
128
128
|
state: 'update_in_progress',
|
|
129
129
|
transactionId,
|
|
130
|
+
// The console that accepted the update. The page keeps it as the
|
|
131
|
+
// baseline for the release handover: by the time it can read the
|
|
132
|
+
// transaction, the successor may already be the one answering, and
|
|
133
|
+
// a baseline taken from the first readable poll would then be the
|
|
134
|
+
// successor's own pid — something that never "changes".
|
|
135
|
+
serverPid: process.pid,
|
|
130
136
|
message: `Update transaction ${transactionId} accepted; the update keeps running even if this console stops.`,
|
|
131
137
|
requiresRestart: false,
|
|
132
138
|
nextAction: 'This page tracks the running update. Do not start another update until it finishes.',
|
|
@@ -240,10 +246,24 @@ export async function handleUpdateRoute(req, res, workspaceDir, subPath) {
|
|
|
240
246
|
else {
|
|
241
247
|
try {
|
|
242
248
|
mod = await import('create-principles-disciple/update-console');
|
|
243
|
-
|
|
249
|
+
// Awaited: the readiness gate re-hashes the deployed executor tree, and
|
|
250
|
+
// awaiting it lets this server keep serving other requests while the
|
|
251
|
+
// tree is read.
|
|
252
|
+
const seam = mod;
|
|
253
|
+
const createAuthority = seam.createReleaseManagerAuthorityAsync ?? seam.createReleaseManagerAuthority;
|
|
254
|
+
authority = await createAuthority({
|
|
244
255
|
pdHome: getPdHome().pdHome,
|
|
245
256
|
metadataBaseUrl: process.env.PD_RELEASE_METADATA_URL,
|
|
246
257
|
});
|
|
258
|
+
// The transport does not cancel what it times out: `asyncHandler` answers
|
|
259
|
+
// 504 at its budget while this route is still awaiting the gate above.
|
|
260
|
+
// Carrying on from there would START an update the page was told had
|
|
261
|
+
// failed — detached, and tracked by nobody. A request that was already
|
|
262
|
+
// answered, or whose caller is gone, is over: nothing below runs for it.
|
|
263
|
+
if (res.writableEnded || res.destroyed) {
|
|
264
|
+
console.error(`[update] ${subPath} abandoned: the request was already answered while the readiness gate ran`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
247
267
|
const readiness = authority.kinds[subPath === '/check' ? 'check' : 'apply-full'];
|
|
248
268
|
if (!readiness.ready || authority.installStatus === null) {
|
|
249
269
|
failure = { ...failure, reason: readiness.reasons.join(',') || 'install_state_corrupt', message: 'The installation is not ready for a signed release update.' };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console successor — the process a Console starts when the installed release
|
|
3
|
+
* changes under it (see release-handover.ts).
|
|
4
|
+
*
|
|
5
|
+
* It exists so a handover never launches a path it was handed: the predecessor
|
|
6
|
+
* forks THIS module — a fixed name inside its own installed build, which an
|
|
7
|
+
* update has already replaced with the new release's copy — and writes the
|
|
8
|
+
* launch configuration to the successor's stdin. The successor then starts the
|
|
9
|
+
* console exactly the way the packaged entry does, with one difference: it
|
|
10
|
+
* keeps trying to bind while the predecessor is still releasing the port.
|
|
11
|
+
*
|
|
12
|
+
* stdin carries one JSON object, `{ "args": ["--workspace", "...", ...],
|
|
13
|
+
* "cwd": "<the predecessor's working directory>" }`: the predecessor's own
|
|
14
|
+
* command-line arguments, and the directory to resolve them from. It is
|
|
15
|
+
* untrusted input and is validated field by field; anything else exits before
|
|
16
|
+
* a port is touched, so a malformed or absent configuration never leaves a
|
|
17
|
+
* stray process behind.
|
|
18
|
+
*
|
|
19
|
+
* The successor's first act is to LEAVE the build directory it was resolved
|
|
20
|
+
* from, for the predecessor's working directory — see
|
|
21
|
+
* `adoptWorkingDirectory`.
|
|
22
|
+
*
|
|
23
|
+
* cli-7 / PRI-892 precedent: importing this module (a test driving
|
|
24
|
+
* `parseSuccessorLaunchConfig`, for example) must NOT start a console or wait
|
|
25
|
+
* on stdin — reading standard input blocks until it ends. Only direct
|
|
26
|
+
* execution runs the successor.
|
|
27
|
+
*/
|
|
28
|
+
export interface SuccessorLaunchConfig {
|
|
29
|
+
readonly args: readonly string[];
|
|
30
|
+
/** The directory the predecessor was working from; absent when the launch line does not carry a usable one. */
|
|
31
|
+
readonly cwd?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function parseSuccessorLaunchConfig(raw: string): SuccessorLaunchConfig | null;
|
|
34
|
+
/**
|
|
35
|
+
* Moves this process's working directory to `cwd` — where the predecessor was
|
|
36
|
+
* launched from — before anything else is loaded from disk.
|
|
37
|
+
*
|
|
38
|
+
* The predecessor resolves this module relative to its build directory, so
|
|
39
|
+
* that is where this process starts out. It must not stay there: on Windows a
|
|
40
|
+
* process's working directory keeps its tree from being renamed or removed,
|
|
41
|
+
* and the next update begins by renaming the whole runtime directory away to
|
|
42
|
+
* back it up. A `cwd` that is gone (or was never given) falls back to the OS
|
|
43
|
+
* temp directory and then home: a console can run from any of those, while the
|
|
44
|
+
* build directory has to be released.
|
|
45
|
+
*/
|
|
46
|
+
export declare function adoptWorkingDirectory(cwd: string | undefined): void;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console successor — the process a Console starts when the installed release
|
|
3
|
+
* changes under it (see release-handover.ts).
|
|
4
|
+
*
|
|
5
|
+
* It exists so a handover never launches a path it was handed: the predecessor
|
|
6
|
+
* forks THIS module — a fixed name inside its own installed build, which an
|
|
7
|
+
* update has already replaced with the new release's copy — and writes the
|
|
8
|
+
* launch configuration to the successor's stdin. The successor then starts the
|
|
9
|
+
* console exactly the way the packaged entry does, with one difference: it
|
|
10
|
+
* keeps trying to bind while the predecessor is still releasing the port.
|
|
11
|
+
*
|
|
12
|
+
* stdin carries one JSON object, `{ "args": ["--workspace", "...", ...],
|
|
13
|
+
* "cwd": "<the predecessor's working directory>" }`: the predecessor's own
|
|
14
|
+
* command-line arguments, and the directory to resolve them from. It is
|
|
15
|
+
* untrusted input and is validated field by field; anything else exits before
|
|
16
|
+
* a port is touched, so a malformed or absent configuration never leaves a
|
|
17
|
+
* stray process behind.
|
|
18
|
+
*
|
|
19
|
+
* The successor's first act is to LEAVE the build directory it was resolved
|
|
20
|
+
* from, for the predecessor's working directory — see
|
|
21
|
+
* `adoptWorkingDirectory`.
|
|
22
|
+
*
|
|
23
|
+
* cli-7 / PRI-892 precedent: importing this module (a test driving
|
|
24
|
+
* `parseSuccessorLaunchConfig`, for example) must NOT start a console or wait
|
|
25
|
+
* on stdin — reading standard input blocks until it ends. Only direct
|
|
26
|
+
* execution runs the successor.
|
|
27
|
+
*/
|
|
28
|
+
import * as fs from 'node:fs';
|
|
29
|
+
import * as os from 'node:os';
|
|
30
|
+
import * as path from 'node:path';
|
|
31
|
+
import { pathToFileURL } from 'node:url';
|
|
32
|
+
/** A console launch line is a handful of short flags; nothing legitimate is larger. */
|
|
33
|
+
const MAX_CONFIG_BYTES = 16 * 1024;
|
|
34
|
+
const MAX_ARGS = 64;
|
|
35
|
+
const MAX_ARG_LENGTH = 4096;
|
|
36
|
+
export function parseSuccessorLaunchConfig(raw) {
|
|
37
|
+
if (raw.length > MAX_CONFIG_BYTES)
|
|
38
|
+
return null;
|
|
39
|
+
let value;
|
|
40
|
+
try {
|
|
41
|
+
value = JSON.parse(raw);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
47
|
+
return null;
|
|
48
|
+
const args = Object.hasOwn(value, 'args') ? Reflect.get(value, 'args') : undefined;
|
|
49
|
+
if (!Array.isArray(args) || args.length === 0 || args.length > MAX_ARGS)
|
|
50
|
+
return null;
|
|
51
|
+
const copied = [];
|
|
52
|
+
for (const argument of args) {
|
|
53
|
+
if (typeof argument !== 'string' || argument.length > MAX_ARG_LENGTH || argument.includes('\0'))
|
|
54
|
+
return null;
|
|
55
|
+
copied.push(argument);
|
|
56
|
+
}
|
|
57
|
+
const cwd = Object.hasOwn(value, 'cwd') ? Reflect.get(value, 'cwd') : undefined;
|
|
58
|
+
// Absolute only: a relative one would be resolved against the very directory
|
|
59
|
+
// this process is about to leave.
|
|
60
|
+
const usableCwd = typeof cwd === 'string' && cwd.length > 0 && cwd.length <= MAX_ARG_LENGTH
|
|
61
|
+
&& !cwd.includes('\0') && path.isAbsolute(cwd);
|
|
62
|
+
return { args: copied, ...(usableCwd ? { cwd } : {}) };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Moves this process's working directory to `cwd` — where the predecessor was
|
|
66
|
+
* launched from — before anything else is loaded from disk.
|
|
67
|
+
*
|
|
68
|
+
* The predecessor resolves this module relative to its build directory, so
|
|
69
|
+
* that is where this process starts out. It must not stay there: on Windows a
|
|
70
|
+
* process's working directory keeps its tree from being renamed or removed,
|
|
71
|
+
* and the next update begins by renaming the whole runtime directory away to
|
|
72
|
+
* back it up. A `cwd` that is gone (or was never given) falls back to the OS
|
|
73
|
+
* temp directory and then home: a console can run from any of those, while the
|
|
74
|
+
* build directory has to be released.
|
|
75
|
+
*/
|
|
76
|
+
export function adoptWorkingDirectory(cwd) {
|
|
77
|
+
let lastError;
|
|
78
|
+
for (const candidate of [cwd, os.tmpdir(), os.homedir()]) {
|
|
79
|
+
if (candidate === undefined || candidate === '')
|
|
80
|
+
continue;
|
|
81
|
+
try {
|
|
82
|
+
process.chdir(candidate);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
lastError = error;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
console.error(`[pd-console] Successor could not leave the build directory (${lastError instanceof Error ? lastError.message : String(lastError)}); `
|
|
90
|
+
+ 'the next update may not be able to back the runtime up.');
|
|
91
|
+
}
|
|
92
|
+
async function run() {
|
|
93
|
+
const config = parseSuccessorLaunchConfig(fs.readFileSync(0, 'utf8'));
|
|
94
|
+
if (config === null) {
|
|
95
|
+
console.error('[pd-console] Successor received no usable launch configuration; exiting.');
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
// Out of the build directory before the console — and everything it imports
|
|
99
|
+
// — is loaded: from here on this process works from where its launcher stood.
|
|
100
|
+
adoptWorkingDirectory(config.cwd);
|
|
101
|
+
// Configuration in hand: let go of the predecessor. An open IPC channel
|
|
102
|
+
// would tie this process's lifetime to the one it is meant to replace.
|
|
103
|
+
if (process.connected === true)
|
|
104
|
+
process.disconnect?.();
|
|
105
|
+
const { main } = await import('./index.js');
|
|
106
|
+
await main({
|
|
107
|
+
// `[node, <this module>]` is all the console reads from the first two slots.
|
|
108
|
+
argv: [...process.argv.slice(0, 2), ...config.args],
|
|
109
|
+
keepTryingToBind: true,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function isMainModuleEntry() {
|
|
113
|
+
const [, entry] = process.argv;
|
|
114
|
+
if (!entry)
|
|
115
|
+
return false;
|
|
116
|
+
try {
|
|
117
|
+
return pathToFileURL(fs.realpathSync(entry)).href === import.meta.url;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (isMainModuleEntry()) {
|
|
124
|
+
run().catch((error) => {
|
|
125
|
+
console.error('[pd-console] Successor failed to start:', error);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -775,6 +775,9 @@
|
|
|
775
775
|
.w-1\.5 {
|
|
776
776
|
width: calc(var(--spacing) * 1.5);
|
|
777
777
|
}
|
|
778
|
+
.w-1\/3 {
|
|
779
|
+
width: calc(1 / 3 * 100%);
|
|
780
|
+
}
|
|
778
781
|
.w-2 {
|
|
779
782
|
width: calc(var(--spacing) * 2);
|
|
780
783
|
}
|
|
@@ -1718,6 +1721,9 @@
|
|
|
1718
1721
|
.bg-card {
|
|
1719
1722
|
background-color: var(--color-card);
|
|
1720
1723
|
}
|
|
1724
|
+
.bg-current {
|
|
1725
|
+
background-color: currentcolor;
|
|
1726
|
+
}
|
|
1721
1727
|
.bg-danger {
|
|
1722
1728
|
background-color: var(--color-danger);
|
|
1723
1729
|
}
|
|
@@ -1787,6 +1793,12 @@
|
|
|
1787
1793
|
background-color: color-mix(in oklab, var(--color-gov) 10%, transparent);
|
|
1788
1794
|
}
|
|
1789
1795
|
}
|
|
1796
|
+
.bg-gov\/60 {
|
|
1797
|
+
background-color: color-mix(in srgb, #1e3a5f 60%, transparent);
|
|
1798
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1799
|
+
background-color: color-mix(in oklab, var(--color-gov) 60%, transparent);
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1790
1802
|
.bg-green {
|
|
1791
1803
|
background-color: var(--color-green);
|
|
1792
1804
|
}
|
|
@@ -2490,6 +2502,12 @@
|
|
|
2490
2502
|
.text-ink-4 {
|
|
2491
2503
|
color: var(--color-ink-4);
|
|
2492
2504
|
}
|
|
2505
|
+
.text-ink-4\/60 {
|
|
2506
|
+
color: color-mix(in srgb, #5F6774 60%, transparent);
|
|
2507
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2508
|
+
color: color-mix(in oklab, var(--color-ink-4) 60%, transparent);
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2493
2511
|
.text-ink-4\/80 {
|
|
2494
2512
|
color: color-mix(in srgb, #5F6774 80%, transparent);
|
|
2495
2513
|
@supports (color: color-mix(in lab, red, red)) {
|