cc-viewer 1.7.23 → 1.8.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 (237) hide show
  1. package/README.md +19 -0
  2. package/cli.js +92 -11
  3. package/concepts/ar/GlobalSettings.md +2 -2
  4. package/concepts/da/GlobalSettings.md +2 -2
  5. package/concepts/de/GlobalSettings.md +2 -2
  6. package/concepts/en/GlobalSettings.md +2 -2
  7. package/concepts/es/GlobalSettings.md +2 -2
  8. package/concepts/fr/GlobalSettings.md +2 -2
  9. package/concepts/it/GlobalSettings.md +2 -2
  10. package/concepts/ja/GlobalSettings.md +2 -2
  11. package/concepts/ko/GlobalSettings.md +2 -2
  12. package/concepts/no/GlobalSettings.md +2 -2
  13. package/concepts/pl/GlobalSettings.md +2 -2
  14. package/concepts/pt-BR/GlobalSettings.md +2 -2
  15. package/concepts/ru/GlobalSettings.md +2 -2
  16. package/concepts/th/GlobalSettings.md +2 -2
  17. package/concepts/tr/GlobalSettings.md +2 -2
  18. package/concepts/uk/GlobalSettings.md +2 -2
  19. package/concepts/zh/GlobalSettings.md +2 -2
  20. package/concepts/zh-TW/GlobalSettings.md +2 -2
  21. package/dist/assets/{App-CusqoEAB.js → App-CCu0y2Cq.js} +2 -2
  22. package/dist/assets/{MdxEditorPanel-e5DlfcqJ.js → MdxEditorPanel-BBhgTmDk.js} +1 -1
  23. package/dist/assets/{Mobile-B8xwCLgr.js → Mobile-vN4lyiaz.js} +1 -1
  24. package/dist/assets/{ProxyStatsModal-_w677xPM.js → ProxyStatsModal-BOflqr0R.js} +1 -1
  25. package/dist/assets/index-C3BRHDVF.js +2 -0
  26. package/dist/assets/seqResourceLoaders-DI0G5nu1.css +41 -0
  27. package/dist/assets/seqResourceLoaders-DpYqp6SP.js +2 -0
  28. package/dist/index.html +1 -1
  29. package/findcc.js +17 -8
  30. package/node_modules/@ccv/core/package.json +13 -0
  31. package/{server/lib → node_modules/@ccv/core/src}/approval-modal-prefs.js +1 -1
  32. package/node_modules/@ccv/core/src/clearCheckpoint.js +7 -0
  33. package/{src/utils → node_modules/@ccv/core/src}/contentFilter.js +207 -141
  34. package/{server/lib → node_modules/@ccv/core/src}/context-rules.js +2 -2
  35. package/{server/lib → node_modules/@ccv/core/src}/delta-reconstructor.js +60 -4
  36. package/{server/lib → node_modules/@ccv/core/src}/error-report.js +5 -4
  37. package/{server/lib → node_modules/@ccv/core/src}/session-boundary.js +3 -3
  38. package/{src/utils → node_modules/@ccv/core/src}/teammateDetector.js +9 -0
  39. package/{server/lib → node_modules/@ccv/core/src}/tools-xml-formatter.js +3 -3
  40. package/{server/lib → node_modules/@ccv/core/src}/v2-transcript-normalizer.js +1 -1
  41. package/{server/lib → node_modules/@ccv/core/src}/voice-pack-events.js +2 -2
  42. package/package.json +11 -97
  43. package/server/_paths.js +28 -7
  44. package/server/i18n.js +60 -0
  45. package/server/interceptor.js +36 -11
  46. package/server/lib/adapters/dingtalk-adapter.js +2 -2
  47. package/server/lib/adapters/discord-adapter.js +2 -2
  48. package/server/lib/adapters/feishu-adapter.js +2 -2
  49. package/server/lib/adapters/wecom-adapter.js +2 -2
  50. package/server/lib/approval-policy.js +29 -0
  51. package/server/lib/{ask-store.js → ask/ask-store.js} +3 -3
  52. package/server/lib/{perm-bridge.js → ask/perm-bridge.js} +5 -5
  53. package/server/lib/chat-queue.js +341 -0
  54. package/server/lib/cli-inject.js +1 -1
  55. package/server/lib/context-watcher.js +3 -3
  56. package/server/lib/create_system_prompt.js +0 -9
  57. package/server/lib/enrich-plan-input.js +1 -1
  58. package/server/lib/ensure-hooks.js +2 -2
  59. package/server/lib/file-access-policy.js +6 -1
  60. package/server/lib/file-api.js +17 -1
  61. package/server/lib/{dingtalk-bridge.js → im/dingtalk-bridge.js} +1 -1
  62. package/server/lib/{im-append-system.js → im/im-append-system.js} +5 -13
  63. package/server/lib/{im-bridge-core.js → im/im-bridge-core.js} +12 -6
  64. package/server/lib/{im-config.js → im/im-config.js} +1 -1
  65. package/server/lib/im/im-deny.js +4 -0
  66. package/server/lib/{im-lang.js → im/im-lang.js} +1 -1
  67. package/server/lib/{im-lock.js → im/im-lock.js} +2 -2
  68. package/server/lib/{im-process-manager.js → im/im-process-manager.js} +1 -1
  69. package/server/lib/{im-senders.js → im/im-senders.js} +1 -1
  70. package/server/lib/{im-skills.js → im/im-skills.js} +2 -2
  71. package/server/lib/interceptor-core.js +8 -5
  72. package/server/lib/kv-cache-analyzer.js +6 -5
  73. package/server/lib/launch-config.js +321 -0
  74. package/server/lib/log-file-utils.js +21 -0
  75. package/server/lib/log-management.js +6 -17
  76. package/server/lib/log-stream.js +1 -1
  77. package/server/lib/log-watcher.js +1 -1
  78. package/server/lib/model-system-prompts.js +1 -1
  79. package/server/lib/prefs-store.js +2 -2
  80. package/server/lib/project-prefs.js +6 -6
  81. package/server/lib/project-state.js +15 -0
  82. package/server/lib/{proxy-retry.js → proxy/proxy-retry.js} +2 -2
  83. package/server/lib/{proxy-stats.js → proxy/proxy-stats.js} +3 -3
  84. package/server/lib/sdk-adapter.js +6 -74
  85. package/server/lib/sdk-manager.js +383 -278
  86. package/server/lib/skills-api.js +1 -1
  87. package/server/lib/spawn-model-resolver.js +21 -6
  88. package/server/lib/stats-worker.js +2 -2
  89. package/server/lib/system-prompt-files.js +11 -10
  90. package/server/lib/system-prompt-render.js +23 -7
  91. package/server/lib/system-prompt-snapshots.js +452 -0
  92. package/server/lib/updater.js +63 -3
  93. package/server/lib/user-prompt-extract.js +5 -5
  94. package/server/lib/v2/adapter.js +3 -3
  95. package/server/lib/v2/conversation-store.js +1 -1
  96. package/server/lib/v2/convert.js +3 -3
  97. package/server/lib/v2/jsonl-read.js +1 -1
  98. package/server/lib/v2/live-feed.js +3 -3
  99. package/server/lib/v2/meta-rows.js +3 -3
  100. package/server/lib/v2/replay.js +1 -1
  101. package/server/lib/v2/session-list.js +1 -1
  102. package/server/lib/v2/session-owner.js +1 -1
  103. package/server/lib/v2/v2-writer.js +26 -1
  104. package/server/lib/v2/verify.js +1 -1
  105. package/server/lib/voice-pack-manager.js +4 -5
  106. package/server/lib/wire-compress.js +1 -1
  107. package/server/proxy.js +5 -5
  108. package/server/pty-manager.js +282 -184
  109. package/server/routes/ask-perm.js +1 -1
  110. package/server/routes/dingtalk.js +3 -3
  111. package/server/routes/events.js +2 -2
  112. package/server/routes/im.js +5 -5
  113. package/server/routes/preferences.js +3 -3
  114. package/server/routes/workspaces.js +1 -1
  115. package/server/server.js +207 -58
  116. package/server/system-prompt-templates/systemPromptModel.md +0 -8
  117. package/server/system-prompt-templates/systemPromptVariables.ar.md +0 -7
  118. package/server/system-prompt-templates/systemPromptVariables.da.md +0 -7
  119. package/server/system-prompt-templates/systemPromptVariables.de.md +0 -7
  120. package/server/system-prompt-templates/systemPromptVariables.es.md +0 -7
  121. package/server/system-prompt-templates/systemPromptVariables.fr.md +0 -7
  122. package/server/system-prompt-templates/systemPromptVariables.it.md +0 -7
  123. package/server/system-prompt-templates/systemPromptVariables.ja.md +0 -7
  124. package/server/system-prompt-templates/systemPromptVariables.ko.md +0 -7
  125. package/server/system-prompt-templates/systemPromptVariables.md +0 -7
  126. package/server/system-prompt-templates/systemPromptVariables.no.md +0 -7
  127. package/server/system-prompt-templates/systemPromptVariables.pl.md +0 -7
  128. package/server/system-prompt-templates/systemPromptVariables.pt-BR.md +0 -7
  129. package/server/system-prompt-templates/systemPromptVariables.ru.md +0 -7
  130. package/server/system-prompt-templates/systemPromptVariables.th.md +0 -7
  131. package/server/system-prompt-templates/systemPromptVariables.tr.md +0 -7
  132. package/server/system-prompt-templates/systemPromptVariables.uk.md +0 -7
  133. package/server/system-prompt-templates/systemPromptVariables.zh-TW.md +0 -7
  134. package/server/system-prompt-templates/systemPromptVariables.zh.md +0 -7
  135. package/dist/assets/index-D6FmFsIz.js +0 -2
  136. package/dist/assets/seqResourceLoaders-3K77Znll.js +0 -2
  137. package/dist/assets/seqResourceLoaders-BgD_Rwvc.css +0 -41
  138. package/src/utils/apiUrl.js +0 -26
  139. package/src/utils/askFallback.js +0 -21
  140. package/src/utils/askOptionDesc.js +0 -55
  141. package/src/utils/askPortalMatcher.js +0 -54
  142. package/src/utils/autoApproveOptions.js +0 -27
  143. package/src/utils/avatarAnimationPostPass.js +0 -49
  144. package/src/utils/builtinPresets.js +0 -18
  145. package/src/utils/clearCheckpoint.js +0 -7
  146. package/src/utils/commandValidator.js +0 -45
  147. package/src/utils/contextRaw.js +0 -18
  148. package/src/utils/contextSidebarNavigation.js +0 -16
  149. package/src/utils/contextTurns.js +0 -117
  150. package/src/utils/displayScaleHelper.js +0 -47
  151. package/src/utils/effectiveModel.js +0 -17
  152. package/src/utils/entry-slim.js +0 -563
  153. package/src/utils/entryCache.js +0 -144
  154. package/src/utils/errorReport.js +0 -6
  155. package/src/utils/fileExpandedPathsStorage.js +0 -70
  156. package/src/utils/fileIcons.jsx +0 -36
  157. package/src/utils/fileOpen.js +0 -37
  158. package/src/utils/formatters.js +0 -48
  159. package/src/utils/gitApi.js +0 -50
  160. package/src/utils/gitTreeBuilder.js +0 -19
  161. package/src/utils/helpers.js +0 -854
  162. package/src/utils/identityHeal.js +0 -108
  163. package/src/utils/imConnState.js +0 -59
  164. package/src/utils/imOrigin.js +0 -24
  165. package/src/utils/imTr.js +0 -7
  166. package/src/utils/imageCompress.js +0 -83
  167. package/src/utils/imageDownscale.js +0 -28
  168. package/src/utils/imageResize.js +0 -112
  169. package/src/utils/ingestPipeline.js +0 -47
  170. package/src/utils/isProxyMode.js +0 -11
  171. package/src/utils/lazyWithReload.js +0 -53
  172. package/src/utils/markdown.js +0 -30
  173. package/src/utils/markdownIncremental.js +0 -39
  174. package/src/utils/markdownProfiler.js +0 -113
  175. package/src/utils/mdExtensionDetect.js +0 -64
  176. package/src/utils/memoryLinkParser.js +0 -44
  177. package/src/utils/modalMask.js +0 -15
  178. package/src/utils/modelSuggestions.js +0 -48
  179. package/src/utils/monotime.js +0 -6
  180. package/src/utils/pinnedMenu.js +0 -55
  181. package/src/utils/presetShortcuts.js +0 -14
  182. package/src/utils/projectAlias.js +0 -135
  183. package/src/utils/promptClassifier.js +0 -112
  184. package/src/utils/promptDetect.js +0 -196
  185. package/src/utils/promptNav.js +0 -60
  186. package/src/utils/ptyChunkBuilder.js +0 -251
  187. package/src/utils/quickMenuHoverIntent.js +0 -35
  188. package/src/utils/rateLimitParser.js +0 -119
  189. package/src/utils/readResultPool.js +0 -106
  190. package/src/utils/refreshCachedItemProp.js +0 -30
  191. package/src/utils/resizeCalc.js +0 -21
  192. package/src/utils/resolveLocalized.js +0 -17
  193. package/src/utils/searchApi.js +0 -47
  194. package/src/utils/searchReplace.js +0 -51
  195. package/src/utils/seqResourceLoaders.js +0 -79
  196. package/src/utils/sessionManager.js +0 -482
  197. package/src/utils/sessionMerge.js +0 -239
  198. package/src/utils/skillModalController.js +0 -111
  199. package/src/utils/skillsParser.js +0 -116
  200. package/src/utils/slashCommandLabels.js +0 -80
  201. package/src/utils/splitDragCalc.js +0 -73
  202. package/src/utils/stickyBottomController.js +0 -643
  203. package/src/utils/svgSanitize.js +0 -48
  204. package/src/utils/systemTags.js +0 -47
  205. package/src/utils/tClaude.js +0 -20
  206. package/src/utils/teamModalBuilder.js +0 -351
  207. package/src/utils/teamSessionParser.js +0 -190
  208. package/src/utils/teammateAvatars.js +0 -194
  209. package/src/utils/termDiag.js +0 -114
  210. package/src/utils/terminalClipboard.js +0 -117
  211. package/src/utils/terminalWriteQueue.js +0 -398
  212. package/src/utils/thinkingMerge.js +0 -49
  213. package/src/utils/toolCatalog.js +0 -30
  214. package/src/utils/toolResultBuilder.js +0 -411
  215. package/src/utils/toolResultClassifier.js +0 -16
  216. package/src/utils/toolResultCore.js +0 -194
  217. package/src/utils/toolsDiff.js +0 -44
  218. package/src/utils/toolsXmlFormatter.js +0 -3
  219. package/src/utils/ultraplanController.js +0 -109
  220. package/src/utils/ultraplanExperts.js +0 -86
  221. package/src/utils/ultraplanTemplates.js +0 -154
  222. package/src/utils/userImageRefs.js +0 -49
  223. package/src/utils/v3Assembler.js +0 -125
  224. package/src/utils/v3Rows.js +0 -49
  225. package/src/utils/voicePackPlayer.js +0 -233
  226. package/src/utils/webSearchGrouping.js +0 -111
  227. package/src/utils/workflowFormat.js +0 -52
  228. package/src/utils/workflowRuns.js +0 -118
  229. package/src/utils/workflowStore.js +0 -94
  230. /package/{src/utils → node_modules/@ccv/core/src}/requestType.js +0 -0
  231. /package/server/lib/{ask-bridge.js → ask/ask-bridge.js} +0 -0
  232. /package/server/lib/{ask-constants.js → ask/ask-constants.js} +0 -0
  233. /package/server/lib/{ask-reaper.js → ask/ask-reaper.js} +0 -0
  234. /package/server/lib/{dingtalk-config.js → im/dingtalk-config.js} +0 -0
  235. /package/server/lib/{im-log-watcher.js → im/im-log-watcher.js} +0 -0
  236. /package/server/lib/{proxy-env.js → proxy/proxy-env.js} +0 -0
  237. /package/server/lib/{proxy-errors.js → proxy/proxy-errors.js} +0 -0
@@ -3,7 +3,7 @@
3
3
  // preferences.json holds UI prefs AND the (base64) LAN password (auth) AND per-project
4
4
  // forks (prefsByProject). Multiple writers touch it — the global POST /api/preferences,
5
5
  // lib/auth.js, and the new project-prefs routes — so every write here goes through ONE
6
- // async file lock + atomic tmp→rename, mirroring server/lib/ask-store.js. Same-process
6
+ // async file lock + atomic tmp→rename, mirroring server/lib/ask/ask-store.js. Same-process
7
7
  // callers serialize via withFileLockAsync's per-lockPath Promise chain; cross-process
8
8
  // callers mutex on the lock file. This prevents a concurrent writer from clobbering the
9
9
  // password-bearing file or losing a fork update.
@@ -12,7 +12,7 @@ import { join, dirname } from 'node:path';
12
12
  import { randomBytes } from 'node:crypto';
13
13
  import { renameSyncWithRetry } from './file-api.js';
14
14
  import { withFileLockAsync } from './async-file-lock.js';
15
- import { mergeApprovalModalPrefs } from './approval-modal-prefs.js';
15
+ import { mergeApprovalModalPrefs } from '@ccv/core/approval-modal-prefs';
16
16
  import { reconcileVoicePackPrefs } from './voice-pack-manager.js';
17
17
  import { LOG_DIR } from '../../findcc.js';
18
18
 
@@ -9,9 +9,9 @@
9
9
  // A project "has a fork" iff a key exists for it (hasOwnProperty). Removing a fork
10
10
  // (toggle off) deletes the key so the project inherits global again.
11
11
  import { basename } from 'node:path';
12
- import { mergeApprovalModalPrefs } from './approval-modal-prefs.js';
13
- import { listPlatforms } from './im-config.js';
14
- import { _projectName } from '../interceptor.js';
12
+ import { mergeApprovalModalPrefs } from '@ccv/core/approval-modal-prefs';
13
+ import { listPlatforms } from './im/im-config.js';
14
+ import { getProjectName } from './project-state.js';
15
15
 
16
16
  // SINGLE SOURCE of "what must never live inside a fork": secrets (auth password + IM creds),
17
17
  // machine-level paths (logDir/claudeConfigDir), and the internal forks map. snapshotForFork /
@@ -33,17 +33,17 @@ export function getCurrentProjectKey() {
33
33
 
34
34
  /** Human-readable project name for display (interceptor's sanitized basename). */
35
35
  export function getCurrentProjectName() {
36
- return _projectName || basename(getCurrentProjectKey());
36
+ return getProjectName() || basename(getCurrentProjectKey());
37
37
  }
38
38
 
39
39
  /**
40
40
  * Whether the server is currently serving a concrete project. In workspace mode the
41
- * project is unknown until a workspace is launched (interceptor _projectName / env are
41
+ * project is unknown until a workspace is launched (project-state name / env are
42
42
  * empty) — refuse to fork under the server's own cwd in that window.
43
43
  */
44
44
  export function hasActiveProject() {
45
45
  if (process.env.CCV_WORKSPACE_MODE === '1') {
46
- return !!(process.env.CCV_PROJECT_DIR || _projectName);
46
+ return !!(process.env.CCV_PROJECT_DIR || getProjectName());
47
47
  }
48
48
  return true;
49
49
  }
@@ -0,0 +1,15 @@
1
+ // Mutable "current project name" state — shared leaf (same pattern as findcc's
2
+ // LOG_DIR). server/interceptor.js owns the value and pushes it at every rebind
3
+ // (module init, initForWorkspace, resetWorkspace); lib readers such as
4
+ // project-prefs.js must not import the interceptor (a stateful L2 module), so
5
+ // they read through this leaf instead.
6
+
7
+ let _currentProjectName = '';
8
+
9
+ export function getProjectName() {
10
+ return _currentProjectName;
11
+ }
12
+
13
+ export function setProjectName(name) {
14
+ _currentProjectName = typeof name === 'string' ? name : '';
15
+ }
@@ -15,9 +15,9 @@
15
15
  // - Streaming responses: only read status + headers to decide whether to retry; never retry after the body has
16
16
  // started being sent (retry-before-first-byte strategy).
17
17
  // - race/stagger use AbortController; cancelled requests must be released correctly.
18
- import { resolveProfileModel } from './interceptor-core.js';
18
+ import { resolveProfileModel } from '../interceptor-core.js';
19
19
  import { readFileSync, existsSync } from 'node:fs';
20
- import { reportSwallowed } from './error-report.js';
20
+ import { reportSwallowed } from '@ccv/core/error-report';
21
21
 
22
22
  // ── Configuration ─────────────────────────────────────────────────
23
23
 
@@ -8,8 +8,8 @@
8
8
  // - Fully separated from cc-viewer's existing session logs (*.jsonl written by interceptor), no cross-contamination.
9
9
  import { mkdirSync } from 'node:fs';
10
10
  import { join } from 'node:path';
11
- import { AsyncWriteQueue } from './async-write-queue.js';
12
- import { reportSwallowed } from './error-report.js';
11
+ import { AsyncWriteQueue } from '../async-write-queue.js';
12
+ import { reportSwallowed } from '@ccv/core/error-report';
13
13
 
14
14
  // ── Detail record schema ──────────────────────────────────────────────
15
15
  // Appends one JSON line after each proxied LLM API request completes. Fields align with llm-retry-proxy's retry records.
@@ -136,7 +136,7 @@ export function flushRecords() {
136
136
  }
137
137
 
138
138
  // ── Stats-update notifier (dependency inversion, review P2) ────────────────
139
- // proxy.js used to dynamically import('./server.js') to reach the statsWorker
139
+ // proxy.js used to dynamically import('../server.js') to reach the statsWorker
140
140
  // singleton — if a future proxy-only process did that first, server.js's
141
141
  // module-load side effects would boot a second viewer. The owner (server.js)
142
142
  // now registers its notify callback here at load time; proxy.js just emits.
@@ -1,81 +1,13 @@
1
1
  /**
2
- * sdk-adapter.js — Convert Agent SDK messages to JSONL entry format.
2
+ * sdk-adapter.js — SDK-mode approval helpers.
3
3
  *
4
- * The frontend expects entries shaped like intercepted Claude API request/response pairs.
5
- * This adapter converts SDKAssistantMessage objects into that format so the
6
- * existing SSE pipeline and ChatView rendering work unchanged.
4
+ * NOTE: SDK-mode display entries are no longer synthesized here. The SDK child
5
+ * process talks to the API through cc-viewer's loopback proxy, so entries reach
6
+ * the frontend via the same wire path as PTY mode (fetch hook → V2Writer →
7
+ * live-feed → SSE). Only the approval-close mapping below remains in use
8
+ * (server.js interruptTurn fan-out).
7
9
  */
8
10
 
9
- // Minimal tool stubs — only used as fallback if SDK doesn't provide real tools
10
- const STUB_TOOLS = [
11
- { name: 'Bash' }, { name: 'Edit' }, { name: 'Read' },
12
- { name: 'Write' }, { name: 'Glob' }, { name: 'Agent' },
13
- ];
14
-
15
- /**
16
- * Convert an SDK assistant message + accumulated conversation into a JSONL entry.
17
- *
18
- * @param {object} assistantMsg — SDKAssistantMessage (has .message: BetaMessage)
19
- * @param {Array} messages — Accumulated conversation messages [{role, content}]
20
- * @param {string} model — Model name
21
- * @param {string} projectName — Project name
22
- * @param {object} [opts] — Additional options
23
- * @param {string} [opts.timestamp] — Stable timestamp for dedup (same per turn)
24
- * @param {boolean} [opts.inProgress] — Whether response is still streaming
25
- * @param {string} [opts.requestId] — Request ID for in-progress entries
26
- * @param {Array} [opts.tools] — Real tools list from SDK init message
27
- * @returns {object} JSONL entry compatible with frontend expectations
28
- */
29
- export function sdkToJSONLEntry(assistantMsg, messages, model, projectName, opts = {}) {
30
- const respBody = assistantMsg?.message || null;
31
- const entry = {
32
- timestamp: opts.timestamp || new Date().toISOString(),
33
- project: projectName || 'sdk',
34
- url: 'https://api.anthropic.com/v1/messages?beta=true',
35
- method: 'POST',
36
- headers: {},
37
- body: {
38
- model: model || respBody?.model || 'claude-opus-4-6',
39
- system: [{ type: 'text', text: 'You are Claude Code' }],
40
- tools: opts.tools || STUB_TOOLS,
41
- messages: messages || [],
42
- metadata: {},
43
- },
44
- response: opts.inProgress ? null : {
45
- status: 200,
46
- statusText: 'OK',
47
- headers: {},
48
- body: respBody,
49
- },
50
- duration: 0,
51
- isStream: false,
52
- mainAgent: true,
53
- };
54
-
55
- if (opts.inProgress) {
56
- entry.inProgress = true;
57
- entry.requestId = opts.requestId || `sdk_${Date.now()}`;
58
- }
59
-
60
- return entry;
61
- }
62
-
63
- /**
64
- * Build a streaming status event payload.
65
- */
66
- export function buildStreamingStatus(active, meta = {}) {
67
- if (active) {
68
- return {
69
- active: true,
70
- model: meta.model || null,
71
- startTime: meta.startTime || Date.now(),
72
- bytesReceived: 0,
73
- chunksReceived: 0,
74
- };
75
- }
76
- return { active: false };
77
- }
78
-
79
11
  /**
80
12
  * Map an SDK approval `kind` to the WS broadcast message type that closes that
81
13
  * kind's modal on every client. Used when interruptTurn() drains pending approvals