@fungi.computer/knapsack 0.0.2 → 0.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/README.md +37 -4
- package/dist/files-patch.d.ts +20 -6
- package/dist/files-patch.js +11 -4
- package/dist/files-read.d.ts +115 -10
- package/dist/files-read.js +82 -12
- package/dist/files-search.d.ts +14 -0
- package/dist/files-search.js +52 -0
- package/dist/files.d.ts +59 -65
- package/dist/files.js +183 -97
- package/dist/index.d.ts +5 -1
- package/dist/index.js +10 -7
- package/dist/ui/browser.d.ts +44 -0
- package/dist/ui/browser.js +171 -0
- package/dist/ui/effect.d.ts +106 -0
- package/dist/ui/effect.js +208 -0
- package/dist/ui/host.d.ts +9 -0
- package/dist/ui/host.js +158 -0
- package/dist/ui/sessions.d.ts +32 -0
- package/dist/ui/sessions.js +172 -0
- package/dist/ui/wire.d.ts +290 -0
- package/dist/ui/wire.js +136 -0
- package/dist/ui-browser.d.ts +6 -0
- package/dist/ui-browser.js +6 -0
- package/dist/ui.d.ts +29 -0
- package/dist/ui.js +35 -0
- package/docs/api/README.md +1 -0
- package/docs/api/files-patch.md +39 -43
- package/docs/api/files-read.md +263 -27
- package/docs/api/index.md +207 -107
- package/docs/api/ui-browser.md +94 -0
- package/package.json +16 -5
package/dist/ui/host.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Mycelium } from "@fungi.computer/mycelium";
|
|
2
|
+
import * as Cause from "effect/Cause";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Exit from "effect/Exit";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Stream from "effect/Stream";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { UiHostError, make as makeEffect, } from "./effect.js";
|
|
9
|
+
import { BrowserCommandRowSchema, BrowserExecutionOutcomeSchema, BrowserExecuteInputSchema, BrowserWireObjectSchema, } from "./wire.js";
|
|
10
|
+
const browserUnavailableSchema = z.object({
|
|
11
|
+
status: z.literal("unavailable"),
|
|
12
|
+
reason: z.enum([
|
|
13
|
+
"browser_busy",
|
|
14
|
+
"browser_not_connected",
|
|
15
|
+
"browser_disconnected",
|
|
16
|
+
]),
|
|
17
|
+
});
|
|
18
|
+
const browserExecutionIndeterminateSchema = z.object({
|
|
19
|
+
status: z.literal("indeterminate"),
|
|
20
|
+
reason: z.literal("browser_disconnected_after_dispatch"),
|
|
21
|
+
});
|
|
22
|
+
const browserCommandDiscoverySchema = z.discriminatedUnion("status", [
|
|
23
|
+
z.object({
|
|
24
|
+
status: z.literal("available"),
|
|
25
|
+
commands: z.array(BrowserCommandRowSchema),
|
|
26
|
+
}),
|
|
27
|
+
browserUnavailableSchema,
|
|
28
|
+
]);
|
|
29
|
+
const browserCommandExecutionSchema = z.union([
|
|
30
|
+
BrowserExecutionOutcomeSchema,
|
|
31
|
+
browserUnavailableSchema,
|
|
32
|
+
browserExecutionIndeterminateSchema,
|
|
33
|
+
]);
|
|
34
|
+
async function runPromiseAtBoundary(effect, signal) {
|
|
35
|
+
signal?.throwIfAborted();
|
|
36
|
+
const exit = await Effect.runPromiseExit(effect, signal === undefined ? undefined : { signal });
|
|
37
|
+
if (Exit.isSuccess(exit))
|
|
38
|
+
return exit.value;
|
|
39
|
+
const failure = Cause.findErrorOption(exit.cause);
|
|
40
|
+
if (Option.isSome(failure))
|
|
41
|
+
throw failure.value;
|
|
42
|
+
if (Cause.hasInterruptsOnly(exit.cause)) {
|
|
43
|
+
signal?.throwIfAborted();
|
|
44
|
+
throw new DOMException("The operation was aborted", "AbortError");
|
|
45
|
+
}
|
|
46
|
+
const squashed = Cause.squash(exit.cause);
|
|
47
|
+
if (squashed instanceof Error)
|
|
48
|
+
throw squashed;
|
|
49
|
+
throw new Error("Live App command host failed without an Error cause");
|
|
50
|
+
}
|
|
51
|
+
function unavailable(reason) {
|
|
52
|
+
return { status: "unavailable", reason };
|
|
53
|
+
}
|
|
54
|
+
function recoverUnavailable(error) {
|
|
55
|
+
switch (error.code) {
|
|
56
|
+
case "browser_busy":
|
|
57
|
+
case "browser_not_connected":
|
|
58
|
+
case "browser_disconnected":
|
|
59
|
+
return Effect.succeed(unavailable(error.code));
|
|
60
|
+
default:
|
|
61
|
+
return Effect.fail(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function discoveryRequest(runtime, request) {
|
|
65
|
+
return runtime.request(request).pipe(Effect.catch(recoverUnavailable));
|
|
66
|
+
}
|
|
67
|
+
function executionRequest(runtime, request) {
|
|
68
|
+
return runtime.request(request).pipe(Effect.catch((error) => {
|
|
69
|
+
if (error.code === "browser_execution_indeterminate")
|
|
70
|
+
return Effect.succeed({
|
|
71
|
+
status: "indeterminate",
|
|
72
|
+
reason: "browser_disconnected_after_dispatch",
|
|
73
|
+
});
|
|
74
|
+
return recoverUnavailable(error);
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
function discoveryResult(result) {
|
|
78
|
+
if ("status" in result)
|
|
79
|
+
return result;
|
|
80
|
+
if (result.type !== "discover")
|
|
81
|
+
throw new UiHostError("invalid_browser_wire", "Browser returned an execution result for discovery");
|
|
82
|
+
return { status: "available", commands: [...result.commands] };
|
|
83
|
+
}
|
|
84
|
+
function executionResult(result) {
|
|
85
|
+
if ("status" in result)
|
|
86
|
+
return result;
|
|
87
|
+
if (result.type !== "execute")
|
|
88
|
+
throw new UiHostError("invalid_browser_wire", "Browser returned a discovery result for execution");
|
|
89
|
+
return result.outcome;
|
|
90
|
+
}
|
|
91
|
+
function eventResponse(runtime) {
|
|
92
|
+
const body = Stream.unwrap(runtime.connect().pipe(Effect.map((connection) => Stream.make(": connected\n\n").pipe(Stream.concat(Stream.fromEffectRepeat(connection.take).pipe(Stream.map((envelope) => `event: browser-request\ndata: ${JSON.stringify({
|
|
93
|
+
...envelope,
|
|
94
|
+
connectionId: connection.id,
|
|
95
|
+
})}\n\n`))))))).pipe(Stream.encodeText, (stream) => Stream.toReadableStream(stream, {
|
|
96
|
+
strategy: { highWaterMark: 1 },
|
|
97
|
+
}));
|
|
98
|
+
return new Response(body, {
|
|
99
|
+
headers: {
|
|
100
|
+
"Cache-Control": "no-cache",
|
|
101
|
+
"Content-Encoding": "Identity",
|
|
102
|
+
"Content-Type": "text/event-stream",
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function errorResponse(cause) {
|
|
107
|
+
if (!(cause instanceof UiHostError))
|
|
108
|
+
return Response.json({ error: "Live App commands are unavailable" }, { status: 503 });
|
|
109
|
+
const status = cause.code === "invalid_browser_wire" ? 400 : 503;
|
|
110
|
+
return Response.json({ error: cause.message }, { status });
|
|
111
|
+
}
|
|
112
|
+
async function browserIngressResponse(request, invalidMessage, ingress) {
|
|
113
|
+
const parsed = Effect.tryPromise({
|
|
114
|
+
try: () => request.json(),
|
|
115
|
+
catch: () => new UiHostError("invalid_browser_wire", invalidMessage),
|
|
116
|
+
}).pipe(Effect.flatMap((input) => Effect.try(() => BrowserWireObjectSchema.parse(input))), Effect.flatMap(ingress));
|
|
117
|
+
try {
|
|
118
|
+
return Response.json(await runPromiseAtBoundary(parsed, request.signal));
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return errorResponse(error);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** Build one Session browser host: its Mycelium `ui` module and HTTP transport. */
|
|
125
|
+
export function createUiHost(runtime = Effect.runSync(makeEffect())) {
|
|
126
|
+
const module = Mycelium.module({
|
|
127
|
+
id: "knapsack-ui",
|
|
128
|
+
name: "ui",
|
|
129
|
+
description: "Live semantic commands from the connected browser",
|
|
130
|
+
operations: {
|
|
131
|
+
discover: Mycelium.operation({
|
|
132
|
+
replay: "safe",
|
|
133
|
+
description: "Discover commands in the connected browser",
|
|
134
|
+
input: z.object({}),
|
|
135
|
+
output: browserCommandDiscoverySchema,
|
|
136
|
+
execute: (_input, context) => runPromiseAtBoundary(discoveryRequest(runtime, { type: "discover" }).pipe(Effect.map(discoveryResult)), context.signal),
|
|
137
|
+
}),
|
|
138
|
+
execute: Mycelium.operation({
|
|
139
|
+
replay: "unsafe",
|
|
140
|
+
description: "Execute one discovered command in the connected browser",
|
|
141
|
+
input: BrowserExecuteInputSchema,
|
|
142
|
+
output: browserCommandExecutionSchema,
|
|
143
|
+
execute: (input, context) => runPromiseAtBoundary(executionRequest(runtime, { type: "execute", ...input }).pipe(Effect.map(executionResult)), context.signal),
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
const fetch = async (request) => {
|
|
148
|
+
const url = new URL(request.url);
|
|
149
|
+
if (request.method === "GET" && url.pathname === "/browser/events")
|
|
150
|
+
return eventResponse(runtime);
|
|
151
|
+
if (request.method === "POST" && url.pathname === "/browser/claims")
|
|
152
|
+
return browserIngressResponse(request, "Browser claim is invalid", runtime.claim);
|
|
153
|
+
if (request.method === "POST" && url.pathname === "/browser/results")
|
|
154
|
+
return browserIngressResponse(request, "Browser result is invalid", runtime.acceptResult);
|
|
155
|
+
return Response.json({ error: "Not found" }, { status: 404 });
|
|
156
|
+
};
|
|
157
|
+
return Object.freeze({ modules: [module], fetch });
|
|
158
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ModuleRegistration } from "@fungi.computer/mycelium";
|
|
2
|
+
/** The maintained browser transport and its Session-bound tool descriptors. */
|
|
3
|
+
export type BrowserHost = Readonly<{
|
|
4
|
+
/** Mycelium tools bound to this host's Session and call-time gates. */
|
|
5
|
+
modules: readonly ModuleRegistration[];
|
|
6
|
+
/** Forward one browser events, claims or results request to the maintained host. */
|
|
7
|
+
fetch: (request: Request) => Promise<Response>;
|
|
8
|
+
}>;
|
|
9
|
+
/** One run's borrow of its Session's browser tools; release ends the borrow. */
|
|
10
|
+
export type BrowserLease = Readonly<{
|
|
11
|
+
modules: BrowserHost["modules"];
|
|
12
|
+
release: () => void;
|
|
13
|
+
}>;
|
|
14
|
+
/** One ephemeral browser host per Session, borrowed by run and SSE scopes. */
|
|
15
|
+
export declare class BrowserSessions {
|
|
16
|
+
private readonly open;
|
|
17
|
+
private readonly hasSession;
|
|
18
|
+
private generation;
|
|
19
|
+
private closed;
|
|
20
|
+
private readonly hosts;
|
|
21
|
+
constructor(open: (sessionId: string) => BrowserHost, hasSession: (sessionId: string) => Promise<boolean>);
|
|
22
|
+
/** End every browser stream and refuse later requests and run leases. */
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
fetch(request: Request): Promise<Response>;
|
|
25
|
+
/** Own the async transport opening until its stream joins the connection scope. */
|
|
26
|
+
private openEvents;
|
|
27
|
+
private createHost;
|
|
28
|
+
acquire(sessionId: string): BrowserLease;
|
|
29
|
+
private releaseBrowserConnection;
|
|
30
|
+
private releaseIdleHost;
|
|
31
|
+
private trackBrowserConnection;
|
|
32
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/** One ephemeral browser host per Session, borrowed by run and SSE scopes. */
|
|
2
|
+
export class BrowserSessions {
|
|
3
|
+
open;
|
|
4
|
+
hasSession;
|
|
5
|
+
generation = 0;
|
|
6
|
+
closed = false;
|
|
7
|
+
hosts = new Map();
|
|
8
|
+
constructor(open, hasSession) {
|
|
9
|
+
this.open = open;
|
|
10
|
+
this.hasSession = hasSession;
|
|
11
|
+
}
|
|
12
|
+
/** End every browser stream and refuse later requests and run leases. */
|
|
13
|
+
async close() {
|
|
14
|
+
this.closed = true;
|
|
15
|
+
// A pending opening or Session lookup from before close never escapes.
|
|
16
|
+
this.generation += 1;
|
|
17
|
+
const old = [...this.hosts.values()];
|
|
18
|
+
this.hosts.clear();
|
|
19
|
+
await Promise.all(old.flatMap((entry) => [...entry.connections].map((close) => close())));
|
|
20
|
+
}
|
|
21
|
+
async fetch(request) {
|
|
22
|
+
if (this.closed)
|
|
23
|
+
return new Response(null, { status: 410 });
|
|
24
|
+
const generation = this.generation;
|
|
25
|
+
const path = new URL(request.url).pathname;
|
|
26
|
+
const browserRoute = /^\/browser\/sessions\/([^/]+)\/browser\/(events|claims|results)$/u.exec(path);
|
|
27
|
+
if (browserRoute === null)
|
|
28
|
+
return new Response("Not found", { status: 404 });
|
|
29
|
+
let sessionId;
|
|
30
|
+
try {
|
|
31
|
+
sessionId = decodeURIComponent(browserRoute[1] ?? "");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return new Response("Not found", { status: 404 });
|
|
35
|
+
}
|
|
36
|
+
const route = browserRoute[2];
|
|
37
|
+
if (!sessionId || !route)
|
|
38
|
+
return new Response("Not found", { status: 404 });
|
|
39
|
+
let entry = this.hosts.get(sessionId);
|
|
40
|
+
if (entry === undefined) {
|
|
41
|
+
if (route !== "events")
|
|
42
|
+
return new Response("Not found", { status: 404 });
|
|
43
|
+
if (!(await this.hasSession(sessionId)))
|
|
44
|
+
return new Response("Not found", { status: 404 });
|
|
45
|
+
if (generation !== this.generation)
|
|
46
|
+
return new Response(null, { status: 404 });
|
|
47
|
+
entry = this.hosts.get(sessionId) ?? this.createHost(sessionId);
|
|
48
|
+
}
|
|
49
|
+
const target = new URL(request.url);
|
|
50
|
+
target.pathname = `/browser/${route}`;
|
|
51
|
+
if (route !== "events")
|
|
52
|
+
return entry.host.fetch(new Request(target, request));
|
|
53
|
+
return this.openEvents(new Request(target, request), sessionId, entry, generation);
|
|
54
|
+
}
|
|
55
|
+
/** Own the async transport opening until its stream joins the connection scope. */
|
|
56
|
+
async openEvents(request, sessionId, entry, generation) {
|
|
57
|
+
entry.browserConnections += 1;
|
|
58
|
+
try {
|
|
59
|
+
const response = await entry.host.fetch(request);
|
|
60
|
+
if (generation !== this.generation) {
|
|
61
|
+
// The maintained transport may finish opening after teardown. Its
|
|
62
|
+
// late scope belongs to the old generation and must never escape.
|
|
63
|
+
await response.body?.cancel();
|
|
64
|
+
this.releaseBrowserConnection(sessionId, entry);
|
|
65
|
+
return new Response(null, { status: 404 });
|
|
66
|
+
}
|
|
67
|
+
if (!response.ok || response.body === null) {
|
|
68
|
+
this.releaseBrowserConnection(sessionId, entry);
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
return this.trackBrowserConnection(response, sessionId, entry);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
this.releaseBrowserConnection(sessionId, entry);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
createHost(sessionId) {
|
|
79
|
+
const entry = {
|
|
80
|
+
host: this.open(sessionId),
|
|
81
|
+
activeRuns: 0,
|
|
82
|
+
browserConnections: 0,
|
|
83
|
+
connections: new Set(),
|
|
84
|
+
};
|
|
85
|
+
this.hosts.set(sessionId, entry);
|
|
86
|
+
return entry;
|
|
87
|
+
}
|
|
88
|
+
acquire(sessionId) {
|
|
89
|
+
if (this.closed)
|
|
90
|
+
throw new Error("Browser host is closed");
|
|
91
|
+
const entry = this.hosts.get(sessionId) ?? this.createHost(sessionId);
|
|
92
|
+
entry.activeRuns += 1;
|
|
93
|
+
let released = false;
|
|
94
|
+
return {
|
|
95
|
+
modules: entry.host.modules,
|
|
96
|
+
release: () => {
|
|
97
|
+
if (released)
|
|
98
|
+
return;
|
|
99
|
+
released = true;
|
|
100
|
+
entry.activeRuns -= 1;
|
|
101
|
+
this.releaseIdleHost(sessionId, entry);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
releaseBrowserConnection(sessionId, entry) {
|
|
106
|
+
entry.browserConnections -= 1;
|
|
107
|
+
this.releaseIdleHost(sessionId, entry);
|
|
108
|
+
}
|
|
109
|
+
releaseIdleHost(sessionId, entry) {
|
|
110
|
+
if (entry.activeRuns === 0 &&
|
|
111
|
+
entry.browserConnections === 0 &&
|
|
112
|
+
this.hosts.get(sessionId) === entry)
|
|
113
|
+
this.hosts.delete(sessionId);
|
|
114
|
+
}
|
|
115
|
+
trackBrowserConnection(response, sessionId, entry) {
|
|
116
|
+
const reader = response.body?.getReader();
|
|
117
|
+
if (reader === undefined) {
|
|
118
|
+
this.releaseBrowserConnection(sessionId, entry);
|
|
119
|
+
return response;
|
|
120
|
+
}
|
|
121
|
+
let released = false;
|
|
122
|
+
let controller;
|
|
123
|
+
const close = async () => {
|
|
124
|
+
if (released)
|
|
125
|
+
return;
|
|
126
|
+
release();
|
|
127
|
+
controller.close();
|
|
128
|
+
await reader.cancel();
|
|
129
|
+
};
|
|
130
|
+
const release = () => {
|
|
131
|
+
if (released)
|
|
132
|
+
return;
|
|
133
|
+
released = true;
|
|
134
|
+
entry.connections.delete(close);
|
|
135
|
+
this.releaseBrowserConnection(sessionId, entry);
|
|
136
|
+
};
|
|
137
|
+
entry.connections.add(close);
|
|
138
|
+
const body = new ReadableStream({
|
|
139
|
+
start: (streamController) => {
|
|
140
|
+
controller = streamController;
|
|
141
|
+
},
|
|
142
|
+
pull: async (controller) => {
|
|
143
|
+
try {
|
|
144
|
+
const next = await reader.read();
|
|
145
|
+
if (released)
|
|
146
|
+
return;
|
|
147
|
+
if (next.done) {
|
|
148
|
+
controller.close();
|
|
149
|
+
release();
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
controller.enqueue(next.value);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
if (released)
|
|
156
|
+
return;
|
|
157
|
+
controller.error(error);
|
|
158
|
+
release();
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
cancel: async (reason) => {
|
|
162
|
+
release();
|
|
163
|
+
await reader.cancel(reason);
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
return new Response(body, {
|
|
167
|
+
status: response.status,
|
|
168
|
+
statusText: response.statusText,
|
|
169
|
+
headers: response.headers,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const uiWireIds: Readonly<{
|
|
3
|
+
readonly request: import("@fungi.computer/cairn").IdCodec<"knapsack-ui", "request", 1>;
|
|
4
|
+
readonly connection: import("@fungi.computer/cairn").IdCodec<"knapsack-ui", "connection", 1>;
|
|
5
|
+
readonly claim: import("@fungi.computer/cairn").IdCodec<"knapsack-ui", "claim", 1>;
|
|
6
|
+
readonly attempt: import("@fungi.computer/cairn").IdCodec<"knapsack-ui", "attempt", 1>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const BrowserWireObjectSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
9
|
+
export type BrowserWireObject = z.output<typeof BrowserWireObjectSchema>;
|
|
10
|
+
export declare const BrowserCommandRowSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
11
|
+
action: z.ZodUnion<readonly [z.ZodObject<{
|
|
12
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
13
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
14
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
18
|
+
}, z.core.$strict>]>;
|
|
19
|
+
commandId: z.ZodString;
|
|
20
|
+
sourceId: z.ZodString;
|
|
21
|
+
title: z.ZodString;
|
|
22
|
+
category: z.ZodString;
|
|
23
|
+
description: z.ZodNullable<z.ZodString>;
|
|
24
|
+
order: z.ZodNumber;
|
|
25
|
+
keybind: z.ZodNullable<z.ZodString>;
|
|
26
|
+
availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
+
status: z.ZodLiteral<"available">;
|
|
28
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
+
status: z.ZodLiteral<"unavailable">;
|
|
30
|
+
reason: z.ZodString;
|
|
31
|
+
}, z.core.$strip>], "status">;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
commandId: z.ZodString;
|
|
34
|
+
sourceId: z.ZodString;
|
|
35
|
+
title: z.ZodString;
|
|
36
|
+
category: z.ZodString;
|
|
37
|
+
description: z.ZodNullable<z.ZodString>;
|
|
38
|
+
order: z.ZodNumber;
|
|
39
|
+
keybind: z.ZodNullable<z.ZodString>;
|
|
40
|
+
availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
41
|
+
status: z.ZodLiteral<"available">;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
status: z.ZodLiteral<"unavailable">;
|
|
44
|
+
reason: z.ZodString;
|
|
45
|
+
}, z.core.$strip>], "status">;
|
|
46
|
+
}, z.core.$strict>]>;
|
|
47
|
+
export declare const BrowserExecuteInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
+
commandId: z.ZodString;
|
|
49
|
+
arguments: z.ZodJSONSchema;
|
|
50
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
+
commandId: z.ZodString;
|
|
52
|
+
}, z.core.$strict>]>;
|
|
53
|
+
declare const BrowserRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"discover">;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
commandId: z.ZodString;
|
|
57
|
+
arguments: z.ZodJSONSchema;
|
|
58
|
+
type: z.ZodLiteral<"execute">;
|
|
59
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
+
commandId: z.ZodString;
|
|
61
|
+
type: z.ZodLiteral<"execute">;
|
|
62
|
+
}, z.core.$strict>]>;
|
|
63
|
+
declare const BrowserRequestEnvelopeSchema: z.ZodObject<{
|
|
64
|
+
requestId: z.ZodString;
|
|
65
|
+
request: z.ZodUnion<readonly [z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"discover">;
|
|
67
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
68
|
+
commandId: z.ZodString;
|
|
69
|
+
arguments: z.ZodJSONSchema;
|
|
70
|
+
type: z.ZodLiteral<"execute">;
|
|
71
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
72
|
+
commandId: z.ZodString;
|
|
73
|
+
type: z.ZodLiteral<"execute">;
|
|
74
|
+
}, z.core.$strict>]>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export declare const BrowserRequestDeliverySchema: z.ZodObject<{
|
|
77
|
+
requestId: z.ZodString;
|
|
78
|
+
request: z.ZodUnion<readonly [z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"discover">;
|
|
80
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
81
|
+
commandId: z.ZodString;
|
|
82
|
+
arguments: z.ZodJSONSchema;
|
|
83
|
+
type: z.ZodLiteral<"execute">;
|
|
84
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
85
|
+
commandId: z.ZodString;
|
|
86
|
+
type: z.ZodLiteral<"execute">;
|
|
87
|
+
}, z.core.$strict>]>;
|
|
88
|
+
connectionId: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export declare const BrowserClaimSchema: z.ZodObject<{
|
|
91
|
+
requestId: z.ZodString;
|
|
92
|
+
connectionId: z.ZodString;
|
|
93
|
+
attemptId: z.ZodString;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
export declare const BrowserClaimResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
96
|
+
status: z.ZodLiteral<"claimed">;
|
|
97
|
+
claimId: z.ZodString;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
status: z.ZodLiteral<"waiting">;
|
|
100
|
+
retryAfterMs: z.ZodNumber;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
status: z.ZodLiteral<"skipped">;
|
|
103
|
+
}, z.core.$strip>], "status">;
|
|
104
|
+
export declare const BrowserExecutionOutcomeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
105
|
+
status: z.ZodLiteral<"handled">;
|
|
106
|
+
result: z.ZodJSONSchema;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
status: z.ZodLiteral<"handled">;
|
|
109
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
+
status: z.ZodLiteral<"closed">;
|
|
111
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
112
|
+
status: z.ZodLiteral<"missing">;
|
|
113
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
114
|
+
status: z.ZodLiteral<"invalid">;
|
|
115
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
116
|
+
status: z.ZodLiteral<"unavailable">;
|
|
117
|
+
reason: z.ZodString;
|
|
118
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
119
|
+
status: z.ZodLiteral<"failed">;
|
|
120
|
+
error: z.ZodObject<{
|
|
121
|
+
code: z.ZodString;
|
|
122
|
+
message: z.ZodString;
|
|
123
|
+
details: z.ZodJSONSchema;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
126
|
+
status: z.ZodLiteral<"failed">;
|
|
127
|
+
error: z.ZodObject<{
|
|
128
|
+
code: z.ZodString;
|
|
129
|
+
message: z.ZodString;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
}, z.core.$strict>]>;
|
|
132
|
+
declare const BrowserWireResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
133
|
+
type: z.ZodLiteral<"discover">;
|
|
134
|
+
commands: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
135
|
+
action: z.ZodUnion<readonly [z.ZodObject<{
|
|
136
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
137
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
138
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
140
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
141
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
142
|
+
}, z.core.$strict>]>;
|
|
143
|
+
commandId: z.ZodString;
|
|
144
|
+
sourceId: z.ZodString;
|
|
145
|
+
title: z.ZodString;
|
|
146
|
+
category: z.ZodString;
|
|
147
|
+
description: z.ZodNullable<z.ZodString>;
|
|
148
|
+
order: z.ZodNumber;
|
|
149
|
+
keybind: z.ZodNullable<z.ZodString>;
|
|
150
|
+
availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
151
|
+
status: z.ZodLiteral<"available">;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
status: z.ZodLiteral<"unavailable">;
|
|
154
|
+
reason: z.ZodString;
|
|
155
|
+
}, z.core.$strip>], "status">;
|
|
156
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
157
|
+
commandId: z.ZodString;
|
|
158
|
+
sourceId: z.ZodString;
|
|
159
|
+
title: z.ZodString;
|
|
160
|
+
category: z.ZodString;
|
|
161
|
+
description: z.ZodNullable<z.ZodString>;
|
|
162
|
+
order: z.ZodNumber;
|
|
163
|
+
keybind: z.ZodNullable<z.ZodString>;
|
|
164
|
+
availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
165
|
+
status: z.ZodLiteral<"available">;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
status: z.ZodLiteral<"unavailable">;
|
|
168
|
+
reason: z.ZodString;
|
|
169
|
+
}, z.core.$strip>], "status">;
|
|
170
|
+
}, z.core.$strict>]>>;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"execute">;
|
|
173
|
+
outcome: z.ZodUnion<readonly [z.ZodObject<{
|
|
174
|
+
status: z.ZodLiteral<"handled">;
|
|
175
|
+
result: z.ZodJSONSchema;
|
|
176
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
177
|
+
status: z.ZodLiteral<"handled">;
|
|
178
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
179
|
+
status: z.ZodLiteral<"closed">;
|
|
180
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
+
status: z.ZodLiteral<"missing">;
|
|
182
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
183
|
+
status: z.ZodLiteral<"invalid">;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
185
|
+
status: z.ZodLiteral<"unavailable">;
|
|
186
|
+
reason: z.ZodString;
|
|
187
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
188
|
+
status: z.ZodLiteral<"failed">;
|
|
189
|
+
error: z.ZodObject<{
|
|
190
|
+
code: z.ZodString;
|
|
191
|
+
message: z.ZodString;
|
|
192
|
+
details: z.ZodJSONSchema;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
195
|
+
status: z.ZodLiteral<"failed">;
|
|
196
|
+
error: z.ZodObject<{
|
|
197
|
+
code: z.ZodString;
|
|
198
|
+
message: z.ZodString;
|
|
199
|
+
}, z.core.$strict>;
|
|
200
|
+
}, z.core.$strict>]>;
|
|
201
|
+
}, z.core.$strip>], "type">;
|
|
202
|
+
export declare const BrowserResultEnvelopeSchema: z.ZodObject<{
|
|
203
|
+
requestId: z.ZodString;
|
|
204
|
+
claimId: z.ZodString;
|
|
205
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
206
|
+
type: z.ZodLiteral<"discover">;
|
|
207
|
+
commands: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
208
|
+
action: z.ZodUnion<readonly [z.ZodObject<{
|
|
209
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
210
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
211
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
212
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
213
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
214
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
215
|
+
}, z.core.$strict>]>;
|
|
216
|
+
commandId: z.ZodString;
|
|
217
|
+
sourceId: z.ZodString;
|
|
218
|
+
title: z.ZodString;
|
|
219
|
+
category: z.ZodString;
|
|
220
|
+
description: z.ZodNullable<z.ZodString>;
|
|
221
|
+
order: z.ZodNumber;
|
|
222
|
+
keybind: z.ZodNullable<z.ZodString>;
|
|
223
|
+
availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
224
|
+
status: z.ZodLiteral<"available">;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
status: z.ZodLiteral<"unavailable">;
|
|
227
|
+
reason: z.ZodString;
|
|
228
|
+
}, z.core.$strip>], "status">;
|
|
229
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
230
|
+
commandId: z.ZodString;
|
|
231
|
+
sourceId: z.ZodString;
|
|
232
|
+
title: z.ZodString;
|
|
233
|
+
category: z.ZodString;
|
|
234
|
+
description: z.ZodNullable<z.ZodString>;
|
|
235
|
+
order: z.ZodNumber;
|
|
236
|
+
keybind: z.ZodNullable<z.ZodString>;
|
|
237
|
+
availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
238
|
+
status: z.ZodLiteral<"available">;
|
|
239
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
240
|
+
status: z.ZodLiteral<"unavailable">;
|
|
241
|
+
reason: z.ZodString;
|
|
242
|
+
}, z.core.$strip>], "status">;
|
|
243
|
+
}, z.core.$strict>]>>;
|
|
244
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
245
|
+
type: z.ZodLiteral<"execute">;
|
|
246
|
+
outcome: z.ZodUnion<readonly [z.ZodObject<{
|
|
247
|
+
status: z.ZodLiteral<"handled">;
|
|
248
|
+
result: z.ZodJSONSchema;
|
|
249
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
250
|
+
status: z.ZodLiteral<"handled">;
|
|
251
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
252
|
+
status: z.ZodLiteral<"closed">;
|
|
253
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
254
|
+
status: z.ZodLiteral<"missing">;
|
|
255
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
256
|
+
status: z.ZodLiteral<"invalid">;
|
|
257
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
258
|
+
status: z.ZodLiteral<"unavailable">;
|
|
259
|
+
reason: z.ZodString;
|
|
260
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
261
|
+
status: z.ZodLiteral<"failed">;
|
|
262
|
+
error: z.ZodObject<{
|
|
263
|
+
code: z.ZodString;
|
|
264
|
+
message: z.ZodString;
|
|
265
|
+
details: z.ZodJSONSchema;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
268
|
+
status: z.ZodLiteral<"failed">;
|
|
269
|
+
error: z.ZodObject<{
|
|
270
|
+
code: z.ZodString;
|
|
271
|
+
message: z.ZodString;
|
|
272
|
+
}, z.core.$strict>;
|
|
273
|
+
}, z.core.$strict>]>;
|
|
274
|
+
}, z.core.$strip>], "type">;
|
|
275
|
+
}, z.core.$strip>;
|
|
276
|
+
export declare const BrowserSettlementResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
277
|
+
status: z.ZodLiteral<"accepted">;
|
|
278
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
279
|
+
status: z.ZodLiteral<"ignored">;
|
|
280
|
+
}, z.core.$strip>], "status">;
|
|
281
|
+
export type BrowserCommandRow = z.output<typeof BrowserCommandRowSchema>;
|
|
282
|
+
export type BrowserRequest = z.output<typeof BrowserRequestSchema>;
|
|
283
|
+
export type BrowserRequestEnvelope = z.output<typeof BrowserRequestEnvelopeSchema>;
|
|
284
|
+
export type BrowserRequestDelivery = z.output<typeof BrowserRequestDeliverySchema>;
|
|
285
|
+
export type BrowserClaim = z.output<typeof BrowserClaimSchema>;
|
|
286
|
+
export type BrowserClaimResult = z.output<typeof BrowserClaimResultSchema>;
|
|
287
|
+
export type BrowserWireResult = z.output<typeof BrowserWireResultSchema>;
|
|
288
|
+
export type BrowserResultEnvelope = z.output<typeof BrowserResultEnvelopeSchema>;
|
|
289
|
+
export type BrowserSettlementResult = z.output<typeof BrowserSettlementResultSchema>;
|
|
290
|
+
export {};
|