create-principles-disciple 1.150.6 → 1.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/_release/product-identity.json +1 -1
- package/codex-adapter/dist/ingestion/codex-version.d.ts +14 -12
- package/codex-adapter/dist/ingestion/codex-version.js +19 -20
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/bind-guard.d.ts +6 -13
- package/console/dist/server/bind-guard.js +8 -17
- package/console/dist/server/index.d.ts +9 -3
- package/console/dist/server/index.js +55 -53
- package/console/dist/server/models/ActivationsConsoleModel.js +2 -1
- package/console/dist/server/models/OwnerDecisionConsoleModel.js +58 -19
- package/console/dist/server/routes/activations.js +2 -2
- package/console/dist/server/routes/diagnostician.js +1 -1
- package/console/dist/server/routes/evidence-outcomes.d.ts +3 -2
- package/console/dist/server/routes/evidence-outcomes.js +1 -1
- package/console/dist/server/routes/failed-tasks.js +1 -1
- package/console/dist/server/routes/governance.d.ts +9 -6
- package/console/dist/server/routes/governance.js +10 -6
- package/console/dist/server/routes/owner-decisions.d.ts +3 -3
- package/console/dist/server/routes/owner-decisions.js +1 -1
- package/console/dist/server/routes/owner-identity.d.ts +4 -5
- package/console/dist/server/routes/owner-identity.js +4 -4
- package/console/dist/server/routes/rule-candidate-bindings.js +1 -1
- package/console/dist/server/routes/update.js +24 -6
- package/console/dist/server/utils/request-guard.d.ts +35 -0
- package/console/dist/server/utils/request-guard.js +81 -0
- package/console/dist/server/utils/response.d.ts +0 -1
- package/console/dist/server/utils/response.js +0 -3
- package/console/dist/web/assets/app.css +95 -167
- package/console/dist/web/assets/app.js +32 -37
- package/core/dist/runtime/activation/activation-control-types.d.ts +3 -0
- package/core/dist/runtime/activation/activation-control-types.d.ts.map +1 -1
- package/core/dist/runtime/activation/rulecode-owner-decision-service.d.ts.map +1 -1
- package/core/dist/runtime/activation/rulecode-owner-decision-service.js +3 -2
- package/core/dist/runtime/activation/rulecode-owner-decision-service.js.map +1 -1
- package/core/dist/runtime/activation/sqlite-activation-safety-store.d.ts.map +1 -1
- package/core/dist/runtime/activation/sqlite-activation-safety-store.js +26 -13
- package/core/dist/runtime/activation/sqlite-activation-safety-store.js.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +22 -8
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/structured-output-repair.d.ts +17 -2
- package/core/dist/runtime/adapter/structured-output-repair.d.ts.map +1 -1
- package/core/dist/runtime/adapter/structured-output-repair.js +26 -5
- package/core/dist/runtime/adapter/structured-output-repair.js.map +1 -1
- package/core/dist/runtime/governance-experience-contract.d.ts +12 -12
- package/core/dist/runtime/governance-experience-contract.d.ts.map +1 -1
- package/core/dist/runtime/governance-experience-contract.js +0 -2
- package/core/dist/runtime/governance-experience-contract.js.map +1 -1
- package/core/dist/runtime/governance-experience.d.ts.map +1 -1
- package/core/dist/runtime/governance-experience.js +8 -16
- package/core/dist/runtime/governance-experience.js.map +1 -1
- package/core/dist/runtime/internalization/approved-rule-revision.d.ts.map +1 -1
- package/core/dist/runtime/internalization/approved-rule-revision.js +2 -1
- package/core/dist/runtime/internalization/approved-rule-revision.js.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime/recovery-sweep-service.d.ts +7 -0
- package/core/dist/runtime/recovery-sweep-service.d.ts.map +1 -1
- package/core/dist/runtime/recovery-sweep-service.js +1 -0
- package/core/dist/runtime/recovery-sweep-service.js.map +1 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts +59 -0
- package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts.map +1 -0
- package/core/dist/runtime/store/context/promoted-evidence-reader.js +201 -0
- package/core/dist/runtime/store/context/promoted-evidence-reader.js.map +1 -0
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.js +43 -2
- package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.js +96 -37
- package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/installer.d.ts +14 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +36 -77
- package/dist/installer.js.map +1 -1
- package/dist/mvp-config.js +1 -1
- package/dist/mvp-config.js.map +1 -1
- package/dist/update/data-compatibility.d.ts.map +1 -1
- package/dist/update/data-compatibility.js +3 -1
- package/dist/update/data-compatibility.js.map +1 -1
- package/dist/update/release-manager.d.ts +5 -0
- package/dist/update/release-manager.d.ts.map +1 -1
- package/dist/update/release-manager.js +11 -1
- package/dist/update/release-manager.js.map +1 -1
- package/host-runtime/dist/adaptive-decision-protocol.d.ts +36 -8
- package/host-runtime/dist/adaptive-decision-protocol.js +79 -20
- package/host-runtime/dist/adaptive-selection.js +6 -1
- package/host-runtime/dist/cli-recovery-probe.d.ts +42 -1
- package/host-runtime/dist/cli-recovery-probe.js +16 -3
- package/host-runtime/dist/conversation-ingestion/pipeline.d.ts +0 -29
- package/host-runtime/dist/conversation-ingestion/pipeline.js +39 -2
- package/host-runtime/package.json +1 -1
- package/package.json +2 -2
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +117 -3
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/console.d.ts +0 -4
- package/pd-cli/dist/commands/console.d.ts.map +1 -1
- package/pd-cli/dist/commands/console.js +4 -67
- package/pd-cli/dist/commands/console.js.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.js +4 -8
- package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
- package/pd-cli/dist/commands/runtime-recovery-failed-tasks.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-recovery-failed-tasks.js +114 -63
- package/pd-cli/dist/commands/runtime-recovery-failed-tasks.js.map +1 -1
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +0 -8
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/console-launcher.d.ts +1 -18
- package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
- package/pd-cli/dist/services/console-launcher.js +4 -92
- package/pd-cli/dist/services/console-launcher.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +440 -423
- 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 +36 -77
- package/release-manager/dist/mvp-config.js +1 -1
- package/release-manager/dist/update/release-manager.js +11 -1
- package/release-manager/package.json +1 -1
- package/workbuddy-adapter/package.json +1 -1
- package/console/dist/server/config/AuthConfig.d.ts +0 -14
- package/console/dist/server/config/AuthConfig.js +0 -42
package/README.md
CHANGED
|
@@ -84,18 +84,18 @@ The installer delivers a local pd-console web UI for principle review.
|
|
|
84
84
|
### Starting the Console
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
pd console --workspace "/path/to/workspace"
|
|
87
|
+
pd console --workspace "/path/to/workspace"
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
The console listens on **127.0.0.1 only** (loopback) — it is not accessible from other machines on the network.
|
|
90
|
+
The console listens on **127.0.0.1 only** (loopback) — it is not accessible from other machines on the network. Non-loopback `--host` values are refused; there is no flag to override this.
|
|
91
91
|
|
|
92
92
|
Open `http://127.0.0.1:3100` in your browser to access the console.
|
|
93
93
|
|
|
94
94
|
### Console Security
|
|
95
95
|
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
96
|
+
- Binding is unconditionally loopback; a non-loopback `--host` refuses to start
|
|
97
|
+
- There is no token or password: opening the console is equivalent to using the current local OS session
|
|
98
|
+
- Cross-site requests are rejected via the `Host` / `Origin` / `Sec-Fetch-Site` allow-list; HTML responses are sent with `X-Frame-Options: DENY`
|
|
99
99
|
|
|
100
100
|
## Rerun / Reinstall
|
|
101
101
|
|
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
* Slice A; ADR-0020 §11.2 + G1 probe report §9).
|
|
4
4
|
*
|
|
5
5
|
* The G1 contract baseline is: minimum supported Codex 0.148.0, verified
|
|
6
|
-
* on-device at 0.150.1
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* transcripts/v0.
|
|
12
|
-
* `session_meta.payload.cli_version`, which is
|
|
13
|
-
* inside a hook subprocess (hook payloads carry
|
|
14
|
-
* fixture contract).
|
|
6
|
+
* on-device at 0.150.1, re-verified at 0.162.1 (PRI-953, 2026-10-13), and
|
|
7
|
+
* re-verified again at 0.167.0-alpha.4.1 (2026-11-13): the installed adapter
|
|
8
|
+
* decoded a real 4.4 MB rollout transcript (48 observations, including
|
|
9
|
+
* assistant turns) and a real Stop payload from that device, and the
|
|
10
|
+
* sanitized capture is pinned as
|
|
11
|
+
* tests/fixtures/g1-contract/transcripts/v0.167.0-alpha.4.1-tool-final-turn.jsonl.
|
|
12
|
+
* The transcript itself carries `session_meta.payload.cli_version`, which is
|
|
13
|
+
* the version signal available inside a hook subprocess (hook payloads carry
|
|
14
|
+
* no version field — G1 fixture contract).
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Version comparison is on the core `MAJOR.MINOR.PATCH` triplet only:
|
|
17
|
+
* prerelease/build suffixes describe a distribution channel, not a different
|
|
18
|
+
* record contract, and the contract itself is pinned by the fixture probe.
|
|
19
|
+
* An unknown or malformed version must never silently guess record fields.
|
|
18
20
|
* Adopting a newer Codex version requires re-running the contract probe and
|
|
19
21
|
* refreshing the fixtures (G1 report §9 drift-detection boundary).
|
|
20
22
|
*/
|
|
21
23
|
export declare const CODEX_INGESTION_MIN_VERSION = "0.148.0";
|
|
22
|
-
export declare const CODEX_INGESTION_VERIFIED_VERSION = "0.
|
|
24
|
+
export declare const CODEX_INGESTION_VERIFIED_VERSION = "0.167.0";
|
|
23
25
|
export type CodexVersionClassification = {
|
|
24
26
|
status: 'supported';
|
|
25
27
|
} | {
|
|
@@ -3,36 +3,35 @@
|
|
|
3
3
|
* Slice A; ADR-0020 §11.2 + G1 probe report §9).
|
|
4
4
|
*
|
|
5
5
|
* The G1 contract baseline is: minimum supported Codex 0.148.0, verified
|
|
6
|
-
* on-device at 0.150.1
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* transcripts/v0.
|
|
12
|
-
* `session_meta.payload.cli_version`, which is
|
|
13
|
-
* inside a hook subprocess (hook payloads carry
|
|
14
|
-
* fixture contract).
|
|
6
|
+
* on-device at 0.150.1, re-verified at 0.162.1 (PRI-953, 2026-10-13), and
|
|
7
|
+
* re-verified again at 0.167.0-alpha.4.1 (2026-11-13): the installed adapter
|
|
8
|
+
* decoded a real 4.4 MB rollout transcript (48 observations, including
|
|
9
|
+
* assistant turns) and a real Stop payload from that device, and the
|
|
10
|
+
* sanitized capture is pinned as
|
|
11
|
+
* tests/fixtures/g1-contract/transcripts/v0.167.0-alpha.4.1-tool-final-turn.jsonl.
|
|
12
|
+
* The transcript itself carries `session_meta.payload.cli_version`, which is
|
|
13
|
+
* the version signal available inside a hook subprocess (hook payloads carry
|
|
14
|
+
* no version field — G1 fixture contract).
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Version comparison is on the core `MAJOR.MINOR.PATCH` triplet only:
|
|
17
|
+
* prerelease/build suffixes describe a distribution channel, not a different
|
|
18
|
+
* record contract, and the contract itself is pinned by the fixture probe.
|
|
19
|
+
* An unknown or malformed version must never silently guess record fields.
|
|
18
20
|
* Adopting a newer Codex version requires re-running the contract probe and
|
|
19
21
|
* refreshing the fixtures (G1 report §9 drift-detection boundary).
|
|
20
22
|
*/
|
|
21
23
|
export const CODEX_INGESTION_MIN_VERSION = '0.148.0';
|
|
22
|
-
export const CODEX_INGESTION_VERIFIED_VERSION = '0.
|
|
24
|
+
export const CODEX_INGESTION_VERIFIED_VERSION = '0.167.0';
|
|
23
25
|
export const CODEX_VERSION_NEXT_ACTION = 'rerun the Codex contract probe / update supported fixtures (docs/architecture/CODEX_G1_CONTRACT_PROBE_REPORT.md §9)';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
26
|
+
/** `1.2.3`, optional `-prerelease` / `+build`; anything else is not a version signal we trust. */
|
|
27
|
+
const SEMVER_PATTERN = /^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
27
28
|
function parseSemver(value) {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
29
|
+
const match = SEMVER_PATTERN.exec(value.trim());
|
|
30
|
+
if (match === null)
|
|
30
31
|
return null;
|
|
31
|
-
const [major, minor, patch] =
|
|
32
|
+
const [, major, minor, patch] = match;
|
|
32
33
|
if (major === undefined || minor === undefined || patch === undefined)
|
|
33
34
|
return null;
|
|
34
|
-
if (!isDigits(major) || !isDigits(minor) || !isDigits(patch))
|
|
35
|
-
return null;
|
|
36
35
|
return { major: Number(major), minor: Number(minor), patch: Number(patch) };
|
|
37
36
|
}
|
|
38
37
|
function compareSemver(a, b) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/codex-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Codex CLI host adapter for Principles Disciple — implements HostAdapter interface for OpenAI Codex CLI's stdin/stdout JSON hook model (ADR-0020).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bind
|
|
2
|
+
* Bind guard for the console HTTP server.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* direct server launch (e.g. `node dist/server.js --host 0.0.0.0` with no
|
|
9
|
-
* token) would bind a LAN-reachable interface with every `/api/*` route
|
|
10
|
-
* callable by unauthenticated peers.
|
|
11
|
-
*
|
|
12
|
-
* The invariant this enforces: authentication disabled ⇒ loopback-only bind.
|
|
13
|
-
* It keys on the effective authentication state (AuthConfig), not on which
|
|
14
|
-
* flag produced that state, so both unauthenticated modes are covered.
|
|
4
|
+
* The console has no application-level credential: the operating-system
|
|
5
|
+
* session is the trust boundary. That is only true while the listener is
|
|
6
|
+
* reachable from the local machine alone, so a non-loopback `--host` is
|
|
7
|
+
* refused unconditionally (it used to depend on the authentication mode).
|
|
15
8
|
*/
|
|
16
|
-
export declare function
|
|
9
|
+
export declare function assertLoopbackBind(host: string): void;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bind
|
|
2
|
+
* Bind guard for the console HTTP server.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* direct server launch (e.g. `node dist/server.js --host 0.0.0.0` with no
|
|
9
|
-
* token) would bind a LAN-reachable interface with every `/api/*` route
|
|
10
|
-
* callable by unauthenticated peers.
|
|
11
|
-
*
|
|
12
|
-
* The invariant this enforces: authentication disabled ⇒ loopback-only bind.
|
|
13
|
-
* It keys on the effective authentication state (AuthConfig), not on which
|
|
14
|
-
* flag produced that state, so both unauthenticated modes are covered.
|
|
4
|
+
* The console has no application-level credential: the operating-system
|
|
5
|
+
* session is the trust boundary. That is only true while the listener is
|
|
6
|
+
* reachable from the local machine alone, so a non-loopback `--host` is
|
|
7
|
+
* refused unconditionally (it used to depend on the authentication mode).
|
|
15
8
|
*/
|
|
16
9
|
const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '::1']);
|
|
17
|
-
export function
|
|
18
|
-
if (isAuthEnabled)
|
|
19
|
-
return;
|
|
10
|
+
export function assertLoopbackBind(host) {
|
|
20
11
|
const normalized = String(host ?? '').toLowerCase().replace(/^\[(.+)\]$/, '$1');
|
|
21
12
|
if (LOOPBACK_HOSTS.has(normalized))
|
|
22
13
|
return;
|
|
23
|
-
console.error('[pd-console] Refusing to bind non-loopback host "' + String(host) + '"
|
|
24
|
-
'
|
|
14
|
+
console.error('[pd-console] Refusing to bind non-loopback host "' + String(host) + '". ' +
|
|
15
|
+
'The Console has no application-level authentication and relies on local OS access; use the default loopback host (127.0.0.1).');
|
|
25
16
|
process.exit(1);
|
|
26
17
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as http from 'http';
|
|
2
2
|
import { type FeedbackChannelConfig } from './config/pd-config-store.js';
|
|
3
|
-
import { AuthConfig } from './config/AuthConfig.js';
|
|
4
3
|
import { WorkspaceConfigStore } from './config/WorkspaceConfigStore.js';
|
|
5
4
|
import { WorkspaceService } from './models/WorkspaceService.js';
|
|
5
|
+
/**
|
|
6
|
+
* The Console has no application-level credential any more. Old launchers,
|
|
7
|
+
* shell profiles and scripts may still pass `--token` / `--no-auth`; they are
|
|
8
|
+
* ignored (unknown args never failed parsing) but the operator gets one line
|
|
9
|
+
* explaining why their secret no longer does anything.
|
|
10
|
+
*/
|
|
11
|
+
export declare function warnAboutLegacyAuthArgs(argv: string[]): void;
|
|
12
|
+
export declare const REQUEST_TIMEOUT_MS = 10000;
|
|
6
13
|
interface AppServices {
|
|
7
14
|
workspaceDir: string;
|
|
8
|
-
authConfig: AuthConfig;
|
|
9
15
|
configStore: WorkspaceConfigStore;
|
|
10
16
|
workspaceService: WorkspaceService;
|
|
11
17
|
feedbackFlags: Record<string, {
|
|
@@ -14,7 +20,7 @@ interface AppServices {
|
|
|
14
20
|
maintainerEmail: string;
|
|
15
21
|
feedbackChannelConfig: FeedbackChannelConfig;
|
|
16
22
|
}
|
|
17
|
-
export declare function initServices(workspaceDir: string
|
|
23
|
+
export declare function initServices(workspaceDir: string): Promise<AppServices>;
|
|
18
24
|
export declare function closeServices(): Promise<void>;
|
|
19
25
|
export declare function handleRequest(services: AppServices): (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
|
20
26
|
export declare function main(): Promise<void>;
|
|
@@ -5,9 +5,9 @@ import { fileURLToPath, pathToFileURL } from 'url';
|
|
|
5
5
|
import { resolveApplyFullTimeoutMs, resolveCheckTimeoutMs } from './update-timeout.js';
|
|
6
6
|
import { loadPdConfig, computeFlagsFromLoadResult, getFeedbackMaintainerEmail, getFeedbackChannelConfig, } from './config/pd-config-store.js';
|
|
7
7
|
import { resolveOwnerIdentity, defaultOwnerIdentityHomeDir } from '@principles/core/runtime';
|
|
8
|
-
import { createProductTelemetryService, scheduleProductTelemetryExport } from '@principles/host-runtime';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { createProductTelemetryService, scheduleProductTelemetryExport, CONSOLE_REQUEST_BUDGET_MS } from '@principles/host-runtime';
|
|
9
|
+
import { assertLoopbackBind } from './bind-guard.js';
|
|
10
|
+
import { guardConsoleApiRequest } from './utils/request-guard.js';
|
|
11
11
|
import { WorkspaceConfigStore } from './config/WorkspaceConfigStore.js';
|
|
12
12
|
import { getPdHome, PdHomeConfigurationError } from './utils/pd-home.js';
|
|
13
13
|
import { EXPERIMENT_CONSOLE_PORT, defaultConsolePort } from './console-ports.js';
|
|
@@ -40,7 +40,7 @@ import { handleUpdateRoute } from './routes/update.js';
|
|
|
40
40
|
import { handleUpdateHistoryRoute, reconcileUpdateHistoryFromJournals } from './routes/update-history.js';
|
|
41
41
|
import { handleUpdateTransactionRoute } from './routes/update-transaction.js';
|
|
42
42
|
import { handleConfigRoute } from './routes/config.js';
|
|
43
|
-
import { sendJson, sendNotFound,
|
|
43
|
+
import { sendJson, sendNotFound, sendError } from './utils/response.js';
|
|
44
44
|
import { migrateLegacyExtensionBackups, resolvePdBackupsRoot } from './utils/pd-backups.js';
|
|
45
45
|
const __filename = fileURLToPath(import.meta.url);
|
|
46
46
|
const __dirname = path.dirname(__filename);
|
|
@@ -104,8 +104,6 @@ function parseArgs(argv, mode = 'production') {
|
|
|
104
104
|
// 13100 so a bare dev start cannot grab the production port. --port wins.
|
|
105
105
|
let port = defaultConsolePort(mode);
|
|
106
106
|
let host = '127.0.0.1';
|
|
107
|
-
let noAuth = false;
|
|
108
|
-
let token = undefined;
|
|
109
107
|
for (let i = 0; i < args.length; i++) {
|
|
110
108
|
if (args[i] === '--port' && i + 1 < args.length) {
|
|
111
109
|
const portStr = args[i + 1];
|
|
@@ -126,22 +124,26 @@ function parseArgs(argv, mode = 'production') {
|
|
|
126
124
|
i++;
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
|
-
else if (args[i] === '--no-auth') {
|
|
130
|
-
noAuth = true;
|
|
131
|
-
}
|
|
132
|
-
else if (args[i] === '--token' && i + 1 < args.length) {
|
|
133
|
-
const next = args[i + 1];
|
|
134
|
-
if (next !== undefined) {
|
|
135
|
-
token = next;
|
|
136
|
-
i++;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
127
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
return { workspace, port, host };
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The Console has no application-level credential any more. Old launchers,
|
|
132
|
+
* shell profiles and scripts may still pass `--token` / `--no-auth`; they are
|
|
133
|
+
* ignored (unknown args never failed parsing) but the operator gets one line
|
|
134
|
+
* explaining why their secret no longer does anything.
|
|
135
|
+
*/
|
|
136
|
+
export function warnAboutLegacyAuthArgs(argv) {
|
|
137
|
+
const args = argv.slice(2);
|
|
138
|
+
if (args.includes('--token')) {
|
|
139
|
+
console.warn('[pd-console] --token is no longer used: the Console has no token authentication. The value is ignored.');
|
|
140
|
+
}
|
|
141
|
+
if (args.includes('--no-auth')) {
|
|
142
|
+
console.warn('[pd-console] --no-auth is no longer needed: the Console never requires authentication. The flag is ignored.');
|
|
143
|
+
}
|
|
144
|
+
if (process.env.PD_CONSOLE_TOKEN && process.env.PD_CONSOLE_TOKEN.length > 0) {
|
|
145
|
+
console.warn('[pd-console] PD_CONSOLE_TOKEN is no longer used: the Console has no token authentication. The value is ignored.');
|
|
143
146
|
}
|
|
144
|
-
return { workspace, port, host, noAuth, token };
|
|
145
147
|
}
|
|
146
148
|
// ── MIME type helpers ──────────────────────────────────────────────────────────────────────
|
|
147
149
|
const MIME_MAP = {
|
|
@@ -181,6 +183,10 @@ function serveFile(res, filePath) {
|
|
|
181
183
|
res.writeHead(200, {
|
|
182
184
|
'Content-Type': contentType,
|
|
183
185
|
'Content-Length': data.length,
|
|
186
|
+
// The Console is fully usable without a login now, so a hostile page
|
|
187
|
+
// must not be able to frame it and harvest clicks.
|
|
188
|
+
'X-Frame-Options': 'DENY',
|
|
189
|
+
'X-Content-Type-Options': 'nosniff',
|
|
184
190
|
});
|
|
185
191
|
res.end(data);
|
|
186
192
|
return true;
|
|
@@ -190,7 +196,10 @@ function serveFile(res, filePath) {
|
|
|
190
196
|
}
|
|
191
197
|
}
|
|
192
198
|
// ── Async handler wrapper ──────────────────────────────────────────────────────────────
|
|
193
|
-
|
|
199
|
+
// PRI-1202: this is the single budget authority. host-runtime derives the CLI
|
|
200
|
+
// recovery probe budget from the same constant (strictly smaller), so a probe
|
|
201
|
+
// can never outlive the request that awaits it.
|
|
202
|
+
export const REQUEST_TIMEOUT_MS = CONSOLE_REQUEST_BUDGET_MS;
|
|
194
203
|
const UPDATE_APPLY_TIMEOUT_MS = 120000;
|
|
195
204
|
// Full update downloads a tarball + copies files — allow 3 min for slow networks.
|
|
196
205
|
// PD_UPDATE_APPLY_FULL_TIMEOUT_MS (ms) overrides it for slow-disk machines:
|
|
@@ -239,7 +248,7 @@ function asyncHandler(fn, timeoutMs = REQUEST_TIMEOUT_MS) {
|
|
|
239
248
|
});
|
|
240
249
|
};
|
|
241
250
|
}
|
|
242
|
-
export async function initServices(workspaceDir
|
|
251
|
+
export async function initServices(workspaceDir) {
|
|
243
252
|
const configStore = new WorkspaceConfigStore();
|
|
244
253
|
const workspaceService = new WorkspaceService(configStore);
|
|
245
254
|
// Load feature flags from canonical .pd/config.yaml — fail-closed: on error, feedback_channel uses defaults
|
|
@@ -289,7 +298,6 @@ export async function initServices(workspaceDir, authConfig) {
|
|
|
289
298
|
const feedbackChannelConfig = getFeedbackChannelConfig(workspaceDir);
|
|
290
299
|
return {
|
|
291
300
|
workspaceDir,
|
|
292
|
-
authConfig,
|
|
293
301
|
configStore,
|
|
294
302
|
workspaceService,
|
|
295
303
|
feedbackFlags,
|
|
@@ -339,10 +347,13 @@ export function handleRequest(services) {
|
|
|
339
347
|
}
|
|
340
348
|
return;
|
|
341
349
|
}
|
|
342
|
-
//
|
|
350
|
+
// Origin/Host guard for all /api/* routes. The console has no credential;
|
|
351
|
+
// this is what keeps other browser origins (and DNS rebinding) out while
|
|
352
|
+
// letting local non-browser clients through.
|
|
343
353
|
if (urlPath.startsWith('/api/')) {
|
|
344
|
-
|
|
345
|
-
|
|
354
|
+
const rejection = guardConsoleApiRequest(req);
|
|
355
|
+
if (rejection !== null) {
|
|
356
|
+
sendError(res, rejection.status, rejection.error, rejection.message, { nextAction: rejection.nextAction });
|
|
346
357
|
return;
|
|
347
358
|
}
|
|
348
359
|
// ── API routes ──────────────────────────────────────────────────
|
|
@@ -496,8 +507,10 @@ export function handleRequest(services) {
|
|
|
496
507
|
const subPath = routePath.slice('/api/activations'.length);
|
|
497
508
|
// ADR-0022 (PRI-578): single resolver — env > ~/.pd/owner.json > none
|
|
498
509
|
const identity = resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir());
|
|
499
|
-
|
|
500
|
-
|
|
510
|
+
// The OS session is the credential now: a registered Owner identity is
|
|
511
|
+
// enough to act as the configured Owner from the local Console.
|
|
512
|
+
const ownerActor = identity.ownerId && identity.credentialId
|
|
513
|
+
? { principal: { kind: 'configured_owner', ownerId: identity.ownerId }, authentication: { method: 'local_owner_session', credentialId: identity.credentialId } }
|
|
501
514
|
: null;
|
|
502
515
|
asyncHandler(() => handleActivationsRoute(req, res, services.workspaceDir, subPath, {
|
|
503
516
|
ownerActor,
|
|
@@ -508,7 +521,7 @@ export function handleRequest(services) {
|
|
|
508
521
|
// ADR-0022 (PRI-578): /api/owner-identity — GET status, POST register, DELETE unregister
|
|
509
522
|
if (routePath === '/api/owner-identity' || routePath.startsWith('/api/owner-identity/')) {
|
|
510
523
|
const subPath = routePath.slice('/api/owner-identity'.length);
|
|
511
|
-
asyncHandler(() => handleOwnerIdentityRoute(req, res, defaultOwnerIdentityHomeDir(), subPath
|
|
524
|
+
asyncHandler(() => handleOwnerIdentityRoute(req, res, defaultOwnerIdentityHomeDir(), subPath))(req, res);
|
|
512
525
|
return;
|
|
513
526
|
}
|
|
514
527
|
// PRI-585: GET /api/governance/experience (flag-gated read-only snapshot)
|
|
@@ -516,7 +529,7 @@ export function handleRequest(services) {
|
|
|
516
529
|
asyncHandler(() => handleGovernanceExperienceRoute(req, res, {
|
|
517
530
|
workspaceDir: services.workspaceDir,
|
|
518
531
|
featureFlags: services.feedbackFlags,
|
|
519
|
-
ownerConfig: resolveOwnerConfigSnapshot(
|
|
532
|
+
ownerConfig: resolveOwnerConfigSnapshot(resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir())),
|
|
520
533
|
}))(req, res);
|
|
521
534
|
return;
|
|
522
535
|
}
|
|
@@ -530,7 +543,7 @@ export function handleRequest(services) {
|
|
|
530
543
|
asyncHandler(() => handleRuleCandidateBindingsRoute(req, res, {
|
|
531
544
|
workspaceDir: services.workspaceDir,
|
|
532
545
|
subPath: routePath.slice('/api/governance/rule-candidate-bindings'.length),
|
|
533
|
-
ownerIdentity:
|
|
546
|
+
ownerIdentity: ownerId !== null && credentialId !== null
|
|
534
547
|
? { ownerId, credentialId } : null,
|
|
535
548
|
}))(req, res);
|
|
536
549
|
return;
|
|
@@ -542,8 +555,7 @@ export function handleRequest(services) {
|
|
|
542
555
|
const subPath = routePath.slice('/api/governance/owner-decisions'.length);
|
|
543
556
|
const odIdentity = resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir());
|
|
544
557
|
const { ownerId, credentialId } = odIdentity;
|
|
545
|
-
const authEnabledForOwner =
|
|
546
|
-
&& ownerId !== null && credentialId !== null;
|
|
558
|
+
const authEnabledForOwner = ownerId !== null && credentialId !== null;
|
|
547
559
|
asyncHandler(() => handleOwnerDecisionsRoute(req, res, {
|
|
548
560
|
workspaceDir: services.workspaceDir,
|
|
549
561
|
subPath,
|
|
@@ -559,7 +571,7 @@ export function handleRequest(services) {
|
|
|
559
571
|
asyncHandler(() => handleDesignGateRoute(req, res, {
|
|
560
572
|
workspaceDir: services.workspaceDir,
|
|
561
573
|
subPath: routePath.slice('/api/governance/design-gate'.length),
|
|
562
|
-
ownerIdentity:
|
|
574
|
+
ownerIdentity: ownerId !== null && credentialId !== null
|
|
563
575
|
? { ownerId, credentialId } : null,
|
|
564
576
|
}))(req, res);
|
|
565
577
|
return;
|
|
@@ -596,8 +608,7 @@ export function handleRequest(services) {
|
|
|
596
608
|
if (routePath === '/api/evidence/outcomes') {
|
|
597
609
|
const eoIdentity = resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir());
|
|
598
610
|
const { ownerId, credentialId } = eoIdentity;
|
|
599
|
-
const authEnabledForOwner =
|
|
600
|
-
&& ownerId !== null && credentialId !== null;
|
|
611
|
+
const authEnabledForOwner = ownerId !== null && credentialId !== null;
|
|
601
612
|
asyncHandler(() => handleEvidenceOutcomesRoute(req, res, {
|
|
602
613
|
workspaceDir: services.workspaceDir,
|
|
603
614
|
ownerIdentity: authEnabledForOwner
|
|
@@ -610,7 +621,7 @@ export function handleRequest(services) {
|
|
|
610
621
|
if (routePath === '/api/health') {
|
|
611
622
|
asyncHandler(() => handleHealthRoute(req, res, {
|
|
612
623
|
workspaceDir: services.workspaceDir,
|
|
613
|
-
authenticationMode:
|
|
624
|
+
authenticationMode: 'no_auth',
|
|
614
625
|
}))(req, res);
|
|
615
626
|
return;
|
|
616
627
|
}
|
|
@@ -655,7 +666,8 @@ export async function main() {
|
|
|
655
666
|
}
|
|
656
667
|
throw error;
|
|
657
668
|
}
|
|
658
|
-
const { workspace, port, host
|
|
669
|
+
const { workspace, port, host } = parseArgs(process.argv, pdHome.mode);
|
|
670
|
+
warnAboutLegacyAuthArgs(process.argv);
|
|
659
671
|
if (pdHome.mode === 'experiment') {
|
|
660
672
|
console.log(`[pd-console] Environment: experiment (PD_EXPERIMENT_ROOT=${pdHome.experimentRoot ?? ''})`);
|
|
661
673
|
console.log(`[pd-console] PD home: ${pdHome.pdHome}`);
|
|
@@ -665,20 +677,10 @@ export async function main() {
|
|
|
665
677
|
else {
|
|
666
678
|
console.log(`[pd-console] Environment: production (PD home: ${pdHome.pdHome})`);
|
|
667
679
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
});
|
|
673
|
-
if (!authConfig.isEnabled() && !noAuth) {
|
|
674
|
-
console.warn('[pd-console] No auth token configured. Running without authentication. Use --token or PD_CONSOLE_TOKEN to enable.');
|
|
675
|
-
}
|
|
676
|
-
// Authentication disabled (explicit --no-auth or the token-less default)
|
|
677
|
-
// must never bind a non-loopback interface: every /api/* route would be
|
|
678
|
-
// reachable by unauthenticated network peers. parseArgs already restricts
|
|
679
|
-
// the explicit --no-auth flag; this is the effective-auth-state guard.
|
|
680
|
-
assertLoopbackBindForUnauthenticatedServer(authConfig.isEnabled(), host);
|
|
681
|
-
const services = await initServices(workspace, authConfig);
|
|
680
|
+
// The OS session is the trust boundary: the Console never has an
|
|
681
|
+
// application-level credential, so it must never be reachable off-machine.
|
|
682
|
+
assertLoopbackBind(host);
|
|
683
|
+
const services = await initServices(workspace);
|
|
682
684
|
// One-time hygiene: move legacy PD backups out of ~/.openclaw/extensions so
|
|
683
685
|
// OpenClaw plugin discovery stops reporting a duplicate principles-disciple
|
|
684
686
|
// plugin on every gateway startup. Best-effort, never blocks startup.
|
|
@@ -727,7 +729,7 @@ export async function main() {
|
|
|
727
729
|
server.listen(port, host, () => {
|
|
728
730
|
console.log('[pd-console] Listening on http://' + host + ':' + port);
|
|
729
731
|
console.log('[pd-console] Workspace: ' + workspace);
|
|
730
|
-
console.log('[pd-console] Auth:
|
|
732
|
+
console.log('[pd-console] Auth: none (local OS session)');
|
|
731
733
|
});
|
|
732
734
|
}
|
|
733
735
|
// cli-7 / PRI-892 precedent: importing this module (a test driving
|
|
@@ -706,7 +706,8 @@ export class ActivationsConsoleModel {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
async promoteRuleCode(activationId, expected, input) {
|
|
709
|
-
const review = await this.getOwnerReview(activationId, input.actor.principal.kind === 'configured_owner'
|
|
709
|
+
const review = await this.getOwnerReview(activationId, input.actor.principal.kind === 'configured_owner'
|
|
710
|
+
&& (input.actor.authentication.method === 'console_token' || input.actor.authentication.method === 'local_owner_session'), { ownerActor: input.actor, routeContext: input.routeContext });
|
|
710
711
|
const flags = computeFlagsFromLoadResult(loadPdConfig(this.workspaceDir));
|
|
711
712
|
const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: false });
|
|
712
713
|
try {
|
|
@@ -20,6 +20,32 @@ const MAX_READ_ISSUE_DETAIL_CHARS = 200;
|
|
|
20
20
|
function describeError(error) {
|
|
21
21
|
return error instanceof Error ? error.message : String(error);
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* PRI-1058: per-activation owner-review reads are independent (each opens its
|
|
25
|
+
* own read-only connection and runs its own CLI probes), but the inbox listed
|
|
26
|
+
* them one at a time. Wall time therefore grew as `N × probes` against the
|
|
27
|
+
* console's fixed request budget, so a loaded machine answered the list with a
|
|
28
|
+
* 504. This bound only changes WHEN the reads happen — `worker` results are
|
|
29
|
+
* consumed in the original row order, so every projection fact (item order,
|
|
30
|
+
* read-issue counts/samples/first detail) stays identical to the serial walk.
|
|
31
|
+
* The bound is finite because each review spawns two real pd CLI subprocesses.
|
|
32
|
+
*/
|
|
33
|
+
const OWNER_REVIEW_CONCURRENCY = 4;
|
|
34
|
+
async function mapWithConcurrency(values, limit, worker) {
|
|
35
|
+
const results = new Array(values.length);
|
|
36
|
+
let nextIndex = 0;
|
|
37
|
+
const runnerCount = Math.max(1, Math.min(limit, values.length));
|
|
38
|
+
await Promise.all(Array.from({ length: runnerCount }, async () => {
|
|
39
|
+
for (;;) {
|
|
40
|
+
const index = nextIndex;
|
|
41
|
+
nextIndex += 1;
|
|
42
|
+
if (index >= values.length)
|
|
43
|
+
return;
|
|
44
|
+
results[index] = await worker(values[index]);
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
return results;
|
|
48
|
+
}
|
|
23
49
|
const GOVERNANCE_TASK_KINDS = new Set(['evaluator', 'rollout_reviewer']);
|
|
24
50
|
/** tasks.status 合法值(PDTaskStatus)运行时守卫。 */
|
|
25
51
|
const TASK_STATUSES = new Set(['pending', 'leased', 'succeeded', 'retry_wait', 'failed', 'needs_human_review']);
|
|
@@ -289,7 +315,12 @@ export class OwnerDecisionConsoleModel {
|
|
|
289
315
|
WHERE action = 'code_tool_hook_shadow_activate'
|
|
290
316
|
AND promoted_at IS NULL AND deactivated_at IS NULL`).all().filter(isRecordRow);
|
|
291
317
|
const activationModel = new ActivationsConsoleModel(this.workspaceDir);
|
|
292
|
-
|
|
318
|
+
// PRI-1058: read every shadow activation with bounded concurrency, then
|
|
319
|
+
// fold the outcomes in the original row order. The read is unchanged
|
|
320
|
+
// (same connection scope, same probes, same readiness predicate); only
|
|
321
|
+
// the interleaving changes, so items / readIssues stay identical to the
|
|
322
|
+
// previous serial walk.
|
|
323
|
+
const outcomes = await mapWithConcurrency(shadowRows, OWNER_REVIEW_CONCURRENCY, async (row) => {
|
|
293
324
|
const artifactId = typeof row.artifact_id === 'string' ? row.artifact_id : '';
|
|
294
325
|
const activationId = typeof row.activation_id === 'string' ? row.activation_id : '';
|
|
295
326
|
try {
|
|
@@ -300,29 +331,37 @@ export class OwnerDecisionConsoleModel {
|
|
|
300
331
|
const review = await activationModel.getOwnerReview(activationId, true, { routeContext });
|
|
301
332
|
if (review.readiness.status !== 'ready' && review.readiness.status !== 'evidence_insufficient') {
|
|
302
333
|
// 非待决:不进收件箱,但必须留下计数与原因(否则该 activation 永久不可见)。
|
|
303
|
-
|
|
304
|
-
continue;
|
|
334
|
+
return { kind: 'skip', reason: 'readiness_not_actionable', activationId, detail: `readiness=${review.readiness.status}` };
|
|
305
335
|
}
|
|
306
336
|
}
|
|
307
337
|
catch (error) {
|
|
308
|
-
|
|
338
|
+
return { kind: 'skip', reason: 'owner_review_read_failed', activationId, detail: describeError(error) };
|
|
339
|
+
}
|
|
340
|
+
return {
|
|
341
|
+
kind: 'item',
|
|
342
|
+
item: {
|
|
343
|
+
reviewKey: `rulecode:${activationId}`,
|
|
344
|
+
kind: 'rulecode_decision',
|
|
345
|
+
taskId: activationId,
|
|
346
|
+
title: 'RuleCode 影子规则待决',
|
|
347
|
+
summary: '一条 code_tool_hook 规则处于影子激活期,等待拥有者裁决(提升 / 拒绝)。',
|
|
348
|
+
reasonCode: 'rulecode_shadow_pending_promotion',
|
|
349
|
+
legacy: false,
|
|
350
|
+
allowedActions: ['promote', 'reject_after_shadow'],
|
|
351
|
+
expectedRevisionEpoch: 0,
|
|
352
|
+
expectedSourceRunId: '',
|
|
353
|
+
expectedSourceArtifactId: artifactId,
|
|
354
|
+
expectedSourceArtifactHash: '',
|
|
355
|
+
createdAt: typeof row.activated_at === 'string' ? row.activated_at : '',
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
});
|
|
359
|
+
for (const outcome of outcomes) {
|
|
360
|
+
if (outcome.kind === 'item') {
|
|
361
|
+
items.push(outcome.item);
|
|
309
362
|
continue;
|
|
310
363
|
}
|
|
311
|
-
|
|
312
|
-
reviewKey: `rulecode:${activationId}`,
|
|
313
|
-
kind: 'rulecode_decision',
|
|
314
|
-
taskId: activationId,
|
|
315
|
-
title: 'RuleCode 影子规则待决',
|
|
316
|
-
summary: '一条 code_tool_hook 规则处于影子激活期,等待拥有者裁决(提升 / 拒绝)。',
|
|
317
|
-
reasonCode: 'rulecode_shadow_pending_promotion',
|
|
318
|
-
legacy: false,
|
|
319
|
-
allowedActions: ['promote', 'reject_after_shadow'],
|
|
320
|
-
expectedRevisionEpoch: 0,
|
|
321
|
-
expectedSourceRunId: '',
|
|
322
|
-
expectedSourceArtifactId: artifactId,
|
|
323
|
-
expectedSourceArtifactHash: '',
|
|
324
|
-
createdAt: typeof row.activated_at === 'string' ? row.activated_at : '',
|
|
325
|
-
});
|
|
364
|
+
recordReadIssue(outcome.reason, outcome.activationId, outcome.detail);
|
|
326
365
|
}
|
|
327
366
|
}
|
|
328
367
|
catch (error) {
|
|
@@ -122,7 +122,7 @@ export async function handleActivationsRoute(req, res, workspaceDir, subPath, au
|
|
|
122
122
|
|| (req.method === 'POST' && revisionMatch[2] === 'revise-rule-once'))) {
|
|
123
123
|
const actor = authority?.ownerActor;
|
|
124
124
|
if (!actor) {
|
|
125
|
-
sendError(res, 403, 'owner_authentication_required', 'This revision requires the configured Owner identity.', { nextAction: '
|
|
125
|
+
sendError(res, 403, 'owner_authentication_required', 'This revision requires the configured Owner identity.', { nextAction: 'Configure PD_OWNER_ID and PD_OWNER_CREDENTIAL_ID, then retry from the local Console.' });
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
const [, rawId] = revisionMatch;
|
|
@@ -181,7 +181,7 @@ export async function handleActivationsRoute(req, res, workspaceDir, subPath, au
|
|
|
181
181
|
const governance = operation === 'continue-observing' || operation === 'promote' || operation === 'reject-after-shadow' || operation === 'recover-to-shadow' || operation === 'release';
|
|
182
182
|
const actor = governance ? authority?.ownerActor : (authority?.ownerActor ?? authority?.breakGlassActor);
|
|
183
183
|
if (!actor) {
|
|
184
|
-
sendError(res, 403, 'owner_authentication_required', 'This governance decision requires the configured Owner identity.', { nextAction: 'Configure PD_OWNER_ID and PD_OWNER_CREDENTIAL_ID, then
|
|
184
|
+
sendError(res, 403, 'owner_authentication_required', 'This governance decision requires the configured Owner identity.', { nextAction: 'Configure PD_OWNER_ID and PD_OWNER_CREDENTIAL_ID, then retry from the local Console.' });
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
const input = { actor, idempotencyKey: body.idempotencyKey, reasonCode: body.reasonCode, ...(body.note === undefined ? {} : { note: body.note }) };
|
|
@@ -259,7 +259,7 @@ async function handleBacklog(res, deps) {
|
|
|
259
259
|
async function handleRun(req, res, input) {
|
|
260
260
|
const { deps, taskId } = input;
|
|
261
261
|
req.resume(); // body is `{}` / empty; drain so the socket is not reset.
|
|
262
|
-
// 1. Same-origin (TD §8.2.3).
|
|
262
|
+
// 1. Same-origin (TD §8.2.3). The local-owner-session guard already ran upstream.
|
|
263
263
|
if (!isSameOriginRequest(req)) {
|
|
264
264
|
sendError(res, 403, 'cross_origin_rejected', 'Cross-origin request rejected');
|
|
265
265
|
return;
|