@reticlehq/core 2.0.1 → 2.2.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/LICENSE +201 -112
- package/NOTICE +5 -0
- package/dist/brand.d.ts +32 -3
- package/dist/brand.d.ts.map +1 -1
- package/dist/brand.js +9 -4
- package/dist/brand.js.map +1 -1
- package/dist/consequence.d.ts +31 -0
- package/dist/consequence.d.ts.map +1 -0
- package/dist/consequence.js +45 -0
- package/dist/consequence.js.map +1 -0
- package/dist/constants.d.ts +161 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +156 -5
- package/dist/constants.js.map +1 -1
- package/dist/daemon-registry.d.ts +5 -5
- package/dist/daemon-registry.d.ts.map +1 -1
- package/dist/daemon-registry.js +5 -5
- package/dist/daemon-registry.js.map +1 -1
- package/dist/event-payloads.d.ts +502 -0
- package/dist/event-payloads.d.ts.map +1 -0
- package/dist/event-payloads.js +138 -0
- package/dist/event-payloads.js.map +1 -0
- package/dist/flow-constants.d.ts +2 -2
- package/dist/flow-constants.js +7 -7
- package/dist/flow-constants.js.map +1 -1
- package/dist/flow-types.d.ts +156 -32
- package/dist/flow-types.d.ts.map +1 -1
- package/dist/flow-types.js +23 -1
- package/dist/flow-types.js.map +1 -1
- package/dist/index.d.ts +19 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -11
- package/dist/index.js.map +1 -1
- package/dist/journal.d.ts +90 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +38 -0
- package/dist/journal.js.map +1 -0
- package/dist/messages.d.ts +118 -16
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +15 -2
- package/dist/messages.js.map +1 -1
- package/dist/notices.d.ts +4 -4
- package/dist/notices.js +4 -4
- package/dist/redaction.d.ts +4 -0
- package/dist/redaction.d.ts.map +1 -0
- package/dist/redaction.js +33 -0
- package/dist/redaction.js.map +1 -0
- package/dist/schema/event-message.json +23 -1
- package/dist/schema/event-type.json +10 -1
- package/dist/schema/reticle-event.json +23 -1
- package/dist/schema/reticle-message.json +23 -1
- package/dist/session-constants.d.ts +2 -2
- package/dist/session-constants.js +2 -2
- package/dist/state-select.d.ts.map +1 -1
- package/dist/state-select.js +21 -5
- package/dist/state-select.js.map +1 -1
- package/dist/toon.d.ts +13 -12
- package/dist/toon.d.ts.map +1 -1
- package/dist/toon.js +37 -20
- package/dist/toon.js.map +1 -1
- package/dist/types.d.ts +80 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -3
- package/dist/types.js.map +1 -1
- package/dist/upgrade.d.ts +5 -5
- package/dist/upgrade.js +3 -3
- package/dist/verification-run.d.ts +25 -23
- package/dist/verification-run.d.ts.map +1 -1
- package/dist/verification-run.js +1 -1
- package/package.json +6 -2
|
@@ -23,22 +23,31 @@
|
|
|
23
23
|
"dom.text",
|
|
24
24
|
"net.request",
|
|
25
25
|
"net.pending",
|
|
26
|
+
"net.stream",
|
|
27
|
+
"perf",
|
|
26
28
|
"route.change",
|
|
27
29
|
"console.log",
|
|
28
30
|
"console.warn",
|
|
29
31
|
"console.error",
|
|
32
|
+
"console.info",
|
|
33
|
+
"console.debug",
|
|
30
34
|
"error.uncaught",
|
|
31
35
|
"visible.shown",
|
|
32
|
-
"visible.hidden",
|
|
33
36
|
"anim.start",
|
|
34
37
|
"anim.end",
|
|
35
38
|
"scroll.position",
|
|
36
39
|
"reveal.shown",
|
|
37
40
|
"signal",
|
|
38
41
|
"state.change",
|
|
42
|
+
"storage.change",
|
|
39
43
|
"page.health",
|
|
44
|
+
"render.commit",
|
|
45
|
+
"focus.change",
|
|
40
46
|
"flow.recorded",
|
|
41
47
|
"transport.overflow",
|
|
48
|
+
"truncated",
|
|
49
|
+
"blind-spot",
|
|
50
|
+
"net.detail",
|
|
42
51
|
"human.control",
|
|
43
52
|
"human.mark"
|
|
44
53
|
]
|
|
@@ -52,6 +61,19 @@
|
|
|
52
61
|
"type": "string",
|
|
53
62
|
"maxLength": 128
|
|
54
63
|
},
|
|
64
|
+
"seq": {
|
|
65
|
+
"type": "integer",
|
|
66
|
+
"minimum": 0
|
|
67
|
+
},
|
|
68
|
+
"actionId": {
|
|
69
|
+
"$ref": "#/definitions/EventMessage/properties/event/properties/ref"
|
|
70
|
+
},
|
|
71
|
+
"attribution": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": [
|
|
74
|
+
"window"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
55
77
|
"data": {
|
|
56
78
|
"type": "object",
|
|
57
79
|
"additionalProperties": {},
|
|
@@ -10,22 +10,31 @@
|
|
|
10
10
|
"dom.text",
|
|
11
11
|
"net.request",
|
|
12
12
|
"net.pending",
|
|
13
|
+
"net.stream",
|
|
14
|
+
"perf",
|
|
13
15
|
"route.change",
|
|
14
16
|
"console.log",
|
|
15
17
|
"console.warn",
|
|
16
18
|
"console.error",
|
|
19
|
+
"console.info",
|
|
20
|
+
"console.debug",
|
|
17
21
|
"error.uncaught",
|
|
18
22
|
"visible.shown",
|
|
19
|
-
"visible.hidden",
|
|
20
23
|
"anim.start",
|
|
21
24
|
"anim.end",
|
|
22
25
|
"scroll.position",
|
|
23
26
|
"reveal.shown",
|
|
24
27
|
"signal",
|
|
25
28
|
"state.change",
|
|
29
|
+
"storage.change",
|
|
26
30
|
"page.health",
|
|
31
|
+
"render.commit",
|
|
32
|
+
"focus.change",
|
|
27
33
|
"flow.recorded",
|
|
28
34
|
"transport.overflow",
|
|
35
|
+
"truncated",
|
|
36
|
+
"blind-spot",
|
|
37
|
+
"net.detail",
|
|
29
38
|
"human.control",
|
|
30
39
|
"human.mark"
|
|
31
40
|
]
|
|
@@ -16,22 +16,31 @@
|
|
|
16
16
|
"dom.text",
|
|
17
17
|
"net.request",
|
|
18
18
|
"net.pending",
|
|
19
|
+
"net.stream",
|
|
20
|
+
"perf",
|
|
19
21
|
"route.change",
|
|
20
22
|
"console.log",
|
|
21
23
|
"console.warn",
|
|
22
24
|
"console.error",
|
|
25
|
+
"console.info",
|
|
26
|
+
"console.debug",
|
|
23
27
|
"error.uncaught",
|
|
24
28
|
"visible.shown",
|
|
25
|
-
"visible.hidden",
|
|
26
29
|
"anim.start",
|
|
27
30
|
"anim.end",
|
|
28
31
|
"scroll.position",
|
|
29
32
|
"reveal.shown",
|
|
30
33
|
"signal",
|
|
31
34
|
"state.change",
|
|
35
|
+
"storage.change",
|
|
32
36
|
"page.health",
|
|
37
|
+
"render.commit",
|
|
38
|
+
"focus.change",
|
|
33
39
|
"flow.recorded",
|
|
34
40
|
"transport.overflow",
|
|
41
|
+
"truncated",
|
|
42
|
+
"blind-spot",
|
|
43
|
+
"net.detail",
|
|
35
44
|
"human.control",
|
|
36
45
|
"human.mark"
|
|
37
46
|
]
|
|
@@ -45,6 +54,19 @@
|
|
|
45
54
|
"type": "string",
|
|
46
55
|
"maxLength": 128
|
|
47
56
|
},
|
|
57
|
+
"seq": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 0
|
|
60
|
+
},
|
|
61
|
+
"actionId": {
|
|
62
|
+
"$ref": "#/definitions/ReticleEvent/properties/ref"
|
|
63
|
+
},
|
|
64
|
+
"attribution": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"enum": [
|
|
67
|
+
"window"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
48
70
|
"data": {
|
|
49
71
|
"type": "object",
|
|
50
72
|
"additionalProperties": {},
|
|
@@ -139,22 +139,31 @@
|
|
|
139
139
|
"dom.text",
|
|
140
140
|
"net.request",
|
|
141
141
|
"net.pending",
|
|
142
|
+
"net.stream",
|
|
143
|
+
"perf",
|
|
142
144
|
"route.change",
|
|
143
145
|
"console.log",
|
|
144
146
|
"console.warn",
|
|
145
147
|
"console.error",
|
|
148
|
+
"console.info",
|
|
149
|
+
"console.debug",
|
|
146
150
|
"error.uncaught",
|
|
147
151
|
"visible.shown",
|
|
148
|
-
"visible.hidden",
|
|
149
152
|
"anim.start",
|
|
150
153
|
"anim.end",
|
|
151
154
|
"scroll.position",
|
|
152
155
|
"reveal.shown",
|
|
153
156
|
"signal",
|
|
154
157
|
"state.change",
|
|
158
|
+
"storage.change",
|
|
155
159
|
"page.health",
|
|
160
|
+
"render.commit",
|
|
161
|
+
"focus.change",
|
|
156
162
|
"flow.recorded",
|
|
157
163
|
"transport.overflow",
|
|
164
|
+
"truncated",
|
|
165
|
+
"blind-spot",
|
|
166
|
+
"net.detail",
|
|
158
167
|
"human.control",
|
|
159
168
|
"human.mark"
|
|
160
169
|
]
|
|
@@ -166,6 +175,19 @@
|
|
|
166
175
|
"type": "string",
|
|
167
176
|
"maxLength": 128
|
|
168
177
|
},
|
|
178
|
+
"seq": {
|
|
179
|
+
"type": "integer",
|
|
180
|
+
"minimum": 0
|
|
181
|
+
},
|
|
182
|
+
"actionId": {
|
|
183
|
+
"$ref": "#/definitions/ReticleMessage/anyOf/3/properties/event/properties/ref"
|
|
184
|
+
},
|
|
185
|
+
"attribution": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"enum": [
|
|
188
|
+
"window"
|
|
189
|
+
]
|
|
190
|
+
},
|
|
169
191
|
"data": {
|
|
170
192
|
"type": "object",
|
|
171
193
|
"additionalProperties": {},
|
|
@@ -72,7 +72,7 @@ export declare const SESSION_HEALTH: {
|
|
|
72
72
|
export declare const SESSION_LIFECYCLE: {
|
|
73
73
|
/**
|
|
74
74
|
* Default agent-idle window before the panel hands back to the human as WAITING. The agent signals
|
|
75
|
-
* this IMMEDIATELY via
|
|
75
|
+
* this IMMEDIATELY via reticle_session {action:"yield"}; this reaper is only the slow backstop for a forgotten yield, so
|
|
76
76
|
* it's deliberately long (a short window would auto-end a session mid slow-step). reticle_session-tunable.
|
|
77
77
|
*/
|
|
78
78
|
readonly IDLE_END_MS: 300000;
|
|
@@ -94,7 +94,7 @@ export declare const SESSION_LIFECYCLE: {
|
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
96
|
* Coding-agent session hygiene thresholds. Coding agents (Claude Code, Codex, Cursor) often
|
|
97
|
-
* complete their task and close their context without calling
|
|
97
|
+
* complete their task and close their context without calling reticle_session {action:"end"}. These constants
|
|
98
98
|
* drive two passive reminder layers: a one-time session_lease on first call, and recurring
|
|
99
99
|
* session_age_warning fields after WARN_AFTER_MS.
|
|
100
100
|
*/
|
|
@@ -70,7 +70,7 @@ export const SESSION_HEALTH = {
|
|
|
70
70
|
export const SESSION_LIFECYCLE = {
|
|
71
71
|
/**
|
|
72
72
|
* Default agent-idle window before the panel hands back to the human as WAITING. The agent signals
|
|
73
|
-
* this IMMEDIATELY via
|
|
73
|
+
* this IMMEDIATELY via reticle_session {action:"yield"}; this reaper is only the slow backstop for a forgotten yield, so
|
|
74
74
|
* it's deliberately long (a short window would auto-end a session mid slow-step). reticle_session-tunable.
|
|
75
75
|
*/
|
|
76
76
|
IDLE_END_MS: 300_000,
|
|
@@ -92,7 +92,7 @@ export const SESSION_LIFECYCLE = {
|
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
94
|
* Coding-agent session hygiene thresholds. Coding agents (Claude Code, Codex, Cursor) often
|
|
95
|
-
* complete their task and close their context without calling
|
|
95
|
+
* complete their task and close their context without calling reticle_session {action:"end"}. These constants
|
|
96
96
|
* drive two passive reminder layers: a one-time session_lease on first call, and recurring
|
|
97
97
|
* session_age_warning fields after WARN_AFTER_MS.
|
|
98
98
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-select.d.ts","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wGAAwG;AACxG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"state-select.d.ts","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wGAAwG;AACxG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAaD,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CA+BrE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkBlE"}
|
package/dist/state-select.js
CHANGED
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
* array indices) and, on a miss, returns the keys that WERE available at the last good level so a wrong
|
|
6
6
|
* path is diagnosable rather than a bare null. `capDepth` prunes deeply-nested values to a budget.
|
|
7
7
|
*/
|
|
8
|
+
/** Cap on how many near-miss keys travel in a failed selection — a 10k-key store must not return a
|
|
9
|
+
* 10k-entry array in the error payload (that was the token blowup the near-miss exists to avoid). */
|
|
10
|
+
const MAX_AVAILABLE_KEYS = 50;
|
|
8
11
|
function keysOf(value) {
|
|
9
12
|
if (Array.isArray(value))
|
|
10
|
-
return value.map((_, i) => String(i));
|
|
13
|
+
return value.slice(0, MAX_AVAILABLE_KEYS).map((_, i) => String(i));
|
|
11
14
|
if (typeof value === 'object' && value !== null)
|
|
12
|
-
return Object.keys(value);
|
|
15
|
+
return Object.keys(value).slice(0, MAX_AVAILABLE_KEYS);
|
|
13
16
|
return [];
|
|
14
17
|
}
|
|
15
18
|
/** Walk `path` (e.g. "captionCache.v3.0.text") into `root`. Empty path returns root unchanged. */
|
|
@@ -18,14 +21,24 @@ export function selectPath(root, path) {
|
|
|
18
21
|
let current = root;
|
|
19
22
|
for (const segment of segments) {
|
|
20
23
|
if (Array.isArray(current)) {
|
|
24
|
+
// Require a CANONICAL index string. `Number('01')`/`Number('1e0')`/`Number(' 1')` all coerce to 1,
|
|
25
|
+
// so `items.01` silently read index 1 — an assertion on a path that doesn't exist quietly passed.
|
|
26
|
+
// `String(index) === segment` accepts only "0","1","2",… and rejects the coercion aliases.
|
|
21
27
|
const index = Number(segment);
|
|
22
|
-
if (!Number.isInteger(index) ||
|
|
28
|
+
if (!Number.isInteger(index) ||
|
|
29
|
+
index < 0 ||
|
|
30
|
+
String(index) !== segment ||
|
|
31
|
+
index >= current.length) {
|
|
23
32
|
return { found: false, value: null, availableKeys: keysOf(current) };
|
|
24
33
|
}
|
|
25
34
|
current = current[index];
|
|
26
35
|
continue;
|
|
27
36
|
}
|
|
28
|
-
|
|
37
|
+
// `Object.hasOwn`, not `in`: `in` walks the prototype, so a path segment of `constructor`,
|
|
38
|
+
// `__proto__`, or `toString` reported found:true and returned a function from Object.prototype —
|
|
39
|
+
// a state assertion on a typo'd path silently passed against a builtin instead of failing with
|
|
40
|
+
// availableKeys. Only an OWN key is a real state path.
|
|
41
|
+
if (typeof current === 'object' && current !== null && Object.hasOwn(current, segment)) {
|
|
29
42
|
current = current[segment];
|
|
30
43
|
continue;
|
|
31
44
|
}
|
|
@@ -50,7 +63,10 @@ export function capDepth(value, maxDepth) {
|
|
|
50
63
|
const keys = Object.keys(value);
|
|
51
64
|
if (maxDepth === 0)
|
|
52
65
|
return `{…${String(keys.length)} keys}`;
|
|
53
|
-
|
|
66
|
+
// Null-proto target: a wire object can carry an own `__proto__` key (via JSON.parse), and
|
|
67
|
+
// `out['__proto__'] = …` on a normal object writes the prototype slot instead of a key, losing
|
|
68
|
+
// that key from the projection. A prototype-less target makes every key an ordinary assignment.
|
|
69
|
+
const out = Object.create(null);
|
|
54
70
|
for (const key of keys)
|
|
55
71
|
out[key] = capDepth(value[key], maxDepth - 1);
|
|
56
72
|
return out;
|
package/dist/state-select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-select.js","sourceRoot":"","sources":["../src/state-select.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,SAAS,MAAM,CAAC,KA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;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,QAAQ,KAAK,CAAC;YAAE,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC5D,0FAA0F;QAC1F,+FAA+F;QAC/F,gGAAgG;QAChG,MAAM,GAAG,GAA4B,MAAM,CAAC,MAAM,CAAC,IAAI,CAA4B,CAAC;QACpF,KAAK,MAAM,GAAG,IAAI,IAAI;YACpB,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAE,KAAiC,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC;QAC7E,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/toon.d.ts
CHANGED
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
* TOON — Token-Optimized Object Notation.
|
|
3
3
|
*
|
|
4
4
|
* A compact, deterministic, line-oriented text format for Reticle snapshots and query results.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* This is a ONE-WAY, encode-only projection of the internal JSON representation (there is no decoder
|
|
6
|
+
* back to JSON — the agent reads TOON, it is never parsed back). Not a binary format — Claude must be
|
|
7
|
+
* able to generate and read it reliably from its training data alone.
|
|
7
8
|
*
|
|
8
9
|
* Grammar (one element per line):
|
|
9
|
-
*
|
|
10
|
+
* type ref "name" [states] key=value...
|
|
10
11
|
*
|
|
11
12
|
* Element types (abbreviated roles):
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* btn button inp textbox/input sel combobox/listbox chk checkbox
|
|
14
|
+
* rad radio lnk link img img dlg dialog/alertdialog
|
|
15
|
+
* nav navigation lst list/listbox tab tab/tabpanel hdr heading
|
|
16
|
+
* frm form mn menu/menubar fld group/fieldset el (any other role)
|
|
16
17
|
*
|
|
17
18
|
* State flags (inside []):
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* vis visible hid hidden en enabled dis disabled
|
|
20
|
+
* chk checked uch unchecked exp expanded col collapsed focus
|
|
20
21
|
*
|
|
21
22
|
* Attributes (key=value, space-separated):
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* val="..." current value of the element
|
|
24
|
+
* count=N child count (for containers, replaces expanding children)
|
|
25
|
+
* ph="..." placeholder text
|
|
25
26
|
*/
|
|
26
27
|
/** Encode an ElementDescriptor to a TOON line. */
|
|
27
28
|
export interface ToonElement {
|
package/dist/toon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toon.d.ts","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA+HD,wEAAwE;AACxE,wBAAgB,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAGtD;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAIpE;AAED,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOnD"}
|
package/dist/toon.js
CHANGED
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
* TOON — Token-Optimized Object Notation.
|
|
3
3
|
*
|
|
4
4
|
* A compact, deterministic, line-oriented text format for Reticle snapshots and query results.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* This is a ONE-WAY, encode-only projection of the internal JSON representation (there is no decoder
|
|
6
|
+
* back to JSON — the agent reads TOON, it is never parsed back). Not a binary format — Claude must be
|
|
7
|
+
* able to generate and read it reliably from its training data alone.
|
|
7
8
|
*
|
|
8
9
|
* Grammar (one element per line):
|
|
9
|
-
*
|
|
10
|
+
* type ref "name" [states] key=value...
|
|
10
11
|
*
|
|
11
12
|
* Element types (abbreviated roles):
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* btn button inp textbox/input sel combobox/listbox chk checkbox
|
|
14
|
+
* rad radio lnk link img img dlg dialog/alertdialog
|
|
15
|
+
* nav navigation lst list/listbox tab tab/tabpanel hdr heading
|
|
16
|
+
* frm form mn menu/menubar fld group/fieldset el (any other role)
|
|
16
17
|
*
|
|
17
18
|
* State flags (inside []):
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* vis visible hid hidden en enabled dis disabled
|
|
20
|
+
* chk checked uch unchecked exp expanded col collapsed focus
|
|
20
21
|
*
|
|
21
22
|
* Attributes (key=value, space-separated):
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* val="..." current value of the element
|
|
24
|
+
* count=N child count (for containers, replaces expanding children)
|
|
25
|
+
* ph="..." placeholder text
|
|
25
26
|
*/
|
|
26
27
|
const ROLE_MAP = {
|
|
27
28
|
button: 'btn',
|
|
@@ -103,18 +104,28 @@ function encodeStates(states, visible) {
|
|
|
103
104
|
}
|
|
104
105
|
return flags.length > 0 ? `[${flags.join(',')}]` : '';
|
|
105
106
|
}
|
|
107
|
+
/** Coerce a wire field to a string. resultToToon receives UNVALIDATED wire data cast to ToonElement,
|
|
108
|
+
* so a missing/numeric `name` must not make `.replace` throw and lose the whole encode. */
|
|
109
|
+
function toText(v) {
|
|
110
|
+
if (typeof v === 'string')
|
|
111
|
+
return v;
|
|
112
|
+
if (typeof v === 'number' || typeof v === 'boolean' || typeof v === 'bigint')
|
|
113
|
+
return String(v);
|
|
114
|
+
return ''; // undefined / null / object / symbol have no representable text on a wire field
|
|
115
|
+
}
|
|
106
116
|
function encodeName(name) {
|
|
107
|
-
return `"${name.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
117
|
+
return `"${toText(name).replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
108
118
|
}
|
|
109
119
|
function encodeValue(val) {
|
|
110
|
-
return `"${val.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
120
|
+
return `"${toText(val).replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
111
121
|
}
|
|
112
122
|
function encodeLine(el, depth) {
|
|
113
123
|
const indent = ' '.repeat(depth);
|
|
114
124
|
const type = abbreviateRole(el.role);
|
|
115
|
-
const states = encodeStates(el.states
|
|
116
|
-
const
|
|
117
|
-
|
|
125
|
+
const states = encodeStates(Array.isArray(el.states) ? el.states : [], el.visible);
|
|
126
|
+
const ref = toText(el.ref) || '?';
|
|
127
|
+
const parts = [indent + type, ref, encodeName(el.name), ...(states ? [states] : [])];
|
|
128
|
+
if (typeof el.value === 'string' && el.value.length > 0)
|
|
118
129
|
parts.push(`val=${encodeValue(el.value)}`);
|
|
119
130
|
if (el.childCount !== undefined)
|
|
120
131
|
parts.push(`count=${String(el.childCount)}`);
|
|
@@ -123,9 +134,15 @@ function encodeLine(el, depth) {
|
|
|
123
134
|
function encodeTree(elements, depth = 0) {
|
|
124
135
|
const lines = [];
|
|
125
136
|
for (const el of elements) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
lines.push(
|
|
137
|
+
// A single malformed element must not lose the rest of the tree — fall back to a placeholder line.
|
|
138
|
+
try {
|
|
139
|
+
lines.push(encodeLine(el, depth));
|
|
140
|
+
if (Array.isArray(el.children) && el.children.length > 0) {
|
|
141
|
+
lines.push(encodeTree(el.children, depth + 1));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
lines.push(`${' '.repeat(depth)}el ? "[unencodable]"`);
|
|
129
146
|
}
|
|
130
147
|
}
|
|
131
148
|
return lines.join('\n');
|
package/dist/toon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toon.js","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"toon.js","sourceRoot":"","sources":["../src/toon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAeH,MAAM,QAAQ,GAA2B;IACvC,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,KAAK;IAClB,UAAU,EAAE,KAAK;IACjB,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,KAAK;IACZ,GAAG,EAAE,KAAK;IACV,IA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