create-principles-disciple 1.147.17 → 1.147.19
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/package.json +1 -1
- package/core/dist/host/host-installer.d.ts +11 -0
- package/core/dist/host/host-installer.d.ts.map +1 -1
- package/core/dist/host/host-installer.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +20 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +75 -12
- package/dist/installer.js.map +1 -1
- package/dist/installers/codex-host-installer.d.ts +21 -0
- package/dist/installers/codex-host-installer.d.ts.map +1 -1
- package/dist/installers/codex-host-installer.js +105 -4
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/dist/installers/workbuddy-host-installer.d.ts +34 -3
- package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
- package/dist/installers/workbuddy-host-installer.js +841 -53
- package/dist/installers/workbuddy-host-installer.js.map +1 -1
- package/dist/utils/config-file-io.d.ts +27 -1
- package/dist/utils/config-file-io.d.ts.map +1 -1
- package/dist/utils/config-file-io.js +78 -3
- package/dist/utils/config-file-io.js.map +1 -1
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/index.d.ts +49 -0
- package/install-layout/dist/index.js +59 -0
- package/install-layout/package.json +1 -1
- package/package.json +4 -4
- package/pd-cli/dist/commands/health-workbuddy.d.ts +31 -0
- package/pd-cli/dist/commands/health-workbuddy.d.ts.map +1 -0
- package/pd-cli/dist/commands/health-workbuddy.js +192 -0
- package/pd-cli/dist/commands/health-workbuddy.js.map +1 -0
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +12 -0
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +110 -110
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/release-manager/dist/installer.js +75 -12
- package/release-manager/dist/installers/codex-host-installer.js +105 -4
- package/release-manager/dist/installers/workbuddy-host-installer.js +841 -53
- package/release-manager/dist/utils/config-file-io.js +78 -3
- package/release-manager/package.json +1 -1
- package/workbuddy-adapter/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "principles-disciple",
|
|
3
3
|
"name": "Principles Disciple",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.2",
|
|
6
6
|
"activation": {
|
|
7
7
|
"onStartup": true,
|
|
8
8
|
"onCapabilities": [
|
package/plugin/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "principles-disciple",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Principles Disciple is an AI Agent Governance System. Stop correcting the same AI behavior across sessions. Turn repeated Agent corrections into Owner-approved, observable, reversible behavior principles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -3563,6 +3563,28 @@ export async function ensureOpenClawWorkspaceDeclaration(workspaceDir, channels)
|
|
|
3563
3563
|
await fse.writeJson(inspection.configPath, config, { spaces: 2 });
|
|
3564
3564
|
return { configPath: inspection.configPath, action: 'created' };
|
|
3565
3565
|
}
|
|
3566
|
+
/**
|
|
3567
|
+
* Marketplace contract (2026-11-07): partition host installer results into
|
|
3568
|
+
* REAL failures and pending MANUAL actions (e.g. the Codex Marketplace
|
|
3569
|
+
* install). A real failure aborts the install transaction (atomic rollback);
|
|
3570
|
+
* a manual action is an explicit partial completion — it must NOT trigger the
|
|
3571
|
+
* other hosts' rollback (the OpenClaw `--host all` defect), but it does make
|
|
3572
|
+
* the aggregate result non-successful with a non-zero exit code so automation
|
|
3573
|
+
* cannot mistake partial for complete. Pure: unit-testable without I/O.
|
|
3574
|
+
*/
|
|
3575
|
+
export function partitionHostInstallResults(results) {
|
|
3576
|
+
const failures = [];
|
|
3577
|
+
const manualActions = [];
|
|
3578
|
+
for (const result of results) {
|
|
3579
|
+
if (result.success)
|
|
3580
|
+
continue;
|
|
3581
|
+
if (result.manualActionRequired === true)
|
|
3582
|
+
manualActions.push(result);
|
|
3583
|
+
else
|
|
3584
|
+
failures.push(result);
|
|
3585
|
+
}
|
|
3586
|
+
return { failures, manualActions };
|
|
3587
|
+
}
|
|
3566
3588
|
/**
|
|
3567
3589
|
* ADR-0020 §2.3: Run host installers for the selected HostTarget.
|
|
3568
3590
|
*
|
|
@@ -4293,24 +4315,41 @@ transaction) {
|
|
|
4293
4315
|
: undefined,
|
|
4294
4316
|
});
|
|
4295
4317
|
// Report host install results (rc-9: surface failures, don't silently swallow).
|
|
4296
|
-
// rc-9 propagation: if ANY host installer
|
|
4318
|
+
// rc-9 propagation: if ANY host installer FAILED, the aggregate install
|
|
4297
4319
|
// result is NOT successful — callers (CLI, tests) must see the failure.
|
|
4298
4320
|
// Previously failures were only logged, leaving `success: true` even when
|
|
4299
4321
|
// a host adapter failed to install (silent failure).
|
|
4300
|
-
|
|
4322
|
+
//
|
|
4323
|
+
// Marketplace contract (2026-11-07): a host result carrying
|
|
4324
|
+
// manualActionRequired (Codex Marketplace install pending) is NOT a
|
|
4325
|
+
// failure of the install transaction. It must not throw — throwing here
|
|
4326
|
+
// used to roll back the SHARED runtime and left the already-successful
|
|
4327
|
+
// OpenClaw install pointing at a restored-away runtime (the --host all
|
|
4328
|
+
// defect). Manual actions are surfaced as an explicit partial completion:
|
|
4329
|
+
// the runtime stays installed and usable, the manifest claims only hosts
|
|
4330
|
+
// that actually installed, and the exit code is non-zero so automation
|
|
4331
|
+
// cannot mistake partial for complete.
|
|
4332
|
+
const { failures: hostFailures, manualActions: hostManualActions } = partitionHostInstallResults(hostResults);
|
|
4333
|
+
const hostFailureMessages = hostFailures.map((hr) => `Host "${hr.hostId}": ${hr.reason ?? 'unknown failure'}. Next: ${hr.nextAction}`);
|
|
4334
|
+
for (const msg of hostFailureMessages) {
|
|
4335
|
+
logger.warn(msg);
|
|
4336
|
+
}
|
|
4301
4337
|
for (const hr of hostResults) {
|
|
4302
|
-
if (
|
|
4303
|
-
const msg = `Host "${hr.hostId}": ${hr.reason ?? 'unknown failure'}. Next: ${hr.nextAction}`;
|
|
4304
|
-
hostFailures.push(msg);
|
|
4305
|
-
logger.warn(msg);
|
|
4306
|
-
}
|
|
4307
|
-
else if (hr.configAction === 'skipped') {
|
|
4338
|
+
if (hr.success && hr.configAction === 'skipped') {
|
|
4308
4339
|
logger.info(`Host "${hr.hostId}" install: ${hr.reason ?? 'skipped'}. Next: ${hr.nextAction}`);
|
|
4309
4340
|
}
|
|
4310
4341
|
}
|
|
4311
4342
|
if (hostFailures.length > 0) {
|
|
4312
|
-
throw new Error(`Host installation failed: ${
|
|
4313
|
-
}
|
|
4343
|
+
throw new Error(`Host installation failed: ${hostFailureMessages.join(' | ')}`);
|
|
4344
|
+
}
|
|
4345
|
+
// Manual-action hosts (e.g. Codex awaiting the Marketplace step) STAY in
|
|
4346
|
+
// the install manifest: the manifest records the hosts PD serves on this
|
|
4347
|
+
// machine (uninstall reads it to decide shared-runtime removal), not a
|
|
4348
|
+
// per-run success ledger. Dropping a pending host here could let a later
|
|
4349
|
+
// sibling-host uninstall remove the shared runtime while the pending
|
|
4350
|
+
// host's registration still points at it — the exact A3 hazard class
|
|
4351
|
+
// this fix exists to close. Real install state remains file-based truth
|
|
4352
|
+
// (checkInstallStatus / host detect()).
|
|
4314
4353
|
writeInstallManifest(installManifestHosts, resolveInstallManifestWorkspaces(options.workspaceDir, options.host));
|
|
4315
4354
|
// PRI-709 P0-1: persist the metadata source after the manifest write, so
|
|
4316
4355
|
// the durable tier cannot be clobbered by the same install.
|
|
@@ -4410,7 +4449,16 @@ transaction) {
|
|
|
4410
4449
|
}
|
|
4411
4450
|
}
|
|
4412
4451
|
if (spinner) {
|
|
4413
|
-
|
|
4452
|
+
// rc-9: the runtime transaction IS committed here, but a pending host
|
|
4453
|
+
// manual action (e.g. the Codex Marketplace install) makes the run a
|
|
4454
|
+
// partial completion — "Install complete!" would be the exact
|
|
4455
|
+
// misleading-success texture this contract exists to remove.
|
|
4456
|
+
if (hostManualActions.length === 0) {
|
|
4457
|
+
spinner.succeed('Install complete!');
|
|
4458
|
+
}
|
|
4459
|
+
else {
|
|
4460
|
+
spinner.warn(`Install partially complete — ${hostManualActions.length} manual step(s) pending (details below)`);
|
|
4461
|
+
}
|
|
4414
4462
|
}
|
|
4415
4463
|
// P0-2: terminate + join the verified child before any later step that
|
|
4416
4464
|
// may touch the runtime tree (here: none destructive, but a wedged child
|
|
@@ -4429,7 +4477,18 @@ transaction) {
|
|
|
4429
4477
|
// requested config instead of the actual state).
|
|
4430
4478
|
const actualEnabledChannels = readEnabledChannelsFromConfigYaml(options.workspaceDir);
|
|
4431
4479
|
const cliWorking = components.cli === 'verified' || components.cli === 'verified_local_only';
|
|
4432
|
-
|
|
4480
|
+
// Marketplace contract (2026-11-07): a pending manual action (e.g. the
|
|
4481
|
+
// Codex Marketplace install) makes the run an explicit PARTIAL completion —
|
|
4482
|
+
// never a full success (no fake "Install complete!"), never a runtime
|
|
4483
|
+
// rollback either. The runtime component itself is verified; the pending
|
|
4484
|
+
// step is host-side and must be surfaced with a non-zero exit code.
|
|
4485
|
+
const isComplete = components.plugin === 'verified' && cliWorking && components.console === 'configured' && hostManualActions.length === 0;
|
|
4486
|
+
const manualActionReason = hostManualActions.length > 0
|
|
4487
|
+
? `Partial completion: ${hostManualActions.map((hr) => `host "${hr.hostId}" requires a manual step (${hr.reason ?? 'manual action required'})`).join('; ')}`
|
|
4488
|
+
: undefined;
|
|
4489
|
+
const manualActionNext = hostManualActions.length > 0
|
|
4490
|
+
? hostManualActions.map((hr) => `Host "${hr.hostId}": ${hr.nextAction}`).join(' | ')
|
|
4491
|
+
: undefined;
|
|
4433
4492
|
// A host installer failure means the install is not fully successful,
|
|
4434
4493
|
// even if all component verifications passed. The operator should see
|
|
4435
4494
|
// success=false and be guided to fix the failed host.
|
|
@@ -4453,6 +4512,9 @@ transaction) {
|
|
|
4453
4512
|
if (launchResult.fallbackAction) {
|
|
4454
4513
|
nextActions.push(launchResult.fallbackAction);
|
|
4455
4514
|
}
|
|
4515
|
+
if (manualActionNext !== undefined) {
|
|
4516
|
+
nextActions.push(manualActionNext);
|
|
4517
|
+
}
|
|
4456
4518
|
pendingResult = {
|
|
4457
4519
|
success: isComplete,
|
|
4458
4520
|
workspaceDir: options.workspaceDir,
|
|
@@ -4464,6 +4526,7 @@ transaction) {
|
|
|
4464
4526
|
nextAction: nextActions.join(' | '),
|
|
4465
4527
|
consoleUrl: launchResult.consoleUrl,
|
|
4466
4528
|
hostResults,
|
|
4529
|
+
...(manualActionReason !== undefined ? { reason: manualActionReason, manualActions: hostManualActions } : {}),
|
|
4467
4530
|
journal: installerJournalRecord(journal),
|
|
4468
4531
|
};
|
|
4469
4532
|
return pendingResult;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* merge into it, never overwrite. The marker file is our own bookkeeping
|
|
24
24
|
* for precise uninstall.
|
|
25
25
|
*/
|
|
26
|
-
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
26
|
+
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'fs';
|
|
27
27
|
import { execSync } from 'child_process';
|
|
28
28
|
import * as path from 'path';
|
|
29
29
|
import * as os from 'os';
|
|
@@ -61,7 +61,12 @@ function getErrorCode(err) {
|
|
|
61
61
|
}
|
|
62
62
|
// ─── Path helpers ───────────────────────────────────────────────────────────
|
|
63
63
|
function getCodexDir() {
|
|
64
|
-
|
|
64
|
+
// Shared authority for Marketplace observation and the legacy hook detector.
|
|
65
|
+
// Codex accepts relative CODEX_HOME; path.resolve matches pd-cli's reader.
|
|
66
|
+
const override = process.env.CODEX_HOME;
|
|
67
|
+
return typeof override === 'string' && override.length > 0
|
|
68
|
+
? path.resolve(override)
|
|
69
|
+
: path.join(os.homedir(), '.codex');
|
|
65
70
|
}
|
|
66
71
|
function getCodexHooksJsonPath() {
|
|
67
72
|
return path.join(getCodexDir(), 'hooks.json');
|
|
@@ -209,6 +214,81 @@ export function detectLegacyCodexHookRegistration(hooksJsonPathOverride) {
|
|
|
209
214
|
}
|
|
210
215
|
return { detected, legacyAsyncPostToolUse };
|
|
211
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Same resolution the pd-cli authority uses (resolveCodexHome): the Codex
|
|
219
|
+
* home may be redirected via CODEX_HOME and the Marketplace cache follows
|
|
220
|
+
* that redirect. Like the pd-cli authority, relative paths and parent
|
|
221
|
+
* components are resolved against the current working directory. This is
|
|
222
|
+
* read-only observation of a user-selected Codex home, not a filesystem write.
|
|
223
|
+
*/
|
|
224
|
+
function resolveCodexHomeForMarketplace() {
|
|
225
|
+
return getCodexDir();
|
|
226
|
+
}
|
|
227
|
+
export function detectCodexMarketplaceState(codexHome) {
|
|
228
|
+
const home = codexHome ?? resolveCodexHomeForMarketplace();
|
|
229
|
+
const cachePluginRoot = path.join(home, 'plugins', 'cache', 'principles', 'principles-disciple');
|
|
230
|
+
let entries;
|
|
231
|
+
try {
|
|
232
|
+
const read = readdirSync(cachePluginRoot);
|
|
233
|
+
// rc-4: validating "is array" before iteration — a non-array listing is
|
|
234
|
+
// unverifiable state, never an empty guess.
|
|
235
|
+
if (!Array.isArray(read)) {
|
|
236
|
+
return { state: 'unknown', reason: 'the Codex Marketplace cache listing is not a directory array: ' + cachePluginRoot };
|
|
237
|
+
}
|
|
238
|
+
entries = read;
|
|
239
|
+
}
|
|
240
|
+
catch (err) {
|
|
241
|
+
if (getErrorCode(err) === 'ENOENT')
|
|
242
|
+
return { state: 'not_installed' };
|
|
243
|
+
return {
|
|
244
|
+
state: 'unknown',
|
|
245
|
+
reason: 'cache root unreadable: ' + cachePluginRoot + ' (' + String(err) + ')',
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
const semverPattern = /^(\d+)\.(\d+)\.(\d+)$/;
|
|
249
|
+
let best;
|
|
250
|
+
let unverifiableCandidate;
|
|
251
|
+
for (const versionDir of entries) {
|
|
252
|
+
const match = semverPattern.exec(versionDir);
|
|
253
|
+
if (match === null)
|
|
254
|
+
continue;
|
|
255
|
+
// Parity with the authority (selectMarketplaceCacheVersionDir): the pin
|
|
256
|
+
// must PARSE as a JSON object, not merely exist — a corrupt pin means the
|
|
257
|
+
// candidate is unusable, not installed (a bare existsSync here would
|
|
258
|
+
// claim installed state that pd-cli health refuses).
|
|
259
|
+
const pinFile = path.join(cachePluginRoot, versionDir, 'runtime-version.json');
|
|
260
|
+
let pinValid;
|
|
261
|
+
try {
|
|
262
|
+
const pin = JSON.parse(readFileSync(pinFile, 'utf-8'));
|
|
263
|
+
pinValid = isRecord(pin);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
pinValid = false;
|
|
267
|
+
}
|
|
268
|
+
if (!pinValid) {
|
|
269
|
+
// Presence of an apparently installed version with an unreadable or
|
|
270
|
+
// malformed pin is UNKNOWN, not proof that no plugin was installed.
|
|
271
|
+
unverifiableCandidate ??= pinFile;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
const major = Number.parseInt(match[1] ?? '', 10);
|
|
275
|
+
const minor = Number.parseInt(match[2] ?? '', 10);
|
|
276
|
+
const patch = Number.parseInt(match[3] ?? '', 10);
|
|
277
|
+
if (![major, minor, patch].every((n) => Number.isFinite(n)))
|
|
278
|
+
continue;
|
|
279
|
+
if (best === undefined
|
|
280
|
+
|| major > best.parts[0]
|
|
281
|
+
|| (major === best.parts[0] && (minor > best.parts[1] || (minor === best.parts[1] && patch > best.parts[2])))) {
|
|
282
|
+
best = { dirName: versionDir, parts: [major, minor, patch] };
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (best === undefined) {
|
|
286
|
+
return unverifiableCandidate === undefined
|
|
287
|
+
? { state: 'not_installed' }
|
|
288
|
+
: { state: 'unknown', reason: 'Codex Marketplace version exists but runtime pin cannot be verified: ' + unverifiableCandidate };
|
|
289
|
+
}
|
|
290
|
+
return { state: 'installed', version: best.dirName, versionDir: path.join(cachePluginRoot, best.dirName) };
|
|
291
|
+
}
|
|
212
292
|
// ─── CodexHostInstaller ─────────────────────────────────────────────────────
|
|
213
293
|
export class CodexHostInstaller {
|
|
214
294
|
hostId = 'codex';
|
|
@@ -231,17 +311,38 @@ export class CodexHostInstaller {
|
|
|
231
311
|
hostId: this.hostId,
|
|
232
312
|
configPath: hooksJsonPath,
|
|
233
313
|
configAction: 'skipped',
|
|
314
|
+
manualActionRequired: true,
|
|
234
315
|
reason: 'A legacy PD global Codex hook registration was detected (async PostToolUse in ~/.codex/hooks.json). The legacy global installer is retired (SPEC rev 2 §17) and cannot update it.',
|
|
235
316
|
nextAction: 'Migrate to the Marketplace plugin: 1) npx create-principles-disciple uninstall --host codex (removes ONLY PD-owned entries; evidence is preserved); 2) codex plugin add principles-disciple@principles; 3) run the plugin setup ($pd-control setup) — it presents the ingestion disclosure and records consent.',
|
|
236
317
|
};
|
|
237
318
|
}
|
|
319
|
+
// Marketplace contract (2026-11-07): the retired global-hook installer
|
|
320
|
+
// never writes anything; the Codex end state is reported honestly in
|
|
321
|
+
// three states and never executes the retired registration logic.
|
|
322
|
+
const marketplace = detectCodexMarketplaceState();
|
|
323
|
+
if (marketplace.state === 'installed') {
|
|
324
|
+
return {
|
|
325
|
+
success: true,
|
|
326
|
+
hostId: this.hostId,
|
|
327
|
+
configAction: 'preserved',
|
|
328
|
+
reason: `Codex Marketplace plugin already installed and confirmable (cache version ${marketplace.version}).`,
|
|
329
|
+
nextAction: 'If not done yet, start a Codex session and run the plugin setup ($pd-control setup) — it verifies Node/runtime/workspace/trust and records the conversation-ingestion consent.',
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
// 'not_installed' and 'unknown' both leave a manual step pending. They are
|
|
333
|
+
// NOT failures of anything this installer attempted (it never writes), so
|
|
334
|
+
// they must not trigger other hosts' rollback — the manualActionRequired
|
|
335
|
+
// flag separates them from real failures (installer.ts aggregation).
|
|
238
336
|
return {
|
|
239
337
|
success: false,
|
|
240
338
|
hostId: this.hostId,
|
|
241
339
|
configPath: hooksJsonPath,
|
|
242
340
|
configAction: 'skipped',
|
|
243
|
-
|
|
244
|
-
|
|
341
|
+
manualActionRequired: true,
|
|
342
|
+
reason: marketplace.state === 'not_installed'
|
|
343
|
+
? 'New Codex global hook registrations are retired (SPEC rev 2 §17) and the Marketplace plugin is not installed on this machine. PD will not auto-execute the Marketplace install or edit the Codex plugin config without authorization.'
|
|
344
|
+
: 'New Codex global hook registrations are retired (SPEC rev 2 §17). The Codex Marketplace install state could not be verified: ' + marketplace.reason + '. PD will not guess the state or auto-execute the Marketplace install.',
|
|
345
|
+
nextAction: 'Install the plugin: codex plugin add principles-disciple@principles — then run its setup ($pd-control setup), which verifies Node/runtime/workspace/trust and records the conversation-ingestion consent. Re-run npx create-principles-disciple afterwards; the install is idempotent.',
|
|
245
346
|
};
|
|
246
347
|
}
|
|
247
348
|
async uninstall(_ctx) {
|