@octane-xplat/devtools 0.0.0-nightly.g1b95ef7
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 +5 -0
- package/dist/app.d.ts +28 -0
- package/dist/app.js +66 -0
- package/dist/backend.d.ts +31 -0
- package/dist/backend.js +182 -0
- package/dist/client.d.ts +49 -0
- package/dist/client.js +168 -0
- package/dist/host/desktop.d.ts +15 -0
- package/dist/host/desktop.js +133 -0
- package/dist/host/panels.d.ts +14 -0
- package/dist/host/panels.js +156 -0
- package/dist/host/records.d.ts +5 -0
- package/dist/host/records.js +46 -0
- package/dist/host/server.d.ts +8 -0
- package/dist/host/server.js +67 -0
- package/dist/host/web.d.ts +5 -0
- package/dist/host/web.js +74 -0
- package/dist/macos/index.macos.d.ts +3 -0
- package/dist/macos/index.macos.js +5 -0
- package/dist/macos/servers.macos.d.ts +4 -0
- package/dist/macos/servers.macos.js +57 -0
- package/dist/macos/socket.macos.d.ts +2 -0
- package/dist/macos/socket.macos.js +152 -0
- package/dist/macos/ws-frames.d.ts +24 -0
- package/dist/macos/ws-frames.js +205 -0
- package/dist/node.d.ts +12 -0
- package/dist/node.js +51 -0
- package/dist/record.d.ts +9 -0
- package/dist/record.js +38 -0
- package/dist/types.d.ts +128 -0
- package/dist/types.js +25 -0
- package/package.json +88 -0
- package/src/app.ts +105 -0
- package/src/assets.d.ts +2 -0
- package/src/backend.ts +278 -0
- package/src/client.ts +248 -0
- package/src/desktop/Shell.macos.tsrx +158 -0
- package/src/desktop/Shell.ts +16 -0
- package/src/desktop/index.macos.ts +7 -0
- package/src/desktop/main.macos.ts +130 -0
- package/src/desktop/panels.d.ts +10 -0
- package/src/desktop/target.ts +34 -0
- package/src/host/desktop.ts +176 -0
- package/src/host/panels.ts +193 -0
- package/src/host/records.ts +62 -0
- package/src/host/server.ts +92 -0
- package/src/host/web.ts +68 -0
- package/src/macos/index.macos.ts +7 -0
- package/src/macos/servers.macos.ts +83 -0
- package/src/macos/socket.macos.ts +218 -0
- package/src/macos/ws-frames.ts +249 -0
- package/src/node.ts +60 -0
- package/src/panel/App.tsrx +288 -0
- package/src/panel/index.html +12 -0
- package/src/panel/index.ts +24 -0
- package/src/panel/main.tsrx +2 -0
- package/src/panel/main.web.tsrx +89 -0
- package/src/panel/model.ts +216 -0
- package/src/panel/panel.css +189 -0
- package/src/panel/plugin.ts +65 -0
- package/src/panel/styles.ts +5 -0
- package/src/panel/tsconfig.browser.json +9 -0
- package/src/record.ts +66 -0
- package/src/types.ts +129 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Shared wire types for the xplat dev hub's devtools channels. The Go hub
|
|
2
|
+
// routes opaque per-channel JSON between app sessions (/app), per-target Node
|
|
3
|
+
// backends (/backend) and devtools panels (/devtools); these are the frame
|
|
4
|
+
// shapes the three peers exchange.
|
|
5
|
+
|
|
6
|
+
/** A declared dev action as the app's registry announces it. */
|
|
7
|
+
export interface DevActionRef {
|
|
8
|
+
id: string
|
|
9
|
+
title?: string
|
|
10
|
+
description?: string
|
|
11
|
+
input?: { fields?: Record<string, unknown> } & Record<string, unknown>
|
|
12
|
+
result?: Record<string, unknown>
|
|
13
|
+
effects?: Record<string, unknown>
|
|
14
|
+
availability?: {
|
|
15
|
+
platforms?: string[]
|
|
16
|
+
readyWhen?: string
|
|
17
|
+
route?: { url?: string; fromInput?: boolean }
|
|
18
|
+
ready?: boolean
|
|
19
|
+
reason?: string
|
|
20
|
+
}
|
|
21
|
+
execution?: { timeoutMs?: number; cancellable?: boolean } & Record<string, unknown>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A connected app session as the hub reports it in `ready`/`sessions`. */
|
|
25
|
+
export interface SessionSnapshot {
|
|
26
|
+
sessionId: string
|
|
27
|
+
targetId: string
|
|
28
|
+
appInstanceId: string
|
|
29
|
+
platform: string
|
|
30
|
+
appLabel?: string
|
|
31
|
+
registryRevision: number
|
|
32
|
+
state: 'ready' | 'disconnected' | string
|
|
33
|
+
ownership: string
|
|
34
|
+
origin: string
|
|
35
|
+
readiness: string
|
|
36
|
+
connectedAt: string
|
|
37
|
+
disconnectedAt: string
|
|
38
|
+
inspection?: unknown
|
|
39
|
+
actions?: DevActionRef[]
|
|
40
|
+
channels: { id: string; version: number }[]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A routing failure reported to a frame's sender (never a close). */
|
|
44
|
+
export interface ChannelError {
|
|
45
|
+
type: 'channel-error'
|
|
46
|
+
code: 'oversize' | 'undeclared_channel' | 'no_backend' | 'no_session' | 'invalid_target'
|
|
47
|
+
channel?: string
|
|
48
|
+
detail: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A connected backend as the hub reports it in `ready`/`backends`. */
|
|
52
|
+
export interface BackendRef {
|
|
53
|
+
channel: string
|
|
54
|
+
targetId: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ReadyFrame {
|
|
58
|
+
type: 'ready'
|
|
59
|
+
panel?: string
|
|
60
|
+
sessions?: SessionSnapshot[]
|
|
61
|
+
backends?: BackendRef[]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface SessionsFrame {
|
|
65
|
+
type: 'sessions'
|
|
66
|
+
sessions?: SessionSnapshot[]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface BackendsFrame {
|
|
70
|
+
type: 'backends'
|
|
71
|
+
backends?: BackendRef[]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Frames the hub sends to a `/backend` connection. */
|
|
75
|
+
export type BackendInboundFrame =
|
|
76
|
+
| ReadyFrame
|
|
77
|
+
| SessionsFrame
|
|
78
|
+
| { type: 'channel'; channel?: string; from: 'app'; session: string; data: unknown }
|
|
79
|
+
| { type: 'channel'; channel?: string; from: 'panel'; panel: string; data: unknown }
|
|
80
|
+
| ChannelError
|
|
81
|
+
|
|
82
|
+
/** Frames the hub sends to a `/devtools` panel connection. */
|
|
83
|
+
export type PanelInboundFrame =
|
|
84
|
+
| ReadyFrame
|
|
85
|
+
| SessionsFrame
|
|
86
|
+
| BackendsFrame
|
|
87
|
+
| { type: 'channel'; channel: string; from: 'app'; session: string; data: unknown }
|
|
88
|
+
| { type: 'channel'; channel: string; from: 'backend'; targetId: string; data: unknown }
|
|
89
|
+
| ChannelError
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Parse one hub frame at the JSON boundary. The `as` here is the single
|
|
93
|
+
* documented assertion point: frame field validation happens at each call
|
|
94
|
+
* site on the narrowed `type` union, so untrusted input never needs a cast
|
|
95
|
+
* anywhere else.
|
|
96
|
+
*/
|
|
97
|
+
export function parseHubFrame(text: string): BackendInboundFrame | PanelInboundFrame | undefined {
|
|
98
|
+
try {
|
|
99
|
+
const frame = JSON.parse(text) as { type?: unknown }
|
|
100
|
+
|
|
101
|
+
return typeof frame?.type === 'string'
|
|
102
|
+
? (frame as BackendInboundFrame | PanelInboundFrame)
|
|
103
|
+
: undefined
|
|
104
|
+
} catch {
|
|
105
|
+
return undefined
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Structural WebSocket contract shared by Node, browser and JSC hosts. */
|
|
110
|
+
export interface DevSocket {
|
|
111
|
+
readyState: number
|
|
112
|
+
onopen: (() => void) | null
|
|
113
|
+
onmessage: ((event: { data: unknown }) => void) | null
|
|
114
|
+
onerror: (() => void) | null
|
|
115
|
+
onclose: ((event: { code: number; reason: string }) => void) | null
|
|
116
|
+
send(data: string): void
|
|
117
|
+
close(): void
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Named host environment for the global WebSocket constructor. */
|
|
121
|
+
export interface DevGlobalWebSocket {
|
|
122
|
+
WebSocket?: new (url: string) => DevSocket
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function devSocket(url: string): DevSocket | undefined {
|
|
126
|
+
const Constructor = (globalThis as DevGlobalWebSocket).WebSocket
|
|
127
|
+
|
|
128
|
+
return Constructor ? new Constructor(url) : undefined
|
|
129
|
+
}
|