Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/httpapi/cli_live_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func loadLiveConfig(t *testing.T) map[string]liveCLIConfig {
}

func redactLive(text string) string {
for _, prefix := range []string{"sk-", "crsr_", "ck_", "AQ."} {
for _, prefix := range []string{"sk-", "crsr_", "grok_", "ck_", "AQ."} {
for {
i := strings.Index(text, prefix)
if i < 0 {
Expand Down
2 changes: 1 addition & 1 deletion internal/runtime/cli_live_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func loadLiveConfig(t *testing.T) map[string]liveCLIConfig {
}

func redactLive(text string) string {
for _, prefix := range []string{"sk-", "crsr_", "ck_", "AQ."} {
for _, prefix := range []string{"sk-", "crsr_", "grok_", "ck_", "AQ."} {
for {
i := strings.Index(text, prefix)
if i < 0 {
Expand Down
2 changes: 1 addition & 1 deletion web/app/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function renderAgents(){
state.agentUsage=used;
const rows=agents.map(a=>{const exec=(state.data.executors||[]).find(x=>x.id===a.executorId);const model=a.model||exec?.model||exec?.name||'';const uses=used.get(a.id)||0;return`<div class="agent-row" role="button" tabindex="0" data-agent-id="${escapeHTML(a.id)}" title="${escapeHTML(`${a.id} · v${a.version||1}`)}"><div class="agent-row-who"><div><b>${escapeHTML(a.name)}</b>${agentRowTag(a)}<small>${escapeHTML(a.description||'未填写职责')}</small></div></div><div class="agent-row-model${model?'':' none'}">${escapeHTML(model||'未选模型')}</div><div class="agent-row-config agent-col-config">${agentConfigSummary(a)}</div><div class="agent-row-uses agent-col-uses${uses?'':' zero'}">${uses?`${uses} 个节点`:'未使用'}</div><div class="agent-row-more"><button type="button" class="agent-more-btn" data-agent-more="${escapeHTML(a.id)}" aria-label="更多操作" aria-haspopup="menu" aria-expanded="false"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><circle cx="5" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="19" cy="12" r="1.6"/></svg></button></div></div>`}).join('');
const head='<div class="agent-row agent-row-head" aria-hidden="true"><div>角色</div><div>模型</div><div class="agent-col-config">配置</div><div class="agent-col-uses">引用</div><div></div></div>';
list.innerHTML=rows?head+rows:(query&&scopedAgents().length?'<div class="catalog-empty"><span>AI</span><b>没有匹配的角色。</b><p>调整搜索,或新建一个角色。</p></div>':`<div class="catalog-empty"><span>AI</span><b>${empty}</b><p>调整搜索,或新建一个角色。</p></div>`);
list.innerHTML=rows?head+rows:(query&&scopedAgents().length?'<div class="catalog-empty"><span>AI</span><b>没有匹配的角色。</b><p>调整搜索,或新建一个角色。</p></div>':`<div class="catalog-empty"><span>AI</span><b>${empty}</b></div>`);
list.querySelectorAll('[data-agent-more]').forEach(btn=>btn.onclick=e=>{e.stopPropagation();openAgentRowMenu(btn,state.data.agents.find(a=>a.id===btn.dataset.agentMore))});
list.querySelectorAll('.agent-row[data-agent-id]').forEach(row=>{
const open=()=>openAgentWizard(state.data.agents.find(a=>a.id===row.dataset.agentId));
Expand Down
2 changes: 1 addition & 1 deletion web/app/issue-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ function operationsPane(issue){
}
function activityPane(issue,data){
const comments=data.comments||[],task=data.task,run=data.run;
const commentHtml=comments.slice().reverse().map(c=>`<div class="comment-row"><div class="muted">${c.authorType==='agent'?'Agent':c.authorId||'成员'} · ${new Date(c.createdAt).toLocaleString()}</div><p>${escapeHTML(c.body)}</p></div>`).join('')||'<div class="detail-empty compact">暂无讨论</div>';
const commentHtml=comments.slice().reverse().map(c=>`<div class="comment-row"><div class="muted">${c.authorType==='agent'?'Agent':c.authorId||'成员'} · ${new Date(c.createdAt).toLocaleString()}</div><p>${escapeHTML(c.body)}</p></div>`).join('')||'<div class="detail-empty compact">暂无讨论。这里只展示该需求已有的评论,暂不能直接发表;需要沟通请到「会话」页签。</div>';
const items=[];
for(const item of [task,data.deletionTask].filter((t,i,all)=>t&&all.findIndex(x=>x?.id===t.id)===i)){
items.push({t:new Date(item.createdAt).getTime(),type:'task.created',label:item.id===data.deletionTask?.id?'阻止删除的任务':'创建任务',detail:`${taskStatusLabel(item.status)} · ${item.id}${item.agentId?' · '+item.agentId:''}`});
Expand Down
5 changes: 3 additions & 2 deletions web/app/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ function renderIssues(){
bindIssueSelection(visibleIssues);
return;
}
const emptyTitle=state.issueRunFilter==='attention'?'没有需要介入的工作项':state.issueRunFilter==='mr'?'没有待处理 MR 的需求':'当前项目没有匹配的工作项';
const emptyHint=state.issueRunFilter==='attention'?'待确认澄清结论、门禁失败、运行失败或已中断的工作项会显示在这里。':state.issueRunFilter==='mr'?'已提 MR 但还没合入的需求会显示在这里。':'从 GitHub 同步,或在本平台新建需求。';
const hasQuery=!!String(state.issueQuery||'').trim(),hasFilter=!!(state.sourceFilter||state.issueStatusFilter||state.issueAssigneeFilter||state.issueRunFilter);
const emptyTitle=state.issueRunFilter==='attention'?'没有需要介入的工作项':state.issueRunFilter==='mr'?'没有待处理 MR 的需求':hasQuery?'未找到与当前关键词匹配的需求':hasFilter?'没有符合当前筛选条件的需求':'当前项目没有匹配的工作项';
const emptyHint=state.issueRunFilter==='attention'?'待确认澄清结论、门禁失败、运行失败或已中断的工作项会显示在这里。':state.issueRunFilter==='mr'?'已提 MR 但还没合入的需求会显示在这里。':hasQuery?`修改关键词,或点击搜索框右侧 × 清除搜索${hasFilter?';也可调整筛选条件':''}。`:hasFilter?'调整或清除筛选条件后再试。':'从 GitHub 同步,或在本平台新建需求。';
const keyWidth=issueKeyColumnWidth(paged.items);
const pager=pagerHTML('issues',paged)||(paged.total?`<nav class="pager pager-summary" aria-label="分页"><span class="pager-meta">共 ${paged.total} 条</span></nav>`:'');
board.innerHTML=`<div class="issue-table-card"><div class="issue-table-scroll"><div class="issue-table${state.issueSelectionMode?' issue-table-selectable':''}" data-page-anchor="issues" style="--issue-col-key:${keyWidth}"><div class="issue-table-row issue-table-head" role="row">${state.issueSelectionMode?`<div class="issue-select-cell">${issueSelectAllCheckbox('全选本页可删除的需求')}</div>`:''}<span>编号</span><span>标题</span><span>来源</span><span>责任人</span><span>仓库</span><span>优先级</span><span>关联 LOOP</span><span>当前环节</span><span>进度</span><span>操作</span></div><div class="issue-table-body">${paged.items.map(issueRow).join('')||`<div class="issue-table-empty">${huiIcon('search')}<b>${emptyTitle}</b><p>${emptyHint}</p></div>`}</div></div></div>${pager}</div>`;
Expand Down
2 changes: 1 addition & 1 deletion web/app/runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function renderRuns(){
$('#runListCount')&&($('#runListCount').textContent=`${runs.length} 条`);const list=$('#runList');
const focusedRow=document.activeElement?.closest?.('#runList .run-card'),focusedPart=focusedRow&&['.run-view-btn','.run-del-btn'].find(s=>document.activeElement.matches(s));
const pagedRuns=paginateList('runs', runs);
list.innerHTML=pagedRuns.items.map(r=>runRowHTML(r,workflows)).join('')||`<div class="run-list-empty">${runIconSlot('search',17,'run-glyph')}<b>没有匹配的运行</b><p>换个关键词,或到需求列表查看对应需求的执行结果。</p></div>`;
list.innerHTML=pagedRuns.items.map(r=>runRowHTML(r,workflows)).join('')||(base.length||state.runQuery||state.runWorkflowFilter?`<div class="run-list-empty">${runIconSlot('search',17,'run-glyph')}<b>没有匹配的运行</b><p>换个关键词或筛选条件,或到需求列表查看对应需求的执行结果。</p></div>`:`<div class="run-list-empty">${runIconSlot('search',17,'run-glyph')}<b>尚无运行</b><p>到需求列表启动一条需求后,运行记录会出现在这里。</p></div>`);
const pager=$('#runPager');
pager.innerHTML=`<span class="run-total">共 ${runs.length} 条</span>${pagerHTML('runs', pagedRuns)}`;
hydrateRunIcons($('#runsView'));
Expand Down
11 changes: 10 additions & 1 deletion web/app/sops.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,15 @@ async function adoptGenericTemplate(){
}catch(e){toast(e.message||'复制通用模板失败')}
finally{button.disabled=false;button.textContent='复制到本项目'}
}
function projectOwnEmptyText(){
const base='当前项目还没有自建或复制的 LOOP。可以新建,或从共享模板 / 通用模板复制一份。';
const project=(state.data?.projects||[]).find(p=>p.id===state.projectFilter);
const id=project?.workflowId;
const def=id&&(state.data?.workflows||[]).find(w=>w.id===id);
if(!def)return base;
const source=def.generic?'通用模板':def.projectId?(def.projectId===project.id?'本项目':'团队共享'):'内置';
return `当前项目默认使用「${escapeHTML(def.name||def.id)}」(${source});本项目还没有自建或复制的 LOOP。可切换到对应范围查看,或复制后修改。`;
}
function renderSOPCatalog(){
renderCatalogScopes();
let workflows=scopedWorkflows();
Expand All @@ -500,7 +509,7 @@ function renderSOPCatalog(){
if(filter!=='all')workflows=workflows.filter(w=>metricHealth(metrics.get(w.id), live.filter(r=>r.workflowId===w.id).length).key===filter);
workflows.sort((a,b)=>{const x=metrics.get(a.id)||{},y=metrics.get(b.id)||{};if(sort==='runs')return (y.totalRuns||0)-(x.totalRuns||0);if(sort==='closure')return (y.closureRate||0)-(x.closureRate||0);if(sort==='failures')return (y.failedRuns||0)-(x.failedRuns||0);return new Date(y.lastRunAt||0)-new Date(x.lastRunAt||0)});
$('#sopStats').innerHTML=`<span class="issue-stat">${workflows.length} LOOPs</span><span class="issue-stat">${workflows.filter(w=>w.status==='published').length} 已发布</span><span class="issue-stat">${new Set(workflows.map(w=>w.owner).filter(Boolean)).size} 负责人</span>`;
const empty=state.sopScope==='generic'?'通用模板暂时不可用。它们由平台维护、与项目无关,所有项目都能复制使用。':state.sopScope==='shared'?'还没有共享给当前项目的 LOOP。把本项目模板设为共享后,其他项目会在这里看到。':'当前项目还没有 LOOP。可以新建,或从共享模板 / 通用模板复制一份。';
const empty=state.sopScope==='generic'?'通用模板暂时不可用。它们由平台维护、与项目无关,所有项目都能复制使用。':state.sopScope==='shared'?'还没有共享给当前项目的 LOOP。把本项目模板设为共享后,其他项目会在这里看到。':projectOwnEmptyText();
const emptyText=filter!=='all'&&scopedWorkflows().length?'当前筛选下没有 LOOP。可以切换健康状态查看全部。':empty;
const sopCatalog=$('#sopCatalog');
bindSOPCatalogEvents(sopCatalog);
Expand Down
2 changes: 1 addition & 1 deletion web/app/workbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const CREDENTIAL_KINDS=[
note:'OpenCode 没有自己的模型服务,需要填写 Base URL。',protocols:[['chat','Chat Completions'],['responses','Responses'],['messages','Messages(Anthropic)']]}),
agentCliCredentialKind('cursor',{name:'Cursor CLI',logo:'cursor',monochrome:true,
note:'Cursor CLI 连接 Cursor 官方服务,可按账号获取模型。',
guide:[['登录 Cursor 控制台,在「Integrations → User API Keys」新建 Key','https://cursor.com/dashboard?tab=integrations','前往 Cursor 创建 API Key'],['复制以 <code>crsr_</code> 开头的 Key'],['粘贴到下方保存']]}),
guide:[['登录 Cursor 控制台,在「Integrations → User API Keys」新建 Key','https://cursor.com/dashboard?tab=integrations','前往 Cursor 创建 API Key'],['复制新建的 Key(新版以 <code>grok_</code> 开头,旧版以 <code>crsr_</code> 开头,均可使用)'],['粘贴到下方保存']]}),
agentCliCredentialKind('agy',{name:'Antigravity',logo:'antigravity',baseUrl:'https://gateway.example.com/v1',required:protocol=>protocol==='chat',
note:'默认连接 Gemini 官方服务;选择 OpenAI 兼容网关时需要填写 Base URL。',extraNote:'OpenAI 兼容网关必填',
guide:[['在 Google AI Studio 创建 Gemini API Key,或准备 OpenAI 兼容网关的 Key','https://aistudio.google.com/apikey','前往 Google AI Studio'],['走网关时记下网关地址'],['粘贴 Key,选择协议;保存后可在模型目录里挑选 AI 对话的模型']],
Expand Down
13 changes: 12 additions & 1 deletion web/i18n-en.js

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions webtest/tests/hui-controls-and-sops.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,26 @@ test('HuiSelect supports trigger mode, inline mode, search filter, keyboard navi
genMore?.click();
await settle(4);
});

test('empty project SOP catalog names the project default instead of claiming no SOP', async (t) => {
const app = await loadApp();
t.after(app.close);
const text = () => app.document.querySelector('#sopCatalog .sop-empty')?.textContent || '';
app.evaluate(`
state.currentUser = { id: 1, loginName: 'owner', isPlatformAdmin: true };
state.sopScope = 'project';
state.projectFilter = 'pay';
state.data.projects = [{ id: 'pay', name: 'Pay', workflowId: 'gen-wf' }];
state.data.workflows = [{ id: 'gen-wf', name: 'Backend Delivery', generic: true, status: 'published', version: 1, nodes: [] }];
renderSOPCatalog();
`);
assert.match(text(), /默认使用「Backend Delivery」(通用模板)/);
assert.match(text(), /还没有自建或复制的 LOOP/);
assert.doesNotMatch(text(), /仅新需求适用/);
app.evaluate(`state.data.workflows[0].name = '<img src=x onerror=1>'; renderSOPCatalog();`);
assert.equal(app.document.querySelector('#sopCatalog .sop-empty img'), null);
assert.match(text(), /<img src=x onerror=1>/);
app.evaluate(`state.data.projects[0].workflowId = ''; renderSOPCatalog();`);
assert.match(text(), /当前项目还没有自建或复制的 LOOP/);
assert.doesNotMatch(text(), /默认使用/);
});
2 changes: 2 additions & 0 deletions webtest/tests/issue-drawer-actions.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ test('drawer clarification, activity, delivery, and operation helpers render mea
operations:operationsPane({...issue,createdAt:'2026-01-01',operations:[
{at:'2026-01-03',action:'update',actor:'Alice',detail:'changed title'}]}),
activity:activityPane(issue,state.issueDetailData),
emptyActivity:activityPane(issue,{...state.issueDetailData,comments:[]}),
artifacts:artifactsPane({run:{...state.issueDetailData.run,artifacts:[
{id:'a1',nodeId:'n1',name:'Report',path:'report.md',attempt:2,size:2048,sha256:'abcdef123456'}]}}),
delivery:deliveryPane(issue,state.issueDetailData),
Expand All @@ -65,6 +66,7 @@ test('drawer clarification, activity, delivery, and operation helpers render mea
assert.match(result.overview, /继续/);
assert.match(result.operations, /编辑需求|changed title/);
assert.match(result.activity, /Automated note/);
assert.match(result.emptyActivity, /暂无讨论.*会话/);
assert.match(result.activity, /节点失败/);
assert.match(result.artifacts, /Report/);
assert.match(result.delivery, /feature\/chart/);
Expand Down
23 changes: 23 additions & 0 deletions webtest/tests/issues-list.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,26 @@ test('rerun-from-node dialog returns the selected node and human context', async
await app.evaluate(`reopenDeliveredIssueSilent('issue-1')`);
assert.equal(app.router.calls.find(c => c.path.endsWith('/reopen')).method, 'POST');
});

test('issue list empty state tells search misses apart from an empty project', async (t) => {
const app = await loadApp();
t.after(app.close);
const out = JSON.parse(await app.evaluate(`(() => {
state.data.issues=[{id:'a',projectId:'project-1',number:1,title:'Login',status:'todo',priority:'low'}];
state.projectFilter='project-1';state.issueView='list';
state.sourceFilter='';state.issueStatusFilter='';state.issueAssigneeFilter='';state.issueRunFilter='';
const text=()=>document.querySelector('#issueBoard').textContent;
state.issueQuery='zzz-no-match';renderIssues();const searched=text();
state.issueStatusFilter='done';renderIssues();const both=text();
state.issueQuery='';renderIssues();const filtered=text();
state.issueStatusFilter='';state.data.issues=[];renderIssues();const none=text();
return JSON.stringify({searched,both,filtered,none});
})()`));
assert.match(out.searched, /未找到与当前关键词匹配的需求/);
assert.match(out.searched, /清除搜索/);
assert.doesNotMatch(out.searched, /GitHub 同步/);
assert.match(out.both, /调整筛选条件/);
assert.match(out.filtered, /没有符合当前筛选条件的需求/);
assert.doesNotMatch(out.filtered, /GitHub 同步/);
assert.match(out.none, /从 GitHub 同步/);
});
16 changes: 16 additions & 0 deletions webtest/tests/runs-detail.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,19 @@ test('child pause and cancellation polling refreshes motion without parent strea
}
}
});

test('run list empty state distinguishes no runs from no matches', async (t) => {
const app = await loadApp();
t.after(app.close);
const out = JSON.parse(app.evaluate(`
state.data.runs=[];state.runFilter='all';state.runQuery='';state.runWorkflowFilter='';renderRuns();
const none=document.querySelector('#runList .run-list-empty').textContent;
state.runQuery='zzz';renderRuns();
const searched=document.querySelector('#runList .run-list-empty').textContent;
state.runQuery='';
JSON.stringify({none,searched})
`));
assert.match(out.none, /尚无运行/);
assert.doesNotMatch(out.none, /关键词/);
assert.match(out.searched, /没有匹配的运行/);
});