@reticlehq/core 3.10.6 → 3.10.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.
@@ -266,6 +266,13 @@ export declare const DriftReason: {
266
266
  * Undecided, as the live act answers it, never a pass and never the app's failure.
267
267
  */
268
268
  readonly TARGET_UNREACHABLE: "target_unreachable";
269
+ /**
270
+ * The step's anchor resolved and its action ran, but its declared consequence could not be
271
+ * decided: the predicate answered `inconclusive` (for example, the page's SDK did not return the
272
+ * whole text it was asked to judge). Undecided, never a pass and never the app's failure. As
273
+ * SIGNAL_NOT_OBSERVED, a correct app replayed as failed.
274
+ */
275
+ readonly EXPECT_UNDECIDED: "expect_undecided";
269
276
  };
270
277
  export type DriftReason = (typeof DriftReason)[keyof typeof DriftReason];
271
278
  /**
@@ -276,6 +276,13 @@ export const DriftReason = {
276
276
  * Undecided, as the live act answers it, never a pass and never the app's failure.
277
277
  */
278
278
  TARGET_UNREACHABLE: 'target_unreachable',
279
+ /**
280
+ * The step's anchor resolved and its action ran, but its declared consequence could not be
281
+ * decided: the predicate answered `inconclusive` (for example, the page's SDK did not return the
282
+ * whole text it was asked to judge). Undecided, never a pass and never the app's failure. As
283
+ * SIGNAL_NOT_OBSERVED, a correct app replayed as failed.
284
+ */
285
+ EXPECT_UNDECIDED: 'expect_undecided',
279
286
  };
280
287
  /**
281
288
  * Did the step's anchor resolve and its action RUN, leaving only the declared consequence unmet?
@@ -296,7 +303,9 @@ export function isConsequenceDrift(reason) {
296
303
  DriftReason.EXPECT_ELEMENT_NOT_FOUND === reason ||
297
304
  // Same class: the anchor resolved, the action ran, and the page is where the step left it. Only
298
305
  // the answer is missing. Excluding it would halt a sweep on a slow endpoint.
299
- DriftReason.NET_STILL_IN_FLIGHT === reason);
306
+ DriftReason.NET_STILL_IN_FLIGHT === reason ||
307
+ // The same again: the action ran and only the answer could not be read.
308
+ DriftReason.EXPECT_UNDECIDED === reason);
300
309
  }
301
310
  /** Default timeout (ms) a signal anchor waits to be observed at replay. */
302
311
  export const FLOW_SIGNAL_TIMEOUT_MS = 4000;
@@ -3,5 +3,5 @@
3
3
  * `scripts/set-version.mjs` writes the version on each release, and `version-lockstep.test.ts`
4
4
  * fails when a doc pins another tag.
5
5
  */
6
- export declare const RETICLE_ACTION_VERSION = "3.10.6";
7
- export declare const RETICLE_ACTION_USES = "reticlehq/reticle/action@v3.10.6";
6
+ export declare const RETICLE_ACTION_VERSION = "3.10.8";
7
+ export declare const RETICLE_ACTION_USES = "reticlehq/reticle/action@v3.10.8";
@@ -3,5 +3,5 @@
3
3
  * `scripts/set-version.mjs` writes the version on each release, and `version-lockstep.test.ts`
4
4
  * fails when a doc pins another tag.
5
5
  */
6
- export const RETICLE_ACTION_VERSION = '3.10.6';
6
+ export const RETICLE_ACTION_VERSION = '3.10.8';
7
7
  export const RETICLE_ACTION_USES = `reticlehq/reticle/action@v${RETICLE_ACTION_VERSION}`;
@@ -22,7 +22,7 @@ export { DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT_GLOBAL, RETICLE_SDK_VERSION_GLOB
22
22
  export { ALTERNATIVE_TESTID_ATTRS, DEFAULT_TESTID_ATTR, TESTID_ATTR_PATTERN, } from './identity/testid-attribute.js';
23
23
  export { PredicateKind } from './verdict/consequence.js';
24
24
  export { SESSION_REF } from './verdict/predicate-tree.js';
25
- export { OutwardAction, isDangerousActionText, isDangerousNavigation, isInertHref, isLocalPage, isLoopbackHostname, isPaymentField, outwardActionOf, outwardRefusal, withoutFilenameTokens, } from './verdict/security.js';
25
+ export { OutwardAction, dangerousActionWord, dangerousNavigationReason, destructiveActionWord, isDangerousActionText, isDangerousNavigation, isInertHref, isLocalPage, isLoopbackHostname, isPaymentField, outwardActionOf, outwardRefusal, withoutFilenameTokens, } from './verdict/security.js';
26
26
  export { STEP_SCREENSHOT } from './verdict/step-screenshot.js';
27
27
  export { BlindSpotKind } from './verdict/verified-constants.js';
28
28
  export { ChannelId } from './wire/channel.js';
@@ -22,7 +22,7 @@ export { DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT_GLOBAL, RETICLE_SDK_VERSION_GLOB
22
22
  export { ALTERNATIVE_TESTID_ATTRS, DEFAULT_TESTID_ATTR, TESTID_ATTR_PATTERN, } from './identity/testid-attribute.js';
23
23
  export { PredicateKind } from './verdict/consequence.js';
24
24
  export { SESSION_REF } from './verdict/predicate-tree.js';
25
- export { OutwardAction, isDangerousActionText, isDangerousNavigation, isInertHref, isLocalPage, isLoopbackHostname, isPaymentField, outwardActionOf, outwardRefusal, withoutFilenameTokens, } from './verdict/security.js';
25
+ export { OutwardAction, dangerousActionWord, dangerousNavigationReason, destructiveActionWord, isDangerousActionText, isDangerousNavigation, isInertHref, isLocalPage, isLoopbackHostname, isPaymentField, outwardActionOf, outwardRefusal, withoutFilenameTokens, } from './verdict/security.js';
26
26
  export { STEP_SCREENSHOT } from './verdict/step-screenshot.js';
27
27
  export { BlindSpotKind } from './verdict/verified-constants.js';
28
28
  export { ChannelId } from './wire/channel.js';
@@ -49,8 +49,22 @@ export declare function withoutFilenameTokens(text: string): string;
49
49
  * role (a tool name, a click with no role on the descriptor) omit it and the text decides.
50
50
  */
51
51
  export declare function isDangerousActionText(text: string, role?: string): boolean;
52
+ /**
53
+ * The word that makes `text` read as destructive or money-moving, lower-cased; undefined when none.
54
+ *
55
+ * Same rule as `isDangerousActionText`. A refusal that names this word tells the agent WHAT the guard
56
+ * read: "payment" in a menu trigger's name is a different problem from "delete" on a submit button.
57
+ */
58
+ export declare function dangerousActionWord(text: string, role?: string): string | undefined;
59
+ /**
60
+ * Only the words that destroy something. A control that only opens a menu or a dialog moves no
61
+ * money, so a money word in its name ("Actions for Payment successful") is not a reason to refuse it.
62
+ */
63
+ export declare function destructiveActionWord(text: string, role?: string): string | undefined;
52
64
  export declare function isInertHref(href: string): boolean;
53
65
  export declare function isDangerousNavigation(href: string): boolean;
66
+ /** Why following `href` is destructive: the destroy word in it, or `payment provider`; else undefined. */
67
+ export declare function dangerousNavigationReason(href: string): string | undefined;
54
68
  export declare const OutwardAction: {
55
69
  readonly INVITE: "invite";
56
70
  readonly SEND: "send";
@@ -218,10 +218,29 @@ export function withoutFilenameTokens(text) {
218
218
  * role (a tool name, a click with no role on the descriptor) omit it and the text decides.
219
219
  */
220
220
  export function isDangerousActionText(text, role) {
221
+ return dangerousActionWord(text, role) !== undefined;
222
+ }
223
+ /**
224
+ * The word that makes `text` read as destructive or money-moving, lower-cased; undefined when none.
225
+ *
226
+ * Same rule as `isDangerousActionText`. A refusal that names this word tells the agent WHAT the guard
227
+ * read: "payment" in a menu trigger's name is a different problem from "delete" on a submit button.
228
+ */
229
+ export function dangerousActionWord(text, role) {
230
+ return firstMatch(DANGEROUS_ACTION, text, role);
231
+ }
232
+ /**
233
+ * Only the words that destroy something. A control that only opens a menu or a dialog moves no
234
+ * money, so a money word in its name ("Actions for Payment successful") is not a reason to refuse it.
235
+ */
236
+ export function destructiveActionWord(text, role) {
237
+ return firstMatch(DESTROY_ACTION, text, role);
238
+ }
239
+ function firstMatch(pattern, text, role) {
221
240
  if (role !== undefined && VALUE_PICKER_ROLES.has(role.trim().toLowerCase())) {
222
- return false;
241
+ return undefined;
223
242
  }
224
- return DANGEROUS_ACTION.test(text.replace(WORD_JOINERS, ' '));
243
+ return pattern.exec(text.replace(WORD_JOINERS, ' '))?.[1]?.toLowerCase();
225
244
  }
226
245
  /**
227
246
  * Is following a link to this href destructive? A link that navigates is a GET: opening a page moves
@@ -235,7 +254,14 @@ export function isInertHref(href) {
235
254
  return INERT_HREF.test(href);
236
255
  }
237
256
  export function isDangerousNavigation(href) {
238
- return isPaymentProviderUrl(href) || DESTROY_ACTION.test(href.replace(WORD_JOINERS, ' '));
257
+ return dangerousNavigationReason(href) !== undefined;
258
+ }
259
+ /** Why following `href` is destructive: the destroy word in it, or `payment provider`; else undefined. */
260
+ export function dangerousNavigationReason(href) {
261
+ if (isPaymentProviderUrl(href)) {
262
+ return 'payment provider';
263
+ }
264
+ return DESTROY_ACTION.exec(href.replace(WORD_JOINERS, ' '))?.[1]?.toLowerCase();
239
265
  }
240
266
  // ── What the Harness may press ────────────────────────────────────────────────────────────────
241
267
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "3.10.6",
3
+ "version": "3.10.8",
4
4
  "description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod and open-verification.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",