cc-viewer 1.9.19 → 1.9.21

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 (72) hide show
  1. package/concepts/ar/CustomUltraplanExpert.md +1 -1
  2. package/concepts/ar/Teammate.md +1 -1
  3. package/concepts/ar/UltraPlan.md +4 -4
  4. package/concepts/da/CustomUltraplanExpert.md +1 -1
  5. package/concepts/da/Teammate.md +1 -1
  6. package/concepts/da/UltraPlan.md +4 -4
  7. package/concepts/de/CustomUltraplanExpert.md +1 -1
  8. package/concepts/de/Teammate.md +1 -1
  9. package/concepts/de/UltraPlan.md +4 -4
  10. package/concepts/en/CustomUltraplanExpert.md +1 -1
  11. package/concepts/en/Teammate.md +1 -1
  12. package/concepts/en/UltraPlan.md +4 -4
  13. package/concepts/es/CustomUltraplanExpert.md +1 -1
  14. package/concepts/es/Teammate.md +1 -1
  15. package/concepts/es/UltraPlan.md +4 -4
  16. package/concepts/fr/CustomUltraplanExpert.md +1 -1
  17. package/concepts/fr/Teammate.md +1 -1
  18. package/concepts/fr/UltraPlan.md +4 -4
  19. package/concepts/it/CustomUltraplanExpert.md +1 -1
  20. package/concepts/it/Teammate.md +1 -1
  21. package/concepts/it/UltraPlan.md +4 -4
  22. package/concepts/ja/CustomUltraplanExpert.md +1 -1
  23. package/concepts/ja/Teammate.md +1 -1
  24. package/concepts/ja/UltraPlan.md +4 -4
  25. package/concepts/ko/CustomUltraplanExpert.md +1 -1
  26. package/concepts/ko/Teammate.md +1 -1
  27. package/concepts/ko/UltraPlan.md +4 -4
  28. package/concepts/no/CustomUltraplanExpert.md +1 -1
  29. package/concepts/no/Teammate.md +1 -1
  30. package/concepts/no/UltraPlan.md +4 -4
  31. package/concepts/pl/CustomUltraplanExpert.md +1 -1
  32. package/concepts/pl/Teammate.md +1 -1
  33. package/concepts/pl/UltraPlan.md +4 -4
  34. package/concepts/pt-BR/CustomUltraplanExpert.md +1 -1
  35. package/concepts/pt-BR/Teammate.md +1 -1
  36. package/concepts/pt-BR/UltraPlan.md +4 -4
  37. package/concepts/ru/CustomUltraplanExpert.md +1 -1
  38. package/concepts/ru/Teammate.md +1 -1
  39. package/concepts/ru/UltraPlan.md +4 -4
  40. package/concepts/th/CustomUltraplanExpert.md +1 -1
  41. package/concepts/th/Teammate.md +1 -1
  42. package/concepts/th/UltraPlan.md +4 -4
  43. package/concepts/tr/CustomUltraplanExpert.md +1 -1
  44. package/concepts/tr/Teammate.md +1 -1
  45. package/concepts/tr/UltraPlan.md +4 -4
  46. package/concepts/uk/CustomUltraplanExpert.md +1 -1
  47. package/concepts/uk/Teammate.md +1 -1
  48. package/concepts/uk/UltraPlan.md +4 -4
  49. package/concepts/zh/CustomUltraplanExpert.md +1 -1
  50. package/concepts/zh/Teammate.md +1 -1
  51. package/concepts/zh/UltraPlan.md +4 -4
  52. package/concepts/zh/ultraplan-origin.md +24 -22
  53. package/concepts/zh-TW/CustomUltraplanExpert.md +1 -1
  54. package/concepts/zh-TW/Teammate.md +1 -1
  55. package/concepts/zh-TW/UltraPlan.md +4 -4
  56. package/dist/assets/{App-5GFhfhAM.js → App-C4f2Dpy9.js} +2 -2
  57. package/dist/assets/{MdxEditorPanel-C71H-8ZP.js → MdxEditorPanel-D7aQDQJp.js} +1 -1
  58. package/dist/assets/{Mobile-CAqle3TP.js → Mobile-D9ekLQFS.js} +1 -1
  59. package/dist/assets/{ProxyStatsModal-B0ySgEsq.js → ProxyStatsModal-CWpgyVKI.js} +1 -1
  60. package/dist/assets/index-CocpEURl.js +2 -0
  61. package/dist/assets/seqResourceLoaders-BhiCEaUt.js +2 -0
  62. package/dist/assets/seqResourceLoaders-DbccWwKz.css +41 -0
  63. package/dist/index.html +1 -1
  64. package/package.json +1 -1
  65. package/server/lib/proxy/proxy-stats.js +26 -0
  66. package/server/lib/v2/meta-rows.js +28 -18
  67. package/server/proxy.js +120 -18
  68. package/server/server.js +46 -1
  69. package/ultraAgents/code-expert.json +1 -1
  70. package/dist/assets/index-C4_-ImaE.js +0 -2
  71. package/dist/assets/seqResourceLoaders-C8O3LxzJ.css +0 -41
  72. package/dist/assets/seqResourceLoaders-CXYXv_fq.js +0 -2
@@ -158,6 +158,32 @@ export function emitProxyStatsUpdate(fileName) {
158
158
  }
159
159
  }
160
160
 
161
+ // ── Slow-upstream listener (sdk-slow-upstream) ──────────────────────────────
162
+ // proxy.js must not import sdk-manager: a proxy-only process (ccv run / PTY)
163
+ // has no SDK loaded, and sdk-manager's top-level `await import('@anthropic-ai/
164
+ // claude-agent-sdk')` would pull the SDK into it. Same registration pattern as
165
+ // the stats listener above: server.js (which already legally holds both
166
+ // sdk-manager and the terminal WS) registers a callback here at load time;
167
+ // proxy.js emits a { cwd, instanceKey, waitingMs, model } signal when a
168
+ // non-utility LLM request has been waiting past the slow threshold. The cwd /
169
+ // instanceKey come from the request's own self-report headers (request-level
170
+ // truth), not the process-wide bound project. No listener (proxy-only process)
171
+ // → no-op.
172
+ let _slowUpstreamListener = null;
173
+
174
+ export function setSlowUpstreamListener(fn) {
175
+ _slowUpstreamListener = typeof fn === 'function' ? fn : null;
176
+ }
177
+
178
+ export function emitSlowUpstream(info) {
179
+ if (!_slowUpstreamListener) return;
180
+ try {
181
+ _slowUpstreamListener(info);
182
+ } catch (err) {
183
+ reportSwallowed('proxyStats.slow-upstream-emit', err);
184
+ }
185
+ }
186
+
161
187
  // ── Aggregate computation ──────────────────────────────────────────────────────
162
188
 
163
189
  /**
@@ -266,13 +266,29 @@ export async function readV2NativeCold(sessionDir, rows) {
266
266
  catch (err) { reportSwallowed('v2-native.conv-read-failed', err); }
267
267
  await yieldLoop(); // one yield per conv file read (error path included)
268
268
  }
269
- // last snapshot at-or-before the window start for this session
269
+ // Single pass over the conv raws: pick the last snapshot at-or-before the
270
+ // window start AND collect the coverage seqs of every line at-or-past it.
271
+ // A separate coverage loop used to re-parse every window line with no
272
+ // event-loop yield, right after this scan had already parsed them.
270
273
  let start = 0;
274
+ let covSeqs = [];
275
+ let covBase = Infinity;
271
276
  for (let i = 0; i < raws.length; i++) {
272
277
  try {
273
278
  const ev = JSON.parse(raws[i]);
274
- if (ev.t === 'snapshot' && ev.seq <= minSeq) start = i;
279
+ if (ev.t === 'snapshot' && ev.seq <= minSeq) {
280
+ start = i;
281
+ covSeqs = [];
282
+ covBase = Infinity;
283
+ }
275
284
  if (ev.seq > minSeq) break;
285
+ // Only lines that PARSE with an integer seq are recorded — a torn
286
+ // trailing line (writer mid-append) is NOT covered: the live feed
287
+ // re-sends it complete and the replay must not skip it.
288
+ if (Number.isInteger(ev.seq)) {
289
+ covSeqs.push(ev.seq);
290
+ if (ev.seq < covBase) covBase = ev.seq;
291
+ }
276
292
  } catch { /* tolerate torn line */ }
277
293
  if (i % 2000 === 1999) await yieldLoop();
278
294
  }
@@ -281,25 +297,19 @@ export async function readV2NativeCold(sessionDir, rows) {
281
297
  // attach buffer can skip replaying it. baseSeq = the smallest seq in the
282
298
  // window (the snapshot baseline is the first in seq order) — a replayed seq
283
299
  // below it was already reflected in the cold assembly and must not be
284
- // re-consumed either. Only lines that PARSE are recorded: a torn trailing
285
- // line (writer mid-append, no newline yet) is NOT in coverage — its seq is
286
- // re-sent complete by the live feed once the newline lands, and the replay
287
- // must not skip it (a skipped snapshot would corrupt the client's assembler).
300
+ // re-consumed either. A torn trailing line is excluded above so its
301
+ // complete re-send is not skipped (a skipped snapshot would corrupt the
302
+ // client's assembler).
288
303
  {
289
304
  const covKey = `${sessionId}\x00${key}`;
290
- let cov = convSeqs.get(covKey);
291
- if (!cov) { cov = { seqs: new Set(), baseSeq: Infinity }; convSeqs.set(covKey, cov); }
292
- for (const raw of windowRaws) {
293
- let seq = null;
294
- try {
295
- const ev = JSON.parse(raw);
296
- if (Number.isInteger(ev && ev.seq)) seq = ev.seq;
297
- } catch { /* torn line: not covered — the live re-send must not be skipped */ }
298
- if (seq === null) continue;
299
- cov.seqs.add(seq);
300
- if (seq < cov.baseSeq) cov.baseSeq = seq;
305
+ const slot = convSeqs.get(covKey);
306
+ if (!slot) {
307
+ convSeqs.set(covKey, { seqs: new Set(covSeqs), baseSeq: covBase === Infinity ? 0 : covBase });
308
+ } else {
309
+ for (const s of covSeqs) slot.seqs.add(s);
310
+ if (covBase < slot.baseSeq) slot.baseSeq = covBase;
311
+ if (!Number.isFinite(slot.baseSeq)) slot.baseSeq = 0;
301
312
  }
302
- if (cov.baseSeq === Infinity) cov.baseSeq = 0;
303
313
  }
304
314
  // Cap each frame at ~512KB of lines: a multi-MB single SSE event forces
305
315
  // one giant synchronous JSON.parse on the client's main thread (no
package/server/proxy.js CHANGED
@@ -13,7 +13,7 @@ import { isAnthropicApiPath, classifyProxyRole } from './lib/interceptor-core.js
13
13
  import { parseAgentId, findHeader } from './lib/v2/agent-id.js';
14
14
  import { liveSystemPromptEnabled } from './lib/system-prompt-live.js';
15
15
  import { executeRequest, extractModel, isStreamResponse } from './lib/proxy/proxy-retry.js';
16
- import { buildRecord, appendRecord, dailyFilePath, todayStr, emitProxyStatsUpdate } from './lib/proxy/proxy-stats.js';
16
+ import { buildRecord, appendRecord, dailyFilePath, todayStr, emitProxyStatsUpdate, emitSlowUpstream } from './lib/proxy/proxy-stats.js';
17
17
  import { reportSwallowed } from './lib/error-report.js';
18
18
  import { LOG_DIR } from '../findcc.js';
19
19
 
@@ -256,7 +256,11 @@ export function startProxy() {
256
256
  }
257
257
  });
258
258
 
259
- // Start on random port
259
+ // Start on random port. Resolve with the port (existing callers destructure a
260
+ // number). Expose the server on the test seam so tests can close it and let
261
+ // node:test's event loop exit (proxy-slow-upstream.test.js hung on the open
262
+ // handle); production callers ignore it.
263
+ __testing.lastServer = server;
260
264
  server.listen(0, '127.0.0.1', () => {
261
265
  const address = server.address();
262
266
  resolve(address.port);
@@ -268,6 +272,29 @@ export function startProxy() {
268
272
  });
269
273
  }
270
274
 
275
+ // A non-utility LLM request that has been waiting this long for ANY upstream
276
+ // response (headers not yet arrived) is, from the user's seat, indistinguishable
277
+ // from a hang — yet both retry layers are legitimately idle (CLI's own retry only
278
+ // counts a settled failure; the proxy's retry engine only re-fires on a settled
279
+ // response/status). Emit ONE advisory frame per request so the UI can say "still
280
+ // waiting on the model" instead of a bare spinner. 30s ≈ long enough to ignore
281
+ // normal slow first-token, short enough to beat the user's give-up threshold.
282
+ const SLOW_UPSTREAM_MS = 30 * 1000;
283
+
284
+ // Monotonic id so concurrent slow requests each get a distinct toast and a
285
+ // resolved frame only clears its own (review P2-1: a single constant key made
286
+ // parallel subagent requests clobber each other and the first resolve dismissed
287
+ // all). Passed through both the slow and the resolved frame.
288
+ let _slowReqSeq = 0;
289
+
290
+ // Test seam: lets tests shrink the threshold and observe emits without standing
291
+ // up a real 30s wait or a network upstream. Production defaults are unchanged.
292
+ export const __testing = {
293
+ slowUpstreamMs: SLOW_UPSTREAM_MS,
294
+ emit: emitSlowUpstream,
295
+ lastServer: null, // set by startProxy so tests can close the listener
296
+ };
297
+
271
298
  // ── 大模型 API 请求处理:重试引擎 + 明细统计 ──────────────────────
272
299
  // mode=off 时仍写 1 条明细(attempts=1)以支撑可用率统计;完全禁用统计用 CCV_PROXY_STATS=off。
273
300
  // 重试配置由 interceptor._retryConfigState 提供(live binding,watchFile 热刷新),
@@ -312,21 +339,87 @@ async function handleLlmApiRequest(req, res, fullUrl, fetchOptions, body, proxyD
312
339
  }
313
340
  });
314
341
 
342
+ // Slow-upstream advisory: fires once if the request is STILL waiting for the
343
+ // upstream's first response byte past SLOW_UPSTREAM_MS. Utility probes
344
+ // (count_tokens / sdk heartbeat) are exempt — they are invisible to the user
345
+ // and firing on them would toast on background traffic. The emit is a no-op
346
+ // unless server.js registered a listener (SDK mode), so PTY/proxy-only
347
+ // processes pay nothing.
348
+ //
349
+ // Scope comes from the request's own self-report headers
350
+ // (x-ccv-project-dir / x-ccv-instance, injected per SDK session / PTY spawn),
351
+ // NOT the process-wide interceptor._projectName — the latter is rebound on
352
+ // every workspace switch, so under concurrent workspaces it would attribute a
353
+ // background workspace's slow request to whichever workspace bound last.
354
+ const slowStartTime = Date.now();
355
+ let slowTimer = null;
356
+ let slowFired = false;
357
+ let slowCwd = '';
358
+ let slowInstance = '';
359
+ let slowReqId = null;
360
+ if (liveCtx.isUtility !== true) {
361
+ slowCwd = findHeader(fetchOptions.headers, 'x-ccv-project-dir') || '';
362
+ slowInstance = findHeader(fetchOptions.headers, 'x-ccv-instance') || '';
363
+ slowReqId = `sq-${++_slowReqSeq}`;
364
+ slowTimer = setTimeout(() => {
365
+ slowFired = true;
366
+ __testing.emit({
367
+ type: 'slow',
368
+ requestId: slowReqId,
369
+ cwd: slowCwd,
370
+ instanceKey: slowInstance,
371
+ waitingMs: Date.now() - slowStartTime,
372
+ model,
373
+ });
374
+ }, __testing.slowUpstreamMs);
375
+ if (slowTimer.unref) slowTimer.unref();
376
+ }
377
+ const clearSlowTimer = () => { if (slowTimer) { clearTimeout(slowTimer); slowTimer = null; } };
378
+ clientAbort.signal.addEventListener('abort', clearSlowTimer, { once: true });
379
+ // The timer measures time-to-HEADERS (fetch resolves at headers). Keep it armed
380
+ // until the first BODY chunk so a headers-fast-then-stalled stream still counts
381
+ // as slow (review P1-2). markFirstByte is the real settle point: it disarms the
382
+ // timer AND emits resolved; the finally below is only an error-path backstop
383
+ // (executeRequest resolves at headers, so clearing there would defeat this).
384
+ let slowFirstByteSeen = false;
385
+ const markFirstByte = () => {
386
+ if (slowFirstByteSeen) return;
387
+ slowFirstByteSeen = true;
388
+ clearSlowTimer();
389
+ if (slowFired) {
390
+ __testing.emit({ type: 'resolved', requestId: slowReqId, cwd: slowCwd, instanceKey: slowInstance });
391
+ }
392
+ };
393
+
315
394
  // 执行带重试的请求
316
- const result = await executeRequest({
317
- url: fullUrl,
318
- fetchOptions: retryFetchOptions,
319
- retryConfig,
320
- ctx: {
321
- dispatcher: proxyDispatcher,
322
- profile,
323
- signal: clientAbort.signal,
324
- // live system 改写上下文(system-prompt-live.js):role 门 + 项目键。
325
- role: liveCtx.role,
326
- isUtility: liveCtx.isUtility === true,
327
- projectKey: interceptor._projectName || '',
328
- },
329
- });
395
+ let result;
396
+ try {
397
+ result = await executeRequest({
398
+ url: fullUrl,
399
+ fetchOptions: retryFetchOptions,
400
+ retryConfig,
401
+ ctx: {
402
+ dispatcher: proxyDispatcher,
403
+ profile,
404
+ signal: clientAbort.signal,
405
+ // live system 改写上下文(system-prompt-live.js):role 门 + 项目键。
406
+ role: liveCtx.role,
407
+ isUtility: liveCtx.isUtility === true,
408
+ projectKey: interceptor._projectName || '',
409
+ },
410
+ });
411
+ } finally {
412
+ // Error-path backstop ONLY: executeRequest resolved at headers, so a success
413
+ // path must NOT clear here — the timer stays armed until the first body chunk
414
+ // (markFirstByte). Clear+resolve only when no usable response came back
415
+ // (network error / aborted / no response object) so the advisory never leaks.
416
+ if (slowFirstByteSeen || !result || !result.response) {
417
+ clearSlowTimer();
418
+ if (slowFired) {
419
+ __testing.emit({ type: 'resolved', requestId: slowReqId, cwd: slowCwd, instanceKey: slowInstance });
420
+ }
421
+ }
422
+ }
330
423
 
331
424
  const { response, attempts, retryCodes, durationMs, finalStatus, succeeded, upstreamStatus } = result;
332
425
 
@@ -379,6 +472,7 @@ async function handleLlmApiRequest(req, res, fullUrl, fetchOptions, body, proxyD
379
472
 
380
473
  // 网络异常(finalStatus=0)或竞速全失败:返回 502 + Proxy Error,与原 catch 分支一致
381
474
  if (finalStatus === 0) {
475
+ markFirstByte(); // settle the advisory on a hard network failure
382
476
  res.writeHead(502, { 'x-forward-attempts': String(attempts) });
383
477
  res.end('Proxy Error');
384
478
  return;
@@ -390,7 +484,12 @@ async function handleLlmApiRequest(req, res, fullUrl, fetchOptions, body, proxyD
390
484
  if (response.body) {
391
485
  // @ts-ignore
392
486
  const nodeStream = Readable.fromWeb(response.body);
393
- nodeStream.on('error', () => {});
487
+ // First body chunk → the wait is over. Also settle if the body errors or
488
+ // closes before any byte (client abort / stalled-then-closed stream), so the
489
+ // advisory never leaks past a terminal stream state.
490
+ nodeStream.on('error', markFirstByte);
491
+ nodeStream.once('data', markFirstByte);
492
+ nodeStream.once('close', markFirstByte);
394
493
  const streamIdleMs = retryConfig && retryConfig.mode === 'off'
395
494
  ? (retryConfig.streamIdleTimeoutMs ?? 0)
396
495
  : 0;
@@ -442,10 +541,13 @@ async function handleLlmApiRequest(req, res, fullUrl, fetchOptions, body, proxyD
442
541
  });
443
542
  }
444
543
  } else if (response.text) {
445
- // 竞速失败兜底 response:用 text() 取 body
544
+ // 竞速失败兜底 response:用 text() 取 body —— a fully-read non-stream body
545
+ // means the wait is over.
446
546
  const text = await response.text();
547
+ markFirstByte();
447
548
  res.end(text);
448
549
  } else {
550
+ markFirstByte(); // no body at all — settle the advisory
449
551
  res.end();
450
552
  }
451
553
  }
package/server/server.js CHANGED
@@ -47,7 +47,7 @@ import { resumeRoutes } from './routes/resume.js';
47
47
  import { sdkContextRoutes } from './routes/sdk-context.js';
48
48
  import { sdkMcpStatusRoutes } from './routes/sdk-mcp-status.js';
49
49
  import { proxyStatsRoutes } from './routes/proxy-stats.js';
50
- import { setProxyStatsListener } from './lib/proxy/proxy-stats.js';
50
+ import { setProxyStatsListener, setSlowUpstreamListener } from './lib/proxy/proxy-stats.js';
51
51
  import * as imCore from './lib/im/im-bridge-core.js';
52
52
  import * as imProcMgr from './lib/im/im-process-manager.js';
53
53
  import * as chatQueue from './lib/chat-queue.js';
@@ -501,6 +501,51 @@ export function notifyProxyStats(logFile) {
501
501
  // through the lib and never reaches back into this module.
502
502
  setProxyStatsListener(notifyProxyStats);
503
503
 
504
+ // Slow-upstream advisory (review follow-up): proxy.js cannot import sdk-manager
505
+ // (a proxy-only process must not load the SDK), so IT emits through proxy-stats
506
+ // and server.js — which already legally holds both the SDK accessors and the
507
+ // terminal WS — decides whether the slow request maps to a live session worth
508
+ // surfacing. The frame carries the request's own cwd/instanceKey and is routed
509
+ // through broadcastWsMessage, so only viewers of that workspace/instance see it.
510
+ setSlowUpstreamListener(({ type, requestId, cwd, instanceKey, waitingMs, model } = {}) => {
511
+ try {
512
+ if (!isSdkMode || !_sdkListSessions || !terminalWss) return;
513
+ // Match the session by the request's real cwd (and instance when present),
514
+ // not the process-wide bound project — concurrent workspaces would otherwise
515
+ // cross-attribute the advisory. No live session → the slow request is not
516
+ // user-visible traffic (IM worker, scheduled task, …) — stay silent.
517
+ const sessions = _sdkListSessions() || [];
518
+ // cwd fallback only when NO instance was reported (review P2-2): an
519
+ // ephemeral/scheduled-task session self-reports a fresh synthetic
520
+ // x-ccv-instance that is never in listSdkSessions; falling back to a
521
+ // same-cwd resident session would then toast for background traffic the
522
+ // user is not waiting on. When an instance IS given but matches nothing,
523
+ // the request is not a resident session's — stay silent.
524
+ const sess = instanceKey
525
+ ? (sessions.find(s => s.instanceKey === instanceKey) || null)
526
+ : (sessions.find(s => cwd && s.cwd === cwd) || null);
527
+ if (type === 'resolved') {
528
+ // The waited-on request settled — tell the UI to dismiss the toast. A
529
+ // request can settle AFTER its session closed (review P2-2): the session
530
+ // lookup then misses and the dismiss would be silently dropped, leaving a
531
+ // stuck toast. Fall back to the request's own self-reported cwd/instanceKey
532
+ // so the dismiss always reaches the workspace that was told to wait.
533
+ const rcwd = sess ? sess.cwd : cwd;
534
+ const rinst = sess ? (sess.instanceKey || null) : (instanceKey || null);
535
+ broadcastWsMessage({
536
+ type: 'sdk-slow-upstream-resolved', cwd: rcwd, project: projectKeyForCwd(rcwd),
537
+ instanceKey: rinst, requestId: requestId || null, ts: Date.now(),
538
+ });
539
+ return;
540
+ }
541
+ if (!sess) return;
542
+ broadcastWsMessage({
543
+ type: 'sdk-slow-upstream', cwd: sess.cwd, project: projectKeyForCwd(sess.cwd),
544
+ instanceKey: sess.instanceKey || null, requestId: requestId || null, waitingMs, model: model || null, ts: Date.now(),
545
+ });
546
+ } catch (err) { reportSwallowed('server.slow-upstream-listener', err); }
547
+ });
548
+
504
549
  const MIME_TYPES = {
505
550
  '.html': 'text/html; charset=utf-8',
506
551
  '.js': 'application/javascript; charset=utf-8',
@@ -41,5 +41,5 @@
41
41
  "tr": "Kıdemli mühendis: çoklu ajan keşfi, plan incelemesi ve yüksek kaliteli uygulama — kod incelemesi, yeniden düzenleme, performans, sürdürülebilirlik.",
42
42
  "uk": "Senior-інженер: багатоагентне дослідження, рев'ю плану та якісна реалізація — рев'ю коду, рефакторинг, продуктивність, супровід."
43
43
  },
44
- "content": "<system-reminder>\n[SCOPED INSTRUCTION] The following instructions apply only to the next 1–3 interactions. Once the task is complete, these instructions should gradually decrease in priority and no longer affect subsequent interactions. You should be adept at utilizing tools such as `AskUserQuestion`, `EnterPlanMode`, and `TeamCreate`, rather than relying solely on plain text processing. Before execution, you must ensure that the `EnterPlanMode`, `ExitPlanMode`, `SendMessage`, `TaskCreate`, `TaskUpdate`, `TaskStop`, `TaskGet`, `TaskOutput` and `TaskList` tools are loaded.\n\nPre-requisite: Use `AskUserQuestion` to clarify user intent whenever the request is ambiguous (target element, interaction style, scope of platforms, etc.). Skip only if the intent is unambiguous.\n\nLeverage a multi-agent exploration mechanism to formulate a highly detailed implementation plan.\n\nInstructions:\n1. Use the `Agent` tool to spawn parallel agents that simultaneously explore different aspects of the codebase:\n- If necessary, assign a preliminary researcher to use the `webSearch` tool to first investigate cutting-edge solutions in the relevant industry domain;\n- One agent responsible for understanding the relevant existing code and architecture;\n- One agent responsible for identifying all files that need to be modified;\n- One agent responsible for identifying potential risks, edge cases, and dependencies;\n- You may add other roles or deploy additional agents beyond the three listed above; the maximum number of concurrently dispatched agents is 5.\n\n2. Synthesize the findings from all agents into a detailed, step-by-step implementation plan.\n\n3. Use the `Agent` tool to spawn 2-3 review agents that examine the plan from different perspectives, checking for missing steps, potential risks, or corresponding mitigation strategies.\n\n4. Integrate the feedback gathered during the review process, then call `ExitPlanMode` to submit your final plan.\n\n5. Once `ExitPlanMode` returns a result:\n- If approved: proceed to execute the plan within this session.\n- If rejected: revise the plan based on the feedback provided and call `ExitPlanMode` again.\n- If an error occurs (including receiving a \"Not in Plan Mode\" message): do **not** follow the suggestions provided in the error message; instead, prompt the user for further instructions.\n\nYour final plan must include the following elements:\n- A clear summary of the implementation strategy;\n- An ordered list of files to be created or modified, with precise details of the required changes for each file;\n- A step-by-step execution sequence;\n- Testing and validation procedures;\n- Potential risks and their corresponding mitigation strategies;\n\n6. After the final plan has been successfully executed:\nFirst run `git diff --quiet && git diff --cached --quiet` (or equivalent) to detect whether the working tree actually has non-trivial changes; if there are no real changes (or only whitespace/comment-only edits), skip the UltraReview step.\nOtherwise, if the project is managed with Git:\nUse the `Agent` tool to build a team, dynamically allocating the number of teammates based on task complexity (5+ is recommended);\nNote: teammates are named (pass `name`), not plain subagents (which have no name);\nTask: Conduct a Code Review of the current git changes from multiple roles and perspectives;\nPre-requisites:\n- The git repository may be located in a subdirectory of the current directory; recursively locate the .git directory first (prefer `git rev-parse --show-toplevel`) before proceeding;\n- In the case of multiple repositories, review tasks may be executed separately per repository;\nReview dimensions (a reference framework — each role covers them as its perspective requires, aiming to be as comprehensive as possible):\n- Whether requirements/objectives have been met and functionality is complete;\n- Whether newly added code introduces side effects, breaks existing functionality, or poses potential risks;\n- Code quality: naming, readability, complexity, technical debt, maintainability;\n- Testing and documentation: whether there is adequate test coverage, and whether critical logic has necessary comments or documentation;\n- Dependencies and compatibility: whether new dependencies or version compatibility issues have been introduced;\n- Any other dimensions you see fit;\nWorkflow:\n- Each teammate, according to their own role, covers the review dimensions one by one and independently outputs a report;\n- After consolidating the reports, perform a cross-review to identify conflicts or shared concerns;\n- Distill specific, actionable modification suggestions and annotate them with priority levels (P0/P1/P2/P3);\n- Upon completion, fix all P0 and P1 items; evaluate P2 items dialectically (use `AskUserQuestion` to consult the user when any item needs a special decision);\n- After execution is complete, close the team: notify each teammate to exit individually;\n</system-reminder>"
44
+ "content": "<system-reminder>\n[SCOPED INSTRUCTION] The following instructions apply only to the next 1–3 interactions. Once the task is complete, these instructions should gradually decrease in priority and no longer affect subsequent interactions. You should be adept at utilizing tools such as `AskUserQuestion` and `EnterPlanMode`, rather than relying solely on plain text processing. Before execution, you must ensure that the `EnterPlanMode`, `ExitPlanMode`, `SendMessage`, `TaskCreate`, `TaskUpdate`, `TaskStop`, `TaskGet`, `TaskOutput` and `TaskList` tools are loaded.\n\nPre-requisite: Use `AskUserQuestion` to clarify user intent whenever the request is ambiguous (target element, interaction style, scope of platforms, etc.). Skip only if the intent is unambiguous.\n\nLeverage a multi-agent exploration mechanism to formulate a highly detailed implementation plan.\n\nInstructions:\n1. Use the `Agent` tool to spawn parallel agents that simultaneously explore different aspects of the codebase:\n- If necessary, assign a preliminary researcher to use the `webSearch` tool to first investigate cutting-edge solutions in the relevant industry domain;\n- One agent responsible for understanding the relevant existing code and architecture;\n- One agent responsible for identifying all files that need to be modified;\n- One agent responsible for identifying potential risks, edge cases, and dependencies;\n- You may add other roles or deploy additional agents beyond the three listed above; the maximum number of concurrently dispatched agents is 5.\n\n2. Synthesize the findings from all agents into a detailed, step-by-step implementation plan.\n\n3. Use the `Agent` tool to spawn 2-3 review agents that examine the plan from different perspectives, checking for missing steps, potential risks, or corresponding mitigation strategies.\n\n4. Integrate the feedback gathered during the review process, then call `ExitPlanMode` to submit your final plan.\n\n5. Once `ExitPlanMode` returns a result:\n- If approved: proceed to execute the plan within this session.\n- If rejected: revise the plan based on the feedback provided and call `ExitPlanMode` again.\n- If an error occurs (including receiving a \"Not in Plan Mode\" message): do **not** follow the suggestions provided in the error message; instead, prompt the user for further instructions.\n\nYour final plan must include the following elements:\n- A clear summary of the implementation strategy;\n- An ordered list of files to be created or modified, with precise details of the required changes for each file;\n- A step-by-step execution sequence;\n- Testing and validation procedures;\n- Potential risks and their corresponding mitigation strategies;\n\n6. After the final plan has been successfully executed:\nFirst run `git diff --quiet && git diff --cached --quiet` (or equivalent) to detect whether the working tree actually has non-trivial changes; if there are no real changes (or only whitespace/comment-only edits), skip the UltraReview step.\nOtherwise, if the project is managed with Git:\nUse the `Agent` tool to build a team, dynamically allocating the number of teammates based on task complexity (5+ recommended);\nNote: spawn teammates (which have a `name`), not plain subagents (which have no name);\nTask: Conduct a Code Review of the current git changes from multiple roles and perspectives;\nPre-requisites:\n- The git repository may be located in a subdirectory of the current directory; recursively locate the `.git` directory first before proceeding;\n- In the case of multiple repositories, review tasks may be executed separately per repository;\nReview dimensions (a reference framework — each role covers them as its perspective requires, aiming to be as comprehensive as possible):\n- Whether requirements/objectives have been met and functionality is complete;\n- Whether newly added code introduces side effects, breaks existing functionality, or poses potential risks;\n- Code quality: naming, readability, complexity, technical debt, maintainability;\n- Testing and documentation: whether there is adequate test coverage, and whether critical logic has necessary comments or documentation;\n- Dependencies and compatibility: whether new dependencies or version compatibility issues have been introduced;\n- Any other dimensions you see fit;\nWorkflow:\n- Each teammate, according to their own role, covers the review dimensions one by one and independently outputs a report;\n- After consolidating the reports, perform a cross-review to identify conflicts or shared concerns;\n- Distill specific, actionable modification suggestions and annotate them with priority levels (P0/P1/P2/P3);\n- Upon completion, fix all P0 and P1 items; evaluate P2 items dialectically (use `AskUserQuestion` to consult the user when any item needs a special decision);\n- After execution is complete, close the team: notify each teammate to exit individually;\n</system-reminder>"
45
45
  }