@agentshouse/mdruntime 0.1.0-ce531b51ff088 → 0.1.0-cec6690d5712e

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 (168) hide show
  1. package/AGENTS.md +121 -29
  2. package/README.md +21 -11
  3. package/dist/adapter.d.ts +65 -28
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/adapter.js +1 -9
  6. package/dist/attached-model.d.ts +11 -0
  7. package/dist/attached-model.d.ts.map +1 -0
  8. package/dist/attached-model.js +47 -0
  9. package/dist/attempt.d.ts +16 -0
  10. package/dist/attempt.d.ts.map +1 -0
  11. package/dist/attempt.js +57 -0
  12. package/dist/bootstrap.d.ts +20 -6
  13. package/dist/bootstrap.d.ts.map +1 -1
  14. package/dist/bootstrap.js +89 -35
  15. package/dist/change-set.d.ts.map +1 -1
  16. package/dist/change-set.js +13 -7
  17. package/dist/change.d.ts +4 -0
  18. package/dist/change.d.ts.map +1 -1
  19. package/dist/chat/acts.d.ts +34 -0
  20. package/dist/chat/acts.d.ts.map +1 -0
  21. package/dist/chat/acts.js +36 -0
  22. package/dist/chat/context.d.ts +3 -0
  23. package/dist/chat/context.d.ts.map +1 -0
  24. package/dist/chat/context.js +10 -0
  25. package/dist/chat/input.d.ts +9 -0
  26. package/dist/chat/input.d.ts.map +1 -0
  27. package/dist/chat/input.js +99 -0
  28. package/dist/chat/kit.d.ts +60 -0
  29. package/dist/chat/kit.d.ts.map +1 -0
  30. package/dist/chat/kit.js +123 -0
  31. package/dist/chat/lasting.d.ts +6 -0
  32. package/dist/chat/lasting.d.ts.map +1 -0
  33. package/dist/chat/lasting.js +19 -0
  34. package/dist/chat/list.d.ts +20 -0
  35. package/dist/chat/list.d.ts.map +1 -0
  36. package/dist/chat/list.js +59 -0
  37. package/dist/chat/markdown.d.ts +19 -0
  38. package/dist/chat/markdown.d.ts.map +1 -0
  39. package/dist/chat/markdown.js +187 -0
  40. package/dist/chat/message.d.ts +6 -0
  41. package/dist/chat/message.d.ts.map +1 -0
  42. package/dist/chat/message.js +192 -0
  43. package/dist/chat/messages.d.ts +21 -0
  44. package/dist/chat/messages.d.ts.map +1 -0
  45. package/dist/chat/messages.js +151 -0
  46. package/dist/chat/name.d.ts +6 -0
  47. package/dist/chat/name.d.ts.map +1 -0
  48. package/dist/chat/name.js +37 -0
  49. package/dist/chat/opened.d.ts +11 -0
  50. package/dist/chat/opened.d.ts.map +1 -0
  51. package/dist/chat/opened.js +17 -0
  52. package/dist/chat/overlay.d.ts +31 -0
  53. package/dist/chat/overlay.d.ts.map +1 -0
  54. package/dist/chat/overlay.js +97 -0
  55. package/dist/chat/parts.d.ts +57 -0
  56. package/dist/chat/parts.d.ts.map +1 -0
  57. package/dist/chat/parts.js +119 -0
  58. package/dist/chat/process.d.ts +20 -0
  59. package/dist/chat/process.d.ts.map +1 -0
  60. package/dist/chat/process.js +32 -0
  61. package/dist/chat/provider.d.ts +63 -0
  62. package/dist/chat/provider.d.ts.map +1 -0
  63. package/dist/chat/provider.js +645 -0
  64. package/dist/chat/question.d.ts +9 -0
  65. package/dist/chat/question.d.ts.map +1 -0
  66. package/dist/chat/question.js +80 -0
  67. package/dist/chat/questions.d.ts +31 -0
  68. package/dist/chat/questions.d.ts.map +1 -0
  69. package/dist/chat/questions.js +111 -0
  70. package/dist/chat/read.d.ts +5 -0
  71. package/dist/chat/read.d.ts.map +1 -0
  72. package/dist/chat/read.js +13 -0
  73. package/dist/chat/ready.d.ts +33 -0
  74. package/dist/chat/ready.d.ts.map +1 -0
  75. package/dist/chat/ready.js +91 -0
  76. package/dist/chat/style.d.ts +4 -0
  77. package/dist/chat/style.d.ts.map +1 -0
  78. package/dist/chat/style.js +302 -0
  79. package/dist/chat.d.ts +14 -0
  80. package/dist/chat.d.ts.map +1 -0
  81. package/dist/chat.js +8 -0
  82. package/dist/client.d.ts +12 -7
  83. package/dist/client.d.ts.map +1 -1
  84. package/dist/client.js +64 -25
  85. package/dist/collection.d.ts +6 -11
  86. package/dist/collection.d.ts.map +1 -1
  87. package/dist/collection.js +56 -19
  88. package/dist/connection.d.ts +21 -16
  89. package/dist/connection.d.ts.map +1 -1
  90. package/dist/connection.js +713 -587
  91. package/dist/conversation.d.ts +28 -8
  92. package/dist/conversation.d.ts.map +1 -1
  93. package/dist/conversation.js +222 -81
  94. package/dist/expectation.d.ts +21 -0
  95. package/dist/expectation.d.ts.map +1 -0
  96. package/dist/expectation.js +70 -0
  97. package/dist/failure.d.ts +13 -0
  98. package/dist/failure.d.ts.map +1 -0
  99. package/dist/failure.js +19 -0
  100. package/dist/host.d.ts +8 -1
  101. package/dist/host.d.ts.map +1 -1
  102. package/dist/host.js +39 -39
  103. package/dist/identity.d.ts +2 -0
  104. package/dist/identity.d.ts.map +1 -1
  105. package/dist/identity.js +10 -1
  106. package/dist/index.d.ts +7 -4
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +2 -0
  109. package/dist/memory.d.ts +12 -5
  110. package/dist/memory.d.ts.map +1 -1
  111. package/dist/memory.js +108 -36
  112. package/dist/model.d.ts +13 -12
  113. package/dist/model.d.ts.map +1 -1
  114. package/dist/model.js +6 -3
  115. package/dist/observation.d.ts +2 -0
  116. package/dist/observation.d.ts.map +1 -1
  117. package/dist/observation.js +24 -14
  118. package/dist/open.d.ts +2 -0
  119. package/dist/open.d.ts.map +1 -0
  120. package/dist/open.js +1 -0
  121. package/dist/outcome.d.ts +22 -3
  122. package/dist/outcome.d.ts.map +1 -1
  123. package/dist/outcome.js +35 -1
  124. package/dist/overlay.d.ts +1 -1
  125. package/dist/overlay.d.ts.map +1 -1
  126. package/dist/overlay.js +19 -15
  127. package/dist/paths.d.ts +0 -1
  128. package/dist/paths.d.ts.map +1 -1
  129. package/dist/paths.js +0 -16
  130. package/dist/query.d.ts +10 -3
  131. package/dist/query.d.ts.map +1 -1
  132. package/dist/query.js +78 -36
  133. package/dist/reach.d.ts +40 -0
  134. package/dist/reach.d.ts.map +1 -0
  135. package/dist/reach.js +272 -0
  136. package/dist/react.d.ts +41 -0
  137. package/dist/react.d.ts.map +1 -0
  138. package/dist/react.js +64 -0
  139. package/dist/read-side.d.ts +4 -0
  140. package/dist/read-side.d.ts.map +1 -1
  141. package/dist/read-side.js +116 -54
  142. package/dist/refresh.d.ts +12 -1
  143. package/dist/refresh.d.ts.map +1 -1
  144. package/dist/refresh.js +35 -22
  145. package/dist/replica.d.ts +6 -6
  146. package/dist/replica.d.ts.map +1 -1
  147. package/dist/replica.js +53 -39
  148. package/dist/room-draft.d.ts +11 -8
  149. package/dist/room-draft.d.ts.map +1 -1
  150. package/dist/room-draft.js +19 -26
  151. package/dist/rows.d.ts +4 -1
  152. package/dist/rows.d.ts.map +1 -1
  153. package/dist/rows.js +82 -39
  154. package/dist/save.d.ts +4 -3
  155. package/dist/save.d.ts.map +1 -1
  156. package/dist/save.js +127 -68
  157. package/dist/search.d.ts +3 -2
  158. package/dist/search.d.ts.map +1 -1
  159. package/dist/status.d.ts +2 -2
  160. package/dist/status.d.ts.map +1 -1
  161. package/dist/status.js +0 -8
  162. package/dist/store.d.ts +26 -2
  163. package/dist/store.d.ts.map +1 -1
  164. package/dist/store.js +206 -90
  165. package/dist/wire.d.ts +56 -19
  166. package/dist/wire.d.ts.map +1 -1
  167. package/dist/wire.js +63 -61
  168. package/package.json +23 -3
@@ -0,0 +1,192 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, } from 'react';
3
+ import { ActionBarPrimitive, AuiIf, ErrorPrimitive, MessagePartPrimitive, MessagePrimitive, groupPartByType, useAuiState, } from '@assistant-ui/react';
4
+ import { MarkdownTextPrimitive } from '@assistant-ui/react-markdown';
5
+ import { Collapsible } from 'radix-ui';
6
+ import remarkGfm from 'remark-gfm';
7
+ import Bot from 'lucide-react/dist/esm/icons/bot.mjs';
8
+ import Brain from 'lucide-react/dist/esm/icons/brain.mjs';
9
+ import CalendarClock from 'lucide-react/dist/esm/icons/calendar-clock.mjs';
10
+ import Check from 'lucide-react/dist/esm/icons/check.mjs';
11
+ import ChevronRight from 'lucide-react/dist/esm/icons/chevron-right.mjs';
12
+ import Copy from 'lucide-react/dist/esm/icons/copy.mjs';
13
+ import Cpu from 'lucide-react/dist/esm/icons/cpu.mjs';
14
+ import ImageGlyph from 'lucide-react/dist/esm/icons/image.mjs';
15
+ import Layers from 'lucide-react/dist/esm/icons/layers.mjs';
16
+ import ListChecks from 'lucide-react/dist/esm/icons/list-checks.mjs';
17
+ import ListTodo from 'lucide-react/dist/esm/icons/list-todo.mjs';
18
+ import Paperclip from 'lucide-react/dist/esm/icons/paperclip.mjs';
19
+ import RotateCw from 'lucide-react/dist/esm/icons/rotate-cw.mjs';
20
+ import Send from 'lucide-react/dist/esm/icons/send.mjs';
21
+ import SlidersHorizontal from 'lucide-react/dist/esm/icons/sliders-horizontal.mjs';
22
+ import Terminal from 'lucide-react/dist/esm/icons/terminal.mjs';
23
+ import { buttonClass, Name, Working } from './kit.js';
24
+ import { StillRunning } from './lasting.js';
25
+ import { list, record, text } from './read.js';
26
+ export const Linked = createContext(null);
27
+ const groupBy = groupPartByType({
28
+ reasoning: ['group-thought', 'group-reasoning'],
29
+ 'tool-call': ['group-thought'],
30
+ });
31
+ const GFM = [remarkGfm];
32
+ const STARTED = 'Session started';
33
+ const SENT = {
34
+ send_routine_request: 'Sent a request',
35
+ cancel_routine_request: 'Cancelled a request',
36
+ };
37
+ const MARKED = {
38
+ mode: { title: 'Mode', Icon: SlidersHorizontal },
39
+ compaction: { title: 'Context compacted', Icon: Layers },
40
+ retry: { title: 'Retrying', Icon: RotateCw },
41
+ model: { title: 'Model', Icon: Cpu },
42
+ };
43
+ const STEP = { completed: '✓', in_progress: '→' };
44
+ function counted(count) {
45
+ return count === 1 ? '1 command' : `${count} commands`;
46
+ }
47
+ function jobShown(said) {
48
+ const icon = _jsx(CalendarClock, { "aria-hidden": "true" });
49
+ const shown = { icon, input: '', output: '' };
50
+ const label = said('label');
51
+ const state = said('state');
52
+ if (said('job') === 'started') {
53
+ return { ...shown, title: 'Background job started', detail: label };
54
+ }
55
+ if (said('job') === 'scheduled') {
56
+ const detail = said('next') === '' ? label : `${label} · ${state}`;
57
+ return { ...shown, title: 'Schedule set', detail };
58
+ }
59
+ const detail = state === '' ? label : `${label} · ${state}`;
60
+ return { ...shown, title: 'Background job ended', detail };
61
+ }
62
+ function shownOf({ toolName, args, result }) {
63
+ const said = (key) => text(args, key) ?? '';
64
+ const plain = { detail: '', input: '', output: '' };
65
+ switch (toolName) {
66
+ case 'subagent':
67
+ return {
68
+ icon: _jsx(Bot, { "aria-hidden": "true" }),
69
+ title: 'Sub-agent',
70
+ detail: said('description'),
71
+ input: said('description'),
72
+ output: typeof result === 'string' ? result : '',
73
+ };
74
+ case 'message':
75
+ return {
76
+ ...plain,
77
+ icon: _jsx(Send, { "aria-hidden": "true" }),
78
+ title: SENT[said('command')] ?? said('command'),
79
+ detail: said('target'),
80
+ };
81
+ case 'plan': {
82
+ const steps = list(args, 'steps').map(record);
83
+ return {
84
+ ...plain,
85
+ icon: _jsx(ListTodo, { "aria-hidden": "true" }),
86
+ title: 'Plan',
87
+ detail: text(steps.find((one) => one.status === 'in_progress') ?? {}, 'content') ?? '',
88
+ input: steps
89
+ .map((one) => `${STEP[text(one, 'status') ?? ''] ?? '○'} ${text(one, 'content') ?? ''}`)
90
+ .join('\n'),
91
+ };
92
+ }
93
+ case 'marker': {
94
+ const marked = MARKED[said('marker')];
95
+ if (marked === undefined)
96
+ return jobShown(said);
97
+ return {
98
+ ...plain,
99
+ icon: _jsx(marked.Icon, { "aria-hidden": "true" }),
100
+ title: marked.title,
101
+ detail: said('text'),
102
+ };
103
+ }
104
+ default:
105
+ return {
106
+ ...plain,
107
+ icon: _jsx(Terminal, { "aria-hidden": "true" }),
108
+ title: counted(Number(args.count)),
109
+ };
110
+ }
111
+ }
112
+ function workedOf(calls) {
113
+ const commands = calls.reduce((sum, one) => (one.toolName === 'commands' ? sum + Number(one.args.count) : sum), 0);
114
+ return commands === 0 ? 'Worked' : `Worked · ${counted(commands)}`;
115
+ }
116
+ function Toggle({ icon, label, detail = '', active, children, }) {
117
+ return (_jsxs(Collapsible.Root, { children: [_jsxs(Collapsible.Trigger, { className: "ahc-row ahc-toggle", children: [icon, _jsx("span", { className: active ? 'ahc-clipped ahc-shimmer' : 'ahc-clipped', children: label }), detail === '' ? null : _jsx("span", { className: "ahc-clipped", children: detail }), _jsx("span", { className: "ahc-chevron", children: _jsx(ChevronRight, { "aria-hidden": "true" }) })] }), _jsx(Collapsible.Content, { children: children })] }));
118
+ }
119
+ function ToolCall({ call, active }) {
120
+ const shown = shownOf(call);
121
+ if (shown.input === '' && shown.output === '') {
122
+ return (_jsxs("div", { className: "ahc-toolline ahc-quiet", children: [shown.icon, _jsx("span", { className: active ? 'ahc-shimmer' : undefined, children: shown.title }), shown.detail === '' ? null : _jsx("span", { className: "ahc-clipped", children: shown.detail })] }));
123
+ }
124
+ return (_jsx(Toggle, { icon: shown.icon, label: shown.title, detail: shown.detail, active: active, children: _jsxs("div", { className: "ahc-quiet ahc-wells", children: [shown.input === '' ? null : _jsx("div", { className: "ahc-well", children: shown.input }), shown.output === '' ? null : _jsx("div", { className: "ahc-well", children: shown.output })] }) }));
125
+ }
126
+ function Thought({ indices, active, children, }) {
127
+ const parts = useAuiState((s) => s.message.parts);
128
+ const held = indices.flatMap((at) => parts[at] ?? []);
129
+ const calls = held.flatMap((part) => (part.type === 'tool-call' ? [part] : []));
130
+ if (calls.length === 0 || held.length === 1)
131
+ return _jsx(_Fragment, { children: children });
132
+ const last = held.at(-1);
133
+ const now = last?.type === 'tool-call'
134
+ ? shownOf(last)
135
+ : { icon: _jsx(Brain, { "aria-hidden": "true" }), title: 'Thinking', detail: '' };
136
+ return (_jsx(Toggle, { icon: active ? now.icon : _jsx(ListChecks, { "aria-hidden": "true" }), label: active ? now.title : workedOf(calls), detail: active ? now.detail : '', active: active, children: children }));
137
+ }
138
+ const SCHEME = /^[a-z][a-z0-9+.-]*:/i;
139
+ function Anchor({ node: _node, href = '', ...rest }) {
140
+ const onLink = useContext(Linked);
141
+ if (SCHEME.test(href) || onLink === null)
142
+ return _jsx("a", { ...rest, href: href, rel: "noreferrer" });
143
+ return (_jsx("a", { ...rest, href: href, onClick: (event) => {
144
+ event.preventDefault();
145
+ onLink(href);
146
+ } }));
147
+ }
148
+ const LINKED = { a: Anchor };
149
+ const THOUGHT = { className: 'ahc-thought' };
150
+ function Said({ thought = false }) {
151
+ return (_jsx(MarkdownTextPrimitive, { className: "ahc-text ahc-markdown", containerProps: thought ? THOUGHT : undefined, remarkPlugins: GFM, components: LINKED }));
152
+ }
153
+ function UserText() {
154
+ return _jsx(MessagePartPrimitive.Text, { className: "ahc-said" });
155
+ }
156
+ export function UserMessage() {
157
+ const said = useAuiState((s) => s.message.parts.some((one) => one.type === 'text' && one.text !== ''));
158
+ const attached = useAuiState((s) => (s.message.attachments?.length ?? 0) > 0);
159
+ const undelivered = useAuiState((s) => s.message.metadata.custom.undelivered === true);
160
+ return (_jsxs(MessagePrimitive.Root, { role: "group", "aria-label": "You", className: "ahc-you", children: [said ? (_jsx("div", { className: "ahc-bubble", children: _jsx(MessagePrimitive.Parts, { components: { Text: UserText } }) })) : null, attached ? (_jsx("div", { className: "ahc-chips", children: _jsx(MessagePrimitive.Attachments, { children: ({ attachment }) => (_jsxs("span", { className: "ahc-chip", children: [_jsx(Paperclip, { "aria-hidden": "true" }), _jsx(Name, { text: attachment.name })] })) }) })) : null, undelivered ? _jsx(Undelivered, {}) : null] }));
161
+ }
162
+ export function Undelivered() {
163
+ return _jsx("span", { className: "ahc-meta", children: "Telegram didn't receive this" });
164
+ }
165
+ export function AssistantMessage() {
166
+ const running = useAuiState((s) => s.message.status?.type === 'running');
167
+ const started = useAuiState((s) => s.message.metadata.isOptimistic !== true);
168
+ const said = useAuiState((s) => s.message.parts.some((one) => one.type === 'text'));
169
+ const last = useAuiState((s) => s.message.isLast);
170
+ const custom = useAuiState((s) => s.message.metadata.custom);
171
+ const lasting = Array.isArray(custom.lasting) ? custom.lasting : [];
172
+ return (_jsxs(MessagePrimitive.Root, { role: "group", "aria-label": running ? 'Turn, running' : 'Turn', className: "ahc-turn", children: [_jsx(MessagePrimitive.GroupedParts, { groupBy: groupBy, indicator: "empty", children: ({ part, children }) => {
173
+ switch (part.type) {
174
+ case 'group-thought':
175
+ return (_jsx(Thought, { indices: part.indices, active: part.status.type === 'running', children: children }));
176
+ case 'group-reasoning':
177
+ return (_jsx(Toggle, { icon: _jsx(Brain, { "aria-hidden": "true" }), label: "Thinking", active: part.status.type === 'running', children: children }));
178
+ case 'text':
179
+ return _jsx(Said, {});
180
+ case 'reasoning':
181
+ return _jsx(Said, { thought: true });
182
+ case 'tool-call':
183
+ return _jsx(ToolCall, { call: part, active: part.status.type === 'running' });
184
+ case 'file':
185
+ return (_jsxs("div", { className: "ahc-toolline ahc-quiet", children: [_jsx(ImageGlyph, { "aria-hidden": "true" }), _jsx("span", { className: "ahc-clipped", children: part.filename })] }));
186
+ case 'indicator':
187
+ return _jsx(Working, { step: started ? STARTED : undefined });
188
+ default:
189
+ return null;
190
+ }
191
+ } }), _jsx(MessagePrimitive.Error, { children: _jsxs(ErrorPrimitive.Root, { className: "ahc-failure", children: [_jsx(ErrorPrimitive.Message, {}), _jsx(AuiIf, { condition: (s) => s.thread.capabilities.reload && s.message.metadata.custom.again === true, children: _jsx(ActionBarPrimitive.Reload, { className: buttonClass('outline', true, false), children: "Try again" }) })] }) }), custom.undelivered === true ? _jsx(Undelivered, {}) : null, said ? (_jsx(ActionBarPrimitive.Root, { hideWhenRunning: true, autohide: "not-last", autohideFloat: "always", className: last ? 'ahc-actions' : 'ahc-actions ahc-actions--floating', children: _jsxs(ActionBarPrimitive.Copy, { className: `${buttonClass('quiet', true, true)} ahc-secondary`, "aria-label": "Copy", children: [_jsx(AuiIf, { condition: (s) => s.message.isCopied, children: _jsx(Check, { "aria-hidden": "true" }) }), _jsx(AuiIf, { condition: (s) => !s.message.isCopied, children: _jsx(Copy, { "aria-hidden": "true" }) })] }) })) : null, lasting.length === 0 ? null : _jsx(StillRunning, { lasting: lasting })] }));
192
+ }
@@ -0,0 +1,21 @@
1
+ import type { ThreadMessageLike } from '@assistant-ui/react';
2
+ import type { TurnContext } from '../adapter.js';
3
+ import type { ConversationView } from '../conversation.js';
4
+ import { type Part } from './parts.js';
5
+ type Entry = ConversationView['messages'][number];
6
+ export type Said = {
7
+ readonly turn: string;
8
+ readonly user: boolean;
9
+ readonly text: string;
10
+ readonly parts: readonly Part[];
11
+ readonly context: TurnContext | null;
12
+ readonly failure: string | null;
13
+ readonly undelivered: boolean;
14
+ readonly files: readonly string[];
15
+ };
16
+ export declare function saidOf(entry: Entry): Said;
17
+ export declare function askedBefore(view: ConversationView | null, id: string | null): string | null;
18
+ export declare function chatMessages(view: ConversationView | null): ThreadMessageLike[];
19
+ export declare function contextOf(view: ConversationView | null): TurnContext | null;
20
+ export {};
21
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/chat/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAA0D,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAO/F,KAAK,KAAK,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,IAAI,GAAG;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAYzC;AAkED,wBAAgB,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAO3F;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,EAAE,CAsD/E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAS3E"}
@@ -0,0 +1,151 @@
1
+ import { contextIn, jobOf, partsOf, stillRunning } from './parts.js';
2
+ import { list, record, text } from './read.js';
3
+ export function saidOf(entry) {
4
+ const message = record(entry.message);
5
+ return {
6
+ turn: text(message, 'turn_id') ?? entry.turn,
7
+ user: text(message, 'role') === 'user',
8
+ text: text(message, 'text') ?? '',
9
+ parts: partsOf(list(message, 'parts')),
10
+ context: contextIn(message.context),
11
+ failure: text(message, 'failure'),
12
+ undelivered: message.telegram_undelivered === true,
13
+ files: list(message, 'files').flatMap((one) => text(record(one), 'name') ?? []),
14
+ };
15
+ }
16
+ function markerArgs(part) {
17
+ if (part.marker !== 'job')
18
+ return { marker: part.marker, text: part.text };
19
+ const job = jobOf(part.text);
20
+ return {
21
+ marker: part.marker,
22
+ text: part.text,
23
+ job: job.kind,
24
+ label: job.label,
25
+ state: job.state,
26
+ next: job.next ?? '',
27
+ };
28
+ }
29
+ function contentOf(id, parts, live) {
30
+ return parts.map((part, at) => {
31
+ const done = !live || at < parts.length - 1;
32
+ const call = (toolName, args) => ({
33
+ type: 'tool-call',
34
+ toolCallId: `${id}:${at}`,
35
+ toolName,
36
+ args,
37
+ result: done ? null : undefined,
38
+ });
39
+ switch (part.type) {
40
+ case 'text':
41
+ return { type: 'text', text: part.text };
42
+ case 'reasoning':
43
+ return { type: 'reasoning', text: part.text };
44
+ case 'commands':
45
+ return call('commands', { count: part.count });
46
+ case 'subagent':
47
+ return {
48
+ ...call('subagent', { description: part.description }),
49
+ result: part.done ? part.result : undefined,
50
+ };
51
+ case 'message':
52
+ return call('message', { command: part.command, target: part.target ?? '' });
53
+ case 'marker':
54
+ return call('marker', markerArgs(part));
55
+ case 'plan':
56
+ return {
57
+ ...call('plan', {}),
58
+ args: { steps: part.steps.map((step) => ({ ...step })) },
59
+ };
60
+ case 'image':
61
+ return { type: 'file', filename: part.name, mimeType: part.mediaType, data: '' };
62
+ }
63
+ });
64
+ }
65
+ function leftRunning(view) {
66
+ if (view.process?.running === false)
67
+ return new Map();
68
+ const turns = view.messages.flatMap((entry) => {
69
+ const one = saidOf(entry);
70
+ return one.user ? [] : [{ turn: one.turn, parts: one.parts, ended: true }];
71
+ });
72
+ return stillRunning(view.turn === null
73
+ ? turns
74
+ : [...turns, { turn: view.turn.turn, parts: partsOf(view.turn.parts), ended: false }]);
75
+ }
76
+ export function askedBefore(view, id) {
77
+ const said = (view?.messages ?? []).map((entry) => ({ ...saidOf(entry), id: entry.identity }));
78
+ const asked = said
79
+ .slice(0, said.findIndex((one) => one.id === id) + 1)
80
+ .reverse()
81
+ .find((one) => one.user);
82
+ return asked === undefined || asked.text === '' ? null : asked.text;
83
+ }
84
+ export function chatMessages(view) {
85
+ if (view === null)
86
+ return [];
87
+ const lasting = leftRunning(view);
88
+ const said = view.messages.map((entry, at) => {
89
+ const one = saidOf(entry);
90
+ const custom = { undelivered: one.undelivered };
91
+ if (one.user) {
92
+ return {
93
+ id: entry.identity,
94
+ role: 'user',
95
+ content: [{ type: 'text', text: one.text }],
96
+ attachments: one.files.map((name, at) => ({
97
+ id: `${entry.identity}:${at}`,
98
+ type: 'file',
99
+ name,
100
+ status: { type: 'complete' },
101
+ content: [],
102
+ })),
103
+ metadata: { custom },
104
+ };
105
+ }
106
+ const failed = one.failure === null
107
+ ? undefined
108
+ : { type: 'incomplete', reason: 'error', error: one.failure };
109
+ return {
110
+ id: entry.identity,
111
+ role: 'assistant',
112
+ content: contentOf(entry.identity, one.parts, false),
113
+ status: failed,
114
+ metadata: {
115
+ custom: {
116
+ ...custom,
117
+ lasting: lasting.get(one.turn) ?? [],
118
+ again: failed !== undefined &&
119
+ view.turn === null &&
120
+ at === view.messages.length - 1 &&
121
+ askedBefore(view, view.messages[at - 1]?.identity ?? null) !== null,
122
+ },
123
+ },
124
+ };
125
+ });
126
+ if (view.turn === null)
127
+ return said;
128
+ const running = `running:${view.turn.turn}`;
129
+ return [
130
+ ...said,
131
+ {
132
+ id: running,
133
+ role: 'assistant',
134
+ content: contentOf(running, partsOf(view.turn.parts), true),
135
+ status: { type: 'running' },
136
+ },
137
+ ];
138
+ }
139
+ export function contextOf(view) {
140
+ if (view === null)
141
+ return null;
142
+ const running = view.turn === null ? null : contextIn(view.turn.context);
143
+ if (running !== null)
144
+ return running;
145
+ for (const entry of [...view.messages].reverse()) {
146
+ const held = contextIn(record(entry.message).context);
147
+ if (held !== null)
148
+ return held;
149
+ }
150
+ return null;
151
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReactElement } from 'react';
2
+ export declare function readable(name: string): string;
3
+ export declare function ChatName({ name }: {
4
+ readonly name: string;
5
+ }): ReactElement;
6
+ //# sourceMappingURL=name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../src/chat/name.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAgC1C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAc1E"}
@@ -0,0 +1,37 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ const INSTANT = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})/g;
3
+ function stamp(at) {
4
+ const time = new Date(at);
5
+ return Number.isNaN(time.getTime())
6
+ ? ''
7
+ : time.toLocaleString('en-US', {
8
+ month: 'short',
9
+ day: 'numeric',
10
+ hour: '2-digit',
11
+ minute: '2-digit',
12
+ });
13
+ }
14
+ function partsOf(name) {
15
+ const parts = [];
16
+ let from = 0;
17
+ for (const found of name.matchAll(INSTANT)) {
18
+ const shown = stamp(found[0]);
19
+ if (shown === '')
20
+ continue;
21
+ if (found.index > from)
22
+ parts.push({ text: name.slice(from, found.index), at: null });
23
+ parts.push({ text: shown, at: found[0] });
24
+ from = found.index + found[0].length;
25
+ }
26
+ if (from < name.length)
27
+ parts.push({ text: name.slice(from), at: null });
28
+ return parts;
29
+ }
30
+ export function readable(name) {
31
+ return partsOf(name)
32
+ .map((part) => part.text)
33
+ .join('');
34
+ }
35
+ export function ChatName({ name }) {
36
+ return (_jsx(_Fragment, { children: partsOf(name).map((part, at) => part.at === null ? (part.text) : (_jsx("time", { dateTime: part.at, children: part.text }, at))) }));
37
+ }
@@ -0,0 +1,11 @@
1
+ import type { ConversationEntry } from '../conversation.js';
2
+ import { type ChatState } from './provider.js';
3
+ export type Opened = ChatState & {
4
+ readonly entry: ConversationEntry | undefined;
5
+ readonly by: string | null;
6
+ readonly name: string;
7
+ readonly deleted: boolean;
8
+ readonly busy: boolean;
9
+ };
10
+ export declare function useOpened(): Opened;
11
+ //# sourceMappingURL=opened.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opened.d.ts","sourceRoot":"","sources":["../../src/chat/opened.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,SAAS,IAAI,MAAM,CAelC"}
@@ -0,0 +1,17 @@
1
+ import { useChat, useChatScope } from './provider.js';
2
+ export function useOpened() {
3
+ const chat = useChat();
4
+ const { known } = useChatScope();
5
+ const entry = chat.conversations.find((one) => one.conversation === chat.conversation);
6
+ const by = entry?.agent.identity ?? chat.agent;
7
+ const live = chat.agents.find((one) => one.identity === by);
8
+ const asks = chat.view?.process?.running === true && chat.questions.length > 0;
9
+ return {
10
+ ...chat,
11
+ entry,
12
+ by,
13
+ name: live?.name ?? entry?.agent.name ?? '',
14
+ deleted: known && chat.conversation !== null && by !== null && live === undefined,
15
+ busy: chat.running || asks,
16
+ };
17
+ }
@@ -0,0 +1,31 @@
1
+ import type { ChatDraft, ConversationEntry, ConversationView } from '../conversation.js';
2
+ import { type ExpectedOf, type Expecting } from '../expectation.js';
3
+ type Entries = readonly ConversationEntry[];
4
+ export type Expectation = {
5
+ readonly key: string;
6
+ readonly view: 'conversation';
7
+ draw(held: ConversationView): ConversationView;
8
+ shown(held: ConversationView): boolean;
9
+ } | {
10
+ readonly key: string;
11
+ readonly view: 'conversations';
12
+ draw(held: Entries): Entries;
13
+ shown(held: Entries): boolean;
14
+ };
15
+ export type Expected = ExpectedOf<Expectation>;
16
+ export type Overlay = Omit<Expecting<Expectation>, 'expect' | 'heard' | 'drawn'> & {
17
+ expect(act: number, expected: Expected): void;
18
+ heard(held: ConversationView): void;
19
+ heardList(held: Entries): void;
20
+ conversation(held: ConversationView): ConversationView;
21
+ conversations(held: Entries): Entries;
22
+ };
23
+ export declare function overlay(): Overlay;
24
+ export declare function sentMessage(key: string, into: readonly string[], said: ChatDraft, turn: string | null): Expectation;
25
+ export declare function optionChosen(conversation: string, option: string, value: string): Expectation;
26
+ export declare function questionAnswered(conversation: string, interaction: string): Expectation;
27
+ export declare function conversationListed(entry: ConversationEntry): Expectation;
28
+ export declare function conversationChanged(conversation: string, changes: Partial<Pick<ConversationEntry, 'name' | 'finished'>>, shown: (entry: ConversationEntry) => boolean): Expectation;
29
+ export declare function conversationGone(conversation: string): Expectation;
30
+ export {};
31
+ //# sourceMappingURL=overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../src/chat/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAa,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG/E,KAAK,OAAO,GAAG,SAAS,iBAAiB,EAAE,CAAC;AAE5C,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IAC/C,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC;CACxC,GACD;IACE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,IAAI,CAAC,IAAI,EAAE,OAA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AAK,OAAO,GAC3C,WAAW,CAQb;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAQlE"}
@@ -0,0 +1,97 @@
1
+ import { expecting } from '../expectation.js';
2
+ import { record, text } from './read.js';
3
+ export function overlay() {
4
+ const held = expecting();
5
+ return {
6
+ subscribe: held.subscribe,
7
+ version: held.version,
8
+ begin: held.begin,
9
+ drop: held.drop,
10
+ expect: (act, expected) => held.expect(act, expected),
11
+ heard: (view) => held.heard((one) => one.view === 'conversation' && one.shown(view)),
12
+ heardList: (entries) => held.heard((one) => one.view === 'conversations' && one.shown(entries)),
13
+ conversation: (view) => held.drawn().reduce((now, one) => (one.view === 'conversation' ? one.draw(now) : now), view),
14
+ conversations: (entries) => held
15
+ .drawn()
16
+ .reduce((now, one) => (one.view === 'conversations' ? one.draw(now) : now), entries),
17
+ };
18
+ }
19
+ export function sentMessage(key, into, said, turn) {
20
+ const sealed = (held) => turn !== null && held.messages.some((one) => one.turn === turn);
21
+ return {
22
+ key,
23
+ view: 'conversation',
24
+ draw: (held) => !into.includes(held.conversation) || sealed(held)
25
+ ? held
26
+ : {
27
+ ...held,
28
+ messages: [
29
+ ...held.messages,
30
+ {
31
+ identity: key,
32
+ turn: turn ?? key,
33
+ text: said.text,
34
+ message: {
35
+ role: 'user',
36
+ text: said.text,
37
+ files: said.files.map((file) => ({ name: file.name })),
38
+ },
39
+ },
40
+ ],
41
+ },
42
+ shown: sealed,
43
+ };
44
+ }
45
+ export function optionChosen(conversation, option, value) {
46
+ const ours = (entry) => text(record(entry), 'id') === option;
47
+ return {
48
+ key: `option ${conversation} ${option}`,
49
+ view: 'conversation',
50
+ draw: (held) => held.conversation !== conversation
51
+ ? held
52
+ : {
53
+ ...held,
54
+ options: held.options.map((entry) => ours(entry) && entry.type === 'select' ? { ...entry, currentValue: value } : entry),
55
+ },
56
+ shown: (held) => held.conversation === conversation &&
57
+ held.options.some((entry) => ours(entry) && text(record(entry), 'currentValue') === value),
58
+ };
59
+ }
60
+ export function questionAnswered(conversation, interaction) {
61
+ const ours = (entry) => text(record(entry), 'interaction_id') === interaction;
62
+ return {
63
+ key: `answer ${conversation} ${interaction}`,
64
+ view: 'conversation',
65
+ draw: (held) => held.conversation !== conversation
66
+ ? held
67
+ : { ...held, questions: held.questions.filter((entry) => !ours(entry)) },
68
+ shown: (held) => held.conversation === conversation && !held.questions.some(ours),
69
+ };
70
+ }
71
+ export function conversationListed(entry) {
72
+ const ours = (one) => one.conversation === entry.conversation;
73
+ return {
74
+ key: `conversation ${entry.conversation}`,
75
+ view: 'conversations',
76
+ draw: (held) => (held.some(ours) ? held : [...held, entry]),
77
+ shown: (held) => held.some(ours),
78
+ };
79
+ }
80
+ export function conversationChanged(conversation, changes, shown) {
81
+ const ours = (one) => one.conversation === conversation;
82
+ return {
83
+ key: `conversation ${conversation} ${Object.keys(changes).sort().join(' ')}`,
84
+ view: 'conversations',
85
+ draw: (held) => held.map((one) => (ours(one) ? { ...one, ...changes } : one)),
86
+ shown: (held) => held.some((one) => ours(one) && shown(one)),
87
+ };
88
+ }
89
+ export function conversationGone(conversation) {
90
+ const ours = (one) => one.conversation === conversation;
91
+ return {
92
+ key: `conversation ${conversation}`,
93
+ view: 'conversations',
94
+ draw: (held) => held.filter((one) => !ours(one)),
95
+ shown: (held) => !held.some(ours),
96
+ };
97
+ }
@@ -0,0 +1,57 @@
1
+ import type { TurnContext } from '../adapter.js';
2
+ export type PlanStep = {
3
+ readonly content: string;
4
+ readonly status: string;
5
+ };
6
+ export type Marker = 'mode' | 'compaction' | 'retry' | 'model' | 'job';
7
+ export type Part = {
8
+ readonly type: 'text';
9
+ readonly text: string;
10
+ } | {
11
+ readonly type: 'reasoning';
12
+ readonly text: string;
13
+ } | {
14
+ readonly type: 'commands';
15
+ readonly count: number;
16
+ } | {
17
+ readonly type: 'subagent';
18
+ readonly description: string;
19
+ readonly done: boolean;
20
+ readonly result: string | null;
21
+ } | {
22
+ readonly type: 'message';
23
+ readonly command: string;
24
+ readonly target: string | null;
25
+ } | {
26
+ readonly type: 'image';
27
+ readonly name: string;
28
+ readonly mediaType: string;
29
+ } | {
30
+ readonly type: 'marker';
31
+ readonly marker: Marker;
32
+ readonly text: string;
33
+ } | {
34
+ readonly type: 'plan';
35
+ readonly steps: readonly PlanStep[];
36
+ };
37
+ export declare function partsOf(raw: readonly unknown[]): readonly Part[];
38
+ export declare function contextIn(raw: unknown): TurnContext | null;
39
+ export type Turn = {
40
+ readonly turn: string;
41
+ readonly parts: readonly Part[];
42
+ readonly ended: boolean;
43
+ };
44
+ export type ChatWork = {
45
+ readonly kind: 'job' | 'schedule' | 'subagent';
46
+ readonly title: string;
47
+ readonly next: string | null;
48
+ };
49
+ export type Job = {
50
+ readonly label: string;
51
+ readonly kind: 'started' | 'scheduled' | 'ended';
52
+ readonly state: string;
53
+ readonly next: string | null;
54
+ };
55
+ export declare function jobOf(said: string): Job;
56
+ export declare function stillRunning(turns: readonly Turn[]): ReadonlyMap<string, readonly ChatWork[]>;
57
+ //# sourceMappingURL=parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../src/chat/parts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAEvE,MAAM,MAAM,IAAI,GACZ;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,M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