@clipy/cli 0.8.1 → 0.8.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/README.md CHANGED
@@ -150,9 +150,15 @@ to headless web capture on `record` and `session start`; they're rejected on
150
150
  of an ephemeral context (`launchPersistentContext`), so the recording carries that
151
151
  profile's whole logged-in identity. Web only; **mutually exclusive with
152
152
  `--storage-state`** (a profile already carries its own storage). `--cookie` /
153
- `--local-storage` / `--init-script` still compose. Point it at a **copy** or a
154
- dedicated profile — never your live Chrome's default profile: Chrome locks a profile
155
- while it's open, so Clipy refuses a dir that has a `SingletonLock`/`SingletonSocket`.
153
+ `--local-storage` / `--init-script` still compose. Chrome locks a profile while it's
154
+ open, so Clipy refuses a dir that has a `SingletonLock`/`SingletonSocket`. Two ways to
155
+ point it at a real logged-in profile:
156
+ - **Quit Chrome, then point at the real profile dir.** No copy needed and you record
157
+ with full identity — but the recorder writes to that profile, so quit Chrome first
158
+ (that's what clears the `Singleton*` locks) and expect it to have your live session.
159
+ - **Copy the profile out and strip the locks** (`cp -R "<profile>" ./clipy-profile &&
160
+ rm -f ./clipy-profile/Singleton*`) for isolation from your live browser, at the cost
161
+ of duplicating a (large) profile dir. The profile owner's call.
156
162
 
157
163
  ```bash
158
164
  # Reuse a saved Playwright login
@@ -305,14 +311,17 @@ clip. If any assertion was attempted, a leading `[verification] N assertion(s):
305
311
  F failed[, K unverified]` note is prepended at 0 ms, so the transcript and the `.md` context
306
312
  open with the scorecard.
307
313
 
308
- **A mark is never dropped.** If the daemon can't be reached to evaluate an assertion — its
309
- event loop briefly starved during a heavy dev-server recompile, say — `clipy mark` doesn't
310
- fail and lose the note. It records the narration anyway, tags it
311
- `[ASSERT ⚠ could not evaluate — <reason>]`, prints a loud `⚠`, and exits 0. An unverified
312
- claim is flagged as unverified (the `K` in the tally), never silently promoted to a `✓`. If
313
- the daemon was only slow (not gone) and processes the same mark a moment later, a
314
- client-generated id dedups the two so the evaluated copy wins and the mark appears exactly
315
- once.
314
+ **A mark is never dropped, and a late verdict never rewrites it.** If the daemon can't be
315
+ reached to evaluate an assertion — its event loop briefly starved during a heavy dev-server
316
+ recompile, say — `clipy mark` doesn't fail and lose the note. It records the narration
317
+ anyway, tags it `[ASSERT ⚠ could not evaluate — <reason>]`, prints a loud `⚠`, and exits 0.
318
+ An unverified claim is flagged as unverified (the `K` in the tally), never silently promoted
319
+ to a `✓`. That ⚠ is the **mark of record**: if the daemon was only slow (not gone) and
320
+ evaluates the same claim a moment later, that verdict judged a *later* page state, so it does
321
+ **not** overwrite the ⚠. It's recorded as a separate, honestly-timestamped
322
+ `[late check of "…" — evaluated Ns after the claim: …]` note at the moment it actually ran,
323
+ and it counts toward neither passed, failed, nor unverified. (Plain, non-asserted marks that
324
+ the daemon later processes are simply deduped — they appear exactly once.)
316
325
 
317
326
  Assertions evaluate against a real page, so they need a **web** session (they're rejected on
318
327
  `--source mac-screen`, which records the real screen with no page to probe).
@@ -364,6 +373,14 @@ clipy mark "the toast appeared" --ago 2 # 2 seconds before now
364
373
  clipy mark "page finished loading" --at 4 # at an absolute 4s on the recording clock
365
374
  ```
366
375
 
376
+ Backdating an **asserted** mark is a subtlety: the mark lands at the backdated time, but the
377
+ assertion still judges the **live** page (the daemon can't rewind). When the verdict was
378
+ observed more than 2 s from the backdated position, the mark stays where you put it and the
379
+ text gains `(assertion observed Ns after this backdated mark — the verdict describes the page
380
+ at observation time)`, with a signed `assert.driftSec` in `--json` — so a ✓/✗ is never read
381
+ as describing the earlier moment. Live-clock asserted marks and backdated plain marks are
382
+ unaffected.
383
+
367
384
  ## Record the real screen — a window, a display (Mac)
368
385
 
369
386
  `--source mac-screen` on `record` / `session start` records through the **running Clipy
package/dist/index.js CHANGED
@@ -2931,27 +2931,15 @@ async function runSessionDaemon(file) {
2931
2931
  return;
2932
2932
  autoMarks.push({ startMs: Math.max(0, Date.now() - recordStart), text });
2933
2933
  };
2934
- // Marks that arrive over the control endpoint (`clipy mark`/`chapter`) or the
2935
- // in-page __clipyMark/__clipyChapter bindings. Kept in memory (like autoMarks)
2936
- // and merged at stop. A hard 200 cap here is the server limit; storeDaemonMark
2937
- // refuses past it so `clipy mark` gets an error rather than a silent drop.
2938
2934
  const daemonMarks = [];
2939
- const storeDaemonMark = (note) => {
2935
+ const storeDaemonMark = (m) => {
2940
2936
  if (daemonMarks.length >= 200)
2941
2937
  return false;
2942
- daemonMarks.push(note);
2938
+ daemonMarks.push(m);
2943
2939
  return true;
2944
2940
  };
2945
- // Assertion tallies → the leading [verification] note at stop.
2946
- let assertRan = 0;
2947
- let assertPassed = 0;
2948
- let assertFailed = 0;
2949
2941
  // A failed --fail-mode=abort assertion sets this; the main loop discards.
2950
2942
  let controlSignal = null;
2951
- // Client-generated ids of marks/chapters we processed over HTTP — so at merge
2952
- // we can drop a file duplicate the client wrote after its call timed out but
2953
- // the daemon actually completed it.
2954
- const processedMarkIds = new Set();
2955
2943
  mkdirSync(state.tmpDir, { recursive: true });
2956
2944
  let browser = null;
2957
2945
  // Persistent (--user-data-dir) contexts have no separate browser, so track the
@@ -3044,31 +3032,46 @@ async function runSessionDaemon(file) {
3044
3032
  const tMs = typeof m.atMs === "number" && Number.isFinite(m.atMs)
3045
3033
  ? Math.max(0, Math.round(m.atMs))
3046
3034
  : Math.max(0, Date.now() - recordStart);
3035
+ const evalAtMs = Math.max(0, Date.now() - recordStart);
3047
3036
  let annotated = text;
3048
3037
  let assertOut;
3038
+ let assertOutcome;
3049
3039
  let aborted = false;
3050
3040
  if (m.assert && typeof m.assert === "object") {
3051
3041
  // evaluateAssertion throws if the page is unresponsive — the HTTP path
3052
3042
  // turns that into a 5xx (the CLI then records a ⚠ UNVERIFIED file mark),
3053
3043
  // and the in-page path rejects to the driver.
3054
3044
  const ev = await evaluateAssertion(page, m.assert);
3055
- assertRan++;
3056
- if (ev.passed)
3057
- assertPassed++;
3058
- else
3059
- assertFailed++;
3060
3045
  annotated = ev.passed
3061
3046
  ? `${text} [assert ✓ ${ev.observed}]`
3062
3047
  : `${text} [ASSERT ✗ expected ${ev.expected}; observed ${ev.observed}]`;
3063
3048
  assertOut = { passed: ev.passed, observed: ev.observed };
3049
+ assertOutcome = { passed: ev.passed, expected: ev.expected, observed: ev.observed };
3064
3050
  if (!ev.passed && m.assert.failMode === "abort")
3065
3051
  aborted = true;
3052
+ // Backdated assertion divergence: a --at/--ago mark is stamped in the past
3053
+ // but the assertion judged the LIVE page. If the verdict was observed more
3054
+ // than 2s from the backdated position, keep the mark where the agent put it
3055
+ // but say so in the text (and expose a signed drift), so the ✓/✗ isn't read
3056
+ // as describing the page at the backdated moment. Live-clock asserted marks
3057
+ // (no atMs) and backdated PLAIN marks get nothing.
3058
+ if (m.atMs != null) {
3059
+ const driftMs = evalAtMs - tMs; // + = observed AFTER the backdated stamp
3060
+ if (Math.abs(driftMs) > 2000) {
3061
+ const n = Math.round(Math.abs(driftMs) / 1000);
3062
+ const dir = driftMs >= 0 ? "after" : "before";
3063
+ annotated += ` (assertion observed ${n}s ${dir} this backdated mark — the verdict describes the page at observation time)`;
3064
+ assertOut.driftSec = Math.round(driftMs / 1000); // signed, for --json
3065
+ }
3066
+ }
3066
3067
  }
3067
- if (!storeDaemonMark({ startMs: tMs, text: annotated })) {
3068
+ // Store the provisional mark of record at the claim time. The merge decides
3069
+ // whether it stays the record (no client timeout) or becomes a late check
3070
+ // (the client already wrote a ⚠ mark of record for this id). P/F is counted
3071
+ // at merge from assertOutcome, so a late eval never lands in the tally.
3072
+ if (!storeDaemonMark({ startMs: tMs, text: annotated, id: m.id, evalAtMs, claim: text, assertOutcome })) {
3068
3073
  throw new Error("mark limit reached (200 marks per recording)");
3069
3074
  }
3070
- if (m.id)
3071
- processedMarkIds.add(m.id);
3072
3075
  if (aborted)
3073
3076
  controlSignal = "abort";
3074
3077
  return {
@@ -3084,9 +3087,12 @@ async function runSessionDaemon(file) {
3084
3087
  // daemon-side assertion + annotation as the CLI flags, at ZERO spawn cost.
3085
3088
  // NOTE: while CDP is exposed the page's own scripts can call these too —
3086
3089
  // within the existing --expose-cdp trust model (documented in the README).
3090
+ // The bindings are exposed under *Impl names and re-declared with explicit
3091
+ // arity below, so an agent probing window.__clipyMark.length sees 2 (not the
3092
+ // 0 an exposeBinding wrapper reports).
3087
3093
  if (wantCdp) {
3088
3094
  await context
3089
- .exposeBinding("__clipyMark", async (_src, ...args) => {
3095
+ .exposeBinding("__clipyMarkImpl", async (_src, ...args) => {
3090
3096
  if (recordStart === 0)
3091
3097
  return { skipped: true };
3092
3098
  const o = (args[1] ?? {});
@@ -3108,7 +3114,7 @@ async function runSessionDaemon(file) {
3108
3114
  })
3109
3115
  .catch((e) => log(`__clipyMark binding failed: ${e.message}`));
3110
3116
  await context
3111
- .exposeBinding("__clipyChapter", (_src, ...args) => {
3117
+ .exposeBinding("__clipyChapterImpl", (_src, ...args) => {
3112
3118
  if (recordStart === 0)
3113
3119
  return;
3114
3120
  const label = String(args[0] ?? "").trim();
@@ -3117,6 +3123,14 @@ async function runSessionDaemon(file) {
3117
3123
  }
3118
3124
  })
3119
3125
  .catch((e) => log(`__clipyChapter binding failed: ${e.message}`));
3126
+ // Declared-arity wrappers so window.__clipyMark.length === 2 / __clipyChapter
3127
+ // === 1 (they resolve the *Impl bindings lazily, at call time).
3128
+ await context
3129
+ .addInitScript({
3130
+ content: "window.__clipyMark = (text, opts) => window.__clipyMarkImpl(text, opts);\n" +
3131
+ "window.__clipyChapter = (label) => window.__clipyChapterImpl(label);",
3132
+ })
3133
+ .catch((e) => log(`in-page binding wrappers failed: ${e.message}`));
3120
3134
  }
3121
3135
  // Local control endpoint: `clipy mark`/`chapter` POST here so the daemon —
3122
3136
  // which owns the live page — evaluates assertions and stamps marks on its
@@ -3133,17 +3147,20 @@ async function runSessionDaemon(file) {
3133
3147
  assert: body.assert,
3134
3148
  id: typeof body.id === "string" ? body.id : undefined,
3135
3149
  });
3136
- /** POST /chapter → a === CHAPTER === mark at the live clock. */
3150
+ /** POST /chapter → a === CHAPTER === mark at the live clock. Carries its
3151
+ * client id so a timed-out-but-processed chapter dedups against the file. */
3137
3152
  const handleChapter = (body) => {
3138
3153
  const label = typeof body.label === "string" ? body.label.trim() : "";
3139
3154
  if (!label)
3140
3155
  throw new Error("chapter label is required");
3141
3156
  const tMs = Math.max(0, Date.now() - recordStart);
3142
- if (!storeDaemonMark({ startMs: tMs, text: `=== CHAPTER: ${label} ===` })) {
3157
+ if (!storeDaemonMark({
3158
+ startMs: tMs,
3159
+ text: `=== CHAPTER: ${label} ===`,
3160
+ id: typeof body.id === "string" ? body.id : undefined,
3161
+ })) {
3143
3162
  throw new Error("mark limit reached (200 marks per recording)");
3144
3163
  }
3145
- if (typeof body.id === "string" && body.id)
3146
- processedMarkIds.add(body.id);
3147
3164
  return { tMs };
3148
3165
  };
3149
3166
  const BODY_CAP = 1_000_000;
@@ -3303,12 +3320,16 @@ async function runSessionDaemon(file) {
3303
3320
  if (browser)
3304
3321
  await browser.close().catch(() => { });
3305
3322
  browser = null;
3306
- // Merge marks from three sources: the file (fallback path, written by
3307
- // `clipy mark` when the control endpoint was unreachable), the daemon-side
3308
- // marks (control endpoint + in-page bindings, already assertion-annotated),
3309
- // and the [auto] instrumentation marks.
3323
+ // Merge marks. The FILE is the mark of record: `clipy mark` writes there when
3324
+ // its control call fails, and a timed-out ASSERTION is recorded ⚠-unverified.
3325
+ // That ⚠ is authoritative — if the daemon later evaluated the same mark, that
3326
+ // late verdict must NOT overwrite the ⚠ (it judged a LATER page state), so we
3327
+ // keep the ⚠ and re-stamp the late evaluation as a self-describing "late check"
3328
+ // at its own time. K counts the ⚠; the late check counts toward neither P/F/K.
3310
3329
  const fileMarks = [];
3311
- let assertUnverified = 0;
3330
+ const unverifiedClaimById = new Map(); // id → claim time (ms)
3331
+ const abandonedIds = new Set(); // any id the client wrote to the file
3332
+ let assertUnverified = 0; // K
3312
3333
  try {
3313
3334
  for (const line of readFileSync(state.marksPath, "utf8").split("\n")) {
3314
3335
  if (!line.trim())
@@ -3316,24 +3337,62 @@ async function runSessionDaemon(file) {
3316
3337
  const m = JSON.parse(line);
3317
3338
  if (typeof m.tMs !== "number" || typeof m.text !== "string" || !m.text.trim())
3318
3339
  continue;
3319
- // Dedup: the daemon already processed this mark over HTTP (the client's
3320
- // control call timed out, but the daemon completed it) — keep the daemon's
3321
- // evaluated copy, drop this file duplicate.
3322
- if (m.id && processedMarkIds.has(m.id))
3323
- continue;
3324
- fileMarks.push({ startMs: Math.max(0, Math.round(m.tMs)), text: m.text.trim() });
3325
- if (m.unverified)
3326
- assertUnverified++; // ⚠ marks the CLI recorded but couldn't verify
3340
+ const startMs = Math.max(0, Math.round(m.tMs));
3341
+ fileMarks.push({ startMs, text: m.text.trim() }); // the mark of record, verbatim
3342
+ if (m.id) {
3343
+ abandonedIds.add(m.id);
3344
+ if (m.unverified) {
3345
+ unverifiedClaimById.set(m.id, startMs);
3346
+ assertUnverified++;
3347
+ }
3348
+ }
3327
3349
  }
3328
3350
  }
3329
3351
  catch {
3330
3352
  // no marks file — fine
3331
3353
  }
3332
- let notes = [...fileMarks, ...daemonMarks, ...autoMarks].sort((a, b) => a.startMs - b.startMs);
3333
- // If any assertion was ATTEMPTED (evaluated pass/fail OR recorded ⚠-unverified),
3334
- // prepend a 0ms verification summary so it LEADS the transcript (a stable sort
3335
- // keeps it ahead of other 0ms marks). The K-unverified clause is omitted when
3336
- // K=0 so existing renderings don't churn.
3354
+ // Resolve the daemon marks against the file marks of record.
3355
+ const resolvedDaemon = [];
3356
+ let assertPassed = 0;
3357
+ let assertFailed = 0;
3358
+ for (const dm of daemonMarks) {
3359
+ if (dm.id && unverifiedClaimById.has(dm.id)) {
3360
+ // The client already recorded a ⚠ mark of record for this assertion; this
3361
+ // daemon copy is a LATE evaluation. Emit it as a separate, honestly-timed
3362
+ // "late check" annotation (not counted in P/F/K).
3363
+ const claimMs = unverifiedClaimById.get(dm.id);
3364
+ const evalAt = Math.max(0, dm.evalAtMs ?? dm.startMs);
3365
+ const afterSec = Math.max(0, Math.round((evalAt - claimMs) / 1000));
3366
+ const oc = dm.assertOutcome;
3367
+ const verdict = oc
3368
+ ? oc.passed
3369
+ ? `✓ ${oc.observed}`
3370
+ : `✗ expected ${oc.expected}; observed ${oc.observed}`
3371
+ : "(no result)";
3372
+ resolvedDaemon.push({
3373
+ startMs: evalAt,
3374
+ text: `[late check of "${dm.claim ?? ""}" — evaluated ${afterSec}s after the claim: ${verdict}]`,
3375
+ });
3376
+ continue;
3377
+ }
3378
+ if (dm.id && abandonedIds.has(dm.id)) {
3379
+ // A plain mark/chapter the client already wrote to the file — dedup, the
3380
+ // file copy is the mark of record. (Exactly once.)
3381
+ continue;
3382
+ }
3383
+ resolvedDaemon.push({ startMs: dm.startMs, text: dm.text });
3384
+ if (dm.assertOutcome) {
3385
+ if (dm.assertOutcome.passed)
3386
+ assertPassed++;
3387
+ else
3388
+ assertFailed++;
3389
+ }
3390
+ }
3391
+ let notes = [...fileMarks, ...resolvedDaemon, ...autoMarks].sort((a, b) => a.startMs - b.startMs);
3392
+ // If any ORIGINAL assertion was attempted (evaluated pass/fail, or recorded
3393
+ // ⚠-unverified), prepend a 0ms verification summary so it LEADS the transcript
3394
+ // (a stable sort keeps it ahead of other 0ms marks). The K clause is omitted
3395
+ // when K=0 so existing renderings don't churn. Late checks don't count.
3337
3396
  const assertN = assertPassed + assertFailed + assertUnverified;
3338
3397
  if (assertN > 0) {
3339
3398
  const tally = `${assertN} assertion(s): ${assertPassed} passed, ${assertFailed} failed` +
@@ -3482,7 +3541,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
3482
3541
  // command's shape without trial-and-error. Bump GUIDE_SCHEMA_VERSION when the
3483
3542
  // contract changes.
3484
3543
  // ---------------------------------------------------------------------------
3485
- const GUIDE_SCHEMA_VERSION = 6;
3544
+ const GUIDE_SCHEMA_VERSION = 7;
3486
3545
  function cmdGuide(json) {
3487
3546
  if (!json) {
3488
3547
  process.stdout.write(HELP);
@@ -3552,10 +3611,10 @@ function cmdGuide(json) {
3552
3611
  "--note is absolute ('12: text') or pass-scoped ('pass2: text' / 'pass2@5: text'); pass-scoped notes anchor to the real start of a --viewports pass, so they don't drift when load time shifts the pass boundaries. A malformed pass note (e.g. 'pass2 text' with no colon) is a usage error, not silently demoted.",
3553
3612
  "--type declares what a recording IS (bug_report/feature_request/product_demo/walkthrough_tutorial/feedback_review/discussion_talk/other, plus short aliases) so the AI summary doesn't misread a demo as a bug report. Applied on web today; --source mac-screen support is pending a Clipy app update.",
3554
3613
  "Assertion marks are the differentiator: assert what you claim. `clipy mark \"X\" --assert-selector '.status' --assert-text Active` records X only alongside the live-page truth — the daemon runs the check against its Playwright page and annotates the mark ✓/✗ with what it actually observed, so a false claim cannot pass as fact in the transcript. --fail-mode abort turns a failed assertion into a discarded session (nothing uploaded, non-zero exit). Assertions need a web session and the daemon's control endpoint (started by clipy 0.6+); they are rejected on --source mac-screen.",
3555
- "A mark is NEVER dropped. If the daemon can't be reached to evaluate an assertion (its event loop briefly starved during a dev-server recompile), `clipy mark` records the narration anyway tagged '[ASSERT ⚠ could not evaluate — <reason>]', prints a loud ⚠, and exits 0 — an unverified claim is flagged, never promoted to a ✓. The tally's third bucket counts these: '[verification] N assertion(s): P passed, F failed, K unverified' (the ', K unverified' clause is omitted when K=0). Every mark carries a client id so a slow-but-not-gone daemon that later processes the same mark dedups the two — the evaluated copy wins and the mark appears exactly once.",
3614
+ "A mark is NEVER dropped, and a late verdict never rewrites it. If the daemon can't be reached to evaluate an assertion (its event loop briefly starved during a dev-server recompile), `clipy mark` records the narration anyway tagged '[ASSERT ⚠ could not evaluate — <reason>]', prints a loud ⚠, and exits 0 — an unverified claim is flagged, never promoted to a ✓. The tally's third bucket counts these: '[verification] N assertion(s): P passed, F failed, K unverified' (the ', K unverified' clause is omitted when K=0). That ⚠ is the MARK OF RECORD: if the daemon was only slow and evaluates the same claim later, that verdict judged a LATER page state, so it does NOT overwrite the ⚠ — it's recorded as a separate '[late check of \"…\" — evaluated Ns after the claim: …]' note at its own time and counts toward none of P/F/K. Plain non-asserted marks the daemon later processes are just deduped (exactly once).",
3556
3615
  "clipy chapter \"<label>\" splits one recording into BEFORE/AFTER sections for PR-review-style demos: record the base branch, `clipy chapter \"AFTER — fix applied\"`, swap branches + restart, record the fix. One video carries both states.",
3557
3616
  "clipy session run [start flags] -- <command…> is the crash-safe wrapper: it starts a session, runs your driver command with inherited stdio (env CLIPY_SESSION=1, plus CLIPY_CDP_URL when --expose-cdp), and guarantees cleanup — exit 0 uploads, any non-zero exit or signal discards and propagates the code. Use it so a crashing driver never records dead air to the max ceiling.",
3558
- "clipy mark --at <sec> stamps at an absolute recording time; --ago <sec> stamps N seconds before now — a `clipy mark` spawn lands ~100-300ms late, so backdate to align a mark with the state it describes. When driving over --expose-cdp, call window.__clipyMark(text, opts?) / window.__clipyChapter(label) IN-PAGE (page.evaluate) to emit marks/chapters with zero spawn latency, evaluated daemon-side with the page in hand. __clipyMark's opts {assertSelector, assertText, assertUrl, failMode} run the SAME assertions as the CLI flags (assertText requires assertSelector or the call rejects; failMode 'abort' discards the session); it returns the annotated {tMs, text, assert}. While CDP is exposed the page's own scripts can call these too (within the existing --expose-cdp trust model).",
3617
+ "clipy mark --at <sec> stamps at an absolute recording time; --ago <sec> stamps N seconds before now — a `clipy mark` spawn lands ~100-300ms late, so backdate to align a mark with the state it describes. Backdating an ASSERTED mark: it lands at the backdated time but the assertion judges the LIVE page, so if the verdict was observed >2s from the backdated position the text gains '(assertion observed Ns after this backdated mark — the verdict describes the page at observation time)' and --json carries a signed assert.driftSec; live-clock asserted marks and backdated plain marks are unaffected. When driving over --expose-cdp, call window.__clipyMark(text, opts?) / window.__clipyChapter(label) IN-PAGE (page.evaluate) to emit marks/chapters with zero spawn latency, evaluated daemon-side with the page in hand. __clipyMark's opts {assertSelector, assertText, assertUrl, failMode} run the SAME assertions as the CLI flags (assertText requires assertSelector or the call rejects; failMode 'abort' discards the session); it returns the annotated {tMs, text, assert}. While CDP is exposed the page's own scripts can call these too (within the existing --expose-cdp trust model).",
3559
3618
  "session --expose-cdp (web, opt-in) publishes a CDP endpoint (cdpHttpUrl) in `session start`/`session status` output and the 0600 session state file; connect with playwright.connectOverCDP() to drive the recorded page. Off by default (any local process could attach); CLIPY_DISABLE_CDP=1 forces it off.",
3560
3619
  "Driving an --expose-cdp session: connect with playwright.connectOverCDP(cdpHttpUrl); the recorded page is browser.contexts()[0].pages()[0] (a fresh context/page you open is NOT captured); page.viewportSize() is null over a CDP attach; resize with a CDP session's Emulation.setDeviceMetricsOverride, not setViewportSize. Your own driver script resolves Playwright from its own cwd — run it as NODE_PATH=$(clipy playwright-path) node driver.js if require('playwright') can't find it.",
3561
3620
  "Auth for headless web capture (record + session start): --storage-state <playwright storageState JSON> is passed straight to Playwright's newContext; --cookie / --local-storage / --init-script are applied to the context BEFORE the first navigation, so a logged-in SPA's route guard sees the state on first paint (seeding it after navigating loses that race). --cookie without a Domain is url-scoped to the target; with a Domain it is domain-scoped. --local-storage pairs are origin-guarded to the target. All four are web-only and are rejected on --source mac-screen, which records the real, already-signed-in screen. The storage-state file may hold live credentials; the CLI never prints its contents and the session state file that carries these specs is chmod 0600.",
package/dist/skill.js CHANGED
@@ -15,7 +15,7 @@ description: Read and create Clipy screen recordings. Use when the user shares a
15
15
 
16
16
  # Clipy — recordings you can read AND make
17
17
 
18
- Written for @clipy/cli + @clipy/mcp 0.8.1 (the two versions move in lockstep). If
18
+ Written for @clipy/cli + @clipy/mcp 0.8.2 (the two versions move in lockstep). If
19
19
  \`clipy --version\` reports older, upgrade first: \`npm i -g @clipy/cli@latest\`.
20
20
 
21
21
  Clipy (clipy.online) is the screen recorder built to be agent-readable. Every
@@ -178,9 +178,13 @@ A mark is NEVER dropped: if the recording daemon can't be reached to evaluate an
178
178
  assertion (e.g. its event loop is briefly starved during a dev-server recompile),
179
179
  \`clipy mark\` still records the narration, tags it \`[ASSERT ⚠ could not evaluate —
180
180
  <reason>]\`, prints a loud ⚠, and exits 0 — an unverified claim is flagged as
181
- unverified (the K bucket), never passed off as a ✓. Assertions need a WEB session
182
- (rejected on --source mac-screen — there's no page to probe). Prefer asserting the
183
- specific claims a reviewer cares about over narrating them unverified.
181
+ unverified (the K bucket), never passed off as a ✓. That ⚠ is the MARK OF RECORD:
182
+ if the daemon was only slow and evaluates the same claim a moment later, that late
183
+ verdict does NOT overwrite the ⚠ (it judged a later page state) — it's recorded as a
184
+ separate \`[late check of "…" — evaluated Ns after the claim: …]\` note at its own
185
+ time, and it counts toward neither passed/failed/unverified. Assertions need a WEB
186
+ session (rejected on --source mac-screen — there's no page to probe). Prefer
187
+ asserting the specific claims a reviewer cares about over narrating them unverified.
184
188
 
185
189
  ### Before/after in one recording (clipy chapter)
186
190
 
@@ -219,6 +223,14 @@ the state it describes. Backdate onto the recording clock:
219
223
  clipy mark "toast appeared" --ago 2 # 2s before now
220
224
  clipy mark "page loaded" --at 4 # absolute 4s on the recording clock
221
225
 
226
+ Backdating an ASSERTED mark: the mark lands at the backdated time, but the assertion
227
+ judges the LIVE page (the daemon can't rewind). If the verdict was observed >2s from
228
+ the backdated position, the mark stays put and its text gains \`(assertion observed Ns
229
+ after this backdated mark — the verdict describes the page at observation time)\` plus a
230
+ signed \`assert.driftSec\` in --json — so a ✓/✗ isn't misread as describing the earlier
231
+ moment. So: assert on the LIVE clock, and reserve --at/--ago for narration you're
232
+ backdating without a claim (or accept the disclaimer).
233
+
222
234
  When you drive over --expose-cdp, emit marks IN-PAGE with zero spawn latency by
223
235
  calling the bindings the daemon exposes (they run daemon-side with the page in
224
236
  hand — no \`clipy mark\` process, no shell-out latency):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipy/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Command-line interface for Clipy — list, search, and read your screen recordings' transcripts, AI summaries, and key moments from the terminal.",
5
5
  "license": "MIT",
6
6
  "type": "module",