@sma1lboy/rove 0.9.304 → 0.9.305-next.430
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-kyddm7xe.js → chunk-06vsvvtr.js} +1 -1
- package/dist/cli/{chunk-jkxn32nk.js → chunk-0s7j1xps.js} +1 -1
- package/dist/cli/{chunk-vk2xz0s4.js → chunk-19n8y9xp.js} +3 -3
- package/dist/cli/{chunk-qnkq7d8z.js → chunk-1bertmzz.js} +3 -3
- package/dist/cli/{chunk-gb2ahsfx.js → chunk-1et3gskx.js} +1 -1
- package/dist/cli/chunk-29e7x3qx.js +2 -0
- package/dist/cli/{chunk-sd6eae1h.js → chunk-2agspgfq.js} +1 -1
- package/dist/cli/{chunk-ga0kvz6j.js → chunk-2gpr5dm4.js} +1 -1
- package/dist/cli/{chunk-d4w91a02.js → chunk-2nddryb2.js} +1 -1
- package/dist/cli/{chunk-q6qmv2jq.js → chunk-37g0yabr.js} +1 -1
- package/dist/cli/{chunk-d3d06a4w.js → chunk-3da0g8md.js} +2 -2
- package/dist/cli/{chunk-mb2tfr2c.js → chunk-3jh1cfdj.js} +1 -1
- package/dist/cli/{chunk-j1rw5jdt.js → chunk-3t3fp5h4.js} +1 -1
- package/dist/cli/{chunk-tr9n297x.js → chunk-4nzf8w3e.js} +2 -2
- package/dist/cli/{chunk-am3vaamq.js → chunk-59ff10tt.js} +1 -1
- package/dist/cli/{chunk-hmfqyvet.js → chunk-5dv7pw3w.js} +2 -2
- package/dist/cli/{chunk-cmbd3s71.js → chunk-6azsw0ry.js} +5 -5
- package/dist/cli/{chunk-vpm8dfyg.js → chunk-6cggsxpr.js} +1 -1
- package/dist/cli/{chunk-p9an6jcq.js → chunk-6jxe4f13.js} +1 -1
- package/dist/cli/{chunk-b7bbnx1x.js → chunk-6wzb9c2x.js} +1 -1
- package/dist/cli/chunk-750rk2xz.js +16 -0
- package/dist/cli/chunk-7dah6dc9.js +2 -0
- package/dist/cli/{chunk-tzf7b25k.js → chunk-7ezpcrkf.js} +1 -1
- package/dist/cli/chunk-7gk8g1ae.js +2 -0
- package/dist/cli/{chunk-22syh28c.js → chunk-7yhekmvy.js} +1 -1
- package/dist/cli/{chunk-mdypt84n.js → chunk-8ag7qs90.js} +1 -1
- package/dist/cli/chunk-8nbvsger.js +2 -0
- package/dist/cli/{chunk-cb3krnqn.js → chunk-8wejvvsz.js} +1 -1
- package/dist/cli/{chunk-akygcre8.js → chunk-9892j1n1.js} +1 -1
- package/dist/cli/{chunk-wh147k4t.js → chunk-9b42t2wf.js} +1 -1
- package/dist/cli/{chunk-ammf7919.js → chunk-9tke0g8m.js} +1 -1
- package/dist/cli/chunk-a5pd9fk3.js +2 -0
- package/dist/cli/{chunk-x4gqyhhv.js → chunk-a6s52zm5.js} +1 -1
- package/dist/cli/{chunk-d4eav2xt.js → chunk-a8j2x5pf.js} +1 -1
- package/dist/cli/chunk-aejb41e3.js +2 -0
- package/dist/cli/{chunk-jx0sfc90.js → chunk-am70fwd0.js} +1 -1
- package/dist/cli/{chunk-gr9555d9.js → chunk-b7rxn7c9.js} +1 -1
- package/dist/cli/chunk-cs7m5f61.js +2 -0
- package/dist/cli/{chunk-s00wwj3a.js → chunk-cvcp1aye.js} +1 -1
- package/dist/cli/{chunk-76433s6v.js → chunk-d35ctfpd.js} +1 -1
- package/dist/cli/chunk-dab3kttb.js +2 -0
- package/dist/cli/{chunk-7w43ktng.js → chunk-ejs6dnxf.js} +1 -1
- package/dist/cli/{chunk-yebkeqj2.js → chunk-er4mc36m.js} +1 -1
- package/dist/cli/{chunk-sqcntdty.js → chunk-etz8f2ny.js} +1 -1
- package/dist/cli/{chunk-g770enx5.js → chunk-fmhnw1nz.js} +2 -2
- package/dist/cli/{chunk-689sfk7h.js → chunk-g70rcpsp.js} +1 -1
- package/dist/cli/{chunk-px91psgc.js → chunk-ga448pv8.js} +1 -1
- package/dist/cli/{chunk-5gw9f1zb.js → chunk-gafj4yp3.js} +4 -4
- package/dist/cli/{chunk-gdjaf50p.js → chunk-ggjg0h5c.js} +1 -1
- package/dist/cli/{chunk-wjz55sc3.js → chunk-gvs8sbp2.js} +1 -1
- package/dist/cli/{chunk-zc7e78mv.js → chunk-gz0x179r.js} +1 -1
- package/dist/cli/chunk-h2xantkm.js +2 -0
- package/dist/cli/{chunk-ytx7x3j8.js → chunk-hct98wxq.js} +1 -1
- package/dist/cli/{chunk-qjr63j9v.js → chunk-kvwneanp.js} +1 -1
- package/dist/cli/chunk-m5ddrj6q.js +2 -0
- package/dist/cli/{chunk-m6ekn4q8.js → chunk-mavyyarb.js} +1 -1
- package/dist/cli/{chunk-6y1jamqn.js → chunk-me70fpec.js} +1 -1
- package/dist/cli/{chunk-ykm19q7h.js → chunk-n15p38e5.js} +1 -1
- package/dist/cli/{chunk-2v2t1a03.js → chunk-nhsem71y.js} +1 -1
- package/dist/cli/{chunk-e04yypye.js → chunk-nyr8zxgd.js} +3 -3
- package/dist/cli/{chunk-q8b6gnc5.js → chunk-p4rhkv3k.js} +1 -1
- package/dist/cli/{chunk-x3c6f2sf.js → chunk-pf3nzz87.js} +1 -1
- package/dist/cli/{chunk-jb63kaer.js → chunk-qaznc1bg.js} +1 -1
- package/dist/cli/{chunk-633beahm.js → chunk-qwqa75g1.js} +1 -1
- package/dist/cli/{chunk-2h58p581.js → chunk-r8xt34nn.js} +1 -1
- package/dist/cli/chunk-ragdpajw.js +6 -0
- package/dist/cli/{chunk-bp3edwby.js → chunk-rnmj5c45.js} +1 -1
- package/dist/cli/{chunk-ahnv378z.js → chunk-s129kc10.js} +1 -1
- package/dist/cli/chunk-s2eezz0a.js +3 -0
- package/dist/cli/{chunk-sfskhmzp.js → chunk-s6wqbs6y.js} +1 -1
- package/dist/cli/{chunk-rz5sspn8.js → chunk-sffdpzfv.js} +1 -1
- package/dist/cli/{chunk-7zawz6sa.js → chunk-sggsdk9s.js} +11 -7
- package/dist/cli/{chunk-16sb3y82.js → chunk-t4reqv8m.js} +1 -1
- package/dist/cli/{chunk-q6q4aram.js → chunk-t7qj639x.js} +1 -1
- package/dist/cli/{chunk-emj5p5k7.js → chunk-t8gt3kq8.js} +1 -1
- package/dist/cli/{chunk-486j02v4.js → chunk-vat1vjkk.js} +1 -1
- package/dist/cli/{chunk-gd8gc37t.js → chunk-vd9670dy.js} +1 -1
- package/dist/cli/chunk-vjejmwzj.js +2 -0
- package/dist/cli/{chunk-rajwag3e.js → chunk-weah9492.js} +1 -1
- package/dist/cli/{chunk-mwbs7818.js → chunk-x5ybfyja.js} +1 -1
- package/dist/cli/{chunk-zpdvfb01.js → chunk-xj3034s1.js} +1 -1
- package/dist/cli/chunk-yk3we30f.js +2 -0
- package/dist/cli/chunk-yzz6vx5j.js +2 -0
- package/dist/cli/{chunk-7d22h7qg.js → chunk-z1fpd4k2.js} +1 -1
- package/dist/cli/{chunk-r9yx4k0q.js → chunk-zc67sqet.js} +1 -1
- package/dist/cli/{chunk-nmfcvtxk.js → chunk-zp4efbtb.js} +1 -1
- package/dist/cli/{chunk-2pc4wpm4.js → chunk-zqftyn6w.js} +1 -1
- package/dist/cli/{chunk-bznee97z.js → chunk-zze1pw22.js} +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/cli/rove.js +3 -3
- package/dist/completions/rove.bash +1 -1
- package/dist/completions/rove.fish +1 -1
- package/dist/completions/rove.zsh +1 -1
- package/dist/web/assets/{index-D9TLg2oV.js → index-7xgjby6F.js} +3 -3
- package/dist/web/assets/{term-mount-Cn86hde_.js → term-mount-OMVJnrk8.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/cli/chunk-0qxqk8cr.js +0 -2
- package/dist/cli/chunk-0r64dqy3.js +0 -3
- package/dist/cli/chunk-1fw86kg2.js +0 -2
- package/dist/cli/chunk-1w2dx91w.js +0 -2
- package/dist/cli/chunk-2ze5ss4k.js +0 -2
- package/dist/cli/chunk-46zqt24x.js +0 -2
- package/dist/cli/chunk-8647s43m.js +0 -2
- package/dist/cli/chunk-96jqrzcp.js +0 -2
- package/dist/cli/chunk-czyyrxmf.js +0 -2
- package/dist/cli/chunk-d9e1vx7y.js +0 -15
- package/dist/cli/chunk-fg7kv30n.js +0 -2
- package/dist/cli/chunk-gpmpv5gw.js +0 -2
- package/dist/cli/chunk-pe92nt86.js +0 -4
- package/dist/cli/chunk-scb1g3zf.js +0 -2
- package/dist/cli/chunk-vy5ja578.js +0 -2
- package/dist/cli/chunk-xrg2tc6p.js +0 -2
- package/dist/cli/chunk-zshgx9fp.js +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{failureHint}from"./chunk-7c89khwg.js";import{PluginCliError,installPlugin,linkPlugin}from"./chunk-
|
|
2
|
+
import{failureHint}from"./chunk-7c89khwg.js";import{PluginCliError,installPlugin,linkPlugin}from"./chunk-mavyyarb.js";import{resolvePluginBinPath}from"./chunk-b0ssvpht.js";import{buildPaneArgv}from"./chunk-38hnq4aq.js";import{buildPluginEnv}from"./chunk-d1vv8xk6.js";import{currentPluginPlatform,loadPluginRegistry,qualifiedActionId,readPluginManifest,removePluginEntry,savePluginRegistry,supportsPlatform}from"./chunk-psxhek7n.js";import"./chunk-s2eezz0a.js";import{SUBCOMMAND_VERBS}from"./chunk-6jxe4f13.js";import{BUILTIN_MODS,installedBuiltinMods,isBuiltinModId,setBuiltinModInstalled}from"./chunk-v8nbqjwc.js";import{pluginCheckoutDir,pluginConfigDir,pluginLogPath}from"./chunk-ws2q07kb.js";import"./chunk-tn9gtf18.js";import"./chunk-w7zv47mp.js";import"./chunk-96kvwzj8.js";import{flagValue}from"./chunk-zsfyj36g.js";import{errorMessage}from"./chunk-9gctbddn.js";import"./chunk-8xdhw922.js";import"./chunk-cmp64q4j.js";import"./chunk-yt15y085.js";import{defaultDaemonSocketPath}from"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{spawnSync}from"child_process";import{readFileSync,rmSync}from"fs";function builtinModRows(homeDir){let installed=new Set(installedBuiltinMods(homeDir));return BUILTIN_MODS.map((mod)=>`${mod.id} first-party ${installed.has(mod.id)?"installed":"not installed"} (${mod.description})`)}function setBuiltinMod(id,install,homeDir){let was=installedBuiltinMods(homeDir).includes(id);if(setBuiltinModInstalled(id,install,homeDir),install)return was?`${id} is already installed`:`installed ${id}`;return was?`uninstalled ${id} (its data stays on disk; reinstall picks it up)`:`${id} is not installed`}var CLI_NAME=ROVE_PRODUCT_NAME;function printUsage(out){out.write([`usage: ${CLI_NAME} plugin <command>`,""," install <owner/repo[/subdir]> [--yes] [--ref <rev>] clone from GitHub, preview, build, register"," install kanban | issues install a first-party mod (uninstall keeps its data)"," link <dir> register a local plugin directory (dev)"," list first-party mods, installed + linked plugins"," search [query] browse the marketplace (GitHub topic rove-plugin)"," outdated check GitHub-installed plugins against upstream"," update <id\u2026> | --all [--yes] reinstall stale plugins from GitHub"," enable <id> | disable <id> toggle a plugin without unregistering it"," unlink <id> unregister a linked plugin (files untouched)"," uninstall <id-or-spec> unregister + remove the managed checkout"," config-dir <id> print the plugin's config directory"," log <id> [-n <count>] tail the plugin's command-run log"," action list [--plugin <id>] declared actions"," action invoke <plugin-id.action-id> run an action now"," pane open <plugin-id.pane-id> [--task <task-id>] open a plugin pane as a terminal tab (JSON:"," clients \u2014 0 = no attached UI performed the split)","","Marketplace: https://github.com/topics/rove-plugin",""].join(`
|
|
3
3
|
`))}function loadAll(){return loadPluginRegistry().plugins.map((entry)=>{try{return{entry,manifest:readPluginManifest(entry.root).manifest}}catch{return{entry,manifest:void 0}}})}function requireEntry(id){let entry=loadPluginRegistry().plugins.find((p)=>p.id===id);if(!entry)throw new PluginCliError(`no plugin registered as \`${id}\`; see \`${CLI_NAME} plugin list\``);return entry}function listPlugins(){for(let row of builtinModRows())console.log(row);let all=loadAll();if(all.length===0){console.log(`no other plugins installed. Try: ${CLI_NAME} plugin install <owner/repo> \u2014 browse the \`rove-plugin\` GitHub topic.`);return}for(let{entry,manifest}of all){let state=entry.enabled?"enabled":"disabled",kind=entry.source.kind==="link"?`linked ${entry.root}`:entry.source.spec,broken=manifest?"":" [manifest unreadable]";console.log(`${entry.id} v${entry.version} ${state} (${kind})${broken}`)}}function setEnabled(id,enabled){let entry=requireEntry(id),registry=loadPluginRegistry();savePluginRegistry({plugins:registry.plugins.map((p)=>p.id===id?{...entry,enabled}:p)}),console.log(`${enabled?"enabled":"disabled"} ${id}`)}function unlink(id){let entry=requireEntry(id);if(entry.source.kind!=="link")throw new PluginCliError(`\`${id}\` is a GitHub install; use uninstall`);savePluginRegistry(removePluginEntry(loadPluginRegistry(),id)),console.log(`unlinked ${id} (files untouched at ${entry.root})`)}function uninstall(idOrSpec){let registry=loadPluginRegistry(),entry=registry.plugins.find((p)=>p.id===idOrSpec||p.source.kind==="github"&&p.source.spec===idOrSpec);if(!entry)throw new PluginCliError(`no plugin registered as \`${idOrSpec}\``);if(entry.source.kind==="link")throw new PluginCliError(`\`${entry.id}\` is linked; use unlink`);savePluginRegistry(removePluginEntry(registry,entry.id)),rmSync(pluginCheckoutDir(entry.id),{recursive:!0,force:!0}),console.log(`uninstalled ${entry.id} (config/state kept under ~/.rove/plugins/${entry.id}/)`)}function listActions(pluginFilter){for(let{entry,manifest}of loadAll()){if(!manifest||pluginFilter&&entry.id!==pluginFilter)continue;for(let action of manifest.actions)console.log(`${qualifiedActionId(entry.id,action.id)} ${action.title}`)}}function findByLongestPluginPrefix(qualified,options,findItem){for(let{entry,manifest}of loadAll().filter(({entry:entry2,manifest:manifest2})=>Boolean(manifest2&&(!options.enabledOnly||entry2.enabled)&&qualified.startsWith(`${entry2.id}.`))).sort((a,b)=>b.entry.id.length-a.entry.id.length)){let item=findItem(manifest,qualified.slice(entry.id.length+1));if(item!==void 0)return{entry,manifest,item}}return}function assertPlatformSupported(label,item,manifest){if(supportsPlatform(item,manifest,currentPluginPlatform()))return;let declared=(item.platforms??manifest.platforms??[]).join(", ");throw new PluginCliError(`\`${label}\` is not supported on this platform (declares ${declared})`)}function invokeAction(qualified,extraArgs){let hit=findByLongestPluginPrefix(qualified,{enabledOnly:!0},(manifest,actionId)=>manifest.actions.find((a)=>a.id===actionId));if(!hit)throw new PluginCliError(`no action \`${qualified}\`; see \`${CLI_NAME} plugin action list\``);assertPlatformSupported(qualified,hit.item,hit.manifest);let action=hit.item,[cmd,...args]=[...action.command,...extraArgs],res=spawnSync(cmd,args,{cwd:hit.entry.root,stdio:"inherit",env:buildPluginEnv({socketPath:defaultDaemonSocketPath(),binPath:resolvePluginBinPath(),pluginId:hit.entry.id,pluginRoot:hit.entry.root,extra:{ROVE_PLUGIN_ACTION_ID:action.id,ROVE_PLUGIN_INVOKE_CWD:process.cwd()}})});process.exit(res.status??1)}function resolvePaneQualified(qualified){let hit=findByLongestPluginPrefix(qualified,{enabledOnly:!1},(manifest,entrypoint)=>manifest.panes.find((p)=>p.id===entrypoint));if(!hit)throw new PluginCliError(`no pane \`${qualified}\`; see \`${CLI_NAME} plugin list\``);return{pluginId:hit.entry.id,entrypoint:hit.item.id}}async function openPane(pluginId,entrypoint,taskFlag){let loaded=loadAll().find(({entry})=>entry.id===pluginId);if(!loaded?.manifest)throw new PluginCliError(`no plugin \`${pluginId}\` (or its manifest is unreadable)`);if(!loaded.entry.enabled)throw new PluginCliError(`\`${pluginId}\` is disabled`);let pane=loaded.manifest.panes.find((p)=>p.id===entrypoint);if(!pane)throw new PluginCliError(`no pane \`${entrypoint}\` in \`${pluginId}\`; declare it under [[panes]]`);assertPlatformSupported(`${pluginId}.${pane.id}`,pane,loaded.manifest);let{openDaemonSession,resolveActiveTaskId}=await import("./chunk-2cf5enj3.js"),session=await openDaemonSession({mode:"start"});try{let taskId=taskFlag??await resolveActiveTaskId(session.client);if(!taskId)throw new PluginCliError("no active task; pass --task <id>");let argv=buildPaneArgv(loaded.entry.id,loaded.entry.root,pane,{socketPath:defaultDaemonSocketPath(),binPath:resolvePluginBinPath(),taskId}),reply=await session.client.request("tab.open",{taskId,argv,title:pane.title,placement:pane.placement});console.log(JSON.stringify({...reply,ok:!0,pane:`${pluginId}.${pane.id}`,taskId,title:pane.title}))}finally{session.close()}}function tailLog(id,count){requireEntry(id);let text;try{text=readFileSync(pluginLogPath(id),"utf8")}catch{console.log("(no runs logged yet)");return}let lines=text.trimEnd().split(`
|
|
4
|
-
`);for(let line of lines.slice(-count))console.log(line)}async function runPluginSubcommand(rest){let[command,...args]=rest;if(command!==void 0&&!SUBCOMMAND_VERBS.plugin.includes(command)){let isHelp=command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}try{switch(command){case"install":{let spec=args.find((a)=>!a.startsWith("-"));if(!spec)throw new PluginCliError("install needs <owner/repo[/subdir]>");if(isBuiltinModId(spec)){console.log(setBuiltinMod(spec,!0));return}await installPlugin(spec,{yes:args.includes("--yes"),ref:flagValue(args,"--ref")});return}case"link":{if(!args[0])throw new PluginCliError("link needs a directory");linkPlugin(args[0]);return}case"list":listPlugins();return;case"search":{let{searchMarketplace}=await import("./chunk-094cgrcc.js");await searchMarketplace(args.find((a)=>!a.startsWith("-")));return}case"outdated":{let{printOutdated}=await import("./chunk-
|
|
4
|
+
`);for(let line of lines.slice(-count))console.log(line)}async function runPluginSubcommand(rest){let[command,...args]=rest;if(command!==void 0&&!SUBCOMMAND_VERBS.plugin.includes(command)){let isHelp=command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}try{switch(command){case"install":{let spec=args.find((a)=>!a.startsWith("-"));if(!spec)throw new PluginCliError("install needs <owner/repo[/subdir]>");if(isBuiltinModId(spec)){console.log(setBuiltinMod(spec,!0));return}await installPlugin(spec,{yes:args.includes("--yes"),ref:flagValue(args,"--ref")});return}case"link":{if(!args[0])throw new PluginCliError("link needs a directory");linkPlugin(args[0]);return}case"list":listPlugins();return;case"search":{let{searchMarketplace}=await import("./chunk-094cgrcc.js");await searchMarketplace(args.find((a)=>!a.startsWith("-")));return}case"outdated":{let{printOutdated}=await import("./chunk-t8gt3kq8.js");printOutdated();return}case"update":{let{updatePlugins}=await import("./chunk-t8gt3kq8.js");await updatePlugins(args.filter((a)=>!a.startsWith("-")),{all:args.includes("--all"),yes:args.includes("--yes")});return}case"enable":case"disable":{if(!args[0])throw new PluginCliError(`${command} needs a plugin id`);if(isBuiltinModId(args[0]))console.log(setBuiltinMod(args[0],command==="enable"));else setEnabled(args[0],command==="enable");return}case"unlink":{if(!args[0])throw new PluginCliError("unlink needs a plugin id");unlink(args[0]);return}case"uninstall":{if(!args[0])throw new PluginCliError("uninstall needs a plugin id or owner/repo spec");if(isBuiltinModId(args[0]))console.log(setBuiltinMod(args[0],!1));else uninstall(args[0]);return}case"config-dir":{if(!args[0])throw new PluginCliError("config-dir needs a plugin id");requireEntry(args[0]),console.log(pluginConfigDir(args[0]));return}case"log":{if(!args[0])throw new PluginCliError("log needs a plugin id");tailLog(args[0],Number.parseInt(flagValue(args,"-n")??"20",10)||20);return}case"pane":{let[sub,...paneArgs]=args;if(sub==="open"){let positional=paneArgs.find((a)=>!a.startsWith("-")&&a!==flagValue(paneArgs,"--task")),pluginId=flagValue(paneArgs,"--plugin"),entrypoint=flagValue(paneArgs,"--entrypoint");if(!pluginId||!entrypoint){if(!positional)throw new PluginCliError("pane open needs <plugin-id.pane-id> (or --plugin <id> --entrypoint <pane-id>) [--task <task-id>]");({pluginId,entrypoint}=resolvePaneQualified(positional))}await openPane(pluginId,entrypoint,flagValue(paneArgs,"--task"));return}printUsage(process.stderr),process.exit(2);return}case"action":{let[sub,...actionArgs]=args;if(sub==="list"){listActions(flagValue(actionArgs,"--plugin"));return}if(sub==="invoke"){if(!actionArgs[0])throw new PluginCliError("action invoke needs <plugin-id.action-id>");invokeAction(actionArgs[0],actionArgs.slice(1));return}printUsage(process.stderr),process.exit(2);return}default:{let isHelp=command===void 0||command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}}}catch(err){if(err instanceof PluginCliError)console.error(`${CLI_NAME} plugin: ${err.message}
|
|
5
5
|
Run ${CLI_NAME} plugin --help for usage.`),process.exit(1);console.error(`${CLI_NAME} plugin: ${errorMessage(err)}
|
|
6
6
|
${failureHint(err,CLI_NAME)}`),process.exit(1)}}export{runPluginSubcommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ENGINE_NOT_OBSERVED_REASON,ENGINE_START_POLL_MS,ENGINE_START_PROBE_MS,deliverHostedPrompt,deliverToKey,ensurePtyHost,findEngineKey,isTaskKey,killTaskSessions,listSessions,listSessionsOrNull,openPtyHost,outcomeFields,taskKeys}from"./chunk-
|
|
2
|
+
import{ENGINE_NOT_OBSERVED_REASON,ENGINE_START_POLL_MS,ENGINE_START_PROBE_MS,deliverHostedPrompt,deliverToKey,ensurePtyHost,findEngineKey,isTaskKey,killTaskSessions,listSessions,listSessionsOrNull,openPtyHost,outcomeFields,taskKeys}from"./chunk-06vsvvtr.js";import"./chunk-zze1pw22.js";import"./chunk-0x62tvdk.js";import"./chunk-y0skz8j9.js";import"./chunk-mqfvzdpr.js";import"./chunk-4whghfgg.js";import"./chunk-rxqdw6s5.js";import"./chunk-xe3zr5b9.js";import"./chunk-gzn14mwk.js";import"./chunk-t7qj639x.js";import"./chunk-gz0x179r.js";import"./chunk-jz1kj4sf.js";import"./chunk-v8nbqjwc.js";import"./chunk-ws2q07kb.js";import"./chunk-g9ba25q5.js";import"./chunk-133c884f.js";import"./chunk-catrr0z3.js";import"./chunk-xjrkvksc.js";import"./chunk-tn9gtf18.js";import"./chunk-ahbw1f8n.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-sffdpzfv.js";import"./chunk-5dv7pw3w.js";import"./chunk-2bapg0v2.js";import"./chunk-750rk2xz.js";import"./chunk-w7zv47mp.js";import"./chunk-cw9h73h5.js";import"./chunk-37g0yabr.js";import"./chunk-nw48bskt.js";import"./chunk-k7tdg6kb.js";import"./chunk-1pmzr8kr.js";import"./chunk-e5jxbd98.js";import"./chunk-84q9hv7m.js";import"./chunk-96kvwzj8.js";import"./chunk-etfh8f4z.js";import"./chunk-07665jz6.js";import"./chunk-40dgv828.js";import"./chunk-zsfyj36g.js";import"./chunk-1feav1w3.js";import"./chunk-9gctbddn.js";import"./chunk-mg1cas61.js";import"./chunk-yvg46jh9.js";import"./chunk-xasg8z9e.js";import"./chunk-8xdhw922.js";import"./chunk-cmp64q4j.js";import"./chunk-j152pk57.js";import"./chunk-c4dfktv2.js";import"./chunk-bdmbevk8.js";import"./chunk-7kysxgbq.js";import"./chunk-g755p68b.js";import"./chunk-tcmzq86w.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-7ghwdjdc.js";import"./chunk-m5nd44st.js";import"./chunk-rxb0hw1e.js";import"./chunk-tw25g9g5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-1mp632fj.js";import"./chunk-91sykzqq.js";export{taskKeys,outcomeFields,openPtyHost,listSessionsOrNull,listSessions,killTaskSessions,isTaskKey,findEngineKey,ensurePtyHost,deliverToKey,deliverHostedPrompt,ENGINE_START_PROBE_MS,ENGINE_START_POLL_MS,ENGINE_NOT_OBSERVED_REASON};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{CONTRIB_ENGINE_IDS,contribEngineEntry,detectBobAccount,detectClaudeAccount,detectCodexAccount,detectCopilotAccount,detectKimiAccount,findClaudeBinary,isContribEngine,isTransientFailureText,mergeFlatHooks,parseFlatHooks,pluginEngineIds,writeIfChanged}from"./chunk-2bapg0v2.js";import{TomlError,parse}from"./chunk-w7zv47mp.js";import{resolveRoveSpawn}from"./chunk-k7tdg6kb.js";import{realPathOrSelf}from"./chunk-yvg46jh9.js";import{ClaudeHookAdapter,isRovePluginEnabled}from"./chunk-j152pk57.js";import{GATED_TOOL_VERBS,JsonHookAdapter,ROVE_HOOK_VERSION,editJsonSettings,hookCommandQuoting,roveHookArgs}from"./chunk-c4dfktv2.js";import{roveCliInvocation,roveHookInvocation}from"./chunk-bdmbevk8.js";import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{bobDbPath,bobHome,bobTrustPath,copilotConfigPath,isJsonlLineWithinBound,readFirstLineBounded,readSharedConfigSync,readTextFileBounded,readTextFileIfRegular,skillsDirUnder,updateSharedJsonSync,vendorAgentDir,vendorConfigHome,vendorWriteHomeDeps}from"./chunk-g755p68b.js";import{BUILTIN_VENDORS,isBuiltinVendor}from"./chunk-h2m7em1e.js";import{samePath}from"./chunk-pn5ygqn6.js";import{isObject}from"./chunk-7ghwdjdc.js";import{roveStateDir}from"./chunk-8143k3t6.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync as existsSync4}from"fs";import{homedir as homedir7}from"os";import{join as join5}from"path";var BOB_SCREEN_MANIFEST={rules:[{state:"blocked",any:["complete sign-in in your browser"]},{state:"blocked",all:["do you trust this folder?"],any:["trust folder","don't trust"]},{state:"blocked",all:["approve once"],any:["reject","always allow"]},{state:"working",any:["enter to steer","tab to queue"]},{state:"idle",lineRegex:["^\\s*\\w[\\w ]* mode( \xB7|\\s*$)"]}]};import{homedir}from"os";var TRUSTED="TRUST_FOLDER";function trustBobWorktree(worktreePath,home=homedir()){updateSharedJsonSync(bobTrustPath(home),(raw)=>{if(raw===void 0)return{};try{return JSON.parse(raw)}catch{return{}}},(doc)=>{let folders=doc.folders&&typeof doc.folders==="object"&&!Array.isArray(doc.folders)?doc.folders:{};if(folders[worktreePath]===TRUSTED)return;let merged={...doc,version:doc.version??1,folders:{...folders,[worktreePath]:TRUSTED}};return`${JSON.stringify(merged,null,2)}
|
|
3
|
-
`})}var claudeCapabilities={interruptSequence:"\x1B"},claudeIdentity={shortName:"Claude"};import{homedir as homedir2,userInfo}from"os";import path from"path";import{spawn}from"child_process";function computeNextAllowedAt(startedAt,finishedAt,timedOut,cfg){if(timedOut)return startedAt+cfg.slowRetryMs;return finishedAt+Math.max(cfg.minIntervalMs,(finishedAt-startedAt)*(cfg.durationFactor??5))}function shouldPoll(state,now){return!state.inFlight&&now>=state.nextAllowedAt}function applyJitter(delayMs,ratio,rand=Math.random){let r=Math.max(0,Math.min(1,ratio)),offset=(rand()*2-1)*delayMs*r;return Math.max(0,delayMs+offset)}function exponentialBackoff(baseMs,attempt,capMs){if(attempt<=0)return Math.min(baseMs,capMs);return Math.min(baseMs*2**attempt,capMs)}function maybeStartScheduledRun(state,cfg,run,onValue){let startedAt=Date.now();if(!shouldPoll(state,startedAt))return!1;state.inFlight=!0;let controller=new AbortController,timer=setTimeout(()=>controller.abort(),cfg.timeoutMs);return(async()=>{let value,ok=!1;try{value=await run(controller.signal),ok=!0}catch{}clearTimeout(timer);let timedOut=controller.signal.aborted;if(state.nextAllowedAt=computeNextAllowedAt(startedAt,Date.now(),timedOut,cfg),state.inFlight=!1,ok&&!timedOut)onValue(value)})(),!0}function decodeCapturedChunks(chunks){return Buffer.concat(chunks.map((c)=>typeof c==="string"?Buffer.from(c):c)).toString("utf8")}function spawnCapture(cmd,args,opts){return new Promise((resolve)=>{let chunks=[],errChunks=[],settled=!1,finish=(status)=>{if(settled)return;settled=!0,resolve({status,stdout:decodeCapturedChunks(chunks),stderr:decodeCapturedChunks(errChunks)})},child=spawn(cmd,args.slice(),{cwd:opts.cwd,stdio:["ignore","pipe","pipe"],env:opts.env,signal:opts.signal,killSignal:"SIGKILL"});child.stdout?.on("data",(chunk)=>{chunks.push(chunk)}),child.stderr?.on("data",(chunk)=>{errChunks.push(chunk)}),child.on("error",()=>finish(null)),child.on("close",(code)=>finish(code))})}var OAUTH_USAGE_URL="https://api.anthropic.com/api/oauth/usage",OAUTH_BETA_HEADER="oauth-2025-04-20",OAUTH_USER_AGENT="claude-cli/2.1.198 (external, cli)",USAGE_TIMEOUT_MS=1e4,KEYCHAIN_SERVICE="Claude Code-credentials";function parseResetsAtMs(value){if(value==null)return null;let numeric=typeof value==="number"?value:/^\d+(?:\.\d+)?$/.test(value.trim())?Number(value):null;if(numeric!=null){if(!Number.isFinite(numeric)||numeric<=0)return null;return numeric<1000000000000?numeric*1000:numeric}let parsed=Date.parse(String(value));return Number.isNaN(parsed)?null:parsed}var clampPercent=(value)=>Math.min(100,Math.max(0,Math.round(value)));function windowLabel(kind,scopeModel){if(kind==="weekly_scoped"&&scopeModel)return scopeModel;return kind.startsWith("weekly")||kind.startsWith("seven_day")?"7d":"5h"}function usageFromClaudePayload(payload,capturedAt){let windows=[];if(payload.limits?.length)for(let limit of payload.limits){if(typeof limit.kind!=="string"||typeof limit.percent!=="number")continue;windows.push({kind:limit.kind,label:windowLabel(limit.kind,limit.scope?.model?.display_name),percent:clampPercent(limit.percent),resetsAt:parseResetsAtMs(limit.resets_at)})}else{if(typeof payload.five_hour?.utilization==="number")windows.push({kind:"session",label:"5h",percent:clampPercent(payload.five_hour.utilization),resetsAt:parseResetsAtMs(payload.five_hour.resets_at)});if(typeof payload.seven_day?.utilization==="number")windows.push({kind:"weekly_all",label:"7d",percent:clampPercent(payload.seven_day.utilization),resetsAt:parseResetsAtMs(payload.seven_day.resets_at)})}return{windows,capturedAt}}function parseCredentials(raw){try{let oauth=JSON.parse(raw)?.claudeAiOauth;if(!oauth||typeof oauth.accessToken!=="string"||!oauth.accessToken)return null;return{accessToken:oauth.accessToken,...typeof oauth.expiresAt==="number"&&Number.isFinite(oauth.expiresAt)?{expiresAt:oauth.expiresAt}:{}}}catch{return null}}var isFresh=(c)=>c.expiresAt===void 0||c.expiresAt>Date.now();async function readFileCredentials(dir){try{return parseCredentials(await readTextFileBounded(path.join(dir,".credentials.json")))}catch{return null}}async function readKeychainCredentials(){if(process.platform!=="darwin")return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),3000);try{let result=await spawnCapture("security",["find-generic-password","-a",userInfo().username,"-w","-s",KEYCHAIN_SERVICE],{cwd:homedir2(),signal:controller.signal});return result.status===0?parseCredentials(result.stdout.trim()):null}finally{clearTimeout(timeout)}}async function readAccessToken(){let configDir=process.env.CLAUDE_CONFIG_DIR?.trim();if(configDir){let fromFile=await readFileCredentials(configDir);return fromFile&&isFresh(fromFile)?fromFile.accessToken:null}return[await readKeychainCredentials(),await readFileCredentials(vendorConfigHome("claude"))].find((c)=>c!=null&&isFresh(c))?.accessToken??null}async function fetchClaudeQuotaUsage(now=Date.now){let token=await readAccessToken().catch(()=>null);if(!token)return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),USAGE_TIMEOUT_MS);try{let response=await fetch(OAUTH_USAGE_URL,{headers:{Authorization:`Bearer ${token}`,"Content-Type":"application/json","User-Agent":OAUTH_USER_AGENT,"anthropic-beta":OAUTH_BETA_HEADER},signal:controller.signal});if(!response.ok)return null;return usageFromClaudePayload(await response.json(),now())}catch{return null}finally{clearTimeout(timeout)}}var SERVER="rove-files",LOCAL_FILE_TOOLS="Read|Edit|Write|Glob|Grep|NotebookEdit";function claudeRemoteWorkspaceArgv(base,linkDir,self=resolveRoveSpawn){let shim=(verb)=>self(["remote-workspace",verb,"--dir",linkDir]),[command="",...args]=shim("mcp"),hook=(matcher,verb)=>({matcher,hooks:[{type:"command",command:quoteShellArgv(shim(verb))}]}),
|
|
2
|
+
import{CONTRIB_ENGINE_IDS,contribEngineEntry,detectBobAccount,detectClaudeAccount,detectCodexAccount,detectCopilotAccount,detectKimiAccount,findClaudeBinary,isContribEngine,isTransientFailureText,mergeFlatHooks,parseFlatHooks,pluginEngineIds,writeIfChanged}from"./chunk-2bapg0v2.js";import{ensureMcpForwards,machineMcp,readRemoteWorkspace,whereThingsRun}from"./chunk-750rk2xz.js";import{TomlError,parse}from"./chunk-w7zv47mp.js";import{resolveRoveSpawn}from"./chunk-k7tdg6kb.js";import{realPathOrSelf}from"./chunk-yvg46jh9.js";import{ClaudeHookAdapter,isRovePluginEnabled}from"./chunk-j152pk57.js";import{GATED_TOOL_VERBS,JsonHookAdapter,ROVE_HOOK_VERSION,editJsonSettings,hookCommandQuoting,roveHookArgs}from"./chunk-c4dfktv2.js";import{roveCliInvocation,roveHookInvocation}from"./chunk-bdmbevk8.js";import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{bobDbPath,bobHome,bobTrustPath,copilotConfigPath,isJsonlLineWithinBound,readFirstLineBounded,readSharedConfigSync,readTextFileBounded,readTextFileIfRegular,skillsDirUnder,updateSharedJsonSync,vendorAgentDir,vendorConfigHome,vendorWriteHomeDeps}from"./chunk-g755p68b.js";import{BUILTIN_VENDORS,isBuiltinVendor}from"./chunk-h2m7em1e.js";import{samePath}from"./chunk-pn5ygqn6.js";import{isObject}from"./chunk-7ghwdjdc.js";import{roveStateDir}from"./chunk-8143k3t6.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync as existsSync4}from"fs";import{homedir as homedir7}from"os";import{join as join5}from"path";var BOB_SCREEN_MANIFEST={rules:[{state:"blocked",any:["complete sign-in in your browser"]},{state:"blocked",all:["do you trust this folder?"],any:["trust folder","don't trust"]},{state:"blocked",all:["approve once"],any:["reject","always allow"]},{state:"working",any:["enter to steer","tab to queue"]},{state:"idle",lineRegex:["^\\s*\\w[\\w ]* mode( \xB7|\\s*$)"]}]};import{homedir}from"os";var TRUSTED="TRUST_FOLDER";function trustBobWorktree(worktreePath,home=homedir()){updateSharedJsonSync(bobTrustPath(home),(raw)=>{if(raw===void 0)return{};try{return JSON.parse(raw)}catch{return{}}},(doc)=>{let folders=doc.folders&&typeof doc.folders==="object"&&!Array.isArray(doc.folders)?doc.folders:{};if(folders[worktreePath]===TRUSTED)return;let merged={...doc,version:doc.version??1,folders:{...folders,[worktreePath]:TRUSTED}};return`${JSON.stringify(merged,null,2)}
|
|
3
|
+
`})}var claudeCapabilities={interruptSequence:"\x1B"},claudeIdentity={shortName:"Claude"};import{homedir as homedir2,userInfo}from"os";import path from"path";import{spawn}from"child_process";function computeNextAllowedAt(startedAt,finishedAt,timedOut,cfg){if(timedOut)return startedAt+cfg.slowRetryMs;return finishedAt+Math.max(cfg.minIntervalMs,(finishedAt-startedAt)*(cfg.durationFactor??5))}function shouldPoll(state,now){return!state.inFlight&&now>=state.nextAllowedAt}function applyJitter(delayMs,ratio,rand=Math.random){let r=Math.max(0,Math.min(1,ratio)),offset=(rand()*2-1)*delayMs*r;return Math.max(0,delayMs+offset)}function exponentialBackoff(baseMs,attempt,capMs){if(attempt<=0)return Math.min(baseMs,capMs);return Math.min(baseMs*2**attempt,capMs)}function maybeStartScheduledRun(state,cfg,run,onValue){let startedAt=Date.now();if(!shouldPoll(state,startedAt))return!1;state.inFlight=!0;let controller=new AbortController,timer=setTimeout(()=>controller.abort(),cfg.timeoutMs);return(async()=>{let value,ok=!1;try{value=await run(controller.signal),ok=!0}catch{}clearTimeout(timer);let timedOut=controller.signal.aborted;if(state.nextAllowedAt=computeNextAllowedAt(startedAt,Date.now(),timedOut,cfg),state.inFlight=!1,ok&&!timedOut)onValue(value)})(),!0}function decodeCapturedChunks(chunks){return Buffer.concat(chunks.map((c)=>typeof c==="string"?Buffer.from(c):c)).toString("utf8")}function spawnCapture(cmd,args,opts){return new Promise((resolve)=>{let chunks=[],errChunks=[],settled=!1,finish=(status)=>{if(settled)return;settled=!0,resolve({status,stdout:decodeCapturedChunks(chunks),stderr:decodeCapturedChunks(errChunks)})},child=spawn(cmd,args.slice(),{cwd:opts.cwd,stdio:["ignore","pipe","pipe"],env:opts.env,signal:opts.signal,killSignal:"SIGKILL"});child.stdout?.on("data",(chunk)=>{chunks.push(chunk)}),child.stderr?.on("data",(chunk)=>{errChunks.push(chunk)}),child.on("error",()=>finish(null)),child.on("close",(code)=>finish(code))})}var OAUTH_USAGE_URL="https://api.anthropic.com/api/oauth/usage",OAUTH_BETA_HEADER="oauth-2025-04-20",OAUTH_USER_AGENT="claude-cli/2.1.198 (external, cli)",USAGE_TIMEOUT_MS=1e4,KEYCHAIN_SERVICE="Claude Code-credentials";function parseResetsAtMs(value){if(value==null)return null;let numeric=typeof value==="number"?value:/^\d+(?:\.\d+)?$/.test(value.trim())?Number(value):null;if(numeric!=null){if(!Number.isFinite(numeric)||numeric<=0)return null;return numeric<1000000000000?numeric*1000:numeric}let parsed=Date.parse(String(value));return Number.isNaN(parsed)?null:parsed}var clampPercent=(value)=>Math.min(100,Math.max(0,Math.round(value)));function windowLabel(kind,scopeModel){if(kind==="weekly_scoped"&&scopeModel)return scopeModel;return kind.startsWith("weekly")||kind.startsWith("seven_day")?"7d":"5h"}function usageFromClaudePayload(payload,capturedAt){let windows=[];if(payload.limits?.length)for(let limit of payload.limits){if(typeof limit.kind!=="string"||typeof limit.percent!=="number")continue;windows.push({kind:limit.kind,label:windowLabel(limit.kind,limit.scope?.model?.display_name),percent:clampPercent(limit.percent),resetsAt:parseResetsAtMs(limit.resets_at)})}else{if(typeof payload.five_hour?.utilization==="number")windows.push({kind:"session",label:"5h",percent:clampPercent(payload.five_hour.utilization),resetsAt:parseResetsAtMs(payload.five_hour.resets_at)});if(typeof payload.seven_day?.utilization==="number")windows.push({kind:"weekly_all",label:"7d",percent:clampPercent(payload.seven_day.utilization),resetsAt:parseResetsAtMs(payload.seven_day.resets_at)})}return{windows,capturedAt}}function parseCredentials(raw){try{let oauth=JSON.parse(raw)?.claudeAiOauth;if(!oauth||typeof oauth.accessToken!=="string"||!oauth.accessToken)return null;return{accessToken:oauth.accessToken,...typeof oauth.expiresAt==="number"&&Number.isFinite(oauth.expiresAt)?{expiresAt:oauth.expiresAt}:{}}}catch{return null}}var isFresh=(c)=>c.expiresAt===void 0||c.expiresAt>Date.now();async function readFileCredentials(dir){try{return parseCredentials(await readTextFileBounded(path.join(dir,".credentials.json")))}catch{return null}}async function readKeychainCredentials(){if(process.platform!=="darwin")return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),3000);try{let result=await spawnCapture("security",["find-generic-password","-a",userInfo().username,"-w","-s",KEYCHAIN_SERVICE],{cwd:homedir2(),signal:controller.signal});return result.status===0?parseCredentials(result.stdout.trim()):null}finally{clearTimeout(timeout)}}async function readAccessToken(){let configDir=process.env.CLAUDE_CONFIG_DIR?.trim();if(configDir){let fromFile=await readFileCredentials(configDir);return fromFile&&isFresh(fromFile)?fromFile.accessToken:null}return[await readKeychainCredentials(),await readFileCredentials(vendorConfigHome("claude"))].find((c)=>c!=null&&isFresh(c))?.accessToken??null}async function fetchClaudeQuotaUsage(now=Date.now){let token=await readAccessToken().catch(()=>null);if(!token)return null;let controller=new AbortController,timeout=setTimeout(()=>controller.abort(),USAGE_TIMEOUT_MS);try{let response=await fetch(OAUTH_USAGE_URL,{headers:{Authorization:`Bearer ${token}`,"Content-Type":"application/json","User-Agent":OAUTH_USER_AGENT,"anthropic-beta":OAUTH_BETA_HEADER},signal:controller.signal});if(!response.ok)return null;return usageFromClaudePayload(await response.json(),now())}catch{return null}finally{clearTimeout(timeout)}}var SERVER="rove-files",LOCAL_FILE_TOOLS="Read|Edit|Write|Glob|Grep|NotebookEdit";function claudeRemoteWorkspaceArgv(base,linkDir,self=resolveRoveSpawn,forwards=forwardedForLink){let shim=(verb)=>self(["remote-workspace",verb,"--dir",linkDir]),[command="",...args]=shim("mcp"),hook=(matcher,verb)=>({matcher,hooks:[{type:"command",command:quoteShellArgv(shim(verb))}]}),forwarded=forwards(linkDir),PreToolUse=[hook("Bash","bash-hook"),hook(LOCAL_FILE_TOOLS,"file-hook")];if(forwarded.length>0)PreToolUse.push(hook(forwarded.map((f)=>`mcp__${f.server}__.*`).join("|"),"mcp-hook"));let servers={[SERVER]:{command,args}};for(let f of forwarded)servers[f.server]={type:"http",url:f.url};return[...base,`--settings=${JSON.stringify({hooks:{PreToolUse}})}`,`--mcp-config=${JSON.stringify({mcpServers:servers})}`]}function forwardedForLink(linkDir){let ws=readRemoteWorkspace(linkDir);if(!ws)return[];let forwards=machineMcp(ws.machine);return ensureMcpForwards(ws.machine,forwards),forwards}function claudeRemoteNotes(ws){return["# This project lives on another machine","",`The project is not in this directory. It is on ${`the machine "${ws.machine}"${ws.system?` (${ws.system})`:""}`}, at \`${ws.path}\`. This directory only links to it, and the environment details you were given describe this machine, not that one.`,"","- Your Bash tool already runs every command there, in the project root. Use it as usual for git, tests, builds and searching (`rg`, `ls`, `find`).","- Each Bash call starts in the project root; a `cd` does not carry over to the next call.",`- Read and change files with the \`mcp__${SERVER}__read\`, \`mcp__${SERVER}__write\` and \`mcp__${SERVER}__edit\` tools. Paths are relative to the project root.`,"- Read, Edit, Write, Glob and Grep work on this machine only. Use them for files outside the project (your own notes, skills, attachments); they cannot see the project.",...whereThingsRun(ws,"- A Bash command that starts with `rove` stays on this machine: Rove and your task are here, so `rove api \u2026` reaches this Rove and takes this machine's paths. It runs here whole, so keep project commands out of that line."),""].join(`
|
|
4
4
|
`)}function isSyntheticClaudeRecord(record){return record.isMeta===!0||record.isCompactSummary===!0||record.type==="api-request-blob"}function isClaudeCommandBreadcrumb(blocks){if(blocks.length===0)return!1;for(let b of blocks){if(b.type!=="text")return!1;let t=b.text.trim();if(!t.startsWith("<command-name>")&&!t.startsWith("<command-message>")&&!t.startsWith("<local-command"))return!1}return!0}function isClaudeSystemReminder(block){if(block.type!=="text")return!1;let t=block.text.trim();return t.startsWith("<system-reminder>")&&t.endsWith("</system-reminder>")}function opensTurn(content){if(typeof content==="string")return content.trim().length>0;if(!Array.isArray(content))return!1;return content.some((b)=>!isObject(b)||b.type!=="tool_result")}function num(v){return typeof v==="number"&&Number.isFinite(v)?v:0}function readUsage(v){if(!isObject(v))return;return{input_tokens:num(v.input_tokens),output_tokens:num(v.output_tokens),cache_read_input_tokens:num(v.cache_read_input_tokens),cache_creation_input_tokens:num(v.cache_creation_input_tokens)}}function finish(draft){if(!draft.id)return null;let totals={input_tokens:0,output_tokens:0,cache_read_input_tokens:0,cache_creation_input_tokens:0};for(let u of draft.usageByMessage.values())totals.input_tokens+=u.input_tokens,totals.output_tokens+=u.output_tokens,totals.cache_read_input_tokens+=u.cache_read_input_tokens,totals.cache_creation_input_tokens+=u.cache_creation_input_tokens;return{id:draft.id,sessionId:draft.sessionId,...draft.model?{model:draft.model}:{},startedAt:draft.startedAt,endedAt:draft.endedAt,...draft.usageByMessage.size>0?{usage:totals}:{}}}function parseClaudeTurns(raw,fallbackSessionId=""){let out=[],draft=null;for(let line of raw.split(`
|
|
5
5
|
`)){let trimmed=line.trim();if(!trimmed||!isJsonlLineWithinBound(trimmed))continue;let record;try{record=JSON.parse(trimmed)}catch{continue}if(!isObject(record)||isSyntheticClaudeRecord(record))continue;let inner=isObject(record.message)?record.message:record,at=typeof record.timestamp==="string"?Date.parse(record.timestamp):Number.NaN;if(!Number.isFinite(at))continue;let sessionId=typeof record.sessionId==="string"?record.sessionId:fallbackSessionId;if(inner.role==="user"){if(!opensTurn(inner.content))continue;if(draft){let done=finish(draft);if(done)out.push(done)}draft={id:"",sessionId,startedAt:at,endedAt:at,usageByMessage:new Map};continue}if(inner.role!=="assistant"||!draft)continue;if(draft.endedAt=at,typeof inner.model==="string")draft.model=inner.model;let messageId=typeof inner.id==="string"?inner.id:"";if(messageId)draft.id=messageId;let usage=readUsage(inner.usage);if(usage&&messageId)draft.usageByMessage.set(messageId,usage)}if(draft){let done=finish(draft);if(done)out.push(done)}return out}async function readClaudeTurns(transcriptPath){try{let raw=await readTextFileBounded(transcriptPath);return parseClaudeTurns(raw)}catch{return[]}}var HEX_RE=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;function parseHex(value){let match=HEX_RE.exec(value);if(!match)return[0,0,0];return[Number.parseInt(match[1],16),Number.parseInt(match[2],16),Number.parseInt(match[3],16)]}function luminance([red,green,blue]){return(red*0.2126+green*0.7152+blue*0.0722)/255}function blend(from,to,amount){return[Math.round(from[0]+(to[0]-from[0])*amount),Math.round(from[1]+(to[1]-from[1])*amount),Math.round(from[2]+(to[2]-from[2])*amount)]}function codexUserMessageBackground(background){return luminance(background)>0.5?blend(background,[0,0,0],0.04):blend(background,[255,255,255],0.12)}function transcriptRewrite(palette){let foreground=parseHex(palette.foreground),background=parseHex(palette.background),backgroundIsLight=luminance(background)>0.5;return{matchBackground:codexUserMessageBackground(background),foreground:backgroundIsLight?foreground:background,background:backgroundIsLight?background:foreground}}var codexTerminalPresentation={alternateScreenStyleRewrites:(palette)=>[transcriptRewrite(palette)]};var codexCapabilities={preparePromptSubmission:(prompt)=>{return/^[\/!]/.test(prompt.trimStart())?prompt:`${prompt} `},beforePromptSubmit:"\x1B[F",terminalPresentation:codexTerminalPresentation,interruptSequence:"\x1B"},codexIdentity={shortName:"Codex"};import{join}from"path";var EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"Stop",verb:"turn-complete"},{event:"SessionEnd",verb:"session-end"},{event:"PreCompact",verb:"pre-compact"},{event:"PostCompact",verb:"post-compact"},{event:"SubagentStart",verb:"subagent-start"},{event:"SubagentStop",verb:"subagent-stop"},{event:"PreToolUse",verb:"tool-pre"},{event:"PostToolUse",verb:"tool-post"}],ROVE_CODEX_HOOK_EVENTS=EVENT_MAP.map((e)=>e.event);function codexHooksPath(){return join(vendorConfigHome("codex"),"hooks.json")}class CodexHookAdapter extends JsonHookAdapter{vendor="codex";setupCommand="/hooks";eventMap=EVENT_MAP;globalSettingsPath(){return codexHooksPath()}activityDetailFromPayload(kind,payload){if(kind==="tool-pre"||kind==="tool-post")return{tool:{...typeof payload.tool_name==="string"?{name:payload.tool_name}:{}}};if(kind==="pre-compact"||kind==="post-compact")return{compact:{trigger:payload.trigger==="manual"?"manual":"auto"}};return}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}}import{createHash}from"crypto";function createAppendParseCache(opts){let maxFiles=opts.maxFiles??8,cache=new Map;function remember(filePath,entry){if(cache.delete(filePath),cache.set(filePath,entry),cache.size>maxFiles){let oldest=cache.keys().next().value;if(oldest!==void 0)cache.delete(oldest)}}return function(filePath,raw,ctx){let stableLength=raw.lastIndexOf(`
|
|
6
6
|
`)+1,entry=cache.get(filePath),verifiedLength=Math.min(entry?.prefixLength??0,stableLength),hash=createHash("sha256").update(raw.slice(0,verifiedLength)),unchanged=entry!==void 0&&Object.is(entry.context,ctx)&&entry.prefixLength<=stableLength&&hash.copy().digest("hex")===entry.prefixHash,prefixState;if(unchanged)prefixState=entry.prefixLength<stableLength?opts.parseChunk(raw.slice(entry.prefixLength,stableLength),entry.state,ctx):entry.state;else prefixState=opts.parseChunk(raw.slice(0,stableLength),opts.initial(ctx),ctx);if(!unchanged||entry.prefixLength!==stableLength||entry.state!==prefixState)remember(filePath,{context:ctx,prefixLength:stableLength,prefixHash:hash.update(raw.slice(verifiedLength,stableLength)).digest("hex"),state:prefixState});let tail=raw.slice(stableLength);return tail.trim().length>0?opts.parseChunk(tail,prefixState,ctx):prefixState}}var sortedMessages=new WeakMap;function sortByTimestamp(messages){let hit=sortedMessages.get(messages);if(hit)return hit;let sorted=[...messages].sort((a,b)=>a.timestamp<b.timestamp?-1:a.timestamp>b.timestamp?1:0);return sortedMessages.set(messages,sorted),sorted}function normalizeCodexContent(raw){if(typeof raw==="string")return raw.length>0?[{type:"text",text:raw}]:[];if(!Array.isArray(raw))return[];let blocks=[];for(let item of raw){if(typeof item==="string"){if(item.length>0)blocks.push({type:"text",text:item});continue}if(!isObject(item))continue;let t=typeof item.type==="string"?item.type:void 0;if(t==="input_text"||t==="output_text"){let text=typeof item.text==="string"?item.text:"";if(text.length>0)blocks.push({type:"text",text});continue}if(t)blocks.push({type:"text",text:`[codex: ${t}]`})}return blocks}function isSyntheticCodexUserRow(blocks){if(blocks.length===0)return!1;for(let b of blocks){if(b.type!=="text")return!1;let t=(b.text??"").trim();if(!isTagEnvelope(t)&&!isInstructionsEnvelope(t))return!1}return!0}var ENVELOPE_TAGS=["environment_context","recommended_plugins","user_instructions"];function isTagEnvelope(text){return ENVELOPE_TAGS.some((tag)=>text.startsWith(`<${tag}>`)&&text.endsWith(`</${tag}>`))}function isInstructionsEnvelope(text){return text.startsWith("# AGENTS.md instructions")&&text.includes("<INSTRUCTIONS>")}function codexUsageToSnapshot(usage,opts={}){let totalInput=numberOr(usage.input_tokens,0),cachedInput=numberOr(usage.cached_input_tokens,0),output=numberOr(usage.output_tokens,0),nonCachedInput=Math.max(0,totalInput-cachedInput);if(totalInput<=0&&output<=0&&cachedInput<=0)return;return{input_tokens:nonCachedInput,output_tokens:output,...cachedInput>0?{cache_read_input_tokens:cachedInput}:{},...validPositive(opts.contextWindowTokens)?{context_window_tokens:opts.contextWindowTokens}:{}}}function numberOr(v,fallback){return typeof v==="number"&&Number.isFinite(v)?v:fallback}function validPositive(v){return typeof v==="number"&&Number.isFinite(v)&&v>0}var emptyState={messages:[],latestUsage:void 0,latestUsageTimestampMs:null},cache=createAppendParseCache({initial:()=>emptyState,parseChunk:foldRolloutChunk});function parseRolloutRaw(filePath,raw,sessionId){let state=cache(filePath,raw,sessionId);return{messages:sortByTimestamp(state.messages),...state.latestUsage?{usageMetrics:state.latestUsage}:{}}}function foldRolloutChunk(chunk,prev,sessionId){let updatedMessages,writableMessages=()=>{return updatedMessages??=[...prev.messages],updatedMessages},latestUsage=prev.latestUsage,latestUsageTimestampMs=prev.latestUsageTimestampMs;for(let line of chunk.split(`
|