@reticlehq/core 3.2.0 → 3.4.0
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 +1 -1
- package/dist/artifacts/flow-composition.d.ts +3 -2
- package/dist/artifacts/flow-constants.d.ts +68 -2
- package/dist/artifacts/flow-constants.js +84 -2
- package/dist/artifacts/flow-expect-flat.d.ts +260 -0
- package/dist/artifacts/flow-expect-flat.js +284 -0
- package/dist/artifacts/flow-mutation-target.d.ts +0 -1
- package/dist/artifacts/flow-mutation-target.js +30 -2
- package/dist/artifacts/flow-step-tool.d.ts +2 -0
- package/dist/artifacts/flow-types.d.ts +1285 -1343
- package/dist/artifacts/flow-types.js +111 -140
- package/dist/artifacts/impact.d.ts +48 -20
- package/dist/artifacts/impact.js +11 -0
- package/dist/artifacts/journal.d.ts +34 -6
- package/dist/artifacts/journal.js +13 -0
- package/dist/hooks/hook-events.d.ts +18 -18
- package/dist/hud-entry.d.ts +9 -0
- package/dist/hud-entry.js +9 -0
- package/dist/identity/source-constants.d.ts +11 -0
- package/dist/identity/source-constants.js +11 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +25 -1
- package/dist/onboarding.d.ts +2 -2
- package/dist/realm/registry.d.ts +0 -8
- package/dist/realm/registry.js +1 -11
- package/dist/registry/daemon-registry.d.ts +14 -4
- package/dist/registry/daemon-registry.js +20 -4
- package/dist/schema/event-message.json +3 -1
- package/dist/schema/event-payloads.json +72 -0
- package/dist/schema/event-type.json +3 -1
- package/dist/schema/reticle-event.json +3 -1
- package/dist/schema/reticle-message.json +3 -1
- package/dist/source-constants.cjs +1 -0
- package/dist/source-constants.d.cts +1 -0
- package/dist/telemetry-feedback.d.ts +6 -6
- package/dist/telemetry-refusal.d.ts +5 -4
- package/dist/telemetry-session.d.ts +25 -2
- package/dist/telemetry-session.js +13 -0
- package/dist/telemetry.d.ts +130 -102
- package/dist/verdict/compare-source.d.ts +80 -0
- package/dist/verdict/compare-source.js +93 -0
- package/dist/verdict/consequence.d.ts +12 -0
- package/dist/verdict/consequence.js +15 -0
- package/dist/verdict/instrumentation-gap.js +1 -1
- package/dist/verdict/intent.d.ts +24 -0
- package/dist/verdict/intent.js +66 -10
- package/dist/verdict/predicate-tree.d.ts +82 -0
- package/dist/verdict/predicate-tree.js +186 -0
- package/dist/verdict/predicate.d.ts +138 -0
- package/dist/verdict/predicate.js +430 -0
- package/dist/verdict/property-assertion.d.ts +191 -0
- package/dist/verdict/property-assertion.js +42 -0
- package/dist/verdict/security.js +16 -4
- package/dist/verdict/verdict-attribution.d.ts +52 -0
- package/dist/verdict/verdict-attribution.js +87 -0
- package/dist/verdict/verification-run.d.ts +330 -83
- package/dist/verdict/verification-run.js +44 -1
- package/dist/verdict/verified-constants.d.ts +9 -0
- package/dist/verdict/verified-constants.js +9 -0
- package/dist/wire/channel.d.ts +10 -0
- package/dist/wire/channel.js +25 -0
- package/dist/wire/constants/constants.d.ts +65 -102
- package/dist/wire/constants/constants.js +79 -101
- package/dist/wire/constants/discovery.d.ts +25 -0
- package/dist/wire/constants/discovery.js +25 -0
- package/dist/wire/constants/event-types.d.ts +122 -0
- package/dist/wire/constants/event-types.js +121 -0
- package/dist/wire/constants/hud-controls.d.ts +19 -0
- package/dist/wire/constants/hud-controls.js +95 -0
- package/dist/wire/constants/hud-use.d.ts +27 -0
- package/dist/wire/constants/hud-use.js +24 -0
- package/dist/wire/constants/session-constants.d.ts +10 -0
- package/dist/wire/constants/session-constants.js +10 -0
- package/dist/wire/event-payloads.d.ts +72 -13
- package/dist/wire/event-payloads.js +26 -4
- package/dist/wire/messages.d.ts +97 -56
- package/dist/wire/messages.js +17 -0
- package/dist/wire/net.d.ts +35 -0
- package/dist/wire/net.js +41 -0
- package/dist/wire/redaction.js +17 -0
- package/dist/wire/state-select.d.ts +2 -1
- package/dist/wire/state-select.js +56 -3
- package/dist/wire/toon.d.ts +1 -1
- package/dist/wire/toon.js +30 -8
- package/dist/wire/types.d.ts +119 -94
- package/dist/wire/types.js +23 -1
- package/dist/words/no-session-reason.d.ts +7 -0
- package/dist/words/no-session-reason.js +7 -0
- package/dist/words/notices.d.ts +7 -0
- package/dist/words/notices.js +9 -2
- package/package.json +7 -2
|
@@ -20,6 +20,19 @@ const LENGTH_SEGMENT = 'length';
|
|
|
20
20
|
function hasIntrinsicLength(value) {
|
|
21
21
|
return Array.isArray(value) || 'string' === typeof value;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* `size` is the second closed name, for the two collections that count with it instead of `length`.
|
|
25
|
+
*
|
|
26
|
+
* The same argument that admitted `length` admits this one: `selectedIds.size` is what an app with a
|
|
27
|
+
* `Set` actually holds, and refusing it reported `found: false` with `availableKeys: []` -- not "I
|
|
28
|
+
* cannot read this", but "the collection is empty", which is a claim about the app and a wrong one
|
|
29
|
+
* (#944).
|
|
30
|
+
*
|
|
31
|
+
* A closed NAME, not a property read, for exactly the reason `length` is. `size` is an accessor on
|
|
32
|
+
* `Set.prototype`/`Map.prototype`, so reaching it by prototype traversal would put `add`, `delete`,
|
|
33
|
+
* `clear`, `constructor` and `__proto__` back on the path grammar in the same move.
|
|
34
|
+
*/
|
|
35
|
+
const SIZE_SEGMENT = 'size';
|
|
23
36
|
/** The keys at a level, as a bounded sample plus the true count when the sample is short. */
|
|
24
37
|
function keysOf(value) {
|
|
25
38
|
if (Array.isArray(value)) {
|
|
@@ -35,10 +48,27 @@ function keysOf(value) {
|
|
|
35
48
|
let total = 0;
|
|
36
49
|
for (const k of value.keys()) {
|
|
37
50
|
total += 1;
|
|
38
|
-
if ('string' === typeof k && keys.length < MAX_AVAILABLE_KEYS)
|
|
51
|
+
if ('string' === typeof k && keys.length < MAX_AVAILABLE_KEYS - 1)
|
|
39
52
|
keys.push(k);
|
|
40
53
|
}
|
|
41
|
-
|
|
54
|
+
// `size` is listed for the reason `length` is listed on an array: it IS selectable here, and a
|
|
55
|
+
// diagnosis that omits it sends someone who wanted the count looking for a key that does not
|
|
56
|
+
// exist. Counted too, so `totalKeys` matches what a caller can actually reach. A Map that
|
|
57
|
+
// really holds a `size` key already lists it, and the explicit entry is what a read returns.
|
|
58
|
+
if (value.has(SIZE_SEGMENT))
|
|
59
|
+
return { keys, total };
|
|
60
|
+
return { keys: [...keys, SIZE_SEGMENT], total: total + 1 };
|
|
61
|
+
}
|
|
62
|
+
if (value instanceof Set) {
|
|
63
|
+
// Was falling through to `Object.keys`, which is `[]` for every Set -- so a miss reported
|
|
64
|
+
// `availableKeys: [], totalKeys: 0` and stated as a fact that the collection was empty. Its
|
|
65
|
+
// members are what is reachable here, plus `size`.
|
|
66
|
+
const keys = [];
|
|
67
|
+
for (const item of value) {
|
|
68
|
+
if ('string' === typeof item && keys.length < MAX_AVAILABLE_KEYS - 1)
|
|
69
|
+
keys.push(item);
|
|
70
|
+
}
|
|
71
|
+
return { keys: [...keys, SIZE_SEGMENT], total: value.size + 1 };
|
|
42
72
|
}
|
|
43
73
|
if ('object' === typeof value && value !== null) {
|
|
44
74
|
const all = Object.keys(value);
|
|
@@ -58,7 +88,8 @@ function miss(value) {
|
|
|
58
88
|
}
|
|
59
89
|
/**
|
|
60
90
|
* Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged.
|
|
61
|
-
* Segments are own keys, canonical array indices, Map keys,
|
|
91
|
+
* Segments are own keys, canonical array indices, Map keys, Set members, `length` on an
|
|
92
|
+
* array/string, or `size` on a Set/Map.
|
|
62
93
|
*/
|
|
63
94
|
export function selectPath(root, path) {
|
|
64
95
|
const segments = path.split('.').filter((s) => s.length > 0);
|
|
@@ -83,10 +114,32 @@ export function selectPath(root, path) {
|
|
|
83
114
|
continue;
|
|
84
115
|
}
|
|
85
116
|
if (current instanceof Map) {
|
|
117
|
+
// An explicit entry wins over the intrinsic. A Map that really holds a key called `size` is
|
|
118
|
+
// answering about its own data, and reading its count instead would be a silent wrong answer
|
|
119
|
+
// on the one shape where both readings are plausible.
|
|
86
120
|
if (current.has(segment)) {
|
|
87
121
|
current = current.get(segment);
|
|
88
122
|
continue;
|
|
89
123
|
}
|
|
124
|
+
if (SIZE_SEGMENT === segment) {
|
|
125
|
+
current = current.size;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
return miss(current);
|
|
129
|
+
}
|
|
130
|
+
if (current instanceof Set) {
|
|
131
|
+
if (SIZE_SEGMENT === segment) {
|
|
132
|
+
current = current.size;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
// MEMBERSHIP, not indexing: a Set has no order to index by, so the only question a named
|
|
136
|
+
// segment can ask of one is whether it holds that item. A segment it does not hold is a MISS
|
|
137
|
+
// rather than `false`, which is how every other absent path behaves here -- and the miss then
|
|
138
|
+
// lists what the Set does hold, which a bare `false` could not.
|
|
139
|
+
if (current.has(segment)) {
|
|
140
|
+
current = true;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
90
143
|
return miss(current);
|
|
91
144
|
}
|
|
92
145
|
// `Object.hasOwn`, not `in`: `in` walks the prototype, so a path segment of `constructor`,
|
package/dist/wire/toon.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* State flags (inside []):
|
|
19
19
|
* vis visible hid hidden en enabled dis disabled
|
|
20
|
-
* chk checked exp expanded focus focused
|
|
20
|
+
* chk checked exp expanded prs pressed focus focused
|
|
21
21
|
* (`present` is on every element, so it is never encoded — see STATE_FLAG.)
|
|
22
22
|
*
|
|
23
23
|
* Attributes (key=value, space-separated):
|
package/dist/wire/toon.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* State flags (inside []):
|
|
19
19
|
* vis visible hid hidden en enabled dis disabled
|
|
20
|
-
* chk checked exp expanded focus focused
|
|
20
|
+
* chk checked exp expanded prs pressed focus focused
|
|
21
21
|
* (`present` is on every element, so it is never encoded — see STATE_FLAG.)
|
|
22
22
|
*
|
|
23
23
|
* Attributes (key=value, space-separated):
|
|
@@ -83,6 +83,7 @@ const STATE_FLAG = {
|
|
|
83
83
|
[ElementState.DISABLED]: 'dis',
|
|
84
84
|
[ElementState.CHECKED]: 'chk',
|
|
85
85
|
[ElementState.EXPANDED]: 'exp',
|
|
86
|
+
[ElementState.PRESSED]: 'prs',
|
|
86
87
|
[ElementState.FOCUSED]: 'focus',
|
|
87
88
|
};
|
|
88
89
|
/** States the `visible` field already encodes, plus the one that is true of everything. */
|
|
@@ -113,20 +114,41 @@ function toText(v) {
|
|
|
113
114
|
return String(v);
|
|
114
115
|
return ''; // undefined / null / object / symbol have no representable text on a wire field
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Quote a text field for a TOON line.
|
|
119
|
+
*
|
|
120
|
+
* Order matters. The backslash goes first, so the escapes added after it are not themselves
|
|
121
|
+
* re-escaped. Then the double quote, which would otherwise end the field early.
|
|
122
|
+
*
|
|
123
|
+
* Then the LINE BREAKS, which is the part a line-oriented format cannot do without. TOON states its
|
|
124
|
+
* own grammar as "one element per line", and a raw newline inside a quoted name split one element
|
|
125
|
+
* across two lines: the second line was not an element and matched no rule of the grammar, so a
|
|
126
|
+
* reader had nothing sane to do with it. Apps supply these routinely rather than exceptionally,
|
|
127
|
+
* because `val=` is the element's current value and a multi-line value is what a textarea holds.
|
|
128
|
+
*
|
|
129
|
+
* Only the two line terminators are escaped. Every other control character is ugly on a line but
|
|
130
|
+
* does not break the one invariant this format has, and this is a projection for an agent to read
|
|
131
|
+
* rather than a sanitiser.
|
|
132
|
+
*
|
|
133
|
+
* `encodeName` and `encodeValue` were byte-identical and are now one function: two copies of an
|
|
134
|
+
* escaping rule is how one of them ends up a character behind the other.
|
|
135
|
+
*/
|
|
136
|
+
function quote(text) {
|
|
137
|
+
const escaped = toText(text)
|
|
138
|
+
.replace(/\\/g, '\\\\')
|
|
139
|
+
.replace(/"/g, '\\"')
|
|
140
|
+
.replace(/\n/g, '\\n')
|
|
141
|
+
.replace(/\r/g, '\\r');
|
|
142
|
+
return `"${escaped}"`;
|
|
121
143
|
}
|
|
122
144
|
function encodeLine(el, depth) {
|
|
123
145
|
const indent = ' '.repeat(depth);
|
|
124
146
|
const type = abbreviateRole(el.role);
|
|
125
147
|
const states = encodeStates(Array.isArray(el.states) ? el.states : [], el.visible);
|
|
126
148
|
const ref = toText(el.ref) || '?';
|
|
127
|
-
const parts = [indent + type, ref,
|
|
149
|
+
const parts = [indent + type, ref, quote(el.name), ...(states ? [states] : [])];
|
|
128
150
|
if ('string' === typeof el.value && el.value.length > 0)
|
|
129
|
-
parts.push(`val=${
|
|
151
|
+
parts.push(`val=${quote(el.value)}`);
|
|
130
152
|
if (el.childCount !== undefined)
|
|
131
153
|
parts.push(`count=${String(el.childCount)}`);
|
|
132
154
|
return parts.join(' ');
|