@reticlehq/core 1.3.0 → 2.0.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.
Files changed (80) hide show
  1. package/README.md +14 -86
  2. package/dist/brand.d.ts +21 -0
  3. package/dist/brand.d.ts.map +1 -0
  4. package/dist/brand.js +16 -0
  5. package/dist/brand.js.map +1 -0
  6. package/dist/constants.d.ts +371 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +343 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/flow-constants.d.ts +175 -0
  11. package/dist/flow-constants.d.ts.map +1 -0
  12. package/dist/flow-constants.js +162 -0
  13. package/dist/flow-constants.js.map +1 -0
  14. package/dist/flow-types.d.ts +1182 -0
  15. package/dist/flow-types.d.ts.map +1 -0
  16. package/dist/flow-types.js +144 -0
  17. package/dist/flow-types.js.map +1 -0
  18. package/dist/index.d.ts +13 -2
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +13 -5543
  21. package/dist/index.js.map +1 -0
  22. package/dist/messages.d.ts +424 -0
  23. package/dist/messages.d.ts.map +1 -0
  24. package/dist/messages.js +103 -0
  25. package/dist/messages.js.map +1 -0
  26. package/dist/notices.d.ts +47 -0
  27. package/dist/notices.d.ts.map +1 -0
  28. package/dist/notices.js +51 -0
  29. package/dist/notices.js.map +1 -0
  30. package/dist/schema/command-message.json +41 -0
  31. package/dist/schema/command-result.json +34 -0
  32. package/dist/schema/event-message.json +77 -0
  33. package/dist/schema/event-type.json +35 -0
  34. package/dist/schema/hello-message.json +59 -0
  35. package/dist/schema/reticle-event.json +63 -0
  36. package/dist/schema/reticle-message.json +193 -0
  37. package/dist/security.d.ts +5 -0
  38. package/dist/security.d.ts.map +1 -0
  39. package/dist/security.js +22 -0
  40. package/dist/security.js.map +1 -0
  41. package/dist/session-constants.d.ts +116 -0
  42. package/dist/session-constants.d.ts.map +1 -0
  43. package/dist/session-constants.js +113 -0
  44. package/dist/session-constants.js.map +1 -0
  45. package/dist/state-select.d.ts +23 -0
  46. package/dist/state-select.d.ts.map +1 -0
  47. package/dist/state-select.js +60 -0
  48. package/dist/state-select.js.map +1 -0
  49. package/dist/toon.d.ts +44 -0
  50. package/dist/toon.d.ts.map +1 -0
  51. package/dist/toon.js +153 -0
  52. package/dist/toon.js.map +1 -0
  53. package/dist/types.d.ts +833 -0
  54. package/dist/types.d.ts.map +1 -0
  55. package/dist/types.js +165 -0
  56. package/dist/types.js.map +1 -0
  57. package/dist/upgrade.d.ts +74 -0
  58. package/dist/upgrade.d.ts.map +1 -0
  59. package/dist/upgrade.js +88 -0
  60. package/dist/upgrade.js.map +1 -0
  61. package/dist/verification-run.d.ts +1195 -0
  62. package/dist/verification-run.d.ts.map +1 -0
  63. package/dist/verification-run.js +261 -0
  64. package/dist/verification-run.js.map +1 -0
  65. package/package.json +32 -79
  66. package/dist/babel.d.ts +0 -7
  67. package/dist/babel.js +0 -32
  68. package/dist/cli.d.ts +0 -1
  69. package/dist/cli.js +0 -11264
  70. package/dist/eslint.d.ts +0 -1
  71. package/dist/eslint.js +0 -134
  72. package/dist/loader.cjs +0 -52
  73. package/dist/next.d.ts +0 -21
  74. package/dist/next.js +0 -24
  75. package/dist/server.d.ts +0 -1
  76. package/dist/server.js +0 -9486
  77. package/dist/test.d.ts +0 -1
  78. package/dist/test.js +0 -9368
  79. package/dist/vite.d.ts +0 -1
  80. package/dist/vite.js +0 -196
@@ -0,0 +1,41 @@
1
+ {
2
+ "$ref": "#/definitions/CommandMessage",
3
+ "definitions": {
4
+ "CommandMessage": {
5
+ "type": "object",
6
+ "properties": {
7
+ "kind": {
8
+ "type": "string",
9
+ "const": "command"
10
+ },
11
+ "id": {
12
+ "type": "string",
13
+ "minLength": 1,
14
+ "maxLength": 128
15
+ },
16
+ "sessionId": {
17
+ "type": "string",
18
+ "minLength": 1,
19
+ "maxLength": 128
20
+ },
21
+ "name": {
22
+ "type": "string",
23
+ "minLength": 1,
24
+ "maxLength": 128
25
+ },
26
+ "args": {
27
+ "type": "object",
28
+ "additionalProperties": {},
29
+ "default": {}
30
+ }
31
+ },
32
+ "required": [
33
+ "kind",
34
+ "id",
35
+ "name"
36
+ ],
37
+ "additionalProperties": false
38
+ }
39
+ },
40
+ "$schema": "http://json-schema.org/draft-07/schema#"
41
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$ref": "#/definitions/CommandResult",
3
+ "definitions": {
4
+ "CommandResult": {
5
+ "type": "object",
6
+ "properties": {
7
+ "kind": {
8
+ "type": "string",
9
+ "const": "command_result"
10
+ },
11
+ "id": {
12
+ "type": "string",
13
+ "minLength": 1,
14
+ "maxLength": 128
15
+ },
16
+ "ok": {
17
+ "type": "boolean"
18
+ },
19
+ "result": {},
20
+ "error": {
21
+ "type": "string",
22
+ "maxLength": 4096
23
+ }
24
+ },
25
+ "required": [
26
+ "kind",
27
+ "id",
28
+ "ok"
29
+ ],
30
+ "additionalProperties": false
31
+ }
32
+ },
33
+ "$schema": "http://json-schema.org/draft-07/schema#"
34
+ }
@@ -0,0 +1,77 @@
1
+ {
2
+ "$ref": "#/definitions/EventMessage",
3
+ "definitions": {
4
+ "EventMessage": {
5
+ "type": "object",
6
+ "properties": {
7
+ "kind": {
8
+ "type": "string",
9
+ "const": "event"
10
+ },
11
+ "event": {
12
+ "type": "object",
13
+ "properties": {
14
+ "t": {
15
+ "type": "number"
16
+ },
17
+ "type": {
18
+ "type": "string",
19
+ "enum": [
20
+ "dom.added",
21
+ "dom.removed",
22
+ "dom.attr",
23
+ "dom.text",
24
+ "net.request",
25
+ "net.pending",
26
+ "route.change",
27
+ "console.log",
28
+ "console.warn",
29
+ "console.error",
30
+ "error.uncaught",
31
+ "visible.shown",
32
+ "visible.hidden",
33
+ "anim.start",
34
+ "anim.end",
35
+ "scroll.position",
36
+ "reveal.shown",
37
+ "signal",
38
+ "state.change",
39
+ "page.health",
40
+ "flow.recorded",
41
+ "transport.overflow",
42
+ "human.control",
43
+ "human.mark"
44
+ ]
45
+ },
46
+ "sessionId": {
47
+ "type": "string",
48
+ "minLength": 1,
49
+ "maxLength": 128
50
+ },
51
+ "ref": {
52
+ "type": "string",
53
+ "maxLength": 128
54
+ },
55
+ "data": {
56
+ "type": "object",
57
+ "additionalProperties": {},
58
+ "default": {}
59
+ }
60
+ },
61
+ "required": [
62
+ "t",
63
+ "type",
64
+ "sessionId"
65
+ ],
66
+ "additionalProperties": false
67
+ }
68
+ },
69
+ "required": [
70
+ "kind",
71
+ "event"
72
+ ],
73
+ "additionalProperties": false
74
+ }
75
+ },
76
+ "$schema": "http://json-schema.org/draft-07/schema#"
77
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$ref": "#/definitions/EventType",
3
+ "definitions": {
4
+ "EventType": {
5
+ "type": "string",
6
+ "enum": [
7
+ "dom.added",
8
+ "dom.removed",
9
+ "dom.attr",
10
+ "dom.text",
11
+ "net.request",
12
+ "net.pending",
13
+ "route.change",
14
+ "console.log",
15
+ "console.warn",
16
+ "console.error",
17
+ "error.uncaught",
18
+ "visible.shown",
19
+ "visible.hidden",
20
+ "anim.start",
21
+ "anim.end",
22
+ "scroll.position",
23
+ "reveal.shown",
24
+ "signal",
25
+ "state.change",
26
+ "page.health",
27
+ "flow.recorded",
28
+ "transport.overflow",
29
+ "human.control",
30
+ "human.mark"
31
+ ]
32
+ }
33
+ },
34
+ "$schema": "http://json-schema.org/draft-07/schema#"
35
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "$ref": "#/definitions/HelloMessage",
3
+ "definitions": {
4
+ "HelloMessage": {
5
+ "type": "object",
6
+ "properties": {
7
+ "kind": {
8
+ "type": "string",
9
+ "const": "hello"
10
+ },
11
+ "protocolVersion": {
12
+ "type": "number",
13
+ "const": 1
14
+ },
15
+ "sessionId": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "maxLength": 128
19
+ },
20
+ "url": {
21
+ "type": "string",
22
+ "maxLength": 4096
23
+ },
24
+ "title": {
25
+ "type": "string",
26
+ "maxLength": 512
27
+ },
28
+ "projectId": {
29
+ "$ref": "#/definitions/HelloMessage/properties/sessionId"
30
+ },
31
+ "adapters": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "string",
35
+ "maxLength": 128
36
+ },
37
+ "maxItems": 32
38
+ },
39
+ "token": {
40
+ "type": "string",
41
+ "maxLength": 512
42
+ },
43
+ "hasCapabilities": {
44
+ "type": "boolean"
45
+ }
46
+ },
47
+ "required": [
48
+ "kind",
49
+ "protocolVersion",
50
+ "sessionId",
51
+ "url",
52
+ "title",
53
+ "adapters"
54
+ ],
55
+ "additionalProperties": false
56
+ }
57
+ },
58
+ "$schema": "http://json-schema.org/draft-07/schema#"
59
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$ref": "#/definitions/ReticleEvent",
3
+ "definitions": {
4
+ "ReticleEvent": {
5
+ "type": "object",
6
+ "properties": {
7
+ "t": {
8
+ "type": "number"
9
+ },
10
+ "type": {
11
+ "type": "string",
12
+ "enum": [
13
+ "dom.added",
14
+ "dom.removed",
15
+ "dom.attr",
16
+ "dom.text",
17
+ "net.request",
18
+ "net.pending",
19
+ "route.change",
20
+ "console.log",
21
+ "console.warn",
22
+ "console.error",
23
+ "error.uncaught",
24
+ "visible.shown",
25
+ "visible.hidden",
26
+ "anim.start",
27
+ "anim.end",
28
+ "scroll.position",
29
+ "reveal.shown",
30
+ "signal",
31
+ "state.change",
32
+ "page.health",
33
+ "flow.recorded",
34
+ "transport.overflow",
35
+ "human.control",
36
+ "human.mark"
37
+ ]
38
+ },
39
+ "sessionId": {
40
+ "type": "string",
41
+ "minLength": 1,
42
+ "maxLength": 128
43
+ },
44
+ "ref": {
45
+ "type": "string",
46
+ "maxLength": 128
47
+ },
48
+ "data": {
49
+ "type": "object",
50
+ "additionalProperties": {},
51
+ "default": {}
52
+ }
53
+ },
54
+ "required": [
55
+ "t",
56
+ "type",
57
+ "sessionId"
58
+ ],
59
+ "additionalProperties": false
60
+ }
61
+ },
62
+ "$schema": "http://json-schema.org/draft-07/schema#"
63
+ }
@@ -0,0 +1,193 @@
1
+ {
2
+ "$ref": "#/definitions/ReticleMessage",
3
+ "definitions": {
4
+ "ReticleMessage": {
5
+ "anyOf": [
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "kind": {
10
+ "type": "string",
11
+ "const": "hello"
12
+ },
13
+ "protocolVersion": {
14
+ "type": "number",
15
+ "const": 1
16
+ },
17
+ "sessionId": {
18
+ "type": "string",
19
+ "minLength": 1,
20
+ "maxLength": 128
21
+ },
22
+ "url": {
23
+ "type": "string",
24
+ "maxLength": 4096
25
+ },
26
+ "title": {
27
+ "type": "string",
28
+ "maxLength": 512
29
+ },
30
+ "projectId": {
31
+ "$ref": "#/definitions/ReticleMessage/anyOf/0/properties/sessionId"
32
+ },
33
+ "adapters": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "string",
37
+ "maxLength": 128
38
+ },
39
+ "maxItems": 32
40
+ },
41
+ "token": {
42
+ "type": "string",
43
+ "maxLength": 512
44
+ },
45
+ "hasCapabilities": {
46
+ "type": "boolean"
47
+ }
48
+ },
49
+ "required": [
50
+ "kind",
51
+ "protocolVersion",
52
+ "sessionId",
53
+ "url",
54
+ "title",
55
+ "adapters"
56
+ ],
57
+ "additionalProperties": false
58
+ },
59
+ {
60
+ "type": "object",
61
+ "properties": {
62
+ "kind": {
63
+ "type": "string",
64
+ "const": "command"
65
+ },
66
+ "id": {
67
+ "type": "string",
68
+ "minLength": 1,
69
+ "maxLength": 128
70
+ },
71
+ "sessionId": {
72
+ "$ref": "#/definitions/ReticleMessage/anyOf/0/properties/sessionId"
73
+ },
74
+ "name": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "maxLength": 128
78
+ },
79
+ "args": {
80
+ "type": "object",
81
+ "additionalProperties": {},
82
+ "default": {}
83
+ }
84
+ },
85
+ "required": [
86
+ "kind",
87
+ "id",
88
+ "name"
89
+ ],
90
+ "additionalProperties": false
91
+ },
92
+ {
93
+ "type": "object",
94
+ "properties": {
95
+ "kind": {
96
+ "type": "string",
97
+ "const": "command_result"
98
+ },
99
+ "id": {
100
+ "type": "string",
101
+ "minLength": 1,
102
+ "maxLength": 128
103
+ },
104
+ "ok": {
105
+ "type": "boolean"
106
+ },
107
+ "result": {},
108
+ "error": {
109
+ "type": "string",
110
+ "maxLength": 4096
111
+ }
112
+ },
113
+ "required": [
114
+ "kind",
115
+ "id",
116
+ "ok"
117
+ ],
118
+ "additionalProperties": false
119
+ },
120
+ {
121
+ "type": "object",
122
+ "properties": {
123
+ "kind": {
124
+ "type": "string",
125
+ "const": "event"
126
+ },
127
+ "event": {
128
+ "type": "object",
129
+ "properties": {
130
+ "t": {
131
+ "type": "number"
132
+ },
133
+ "type": {
134
+ "type": "string",
135
+ "enum": [
136
+ "dom.added",
137
+ "dom.removed",
138
+ "dom.attr",
139
+ "dom.text",
140
+ "net.request",
141
+ "net.pending",
142
+ "route.change",
143
+ "console.log",
144
+ "console.warn",
145
+ "console.error",
146
+ "error.uncaught",
147
+ "visible.shown",
148
+ "visible.hidden",
149
+ "anim.start",
150
+ "anim.end",
151
+ "scroll.position",
152
+ "reveal.shown",
153
+ "signal",
154
+ "state.change",
155
+ "page.health",
156
+ "flow.recorded",
157
+ "transport.overflow",
158
+ "human.control",
159
+ "human.mark"
160
+ ]
161
+ },
162
+ "sessionId": {
163
+ "$ref": "#/definitions/ReticleMessage/anyOf/0/properties/sessionId"
164
+ },
165
+ "ref": {
166
+ "type": "string",
167
+ "maxLength": 128
168
+ },
169
+ "data": {
170
+ "type": "object",
171
+ "additionalProperties": {},
172
+ "default": {}
173
+ }
174
+ },
175
+ "required": [
176
+ "t",
177
+ "type",
178
+ "sessionId"
179
+ ],
180
+ "additionalProperties": false
181
+ }
182
+ },
183
+ "required": [
184
+ "kind",
185
+ "event"
186
+ ],
187
+ "additionalProperties": false
188
+ }
189
+ ]
190
+ }
191
+ },
192
+ "$schema": "http://json-schema.org/draft-07/schema#"
193
+ }
@@ -0,0 +1,5 @@
1
+ /** True only for literal loopback hosts, never lookalike DNS names such as 127.example.com. */
2
+ export declare function isLoopbackHostname(hostname: string): boolean;
3
+ /** Best-effort classifier for labels and tool names that can trigger irreversible effects. */
4
+ export declare function isDangerousActionText(text: string): boolean;
5
+ //# sourceMappingURL=security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAGA,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAe5D;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D"}
@@ -0,0 +1,22 @@
1
+ const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|logout|log out|sign out|close account|cancel subscription|purchase|buy|pay|place order|confirm order|deploy|publish|send|transfer|withdraw|refund)\b/i;
2
+ /** True only for literal loopback hosts, never lookalike DNS names such as 127.example.com. */
3
+ export function isLoopbackHostname(hostname) {
4
+ const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, '');
5
+ if (normalized === 'localhost' || normalized === '::1' || normalized === '0:0:0:0:0:0:0:1') {
6
+ return true;
7
+ }
8
+ const octets = normalized.split('.');
9
+ return (octets.length === 4 &&
10
+ octets[0] === '127' &&
11
+ octets.every((octet) => {
12
+ if (!/^\d{1,3}$/.test(octet))
13
+ return false;
14
+ const value = Number(octet);
15
+ return value >= 0 && value <= 255;
16
+ }));
17
+ }
18
+ /** Best-effort classifier for labels and tool names that can trigger irreversible effects. */
19
+ export function isDangerousActionText(text) {
20
+ return DANGEROUS_ACTION.test(text.replace(/[_-]+/g, ' '));
21
+ }
22
+ //# sourceMappingURL=security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security.js","sourceRoot":"","sources":["../src/security.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GACpB,kNAAkN,CAAC;AAErN,+FAA+F;AAC/F,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAClE,IAAI,UAAU,KAAK,WAAW,IAAI,UAAU,KAAK,KAAK,IAAI,UAAU,KAAK,iBAAiB,EAAE,CAAC;QAC3F,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,CAAC;QACnB,MAAM,CAAC,CAAC,CAAC,KAAK,KAAK;QACnB,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC;QACpC,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Session lifecycle, health, control, and lease constants. Split out of constants.ts to keep each
3
+ * file under the cohesion cap; re-exported from the package index, so importers are unaffected.
4
+ */
5
+ /**
6
+ * Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
7
+ * `active → paused → active … → ended`; `ended` is terminal.
8
+ */
9
+ export declare const SessionState: {
10
+ readonly ACTIVE: "active";
11
+ readonly PAUSED: "paused";
12
+ readonly ENDED: "ended";
13
+ };
14
+ export type SessionState = (typeof SessionState)[keyof typeof SessionState];
15
+ /** Narrow an unknown wire value to a SessionState (no zod needed at this membership boundary). */
16
+ export declare function isSessionState(value: unknown): value is SessionState;
17
+ /**
18
+ * Sentinel session label meaning "give this tab its own unique id". The SDK maps it (and an absent
19
+ * label) to a per-tab id so several tabs — a human tab + an Reticle-driven tour, a Director-cut popup —
20
+ * never collide on one session id. Pass an explicit label only when tabs should intentionally share.
21
+ */
22
+ export declare const SESSION_AUTO = "auto";
23
+ /** Live-control: kinds a human can emit from the panel (the `kind` of a HUMAN_CONTROL event). */
24
+ export declare const HumanControlKind: {
25
+ readonly PAUSE: "pause";
26
+ readonly RESUME: "resume";
27
+ readonly END: "end";
28
+ readonly MESSAGE: "message";
29
+ /** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
30
+ readonly REPLAY: "replay";
31
+ };
32
+ export type HumanControlKind = (typeof HumanControlKind)[keyof typeof HumanControlKind];
33
+ /**
34
+ * Human review marks: the durability tier of the anchor that pins a mark to an element. Mirrors the
35
+ * browser's auto-anchor AnchorStrategy values (testid > component@source > role > position) so the
36
+ * agent draining a mark knows how trustworthy the element address is. Wire-owned here because the
37
+ * mark crosses browser → bridge → agent; the browser maps its synthesized anchor onto these.
38
+ */
39
+ export declare const MarkAnchorStrategy: {
40
+ readonly TESTID: "testid";
41
+ readonly COMPONENT: "component";
42
+ readonly ROLE: "role";
43
+ readonly POSITION: "position";
44
+ };
45
+ export type MarkAnchorStrategy = (typeof MarkAnchorStrategy)[keyof typeof MarkAnchorStrategy];
46
+ /** Human review marks: lifecycle of a mark in the server-side review store. */
47
+ export declare const MarkStatus: {
48
+ /** Flagged by the human, not yet addressed by the agent. */
49
+ readonly PENDING: "pending";
50
+ /** The agent claimed the mark as fixed (reticle_review resolve). Terminal. */
51
+ readonly RESOLVED: "resolved";
52
+ };
53
+ export type MarkStatus = (typeof MarkStatus)[keyof typeof MarkStatus];
54
+ /**
55
+ * SDK page-health heartbeat cadence (native timer) and the server's
56
+ * throttle threshold. Kept named so the server's staleness check can be reasoned about
57
+ * against the SDK's heartbeat (≈ 2 missed heartbeats ⇒ throttled).
58
+ */
59
+ export declare const SESSION_HEALTH: {
60
+ readonly HEARTBEAT_MS: 5000;
61
+ /** lastSeenMs beyond this ⇒ throttled (≈ 2 missed heartbeats). */
62
+ readonly STALE_THRESHOLD_MS: 12000;
63
+ };
64
+ /**
65
+ * Server-authoritative session liveness. The browser-side idle timer is throttled in a backgrounded
66
+ * tab and dies entirely if the agent (MCP client) kills the bridge — so the Node server (immune to
67
+ * throttling) owns the decision: a session whose AGENT has been idle past `IDLE_END_MS` is reaped and
68
+ * ended via a PRESENTER push (which a throttled tab still receives). `BRIDGE_LOST_MS` is the browser's
69
+ * own fallback: when it cannot reach the bridge for this long (server/agent process gone), it ends the
70
+ * session itself so the HUD never sits "running" forever.
71
+ */
72
+ export declare const SESSION_LIFECYCLE: {
73
+ /**
74
+ * Default agent-idle window before the panel hands back to the human as WAITING. The agent signals
75
+ * this IMMEDIATELY via reticle_yield; this reaper is only the slow backstop for a forgotten yield, so
76
+ * it's deliberately long (a short window would auto-end a session mid slow-step). reticle_session-tunable.
77
+ */
78
+ readonly IDLE_END_MS: 300000;
79
+ /** Floor for a tuned idle window (so an agent can't disable the safety net). */
80
+ readonly IDLE_END_MIN_MS: 5000;
81
+ /** How often the server reaper sweeps sessions for idle/disconnected ones. */
82
+ readonly REAP_INTERVAL_MS: 5000;
83
+ /** Browser fallback: continuous failure to reach the bridge for this long ⇒ self-end the session. */
84
+ readonly BRIDGE_LOST_MS: 15000;
85
+ /**
86
+ * Daemon self-shutdown: after this long with NO agent connected, NO browser session, and NO pool
87
+ * lease, the detached daemon tears itself down (closes Chromium + bridge, frees the port, removes its
88
+ * pidfile, exits) so Reticle never lingers eating resources after the editor closes. Long enough to
89
+ * survive brief agent reconnects between turns; overridable via RETICLE_IDLE_SHUTDOWN_MS (0 = never).
90
+ */
91
+ readonly DAEMON_IDLE_SHUTDOWN_MS: 300000;
92
+ /** How often the daemon checks whether it has gone idle. Unref'd, so it never keeps the process up. */
93
+ readonly DAEMON_IDLE_CHECK_MS: 30000;
94
+ };
95
+ /**
96
+ * Coding-agent session hygiene thresholds. Coding agents (Claude Code, Codex, Cursor) often
97
+ * complete their task and close their context without calling reticle_end_session. These constants
98
+ * drive two passive reminder layers: a one-time session_lease on first call, and recurring
99
+ * session_age_warning fields after WARN_AFTER_MS.
100
+ */
101
+ export declare const SESSION_LEASE: {
102
+ /** ms after which age warnings appear on every session-bound tool result. */
103
+ readonly WARN_AFTER_MS: 600000;
104
+ /** ms after which reticle_sessions marks a session as stale. */
105
+ readonly STALE_AFTER_MS: 1800000;
106
+ };
107
+ /** Why the SDK emitted a PAGE_HEALTH event. */
108
+ export declare const HealthReason: {
109
+ readonly VISIBILITY: "visibilitychange";
110
+ readonly FOCUS: "focus";
111
+ readonly BLUR: "blur";
112
+ readonly HEARTBEAT: "heartbeat";
113
+ readonly INITIAL: "initial";
114
+ };
115
+ export type HealthReason = (typeof HealthReason)[keyof typeof HealthReason];
116
+ //# sourceMappingURL=session-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-constants.d.ts","sourceRoot":"","sources":["../src/session-constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE5E,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAIpE;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC,iGAAiG;AACjG,eAAO,MAAM,gBAAgB;;;;;IAK3B,oGAAoG;;CAE5F,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,+EAA+E;AAC/E,eAAO,MAAM,UAAU;IACrB,4DAA4D;;IAE5D,8EAA8E;;CAEtE,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,cAAc;;IAEzB,kEAAkE;;CAE1D,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;;;OAIG;;IAEH,gFAAgF;;IAEhF,8EAA8E;;IAE9E,qGAAqG;;IAErG;;;;;OAKG;;IAEH,uGAAuG;;CAE/F,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,aAAa;IACxB,6EAA6E;;IAE7E,gEAAgE;;CAExD,CAAC;AAEX,+CAA+C;AAC/C,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}