@sma1lboy/rove 0.9.242 → 0.9.244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{chunk-089zn7my.js → chunk-0v82hp1z.js} +1 -1
- package/dist/cli/{chunk-z6acdd5c.js → chunk-195nhfna.js} +1 -1
- package/dist/cli/{chunk-0pw3xfqz.js → chunk-1erp3qxx.js} +1 -1
- package/dist/cli/{chunk-tjb8fftb.js → chunk-20r85tnf.js} +2 -2
- package/dist/cli/chunk-2mrwdd50.js +10 -0
- package/dist/cli/{chunk-g7jgmz7p.js → chunk-2pvck9jx.js} +3 -3
- package/dist/cli/chunk-2zmcwmn8.js +2 -0
- package/dist/cli/chunk-2zrphhdf.js +2 -0
- package/dist/cli/{chunk-wp3ts69s.js → chunk-3pdg2afa.js} +1 -1
- package/dist/cli/{chunk-g5c5jytr.js → chunk-3yd0ty84.js} +1 -1
- package/dist/cli/chunk-4xns5j33.js +3 -0
- package/dist/cli/chunk-55ajzrj6.js +3 -0
- package/dist/cli/{chunk-c84a6t3t.js → chunk-5a0582t8.js} +1 -1
- package/dist/cli/chunk-5bfern2b.js +2 -0
- package/dist/cli/{chunk-28zg6p31.js → chunk-6c5hh9zq.js} +1 -1
- package/dist/cli/{chunk-tvk46rfs.js → chunk-78xjh4gg.js} +1 -1
- package/dist/cli/chunk-7mq1ascs.js +2 -0
- package/dist/cli/{chunk-h3fckxn3.js → chunk-83e13qdq.js} +1 -1
- package/dist/cli/{chunk-599q1w3a.js → chunk-8fhx8ys9.js} +2 -2
- package/dist/cli/chunk-8pna13mr.js +2 -0
- package/dist/cli/{chunk-xkv2vm37.js → chunk-8tcqt5p4.js} +1 -1
- package/dist/cli/{chunk-x5fdsft6.js → chunk-8vtdcnre.js} +1 -1
- package/dist/cli/{chunk-g4c4ffqp.js → chunk-9b6pdnxp.js} +2 -2
- package/dist/cli/chunk-9q1m5qz0.js +2 -0
- package/dist/cli/chunk-9vy0csmk.js +9 -0
- package/dist/cli/{chunk-fert44x2.js → chunk-9x980fd4.js} +1 -1
- package/dist/cli/{chunk-4j8g3fcd.js → chunk-bx5myh57.js} +1 -1
- package/dist/cli/chunk-catrr0z3.js +3 -0
- package/dist/cli/{chunk-yc09g6vq.js → chunk-cv9rjs9p.js} +1 -1
- package/dist/cli/{chunk-snhcvjdb.js → chunk-dgt1yq74.js} +1 -1
- package/dist/cli/{chunk-00twck20.js → chunk-dk03kqd4.js} +1 -1
- package/dist/cli/{chunk-fg62y5fm.js → chunk-e3g79zpp.js} +1 -1
- package/dist/cli/{chunk-n77m138t.js → chunk-e6x95bc9.js} +1 -1
- package/dist/cli/{chunk-f0qamp5r.js → chunk-easxds8p.js} +1 -1
- package/dist/cli/{chunk-94zjxcnf.js → chunk-fwbk82nn.js} +1 -1
- package/dist/cli/{chunk-q08abj38.js → chunk-g203qezy.js} +1 -1
- package/dist/cli/chunk-gcxcq22q.js +5 -0
- package/dist/cli/{chunk-y8tysjc2.js → chunk-gpan2g7d.js} +1 -1
- package/dist/cli/{chunk-hg72x88m.js → chunk-hh66tk5v.js} +1 -1
- package/dist/cli/{chunk-p024scd4.js → chunk-j3783bf2.js} +1 -1
- package/dist/cli/{chunk-4ev7g7j1.js → chunk-j5mvw8cb.js} +1 -1
- package/dist/cli/{chunk-808wt4qs.js → chunk-jva9qfcn.js} +1 -1
- package/dist/cli/{chunk-576r5nht.js → chunk-k4374n9t.js} +1 -1
- package/dist/cli/{chunk-nckmga7j.js → chunk-k5py2g4y.js} +1 -1
- package/dist/cli/{chunk-s3bqmn0s.js → chunk-kdee8kgm.js} +1 -1
- package/dist/cli/{chunk-460bba4e.js → chunk-kr9bvxaz.js} +2 -2
- package/dist/cli/{chunk-9hmzrmdt.js → chunk-p1htk7za.js} +1 -1
- package/dist/cli/{chunk-h33m6cc6.js → chunk-p7wsz1kf.js} +1 -1
- package/dist/cli/{chunk-x9s14ppv.js → chunk-qdfxk8pt.js} +1 -1
- package/dist/cli/chunk-qgfgjhgb.js +2 -0
- package/dist/cli/{chunk-tntt3ken.js → chunk-qy2exha8.js} +1 -1
- package/dist/cli/{chunk-2x9yc5nx.js → chunk-r12sxzvg.js} +1 -1
- package/dist/cli/{chunk-my6xhnej.js → chunk-rfgwj1m7.js} +1 -1
- package/dist/cli/{chunk-bn73kd6z.js → chunk-rn1kwc71.js} +1 -1
- package/dist/cli/{chunk-k6886jet.js → chunk-s633vsc6.js} +1 -1
- package/dist/cli/{chunk-ff1h2qxd.js → chunk-sb2ardv3.js} +1 -1
- package/dist/cli/chunk-smqze3sm.js +2 -0
- package/dist/cli/{chunk-ytxk6zqc.js → chunk-t3682s5j.js} +1 -1
- package/dist/cli/{chunk-n3he2z72.js → chunk-t7e76hpj.js} +1 -1
- package/dist/cli/chunk-t7j8g9f6.js +3 -0
- package/dist/cli/{chunk-c2m55b72.js → chunk-th5caet8.js} +1 -1
- package/dist/cli/{chunk-nnjqb4nb.js → chunk-tje9nhmd.js} +1 -1
- package/dist/cli/chunk-w26thyva.js +2 -0
- package/dist/cli/{chunk-zt49bbg9.js → chunk-x1d1mq5c.js} +1 -1
- package/dist/cli/{chunk-zx2n95qe.js → chunk-xnn96zvb.js} +1 -1
- package/dist/cli/{chunk-svm809bx.js → chunk-xnsk57ta.js} +1 -1
- package/dist/cli/{chunk-2ss0xjsp.js → chunk-xyzar5xd.js} +1 -1
- package/dist/cli/{chunk-1wdtwxbt.js → chunk-y76adyep.js} +10 -10
- package/dist/cli/{chunk-3d1hjrq0.js → chunk-ybw6wah4.js} +1 -1
- package/dist/cli/{chunk-s4xfj2xj.js → chunk-ysqaq4bk.js} +1 -1
- package/dist/cli/{chunk-yxt1y0n3.js → chunk-zh6fadgw.js} +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/cli/rove.js +1 -1
- package/dist/completions/rove.bash +1 -1
- package/dist/completions/rove.fish +1 -1
- package/dist/completions/rove.zsh +1 -1
- package/dist/skills/rove/SKILL.md +11 -14
- package/dist/skills/rove/references/api-flags.md +53 -46
- package/package.json +2 -2
- package/dist/cli/chunk-2andp9gs.js +0 -2
- package/dist/cli/chunk-30kjq5m7.js +0 -2
- package/dist/cli/chunk-54h93msh.js +0 -2
- package/dist/cli/chunk-a2wf3nkw.js +0 -2
- package/dist/cli/chunk-c8c44dty.js +0 -9
- package/dist/cli/chunk-d0qgz1es.js +0 -2
- package/dist/cli/chunk-dgs0m8r4.js +0 -3
- package/dist/cli/chunk-dkgxz9hf.js +0 -5
- package/dist/cli/chunk-kb6xw0fw.js +0 -2
- package/dist/cli/chunk-m4f5h05c.js +0 -10
- package/dist/cli/chunk-m6q44xc0.js +0 -2
- package/dist/cli/chunk-qvfdqrbf.js +0 -3
- package/dist/cli/chunk-rjq1ryb1.js +0 -2
- package/dist/cli/chunk-y7jhc2zf.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{closeTab,engineTabArgv,initialTabs,setTabTitle,terminalTabsKey}from"./chunk-bn73kd6z.js";import{awaitEngineProcess,buildEngineSessionLaunch,deliverToHostedKey,enginePresence,ensureHostedSessionHost,findHostedEngineKey,hostedSessionFailureLine,hostedTaskKeys,initMarkerSaysFinished,isHostedTaskKey,killHostedSessions,listHostedSessions,listHostedSessionsOrNull,openHostedSessionHost,pastePromptWhenEngineUp,readPersistedTerminalDefaultColors}from"./chunk-yxt1y0n3.js";import{engineLaunchArgv}from"./chunk-x9s14ppv.js";import{ApiError}from"./chunk-f7zjggfv.js";import{loadStateFile,patchStateFile,updateStateFile}from"./chunk-7q43tysm.js";function taskEngineArgv(task){return engineLaunchArgv({command:task.command,vendor:task.vendor})}function readTabsSnapshot(taskId){try{let snap=loadStateFile()[terminalTabsKey(taskId)];return snap&&Array.isArray(snap.tabs)?snap:void 0}catch{return}}function closeTabsSnapshot(taskId,tabId){let closing,key=terminalTabsKey(taskId);return updateStateFile((store)=>{let state=store[key];if(!state||!Array.isArray(state.tabs))return!1;if(closing=state.tabs.find((tab)=>tab.id===tabId),!closing)return!1;let{state:next,closedId}=closeTab(state,tabId,{allowEmpty:!0});if(!closedId)return closing=void 0,!1;store[key]=next;return}),closing}function renameTabsSnapshot(taskId,tabId,title){let found=!1,key=terminalTabsKey(taskId);return updateStateFile((store)=>{let state=store[key];if(!state||!Array.isArray(state.tabs))return!1;if(!state.tabs.some((tab)=>tab.id===tabId))return!1;found=!0;let next=setTabTitle(state,tabId,title);if(next===state)return!1;store[key]=next;return}),found}var aliveKeysOf=(sessions)=>new Set(sessions.filter((s)=>s.alive).map((s)=>s.key));function unregisteredTabIds(snapshot,taskId,sessions){let known=new Set((snapshot?.tabs??[]).map((t)=>t.id)),prefix=`${taskId}::`,out=[];for(let s of sessions){if(!s.alive||!s.key.startsWith(prefix))continue;let tabId=s.key.slice(prefix.length);if(tabId.includes("::"))continue;if(!known.has(tabId)&&!out.includes(tabId))out.push(tabId)}return out}var abnormalExit=(exit)=>exit&&(exit.code!==0||exit.signal!==null)?exit:null;function joinTaskTabs(snapshot,taskId,sessions,persistedExits={},liveVendors,engineAlive){let unknown=sessions===null,rows0=sessions??[],alive=aliveKeysOf(rows0),sessionExits=new Map(rows0.map((s)=>[s.key,s.exit])),deadExit=(key)=>{let ex=abnormalExit(sessionExits.get(key)??persistedExits[key]);if(!ex)return null;let record=persistedExits[key],sameDeath=record?.at===ex.at,tail=sameDeath?record?.tail:void 0,code=ex.code??(sameDeath?record?.code??null:null),layer=record?.layer??"pty";return{code,signal:ex.signal,at:ex.at,layer,...tail&&tail.length>0?{tail}:{}}},engineExit=(key)=>{let record=persistedExits[`${key}#engine`];if(!record)return null;let{code,signal,at,tail,atApproximate}=record;return{code,signal,at,layer:"engine",...atApproximate?{atApproximate}:{},...tail&&tail.length>0?{tail}:{}}},rows=(snapshot?.tabs??[]).map((t)=>{let key=`${taskId}::${t.id}`,isAlive=unknown?null:alive.has(key),walked=isAlive===!0&&liveVendors?.has(key)===!0?liveVendors.get(key)??null:void 0,engineIsAlive=engineAliveOf(key,isAlive,engineAlive);return{id:t.id,kind:t.kind,title:t.title??null,vendor:t.vendor??null,liveVendor:walked!==void 0?walked:t.liveVendor??null,lastTitle:t.lastTitle??null,autoTitle:t.autoTitle??null,alive:isAlive,engineAlive:engineIsAlive,exit:isAlive===!1?deadExit(key):engineIsAlive===!1?engineExit(key):null}});for(let tabId of unregisteredTabIds(snapshot,taskId,rows0))rows.push({id:tabId,kind:"engine",title:null,vendor:null,liveVendor:null,lastTitle:null,autoTitle:null,alive:!0,engineAlive:engineAliveOf(`${taskId}::${tabId}`,!0,engineAlive),exit:null,unregistered:!0});return rows}function engineAliveOf(key,isAlive,engineAlive){if(isAlive===null)return null;if(!isAlive)return!1;return engineAlive?.has(key)===!0?engineAlive.get(key)??null:null}function publishCliTabSnapshot(taskId,sessionId){if(!taskId)return;try{let key=terminalTabsKey(taskId);if(loadStateFile()[key]!==void 0)return;let seeded=initialTabs();patchStateFile({[key]:sessionId?{...seeded,tabs:seeded.tabs.map((t)=>t.kind==="engine"?{...t,sessionId,spawned:!0}:t)}:seeded})}catch{}}function markCliTabSession(taskId,tabId,sessionId){try{let key=terminalTabsKey(taskId),existing=loadStateFile()[key];if(!existing||!Array.isArray(existing.tabs))return;patchStateFile({[key]:{...existing,tabs:existing.tabs.map((t)=>t.id===tabId&&t.kind==="engine"?{...t,sessionId,spawned:!0}:t)}})}catch{}}function mintCliTab(taskId,vendor,command){let tabId="tab-1";try{let key=terminalTabsKey(taskId),existing=loadStateFile()[key],state=existing&&Array.isArray(existing.tabs)&&existing.tabs.length>0?existing:initialTabs(),ordinal=typeof state.nextOrdinal==="number"&&state.nextOrdinal>1?state.nextOrdinal:2;tabId=`tab-${ordinal}`,patchStateFile({[key]:{...state,tabs:[...state.tabs,{kind:"engine",id:tabId,title:null,ordinal,...vendor?{vendor}:{},...command?{engineCommand:command}:{}}],activeId:tabId,nextOrdinal:ordinal+1}})}catch{tabId=`tab-cli-${Date.now().toString(36)}`}return tabId}function restoredTabsOf(sessions,taskId,exceptKey){let prefix=`${taskId}::`,ids=[];for(let s of sessions){if(s.alive||s.restored!==!0||s.key===exceptKey||!s.key.startsWith(prefix))continue;let tab=s.key.slice(prefix.length);if(tab.includes("::"))continue;if(!ids.includes(tab))ids.push(tab)}let tabs=readTabsSnapshot(taskId)?.tabs??[];return ids.map((tab)=>{let sessionId=tabs.find((t)=>t.id===tab)?.sessionId;return sessionId?{tab,sessionId}:{tab}})}function restoredTabLaunch(task,tabId,worktreePath,shell){let tab=readTabsSnapshot(task.id)?.tabs.find((t)=>t.id===tabId&&t.kind==="engine");if(!tab)return null;let base=engineLaunchArgv({command:tab.engineCommand??(tab.vendor?void 0:task.command),vendor:tab.vendor??task.vendor,effort:task.modelEffort,model:tab.engineCommand||tab.vendor?void 0:task.model});return buildEngineSessionLaunch({task:{id:task.id,kind:task.kind??"task",vendor:tab.vendor??task.vendor,repo:task.repo},worktreePath,shell,argv:engineTabArgv(tab,base,!1,task.vendor),promptIntent:{kind:"none"},tabId})}var isTaskKey=isHostedTaskKey,findEngineKey=findHostedEngineKey,taskKeys=hostedTaskKeys,openPtyHost=openHostedSessionHost,ensurePtyHost=ensureHostedSessionHost,listSessions=listHostedSessions,listSessionsOrNull=listHostedSessionsOrNull,deliverToKey=deliverToHostedKey,ENGINE_START_PROBE_MS=3000,ENGINE_START_POLL_MS=150,ENGINE_NOT_OBSERVED_REASON=`no engine process appeared in the session within ${ENGINE_START_PROBE_MS}ms`;function outcomeFields(outcome){if(!outcome)return{engineReady:!1,delivered:!1};return{engineReady:outcome.ready,delivered:!0,bytes:outcome.bytes,promptEcho:outcome.confirmed?"confirmed":"unconfirmed"}}async function deliverHostedPrompt(rpc,target,cwd,prompt,launch,opts){let{sessions=[]}=await rpc.request("pty.list",{}),existingKey=opts?.forceNew?null:findEngineKey(sessions,target.id,target.engineBin);if(existingKey){let pid=sessions.find((s)=>s.key===existingKey)?.pid,presence=await enginePresence(pid,target.engineBin,opts?.snapshot);if(presence.kind==="unknown")throw new ApiError(`could not read the process table, so task ${target.id}'s engine tab (${existingKey}) could not be checked for a live engine`,"ENGINE_PROBE_FAILED",{hint:"the `ps` probe failed or timed out; retry, or check the machine's process table",nextCommandArgs:["api","pty-list"]});if(presence.kind!=="engine")throw new ApiError(`task ${target.id}'s engine tab (${existingKey}) has no live engine process \u2014 its engine exited into a plain shell`,"ENGINE_NOT_RUNNING",{hint:"spawn a fresh engine tab for this prompt with --tab new",nextCommandArgs:["api","send","--task-id",target.id,"--tab","new","--prompt",prompt]});let outcome=await deliverToKey(rpc,existingKey,prompt,{vendor:presence.vendor});return{session:existingKey,pane:existingKey,started:!1,...outcomeFields(outcome)}}if(!opts?.forceNew){let aliveTabs=sessions.filter((s)=>s.alive&&isTaskKey(s.key,target.id)).map((s)=>s.key);if(aliveTabs.length>0)throw new ApiError(`task ${target.id} has live tabs (${aliveTabs.join(", ")}) but none resolves as its engine tab \u2014 refusing to spawn a new engine`,"NO_ENGINE_TAB",{hint:"address a live engine tab explicitly with --tab <tab-N> (see pty-list), or spawn a fresh engine tab with --tab new",nextCommandArgs:["api","pty-list"]})}let frozen=restoredTabsOf(sessions,target.id,launch.key),disclose=frozen.length>0?{frozenTabs:frozen}:{},staleCanonical=sessions.find((session)=>session.key===launch.key&&!session.alive);if(staleCanonical&&staleCanonical.restored!==!0)await rpc.request("pty.kill",{key:launch.key});let open=await rpc.request("pty.open",{key:launch.key,cwd,command:launch.command,defaultColors:readPersistedTerminalDefaultColors()});try{if(!open.alive)return{session:launch.key,pane:launch.key,started:open.created!==!1||open.respawned===!0,engineReady:!1,delivered:!1,...disclose};if(launch.firstMessage){let outcome=await pastePromptWhenEngineUp(rpc,launch.key,target.engineBin,launch.firstMessage,{initMarkerPath:launch.initMarkerPath,initTimeoutMs:launch.initTimeoutMs});return{session:launch.key,pane:launch.key,started:open.created!==!1||open.respawned===!0,...outcomeFields(outcome),...disclose}}let started=open.created!==!1||open.respawned===!0;if(open.created===!1&&open.respawned!==!0){let outcome=await pastePromptWhenEngineUp(rpc,launch.key,target.engineBin,prompt,{snapshot:opts?.snapshot});return{session:launch.key,pane:launch.key,started,...outcomeFields(outcome),...disclose}}let pendingInit={session:launch.key,pane:launch.key,started,engineReady:!1,delivered:!0,reason:"repo init script is still running; the engine has not started yet",...disclose};if(launch.initMarkerPath&&!initMarkerSaysFinished(launch.initMarkerPath))return pendingInit;if(await awaitEngineProcess(rpc,launch.key,target.engineBin,{timeoutMs:ENGINE_START_PROBE_MS,intervalMs:ENGINE_START_POLL_MS,snapshot:opts?.snapshot})===null){if(launch.initMarkerPath&&!initMarkerSaysFinished(launch.initMarkerPath)&&(await listSessions(rpc)).some((session)=>session.key===launch.key&&session.alive)&&!initMarkerSaysFinished(launch.initMarkerPath))return pendingInit;return{session:launch.key,pane:launch.key,started,engineReady:!1,delivered:!1,reason:await hostedSessionFailureLine(rpc,launch.key)??ENGINE_NOT_OBSERVED_REASON,...disclose}}return{session:launch.key,pane:launch.key,started,engineReady:!0,delivered:!0,...disclose}}finally{await rpc.request("pty.detach",{key:launch.key}).catch(()=>{})}}var killTaskSessions=killHostedSessions;
|
|
2
|
+
import{closeTab,engineTabArgv,initialTabs,setTabTitle,terminalTabsKey}from"./chunk-rn1kwc71.js";import{awaitEngineProcess,buildEngineSessionLaunch,deliverToHostedKey,enginePresence,ensureHostedSessionHost,findHostedEngineKey,hostedSessionFailureLine,hostedTaskKeys,initMarkerSaysFinished,isHostedTaskKey,killHostedSessions,listHostedSessions,listHostedSessionsOrNull,openHostedSessionHost,pastePromptWhenEngineUp,readPersistedTerminalDefaultColors}from"./chunk-zh6fadgw.js";import{engineLaunchArgv}from"./chunk-qdfxk8pt.js";import{ApiError}from"./chunk-f7zjggfv.js";import{loadStateFile,patchStateFile,updateStateFile}from"./chunk-7q43tysm.js";function taskEngineArgv(task){return engineLaunchArgv({command:task.command,vendor:task.vendor})}function readTabsSnapshot(taskId){try{let snap=loadStateFile()[terminalTabsKey(taskId)];return snap&&Array.isArray(snap.tabs)?snap:void 0}catch{return}}function closeTabsSnapshot(taskId,tabId){let closing,key=terminalTabsKey(taskId);return updateStateFile((store)=>{let state=store[key];if(!state||!Array.isArray(state.tabs))return!1;if(closing=state.tabs.find((tab)=>tab.id===tabId),!closing)return!1;let{state:next,closedId}=closeTab(state,tabId,{allowEmpty:!0});if(!closedId)return closing=void 0,!1;store[key]=next;return}),closing}function renameTabsSnapshot(taskId,tabId,title){let found=!1,key=terminalTabsKey(taskId);return updateStateFile((store)=>{let state=store[key];if(!state||!Array.isArray(state.tabs))return!1;if(!state.tabs.some((tab)=>tab.id===tabId))return!1;found=!0;let next=setTabTitle(state,tabId,title);if(next===state)return!1;store[key]=next;return}),found}var aliveKeysOf=(sessions)=>new Set(sessions.filter((s)=>s.alive).map((s)=>s.key));function unregisteredTabIds(snapshot,taskId,sessions){let known=new Set((snapshot?.tabs??[]).map((t)=>t.id)),prefix=`${taskId}::`,out=[];for(let s of sessions){if(!s.alive||!s.key.startsWith(prefix))continue;let tabId=s.key.slice(prefix.length);if(tabId.includes("::"))continue;if(!known.has(tabId)&&!out.includes(tabId))out.push(tabId)}return out}var abnormalExit=(exit)=>exit&&(exit.code!==0||exit.signal!==null)?exit:null;function joinTaskTabs(snapshot,taskId,sessions,persistedExits={},liveVendors,engineAlive){let unknown=sessions===null,rows0=sessions??[],alive=aliveKeysOf(rows0),sessionExits=new Map(rows0.map((s)=>[s.key,s.exit])),deadExit=(key)=>{let ex=abnormalExit(sessionExits.get(key)??persistedExits[key]);if(!ex)return null;let record=persistedExits[key],sameDeath=record?.at===ex.at,tail=sameDeath?record?.tail:void 0,code=ex.code??(sameDeath?record?.code??null:null),layer=record?.layer??"pty";return{code,signal:ex.signal,at:ex.at,layer,...tail&&tail.length>0?{tail}:{}}},engineExit=(key)=>{let record=persistedExits[`${key}#engine`];if(!record)return null;let{code,signal,at,tail,atApproximate}=record;return{code,signal,at,layer:"engine",...atApproximate?{atApproximate}:{},...tail&&tail.length>0?{tail}:{}}},rows=(snapshot?.tabs??[]).map((t)=>{let key=`${taskId}::${t.id}`,isAlive=unknown?null:alive.has(key),walked=isAlive===!0&&liveVendors?.has(key)===!0?liveVendors.get(key)??null:void 0,engineIsAlive=engineAliveOf(key,isAlive,engineAlive);return{id:t.id,kind:t.kind,title:t.title??null,vendor:t.vendor??null,liveVendor:walked!==void 0?walked:t.liveVendor??null,lastTitle:t.lastTitle??null,autoTitle:t.autoTitle??null,alive:isAlive,engineAlive:engineIsAlive,exit:isAlive===!1?deadExit(key):engineIsAlive===!1?engineExit(key):null}});for(let tabId of unregisteredTabIds(snapshot,taskId,rows0))rows.push({id:tabId,kind:"engine",title:null,vendor:null,liveVendor:null,lastTitle:null,autoTitle:null,alive:!0,engineAlive:engineAliveOf(`${taskId}::${tabId}`,!0,engineAlive),exit:null,unregistered:!0});return rows}function engineAliveOf(key,isAlive,engineAlive){if(isAlive===null)return null;if(!isAlive)return!1;return engineAlive?.has(key)===!0?engineAlive.get(key)??null:null}function publishCliTabSnapshot(taskId,sessionId){if(!taskId)return;try{let key=terminalTabsKey(taskId);if(loadStateFile()[key]!==void 0)return;let seeded=initialTabs();patchStateFile({[key]:sessionId?{...seeded,tabs:seeded.tabs.map((t)=>t.kind==="engine"?{...t,sessionId,spawned:!0}:t)}:seeded})}catch{}}function markCliTabSession(taskId,tabId,sessionId){try{let key=terminalTabsKey(taskId),existing=loadStateFile()[key];if(!existing||!Array.isArray(existing.tabs))return;patchStateFile({[key]:{...existing,tabs:existing.tabs.map((t)=>t.id===tabId&&t.kind==="engine"?{...t,sessionId,spawned:!0}:t)}})}catch{}}function mintCliTab(taskId,vendor,command){let tabId="tab-1";try{let key=terminalTabsKey(taskId),existing=loadStateFile()[key],state=existing&&Array.isArray(existing.tabs)&&existing.tabs.length>0?existing:initialTabs(),ordinal=typeof state.nextOrdinal==="number"&&state.nextOrdinal>1?state.nextOrdinal:2;tabId=`tab-${ordinal}`,patchStateFile({[key]:{...state,tabs:[...state.tabs,{kind:"engine",id:tabId,title:null,ordinal,...vendor?{vendor}:{},...command?{engineCommand:command}:{}}],activeId:tabId,nextOrdinal:ordinal+1}})}catch{tabId=`tab-cli-${Date.now().toString(36)}`}return tabId}function restoredTabsOf(sessions,taskId,exceptKey){let prefix=`${taskId}::`,ids=[];for(let s of sessions){if(s.alive||s.restored!==!0||s.key===exceptKey||!s.key.startsWith(prefix))continue;let tab=s.key.slice(prefix.length);if(tab.includes("::"))continue;if(!ids.includes(tab))ids.push(tab)}let tabs=readTabsSnapshot(taskId)?.tabs??[];return ids.map((tab)=>{let sessionId=tabs.find((t)=>t.id===tab)?.sessionId;return sessionId?{tab,sessionId}:{tab}})}function restoredTabLaunch(task,tabId,worktreePath,shell){let tab=readTabsSnapshot(task.id)?.tabs.find((t)=>t.id===tabId&&t.kind==="engine");if(!tab)return null;let base=engineLaunchArgv({command:tab.engineCommand??(tab.vendor?void 0:task.command),vendor:tab.vendor??task.vendor,effort:task.modelEffort,model:tab.engineCommand||tab.vendor?void 0:task.model});return buildEngineSessionLaunch({task:{id:task.id,kind:task.kind??"task",vendor:tab.vendor??task.vendor,repo:task.repo},worktreePath,shell,argv:engineTabArgv(tab,base,!1,task.vendor),promptIntent:{kind:"none"},tabId})}var isTaskKey=isHostedTaskKey,findEngineKey=findHostedEngineKey,taskKeys=hostedTaskKeys,openPtyHost=openHostedSessionHost,ensurePtyHost=ensureHostedSessionHost,listSessions=listHostedSessions,listSessionsOrNull=listHostedSessionsOrNull,deliverToKey=deliverToHostedKey,ENGINE_START_PROBE_MS=3000,ENGINE_START_POLL_MS=150,ENGINE_NOT_OBSERVED_REASON=`no engine process appeared in the session within ${ENGINE_START_PROBE_MS}ms`;function outcomeFields(outcome){if(!outcome)return{engineReady:!1,delivered:!1};return{engineReady:outcome.ready,delivered:!0,bytes:outcome.bytes,promptEcho:outcome.confirmed?"confirmed":"unconfirmed"}}async function deliverHostedPrompt(rpc,target,cwd,prompt,launch,opts){let{sessions=[]}=await rpc.request("pty.list",{}),existingKey=opts?.forceNew?null:findEngineKey(sessions,target.id,target.engineBin);if(existingKey){let pid=sessions.find((s)=>s.key===existingKey)?.pid,presence=await enginePresence(pid,target.engineBin,opts?.snapshot);if(presence.kind==="unknown")throw new ApiError(`could not read the process table, so task ${target.id}'s engine tab (${existingKey}) could not be checked for a live engine`,"ENGINE_PROBE_FAILED",{hint:"the `ps` probe failed or timed out; retry, or check the machine's process table",nextCommandArgs:["api","pty-list"]});if(presence.kind!=="engine")throw new ApiError(`task ${target.id}'s engine tab (${existingKey}) has no live engine process \u2014 its engine exited into a plain shell`,"ENGINE_NOT_RUNNING",{hint:"spawn a fresh engine tab for this prompt with --tab new",nextCommandArgs:["api","send","--task-id",target.id,"--tab","new","--prompt",prompt]});let outcome=await deliverToKey(rpc,existingKey,prompt,{vendor:presence.vendor});return{session:existingKey,pane:existingKey,started:!1,...outcomeFields(outcome)}}if(!opts?.forceNew){let aliveTabs=sessions.filter((s)=>s.alive&&isTaskKey(s.key,target.id)).map((s)=>s.key);if(aliveTabs.length>0)throw new ApiError(`task ${target.id} has live tabs (${aliveTabs.join(", ")}) but none resolves as its engine tab \u2014 refusing to spawn a new engine`,"NO_ENGINE_TAB",{hint:"address a live engine tab explicitly with --tab <tab-N> (see pty-list), or spawn a fresh engine tab with --tab new",nextCommandArgs:["api","pty-list"]})}let frozen=restoredTabsOf(sessions,target.id,launch.key),disclose=frozen.length>0?{frozenTabs:frozen}:{},staleCanonical=sessions.find((session)=>session.key===launch.key&&!session.alive);if(staleCanonical&&staleCanonical.restored!==!0)await rpc.request("pty.kill",{key:launch.key});let open=await rpc.request("pty.open",{key:launch.key,cwd,command:launch.command,defaultColors:readPersistedTerminalDefaultColors()});try{if(!open.alive)return{session:launch.key,pane:launch.key,started:open.created!==!1||open.respawned===!0,engineReady:!1,delivered:!1,...disclose};if(launch.firstMessage){let outcome=await pastePromptWhenEngineUp(rpc,launch.key,target.engineBin,launch.firstMessage,{initMarkerPath:launch.initMarkerPath,initTimeoutMs:launch.initTimeoutMs});return{session:launch.key,pane:launch.key,started:open.created!==!1||open.respawned===!0,...outcomeFields(outcome),...disclose}}let started=open.created!==!1||open.respawned===!0;if(open.created===!1&&open.respawned!==!0){let outcome=await pastePromptWhenEngineUp(rpc,launch.key,target.engineBin,prompt,{snapshot:opts?.snapshot});return{session:launch.key,pane:launch.key,started,...outcomeFields(outcome),...disclose}}let pendingInit={session:launch.key,pane:launch.key,started,engineReady:!1,delivered:!0,reason:"repo init script is still running; the engine has not started yet",...disclose};if(launch.initMarkerPath&&!initMarkerSaysFinished(launch.initMarkerPath))return pendingInit;if(await awaitEngineProcess(rpc,launch.key,target.engineBin,{timeoutMs:ENGINE_START_PROBE_MS,intervalMs:ENGINE_START_POLL_MS,snapshot:opts?.snapshot})===null){if(launch.initMarkerPath&&!initMarkerSaysFinished(launch.initMarkerPath)&&(await listSessions(rpc)).some((session)=>session.key===launch.key&&session.alive)&&!initMarkerSaysFinished(launch.initMarkerPath))return pendingInit;return{session:launch.key,pane:launch.key,started,engineReady:!1,delivered:!1,reason:await hostedSessionFailureLine(rpc,launch.key)??ENGINE_NOT_OBSERVED_REASON,...disclose}}return{session:launch.key,pane:launch.key,started,engineReady:!0,delivered:!0,...disclose}}finally{await rpc.request("pty.detach",{key:launch.key}).catch(()=>{})}}var killTaskSessions=killHostedSessions;
|
|
3
3
|
export{taskEngineArgv,readTabsSnapshot,closeTabsSnapshot,renameTabsSnapshot,unregisteredTabIds,joinTaskTabs,publishCliTabSnapshot,markCliTabSession,mintCliTab,restoredTabLaunch,isTaskKey,findEngineKey,taskKeys,openPtyHost,ensurePtyHost,listSessions,listSessionsOrNull,deliverToKey,ENGINE_START_PROBE_MS,ENGINE_START_POLL_MS,ENGINE_NOT_OBSERVED_REASON,outcomeFields,deliverHostedPrompt,killTaskSessions};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{protocolEntry}from"./chunk-
|
|
2
|
+
import{protocolEntry}from"./chunk-qdfxk8pt.js";import{getPersistedString,getPersistedValue}from"./chunk-h9cg0j3a.js";import{acquireSync,releaseSync}from"./chunk-mw0ysrpd.js";import{secretsPath}from"./chunk-prqeddy7.js";function bottomRegion(captureText,lines){return captureText.split(`
|
|
3
3
|
`).filter((l)=>l.trim().length>0).slice(-lines)}function ruleMatches(rule,region){let haystack=region.join(`
|
|
4
4
|
`).toLowerCase();if(rule.all&&!rule.all.every((s)=>haystack.includes(s.toLowerCase())))return!1;if(rule.any&&!rule.any.some((s)=>haystack.includes(s.toLowerCase())))return!1;if(rule.lineRegex){let regexes=rule.lineRegex.map((r)=>new RegExp(r,"i"));if(!region.some((line)=>regexes.some((re)=>re.test(line))))return!1}return Boolean(rule.all||rule.any||rule.lineRegex)}function classifyScreen(manifest,captureText){for(let rule of manifest.rules){let region=bottomRegion(captureText,rule.bottomLines??12);if(region.length===0)continue;if(ruleMatches(rule,region))return rule.state}return null}var MAX_ERROR_ROWS=6;function screenErrorLine(errorLine,rows,opts={}){let filled=rows.flatMap((row,index)=>row.trim()?[index]:[]),window=filled.slice(-12);for(let k=window.length-1;k>=0;k--){let start=window[k];if(!errorLine.test(rows[start]??""))continue;let end=start+1;while(end<rows.length&&end-start<MAX_ERROR_ROWS&&rows[end]?.trim())end++;if(opts.last&&filled.some((index)=>index>=end))return;return rows.slice(start,end).map((row)=>row.trim()).join(" ")}return}var AUTO_ROUTING_TIERS=["swift","standard","deep"];function isAutoRoutingTier(value){return AUTO_ROUTING_TIERS.includes(value??"")}var DEFAULT_AUTO_ROUTING={swift:{engine:"claude",model:"sonnet"},standard:{engine:"claude",model:"opus"},deep:{engine:"claude",model:"fable"}};function autoRoutingKey(tier,field){return`autoRouting.${tier}.${field}`}function stringAt(get,key){let raw=get(key);return typeof raw==="string"?raw:void 0}function readAutoRoutingTable(get=getPersistedString){let table={};for(let tier of AUTO_ROUTING_TIERS){let base=DEFAULT_AUTO_ROUTING[tier],engine=stringAt(get,autoRoutingKey(tier,"engine"));if(engine!==void 0&&!engine.trim())return null;let model=stringAt(get,autoRoutingKey(tier,"model")),effort=stringAt(get,autoRoutingKey(tier,"effort")),resolvedModel=model===void 0?base.model:model.trim()||void 0,resolvedEffort=effort===void 0?base.effort:effort.trim()||void 0;table[tier]={engine:engine?.trim()||base.engine,...resolvedModel?{model:resolvedModel}:{},...resolvedEffort?{effort:resolvedEffort}:{}}}return table}function tierBlock(target,deps){let{engine}=target;if(!deps.engineIds.has(engine))return{kind:"engine",engine};if(deps.accountKind(engine)==="none")return{kind:"account",engine};let entry=protocolEntry(engine);if(target.model&&!entry.modelArgv)return{kind:"model",engine,model:target.model};if(target.effort){let levels=entry.effortLevels??[];if(!levels.includes(target.effort))return{kind:"effort",engine,effort:target.effort,levels}}return null}function describeTierBlock(block){switch(block.kind){case"engine":return`engine ${block.engine} is not one engine-list names`;case"account":return`engine ${block.engine} is not logged in`;case"model":return`engine ${block.engine} declares no model flag, so model ${JSON.stringify(block.model)} cannot be passed`;case"effort":return block.levels.length===0?`engine ${block.engine} declares no reasoning effort levels`:`engine ${block.engine} does not accept effort ${JSON.stringify(block.effort)} \u2014 it declares ${block.levels.join(", ")}`}}import{mkdirSync,readFileSync,readdirSync,renameSync,unlinkSync,writeFileSync}from"fs";import{basename,dirname,join}from"path";var HINT_TAIL=4;function readStored(path){let raw;try{raw=readFileSync(path,"utf8")}catch{return{}}try{let parsed=JSON.parse(raw);if(typeof parsed==="object"&&parsed!==null&&!Array.isArray(parsed))return parsed}catch{}return"corrupt"}function readAll(){let stored=readStored(secretsPath());if(stored==="corrupt")return{};let out={};for(let[k,v]of Object.entries(stored))if(typeof v==="string")out[k]=v;return out}function stagingPath(path){return`${path}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`}function sweepStagingFiles(path){let dir=dirname(path),prefix=`${basename(path)}.`,entries;try{entries=readdirSync(dir)}catch{return}for(let entry of entries){if(!entry.startsWith(prefix)||!entry.endsWith(".tmp"))continue;try{unlinkSync(join(dir,entry))}catch{}}}function transact(mutate){let path=secretsPath();mkdirSync(dirname(path),{recursive:!0,mode:448});let lockPath=`${path}.lock`,token=acquireSync(lockPath);try{sweepStagingFiles(path);let secrets=readStored(path);if(secrets==="corrupt")renameSync(path,`${path}.corrupt-${Date.now()}`),secrets={};if(mutate(secrets),Object.keys(secrets).length===0){try{unlinkSync(path)}catch(err){if(err?.code!=="ENOENT")throw err}return}let tmp=stagingPath(path);writeFileSync(tmp,JSON.stringify(secrets),{encoding:"utf8",mode:384}),renameSync(tmp,path)}finally{releaseSync(lockPath,token)}}function readSecret(name){let v=readAll()[name];return v?.trim()?v.trim():void 0}function resolveSecret(name,env=process.env){return env[name]?.trim()||readSecret(name)}function secretStatus(name,env=process.env){let stored=readAll()[name]?.trim(),hint=stored?secretHint(stored):"";if(env[name]?.trim())return{source:"env",hint};return{source:stored?"file":"none",hint}}function secretHint(value){let v=value.trim();return v.length<=HINT_TAIL?"\u2026":`\u2026${v.slice(-HINT_TAIL)}`}function writeSecret(name,value){transact((secrets)=>{let v=value.trim();if(v)secrets[name]=v;else delete secrets[name]})}var SUM_TOLERANCE=0.02,bad=(why)=>({ok:!1,why});function isRecord(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function readConfidence(v){return typeof v==="number"&&Number.isFinite(v)&&v>=0&&v<=1?v:void 0}function readChoiceAnswer(answer){if(!isRecord(answer))return bad("answer is not an object");let choice=answer.choice;if(typeof choice!=="string"||!isAutoRoutingTier(choice))return bad(`choice ${JSON.stringify(choice)} is not one of the offered tiers`);let probs=answer.probabilities;if(!isRecord(probs))return bad("probabilities is not an object");let keys=Object.keys(probs).sort(),expected=[...AUTO_ROUTING_TIERS].sort();if(keys.length!==expected.length||keys.some((k,i)=>k!==expected[i]))return bad(`probabilities keys ${keys.join(",")} do not match the offered tiers`);let values={},sum=0;for(let tier of AUTO_ROUTING_TIERS){let p=probs[tier];if(typeof p!=="number"||!Number.isFinite(p)||p<0||p>1)return bad(`probability for ${tier} is not a number in [0,1]`);values[tier]=p,sum+=p}if(Math.abs(sum-1)>SUM_TOLERANCE)return bad(`probabilities sum to ${sum.toFixed(3)}`);for(let tier of AUTO_ROUTING_TIERS)if(values[tier]>values[choice])return bad(`choice ${choice} is not the most likely tier`);let confidence=readConfidence(answer.confidence);if(confidence===void 0)return bad("confidence is missing or out of range");return{ok:!0,value:{tier:choice,confidence,probabilities:values}}}function readJevAnswer(payload){if(!isRecord(payload))return bad("response is not an object");let answers=payload.answers;if(!isRecord(answers))return bad("response has no answers");return readChoiceAnswer(answers.verdict)}function readPlainAnswer(payload){if(!isRecord(payload))return bad("response is not an object");let tier=payload.tier;if(typeof tier!=="string"||!isAutoRoutingTier(tier))return bad(`tier ${JSON.stringify(tier)} is not one of ${AUTO_ROUTING_TIERS.join(", ")}`);let confidence=readConfidence(payload.confidence);if(confidence===void 0)return bad("confidence is missing or not a number in [0,1]");return{ok:!0,value:{tier,confidence}}}var DEFAULT_TIER_RUBRIC={role:"\u4F60\u5728\u7ED9\u4E00\u6761\u300C\u7528\u6237\u65B0\u5EFA coding task \u65F6\u5199\u7684\u7B2C\u4E00\u53E5\u8BDD\u300D\u6253\u6DF1\u5EA6\u6863\u3002",criterion:"\u53EA\u6709\u4E00\u4E2A\u5224\u636E\uFF1A\u7528\u6237\u7684\u6307\u4EE4\u91CC\uFF0C\u6709\u591A\u5C11\u6D41\u7A0B\u9700\u8981\u6A21\u578B\u81EA\u5DF1\u63A8\u7406\u51FA\u6765\u3002\u4E0D\u770B\u5DE5\u4F5C\u91CF\uFF0C\u4E0D\u770B\u96BE\u5EA6\uFF0C\u4E0D\u770B\u6587\u672C\u957F\u77ED\uFF0C\u4E0D\u770B\u8BED\u8A00\u3002\u4E09\u6863\u6CA1\u6709\u76EE\u6807\u6BD4\u4F8B\u3002",criteria:{swift:{what:`- \u8BF4\u4E86\u600E\u4E48\u505A\uFF1Astep-by-step\u3001\u6307\u5230\u4E86\u6587\u4EF6/\u914D\u7F6E/\u9009\u9879\u3001\u7ED9\u4E86\u53C2\u8003\u5B9E\u73B0\uFF08\u300C\u53C2\u8003 vuetify \u540C\u540D prop\u300D\u300C\u50CF fzf \u90A3\u6837\u300D\uFF09\u3002
|
|
5
5
|
- \u7528\u6237\u5DF2\u7ECF\u5B9A\u4F4D\u8FC7\u4E86\uFF1A\u300Cprofile \u4E86\u4E00\u4E0B\u53D1\u73B0\u662F X\uFF0C\u7F13\u5B58\u4E00\u4E0B\u5427\u300D\u2014\u2014\u539F\u56E0\u627E\u5230\u4E86\uFF0C\u5269\u4E0B\u7167\u505A\u3002
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{submitFeedback}from"./chunk-
|
|
2
|
+
import{submitFeedback}from"./chunk-jva9qfcn.js";import"./chunk-fwbk82nn.js";import"./chunk-prqeddy7.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-b39sdtt0.js";import"./chunk-nc46gddg.js";import"./chunk-wqfp8d9w.js";import{readFileSync}from"fs";var CLI_NAME=ROVE_PRODUCT_NAME,FEEDBACK_USAGE=[`Usage: ${CLI_NAME} feedback --title <text> (--body <text> | --body-file <path>) [--category <slug>]`,"","Create a GitHub Discussion in the Rove repository using the GitHub CLI.","","Requires:"," gh auth login","","Options:"," --title <text> Discussion title"," --body <text> Discussion body"," --body-file <path> Read the Discussion body from a file; use - for stdin"," --category <slug> Discussion category slug (default: feedback)"," -h, --help Print this help",""].join(`
|
|
3
3
|
`);function usageError(message){process.stderr.write(`${CLI_NAME} feedback: ${message}
|
|
4
4
|
|
|
5
5
|
${FEEDBACK_USAGE}
|