apps 0.0.1-beta.144 → 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.
Files changed (48) hide show
  1. package/README.md +14 -0
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-IWLFLMIL.js → chunk-4XXHO5UG.js} +3966 -1760
  4. package/js/{chunk-6OWHQINS.js → chunk-63BS5GBH.js} +2 -2
  5. package/js/{chunk-6NRWFVK2.js → chunk-ALZDZ3ZT.js} +3 -3
  6. package/js/{chunk-T4MICYGT.js → chunk-CQCY3OZS.js} +2 -2
  7. package/js/{chunk-QDF7PQAD.js → chunk-CWAPV2TN.js} +2 -2
  8. package/js/{chunk-5MEOL2SG.js → chunk-DX5DD6Z2.js} +6 -6
  9. package/js/{chunk-455CCO6Q.js → chunk-E2PVLAGK.js} +1 -1
  10. package/js/{chunk-AFEMXP3F.js → chunk-FWK2WTJB.js} +2 -2
  11. package/js/{chunk-2OGVSUNI.js → chunk-GWFQCQB5.js} +2 -2
  12. package/js/chunk-HEFJFDU4.js +87 -0
  13. package/js/{chunk-B2PSDMZP.js → chunk-I7MYW7IK.js} +2 -2
  14. package/js/{chunk-B4JN2A6F.js → chunk-MXFPSMNM.js} +1 -1
  15. package/js/{chunk-INQON4A2.js → chunk-OA4UYCJ4.js} +2 -2
  16. package/js/{chunk-OFSXKKD6.js → chunk-PUMGAWHB.js} +7 -7
  17. package/js/{chunk-W6V5OIHB.js → chunk-SEJXUMGT.js} +267 -1
  18. package/js/{chunk-BU3UOD2T.js → chunk-SXYFFXHM.js} +1 -1
  19. package/js/{chunk-BHSWVS3Q.js → chunk-UT2CBMW3.js} +4 -1
  20. package/js/{chunk-TMYRAFMC.js → chunk-ZWFMEH2Y.js} +18 -1
  21. package/js/client.js +30 -8
  22. package/js/contracts.js +1 -2
  23. package/js/effect.js +10 -11
  24. package/js/graphql.js +12 -13
  25. package/js/host.js +10 -11
  26. package/js/index.js +6 -7
  27. package/js/mcp/effect.js +11 -12
  28. package/js/mcp.js +13 -14
  29. package/js/openapi.js +8 -9
  30. package/js/react.js +122 -3
  31. package/js/skills/effect.js +1 -2
  32. package/js/skills.js +7 -8
  33. package/js/ui/auth/contracts.js +5 -1
  34. package/js/ui/auth.js +7 -4
  35. package/js/ui/contracts.js +52 -5
  36. package/js/ui/serving.js +55 -17
  37. package/package.json +1 -1
  38. package/runtime.json +1 -1
  39. package/types/apps/src/client.d.ts +3 -0
  40. package/types/apps/src/contracts/desktop-errors.d.ts +46 -0
  41. package/types/apps/src/contracts/desktop.d.ts +228 -0
  42. package/types/apps/src/contracts/ui-auth.d.ts +4 -1
  43. package/types/apps/src/contracts/ui.d.ts +43 -1
  44. package/types/apps/src/implementation/desktop.d.ts +85 -0
  45. package/types/apps/src/implementation/ui-serving.d.ts +13 -1
  46. package/types/apps/src/react.d.ts +29 -0
  47. package/types/apps/src/ui-serving.d.ts +1 -1
  48. package/js/chunk-QLUWYCOT.js +0 -2325
@@ -5,12 +5,12 @@ import {
5
5
  PartialListing,
6
6
  joinPath,
7
7
  mergeMeta
8
- } from "./chunk-455CCO6Q.js";
8
+ } from "./chunk-E2PVLAGK.js";
9
9
  import {
10
10
  isShortenedStated,
11
11
  parseProviderError,
12
12
  providerError
13
- } from "./chunk-BU3UOD2T.js";
13
+ } from "./chunk-SXYFFXHM.js";
14
14
  import {
15
15
  ApiErrorResponse,
16
16
  CacheError,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  appInvocationFetch
3
- } from "./chunk-B4JN2A6F.js";
3
+ } from "./chunk-MXFPSMNM.js";
4
4
  import {
5
5
  fromPromise,
6
6
  method,
7
7
  toPromise
8
- } from "./chunk-BU3UOD2T.js";
8
+ } from "./chunk-SXYFFXHM.js";
9
9
  import {
10
10
  CacheAcquired,
11
11
  CacheEntry,
@@ -20,7 +20,7 @@ import {
20
20
  captureTelemetry,
21
21
  owned,
22
22
  ownedBy
23
- } from "./chunk-T4MICYGT.js";
23
+ } from "./chunk-CQCY3OZS.js";
24
24
  import {
25
25
  Clock_exports,
26
26
  Duration_exports,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FetchHttpClient_exports
3
- } from "./chunk-2OGVSUNI.js";
3
+ } from "./chunk-GWFQCQB5.js";
4
4
  import {
5
5
  recordedMessage
6
6
  } from "./chunk-6XBOKQ4E.js";
@@ -25,7 +25,7 @@ import {
25
25
  text,
26
26
  transformResponse,
27
27
  uint8Array
28
- } from "./chunk-IWLFLMIL.js";
28
+ } from "./chunk-4XXHO5UG.js";
29
29
  import {
30
30
  Array as Array2,
31
31
  Boolean2 as Boolean,
@@ -2,11 +2,11 @@ import {
2
2
  declaredOperations,
3
3
  nativeOperation,
4
4
  nativeRouter
5
- } from "./chunk-455CCO6Q.js";
5
+ } from "./chunk-E2PVLAGK.js";
6
6
  import {
7
7
  fromPromise,
8
8
  method
9
- } from "./chunk-BU3UOD2T.js";
9
+ } from "./chunk-SXYFFXHM.js";
10
10
  import {
11
11
  EmittedEvent,
12
12
  EventName,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-OFSXKKD6.js";
3
+ } from "./chunk-PUMGAWHB.js";
4
4
  import {
5
5
  failOnNetworkRefusal
6
- } from "./chunk-B4JN2A6F.js";
6
+ } from "./chunk-MXFPSMNM.js";
7
7
  import {
8
8
  accountProviderError,
9
9
  bodyUpstreamError,
10
10
  fromPromise,
11
11
  httpProviderError,
12
12
  providerErrorDetail
13
- } from "./chunk-BU3UOD2T.js";
13
+ } from "./chunk-SXYFFXHM.js";
14
14
  import {
15
15
  AfterReply,
16
16
  ElicitationFailed,
@@ -38,17 +38,17 @@ import {
38
38
  import {
39
39
  captureTelemetry,
40
40
  owned
41
- } from "./chunk-T4MICYGT.js";
41
+ } from "./chunk-CQCY3OZS.js";
42
42
  import {
43
43
  FetchHttpClient_exports
44
- } from "./chunk-2OGVSUNI.js";
44
+ } from "./chunk-GWFQCQB5.js";
45
45
  import {
46
46
  JsonObject
47
47
  } from "./chunk-7A4ZSEM3.js";
48
48
  import {
49
49
  HttpClientRequest_exports,
50
50
  HttpClient_exports
51
- } from "./chunk-IWLFLMIL.js";
51
+ } from "./chunk-4XXHO5UG.js";
52
52
  import {
53
53
  Clock_exports,
54
54
  Deferred_exports,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  accountProviderError,
3
3
  fromPromise
4
- } from "./chunk-BU3UOD2T.js";
4
+ } from "./chunk-SXYFFXHM.js";
5
5
  import {
6
6
  HostedTool,
7
7
  HostedToolSummary,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getWithReads
3
- } from "./chunk-6NRWFVK2.js";
3
+ } from "./chunk-ALZDZ3ZT.js";
4
4
  import {
5
5
  fromPromise,
6
6
  method,
7
7
  toPromise
8
- } from "./chunk-BU3UOD2T.js";
8
+ } from "./chunk-SXYFFXHM.js";
9
9
  import {
10
10
  CacheError
11
11
  } from "./chunk-EXL6F456.js";
@@ -4,8 +4,8 @@ import {
4
4
  TransportError,
5
5
  fromWeb,
6
6
  layerMergedContext,
7
- make2 as make
8
- } from "./chunk-IWLFLMIL.js";
7
+ make
8
+ } from "./chunk-4XXHO5UG.js";
9
9
  import {
10
10
  Reference,
11
11
  Service,
@@ -0,0 +1,87 @@
1
+ // src/contracts/desktop.ts
2
+ var desktopPermissions = [
3
+ "menuBar",
4
+ "shortcuts",
5
+ "floating",
6
+ "startAtLogin",
7
+ "microphone",
8
+ "camera",
9
+ "systemAudio",
10
+ "clipboardRead",
11
+ "notifications"
12
+ ];
13
+ var desktopMenuBarTitleMaxLength = 24;
14
+ var desktopBadgeMaximum = 99999;
15
+ var desktopMaximumWindows = 8;
16
+ var desktopWindowSize = { minimum: 200, maximum: 4096 };
17
+ var desktopAppBridgeGlobal = "__executorDesktop";
18
+ var desktopShortcutEvent = "executor:desktop-shortcut";
19
+ var desktopWindowEvent = "executor:desktop-window";
20
+ var desktopBridgeVersion = 1;
21
+ var desktopNotificationPathKey = "path";
22
+ var desktopHostBridgeGlobal = "__executorDesktopHost";
23
+ var executorServerIdentityPath = "/.well-known/executor";
24
+ var desktopLinkProtocol = "executor";
25
+ var installHost = "install";
26
+ var appIdPattern = /^app_[A-Za-z0-9_-]{1,124}$/u;
27
+ var organizationIdPattern = /^[A-Za-z0-9_-]{1,128}$/u;
28
+ var labelPattern = /^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]{1,80}$/u;
29
+ var loopbackHostname = (hostname) => hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "[::1]" || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/u.test(hostname);
30
+ var dashboardOrigin = (value) => {
31
+ const url = URL.parse(value);
32
+ if (url === null || url.origin !== value) return void 0;
33
+ if (url.protocol === "https:") return url.origin;
34
+ return url.protocol === "http:" && loopbackHostname(url.hostname) ? url.origin : void 0;
35
+ };
36
+ var desktopInstallLink = (link) => {
37
+ const params = new URLSearchParams({ server: link.server, app: link.app });
38
+ if (link.organization !== void 0) params.set("org", link.organization);
39
+ if (link.name !== void 0 && labelPattern.test(link.name)) params.set("name", link.name);
40
+ if (link.team !== void 0 && labelPattern.test(link.team)) params.set("team", link.team);
41
+ const value = `${desktopLinkProtocol}://${installHost}?${params.toString()}`;
42
+ return parseDesktopInstallLink(value) === void 0 ? void 0 : value;
43
+ };
44
+ var parseDesktopInstallLink = (value) => {
45
+ const url = URL.parse(value);
46
+ if (url === null || url.protocol !== `${desktopLinkProtocol}:` || url.hostname !== installHost || url.username !== "" || url.password !== "" || url.port !== "" || url.hash !== "" || url.pathname !== "" && url.pathname !== "/")
47
+ return void 0;
48
+ const keys = [...url.searchParams.keys()];
49
+ const allowed = ["server", "app", "org", "name", "team"];
50
+ if (new Set(keys).size !== keys.length || keys.some((key) => !allowed.includes(key)) || !keys.includes("server") || !keys.includes("app"))
51
+ return void 0;
52
+ const server = dashboardOrigin(url.searchParams.get("server") ?? "");
53
+ const app = url.searchParams.get("app") ?? "";
54
+ const organization = url.searchParams.get("org");
55
+ const name = url.searchParams.get("name");
56
+ const team = url.searchParams.get("team");
57
+ if (server === void 0 || !appIdPattern.test(app)) return void 0;
58
+ if (organization !== null && !organizationIdPattern.test(organization)) return void 0;
59
+ if (name !== null && !labelPattern.test(name) || team !== null && !labelPattern.test(team))
60
+ return void 0;
61
+ return {
62
+ server,
63
+ app,
64
+ ...organization === null ? {} : { organization },
65
+ ...name === null ? {} : { name },
66
+ ...team === null ? {} : { team }
67
+ };
68
+ };
69
+
70
+ export {
71
+ desktopPermissions,
72
+ desktopMenuBarTitleMaxLength,
73
+ desktopBadgeMaximum,
74
+ desktopMaximumWindows,
75
+ desktopWindowSize,
76
+ desktopAppBridgeGlobal,
77
+ desktopShortcutEvent,
78
+ desktopWindowEvent,
79
+ desktopBridgeVersion,
80
+ desktopNotificationPathKey,
81
+ desktopHostBridgeGlobal,
82
+ executorServerIdentityPath,
83
+ desktopLinkProtocol,
84
+ loopbackHostname,
85
+ desktopInstallLink,
86
+ parseDesktopInstallLink
87
+ };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-6OWHQINS.js";
3
+ } from "./chunk-63BS5GBH.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
7
7
  routerDeclaration
8
- } from "./chunk-455CCO6Q.js";
8
+ } from "./chunk-E2PVLAGK.js";
9
9
 
10
10
  // src/implementation/protocol-operations.ts
11
11
  var protocolOperations = (operations, kinds = {}) => {
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-EXL6F456.js";
9
9
  import {
10
10
  invocationFetch
11
- } from "./chunk-T4MICYGT.js";
11
+ } from "./chunk-CQCY3OZS.js";
12
12
  import {
13
13
  Effect_exports,
14
14
  Schema_exports
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  appSignInCallbackPath
3
- } from "./chunk-BHSWVS3Q.js";
3
+ } from "./chunk-UT2CBMW3.js";
4
4
  import {
5
5
  HttpServerResponse_exports
6
- } from "./chunk-IWLFLMIL.js";
6
+ } from "./chunk-4XXHO5UG.js";
7
7
 
8
8
  // src/implementation/ui-auth.ts
9
9
  var appPrivateHeaders = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  authorCache,
3
3
  unavailableCache
4
- } from "./chunk-6NRWFVK2.js";
4
+ } from "./chunk-ALZDZ3ZT.js";
5
5
  import {
6
6
  accountSecrets,
7
7
  boundFailureMessage,
@@ -12,10 +12,10 @@ import {
12
12
  parseSkillLoadFailed,
13
13
  readCatalog,
14
14
  routerSkills
15
- } from "./chunk-6OWHQINS.js";
15
+ } from "./chunk-63BS5GBH.js";
16
16
  import {
17
17
  appInvocationFetch
18
- } from "./chunk-B4JN2A6F.js";
18
+ } from "./chunk-MXFPSMNM.js";
19
19
  import {
20
20
  folderSkillsEffect
21
21
  } from "./chunk-XR7KZNKD.js";
@@ -26,12 +26,12 @@ import {
26
26
  makeEmitter,
27
27
  toEffectApp,
28
28
  withPlacements
29
- } from "./chunk-QDF7PQAD.js";
29
+ } from "./chunk-CWAPV2TN.js";
30
30
  import {
31
31
  declaredOperations,
32
32
  locate,
33
33
  nativeOperation
34
- } from "./chunk-455CCO6Q.js";
34
+ } from "./chunk-E2PVLAGK.js";
35
35
  import {
36
36
  accountProviderError,
37
37
  appCode,
@@ -39,7 +39,7 @@ import {
39
39
  httpProviderError,
40
40
  parseProviderError,
41
41
  toPromise
42
- } from "./chunk-BU3UOD2T.js";
42
+ } from "./chunk-SXYFFXHM.js";
43
43
  import {
44
44
  AccountCheckResult,
45
45
  AfterReply,
@@ -119,7 +119,7 @@ import {
119
119
  makeOwnershipAccounting,
120
120
  measuredSpan,
121
121
  owned
122
- } from "./chunk-T4MICYGT.js";
122
+ } from "./chunk-CQCY3OZS.js";
123
123
  import {
124
124
  JsonObject,
125
125
  JsonValue
@@ -1,3 +1,11 @@
1
+ import {
2
+ desktopAppBridgeGlobal,
3
+ desktopBadgeMaximum,
4
+ desktopBridgeVersion,
5
+ desktopMenuBarTitleMaxLength,
6
+ desktopShortcutEvent,
7
+ desktopWindowEvent
8
+ } from "./chunk-HEFJFDU4.js";
1
9
  import {
2
10
  Boolean,
3
11
  Cause,
@@ -5,6 +13,7 @@ import {
5
13
  Defect,
6
14
  Int,
7
15
  InvalidType,
16
+ Match_exports,
8
17
  MixedScheduler,
9
18
  Never2 as Never,
10
19
  NoSuchElementError,
@@ -13,6 +22,7 @@ import {
13
22
  PipeInspectableProto,
14
23
  Pointer,
15
24
  Scheduler,
25
+ Schema_exports,
16
26
  Scope,
17
27
  Service,
18
28
  TaggedError,
@@ -2714,10 +2724,266 @@ var queryCommitted = (result) => {
2714
2724
  commits.get(result)?.();
2715
2725
  };
2716
2726
 
2727
+ // src/contracts/desktop-errors.ts
2728
+ var DesktopPermissionName = Schema_exports.Literals([
2729
+ "menuBar",
2730
+ "shortcuts",
2731
+ "floating",
2732
+ "startAtLogin",
2733
+ "microphone",
2734
+ "camera",
2735
+ "systemAudio",
2736
+ "clipboardRead",
2737
+ "notifications"
2738
+ ]);
2739
+ var permissionDeniedFields = { permission: DesktopPermissionName };
2740
+ var shortcutTakenFields = { accelerator: Schema_exports.String };
2741
+ var invalidInputFields = { message: Schema_exports.String };
2742
+ var DesktopUnavailable = class extends Schema_exports.TaggedError()(
2743
+ "DesktopUnavailable",
2744
+ {}
2745
+ ) {
2746
+ };
2747
+ var DesktopPermissionDenied = class extends Schema_exports.TaggedError()(
2748
+ "DesktopPermissionDenied",
2749
+ permissionDeniedFields
2750
+ ) {
2751
+ };
2752
+ var ShortcutTaken = class extends Schema_exports.TaggedError()(
2753
+ "ShortcutTaken",
2754
+ shortcutTakenFields
2755
+ ) {
2756
+ };
2757
+ var DesktopInvalidInput = class extends Schema_exports.TaggedError()(
2758
+ "DesktopInvalidInput",
2759
+ invalidInputFields
2760
+ ) {
2761
+ };
2762
+ var SystemAudioBlocked = class extends Schema_exports.TaggedError()(
2763
+ "SystemAudioBlocked",
2764
+ {}
2765
+ ) {
2766
+ };
2767
+ var DesktopBridgeRejection = Schema_exports.Union([
2768
+ Schema_exports.TaggedStruct("DesktopUnavailable", {}),
2769
+ Schema_exports.TaggedStruct("DesktopPermissionDenied", permissionDeniedFields),
2770
+ Schema_exports.TaggedStruct("ShortcutTaken", shortcutTakenFields),
2771
+ Schema_exports.TaggedStruct("DesktopInvalidInput", invalidInputFields),
2772
+ Schema_exports.TaggedStruct("SystemAudioBlocked", {})
2773
+ ]);
2774
+
2775
+ // src/implementation/desktop.ts
2776
+ var bridgeMethods = [
2777
+ "permission",
2778
+ "requestPermission",
2779
+ "setMenuBarTitle",
2780
+ "registerShortcut",
2781
+ "unregisterShortcut",
2782
+ "setFloating",
2783
+ "windowAction",
2784
+ "openWindow",
2785
+ "setBadge",
2786
+ "systemAudio"
2787
+ ];
2788
+ var isBridge = (value2) => typeof value2 === "object" && value2 !== null && Reflect.get(value2, "version") === desktopBridgeVersion && bridgeMethods.every((method) => typeof Reflect.get(value2, method) === "function");
2789
+ var currentBridge = () => {
2790
+ const value2 = typeof window === "undefined" ? void 0 : Reflect.get(window, desktopAppBridgeGlobal);
2791
+ return isBridge(value2) ? value2 : void 0;
2792
+ };
2793
+ var decodeRejection = Schema_exports.decodeUnknownOption(DesktopBridgeRejection);
2794
+ var typedRejection = (reason) => Option_exports.match(decodeRejection(reason), {
2795
+ onNone: () => reason,
2796
+ onSome: Match_exports.valueTags({
2797
+ DesktopUnavailable: () => new DesktopUnavailable(),
2798
+ DesktopPermissionDenied: ({ permission }) => new DesktopPermissionDenied({ permission }),
2799
+ ShortcutTaken: ({ accelerator }) => new ShortcutTaken({ accelerator }),
2800
+ DesktopInvalidInput: ({ message }) => new DesktopInvalidInput({ message }),
2801
+ SystemAudioBlocked: () => new SystemAudioBlocked()
2802
+ })
2803
+ });
2804
+ var call = async (run) => {
2805
+ const bridge = currentBridge();
2806
+ if (bridge === void 0) throw new DesktopUnavailable();
2807
+ try {
2808
+ return await run(bridge);
2809
+ } catch (reason) {
2810
+ throw typedRejection(reason);
2811
+ }
2812
+ };
2813
+ var shortcutsByBridge = /* @__PURE__ */ new WeakMap();
2814
+ var heldShortcuts = (bridge) => {
2815
+ const held = shortcutsByBridge.get(bridge) ?? /* @__PURE__ */ new Set();
2816
+ shortcutsByBridge.set(bridge, held);
2817
+ return held;
2818
+ };
2819
+ var invalid = (message) => Promise.reject(new DesktopInvalidInput({ message }));
2820
+ var windowEventType = (event) => {
2821
+ if (!(event instanceof CustomEvent)) return void 0;
2822
+ const detail = event.detail;
2823
+ if (typeof detail !== "object" || detail === null) return void 0;
2824
+ const type = Reflect.get(detail, "type");
2825
+ return type === "focus" || type === "blur" ? type : void 0;
2826
+ };
2827
+ var onWindowEvent = (type, handler) => {
2828
+ if (currentBridge() === void 0) return () => void 0;
2829
+ const listener = (event) => {
2830
+ if (windowEventType(event) === type) handler();
2831
+ };
2832
+ window.addEventListener(desktopWindowEvent, listener);
2833
+ return () => window.removeEventListener(desktopWindowEvent, listener);
2834
+ };
2835
+ var displayAudio = async (bridge) => {
2836
+ await bridge.systemAudio();
2837
+ const stream2 = await navigator.mediaDevices.getDisplayMedia({ audio: true, video: true }).catch(async (reason) => {
2838
+ await bridge.systemAudio();
2839
+ throw reason;
2840
+ });
2841
+ for (const track of stream2.getVideoTracks()) {
2842
+ track.stop();
2843
+ stream2.removeTrack(track);
2844
+ }
2845
+ if (stream2.getAudioTracks().length === 0) throw new DesktopUnavailable();
2846
+ return stream2;
2847
+ };
2848
+ var shortcutId = (event) => {
2849
+ if (!(event instanceof CustomEvent)) return void 0;
2850
+ const detail = event.detail;
2851
+ if (typeof detail !== "object" || detail === null) return void 0;
2852
+ const id = Reflect.get(detail, "id");
2853
+ return typeof id === "string" ? id : void 0;
2854
+ };
2855
+ var desktop = {
2856
+ /** Whether this page is in an installed Executor desktop window. */
2857
+ get available() {
2858
+ return currentBridge() !== void 0;
2859
+ },
2860
+ /** The person's choice for one capability, without asking them. */
2861
+ permission: (name) => currentBridge() === void 0 ? Promise.resolve("unavailable") : call((bridge) => bridge.permission(name)),
2862
+ /**
2863
+ * Ask the person for one capability now, if they have not answered yet, and resolve their
2864
+ * choice; a refusal resolves `"denied"` rather than rejecting. Use it for `startAtLogin`, which
2865
+ * no other call asks for, or to ask for the microphone before a recording starts.
2866
+ */
2867
+ requestPermission: (name) => currentBridge() === void 0 ? Promise.resolve("unavailable") : call((bridge) => bridge.requestPermission(name)),
2868
+ menuBar: {
2869
+ /**
2870
+ * Show plain text for the app in the menu bar, at most `desktopMenuBarTitleMaxLength`
2871
+ * characters. `null` restores the app's name. Needs the `menuBar` permission.
2872
+ */
2873
+ setTitle: (text) => call(
2874
+ (bridge) => text !== null && text.length > desktopMenuBarTitleMaxLength ? Promise.reject(
2875
+ new DesktopInvalidInput({
2876
+ message: `A menu-bar title can be at most ${desktopMenuBarTitleMaxLength} characters.`
2877
+ })
2878
+ ) : bridge.setMenuBarTitle(text)
2879
+ )
2880
+ },
2881
+ shortcuts: {
2882
+ /**
2883
+ * Call `handler` whenever the person presses `accelerator` anywhere on their computer, in
2884
+ * Electron accelerator syntax such as `"CommandOrControl+Shift+K"`. Resolves a function that
2885
+ * removes the shortcut through the desktop window that registered it. The shortcut stays held,
2886
+ * and `handler` keeps running, until that function resolves; when it rejects, call it again.
2887
+ * Needs the `shortcuts` permission; rejects with `ShortcutTaken` when another program holds
2888
+ * the keys.
2889
+ */
2890
+ register: (accelerator, handler) => call(async (bridge) => {
2891
+ const { id } = await bridge.registerShortcut(accelerator);
2892
+ const held = heldShortcuts(bridge);
2893
+ if (held.has(id))
2894
+ throw new Error(
2895
+ `The desktop gave the shortcut ${accelerator} the ID ${id}, which another registration in this page already holds.`
2896
+ );
2897
+ held.add(id);
2898
+ const listener = (event) => {
2899
+ if (shortcutId(event) === id) handler();
2900
+ };
2901
+ window.addEventListener(desktopShortcutEvent, listener);
2902
+ let removal;
2903
+ let removed = false;
2904
+ const unregister = async () => {
2905
+ try {
2906
+ await bridge.unregisterShortcut(id);
2907
+ } catch (reason) {
2908
+ throw typedRejection(reason);
2909
+ } finally {
2910
+ removal = void 0;
2911
+ }
2912
+ removed = true;
2913
+ held.delete(id);
2914
+ window.removeEventListener(desktopShortcutEvent, listener);
2915
+ };
2916
+ return () => {
2917
+ if (removed) return Promise.resolve();
2918
+ removal ??= unregister();
2919
+ return removal;
2920
+ };
2921
+ })
2922
+ },
2923
+ window: {
2924
+ /** Keep the app's window above other windows, or stop. Needs the `floating` permission. */
2925
+ setFloating: (on) => call((bridge) => bridge.setFloating(on)),
2926
+ /** Make the window this page is in visible. */
2927
+ show: () => call((bridge) => bridge.windowAction("show")),
2928
+ /** Hide the window this page is in. The app keeps running, and its page keeps running. */
2929
+ hide: () => call((bridge) => bridge.windowAction("hide")),
2930
+ /**
2931
+ * Show the window this page is in and bring it in front of every other app's windows, such as
2932
+ * from a global shortcut's handler.
2933
+ */
2934
+ focus: () => call((bridge) => bridge.windowAction("focus")),
2935
+ /** Hide the window when it is visible and focused; otherwise show and focus it. */
2936
+ toggle: () => call((bridge) => bridge.windowAction("toggle")),
2937
+ /**
2938
+ * Open another window of this app at `path`, such as `"/compose?to=ada"`, on the app's own
2939
+ * origin, or focus the window that already shows that path. The window has `desktop` too, with
2940
+ * the same permissions, and closes when the app quits. At most `desktopMaximumWindows` are
2941
+ * open at once; `floating` needs the `floating` permission.
2942
+ */
2943
+ open: (path, options = {}) => call(
2944
+ (bridge) => path.startsWith("/") && !path.startsWith("//") ? bridge.openWindow(path, options) : invalid(`${path} is not a path on this app, such as /notes/42.`)
2945
+ ),
2946
+ /**
2947
+ * Call `handler` whenever the window this page is in loses focus, such as to hide a window a
2948
+ * shortcut summoned. Returns a function that stops listening. Does nothing outside an
2949
+ * installed Executor desktop window.
2950
+ */
2951
+ onBlur: (handler) => onWindowEvent("blur", handler),
2952
+ /** Call `handler` whenever the window this page is in gains focus. */
2953
+ onFocus: (handler) => onWindowEvent("focus", handler)
2954
+ },
2955
+ badge: {
2956
+ /**
2957
+ * Show a count on the app's icon: on Windows, on the app's own taskbar button; on macOS and
2958
+ * Linux, installed apps share Executor's Dock or launcher icon, which shows the sum of their
2959
+ * counts. `null` or 0 removes the app's count. Needs no permission.
2960
+ */
2961
+ set: (count) => call(
2962
+ (bridge) => count === null || Number.isInteger(count) && count >= 0 && count <= desktopBadgeMaximum ? bridge.setBadge(count) : invalid(`A badge is a whole number from 0 to ${desktopBadgeMaximum}.`)
2963
+ )
2964
+ },
2965
+ audio: {
2966
+ /**
2967
+ * Everything playing on this computer, such as the other people in a call, as an audio-only
2968
+ * `MediaStream`. Asks for the `systemAudio` permission the first time. Rejects with
2969
+ * `SystemAudioBlocked` when macOS has not allowed Executor to record the screen and system
2970
+ * audio, after offering to open System Settings, and with `DesktopUnavailable` where the
2971
+ * computer cannot capture system audio (Linux, macOS before 13). Stop its tracks when done.
2972
+ */
2973
+ system: () => call(displayAudio)
2974
+ }
2975
+ };
2976
+
2717
2977
  export {
2718
2978
  AsyncResult_exports,
2719
2979
  AtomRegistry_exports,
2720
2980
  Atom_exports,
2721
2981
  queryResult,
2722
- queryCommitted
2982
+ queryCommitted,
2983
+ DesktopUnavailable,
2984
+ DesktopPermissionDenied,
2985
+ ShortcutTaken,
2986
+ DesktopInvalidInput,
2987
+ SystemAudioBlocked,
2988
+ desktop
2723
2989
  };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-EXL6F456.js";
5
5
  import {
6
6
  owned
7
- } from "./chunk-T4MICYGT.js";
7
+ } from "./chunk-CQCY3OZS.js";
8
8
  import {
9
9
  AccountId
10
10
  } from "./chunk-7A4ZSEM3.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ appMenuBarRoute
3
+ } from "./chunk-ZWFMEH2Y.js";
1
4
  import {
2
5
  Schema_exports
3
6
  } from "./chunk-NXEGROI6.js";
@@ -16,7 +19,7 @@ var AppReturnPath = Schema_exports.String.check(
16
19
  return false;
17
20
  try {
18
21
  const url = new URL(value, "https://app.invalid");
19
- return url.origin === "https://app.invalid" && !/^\/(?:_executor|dashboard|auth|v1|mcp)(?:\/|$)/.test(decodeURIComponent(url.pathname));
22
+ return url.origin === "https://app.invalid" && (url.pathname === appMenuBarRoute || !/^\/(?:_executor|dashboard|auth|v1|mcp)(?:\/|$)/.test(decodeURIComponent(url.pathname)));
20
23
  } catch {
21
24
  return false;
22
25
  }