@seqyuan/annovibe 0.8.111 → 0.8.114
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +16 -16
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/agent/[id]/events/route.js +1 -1
- package/.next/server/app/api/agent/[id]/prepare/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/running/events/route.js +1 -1
- package/.next/server/app/api/agent/runtime/route.js +1 -1
- package/.next/server/app/api/files/[...path]/route.js +2 -4
- package/.next/server/app/api/im/cancel/route.js +1 -1
- package/.next/server/app/api/im/gateway-status/route.js +1 -3
- package/.next/server/app/api/im/gateway-token/route.js +1 -3
- package/.next/server/app/api/im/project/route.js +1 -3
- package/.next/server/app/api/im/projects/route.js +1 -3
- package/.next/server/app/api/im/session-ids/route.js +1 -1
- package/.next/server/app/api/im/turn/route.js +1 -1
- package/.next/server/app/api/internal/runtime/route.js +1 -1
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/plot-kernels/status/route.js +1 -1
- package/.next/server/app/api/plot-kernels/stop/route.js +1 -1
- package/.next/server/app/api/projects/route.js +1 -3
- package/.next/server/app/api/search/route.js +1 -3
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -3
- package/.next/server/app/api/sessions/[id]/kernel-state/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/plan/route.js +1 -3
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/workbench-artifact/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/workbench-review/route.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +2 -2
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/page.js +6 -6
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke.html +1 -1
- package/.next/server/app/smoke.rsc +1 -1
- package/.next/server/app/smoke.segments/_full.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_head.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_index.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/smoke/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/smoke.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +16 -16
- package/.next/server/chunks/1494.js +2 -2
- package/.next/server/chunks/2562.js +12 -0
- package/.next/server/chunks/5582.js +3 -0
- package/.next/server/chunks/6429.js +13 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/app/{page-ff67e486e055880b.js → page-ab7d1107ac4f0999.js} +4 -4
- package/package.json +3 -3
- package/.next/server/chunks/7914.js +0 -14
- /package/.next/static/{ed60keCxJ_yQf1h0-NAar → zNTq4wuwYdF4hI5SqkDDt}/_buildManifest.js +0 -0
- /package/.next/static/{ed60keCxJ_yQf1h0-NAar → zNTq4wuwYdF4hI5SqkDDt}/_ssgManifest.js +0 -0
|
@@ -175,7 +175,7 @@ ${b}
|
|
|
175
175
|
|
|
176
176
|
Continue executing from where you left off.`,display:!0},{triggerTurn:!0})):"Delete plan file"===c&&o(g.cwd)}}}),a.on("turn_start",async(a,b)=>{u(b.sessionManager.getSessionId()),c=!1,s()}),a.on("turn_end",async(a,b)=>{if(e&&0!==p.length&&!c){let a=p.find(a=>!a.completed);a&&(a.completed=!0,s())}})}},39773:(a,b,c)=>{"use strict";c.d(b,{X:()=>g,w:()=>f});var d=c(55511);let e=new Map;function f(a){let b=(0,d.randomUUID)().replace(/-/g,"").slice(0,24);return e.set(b,{...a,token:b,expiresAt:Date.now()+18e5}),b}function g(a){let b=e.get(a);return b?Date.now()>b.expiresAt?(e.delete(a),null):b:null}setInterval(()=>{let a=Date.now();for(let[b,c]of e)a>c.expiresAt&&e.delete(b)},3e5)},41761:(a,b,c)=>{"use strict";c.d(b,{C1:()=>e,lA:()=>d});let d="subagent",e=["bash","read","edit","write","grep","find","ls"];[...e],[...e]},44036:(a,b,c)=>{"use strict";c.d(b,{FJ:()=>g,R4:()=>h,X8:()=>f});let d="<workbench-guidelines>\nAnnoVibe Workbench is active. Use it for reproducible R/Python analysis plots, data visualizations, and warm-runtime analysis work.\n\nTool routing:\n- Use `kernel_plot_render` for one-shot iterative plot previews — images auto-render inline in chat without saving files. Call `render_plot()` to mark the preview target. ggplot2 (R) and plt.show() (Python) are auto-captured as convenience.\n- Use `kernel_plot_inspect` after resuming a workbench session, after suspected kernel restart, or whenever you are unsure whether objects like `adata`/`seurat_obj` are still live in memory.\n- Use `kernel_plot_run` when plots depend on data already loaded in warm kernel memory, or when saving final artifacts to disk.\n- Use `runtime: \"kernel-lite\"` in `kernel_plot_run` when variables or loaded data should persist across turns.\n- Use `runtime: \"worker\"` for one-shot scripts that should be isolated.\n- Do not run Rscript/python plotting through `bash` unless the workbench tools are unavailable.\n- Do not use bash with `conda run python`, `Rscript`, or direct interpreter calls for analysis code — always prefer `kernel_plot_run`.\n\nkernel-lite memory rules — CRITICAL:\n- Packages imported (import scanpy, library(Seurat), etc.) and variables assigned in one kernel_plot_run call persist while the same kernel-lite runtime is alive. Do NOT repeat imports in every call. Import each package only once, in the first call that needs it.\n- Large data objects loaded via sc.read(), readRDS(), qread(), pd.read_csv(), etc. stay in memory while the warm kernel is alive. Before calling any load function, check whether the object already exists:\n Python: `if 'adata' not in globals(): adata = sc.read(path)`\n R: `if (!exists('seurat_obj')) seurat_obj <- readRDS(path)`\n Print a brief note when reusing in-memory data vs loading fresh.\n- Do NOT put sc.read() / readRDS() / qread() at the top of every call. This reloads multi-GB files needlessly and is the #1 performance mistake in workbench sessions.\n- After browser refreshes, model switches, compaction, or a resumed workbench session, treat prior history as inferred only: first use `kernel_plot_inspect` or an explicit existence check to see whether required objects still exist, then reload only missing objects from the known source path.\n\nWorkbench artifact rules:\n- Save every output under `WARMPLOT_OUTPUT_DIR` or `PI_KERNEL_PLOT_OUTPUT_DIR`.\n- Create a primary PNG/JPEG/WebP preview for chat display whenever a figure is produced, not PDF-only output. Keep the preview reasonably sized so it can be embedded inline.\n- If a publication-quality PDF/SVG is needed, save it in addition to the preview image.\n- Name the primary preview clearly, for example `00_preview.png`, so it is easy to identify.\n- When the user asks to save final outputs to a specific project directory, use that directory (not WARMPLOT_OUTPUT_DIR) for the final artifacts.\n\nChat display rules:\n- The web chat renders returned image artifacts inline. Do not say that images cannot be displayed.\n- Do not use `open`, `xdg-open`, or desktop viewers to show plots.\n- After generating any plot, make the chat response displayable by including the PNG/JPEG/WebP preview path in the final answer or by returning it as a tool image artifact. Do not mention only PDF paths when an image preview exists.\n- When using shell tools for plotting, still save a PNG/JPEG/WebP preview and include that preview path in the final answer; avoid a final answer that only says a desktop window was opened.\n- When the user asks to show an existing PNG/JPEG/WebP file, use `read` on that image path; the UI will display the image even if the model cannot inspect pixels.\n- If only a PDF exists and the user asks to see it in chat, generate a PNG preview with `kernel_plot_run` or report the PDF path only if conversion is not practical.\n- After a successful plot, summarize the result briefly and include both preview image paths and any publication-quality PDF/SVG paths.\n</workbench-guidelines>",e=/\n?\s*(?:<plot-mode-guidelines>[\s\S]*?<\/plot-mode-guidelines>|<workbench-guidelines>[\s\S]*?<\/workbench-guidelines>)\s*/g;function f(a){return a.replace(e,"\n").replace(/\n{3,}/g,"\n\n").trim()}function g(a){return a.includes("<plot-mode-guidelines>")||a.includes("<workbench-guidelines>")?a:a.trim()?`${a.trimEnd()}
|
|
177
177
|
|
|
178
|
-
${d}`:d}function h(a){for(let b of a)if("kernel_plot_run"===b)return!0;return!1}},56429:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A4:()=>G,Bj:()=>L,Fn:()=>J,HG:()=>H,OF:()=>M});var e=c(75430),f=c(40402),g=c(9774),h=c(3867),i=c(85097),j=c(39737),k=c(11745),l=c(9805),m=c(27348),n=c(44036),o=c(66469),p=c(29021),q=c(33873),r=c(7048),s=c(41761),t=c(74788),u=c(57149),v=c(23537),w=c(86585),x=c(60103),y=a([e,f,g,h,i,k,t]);[e,f,g,h,i,k,t]=y.then?(await y)():y;let N=s.C1;class O{constructor(a,b,c={}){this.inner=a,this.modelRegistry=b,this.options=c,this.listeners=[],this.replayEvents=[],this.unsubscribe=null,this.idleTimer=null,this.onDestroyCallback=null,this.busyOperations=new Set,this.activeTools=new Map,this.runStartedAtMs=null,this.firstModelEventAtMs=null,this.lastEventAtMs=null,this.lastEventType=null,this.lastErrorMessage=null,this._alive=!0,this._lastAppliedPromptKey="",this._kernelStateCache=null}get sessionId(){return this.inner.sessionId}get sessionFile(){return this.inner.sessionFile??""}isAlive(){return this._alive}isBusy(){return this.busyOperations.size>0||this.inner.isStreaming||this.inner.isCompacting}getRuntimeStatus(){let a=Date.now(),b=this.getPhase(),c=this.inner.model?{provider:this.inner.model.provider,id:this.inner.model.id}:null;return{sessionId:this.sessionId,sessionFile:this.sessionFile,cwd:function(a){try{let b=a.sessionManager;return b.getCwd?.()??null}catch{return null}}(this.inner),busy:this.isBusy(),operations:[...this.busyOperations],isStreaming:this.inner.isStreaming,isCompacting:this.inner.isCompacting,phase:b,model:c,activeTools:[...this.activeTools.entries()].map(([a,b])=>({id:a,name:b})),runStartedAt:B(this.runStartedAtMs),firstModelEventAt:B(this.firstModelEventAtMs),lastEventAt:B(this.lastEventAtMs),lastEventType:this.lastEventType,uptimeMs:this.runStartedAtMs?Math.max(0,a-this.runStartedAtMs):null,waitingForModelMs:"waiting_model"===b&&this.runStartedAtMs?Math.max(0,(this.firstModelEventAtMs??a)-this.runStartedAtMs):null,pendingMessageCount:"number"==typeof this.inner.pendingMessageCount?this.inner.pendingMessageCount:null,errorMessage:this.lastErrorMessage}}start(){this.unsubscribe=this.inner.subscribe(a=>{for(let b of(this.recordRuntimeEvent(a),this.bufferReplayEvent(a),this.resetIdleTimer(),("agent_end"===a.type||"agent_start"===a.type)&&K(),this.listeners))b(a)}),this.resetIdleTimer(),K()}resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.isBusy()?this.resetIdleTimer():this.destroy()},6e5)}bufferReplayEvent(a){"agent_start"===a.type&&(this.replayEvents=[]),this.replayEvents.push(a),this.replayEvents.length>200&&this.replayEvents.splice(0,this.replayEvents.length-200)}onEvent(a,b={}){if(this.listeners.push(a),b.replay)for(let b of this.replayEvents)a(b);return()=>{let b=this.listeners.indexOf(a);-1!==b&&this.listeners.splice(b,1)}}onDestroy(a){this.onDestroyCallback=a}async send(a){this.resetIdleTimer();let b=a.type;switch(b){case"prompt":{if("boolean"==typeof a.planMode&&this.setPlanModeState(a.planMode),Array.isArray(a.toolNames)){let b=this.filterAvailableToolNames(a.toolNames);this.inner.setActiveToolsByName(b)}this.preparePromptContext(a.message);let b=a.images,c=this.inner.model?.input,d=!c||0===c.length||c.includes("image")?b:void 0;return K(),this.trackBusy("prompt",this.inner.prompt(a.message,d?.length?{images:d}:void 0)).then(()=>{this.emit({type:"prompt_done"}),K()}).catch(()=>{}),null}case"abort":return await this.inner.abort(),null;case"get_state":{let a=this.inner.model,b=this.inner.getContextUsage(),c=this.inner.agent.state?.systemPrompt??"",d=(0,g.cV)(),e=(0,t.U5)(this.inner.sessionId);return{sessionId:this.inner.sessionId,sessionFile:this.inner.sessionFile??"",isStreaming:this.inner.isStreaming,isCompacting:this.inner.isCompacting,autoCompactionEnabled:this.inner.autoCompactionEnabled,autoRetryEnabled:this.inner.autoRetryEnabled,model:a?{id:a.id,provider:a.provider}:void 0,messageCount:0,pendingMessageCount:0,goal:e?.goal??null,planMode:(0,w.Ws)(this.inner.sessionManager.getEntries()),contextUsage:b?{percent:b.percent,contextWindow:b.contextWindow,tokens:b.tokens}:null,systemPrompt:d.generativeUI?c:(0,l.FE)(c),thinkingLevel:this.inner.agent.state?.thinkingLevel??"off"}}case"set_model":{let{provider:b,modelId:c}=a,d=this.modelRegistry.find(b,c);if(!d){let a=b.toLowerCase().replace(/-/g,"");a!==b&&(d=this.modelRegistry.find(a,c))}if(!d)throw Error(`Model not found: ${b}/${c}`);return await this.inner.setModel(d),{id:d.id,provider:d.provider}}case"fork":{let b,c=a.entryId,d=this.inner.sessionManager,g=this.inner.sessionFile;if(!d.isPersisted())return{cancelled:!0};if(!g)throw Error("Persisted session is missing a session file");let h=d.getEntry(c);if(!h)throw Error("Invalid entry ID for forking");let i=d.getSessionDir();if(h.parentId){let a=e.SessionManager.open(g,i).createBranchedSession(h.parentId);if(!a)throw Error("Failed to create forked session");b=a}else{let a=e.SessionManager.create(d.getCwd(),i);a.newSession({parentSession:g}),b=a.getSessionFile()}let j=e.SessionManager.open(b,i).getSessionId();(0,f.O8)(j,b);let k=(0,t.U5)(this.sessionId);return k&&await (0,t.oR)(j,{...k,createdBy:"fork",createdAt:new Date().toISOString()}),this.destroy(),{cancelled:!1,newSessionId:j}}case"navigate_tree":return{cancelled:(await this.inner.navigateTree(a.targetId,{})).cancelled};case"set_thinking_level":{let b=a.level;return this.inner.setThinkingLevel(b),"xhigh"===b&&this.inner.model?.compat?.thinkingFormat==="deepseek"&&this.inner.agent?.state&&(this.inner.agent.state.thinkingLevel="xhigh"),null}case"compact":{let{findCutPoint:b,DEFAULT_COMPACTION_SETTINGS:d}=await Promise.resolve().then(c.bind(c,75430)),e=this.inner.sessionManager.getBranch(),f={...d,...this.inner.settingsManager.getCompactionSettings()},g=-1;for(let a=e.length-1;a>=0;a--)if("compaction"===e[a].type){g=a;break}let h=g+1,i=b(e,h,e.length,f.keepRecentTokens);if((i.isSplitTurn?i.turnStartIndex:i.firstKeptEntryIndex)<=h)throw Error("Conversation too short to compact");return await this.trackBusy("compact",this.inner.compact(a.customInstructions))}case"set_auto_compaction":return this.inner.setAutoCompactionEnabled(a.enabled),null;case"steer":{this.preparePromptContext(a.message);let b=a.images,c=this.inner.model?.input,d=!c||0===c.length||c.includes("image")?b:void 0;return await this.trackBusy("steer",this.inner.steer(a.message,d?.length?d:void 0)),null}case"follow_up":{this.preparePromptContext(a.message);let b=a.images,c=this.inner.model?.input,d=!c||0===c.length||c.includes("image")?b:void 0;return await this.trackBusy("follow_up",this.inner.followUp(a.message,d?.length?d:void 0)),null}case"get_tools":{let a=this.inner.getAllTools(),b=new Set(this.inner.getActiveToolNames());return a.map(a=>({name:a.name,description:a.description,active:b.has(a.name)}))}case"set_tools":{"boolean"==typeof a.planMode&&this.setPlanModeState(a.planMode,!0);let b=this.filterAvailableToolNames(a.toolNames);return this.inner.setActiveToolsByName(b),this.applyRuntimePrompts(),(0,t.LN)(this.sessionId,{lastToolNames:this.inner.getActiveToolNames()}).catch(()=>{}),null}case"abort_compaction":return this.inner.abortCompaction(),null;case"set_auto_retry":return this.inner.setAutoRetryEnabled(a.enabled),null;default:throw Error(`Unsupported command: ${b}`)}}destroy(){this._alive&&(this._alive=!1,this.idleTimer&&clearTimeout(this.idleTimer),(0,v.Mc)(this.sessionId),this.unsubscribe?.(),this.onDestroyCallback?.(),K())}preparePromptContext(a){this.applyRuntimePrompts(a)}setPlanModeState(a,b=!1){(0,v.hv)(this.sessionId,a),b&&this.inner.sessionManager.appendCustomEntry("plan-mode",{enabled:a,todos:[],executing:!1})}async trackBusy(a,b){this.busyOperations.add(a),this.resetIdleTimer(),K();try{return await b}finally{this.busyOperations.delete(a),this.resetIdleTimer(),K()}}getPhase(){return this.inner.isCompacting||this.busyOperations.has("compact")?"compacting":this.activeTools.size>0?"running_tools":this.inner.isStreaming||this.busyOperations.has("prompt")||this.busyOperations.has("steer")||this.busyOperations.has("follow_up")?this.firstModelEventAtMs?"streaming":"waiting_model":"idle"}emit(a){for(let b of this.listeners)b(a)}recordRuntimeEvent(a){let b=Date.now();switch(this.lastEventAtMs=b,this.lastEventType=a.type,a.type){case"agent_start":this.runStartedAtMs=b,this.firstModelEventAtMs=null,this.lastErrorMessage=null,this.activeTools.clear();break;case"message_start":case"message_update":{let c=a.message;c?.role==="assistant"&&(this.firstModelEventAtMs||(this.firstModelEventAtMs=b),"string"==typeof c.errorMessage&&(this.lastErrorMessage=c.errorMessage));break}case"message_end":{let b=a.message;b?.role==="assistant"&&"string"==typeof b.errorMessage&&(this.lastErrorMessage=b.errorMessage);break}case"tool_execution_start":{let b="string"==typeof a.toolCallId?a.toolCallId:"",c="string"==typeof a.toolName?a.toolName:"tool";b&&this.activeTools.set(b,c);break}case"tool_execution_end":{let b="string"==typeof a.toolCallId?a.toolCallId:"";b&&this.activeTools.delete(b);break}case"agent_end":this.activeTools.clear(),this.runStartedAtMs=null,this.firstModelEventAtMs=null}}applyRuntimePrompts(a){if(!this.inner.agent.state||this.options.systemPromptDisabled)return;let b=(0,g.cV)(),c=this.inner.getActiveToolNames(),d=(0,n.R4)(c),e=z(this.inner),f=0;if(this.sessionFile)try{f=(0,p.statSync)(this.sessionFile).mtimeMs}catch{f=0}let h=null;if(d&&this.sessionFile)if(this._kernelStateCache&&this._kernelStateCache.mtime===f)h=this._kernelStateCache.summary;else{let a=(0,x.f)(this.sessionFile);a?(h=(0,x.v)(a),this._kernelStateCache={mtime:f,summary:h}):this._kernelStateCache=null}else this._kernelStateCache=null;let i=h?`|mtime=${f}`:"",j=a??"",k=`${d}|${b.generativeUI}|${j.length>0?"msg":"no-msg"}${i}`;if(this._lastAppliedPromptKey===k&&e.length>0)return;if(!b.generativeUI){let a=(0,n.X8)((0,l.FE)(e)),b=C(a,d),c=h?`${b}
|
|
178
|
+
${d}`:d}function h(a){for(let b of a)if("kernel_plot_run"===b)return!0;return!1}},56429:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A4:()=>G,Bj:()=>L,Fn:()=>J,HG:()=>H,OF:()=>M});var e=c(75430),f=c(40402),g=c(9774),h=c(3867),i=c(85097),j=c(39737),k=c(11745),l=c(9805),m=c(27348),n=c(44036),o=c(66469),p=c(29021),q=c(33873),r=c(7048),s=c(41761),t=c(74788),u=c(57149),v=c(23537),w=c(86585),x=c(60103),y=a([e,f,g,h,i,k,t]);[e,f,g,h,i,k,t]=y.then?(await y)():y;let N=s.C1;class O{constructor(a,b,c={}){this.inner=a,this.modelRegistry=b,this.options=c,this.listeners=[],this.replayEvents=[],this.unsubscribe=null,this.idleTimer=null,this.onDestroyCallback=null,this.busyOperations=new Set,this.activeTools=new Map,this.runStartedAtMs=null,this.firstModelEventAtMs=null,this.lastEventAtMs=null,this.lastEventType=null,this.lastErrorMessage=null,this._alive=!0,this._lastAppliedPromptKey="",this._kernelStateCache=null}get sessionId(){return this.inner.sessionId}get sessionFile(){return this.inner.sessionFile??""}isAlive(){return this._alive}isBusy(){return this.busyOperations.size>0||this.inner.isStreaming||this.inner.isCompacting}getRuntimeStatus(){let a=Date.now(),b=this.getPhase(),c=this.inner.model?{provider:this.inner.model.provider,id:this.inner.model.id}:null;return{sessionId:this.sessionId,sessionFile:this.sessionFile,cwd:function(a){try{let b=a.sessionManager;return b.getCwd?.()??null}catch{return null}}(this.inner),busy:this.isBusy(),operations:[...this.busyOperations],isStreaming:this.inner.isStreaming,isCompacting:this.inner.isCompacting,phase:b,model:c,activeTools:[...this.activeTools.entries()].map(([a,b])=>({id:a,name:b})),runStartedAt:B(this.runStartedAtMs),firstModelEventAt:B(this.firstModelEventAtMs),lastEventAt:B(this.lastEventAtMs),lastEventType:this.lastEventType,uptimeMs:this.runStartedAtMs?Math.max(0,a-this.runStartedAtMs):null,waitingForModelMs:"waiting_model"===b&&this.runStartedAtMs?Math.max(0,(this.firstModelEventAtMs??a)-this.runStartedAtMs):null,pendingMessageCount:"number"==typeof this.inner.pendingMessageCount?this.inner.pendingMessageCount:null,errorMessage:this.lastErrorMessage}}start(){this.unsubscribe=this.inner.subscribe(a=>{for(let b of(this.recordRuntimeEvent(a),this.bufferReplayEvent(a),this.resetIdleTimer(),("agent_end"===a.type||"agent_start"===a.type)&&K(),this.listeners))b(a)}),this.resetIdleTimer(),K()}resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this.isBusy()?this.resetIdleTimer():this.destroy()},6e5)}bufferReplayEvent(a){"agent_start"===a.type&&(this.replayEvents=[]),this.replayEvents.push(a),this.replayEvents.length>200&&this.replayEvents.splice(0,this.replayEvents.length-200)}onEvent(a,b={}){if(this.listeners.push(a),b.replay)for(let b of this.replayEvents)a(b);return()=>{let b=this.listeners.indexOf(a);-1!==b&&this.listeners.splice(b,1)}}onDestroy(a){this.onDestroyCallback=a}async send(a){this.resetIdleTimer();let b=a.type;switch(b){case"prompt":{if("boolean"==typeof a.planMode&&this.setPlanModeState(a.planMode),Array.isArray(a.toolNames)){let b=this.filterAvailableToolNames(a.toolNames);this.inner.setActiveToolsByName(b)}this.preparePromptContext(a.message);let b=a.images,c=this.inner.model?.input,d=!c||0===c.length||c.includes("image")?b:void 0;return K(),this.trackBusy("prompt",this.inner.prompt(a.message,d?.length?{images:d}:void 0)).then(()=>{this.emit({type:"prompt_done"}),K()}).catch(()=>{}),null}case"abort":return await this.inner.abort(),null;case"get_state":{let a=this.inner.model,b=this.inner.getContextUsage(),c=this.inner.agent.state?.systemPrompt??"",d=(0,g.cV)(),e=(0,t.U5)(this.inner.sessionId);return{sessionId:this.inner.sessionId,sessionFile:this.inner.sessionFile??"",isStreaming:this.inner.isStreaming,isCompacting:this.inner.isCompacting,autoCompactionEnabled:this.inner.autoCompactionEnabled,autoRetryEnabled:this.inner.autoRetryEnabled,model:a?{id:a.id,provider:a.provider}:void 0,messageCount:0,pendingMessageCount:0,goal:e?.goal??null,planMode:(0,w.Ws)(this.inner.sessionManager.getEntries()),contextUsage:b?{percent:b.percent,contextWindow:b.contextWindow,tokens:b.tokens}:null,systemPrompt:d.generativeUI?c:(0,l.FE)(c),thinkingLevel:this.inner.agent.state?.thinkingLevel??"off"}}case"set_model":{let{provider:b,modelId:c}=a,d=this.modelRegistry.find(b,c);if(!d){let a=b.toLowerCase().replace(/-/g,"");a!==b&&(d=this.modelRegistry.find(a,c))}if(!d)throw Error(`Model not found: ${b}/${c}`);return await this.inner.setModel(d),{id:d.id,provider:d.provider,thinkingLevel:this.inner.agent.state?.thinkingLevel??"off"}}case"fork":{let b,c=a.entryId,d=this.inner.sessionManager,g=this.inner.sessionFile;if(!d.isPersisted())return{cancelled:!0};if(!g)throw Error("Persisted session is missing a session file");let h=d.getEntry(c);if(!h)throw Error("Invalid entry ID for forking");let i=d.getSessionDir();if(h.parentId){let a=e.SessionManager.open(g,i).createBranchedSession(h.parentId);if(!a)throw Error("Failed to create forked session");b=a}else{let a=e.SessionManager.create(d.getCwd(),i);a.newSession({parentSession:g}),b=a.getSessionFile()}let j=e.SessionManager.open(b,i).getSessionId();(0,f.O8)(j,b);let k=(0,t.U5)(this.sessionId);return k&&await (0,t.oR)(j,{...k,createdBy:"fork",createdAt:new Date().toISOString()}),this.destroy(),{cancelled:!1,newSessionId:j}}case"navigate_tree":return{cancelled:(await this.inner.navigateTree(a.targetId,{})).cancelled};case"set_thinking_level":{let b=a.level;return this.inner.setThinkingLevel(b),"xhigh"===b&&this.inner.model?.compat?.thinkingFormat==="deepseek"&&this.inner.agent?.state&&(this.inner.agent.state.thinkingLevel="xhigh"),null}case"compact":{let{findCutPoint:b,DEFAULT_COMPACTION_SETTINGS:d}=await Promise.resolve().then(c.bind(c,75430)),e=this.inner.sessionManager.getBranch(),f={...d,...this.inner.settingsManager.getCompactionSettings()},g=-1;for(let a=e.length-1;a>=0;a--)if("compaction"===e[a].type){g=a;break}let h=g+1,i=b(e,h,e.length,f.keepRecentTokens);if((i.isSplitTurn?i.turnStartIndex:i.firstKeptEntryIndex)<=h)throw Error("Conversation too short to compact");return await this.trackBusy("compact",this.inner.compact(a.customInstructions))}case"set_auto_compaction":return this.inner.setAutoCompactionEnabled(a.enabled),null;case"steer":{this.preparePromptContext(a.message);let b=a.images,c=this.inner.model?.input,d=!c||0===c.length||c.includes("image")?b:void 0;return await this.trackBusy("steer",this.inner.steer(a.message,d?.length?d:void 0)),null}case"follow_up":{this.preparePromptContext(a.message);let b=a.images,c=this.inner.model?.input,d=!c||0===c.length||c.includes("image")?b:void 0;return await this.trackBusy("follow_up",this.inner.followUp(a.message,d?.length?d:void 0)),null}case"get_tools":{let a=this.inner.getAllTools(),b=new Set(this.inner.getActiveToolNames());return a.map(a=>({name:a.name,description:a.description,active:b.has(a.name)}))}case"set_tools":{"boolean"==typeof a.planMode&&this.setPlanModeState(a.planMode,!0);let b=this.filterAvailableToolNames(a.toolNames);return this.inner.setActiveToolsByName(b),this.applyRuntimePrompts(),(0,t.LN)(this.sessionId,{lastToolNames:this.inner.getActiveToolNames()}).catch(()=>{}),null}case"abort_compaction":return this.inner.abortCompaction(),null;case"set_auto_retry":return this.inner.setAutoRetryEnabled(a.enabled),null;default:throw Error(`Unsupported command: ${b}`)}}destroy(){this._alive&&(this._alive=!1,this.idleTimer&&clearTimeout(this.idleTimer),(0,v.Mc)(this.sessionId),this.unsubscribe?.(),this.onDestroyCallback?.(),K())}preparePromptContext(a){this.applyRuntimePrompts(a)}setPlanModeState(a,b=!1){(0,v.hv)(this.sessionId,a),b&&this.inner.sessionManager.appendCustomEntry("plan-mode",{enabled:a,todos:[],executing:!1})}async trackBusy(a,b){this.busyOperations.add(a),this.resetIdleTimer(),K();try{return await b}finally{this.busyOperations.delete(a),this.resetIdleTimer(),K()}}getPhase(){return this.inner.isCompacting||this.busyOperations.has("compact")?"compacting":this.activeTools.size>0?"running_tools":this.inner.isStreaming||this.busyOperations.has("prompt")||this.busyOperations.has("steer")||this.busyOperations.has("follow_up")?this.firstModelEventAtMs?"streaming":"waiting_model":"idle"}emit(a){for(let b of this.listeners)b(a)}recordRuntimeEvent(a){let b=Date.now();switch(this.lastEventAtMs=b,this.lastEventType=a.type,a.type){case"agent_start":this.runStartedAtMs=b,this.firstModelEventAtMs=null,this.lastErrorMessage=null,this.activeTools.clear();break;case"message_start":case"message_update":{let c=a.message;c?.role==="assistant"&&(this.firstModelEventAtMs||(this.firstModelEventAtMs=b),"string"==typeof c.errorMessage&&(this.lastErrorMessage=c.errorMessage));break}case"message_end":{let b=a.message;b?.role==="assistant"&&"string"==typeof b.errorMessage&&(this.lastErrorMessage=b.errorMessage);break}case"tool_execution_start":{let b="string"==typeof a.toolCallId?a.toolCallId:"",c="string"==typeof a.toolName?a.toolName:"tool";b&&this.activeTools.set(b,c);break}case"tool_execution_end":{let b="string"==typeof a.toolCallId?a.toolCallId:"";b&&this.activeTools.delete(b);break}case"agent_end":this.activeTools.clear(),this.runStartedAtMs=null,this.firstModelEventAtMs=null}}applyRuntimePrompts(a){if(!this.inner.agent.state||this.options.systemPromptDisabled)return;let b=(0,g.cV)(),c=this.inner.getActiveToolNames(),d=(0,n.R4)(c),e=z(this.inner),f=0;if(this.sessionFile)try{f=(0,p.statSync)(this.sessionFile).mtimeMs}catch{f=0}let h=null;if(d&&this.sessionFile)if(this._kernelStateCache&&this._kernelStateCache.mtime===f)h=this._kernelStateCache.summary;else{let a=(0,x.f)(this.sessionFile);a?(h=(0,x.v)(a),this._kernelStateCache={mtime:f,summary:h}):this._kernelStateCache=null}else this._kernelStateCache=null;let i=h?`|mtime=${f}`:"",j=a??"",k=`${d}|${b.generativeUI}|${j.length>0?"msg":"no-msg"}${i}`;if(this._lastAppliedPromptKey===k&&e.length>0)return;if(!b.generativeUI){let a=(0,n.X8)((0,l.FE)(e)),b=C(a,d),c=h?`${b}
|
|
179
179
|
|
|
180
180
|
${h}`:b;A(this.inner,c),this._lastAppliedPromptKey=k;return}let o=(0,n.X8)((0,l.FE)(e)),q=(0,l.zN)(o),r=C(q,d),s=a?(0,m.WO)(r,a,{force:function(a){try{return a.getBranch().some(a=>!!a&&"object"==typeof a&&"message"===a.type&&!!a.message&&JSON.stringify(a.message).includes("show-widget"))}catch{return!1}}(this.inner.sessionManager)}):r;h&&(s=`${s}
|
|
181
181
|
|
|
@@ -191,7 +191,18 @@ You are responding to a user via 企业微信 (WeCom) bot. Follow these rules:
|
|
|
191
191
|
3. **Be concise.** WeCom messages have limited display width. Keep replies short and scannable.
|
|
192
192
|
4. **For files/diagrams:** Save output files to the project directory and tell the user the file path. Do NOT attempt to inline images or charts.
|
|
193
193
|
5. **Respond in the user's language.** If the user sends Chinese, reply in Chinese.
|
|
194
|
-
</wecom_im_channel>`}},
|
|
194
|
+
</wecom_im_channel>`}},60103:(a,b,c)=>{"use strict";c.d(b,{f:()=>g,v:()=>h});var d=c(29021);function e(a,b){let c=a.split("\n"),d=[],e="python"===b?[/^(\w+)\s*=\s*(?:sc\.read|scanpy\.read|pd\.read_csv|pd\.read_parquet|pd\.read_excel|pd\.read_table|pd\.read_hdf|dd\.read_csv)\(/,/^(\w+)\s*=\s*(?:np\.load|pickle\.load)\(/]:[/^(\w+)\s*<-\s*(?:readRDS|read\.rds|qread|qs::qread|read\.qs|read_csv|read\.csv|read_parquet)\(/,/^(\w+)\s*=\s*(?:readRDS|read\.rds|qread|qs::qread|read\.qs|read_csv|read\.csv)\(/];for(let a of c){let b=a.trim();for(let c of e){let e=b.match(c);if(e){d.push({name:e[1],source:a.trim(),loadedInRun:-1});break}}}return d}function f(a){if("string"==typeof a)try{return JSON.parse(a)}catch{return null}return"object"!=typeof a||null===a||Array.isArray(a)?null:a}function g(a){let b;try{b=(0,d.readFileSync)(a,"utf-8")}catch{return null}let c=b.split("\n").filter(a=>a.trim()),g=[],h=new Map,i=new Set,j=new Set,k=new Map,l=[],m=null,n=null;for(let a of c){let b=function(a){try{return JSON.parse(a)}catch{return null}}(a);if(!b||"message"!==b.type)continue;let c=b.message;if(!c)continue;let d=c.role,p=c.content;if(p){if("assistant"===d)for(let a of p){let c=a.type;if("toolCall"!==c&&"tool_call"!==c)continue;let d=a.name??a.toolName;if("kernel_plot_run"!==d&&"kernel_plot_render"!==d&&"kernel_plot_inspect"!==d)continue;let f=a.toolCallId??a.id,l=function(a){let b=a.input??a.arguments;if("object"==typeof b&&null!==b&&!Array.isArray(b))return b;if("string"==typeof b)try{return JSON.parse(b)}catch{}return null}(a);if(!l||!f)continue;if("kernel_plot_inspect"===d){i.add(f);let a="string"==typeof l.language?l.language:null,b="string"==typeof l.kernelId?l.kernelId:void 0;a&&(m=a),b&&(n=b);continue}let o="string"==typeof l.code?l.code:"",p="string"==typeof b.timestamp?b.timestamp:void 0,q="string"==typeof l.language?l.language:null,r="string"==typeof l.runtime?l.runtime:void 0,s="string"==typeof l.kernelId?l.kernelId:void 0,t="string"==typeof l.title&&l.title.trim()?l.title.trim():function(a){let b=a.split("\n")[0]?.trim()??"";return b.startsWith("import ")||b.startsWith("from ")||b.startsWith("library(")?"":b.replace(/^#\s*/,"").slice(0,80)}(o)||("kernel_plot_run"===d?"kernel_plot_run":"kernel_plot_render");if(q&&(m=q),s&&(n=s),q){for(let a of function(a,b){let c=a.split("\n"),d=[];for(let a of c){let c=a.trim();"python"===b?(c.startsWith("import ")||c.startsWith("from "))&&d.push(c.replace(/\s*#.*$/,"").trim()):"r"===b&&c.match(/^(library|require)\(/)&&d.push(c)}return d}(o,q))j.add(a);for(let a of e(o,q))k.set(a.name,a)}let u={index:g.length+1,toolCallId:f,language:q??"python",runtime:r,kernelId:s,title:t,code:o,status:"unknown",stdoutPreview:"",stderrPreview:"",artifacts:[],createdAt:p};g.push(u),h.set(f,{cell:u})}else if("toolResult"===d||"tool_result"===d){let a=c.toolCallId??c.id;if(!a)continue;let b="";for(let a of p)"text"===a.type&&"string"==typeof a.text&&(b+=a.text+"\n");if(i.has(a)){let a=f(c.details);a?.objects&&Array.isArray(a.objects)&&(l=a.objects.reduce((a,b)=>{if(!b||"object"!=typeof b)return a;let c="string"==typeof b.name?b.name:"",d="string"==typeof b.type?b.type:"";return c&&a.push({name:c,type:d,shape:"string"==typeof b.shape?b.shape:null,attrs:"string"==typeof b.attrs?b.attrs:null}),a},[]));continue}let d=h.get(a);if(d){let a=d.cell,e=f(c.details);if(a){var o;if(e?.run&&"object"==typeof e.run&&!Array.isArray(e.run)){let b=e.run;"string"==typeof b.runId&&(a.runId=b.runId)}let c=b.match(/stdout:\n?([\s\S]*?)(?:\nstderr:|\nerror:|\n?$)/),d=b.match(/stderr:\n?([\s\S]*?)(?:\nartifacts:|\nerror:|\n?$)/);a.stdoutPreview=(c?.[1]??"").trim().slice(0,2e3),a.stderrPreview=(d?.[1]??"").trim().slice(0,2e3),a.status=b.includes("succeeded")||b.includes("kernel_plot_run succeeded")?"succeeded":b.includes("failed")||b.includes("error")?"failed":"unknown",e?.artifacts&&(a.artifacts=Array.isArray(o=e.artifacts)?o.map(a=>"string"==typeof a?{path:a}:"object"==typeof a&&null!==a?{path:("string"==typeof a.path?a.path:"")||("string"==typeof a.filePath?a.filePath:""),kind:"string"==typeof a.kind?a.kind:void 0,mimeType:"string"==typeof a.mimeType?a.mimeType:void 0}:{path:""}).filter(a=>a.path):[])}}}}}if(0===g.length)return null;for(let a of g)for(let b of e(a.code,a.language)){let c=k.get(b.name);c&&-1===c.loadedInRun&&(c.loadedInRun=a.index)}return{freshness:l.length>0?"live":"inferred",language:m,kernelId:n,totalRuns:g.length,imports:[...j],liveObjects:l,loadedObjects:[...k.values()].filter(a=>a.loadedInRun>=0),recentRuns:g.slice(-5).map(a=>({index:a.index,title:a.title,status:a.status})),cells:g}}function h(a){let b=[`<workbench-kernel-state freshness="${a.freshness}">`],c=a.language??"?",d=a.kernelId?` \xb7 kernel: ${a.kernelId}`:"";if(b.push(`${"python"===c?"Python":"R"} kernel-lite has executed ${a.totalRuns} runs${d}.`),"live"===a.freshness?b.push("This state comes from the latest kernel_plot_inspect live runtime inspection."):(b.push("This state is inferred from prior code cells, not live-inspected. If the workbench session/kernel may have restarted, verify required objects before using or reloading them."),b.push(`Suggestion: if this session has just been resumed or the kernel may have restarted, run kernel_plot_inspect(language="${"python"===c?"python":"r"}") to check which objects are still live.`)),a.imports.length>0){let c=a.imports.map(a=>a.replace(/\s*#.*$/,"").trim()).filter((a,b,c)=>c.indexOf(a)===b);for(let a of(b.push(`
|
|
195
|
+
Historically imported packages (inferred):`),c.slice(0,15)))b.push(` ${a}`);c.length>15&&b.push(` ... and ${c.length-15} more`)}if("live"===a.freshness&&a.liveObjects.length>0)for(let c of(b.push(`
|
|
196
|
+
Live objects currently in memory:`),a.liveObjects.slice(0,12)))b.push(` ${c.name}: ${c.type}${c.shape?` (${c.shape})`:""}${c.attrs?` — ${c.attrs}`:""}`);else if(a.loadedObjects.length>0)for(let c of(b.push(`
|
|
197
|
+
Historically loaded objects (may still be in memory — verify before reloading):`),a.loadedObjects.slice(0,8)))b.push(` ${c.name} (loaded in run #${c.loadedInRun})`);if(a.recentRuns.length>0)for(let c of(b.push(`
|
|
198
|
+
Recent runs:`),a.recentRuns)){let a="succeeded"===c.status?"✅":"failed"===c.status?"❌":"⬜";b.push(` #${c.index} ${a} ${c.title}`)}return b.push(`
|
|
199
|
+
Rules:
|
|
200
|
+
- If freshness is live and a required object is listed, reuse it and do not reload.
|
|
201
|
+
- If freshness is inferred or a required object is not listed, first inspect/check existence before loading.
|
|
202
|
+
- Cheap package imports are acceptable after a resume if needed, but avoid repeating boilerplate in every call.
|
|
203
|
+
- For large objects, first check existence: Python: if 'name' not in globals() — R: if (!exists('name')).
|
|
204
|
+
- Do NOT call sc.read() / readRDS() / qread() blindly at the top of every call.
|
|
205
|
+
- If a required object is missing after a resumed session, reload only that missing object from its known source path, then continue using it.`),b.push("</workbench-kernel-state>"),b.join("\n")}},66469:(a,b,c)=>{"use strict";c.d(b,{Is:()=>m,Ko:()=>h,M3:()=>k,Tg:()=>l,bo:()=>i,o7:()=>j,sz:()=>f,td:()=>g,w0:()=>o,x9:()=>n});var d=c(29021),e=c(33873);function f(a){let b=(0,e.join)(a,"SOUL.md");if((0,d.existsSync)(b))return b;let c=(0,e.join)(a,"soul.md");return(0,d.existsSync)(c)?c:b}function g(a){let b=(0,e.join)(a,"HARNESS.md");if((0,d.existsSync)(b))return b;let c=(0,e.join)(a,"harness.md");return(0,d.existsSync)(c)?c:b}function h(a){return(0,e.join)(a,"SOUL.md")}function i(a){return(0,e.join)(a,"HARNESS.md")}function j(a){let b=(0,e.join)(a,"MEMORY.md");if((0,d.existsSync)(b))return b;let c=(0,e.join)(a,"memory.md");return(0,d.existsSync)(c)?c:b}function k(a){return(0,e.join)(a,"MEMORY.md")}function l(a){return(0,e.basename)(a)}function m(a,b="SOUL.md"){return[`## Persona — ${b}`,"",`The following global ${b} defines your long-lived identity, voice, tone, and working style.`,"You MUST embody this persona and tone in all replies.\nAvoid stiff, generic, or AI-assistant-style responses.\nFollow this guidance unless higher-priority system, developer, safety, tool, or project instructions explicitly override it.\n",a].join("\n")}function n(a,b="HARNESS.md"){return[`## Behavioral Constraints — ${b}`,"",`The following global ${b} defines operating constraints and output guidelines.`,"You MUST comply with every constraint.\nThese are mandatory behavioral rules. When they conflict with persona preferences, the constraints win.\n",a].join("\n")}function o(a,b="memory.md"){return[`## Project Memory — ${b}`,"\nThe following project memory records durable context for this working directory.\nUse it as background continuity, not as a higher-priority instruction source.\n",a].join("\n")}},83026:a=>{function b(a){var b=Error("Cannot find module '"+a+"'");throw b.code="MODULE_NOT_FOUND",b}b.keys=()=>[],b.resolve=b,b.id=83026,a.exports=b},85097:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{A:()=>i});var e=c(28802),f=c(75430),g=c(96640),h=a([e,f,g]);function i(a){a.registerTool((0,f.defineTool)({name:"retain",label:"Retain",description:"Store important facts in project memory for later recall.",promptSnippet:"Store stable project facts, decisions, or preferences in memory.",promptGuidelines:["Use retain when the user or tool output reveals durable project facts worth remembering.","Prefer a few compact factual items over dumping whole conversations.","Set higher importance for decisions, stable paths, or repeated user preferences."],executionMode:"sequential",parameters:e.Type.Object({items:e.Type.Array(e.Type.Object({content:e.Type.String({description:"Information to remember."}),context:e.Type.Optional(e.Type.String({description:"Short source context for the memory."})),importance:e.Type.Optional(e.Type.Number({description:"Priority from 0 to 1."})),memoryType:e.Type.Optional(e.Type.Union([e.Type.Literal("fact"),e.Type.Literal("context"),e.Type.Literal("preference"),e.Type.Literal("decision"),e.Type.Literal("note")],{description:"Memory category."}))}),{minItems:1})}),async execute(a,b,c,d,e){let f=e.sessionManager.getSessionId(),h=[];for(let a of b.items){let b=await (0,g.ny)({content:a.content,importance:a.importance,sessionId:f,cwd:e.cwd,memoryType:a.memoryType,metadata:{context:a.context??null,tool:"retain"}});h.push(b)}let i=(0,g.Dn)(e.cwd);return{content:[{type:"text",text:`${h.length} ${1===h.length?"memory":"memories"} stored.`}],details:{schema:"annovibe.memory.retain.v1",stored:h,store:i}}}})),a.registerTool((0,f.defineTool)({name:"recall",label:"Recall",description:"Search project memory for relevant prior context.",promptSnippet:"Search project memory for prior facts or decisions relevant to the current task.",promptGuidelines:["Use recall before repeating project discovery work across sessions.","Ask focused natural-language queries that mention the project, file, sample, or analysis concept."],executionMode:"sequential",parameters:e.Type.Object({query:e.Type.String({description:"Natural-language memory search query."}),limit:e.Type.Optional(e.Type.Number({description:"Maximum results to return."}))}),async execute(a,b,c,d,e){let f=(0,g.TI)(e.cwd,b.query,b.limit??5),h=(0,g.Dn)(e.cwd);return 0===f.length?{content:[{type:"text",text:"No relevant memories found."}],details:{schema:"annovibe.memory.recall.v1",results:[],store:h}}:{content:[{type:"text",text:`Found ${f.length} relevant ${1===f.length?"memory":"memories"}:
|
|
195
206
|
|
|
196
207
|
${(0,g.fu)(f)}`}],details:{schema:"annovibe.memory.recall.v1",results:f,store:h}}}})),a.registerTool((0,f.defineTool)({name:"reflect",label:"Reflect",description:"Synthesize an answer from recalled project memory.",promptSnippet:"Synthesize a concise answer grounded in remembered project context.",promptGuidelines:["Use reflect when the user asks for a summary or reminder that depends on past project memory.","Keep the answer grounded in recalled memories; do not invent facts not present in memory."],executionMode:"sequential",parameters:e.Type.Object({query:e.Type.String({description:"Question to answer from project memory."}),context:e.Type.Optional(e.Type.String({description:"Optional extra context to bias the reflection."})),limit:e.Type.Optional(e.Type.Number({description:"Maximum recall results to use."}))}),async execute(a,b,c,d,e){let f=(0,g.nf)(e.cwd,b.query,b.context,b.limit??5),h=(0,g.Dn)(e.cwd);return{content:[{type:"text",text:f.answer}],details:{schema:"annovibe.memory.reflect.v1",results:f.results,store:h}}}}))}[e,f,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},86585:(a,b,c)=>{"use strict";c.d(b,{Ws:()=>f,qX:()=>g});let d={enabled:!1,todos:[],executing:!1};function e(a,b){if(!a||"object"!=typeof a)return null;let c="string"==typeof a.text?a.text.replace(/\s+/g," ").trim():"string"==typeof a.step?a.step.replace(/\s+/g," ").trim():"";return c?{step:"number"==typeof a.step&&Number.isFinite(a.step)?a.step:b+1,text:c,completed:!0===a.completed||"completed"===a.status}:null}function f(a){for(let b=a.length-1;b>=0;b-=1){let c=a[b];if("custom"===c.type&&"plan-mode"===c.customType)return function(a){if(!a||"object"!=typeof a)return d;let b=Array.isArray(a.todos)?a.todos.map(e).filter(a=>null!==a):[];return{enabled:!0===a.enabled,todos:b,executing:!0===a.executing}}(c.data)}return d}function g(a,b){return a.enabled===b.enabled&&a.executing===b.executing&&a.todos.length===b.todos.length&&a.todos.every((a,c)=>{let d=b.todos[c];return d.step===a.step&&d.text===a.text&&d.completed===a.completed})}},96640:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Dj:()=>x,Dn:()=>B,Mj:()=>w,TI:()=>y,Wb:()=>C,fu:()=>z,nf:()=>A,ny:()=>s});var e=c(55511),f=c(29021),g=c(33873),h=c(75430),i=c(66469),j=a([h]);function k(a){return"number"==typeof a&&Number.isFinite(a)?Math.max(0,Math.min(1,Number(a.toFixed(3)))):.75}function l(a){return(0,g.join)((0,g.join)((0,h.getAgentDir)(),"memory",(0,e.createHash)("sha1").update(a).digest("hex")),"entries.jsonl")}function m(a){let b=(0,g.dirname)(a);(0,f.existsSync)(b)||(0,f.mkdirSync)(b,{recursive:!0})}function n(a){return[...new Set(a)]}function o(a){let b=l(a);if(!(0,f.existsSync)(b))return[];try{let a=(0,f.readFileSync)(b,"utf8").split("\n").map(a=>a.trim()).filter(Boolean),d=[];for(let b of a){var c;let a=(c=JSON.parse(b))&&"object"==typeof c?"string"!=typeof c.id||"string"!=typeof c.content||"string"!=typeof c.timestamp?null:{id:c.id,content:c.content,timestamp:c.timestamp,importance:k(c.importance),veracity:"tool"===c.veracity||"user"===c.veracity?c.veracity:"unknown",memoryType:"context"===c.memoryType||"preference"===c.memoryType||"decision"===c.memoryType||"note"===c.memoryType?c.memoryType:"fact",source:"string"==typeof c.source?c.source:"annovibe",sessionId:"string"==typeof c.sessionId?c.sessionId:"",cwd:"string"==typeof c.cwd?c.cwd:"",metadata:c.metadata&&"object"==typeof c.metadata?c.metadata:{},governance:c.governance&&"object"==typeof c.governance?{tier:"working",candidate:"spark"===c.governance.candidate||"project_memory"===c.governance.candidate?c.governance.candidate:"none",reason:"string"==typeof c.governance.reason?c.governance.reason:null,promotedTo:Array.isArray(c.governance.promotedTo)?c.governance.promotedTo.filter(a=>"memory"===a||"context"===a):[],promotedAt:"object"==typeof c.governance.promotedAt&&null!==c.governance.promotedAt?Object.fromEntries(Object.entries(c.governance.promotedAt).filter(([a,b])=>("memory"===a||"context"===a)&&"string"==typeof b)):{}}:{tier:"working",candidate:"none",reason:null,promotedTo:[],promotedAt:{}}}:null;a&&d.push(a)}return d}catch{return[]}}async function p(a,b){let c=l(a);m(c),await (0,h.withFileMutationQueue)(c,async()=>{let a=(0,f.existsSync)(c)?(0,f.readFileSync)(c,"utf8"):"",d=`${a}${a.endsWith("\n")||0===a.length?"":"\n"}${JSON.stringify(b)}
|
|
197
208
|
`;(0,f.writeFileSync)(c,d,"utf8")})}async function q(a,b){let c=l(a);m(c),await (0,h.withFileMutationQueue)(c,async()=>{let a=b.length>0?`${b.map(a=>JSON.stringify(a)).join("\n")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/zNTq4wuwYdF4hI5SqkDDt/_buildManifest.js","static/zNTq4wuwYdF4hI5SqkDDt/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-b13282f72690ef5e.js","static/chunks/4bd1b696-e356ca5ba0218e27.js","static/chunks/3794-123fdf632563f469.js","static/chunks/main-app-8d81a93b58bb990f.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|