sh3-core 0.15.3 → 0.16.0

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 (224) hide show
  1. package/dist/BrandSlot.svelte +9 -9
  2. package/dist/{Shell.svelte → Sh3.svelte} +65 -65
  3. package/dist/Sh3.svelte.d.ts +5 -0
  4. package/dist/__test__/render.js +1 -1
  5. package/dist/actions/ActionPanel.svelte +3 -3
  6. package/dist/actions/CommandPalette.svelte +2 -2
  7. package/dist/actions/MenuBar.svelte +1 -1
  8. package/dist/actions/MenuBar.test.js +1 -1
  9. package/dist/actions/MenuButton.svelte +3 -3
  10. package/dist/actions/dispatcher.svelte.js +1 -1
  11. package/dist/actions/listActive.js +1 -1
  12. package/dist/actions/listeners.js +6 -6
  13. package/dist/actions/selection.svelte.d.ts +2 -2
  14. package/dist/actions/selection.svelte.js +4 -4
  15. package/dist/actions/selection.test.js +1 -1
  16. package/dist/actions/{shellActions.test.js → sh3Actions.test.js} +14 -14
  17. package/dist/actions/state.svelte.d.ts +3 -3
  18. package/dist/actions/state.svelte.js +3 -3
  19. package/dist/actions/syncMountedViewIds.test.js +1 -1
  20. package/dist/actions/types.d.ts +1 -1
  21. package/dist/api.d.ts +5 -5
  22. package/dist/api.js +7 -7
  23. package/dist/app/admin/ApiKeysView.svelte +9 -9
  24. package/dist/app/admin/AuthSettingsView.svelte +6 -6
  25. package/dist/app/admin/SystemView.svelte +12 -12
  26. package/dist/app/admin/UsersView.svelte +8 -8
  27. package/dist/app/store/AppUpdateAvailableModal.svelte +14 -14
  28. package/dist/app/store/PermissionConfirmModal.svelte +20 -20
  29. package/dist/app/store/StoreView.svelte +51 -51
  30. package/dist/app/store/UninstallAppDialog.svelte +14 -14
  31. package/dist/app/store/storeShard.svelte.js +1 -1
  32. package/dist/app/store/verbs.js +1 -1
  33. package/dist/apps/lifecycle.d.ts +1 -1
  34. package/dist/apps/lifecycle.js +4 -4
  35. package/dist/apps/lifecycle.test.js +5 -5
  36. package/dist/apps/registry.svelte.d.ts +2 -2
  37. package/dist/apps/registry.svelte.js +3 -3
  38. package/dist/apps/types.d.ts +1 -1
  39. package/dist/auth/GuestBanner.svelte +19 -19
  40. package/dist/auth/SignInWall.svelte +17 -17
  41. package/dist/auth/auth.svelte.d.ts +1 -1
  42. package/dist/auth/auth.svelte.js +1 -1
  43. package/dist/boot/satellitePayload.js +1 -1
  44. package/dist/color/api.d.ts +1 -1
  45. package/dist/color/api.js +1 -1
  46. package/dist/color/{shell-api.js → sh3-api.js} +3 -3
  47. package/dist/conflicts/ConflictModal.svelte +1 -1
  48. package/dist/conflicts/ConflictModal.svelte.d.ts +1 -1
  49. package/dist/conflicts/DetailView.svelte +19 -19
  50. package/dist/conflicts/PromptView.svelte +9 -9
  51. package/dist/conflicts/adapter-documents.js +1 -1
  52. package/dist/conflicts/api.d.ts +1 -1
  53. package/dist/conflicts/api.js +2 -2
  54. package/dist/conflicts/renderer-registry.js +1 -1
  55. package/dist/conflicts/renderers/MetaOnlyRenderer.svelte +8 -8
  56. package/dist/conflicts/renderers/TextDiffRenderer.svelte +15 -15
  57. package/dist/conflicts/renderers/index.js +1 -1
  58. package/dist/conflicts/resolve-primitive.js +1 -1
  59. package/dist/conflicts/{shell-api.js → sh3-api.js} +2 -2
  60. package/dist/contributions/registry.js +1 -1
  61. package/dist/createShell.d.ts +2 -2
  62. package/dist/createShell.js +6 -6
  63. package/dist/host-entry.d.ts +1 -1
  64. package/dist/host-entry.js +2 -2
  65. package/dist/host.js +2 -2
  66. package/dist/index.d.ts +1 -1
  67. package/dist/index.js +2 -2
  68. package/dist/keys/ConsentDialog.svelte +15 -15
  69. package/dist/keys/consent.svelte.d.ts +2 -2
  70. package/dist/keys/consent.svelte.js +3 -3
  71. package/dist/keys/revocation-bus.svelte.d.ts +3 -3
  72. package/dist/keys/revocation-bus.svelte.js +3 -3
  73. package/dist/layout/DragPreview.svelte +9 -9
  74. package/dist/layout/LayoutRenderer.browser.test.js +2 -2
  75. package/dist/layout/LayoutRenderer.svelte +4 -4
  76. package/dist/layout/SlotContainer.svelte +12 -12
  77. package/dist/layout/SlotDropZone.svelte +2 -2
  78. package/dist/layout/inspection.d.ts +1 -1
  79. package/dist/layout/inspection.js +1 -1
  80. package/dist/layout/store.svelte.js +3 -3
  81. package/dist/layout/types.d.ts +1 -1
  82. package/dist/layouts-shard/LayoutSaveModal.svelte +20 -20
  83. package/dist/layouts-shard/LayoutsSection.svelte +11 -11
  84. package/dist/layouts-shard/filter.test.js +3 -3
  85. package/dist/layouts-shard/layoutsApi.test.js +3 -3
  86. package/dist/layouts-shard/layoutsShard.svelte.test.js +7 -7
  87. package/dist/migrations/mode-id-rename.js +2 -2
  88. package/dist/overlays/ConfirmDialog.svelte +8 -8
  89. package/dist/overlays/EntityAppearanceModal.svelte +19 -19
  90. package/dist/overlays/FloatFrame.svelte +20 -20
  91. package/dist/overlays/FloatLayer.svelte +1 -1
  92. package/dist/overlays/ModalFrame.svelte +5 -5
  93. package/dist/overlays/PopupFrame.svelte +4 -4
  94. package/dist/overlays/ToastItem.svelte +12 -12
  95. package/dist/overlays/float.d.ts +2 -2
  96. package/dist/overlays/float.js +3 -3
  97. package/dist/overlays/float.test.js +6 -6
  98. package/dist/overlays/modal.js +1 -1
  99. package/dist/overlays/modal.test.js +2 -2
  100. package/dist/overlays/parentHost.js +2 -2
  101. package/dist/overlays/parentHost.test.js +5 -5
  102. package/dist/overlays/popup.js +2 -2
  103. package/dist/overlays/popup.test.js +2 -2
  104. package/dist/overlays/roots.js +4 -4
  105. package/dist/overlays/toast.js +1 -1
  106. package/dist/overlays/types.js +3 -3
  107. package/dist/primitives/Button.svelte +16 -16
  108. package/dist/primitives/Collapsible.svelte +11 -11
  109. package/dist/primitives/ResizableSplitter.svelte +10 -10
  110. package/dist/primitives/TabbedPanel.svelte +19 -19
  111. package/dist/primitives/base.css +57 -57
  112. package/dist/primitives/widgets/ColorSwatch.svelte +15 -15
  113. package/dist/primitives/widgets/ColorSwatch.svelte.test.js +4 -4
  114. package/dist/primitives/widgets/Field.svelte +20 -20
  115. package/dist/primitives/widgets/FilePicker.svelte +13 -13
  116. package/dist/primitives/widgets/IconPicker.svelte +14 -14
  117. package/dist/primitives/widgets/IconToggleGroup.svelte +14 -14
  118. package/dist/primitives/widgets/NumberInput.svelte +17 -17
  119. package/dist/primitives/widgets/PickerList.svelte +17 -17
  120. package/dist/primitives/widgets/RangeSlider.svelte +16 -16
  121. package/dist/primitives/widgets/Segmented.svelte +16 -16
  122. package/dist/primitives/widgets/Select.svelte +14 -14
  123. package/dist/primitives/widgets/Select.svelte.test.js +2 -2
  124. package/dist/primitives/widgets/Slider.svelte +20 -20
  125. package/dist/primitives/widgets/SliderGroup.svelte +2 -2
  126. package/dist/primitives/widgets/Textarea.svelte +13 -13
  127. package/dist/primitives/widgets/_select-listbox.svelte +15 -15
  128. package/dist/projects/session-state.svelte.js +1 -1
  129. package/dist/projects-shard/DeleteProjectDialog.svelte +12 -12
  130. package/dist/projects-shard/ProjectManage.svelte +25 -25
  131. package/dist/projects-shard/ProjectsSection.svelte +12 -12
  132. package/dist/registry/installer.d.ts +2 -2
  133. package/dist/registry/installer.js +2 -2
  134. package/dist/registry/loader.js +1 -1
  135. package/dist/registry/permission-descriptions.js +2 -2
  136. package/dist/registry/permission-descriptions.test.js +1 -1
  137. package/dist/runtime/runVerb-shell.test.js +2 -2
  138. package/dist/runtime/runVerb.js +4 -4
  139. package/dist/runtime/runVerb.test.js +4 -4
  140. package/dist/satellite/SatelliteShell.svelte +2 -2
  141. package/dist/{shell → sh3}/views/KeysAndPeers.svelte +7 -7
  142. package/dist/sh3Api/headless.d.ts +4 -0
  143. package/dist/{shell-shard/shellApi.js → sh3Api/headless.js} +5 -5
  144. package/dist/{shell-shard/shellApi.svelte.test.js → sh3Api/headless.svelte.test.js} +11 -11
  145. package/dist/{shellApi → sh3Api}/window.js +2 -2
  146. package/dist/{shellApi → sh3Api}/window.test.js +1 -1
  147. package/dist/{shellRuntime.svelte.d.ts → sh3Runtime.svelte.d.ts} +22 -10
  148. package/dist/{shellRuntime.svelte.js → sh3Runtime.svelte.js} +12 -10
  149. package/dist/sh3Runtime.svelte.test.d.ts +1 -0
  150. package/dist/sh3Runtime.svelte.test.js +46 -0
  151. package/dist/sh3core-shard/AppInfoView.svelte +19 -19
  152. package/dist/sh3core-shard/{ShellHome.svelte → Sh3Home.svelte} +82 -82
  153. package/dist/sh3core-shard/Sh3Home.svelte.d.ts +3 -0
  154. package/dist/sh3core-shard/{ShellTitle.svelte → Sh3Title.svelte} +11 -11
  155. package/dist/sh3core-shard/Sh3Title.svelte.d.ts +3 -0
  156. package/dist/sh3core-shard/appActions.js +3 -3
  157. package/dist/sh3core-shard/sh3coreShard.svelte.js +7 -7
  158. package/dist/shards/activate.svelte.d.ts +1 -1
  159. package/dist/shards/activate.svelte.js +6 -6
  160. package/dist/shards/types.d.ts +5 -5
  161. package/dist/shards/types.js +2 -2
  162. package/dist/shell-shard/CommandLine.svelte +7 -7
  163. package/dist/shell-shard/InputLine.svelte +3 -3
  164. package/dist/shell-shard/ScrollbackView.svelte +2 -2
  165. package/dist/shell-shard/Terminal.svelte +5 -5
  166. package/dist/shell-shard/Terminal.svelte.d.ts +2 -2
  167. package/dist/shell-shard/dispatch-custom.test.js +2 -2
  168. package/dist/shell-shard/dispatch-gating.test.js +2 -2
  169. package/dist/shell-shard/dispatch-invoke.test.js +2 -2
  170. package/dist/shell-shard/dispatch-to-terminal.js +1 -1
  171. package/dist/shell-shard/dispatch.d.ts +2 -2
  172. package/dist/shell-shard/dispatch.js +2 -2
  173. package/dist/shell-shard/entries/PromptEntry.svelte +4 -4
  174. package/dist/shell-shard/entries/StatusEntry.svelte +4 -4
  175. package/dist/shell-shard/entries/TextEntry.svelte +3 -3
  176. package/dist/shell-shard/locateSlot.test.js +9 -9
  177. package/dist/shell-shard/manifest.js +2 -2
  178. package/dist/shell-shard/registry.d.ts +2 -2
  179. package/dist/shell-shard/rich/AppCard.svelte +1 -1
  180. package/dist/shell-shard/rich/AppsTable.svelte +1 -1
  181. package/dist/shell-shard/rich/HelpTable.svelte +1 -1
  182. package/dist/shell-shard/rich/HistoryList.svelte +1 -1
  183. package/dist/shell-shard/rich/ViewsTable.svelte +1 -1
  184. package/dist/shell-shard/rich/ZoneTree.svelte +2 -2
  185. package/dist/shell-shard/shellShard.svelte.d.ts +1 -1
  186. package/dist/shell-shard/shellShard.svelte.js +8 -8
  187. package/dist/shell-shard/terminal-dispatch.test.js +2 -2
  188. package/dist/shell-shard/toolbar/Toolbar.svelte +4 -4
  189. package/dist/shell-shard/toolbar/Toolbar.svelte.d.ts +2 -2
  190. package/dist/shell-shard/toolbar/slots/BusySlot.svelte +2 -2
  191. package/dist/shell-shard/toolbar/slots/FocusLockSlot.svelte +2 -2
  192. package/dist/shell-shard/toolbar/slots/ModeSlot.svelte +1 -1
  193. package/dist/shell-shard/toolbar/slots/TargetShardSlot.svelte +1 -1
  194. package/dist/shell-shard/toolbar/slots.d.ts +3 -3
  195. package/dist/shell-shard/verbs/apps.js +3 -3
  196. package/dist/shell-shard/verbs/help.js +1 -1
  197. package/dist/shell-shard/verbs/help.svelte.test.js +1 -1
  198. package/dist/shell-shard/verbs/history.js +1 -1
  199. package/dist/shell-shard/verbs/mode.js +2 -2
  200. package/dist/shell-shard/verbs/mode.test.js +2 -2
  201. package/dist/shell-shard/verbs/shards.js +1 -1
  202. package/dist/shell-shard/verbs/views.js +8 -8
  203. package/dist/shell-shard/verbs/zones.js +2 -2
  204. package/dist/state/zones.svelte.d.ts +2 -2
  205. package/dist/state/zones.svelte.js +4 -4
  206. package/dist/theme.d.ts +3 -3
  207. package/dist/theme.js +5 -5
  208. package/dist/tokens.css +68 -68
  209. package/dist/verbs/types.d.ts +5 -5
  210. package/dist/verbs/types.js +1 -1
  211. package/dist/version.d.ts +1 -1
  212. package/dist/version.js +1 -1
  213. package/package.json +1 -1
  214. package/dist/Shell.svelte.d.ts +0 -5
  215. package/dist/sh3core-shard/ShellHome.svelte.d.ts +0 -3
  216. package/dist/sh3core-shard/ShellTitle.svelte.d.ts +0 -3
  217. package/dist/shell-shard/shellApi.d.ts +0 -4
  218. /package/dist/actions/{shellActions.test.d.ts → sh3Actions.test.d.ts} +0 -0
  219. /package/dist/color/{shell-api.d.ts → sh3-api.d.ts} +0 -0
  220. /package/dist/conflicts/{shell-api.d.ts → sh3-api.d.ts} +0 -0
  221. /package/dist/{shell → sh3}/views/KeysAndPeers.svelte.d.ts +0 -0
  222. /package/dist/{shell-shard/shellApi.svelte.test.d.ts → sh3Api/headless.svelte.test.d.ts} +0 -0
  223. /package/dist/{shellApi → sh3Api}/window.d.ts +0 -0
  224. /package/dist/{shellApi → sh3Api}/window.test.d.ts +0 -0
@@ -0,0 +1,4 @@
1
+ import type { Sh3Api } from '../shell-shard/registry';
2
+ import type { ZoneManager } from '../state/types';
3
+ export declare function makeSh3ApiHeadless(zones?: ZoneManager): Sh3Api;
4
+ export declare function makeSh3ApiForTest(): Sh3Api;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Headless ShellApi factory.
2
+ * Headless Sh3Api factory.
3
3
  *
4
4
  * Built only from framework primitives (apps registry, layout inspection,
5
5
  * auth, float manager). No Svelte component imports — safe to load from
@@ -15,7 +15,7 @@ import { registeredShards, listStandaloneViews } from '../shards/activate.svelte
15
15
  import { inspectActiveLayout, focusView, closeTab, popoutView, dockFloat, dockIntoActiveLayout, locateSlot as locateSlotInActiveLayout, } from '../layout/inspection';
16
16
  import { floatManager } from '../overlays/float';
17
17
  import { getUser, isAdmin } from '../auth/index';
18
- import { makeDispatchToTerminal } from './dispatch-to-terminal';
18
+ import { makeDispatchToTerminal } from '../shell-shard/dispatch-to-terminal';
19
19
  const KNOWN_ZONES = ['ephemeral', 'session', 'workspace', 'user'];
20
20
  function collectTabEntries(node) {
21
21
  if (node.type === 'tabs') {
@@ -29,7 +29,7 @@ function collectTabEntries(node) {
29
29
  }
30
30
  return [];
31
31
  }
32
- export function makeShellApiHeadless(zones) {
32
+ export function makeSh3ApiHeadless(zones) {
33
33
  return {
34
34
  listApps() {
35
35
  return listRegisteredApps().map((m) => ({ id: m.id, label: m.label }));
@@ -168,6 +168,6 @@ export function makeShellApiHeadless(zones) {
168
168
  dispatchToTerminal: makeDispatchToTerminal({ headless: true }),
169
169
  };
170
170
  }
171
- export function makeShellApiForTest() {
172
- return makeShellApiHeadless();
171
+ export function makeSh3ApiForTest() {
172
+ return makeSh3ApiHeadless();
173
173
  }
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { makeShellApiHeadless } from './shellApi';
2
+ import { makeSh3ApiHeadless } from './headless';
3
3
  function makeMockZoneManager() {
4
4
  const data = {
5
5
  ephemeral: {},
@@ -14,46 +14,46 @@ function makeMockZoneManager() {
14
14
  clearAll: () => { },
15
15
  };
16
16
  }
17
- describe('shellApi listZones', () => {
17
+ describe('sh3Api listZones', () => {
18
18
  it('returns empty when no ZoneManager provided (stub mode)', () => {
19
- const api = makeShellApiHeadless();
19
+ const api = makeSh3ApiHeadless();
20
20
  expect(api.listZones()).toEqual([]);
21
21
  });
22
22
  it('returns one row per shard with the zones it has data in', () => {
23
23
  var _a, _b;
24
- const api = makeShellApiHeadless(makeMockZoneManager());
24
+ const api = makeSh3ApiHeadless(makeMockZoneManager());
25
25
  const rows = api.listZones();
26
26
  const byShard = new Map(rows.map((r) => [r.shardId, r.zones]));
27
27
  expect((_a = byShard.get('shard-a')) === null || _a === void 0 ? void 0 : _a.sort()).toEqual(['session', 'workspace']);
28
28
  expect((_b = byShard.get('shard-b')) === null || _b === void 0 ? void 0 : _b.sort()).toEqual(['user', 'workspace']);
29
29
  });
30
30
  it('filters by shardId when provided', () => {
31
- const api = makeShellApiHeadless(makeMockZoneManager());
31
+ const api = makeSh3ApiHeadless(makeMockZoneManager());
32
32
  const rows = api.listZones('shard-a');
33
33
  expect(rows).toHaveLength(1);
34
34
  expect(rows[0].shardId).toBe('shard-a');
35
35
  expect(rows[0].zones.sort()).toEqual(['session', 'workspace']);
36
36
  });
37
37
  it('returns empty array for unknown shardId', () => {
38
- const api = makeShellApiHeadless(makeMockZoneManager());
38
+ const api = makeSh3ApiHeadless(makeMockZoneManager());
39
39
  expect(api.listZones('not-a-shard')).toEqual([]);
40
40
  });
41
41
  });
42
- describe('shellApi readZone', () => {
42
+ describe('sh3Api readZone', () => {
43
43
  it('returns null when no ZoneManager provided', () => {
44
- const api = makeShellApiHeadless();
44
+ const api = makeSh3ApiHeadless();
45
45
  expect(api.readZone('shard-a', 'workspace')).toBe(null);
46
46
  });
47
47
  it('returns peeked value via ZoneManager', () => {
48
- const api = makeShellApiHeadless(makeMockZoneManager());
48
+ const api = makeSh3ApiHeadless(makeMockZoneManager());
49
49
  expect(api.readZone('shard-a', 'workspace')).toEqual({ bar: 2 });
50
50
  });
51
51
  it('returns null for unknown zone name', () => {
52
- const api = makeShellApiHeadless(makeMockZoneManager());
52
+ const api = makeSh3ApiHeadless(makeMockZoneManager());
53
53
  expect(api.readZone('shard-a', 'bogus')).toBe(null);
54
54
  });
55
55
  it('returns null for missing shard entry', () => {
56
- const api = makeShellApiHeadless(makeMockZoneManager());
56
+ const api = makeSh3ApiHeadless(makeMockZoneManager());
57
57
  expect(api.readZone('not-a-shard', 'workspace')).toBe(null);
58
58
  });
59
59
  });
@@ -1,5 +1,5 @@
1
1
  /*
2
- * shell.window — host-side facade for spawning satellite windows.
2
+ * sh3.window — host-side facade for spawning satellite windows.
3
3
  *
4
4
  * Under Tauri, `spawnSatellite` invokes the `sh3_spawn_satellite` Rust
5
5
  * command which opens a native WebviewWindow pointed at the embedded
@@ -24,7 +24,7 @@ function nextLabel() {
24
24
  export async function spawnSatellite(payload, opts = {}) {
25
25
  var _a, _b, _c, _d;
26
26
  if (!isTauri()) {
27
- console.warn('[sh3] shell.window.spawn called outside Tauri — no-op');
27
+ console.warn('[sh3] sh3.window.spawn called outside Tauri — no-op');
28
28
  return '';
29
29
  }
30
30
  const { invoke } = await import('@tauri-apps/api/core');
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest';
2
2
  import { spawnSatellite } from './window';
3
- describe('shell.window.spawn (non-Tauri)', () => {
3
+ describe('sh3.window.spawn (non-Tauri)', () => {
4
4
  beforeEach(() => {
5
5
  delete globalThis.__TAURI_INTERNALS__;
6
6
  });
@@ -9,15 +9,16 @@ import type { ConflictsApi } from './conflicts/api';
9
9
  import type { ColorApi } from './color/api';
10
10
  import { type OpenContextMenuOpts, type OpenPaletteOpts } from './actions/listeners';
11
11
  import type { ActiveActionDescriptor } from './actions/types';
12
+ import { type DispatchToTerminalResult } from './shell-shard/dispatch-to-terminal';
12
13
  /**
13
- * The process-wide shell singleton exposed to shards and the shell's own
14
+ * The process-wide sh3 singleton exposed to shards and the sh3's own
14
15
  * internal code. Provides state zone creation and overlay managers.
15
16
  * Shards receive a pre-bound version via `ShardContext` rather than
16
- * accessing `shell` directly.
17
+ * accessing `sh3` directly.
17
18
  */
18
- export interface Shell {
19
+ export interface Sh3 {
19
20
  /**
20
- * Declare the state zones a shard (or the shell itself) wants to use.
21
+ * Declare the state zones a shard (or the sh3 itself) wants to use.
21
22
  * Returns a live reactive object per declared zone. Persistent zones
22
23
  * are hydrated from the backend before the call returns.
23
24
  */
@@ -32,18 +33,29 @@ export interface Shell {
32
33
  float: FloatManager;
33
34
  /** Named layout presets per app. See overlays/presets.ts. */
34
35
  presets: PresetManager;
35
- /** Conflict manager view. Shell-owned modal for conflict arbitration. */
36
+ /** Conflict manager view. Sh3-owned modal for conflict arbitration. */
36
37
  conflicts: ConflictsApi;
37
38
  /** Color picker. Falls back to native <input type="color"> when no picker shard is contributed. */
38
39
  color: ColorApi;
39
40
  /** Actions facade — rebind keys, query bindings, open menus/palette. */
40
- actions: ShellActionsApi;
41
+ actions: Sh3ActionsApi;
42
+ /**
43
+ * Dispatch `line` through a Terminal view's normal submit path. Used by
44
+ * views outside a verb context (floating pickers, dialogs) to drive a
45
+ * terminal as if the user had typed the line. Resolves which terminal:
46
+ * focused → sole → fail. Returns synchronously with the routing outcome;
47
+ * the dispatch itself runs fire-and-forget.
48
+ *
49
+ * Mirrors `Sh3Api.dispatchToTerminal` (the verb-side surface). Both
50
+ * read the same module-scoped registry of live Terminal.svelte instances.
51
+ */
52
+ dispatchToTerminal(line: string): DispatchToTerminalResult;
41
53
  }
42
54
  /**
43
55
  * API for managing action bindings and triggering menus/palette
44
56
  * programmatically (e.g. from a future settings UI shard).
45
57
  */
46
- export interface ShellActionsApi {
58
+ export interface Sh3ActionsApi {
47
59
  /** Persist a custom shortcut for an action and refresh live state if the app is active. */
48
60
  rebind(appId: string, actionId: string, shortcut: string | null): Promise<void>;
49
61
  /** Remove a custom shortcut override and refresh live state if the app is active. */
@@ -60,7 +72,7 @@ export interface ShellActionsApi {
60
72
  * order. See {@link ActiveActionDescriptor}.
61
73
  *
62
74
  * Non-reactive: returns a fresh array on each call. Subscribe via
63
- * {@link ShellActionsApi.onActiveChange} to re-call when the active
75
+ * {@link Sh3ActionsApi.onActiveChange} to re-call when the active
64
76
  * set or shortcuts change.
65
77
  */
66
78
  listActive(): ActiveActionDescriptor[];
@@ -71,5 +83,5 @@ export interface ShellActionsApi {
71
83
  */
72
84
  onActiveChange(cb: () => void): () => void;
73
85
  }
74
- /** The process-wide shell instance. Framework-internal code uses this directly; shards receive a scoped view via `ShardContext`. */
75
- export declare const shell: Shell;
86
+ /** The process-wide sh3 instance. Framework-internal code uses this directly; shards receive a scoped view via `ShardContext`. */
87
+ export declare const sh3: Sh3;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * shell — the framework-facing entry point passed to shards.
2
+ * sh3 — the framework-facing entry point passed to shards.
3
3
  *
4
4
  * Conceptually this is the object a shard receives from its activation
5
5
  * callback; it exposes the APIs the shard is allowed to touch.
@@ -8,11 +8,11 @@
8
8
  * Phase 4: registerView (lives on ShardContext, not here).
9
9
  * Phase 5: modal / popup / toast overlay managers.
10
10
  *
11
- * For now `shell` is a module-level singleton. Once the shard lifecycle
12
- * exists in a fuller form, per-shard shells will be constructed per
11
+ * For now `sh3` is a module-level singleton. Once the shard lifecycle
12
+ * exists in a fuller form, per-shard sh3 instances will be constructed per
13
13
  * activation with the shardId baked in, so shards no longer need to pass
14
14
  * their own id to `state`. Overlay managers stay process-wide because
15
- * the layer stack is a shell-global resource.
15
+ * the layer stack is a sh3-global resource.
16
16
  */
17
17
  import { createStateZones } from './state/zones.svelte';
18
18
  import { modalManager } from './overlays/modal';
@@ -20,14 +20,15 @@ import { popupManager } from './overlays/popup';
20
20
  import { toastManager } from './overlays/toast';
21
21
  import { floatManager } from './overlays/float';
22
22
  import { presetManager } from './overlays/presets';
23
- import { conflictsApi } from './conflicts/shell-api';
24
- import { colorApi } from './color/shell-api';
23
+ import { conflictsApi } from './conflicts/sh3-api';
24
+ import { colorApi } from './color/sh3-api';
25
25
  import { loadUserBindings, saveUserBinding } from './actions/bindings-store';
26
26
  import { openContextMenu as listenersOpenContextMenu, openPalette as listenersOpenPalette, } from './actions/listeners';
27
27
  import { setUserBindings, getLiveDispatcherState, onActiveChange as onActiveChangeState, __notifyActiveChange, } from './actions/state.svelte';
28
28
  import { listActions, onActionsChange } from './actions/registry';
29
29
  import { listActiveFromEntries } from './actions/listActive';
30
- const shellActions = {
30
+ import { makeDispatchToTerminal } from './shell-shard/dispatch-to-terminal';
31
+ const sh3Actions = {
31
32
  async rebind(appId, actionId, shortcut) {
32
33
  await saveUserBinding(appId, actionId, shortcut);
33
34
  const current = getLiveDispatcherState();
@@ -64,8 +65,8 @@ const shellActions = {
64
65
  };
65
66
  },
66
67
  };
67
- /** The process-wide shell instance. Framework-internal code uses this directly; shards receive a scoped view via `ShardContext`. */
68
- export const shell = {
68
+ /** The process-wide sh3 instance. Framework-internal code uses this directly; shards receive a scoped view via `ShardContext`. */
69
+ export const sh3 = {
69
70
  state: createStateZones,
70
71
  modal: modalManager,
71
72
  popup: popupManager,
@@ -74,5 +75,6 @@ export const shell = {
74
75
  presets: presetManager,
75
76
  conflicts: conflictsApi,
76
77
  color: colorApi,
77
- actions: shellActions,
78
+ actions: sh3Actions,
79
+ dispatchToTerminal: makeDispatchToTerminal({ headless: false }),
78
80
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Targeted coverage for the `sh3` runtime singleton's dispatchToTerminal.
3
+ *
4
+ * The wiring is what matters: the singleton must consult the same module-
5
+ * scoped terminal-registry as Sh3Api.dispatchToTerminal so a Svelte view
6
+ * (which imports `sh3`) and a verb (which receives `vctx.sh3`) hit the
7
+ * same set of live Terminal handles. A view import is the only path a
8
+ * picker has — without this, the dispatchToTerminal API is unreachable
9
+ * from the place it was designed to be called.
10
+ */
11
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
12
+ import { sh3 } from './sh3Runtime.svelte';
13
+ import { registerTerminalView, __resetTerminalRegistryForTest, } from './shell-shard/terminal-registry';
14
+ function makeHandle(id, focusStamp = 0, dispatch = vi.fn(async () => undefined)) {
15
+ return {
16
+ id,
17
+ dispatch,
18
+ getFocusStamp: () => focusStamp,
19
+ getMode: () => ({ id: 'sh3', label: 'sh3', transport: 'none', autoRelocate: false, showCwd: true }),
20
+ };
21
+ }
22
+ describe('sh3 runtime singleton — dispatchToTerminal', () => {
23
+ beforeEach(() => {
24
+ __resetTerminalRegistryForTest();
25
+ });
26
+ it('returns no-terminal when registry is empty', () => {
27
+ const r = sh3.dispatchToTerminal('foo');
28
+ expect(r).toMatchObject({ ok: false, error: 'no-terminal', message: 'no terminal open' });
29
+ });
30
+ it('routes through the resolved handle when one is registered', () => {
31
+ const dispatch = vi.fn(async () => undefined);
32
+ registerTerminalView(makeHandle('term-1', 0, dispatch));
33
+ const r = sh3.dispatchToTerminal('apps');
34
+ expect(r).toEqual({ ok: true, terminalId: 'term-1' });
35
+ expect(dispatch).toHaveBeenCalledWith('apps');
36
+ });
37
+ it('shares the registry with Sh3Api.dispatchToTerminal (same handles, same routing)', () => {
38
+ const dispatch = vi.fn(async () => undefined);
39
+ registerTerminalView(makeHandle('term-shared', 0, dispatch));
40
+ // The singleton is the surface a Svelte view sees; it must hit the
41
+ // same registry as the verb-side Sh3Api.
42
+ const r = sh3.dispatchToTerminal('hi');
43
+ expect(r).toEqual({ ok: true, terminalId: 'term-shared' });
44
+ expect(dispatch).toHaveBeenCalledWith('hi');
45
+ });
46
+ });
@@ -94,15 +94,15 @@
94
94
  padding: 16px 20px;
95
95
  min-width: 360px;
96
96
  max-width: 520px;
97
- color: var(--shell-fg);
98
- background: var(--shell-bg);
97
+ color: var(--sh3-fg);
98
+ background: var(--sh3-bg);
99
99
  font: inherit;
100
100
  }
101
101
  header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
102
102
  header h2 { margin: 0; font-size: 16px; }
103
103
  header .id {
104
104
  font-size: 12px;
105
- color: var(--shell-fg-muted);
105
+ color: var(--sh3-fg-muted);
106
106
  }
107
107
  .version { margin: 4px 0 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
108
108
  .description { margin: 8px 0 12px; }
@@ -114,7 +114,7 @@
114
114
  }
115
115
  .row { margin: 6px 0; font-size: 13px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
116
116
  .label {
117
- color: var(--shell-fg-muted);
117
+ color: var(--sh3-fg-muted);
118
118
  font-size: 11px;
119
119
  text-transform: uppercase;
120
120
  letter-spacing: 0.04em;
@@ -124,31 +124,31 @@
124
124
  .chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
125
125
  .chips code {
126
126
  padding: 1px 6px;
127
- border: 1px solid var(--shell-border);
128
- border-radius: var(--shell-radius-sm, 3px);
127
+ border: 1px solid var(--sh3-border);
128
+ border-radius: var(--sh3-radius-sm, 3px);
129
129
  }
130
130
  .badge {
131
131
  font-size: 11px;
132
132
  padding: 1px 6px;
133
- border-radius: var(--shell-radius-sm, 3px);
134
- background: var(--shell-bg-elevated);
135
- color: var(--shell-fg-muted);
136
- border: 1px solid var(--shell-border);
133
+ border-radius: var(--sh3-radius-sm, 3px);
134
+ background: var(--sh3-bg-elevated);
135
+ color: var(--sh3-fg-muted);
136
+ border: 1px solid var(--sh3-border);
137
137
  }
138
- .installed { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--shell-border); }
138
+ .installed { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--sh3-border); }
139
139
  code {
140
- font-family: var(--shell-font-mono, monospace);
141
- background: var(--shell-bg-elevated);
140
+ font-family: var(--sh3-font-mono, monospace);
141
+ background: var(--sh3-bg-elevated);
142
142
  padding: 0 4px;
143
- border-radius: var(--shell-radius-sm, 3px);
143
+ border-radius: var(--sh3-radius-sm, 3px);
144
144
  }
145
145
  .actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
146
146
  .actions button {
147
- background: var(--shell-bg-elevated);
148
- color: var(--shell-fg);
149
- border: 1px solid var(--shell-border);
150
- border-radius: var(--shell-radius-sm, 3px);
147
+ background: var(--sh3-bg-elevated);
148
+ color: var(--sh3-fg);
149
+ border: 1px solid var(--sh3-border);
150
+ border-radius: var(--sh3-radius-sm, 3px);
151
151
  padding: 6px 14px; font: inherit; cursor: pointer;
152
152
  }
153
- .actions button:hover { border-color: var(--shell-accent); }
153
+ .actions button:hover { border-color: var(--sh3-accent); }
154
154
  </style>