@reticlehq/core 1.3.1 → 2.0.1
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 +14 -88
- package/dist/brand.d.ts +21 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +16 -0
- package/dist/brand.js.map +1 -0
- package/dist/constants.d.ts +378 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +352 -0
- package/dist/constants.js.map +1 -0
- package/dist/daemon-registry.d.ts +36 -0
- package/dist/daemon-registry.d.ts.map +1 -0
- package/dist/daemon-registry.js +48 -0
- package/dist/daemon-registry.js.map +1 -0
- package/dist/flow-constants.d.ts +175 -0
- package/dist/flow-constants.d.ts.map +1 -0
- package/dist/flow-constants.js +162 -0
- package/dist/flow-constants.js.map +1 -0
- package/dist/flow-types.d.ts +1204 -0
- package/dist/flow-types.d.ts.map +1 -0
- package/dist/flow-types.js +152 -0
- package/dist/flow-types.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -5563
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +424 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +103 -0
- package/dist/messages.js.map +1 -0
- package/dist/notices.d.ts +60 -0
- package/dist/notices.d.ts.map +1 -0
- package/dist/notices.js +64 -0
- package/dist/notices.js.map +1 -0
- package/dist/schema/command-message.json +41 -0
- package/dist/schema/command-result.json +34 -0
- package/dist/schema/event-message.json +77 -0
- package/dist/schema/event-type.json +35 -0
- package/dist/schema/hello-message.json +59 -0
- package/dist/schema/reticle-event.json +63 -0
- package/dist/schema/reticle-message.json +193 -0
- package/dist/security.d.ts +5 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +22 -0
- package/dist/security.js.map +1 -0
- package/dist/session-constants.d.ts +116 -0
- package/dist/session-constants.d.ts.map +1 -0
- package/dist/session-constants.js +113 -0
- package/dist/session-constants.js.map +1 -0
- package/dist/state-select.d.ts +23 -0
- package/dist/state-select.d.ts.map +1 -0
- package/dist/state-select.js +60 -0
- package/dist/state-select.js.map +1 -0
- package/dist/toon.d.ts +44 -0
- package/dist/toon.d.ts.map +1 -0
- package/dist/toon.js +153 -0
- package/dist/toon.js.map +1 -0
- package/dist/types.d.ts +833 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +165 -0
- package/dist/types.js.map +1 -0
- package/dist/upgrade.d.ts +74 -0
- package/dist/upgrade.d.ts.map +1 -0
- package/dist/upgrade.js +87 -0
- package/dist/upgrade.js.map +1 -0
- package/dist/verification-run.d.ts +1195 -0
- package/dist/verification-run.d.ts.map +1 -0
- package/dist/verification-run.js +261 -0
- package/dist/verification-run.js.map +1 -0
- package/package.json +32 -79
- package/dist/babel.d.ts +0 -7
- package/dist/babel.js +0 -32
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -11273
- package/dist/eslint.d.ts +0 -1
- package/dist/eslint.js +0 -134
- package/dist/loader.cjs +0 -52
- package/dist/next.d.ts +0 -21
- package/dist/next.js +0 -24
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -9495
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -9377
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +0 -196
package/dist/notices.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-facing HUD/notice copy that crosses the wire to the panel or surfaces on tool results.
|
|
3
|
+
* Kept apart from the wire enums in constants.ts so the prose can grow without bloating that file.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Tone of a PRESENTER push, rides the command as optional `tone`. Lets the panel tell apart the ways
|
|
7
|
+
* a session can stop, so the human on the browser always knows the agent's mode:
|
|
8
|
+
* calm — a normal, human/agent-driven end ("done").
|
|
9
|
+
* waiting — the agent finished its turn / went idle; it will resume on your next message.
|
|
10
|
+
* ask — the agent is blocked and needs your input to continue (carries the question as text).
|
|
11
|
+
* warn — the agent stopped unexpectedly (crashed / disconnected) — switch to your terminal.
|
|
12
|
+
*/
|
|
13
|
+
export const PresenterTone = {
|
|
14
|
+
CALM: 'calm',
|
|
15
|
+
WAITING: 'waiting',
|
|
16
|
+
ASK: 'ask',
|
|
17
|
+
WARN: 'warn',
|
|
18
|
+
};
|
|
19
|
+
/** Narrow an unknown wire value to a PresenterTone (defaults handled by the caller). */
|
|
20
|
+
export function isPresenterTone(value) {
|
|
21
|
+
return (value === PresenterTone.CALM ||
|
|
22
|
+
value === PresenterTone.WAITING ||
|
|
23
|
+
value === PresenterTone.ASK ||
|
|
24
|
+
value === PresenterTone.WARN);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Surfaced on observe/network/console results once the event ring buffer has evicted anything (age
|
|
28
|
+
* or size cap). Converts a silent false negative into an honest one: a "no such event" answer after
|
|
29
|
+
* eviction may be "I dropped the evidence", not "it never happened" — widen the buffer / grade
|
|
30
|
+
* sooner. Rides in a `buffer` block only when `dropped > 0` (silence ⇒ nothing lost).
|
|
31
|
+
*/
|
|
32
|
+
export const BUFFER_EVICTION_WARNING = 'event buffer evicted older events (age/size cap) — a negative result here may be a false negative; the evidence may have expired. Grade sooner or widen the buffer.';
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when a tool needs a live browser session and none is connected. Names the #1 real cause in a
|
|
35
|
+
* multi-repo / multi-agent setup — a PORT MISMATCH between the app's SDK and the daemon — so the agent
|
|
36
|
+
* checks the wiring instead of only the "is the SDK enabled?" dead end.
|
|
37
|
+
*/
|
|
38
|
+
export const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port — a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. reticle_wait_ready blocks briefly for a session to appear.";
|
|
39
|
+
/** Surfaced on act/assert results when the target tab is throttled. */
|
|
40
|
+
export const THROTTLED_WARNING = 'tab throttled; timer/rAF/pointer gestures may silently no-op — refocus before driving';
|
|
41
|
+
/**
|
|
42
|
+
* Pushed to the panel when the last agent's MCP connection drops — the agent (any of
|
|
43
|
+
* Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
|
|
44
|
+
* on the browser, that control is back on the terminal so a typed prompt isn't silently lost.
|
|
45
|
+
*/
|
|
46
|
+
export const AGENT_STOPPED_NOTICE = 'Agent stopped — switch to your terminal to continue.';
|
|
47
|
+
/**
|
|
48
|
+
* Prefixes any human notes typed into the panel but not yet read when the session ends — folded into
|
|
49
|
+
* the end banner so a prompt sent in the death-race (agent stops mid-keystroke) is surfaced back to
|
|
50
|
+
* the human, copyable, instead of vanishing into a dead inbox.
|
|
51
|
+
*/
|
|
52
|
+
export const UNDELIVERED_NOTES_LABEL = 'Undelivered (paste into your terminal):';
|
|
53
|
+
/** Panel notice when the agent yields after finishing its turn (reticle_yield mode:'waiting'). */
|
|
54
|
+
export const AGENT_WAITING_NOTICE = 'Agent finished its turn — your move. Continue in your terminal.';
|
|
55
|
+
/** Panel notice prefix when the agent is blocked on you (reticle_yield mode:'ask'); the question follows. */
|
|
56
|
+
export const AGENT_ASK_NOTICE = 'Agent needs your input — answer in your terminal';
|
|
57
|
+
/**
|
|
58
|
+
* Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
|
|
59
|
+
* reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
|
|
60
|
+
* the in-page SDK + CDP path. Points at the `reticle drive` escape hatch (a guaranteed scriptable
|
|
61
|
+
* context). Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
|
|
62
|
+
*/
|
|
63
|
+
export const UNSCRIPTABLE_TAB_RECOMMENDATION = 'tab hidden/throttled and may be un-focusable from here; refocus it, or run `reticle drive <url>` for a guaranteed scriptable context';
|
|
64
|
+
//# sourceMappingURL=notices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notices.js","sourceRoot":"","sources":["../src/notices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC;AAGX,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,KAAK,KAAK,aAAa,CAAC,IAAI;QAC5B,KAAK,KAAK,aAAa,CAAC,OAAO;QAC/B,KAAK,KAAK,aAAa,CAAC,GAAG;QAC3B,KAAK,KAAK,aAAa,CAAC,IAAI,CAC7B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAClC,qKAAqK,CAAC;AAExK;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,yUAAyU,CAAC;AAE5U,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAC5B,uFAAuF,CAAC;AAE1F;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,sDAAsD,CAAC;AAE3F;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF,kGAAkG;AAClG,MAAM,CAAC,MAAM,oBAAoB,GAC/B,iEAAiE,CAAC;AAEpE,6GAA6G;AAC7G,MAAM,CAAC,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,sIAAsI,CAAC"}
|
|
@@ -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"}
|
package/dist/security.js
ADDED
|
@@ -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"}
|