@volter/teams 0.1.23 → 0.1.24

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.23",
3
+ "version": "0.1.24",
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",
@@ -83,17 +83,26 @@ function normalizedSession(descriptor, messages) {
83
83
  export function mountSessionView(element, { onSend, control = false, agentName = null }) {
84
84
  // One badge, following the token's scope: fixed when mounted (the team view reads its labels once).
85
85
  const labels = { readOnly: control ? 'Control' : 'Read-only' };
86
- let current = { descriptor: null, messages: [], members: [], machines: [], live: false, status: 'loading', error: null, canSend: control, sending: false };
86
+ let current = { descriptor: null, messages: [], members: [], machines: [], live: false, status: 'loading', error: null, canSend: control, sending: false, pending: null };
87
87
  const adapter = {
88
- onIntent: async (intent) => { if (intent?.action === 'send' && intent.text?.trim()) await onSend(intent.text.trim()); },
88
+ // A sent line shows at once as the user's pending turn: a session mid-turn records it only when it takes it in.
89
+ onIntent: async (intent) => {
90
+ const text = intent?.action === 'send' ? intent.text?.trim() : '';
91
+ if (!text) return;
92
+ current = { ...current, pending: { text, status: 'sending' } }; draw();
93
+ const delivered = await onSend(text);
94
+ if (!delivered) { current = { ...current, pending: { text, status: 'failed' } }; draw(); }
95
+ },
89
96
  copyText: (text) => globalThis.navigator?.clipboard?.writeText(text),
90
97
  };
91
98
  const draw = () => {
92
99
  const { descriptor, messages, members, machines, live, status, error, canSend, sending } = current;
100
+ // The pending line goes once the session has recorded it (a user message holding that text).
101
+ if (current.pending && messages.some((message) => message?.role === 'user' && typeof message.content === 'string' && message.content.includes(current.pending.text))) current = { ...current, pending: null };
93
102
  const transcript = descriptor ? withPeople(projectSubagentTranscript(normalizedSession(descriptor, messages), { prefix: descriptor.id, maxEntries: 500 }), messages, { agentName, sessionId: descriptor.id }) : [];
94
103
  const composerState = normalizeUiState({ ...EMPTY_UI_STATE, startup: 'ready', harness: descriptor?.harness ?? '', canSend: canSend && !sending, busy: sending, transcript });
95
104
  render(h('div', { class: 'session-view' },
96
- h(TeamTranscript, { session: descriptor, transcript, members, machines, live, status, error, adapter, labels }),
105
+ h(TeamTranscript, { session: descriptor, transcript, members, machines, live, status, error, adapter, labels, pending: current.pending }),
97
106
  canSend ? h('div', { class: 'session-composer scui-root' }, h(Composer, { state: composerState, adapter })) : null,
98
107
  ), element);
99
108
  };