@puredesktop/puredesktop-ui-bridge 2.1.4 → 2.1.7

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 (183) hide show
  1. package/package.json +19 -1
  2. package/src/agents/runtime/mapAgentSnapshot.test.ts +1 -3
  3. package/src/agents/runtime/mapAgentSnapshot.ts +8 -4
  4. package/src/agents/runtime/mergeUsageTurn.ts +1 -2
  5. package/src/agents/runtime/pendingToolCalls.test.ts +1 -3
  6. package/src/agents/runtime/unresolvedToolCalls.ts +1 -2
  7. package/src/bridge/agentModelTiers.ts +9 -4
  8. package/src/bridge/agents.mjs +3 -1
  9. package/src/bridge/calendarDraftIntent.ts +12 -4
  10. package/src/bridge/calendarInviteIntent.ts +18 -5
  11. package/src/bridge/client.mjs +45 -45
  12. package/src/bridge/dialog.d.mts +8 -8
  13. package/src/bridge/dialog.mjs +40 -40
  14. package/src/bridge/dialog.test.ts +73 -73
  15. package/src/bridge/fs.d.mts +41 -41
  16. package/src/bridge/fs.mjs +56 -56
  17. package/src/bridge/fs.test.ts +83 -83
  18. package/src/bridge/fs.ts +28 -28
  19. package/src/bridge/googleAuth.ts +3 -1
  20. package/src/bridge/methods.d.mts +6 -0
  21. package/src/bridge/methods.mjs +7 -0
  22. package/src/bridge/network.d.mts +17 -17
  23. package/src/bridge/network.mjs +22 -22
  24. package/src/bridge/pureRender/base.css +324 -76
  25. package/src/bridge/pureRender/compiler.ts +1 -1
  26. package/src/bridge/pureRender/document.test.ts +2 -2
  27. package/src/bridge/pureRender/extraction.test.ts +24 -12
  28. package/src/bridge/pureRender/extraction.ts +10 -7
  29. package/src/bridge/pureRender/flow.css +17 -3
  30. package/src/bridge/pureRender/normalize.ts +28 -26
  31. package/src/bridge/pureRender/presets.ts +7 -7
  32. package/src/bridge/pureRender/profiles/book.css +122 -19
  33. package/src/bridge/pureRender/profiles/manuscript.css +57 -11
  34. package/src/bridge/pureRender/profiles/writer.css +48 -10
  35. package/src/bridge/pureRender/reset.css +20 -5
  36. package/src/bridge/pureRender/theme.ts +37 -9
  37. package/src/bridge/pureRender/tokens/default.css +45 -33
  38. package/src/bridge/react/usePlatformAgentRunLiveState.tsx +4 -1
  39. package/src/bridge/react/usePlatformAgentSessionDrive.tsx +13 -4
  40. package/src/bridge/screenAnnotation.test.ts +4 -1
  41. package/src/bridge/screenAnnotation.ts +6 -2
  42. package/src/bridge/storage.d.mts +26 -24
  43. package/src/bridge/storage.mjs +18 -18
  44. package/src/bridge/storage.test.ts +45 -45
  45. package/src/bridge/types.ts +62 -58
  46. package/src/bridge/window.d.mts +3 -1
  47. package/src/bridge/workspace.d.mts +7 -0
  48. package/src/bridge/workspace.mjs +8 -0
  49. package/src/bridge/workspace.ts +1 -0
  50. package/src/commitments/commitments.test.ts +10 -3
  51. package/src/commitments/commitments.ts +18 -4
  52. package/src/components/accessibility/AccessibilityReviewDialog.tsx +7 -2
  53. package/src/components/accessibility/accessibilityReview.test.ts +11 -4
  54. package/src/components/accessibility/accessibilityReview.ts +18 -10
  55. package/src/components/agent-feedback/ScreenAnnotationAgentDialog.tsx +9 -2
  56. package/src/components/agents/AgentContextUsageBar.tsx +5 -3
  57. package/src/components/agents/AgentDrawerPanel.test.tsx +15 -3
  58. package/src/components/agents/AgentMessageBubble.tsx +1 -3
  59. package/src/components/agents/AgentQuestionPromptList.tsx +3 -3
  60. package/src/components/agents/AgentToolApprovalActions.tsx +1 -3
  61. package/src/components/agents/agentPanelStyles.ts +1 -3
  62. package/src/components/agents/agentToolDisplay.ts +4 -1
  63. package/src/components/assets/asset-library/AssetLibraryDialog.tsx +2 -0
  64. package/src/components/assets/asset-library/AssetLibraryWorkspace.tsx +2 -0
  65. package/src/components/assets/asset-library/detail/AssetLibraryDetailHeader.test.tsx +40 -0
  66. package/src/components/assets/asset-library/detail/AssetLibraryDetailHeader.tsx +7 -3
  67. package/src/components/assets/asset-library/detail/AssetLibraryDetailPreview.tsx +8 -8
  68. package/src/components/assets/asset-library/hooks/useAssetLibraryDialog.ts +13 -2
  69. package/src/components/assets/asset-library/hooks/useAssetLibraryMutations.ts +18 -1
  70. package/src/components/assets/asset-library/sidebar/AssetLibraryListRow.tsx +9 -6
  71. package/src/components/assets/asset-library/sidebar/AssetLibrarySidebarToolbar.tsx +3 -1
  72. package/src/components/assets/asset-library/sidebar/AssetListThumbnail.tsx +1 -1
  73. package/src/components/assets/asset-library/types.ts +6 -0
  74. package/src/components/chrome/OverlayActionCapsule.tsx +2 -2
  75. package/src/components/chrome/PanelTabStrip.tsx +3 -2
  76. package/src/components/chrome/PureAppWordmark.tsx +15 -15
  77. package/src/components/chrome/WorkspaceTabStrip.tsx +19 -14
  78. package/src/components/chrome/documentChromePolicy.test.ts +34 -0
  79. package/src/components/chrome/documentChromePolicy.ts +15 -0
  80. package/src/components/chrome/index.ts +4 -0
  81. package/src/components/chrome/workspaceTabTypes.ts +2 -0
  82. package/src/components/common/buttons/Button.tsx +60 -10
  83. package/src/components/common/buttons/ChoiceChip.tsx +2 -2
  84. package/src/components/common/buttons/IconButton.tsx +26 -0
  85. package/src/components/common/buttons/SegmentedControl.tsx +23 -7
  86. package/src/components/common/canvas/CanvasElementFrame.tsx +37 -28
  87. package/src/components/common/canvas/canvasGeometry.test.ts +4 -5
  88. package/src/components/common/canvas/canvasGeometry.ts +1 -4
  89. package/src/components/common/canvas/useCanvasDragResize.test.tsx +10 -10
  90. package/src/components/common/canvas/useCanvasDragResize.ts +1 -4
  91. package/src/components/common/cards/OpenReviewCard.tsx +6 -6
  92. package/src/components/common/chat/ChatBox.test.tsx +9 -1
  93. package/src/components/common/chat/ChatBox.tsx +3 -4
  94. package/src/components/common/chat/ChatMarkdown.tsx +1 -1
  95. package/src/components/common/chat/ChatModelMenu.tsx +1 -1
  96. package/src/components/common/chat/ChatThinkingIndicator.tsx +1 -1
  97. package/src/components/common/chat/ChatThread.tsx +2 -1
  98. package/src/components/common/chat/ChatToolRow.tsx +2 -2
  99. package/src/components/common/chat/ChatUserBubble.tsx +1 -1
  100. package/src/components/common/connections/ConnectionSetup.tsx +6 -6
  101. package/src/components/common/containers/AppFrame.test.tsx +37 -36
  102. package/src/components/common/containers/AppFrame.tsx +15 -0
  103. package/src/components/common/containers/AppHeader.tsx +6 -3
  104. package/src/components/common/containers/SurfacePanel.tsx +1 -0
  105. package/src/components/common/containers/useOpacityPresence.ts +10 -15
  106. package/src/components/common/context/ContextSelector.tsx +10 -10
  107. package/src/components/common/desk/CreationDesk.tsx +23 -11
  108. package/src/components/common/desk/DailyBrief.tsx +18 -7
  109. package/src/components/common/desk/DeskCard.tsx +11 -6
  110. package/src/components/common/dropdown/MenuButtonDropdown.tsx +58 -6
  111. package/src/components/common/dropdown/MenuDropdownItem.tsx +23 -3
  112. package/src/components/common/dropdown/MenuPanel.tsx +8 -8
  113. package/src/components/common/dropdown/SelectMenu.tsx +8 -3
  114. package/src/components/common/dropdown/menuTypes.ts +2 -1
  115. package/src/components/common/evidence/StructuredEvidenceView.tsx +9 -5
  116. package/src/components/common/feedback/Badge.tsx +19 -5
  117. package/src/components/common/feedback/CapabilityPills.tsx +1 -1
  118. package/src/components/common/feedback/InfoHint.tsx +2 -2
  119. package/src/components/common/feedback/PlatformChip.tsx +9 -9
  120. package/src/components/common/feedback/QuietPill.tsx +5 -8
  121. package/src/components/common/feedback/WorkProgressPanel.tsx +14 -14
  122. package/src/components/common/files/FileTable.tsx +8 -2
  123. package/src/components/common/inputs/Checkbox.tsx +1 -1
  124. package/src/components/common/inputs/EditableSecretField.tsx +1 -3
  125. package/src/components/common/inputs/InlineComposer.tsx +2 -2
  126. package/src/components/common/inputs/PaletteDropdown.tsx +33 -23
  127. package/src/components/common/inputs/SurfacePalettePicker.tsx +1 -1
  128. package/src/components/common/inputs/ToggleSwitch.tsx +2 -2
  129. package/src/components/common/inputs/WorkspacePicker.tsx +3 -3
  130. package/src/components/common/lists/listRowStyles.ts +4 -2
  131. package/src/components/common/lists/quiet-ledger/index.ts +1 -4
  132. package/src/components/common/lists/reorderable/DragHandle.tsx +1 -1
  133. package/src/components/common/lists/reorderable/ReorderableSections.tsx +2 -1
  134. package/src/components/common/media/ImageReferencePicker.tsx +22 -14
  135. package/src/components/common/narrative/NarrativeMention.tsx +15 -9
  136. package/src/components/common/navigation/NavigationCardRow.tsx +2 -2
  137. package/src/components/common/navigation/UnderlineTabs.tsx +1 -0
  138. package/src/components/common/overlays/Modal.tsx +52 -3
  139. package/src/components/common/overlays/ObjectActionStrip.tsx +2 -2
  140. package/src/components/common/people/AutoUpdateReviewList.tsx +2 -2
  141. package/src/components/common/people/EntityList.tsx +7 -3
  142. package/src/components/common/people/EntityPortrait.tsx +6 -1
  143. package/src/components/common/people/LinkedDossierList.tsx +3 -1
  144. package/src/components/common/people/RelationshipMap.tsx +3 -9
  145. package/src/components/common/research/EvidenceDossier.tsx +24 -20
  146. package/src/components/common/tiles/CatalogCard.tsx +1 -1
  147. package/src/components/credentials/CredentialsPanel.tsx +2 -6
  148. package/src/components/data/DataChart.tsx +119 -94
  149. package/src/components/data/dataTable.ts +4 -1
  150. package/src/components/editor/DocumentAppChrome.tsx +172 -0
  151. package/src/components/editor/EditorCommentPromptDialog.tsx +1 -1
  152. package/src/components/editor/EditorLinkPromptDialog.tsx +1 -1
  153. package/src/components/print-design/PrintDesignPanel.test.tsx +8 -6
  154. package/src/components/print-design/PrintDesignPanel.tsx +18 -25
  155. package/src/components/proofing/PagedProofDialog.tsx +17 -4
  156. package/src/editor/EditorViewModeToggle.tsx +6 -2
  157. package/src/editor/index.ts +6 -0
  158. package/src/theme/ThemeProvider.tsx +5 -2
  159. package/src/theme/appAccents.test.ts +51 -0
  160. package/src/theme/appAccents.ts +151 -88
  161. package/src/theme/appIdentityCss.mjs +256 -0
  162. package/src/theme/appIdentityCss.ts +256 -0
  163. package/src/theme/composePlatformTheme.test.ts +43 -14
  164. package/src/theme/platformFont.d.mts +2 -2
  165. package/src/theme/platformFont.mjs +4 -3
  166. package/src/theme/reportsShellChromeSelectors.ts +14 -132
  167. package/src/theme/surfaceCss.mjs +37 -0
  168. package/src/theme/surfaceCss.ts +37 -0
  169. package/src/theme/surfacePalettes.ts +120 -79
  170. package/src/theme/surfaceRoleSelectors.ts +135 -71
  171. package/src/theme/themes/dark.ts +44 -43
  172. package/src/theme/themes/light.ts +40 -38
  173. package/src/theme/themes/palette.ts +32 -30
  174. package/src/theme/themes/shared.ts +17 -17
  175. package/src/theme/utils/GlobalStyles.ts +10 -6
  176. package/src/theme/utils/appFrameDocumentStyles.mjs +6 -1
  177. package/src/theme/utils/cssVariables.ts +169 -0
  178. package/src/writing/DraftAssistantDialog.tsx +85 -85
  179. package/src/writing/WritingStyleManager.tsx +6 -3
  180. package/src/writing/draftTextWithAgent.ts +47 -50
  181. package/src/writing/styleStore.ts +4 -3
  182. package/src/writing/writingStyle.test.ts +8 -2
  183. package/src/writing/writingStyle.ts +19 -8
@@ -1,31 +1,31 @@
1
- import type {
2
- PlatformFileCreateFolderResult,
3
- PlatformFileDeleteResult,
4
- PlatformFileListResult,
5
- PlatformFilePreviewUrlResult,
6
- PlatformFileReadBinaryResult,
7
- PlatformFileReadPreviewResult,
8
- PlatformFileRenameResult,
9
- PlatformFileWriteResult,
10
- } from './types.js'
1
+ import type {
2
+ PlatformFileCreateFolderResult,
3
+ PlatformFileDeleteResult,
4
+ PlatformFileListResult,
5
+ PlatformFilePreviewUrlResult,
6
+ PlatformFileReadBinaryResult,
7
+ PlatformFileReadPreviewResult,
8
+ PlatformFileRenameResult,
9
+ PlatformFileWriteResult,
10
+ } from './types.js'
11
11
 
12
- export declare const PLATFORM_FILE_TEXT_PREVIEW_MAX_BYTES: number
13
- export declare const PLATFORM_FILE_BINARY_PREVIEW_MAX_BYTES: number
14
-
15
- export declare function listPlatformFiles(
16
- rootPath: string,
17
- ): Promise<PlatformFileListResult>
18
-
19
- export declare function readPlatformTextFile(path: string): Promise<string>
20
-
21
- export declare function writePlatformTextFile(
22
- path: string,
23
- content: string,
24
- ): Promise<PlatformFileWriteResult>
25
-
26
- export declare function readPlatformFilePreview(
27
- path: string,
28
- maxBytes?: number,
12
+ export declare const PLATFORM_FILE_TEXT_PREVIEW_MAX_BYTES: number
13
+ export declare const PLATFORM_FILE_BINARY_PREVIEW_MAX_BYTES: number
14
+
15
+ export declare function listPlatformFiles(
16
+ rootPath: string,
17
+ ): Promise<PlatformFileListResult>
18
+
19
+ export declare function readPlatformTextFile(path: string): Promise<string>
20
+
21
+ export declare function writePlatformTextFile(
22
+ path: string,
23
+ content: string,
24
+ ): Promise<PlatformFileWriteResult>
25
+
26
+ export declare function readPlatformFilePreview(
27
+ path: string,
28
+ maxBytes?: number,
29
29
  ): Promise<PlatformFileReadPreviewResult>
30
30
 
31
31
  export declare function readPlatformFileBinary(
@@ -51,17 +51,17 @@ export declare function writePlatformFileBinary(
51
51
  base64: string,
52
52
  ): Promise<{ ok: true }>
53
53
 
54
- export declare function createPlatformFolder(
55
- parentPath: string,
56
- name: string,
57
- ): Promise<PlatformFileCreateFolderResult>
58
-
59
- export declare function renamePlatformFile(
60
- path: string,
61
- name: string,
62
- ): Promise<PlatformFileRenameResult>
63
-
64
- export declare function deletePlatformFile(
65
- path: string,
66
- recursive?: boolean,
67
- ): Promise<PlatformFileDeleteResult>
54
+ export declare function createPlatformFolder(
55
+ parentPath: string,
56
+ name: string,
57
+ ): Promise<PlatformFileCreateFolderResult>
58
+
59
+ export declare function renamePlatformFile(
60
+ path: string,
61
+ name: string,
62
+ ): Promise<PlatformFileRenameResult>
63
+
64
+ export declare function deletePlatformFile(
65
+ path: string,
66
+ recursive?: boolean,
67
+ ): Promise<PlatformFileDeleteResult>
package/src/bridge/fs.mjs CHANGED
@@ -5,38 +5,38 @@ import { PLATFORM_BRIDGE_METHODS } from './methods.mjs'
5
5
  export const PLATFORM_FILE_TEXT_PREVIEW_MAX_BYTES = 64 * 1024
6
6
 
7
7
  /** Default binary preview cap for legacy inline image reads. Prefer `fs.previewUrl`. */
8
- export const PLATFORM_FILE_BINARY_PREVIEW_MAX_BYTES = 5 * 1024 * 1024
9
-
10
- /**
11
- * @param {string} rootPath
12
- * @returns {Promise<import('./types.ts').PlatformFileListResult>}
13
- */
14
- export async function listPlatformFiles(rootPath) {
15
- return bridge.call(PLATFORM_BRIDGE_METHODS.FS_LIST, [{ rootPath }])
16
- }
17
-
18
- /**
19
- * @param {string} path
20
- * @returns {Promise<string>}
21
- */
22
- export async function readPlatformTextFile(path) {
23
- return bridge.call(PLATFORM_BRIDGE_METHODS.FS_READ, [path])
24
- }
25
-
26
- /**
27
- * @param {string} path
28
- * @param {string} content
29
- * @returns {Promise<import('./types.ts').PlatformFileWriteResult>}
30
- */
31
- export async function writePlatformTextFile(path, content) {
32
- return bridge.call(PLATFORM_BRIDGE_METHODS.FS_WRITE, [path, content])
33
- }
34
-
35
- /**
36
- * @param {string} path
37
- * @returns {Promise<import('./types.ts').PlatformFilePreviewUrlResult>}
38
- */
39
- export async function readPlatformFilePreviewUrl(path) {
8
+ export const PLATFORM_FILE_BINARY_PREVIEW_MAX_BYTES = 5 * 1024 * 1024
9
+
10
+ /**
11
+ * @param {string} rootPath
12
+ * @returns {Promise<import('./types.ts').PlatformFileListResult>}
13
+ */
14
+ export async function listPlatformFiles(rootPath) {
15
+ return bridge.call(PLATFORM_BRIDGE_METHODS.FS_LIST, [{ rootPath }])
16
+ }
17
+
18
+ /**
19
+ * @param {string} path
20
+ * @returns {Promise<string>}
21
+ */
22
+ export async function readPlatformTextFile(path) {
23
+ return bridge.call(PLATFORM_BRIDGE_METHODS.FS_READ, [path])
24
+ }
25
+
26
+ /**
27
+ * @param {string} path
28
+ * @param {string} content
29
+ * @returns {Promise<import('./types.ts').PlatformFileWriteResult>}
30
+ */
31
+ export async function writePlatformTextFile(path, content) {
32
+ return bridge.call(PLATFORM_BRIDGE_METHODS.FS_WRITE, [path, content])
33
+ }
34
+
35
+ /**
36
+ * @param {string} path
37
+ * @returns {Promise<import('./types.ts').PlatformFilePreviewUrlResult>}
38
+ */
39
+ export async function readPlatformFilePreviewUrl(path) {
40
40
  return bridge.call(PLATFORM_BRIDGE_METHODS.FS_PREVIEW_URL, [{ path }])
41
41
  }
42
42
 
@@ -100,27 +100,27 @@ export async function writePlatformFileBinary(path, base64) {
100
100
  * @param {string} name
101
101
  * @returns {Promise<{ path: string }>}
102
102
  */
103
- export async function createPlatformFolder(parentPath, name) {
104
- return bridge.call(PLATFORM_BRIDGE_METHODS.FS_CREATE_FOLDER, [
105
- { parentPath, name },
106
- ])
107
- }
108
-
109
- /**
110
- * @param {string} path
111
- * @param {string} name
112
- * @returns {Promise<import('./types.ts').PlatformFileRenameResult>}
113
- */
114
- export async function renamePlatformFile(path, name) {
115
- return bridge.call(PLATFORM_BRIDGE_METHODS.FS_RENAME, [{ path, name }])
116
- }
117
-
118
- /**
119
- * @param {string} path
120
- * @param {boolean | undefined} recursive
121
- * @returns {Promise<import('./types.ts').PlatformFileDeleteResult>}
122
- */
123
- export async function deletePlatformFile(path, recursive) {
124
- const request = recursive === undefined ? { path } : { path, recursive }
125
- return bridge.call(PLATFORM_BRIDGE_METHODS.FS_DELETE, [request])
126
- }
103
+ export async function createPlatformFolder(parentPath, name) {
104
+ return bridge.call(PLATFORM_BRIDGE_METHODS.FS_CREATE_FOLDER, [
105
+ { parentPath, name },
106
+ ])
107
+ }
108
+
109
+ /**
110
+ * @param {string} path
111
+ * @param {string} name
112
+ * @returns {Promise<import('./types.ts').PlatformFileRenameResult>}
113
+ */
114
+ export async function renamePlatformFile(path, name) {
115
+ return bridge.call(PLATFORM_BRIDGE_METHODS.FS_RENAME, [{ path, name }])
116
+ }
117
+
118
+ /**
119
+ * @param {string} path
120
+ * @param {boolean | undefined} recursive
121
+ * @returns {Promise<import('./types.ts').PlatformFileDeleteResult>}
122
+ */
123
+ export async function deletePlatformFile(path, recursive) {
124
+ const request = recursive === undefined ? { path } : { path, recursive }
125
+ return bridge.call(PLATFORM_BRIDGE_METHODS.FS_DELETE, [request])
126
+ }
@@ -1,30 +1,30 @@
1
- import { beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { PLATFORM_BRIDGE_METHODS } from './methods.mjs'
3
-
4
- const bridgeCall = vi.hoisted(() => vi.fn())
5
-
6
- vi.mock('./client.mjs', () => ({
7
- bridge: {
8
- call: bridgeCall,
9
- },
10
- }))
11
-
12
- import {
13
- dataUrlFromFileBinary,
14
- deletePlatformFile,
15
- listPlatformFiles,
16
- readPlatformTextFile,
17
- renamePlatformFile,
18
- writePlatformTextFile,
19
- } from './fs.mjs'
20
-
21
- beforeEach(() => {
22
- bridgeCall.mockReset()
23
- })
24
-
25
- describe('dataUrlFromFileBinary', () => {
26
- it('builds a data URL from bridge binary result', () => {
27
- expect(
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest'
2
+ import { PLATFORM_BRIDGE_METHODS } from './methods.mjs'
3
+
4
+ const bridgeCall = vi.hoisted(() => vi.fn())
5
+
6
+ vi.mock('./client.mjs', () => ({
7
+ bridge: {
8
+ call: bridgeCall,
9
+ },
10
+ }))
11
+
12
+ import {
13
+ dataUrlFromFileBinary,
14
+ deletePlatformFile,
15
+ listPlatformFiles,
16
+ readPlatformTextFile,
17
+ renamePlatformFile,
18
+ writePlatformTextFile,
19
+ } from './fs.mjs'
20
+
21
+ beforeEach(() => {
22
+ bridgeCall.mockReset()
23
+ })
24
+
25
+ describe('dataUrlFromFileBinary', () => {
26
+ it('builds a data URL from bridge binary result', () => {
27
+ expect(
28
28
  dataUrlFromFileBinary({
29
29
  path: '/tmp/image.png',
30
30
  mimeType: 'image/png',
@@ -32,59 +32,59 @@ describe('dataUrlFromFileBinary', () => {
32
32
  truncated: false,
33
33
  byteLength: 3,
34
34
  }),
35
- ).toBe('data:image/png;base64,abc123')
36
- })
37
- })
38
-
39
- describe('filesystem bridge helpers', () => {
40
- it('lists files using the shell request object shape', async () => {
41
- bridgeCall.mockResolvedValue({ entries: [] })
42
-
43
- await listPlatformFiles('/tmp')
44
-
45
- expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_LIST, [
46
- { rootPath: '/tmp' },
47
- ])
48
- })
49
-
50
- it('reads text files using the shell path argument shape', async () => {
51
- bridgeCall.mockResolvedValue('hello')
52
-
53
- await readPlatformTextFile('/tmp/a.md')
54
-
55
- expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_READ, [
56
- '/tmp/a.md',
57
- ])
58
- })
59
-
60
- it('writes text files using the shell path and content argument shape', async () => {
61
- bridgeCall.mockResolvedValue({ ok: true })
62
-
63
- await writePlatformTextFile('/tmp/a.md', 'hello')
64
-
65
- expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_WRITE, [
66
- '/tmp/a.md',
67
- 'hello',
68
- ])
69
- })
70
-
71
- it('renames files using the shell request object shape', async () => {
72
- bridgeCall.mockResolvedValue({ path: '/tmp/b.md' })
73
-
74
- await renamePlatformFile('/tmp/a.md', 'b.md')
75
-
76
- expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_RENAME, [
77
- { path: '/tmp/a.md', name: 'b.md' },
78
- ])
79
- })
80
-
81
- it('deletes files using the shell request object shape', async () => {
82
- bridgeCall.mockResolvedValue({ ok: true })
83
-
84
- await deletePlatformFile('/tmp/a.md', true)
85
-
86
- expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_DELETE, [
87
- { path: '/tmp/a.md', recursive: true },
88
- ])
89
- })
90
- })
35
+ ).toBe('data:image/png;base64,abc123')
36
+ })
37
+ })
38
+
39
+ describe('filesystem bridge helpers', () => {
40
+ it('lists files using the shell request object shape', async () => {
41
+ bridgeCall.mockResolvedValue({ entries: [] })
42
+
43
+ await listPlatformFiles('/tmp')
44
+
45
+ expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_LIST, [
46
+ { rootPath: '/tmp' },
47
+ ])
48
+ })
49
+
50
+ it('reads text files using the shell path argument shape', async () => {
51
+ bridgeCall.mockResolvedValue('hello')
52
+
53
+ await readPlatformTextFile('/tmp/a.md')
54
+
55
+ expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_READ, [
56
+ '/tmp/a.md',
57
+ ])
58
+ })
59
+
60
+ it('writes text files using the shell path and content argument shape', async () => {
61
+ bridgeCall.mockResolvedValue({ ok: true })
62
+
63
+ await writePlatformTextFile('/tmp/a.md', 'hello')
64
+
65
+ expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_WRITE, [
66
+ '/tmp/a.md',
67
+ 'hello',
68
+ ])
69
+ })
70
+
71
+ it('renames files using the shell request object shape', async () => {
72
+ bridgeCall.mockResolvedValue({ path: '/tmp/b.md' })
73
+
74
+ await renamePlatformFile('/tmp/a.md', 'b.md')
75
+
76
+ expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_RENAME, [
77
+ { path: '/tmp/a.md', name: 'b.md' },
78
+ ])
79
+ })
80
+
81
+ it('deletes files using the shell request object shape', async () => {
82
+ bridgeCall.mockResolvedValue({ ok: true })
83
+
84
+ await deletePlatformFile('/tmp/a.md', true)
85
+
86
+ expect(bridgeCall).toHaveBeenCalledWith(PLATFORM_BRIDGE_METHODS.FS_DELETE, [
87
+ { path: '/tmp/a.md', recursive: true },
88
+ ])
89
+ })
90
+ })
package/src/bridge/fs.ts CHANGED
@@ -1,28 +1,28 @@
1
- export {
2
- createPlatformFolder,
3
- dataUrlFromFileBinary,
4
- deletePlatformFile,
5
- listPlatformFiles,
6
- readPlatformFileBinary,
7
- readPlatformFileBinaryDataUrl,
8
- readPlatformFilePreview,
9
- readPlatformFilePreviewUrl,
10
- readPlatformTextFile,
11
- renamePlatformFile,
12
- writePlatformFileBinary,
13
- writePlatformTextFile,
14
- PLATFORM_FILE_BINARY_PREVIEW_MAX_BYTES,
15
- PLATFORM_FILE_TEXT_PREVIEW_MAX_BYTES,
16
- } from './fs.mjs'
17
-
18
- export type {
19
- PlatformFileCreateFolderResult,
20
- PlatformFileDeleteResult,
21
- PlatformFileEntry,
22
- PlatformFileListResult,
23
- PlatformFilePreviewUrlResult,
24
- PlatformFileReadBinaryResult,
25
- PlatformFileReadPreviewResult,
26
- PlatformFileRenameResult,
27
- PlatformFileWriteResult,
28
- } from './types.js'
1
+ export {
2
+ createPlatformFolder,
3
+ dataUrlFromFileBinary,
4
+ deletePlatformFile,
5
+ listPlatformFiles,
6
+ readPlatformFileBinary,
7
+ readPlatformFileBinaryDataUrl,
8
+ readPlatformFilePreview,
9
+ readPlatformFilePreviewUrl,
10
+ readPlatformTextFile,
11
+ renamePlatformFile,
12
+ writePlatformFileBinary,
13
+ writePlatformTextFile,
14
+ PLATFORM_FILE_BINARY_PREVIEW_MAX_BYTES,
15
+ PLATFORM_FILE_TEXT_PREVIEW_MAX_BYTES,
16
+ } from './fs.mjs'
17
+
18
+ export type {
19
+ PlatformFileCreateFolderResult,
20
+ PlatformFileDeleteResult,
21
+ PlatformFileEntry,
22
+ PlatformFileListResult,
23
+ PlatformFilePreviewUrlResult,
24
+ PlatformFileReadBinaryResult,
25
+ PlatformFileReadPreviewResult,
26
+ PlatformFileRenameResult,
27
+ PlatformFileWriteResult,
28
+ } from './types.js'
@@ -127,7 +127,9 @@ export async function exchangeCodeForTokens(
127
127
  `Google token exchange failed (${response.status}): ${response.body}`,
128
128
  )
129
129
  }
130
- return tokensFromTokenResponse(JSON.parse(response.body) as GoogleTokenResponse)
130
+ return tokensFromTokenResponse(
131
+ JSON.parse(response.body) as GoogleTokenResponse,
132
+ )
131
133
  }
132
134
 
133
135
  export interface TokenRefreshInput {
@@ -7,6 +7,7 @@ export declare const PLATFORM_BRIDGE_METHODS: {
7
7
  readonly CATALOG_OPEN: 'catalog.open'
8
8
  readonly WORKSPACE_OPEN_APP: 'workspace.openApp'
9
9
  readonly WORKSPACE_OPEN_PALETTE: 'workspace.openPalette'
10
+ readonly WORKSPACE_UPDATE_CURRENT_TAB: 'workspace.updateCurrentTab'
10
11
  readonly SCHEDULER_REGISTER: 'scheduler.register'
11
12
  readonly SCHEDULER_UNREGISTER: 'scheduler.unregister'
12
13
  readonly CATALOG_CONSUME_PENDING_OPEN: 'catalog.consumePendingOpen'
@@ -32,9 +33,12 @@ export declare const PLATFORM_BRIDGE_METHODS: {
32
33
  readonly DIALOG_SAVE_FOLDER: 'dialog.saveFolder'
33
34
  readonly DIALOG_OPEN_IMAGE: 'dialog.openImage'
34
35
  readonly DIALOG_OPEN_FILE: 'dialog.openFile'
36
+ readonly DIALOG_SAVE_FILE: 'dialog.saveFile'
35
37
  readonly OS_REVEAL: 'os.reveal'
36
38
  readonly OS_OPEN_PATH: 'os.openPath'
37
39
  readonly OS_TRASH: 'os.trash'
40
+ readonly CLIPBOARD_READ: 'clipboard.read'
41
+ readonly CLIPBOARD_WRITE: 'clipboard.write'
38
42
  readonly RENDER_PRINT_HTML: 'render.printHtml'
39
43
  readonly RENDER_PREPARE_PAGED_PREVIEW: 'render.preparePagedPreview'
40
44
  readonly RENDER_CAPTURE_PAGED_SNAPSHOT: 'render.capturePagedSnapshot'
@@ -102,6 +106,7 @@ export declare const PLATFORM_BRIDGE_METHODS: {
102
106
 
103
107
  export declare const PLATFORM_BRIDGE_METHOD_PREFIXES: {
104
108
  readonly RUNTIME: 'runtime.'
109
+ readonly WORKSPACE: 'workspace.'
105
110
  readonly THEME: 'theme.'
106
111
  readonly WINDOW: 'window.'
107
112
  readonly SETTINGS: 'settings.'
@@ -109,6 +114,7 @@ export declare const PLATFORM_BRIDGE_METHOD_PREFIXES: {
109
114
  readonly FS: 'fs.'
110
115
  readonly DIALOG: 'dialog.'
111
116
  readonly OS: 'os.'
117
+ readonly CLIPBOARD: 'clipboard.'
112
118
  readonly RENDER: 'render.'
113
119
  readonly WATCH: 'watch.'
114
120
  readonly ASSETS: 'assets.'
@@ -10,6 +10,7 @@ export const PLATFORM_BRIDGE_METHODS = {
10
10
  CATALOG_OPEN: 'catalog.open',
11
11
  WORKSPACE_OPEN_APP: 'workspace.openApp',
12
12
  WORKSPACE_OPEN_PALETTE: 'workspace.openPalette',
13
+ WORKSPACE_UPDATE_CURRENT_TAB: 'workspace.updateCurrentTab',
13
14
  SCHEDULER_REGISTER: 'scheduler.register',
14
15
  SCHEDULER_UNREGISTER: 'scheduler.unregister',
15
16
  CATALOG_CONSUME_PENDING_OPEN: 'catalog.consumePendingOpen',
@@ -41,11 +42,15 @@ export const PLATFORM_BRIDGE_METHODS = {
41
42
  DIALOG_SAVE_FOLDER: 'dialog.saveFolder',
42
43
  DIALOG_OPEN_IMAGE: 'dialog.openImage',
43
44
  DIALOG_OPEN_FILE: 'dialog.openFile',
45
+ DIALOG_SAVE_FILE: 'dialog.saveFile',
44
46
 
45
47
  OS_REVEAL: 'os.reveal',
46
48
  OS_OPEN_PATH: 'os.openPath',
47
49
  OS_TRASH: 'os.trash',
48
50
 
51
+ CLIPBOARD_READ: 'clipboard.read',
52
+ CLIPBOARD_WRITE: 'clipboard.write',
53
+
49
54
  RENDER_PRINT_HTML: 'render.printHtml',
50
55
  RENDER_PREPARE_PAGED_PREVIEW: 'render.preparePagedPreview',
51
56
  RENDER_CAPTURE_PAGED_SNAPSHOT: 'render.capturePagedSnapshot',
@@ -123,6 +128,7 @@ export const PLATFORM_BRIDGE_METHODS = {
123
128
 
124
129
  export const PLATFORM_BRIDGE_METHOD_PREFIXES = {
125
130
  RUNTIME: 'runtime.',
131
+ WORKSPACE: 'workspace.',
126
132
  THEME: 'theme.',
127
133
  WINDOW: 'window.',
128
134
  SETTINGS: 'settings.',
@@ -130,6 +136,7 @@ export const PLATFORM_BRIDGE_METHOD_PREFIXES = {
130
136
  FS: 'fs.',
131
137
  DIALOG: 'dialog.',
132
138
  OS: 'os.',
139
+ CLIPBOARD: 'clipboard.',
133
140
  RENDER: 'render.',
134
141
  WATCH: 'watch.',
135
142
  ASSETS: 'assets.',
@@ -1,17 +1,17 @@
1
- export interface PlatformNetworkFetchRequest {
2
- url: string
3
- method?: string
4
- headers?: Record<string, string>
5
- body?: string
6
- }
7
-
8
- export interface PlatformNetworkFetchResponse {
9
- status: number
10
- ok: boolean
11
- headers: Record<string, string>
12
- body: string
13
- }
14
-
15
- export declare function networkFetch(
16
- request: PlatformNetworkFetchRequest,
17
- ): Promise<PlatformNetworkFetchResponse>
1
+ export interface PlatformNetworkFetchRequest {
2
+ url: string
3
+ method?: string
4
+ headers?: Record<string, string>
5
+ body?: string
6
+ }
7
+
8
+ export interface PlatformNetworkFetchResponse {
9
+ status: number
10
+ ok: boolean
11
+ headers: Record<string, string>
12
+ body: string
13
+ }
14
+
15
+ export declare function networkFetch(
16
+ request: PlatformNetworkFetchRequest,
17
+ ): Promise<PlatformNetworkFetchResponse>
@@ -1,22 +1,22 @@
1
- import { bridge } from './client.mjs'
2
- import { PLATFORM_BRIDGE_METHODS } from './methods.mjs'
3
-
4
- /**
5
- * Fetch an HTTP(S) resource through the shell network bridge.
6
- *
7
- * @param {{
8
- * url: string,
9
- * method?: string,
10
- * headers?: Record<string, string>,
11
- * body?: string,
12
- * }} request
13
- * @returns {Promise<{
14
- * status: number,
15
- * ok: boolean,
16
- * headers: Record<string, string>,
17
- * body: string,
18
- * }>}
19
- */
20
- export async function networkFetch(request) {
21
- return bridge.call(PLATFORM_BRIDGE_METHODS.NETWORK_FETCH, [request])
22
- }
1
+ import { bridge } from './client.mjs'
2
+ import { PLATFORM_BRIDGE_METHODS } from './methods.mjs'
3
+
4
+ /**
5
+ * Fetch an HTTP(S) resource through the shell network bridge.
6
+ *
7
+ * @param {{
8
+ * url: string,
9
+ * method?: string,
10
+ * headers?: Record<string, string>,
11
+ * body?: string,
12
+ * }} request
13
+ * @returns {Promise<{
14
+ * status: number,
15
+ * ok: boolean,
16
+ * headers: Record<string, string>,
17
+ * body: string,
18
+ * }>}
19
+ */
20
+ export async function networkFetch(request) {
21
+ return bridge.call(PLATFORM_BRIDGE_METHODS.NETWORK_FETCH, [request])
22
+ }