dsh-super-code 0.1.1 → 0.1.3

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.
package/client/index.js CHANGED
@@ -9,22 +9,29 @@
9
9
  ;(globalThis.window || globalThis).__ModuleLoader__.load({ id: 'dsh-super-code', factory: (require) => {
10
10
  const React = require('react')
11
11
  const { useEffect, useLayoutEffect, useRef, useMemo, useState, useSyncExternalStore } = React
12
- const { IconRefreshOutline16 } = require('@deepseek-ai/dsh-client-ui-primitives')
12
+ const { IconChevronDownOutline14, IconRefreshOutline16 } = require('@deepseek-ai/dsh-client-ui-primitives')
13
13
  const { SessionEventStream } = require('@deepseek-ai/dsh-api-session-controller')
14
14
 
15
15
  const LOCALE_NS = 'dshSuperCode'
16
16
  const zh = {
17
- 'preset.description': '统一编码预设,按需协作。', 'preset.refresh': '刷新状态',
17
+ 'preset.title': 'Super Code 模式', 'usage.cacheUnknown': '缓存 —',
18
+ 'preset.description': '更快、更省、更聪明的编码模式。', 'preset.refresh': '刷新状态', 'preset.expand': '展开设置', 'preset.collapse': '收起设置',
18
19
  'preset.state.available': '预设可用', 'preset.state.installed': '用户预设已安装', 'preset.state.conflict': '已有同名预设',
19
20
  'preset.state.missing': '尚未安装', 'preset.state.broken': '预设不可用',
20
- 'preset.availableHint': '可在新对话中选择此预设。用户副本不会自动覆盖或更新。',
21
- 'preset.installHint': '安装一份用户预设;已有内容会保留,重名时请换个名称。',
22
- 'preset.userConflict': '用户目录中已有同名预设,已保留。可换名安装独立副本。',
21
+ 'preset.availableHint': '可在新对话中选择此预设。升级仅更新未修改的默认名称和描述。',
22
+ 'preset.installHint': '安装一份用户预设;已有内容会保留,标识符冲突时请换个标识符。',
23
+ 'preset.userConflict': '用户目录中已有相同标识符的预设,已保留。可更换标识符安装独立副本。',
23
24
  'preset.readonly': '此宿主未提供用户预设目录,无法安装副本。',
24
- 'preset.name': '预设名称', 'preset.nameHint': '使用小写字母、数字和连字符,最多 64 个字符。安装后在新对话中选择。',
25
+ 'preset.displayName': '显示名称', 'preset.displayNameHint': '支持中文和空格,最多 120 个字符,例如 Super Code 模式。', 'preset.name': '预设标识符', 'preset.nameHint': '用于安装目录,通常保留 super-code 即可。以小写字母或数字开头,仅含小写字母、数字和连字符,最多 64 个字符。',
26
+ 'preset.confirmTitle': '确认重新安装预设',
27
+ 'preset.confirmHint': '以下是通过本插件安装的预设,将会被移除并按照新名称重新安装,旧内容会保留恢复备份。对于需要保留的预设可以手动在列表中移除。',
28
+ 'preset.confirmEmpty': '没有需要重装的预设。', 'preset.remove': '从列表移除', 'preset.cancel': '取消', 'preset.confirm': '确认重装',
29
+ 'preset.reinstall': '重新安装预设', 'preset.reinstallHint': '使用下方名称和标识符重新安装,移除旧预设并保留恢复备份。',
30
+ 'preset.error.ownership-unverified': '无法确认旧预设归属(可能来自旧版本或目录已被替换),未删除任何预设。',
25
31
  'preset.install': '安装用户预设', 'preset.working': '处理中…',
26
- 'preset.error.invalid-name': '名称格式不正确,请使用小写字母、数字和连字符。',
27
- 'preset.error.name-taken': '该名称已被占用,原预设未改动。请换个名称。',
32
+ 'preset.error.invalid-name': '标识符须以小写字母或数字开头,仅含小写字母、数字和连字符,最多 64 个字符。',
33
+ 'preset.error.invalid-display-name': '显示名称不能为空或全为空格,最多 120 个字符;支持中文和空格。',
34
+ 'preset.error.name-taken': '该标识符已被占用,原预设未改动。请更换标识符。',
28
35
  'preset.error.no-user-root': '此宿主没有可写的用户预设目录。',
29
36
  'preset.error.install-failed': '安装未完成,请检查预设目录的写入权限后重试。',
30
37
  'preset.error.connection': '暂时无法读取预设状态,请刷新重试。',
@@ -42,17 +49,24 @@ const zh = {
42
49
  'detail.path': 'Agent 路径', 'detail.title': 'Agent 详情', 'detail.refresh': '刷新对话详情', 'detail.task': '任务', 'detail.agent': 'Agent', 'detail.interrupted': 'Agent · 已中断', 'detail.error': '执行错误', 'detail.incomplete': '执行未完成,请稍后重试。', 'detail.input': '输入', 'detail.output': '输出', 'detail.cacheRead': '缓存读取', 'detail.cacheWrite': '缓存写入', 'detail.total': 'Token 总量', 'detail.hitRate': '缓存命中率', 'detail.moreUsage': '用量详情', 'detail.unavailable': '未提供', 'detail.reading': '正在读取对话…', 'detail.read': '读取中…', 'detail.older': '加载更早记录', 'detail.latest': '回到最新', 'detail.empty': '暂无执行内容', 'detail.new': '有新内容 · 查看最新', 'detail.loadError': '对话详情读取失败', 'detail.connection': '连接中断,正在重连', 'detail.historyError': '历史记录读取失败', 'detail.open': '展开全文', 'detail.noAccess': '无法打开详情,请重试', 'tree.loadError': '部分执行记录读取失败,请刷新重试', 'detail.unknown': '用量未知', 'main.agent': '主 Agent', 'tree.open': '点击查看详情', 'tree.expand': '展开', 'tree.collapse': '收起', 'image': '[图片]'
43
50
  }
44
51
  const en = {
45
- 'preset.description': 'One coding preset with on-demand collaboration.', 'preset.refresh': 'Refresh status',
52
+ 'preset.title': 'Super Code', 'usage.cacheUnknown': 'Cache —',
53
+ 'preset.description': 'A faster, more efficient, smarter coding mode.', 'preset.refresh': 'Refresh status', 'preset.expand': 'Show settings', 'preset.collapse': 'Hide settings',
46
54
  'preset.state.available': 'Preset available', 'preset.state.installed': 'User preset installed', 'preset.state.conflict': 'Preset name already exists',
47
55
  'preset.state.missing': 'Not installed', 'preset.state.broken': 'Preset unavailable',
48
- 'preset.availableHint': 'Select this preset in a new conversation. User copies are never overwritten or updated automatically.',
49
- 'preset.installHint': 'Install a user copy. Existing content is preserved; choose another name if it is taken.',
50
- 'preset.userConflict': 'A user preset with this name already exists and was preserved. Choose another name for a separate copy.',
56
+ 'preset.availableHint': 'Select this preset in a new conversation. Upgrades update only unchanged default names and descriptions.',
57
+ 'preset.installHint': 'Install a user copy. Existing content is preserved; choose another identifier if it is taken.',
58
+ 'preset.userConflict': 'A user preset with this identifier already exists and was preserved. Choose another identifier for a separate copy.',
51
59
  'preset.readonly': 'This host does not provide a user preset directory.',
52
- 'preset.name': 'Preset name', 'preset.nameHint': 'Lowercase letters, digits and hyphens, up to 64 characters. Select it in a new conversation after installing.',
60
+ 'preset.displayName': 'Display name', 'preset.displayNameHint': 'Supports Chinese characters and spaces, up to 120 characters, e.g. Super Code 模式.', 'preset.name': 'Preset identifier', 'preset.nameHint': 'Used for the installation directory; usually keep super-code. Start with a lowercase letter or digit; use only lowercase letters, digits and hyphens, up to 64 characters.',
61
+ 'preset.confirmTitle': 'Confirm preset reinstallation',
62
+ 'preset.confirmHint': 'These presets were installed by this plugin. They will be removed and reinstalled with the new names shown, and recovery backups will be kept. Remove any preset you want to keep from the list.',
63
+ 'preset.confirmEmpty': 'No presets selected for reinstallation.', 'preset.remove': 'Remove from list', 'preset.cancel': 'Cancel', 'preset.confirm': 'Confirm reinstall',
64
+ 'preset.reinstall': 'Reinstall preset', 'preset.reinstallHint': 'Reinstall with the name and identifier below, removing the old preset and keeping a recovery backup.',
65
+ 'preset.error.ownership-unverified': 'Cannot verify ownership of the old preset (it may come from an older version or a replaced directory). No presets were deleted.',
53
66
  'preset.install': 'Install user preset', 'preset.working': 'Working…',
54
- 'preset.error.invalid-name': 'Use lowercase letters, digits and hyphens for the name.',
55
- 'preset.error.name-taken': 'This name is taken. The existing preset was preserved. Choose another name.',
67
+ 'preset.error.invalid-name': 'The identifier must start with a lowercase letter or digit and contain only lowercase letters, digits and hyphens, up to 64 characters.',
68
+ 'preset.error.invalid-display-name': 'The display name cannot be empty or whitespace-only and must be at most 120 characters. Chinese characters and spaces are supported.',
69
+ 'preset.error.name-taken': 'This identifier is taken. The existing preset was preserved. Choose another identifier.',
56
70
  'preset.error.no-user-root': 'This host has no writable user preset directory.',
57
71
  'preset.error.install-failed': 'Installation failed. Check directory write permissions and retry.',
58
72
  'preset.error.connection': 'Preset status is unavailable. Refresh to try again.',
@@ -204,7 +218,6 @@ function agentTreeTotals(view, catalogs = {}) {
204
218
  }
205
219
 
206
220
  const historyRowHeight = 56
207
- const historyCollator = new Intl.Collator('zh-CN', { numeric: true, sensitivity: 'base' })
208
221
 
209
222
  function agentHistoryRange(range, from = '', to = '', now = Date.now()) {
210
223
  const today = new Date(now)
@@ -228,6 +241,7 @@ function agentHistoryRange(range, from = '', to = '', now = Date.now()) {
228
241
  }
229
242
 
230
243
  function agentHistoryRows(view, hidden, totals, options = {}) {
244
+ const historyCollator = new Intl.Collator(localeCode(options.t || (key => zh[key] || key)), { numeric: true, sensitivity: 'base' })
231
245
  const query = (options.query || '').trim().toLocaleLowerCase()
232
246
  const range = agentHistoryRange(options.range || 'all', options.from, options.to, options.now)
233
247
  if (!range.valid) return []
@@ -266,7 +280,8 @@ function AgentHistory({ view, hidden, totals, open, t = key => zh[key] || key })
266
280
  const [scroll, setScroll] = useState({ top: 0, height: 168 })
267
281
  const viewport = useRef(null), focusTarget = useRef('')
268
282
  const records = useMemo(() => agentHistoryRows(view, hidden, totals, { ...filters, t }), [view, hidden, totals, filters, t])
269
- const dateFormat = useMemo(() => new Intl.DateTimeFormat(localeCode(t), { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }), [t])
283
+ const language = localeCode(t)
284
+ const dateFormat = useMemo(() => new Intl.DateTimeFormat(language, { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }), [language])
270
285
  const window = agentHistoryWindow(records.length, scroll.top, scroll.height)
271
286
  const range = agentHistoryRange(filters.range, filters.from, filters.to)
272
287
  const change = (key, value) => setFilters(previous => ({ ...previous, [key]: value }))
@@ -320,7 +335,7 @@ function AgentHistory({ view, hidden, totals, open, t = key => zh[key] || key })
320
335
  return React.createElement('div', { key: record.id, role: 'listitem', 'aria-posinset': index + 1, 'aria-setsize': records.length,
321
336
  style: { position: 'absolute', top: index * historyRowHeight, height: historyRowHeight, width: '100%' } },
322
337
  React.createElement('button', { type: 'button', 'data-history-id': record.id, onClick: () => open(record.node), onKeyDown: event => keyDown(event, index),
323
- title: `${record.title} · ${record.parent} · ${record.time < 0 ? date : new Date(record.time).toLocaleString()} · ${record.tokens < 0 ? text(t, 'history.unknownUsage') : record.tokens + ' Token' + (record.partial ? ' (' + text(t, 'usage.partial') + ')' : '')}`,
338
+ title: `${record.title} · ${record.parent} · ${record.time < 0 ? date : new Date(record.time).toLocaleString(localeCode(t))} · ${record.tokens < 0 ? text(t, 'history.unknownUsage') : record.tokens + ' Token' + (record.partial ? ' (' + text(t, 'usage.partial') + ')' : '')}`,
324
339
  'aria-label': text(t, 'history.view', { title: record.title }) },
325
340
  React.createElement('i', { className: 'dsh-super-code-circle ' + status.tone, 'aria-hidden': true }),
326
341
  React.createElement('span', null, React.createElement('strong', null, record.title), React.createElement('small', null, `${status.label} · ${date} · ${record.parent}`)),
@@ -456,12 +471,12 @@ function AgentTreeBody({ state, view, saved, openDetail, refresh, watchCatalog,
456
471
  ...Object.keys(catalogs).filter(id => view.nodes.has(id))])]
457
472
  const open = node => {
458
473
  setError('')
459
- Promise.resolve().then(() => openDetail(node)).catch(() => setError(text(t, 'detail.noAccess')))
474
+ Promise.resolve().then(() => openDetail(node)).catch(() => setError('detail.noAccess'))
460
475
  }
461
476
  const reload = async () => {
462
477
  setBusy(true); setError('')
463
478
  try { await Promise.all([...new Set([view.root, ...watched])].filter(Boolean).map(id => refresh(id))) }
464
- catch { setError(text(t, 'tree.loadError')) }
479
+ catch { setError('tree.loadError') }
465
480
  finally { setBusy(false) }
466
481
  }
467
482
  const keyDown = (event, row) => {
@@ -495,7 +510,7 @@ function AgentTreeBody({ state, view, saved, openDetail, refresh, watchCatalog,
495
510
  React.createElement('strong', null, text(t, 'tree.title')),
496
511
  React.createElement('span', { className: 'dsh-super-code-tree-count' }, text(t, 'tree.count', { shown: rows.length, total: view.nodes.size, running }))),
497
512
  React.createElement('button', { type: 'button', className: 'dsh-super-code-icon-button', disabled: busy || !view.root, onClick: reload, title: text(t, 'tree.refresh'), 'aria-label': text(t, 'tree.refresh') }, React.createElement(IconRefreshOutline16))),
498
- (error || catalogError) && React.createElement('p', { role: 'alert', className: 'dsh-super-code-tree-error' }, error || text(t, 'tree.loadError')),
513
+ (error || catalogError) && React.createElement('p', { role: 'alert', className: 'dsh-super-code-tree-error' }, text(t, error || 'tree.loadError')),
499
514
  React.createElement('div', { className: 'dsh-super-code-graph-legend', 'aria-label': text(t, 'tree.status') },
500
515
  ['tree.legend.active', 'tree.legend.idle', 'tree.legend.stopped', 'tree.legend.unavailable'].map((key, index) => React.createElement('span', { key },
501
516
  React.createElement('i', { className: 'dsh-super-code-circle ' + ['active', 'idle', 'stopped', 'unavailable'][index], 'aria-hidden': true }), text(t, key)))),
@@ -558,9 +573,9 @@ function AgentTreeBody({ state, view, saved, openDetail, refresh, watchCatalog,
558
573
  React.createElement('span', { className: 'dsh-super-code-circle ' + tone, 'aria-hidden': true }, row.id === view.root ? text(t, 'main.agent').slice(0, 1) : String(rows.findIndex(item => item.id === row.id))),
559
574
  React.createElement('span', { className: 'dsh-super-code-tree-content' },
560
575
  React.createElement('span', { className: 'dsh-super-code-tree-title' }, title),
561
- React.createElement('span', { className: 'dsh-super-code-tree-usage', title: text(t, 'tree.usage', { partial: partial ? text(t, 'usage.incomplete') : '', tokens: usage.tokens.toLocaleString(), cache: usage.cache.toLocaleString(), agents: usage.agents }) },
576
+ React.createElement('span', { className: 'dsh-super-code-tree-usage', title: text(t, 'tree.usage', { partial: partial ? text(t, 'usage.incomplete') : '', tokens: usage.tokens.toLocaleString(localeCode(t)), cache: usage.cache.toLocaleString(localeCode(t)), agents: usage.agents }) },
562
577
  React.createElement('span', null, usage.known ? `${number(usage.tokens)} token` : text(t, 'usage.unknown')),
563
- React.createElement('span', null, usage.known ? text(t, 'usage.cache', { value: usage.input ? Math.round(usage.cache / usage.input * 100) : 0 }) + (partial ? ` · ${text(t, 'usage.partial')}` : '') : 'Cache —')))),
578
+ React.createElement('span', null, usage.known ? text(t, 'usage.cache', { value: usage.input ? Math.round(usage.cache / usage.input * 100) : 0 }) + (partial ? ` · ${text(t, 'usage.partial')}` : '') : text(t, 'usage.cacheUnknown'))))),
564
579
  hasChildren && React.createElement('button', { type: 'button', className: 'dsh-super-code-branch-toggle',
565
580
  style: { left: row.x + 21, top: row.y + 25 }, 'aria-label': `${collapsed.has(row.id) || !isExpanded ? text(t, 'tree.expand') : text(t, 'tree.collapse')} ${title}`,
566
581
  title: text(t, 'tree.organize'), onClick: () => toggleBranch(row.id) },
@@ -600,10 +615,10 @@ function agentPath(view, id) {
600
615
  return path
601
616
  }
602
617
 
603
- function contentText(blocks) {
618
+ function contentText(blocks, t) {
604
619
  return (blocks || []).map(block => {
605
620
  if (block.type === 'text' && typeof block.text === 'string') return block.text
606
- if (block.type === 'image') return '[图片]'
621
+ if (block.type === 'image') return text(t, 'image')
607
622
  return ''
608
623
  }).filter(Boolean).join('\n\n')
609
624
  }
@@ -611,12 +626,12 @@ function contentText(blocks) {
611
626
  function detailRecord(entry, t = key => zh[key] || key) {
612
627
  const event = entry.event, data = event?.data
613
628
  if (!data) return { kind: 'skip' }
614
- const base = { seq: event.seq, time: event.time }
629
+ const base = { seq: event.seq, time: event.time, entry }
615
630
  if (event.type === 'user/message') {
616
631
  if (data.source?.kind !== 'user') return { kind: 'skip' }
617
- return { ...base, kind: 'message', label: text(t, 'detail.task'), text: contentText(data.content) }
632
+ return { ...base, kind: 'message', label: text(t, 'detail.task'), text: contentText(data.content, t) }
618
633
  }
619
- if (event.type === 'assistant/message') return { ...base, kind: 'message', label: data.interrupted ? text(t, 'detail.interrupted') : text(t, 'detail.agent'), text: contentText(data.message?.content) }
634
+ if (event.type === 'assistant/message') return { ...base, kind: 'message', label: data.interrupted ? text(t, 'detail.interrupted') : text(t, 'detail.agent'), text: contentText(data.message?.content, t) }
620
635
  if (event.type === 'turn/error') return { ...base, kind: 'error', label: text(t, 'detail.error'), text: data.message || text(t, 'detail.incomplete') }
621
636
  return { kind: 'skip' }
622
637
  }
@@ -654,7 +669,7 @@ function createAgentInspector(createStream, address, readPage, initial, t = key
654
669
  cursor: change.entries.at(-1)?.event.seq ?? -1,
655
670
  projections: change.page.projections?.values || {}, error: '' })
656
671
  } else if (change.type === 'append' && !snapshot.earlier) {
657
- const item = detailRecord(change.entry)
672
+ const item = detailRecord(change.entry, t)
658
673
  cursor = change.entry.event.seq
659
674
  if (item.kind !== 'skip' && item.text) {
660
675
  const items = [...snapshot.items, item]
@@ -663,13 +678,13 @@ function createAgentInspector(createStream, address, readPage, initial, t = key
663
678
  }
664
679
  }
665
680
  },
666
- carrierFailed: () => publish({ error: text(t, 'detail.connection') }),
667
- failed: () => publish({ status: 'error', error: text(t, 'detail.loadError') }),
681
+ carrierFailed: () => publish({ error: 'detail.connection' }),
682
+ failed: () => publish({ status: 'error', error: 'detail.loadError' }),
668
683
  })
669
684
  return {
670
685
  getSnapshot: () => snapshot,
671
686
  subscribe: listener => { listeners.add(listener); return () => listeners.delete(listener) },
672
- start: () => { stream.open({ maxMessages: 40 }).catch(() => publish({ status: 'error', error: text(t, 'detail.loadError') })) },
687
+ start: () => { stream.open({ maxMessages: 40 }).catch(() => publish({ status: 'error', error: 'detail.loadError' })) },
673
688
  older: async () => {
674
689
  if (snapshot.status === 'paging' || !snapshot.hasMore) return
675
690
  publish({ status: 'paging', error: '' })
@@ -682,7 +697,7 @@ function createAgentInspector(createStream, address, readPage, initial, t = key
682
697
  firstSeq: items.length > 200 ? visible[0].seq : result.value.records[0]?.event.seq ?? 0,
683
698
  hasMore: result.value.hasMore || items.length > 200 })
684
699
  }
685
- catch { publish({ status: 'error', error: text(t, 'detail.historyError') }) }
700
+ catch { publish({ status: 'error', error: 'detail.historyError' }) }
686
701
  },
687
702
  dispose: () => { disposed = true; listeners.clear(); void stream.dispose() },
688
703
  }
@@ -771,79 +786,172 @@ function AgentDetail({ useTabInfo, useSessions, createInspector, detailStates, t
771
786
  saved.following = !snapshot.earlier && element.scrollHeight - element.clientHeight - element.scrollTop < 32
772
787
  if (saved.following) markUnread(false)
773
788
  } },
774
- snapshot.error && React.createElement('p', { role: 'alert' }, snapshot.error),
789
+ snapshot.error && React.createElement('p', { role: 'alert' }, text(t, snapshot.error)),
775
790
  snapshot.status === 'loading' && React.createElement('p', { role: 'status' }, text(t, 'detail.reading')),
776
791
  snapshot.hasMore && React.createElement('button', { type: 'button', disabled: snapshot.status === 'paging', onClick: inspector.older }, snapshot.status === 'paging' ? text(t, 'detail.read') : text(t, 'detail.older')),
777
792
  (snapshot.earlier || snapshot.truncated) && React.createElement('button', { type: 'button', onClick: latest }, text(t, 'detail.latest')),
778
793
  snapshot.status === 'ready' && !snapshot.items.length && React.createElement('p', null, text(t, 'detail.empty')),
779
- snapshot.items.map(item => React.createElement('article', { key: item.seq, className: 'dsh-super-code-detail-entry ' + item.kind },
794
+ snapshot.items.map(record => {
795
+ const item = record.entry ? detailRecord(record.entry, t) : record
796
+ return React.createElement('article', { key: item.seq, className: 'dsh-super-code-detail-entry ' + item.kind },
780
797
  item.collapsed ? React.createElement('details', { open: saved.open.has(item.seq), onToggle: event => { if (event.currentTarget.open) saved.open.add(item.seq); else saved.open.delete(item.seq) } },
781
798
  React.createElement('summary', null, item.label),
782
799
  React.createElement(DetailText, { text: item.text, t }))
783
800
  : React.createElement(React.Fragment, null,
784
801
  React.createElement('div', { className: 'dsh-super-code-detail-entry-label' }, item.label,
785
802
  React.createElement('time', null, new Date(item.time).toLocaleTimeString(localeCode(t), { hour12: false }))),
786
- React.createElement(DetailText, { text: item.text, t })))) ),
803
+ React.createElement(DetailText, { text: item.text, t })))
804
+ }) ),
787
805
  unread && React.createElement('button', { type: 'button', className: 'dsh-super-code-new-content', onClick: () => {
788
806
  saved.following = true; log.current.scrollTop = log.current.scrollHeight; markUnread(false)
789
807
  } }, text(t, 'detail.new')))
790
808
  }
791
809
 
792
810
  // Explicit public Remote contribution; no model tools or private transport hooks.
811
+ const remoteStringCodec = { mode: 'strict', typeSymbol: 'string', schema: {
812
+ parse(value) {
813
+ if (typeof value !== 'string') throw new TypeError('Expected a string')
814
+ return value
815
+ },
816
+ } }
793
817
  const presetRemoteContribution = {
794
818
  package: 'dsh-super-code',
795
- descriptors: ['status', 'installPreset'].map(method => ({
819
+ descriptors: ['status', 'installPreset', 'reinstallPreset', 'synchronize'].map(method => ({
796
820
  id: `dsh-super-code:superCodePresets/${method}`, service: 'superCodePresets',
797
821
  namespace: 'superCodePresets', method, invocation: { kind: 'direct' },
798
- parameters: method === 'installPreset' ? [{ name: 'id', wire: 'id', source: 'json', codec: { mode: 'strict', typeSymbol: 'dsh-super-code#PresetId', schema: { parse(value) {
799
- if (typeof value !== 'string' || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(value)) throw new Error('Invalid preset name')
800
- return value
801
- } } } }] : [],
822
+ parameters: (method === 'reinstallPreset' ? ['previousId', 'id', 'name'] : method === 'installPreset' ? ['id', 'name'] : method === 'synchronize' ? ['language'] : []).map(name => ({
823
+ name, wire: name, source: 'json', codec: remoteStringCodec,
824
+ })),
802
825
  result: { mode: 'src-json' },
803
826
  })),
804
827
  }
805
828
 
829
+ // Old hosts render file metadata. Synchronize through our own Remote, then
830
+ // reload their cached roster only when a managed field actually changed.
831
+ function synchronizePresetDisplay(api, locale, reload, onError) {
832
+ let disposed = false, running = false, pending = '', last = '', needsReload = false
833
+ const changed = () => {
834
+ pending = locale.getSnapshot().active
835
+ if (running || pending === last) return
836
+ running = true
837
+ void (async () => {
838
+ try {
839
+ while (!disposed && pending !== last) {
840
+ const language = pending
841
+ const result = await api.synchronize(language)
842
+ if (!result.ok) throw new Error('Preset display synchronization failed')
843
+ last = language
844
+ needsReload ||= result.value.changed
845
+ if (!disposed && needsReload && pending === language) { reload(); return }
846
+ }
847
+ } catch (error) { if (!disposed) onError(error) }
848
+ finally { running = false }
849
+ })()
850
+ }
851
+ const unsubscribe = locale.subscribe(changed)
852
+ changed()
853
+ return () => { disposed = true; unsubscribe() }
854
+ }
855
+
806
856
  function PresetSettings({ api, t }) {
807
- const [status, setStatus] = useState(null), [name, setName] = useState('super-code')
808
- const [busy, setBusy] = useState(true), [error, setError] = useState('')
857
+ const [status, setStatus] = useState(null), [customId, setCustomId] = useState(null)
858
+ const name = customId ?? (status?.state === 'installed' ? status.id : 'super-code')
859
+ const [customDisplayName, setCustomDisplayName] = useState(null)
860
+ const displayName = customDisplayName ?? (status?.state === 'installed' ? status.name || t('preset.title') : t('preset.title'))
861
+ const [busy, setBusy] = useState(true), [error, setError] = useState(''), [open, setOpen] = useState(false)
862
+ const [confirmation, setConfirmation] = useState(null)
863
+ const dialog = useRef(null)
809
864
  const alive = useRef(false), pending = useRef(false)
810
- const run = async install => {
865
+ useEffect(() => {
866
+ if (!confirmation || !dialog.current) return
867
+ const element = dialog.current
868
+ element.showModal()
869
+ element.querySelector('[data-super-code-cancel]')?.focus()
870
+ return () => { if (element.open) element.close() }
871
+ }, [confirmation !== null])
872
+ const run = async (install, confirmed = null) => {
811
873
  if (pending.current) return
812
874
  pending.current = true; setBusy(true); setError('')
813
875
  try {
814
- const response = install ? await api.installPreset(name.trim()) : await api.status()
876
+ const installName = customDisplayName === null ? '' : displayName.trim()
877
+ const response = !install ? await api.status() : confirmed
878
+ ? await api.reinstallPreset(confirmed.previousId, confirmed.id, confirmed.name)
879
+ : await api.installPreset(name.trim(), installName)
815
880
  if (!response.ok) throw new Error('Remote unavailable')
816
881
  if (!alive.current) return
817
882
  const value = response.value
818
883
  setStatus(install ? value.status : value)
819
- if (install && !value.ok) setError(t(`preset.error.${value.error}`))
884
+ if (install && !value.ok) setError(`preset.error.${value.error}`)
885
+ if (!install || value.ok) {
886
+ const synced = await api.synchronize(localeCode(t))
887
+ if (!synced.ok) throw new Error('Preset display synchronization failed')
888
+ if (install || synced.value.changed) window.location.reload()
889
+ }
820
890
  } catch {
821
- if (alive.current) setError(t('preset.error.connection'))
891
+ if (alive.current) setError('preset.error.connection')
822
892
  } finally {
823
893
  pending.current = false
824
894
  if (alive.current) setBusy(false)
825
895
  }
826
896
  }
827
897
  useEffect(() => { alive.current = true; run(false); return () => { alive.current = false } }, [api])
898
+ const submit = () => {
899
+ if (busy || pending.current || !displayName.trim() || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(name.trim())) return
900
+ if (status?.state === 'installed') {
901
+ setConfirmation([{ previousId: status.id, id: name.trim(),
902
+ name: customDisplayName === null && displayName === t('preset.title') ? '' : displayName.trim(), label: displayName.trim() }])
903
+ } else run(true)
904
+ }
828
905
  const available = status && ['available', 'installed'].includes(status.state)
829
- return React.createElement('section', { className: 'dsh-super-code-settings', 'aria-label': 'Super Code' },
830
- React.createElement('header', null,
831
- React.createElement('div', null, React.createElement('h3', null, 'Super Code'), React.createElement('p', null, t('preset.description'))),
832
- React.createElement('button', { type: 'button', disabled: busy, onClick: () => run(false), 'aria-label': t('preset.refresh') }, t('preset.refresh'))),
833
- status && React.createElement('p', { className: 'dsh-super-code-preset-status', role: 'status', 'data-available': available },
834
- React.createElement('span', { 'aria-hidden': true }, '●'), ' ', t(`preset.state.${status.state}`), ' · ', status.id),
835
- status && React.createElement('p', null, t(available ? 'preset.availableHint' : 'preset.installHint')),
836
- status?.userConflict && status.state !== 'conflict' && React.createElement('p', null, t('preset.userConflict')),
837
- status && !status.authorable && React.createElement('p', { role: 'note' }, t('preset.readonly')),
838
- status?.authorable && React.createElement('form', { onSubmit: event => { event.preventDefault(); run(true) } },
839
- React.createElement('label', { htmlFor: 'super-code-preset-name' }, t('preset.name')),
840
- React.createElement('div', { className: 'dsh-super-code-install-row' },
841
- React.createElement('input', { id: 'super-code-preset-name', value: name, maxLength: 64, disabled: busy,
842
- pattern: '[a-z0-9][a-z0-9\\-]{0,63}', required: true, autoComplete: 'off', spellCheck: false,
843
- 'aria-describedby': 'super-code-preset-name-hint', onChange: event => setName(event.target.value) }),
844
- React.createElement('button', { type: 'submit', disabled: busy || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(name.trim()) }, t(busy ? 'preset.working' : 'preset.install'))),
845
- React.createElement('small', { id: 'super-code-preset-name-hint' }, t('preset.nameHint'))),
846
- error && React.createElement('p', { role: 'alert' }, error))
906
+ return React.createElement('li', { className: `dsh-super-code-settings${open ? ' dsh-super-code-settings-open' : ''}` },
907
+ React.createElement('button', { type: 'button', className: 'dsh-super-code-settings-header', 'aria-expanded': open,
908
+ 'aria-label': `${t(open ? 'preset.collapse' : 'preset.expand')}: ${t('preset.title')}`, onClick: () => setOpen(!open) },
909
+ React.createElement('span', { className: 'dsh-super-code-settings-head-text' },
910
+ React.createElement('span', { className: 'dsh-super-code-settings-name' }, t('preset.title')),
911
+ React.createElement('span', { className: 'dsh-super-code-settings-description' }, t('preset.description'))),
912
+ React.createElement(IconChevronDownOutline14, { className: `dsh-super-code-settings-chevron${open ? ' dsh-super-code-settings-chevron-open' : ''}`, 'aria-hidden': true })),
913
+ open && React.createElement('div', { className: 'dsh-super-code-settings-body' },
914
+ status && React.createElement('p', { className: 'dsh-super-code-preset-status', role: 'status', 'data-available': available },
915
+ React.createElement('span', { 'aria-hidden': true }, '●'), ' ', t(`preset.state.${status.state}`), ' · ', status.id),
916
+ React.createElement('div', { className: 'dsh-super-code-settings-actions' },
917
+ React.createElement('button', { type: 'button', disabled: busy, onClick: () => run(false), 'aria-label': t('preset.refresh') }, t('preset.refresh'))),
918
+ status && React.createElement('p', null, t(available ? 'preset.availableHint' : 'preset.installHint')),
919
+ status?.state === 'installed' && React.createElement('p', null, t('preset.reinstallHint')),
920
+ status?.userConflict && status.state !== 'conflict' && React.createElement('p', null, t('preset.userConflict')),
921
+ status && !status.authorable && React.createElement('p', { role: 'note' }, t('preset.readonly')),
922
+ status?.authorable && React.createElement('form', { onSubmit: event => { event.preventDefault(); submit() } },
923
+ React.createElement('label', { htmlFor: 'super-code-display-name' }, t('preset.displayName')),
924
+ React.createElement('input', { id: 'super-code-display-name', value: displayName, maxLength: 120, required: true, disabled: busy, 'aria-describedby': 'super-code-display-name-hint', onChange: event => setCustomDisplayName(event.target.value) }),
925
+ React.createElement('small', { id: 'super-code-display-name-hint' }, t('preset.displayNameHint')),
926
+ React.createElement('label', { htmlFor: 'super-code-preset-name' }, t('preset.name')),
927
+ React.createElement('div', { className: 'dsh-super-code-install-row' },
928
+ React.createElement('input', { id: 'super-code-preset-name', value: name, maxLength: 64, disabled: busy,
929
+ pattern: '[a-z0-9][a-z0-9\\-]{0,63}', required: true, autoComplete: 'off', spellCheck: false,
930
+ 'aria-describedby': 'super-code-preset-name-hint', onChange: event => setCustomId(event.target.value) }),
931
+ React.createElement('button', { type: 'submit', disabled: busy || !displayName.trim() || !/^[a-z0-9][a-z0-9-]{0,63}$/.test(name.trim()) }, t(busy ? 'preset.working' : status?.state === 'installed' ? 'preset.reinstall' : 'preset.install'))),
932
+ React.createElement('small', { id: 'super-code-preset-name-hint' }, t('preset.nameHint'))),
933
+ error && React.createElement('p', { role: 'alert' }, t(error))),
934
+ confirmation && React.createElement('dialog', { ref: dialog, className: 'dsh-super-code-confirm',
935
+ 'aria-labelledby': 'super-code-confirm-title', 'aria-describedby': 'super-code-confirm-hint',
936
+ onKeyDown: event => { if (event.key === 'Escape') event.stopPropagation() },
937
+ onCancel: event => { event.preventDefault(); event.stopPropagation(); setConfirmation(null) } },
938
+ React.createElement('h3', { id: 'super-code-confirm-title' }, t('preset.confirmTitle')),
939
+ React.createElement('p', { id: 'super-code-confirm-hint' }, t('preset.confirmHint')),
940
+ confirmation.length ? React.createElement('ul', null, ...confirmation.map(item =>
941
+ React.createElement('li', { key: item.previousId },
942
+ React.createElement('span', null, `${item.previousId} → ${item.label} · ${item.id}`),
943
+ React.createElement('button', { type: 'button', 'aria-label': `${t('preset.remove')}: ${item.previousId}`,
944
+ onClick: () => setConfirmation(items => items.filter(row => row.previousId !== item.previousId)) }, t('preset.remove')))))
945
+ : React.createElement('p', { role: 'status' }, t('preset.confirmEmpty')),
946
+ React.createElement('div', { className: 'dsh-super-code-confirm-actions' },
947
+ React.createElement('button', { type: 'button', autoFocus: true, 'data-super-code-cancel': true, onClick: () => setConfirmation(null) }, t('preset.cancel')),
948
+ React.createElement('button', { type: 'button', disabled: busy || !confirmation.length,
949
+ onClick: () => {
950
+ if (busy || pending.current || !confirmation.length) return
951
+ const selected = confirmation[0]
952
+ setConfirmation(null)
953
+ run(true, selected)
954
+ } }, t('preset.confirm')))))
847
955
  }
848
956
 
849
957
  const inject = [
@@ -855,22 +963,30 @@ function apply(ctx) {
855
963
  const locale = ctx.locale || { register: () => () => {}, bind: () => key => zh[key] || key }
856
964
  ctx.effect(() => locale.register(LOCALE_NS, { zh, en }), 'dsh-super-code: dictionaries')
857
965
  const t = locale.bind(LOCALE_NS)
858
- ctx.effect(async () => {
859
- const owner = ctx
860
- await owner.remote.$mount(presetRemoteContribution)
861
- owner.inject(['remote.superCodePresets'], ready => ready.slots.inject('settings.plugin.item', () => ready.slots.register({
966
+ // $mount creates a lifecycle effect on this same fiber; awaiting it from
967
+ // another effect would stall the namespace and the settings contribution.
968
+ void ctx.remote.$mount(presetRemoteContribution).catch(error => console.warn('Super Code preset Remote:', error))
969
+ ctx.inject(['remote.superCodePresets'], ready => {
970
+ ready.effect(() => synchronizePresetDisplay(ready.remote.superCodePresets, locale,
971
+ () => window.location.reload(), error => console.warn('Super Code preset display:', error)), 'super-code: preset display')
972
+ return ready.slots.inject('settings.plugin.item', () => ready.slots.register({
862
973
  name: 'settings.plugin.item', key: 'super-code', locale: LOCALE_NS,
863
- inject: () => ({ api: ready.remote.superCodePresets, t }),
864
- }, PresetSettings)))
974
+ inject: () => ({ api: ready.remote.superCodePresets }),
975
+ }, PresetSettings))
865
976
  })
866
977
  ctx.effect(() => {
867
978
  const style = document.createElement('style')
868
979
  style.dataset.dshSuperCode = 'true'
869
980
  style.textContent = `
870
- .dsh-super-code-settings{padding:20px;border:1px solid var(--dsw-alias-border-l1,#dedfe3);border-radius:12px;line-height:1.6;font-size:13px}
871
- .dsh-super-code-settings header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
872
- .dsh-super-code-settings h3{margin:0;font-size:15px;font-weight:600}.dsh-super-code-settings p{margin:8px 0;color:var(--dsw-alias-label-secondary,#70757d)}
873
- .dsh-super-code-settings button,.dsh-super-code-settings input{font:inherit;color:inherit;border:1px solid var(--dsw-alias-border-l1,#dedfe3);border-radius:7px;background:transparent;padding:7px 10px;min-height:34px}
981
+ .dsh-super-code-settings{list-style:none;border:.5px solid var(--dsw-alias-border-l4,#dedfe3);border-radius:16px;background:var(--dsw-alias-bg-layer-3,transparent);line-height:1.6;font-size:13px;transition:border-color .16s,background .16s}
982
+ .dsh-super-code-settings:hover{border-color:var(--dsw-alias-label-dimmed,#a8abb2)}.dsh-super-code-settings-open{background:var(--dsw-alias-bg-layer-2,transparent);border-color:var(--dsw-alias-label-dimmed,#a8abb2)}
983
+ .dsh-super-code-settings-header{width:100%;appearance:none;border:0;background:none;font:inherit;color:inherit;text-align:left;cursor:pointer;display:flex;align-items:center;gap:12px;padding:14px 16px;border-radius:12px}
984
+ .dsh-super-code-settings-head-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}.dsh-super-code-settings-name{font-size:15px;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary,inherit)}
985
+ .dsh-super-code-settings-description{font-size:13px;line-height:1.5;color:var(--dsw-alias-label-tertiary,#70757d)}.dsh-super-code-settings-chevron{flex:none;color:var(--dsw-alias-label-tertiary,#70757d);transition:transform .16s}.dsh-super-code-settings-chevron-open{transform:rotate(180deg)}
986
+ .dsh-super-code-confirm{box-sizing:border-box;width:min(560px,calc(100vw - 48px));max-height:80vh;overflow:auto;border:1px solid var(--dsw-alias-border-l2,#dedfe3);border-radius:8px;padding:24px;color:var(--dsw-alias-label-primary,#202126);background:var(--dsw-alias-bg-layer-1,#fff);font-size:13px;line-height:1.6}.dsh-super-code-confirm::backdrop{background:#0006}.dsh-super-code-confirm h3{font-size:16px;margin:0 0 12px}.dsh-super-code-confirm p{margin:0 0 14px}.dsh-super-code-confirm ul{padding:0;margin:0 0 18px;list-style:none}.dsh-super-code-confirm li{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:12px 0;overflow-wrap:anywhere}.dsh-super-code-confirm-actions{display:flex;justify-content:flex-end;gap:8px}.dsh-super-code-confirm button{font:inherit;color:inherit;border:1px solid var(--dsw-alias-border-l1,#dedfe3);border-radius:6px;background:transparent;padding:7px 10px;min-height:34px;cursor:pointer}.dsh-super-code-confirm button:disabled{opacity:.45;cursor:default}.dsh-super-code-confirm button:focus-visible{outline:2px solid var(--dsw-color-primary,#3276dc);outline-offset:2px}
987
+ .dsh-super-code-settings-body{border-top:.5px solid var(--dsw-alias-border-l2,#dedfe3);margin:0 16px;padding:12px 0 14px}.dsh-super-code-settings-actions{display:flex;justify-content:flex-end}
988
+ .dsh-super-code-settings p{margin:8px 0;color:var(--dsw-alias-label-secondary,#70757d)}
989
+ .dsh-super-code-settings-body button,.dsh-super-code-settings input{font:inherit;color:inherit;border:1px solid var(--dsw-alias-border-l1,#dedfe3);border-radius:7px;background:transparent;padding:7px 10px;min-height:34px}
874
990
  .dsh-super-code-settings button{cursor:pointer;white-space:nowrap}.dsh-super-code-settings button:disabled{opacity:.45;cursor:default}
875
991
  .dsh-super-code-settings form{margin-top:16px}.dsh-super-code-settings label{display:block;margin-bottom:6px}
876
992
  .dsh-super-code-install-row{display:flex;gap:8px;flex-wrap:wrap}.dsh-super-code-install-row input{flex:1;min-width:140px}
@@ -1037,17 +1153,17 @@ function apply(ctx) {
1037
1153
  (target, options) => new SessionEventStream(ctx.remote, target, options), address,
1038
1154
  (request, signal) => ctx.remote.session.page(request, signal), initial, t) }
1039
1155
  ctx.slots.inject('sidebar.right.pane.tab', () => ctx.slots.register({
1040
- name: 'sidebar.right.pane.tab', key: 'dsh-super-code-detail', inject: () => ({ ...detailActions, t }),
1156
+ name: 'sidebar.right.pane.tab', key: 'dsh-super-code-detail', locale: LOCALE_NS, inject: () => ({ ...detailActions }),
1041
1157
  }, AgentDetail))
1042
1158
  ctx.slots.inject('sidebar.right.pane.tab', () => ctx.slots.register({
1043
1159
  // Keyed tab bodies dispatch by the definition id, while `kind` is the
1044
1160
  // page/content discriminator used by the Sidebar controller.
1045
- name: 'sidebar.right.pane.tab', key: treeId,
1046
- inject: () => ({ ...treeActions, t }),
1161
+ name: 'sidebar.right.pane.tab', key: treeId, locale: LOCALE_NS,
1162
+ inject: () => ({ ...treeActions }),
1047
1163
  }, AgentTree))
1048
1164
  ctx.effect(() => disposeTreeType, 'super-code: Agent tree tab')
1049
1165
  ctx.effect(() => disposeDetailType, 'super-code: Agent detail tab')
1050
1166
  }
1051
1167
 
1052
- return { inject, apply, buildAgentView, visibleAgentRows, agentTreeDisplay, agentTreeTotals, agentTreeLayout, agentExecutionStatus, agentDetailAddress, agentDetailTarget, agentPath, detailRecord, createAgentInspector, agentHistoryRange, agentHistoryRows, agentHistoryWindow }
1168
+ return { inject, apply, synchronizePresetDisplay, buildAgentView, visibleAgentRows, agentTreeDisplay, agentTreeTotals, agentTreeLayout, agentExecutionStatus, agentDetailAddress, agentDetailTarget, agentPath, detailRecord, createAgentInspector, agentHistoryRange, agentHistoryRows, agentHistoryWindow }
1053
1169
  } })
@@ -6,5 +6,5 @@ export interface GuidedRoute {
6
6
  /** Exact deployment policy, not a guess about capability from a model name. */
7
7
  export declare function createGuidanceSelector(routes?: readonly GuidedRoute[]): (provider: unknown, model: unknown) => GuidanceMode;
8
8
  /** Only selected routes pay for concrete reminders; standards remain identical. */
9
- export declare const GUIDED_INSTRUCTIONS = "Inspect definitions and working callers for uncertain APIs; do not add aliases to satisfy imagined tests. A cause remains unconfirmed until an observation distinguishes it. Run the relevant check and inspect the result: a started command, exit code alone, zero tests or a teammate's claim does not establish acceptance. Before calling a failure pre-existing or environmental, compare the same check on the baseline; otherwise report it as unresolved. Never assume hidden tests will fix a failure. When stuck, change the hypothesis or reduce the reproduction, not the agent count. Use only necessary checks; no mandatory checklist or extra narration.";
9
+ export declare const GUIDED_INSTRUCTIONS = "For uncertain APIs, inspect definitions and working callers. State the observed mismatch before editing; choose a check that distinguishes competing causes. For a changed state transition, test its relevant entry condition (e.g. saved in-progress state for restart), not only a fresh success. Match the final diff to the user's requested behaviors. A started command, exit code alone, zero tests or a teammate's claim is not acceptance. Keep a failing check unresolved until it passes or baseline evidence/an explicit contract change explains it; never predict that replacement tests will fix it. When stuck, reduce the reproduction or change the hypothesis, not the agent count. Reuse evidence already present; no extra checklist or narration.";
10
10
  //# sourceMappingURL=guidance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../src/core/guidance.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAA;AAChD,MAAM,WAAW,WAAW;IAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAOlF,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,SAAS,WAAW,EAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,YAAY,CAK/H;AAED,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,8oBAA8oB,CAAA"}
1
+ {"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../src/core/guidance.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAA;AAChD,MAAM,WAAW,WAAW;IAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAOlF,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,SAAS,WAAW,EAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,YAAY,CAK/H;AAED,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,6uBAA6uB,CAAA"}
@@ -12,5 +12,5 @@ export function createGuidanceSelector(routes = []) {
12
12
  return (provider, model) => typeof provider === 'string' && typeof model === 'string' && keys.has(JSON.stringify([provider, model])) ? 'guided' : 'standard';
13
13
  }
14
14
  /** Only selected routes pay for concrete reminders; standards remain identical. */
15
- export const GUIDED_INSTRUCTIONS = `Inspect definitions and working callers for uncertain APIs; do not add aliases to satisfy imagined tests. A cause remains unconfirmed until an observation distinguishes it. Run the relevant check and inspect the result: a started command, exit code alone, zero tests or a teammate's claim does not establish acceptance. Before calling a failure pre-existing or environmental, compare the same check on the baseline; otherwise report it as unresolved. Never assume hidden tests will fix a failure. When stuck, change the hypothesis or reduce the reproduction, not the agent count. Use only necessary checks; no mandatory checklist or extra narration.`;
15
+ export const GUIDED_INSTRUCTIONS = `For uncertain APIs, inspect definitions and working callers. State the observed mismatch before editing; choose a check that distinguishes competing causes. For a changed state transition, test its relevant entry condition (e.g. saved in-progress state for restart), not only a fresh success. Match the final diff to the user's requested behaviors. A started command, exit code alone, zero tests or a teammate's claim is not acceptance. Keep a failing check unresolved until it passes or baseline evidence/an explicit contract change explains it; never predict that replacement tests will fix it. When stuck, reduce the reproduction or change the hypothesis, not the agent count. Reuse evidence already present; no extra checklist or narration.`;
16
16
  //# sourceMappingURL=guidance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guidance.js","sourceRoot":"","sources":["../../src/core/guidance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACzC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAErB,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,SAAiC,EAAE;IACxE,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACnD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5F,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACpF,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAA;AAC9J,CAAC;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,2oBAA2oB,CAAA"}
1
+ {"version":3,"file":"guidance.js","sourceRoot":"","sources":["../../src/core/guidance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACzC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAErB,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,SAAiC,EAAE;IACxE,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACnD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5F,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACpF,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAA;AAC9J,CAAC;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,0uBAA0uB,CAAA"}
@@ -13,7 +13,7 @@ export type MethodName = 'investigation' | 'product' | 'bugfix' | 'architecture'
13
13
  export declare const METHODS: Readonly<Record<MethodName, string>>;
14
14
  export declare const TEAMS: Readonly<Record<TeamName, TeamDefinition>>;
15
15
  /** Stable, compact instructions; the host logs selected methods as tool results. */
16
- export declare const SUPER_CODE_INSTRUCTIONS = "You are super-code, responsible for completing the user's coding work.\nChoose by deliverable: research (facts), design (plan), develop (code), verify (checks), optimize (measured gains). Teams are specialties, not stages or resident agents. Use super_code_method only for missing expertise. No routing call or mandatory reflection loop.\nExplanation/design does not authorize edits; methods/teammates grant no permission. Ask only for decisions affecting correctness or scope. Finish and validate by risk; distinguish delivery, validation limits and blockers. Diagnosis is not a fix; stop without unrelated additions.\nFor long/interleaved work, use super_code_task for user-sourced requirements, acceptance, decisions/evidence and next dependency. Record material changes before switching/compaction, not every action. Preserve unaffected constraints; user corrections outrank old records. Never truncate hard requirements. Resume from current context; read only missing details and recheck mutable evidence. Focus/status questions do not cancel work.\nParallelize independent tools first. Delegate independent deliverables only for clear time or verification value. Reuse members only for related scope with valid context; never delegate recursively. Continue locally; one writer per file or isolated workspaces. For recorded tasks, delegate binds scope/ownership/versions; validate_member precedes lead review. Neither starts workers nor enforces runtime token budgets. Check key evidence, reject stale returns, count all attempts; unknown-stop is not success.\nResolve unclear APIs from requirements and callers, not guessed test names or aliases. Attribute failures to the environment only with baseline evidence; never assume later tests repair them. For hard problems, use a discriminating experiment, smaller reproduction or independent reference before expanding scope.\nMinimize total request cost. Reuse valid context; batch independent reads; avoid round trips for tiny savings. Keep required checks; inspect scaling and resource release. Report artifacts, actual checks and gaps briefly; no forced format or unmeasured gains.";
16
+ export declare const SUPER_CODE_INSTRUCTIONS = "You are super-code, completing the user's authorized coding work.\nChoose by deliverable: research, design, develop, verify, optimize. Teams are specialties, not stages. Use super_code_method when causes remain indistinguishable, failures repeat or state/recovery behavior is unclear; reuse loaded guidance. No mandatory routing or reflection loop.\nExplanation/design does not authorize edits; methods/teammates grant no permission. Ask only for decisions affecting correctness or scope. Diagnosis is not a fix.\nFor long/interleaved work, use super_code_task to preserve user-sourced requirements, acceptance, decisions/evidence and next dependency before switching or compaction, not each action. Corrections replace affected constraints only. Never truncate hard requirements. Resume from current context; read missing details and recheck mutable evidence. Status questions do not cancel work.\nBatch independent tools first. Delegate independent deliverables for time or verification value; reuse members for related scope, never recursively. Continue locally; one writer per file or isolated workspaces. For recorded tasks, delegate binds ownership/versions; validate_member precedes lead review. Neither starts workers nor enforces token budgets. Reject stale returns; count all attempts; unknown-stop is not success.\nResolve APIs from visible contracts and callers, never guessed tests or aliases. Before finishing, compare the diff with requirements and affected existing behavior. Check changed recovery/state paths, not just the happy path. An unresolved failure stays unresolved unless baseline evidence or an explicit contract change explains it; future tests cannot establish success. When stuck, change the hypothesis or reduce the reproduction before expanding scope.\nMinimize request cost: reuse context, read targeted ranges, batch independent checks. Keep full verbose logs in task files; report exit status, executed test counts, failure context and file references. Do not hide errors or skip required checks to save tokens. Inspect scaling and resource release. Report delivery, checks and gaps; no unmeasured gains.";
17
17
  /** Read exactly the selected team/method; caller chooses using task meaning. */
18
18
  export declare function readTeamMethod(team: TeamName, method?: MethodName): string;
19
19
  //# sourceMappingURL=teams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/core/teams.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,UAAU,kEAAmE,CAAA;AAC1F,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;CACxC;AAED,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAA;AACtJ,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAU9C,CAAA;AAEX,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CAM3D,CAAA;AAEF,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,gmEAM+N,CAAA;AAEnQ,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAM1E"}
1
+ {"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/core/teams.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,eAAO,MAAM,UAAU,kEAAmE,CAAA;AAC1F,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,CAAC,CAAA;AAChD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAA;CACxC;AAED,sFAAsF;AACtF,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAA;AACtJ,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAU9C,CAAA;AAEX,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CAM3D,CAAA;AAEF,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,imEAM+T,CAAA;AAEnW,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAM1E"}