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.
@@ -18,9 +18,14 @@ function isRecord(value) {
18
18
  function patchTargets(params, projectDir) {
19
19
  if (params === null)
20
20
  return undefined;
21
+ // Native Codex sends the patch body under `tool_input.command`
22
+ // (`{"command":"*** Begin Patch..."}`); older/embedded callers use
23
+ // `patch` or `input`. All three carry the same `*** <op> File:` headers.
21
24
  const patch = typeof params.patch === 'string'
22
25
  ? params.patch
23
- : typeof params.input === 'string' ? params.input : null;
26
+ : typeof params.input === 'string'
27
+ ? params.input
28
+ : typeof params.command === 'string' ? params.command : null;
24
29
  if (patch === null || Buffer.byteLength(patch, 'utf8') > MAX_PATCH_BYTES)
25
30
  return undefined;
26
31
  const targets = [];
@@ -194,6 +194,39 @@ export function createProductionRuleHostGate(options = {}) {
194
194
  metadata: { evaluatedLiveRules: 0 },
195
195
  };
196
196
  }
197
+ // PRI-1044 step 3-1: an ACTIVE activation whose pi_artifacts row is gone
198
+ // is invisible to the candidate query below (INNER JOIN), so the gate
199
+ // reported `no_rules_armed` and enforced nothing with no trace at all
200
+ // (observed: 8+ hours of silent non-enforcement). Detect the dangling
201
+ // reference explicitly: the fail-open availability posture is unchanged,
202
+ // but the gap becomes Owner-visible (rc-9) through a structured warning
203
+ // that names the activation AND the durable out-of-workspace marker, so
204
+ // it survives the host's per-call log buffer.
205
+ const danglingArtifacts = connection.getDb().prepare(`
206
+ SELECT a.activation_id, a.artifact_id
207
+ FROM activations a
208
+ WHERE a.channel = 'code_tool_hook' AND a.deactivated_at IS NULL
209
+ AND NOT EXISTS (SELECT 1 FROM pi_artifacts p WHERE p.artifact_id = a.artifact_id)
210
+ ORDER BY a.activated_at ASC
211
+ `).all();
212
+ if (!Array.isArray(danglingArtifacts)) {
213
+ addWarning(warnings, 'activation_artifact_reference_query_invalid', 'inspect state.db schema and integrity');
214
+ }
215
+ else {
216
+ const missingArtifacts = [];
217
+ for (const dangling of danglingArtifacts) {
218
+ if (!isRecord(dangling) || typeof dangling.activation_id !== 'string') {
219
+ addWarning(warnings, 'activation_artifact_reference_invalid', 'inspect state.db activation rows and integrity');
220
+ continue;
221
+ }
222
+ const artifactLabel = typeof dangling.artifact_id === 'string' ? dangling.artifact_id : 'unknown';
223
+ missingArtifacts.push(`${dangling.activation_id}->${artifactLabel}`);
224
+ addWarning(warnings, `activation_artifact_missing: activation=${dangling.activation_id} artifact=${artifactLabel}`, 'restore the referenced pi_artifacts row or deactivate the stale activation; the rule did not run');
225
+ }
226
+ if (missingArtifacts.length > 0) {
227
+ recordDegradedEnforcement(event.context.workspaceDir, `activation_artifact_missing: ${missingArtifacts.join(', ')}`.slice(0, 300));
228
+ }
229
+ }
197
230
  const rows = connection.getDb().prepare(`
198
231
  SELECT a.activation_id, a.artifact_id, a.target_ref, a.action,
199
232
  c.enforcement, c.isolation_decision_id,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/host-runtime",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/package.json CHANGED
@@ -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": {
@@ -99,7 +99,7 @@
99
99
  "directory": "packages/create-principles-disciple"
100
100
  },
101
101
  "pd": {
102
- "bundledPluginVersion": "3.1.3"
102
+ "bundledPluginVersion": "3.1.4"
103
103
  },
104
- "gitHead": "4000adc495a7c146f4d9282c114d0d936d8e196a"
104
+ "gitHead": "716789d80d4308eac4f3d224ea68a6961331b047"
105
105
  }