@lensmcp/protocol-types 1.25.48 → 1.25.50
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/index.d.ts +2 -0
- package/index.js +1 -1
- package/lib/ai-call.js +5 -5
- package/lib/dashboard.d.ts +90 -0
- package/lib/goal-outcome.d.ts +159 -0
- package/lib/goal-outcome.js +1 -0
- package/lib/goal-retro.d.ts +60 -0
- package/lib/goal-retro.js +1 -0
- package/lib/overseer-findings.d.ts +113 -2
- package/lib/overseer-findings.js +1 -1
- package/lib/team-library.d.ts +9 -0
- package/lib/team.d.ts +194 -3
- package/lib/team.js +1 -1
- package/lib/workspace-actions.d.ts +159 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export * from './lib/event-loop.js';
|
|
|
32
32
|
export * from './lib/workspace-actions.js';
|
|
33
33
|
export * from './lib/team.js';
|
|
34
34
|
export * from './lib/team-review-changes.js';
|
|
35
|
+
export * from './lib/goal-outcome.js';
|
|
36
|
+
export * from './lib/goal-retro.js';
|
|
35
37
|
export * from './lib/team-design.js';
|
|
36
38
|
export * from './lib/team-library.js';
|
|
37
39
|
export * from './lib/system-report.js';
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export*from"./lib/schema-version.js";export*from"./lib/source-location.js";export*from"./lib/context.js";export*from"./lib/event.js";export*from"./lib/node.js";export*from"./lib/edge.js";export*from"./lib/attributes.js";export*from"./lib/producer-health.js";export*from"./lib/resources.js";export*from"./lib/tokens.js";export*from"./lib/capture-demand.js";export*from"./lib/bounded-clone.js";export*from"./lib/bounded-map.js";export*from"./lib/flood-guard.js";export*from"./lib/dashboard.js";export*from"./lib/log-query.js";export*from"./lib/error-dismissal.js";export*from"./lib/ai-content.js";export*from"./lib/http-exchange.js";export*from"./lib/ai-call.js";export*from"./lib/ai-call-row.js";export*from"./lib/ai-call-groups.js";export*from"./lib/ai-context.js";export*from"./lib/ai-origins.js";export*from"./lib/ai-playground.js";export*from"./lib/pod-memory.js";export*from"./lib/perf-rules.js";export*from"./lib/sources.js";export*from"./lib/page-visit.js";export*from"./lib/replay.js";export*from"./lib/event-loop.js";export*from"./lib/workspace-actions.js";export*from"./lib/team.js";export*from"./lib/team-review-changes.js";export*from"./lib/team-design.js";export*from"./lib/team-library.js";export*from"./lib/system-report.js";export*from"./lib/overseer-findings.js";export*from"./lib/overseer-rounds.js";
|
|
1
|
+
"use strict";export*from"./lib/schema-version.js";export*from"./lib/source-location.js";export*from"./lib/context.js";export*from"./lib/event.js";export*from"./lib/node.js";export*from"./lib/edge.js";export*from"./lib/attributes.js";export*from"./lib/producer-health.js";export*from"./lib/resources.js";export*from"./lib/tokens.js";export*from"./lib/capture-demand.js";export*from"./lib/bounded-clone.js";export*from"./lib/bounded-map.js";export*from"./lib/flood-guard.js";export*from"./lib/dashboard.js";export*from"./lib/log-query.js";export*from"./lib/error-dismissal.js";export*from"./lib/ai-content.js";export*from"./lib/http-exchange.js";export*from"./lib/ai-call.js";export*from"./lib/ai-call-row.js";export*from"./lib/ai-call-groups.js";export*from"./lib/ai-context.js";export*from"./lib/ai-origins.js";export*from"./lib/ai-playground.js";export*from"./lib/pod-memory.js";export*from"./lib/perf-rules.js";export*from"./lib/sources.js";export*from"./lib/page-visit.js";export*from"./lib/replay.js";export*from"./lib/event-loop.js";export*from"./lib/workspace-actions.js";export*from"./lib/team.js";export*from"./lib/team-review-changes.js";export*from"./lib/goal-outcome.js";export*from"./lib/goal-retro.js";export*from"./lib/team-design.js";export*from"./lib/team-library.js";export*from"./lib/system-report.js";export*from"./lib/overseer-findings.js";export*from"./lib/overseer-rounds.js";
|
package/lib/ai-call.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var se=Object.defineProperty;var v=(t,s)=>se(t,"name",{value:s,configurable:!0});var oe=Object.defineProperty,_=v((t,s)=>oe(t,"name",{value:s,configurable:!0}),"d");const b=_(t=>!!t&&typeof t=="object"&&!Array.isArray(t),"isObj"),e=_(t=>typeof t=="string"?t:void 0,"str"),h=_(t=>typeof t=="number"&&Number.isFinite(t)?t:void 0,"num"),k=_(t=>Array.isArray(t)?t:[],"arr"),c=_(t=>b(t)?t:{},"obj"),A=_(t=>typeof t=="string"?t:t===void 0?"":JSON.stringify(t),"json"),
|
|
1
|
+
"use strict";var se=Object.defineProperty;var v=(t,s)=>se(t,"name",{value:s,configurable:!0});var oe=Object.defineProperty,_=v((t,s)=>oe(t,"name",{value:s,configurable:!0}),"d");const b=_(t=>!!t&&typeof t=="object"&&!Array.isArray(t),"isObj"),e=_(t=>typeof t=="string"?t:void 0,"str"),h=_(t=>typeof t=="number"&&Number.isFinite(t)?t:void 0,"num"),k=_(t=>Array.isArray(t)?t:[],"arr"),c=_(t=>b(t)?t:{},"obj"),A=_(t=>typeof t=="string"?t:t===void 0?"":JSON.stringify(t),"json"),F=_(t=>t>=1024*1024?`${(t/1024/1024).toFixed(1)} MB`:`${Math.round(t/1024)} KB`,"kb");export const CUT_MARK="\u2026";export function parseJsonPrefix(t){try{return{value:JSON.parse(t),cut:!1}}catch{}const s=[];let n=0,l=!1,a=!1,r=!1;const o=t.length,i=_(m=>{const d=s[s.length-1];d&&(d.state="after"),n=m},"ended");for(let m=0;m<o;m++){const d=t[m];if(l){r?r=!1:d==="\\"?r=!0:d==='"'&&(l=!1,a?s[s.length-1].state="colon":i(m+1));continue}if(d===" "||d===`
|
|
2
2
|
`||d==="\r"||d===" ")continue;const f=s[s.length-1];if(d==='"'){l=!0,a=!!f&&f.c==="{"&&f.state==="key";continue}if(d==="{"||d==="["){s.push({c:d,state:d==="{"?"key":"value"}),n=m+1;continue}if(d==="}"||d==="]"){s.pop(),i(m+1);continue}if(d===":"){f&&(f.state="value");continue}if(d===","){f&&(f.state=f.c==="{"?"key":"value");continue}let g=m;for(;g<o&&!`,}]
|
|
3
|
-
\r `.includes(t[g]);)g++;if(g>=o)break;i(g),m=g-1}const u=s.map(m=>m.c==="{"?"}":"]").reverse().join("");if(l&&!a)for(let m=0;m<=6;m++)try{return{value:JSON.parse(`${t.slice(0,o-m)}${CUT_MARK}"${u}`),cut:!0}}catch{}if(n)try{return{value:JSON.parse(`${t.slice(0,n)}${u}`),cut:!0}}catch{return}}v(parseJsonPrefix,"parseJsonPrefix"),_(parseJsonPrefix,"parseJsonPrefix");export function aiApiOf(t){const s=t.split("?")[0].replace(/\/+$/,"");if(/\/responses$/.test(s))return"responses";if(/\/chat\/completions$/.test(s))return"chat";if(/\/embeddings$/.test(s))return"embeddings";if(/\/messages$/.test(s))return"messages"}v(aiApiOf,"aiApiOf"),_(aiApiOf,"aiApiOf");export function splitToolName(t,s){if(s)return{server:s,tool:t};const n=/^(?:mcp__)?([A-Za-z0-9-]+(?:_[A-Za-z0-9-]+)*)__(.+)$/.exec(t);return n?{server:n[1],tool:n[2]}:{tool:t}}v(splitToolName,"splitToolName"),_(splitToolName,"splitToolName");const $=_((t,s,n={})=>({...n.callId?{callId:n.callId}:{},name:t,...splitToolName(t,n.server),arguments:s,...n.output!==void 0?{output:n.output}:{},...n.error?{error:n.error}:{}}),"toolCall");function M(t,s,n){if(!t)return;if(t.omitted==="ai"){n.push(`The ${s==="request"?"prompt":"answer"} was not kept \u2014 an AI provider\u2019s bodies are kept only when asked for: Settings \u203A
|
|
3
|
+
\r `.includes(t[g]);)g++;if(g>=o)break;i(g),m=g-1}const u=s.map(m=>m.c==="{"?"}":"]").reverse().join("");if(l&&!a)for(let m=0;m<=6;m++)try{return{value:JSON.parse(`${t.slice(0,o-m)}${CUT_MARK}"${u}`),cut:!0}}catch{}if(n)try{return{value:JSON.parse(`${t.slice(0,n)}${u}`),cut:!0}}catch{return}}v(parseJsonPrefix,"parseJsonPrefix"),_(parseJsonPrefix,"parseJsonPrefix");export function aiApiOf(t){const s=t.split("?")[0].replace(/\/+$/,"");if(/\/responses$/.test(s))return"responses";if(/\/chat\/completions$/.test(s))return"chat";if(/\/embeddings$/.test(s))return"embeddings";if(/\/messages$/.test(s))return"messages"}v(aiApiOf,"aiApiOf"),_(aiApiOf,"aiApiOf");export function splitToolName(t,s){if(s)return{server:s,tool:t};const n=/^(?:mcp__)?([A-Za-z0-9-]+(?:_[A-Za-z0-9-]+)*)__(.+)$/.exec(t);return n?{server:n[1],tool:n[2]}:{tool:t}}v(splitToolName,"splitToolName"),_(splitToolName,"splitToolName");const $=_((t,s,n={})=>({...n.callId?{callId:n.callId}:{},name:t,...splitToolName(t,n.server),arguments:s,...n.output!==void 0?{output:n.output}:{},...n.error?{error:n.error}:{}}),"toolCall");function M(t,s,n){if(!t)return;if(t.omitted==="ai"){n.push(`The ${s==="request"?"prompt":"answer"} was not kept \u2014 an AI provider\u2019s bodies are kept only when asked for: Settings \u203A Capture \u203A AI calls, for the calls made after.`);return}if(t.omitted||t.text===void 0)return;const l=parseJsonPrefix(t.text);if(l)return(l.cut||t.truncated)&&n.push(`The ${s} was kept to its first ${F(t.kept)} of ${F(t.size)} \u2014 read as far as it goes; what follows is not shown (the ${s==="request"?"end of the conversation":"rest of the answer"}, marked ${CUT_MARK}).`),l.value}v(M,"E"),_(M,"readBody");function J(t){if(t.data===void 0||t.data==="[DONE]")return;const s=parseJsonPrefix(t.data);return s&&b(s.value)?{v:s.value,cut:s.cut}:void 0}v(J,"M"),_(J,"eventJson");function I(t){if(typeof t=="string")return{text:t,attachments:[]};const s=[],n=[];for(const l of k(t)){if(typeof l=="string"){s.push(l);continue}const a=c(l),r=e(a.type)??"",o=e(a.text)??e(a.refusal);o!==void 0?s.push(o):/image/.test(r)?n.push(e(a.detail)?`image (${e(a.detail)})`:"image"):/file|document/.test(r)?n.push(`file ${e(a.filename)??e(c(a.source).media_type)??e(a.file_id)??""}`.trim()):/audio/.test(r)?n.push("audio"):r&&n.push(r)}return{text:s.join(`
|
|
4
4
|
|
|
5
5
|
`),attachments:n}}v(I,"I"),_(I,"contentOf");const N=_(t=>typeof t=="string"?t:Array.isArray(t)&&I(t).text||A(t),"outputOf");function C(t,s){const n=[];for(const[a,r]of s){let o=t;for(const u of a.split("."))o=c(o)[u];if(o==null)continue;const i=typeof o=="string"?o:typeof o=="number"||typeof o=="boolean"?String(o):b(o)&&e(o.name)?`${e(o.type)??"tool"} ${e(o.name)}`:b(o)&&e(o.type)?e(o.type):JSON.stringify(o);n.push({name:r,value:i})}const l=c(t.metadata);for(const[a,r]of Object.entries(l))n.push({name:`metadata.${a}`,value:typeof r=="string"?r:JSON.stringify(r)});return n}v(C,"O"),_(C,"settingsOf");function O(t,s,n,l){const a=s?t.byCallId.get(s):void 0;if(a){a.output=n,l&&(a.error=l);return}t.call.turns.push({kind:"tool",...$("(an earlier call)","",{callId:s,output:n,error:l})})}v(O,"T"),_(O,"addOutput");function j(t,s){const n={kind:"tool",...s};t.call.turns.push(n),s.callId&&t.byCallId.set(s.callId,n)}v(j,"S"),_(j,"addCall");const ne=[["reasoning.effort","reasoning effort"],["reasoning.summary","reasoning summary"],["max_output_tokens","max output tokens"],["temperature","temperature"],["top_p","top_p"],["tool_choice","tool choice"],["parallel_tool_calls","parallel tool calls"],["text.verbosity","verbosity"],["truncation","truncation"],["previous_response_id","continues response"],["store","store"],["service_tier","service tier"],["stream","stream"],["prompt_cache_key","prompt cache key"],["user","user"],["safety_identifier","safety identifier"]],W=_(t=>A(Object.fromEntries(Object.entries(t).filter(([s])=>s!=="type"&&s!=="id"&&s!=="status"))),"builtInCall");function Z(t,s){const n=e(s.type)??(s.role?"message":"");if(n==="message"){const l=e(s.role)??"user",{text:a,attachments:r}=I(s.content);l==="system"?t.call.system.push({source:"system message",text:a}):t.call.turns.push({kind:"message",role:l,text:a,...r.length?{attachments:r}:{}})}else if(n==="function_call"||n==="custom_tool_call")j(t,$(e(s.name)??"?",e(s.arguments)??A(s.input),{callId:e(s.call_id)}));else if(n==="function_call_output"||n==="custom_tool_call_output"||n==="computer_call_output"||n==="local_shell_call_output")O(t,e(s.call_id),N(s.output));else if(n==="mcp_call")j(t,$(e(s.name)??"?",e(s.arguments)??"",{callId:e(s.id),server:e(s.server_label),...s.output!==void 0&&s.output!==null?{output:N(s.output)}:{},error:e(s.error)}));else if(n==="mcp_list_tools"){const l=k(s.tools).map(a=>e(c(a).name)).filter(Boolean);j(t,$("list_tools","",{server:e(s.server_label),output:l.join(", ")}))}else if(n==="reasoning"){const l=k(s.summary).map(a=>e(c(a).text)).filter(Boolean).join(`
|
|
6
6
|
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
|
|
11
11
|
`)),a.length&&(n.reasoning=a.join(`
|
|
12
12
|
|
|
13
|
-
`))}v(E,"
|
|
13
|
+
`))}v(E,"G"),_(E,"responsesOutput");function H(t,s,n){let l,a=0;const r=new Map,o=new Set,i=new Map,u=new Map,m=new Map;for(const f of s){const g=J(f);if(!g)continue;g.cut&&a++;const p=g.v,y=e(p.type)??f.event,w=h(p.output_index)??0;if(y==="response.completed"||y==="response.incomplete"||y==="response.failed"){if(!g.cut&&b(p.response))l=p.response;else if(b(p.response)){const x=p.response;e(x.status)&&(t.call.answer.status=e(x.status))}}else if(y==="response.created"||y==="response.in_progress"){const x=c(p.response);e(x.model)&&(t.call.model??=e(x.model)),e(x.id)&&(t.call.responseId??=e(x.id))}else y==="response.output_item.added"||y==="response.output_item.done"?b(p.item)&&(!o.has(w)||!g.cut)&&(r.set(w,{...r.get(w)??{},...p.item}),y.endsWith(".done")&&!g.cut&&o.add(w)):y==="response.output_text.delta"||y==="response.refusal.delta"?i.set(w,(i.get(w)??"")+(e(p.delta)??"")):y==="response.output_text.done"&&!g.cut&&e(p.text)!==void 0?i.set(w,e(p.text)):y==="response.function_call_arguments.delta"||y==="response.custom_tool_call_input.delta"||y==="response.mcp_call_arguments.delta"?u.set(w,(u.get(w)??"")+(e(p.delta)??"")):(y==="response.function_call_arguments.done"||y==="response.mcp_call_arguments.done")&&!g.cut&&e(p.arguments)!==void 0?u.set(w,e(p.arguments)):y==="response.reasoning_summary_text.delta"?m.set(w,(m.get(w)??"")+(e(p.delta)??"")):(y==="error"||y==="response.error")&&(t.call.answer.error=e(p.message)??e(c(p.error).message)??"the stream reported an error")}if(l){q(t,l);return}const d=[...r.entries()].sort(([f],[g])=>f-g).map(([f,g])=>{if(o.has(f))return g;const p=e(g.type);return p==="message"&&i.has(f)?{...g,content:[{type:"output_text",text:i.get(f)}]}:(p==="function_call"||p==="mcp_call")&&u.has(f)?{...g,arguments:u.get(f)}:p==="custom_tool_call"&&u.has(f)?{...g,input:u.get(f)}:p==="reasoning"&&m.has(f)?{...g,summary:[{type:"summary_text",text:m.get(f)}]}:g});for(const[f,g]of i)r.has(f)||d.push({type:"message",content:[{type:"output_text",text:g}]});E(t,d),t.call.answer.status||(t.call.answer.status=d.length?"completed":"unknown"),a&&n.push(`${a} of the stream\u2019s events were kept to their first 4 KB, so the answer was rebuilt from its pieces${t.call.usage?"":" \u2014 its token counts came in the last event, which was cut"}.`)}v(H,"Z"),_(H,"responsesStream");function R(t,s,n,l){const a=t.call;e(s.model)&&(a.model=e(s.model)),e(s.instructions)&&a.system.push({source:"instructions",text:e(s.instructions)});const r=s.input;if(typeof r=="string")a.turns.push({kind:"message",role:"user",text:r});else for(const i of k(r))b(i)&&Z(t,i);a.tools=D(s),a.settings=C(s,ne);const o=c(c(s.text).format);e(o.type)&&o.type!=="text"&&(a.answer.format={type:e(o.type),...e(o.name)?{name:e(o.name)}:{},...o.schema!==void 0?{schema:o.schema}:{},...typeof o.strict=="boolean"?{strict:o.strict}:{}}),T(t,n,l,i=>q(t,i),i=>H(t,i,l))}v(R,"D"),_(R,"responsesCall");const re=[["reasoning_effort","reasoning effort"],["max_completion_tokens","max completion tokens"],["max_tokens","max tokens"],["temperature","temperature"],["top_p","top_p"],["tool_choice","tool choice"],["parallel_tool_calls","parallel tool calls"],["n","n"],["seed","seed"],["stop","stop"],["presence_penalty","presence penalty"],["frequency_penalty","frequency penalty"],["verbosity","verbosity"],["store","store"],["service_tier","service tier"],["stream","stream"],["user","user"]];function K(t){const s=k(t.tool_calls).map(c).map(l=>{const a=c(l.function);return $(e(a.name)??e(c(l.custom).name)??"?",e(a.arguments)??e(c(l.custom).input)??"",{callId:e(l.id)})}),n=c(t.function_call);return e(n.name)&&s.push($(e(n.name),e(n.arguments)??"",{})),s}v(K,"L"),_(K,"chatCalls");function z(t,s){const n=t.call.answer;e(s.model)&&(t.call.model??=e(s.model)),e(s.id)&&(t.call.responseId??=e(s.id));const l=c(k(s.choices)[0]),a=c(l.message),r=I(a.content).text;r&&(n.text=r),e(a.refusal)&&(n.refusal=e(a.refusal));const o=e(a.reasoning_content)??e(a.reasoning);o&&(n.reasoning=o),n.toolCalls.push(...K(a)),e(l.finish_reason)&&(n.finish=e(l.finish_reason)),n.status=n.finish?"completed":n.status??"unknown";const i=c(s.error);e(i.message)&&(n.error=e(i.message));const u=c(s.usage);Object.keys(u).length&&(t.call.usage={...h(u.prompt_tokens)!==void 0?{input:h(u.prompt_tokens)}:{},...h(c(u.prompt_tokens_details).cached_tokens)!==void 0?{cached:h(c(u.prompt_tokens_details).cached_tokens)}:{},...h(c(u.prompt_tokens_details).cache_write_tokens)?{written:h(c(u.prompt_tokens_details).cache_write_tokens)}:{},...h(u.completion_tokens)!==void 0?{output:h(u.completion_tokens)}:{},...h(c(u.completion_tokens_details).reasoning_tokens)!==void 0?{reasoning:h(c(u.completion_tokens_details).reasoning_tokens)}:{},...h(u.total_tokens)!==void 0?{total:h(u.total_tokens)}:{}})}v(z,"P"),_(z,"chatAnswer");function G(t,s,n){let l="",a="",r="",o,i,u,m,d=0;const f=new Map;for(const p of s){const y=J(p);if(!y)continue;y.cut&&d++,u??=e(y.v.model),m??=e(y.v.id),b(y.v.usage)&&(i=y.v.usage),b(y.v.error)&&(t.call.answer.error=e(y.v.error.message)??"the stream reported an error");const w=c(k(y.v.choices)[0]),x=c(w.delta);l+=e(x.content)??"",a+=e(x.reasoning_content)??e(x.reasoning)??"",r+=e(x.refusal)??"";for(const S of k(x.tool_calls).map(c)){const P=h(S.index)??0,B=f.get(P)??{name:"",args:""},U=c(S.function);e(S.id)&&(B.id=e(S.id)),B.name+=e(U.name)??"",B.args+=e(U.arguments)??"",f.set(P,B)}e(w.finish_reason)&&(o=e(w.finish_reason))}const g={content:l,...a?{reasoning_content:a}:{},...r?{refusal:r}:{},tool_calls:[...f.entries()].sort(([p],[y])=>p-y).map(([,p])=>({id:p.id,function:{name:p.name,arguments:p.args}}))};z(t,{...u?{model:u}:{},...m?{id:m}:{},choices:[{message:g,...o?{finish_reason:o}:{}}],...i?{usage:i}:{}}),d&&n.push(`${d} of the stream\u2019s chunks were kept to their first 4 KB \u2014 the answer was joined from what was kept of them.`)}v(G,"V"),_(G,"chatStream");function Q(t,s,n,l){const a=t.call;e(s.model)&&(a.model=e(s.model));for(const o of k(s.messages).map(c)){const i=e(o.role)??"user",{text:u,attachments:m}=I(o.content);if(i==="system")a.system.push({source:"system message",text:u});else if(i==="tool")O(t,e(o.tool_call_id),u);else if(i==="function")O(t,void 0,u);else{(u||m.length||i!=="assistant")&&a.turns.push({kind:"message",role:i,text:u,...m.length?{attachments:m}:{}});for(const d of K(o))j(t,d)}}a.tools=[...k(s.tools).map(c),...k(s.functions).map(o=>({type:"function",function:o}))].map(o=>{const i=c(o.function),u=e(o.type)??"function",m=e(i.name)??e(c(o.custom).name)??u;return{name:m,...splitToolName(m),type:u,...e(i.description)??e(c(o.custom).description)?{description:e(i.description)??e(c(o.custom).description)}:{},...i.parameters!==void 0?{parameters:i.parameters}:{},...typeof i.strict=="boolean"?{strict:i.strict}:{},called:0}}),a.settings=C(s,re);const r=c(s.response_format);if(e(r.type)&&r.type!=="text"){const o=c(r.json_schema);a.answer.format={type:e(r.type),...e(o.name)?{name:e(o.name)}:{},...o.schema!==void 0?{schema:o.schema}:{},...typeof o.strict=="boolean"?{strict:o.strict}:{}}}T(t,n,l,o=>z(t,o),o=>G(t,o,l))}v(Q,"X"),_(Q,"chatCall");const ae=[["max_tokens","max tokens"],["thinking.budget_tokens","thinking budget"],["temperature","temperature"],["top_p","top_p"],["top_k","top_k"],["tool_choice","tool choice"],["stop_sequences","stop sequences"],["stream","stream"],["metadata.user_id","user"]];function V(t,s,n){if(typeof n=="string"){t.call.turns.push({kind:"message",role:s,text:n});return}const l=[],a=[],r=_(()=>{(l.length||a.length)&&t.call.turns.push({kind:"message",role:s,text:l.join(`
|
|
14
14
|
|
|
15
|
-
`),...a.length?{attachments:[...a]}:{}}),l.length=0,a.length=0},"flush");for(const o of k(n).map(c)){const i=e(o.type)??"";i==="text"?l.push(e(o.text)??""):i==="tool_use"||i==="server_tool_use"||i==="mcp_tool_use"?(r(),j(t,$(e(o.name)??"?",A(o.input),{callId:e(o.id),server:e(o.server_name)}))):i==="tool_result"||i==="mcp_tool_result"||/_tool_result$/.test(i)?(r(),O(t,e(o.tool_use_id),N(o.content),o.is_error===!0?"the tool reported an error":void 0)):i==="thinking"||i==="redacted_thinking"?(r(),t.call.turns.push({kind:"reasoning",...e(o.thinking)?{text:e(o.thinking)}:{}})):a.push(i==="image"?"image":i==="document"?`document ${e(o.title)??""}`.trim():i)}r()}v(V,"ee"),_(V,"anthropicBlocks");function
|
|
15
|
+
`),...a.length?{attachments:[...a]}:{}}),l.length=0,a.length=0},"flush");for(const o of k(n).map(c)){const i=e(o.type)??"";i==="text"?l.push(e(o.text)??""):i==="tool_use"||i==="server_tool_use"||i==="mcp_tool_use"?(r(),j(t,$(e(o.name)??"?",A(o.input),{callId:e(o.id),server:e(o.server_name)}))):i==="tool_result"||i==="mcp_tool_result"||/_tool_result$/.test(i)?(r(),O(t,e(o.tool_use_id),N(o.content),o.is_error===!0?"the tool reported an error":void 0)):i==="thinking"||i==="redacted_thinking"?(r(),t.call.turns.push({kind:"reasoning",...e(o.thinking)?{text:e(o.thinking)}:{}})):a.push(i==="image"?"image":i==="document"?`document ${e(o.title)??""}`.trim():i)}r()}v(V,"ee"),_(V,"anthropicBlocks");function L(t,s){const n=t.call.answer;e(s.model)&&(t.call.model??=e(s.model)),e(s.id)&&(t.call.responseId??=e(s.id));const l=[],a=[];for(const i of k(s.content).map(c)){const u=e(i.type);u==="text"?l.push(e(i.text)??""):u==="tool_use"||u==="server_tool_use"||u==="mcp_tool_use"?n.toolCalls.push($(e(i.name)??"?",A(i.input),{callId:e(i.id),server:e(i.server_name)})):u==="thinking"&&a.push(e(i.thinking)??"")}l.length&&(n.text=l.join(`
|
|
16
16
|
|
|
17
17
|
`)),a.length&&(n.reasoning=a.join(`
|
|
18
18
|
|
|
19
|
-
`)),e(s.stop_reason)&&(n.finish=e(s.stop_reason)),n.status=s.type==="error"?"failed":n.finish?"completed":n.status??"unknown";const r=c(s.error);e(r.message)&&(n.error=e(r.message));const o=c(s.usage);if(Object.keys(o).length){const i=h(o.input_tokens),u=h(o.cache_read_input_tokens),m=h(o.output_tokens);t.call.usage={...i!==void 0?{input:i+(u??0)+(h(o.cache_creation_input_tokens)??0)}:{},...u!==void 0?{cached:u}:{},...h(o.cache_creation_input_tokens)?{written:h(o.cache_creation_input_tokens)}:{},...m!==void 0?{output:m}:{}}}}v(
|
|
19
|
+
`)),e(s.stop_reason)&&(n.finish=e(s.stop_reason)),n.status=s.type==="error"?"failed":n.finish?"completed":n.status??"unknown";const r=c(s.error);e(r.message)&&(n.error=e(r.message));const o=c(s.usage);if(Object.keys(o).length){const i=h(o.input_tokens),u=h(o.cache_read_input_tokens),m=h(o.output_tokens);t.call.usage={...i!==void 0?{input:i+(u??0)+(h(o.cache_creation_input_tokens)??0)}:{},...u!==void 0?{cached:u}:{},...h(o.cache_creation_input_tokens)?{written:h(o.cache_creation_input_tokens)}:{},...m!==void 0?{output:m}:{}}}}v(L,"U"),_(L,"anthropicAnswer");function X(t,s,n){let l={};const a=new Map,r=new Map;let o={},i=0;for(const u of s){const m=J(u);if(!m)continue;m.cut&&i++;const d=m.v,f=e(d.type)??u.event,g=h(d.index)??0;if(f==="message_start")l=c(d.message),o={...c(l.usage)};else if(f==="content_block_start")a.set(g,{...c(d.content_block)});else if(f==="content_block_delta"){const p=c(d.delta),y=a.get(g)??{};e(p.text)!==void 0&&(y.text=(e(y.text)??"")+e(p.text)),e(p.thinking)!==void 0&&(y.thinking=(e(y.thinking)??"")+e(p.thinking)),e(p.partial_json)!==void 0&&r.set(g,(r.get(g)??"")+e(p.partial_json)),a.set(g,y)}else f==="message_delta"?(l={...l,...c(d.delta)},o={...o,...c(d.usage)}):f==="error"&&(t.call.answer.error=e(c(d.error).message)??"the stream reported an error")}for(const[u,m]of r){const d=a.get(u);d&&(d.input=parseJsonPrefix(m)?.value??m)}L(t,{...l,content:[...a.entries()].sort(([u],[m])=>u-m).map(([,u])=>u),usage:o}),i&&n.push(`${i} of the stream\u2019s events were kept to their first 4 KB \u2014 the answer was joined from what was kept of them.`)}v(X,"te"),_(X,"anthropicStream");function Y(t,s,n,l){const a=t.call;e(s.model)&&(a.model=e(s.model));const r=s.system;if(typeof r=="string"&&r)a.system.push({source:"system",text:r});else for(const o of k(r).map(c))e(o.text)&&a.system.push({source:"system",text:e(o.text)});for(const o of k(s.messages).map(c))V(t,e(o.role)??"user",o.content);a.tools=[...k(s.tools).map(c).map(o=>{const i=e(o.name)??e(o.type)??"tool";return{name:i,...splitToolName(i),type:e(o.type)??"custom",...e(o.description)?{description:e(o.description)}:{},...o.input_schema!==void 0?{parameters:o.input_schema}:{},called:0}}),...k(s.mcp_servers).map(c).map(o=>({name:e(o.name)??"mcp",server:e(o.name)??"mcp",tool:"every tool",type:"mcp",...e(o.url)?{description:e(o.url)}:{},called:0}))],a.settings=C(s,ae),T(t,n,l,o=>L(t,o),o=>X(t,o,l))}v(Y,"ne"),_(Y,"anthropicCall");function ee(t,s,n,l){const a=t.call;e(s.model)&&(a.model=e(s.model));const r=s.input,o=typeof r=="string"?[r]:k(r),i=o.slice(0,200).map(p=>typeof p=="string"?p:typeof p=="number"?`token ${p}`:Array.isArray(p)?`${p.length} tokens`:A(p)),u=o.length>0&&o.every(p=>typeof p=="number");a.embedding={inputs:u?[`${o.length} tokens`]:i,count:u?1:o.length,...h(s.dimensions)!==void 0?{dimensions:h(s.dimensions)}:{}},a.settings=C(s,[["dimensions","dimensions"],["encoding_format","encoding"],["user","user"]]);const m=c(M(n.response.body,"answer",[])),d=k(m.data);if(d.length){a.embedding.vectors=d.length;const p=c(d[0]).embedding;Array.isArray(p)&&a.embedding.dimensions===void 0&&(a.embedding.dimensions=p.length)}const f=c(m.usage);h(f.prompt_tokens)!==void 0&&(a.usage={input:h(f.prompt_tokens),...h(f.total_tokens)!==void 0?{total:h(f.total_tokens)}:{}}),a.answer.status=n.status!==void 0&&n.status<400?"completed":"failed";const g=c(m.error);e(g.message)&&(a.answer.error=e(g.message))}v(ee,"se"),_(ee,"embeddingsCall");function T(t,s,n,l,a){const r=s.response.stream;if(r){if(r.events.length&&r.events.every(i=>i.data===void 0)){n.push("The answer streamed, and only each event\u2019s name, time and size were kept \u2014 an AI provider\u2019s bodies are kept only when asked for: Settings \u203A Capture \u203A AI calls.");return}a(r.events),r.cut&&n.push(`The stream was cut after ${r.events.length.toLocaleString("en-US")} of its ${r.total.toLocaleString("en-US")} events \u2014 what came after is not shown.`);return}const o=M(s.response.body,"answer",n);b(o)?l(o):s.error&&(t.call.answer.error=s.error),t.call.answer.status||(t.call.answer.status=s.error||(s.status??0)>=400?"failed":"unknown")}v(T,"N"),_(T,"answerOf");function te(t){return t.api==="embeddings"?"embedding":t.answer.format&&/json/.test(t.answer.format.type)?"decision":t.tools.length||t.answer.toolCalls.length||t.turns.some(s=>s.kind==="tool")?"tools":t.turns.filter(s=>s.kind==="message"&&(s.role==="user"||s.role==="assistant")).length>1?"chat":"prompt"}v(te,"oe"),_(te,"shapeOf");export function aiCallOf(t){if(!t.ai)return;const s=aiApiOf(t.path);if(!s)return;const n=[],l={call:{provider:t.ai.provider,api:s,shape:"prompt",settings:[],system:[],turns:[],tools:[],answer:{toolCalls:[]},gaps:n},byCallId:new Map},a=c(M(t.request.body,"request",n));s==="responses"?R(l,a,t,n):s==="chat"?Q(l,a,t,n):s==="messages"?Y(l,a,t,n):ee(l,a,t,n);const r=l.call;if(r.answer.text!==void 0&&(r.answer.format?/json/.test(r.answer.format.type):/^\s*[{[]/.test(r.answer.text))){const i=parseJsonPrefix(r.answer.text);i&&(b(i.value)||Array.isArray(i.value))&&(r.answer.json=i.value)}!r.answer.finish&&r.answer.toolCalls.length&&(r.answer.finish="tool calls");const o=new Map;for(const i of r.turns)i.kind==="tool"&&o.set(i.name,(o.get(i.name)??0)+1);for(const i of r.answer.toolCalls)o.set(i.name,(o.get(i.name)??0)+1);for(const i of r.tools)i.called=o.get(i.name)??0;r.shape=te(r);for(const i of r.system)i.text.endsWith(CUT_MARK)&&(i.cut=!0);return r}v(aiCallOf,"aiCallOf"),_(aiCallOf,"aiCallOf");export const SHAPE_LABEL={prompt:"Single prompt",chat:"Conversation",tools:"Tool calling",decision:"Structured decision",embedding:"Embedding"};export function prettyJson(t){const s=t.trim()?parseJsonPrefix(t):void 0;return s&&(b(s.value)||Array.isArray(s.value))?{value:s.value,text:t}:{text:t}}v(prettyJson,"prettyJson"),_(prettyJson,"prettyJson");
|
package/lib/dashboard.d.ts
CHANGED
|
@@ -271,6 +271,11 @@ export interface DashCluster {
|
|
|
271
271
|
}>;
|
|
272
272
|
/** This project's worktree INSTANCES the gateway knows (`lensmcp instance start`) — running or stopped. */
|
|
273
273
|
worktrees?: DashWorktree[];
|
|
274
|
+
/**
|
|
275
|
+
* Worktrees still on record whose folder is no longer a checkout — removed, or removed with a failure the lens recorded
|
|
276
|
+
* — left out of `worktrees`: `lensmcp instance prune` forgets them and drops the data the lens made for them.
|
|
277
|
+
*/
|
|
278
|
+
worktreesGone?: number;
|
|
274
279
|
/** Set when THIS dashboard is a worktree instance's: whose worktree it is. */
|
|
275
280
|
instance?: {
|
|
276
281
|
name: string;
|
|
@@ -965,6 +970,7 @@ export interface DashSummary {
|
|
|
965
970
|
troubled: number;
|
|
966
971
|
instance?: DashCluster['instance'];
|
|
967
972
|
worktrees?: DashWorktree[];
|
|
973
|
+
worktreesGone?: number;
|
|
968
974
|
};
|
|
969
975
|
/** `DashSession.setupIssues.length`. */
|
|
970
976
|
setupIssues?: number;
|
|
@@ -3702,3 +3708,87 @@ export interface DashVersions {
|
|
|
3702
3708
|
};
|
|
3703
3709
|
processes: DashRunningVersion[];
|
|
3704
3710
|
}
|
|
3711
|
+
/** Where a setting's value comes from: its default, this machine, this repository's `lensmcp.json`, or the environment. */
|
|
3712
|
+
export type DashSettingSource = 'default' | 'machine' | 'repository' | 'env';
|
|
3713
|
+
/** When a change reaches what reads it: at once, when a service starts again, when the lens starts again, when the gateway starts again. */
|
|
3714
|
+
export type DashSettingApplies = 'now' | 'service' | 'lens' | 'gateway';
|
|
3715
|
+
/** One row of a Settings page: a card's switch (`switch`) or a variable kept as a setting (`variable`). */
|
|
3716
|
+
export interface DashSettingRow {
|
|
3717
|
+
/** A switch's key (`sqlValues`) or a variable's name (`LENSMCP_TYPECHECK`): what `POST /api/settings` takes. */
|
|
3718
|
+
key: string;
|
|
3719
|
+
kind: 'switch' | 'variable';
|
|
3720
|
+
title: string;
|
|
3721
|
+
/** One or two sentences: what it does, and what the other value does. */
|
|
3722
|
+
desc: string;
|
|
3723
|
+
value: string | number;
|
|
3724
|
+
default: string | number;
|
|
3725
|
+
/** The values it takes, each with its word. `on`/`off` alone: the screen draws a switch. */
|
|
3726
|
+
options?: Array<{
|
|
3727
|
+
value: string | number;
|
|
3728
|
+
label: string;
|
|
3729
|
+
}>;
|
|
3730
|
+
/** A number: the unit it is edited in, what one of that unit is in the stored value, its bounds, and what 0 means. */
|
|
3731
|
+
number?: {
|
|
3732
|
+
unit: string;
|
|
3733
|
+
scale?: number;
|
|
3734
|
+
min?: number;
|
|
3735
|
+
max?: number;
|
|
3736
|
+
zero?: string;
|
|
3737
|
+
};
|
|
3738
|
+
/** `usd`: dollars a day, the usual amounts with a click or any amount typed. */
|
|
3739
|
+
unit?: 'usd';
|
|
3740
|
+
kept: 'repository' | 'machine';
|
|
3741
|
+
source: DashSettingSource;
|
|
3742
|
+
/** The variable that sets it in a process's environment. Set there, it wins and the row is locked. */
|
|
3743
|
+
env?: string;
|
|
3744
|
+
/** Where the environment's value comes from when it is set: `shell`, or the dotenv file that declares it. */
|
|
3745
|
+
envFrom?: string;
|
|
3746
|
+
applies: DashSettingApplies;
|
|
3747
|
+
/** Turning it up spends from the person's API keys. */
|
|
3748
|
+
costs?: boolean;
|
|
3749
|
+
/** Its feature is off: the value reads off until the feature is on again. */
|
|
3750
|
+
featureOff?: {
|
|
3751
|
+
id: string;
|
|
3752
|
+
title: string;
|
|
3753
|
+
};
|
|
3754
|
+
/** Today's spend, for a daily allowance. */
|
|
3755
|
+
spentToday?: number;
|
|
3756
|
+
}
|
|
3757
|
+
export interface DashSettingSection {
|
|
3758
|
+
title: string;
|
|
3759
|
+
desc?: string;
|
|
3760
|
+
rows: DashSettingRow[];
|
|
3761
|
+
}
|
|
3762
|
+
/** A documented variable on «All variables»: its value in the lens's environment and where that comes from. */
|
|
3763
|
+
export interface DashSettingVariable {
|
|
3764
|
+
name: string;
|
|
3765
|
+
/** The section of the variables reference it is in (`Pod lifecycle`, `Event history`…). */
|
|
3766
|
+
group: string;
|
|
3767
|
+
default: string;
|
|
3768
|
+
desc: string;
|
|
3769
|
+
value?: string;
|
|
3770
|
+
source: DashSettingSource | 'unset';
|
|
3771
|
+
envFrom?: string;
|
|
3772
|
+
/** It is a setting too: the page that edits it. */
|
|
3773
|
+
page?: string;
|
|
3774
|
+
}
|
|
3775
|
+
export interface DashSettings {
|
|
3776
|
+
workspace: string;
|
|
3777
|
+
at: number;
|
|
3778
|
+
/** Each page's sections, by page id (`capture`, `typecheck`…). Pages drawn by the screen alone are absent. */
|
|
3779
|
+
pages: Record<string, DashSettingSection[]>;
|
|
3780
|
+
variables: DashSettingVariable[];
|
|
3781
|
+
files: {
|
|
3782
|
+
repository: string;
|
|
3783
|
+
repositoryExists: boolean;
|
|
3784
|
+
machine: string;
|
|
3785
|
+
};
|
|
3786
|
+
/** Machine switches are kept in the workspace history: false when there is none, and those rows cannot change. */
|
|
3787
|
+
kept: boolean;
|
|
3788
|
+
}
|
|
3789
|
+
/** What `POST /api/settings` answers: the row as it is now, and the value it had — what Undo sends back. */
|
|
3790
|
+
export interface DashSettingSaved {
|
|
3791
|
+
row: DashSettingRow;
|
|
3792
|
+
/** The value before; null: it was not set (the default, or the environment's). */
|
|
3793
|
+
previous: string | number | null;
|
|
3794
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { DashTeamKind, DashTeamOutcome, DashTeamTaskState } from './team.js';
|
|
2
|
+
/**
|
|
3
|
+
* A goal's outcome row (planning/team/18 RT-D16): its run's outcomes in numbers, written when its archive is, or by the
|
|
4
|
+
* retrospective for a goal that never archives, and kept in the coordination store. Later retrospectives grade the
|
|
5
|
+
* changes applied after a goal against the rows of the goals that follow it; a row says nothing about why.
|
|
6
|
+
*/
|
|
7
|
+
export interface DashGoalOutcome {
|
|
8
|
+
schema: 1;
|
|
9
|
+
goalId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
repoId: string;
|
|
12
|
+
/** What wrote it: the goal's archive, or a retrospective of a goal with none. */
|
|
13
|
+
source: 'archive' | 'retrospective';
|
|
14
|
+
writtenAt: number;
|
|
15
|
+
/** The run review's window — `open`: the goal was still running. */
|
|
16
|
+
window: {
|
|
17
|
+
from: number;
|
|
18
|
+
to: number;
|
|
19
|
+
open: boolean;
|
|
20
|
+
};
|
|
21
|
+
state: DashTeamTaskState;
|
|
22
|
+
outcome?: DashTeamOutcome;
|
|
23
|
+
/** The lensmcp that wrote the row. */
|
|
24
|
+
lensmcp?: string;
|
|
25
|
+
changes: DashGoalOutcomeChanges;
|
|
26
|
+
/** Bugs filed against, and tests failed on, a change a review had approved — the verdicts an outcome contradicted. */
|
|
27
|
+
afterApproval: DashGoalOutcomeContradiction[];
|
|
28
|
+
/** Per check: seeded, its verdicts, caught later (check-counts.ts), without the review ids. */
|
|
29
|
+
checks: DashGoalOutcomeCheck[];
|
|
30
|
+
qa: {
|
|
31
|
+
runs: number;
|
|
32
|
+
passed: number;
|
|
33
|
+
failed: number;
|
|
34
|
+
};
|
|
35
|
+
/** Per kind of task: how many, ms waited from created to first claim, ms worked from first claim to closed. */
|
|
36
|
+
time: Partial<Record<DashTeamKind, {
|
|
37
|
+
tasks: number;
|
|
38
|
+
waited: number;
|
|
39
|
+
worked: number;
|
|
40
|
+
}>>;
|
|
41
|
+
sessions: DashGoalOutcomeSessions;
|
|
42
|
+
/** The run's model tokens (input with cache, and output), corrected as foodguard-157 made them; per change made. */
|
|
43
|
+
tokens?: {
|
|
44
|
+
total: number;
|
|
45
|
+
perChange?: number;
|
|
46
|
+
};
|
|
47
|
+
/** The paths the goal's work named or edited, at most 300 — what a proposal's path scope is matched against. */
|
|
48
|
+
touched?: string[];
|
|
49
|
+
/** The run review's flags by kind. */
|
|
50
|
+
flags: Record<string, number>;
|
|
51
|
+
/** What the agents worked under (RT-D5): each role's rules hash and when it was in force, the flow's, the checks'. */
|
|
52
|
+
inForce: DashGoalInForce;
|
|
53
|
+
/**
|
|
54
|
+
* The lessons the run's claims were told (RT-D15), each with the claims and changes it was told on, and the bugs filed
|
|
55
|
+
* and tests failed after an approval on those changes — what grades a lesson beyond its finding's acceptance check.
|
|
56
|
+
* Absent on a row a lensmcp before this wrote.
|
|
57
|
+
*/
|
|
58
|
+
lessons?: DashGoalOutcomeLesson[];
|
|
59
|
+
/**
|
|
60
|
+
* Transcript mistakes LensMCP's recipes counted (planning/team/18 gate 7) — kept by the goal's retrospective, which
|
|
61
|
+
* reads the transcripts; absent on a row no retrospective read.
|
|
62
|
+
*/
|
|
63
|
+
transcripts?: DashGoalTranscripts;
|
|
64
|
+
/** Items left out past a cap — the row counts what it read. */
|
|
65
|
+
truncated?: {
|
|
66
|
+
tasks?: number;
|
|
67
|
+
joins?: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface DashGoalOutcomeChanges {
|
|
71
|
+
/** Builds and bugs the team made. */
|
|
72
|
+
total: number;
|
|
73
|
+
/** Those with at least one review, and those whose every reviewing role's newest review approved. */
|
|
74
|
+
reviewed: number;
|
|
75
|
+
approved: number;
|
|
76
|
+
/** Those reworked at least once, and the rework rounds of all of them. */
|
|
77
|
+
reworked: number;
|
|
78
|
+
reworkRounds: number;
|
|
79
|
+
/** Reviewed changes by rework rounds: `{ "0": 5, "1": 2, "2": 1 }`. */
|
|
80
|
+
byRounds: Record<string, number>;
|
|
81
|
+
}
|
|
82
|
+
export interface DashGoalOutcomeContradiction {
|
|
83
|
+
/** The bug filed, or the test that failed. */
|
|
84
|
+
taskId: string;
|
|
85
|
+
kind: 'bug' | 'test';
|
|
86
|
+
/** The change it contradicts, and the reviews that had approved it. */
|
|
87
|
+
changeId: string;
|
|
88
|
+
approvedBy: string[];
|
|
89
|
+
/** The paths it and the change share — the change's own when it names none. */
|
|
90
|
+
paths: string[];
|
|
91
|
+
/** The check families the approving reviews passed or ruled n/a. */
|
|
92
|
+
families: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface DashGoalTranscripts {
|
|
95
|
+
/** Transcripts read, their bytes, and those cut or left out past the caps. */
|
|
96
|
+
agents: number;
|
|
97
|
+
bytes: number;
|
|
98
|
+
cut?: number;
|
|
99
|
+
/** By recipe: lines matched and the agents they came from; for repeated errors, groups and their keys (`5× Error: …`). */
|
|
100
|
+
recipes: Partial<Record<string, {
|
|
101
|
+
count: number;
|
|
102
|
+
agents: number;
|
|
103
|
+
keys?: string[];
|
|
104
|
+
}>>;
|
|
105
|
+
}
|
|
106
|
+
export interface DashGoalOutcomeLesson {
|
|
107
|
+
id: string;
|
|
108
|
+
/** Claims it was told at, and the changes (builds and bugs) those claims were on. */
|
|
109
|
+
told: number;
|
|
110
|
+
changes: number;
|
|
111
|
+
/** The afterApproval rows on a change it was told on: the bug or test's task id — it was told, and it did not hold. */
|
|
112
|
+
missed: string[];
|
|
113
|
+
}
|
|
114
|
+
export type DashGoalOutcomeCheck = {
|
|
115
|
+
id: string;
|
|
116
|
+
family: string;
|
|
117
|
+
level?: 'must' | 'should';
|
|
118
|
+
seeded: number;
|
|
119
|
+
pass: number;
|
|
120
|
+
fail: number;
|
|
121
|
+
na: number;
|
|
122
|
+
open: number;
|
|
123
|
+
caughtLater: number;
|
|
124
|
+
};
|
|
125
|
+
export interface DashGoalOutcomeSessions {
|
|
126
|
+
/** Agents with a session, by the role they held longest. */
|
|
127
|
+
byRole: Record<string, number>;
|
|
128
|
+
/** Agents that claimed work and completed none. */
|
|
129
|
+
finishedNothing: number;
|
|
130
|
+
/** Spawned agents that never joined. */
|
|
131
|
+
unjoined: number;
|
|
132
|
+
}
|
|
133
|
+
export interface DashGoalInForce {
|
|
134
|
+
/** Each role's rules hash, in the order first joined: how many joins carried it, and when the first and last were. */
|
|
135
|
+
roles: Array<{
|
|
136
|
+
role: string;
|
|
137
|
+
rulesHash: string;
|
|
138
|
+
joins: number;
|
|
139
|
+
from: number;
|
|
140
|
+
to: number;
|
|
141
|
+
}>;
|
|
142
|
+
/** The flow's (flow.json and its caps) and the check catalog's hashes the joins saw. */
|
|
143
|
+
flow: string[];
|
|
144
|
+
checks: string[];
|
|
145
|
+
/** Joins from a lensmcp too old to record what it sent. */
|
|
146
|
+
unrecorded: number;
|
|
147
|
+
/**
|
|
148
|
+
* The lensmcp versions that served the joins, in the order first seen, with the roles that joined through each: two
|
|
149
|
+
* versions in one goal is LensMCP's own rules changing under it (a lens upgraded mid-run, or a worktree's older lens).
|
|
150
|
+
* Absent on a row a lensmcp before this recorded, and empty when no join recorded its version.
|
|
151
|
+
*/
|
|
152
|
+
lensmcp?: Array<{
|
|
153
|
+
version: string;
|
|
154
|
+
joins: number;
|
|
155
|
+
roles: string[];
|
|
156
|
+
from: number;
|
|
157
|
+
to: number;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A goal's retrospective run (planning/team/18 RT-D1, RT-D2): queued when the goal's archive is written or the person
|
|
3
|
+
* clicks, run by the lens — a digest code builds, one Opus call only when a gate fired — and what it wrote: the goal's
|
|
4
|
+
* account, the findings it proposed, those it merged into a live one, those it dropped and why, the grades it read first.
|
|
5
|
+
*/
|
|
6
|
+
export type DashGoalRetroState = 'queued' | 'running' | 'waiting' | 'done' | 'failed';
|
|
7
|
+
export interface DashGoalRetroGate {
|
|
8
|
+
id: string;
|
|
9
|
+
rank: number;
|
|
10
|
+
fired: boolean;
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DashGoalRetro {
|
|
14
|
+
schema: 1;
|
|
15
|
+
goalId: string;
|
|
16
|
+
repoId: string;
|
|
17
|
+
title: string;
|
|
18
|
+
/** Who asked: the goal's archive (it completed), or the person. */
|
|
19
|
+
by: 'archive' | 'person';
|
|
20
|
+
queuedAt: number;
|
|
21
|
+
state: DashGoalRetroState;
|
|
22
|
+
/** What it waits on: Retrospectives switched off, no working key, the day's allowance spent. */
|
|
23
|
+
wait?: 'off' | 'key' | 'allowance';
|
|
24
|
+
reason?: string;
|
|
25
|
+
startedAt?: number;
|
|
26
|
+
endedAt?: number;
|
|
27
|
+
gates?: DashGoalRetroGate[];
|
|
28
|
+
/** The goal's account (markdown): where time went, what nobody knew, how earlier fixes fared. */
|
|
29
|
+
account?: string;
|
|
30
|
+
/** Findings it wrote, those a new sighting merged into, and the proposals it dropped with why. */
|
|
31
|
+
findings?: string[];
|
|
32
|
+
merged?: string[];
|
|
33
|
+
dropped?: string[];
|
|
34
|
+
/** The earlier proposals it graded before proposing (RT-D16). */
|
|
35
|
+
graded?: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
verdict: string;
|
|
38
|
+
}>;
|
|
39
|
+
costUsd?: number;
|
|
40
|
+
model?: string;
|
|
41
|
+
toolCalls?: number;
|
|
42
|
+
digestBytes?: number;
|
|
43
|
+
/** The goal's earlier runs, newest last (at most 10): what each cost counts toward its day's allowance. */
|
|
44
|
+
earlier?: Array<{
|
|
45
|
+
endedAt: number;
|
|
46
|
+
state: DashGoalRetroState;
|
|
47
|
+
costUsd: number;
|
|
48
|
+
findings: number;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
/** `/api/team/retro?id=` — a goal's retrospective (none yet: null), and the day's allowance for them. */
|
|
52
|
+
export interface DashGoalRetroAnswer {
|
|
53
|
+
retro: DashGoalRetro | null;
|
|
54
|
+
allowance: {
|
|
55
|
+
on: boolean;
|
|
56
|
+
dailyUsd: number;
|
|
57
|
+
runUsd: number;
|
|
58
|
+
spentTodayUsd: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{};
|
|
@@ -83,6 +83,49 @@ export type DashFindingAction = {
|
|
|
83
83
|
kind: 'issue';
|
|
84
84
|
title: string;
|
|
85
85
|
draft: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A check file in the project's layer (planning/team/18 RT-D7): `add` a new one, `narrow` one with the same id (the
|
|
89
|
+
* whole file both times), or `off` — never for a must check of the security or data families. Written uncommitted.
|
|
90
|
+
*/
|
|
91
|
+
| {
|
|
92
|
+
kind: 'check';
|
|
93
|
+
repoId: string;
|
|
94
|
+
id: string;
|
|
95
|
+
op: 'add' | 'narrow' | 'off';
|
|
96
|
+
text?: string;
|
|
97
|
+
why?: string;
|
|
98
|
+
level?: 'must' | 'should';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One rule of `project.md` or a role file, by its anchor — the rule's exact text, found exactly once: `add` a line
|
|
102
|
+
* after it, `edit` it, `retire` its line. Refused past the brief's cut or a role's budget. Written uncommitted.
|
|
103
|
+
*/
|
|
104
|
+
| {
|
|
105
|
+
kind: 'rule';
|
|
106
|
+
repoId: string;
|
|
107
|
+
file: string;
|
|
108
|
+
op: 'add' | 'edit' | 'retire';
|
|
109
|
+
anchor: string;
|
|
110
|
+
text?: string;
|
|
111
|
+
}
|
|
112
|
+
/** `flow.json` keys set (caps, goal, handOffs; null takes one out) — refused below the lensmcp that reads them. */
|
|
113
|
+
| {
|
|
114
|
+
kind: 'flow';
|
|
115
|
+
repoId: string;
|
|
116
|
+
set: Record<string, unknown>;
|
|
117
|
+
minLensmcp?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A team lesson (planning/team/18 RT-D15), `.lensmcp/team/lessons/<id>.md`: `add` the whole file (a fact, its roles and
|
|
121
|
+
* paths, the file:line it cites; LensMCP sets its expiry, 90 days), `renew` its expiry, `retire` it. Written uncommitted.
|
|
122
|
+
*/
|
|
123
|
+
| {
|
|
124
|
+
kind: 'lesson';
|
|
125
|
+
repoId: string;
|
|
126
|
+
id: string;
|
|
127
|
+
op: 'add' | 'renew' | 'retire';
|
|
128
|
+
text?: string;
|
|
86
129
|
};
|
|
87
130
|
export type DashFindingActionKind = DashFindingAction['kind'];
|
|
88
131
|
/** The kinds Apply runs itself; any other is the person's — but an `issue`, run once the issues folder is set (S6). */
|
|
@@ -99,6 +142,9 @@ export interface DashFindingActionResult {
|
|
|
99
142
|
kind: DashFindingActionKind;
|
|
100
143
|
outcome: 'ran' | 'yours' | 'failed';
|
|
101
144
|
message?: string;
|
|
145
|
+
/** A file it wrote, and the sha-256 of what it wrote — a later edit outside Apply is the person's (planning/team/18 RT-D14). */
|
|
146
|
+
path?: string;
|
|
147
|
+
sha?: string;
|
|
102
148
|
}
|
|
103
149
|
/** The newest Apply: every action run (or the person's) — or, not ok, the ones that failed; the finding stays proposed. */
|
|
104
150
|
export interface DashFindingApply {
|
|
@@ -117,8 +163,62 @@ export interface DashFindingDismissed {
|
|
|
117
163
|
}
|
|
118
164
|
export interface DashFindingFixed {
|
|
119
165
|
at: number;
|
|
120
|
-
/**
|
|
121
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Its proposal applied and its checks ok for 24 h; its checks ok for 24 h with nothing applied; the overseer said so;
|
|
168
|
+
* its acceptance check held on the goals after it (planning/team/18 RT-D16).
|
|
169
|
+
*/
|
|
170
|
+
how: 'applied' | 'cleared' | 'overseer' | 'held';
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* How an applied proposal is judged on the goals after it (planning/team/18 RT-D16): a metric read from their outcome
|
|
174
|
+
* rows, with no model. `metric` is one of:
|
|
175
|
+
* - `check.caughtLater:<id>`, `check.fail:<id>`: per seeding of the check;
|
|
176
|
+
* - `afterApproval`, `afterApproval.family:<family>`: bugs and failed tests after an approval, per reviewed change;
|
|
177
|
+
* - `rework.rounds`: per reviewed change;
|
|
178
|
+
* - `flags:<kind>`: per goal;
|
|
179
|
+
* - `sessions.finishedNothing`: per session;
|
|
180
|
+
* - `wait:<kind>`: ms waited per ms worked, for tasks of the kind;
|
|
181
|
+
* - `tokens.perChange`: per change made.
|
|
182
|
+
*/
|
|
183
|
+
export interface DashFindingAcceptance {
|
|
184
|
+
metric: string;
|
|
185
|
+
/** The goals it is judged on: those touching one of these roles or paths — none: every goal of its repository. */
|
|
186
|
+
scope?: {
|
|
187
|
+
roles?: string[];
|
|
188
|
+
paths?: string[];
|
|
189
|
+
};
|
|
190
|
+
/** The metric over the goals it came from, and what it must reach: at most (`down`) or at least (`up`). */
|
|
191
|
+
baseline: number;
|
|
192
|
+
target: number;
|
|
193
|
+
direction: 'down' | 'up';
|
|
194
|
+
/** The next `goals` goals in scope (3), or what `days` (21) brought. */
|
|
195
|
+
goals: number;
|
|
196
|
+
days: number;
|
|
197
|
+
/** The least exposure a verdict needs (3): seedings, reviewed changes, sessions, tasks of the kind, goals. */
|
|
198
|
+
minExposure: number;
|
|
199
|
+
/** One metric that must not get worse by more than `tolerance`, a fraction of its baseline (0.25). */
|
|
200
|
+
counter?: {
|
|
201
|
+
metric: string;
|
|
202
|
+
baseline: number;
|
|
203
|
+
direction: 'down' | 'up';
|
|
204
|
+
tolerance: number;
|
|
205
|
+
};
|
|
206
|
+
/** The goals its baseline was read from: never graded on them. */
|
|
207
|
+
from?: string[];
|
|
208
|
+
}
|
|
209
|
+
export type DashFindingGradeVerdict = 'held' | 'not-held' | 'side-effect' | 'unexposed' | 'expired';
|
|
210
|
+
/** An applied proposal graded (RT-D16) — a count of recurrence over the goals read, not a claim about cause. */
|
|
211
|
+
export interface DashFindingGrade {
|
|
212
|
+
at: number;
|
|
213
|
+
verdict: DashFindingGradeVerdict;
|
|
214
|
+
/** The goals read, oldest first. */
|
|
215
|
+
goals: string[];
|
|
216
|
+
/** The metric over them, and its exposure; the counter-metric's. */
|
|
217
|
+
value?: number;
|
|
218
|
+
exposure: number;
|
|
219
|
+
counterValue?: number;
|
|
220
|
+
/** Not held or a side effect, across the proposals tried for it: two make a retire or escalate proposal. */
|
|
221
|
+
failures: number;
|
|
122
222
|
}
|
|
123
223
|
/**
|
|
124
224
|
* A LensMCP-cause finding filed as an issue in the lensmcp checkout (planning/team/15 S6, SA-D5): its copy in the
|
|
@@ -166,6 +266,17 @@ export interface DashFinding {
|
|
|
166
266
|
fixed?: DashFindingFixed;
|
|
167
267
|
/** Filed as a LensMCP issue (cause `lensmcp`, the issues folder set). */
|
|
168
268
|
issue?: DashFindingIssue;
|
|
269
|
+
/** How its applied proposal is judged on the goals after it, and the newest grade (planning/team/18 RT-D16). */
|
|
270
|
+
acceptance?: DashFindingAcceptance;
|
|
271
|
+
grade?: DashFindingGrade;
|
|
272
|
+
/** A retrospective wrote it (planning/team/18 RT-D1) — the overseer's otherwise. */
|
|
273
|
+
source?: 'retrospective';
|
|
274
|
+
/** `<repo>:<target>:<signal>` (RT-D8): a new sighting of the same cause merges into it as another goal (RT-D9). */
|
|
275
|
+
causeKey?: string;
|
|
276
|
+
/** The independent goals that showed its cause, oldest first. */
|
|
277
|
+
goals?: string[];
|
|
278
|
+
/** An unapplied retrospective proposal expires then (RT-D9: 14 days). */
|
|
279
|
+
expiresAt?: number;
|
|
169
280
|
createdAt: number;
|
|
170
281
|
updatedAt: number;
|
|
171
282
|
/** The evidence and the proposal in words (markdown) — whole on one finding, absent in a list. */
|
package/lib/overseer-findings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var i=(e,n)=>c(e,"name",{value:n,configurable:!0});var u=Object.defineProperty,o=i((e,n)=>u(e,"name",{value:n,configurable:!0}),"
|
|
1
|
+
"use strict";var c=Object.defineProperty;var i=(e,n)=>c(e,"name",{value:n,configurable:!0});var u=Object.defineProperty,o=i((e,n)=>u(e,"name",{value:n,configurable:!0}),"s");export const FINDING_RUN_KINDS=["operate","stop-launch","close-session","role","role-off","check","rule","flow","lesson"];export function findingLive(e){return e.state==="open"||e.state==="proposed"||e.state==="applied"}i(findingLive,"findingLive"),o(findingLive,"findingLive");export function findingRunsActions(e,n={}){return e.actions.some(s=>FINDING_RUN_KINDS.includes(s.kind)||s.kind==="issue"&&n.issuesFolder===!0)}i(findingRunsActions,"findingRunsActions"),o(findingRunsActions,"findingRunsActions");export function findingsForCheck(e,n,s){const r=`repo:${n}/team.${s}`;return e.filter(t=>findingLive(t)&&t.checks.includes(r))}i(findingsForCheck,"findingsForCheck"),o(findingsForCheck,"findingsForCheck");
|
package/lib/team-library.d.ts
CHANGED
|
@@ -154,6 +154,15 @@ export interface DashTeamMember {
|
|
|
154
154
|
fields: Record<string, DashTeamFieldSource>;
|
|
155
155
|
/** Why its file was not read (the default stood in) — empty when it was. */
|
|
156
156
|
problems: string[];
|
|
157
|
+
/** The checks it is held to (planning/team/17): how many, how many must, by family — team://checks names them. */
|
|
158
|
+
checks?: {
|
|
159
|
+
count: number;
|
|
160
|
+
must: number;
|
|
161
|
+
families: Array<{
|
|
162
|
+
family: string;
|
|
163
|
+
count: number;
|
|
164
|
+
}>;
|
|
165
|
+
};
|
|
157
166
|
}
|
|
158
167
|
/** `GET /api/team/roles` — the team as the checkout's files make it. */
|
|
159
168
|
export interface DashTeamMembers {
|
package/lib/team.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type DashTeamKind = (typeof DASH_TEAM_KINDS)[number];
|
|
|
13
13
|
export type DashTeamTaskState = 'open' | 'claimed' | 'recovery' | 'completed' | 'cancelled';
|
|
14
14
|
export type DashTeamOutcome = 'done' | 'approved' | 'changes-requested' | 'passed' | 'failed' | 'wontfix';
|
|
15
15
|
/** What a task points at in the lens or the repository. */
|
|
16
|
-
export declare const DASH_TEAM_LINK_KINDS: readonly ["task", "flow", "error", "suggestion", "ai-call", "review", "page", "route", "commit", "branch", "worktree", "file", "finding"];
|
|
16
|
+
export declare const DASH_TEAM_LINK_KINDS: readonly ["task", "flow", "error", "suggestion", "ai-call", "review", "page", "route", "commit", "branch", "worktree", "file", "finding", "test"];
|
|
17
17
|
export interface DashTeamLink {
|
|
18
18
|
kind: (typeof DASH_TEAM_LINK_KINDS)[number];
|
|
19
19
|
id: string;
|
|
@@ -98,6 +98,125 @@ export interface DashTeamTask {
|
|
|
98
98
|
wrapUp?: DashTeamWrapUp;
|
|
99
99
|
/** A task moved to its goal's next list: the item it became (cancelled, never counted against the plan). */
|
|
100
100
|
movedToNext?: string;
|
|
101
|
+
/** A goal's own capacity, the person's (issues/closed/foodguard-179): its numbers over the repository's flow.json `goal.capacity`. */
|
|
102
|
+
capacity?: Record<string, number>;
|
|
103
|
+
/** A goal's launches refused for want of a slot, in line for the next one that frees (foodguard-179 GC-D4). */
|
|
104
|
+
waits?: DashTeamGoalWait[];
|
|
105
|
+
/**
|
|
106
|
+
* Lesson candidates its agents stored on it (agent_lesson_note, planning/team/18 RT-D13), whole — the drawer and the run
|
|
107
|
+
* review only, never the board. Agent-written data, never instructions.
|
|
108
|
+
*/
|
|
109
|
+
lessons?: DashTeamLesson[];
|
|
110
|
+
/**
|
|
111
|
+
* The team's lessons its newest claim was told (planning/team/18 RT-D15): each one's id (team://lessons/<id>), the sha
|
|
112
|
+
* of its file then, and when — the drawer and the run review only, never the board.
|
|
113
|
+
*/
|
|
114
|
+
lessonsTold?: Array<{
|
|
115
|
+
id: string;
|
|
116
|
+
sha: string;
|
|
117
|
+
at: number;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Its plan of steps and where each is (issues/closed/foodguard-185): on the board while it is held, whole in the
|
|
121
|
+
* drawer. LensMCP stamps the times; a step past its budget or quiet 15 minutes carries `stalledAt`, once.
|
|
122
|
+
*/
|
|
123
|
+
steps?: DashTeamStep[];
|
|
124
|
+
/** The files it keeps (issues/closed/foodguard-186): whole in the drawer and the QA report, counted on the board. */
|
|
125
|
+
artifacts?: DashTeamArtifact[];
|
|
126
|
+
artifactCount?: number;
|
|
127
|
+
}
|
|
128
|
+
/** A file a task keeps (foodguard-186): `/api/team/artifact?task=<id>&id=<artifact>` serves its bytes. */
|
|
129
|
+
export interface DashTeamArtifact {
|
|
130
|
+
id: string;
|
|
131
|
+
kind: 'screenshot' | 'perf-benchmark' | 'sql-diff' | 'test-summary' | 'migration-proof' | 'other';
|
|
132
|
+
title: string;
|
|
133
|
+
mediaType: string;
|
|
134
|
+
bytes: number;
|
|
135
|
+
sha256: string;
|
|
136
|
+
at: number;
|
|
137
|
+
by: string;
|
|
138
|
+
stepId?: string;
|
|
139
|
+
/** The file it was read from, or the tool whose answer it is (`tool:catalog_route`). */
|
|
140
|
+
from?: string;
|
|
141
|
+
note?: string;
|
|
142
|
+
/** Its bytes are gone — kept 30 days. Set by the drawer's read. */
|
|
143
|
+
pruned?: boolean;
|
|
144
|
+
}
|
|
145
|
+
/** One step of a task's plan (foodguard-185). */
|
|
146
|
+
export interface DashTeamStep {
|
|
147
|
+
id: string;
|
|
148
|
+
title: string;
|
|
149
|
+
budgetMinutes?: number;
|
|
150
|
+
state: 'queued' | 'running' | 'passed' | 'failed' | 'skipped';
|
|
151
|
+
startedAt?: number;
|
|
152
|
+
endedAt?: number;
|
|
153
|
+
updatedAt?: number;
|
|
154
|
+
counts?: {
|
|
155
|
+
passed?: number;
|
|
156
|
+
failed?: number;
|
|
157
|
+
skipped?: number;
|
|
158
|
+
total?: number;
|
|
159
|
+
};
|
|
160
|
+
runIds?: string[];
|
|
161
|
+
note?: string;
|
|
162
|
+
stalledAt?: number;
|
|
163
|
+
}
|
|
164
|
+
/** A fact a team agent noticed while it worked (RT-D13): agent-written data — no other agent is shown it. */
|
|
165
|
+
export interface DashTeamLesson {
|
|
166
|
+
at: number;
|
|
167
|
+
/** The session that wrote it, and the role it was in. */
|
|
168
|
+
sessionId: string;
|
|
169
|
+
role?: string;
|
|
170
|
+
fact: string;
|
|
171
|
+
/** Repository-relative paths it is about, the roles it matters to, and the tasks it rests on. */
|
|
172
|
+
paths?: string[];
|
|
173
|
+
roles?: string[];
|
|
174
|
+
rests?: string[];
|
|
175
|
+
}
|
|
176
|
+
/** A launch in line for a slot (issues/closed/foodguard-179 GC-D4). */
|
|
177
|
+
export interface DashTeamGoalWait {
|
|
178
|
+
role: string;
|
|
179
|
+
taskId?: string;
|
|
180
|
+
/** Its place in line: when it began to wait. */
|
|
181
|
+
since: number;
|
|
182
|
+
/** The manager that asked. */
|
|
183
|
+
by: string;
|
|
184
|
+
/** A free slot held for it: its manager told at `at`, no other goal takes it until `until`. */
|
|
185
|
+
offered?: {
|
|
186
|
+
at: number;
|
|
187
|
+
until: number;
|
|
188
|
+
};
|
|
189
|
+
/** The agent another goal borrowed past its capacity that gives its slot back for it. */
|
|
190
|
+
freeing?: string;
|
|
191
|
+
}
|
|
192
|
+
/** One of a goal's capacity numbers and what it uses of it — `used` past `max`: borrowed (foodguard-179). */
|
|
193
|
+
export interface DashTeamCapacityUse {
|
|
194
|
+
/** A role's id, a kind of role (`kind`: writers, checkers) or `research` — its claimed research tasks. */
|
|
195
|
+
key: string;
|
|
196
|
+
kind?: boolean;
|
|
197
|
+
max: number;
|
|
198
|
+
used: number;
|
|
199
|
+
/** flow.json's (`team`), the person's for this goal, or its manager's lower one. */
|
|
200
|
+
from: 'team' | 'person' | 'manager';
|
|
201
|
+
}
|
|
202
|
+
/** The running goals (`GET /api/team/board` `goals`, issues/closed/foodguard-179). */
|
|
203
|
+
export interface DashTeamGoals {
|
|
204
|
+
/** flow.json `goals.running`: the most goals that run at once. */
|
|
205
|
+
max: number;
|
|
206
|
+
running: Array<{
|
|
207
|
+
id: string;
|
|
208
|
+
title: string;
|
|
209
|
+
capacity: DashTeamCapacityUse[];
|
|
210
|
+
waits?: DashTeamGoalWait[];
|
|
211
|
+
}>;
|
|
212
|
+
/** Open goals no goal is above, first to start first — while the running goals fill `max`. */
|
|
213
|
+
next?: string[];
|
|
214
|
+
/** The kinds the running goals' capacities add up past the team's caps: a goal may wait for its own. */
|
|
215
|
+
over?: Array<{
|
|
216
|
+
kind: 'writers' | 'checkers';
|
|
217
|
+
guaranteed: number;
|
|
218
|
+
cap: number;
|
|
219
|
+
}>;
|
|
101
220
|
}
|
|
102
221
|
/** A goal's plan as it stands (planning/team/16 GS-D1). */
|
|
103
222
|
export interface DashTeamGoalPlan {
|
|
@@ -138,6 +257,8 @@ export interface DashTeamGoalRole {
|
|
|
138
257
|
effort?: string;
|
|
139
258
|
client?: 'codex' | 'claude';
|
|
140
259
|
reviews?: string[];
|
|
260
|
+
/** The most agents of the role the goal runs — its manager's word, never above the goal's capacity. */
|
|
261
|
+
max?: number;
|
|
141
262
|
}
|
|
142
263
|
/** One claim's work, from its holder's hooks: the files edited, commits, the checks and the whole suites run, workspace actions. */
|
|
143
264
|
export interface DashTeamTaskWork {
|
|
@@ -157,7 +278,7 @@ export interface DashTeamTaskWork {
|
|
|
157
278
|
* change completed with no commit or no check, a QA pass naming no run, a claim with no line in ten minutes, a holder
|
|
158
279
|
* whose process ended. Hints, never verdicts.
|
|
159
280
|
*/
|
|
160
|
-
export type DashTeamConductKind = 'checker-edited' | 'whole-suite' | 'outside-paths' | 'no-commit' | 'unchecked' | 'qa-unrun' | 'quiet-claim' | 'host-gone' | 'edited-reserved';
|
|
281
|
+
export type DashTeamConductKind = 'checker-edited' | 'whole-suite' | 'outside-paths' | 'no-commit' | 'unchecked' | 'qa-unrun' | 'quiet-claim' | 'host-gone' | 'edited-reserved' | 'check-unproved' | 'over-budget';
|
|
161
282
|
export interface DashTeamFlag {
|
|
162
283
|
kind: DashTeamConductKind;
|
|
163
284
|
severity: 'info' | 'warn';
|
|
@@ -170,9 +291,52 @@ export interface DashTeamFlag {
|
|
|
170
291
|
export interface DashTeamReviewItem {
|
|
171
292
|
id: string;
|
|
172
293
|
text: string;
|
|
173
|
-
from: 'done-means' | 'tests' | 'recheck' | 'reviewer';
|
|
294
|
+
from: 'done-means' | 'tests' | 'recheck' | 'check' | 'reviewer';
|
|
174
295
|
verdict?: 'pass' | 'fail' | 'n/a';
|
|
175
296
|
note?: string;
|
|
297
|
+
/** A check's item (planning/team/17): `<id>@<hash8>`, its level, what its note must show, what not to flag, and why it applied. */
|
|
298
|
+
check?: string;
|
|
299
|
+
level?: 'must' | 'should';
|
|
300
|
+
proof?: string;
|
|
301
|
+
not?: string;
|
|
302
|
+
why?: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* A goal's checks as the Team page's drawer shows them (planning/team/17 SK-D7): the pick's state and its picks — each
|
|
306
|
+
* with why, the paths it was picked for, and whether the model or the person chose it — the ids the person removed,
|
|
307
|
+
* and the checks in force to add from. `GET /api/team/goal/checks?id=`.
|
|
308
|
+
*/
|
|
309
|
+
export interface DashTeamGoalChecks {
|
|
310
|
+
goal: {
|
|
311
|
+
id: string;
|
|
312
|
+
title: string;
|
|
313
|
+
};
|
|
314
|
+
checks?: {
|
|
315
|
+
state: 'picked' | 'floor' | 'running';
|
|
316
|
+
picked: Array<{
|
|
317
|
+
id: string;
|
|
318
|
+
why: string;
|
|
319
|
+
paths?: string[];
|
|
320
|
+
by: 'model' | 'person';
|
|
321
|
+
}>;
|
|
322
|
+
removed: string[];
|
|
323
|
+
at: number;
|
|
324
|
+
reason?: string;
|
|
325
|
+
wait?: 'key' | 'allowance' | 'off';
|
|
326
|
+
model?: string;
|
|
327
|
+
again?: boolean;
|
|
328
|
+
costUsd?: number;
|
|
329
|
+
};
|
|
330
|
+
catalog: {
|
|
331
|
+
sha: string;
|
|
332
|
+
checks: Array<{
|
|
333
|
+
id: string;
|
|
334
|
+
title: string;
|
|
335
|
+
level: 'must' | 'should';
|
|
336
|
+
family: string;
|
|
337
|
+
layer: 'library' | 'user' | 'project';
|
|
338
|
+
}>;
|
|
339
|
+
};
|
|
176
340
|
}
|
|
177
341
|
/** A task named in another's chain: its parent, its children, a blocker. */
|
|
178
342
|
export interface DashTeamTaskRef {
|
|
@@ -305,6 +469,8 @@ export interface DashTeamBoard {
|
|
|
305
469
|
roles: DashTeamRole[];
|
|
306
470
|
/** What the board's tasks raise about the agents that hold or held them. */
|
|
307
471
|
flags?: DashTeamFlag[];
|
|
472
|
+
/** The running goals, each one's capacity and waits, and the goals next to start (issues/closed/foodguard-179). */
|
|
473
|
+
goals?: DashTeamGoals;
|
|
308
474
|
/** More sessions or tasks than the board carries. */
|
|
309
475
|
truncated: boolean;
|
|
310
476
|
/**
|
|
@@ -361,6 +527,8 @@ export interface DashTeamOperate {
|
|
|
361
527
|
/** Cancel it, with why. */
|
|
362
528
|
cancel?: string;
|
|
363
529
|
note?: string;
|
|
530
|
+
/** A goal's capacity, by role, kind or research — null gives a key back to flow.json's (foodguard-179). */
|
|
531
|
+
capacity?: Record<string, number | null>;
|
|
364
532
|
}
|
|
365
533
|
/** `POST /api/team/message` — to one agent, or to everyone (no `to`). */
|
|
366
534
|
export interface DashTeamMessage {
|
|
@@ -741,6 +909,27 @@ export interface DashTeamReview {
|
|
|
741
909
|
/** The reviewed goal's plan, and its next list (GS-D1–D2). */
|
|
742
910
|
plan?: import('./team-review-changes.js').DashTeamReviewPlan;
|
|
743
911
|
next?: DashTeamNextItem[];
|
|
912
|
+
/** How each check fared in the run's reviews (planning/team/17 SK-D12) — absent: no review held a check item. */
|
|
913
|
+
checks?: DashTeamCheckCount[];
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* One check's record in a window's reviews (planning/team/17 SK-D12, libs/storage check-counts.ts): seeded, its verdicts,
|
|
917
|
+
* and caught later — passed or n/a, then a later review of the same change failed an item of its family, or a bug filed
|
|
918
|
+
* after it names the check.
|
|
919
|
+
*/
|
|
920
|
+
export interface DashTeamCheckCount {
|
|
921
|
+
/** Without its content hash: `data/no-query-in-loop` — team://checks/<id>. */
|
|
922
|
+
id: string;
|
|
923
|
+
family: string;
|
|
924
|
+
level?: 'must' | 'should';
|
|
925
|
+
seeded: number;
|
|
926
|
+
pass: number;
|
|
927
|
+
fail: number;
|
|
928
|
+
na: number;
|
|
929
|
+
open: number;
|
|
930
|
+
caughtLater: number;
|
|
931
|
+
/** The reviews it was in, at most 5: caught later first, then failed, then the newest. */
|
|
932
|
+
reviews: string[];
|
|
744
933
|
}
|
|
745
934
|
/** The clients LensMCP launches headless: Codex (`codex exec`) and Claude Code (`claude -p`). */
|
|
746
935
|
export type DashTeamLaunchClient = 'codex' | 'claude';
|
|
@@ -1005,6 +1194,8 @@ export interface DashTeamHealth {
|
|
|
1005
1194
|
joins?: number;
|
|
1006
1195
|
messages?: number;
|
|
1007
1196
|
};
|
|
1197
|
+
/** How each check fared in the window's reviews (planning/team/17 SK-D12) — absent: no review held a check item. */
|
|
1198
|
+
reviewChecks?: DashTeamCheckCount[];
|
|
1008
1199
|
observedAt: number;
|
|
1009
1200
|
}
|
|
1010
1201
|
/**
|
package/lib/team.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var r=(t,e)=>o(t,"name",{value:e,configurable:!0});var i=Object.defineProperty,a=r((t,e)=>i(t,"name",{value:e,configurable:!0}),"r");export const DASH_TEAM_KINDS=["goal","build","bug","review","test","qa","docs","marketing","research","chore"],DASH_TEAM_LINK_KINDS=["task","flow","error","suggestion","ai-call","review","page","route","commit","branch","worktree","file","finding"];export function modelClient(t){const e=t?.trim()??"";if(/\b(claude|opus|sonnet|haiku|fable)\b/i.test(e))return"claude";if(/^(gpt|o\d+|codex)\b/i.test(e))return"codex"}r(modelClient,"modelClient"),a(modelClient,"modelClient");
|
|
1
|
+
"use strict";var o=Object.defineProperty;var r=(t,e)=>o(t,"name",{value:e,configurable:!0});var i=Object.defineProperty,a=r((t,e)=>i(t,"name",{value:e,configurable:!0}),"r");export const DASH_TEAM_KINDS=["goal","build","bug","review","test","qa","docs","marketing","research","chore"],DASH_TEAM_LINK_KINDS=["task","flow","error","suggestion","ai-call","review","page","route","commit","branch","worktree","file","finding","test"];export function modelClient(t){const e=t?.trim()??"";if(/\b(claude|opus|sonnet|haiku|fable)\b/i.test(e))return"claude";if(/^(gpt|o\d+|codex)\b/i.test(e))return"codex"}r(modelClient,"modelClient"),a(modelClient,"modelClient");
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
export type WorkspaceActionKind = 'start' | 'stop' | 'restart' | 'migrate' | 'test' | 'e2e' | 'typecheck' | 'lint' | 'build' | 'verify' | 'worktree-stop' | 'worktree-remove';
|
|
1
|
+
export type WorkspaceActionKind = 'start' | 'stop' | 'restart' | 'migrate' | 'test' | 'e2e' | 'typecheck' | 'lint' | 'build' | 'verify' | 'benchmark' | 'capture' | 'worktree-stop' | 'worktree-remove';
|
|
2
2
|
export type WorkspaceActionState = 'queued' | 'running' | 'passed' | 'failed' | 'errored' | 'cancelled' | 'timeout';
|
|
3
|
+
/**
|
|
4
|
+
* The machine queue's lane (issues/closed/foodguard-189): `heavy` runs one at a time on the machine — a whole test target,
|
|
5
|
+
* e2e, verify, anything over an hour; `light` runs a few at once, admitted by free memory — specs by file or relation, a
|
|
6
|
+
* typecheck, a lint, a build.
|
|
7
|
+
*/
|
|
8
|
+
export type WorkspaceActionLane = 'light' | 'heavy';
|
|
3
9
|
export interface WorkspaceActionInput {
|
|
4
10
|
action: WorkspaceActionKind;
|
|
5
|
-
project
|
|
11
|
+
/** The Nx project — absent only for a run over `affected` projects. */
|
|
12
|
+
project?: string;
|
|
6
13
|
target?: string;
|
|
7
14
|
worktree?: string;
|
|
8
15
|
timeoutMs?: number;
|
|
@@ -10,13 +17,88 @@ export interface WorkspaceActionInput {
|
|
|
10
17
|
heapMb?: number;
|
|
11
18
|
files?: string[];
|
|
12
19
|
testName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* A test run of the specs related to these source files (issues/closed/foodguard-188): jest's `--findRelatedTests`, or
|
|
22
|
+
* for vitest the specs the repository's import graph says import them at any depth. Paths in the checkout.
|
|
23
|
+
*/
|
|
24
|
+
related?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* The target over every project Nx says is affected between `base` and `head` (HEAD) — one step per project, in the
|
|
27
|
+
* heavy lane, `stage` saying «test 12 of 148: dashboard» (foodguard-188, main-level QA). `project` may be left out.
|
|
28
|
+
*/
|
|
29
|
+
affected?: {
|
|
30
|
+
base: string;
|
|
31
|
+
head?: string;
|
|
32
|
+
};
|
|
13
33
|
hard?: boolean;
|
|
34
|
+
/** The queue's lane — none: by what the run is (heavy for a whole test target, e2e, verify or over an hour). */
|
|
35
|
+
lane?: WorkspaceActionLane;
|
|
14
36
|
/** Preparation of an existing instance. Only services started by this run are cleaned up. */
|
|
15
37
|
prepare?: {
|
|
16
38
|
migrationProject?: string;
|
|
17
39
|
migrationTarget?: string;
|
|
18
40
|
services?: string[];
|
|
19
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* benchmark (issues/closed/foodguard-191): the routes called through the lens, `calls` times each after `warmup`, on
|
|
44
|
+
* this run's checkout and — `compare`, on by default in a worktree — on Main, alone on the machine.
|
|
45
|
+
*/
|
|
46
|
+
benchmark?: {
|
|
47
|
+
origin: string;
|
|
48
|
+
routes: WorkspaceBenchmarkRoute[];
|
|
49
|
+
calls?: number;
|
|
50
|
+
warmup?: number;
|
|
51
|
+
compare?: boolean;
|
|
52
|
+
};
|
|
53
|
+
/** capture (foodguard-191): real PNGs of the pages, at each width and theme, on this run's checkout and on Main. */
|
|
54
|
+
capture?: {
|
|
55
|
+
origin: string;
|
|
56
|
+
pages: WorkspaceCapturePage[];
|
|
57
|
+
widths?: number[];
|
|
58
|
+
themes?: Array<'light' | 'dark'>;
|
|
59
|
+
compare?: boolean;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface WorkspaceBenchmarkRoute {
|
|
63
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
64
|
+
path: string;
|
|
65
|
+
as?: string;
|
|
66
|
+
body?: unknown;
|
|
67
|
+
service?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface WorkspaceCapturePage {
|
|
70
|
+
path: string;
|
|
71
|
+
name?: string;
|
|
72
|
+
}
|
|
73
|
+
/** One route on one checkout, as a benchmark measured it. */
|
|
74
|
+
export interface WorkspaceBenchmarkRow {
|
|
75
|
+
route: string;
|
|
76
|
+
checkout: string;
|
|
77
|
+
as?: string;
|
|
78
|
+
calls: number;
|
|
79
|
+
/** Calls that did not answer 2xx/3xx, or did not answer. */
|
|
80
|
+
failed: number;
|
|
81
|
+
p50Ms?: number;
|
|
82
|
+
p95Ms?: number;
|
|
83
|
+
maxMs?: number;
|
|
84
|
+
/** SQL statements one request ran, its median; and the most times one request ran the same statement (a loop). */
|
|
85
|
+
sqlPerRequest?: number;
|
|
86
|
+
dbInLoop?: number;
|
|
87
|
+
statuses: Record<string, number>;
|
|
88
|
+
/** A few of its flows, to open with flow_get. */
|
|
89
|
+
flows?: string[];
|
|
90
|
+
note?: string;
|
|
91
|
+
}
|
|
92
|
+
/** One picture a capture took: `file` is the run's evidence (`capture-3.bin`, a PNG — workspace_action_read gives it base64). */
|
|
93
|
+
export interface WorkspaceCaptureShot {
|
|
94
|
+
checkout: string;
|
|
95
|
+
page: string;
|
|
96
|
+
width: number;
|
|
97
|
+
theme: 'light' | 'dark';
|
|
98
|
+
file?: string;
|
|
99
|
+
bytes?: number;
|
|
100
|
+
url: string;
|
|
101
|
+
note?: string;
|
|
20
102
|
}
|
|
21
103
|
export interface WorkspaceActionDescriptor {
|
|
22
104
|
id: string;
|
|
@@ -29,12 +111,50 @@ export interface WorkspaceActionDescriptor {
|
|
|
29
111
|
prerequisites: string[];
|
|
30
112
|
}
|
|
31
113
|
export interface WorkspaceActionFailure {
|
|
114
|
+
/** Of the test's file as the checkout knows it and its full name: the same test has one id in every checkout. */
|
|
32
115
|
id: string;
|
|
33
116
|
name: string;
|
|
34
117
|
file?: string;
|
|
35
118
|
line?: number;
|
|
36
119
|
message: string;
|
|
37
120
|
occurrences: number;
|
|
121
|
+
/**
|
|
122
|
+
* Against main's known failures for its project and target (issues/closed/foodguard-184): `known` — it fails on main
|
|
123
|
+
* too — or `new`. None: no baseline was read (an opaque target, or a run from before LensMCP read one).
|
|
124
|
+
*/
|
|
125
|
+
status?: 'new' | 'known';
|
|
126
|
+
/** A known failure: main's latest commit it failed at, and the commit and day it was first seen failing there. */
|
|
127
|
+
known?: {
|
|
128
|
+
sha: string;
|
|
129
|
+
firstSha: string;
|
|
130
|
+
since: string;
|
|
131
|
+
firstAt?: number;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A test step against main's known failures for its project and target (issues/closed/foodguard-184). `sha`, `date`
|
|
136
|
+
* and `run`: main's latest run that kept the list — none when no main run is recorded, and every failure is new.
|
|
137
|
+
*/
|
|
138
|
+
export interface WorkspaceActionBaseline {
|
|
139
|
+
branch?: string;
|
|
140
|
+
sha?: string;
|
|
141
|
+
date?: string;
|
|
142
|
+
run?: string;
|
|
143
|
+
/** Only narrowed main runs (by file, name or relation) kept this list: a test none of them ran is new by default. */
|
|
144
|
+
partial?: boolean;
|
|
145
|
+
newFailed: number;
|
|
146
|
+
knownFailed: number;
|
|
147
|
+
/** Known on main, and passed here: the first 10, and how many in all. */
|
|
148
|
+
fixedHere: Array<{
|
|
149
|
+
id: string;
|
|
150
|
+
name: string;
|
|
151
|
+
file?: string;
|
|
152
|
+
}>;
|
|
153
|
+
fixedHereCount: number;
|
|
154
|
+
/** This run was clean on Main and kept the list: `whole` replaced it; `narrowed` added its failures and cleared what passed. */
|
|
155
|
+
recorded?: 'whole' | 'narrowed';
|
|
156
|
+
/** Why the list was not read, or why this run on Main did not keep it. */
|
|
157
|
+
note?: string;
|
|
38
158
|
}
|
|
39
159
|
export interface WorkspaceActionCounts {
|
|
40
160
|
passed: number;
|
|
@@ -44,6 +164,11 @@ export interface WorkspaceActionCounts {
|
|
|
44
164
|
}
|
|
45
165
|
export interface WorkspaceActionStep {
|
|
46
166
|
id: string;
|
|
167
|
+
/** The project it ran — a run over several projects (`affected`) has one step each. */
|
|
168
|
+
project?: string;
|
|
169
|
+
/** A related run: the specs it ran (first 50), and how many in all. */
|
|
170
|
+
specs?: string[];
|
|
171
|
+
specsCount?: number;
|
|
47
172
|
action: WorkspaceActionKind | 'cleanup';
|
|
48
173
|
state: WorkspaceActionState | 'skipped';
|
|
49
174
|
durationMs: number;
|
|
@@ -79,6 +204,17 @@ export interface WorkspaceActionStep {
|
|
|
79
204
|
changed: string[];
|
|
80
205
|
};
|
|
81
206
|
};
|
|
207
|
+
/** A test step's failures against main's known ones: how many are new, how many known, and what passed here. */
|
|
208
|
+
baseline?: WorkspaceActionBaseline;
|
|
209
|
+
/** A benchmark step's rows: each route on each checkout, Main beside this one (foodguard-191). */
|
|
210
|
+
benchmark?: {
|
|
211
|
+
rows: WorkspaceBenchmarkRow[];
|
|
212
|
+
quiet?: string;
|
|
213
|
+
};
|
|
214
|
+
/** A capture step's pictures (foodguard-191). */
|
|
215
|
+
capture?: {
|
|
216
|
+
shots: WorkspaceCaptureShot[];
|
|
217
|
+
};
|
|
82
218
|
evidence: {
|
|
83
219
|
log: string;
|
|
84
220
|
report?: string;
|
|
@@ -101,6 +237,27 @@ export interface WorkspaceActionRun {
|
|
|
101
237
|
durationMs: number;
|
|
102
238
|
steps: WorkspaceActionStep[];
|
|
103
239
|
note?: string;
|
|
240
|
+
/** The machine queue: its lane; while queued, its place and why it waits; once admitted, how long it waited. */
|
|
241
|
+
queue?: WorkspaceActionQueue;
|
|
242
|
+
/** A run over many projects: its steps by state — the summary keeps the ones that did not pass, and folds the rest here. */
|
|
243
|
+
rollup?: {
|
|
244
|
+
steps: number;
|
|
245
|
+
passed: number;
|
|
246
|
+
failed: number;
|
|
247
|
+
errored: number;
|
|
248
|
+
skipped: number;
|
|
249
|
+
other: number;
|
|
250
|
+
folded: number;
|
|
251
|
+
newFailed?: number;
|
|
252
|
+
knownFailed?: number;
|
|
253
|
+
};
|
|
104
254
|
resultRef: string;
|
|
105
255
|
retentionDays: number;
|
|
106
256
|
}
|
|
257
|
+
export interface WorkspaceActionQueue {
|
|
258
|
+
lane: WorkspaceActionLane;
|
|
259
|
+
place?: number;
|
|
260
|
+
of?: number;
|
|
261
|
+
why?: string;
|
|
262
|
+
waitedMs?: number;
|
|
263
|
+
}
|