@ai-workbench/connect 0.7.49 → 0.7.50-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -125
- package/client/index.cjs +8 -371
- package/helper/auth-status.cjs +8 -14
- package/helper/remote-access.sh +91 -0
- package/lib/api.d.ts +4 -86
- package/lib/components.js +4 -162
- package/lib/connect.d.ts +3 -3
- package/lib/connect.js +6 -20
- package/lib/cordis.d.ts +1 -3
- package/lib/defaults.d.ts +0 -3
- package/lib/defaults.js +0 -1
- package/lib/{profile-runtime.d.ts → enrollment-runtime.d.ts} +1 -1
- package/lib/enrollment-runtime.js +31 -0
- package/lib/enrollment.d.ts +0 -1
- package/lib/enrollment.js +2 -5
- package/lib/index.d.ts +0 -4
- package/lib/index.js +17 -7
- package/lib/integration.d.ts +1 -1
- package/lib/integration.js +1 -3
- package/lib/needs.js +0 -22
- package/lib/ports.d.ts +2 -5
- package/lib/private-files.d.ts +0 -2
- package/lib/private-files.js +1 -17
- package/lib/profile-activation.d.ts +2 -0
- package/lib/profile-activation.js +3 -1
- package/lib/profile-enrollment.d.ts +2 -1
- package/lib/profile-enrollment.js +5 -5
- package/lib/remote-access.d.ts +36 -0
- package/lib/remote-access.js +103 -0
- package/lib/ssh.js +11 -1
- package/lib/startup.d.ts +0 -1
- package/package.json +3 -9
- package/helper/host-directories.cjs +0 -116
- package/lib/conversation-log.d.ts +0 -9
- package/lib/conversation-log.js +0 -44
- package/lib/directory-session.d.ts +0 -7
- package/lib/directory-session.js +0 -153
- package/lib/host-directories.d.ts +0 -58
- package/lib/host-directories.js +0 -84
- package/lib/host-session-projects.d.ts +0 -12
- package/lib/host-session-projects.js +0 -82
- package/lib/local-workspace-context.d.ts +0 -46
- package/lib/local-workspace-context.js +0 -17
- package/lib/native-workspace.d.ts +0 -11
- package/lib/native-workspace.js +0 -1
- package/lib/profile-runtime.js +0 -119
- package/lib/workspace-directory-picker-types.d.ts +0 -44
- package/lib/workspace-directory-picker-types.js +0 -1
- package/lib/workspace-directory-picker.d.ts +0 -30
- package/lib/workspace-directory-picker.js +0 -328
- package/lib/workspace-location-types.d.ts +0 -76
- package/lib/workspace-location-types.js +0 -1
- package/lib/workspace-locations.d.ts +0 -60
- package/lib/workspace-locations.js +0 -439
package/client/index.cjs
CHANGED
|
@@ -19,7 +19,6 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
19
19
|
"importHelp": "Choose the connection files folder provided by your administrator.",
|
|
20
20
|
"enrollmentRejected": "The device setup is no longer valid. Contact your administrator; submission has stopped.",
|
|
21
21
|
"importInvalid": "These connection files could not be verified. Ask your administrator for a valid folder.",
|
|
22
|
-
"workspaceLimit": "Remote workspaces appear in the normal workspace selector after connection. Local files and attachments are not automatically transferred to the remote host.",
|
|
23
22
|
"unknown": "The remote host connection status could not be confirmed. Contact your administrator.",
|
|
24
23
|
"details": "Technical details",
|
|
25
24
|
"signIn": "Sign in to {brand}",
|
|
@@ -38,112 +37,13 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
38
37
|
"unavailable": "The remote host is currently unavailable. Contact your administrator.",
|
|
39
38
|
"stale": "This sign-in request has changed. Use the current prompt.",
|
|
40
39
|
"actionFailed": "The action could not be completed. Contact your administrator.",
|
|
41
|
-
"permissionRead": "Read",
|
|
42
|
-
"permissionWrite": "Write",
|
|
43
|
-
"permissionEnter": "Enter",
|
|
44
|
-
"allowed": "Allowed",
|
|
45
|
-
"deniedPermission": "Not allowed",
|
|
46
|
-
"unknownPermission": "Unknown",
|
|
47
|
-
"pageSizeInvalid": "Entries per page must be a positive safe integer.",
|
|
48
|
-
"hostBrowseFailed": "Unable to read host folders. No automatic retry was made.",
|
|
49
|
-
"locationChanged": "The workspace or connection changed. Refresh locations.",
|
|
50
|
-
"locationSaveFailed": "Location was not saved. Refresh locations.",
|
|
51
|
-
"locationSaveUnknown": "Unable to confirm the save. Refresh to verify; no automatic retry was made.",
|
|
52
|
-
"hostExecution": "Host folder selected. Each turn confirms that this path exists on the host and is a folder.",
|
|
53
|
-
"locationUnavailable": "This workspace location is unavailable. See the details.",
|
|
54
|
-
"localExecution": "Local folder selected. Local execution requirements will be checked before running.",
|
|
55
|
-
"sourceUnselected": "No file source selected.",
|
|
56
|
-
"hostUnverified": "Host identity has not been verified",
|
|
57
|
-
"localWorkspacePrefix": "Native local workspace: ",
|
|
58
|
-
"remoteHostPrefix": "Remote host: ",
|
|
59
|
-
"useLocal": "Use local folder",
|
|
60
|
-
"browseHost": "Browse host folders",
|
|
61
|
-
"absoluteHostPath": "Absolute host path",
|
|
62
|
-
"openHostPath": "Open host folder",
|
|
63
|
-
"hostPageSize": "Host entries per page",
|
|
64
|
-
"pageDefaultPrefix": "Default: ",
|
|
65
|
-
"pageBudgetHelp": " entries per page. Enter an integer from 1 to 9007199254740991. Browse and select existing folders only; local files are not uploaded automatically.",
|
|
66
|
-
"locationChecking": "Verifying workspace location…",
|
|
67
|
-
"requestedPath": "Requested path: ",
|
|
68
|
-
"canonicalPath": "Canonical path: ",
|
|
69
|
-
"parentPath": "Parent: ",
|
|
70
|
-
"none": "None",
|
|
71
|
-
"symlink": "Symbolic link: ",
|
|
72
|
-
"yes": "Yes",
|
|
73
|
-
"no": "No",
|
|
74
|
-
"openParent": "Open parent folder",
|
|
75
|
-
"selectCurrentHost": "Select current host folder",
|
|
76
|
-
"symlinkSuffix": "; symbolic link: ",
|
|
77
|
-
"directoryUnavailable": "Folder unavailable: ",
|
|
78
|
-
"openPrefix": "Open ",
|
|
79
|
-
"choosePrefix": "Select ",
|
|
80
|
-
"loadMore": "Load more folders",
|
|
81
|
-
"directoryPath": "Folder path",
|
|
82
|
-
"folders": "Folders",
|
|
83
|
-
"addingWorkspace": "Adding workspace…",
|
|
84
|
-
"loading": "Loading…",
|
|
85
|
-
"newFolder": "New folder",
|
|
86
|
-
"showHidden": "Show hidden files",
|
|
87
40
|
"cancel": "Cancel",
|
|
88
|
-
"open": "Open",
|
|
89
|
-
"newFolderPrefix": "Create a folder in “",
|
|
90
|
-
"newFolderSuffix": "”",
|
|
91
|
-
"folderName": "Folder name",
|
|
92
|
-
"create": "Create",
|
|
93
|
-
"workspaceAddFailed": "Workspace could not be added. Choose again.",
|
|
94
|
-
"workspacePickInvalid": "Workspace selection could not be verified. Choose again.",
|
|
95
|
-
"systemPickerFailed": "Unable to open the system folder picker. Check the official folder picker component.",
|
|
96
|
-
"localDirectoryInvalid": "This local folder is unavailable. Choose again.",
|
|
97
|
-
"directoryReadFailed": "Unable to read folders. Check the connection.",
|
|
98
|
-
"workspaceAddUnknown": "Unable to confirm the workspace was added. Check the workspace list.",
|
|
99
|
-
"folderCreateFailed": "Folder was not created. Check the current folder.",
|
|
100
|
-
"folderCreateUnknown": "Unable to confirm creation. Check the folder before trying again.",
|
|
101
|
-
"chooseWorkspace": "Choose workspace folder",
|
|
102
|
-
"deviceLocation": "Folder location",
|
|
103
|
-
"local": "This Mac",
|
|
104
|
-
"remoteHost": "Remote host",
|
|
105
|
-
"chooseDevice": "Choose where the folder is located.",
|
|
106
|
-
"systemChooseFolder": "Choose a folder in the system window.",
|
|
107
|
-
"systemFolderHelp": "Local folders use the system folder picker.",
|
|
108
|
-
"chooseFolder": "Choose folder",
|
|
109
|
-
"pickerLoading": "Loading unified folder picker settings.",
|
|
110
|
-
"pickerLoadFailed": "Unable to load folder picker settings. No automatic retry was made.",
|
|
111
|
-
"pickerSettingsInvalid": "Folder picker settings could not be verified. A valid negative safe integer workspaceLocations.pickerSlotPriority and folder budgets are required.",
|
|
112
|
-
"slotMissing": "Official workspace slot required: ",
|
|
113
|
-
"pickerReady": "The unified folder picker is connected to both Add workspace entries.",
|
|
114
|
-
"slotHidden": "The unified folder picker is hidden: ",
|
|
115
|
-
"slotPriorityNeed": "; change workspaceLocations.pickerSlotPriority in the official plugin Config. Current value: ",
|
|
116
|
-
"priorityLower": "; it must be lower than the other entry priorities.",
|
|
117
|
-
"slotConflict": "Folder picker registration conflict: ",
|
|
118
|
-
"pickerReloadFailed": "Unable to read folder picker settings or entries. Check the connection and reload; no automatic retry was made.",
|
|
119
|
-
"unifiedPicker": "Unified folder picker",
|
|
120
|
-
"mappingRootPrefix": "Remote mapping folder: ",
|
|
121
|
-
"mappingHelp": "; subfolder names derive from the host and absolute path. These are native workspace identity anchors, not host execution identity checks. They do not store or sync employee files. Successful mappings are retained, including after removing a workspace or uninstalling. A failed addition affects only that attempt. Remove any leftover entry through native workspace management, then choose again. Previous failures do not lock the picker.",
|
|
122
|
-
"slotPriorityPrefix": "workspaceLocations.pickerSlotPriority: ",
|
|
123
|
-
"slotPriorityHelp": " (default -10, a negative safe integer; lower values have higher priority). Change it in the official plugin Config. The official entry remains available.",
|
|
124
|
-
"directoryPageSizePrefix": "workspaceLocations.pageSize: ",
|
|
125
|
-
"metadataBudgetPrefix": " (default 100); enrollmentMetadataMaxBytes: ",
|
|
126
|
-
"metadataBudgetHelp": " bytes (default 1048576). Folder output is also limited by commandOutputMaxBytes. View and change these in the official plugin Config. There are no hidden folder count or lifetime limits.",
|
|
127
|
-
"reloadPicker": "Reload folder picker settings",
|
|
128
|
-
"workspaceListFailed": "Unable to read the native workspace list.",
|
|
129
|
-
"workspaceListRetry": "Unable to read the native workspace list. No automatic retry was made.",
|
|
130
|
-
"fileSources": "Workspace file sources",
|
|
131
|
-
"fileSourcesHelp": "Use Add workspace to choose a local or remote host folder in the same picker. A remote folder needs no additional local folder. This section manages and refreshes the same source ledger without rebinding existing workspaces.",
|
|
132
|
-
"executionHelp": "Each turn verifies the selected folder. A disconnection fails only that turn; the next turn checks again after recovery. Files and commands run in the selected location. Changing sources requires a new session. Permissions follow the current mode; credentials remain on the host. Technical log failures do not block execution.",
|
|
133
|
-
"refreshWorkspaces": "Refresh native workspace list",
|
|
134
|
-
"locationsUnverified": "Workspace locations have not been verified.",
|
|
135
|
-
"workspaceEmpty": "No native workspaces yet. Use Add workspace to choose a folder.",
|
|
136
41
|
"pasteHelp": "After signing in in your browser, paste the authorization code from that page here.",
|
|
137
42
|
"claudeCode": "Claude authorization code",
|
|
138
43
|
"finishLogin": "Finish sign-in",
|
|
139
44
|
"submitting": "Sending the authorization result to the host…",
|
|
140
45
|
"deviceHelp": "Enter this one-time device code in your browser:",
|
|
141
46
|
"cancelLogin": "Cancel sign-in",
|
|
142
|
-
"logReadFailed": "Unable to read local logs. Expand again later to retry.",
|
|
143
|
-
"conversationDetails": "Conversation details",
|
|
144
|
-
"logHelp": "Read local logs. Logging failures do not block execution.",
|
|
145
|
-
"logLoading": "Reading local logs…",
|
|
146
|
-
"logEmpty": "No local logs yet.",
|
|
147
47
|
"interruptionPrefix": "The host connection was interrupted (",
|
|
148
48
|
"interruptionSuffix": " minutes so far). It will reconnect when the network recovers. Check your Mac’s network.",
|
|
149
49
|
"reconfirming": "Reconfirming connection",
|
|
@@ -153,8 +53,6 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
153
53
|
"ready": "All ready",
|
|
154
54
|
"remainingTasks": "Remaining: {steps}",
|
|
155
55
|
"stepSeparator": ", ",
|
|
156
|
-
"sourceHostOnly": "Your administrator has set workspaces to use remote host folders only.",
|
|
157
|
-
"sourceLocalOnly": "Your administrator has set workspaces to use local folders only.",
|
|
158
56
|
"connectionFiles": "Connection files",
|
|
159
57
|
"networkLabel": "Network",
|
|
160
58
|
"networkConnected": "Connected to the company host",
|
|
@@ -176,24 +74,6 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
176
74
|
"stepCheck": "Confirm {brand} sign-in status",
|
|
177
75
|
"invalidCode": "The authorization code is malformed or belongs to another sign-in. Start sign-in again.",
|
|
178
76
|
"hostLoginFailed": "Claude sign-in was not completed; the host did not confirm success. Start sign-in again.",
|
|
179
|
-
"need.WORKSPACE_PICKER_INVALID": "This folder selection expired or is invalid. Reopen the folder picker.",
|
|
180
|
-
"need.WORKSPACE_PICKER_STORAGE_FAILED": "The folder location could not be read or saved. Reopen the picker and choose again.",
|
|
181
|
-
"need.WORKSPACE_PICKER_ROLLBACK_FAILED": "The workspace was not added. Remove any leftover entry in native workspace management, then choose again.",
|
|
182
|
-
"need.LOCAL_WORKSPACE_CONTEXT_UNSUPPORTED": "Local workspace process context is not available on this platform.",
|
|
183
|
-
"need.LOCAL_WORKSPACE_CONTEXT_UNAVAILABLE": "The local process environment could not be confirmed. Handoff stopped; the cause is unknown.",
|
|
184
|
-
"need.HOST_DIRECTORY_EXISTS": "A folder with this name already exists. Choose another name.",
|
|
185
|
-
"need.HOST_DIRECTORY_INVALID": "This path does not exist or is not a folder. Choose again.",
|
|
186
|
-
"need.HOST_DIRECTORY_UNREADABLE": "Unable to list host folders. Check folder permissions or the connection.",
|
|
187
|
-
"need.HOST_DIRECTORY_CHANGED": "The folder contents or location changed. Browse again before selecting.",
|
|
188
|
-
"need.HOST_DIRECTORY_PAGE_TOO_LARGE": "This folder page is too large. Reduce the entries per page and browse again.",
|
|
189
|
-
"need.WORKSPACE_LOCATION_REQUIRED": "Choose a file source for this workspace first.",
|
|
190
|
-
"need.WORKSPACE_LOCATION_INVALID": "The workspace location does not match the current folder or host identity. Choose again.",
|
|
191
|
-
"need.WORKSPACE_LOCATION_CONFLICT": "The workspace or connection changed. Refresh locations.",
|
|
192
|
-
"need.WORKSPACE_LOCATION_PROVIDER_REQUIRED": "The host folder is saved. Execution is waiting for the remote provider to support workspace locations.",
|
|
193
|
-
"need.WORKSPACE_EXECUTION_UNAVAILABLE": "The local folder is saved. Remote execution of local files and commands is not available yet.",
|
|
194
|
-
"need.WORKSPACE_LOCATION_STORAGE_FAILED": "Unable to read or save the workspace location. Reopen the folder picker and choose again.",
|
|
195
|
-
"need.REMOTE_DETAIL_STORAGE_FAILED": "Local logs cannot be read right now. Expand again later.",
|
|
196
|
-
"need.MODEL_CATALOG_CONTEXT_INVALID": "The model catalog provider is invalid. See technical details.",
|
|
197
77
|
"need.ACTIVATION_CONFLICT": "Another setup is already in progress. Duplicate setup stopped; contact your administrator.",
|
|
198
78
|
"need.ACTIVATION_CANCELLED": "Network setup was cancelled.",
|
|
199
79
|
"need.ENROLLMENT_CLEANUP_UNBOUND": "Connection files do not match the saved network identity. Cleanup stopped; contact your administrator.",
|
|
@@ -206,14 +86,10 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
206
86
|
"need.HELPER_HANDOFF_FAILED": "Connection service handoff did not finish. Contact your administrator.",
|
|
207
87
|
"need.HELPER_SHUTDOWN_FORCED": "The connection service did not exit normally. Contact your administrator to verify its status.",
|
|
208
88
|
"need.HOST_OFFLINE": "Unable to connect to the company host. Check your Mac’s network, then check again.",
|
|
209
|
-
"need.EMPLOYEE_MISSING": "Your employee account is missing on the host. Ask your administrator to provision it.",
|
|
210
89
|
"need.SSH_FAILED": "Unable to connect to the company host. Check your Mac’s network, then check again.",
|
|
211
90
|
"need.CONNECTION_LOST": "Connection interrupted. Waiting for the network to recover, then the host will reconnect.",
|
|
212
91
|
"need.HOST_TRUST_REQUIRED": "Trusted host connection information is missing. Contact your administrator.",
|
|
213
92
|
"need.HOST_KEY_MISMATCH": "The host identity does not match your connection files. Ask your administrator to check it.",
|
|
214
|
-
"need.PROJECT_PROTOCOL_INVALID": "Unable to read the workspace location. Reopen the folder picker and choose again.",
|
|
215
|
-
"need.PROJECT_BINDING_INVALID": "This workspace could not be prepared. Session history is still available. See technical details before trying again.",
|
|
216
|
-
"need.PROJECT_BINDING_REQUIRED": "Choose a linked remote workspace in this session.",
|
|
217
93
|
"need.DISPOSED": "The connection plugin is disabled. Enable it again.",
|
|
218
94
|
"need.AUTH_STATUS_INVALID": "Unable to confirm sign-in status. Check your network, then check again.",
|
|
219
95
|
"statusAuthorizing": "Signing in…",
|
|
@@ -229,7 +105,6 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
229
105
|
"enrollmentKeyRejected": "开通链接已失效,请向管理员领取新的。",
|
|
230
106
|
"enrollmentRejected": "已存设备身份已失效,请联系管理员处理。",
|
|
231
107
|
"importInvalid": "这份连接资料无法通过检查,请向管理员领取有效的文件夹。",
|
|
232
|
-
"workspaceLimit": "通过默认添加工作区,在统一目录选择器中选择本机或远程主机的文件夹。本地文件不会自动上传。",
|
|
233
108
|
"unknown": "远程主机连接状态无法确认,请重新检查。",
|
|
234
109
|
"details": "技术详情",
|
|
235
110
|
"signIn": "登录 {brand}",
|
|
@@ -250,120 +125,19 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
250
125
|
"unavailable": "远程主机暂时连不上,请检查本机网络。",
|
|
251
126
|
"stale": "这个登录询问已经更新,请使用当前提示。",
|
|
252
127
|
"actionFailed": "操作未能完成,请查看技术详情。",
|
|
253
|
-
"permissionRead": "读取",
|
|
254
|
-
"permissionWrite": "写入",
|
|
255
|
-
"permissionEnter": "进入",
|
|
256
|
-
"allowed": "允许",
|
|
257
|
-
"deniedPermission": "不允许",
|
|
258
|
-
"unknownPermission": "未知",
|
|
259
|
-
"pageSizeInvalid": "每页条数需要正安全整数。",
|
|
260
|
-
"hostBrowseFailed": "主机目录读取失败,未自动重试。",
|
|
261
|
-
"locationChanged": "工作区或连接已变化,请刷新位置。",
|
|
262
|
-
"locationSaveFailed": "位置未保存,请刷新位置。",
|
|
263
|
-
"locationSaveUnknown": "位置保存结果无法确认,请刷新后核实;未自动重试。",
|
|
264
|
-
"hostExecution": "已选择主机文件夹;每轮开始只确认该路径在主机上存在且为文件夹。",
|
|
265
|
-
"locationUnavailable": "工作区位置当前不可用,请查看具体原因。",
|
|
266
|
-
"localExecution": "已选择本机文件夹;运行前会核验本机执行条件。",
|
|
267
|
-
"sourceUnselected": "尚未选择文件来源。",
|
|
268
|
-
"hostUnverified": "主机标识尚未核实",
|
|
269
|
-
"localWorkspacePrefix": "原生本地工作区:",
|
|
270
|
-
"remoteHostPrefix": "远程主机:",
|
|
271
|
-
"useLocal": "使用本地文件夹",
|
|
272
|
-
"browseHost": "浏览主机文件夹",
|
|
273
|
-
"absoluteHostPath": "主机绝对目录",
|
|
274
|
-
"openHostPath": "打开主机目录",
|
|
275
|
-
"hostPageSize": "主机目录每页条数",
|
|
276
|
-
"pageDefaultPrefix": "默认每页 ",
|
|
277
|
-
"pageBudgetHelp": " 条;可填写1至9007199254740991整数。只浏览和选择已有目录,不创建目录;本地文件不会自动上传。",
|
|
278
|
-
"locationChecking": "正在核实工作区位置…",
|
|
279
|
-
"requestedPath": "请求目录:",
|
|
280
|
-
"canonicalPath": "规范路径:",
|
|
281
|
-
"parentPath": "父级:",
|
|
282
|
-
"none": "无",
|
|
283
|
-
"symlink": "符号链接:",
|
|
284
|
-
"yes": "是",
|
|
285
|
-
"no": "否",
|
|
286
|
-
"openParent": "打开父级目录",
|
|
287
|
-
"selectCurrentHost": "选择当前主机文件夹",
|
|
288
|
-
"symlinkSuffix": ";符号链接:",
|
|
289
|
-
"directoryUnavailable": "目录无法使用:",
|
|
290
|
-
"openPrefix": "打开 ",
|
|
291
|
-
"choosePrefix": "选择 ",
|
|
292
|
-
"loadMore": "继续加载目录",
|
|
293
|
-
"directoryPath": "目录路径",
|
|
294
|
-
"folders": "文件夹",
|
|
295
|
-
"addingWorkspace": "正在添加工作区…",
|
|
296
|
-
"loading": "加载中…",
|
|
297
|
-
"newFolder": "新建文件夹",
|
|
298
|
-
"showHidden": "显示隐藏文件",
|
|
299
128
|
"cancel": "取消",
|
|
300
|
-
"open": "打开",
|
|
301
|
-
"newFolderPrefix": "在“",
|
|
302
|
-
"newFolderSuffix": "”中新建文件夹",
|
|
303
|
-
"folderName": "文件夹名称",
|
|
304
|
-
"create": "创建",
|
|
305
|
-
"workspaceAddFailed": "工作区未能添加,请重新选择。",
|
|
306
|
-
"workspacePickInvalid": "工作区选择结果无法核实,请重新选择。",
|
|
307
|
-
"systemPickerFailed": "系统目录选择框无法打开,请检查官方目录选择组件。",
|
|
308
|
-
"localDirectoryInvalid": "本机目录无法使用,请重新选择。",
|
|
309
|
-
"directoryReadFailed": "目录无法读取,请检查连接。",
|
|
310
|
-
"workspaceAddUnknown": "工作区添加结果无法确认,请查看工作区列表。",
|
|
311
|
-
"folderCreateFailed": "文件夹未能创建,请查看当前目录。",
|
|
312
|
-
"folderCreateUnknown": "创建结果无法确认,请查看目录后再试。",
|
|
313
|
-
"chooseWorkspace": "选择工作区目录",
|
|
314
|
-
"deviceLocation": "目录所在设备",
|
|
315
|
-
"local": "本机",
|
|
316
|
-
"remoteHost": "远程主机",
|
|
317
|
-
"chooseDevice": "请选择目录所在设备。",
|
|
318
|
-
"systemChooseFolder": "请在系统窗口选择文件夹。",
|
|
319
|
-
"systemFolderHelp": "本机文件夹使用系统目录选择框。",
|
|
320
|
-
"chooseFolder": "选择文件夹",
|
|
321
|
-
"pickerLoading": "正在读取统一目录选择器设置。",
|
|
322
|
-
"pickerLoadFailed": "目录选择器设置无法读取;未自动重试。",
|
|
323
|
-
"pickerSettingsInvalid": "目录选择器设置无法核实;我需要有效的 workspaceLocations.pickerSlotPriority(小于0的安全整数)及目录预算。",
|
|
324
|
-
"slotMissing": "我需要官方工作区入口声明:",
|
|
325
|
-
"pickerReady": "统一目录选择器已接入两个添加工作区入口。",
|
|
326
|
-
"slotHidden": "统一目录选择器被遮蔽:",
|
|
327
|
-
"slotPriorityNeed": ";我需要在官方插件 Config 调整 workspaceLocations.pickerSlotPriority,当前值 ",
|
|
328
|
-
"priorityLower": ",必须低于其他入口优先级。",
|
|
329
|
-
"slotConflict": "目录选择器入口注册冲突:",
|
|
330
|
-
"pickerReloadFailed": "目录选择器设置或入口无法读取,请检查连接并重新加载;未自动重试。",
|
|
331
|
-
"unifiedPicker": "统一目录选择器",
|
|
332
|
-
"mappingRootPrefix": "远程映射目录:",
|
|
333
|
-
"mappingHelp": ";子目录名由主机名与绝对路径生成,仅用于原生工作区占位,不作主机执行身份检查。仅作原生工作区身份锚,不同步、不存员工文件;成功映射保留,移除工作区或卸载后不自动清理。添加失败只影响本次;若列表有残留条目,可在 DSH 原生工作区管理中删除,再重新选择。选择器不会因旧失败持续锁住。",
|
|
334
|
-
"slotPriorityPrefix": "workspaceLocations.pickerSlotPriority 当前为 ",
|
|
335
|
-
"slotPriorityHelp": "(默认-10,小于0的安全整数;数值越低优先级越高)。可在官方插件 Config 修改,保留官方原生入口。",
|
|
336
|
-
"directoryPageSizePrefix": "workspaceLocations.pageSize 当前为 ",
|
|
337
|
-
"metadataBudgetPrefix": "(默认100);enrollmentMetadataMaxBytes 当前为 ",
|
|
338
|
-
"metadataBudgetHelp": " 字节(默认1048576)。目录输出同时受 commandOutputMaxBytes 约束;请到官方插件 Config 查看和修改。没有隐藏目录数量或寿命上限。",
|
|
339
|
-
"reloadPicker": "重新加载目录选择器设置",
|
|
340
|
-
"workspaceListFailed": "原生工作区列表读取失败。",
|
|
341
|
-
"workspaceListRetry": "原生工作区列表读取失败,未自动重试。",
|
|
342
|
-
"fileSources": "工作区文件来源",
|
|
343
|
-
"fileSourcesHelp": "通过默认添加工作区,在同一个目录选择器中切换本机或远程主机并选定文件夹;远程目录无需另选本机文件夹。本节管理和刷新相同来源账本,不自动改绑已有工作区。",
|
|
344
|
-
"executionHelp": "每轮开始核实所选目录;断线只使本轮失败,恢复后下一轮重新核实。文件和命令只在所选位置执行,换来源需新会话;权限跟随当前档位,凭据只保留在主机。技术日志尽力记录,写入失败不影响运行。",
|
|
345
|
-
"refreshWorkspaces": "刷新原生工作区列表",
|
|
346
|
-
"locationsUnverified": "工作区位置尚未核实。",
|
|
347
|
-
"workspaceEmpty": "当前没有原生工作区,请先通过默认添加工作区选择文件夹。",
|
|
348
129
|
"pasteHelp": "在浏览器完成登录后,把页面上的授权码粘贴到这里",
|
|
349
130
|
"claudeCode": "Claude 授权码",
|
|
350
131
|
"finishLogin": "完成登录",
|
|
351
132
|
"submitting": "正在把授权结果交给主机…",
|
|
352
133
|
"deviceHelp": "在默认浏览器中输入一次性设备码:",
|
|
353
134
|
"cancelLogin": "取消登录",
|
|
354
|
-
"logReadFailed": "本地日志读取失败,可稍后重新展开查看。",
|
|
355
|
-
"conversationDetails": "会话技术详情",
|
|
356
|
-
"logHelp": "读取本机日志;记录失败不会阻止运行。",
|
|
357
|
-
"logLoading": "正在读取本地日志…",
|
|
358
|
-
"logEmpty": "暂无本地日志。",
|
|
359
135
|
"interruptionPrefix": "与主机的连接已中断(已持续 ",
|
|
360
136
|
"interruptionSuffix": " 分钟),网络恢复后会自动重连;你可以先检查本机网络",
|
|
361
137
|
"reconfirming": "正在重新确认",
|
|
362
138
|
"ready": "全部就绪",
|
|
363
139
|
"remainingTasks": "还需:{steps}",
|
|
364
140
|
"stepSeparator": "、",
|
|
365
|
-
"sourceHostOnly": "管理员已设置为只使用远程主机目录",
|
|
366
|
-
"sourceLocalOnly": "管理员已设置为只使用本机目录",
|
|
367
141
|
"connectionFiles": "连接资料",
|
|
368
142
|
"networkLabel": "网络",
|
|
369
143
|
"networkConnected": "已连接公司主机",
|
|
@@ -385,24 +159,6 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
385
159
|
"stepCheck": "确认 {brand} 登录状态",
|
|
386
160
|
"invalidCode": "授权码格式不正确或不属于本次登录,请重新发起登录。",
|
|
387
161
|
"hostLoginFailed": "本次 Claude 登录未完成,主机未确认成功。请重新发起登录。",
|
|
388
|
-
"need.WORKSPACE_PICKER_INVALID": "目录选择请求已失效或格式无效,请重新打开目录选择器。",
|
|
389
|
-
"need.WORKSPACE_PICKER_STORAGE_FAILED": "本次未能读取或保存目录位置,可重新打开选择器再选。",
|
|
390
|
-
"need.WORKSPACE_PICKER_ROLLBACK_FAILED": "本次添加未完成;若工作区列表有残留条目,可在 DSH 原生工作区管理中删除,再重新选择。",
|
|
391
|
-
"need.LOCAL_WORKSPACE_CONTEXT_UNSUPPORTED": "当前平台尚未接入本地工作区进程环境交接。",
|
|
392
|
-
"need.LOCAL_WORKSPACE_CONTEXT_UNAVAILABLE": "本机进程环境无法确认,已停止交接;根因未查明。",
|
|
393
|
-
"need.HOST_DIRECTORY_EXISTS": "文件夹已存在,请换个名称。",
|
|
394
|
-
"need.HOST_DIRECTORY_INVALID": "目录不存在或不是文件夹,请重新选择。",
|
|
395
|
-
"need.HOST_DIRECTORY_UNREADABLE": "主机目录无法列出,请查看目录权限或连接状态。",
|
|
396
|
-
"need.HOST_DIRECTORY_CHANGED": "目录内容或位置已变化,请重新浏览后选择。",
|
|
397
|
-
"need.HOST_DIRECTORY_PAGE_TOO_LARGE": "本页目录信息过多,请减小每页条数后重新浏览。",
|
|
398
|
-
"need.WORKSPACE_LOCATION_REQUIRED": "请先为此工作区选择文件来源。",
|
|
399
|
-
"need.WORKSPACE_LOCATION_INVALID": "工作区位置与当前目录或主机身份不符,请重新选择。",
|
|
400
|
-
"need.WORKSPACE_LOCATION_CONFLICT": "工作区或连接已变化,请刷新位置。",
|
|
401
|
-
"need.WORKSPACE_LOCATION_PROVIDER_REQUIRED": "主机文件夹已记录,等待远程提供方接入位置合同后才能执行。",
|
|
402
|
-
"need.WORKSPACE_EXECUTION_UNAVAILABLE": "本地文件夹已记录,按需远程文件与命令执行尚未接通。",
|
|
403
|
-
"need.WORKSPACE_LOCATION_STORAGE_FAILED": "本次无法读取或保存工作区位置,可重新打开目录选择器再选。",
|
|
404
|
-
"need.REMOTE_DETAIL_STORAGE_FAILED": "本地日志暂时无法读取,可稍后重新展开查看。",
|
|
405
|
-
"need.MODEL_CATALOG_CONTEXT_INVALID": "模型目录查询的品牌无效。",
|
|
406
162
|
"need.ACTIVATION_CONFLICT": "已有另一项开通正在进行,已停止重复开通,请联系管理员。",
|
|
407
163
|
"need.ACTIVATION_CANCELLED": "本次网络开通已取消。",
|
|
408
164
|
"need.ENROLLMENT_CLEANUP_UNBOUND": "连接资料与已保存的入网身份不匹配,已停止清理,请联系管理员。",
|
|
@@ -415,14 +171,10 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
415
171
|
"need.HELPER_HANDOFF_FAILED": "网络组件交接未完成,请联系管理员。",
|
|
416
172
|
"need.HELPER_SHUTDOWN_FORCED": "网络组件未能正常退出,请联系管理员核实状态。",
|
|
417
173
|
"need.HOST_OFFLINE": "暂时无法连接主机,最后在线时间未提供时为未知;可先检查本机网络。",
|
|
418
|
-
"need.EMPLOYEE_MISSING": "主机上没有你的员工账号,需要管理员运行开通。",
|
|
419
174
|
"need.SSH_FAILED": "与主机暂时连不上,可先检查本机网络。",
|
|
420
175
|
"need.CONNECTION_LOST": "连接中断,正在等待网络恢复信号,恢复后将重新连接。",
|
|
421
176
|
"need.HOST_TRUST_REQUIRED": "远程主机连接还缺少可信的连接信息,请联系管理员。",
|
|
422
177
|
"need.HOST_KEY_MISMATCH": "主机身份与已开通的信任材料不符,需要管理员检查。",
|
|
423
|
-
"need.PROJECT_PROTOCOL_INVALID": "本次未能读取工作区位置,可重新打开目录选择器再选。",
|
|
424
|
-
"need.PROJECT_BINDING_INVALID": "本轮工作区准备失败,原会话历史仍可查看。请查看技术详情后再试。",
|
|
425
|
-
"need.PROJECT_BINDING_REQUIRED": "请在会话中选择已关联的远程工作区。",
|
|
426
178
|
"need.DISPOSED": "连接插件已卸载,需要重新启用插件。",
|
|
427
179
|
"need.AUTH_STATUS_INVALID": "暂时无法确认登录状态,可检查本机网络后重新检查。",
|
|
428
180
|
"statusAuthorizing": "正在登录…",
|
|
@@ -435,128 +187,20 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
435
187
|
const quotaCopy={"usage":"订阅额度","refresh":"刷新","refreshing":"刷新中…","noUsage":"登录后可读取主机上 {brand} 返回的额度窗口。","usageLoading":"正在读取额度…","usageEmpty":"当前账户没有返回可显示的额度窗口。请稍后刷新;这不代表额度为零。","usageRefreshFailed":"暂时无法更新额度,请稍后重试。","usageLastKnown":"上次获取的额度 · {value}","usageUpdated":"更新于 {value}","remaining":"剩余 {value}%","windowFiveHours":"5 小时额度","windowDaily":"每日额度","windowWeekly":"每周额度","windowMonthly":"每月额度","windowAnnual":"年度额度","windowHours":"{value} 小时额度","windowDays":"{value} 天额度","resets":"重置于 {value}","resetUnknown":"重置时间未提供","creditsFoldTitle":"额外 Credits 与额度重置","creditsBalance":"额外 Credits 余额","creditsUnit":"credits","unlimited":"不限额","unavailable":"暂无数据","creditsNote":"下方的额外 Credits 和额度重置与套餐额度分开计算。","creditsAfterAllowance":"Credits 要等套餐额度用完后才会开始消耗,官方没有“先用 Credits”的开关。","monthlyCreditLimit":"Credits 月度消费上限","creditsUsed":"已用 {used} / {limit} credits","spendReached":"Credits 月度消费上限已用尽。","resetCredits":"额度重置","resetCreditsHint":"使用重置可恢复短周期额度、每周额度,或两者同时恢复。","resetAvailableTab":"可用","resetFull":"完全重置","resetCreditDefaultName":"额度重置","resetUse":"使用重置","resetPreparing":"准备中…","resetConfirmTitle":"确认使用额度重置","resetWarning":"执行后会消耗 1 次,且无法撤销。","resetEarlyWarning":"当前额度未用尽,服务可能不执行重置。","resetAcknowledge":"我知道这次操作可能立即消耗 1 次重置","resetCreditExpires":"有效期至:{value}","resetCreditExpiryUnknown":"到期时间未提供","resetWait":"请等待 {count} 秒","resetFinal":"确认使用","resetUsing":"使用中…","resetSuccess":"额度重置已完成。","resetNothing":"当前没有可重置的额度,未消耗新的重置次数。","resetNoCredit":"没有可用的额度重置。","resetAlready":"这次重置请求已处理。","resetFailed":"无法使用额度重置。","resetRenewLogin":"登录状态已失效,请重新登录。","resetExpired":"本次确认已失效,请重新开始。","resetInProgress":"额度重置正在处理中。","resetTooEarly":"请等待冷静期结束后再确认。","resetAcknowledgeRequired":"请先确认已了解这次操作可能消耗重置次数。","resetUncertain":"服务端返回结果不确定。请再次确认,插件会复用同一个请求,不会另外发起一次重置。","extraUsage":"额外用量(本月)","extraUsageUsed":"已用 {used} / {limit}","extraUsageOff":"未开启"};
|
|
436
188
|
for(const dictionary of Object.values(dictionaries))Object.assign(dictionary,quotaCopy);
|
|
437
189
|
function createWorkbenchController(call,subscribe){
|
|
438
|
-
let state={value:undefined,error:'',reconfirming:false,importing:false,acting:false},disposed=false,started=false,off,revision=-1,instance,eventVersion=0;
|
|
190
|
+
let state={value:undefined,error:'',reconfirming:false,importing:false,acting:false},disposed=false,started=false,off,revision=-1,instance,eventVersion=0;const retired=new Set(),listeners=new Set();
|
|
439
191
|
const publish=next=>{state=next;for(const fn of listeners)fn();};
|
|
440
192
|
const record=value=>!!value&&typeof value==='object'&&!Array.isArray(value);
|
|
441
|
-
const
|
|
442
|
-
const
|
|
443
|
-
const validLocationItem=item=>record(item)&&safeText(item.workspaceId)&&safeText(item.workspaceName)&&safeText(item.localPath)&&(item.bindingId===null||safeText(item.bindingId))&&[null,'local','host'].includes(item.source)&&(item.source==='host'?safeText(item.host?.host)&&safeText(item.remote?.path)&&item.remote.path.startsWith('/'):['unselected','selected','invalid'].includes(item.status)&&['not-selected','local-pending'].includes(item.execution));
|
|
444
|
-
const validLocations=value=>record(value)&&safeText(value.instanceId)&&Number.isSafeInteger(value.epoch)&&value.epoch>=0&&Number.isSafeInteger(value.revision)&&value.revision>=0&&['loading','ready','failed','disposed'].includes(value.phase)&&Number.isSafeInteger(value.pageSize)&&value.pageSize>=1&&(value.host===undefined||value.host===null||validHost(value.host))&&Array.isArray(value.items)&&value.items.every(validLocationItem);
|
|
445
|
-
const validSnapshot=value=>{const s=value?.startup,l=value?.workspaceLocations;return record(s)&&['checking','blocked','login-required','authorizing','idle','disposed'].includes(s.phase)&&record(s.logins)&&Object.values(s.logins).every(v=>typeof v==='boolean')&&(s.checkingProviders===undefined||Array.isArray(s.checkingProviders))&&(s.providerNeeds===undefined||record(s.providerNeeds))&&(l===undefined||l===null||validLocations(l));};
|
|
446
|
-
const acceptLocations=(incoming,source)=>{if(!incoming)return incoming;const valid=typeof incoming.instanceId==='string'&&Number.isSafeInteger(incoming.epoch)&&incoming.epoch>=0&&Number.isSafeInteger(incoming.revision)&&incoming.revision>=0;if(!valid||retiredLocations.has(incoming.instanceId)||(workspaceLocations&&incoming.instanceId===workspaceLocations.instanceId&&(incoming.epoch<workspaceLocations.epoch||incoming.revision<workspaceLocations.revision))||(workspaceLocations&&incoming.instanceId!==workspaceLocations.instanceId&&source==='http'))return workspaceLocations;if(workspaceLocations&&incoming.instanceId!==workspaceLocations.instanceId)retiredLocations.add(workspaceLocations.instanceId);workspaceLocations=incoming;return incoming;};
|
|
447
|
-
const locationCall=async(path,body)=>{if(state.reconfirming)return {ok:false,error:{code:'CONNECTION_UNKNOWN',message:'正在重新确认,请先重新检查当前连接。'}};const before=state.value?.workspaceLocations,at=eventVersion;let result;try{result=await call('/workspace-locations/'+path,'POST',body);}catch(error){if(!disposed&&at===eventVersion)failure();throw error;}if(disposed)return result;if(result?.ok&&path!=='browse'&&!validLocations(result.value)){if(at===eventVersion)failure();return {ok:false,error:{code:'CONNECTION_UNKNOWN',message:'工作区位置快照无法核实,请重新检查当前连接。'}};}if(result?.ok&&path!=='browse'&&state.value&&before?.instanceId===state.value.workspaceLocations?.instanceId&&before?.epoch===state.value.workspaceLocations?.epoch&&(path!=='select'||sameLocationContext(state.value.workspaceLocations,body))){const next=acceptLocations(result.value,'http');publish({...state,value:{...state.value,workspaceLocations:next}});}return result;};
|
|
448
|
-
const accept=(value,source='event')=>{if(disposed)return;const next=value?.startup?.revision,id=value?.startup?.instanceId;if(typeof id!=='string'||!id||!Number.isSafeInteger(next)||next<0||!validSnapshot(value)){failure();return;}if(id!==instance){if(instance&&(source==='http'||retired.has(id)))return;if(instance)retired.add(instance);instance=id;revision=-1;}if(next<revision)return;revision=next;if(value.workspaceLocations)value={...value,workspaceLocations:acceptLocations(value.workspaceLocations,source)};publish({...state,value,error:value.actionErrorCode||value.enrollment?.need?.code||(value.actionError?'ACTION_FAILED':''),reconfirming:false});};
|
|
193
|
+
const validSnapshot=value=>{const s=value?.startup;return record(s)&&['checking','blocked','login-required','authorizing','idle','disposed'].includes(s.phase)&&record(s.logins)&&Object.values(s.logins).every(v=>typeof v==='boolean')&&(s.checkingProviders===undefined||Array.isArray(s.checkingProviders))&&(s.providerNeeds===undefined||record(s.providerNeeds));};
|
|
194
|
+
const accept=(value,source='event')=>{if(disposed)return;const next=value?.startup?.revision,id=value?.startup?.instanceId;if(typeof id!=='string'||!id||!Number.isSafeInteger(next)||next<0||!validSnapshot(value)){failure();return;}if(id!==instance){if(instance&&(source==='http'||retired.has(id)))return;if(instance)retired.add(instance);instance=id;revision=-1;}if(next<revision)return;revision=next;publish({...state,value,error:value.actionErrorCode||value.enrollment?.need?.code||(value.actionError?'ACTION_FAILED':''),reconfirming:false});};
|
|
449
195
|
const failure=()=>{if(!disposed)publish({...state,error:'CONNECTION_UNKNOWN',reconfirming:true});};
|
|
450
|
-
return {readNetworkQuality:refresh=>call('/network-quality'+(refresh?'?refresh=1':''),'GET'),
|
|
196
|
+
return {readNetworkQuality:refresh=>call('/network-quality'+(refresh?'?refresh=1':''),'GET'),quota:(path,body)=>call('/quota/'+path,body===undefined?'GET':'POST',body),getSnapshot:()=>state,subscribe:fn=>{listeners.add(fn);return()=>listeners.delete(fn);},async action(path='/check',body){if(state.reconfirming&&path!=='/check'||state.importing||state.acting)return;const account=/^\/(forget|logout)\//.test(path);if(account)publish({...state,acting:true});const importing=path==='/enrollment/import';if(importing)publish({...state,importing:true,error:''});const at=eventVersion;try{const value=await call(path,'POST',body);if(at===eventVersion)accept(value,'http');}catch{if(at===eventVersion)failure();}finally{if(!disposed&&(account||importing))publish({...state,...(account?{acting:false}:{}),...(importing?{importing:false}:{})});}},start(){if(disposed||started)return;started=true;off=subscribe(value=>{eventVersion++;accept(value);},()=>{eventVersion++;failure();});const at=eventVersion;void call('/status','GET').then(value=>{if(at===eventVersion)accept(value,'http');},()=>{if(at===eventVersion)failure();});},dispose(){disposed=true;off?.();listeners.clear();}};
|
|
451
197
|
}
|
|
452
198
|
function useWorkbench(workbench){const snapshot=React.useSyncExternalStore(workbench.subscribe,workbench.getSnapshot);return {state:snapshot.value,error:snapshot.error,reconfirming:snapshot.reconfirming,importing:snapshot.importing,acting:snapshot.acting,action:workbench.action};}
|
|
453
199
|
function isLoginQuestion(state){const s=state?.startup;return s?.phase==='login-required'&&s.requestId&&s.provider&&s.logins?.[s.provider]===false&&!s.checkingProviders?.includes(s.provider)&&!s.providerNeeds?.[s.provider];}
|
|
454
|
-
function Details({state,error,t}){return h(SettingsDisclosure,{title:t('details')},h('pre',{style:technicalStyle},JSON.stringify({actionErrorCode:error||state?.actionErrorCode,enrollment:state?.enrollment,actionError:state?.actionError,inventory:state?.inventory,network:state?.network,connection:state?.connection,connectionMessageSettings:state?.connectionMessageSettings,connect:state?.connect,
|
|
200
|
+
function Details({state,error,t}){return h(SettingsDisclosure,{title:t('details')},h('pre',{style:technicalStyle},JSON.stringify({actionErrorCode:error||state?.actionErrorCode,enrollment:state?.enrollment,actionError:state?.actionError,inventory:state?.inventory,network:state?.network,connection:state?.connection,connectionMessageSettings:state?.connectionMessageSettings,connect:state?.connect,checks:state?.startup?.technicalDetails,providerNeeds:state?.startup?.providerNeeds,queuedProviders:state?.startup?.queuedProviders,checkingProviders:state?.startup?.checkingProviders},null,2)));}
|
|
455
201
|
const UI=require('@deepseek-ai/dsh-client-ui-primitives'),Button=UI.Button,Input=UI.Input;
|
|
456
202
|
const Translation=React.createContext(null);
|
|
457
|
-
function LocaleText({id,params}){const {t}=React.useContext(Translation);return t(id,params);}
|
|
458
203
|
function NeedMessage({need,fallback='actionFailed'}){const {t}=React.useContext(Translation);return h(React.Fragment,null,t(need?.code==='ENROLLMENT_REQUIRED'&&need.officialReason==='NEED_ENROLLMENT'?'enrollmentKeyMissing':need?.code?needKey(need.code):fallback),need?.message?h(SettingsDisclosure,{title:t('details')},h('pre',{style:technicalStyle},JSON.stringify({message:need.message,action:need.action},null,2))):null);}
|
|
459
|
-
function DirectoryPermissions({permissions}){const {t}=React.useContext(Translation);return h('p',{style:descriptionStyle},...['read','write','execute'].map((key,index)=>(index?' · ':'')+({read:t('permissionRead'),write:t('permissionWrite'),execute:t('permissionEnter')}[key])+': '+(permissions?.[key]===true?t('allowed'):permissions?.[key]===false?t('deniedPermission'):t('unknownPermission'))),permissions?.reason?t('parenthetical',{value:permissions.reason}):'');}
|
|
460
|
-
const sameLocationContext=(state,context)=>state?.instanceId===context.instanceId&&state?.epoch===context.epoch&&state.items?.some(item=>item.workspaceId===context.workspaceId&&item.bindingId===context.expectedBindingId);
|
|
461
|
-
function WorkspaceLocationRow({item,locations,workbench}){const {t}=React.useContext(Translation);
|
|
462
|
-
const [page,setPage]=React.useState(null),[path,setPath]=React.useState(''),[pageSize,setPageSize]=React.useState(String(locations.pageSize)),[loading,setLoading]=React.useState(false),[error,setError]=React.useState('');
|
|
463
|
-
const live=React.useRef(true),sequence=React.useRef(0),context={instanceId:locations.instanceId,epoch:locations.epoch,workspaceId:item.workspaceId,expectedBindingId:item.bindingId};
|
|
464
|
-
React.useEffect(()=>()=>{live.current=false;sequence.current++;},[]);
|
|
465
|
-
const current=()=>live.current&&sameLocationContext(workbench.getSnapshot().value?.workspaceLocations,context);
|
|
466
|
-
const browse=async(query={})=>{const at=++sequence.current;setLoading(true);setError('');setPage(null);try{const size=Number(pageSize);if(!/^\d+$/.test(pageSize)||!Number.isSafeInteger(size)||size<1){setError(h(LocaleText,{id:'pageSizeInvalid'}));return;}const result=await workbench.browseWorkspaceHostDirectories({...context,pageSize:size,...query});if(at!==sequence.current||!current())return;if(!result?.ok){setError(h(NeedMessage,{need:result?.error,fallback:'hostBrowseFailed'}));return;}const value=result.value;if(value.instanceId!==context.instanceId||value.epoch!==context.epoch||value.workspaceId!==context.workspaceId||value.bindingId!==context.expectedBindingId){setError(h(LocaleText,{id:'locationChanged'}));return;}setPage(value);}catch{if(at===sequence.current&¤t())setError(h(LocaleText,{id:'hostBrowseFailed'}));}finally{if(at===sequence.current&¤t())setLoading(false);}};
|
|
467
|
-
const select=async(choice)=>{const at=++sequence.current;setLoading(true);setError('');setPage(null);try{const result=await workbench.selectWorkspaceLocation({...context,...choice});if(at!==sequence.current||!current())return;if(!result?.ok)setError(h(NeedMessage,{need:result?.error,fallback:'locationSaveFailed'}));}catch{if(at===sequence.current&¤t())setError(h(LocaleText,{id:'locationSaveUnknown'}));}finally{if(at===sequence.current&¤t())setLoading(false);}};
|
|
468
|
-
const execution=item.source==='host'?t('hostExecution'):item.status==='invalid'?t('locationUnavailable'):item.execution==='local-pending'?t('localExecution'):t('sourceUnselected');
|
|
469
|
-
const identity=locations.host,host=identity?identity.username+'@'+identity.host+':'+identity.port:t('hostUnverified');
|
|
470
|
-
const actions={display:'flex',gap:8,flexWrap:'wrap'},rowButton=(label,onClick,disabled=false)=>h(Button,{type:'button',variant:'toolbar',size:'md',disabled,onClick},label);
|
|
471
|
-
return h('div',{'aria-label':item.workspaceName},
|
|
472
|
-
h(SettingsRow,{title:item.workspaceName,status:execution,action:h('div',{style:actions},rowButton(t('useLocal'),()=>select({source:'local'}),loading),rowButton(t('browseHost'),()=>browse(),loading))}),
|
|
473
|
-
h(SettingsRow,{title:t('localWorkspacePrefix'),status:item.localPath}),h(SettingsRow,{title:t('remoteHostPrefix'),status:host}),
|
|
474
|
-
item.need?h('div',{role:'alert',style:errorStyle},h(NeedMessage,{need:item.need,fallback:'locationUnavailable'})):null,
|
|
475
|
-
h(SettingsRow,{title:t('absoluteHostPath'),action:h('div',{style:actions},h(Input,{'aria-label':t('absoluteHostPath'),type:'text',value:path,disabled:loading,onChange:event=>setPath(event.target.value)}),rowButton(t('openHostPath'),()=>browse({path}),loading||!path.startsWith('/')))}),
|
|
476
|
-
h(SettingsRow,{title:t('hostPageSize'),status:t('pageDefaultPrefix')+locations.pageSize+t('pageBudgetHelp'),action:h(Input,{'aria-label':t('hostPageSize'),type:'number',min:1,max:Number.MAX_SAFE_INTEGER,step:1,value:pageSize,disabled:loading,onChange:event=>setPageSize(event.target.value)})}),
|
|
477
|
-
loading?h('p',{role:'status',style:descriptionStyle},t('locationChecking')):null,error?h('div',{role:'alert',style:errorStyle},error):null,
|
|
478
|
-
page?h(React.Fragment,null,h(SettingsRow,{title:t('requestedPath'),status:page.requestedPath}),h(SettingsRow,{title:t('canonicalPath'),status:page.path}),h(SettingsRow,{title:t('parentPath'),status:page.parentPath??t('none')}),
|
|
479
|
-
h(SettingsRow,{title:t('symlink'),status:page.isSymlink?t('yes'):t('no')},h(DirectoryPermissions,{permissions:page.permissions})),
|
|
480
|
-
h('div',{style:actions},page.parentPath?rowButton(t('openParent'),()=>browse({path:page.parentPath}),loading):null,rowButton(t('selectCurrentHost'),()=>select({source:'host',selectionToken:page.selectionToken}),loading||!page.selectionToken)),
|
|
481
|
-
...page.entries.map(entry=>h(SettingsRow,{key:entry.requestedPath,title:entry.name,status:entry.path??entry.requestedPath,action:h('div',{style:actions},rowButton(t('openPrefix')+entry.name,()=>browse({path:entry.requestedPath}),loading||!!entry.errorCode),rowButton(t('choosePrefix')+entry.name,()=>select({source:'host',selectionToken:entry.selectionToken}),loading||!entry.selectionToken))},h('p',{style:descriptionStyle},t('symlink')+(entry.isSymlink?t('yes'):t('no'))),h(DirectoryPermissions,{permissions:entry.permissions}),entry.errorCode?h('p',{role:'alert',style:errorStyle},t('directoryUnavailable')+entry.errorCode):null)),
|
|
482
|
-
page.nextCursor?rowButton(t('loadMore'),()=>browse({cursor:page.nextCursor}),loading):null):null);
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
const pickerNeedText=(need,fallback)=>h(NeedMessage,{need,fallback});
|
|
487
|
-
// DSH browse exports only its plugin loader. Keep the remote data adapter here.
|
|
488
|
-
function RemoteWorkspaceBrowser({page,busy,error,browse,select,cancel,createFolder,saving,onCreateOpenChange}){const {t}=React.useContext(Translation);
|
|
489
|
-
const [folder,setFolder]=React.useState(null),[showHidden,setShowHidden]=React.useState(false);
|
|
490
|
-
const drafting=folder!==null;React.useEffect(()=>{onCreateOpenChange?.(drafting);return()=>onCreateOpenChange?.(false);},[drafting,onCreateOpenChange]);
|
|
491
|
-
const crumbs=page?[{name:'/',path:'/'},...page.path.split('/').filter(Boolean).map((name,index,parts)=>({name,path:'/'+parts.slice(0,index+1).join('/')}))]:[];
|
|
492
|
-
const actionStyle={display:'flex',gap:8,alignItems:'center'},rowStyle={display:'flex',justifyContent:'space-between',width:'100%',padding:'8px 12px',border:0,background:'transparent',color:'inherit',textAlign:'left',borderRadius:6};
|
|
493
|
-
return h(React.Fragment,null,h('fieldset',{disabled:drafting,style:{border:0,padding:0,margin:0}},
|
|
494
|
-
h('nav',{role:'navigation','aria-label':t('directoryPath'),style:{...actionStyle,overflow:'auto',padding:'12px 0'}},...crumbs.map((crumb,index)=>h(React.Fragment,{key:crumb.path},index?h('span',{'aria-hidden':true},'›'):null,h(Button,{type:'button',disabled:busy,onClick:()=>browse({target:'host',path:crumb.path})},crumb.name)))),
|
|
495
|
-
page?.notice?h('p',{role:'status'},t('locationChanged')):null,
|
|
496
|
-
h('div',{style:{height:280,overflow:'auto',borderTop:'1px solid var(--border, #ddd)',borderBottom:'1px solid var(--border, #ddd)',padding:'8px 0'}},h('ul',{'aria-label':t('folders'),style:{listStyle:'none',padding:0,margin:0}},...(page?.entries??[]).filter(entry=>showHidden||!entry.name.startsWith('.')).map(entry=>h('li',{key:entry.path},h(Button,{type:'button',disabled:busy||!entry.available,style:rowStyle,onClick:()=>browse({target:'host',path:entry.path})},h('span',null,h('span',{'aria-hidden':true},'▱ '),entry.name),h('span',{'aria-hidden':true},'›'))))),page?.nextCursor?h(Button,{type:'button',disabled:busy,onClick:()=>browse({target:'host',cursor:page.nextCursor},true)},t('loadMore')):null,
|
|
497
|
-
busy?h('p',{role:'status'},saving?t('addingWorkspace'):t('loading')):null,error?h('div',{role:'alert'},error):null),
|
|
498
|
-
h('div',{style:{...actionStyle,paddingTop:16}},h(Button,{type:'button',disabled:busy||!page,onClick:()=>setFolder('')},t('newFolder')),h(Button,{type:'button',disabled:busy,'aria-pressed':showHidden,onClick:()=>setShowHidden(v=>!v)},t('showHidden')),h('span',{style:{flex:1}}),h(Button,{type:'button',disabled:saving||busy&&folder!==null,onClick:cancel},t('cancel')),h(Button,{type:'button',disabled:busy||!page,onClick:select},t('open')))),
|
|
499
|
-
folder!==null?h('section',{role:'dialog','aria-label':t('newFolder'),'aria-modal':true,style:{padding:16,border:'1px solid var(--border, #ddd)',borderRadius:8,marginTop:16}},h('h3',null,t('newFolder')),h('p',null,t('newFolderPrefix')+(page?.path??'')+t('newFolderSuffix')),h(Input,{'aria-label':t('folderName'),value:folder,autoFocus:true,disabled:busy,onChange:event=>setFolder(event.target.value)}),error?h('div',{role:'alert'},error):null,h('div',{style:{...actionStyle,justifyContent:'flex-end',paddingTop:12}},h(Button,{type:'button',disabled:busy,onClick:()=>setFolder(null)},t('cancel')),h(Button,{type:'button',disabled:busy||!folder||['.','..'].includes(folder)||/[\\/]/.test(folder),onClick:async()=>{if(await createFolder(folder))setFolder(null);}},t('create')))):null);
|
|
500
|
-
}
|
|
501
|
-
const emptyPickerSnapshot={};const emptyPickerSubscribe=()=>()=>{};const getEmptyPickerSnapshot=()=>emptyPickerSnapshot;
|
|
502
|
-
function WorkspaceDirectoryFlow(props){return h(Translation.Provider,{value:{t:props.t}},h(WorkspaceDirectoryFlowBody,props));}
|
|
503
|
-
function WorkspaceDirectoryFlowBody(props){const {t}=React.useContext(Translation);
|
|
504
|
-
const sourceSnapshot=React.useSyncExternalStore(props.workbench.subscribe??emptyPickerSubscribe,props.workbench.getSnapshot??getEmptyPickerSnapshot);
|
|
505
|
-
const sources=sourceSnapshot.value?.enrollment?.workspaceSources??['local','host'],sourceKey=sources.join(','),onlySource=sources.length===1?sources[0]:undefined;
|
|
506
|
-
const {open,workbench}=props,[page,setPage]=React.useState(null),[busy,setBusy]=React.useState(false),[error,setError]=React.useState(''),[target,setTarget]=React.useState(null),[saving,setSaving]=React.useState(false),[creating,setCreating]=React.useState(false);
|
|
507
|
-
const live=React.useRef(true),active=React.useRef(false),generation=React.useRef(0),locked=React.useRef(false),savingRef=React.useRef(false),lastOpen=React.useRef(false),outcome=React.useRef(props);outcome.current=props;
|
|
508
|
-
if(lastOpen.current!==open){lastOpen.current=open;generation.current++;active.current=!!open;locked.current=false;savingRef.current=false;}
|
|
509
|
-
React.useEffect(()=>{live.current=true;return()=>{live.current=false;active.current=false;generation.current++;};},[]);
|
|
510
|
-
const current=at=>live.current&&active.current&&lastOpen.current&&at===generation.current;
|
|
511
|
-
const commit=async(value,at)=>{savingRef.current=true;setSaving(true);const result=await workbench.selectWorkspaceDirectory({selectionToken:value.selectionToken});if(!current(at))return;
|
|
512
|
-
if(!result?.ok){setError(pickerNeedText(result?.error,'workspaceAddFailed'));return;}
|
|
513
|
-
if(typeof result.value?.path!=='string'||!result.value.path||result.value.source!==value.target||typeof result.value.workspaceId!=='string'){setError(h(LocaleText,{id:'workspacePickInvalid'}));return;}
|
|
514
|
-
active.current=false;generation.current++;savingRef.current=false;setSaving(false);setBusy(false);outcome.current.onPicked(result.value.path);
|
|
515
|
-
};
|
|
516
|
-
const pickLocal=async(at)=>{
|
|
517
|
-
let chosen;try{if(typeof outcome.current.pickDirectory!=='function')throw Error('missing official picker');chosen=await outcome.current.pickDirectory();}catch{if(current(at))setError(h(LocaleText,{id:'systemPickerFailed'}));return;}
|
|
518
|
-
if(!current(at)||chosen===null)return;
|
|
519
|
-
const result=await workbench.browseWorkspaceDirectories({target:'local',path:chosen});if(!current(at))return;
|
|
520
|
-
if(!result?.ok){setError(pickerNeedText(result?.error,'localDirectoryInvalid'));return;}
|
|
521
|
-
await commit(result.value,at);
|
|
522
|
-
};
|
|
523
|
-
const browse=async(request={},append=false)=>{
|
|
524
|
-
if(!active.current||locked.current)return;locked.current=true;const at=generation.current,previous=page;setBusy(true);setError('');if(request.target){setTarget(request.target);setPage(null);}
|
|
525
|
-
try{if(request.target==='local'){await pickLocal(at);return;}const result=await workbench.browseWorkspaceDirectories(request);if(!current(at))return;if(!result?.ok){setError(pickerNeedText(result?.error,'directoryReadFailed'));return;}const value=result.value;setTarget(value.target);
|
|
526
|
-
if(value.target==='local'){setPage(null);await pickLocal(at);}else setPage(append&&previous?.target==='host'&&previous.path===value.path?{...value,entries:[...previous.entries,...value.entries.filter(entry=>!previous.entries.some(old=>old.path===entry.path))]}:value);
|
|
527
|
-
}catch{if(current(at))setError(h(LocaleText,{id:savingRef.current?'workspaceAddUnknown':'directoryReadFailed'}));}finally{if(current(at)){locked.current=false;savingRef.current=false;setSaving(false);setBusy(false);}}
|
|
528
|
-
};
|
|
529
|
-
React.useEffect(()=>{savingRef.current=false;setSaving(false);if(open){active.current=true;generation.current++;locked.current=false;setTarget(null);setPage(null);setError('');setBusy(false);if(onlySource)void browse({target:onlySource});}else{setPage(null);setError('');setBusy(false);}},[open,sourceKey]);
|
|
530
|
-
const cancel=()=>{if(!active.current||savingRef.current)return;active.current=false;generation.current++;locked.current=false;setPage(null);setBusy(false);outcome.current.onCancel();};
|
|
531
|
-
const select=async()=>{if(!active.current||locked.current||!page)return;locked.current=true;setBusy(true);setError('');const at=generation.current;try{await commit(page,at);}catch{if(current(at))setError(h(LocaleText,{id:'workspaceAddUnknown'}));}finally{if(current(at)){locked.current=false;savingRef.current=false;setSaving(false);setBusy(false);}}};
|
|
532
|
-
const createFolder=async(name)=>{if(!active.current||locked.current||!page)return false;locked.current=true;savingRef.current=true;setBusy(true);setError('');const at=generation.current;try{const result=await workbench.createWorkspaceDirectory({selectionToken:page.selectionToken,name});if(!current(at))return false;if(!result?.ok){setError(pickerNeedText(result?.error,'folderCreateFailed'));return false;}setPage(result.value);return true;}catch{if(current(at))setError(h(LocaleText,{id:'folderCreateUnknown'}));return false;}finally{if(current(at)){locked.current=false;savingRef.current=false;setBusy(false);}}};
|
|
533
|
-
if(!open)return null;
|
|
534
|
-
return h('section',{role:'dialog','aria-modal':true,'aria-label':t('chooseWorkspace'),style:{position:'fixed',inset:0,zIndex:100,background:'rgba(0,0,0,.25)',display:'flex',alignItems:'center',justifyContent:'center'}},h('div',{style:{background:'var(--dsw-alias-bg-layer-2)',color:'var(--dsw-alias-label-primary)',border:'1px solid var(--dsw-alias-border-l2)',borderRadius:12,padding:24,width:'min(720px,90vw)',maxHeight:'85vh',overflow:'auto',boxShadow:'0 12px 40px rgba(0,0,0,.2)'}},h('h2',null,t('chooseWorkspace')),onlySource?h('p',{style:descriptionStyle},t(onlySource==='host'?'sourceHostOnly':'sourceLocalOnly')):h('div',{'aria-label':t('deviceLocation'),style:{display:'flex',gap:8}},...sources.map(value=>h(Button,{key:value,type:'button',disabled:busy||creating,'aria-pressed':target===value,onClick:()=>browse({target:value})},value==='local'?t('local'):t('remoteHost')))),
|
|
535
|
-
target===null?h(React.Fragment,null,h('p',null,t('chooseDevice')),h(Button,{type:'button',onClick:cancel},t('cancel'))):target==='host'?h(RemoteWorkspaceBrowser,{page,busy,error,browse,select,cancel,createFolder,saving,onCreateOpenChange:setCreating}):h(React.Fragment,null,h('p',{role:'status'},busy?saving?t('addingWorkspace'):t('systemChooseFolder'):t('systemFolderHelp')),error?h('div',{role:'alert'},error):null,h(Button,{type:'button',disabled:busy,onClick:()=>browse({target:'local'})},t('chooseFolder')),h(Button,{type:'button',disabled:saving,onClick:cancel},t('cancel')))));
|
|
536
|
-
}
|
|
537
|
-
function createWorkspaceDirectoryPickerRegistration(ctx,workbench){
|
|
538
|
-
const pickDirectory=()=>{const desktop=globalThis.__DSH_DIRECTORY_PICKER__;return desktop===undefined?ctx.uiWorkspace.pickDirectory():desktop.pick();};
|
|
539
|
-
const names=['sidebar.workspaces.directoryFlow','conversation.hero.workspace.directoryFlow'],listeners=new Set();let state={phase:'loading',message:t=>t('pickerLoading')},alive=true,started=false,epoch=0,cleanup=[];
|
|
540
|
-
const publish=next=>{if(!alive)return;state=next;for(const fn of listeners)fn();};
|
|
541
|
-
const clear=()=>{for(const off of cleanup.splice(0).reverse())off();};
|
|
542
|
-
const reload=async()=>{if(!alive)return;const at=++epoch;clear();publish({phase:'loading',message:t=>t('pickerLoading')});try{const result=await workbench.getWorkspaceDirectoryPickerSettings();if(!alive||epoch!==at)return;if(!result?.ok){publish({phase:'failed',message:t=>h(NeedMessage,{need:result?.error,fallback:'pickerLoadFailed'})});return;}const settings=result.value;if(!settings||!Number.isSafeInteger(settings.slotPriority)||settings.slotPriority>=0||typeof settings.mappingRoot!=='string'||!Number.isSafeInteger(settings.pageSize)||settings.pageSize<1||!Number.isSafeInteger(settings.metadataMaxBytes)||settings.metadataMaxBytes<1){publish({phase:'failed',message:t=>t('pickerSettingsInvalid')});return;}
|
|
543
|
-
const statuses=new Map(names.map(name=>[name,t=>t('slotMissing')+name]));
|
|
544
|
-
const update=()=>{if(!alive||epoch!==at)return;const errors=[...statuses.values()].filter(Boolean);publish({phase:errors.length?'failed':'ready',settings,message:t=>errors.length?errors.map((render,index)=>h('span',{key:index,style:{display:'block'}},render(t))):t('pickerReady')});};
|
|
545
|
-
for(const name of names){const off=ctx.slots.inject(name,()=>{if(!alive||epoch!==at)return()=>{};let registered,unsubscribe;try{registered=ctx.slots.register({name,locale:NS,priority:settings.slotPriority,inject:()=>({workbench,pickDirectory})},WorkspaceDirectoryFlow);const check=()=>{if(!alive||epoch!==at)return;const winner=ctx.slots.entriesOfSlot(name)[0];statuses.set(name,winner?.component===WorkspaceDirectoryFlow&&winner.options.priority===settings.slotPriority?null:t=>t('slotHidden')+name+t('slotPriorityNeed')+settings.slotPriority+t('priorityLower'));update();};unsubscribe=ctx.slots.subscribe(name,check);check();}catch{statuses.set(name,t=>t('slotConflict')+name+t('slotPriorityNeed')+settings.slotPriority);update();}let released=false;const release=()=>{if(released)return;released=true;unsubscribe?.();registered?.();if(alive&&epoch===at){statuses.set(name,t=>t('slotMissing')+name);update();}};cleanup.push(release);return release;});if(typeof off==='function')cleanup.push(off);}update();
|
|
546
|
-
}catch{if(alive&&epoch===at)publish({phase:'failed',message:t=>t('pickerReloadFailed')});}
|
|
547
|
-
};
|
|
548
|
-
return {getSnapshot:()=>state,subscribe:fn=>{listeners.add(fn);return()=>listeners.delete(fn);},start(){if(started||!alive)return;started=true;return reload();},reload,dispose(){alive=false;epoch++;clear();listeners.clear();}};
|
|
549
|
-
}
|
|
550
|
-
function WorkspacePickerSettings({registration}){const {t}=React.useContext(Translation);const value=React.useSyncExternalStore(registration.subscribe,registration.getSnapshot),settings=value.settings;return h(SettingsDisclosure,{title:t('unifiedPicker'),description:value.message(t),error:value.phase==='failed',action:h(Button,{type:'button',variant:'toolbar',size:'md',disabled:value.phase==='loading',onClick:()=>registration.reload()},t('reloadPicker'))},
|
|
551
|
-
settings?h(React.Fragment,null,h(SettingsRow,{title:t('mappingRootPrefix'),status:settings.mappingRoot},h('p',{style:descriptionStyle},t('mappingHelp'))),h(SettingsRow,{title:t('slotPriorityPrefix'),status:settings.slotPriority},h('p',{style:descriptionStyle},t('slotPriorityHelp'))),h(SettingsRow,{title:t('directoryPageSizePrefix'),status:settings.pageSize},h('p',{style:descriptionStyle},t('metadataBudgetPrefix')+settings.metadataMaxBytes+t('metadataBudgetHelp')))):null);}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
function WorkspaceLocations({state,workbench}){const {t}=React.useContext(Translation);
|
|
555
|
-
const locations=state?.workspaceLocations,[error,setError]=React.useState(''),[refreshing,setRefreshing]=React.useState(false);if(!locations)return null;
|
|
556
|
-
const refresh=async()=>{setRefreshing(true);setError('');try{const result=await workbench.refreshWorkspaceLocations();if(!result?.ok)setError(h(NeedMessage,{need:result?.error,fallback:'workspaceListFailed'}));}catch{setError(h(LocaleText,{id:'workspaceListRetry'}));}finally{setRefreshing(false);}};
|
|
557
|
-
return h(SettingsDisclosure,{title:t('fileSources'),description:t('fileSourcesHelp'),action:h(Button,{type:'button',variant:'toolbar',size:'md',disabled:refreshing,onClick:refresh},t('refreshWorkspaces'))},h('p',{style:descriptionStyle},t('executionHelp')),error?h('div',{role:'alert',style:errorStyle},error):null,locations.phase!=='ready'?h('div',{role:locations.need?'alert':'status',style:locations.need?errorStyle:descriptionStyle},h(NeedMessage,{need:locations.need,fallback:'locationsUnverified'})):locations.items.length?locations.items.map(item=>h(WorkspaceLocationRow,{key:JSON.stringify([locations.instanceId,locations.epoch,item.workspaceId,item.bindingId,item.source,item.localPath]),item,locations,workbench})):h('p',{style:descriptionStyle},t('workspaceEmpty')));
|
|
558
|
-
|
|
559
|
-
}
|
|
560
204
|
function Copy({text,label}){const {t}=React.useContext(Translation),[status,setStatus]=React.useState('');return h(React.Fragment,null,h(Button,{type:'button',variant:'outline',size:'sm',style:{flexShrink:0},'aria-label':label??t('copy'),onClick:async()=>{try{await navigator.clipboard.writeText(text);setStatus('copied');}catch{setStatus('copyFailed');}}},t('copy')),status?h('span',{role:'status'},t(status)):null);}
|
|
561
205
|
// Display sample only: two typical 43-character opaque fields plus '#'. Never a validation limit.
|
|
562
206
|
const CLAUDE_CODE_COLUMNS=43+1+43;
|
|
@@ -573,12 +217,6 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
573
217
|
h('p',{role:'status',style:{margin:0}},t('submitting'))):h('p',{role:'status',style:{margin:0}},t('waitingLogin')),
|
|
574
218
|
h('div',null,h(Button,{type:'button',variant:'ghost',icon:h(UI.IconCloseOutlineRegular,{'aria-hidden':true}),onClick:()=>{setCode('');void action('/cancel-login/'+value.id);}},t('cancelLogin'))));
|
|
575
219
|
}
|
|
576
|
-
function ConversationLog({workbench}){const {t}=React.useContext(Translation);
|
|
577
|
-
const [text,setText]=React.useState(''),[error,setError]=React.useState(''),[loading,setLoading]=React.useState(false),live=React.useRef(true),request=React.useRef(0);
|
|
578
|
-
React.useEffect(()=>()=>{live.current=false;},[]);
|
|
579
|
-
const read=async()=>{const at=++request.current;setLoading(true);setError('');setText('');try{const result=await workbench.readConversationLog();if(live.current&&request.current===at){if(result?.ok&&typeof result.value==='string')setText(result.value);else setError(h(NeedMessage,{need:result?.error,fallback:'logReadFailed'}));}}catch{if(live.current&&request.current===at)setError(h(LocaleText,{id:'logReadFailed'}));}finally{if(live.current&&request.current===at)setLoading(false);}};
|
|
580
|
-
return h(SettingsDisclosure,{title:t('conversationDetails'),description:t('logHelp'),onOpen:read},loading?h('p',{role:'status',style:descriptionStyle},t('logLoading')):error?h('div',{role:'alert',style:errorStyle},error):h('pre',{style:technicalStyle},text||t('logEmpty')));
|
|
581
|
-
}
|
|
582
220
|
function ConnectionInterruption({recovery}){const {t}=React.useContext(Translation);
|
|
583
221
|
const [,update]=React.useState(0);React.useEffect(()=>{if(recovery?.phase!=='reconnecting'||!Number.isFinite(recovery.startedAt))return;const timer=setInterval(()=>update(n=>n+1),60000);return()=>clearInterval(timer);},[recovery?.phase,recovery?.startedAt]);
|
|
584
222
|
if(recovery?.phase!=='reconnecting'||!Number.isFinite(recovery.startedAt))return null;return h('p',{role:'status'},t('interruptionPrefix')+Math.max(0,Math.floor((Date.now()-recovery.startedAt)/60000))+t('interruptionSuffix'));
|
|
@@ -719,13 +357,12 @@ window.__ModuleLoader__.load({id:'@ai-workbench/connect',factory:(require)=>{
|
|
|
719
357
|
generalError?h('p',{role:'alert',style:{...descriptionStyle,color:'var(--dsw-alias-state-error-primary)'}},t(needKey(generalError))):null),
|
|
720
358
|
reconfirming?h(Button,{type:'button',variant:'toolbar',size:'md',disabled:connecting,onClick:()=>void action()},t('recheck')):null,
|
|
721
359
|
confirmForget?h(UI.Modal,{open:true,title:t('forgetConnection'),onClose:()=>setConfirmForget(null)},h('p',null,t('forgetConfirm',{employee:confirmForget.employee})),h(Button,{type:'button',variant:'toolbar',size:'md',onClick:()=>setConfirmForget(null)},t('cancel')),h(Button,{type:'button',variant:'toolbar',size:'md',onClick:()=>{const path=confirmForget.path;setConfirmForget(null);if(path===forgetPath)void action(path);}},t('confirmForget'))):null,
|
|
722
|
-
h(Advanced,{t}
|
|
360
|
+
h(Advanced,{t},h(Details,{state,error,t})));
|
|
723
361
|
}
|
|
724
|
-
return {name:'ai-workbench-connect-client',inject:['slots','locale'
|
|
362
|
+
return {name:'ai-workbench-connect-client',inject:['slots','locale'],createWorkbenchController,Panel,NetworkSignal,networkGrade,dictionaries,apply(ctx){
|
|
725
363
|
ctx.effect(()=>ctx.locale.register(NS,dictionaries));const t=ctx.locale.bind(NS);
|
|
726
364
|
const workbench=createWorkbenchController(async(path,method,body)=>{const response=await fetch('/ai-workbench-connect'+path,{method,...body===undefined?{}:{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}});const value=await response.json();if(!response.ok&&!value?.startup&&typeof value?.ok!=='boolean')throw Error('connection-unavailable');return value;},(accept,failure)=>{const source=new EventSource('/ai-workbench-connect/events');source.onmessage=event=>{try{accept(JSON.parse(event.data));}catch{failure();}};source.onerror=failure;return()=>source.close();});
|
|
727
|
-
|
|
728
|
-
ctx.effect(()=>{workbench.start();void registration.start();return()=>{registration.dispose();workbench.dispose();};});
|
|
365
|
+
ctx.effect(()=>{workbench.start();return()=>workbench.dispose();});
|
|
729
366
|
ctx.slots.inject('settings.section',()=>ctx.slots.register({name:'settings.section',id:'ai-workbench-connect',label:()=>t('title'),locale:NS,inject:()=>({workbench})},Panel));
|
|
730
367
|
}};
|
|
731
368
|
}});
|