@blue-soda/dsh-remote 0.5.6 → 0.5.8

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 (232) hide show
  1. package/README.md +14 -3
  2. package/cordis.patch.yml +30 -30
  3. package/dist/client.github.js +1 -1
  4. package/dist/client.js +1 -1
  5. package/dist/index.js +1216 -396
  6. package/dist/index.js.map +4 -4
  7. package/dsh-plugin.json +41 -41
  8. package/package.json +165 -165
  9. package/dist/acp.d.ts +0 -75
  10. package/dist/acp.d.ts.map +0 -1
  11. package/dist/acp.js +0 -61
  12. package/dist/acp.js.map +0 -1
  13. package/dist/api-proxy-switch.d.ts +0 -33
  14. package/dist/api-proxy-switch.d.ts.map +0 -1
  15. package/dist/api-proxy-switch.js +0 -109
  16. package/dist/api-proxy-switch.js.map +0 -1
  17. package/dist/atomic-file.d.ts +0 -16
  18. package/dist/atomic-file.d.ts.map +0 -1
  19. package/dist/atomic-file.js +0 -81
  20. package/dist/atomic-file.js.map +0 -1
  21. package/dist/bin/doctor.d.ts +0 -3
  22. package/dist/bin/doctor.d.ts.map +0 -1
  23. package/dist/bin/doctor.js +0 -13
  24. package/dist/bin/doctor.js.map +0 -1
  25. package/dist/cli.d.ts +0 -32
  26. package/dist/cli.d.ts.map +0 -1
  27. package/dist/cli.js +0 -289
  28. package/dist/cli.js.map +0 -1
  29. package/dist/client-runtime.d.ts +0 -375
  30. package/dist/client-runtime.d.ts.map +0 -1
  31. package/dist/client-runtime.js +0 -1768
  32. package/dist/client-runtime.js.map +0 -1
  33. package/dist/client-secure-transport.d.ts +0 -23
  34. package/dist/client-secure-transport.d.ts.map +0 -1
  35. package/dist/client-secure-transport.js +0 -144
  36. package/dist/client-secure-transport.js.map +0 -1
  37. package/dist/client-target-store.d.ts +0 -40
  38. package/dist/client-target-store.d.ts.map +0 -1
  39. package/dist/client-target-store.js +0 -79
  40. package/dist/client-target-store.js.map +0 -1
  41. package/dist/client.d.ts +0 -13
  42. package/dist/client.d.ts.map +0 -1
  43. package/dist/codex/app-server.d.ts +0 -71
  44. package/dist/codex/app-server.d.ts.map +0 -1
  45. package/dist/codex/app-server.js +0 -268
  46. package/dist/codex/app-server.js.map +0 -1
  47. package/dist/codex/codex-image-codec.d.ts +0 -7
  48. package/dist/codex/codex-image-codec.d.ts.map +0 -1
  49. package/dist/codex/codex-image-codec.js +0 -288
  50. package/dist/codex/codex-image-codec.js.map +0 -1
  51. package/dist/codex/domain.d.ts +0 -102
  52. package/dist/codex/domain.d.ts.map +0 -1
  53. package/dist/codex/domain.js +0 -1323
  54. package/dist/codex/domain.js.map +0 -1
  55. package/dist/codex/method-policy.d.ts +0 -338
  56. package/dist/codex/method-policy.d.ts.map +0 -1
  57. package/dist/codex/method-policy.js +0 -141
  58. package/dist/codex/method-policy.js.map +0 -1
  59. package/dist/codex/peer-bridge.d.ts +0 -57
  60. package/dist/codex/peer-bridge.d.ts.map +0 -1
  61. package/dist/codex/peer-bridge.js +0 -299
  62. package/dist/codex/peer-bridge.js.map +0 -1
  63. package/dist/codex/permissions.d.ts +0 -4
  64. package/dist/codex/permissions.d.ts.map +0 -1
  65. package/dist/codex/permissions.js +0 -21
  66. package/dist/codex/permissions.js.map +0 -1
  67. package/dist/codex/session-id.d.ts +0 -10
  68. package/dist/codex/session-id.d.ts.map +0 -1
  69. package/dist/codex/session-id.js +0 -15
  70. package/dist/codex/session-id.js.map +0 -1
  71. package/dist/codex/virtual-harness.d.ts +0 -209
  72. package/dist/codex/virtual-harness.d.ts.map +0 -1
  73. package/dist/codex/virtual-harness.js +0 -2650
  74. package/dist/codex/virtual-harness.js.map +0 -1
  75. package/dist/codex-workspace-bridge.d.ts +0 -108
  76. package/dist/codex-workspace-bridge.d.ts.map +0 -1
  77. package/dist/codex-workspace-bridge.js +0 -502
  78. package/dist/codex-workspace-bridge.js.map +0 -1
  79. package/dist/config.d.ts +0 -99
  80. package/dist/config.d.ts.map +0 -1
  81. package/dist/config.js +0 -127
  82. package/dist/config.js.map +0 -1
  83. package/dist/connection-controller.d.ts +0 -44
  84. package/dist/connection-controller.d.ts.map +0 -1
  85. package/dist/connection-controller.js +0 -185
  86. package/dist/connection-controller.js.map +0 -1
  87. package/dist/control-route.d.ts +0 -34
  88. package/dist/control-route.d.ts.map +0 -1
  89. package/dist/control-route.js +0 -136
  90. package/dist/control-route.js.map +0 -1
  91. package/dist/control-runtime.d.ts +0 -138
  92. package/dist/control-runtime.d.ts.map +0 -1
  93. package/dist/control-runtime.js +0 -543
  94. package/dist/control-runtime.js.map +0 -1
  95. package/dist/control-stream.d.ts +0 -67
  96. package/dist/control-stream.d.ts.map +0 -1
  97. package/dist/control-stream.js +0 -179
  98. package/dist/control-stream.js.map +0 -1
  99. package/dist/defaults.d.ts +0 -9
  100. package/dist/defaults.d.ts.map +0 -1
  101. package/dist/defaults.js +0 -9
  102. package/dist/defaults.js.map +0 -1
  103. package/dist/file-viewer-bridge.d.ts +0 -30
  104. package/dist/file-viewer-bridge.d.ts.map +0 -1
  105. package/dist/file-viewer-bridge.js +0 -128
  106. package/dist/file-viewer-bridge.js.map +0 -1
  107. package/dist/file-viewer-contract.d.ts +0 -5
  108. package/dist/file-viewer-contract.d.ts.map +0 -1
  109. package/dist/file-viewer-contract.js +0 -4
  110. package/dist/file-viewer-contract.js.map +0 -1
  111. package/dist/harness-api-bridge.d.ts +0 -81
  112. package/dist/harness-api-bridge.d.ts.map +0 -1
  113. package/dist/harness-api-bridge.js +0 -862
  114. package/dist/harness-api-bridge.js.map +0 -1
  115. package/dist/harness-api-history.d.ts +0 -3
  116. package/dist/harness-api-history.d.ts.map +0 -1
  117. package/dist/harness-api-history.js +0 -59
  118. package/dist/harness-api-history.js.map +0 -1
  119. package/dist/harness-remote-bridge.d.ts +0 -60
  120. package/dist/harness-remote-bridge.d.ts.map +0 -1
  121. package/dist/harness-remote-bridge.js +0 -540
  122. package/dist/harness-remote-bridge.js.map +0 -1
  123. package/dist/harness-version.d.ts +0 -23
  124. package/dist/harness-version.d.ts.map +0 -1
  125. package/dist/harness-version.js +0 -95
  126. package/dist/harness-version.js.map +0 -1
  127. package/dist/identity-store.d.ts +0 -45
  128. package/dist/identity-store.d.ts.map +0 -1
  129. package/dist/identity-store.js +0 -186
  130. package/dist/identity-store.js.map +0 -1
  131. package/dist/ids.d.ts +0 -2
  132. package/dist/ids.d.ts.map +0 -1
  133. package/dist/ids.js +0 -17
  134. package/dist/ids.js.map +0 -1
  135. package/dist/index.d.ts +0 -78
  136. package/dist/index.d.ts.map +0 -1
  137. package/dist/logging.d.ts +0 -18
  138. package/dist/logging.d.ts.map +0 -1
  139. package/dist/logging.js +0 -30
  140. package/dist/logging.js.map +0 -1
  141. package/dist/loopback-host.d.ts +0 -20
  142. package/dist/loopback-host.d.ts.map +0 -1
  143. package/dist/loopback-host.js +0 -245
  144. package/dist/loopback-host.js.map +0 -1
  145. package/dist/loopback-preview.d.ts +0 -19
  146. package/dist/loopback-preview.d.ts.map +0 -1
  147. package/dist/loopback-preview.js +0 -232
  148. package/dist/loopback-preview.js.map +0 -1
  149. package/dist/native-rtc-helper.d.ts +0 -14
  150. package/dist/native-rtc-helper.d.ts.map +0 -1
  151. package/dist/native-rtc-helper.js +0 -575
  152. package/dist/native-rtc-helper.js.map +0 -1
  153. package/dist/remote-api-proxy.d.ts +0 -17
  154. package/dist/remote-api-proxy.d.ts.map +0 -1
  155. package/dist/remote-api-proxy.js +0 -451
  156. package/dist/remote-api-proxy.js.map +0 -1
  157. package/dist/remote-directory-browser.d.ts +0 -16
  158. package/dist/remote-directory-browser.d.ts.map +0 -1
  159. package/dist/remote-directory-browser.js +0 -48
  160. package/dist/remote-directory-browser.js.map +0 -1
  161. package/dist/remote-file-content-provider.d.ts +0 -48
  162. package/dist/remote-file-content-provider.d.ts.map +0 -1
  163. package/dist/remote-file-content-provider.js +0 -93
  164. package/dist/remote-file-content-provider.js.map +0 -1
  165. package/dist/remote-typert-gateway.d.ts +0 -20
  166. package/dist/remote-typert-gateway.d.ts.map +0 -1
  167. package/dist/remote-typert-gateway.js +0 -334
  168. package/dist/remote-typert-gateway.js.map +0 -1
  169. package/dist/rpc-binary-attachments.d.ts +0 -33
  170. package/dist/rpc-binary-attachments.d.ts.map +0 -1
  171. package/dist/rpc-binary-attachments.js +0 -142
  172. package/dist/rpc-binary-attachments.js.map +0 -1
  173. package/dist/rpc-router.d.ts +0 -31
  174. package/dist/rpc-router.d.ts.map +0 -1
  175. package/dist/rpc-router.js +0 -201
  176. package/dist/rpc-router.js.map +0 -1
  177. package/dist/safe-error.d.ts +0 -8
  178. package/dist/safe-error.d.ts.map +0 -1
  179. package/dist/safe-error.js +0 -20
  180. package/dist/safe-error.js.map +0 -1
  181. package/dist/server-api.d.ts +0 -109
  182. package/dist/server-api.d.ts.map +0 -1
  183. package/dist/server-api.js +0 -520
  184. package/dist/server-api.js.map +0 -1
  185. package/dist/server-connection.d.ts +0 -79
  186. package/dist/server-connection.d.ts.map +0 -1
  187. package/dist/server-connection.js +0 -1023
  188. package/dist/server-connection.js.map +0 -1
  189. package/dist/server-credentials.d.ts +0 -55
  190. package/dist/server-credentials.d.ts.map +0 -1
  191. package/dist/server-credentials.js +0 -108
  192. package/dist/server-credentials.js.map +0 -1
  193. package/dist/service.d.ts +0 -151
  194. package/dist/service.d.ts.map +0 -1
  195. package/dist/service.js +0 -448
  196. package/dist/service.js.map +0 -1
  197. package/dist/session-format-compat.d.ts +0 -3
  198. package/dist/session-format-compat.d.ts.map +0 -1
  199. package/dist/session-format-compat.js +0 -183
  200. package/dist/session-format-compat.js.map +0 -1
  201. package/dist/status-stream.d.ts +0 -48
  202. package/dist/status-stream.d.ts.map +0 -1
  203. package/dist/status-stream.js +0 -133
  204. package/dist/status-stream.js.map +0 -1
  205. package/dist/terminal-policy.d.ts +0 -21
  206. package/dist/terminal-policy.d.ts.map +0 -1
  207. package/dist/terminal-policy.js +0 -68
  208. package/dist/terminal-policy.js.map +0 -1
  209. package/dist/tui-command.d.ts +0 -13
  210. package/dist/tui-command.d.ts.map +0 -1
  211. package/dist/tui-command.js +0 -392
  212. package/dist/tui-command.js.map +0 -1
  213. package/dist/typert-gateway-contract.d.ts +0 -59
  214. package/dist/typert-gateway-contract.d.ts.map +0 -1
  215. package/dist/typert-gateway-contract.js +0 -2
  216. package/dist/typert-gateway-contract.js.map +0 -1
  217. package/dist/typert-gateway-switch.d.ts +0 -85
  218. package/dist/typert-gateway-switch.d.ts.map +0 -1
  219. package/dist/typert-gateway-switch.js +0 -448
  220. package/dist/typert-gateway-switch.js.map +0 -1
  221. package/dist/types.d.ts +0 -20
  222. package/dist/types.d.ts.map +0 -1
  223. package/dist/types.js +0 -2
  224. package/dist/types.js.map +0 -1
  225. package/dist/version.d.ts +0 -12
  226. package/dist/version.d.ts.map +0 -1
  227. package/dist/version.js +0 -12
  228. package/dist/version.js.map +0 -1
  229. package/dist/werift-rtc.d.ts +0 -121
  230. package/dist/werift-rtc.d.ts.map +0 -1
  231. package/dist/werift-rtc.js +0 -490
  232. package/dist/werift-rtc.js.map +0 -1
@@ -1,392 +0,0 @@
1
- import { renderCompactTerminalQr, renderTerminalQr } from './cli.js';
2
- import { ENABLED_QR_PROVIDERS, ServerApiError, isEnabledQrProvider, oauthProviderName } from './server-api.js';
3
- const QR_POLL_INTERVAL_MS = 2_000;
4
- const REMOTE_LOGIN_SCENE_ID = 'remote-login';
5
- const REMOTE_STATUS_SCENE_ID = 'remote-status';
6
- /** Soft TUI integration: Desktop profiles never wait for terminal-only services. */
7
- export function installTuiRemoteCommand(ctx, resolveTarget) {
8
- const tuiContext = ctx;
9
- // The bundle's TUI-only Loader row exposes these services at the entry
10
- // boundary. A Desktop entry has neither and stays completely inert here.
11
- const commands = tuiContext.get('commands', false);
12
- if (commands === undefined)
13
- return;
14
- // Newer dsh-TUI versions attribute commands to their owning plugin through
15
- // this optional service. Older versions only expose the direct registry.
16
- const pluginHost = tuiContext.get('tuiPluginHost', false);
17
- const trees = tuiContext.get('tuiCommandTrees', false);
18
- const scenes = tuiContext.get('tuiScenes', false);
19
- const login = new RemoteLoginController(resolveTarget);
20
- const LoginScene = createRemoteLoginScene(login);
21
- const StatusScene = createRemoteStatusScene(resolveTarget);
22
- tuiContext.effect(() => {
23
- const definition = {
24
- name: 'remote',
25
- description: 'Manage Remote Host login and connection status',
26
- input: { hint: '[status | login [github|zhihu] | logout]' },
27
- recordInput: false,
28
- handler: async ({ rawInput }) => {
29
- const args = rawInput.trim().split(/\s+/u).filter(Boolean);
30
- const command = args[0] ?? 'status';
31
- if (command === 'status' && args.length <= 1) {
32
- if (scenes?.open(REMOTE_STATUS_SCENE_ID) === true)
33
- return { kind: 'success' };
34
- return { kind: 'success', text: formatRemoteStatusInline(resolveTarget()) };
35
- }
36
- if (command === 'login' && args.length <= 2) {
37
- const provider = args[1] ?? ENABLED_QR_PROVIDERS[0] ?? 'wechat';
38
- if (!isEnabledQrProvider(provider)) {
39
- return { kind: 'error', text: `Usage: /remote login [${ENABLED_QR_PROVIDERS.join('|')}]` };
40
- }
41
- if (scenes === undefined) {
42
- return {
43
- kind: 'error',
44
- text: `The Remote login screen is unavailable. Run "ds-harness-remote login ${provider}" outside dsh-TUI, then restart it.`,
45
- };
46
- }
47
- login.start(provider);
48
- if (!scenes.open(REMOTE_LOGIN_SCENE_ID)) {
49
- login.cancel();
50
- return { kind: 'error', text: 'The Remote login screen is unavailable.' };
51
- }
52
- return { kind: 'success' };
53
- }
54
- if (command === 'logout' && args.length === 1) {
55
- const target = resolveTarget();
56
- if (target === undefined)
57
- return remoteNotReady();
58
- try {
59
- await target.runtime.clearHostAuthorization();
60
- return {
61
- kind: 'success',
62
- text: 'Remote Host logged out and its local device identity was rotated.',
63
- };
64
- }
65
- catch (error) {
66
- return {
67
- kind: 'error',
68
- text: `Local Remote Host credentials were cleared, but Server revocation failed (${errorCode(error)}).`,
69
- };
70
- }
71
- }
72
- if (command === 'config') {
73
- return { kind: 'error', text: 'Host configuration is not supported yet.' };
74
- }
75
- return { kind: 'error', text: remoteCommandUsage() };
76
- },
77
- };
78
- const disposeCommand = registerRemoteCommand(tuiContext, commands, pluginHost, definition);
79
- const disposeTree = registerOptional(tuiContext, 'command completion', () => trees?.register({
80
- root: 'remote',
81
- descriptions: {
82
- en: 'Manage Remote Host login and connection status',
83
- zh: '管理 Remote Host 登录和连接状态',
84
- },
85
- children: remoteCommandChildren,
86
- }));
87
- const disposeScene = registerOptional(tuiContext, 'login scene', () => scenes?.register({
88
- id: REMOTE_LOGIN_SCENE_ID,
89
- title: 'Remote Host login',
90
- component: LoginScene,
91
- }, tuiContext));
92
- const disposeStatusScene = registerOptional(tuiContext, 'status scene', () => scenes?.register({
93
- id: REMOTE_STATUS_SCENE_ID,
94
- title: 'Remote Host status',
95
- component: StatusScene,
96
- }, tuiContext));
97
- return () => {
98
- login.cancel();
99
- disposeCommand();
100
- disposeTree();
101
- disposeScene();
102
- disposeStatusScene();
103
- };
104
- }, 'ds-harness-remote: dsh-tui /remote command');
105
- }
106
- function registerRemoteCommand(ctx, commands, pluginHost, definition) {
107
- if (pluginHost === undefined)
108
- return commands.register(definition);
109
- try {
110
- return pluginHost.registerCommand(ctx, definition);
111
- }
112
- catch (error) {
113
- // dsh rc.2 with dsh-TUI 0.10.0-beta.4 mounts the mediated service but its
114
- // Cordis bundle loader does not admit third-party activations yet. Keep the
115
- // command usable on that exact compatibility seam; every other mediated
116
- // registration failure remains fail-closed.
117
- if (!hasErrorCode(error, 'COMPONENT_NOT_ADMITTED'))
118
- throw error;
119
- ctx.logger.debug('dsh-TUI Remote command is using the legacy command registry because Component admission is unavailable');
120
- return commands.register(definition);
121
- }
122
- }
123
- function hasErrorCode(error, code) {
124
- return typeof error === 'object' && error !== null && 'code' in error
125
- && error.code === code;
126
- }
127
- function registerOptional(ctx, feature, register) {
128
- try {
129
- return register() ?? (() => { });
130
- }
131
- catch (error) {
132
- ctx.logger.warn(`dsh-TUI Remote ${feature} is unavailable`, { code: errorCode(error) });
133
- return () => { };
134
- }
135
- }
136
- function remoteCommandChildren(canonicalPath) {
137
- if (canonicalPath.length === 1 && canonicalPath[0] === 'remote') {
138
- return [
139
- {
140
- name: 'status',
141
- description: 'Show Remote Host authorization and connection status',
142
- descriptions: { zh: '查看 Remote Host 授权和连接状态' },
143
- },
144
- {
145
- name: 'login',
146
- description: 'Authorize this Host with a GitHub or Zhihu QR code',
147
- descriptions: { zh: '使用 GitHub 或知乎二维码授权当前 Host' },
148
- },
149
- {
150
- name: 'logout',
151
- description: 'Revoke this Host and rotate its local identity',
152
- descriptions: { zh: '撤销当前 Host 并轮换本地身份' },
153
- },
154
- ];
155
- }
156
- if (canonicalPath.length === 2 && canonicalPath[0] === 'remote' && canonicalPath[1] === 'login') {
157
- return ENABLED_QR_PROVIDERS.map((provider, index) => ({
158
- name: provider,
159
- description: `Sign in with ${oauthProviderName(provider)}${index === 0 ? ' (default)' : ''}`,
160
- descriptions: { zh: `使用${oauthProviderName(provider)}登录${index === 0 ? '(默认)' : ''}` },
161
- }));
162
- }
163
- return [];
164
- }
165
- function remoteStatusLines(target) {
166
- if (target === undefined) {
167
- return ['Remote Host is disabled or still starting. Check the ds-harness-remote settings and retry.'];
168
- }
169
- const { runtime, config } = target;
170
- const status = runtime.hostStatus();
171
- const diagnostics = runtime.diagnostics();
172
- const codex = runtime.codexStatus();
173
- const capabilities = new Set(diagnostics.capabilities);
174
- const connection = status.online
175
- ? 'online'
176
- : status.starting
177
- ? 'starting'
178
- : status.reconnecting
179
- ? 'reconnecting'
180
- : status.accountRequired
181
- ? 'authorization required'
182
- : 'offline';
183
- return [
184
- `Server: ${config.serverUrl ?? 'not configured'}`,
185
- 'Host control: enabled',
186
- `Device: ${status.deviceId ?? 'not initialized'}`,
187
- `Authorization: ${status.authorized ? status.account === undefined ? 'logged in' : `logged in (${status.account})` : 'logged out'}`,
188
- `Server connection: ${connection}`,
189
- ...(status.error === undefined ? [] : [`Connection error: ${status.error}`]),
190
- ...(status.error === 'CONNECTION_REPLACED'
191
- ? ['Another instance is using this Host identity. Stop it or use a separate DSH_HOME before reconnecting.']
192
- : status.error === 'SERVER_CREDENTIALS_BUSY'
193
- ? ['Credential refresh is locked. Stop all instances before removing an orphaned server-credentials.json.refresh-lock and authorizing again.']
194
- : status.accountRequired ? ['Authorize again with /remote login [github|zhihu].'] : []),
195
- `Harness Remote API: ${capabilities.has('harness.api.v1')
196
- ? 'available (ApiProxy)'
197
- : capabilities.has('harness.remote.v3')
198
- ? 'available (Typert Remote Session V3)'
199
- : capabilities.has('harness.remote.v1')
200
- ? 'available (Typert Remote)'
201
- : 'unavailable'}`,
202
- `Remote clients: ${diagnostics.activeConnections}`,
203
- `Codex Remote: ${codex.enabled ? codex.state : 'disabled'}`,
204
- '',
205
- 'Commands: /remote login [github|zhihu] · /remote status · /remote logout',
206
- ];
207
- }
208
- function formatRemoteStatusInline(target) {
209
- return remoteStatusLines(target).filter(Boolean).join(' · ');
210
- }
211
- function remoteCommandUsage() {
212
- return [
213
- 'Usage:',
214
- ' /remote',
215
- ' /remote status',
216
- ' /remote login [github|zhihu]',
217
- ' /remote logout',
218
- ].join('\n');
219
- }
220
- function remoteNotReady() {
221
- return {
222
- kind: 'error',
223
- text: 'Remote Host is disabled or still starting. Check the ds-harness-remote settings and retry.',
224
- };
225
- }
226
- class RemoteLoginController {
227
- resolveTarget;
228
- current = { phase: 'idle', provider: 'zhihu' };
229
- listeners = new Set();
230
- attempt = 0;
231
- constructor(resolveTarget) {
232
- this.resolveTarget = resolveTarget;
233
- }
234
- snapshot = () => this.current;
235
- subscribe = (listener) => {
236
- this.listeners.add(listener);
237
- return () => { this.listeners.delete(listener); };
238
- };
239
- start(provider) {
240
- const attempt = ++this.attempt;
241
- this.update({ phase: 'loading', provider });
242
- void this.run(attempt, provider);
243
- }
244
- cancel() {
245
- this.attempt += 1;
246
- }
247
- async run(attempt, provider) {
248
- try {
249
- const target = this.resolveTarget();
250
- if (target === undefined)
251
- throw new Error('REMOTE_NOT_READY');
252
- const session = await target.runtime.startHostOAuthQrLogin(provider);
253
- const [qr, compactQr] = await Promise.all([
254
- renderTerminalQr(session.scanUrl),
255
- renderCompactTerminalQr(session.scanUrl),
256
- ]);
257
- if (attempt !== this.attempt)
258
- return;
259
- this.update({ phase: 'waiting', provider, qr, compactQr, scanUrl: session.scanUrl });
260
- await this.poll(attempt, provider, session, target.runtime);
261
- }
262
- catch (error) {
263
- if (attempt !== this.attempt)
264
- return;
265
- this.update({ phase: 'error', provider, error: errorCode(error) });
266
- }
267
- }
268
- async poll(attempt, provider, session, runtime) {
269
- const deadline = Date.now() + session.expiresIn * 1_000;
270
- while (attempt === this.attempt && Date.now() < deadline) {
271
- try {
272
- const result = await runtime.pollHostOAuthQrLogin(session.qrId);
273
- if (attempt !== this.attempt)
274
- return;
275
- if (result.status === 'complete') {
276
- this.update({ phase: 'complete', provider, account: result.authorization.account });
277
- return;
278
- }
279
- if (result.status === 'expired')
280
- break;
281
- }
282
- catch (error) {
283
- if (!(error instanceof ServerApiError) || !error.retryable)
284
- throw error;
285
- }
286
- await wait(Math.min(QR_POLL_INTERVAL_MS, Math.max(1, deadline - Date.now())));
287
- }
288
- if (attempt === this.attempt)
289
- this.update({ phase: 'expired', provider });
290
- }
291
- update(snapshot) {
292
- this.current = snapshot;
293
- for (const listener of this.listeners)
294
- listener(snapshot);
295
- }
296
- }
297
- function createRemoteLoginScene(controller) {
298
- return function RemoteLoginScene({ React, ui, close }) {
299
- const [snapshot, setSnapshot] = React.useState(controller.snapshot());
300
- const terminal = ui.useTerminalSize();
301
- React.useEffect(() => {
302
- const unsubscribe = controller.subscribe(setSnapshot);
303
- return () => {
304
- unsubscribe();
305
- controller.cancel();
306
- };
307
- }, []);
308
- ui.useInput((input, key) => {
309
- if (key.escape === true || input.toLowerCase() === 'q') {
310
- controller.cancel();
311
- close();
312
- }
313
- });
314
- const provider = oauthProviderName(snapshot.provider);
315
- const other = ENABLED_QR_PROVIDERS.filter(candidate => candidate !== snapshot.provider)
316
- .map(candidate => `/remote login ${candidate}`).join(' or ');
317
- const children = [
318
- React.createElement(ui.Text, { key: 'title', bold: true, color: 'accent' }, 'Remote Host login'),
319
- React.createElement(ui.Text, { key: 'provider' }, other === ''
320
- ? `Provider: ${provider}`
321
- : `Provider: ${provider} · You can also use ${other}`),
322
- ];
323
- if (snapshot.phase === 'loading') {
324
- children.push(React.createElement(ui.Text, { key: 'loading', color: 'subtle' }, 'Creating authorization QR code…'));
325
- }
326
- else if (snapshot.phase === 'waiting' && snapshot.qr !== undefined && snapshot.scanUrl !== undefined) {
327
- const fullRows = snapshot.qr.split('\n').length;
328
- const fullColumns = printableWidth(snapshot.qr.split('\n')[0] ?? '');
329
- const useFullQr = terminal.rows >= fullRows + 7 && terminal.columns >= fullColumns + 4;
330
- const qr = useFullQr || snapshot.compactQr === undefined ? snapshot.qr : snapshot.compactQr;
331
- const qrRows = qr.split('\n').length;
332
- const qrColumns = printableWidth(qr.split('\n')[0] ?? '');
333
- if (terminal.rows < qrRows + 7 || terminal.columns < qrColumns + 4) {
334
- children.push(React.createElement(ui.Text, { key: 'size-warning', color: 'warning' }, `Resize the terminal to at least ${qrColumns + 4} × ${qrRows + 7} if the QR code is clipped.`));
335
- }
336
- children.push(React.createElement(ui.Text, { key: 'scan' }, 'Scan this QR code to authorize this Host:'), React.createElement(ui.Text, { key: 'qr', wrap: 'truncate' }, qr), React.createElement(ui.Text, { key: 'url', color: 'link', underline: true }, terminalLink(snapshot.scanUrl)), React.createElement(ui.Text, { key: 'waiting', color: 'subtle' }, 'Waiting for authorization…'));
337
- }
338
- else if (snapshot.phase === 'complete') {
339
- children.push(React.createElement(ui.Text, { key: 'complete', color: 'success' }, snapshot.account === undefined
340
- ? 'Remote Host login complete. The Host is reconnecting now.'
341
- : `Remote Host login complete for ${snapshot.account}. The Host is reconnecting now.`));
342
- }
343
- else if (snapshot.phase === 'expired') {
344
- children.push(React.createElement(ui.Text, { key: 'expired', color: 'warning' }, 'The QR code expired. Close this screen and run /remote login again.'));
345
- }
346
- else if (snapshot.phase === 'error') {
347
- children.push(React.createElement(ui.Text, { key: 'error', color: 'error' }, `Remote Host login failed (${snapshot.error ?? 'UNKNOWN'}).`));
348
- }
349
- children.push(React.createElement(ui.Text, { key: 'close', color: 'subtle' }, 'Press Esc or q to return.'));
350
- return React.createElement(ui.Box, {
351
- flexDirection: 'column',
352
- gap: 1,
353
- paddingX: Math.max(0, Math.min(2, Math.floor((terminal.columns - 1) / 2))),
354
- }, ...children);
355
- };
356
- }
357
- function createRemoteStatusScene(resolveTarget) {
358
- return function RemoteStatusScene({ React, ui, close }) {
359
- const terminal = ui.useTerminalSize();
360
- ui.useInput((input, key) => {
361
- if (key.escape === true || input.toLowerCase() === 'q')
362
- close();
363
- });
364
- const children = [
365
- React.createElement(ui.Text, { key: 'title', bold: true, color: 'accent' }, 'Remote Host status'),
366
- ...remoteStatusLines(resolveTarget()).map((line, index) => React.createElement(ui.Text, { key: `status-${index}`, color: line === '' ? 'subtle' : undefined }, line === '' ? ' ' : line)),
367
- React.createElement(ui.Text, { key: 'close', color: 'subtle' }, 'Press Esc or q to return.'),
368
- ];
369
- return React.createElement(ui.Box, {
370
- flexDirection: 'column',
371
- gap: 1,
372
- paddingX: Math.max(0, Math.min(2, Math.floor((terminal.columns - 1) / 2))),
373
- }, ...children);
374
- };
375
- }
376
- function terminalLink(url) {
377
- return `\u001B]8;;${url}\u0007${url}\u001B]8;;\u0007`;
378
- }
379
- function printableWidth(value) {
380
- return value.replace(/\u001B\[[0-9;]*m/gu, '').length;
381
- }
382
- function errorCode(error) {
383
- if (error instanceof ServerApiError)
384
- return error.code;
385
- if (error instanceof Error && 'code' in error && typeof error.code === 'string')
386
- return error.code;
387
- return 'CONNECTION_FAILED';
388
- }
389
- function wait(milliseconds) {
390
- return new Promise(resolve => setTimeout(resolve, milliseconds));
391
- }
392
- //# sourceMappingURL=tui-command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tui-command.js","sourceRoot":"","sources":["../src/tui-command.ts"],"names":[],"mappings":"AAEA,O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AAS,GAAG,kBAAkB,CAAA;AACvD,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAA;AACvD,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,KAAK,YAAY,cAAc;QAAE,OAAO,KAAK,CAAC,IAAI,CAAA;IACtD,IAAI,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,CAAA;IAClG,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED,SAAS,IAAI,CAAC,YAAoB;IAChC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAA;AAClE,CAAC"}
@@ -1,59 +0,0 @@
1
- export interface TypertGatewayRequest {
2
- namespace: string;
3
- method: string;
4
- /** Typert Remote payloads require one plain object under `args`. */
5
- args: Readonly<Record<string, unknown>>;
6
- signal?: AbortSignal;
7
- }
8
- export type TypertRpcResult = {
9
- ok: true;
10
- value?: unknown;
11
- } | {
12
- ok: false;
13
- error: {
14
- code: string;
15
- message: string;
16
- details: Record<string, unknown>;
17
- };
18
- };
19
- /** Legacy carrier open (≤0.1.6): the third argument is the cancellation signal. */
20
- export type LegacyWireStreamOpen = (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<AsyncIterable<unknown>>;
21
- /**
22
- * dsh 0.1.7-rc.1 carrier open: the third argument is the Client uplink and the
23
- * cancellation signal moves to the fifth position. Passing an `AbortSignal` as
24
- * the third argument makes the Host throw `signals[0] is not of type AbortSignal`.
25
- */
26
- export type Rc1WireStreamOpen = (endpoint: string, payload: unknown, uplink: AsyncIterable<unknown>, peer: unknown, signal: AbortSignal) => Promise<AsyncIterable<unknown>>;
27
- /** Carrier open signature of the running Harness release. */
28
- export type TypertWireStreamOpen = LegacyWireStreamOpen | Rc1WireStreamOpen;
29
- export interface TypertGatewayWireStreamLike {
30
- open: TypertWireStreamOpen;
31
- failure(error: unknown): {
32
- code: string;
33
- message: string;
34
- details: Record<string, unknown>;
35
- };
36
- }
37
- /** Public Gateway face shared by Harness rc.2 and alpha releases. */
38
- export interface TypertGatewayLike {
39
- invoke(request: TypertGatewayRequest): Promise<unknown>;
40
- stream?(request: TypertGatewayRequest): Promise<AsyncIterable<unknown>>;
41
- wireStream?: TypertGatewayWireStreamLike;
42
- }
43
- /** Carrier-level face captured from the alpha Gateway before target switching. */
44
- export interface LocalTypertGateway extends TypertGatewayLike {
45
- dispatch(endpoint: string, payload: unknown, signal: AbortSignal): Promise<TypertRpcResult>;
46
- open(endpoint: string, payload: unknown, signal: AbortSignal): Promise<AsyncIterable<unknown>>;
47
- failure(error: unknown): {
48
- code: string;
49
- message: string;
50
- details: Record<string, unknown>;
51
- };
52
- supportsCarrier: boolean;
53
- }
54
- export interface RemoteTypertGatewayTarget {
55
- invoke(request: TypertGatewayRequest): Promise<unknown>;
56
- dispatch(endpoint: string, payload: unknown, signal: AbortSignal): Promise<TypertRpcResult>;
57
- open(endpoint: string, payload: unknown, signal: AbortSignal): Promise<AsyncIterable<unknown>>;
58
- }
59
- //# sourceMappingURL=typert-gateway-contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typert-gateway-contract.d.ts","sourceRoot":"","sources":["../src/typert-gateway-contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACvC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,CA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FAAkF;AAClF,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC3F,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9F,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAA;IAC5F,eAAe,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC3F,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;CAC/F"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=typert-gateway-contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typert-gateway-contract.js","sourceRoot":"","sources":["../src/typert-gateway-contract.ts"],"names":[],"mappings":""}
@@ -1,85 +0,0 @@
1
- import type { LocalTypertGateway, RemoteTypertGatewayTarget, TypertGatewayLike, TypertGatewayRequest, TypertRpcResult } from './typert-gateway-contract.js';
2
- type RemoteInvoke = (request: TypertGatewayRequest) => Promise<unknown>;
3
- type CarrierDispatch = (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<TypertRpcResult>;
4
- type CarrierOpen = (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<AsyncIterable<unknown>>;
5
- export interface RemoteCommandSupport {
6
- execute: boolean;
7
- list: boolean;
8
- }
9
- /** Keeps the official Gateway object stable while its selected Host changes. */
10
- export declare class TypertGatewaySwitch {
11
- private readonly runtime;
12
- private readonly originalInvoke;
13
- private readonly localInvoke;
14
- private readonly originalStream?;
15
- private readonly localStream?;
16
- private readonly originalDispatch?;
17
- private readonly localDispatch?;
18
- private readonly originalOpen?;
19
- private readonly localOpen?;
20
- private remoteInvoke?;
21
- private remoteTarget?;
22
- private remoteSupport;
23
- private target?;
24
- private installed;
25
- /** Defaults to reachable so a caller that never wires this keeps the old behaviour. */
26
- private remoteAvailability;
27
- constructor(gateway: TypertGatewayLike);
28
- /** Original local dispatcher, used by the Host bridge without switch recursion. */
29
- local(): LocalTypertGateway;
30
- supportsCarrier(): boolean;
31
- status(): {
32
- mode: 'local' | 'remote';
33
- target?: {
34
- deviceId: string;
35
- name: string;
36
- };
37
- };
38
- install(): void;
39
- selectRemote(remote: RemoteInvoke | RemoteTypertGatewayTarget, support?: RemoteCommandSupport, target?: {
40
- deviceId: string;
41
- name: string;
42
- }): void;
43
- selectLocal(): void;
44
- /**
45
- * The local shell's carriers, for a remote target that owns only part of the
46
- * endpoint space. The Codex virtual Harness owns the CodeX domain; the shell's own
47
- * settings bootstrap, plugin registry and account reads must stay here, or the
48
- * window describes the remote Host instead of this installation.
49
- * @returns the captured local carriers, absent when the running release has none.
50
- */
51
- localCarrier(): {
52
- dispatch?: CarrierDispatch;
53
- open?: CarrierOpen;
54
- };
55
- restore(): void;
56
- /**
57
- * Whether the peer a remote target routes to is reachable right now.
58
- *
59
- * A remote-mode boot still needs its own local services — localizations, theme,
60
- * the plugin registry — before any remote work can happen. Routing those to a
61
- * peer that is not connected leaves them unanswered, so the whole shell fails to
62
- * activate: a dropped connection becomes "the application is unavailable" and
63
- * stays that way until the user restarts into local mode. Serve local while the
64
- * peer is away; the live session takes over again as soon as it is reachable.
65
- */
66
- setRemoteAvailability(check: () => boolean): void;
67
- private routesToRemote;
68
- private selectInvoke;
69
- /**
70
- * Run a remote call, and answer it locally when the peer turns out not to serve
71
- * that endpoint. A remote-mode boot still issues RPCs only the local shell can
72
- * answer: the Desktop asks the local Web server for its locale bootstrap over the
73
- * remote mux before any remote work happens. Forwarding those swept them to a host
74
- * that does not implement them, the locale plugin failed, and every entry
75
- * depending on it stayed pending. A genuine business error still propagates.
76
- * @param endpoint - endpoint being routed, for the diagnostic warning.
77
- * @param remote - the remote carrier call.
78
- * @param local - the local call used when the peer could not answer.
79
- * @returns the remote or local result.
80
- */
81
- private withLocalFallback;
82
- private failure;
83
- }
84
- export {};
85
- //# sourceMappingURL=typert-gateway-switch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typert-gateway-switch.d.ts","sourceRoot":"","sources":["../src/typert-gateway-switch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAElB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAGrC,KAAK,YAAY,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AACvE,KAAK,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;AAC5G,KAAK,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAA;AAgD/G,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,OAAO,CAAA;CACd;AAID,gFAAgF;AA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