dsh-hello 0.1.2 → 0.1.3

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 xdnote
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xdnote
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -248,7 +248,7 @@ the app probes `/dsh-hello/health`, and pairings live under `dsh-hello/*`.
248
248
  pairingTtlMs: 300000
249
249
  pairingCodeLength: 4
250
250
  pairingMaxAttempts: 8
251
- interactionTarget: browser-first # phone-first | browser-first | browser-only
251
+ interactionTarget: browser-only # browser-only | browser-first | phone-first (Default | DSH first | Device first)
252
252
  approvalWaitTimeoutMs: 120000
253
253
  questionWaitTimeoutMs: 120000
254
254
  allowSessionWideGrants: true
@@ -378,13 +378,14 @@ watermarks are shared across paired devices.
378
378
  ### Approval policy
379
379
 
380
380
  dsh hands an approval or a question to **one** answerer: the first listener that
381
- does not call `next()`. `interactionTarget` decides who that is.
381
+ does not call `next()`. `interactionTarget` decides who that is; the admin page
382
+ calls the same three choices Default, DSH first and Device first.
382
383
 
383
- | Value | Who answers |
384
- |---|---|
385
- | `browser-first` (default) | A live browser always answers. With no browser connected the app holds the request, even in the background. |
386
- | `phone-first` | A foreground app answers, even when a browser is connected; otherwise dsh's own listeners do. |
387
- | `browser-only` | Nobody here: the plugin registers no listener, so dsh behaves exactly as if it were not installed. The app shows a read-only prompt and hands the decision to the Web UI. |
384
+ | Admin label | Value | Who answers |
385
+ |---|---|---|
386
+ | Default (default) | `browser-only` | Nobody here: the plugin registers no listener, so dsh behaves exactly as if it were not installed. The app shows a read-only prompt and hands the decision to the Web UI. |
387
+ | DSH first | `browser-first` | A live web UI always answers. With no browser connected the app holds the request, even in the background. |
388
+ | Device first | `phone-first` | A foreground app answers, even when a browser is connected; otherwise dsh's own listeners do. |
388
389
 
389
390
  The plugin registers unscoped (`global`) waterfall listeners ahead of the
390
391
  browser's answerer, so the policy rather than listener order decides. dsh 0.2.2
package/cordis.patch.yml CHANGED
@@ -1,3 +1,3 @@
1
- - insert:
2
- - id: dsh-hello
3
- name: dsh-hello
1
+ - insert:
2
+ - id: dsh-hello
3
+ name: dsh-hello
package/lib/client.js CHANGED
@@ -36,6 +36,7 @@ window.__ModuleLoader__.load({
36
36
  .dd-head{padding:0 0 18px}
37
37
  .dd-title{font-size:18px;font-weight:600;margin:0 0 4px;color:var(--dsw-alias-label-primary)}
38
38
  .dd-desc{margin:0;font-size:13px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
39
+ .dd-oneLine{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
39
40
  .dd-row{display:flex;gap:24px;align-items:center;justify-content:space-between;padding:16px 0;border-bottom:0.5px solid var(--dsw-alias-border-l3,rgba(127,127,127,.22))}
40
41
  .dd-rowTop{flex-wrap:wrap;row-gap:10px}
41
42
  .dd-rowTop .dd-rowText{flex:1 1 240px}
@@ -94,6 +95,13 @@ window.__ModuleLoader__.load({
94
95
  lockHintOn: '已锁定:新设备无法配对,已连接的设备照常使用',
95
96
  oneTimeMode: '一次性',
96
97
  fixedMode: '永久性',
98
+ interactionTitle: '审批与提问',
99
+ interactionDefault: '默认',
100
+ interactionDshFirst: 'DSH 优先',
101
+ interactionDeviceFirst: '设备优先',
102
+ interactionHintDefault: '不发给手机,只在网页处理',
103
+ interactionHintDshFirst: '网页开着时由网页作答',
104
+ interactionHintDeviceFirst: '优先发给正在使用的设备',
97
105
  remaining: '剩余 {time}',
98
106
  reset: '重置',
99
107
  modify: '修改',
@@ -105,8 +113,6 @@ window.__ModuleLoader__.load({
105
113
  passwordInvalid: '请输入 4 位数字',
106
114
  confirm: '确定',
107
115
  cancel: '取消',
108
- resetTitle: '恢复为一次性配对码?',
109
- resetDesc: '当前永久码会立即失效,并生成新的一次性码。',
110
116
  qrTitle: '扫码/输入',
111
117
  qrLoading: '二维码加载中…',
112
118
  qrHint: '请用手机打开 DSH Hello,连接 → 添加服务器 → 使用插件配对 → 扫描二维码。',
@@ -135,6 +141,13 @@ window.__ModuleLoader__.load({
135
141
  lockHintOn: 'Locked: new devices cannot pair, while paired devices keep working',
136
142
  oneTimeMode: 'One-time',
137
143
  fixedMode: 'Permanent',
144
+ interactionTitle: 'Approvals & questions',
145
+ interactionDefault: 'Default',
146
+ interactionDshFirst: 'DSH first',
147
+ interactionDeviceFirst: 'Device first',
148
+ interactionHintDefault: 'Web UI only; nothing reaches devices',
149
+ interactionHintDshFirst: 'The open web UI answers first',
150
+ interactionHintDeviceFirst: 'The device in use answers first',
138
151
  remaining: '{time} left',
139
152
  reset: 'Reset',
140
153
  modify: 'Change',
@@ -146,8 +159,6 @@ window.__ModuleLoader__.load({
146
159
  passwordInvalid: 'Enter four digits',
147
160
  confirm: 'Confirm',
148
161
  cancel: 'Cancel',
149
- resetTitle: 'Restore one-time pairing?',
150
- resetDesc: 'The permanent code stops working immediately and a fresh one-time code is generated.',
151
162
  qrTitle: 'Scan or type',
152
163
  qrLoading: 'Loading QR…',
153
164
  qrHint: 'Open DSH Hello on your phone, then Connection → Add server → Plugin pairing → Scan QR code.',
@@ -268,6 +279,9 @@ window.__ModuleLoader__.load({
268
279
 
269
280
  const fixed = data?.fixed === true
270
281
  const locked = data?.locked === true
282
+ const interaction = data?.interactionTarget === 'phone-first' || data?.interactionTarget === 'browser-only'
283
+ ? data.interactionTarget
284
+ : 'browser-first'
271
285
  const remaining = !fixed && data ? Math.max(0, data.expiresAt - now) : null
272
286
  const left = remaining === null
273
287
  ? ''
@@ -295,15 +309,33 @@ window.__ModuleLoader__.load({
295
309
  }
296
310
  }
297
311
 
312
+ async function setInteractionTarget(target) {
313
+ setBusy(true)
314
+ setError(null)
315
+ try {
316
+ const response = await fetch(BASE + '/admin/interaction' + adminBaseQuery(), {
317
+ method: 'POST',
318
+ credentials: 'same-origin',
319
+ headers: { 'content-type': 'application/json' },
320
+ body: JSON.stringify({ target }),
321
+ })
322
+ if (!response.ok) {
323
+ const body = await response.json().catch(() => null)
324
+ throw new Error(body?.error?.message || t('operationFailed'))
325
+ }
326
+ setData(await response.json())
327
+ } catch (failure) {
328
+ setError(failure instanceof Error ? failure.message : String(failure))
329
+ } finally {
330
+ setBusy(false)
331
+ }
332
+ }
333
+
298
334
  const openPermanent = () => {
299
335
  setPassword('')
300
336
  setDialogError(null)
301
337
  setDialog('permanent')
302
338
  }
303
- const openReset = () => {
304
- setDialogError(null)
305
- setDialog('reset')
306
- }
307
339
  /**
308
340
  * One three-way switch: Lock, One-time, Permanent. Unlocking restores
309
341
  * whichever code mode was in force, so switching from Lock to another
@@ -316,7 +348,9 @@ window.__ModuleLoader__.load({
316
348
  return
317
349
  }
318
350
  if (locked) await setLocked(false)
319
- if (next === 'one-time' && fixed) openReset()
351
+ // Picking One-time drops the permanent code on the spot: the switch
352
+ // states the intent, so it must not ask a second time.
353
+ if (next === 'one-time' && fixed) { await perform({ action: 'auto' }); return }
320
354
  if (next === 'permanent' && !fixed) openPermanent()
321
355
  }
322
356
  const confirmPermanent = async () => {
@@ -333,14 +367,6 @@ window.__ModuleLoader__.load({
333
367
  setDialog(null)
334
368
  setPassword('')
335
369
  }
336
- const confirmReset = async () => {
337
- const failure = await perform({ action: 'auto' })
338
- if (failure !== null) {
339
- setDialogError(failure)
340
- return
341
- }
342
- setDialog(null)
343
- }
344
370
 
345
371
  const revokeDevice = async (device) => {
346
372
  const name = device.deviceName || String(device.deviceId || '').slice(0, 12)
@@ -445,7 +471,7 @@ window.__ModuleLoader__.load({
445
471
  h('div', { className: 'dd-control' },
446
472
  fixed
447
473
  ? h(Button, {
448
- variant: 'outline',
474
+ variant: 'primary',
449
475
  size: 'sm',
450
476
  disabled: busy,
451
477
  onClick: openPermanent,
@@ -462,6 +488,40 @@ window.__ModuleLoader__.load({
462
488
  ),
463
489
  ],
464
490
 
491
+ h('div', { className: 'dd-row dd-rowTop' },
492
+ h('div', { className: 'dd-rowText' },
493
+ h('span', { className: 'dd-label' }, t('interactionTitle')),
494
+ h('span', { className: 'dd-desc dd-oneLine' },
495
+ interaction === 'phone-first'
496
+ ? t('interactionHintDeviceFirst')
497
+ : interaction === 'browser-first'
498
+ ? t('interactionHintDshFirst')
499
+ : t('interactionHintDefault')),
500
+ ),
501
+ h('div', { className: 'dd-control' },
502
+ h('div', { className: 'dd-segment' },
503
+ h('button', {
504
+ type: 'button',
505
+ className: 'dd-segmentButton' + (interaction === 'browser-only' ? ' is-active' : ''),
506
+ disabled: busy || data === null,
507
+ onClick: () => { void setInteractionTarget('browser-only') },
508
+ }, t('interactionDefault')),
509
+ h('button', {
510
+ type: 'button',
511
+ className: 'dd-segmentButton' + (interaction === 'browser-first' ? ' is-active' : ''),
512
+ disabled: busy || data === null,
513
+ onClick: () => { void setInteractionTarget('browser-first') },
514
+ }, t('interactionDshFirst')),
515
+ h('button', {
516
+ type: 'button',
517
+ className: 'dd-segmentButton' + (interaction === 'phone-first' ? ' is-active' : ''),
518
+ disabled: busy || data === null,
519
+ onClick: () => { void setInteractionTarget('phone-first') },
520
+ }, t('interactionDeviceFirst')),
521
+ ),
522
+ ),
523
+ ),
524
+
465
525
  h('div', { className: 'dd-block' },
466
526
  h('span', { className: 'dd-label' }, t('devices')),
467
527
  h('div', { className: 'dd-devices' },
@@ -506,23 +566,17 @@ window.__ModuleLoader__.load({
506
566
  },
507
567
  h('div', { className: 'dd-modal', role: 'dialog', 'aria-modal': 'true' },
508
568
  h('h3', { className: 'dd-modalTitle' },
509
- dialog === 'permanent'
510
- ? (fixed ? t('modifyTitle') : t('setPermanentTitle'))
511
- : t('resetTitle')),
569
+ fixed ? t('modifyTitle') : t('setPermanentTitle')),
512
570
  h('p', { className: 'dd-desc' },
513
- dialog === 'permanent'
514
- ? (fixed ? t('modifyDesc') : t('setPermanentDesc'))
515
- : t('resetDesc')),
516
- dialog === 'permanent'
517
- ? h(Input, {
518
- className: 'dd-modalInput',
519
- value: password,
520
- placeholder: t('passwordPlaceholder'),
521
- autoFocus: true,
522
- autoComplete: 'off',
523
- onChange: event => setPassword(event.target.value.replace(/\D/g, '').slice(0, 4)),
524
- })
525
- : null,
571
+ fixed ? t('modifyDesc') : t('setPermanentDesc')),
572
+ h(Input, {
573
+ className: 'dd-modalInput',
574
+ value: password,
575
+ placeholder: t('passwordPlaceholder'),
576
+ autoFocus: true,
577
+ autoComplete: 'off',
578
+ onChange: event => setPassword(event.target.value.replace(/\D/g, '').slice(0, 4)),
579
+ }),
526
580
  dialogError === null ? null : h('p', { className: 'dd-error' }, dialogError),
527
581
  h('div', { className: 'dd-modalActions' },
528
582
  h(Button, {
@@ -535,7 +589,7 @@ window.__ModuleLoader__.load({
535
589
  variant: 'primary',
536
590
  size: 'sm',
537
591
  disabled: busy,
538
- onClick: () => { void (dialog === 'permanent' ? confirmPermanent() : confirmReset()) },
592
+ onClick: () => { void confirmPermanent() },
539
593
  }, t('confirm')),
540
594
  ),
541
595
  )),
package/lib/config.d.ts CHANGED
@@ -68,13 +68,15 @@ export interface Config {
68
68
  *
69
69
  * dsh dispatches both through one agent-scoped waterfall, so exactly one
70
70
  * answerer sees a request: whoever holds it first. This switch decides who
71
- * that is.
72
- * - `phone-first`: the app holds requests while it is in the foreground;
73
- * anything else falls through to dsh's own listeners (the browser).
74
- * - `browser-first`: a live browser client always answers; the app holds
75
- * only when no browser is connected (for example, phone-only on the go).
76
- * - `browser-only`: this plugin never answers - dsh behaves as if it were
77
- * not installed - and the app only shows a prompt that opens the Web UI.
71
+ * that is. The admin page offers the same three choices as Default, DSH
72
+ * first and Device first.
73
+ * - `browser-only` (Default): this plugin never answers - dsh behaves as if
74
+ * it were not installed - and the app only shows a prompt that opens the
75
+ * Web UI.
76
+ * - `browser-first` (DSH first): a live web UI always answers; the app holds
77
+ * only when no browser is connected (phone-only, on the go).
78
+ * - `phone-first` (Device first): the app holds requests while it is in the
79
+ * foreground; anything else falls through to dsh's own listeners.
78
80
  */
79
81
  interactionTarget: InteractionTarget;
80
82
  /** How long an approval request is held for the app before delegation. */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAE7C,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,yEAAyE;IACzE,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wBAAwB;IACxB,eAAe,EAAE,SAAS,GAAG,YAAY,CAAA;IACzC,+CAA+C;IAC/C,aAAa,EAAE,OAAO,CAAA;IACtB,4CAA4C;IAC5C,cAAc,EAAE,OAAO,CAAA;IACvB,yCAAyC;IACzC,cAAc,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,eAAe,GAAG,cAAc,CAAA;AAEhF,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAA;IACtB;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAA;IACxB,sDA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sB,EAAE,OAAO,CAAA;IAC/B;;;;OAIG;IACH,iBAAiB,EAAE,OAAO,CAAA;IAC1B,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,iBAAiB,EAAE,MAAM,CAAA;IACzB,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAA;IACpB,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAA;IACvB,0BAA0B;IAC1B,IAAI,EAAE,UAAU,CAAA;CACjB;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CAsChC,CAAA;AAEF,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAmD1E;AAUD,eAAO,MAAM,iBAAiB,EAAE,UAM/B,CAAA"}
package/lib/config.js CHANGED
@@ -13,7 +13,7 @@ export const Config = Schema.object({
13
13
  pairingMaxAttempts: Schema.number().default(8),
14
14
  pairingCode: Schema.string(),
15
15
  logPairingCode: Schema.boolean().default(true),
16
- interactionTarget: Schema.union(['phone-first', 'browser-first', 'browser-only']).default('browser-first'),
16
+ interactionTarget: Schema.union(['phone-first', 'browser-first', 'browser-only']).default('browser-only'),
17
17
  approvalWaitTimeoutMs: Schema.number().default(2 * 60 * 1000),
18
18
  questionWaitTimeoutMs: Schema.number().default(2 * 60 * 1000),
19
19
  allowSessionWideGrants: Schema.boolean().default(true),
@@ -55,7 +55,7 @@ export function normalizeConfig(input) {
55
55
  pairingCodeLength: raw.pairingCodeLength ?? 4,
56
56
  pairingMaxAttempts: raw.pairingMaxAttempts ?? 8,
57
57
  logPairingCode: raw.logPairingCode ?? true,
58
- interactionTarget: raw.interactionTarget ?? 'browser-first',
58
+ interactionTarget: raw.interactionTarget ?? 'browser-only',
59
59
  approvalWaitTimeoutMs: raw.approvalWaitTimeoutMs ?? 2 * 60 * 1000,
60
60
  questionWaitTimeoutMs: raw.questionWaitTimeoutMs ?? 2 * 60 * 1000,
61
61
  allowSessionWideGrants: raw.allowSessionWideGrants ?? true,
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,MAAM,MAAM,0BAA0B,CAAA;AA0G7C,MAAM,CAAC,MAAM,MAAM,GAAmB,MAAM,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACvD,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC9C,eAAe,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAChD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IACpD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;IAC5B,cAAc,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9C,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,eAAe,EAAE,cAAc,CAAU,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IACnH,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAC7D,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,CAA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MpE,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,CAAA;AACtC,eAAO,MAAM,IAAI,cAAc,CAAA;AAE/B;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAoD,CAAA;AAIvE;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA6H9F;AAmGD,OAAO,EAAE,eAAe,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAmB,KAAK,MAAM,IAAI,YAAY,EAAE,MAAM,aAAa,CAAA;AAGlF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAK5C,OAAO,EAAuB,eAAe,EAAE,MAAM,eAAe,CAAA;AAMpE,OAAO,EAAE,MAAM,EAAE,CAAA;AACjB,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,CAAA;AACtC,eAAO,MAAM,IAAI,cAAc,CAAA;AAE/B;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAoD,CAAA;AAIvE;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAmJ9F;AAmGD,OAAO,EAAE,eAAe,EAAE,CAAA"}
package/lib/index.js CHANGED
@@ -4193,7 +4193,7 @@ var Config = Schema.object({
4193
4193
  pairingMaxAttempts: Schema.number().default(8),
4194
4194
  pairingCode: Schema.string(),
4195
4195
  logPairingCode: Schema.boolean().default(true),
4196
- interactionTarget: Schema.union(["phone-first", "browser-first", "browser-only"]).default("browser-first"),
4196
+ interactionTarget: Schema.union(["phone-first", "browser-first", "browser-only"]).default("browser-only"),
4197
4197
  approvalWaitTimeoutMs: Schema.number().default(2 * 60 * 1e3),
4198
4198
  questionWaitTimeoutMs: Schema.number().default(2 * 60 * 1e3),
4199
4199
  allowSessionWideGrants: Schema.boolean().default(true),
@@ -4234,7 +4234,7 @@ function normalizeConfig(input) {
4234
4234
  pairingCodeLength: raw.pairingCodeLength ?? 4,
4235
4235
  pairingMaxAttempts: raw.pairingMaxAttempts ?? 8,
4236
4236
  logPairingCode: raw.logPairingCode ?? true,
4237
- interactionTarget: raw.interactionTarget ?? "browser-first",
4237
+ interactionTarget: raw.interactionTarget ?? "browser-only",
4238
4238
  approvalWaitTimeoutMs: raw.approvalWaitTimeoutMs ?? 2 * 60 * 1e3,
4239
4239
  questionWaitTimeoutMs: raw.questionWaitTimeoutMs ?? 2 * 60 * 1e3,
4240
4240
  allowSessionWideGrants: raw.allowSessionWideGrants ?? true,
@@ -4830,6 +4830,7 @@ var InteractionBroker = class {
4830
4830
  this.hub = hub;
4831
4831
  this.push = push2;
4832
4832
  this.logger = logger;
4833
+ this.target = config.interactionTarget;
4833
4834
  }
4834
4835
  ctx;
4835
4836
  config;
@@ -4843,12 +4844,19 @@ var InteractionBroker = class {
4843
4844
  foreground = /* @__PURE__ */ new Map();
4844
4845
  /** Hands held interactions back if a foreground app dies without a false ping. */
4845
4846
  presenceSweep = setInterval(() => this.releasePhoneHolds(), 15e3);
4847
+ /** Runtime policy: the config default, replaceable from the admin page. */
4848
+ target;
4849
+ getTarget() {
4850
+ return this.target;
4851
+ }
4852
+ setTarget(target) {
4853
+ if (target === this.target) return;
4854
+ this.target = target;
4855
+ this.logger.info(`[dsh-hello] interaction target is now ${target}`);
4856
+ if (target === "browser-only") this.releasePhoneHolds(true);
4857
+ }
4846
4858
  register() {
4847
4859
  this.presenceSweep.unref?.();
4848
- if (this.config.interactionTarget === "browser-only") {
4849
- this.logger.info("[dsh-hello] interactionTarget browser-only: the app will not answer approvals or questions");
4850
- return;
4851
- }
4852
4860
  const listen = { global: true, prepend: true };
4853
4861
  this.ctx.on("approval/request", async (...args) => {
4854
4862
  const req = args[0];
@@ -5174,7 +5182,7 @@ var InteractionBroker = class {
5174
5182
  */
5175
5183
  shouldHoldForPhone() {
5176
5184
  return shouldHoldInteraction({
5177
- target: this.config.interactionTarget,
5185
+ target: this.target,
5178
5186
  browserLive: this.browserWins(),
5179
5187
  foregroundPhone: this.phoneWins(),
5180
5188
  appConnected: this.appCanAnswer()
@@ -5195,8 +5203,8 @@ var InteractionBroker = class {
5195
5203
  * The app left the foreground (or stopped heartbeating). Any interaction it
5196
5204
  * was holding goes back to dsh so a connected browser can render it now.
5197
5205
  */
5198
- releasePhoneHolds() {
5199
- if (this.hasForegroundPhone()) return;
5206
+ releasePhoneHolds(force = false) {
5207
+ if (!force && this.hasForegroundPhone()) return;
5200
5208
  for (const [id, pending] of [...this.questions]) {
5201
5209
  if (!pending.phoneHold) continue;
5202
5210
  clearTimeout(pending.timer);
@@ -6367,6 +6375,22 @@ function registerRoutes(router, deps) {
6367
6375
  sendJson(rc.res, 200, await adminData(deps, requestBase(rc) ?? requestOrigin(deps, rc) ?? ""));
6368
6376
  }
6369
6377
  });
6378
+ router.add({
6379
+ method: "POST",
6380
+ pattern: "/admin/interaction",
6381
+ auth: "public",
6382
+ handler: async (rc) => {
6383
+ if (!adminAuthorized(deps, rc)) throw new HttpError(401, "admin-unauthorized", "open this page from an authenticated dsh browser");
6384
+ const body = rc.body ?? {};
6385
+ const target = body.target;
6386
+ if (target !== "phone-first" && target !== "browser-first" && target !== "browser-only") {
6387
+ throw new HttpError(400, "bad-target", "target must be phone-first, browser-first, or browser-only");
6388
+ }
6389
+ if (deps.saveInteractionTarget === void 0) throw new HttpError(503, "interaction-unavailable", "this Host cannot change the interaction policy");
6390
+ await deps.saveInteractionTarget(target);
6391
+ sendJson(rc.res, 200, await adminData(deps, requestBase(rc) ?? requestOrigin(deps, rc) ?? ""));
6392
+ }
6393
+ });
6370
6394
  router.add({
6371
6395
  method: "POST",
6372
6396
  pattern: "/admin/lock",
@@ -7380,10 +7404,11 @@ function scheduleCode(result) {
7380
7404
  return typeof code === "string" ? code : void 0;
7381
7405
  }
7382
7406
  function features(deps) {
7407
+ const target = deps.interactionTarget?.() ?? deps.config.interactionTarget;
7383
7408
  return {
7384
- approvals: deps.config.interactionTarget !== "browser-only",
7385
- questions: deps.config.interactionTarget !== "browser-only",
7386
- interactionTarget: deps.config.interactionTarget,
7409
+ approvals: target !== "browser-only",
7410
+ questions: target !== "browser-only",
7411
+ interactionTarget: target,
7387
7412
  presence: true,
7388
7413
  push: deps.push.isConfigured(),
7389
7414
  debugRoutes: deps.config.enableDebugRoutes,
@@ -7463,6 +7488,7 @@ async function adminData(deps, originBase) {
7463
7488
  formatted: view.formatted,
7464
7489
  fixed: view.fixed,
7465
7490
  locked: deps.pairing.isLocked(),
7491
+ interactionTarget: deps.interactionTarget?.() ?? deps.config.interactionTarget,
7466
7492
  expiresAt: view.fixed ? null : view.expiresAt,
7467
7493
  origin,
7468
7494
  basePath: deps.config.basePath,
@@ -8259,6 +8285,23 @@ async function apply(ctx, rawConfig) {
8259
8285
  }
8260
8286
  const interactions = new InteractionBroker(host, config, hub, push2, logger);
8261
8287
  interactions.register();
8288
+ const interactionRecordKey = "dsh-hello/interactions";
8289
+ if (credentials !== void 0) {
8290
+ try {
8291
+ const record = await credentials.readRecord(interactionRecordKey);
8292
+ const target = record?.payload?.target;
8293
+ if (target === "phone-first" || target === "browser-first" || target === "browser-only") {
8294
+ interactions.setTarget(target);
8295
+ }
8296
+ } catch (error) {
8297
+ logger.warn(`[dsh-hello] could not load the interaction target: ${shortError(error)}`);
8298
+ }
8299
+ }
8300
+ const saveInteractionTarget = async (target) => {
8301
+ interactions.setTarget(target);
8302
+ if (credentials === void 0) return;
8303
+ await credentials.modifyRecord(interactionRecordKey, async () => ({ kind: "grant", payload: { target } }));
8304
+ };
8262
8305
  const sessions = createSessionFacade(host);
8263
8306
  const terminals = new TerminalManager(host, logger);
8264
8307
  const connection = readService(ctx, "connection");
@@ -8292,7 +8335,9 @@ async function apply(ctx, rawConfig) {
8292
8335
  logger,
8293
8336
  version,
8294
8337
  pluginVersion: PLUGIN_VERSION,
8295
- webUrl
8338
+ webUrl,
8339
+ saveInteractionTarget,
8340
+ interactionTarget: () => interactions.getTarget()
8296
8341
  });
8297
8342
  ctx.effect(() => {
8298
8343
  const dispose = webServer.register(router.hostRoute());