@40rty/ams-cli 0.2.1 → 0.3.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.
@@ -1,26 +1,20 @@
1
- import {
2
- SpacefrontCanvas,
3
- renderInline,
4
- useCart,
5
- useComposerChipSelect,
6
- useComposerDraft,
7
- useFourtySession,
8
- useGoHome,
9
- useThreadRows,
10
- } from '@40rty/ams-sdk';
1
+ import {SpacefrontCanvas, useCart, useGoHome} from '@40rty/ams-sdk';
2
+ import {SpacefrontIsland} from '@40rty/ams-ui/island';
3
+ import '@40rty/ams-ui/island.css';
11
4
 
12
- /** The page: a header, the canvas the agent composes onto, and the conversation. */
5
+ /**
6
+ * The page: a header, the canvas the agent composes onto, and the AMS island —
7
+ * the floating composer every 40rty spacefront is recognised by. The island is
8
+ * `@40rty/ams-ui`'s: its shape is fixed (grip, latest answer, field, round send
9
+ * stamp, suggestion chips, a pill when folded); its look is the brand tokens,
10
+ * mapped onto its `--fourty-island-*` properties in `styles.css`.
11
+ */
13
12
  export function Shell() {
14
- const session = useFourtySession();
15
- const [draft, setDraft] = useComposerDraft();
16
- const {rows, isEmpty} = useThreadRows();
17
- const selectChip = useComposerChipSelect();
18
13
  const goHome = useGoHome();
19
14
  const {cart} = useCart();
20
- const chips = session.suggestions ? session.suggestions.actions : [];
21
15
 
22
16
  return (
23
- <div className="flex min-h-screen flex-col bg-paper text-ink antialiased">
17
+ <div className="min-h-screen bg-paper text-ink antialiased">
24
18
  <header className="sticky top-0 z-40 flex h-16 items-center justify-between border-b border-ink/10 bg-paper/90 px-6 backdrop-blur md:px-10">
25
19
  <button type="button" className="font-semibold" onClick={goHome}>
26
20
  __LABEL__
@@ -30,52 +24,11 @@ export function Shell() {
30
24
  </a>
31
25
  </header>
32
26
 
33
- <div className="grid flex-grow lg:grid-cols-[1fr_24rem]">
34
- <main className="min-w-0">
35
- <SpacefrontCanvas />
36
- </main>
27
+ <main className="min-w-0 pb-56">
28
+ <SpacefrontCanvas />
29
+ </main>
37
30
 
38
- <aside className="flex flex-col gap-6 border-l border-ink/10 p-6 lg:sticky lg:top-16 lg:h-[calc(100vh-4rem)]">
39
- <div className="grid grow content-start gap-4 overflow-y-auto">
40
- {isEmpty && <p className="text-ink/60">Tell us what you’re looking for.</p>}
41
- {rows.map((row) => (
42
- <div key={row.key} className="grid gap-1">
43
- <p className="text-sm text-ink/60">{row.visitorText}</p>
44
- <p>{renderInline(row.prose, row.key)}</p>
45
- </div>
46
- ))}
47
- {session.error && <p className="text-accent">{session.error}</p>}
48
- </div>
49
-
50
- <div className="flex flex-wrap gap-2">
51
- {chips.map((chip) => (
52
- <button key={chip.id} type="button" className="rounded-full border border-ink/20 px-3 py-1 text-sm" onClick={() => selectChip(chip)}>
53
- {chip.label}
54
- </button>
55
- ))}
56
- </div>
57
-
58
- <form
59
- className="flex gap-3"
60
- onSubmit={(event) => {
61
- event.preventDefault();
62
- if (draft.trim() === '') return;
63
- session.sendMessage(draft);
64
- setDraft('');
65
- }}
66
- >
67
- <input
68
- className="w-full border-b border-ink/20 bg-transparent py-2 outline-none focus:border-ink"
69
- placeholder="Ask anything…"
70
- value={draft}
71
- onChange={(event) => setDraft(event.target.value)}
72
- />
73
- <button type="submit" className="rounded bg-ink px-4 text-paper disabled:opacity-50" disabled={session.isRunning}>
74
- Ask
75
- </button>
76
- </form>
77
- </aside>
78
- </div>
31
+ <SpacefrontIsland />
79
32
  </div>
80
33
  );
81
34
  }
@@ -7,4 +7,11 @@
7
7
  --color-ink: 20 20 20;
8
8
  --color-paper: 250 250 249;
9
9
  --color-accent: 191 72 0;
10
+
11
+ /* The AMS island (`@40rty/ams-ui/island`), in the same tokens. */
12
+ --fourty-island-surface: rgb(var(--color-paper));
13
+ --fourty-island-fg: rgb(var(--color-ink));
14
+ --fourty-island-accent: rgb(var(--color-accent));
15
+ --fourty-island-accent-fg: rgb(var(--color-paper));
16
+ --fourty-island-error: rgb(var(--color-accent));
10
17
  }