@beeuni/sdk 0.1.0 → 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.
Files changed (291) hide show
  1. package/README.md +53 -92
  2. package/dist/beeuni.esm.min.js +36 -34
  3. package/dist/beeuni.global.js +36 -34
  4. package/dist/browser/cache/idb-sync-cache.js +15 -5
  5. package/dist/browser/session-sync/server-transcript-mirror.d.ts +7 -1
  6. package/dist/browser/session-sync/server-transcript-mirror.js +30 -24
  7. package/dist/browser/session-sync/session-sync-registry.d.ts +3 -1
  8. package/dist/browser/session-sync/session-sync-registry.js +48 -3
  9. package/dist/browser/stores/sync-store/keep-unchanged.d.ts +4 -0
  10. package/dist/browser/stores/sync-store/keep-unchanged.js +34 -0
  11. package/dist/browser/stores/sync-store.d.ts +7 -0
  12. package/dist/browser/stores/sync-store.js +122 -35
  13. package/dist/core/attachments/prompt-attachments.d.ts +4 -0
  14. package/dist/core/attachments/prompt-attachments.js +34 -0
  15. package/dist/core/capture/rules.d.ts +17 -0
  16. package/dist/core/capture/rules.js +27 -0
  17. package/dist/core/client/beeuni.d.ts +99 -34
  18. package/dist/core/client/beeuni.js +5 -11
  19. package/dist/core/client/capture.d.ts +105 -0
  20. package/dist/core/client/capture.js +48 -0
  21. package/dist/core/client/facade-catalog.d.ts +0 -4
  22. package/dist/core/client/facade-catalog.js +1 -5
  23. package/dist/core/client/facade-identity.d.ts +1 -0
  24. package/dist/core/client/facade-identity.js +1 -0
  25. package/dist/core/client/project-access-resources.d.ts +3 -1
  26. package/dist/core/client/project-access-resources.js +1 -1
  27. package/dist/core/client/project-connections.d.ts +2 -2
  28. package/dist/core/client/project-connections.js +2 -2
  29. package/dist/core/client/project-operations-admin.d.ts +4 -4
  30. package/dist/core/client/project-operations-review.d.ts +2 -3
  31. package/dist/core/client/project-operations-review.js +1 -0
  32. package/dist/core/client/project-operations-workspace.d.ts +4 -4
  33. package/dist/core/client/project-operations-workspace.js +1 -1
  34. package/dist/core/client/project-operations.d.ts +9 -19
  35. package/dist/core/client/project-operations.js +2 -6
  36. package/dist/core/client/project-platform-security.d.ts +1 -1
  37. package/dist/core/client/project-platform-settings.d.ts +1 -1
  38. package/dist/core/client/session-context.d.ts +2 -0
  39. package/dist/core/client/session-handle.d.ts +13 -0
  40. package/dist/core/client/session-lifecycle-resources.d.ts +11 -0
  41. package/dist/core/client/session-lifecycle-resources.js +4 -0
  42. package/dist/core/client/session-lifecycle-security.d.ts +2 -0
  43. package/dist/core/client/session-lifecycle-security.js +1 -0
  44. package/dist/core/client/session-readiness.d.ts +2 -0
  45. package/dist/core/client/session-readiness.js +20 -1
  46. package/dist/core/http/api-client.d.ts +1 -7
  47. package/dist/core/http/api-client.js +2 -37
  48. package/dist/core/http/auth.d.ts +2 -4
  49. package/dist/core/http/auth.js +2 -8
  50. package/dist/core/http/config.d.ts +2 -0
  51. package/dist/core/http/response-error.js +26 -11
  52. package/dist/core/http/transport.js +6 -1
  53. package/dist/core/models/composer-model.d.ts +14 -0
  54. package/dist/core/models/composer-model.js +21 -1
  55. package/dist/core/rest/platform-client/capture.d.ts +363 -0
  56. package/dist/core/rest/platform-client/capture.js +116 -0
  57. package/dist/core/rest/platform-client/client-policy.d.ts +8 -0
  58. package/dist/core/rest/platform-client/client-policy.js +30 -0
  59. package/dist/core/rest/platform-client/index.d.ts +4 -4
  60. package/dist/core/rest/platform-client/index.js +4 -4
  61. package/dist/core/rest/platform-client/lifecycle.js +18 -12
  62. package/dist/core/rest/platform-client/shared.d.ts +5 -0
  63. package/dist/core/rest/platform-client/shared.js +18 -0
  64. package/dist/core/rest/platform-client/types.d.ts +1 -1
  65. package/dist/core/rest/projects-client/account-secret-resources.d.ts +2 -1
  66. package/dist/core/rest/projects-client/accounts.d.ts +34 -0
  67. package/dist/core/rest/projects-client/accounts.js +10 -0
  68. package/dist/core/rest/projects-client/admin-providers.d.ts +0 -61
  69. package/dist/core/rest/projects-client/admin-providers.js +0 -6
  70. package/dist/core/rest/projects-client/agent-config.d.ts +3 -0
  71. package/dist/core/rest/projects-client/apps-fleet.d.ts +5 -1
  72. package/dist/core/rest/projects-client/apps-fleet.js +2 -2
  73. package/dist/core/rest/projects-client/apps.d.ts +11 -1
  74. package/dist/core/rest/projects-client/change-requests.d.ts +2 -0
  75. package/dist/core/rest/projects-client/change-requests.js +2 -0
  76. package/dist/core/rest/projects-client/connectors.d.ts +13 -55
  77. package/dist/core/rest/projects-client/connectors.js +5 -29
  78. package/dist/core/rest/projects-client/files.d.ts +3 -0
  79. package/dist/core/rest/projects-client/files.js +4 -0
  80. package/dist/core/rest/projects-client/gateway.d.ts +5 -0
  81. package/dist/core/rest/projects-client/git-backend.d.ts +1 -10
  82. package/dist/core/rest/projects-client/git-backend.js +0 -10
  83. package/dist/core/rest/projects-client/iam-actions.d.ts +76 -0
  84. package/dist/core/rest/projects-client/iam-actions.js +101 -0
  85. package/dist/core/rest/projects-client/iam-sso.d.ts +0 -10
  86. package/dist/core/rest/projects-client/iam-sso.js +0 -3
  87. package/dist/core/rest/projects-client/iam.d.ts +1 -0
  88. package/dist/core/rest/projects-client/iam.js +1 -0
  89. package/dist/core/rest/projects-client/index.d.ts +1 -4
  90. package/dist/core/rest/projects-client/index.js +1 -4
  91. package/dist/core/rest/projects-client/notifications.d.ts +1 -1
  92. package/dist/core/rest/projects-client/notifications.js +4 -0
  93. package/dist/core/rest/projects-client/projects.d.ts +4 -2
  94. package/dist/core/rest/projects-client/projects.js +4 -2
  95. package/dist/core/rest/projects-client/review-items.d.ts +2 -0
  96. package/dist/core/rest/projects-client/review-items.js +4 -0
  97. package/dist/core/rest/projects-client/review.d.ts +17 -3
  98. package/dist/core/rest/projects-client/review.js +11 -0
  99. package/dist/core/rest/projects-client/sandbox.d.ts +8 -9
  100. package/dist/core/rest/projects-client/secrets.d.ts +3 -0
  101. package/dist/core/rest/projects-client/session-attachments.js +14 -1
  102. package/dist/core/rest/projects-client/session-sandbox.d.ts +1 -1
  103. package/dist/core/rest/projects-client/sessions.d.ts +31 -4
  104. package/dist/core/rest/projects-client/sessions.js +34 -4
  105. package/dist/core/runtime/runtime-rest-client.js +1 -1
  106. package/dist/core/runtime/runtime-types.d.ts +1 -0
  107. package/dist/core/session/control-stream.d.ts +1 -0
  108. package/dist/core/session/control-stream.js +18 -1
  109. package/dist/core/session/open-bundle.d.ts +4 -4
  110. package/dist/core/session/open-bundle.js +29 -46
  111. package/dist/core/session/turn-end-watch.d.ts +47 -0
  112. package/dist/core/session/turn-end-watch.js +141 -0
  113. package/dist/core/session-log/guard.d.ts +6 -0
  114. package/dist/core/session-log/guard.js +109 -0
  115. package/dist/core/session-log/index.d.ts +7 -0
  116. package/dist/core/session-log/index.js +5 -0
  117. package/dist/core/session-log/saved-log.d.ts +10 -0
  118. package/dist/core/session-log/saved-log.js +25 -0
  119. package/dist/core/session-log/source.d.ts +25 -0
  120. package/dist/core/session-log/source.js +30 -0
  121. package/dist/core/session-log/store.d.ts +21 -0
  122. package/dist/core/session-log/store.js +126 -0
  123. package/dist/core/session-log/tool-call.d.ts +11 -0
  124. package/dist/core/session-log/tool-call.js +65 -0
  125. package/dist/core/session-log/turns/blocks.d.ts +60 -0
  126. package/dist/core/session-log/turns/blocks.js +124 -0
  127. package/dist/core/session-log/turns/history.d.ts +32 -0
  128. package/dist/core/session-log/turns/history.js +99 -0
  129. package/dist/core/session-log/turns/index.d.ts +4 -0
  130. package/dist/core/session-log/turns/index.js +4 -0
  131. package/dist/core/session-log/turns/metrics.d.ts +21 -0
  132. package/dist/core/session-log/turns/metrics.js +29 -0
  133. package/dist/core/session-log/turns/turn.d.ts +55 -0
  134. package/dist/core/session-log/turns/turn.js +279 -0
  135. package/dist/core/session-log/turns/v1-parts.d.ts +8 -0
  136. package/dist/core/session-log/turns/v1-parts.js +43 -0
  137. package/dist/core/session-log/types.d.ts +264 -0
  138. package/dist/core/session-log/types.js +6 -0
  139. package/dist/core/session-log/v1-view.d.ts +13 -0
  140. package/dist/core/session-log/v1-view.js +215 -0
  141. package/dist/core/session-log/v1.d.ts +31 -0
  142. package/dist/core/session-log/v1.js +473 -0
  143. package/dist/core/session-sync/copy-store-types.d.ts +19 -0
  144. package/dist/core/session-sync/copy-store-types.js +1 -0
  145. package/dist/core/session-sync/saved-copy-store.js +25 -4
  146. package/dist/core/session-sync/saved-transcript.d.ts +15 -1
  147. package/dist/core/session-sync/saved-transcript.js +55 -0
  148. package/dist/core/session-sync/session-sync-controller.js +3 -0
  149. package/dist/core/stream/event-stream.js +2 -2
  150. package/dist/core/turns/classify.d.ts +2 -1
  151. package/dist/core/turns/classify.js +7 -3
  152. package/dist/core/turns/edit-blocks.d.ts +1 -0
  153. package/dist/core/turns/edit-blocks.js +15 -0
  154. package/dist/core/turns/parts.d.ts +3 -2
  155. package/dist/core/turns/parts.js +4 -2
  156. package/dist/core/turns/segments/burst-summary.d.ts +1 -0
  157. package/dist/core/turns/segments/burst-summary.js +24 -0
  158. package/dist/core/turns/segments/group-steps.d.ts +4 -3
  159. package/dist/core/turns/segments/group-steps.js +9 -6
  160. package/dist/core/turns/segments/index.d.ts +1 -0
  161. package/dist/core/turns/segments/index.js +1 -0
  162. package/dist/core/turns/segments/narration.d.ts +5 -4
  163. package/dist/core/turns/segments/narration.js +12 -3
  164. package/dist/core/turns/segments/session-activity-groups.d.ts +2 -1
  165. package/dist/core/turns/segments/session-activity-groups.js +3 -1
  166. package/dist/core/turns/segments/step-label.d.ts +2 -1
  167. package/dist/core/turns/segments/step-label.js +3 -1
  168. package/dist/core/turns/segments/work-split.d.ts +10 -0
  169. package/dist/core/turns/segments/work-split.js +40 -0
  170. package/dist/core/turns/segments/working-turn.d.ts +4 -2
  171. package/dist/core/turns/segments/working-turn.js +9 -8
  172. package/dist/core/turns/state.d.ts +2 -7
  173. package/dist/core/turns/state.js +28 -134
  174. package/dist/core/turns/tool-kind.d.ts +1 -1
  175. package/dist/core/turns/tool-kind.js +3 -2
  176. package/dist/core/turns/tool-registry.js +1 -0
  177. package/dist/core/turns/tools/tool-meta.d.ts +3 -2
  178. package/dist/core/turns/tools/tool-meta.js +5 -2
  179. package/dist/core/turns/tools/tool-outcome.d.ts +2 -1
  180. package/dist/core/turns/tools/tool-outcome.js +3 -1
  181. package/dist/core/turns/types.d.ts +1 -1
  182. package/dist/core/turns/view-model.js +1 -13
  183. package/dist/core/warm-session-pool.d.ts +29 -0
  184. package/dist/core/warm-session-pool.js +127 -0
  185. package/dist/genui/catalog.d.ts +28 -0
  186. package/dist/genui/catalog.js +396 -0
  187. package/dist/genui/expansion.d.ts +3 -0
  188. package/dist/genui/expansion.js +295 -0
  189. package/dist/genui/fence-entry.d.ts +2 -0
  190. package/dist/genui/fence-entry.js +1 -0
  191. package/dist/genui/fence.d.ts +21 -0
  192. package/dist/genui/fence.js +138 -0
  193. package/dist/genui/index.d.ts +6 -0
  194. package/dist/genui/index.js +6 -0
  195. package/dist/genui/markdown.d.ts +12 -0
  196. package/dist/genui/markdown.js +104 -0
  197. package/dist/genui/parse.d.ts +6 -0
  198. package/dist/genui/parse.js +75 -0
  199. package/dist/genui/prompt.d.ts +2 -0
  200. package/dist/genui/prompt.js +206 -0
  201. package/dist/genui/react/default-components.d.ts +2 -0
  202. package/dist/genui/react/default-components.js +72 -0
  203. package/dist/genui/react/default-components.test.d.ts +1 -0
  204. package/dist/genui/react/default-components.test.js +94 -0
  205. package/dist/genui/react/genui-block-disabled.test.d.ts +1 -0
  206. package/dist/genui/react/genui-block-disabled.test.js +50 -0
  207. package/dist/genui/react/genui-block.d.ts +28 -0
  208. package/dist/genui/react/genui-block.js +91 -0
  209. package/dist/genui/react/genui-block.test.d.ts +1 -0
  210. package/dist/genui/react/genui-block.test.js +205 -0
  211. package/dist/genui/react/index.d.ts +2 -0
  212. package/dist/genui/react/index.js +2 -0
  213. package/dist/genui/share.d.ts +5 -0
  214. package/dist/genui/share.js +30 -0
  215. package/dist/genui/test-fixtures.d.ts +2 -0
  216. package/dist/genui/test-fixtures.js +16 -0
  217. package/dist/genui/types.d.ts +29 -0
  218. package/dist/genui/types.js +1 -0
  219. package/dist/genui/urls.d.ts +1 -0
  220. package/dist/genui/urls.js +18 -0
  221. package/dist/genui/validate.d.ts +9 -0
  222. package/dist/genui/validate.js +116 -0
  223. package/dist/index.d.ts +4 -4
  224. package/dist/index.js +4 -4
  225. package/dist/internal/connector-catalog.d.ts +48 -0
  226. package/dist/internal/connector-catalog.js +27 -0
  227. package/dist/internal/host-configuration.d.ts +22 -0
  228. package/dist/internal/host-configuration.js +28 -0
  229. package/dist/internal/platform-admin-react.d.ts +12 -0
  230. package/dist/internal/platform-admin-react.js +13 -0
  231. package/dist/internal/platform-admin.d.ts +9 -0
  232. package/dist/internal/platform-admin.js +9 -0
  233. package/dist/platform/ui.d.ts +8 -2
  234. package/dist/platform/ui.js +19 -4
  235. package/dist/react/chat/use-chat-turns.d.ts +1 -1
  236. package/dist/react/human-presence.d.ts +9 -0
  237. package/dist/react/human-presence.js +12 -0
  238. package/dist/react/index.d.ts +4 -13
  239. package/dist/react/index.js +4 -13
  240. package/dist/react/opencode.d.ts +1 -0
  241. package/dist/react/opencode.js +1 -0
  242. package/dist/react/query-contracts.d.ts +6 -0
  243. package/dist/react/query-contracts.js +6 -0
  244. package/dist/react/query-keys.d.ts +17 -2
  245. package/dist/react/query-keys.js +24 -2
  246. package/dist/react/reset-identity-state.js +2 -0
  247. package/dist/react/session-cache-write.d.ts +1 -0
  248. package/dist/react/session-cache-write.js +20 -0
  249. package/dist/react/session-transcript-subscription.js +3 -1
  250. package/dist/react/sign-in-with-beeuni.d.ts +6 -6
  251. package/dist/react/turn-end-handoff.d.ts +13 -0
  252. package/dist/react/turn-end-handoff.js +101 -0
  253. package/dist/react/use-admin-providers.d.ts +3 -6
  254. package/dist/react/use-admin-providers.js +1 -11
  255. package/dist/react/use-capture.d.ts +47 -0
  256. package/dist/react/use-capture.js +173 -0
  257. package/dist/react/use-feature-flag.js +1 -0
  258. package/dist/react/use-opencode-events/handle-event.d.ts +1 -0
  259. package/dist/react/use-opencode-events/handle-event.js +5 -0
  260. package/dist/react/use-opencode-events/handle-interaction-event.js +8 -3
  261. package/dist/react/use-opencode-events/handle-session-event.js +13 -8
  262. package/dist/react/use-opencode-events/handler-context.d.ts +1 -0
  263. package/dist/react/use-opencode-events/helpers.d.ts +1 -0
  264. package/dist/react/use-opencode-events/helpers.js +11 -1
  265. package/dist/react/use-opencode-events/index.js +1 -0
  266. package/dist/react/use-opencode-local.d.ts +5 -1
  267. package/dist/react/use-opencode-local.js +15 -2
  268. package/dist/react/use-opencode-sessions/commands.d.ts +11 -1
  269. package/dist/react/use-opencode-sessions/commands.js +21 -1
  270. package/dist/react/use-opencode-sessions/permissions.js +28 -1
  271. package/dist/react/use-project-sessions.d.ts +1 -1
  272. package/dist/react/use-project-sessions.js +6 -5
  273. package/dist/react/use-prompt-attachments.js +1 -0
  274. package/dist/react/use-review-summary.d.ts +13 -0
  275. package/dist/react/use-review-summary.js +32 -0
  276. package/dist/react/use-runtime-reconnect.js +1 -1
  277. package/dist/react/use-session-list-state.d.ts +6 -0
  278. package/dist/react/use-session-list-state.js +33 -0
  279. package/dist/react/use-session-log.d.ts +16 -0
  280. package/dist/react/use-session-log.js +143 -0
  281. package/dist/react/use-session-messages.d.ts +2 -1
  282. package/dist/react/use-session-messages.js +15 -14
  283. package/dist/react/use-session-stream.js +12 -1
  284. package/dist/react/use-session-sync.d.ts +2 -2
  285. package/dist/react/use-session-sync.js +10 -8
  286. package/dist/react/use-session-transcript-history.js +2 -12
  287. package/dist/react/use-session-working.d.ts +2 -0
  288. package/dist/react/use-session-working.js +10 -0
  289. package/dist/react/use-session.d.ts +6 -0
  290. package/dist/react/use-session.js +88 -6
  291. package/package.json +62 -8
@@ -0,0 +1,29 @@
1
+ import { sessionLogTurns, usageCostOf } from './turn.js';
2
+ export function sessionLogThreadMetrics(thread, options = {}) {
3
+ const m = {
4
+ cost: null,
5
+ messages: { all: 0, user: 0, assistant: 0 },
6
+ tokens: { input: 0, output: 0, reasoning: 0, cacheRead: 0, cacheWrite: 0 },
7
+ context: null,
8
+ };
9
+ for (const turn of sessionLogTurns(thread)) {
10
+ const cost = usageCostOf([turn.user, ...turn.assistant], options.pricing);
11
+ if (!cost)
12
+ continue;
13
+ for (const k of Object.keys(m.tokens))
14
+ m.tokens[k] += cost.tokens[k];
15
+ }
16
+ for (const msg of thread.messages) {
17
+ if (msg.role === 'user')
18
+ m.messages.user++;
19
+ else if (msg.role === 'assistant')
20
+ m.messages.assistant++;
21
+ if (msg.kind === 'compaction' && msg.status !== 'streaming')
22
+ m.messages.assistant++;
23
+ const u = msg.usage;
24
+ if ((msg.role === 'assistant' || msg.kind === 'compaction') && u && u.input + u.output + (u.reasoning ?? 0) + u.cache_read + u.cache_write > 0)
25
+ m.context = msg;
26
+ }
27
+ m.messages.all = m.messages.user + m.messages.assistant;
28
+ return m;
29
+ }
@@ -0,0 +1,55 @@
1
+ import type { SessionPrompt } from '../../rest/projects-client/sessions.js';
2
+ import { type GatewayErrorDetails } from '../../turns/errors.js';
3
+ import type { ModelPricingLookup, TurnCostInfo } from '../../turns/types.js';
4
+ import { type AttachmentBlock, type CompactionBlock, type SessionLogBlock, type SessionLogMessage, type SessionLogThread, type TextBlock, type ToolCallBlock } from '../types.js';
5
+ export type SessionLogTurnStatus = 'pending' | SessionLogMessage['status'];
6
+ export type SessionLogCallStatus = ToolCallBlock['status'] | 'interrupted';
7
+ export interface SessionLogTurnError {
8
+ code: string;
9
+ message: string;
10
+ details?: GatewayErrorDetails;
11
+ raw?: string;
12
+ }
13
+ export interface SessionLogCompaction {
14
+ block: CompactionBlock | null;
15
+ hasContent: boolean;
16
+ inFlight: boolean;
17
+ }
18
+ export interface SessionLogContinuation {
19
+ marker: string;
20
+ prompt: string | null;
21
+ }
22
+ export interface SessionLogTurn {
23
+ id: string;
24
+ user: SessionLogMessage;
25
+ assistant: SessionLogMessage[];
26
+ partial: boolean;
27
+ continues: SessionLogContinuation | null;
28
+ blocks: SessionLogBlock[];
29
+ status: SessionLogTurnStatus;
30
+ error: SessionLogTurnError | null;
31
+ cost: TurnCostInfo | null;
32
+ compaction: SessionLogCompaction | null;
33
+ threads: string[];
34
+ plan: boolean;
35
+ shell: ToolCallBlock | null;
36
+ response: TextBlock | null;
37
+ attachments: AttachmentBlock[];
38
+ live: boolean;
39
+ queued: boolean;
40
+ retrying: boolean;
41
+ }
42
+ export interface SessionLogTurnsOptions {
43
+ busy?: boolean;
44
+ liveMessageId?: string | null;
45
+ held?: readonly string[];
46
+ threads?: ReadonlyArray<Pick<SessionLogThread, 'thread_id' | 'spawned_by'>>;
47
+ pricing?: ModelPricingLookup;
48
+ hideOutOfContext?: boolean;
49
+ }
50
+ export declare const isClosedByRule: (b: ToolCallBlock) => boolean;
51
+ export declare function sessionLogCallStatus(call: ToolCallBlock, live: boolean): SessionLogCallStatus;
52
+ export declare function sessionLogPromptMessage(prompt: SessionPrompt, threadId: string): SessionLogMessage;
53
+ export declare function usageCostOf(replies: SessionLogMessage[], lookup?: ModelPricingLookup): TurnCostInfo | null;
54
+ export declare function sessionLogRetrying(thread: Pick<SessionLogThread, 'messages'>): boolean;
55
+ export declare function sessionLogTurns(source: SessionLogThread, options?: SessionLogTurnsOptions): SessionLogTurn[];
@@ -0,0 +1,279 @@
1
+ import { extractGatewayErrorDetails, rawErrorText, unwrapError } from '../../turns/errors.js';
2
+ import { hasRetryingAssistantTurn } from '../../turns/open-turn.js';
3
+ import { getChildSessionId, shouldShowToolPart } from '../../turns/parts.js';
4
+ import { resolveWorkingTurn } from '../../turns/segments/working-turn.js';
5
+ import { getTurnTokens } from '../../turns/state.js';
6
+ import { toolKind } from '../../turns/tool-kind.js';
7
+ import { SESSION_LOG_MINOR, SESSION_LOG_SCHEMA, } from '../types.js';
8
+ import { isV1Thread } from '../v1-view.js';
9
+ import { messageOfBlock, v1RowsOf } from './v1-parts.js';
10
+ const V1_IMPORT = 'beeuni-v1-import';
11
+ function getTurnCost(parts, _lookup) {
12
+ const tokens = getTurnTokens(parts);
13
+ return tokens ? { cost: null, tokens } : undefined;
14
+ }
15
+ const V = { schema: SESSION_LOG_SCHEMA, v: SESSION_LOG_MINOR };
16
+ function last(list, test) {
17
+ for (let i = list.length - 1; i >= 0; i--)
18
+ if (test(list[i]))
19
+ return list[i];
20
+ return undefined;
21
+ }
22
+ const isCall = (b) => b.type === 'tool_call';
23
+ const isOpen = (b) => b.status === 'pending' || b.status === 'running';
24
+ export const isClosedByRule = (b) => b.status === 'error' && (b.result?.synthetic === true || b.result?.error?.code === 'interrupted');
25
+ export function sessionLogCallStatus(call, live) {
26
+ const closed = isClosedByRule(call);
27
+ if (!isOpen(call) && !closed)
28
+ return call.status;
29
+ if (!live)
30
+ return 'interrupted';
31
+ return call.status === 'running' || (closed && call.started_at) ? 'running' : 'pending';
32
+ }
33
+ const prompts = new WeakMap();
34
+ export function sessionLogPromptMessage(prompt, threadId) {
35
+ const cached = prompts.get(prompt);
36
+ if (cached)
37
+ return cached;
38
+ const ms = typeof prompt.client_sent_at_ms === 'number' ? prompt.client_sent_at_ms : Date.parse(prompt.created_at);
39
+ const message = {
40
+ ...V, message_id: prompt.message_id || `queued-${prompt.prompt_id}`, thread_id: threadId, seq: Number.MAX_SAFE_INTEGER, role: 'user', kind: 'turn',
41
+ status: 'complete', in_context: true, origin: 'prompt', model: null, usage: null, finish: null, error: null,
42
+ created_at: Number.isFinite(ms) ? new Date(ms).toISOString() : '', completed_at: null,
43
+ producer: { harness: 'beeuni-inbox', harness_version: '', adapter_version: '1' },
44
+ blocks: [{ type: 'text', id: `syn-${prompt.prompt_id}`, text: prompt.full_text ?? prompt.text }],
45
+ };
46
+ prompts.set(prompt, message);
47
+ return message;
48
+ }
49
+ const standIns = new WeakMap();
50
+ function standInFor(reply) {
51
+ let m = standIns.get(reply);
52
+ if (!m) {
53
+ m = {
54
+ ...V, message_id: reply.reply_to, thread_id: reply.thread_id, seq: reply.seq, role: 'user', kind: 'turn', status: 'complete', in_context: true,
55
+ model: null, usage: null, finish: null, error: null, created_at: reply.created_at, completed_at: null, producer: reply.producer, blocks: [],
56
+ };
57
+ standIns.set(reply, m);
58
+ }
59
+ return m;
60
+ }
61
+ const continuations = new WeakMap();
62
+ function continuationOf(marker) {
63
+ let m = continuations.get(marker);
64
+ if (!m) {
65
+ m = {
66
+ ...V, message_id: `${marker.message_id}:continued`, thread_id: marker.thread_id, seq: marker.seq, role: 'user', kind: 'turn', status: 'complete', in_context: true,
67
+ model: null, usage: null, finish: null, error: null, created_at: marker.created_at, completed_at: null, producer: marker.producer, blocks: [],
68
+ };
69
+ continuations.set(marker, m);
70
+ }
71
+ return m;
72
+ }
73
+ const isEmptyShell = (m) => !m.error && m.blocks.length === 0 && !(m.usage && (m.usage.input || m.usage.output || m.usage.reasoning));
74
+ function drafts(messages, held) {
75
+ const turns = [];
76
+ const byId = new Map();
77
+ for (const m of messages) {
78
+ if (m.role !== 'user' || m.kind === 'context' || byId.has(m.message_id))
79
+ continue;
80
+ const d = { user: m, assistant: [], partial: false };
81
+ byId.set(m.message_id, d);
82
+ turns.push(d);
83
+ }
84
+ const partials = [];
85
+ const leading = [];
86
+ const order = new Map();
87
+ const continued = new Map();
88
+ let last = null;
89
+ let compaction = null;
90
+ for (const m of messages) {
91
+ if (m.role === 'user') {
92
+ const d = byId.get(m.message_id);
93
+ if (d && !held.has(m.message_id)) {
94
+ last = d;
95
+ if (!order.has(d))
96
+ order.set(d, order.size);
97
+ if (d.user.kind === 'compaction')
98
+ compaction = d;
99
+ }
100
+ continue;
101
+ }
102
+ if (m.role !== 'assistant' || isEmptyShell(m))
103
+ continue;
104
+ const named = m.reply_to ? byId.get(m.reply_to) : undefined;
105
+ let home = named ?? last;
106
+ if (compaction && home && (home === compaction || (order.get(home) ?? Infinity) < order.get(compaction))) {
107
+ let next = continued.get(compaction);
108
+ if (!next) {
109
+ next = { user: continuationOf(compaction.user), assistant: [], partial: true, continues: { marker: compaction.user.message_id, prompt: home === compaction ? null : home.user.message_id } };
110
+ continued.set(compaction, next);
111
+ }
112
+ home = next;
113
+ }
114
+ if (home) {
115
+ home.assistant.push(m);
116
+ continue;
117
+ }
118
+ if (!m.reply_to) {
119
+ leading.push(m);
120
+ continue;
121
+ }
122
+ const current = partials[partials.length - 1];
123
+ if (current && current.user.message_id === m.reply_to)
124
+ current.assistant.push(m);
125
+ else
126
+ partials.push({ user: standInFor(m), assistant: [m], partial: true });
127
+ }
128
+ if (leading.length) {
129
+ const first = turns[0] ?? partials[0];
130
+ if (first)
131
+ first.assistant.unshift(...leading);
132
+ else
133
+ turns.push({ user: leading[0], assistant: leading.slice(1), partial: false });
134
+ }
135
+ const shown = turns.filter((t) => !held.has(t.user.message_id)).flatMap((t) => {
136
+ const next = continued.get(t);
137
+ return next ? [t, next] : [t];
138
+ });
139
+ return [...partials, ...shown, ...[...held].flatMap((id) => byId.get(id) ?? [])];
140
+ }
141
+ function continuedHint(list, hint) {
142
+ if (!hint)
143
+ return hint;
144
+ let out = hint;
145
+ for (const d of list) {
146
+ const c = d.continues;
147
+ if (c && (out === c.marker || out === c.prompt || hint === c.prompt))
148
+ out = d.user.message_id;
149
+ }
150
+ return out;
151
+ }
152
+ function errorOf(d) {
153
+ const sources = d.user.kind === 'compaction' ? [d.user, ...d.assistant] : d.assistant;
154
+ const m = sources.find((x) => x.error);
155
+ if (!m?.error)
156
+ return null;
157
+ const error = v1RowsOf(m)[0]?.info?.error ?? m.error.message;
158
+ const details = extractGatewayErrorDetails(error);
159
+ const raw = rawErrorText(error);
160
+ return { code: m.error.code, message: details?.message || unwrapError(error), ...(details && { details }), ...(raw !== undefined && { raw }) };
161
+ }
162
+ function costOf(replies, exact, lookup) {
163
+ if (replies.length && replies.every(exact)) {
164
+ return getTurnCost(replies.flatMap((m) => v1RowsOf(m).flatMap((row) => row.parts.map((part) => ({ part, message: row })))), lookup) ?? null;
165
+ }
166
+ return usageCostOf(replies, lookup);
167
+ }
168
+ export function usageCostOf(replies, lookup) {
169
+ const parts = replies.flatMap((m) => {
170
+ const u = m.usage;
171
+ if (!u)
172
+ return [];
173
+ const part = { type: 'step-finish', cost: u.cost ?? 0, tokens: { input: u.input, output: u.output, reasoning: u.reasoning ?? 0, cache: { read: u.cache_read, write: u.cache_write } } };
174
+ return [{ part, message: { info: { id: m.message_id, role: 'assistant', providerID: m.model?.provider, modelID: m.model?.model }, parts: [part] } }];
175
+ });
176
+ return getTurnCost(parts, lookup) ?? null;
177
+ }
178
+ function compactionOf(user) {
179
+ if (user.kind !== 'compaction')
180
+ return null;
181
+ const block = user.blocks.find((b) => b.type === 'compaction') ?? null;
182
+ return { block, hasContent: !!block?.summary?.trim(), inFlight: user.status === 'streaming' };
183
+ }
184
+ function shellOf(d) {
185
+ const prompt = d.user.blocks;
186
+ if (!prompt.length || !prompt.every((b) => b.type === 'text' && b.synthetic))
187
+ return null;
188
+ const only = d.assistant.length === 1 && d.assistant[0].blocks.length === 1 ? d.assistant[0].blocks[0] : null;
189
+ return only && isCall(only) && only.name === 'bash' ? only : null;
190
+ }
191
+ function threadsOf(d, blocks, heads, known) {
192
+ if (!heads.length)
193
+ return [];
194
+ const replies = new Set(d.assistant.map((m) => m.message_id));
195
+ const out = new Set();
196
+ for (const h of heads)
197
+ if (h.spawned_by && replies.has(h.spawned_by.message_id))
198
+ out.add(h.thread_id);
199
+ for (const b of blocks) {
200
+ const id = b.type === 'subtask' ? b.thread_id : isCall(b) ? getChildSessionId(b) : undefined;
201
+ if (id && known.has(id))
202
+ out.add(id);
203
+ }
204
+ return [...out];
205
+ }
206
+ const writesPlan = (d) => d.assistant.some((m) => m.blocks.some((b) => isCall(b) && toolKind(b.name) === 'todowrite' && shouldShowToolPart(b)));
207
+ const cache = new WeakMap();
208
+ const NONE = [];
209
+ export function sessionLogRetrying(thread) {
210
+ const reply = last(thread.messages, (m) => m.role === 'assistant');
211
+ return !!reply && hasRetryingAssistantTurn(v1RowsOf(reply));
212
+ }
213
+ const inContext = new WeakMap();
214
+ function inContextOnly(thread) {
215
+ let out = inContext.get(thread);
216
+ if (!out) {
217
+ const messages = thread.messages.filter((m) => m.in_context || m.status === 'streaming');
218
+ out = messages.length === thread.messages.length ? thread : { ...thread, messages };
219
+ inContext.set(thread, out);
220
+ }
221
+ return out;
222
+ }
223
+ export function sessionLogTurns(source, options = {}) {
224
+ const thread = options.hideOutOfContext ? inContextOnly(source) : source;
225
+ const held = new Set(options.held ?? NONE);
226
+ const list = drafts(thread.messages, held);
227
+ const lastReply = last(thread.messages, (m) => m.role === 'assistant');
228
+ const retrying = sessionLogRetrying(thread);
229
+ const working = resolveWorkingTurn({
230
+ turns: list.map((d) => ({
231
+ userMessage: { info: { id: d.user.message_id } },
232
+ assistantMessages: d.assistant.map((m) => ({ info: { time: m.status === 'streaming' ? {} : { completed: 1 }, error: m.error ?? undefined } })),
233
+ })),
234
+ hintMessageId: continuedHint(list, options.liveMessageId),
235
+ unrunTurnIds: held,
236
+ });
237
+ const anchor = last(list, writesPlan) ?? list[list.length - 1];
238
+ const v1Thread = isV1Thread(thread);
239
+ const exact = (m) => v1Thread || m.producer.harness === V1_IMPORT;
240
+ const heads = options.threads ?? [];
241
+ const known = new Set(heads.map((h) => h.thread_id));
242
+ return list.map((d) => {
243
+ const live = options.busy === true && working.workingTurnId === d.user.message_id;
244
+ const queued = working.pendingTurnIds.includes(d.user.message_id);
245
+ const retries = retrying && d.assistant.includes(lastReply);
246
+ const key = `${d.partial}|${live}|${queued}|${d === anchor}|${retries}`;
247
+ const prev = cache.get(d.user);
248
+ if (prev && prev.key === key && prev.pricing === options.pricing && prev.heads === options.threads && prev.assistant.length === d.assistant.length && prev.assistant.every((m, i) => m === d.assistant[i]))
249
+ return prev.turn;
250
+ const blocks = d.assistant.flatMap((m) => m.blocks);
251
+ for (const m of d.assistant)
252
+ for (const b of m.blocks)
253
+ messageOfBlock.set(b, m);
254
+ const threads = threadsOf(d, blocks, heads, known);
255
+ const reply = d.assistant[d.assistant.length - 1];
256
+ const turn = {
257
+ id: d.user.message_id,
258
+ user: d.user,
259
+ assistant: d.assistant,
260
+ partial: d.partial,
261
+ continues: d.continues ?? null,
262
+ blocks,
263
+ status: retries ? 'streaming' : reply ? reply.status : d.user.kind === 'compaction' ? d.user.status : 'pending',
264
+ error: errorOf(d),
265
+ cost: costOf([d.user, ...d.assistant], exact, options.pricing),
266
+ compaction: compactionOf(d.user),
267
+ threads,
268
+ plan: d === anchor,
269
+ shell: shellOf(d),
270
+ response: last(blocks, (b) => b.type === 'text' && !!b.text.trim()) ?? null,
271
+ attachments: d.user.blocks.filter((b) => b.type === 'attachment' && (b.mime.startsWith('image/') || b.mime === 'application/pdf')),
272
+ live,
273
+ queued,
274
+ retrying: retries,
275
+ };
276
+ cache.set(d.user, { assistant: d.assistant, key, pricing: options.pricing, heads: options.threads, turn });
277
+ return turn;
278
+ });
279
+ }
@@ -0,0 +1,8 @@
1
+ import type { Part } from '../../runtime/runtime-types.js';
2
+ import { type SessionLogBlock, type SessionLogMessage } from '../types.js';
3
+ import { type V1MessageRow } from '../v1-view.js';
4
+ export declare const messageOfBlock: WeakMap<SessionLogBlock, SessionLogMessage>;
5
+ export declare function partOf(block: SessionLogBlock): Part | undefined;
6
+ export declare const blockOf: (part: object) => SessionLogBlock;
7
+ export declare const partsOf: (list: ReadonlyArray<SessionLogBlock>) => Part[];
8
+ export declare function v1RowsOf(m: SessionLogMessage): V1MessageRow[];
@@ -0,0 +1,43 @@
1
+ import { blockPartOf } from '../tool-call.js';
2
+ import { SESSION_LOG_MINOR, SESSION_LOG_SCHEMA } from '../types.js';
3
+ import { rowsOf } from '../v1-view.js';
4
+ const blocks = new WeakMap();
5
+ export const messageOfBlock = new WeakMap();
6
+ const fallbacks = new WeakMap();
7
+ export function partOf(block) {
8
+ let part;
9
+ const message = messageOfBlock.get(block);
10
+ if (message)
11
+ part = partsById(message).get(block.id);
12
+ if (part)
13
+ return blocks.set(part, block), part;
14
+ if (block.type !== 'harness')
15
+ part = blockPartOf(block);
16
+ else if (typeof block.data?.type === 'string')
17
+ part = block.data;
18
+ else if (block.model_visible && block.fallback_text !== undefined) {
19
+ part = fallbacks.get(block) ?? { id: block.id, type: 'text', text: block.fallback_text, synthetic: true };
20
+ fallbacks.set(block, part);
21
+ }
22
+ if (part)
23
+ blocks.set(part, block);
24
+ return part;
25
+ }
26
+ export const blockOf = (part) => blocks.get(part);
27
+ export const partsOf = (list) => list.flatMap((b) => partOf(b) ?? []);
28
+ const indexes = new WeakMap();
29
+ function partsById(m) {
30
+ let index = indexes.get(m);
31
+ if (!index)
32
+ indexes.set(m, (index = new Map(v1RowsOf(m)[0]?.parts.map((p) => [p.id, p]))));
33
+ return index;
34
+ }
35
+ const heads = new Map();
36
+ export function v1RowsOf(m) {
37
+ let head = heads.get(m.thread_id);
38
+ if (!head) {
39
+ head = { schema: SESSION_LOG_SCHEMA, v: SESSION_LOG_MINOR, thread_id: m.thread_id, parent_thread_id: null, spawned_by: null, agent: null, title: null, created_at: '' };
40
+ heads.set(m.thread_id, head);
41
+ }
42
+ return rowsOf(head, m);
43
+ }
@@ -0,0 +1,264 @@
1
+ export declare const SESSION_LOG_SCHEMA: "beeuni.session/2";
2
+ export declare const SESSION_LOG_MINOR = 1;
3
+ export type SchemaRef = {
4
+ schema: typeof SESSION_LOG_SCHEMA;
5
+ v: number;
6
+ };
7
+ export type Ext = Record<string, {
8
+ version: string;
9
+ native_id?: string;
10
+ data?: unknown;
11
+ }>;
12
+ export type Producer = {
13
+ harness: string;
14
+ harness_version: string;
15
+ adapter_version: string;
16
+ };
17
+ export type ModelRef = {
18
+ provider: string;
19
+ model: string;
20
+ api?: 'anthropic-messages' | 'openai-chat' | 'openai-responses' | (string & {});
21
+ variant?: string;
22
+ reasoning_effort?: string;
23
+ };
24
+ export type Todo = {
25
+ id?: string;
26
+ content: string;
27
+ status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
28
+ priority?: 'high' | 'medium' | 'low';
29
+ };
30
+ export type Pending = {
31
+ id: string;
32
+ thread_id: string;
33
+ call_id?: string;
34
+ payload: unknown;
35
+ asked_at: string;
36
+ };
37
+ export type RestoreGrade = 'native' | 'converted' | 'partial';
38
+ export type GradeCounts = {
39
+ tool_input: number;
40
+ cut_point: number;
41
+ attachment: number;
42
+ };
43
+ export type SessionLog = SchemaRef & {
44
+ session_id: string;
45
+ title: string | null;
46
+ created_at: string;
47
+ restore_grade: RestoreGrade;
48
+ grade_counts?: GradeCounts;
49
+ harness: {
50
+ current: string;
51
+ history: Array<{
52
+ harness: string;
53
+ version: string;
54
+ from_seq: number;
55
+ at: string;
56
+ }>;
57
+ };
58
+ selection: {
59
+ agent: string | null;
60
+ model: ModelRef | null;
61
+ };
62
+ todos: Todo[];
63
+ pending: {
64
+ questions: Pending[];
65
+ permissions: Pending[];
66
+ };
67
+ threads: SessionLogThread[];
68
+ ext?: Ext;
69
+ };
70
+ export type ThreadInteraction = {
71
+ message_id: string;
72
+ call_id: string;
73
+ op: 'spawn' | 'send' | 'wait' | 'close' | 'resume' | 'result';
74
+ };
75
+ export type SessionLogThread = SchemaRef & {
76
+ thread_id: string;
77
+ parent_thread_id: string | null;
78
+ spawned_by: {
79
+ message_id: string;
80
+ call_id: string;
81
+ } | null;
82
+ interactions?: ThreadInteraction[];
83
+ agent: string | null;
84
+ native_agent_id?: string;
85
+ nickname?: string | null;
86
+ title: string | null;
87
+ created_at: string;
88
+ messages: SessionLogMessage[];
89
+ ext?: Ext;
90
+ };
91
+ export type Role = 'user' | 'assistant' | 'system';
92
+ export type SessionLogMessage = SchemaRef & {
93
+ message_id: string;
94
+ thread_id: string;
95
+ seq: number;
96
+ role: Role;
97
+ kind: 'turn' | 'compaction' | 'context';
98
+ status: 'streaming' | 'complete' | 'error' | 'aborted' | 'interrupted';
99
+ in_context: boolean;
100
+ hidden_reason?: 'failed_attempt' | 'aborted' | 'retracted' | 'reverted' | 'superseded';
101
+ origin?: 'prompt' | 'steer' | 'command' | 'automation' | 'subagent' | 'notification';
102
+ agent?: string | null;
103
+ native_agent_id?: string;
104
+ reply_to?: string | null;
105
+ parent_message_id?: string | null;
106
+ model: ModelRef | null;
107
+ usage: Usage | null;
108
+ finish: 'stop' | 'tool_calls' | 'length' | 'error' | 'aborted' | null;
109
+ error: {
110
+ code: string;
111
+ message: string;
112
+ } | null;
113
+ created_at: string;
114
+ completed_at: string | null;
115
+ producer: Producer;
116
+ blocks: SessionLogBlock[];
117
+ context_ref?: string;
118
+ ext?: Ext;
119
+ };
120
+ export type Usage = {
121
+ input: number;
122
+ output: number;
123
+ cache_read: number;
124
+ cache_write: number;
125
+ reasoning?: number;
126
+ cost?: number;
127
+ };
128
+ export type BlockBase = {
129
+ id: string;
130
+ };
131
+ export type SessionLogBlock = TextBlock | ReasoningBlock | AttachmentBlock | ToolCallBlock | CompactionBlock | SubtaskBlock | StepBlock | HarnessBlock;
132
+ export type TextBlock = BlockBase & {
133
+ type: 'text';
134
+ text: string;
135
+ model_text?: string;
136
+ synthetic?: boolean;
137
+ ref?: string;
138
+ bytes?: number;
139
+ ext?: Ext;
140
+ };
141
+ export type ReasoningBlock = BlockBase & {
142
+ type: 'reasoning';
143
+ text: string;
144
+ summary?: string[];
145
+ redacted?: boolean;
146
+ ext?: Ext;
147
+ };
148
+ export type AttachmentBlock = BlockBase & {
149
+ type: 'attachment';
150
+ ref?: string;
151
+ mime: string;
152
+ name?: string;
153
+ label?: string;
154
+ source_path?: string;
155
+ bytes?: number;
156
+ sha256?: string;
157
+ url?: string;
158
+ ext?: Ext;
159
+ };
160
+ export declare const KNOWN_TOOL_KINDS: readonly ["shell", "read", "write", "edit", "patch", "list", "glob", "grep", "web_fetch", "web_search", "todo", "task", "question", "plan", "mcp", "other"];
161
+ export type KnownToolKind = (typeof KNOWN_TOOL_KINDS)[number];
162
+ export type ToolKind = KnownToolKind | (string & {});
163
+ export type ToolResultContent = {
164
+ type: 'text';
165
+ text: string;
166
+ ref?: string;
167
+ bytes?: number;
168
+ } | {
169
+ type: 'attachment';
170
+ ref?: string;
171
+ mime: string;
172
+ sha256?: string;
173
+ url?: string;
174
+ };
175
+ export type ToolCallBlock = BlockBase & {
176
+ type: 'tool_call';
177
+ call_id: string;
178
+ name: string;
179
+ kind: ToolKind;
180
+ input: unknown;
181
+ input_format?: 'json' | 'text';
182
+ status: 'pending' | 'running' | 'complete' | 'error';
183
+ result?: {
184
+ content: ToolResultContent[];
185
+ model_content?: ToolResultContent[];
186
+ is_error: boolean;
187
+ error?: {
188
+ code?: string;
189
+ message: string;
190
+ };
191
+ exit_code?: number;
192
+ synthetic?: boolean;
193
+ cleared_at?: string;
194
+ details?: unknown;
195
+ };
196
+ title?: string;
197
+ started_at?: string;
198
+ ended_at?: string;
199
+ ext?: Ext;
200
+ };
201
+ export type CompactionLayoutEntry = {
202
+ summary: true;
203
+ } | {
204
+ message_id: string;
205
+ text_only?: boolean;
206
+ } | {
207
+ text: string;
208
+ };
209
+ export type CompactionBlock = BlockBase & {
210
+ type: 'compaction';
211
+ summary: string | null;
212
+ opaque?: boolean;
213
+ first_kept_message_id: string | null;
214
+ layout?: CompactionLayoutEntry[];
215
+ tokens_before?: number;
216
+ trigger?: 'auto' | 'manual' | 'overflow' | 'unknown';
217
+ ext?: Ext;
218
+ };
219
+ export type SubtaskBlock = BlockBase & {
220
+ type: 'subtask';
221
+ thread_id: string;
222
+ agent: string;
223
+ description: string;
224
+ call_id?: string;
225
+ call_ids?: string[];
226
+ };
227
+ export type StepBlock = BlockBase & {
228
+ type: 'step';
229
+ phase: 'start' | 'finish';
230
+ ext?: Ext;
231
+ };
232
+ export type HarnessBlock = BlockBase & {
233
+ type: 'harness';
234
+ harness: string;
235
+ kind: string;
236
+ data: unknown;
237
+ model_visible: boolean;
238
+ fallback_text?: string;
239
+ };
240
+ export type CapabilityFeatures = {
241
+ tool_error_channel: boolean;
242
+ attachments: {
243
+ user: string[];
244
+ tool_result: boolean;
245
+ };
246
+ compaction: Array<'summary_first_tail' | 'layout' | 'text_tail' | 'opaque'>;
247
+ subagents: 'none' | 'sync' | 'async';
248
+ todos: boolean;
249
+ reasoning_replay: 'none' | 'same_model' | 'lowers_to_text';
250
+ freeform_tool_input: boolean;
251
+ };
252
+ export type AdapterCapabilities = {
253
+ harness: string;
254
+ harness_versions: string;
255
+ schema_minors: number[];
256
+ dialects: Array<NonNullable<ModelRef['api']>>;
257
+ native: CapabilityFeatures;
258
+ rendered: CapabilityFeatures;
259
+ };
260
+ export type ExportCursor = {
261
+ thread_id: string;
262
+ last_seq: number;
263
+ native_hashes: Record<string, string>;
264
+ };
@@ -0,0 +1,6 @@
1
+ export const SESSION_LOG_SCHEMA = 'beeuni.session/2';
2
+ export const SESSION_LOG_MINOR = 1;
3
+ export const KNOWN_TOOL_KINDS = [
4
+ 'shell', 'read', 'write', 'edit', 'patch', 'list', 'glob', 'grep',
5
+ 'web_fetch', 'web_search', 'todo', 'task', 'question', 'plan', 'mcp', 'other',
6
+ ];