@reticlehq/core 3.8.1 → 3.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/dist/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export * from './wire/constants/response-body-reason.js';
29
29
  export * from './identity/source-constants.js';
30
30
  export * from './identity/testid-attribute.js';
31
31
  export * from './wire/event-classification.js';
32
+ export * from './wire/click-input.js';
32
33
  export * from './wire/global-press.js';
33
34
  export * from './wire/hold.js';
34
35
  export * from './verdict/verified-constants.js';
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ export * from './wire/constants/response-body-reason.js'; // why a NET_REQUEST c
30
30
  export * from './identity/source-constants.js'; // DATA_RETICLE_SOURCE_ATTR, RETICLE_ROOT_GLOBAL
31
31
  export * from './identity/testid-attribute.js'; // DEFAULT_TESTID_ATTR, ALTERNATIVE_TESTID_ATTRS
32
32
  export * from './wire/event-classification.js'; // CHURN_TYPES — shared eviction priority for buffer/queue
33
+ export * from './wire/click-input.js'; // which button and modifiers a click may carry
33
34
  export * from './wire/global-press.js'; // which press is a document key (Escape / Tab / a shortcut)
34
35
  export * from './wire/hold.js'; // clampHoldMs — the bounded hold both input paths honour
35
36
  export * from './verdict/verified-constants.js'; // Verified — the one field an agent gates on
@@ -0,0 +1,15 @@
1
+ import { ActionType } from './constants/constants.js';
2
+ /** The pointer buttons a click can use, as the agent spells them in `args.button`. */
3
+ export declare const ClickButton: {
4
+ readonly LEFT: "left";
5
+ readonly MIDDLE: "middle";
6
+ readonly RIGHT: "right";
7
+ };
8
+ export type ClickButton = (typeof ClickButton)[keyof typeof ClickButton];
9
+ /** The button a click asks for: left when `args.button` is absent, undefined when it is unknown. */
10
+ export declare function clickButtonFromArgs(args: Record<string, unknown>): ClickButton | undefined;
11
+ /**
12
+ * Why a click or dblclick cannot be driven as asked, or undefined when it can. The page and the
13
+ * server both refuse with this sentence, so an argument is never dropped without a word.
14
+ */
15
+ export declare function clickInputProblem(action: ActionType, args: Record<string, unknown>): string | undefined;
@@ -0,0 +1,42 @@
1
+ import { ActionType } from './constants/constants.js';
2
+ import { pressModifiersFromArgs } from './global-press.js';
3
+ /** The pointer buttons a click can use, as the agent spells them in `args.button`. */
4
+ export const ClickButton = {
5
+ LEFT: 'left',
6
+ MIDDLE: 'middle',
7
+ RIGHT: 'right',
8
+ };
9
+ const CLICK_BUTTON_NAMES = Object.values(ClickButton);
10
+ /** The button a click asks for: left when `args.button` is absent, undefined when it is unknown. */
11
+ export function clickButtonFromArgs(args) {
12
+ const raw = args['button'];
13
+ if (raw === undefined) {
14
+ return ClickButton.LEFT;
15
+ }
16
+ if ('string' !== typeof raw) {
17
+ return undefined;
18
+ }
19
+ const name = raw.toLowerCase();
20
+ return CLICK_BUTTON_NAMES.find((known) => known === name);
21
+ }
22
+ /**
23
+ * Why a click or dblclick cannot be driven as asked, or undefined when it can. The page and the
24
+ * server both refuse with this sentence, so an argument is never dropped without a word.
25
+ */
26
+ export function clickInputProblem(action, args) {
27
+ const button = clickButtonFromArgs(args);
28
+ if (button === undefined) {
29
+ return `unsupported click button ${JSON.stringify(args['button'])}: use ${CLICK_BUTTON_NAMES.join(', ')}`;
30
+ }
31
+ if (action === ActionType.DBLCLICK && button !== ClickButton.LEFT) {
32
+ return 'a dblclick uses the left button only: a browser sends no dblclick for another button';
33
+ }
34
+ const raw = args['modifiers'];
35
+ if (Array.isArray(raw)) {
36
+ const unknown = raw.filter((item) => 0 === pressModifiersFromArgs({ modifiers: [item] }).length);
37
+ if (0 < unknown.length) {
38
+ return `unsupported click modifier ${JSON.stringify(unknown[0])}: use Meta, Control, Shift or Alt`;
39
+ }
40
+ }
41
+ return undefined;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
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",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "zod": "^4.6.6",
50
- "open-verification": "1.0.0"
50
+ "open-verification": "1.1.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "fast-check": "^4.10.2"