arco-workbench 0.1.7 → 0.1.9

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 (301) hide show
  1. package/CONTRIBUTING.md +63 -12
  2. package/README.md +21 -17
  3. package/client/dist/assets/{PhosphorBackdrop-DVQdBrTw.js → PhosphorBackdrop-DRu16-Is.js} +1 -1
  4. package/client/dist/assets/{ThemedBackgroundShaderImpl-BfSs2tB4.js → ThemedBackgroundShaderImpl-BLdwwQ4D.js} +1 -1
  5. package/client/dist/assets/{XtermView-DaMjC8Ny.js → XtermView-Xk7_9JaH.js} +1 -1
  6. package/client/dist/assets/{galleryEditor-BCQnXj7R.js → galleryEditor-CI8ClzBa.js} +1 -1
  7. package/client/dist/assets/{index-DD9kFGsF.css → index-BEFgrUJJ.css} +1 -1
  8. package/client/dist/assets/{index-COfbHCYv.js → index-C7WzZfsr.js} +257 -255
  9. package/client/dist/index.html +2 -2
  10. package/client/src/App.tsx +2 -0
  11. package/client/src/components/ChatMessage.tsx +33 -8
  12. package/client/src/components/ChatModeView.tsx +2 -0
  13. package/client/src/components/ClusterRightPanel/ReplaceMemberDialog.tsx +65 -15
  14. package/client/src/components/ClusterRightPanel/SkillsControl.tsx +124 -0
  15. package/client/src/components/ClusterRightPanel/index.tsx +4 -0
  16. package/client/src/components/ClusterTaskBoardTab.tsx +9 -22
  17. package/client/src/components/CodexLateCommand.tsx +34 -0
  18. package/client/src/components/DialogShell.tsx +2 -0
  19. package/client/src/components/MemberCard.tsx +4 -1
  20. package/client/src/components/MemberPane.tsx +3 -1
  21. package/client/src/components/NeedsYouBadge.tsx +3 -3
  22. package/client/src/components/PhoneUpload.tsx +288 -0
  23. package/client/src/components/PrimaryStatus.tsx +14 -6
  24. package/client/src/components/ProviderReleasesModal.tsx +8 -4
  25. package/client/src/components/ProvidersPopover.tsx +28 -23
  26. package/client/src/components/RuntimeStateBanner.tsx +5 -0
  27. package/client/src/components/SettingsPanel.tsx +2 -2
  28. package/client/src/components/SkillEditorDialog.tsx +2 -2
  29. package/client/src/components/SkillsSettings.tsx +21 -4
  30. package/client/src/components/TabBar.tsx +91 -9
  31. package/client/src/components/TerminalInput.tsx +15 -11
  32. package/client/src/components/TranscriptSendDialog.tsx +12 -8
  33. package/client/src/components/TranscriptWorkerDialog.tsx +119 -0
  34. package/client/src/components/WorkflowView.tsx +2 -0
  35. package/client/src/components/clusterNeedsYou.ts +11 -18
  36. package/client/src/explorer/ArtifactsLens.tsx +37 -28
  37. package/client/src/explorer/ExplorerApp.tsx +5 -4
  38. package/client/src/explorer/types.ts +8 -3
  39. package/client/src/help/content/cluster.tsx +48 -17
  40. package/client/src/help/content/composer.tsx +40 -1
  41. package/client/src/help/content/header.tsx +18 -1
  42. package/client/src/help/content/misc.tsx +9 -1
  43. package/client/src/help/content/settings.tsx +18 -4
  44. package/client/src/help/content/tabbar.tsx +5 -0
  45. package/client/src/help/manualSections/actions.tsx +31 -0
  46. package/client/src/help/manualSections/clusters.tsx +44 -20
  47. package/client/src/help/manualSections/configuration.tsx +20 -0
  48. package/client/src/help/manualSections/gettingStarted.tsx +4 -4
  49. package/client/src/help/manualSections/maintenance.tsx +25 -6
  50. package/client/src/help/manualSections/powerFeatures.tsx +3 -2
  51. package/client/src/help/manualSections/providers.tsx +32 -8
  52. package/client/src/help/manualSections/troubleshooting.tsx +2 -1
  53. package/client/src/help/manualSections/workflows.tsx +12 -0
  54. package/client/src/help/manualSections/workspace.tsx +36 -0
  55. package/client/src/stores/appStore.ts +7 -0
  56. package/client/src/stores/appStore.types.ts +4 -0
  57. package/client/src/styles/global.css +109 -0
  58. package/client/src/utils/phoneTheme.ts +38 -0
  59. package/client/src/utils/phoneUploadApi.ts +10 -0
  60. package/client/src/utils/transcriptWorkerRequest.ts +24 -0
  61. package/client/src/ws/handleServerMessage.ts +31 -8
  62. package/docs/ARCHITECTURE.md +1 -1
  63. package/docs/CLIENT.md +16 -9
  64. package/docs/FEATURES.md +13 -7
  65. package/docs/GETTING_STARTED.md +12 -6
  66. package/docs/GOTCHAS.md +2 -1
  67. package/docs/INDEX.md +1 -1
  68. package/docs/OPERATIONS.md +213 -52
  69. package/docs/PERSISTENCE.md +7 -2
  70. package/docs/PRIMITIVES.md +42 -0
  71. package/docs/PROTOCOL_CLUSTER.md +51 -4
  72. package/docs/PROTOCOL_PRIMITIVES.md +39 -0
  73. package/docs/PROVIDERS.md +84 -13
  74. package/docs/SETTINGS.md +29 -3
  75. package/docs/TASK_LEDGER.md +7 -15
  76. package/native/linux-x64/manifest.json +1 -1
  77. package/native/win32-x64/manifest.json +1 -1
  78. package/node_modules/@arco/shared/dist/clusterCoordination.d.ts +2 -0
  79. package/node_modules/@arco/shared/dist/clusterCoordination.js +5 -1
  80. package/node_modules/@arco/shared/dist/protocol/chat.d.ts +1 -0
  81. package/node_modules/@arco/shared/dist/protocol/clientMessages.d.ts +3 -2
  82. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +15 -1
  83. package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
  84. package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
  85. package/node_modules/@arco/shared/dist/protocol/models.d.ts +4 -3
  86. package/node_modules/@arco/shared/dist/protocol/models.js +26 -2
  87. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +13 -1
  88. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +4 -0
  89. package/node_modules/@arco/shared/dist/protocol/transcriptWorker.d.ts +47 -0
  90. package/node_modules/@arco/shared/dist/protocol/transcriptWorker.js +2 -0
  91. package/node_modules/@arco/shared/dist/protocol/workflows.d.ts +1 -0
  92. package/node_modules/@arco/shared/dist/runtimeVersions.d.ts +1 -0
  93. package/node_modules/@arco/shared/dist/runtimeVersions.js +14 -0
  94. package/node_modules/@arco/shared/package.json +1 -1
  95. package/package.json +2 -2
  96. package/scripts/packaging/arco.mjs +1 -1
  97. package/scripts/packaging/native-repair.mjs +32 -4
  98. package/server/dist/atomicFile.js +1 -2
  99. package/server/dist/capabilities.d.ts +5 -2
  100. package/server/dist/capabilities.js +59 -9
  101. package/server/dist/cliUpdateDecision.d.ts +1 -1
  102. package/server/dist/cliUpdateDecision.js +5 -3
  103. package/server/dist/clusterDirector.js +2 -1
  104. package/server/dist/clusterPeerOps.js +14 -8
  105. package/server/dist/clusterProgress.js +1 -1
  106. package/server/dist/clusterRehydrate.js +2 -0
  107. package/server/dist/clusterSkills.d.ts +13 -0
  108. package/server/dist/clusterSkills.js +81 -0
  109. package/server/dist/clusterSnapshots.js +2 -0
  110. package/server/dist/clusterStore.d.ts +7 -2
  111. package/server/dist/clusterStore.js +42 -1
  112. package/server/dist/diagnostics/codeSkew.js +1 -0
  113. package/server/dist/eventLog.d.ts +7 -0
  114. package/server/dist/eventLog.js +70 -13
  115. package/server/dist/explorerDocs.d.ts +10 -6
  116. package/server/dist/explorerDocs.js +75 -34
  117. package/server/dist/historyLimits.d.ts +1 -0
  118. package/server/dist/historyLimits.js +3 -0
  119. package/server/dist/http/attachmentUpload.d.ts +13 -0
  120. package/server/dist/http/attachmentUpload.js +38 -0
  121. package/server/dist/http/browserWorktrees.d.ts +23 -0
  122. package/server/dist/http/browserWorktrees.js +120 -0
  123. package/server/dist/http/phoneUploadDrafts.d.ts +13 -0
  124. package/server/dist/http/phoneUploadDrafts.js +125 -0
  125. package/server/dist/http/phoneUploadListener.d.ts +17 -0
  126. package/server/dist/http/phoneUploadListener.js +81 -0
  127. package/server/dist/http/phoneUploadNetwork.d.ts +9 -0
  128. package/server/dist/http/phoneUploadNetwork.js +106 -0
  129. package/server/dist/http/phoneUploadPage.d.ts +2 -0
  130. package/server/dist/http/phoneUploadPage.js +136 -0
  131. package/server/dist/http/phoneUploadRouteHistory.d.ts +4 -0
  132. package/server/dist/http/phoneUploadRouteHistory.js +72 -0
  133. package/server/dist/http/phoneUploadRoutes.d.ts +4 -0
  134. package/server/dist/http/phoneUploadRoutes.js +419 -0
  135. package/server/dist/http/phoneUploadTheme.d.ts +17 -0
  136. package/server/dist/http/phoneUploadTheme.js +96 -0
  137. package/server/dist/http/projectBinding.d.ts +1 -0
  138. package/server/dist/http/projectBinding.js +3 -2
  139. package/server/dist/http/readConfinement.js +5 -1
  140. package/server/dist/http/router.js +14 -25
  141. package/server/dist/http/writeConfinement.js +19 -2
  142. package/server/dist/index.js +24 -1
  143. package/server/dist/jsonlLines.d.ts +4 -0
  144. package/server/dist/jsonlLines.js +53 -0
  145. package/server/dist/management/identity.js +1 -0
  146. package/server/dist/mcp/clusterMcpTools.js +4 -4
  147. package/server/dist/primitives/seedWorker.d.ts +1 -0
  148. package/server/dist/primitives/seedWorker.js +2 -1
  149. package/server/dist/project/taskLedger.d.ts +4 -0
  150. package/server/dist/project/taskLedger.js +7 -4
  151. package/server/dist/providerConversation.d.ts +1 -0
  152. package/server/dist/providerConversation.js +17 -0
  153. package/server/dist/providers/claude-native/resumeSummary.d.ts +9 -0
  154. package/server/dist/providers/claude-native/resumeSummary.js +102 -49
  155. package/server/dist/providers/claude-native/worker.js +8 -4
  156. package/server/dist/providers/claude.js +2 -1
  157. package/server/dist/providers/clusterTaskToolDefinitions.js +4 -4
  158. package/server/dist/providers/codex-appserver/catalog.js +16 -1
  159. package/server/dist/providers/codex-appserver/heldCommands.d.ts +14 -0
  160. package/server/dist/providers/codex-appserver/heldCommands.js +54 -0
  161. package/server/dist/providers/codex-appserver/index.d.ts +52 -2
  162. package/server/dist/providers/codex-appserver/index.js +239 -21
  163. package/server/dist/providers/codex-appserver/lateCommands.d.ts +62 -0
  164. package/server/dist/providers/codex-appserver/lateCommands.js +195 -0
  165. package/server/dist/providers/codex-appserver/worker.d.ts +23 -1
  166. package/server/dist/providers/codex-appserver/worker.js +89 -20
  167. package/server/dist/providers/codex.js +2 -1
  168. package/server/dist/providers/codexCodeMode.d.ts +2 -1
  169. package/server/dist/providers/codexCodeMode.js +8 -3
  170. package/server/dist/providers/cursor/print.js +2 -1
  171. package/server/dist/providers/cursor/worker.js +2 -1
  172. package/server/dist/providers/llamacpp.js +17 -8
  173. package/server/dist/providers/ollamaRecovery.js +6 -6
  174. package/server/dist/providers/ollamaResilience.js +3 -3
  175. package/server/dist/providers/ollamaTokens.js +1 -1
  176. package/server/dist/quota.d.ts +0 -18
  177. package/server/dist/quota.js +0 -44
  178. package/server/dist/replacementHistory.d.ts +19 -0
  179. package/server/dist/replacementHistory.js +49 -0
  180. package/server/dist/server/broadcast.d.ts +2 -1
  181. package/server/dist/server/broadcast.js +1 -0
  182. package/server/dist/server/prompts.d.ts +1 -0
  183. package/server/dist/server/prompts.js +6 -1
  184. package/server/dist/sessionJsonl.d.ts +1 -1
  185. package/server/dist/sessionJsonl.js +115 -40
  186. package/server/dist/smartPickupAdapters.js +15 -2
  187. package/server/dist/transcriptWorker.d.ts +34 -0
  188. package/server/dist/transcriptWorker.js +201 -0
  189. package/server/dist/workers/WorkerManager.d.ts +1 -0
  190. package/server/dist/workers/WorkerManager.js +1 -0
  191. package/server/dist/workers/processKill.d.ts +9 -1
  192. package/server/dist/workers/processKill.js +26 -10
  193. package/server/dist/workflowStore.d.ts +1 -0
  194. package/server/dist/workflowStore.js +31 -0
  195. package/server/dist/ws/clusterHandlers.d.ts +1 -0
  196. package/server/dist/ws/clusterHandlers.js +62 -26
  197. package/server/dist/ws/handoffHandlers.js +7 -2
  198. package/server/dist/ws/transcriptWorkerHandlers.d.ts +25 -0
  199. package/server/dist/ws/transcriptWorkerHandlers.js +139 -0
  200. package/server/dist/ws/turnEngine.js +40 -9
  201. package/server/dist/ws/updatePrimaryConfig.js +27 -8
  202. package/server/dist/ws/workflowHandlers.d.ts +4 -1
  203. package/server/dist/ws/workflowHandlers.js +3 -1
  204. package/server/package.json +1 -1
  205. package/server/src/atomicFile.ts +1 -2
  206. package/server/src/capabilities.ts +58 -17
  207. package/server/src/cliUpdateDecision.ts +5 -4
  208. package/server/src/clusterDirector.ts +2 -1
  209. package/server/src/clusterPeerOps.ts +15 -9
  210. package/server/src/clusterProgress.ts +1 -1
  211. package/server/src/clusterRehydrate.ts +2 -0
  212. package/server/src/clusterSkills.ts +79 -0
  213. package/server/src/clusterSnapshots.ts +1 -0
  214. package/server/src/clusterStore.ts +38 -0
  215. package/server/src/diagnostics/codeSkew.ts +1 -0
  216. package/server/src/eventLog.ts +73 -13
  217. package/server/src/explorerDocs.ts +75 -34
  218. package/server/src/historyLimits.ts +2 -0
  219. package/server/src/http/attachmentUpload.ts +49 -0
  220. package/server/src/http/browserWorktrees.ts +124 -0
  221. package/server/src/http/phoneUploadDrafts.ts +118 -0
  222. package/server/src/http/phoneUploadListener.ts +96 -0
  223. package/server/src/http/phoneUploadNetwork.ts +117 -0
  224. package/server/src/http/phoneUploadPage.ts +137 -0
  225. package/server/src/http/phoneUploadRouteHistory.ts +73 -0
  226. package/server/src/http/phoneUploadRoutes.ts +398 -0
  227. package/server/src/http/phoneUploadTheme.ts +97 -0
  228. package/server/src/http/projectBinding.ts +3 -2
  229. package/server/src/http/readConfinement.ts +5 -1
  230. package/server/src/http/router.ts +12 -26
  231. package/server/src/http/writeConfinement.ts +13 -2
  232. package/server/src/index.ts +23 -0
  233. package/server/src/jsonlLines.ts +52 -0
  234. package/server/src/management/identity.ts +1 -0
  235. package/server/src/mcp/clusterMcpTools.ts +4 -4
  236. package/server/src/primitives/seedWorker.ts +3 -1
  237. package/server/src/project/taskLedger.ts +7 -5
  238. package/server/src/providerConversation.ts +15 -0
  239. package/server/src/providers/claude-native/resumeSummary.ts +98 -50
  240. package/server/src/providers/claude-native/worker.ts +8 -4
  241. package/server/src/providers/claude.ts +2 -1
  242. package/server/src/providers/clusterTaskToolDefinitions.ts +4 -4
  243. package/server/src/providers/codex-appserver/catalog.ts +14 -1
  244. package/server/src/providers/codex-appserver/heldCommands.ts +58 -0
  245. package/server/src/providers/codex-appserver/index.ts +222 -20
  246. package/server/src/providers/codex-appserver/lateCommands.ts +225 -0
  247. package/server/src/providers/codex-appserver/worker.ts +85 -21
  248. package/server/src/providers/codex.ts +2 -1
  249. package/server/src/providers/codexCodeMode.ts +9 -4
  250. package/server/src/providers/cursor/print.ts +2 -1
  251. package/server/src/providers/cursor/worker.ts +2 -1
  252. package/server/src/providers/llamacpp.ts +18 -7
  253. package/server/src/providers/llamacppRecovery.ts +2 -0
  254. package/server/src/providers/ollamaRecovery.ts +6 -6
  255. package/server/src/providers/ollamaResilience.ts +3 -3
  256. package/server/src/providers/ollamaTokens.ts +1 -1
  257. package/server/src/providers/ollamaToolSubset.ts +3 -3
  258. package/server/src/quota.ts +0 -50
  259. package/server/src/replacementHistory.ts +44 -0
  260. package/server/src/server/broadcast.ts +2 -0
  261. package/server/src/server/prompts.ts +8 -1
  262. package/server/src/sessionJsonl.ts +92 -32
  263. package/server/src/smartPickupAdapters.ts +17 -3
  264. package/server/src/transcriptWorker.ts +182 -0
  265. package/server/src/workers/WorkerManager.ts +2 -0
  266. package/server/src/workers/processKill.ts +35 -7
  267. package/server/src/workflowStore.ts +21 -0
  268. package/server/src/ws/clusterHandlers.ts +43 -25
  269. package/server/src/ws/handoffHandlers.ts +7 -1
  270. package/server/src/ws/transcriptWorkerHandlers.ts +126 -0
  271. package/server/src/ws/turnEngine.ts +35 -8
  272. package/server/src/ws/updatePrimaryConfig.ts +25 -6
  273. package/server/src/ws/workflowHandlers.ts +3 -1
  274. package/shared/dist/clusterCoordination.d.ts +2 -0
  275. package/shared/dist/clusterCoordination.js +5 -1
  276. package/shared/dist/protocol/chat.d.ts +1 -0
  277. package/shared/dist/protocol/clientMessages.d.ts +3 -2
  278. package/shared/dist/protocol/clusters.d.ts +15 -1
  279. package/shared/dist/protocol/index.d.ts +1 -0
  280. package/shared/dist/protocol/index.js +1 -0
  281. package/shared/dist/protocol/models.d.ts +4 -3
  282. package/shared/dist/protocol/models.js +26 -2
  283. package/shared/dist/protocol/serverMessages.d.ts +13 -1
  284. package/shared/dist/protocol/tasks.d.ts +4 -0
  285. package/shared/dist/protocol/transcriptWorker.d.ts +47 -0
  286. package/shared/dist/protocol/transcriptWorker.js +2 -0
  287. package/shared/dist/protocol/workflows.d.ts +1 -0
  288. package/shared/dist/runtimeVersions.d.ts +1 -0
  289. package/shared/dist/runtimeVersions.js +14 -0
  290. package/shared/src/clusterCoordination.ts +7 -1
  291. package/shared/src/protocol/chat.ts +1 -0
  292. package/shared/src/protocol/clientMessages.ts +5 -0
  293. package/shared/src/protocol/clusters.ts +20 -6
  294. package/shared/src/protocol/index.ts +1 -0
  295. package/shared/src/protocol/models.ts +31 -5
  296. package/shared/src/protocol/serverMessages.ts +13 -0
  297. package/shared/src/protocol/settings.ts +2 -3
  298. package/shared/src/protocol/tasks.ts +4 -7
  299. package/shared/src/protocol/transcriptWorker.ts +49 -0
  300. package/shared/src/protocol/workflows.ts +4 -0
  301. package/shared/src/runtimeVersions.ts +14 -0
@@ -0,0 +1,120 @@
1
+ // A read grant for a single Git-confirmed checkout. This does not register the
2
+ // checkout with the global project roots or use the managed-task write grant.
3
+ import { realpath } from 'node:fs';
4
+ import { lstat } from 'node:fs/promises';
5
+ import { homedir } from 'node:os';
6
+ import path from 'node:path';
7
+ import { promisify } from 'node:util';
8
+ import { FileAccessError, isPathWithin } from '../fileAccessPolicy.js';
9
+ import { gitOutput } from './projectBinding.js';
10
+ const nativePath = promisify(realpath.native);
11
+ const samePath = (a, b) => path.relative(a, b) === '';
12
+ function refuseArcoState(target) {
13
+ if (path.resolve(target).split(path.sep).some(part => part.toLowerCase() === '.arco'))
14
+ throw new FileAccessError();
15
+ }
16
+ async function gitDirectory(cwd, arg, signal) {
17
+ const stdout = await gitOutput(cwd, ['rev-parse', '--path-format=absolute', arg], signal);
18
+ return nativePath(stdout.replace(process.platform === 'win32' ? /\r?\n$/ : /\n$/, ''));
19
+ }
20
+ export async function browserWorktreeRegistry(boundCwd, signal) {
21
+ try {
22
+ const output = await gitOutput(boundCwd, ['worktree', 'list', '--porcelain', '-z'], signal);
23
+ const entries = output.split('\0\0').flatMap(record => {
24
+ const [worktree, ...fields] = record.split('\0');
25
+ if (!worktree.startsWith('worktree ') || fields.some(field => /^(bare|prunable)( |$)/.test(field)))
26
+ return [];
27
+ const directory = path.normalize(worktree.slice('worktree '.length));
28
+ const branch = fields.find(field => field.startsWith('branch refs/heads/'))?.slice('branch refs/heads/'.length);
29
+ const head = fields.find(field => /^HEAD [0-9a-f]{7,64}$/.test(field))?.slice(5, 12);
30
+ return path.isAbsolute(directory) && (branch || head)
31
+ ? [{ directory, branch: branch || ('Detached HEAD ' + head) }] : [];
32
+ });
33
+ if (entries.length < 2)
34
+ return null;
35
+ const [checkout, common] = await Promise.all([
36
+ gitDirectory(boundCwd, '--show-toplevel', signal),
37
+ gitDirectory(boundCwd, '--git-common-dir', signal),
38
+ ]);
39
+ return { checkout, common, entries: entries.filter(entry => !samePath(entry.directory, checkout)) };
40
+ }
41
+ catch {
42
+ return null;
43
+ }
44
+ }
45
+ export async function confirmBrowserWorktree(registry, entry, access, signal) {
46
+ try {
47
+ refuseArcoState(entry.directory);
48
+ const root = await lstat(entry.directory);
49
+ if (!root.isDirectory())
50
+ return null;
51
+ const canonical = await access.safeDirectory(entry.directory);
52
+ refuseArcoState(canonical);
53
+ const real = await nativePath(canonical);
54
+ access.assertSafePath(real);
55
+ const home = await nativePath(homedir()).catch(() => homedir());
56
+ if (samePath(real, registry.checkout) || samePath(real, path.parse(real).root) || isPathWithin(real, home))
57
+ return null;
58
+ const [top, common] = await Promise.all([
59
+ gitDirectory(real, '--show-toplevel', signal),
60
+ gitDirectory(real, '--git-common-dir', signal),
61
+ ]);
62
+ if (!samePath(real, top) || !samePath(common, registry.common))
63
+ return null;
64
+ return { ...entry, canonical, native: real, device: root.dev, inode: root.ino };
65
+ }
66
+ catch {
67
+ return null;
68
+ }
69
+ }
70
+ export async function browserWorktreeFile(target, tree, access) {
71
+ refuseArcoState(target);
72
+ if (!isPathWithin(tree.directory, target) && !isPathWithin(tree.canonical, target))
73
+ throw new FileAccessError();
74
+ const { real } = await access.inspect(target, undefined, 'file');
75
+ // Git for Windows and Node may spell the same directory differently when
76
+ // a parent has an 8.3 name. Compare both resolved paths in native spelling.
77
+ const expanded = await nativePath(real);
78
+ access.assertSafePath(expanded);
79
+ refuseArcoState(real);
80
+ refuseArcoState(expanded);
81
+ if (!isPathWithin(tree.native, expanded))
82
+ throw new FileAccessError();
83
+ const root = await lstat(tree.directory);
84
+ if (!root.isDirectory() || root.dev !== tree.device || root.ino !== tree.inode)
85
+ throw new FileAccessError();
86
+ return real;
87
+ }
88
+ export async function resolveWorktreeFile(target, boundCwd, access) {
89
+ const registry = await browserWorktreeRegistry(boundCwd);
90
+ if (!registry)
91
+ throw new FileAccessError();
92
+ let alias;
93
+ let entry = registry.entries.filter(candidate => isPathWithin(candidate.directory, target))
94
+ .sort((a, b) => b.directory.length - a.directory.length)[0];
95
+ if (!entry) {
96
+ // Parent aliases occur on macOS and Windows. Match the root's expanded
97
+ // spelling but keep the request's spelling for read confinement below.
98
+ const spellings = await Promise.all(registry.entries.map(async (candidate) => ({
99
+ candidate,
100
+ real: await nativePath(candidate.directory).catch(() => null),
101
+ })));
102
+ for (let dir = path.dirname(target); dir !== path.dirname(dir); dir = path.dirname(dir)) {
103
+ const stat = await lstat(dir).catch(() => null);
104
+ if (!stat?.isDirectory())
105
+ continue;
106
+ const real = await nativePath(dir);
107
+ const registered = spellings.find(candidate => candidate.real && samePath(candidate.real, real))?.candidate;
108
+ if (registered) {
109
+ entry = registered;
110
+ alias = dir;
111
+ break;
112
+ }
113
+ }
114
+ }
115
+ const verified = entry && await confirmBrowserWorktree(registry, entry, access);
116
+ if (!verified)
117
+ throw new FileAccessError();
118
+ return browserWorktreeFile(target, alias ? { ...verified, directory: alias } : verified, access);
119
+ }
120
+ //# sourceMappingURL=browserWorktrees.js.map
@@ -0,0 +1,13 @@
1
+ import type { StoredAttachment } from './attachmentUpload.js';
2
+ export declare const PHONE_DRAFT_TTL_MS: number;
3
+ export interface PhoneDraft extends StoredAttachment {
4
+ workflowId: string;
5
+ owner: string;
6
+ expiresAt: number;
7
+ }
8
+ export declare function phoneFilename(name: string): string;
9
+ export declare function rememberPhoneDraft(entry: PhoneDraft): Promise<void>;
10
+ export declare function phoneDraftForOwner(id: string, owner: string): PhoneDraft | null;
11
+ export declare function discardPhoneDraft(entry: PhoneDraft): Promise<void>;
12
+ export declare function adoptPhoneDrafts(workflowId: string, attachments: readonly string[] | undefined): boolean;
13
+ export declare function sweepPhoneDrafts(): Promise<void>;
@@ -0,0 +1,125 @@
1
+ import { lstatSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
2
+ import { basename, join } from 'node:path';
3
+ import { arcoHome } from '../arcoHome.js';
4
+ import { UPLOADS_DIR, UUID_PATTERN } from '../server/constants.js';
5
+ import { ensureStorageRoot } from '../storageRoot.js';
6
+ export const PHONE_DRAFT_TTL_MS = 30 * 60_000;
7
+ const ROOT_NAME = '.phone-upload-drafts';
8
+ function recordsDirectory() {
9
+ return join(arcoHome(), ROOT_NAME);
10
+ }
11
+ function recordPath(fileId) {
12
+ if (!UUID_PATTERN.test(fileId))
13
+ throw new Error('Invalid phone upload ID');
14
+ return join(recordsDirectory(), fileId + '.json');
15
+ }
16
+ function safeName(filename) {
17
+ return typeof filename === 'string' && /^[\p{L}\p{N}_()-][\p{L}\p{N} ._()-]{0,119}$/u.test(filename);
18
+ }
19
+ export function phoneFilename(name) {
20
+ const cleaned = name.normalize('NFC').replace(/[^\p{L}\p{N} ._()-]/gu, '_').replace(/^[. ]+|[. ]+$/g, '');
21
+ // A Windows file system also observes the extension after Unicode sanitizing.
22
+ return safeName(cleaned) ? cleaned : '';
23
+ }
24
+ function readRecord(id) {
25
+ try {
26
+ const directory = lstatSync(recordsDirectory());
27
+ if (!directory.isDirectory() || directory.isSymbolicLink())
28
+ return null;
29
+ const target = recordPath(id);
30
+ const stat = lstatSync(target);
31
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 4096)
32
+ return null;
33
+ const entry = JSON.parse(readFileSync(target, 'utf8'));
34
+ if (entry.fileId !== id || !safeName(entry.filename) || typeof entry.path !== 'string'
35
+ || basename(entry.path) !== `${id}-${entry.filename}` || typeof entry.owner !== 'string'
36
+ || typeof entry.workflowId !== 'string' || typeof entry.expiresAt !== 'number'
37
+ || !Number.isSafeInteger(entry.expiresAt))
38
+ return null;
39
+ return entry;
40
+ }
41
+ catch {
42
+ return null;
43
+ }
44
+ }
45
+ export async function rememberPhoneDraft(entry) {
46
+ const directory = await ensureStorageRoot(recordsDirectory());
47
+ writeFileSync(join(directory, entry.fileId + '.json'), JSON.stringify(entry), { flag: 'wx', mode: 0o600 });
48
+ }
49
+ export function phoneDraftForOwner(id, owner) {
50
+ const entry = readRecord(id);
51
+ return entry && entry.owner === owner && entry.expiresAt > Date.now() ? entry : null;
52
+ }
53
+ export async function discardPhoneDraft(entry) {
54
+ const directory = await ensureStorageRoot(UPLOADS_DIR, false);
55
+ // Send may take ownership while the directory check is in flight.
56
+ if (readRecord(entry.fileId)?.path !== entry.path)
57
+ return;
58
+ const path = join(directory, `${entry.fileId}-${entry.filename}`);
59
+ // Delete only a filename generated for this phone receipt, never a path
60
+ // supplied by the phone or stored in the receipt.
61
+ for (const name of [path, path + '.model.png', path + '.model.jpg']) {
62
+ try {
63
+ unlinkSync(name);
64
+ }
65
+ catch (error) {
66
+ if (error.code !== 'ENOENT')
67
+ throw error;
68
+ }
69
+ }
70
+ forgetRecord(entry.fileId);
71
+ }
72
+ function forgetRecord(fileId) {
73
+ try {
74
+ unlinkSync(recordPath(fileId));
75
+ }
76
+ catch (error) {
77
+ if (error.code !== 'ENOENT')
78
+ throw error;
79
+ }
80
+ }
81
+ // Called only at the send acceptance points. Removing the cleanup receipt
82
+ // before queuing or starting the turn keeps sent attachments in history.
83
+ export function adoptPhoneDrafts(workflowId, attachments) {
84
+ const entries = [];
85
+ for (const path of attachments ?? []) {
86
+ const id = basename(path).slice(0, 36);
87
+ if (!UUID_PATTERN.test(id))
88
+ continue;
89
+ const entry = readRecord(id);
90
+ if (!entry)
91
+ continue;
92
+ if (entry.workflowId !== workflowId || entry.path !== path || entry.expiresAt <= Date.now())
93
+ return false;
94
+ entries.push(entry);
95
+ }
96
+ for (const entry of entries)
97
+ forgetRecord(entry.fileId);
98
+ return true;
99
+ }
100
+ let sweeping = false;
101
+ export async function sweepPhoneDrafts() {
102
+ if (sweeping)
103
+ return;
104
+ sweeping = true;
105
+ try {
106
+ const directory = lstatSync(recordsDirectory());
107
+ if (!directory.isDirectory() || directory.isSymbolicLink())
108
+ return;
109
+ for (const file of readdirSync(recordsDirectory())) {
110
+ if (!file.endsWith('.json'))
111
+ continue;
112
+ const entry = readRecord(file.slice(0, -5));
113
+ if (entry && entry.expiresAt <= Date.now())
114
+ await discardPhoneDraft(entry).catch(() => { });
115
+ }
116
+ }
117
+ catch {
118
+ // No phone uploads yet, or managed storage is unavailable.
119
+ }
120
+ finally {
121
+ sweeping = false;
122
+ }
123
+ }
124
+ setInterval(() => { void sweepPhoneDrafts(); }, 30_000).unref();
125
+ //# sourceMappingURL=phoneUploadDrafts.js.map
@@ -0,0 +1,17 @@
1
+ import { type IncomingMessage, type Server, type ServerResponse } from 'node:http';
2
+ export interface PhoneListener {
3
+ origins: string[];
4
+ close(): void;
5
+ }
6
+ type Handler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
7
+ /** An HTTP server that answers only the phone upload path and refuses everything else. */
8
+ export declare function createPhoneServer(handler: Handler): Server;
9
+ export declare function _bindPhoneListenerForTest(map: ((address: string) => string) | null): void;
10
+ /**
11
+ * Bind one phone server per address. Arco's own port is tried first, so a
12
+ * firewall rule for that port also covers phones; when it is taken on an
13
+ * address, the system picks a free port there. Addresses that cannot be
14
+ * bound are left out.
15
+ */
16
+ export declare function startPhoneListener(addresses: string[], preferredPort: number, handler: Handler): Promise<PhoneListener>;
17
+ export {};
@@ -0,0 +1,81 @@
1
+ import http from 'node:http';
2
+ const PHONE_PATH = '/phone-upload';
3
+ function notFound(res) {
4
+ res.writeHead(404, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store', Connection: 'close' });
5
+ res.end(JSON.stringify({ error: 'Not found.' }));
6
+ }
7
+ /** An HTTP server that answers only the phone upload path and refuses everything else. */
8
+ export function createPhoneServer(handler) {
9
+ const server = http.createServer((req, res) => {
10
+ if (req.url !== PHONE_PATH || req.headers.upgrade)
11
+ return notFound(res);
12
+ handler(req, res).catch(() => {
13
+ if (!res.headersSent)
14
+ res.writeHead(500, { 'Content-Type': 'application/json' });
15
+ res.end();
16
+ });
17
+ });
18
+ server.on('upgrade', (_req, socket) => { socket.destroy(); });
19
+ server.headersTimeout = 15_000;
20
+ server.requestTimeout = 5 * 60_000;
21
+ server.keepAliveTimeout = 5_000;
22
+ server.maxConnections = 32;
23
+ return server;
24
+ }
25
+ // Tests bind the listener to loopback while it reports a fixture private
26
+ // address, so the operator route can be exercised without that interface.
27
+ let bindAddressForTest = null;
28
+ export function _bindPhoneListenerForTest(map) {
29
+ bindAddressForTest = map;
30
+ }
31
+ function listen(server, address, port) {
32
+ return new Promise((resolve, reject) => {
33
+ server.once('error', reject);
34
+ server.listen(port, address, () => {
35
+ server.off('error', reject);
36
+ const bound = server.address();
37
+ resolve(typeof bound === 'object' && bound ? bound.port : port);
38
+ });
39
+ });
40
+ }
41
+ /**
42
+ * Bind one phone server per address. Arco's own port is tried first, so a
43
+ * firewall rule for that port also covers phones; when it is taken on an
44
+ * address, the system picks a free port there. Addresses that cannot be
45
+ * bound are left out.
46
+ */
47
+ export async function startPhoneListener(addresses, preferredPort, handler) {
48
+ const servers = [];
49
+ const origins = [];
50
+ for (const address of addresses) {
51
+ let reason = '';
52
+ for (const port of preferredPort ? [preferredPort, 0] : [0]) {
53
+ const server = createPhoneServer(handler);
54
+ try {
55
+ const bound = await listen(server, bindAddressForTest?.(address) ?? address, port);
56
+ server.on('error', error => console.warn(`[arco] phone upload listener: ${error.message}`));
57
+ servers.push(server);
58
+ origins.push(new URL(`http://${address}:${bound}`).origin);
59
+ reason = '';
60
+ break;
61
+ }
62
+ catch (e) {
63
+ reason = e.code ?? 'unknown error';
64
+ server.close();
65
+ }
66
+ }
67
+ // The error code only: the address itself stays out of the log.
68
+ if (reason)
69
+ console.warn(`[arco] phone upload listener could not bind a private address: ${reason}`);
70
+ }
71
+ return {
72
+ origins,
73
+ close() {
74
+ for (const server of servers) {
75
+ server.close();
76
+ server.closeIdleConnections();
77
+ }
78
+ },
79
+ };
80
+ }
81
+ //# sourceMappingURL=phoneUploadListener.js.map
@@ -0,0 +1,9 @@
1
+ import type { IncomingMessage } from 'node:http';
2
+ /**
3
+ * The IPv4 private network and tailnet addresses of this machine that a
4
+ * phone could reach, container bridges excluded. The temporary phone
5
+ * listener binds each one separately, never a wildcard.
6
+ */
7
+ export declare function phoneListenerAddresses(): string[];
8
+ export declare function phoneUploadOrigins(req: IncomingMessage): string[];
9
+ export declare function privatePhoneOrigin(req: IncomingMessage): string | undefined;
@@ -0,0 +1,106 @@
1
+ import { BlockList, isIP } from 'node:net';
2
+ import os from 'node:os';
3
+ import { HOST } from '../server/constants.js';
4
+ const privateNetworks = new BlockList();
5
+ // RFC 1918 IPv4 network prefixes, in octets.
6
+ for (const [first, second, prefix] of [[10, 0, 8], [172, 16, 12], [192, 168, 16]]) {
7
+ privateNetworks.addSubnet([first, second, 0, 0].join('.'), prefix);
8
+ }
9
+ privateNetworks.addSubnet('fc00::', 7, 'ipv6');
10
+ const tailscaleNetworks = new BlockList();
11
+ tailscaleNetworks.addSubnet([100, 64, 0, 0].join('.'), 10);
12
+ tailscaleNetworks.addSubnet('fd7a:115c:a1e0::', 48, 'ipv6');
13
+ function address(ip) {
14
+ return (ip ?? '').replace(/^::ffff:(?=\d)/i, '').split('%')[0].toLowerCase();
15
+ }
16
+ function family(ip) {
17
+ return isIP(ip) === 6 ? 'ipv6' : 'ipv4';
18
+ }
19
+ function loopback(ip) {
20
+ return ip === '::1' || /^127\./.test(ip);
21
+ }
22
+ function isDirect(req) {
23
+ return !req.headers.forwarded && !req.headers['x-forwarded-for']
24
+ && !req.headers['x-forwarded-proto'] && !req.headers['x-forwarded-host'];
25
+ }
26
+ function privateInterface(entry, tailnet, port) {
27
+ if (entry.internal || !entry.cidr)
28
+ return null;
29
+ const ip = address(entry.address);
30
+ const kind = family(ip);
31
+ const isTailnet = tailnet && tailscaleNetworks.check(ip, kind);
32
+ if (!isTailnet && !privateNetworks.check(ip, kind))
33
+ return null;
34
+ const peers = isTailnet ? tailscaleNetworks : new BlockList();
35
+ if (!isTailnet) {
36
+ const prefix = Number(entry.cidr.split('/')[1]);
37
+ if (prefix <= 0 || prefix > (kind === 'ipv4' ? 32 : 128))
38
+ return null;
39
+ peers.addSubnet(ip, prefix, kind);
40
+ }
41
+ const host = kind === 'ipv6' ? `[${ip}]` : ip;
42
+ return { address: ip, origin: new URL(`http://${host}:${port}`).origin, peers, tailnet: isTailnet };
43
+ }
44
+ function canReach(network, peer) {
45
+ const kind = family(peer);
46
+ return isIP(peer) !== 0 && (network.tailnet ? tailscaleNetworks : privateNetworks).check(peer, kind)
47
+ && network.peers.check(peer, kind);
48
+ }
49
+ // The private addresses the running listener serves. This depends only on
50
+ // the listener and the machine's interfaces, never on the URL or route the
51
+ // desktop page used: a page opened by machine name, by another address or
52
+ // through a proxy is offered the same direct addresses a phone can reach.
53
+ // A wildcard listener serves every private interface (container bridges
54
+ // excluded); a listener bound to one address serves only that address.
55
+ function privateListeners(req) {
56
+ if (!req.socket.localPort || req.socket.encrypted)
57
+ return [];
58
+ const local = address(req.socket.localAddress);
59
+ const wildcard = HOST === '::' || HOST === '0.0.0.0';
60
+ const networks = new Map();
61
+ for (const [name, entries] of Object.entries(os.networkInterfaces())) {
62
+ if (wildcard && /^(docker|veth|virbr|br-)/i.test(name))
63
+ continue;
64
+ const tailnet = /tailscale/i.test(name) || !!entries?.some(entry => /^fd7a:115c:a1e0:/i.test(entry.address));
65
+ for (const entry of entries ?? []) {
66
+ const ip = address(entry.address);
67
+ if (wildcard ? HOST === '0.0.0.0' && family(ip) !== 'ipv4' : ip !== local)
68
+ continue;
69
+ const network = privateInterface(entry, tailnet, req.socket.localPort);
70
+ if (network)
71
+ networks.set(network.origin, network);
72
+ }
73
+ }
74
+ return [...networks.values()];
75
+ }
76
+ /**
77
+ * The IPv4 private network and tailnet addresses of this machine that a
78
+ * phone could reach, container bridges excluded. The temporary phone
79
+ * listener binds each one separately, never a wildcard.
80
+ */
81
+ export function phoneListenerAddresses() {
82
+ const found = new Set();
83
+ for (const [name, entries] of Object.entries(os.networkInterfaces())) {
84
+ if (/^(docker|veth|virbr|br-)/i.test(name))
85
+ continue;
86
+ const tailnet = /tailscale/i.test(name) || !!entries?.some(entry => /^fd7a:115c:a1e0:/i.test(entry.address));
87
+ for (const entry of entries ?? []) {
88
+ const network = family(address(entry.address)) === 'ipv4' ? privateInterface(entry, tailnet, 1) : null;
89
+ if (network)
90
+ found.add(network.address);
91
+ }
92
+ }
93
+ return [...found];
94
+ }
95
+ export function phoneUploadOrigins(req) {
96
+ return privateListeners(req).map(network => network.origin);
97
+ }
98
+ export function privatePhoneOrigin(req) {
99
+ const local = address(req.socket.localAddress);
100
+ const peer = address(req.socket.remoteAddress);
101
+ if (!isDirect(req) || !isIP(peer) || loopback(peer))
102
+ return undefined;
103
+ return privateListeners(req).find(network => network.address === local
104
+ && canReach(network, peer) && req.headers.host === new URL(network.origin).host)?.origin;
105
+ }
106
+ //# sourceMappingURL=phoneUploadNetwork.js.map
@@ -0,0 +1,2 @@
1
+ export declare const PHONE_PAGE_CSP: string;
2
+ export declare const PHONE_PAGE: string;
@@ -0,0 +1,136 @@
1
+ import { createHash } from 'node:crypto';
2
+ const script = String.raw `
3
+ const token = location.hash.slice(1);
4
+ history.replaceState(null, '', location.pathname);
5
+ const status = document.querySelector('#status');
6
+ const controls = [...document.querySelectorAll('input')];
7
+ const progress = document.querySelector('progress');
8
+ const errors = [];
9
+ let uploading = false;
10
+ let finished = 0;
11
+
12
+ // The look of Arco on the computer when the code was opened: checked theme
13
+ // values and, when the theme uses one, a font bundled with Arco. Read with
14
+ // the token from the same path; a failure leaves the plain page.
15
+ function read(headers, type) {
16
+ return new Promise(resolve => {
17
+ const req = new XMLHttpRequest();
18
+ req.open('GET', '/phone-upload');
19
+ req.responseType = type;
20
+ req.timeout = 15000;
21
+ for (const [name, value] of Object.entries(headers)) req.setRequestHeader(name, value);
22
+ req.onload = () => resolve(req.status === 200 ? req.response : null);
23
+ req.onerror = req.ontimeout = () => resolve(null);
24
+ req.send();
25
+ });
26
+ }
27
+
28
+ async function applyTheme() {
29
+ const reply = await read({ 'X-Arco-Phone-Upload': token }, 'json');
30
+ const theme = reply && reply.theme;
31
+ if (!theme) return;
32
+ const root = document.documentElement;
33
+ for (const [name, value] of Object.entries(theme.vars || {})) {
34
+ if (/^[a-z-]+$/.test(name) && typeof value === 'string') root.style.setProperty('--' + name, value);
35
+ }
36
+ if (theme.scheme === 'light' || theme.scheme === 'dark') root.style.colorScheme = theme.scheme;
37
+ if (!document.fonts || typeof FontFace !== 'function') return;
38
+ for (const font of theme.fonts || []) {
39
+ const bytes = await read({ 'X-Arco-Phone-Upload': token, 'X-Arco-Phone-Font': font.id }, 'arraybuffer');
40
+ if (!bytes) continue;
41
+ try { document.fonts.add(await new FontFace(font.family, bytes, { weight: font.weight }).load()); } catch {}
42
+ }
43
+ }
44
+
45
+ function disable(value) {
46
+ for (const input of controls) input.disabled = value;
47
+ }
48
+
49
+ function upload(file) {
50
+ return new Promise(resolve => {
51
+ const req = new XMLHttpRequest();
52
+ req.open('POST', '/phone-upload');
53
+ req.timeout = 5 * 60 * 1000;
54
+ req.setRequestHeader('X-Arco-Phone-Upload', token);
55
+ req.setRequestHeader('Content-Type', file.type || 'application/octet-stream');
56
+ req.setRequestHeader('X-Filename', encodeURIComponent(file.name));
57
+ req.upload.onprogress = event => {
58
+ if (event.lengthComputable) progress.value = event.loaded / event.total;
59
+ };
60
+ req.onload = () => {
61
+ if (req.status === 201) return resolve({ ok: true });
62
+ try { resolve({ error: JSON.parse(req.responseText).error, expired: req.status === 410 }); }
63
+ catch { resolve({ error: 'Upload failed.' }); }
64
+ };
65
+ req.onerror = req.ontimeout = () => resolve({ error: 'Connection lost. Try again on the same private network.' });
66
+ req.send(file);
67
+ });
68
+ }
69
+
70
+ if (!/^[\w-]{43}$/.test(token)) {
71
+ disable(true);
72
+ status.textContent = 'Scan a new code from Arco to upload.';
73
+ } else {
74
+ void applyTheme();
75
+ for (const input of controls) input.addEventListener('change', async () => {
76
+ const files = [...input.files];
77
+ input.value = '';
78
+ if (uploading || !files.length) return;
79
+ uploading = true;
80
+ disable(true);
81
+ errors.length = 0;
82
+ for (const file of files) {
83
+ status.textContent = 'Uploading ' + file.name + '…';
84
+ delete status.dataset.state;
85
+ progress.hidden = false;
86
+ progress.value = 0;
87
+ const result = file.size > 20 * 1024 * 1024
88
+ ? { error: 'This file is over 20 MiB.' } : await upload(file);
89
+ if (result.expired) {
90
+ status.textContent = result.error;
91
+ status.dataset.state = 'error';
92
+ progress.hidden = true;
93
+ return;
94
+ }
95
+ if (result.ok) finished++;
96
+ else errors.push(file.name + ': ' + result.error);
97
+ }
98
+ progress.hidden = true;
99
+ status.textContent = [finished + ' uploaded. Review and send from Arco.', ...errors].join(' ');
100
+ status.dataset.state = errors.length ? 'error' : 'done';
101
+ uploading = false;
102
+ disable(false);
103
+ });
104
+ }
105
+ `;
106
+ export const PHONE_PAGE_CSP = `default-src 'none'; script-src 'sha256-${createHash('sha256').update(script).digest('base64')}'; connect-src 'self'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'`;
107
+ export const PHONE_PAGE = `<!doctype html>
108
+ <html lang="en">
109
+ <meta charset="utf-8">
110
+ <meta name="viewport" content="width=device-width,initial-scale=1">
111
+ <title>Upload to Arco</title>
112
+ <style>
113
+ :root { color-scheme: light dark; }
114
+ body { margin: 0; padding: 2rem 1rem; font: 1rem/1.45 var(--font-body, system-ui, sans-serif); color: var(--color-fg, CanvasText); background: var(--color-bg, Canvas); }
115
+ main { max-width: 30rem; margin: 0 auto; }
116
+ h1 { margin: 0 0 1rem; font: 700 1.25rem/1.2 var(--font-display, var(--font-body, system-ui, sans-serif)); letter-spacing: .05em; color: var(--color-accent-primary, inherit); }
117
+ label { display: block; margin: 1rem 0; padding: .75rem; font-family: var(--font-display, inherit); font-weight: 600; background: var(--color-bg-dialog, transparent); border: var(--border-width, 1px) solid var(--color-border, GrayText); border-radius: var(--radius-sm, .3rem); }
118
+ input { display: block; box-sizing: border-box; width: 100%; margin-top: .5rem; min-height: 2.75rem; font: 400 .9rem var(--font-body, inherit); color: var(--color-control-fg, inherit); }
119
+ input::file-selector-button { min-height: 2.75rem; margin-right: .75rem; padding: .35rem .75rem; font: 600 .9rem var(--font-display, inherit); color: var(--color-accent-primary, ButtonText); background: var(--color-bg, ButtonFace); border: var(--border-width, 1px) solid var(--color-accent-primary, ButtonBorder); border-radius: var(--radius-sm, .3rem); }
120
+ input:focus-visible { outline: 2px solid var(--color-accent-primary, Highlight); outline-offset: 2px; }
121
+ input:disabled { opacity: .6; }
122
+ progress { width: 100%; accent-color: var(--color-accent-primary, auto); }
123
+ #status { overflow-wrap: anywhere; color: var(--color-fg-muted, inherit); }
124
+ #status[data-state="done"] { color: var(--color-success, inherit); }
125
+ #status[data-state="error"] { color: var(--color-error, inherit); }
126
+ </style>
127
+ <main>
128
+ <h1>Upload to Arco</h1>
129
+ <label>Take Photo <input type="file" accept="image/*" capture="environment"></label>
130
+ <label>Choose Files <input type="file" multiple accept="image/*,.pdf,.txt,.md,.csv,.rtf,.docx,.xlsx,.pptx,.odt,.ods,.odp"></label>
131
+ <p role="status" id="status">Up to 20 MiB per file.</p>
132
+ <progress hidden value="0" max="1" aria-label="Upload progress"></progress>
133
+ </main>
134
+ <script>${script}</script>
135
+ </html>`;
136
+ //# sourceMappingURL=phoneUploadPage.js.map
@@ -0,0 +1,4 @@
1
+ export declare function routeSuccesses(origins: string[]): Record<string, number>;
2
+ export declare function recordRouteSuccess(origin: string, at?: number): Promise<void>;
3
+ export declare function _forgetRouteHistoryForTest(): void;
4
+ export declare function _routeHistorySavedForTest(): Promise<void>;