@velmlabs/unstuck-protocol 0.1.2 → 0.1.3
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/dist/index.d.ts +42 -2
- package/dist/index.js +8 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -161,6 +161,18 @@ type ViewerInput = Extract<ViewerToEngine, {
|
|
|
161
161
|
}>;
|
|
162
162
|
declare const ViewerErrorCodes: readonly ["token_invalid", "token_used", "expired", "session_closed", "bad_message", "code_required", "code_invalid"];
|
|
163
163
|
type ViewerErrorCode = (typeof ViewerErrorCodes)[number];
|
|
164
|
+
/** What kind of field the person can type into, so the viewer can open the matching keyboard (never its value). */
|
|
165
|
+
declare const FieldKinds: readonly ["text", "numeric", "otp", "email", "password"];
|
|
166
|
+
type FieldKind = (typeof FieldKinds)[number];
|
|
167
|
+
/** A typable field's box in CSS pixels of the streamed viewport (the same space as `mouse` messages). */
|
|
168
|
+
declare const FieldSchema: _sinclair_typebox.TObject<{
|
|
169
|
+
x: _sinclair_typebox.TNumber;
|
|
170
|
+
y: _sinclair_typebox.TNumber;
|
|
171
|
+
w: _sinclair_typebox.TNumber;
|
|
172
|
+
h: _sinclair_typebox.TNumber;
|
|
173
|
+
kind: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"text" | "numeric" | "otp" | "email" | "password">[]>;
|
|
174
|
+
}>;
|
|
175
|
+
type Field = Static<typeof FieldSchema>;
|
|
164
176
|
declare const EngineToViewerSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
165
177
|
t: _sinclair_typebox.TLiteral<"ready">;
|
|
166
178
|
reason: _sinclair_typebox.TString;
|
|
@@ -176,6 +188,25 @@ declare const EngineToViewerSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.
|
|
|
176
188
|
message: _sinclair_typebox.TString;
|
|
177
189
|
}>, _sinclair_typebox.TObject<{
|
|
178
190
|
t: _sinclair_typebox.TLiteral<"pong">;
|
|
191
|
+
}>, _sinclair_typebox.TObject<{
|
|
192
|
+
t: _sinclair_typebox.TLiteral<"fields">;
|
|
193
|
+
fields: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
194
|
+
x: _sinclair_typebox.TNumber;
|
|
195
|
+
y: _sinclair_typebox.TNumber;
|
|
196
|
+
w: _sinclair_typebox.TNumber;
|
|
197
|
+
h: _sinclair_typebox.TNumber;
|
|
198
|
+
kind: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"text" | "numeric" | "otp" | "email" | "password">[]>;
|
|
199
|
+
}>>;
|
|
200
|
+
}>, _sinclair_typebox.TObject<{
|
|
201
|
+
t: _sinclair_typebox.TLiteral<"focus">;
|
|
202
|
+
kind: _sinclair_typebox.TUnion<[_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"text" | "numeric" | "otp" | "email" | "password">[]>, _sinclair_typebox.TNull]>;
|
|
203
|
+
field: _sinclair_typebox.TOptional<_sinclair_typebox.TObject<{
|
|
204
|
+
x: _sinclair_typebox.TNumber;
|
|
205
|
+
y: _sinclair_typebox.TNumber;
|
|
206
|
+
w: _sinclair_typebox.TNumber;
|
|
207
|
+
h: _sinclair_typebox.TNumber;
|
|
208
|
+
kind: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"text" | "numeric" | "otp" | "email" | "password">[]>;
|
|
209
|
+
}>>;
|
|
179
210
|
}>]>;
|
|
180
211
|
type EngineToViewer = {
|
|
181
212
|
t: 'ready';
|
|
@@ -192,6 +223,15 @@ type EngineToViewer = {
|
|
|
192
223
|
message: string;
|
|
193
224
|
} | {
|
|
194
225
|
t: 'pong';
|
|
226
|
+
} | {
|
|
227
|
+
t: 'fields';
|
|
228
|
+
fields: Field[];
|
|
229
|
+
}
|
|
230
|
+
/** `field`: where the focused field is (engine 0.1.3+), so the viewer can outline it; never its value. */
|
|
231
|
+
| {
|
|
232
|
+
t: 'focus';
|
|
233
|
+
kind: FieldKind | null;
|
|
234
|
+
field?: Field;
|
|
195
235
|
};
|
|
196
236
|
declare function parseViewerMessage(raw: string): ViewerToEngine | null;
|
|
197
237
|
|
|
@@ -281,5 +321,5 @@ declare function openMsg(key: CryptoKey, sessionId: string, dir: Direction, conn
|
|
|
281
321
|
plain: Uint8Array;
|
|
282
322
|
} | null>;
|
|
283
323
|
|
|
284
|
-
export { EngineToViewerSchema, FRAME_TYPE_JPEG, KEY_SUBPROTOCOL_PREFIX, Methods, PROTOCOL_VERSION, RELAY_CLOSE, RELAY_LIMITS, RELAY_SUBPROTOCOL, RpcCallError, SESSION_ID_RE, SessionStatusSchema, ViewerErrorCodes, ViewerToEngineSchema, b64urlDecode, b64urlEncode, createRpcPeer, decodeEnvelope, decodeFrame, encodeEnvelope, encodeFrame, importE2eKey, isJsonPlaintext, newConnNonce, newE2eKey, open, openMsg, parseAgentToRelay, parseRelayToAgent, parseViewerMessage, seal, sealMsg };
|
|
285
|
-
export type { AgentToRelay, CdpClosedParams, CdpEventParams, CdpSendParams, CdpSubscribeParams, Direction, EngineToViewer, Frame, HelloParams, HelloResult, PagePopupParams, RelayToAgent, RpcError, RpcNotification, RpcPeer, RpcRequest, RpcResponse, SessionStatus, TakeoverLinkParams, TakeoverParams, TakeoverResult, TakeoverStatus, ViewerErrorCode, ViewerInput, ViewerToEngine };
|
|
324
|
+
export { EngineToViewerSchema, FRAME_TYPE_JPEG, FieldKinds, FieldSchema, KEY_SUBPROTOCOL_PREFIX, Methods, PROTOCOL_VERSION, RELAY_CLOSE, RELAY_LIMITS, RELAY_SUBPROTOCOL, RpcCallError, SESSION_ID_RE, SessionStatusSchema, ViewerErrorCodes, ViewerToEngineSchema, b64urlDecode, b64urlEncode, createRpcPeer, decodeEnvelope, decodeFrame, encodeEnvelope, encodeFrame, importE2eKey, isJsonPlaintext, newConnNonce, newE2eKey, open, openMsg, parseAgentToRelay, parseRelayToAgent, parseViewerMessage, seal, sealMsg };
|
|
325
|
+
export type { AgentToRelay, CdpClosedParams, CdpEventParams, CdpSendParams, CdpSubscribeParams, Direction, EngineToViewer, Field, FieldKind, Frame, HelloParams, HelloResult, PagePopupParams, RelayToAgent, RpcError, RpcNotification, RpcPeer, RpcRequest, RpcResponse, SessionStatus, TakeoverLinkParams, TakeoverParams, TakeoverResult, TakeoverStatus, ViewerErrorCode, ViewerInput, ViewerToEngine };
|
package/dist/index.js
CHANGED
|
@@ -159,11 +159,16 @@ var ViewerToEngineSchema = Type.Union([
|
|
|
159
159
|
Type.Object({ t: Lit("ping") }, { additionalProperties: false })
|
|
160
160
|
]);
|
|
161
161
|
var ViewerErrorCodes = ["token_invalid", "token_used", "expired", "session_closed", "bad_message", "code_required", "code_invalid"];
|
|
162
|
+
var FieldKinds = ["text", "numeric", "otp", "email", "password"];
|
|
163
|
+
var FieldKindSchema = Type.Union(FieldKinds.map((k) => Lit(k)));
|
|
164
|
+
var FieldSchema = Type.Object({ x: Num, y: Num, w: Num, h: Num, kind: FieldKindSchema }, { additionalProperties: false });
|
|
162
165
|
var EngineToViewerSchema = Type.Union([
|
|
163
166
|
Type.Object({ t: Lit("ready"), reason: Type.String(), site: Type.String(), expiresAt: Num, resumeKey: Type.String() }),
|
|
164
167
|
Type.Object({ t: Lit("state"), status: SessionStatusSchema }),
|
|
165
168
|
Type.Object({ t: Lit("error"), code: Type.Union(ViewerErrorCodes.map((c) => Lit(c))), message: Type.String() }),
|
|
166
|
-
Type.Object({ t: Lit("pong") })
|
|
169
|
+
Type.Object({ t: Lit("pong") }),
|
|
170
|
+
Type.Object({ t: Lit("fields"), fields: Type.Array(FieldSchema, { maxItems: 30 }) }),
|
|
171
|
+
Type.Object({ t: Lit("focus"), kind: Type.Union([FieldKindSchema, Type.Null()]), field: Type.Optional(FieldSchema) })
|
|
167
172
|
]);
|
|
168
173
|
function parseViewerMessage(raw) {
|
|
169
174
|
let v;
|
|
@@ -315,6 +320,8 @@ async function openMsg(key, sessionId, dir, conn, sealed) {
|
|
|
315
320
|
export {
|
|
316
321
|
EngineToViewerSchema,
|
|
317
322
|
FRAME_TYPE_JPEG,
|
|
323
|
+
FieldKinds,
|
|
324
|
+
FieldSchema,
|
|
318
325
|
KEY_SUBPROTOCOL_PREFIX,
|
|
319
326
|
Methods,
|
|
320
327
|
PROTOCOL_VERSION,
|