apps 0.0.1-beta.143 → 0.0.1-beta.148
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 -0
- package/check-publish.mjs +0 -1
- package/framework-reference.json +1 -1
- package/js/{chunk-IWLFLMIL.js → chunk-4XXHO5UG.js} +3966 -1760
- package/js/{chunk-NXUNFV44.js → chunk-63BS5GBH.js} +9 -14
- package/js/{chunk-2XEQYDQY.js → chunk-A6FRLRCN.js} +0 -1
- package/js/{chunk-PASOVDON.js → chunk-ALZDZ3ZT.js} +9 -30
- package/js/{chunk-H4JK7UTH.js → chunk-CQCY3OZS.js} +8 -49
- package/js/{chunk-V6OUBNL4.js → chunk-CWAPV2TN.js} +4 -6
- package/js/{chunk-RW5EXIO6.js → chunk-DX5DD6Z2.js} +8 -17
- package/js/{chunk-B54D6AN7.js → chunk-E2PVLAGK.js} +7 -15
- package/js/{chunk-LRXY54YF.js → chunk-EXL6F456.js} +1 -1
- package/js/{chunk-Y3QPWYHC.js → chunk-FWK2WTJB.js} +4 -5
- package/js/{chunk-2OGVSUNI.js → chunk-GWFQCQB5.js} +2 -2
- package/js/chunk-HEFJFDU4.js +87 -0
- package/js/{chunk-XRNSAU62.js → chunk-I7MYW7IK.js} +2 -2
- package/js/{chunk-ADG72XX3.js → chunk-JLHRRTRH.js} +6 -13
- package/js/{chunk-K24M6LZ7.js → chunk-MXFPSMNM.js} +2 -2
- package/js/{chunk-INQON4A2.js → chunk-OA4UYCJ4.js} +2 -2
- package/js/{chunk-3RIEA22Q.js → chunk-PUMGAWHB.js} +24 -43
- package/js/{chunk-W6V5OIHB.js → chunk-SEJXUMGT.js} +267 -1
- package/js/{chunk-RUSVGD5N.js → chunk-SXYFFXHM.js} +2 -2
- package/js/{chunk-BHSWVS3Q.js → chunk-UT2CBMW3.js} +4 -1
- package/js/{chunk-XAOJP46A.js → chunk-XR7KZNKD.js} +1 -1
- package/js/{chunk-TMYRAFMC.js → chunk-ZWFMEH2Y.js} +18 -1
- package/js/client.js +31 -14
- package/js/contracts.js +3 -4
- package/js/effect.js +14 -15
- package/js/graphql.js +16 -19
- package/js/host.js +14 -17
- package/js/index.js +10 -16
- package/js/mcp/effect.js +15 -16
- package/js/mcp.js +17 -18
- package/js/openapi.js +14 -22
- package/js/react.js +122 -3
- package/js/skills/effect.js +3 -4
- package/js/skills.js +17 -24
- package/js/ui/auth/contracts.js +5 -1
- package/js/ui/auth.js +7 -4
- package/js/ui/contracts.js +52 -5
- package/js/ui/serving.js +55 -17
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/app-cache/src/index.d.ts +1 -40
- package/types/app-data/src/contracts/database.d.ts +0 -21
- package/types/apps/src/client.d.ts +3 -0
- package/types/apps/src/contracts/desktop-errors.d.ts +46 -0
- package/types/apps/src/contracts/desktop.d.ts +228 -0
- package/types/apps/src/contracts/ui-auth.d.ts +4 -1
- package/types/apps/src/contracts/ui.d.ts +43 -1
- package/types/apps/src/implementation/desktop.d.ts +85 -0
- package/types/apps/src/implementation/ui-serving.d.ts +13 -1
- package/types/apps/src/react.d.ts +29 -0
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +0 -24
- package/types/telemetry/src/browser-operations.d.ts +0 -8
- package/types/telemetry/src/browser-performance.d.ts +0 -2
- package/types/telemetry/src/browser-request-timing.d.ts +0 -1
- package/types/telemetry/src/browser.d.ts +0 -10
- package/types/telemetry/src/config.d.ts +0 -8
- package/types/telemetry/src/context.d.ts +0 -6
- package/types/telemetry/src/index.d.ts +0 -1
- package/types/telemetry/src/keepalive.d.ts +0 -44
- package/types/telemetry/src/layer.d.ts +0 -8
- package/types/telemetry/src/measurements.d.ts +0 -8
- package/types/telemetry/src/ownership.d.ts +0 -45
- package/types/telemetry/src/pending-span.d.ts +0 -2
- package/types/telemetry/src/recorded-failure.d.ts +0 -26
- package/types/telemetry/src/relay.d.ts +0 -29
- package/types/telemetry/src/span-attributes.d.ts +0 -38
- package/types/telemetry/src/trace-context.d.ts +0 -6
- package/types/telemetry/src/transport.d.ts +0 -10
- package/types/utils/src/api-error.d.ts +0 -22
- package/types/utils/src/connection-failure.d.ts +0 -10
- package/types/utils/src/random-uuid.d.ts +0 -5
- package/types/utils/src/recorded-message.d.ts +0 -15
- package/types/utils/src/schema-definitions.d.ts +0 -6
- package/types/utils/src/user-facing-error.d.ts +0 -19
- package/js/chunk-QLUWYCOT.js +0 -2325
|
@@ -1,58 +1,28 @@
|
|
|
1
|
-
/** Portable Effect cache mechanics. Adapters own storage and the background task lifetime. */
|
|
2
1
|
import { Duration, Effect, Schema } from "effect";
|
|
3
2
|
import { CacheError, type CacheTransport } from "./contracts/cache.js";
|
|
4
3
|
export * from "./contracts/cache.js";
|
|
5
|
-
/** Hash key material before storage or transport; keys and credential scope never enter telemetry. */
|
|
6
4
|
export declare const cacheKey: (key: unknown) => Effect.Effect<string, CacheError, never>;
|
|
7
|
-
/** A cache hit is decoded with the caller's schema. Loader failures are never cached. */
|
|
8
5
|
export interface CacheGet<A> {
|
|
9
6
|
readonly key: Schema.Json;
|
|
10
7
|
readonly schema: Schema.Decoder<A>;
|
|
11
8
|
readonly freshFor: Duration.Input;
|
|
12
9
|
readonly staleFor?: Duration.Input;
|
|
13
|
-
/**
|
|
14
|
-
* What a read does with a value past `freshFor` and within `staleFor`. `serve`, the default,
|
|
15
|
-
* returns it while one background load replaces it. `revalidate` awaits that load first, like a
|
|
16
|
-
* miss; the value stays readable to the load, which can confirm it instead of rebuilding it.
|
|
17
|
-
*/
|
|
18
10
|
readonly stale?: "serve" | "revalidate";
|
|
19
11
|
readonly load: Effect.Effect<A, unknown>;
|
|
20
12
|
}
|
|
21
|
-
|
|
22
|
-
export declare const makeCache: (host: CacheTransport, background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>, scope?: Schema.Json,
|
|
23
|
-
/** The caller's own deadline, when the host supplies one. Waiting never runs past it. */
|
|
24
|
-
deadline?: number,
|
|
25
|
-
/**
|
|
26
|
-
* Wraps the time this caller waits on another caller's load of the same entry, polls included,
|
|
27
|
-
* so the host can trace it and count it as waiting rather than as its own work.
|
|
28
|
-
*/
|
|
29
|
-
leaseWait?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) => {
|
|
30
|
-
/** Read arbitrary retained JSON entries without initiating a refresh. Missing and null are distinct. */
|
|
13
|
+
export declare const makeCache: (host: CacheTransport, background: (task: Effect.Effect<void, unknown>) => Effect.Effect<void>, scope?: Schema.Json, deadline?: number, leaseWait?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) => {
|
|
31
14
|
read: (keys: readonly Schema.Json[]) => Effect.Effect<readonly ({
|
|
32
15
|
readonly value: Schema.Json;
|
|
33
16
|
readonly version: string;
|
|
34
17
|
readonly freshUntil: number;
|
|
35
18
|
readonly staleUntil: number;
|
|
36
19
|
} | null)[], CacheError, never>;
|
|
37
|
-
/** Publish bounded immutable parts before publishing the manifest that references them. */
|
|
38
20
|
write: (entries: readonly {
|
|
39
21
|
readonly key: Schema.Json;
|
|
40
22
|
readonly value: Schema.Json;
|
|
41
23
|
}[], retention: Duration.Input) => Effect.Effect<void, CacheError, never>;
|
|
42
|
-
/** Revoke retained data and any loader's right to publish its in-flight result. */
|
|
43
24
|
invalidate: (key: Schema.Json) => Effect.Effect<void, CacheError, never>;
|
|
44
|
-
/**
|
|
45
|
-
* Read fresh data, refresh stale data in the background (or first, with `stale: "revalidate"`),
|
|
46
|
-
* or wait for the lease owner.
|
|
47
|
-
*/
|
|
48
25
|
get: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
|
|
49
|
-
/**
|
|
50
|
-
* `get`, also reading the keys of this scope that `keys` names in the same round trip. `keys`
|
|
51
|
-
* gets the entry's store key, which is unique to this scope and key, so a caller can remember
|
|
52
|
-
* what it read under it. `reads` holds their entries, undecoded and in order, when the value
|
|
53
|
-
* was read from the store; it is undefined when the value was loaded or the store did not read
|
|
54
|
-
* them, and the caller then reads what it still needs.
|
|
55
|
-
*/
|
|
56
26
|
getWith: <A>(options: CacheGet<A>, keys: (key: string) => readonly Schema.Json[]) => Effect.Effect<{
|
|
57
27
|
value: A;
|
|
58
28
|
key: string;
|
|
@@ -63,17 +33,9 @@ leaseWait?: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>)
|
|
|
63
33
|
readonly staleUntil: number;
|
|
64
34
|
} | null)[] | undefined;
|
|
65
35
|
}, unknown, never>;
|
|
66
|
-
/** Force one awaited refresh without removing the retained value. Concurrent refreshes share a load. */
|
|
67
36
|
revalidate: <A>(options: CacheGet<A>) => Effect.Effect<A, unknown, never>;
|
|
68
37
|
};
|
|
69
|
-
/**
|
|
70
|
-
* Host-side lease ownership for one app invocation. Leases the invocation claims are renewed while
|
|
71
|
-
* it runs, so a slow load keeps its key, and released when the host ends the invocation, including
|
|
72
|
-
* interrupted and cancelled ones and loads whose own release never arrived. A holder that stops
|
|
73
|
-
* running, or whose store channel stops answering, loses its lease within `leaseMs`.
|
|
74
|
-
*/
|
|
75
38
|
export declare const holdLeases: (transport: CacheTransport) => Effect.Effect<{
|
|
76
|
-
/** Use for every command of the invocation. Each command is bounded by `commandTimeoutMs`. */
|
|
77
39
|
transport: (input: {
|
|
78
40
|
readonly operation: "read";
|
|
79
41
|
readonly keys: readonly string[];
|
|
@@ -120,6 +82,5 @@ export declare const holdLeases: (transport: CacheTransport) => Effect.Effect<{
|
|
|
120
82
|
readonly operation: "invalidate";
|
|
121
83
|
readonly key: string;
|
|
122
84
|
}) => Effect.Effect<Schema.Json, CacheError, never>;
|
|
123
|
-
/** Stop renewing and release every lease the invocation still holds. */
|
|
124
85
|
close: Effect.Effect<void, never, never>;
|
|
125
86
|
}, never, never>;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
/** Portable, serialized app database declarations and operations. No product identity or database secrets cross this boundary. */
|
|
2
1
|
import { Schema, type Effect } from "effect";
|
|
3
|
-
/** Names have Lakebed's identifier shape and are always bound SQL values, never raw SQL. */
|
|
4
2
|
export declare const DataName: Schema.String;
|
|
5
|
-
/** Stored fields and index terms use finite scalar values; absent optional fields are represented by null in transport. */
|
|
6
3
|
export declare const Scalar: Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>;
|
|
7
4
|
export type Scalar = typeof Scalar.Type;
|
|
8
5
|
export declare const Field: Schema.Struct<{
|
|
@@ -42,7 +39,6 @@ export declare const DatabaseSchema: Schema.$Record<Schema.String, Schema.Struct
|
|
|
42
39
|
}>>;
|
|
43
40
|
}>>;
|
|
44
41
|
export type DatabaseSchema = typeof DatabaseSchema.Type;
|
|
45
|
-
/** The engine owns stable row identity and timestamps. */
|
|
46
42
|
export declare const Row: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Finite, Schema.Boolean]>>;
|
|
47
43
|
export type Row = typeof Row.Type;
|
|
48
44
|
export declare const RowMetadata: Schema.Struct<{
|
|
@@ -140,10 +136,8 @@ export type OperationResult = typeof OperationResult.Type;
|
|
|
140
136
|
declare const AppDatabaseError_base: Schema.Class<AppDatabaseError, Schema.TaggedStruct<"AppDatabaseError", {
|
|
141
137
|
readonly reason: Schema.Literals<readonly ["schema", "schema_changed", "table", "index", "range", "value", "readonly", "cursor", "limit", "closed", "storage", "replay"]>;
|
|
142
138
|
}>, import("effect/Cause").YieldableError>;
|
|
143
|
-
/** Safe expected failures, without supplied documents, SQL text, cursor payloads or credentials. */
|
|
144
139
|
export declare class AppDatabaseError extends AppDatabaseError_base {
|
|
145
140
|
}
|
|
146
|
-
/** Bounded work per authored operation. collect/count do not silently truncate. */
|
|
147
141
|
export declare const DatabaseLimits: Schema.Struct<{
|
|
148
142
|
readonly rowsRead: Schema.Int;
|
|
149
143
|
readonly rowsReturned: Schema.Int;
|
|
@@ -155,12 +149,7 @@ export declare const DatabaseLimits: Schema.Struct<{
|
|
|
155
149
|
readonly indexBytes: Schema.Int;
|
|
156
150
|
}>;
|
|
157
151
|
export type DatabaseLimits = typeof DatabaseLimits.Type;
|
|
158
|
-
/** Current per-invocation budgets, shared by every database adapter. */
|
|
159
152
|
export declare const defaultDatabaseLimits: DatabaseLimits;
|
|
160
|
-
/**
|
|
161
|
-
* The budget a query or mutation exhausted. `pageSize` bounds one take(n) or paginate call;
|
|
162
|
-
* `valueBytes` bounds one stored row; the rest accumulate across the whole invocation.
|
|
163
|
-
*/
|
|
164
153
|
export declare const DatabaseLimit: Schema.Literals<readonly ["scanCalls", "directGets", "rowsRead", "rowsReturned", "pageSize", "bytesRead", "writes", "valueBytes"]>;
|
|
165
154
|
export type DatabaseLimit = typeof DatabaseLimit.Type;
|
|
166
155
|
declare const DatabaseLimitExceeded_base: Schema.Class<DatabaseLimitExceeded, Schema.TaggedStruct<"DatabaseLimitExceeded", {
|
|
@@ -168,51 +157,41 @@ declare const DatabaseLimitExceeded_base: Schema.Class<DatabaseLimitExceeded, Sc
|
|
|
168
157
|
readonly maximum: Schema.Int;
|
|
169
158
|
readonly requested: Schema.Int;
|
|
170
159
|
}>, import("effect/Cause").YieldableError>;
|
|
171
|
-
/** A query or mutation exceeded one of its database budgets. Nothing it wrote is committed. */
|
|
172
160
|
export declare class DatabaseLimitExceeded extends DatabaseLimitExceeded_base {
|
|
173
161
|
get message(): string;
|
|
174
162
|
}
|
|
175
|
-
/** Host-owned row metadata that authored tables cannot declare. */
|
|
176
163
|
export declare const reservedFieldNames: readonly ["id", "createdAt", "updatedAt"];
|
|
177
164
|
declare const DatabaseFieldReserved_base: Schema.Class<DatabaseFieldReserved, Schema.TaggedStruct<"DatabaseFieldReserved", {
|
|
178
165
|
readonly table: Schema.String;
|
|
179
166
|
readonly field: Schema.Literals<readonly ["id", "createdAt", "updatedAt"]>;
|
|
180
167
|
}>, import("effect/Cause").YieldableError>;
|
|
181
|
-
/** A table declared a field the host adds to every row. */
|
|
182
168
|
export declare class DatabaseFieldReserved extends DatabaseFieldReserved_base {
|
|
183
169
|
get message(): string;
|
|
184
170
|
}
|
|
185
|
-
/** Failures a database session reports to authored code and its host. */
|
|
186
171
|
export type DatabaseError = AppDatabaseError | DatabaseLimitExceeded;
|
|
187
|
-
/** Host resource bounds outside an individual database transaction. Durations are milliseconds. */
|
|
188
172
|
export declare const DatabaseRuntimeLimits: Schema.Struct<{
|
|
189
173
|
readonly maxCursorChars: Schema.Int;
|
|
190
174
|
readonly connectionCacheCapacity: Schema.Int;
|
|
191
175
|
readonly connectionCacheTtlMs: Schema.Int;
|
|
192
176
|
}>;
|
|
193
177
|
export type DatabaseRuntimeLimits = typeof DatabaseRuntimeLimits.Type;
|
|
194
|
-
/** Cache eviction closes idle connections; it does not limit installed apps or expire their data. */
|
|
195
178
|
export declare const defaultDatabaseRuntimeLimits: {
|
|
196
179
|
readonly maxCursorChars: number;
|
|
197
180
|
readonly connectionCacheCapacity: number;
|
|
198
181
|
readonly connectionCacheTtlMs: number;
|
|
199
182
|
};
|
|
200
|
-
/** The host binds one database and read/write authority for the entire invocation. */
|
|
201
183
|
export interface DatabaseSession {
|
|
202
|
-
/** Host-only idempotency receipt, committed atomically with the mutation and validated result. */
|
|
203
184
|
readonly once: <E, R>(key: string, fingerprint: string, work: () => Effect.Effect<Schema.Json, E, R>) => Effect.Effect<Schema.Json, E | DatabaseError, R>;
|
|
204
185
|
readonly readTables: ReadonlySet<string>;
|
|
205
186
|
readonly changedTables: ReadonlySet<string>;
|
|
206
187
|
readonly execute: (operation: DatabaseOperation) => Effect.Effect<OperationResult, DatabaseError>;
|
|
207
188
|
}
|
|
208
|
-
/** Native operation scope owns snapshot consistency, write rollback and commit notifications. */
|
|
209
189
|
export interface AppDatabase {
|
|
210
190
|
readonly schema: DatabaseSchema;
|
|
211
191
|
readonly schemaHash: string;
|
|
212
192
|
readonly read: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
|
|
213
193
|
readonly mutate: <A, E, R>(work: (session: DatabaseSession) => Effect.Effect<A, E, R>) => Effect.Effect<A, E | DatabaseError, R>;
|
|
214
194
|
}
|
|
215
|
-
/** Product-independent app partitions. A host supplies persistent storage; callers never choose filenames. */
|
|
216
195
|
export interface AppDatabases {
|
|
217
196
|
readonly read: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
|
|
218
197
|
readonly mutate: <A, E>(app: string, schema: DatabaseSchema, work: (session: DatabaseSession) => Effect.Effect<A, E>) => Effect.Effect<A, E | DatabaseError>;
|
|
@@ -3,3 +3,6 @@ export { queryReference, mutationReference, liveQueryAtom } from "./implementati
|
|
|
3
3
|
export { AppQueryFailed, type OperationReference, type QueryDescriptor, type QueryTransport, } from "./contracts/live.js";
|
|
4
4
|
export { createAppClient } from "./implementation/ui-client.js";
|
|
5
5
|
export type { AppMutation, OptimisticLocalStore, OptimisticUpdate, } from "./contracts/optimistic.js";
|
|
6
|
+
export { desktop } from "./implementation/desktop.js";
|
|
7
|
+
export { DesktopUnavailable, DesktopPermissionDenied, ShortcutTaken, DesktopInvalidInput, SystemAudioBlocked, type DesktopError, } from "./contracts/desktop-errors.js";
|
|
8
|
+
export { desktopBadgeMaximum, desktopMaximumWindows, desktopMenuBarTitleMaxLength, desktopPermissions, desktopWindowSize, type DesktopPermission, type DesktopPermissionState, type DesktopWindowOptions, } from "./contracts/desktop.js";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Failures of `desktop` from `apps/client`, which authors check with `instanceof`. */
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import type { DesktopBridgeFailure } from "./desktop.js";
|
|
4
|
+
declare const DesktopUnavailable_base: Schema.Class<DesktopUnavailable, Schema.TaggedStruct<"DesktopUnavailable", {}>, import("effect/Cause").YieldableError>;
|
|
5
|
+
/** The page is not in an installed Executor desktop window, or the desktop closed the bridge. */
|
|
6
|
+
export declare class DesktopUnavailable extends DesktopUnavailable_base {
|
|
7
|
+
}
|
|
8
|
+
declare const DesktopPermissionDenied_base: Schema.Class<DesktopPermissionDenied, Schema.TaggedStruct<"DesktopPermissionDenied", {
|
|
9
|
+
permission: Schema.Literals<readonly ["menuBar", "shortcuts", "floating", "startAtLogin", "microphone", "camera", "systemAudio", "clipboardRead", "notifications"]>;
|
|
10
|
+
}>, import("effect/Cause").YieldableError>;
|
|
11
|
+
/** The person did not allow this capability for the app. */
|
|
12
|
+
export declare class DesktopPermissionDenied extends DesktopPermissionDenied_base {
|
|
13
|
+
}
|
|
14
|
+
declare const ShortcutTaken_base: Schema.Class<ShortcutTaken, Schema.TaggedStruct<"ShortcutTaken", {
|
|
15
|
+
accelerator: Schema.String;
|
|
16
|
+
}>, import("effect/Cause").YieldableError>;
|
|
17
|
+
/** Another app or program already holds this global shortcut. */
|
|
18
|
+
export declare class ShortcutTaken extends ShortcutTaken_base {
|
|
19
|
+
}
|
|
20
|
+
declare const DesktopInvalidInput_base: Schema.Class<DesktopInvalidInput, Schema.TaggedStruct<"DesktopInvalidInput", {
|
|
21
|
+
message: Schema.String;
|
|
22
|
+
}>, import("effect/Cause").YieldableError>;
|
|
23
|
+
/** The call's input is not one the desktop accepts, such as a title that is too long. */
|
|
24
|
+
export declare class DesktopInvalidInput extends DesktopInvalidInput_base {
|
|
25
|
+
}
|
|
26
|
+
declare const SystemAudioBlocked_base: Schema.Class<SystemAudioBlocked, Schema.TaggedStruct<"SystemAudioBlocked", {}>, import("effect/Cause").YieldableError>;
|
|
27
|
+
/**
|
|
28
|
+
* The app may hear system audio, but macOS has not allowed Executor to record the screen and
|
|
29
|
+
* system audio. The desktop has already offered to open System Settings; try again afterwards.
|
|
30
|
+
*/
|
|
31
|
+
export declare class SystemAudioBlocked extends SystemAudioBlocked_base {
|
|
32
|
+
}
|
|
33
|
+
/** Any failure a `desktop` call rejects with. */
|
|
34
|
+
export type DesktopError = DesktopUnavailable | DesktopPermissionDenied | ShortcutTaken | DesktopInvalidInput | SystemAudioBlocked;
|
|
35
|
+
/** The plain tagged objects a bridge rejects with, as they cross the desktop's preload. */
|
|
36
|
+
export declare const DesktopBridgeRejection: Schema.Union<readonly [Schema.TaggedStruct<"DesktopUnavailable", {}>, Schema.TaggedStruct<"DesktopPermissionDenied", {
|
|
37
|
+
permission: Schema.Literals<readonly ["menuBar", "shortcuts", "floating", "startAtLogin", "microphone", "camera", "systemAudio", "clipboardRead", "notifications"]>;
|
|
38
|
+
}>, Schema.TaggedStruct<"ShortcutTaken", {
|
|
39
|
+
accelerator: Schema.String;
|
|
40
|
+
}>, Schema.TaggedStruct<"DesktopInvalidInput", {
|
|
41
|
+
message: Schema.String;
|
|
42
|
+
}>, Schema.TaggedStruct<"SystemAudioBlocked", {}>]>;
|
|
43
|
+
type Same<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
|
|
44
|
+
/** Fails to compile when the decoder and the bridge contract's `DesktopBridgeFailure` differ. */
|
|
45
|
+
export declare const desktopBridgeRejectionMatchesContract: Same<typeof DesktopBridgeRejection.Type, DesktopBridgeFailure>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocols between the Executor desktop app and the pages it shows. The desktop's preload exposes
|
|
3
|
+
* each bridge as one frozen global, only in windows it owns, and checks the page's exact origin on
|
|
4
|
+
* every call. Neither bridge carries credentials, file access or account choice.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A capability an installed app asks the person for, once, and keeps until they revoke it.
|
|
8
|
+
* `microphone` and `camera` gate `navigator.mediaDevices.getUserMedia`, `clipboardRead` gates
|
|
9
|
+
* `navigator.clipboard.readText()`, `systemAudio` gates `desktop.audio.system()`, and
|
|
10
|
+
* `startAtLogin` opens the app hidden when the person signs in to their computer.
|
|
11
|
+
*/
|
|
12
|
+
export type DesktopPermission = "menuBar" | "shortcuts" | "floating" | "startAtLogin" | "microphone" | "camera" | "systemAudio" | "clipboardRead" | "notifications";
|
|
13
|
+
/** Every `DesktopPermission`, in the order the desktop lists them. */
|
|
14
|
+
export declare const desktopPermissions: readonly DesktopPermission[];
|
|
15
|
+
/**
|
|
16
|
+
* `prompt` asks on first use. `unavailable` means the page is not in an installed desktop window,
|
|
17
|
+
* or this platform has no such capability: `systemAudio` needs macOS 13 or Windows, and
|
|
18
|
+
* `startAtLogin` needs macOS, Windows or a Linux desktop that reads `~/.config/autostart`.
|
|
19
|
+
*/
|
|
20
|
+
export type DesktopPermissionState = "granted" | "denied" | "prompt" | "unavailable";
|
|
21
|
+
/** Failures a bridge call rejects with, as plain tagged objects that cross the preload boundary. */
|
|
22
|
+
export type DesktopBridgeFailure = {
|
|
23
|
+
readonly _tag: "DesktopUnavailable";
|
|
24
|
+
} | {
|
|
25
|
+
readonly _tag: "DesktopPermissionDenied";
|
|
26
|
+
readonly permission: DesktopPermission;
|
|
27
|
+
} | {
|
|
28
|
+
readonly _tag: "ShortcutTaken";
|
|
29
|
+
readonly accelerator: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly _tag: "DesktopInvalidInput";
|
|
32
|
+
readonly message: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly _tag: "SystemAudioBlocked";
|
|
35
|
+
};
|
|
36
|
+
/** Longest menu-bar title, in characters. */
|
|
37
|
+
export declare const desktopMenuBarTitleMaxLength = 24;
|
|
38
|
+
/** Largest count `setBadge` shows. */
|
|
39
|
+
export declare const desktopBadgeMaximum = 99999;
|
|
40
|
+
/** Most extra windows one installed app holds open at once, besides its main window. */
|
|
41
|
+
export declare const desktopMaximumWindows = 8;
|
|
42
|
+
/** Smallest and largest size, in pixels, of a window `openWindow` opens. */
|
|
43
|
+
export declare const desktopWindowSize: {
|
|
44
|
+
readonly minimum: 200;
|
|
45
|
+
readonly maximum: 4096;
|
|
46
|
+
};
|
|
47
|
+
/** What a window `openWindow` opens looks like. Width and height default to 800 by 600. */
|
|
48
|
+
export interface DesktopWindowOptions {
|
|
49
|
+
readonly width?: number;
|
|
50
|
+
readonly height?: number;
|
|
51
|
+
/** Keep the window above other windows. Needs the `floating` permission. */
|
|
52
|
+
readonly floating?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** What happened to the window a page is in, as the `type` of a `desktopWindowEvent`. */
|
|
55
|
+
export type DesktopWindowEventType = "focus" | "blur";
|
|
56
|
+
/**
|
|
57
|
+
* The bridge in an installed app window or menu-bar popover, at `window[desktopAppBridgeGlobal]`.
|
|
58
|
+
* Authors use `desktop` from `apps/client`, which wraps it; they never read the global.
|
|
59
|
+
* Notifications use the standard `Notification` API; the desktop asks for the `notifications`
|
|
60
|
+
* permission in front of it.
|
|
61
|
+
*/
|
|
62
|
+
export interface DesktopAppBridge {
|
|
63
|
+
readonly version: typeof desktopBridgeVersion;
|
|
64
|
+
readonly permission: (name: DesktopPermission) => Promise<DesktopPermissionState>;
|
|
65
|
+
/** Ask the person for a permission now if they have not answered, and resolve their choice. */
|
|
66
|
+
readonly requestPermission: (name: DesktopPermission) => Promise<DesktopPermissionState>;
|
|
67
|
+
/** Plain text up to `desktopMenuBarTitleMaxLength`; `null` restores the app's name. */
|
|
68
|
+
readonly setMenuBarTitle: (text: string | null) => Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Register a global shortcut in Electron accelerator syntax. When pressed, the page receives a
|
|
71
|
+
* `desktopShortcutEvent` `CustomEvent` on `window` whose `detail` is `{ id }`.
|
|
72
|
+
*/
|
|
73
|
+
readonly registerShortcut: (accelerator: string) => Promise<{
|
|
74
|
+
readonly id: string;
|
|
75
|
+
}>;
|
|
76
|
+
readonly unregisterShortcut: (id: string) => Promise<void>;
|
|
77
|
+
readonly setFloating: (on: boolean) => Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* The window the calling page is in: `show` makes it visible, `hide` hides it, `focus` shows it
|
|
80
|
+
* and brings it in front of every other app's windows, and `toggle` hides it when it is visible
|
|
81
|
+
* and focused and focuses it otherwise.
|
|
82
|
+
*/
|
|
83
|
+
readonly windowAction: (action: "show" | "hide" | "focus" | "toggle") => Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Open another window of this app at a path on the app's own origin, or focus the window that
|
|
86
|
+
* already shows it. The window has this bridge too and closes with the app.
|
|
87
|
+
*/
|
|
88
|
+
readonly openWindow: (path: string, options: DesktopWindowOptions) => Promise<void>;
|
|
89
|
+
/** A count from 1 to `desktopBadgeMaximum` on the app's icon; `null` or 0 removes it. */
|
|
90
|
+
readonly setBadge: (count: number | null) => Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Ask for the `systemAudio` permission and check the computer lets Executor record what it
|
|
93
|
+
* plays. Resolves when `getDisplayMedia` in this page will capture system audio.
|
|
94
|
+
*/
|
|
95
|
+
readonly systemAudio: () => Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export declare const desktopAppBridgeGlobal = "__executorDesktop";
|
|
98
|
+
export declare const desktopShortcutEvent = "executor:desktop-shortcut";
|
|
99
|
+
/** Dispatched on `window` with `detail` `{ type: DesktopWindowEventType }`. */
|
|
100
|
+
export declare const desktopWindowEvent = "executor:desktop-window";
|
|
101
|
+
export declare const desktopBridgeVersion = 1;
|
|
102
|
+
/**
|
|
103
|
+
* `executor://app/<server>/<app>` opens an installed app; a path and query after the app's ID,
|
|
104
|
+
* such as `executor://app/<server>/<app>/notes/42?tab=edit`, open it at that path on its origin.
|
|
105
|
+
* A notification an app shows with `new Notification(title, { data: { path } })` opens that path
|
|
106
|
+
* the same way when the person clicks it.
|
|
107
|
+
*/
|
|
108
|
+
export declare const desktopNotificationPathKey = "path";
|
|
109
|
+
/**
|
|
110
|
+
* An app on one account the desktop holds. `server` is the account's `id` (`DesktopAccount`): the
|
|
111
|
+
* server's ID from `/.well-known/executor` for this computer, `<server ID>.<organization ID>` for a
|
|
112
|
+
* team on a hosted server. App links use it as their `<server>` segment.
|
|
113
|
+
*/
|
|
114
|
+
export interface DesktopAppRef {
|
|
115
|
+
readonly server: string;
|
|
116
|
+
readonly app: string;
|
|
117
|
+
}
|
|
118
|
+
export interface DesktopInstalledApp extends DesktopAppRef {
|
|
119
|
+
readonly name: string;
|
|
120
|
+
readonly installedAt: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The account a desktop dashboard window belongs to: this computer's own Executor, or one team on
|
|
124
|
+
* a hosted server. `id` is the server's ID for this computer and `<server ID>.<organization ID>` for
|
|
125
|
+
* a team, so several teams on one server are separate accounts.
|
|
126
|
+
*/
|
|
127
|
+
export interface DesktopAccount {
|
|
128
|
+
readonly id: string;
|
|
129
|
+
readonly kind: "local" | "self-host" | "cloud";
|
|
130
|
+
readonly team: string;
|
|
131
|
+
readonly host: string;
|
|
132
|
+
/**
|
|
133
|
+
* `sign-in-again`: its sign-in ended and its apps stay closed until it signs in again.
|
|
134
|
+
* `unreachable`: its server did not answer the last time the desktop asked.
|
|
135
|
+
*/
|
|
136
|
+
readonly state: "signed-in" | "sign-in-again" | "unreachable";
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Where the dashboard's account button is, in CSS pixels of the page's viewport, so the desktop
|
|
140
|
+
* shows its own account menu above it. `settings` adds Account settings to the menu.
|
|
141
|
+
*/
|
|
142
|
+
export interface DesktopAccountMenuOptions {
|
|
143
|
+
readonly anchor: {
|
|
144
|
+
readonly x: number;
|
|
145
|
+
readonly y: number;
|
|
146
|
+
readonly width: number;
|
|
147
|
+
readonly height: number;
|
|
148
|
+
};
|
|
149
|
+
readonly settings: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The bridge in the desktop's dashboard windows, at `window[desktopHostBridgeGlobal]`. The shared
|
|
153
|
+
* dashboard shows Install as app and the Desktop section only when it is present. `install` shows
|
|
154
|
+
* the desktop's own confirmation dialog and resolves `null` when the person cancels.
|
|
155
|
+
*/
|
|
156
|
+
export interface DesktopHostBridge {
|
|
157
|
+
readonly version: typeof desktopBridgeVersion;
|
|
158
|
+
/** The account this dashboard window belongs to: a `DesktopAccount`'s `id`. */
|
|
159
|
+
readonly server: string;
|
|
160
|
+
readonly installed: (app: string) => Promise<DesktopInstalledApp | null>;
|
|
161
|
+
readonly install: (app: string) => Promise<DesktopInstalledApp | null>;
|
|
162
|
+
readonly uninstall: (app: string) => Promise<void>;
|
|
163
|
+
readonly open: (app: string) => Promise<void>;
|
|
164
|
+
readonly permissions: (app: string) => Promise<Record<DesktopPermission, DesktopPermissionState>>;
|
|
165
|
+
/**
|
|
166
|
+
* `denied` and `prompt` apply at once. `granted` shows the desktop's own permission prompt
|
|
167
|
+
* first, so a page can't grant an app anything the person did not allow there. Resolves the
|
|
168
|
+
* state the permission has afterwards.
|
|
169
|
+
*/
|
|
170
|
+
readonly setPermission: (app: string, name: DesktopPermission, state: "granted" | "denied" | "prompt") => Promise<DesktopPermissionState>;
|
|
171
|
+
/** This window's own account. Desktops before accounts lack the three account members. */
|
|
172
|
+
readonly account?: () => Promise<DesktopAccount>;
|
|
173
|
+
/** Calls `listener` with this window's account whenever it changes, until the returned function runs. */
|
|
174
|
+
readonly watchAccount?: (listener: (account: DesktopAccount) => void) => () => void;
|
|
175
|
+
/**
|
|
176
|
+
* Calls `listener` with an app's ID whenever it is installed or removed on this desktop, however
|
|
177
|
+
* that happened, until the returned function runs.
|
|
178
|
+
*/
|
|
179
|
+
readonly watchInstalled?: (listener: (app: string) => void) => () => void;
|
|
180
|
+
/**
|
|
181
|
+
* Show the desktop's own account menu, which lists every account on this computer and switches,
|
|
182
|
+
* adds, signs out of and removes them; the page never sees the other accounts. Resolves when the
|
|
183
|
+
* menu closes: `settings` when the person chose Account settings, which the page then opens.
|
|
184
|
+
*/
|
|
185
|
+
readonly openAccountMenu?: (options: DesktopAccountMenuOptions) => Promise<"settings" | null>;
|
|
186
|
+
}
|
|
187
|
+
export declare const desktopHostBridgeGlobal = "__executorDesktopHost";
|
|
188
|
+
/**
|
|
189
|
+
* What `GET /.well-known/executor` answers on every Executor server, so a desktop can key it.
|
|
190
|
+
* `origins` names where each role is served: the dashboard with sign-in and session links, the
|
|
191
|
+
* API with its protected resource, and the OAuth issuer. One origin serves all three on local
|
|
192
|
+
* and self-host; Cloud splits them across hosts.
|
|
193
|
+
*/
|
|
194
|
+
export interface ExecutorServerIdentity {
|
|
195
|
+
readonly serverId: string;
|
|
196
|
+
readonly kind: "local" | "self-host" | "cloud";
|
|
197
|
+
readonly origins: {
|
|
198
|
+
readonly dashboard: string;
|
|
199
|
+
readonly api: string;
|
|
200
|
+
readonly auth: string;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
export declare const executorServerIdentityPath = "/.well-known/executor";
|
|
204
|
+
/**
|
|
205
|
+
* A browser dashboard's request that the desktop install one of its apps:
|
|
206
|
+
* `executor://install?server=<dashboard origin>&app=<app ID>`, with `&org=<organization ID>` for a
|
|
207
|
+
* hosted server. Any website can open such a link, so it carries no credential and grants
|
|
208
|
+
* nothing: the desktop confirms the server's identity at `server` and shows its own install
|
|
209
|
+
* dialog, and adding an unknown server shows the server form with that host first.
|
|
210
|
+
*/
|
|
211
|
+
export interface DesktopInstallLink {
|
|
212
|
+
/** The dashboard's origin: `https://`, or `http://` on `localhost`, `127.0.0.1` or `[::1]`. */
|
|
213
|
+
readonly server: string;
|
|
214
|
+
readonly app: string;
|
|
215
|
+
readonly organization?: string;
|
|
216
|
+
/**
|
|
217
|
+
* The app's and its team's names as the dashboard showed them, so a desktop that cannot read
|
|
218
|
+
* them yet can say what the link asks. Any page can write them, so they only label a prompt.
|
|
219
|
+
*/
|
|
220
|
+
readonly name?: string;
|
|
221
|
+
readonly team?: string;
|
|
222
|
+
}
|
|
223
|
+
export declare const desktopLinkProtocol = "executor";
|
|
224
|
+
export declare const loopbackHostname: (hostname: string) => boolean;
|
|
225
|
+
/** Build an install link, or `undefined` when its parts would not parse back. */
|
|
226
|
+
export declare const desktopInstallLink: (link: DesktopInstallLink) => string | undefined;
|
|
227
|
+
/** Read an install link strictly: any other part, repeated or unknown parameter is refused. */
|
|
228
|
+
export declare const parseDesktopInstallLink: (value: string) => DesktopInstallLink | undefined;
|
|
@@ -5,7 +5,10 @@ export declare const AppSignInId: Schema.brand<Schema.String, "AppSignInId">;
|
|
|
5
5
|
export type AppSignInId = typeof AppSignInId.Type;
|
|
6
6
|
/** Authentication proofs are redacted at the HTTP boundary. */
|
|
7
7
|
export declare const AppSignInCode: Schema.RedactedFromValue<Schema.String>;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* A path on the current app origin, including its query and fragment; never a redirect to another
|
|
10
|
+
* host or host-owned route, except the menu-bar page, which renders the app like its main page.
|
|
11
|
+
*/
|
|
9
12
|
export declare const AppReturnPath: Schema.brand<Schema.String, "AppReturnPath">;
|
|
10
13
|
export type AppReturnPath = typeof AppReturnPath.Type;
|
|
11
14
|
/** Callback query on the app origin. The code is single-use and works only with its attempt's cookie. */
|
|
@@ -24,6 +24,48 @@ export interface UiAccountNotice {
|
|
|
24
24
|
/** The app's accounts in the dashboard. */
|
|
25
25
|
readonly fix: string;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* The pages a host can open for an app: the source file that defines each, and where the build
|
|
29
|
+
* retains it. `main` is the app's page in a browser tab or an installed window; `menuBar` is the
|
|
30
|
+
* desktop menu-bar popover. Retained pages outside `index.html` sit under the host-owned
|
|
31
|
+
* `_executor/` prefix, which neither compiled output nor public files can use.
|
|
32
|
+
*/
|
|
33
|
+
export declare const appUiDocuments: {
|
|
34
|
+
readonly main: {
|
|
35
|
+
readonly source: "ui/index.html";
|
|
36
|
+
readonly asset: "index.html";
|
|
37
|
+
};
|
|
38
|
+
readonly menuBar: {
|
|
39
|
+
readonly source: "ui/menubar.html";
|
|
40
|
+
readonly asset: "_executor/menubar.html";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type AppUiDocument = keyof typeof appUiDocuments;
|
|
44
|
+
/** The app's icon, for desktop launchers, windows and the menu bar. */
|
|
45
|
+
export declare const appUiIcon: {
|
|
46
|
+
readonly source: "ui/icon.svg";
|
|
47
|
+
readonly asset: "_executor/icon.svg";
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Which optional pages a build retained, written beside them so a host learns this from one read.
|
|
51
|
+
* Builds from before it have only the main page.
|
|
52
|
+
*/
|
|
53
|
+
export declare const appUiPagesAsset = "_executor/pages.json";
|
|
54
|
+
export declare const AppUiPagesManifest: Schema.Struct<{
|
|
55
|
+
readonly menuBar: Schema.Boolean;
|
|
56
|
+
readonly icon: Schema.Boolean;
|
|
57
|
+
}>;
|
|
58
|
+
/** What a version's retained UI has: its main page, menu-bar page and icon. */
|
|
59
|
+
export interface AppUiPages {
|
|
60
|
+
readonly main: boolean;
|
|
61
|
+
readonly menuBar: boolean;
|
|
62
|
+
readonly icon: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Where an app's origin serves its menu-bar page and its icon. */
|
|
65
|
+
export declare const appMenuBarRoute = "/_executor/menubar";
|
|
66
|
+
export declare const appIconRoute = "/_executor/icon.svg";
|
|
67
|
+
/** Bytes an icon may contain. */
|
|
68
|
+
export declare const appUiIconMaxBytes: number;
|
|
27
69
|
/** Retained browser bytes. Hosts authorize access before reading or rendering them. */
|
|
28
70
|
export interface AppUiFile {
|
|
29
71
|
readonly body: Uint8Array;
|
|
@@ -127,4 +169,4 @@ export declare const AppUiApi: HttpApi.HttpApi<"app-ui", HttpApiGroup.HttpApiGro
|
|
|
127
169
|
} | {
|
|
128
170
|
readonly type: "heartbeat";
|
|
129
171
|
}>, Schema.toCodecJson<typeof UiUnauthorized | typeof UiForbidden | typeof UiVersionChanged | typeof UiFailed>, never, never>, false>>;
|
|
130
|
-
export
|
|
172
|
+
export * from "./desktop.js";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type DesktopPermission, type DesktopPermissionState, type DesktopWindowOptions } from "../contracts/desktop.js";
|
|
2
|
+
/**
|
|
3
|
+
* Capabilities of the Executor desktop app, for a page shown in an installed app window or its
|
|
4
|
+
* menu-bar popover. In any other page `available` is false, `permission` resolves `"unavailable"`
|
|
5
|
+
* and every other call rejects with `DesktopUnavailable`. Calls that need a permission ask the
|
|
6
|
+
* person the first time and reject with `DesktopPermissionDenied` when they decline.
|
|
7
|
+
*/
|
|
8
|
+
export declare const desktop: {
|
|
9
|
+
/** Whether this page is in an installed Executor desktop window. */
|
|
10
|
+
readonly available: boolean;
|
|
11
|
+
/** The person's choice for one capability, without asking them. */
|
|
12
|
+
permission: (name: DesktopPermission) => Promise<DesktopPermissionState>;
|
|
13
|
+
/**
|
|
14
|
+
* Ask the person for one capability now, if they have not answered yet, and resolve their
|
|
15
|
+
* choice; a refusal resolves `"denied"` rather than rejecting. Use it for `startAtLogin`, which
|
|
16
|
+
* no other call asks for, or to ask for the microphone before a recording starts.
|
|
17
|
+
*/
|
|
18
|
+
requestPermission: (name: DesktopPermission) => Promise<DesktopPermissionState>;
|
|
19
|
+
menuBar: {
|
|
20
|
+
/**
|
|
21
|
+
* Show plain text for the app in the menu bar, at most `desktopMenuBarTitleMaxLength`
|
|
22
|
+
* characters. `null` restores the app's name. Needs the `menuBar` permission.
|
|
23
|
+
*/
|
|
24
|
+
setTitle: (text: string | null) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
shortcuts: {
|
|
27
|
+
/**
|
|
28
|
+
* Call `handler` whenever the person presses `accelerator` anywhere on their computer, in
|
|
29
|
+
* Electron accelerator syntax such as `"CommandOrControl+Shift+K"`. Resolves a function that
|
|
30
|
+
* removes the shortcut through the desktop window that registered it. The shortcut stays held,
|
|
31
|
+
* and `handler` keeps running, until that function resolves; when it rejects, call it again.
|
|
32
|
+
* Needs the `shortcuts` permission; rejects with `ShortcutTaken` when another program holds
|
|
33
|
+
* the keys.
|
|
34
|
+
*/
|
|
35
|
+
register: (accelerator: string, handler: () => void) => Promise<() => Promise<void>>;
|
|
36
|
+
};
|
|
37
|
+
window: {
|
|
38
|
+
/** Keep the app's window above other windows, or stop. Needs the `floating` permission. */
|
|
39
|
+
setFloating: (on: boolean) => Promise<void>;
|
|
40
|
+
/** Make the window this page is in visible. */
|
|
41
|
+
show: () => Promise<void>;
|
|
42
|
+
/** Hide the window this page is in. The app keeps running, and its page keeps running. */
|
|
43
|
+
hide: () => Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Show the window this page is in and bring it in front of every other app's windows, such as
|
|
46
|
+
* from a global shortcut's handler.
|
|
47
|
+
*/
|
|
48
|
+
focus: () => Promise<void>;
|
|
49
|
+
/** Hide the window when it is visible and focused; otherwise show and focus it. */
|
|
50
|
+
toggle: () => Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Open another window of this app at `path`, such as `"/compose?to=ada"`, on the app's own
|
|
53
|
+
* origin, or focus the window that already shows that path. The window has `desktop` too, with
|
|
54
|
+
* the same permissions, and closes when the app quits. At most `desktopMaximumWindows` are
|
|
55
|
+
* open at once; `floating` needs the `floating` permission.
|
|
56
|
+
*/
|
|
57
|
+
open: (path: string, options?: DesktopWindowOptions) => Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Call `handler` whenever the window this page is in loses focus, such as to hide a window a
|
|
60
|
+
* shortcut summoned. Returns a function that stops listening. Does nothing outside an
|
|
61
|
+
* installed Executor desktop window.
|
|
62
|
+
*/
|
|
63
|
+
onBlur: (handler: () => void) => (() => void);
|
|
64
|
+
/** Call `handler` whenever the window this page is in gains focus. */
|
|
65
|
+
onFocus: (handler: () => void) => (() => void);
|
|
66
|
+
};
|
|
67
|
+
badge: {
|
|
68
|
+
/**
|
|
69
|
+
* Show a count on the app's icon: on Windows, on the app's own taskbar button; on macOS and
|
|
70
|
+
* Linux, installed apps share Executor's Dock or launcher icon, which shows the sum of their
|
|
71
|
+
* counts. `null` or 0 removes the app's count. Needs no permission.
|
|
72
|
+
*/
|
|
73
|
+
set: (count: number | null) => Promise<void>;
|
|
74
|
+
};
|
|
75
|
+
audio: {
|
|
76
|
+
/**
|
|
77
|
+
* Everything playing on this computer, such as the other people in a call, as an audio-only
|
|
78
|
+
* `MediaStream`. Asks for the `systemAudio` permission the first time. Rejects with
|
|
79
|
+
* `SystemAudioBlocked` when macOS has not allowed Executor to record the screen and system
|
|
80
|
+
* audio, after offering to open System Settings, and with `DesktopUnavailable` where the
|
|
81
|
+
* computer cannot capture system audio (Linux, macOS before 13). Stop its tracks when done.
|
|
82
|
+
*/
|
|
83
|
+
system: () => Promise<MediaStream>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Option, Stream } from "effect";
|
|
2
2
|
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
3
|
-
import { UiFailed, UiForbidden, type AppUiAsset, type AppUiRange, type AppUiStoredFile, type UiAccountNotice } from "../contracts/ui.js";
|
|
3
|
+
import { type AppUiPages, UiFailed, type AppUiDocument, UiForbidden, type AppUiAsset, type AppUiRange, type AppUiStoredFile, type UiAccountNotice } from "../contracts/ui.js";
|
|
4
4
|
/**
|
|
5
5
|
* The version's public file a page path names, or a 404 for a missing file. `None` means the path
|
|
6
6
|
* is the page itself. Hosts answer files before the page's account and usage work, which a file
|
|
@@ -17,6 +17,8 @@ export declare const appFile: <E, R>(options: {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const appDocument: <E, R>(options: {
|
|
19
19
|
readonly version: string;
|
|
20
|
+
/** Which of the app's pages to render; the main page when absent. */
|
|
21
|
+
readonly document?: AppUiDocument | undefined;
|
|
20
22
|
/** The account IDs the page runs with, by requirement. */
|
|
21
23
|
readonly accountIds?: Readonly<Record<string, readonly string[]>> | undefined;
|
|
22
24
|
readonly accounts?: UiAccountNotice | undefined;
|
|
@@ -33,6 +35,16 @@ export declare const storedAppFile: <E1, E2>(stored: {
|
|
|
33
35
|
}, read: (range: AppUiRange | undefined) => Effect.Effect<Option.Option<{
|
|
34
36
|
readonly body: Stream.Stream<Uint8Array, E1>;
|
|
35
37
|
}>, E2>) => AppUiStoredFile;
|
|
38
|
+
/**
|
|
39
|
+
* The app's icon. The response forbids scripts and outside loads, so opening the URL shows only
|
|
40
|
+
* the drawing; desktops render it as an image, which runs nothing either.
|
|
41
|
+
*/
|
|
42
|
+
export declare const appIcon: (asset: AppUiAsset | undefined, build: string) => Effect.Effect<HttpServerResponse.HttpServerResponse, UiFailed, HttpServerRequest.HttpServerRequest>;
|
|
43
|
+
/**
|
|
44
|
+
* What a version's retained UI has, from its pages manifest, or from its main page for a build
|
|
45
|
+
* that predates the manifest.
|
|
46
|
+
*/
|
|
47
|
+
export declare const appUiPages: <E, R>(asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>) => Effect.Effect<AppUiPages, E | UiFailed, R>;
|
|
36
48
|
/** The file a URL path names: each segment percent-decoded, or none when one does not decode. */
|
|
37
49
|
export declare const assetPath: (path: string) => Option.Option<string>;
|
|
38
50
|
/** Serve an asset only after the host has checked current access and file existence.
|