create-principles-disciple 1.152.0 → 1.152.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_release/product-identity.json +1 -1
- package/codex-adapter/dist/tool-semantics.d.ts +11 -1
- package/codex-adapter/dist/tool-semantics.js +11 -1
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/index.js +5 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.js +1 -2
- package/console/dist/server/models/GovernanceConsoleModel.js +56 -68
- package/console/dist/server/models/RuleCandidateBindingConsoleModel.js +31 -31
- package/console/dist/server/routes/update.js +45 -30
- package/console/dist/server/update-timeout.js +15 -1
- package/console/dist/shared/rule-candidate-binding-contract.d.ts +4 -1
- package/console/dist/web/assets/app.js +26 -26
- package/core/dist/runtime/candidate-audit.d.ts.map +1 -1
- package/core/dist/runtime/candidate-audit.js +6 -3
- package/core/dist/runtime/candidate-audit.js.map +1 -1
- package/core/dist/runtime/golden-trace.d.ts.map +1 -1
- package/core/dist/runtime/golden-trace.js +30 -24
- package/core/dist/runtime/golden-trace.js.map +1 -1
- package/core/dist/runtime/index.d.ts +1 -1
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
- package/core/dist/runtime/internalization/refiner-sandbox-wrapper.js +4 -4
- package/core/dist/runtime/internalization/refiner-sandbox-wrapper.js.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-output.js +21 -0
- package/core/dist/runtime/internalization/rollout-reviewer-output.js.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js +33 -2
- package/core/dist/runtime/internalization/rollout-reviewer-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/rule-host-input-builder.d.ts +21 -1
- package/core/dist/runtime/internalization/rule-host-input-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rule-host-input-builder.js +13 -0
- package/core/dist/runtime/internalization/rule-host-input-builder.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +16 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.js +23 -2
- package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization-chain-integrity-read-model.d.ts +1 -0
- package/core/dist/runtime/internalization-chain-integrity-read-model.d.ts.map +1 -1
- package/core/dist/runtime/internalization-chain-integrity-read-model.js +8 -5
- package/core/dist/runtime/internalization-chain-integrity-read-model.js.map +1 -1
- package/core/dist/runtime/pruning-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pruning-read-model.js +7 -5
- package/core/dist/runtime/pruning-read-model.js.map +1 -1
- package/core/dist/runtime/schema-conformance-read-model.d.ts +1 -0
- package/core/dist/runtime/schema-conformance-read-model.d.ts.map +1 -1
- package/core/dist/runtime/schema-conformance-read-model.js +8 -5
- package/core/dist/runtime/schema-conformance-read-model.js.map +1 -1
- package/core/dist/runtime/signal-collector/confidence-gate.d.ts +16 -1
- package/core/dist/runtime/signal-collector/confidence-gate.d.ts.map +1 -1
- package/core/dist/runtime/signal-collector/confidence-gate.js +25 -4
- package/core/dist/runtime/signal-collector/confidence-gate.js.map +1 -1
- package/core/dist/runtime/signal-collector/index.d.ts +1 -1
- package/core/dist/runtime/signal-collector/index.d.ts.map +1 -1
- package/core/dist/runtime/signal-collector/index.js.map +1 -1
- package/core/dist/runtime/signal-collector/llm-stage.d.ts +30 -1
- package/core/dist/runtime/signal-collector/llm-stage.d.ts.map +1 -1
- package/core/dist/runtime/signal-collector/llm-stage.js +28 -2
- package/core/dist/runtime/signal-collector/llm-stage.js.map +1 -1
- package/core/dist/trajectory-store.d.ts +17 -1
- package/core/dist/trajectory-store.d.ts.map +1 -1
- package/core/dist/trajectory-store.js +32 -10
- package/core/dist/trajectory-store.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/installer.d.ts +18 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +24 -0
- package/dist/installer.js.map +1 -1
- package/dist/installers/legacy-workbuddy-skill.d.ts +46 -14
- package/dist/installers/legacy-workbuddy-skill.d.ts.map +1 -1
- package/dist/installers/legacy-workbuddy-skill.js +162 -29
- package/dist/installers/legacy-workbuddy-skill.js.map +1 -1
- package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
- package/dist/installers/workbuddy-host-installer.js +7 -6
- package/dist/installers/workbuddy-host-installer.js.map +1 -1
- package/host-runtime/dist/active-principle-prompt.js +2 -2
- package/host-runtime/dist/governance-observation-store.js +2 -2
- package/host-runtime/dist/governance-signal-admission.js +2 -1
- package/host-runtime/dist/host-liveness-contract.js +2 -2
- package/host-runtime/dist/product-telemetry/milestone-readers.js +3 -2
- package/host-runtime/dist/production-pain-evidence.js +3 -2
- package/host-runtime/dist/production-rulehost-gate.d.ts +20 -0
- package/host-runtime/dist/production-rulehost-gate.js +110 -35
- package/host-runtime/dist/prompt-activation-deliverability.js +3 -3
- package/host-runtime/dist/prompt-injection-status.js +2 -2
- package/host-runtime/dist/signal-classifier.d.ts +8 -1
- package/host-runtime/dist/signal-classifier.js +1 -1
- package/host-runtime/dist/workspace-behavior-evidence.js +4 -3
- package/host-runtime/package.json +5 -1
- package/package.json +2 -2
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +2 -1
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/demo-story-a.d.ts.map +1 -1
- package/pd-cli/dist/commands/demo-story-a.js +2 -1
- package/pd-cli/dist/commands/demo-story-a.js.map +1 -1
- package/pd-cli/dist/commands/health-mcp.d.ts +21 -0
- package/pd-cli/dist/commands/health-mcp.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-mcp.js +19 -1
- package/pd-cli/dist/commands/health-mcp.js.map +1 -1
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +12 -4
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/dist/commands/legacy-cleanup.d.ts.map +1 -1
- package/pd-cli/dist/commands/legacy-cleanup.js +2 -1
- package/pd-cli/dist/commands/legacy-cleanup.js.map +1 -1
- package/pd-cli/dist/commands/pain-list.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-list.js +2 -1
- package/pd-cli/dist/commands/pain-list.js.map +1 -1
- package/pd-cli/dist/commands/principles-stats.d.ts.map +1 -1
- package/pd-cli/dist/commands/principles-stats.js +2 -1
- package/pd-cli/dist/commands/principles-stats.js.map +1 -1
- package/pd-cli/dist/commands/quality-scorecard.d.ts.map +1 -1
- package/pd-cli/dist/commands/quality-scorecard.js +2 -1
- package/pd-cli/dist/commands/quality-scorecard.js.map +1 -1
- package/pd-cli/dist/commands/runtime-init.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-init.js +5 -4
- package/pd-cli/dist/commands/runtime-init.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-evidence.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-evidence.js +2 -1
- package/pd-cli/dist/commands/runtime-internalization-evidence.js.map +1 -1
- package/pd-cli/dist/commands/runtime-recovery-failed-task.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-recovery-failed-task.js +2 -1
- package/pd-cli/dist/commands/runtime-recovery-failed-task.js.map +1 -1
- package/pd-cli/dist/legacy/session-history-import.js +2 -2
- package/pd-cli/dist/legacy/session-history-import.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/pd-mcp-server/dist/index.js +33 -2
- package/pd-mcp-server/dist/server.d.ts +7 -3
- package/pd-mcp-server/dist/server.js +6 -1
- package/pd-mcp-server/dist/submit-assembly.d.ts +24 -0
- package/pd-mcp-server/dist/submit-assembly.js +61 -0
- 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 +2 -1
- package/plugin/dist/bundle.js +493 -488
- package/plugin/dist/constants/tool-semantics.d.ts +13 -0
- package/plugin/dist/core/correction-anchor.d.ts +40 -0
- package/plugin/dist/core/experiment-workspace-guard.d.ts +10 -0
- package/plugin/dist/core/signal-collector-host.d.ts +33 -2
- package/plugin/dist/core/trajectory.d.ts +31 -0
- package/plugin/dist/core/workspace-context.d.ts +0 -4
- package/plugin/dist/hooks/gate.d.ts +0 -5
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +32 -26
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/dist/installer.js +24 -0
- package/release-manager/dist/installers/legacy-workbuddy-skill.js +162 -29
- package/release-manager/dist/installers/workbuddy-host-installer.js +7 -6
- package/release-manager/package.json +1 -1
- package/workbuddy-adapter/dist/tool-semantics.d.ts +11 -0
- package/workbuddy-adapter/dist/tool-semantics.js +11 -0
- package/workbuddy-adapter/package.json +1 -1
- package/plugin/dist/core/rule-host.d.ts +0 -203
|
@@ -2,15 +2,26 @@
|
|
|
2
2
|
* Legacy WorkBuddy user-level skill retirement
|
|
3
3
|
* (SPEC-PD-AGENT-PAIN-INGRESS-001 §5.5 / TECHNICAL-DESIGN §7.4).
|
|
4
4
|
*
|
|
5
|
-
* PD
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* PD no longer ships ANY user-level skill: the four active capabilities live
|
|
6
|
+
* inside the plugin payload, and pain raised by an agent is ingested through
|
|
7
|
+
* the governed host path. Older installs, however, left several retired
|
|
8
|
+
* skills behind in `~/.workbuddy/skills/`:
|
|
9
|
+
*
|
|
10
|
+
* - `pd-record-pain` — wrote pain through a retired, ungoverned channel;
|
|
11
|
+
* - `pd-status` / `pd-setup` / `pd-disable` — Codex-era skills that point
|
|
12
|
+
* at `~/.codex/plugins/cache/`, `host.codex` and Codex `/hooks`;
|
|
13
|
+
* - `pd-review` (pre-unification payload) — competes by directory name with
|
|
14
|
+
* the plugin's CURRENT `pd-review`, so the host may load the stale one.
|
|
15
|
+
*
|
|
16
|
+
* The last four were deleted/rewritten by 5c383e572 ("refactor(skills):
|
|
17
|
+
* unify PD host skill capabilities", 2026-10-22) but were never added to the
|
|
18
|
+
* retirement registry, so every later install/upgrade left them in place.
|
|
19
|
+
* This module now retires all of them under the same preservation-first rules.
|
|
9
20
|
*
|
|
10
21
|
* Rules this module implements — and the reasons each one exists:
|
|
11
22
|
*
|
|
12
23
|
* 1. Detection is path + frontmatter `name`. A directory that happens to be
|
|
13
|
-
* called
|
|
24
|
+
* called like a retired skill but declares a different name is the
|
|
14
25
|
* Owner's own skill; it is never touched and never reported.
|
|
15
26
|
* 2. Only a copy whose bytes match a PUBLISHED skill payload may be renamed.
|
|
16
27
|
* The published payload hashes below are derived from this repository's
|
|
@@ -27,25 +38,101 @@
|
|
|
27
38
|
import { createHash } from 'node:crypto';
|
|
28
39
|
import { existsSync, readdirSync, readFileSync, renameSync } from 'node:fs';
|
|
29
40
|
import * as path from 'node:path';
|
|
30
|
-
export const LEGACY_WORKBUDDY_SKILL_DIR = 'pd-record-pain';
|
|
31
41
|
export const LEGACY_WORKBUDDY_SKILL_FILE = 'SKILL.md';
|
|
32
42
|
/**
|
|
33
|
-
* Every
|
|
34
|
-
* recovered from git history (`git cat-file blob <blob>`).
|
|
35
|
-
*
|
|
43
|
+
* Every user-level PD skill payload this repository has ever shipped and
|
|
44
|
+
* later retired, recovered from git history (`git cat-file blob <blob>`).
|
|
45
|
+
*
|
|
46
|
+
* Only blobs published BEFORE 5c383e572 are listed for `pd-review`: the
|
|
47
|
+
* post-unification payloads are still shipped inside the plugin and must
|
|
48
|
+
* never be retired, even if an Owner copied one into the user-level dir.
|
|
36
49
|
*/
|
|
37
|
-
export const
|
|
50
|
+
export const LEGACY_WORKBUDDY_SKILL_ENTRIES = [
|
|
51
|
+
{
|
|
52
|
+
dir: 'pd-record-pain',
|
|
53
|
+
published: [
|
|
54
|
+
{
|
|
55
|
+
label: '0.1.1-openclaw',
|
|
56
|
+
sha256: 'beb758bd66c6e330ff18bb751136a276d98486d85876b4488d09551b672d8186',
|
|
57
|
+
provenance: 'plugins/principles-disciple/skills/pd-record-pain/SKILL.md @ plugin 0.1.1 (blob 7df4717)',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: '0.1.0-workbuddy',
|
|
61
|
+
sha256: 'f2eee21234250bf530a81579f033cda4fa41c0728bc81536320774127bd2d6e6',
|
|
62
|
+
provenance: 'packages/workbuddy-adapter/plugin/skills/pd-record-pain/SKILL.md @ plugin 0.1.0 (blob 7338fe8)',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
dir: 'pd-status',
|
|
68
|
+
published: [
|
|
69
|
+
{
|
|
70
|
+
label: 'codex-2026-09-23',
|
|
71
|
+
sha256: '853d5f8de9996239dbfc4d1fca27f5e96cd852cf1b8deea0c1cb8d1655800126',
|
|
72
|
+
provenance: 'plugins/principles-disciple/skills/pd-status/SKILL.md @ 42f0f4a7',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: 'workbuddy-2026-10-17',
|
|
76
|
+
sha256: '0b9b3bc6e730b4d9244522f9b9bc5a7ce27f29a82ec9ff432105ab21ae3573e0',
|
|
77
|
+
provenance: 'packages/workbuddy-adapter/plugin/skills/pd-status/SKILL.md @ b02ebb53',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
dir: 'pd-setup',
|
|
83
|
+
published: [
|
|
84
|
+
{
|
|
85
|
+
label: 'codex-2026-08-14',
|
|
86
|
+
sha256: 'bf4ad63c94a692c0264b357659a0b8db3acddcc26ac190f2a5dd81e04501b9ab',
|
|
87
|
+
provenance: 'plugins/principles-disciple/skills/pd-setup/SKILL.md @ 03747736',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
label: 'codex-2026-09-23',
|
|
91
|
+
sha256: 'fd1dbd26d0dc87e201a89bf2790cbe136a93921a62e45bca428037ef1ecf1bfa',
|
|
92
|
+
provenance: 'plugins/principles-disciple/skills/pd-setup/SKILL.md @ 42f0f4a7',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: 'codex-2026-10-05',
|
|
96
|
+
sha256: '8d6eae4df8b311c37e86788bc5487a5b692970573334f5b890ee6fd452f20502',
|
|
97
|
+
provenance: 'plugins/principles-disciple/skills/pd-setup/SKILL.md @ cee2304f',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
38
101
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
102
|
+
dir: 'pd-disable',
|
|
103
|
+
published: [
|
|
104
|
+
{
|
|
105
|
+
label: 'codex-2026-09-23',
|
|
106
|
+
sha256: '590769fcf93d60389346e001ce8a76c2157976f5d38035523f3807ffc2477f8e',
|
|
107
|
+
provenance: 'plugins/principles-disciple/skills/pd-disable/SKILL.md @ 42f0f4a7',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: 'workbuddy-2026-10-17',
|
|
111
|
+
sha256: '25172b5f67503c07cf31e06dc6092796fc277faad6f8746ce9595bf951294f86',
|
|
112
|
+
provenance: 'packages/workbuddy-adapter/plugin/skills/pd-disable/SKILL.md @ b02ebb53',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
42
115
|
},
|
|
43
116
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
117
|
+
dir: 'pd-review',
|
|
118
|
+
published: [
|
|
119
|
+
{
|
|
120
|
+
label: 'codex-2026-09-23',
|
|
121
|
+
sha256: '18665f1a8e0d5a34ab245859cc34f08c56c8946648274e870e95d1642e331b74',
|
|
122
|
+
provenance: 'plugins/principles-disciple/skills/pd-review/SKILL.md @ 42f0f4a7 (pre-unification)',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: 'workbuddy-2026-10-17',
|
|
126
|
+
sha256: '635fa9c7aa232cacd356bb25dc7e1c1c00305786fdcc930d03257edbeea0216e',
|
|
127
|
+
provenance: 'packages/workbuddy-adapter/plugin/skills/pd-review/SKILL.md @ b02ebb53 (pre-unification)',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
47
130
|
},
|
|
48
131
|
];
|
|
132
|
+
/** Kept for backwards compatibility with the single-skill callers/tests. */
|
|
133
|
+
export const LEGACY_WORKBUDDY_SKILL_DIR = 'pd-record-pain';
|
|
134
|
+
/** Kept for backwards compatibility: the `pd-record-pain` payloads. */
|
|
135
|
+
export const PUBLISHED_LEGACY_WORKBUDDY_SKILLS = LEGACY_WORKBUDDY_SKILL_ENTRIES.find((entry) => entry.dir === LEGACY_WORKBUDDY_SKILL_DIR)?.published ?? [];
|
|
49
136
|
function frontmatterName(content) {
|
|
50
137
|
// Minimal, format-only parse: the skill frontmatter is a leading `---` block
|
|
51
138
|
// of `key: value` lines. We only need `name`, and a missing block is a
|
|
@@ -66,18 +153,21 @@ function frontmatterName(content) {
|
|
|
66
153
|
function sha256Of(bytes) {
|
|
67
154
|
return createHash('sha256').update(bytes).digest('hex');
|
|
68
155
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
156
|
+
function publishedForSkill(dirName) {
|
|
157
|
+
return LEGACY_WORKBUDDY_SKILL_ENTRIES.find((entry) => entry.dir === dirName)?.published ?? [];
|
|
158
|
+
}
|
|
159
|
+
function skillDir(configDir, dirName) {
|
|
160
|
+
return path.join(configDir, 'skills', dirName);
|
|
71
161
|
}
|
|
72
162
|
/**
|
|
73
163
|
* Read-only inspection. Never renames, never deletes.
|
|
74
164
|
*
|
|
75
|
-
*
|
|
76
|
-
* fixture; production callers always use the shipped registry.
|
|
165
|
+
* Production callers always use the shipped registry for `skillDir`.
|
|
77
166
|
*/
|
|
78
167
|
export function inspectLegacyWorkbuddySkill(options) {
|
|
79
|
-
const
|
|
80
|
-
const
|
|
168
|
+
const dirName = options.skillDir ?? LEGACY_WORKBUDDY_SKILL_DIR;
|
|
169
|
+
const publishedVersions = options.published ?? publishedForSkill(dirName);
|
|
170
|
+
const dir = skillDir(options.configDir, dirName);
|
|
81
171
|
const skillPath = path.join(dir, LEGACY_WORKBUDDY_SKILL_FILE);
|
|
82
172
|
if (!existsSync(skillPath)) {
|
|
83
173
|
// Idempotency: a previously retired copy leaves only the suffixed file.
|
|
@@ -93,7 +183,7 @@ export function inspectLegacyWorkbuddySkill(options) {
|
|
|
93
183
|
: { status: 'already_deprecated', path: skillPath, deprecatedPath };
|
|
94
184
|
}
|
|
95
185
|
const bytes = readFileSync(skillPath);
|
|
96
|
-
if (frontmatterName(bytes.toString('utf8')) !==
|
|
186
|
+
if (frontmatterName(bytes.toString('utf8')) !== dirName) {
|
|
97
187
|
// Same directory name, different declared skill: not ours to retire.
|
|
98
188
|
return { status: 'absent', path: skillPath };
|
|
99
189
|
}
|
|
@@ -116,17 +206,41 @@ export function inspectLegacyWorkbuddySkill(options) {
|
|
|
116
206
|
};
|
|
117
207
|
}
|
|
118
208
|
/**
|
|
119
|
-
* Retire
|
|
209
|
+
* Retire ONE legacy user-level skill when it is provably an unmodified PD
|
|
120
210
|
* payload. Safe to run on every install/upgrade: absent, already-retired and
|
|
121
211
|
* Owner-modified states are all no-ops.
|
|
122
212
|
*/
|
|
123
213
|
export function deprecateLegacyWorkbuddySkill(options) {
|
|
124
|
-
const
|
|
214
|
+
const dirName = options.skillDir ?? LEGACY_WORKBUDDY_SKILL_DIR;
|
|
215
|
+
// Retirement runs AFTER the installer has already committed the plugin
|
|
216
|
+
// registration and the config, so an inspection throw here would make a
|
|
217
|
+
// successful install report failure. One unreadable entry (EISDIR on a
|
|
218
|
+
// `SKILL.md` directory, EACCES/EISDIR on a locked file) is isolated into a
|
|
219
|
+
// warning and the caller keeps going — including the aggregate loop.
|
|
220
|
+
let state;
|
|
221
|
+
try {
|
|
222
|
+
state = inspectLegacyWorkbuddySkill({ ...options, skillDir: dirName });
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
226
|
+
return {
|
|
227
|
+
state: {
|
|
228
|
+
status: 'inspection_failed',
|
|
229
|
+
path: path.join(skillDir(options.configDir, dirName), LEGACY_WORKBUDDY_SKILL_FILE),
|
|
230
|
+
reason,
|
|
231
|
+
},
|
|
232
|
+
warnings: [
|
|
233
|
+
`WARNING [legacy_skill_inspection_failed]: the retired skill "${dirName}" could not be inspected (${reason}).`,
|
|
234
|
+
` It was left untouched; skill discovery may still load it. Fix permissions or delete the directory yourself.`,
|
|
235
|
+
],
|
|
236
|
+
};
|
|
237
|
+
}
|
|
125
238
|
if (state.status === 'modified') {
|
|
126
239
|
return {
|
|
127
240
|
state,
|
|
128
241
|
warnings: [
|
|
129
|
-
'WARNING [deprecated_skill_modified]: a retired user-level skill
|
|
242
|
+
'WARNING [deprecated_skill_modified]: a retired user-level skill ' +
|
|
243
|
+
`"${dirName}" was found but NOT modified ` +
|
|
130
244
|
`(${state.path}, sha256 ${state.sha256.slice(0, 12)}…) — its content matches no published version.`,
|
|
131
245
|
` ${state.nextAction}`,
|
|
132
246
|
],
|
|
@@ -142,7 +256,7 @@ export function deprecateLegacyWorkbuddySkill(options) {
|
|
|
142
256
|
return {
|
|
143
257
|
state,
|
|
144
258
|
warnings: [
|
|
145
|
-
`WARNING [legacy_skill_rename_failed]: retired skill "
|
|
259
|
+
`WARNING [legacy_skill_rename_failed]: retired skill "${dirName}" could not be renamed because ${state.deprecatedPath} already exists.`,
|
|
146
260
|
` Move or delete ${state.path} yourself; skill discovery still sees it.`,
|
|
147
261
|
],
|
|
148
262
|
};
|
|
@@ -153,7 +267,7 @@ export function deprecateLegacyWorkbuddySkill(options) {
|
|
|
153
267
|
return {
|
|
154
268
|
state,
|
|
155
269
|
warnings: [
|
|
156
|
-
`WARNING [legacy_skill_rename_failed]: retired skill "
|
|
270
|
+
`WARNING [legacy_skill_rename_failed]: retired skill "${dirName}" could not be renamed (${error instanceof Error ? error.message : String(error)}).`,
|
|
157
271
|
` Delete ${state.path} yourself; skill discovery still sees it.`,
|
|
158
272
|
],
|
|
159
273
|
};
|
|
@@ -161,8 +275,27 @@ export function deprecateLegacyWorkbuddySkill(options) {
|
|
|
161
275
|
return {
|
|
162
276
|
state,
|
|
163
277
|
warnings: [
|
|
164
|
-
`Retired the obsolete user-level skill "
|
|
278
|
+
`Retired the obsolete user-level skill "${dirName}" (renamed to ${path.basename(state.deprecatedPath)}).`,
|
|
165
279
|
],
|
|
166
280
|
};
|
|
167
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Retire EVERY registered legacy user-level skill. This is the production
|
|
284
|
+
* entry point for install/upgrade: one retired skill must not mask the others.
|
|
285
|
+
*
|
|
286
|
+
* `entries` is injectable so tests can exercise the loop without touching the
|
|
287
|
+
* shipped registry; production callers always use the registry.
|
|
288
|
+
*/
|
|
289
|
+
export function deprecateAllLegacyWorkbuddySkills(options) {
|
|
290
|
+
const entries = options.entries ?? LEGACY_WORKBUDDY_SKILL_ENTRIES;
|
|
291
|
+
const outcomes = entries.map((entry) => deprecateLegacyWorkbuddySkill({
|
|
292
|
+
configDir: options.configDir,
|
|
293
|
+
skillDir: entry.dir,
|
|
294
|
+
published: entry.published,
|
|
295
|
+
}));
|
|
296
|
+
return {
|
|
297
|
+
outcomes,
|
|
298
|
+
warnings: outcomes.flatMap((outcome) => outcome.warnings),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
168
301
|
//# sourceMappingURL=legacy-workbuddy-skill.js.map
|
|
@@ -66,7 +66,7 @@ export const WORKBUDDY_PLUGIN_KEY = `${WORKBUDDY_PLUGIN_NAME}@${WORKBUDDY_MARKET
|
|
|
66
66
|
const WORKBUDDY_REQUIRED_SKILLS = ['pd-cli-operator', 'pd-pain-signal', 'pd-review', 'pd-control'];
|
|
67
67
|
import { atomicReplaceTextFile, AtomicReplaceCleanupError, AtomicReplaceConflictError, errnoCode } from '../utils/config-file-io.js';
|
|
68
68
|
import { checkMcpRegistrationConflict } from './mcp-registration-conflict.js';
|
|
69
|
-
import {
|
|
69
|
+
import { deprecateAllLegacyWorkbuddySkills } from './legacy-workbuddy-skill.js';
|
|
70
70
|
import { resolveMcpServerDir, resolveMcpServerEntry } from '../mcp-server-layout-compat.js';
|
|
71
71
|
import { getHomeDir, generateConfigYamlContent, getConfigYamlPath, resolveDefaultModelForProvider, isValidHttpBaseUrl } from '../mvp-config.js';
|
|
72
72
|
// Type-only import from @principles/core — erased at compile time; this
|
|
@@ -2554,11 +2554,12 @@ export class WorkBuddyHostInstaller {
|
|
|
2554
2554
|
const pendingRebindNote = profilePendingAgents.length > 0
|
|
2555
2555
|
? ` Pending config: agent(s) ${profilePendingAgents.join(', ')} still bind to their explicit runtime profiles; to rebind them to the install profile, set internalAgents.agents.<name>.runtimeProfile to '${GOVERNANCE_PROFILE_ID}' (or remove the per-agent runtimeProfile row so they inherit internalAgents.defaultRuntime) in ${path.join(p.governanceDir, '.pd', 'config.yaml')}.`
|
|
2556
2556
|
: '';
|
|
2557
|
-
// SPEC-PD-AGENT-PAIN-INGRESS-001 §5.5 / TD §7.4: retire
|
|
2558
|
-
//
|
|
2559
|
-
//
|
|
2560
|
-
//
|
|
2561
|
-
|
|
2557
|
+
// SPEC-PD-AGENT-PAIN-INGRESS-001 §5.5 / TD §7.4: retire every old
|
|
2558
|
+
// user-level PD skill once per install/upgrade (`pd-record-pain` plus the
|
|
2559
|
+
// Codex-era pd-status/pd-setup/pd-disable and the pre-unification
|
|
2560
|
+
// pd-review). Idempotent and preservation-first: a copy that is not
|
|
2561
|
+
// provably a published payload is reported, never overwritten or deleted.
|
|
2562
|
+
const legacySkill = deprecateAllLegacyWorkbuddySkills({ configDir: p.configDir });
|
|
2562
2563
|
return {
|
|
2563
2564
|
success: true,
|
|
2564
2565
|
hostId: this.hostId,
|
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
* sessions sample more names — a wrong guess is worse than a gap (unknown
|
|
17
17
|
* names resolve to 'other' and are never fabricated into Write/Bash
|
|
18
18
|
* equivalences).
|
|
19
|
+
*
|
|
20
|
+
* `pd_submit_pain` is the OG-4 MCP write tool (Owner-authorized for all three
|
|
21
|
+
* hosts on 2026-11-13), and it is deliberately NOT declared here:
|
|
22
|
+
* `CanonicalKind` is a FILE-mutation axis, and `workbuddy-rule-context-provider`
|
|
23
|
+
* only marks facts incomplete for `'execute' | 'other'`. Declaring a ledger
|
|
24
|
+
* write as `'write'` would make it count inside
|
|
25
|
+
* `computeBehaviorFacts.writeCount` while its payload carries no target path,
|
|
26
|
+
* and would switch off the conservative guard for every session that submits a
|
|
27
|
+
* pain. It therefore stays `'other'` — the same "a wrong guess is worse than a
|
|
28
|
+
* gap" rule as the rest of this declaration. The host's `*` PreToolUse matcher
|
|
29
|
+
* still delivers the event, so the call remains observable.
|
|
19
30
|
*/
|
|
20
31
|
import { type ToolSemanticMappingV1, type ToolSemanticRegistry } from '@principles/core/runtime';
|
|
21
32
|
export declare const WORKBUDDY_TOOL_SEMANTIC_MAPPINGS: readonly ToolSemanticMappingV1[];
|
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
* sessions sample more names — a wrong guess is worse than a gap (unknown
|
|
17
17
|
* names resolve to 'other' and are never fabricated into Write/Bash
|
|
18
18
|
* equivalences).
|
|
19
|
+
*
|
|
20
|
+
* `pd_submit_pain` is the OG-4 MCP write tool (Owner-authorized for all three
|
|
21
|
+
* hosts on 2026-11-13), and it is deliberately NOT declared here:
|
|
22
|
+
* `CanonicalKind` is a FILE-mutation axis, and `workbuddy-rule-context-provider`
|
|
23
|
+
* only marks facts incomplete for `'execute' | 'other'`. Declaring a ledger
|
|
24
|
+
* write as `'write'` would make it count inside
|
|
25
|
+
* `computeBehaviorFacts.writeCount` while its payload carries no target path,
|
|
26
|
+
* and would switch off the conservative guard for every session that submits a
|
|
27
|
+
* pain. It therefore stays `'other'` — the same "a wrong guess is worse than a
|
|
28
|
+
* gap" rule as the rest of this declaration. The host's `*` PreToolUse matcher
|
|
29
|
+
* still delivers the event, so the call remains observable.
|
|
19
30
|
*/
|
|
20
31
|
import { buildToolSemanticRegistry } from '@principles/core/runtime';
|
|
21
32
|
export const WORKBUDDY_TOOL_SEMANTIC_MAPPINGS = Object.freeze([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/workbuddy-adapter",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "WorkBuddy host adapter for Principles Disciple — implements the HostAdapter interface for WorkBuddy's Git Bash command-hook model (ADR-0020 third host, SPEC workbuddy-host-adapter v0.3.0).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Host — Constrained execution layer for active code implementations
|
|
3
|
-
*
|
|
4
|
-
* PURPOSE: Load active code implementations from the SQLite activations table
|
|
5
|
-
* (code_tool_hook channel), execute them in a constrained node:vm context,
|
|
6
|
-
* and merge their decisions.
|
|
7
|
-
*
|
|
8
|
-
* ARCHITECTURE (PRI-436):
|
|
9
|
-
* - SQLite is the SOLE production source of active RuleCode
|
|
10
|
-
* - No filesystem ledger or implementation asset reads occur during evaluation
|
|
11
|
-
* - Constructor takes stateDir for API compatibility (no longer used for impl loading)
|
|
12
|
-
* - workspaceDir enables reading code_tool_hook activations from SQLite
|
|
13
|
-
* - evaluate(input) loads active code implementations and runs them
|
|
14
|
-
* - Each implementation executes in an isolated vm context with minimal helpers
|
|
15
|
-
* - Decision merge: block short-circuits, requireApproval collects, allow is implicit
|
|
16
|
-
*
|
|
17
|
-
* SECURITY CONSTRAINTS (T-12-01, T-12-04):
|
|
18
|
-
* - Candidate code loads through a dedicated vm context, not the host realm
|
|
19
|
-
* - No importModuleDynamically callback
|
|
20
|
-
* - Helpers are a frozen object — implementations cannot modify the helper surface
|
|
21
|
-
*
|
|
22
|
-
* CONSERVATIVE DEGRADATION (T-12-02, D-08):
|
|
23
|
-
* - On ANY host error (load failure, eval error, vm error): return undefined
|
|
24
|
-
* - Never throw, never bypass downstream gates (Progressive Gate, Edit Verification)
|
|
25
|
-
*/
|
|
26
|
-
import type { RuleHostInput, RuleHostResult } from '@principles/core/runtime';
|
|
27
|
-
import type { RuleHostLogger } from '@principles/core/runtime';
|
|
28
|
-
export type { RuleHostLogger } from '@principles/core/runtime';
|
|
29
|
-
export interface RuleHostOptions {
|
|
30
|
-
/** Workspace directory for SQLite access. Required for RuleHost to load active code_tool_hook activations. */
|
|
31
|
-
workspaceDir?: string;
|
|
32
|
-
}
|
|
33
|
-
type RuleHostActivationMode = 'shadow' | 'live';
|
|
34
|
-
export interface RuleHostObservedDecision extends RuleHostResult {
|
|
35
|
-
readonly activationId: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* PRI-491 — A structured record of an activation that was skipped at load
|
|
39
|
-
* time (flag-off v2, unsupported action, unsupported context version,
|
|
40
|
-
* missing target_ref, content_json not an object, no implementationCode,
|
|
41
|
-
* or duplicate active activation for target_ref).
|
|
42
|
-
*
|
|
43
|
-
* Unlike compile/load failures (which emit rulehost_unhealthy), skipped
|
|
44
|
-
* activations have a configuration/flag reason — the RuleCode itself may be
|
|
45
|
-
* valid, but the runtime chose not to execute it. Duplicate activations are
|
|
46
|
-
* a special case: they ALSO emit rulehost_unhealthy (for telemetry), but are
|
|
47
|
-
* surfaced in skippedActivations so the owner can observe and act (rc-9).
|
|
48
|
-
*
|
|
49
|
-
* ERR-002 (rc-9): every skip carries a reason + nextAction, never silent.
|
|
50
|
-
*/
|
|
51
|
-
export interface SkippedActivation {
|
|
52
|
-
readonly activationId: string;
|
|
53
|
-
readonly ruleId: string;
|
|
54
|
-
/**
|
|
55
|
-
* The mode the activation WOULD have had if loaded. Optional for cases
|
|
56
|
-
* where the action itself is unrecognized (neither shadow nor live).
|
|
57
|
-
*/
|
|
58
|
-
readonly mode?: RuleHostActivationMode;
|
|
59
|
-
readonly reason: string;
|
|
60
|
-
readonly nextAction: string;
|
|
61
|
-
}
|
|
62
|
-
export interface RuleHostEvaluationReport {
|
|
63
|
-
readonly liveDecision: RuleHostResult | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* P1 (ISSUE-023): live 聚合决策的溯源 — 贡献该决策的 live activation id
|
|
66
|
-
* (经 ruleId 反查 implementationSources)。审计开放项: 414 次 live-mode
|
|
67
|
-
* 评估无法对账到具体规则,因为 live 事件不带 activationId。
|
|
68
|
-
*/
|
|
69
|
-
readonly liveDecisionActivationId?: string;
|
|
70
|
-
readonly shadowDecisions: readonly RuleHostObservedDecision[];
|
|
71
|
-
/**
|
|
72
|
-
* PRI-491 — Activations that were skipped at load time. Empty when all
|
|
73
|
-
* active activations loaded successfully. Each entry carries a structured
|
|
74
|
-
* reason + nextAction so the owner can act without reading SQLite rows.
|
|
75
|
-
*/
|
|
76
|
-
readonly skippedActivations: readonly SkippedActivation[];
|
|
77
|
-
/**
|
|
78
|
-
* PRI-567 — Number of live-mode implementations loaded for this evaluation.
|
|
79
|
-
* Lets the gate distinguish "live rule evaluated → allow" from
|
|
80
|
-
* "no live rules armed at all" (which previously both logged decision='allow',
|
|
81
|
-
* making enforcement statistics read as if rules were active when none were).
|
|
82
|
-
*/
|
|
83
|
-
readonly liveRulesLoaded: number;
|
|
84
|
-
/** Distinguishes an empty live set from a failed evaluation. */
|
|
85
|
-
readonly evaluationStatus: 'ok' | 'failed';
|
|
86
|
-
}
|
|
87
|
-
export declare class RuleHost {
|
|
88
|
-
private readonly stateDir;
|
|
89
|
-
private logger;
|
|
90
|
-
private readonly workspaceDir;
|
|
91
|
-
private readonly implementationSources;
|
|
92
|
-
private activationFingerprint;
|
|
93
|
-
private cachedImplementations;
|
|
94
|
-
/**
|
|
95
|
-
* PRI-491: Cached skipped activations from the last load. Returned alongside
|
|
96
|
-
* cachedImplementations on fingerprint hit so evaluateDetailed can surface
|
|
97
|
-
* them without re-scanning SQLite.
|
|
98
|
-
*/
|
|
99
|
-
private cachedSkipped;
|
|
100
|
-
private sqliteConnection;
|
|
101
|
-
/**
|
|
102
|
-
* R2-RH-002: Guards the "armed but empty" warn so it fires at most once per
|
|
103
|
-
* RuleHost instance. Without this, the 0-rules path (workspaceDir missing OR
|
|
104
|
-
* zero active code_tool_hook activations) returns [] silently on every
|
|
105
|
-
* evaluation — an observability gap (rc-9-no-silent-fallback). The warn is
|
|
106
|
-
* NOT a degradation fallback (RuleHost correctly has no opinion when empty);
|
|
107
|
-
* it makes the empty-armed state visible so operators can investigate why
|
|
108
|
-
* no live rules are loaded.
|
|
109
|
-
*/
|
|
110
|
-
private emptyLoadWarnEmitted;
|
|
111
|
-
/**
|
|
112
|
-
* PRI-1044 step 3-1 (LOCKSTEP twin of the host-runtime gate): an ACTIVE
|
|
113
|
-
* activation whose pi_artifacts row is gone is dropped by the INNER JOIN in
|
|
114
|
-
* `_loadFromActivationsTable`, so the RuleHost silently enforces fewer rules
|
|
115
|
-
* than the Owner armed. Suppression is keyed on the dangling descriptor SET
|
|
116
|
-
* (not a one-shot latch, which would never re-arm on this cached singleton
|
|
117
|
-
* instance): an unchanged set is not re-logged, a changed set is, and an
|
|
118
|
-
* empty set clears the signature so a later recurrence warns again.
|
|
119
|
-
*/
|
|
120
|
-
private danglingArtifactSignature;
|
|
121
|
-
constructor(stateDir: string, logger?: RuleHostLogger, options?: RuleHostOptions);
|
|
122
|
-
/**
|
|
123
|
-
* Update the logger sink on a cached RuleHost instance.
|
|
124
|
-
*
|
|
125
|
-
* WorkspaceContext caches the RuleHost singleton, but each gate call may
|
|
126
|
-
* pass a request-level logger. Without this update, warn/unhealthy logs
|
|
127
|
-
* would forever go to the first logger sink, making the new path hard to
|
|
128
|
-
* debug.
|
|
129
|
-
*/
|
|
130
|
-
updateLogger(logger: RuleHostLogger): void;
|
|
131
|
-
/**
|
|
132
|
-
* Evaluate the input against all active code implementations.
|
|
133
|
-
*
|
|
134
|
-
* Returns:
|
|
135
|
-
* - undefined when no active code implementations exist (no opinion)
|
|
136
|
-
* - undefined when all implementations return allow or matched=false
|
|
137
|
-
* - { decision: 'block', ... } when any implementation returns block (short-circuits)
|
|
138
|
-
* - { decision: 'requireApproval', ... } when any implementation returns requireApproval
|
|
139
|
-
*/
|
|
140
|
-
evaluate(input: RuleHostInput): RuleHostResult | undefined;
|
|
141
|
-
dispose(): void;
|
|
142
|
-
evaluateDetailed(input: RuleHostInput): RuleHostEvaluationReport;
|
|
143
|
-
/**
|
|
144
|
-
* Load active code implementations from the SQLite activations table.
|
|
145
|
-
*
|
|
146
|
-
* PRI-436: SQLite is the SOLE production source. The filesystem ledger
|
|
147
|
-
* (principle-tree-ledger) and implementation asset paths have been deleted.
|
|
148
|
-
* No fallback, no dual-source, no deprecated adapter.
|
|
149
|
-
*
|
|
150
|
-
* Source: activations table (code_tool_hook channel, deactivated_at IS NULL)
|
|
151
|
-
* → JOIN pi_artifacts for content_json → extract implementationCode → compile
|
|
152
|
-
*/
|
|
153
|
-
private _loadActiveCodeImplementations;
|
|
154
|
-
/**
|
|
155
|
-
* R2-RH-002: Emit the "armed but empty" warn at most once per RuleHost
|
|
156
|
-
* instance. The warn is cached via `emptyLoadWarnEmitted` so repeated
|
|
157
|
-
* evaluations (which all hit the empty path) do not spam the log.
|
|
158
|
-
*
|
|
159
|
-
* This is an observability signal, NOT a degradation fallback — RuleHost
|
|
160
|
-
* correctly returns "no opinion" when there are no active rules. The warn
|
|
161
|
-
* makes the empty state visible so operators can distinguish "RuleHost is
|
|
162
|
-
* working but has no rules" from "RuleHost is broken" (rc-9-no-silent-fallback).
|
|
163
|
-
*/
|
|
164
|
-
private _emitEmptyLoadWarn;
|
|
165
|
-
/**
|
|
166
|
-
* Load active code implementations from the activations table (code_tool_hook channel).
|
|
167
|
-
*
|
|
168
|
-
* For each activation record:
|
|
169
|
-
* 1. Query the pi_artifacts table for the artifact content
|
|
170
|
-
* 2. Parse content_json to extract implementationCode (treated as unknown, EP-01)
|
|
171
|
-
* 3. Compile via loadRuleImplementationModule (isolated vm context)
|
|
172
|
-
*
|
|
173
|
-
* PRI-436 invariant: at most one active activation per rule (target_ref).
|
|
174
|
-
* Duplicate active activations for the same target_ref are ALL skipped
|
|
175
|
-
* (zero executions) and emit structured unhealthy evidence via logger.warn
|
|
176
|
-
* (Runtime Contract Rule 9: graceful degradation includes a reason).
|
|
177
|
-
*
|
|
178
|
-
* All data from SQLite is treated as unknown and validated before use.
|
|
179
|
-
*/
|
|
180
|
-
private _loadFromActivationsTable;
|
|
181
|
-
/**
|
|
182
|
-
* PRI-437: Record an unhealthy activation state to EventLog.
|
|
183
|
-
*
|
|
184
|
-
* This makes compile/load failures visible to CLI (pd runtime health) and
|
|
185
|
-
* Console API — NOT just a logger.warn that's silently skipped.
|
|
186
|
-
*
|
|
187
|
-
* ERR-002: degradation includes a reason and nextAction (not silent).
|
|
188
|
-
* Failures in EventLog recording are caught and logged (never throw).
|
|
189
|
-
*/
|
|
190
|
-
private _recordUnhealthy;
|
|
191
|
-
/**
|
|
192
|
-
* PRI-491: Record a skipped activation to EventLog.
|
|
193
|
-
*
|
|
194
|
-
* Unlike _recordUnhealthy (compile/load failures), skipped activations have
|
|
195
|
-
* a configuration/flag reason — the RuleCode itself may be valid, but the
|
|
196
|
-
* runtime chose not to execute it (flag-off v2, unsupported context version,
|
|
197
|
-
* unsupported action, content_json not object, no implementationCode).
|
|
198
|
-
*
|
|
199
|
-
* ERR-002: degradation includes a reason and nextAction (rc-9-no-silent-fallback).
|
|
200
|
-
* Failures in EventLog recording are caught and logged (never throw).
|
|
201
|
-
*/
|
|
202
|
-
private _recordSkipped;
|
|
203
|
-
}
|