create-principles-disciple 1.148.5 → 1.148.8

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.
@@ -108,6 +108,16 @@ export declare class RuleHost {
108
108
  * no live rules are loaded.
109
109
  */
110
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;
111
121
  constructor(stateDir: string, logger?: RuleHostLogger, options?: RuleHostOptions);
112
122
  /**
113
123
  * Update the logger sink on a cached RuleHost instance.
@@ -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.1.4",
5
+ "version": "3.1.5",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -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.1.3",
5
+ "version": "3.1.4",
6
6
  "activation": {
7
7
  "onStartup": true,
8
8
  "onCapabilities": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "principles-disciple",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
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",
@@ -170,6 +170,45 @@ function resolveInstallManifestHosts(host) {
170
170
  }
171
171
  return mergeInstallManifestHosts(current, host);
172
172
  }
173
+ /** Hosts the install manifest already records BEFORE this run attaches its own. */
174
+ function readPersistedInstallHosts() {
175
+ try {
176
+ const parsed = parseInstallManifest(JSON.parse(readFileSync(getInstallManifestPath(), 'utf8')));
177
+ return parsed.manifest ? installManifestHostsForPersist(parsed.manifest) : [];
178
+ }
179
+ catch {
180
+ // Malformed manifests are rejected later by resolveInstallManifestHosts;
181
+ // an unreadable record must never be treated as "this host was installed".
182
+ return [];
183
+ }
184
+ }
185
+ /**
186
+ * Hosts PD already serves whose artifacts this run does NOT touch.
187
+ *
188
+ * The runtime directory (`~/.pd/runtime`) is shared across hosts, but each
189
+ * host's `mcp-binding.json` pins the MCP server version it launches. An
190
+ * install/update scoped to ONE host (`--host openclaw` is the default) replaces
191
+ * that shared runtime and silently leaves every other installed host bound to
192
+ * the previous MCP server version — the host then fails closed at launch with
193
+ * `binding_version_mismatch`. Those previously installed hosts must be
194
+ * refreshed in the same run, otherwise a routine update breaks them until the
195
+ * operator happens to re-run the installer for each one.
196
+ *
197
+ * WorkBuddy stays opt-in (OD-03): 'all' never attaches it here, but a manifest
198
+ * that ALREADY records it must be refreshed like any other served host.
199
+ */
200
+ export function resolveHostRefreshTargets(persistedHosts, host) {
201
+ const covered = new Set(host === 'all' ? ['openclaw', 'codex'] : [host]);
202
+ const targets = [];
203
+ for (const persisted of persistedHosts) {
204
+ if (persisted !== 'openclaw' && persisted !== 'codex' && persisted !== 'workbuddy')
205
+ continue;
206
+ if (covered.has(persisted) || targets.includes(persisted))
207
+ continue;
208
+ targets.push(persisted);
209
+ }
210
+ return targets;
211
+ }
173
212
  /**
174
213
  * PRI-624 Slice C: the install manifest records every Workspace this install
175
214
  * serves so the Companion can discover its per-Workspace workers (SPEC §13
@@ -4041,6 +4080,7 @@ transaction) {
4041
4080
  // Validate the existing host-ownership record before mutating runtime or
4042
4081
  // host config. A malformed manifest must not be discovered only after the
4043
4082
  // old installation has already been replaced (rc-3/rc-9).
4083
+ const persistedHostsBeforeRun = readPersistedInstallHosts();
4044
4084
  installManifestHosts = resolveInstallManifestHosts(options.host);
4045
4085
  if (installsOpenClaw(options.host))
4046
4086
  migrateLegacyPdBackups();
@@ -4300,7 +4340,7 @@ transaction) {
4300
4340
  stepIndex++;
4301
4341
  if (spinner)
4302
4342
  updateProgress(spinner, stepIndex, 'Updating host config...');
4303
- const hostResults = await runHostInstallers(options.host, {
4343
+ const hostInstallCtx = {
4304
4344
  workspaceDir: options.workspaceDir,
4305
4345
  pluginDir,
4306
4346
  language: options.language,
@@ -4313,7 +4353,8 @@ transaction) {
4313
4353
  baseUrl: options.runtimeProfile.baseUrl,
4314
4354
  }
4315
4355
  : undefined,
4316
- });
4356
+ };
4357
+ const hostResults = await runHostInstallers(options.host, hostInstallCtx);
4317
4358
  // Report host install results (rc-9: surface failures, don't silently swallow).
4318
4359
  // rc-9 propagation: if ANY host installer FAILED, the aggregate install
4319
4360
  // result is NOT successful — callers (CLI, tests) must see the failure.
@@ -4342,6 +4383,27 @@ transaction) {
4342
4383
  if (hostFailures.length > 0) {
4343
4384
  throw new Error(`Host installation failed: ${hostFailureMessages.join(' | ')}`);
4344
4385
  }
4386
+ // Shared-runtime consistency: this run replaced `~/.pd/runtime`, so every
4387
+ // OTHER host already recorded in the manifest still pins the previous MCP
4388
+ // server version in its own mcp-binding.json and would fail closed at the
4389
+ // next launch (binding_version_mismatch). Refresh them through their real
4390
+ // host installers here — best effort only: the requested host succeeded,
4391
+ // and a sibling refresh failure must not roll back the working runtime.
4392
+ const refreshTargets = resolveHostRefreshTargets(persistedHostsBeforeRun, options.host);
4393
+ for (const refreshTarget of refreshTargets) {
4394
+ if (spinner)
4395
+ updateProgress(spinner, stepIndex, `Refreshing ${refreshTarget} host binding...`);
4396
+ const refreshResults = await runHostInstallers(refreshTarget, hostInstallCtx);
4397
+ for (const hr of refreshResults) {
4398
+ if (hr.success) {
4399
+ logger.info(`Host "${hr.hostId}" refreshed for the new runtime${hr.reason ? `: ${hr.reason}` : ''}.`);
4400
+ }
4401
+ else {
4402
+ // rc-9: never silent — state the reason and the exact recovery step.
4403
+ logger.warn(`Host "${hr.hostId}" refresh failed: ${hr.reason ?? 'unknown failure'}. Next: ${hr.nextAction ?? `npx create-principles-disciple install --host ${hr.hostId}`}`);
4404
+ }
4405
+ }
4406
+ }
4345
4407
  // Manual-action hosts (e.g. Codex awaiting the Marketplace step) STAY in
4346
4408
  // the install manifest: the manifest records the hosts PD serves on this
4347
4409
  // machine (uninstall reads it to decide shared-runtime removal), not a
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-principles-disciple",
3
- "version": "1.148.5",
3
+ "version": "1.148.8",
4
4
  "description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
5
5
  "type": "module",
6
6
  "bin": {