@crouton-kit/crouter 0.3.27 → 0.3.29
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/dist/build-root.js +4 -2
- package/dist/builtin-memory/crouter-development/marketplaces.md +7 -6
- package/dist/builtin-memory/crouter-development/personas/base-prompt.md +1 -1
- package/dist/builtin-memory/crouter-development/personas/orchestrator-prompt.md +1 -1
- package/dist/builtin-memory/crouter-development/personas.md +1 -1
- package/dist/builtin-memory/crouter-development/plugins.md +20 -18
- package/dist/builtin-memory/design.md +1 -1
- package/dist/builtin-memory/development.md +1 -1
- package/dist/builtin-memory/internal/INDEX.md +1 -1
- package/dist/builtin-memory/internal/examples/INDEX.md +1 -1
- package/dist/builtin-memory/internal/examples/imessage-assistant.md +2 -2
- package/dist/builtin-memory/internal/nodes-and-canvas.md +1 -1
- package/dist/builtin-memory/internal/storage-tiers.md +1 -1
- package/dist/builtin-memory/planning.md +1 -1
- package/dist/builtin-memory/spec.md +6 -4
- package/dist/builtin-personas/orchestration-kernel.md +4 -5
- package/dist/builtin-personas/runtime-base.md +8 -4
- package/dist/builtin-personas/spec/PERSONA.md +8 -4
- package/dist/builtin-personas/spec/orchestrator.md +5 -3
- package/dist/builtin-personas/spec/requirements/PERSONA.md +10 -0
- package/dist/builtin-views/canvas/core.mjs +586 -0
- package/dist/builtin-views/canvas/text.mjs +58 -0
- package/dist/builtin-views/canvas/tui.mjs +165 -0
- package/dist/builtin-views/canvas/web.jsx +120 -0
- package/dist/builtin-views/git-pr/core.mjs +673 -0
- package/dist/builtin-views/git-pr/text.mjs +84 -0
- package/dist/builtin-views/git-pr/tui.mjs +302 -0
- package/dist/builtin-views/git-pr/web.jsx +216 -0
- package/dist/builtin-views/inbox/_lib/render.mjs +1 -3
- package/dist/builtin-views/inbox/core.mjs +1273 -0
- package/dist/builtin-views/inbox/text.mjs +73 -0
- package/dist/builtin-views/inbox/tui.mjs +312 -0
- package/dist/builtin-views/inbox/web.jsx +188 -0
- package/dist/builtin-views/linkedin/core.mjs +906 -0
- package/dist/builtin-views/linkedin/text.mjs +69 -0
- package/dist/builtin-views/linkedin/tui.mjs +427 -0
- package/dist/builtin-views/linkedin/web.jsx +206 -0
- package/dist/builtin-views/workspace-sidebar/core.mjs +621 -0
- package/dist/builtin-views/workspace-sidebar/text.mjs +53 -0
- package/dist/builtin-views/workspace-sidebar/tui.mjs +142 -0
- package/dist/builtin-views/workspace-sidebar/web.jsx +109 -0
- package/dist/cli.js +3 -3
- package/dist/clients/attach/__tests__/action-parity.test.js +48 -0
- package/dist/clients/attach/__tests__/clipboard-image.test.js +76 -0
- package/dist/clients/attach/__tests__/editor-newline.test.js +57 -0
- package/dist/clients/attach/__tests__/git-info.test.js +31 -0
- package/dist/clients/attach/__tests__/onrequest-wired.test.js +20 -0
- package/dist/clients/attach/__tests__/reconnect-giveup.test.js +30 -0
- package/dist/clients/attach/__tests__/slash-quit-copy.test.js +42 -0
- package/dist/clients/attach/__tests__/titled-editor.test.d.ts +1 -0
- package/dist/clients/attach/__tests__/titled-editor.test.js +39 -0
- package/dist/clients/attach/attach-cmd.js +445 -41
- package/dist/clients/attach/auth-pickers.d.ts +9 -0
- package/dist/clients/attach/auth-pickers.js +194 -0
- package/dist/clients/attach/canvas-panels.d.ts +12 -0
- package/dist/clients/attach/canvas-panels.js +78 -0
- package/dist/clients/attach/chat-view.d.ts +27 -2
- package/dist/clients/attach/chat-view.js +98 -9
- package/dist/clients/attach/clipboard-image.d.ts +47 -8
- package/dist/clients/attach/clipboard-image.js +150 -26
- package/dist/clients/attach/clipboard-text.d.ts +3 -0
- package/dist/clients/attach/clipboard-text.js +39 -0
- package/dist/clients/attach/config-load.d.ts +54 -7
- package/dist/clients/attach/config-load.js +99 -3
- package/dist/clients/attach/context-message.d.ts +12 -0
- package/dist/clients/attach/context-message.js +72 -0
- package/dist/clients/attach/git-info.d.ts +20 -0
- package/dist/clients/attach/git-info.js +44 -0
- package/dist/clients/attach/graph-overlay.d.ts +43 -0
- package/dist/clients/attach/graph-overlay.js +306 -0
- package/dist/clients/attach/input-controller.d.ts +81 -13
- package/dist/clients/attach/input-controller.js +307 -67
- package/dist/clients/attach/pickers.d.ts +58 -0
- package/dist/clients/attach/pickers.js +171 -0
- package/dist/clients/attach/slash-commands.d.ts +44 -1
- package/dist/clients/attach/slash-commands.js +250 -27
- package/dist/clients/attach/titled-editor.d.ts +33 -0
- package/dist/clients/attach/titled-editor.js +84 -0
- package/dist/clients/attach/view-socket.d.ts +37 -2
- package/dist/clients/attach/view-socket.js +131 -7
- package/dist/clients/web/dev-server.d.ts +7 -0
- package/dist/clients/web/dev-server.js +59 -0
- package/dist/clients/web/events.d.ts +14 -0
- package/dist/clients/web/events.js +151 -0
- package/dist/clients/web/server.d.ts +18 -0
- package/dist/clients/web/server.js +450 -0
- package/dist/clients/web/web-cmd.d.ts +2 -0
- package/dist/clients/web/web-cmd.js +120 -0
- package/dist/commands/canvas.js +1 -2
- package/dist/commands/chord.js +1 -1
- package/dist/commands/dashboard.js +5 -1
- package/dist/commands/human/prompts.js +3 -3
- package/dist/commands/human/queue.d.ts +17 -0
- package/dist/commands/human/queue.js +111 -4
- package/dist/commands/memory/__tests__/lint-schema.test.js +27 -4
- package/dist/commands/memory/lint.d.ts +5 -4
- package/dist/commands/memory/lint.js +23 -7
- package/dist/commands/memory/read.js +2 -2
- package/dist/commands/memory/shared.d.ts +7 -1
- package/dist/commands/memory/shared.js +18 -3
- package/dist/commands/memory/write.js +20 -7
- package/dist/commands/memory.js +4 -4
- package/dist/commands/node.d.ts +1 -1
- package/dist/commands/node.js +64 -65
- package/dist/commands/pkg.js +1 -2
- package/dist/commands/revive.js +11 -3
- package/dist/commands/sys/feedback.d.ts +1 -0
- package/dist/commands/sys/feedback.js +163 -0
- package/dist/commands/sys/sync.d.ts +1 -0
- package/dist/commands/sys/sync.js +187 -0
- package/dist/commands/sys.js +4 -2
- package/dist/commands/view-cycle.js +2 -2
- package/dist/commands/view-list.js +8 -8
- package/dist/commands/view-new.js +21 -17
- package/dist/commands/view-pick.js +1 -1
- package/dist/commands/view-run.js +35 -14
- package/dist/commands/view.js +8 -6
- package/dist/commands/workspace.d.ts +2 -0
- package/dist/commands/workspace.js +161 -0
- package/dist/core/__tests__/broker-double-spawn.test.d.ts +1 -0
- package/dist/core/__tests__/broker-double-spawn.test.js +143 -0
- package/dist/core/__tests__/broker-fork-seam.test.d.ts +1 -0
- package/dist/core/__tests__/broker-fork-seam.test.js +102 -0
- package/dist/core/__tests__/broker-sdk-wiring.test.js +2 -0
- package/dist/core/__tests__/broker-snapshot-history.test.d.ts +1 -0
- package/dist/core/__tests__/broker-snapshot-history.test.js +105 -0
- package/dist/core/__tests__/child-death-wake.test.js +56 -111
- package/dist/core/__tests__/close.test.js +14 -20
- package/dist/core/__tests__/context-intro.test.js +19 -19
- package/dist/core/__tests__/daemon-boot.test.js +30 -23
- package/dist/core/__tests__/draw-style.test.js +1 -1
- package/dist/core/__tests__/error-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/error-stall-recycle.test.js +141 -0
- package/dist/core/__tests__/fixtures/fake-engine.d.ts +24 -1
- package/dist/core/__tests__/fixtures/fake-engine.js +32 -2
- package/dist/core/__tests__/fixtures/fake-pi-host.js +2 -2
- package/dist/core/__tests__/focuses.test.js +25 -13
- package/dist/core/__tests__/fork.test.js +22 -5
- package/dist/core/__tests__/full/broker-control-preempt.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-control-preempt.test.js +61 -0
- package/dist/core/__tests__/full/broker-model-changed-broadcast.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-model-changed-broadcast.test.js +57 -0
- package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.d.ts +1 -0
- package/dist/core/__tests__/full/broker-navigate-tree-rewelcome.test.js +80 -0
- package/dist/core/__tests__/full/broker-pane-resolution.test.js +90 -0
- package/dist/core/__tests__/full/cascade-close.test.js +22 -8
- package/dist/core/__tests__/full/detach-focus.test.js +66 -169
- package/dist/core/__tests__/helpers/harness.d.ts +6 -9
- package/dist/core/__tests__/helpers/harness.js +19 -36
- package/dist/core/__tests__/human-node-not-supervised.test.d.ts +1 -0
- package/dist/core/__tests__/human-node-not-supervised.test.js +83 -0
- package/dist/core/__tests__/human-stranded-deliver.test.d.ts +1 -0
- package/dist/core/__tests__/human-stranded-deliver.test.js +108 -0
- package/dist/core/__tests__/lifecycle.test.js +1 -19
- package/dist/core/__tests__/live-mutation-verbs.test.js +5 -5
- package/dist/core/__tests__/memory-resolver.test.js +1 -1
- package/dist/core/__tests__/on-read-dedup-resume.test.d.ts +1 -0
- package/dist/core/__tests__/on-read-dedup-resume.test.js +81 -0
- package/dist/core/__tests__/refresh-stall-recycle.test.d.ts +1 -0
- package/dist/core/__tests__/refresh-stall-recycle.test.js +88 -0
- package/dist/core/__tests__/relaunch-root.test.d.ts +1 -0
- package/dist/core/__tests__/relaunch-root.test.js +114 -0
- package/dist/core/__tests__/reset.test.js +19 -79
- package/dist/core/__tests__/steer-note.test.js +9 -7
- package/dist/core/__tests__/tmux-surface.test.js +13 -7
- package/dist/core/bootstrap.d.ts +0 -3
- package/dist/core/bootstrap.js +1 -143
- package/dist/core/canvas/browse/__tests__/model.test.js +86 -1
- package/dist/core/canvas/browse/__tests__/render.test.js +2 -1
- package/dist/core/canvas/browse/app.js +131 -8
- package/dist/core/canvas/browse/model.d.ts +23 -5
- package/dist/core/canvas/browse/model.js +68 -13
- package/dist/core/canvas/browse/render.d.ts +7 -1
- package/dist/core/canvas/browse/render.js +178 -47
- package/dist/core/canvas/canvas.js +1 -1
- package/dist/core/canvas/focuses.d.ts +4 -4
- package/dist/core/canvas/focuses.js +7 -7
- package/dist/core/canvas/nav-model.d.ts +162 -0
- package/dist/core/canvas/nav-model.js +487 -0
- package/dist/core/canvas/paths.d.ts +7 -0
- package/dist/core/canvas/paths.js +9 -0
- package/dist/core/canvas/render.d.ts +68 -9
- package/dist/core/canvas/render.js +195 -61
- package/dist/core/canvas/types.d.ts +16 -23
- package/dist/core/config.js +1 -4
- package/dist/core/memory-resolver.js +43 -5
- package/dist/core/runtime/bearings.d.ts +1 -1
- package/dist/core/runtime/bearings.js +8 -8
- package/dist/core/runtime/branded-host.d.ts +16 -0
- package/dist/core/runtime/branded-host.js +127 -0
- package/dist/core/runtime/broker-protocol.d.ts +212 -6
- package/dist/core/runtime/broker-sdk.d.ts +0 -12
- package/dist/core/runtime/broker-sdk.js +77 -6
- package/dist/core/runtime/broker.d.ts +5 -1
- package/dist/core/runtime/broker.js +520 -59
- package/dist/core/runtime/close.d.ts +12 -2
- package/dist/core/runtime/close.js +37 -16
- package/dist/core/runtime/front-door.js +14 -7
- package/dist/core/runtime/host.d.ts +14 -34
- package/dist/core/runtime/host.js +14 -50
- package/dist/core/runtime/launch.d.ts +12 -9
- package/dist/core/runtime/launch.js +27 -15
- package/dist/core/runtime/lifecycle.d.ts +1 -1
- package/dist/core/runtime/lifecycle.js +15 -19
- package/dist/core/runtime/nodes.d.ts +0 -55
- package/dist/core/runtime/nodes.js +6 -74
- package/dist/core/runtime/placement.d.ts +91 -334
- package/dist/core/runtime/placement.js +262 -828
- package/dist/core/runtime/promote.d.ts +2 -0
- package/dist/core/runtime/promote.js +24 -6
- package/dist/core/runtime/recap.d.ts +8 -0
- package/dist/core/runtime/recap.js +107 -0
- package/dist/core/runtime/recycle.js +25 -61
- package/dist/core/runtime/reset.d.ts +43 -37
- package/dist/core/runtime/reset.js +131 -218
- package/dist/core/runtime/revive.d.ts +9 -29
- package/dist/core/runtime/revive.js +45 -135
- package/dist/core/runtime/spawn.d.ts +15 -11
- package/dist/core/runtime/spawn.js +168 -136
- package/dist/core/runtime/surface-bg.d.ts +11 -0
- package/dist/core/runtime/surface-bg.js +68 -0
- package/dist/core/runtime/tmux.d.ts +15 -43
- package/dist/core/runtime/tmux.js +38 -80
- package/dist/core/scope.d.ts +1 -2
- package/dist/core/scope.js +1 -5
- package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.d.ts +1 -0
- package/dist/core/skill-sync/__tests__/dry-run-wrote-count.test.js +57 -0
- package/dist/core/skill-sync/builtins.d.ts +42 -0
- package/dist/core/skill-sync/builtins.js +112 -0
- package/dist/core/skill-sync/claude-plugins.d.ts +23 -0
- package/dist/core/skill-sync/claude-plugins.js +71 -0
- package/dist/core/skill-sync/engine.d.ts +42 -0
- package/dist/core/skill-sync/engine.js +633 -0
- package/dist/core/skill-sync/export.d.ts +23 -0
- package/dist/core/skill-sync/export.js +86 -0
- package/dist/core/skill-sync/manifest.d.ts +64 -0
- package/dist/core/skill-sync/manifest.js +181 -0
- package/dist/core/skill-sync/profile.d.ts +76 -0
- package/dist/core/skill-sync/profile.js +173 -0
- package/dist/core/skill-sync/snapshot.d.ts +57 -0
- package/dist/core/skill-sync/snapshot.js +120 -0
- package/dist/core/spawn.d.ts +14 -0
- package/dist/core/spawn.js +29 -9
- package/dist/core/substrate/index.d.ts +2 -2
- package/dist/core/substrate/index.js +7 -7
- package/dist/core/substrate/injected-store.d.ts +10 -0
- package/dist/core/substrate/injected-store.js +55 -0
- package/dist/core/substrate/on-read.js +68 -6
- package/dist/core/substrate/render.d.ts +8 -11
- package/dist/core/substrate/render.js +29 -43
- package/dist/core/substrate/schema.d.ts +16 -11
- package/dist/core/substrate/schema.js +32 -31
- package/dist/core/tui/host.d.ts +12 -4
- package/dist/core/tui/host.js +280 -149
- package/dist/core/view/bridge.d.ts +10 -0
- package/dist/core/view/bridge.js +31 -0
- package/dist/core/view/chrome.d.ts +9 -0
- package/dist/core/view/chrome.js +22 -0
- package/dist/core/view/contract.d.ts +171 -0
- package/dist/core/view/contract.js +23 -0
- package/dist/core/view/loader.d.ts +31 -0
- package/dist/core/view/loader.js +188 -0
- package/dist/core/view/transport-local.d.ts +7 -0
- package/dist/core/view/transport-local.js +70 -0
- package/dist/core/view/transport.d.ts +4 -0
- package/dist/core/view/transport.js +15 -0
- package/dist/daemon/crtrd.d.ts +38 -27
- package/dist/daemon/crtrd.js +303 -376
- package/dist/daemon/manage.js +6 -1
- package/dist/index.js +1 -1
- package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +28 -20
- package/dist/pi-extensions/canvas-context-intro.js +4 -4
- package/dist/pi-extensions/canvas-doc-substrate.js +29 -20
- package/dist/pi-extensions/canvas-nav.js +35 -385
- package/dist/pi-extensions/canvas-recap.d.ts +37 -0
- package/dist/pi-extensions/canvas-recap.js +236 -0
- package/dist/pi-extensions/canvas-resume.js +2 -1
- package/dist/pi-extensions/canvas-stophook.d.ts +15 -13
- package/dist/pi-extensions/canvas-stophook.js +119 -103
- package/dist/pi-extensions/canvas-view.js +2 -1
- package/dist/pi-extensions/widget-order-bus.d.ts +6 -0
- package/dist/pi-extensions/widget-order-bus.js +34 -0
- package/dist/prompts/view.d.ts +2 -2
- package/dist/prompts/view.js +145 -73
- package/dist/types.d.ts +1 -6
- package/dist/types.js +1 -3
- package/dist/web/ViewChrome.d.ts +7 -0
- package/dist/web/ViewChrome.js +28 -0
- package/dist/web/ViewPane.d.ts +39 -0
- package/dist/web/ViewPane.js +48 -0
- package/dist/web/index.d.ts +6 -0
- package/dist/web/index.js +16 -0
- package/dist/web/runtime.d.ts +39 -0
- package/dist/web/runtime.js +133 -0
- package/dist/web/states.d.ts +24 -0
- package/dist/web/states.js +24 -0
- package/dist/web/transport-http.d.ts +5 -0
- package/dist/web/transport-http.js +28 -0
- package/dist/web-client/assets/index-BUvQb4hR.css +2 -0
- package/dist/web-client/assets/index-ClLQXYAE.js +10 -0
- package/dist/web-client/index.html +13 -0
- package/package.json +20 -6
- package/dist/builtin-views/canvas/client.mjs +0 -303
- package/dist/builtin-views/canvas/view.mjs +0 -576
- package/dist/builtin-views/git-pr/client.mjs +0 -440
- package/dist/builtin-views/git-pr/view.mjs +0 -675
- package/dist/builtin-views/inbox/sources/gmail.mjs +0 -965
- package/dist/builtin-views/inbox/sources/linkedin.mjs +0 -427
- package/dist/builtin-views/inbox/view.mjs +0 -889
- package/dist/builtin-views/linkedin/client.mjs +0 -610
- package/dist/builtin-views/linkedin/view.mjs +0 -1171
- package/dist/commands/pkg/bridge.d.ts +0 -1
- package/dist/commands/pkg/bridge.js +0 -137
- package/dist/commands/skill/author.d.ts +0 -3
- package/dist/commands/skill/author.js +0 -140
- package/dist/commands/skill/shared.d.ts +0 -3
- package/dist/commands/skill/shared.js +0 -19
- package/dist/commands/skill.d.ts +0 -2
- package/dist/commands/skill.js +0 -21
- package/dist/commands/tmux-spread.d.ts +0 -2
- package/dist/commands/tmux-spread.js +0 -144
- package/dist/core/__tests__/full/daemon-liveness-pane.full.test.js +0 -292
- package/dist/core/__tests__/full/placement-focus.test.js +0 -309
- package/dist/core/__tests__/full/placement-reconcile.test.js +0 -212
- package/dist/core/__tests__/full/placement-revive.test.js +0 -238
- package/dist/core/__tests__/full/placement-teardown.test.js +0 -221
- package/dist/core/__tests__/home-session.test.js +0 -186
- package/dist/core/__tests__/relaunch.test.js +0 -335
- package/dist/core/bridge-map.d.ts +0 -19
- package/dist/core/bridge-map.js +0 -73
- package/dist/core/tui/contract.d.ts +0 -83
- package/dist/core/tui/contract.js +0 -8
- package/dist/core/tui/loader.d.ts +0 -16
- package/dist/core/tui/loader.js +0 -94
- package/dist/prompts/skill.d.ts +0 -2
- package/dist/prompts/skill.js +0 -650
- /package/dist/{core/__tests__/full/daemon-liveness-pane.full.test.d.ts → clients/attach/__tests__/action-parity.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-focus.test.d.ts → clients/attach/__tests__/clipboard-image.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-reconcile.test.d.ts → clients/attach/__tests__/editor-newline.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-revive.test.d.ts → clients/attach/__tests__/git-info.test.d.ts} +0 -0
- /package/dist/{core/__tests__/full/placement-teardown.test.d.ts → clients/attach/__tests__/onrequest-wired.test.d.ts} +0 -0
- /package/dist/{core/__tests__/home-session.test.d.ts → clients/attach/__tests__/reconnect-giveup.test.d.ts} +0 -0
- /package/dist/{core/__tests__/relaunch.test.d.ts → clients/attach/__tests__/slash-quit-copy.test.d.ts} +0 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
/**
|
|
3
|
+
* LinkedIn Messages — the WEB presenter for the `linkedin` view (React +
|
|
4
|
+
* Tailwind). Browser-only: consumed solely by the web serve path (Vite owns JSX
|
|
5
|
+
* + Tailwind); NEVER Node-imported. The default export is a pure function of
|
|
6
|
+
* `state`; DOM events call `dispatch(intentName, payload?)`.
|
|
7
|
+
*
|
|
8
|
+
* Same logical model as the TUI presenter (the two-pane inbox: conversation list
|
|
9
|
+
* 1 : thread 2, compose/react modes, the discover→auth→settle recovery panel)
|
|
10
|
+
* read from the SAME portable `core.mjs` — zero shared rendering code with
|
|
11
|
+
* `tui.mjs`. The recovery / degraded panels render the typed `SourceError.
|
|
12
|
+
* display` VERBATIM (the contract display/kind split): the presenter maps only
|
|
13
|
+
* `display.level` → a four-state component, never branching on `kind`. Outer
|
|
14
|
+
* chrome (title / status / banner / chip) is rendered by `<ViewChrome>`.
|
|
15
|
+
*
|
|
16
|
+
* @module linkedin/web
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { relTimestamp, EMOJIS } from './core.mjs';
|
|
20
|
+
import { Loading, Empty, ErrorState, NotReady } from '@crouton-kit/crouter/web';
|
|
21
|
+
|
|
22
|
+
/** @typedef {import('./core.mjs').LiState} LiState */
|
|
23
|
+
|
|
24
|
+
// ── Recovery takeover (renders display.* VERBATIM; level → component) ──────────
|
|
25
|
+
|
|
26
|
+
/** @param {{ rec: import('./core.mjs').Recovery, dispatch: (i:string, p?:unknown)=>void }} props */
|
|
27
|
+
function Recovery({ rec, dispatch }) {
|
|
28
|
+
const d = rec.display;
|
|
29
|
+
if (rec.spinner) return <Loading label={d.headline} />;
|
|
30
|
+
const Comp = d.level === 'error' ? ErrorState : NotReady;
|
|
31
|
+
return (
|
|
32
|
+
<Comp
|
|
33
|
+
headline={d.headline}
|
|
34
|
+
explanation={d.explanation}
|
|
35
|
+
nextStep={d.nextStep || undefined}
|
|
36
|
+
onRetry={() => dispatch('refresh')}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ── Conversation list (left pane) ──────────────────────────────────────────────
|
|
42
|
+
|
|
43
|
+
/** @param {{ state: LiState, dispatch: (i:string, p?:unknown)=>void }} props */
|
|
44
|
+
function ConvoList({ state, dispatch }) {
|
|
45
|
+
return (
|
|
46
|
+
<ul className="divide-y divide-slate-100 overflow-y-auto">
|
|
47
|
+
{state.convos.map((c, i) => {
|
|
48
|
+
const selected = i === state.convCursor;
|
|
49
|
+
const open = c.urn === state.openUrn;
|
|
50
|
+
const ts = relTimestamp(c.ts);
|
|
51
|
+
return (
|
|
52
|
+
<li
|
|
53
|
+
key={c.urn || i}
|
|
54
|
+
onClick={() => dispatch('openThread', i)}
|
|
55
|
+
className={`flex cursor-pointer items-baseline gap-2 px-3 py-2 ${selected ? 'bg-slate-100' : ''} ${open ? 'border-l-2 border-cyan-500' : 'border-l-2 border-transparent'}`}
|
|
56
|
+
>
|
|
57
|
+
<span className={`shrink-0 ${c.unread ? 'text-cyan-600' : 'text-transparent'}`}>●</span>
|
|
58
|
+
<span className="min-w-0 flex-1">
|
|
59
|
+
<span className={c.unread ? 'font-semibold' : ''}>{c.name || 'Unknown'}</span>
|
|
60
|
+
{c.lastMessage ? (
|
|
61
|
+
<span className="ml-2 truncate text-slate-400">{c.lastMessage.replace(/\s+/g, ' ').trim()}</span>
|
|
62
|
+
) : null}
|
|
63
|
+
</span>
|
|
64
|
+
{ts ? <span className="shrink-0 text-xs text-slate-400">{ts}</span> : null}
|
|
65
|
+
</li>
|
|
66
|
+
);
|
|
67
|
+
})}
|
|
68
|
+
</ul>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ── Thread (right pane) ────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
/** @param {{ m: import('./core.mjs').Message }} props */
|
|
75
|
+
function MessageGroup({ m }) {
|
|
76
|
+
const ts = relTimestamp(m.ts);
|
|
77
|
+
if (m.fromMe) {
|
|
78
|
+
return (
|
|
79
|
+
<div className="border-l-2 border-green-500 pl-2">
|
|
80
|
+
<div className="flex items-baseline justify-between">
|
|
81
|
+
<span className="font-semibold text-green-600">You</span>
|
|
82
|
+
{ts ? <span className="text-xs text-slate-400">{ts}</span> : null}
|
|
83
|
+
</div>
|
|
84
|
+
<div className="whitespace-pre-wrap text-slate-700">{m.text}</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return (
|
|
89
|
+
<div>
|
|
90
|
+
<div className="flex items-baseline justify-between">
|
|
91
|
+
<span className="font-semibold text-cyan-700">{m.sender || 'Them'}</span>
|
|
92
|
+
{ts ? <span className="text-xs text-slate-400">{ts}</span> : null}
|
|
93
|
+
</div>
|
|
94
|
+
<div className="whitespace-pre-wrap text-slate-700">{m.text}</div>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @param {{ state: LiState, dispatch: (i:string, p?:unknown)=>void }} props */
|
|
100
|
+
function Thread({ state, dispatch }) {
|
|
101
|
+
const openConvo = state.openUrn ? state.convos.find((c) => c.urn === state.openUrn) : null;
|
|
102
|
+
if (!state.openUrn) {
|
|
103
|
+
return (
|
|
104
|
+
<div className="flex h-full flex-col items-center justify-center gap-1 p-8 text-center text-slate-400">
|
|
105
|
+
<div>✉ No conversation open</div>
|
|
106
|
+
<div className="text-sm">Select a conversation to open it.</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return (
|
|
111
|
+
<div className="flex h-full flex-col">
|
|
112
|
+
<div className="flex items-baseline justify-between border-b border-slate-200 px-3 py-2">
|
|
113
|
+
<span className="font-semibold">{openConvo ? openConvo.name : 'Conversation'}</span>
|
|
114
|
+
{openConvo && relTimestamp(openConvo.ts) ? (
|
|
115
|
+
<span className="text-xs text-slate-400">{relTimestamp(openConvo.ts)}</span>
|
|
116
|
+
) : null}
|
|
117
|
+
</div>
|
|
118
|
+
<div className="flex-1 space-y-3 overflow-y-auto px-3 py-3">
|
|
119
|
+
{state.thread.length === 0 ? (
|
|
120
|
+
<div className="text-slate-400">Loading messages…</div>
|
|
121
|
+
) : (
|
|
122
|
+
state.thread.map((m, i) => <MessageGroup key={m.urn || i} m={m} />)
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
125
|
+
{state.mode === 'reply' ? <Composer state={state} dispatch={dispatch} /> : null}
|
|
126
|
+
{state.mode === 'react' ? <ReactBar state={state} dispatch={dispatch} /> : null}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** @param {{ state: LiState, dispatch: (i:string, p?:unknown)=>void }} props */
|
|
132
|
+
function Composer({ state, dispatch }) {
|
|
133
|
+
return (
|
|
134
|
+
<div className="border-t border-slate-200 p-2">
|
|
135
|
+
<textarea
|
|
136
|
+
autoFocus
|
|
137
|
+
rows={2}
|
|
138
|
+
value={state.draft}
|
|
139
|
+
placeholder="Reply… (Enter to send · Esc to cancel)"
|
|
140
|
+
onChange={(e) => dispatch('setDraft', e.target.value)}
|
|
141
|
+
onKeyDown={(e) => {
|
|
142
|
+
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); dispatch('submitReply'); }
|
|
143
|
+
else if (e.key === 'Escape') { e.preventDefault(); dispatch('cancelCompose'); }
|
|
144
|
+
}}
|
|
145
|
+
className="w-full resize-none rounded border border-slate-300 p-2 font-mono text-sm outline-none focus:border-amber-500"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** @param {{ state: LiState, dispatch: (i:string, p?:unknown)=>void }} props */
|
|
152
|
+
function ReactBar({ state, dispatch }) {
|
|
153
|
+
return (
|
|
154
|
+
<div className="flex items-center gap-2 border-t border-slate-200 p-2">
|
|
155
|
+
<span className="text-amber-600">☺ React</span>
|
|
156
|
+
{EMOJIS.map((e, i) => (
|
|
157
|
+
<button
|
|
158
|
+
key={e}
|
|
159
|
+
type="button"
|
|
160
|
+
onClick={() => { dispatch('reactPick', i); dispatch('submitReact'); }}
|
|
161
|
+
className={`rounded px-2 py-1 text-lg ${i === state.reactCursor ? 'bg-slate-200' : ''} hover:bg-slate-100`}
|
|
162
|
+
>
|
|
163
|
+
{e}
|
|
164
|
+
</button>
|
|
165
|
+
))}
|
|
166
|
+
<button type="button" onClick={() => dispatch('cancelCompose')} className="ml-auto text-sm text-slate-500 hover:text-slate-700">
|
|
167
|
+
Esc cancel
|
|
168
|
+
</button>
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ── The view ───────────────────────────────────────────────────────────────────
|
|
174
|
+
|
|
175
|
+
/** @param {import('../../core/view/contract.js').ViewProps<LiState>} props */
|
|
176
|
+
export default function LinkedIn({ state, dispatch }) {
|
|
177
|
+
if (state.recovery) return <Recovery rec={state.recovery} dispatch={dispatch} />;
|
|
178
|
+
|
|
179
|
+
if (state.convos.length === 0) {
|
|
180
|
+
if (state.lastFetch === 0) return <Loading label="Loading conversations…" />;
|
|
181
|
+
return <Empty label="All caught up — no conversations in your inbox." />;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<div
|
|
186
|
+
className="grid h-full grid-cols-3 font-mono text-sm outline-none"
|
|
187
|
+
tabIndex={0}
|
|
188
|
+
onKeyDown={(e) => {
|
|
189
|
+
if (state.mode !== 'list') return;
|
|
190
|
+
if (e.key === 'j' || e.key === 'ArrowDown') { e.preventDefault(); dispatch('cursorDown'); }
|
|
191
|
+
else if (e.key === 'k' || e.key === 'ArrowUp') { e.preventDefault(); dispatch('cursorUp'); }
|
|
192
|
+
else if (e.key === 'Enter') { e.preventDefault(); dispatch('openThread', state.convCursor); }
|
|
193
|
+
else if (e.key === 'r') { e.preventDefault(); dispatch('startReply'); }
|
|
194
|
+
else if (e.key === 'e') { e.preventDefault(); dispatch('startReact'); }
|
|
195
|
+
else if (e.key === 'g') { dispatch('refresh'); }
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
<div className="col-span-1 border-r border-slate-200">
|
|
199
|
+
<ConvoList state={state} dispatch={dispatch} />
|
|
200
|
+
</div>
|
|
201
|
+
<div className="col-span-2">
|
|
202
|
+
<Thread state={state} dispatch={dispatch} />
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|