@linxin666/dsh-remote-web-ui 0.1.1

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 (118) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +346 -0
  3. package/cordis.patch.yml +10 -0
  4. package/lib/client.js +2817 -0
  5. package/lib/index.js +1455 -0
  6. package/lib/invariant.js +21 -0
  7. package/lib/types/client/PairFailedNotice.d.ts +12 -0
  8. package/lib/types/client/PairFailedNotice.d.ts.map +1 -0
  9. package/lib/types/client/PhoneIcon.d.ts +19 -0
  10. package/lib/types/client/PhoneIcon.d.ts.map +1 -0
  11. package/lib/types/client/PluginSettingsCard.d.ts +78 -0
  12. package/lib/types/client/PluginSettingsCard.d.ts.map +1 -0
  13. package/lib/types/client/RemoteEntry.d.ts +10 -0
  14. package/lib/types/client/RemoteEntry.d.ts.map +1 -0
  15. package/lib/types/client/RemotePanel.d.ts +50 -0
  16. package/lib/types/client/RemotePanel.d.ts.map +1 -0
  17. package/lib/types/client/RemoteSettingsCard.d.ts +75 -0
  18. package/lib/types/client/RemoteSettingsCard.d.ts.map +1 -0
  19. package/lib/types/client/deep-link.d.ts +40 -0
  20. package/lib/types/client/deep-link.d.ts.map +1 -0
  21. package/lib/types/client/index.d.ts +54 -0
  22. package/lib/types/client/index.d.ts.map +1 -0
  23. package/lib/types/client/locales.d.ts +144 -0
  24. package/lib/types/client/locales.d.ts.map +1 -0
  25. package/lib/types/client/pair-api.d.ts +100 -0
  26. package/lib/types/client/pair-api.d.ts.map +1 -0
  27. package/lib/types/client/settings-form.d.ts +119 -0
  28. package/lib/types/client/settings-form.d.ts.map +1 -0
  29. package/lib/types/gate.d.ts +58 -0
  30. package/lib/types/gate.d.ts.map +1 -0
  31. package/lib/types/index.d.ts +78 -0
  32. package/lib/types/index.d.ts.map +1 -0
  33. package/lib/types/invariant.d.ts +16 -0
  34. package/lib/types/invariant.d.ts.map +1 -0
  35. package/lib/types/lan.d.ts +15 -0
  36. package/lib/types/lan.d.ts.map +1 -0
  37. package/lib/types/mobile/api.d.ts +64 -0
  38. package/lib/types/mobile/api.d.ts.map +1 -0
  39. package/lib/types/mobile/index.d.ts +10 -0
  40. package/lib/types/mobile/index.d.ts.map +1 -0
  41. package/lib/types/mobile/messages.d.ts +103 -0
  42. package/lib/types/mobile/messages.d.ts.map +1 -0
  43. package/lib/types/mobile/messages.test.d.ts +2 -0
  44. package/lib/types/mobile/messages.test.d.ts.map +1 -0
  45. package/lib/types/mobile/mobile-styles.d.ts +6 -0
  46. package/lib/types/mobile/mobile-styles.d.ts.map +1 -0
  47. package/lib/types/mobile/mobile-theme.d.ts +22 -0
  48. package/lib/types/mobile/mobile-theme.d.ts.map +1 -0
  49. package/lib/types/mobile/mobile-theme.test.d.ts +2 -0
  50. package/lib/types/mobile/mobile-theme.test.d.ts.map +1 -0
  51. package/lib/types/mobile/mux.d.ts +52 -0
  52. package/lib/types/mobile/mux.d.ts.map +1 -0
  53. package/lib/types/mobile/rpc.d.ts +38 -0
  54. package/lib/types/mobile/rpc.d.ts.map +1 -0
  55. package/lib/types/mobile/theme-toggle.d.ts +12 -0
  56. package/lib/types/mobile/theme-toggle.d.ts.map +1 -0
  57. package/lib/types/mobile/views/App.d.ts +59 -0
  58. package/lib/types/mobile/views/App.d.ts.map +1 -0
  59. package/lib/types/mobile/views/ChatView.d.ts +39 -0
  60. package/lib/types/mobile/views/ChatView.d.ts.map +1 -0
  61. package/lib/types/mobile/views/ChatView.test.d.ts +2 -0
  62. package/lib/types/mobile/views/ChatView.test.d.ts.map +1 -0
  63. package/lib/types/mobile/views/SessionListView.d.ts +27 -0
  64. package/lib/types/mobile/views/SessionListView.d.ts.map +1 -0
  65. package/lib/types/mobile/views/SessionListView.test.d.ts +2 -0
  66. package/lib/types/mobile/views/SessionListView.test.d.ts.map +1 -0
  67. package/lib/types/mobile/views/WorkspaceView.d.ts +19 -0
  68. package/lib/types/mobile/views/WorkspaceView.d.ts.map +1 -0
  69. package/lib/types/mobile-api.d.ts +41 -0
  70. package/lib/types/mobile-api.d.ts.map +1 -0
  71. package/lib/types/mobile-routes.d.ts +16 -0
  72. package/lib/types/mobile-routes.d.ts.map +1 -0
  73. package/lib/types/pairing.d.ts +215 -0
  74. package/lib/types/pairing.d.ts.map +1 -0
  75. package/lib/types/routes.d.ts +58 -0
  76. package/lib/types/routes.d.ts.map +1 -0
  77. package/lib/types/tunnel.d.ts +99 -0
  78. package/lib/types/tunnel.d.ts.map +1 -0
  79. package/package.json +104 -0
  80. package/src/client/PairFailedNotice.tsx +33 -0
  81. package/src/client/PhoneIcon.tsx +31 -0
  82. package/src/client/PluginSettingsCard.tsx +207 -0
  83. package/src/client/RemoteEntry.tsx +202 -0
  84. package/src/client/RemotePanel.tsx +186 -0
  85. package/src/client/RemoteSettingsCard.tsx +220 -0
  86. package/src/client/deep-link.ts +137 -0
  87. package/src/client/index.ts +167 -0
  88. package/src/client/locales.ts +149 -0
  89. package/src/client/pair-api.ts +176 -0
  90. package/src/client/remote.module.css +422 -0
  91. package/src/client/settings-card.module.css +296 -0
  92. package/src/client/settings-form.ts +294 -0
  93. package/src/css-modules.d.ts +6 -0
  94. package/src/gate.ts +121 -0
  95. package/src/index.ts +299 -0
  96. package/src/invariant.ts +32 -0
  97. package/src/lan.ts +21 -0
  98. package/src/mobile/api.ts +106 -0
  99. package/src/mobile/index.tsx +27 -0
  100. package/src/mobile/messages.test.ts +222 -0
  101. package/src/mobile/messages.ts +555 -0
  102. package/src/mobile/mobile-styles.ts +853 -0
  103. package/src/mobile/mobile-theme.test.ts +84 -0
  104. package/src/mobile/mobile-theme.ts +76 -0
  105. package/src/mobile/mux.ts +126 -0
  106. package/src/mobile/rpc.ts +90 -0
  107. package/src/mobile/theme-toggle.tsx +47 -0
  108. package/src/mobile/views/App.tsx +152 -0
  109. package/src/mobile/views/ChatView.test.tsx +243 -0
  110. package/src/mobile/views/ChatView.tsx +650 -0
  111. package/src/mobile/views/SessionListView.test.tsx +139 -0
  112. package/src/mobile/views/SessionListView.tsx +186 -0
  113. package/src/mobile/views/WorkspaceView.tsx +108 -0
  114. package/src/mobile-api.ts +271 -0
  115. package/src/mobile-routes.ts +77 -0
  116. package/src/pairing.ts +390 -0
  117. package/src/routes.ts +346 -0
  118. package/src/tunnel.ts +264 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pair-api.d.ts","sourceRoot":"","sources":["../../../src/client/pair-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAwB;AACxB,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,IAAI,CAAA;IACR,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,8DAA8D;IAC9D,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,KAAK,CAAA;IACT,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,KAAK,CAAA;IACT,IAAI,EAAE,iBAAiB,CAAA;CACxB;AAED,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,KAAK,CAAA;IACT,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAExG,8BAA8B;AAC9B,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,CAAA;CAAE,CAAA;AAEjF,sEAAsE;AACtE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAA;IACxC,GAAG,CAAC,EA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AAO,CAAC,CAsB7D"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Staged form model behind the plugin settings card. A card stages what the
3
+ * user types and writes it only when they save — the settings write is a
4
+ * durable, revision-fenced document mutation, so staging keeps what is on
5
+ * screen exactly what a save would store. Mirrors the official
6
+ * ui-plugin-config card-store pattern in a self-contained slice: this
7
+ * package must not depend on a sibling UI package.
8
+ */
9
+ import type { SettingsScope, SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client';
10
+ /** The write one field's staged text performs when the card is saved. */
11
+ export type FieldWrite = {
12
+ kind: 'set';
13
+ value: unknown;
14
+ } | {
15
+ kind: 'clear';
16
+ };
17
+ /** How one field converts between its stored value and its draft text. */
18
+ export interface FieldSpec {
19
+ /** Field name inside the namespace section. */
20
+ field: string;
21
+ /** Render a stored value as draft text; the empty string when the section carries none. */
22
+ format: (value: unknown) => string;
23
+ /**
24
+ * The write this draft text stages, or undefined when the text is not a
25
+ * value this field accepts — which blocks the save rather than discarding it.
26
+ */
27
+ parse: (text: string) => FieldWrite | undefined;
28
+ }
29
+ /** One field as the card renders it. */
30
+ export interface FieldState {
31
+ /** Draft text the control renders. */
32
+ text: string;
33
+ /** Whether saving would leave a user-layer entry for this field. */
34
+ overridden: boolean;
35
+ /** Whether the draft is not a value this field accepts, which blocks saving. */
36
+ invalid: boolean;
37
+ }
38
+ /** Form state every plugin settings card shares. */
39
+ export interface CardShell {
40
+ /** False while the namespace is not served to this client; the card renders nothing. */
41
+ available: boolean;
42
+ /** Whether the Host document accepts writes. */
43
+ writable: boolean;
44
+ /** Whether the form holds edits that a save would write. */
45
+ dirty: boolean;
46
+ /** Whether any staged draft is invalid, which blocks the save. */
47
+ invalid: boolean;
48
+ /** Whether a save is crossing the wire. */
49
+ saving: boolean;
50
+ /** Whether the last save did not land as staged; cleared by the next edit or save. */
51
+ failed: boolean;
52
+ }
53
+ /** The write actions the card's slot entry injects. */
54
+ export interface CardActions {
55
+ /** Stage draft text for one field. */
56
+ edit: (field: string, text: string) => void;
57
+ /** Stage a clear, so saving lets the field re-inherit the composition layer. */
58
+ resetField: (field: string) => void;
59
+ /** Write every staged edit, then re-seed from what the Host accepted. */
60
+ save: () => void;
61
+ /** Drop every staged edit. */
62
+ discard: () => void;
63
+ }
64
+ /** A whole-number field. An empty draft clears the field; any other draft that is not a finite number blocks the save. */
65
+ export declare function numberField(field: string): FieldSpec;
66
+ /** A free-text field. An empty draft clears the field. */
67
+ export declare function textField(field: string): FieldSpec;
68
+ /** A boolean field, edited through true/false draft text. */
69
+ export declare function booleanField(field: string): FieldSpec;
70
+ /**
71
+ * Stages one card's edits over one settings namespace and writes them on save.
72
+ *
73
+ * The Host is the only authority on whether a value was accepted — its
74
+ * validators own the constraints no schema can express — so the outcome is
75
+ * read back from the section rather than predicted here. A save that did not
76
+ * land keeps its drafts, so the user can correct them instead of retyping.
77
+ */
78
+ export declare class CardForm<T> {
79
+ private readonly scope;
80
+ private readonly specs;
81
+ private readonly staged;
82
+ private readonly listeners;
83
+ private saving;
84
+ private failed;
85
+ /** @param scope - the bound settings scope for this card's namespace. */
86
+ constructor(scope: SettingsScope<T>, specs: FieldSpec[]);
87
+ /** Publish a projection of this form, rebuilt whenever the scope or a draft changes. */
88
+ bind<S>(project: () => S): SnapshotStore<S>;
89
+ /** Read the card-level state: what the Host serves, and what a save would do. */
90
+ shell(): CardShell;
91
+ /** Read one field's state from the effective section and its staged draft. */
92
+ field(field: string): FieldState;
93
+ /** The actions the card's slot registration injects. */
94
+ actions(): CardActions;
95
+ /**
96
+ * Write every staged edit, then re-seed from what the Host accepted.
97
+ * @returns settlement after every write and the read-back.
98
+ */
99
+ save(): Promise<void>;
100
+ /**
101
+ * Every staged edit a save would write. An entry whose draft is not a value
102
+ * its field accepts carries no write: the form is still dirty, and the save
103
+ * refuses rather than dropping the edit. A staged edit that matches the
104
+ * effective section is not a write at all.
105
+ * @returns the planned writes, in the order the fields were staged.
106
+ */
107
+ private plan;
108
+ private clear;
109
+ private store;
110
+ private stage;
111
+ private specOf;
112
+ private snapshotOf;
113
+ private sectionValue;
114
+ private baseValue;
115
+ private userLayer;
116
+ private stored;
117
+ private publish;
118
+ }
119
+ //# sourceMappingURL=settings-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-form.d.ts","sourceRoot":"","sources":["../../../src/client/settings-form.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAyB,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAGjH,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAErB,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAA;IACb,2FAA2F;IAC3F,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAA;IAClC;;;OAGG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAA;CAChD;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAA;IACnB,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,wFAAwF;IACxF,SAAS,EAAE,OAAO,CAAA;IAClB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAA;IACjB,4DAA4D;IAC5D,KAAK,EAAE,OAAO,CAAA;IACd,kEAAkE;IAClE,OAAO,EAAE,OAAO,CAAA;IAChB,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAA;IACf,sFAAsF;IACtF,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,uDAAuD;AAC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MG;IACH,OAAO,CAAC,IAAI;YAiBE,KAAK;YAKL,KAAK;IAKnB,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,OAAO;CAGhB"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The `api/gate` listener: application-level access control layered on top
3
+ * of the transport fence (the fence is Host/Origin based and explicitly not
4
+ * an authentication layer — packages/client/connection documents this
5
+ * event as the sanctioned seam for pairing/revocation).
6
+ *
7
+ * Policy: loopback requests (the desktop) pass without a device identity;
8
+ * every non-loopback /api request must carry a live, non-revoked device
9
+ * cookie. This makes the QR the only way into a LAN-exposed dsh web and
10
+ * gives "停止" real teeth: revoked devices 403 on their next request,
11
+ * including the mux/SSE stream (which then dies on reconnect).
12
+ */
13
+ import type { IncomingMessage } from 'node:http';
14
+ import type { PairingService } from './pairing.ts';
15
+ /**
16
+ * Whether a normalized URL hostname names the local loopback authority.
17
+ * Semantics mirror the connection package's internal predicate (localhost,
18
+ * IPv6 loopback, any IPv4 address in 127/8); it is reimplemented here because
19
+ * the connection package no longer exports it — the fence now lives inside
20
+ * the connection plugin, and external host plugins only need the
21
+ * classification, not the whole trust decision.
22
+ * @param hostname - WHATWG URL hostname (IPv6 literals retain brackets).
23
+ * @returns true for localhost, IPv6 loopback, or any IPv4 address in 127/8.
24
+ */
25
+ export declare function isLoopbackHostname(hostname: string): boolean;
26
+ /** Whether a socket remote address names the loopback range (127/8, ::1, IPv4-mapped). */
27
+ export declare function isLoopbackAddress(address: string | undefined): boolean;
28
+ /**
29
+ * Read one cookie value from a Cookie header.
30
+ * @param header - the raw Cookie header value (or undefined).
31
+ * @param name - the cookie name.
32
+ * @returns the value, or undefined when absent.
33
+ */
34
+ export declare function readCookie(header: string | undefined, name: string): string | undefined;
35
+ /**
36
+ * The effective Host hostname of a request.
37
+ * @param request - node HTTP request.
38
+ * @returns the normalized hostname, or undefined when unparsable.
39
+ */
40
+ export declare function hostnameOf(request: IncomingMessage): string | undefined;
41
+ /** Whether a request comes from the desktop loopback client (loopback socket AND loopback Host). */
42
+ export declare function isLoopbackClient(request: IncomingMessage): boolean;
43
+ /**
44
+ * Build the api/gate listener for one pairing service.
45
+ * @param service - the pairing service.
46
+ * @param requirePairingForLan - when false, non-loopback requests pass
47
+ * without a device cookie (the feature then only manages tokens/status;
48
+ * revocation of paired devices still holds). A function is re-read per
49
+ * request, so a settings edit takes effect without a restart. Defaults to true.
50
+ * @param enabled - when false, every non-loopback request is vetoed while
51
+ * loopback stays available. A function is re-read per request so the fence
52
+ * stays mounted for the plugin lifetime and disabling the plugin cannot open
53
+ * a LAN-exposed /api. Defaults to true.
54
+ * @returns the cordis waterfall listener: call `next()` to delegate,
55
+ * return false (without calling it) to veto with 403.
56
+ */
57
+ export declare function makeGateListener(service: PairingService, requirePairingForLan?: boolean | (() => boolean), enabled?: boolean | (() => boolean)): (request: IncomingMessage, method: string | undefined, next: () => boolean | Promise<boolean>) => boolean | Promise<boolean>;
58
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAMtE;AAUD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAQvE;AAED,oGAAoG;AACpG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAKlE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,cAAc,EACvB,oBAAoB,GAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAQ,EACtD,OAAO,GAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAQ,GACxC,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAW9H"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Mobile remote control for the dsh web GUI — host half. Mounts the pairing
3
+ * service (one-time tokens, device sessions, revocation), the /api/pair
4
+ * route family (issue/accept/stop/heartbeat/status/events), the api/gate
5
+ * listener that enforces pairing on every other /api request from
6
+ * non-loopback hosts, and the presence sweep. The browser half (the
7
+ * `./client` entry) renders the sidebar entry, the pairing panel, and the
8
+ * phone-side pair/accept + deep-link flow.
9
+ */
10
+ import type { IncomingMessage } from 'node:http';
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import z from 'schemastery';
13
+ declare module '@deepseek-ai/cordis' {
14
+ interface Events {
15
+ /**
16
+ * Waterfall seam on the /api transport fence: the connection plugin
17
+ * fires this per /api request before bridging to the API proxy on
18
+ * deployments that carry the pairing/revocation seam; call `next()` to
19
+ * delegate, return false (without calling it) to veto with 403.
20
+ */
21
+ 'api/gate'(this: Context, request: IncomingMessage, method: string | undefined, next: () => boolean | Promise<boolean>): boolean | Promise<boolean>;
22
+ }
23
+ }
24
+ /** Stable cordis plugin name. */
25
+ export declare const name = "remote-web-ui";
26
+ /** Services required before the pairing surfaces can mount. */
27
+ export declare const inject: string[];
28
+ /**
29
+ * Settings namespace of the remote-control capability — the section the web
30
+ * settings surface edits. Spelled here rather than imported: the browser
31
+ * half spells the same value and must not depend on a Host package.
32
+ */
33
+ export declare const REMOTE_WEB_UI_SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
34
+ /** Plugin config, validated by the same-named schemastery schema. */
35
+ export interface Config {
36
+ /** Token lifetime in ms; the QR link dies after this. */
37
+ tokenTtlMs?: number;
38
+ /** A device is "online" while its lastSeenAt is newer than this (ms). */
39
+ offlineAfterMs?: number;
40
+ /** Hard cap on paired device sessions (oldest evicted when full). */
41
+ maxDevices?: number;
42
+ /** Cookie name carrying the paired device id. */
43
+ cookieName?: string;
44
+ /**
45
+ * When true (default), every non-loopback /api request must carry a live
46
+ * paired-device cookie — the QR is the only way into a LAN-exposed dsh
47
+ * web, and stop() genuinely cuts paired devices off. Set false to keep
48
+ * the fence's open-LAN behavior and use pairing only for tokens/status.
49
+ */
50
+ requirePairingForLan?: boolean;
51
+ /**
52
+ * Public base URL of a tunnel in front of this server (e.g. a Cloudflare
53
+ * Tunnel quick URL `https://xxx.trycloudflare.com` or a named-tunnel
54
+ * subdomain). When set, the QR link is built from it — a phone anywhere
55
+ * can pair — and its host is trusted by the phone-facing pairing fence.
56
+ * Leave unset for LAN-only usage. Malformed values are ignored with a
57
+ * warning (LAN-only behavior preserved). Ignored while `autoTunnel` is on.
58
+ */
59
+ publicBaseUrl?: string;
60
+ /**
61
+ * When true, the plugin runs its own Cloudflare quick tunnel (the
62
+ * cloudflared binary ships with the package — no user-side install) and
63
+ * feeds the minted public URL into both the QR base and the /api trust
64
+ * fence dynamically, so phones anywhere can pair without any manual
65
+ * tunnel setup. The manual `publicBaseUrl` is ignored while this is on.
66
+ */
67
+ autoTunnel?: boolean;
68
+ /** Master switch for the plugin (browser half + host pairing surfaces). */
69
+ enabled?: boolean;
70
+ }
71
+ export declare const Config: z<Config>;
72
+ /**
73
+ * Mount the pairing service, routes, gate listener, and presence sweep.
74
+ * @param ctx - host plugin context carrying webServer.
75
+ * @param config - resolved plugin config (schema defaults applied by the loader).
76
+ */
77
+ export declare function apply(ctx: Context, config?: Config): void;
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,CAAC,MAAM,aAAa,CAAA;AAU3B,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,MAAM;QACd;;;;;WAKG;QACH,UAAU,CACR,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GACrC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KAC9B;CACF;AAED,iCAAiC;AACjC,eAAO,MAAM,IAAI,kBAAkB,CAAA;AAEnC,+DAA+D;AAC/D,eAAO,MAAM,MAAM,UAA4B,CAAA;AAE/C;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,uDAAqC,CAAA;AAElF,qEAAqE;AACrE,MAAM,WAAW,MAAM;IACrB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAS3B,CAAA;AAwBF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CA8JzD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Package-owned invariant companion for `@linxin666/dsh-remote-web-ui`.
3
+ * @module @linxin666/dsh-remote-web-ui/invariant
4
+ */
5
+ import type { Context } from '@deepseek-ai/cordis';
6
+ /** Cordis companion plugin name. */
7
+ export declare const name = "remote-web-ui-invariant";
8
+ /** Service required before the companion can reserve package ownership. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Register this package's invariant companion.
12
+ * @param ctx - Cordis context carrying the invariant service.
13
+ * @returns the installed registration's disposer after setup succeeds.
14
+ */
15
+ export declare const apply: (ctx: Context) => Promise<() => void>;
16
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../src/invariant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAKlD,oCAAoC;AACpC,eAAO,MAAM,IAAI,4BAA4B,CAAA;AAC7C,2EAA2E;AAC3E,eAAO,MAAM,MAAM,UAAiB,CAAA;AAUpC;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,OAAO,KAAG,OAAO,CAAC,MAAM,IAAI,CACU,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * LAN address derivation for the pairing URLs. Mirrors the dsh CLI's
3
+ * boot-time sampling (apps/cli/src/app-cli-entry.ts `resolveLanTrust`): the
4
+ * pairing links may only name addresses the /api trust fence was configured
5
+ * with, so the same non-internal IPv4 derivation applies here — an external
6
+ * plugin cannot read the CLI's sampled snapshot, but the fence accepts
7
+ * exactly these literals, which is the property that matters.
8
+ */
9
+ /**
10
+ * Non-internal IPv4 interface addresses of this machine — the IP-literal
11
+ * authorities an all-interfaces bind is reachable by on the LAN.
12
+ * @returns the addresses in interface order (possibly empty).
13
+ */
14
+ export declare function lanIPv4Addresses(): string[];
15
+ //# sourceMappingURL=lan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lan.d.ts","sourceRoot":"","sources":["../../src/lan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAI3C"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Mobile-surface business API: the handful of host RPC methods the
3
+ * simplified surface needs. Types come from the harness apiproxy contract
4
+ * (type-only imports; the wire schemas stay in the bundle only through the
5
+ * rpc/mux layers).
6
+ */
7
+ import type { WorkspaceView } from '@deepseek-ai/dsh-host-apiproxy/api/workspace';
8
+ import type { SessionSummary, SessionModels, SessionProjectionsBlock } from '@deepseek-ai/dsh-host-apiproxy/api/sessions';
9
+ /** One session.list page. */
10
+ export interface SessionPage {
11
+ items: SessionSummary[];
12
+ /** Continuation cursor; undefined once the tail is reached. */
13
+ nextCursor?: string;
14
+ hasMore: boolean;
15
+ }
16
+ /** The session.create result (the id is the commit the caller navigates to). */
17
+ export interface CreatedSession {
18
+ sessionId: string;
19
+ /** The composition the new session runs (echoed so the caller can label it). */
20
+ agentPreset?: string;
21
+ }
22
+ /** One history page (already bounded to whole messages by the host). */
23
+ export interface HistoryPage {
24
+ events: import('@deepseek-ai/dsh-host-apiproxy/api/sessions').HistoryEntry[];
25
+ hasMore: boolean;
26
+ /**
27
+ * Projection baseline riding the tail page (permissions select etc.);
28
+ * absent when the deployment mounts no projection registry.
29
+ */
30
+ projections?: SessionProjectionsBlock;
31
+ }
32
+ /** The workspace roster (session ids come back per workspace). */
33
+ export declare function listWorkspaces(): Promise<WorkspaceView[]>;
34
+ /** One session.list page; omit the cursor for the first page. */
35
+ export declare function listSessions(cursor?: string): Promise<SessionPage>;
36
+ /**
37
+ * Create a blank session (entity birth precedes the first message). Name a
38
+ * workspace to attach it there, or a cwd; omitting both uses the host cwd.
39
+ */
40
+ export declare function createSession(options?: {
41
+ workspaceId?: string;
42
+ cwd?: string;
43
+ }): Promise<CreatedSession>;
44
+ /** One history window; omit beforeSeq for the tail page. */
45
+ export declare function history(sessionId: string, beforeSeq?: number, maxMessages?: number): Promise<HistoryPage>;
46
+ /** Send one text prompt (queued: the agent picks it up in order). */
47
+ export declare function prompt(sessionId: string, text: string): Promise<void>;
48
+ /** Send one slash command line (e.g. `/permission workspace-write`). */
49
+ export declare function sendCommand(sessionId: string, line: string): Promise<unknown>;
50
+ /** Fresh advisory model directory for one session (current + groups + failures). */
51
+ export declare function models(sessionId: string): Promise<SessionModels>;
52
+ /** Select the complete model selection (provider/model/reasoning effort) for a session. */
53
+ export declare function selectModel(sessionId: string, selection: {
54
+ provider: string;
55
+ model: string;
56
+ reasoningEffort?: string;
57
+ }): Promise<{
58
+ selected: {
59
+ provider: string;
60
+ model: string;
61
+ reasoningEffort?: string;
62
+ };
63
+ }>;
64
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/mobile/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAA;AAGzH,6BAA6B;AAC7B,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;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,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GACvE,OAAO,CAAC;IAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAOtF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Mobile surface entry: the standalone phone UI served at /m. Boots its own
3
+ * React tree (no main-UI module loader), talks to the host over the shared
4
+ * /api transport with the paired-device cookie, and renders a deliberately
5
+ * thin three-level surface:
6
+ * workspaces (landing, no new-session homepage) → sessions (paged) →
7
+ * chat (history paged on demand + live mux stream + prompt input).
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mobile/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Message fold: collapse a session event stream into a renderable, ordered
3
+ * message list for the mobile surface.
4
+ *
5
+ * The mobile page is an independent, self-contained bundle, so this module has
6
+ * no value imports: it re-declares a local `WireEvent` (a loose envelope with a
7
+ * typed `type` and a wide `data`) and folds it into {@link RenderMessage} rows.
8
+ * It is a pure, side-effect-free fold — callers hold the rendered list and feed
9
+ * the next batch of events in to get the next list. Caller-supplied `existing`
10
+ * messages are never mutated: every change builds a fresh message object.
11
+ *
12
+ * The data shapes follow the host session protocol (see the dsh session
13
+ * `types.ts` / `surface.ts` and the llm `types.ts` sources the reference audit
14
+ * read):
15
+ *
16
+ * - `user/message` data = `{ id, role, content: ContentBlock[], source }`
17
+ * - `assistant/message` data = `{ turn, step, message: { id, content }, usage? }`
18
+ * - `assistant/chunk` data = `{ turn, step, chunk: { type: 'text-delta' | 'reasoning-delta', text } }`
19
+ * - `turn/start` data = `{ turn }`
20
+ * - `turn/end` data = `{ turn, reason: { kind: 'error' | ... } }`
21
+ * - `tool/call` data = `{ turn, step, callId, name, arguments }`
22
+ * - `session/end-seed` empty data (skipped)
23
+ *
24
+ * Assistant content blocks (`text` vs `reasoning`) fold into two separate
25
+ * fields — `text` and `reasoning` — so the surface can show reasoning behind
26
+ * a collapsed disclosure instead of dumping it into the message body. Tool
27
+ * calls accumulate ordered details (`tools`) in addition to the plain
28
+ * `toolSummary` name list.
29
+ *
30
+ * The mobile message-level aliases `message/chunk`, `message/update` and
31
+ * `message/delete` are also accepted (assumed shapes documented below).
32
+ *
33
+ * Design notes:
34
+ * - Events are applied in ascending `seq` order.
35
+ * - A `seq` watermark is derived from `existing` (the max already-rendered
36
+ * message seq). Events whose seq is already at or below the watermark are
37
+ * skipped, which makes re-applying the same batch idempotent without
38
+ * double-folding streamed chunk text.
39
+ * - Create events additionally dedupe by message id, so a repeated
40
+ * `user/message` / `assistant/message` replaces in place instead of duplicating.
41
+ * - A pending assistant message (alive while `assistant/chunk`-style deltas
42
+ * keep arriving, `pending: true`) is finalized by the matching
43
+ * `assistant/message` (same id or `(turn, step)`) or closed by `turn/end`.
44
+ */
45
+ export interface RenderMessage {
46
+ /** Stable message identity — the wire id when present, else the event seq. */
47
+ readonly id: string;
48
+ readonly kind: 'user' | 'assistant';
49
+ /** The fully folded text (assistant chunks aggregate into their message). */
50
+ readonly text: string;
51
+ /**
52
+ * Folded reasoning text, kept separate from `text` so the surface can
53
+ * hide it behind a collapsed Think disclosure (web-UI parity).
54
+ */
55
+ readonly reasoning?: string;
56
+ /**
57
+ * Ordered tool calls of this assistant message, in first-seen order,
58
+ * driving the collapsible tool disclosure (name + raw arguments).
59
+ */
60
+ readonly tools?: ToolCallInfo[];
61
+ /** Seq of the latest event that touched this message (used for loadOlder). */
62
+ readonly seq: number;
63
+ /** Epoch ms of the latest touch. */
64
+ readonly time: number;
65
+ /** True while an assistant message is still receiving chunks (not yet closed). */
66
+ readonly pending?: boolean;
67
+ /** Plain-text tool call summary for this assistant message, e.g. "使用 bash / read". */
68
+ readonly toolSummary?: string;
69
+ /** Set when the owning turn ended in an error. */
70
+ readonly failed?: boolean;
71
+ }
72
+ /** One tool call attached to an assistant message (callId dedupes repeats). */
73
+ export interface ToolCallInfo {
74
+ /** Tool-call id (synthetic `${name}#${seq}` when the wire omitted it). */
75
+ readonly callId: string;
76
+ /** Tool name, e.g. "bash". */
77
+ readonly name: string;
78
+ /** Raw arguments JSON, when the event carried it. */
79
+ readonly arguments?: string;
80
+ }
81
+ /**
82
+ * The session event envelope as the mobile fold sees it. `data` is kept wide
83
+ * (unknown) so the fold reads fields defensively; `surfaceOp` / `sourceEventSeqs`
84
+ * are envelope metadata unrelated to message rendering and are ignored here.
85
+ */
86
+ export interface WireEvent {
87
+ readonly type: string;
88
+ readonly seq: number;
89
+ readonly time: number;
90
+ readonly data: unknown;
91
+ readonly sourceEventSeqs?: number[];
92
+ readonly surfaceOp?: unknown;
93
+ readonly ignorable?: true;
94
+ }
95
+ /**
96
+ * Fold a batch of session events into a renderable message list.
97
+ *
98
+ * @param events - events to apply, in any order (folded by ascending seq).
99
+ * @param existing - the previously rendered list (live-stream incremental tail).
100
+ * @returns messages sorted by seq.
101
+ */
102
+ export declare function foldEvents(events: readonly WireEvent[], existing?: readonly RenderMessage[]): RenderMessage[];
103
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/mobile/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,QAAQ,CAA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 -0,0 +1 @@
1
+ {"version":3,"file":"messages.test.d.ts","sourceRoot":"","sources":["../../../src/mobile/messages.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Mobile surface stylesheet, shipped as a string and injected at boot (the
3
+ * standalone page has no CSS-module pipeline).
4
+ */
5
+ export declare const mobileCss = "/* Mobile surface chrome: standalone stylesheet (no main-UI design tokens \u2014\n this page boots without the shell). Light-first palette; the dark palette\n applies only when the header toggle sets [data-theme='dark']. */\n\n:root {\n --m-bg: #f3f5f9;\n --m-bg-raised: #ffffff;\n --m-bg-input: #ffffff;\n --m-border: #dfe4ec;\n --m-text: #1c2333;\n --m-text-secondary: #4d5768;\n --m-text-tertiary: #8b95a7;\n --m-accent: #2f6fed;\n --m-accent-soft: rgba(47, 111, 237, 0.12);\n --m-danger: #d64545;\n --m-success: #1e9e6a;\n --m-radius: 12px;\n --m-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);\n --m-shadow-raise: 0 6px 20px rgba(16, 24, 40, 0.1);\n --m-backdrop: rgba(15, 23, 42, 0.4);\n}\n\n:root[data-theme='dark'] {\n --m-bg: #111418;\n --m-bg-raised: #1a1f26;\n --m-bg-input: #20262e;\n --m-border: #2b333d;\n --m-text: #e8eaed;\n --m-text-secondary: #9aa3ad;\n --m-text-tertiary: #6b747f;\n --m-accent: #4f8cff;\n --m-accent-soft: rgba(79, 140, 255, 0.14);\n --m-danger: #e5534b;\n --m-success: #3fb68b;\n --m-radius: 12px;\n --m-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n --m-shadow-raise: 0 6px 20px rgba(0, 0, 0, 0.4);\n --m-backdrop: rgba(0, 0, 0, 0.55);\n}\n\n* {\n box-sizing: border-box;\n}\n\nhtml,\nbody {\n margin: 0;\n padding: 0;\n height: 100%;\n background: var(--m-bg);\n color: var(--m-text);\n font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', 'Segoe UI', sans-serif;\n font-size: 15px;\n line-height: 1.5;\n -webkit-text-size-adjust: 100%;\n}\n\n/* The app fills exactly one viewport: the page itself never scrolls, each\n view owns its scroll region (chat history, session lists) and the chat\n composer stays pinned to the bottom of the screen. */\n#root {\n height: 100dvh;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n\n.mobile {\n min-height: 0;\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n}\n\n/* \u2500\u2500 header \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.mobile-header {\n position: sticky;\n top: 0;\n z-index: 10;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px;\n background: color-mix(in srgb, var(--m-bg) 88%, transparent);\n backdrop-filter: blur(10px);\n border-bottom: 1px solid var(--m-border);\n}\n\n.mobile-title {\n margin: 0;\n font-size: 17px;\n font-weight: 600;\n}\n\n.mobile-titleInline {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mobile-back {\n flex: none;\n width: 32px;\n height: 32px;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--m-text);\n font-size: 22px;\n line-height: 1;\n cursor: pointer;\n transition: background-color 0.12s ease, box-shadow 0.12s ease;\n}\n\n.mobile-back:active {\n background: var(--m-bg-raised);\n}\n\n.mobile-back:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--m-bg), 0 0 0 4px var(--m-accent);\n}\n\n.mobile-theme-toggle {\n flex: none;\n margin-left: auto;\n width: 32px;\n height: 32px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--m-text-secondary);\n cursor: pointer;\n transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;\n}\n\n.mobile-theme-toggle:active {\n background: var(--m-bg-raised);\n}\n\n.mobile-theme-toggle:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--m-bg), 0 0 0 4px var(--m-accent);\n}\n\n.mobile-theme-toggle svg {\n width: 18px;\n height: 18px;\n}\n\n/* \u2500\u2500 lists \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.mobile-list {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n list-style: none;\n margin: 0;\n padding: 8px 0 calc(env(safe-area-inset-bottom, 0px) + 16px);\n}\n\n.mobile-row {\n display: flex;\n align-items: center;\n gap: 10px;\n width: calc(100% - 24px);\n margin: 0 12px 8px;\n padding: 13px 14px;\n border: 1px solid var(--m-border);\n border-radius: 14px;\n background: var(--m-bg-raised);\n box-shadow: var(--m-shadow);\n color: var(--m-text);\n text-align: left;\n cursor: pointer;\n}\n\n.mobile-row:active {\n background: color-mix(in srgb, var(--m-text) 5%, var(--m-bg-raised));\n}\n\n.mobile-rowMain {\n flex: 1;\n min-width: 0;\n display: flex;\n align-items: baseline;\n gap: 8px;\n}\n\n.mobile-rowTitle {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 15px;\n}\n\n.mobile-rowMeta {\n flex: none;\n color: var(--m-text-tertiary);\n font-size: 12px;\n}\n\n.mobile-chevron {\n flex: none;\n color: var(--m-text-tertiary);\n font-size: 18px;\n}\n\n.mobile-live {\n margin-left: 6px;\n color: var(--m-success);\n font-size: 10px;\n vertical-align: middle;\n}\n\n/* \u2500\u2500 empty / error states \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.mobile-empty {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n padding: 32px;\n}\n\n.mobile-muted {\n margin: 0;\n color: var(--m-text-tertiary);\n}\n\n.mobile-error {\n margin: 0;\n color: var(--m-danger);\n}\n\n.mobile-pad {\n padding: 8px 16px;\n}\n\n/* \u2500\u2500 buttons \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.mobile-button {\n height: 38px;\n padding: 0 18px;\n border: 1px solid var(--m-border);\n border-radius: 10px;\n background: var(--m-bg-raised);\n color: var(--m-text);\n font-size: 14px;\n cursor: pointer;\n}\n\n.mobile-button:disabled {\n opacity: 0.5;\n}\n\n.mobile-block {\n display: block;\n width: calc(100% - 32px);\n margin: 4px 16px;\n}\n\n/* Primary action (create session): accent fill, readable on both themes. */\n.mobile-new {\n display: block;\n width: 100%;\n height: 44px;\n border: none;\n border-radius: 12px;\n background: linear-gradient(135deg, var(--m-accent) 0%, #4c8dff 100%);\n color: #fff;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n box-shadow: 0 2px 8px rgba(47, 111, 237, 0.3);\n}\n\n.mobile-new:active {\n opacity: 0.88;\n}\n\n.mobile-new:disabled {\n opacity: 0.6;\n}\n\n.mobile-hint {\n display: block;\n margin-top: 2px;\n color: var(--m-text-tertiary);\n font-size: 12px;\n}\n\n/* \u2500\u2500 chat \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.chat {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-height: 0;\n}\n\n.chat-scroll {\n flex: 1;\n overflow-y: auto;\n padding: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 12px);\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.chat-msg {\n max-width: 88%;\n padding: 10px 12px;\n border-radius: var(--m-radius);\n font-size: 14.5px;\n line-height: 1.55;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n}\n\n.chat-msg-user {\n align-self: flex-end;\n background: linear-gradient(135deg, var(--m-accent) 0%, #4c8dff 100%);\n color: #fff;\n border-bottom-right-radius: 4px;\n box-shadow: 0 1px 3px rgba(47, 111, 237, 0.28);\n}\n\n.chat-msg-assistant {\n align-self: flex-start;\n background: var(--m-bg-raised);\n border: 1px solid var(--m-border);\n border-bottom-left-radius: 4px;\n box-shadow: var(--m-shadow);\n}\n\n.chat-msg-pending .chat-msg-text::after {\n content: '\u258D';\n animation: chat-blink 1s steps(2) infinite;\n}\n\n@keyframes chat-blink {\n 50% {\n opacity: 0;\n }\n}\n\n.chat-msg-failed {\n border-color: var(--m-danger);\n}\n\n.chat-msg-failtag {\n display: inline-block;\n margin-top: 6px;\n padding: 1px 8px;\n border: 1px solid var(--m-danger);\n border-radius: 999px;\n color: var(--m-danger);\n font-size: 11px;\n}\n\n.chat-msg-time {\n display: block;\n margin-top: 4px;\n color: var(--m-text-tertiary);\n font-size: 10.5px;\n line-height: 1.2;\n}\n\n.chat-msg-toggle {\n display: block;\n margin-top: 8px;\n padding: 4px 0;\n border: none;\n background: transparent;\n color: var(--m-accent);\n font-size: 13px;\n cursor: pointer;\n}\n\n/* \u2500\u2500 message disclosures (reasoning / tools) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.chat-disclosure {\n margin-bottom: 8px;\n border: 1px solid var(--m-border);\n border-radius: 10px;\n background: color-mix(in srgb, var(--m-bg) 55%, transparent);\n overflow: hidden;\n}\n\n.chat-disclosure-head {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 7px 10px;\n border: none;\n background: transparent;\n color: var(--m-text);\n font-size: 12.5px;\n text-align: left;\n cursor: pointer;\n white-space: nowrap;\n}\n\n.chat-disclosure-caret {\n flex: none;\n color: var(--m-text-tertiary);\n font-size: 14px;\n line-height: 1;\n transition: transform 0.15s ease;\n}\n\n.chat-disclosure-open .chat-disclosure-caret {\n transform: rotate(90deg);\n}\n\n.chat-disclosure-label {\n flex: none;\n color: var(--m-text-secondary);\n}\n\n.chat-reasoning[data-pending] .chat-disclosure-label {\n color: var(--m-accent);\n}\n\n.chat-disclosure-summary {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n color: var(--m-text-tertiary);\n font-size: 12px;\n}\n\n.chat-disclosure-count {\n flex: none;\n color: var(--m-text-tertiary);\n font-size: 11px;\n}\n\n.chat-disclosure-body {\n padding: 8px 10px 10px;\n border-top: 1px dashed var(--m-border);\n color: var(--m-text-secondary);\n font-size: 12.5px;\n line-height: 1.6;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n max-height: 40vh;\n overflow-y: auto;\n}\n\n.chat-tools-body {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.chat-tool-item {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.chat-tool-name {\n color: var(--m-text);\n font-size: 12.5px;\n font-weight: 600;\n}\n\n.chat-tool-args {\n margin: 0;\n padding: 6px 8px;\n border-radius: 6px;\n background: var(--m-bg-input);\n color: var(--m-text-secondary);\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 11px;\n line-height: 1.5;\n overflow-wrap: break-word;\n white-space: pre-wrap;\n}\n\n/* \u2500\u2500 composer toolbar (model / permission chips) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.chat-tools {\n display: flex;\n gap: 8px;\n padding: 6px 12px 0;\n}\n\n.chat-chip {\n flex: 1;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: 6px;\n height: 32px;\n padding: 0 10px;\n border: 1px solid var(--m-border);\n border-radius: 999px;\n background: var(--m-bg-raised);\n box-shadow: var(--m-shadow);\n color: var(--m-text);\n font-size: 12px;\n cursor: pointer;\n}\n\n.chat-chip:active {\n border-color: var(--m-accent);\n background: var(--m-accent-soft);\n}\n\n.chat-chip-label {\n flex: none;\n color: var(--m-text-tertiary);\n}\n\n.chat-chip-value {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.chat-chip-chevron {\n flex: none;\n color: var(--m-text-tertiary);\n font-size: 14px;\n}\n\n/* \u2500\u2500 bottom sheets \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\n.sheet-backdrop {\n position: fixed;\n inset: 0;\n z-index: 50;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n background: var(--m-backdrop);\n animation: sheet-fade 0.18s ease;\n}\n\n@keyframes sheet-fade {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.sheet {\n max-height: 74dvh;\n display: flex;\n flex-direction: column;\n background: var(--m-bg-raised);\n border: 1px solid var(--m-border);\n border-bottom: none;\n border-radius: 16px 16px 0 0;\n box-shadow: var(--m-shadow-raise);\n padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);\n animation: sheet-up 0.22s ease;\n}\n\n@keyframes sheet-up {\n from {\n transform: translateY(40px);\n opacity: 0.6;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n\n.sheet-handle {\n flex: none;\n align-self: center;\n width: 36px;\n height: 4px;\n margin: 8px 0 4px;\n border-radius: 999px;\n background: var(--m-border);\n}\n\n.sheet-title {\n flex: none;\n padding: 6px 16px 10px;\n font-size: 15px;\n font-weight: 600;\n}\n\n.sheet-body {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 0 12px 8px;\n}\n\n.sheet-status {\n padding: 18px 8px;\n color: var(--m-text-tertiary);\n font-size: 13px;\n text-align: center;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n}\n\n.sheet-status-error {\n color: var(--m-danger);\n}\n\n.sheet-hint {\n margin: 0;\n color: var(--m-text-secondary);\n font-size: 12px;\n line-height: 1.5;\n max-width: 32em;\n}\n\n.sheet-error {\n margin: 0 0 8px;\n color: var(--m-danger);\n font-size: 12.5px;\n}\n\n.sheet-section {\n margin-bottom: 14px;\n}\n\n.sheet-section-title {\n padding: 4px 8px 6px;\n color: var(--m-text-tertiary);\n font-size: 12px;\n font-weight: 600;\n}\n\n.sheet-option {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n padding: 10px 12px;\n border: 1px solid transparent;\n border-radius: 10px;\n background: transparent;\n color: var(--m-text);\n text-align: left;\n cursor: pointer;\n}\n\n.sheet-option:active {\n background: var(--m-bg-input);\n}\n\n.sheet-option-selected {\n border-color: var(--m-accent);\n background: color-mix(in srgb, var(--m-accent) 12%, transparent);\n}\n\n.sheet-option:disabled {\n opacity: 0.5;\n}\n\n.sheet-option-copy {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.sheet-option-title {\n font-size: 14px;\n}\n\n.sheet-option-desc {\n color: var(--m-text-tertiary);\n font-size: 12px;\n line-height: 1.4;\n}\n\n.sheet-option-check {\n flex: none;\n color: var(--m-accent);\n font-size: 15px;\n font-weight: 700;\n}\n\n.sheet-confirm-desc {\n margin: 0 4px 14px;\n color: var(--m-text-secondary);\n font-size: 13px;\n line-height: 1.6;\n}\n\n.sheet-confirm-actions {\n display: flex;\n gap: 10px;\n padding: 4px;\n}\n\n.sheet-confirm-actions .mobile-button {\n flex: 1;\n}\n\n.sheet-confirm-danger {\n flex: 1;\n height: 38px;\n border: none;\n border-radius: 10px;\n background: var(--m-danger);\n color: #fff;\n font-size: 14px;\n cursor: pointer;\n}\n\n.sheet-confirm-danger:disabled {\n opacity: 0.5;\n}\n\n.chat-meta {\n margin-top: 4px;\n color: var(--m-text-tertiary);\n font-size: 11px;\n}\n\n.chat-typing {\n color: var(--m-text-tertiary);\n font-size: 13px;\n padding: 4px 2px;\n}\n\n.chat-inputbar {\n display: flex;\n gap: 8px;\n padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);\n border-top: 1px solid var(--m-border);\n background: var(--m-bg);\n}\n\n.chat-input {\n flex: 1;\n min-width: 0;\n min-height: 40px;\n max-height: 120px;\n padding: 9px 12px;\n border: 1px solid var(--m-border);\n border-radius: 10px;\n background: var(--m-bg-input);\n color: var(--m-text);\n font: inherit;\n font-size: 14.5px;\n resize: none;\n outline: none;\n}\n\n.chat-input:focus {\n border-color: var(--m-accent);\n}\n\n.chat-send {\n flex: none;\n align-self: flex-end;\n height: 40px;\n padding: 0 16px;\n border: none;\n border-radius: 10px;\n background: var(--m-accent);\n color: #fff;\n font-size: 14px;\n cursor: pointer;\n}\n\n.chat-send:disabled {\n opacity: 0.5;\n}\n\n.chat-load-older {\n align-self: center;\n margin: 4px 0;\n border: none;\n background: transparent;\n color: var(--m-text-secondary);\n font-size: 13px;\n cursor: pointer;\n padding: 6px 10px;\n}\n\n/* Touch surfaces have no hover, so keyboard focus must be fully visible.\n One shared ring keeps every interactive control consistent and readable\n on both palettes. */\n.mobile-row:focus-visible,\n.mobile-button:focus-visible,\n.mobile-new:focus-visible,\n.chat-send:focus-visible,\n.chat-chip:focus-visible,\n.chat-msg-toggle:focus-visible,\n.chat-load-older:focus-visible,\n.chat-disclosure-head:focus-visible,\n.sheet-option:focus-visible,\n.sheet-confirm-danger:focus-visible,\n.chat-input:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--m-bg), 0 0 0 4px var(--m-accent);\n}\n\n/* Accessibility: collapse every interaction/enter animation for\n reduced-motion users; surface layout itself stays static. */\n@media (prefers-reduced-motion: reduce) {\n .mobile-theme-toggle,\n .mobile-back,\n .mobile-row,\n .mobile-button,\n .mobile-new,\n .chat-send,\n .chat-chip,\n .chat-msg-toggle,\n .chat-load-older,\n .chat-disclosure-head,\n .chat-disclosure-caret,\n .chat-msg-pending .chat-msg-text::after,\n .sheet-backdrop,\n .sheet,\n .sheet-option,\n .sheet-confirm-danger,\n .chat-input {\n animation: none;\n transition: none;\n }\n}\n";
6
+ //# sourceMappingURL=mobile-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-styles.d.ts","sourceRoot":"","sources":["../../../src/mobile/mobile-styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,SAAS,48kBAg1BrB,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Mobile-surface theme: light by default, dark via an explicit persisted
3
+ * toggle. The standalone page boots without the shell, so there is no theme
4
+ * system to inherit — the choice is stored in localStorage and applied as a
5
+ * `data-theme` attribute on <html>; the stylesheet defines both palettes
6
+ * under `:root` (light) / `:root[data-theme='dark']` (dark).
7
+ *
8
+ * A tiny module store (subscribe/get) keeps the toggle button and the boot
9
+ * path in sync without threading props through the three view levels.
10
+ */
11
+ export type MobileTheme = 'light' | 'dark';
12
+ /** Current theme (light unless the user explicitly toggled to dark). */
13
+ export declare function getMobileTheme(): MobileTheme;
14
+ /** Subscribe to theme changes; returns the unsubscribe function. */
15
+ export declare function subscribeMobileTheme(listener: () => void): () => void;
16
+ /** Set the theme explicitly (persisted + applied to the document). */
17
+ export declare function setMobileTheme(theme: MobileTheme): void;
18
+ /** Flip light/dark and return the new theme. */
19
+ export declare function toggleMobileTheme(): MobileTheme;
20
+ /** Apply the persisted (or default) theme once at boot, before first paint. */
21
+ export declare function initMobileTheme(): void;
22
+ //# sourceMappingURL=mobile-theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-theme.d.ts","sourceRoot":"","sources":["../../../src/mobile/mobile-theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAmC1C,wEAAwE;AACxE,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED,oEAAoE;AACpE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAGrE;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAMvD;AAED,gDAAgD;AAChD,wBAAgB,iBAAiB,IAAI,WAAW,CAG/C;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mobile-theme.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-theme.test.d.ts","sourceRoot":"","sources":["../../../src/mobile/mobile-theme.test.ts"],"names":[],"mappings":""}