@allyhub/sdk 0.9.0 → 0.10.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/node_modules/@allyhub/audio/package.json +1 -1
  3. package/dist/node_modules/@allyhub/chart/dist/chart-xml.d.ts +3 -0
  4. package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
  5. package/dist/node_modules/@allyhub/chart/dist/chart.d.ts +22 -0
  6. package/dist/node_modules/@allyhub/chart/dist/chart.js +1 -1
  7. package/dist/node_modules/@allyhub/chart/package.json +1 -1
  8. package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
  9. package/dist/node_modules/@allyhub/formats/dist/data/faces.d.ts +1 -1
  10. package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +87 -1
  11. package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
  12. package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +89 -0
  13. package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
  14. package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +50 -0
  15. package/dist/node_modules/@allyhub/formats/package.json +1 -1
  16. package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
  17. package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
  18. package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
  19. package/dist/node_modules/@allyhub/measure/package.json +1 -1
  20. package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
  21. package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
  22. package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +16 -0
  23. package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
  24. package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +6 -0
  25. package/dist/node_modules/@allyhub/piece/package.json +1 -1
  26. package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +132 -0
  27. package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
  28. package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
  29. package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
  30. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.d.ts +337 -0
  31. package/dist/node_modules/@allyhub/protocol/dist/browser-bridge.js +2 -0
  32. package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +153 -0
  33. package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
  34. package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +4 -2
  35. package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
  36. package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +43 -188
  37. package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
  38. package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +1 -0
  39. package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
  40. package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +1 -0
  41. package/dist/node_modules/@allyhub/protocol/dist/mail.js +1 -1
  42. package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +51 -91
  43. package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
  44. package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +3 -3
  45. package/dist/node_modules/@allyhub/protocol/package.json +5 -1
  46. package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
  47. package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
  48. package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
  49. package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
  50. package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
  51. package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
  52. package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
  53. package/dist/node_modules/@allyhub/scenery/package.json +1 -1
  54. package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
  55. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.d.ts +70 -0
  56. package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
  57. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.d.ts +6 -0
  58. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
  59. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
  60. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.d.ts +3 -1
  61. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/define.js +1 -1
  62. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
  63. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/kernels.js +1 -1
  64. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
  65. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/maths.js +1 -1
  66. package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
  67. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.d.ts +9 -0
  68. package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
  69. package/dist/node_modules/@allyhub/sheet/dist/calc/types.d.ts +6 -0
  70. package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
  71. package/dist/node_modules/@allyhub/sheet/dist/chart.d.ts +9 -0
  72. package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
  73. package/dist/node_modules/@allyhub/sheet/dist/formula/ast.d.ts +12 -1
  74. package/dist/node_modules/@allyhub/sheet/dist/formula/move.d.ts +5 -1
  75. package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
  76. package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
  77. package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
  78. package/dist/node_modules/@allyhub/sheet/dist/index.d.ts +2 -1
  79. package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
  80. package/dist/node_modules/@allyhub/sheet/dist/inspect.d.ts +12 -2
  81. package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
  82. package/dist/node_modules/@allyhub/sheet/dist/printed.d.ts +19 -0
  83. package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
  84. package/dist/node_modules/@allyhub/sheet/dist/values.d.ts +2 -0
  85. package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
  86. package/dist/node_modules/@allyhub/sheet/dist/workbook.d.ts +2 -0
  87. package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
  88. package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
  89. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.d.ts +6 -2
  90. package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
  91. package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
  92. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.d.ts +0 -1
  93. package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
  94. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.d.ts +3 -1
  95. package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
  96. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.d.ts +7 -1
  97. package/dist/node_modules/@allyhub/sheet/dist/xlsx/sax.js +3 -1
  98. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.d.ts +6 -0
  99. package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
  100. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.d.ts +1 -1
  101. package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
  102. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.d.ts +12 -1
  103. package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.js +3 -2
  104. package/dist/node_modules/@allyhub/sheet/package.json +1 -1
  105. package/dist/node_modules/@allyhub/slides-core/dist/api.d.ts +57 -7
  106. package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
  107. package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
  108. package/dist/node_modules/@allyhub/slides-core/dist/enums.d.ts +24 -0
  109. package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
  110. package/dist/node_modules/@allyhub/slides-core/dist/fact.d.ts +15 -0
  111. package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
  112. package/dist/node_modules/@allyhub/slides-core/dist/model.d.ts +6 -2
  113. package/dist/node_modules/@allyhub/slides-core/dist/resolve.d.ts +3 -1
  114. package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
  115. package/dist/node_modules/@allyhub/slides-core/dist/sdk.d.ts +1 -1
  116. package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
  117. package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
  118. package/dist/node_modules/@allyhub/video-core/dist/piece.d.ts +2 -2
  119. package/dist/node_modules/@allyhub/video-core/dist/schema.d.ts +2 -2
  120. package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
  121. package/dist/node_modules/@allyhub/video-core/package.json +1 -1
  122. package/dist/node_modules/@allyhub/video-sdk/dist/phone.d.ts +12 -5
  123. package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +1 -1
  124. package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
  125. package/docs/README.md +2 -0
  126. package/docs/canvas.md +28 -0
  127. package/docs/defaults.md +20 -2
  128. package/docs/docs.md +8 -8
  129. package/docs/scenery.md +3 -4
  130. package/docs/sheets.md +22 -5
  131. package/docs/slides.md +50 -4
  132. package/docs/speech.md +1 -1
  133. package/docs/x.md +73 -0
  134. package/package.json +1 -1
@@ -0,0 +1,337 @@
1
+ import { z } from "zod";
2
+ /** The version of these messages; `bridge/hello` carries each end's. */
3
+ export declare const BRIDGE_PROTOCOL = 1;
4
+ /** The native messaging host Studio installs, by the name Chrome knows it. */
5
+ export declare const BRIDGE_NATIVE_HOST = "com.allyhub.browser";
6
+ /**
7
+ * What an agent names the person's own browser by when it does not care
8
+ * which (`ALLYHUB_BROWSER=person`): their default one if it is connected,
9
+ * else the one connected.
10
+ */
11
+ export declare const PERSON_BROWSER = "person";
12
+ /** Where a Host's door takes the extension's WebSocket (behind a cloud Studio's gateway, with a ticket). */
13
+ export declare const BRIDGE_PATH = "/browser";
14
+ /**
15
+ * The extension's IDs: the store's (v1's listing, which carries the
16
+ * bridge beside v1's features) and the development build's, fixed by the
17
+ * `key` in its manifest. A native host's manifest names both; a Host's
18
+ * door lets in only their origins.
19
+ */
20
+ export declare const BRIDGE_EXTENSION_IDS: {
21
+ readonly store: "pmckbhaedjblcbkbkcbmmogpealiaeol";
22
+ readonly development: "dbmenjkebdgjkhjdcicplkaakmjcjhdp";
23
+ };
24
+ /** Where a person installs the extension (Chrome's store; Edge, Brave, Arc and the others install from it too). */
25
+ export declare const BRIDGE_STORE_URL: string;
26
+ /** The origins a Host's door accepts the extension's WebSocket from. */
27
+ export declare const BRIDGE_EXTENSION_ORIGINS: readonly string[];
28
+ /**
29
+ * The pages that may hand the extension a ticket to a cloud Studio (its
30
+ * `externally_connectable`): AllyHub's window, production's and staging's.
31
+ * Never `*.allyhub.studio`, which serves projects' code.
32
+ */
33
+ export declare const BRIDGE_WINDOW_ORIGINS: readonly ["https://app.allyhub.com", "https://app.allyhub-staging.com"];
34
+ /** The domains a cloud Studio's Host is reached under (its gateway's), production's and staging's. */
35
+ export declare const BRIDGE_STUDIO_DOMAINS: readonly ["allyhub.studio", "allyhub-studio-staging.com"];
36
+ /** What AllyHub's window asks the extension (`chrome.runtime.sendMessage` to it). */
37
+ export declare const BridgeWindowMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
38
+ type: z.ZodLiteral<"allyhub/bridge/status">;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ type: z.ZodLiteral<"allyhub/bridge/connect">;
41
+ url: z.ZodString;
42
+ }, z.core.$strip>], "type">;
43
+ export type BridgeWindowMessage = z.infer<typeof BridgeWindowMessageSchema>;
44
+ /** The extension's answer to the window. */
45
+ export declare const BridgeWindowAnswerSchema: z.ZodObject<{
46
+ version: z.ZodString;
47
+ connected: z.ZodArray<z.ZodString>;
48
+ error: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>;
50
+ export type BridgeWindowAnswer = z.infer<typeof BridgeWindowAnswerSchema>;
51
+ /**
52
+ * The address the extension may connect to, a window gave it: a cloud
53
+ * Studio's door (`wss://<sandbox>.allyhub.studio/browser`), never another
54
+ * server; a development build, a Host on this computer too, named
55
+ * `localhost`, `127.0.0.1` or any `*.localhost` (`cloud:local` reaches a
56
+ * Host as `<sandbox>.studio.localhost`). `undefined` for any other.
57
+ *
58
+ * Read by the URL parser, not a pattern: what it returns is the address
59
+ * the extension connects to, so a spelling a pattern reads apart from the
60
+ * parser (a backslash, an encoded slash) cannot reach another server.
61
+ */
62
+ export declare function bridgeTarget(url: string, development: boolean): URL | undefined;
63
+ /**
64
+ * The largest message Chrome passes from a native host to its extension
65
+ * is 1 MB; the other way, 64 MiB. A Host splits what it sends over native
66
+ * messaging into parts well under that (`splitNative`), and the extension
67
+ * puts them together again (`NativeParts`).
68
+ */
69
+ export declare const NATIVE_PART_CHARS: number;
70
+ /** Browsers the extension runs in, by their product. */
71
+ export declare const BROWSER_PRODUCTS: readonly ["chrome", "edge", "brave", "arc", "opera", "vivaldi", "chromium"];
72
+ export declare const BrowserProductSchema: z.ZodUnion<readonly [z.ZodEnum<{
73
+ chrome: "chrome";
74
+ edge: "edge";
75
+ brave: "brave";
76
+ arc: "arc";
77
+ opera: "opera";
78
+ vivaldi: "vivaldi";
79
+ chromium: "chromium";
80
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
81
+ export type BrowserProduct = z.infer<typeof BrowserProductSchema>;
82
+ /** How a browser is called to a person. */
83
+ export declare const BROWSER_PRODUCT_NAMES: Record<(typeof BROWSER_PRODUCTS)[number], string>;
84
+ /** A browser's name for a person: its product's, or the word itself for one this version does not know. */
85
+ export declare const browserName: (product: string) => string;
86
+ /** The extension says who it is, first, on every connection. */
87
+ export declare const BridgeHelloSchema: z.ZodObject<{
88
+ protocol: z.ZodInt;
89
+ extension: z.ZodObject<{
90
+ id: z.ZodString;
91
+ version: z.ZodString;
92
+ }, z.core.$strip>;
93
+ browser: z.ZodObject<{
94
+ id: z.ZodString;
95
+ product: z.ZodUnion<readonly [z.ZodEnum<{
96
+ chrome: "chrome";
97
+ edge: "edge";
98
+ brave: "brave";
99
+ arc: "arc";
100
+ opera: "opera";
101
+ vivaldi: "vivaldi";
102
+ chromium: "chromium";
103
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
104
+ version: z.ZodString;
105
+ userAgent: z.ZodString;
106
+ }, z.core.$strip>;
107
+ }, z.core.$strip>;
108
+ export type BridgeHello = z.infer<typeof BridgeHelloSchema>;
109
+ /** The Host's answer: who it is, so the extension can name it. */
110
+ export declare const BridgeWelcomeSchema: z.ZodObject<{
111
+ protocol: z.ZodInt;
112
+ host: z.ZodObject<{
113
+ name: z.ZodString;
114
+ remote: z.ZodBoolean;
115
+ }, z.core.$strip>;
116
+ }, z.core.$strip>;
117
+ export type BridgeWelcome = z.infer<typeof BridgeWelcomeSchema>;
118
+ /** A tab, as `chrome.tabs` describes it, and only what the Host uses. */
119
+ export declare const BridgeTabSchema: z.ZodObject<{
120
+ tabId: z.ZodInt;
121
+ windowId: z.ZodOptional<z.ZodInt>;
122
+ url: z.ZodOptional<z.ZodString>;
123
+ title: z.ZodOptional<z.ZodString>;
124
+ openerTabId: z.ZodOptional<z.ZodInt>;
125
+ active: z.ZodOptional<z.ZodBoolean>;
126
+ status: z.ZodOptional<z.ZodString>;
127
+ }, z.core.$strip>;
128
+ export type BridgeTab = z.infer<typeof BridgeTabSchema>;
129
+ /**
130
+ * A group of the agent's tabs: a Chrome tab group per project, named for
131
+ * it. `key` is the Host's, the same for the same project.
132
+ */
133
+ export declare const BridgeGroupSchema: z.ZodObject<{
134
+ key: z.ZodString;
135
+ title: z.ZodString;
136
+ }, z.core.$strip>;
137
+ export type BridgeGroup = z.infer<typeof BridgeGroupSchema>;
138
+ /** Why Chrome let go of a tab (`chrome.debugger.onDetach`'s reasons, and the extension's own). */
139
+ export declare const DETACH_REASONS: readonly ["target_closed", "canceled_by_user", "not_allowed", "released"];
140
+ export declare const DetachReasonSchema: z.ZodUnion<readonly [z.ZodEnum<{
141
+ target_closed: "target_closed";
142
+ canceled_by_user: "canceled_by_user";
143
+ not_allowed: "not_allowed";
144
+ released: "released";
145
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
146
+ /** A CDP command for a tab: the tab's own session, or a child's (a frame in another process, a worker). */
147
+ export declare const BridgeCdpSchema: z.ZodObject<{
148
+ tabId: z.ZodInt;
149
+ sessionId: z.ZodOptional<z.ZodString>;
150
+ method: z.ZodString;
151
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
152
+ }, z.core.$strip>;
153
+ /** What the Host asks of the extension. */
154
+ export declare const BRIDGE_EXTENSION_METHODS: {
155
+ readonly "tabs/create": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
156
+ group: z.ZodObject<{
157
+ key: z.ZodString;
158
+ title: z.ZodString;
159
+ }, z.core.$strip>;
160
+ url: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strip>, z.ZodObject<{
162
+ tabId: z.ZodInt;
163
+ windowId: z.ZodOptional<z.ZodInt>;
164
+ url: z.ZodOptional<z.ZodString>;
165
+ title: z.ZodOptional<z.ZodString>;
166
+ openerTabId: z.ZodOptional<z.ZodInt>;
167
+ active: z.ZodOptional<z.ZodBoolean>;
168
+ status: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$strip>>;
170
+ readonly "tabs/close": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
171
+ tabId: z.ZodInt;
172
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
173
+ readonly "tabs/activate": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
174
+ tabId: z.ZodInt;
175
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
176
+ readonly "debugger/attach": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
177
+ tabId: z.ZodInt;
178
+ group: z.ZodObject<{
179
+ key: z.ZodString;
180
+ title: z.ZodString;
181
+ }, z.core.$strip>;
182
+ }, z.core.$strip>, z.ZodObject<{
183
+ targetInfo: z.ZodRecord<z.ZodString, z.ZodUnknown>;
184
+ }, z.core.$strip>>;
185
+ readonly "debugger/detach": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
186
+ tabId: z.ZodInt;
187
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
188
+ readonly "debugger/send": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
189
+ tabId: z.ZodInt;
190
+ sessionId: z.ZodOptional<z.ZodString>;
191
+ method: z.ZodString;
192
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
193
+ }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
194
+ readonly "groups/release": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
195
+ key: z.ZodString;
196
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>;
197
+ };
198
+ /** What the extension asks of the Host. */
199
+ export declare const BRIDGE_HOST_METHODS: {
200
+ readonly "bridge/hello": import("./jsonrpc.js").MethodSpec<z.ZodObject<{
201
+ protocol: z.ZodInt;
202
+ extension: z.ZodObject<{
203
+ id: z.ZodString;
204
+ version: z.ZodString;
205
+ }, z.core.$strip>;
206
+ browser: z.ZodObject<{
207
+ id: z.ZodString;
208
+ product: z.ZodUnion<readonly [z.ZodEnum<{
209
+ chrome: "chrome";
210
+ edge: "edge";
211
+ brave: "brave";
212
+ arc: "arc";
213
+ opera: "opera";
214
+ vivaldi: "vivaldi";
215
+ chromium: "chromium";
216
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
217
+ version: z.ZodString;
218
+ userAgent: z.ZodString;
219
+ }, z.core.$strip>;
220
+ }, z.core.$strip>, z.ZodObject<{
221
+ protocol: z.ZodInt;
222
+ host: z.ZodObject<{
223
+ name: z.ZodString;
224
+ remote: z.ZodBoolean;
225
+ }, z.core.$strip>;
226
+ }, z.core.$strip>>;
227
+ };
228
+ /** What the extension tells the Host. */
229
+ export declare const BRIDGE_HOST_NOTIFICATIONS: {
230
+ readonly "tabs/added": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{
231
+ key: z.ZodString;
232
+ tab: z.ZodObject<{
233
+ tabId: z.ZodInt;
234
+ windowId: z.ZodOptional<z.ZodInt>;
235
+ url: z.ZodOptional<z.ZodString>;
236
+ title: z.ZodOptional<z.ZodString>;
237
+ openerTabId: z.ZodOptional<z.ZodInt>;
238
+ active: z.ZodOptional<z.ZodBoolean>;
239
+ status: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strip>;
241
+ }, z.core.$strip>>;
242
+ readonly "tabs/updated": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{
243
+ tab: z.ZodObject<{
244
+ tabId: z.ZodInt;
245
+ windowId: z.ZodOptional<z.ZodInt>;
246
+ url: z.ZodOptional<z.ZodString>;
247
+ title: z.ZodOptional<z.ZodString>;
248
+ openerTabId: z.ZodOptional<z.ZodInt>;
249
+ active: z.ZodOptional<z.ZodBoolean>;
250
+ status: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strip>;
252
+ }, z.core.$strip>>;
253
+ readonly "tabs/removed": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{
254
+ tabId: z.ZodInt;
255
+ }, z.core.$strip>>;
256
+ readonly "debugger/event": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{
257
+ tabId: z.ZodInt;
258
+ sessionId: z.ZodOptional<z.ZodString>;
259
+ method: z.ZodString;
260
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
261
+ }, z.core.$strip>>;
262
+ readonly "debugger/detached": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{
263
+ tabId: z.ZodInt;
264
+ reason: z.ZodUnion<readonly [z.ZodEnum<{
265
+ target_closed: "target_closed";
266
+ canceled_by_user: "canceled_by_user";
267
+ not_allowed: "not_allowed";
268
+ released: "released";
269
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
270
+ }, z.core.$strip>>;
271
+ readonly "bridge/stopped": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{}, z.core.$strip>>;
272
+ readonly "bridge/ping": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{}, z.core.$strip>>;
273
+ };
274
+ /** Why a CDP command is refused, or undefined when it is relayed. */
275
+ export declare function refusedCdp(cdpMethod: string): string | undefined;
276
+ /** Pages no agent may use: the browser's own, other extensions', the store. */
277
+ export declare function usableUrl(url: string | undefined): boolean;
278
+ /** One part of a message too large for native messaging. */
279
+ export declare const NativePartSchema: z.ZodObject<{
280
+ part: z.ZodObject<{
281
+ id: z.ZodInt;
282
+ index: z.ZodInt;
283
+ count: z.ZodInt;
284
+ text: z.ZodString;
285
+ }, z.core.$strip>;
286
+ }, z.core.$strip>;
287
+ /** A message as native messaging carries it to the extension: whole, or in parts. */
288
+ export declare function splitNative(text: string, nextId: () => number, max?: number): string[];
289
+ /** Puts a message sent in parts together again: undefined until its last part. */
290
+ export declare class NativeParts {
291
+ private readonly pending;
292
+ /** A message received: itself when whole, its text once its last part came, or undefined. */
293
+ take(message: unknown): unknown;
294
+ }
295
+ /** An error the other end answered with. */
296
+ export declare class BridgeError extends Error {
297
+ readonly code: number;
298
+ constructor(code: number, message: string);
299
+ }
300
+ export interface BridgePeerOptions {
301
+ /** Sends one message to the other end. */
302
+ send(message: unknown): void;
303
+ /** Answers a request: its result, or throws (a `BridgeError` keeps its code). */
304
+ request?(method: string, params: unknown): Promise<unknown>;
305
+ /** Hears a notification. */
306
+ notify?(method: string, params: unknown): void;
307
+ /** How long a request waits for its answer, by method; default 30 s. */
308
+ timeoutMs?(method: string): number;
309
+ }
310
+ /**
311
+ * One end of the bridge: requests both ways, notifications both ways, over
312
+ * any transport that carries a message at a time. An answer is handed to
313
+ * its caller as it arrives, before any message after it is read, so a CDP
314
+ * client sees a command's answer and the events after it in Chrome's
315
+ * order (Browser MCP's ordering fix).
316
+ */
317
+ export declare class BridgePeer {
318
+ private readonly o;
319
+ private readonly pending;
320
+ private next;
321
+ private closed;
322
+ constructor(options: BridgePeerOptions);
323
+ request(method: string, params: unknown): Promise<unknown>;
324
+ /**
325
+ * A request whose answer is handed to `done` as it is read, before any
326
+ * message after it: what a relay uses to keep a command's answer ahead
327
+ * of the events Chrome sent after it.
328
+ */
329
+ call(method: string, params: unknown, done: (error: Error | undefined, result: unknown) => void): void;
330
+ notify(method: string, params: unknown): void;
331
+ /** A message from the other end. */
332
+ receive(message: unknown): void;
333
+ /** The transport ended: every request waiting fails. */
334
+ close(reason: string): void;
335
+ get isClosed(): boolean;
336
+ }
337
+ //# sourceMappingURL=browser-bridge.d.ts.map
@@ -0,0 +1,2 @@
1
+ /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
+ import{z as e}from"zod";import{method as d,notification as g}from"./jsonrpc.js";import{known as b,openEnum as l}from"./open.js";export const BRIDGE_PROTOCOL=1,BRIDGE_NATIVE_HOST="com.allyhub.browser",PERSON_BROWSER="person",BRIDGE_PATH="/browser",BRIDGE_EXTENSION_IDS={store:"pmckbhaedjblcbkbkcbmmogpealiaeol",development:"dbmenjkebdgjkhjdcicplkaakmjcjhdp"},BRIDGE_STORE_URL=`https://chromewebstore.google.com/detail/${BRIDGE_EXTENSION_IDS.store}`,BRIDGE_EXTENSION_ORIGINS=Object.values(BRIDGE_EXTENSION_IDS).map(r=>`chrome-extension://${r}`),BRIDGE_WINDOW_ORIGINS=["https://app.allyhub.com","https://app.allyhub-staging.com"],BRIDGE_STUDIO_DOMAINS=["allyhub.studio","allyhub-studio-staging.com"],BridgeWindowMessageSchema=e.discriminatedUnion("type",[e.object({type:e.literal("allyhub/bridge/status")}),e.object({type:e.literal("allyhub/bridge/connect"),url:e.string()})]),BridgeWindowAnswerSchema=e.object({version:e.string(),connected:e.array(e.string()),error:e.string().optional()});export function bridgeTarget(r,o){let t;try{t=new URL(r)}catch{return}if(t.username!==""||t.password!==""||t.pathname!==BRIDGE_PATH||t.hash!=="")return;const n=t.protocol.toLowerCase(),s=t.hostname.toLowerCase();if(n==="wss:"&&BRIDGE_STUDIO_DOMAINS.some(a=>s.endsWith(`.${a}`))||o&&(n==="ws:"||n==="wss:")&&(s==="127.0.0.1"||s==="localhost"||s.endsWith(".localhost")))return t}export const NATIVE_PART_CHARS=128*1024,BROWSER_PRODUCTS=["chrome","edge","brave","arc","opera","vivaldi","chromium"],BrowserProductSchema=l(BROWSER_PRODUCTS),BROWSER_PRODUCT_NAMES={chrome:"Google Chrome",edge:"Microsoft Edge",brave:"Brave",arc:"Arc",opera:"Opera",vivaldi:"Vivaldi",chromium:"Chromium"},browserName=r=>b(BROWSER_PRODUCTS,r)?BROWSER_PRODUCT_NAMES[r]:r,BridgeHelloSchema=e.object({protocol:e.int().min(1),extension:e.object({id:e.string(),version:e.string()}),browser:e.object({id:e.string().min(1).max(100),product:BrowserProductSchema,version:e.string(),userAgent:e.string()})}),BridgeWelcomeSchema=e.object({protocol:e.int().min(1),host:e.object({name:e.string(),remote:e.boolean()})}),BridgeTabSchema=e.object({tabId:e.int(),windowId:e.int().optional(),url:e.string().optional(),title:e.string().optional(),openerTabId:e.int().optional(),active:e.boolean().optional(),status:e.string().optional()}),BridgeGroupSchema=e.object({key:e.string().min(1).max(200),title:e.string().min(1).max(80)}),DETACH_REASONS=["target_closed","canceled_by_user","not_allowed","released"],DetachReasonSchema=l(DETACH_REASONS),BridgeCdpSchema=e.object({tabId:e.int(),sessionId:e.string().optional(),method:e.string().min(1),params:e.record(e.string(),e.unknown()).optional()});const p=e.object({});export const BRIDGE_EXTENSION_METHODS={"tabs/create":d(e.object({group:BridgeGroupSchema,url:e.string().optional()}),BridgeTabSchema,"Opens a tab in the background, in the group, and attaches the debugger to it."),"tabs/close":d(e.object({tabId:e.int()}),p,"Closes a tab."),"tabs/activate":d(e.object({tabId:e.int()}),p,"Shows a tab to the person (a handoff: something only they can do)."),"debugger/attach":d(e.object({tabId:e.int(),group:BridgeGroupSchema}),e.object({targetInfo:e.record(e.string(),e.unknown())}),"Attaches the debugger to a tab and keeps it in the group: its Target.getTargetInfo."),"debugger/detach":d(e.object({tabId:e.int()}),p,"Lets go of a tab; it stays open, in its group."),"debugger/send":d(BridgeCdpSchema,e.record(e.string(),e.unknown()),"Sends a CDP command to an attached tab, refused when it reaches past the tab."),"groups/release":d(e.object({key:e.string()}),p,"Lets go of every tab of a group and ungroups them; they stay open for the person.")},BRIDGE_HOST_METHODS={"bridge/hello":d(BridgeHelloSchema,BridgeWelcomeSchema,"The extension says who it is; the Host who it is.")},BRIDGE_HOST_NOTIFICATIONS={"tabs/added":g(e.object({key:e.string(),tab:BridgeTabSchema}),"A tab joined a group: the person dragged it in, or one of the group's pages opened it."),"tabs/updated":g(e.object({tab:BridgeTabSchema}),"A tab of a group changed: its address, title or loading."),"tabs/removed":g(e.object({tabId:e.int()}),"A tab of a group closed or left it."),"debugger/event":g(BridgeCdpSchema,"A CDP event from an attached tab."),"debugger/detached":g(e.object({tabId:e.int(),reason:DetachReasonSchema}),"Chrome let go of a tab, or the extension did."),"bridge/stopped":g(e.object({}),"The person stopped the agents (Cancel on Chrome's debugging bar): every tab was let go."),"bridge/ping":g(e.object({}),"Keeps a WebSocket, and so the extension's service worker, alive.")};const m=new Set(["Network.getAllCookies","Network.getCookies","Network.setCookie","Network.setCookies","Network.deleteCookies","Network.clearBrowserCookies","Network.clearBrowserCache","Network.loadNetworkResource","Page.setDownloadBehavior","Security.setIgnoreCertificateErrors","Target.attachToTarget","Target.attachToBrowserTarget","Target.activateTarget","Target.closeTarget","Target.createTarget","Target.createBrowserContext","Target.disposeBrowserContext","Target.exposeDevToolsProtocol","Target.getTargets","Target.sendMessageToTarget","Target.setDiscoverTargets","Target.setRemoteLocations"]),f=new Set(["Storage","IndexedDB","CacheStorage","DOMStorage","Browser","SystemInfo"]);export function refusedCdp(r){const o=r.split(".")[0]??"";if(m.has(r)||f.has(o))return`AllyHub's extension does not allow ${r} in the person's browser: it reaches past the tab (other sites, other tabs, or the browser itself).`}export function usableUrl(r){if(r===void 0||r===""||r==="about:blank")return!0;const o=/^https?:\/\/(?:[^@/?#]*@)?(\[[^\]]*\]|[^:/?#]+)(?::\d*)?([^?#]*)/iu.exec(r);if(!o)return!1;const t=(o[1]??"").toLowerCase(),n=o[2]===void 0||o[2]===""?"/":o[2];return!w.some(s=>t===s.host&&n.startsWith(s.path))}const w=[{host:"chromewebstore.google.com",path:"/"},{host:"chrome.google.com",path:"/webstore"},{host:"microsoftedge.microsoft.com",path:"/addons"}];export const NativePartSchema=e.object({part:e.object({id:e.int(),index:e.int().min(0),count:e.int().min(1),text:e.string()})});export function splitNative(r,o,t=NATIVE_PART_CHARS){if(r.length<=t)return[r];const n=o(),s=Math.ceil(r.length/t),a=[];for(let i=0;i<s;i++)a.push(JSON.stringify({part:{id:n,index:i,count:s,text:r.slice(i*t,(i+1)*t)}}));return a}export class NativeParts{pending=new Map;take(o){const t=NativePartSchema.safeParse(o);if(!t.success)return o;const{id:n,index:s,count:a,text:i}=t.data.part;let c=this.pending.get(n);if(c||(c=[],this.pending.set(n,c)),c[s]=i,!(c.filter(u=>typeof u=="string").length<a))return this.pending.delete(n),JSON.parse(c.join(""))}}export class BridgeError extends Error{code;constructor(o,t){super(t),this.name="BridgeError",this.code=o}}const h=globalThis;export class BridgePeer{o;pending=new Map;next=1;closed;constructor(o){this.o=o}request(o,t){return new Promise((n,s)=>{this.call(o,t,(a,i)=>{a?s(a):n(i)})})}call(o,t,n){if(this.closed){n(this.closed,void 0);return}const s=this.next++,a=this.o.timeoutMs?.(o)??3e4,i=h.setTimeout(()=>{this.pending.delete(s),n(new BridgeError(-32005,`${o} had no answer in ${String(a/1e3)} s.`),void 0)},a);this.pending.set(s,{method:o,done:n,timer:i});try{this.o.send({jsonrpc:"2.0",id:s,method:o,params:t})}catch(c){h.clearTimeout(i),this.pending.delete(s),n(c instanceof Error?c:new Error(String(c)),void 0)}}notify(o,t){this.closed||this.o.send({jsonrpc:"2.0",method:o,params:t})}receive(o){if(typeof o!="object"||o===null)return;const t=o;if(typeof t.method=="string"){if(typeof t.id=="number"||typeof t.id=="string"){const s=t.id;(this.o.request?this.o.request(t.method,t.params??{}):Promise.reject(new BridgeError(-32601,`There is no method "${t.method}".`))).then(i=>{this.closed||this.o.send({jsonrpc:"2.0",id:s,result:i??{}})},i=>{this.closed||this.o.send({jsonrpc:"2.0",id:s,error:{code:i instanceof BridgeError?i.code:-32603,message:i instanceof Error?i.message:String(i)}})})}else this.o.notify?.(t.method,t.params??{});return}if(typeof t.id!="number")return;const n=this.pending.get(t.id);n&&(this.pending.delete(t.id),h.clearTimeout(n.timer),t.error!==void 0?n.done(new BridgeError(typeof t.error.code=="number"?t.error.code:-32603,typeof t.error.message=="string"?t.error.message:n.method),void 0):n.done(void 0,t.result))}close(o){if(!this.closed){this.closed=new BridgeError(-32005,o);for(const t of this.pending.values())h.clearTimeout(t.timer),t.done(this.closed,void 0);this.pending.clear()}}get isClosed(){return this.closed!==void 0}}
@@ -104,6 +104,29 @@ export declare const BillingUsageSchema: z.ZodObject<{
104
104
  }, z.core.$strip>>;
105
105
  }, z.core.$strip>;
106
106
  export type BillingUsage = z.infer<typeof BillingUsageSchema>;
107
+ /**
108
+ * `GET ?days=30&limit=500`: each spend of the last days, the latest first:
109
+ * an owner or an admin reads the team's, a member their own. `more` when
110
+ * there were more than `limit`.
111
+ */
112
+ export declare const BILLING_SPENDS_PATH = "/api/billing/spends";
113
+ export declare const BillingSpendsSchema: z.ZodObject<{
114
+ spends: z.ZodArray<z.ZodObject<{
115
+ at: z.ZodString;
116
+ kind: z.ZodUnion<readonly [z.ZodEnum<{
117
+ models: "models";
118
+ tools: "tools";
119
+ studio: "studio";
120
+ other: "other";
121
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
122
+ what: z.ZodNullable<z.ZodString>;
123
+ seconds: z.ZodNullable<z.ZodNumber>;
124
+ member: z.ZodNullable<z.ZodString>;
125
+ credits: z.ZodNumber;
126
+ }, z.core.$strip>>;
127
+ more: z.ZodBoolean;
128
+ }, z.core.$strip>;
129
+ export type BillingSpends = z.infer<typeof BillingSpendsSchema>;
107
130
  /** `POST`, an owner's or an admin's: Stripe Checkout for a plan or a top-up; answers `{ url }`. */
108
131
  export declare const BILLING_CHECKOUT_PATH = "/api/billing/checkout";
109
132
  export declare const CheckoutRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
@@ -150,6 +173,25 @@ export declare const BillingPaymentSchema: z.ZodObject<{
150
173
  email: z.ZodNullable<z.ZodString>;
151
174
  }, z.core.$strip>;
152
175
  export type BillingPayment = z.infer<typeof BillingPaymentSchema>;
176
+ /** `GET`, an owner's or an admin's: the organization's invoices, the latest first (Stripe's, with their PDFs). */
177
+ export declare const BILLING_INVOICES_PATH = "/api/billing/invoices";
178
+ export declare const BillingInvoicesSchema: z.ZodObject<{
179
+ invoices: z.ZodArray<z.ZodObject<{
180
+ id: z.ZodString;
181
+ number: z.ZodNullable<z.ZodString>;
182
+ createdAt: z.ZodString;
183
+ kind: z.ZodUnion<readonly [z.ZodEnum<{
184
+ credits: "credits";
185
+ plan: "plan";
186
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
187
+ totalCents: z.ZodNumber;
188
+ currency: z.ZodString;
189
+ status: z.ZodString;
190
+ pdf: z.ZodNullable<z.ZodString>;
191
+ url: z.ZodNullable<z.ZodString>;
192
+ }, z.core.$strip>>;
193
+ }, z.core.$strip>;
194
+ export type BillingInvoices = z.infer<typeof BillingInvoicesSchema>;
153
195
  /** `POST { topUpCents }`, an owner's or an admin's: credits bought with the saved card at once; answers `{ credits }`, what was added. */
154
196
  export declare const BILLING_TOP_UP_PATH = "/api/billing/top-up";
155
197
  export declare const TopUpRequestSchema: z.ZodObject<{
@@ -222,10 +264,21 @@ export type ModelCatalog = z.infer<typeof ModelCatalogSchema>;
222
264
  /** A JSON Schema document of a tool's input or output. */
223
265
  export declare const JsonSchemaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
224
266
  export declare const CATALOG_PATH = "/api/catalog";
267
+ /** The units the console lists a tool's price in. */
268
+ export declare const PRICE_UNITS: readonly ["call", "result", "page", "second", "minute", "thousand_characters", "image", "frame", "megapixel", "question", "phrase"];
269
+ /** The console's sections of AI tools; a data work's tools are research. */
270
+ export declare const TOOL_SECTIONS: readonly ["video", "image", "voice", "music"];
271
+ /** What a work is, for the console's capabilities: data from many sources (switched as one), or AI models (each tool switched on its own). */
272
+ export declare const WORK_KINDS: readonly ["data", "ai"];
225
273
  export declare const CatalogWorkSchema: z.ZodObject<{
226
274
  id: z.ZodString;
227
275
  title: z.ZodString;
228
276
  description: z.ZodString;
277
+ kind: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
278
+ data: "data";
279
+ ai: "ai";
280
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>>;
281
+ line: z.ZodOptional<z.ZodString>;
229
282
  }, z.core.$strip>;
230
283
  export type CatalogWork = z.infer<typeof CatalogWorkSchema>;
231
284
  export declare const CatalogToolSchema: z.ZodObject<{
@@ -237,6 +290,33 @@ export declare const CatalogToolSchema: z.ZodObject<{
237
290
  output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
238
291
  long: z.ZodBoolean;
239
292
  example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
293
+ price: z.ZodOptional<z.ZodObject<{
294
+ credits: z.ZodNumber;
295
+ per: z.ZodUnion<readonly [z.ZodEnum<{
296
+ call: "call";
297
+ result: "result";
298
+ page: "page";
299
+ second: "second";
300
+ minute: "minute";
301
+ thousand_characters: "thousand_characters";
302
+ image: "image";
303
+ frame: "frame";
304
+ megapixel: "megapixel";
305
+ question: "question";
306
+ phrase: "phrase";
307
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
308
+ varies: z.ZodBoolean;
309
+ }, z.core.$strip>>;
310
+ shown: z.ZodOptional<z.ZodObject<{
311
+ name: z.ZodString;
312
+ line: z.ZodString;
313
+ section: z.ZodUnion<readonly [z.ZodEnum<{
314
+ image: "image";
315
+ video: "video";
316
+ voice: "voice";
317
+ music: "music";
318
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
319
+ }, z.core.$strip>>;
240
320
  }, z.core.$strip>;
241
321
  export type CatalogTool = z.infer<typeof CatalogToolSchema>;
242
322
  export declare const CatalogSchema: z.ZodObject<{
@@ -245,6 +325,11 @@ export declare const CatalogSchema: z.ZodObject<{
245
325
  id: z.ZodString;
246
326
  title: z.ZodString;
247
327
  description: z.ZodString;
328
+ kind: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
329
+ data: "data";
330
+ ai: "ai";
331
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>>;
332
+ line: z.ZodOptional<z.ZodString>;
248
333
  }, z.core.$strip>>;
249
334
  tools: z.ZodArray<z.ZodObject<{
250
335
  name: z.ZodString;
@@ -255,9 +340,77 @@ export declare const CatalogSchema: z.ZodObject<{
255
340
  output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
256
341
  long: z.ZodBoolean;
257
342
  example: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
343
+ price: z.ZodOptional<z.ZodObject<{
344
+ credits: z.ZodNumber;
345
+ per: z.ZodUnion<readonly [z.ZodEnum<{
346
+ call: "call";
347
+ result: "result";
348
+ page: "page";
349
+ second: "second";
350
+ minute: "minute";
351
+ thousand_characters: "thousand_characters";
352
+ image: "image";
353
+ frame: "frame";
354
+ megapixel: "megapixel";
355
+ question: "question";
356
+ phrase: "phrase";
357
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
358
+ varies: z.ZodBoolean;
359
+ }, z.core.$strip>>;
360
+ shown: z.ZodOptional<z.ZodObject<{
361
+ name: z.ZodString;
362
+ line: z.ZodString;
363
+ section: z.ZodUnion<readonly [z.ZodEnum<{
364
+ image: "image";
365
+ video: "video";
366
+ voice: "voice";
367
+ music: "music";
368
+ }>, z.core.$ZodBranded<z.ZodString, "Unknown", "out">]>;
369
+ }, z.core.$strip>>;
258
370
  }, z.core.$strip>>;
259
371
  }, z.core.$strip>;
260
372
  export type Catalog = z.infer<typeof CatalogSchema>;
373
+ /**
374
+ * `GET`: the cloud tools the organization turned off, anyone in it reads;
375
+ * `PUT { work, on }` or `PUT { tool, on }`, an owner's or an admin's: one
376
+ * switched, answering what is off now. A data work is switched as one
377
+ * (its tools added later too), an AI work's tools each on its own. A
378
+ * tool turned off is refused to every call in the organization (403
379
+ * `tool_off`): the CLI's, Studio's, an agent's.
380
+ */
381
+ export declare const CAPABILITIES_PATH = "/api/capabilities";
382
+ export declare const CapabilitiesSchema: z.ZodObject<{
383
+ off: z.ZodObject<{
384
+ works: z.ZodArray<z.ZodString>;
385
+ tools: z.ZodArray<z.ZodString>;
386
+ }, z.core.$strip>;
387
+ }, z.core.$strip>;
388
+ export type Capabilities = z.infer<typeof CapabilitiesSchema>;
389
+ export declare const CapabilityRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
390
+ work: z.ZodString;
391
+ on: z.ZodBoolean;
392
+ }, z.core.$strict>, z.ZodObject<{
393
+ tool: z.ZodString;
394
+ on: z.ZodBoolean;
395
+ }, z.core.$strict>]>;
396
+ export type CapabilityRequest = z.infer<typeof CapabilityRequestSchema>;
397
+ /**
398
+ * `GET`: the editors the console lists, free in every product: each kind
399
+ * the built-in extensions contribute with how the console shows it, in its
400
+ * order; open to anyone.
401
+ */
402
+ export declare const EDITORS_PATH = "/api/editors";
403
+ export declare const EditorsSchema: z.ZodObject<{
404
+ editors: z.ZodArray<z.ZodObject<{
405
+ id: z.ZodString;
406
+ name: z.ZodRecord<z.ZodString, z.ZodString>;
407
+ plural: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
408
+ line: z.ZodRecord<z.ZodString, z.ZodString>;
409
+ icon: z.ZodOptional<z.ZodString>;
410
+ color: z.ZodOptional<z.ZodString>;
411
+ }, z.core.$strip>>;
412
+ }, z.core.$strip>;
413
+ export type Editors = z.infer<typeof EditorsSchema>;
261
414
  /** Where a tool's calls are made (POST). */
262
415
  export declare const toolCallsPath: (tool: string) => string;
263
416
  /** Where a call is read again (GET). */
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{z as t}from"zod";import{openEnum as o}from"./open.js";export const API_KEY_ENV="ALLYHUB_API_KEY",BILLING_SUMMARY_PATH="/api/billing/summary",AUTO_TOP_UP_STOPS=["no_card","saving_card","not_a_card","declined","needs_authentication","not_charged","under_line","refunded","disputed","monthly_limit"],BILLING_INTERVALS=["month","year"],BillingSummarySchema=t.object({credits:t.number(),held:t.number(),owed:t.number(),frozen:t.string().nullable().default(null),plan:t.object({id:t.string(),name:t.string(),interval:o(BILLING_INTERVALS),status:t.string(),renewsAt:t.iso.datetime().nullable(),endsAt:t.iso.datetime().nullable(),monthlyCredits:t.number().default(0),price:t.object({amountCents:t.number(),currency:t.string()}).nullable().default(null)}).nullable(),allowance:t.object({total:t.number(),used:t.number(),renewsAt:t.iso.datetime()}).nullable().default(null),bought:t.number().default(0),customer:t.boolean().default(!1),autoTopUp:t.object({below:t.number(),amountCents:t.number(),monthlyLimitCents:t.number().nullable().default(null),chargedThisMonthCents:t.number().default(0),stopped:o(AUTO_TOP_UP_STOPS).nullable()}).nullable()}),BILLING_PLANS_PATH="/api/billing/plans",BillingPlansSchema=t.object({plans:t.array(t.object({id:t.string(),name:t.string(),family:t.string().nullable().default(null),recommended:t.boolean().default(!1),monthlyCredits:t.number(),prices:t.array(t.object({interval:o(BILLING_INTERVALS),amountCents:t.number(),currency:t.string()}))})),topUp:t.object({currency:t.string(),creditsPerDollar:t.number(),minCents:t.number(),maxCents:t.number(),presetsCents:t.array(t.number()).default([])}),welcomeCredits:t.number().optional()}),BILLING_USAGE_PATH="/api/billing/usage",SPEND_KINDS=["models","tools","studio","other"],BillingUsageSchema=t.object({days:t.array(t.object({day:t.iso.date(),credits:t.number(),byKind:t.record(t.string(),t.number()).default({})}))}),BILLING_CHECKOUT_PATH="/api/billing/checkout",CheckoutRequestSchema=t.union([t.strictObject({plan:t.string(),interval:t.enum(BILLING_INTERVALS)}),t.strictObject({topUpCents:t.number().int()})]),BILLING_PORTAL_PATH="/api/billing/portal",PortalRequestSchema=t.union([t.strictObject({flow:t.enum(["home","payment_method","cancel"])}),t.strictObject({flow:t.literal("change_plan"),plan:t.string(),interval:t.enum(BILLING_INTERVALS)})]).default({flow:"home"}),BILLING_RESUME_PATH="/api/billing/resume",BILLING_PAYMENT_PATH="/api/billing/payment",BillingPaymentSchema=t.object({card:t.object({brand:t.string(),last4:t.string(),expMonth:t.number(),expYear:t.number()}).nullable(),email:t.string().nullable()}),BILLING_TOP_UP_PATH="/api/billing/top-up",TopUpRequestSchema=t.strictObject({topUpCents:t.number().int()}),BILLING_REQUEST_PATH="/api/billing/request",AUTO_TOP_UP_PATH="/api/billing/auto-top-up",AutoTopUpRequestSchema=t.strictObject({below:t.number().nonnegative(),amountCents:t.number().int().positive(),monthlyLimitCents:t.number().int().positive().nullable().optional(),newCard:t.boolean().optional()}),BILLING_REFUSALS=["top_up_amount","monthly_limit","has_plan","no_plan","no_such_plan","not_customer","no_card","frozen","not_charged","asked_today"],BILLING_PAGE_PATH="/settings/plan",BILLING_PAID_PATH="/settings/plan?paid=1",LLM_MODELS_PATH="/api/llm/models",LLM_MESSAGES_PATH="/api/llm/v1/messages",MODEL_TIERS=["premium","standard","efficient"];const a={tier:o(MODEL_TIERS).optional(),maker:t.string().min(1).optional()};export const ModelCatalogSchema=t.object({models:t.array(t.looseObject({id:t.string().min(1),name:t.string().min(1),...a,reasoning:t.boolean().optional(),input:t.array(t.string()).optional(),contextWindow:t.number().int().positive().optional(),maxOutput:t.number().int().positive().optional()})).min(1),defaultModel:t.string().min(1),needPlan:t.array(t.looseObject({id:t.string().min(1),name:t.string().min(1),...a})).default([])}),JsonSchemaSchema=t.record(t.string(),t.unknown()),CATALOG_PATH="/api/catalog",CatalogWorkSchema=t.object({id:t.string().min(1),title:t.string().min(1),description:t.string().min(1)}),CatalogToolSchema=t.object({name:t.string().min(1),work:t.string().min(1),title:t.string().min(1),description:t.string().min(1),input:JsonSchemaSchema,output:JsonSchemaSchema,long:t.boolean(),example:t.record(t.string(),t.unknown()).optional()}),CatalogSchema=t.object({version:t.string().min(1),works:t.array(CatalogWorkSchema),tools:t.array(CatalogToolSchema)}),toolCallsPath=e=>`/api/tools/${encodeURIComponent(e)}/calls`,callPath=e=>`/api/calls/${encodeURIComponent(e)}`,ToolCallRequestSchema=t.strictObject({input:t.record(t.string(),t.unknown())}),CALL_STATUS=["working","completed","failed"],ToolCallSchema=t.object({id:t.string().min(1),tool:t.string().min(1),status:o(CALL_STATUS),output:t.unknown().optional(),error:t.object({kind:t.string().min(1),message:t.string().min(1)}).optional(),credits:t.number().nonnegative().optional(),pollAfterMs:t.number().int().nonnegative().optional(),createdAt:t.string(),endedAt:t.string().optional()});const i="ally://data-tool-results/";export const allyFilePath=(e,n)=>`${i}${encodeURIComponent(e)}/${encodeURIComponent(n)}`;export function parseAllyFilePath(e){if(!e.startsWith(i))return;const[n,r,...l]=e.slice(i.length).split("/");if(!(!n||!r||l.length>0))try{return{id:decodeURIComponent(n),name:decodeURIComponent(r)}}catch{return}}export const FILE_MAX_BYTES=1024*1024*1024,FILES_PATH="/api/files",FileCreateRequestSchema=t.strictObject({name:t.string().min(1).max(255),size:t.int().positive().max(FILE_MAX_BYTES),sha256:t.string().regex(/^[0-9a-f]{64}$/u),contentType:t.string().min(1).max(255)}),FileCreatedSchema=t.object({id:t.string().min(1),upload:t.object({url:t.url(),headers:t.record(t.string(),t.string())}).nullable()}),fileDonePath=e=>`${FILES_PATH}/${encodeURIComponent(e)}/done`,UploadedFileSchema=t.object({id:t.string().min(1),name:t.string()}),FileContentResponseSchema=t.object({url:t.url()}),fileContentPath=(e,n)=>`${FILES_PATH}/${encodeURIComponent(e)}/content?disposition=${n}`;
2
+ import{z as t}from"zod";import{openEnum as n}from"./open.js";export const API_KEY_ENV="ALLYHUB_API_KEY",BILLING_SUMMARY_PATH="/api/billing/summary",AUTO_TOP_UP_STOPS=["no_card","saving_card","not_a_card","declined","needs_authentication","not_charged","under_line","refunded","disputed","monthly_limit"],BILLING_INTERVALS=["month","year"],BillingSummarySchema=t.object({credits:t.number(),held:t.number(),owed:t.number(),frozen:t.string().nullable().default(null),plan:t.object({id:t.string(),name:t.string(),interval:n(BILLING_INTERVALS),status:t.string(),renewsAt:t.iso.datetime().nullable(),endsAt:t.iso.datetime().nullable(),monthlyCredits:t.number().default(0),price:t.object({amountCents:t.number(),currency:t.string()}).nullable().default(null)}).nullable(),allowance:t.object({total:t.number(),used:t.number(),renewsAt:t.iso.datetime()}).nullable().default(null),bought:t.number().default(0),customer:t.boolean().default(!1),autoTopUp:t.object({below:t.number(),amountCents:t.number(),monthlyLimitCents:t.number().nullable().default(null),chargedThisMonthCents:t.number().default(0),stopped:n(AUTO_TOP_UP_STOPS).nullable()}).nullable()}),BILLING_PLANS_PATH="/api/billing/plans",BillingPlansSchema=t.object({plans:t.array(t.object({id:t.string(),name:t.string(),family:t.string().nullable().default(null),recommended:t.boolean().default(!1),monthlyCredits:t.number(),prices:t.array(t.object({interval:n(BILLING_INTERVALS),amountCents:t.number(),currency:t.string()}))})),topUp:t.object({currency:t.string(),creditsPerDollar:t.number(),minCents:t.number(),maxCents:t.number(),presetsCents:t.array(t.number()).default([])}),welcomeCredits:t.number().optional()}),BILLING_USAGE_PATH="/api/billing/usage",SPEND_KINDS=["models","tools","studio","other"],BillingUsageSchema=t.object({days:t.array(t.object({day:t.iso.date(),credits:t.number(),byKind:t.record(t.string(),t.number()).default({})}))}),BILLING_SPENDS_PATH="/api/billing/spends",BillingSpendsSchema=t.object({spends:t.array(t.object({at:t.string(),kind:n(SPEND_KINDS),what:t.string().nullable(),seconds:t.number().nullable(),member:t.string().nullable(),credits:t.number()})),more:t.boolean()}),BILLING_CHECKOUT_PATH="/api/billing/checkout",CheckoutRequestSchema=t.union([t.strictObject({plan:t.string(),interval:t.enum(BILLING_INTERVALS)}),t.strictObject({topUpCents:t.number().int()})]),BILLING_PORTAL_PATH="/api/billing/portal",PortalRequestSchema=t.union([t.strictObject({flow:t.enum(["home","payment_method","cancel"])}),t.strictObject({flow:t.literal("change_plan"),plan:t.string(),interval:t.enum(BILLING_INTERVALS)})]).default({flow:"home"}),BILLING_RESUME_PATH="/api/billing/resume",BILLING_PAYMENT_PATH="/api/billing/payment",BillingPaymentSchema=t.object({card:t.object({brand:t.string(),last4:t.string(),expMonth:t.number(),expYear:t.number()}).nullable(),email:t.string().nullable()}),BILLING_INVOICES_PATH="/api/billing/invoices",BillingInvoicesSchema=t.object({invoices:t.array(t.object({id:t.string(),number:t.string().nullable(),createdAt:t.string(),kind:n(["plan","credits"]),totalCents:t.number(),currency:t.string(),status:t.string(),pdf:t.string().nullable(),url:t.string().nullable()}))}),BILLING_TOP_UP_PATH="/api/billing/top-up",TopUpRequestSchema=t.strictObject({topUpCents:t.number().int()}),BILLING_REQUEST_PATH="/api/billing/request",AUTO_TOP_UP_PATH="/api/billing/auto-top-up",AutoTopUpRequestSchema=t.strictObject({below:t.number().nonnegative(),amountCents:t.number().int().positive(),monthlyLimitCents:t.number().int().positive().nullable().optional(),newCard:t.boolean().optional()}),BILLING_REFUSALS=["top_up_amount","monthly_limit","has_plan","no_plan","no_such_plan","not_customer","no_card","frozen","not_charged","asked_today"],BILLING_PAGE_PATH="/settings/plan",BILLING_PAID_PATH="/settings/plan?paid=1",LLM_MODELS_PATH="/api/llm/models",LLM_MESSAGES_PATH="/api/llm/v1/messages",MODEL_TIERS=["premium","standard","efficient"];const a={tier:n(MODEL_TIERS).optional(),maker:t.string().min(1).optional()};export const ModelCatalogSchema=t.object({models:t.array(t.looseObject({id:t.string().min(1),name:t.string().min(1),...a,reasoning:t.boolean().optional(),input:t.array(t.string()).optional(),contextWindow:t.number().int().positive().optional(),maxOutput:t.number().int().positive().optional()})).min(1),defaultModel:t.string().min(1),needPlan:t.array(t.looseObject({id:t.string().min(1),name:t.string().min(1),...a})).default([])}),JsonSchemaSchema=t.record(t.string(),t.unknown()),CATALOG_PATH="/api/catalog",PRICE_UNITS=["call","result","page","second","minute","thousand_characters","image","frame","megapixel","question","phrase"],TOOL_SECTIONS=["video","image","voice","music"],WORK_KINDS=["data","ai"],CatalogWorkSchema=t.object({id:t.string().min(1),title:t.string().min(1),description:t.string().min(1),kind:n(WORK_KINDS).default("data"),line:t.string().optional()}),CatalogToolSchema=t.object({name:t.string().min(1),work:t.string().min(1),title:t.string().min(1),description:t.string().min(1),input:JsonSchemaSchema,output:JsonSchemaSchema,long:t.boolean(),example:t.record(t.string(),t.unknown()).optional(),price:t.object({credits:t.number().nonnegative(),per:n(PRICE_UNITS),varies:t.boolean()}).optional(),shown:t.object({name:t.string(),line:t.string(),section:n(TOOL_SECTIONS)}).optional()}),CatalogSchema=t.object({version:t.string().min(1),works:t.array(CatalogWorkSchema),tools:t.array(CatalogToolSchema)}),CAPABILITIES_PATH="/api/capabilities",CapabilitiesSchema=t.object({off:t.object({works:t.array(t.string()),tools:t.array(t.string())})}),CapabilityRequestSchema=t.union([t.strictObject({work:t.string().min(1),on:t.boolean()}),t.strictObject({tool:t.string().min(1),on:t.boolean()})]),EDITORS_PATH="/api/editors",EditorsSchema=t.object({editors:t.array(t.object({id:t.string().min(1),name:t.record(t.string(),t.string()),plural:t.record(t.string(),t.string()).optional(),line:t.record(t.string(),t.string()),icon:t.string().optional(),color:t.string().optional()}))}),toolCallsPath=e=>`/api/tools/${encodeURIComponent(e)}/calls`,callPath=e=>`/api/calls/${encodeURIComponent(e)}`,ToolCallRequestSchema=t.strictObject({input:t.record(t.string(),t.unknown())}),CALL_STATUS=["working","completed","failed"],ToolCallSchema=t.object({id:t.string().min(1),tool:t.string().min(1),status:n(CALL_STATUS),output:t.unknown().optional(),error:t.object({kind:t.string().min(1),message:t.string().min(1)}).optional(),credits:t.number().nonnegative().optional(),pollAfterMs:t.number().int().nonnegative().optional(),createdAt:t.string(),endedAt:t.string().optional()});const i="ally://data-tool-results/";export const allyFilePath=(e,o)=>`${i}${encodeURIComponent(e)}/${encodeURIComponent(o)}`;export function parseAllyFilePath(e){if(!e.startsWith(i))return;const[o,r,...s]=e.slice(i.length).split("/");if(!(!o||!r||s.length>0))try{return{id:decodeURIComponent(o),name:decodeURIComponent(r)}}catch{return}}export const FILE_MAX_BYTES=1024*1024*1024,FILES_PATH="/api/files",FileCreateRequestSchema=t.strictObject({name:t.string().min(1).max(255),size:t.int().positive().max(FILE_MAX_BYTES),sha256:t.string().regex(/^[0-9a-f]{64}$/u),contentType:t.string().min(1).max(255)}),FileCreatedSchema=t.object({id:t.string().min(1),upload:t.object({url:t.url(),headers:t.record(t.string(),t.string())}).nullable()}),fileDonePath=e=>`${FILES_PATH}/${encodeURIComponent(e)}/done`,UploadedFileSchema=t.object({id:t.string().min(1),name:t.string()}),FileContentResponseSchema=t.object({url:t.url()}),fileContentPath=(e,o)=>`${FILES_PATH}/${encodeURIComponent(e)}/content?disposition=${o}`;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { type ClientOf } from "./jsonrpc.js";
3
- import { type NoteSurface } from "./notes.js";
3
+ import { type NoteInset, type NoteSurface } from "./notes.js";
4
4
  export { PLACE_PARAM, PlaceSchema, placeIn, placeParams, type Place, } from "./place.js";
5
5
  export declare const ThemeSchema: z.ZodEnum<{
6
6
  light: "light";
@@ -235,8 +235,8 @@ export declare const HOST_NOTIFICATIONS: {
235
235
  }, z.core.$strict>>;
236
236
  readonly "check/changed": import("./jsonrpc.js").NotificationSpec<z.ZodObject<{
237
237
  status: z.ZodEnum<{
238
- failed: "failed";
239
238
  off: "off";
239
+ failed: "failed";
240
240
  running: "running";
241
241
  done: "done";
242
242
  waiting: "waiting";
@@ -647,5 +647,7 @@ export type EditorHost = ClientOf<typeof EDITOR_HOST_METHODS> & {
647
647
  on<N extends keyof typeof HOST_NOTIFICATIONS>(name: N, listener: (params: z.output<(typeof HOST_NOTIFICATIONS)[N]["params"]>) => void): () => void;
648
648
  /** Gives the host what it asks of the editor for a person's notes; answers how to stop. Absent where nobody takes notes. */
649
649
  notes?(surface: NoteSurface): () => void;
650
+ /** Gives the host a box of the page that draws itself and answers for its marks; answers how to stop. Absent where nobody takes notes. */
651
+ noteInset?(inset: NoteInset): () => void;
650
652
  };
651
653
  //# sourceMappingURL=editor.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{z as t}from"zod";import{FILE_METHODS as r,FILE_NOTIFICATIONS as a,FolderSchema as i,PathSchema as o}from"./files.js";import{method as e,notification as n}from"./jsonrpc.js";import{KindInfoSchema as h}from"./kinds.js";import{NoteRectSchema as c}from"./notes.js";import{PlaceSchema as s}from"./place.js";import{AgentHereSchema as l,PRESENCE_METHODS as m,PRESENCE_NOTIFICATIONS as p}from"./presence.js";import{TOOL_NOTIFICATIONS as d}from"./tools.js";export{PLACE_PARAM,PlaceSchema,placeIn,placeParams}from"./place.js";export const ThemeSchema=t.enum(["light","dark"]),HostContextSchema=t.strictObject({locale:t.string().min(2),theme:ThemeSchema,agent:t.strictObject({name:t.string().min(1)}).optional(),project:t.strictObject({name:t.string().min(1)}),notes:t.boolean().optional(),share:t.boolean().optional(),commands:t.boolean().optional(),audienceWindow:t.boolean().optional(),readOnly:t.boolean().optional(),viewer:t.boolean().optional(),place:s.optional(),item:t.strictObject({id:o,kind:t.string().min(1).optional(),dir:i,entry:o,kindInfo:h}),editor:t.string().min(1)}),OpenTargetSchema=t.discriminatedUnion("type",[t.strictObject({type:t.literal("file"),path:o,line:t.int().positive().optional()}),t.strictObject({type:t.literal("browser"),url:t.url({protocol:/^https?$/u}).optional(),tabId:t.string().min(1).optional()})]),AUDIENCE_WINDOW="allyhub-audience",EDITOR_STATES=["saved","saving","unsaved","error"],EXPORT_BUTTON_STATES=["idle","queued","running","done","failed"],ExportStateSchema=t.strictObject({at:t.enum(EXPORT_BUTTON_STATES),percent:t.number().min(0).max(100).optional(),open:t.boolean().optional()}),HOST_METHODS={"host/context":e(t.strictObject({}),HostContextSchema,"Where the editor runs."),"items/open":e(t.strictObject({target:OpenTargetSchema}),t.strictObject({}),"Shows another item, a file or a page, where the host shows things."),"storage/get":e(t.strictObject({key:t.string().min(1)}),t.strictObject({value:t.unknown()}),"What the editor kept for this person on this computer (a hand sort, what was last seen), or null."),"storage/set":e(t.strictObject({key:t.string().min(1),value:t.unknown()}),t.strictObject({}),"Keeps a value for this person on this computer; null removes it."),"editor/state":e(t.strictObject({state:t.enum(EDITOR_STATES),message:t.string().optional()}),t.strictObject({}),"Says whether what the person typed is saved."),"export/state":e(ExportStateSchema,t.strictObject({}),"Says how the item's exports go, for a host that draws Export itself (HostContext's `commands`)."),"agent/here":e(l,t.strictObject({}),"Says whether the project's agent is in the item and what it does there, and whether the editor follows it, for a host that draws the agent's name itself (HostContext's `commands`); the host's button asks back with `editor/command`'s `follow` or `unfollow`."),"editor/place":e(t.strictObject({place:s}),t.strictObject({}),"Says where the person is in the item (a video's moment, a deck's slide), on a pause, a seek or another slide, never each frame, so the host opens it there again (HostContext's `place`). The place is the editor's, in the shape its `editors` contribution's schema says; the host keeps it unread."),"agent/ask":e(t.strictObject({text:t.string().min(1)}),t.strictObject({delivered:t.boolean()}),"Puts words before the person's agent, for them to go on and send; false where no agent takes them. Never sent by itself."),"note/begin":e(t.strictObject({from:c.optional()}),t.strictObject({begun:t.boolean()}),"Starts the host's Note mode on what is on show, as its own Note button does, so a person can mark anything up for their agent from wherever they are; false where the host has none. Sends nothing."),"share/begin":e(t.strictObject({}),t.strictObject({begun:t.boolean()}),"Opens the host's Share panel for the item on show, as the editor's own Share button does (HostContext's `share`); false where the host shares nothing. Shares nothing by itself."),"edit/request":e(t.strictObject({}),t.strictObject({asked:t.boolean()}),"The person tried to change what a read-only host shows (`readOnly`): the host offers to wake the machine that changes it; false where nothing does."),"tools/call":e(t.strictObject({name:t.string().min(1),arguments:t.record(t.string(),t.unknown()).default({})}),t.strictObject({result:t.unknown()}),"Runs one of the project server's tools (tools.ts's PROJECT_TOOLS), for an editor that needs more than files (a video's preview, a still).")},HOST_NOTIFICATIONS={"host/context-changed":n(HostContextSchema,"The language, theme or agent changed."),"editor/command":n(t.strictObject({command:t.string().min(1),open:t.boolean().optional()}),"The host around the editor asked it to run a command: what its own shortcut does (Export, ⌘E), or a command its extension contributes."),...a,...d,...p},EDITOR_HOST_METHODS={...r,...HOST_METHODS,...m};
2
+ import{z as t}from"zod";import{FILE_METHODS as r,FILE_NOTIFICATIONS as a,FolderSchema as i,PathSchema as o}from"./files.js";import{method as e,notification as n}from"./jsonrpc.js";import{KindInfoSchema as h}from"./kinds.js";import{NoteRectSchema as c}from"./notes.js";import{PlaceSchema as s}from"./place.js";import{AgentHereSchema as l,PRESENCE_METHODS as m,PRESENCE_NOTIFICATIONS as p}from"./presence.js";import{TOOL_NOTIFICATIONS as d}from"./tools.js";export{PLACE_PARAM,PlaceSchema,placeIn,placeParams}from"./place.js";export const ThemeSchema=t.enum(["light","dark"]),HostContextSchema=t.strictObject({locale:t.string().min(2),theme:ThemeSchema,agent:t.strictObject({name:t.string().min(1)}).optional(),project:t.strictObject({name:t.string().min(1)}),notes:t.boolean().optional(),share:t.boolean().optional(),commands:t.boolean().optional(),audienceWindow:t.boolean().optional(),readOnly:t.boolean().optional(),viewer:t.boolean().optional(),place:s.optional(),item:t.strictObject({id:o,kind:t.string().min(1).optional(),dir:i,entry:o,kindInfo:h}),editor:t.string().min(1)}),OpenTargetSchema=t.discriminatedUnion("type",[t.strictObject({type:t.literal("file"),path:o,line:t.int().positive().optional()}),t.strictObject({type:t.literal("browser"),url:t.url({protocol:/^https?$/u}).optional(),tabId:t.string().min(1).optional()})]),AUDIENCE_WINDOW="allyhub-audience",EDITOR_STATES=["saved","saving","unsaved","error"],EXPORT_BUTTON_STATES=["idle","queued","running","done","failed"],ExportStateSchema=t.strictObject({at:t.enum(EXPORT_BUTTON_STATES),percent:t.number().min(0).max(100).optional(),open:t.boolean().optional()}),HOST_METHODS={"host/context":e(t.strictObject({}),HostContextSchema,"Where the editor runs."),"items/open":e(t.strictObject({target:OpenTargetSchema}),t.strictObject({}),"Shows another item, a file or a page, where the host shows things."),"storage/get":e(t.strictObject({key:t.string().min(1)}),t.strictObject({value:t.unknown()}),"What the editor kept for this person on this computer (a hand sort, what was last seen), or null."),"storage/set":e(t.strictObject({key:t.string().min(1),value:t.unknown()}),t.strictObject({}),"Keeps a value for this person on this computer; null removes it."),"editor/state":e(t.strictObject({state:t.enum(EDITOR_STATES),message:t.string().optional()}),t.strictObject({}),"Says whether what the person typed is saved."),"export/state":e(ExportStateSchema,t.strictObject({}),"Says how the item's exports go, for a host that draws Export itself (HostContext's `commands`)."),"agent/here":e(l,t.strictObject({}),"Says whether the project's agent is in the item and what it does there, and whether the editor follows it, for a host that draws the agent's name itself (HostContext's `commands`); the host's button asks back with `editor/command`'s `follow` or `unfollow`."),"editor/place":e(t.strictObject({place:s}),t.strictObject({}),"Says where the person is in the item (a video's moment, a deck's slide), on a pause, a seek or another slide, never each frame, so the host opens it there again (HostContext's `place`). The place is the editor's, in the shape its `editors` contribution's schema says; the host keeps it unread."),"agent/ask":e(t.strictObject({text:t.string().min(1)}),t.strictObject({delivered:t.boolean()}),"Puts words before the person's agent, for them to go on and send; false where no agent takes them. Never sent by itself."),"note/begin":e(t.strictObject({from:c.optional()}),t.strictObject({begun:t.boolean()}),"Starts the host's Mark up on what is on show, as its own Note button does, so a person can mark anything up for their agent from wherever they are; false where the host has none. Sends nothing."),"share/begin":e(t.strictObject({}),t.strictObject({begun:t.boolean()}),"Opens the host's Share panel for the item on show, as the editor's own Share button does (HostContext's `share`); false where the host shares nothing. Shares nothing by itself."),"edit/request":e(t.strictObject({}),t.strictObject({asked:t.boolean()}),"The person tried to change what a read-only host shows (`readOnly`): the host offers to wake the machine that changes it; false where nothing does."),"tools/call":e(t.strictObject({name:t.string().min(1),arguments:t.record(t.string(),t.unknown()).default({})}),t.strictObject({result:t.unknown()}),"Runs one of the project server's tools (tools.ts's PROJECT_TOOLS), for an editor that needs more than files (a video's preview, a still).")},HOST_NOTIFICATIONS={"host/context-changed":n(HostContextSchema,"The language, theme or agent changed."),"editor/command":n(t.strictObject({command:t.string().min(1),open:t.boolean().optional()}),"The host around the editor asked it to run a command: what its own shortcut does (Export, ⌘E), or a command its extension contributes."),...a,...d,...p},EDITOR_HOST_METHODS={...r,...HOST_METHODS,...m};