@askalf/dario 5.4.10 → 5.4.11

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.
@@ -42,8 +42,14 @@ export declare function scrubTemplate(data: TemplateData): TemplateData;
42
42
  */
43
43
  export declare function scrubText(text: string): string;
44
44
  /**
45
- * Run over a string and report any user-identifying patterns that remain.
46
- * Used by `scripts/check-cc-drift.mjs` to verify the baked template
47
- * passes scrubbing before a release goes out.
45
+ * Run over a string and report anything that must not survive into a bake:
46
+ * user-identifying paths, host-context sections the strip missed, and
47
+ * instruction-file prose (dario#872). Despite the name the contract has never
48
+ * been paths-only. Used by `scripts/check-cc-drift.mjs` to gate a release and
49
+ * by `scripts/capture-and-bake.mjs` to fail a bake.
50
+ *
51
+ * Deliberately NOT called from `extractTemplate`: that serves the live-capture
52
+ * path too, and the live fingerprint keeps host context on purpose — it exists
53
+ * to replay the operator's own CC install faithfully. Only the bake publishes.
48
54
  */
49
55
  export declare function findUserPathHits(text: string): string[];
@@ -222,9 +222,44 @@ function scrubObjectStrings(value) {
222
222
  return value;
223
223
  }
224
224
  /**
225
- * Run over a string and report any user-identifying patterns that remain.
226
- * Used by `scripts/check-cc-drift.mjs` to verify the baked template
227
- * passes scrubbing before a release goes out.
225
+ * Prose CC emits when it injects user- or project-level instruction files
226
+ * (CLAUDE.md, memory, environment) into a prompt. The section strip above is
227
+ * keyed on the `# claudeMd` heading shape; these are keyed on the wrapper text
228
+ * itself, so a reshaped or renamed heading still gets caught.
229
+ *
230
+ * Both halves are load-bearing. `removeSection` and the heading detector in
231
+ * findUserPathHits read the SAME heading list, so a heading CC renames strips
232
+ * nothing and flags nothing — two silent failures — and once paths are scrubbed
233
+ * the leftover prose carries no user path for the other detectors to catch.
234
+ * dario#872 saw one capture in six come back carrying another session's
235
+ * instruction text; this is the half that does not depend on the heading.
236
+ *
237
+ * Every marker is verified absent from the real baked template — base, fable,
238
+ * opus-5 and sonnet-5 prompts plus every tool description. Do NOT add bare
239
+ * `CLAUDE.md` or `system-reminder`: CC's own system prompt and tool
240
+ * descriptions both mention them, so either would fail every bake. Verified,
241
+ * not assumed, and test/context-bleed.mjs pins it.
242
+ */
243
+ const INSTRUCTION_INJECTION_MARKERS = [
244
+ { label: 'instruction-file wrapper', re: /Codebase and user instructions are shown below/ },
245
+ { label: 'instruction-file wrapper', re: /IMPORTANT: These instructions OVERRIDE any default behavior/ },
246
+ // Straight and typographic apostrophe both — CC emits the straight one today,
247
+ // and a marker that a quote-style change silently disarms is not a guard.
248
+ { label: 'instruction-file annotation', re: /user['’]s private global instructions/ },
249
+ { label: 'memory-file annotation', re: /auto-memory, persists across conversations/ },
250
+ { label: 'instruction-file heading', re: /\bContents of [^\n]{1,300}\.md\b/ },
251
+ { label: 'project-instruction wrapper', re: /Here are useful instructions from/ },
252
+ ];
253
+ /**
254
+ * Run over a string and report anything that must not survive into a bake:
255
+ * user-identifying paths, host-context sections the strip missed, and
256
+ * instruction-file prose (dario#872). Despite the name the contract has never
257
+ * been paths-only. Used by `scripts/check-cc-drift.mjs` to gate a release and
258
+ * by `scripts/capture-and-bake.mjs` to fail a bake.
259
+ *
260
+ * Deliberately NOT called from `extractTemplate`: that serves the live-capture
261
+ * path too, and the live fingerprint keeps host context on purpose — it exists
262
+ * to replay the operator's own CC install faithfully. Only the bake publishes.
228
263
  */
229
264
  export function findUserPathHits(text) {
230
265
  const hits = [];
@@ -249,5 +284,13 @@ export function findUserPathHits(text) {
249
284
  hits.push(`# ${name} (host-context section not stripped)`);
250
285
  }
251
286
  }
287
+ // Instruction-file prose, matched on the wrapper rather than the heading.
288
+ // Excerpt is bounded: a hit is printed by the bake, and the whole point is
289
+ // that the matched text may be somebody's private instructions.
290
+ for (const { label, re } of INSTRUCTION_INJECTION_MARKERS) {
291
+ const m = text.match(re);
292
+ if (m)
293
+ hits.push(`${m[0].slice(0, 60)} (${label} not stripped)`);
294
+ }
252
295
  return hits;
253
296
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "5.4.10",
3
+ "version": "5.4.11",
4
4
  "description": "Use your Claude Pro/Max subscription in any tool — Cursor, Cline, Aider, the Agent SDK, your scripts — at subscription pricing, not per-token API bills. One local Anthropic + OpenAI-compatible endpoint.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "tsc && cp src/cc-template-data.json dist/",
24
24
  "test": "node --test --test-concurrency=8 test/all.test.mjs",
25
- "test:serial": "node test/issue-29-tool-translation.mjs && node test/hybrid-tools.mjs && node test/tool-schema-contract.mjs && node test/scrub-paths.mjs && node test/provider-prefix.mjs && node test/analytics-recording.mjs && node test/analytics-billing-bucket.mjs && node test/failover-429.mjs && node test/pool-sticky.mjs && node test/live-fingerprint.mjs && node test/proxy-header-order.mjs && node test/proxy-body-order.mjs && node test/runtime-fingerprint.mjs && node test/pacing.mjs && node test/stream-drain.mjs && node test/subagent.mjs && node test/mcp-protocol.mjs && node test/mcp-tools.mjs && node test/mcp-e2e.mjs && node test/session-rotation.mjs && node test/drift-detection.mjs && node test/cc-authorize-probe-classifier.mjs && node test/compat-range.mjs && node test/doctor-formatter.mjs && node test/doctor-identity-drift.mjs && node test/atomic-write.mjs && node test/account-refresh-singleflight.mjs && node test/durable-token-persist.mjs && node test/streaming-edge-cases.mjs && node test/client-detection.mjs && node test/manual-oauth-flow.mjs && node test/scrub-template.mjs && node test/sanitize-messages.mjs && node test/platform-tools.mjs && node test/strict-template-flags.mjs && node test/request-queue.mjs && node test/effort-flag.mjs && node test/template-invariants.mjs",
25
+ "test:serial": "node test/issue-29-tool-translation.mjs && node test/hybrid-tools.mjs && node test/tool-schema-contract.mjs && node test/scrub-paths.mjs && node test/provider-prefix.mjs && node test/analytics-recording.mjs && node test/analytics-billing-bucket.mjs && node test/failover-429.mjs && node test/pool-sticky.mjs && node test/live-fingerprint.mjs && node test/proxy-header-order.mjs && node test/proxy-body-order.mjs && node test/runtime-fingerprint.mjs && node test/pacing.mjs && node test/stream-drain.mjs && node test/subagent.mjs && node test/mcp-protocol.mjs && node test/mcp-tools.mjs && node test/mcp-e2e.mjs && node test/session-rotation.mjs && node test/drift-detection.mjs && node test/cc-authorize-probe-classifier.mjs && node test/compat-range.mjs && node test/doctor-formatter.mjs && node test/doctor-identity-drift.mjs && node test/atomic-write.mjs && node test/account-refresh-singleflight.mjs && node test/durable-token-persist.mjs && node test/streaming-edge-cases.mjs && node test/client-detection.mjs && node test/manual-oauth-flow.mjs && node test/scrub-template.mjs && node test/context-bleed.mjs && node test/sanitize-messages.mjs && node test/platform-tools.mjs && node test/strict-template-flags.mjs && node test/request-queue.mjs && node test/effort-flag.mjs && node test/template-invariants.mjs",
26
26
  "audit": "npm audit --production --audit-level=high",
27
27
  "prepublishOnly": "npm run build",
28
28
  "start": "node dist/cli.js",