@markusylisiurunen/tau 0.3.106 → 0.3.107
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/README.md +1 -1
- package/dist/core/agent/agent_runtime.js +110 -17
- package/dist/core/agent/agent_runtime.js.map +1 -1
- package/dist/core/agent/notification_inbox.js +98 -0
- package/dist/core/agent/notification_inbox.js.map +1 -0
- package/dist/core/code_mode/agents.js +40 -2
- package/dist/core/code_mode/agents.js.map +1 -1
- package/dist/core/code_mode/models.js +8 -11
- package/dist/core/code_mode/models.js.map +1 -1
- package/dist/core/history/threaded_history_store.js.map +1 -1
- package/dist/core/models/openrouter.js +11 -3
- package/dist/core/models/openrouter.js.map +1 -1
- package/dist/core/models/openrouter_decisions.js +15 -13
- package/dist/core/models/openrouter_decisions.js.map +1 -1
- package/dist/core/runtime/chat_runtime.js +24 -3
- package/dist/core/runtime/chat_runtime.js.map +1 -1
- package/dist/core/session/runner.js +34 -0
- package/dist/core/session/runner.js.map +1 -1
- package/dist/core/static/tau_docs/code-mode.md +1 -1
- package/dist/core/static/tau_docs/getting-started.md +1 -1
- package/dist/core/static/tau_docs/openrouter.md +4 -3
- package/dist/core/static/tau_docs/sdk.md +1 -1
- package/dist/core/static/tau_docs/session-protocol.md +6 -1
- package/dist/core/static/tau_docs/subagents.md +2 -0
- package/dist/core/static/tau_docs/tui.md +1 -1
- package/dist/core/subagents/agent_supervisor.js +28 -0
- package/dist/core/subagents/agent_supervisor.js.map +1 -1
- package/dist/core/subagents/claude_code_runner.mjs +75 -75
- package/dist/core/telegram/session_manager.js +1 -0
- package/dist/core/telegram/session_manager.js.map +1 -1
- package/dist/core/tool/openrouter.js +5 -1
- package/dist/core/tool/openrouter.js.map +1 -1
- package/dist/core/tools/bash_jobs.js +1 -1
- package/dist/core/tools/bash_jobs.js.map +1 -1
- package/dist/core/tools/catalog.js +9 -1
- package/dist/core/tools/catalog.js.map +1 -1
- package/dist/core/tools/code_jobs.js +4 -1
- package/dist/core/tools/code_jobs.js.map +1 -1
- package/dist/core/tools/notifications.js +87 -0
- package/dist/core/tools/notifications.js.map +1 -0
- package/dist/core/tools/wait_for_agents.js +1 -1
- package/dist/core/tools/wait_for_agents.js.map +1 -1
- package/dist/core/version.js +2 -2
- package/dist/diff_tool/app/dist/assets/{core-Cnp6wBC7.js → core-C8H11wfm.js} +1 -1
- package/dist/diff_tool/app/dist/assets/engine-oniguruma-wS7L8vWH.js +1 -0
- package/dist/diff_tool/app/dist/assets/{highlights-DeO0fGqQ.js → highlights-cE22-a3y.js} +1 -1
- package/dist/diff_tool/app/dist/assets/{index-BDuQ2wXS.js → index-CBMkrdCu.js} +4 -4
- package/dist/diff_tool/app/dist/assets/langs-jT2mm32y.js +1 -0
- package/dist/diff_tool/app/dist/assets/{shiki-CwKGJZFi.js → shiki-vGFSB_wG.js} +2 -2
- package/dist/diff_tool/app/dist/assets/{stream-tokenizer-D4-m26wx.js → stream-tokenizer-oD1fJWpE.js} +1 -1
- package/dist/diff_tool/app/dist/assets/{themes-Do3waJhf.js → themes-CEjjT94e.js} +2 -2
- package/dist/diff_tool/app/dist/index.html +1 -1
- package/dist/host/local_session_host.js +202 -21
- package/dist/host/local_session_host.js.map +1 -1
- package/dist/host/session_protocol_handler.js +44 -22
- package/dist/host/session_protocol_handler.js.map +1 -1
- package/dist/protocol/session_protocol.d.ts +7 -1
- package/dist/protocol/session_protocol.js +3 -1
- package/dist/protocol/session_protocol.js.map +1 -1
- package/dist/store/session_snapshot_migrations.js +8 -1
- package/dist/store/session_snapshot_migrations.js.map +1 -1
- package/dist/tui/session_chat_controller.js +59 -52
- package/dist/tui/session_chat_controller.js.map +1 -1
- package/package.json +13 -12
- package/dist/diff_tool/app/dist/assets/engine-oniguruma-ConHyUk6.js +0 -1
- package/dist/diff_tool/app/dist/assets/langs-DDFHLNuJ.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Y as bundledLanguages}from"./index-CBMkrdCu.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./langs-
|
|
2
|
-
import{H as e,U as t,at as n,c as r,ct as i,lt as a,nt as o,ot as s,rt as c,s as l,st as u}from"./index-BDuQ2wXS.js";import{t as d}from"./preload-helper-DclECHGd.js";import{n as f,t as p}from"./stream-tokenizer-D4-m26wx.js";async function m(e){if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:n())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=a.get(e);if(t!=null)return t;let r=(async()=>{let t=u.get(e);if(t==null){let{bundledLanguages:n}=await d(async()=>{let{bundledLanguages:e}=await import(`./langs-DDFHLNuJ.js`);return{bundledLanguages:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e])}if(t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let{default:n}=await t(),r={name:e,data:n};return i.has(e)||i.set(e,r),r})();a.set(e,r);try{return await r}finally{a.get(e)===r&&a.delete(e)}}function h(e){return i.get(e)??m(e)}async function g(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=h(r)??m(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function _(e,t){for(let n of Array.isArray(e)?e:[e]){let e=i.get(n.name);e??(e=n,i.set(n.name,e)),t.attachLanguages([e]),s.add(e.name)}}function v(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}var y=0,b=0,x=class{backend;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=!1;#u=[t];#d=[];#f=0;#p=[];#m=-1;#h=!0;#g=!1;#_=0;#v=++b;#y=-1;#b=-1;#x;#S=0;#C=[];#w=!1;#T=v(async e=>{if(this.#l)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#i.lineCount);if(this.#t==null&&!C(this.#i.languageId)){if(await this.backend?.loadLanguages([this.#i.languageId]),this.#l)return;this.#t=this.#e.getLanguage(this.#i.languageId)}this.#D(),this.#N(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#v&&typeof r==`number`&&r===this.#_&&(this.#y>=0?this.#z(r):this.#B(r))};getStringCommentRegexpRangesInLine(e){if(!this.#s||e<0||e>=this.#i.lineCount||(this.#O(),this.#t==null))return null;if(this.#C[e]===void 0){this.#R(e);let n=this.#u[e]??t,r=this.#P(e,n);this.#u[e+1]=r.state}return this.#C[e]??null}constructor(e,t,n){this.backend=n,this.#e=e,this.#i=t.textDocument,this.#n=t.theme,this.#r=[],this.#a=t.tokenizeMaxLineLength??1e3,this.#o=t.onDeferTokenize,this.#s=t.matchBrackets!==!1,this.#c=t.__debug??!1,this.#O(),this.#D()}setTheme(e){this.#n!==e&&(this.#n=e,this.#D(),this.stopBackgroundTokenize(),this.#u=[t],this.#d=[],this.#f=0,this.#p=[],this.#t!=null&&this.#i.lineCount>0&&this.#M(0))}#D(){if(this.#n===``)return;this.backend?.getTheme(this.#n);let{colorMap:e}=this.#e.setTheme(this.#n);this.#r=e}dispose(){this.#l=!0,this.stopBackgroundTokenize(),this.#A()}tokenize(e,n,r=!1){if(this.#O(),this.#D(),this.#t==null&&!C(this.#i.languageId))throw Error(`Grammar for language "${this.#i.languageId}" not loaded`);let{lineCount:i}=this.#i,{startingLine:a=0,totalLines:o=1/0}=n??{},s=o===1/0?i:Math.min(a+o,i),c=e.startLine,l=Math.max(a,c),u=n!=null&&o!==1/0&&e.lineDelta>0&&c<s&&e.endLine>=s,d=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#s&&!d&&(this.#C.length=Math.min(this.#C.length,e.startLine));let f=r&&e.lineDelta!==0&&c>=a,p=d||n==null||c>=l,m=e.changedLineRanges??[[c,e.endLine]];this.#d=[],this.#f=0,this.#p=[];let h=-1;if(c<l)for(let[e,t]of m)e<l&&(h=Math.max(h,Math.min(t,l-1)));let g=h>=c&&(d||e.lineDelta<0);d?this.#R(c):(this.#I(e),(n==null||c>=l)&&this.#R(l));let _=0,v=m[_][1],y,b=0,x=d?m[_][0]:l,S=!1,w=new Map,T=g?new Map:void 0;if(T!=null&&!d){let e=Math.min(h+1,l,s);if(e>c){this.#R(e);let n=c,r=this.#u[n]??t;for(;n<e;n++){let e=this.#P(n,r);r=e.state,T.set(n,e.resolvedTokens)}this.#u[e]=r}}let E=this.#u[x]??t;for(;x<s;){let e=d?this.#u[x+1]:f?this.#L(x+1):void 0;p&&(this.#u[x]=E);let{resolvedTokens:t,state:n}=this.#P(x,E);if(E=n,x>=l?w.set(x,t):T?.set(x,t),p&&(this.#u[x+1]=E),S=x>=v&&(d||f)&&e!=null&&E.equals(e),S){_++;let e=m[_];if(e==null)break;if(e[0]>=s){y=e[0],b=_;break}let t=this.#u[e[0]];if(f)for(let n=x+2;n<=e[0]&&(t=this.#L(n),t!=null);n++)this.#u[n]=t;t==null?(v=e[1],x++):(x=e[0],E=t,v=e[1]),S=!1}else x++}if(p&&(x<s?this.#u[x+1]=E:this.#u[x]=E),S&&f&&y==null){for(let e=x+2;e<=i;e++){let t=this.#L(e);if(t==null)break;this.#u[e]=t}this.#d=[],this.#f=0,this.#p=[]}if(T!=null&&T.size>0&&this.#o(T),y!=null)this.#s&&d&&(this.#C.length=Math.min(this.#C.length,y)),this.#M(y,m,b);else if(!S&&x<i){let e=u&&c>=l?s:c<l&&!d?c:x;this.#s&&d&&(this.#C.length=Math.min(this.#C.length,e)),this.#M(e,m,_)}return w}prebuildStateStack(e){this.#O(),this.#T(e)}stopBackgroundTokenize(){this.#b=-1,this.#h||(this.#h=!0,this.#g=!1,this.#m=-1,this.#y=-1,this.#x=void 0,this.#S=0,this.#d=[],this.#f=0,this.#p=[],this.#A())}pauseBackgroundTokenize(){this.#h||this.#g||(this.#c&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#_}),this.#g=!0)}resumeBackgroundTokenize(){this.#h||!this.#g||this.#t==null||this.#m<0||(this.#c&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#_}),this.#g=!1,this.#j(this.#_))}#O(){this.#t==null&&!C(this.#i.languageId)&&this.#e.getLoadedLanguages().includes(this.#i.languageId)&&(this.#t=this.#e.getLanguage(this.#i.languageId))}#k(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#A(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#j(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#v,jobId:e})}#M(e,t,n=0){if(C(this.#i.languageId))return;let r=++this.#_;this.#c&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#h=!1,this.#g=!1,this.#m=e,this.#y>=0&&(this.#b=Math.max(this.#b,this.#y)),this.#y=-1,this.#x=t,this.#S=n,this.#k(),this.#j(r)}#N(e){if(this.#t==null||this.#u.length>e)return;if(!this.#h){this.#y>=0?this.#y=Math.max(this.#y,e):this.#b=Math.max(this.#b,e);return}let t=++this.#_;this.#h=!1,this.#g=!1,this.#m=this.#u.length-1,this.#y=e,this.#b=-1,this.#x=void 0,this.#S=0,this.#k(),this.#j(t)}#P(e,t){let n=this.#i.getLineText(e);if(n.length>=this.#a)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t==null||n===``||n.trim()===``)return this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=S(this.#t,this.#r,n,t,y,this.#s);return this.#F(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#F(e,t){this.#s&&(this.#C[e]=t)}#I(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#u.length-n?(this.#d=this.#u,this.#f=0,this.#u=this.#u.slice(0,n)):(this.#f=n,this.#d=this.#u.slice(n),this.#u.length=Math.min(this.#u.length,n)),this.#p=t}#L(e){let t=e;for(let n=this.#p.length-1;n>=0;n--){let[r,i,a]=this.#p[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#u[e]}}return this.#d[t-this.#f]??this.#u[e]}#R(e,n){let r=Math.min(Math.max(0,e),this.#i.lineCount);if(this.#u.length>r||this.#t==null)return!0;let i=n==null?0:performance.now(),a=this.#u.length-1,o=this.#u[a]??t;for(;a<r;){this.#u[a]=o;let e=this.#i.getLineText(a);if(e.length<this.#a&&e!==``&&e.trim()!==``){let t=S(this.#t,this.#r,e,o,y,this.#s,!1);this.#F(a,t.bracketIgnoredRanges),o=t.ruleStack}else this.#F(a,null);if(a++,this.#u[a]=o,n!=null&&performance.now()-i>n)break}return a>=r}#z(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let t=this.#R(this.#y,1);this.#h||this.#g||e!==this.#_||(t?this.stopBackgroundTokenize():(this.#m=this.#u.length-1,this.#j(e)))}#B(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let n=performance.now(),r=new Map,i=this.#i.lineCount,a=this.#x,o=this.#m,s=this.#u[o]??t,c=!1,l=this.#S,u=a?.[l]?.[1];for(;o<i;){this.#u[o]=s;let e=u==null?void 0:this.#L(o+1),t=this.#P(o,s);if(r.set(o,t.resolvedTokens),s=t.state,this.#u[o+1]=s,c=u!=null&&o>=u&&e!=null&&s.equals(e),o++,c){l++;let e=a?.[l];if(e==null)break;if(u=e[1],this.#u[e[0]]==null)c=!1;else{o=e[0],s=this.#u[o]??s,c=!1;continue}}if(performance.now()-n>1)break}if(this.#o(r),!(this.#h||this.#g||e!==this.#_)){if(c||o>=i){let e=this.#b;this.stopBackgroundTokenize(),e>=0&&this.#N(e)}else this.#m=o,this.#S=l,this.#j(e)}}};function S(t,n,r,i,a,o=!0,s=!0){let c=t.tokenizeLine2(r,i,a);c.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${r.substring(0,100)}`);let l=c.tokens,u=l.length/2,d=[],f=[];if(!s&&!o)return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f};for(let t=0;t<u;t++){let i=l[2*t],a=t+1<u?l[2*t+2]:r.length;if(i===a)continue;let c=l[2*t+1];if(s){let t=e.getForeground(c);d.push([i,n[t],r.slice(i,a)])}o&&e.getTokenType(c)>0&&f.push([i,a])}return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f}}function C(e){return e===`text`||e===`ansi`}var w=class e extends p{highlighter;options;#e=``;#t;constructor(e,t){super(),this.highlighter=e,this.options=t}tokenizeChunk(e,t){let n=(this.#e+e).split(/(\r\n|\r|\n)/),r=[];for(let e=0;e<n.length;e+=2){let i=n[e],a=this.highlighter.codeToTokens(i,{...this.options,grammarState:this.#t}),s=a.tokens[0].map(e=>({...e,offset:e.offset+this.stableOffset}));e+1<n.length?(o(t,s),this.pushLineBreak(t,i.length,n[e+1]),this.#t=a.grammarState):(r=s,this.#e=i)}return{unstable:r,tailLength:this.#e.length}}clone(){this.assertActive();let t=new e(this.highlighter,this.options);return this.copyStateTo(t),t.#e=this.#e,t.#t=this.#t,t}resetSource(){this.#e=``,this.#t=void 0}releaseSource(){this.resetSource()}},T=class e extends f{raw;loadedThemes=new Map;attachedLanguages=new Set([`text`,`ansi`]);static async create(t){let n=t===`shiki-wasm`?(await d(async()=>{let{createOnigurumaEngine:e}=await import(`./engine-oniguruma-ConHyUk6.js`);return{createOnigurumaEngine:e}},__vite__mapDeps([6,1,2,3,4,5]),import.meta.url)).createOnigurumaEngine(d(()=>import(`./wasm-4KdTHw0F.js`),[],import.meta.url)):(await d(async()=>{let{createJavaScriptRegexEngine:e}=await import(`./engine-javascript-DKxkqixV.js`);return{createJavaScriptRegexEngine:e}},[],import.meta.url)).createJavaScriptRegexEngine(),i=await r({themes:[],langs:[],engine:n});return new e(t,i)}constructor(e,t){super(e,c(e)),this.raw=t}getTheme(e){this.assertNotDisposed();let t=this.loadedThemes.get(e),n=this.themeResolver.getResolvedTheme(e)??t;if(n==null)throw Error(`Theme "${e}" has not been resolved`);if(t!==n){let t=n.textmate??(n.cssVariables==null?void 0:l(n.cssVariables));if(t==null)throw Error(`Theme "${e}" does not support Shiki`);this.raw.setTheme({...t,name:e}),this.loadedThemes.set(e,n)}return n}codeToTokens(e,t){return this.raw.codeToTokens(e,this.resolveOptions(t))}createEditorTokenizer(e){return new x(this.raw,e,this)}createStreamTokenizer(e){return new w(this.raw,this.resolveOptions(e))}async loadLanguages(e){this.assertNotDisposed(),_(await g(e.filter(e=>!this.attachedLanguages.has(e))),this)}hasLoadedLanguages(e){if(this.disposed)return!1;let t;return e.every(e=>this.attachedLanguages.has(e)?!0:!u.has(e)&&(t??=this.raw.getLoadedLanguages(),t.includes(e)))}attachLanguages(e){this.assertNotDisposed();for(let t of e){if(this.attachedLanguages.has(t.name))continue;let e=t.data.find(e=>e.name===t.name||e.aliases?.includes(t.name)===!0);if(e==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${t.name}" as its name or an alias.`);this.raw.loadLanguageSync(t.data);try{this.raw.getLanguage(t.name)}catch{throw Error(`attachResolvedLanguages: "${e.name}" is already loaded without alias "${t.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(t.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:e,themes:t,...n}){if(this.assertNotDisposed(),e!=null)return this.getTheme(e),{...n,theme:e};if(t==null)throw Error(`A theme or themes option is required`);for(let e of Object.values(t))this.getTheme(e);return{...n,themes:t}}};export{T as ShikiHighlighter};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./langs-jT2mm32y.js","./index-CBMkrdCu.js","./rolldown-runtime-XKyaHtl9.js","./preload-helper-DclECHGd.js","./lib-BKZ5ZaMU.js","./index-DuML4oGc.css","./engine-oniguruma-wS7L8vWH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{H as e,U as t,at as n,c as r,ct as i,lt as a,nt as o,ot as s,rt as c,s as l,st as u}from"./index-CBMkrdCu.js";import{t as d}from"./preload-helper-DclECHGd.js";import{n as f,t as p}from"./stream-tokenizer-oD1fJWpE.js";async function m(e){if(typeof __DIFFS_WORKER__<`u`?__DIFFS_WORKER__:n())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=a.get(e);if(t!=null)return t;let r=(async()=>{let t=u.get(e);if(t==null){let{bundledLanguages:n}=await d(async()=>{let{bundledLanguages:e}=await import(`./langs-jT2mm32y.js`);return{bundledLanguages:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);Object.prototype.hasOwnProperty.call(n,e)&&(t=n[e])}if(t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let{default:n}=await t(),r={name:e,data:n};return i.has(e)||i.set(e,r),r})();a.set(e,r);try{return await r}finally{a.get(e)===r&&a.delete(e)}}function h(e){return i.get(e)??m(e)}async function g(e){let t=[],n=[];for(let r of e){if(r===`text`||r===`ansi`)continue;let e=h(r)??m(r);`then`in e?n.push(e):t.push(e)}return n.length>0&&await Promise.all(n).then(e=>{for(let n of e){if(n==null)throw Error(`resolvedLanguages: unable to resolve language`);t.push(n)}}),t}function _(e,t){for(let n of Array.isArray(e)?e:[e]){let e=i.get(n.name);e??(e=n,i.set(n.name,e)),t.attachLanguages([e]),s.add(e.name)}}function v(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}var y=0,b=0,x=class{backend;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=!1;#u=[t];#d=[];#f=0;#p=[];#m=-1;#h=!0;#g=!1;#_=0;#v=++b;#y=-1;#b=-1;#x;#S=0;#C=[];#w=!1;#T=v(async e=>{if(this.#l)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#i.lineCount);if(this.#t==null&&!C(this.#i.languageId)){if(await this.backend?.loadLanguages([this.#i.languageId]),this.#l)return;this.#t=this.#e.getLanguage(this.#i.languageId)}this.#D(),this.#N(r)},500);#E=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#v&&typeof r==`number`&&r===this.#_&&(this.#y>=0?this.#z(r):this.#B(r))};getStringCommentRegexpRangesInLine(e){if(!this.#s||e<0||e>=this.#i.lineCount||(this.#O(),this.#t==null))return null;if(this.#C[e]===void 0){this.#R(e);let n=this.#u[e]??t,r=this.#P(e,n);this.#u[e+1]=r.state}return this.#C[e]??null}constructor(e,t,n){this.backend=n,this.#e=e,this.#i=t.textDocument,this.#n=t.theme,this.#r=[],this.#a=t.tokenizeMaxLineLength??1e3,this.#o=t.onDeferTokenize,this.#s=t.matchBrackets!==!1,this.#c=t.__debug??!1,this.#O(),this.#D()}setTheme(e){this.#n!==e&&(this.#n=e,this.#D(),this.stopBackgroundTokenize(),this.#u=[t],this.#d=[],this.#f=0,this.#p=[],this.#t!=null&&this.#i.lineCount>0&&this.#M(0))}#D(){if(this.#n===``)return;this.backend?.getTheme(this.#n);let{colorMap:e}=this.#e.setTheme(this.#n);this.#r=e}dispose(){this.#l=!0,this.stopBackgroundTokenize(),this.#A()}tokenize(e,n,r=!1){if(this.#O(),this.#D(),this.#t==null&&!C(this.#i.languageId))throw Error(`Grammar for language "${this.#i.languageId}" not loaded`);let{lineCount:i}=this.#i,{startingLine:a=0,totalLines:o=1/0}=n??{},s=o===1/0?i:Math.min(a+o,i),c=e.startLine,l=Math.max(a,c),u=n!=null&&o!==1/0&&e.lineDelta>0&&c<s&&e.endLine>=s,d=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0);this.#s&&!d&&(this.#C.length=Math.min(this.#C.length,e.startLine));let f=r&&e.lineDelta!==0&&c>=a,p=d||n==null||c>=l,m=e.changedLineRanges??[[c,e.endLine]];this.#d=[],this.#f=0,this.#p=[];let h=-1;if(c<l)for(let[e,t]of m)e<l&&(h=Math.max(h,Math.min(t,l-1)));let g=h>=c&&(d||e.lineDelta<0);d?this.#R(c):(this.#I(e),(n==null||c>=l)&&this.#R(l));let _=0,v=m[_][1],y,b=0,x=d?m[_][0]:l,S=!1,w=new Map,T=g?new Map:void 0;if(T!=null&&!d){let e=Math.min(h+1,l,s);if(e>c){this.#R(e);let n=c,r=this.#u[n]??t;for(;n<e;n++){let e=this.#P(n,r);r=e.state,T.set(n,e.resolvedTokens)}this.#u[e]=r}}let E=this.#u[x]??t;for(;x<s;){let e=d?this.#u[x+1]:f?this.#L(x+1):void 0;p&&(this.#u[x]=E);let{resolvedTokens:t,state:n}=this.#P(x,E);if(E=n,x>=l?w.set(x,t):T?.set(x,t),p&&(this.#u[x+1]=E),S=x>=v&&(d||f)&&e!=null&&E.equals(e),S){_++;let e=m[_];if(e==null)break;if(e[0]>=s){y=e[0],b=_;break}let t=this.#u[e[0]];if(f)for(let n=x+2;n<=e[0]&&(t=this.#L(n),t!=null);n++)this.#u[n]=t;t==null?(v=e[1],x++):(x=e[0],E=t,v=e[1]),S=!1}else x++}if(p&&(x<s?this.#u[x+1]=E:this.#u[x]=E),S&&f&&y==null){for(let e=x+2;e<=i;e++){let t=this.#L(e);if(t==null)break;this.#u[e]=t}this.#d=[],this.#f=0,this.#p=[]}if(T!=null&&T.size>0&&this.#o(T),y!=null)this.#s&&d&&(this.#C.length=Math.min(this.#C.length,y)),this.#M(y,m,b);else if(!S&&x<i){let e=u&&c>=l?s:c<l&&!d?c:x;this.#s&&d&&(this.#C.length=Math.min(this.#C.length,e)),this.#M(e,m,_)}return w}prebuildStateStack(e){this.#O(),this.#T(e)}stopBackgroundTokenize(){this.#b=-1,this.#h||(this.#h=!0,this.#g=!1,this.#m=-1,this.#y=-1,this.#x=void 0,this.#S=0,this.#d=[],this.#f=0,this.#p=[],this.#A())}pauseBackgroundTokenize(){this.#h||this.#g||(this.#c&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#_}),this.#g=!0)}resumeBackgroundTokenize(){this.#h||!this.#g||this.#t==null||this.#m<0||(this.#c&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#_}),this.#g=!1,this.#j(this.#_))}#O(){this.#t==null&&!C(this.#i.languageId)&&this.#e.getLoadedLanguages().includes(this.#i.languageId)&&(this.#t=this.#e.getLanguage(this.#i.languageId))}#k(){this.#w||=(globalThis.addEventListener(`message`,this.#E),!0)}#A(){this.#w&&=(globalThis.removeEventListener(`message`,this.#E),!1)}#j(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#v,jobId:e})}#M(e,t,n=0){if(C(this.#i.languageId))return;let r=++this.#_;this.#c&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#h=!1,this.#g=!1,this.#m=e,this.#y>=0&&(this.#b=Math.max(this.#b,this.#y)),this.#y=-1,this.#x=t,this.#S=n,this.#k(),this.#j(r)}#N(e){if(this.#t==null||this.#u.length>e)return;if(!this.#h){this.#y>=0?this.#y=Math.max(this.#y,e):this.#b=Math.max(this.#b,e);return}let t=++this.#_;this.#h=!1,this.#g=!1,this.#m=this.#u.length-1,this.#y=e,this.#b=-1,this.#x=void 0,this.#S=0,this.#k(),this.#j(t)}#P(e,t){let n=this.#i.getLineText(e);if(n.length>=this.#a)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t==null||n===``||n.trim()===``)return this.#F(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=S(this.#t,this.#r,n,t,y,this.#s);return this.#F(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#F(e,t){this.#s&&(this.#C[e]=t)}#I(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#u.length-n?(this.#d=this.#u,this.#f=0,this.#u=this.#u.slice(0,n)):(this.#f=n,this.#d=this.#u.slice(n),this.#u.length=Math.min(this.#u.length,n)),this.#p=t}#L(e){let t=e;for(let n=this.#p.length-1;n>=0;n--){let[r,i,a]=this.#p[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#u[e]}}return this.#d[t-this.#f]??this.#u[e]}#R(e,n){let r=Math.min(Math.max(0,e),this.#i.lineCount);if(this.#u.length>r||this.#t==null)return!0;let i=n==null?0:performance.now(),a=this.#u.length-1,o=this.#u[a]??t;for(;a<r;){this.#u[a]=o;let e=this.#i.getLineText(a);if(e.length<this.#a&&e!==``&&e.trim()!==``){let t=S(this.#t,this.#r,e,o,y,this.#s,!1);this.#F(a,t.bracketIgnoredRanges),o=t.ruleStack}else this.#F(a,null);if(a++,this.#u[a]=o,n!=null&&performance.now()-i>n)break}return a>=r}#z(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let t=this.#R(this.#y,1);this.#h||this.#g||e!==this.#_||(t?this.stopBackgroundTokenize():(this.#m=this.#u.length-1,this.#j(e)))}#B(e){if(this.#h||this.#g||this.#t==null||e!==this.#_)return;this.#D();let n=performance.now(),r=new Map,i=this.#i.lineCount,a=this.#x,o=this.#m,s=this.#u[o]??t,c=!1,l=this.#S,u=a?.[l]?.[1];for(;o<i;){this.#u[o]=s;let e=u==null?void 0:this.#L(o+1),t=this.#P(o,s);if(r.set(o,t.resolvedTokens),s=t.state,this.#u[o+1]=s,c=u!=null&&o>=u&&e!=null&&s.equals(e),o++,c){l++;let e=a?.[l];if(e==null)break;if(u=e[1],this.#u[e[0]]==null)c=!1;else{o=e[0],s=this.#u[o]??s,c=!1;continue}}if(performance.now()-n>1)break}if(this.#o(r),!(this.#h||this.#g||e!==this.#_)){if(c||o>=i){let e=this.#b;this.stopBackgroundTokenize(),e>=0&&this.#N(e)}else this.#m=o,this.#S=l,this.#j(e)}}};function S(t,n,r,i,a,o=!0,s=!0){let c=t.tokenizeLine2(r,i,a);c.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${r.substring(0,100)}`);let l=c.tokens,u=l.length/2,d=[],f=[];if(!s&&!o)return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f};for(let t=0;t<u;t++){let i=l[2*t],a=t+1<u?l[2*t+2]:r.length;if(i===a)continue;let c=l[2*t+1];if(s){let t=e.getForeground(c);d.push([i,n[t],r.slice(i,a)])}o&&e.getTokenType(c)>0&&f.push([i,a])}return{ruleStack:c.ruleStack,resolvedTokens:d,bracketIgnoredRanges:f}}function C(e){return e===`text`||e===`ansi`}var w=class e extends p{highlighter;options;#e=``;#t;constructor(e,t){super(),this.highlighter=e,this.options=t}tokenizeChunk(e,t){let n=(this.#e+e).split(/(\r\n|\r|\n)/),r=[];for(let e=0;e<n.length;e+=2){let i=n[e],a=this.highlighter.codeToTokens(i,{...this.options,grammarState:this.#t}),s=a.tokens[0].map(e=>({...e,offset:e.offset+this.stableOffset}));e+1<n.length?(o(t,s),this.pushLineBreak(t,i.length,n[e+1]),this.#t=a.grammarState):(r=s,this.#e=i)}return{unstable:r,tailLength:this.#e.length}}clone(){this.assertActive();let t=new e(this.highlighter,this.options);return this.copyStateTo(t),t.#e=this.#e,t.#t=this.#t,t}resetSource(){this.#e=``,this.#t=void 0}releaseSource(){this.resetSource()}},T=class e extends f{raw;loadedThemes=new Map;attachedLanguages=new Set([`text`,`ansi`]);static async create(t){let n=t===`shiki-wasm`?(await d(async()=>{let{createOnigurumaEngine:e}=await import(`./engine-oniguruma-wS7L8vWH.js`);return{createOnigurumaEngine:e}},__vite__mapDeps([6,1,2,3,4,5]),import.meta.url)).createOnigurumaEngine(d(()=>import(`./wasm-4KdTHw0F.js`),[],import.meta.url)):(await d(async()=>{let{createJavaScriptRegexEngine:e}=await import(`./engine-javascript-DKxkqixV.js`);return{createJavaScriptRegexEngine:e}},[],import.meta.url)).createJavaScriptRegexEngine(),i=await r({themes:[],langs:[],engine:n});return new e(t,i)}constructor(e,t){super(e,c(e)),this.raw=t}getTheme(e){this.assertNotDisposed();let t=this.loadedThemes.get(e),n=this.themeResolver.getResolvedTheme(e)??t;if(n==null)throw Error(`Theme "${e}" has not been resolved`);if(t!==n){let t=n.textmate??(n.cssVariables==null?void 0:l(n.cssVariables));if(t==null)throw Error(`Theme "${e}" does not support Shiki`);this.raw.setTheme({...t,name:e}),this.loadedThemes.set(e,n)}return n}codeToTokens(e,t){return this.raw.codeToTokens(e,this.resolveOptions(t))}createEditorTokenizer(e){return new x(this.raw,e,this)}createStreamTokenizer(e){return new w(this.raw,this.resolveOptions(e))}async loadLanguages(e){this.assertNotDisposed(),_(await g(e.filter(e=>!this.attachedLanguages.has(e))),this)}hasLoadedLanguages(e){if(this.disposed)return!1;let t;return e.every(e=>this.attachedLanguages.has(e)?!0:!u.has(e)&&(t??=this.raw.getLoadedLanguages(),t.includes(e)))}attachLanguages(e){this.assertNotDisposed();for(let t of e){if(this.attachedLanguages.has(t.name))continue;let e=t.data.find(e=>e.name===t.name||e.aliases?.includes(t.name)===!0);if(e==null)throw Error(`attachResolvedLanguages: No returned grammar declares "${t.name}" as its name or an alias.`);this.raw.loadLanguageSync(t.data);try{this.raw.getLanguage(t.name)}catch{throw Error(`attachResolvedLanguages: "${e.name}" is already loaded without alias "${t.name}". Load the alias first or give the grammar a unique name.`)}this.attachedLanguages.add(t.name)}}releaseResources(){this.loadedThemes.clear(),this.attachedLanguages.clear(),this.raw.dispose()}resolveOptions({theme:e,themes:t,...n}){if(this.assertNotDisposed(),e!=null)return this.getTheme(e),{...n,theme:e};if(t==null)throw Error(`A theme or themes option is required`);for(let e of Object.values(t))this.getTheme(e);return{...n,themes:t}}};export{T as ShikiHighlighter};
|
package/dist/diff_tool/app/dist/assets/{stream-tokenizer-D4-m26wx.js → stream-tokenizer-oD1fJWpE.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,dt as t,et as n,ft as r,ut as i}from"./index-
|
|
1
|
+
import{$ as e,dt as t,et as n,ft as r,ut as i}from"./index-CBMkrdCu.js";function a(t,r,i,a=!1){let o=[0];if(i.decorations?.some(e=>typeof e.start==`number`||typeof e.end==`number`)===!0)for(let e=t.indexOf(`
|
|
2
2
|
`);e!==-1;e=t.indexOf(`
|
|
3
3
|
`,e+1))o.push(e+1);let s={type:`element`,tagName:`code`,properties:{},children:[]},c=n(r.tokens,{decorations:i.decorations,mergeWhitespaces:i.mergeWhitespaces,lineOffsets:o,cacheHtmlStyles:a});for(let e=0;e<c.length;e++)e>0&&s.children.push({type:`text`,value:`
|
|
4
4
|
`}),s.children.push(c[e]);let l={type:`root`,children:[{type:`element`,tagName:`pre`,properties:{class:`diffs`,style:r.rootStyle===!1?void 0:r.rootStyle??[r.fg==null?``:`color:${r.fg}`,r.bg==null?``:`background-color:${r.bg}`].filter(Boolean).join(`;`),tabIndex:0},children:[s]}]};return e(l)}var o=class{name;themeResolver;disposed=!1;constructor(e,n){this.name=e,this.themeResolver=n,t(e)}codeToHtml(e,t){return a(e,this.codeToTokens(e,t),t,this.name===`highlights`)}get isDisposed(){return this.disposed}dispose(){this.disposed||(this.disposed=!0,this.releaseResources(),r())}assertNotDisposed(){if(this.disposed)throw new i}},s=class{disposed=!1;stableOffset=0;unstable=[];pendingCarriageReturn=``;enqueue(e){this.assertActive(),e=this.pendingCarriageReturn+e,this.pendingCarriageReturn=e.endsWith(`\r`)?`\r`:``,this.pendingCarriageReturn!==``&&(e=e.slice(0,-1));let t=this.unstable.length,n=[],{unstable:r,tailLength:i}=this.tokenizeChunk(e,n);return this.pendingCarriageReturn!==``&&r.push({content:`\r`,offset:this.stableOffset+i}),this.unstable=r,{recall:t,stable:n,unstable:r}}pushLineBreak(e,t,n){for(let r=0;r<n.length;r++)e.push({content:n[r],offset:this.stableOffset+t+r});this.stableOffset+=t+n.length}close(){let e=this.unstable;return this.dispose(),{stable:e}}clear(){this.assertActive(),this.stableOffset=0,this.unstable=[],this.pendingCarriageReturn=``,this.resetSource()}dispose(){this.disposed||(this.disposed=!0,this.unstable=[],this.releaseSource())}copyStateTo(e){e.stableOffset=this.stableOffset,e.unstable=this.unstable.slice(),e.pendingCarriageReturn=this.pendingCarriageReturn}assertActive(){if(this.disposed)throw Error(`stream tokenizer is disposed`)}};export{o as n,s as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./core-
|
|
2
|
-
import{it as e}from"./index-BDuQ2wXS.js";import{t}from"./preload-helper-DclECHGd.js";function n(e){let t=[],i=new Set;for(let n of r(e.themes)){let e=o(n)?n.getThemes():[n];for(let n of e){if(i.has(n.name))throw Error(`Theme collection already contains theme "${n.name}"`);i.add(n.name),t.push(n)}}let a=Object.freeze([...t]),s=Object.freeze(a.filter(e=>e.colorScheme===`light`)),c=Object.freeze(a.filter(e=>e.colorScheme===`dark`)),l=new Map(a.map(e=>[e.name,e])),u=Object.freeze(a.map(e=>e.name)),d=Object.freeze(s.map(e=>e.name)),f=Object.freeze(c.map(e=>e.name));function p(e){if(e==null)return a;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?s:t===`dark`?c:a:a.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return l.get(e)},getThemes(e){return p(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?d:e?.colorScheme===`dark`?f:u:p(e).map(e=>e.name)},hasTheme(e){return l.has(e)},orderBy(e){return n({themes:a.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],r=new Set;for(let n of e){if(r.has(n))throw Error(`Theme collection pick already includes theme "${n}"`);r.add(n);let e=l.get(n);if(e==null)throw Error(`Theme collection does not contain theme "${n}"`);t.push(e)}return n({themes:t})},registerInto(e){for(let t of a)e.registerThemeIfAbsent(t.name,t.load)}}}function r(e){return i(e)?[e]:e}function i(e){return o(e)||a(e)}function a(e){return typeof e.name==`string`&&typeof e.load==`function`}function o(e){return typeof e.getThemes==`function`}function s({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:c(t)}}function c(n){return async()=>{let[r,{normalizeTheme:i}]=await Promise.all([n(),t(()=>import(`./core-Cnp6wBC7.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)]);return i(e(r))}}var l=`pierre`,u=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],d=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],f=[...d,...u],p=new Set(d);function m(e){return p.has(e)?`light`:`dark`}var h={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},g={"pierre-dark":()=>t(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>t(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>t(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>t(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>t(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>t(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>t(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>t(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>t(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>t(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function _(e){return s({name:e,collection:l,colorScheme:m(e),displayName:h[e],load:g[e]})}var v=n({themes:f.map(e=>_(e))}),y=`shiki`,b=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],x=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),S=new Set(b);function C(e){return S.has(e)?`light`:`dark`}var w={andromeeda:()=>t(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>t(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>t(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>t(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>t(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>t(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>t(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>t(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>t(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>t(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>t(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>t(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>t(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>t(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>t(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>t(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>t(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>t(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>t(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>t(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>t(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>t(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>t(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>t(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>t(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>t(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>t(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>t(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>t(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>t(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>t(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>t(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>t(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>t(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>t(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>t(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>t(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>t(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>t(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>t(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>t(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>t(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>t(()=>import(`./monokai-BscAjiQZ.js`),[],import.meta.url),"night-owl":()=>t(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>t(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>t(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>t(()=>import(`./one-dark-pro-C6YyR8OD.js`),[],import.meta.url),"one-light":()=>t(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>t(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>t(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>t(()=>import(`./red-CYlAq2b0.js`),[],import.meta.url),"rose-pine":()=>t(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>t(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>t(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>t(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>t(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>t(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>t(()=>import(`./solarized-dark-b97czJOk.js`),[],import.meta.url),"solarized-light":()=>t(()=>import(`./solarized-light-DFPxpIYQ.js`),[],import.meta.url),"synthwave-84":()=>t(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>t(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>t(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>t(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>t(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>t(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function T(e){return s({name:e,collection:y,colorScheme:C(e),load:w[e]})}var E=n({themes:Object.freeze([...b.map(e=>T(e)),...x.map(e=>T(e))])}),D=n({themes:[v,E]});export{s as createTheme,v as pierreThemes,E as shikiThemes,D as themes};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./core-C8H11wfm.js","./index-CBMkrdCu.js","./rolldown-runtime-XKyaHtl9.js","./preload-helper-DclECHGd.js","./lib-BKZ5ZaMU.js","./index-DuML4oGc.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{it as e}from"./index-CBMkrdCu.js";import{t}from"./preload-helper-DclECHGd.js";function n(e){let t=[],i=new Set;for(let n of r(e.themes)){let e=o(n)?n.getThemes():[n];for(let n of e){if(i.has(n.name))throw Error(`Theme collection already contains theme "${n.name}"`);i.add(n.name),t.push(n)}}let a=Object.freeze([...t]),s=Object.freeze(a.filter(e=>e.colorScheme===`light`)),c=Object.freeze(a.filter(e=>e.colorScheme===`dark`)),l=new Map(a.map(e=>[e.name,e])),u=Object.freeze(a.map(e=>e.name)),d=Object.freeze(s.map(e=>e.name)),f=Object.freeze(c.map(e=>e.name));function p(e){if(e==null)return a;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?s:t===`dark`?c:a:a.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return l.get(e)},getThemes(e){return p(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?d:e?.colorScheme===`dark`?f:u:p(e).map(e=>e.name)},hasTheme(e){return l.has(e)},orderBy(e){return n({themes:a.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],r=new Set;for(let n of e){if(r.has(n))throw Error(`Theme collection pick already includes theme "${n}"`);r.add(n);let e=l.get(n);if(e==null)throw Error(`Theme collection does not contain theme "${n}"`);t.push(e)}return n({themes:t})},registerInto(e){for(let t of a)e.registerThemeIfAbsent(t.name,t.load)}}}function r(e){return i(e)?[e]:e}function i(e){return o(e)||a(e)}function a(e){return typeof e.name==`string`&&typeof e.load==`function`}function o(e){return typeof e.getThemes==`function`}function s({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:c(t)}}function c(n){return async()=>{let[r,{normalizeTheme:i}]=await Promise.all([n(),t(()=>import(`./core-C8H11wfm.js`),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)]);return i(e(r))}}var l=`pierre`,u=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],d=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],f=[...d,...u],p=new Set(d);function m(e){return p.has(e)?`light`:`dark`}var h={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},g={"pierre-dark":()=>t(()=>import(`./pierre-dark-CpLgRqie.js`),[],import.meta.url),"pierre-dark-soft":()=>t(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[],import.meta.url),"pierre-dark-vibrant":()=>t(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[],import.meta.url),"pierre-dark-protanopia-deuteranopia":()=>t(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[],import.meta.url),"pierre-dark-tritanopia":()=>t(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[],import.meta.url),"pierre-light":()=>t(()=>import(`./pierre-light-CoaEpmwp.js`),[],import.meta.url),"pierre-light-soft":()=>t(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[],import.meta.url),"pierre-light-vibrant":()=>t(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[],import.meta.url),"pierre-light-protanopia-deuteranopia":()=>t(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[],import.meta.url),"pierre-light-tritanopia":()=>t(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[],import.meta.url)};function _(e){return s({name:e,collection:l,colorScheme:m(e),displayName:h[e],load:g[e]})}var v=n({themes:f.map(e=>_(e))}),y=`shiki`,b=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],x=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),S=new Set(b);function C(e){return S.has(e)?`light`:`dark`}var w={andromeeda:()=>t(()=>import(`./andromeeda-vGVdxbeo.js`),[],import.meta.url),"aurora-x":()=>t(()=>import(`./aurora-x-CDeNXAV0.js`),[],import.meta.url),"ayu-dark":()=>t(()=>import(`./ayu-dark-DluEY0Gj.js`),[],import.meta.url),"ayu-light":()=>t(()=>import(`./ayu-light-C3h-C4tm.js`),[],import.meta.url),"ayu-mirage":()=>t(()=>import(`./ayu-mirage-Bqwy1Gya.js`),[],import.meta.url),"catppuccin-frappe":()=>t(()=>import(`./catppuccin-frappe-C9Q5zVZY.js`),[],import.meta.url),"catppuccin-latte":()=>t(()=>import(`./catppuccin-latte-CtsyrtPq.js`),[],import.meta.url),"catppuccin-macchiato":()=>t(()=>import(`./catppuccin-macchiato-R8nAf1vR.js`),[],import.meta.url),"catppuccin-mocha":()=>t(()=>import(`./catppuccin-mocha-DjuaAJKi.js`),[],import.meta.url),"dark-plus":()=>t(()=>import(`./dark-plus-Cs2F2srj.js`),[],import.meta.url),dracula:()=>t(()=>import(`./dracula-BHWKrbxM.js`),[],import.meta.url),"dracula-soft":()=>t(()=>import(`./dracula-soft-5eyTD99u.js`),[],import.meta.url),"everforest-dark":()=>t(()=>import(`./everforest-dark-sB-x3p7T.js`),[],import.meta.url),"everforest-light":()=>t(()=>import(`./everforest-light-Df2xbC6M.js`),[],import.meta.url),"github-dark":()=>t(()=>import(`./github-dark-C-LZuMrd.js`),[],import.meta.url),"github-dark-default":()=>t(()=>import(`./github-dark-default-DXG-b-1a.js`),[],import.meta.url),"github-dark-dimmed":()=>t(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[],import.meta.url),"github-dark-high-contrast":()=>t(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[],import.meta.url),"github-light":()=>t(()=>import(`./github-light-EUqPIrTm.js`),[],import.meta.url),"github-light-default":()=>t(()=>import(`./github-light-default-BXViO-2h.js`),[],import.meta.url),"github-light-high-contrast":()=>t(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[],import.meta.url),"gruvbox-dark-hard":()=>t(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[],import.meta.url),"gruvbox-dark-medium":()=>t(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[],import.meta.url),"gruvbox-dark-soft":()=>t(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[],import.meta.url),"gruvbox-light-hard":()=>t(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[],import.meta.url),"gruvbox-light-medium":()=>t(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[],import.meta.url),"gruvbox-light-soft":()=>t(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[],import.meta.url),horizon:()=>t(()=>import(`./horizon-CE9ld1lL.js`),[],import.meta.url),"horizon-bright":()=>t(()=>import(`./horizon-bright-DSNQnXHK.js`),[],import.meta.url),houston:()=>t(()=>import(`./houston-CsvMBhTu.js`),[],import.meta.url),"kanagawa-dragon":()=>t(()=>import(`./kanagawa-dragon-Bozd7klA.js`),[],import.meta.url),"kanagawa-lotus":()=>t(()=>import(`./kanagawa-lotus-BmuOG9ZW.js`),[],import.meta.url),"kanagawa-wave":()=>t(()=>import(`./kanagawa-wave-BML5mF2J.js`),[],import.meta.url),laserwave:()=>t(()=>import(`./laserwave-C_8bwKvT.js`),[],import.meta.url),"light-plus":()=>t(()=>import(`./light-plus-DVQuIRkW.js`),[],import.meta.url),"material-theme":()=>t(()=>import(`./material-theme-Bm3Qr25_.js`),[],import.meta.url),"material-theme-darker":()=>t(()=>import(`./material-theme-darker-2IIEA8gg.js`),[],import.meta.url),"material-theme-lighter":()=>t(()=>import(`./material-theme-lighter-uhdI0v04.js`),[],import.meta.url),"material-theme-ocean":()=>t(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[],import.meta.url),"material-theme-palenight":()=>t(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[],import.meta.url),"min-dark":()=>t(()=>import(`./min-dark-BSWPekZh.js`),[],import.meta.url),"min-light":()=>t(()=>import(`./min-light-DDpmG2fV.js`),[],import.meta.url),monokai:()=>t(()=>import(`./monokai-BscAjiQZ.js`),[],import.meta.url),"night-owl":()=>t(()=>import(`./night-owl-DhmEMT88.js`),[],import.meta.url),"night-owl-light":()=>t(()=>import(`./night-owl-light-eJ-hLW7d.js`),[],import.meta.url),nord:()=>t(()=>import(`./nord-Cb4Vim4T.js`),[],import.meta.url),"one-dark-pro":()=>t(()=>import(`./one-dark-pro-C6YyR8OD.js`),[],import.meta.url),"one-light":()=>t(()=>import(`./one-light-D7Lr4KcI.js`),[],import.meta.url),plastic:()=>t(()=>import(`./plastic-DQwYfKfQ.js`),[],import.meta.url),poimandres:()=>t(()=>import(`./poimandres-DRFjx7u4.js`),[],import.meta.url),red:()=>t(()=>import(`./red-CYlAq2b0.js`),[],import.meta.url),"rose-pine":()=>t(()=>import(`./rose-pine-aMsaMD1D.js`),[],import.meta.url),"rose-pine-dawn":()=>t(()=>import(`./rose-pine-dawn-8PwUyIlP.js`),[],import.meta.url),"rose-pine-moon":()=>t(()=>import(`./rose-pine-moon-DO-qXg-I.js`),[],import.meta.url),"slack-dark":()=>t(()=>import(`./slack-dark-DnToyrRv.js`),[],import.meta.url),"slack-ochin":()=>t(()=>import(`./slack-ochin-B2OO5cIa.js`),[],import.meta.url),"snazzy-light":()=>t(()=>import(`./snazzy-light-4G7pJPwS.js`),[],import.meta.url),"solarized-dark":()=>t(()=>import(`./solarized-dark-b97czJOk.js`),[],import.meta.url),"solarized-light":()=>t(()=>import(`./solarized-light-DFPxpIYQ.js`),[],import.meta.url),"synthwave-84":()=>t(()=>import(`./synthwave-84-nFMaYfgc.js`),[],import.meta.url),"tokyo-night":()=>t(()=>import(`./tokyo-night-oM2G3aXe.js`),[],import.meta.url),vesper:()=>t(()=>import(`./vesper-DdrHHSXu.js`),[],import.meta.url),"vitesse-black":()=>t(()=>import(`./vitesse-black-fwtXNY1n.js`),[],import.meta.url),"vitesse-dark":()=>t(()=>import(`./vitesse-dark-BZCL-v6S.js`),[],import.meta.url),"vitesse-light":()=>t(()=>import(`./vitesse-light-VbXTXTou.js`),[],import.meta.url)};function T(e){return s({name:e,collection:y,colorScheme:C(e),load:w[e]})}var E=n({themes:Object.freeze([...b.map(e=>T(e)),...x.map(e=>T(e))])}),D=n({themes:[v,E]});export{s as createTheme,v as pierreThemes,E as shikiThemes,D as themes};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Tau diff tool</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-CBMkrdCu.js"></script>
|
|
8
8
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-XKyaHtl9.js">
|
|
9
9
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-DclECHGd.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/lib-BKZ5ZaMU.js">
|
|
@@ -185,6 +185,7 @@ export class LocalSessionHost {
|
|
|
185
185
|
createdAt,
|
|
186
186
|
persona: bootstrap.persona,
|
|
187
187
|
autoCompactDefaults: this.sessionOptions.autoCompactDefaults,
|
|
188
|
+
notifications: committedSnapshot?.settings.notifications ?? createParams?.notifications ?? true,
|
|
188
189
|
backend: executionEnvironment.getToolExecutionBackend(),
|
|
189
190
|
clientTools: () => this.clientToolBroker.getToolDefinitions(sessionId),
|
|
190
191
|
modelResolver: bootstrap.modelResolver,
|
|
@@ -595,6 +596,13 @@ class LocalHostedSessionHandle {
|
|
|
595
596
|
activeWorkAbortControllers = new Set();
|
|
596
597
|
activeWorkPromises = new Set();
|
|
597
598
|
activeExecAbortControllers = new Map();
|
|
599
|
+
turnIdleListeners = new Set();
|
|
600
|
+
unsubscribeNotifications;
|
|
601
|
+
/** Work that must finish before the agent starts a turn on its own. */
|
|
602
|
+
turnAdmissionHolds = 0;
|
|
603
|
+
/** Set after an interruption or a failed turn, and cleared by the next client turn. */
|
|
604
|
+
notificationWakePaused = false;
|
|
605
|
+
notificationWakeScheduled = false;
|
|
598
606
|
activeTurnPromise;
|
|
599
607
|
activeLogicalTurn;
|
|
600
608
|
disposePromise;
|
|
@@ -621,6 +629,10 @@ class LocalHostedSessionHandle {
|
|
|
621
629
|
this.recordUsage = recordUsage;
|
|
622
630
|
this.removeFromHost = removeFromHost;
|
|
623
631
|
this.session = runtime;
|
|
632
|
+
this.unsubscribeNotifications =
|
|
633
|
+
runtime.notifications?.subscribe(() => {
|
|
634
|
+
this.scheduleNotificationWake();
|
|
635
|
+
}) ?? (() => { });
|
|
624
636
|
this.boundMcpServers = structuredClone(catalog.mcp.status === "available" ? bootstrap.config.mcpServers : {});
|
|
625
637
|
this.persistedSnapshot = committedSnapshot
|
|
626
638
|
? cloneSessionProtocolSnapshot(committedSnapshot)
|
|
@@ -639,7 +651,106 @@ class LocalHostedSessionHandle {
|
|
|
639
651
|
this.runtime.supervisor.getActiveCount() > 0);
|
|
640
652
|
}
|
|
641
653
|
get isTurnRunning() {
|
|
642
|
-
return this.runtime.isTurnRunning;
|
|
654
|
+
return Boolean(this.activeLogicalTurn) || this.runtime.isTurnRunning;
|
|
655
|
+
}
|
|
656
|
+
onTurnIdle(handler) {
|
|
657
|
+
this.turnIdleListeners.add(handler);
|
|
658
|
+
return () => {
|
|
659
|
+
this.turnIdleListeners.delete(handler);
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
turnBecameIdle() {
|
|
663
|
+
if (this.isTurnRunning)
|
|
664
|
+
return;
|
|
665
|
+
for (const listener of this.turnIdleListeners) {
|
|
666
|
+
try {
|
|
667
|
+
listener();
|
|
668
|
+
}
|
|
669
|
+
catch {
|
|
670
|
+
/* Observers cannot fail session work. */
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
this.scheduleNotificationWake();
|
|
674
|
+
}
|
|
675
|
+
holdTurnAdmission() {
|
|
676
|
+
this.turnAdmissionHolds += 1;
|
|
677
|
+
let released = false;
|
|
678
|
+
return () => {
|
|
679
|
+
if (released)
|
|
680
|
+
return;
|
|
681
|
+
released = true;
|
|
682
|
+
this.turnAdmissionHolds -= 1;
|
|
683
|
+
this.scheduleNotificationWake();
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
async waitForActiveTurn() {
|
|
687
|
+
await this.activeTurnPromise?.catch(() => undefined);
|
|
688
|
+
await this.mutationQueue;
|
|
689
|
+
}
|
|
690
|
+
canWakeForNotifications() {
|
|
691
|
+
return (!this.disposing &&
|
|
692
|
+
!this.disposed &&
|
|
693
|
+
!this.notificationWakePaused &&
|
|
694
|
+
this.turnAdmissionHolds === 0 &&
|
|
695
|
+
!this.isTurnRunning &&
|
|
696
|
+
!this.hasUnsettledTurn &&
|
|
697
|
+
this.runtime.notifications?.hasUndelivered() === true);
|
|
698
|
+
}
|
|
699
|
+
get hasUnsettledTurn() {
|
|
700
|
+
return (this.pendingAcceptedTurnHistoryEntryIds.size > 0 ||
|
|
701
|
+
[...this.turns.values()].some((turn) => turn.state === "running"));
|
|
702
|
+
}
|
|
703
|
+
/** Deferred by one macrotask so that client work released at the same time is admitted first. */
|
|
704
|
+
scheduleNotificationWake() {
|
|
705
|
+
if (this.notificationWakeScheduled || !this.canWakeForNotifications())
|
|
706
|
+
return;
|
|
707
|
+
this.notificationWakeScheduled = true;
|
|
708
|
+
void this.trackActiveWork(async () => {
|
|
709
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
710
|
+
this.notificationWakeScheduled = false;
|
|
711
|
+
if (this.canWakeForNotifications())
|
|
712
|
+
await this.runNotificationTurn();
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
async runNotificationTurn() {
|
|
716
|
+
const id = this.createTurnHistoryEntryId();
|
|
717
|
+
this.pendingAcceptedTurnHistoryEntryIds.add(id);
|
|
718
|
+
try {
|
|
719
|
+
await this.runLogicalTurn((logicalTurn) => this.runAndSettleTurn(logicalTurn, id, { notificationTurn: true }));
|
|
720
|
+
}
|
|
721
|
+
catch (error) {
|
|
722
|
+
this.notificationWakePaused = true;
|
|
723
|
+
await this.recoverFailedNotificationTurn(id, error);
|
|
724
|
+
}
|
|
725
|
+
finally {
|
|
726
|
+
this.pendingAcceptedTurnHistoryEntryIds.delete(id);
|
|
727
|
+
// A notification that arrived while this turn was being admitted could not wake it.
|
|
728
|
+
this.scheduleNotificationWake();
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
/** No client waits for an automatic turn, so its failure must end up in the snapshot. */
|
|
732
|
+
async recoverFailedNotificationTurn(id, error) {
|
|
733
|
+
if (this.turns.has(id)) {
|
|
734
|
+
// Its receipt could not be settled even as failed.
|
|
735
|
+
this.invalidateProjection(error);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
try {
|
|
739
|
+
await this.enqueueMutation(async () => {
|
|
740
|
+
const item = this.appendNoticeTimelineItem(`automatic-turn-failed-${randomUUID()}`, Date.now(), {
|
|
741
|
+
kind: "tau.turn.failed",
|
|
742
|
+
version: 1,
|
|
743
|
+
severity: "error",
|
|
744
|
+
subject: { type: "session" },
|
|
745
|
+
presentation: projectSessionProtocolNoticePresentation("failed to start automatic turn", [formatErrorDiagnostic(error)]),
|
|
746
|
+
data: { reason: "runtime-error" },
|
|
747
|
+
});
|
|
748
|
+
await this.emitPatch("notice", [{ type: "timeline.append", item: structuredClone(item) }]);
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
catch (recoveryError) {
|
|
752
|
+
this.invalidateProjection(new AggregateError([error, recoveryError], "automatic turn failed"));
|
|
753
|
+
}
|
|
643
754
|
}
|
|
644
755
|
get canAcceptSteering() {
|
|
645
756
|
return this.runtime.isTurnRunning;
|
|
@@ -687,7 +798,11 @@ class LocalHostedSessionHandle {
|
|
|
687
798
|
this.pendingAcceptedTurnHistoryEntryIds.has(historyEntryId))) {
|
|
688
799
|
throw new Error(`history entry id '${historyEntryId}' belongs to an accepted turn`);
|
|
689
800
|
}
|
|
690
|
-
const
|
|
801
|
+
const recordOptions = historyEntryId === undefined ? undefined : { historyEntryId };
|
|
802
|
+
// During a turn, the text joins it and the turn owns any failure.
|
|
803
|
+
const userHistoryEntryId = this.runtime.isTurnRunning
|
|
804
|
+
? await this.session.record(options.text, recordOptions)
|
|
805
|
+
: await this.runAgentStateMutation(() => this.session.record(options.text, recordOptions));
|
|
691
806
|
return {
|
|
692
807
|
snapshot: await this.snapshot(),
|
|
693
808
|
userHistoryEntryId,
|
|
@@ -696,6 +811,7 @@ class LocalHostedSessionHandle {
|
|
|
696
811
|
async acceptTurn(options) {
|
|
697
812
|
this.assertActive();
|
|
698
813
|
const userHistoryEntryId = this.createTurnHistoryEntryId(options.historyEntryId);
|
|
814
|
+
this.notificationWakePaused = false;
|
|
699
815
|
this.pendingAcceptedTurnHistoryEntryIds.add(userHistoryEntryId);
|
|
700
816
|
try {
|
|
701
817
|
await this.session.commitUserText(options.text, { historyEntryId: userHistoryEntryId });
|
|
@@ -709,7 +825,8 @@ class LocalHostedSessionHandle {
|
|
|
709
825
|
if (preferredId !== undefined) {
|
|
710
826
|
const normalizedId = normalizeExplicitHistoryEntryId(preferredId);
|
|
711
827
|
if (this.turns.has(normalizedId) ||
|
|
712
|
-
this.pendingAcceptedTurnHistoryEntryIds.has(normalizedId)
|
|
828
|
+
this.pendingAcceptedTurnHistoryEntryIds.has(normalizedId) ||
|
|
829
|
+
this.session.rawHistoryEntries.some((entry) => entry.id === normalizedId)) {
|
|
713
830
|
throw new Error(`turn '${normalizedId}' was already accepted`);
|
|
714
831
|
}
|
|
715
832
|
return normalizedId;
|
|
@@ -730,11 +847,27 @@ class LocalHostedSessionHandle {
|
|
|
730
847
|
if (acceptedTurn.state === "settled") {
|
|
731
848
|
throw new Error(`turn '${userHistoryEntryId}' was already settled`);
|
|
732
849
|
}
|
|
733
|
-
const turn = await this.runLogicalTurn((logicalTurn) => this.
|
|
734
|
-
await this.settleTurn(userHistoryEntryId, turn);
|
|
850
|
+
const turn = await this.runLogicalTurn((logicalTurn) => this.runAndSettleTurn(logicalTurn, userHistoryEntryId, { notificationTurn: false }));
|
|
735
851
|
return { userHistoryEntryId, turn };
|
|
736
852
|
}
|
|
853
|
+
async runAndSettleTurn(logicalTurn, userHistoryEntryId, { notificationTurn }) {
|
|
854
|
+
const outcome = notificationTurn
|
|
855
|
+
? await this.runTurnNow(logicalTurn, { notificationHistoryEntryId: userHistoryEntryId })
|
|
856
|
+
: await this.runTurnNow(logicalTurn, { rootHistoryEntryId: userHistoryEntryId });
|
|
857
|
+
try {
|
|
858
|
+
await this.settleTurn(userHistoryEntryId, outcome);
|
|
859
|
+
return outcome;
|
|
860
|
+
}
|
|
861
|
+
catch (error) {
|
|
862
|
+
// A receipt left running would block every later automatic turn.
|
|
863
|
+
this.notificationWakePaused = true;
|
|
864
|
+
const failed = await this.cleanupFailedTurn(userHistoryEntryId, error);
|
|
865
|
+
await this.settleTurn(userHistoryEntryId, failed);
|
|
866
|
+
return failed;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
737
869
|
async runTurn() {
|
|
870
|
+
this.notificationWakePaused = false;
|
|
738
871
|
return await this.runLogicalTurn((logicalTurn) => this.runTurnNow(logicalTurn));
|
|
739
872
|
}
|
|
740
873
|
async settleTurn(userHistoryEntryId, outcome) {
|
|
@@ -782,31 +915,49 @@ class LocalHostedSessionHandle {
|
|
|
782
915
|
this.activeTurnPromise = undefined;
|
|
783
916
|
this.activeLogicalTurn = undefined;
|
|
784
917
|
await this.enqueueSnapshotResetIfChanged("assistant-message");
|
|
918
|
+
this.turnBecameIdle();
|
|
785
919
|
}
|
|
786
920
|
}
|
|
787
921
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
922
|
+
/**
|
|
923
|
+
* Runs a turn rooted at an existing user message, or at the notification message the runtime
|
|
924
|
+
* commits under `notificationHistoryEntryId` once the turn has started.
|
|
925
|
+
*/
|
|
926
|
+
async runTurnNow(logicalTurn, root = {}) {
|
|
927
|
+
const { notificationHistoryEntryId } = root;
|
|
928
|
+
const rootHistoryEntryId = notificationHistoryEntryId ?? this.findTurnRootUserMessage(root.rootHistoryEntryId).id;
|
|
795
929
|
if (logicalTurn.cancellationRequested)
|
|
796
930
|
return abortedTurnOutcome();
|
|
797
931
|
try {
|
|
798
|
-
const result = await this.runtime.runTurn();
|
|
932
|
+
const result = await this.runtime.runTurn({ notificationHistoryEntryId });
|
|
799
933
|
if (result.terminalResult.aborted && this.draftAssistantMessage) {
|
|
800
934
|
await this.interruptDraftAssistantMessage();
|
|
801
935
|
}
|
|
802
936
|
await this.enqueueSnapshotResetIfChanged("assistant-message");
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
937
|
+
if (logicalTurn.cancellationRequested)
|
|
938
|
+
return abortedTurnOutcome();
|
|
939
|
+
const { terminalResult } = result;
|
|
940
|
+
if (turnOutcomeFromResult(terminalResult, terminalResult.finalMessage).status !== "completed") {
|
|
941
|
+
this.notificationWakePaused = true;
|
|
942
|
+
}
|
|
943
|
+
return turnOutcomeFromResult(result, result.finalMessage);
|
|
806
944
|
}
|
|
807
945
|
catch (error) {
|
|
808
|
-
|
|
946
|
+
this.notificationWakePaused = true;
|
|
947
|
+
// An automatic turn that failed before its message was saved has no turn to fail.
|
|
948
|
+
if (notificationHistoryEntryId && !this.turns.has(notificationHistoryEntryId))
|
|
949
|
+
throw error;
|
|
950
|
+
return await this.cleanupFailedTurn(rootHistoryEntryId, error);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
findTurnRootUserMessage(historyEntryId) {
|
|
954
|
+
const rootUserMessage = historyEntryId
|
|
955
|
+
? this.session.rawHistoryEntries.find((entry) => entry.id === historyEntryId && entry.message.role === "user")
|
|
956
|
+
: this.session.rawHistoryEntries.findLast((entry) => entry.message.role === "user");
|
|
957
|
+
if (!rootUserMessage) {
|
|
958
|
+
throw new Error("cannot run a turn without a user message");
|
|
809
959
|
}
|
|
960
|
+
return rootUserMessage;
|
|
810
961
|
}
|
|
811
962
|
interruptTurn() {
|
|
812
963
|
this.assertActive();
|
|
@@ -814,14 +965,21 @@ class LocalHostedSessionHandle {
|
|
|
814
965
|
if (logicalTurn) {
|
|
815
966
|
logicalTurn.cancellationRequested = true;
|
|
816
967
|
}
|
|
817
|
-
|
|
968
|
+
const interrupted = this.runtime.interruptTurn() || Boolean(logicalTurn);
|
|
969
|
+
if (interrupted)
|
|
970
|
+
this.notificationWakePaused = true;
|
|
971
|
+
return interrupted;
|
|
818
972
|
}
|
|
819
973
|
interruptActiveWork() {
|
|
820
974
|
const logicalTurn = this.activeLogicalTurn;
|
|
821
975
|
if (logicalTurn) {
|
|
822
976
|
logicalTurn.cancellationRequested = true;
|
|
823
977
|
}
|
|
824
|
-
|
|
978
|
+
const interruptedTurn = this.runtime.interruptTurn() || Boolean(logicalTurn);
|
|
979
|
+
// Only stopping the main agent pauses automatic turns, not cancelling side work.
|
|
980
|
+
if (interruptedTurn)
|
|
981
|
+
this.notificationWakePaused = true;
|
|
982
|
+
let interrupted = interruptedTurn;
|
|
825
983
|
for (const abortController of this.activeWorkAbortControllers) {
|
|
826
984
|
if (!abortController.signal.aborted) {
|
|
827
985
|
abortController.abort();
|
|
@@ -1112,6 +1270,7 @@ class LocalHostedSessionHandle {
|
|
|
1112
1270
|
? AbortSignal.any([externalSignal, abortController.signal])
|
|
1113
1271
|
: abortController.signal;
|
|
1114
1272
|
try {
|
|
1273
|
+
signal.throwIfAborted();
|
|
1115
1274
|
return await this.runActiveWork(operation, signal);
|
|
1116
1275
|
}
|
|
1117
1276
|
finally {
|
|
@@ -1252,6 +1411,7 @@ class LocalHostedSessionHandle {
|
|
|
1252
1411
|
async dispose() {
|
|
1253
1412
|
if (!this.disposePromise) {
|
|
1254
1413
|
this.disposing = true;
|
|
1414
|
+
this.unsubscribeNotifications();
|
|
1255
1415
|
this.disposePromise = this.disposeNow();
|
|
1256
1416
|
}
|
|
1257
1417
|
return await this.disposePromise;
|
|
@@ -1435,7 +1595,7 @@ class LocalHostedSessionHandle {
|
|
|
1435
1595
|
? { usageCheckpoint: { ...agentState.usageCheckpoint } }
|
|
1436
1596
|
: {}),
|
|
1437
1597
|
},
|
|
1438
|
-
lifecycle: this.
|
|
1598
|
+
lifecycle: this.activeLogicalTurn || this.runtime.isTurnRunning ? "running" : "idle",
|
|
1439
1599
|
costTotal: this.costTotal,
|
|
1440
1600
|
settings: {
|
|
1441
1601
|
autoCompactThresholdTokens: this.runtime.autoCompactOverrideTokens,
|
|
@@ -1447,6 +1607,7 @@ class LocalHostedSessionHandle {
|
|
|
1447
1607
|
...(this.runtime.persona.settings.serviceTier !== undefined
|
|
1448
1608
|
? { serviceTier: this.runtime.persona.settings.serviceTier }
|
|
1449
1609
|
: {}),
|
|
1610
|
+
notifications: this.runtime.notifications !== undefined,
|
|
1450
1611
|
},
|
|
1451
1612
|
bootstrap: {
|
|
1452
1613
|
model: modelSnapshotFromModel(this.runtime.persona.model),
|
|
@@ -1598,6 +1759,7 @@ class LocalHostedSessionHandle {
|
|
|
1598
1759
|
}
|
|
1599
1760
|
}
|
|
1600
1761
|
async runAgentStateMutation(mutation) {
|
|
1762
|
+
const release = this.holdTurnAdmission();
|
|
1601
1763
|
const runtimeState = this.runtime.snapshot();
|
|
1602
1764
|
try {
|
|
1603
1765
|
return await mutation();
|
|
@@ -1608,6 +1770,9 @@ class LocalHostedSessionHandle {
|
|
|
1608
1770
|
}
|
|
1609
1771
|
throw error;
|
|
1610
1772
|
}
|
|
1773
|
+
finally {
|
|
1774
|
+
release();
|
|
1775
|
+
}
|
|
1611
1776
|
}
|
|
1612
1777
|
enqueueMutation(mutation) {
|
|
1613
1778
|
const result = this.mutationQueue
|
|
@@ -1877,7 +2042,23 @@ class LocalHostedSessionHandle {
|
|
|
1877
2042
|
}
|
|
1878
2043
|
this.turns.set(event.historyEntryId, turn);
|
|
1879
2044
|
}
|
|
1880
|
-
const timelineItem =
|
|
2045
|
+
const timelineItem = event.origin === "notification"
|
|
2046
|
+
? this.appendNoticeTimelineItem(`notification-${event.historyEntryId}`, event.message.timestamp, {
|
|
2047
|
+
kind: "tau.notifications",
|
|
2048
|
+
version: 1,
|
|
2049
|
+
severity: "info",
|
|
2050
|
+
subject: { type: "message", id: event.historyEntryId },
|
|
2051
|
+
presentation: projectSessionProtocolNoticePresentation(event.notificationTitles.length === 1 && event.omittedNotifications === 0
|
|
2052
|
+
? "notification"
|
|
2053
|
+
: "notifications", [
|
|
2054
|
+
...event.notificationTitles,
|
|
2055
|
+
...(event.omittedNotifications > 0
|
|
2056
|
+
? [`and ${event.omittedNotifications} more`]
|
|
2057
|
+
: []),
|
|
2058
|
+
]),
|
|
2059
|
+
data: {},
|
|
2060
|
+
})
|
|
2061
|
+
: this.appendMessageTimelineItem(event.historyEntryId, event.message.timestamp);
|
|
1881
2062
|
await this.emitPatch("user-message", [
|
|
1882
2063
|
this.agentStateChange(),
|
|
1883
2064
|
...(turn ? [{ type: "turn.set", turn }] : []),
|