@yuriai/web 0.2.8-beta.1 → 0.2.8-beta.2
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/dist/assets/{AssistantView-Df-G2DX8.js → AssistantView-BjpY2u0c.js} +3 -3
- package/dist/assets/{DiagramView-BoVqJRQb.js → DiagramView-7j0sZC_P.js} +1 -1
- package/dist/assets/{GuiPluginSurface-DxLoeTDb.js → GuiPluginSurface-D_TK-2vZ.js} +1 -1
- package/dist/assets/{MarkdownRenderer-DYi_qpYy.js → MarkdownRenderer-B8zgOCfr.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-CMxRMFqp.js → MarkdownRendererImpl-Dh7XVDLd.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-DQ4urBZW.js → MarkstreamRendererImpl-D-qtRrvg.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-C4fJlKdu.js → MobileDetailNavigation-LkTVYLZX.js} +1 -1
- package/dist/assets/{MobileShareBridge-DLC-TdRy.js → MobileShareBridge-CsTyKMtN.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-CMbbtHh7.js → MobileTabPageHeader-xz9RMXg4.js} +1 -1
- package/dist/assets/{MultiRunWindow-Cwp8-_Wh.js → MultiRunWindow-hMpjV7so.js} +1 -1
- package/dist/assets/{SettingsView-CYDk0wpN.js → SettingsView-D8qpss-X.js} +1 -1
- package/dist/assets/{SettingsWindow-Vuzphf9b.js → SettingsWindow-B1VuFkFq.js} +1 -1
- package/dist/assets/{TerminalView-Dhalx6_Z.js → TerminalView-CLcaJh2M.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DBxSxWNh.js → ToolOutputDialog-BuZo3XvN.js} +1 -1
- package/dist/assets/{appThemeRegistry-JEhMXHGF.js → appThemeRegistry-B7sp1Hw8.js} +1 -1
- package/dist/assets/{capgoAdapter-BgD0wyhC.js → capgoAdapter-vxOdqloD.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-BQdfRBkk.js → fileMentionTouchSelection-DspnKU8D.js} +1 -1
- package/dist/assets/{gitApi-DhDVqj9b.js → gitApi-BLYdWaG8.js} +1 -1
- package/dist/assets/{insertionBoundaries-BMe1F3uB.js → insertionBoundaries-DqlfZVY9.js} +1 -1
- package/dist/assets/{main-DXlMu2LF.js → main-DA7z198b.js} +2 -2
- package/dist/assets/{main-CfOYzhn0.js → main-Qw23QJ7L.js} +4 -4
- package/dist/assets/{mcpQueries-vxcQAIGB.js → mcpQueries-C6Tu2cF3.js} +1 -1
- package/dist/assets/{miniChat-D48iGEEW.js → miniChat-HafcB3H-.js} +2 -2
- package/dist/assets/{mobile-Cy5qSiDY.js → mobile-DwXoGpxm.js} +2 -2
- package/dist/assets/{mobileBackNavigation-QtBK9OSb.js → mobileBackNavigation-9MR5h5K6.js} +1 -1
- package/dist/assets/{multirun-BR9a6EBo.js → multirun-D-je_w02.js} +1 -1
- package/dist/assets/{native-config-CHySeHif.js → native-config-Bb3pPQPD.js} +1 -1
- package/dist/assets/{projectMeta-Bn2vBNDe.js → projectMeta-DaCyZW_D.js} +1 -1
- package/dist/assets/{readiness-BAssoNVf.js → readiness-BHqz_NPS.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-B9Kci_8q.js → renderElectronMiniChatApp-COaMALRh.js} +2 -2
- package/dist/assets/{renderMobileApp-CBivL8Ps.js → renderMobileApp-BOGntDSu.js} +4 -4
- package/dist/assets/{runtimeConfig-COdEwlK-.js → runtimeConfig-BiSluBXe.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-D3x76Qpf.js → runtimeEndpointReset-CJwlI_R-.js} +3 -3
- package/dist/assets/{sessionChangeSummary-Dtgq0CWg.js → sessionChangeSummary-BAv8zzro.js} +1 -1
- package/dist/assets/{sessionLookup--Wlr3e8X.js → sessionLookup-DOw7g15p.js} +1 -1
- package/dist/assets/{speechSettingsQueries-D3fc_4Iy.js → speechSettingsQueries-B8zEN5QM.js} +1 -1
- package/dist/assets/{types-D8_26ZKT.js → types-BiP0jssb.js} +1 -1
- package/dist/assets/{useAppFontEffects-DLT9jVl1.js → useAppFontEffects-De1qI6c-.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-BNAZWH9L.js → useDesktopWindowControlsLayout-BzXi6Wf1.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-D2_-KCB7.js → useEffectiveDirectory-BcbBl_6y.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-DJwk64Po.js → useMobileNavigationStore-DqDCVXO1.js} +3 -3
- package/dist/assets/{useWorkerHighlightedLines-k48txabk.js → useWorkerHighlightedLines-CDVleuma.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +1 -1
- package/server/lib/assistants/DOCUMENTATION.md +3 -0
- package/server/lib/assistants/contact-tools.js +145 -10
- package/server/lib/assistants/contact-tools.test.js +11 -2
- package/server/lib/assistants/harness.js +6 -3
- package/server/lib/assistants/harness.test.js +57 -0
- package/server/lib/assistants/routes.js +1 -0
- package/server/lib/assistants/service.js +66 -1
- package/server/lib/assistants/service.test.js +37 -0
- package/server/lib/llm/DOCUMENTATION.md +3 -0
- package/server/lib/llm/completions.js +2 -1
- package/server/lib/llm/completions.test.js +9 -0
- package/server/lib/opencode/feature-routes-runtime.js +1 -0
package/dist/assets/{useWorkerHighlightedLines-k48txabk.js → useWorkerHighlightedLines-CDVleuma.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-BSFWH-Ok.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-BjiyvtB2.js";import{i as u,n as d,t as f}from"./tooltip-DygQ-2xe.js";import{n as p}from"./MarkdownRenderer-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,rt as n}from"./vendor-base-ui-CdzJ6My_.js";import{v as r}from"./useUIStore-NMQx_cnG.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{f as a,r as o,t as s}from"./button-BSFWH-Ok.js";import{n as c}from"./useThemeSystem-8jhE4Zyk.js";import{n as l}from"./Icon-BjiyvtB2.js";import{i as u,n as d,t as f}from"./tooltip-DygQ-2xe.js";import{n as p}from"./MarkdownRenderer-B8zgOCfr.js";import{n as m,r as h}from"./toolHelpers-DL452NVK.js";import{t as g}from"./vendor-tanstack-react-virtual-B_EO--9t.js";import{n as _}from"./markdownTheme-DHoKvD6O.js";import{n as v,t as y}from"./markdown-worker-oBGEB9Eg.js";var b=e(t(),1),x=i(),S=n(),C=`w-[min(30rem,calc(100cqw-1rem))] min-w-[280px] max-w-full overflow-hidden rounded-xl shadow-[inset_0_1px_0_0_rgba(255,255,255,0.8),inset_0_0_0_1px_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.10),0_1px_2px_-0.5px_rgba(0,0,0,0.08),0_4px_8px_-2px_rgba(0,0,0,0.08),0_12px_20px_-4px_rgba(0,0,0,0.08)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.12),inset_0_0_0_1px_rgba(255,255,255,0.08),0_0_0_1px_rgba(0,0,0,0.36),0_1px_1px_-0.5px_rgba(0,0,0,0.22),0_3px_3px_-1.5px_rgba(0,0,0,0.20),0_6px_6px_-3px_rgba(0,0,0,0.16)]`,w={maxWidth:`min(28rem, calc(100cqw - 4ch))`,backgroundColor:`var(--surface-elevated)`,color:`var(--surface-elevated-foreground)`},T=`flex items-center justify-between gap-3 border-b border-[var(--surface-subtle)] px-3 py-2.5`,E=`text-xs font-medium leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,D=`text-xs tabular-nums leading-4 text-muted-foreground md:text-[0.8125rem] md:leading-5`,O=`m-0 list-none divide-y divide-[var(--surface-subtle)] p-0`,k=`${O} max-h-[min(22rem,50vh)] overflow-y-auto`,A=`${O} w-full`,ee={className:`p-0 rounded-none`,maxHeightClass:`max-h-[46vh]`,disableHorizontal:!0},j=`px-2.5 py-1.5 text-xs leading-4 md:py-2 md:text-[0.8125rem] md:leading-5`,M=`flex min-w-0 items-center gap-1 text-xs leading-4 text-muted-foreground md:gap-1.5 md:text-[0.8125rem] md:leading-5`,te=`min-w-0 truncate text-xs leading-4 text-foreground md:text-[0.8125rem] md:leading-5`,ne=`inline-flex shrink-0 items-center gap-1 text-xs leading-4 tabular-nums text-muted-foreground md:text-[0.8125rem] md:leading-5`,re=`h-3 w-3 shrink-0 md:h-3.5 md:w-3.5`,ie={in_progress:`text-foreground`,pending:`text-foreground`,completed:`text-muted-foreground line-through`,cancelled:`text-muted-foreground line-through`},ae={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},N=e=>{let t=(0,x.c)(26),{todo:n,isActive:r,activeRef:i}=e,{t:s}=a(),c=oe.has(n.status)?n.status:`pending`,p=ae[c],m;t[0]!==s||t[1]!==p?(m=s(p),t[0]=s,t[1]=p,t[2]=m):m=t[2];let h=m,g;t[3]===c?g=t[4]:(g=c===`in_progress`?(0,S.jsx)(l,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):c===`completed`?(0,S.jsx)(l,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,S.jsx)(l,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=c,t[4]=g);let _=g,v=r?`step`:void 0,y=r&&`bg-[var(--surface-muted)] before:absolute before:inset-y-2 before:left-0 before:w-0.5 before:rounded-full before:bg-[var(--status-info)]`,b;t[5]===y?b=t[6]:(b=o(`group relative grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] items-start gap-2.5`,j,y),t[5]=y,t[6]=b);let C;t[7]!==_||t[8]!==h?(C=(0,S.jsx)(u,{asChild:!0,children:(0,S.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":h,children:_})}),t[7]=_,t[8]=h,t[9]=C):C=t[9];let w;t[10]===h?w=t[11]:(w=(0,S.jsx)(d,{side:`left`,sideOffset:6,children:h}),t[10]=h,t[11]=w);let T;t[12]!==C||t[13]!==w?(T=(0,S.jsxs)(f,{children:[C,w]}),t[12]=C,t[13]=w,t[14]=T):T=t[14];let E=ie[c],D;t[15]===E?D=t[16]:(D=o(`block whitespace-normal break-words`,E),t[15]=E,t[16]=D);let O;t[17]!==D||t[18]!==n.content?(O=(0,S.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(`span`,{className:D,children:n.content})}),t[17]=D,t[18]=n.content,t[19]=O):O=t[19];let k;return t[20]!==i||t[21]!==O||t[22]!==v||t[23]!==b||t[24]!==T?(k=(0,S.jsxs)(`li`,{ref:i,"aria-current":v,className:b,children:[T,O]}),t[20]=i,t[21]=O,t[22]=v,t[23]=b,t[24]=T,t[25]=k):k=t[25],k},oe=new Set([`in_progress`,`pending`,`completed`,`cancelled`]),P=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),F=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,I=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=F(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},L=e=>`<pre><code>${P(e)}</code></pre>`,R=e=>{let t=(0,x.c)(21),{code:n,language:r,className:i,style:a,codeStyle:s,wrap:l}=e,u=l!==void 0&&l,{currentTheme:d}=c(),f=b.useRef(null),p;t[0]===d?p=t[1]:(p=_(d),t[0]=d,t[1]=p);let m=p,h,g;t[2]!==n||t[3]!==s||t[4]!==u?(h=()=>{let e=f.current;e&&(e.innerHTML=L(n),I(e,u,s))},g=[n,u,s],t[2]=n,t[3]=s,t[4]=u,t[5]=h,t[6]=g):(h=t[5],g=t[6]),b.useLayoutEffect(h,g);let v,C;t[7]!==n||t[8]!==s||t[9]!==r||t[10]!==u?(v=()=>{let e=f.current;if(!e)return;let t=!0,i=new AbortController;return y(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,I(e,u,s))}),()=>{t=!1,i.abort()}},C=[n,r,u,s],t[7]=n,t[8]=s,t[9]=r,t[10]=u,t[11]=v,t[12]=C):(v=t[11],C=t[12]),b.useEffect(v,C);let w;t[13]===i?w=t[14]:(w=o(`typography-code`,i),t[13]=i,t[14]=w);let T=m,E;t[15]!==a||t[16]!==T?(E={...T,...a},t[15]=a,t[16]=T,t[17]=E):E=t[17];let D;return t[18]!==w||t[19]!==E?(D=(0,S.jsx)(`div`,{ref:f,className:w,style:E}),t[18]=w,t[19]=E,t[20]=D):D=t[20],D},z=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},B=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},V=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,H=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,U=(e,t)=>!e||typeof e!=`object`?String(e):h(e,t||``),W=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},G=e=>{if(!e||typeof e!=`object`)return;let t=W(e.patch)??W(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=W(e.patch)??W(e.diff);if(t)return t}},K=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},q=(e,t,n)=>{let r=z(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&V(r)&&(r=H(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=G(n);if(e)return e}return r},se=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},ce=(e,t)=>{try{let n=e.trim().split(`
|
|
4
4
|
`).filter(Boolean);if(n.length===0)return null;let i=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,r=Math.floor(e.length/2),a=!n.endsWith(`/`);i.push({name:n.replace(/\/$/,``),depth:r,isFile:a})}}),(0,S.jsx)(`div`,{className:o(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:r.tool.popup,children:i.map((e,t)=>(0,S.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,S.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,S.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},le={backgroundColor:`var(--status-info)`,opacity:.6},ue=(e,t,n)=>{try{let i=e.trim().split(`
|
package/dist/index.html
CHANGED
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
opacity: 0.72;
|
|
561
561
|
}
|
|
562
562
|
</style>
|
|
563
|
-
<script type="module" crossorigin src="/assets/main-
|
|
563
|
+
<script type="module" crossorigin src="/assets/main-DA7z198b.js"></script>
|
|
564
564
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
565
565
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
566
566
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -591,10 +591,10 @@
|
|
|
591
591
|
<link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
|
|
592
592
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
|
|
593
593
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
|
|
594
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
595
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
596
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
597
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
594
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BiP0jssb.js">
|
|
595
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-vxOdqloD.js">
|
|
596
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bb3pPQPD.js">
|
|
597
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BiSluBXe.js">
|
|
598
598
|
<link rel="stylesheet" crossorigin href="/assets/src-NlrSCyPZ.css">
|
|
599
599
|
</head>
|
|
600
600
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
.dark #initial-loading img { filter: invert(1); }
|
|
78
78
|
</style>
|
|
79
79
|
|
|
80
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
80
|
+
<script type="module" crossorigin src="/assets/miniChat-HafcB3H-.js"></script>
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -108,10 +108,10 @@
|
|
|
108
108
|
<link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
|
|
109
109
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
|
|
110
110
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
|
|
111
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
112
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
113
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
114
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
111
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BiP0jssb.js">
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-vxOdqloD.js">
|
|
113
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bb3pPQPD.js">
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BiSluBXe.js">
|
|
115
115
|
<link rel="stylesheet" crossorigin href="/assets/src-NlrSCyPZ.css">
|
|
116
116
|
</head>
|
|
117
117
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
|
|
67
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
67
|
+
<script type="module" crossorigin src="/assets/mobile-DwXoGpxm.js"></script>
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-ef9W7A43.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-CAZiOV2G.js">
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
<link rel="modulepreload" crossorigin href="/assets/platform-DXeTzJHG.js">
|
|
96
96
|
<link rel="modulepreload" crossorigin href="/assets/terminalApi-CIbkfDkE.js">
|
|
97
97
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-BzblfnMx.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/types-BiP0jssb.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-vxOdqloD.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-Bb3pPQPD.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-BiSluBXe.js">
|
|
102
102
|
<link rel="stylesheet" crossorigin href="/assets/src-NlrSCyPZ.css">
|
|
103
103
|
</head>
|
|
104
104
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -254,6 +254,9 @@ Reply language follows the user's latest substantive message and conversation co
|
|
|
254
254
|
|
|
255
255
|
- `create_assistant` calls the same in-process `createAssistant` (`name`, connected OpenCode `providerID`/`modelID`, `mode: 'continuous'`). It emits an `assistant` card that opens that contact.
|
|
256
256
|
- `schedule_task` calls in-process `projectConfigRuntime.upsertScheduledTask` with the same payload as `PUT /api/projects/:id/scheduled-tasks` (`name`, `schedule.kind/time/timezone`, `execution.prompt` + provider/model) on a registered project, then best-effort `scheduledTasksRuntime.syncProject`. It emits a `schedule` card.
|
|
257
|
+
- `list_scheduled_tasks` lists registered projects' tasks with exact task/project IDs, schedule, model and a bounded prompt preview. Failed project reads remain explicit partial failures. Read-only background turns may list but cannot modify tasks.
|
|
258
|
+
- `update_scheduled_task` uses the existing project-config patch operation and scheduler sync, changing only supplied fields and validating explicit models against the connected catalog. It emits the existing schedule card; it can edit tasks created outside the Assistant.
|
|
259
|
+
- Native and legacy text calls share the same tool-name validation and shell-alias normalization. `shell`, `powershell`, `grep`, `glob`, `find` and `ls` may resolve to the existing `bash` tool only when it is available. Native call IDs survive normalization. Unknown tool corrections identify the rejected name and available tools, without executing a rejected prefix. The contact harness owns bounded correction; generic completion callers retain strict tool-name validation.
|
|
257
260
|
- Successful `schedule_task` also writes an assistants-owned mapping row in `assistants.sqlite` (`assistant_scheduled_task`: assistantID + projectID + taskID). Project-config execution strips unknown fields, so ownership stays out of the task payload. `GET /api/yuri/assistants/:id/scheduled-tasks` returns those mappings joined with live `listScheduledTasks` records when possible; failed project lookups keep the mapping with `task: null`.
|
|
258
261
|
- `CONTACT_SYSTEM_PROMPT` + `formatContactToolsPrompt` + `formatPiCodingPrompt` tell the model to call these from natural language (开新对话 / 找项目 / 现有对话 / 查看助手设定·默认提示词 / 改默认提示词·设置人设 / 建助理 / 建会话·继续会话 / 监听会话 / 停止会话 / 排定时任务 / 给 X 说一声). Catalog lines include each tool's JSON argument schema (pi `write`/`edit` require `path`+`content` / `path`+`edits[{oldText,newText}]`). A reply without the tool call does nothing; never say 已创建 / 已发送 / 已停止 unless the tool returned. Completions are messages-only (no native tools), so `parseContactToolCalls` accepts a fence, a whole-message JSON object, or a bare `{name, arguments}` object anywhere in the reply. Tool results are re-injected as user turns labeled `Yuri tool result name=<tool> call=<id>` with JSON `{ isError, content }`; assistant calls and their arguments/IDs are also retained so multi-step turns keep call/result association. The harness replaces every `{{LANGUAGE}}` token — in the built-in prompt and in `defaultPrompt` — with the UI locale sent on the composer payload (`language` field, whitelisted locale code → display name). Background/settle turns recall the last locale seen for that assistant; unknown or missing locales resolve to `the user's interface language`, so the token never leaks into the prompt.
|
|
259
262
|
- If the user asked for `new_conversation` / `clear_chat_history` / `list_projects` / `list_sessions` / `get_assistant_settings` / `update_default_prompt` / `create_assistant` / `schedule_task` / `message_assistant` / `watch_session` / `stop_session` / `assign_session` and the first completion has no tool call, the harness runs **one** follow-up completion whose user content is only `emit the fence now, do not claim success.` If still no tool, the turn replies that it could not complete and does not fake a card. No slash commands. No second store.
|
|
@@ -30,6 +30,8 @@ export const ARCHIVE_SESSION_TOOL_NAME = 'archive_session';
|
|
|
30
30
|
export const DELETE_SESSION_TOOL_NAME = 'delete_session';
|
|
31
31
|
export const CREATE_ASSISTANT_TOOL_NAME = 'create_assistant';
|
|
32
32
|
export const SCHEDULE_TASK_TOOL_NAME = 'schedule_task';
|
|
33
|
+
const LIST_SCHEDULED_TASKS_TOOL_NAME = 'list_scheduled_tasks';
|
|
34
|
+
const UPDATE_SCHEDULED_TASK_TOOL_NAME = 'update_scheduled_task';
|
|
33
35
|
export const MESSAGE_ASSISTANT_TOOL_NAME = 'message_assistant';
|
|
34
36
|
export const NEW_CONVERSATION_TOOL_NAME = 'new_conversation';
|
|
35
37
|
export const CLEAR_CHAT_HISTORY_TOOL_NAME = 'clear_chat_history';
|
|
@@ -90,11 +92,38 @@ export function normalizeAssignRequestKey(params = {}) {
|
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
// Common shell-style tool names that models emit from other harnesses. They run
|
|
96
|
+
// through the real bash tool instead of being rejected.
|
|
97
|
+
const BASH_ALIAS_TOOLS = new Set(['shell', 'powershell', 'grep', 'glob', 'find', 'ls']);
|
|
98
|
+
const shellQuote = (value) => `'${String(value).replace(/'/g, `'\\''`)}'`;
|
|
99
|
+
const aliasString = (args, ...keys) => {
|
|
100
|
+
for (const key of keys) {
|
|
101
|
+
if (typeof args?.[key] === 'string' && args[key].trim()) return args[key].trim();
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
};
|
|
105
|
+
const bashAliasCommand = (name, args = {}) => {
|
|
106
|
+
const command = aliasString(args, 'command', 'cmd', 'script');
|
|
107
|
+
if (command) return command;
|
|
108
|
+
const target = shellQuote(aliasString(args, 'path', 'directory', 'dir', 'cwd') || '.');
|
|
109
|
+
const pattern = aliasString(args, 'pattern', 'query', 'regex', 'name', 'glob');
|
|
110
|
+
if (name === 'ls') return `ls -la ${target}`;
|
|
111
|
+
if (!pattern) return null;
|
|
112
|
+
if (name === 'grep') {
|
|
113
|
+
const include = aliasString(args, 'include', 'glob', 'filePattern');
|
|
114
|
+
const quoted = shellQuote(pattern);
|
|
115
|
+
return include && include !== pattern
|
|
116
|
+
? `if command -v rg >/dev/null 2>&1; then rg -n -g ${shellQuote(include)} -e ${quoted} ${target}; else grep -rnE --include=${shellQuote(include)} -e ${quoted} ${target}; fi`
|
|
117
|
+
: `if command -v rg >/dev/null 2>&1; then rg -n -e ${quoted} ${target}; else grep -rnE -e ${quoted} ${target}; fi`;
|
|
118
|
+
}
|
|
119
|
+
return `if command -v rg >/dev/null 2>&1; then rg --files -g ${shellQuote(pattern)} ${target}; else find ${target} -name ${shellQuote(pattern)}; fi`;
|
|
120
|
+
};
|
|
94
121
|
|
|
95
122
|
export const MISSED_FENCE_RETRY_USER_TEXT = 'emit the fence now, do not claim success.';
|
|
96
123
|
|
|
97
124
|
const CREATE_ASSISTANT_INTENT = /建助理|新建[^。\n!]{0,24}助理|创建[^。\n!]{0,24}助理|加一个助理|create (?:an |a new )?assistant|new assistant/iu;
|
|
125
|
+
// Changing or reviewing existing tasks starts with list_scheduled_tasks, not schedule_task.
|
|
126
|
+
const UPDATE_SCHEDULED_TASK_INTENT = /(?:改|修改|更新|换|切换|暂停|停用|启用|查看|看看|列出)[^。\n]{0,24}定时任务|定时任务[^。\n]{0,40}(?:改|换成|换为|切换|暂停|停用|启用|有哪些|列表)|(?:update|change|edit|pause|disable|enable|list)[^.\n]{0,24}scheduled tasks?/iu;
|
|
98
127
|
const SCHEDULE_TASK_INTENT = /排定时任务|排个?定时任务|定时任务|schedule (?:a )?(?:daily )?(?:task|ping)|scheduled task|排个?(?:每日)?(?:任务|ping)/iu;
|
|
99
128
|
const ASSIGN_SESSION_INTENT = /(?:建|开)(?:一个|个)?(?:新)?(?:编码\s*)?(?:session|会话)|继续(?:这个|该|那个)?(?:编码\s*)?(?:session|会话)|open (?:a )?(?:coding )?session|continue (?:the |this |that )?(?:coding )?session|assign_session/giu;
|
|
100
129
|
const WATCH_SESSION_INTENT = /监听(?:这个|该|那个)?(?:编码\s*)?(?:session|会话)|关注(?:这个|该|那个)?(?:编码\s*)?(?:session|会话)|watch (?:the |this |that )?(?:coding )?session|monitor (?:the |this |that )?(?:coding )?session|watch_session/giu;
|
|
@@ -170,6 +199,28 @@ const scheduleTaskParameters = typeboxObject({
|
|
|
170
199
|
model: typeboxOptional(typeboxString('Optional provider/model string such as opencode-go/deepseek-v4-flash.')),
|
|
171
200
|
});
|
|
172
201
|
|
|
202
|
+
const listScheduledTasksParameters = typeboxObject({
|
|
203
|
+
projectPath: typeboxOptional(typeboxString('Registered project path or id to limit the listing. Omit to list every registered project.')),
|
|
204
|
+
query: typeboxOptional(typeboxString('Optional filter against task name, id, prompt, or provider/model.')),
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const updateScheduledTaskParameters = typeboxObject({
|
|
208
|
+
taskID: typeboxString('Exact task id from list_scheduled_tasks.'),
|
|
209
|
+
projectID: typeboxString('Exact project id from list_scheduled_tasks.'),
|
|
210
|
+
name: typeboxOptional(typeboxString('New task name.')),
|
|
211
|
+
enabled: typeboxOptional(typeboxString('"true" or "false" to enable or pause the task.')),
|
|
212
|
+
prompt: typeboxOptional(typeboxString('New prompt for the scheduled run.')),
|
|
213
|
+
providerID: typeboxOptional(typeboxString('New OpenCode provider ID from the connected catalog.')),
|
|
214
|
+
modelID: typeboxOptional(typeboxString('New OpenCode model ID from the connected catalog.')),
|
|
215
|
+
model: typeboxOptional(typeboxString('New provider/model string from the connected catalog.')),
|
|
216
|
+
kind: typeboxOptional(typeboxString('New schedule kind: daily, weekly, once, or cron.')),
|
|
217
|
+
time: typeboxOptional(typeboxString('New HH:mm local time.')),
|
|
218
|
+
timezone: typeboxOptional(typeboxString('New IANA timezone.')),
|
|
219
|
+
date: typeboxOptional(typeboxString('YYYY-MM-DD for kind=once.')),
|
|
220
|
+
weekdays: typeboxOptional(typeboxString('Comma-separated 0-6 weekdays for kind=weekly.')),
|
|
221
|
+
cron: typeboxOptional(typeboxString('Cron expression for kind=cron.')),
|
|
222
|
+
});
|
|
223
|
+
|
|
173
224
|
const messageAssistantParameters = typeboxObject({
|
|
174
225
|
text: typeboxString('Read-only message to insert into the other assistant contact transcript.'),
|
|
175
226
|
to: typeboxOptional(typeboxString('Recipient assistant display name, e.g. PeerQA.')),
|
|
@@ -349,8 +400,8 @@ export function boundSessionListLimit(value) {
|
|
|
349
400
|
const allowedToolName = (name, allowedNames) => {
|
|
350
401
|
if (typeof name !== 'string' || !name.trim()) return false;
|
|
351
402
|
const next = name.trim();
|
|
352
|
-
if (
|
|
353
|
-
return
|
|
403
|
+
if (allowedNames.has(next)) return true;
|
|
404
|
+
return BASH_ALIAS_TOOLS.has(next) && allowedNames.has('bash');
|
|
354
405
|
};
|
|
355
406
|
|
|
356
407
|
const parseToolPayload = (raw, allowedNames) => {
|
|
@@ -365,9 +416,43 @@ const parseToolPayload = (raw, allowedNames) => {
|
|
|
365
416
|
if (!allowedToolName(name, allowedNames)) return null;
|
|
366
417
|
const args = parsed.arguments;
|
|
367
418
|
if (args != null && (typeof args !== 'object' || Array.isArray(args))) return null;
|
|
368
|
-
|
|
419
|
+
const normalizedArgs = args && typeof args === 'object' ? args : {};
|
|
420
|
+
if (!allowedNames.has(name) && BASH_ALIAS_TOOLS.has(name)) {
|
|
421
|
+
const command = bashAliasCommand(name, normalizedArgs);
|
|
422
|
+
if (!command) return null;
|
|
423
|
+
const timeout = typeof normalizedArgs.timeout === 'number' ? { timeout: normalizedArgs.timeout } : {};
|
|
424
|
+
return { name: 'bash', arguments: { command, ...timeout } };
|
|
425
|
+
}
|
|
426
|
+
return { name, arguments: normalizedArgs };
|
|
369
427
|
};
|
|
370
428
|
|
|
429
|
+
const describeRejectedToolPayload = (raw, allowedNames) => {
|
|
430
|
+
const fallback = 'Invalid or unavailable tool in yuri-tool fence';
|
|
431
|
+
let parsed;
|
|
432
|
+
try { parsed = JSON.parse(raw); }
|
|
433
|
+
catch { return `${fallback}: the payload is not valid JSON.`; }
|
|
434
|
+
const name = typeof parsed?.name === 'string' ? parsed.name.trim() : '';
|
|
435
|
+
if (name && !allowedToolName(name, allowedNames)) {
|
|
436
|
+
return `${fallback}: "${name.slice(0, 80)}" is not an available tool. Use only: ${[...allowedNames].join(', ')}. If no available tool can do the task, say so in a final answer.`;
|
|
437
|
+
}
|
|
438
|
+
return `${fallback}: expected {"name":"<tool>","arguments":{...}}.`;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export function parseContactNativeToolCalls(calls, allowedNames) {
|
|
442
|
+
const allowed = new Set(allowedNames);
|
|
443
|
+
const toolCalls = [];
|
|
444
|
+
for (const call of calls) {
|
|
445
|
+
let args;
|
|
446
|
+
try { args = JSON.parse(call.function.arguments); }
|
|
447
|
+
catch { return { toolCalls: [], protocolError: 'Tool arguments must be valid JSON.' }; }
|
|
448
|
+
const raw = JSON.stringify({ name: call.function.name, arguments: args });
|
|
449
|
+
const parsed = parseToolPayload(raw, allowed);
|
|
450
|
+
if (!parsed) return { toolCalls: [], protocolError: describeRejectedToolPayload(raw, allowed) };
|
|
451
|
+
toolCalls.push({ ...parsed, id: call.id });
|
|
452
|
+
}
|
|
453
|
+
return { toolCalls, protocolError: '' };
|
|
454
|
+
}
|
|
455
|
+
|
|
371
456
|
const extractJsonObjectAt = (text, start) => {
|
|
372
457
|
if (text[start] !== '{') return null;
|
|
373
458
|
let depth = 0;
|
|
@@ -426,7 +511,7 @@ export function stripContactToolFences(text) {
|
|
|
426
511
|
export function parseContactToolCalls(text, allowedNames = []) {
|
|
427
512
|
const allowed = new Set(
|
|
428
513
|
(Array.isArray(allowedNames) ? allowedNames : [])
|
|
429
|
-
.filter((name) => typeof name === 'string' && name.trim()
|
|
514
|
+
.filter((name) => typeof name === 'string' && name.trim())
|
|
430
515
|
.map((name) => name.trim()),
|
|
431
516
|
);
|
|
432
517
|
const raw = typeof text === 'string' ? text : '';
|
|
@@ -451,7 +536,7 @@ export function parseContactToolCalls(text, allowedNames = []) {
|
|
|
451
536
|
}
|
|
452
537
|
const toolCall = parseToolPayload(raw.slice(payloadStart, end).trim(), allowed);
|
|
453
538
|
if (!toolCall) {
|
|
454
|
-
return { chatText: '', toolCalls: [], protocolError:
|
|
539
|
+
return { chatText: '', toolCalls: [], protocolError: describeRejectedToolPayload(raw.slice(payloadStart, end).trim(), allowed) };
|
|
455
540
|
}
|
|
456
541
|
toolCalls.push(toolCall);
|
|
457
542
|
visible.push(raw.slice(visibleStart, index));
|
|
@@ -524,7 +609,7 @@ const hasNewConversationIntent = (text) => hasIntentMatch(NEW_CONVERSATION_INTEN
|
|
|
524
609
|
export function detectRequestedContactTools(userText, allowedNames = []) {
|
|
525
610
|
const allowed = new Set(
|
|
526
611
|
(Array.isArray(allowedNames) ? allowedNames : [])
|
|
527
|
-
.filter((name) => typeof name === 'string' && name.trim()
|
|
612
|
+
.filter((name) => typeof name === 'string' && name.trim())
|
|
528
613
|
.map((name) => name.trim()),
|
|
529
614
|
);
|
|
530
615
|
const text = typeof userText === 'string' ? userText : '';
|
|
@@ -558,7 +643,9 @@ export function detectRequestedContactTools(userText, allowedNames = []) {
|
|
|
558
643
|
if (allowed.has(CREATE_ASSISTANT_TOOL_NAME) && CREATE_ASSISTANT_INTENT.test(text)) {
|
|
559
644
|
requested.push(CREATE_ASSISTANT_TOOL_NAME);
|
|
560
645
|
}
|
|
561
|
-
if (allowed.has(
|
|
646
|
+
if (allowed.has(LIST_SCHEDULED_TASKS_TOOL_NAME) && UPDATE_SCHEDULED_TASK_INTENT.test(text)) {
|
|
647
|
+
requested.push(LIST_SCHEDULED_TASKS_TOOL_NAME);
|
|
648
|
+
} else if (allowed.has(SCHEDULE_TASK_TOOL_NAME) && SCHEDULE_TASK_INTENT.test(text)) {
|
|
562
649
|
requested.push(SCHEDULE_TASK_TOOL_NAME);
|
|
563
650
|
}
|
|
564
651
|
// Prefer explicit stop/watch over generic continue/assign when both could match.
|
|
@@ -592,6 +679,17 @@ const trim = (value, max = 10_000) => {
|
|
|
592
679
|
return next;
|
|
593
680
|
};
|
|
594
681
|
|
|
682
|
+
/** Model-facing scheduled-task summary: identity, schedule, model, bounded prompt preview. */
|
|
683
|
+
export function summarizeScheduledTask(task, projectID) {
|
|
684
|
+
const prompt = typeof task?.execution?.prompt === 'string' ? task.execution.prompt : '';
|
|
685
|
+
return {
|
|
686
|
+
id: task?.id ?? null, projectID, name: task?.name ?? null,
|
|
687
|
+
enabled: task?.enabled !== false, schedule: task?.schedule ?? null,
|
|
688
|
+
providerID: task?.execution?.providerID ?? null, modelID: task?.execution?.modelID ?? null,
|
|
689
|
+
promptPreview: prompt.length > 200 ? `${prompt.slice(0, 200)}…` : prompt,
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
|
|
595
693
|
/** Resolve OpenCode provider/model from tool args or the current contact. */
|
|
596
694
|
export function resolveContactProviderModel(params = {}, fallback = {}) {
|
|
597
695
|
const providerID = trim(params.providerID, 256);
|
|
@@ -710,7 +808,7 @@ export function formatApplicationToolCatalogEntry(tool) {
|
|
|
710
808
|
|
|
711
809
|
export function formatContactToolsPrompt(tools) {
|
|
712
810
|
const list = Array.isArray(tools)
|
|
713
|
-
? tools.filter((tool) => tool?.name && !
|
|
811
|
+
? tools.filter((tool) => tool?.name && !isPiCodingToolName(tool.name))
|
|
714
812
|
: [];
|
|
715
813
|
if (list.length === 0) return '';
|
|
716
814
|
return [
|
|
@@ -779,7 +877,8 @@ export function formatContactToolsPrompt(tools) {
|
|
|
779
877
|
'steer_session sends text into an existing session with delivery=steer, preserving its model. archive_session archives an existing session; delete_session permanently deletes it. Use exact sessionID from history, references or list_sessions; ask if the target is ambiguous. Only delete when the user requested deletion. These operations call real APIs; never claim success from a spoken promise. assign_session creates a new session when sessionID is omitted, or continues an existing session when supplied.',
|
|
780
878
|
'stop_session calls real OpenCode session.abort for that sessionID and returns the true result. Directory comes from authoritative session metadata. A failure is not a silent success. Do not claim stopped unless the tool returned success.',
|
|
781
879
|
'create_assistant reuses already-connected OpenCode providers (providerID/modelID). Mode is continuous.',
|
|
782
|
-
'schedule_task writes the same payload as PUT /api/projects/:id/scheduled-tasks onto a registered project.',
|
|
880
|
+
'schedule_task writes the same payload as PUT /api/projects/:id/scheduled-tasks onto a registered project. It only creates new tasks.',
|
|
881
|
+
'To review or change existing scheduled tasks, call list_scheduled_tasks, then update_scheduled_task with the exact taskID and projectID it returned. Update one task per call and pass only the fields to change.',
|
|
783
882
|
'message_assistant is read-only: it inserts into the other contact transcript. It never runs promptAsync or mutates sessions or files. Never assign through a peer message.',
|
|
784
883
|
'A reply without the tool call does nothing — agreeing in Chinese (好的 / 我来创建 / 我去说一声) is not sending.',
|
|
785
884
|
'A yuri-message prefix is not required before a tool fence; publish one only when it tells the user something new. Keep private reasoning, tool names, and raw traces out of public messages.',
|
|
@@ -917,6 +1016,8 @@ export function createContactTools({
|
|
|
917
1016
|
deleteSession,
|
|
918
1017
|
createAssistant,
|
|
919
1018
|
scheduleTask,
|
|
1019
|
+
listScheduledTasks,
|
|
1020
|
+
updateScheduledTask,
|
|
920
1021
|
deliverPeerMessage,
|
|
921
1022
|
clearContactMemory,
|
|
922
1023
|
resetContact,
|
|
@@ -1410,6 +1511,40 @@ export function createContactTools({
|
|
|
1410
1511
|
}
|
|
1411
1512
|
},
|
|
1412
1513
|
},
|
|
1514
|
+
{
|
|
1515
|
+
name: LIST_SCHEDULED_TASKS_TOOL_NAME,
|
|
1516
|
+
label: 'List scheduled tasks',
|
|
1517
|
+
description: 'List scheduled tasks across registered projects with id, projectID, name, enabled, schedule, provider/model, and a prompt preview. Partial failures list failed projects.',
|
|
1518
|
+
parameters: listScheduledTasksParameters,
|
|
1519
|
+
execute: async (_toolCallId, params) => {
|
|
1520
|
+
try {
|
|
1521
|
+
if (typeof listScheduledTasks !== 'function') throw new AssignError('upstream_error', 'Listing scheduled tasks is unavailable.');
|
|
1522
|
+
const result = await listScheduledTasks(params || {});
|
|
1523
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }], details: result, terminate: false };
|
|
1524
|
+
} catch (error) { return toolFailure(error, 'list_scheduled_tasks_failed', 'Could not list scheduled tasks.'); }
|
|
1525
|
+
},
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
name: UPDATE_SCHEDULED_TASK_TOOL_NAME,
|
|
1529
|
+
label: 'Update scheduled task',
|
|
1530
|
+
description: 'Update one existing scheduled task by exact taskID + projectID from list_scheduled_tasks. Pass only fields to change. An explicit model must exist in the connected catalog. Emits a schedule card.',
|
|
1531
|
+
parameters: updateScheduledTaskParameters,
|
|
1532
|
+
execute: async (_toolCallId, params) => {
|
|
1533
|
+
try {
|
|
1534
|
+
if (typeof updateScheduledTask !== 'function') throw new AssignError('upstream_error', 'Updating a scheduled task is unavailable.');
|
|
1535
|
+
const taskID = trim(params?.taskID, 256);
|
|
1536
|
+
const projectID = trim(params?.projectID, 256);
|
|
1537
|
+
if (!taskID || !projectID) throw new AssignError('validation_error', 'update_scheduled_task requires taskID and projectID from list_scheduled_tasks.');
|
|
1538
|
+
const updated = await updateScheduledTask({ ...params, taskID, projectID });
|
|
1539
|
+
const task = updated?.task || {};
|
|
1540
|
+
const card = createScheduleCardPart({ taskID: task.id || taskID, projectID, name: task.name || taskID,
|
|
1541
|
+
kind: task.schedule?.kind, time: task.schedule?.time || task.schedule?.times?.[0],
|
|
1542
|
+
timezone: task.schedule?.timezone, prompt: task.execution?.prompt });
|
|
1543
|
+
emitCard(card);
|
|
1544
|
+
return { content: [{ type: 'text', text: JSON.stringify({ updated: true, task: summarizeScheduledTask(task, projectID) }) }], details: { card, updated }, terminate: false };
|
|
1545
|
+
} catch (error) { return toolFailure(error, 'update_scheduled_task_failed', 'Could not update that scheduled task.'); }
|
|
1546
|
+
},
|
|
1547
|
+
},
|
|
1413
1548
|
{
|
|
1414
1549
|
name: MESSAGE_ASSISTANT_TOOL_NAME,
|
|
1415
1550
|
label: 'Message assistant',
|
|
@@ -38,6 +38,13 @@ import {
|
|
|
38
38
|
import { attachmentScopeKey } from './assign.js';
|
|
39
39
|
|
|
40
40
|
describe('contact tool protocol', () => {
|
|
41
|
+
it('recovers shell aliases and names unavailable tools without enabling bash in read-only contexts', () => {
|
|
42
|
+
const parsed = parseContactToolCalls('```yuri-tool\n{"name":"grep","arguments":{"pattern":"it\u0027s","path":"src"}}\n```', ['bash']);
|
|
43
|
+
expect(parsed.toolCalls[0]).toMatchObject({ name: 'bash' });
|
|
44
|
+
expect(parsed.toolCalls[0].arguments.command).toContain("-e 'it'\\''s' 'src'");
|
|
45
|
+
expect(parseContactToolCalls('```yuri-tool\n{"name":"grep","arguments":{"pattern":"x"}}\n```', ['read']).protocolError).toContain('"grep" is not an available tool');
|
|
46
|
+
expect(detectRequestedContactTools('把定时任务里的模型换成新的', ['schedule_task', 'list_scheduled_tasks'])).toEqual(['list_scheduled_tasks']);
|
|
47
|
+
});
|
|
41
48
|
it('shows current-instance models with ordered favorites and recents using exact ids', () => {
|
|
42
49
|
const prompt = formatConnectedModelsPrompt([
|
|
43
50
|
{ providerID: 'p', providerName: 'Connected Provider', modelID: 'claude-sonnet-4-6', name: 'Claude Sonnet 4.6' },
|
|
@@ -282,8 +289,8 @@ describe('contact tool protocol', () => {
|
|
|
282
289
|
});
|
|
283
290
|
expect(parseContactToolCalls(
|
|
284
291
|
'```yuri-tool\n{"name":"glob","arguments":{"pattern":"*"}}\n```',
|
|
285
|
-
['
|
|
286
|
-
).toolCalls).
|
|
292
|
+
['bash'],
|
|
293
|
+
).toolCalls[0]).toMatchObject({ name: 'bash' });
|
|
287
294
|
});
|
|
288
295
|
|
|
289
296
|
it('tells DeepSeek to call tools from natural language, not slash commands', () => {
|
|
@@ -438,6 +445,8 @@ describe('createContactTools', () => {
|
|
|
438
445
|
UPDATE_DEFAULT_PROMPT_TOOL_NAME,
|
|
439
446
|
CREATE_ASSISTANT_TOOL_NAME,
|
|
440
447
|
SCHEDULE_TASK_TOOL_NAME,
|
|
448
|
+
'list_scheduled_tasks',
|
|
449
|
+
'update_scheduled_task',
|
|
441
450
|
MESSAGE_ASSISTANT_TOOL_NAME,
|
|
442
451
|
ASSIGN_SESSION_TOOL_NAME,
|
|
443
452
|
WATCH_SESSION_TOOL_NAME,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
formatRegisteredProjectsPrompt,
|
|
13
13
|
MISSED_FENCE_RETRY_USER_TEXT,
|
|
14
14
|
parseContactToolCalls,
|
|
15
|
+
parseContactNativeToolCalls,
|
|
15
16
|
stripContactToolFences,
|
|
16
17
|
} from './contact-tools.js';
|
|
17
18
|
import {
|
|
@@ -108,6 +109,7 @@ export const CONTACT_SYSTEM_PROMPT = [
|
|
|
108
109
|
'Send a progress message when it tells the user something they do not already know: a direction they may want to correct, a finding that matters, a blocker, or that the work will take a while. Skip messages that would only repeat the plan or narrate a step. Keep the final answer to the remaining outcome instead of repeating earlier updates.',
|
|
109
110
|
'Public message protocol: put each user-facing progress message at the START of your response in its own yuri-message JSON fence, with a single-line JSON object {"text":"Your short message"}. Then emit the next tool call or final answer. A closed message fence is delivered immediately while you are still generating. Include only text intended for the user. Tool results are evidence for you to summarize in your own words; never copy their stock confirmation wording into your reply.',
|
|
110
111
|
'Do not expose tool traces, Activity, or editor actions.',
|
|
112
|
+
'To view, change, enable, or pause existing scheduled tasks (查看/修改/暂停定时任务), use list_scheduled_tasks and then update_scheduled_task with the returned projectID/taskID. schedule_task only creates new tasks.',
|
|
111
113
|
'You have bash, read, write, and edit in the working directory. Use them for pwd, files, and shell. Never say you have no terminal or cannot read files. Ignore any temporary generator workspace in the environment.',
|
|
112
114
|
'Understand natural language in any language, including Chinese: 开新对话 / 清除记忆 means new_conversation (LLM memory only, chat history stays), 清空聊天记录 means clear_chat_history (delete transcript), 找项目 means list_projects, 现有对话 means list_sessions, 查看助手设定 / 默认提示词 means get_assistant_settings (pass to="Name" for another assistant), 改默认提示词 / 设置人设 / 改某助手的默认提示词 means update_default_prompt (persists that assistant\'s settings, later turns only; pass to="OpenCode 配置助手" to edit another contact without changing this one), 建助理 means create_assistant, 建会话 / 开个新会话 / 继续会话 means assign_session, 监听会话 means watch_session, 停止/取消/打断会话 means stop_session, 插话 means steer_session, 归档会话 means archive_session, 删除会话 means delete_session, 排定时任务 means schedule_task, 给 X 说一声 means message_assistant, 发卡片 means emit a card via those tools — never ask the user to type /card or /dm.',
|
|
113
115
|
'You receive the registered project catalog every turn. Match the user goal against project labels and paths and existing OpenCode conversations via list_sessions. Start in the user-configured working directory; managed contacts start in the current server user home directory and can inspect user-global directories with read/bash. When the starting directory has no relevant session, walk its parent directories to find the nearest relevant existing OpenCode workspace using session directory metadata, then search that workspace for the requested project or conversation. Use an unscoped list_sessions lookup when broader context is needed. Prefer the user-configured directory and explicit session context; ask a short question when several relevant targets remain. Keep discovery bounded and use actual tool results as evidence.',
|
|
@@ -468,6 +470,7 @@ export function createContactStreamFn(createChatCompletion, {
|
|
|
468
470
|
if (typeof delta === 'string' && delta && typeof onTextDelta === 'function') onTextDelta(delta);
|
|
469
471
|
},
|
|
470
472
|
globalEventHub,
|
|
473
|
+
validateToolCalls: false,
|
|
471
474
|
});
|
|
472
475
|
signal?.throwIfAborted();
|
|
473
476
|
text = result?.completion?.choices?.[0]?.message?.content ?? result?.text ?? '';
|
|
@@ -485,9 +488,9 @@ export function createContactStreamFn(createChatCompletion, {
|
|
|
485
488
|
// A final answer is opaque text; quoted tool examples in it cannot run.
|
|
486
489
|
const nativeCalls = result?.completion?.choices?.[0]?.message?.tool_calls ?? [];
|
|
487
490
|
parsed = nativeCalls.length ? {
|
|
488
|
-
|
|
491
|
+
...parseContactNativeToolCalls(nativeCalls, allowedNames),
|
|
489
492
|
chatText: text,
|
|
490
|
-
|
|
493
|
+
...(finalText !== null ? { protocolError: 'Do not mix native tool calls with a final declaration.' } : {}),
|
|
491
494
|
} : finalText === null ? parseContactToolCalls(text, allowedNames) : { toolCalls: [], chatText: finalText };
|
|
492
495
|
const mixedBatch = parsed.toolCalls.length > 1 && parsed.toolCalls.some((call) => !isPiCodingToolName(call.name));
|
|
493
496
|
const malformedFinal = finalText === null && /```yuri-final/u.test(parsed.chatText);
|
|
@@ -659,7 +662,7 @@ export async function runContactTurn({
|
|
|
659
662
|
const modelID = assistant.modelID;
|
|
660
663
|
const cwd = resolveAssistantCwd(assistant);
|
|
661
664
|
const contactTools = Array.isArray(tools)
|
|
662
|
-
? tools.filter((tool) => tool && typeof tool.name === 'string' && !isPiCodingToolName(tool.name) && (!readOnly || ['list_projects', 'list_sessions', 'read_session', 'get_assistant_settings', 'search_memory', 'read_memory'].includes(tool.name)))
|
|
665
|
+
? tools.filter((tool) => tool && typeof tool.name === 'string' && !isPiCodingToolName(tool.name) && (!readOnly || ['list_projects', 'list_sessions', 'read_session', 'list_scheduled_tasks', 'get_assistant_settings', 'search_memory', 'read_memory'].includes(tool.name)))
|
|
663
666
|
: [];
|
|
664
667
|
let runtime = null;
|
|
665
668
|
let removeAbortListener = null;
|
|
@@ -21,6 +21,63 @@ import { createChatCompletion as gatewayCompletion } from '../llm/completions.js
|
|
|
21
21
|
import { generateOpenCodeText } from '../llm/generate.js'
|
|
22
22
|
|
|
23
23
|
describe('createContactStreamFn', () => {
|
|
24
|
+
it('offers scheduled-task lookup but no mutation or shell tools in read-only turns', async () => {
|
|
25
|
+
const seen = [];
|
|
26
|
+
const tools = createContactTools({ listScheduledTasks: vi.fn(), updateScheduledTask: vi.fn() });
|
|
27
|
+
await runContactTurn({ assistant: { providerID: 'p', modelID: 'm' }, history: [], userText: '后台复盘', tools, readOnly: true,
|
|
28
|
+
createChatCompletion: async ({ body }) => { seen.push(...body.tools.map(tool => tool.function.name)); return { text: '已检查。' }; },
|
|
29
|
+
});
|
|
30
|
+
expect(seen).toContain('list_scheduled_tasks');
|
|
31
|
+
expect(seen).not.toContain('update_scheduled_task');
|
|
32
|
+
expect(seen).not.toContain('bash');
|
|
33
|
+
});
|
|
34
|
+
it('runs scheduled-task listing and updating through native schemas and the real pi loop', async () => {
|
|
35
|
+
const listScheduledTasks = vi.fn(async () => ({ tasks: [{ id: 'task1', projectID: 'project1' }] }));
|
|
36
|
+
const updateScheduledTask = vi.fn(async () => ({ task: { id: 'task1', name: 'Task', schedule: { kind: 'daily', times: ['09:00'] }, execution: { providerID: 'p', modelID: 'm' } } }));
|
|
37
|
+
const tools = createContactTools({ listScheduledTasks, updateScheduledTask });
|
|
38
|
+
let round = 0;
|
|
39
|
+
const completion = input => gatewayCompletion({ ...input,
|
|
40
|
+
loadCatalog: async () => ({ models: [{ providerID: 'p', modelID: 'm' }] }),
|
|
41
|
+
generateText: async ({ messages, tools: schemas }) => {
|
|
42
|
+
expect(schemas.map(tool => tool.name)).toEqual(expect.arrayContaining(['list_scheduled_tasks', 'update_scheduled_task']));
|
|
43
|
+
round++;
|
|
44
|
+
if (round === 1) return { text: '', toolCalls: [{ id: 'list1', name: 'list_scheduled_tasks', arguments: {} }] };
|
|
45
|
+
expect(messages.some(message => message.role === 'tool' && message.tool_call_id === 'list1')).toBe(true);
|
|
46
|
+
if (round === 2) return { text: '', toolCalls: [{ id: 'update1', name: 'update_scheduled_task', arguments: { taskID: 'task1', projectID: 'project1', model: 'p/m' } }] };
|
|
47
|
+
return { text: '```yuri-final\n{"status":"complete","text":"任务已更新。"}\n```', toolCalls: [] };
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
const result = await runContactTurn({ assistant: { providerID: 'p', modelID: 'm' }, history: [], userText: '修改定时任务的模型', tools, createChatCompletion: completion });
|
|
51
|
+
expect(result.text).toBe('任务已更新。');
|
|
52
|
+
expect(listScheduledTasks).toHaveBeenCalledTimes(1);
|
|
53
|
+
expect(updateScheduledTask).toHaveBeenCalledExactlyOnceWith({ taskID: 'task1', projectID: 'project1', model: 'p/m' });
|
|
54
|
+
expect(round).toBe(3);
|
|
55
|
+
});
|
|
56
|
+
it('normalizes native shell aliases through the production gateway and preserves call identity', async () => {
|
|
57
|
+
const completion = input => gatewayCompletion({ ...input,
|
|
58
|
+
loadCatalog: async () => ({ models: [{ providerID: 'p', modelID: 'm' }] }),
|
|
59
|
+
generateText: async () => ({ text: '', toolCalls: [{ id: 'native_alias', name: 'grep', arguments: { pattern: 'needle', path: 'src' } }] }),
|
|
60
|
+
});
|
|
61
|
+
const result = await createContactStreamFn(completion)(
|
|
62
|
+
{ name: 'p/m', id: 'm', provider: 'yuri', api: 'openai-completions' },
|
|
63
|
+
{ messages: [{ role: 'user', content: 'Find needle in src' }], tools: [{ name: 'bash', parameters: { type: 'object', properties: { command: { type: 'string' } } } }] },
|
|
64
|
+
).result();
|
|
65
|
+
expect(result.content.at(-1)).toMatchObject({ type: 'toolCall', id: 'native_alias', name: 'bash', arguments: { command: expect.stringContaining("-e 'needle' 'src'") } });
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('corrects unavailable native tools with actionable tool names', async () => {
|
|
69
|
+
const completion = vi.fn()
|
|
70
|
+
.mockResolvedValueOnce({ completion: { choices: [{ message: { content: '', tool_calls: [{ id: 'bad', function: { name: 'list_cron', arguments: '{}' } }] } }] } })
|
|
71
|
+
.mockResolvedValueOnce({ completion: { choices: [{ message: { content: '', tool_calls: [{ id: 'good', function: { name: 'list_scheduled_tasks', arguments: '{}' } }] } }] } });
|
|
72
|
+
const result = await createContactStreamFn(completion)(
|
|
73
|
+
{ name: 'p/m', id: 'm', provider: 'yuri', api: 'openai-completions' },
|
|
74
|
+
{ messages: [], tools: [{ name: 'list_scheduled_tasks' }] },
|
|
75
|
+
).result();
|
|
76
|
+
expect(completion).toHaveBeenCalledTimes(2);
|
|
77
|
+
expect(JSON.stringify(completion.mock.calls[1][0].body.messages)).toContain('list_cron');
|
|
78
|
+
expect(JSON.stringify(completion.mock.calls[1][0].body.messages)).toContain('list_scheduled_tasks');
|
|
79
|
+
expect(result.content.at(-1)).toMatchObject({ type: 'toolCall', id: 'good', name: 'list_scheduled_tasks' });
|
|
80
|
+
});
|
|
24
81
|
it('continues eight real Agent tool rounds through gateway recovery without replaying completed tools', async () => {
|
|
25
82
|
vi.useFakeTimers()
|
|
26
83
|
try {
|
|
@@ -33,6 +33,7 @@ export const registerAssistantRoutes = (app, dependencies) => {
|
|
|
33
33
|
listScheduledTasks: dependencies.listScheduledTasks,
|
|
34
34
|
sessionIndexService: dependencies.sessionIndexService,
|
|
35
35
|
upsertScheduledTask: dependencies.upsertScheduledTask,
|
|
36
|
+
patchScheduledTask: dependencies.patchScheduledTask,
|
|
36
37
|
syncScheduledTaskProject: dependencies.syncScheduledTaskProject,
|
|
37
38
|
globalEventHub: dependencies.globalEventHub,
|
|
38
39
|
onRevisionTip: dependencies.onRevisionTip,
|