@agentshouse/mdruntime 0.1.0-cb9c79aee537a → 0.1.0-cba6f2439bb25

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 (229) hide show
  1. package/README.md +18 -15
  2. package/dist/adapter.d.ts +70 -32
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/attached-model.d.ts +5 -1
  5. package/dist/attached-model.d.ts.map +1 -1
  6. package/dist/attached-model.js +38 -4
  7. package/dist/binary.d.ts +0 -5
  8. package/dist/binary.d.ts.map +1 -1
  9. package/dist/binary.js +1 -1
  10. package/dist/bootstrap.d.ts +26 -8
  11. package/dist/bootstrap.d.ts.map +1 -1
  12. package/dist/bootstrap.js +174 -102
  13. package/dist/chain.d.ts +11 -0
  14. package/dist/chain.d.ts.map +1 -0
  15. package/dist/chain.js +64 -0
  16. package/dist/change-set.d.ts +9 -16
  17. package/dist/change-set.d.ts.map +1 -1
  18. package/dist/change-set.js +11 -89
  19. package/dist/change.d.ts +31 -1
  20. package/dist/change.d.ts.map +1 -1
  21. package/dist/change.js +10 -1
  22. package/dist/client.d.ts +9 -5
  23. package/dist/client.d.ts.map +1 -1
  24. package/dist/client.js +80 -6
  25. package/dist/collection.d.ts +11 -20
  26. package/dist/collection.d.ts.map +1 -1
  27. package/dist/collection.js +53 -354
  28. package/dist/compile.d.ts +16 -0
  29. package/dist/compile.d.ts.map +1 -0
  30. package/dist/compile.js +771 -0
  31. package/dist/connection.d.ts +18 -10
  32. package/dist/connection.d.ts.map +1 -1
  33. package/dist/connection.js +2631 -986
  34. package/dist/conversation.d.ts +14 -6
  35. package/dist/conversation.d.ts.map +1 -1
  36. package/dist/conversation.js +237 -90
  37. package/dist/digest.d.ts +7 -0
  38. package/dist/digest.d.ts.map +1 -0
  39. package/dist/digest.js +113 -0
  40. package/dist/durability.d.ts +3 -5
  41. package/dist/durability.d.ts.map +1 -1
  42. package/dist/durability.js +5 -0
  43. package/dist/entry.d.ts +4 -1
  44. package/dist/entry.d.ts.map +1 -1
  45. package/dist/entry.js +18 -24
  46. package/dist/file.d.ts +2 -19
  47. package/dist/file.d.ts.map +1 -1
  48. package/dist/file.js +7 -122
  49. package/dist/fulltext.d.ts +27 -0
  50. package/dist/fulltext.d.ts.map +1 -0
  51. package/dist/fulltext.js +370 -0
  52. package/dist/host.d.ts +4 -4
  53. package/dist/host.d.ts.map +1 -1
  54. package/dist/host.js +45 -15
  55. package/dist/identity.d.ts +0 -1
  56. package/dist/identity.d.ts.map +1 -1
  57. package/dist/identity.js +0 -3
  58. package/dist/index.d.ts +12 -10
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +5 -2
  61. package/dist/live.d.ts +22 -0
  62. package/dist/live.d.ts.map +1 -0
  63. package/dist/live.js +124 -0
  64. package/dist/media.d.ts +8 -0
  65. package/dist/media.d.ts.map +1 -0
  66. package/dist/media.js +208 -0
  67. package/dist/memory.d.ts +3 -2
  68. package/dist/memory.d.ts.map +1 -1
  69. package/dist/memory.js +66 -23
  70. package/dist/messages.d.ts +28 -0
  71. package/dist/messages.d.ts.map +1 -0
  72. package/dist/messages.js +90 -0
  73. package/dist/model.d.ts +6 -0
  74. package/dist/model.d.ts.map +1 -1
  75. package/dist/model.js +7 -1
  76. package/dist/name.d.ts +4 -0
  77. package/dist/name.d.ts.map +1 -0
  78. package/dist/name.js +122 -0
  79. package/dist/observation.d.ts +13 -0
  80. package/dist/observation.d.ts.map +1 -1
  81. package/dist/observation.js +84 -0
  82. package/dist/opened.d.ts +22 -0
  83. package/dist/opened.d.ts.map +1 -0
  84. package/dist/opened.js +107 -0
  85. package/dist/outcome.d.ts +40 -5
  86. package/dist/outcome.d.ts.map +1 -1
  87. package/dist/outcome.js +38 -2
  88. package/dist/overlay.d.ts +2 -6
  89. package/dist/overlay.d.ts.map +1 -1
  90. package/dist/overlay.js +87 -176
  91. package/dist/paths.d.ts +1 -0
  92. package/dist/paths.d.ts.map +1 -1
  93. package/dist/paths.js +4 -0
  94. package/dist/query.d.ts +11 -1
  95. package/dist/query.d.ts.map +1 -1
  96. package/dist/query.js +13 -1
  97. package/dist/reach.d.ts +13 -4
  98. package/dist/reach.d.ts.map +1 -1
  99. package/dist/reach.js +201 -72
  100. package/dist/readiness.d.ts +19 -9
  101. package/dist/readiness.d.ts.map +1 -1
  102. package/dist/readiness.js +6 -6
  103. package/dist/reads.d.ts.map +1 -1
  104. package/dist/reads.js +10 -17
  105. package/dist/recovery.d.ts +2 -2
  106. package/dist/recovery.d.ts.map +1 -1
  107. package/dist/recovery.js +8 -7
  108. package/dist/refresh.d.ts +15 -14
  109. package/dist/refresh.d.ts.map +1 -1
  110. package/dist/refresh.js +113 -56
  111. package/dist/replica.d.ts +56 -38
  112. package/dist/replica.d.ts.map +1 -1
  113. package/dist/replica.js +279 -195
  114. package/dist/room-draft.d.ts +21 -3
  115. package/dist/room-draft.d.ts.map +1 -1
  116. package/dist/room-draft.js +102 -28
  117. package/dist/rows.d.ts +38 -31
  118. package/dist/rows.d.ts.map +1 -1
  119. package/dist/rows.js +173 -101
  120. package/dist/save.d.ts +52 -15
  121. package/dist/save.d.ts.map +1 -1
  122. package/dist/save.js +504 -182
  123. package/dist/search.d.ts +11 -43
  124. package/dist/search.d.ts.map +1 -1
  125. package/dist/search.js +0 -213
  126. package/dist/shared.d.ts +5 -3
  127. package/dist/shared.d.ts.map +1 -1
  128. package/dist/shared.js +72 -35
  129. package/dist/status.d.ts +5 -0
  130. package/dist/status.d.ts.map +1 -1
  131. package/dist/status.js +3 -1
  132. package/dist/store.d.ts +85 -93
  133. package/dist/store.d.ts.map +1 -1
  134. package/dist/store.js +323 -687
  135. package/dist/stored.d.ts +135 -0
  136. package/dist/stored.d.ts.map +1 -0
  137. package/dist/stored.js +568 -0
  138. package/dist/tables.d.ts +352 -0
  139. package/dist/tables.d.ts.map +1 -0
  140. package/dist/tables.js +621 -0
  141. package/dist/turn.d.ts +2 -2
  142. package/dist/turn.d.ts.map +1 -1
  143. package/dist/turn.js +34 -23
  144. package/dist/validation.d.ts +30 -0
  145. package/dist/validation.d.ts.map +1 -0
  146. package/dist/validation.js +162 -0
  147. package/dist/windows.d.ts +2 -6
  148. package/dist/windows.d.ts.map +1 -1
  149. package/dist/windows.js +30 -34
  150. package/dist/wire.d.ts +17 -1
  151. package/dist/wire.d.ts.map +1 -1
  152. package/dist/wire.js +5 -1
  153. package/dist/words.d.ts +19 -0
  154. package/dist/words.d.ts.map +1 -0
  155. package/dist/words.js +156 -0
  156. package/package.json +18 -19
  157. package/AGENTS.md +0 -299
  158. package/dist/chat/acts.d.ts +0 -33
  159. package/dist/chat/acts.d.ts.map +0 -1
  160. package/dist/chat/acts.js +0 -36
  161. package/dist/chat/context.d.ts +0 -3
  162. package/dist/chat/context.d.ts.map +0 -1
  163. package/dist/chat/context.js +0 -10
  164. package/dist/chat/earlier.d.ts +0 -10
  165. package/dist/chat/earlier.d.ts.map +0 -1
  166. package/dist/chat/earlier.js +0 -54
  167. package/dist/chat/input.d.ts +0 -9
  168. package/dist/chat/input.d.ts.map +0 -1
  169. package/dist/chat/input.js +0 -99
  170. package/dist/chat/kit.d.ts +0 -61
  171. package/dist/chat/kit.d.ts.map +0 -1
  172. package/dist/chat/kit.js +0 -123
  173. package/dist/chat/lasting.d.ts +0 -6
  174. package/dist/chat/lasting.d.ts.map +0 -1
  175. package/dist/chat/lasting.js +0 -19
  176. package/dist/chat/list.d.ts +0 -27
  177. package/dist/chat/list.d.ts.map +0 -1
  178. package/dist/chat/list.js +0 -99
  179. package/dist/chat/markdown.d.ts +0 -21
  180. package/dist/chat/markdown.d.ts.map +0 -1
  181. package/dist/chat/markdown.js +0 -246
  182. package/dist/chat/message.d.ts +0 -6
  183. package/dist/chat/message.d.ts.map +0 -1
  184. package/dist/chat/message.js +0 -192
  185. package/dist/chat/messages.d.ts +0 -22
  186. package/dist/chat/messages.d.ts.map +0 -1
  187. package/dist/chat/messages.js +0 -155
  188. package/dist/chat/name.d.ts +0 -6
  189. package/dist/chat/name.d.ts.map +0 -1
  190. package/dist/chat/name.js +0 -37
  191. package/dist/chat/opened.d.ts +0 -11
  192. package/dist/chat/opened.d.ts.map +0 -1
  193. package/dist/chat/opened.js +0 -17
  194. package/dist/chat/overlay.d.ts +0 -31
  195. package/dist/chat/overlay.d.ts.map +0 -1
  196. package/dist/chat/overlay.js +0 -97
  197. package/dist/chat/parts.d.ts +0 -57
  198. package/dist/chat/parts.d.ts.map +0 -1
  199. package/dist/chat/parts.js +0 -119
  200. package/dist/chat/pieces.d.ts +0 -51
  201. package/dist/chat/pieces.d.ts.map +0 -1
  202. package/dist/chat/pieces.js +0 -797
  203. package/dist/chat/process.d.ts +0 -20
  204. package/dist/chat/process.d.ts.map +0 -1
  205. package/dist/chat/process.js +0 -32
  206. package/dist/chat/provider.d.ts +0 -63
  207. package/dist/chat/provider.d.ts.map +0 -1
  208. package/dist/chat/provider.js +0 -628
  209. package/dist/chat/question.d.ts +0 -9
  210. package/dist/chat/question.d.ts.map +0 -1
  211. package/dist/chat/question.js +0 -69
  212. package/dist/chat/questions.d.ts +0 -31
  213. package/dist/chat/questions.d.ts.map +0 -1
  214. package/dist/chat/questions.js +0 -111
  215. package/dist/chat/read.d.ts +0 -5
  216. package/dist/chat/read.d.ts.map +0 -1
  217. package/dist/chat/read.js +0 -13
  218. package/dist/chat/ready.d.ts +0 -34
  219. package/dist/chat/ready.d.ts.map +0 -1
  220. package/dist/chat/ready.js +0 -91
  221. package/dist/chat/style.d.ts +0 -4
  222. package/dist/chat/style.d.ts.map +0 -1
  223. package/dist/chat/style.js +0 -302
  224. package/dist/chat.d.ts +0 -14
  225. package/dist/chat.d.ts.map +0 -1
  226. package/dist/chat.js +0 -8
  227. package/dist/read-side.d.ts +0 -27
  228. package/dist/read-side.d.ts.map +0 -1
  229. package/dist/read-side.js +0 -824
package/dist/chat/name.js DELETED
@@ -1,37 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,17 +0,0 @@
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
- }
@@ -1,31 +0,0 @@
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
@@ -1 +0,0 @@
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,OAAO,GAAG,OAAO,CAAC;IAC7B,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;CAC/B,CAAC;AAEN,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAE/C,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,GAAG;IACjF,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAAC;IACvD,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;CACvC,CAAC;AAEF,wBAAgB,OAAO,IAAI,OAAO,CAiBjC;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,WAAW,CA2Bb;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAkB7F;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,WAAW,CAWvF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAQxE;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,EAC9D,KAAK,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,GAC3C,WAAW,CAQb;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAQlE"}
@@ -1,97 +0,0 @@
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
- }
@@ -1,57 +0,0 @@
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
@@ -1 +0,0 @@
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,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrD;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACtF;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,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ASvC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,QAAQ,EAAE,CAAC,CA0C7F"}
@@ -1,119 +0,0 @@
1
- import { list, record, text } from './read.js';
2
- const MARKERS = ['mode', 'compaction', 'retry', 'model', 'job'];
3
- function partOf(raw) {
4
- const part = record(raw);
5
- switch (text(part, 'type')) {
6
- case 'text':
7
- case 'reasoning': {
8
- const said = text(part, 'text');
9
- return said === null ? null : { type: part.type, text: said };
10
- }
11
- case 'commands':
12
- return typeof part.count === 'number' ? { type: 'commands', count: part.count } : null;
13
- case 'subagent':
14
- return {
15
- type: 'subagent',
16
- description: text(part, 'description') ?? '',
17
- done: part.status === 'done',
18
- result: text(part, 'result'),
19
- };
20
- case 'message': {
21
- const command = text(part, 'command');
22
- return command === null ? null : { type: 'message', command, target: text(part, 'target') };
23
- }
24
- case 'image': {
25
- const name = text(part, 'name');
26
- return name === null
27
- ? null
28
- : { type: 'image', name, mediaType: text(part, 'media_type') ?? '' };
29
- }
30
- case 'marker': {
31
- const marker = text(part, 'marker');
32
- return marker === null || !MARKERS.includes(marker)
33
- ? null
34
- : { type: 'marker', marker: marker, text: text(part, 'text') ?? '' };
35
- }
36
- case 'plan':
37
- return {
38
- type: 'plan',
39
- steps: list(part, 'entries').flatMap((entry) => {
40
- const step = record(entry);
41
- const content = text(step, 'content');
42
- return content === null ? [] : [{ content, status: text(step, 'status') ?? '' }];
43
- }),
44
- };
45
- default:
46
- return null;
47
- }
48
- }
49
- export function partsOf(raw) {
50
- return raw.flatMap((one) => partOf(one) ?? []);
51
- }
52
- export function contextIn(raw) {
53
- const held = record(raw);
54
- return typeof held.used === 'number' && typeof held.window === 'number' && held.window > 0
55
- ? { used: held.used, window: held.window }
56
- : null;
57
- }
58
- const NEXT_RUN = 'next run ';
59
- export function jobOf(said) {
60
- const at = said.lastIndexOf(': ');
61
- const label = at === -1 ? said : said.slice(0, at);
62
- const state = at === -1 ? '' : said.slice(at + 2);
63
- if (state === 'running')
64
- return { label, kind: 'started', state, next: null };
65
- if (state === 'scheduled')
66
- return { label, kind: 'scheduled', state, next: null };
67
- return state.startsWith(NEXT_RUN)
68
- ? { label, kind: 'scheduled', state, next: state.slice(NEXT_RUN.length) }
69
- : { label, kind: 'ended', state, next: null };
70
- }
71
- export function stillRunning(turns) {
72
- const open = [];
73
- const close = (key) => {
74
- const at = open.map((one) => one.key).lastIndexOf(key);
75
- if (at !== -1)
76
- open.splice(at, 1);
77
- };
78
- for (const { turn, parts, ended } of turns) {
79
- for (const part of parts) {
80
- if (part.type === 'subagent') {
81
- const key = `subagent\u0000${part.description}`;
82
- if (part.done)
83
- close(key);
84
- else if (ended) {
85
- open.push({ turn, key, work: { kind: 'subagent', title: part.description, next: null } });
86
- }
87
- continue;
88
- }
89
- if (part.type !== 'marker' || part.marker !== 'job')
90
- continue;
91
- const job = jobOf(part.text);
92
- const started = `job\u0000${job.label}`;
93
- const schedule = `schedule\u0000${job.label}`;
94
- if (job.kind === 'scheduled') {
95
- close(schedule);
96
- if (ended) {
97
- open.push({
98
- turn,
99
- key: schedule,
100
- work: { kind: 'schedule', title: job.label, next: job.next },
101
- });
102
- }
103
- }
104
- else if (job.kind === 'started') {
105
- if (ended) {
106
- open.push({ turn, key: started, work: { kind: 'job', title: job.label, next: null } });
107
- }
108
- }
109
- else {
110
- close(started);
111
- close(schedule);
112
- }
113
- }
114
- }
115
- const under = new Map();
116
- for (const one of open)
117
- under.set(one.turn, [...(under.get(one.turn) ?? []), one.work]);
118
- return under;
119
- }
@@ -1,51 +0,0 @@
1
- import { fromMarkdown } from 'mdast-util-from-markdown';
2
- export type Root = ReturnType<typeof fromMarkdown>;
3
- export type Block = Root['children'][number];
4
- export declare function parseMarkdown(text: string): Root;
5
- export type Step = 'list' | 'table' | 'blockquote' | 'paragraph';
6
- export interface Piece {
7
- readonly nodes: readonly Block[];
8
- readonly path: readonly Step[];
9
- readonly join: string;
10
- }
11
- interface Next {
12
- readonly start: number;
13
- readonly path: readonly Step[];
14
- readonly join: string;
15
- readonly carry: string;
16
- }
17
- interface Found {
18
- readonly key: string;
19
- readonly at: number;
20
- readonly url: string;
21
- }
22
- interface Region {
23
- readonly setext: boolean;
24
- readonly last: ReadonlyMap<string, number>;
25
- readonly runs: ReadonlyMap<number, number>;
26
- }
27
- interface Discovery {
28
- readonly found: Found[];
29
- next: Next | null;
30
- }
31
- export interface Long {
32
- readonly text: string;
33
- readonly starts: Int32Array;
34
- readonly breaks: Int32Array;
35
- readonly quoteBreaks: Int32Array;
36
- readonly anchors: readonly number[];
37
- readonly candidates: ReadonlyMap<string, readonly number[]>;
38
- readonly pieces: Piece[];
39
- next: Next | null;
40
- readonly urls: Map<string, string>;
41
- readonly spans: Map<string, readonly Found[]>;
42
- readonly discoveries: Map<number, Discovery>;
43
- readonly regions: Map<string, Region>;
44
- }
45
- export declare function identifierOf(label: string): string;
46
- export declare function longOf(text: string): Long;
47
- export declare function pieceAt(long: Long, index: number): Piece | null;
48
- export declare function drawn(long: Long, count: number): Block[];
49
- export declare function remaining(long: Long, count: number): boolean;
50
- export {};
51
- //# sourceMappingURL=pieces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pieces.d.ts","sourceRoot":"","sources":["../../src/chat/pieces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACnD,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAI7C,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEhD;AA4DD,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,CAAC;AAIjE,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,K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