@skrr-ai/cli 0.1.161 → 0.1.163

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.
Files changed (91) hide show
  1. package/dist/base-command.d.ts +5 -2
  2. package/dist/base-command.js +96 -39
  3. package/dist/commands/activity/list.d.ts +7 -0
  4. package/dist/commands/activity/list.js +17 -0
  5. package/dist/commands/activity/scan-older.d.ts +2 -2
  6. package/dist/commands/activity/scan-older.js +6 -5
  7. package/dist/commands/activity/show.d.ts +0 -2
  8. package/dist/commands/activity/show.js +21 -42
  9. package/dist/commands/agents/always-on/release-run.d.ts +3 -3
  10. package/dist/commands/agents/always-on/release-run.js +5 -6
  11. package/dist/commands/agents/mini-computer/app/reset.d.ts +1 -0
  12. package/dist/commands/agents/mini-computer/app/reset.js +5 -2
  13. package/dist/commands/agents/mini-computer/app/set.js +1 -1
  14. package/dist/commands/agents/mini-computer/show.js +4 -2
  15. package/dist/commands/agents/mini-computer/tasks-view.js +2 -2
  16. package/dist/commands/agents/triggers/replay.js +1 -1
  17. package/dist/commands/agents/triggers/runs.d.ts +2 -3
  18. package/dist/commands/agents/triggers/runs.js +4 -5
  19. package/dist/commands/apps/auto-apply.js +31 -10
  20. package/dist/commands/apps/check.js +8 -0
  21. package/dist/commands/apps/data/batch.js +16 -5
  22. package/dist/commands/apps/data/collections.js +1 -1
  23. package/dist/commands/apps/data/delete.js +12 -4
  24. package/dist/commands/apps/data/patch.js +11 -4
  25. package/dist/commands/apps/data/put.js +13 -6
  26. package/dist/commands/apps/data/query.js +3 -3
  27. package/dist/commands/apps/install.js +24 -7
  28. package/dist/commands/apps/installations/events.d.ts +1 -0
  29. package/dist/commands/apps/installations/events.js +63 -10
  30. package/dist/commands/apps/installations/show.js +26 -5
  31. package/dist/commands/apps/installations/snapshot.js +1 -1
  32. package/dist/commands/apps/installations/versions.js +25 -9
  33. package/dist/commands/apps/logs.js +4 -1
  34. package/dist/commands/apps/push.js +10 -2
  35. package/dist/commands/apps/reconsent.js +7 -1
  36. package/dist/commands/apps/rollback.js +2 -2
  37. package/dist/commands/apps/settings/set.js +81 -4
  38. package/dist/commands/apps/settings/show.js +38 -7
  39. package/dist/commands/balance/usage/breakdown.d.ts +1 -1
  40. package/dist/commands/balance/usage/breakdown.js +4 -4
  41. package/dist/commands/balance/usage/events.d.ts +1 -1
  42. package/dist/commands/balance/usage/events.js +4 -4
  43. package/dist/commands/duties/status.js +20 -15
  44. package/dist/commands/goals/create.js +18 -1
  45. package/dist/commands/outbox/drop.js +21 -15
  46. package/dist/commands/outbox/list.d.ts +2 -1
  47. package/dist/commands/outbox/list.js +20 -11
  48. package/dist/commands/outbox/retry.d.ts +8 -11
  49. package/dist/commands/outbox/retry.js +135 -92
  50. package/dist/commands/spaces/create.js +1 -1
  51. package/dist/commands/tasks/comments/add.js +1 -1
  52. package/dist/commands/triggers/audit.js +3 -5
  53. package/dist/commands/triggers/fire-detail.js +7 -1
  54. package/dist/commands/triggers/preflight.js +15 -10
  55. package/dist/commands/triggers/replay.js +1 -1
  56. package/dist/commands/triggers/runs.d.ts +2 -4
  57. package/dist/commands/triggers/runs.js +3 -5
  58. package/dist/generated/agent-guides.json +19 -19
  59. package/dist/lib/agent-activity.d.ts +21 -1
  60. package/dist/lib/agent-activity.js +98 -29
  61. package/dist/lib/api-fetch.d.ts +2 -0
  62. package/dist/lib/api-fetch.js +5 -5
  63. package/dist/lib/appData.d.ts +43 -5
  64. package/dist/lib/appData.js +117 -25
  65. package/dist/lib/appInstallations.d.ts +5 -5
  66. package/dist/lib/appInstallations.js +211 -74
  67. package/dist/lib/appSettings.d.ts +2 -0
  68. package/dist/lib/appSettings.js +36 -3
  69. package/dist/lib/apps-command.d.ts +9 -0
  70. package/dist/lib/apps-command.js +191 -7
  71. package/dist/lib/appsCheck.js +29 -3
  72. package/dist/lib/appsFs.d.ts +1 -1
  73. package/dist/lib/balance.d.ts +5 -5
  74. package/dist/lib/balance.js +4 -4
  75. package/dist/lib/dedicated-power.js +4 -3
  76. package/dist/lib/json-output.d.ts +4 -0
  77. package/dist/lib/json-output.js +38 -0
  78. package/dist/lib/miniComputer.js +9 -2
  79. package/dist/lib/node-adapter.js +35 -2
  80. package/dist/lib/outbox.d.ts +20 -5
  81. package/dist/lib/outbox.js +233 -76
  82. package/dist/lib/rate-limit-retry.d.ts +3 -2
  83. package/dist/lib/rate-limit-retry.js +3 -2
  84. package/dist/lib/roles.d.ts +1 -1
  85. package/dist/lib/triggers.d.ts +3 -0
  86. package/dist/lib/triggers.js +10 -0
  87. package/dist/lib/widgetStaticScan.d.ts +3 -1
  88. package/dist/lib/widgetStaticScan.js +182 -47
  89. package/dist/node_modules/@skrr-ai/data-provider/index.js +10442 -9507
  90. package/oclif.manifest.json +138 -45
  91. package/package.json +4 -3
@@ -32,13 +32,20 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.MAX_REPLAY_ATTEMPTS = void 0;
39
+ exports.OutboxFullError = exports.MAX_REPLAY_ATTEMPTS = void 0;
37
40
  exports.isOutageFailure = isOutageFailure;
38
41
  exports.isRetryableWrite = isRetryableWrite;
42
+ exports.lockOutboxReplay = lockOutboxReplay;
39
43
  exports.enqueueWrite = enqueueWrite;
40
44
  exports.listWrites = listWrites;
45
+ exports.listReplayWrites = listReplayWrites;
41
46
  exports.replaceWrites = replaceWrites;
47
+ exports.claimOutboxReplay = claimOutboxReplay;
48
+ exports.acknowledgeOutboxReplay = acknowledgeOutboxReplay;
42
49
  exports.dropWrite = dropWrite;
43
50
  exports.recordIncident = recordIncident;
44
51
  exports.recordRecovery = recordRecovery;
@@ -71,9 +78,8 @@ exports.isIncidentActive = isIncidentActive;
71
78
  * A script that treats it as done would be wrong; a human who sees "queued"
72
79
  * knows their content is safe and the operation is still owed.
73
80
  *
74
- * 4. Append-only, one JSON object per line, fsynced. A crash mid-write must
75
- * not corrupt earlier entries, and a partially written trailing line is
76
- * skipped on read rather than failing the whole file.
81
+ * 4. One JSON object per line, fsynced on append. A damaged or unreadable
82
+ * file is reported rather than silently treated as an empty queue.
77
83
  *
78
84
  * Scope note: this queues the INTENT (endpoint, payload, idempotency key), not
79
85
  * a promise about ordering. Entries replay oldest-first but independently — the
@@ -84,6 +90,7 @@ const fs = __importStar(require("node:fs"));
84
90
  const os = __importStar(require("node:os"));
85
91
  const path = __importStar(require("node:path"));
86
92
  const crypto = __importStar(require("node:crypto"));
93
+ const proper_lockfile_1 = __importDefault(require("proper-lockfile"));
87
94
  const IS_OUTAGE_FAILURE_RE = /fetch failed|ECONNREFUSED|ENOTFOUND|ETIMEDOUT|ECONNRESET|socket hang up|network/i;
88
95
  /**
89
96
  * A replay that keeps failing is either a permanent server-side refusal or a
@@ -228,6 +235,99 @@ function ensureDir(profile) {
228
235
  fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
229
236
  return dir;
230
237
  }
238
+ /** Serialize short disk transactions between cooperating CLI processes. */
239
+ function withQueueLock(profile, work) {
240
+ const dir = ensureDir(profile);
241
+ const lockKey = path.join(dir, '.queue');
242
+ const lockPath = path.join(dir, '.queue.lock');
243
+ let release;
244
+ const until = Date.now() + 2_000;
245
+ while (!release) {
246
+ try {
247
+ release = proper_lockfile_1.default.lockSync(lockKey, { lockfilePath: lockPath, realpath: false, stale: 120_000 });
248
+ }
249
+ catch (error) {
250
+ if (error.code !== 'ELOCKED' || Date.now() >= until)
251
+ throw error;
252
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 25);
253
+ }
254
+ }
255
+ try {
256
+ return work();
257
+ }
258
+ finally {
259
+ release();
260
+ }
261
+ }
262
+ /** One replay at a time; unlike the short queue lock, this spans network calls. */
263
+ async function lockOutboxReplay(profile) {
264
+ const dir = ensureDir(profile);
265
+ try {
266
+ return await proper_lockfile_1.default.lock(path.join(dir, '.replay'), { lockfilePath: path.join(dir, '.replay.lock'), realpath: false, stale: 120_000 });
267
+ }
268
+ catch (error) {
269
+ if (error.code !== 'ELOCKED')
270
+ throw error;
271
+ throw Object.assign(new Error('Another outbox retry or drop is in progress. Wait for it to finish, then inspect the queue and reconcile any uncertain result before deciding whether to retry.'), {
272
+ code: 'OUTBOX_BUSY', retryable: false,
273
+ });
274
+ }
275
+ }
276
+ class OutboxCorruptError extends Error {
277
+ code = 'OUTBOX_CORRUPT';
278
+ retryable = false;
279
+ constructor() {
280
+ super('The local outbox is damaged or incomplete. Its file was not changed; preserve it before attempting repair.');
281
+ this.name = 'OutboxCorruptError';
282
+ }
283
+ }
284
+ /** A mutation must never turn an unreadable or damaged queue into an empty one. */
285
+ function readWritesStrict(profile) {
286
+ let raw;
287
+ try {
288
+ raw = fs.readFileSync(outboxPath(profile), 'utf8');
289
+ }
290
+ catch (error) {
291
+ if (error.code === 'ENOENT')
292
+ return [];
293
+ throw error;
294
+ }
295
+ const seen = new Set();
296
+ return raw.split('\n').filter((line) => line.trim()).map((line) => {
297
+ let value;
298
+ try {
299
+ value = JSON.parse(line);
300
+ }
301
+ catch {
302
+ throw new OutboxCorruptError();
303
+ }
304
+ const entry = value;
305
+ if (!entry || typeof entry !== 'object' || typeof entry.id !== 'string' || !entry.id ||
306
+ seen.has(entry.id) || typeof entry.idempotencyKey !== 'string' || !entry.idempotencyKey ||
307
+ typeof entry.command !== 'string' || typeof entry.summary !== 'string' ||
308
+ !['post', 'put', 'patch', 'delete'].includes(entry.method) ||
309
+ (entry.method !== 'delete' && !Object.prototype.hasOwnProperty.call(entry, 'body')) ||
310
+ typeof entry.url !== 'string' || !entry.url || typeof entry.queuedAt !== 'string' ||
311
+ !entry.reason || typeof entry.reason !== 'object' || typeof entry.reason.message !== 'string' ||
312
+ !Number.isInteger(entry.attempts) || entry.attempts < 0 ||
313
+ (entry.replay !== undefined && (!entry.replay || typeof entry.replay !== 'object' ||
314
+ !['sending', 'result_recorded'].includes(entry.replay.state) ||
315
+ typeof entry.replay.attemptId !== 'string' || !entry.replay.attemptId ||
316
+ typeof entry.replay.startedAt !== 'string' || !entry.replay.startedAt ||
317
+ typeof entry.replay.fingerprint !== 'string' || !/^[0-9a-f]{64}$/.test(entry.replay.fingerprint) ||
318
+ (entry.replay.state === 'result_recorded' && (typeof entry.replay.resultId !== 'string' || !entry.replay.resultId))))) {
319
+ throw new OutboxCorruptError();
320
+ }
321
+ seen.add(entry.id);
322
+ return entry;
323
+ });
324
+ }
325
+ function replayFingerprint(entry) {
326
+ return crypto.createHash('sha256').update(JSON.stringify({
327
+ id: entry.id, key: entry.idempotencyKey, command: entry.command, method: entry.method,
328
+ url: entry.url, body: entry.body, workspaceId: entry.workspaceId ?? null,
329
+ })).digest('hex');
330
+ }
231
331
  /**
232
332
  * Append one entry, fsynced before returning.
233
333
  *
@@ -243,79 +343,72 @@ function ensureDir(profile) {
243
343
  * grows for as long as nobody is looking, which is exactly the situation a
244
344
  * queue exists for.
245
345
  *
246
- * When full the OLDEST is dropped: the newest write is the one the user just
247
- * authored and still remembers, and losing that is the more visible failure.
346
+ * A full queue refuses the new entry; it never discards an older write.
248
347
  */
249
348
  const MAX_QUEUED_WRITES = 200;
250
- function enqueueWrite(input, profile) {
251
- ensureDir(profile);
252
- // Same logical write, already queued → return the existing entry.
253
- //
254
- // Without this, a command that retries against a persistent 401 appends a
255
- // fresh `obx_<uuid>` every attempt, and the queue fills with duplicates of
256
- // one intent. They would all replay, and the idempotency key would make the
257
- // server collapse them — but only after the CLI had stored, drained and sent
258
- // each copy, and only if the server side is actually enforcing it.
259
- //
260
- // Matching on `idempotencyKey` is what makes this safe: it is caller-minted
261
- // and stable for the logical write (see `idempotencyKeyFor`), so two entries
262
- // sharing one are the same intent by construction, not by coincidence.
263
- if (input.idempotencyKey) {
264
- const existing = listWrites(profile).find((e) => e.idempotencyKey === input.idempotencyKey);
265
- if (existing)
266
- return existing;
349
+ class OutboxFullError extends Error {
350
+ constructor() {
351
+ super(`The local queue already contains ${MAX_QUEUED_WRITES} writes.`);
352
+ this.name = 'OutboxFullError';
267
353
  }
268
- const entry = {
269
- ...input,
270
- id: `obx_${crypto.randomUUID()}`,
271
- queuedAt: new Date().toISOString(),
272
- attempts: 0,
273
- };
274
- const current = listWrites(profile);
275
- if (current.length >= MAX_QUEUED_WRITES) {
276
- // Rewrite rather than append. `replaceWrites` is atomic (tmp + rename), so
277
- // a crash here leaves either the old queue or the new one — never a
278
- // truncated file, which for a durable queue would be the worst outcome.
279
- replaceWrites([...current.slice(current.length - MAX_QUEUED_WRITES + 1), entry], profile);
354
+ }
355
+ exports.OutboxFullError = OutboxFullError;
356
+ function enqueueWrite(input, profile) {
357
+ return withQueueLock(profile, () => {
358
+ const current = readWritesStrict(profile);
359
+ // Same logical write, already queued → return the existing entry.
360
+ //
361
+ // Without this, a command that retries against a persistent 401 appends a
362
+ // fresh `obx_<uuid>` every attempt, and the queue fills with duplicates of
363
+ // one intent. They would all replay, and the idempotency key would make the
364
+ // server collapse them — but only after the CLI had stored, drained and sent
365
+ // each copy, and only if the server side is actually enforcing it.
366
+ //
367
+ // Matching on `idempotencyKey` is what makes this safe: it is caller-minted
368
+ // and stable for the logical write (see `idempotencyKeyFor`), so two entries
369
+ // sharing one are the same intent by construction, not by coincidence.
370
+ if (input.idempotencyKey) {
371
+ const existing = current.find((e) => e.idempotencyKey === input.idempotencyKey);
372
+ if (existing)
373
+ return existing;
374
+ }
375
+ const entry = {
376
+ ...input,
377
+ id: `obx_${crypto.randomUUID()}`,
378
+ queuedAt: new Date().toISOString(),
379
+ attempts: 0,
380
+ };
381
+ if (current.length >= MAX_QUEUED_WRITES) {
382
+ throw new OutboxFullError();
383
+ }
384
+ const fd = fs.openSync(outboxPath(profile), 'a', 0o600);
385
+ try {
386
+ fs.writeFileSync(fd, `${JSON.stringify(entry)}\n`);
387
+ fs.fsyncSync(fd);
388
+ }
389
+ finally {
390
+ fs.closeSync(fd);
391
+ }
280
392
  return entry;
281
- }
282
- const fd = fs.openSync(outboxPath(profile), 'a', 0o600);
283
- try {
284
- fs.writeSync(fd, `${JSON.stringify(entry)}\n`);
285
- fs.fsyncSync(fd);
286
- }
287
- finally {
288
- fs.closeSync(fd);
289
- }
290
- return entry;
393
+ });
291
394
  }
292
- /**
293
- * Read every intact entry. A truncated trailing line — the shape a crash
294
- * mid-append leaves — is skipped, because losing the one entry that was still
295
- * being written is strictly better than failing to read the ones that landed.
296
- */
395
+ /** Fail visibly when the queue is unreadable; never present damage as an empty queue. */
297
396
  function listWrites(profile) {
298
- let raw;
397
+ // Avoid creating an empty queue just to list it, while serializing reads of
398
+ // an existing queue with an append or rename in another process.
299
399
  try {
300
- raw = fs.readFileSync(outboxPath(profile), 'utf8');
400
+ fs.statSync(outboxDir(profile));
301
401
  }
302
- catch {
303
- return [];
304
- }
305
- const entries = [];
306
- for (const line of raw.split('\n')) {
307
- if (!line.trim())
308
- continue;
309
- try {
310
- const parsed = JSON.parse(line);
311
- if (parsed && typeof parsed.id === 'string')
312
- entries.push(parsed);
313
- }
314
- catch {
315
- /* torn trailing line — see the docblock */
316
- }
402
+ catch (error) {
403
+ if (error.code === 'ENOENT')
404
+ return [];
405
+ throw error;
317
406
  }
318
- return entries;
407
+ return withQueueLock(profile, () => readWritesStrict(profile));
408
+ }
409
+ /** Replay must fail before sending if the queue cannot be read intact. */
410
+ function listReplayWrites(profile) {
411
+ return withQueueLock(profile, () => readWritesStrict(profile));
319
412
  }
320
413
  /**
321
414
  * Rewrite the log with `entries`, atomically (tmp + rename).
@@ -326,18 +419,82 @@ function listWrites(profile) {
326
419
  function replaceWrites(entries, profile) {
327
420
  ensureDir(profile);
328
421
  const file = outboxPath(profile);
329
- const tmp = `${file}.tmp.${process.pid}`;
422
+ const tmp = `${file}.tmp.${process.pid}.${crypto.randomUUID()}`;
330
423
  const payload = entries.map((e) => JSON.stringify(e)).join('\n');
331
- fs.writeFileSync(tmp, payload ? `${payload}\n` : '', { mode: 0o600 });
424
+ const fd = fs.openSync(tmp, 'wx', 0o600);
425
+ try {
426
+ fs.writeFileSync(fd, payload ? `${payload}\n` : '');
427
+ fs.fsyncSync(fd);
428
+ }
429
+ finally {
430
+ fs.closeSync(fd);
431
+ }
332
432
  fs.renameSync(tmp, file);
333
433
  }
434
+ /** A claim must reach the directory before a network request can start. */
435
+ function durableReplayReplace(entries, profile) {
436
+ const dir = ensureDir(profile);
437
+ let fd;
438
+ try {
439
+ fd = fs.openSync(dir, 'r');
440
+ // Fail before sending if this filesystem cannot sync its directory.
441
+ fs.fsyncSync(fd);
442
+ replaceWrites(entries, profile);
443
+ fs.fsyncSync(fd);
444
+ }
445
+ catch {
446
+ throw Object.assign(new Error('The outbox could not confirm durable replay state. No further requests were sent; inspect the queue and reconcile any uncertain result.'), {
447
+ code: 'OUTBOX_DURABILITY_UNAVAILABLE', retryable: false,
448
+ });
449
+ }
450
+ finally {
451
+ if (fd !== undefined)
452
+ fs.closeSync(fd);
453
+ }
454
+ }
455
+ /** Persist a one-attempt claim before sending. Existing claims are never taken over. */
456
+ function claimOutboxReplay(id, profile) {
457
+ return withQueueLock(profile, () => {
458
+ const entries = readWritesStrict(profile);
459
+ const index = entries.findIndex((entry) => entry.id === id);
460
+ if (index < 0 || entries[index].replay !== undefined)
461
+ return null;
462
+ const now = new Date().toISOString();
463
+ const claimed = {
464
+ ...entries[index], attempts: entries[index].attempts + 1, lastAttemptAt: now,
465
+ replay: { state: 'sending', attemptId: crypto.randomUUID(), startedAt: now, fingerprint: replayFingerprint(entries[index]) },
466
+ };
467
+ entries[index] = claimed;
468
+ durableReplayReplace(entries, profile);
469
+ return claimed;
470
+ });
471
+ }
472
+ /** Retain the content while recording the result of the exact claimed request. */
473
+ function acknowledgeOutboxReplay(claim, resultId, profile) {
474
+ withQueueLock(profile, () => {
475
+ const entries = readWritesStrict(profile);
476
+ const current = entries.find((entry) => entry.id === claim.id);
477
+ if (!claim.replay || !current || current.replay?.attemptId !== claim.replay.attemptId ||
478
+ current.replay.state !== 'sending' || current.replay.fingerprint !== replayFingerprint(current) ||
479
+ current.replay.fingerprint !== claim.replay.fingerprint || !resultId) {
480
+ throw Object.assign(new Error('The outbox entry changed during replay; inspect and reconcile it before trying again.'), {
481
+ code: 'OUTBOX_REPLAY_CHANGED', retryable: false,
482
+ });
483
+ }
484
+ const updated = entries.map((entry) => entry.id === claim.id
485
+ ? { ...entry, replay: { ...claim.replay, state: 'result_recorded', resultId } } : entry);
486
+ durableReplayReplace(updated, profile);
487
+ });
488
+ }
334
489
  function dropWrite(id, profile) {
335
- const entries = listWrites(profile);
336
- const remaining = entries.filter((e) => e.id !== id);
337
- if (remaining.length === entries.length)
338
- return false;
339
- replaceWrites(remaining, profile);
340
- return true;
490
+ return withQueueLock(profile, () => {
491
+ const entries = readWritesStrict(profile);
492
+ const remaining = entries.filter((e) => e.id !== id);
493
+ if (remaining.length === entries.length)
494
+ return false;
495
+ replaceWrites(remaining, profile);
496
+ return true;
497
+ });
341
498
  }
342
499
  /**
343
500
  * Record that the control plane is failing.
@@ -7,8 +7,9 @@
7
7
  * 429 as terminal, so a burst of keyed creates failed on the first refusal.
8
8
  *
9
9
  * Retried only when replay is provably safe: a GET, or a write that carries an
10
- * `X-Idempotency-Key` (every `request.ts` / adapter write does). A 429 means the
11
- * request was refused before it ran, so the key is belt and braces.
10
+ * `X-Idempotency-Key` (every `request.ts` / adapter write does). Callers must
11
+ * disable retries for routes without server-side replay protection: a client
12
+ * header or a 429 from an intermediary does not prove the write did not run.
12
13
  *
13
14
  * Never retried when the body says it cannot help: a 429 that declares
14
15
  * `retryable: false` (a follow-up budget refusal, which says the day resets at
@@ -8,8 +8,9 @@
8
8
  * 429 as terminal, so a burst of keyed creates failed on the first refusal.
9
9
  *
10
10
  * Retried only when replay is provably safe: a GET, or a write that carries an
11
- * `X-Idempotency-Key` (every `request.ts` / adapter write does). A 429 means the
12
- * request was refused before it ran, so the key is belt and braces.
11
+ * `X-Idempotency-Key` (every `request.ts` / adapter write does). Callers must
12
+ * disable retries for routes without server-side replay protection: a client
13
+ * header or a 429 from an intermediary does not prove the write did not run.
13
14
  *
14
15
  * Never retried when the body says it cannot help: a 429 that declares
15
16
  * `retryable: false` (a follow-up budget refusal, which says the day resets at
@@ -53,7 +53,7 @@ export declare const roleApi: {
53
53
  config?: Record<string, unknown> | undefined;
54
54
  }[];
55
55
  sources: {
56
- source: "space" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "docs" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run";
56
+ source: "space" | "docs" | "tasks" | "memory" | "daemon" | "email" | "goal" | "files" | "local" | "browser" | "metrics" | "monitor" | "github" | "conversations" | "agent_initiatives" | "messages" | "documents" | "slack" | "calendar" | "product_metrics" | "business_metrics" | "state_monitor" | "agent_run";
57
57
  enabled: boolean;
58
58
  config?: Record<string, unknown> | undefined;
59
59
  }[];
@@ -206,6 +206,7 @@ export interface TriggerDefinition {
206
206
  updatedAt?: string;
207
207
  }
208
208
  export interface TriggerFireRecord {
209
+ publicProjection?: string;
209
210
  _id?: string;
210
211
  triggerId?: string;
211
212
  occurrenceId?: string;
@@ -876,6 +877,8 @@ export declare function policyAuditExplanation(fire: {
876
877
  * server wrote it.
877
878
  */
878
879
  export declare function fireReasonText(reason: string): string;
880
+ /** This is a provenance restriction on replay, not a new verdict on the recorded run. */
881
+ export declare function unverifiedReplayExplanation(): string;
879
882
  export declare function renderFireAudit(fires: TriggerFireRecord[], log: (line: string) => void, waiting?: TriggerAuditResponse['waiting'], options?: {
880
883
  timeZone?: string;
881
884
  }): void;
@@ -74,6 +74,7 @@ exports.scheduleStartLagSentence = scheduleStartLagSentence;
74
74
  exports.policyCardSentence = policyCardSentence;
75
75
  exports.policyAuditExplanation = policyAuditExplanation;
76
76
  exports.fireReasonText = fireReasonText;
77
+ exports.unverifiedReplayExplanation = unverifiedReplayExplanation;
77
78
  exports.renderFireAudit = renderFireAudit;
78
79
  exports.describeTriggerBudget = describeTriggerBudget;
79
80
  const data_provider_1 = require("@skrr-ai/data-provider");
@@ -2201,6 +2202,10 @@ function fireReasonText(reason) {
2201
2202
  return reason;
2202
2203
  }
2203
2204
  }
2205
+ /** This is a provenance restriction on replay, not a new verdict on the recorded run. */
2206
+ function unverifiedReplayExplanation() {
2207
+ return 'Replay is unavailable because this historical fire cannot be linked with certainty to the current trigger. The recorded outcome is unchanged. Inspect the current action with `skrr triggers show <trigger-id>` before requesting a separate manual run with `skrr triggers fire <trigger-id>`. A manual fire can bypass a disabled trigger and quiet hours, and is not a replay of the original event; permissions and required inputs still apply.';
2208
+ }
2204
2209
  function renderFireAudit(fires, log, waiting, options = {}) {
2205
2210
  // An armed one-shot whose time passed has no fire record yet. "No records" alone reads as
2206
2211
  // "not yet", so say that it is late and what it is waiting for.
@@ -2211,6 +2216,11 @@ function renderFireAudit(fires, log, waiting, options = {}) {
2211
2216
  log('No fire audit records.');
2212
2217
  return;
2213
2218
  }
2219
+ if (fires.some((fire) => fire.publicProjection === 'source_unverified' ||
2220
+ fire.metadata?.replayBlockedReason === 'event_not_authorized'))
2221
+ log('Restricted fire summaries: historical physical Trigger identity is unverified.');
2222
+ if (fires.some((fire) => fire.metadata?.replayBlockedReason === 'source_identity_unverified'))
2223
+ log(unverifiedReplayExplanation());
2214
2224
  (0, format_1.renderTable)(fires.map((fire) => ({
2215
2225
  trigger: fire.triggerId ?? '',
2216
2226
  firedAt: options.timeZone ? (0, format_1.zonedTime)(fire.firedAt, options.timeZone, { seconds: false }) : (fire.firedAt ?? '-'),
@@ -107,5 +107,7 @@ export declare function classifyUrl(raw: string): UrlKind;
107
107
  * only the strings it is given; the cost is linear in their length, which the
108
108
  * caller has already bounded by the widget limits.
109
109
  */
110
- export declare function scanWidgetSource(source: WidgetSource): StaticScanResult;
110
+ export declare function scanWidgetSource(source: WidgetSource, options?: {
111
+ allowAppLocalReferences?: boolean;
112
+ }): StaticScanResult;
111
113
  export {};