@volter/teams 0.1.18 → 0.1.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/teams",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "type": "module",
5
5
  "description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
6
6
  "license": "MIT",
package/server/viewer.mjs CHANGED
@@ -10,6 +10,9 @@ const FILES = {
10
10
  // The same module under its own name, as a workplace console imports it (openBrowserSession, sendBrowserTurn).
11
11
  '/view/browser-channel.mjs': ['browser-channel.mjs', 'text/javascript; charset=utf-8'],
12
12
  '/view/stream-rpc.mjs': ['stream-rpc.mjs', 'text/javascript; charset=utf-8'],
13
+ // A team session's surface: supercode-ui's transcript and composer, built by scripts/build-session-view.mjs.
14
+ '/view/session-view.mjs': ['viewer/session-view.mjs', 'text/javascript; charset=utf-8'],
15
+ '/view/session-view.css': ['viewer/session-view.css', 'text/css; charset=utf-8'],
13
16
  };
14
17
  let bundled = null;
15
18
 
package/viewer/index.html CHANGED
@@ -33,6 +33,12 @@
33
33
  button.action, label.action { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
34
34
  button.action:disabled { opacity: .5; cursor: default; }
35
35
  label.action input { display: none; }
36
+ /* supercode-ui follows this page's dark scheme; its composer spans the page instead of its 420px default. */
37
+ #session { flex: 1; min-width: 0; min-height: 0; display: flex; --scui-color-scheme: dark; }
38
+ #session .session-view { flex: 1; min-width: 0; display: flex; flex-direction: column; }
39
+ #session .session-view > section { flex: 1; min-height: 0; overflow: auto; }
40
+ #session .session-composer { border-top: 1px solid var(--line); padding: 8px; --scui-width: 100%; --scui-height: auto; }
41
+ #session .session-composer > * { flex: 1; min-width: 0; }
36
42
  [hidden] { display: none !important; }
37
43
  </style>
38
44
  </head>
@@ -41,6 +47,7 @@
41
47
  <div id="status"></div>
42
48
  <main>
43
49
  <div id="terminal" hidden></div>
50
+ <div id="session" hidden></div>
44
51
  <div id="folder">
45
52
  <nav id="entries"><div class="crumbs" id="crumbs"></div><div id="list"></div></nav>
46
53
  <section id="file">
@@ -0,0 +1,78 @@
1
+ // The hosted viewer's session surface, bundled with its dependencies into viewer/session-view.mjs
2
+ // (scripts/build-session-view.mjs): supercode-ui's team transcript and composer, mounted for one team session. The
3
+ // page (viewer.mjs) owns the token, the reads and the channel; this module only renders what it is given and hands
4
+ // back what the member typed.
5
+ import { h, render } from 'preact';
6
+ import { TeamTranscript } from '@volter/supercode-ui/preact/teams';
7
+ import { Composer } from '@volter/supercode-ui/preact/composer';
8
+ import { EMPTY_UI_STATE, normalizeUiState } from '@volter/supercode-ui';
9
+ import { projectSubagentTranscript } from '@volter/supercode-ui/controller';
10
+
11
+ // A person's picture: the brand's person placeholder. An empty seed is its one standard anonymous face.
12
+ const personImage = (seed = '') => `https://brand.volter.ai/runner/svg?seed=${encodeURIComponent(seed)}&size=36&radius=18`;
13
+
14
+ /**
15
+ * Who wrote each user turn, from the message's own annotations (source_name / source_principal_id, recorded when a
16
+ * Room member typed it): their name and face, or, for anyone unnamed, the standard anonymous face. Never an agent mark.
17
+ */
18
+ function withPeople(transcript, messages) {
19
+ const byTime = new Map();
20
+ for (const message of messages) {
21
+ if (message?.role !== 'user') continue;
22
+ const at = Date.parse(message.metadata?.timestamp ?? '');
23
+ if (Number.isFinite(at)) byTime.set(at, message.metadata);
24
+ }
25
+ return transcript.map((entry) => {
26
+ if (entry.role !== 'user') return entry;
27
+ const metadata = byTime.get(entry.ts) ?? {};
28
+ const name = metadata.source_name || null;
29
+ return { ...entry, actor: { name: name ?? 'Someone in the session', image: personImage(name ? (metadata.source_principal_id || name) : '') } };
30
+ });
31
+ }
32
+
33
+ const SOURCES = { 'claude-code': 'claude_code', codex: 'codex', gemini: 'gemini', goose: 'goose', grok: 'grok', opencode: 'opencode', pi: 'pi' };
34
+
35
+ /** A team session's captured messages as the harness SDK's normalized session, for supercode-ui's projection. */
36
+ function normalizedSession(descriptor, messages) {
37
+ return {
38
+ source: SOURCES[descriptor.harness] ?? 'native',
39
+ session_id: descriptor.id,
40
+ model: null,
41
+ cwd: null,
42
+ system_prompt: null,
43
+ agent_id: null,
44
+ parent_tool_use_id: null,
45
+ lineage: {},
46
+ trigger: 'human',
47
+ surface: null,
48
+ messages,
49
+ };
50
+ }
51
+
52
+ /**
53
+ * Mount one session into `element`. `update({ descriptor, messages, live, status, error, canSend, sending })` renders
54
+ * the session (messages are the captured normalized values, oldest first); `onSend(text)` is called with a turn the
55
+ * member typed, and resolves once it was delivered or refused.
56
+ */
57
+ export function mountSessionView(element, { onSend }) {
58
+ let current = { descriptor: null, messages: [], live: false, status: 'loading', error: null, canSend: false, sending: false };
59
+ const adapter = {
60
+ onIntent: async (intent) => { if (intent?.action === 'send' && intent.text?.trim()) await onSend(intent.text.trim()); },
61
+ copyText: (text) => globalThis.navigator?.clipboard?.writeText(text),
62
+ };
63
+ const draw = () => {
64
+ const { descriptor, messages, live, status, error, canSend, sending } = current;
65
+ const transcript = descriptor ? withPeople(projectSubagentTranscript(normalizedSession(descriptor, messages), { prefix: descriptor.id, maxEntries: 500 }), messages) : [];
66
+ const composerState = normalizeUiState({ ...EMPTY_UI_STATE, startup: 'ready', harness: descriptor?.harness ?? '', canSend: canSend && !sending, busy: sending, transcript });
67
+ render(h('div', { class: 'session-view' },
68
+ // The header says what this viewer may do: type into the session (a control token) or only read it.
69
+ h(TeamTranscript, { session: descriptor, transcript, live, status, error, adapter, labels: { readOnly: canSend ? 'Control' : 'Read-only' } }),
70
+ canSend ? h('div', { class: 'session-composer scui-root' }, h(Composer, { state: composerState, adapter })) : null,
71
+ ), element);
72
+ };
73
+ draw();
74
+ return {
75
+ update(next) { current = { ...current, ...next }; draw(); },
76
+ unmount() { render(null, element); },
77
+ };
78
+ }