@robota-sdk/agent-command 3.0.0-beta.73 → 3.0.0-beta.75

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.
Files changed (68) hide show
  1. package/dist/node/index.cjs +35 -34
  2. package/dist/node/index.d.ts +64 -3
  3. package/dist/node/index.d.ts.map +1 -1
  4. package/dist/node/index.js +34 -33
  5. package/dist/node/index.js.map +1 -1
  6. package/package.json +10 -8
  7. package/src/agent/agent-command-module.ts +1 -2
  8. package/src/agent/agent-command-parser.ts +1 -1
  9. package/src/agent/agent-command.ts +2 -5
  10. package/src/background/background-command-module.ts +2 -6
  11. package/src/background/background-command.ts +2 -1
  12. package/src/compact/compact-command-module.ts +2 -6
  13. package/src/compact/compact-command.ts +2 -1
  14. package/src/context/__tests__/context-command-module.test.ts +2 -2
  15. package/src/context/context-command-module.ts +2 -6
  16. package/src/context/context-command.ts +1 -2
  17. package/src/default/__tests__/default-command-modules.test.ts +97 -0
  18. package/src/default/default-command-modules.ts +42 -1
  19. package/src/exit/exit-command-module.ts +2 -3
  20. package/src/exit/exit-command.ts +2 -1
  21. package/src/help/__tests__/help-command.test.ts +2 -5
  22. package/src/help/help-command-module.ts +2 -6
  23. package/src/help/help-command.ts +2 -1
  24. package/src/index.ts +2 -0
  25. package/src/language/language-command-module.ts +2 -3
  26. package/src/language/language-command.ts +2 -1
  27. package/src/memory/memory-command-module.ts +2 -6
  28. package/src/memory/memory-command.ts +1 -2
  29. package/src/mode/__tests__/mode-command-module.test.ts +1 -1
  30. package/src/mode/mode-command-module.ts +2 -3
  31. package/src/mode/mode-command.ts +2 -1
  32. package/src/permissions/__tests__/permissions-command-module.test.ts +1 -1
  33. package/src/permissions/permissions-command-module.ts +2 -6
  34. package/src/permissions/permissions-command.ts +2 -1
  35. package/src/plugin/__tests__/plugin-command-module.test.ts +2 -5
  36. package/src/plugin/plugin-command-module.ts +2 -6
  37. package/src/plugin/plugin-command.ts +2 -5
  38. package/src/plugins/default-plugin-command-adapter.ts +2 -2
  39. package/src/preset/__tests__/preset-command-module.test.ts +138 -0
  40. package/src/preset/index.ts +6 -0
  41. package/src/preset/preset-command-module.ts +79 -0
  42. package/src/preset/preset-command.ts +58 -0
  43. package/src/provider/provider-command-execution.ts +1 -2
  44. package/src/provider/provider-command-module.ts +5 -3
  45. package/src/provider/provider-command-profile-lifecycle.ts +2 -5
  46. package/src/provider/provider-command-profile-operations.ts +2 -3
  47. package/src/provider/provider-command-profile.ts +1 -2
  48. package/src/provider/provider-command-setup.ts +7 -5
  49. package/src/provider/provider-startup.ts +14 -2
  50. package/src/reset/reset-command-module.ts +2 -6
  51. package/src/reset/reset-command.ts +2 -1
  52. package/src/rewind/rewind-command-module.ts +2 -6
  53. package/src/rewind/rewind-command.ts +1 -1
  54. package/src/schedule/__tests__/schedule-command.test.ts +107 -0
  55. package/src/schedule/index.ts +9 -0
  56. package/src/schedule/schedule-command-module.ts +102 -0
  57. package/src/schedule/schedule-command.ts +72 -0
  58. package/src/schedule/schedule-spec-parser.ts +66 -0
  59. package/src/session/session-command-module.ts +2 -3
  60. package/src/session/session-command.ts +2 -1
  61. package/src/settings/settings-command-module.ts +2 -6
  62. package/src/skills/skills-command-module.ts +2 -6
  63. package/src/skills/skills-command.ts +2 -5
  64. package/src/statusline/statusline-command-module.ts +2 -6
  65. package/src/statusline/statusline-command.ts +2 -2
  66. package/src/user-local/user-local-command-module.ts +2 -6
  67. package/src/user-local/user-local-command.ts +2 -1
  68. package/src/user-local/user-local-memory-command.ts +2 -1
@@ -1,28 +1,29 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@robota-sdk/agent-framework`),t=require(`@robota-sdk/agent-core`),n=require(`node:path`),r=require(`node:fs`),i=require(`node:child_process`),a=require(`node:os`);function o(e){let t=[],n=``,r,i=!1;for(let a of e){if(i){n+=a,i=!1;continue}if(r&&a===`\\`){i=!0;continue}if(r){a===r?r=void 0:n+=a;continue}if(a===`"`||a===`'`){r=a;continue}if(/\s/.test(a)){n.length>0&&(t.push(n),n=``);continue}n+=a}return n.length>0&&t.push(n),t}function s(e){let t=[],n,r,i;for(let a=0;a<e.length;a+=1){let o=e[a];if(o!==`--background`){if(o===`--agent`||o===`--type`||o===`-a`){n=e[a+1],a+=1;continue}if(o===`--model`){r=e[a+1],a+=1;continue}if(o===`--isolation`){let t=e[a+1];(t===`none`||t===`worktree`)&&(i=t),a+=1;continue}o!==void 0&&t.push(o)}}return{positional:t,...n?{agentType:n}:{},...r?{model:r}:{},...i?{isolation:i}:{}}}function c(e,t,n,r){return{agentType:t,label:n,mode:`background`,prompt:r,...e.model?{model:e.model}:{},...e.isolation?{isolation:e.isolation}:{}}}function l(e,t){let n=s(e),[r,...i]=n.positional,a=n.agentType??`general-purpose`,o=n.positional;!n.agentType&&r&&t.has(r)&&(a=r,o=i);let l=o.join(` `).trim();if(l)return c(n,a,a,l)}function u(e,t){let n=s(e);return n.positional.map(e=>ee(e,n,t)).filter(e=>e!==void 0)}function ee(e,t,n){let r=e.indexOf(`=`);if(r>0)return te(e.slice(0,r),e.slice(r+1),t,n);let i=e.indexOf(`:`);if(i<=0||i===e.length-1)return;let a=e.slice(0,i),o=e.slice(i+1);return c(t,t.agentType??(n.has(a)?a:`general-purpose`),a,o)}function te(e,t,n,r){let i=t.indexOf(`:`);if(i===-1)return c(n,n.agentType??(r.has(e)?e:`general-purpose`),e,t);if(!(i===0||i===t.length-1))return c(n,t.slice(0,i),e,t.slice(i+1))}function d(e){return e instanceof Error?e.message:String(e)}function f(e){return new Set(e.listAgentDefinitions().map(e=>e.name))}function p(e,t){let n=e.listAgentDefinitions();if(!n.some(e=>e.name===t))return{message:`Unknown agent type: ${t}\nAvailable agents: ${n.map(e=>e.name).join(`, `)}`,success:!1}}async function m(e,t){let n=p(e,t.agentType);if(n)return n;try{return{state:await e.spawnAgentJob(t)}}catch(e){return{message:d(e),success:!1}}}function h(){return{message:``,effects:[{type:`agent-switcher-requested`}],success:!0}}async function g(e){let t=e.listAgentDefinitions(),n=e.listAgentJobs();return{message:[`Available agents:`,...t.map(e=>` ${e.name} - ${e.description}`),``,n.length===0?`No active agent jobs.`:`Agent jobs:`,...n.map(e=>` ${ne(e)}`)].join(`
2
- `),success:!0,data:{agents:t.length,jobs:n.length}}}function ne(e){let t=[e.worktreePath?`worktree=${e.worktreePath}`:void 0,e.branchName?`branch=${e.branchName}`:void 0].filter(e=>e!==void 0),n=t.length>0?` ${t.join(` `)}`:``;return`${e.id} [${e.status}${n}] ${e.label} - ${e.promptPreview}`}async function re(e,t){let n=l(t,f(e));if(!n)return{message:`Usage: agent run [AGENT_NAME] [--agent AGENT_NAME] PROMPT`,success:!1};let r=await m(e,n);if(`success`in r)return r;let{state:i}=r;return{message:`Started agent job: ${i.id}`,success:!0,data:{agentId:i.id,status:i.status}}}async function ie(t,n){let r=n.includes(`--wait`)||!n.includes(`--detach`),i=u(n.filter(e=>e!==`--wait`&&e!==`--detach`),f(t));if(i.length===0)return{message:`Usage: agent parallel [--wait|--detach] LABEL:"PROMPT" [LABEL=AGENT_NAME:"PROMPT"]`,success:!1};let a=i.map(e=>p(t,e.agentType)).find(e=>e!==void 0);if(a)return a;let o;try{o=await Promise.all(i.map(e=>t.spawnAgentJob(e)))}catch(e){return{message:d(e),success:!1}}let s=t.createBackgroundJobGroup({waitPolicy:`wait_all`,taskIds:o.map(e=>e.id),label:`agent parallel`});if(r){let n=(0,e.summarizeBackgroundJobGroup)(await t.waitBackgroundJobGroup(s.id));return{message:de(n),success:!0,data:{agentIds:o.map(e=>e.id),groupId:s.id,summary:n}}}return{message:[`Started agent jobs:`,...o.map(e=>`${e.label}: ${e.id}`)].join(`
3
- `),success:!0,data:{agentIds:o.map(e=>e.id),groupId:s.id}}}async function ae(t,n){let[r]=n;if(!r)return{message:`Usage: agent wait GROUP_ID`,success:!1};let i=(0,e.summarizeBackgroundJobGroup)(await t.waitBackgroundJobGroup(r));return{message:de(i),success:!0,data:{groupId:r,summary:i}}}async function oe(e,t){let[n,r]=t;if(!n)return{message:`Usage: agent read AGENT_ID [OFFSET]`,success:!1};let i=r?{offset:Number.parseInt(r,10)}:void 0,a=await e.readBackgroundTaskLog(n,i),o=a.nextCursor?`\nNext offset: ${a.nextCursor.offset}`:``;return{message:a.lines.length>0?`${a.lines.join(`
4
- `)}${o}`:`No log lines: ${n}`,success:!0,data:{agentId:n,nextOffset:a.nextCursor?.offset}}}async function se(e,t){let[n,...r]=t,i=r.join(` `).trim();return!n||!i?{message:`Usage: agent send AGENT_ID PROMPT`,success:!1}:(await e.sendAgentJob(n,i),{message:`Sent input to agent job: ${n}`,success:!0,data:{agentId:n}})}async function ce(e,t){let[n,...r]=t;return n?(await e.cancelAgentJob(n,r.join(` `)||void 0),{message:`Agent job stopped: ${n}`,success:!0,data:{agentId:n}}):{message:`Usage: agent stop AGENT_ID [REASON]`,success:!1}}async function le(e,t){let[n]=t;return n?(await e.closeAgentJob(n),{message:`Agent job closed: ${n}`,success:!0,data:{agentId:n}}):{message:`Usage: agent close AGENT_ID`,success:!1}}async function ue(e,t){try{if(t.trim()===``)return h();let[n=`list`,...r]=o(t);return n===`list`&&r.length===0?g(e):n===`run`?re(e,r):n===`parallel`?ie(e,r):n===`wait`?ae(e,r):n===`read`||n===`open`?oe(e,r):n===`send`?se(e,r):n===`stop`||n===`cancel`?ce(e,r):n===`close`?le(e,r):re(e,[n,...r])}catch(e){return{message:d(e),success:!1}}}function de(e){return[`Background job group ${e.groupId}: ${e.status} (${e.completed}/${e.total} completed, ${e.failed} failed, ${e.cancelled} cancelled, ${e.pending} pending)`,...e.lines].join(`
5
- `)}function fe(e){let t=e.getAgentJobCapability?.();if(!t)throw Error(`Agent job capability is not available in this context.`);return t}function pe(){return[{name:`list`,description:`List available agents and active jobs`,source:`agent`},{name:`run`,description:`Start one background agent job`,source:`agent`},{name:`parallel`,description:`Run multiple agents in parallel`,source:`agent`},{name:`wait`,description:`Wait for a background agent group summary`,source:`agent`},{name:`read`,description:`Read an agent job log page`,source:`agent`},{name:`send`,description:`Send follow-up input to an agent job`,source:`agent`},{name:`stop`,description:`Cancel a running agent job`,source:`agent`},{name:`close`,description:`Dismiss a terminal agent job`,source:`agent`},{name:`open`,description:`Focus an agent job detail view when supported`,source:`agent`}]}function _(){return{name:`agent`,displayName:`Agent Jobs`,description:[`Subagent jobs command.`,`Natural-language arguments start one background agent job.`,`When the user explicitly asks to create, run, spawn, delegate to, or use agents/subagents, start the requested agent command immediately and do not ask a follow-up question unless execution is impossible or unsafe.`,`If the target item is unspecified, include target selection inside the agent prompt instead of delaying execution.`,`The parallel form starts multiple background agent jobs as a wait_all group and returns a consolidated group summary unless --detach is present.`,`list, wait, read, send, stop, close, and open manage existing agent jobs.`].join(` `),source:`agent`,modelInvocable:!0,argumentHint:`PROMPT | AGENT_NAME PROMPT | list | parallel [--wait|--detach] LABEL:"PROMPT" [LABEL=AGENT_NAME:"PROMPT"] | wait GROUP_ID | read AGENT_ID [OFFSET] | send AGENT_ID PROMPT | stop AGENT_ID | close AGENT_ID`,safety:`background-agent`,subcommands:pe()}}function me(){let e=_();return{name:e.name,...e.displayName===void 0?{}:{displayName:e.displayName},description:e.description,requiresPermission:!1,execute:(e,t)=>ue(fe(e),t),...e.modelInvocable===void 0?{}:{modelInvocable:e.modelInvocable},...e.userInvocable===void 0?{}:{userInvocable:e.userInvocable},...e.argumentHint===void 0?{}:{argumentHint:e.argumentHint},...e.safety===void 0?{}:{safety:e.safety}}}var he=class{name=`agent`;getCommands(){return[_()]}};function ge(){return{name:`agent-command-agent`,commandSources:[new he],systemCommands:[me()],sessionRequirements:[`agent-runtime`]}}function _e(e){return e.trim().split(/\s+/).filter(Boolean)}async function ve(t,n){let[r=`list`,i,...a]=_e(n);if(r===`list`){let n=(0,e.listCommandBackgroundTasks)(t);return{message:(0,e.formatCommandBackgroundTaskList)(n),success:!0,data:{count:n.length}}}if(!i)return{message:e.BACKGROUND_COMMAND_USAGE,success:!1};if(r===`read`||r===`log`||r===`open`){let n=await(0,e.readCommandBackgroundTaskLog)(t,i,(0,e.parseCommandBackgroundLogCursor)(a[0])),r=n.nextCursor?`\nNext offset: ${n.nextCursor.offset}`:``;return{message:n.lines.length>0?`${n.lines.join(`
6
- `)}${r}`:`No log lines: ${i}`,success:!0,data:{taskId:i,nextOffset:n.nextCursor?.offset}}}return r===`cancel`||r===`stop`?(await(0,e.cancelCommandBackgroundTask)(t,i,a.join(` `)||void 0),{message:`Background task cancelled: ${i}`,success:!0,data:{taskId:i}}):r===`close`||r===`dismiss`?(await(0,e.closeCommandBackgroundTask)(t,i),{message:`Background task closed: ${i}`,success:!0,data:{taskId:i}}):{message:`Unknown background action: ${r}`,success:!1}}function v(){return{name:`background`,displayName:`Background Tasks`,description:e.BACKGROUND_COMMAND_DESCRIPTION,source:`background`,modelInvocable:!1,subcommands:(0,e.buildBackgroundCommandSubcommands)()}}function ye(){let e=v();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,subcommands:e.subcommands,execute:ve}}var be=class{name=`background`;getCommands(){return[v()]}};function xe(){return{name:`agent-command-background`,commandSources:[new be],systemCommands:[ye()]}}function Se(e){let t=e.trim();return t.length>0?t:void 0}async function Ce(t,n){let{before:r,after:i,beforeMessageCount:a,afterMessageCount:o}=await(0,e.compactCommandContext)(t,Se(n)),s=a-o;return{message:[`Context compacted.`,` Removed messages: ${s} (${a>0?Math.round(s/a*100):0}% of total)`,` Context: ${Math.round(r.usedPercentage)}% → ${Math.round(i.usedPercentage)}%`].join(`
7
- `),success:!0,data:{before:r,after:i,beforeMessageCount:a,afterMessageCount:o}}}function y(){return{name:`compact`,displayName:`Compact Context`,description:`Compress context window`,source:`compact`,modelInvocable:!0,argumentHint:`[instructions]`,safety:`write`,example:`/compact Summarize the current context`}}function we(){let e=y();return{name:e.name,displayName:e.displayName,description:e.description,example:e.example,requiresPermission:!1,userInvocable:!0,modelInvocable:e.modelInvocable,argumentHint:e.argumentHint,safety:e.safety,lifecycle:`blocking`,execute:Ce}}var Te=class{name=`compact`;getCommands(){return[y()]}};function Ee(){return{name:`agent-command-compact`,commandSources:[new Te],systemCommands:[we()]}}const b=[`Usage: /context [list] | add <path> | remove <path> | clear | auto on | off | <percent> | reset`,`Examples: /context list, /context add AGENTS.md, /context remove AGENTS.md, /context auto 85%`].join(`
8
- `);function x(e){return e===!1?`disabled`:`${Math.round(e*100)}%`}function S(e,t){return e===!1?`Auto compact: disabled (${t})`:`Auto compact: ${x(e)} (${t})`}function De(e){return e?`settings`:`current session only`}async function Oe(t,n){let r=n.trim().split(/\s+/).filter(e=>e.length>0);if(r.length>0)return ke(t,r);let i=(0,e.readCommandContextState)(t),a=(0,e.readAutoCompactThreshold)(t),o=(0,e.readAutoCompactThresholdSource)(t),s=ze(t.getSession().getFullHistory()),c=(0,e.listCommandContextReferences)(t);return{message:[`Context: ${i.usedTokens.toLocaleString()} / ${i.maxTokens.toLocaleString()} tokens (${Math.round(i.usedPercentage)}%)`,S(a,o),Fe(c),`History: ${s.turnCount} turn${s.turnCount===1?``:`s`}`].join(`
9
- `),success:!0,data:{usedTokens:i.usedTokens,maxTokens:i.maxTokens,percentage:i.usedPercentage,autoCompactThreshold:a,autoCompactThresholdSource:o,references:c}}}async function ke(t,n){let[r,...i]=n;if(r===`list`)return i.length>0?{success:!1,message:b}:Be(t);if(r===`add`)return je(t,i);if(r===`remove`)return Me(t,i);if(r===`clear`){if(i.length>0)return{success:!1,message:b};let n=(0,e.clearCommandContextReferences)(t);return{success:!0,message:`Context references cleared: ${n.removed.length} removed.`,data:{removed:n.removed}}}return r===`auto`?Ae(t,i):{success:!1,message:b}}function Ae(t,n){let[r,i]=n;if(i!==void 0)return{success:!1,message:b};if(r===void 0){let n=(0,e.readAutoCompactThreshold)(t),r=(0,e.readAutoCompactThresholdSource)(t);return{success:!0,message:[S(n,r),b].join(`
10
- `),data:{autoCompactThreshold:n,autoCompactThresholdSource:r}}}if(r===`on`)return C(t,e.DEFAULT_AUTO_COMPACT_THRESHOLD,`enabled`);if(r===`off`)return C(t,!1,`disabled`);if(r===`reset`){let n=(0,e.resetAutoCompactThresholdSetting)(t);return(0,e.setCommandAutoCompactThreshold)(t,e.DEFAULT_AUTO_COMPACT_THRESHOLD,`default`),{success:!0,message:`Auto compact reset to default: ${x(e.DEFAULT_AUTO_COMPACT_THRESHOLD)} (${De(n)}).`,data:{autoCompactThreshold:e.DEFAULT_AUTO_COMPACT_THRESHOLD,autoCompactThresholdSource:`default`,persisted:n}}}let a=Pe(r);return a.success?C(t,a.threshold,`threshold set`):{success:!1,message:`${a.message}\n${b}`}}async function je(t,n){let r=n.join(` `).trim();if(!r)return{success:!1,message:b};let i=await(0,e.addCommandContextReference)(t,r);return i.reference?{success:!0,message:[`Context reference added: ${T(i.reference)}.`,...i.evicted.length>0?[`Evicted ${i.evicted.length} older context reference(s).`]:[]].join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@robota-sdk/agent-framework"),t=require("@robota-sdk/agent-preset"),n=require("@robota-sdk/agent-core"),r=require("node:path"),i=require("node:fs"),a=require("node:child_process"),o=require("node:os");const s=`general-purpose`;function c(e){let t=[],n=``,r,i=!1;for(let a of e){if(i){n+=a,i=!1;continue}if(r&&a===`\\`){i=!0;continue}if(r){a===r?r=void 0:n+=a;continue}if(a===`"`||a===`'`){r=a;continue}if(/\s/.test(a)){n.length>0&&(t.push(n),n=``);continue}n+=a}return n.length>0&&t.push(n),t}function l(e){let t=[],n,r,i;for(let a=0;a<e.length;a+=1){let o=e[a];if(o!==`--background`){if(o===`--agent`||o===`--type`||o===`-a`){n=e[a+1],a+=1;continue}if(o===`--model`){r=e[a+1],a+=1;continue}if(o===`--isolation`){let t=e[a+1];(t===`none`||t===`worktree`)&&(i=t),a+=1;continue}o!==void 0&&t.push(o)}}return{positional:t,...n?{agentType:n}:{},...r?{model:r}:{},...i?{isolation:i}:{}}}function u(e,t,n,r){return{agentType:t,label:n,mode:`background`,prompt:r,...e.model?{model:e.model}:{},...e.isolation?{isolation:e.isolation}:{}}}function ee(e,t){let n=l(e),[r,...i]=n.positional,a=n.agentType??s,o=n.positional;!n.agentType&&r&&t.has(r)&&(a=r,o=i);let c=o.join(` `).trim();if(c)return u(n,a,a,c)}function te(e,t){let n=l(e);return n.positional.map(e=>ne(e,n,t)).filter(e=>e!==void 0)}function ne(e,t,n){let r=e.indexOf(`=`);if(r>0)return d(e.slice(0,r),e.slice(r+1),t,n);let i=e.indexOf(`:`);if(i<=0||i===e.length-1)return;let a=e.slice(0,i),o=e.slice(i+1);return u(t,t.agentType??(n.has(a)?a:s),a,o)}function d(e,t,n,r){let i=t.indexOf(`:`);if(i===-1)return u(n,n.agentType??(r.has(e)?e:s),e,t);if(!(i===0||i===t.length-1))return u(n,t.slice(0,i),e,t.slice(i+1))}function f(e){return e instanceof Error?e.message:String(e)}function p(e){return new Set(e.listAgentDefinitions().map(e=>e.name))}function m(e,t){let n=e.listAgentDefinitions();if(!n.some(e=>e.name===t))return{message:`Unknown agent type: ${t}\nAvailable agents: ${n.map(e=>e.name).join(`, `)}`,success:!1}}async function h(e,t){let n=m(e,t.agentType);if(n)return n;try{return{state:await e.spawnAgentJob(t)}}catch(e){return{message:f(e),success:!1}}}function re(){return{message:``,effects:[{type:`agent-switcher-requested`}],success:!0}}async function ie(e){let t=e.listAgentDefinitions(),n=e.listAgentJobs();return{message:[`Available agents:`,...t.map(e=>` ${e.name} - ${e.description}`),``,n.length===0?`No active agent jobs.`:`Agent jobs:`,...n.map(e=>` ${ae(e)}`)].join(`
2
+ `),success:!0,data:{agents:t.length,jobs:n.length}}}function ae(e){let t=[e.worktreePath?`worktree=${e.worktreePath}`:void 0,e.branchName?`branch=${e.branchName}`:void 0].filter(e=>e!==void 0),n=t.length>0?` ${t.join(` `)}`:``;return`${e.id} [${e.status}${n}] ${e.label} - ${e.promptPreview}`}async function oe(e,t){let n=ee(t,p(e));if(!n)return{message:`Usage: agent run [AGENT_NAME] [--agent AGENT_NAME] PROMPT`,success:!1};let r=await h(e,n);if(`success`in r)return r;let{state:i}=r;return{message:`Started agent job: ${i.id}`,success:!0,data:{agentId:i.id,status:i.status}}}async function se(t,n){let r=n.includes(`--wait`)||!n.includes(`--detach`),i=te(n.filter(e=>e!==`--wait`&&e!==`--detach`),p(t));if(i.length===0)return{message:`Usage: agent parallel [--wait|--detach] LABEL:"PROMPT" [LABEL=AGENT_NAME:"PROMPT"]`,success:!1};let a=i.map(e=>m(t,e.agentType)).find(e=>e!==void 0);if(a)return a;let o;try{o=await Promise.all(i.map(e=>t.spawnAgentJob(e)))}catch(e){return{message:f(e),success:!1}}let s=t.createBackgroundJobGroup({waitPolicy:`wait_all`,taskIds:o.map(e=>e.id),label:`agent parallel`});if(r){let n=(0,e.summarizeBackgroundJobGroup)(await t.waitBackgroundJobGroup(s.id));return{message:me(n),success:!0,data:{agentIds:o.map(e=>e.id),groupId:s.id,summary:n}}}return{message:[`Started agent jobs:`,...o.map(e=>`${e.label}: ${e.id}`)].join(`
3
+ `),success:!0,data:{agentIds:o.map(e=>e.id),groupId:s.id}}}async function ce(t,n){let[r]=n;if(!r)return{message:`Usage: agent wait GROUP_ID`,success:!1};let i=(0,e.summarizeBackgroundJobGroup)(await t.waitBackgroundJobGroup(r));return{message:me(i),success:!0,data:{groupId:r,summary:i}}}async function le(e,t){let[n,r]=t;if(!n)return{message:`Usage: agent read AGENT_ID [OFFSET]`,success:!1};let i=r?{offset:Number.parseInt(r,10)}:void 0,a=await e.readBackgroundTaskLog(n,i),o=a.nextCursor?`\nNext offset: ${a.nextCursor.offset}`:``;return{message:a.lines.length>0?`${a.lines.join(`
4
+ `)}${o}`:`No log lines: ${n}`,success:!0,data:{agentId:n,nextOffset:a.nextCursor?.offset}}}async function ue(e,t){let[n,...r]=t,i=r.join(` `).trim();return!n||!i?{message:`Usage: agent send AGENT_ID PROMPT`,success:!1}:(await e.sendAgentJob(n,i),{message:`Sent input to agent job: ${n}`,success:!0,data:{agentId:n}})}async function de(e,t){let[n,...r]=t;return n?(await e.cancelAgentJob(n,r.join(` `)||void 0),{message:`Agent job stopped: ${n}`,success:!0,data:{agentId:n}}):{message:`Usage: agent stop AGENT_ID [REASON]`,success:!1}}async function fe(e,t){let[n]=t;return n?(await e.closeAgentJob(n),{message:`Agent job closed: ${n}`,success:!0,data:{agentId:n}}):{message:`Usage: agent close AGENT_ID`,success:!1}}async function pe(e,t){try{if(t.trim()===``)return re();let[n=`list`,...r]=c(t);return n===`list`&&r.length===0?ie(e):n===`run`?oe(e,r):n===`parallel`?se(e,r):n===`wait`?ce(e,r):n===`read`||n===`open`?le(e,r):n===`send`?ue(e,r):n===`stop`||n===`cancel`?de(e,r):n===`close`?fe(e,r):oe(e,[n,...r])}catch(e){return{message:f(e),success:!1}}}function me(e){return[`Background job group ${e.groupId}: ${e.status} (${e.completed}/${e.total} completed, ${e.failed} failed, ${e.cancelled} cancelled, ${e.pending} pending)`,...e.lines].join(`
5
+ `)}function he(e){let t=e.getAgentJobCapability?.();if(!t)throw Error(`Agent job capability is not available in this context.`);return t}function ge(){return[{name:`list`,description:`List available agents and active jobs`,source:`agent`},{name:`run`,description:`Start one background agent job`,source:`agent`},{name:`parallel`,description:`Run multiple agents in parallel`,source:`agent`},{name:`wait`,description:`Wait for a background agent group summary`,source:`agent`},{name:`read`,description:`Read an agent job log page`,source:`agent`},{name:`send`,description:`Send follow-up input to an agent job`,source:`agent`},{name:`stop`,description:`Cancel a running agent job`,source:`agent`},{name:`close`,description:`Dismiss a terminal agent job`,source:`agent`},{name:`open`,description:`Focus an agent job detail view when supported`,source:`agent`}]}function g(){return{name:`agent`,displayName:`Agent Jobs`,description:[`Subagent jobs command.`,`Natural-language arguments start one background agent job.`,`When the user explicitly asks to create, run, spawn, delegate to, or use agents/subagents, start the requested agent command immediately and do not ask a follow-up question unless execution is impossible or unsafe.`,`If the target item is unspecified, include target selection inside the agent prompt instead of delaying execution.`,`The parallel form starts multiple background agent jobs as a wait_all group and returns a consolidated group summary unless --detach is present.`,`list, wait, read, send, stop, close, and open manage existing agent jobs.`].join(` `),source:`agent`,modelInvocable:!0,argumentHint:`PROMPT | AGENT_NAME PROMPT | list | parallel [--wait|--detach] LABEL:"PROMPT" [LABEL=AGENT_NAME:"PROMPT"] | wait GROUP_ID | read AGENT_ID [OFFSET] | send AGENT_ID PROMPT | stop AGENT_ID | close AGENT_ID`,safety:`background-agent`,subcommands:ge()}}function _e(){let e=g();return{name:e.name,...e.displayName===void 0?{}:{displayName:e.displayName},description:e.description,requiresPermission:!1,execute:(e,t)=>pe(he(e),t),...e.modelInvocable===void 0?{}:{modelInvocable:e.modelInvocable},...e.userInvocable===void 0?{}:{userInvocable:e.userInvocable},...e.argumentHint===void 0?{}:{argumentHint:e.argumentHint},...e.safety===void 0?{}:{safety:e.safety}}}var ve=class{name=`agent`;getCommands(){return[g()]}};function ye(){return{name:`agent-command-agent`,commandSources:[new ve],systemCommands:[_e()],sessionRequirements:[`agent-runtime`]}}function be(e){return e.trim().split(/\s+/).filter(Boolean)}async function xe(t,n){let[r=`list`,i,...a]=be(n);if(r===`list`){let n=(0,e.listCommandBackgroundTasks)(t);return{message:(0,e.formatCommandBackgroundTaskList)(n),success:!0,data:{count:n.length}}}if(!i)return{message:e.BACKGROUND_COMMAND_USAGE,success:!1};if(r===`read`||r===`log`||r===`open`){let n=await(0,e.readCommandBackgroundTaskLog)(t,i,(0,e.parseCommandBackgroundLogCursor)(a[0])),r=n.nextCursor?`\nNext offset: ${n.nextCursor.offset}`:``;return{message:n.lines.length>0?`${n.lines.join(`
6
+ `)}${r}`:`No log lines: ${i}`,success:!0,data:{taskId:i,nextOffset:n.nextCursor?.offset}}}return r===`cancel`||r===`stop`?(await(0,e.cancelCommandBackgroundTask)(t,i,a.join(` `)||void 0),{message:`Background task cancelled: ${i}`,success:!0,data:{taskId:i}}):r===`close`||r===`dismiss`?(await(0,e.closeCommandBackgroundTask)(t,i),{message:`Background task closed: ${i}`,success:!0,data:{taskId:i}}):{message:`Unknown background action: ${r}`,success:!1}}function Se(){return{name:`background`,displayName:`Background Tasks`,description:e.BACKGROUND_COMMAND_DESCRIPTION,source:`background`,modelInvocable:!1,subcommands:(0,e.buildBackgroundCommandSubcommands)()}}function Ce(){let e=Se();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,subcommands:e.subcommands,execute:xe}}var we=class{name=`background`;getCommands(){return[Se()]}};function Te(){return{name:`agent-command-background`,commandSources:[new we],systemCommands:[Ce()]}}function Ee(e){let t=e.trim();return t.length>0?t:void 0}async function De(t,n){let{before:r,after:i,beforeMessageCount:a,afterMessageCount:o}=await(0,e.compactCommandContext)(t,Ee(n)),s=a-o;return{message:[`Context compacted.`,` Removed messages: ${s} (${a>0?Math.round(s/a*100):0}% of total)`,` Context: ${Math.round(r.usedPercentage)}% → ${Math.round(i.usedPercentage)}%`].join(`
7
+ `),success:!0,data:{before:r,after:i,beforeMessageCount:a,afterMessageCount:o}}}function Oe(){return{name:`compact`,displayName:`Compact Context`,description:`Compress context window`,source:`compact`,modelInvocable:!0,argumentHint:`[instructions]`,safety:`write`,example:`/compact Summarize the current context`}}function ke(){let e=Oe();return{name:e.name,displayName:e.displayName,description:e.description,example:e.example,requiresPermission:!1,userInvocable:!0,modelInvocable:e.modelInvocable,argumentHint:e.argumentHint,safety:e.safety,lifecycle:`blocking`,execute:De}}var Ae=class{name=`compact`;getCommands(){return[Oe()]}};function je(){return{name:`agent-command-compact`,commandSources:[new Ae],systemCommands:[ke()]}}const _=[`Usage: /context [list] | add <path> | remove <path> | clear | auto on | off | <percent> | reset`,`Examples: /context list, /context add AGENTS.md, /context remove AGENTS.md, /context auto 85%`].join(`
8
+ `);function v(e){return e===!1?`disabled`:`${Math.round(e*100)}%`}function y(e,t){return e===!1?`Auto compact: disabled (${t})`:`Auto compact: ${v(e)} (${t})`}function Me(e){return e?`settings`:`current session only`}async function Ne(t,n){let r=n.trim().split(/\s+/).filter(e=>e.length>0);if(r.length>0)return Pe(t,r);let i=(0,e.readCommandContextState)(t),a=(0,e.readAutoCompactThreshold)(t),o=(0,e.readAutoCompactThresholdSource)(t),s=We(t.getSession().getFullHistory()),c=(0,e.listCommandContextReferences)(t);return{message:[`Context: ${i.usedTokens.toLocaleString()} / ${i.maxTokens.toLocaleString()} tokens (${Math.round(i.usedPercentage)}%)`,y(a,o),Be(c),`History: ${s.turnCount} turn${s.turnCount===1?``:`s`}`].join(`
9
+ `),success:!0,data:{usedTokens:i.usedTokens,maxTokens:i.maxTokens,percentage:i.usedPercentage,autoCompactThreshold:a,autoCompactThresholdSource:o,references:c}}}async function Pe(t,n){let[r,...i]=n;if(r===`list`)return i.length>0?{success:!1,message:_}:Ge(t);if(r===`add`)return Ie(t,i);if(r===`remove`)return Le(t,i);if(r===`clear`){if(i.length>0)return{success:!1,message:_};let n=(0,e.clearCommandContextReferences)(t);return{success:!0,message:`Context references cleared: ${n.removed.length} removed.`,data:{removed:n.removed}}}return r===`auto`?Fe(t,i):{success:!1,message:_}}function Fe(t,n){let[r,i]=n;if(i!==void 0)return{success:!1,message:_};if(r===void 0){let n=(0,e.readAutoCompactThreshold)(t),r=(0,e.readAutoCompactThresholdSource)(t);return{success:!0,message:[y(n,r),_].join(`
10
+ `),data:{autoCompactThreshold:n,autoCompactThresholdSource:r}}}if(r===`on`)return b(t,e.DEFAULT_AUTO_COMPACT_THRESHOLD,`enabled`);if(r===`off`)return b(t,!1,`disabled`);if(r===`reset`){let n=(0,e.resetAutoCompactThresholdSetting)(t);return(0,e.setCommandAutoCompactThreshold)(t,e.DEFAULT_AUTO_COMPACT_THRESHOLD,`default`),{success:!0,message:`Auto compact reset to default: ${v(e.DEFAULT_AUTO_COMPACT_THRESHOLD)} (${Me(n)}).`,data:{autoCompactThreshold:e.DEFAULT_AUTO_COMPACT_THRESHOLD,autoCompactThresholdSource:`default`,persisted:n}}}let a=ze(r);return a.success?b(t,a.threshold,`threshold set`):{success:!1,message:`${a.message}\n${_}`}}async function Ie(t,n){let r=n.join(` `).trim();if(!r)return{success:!1,message:_};let i=await(0,e.addCommandContextReference)(t,r);return i.reference?{success:!0,message:[`Context reference added: ${S(i.reference)}.`,...i.evicted.length>0?[`Evicted ${i.evicted.length} older context reference(s).`]:[]].join(`
11
11
  `),data:{reference:i.reference,evicted:i.evicted}}:{success:!1,message:i.diagnostics.join(`
12
- `)||`Context reference not found: ${r}`,data:{diagnostics:i.diagnostics}}}function Me(t,n){let r=n.join(` `).trim();if(!r)return{success:!1,message:b};let i=(0,e.removeCommandContextReference)(t,r);return i.removed?{success:!0,message:`Context reference removed: ${T(i.removed)}.`,data:{removed:i.removed}}:{success:!1,message:`Context reference not found: ${r}`}}function C(t,n,r){let i=(0,e.writeAutoCompactThresholdSetting)(t,n),a=i?`settings`:`session`;return(0,e.setCommandAutoCompactThreshold)(t,n,a),{success:!0,message:Ne(r,n,i),data:{autoCompactThreshold:n,autoCompactThresholdSource:a,persisted:i}}}function Ne(e,t,n){let r=De(n);return e===`disabled`?`Auto compact disabled (${r}).`:e===`enabled`?`Auto compact enabled at ${x(t)} (${r}).`:`Auto compact threshold set to ${x(t)} (${r}).`}function Pe(e){if(e.endsWith(`%`)){let t=Number(e.slice(0,-1));return!Number.isFinite(t)||t<=0||t>100?{success:!1,message:`Auto compact percentage must be greater than 0% and at most 100%.`}:{success:!0,threshold:t/100}}if(e.includes(`.`)){let t=Number(e);return!Number.isFinite(t)||t<=0||t>1?{success:!1,message:`Auto compact fraction must be greater than 0 and at most 1.`}:{success:!0,threshold:t}}return{success:!1,message:`Use a percentage such as 85% or a fraction such as 0.85.`}}function Fe(e){return`References: ${e.filter(e=>e.status===`active`).length} active, ${e.filter(e=>e.status===`observed`).length} observed`}function w(e){return Math.ceil(e/4)}function T(e){return[e.relativePath,`[${e.loadType}, ${e.status}]`,`~${w(e.byteLength).toLocaleString()} tokens`].join(` `)}function Ie(e){try{return JSON.parse(e)}catch{return null}}function Le(e){let t=Ie(e);if(t===null)return``;let n=Object.values(t)[0],r=typeof n==`string`?n:JSON.stringify(n);return r.length>60?`${r.slice(0,60)}…`:r}function Re(e){let t=0,n=0,r=0,i=0,a=0,o=0,s=0;for(let c of e){let e=Math.ceil(JSON.stringify(c).length/4);c.role===`system`?t+=e:c.role===`user`?(n+=e,r++):c.role===`assistant`?(i+=e,a++):c.role===`tool`&&(o+=e,s++)}return{systemTokens:t,userTokens:n,userCount:r,assistantTokens:i,assistantCount:a,toolTokens:o,toolCallCount:s,totalTokens:t+n+i+o}}function ze(e){let t=new Map;for(let n of e){if(n.category!==`chat`||n.type!==`assistant`)continue;let e=n.data;for(let n of e.toolCalls??[])t.set(n.id,{name:n.function.name,firstArg:Le(n.function.arguments)})}let n=0,r=0,i=new Map;for(let a of e)if(a.category===`chat`){if(a.type===`user`)n++;else if(a.type===`tool`){let e=a.data,n=t.get(e.toolCallId??``),o=n?.name??`tool`,s=n?.firstArg??``;r++,i.set(`${o}:${s}`,{toolName:o,displayArg:s})}}return{turnCount:n,toolResults:[...i.values()],totalToolCallCount:r}}function E(e,t,n){let r=`${e}${t>0?` — ~${t.toLocaleString()} tokens`:``}:`;return n.length===0?`${r}\n (none)`:[r,...n.map(e=>` ${e}`)].join(`
13
- `)}function Be(t){let n=(0,e.readCommandContextState)(t),r=(0,e.readAutoCompactThreshold)(t),i=(0,e.readAutoCompactThresholdSource)(t),a=Re(t.getSession().getHistory()),o=ze(t.getSession().getFullHistory()),s=(0,e.listCommandContextReferences)(t),c=s.filter(e=>e.loadType===`system`),l=s.filter(e=>e.loadType===`manual`),u=s.filter(e=>e.loadType===`prompt-reference`),ee=c.reduce((e,t)=>e+w(t.byteLength),0),te=l.reduce((e,t)=>e+w(t.byteLength),0),d=u.reduce((e,t)=>e+w(t.byteLength),0),f=o.turnCount===0?`Conversation history — 0 turns`:`Conversation history — ${o.turnCount} turn${o.turnCount===1?``:`s`} | ~${a.totalTokens.toLocaleString()} tokens`,p=o.toolResults.map(e=>`${e.toolName}${e.displayArg?`: ${e.displayArg}`:``}`),m=o.toolResults.length,h=o.totalToolCallCount,g=h===0?`Tool results (0): (none)`:m<h?`Tool results (${m} unique / ${h} calls, ~${a.toolTokens.toLocaleString()} tokens):`:`Tool results (${m}, ~${a.toolTokens.toLocaleString()} tokens):`,ne=o.turnCount===0?[]:[`User (${a.userCount}): ~${a.userTokens.toLocaleString()} tokens`,`Assistant (${a.assistantCount}): ~${a.assistantTokens.toLocaleString()} tokens`,...a.systemTokens>0?[`System messages: ~${a.systemTokens.toLocaleString()} tokens`]:[],h>0?[g,...p.map(e=>` ${e}`)].join(`
14
- `):g],re=o.turnCount===0?`${f}:\n (none)`:[`${f}:`,...ne.map(e=>` ${e}`)].join(`
15
- `);return{success:!0,message:[`Context: ${n.usedTokens.toLocaleString()} / ${n.maxTokens.toLocaleString()} tokens (${Math.round(n.usedPercentage)}%)`,S(r,i),``,E(`System prompt (active every turn)`,ee,c.map(T)),``,re,``,E(`Manually added`,te,l.map(T)),``,E(`Prompt references (@-syntax)`,d,u.map(T))].join(`
16
- `),data:{references:s,history:{turnCount:o.turnCount,toolResults:o.toolResults}}}}function D(){return{name:`context`,displayName:`Context References`,description:`Context window info, reference inventory, and auto-compact controls`,source:`context`,modelInvocable:!1,argumentHint:`list | add <path> | remove <path> | clear | auto ...`,subcommands:[{name:`list`,description:`List loaded context references`,source:`context`},{name:`add`,description:`Add a file to active context references`,source:`context`},{name:`remove`,description:`Remove a context reference`,source:`context`},{name:`clear`,description:`Clear context references`,source:`context`},{name:`auto`,description:`Inspect or change auto-compact policy`,source:`context`}]}}function Ve(){let e=D();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,execute:Oe}}var He=class{name=`context`;getCommands(){return[D()]}};function Ue(){return{name:`agent-command-context`,commandSources:[new He],systemCommands:[Ve()]}}function We(t,n){return{success:!0,message:`Exit requested.`,effects:[(0,e.createSessionExitRequestedEffect)()]}}function Ge(){return{name:`exit`,displayName:`Exit Session`,description:e.EXIT_COMMAND_DESCRIPTION,source:`exit`,modelInvocable:!1}}function Ke(){let e=Ge();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!0,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:We}}var qe=class{name=`exit`;getCommands(){return[Ge()]}};const Je={exit:{type:`confirm`,message:`Exit the session?`}};function Ye(){return{name:`agent-command-exit`,commandSources:[new qe],systemCommands:[Ke()],interactionHints:Je}}function Xe(t,n){return{success:!0,message:(0,e.formatCommandHelpMessage)(t)}}function Ze(){return{name:`help`,displayName:`Help`,description:e.HELP_COMMAND_DESCRIPTION,source:`help`,modelInvocable:!1}}function Qe(){let e=Ze();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Xe}}var $e=class{name=`help`;getCommands(){return[Ze()]}};function et(){return{name:`agent-command-help`,commandSources:[new $e],systemCommands:[Qe()]}}function tt(t,n){let r=(0,e.parseLanguageArgument)(n);return r===void 0?{message:(0,e.formatLanguageUsageMessage)(),success:!1}:{message:`Language set to "${r}".`,success:!0,data:{language:r},effects:[{type:`language-change-requested`,language:r}]}}function nt(){return{name:`language`,displayName:`Language`,description:e.LANGUAGE_COMMAND_DESCRIPTION,source:`language`,argumentHint:e.LANGUAGE_COMMAND_ARGUMENT_HINT,subcommands:(0,e.buildLanguageCommandSubcommands)(`language`),modelInvocable:!1}}function rt(){let e=nt();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:tt}}var it=class{name=`language`;getCommands(){return[nt()]}};const at={language:{type:`pick`,getItems:()=>(0,e.buildLanguageCommandSubcommands)().map(e=>({label:`${e.name} ${e.description??``}`.trimEnd(),value:e.name,description:e.description}))}};function ot(){return{name:`agent-command-language`,commandSources:[new it],systemCommands:[rt()],interactionHints:at}}function O(){return{message:e.MEMORY_COMMAND_USAGE,success:!1}}function st(e){return{message:e instanceof Error?e.message:String(e),success:!1}}function ct(e){let t=e.list(),n=t.topics.length>0?t.topics.map(e=>`- ${e.name}: ${e.path}`).join(`
12
+ `)||`Context reference not found: ${r}`,data:{diagnostics:i.diagnostics}}}function Le(t,n){let r=n.join(` `).trim();if(!r)return{success:!1,message:_};let i=(0,e.removeCommandContextReference)(t,r);return i.removed?{success:!0,message:`Context reference removed: ${S(i.removed)}.`,data:{removed:i.removed}}:{success:!1,message:`Context reference not found: ${r}`}}function b(t,n,r){let i=(0,e.writeAutoCompactThresholdSetting)(t,n),a=i?`settings`:`session`;return(0,e.setCommandAutoCompactThreshold)(t,n,a),{success:!0,message:Re(r,n,i),data:{autoCompactThreshold:n,autoCompactThresholdSource:a,persisted:i}}}function Re(e,t,n){let r=Me(n);return e===`disabled`?`Auto compact disabled (${r}).`:e===`enabled`?`Auto compact enabled at ${v(t)} (${r}).`:`Auto compact threshold set to ${v(t)} (${r}).`}function ze(e){if(e.endsWith(`%`)){let t=Number(e.slice(0,-1));return!Number.isFinite(t)||t<=0||t>100?{success:!1,message:`Auto compact percentage must be greater than 0% and at most 100%.`}:{success:!0,threshold:t/100}}if(e.includes(`.`)){let t=Number(e);return!Number.isFinite(t)||t<=0||t>1?{success:!1,message:`Auto compact fraction must be greater than 0 and at most 1.`}:{success:!0,threshold:t}}return{success:!1,message:`Use a percentage such as 85% or a fraction such as 0.85.`}}function Be(e){return`References: ${e.filter(e=>e.status===`active`).length} active, ${e.filter(e=>e.status===`observed`).length} observed`}function x(e){return Math.ceil(e/4)}function S(e){return[e.relativePath,`[${e.loadType}, ${e.status}]`,`~${x(e.byteLength).toLocaleString()} tokens`].join(` `)}function Ve(e){try{return JSON.parse(e)}catch{return null}}function He(e){let t=Ve(e);if(t===null)return``;let n=Object.values(t)[0],r=typeof n==`string`?n:JSON.stringify(n);return r.length>60?`${r.slice(0,60)}…`:r}function Ue(e){let t=0,n=0,r=0,i=0,a=0,o=0,s=0;for(let c of e){let e=Math.ceil(JSON.stringify(c).length/4);c.role===`system`?t+=e:c.role===`user`?(n+=e,r++):c.role===`assistant`?(i+=e,a++):c.role===`tool`&&(o+=e,s++)}return{systemTokens:t,userTokens:n,userCount:r,assistantTokens:i,assistantCount:a,toolTokens:o,toolCallCount:s,totalTokens:t+n+i+o}}function We(e){let t=new Map;for(let n of e){if(n.category!==`chat`||n.type!==`assistant`)continue;let e=n.data;for(let n of e.toolCalls??[])t.set(n.id,{name:n.function.name,firstArg:He(n.function.arguments)})}let n=0,r=0,i=new Map;for(let a of e)if(a.category===`chat`){if(a.type===`user`)n++;else if(a.type===`tool`){let e=a.data,n=t.get(e.toolCallId??``),o=n?.name??`tool`,s=n?.firstArg??``;r++,i.set(`${o}:${s}`,{toolName:o,displayArg:s})}}return{turnCount:n,toolResults:[...i.values()],totalToolCallCount:r}}function C(e,t,n){let r=`${e}${t>0?` — ~${t.toLocaleString()} tokens`:``}:`;return n.length===0?`${r}\n (none)`:[r,...n.map(e=>` ${e}`)].join(`
13
+ `)}function Ge(t){let n=(0,e.readCommandContextState)(t),r=(0,e.readAutoCompactThreshold)(t),i=(0,e.readAutoCompactThresholdSource)(t),a=Ue(t.getSession().getHistory()),o=We(t.getSession().getFullHistory()),s=(0,e.listCommandContextReferences)(t),c=s.filter(e=>e.loadType===`system`),l=s.filter(e=>e.loadType===`manual`),u=s.filter(e=>e.loadType===`prompt-reference`),ee=c.reduce((e,t)=>e+x(t.byteLength),0),te=l.reduce((e,t)=>e+x(t.byteLength),0),ne=u.reduce((e,t)=>e+x(t.byteLength),0),d=o.turnCount===0?`Conversation history — 0 turns`:`Conversation history — ${o.turnCount} turn${o.turnCount===1?``:`s`} | ~${a.totalTokens.toLocaleString()} tokens`,f=o.toolResults.map(e=>`${e.toolName}${e.displayArg?`: ${e.displayArg}`:``}`),p=o.toolResults.length,m=o.totalToolCallCount,h=m===0?`Tool results (0): (none)`:p<m?`Tool results (${p} unique / ${m} calls, ~${a.toolTokens.toLocaleString()} tokens):`:`Tool results (${p}, ~${a.toolTokens.toLocaleString()} tokens):`,re=o.turnCount===0?[]:[`User (${a.userCount}): ~${a.userTokens.toLocaleString()} tokens`,`Assistant (${a.assistantCount}): ~${a.assistantTokens.toLocaleString()} tokens`,...a.systemTokens>0?[`System messages: ~${a.systemTokens.toLocaleString()} tokens`]:[],m>0?[h,...f.map(e=>` ${e}`)].join(`
14
+ `):h],ie=o.turnCount===0?`${d}:\n (none)`:[`${d}:`,...re.map(e=>` ${e}`)].join(`
15
+ `);return{success:!0,message:[`Context: ${n.usedTokens.toLocaleString()} / ${n.maxTokens.toLocaleString()} tokens (${Math.round(n.usedPercentage)}%)`,y(r,i),``,C(`System prompt (active every turn)`,ee,c.map(S)),``,ie,``,C(`Manually added`,te,l.map(S)),``,C(`Prompt references (@-syntax)`,ne,u.map(S))].join(`
16
+ `),data:{references:s,history:{turnCount:o.turnCount,toolResults:o.toolResults}}}}function w(){return{name:`context`,displayName:`Context References`,description:`Context window info, reference inventory, and auto-compact controls`,source:`context`,modelInvocable:!1,argumentHint:`list | add <path> | remove <path> | clear | auto ...`,subcommands:[{name:`list`,description:`List loaded context references`,source:`context`},{name:`add`,description:`Add a file to active context references`,source:`context`},{name:`remove`,description:`Remove a context reference`,source:`context`},{name:`clear`,description:`Clear context references`,source:`context`},{name:`auto`,description:`Inspect or change auto-compact policy`,source:`context`}]}}function Ke(){let e=w();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,execute:Ne}}var qe=class{name=`context`;getCommands(){return[w()]}};function Je(){return{name:`agent-command-context`,commandSources:[new qe],systemCommands:[Ke()]}}function Ye(t,n){return{success:!0,message:`Exit requested.`,effects:[(0,e.createSessionExitRequestedEffect)()]}}function Xe(){return{name:`exit`,displayName:`Exit Session`,description:e.EXIT_COMMAND_DESCRIPTION,source:`exit`,modelInvocable:!1}}function Ze(){let e=Xe();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!0,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Ye}}var Qe=class{name=`exit`;getCommands(){return[Xe()]}};const $e={exit:{type:`confirm`,message:`Exit the session?`}};function et(){return{name:`agent-command-exit`,commandSources:[new Qe],systemCommands:[Ze()],interactionHints:$e}}function tt(t,n){return{success:!0,message:(0,e.formatCommandHelpMessage)(t)}}function nt(){return{name:`help`,displayName:`Help`,description:e.HELP_COMMAND_DESCRIPTION,source:`help`,modelInvocable:!1}}function rt(){let e=nt();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:tt}}var it=class{name=`help`;getCommands(){return[nt()]}};function at(){return{name:`agent-command-help`,commandSources:[new it],systemCommands:[rt()]}}function ot(t,n){let r=(0,e.parseLanguageArgument)(n);return r===void 0?{message:(0,e.formatLanguageUsageMessage)(),success:!1}:{message:`Language set to "${r}".`,success:!0,data:{language:r},effects:[{type:`language-change-requested`,language:r}]}}function st(){return{name:`language`,displayName:`Language`,description:e.LANGUAGE_COMMAND_DESCRIPTION,source:`language`,argumentHint:e.LANGUAGE_COMMAND_ARGUMENT_HINT,subcommands:(0,e.buildLanguageCommandSubcommands)(`language`),modelInvocable:!1}}function ct(){let e=st();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:ot}}var lt=class{name=`language`;getCommands(){return[st()]}};const ut={language:{type:`pick`,getItems:()=>(0,e.buildLanguageCommandSubcommands)().map(e=>({label:`${e.name} ${e.description??``}`.trimEnd(),value:e.name,description:e.description}))}};function dt(){return{name:`agent-command-language`,commandSources:[new lt],systemCommands:[ct()],interactionHints:ut}}function T(){return{message:e.MEMORY_COMMAND_USAGE,success:!1}}function ft(e){return{message:e instanceof Error?e.message:String(e),success:!1}}function pt(e){let t=e.list(),n=t.topics.length>0?t.topics.map(e=>`- ${e.name}: ${e.path}`).join(`
17
17
  `):`(none)`;return{message:[`Memory index: ${t.indexPath}`,`Topics directory: ${t.topicsPath}`,`Topics:`,n].join(`
18
- `),success:!0,data:{indexPath:t.indexPath,topicsPath:t.topicsPath,topicCount:t.topics.length}}}function lt(e,t){if(!t||t===`index`){let t=e.loadStartupMemory();return{message:t.content||`(empty memory index)`,success:!0,data:{path:t.path,lineCount:t.lineCount,truncated:t.truncated}}}return{message:e.readTopic(t)||`(empty memory topic: ${t})`,success:!0,data:{topic:t}}}function ut(t){let n=t[1],r=t[2],i=t.slice(3).join(` `).trim();if(!(!n||!(0,e.isCommandMemoryType)(n)||!r||i.length===0))return{type:n,topic:r,text:i}}function dt(e){let t=e.list(`pending`);return{message:[`Pending memory candidates:`,...t.length>0?t.map(e=>`- ${e.id} ${e.type}/${e.topic} confidence=${e.confidence}: ${e.text}`):[`(no pending memory candidates)`]].join(`
19
- `),success:!0,data:{count:t.length}}}function k(t,n){(0,e.recordCommandMemoryEvent)(t,n)}function ft(e,t,n,r){if(!r)return O();try{let i=t.mark(r,`approved`,`approved-by-user`),a=n.append(i),o=t.mark(r,`saved`,`approved-and-saved`);return k(e,{type:`memory_candidate_approved`,candidateId:o.id,topic:o.topic,reason:`approved-by-user`}),k(e,{type:`memory_candidate_saved`,candidateId:o.id,topic:o.topic,reason:a.deduplicated?`deduplicated`:`approved-and-saved`}),{message:a.deduplicated?`Saved memory candidate ${r} was already present in ${a.topicPath}`:`Saved memory candidate ${r} to ${a.topicPath}`,success:!0,data:{id:r,status:o.status,topic:a.topic,topicPath:a.topicPath,deduplicated:a.deduplicated}}}catch(e){return st(e instanceof Error?e:String(e))}}function pt(e,t,n){if(!n)return O();try{let r=t.mark(n,`rejected`,`rejected-by-user`);return k(e,{type:`memory_candidate_rejected`,candidateId:r.id,topic:r.topic,reason:`rejected-by-user`}),{message:`Rejected memory candidate ${n}`,success:!0,data:{id:n,status:r.status}}}catch(e){return st(e instanceof Error?e:String(e))}}function mt(t){let n=(0,e.listCommandUsedMemoryReferences)(t);return{message:[`Used memory references:`,...n.length>0?n.map(e=>{let t=e.truncated?` truncated=true`:``;return`- ${e.topic} score=${e.score}${t}: ${e.path}`}):[`(no memory used in current turn)`]].join(`
20
- `),success:!0,data:{count:n.length,references:[...n]}}}function ht(t,n){let r=n.trim().split(/\s+/).filter(Boolean),i=r[0]??`list`,a=(0,e.createCommandMemoryStores)(t);if(i===`list`)return ct(a.project);if(i===`show`)return lt(a.project,r[1]);if(i===`pending`)return dt(a.pending);if(i===`approve`)return ft(t,a.pending,a.project,r[1]);if(i===`reject`)return pt(t,a.pending,r[1]);if(i===`used`)return mt(t);if(i===`add`){let t=ut(r);if(!t)return O();if((0,e.hasSensitiveCommandMemoryContent)(t.text))return{message:`Refusing to save sensitive memory content.`,success:!1};let n=a.project.append(t);return{message:n.deduplicated?`${t.type} memory already exists in ${n.topicPath}`:`Saved ${t.type} memory to ${n.topicPath}`,success:!0,data:{indexPath:n.indexPath,topicPath:n.topicPath,topic:n.topic,deduplicated:n.deduplicated}}}return O()}function A(){return{name:`memory`,displayName:`Memory`,description:e.MEMORY_COMMAND_DESCRIPTION,source:`memory`,argumentHint:e.MEMORY_COMMAND_ARGUMENT_HINT,modelInvocable:!0,safety:`write`,subcommands:(0,e.buildMemoryCommandSubcommands)()}}function gt(){let e=A();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!0,argumentHint:e.argumentHint,safety:e.safety,subcommands:e.subcommands,execute:ht}}var _t=class{name=`memory`;getCommands(){return[A()]}};function vt(){return{name:`agent-command-memory`,commandSources:[new _t],systemCommands:[gt()]}}function yt(t,n){let r=(0,e.parsePermissionModeArgument)(n);if(r===void 0){let n=(0,e.readCommandPermissionMode)(t);return{message:`Current mode: ${n}`,success:!0,data:{mode:n}}}return(0,e.isPermissionMode)(r)?((0,e.writeCommandPermissionMode)(t,r),{message:`Permission mode set to: ${r}`,success:!0,data:{mode:r}}):{message:(0,e.formatInvalidPermissionModeMessage)(),success:!1}}function j(){return{name:`mode`,displayName:`Interaction Mode`,description:e.PERMISSION_MODE_COMMAND_DESCRIPTION,source:`mode`,argumentHint:e.PERMISSION_MODE_ARGUMENT_HINT,subcommands:(0,e.buildPermissionModeSubcommands)(`mode`),modelInvocable:!1}}function bt(){let e=j();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:yt}}var xt=class{name=`mode`;getCommands(){return[j()]}};const St={mode:{type:`pick`,getItems:()=>(0,e.buildPermissionModeSubcommands)().map(e=>({label:e.name,value:e.name,description:e.description}))}};function Ct(){return{name:`agent-command-mode`,commandSources:[new xt],systemCommands:[bt()],interactionHints:St}}function wt(t,n){let r=(0,e.parsePermissionModeArgument)(n);if(r!==void 0){if(!(0,e.isPermissionMode)(r))return{message:(0,e.formatInvalidPermissionModeMessage)(),success:!1};(0,e.writeCommandPermissionMode)(t,r);let n=(0,e.readCommandPermissionsState)(t);return{message:`Permission mode set to: ${r}\n${(0,e.formatCommandPermissionsMessage)(n)}`,success:!0,data:{mode:n.mode,sessionAllowed:n.sessionAllowed}}}let i=(0,e.readCommandPermissionsState)(t);return{message:(0,e.formatCommandPermissionsMessage)(i),success:!0,data:{mode:i.mode,sessionAllowed:i.sessionAllowed}}}function M(){return{name:`permissions`,displayName:`Permissions`,description:e.PERMISSIONS_COMMAND_DESCRIPTION,source:`permissions`,argumentHint:e.PERMISSION_MODE_ARGUMENT_HINT,subcommands:(0,e.buildPermissionModeSubcommands)(`permissions`),modelInvocable:!1}}function Tt(){let e=M();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!0,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:wt}}var Et=class{name=`permissions`;getCommands(){return[M()]}};function Dt(){return{name:`agent-command-permissions`,commandSources:[new Et],systemCommands:[Tt()]}}function Ot(e){let t=e.trim().split(/\s+/).filter(e=>e.length>0);return{subcommand:t[0]??``,subArgs:t.slice(1).join(` `).trim()}}function N(e){return{success:!1,message:e}}function kt(t){return(0,e.resolvePluginCommandAdapter)(t)}async function P(e,t){let n=kt(e);if(n===void 0)return{success:!1,message:`Plugin management is not available.`};try{return{success:!0,message:await t(n)}}catch(e){return{success:!1,message:`Plugin error: ${e instanceof Error?e.message:String(e)}`}}}async function At(e,t){let{subcommand:n,subArgs:r}=Ot(t);return n===`add`&&r.length>0?P(e,async e=>{let t=await e.marketplaceAdd(r);return`Added marketplace: "${t}" (from ${r})\nInstall plugins with: /plugin install <name>@${t}`}):n===`remove`&&r.length>0?P(e,async e=>(await e.marketplaceRemove(r),`Removed marketplace "${r}" and uninstalled its plugins.`)):n===`update`&&r.length>0?P(e,async e=>(await e.marketplaceUpdate(r),`Updated marketplace "${r}".`)):n===`list`?P(e,async e=>{let t=await e.marketplaceList();return t.length===0?`No marketplace sources configured.`:`Marketplace sources:\n${t.map(e=>` ${e.name} (${e.type})`).join(`
21
- `)}`}):N(`Usage: /plugin marketplace add <source> | remove <name> | update <name> | list`)}function F(e,t,n,r){return t.length===0?Promise.resolve(N(n)):P(e,e=>Promise.resolve(r(e,t)))}function jt(){return{success:!0,message:`Opening plugin manager...`,effects:[(0,e.createPluginTuiRequestedEffect)()]}}function Mt(e,t){return F(e,t,`Usage: /plugin install <name>@<marketplace>`,async(e,t)=>(await e.install(t),`Installed plugin: ${t}`))}function Nt(e,t){return F(e,t,`Usage: /plugin uninstall <name>@<marketplace>`,async(e,t)=>(await e.uninstall(t),`Uninstalled plugin: ${t}`))}function Pt(e,t){return F(e,t,`Usage: /plugin enable <name>@<marketplace>`,async(e,t)=>(await e.enable(t),`Enabled plugin: ${t}`))}function Ft(e,t){return F(e,t,`Usage: /plugin disable <name>@<marketplace>`,async(e,t)=>(await e.disable(t),`Disabled plugin: ${t}`))}async function It(e,t){let{subcommand:n,subArgs:r}=Ot(t);switch(n){case``:case`manage`:return jt();case`install`:return Mt(e,r);case`uninstall`:return Nt(e,r);case`enable`:return Pt(e,r);case`disable`:return Ft(e,r);case`marketplace`:return At(e,r);default:return N(`Unknown plugin subcommand: ${n}`)}}async function Lt(t,n){return P(t,async e=>{let t=await e.reloadPlugins();return`Reloaded ${t.loadedPluginCount===1?`1 plugin resource`:`${t.loadedPluginCount} plugin resources`}.`}).then(t=>t.success?{...t,effects:[(0,e.createPluginRegistryReloadRequestedEffect)()]}:t)}function I(){return{name:`plugin`,displayName:`Plugins`,description:e.PLUGIN_COMMAND_DESCRIPTION,source:`plugin-manager`,modelInvocable:!1,argumentHint:e.PLUGIN_COMMAND_ARGUMENT_HINT,subcommands:(0,e.buildPluginCommandSubcommands)()}}function L(){return{name:`reload-plugins`,displayName:`Reload Plugins`,description:e.RELOAD_PLUGINS_COMMAND_DESCRIPTION,source:`plugin-manager`,modelInvocable:!1}}function Rt(){let e=I();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,lifecycle:`inline`,subcommands:e.subcommands,execute:It}}function zt(){let e=L();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Lt}}var Bt=class{name=`plugin-manager`;getCommands(){return[I(),L()]}};function Vt(){return{name:`agent-command-plugin`,commandSources:[new Bt],systemCommands:[Rt(),zt()]}}function R(e,t,n={}){let r=Jt(e,t);return{type:e,steps:Zt(Yt(r),n.initialValues),setupHelpLinks:r.setupHelpLinks??[],stepIndex:0,values:{},existingProfileNames:n.existingProfileNames??[],...n.profileName===void 0?{}:{profileName:n.profileName},...n.setCurrent===void 0?{}:{setCurrent:n.setCurrent}}}function Ht(e){return e.length===0?` No providers are available.`:[` Select provider:`,...e.map((e,t)=>` ${t+1}. ${V(e)}`),` Provider [1-${e.length}] (default: 1): `].join(`
22
- `)}function Ut(e,n){let r=e.trim(),i=r.length>0?r:`1`,a=qt(i);if(a!==void 0){let e=n[a];if(e!==void 0)return e.type;throw Error(`Provider selection ${i} is out of range. Currently supported: ${(0,t.formatSupportedProviderTypes)(n)}`)}let o=(0,t.findProviderDefinition)(n,i);if(o===void 0)throw Error(`Unknown provider: ${i}. Currently supported: ${(0,t.formatSupportedProviderTypes)(n)}`);return o.type}function z(e){let t=e.steps[e.stepIndex];if(t===void 0)throw Error(`Provider setup step ${e.stepIndex} is out of range`);return t}function B(e,t){let n=z(e),r=t.trim()||n.defaultValue||``,i=U(n,r);if(i!==void 0)return{status:`error`,state:e,message:i};let a={...e,stepIndex:e.stepIndex+1,values:{...e.values,[n.key]:r}};return a.stepIndex<e.steps.length?{status:`next`,state:a}:{status:`complete`,input:Qt(a)}}async function Wt(e,t,n,r={}){let i=R(e,n,r),a=i.steps.length;for(;i.stepIndex<a;){let e=z(i),n=await t(Gt(e,i.setupHelpLinks),e.masked===!0),r=B(i,n);if(r.status===`complete`)return r.input;if(r.status===`error`)throw Error(r.message);i=r.state}throw Error(`Provider setup flow ended without completion`)}function Gt(e,t=[]){let n=e.defaultValue===void 0?``:` (default: ${e.defaultValue})`,r=H(t);return`${r.length>0?`${r}\n`:``} ${e.title}${n}: `}const Kt={"cloud-paid":`[Cloud/Paid]`,"cloud-free":`[Cloud/Free]`,"local-free":`[Local/Free]`};function V(e){let t=`${e.category===void 0?``:`${Kt[e.category]??``} `}${e.displayName===void 0?e.type:`${e.displayName} (${e.type})`}`;return e.description===void 0?t:`${t} — ${e.description}`}function H(e=[]){return e.length===0?``:e.map(e=>` Setup help: ${Xt(e.kind)}: ${e.label} - ${e.url}`).join(`
23
- `)}function qt(e){if(/^\d+$/.test(e))return Number(e)-1}function U(e,t){if(e.required===!0&&t.length===0)return`Required`}function Jt(e,n){let r=(0,t.findProviderDefinition)(n,e);if(r===void 0)throw Error(`Unknown provider: ${e}. Currently supported: ${(0,t.formatSupportedProviderTypes)(n)}`);return r}function Yt(e){if(e.setupSteps!==void 0)return[...e.setupSteps];let t=[{key:`model`,title:`${e.type} model`,defaultValue:e.defaults?.model,required:e.defaults?.model===void 0}];return e.defaults?.baseURL!==void 0&&t.unshift({key:`baseURL`,title:`${e.type} base URL`,defaultValue:e.defaults.baseURL}),e.requiresApiKey===!0&&t.push({key:`apiKey`,title:`${e.type} API key`,defaultValue:e.defaults?.apiKey,required:e.defaults?.apiKey===void 0,masked:!0}),t}function Xt(e){return e===`api-key`?`API key`:e===`console`?`Console`:`Official`}function Zt(e,t){return t===void 0?[...e]:e.map(e=>{let n=t[e.key];return n===void 0?e:{...e,defaultValue:n,required:!1}})}function Qt(t){let n=t.profileName??(0,e.suggestProviderProfileName)({type:t.type},{existingProfileNames:t.existingProfileNames}),r=t.values.apiKey;return{profile:n,type:t.type,model:t.values.model,...r!==void 0&&r.length>0&&{apiKey:r},...t.values.baseURL!==void 0&&{baseURL:t.values.baseURL},setCurrent:t.setCurrent??!0}}const $t={type:`session-restart-requested`,reason:`other`};function en(e,t){return R(e,t.providerDefinitions,{existingProfileNames:Object.keys(t.settings.readMergedSettings().providers??{})})}function W(e,t){return{prompt:tn(e),submit:n=>rn(e,n,t),cancel:()=>({message:`Provider setup cancelled.`,success:!0})}}function tn(e){let t=z(e),n=t.masked===!0&&t.defaultValue!==void 0?`(unchanged)`:t.defaultValue;return{kind:`text`,title:t.title,...nn(e),...n===void 0?{}:{placeholder:n},...t.defaultValue===void 0?{}:{allowEmpty:!0},...t.masked===void 0?{}:{masked:t.masked},validate:e=>U(t,e)}}function nn(e){let t=H(e.setupHelpLinks);return t.length>0?{description:t}:{}}function rn(e,t,n){let r=B(e,t);return r.status===`error`?{message:r.message,success:!1,interaction:W(e,n)}:r.status===`complete`?an(r.input,n):{message:``,success:!0,interaction:W(r.state,n)}}function an(t,n){let r=n.settings.readTargetSettings(),i=(0,e.buildProviderSetupPatch)(t,{providerDefinitions:n.providerDefinitions});return n.settings.writeTargetSettings((0,e.mergeProviderPatch)(r,i)),{message:`Provider ${t.profile} configured. Restarting...`,success:!0,effects:[{...$t,message:`Provider setup restart`}]}}function on(e,t,n){return`${e===n?`* `:``}${e}: ${t.type??`unknown`} ${t.model??`(no model)`}`}function sn(t,n,r){if(!n)return{message:`Usage: /provider switch <profile>`,success:!1};if(!t?.[n])return{message:`Provider profile "${n}" was not found.`,success:!1};let{orgPolicy:i}=r;if(i?.allowedProviders&&!i.allowedProviders.includes(n))return{message:(0,e.formatOrgPolicyViolationMessage)(`Provider "${n}" is not allowed by your organization policy. Allowed: ${i.allowedProviders.join(`, `)}.`,i.adminContact),success:!1};if(r.settings.readMergedSettings().currentProvider===n)return{message:`Already using provider "${n}".`,success:!0};let a=t[n],o=r.settings.readTargetSettings(),s=r.settings.readMergedSettings(),c=o.providers?.[n]!==void 0||s.providers?.[n]!==void 0?{...o,currentProvider:n}:(0,e.setCurrentProvider)(o,n);return r.settings.writeTargetSettings(c),{message:`Switched to ${n} (${a.model??`unknown model`}). History preserved.`,success:!0,effects:[{type:`provider-hot-swap-requested`,profileName:n}]}}function cn(e,t){let n=t.settings.readMergedSettings().providers?.[e];if(!n)return{message:`Provider profile "${e}" was not found.`,success:!1};if(!n.type)return{message:`Provider profile "${e}" is missing type.`,success:!1};try{let r=R(n.type,t.providerDefinitions,{profileName:e,setCurrent:!1,initialValues:ln(n)});return{message:`Provider edit requested: ${e}`,success:!0,interaction:G(r,e,t)}}catch(e){return{message:e instanceof Error?e.message:String(e),success:!1}}}function ln(e){return{...typeof e.model==`string`?{model:e.model}:{},...typeof e.apiKey==`string`?{apiKey:e.apiKey}:{},...typeof e.baseURL==`string`?{baseURL:e.baseURL}:{}}}function G(e,t,n){return{prompt:tn(e),submit:r=>un(e,t,r,n),cancel:()=>({message:`Provider edit cancelled.`,success:!0})}}function un(e,t,n,r){let i=B(e,n);return i.status===`error`?{message:i.message,success:!1,interaction:G(e,t,r)}:i.status===`complete`?dn(i.input,t,r):{message:``,success:!0,interaction:G(i.state,t,r)}}function dn(t,n,r){let i=r.settings.readMergedSettings(),a=i.providers?.[n];if(!a)return{message:`Provider profile "${n}" was not found.`,success:!1};let{orgPolicy:o}=r;if(o?.requireApiKeyFromEnv&&(0,e.isApiKeyPlaintext)(t.apiKey))return{message:(0,e.formatOrgPolicyViolationMessage)(`Your organization policy requires API keys to be stored as environment variable references ($ENV:VAR_NAME), not as plaintext.`,o.adminContact),success:!1};let s=r.settings.readTargetSettings(),c=(0,e.buildProviderSetupPatch)(t,{providerDefinitions:r.providerDefinitions}).providers[n];if(!c)return{message:`Provider profile "${n}" was not updated.`,success:!1};r.settings.writeTargetSettings((0,e.upsertProviderProfile)(s,n,{...a,...c}));let l=i.currentProvider===n;return{message:l?`Provider ${n} updated. Switching...`:`Provider ${n} updated.`,success:!0,...l?{effects:[{type:`provider-hot-swap-requested`,profileName:n}]}:{}}}const fn={type:`session-restart-requested`,reason:`other`};function pn(e,t){let n=t.settings.readMergedSettings();if(!n.providers?.[e])return{message:`Provider profile "${e}" was not found.`,success:!1};let r=xn(e,Object.keys(n.providers));return{message:`Provider duplicate requested: ${e}`,success:!0,interaction:mn(e,r,t)}}function mn(e,t,n){return{prompt:{kind:`text`,title:`Duplicate ${e} as`,placeholder:t,allowEmpty:!0,validate:e=>hn(e,t,n)},submit:r=>gn(e,r,t,n),cancel:()=>({message:`Provider duplicate cancelled.`,success:!0})}}function hn(e,t,n){let r=Sn(e,t);if(r.length===0)return`Required`;if(n.settings.readMergedSettings().providers?.[r]!==void 0)return`Provider profile "${r}" already exists`}function gn(t,n,r,i){let a=i.settings.readMergedSettings().providers?.[t];if(!a)return{message:`Provider profile "${t}" was not found.`,success:!1};let o=Sn(n,r),s=hn(o,r,i);return s===void 0?(i.settings.writeTargetSettings((0,e.upsertProviderProfile)(i.settings.readTargetSettings(),o,{...a})),{message:`Provider profile duplicated: ${t} -> ${o}.`,success:!0}):{message:s,success:!1}}function _n(e,t){let n=t.settings.readMergedSettings().providers??{};return n[e]?Object.keys(n).length<=1?{message:`Cannot delete the only provider profile.`,success:!1}:t.settings.readTargetSettings().providers?.[e]===void 0?{message:`Provider profile "${e}" is not stored in the active write target; edit its source settings file or override it before deleting.`,success:!1}:{message:`Provider delete requested: ${e}`,success:!0,interaction:vn(e,t)}:{message:`Provider profile "${e}" was not found.`,success:!1}}function vn(e,t){return{prompt:{kind:`choice`,title:`Delete provider profile ${e}?`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]},submit:n=>n===`yes`?yn(e,t):{message:`Provider delete cancelled.`,success:!0},cancel:()=>({message:`Provider delete cancelled.`,success:!0})}}function yn(t,n){let r=n.settings.readMergedSettings();if(r.currentProvider!==t)return n.settings.writeTargetSettings((0,e.deleteProviderProfile)(n.settings.readTargetSettings(),t)),{message:`Provider profile deleted: ${t}.`,success:!0};let i=Object.entries(r.providers??{}).filter(([e])=>e!==t).map(([e,t])=>({value:e,label:on(e,t,r.currentProvider)}));return{message:`Select a replacement provider before deleting ${t}.`,success:!0,interaction:{prompt:{kind:`choice`,title:`Replacement provider for ${t}`,options:i,maxVisible:8},submit:e=>bn(t,e,n),cancel:()=>({message:`Provider delete cancelled.`,success:!0})}}}function bn(t,n,r){if(r.settings.readMergedSettings().providers?.[n]===void 0||n===t)return{message:`Provider profile "${n}" was not found.`,success:!1};let i=(0,e.deleteProviderProfile)(r.settings.readTargetSettings(),t);return r.settings.writeTargetSettings({...i,currentProvider:n}),{message:`Provider profile deleted: ${t}. Restarting with ${n}...`,success:!0,effects:[{...fn,message:`Provider delete restart`}]}}function xn(t,n){let r=(0,e.sanitizeProviderProfileName)(`${t}-copy`)??`provider-copy`;if(!n.includes(r))return r;for(let e=2;e<1e3;e+=1){let t=`${r}-${e}`;if(!n.includes(t))return t}return`${r}-${Date.now()}`}function Sn(t,n){return(0,e.sanitizeProviderProfileName)(t.trim()||n)??``}const Cn=`switch`,wn=`edit`,Tn=`test`,En=`duplicate`,Dn=`delete`,On=`cancel`;function kn(e,t,n){return{prompt:{kind:`choice`,title:`Select provider profile`,options:Object.entries(t??{}).map(([t,n])=>({value:t,label:on(t,n,e)})),maxVisible:8},submit:e=>An(e,n),cancel:()=>({message:`Provider profile selection cancelled.`,success:!0})}}function An(e,t){return t.settings.readMergedSettings().providers?.[e]?{message:`Provider profile selected: ${e}`,success:!0,interaction:jn(e,t)}:{message:`Provider profile "${e}" was not found.`,success:!1}}function jn(e,t){return{prompt:{kind:`choice`,title:`Provider profile: ${e}`,options:[{value:Cn,label:`Switch`},{value:wn,label:`Edit`},{value:Tn,label:`Test`},{value:En,label:`Duplicate`},{value:Dn,label:`Delete`},{value:On,label:`Cancel`}]},submit:n=>Mn(e,n,t),cancel:()=>({message:`Provider profile action cancelled.`,success:!0})}}async function Mn(t,n,r){let i=r.settings.readMergedSettings();switch(n){case Cn:return sn(i.providers,t,r);case wn:return cn(t,r);case Tn:return await(0,e.testProviderProfileCommand)(i.currentProvider,i.providers,t,r);case En:return pn(t,r);case Dn:return _n(t,r);case On:return{message:`Provider profile action cancelled.`,success:!0};default:return{message:`Unknown provider profile action "${n}".`,success:!1}}}async function Nn(t,n){let r=n.settings.readMergedSettings(),i=t.trim();if(i.length===0)return Pn(r.currentProvider,r.providers,n);let[a=`current`,o]=i.split(/\s+/);return a===`list`?Pn(r.currentProvider,r.providers,n):a===`current`||a===``?{message:In(r.currentProvider,r.providers),success:!0}:a===`switch`?sn(r.providers,o,n):a===`test`?await(0,e.testProviderProfileCommand)(r.currentProvider,r.providers,o,n):a===`add`?Ln(o,n):{message:`Usage: provider [current|list|switch <profile>|add <type>|test [profile]]`,success:!1}}function Pn(e,t,n){let r=Fn(e,t);return Object.keys(t??{}).length===0?{message:r,success:!0}:{message:r,success:!0,interaction:kn(e,t,n)}}function Fn(e,t){let n=Object.entries(t??{});return n.length===0?`No provider profiles configured.`:n.map(([t,n])=>`${t===e?`*`:`-`} ${t}: ${n.type??`unknown`} ${n.model??`(no model)`}`).join(`
24
- `)}function In(e,t){if(!e)return`No current provider configured.`;let n=t?.[e];return n?[`Current provider: ${e}`,`Type: ${n.type??`unknown`}`,`Model: ${n.model??`(no model)`}`,...n.baseURL?[`Base URL: ${n.baseURL}`]:[]].join(`
25
- `):`Current provider "${e}" was not found in providers.`}function Ln(e,n){return e===void 0||e.length===0?{message:`Provider setup requested. Select a provider to continue.`,success:!0,interaction:Rn(n)}:(0,t.findProviderDefinition)(n.providerDefinitions,e)===void 0?{message:`Usage: provider add <type>. Supported: ${(0,t.formatSupportedProviderTypes)(n.providerDefinitions)}`,success:!1}:{message:`Provider setup requested: ${e}`,success:!0,interaction:W(en(e,n),n)}}function Rn(e){return{prompt:{kind:`choice`,title:`Select provider`,options:e.providerDefinitions.map(e=>({value:e.type,label:V(e)})),maxVisible:6},submit:t=>{let n=en(t,e);return{message:`Provider setup requested: ${t}`,success:!0,interaction:W(n,e)}},cancel:()=>({message:`Provider setup cancelled.`,success:!0})}}function zn(){return[{name:`current`,description:`Show current provider`,source:`provider`},{name:`list`,description:`List provider profiles`,source:`provider`},{name:`switch`,description:`Hot-swap to another provider profile`,source:`provider`},{name:`add`,description:`Configure a provider profile`,source:`provider`},{name:`test`,description:`Test provider profile`,source:`provider`}]}function K(){return{name:`provider`,displayName:`Provider Setup`,description:`Manage provider profiles`,source:`provider`,modelInvocable:!1,argumentHint:`current | list | switch <profile> | add [type] | test [profile]`,subcommands:zn(),example:`/provider switch production`}}var Bn=class{name=`provider`;getCommands(){return[K()]}};function Vn(e){let t=K();return{name:t.name,displayName:t.displayName,description:t.description,example:t.example,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:t.argumentHint,subcommands:t.subcommands,execute:async(t,n)=>Nn(n,e)}}const Hn={provider:{type:`pick`,getItems:()=>zn().map(e=>({label:e.name,value:e.name,description:e.description}))}};function Un(e){return{name:`agent-command-provider`,commandSources:[new Bn],systemCommands:[Vn(e)],interactionHints:Hn}}async function Wn(e,t){let n=(await e(`
18
+ `),success:!0,data:{indexPath:t.indexPath,topicsPath:t.topicsPath,topicCount:t.topics.length}}}function mt(e,t){if(!t||t===`index`){let t=e.loadStartupMemory();return{message:t.content||`(empty memory index)`,success:!0,data:{path:t.path,lineCount:t.lineCount,truncated:t.truncated}}}return{message:e.readTopic(t)||`(empty memory topic: ${t})`,success:!0,data:{topic:t}}}function ht(t){let n=t[1],r=t[2],i=t.slice(3).join(` `).trim();if(!(!n||!(0,e.isCommandMemoryType)(n)||!r||i.length===0))return{type:n,topic:r,text:i}}function gt(e){let t=e.list(`pending`);return{message:[`Pending memory candidates:`,...t.length>0?t.map(e=>`- ${e.id} ${e.type}/${e.topic} confidence=${e.confidence}: ${e.text}`):[`(no pending memory candidates)`]].join(`
19
+ `),success:!0,data:{count:t.length}}}function E(t,n){(0,e.recordCommandMemoryEvent)(t,n)}function _t(e,t,n,r){if(!r)return T();try{let i=t.mark(r,`approved`,`approved-by-user`),a=n.append(i),o=t.mark(r,`saved`,`approved-and-saved`);return E(e,{type:`memory_candidate_approved`,candidateId:o.id,topic:o.topic,reason:`approved-by-user`}),E(e,{type:`memory_candidate_saved`,candidateId:o.id,topic:o.topic,reason:a.deduplicated?`deduplicated`:`approved-and-saved`}),{message:a.deduplicated?`Saved memory candidate ${r} was already present in ${a.topicPath}`:`Saved memory candidate ${r} to ${a.topicPath}`,success:!0,data:{id:r,status:o.status,topic:a.topic,topicPath:a.topicPath,deduplicated:a.deduplicated}}}catch(e){return ft(e instanceof Error?e:String(e))}}function vt(e,t,n){if(!n)return T();try{let r=t.mark(n,`rejected`,`rejected-by-user`);return E(e,{type:`memory_candidate_rejected`,candidateId:r.id,topic:r.topic,reason:`rejected-by-user`}),{message:`Rejected memory candidate ${n}`,success:!0,data:{id:n,status:r.status}}}catch(e){return ft(e instanceof Error?e:String(e))}}function yt(t){let n=(0,e.listCommandUsedMemoryReferences)(t);return{message:[`Used memory references:`,...n.length>0?n.map(e=>{let t=e.truncated?` truncated=true`:``;return`- ${e.topic} score=${e.score}${t}: ${e.path}`}):[`(no memory used in current turn)`]].join(`
20
+ `),success:!0,data:{count:n.length,references:[...n]}}}function bt(t,n){let r=n.trim().split(/\s+/).filter(Boolean),i=r[0]??`list`,a=(0,e.createCommandMemoryStores)(t);if(i===`list`)return pt(a.project);if(i===`show`)return mt(a.project,r[1]);if(i===`pending`)return gt(a.pending);if(i===`approve`)return _t(t,a.pending,a.project,r[1]);if(i===`reject`)return vt(t,a.pending,r[1]);if(i===`used`)return yt(t);if(i===`add`){let t=ht(r);if(!t)return T();if((0,e.hasSensitiveCommandMemoryContent)(t.text))return{message:`Refusing to save sensitive memory content.`,success:!1};let n=a.project.append(t);return{message:n.deduplicated?`${t.type} memory already exists in ${n.topicPath}`:`Saved ${t.type} memory to ${n.topicPath}`,success:!0,data:{indexPath:n.indexPath,topicPath:n.topicPath,topic:n.topic,deduplicated:n.deduplicated}}}return T()}function D(){return{name:`memory`,displayName:`Memory`,description:e.MEMORY_COMMAND_DESCRIPTION,source:`memory`,argumentHint:e.MEMORY_COMMAND_ARGUMENT_HINT,modelInvocable:!0,safety:`write`,subcommands:(0,e.buildMemoryCommandSubcommands)()}}function xt(){let e=D();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!0,argumentHint:e.argumentHint,safety:e.safety,subcommands:e.subcommands,execute:bt}}var St=class{name=`memory`;getCommands(){return[D()]}};function Ct(){return{name:`agent-command-memory`,commandSources:[new St],systemCommands:[xt()]}}function wt(t,n){let r=(0,e.parsePermissionModeArgument)(n);if(r===void 0){let n=(0,e.readCommandPermissionMode)(t);return{message:`Current mode: ${n}`,success:!0,data:{mode:n}}}return(0,e.isPermissionMode)(r)?((0,e.writeCommandPermissionMode)(t,r),{message:`Permission mode set to: ${r}`,success:!0,data:{mode:r}}):{message:(0,e.formatInvalidPermissionModeMessage)(),success:!1}}function O(){return{name:`mode`,displayName:`Interaction Mode`,description:e.PERMISSION_MODE_COMMAND_DESCRIPTION,source:`mode`,argumentHint:e.PERMISSION_MODE_ARGUMENT_HINT,subcommands:(0,e.buildPermissionModeSubcommands)(`mode`),modelInvocable:!1}}function Tt(){let e=O();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:wt}}var Et=class{name=`mode`;getCommands(){return[O()]}};const Dt={mode:{type:`pick`,getItems:()=>(0,e.buildPermissionModeSubcommands)().map(e=>({label:e.name,value:e.name,description:e.description}))}};function Ot(){return{name:`agent-command-mode`,commandSources:[new Et],systemCommands:[Tt()],interactionHints:Dt}}function kt(t,n){let r=(0,e.parsePermissionModeArgument)(n);if(r!==void 0){if(!(0,e.isPermissionMode)(r))return{message:(0,e.formatInvalidPermissionModeMessage)(),success:!1};(0,e.writeCommandPermissionMode)(t,r);let n=(0,e.readCommandPermissionsState)(t);return{message:`Permission mode set to: ${r}\n${(0,e.formatCommandPermissionsMessage)(n)}`,success:!0,data:{mode:n.mode,sessionAllowed:n.sessionAllowed}}}let i=(0,e.readCommandPermissionsState)(t);return{message:(0,e.formatCommandPermissionsMessage)(i),success:!0,data:{mode:i.mode,sessionAllowed:i.sessionAllowed}}}function k(){return{name:`permissions`,displayName:`Permissions`,description:e.PERMISSIONS_COMMAND_DESCRIPTION,source:`permissions`,argumentHint:e.PERMISSION_MODE_ARGUMENT_HINT,subcommands:(0,e.buildPermissionModeSubcommands)(`permissions`),modelInvocable:!1}}function At(){let e=k();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!0,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:kt}}var jt=class{name=`permissions`;getCommands(){return[k()]}};function Mt(){return{name:`agent-command-permissions`,commandSources:[new jt],systemCommands:[At()]}}function Nt(e){let t=e.trim().split(/\s+/).filter(e=>e.length>0);return{subcommand:t[0]??``,subArgs:t.slice(1).join(` `).trim()}}function A(e){return{success:!1,message:e}}function Pt(t){return(0,e.resolvePluginCommandAdapter)(t)}async function j(e,t){let n=Pt(e);if(n===void 0)return{success:!1,message:`Plugin management is not available.`};try{return{success:!0,message:await t(n)}}catch(e){return{success:!1,message:`Plugin error: ${e instanceof Error?e.message:String(e)}`}}}async function Ft(e,t){let{subcommand:n,subArgs:r}=Nt(t);return n===`add`&&r.length>0?j(e,async e=>{let t=await e.marketplaceAdd(r);return`Added marketplace: "${t}" (from ${r})\nInstall plugins with: /plugin install <name>@${t}`}):n===`remove`&&r.length>0?j(e,async e=>(await e.marketplaceRemove(r),`Removed marketplace "${r}" and uninstalled its plugins.`)):n===`update`&&r.length>0?j(e,async e=>(await e.marketplaceUpdate(r),`Updated marketplace "${r}".`)):n===`list`?j(e,async e=>{let t=await e.marketplaceList();return t.length===0?`No marketplace sources configured.`:`Marketplace sources:\n${t.map(e=>` ${e.name} (${e.type})`).join(`
21
+ `)}`}):A(`Usage: /plugin marketplace add <source> | remove <name> | update <name> | list`)}function M(e,t,n,r){return t.length===0?Promise.resolve(A(n)):j(e,e=>Promise.resolve(r(e,t)))}function It(){return{success:!0,message:`Opening plugin manager...`,effects:[(0,e.createPluginTuiRequestedEffect)()]}}function Lt(e,t){return M(e,t,`Usage: /plugin install <name>@<marketplace>`,async(e,t)=>(await e.install(t),`Installed plugin: ${t}`))}function Rt(e,t){return M(e,t,`Usage: /plugin uninstall <name>@<marketplace>`,async(e,t)=>(await e.uninstall(t),`Uninstalled plugin: ${t}`))}function zt(e,t){return M(e,t,`Usage: /plugin enable <name>@<marketplace>`,async(e,t)=>(await e.enable(t),`Enabled plugin: ${t}`))}function Bt(e,t){return M(e,t,`Usage: /plugin disable <name>@<marketplace>`,async(e,t)=>(await e.disable(t),`Disabled plugin: ${t}`))}async function Vt(e,t){let{subcommand:n,subArgs:r}=Nt(t);switch(n){case``:case`manage`:return It();case`install`:return Lt(e,r);case`uninstall`:return Rt(e,r);case`enable`:return zt(e,r);case`disable`:return Bt(e,r);case`marketplace`:return Ft(e,r);default:return A(`Unknown plugin subcommand: ${n}`)}}async function Ht(t,n){return j(t,async e=>{let t=await e.reloadPlugins();return`Reloaded ${t.loadedPluginCount===1?`1 plugin resource`:`${t.loadedPluginCount} plugin resources`}.`}).then(t=>t.success?{...t,effects:[(0,e.createPluginRegistryReloadRequestedEffect)()]}:t)}function N(){return{name:`plugin`,displayName:`Plugins`,description:e.PLUGIN_COMMAND_DESCRIPTION,source:`plugin-manager`,modelInvocable:!1,argumentHint:e.PLUGIN_COMMAND_ARGUMENT_HINT,subcommands:(0,e.buildPluginCommandSubcommands)()}}function P(){return{name:`reload-plugins`,displayName:`Reload Plugins`,description:e.RELOAD_PLUGINS_COMMAND_DESCRIPTION,source:`plugin-manager`,modelInvocable:!1}}function Ut(){let e=N();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,lifecycle:`inline`,subcommands:e.subcommands,execute:Vt}}function Wt(){let e=P();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Ht}}var Gt=class{name=`plugin-manager`;getCommands(){return[N(),P()]}};function Kt(){return{name:`agent-command-plugin`,commandSources:[new Gt],systemCommands:[Ut(),Wt()]}}function qt(e){return e.getSession().getActivePresetId?.()??`default`}function Jt(e){return[`Available presets:`,...(0,t.listPresets)().map(t=>`${t.id===e?`* `:` `}${t.id} — ${t.title}: ${t.description}`)].join(`
22
+ `)}function Yt(e){return`Unknown preset: ${e}. Available: ${(0,t.listPresets)().map(e=>e.id).join(`, `)}`}function Xt(n,r){let i=r.trim().split(/\s+/)[0];if(i===void 0||i.length===0||i===`list`){let e=qt(n);return{message:Jt(e),success:!0,data:{presets:(0,t.listPresets)(),active:e}}}return(0,t.getPreset)(i)===void 0?{message:Yt(i),success:!1}:((0,e.applyPresetToSession)(n,i,(0,t.resolvePreset)(i)),{message:`Switched to preset: ${i}`,success:!0,data:{preset:i}})}function Zt(e=`preset`){return(0,t.listPresets)().map(t=>({name:t.id,description:t.description,source:e}))}function F(){return{name:`preset`,displayName:`Agent Preset`,description:`List presets or switch the active preset`,source:`preset`,argumentHint:`list | <preset-id>`,subcommands:Zt(`preset`),modelInvocable:!1}}function Qt(){let e=F();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:Xt}}var $t=class{name=`preset`;getCommands(){return[F()]}};const en={preset:{type:`pick`,getItems:()=>Zt().map(e=>({label:e.name,value:e.name,description:e.description}))}};function tn(){return{name:`agent-command-preset`,commandSources:[new $t],systemCommands:[Qt()],interactionHints:en}}function I(e,t,n={}){let r=ln(e,t);return{type:e,steps:fn(un(r),n.initialValues),setupHelpLinks:r.setupHelpLinks??[],stepIndex:0,values:{},existingProfileNames:n.existingProfileNames??[],...n.profileName===void 0?{}:{profileName:n.profileName},...n.setCurrent===void 0?{}:{setCurrent:n.setCurrent}}}function nn(e){return e.length===0?` No providers are available.`:[` Select provider:`,...e.map((e,t)=>` ${t+1}. ${z(e)}`),` Provider [1-${e.length}] (default: 1): `].join(`
23
+ `)}function rn(e,t){let r=e.trim(),i=r.length>0?r:`1`,a=cn(i);if(a!==void 0){let e=t[a];if(e!==void 0)return e.type;throw Error(`Provider selection ${i} is out of range. Currently supported: ${(0,n.formatSupportedProviderTypes)(t)}`)}let o=(0,n.findProviderDefinition)(t,i);if(o===void 0)throw Error(`Unknown provider: ${i}. Currently supported: ${(0,n.formatSupportedProviderTypes)(t)}`);return o.type}function L(e){let t=e.steps[e.stepIndex];if(t===void 0)throw Error(`Provider setup step ${e.stepIndex} is out of range`);return t}function R(e,t){let n=L(e),r=t.trim()||n.defaultValue||``,i=V(n,r);if(i!==void 0)return{status:`error`,state:e,message:i};let a={...e,stepIndex:e.stepIndex+1,values:{...e.values,[n.key]:r}};return a.stepIndex<e.steps.length?{status:`next`,state:a}:{status:`complete`,input:pn(a)}}async function an(e,t,n,r={}){let i=I(e,n,r),a=i.steps.length;for(;i.stepIndex<a;){let e=L(i),n=await t(on(e,i.setupHelpLinks),e.masked===!0),r=R(i,n);if(r.status===`complete`)return r.input;if(r.status===`error`)throw Error(r.message);i=r.state}throw Error(`Provider setup flow ended without completion`)}function on(e,t=[]){let n=e.defaultValue===void 0?``:` (default: ${e.defaultValue})`,r=B(t);return`${r.length>0?`${r}\n`:``} ${e.title}${n}: `}const sn={"cloud-paid":`[Cloud/Paid]`,"cloud-free":`[Cloud/Free]`,"local-free":`[Local/Free]`};function z(e){let t=`${e.category===void 0?``:`${sn[e.category]??``} `}${e.displayName===void 0?e.type:`${e.displayName} (${e.type})`}`;return e.description===void 0?t:`${t} — ${e.description}`}function B(e=[]){return e.length===0?``:e.map(e=>` Setup help: ${dn(e.kind)}: ${e.label} - ${e.url}`).join(`
24
+ `)}function cn(e){if(/^\d+$/.test(e))return Number(e)-1}function V(e,t){if(e.required===!0&&t.length===0)return`Required`}function ln(e,t){let r=(0,n.findProviderDefinition)(t,e);if(r===void 0)throw Error(`Unknown provider: ${e}. Currently supported: ${(0,n.formatSupportedProviderTypes)(t)}`);return r}function un(e){if(e.setupSteps!==void 0)return[...e.setupSteps];let t=[{key:`model`,title:`${e.type} model`,defaultValue:e.defaults?.model,required:e.defaults?.model===void 0}];return e.defaults?.baseURL!==void 0&&t.unshift({key:`baseURL`,title:`${e.type} base URL`,defaultValue:e.defaults.baseURL}),e.requiresApiKey===!0&&t.push({key:`apiKey`,title:`${e.type} API key`,defaultValue:e.defaults?.apiKey,required:e.defaults?.apiKey===void 0,masked:!0}),t}function dn(e){return e===`api-key`?`API key`:e===`console`?`Console`:`Official`}function fn(e,t){return t===void 0?[...e]:e.map(e=>{let n=t[e.key];return n===void 0?e:{...e,defaultValue:n,required:!1}})}function pn(t){let n=t.profileName??(0,e.suggestProviderProfileName)({type:t.type},{existingProfileNames:t.existingProfileNames}),r=t.values.apiKey;return{profile:n,type:t.type,model:t.values.model,...r!==void 0&&r.length>0&&{apiKey:r},...t.values.baseURL!==void 0&&{baseURL:t.values.baseURL},setCurrent:t.setCurrent??!0}}const mn={type:`session-restart-requested`,reason:`other`};function hn(e,t){return I(e,t.providerDefinitions,{existingProfileNames:Object.keys(t.settings.readMergedSettings().providers??{})})}function H(e,t){return{prompt:gn(e),submit:n=>vn(e,n,t),cancel:()=>({message:`Provider setup cancelled.`,success:!0})}}function gn(e){let t=L(e),n=t.masked===!0&&t.defaultValue!==void 0?`(unchanged)`:t.defaultValue;return{kind:`text`,title:t.title,..._n(e),...n===void 0?{}:{placeholder:n},...t.defaultValue===void 0?{}:{allowEmpty:!0},...t.masked===void 0?{}:{masked:t.masked},validate:e=>V(t,e)}}function _n(e){let t=B(e.setupHelpLinks);return t.length>0?{description:t}:{}}function vn(e,t,n){let r=R(e,t);return r.status===`error`?{message:r.message,success:!1,interaction:H(e,n)}:r.status===`complete`?yn(r.input,n):{message:``,success:!0,interaction:H(r.state,n)}}function yn(t,n){let r=n.settings.readTargetSettings(),i=(0,e.buildProviderSetupPatch)(t,{providerDefinitions:n.providerDefinitions});return n.settings.writeTargetSettings((0,e.mergeProviderPatch)(r,i)),{message:`Provider ${t.profile} configured. Restarting...`,success:!0,effects:[{...mn,message:`Provider setup restart`}]}}function bn(e,t,n){return`${e===n?`* `:``}${e}: ${t.type??`unknown`} ${t.model??`(no model)`}`}function xn(t,n,r){if(!n)return{message:`Usage: /provider switch <profile>`,success:!1};if(!t?.[n])return{message:`Provider profile "${n}" was not found.`,success:!1};let{orgPolicy:i}=r;if(i?.allowedProviders&&!i.allowedProviders.includes(n))return{message:(0,e.formatOrgPolicyViolationMessage)(`Provider "${n}" is not allowed by your organization policy. Allowed: ${i.allowedProviders.join(`, `)}.`,i.adminContact),success:!1};if(r.settings.readMergedSettings().currentProvider===n)return{message:`Already using provider "${n}".`,success:!0};let a=t[n],o=r.settings.readTargetSettings(),s=r.settings.readMergedSettings(),c=o.providers?.[n]!==void 0||s.providers?.[n]!==void 0?{...o,currentProvider:n}:(0,e.setCurrentProvider)(o,n);return r.settings.writeTargetSettings(c),{message:`Switched to ${n} (${a.model??`unknown model`}). History preserved.`,success:!0,effects:[{type:`provider-hot-swap-requested`,profileName:n}]}}function Sn(e,t){let n=t.settings.readMergedSettings().providers?.[e];if(!n)return{message:`Provider profile "${e}" was not found.`,success:!1};if(!n.type)return{message:`Provider profile "${e}" is missing type.`,success:!1};try{let r=I(n.type,t.providerDefinitions,{profileName:e,setCurrent:!1,initialValues:Cn(n)});return{message:`Provider edit requested: ${e}`,success:!0,interaction:U(r,e,t)}}catch(e){return{message:e instanceof Error?e.message:String(e),success:!1}}}function Cn(e){return{...typeof e.model==`string`?{model:e.model}:{},...typeof e.apiKey==`string`?{apiKey:e.apiKey}:{},...typeof e.baseURL==`string`?{baseURL:e.baseURL}:{}}}function U(e,t,n){return{prompt:gn(e),submit:r=>wn(e,t,r,n),cancel:()=>({message:`Provider edit cancelled.`,success:!0})}}function wn(e,t,n,r){let i=R(e,n);return i.status===`error`?{message:i.message,success:!1,interaction:U(e,t,r)}:i.status===`complete`?Tn(i.input,t,r):{message:``,success:!0,interaction:U(i.state,t,r)}}function Tn(t,n,r){let i=r.settings.readMergedSettings(),a=i.providers?.[n];if(!a)return{message:`Provider profile "${n}" was not found.`,success:!1};let{orgPolicy:o}=r;if(o?.requireApiKeyFromEnv&&(0,e.isApiKeyPlaintext)(t.apiKey))return{message:(0,e.formatOrgPolicyViolationMessage)(`Your organization policy requires API keys to be stored as environment variable references ($ENV:VAR_NAME), not as plaintext.`,o.adminContact),success:!1};let s=r.settings.readTargetSettings(),c=(0,e.buildProviderSetupPatch)(t,{providerDefinitions:r.providerDefinitions}).providers[n];if(!c)return{message:`Provider profile "${n}" was not updated.`,success:!1};r.settings.writeTargetSettings((0,e.upsertProviderProfile)(s,n,{...a,...c}));let l=i.currentProvider===n;return{message:l?`Provider ${n} updated. Switching...`:`Provider ${n} updated.`,success:!0,...l?{effects:[{type:`provider-hot-swap-requested`,profileName:n}]}:{}}}const En={type:`session-restart-requested`,reason:`other`};function Dn(e,t){let n=t.settings.readMergedSettings();if(!n.providers?.[e])return{message:`Provider profile "${e}" was not found.`,success:!1};let r=Fn(e,Object.keys(n.providers));return{message:`Provider duplicate requested: ${e}`,success:!0,interaction:On(e,r,t)}}function On(e,t,n){return{prompt:{kind:`text`,title:`Duplicate ${e} as`,placeholder:t,allowEmpty:!0,validate:e=>kn(e,t,n)},submit:r=>An(e,r,t,n),cancel:()=>({message:`Provider duplicate cancelled.`,success:!0})}}function kn(e,t,n){let r=In(e,t);if(r.length===0)return`Required`;if(n.settings.readMergedSettings().providers?.[r]!==void 0)return`Provider profile "${r}" already exists`}function An(t,n,r,i){let a=i.settings.readMergedSettings().providers?.[t];if(!a)return{message:`Provider profile "${t}" was not found.`,success:!1};let o=In(n,r),s=kn(o,r,i);return s===void 0?(i.settings.writeTargetSettings((0,e.upsertProviderProfile)(i.settings.readTargetSettings(),o,{...a})),{message:`Provider profile duplicated: ${t} -> ${o}.`,success:!0}):{message:s,success:!1}}function jn(e,t){let n=t.settings.readMergedSettings().providers??{};return n[e]?Object.keys(n).length<=1?{message:`Cannot delete the only provider profile.`,success:!1}:t.settings.readTargetSettings().providers?.[e]===void 0?{message:`Provider profile "${e}" is not stored in the active write target; edit its source settings file or override it before deleting.`,success:!1}:{message:`Provider delete requested: ${e}`,success:!0,interaction:Mn(e,t)}:{message:`Provider profile "${e}" was not found.`,success:!1}}function Mn(e,t){return{prompt:{kind:`choice`,title:`Delete provider profile ${e}?`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]},submit:n=>n===`yes`?Nn(e,t):{message:`Provider delete cancelled.`,success:!0},cancel:()=>({message:`Provider delete cancelled.`,success:!0})}}function Nn(t,n){let r=n.settings.readMergedSettings();if(r.currentProvider!==t)return n.settings.writeTargetSettings((0,e.deleteProviderProfile)(n.settings.readTargetSettings(),t)),{message:`Provider profile deleted: ${t}.`,success:!0};let i=Object.entries(r.providers??{}).filter(([e])=>e!==t).map(([e,t])=>({value:e,label:bn(e,t,r.currentProvider)}));return{message:`Select a replacement provider before deleting ${t}.`,success:!0,interaction:{prompt:{kind:`choice`,title:`Replacement provider for ${t}`,options:i,maxVisible:8},submit:e=>Pn(t,e,n),cancel:()=>({message:`Provider delete cancelled.`,success:!0})}}}function Pn(t,n,r){if(r.settings.readMergedSettings().providers?.[n]===void 0||n===t)return{message:`Provider profile "${n}" was not found.`,success:!1};let i=(0,e.deleteProviderProfile)(r.settings.readTargetSettings(),t);return r.settings.writeTargetSettings({...i,currentProvider:n}),{message:`Provider profile deleted: ${t}. Restarting with ${n}...`,success:!0,effects:[{...En,message:`Provider delete restart`}]}}function Fn(t,n){let r=(0,e.sanitizeProviderProfileName)(`${t}-copy`)??`provider-copy`;if(!n.includes(r))return r;for(let e=2;e<1e3;e+=1){let t=`${r}-${e}`;if(!n.includes(t))return t}return`${r}-${Date.now()}`}function In(t,n){return(0,e.sanitizeProviderProfileName)(t.trim()||n)??``}const Ln=`switch`,Rn=`edit`,zn=`test`,Bn=`duplicate`,Vn=`delete`,Hn=`cancel`;function Un(e,t,n){return{prompt:{kind:`choice`,title:`Select provider profile`,options:Object.entries(t??{}).map(([t,n])=>({value:t,label:bn(t,n,e)})),maxVisible:8},submit:e=>Wn(e,n),cancel:()=>({message:`Provider profile selection cancelled.`,success:!0})}}function Wn(e,t){return t.settings.readMergedSettings().providers?.[e]?{message:`Provider profile selected: ${e}`,success:!0,interaction:Gn(e,t)}:{message:`Provider profile "${e}" was not found.`,success:!1}}function Gn(e,t){return{prompt:{kind:`choice`,title:`Provider profile: ${e}`,options:[{value:Ln,label:`Switch`},{value:Rn,label:`Edit`},{value:zn,label:`Test`},{value:Bn,label:`Duplicate`},{value:Vn,label:`Delete`},{value:Hn,label:`Cancel`}]},submit:n=>Kn(e,n,t),cancel:()=>({message:`Provider profile action cancelled.`,success:!0})}}async function Kn(t,n,r){let i=r.settings.readMergedSettings();switch(n){case Ln:return xn(i.providers,t,r);case Rn:return Sn(t,r);case zn:return await(0,e.testProviderProfileCommand)(i.currentProvider,i.providers,t,r);case Bn:return Dn(t,r);case Vn:return jn(t,r);case Hn:return{message:`Provider profile action cancelled.`,success:!0};default:return{message:`Unknown provider profile action "${n}".`,success:!1}}}async function qn(t,n){let r=n.settings.readMergedSettings(),i=t.trim();if(i.length===0)return Jn(r.currentProvider,r.providers,n);let[a=`current`,o]=i.split(/\s+/);return a===`list`?Jn(r.currentProvider,r.providers,n):a===`current`||a===``?{message:Xn(r.currentProvider,r.providers),success:!0}:a===`switch`?xn(r.providers,o,n):a===`test`?await(0,e.testProviderProfileCommand)(r.currentProvider,r.providers,o,n):a===`add`?Zn(o,n):{message:`Usage: provider [current|list|switch <profile>|add <type>|test [profile]]`,success:!1}}function Jn(e,t,n){let r=Yn(e,t);return Object.keys(t??{}).length===0?{message:r,success:!0}:{message:r,success:!0,interaction:Un(e,t,n)}}function Yn(e,t){let n=Object.entries(t??{});return n.length===0?`No provider profiles configured.`:n.map(([t,n])=>`${t===e?`*`:`-`} ${t}: ${n.type??`unknown`} ${n.model??`(no model)`}`).join(`
25
+ `)}function Xn(e,t){if(!e)return`No current provider configured.`;let n=t?.[e];return n?[`Current provider: ${e}`,`Type: ${n.type??`unknown`}`,`Model: ${n.model??`(no model)`}`,...n.baseURL?[`Base URL: ${n.baseURL}`]:[]].join(`
26
+ `):`Current provider "${e}" was not found in providers.`}function Zn(e,t){return e===void 0||e.length===0?{message:`Provider setup requested. Select a provider to continue.`,success:!0,interaction:Qn(t)}:(0,n.findProviderDefinition)(t.providerDefinitions,e)===void 0?{message:`Usage: provider add <type>. Supported: ${(0,n.formatSupportedProviderTypes)(t.providerDefinitions)}`,success:!1}:{message:`Provider setup requested: ${e}`,success:!0,interaction:H(hn(e,t),t)}}function Qn(e){return{prompt:{kind:`choice`,title:`Select provider`,options:e.providerDefinitions.map(e=>({value:e.type,label:z(e)})),maxVisible:6},submit:t=>{let n=hn(t,e);return{message:`Provider setup requested: ${t}`,success:!0,interaction:H(n,e)}},cancel:()=>({message:`Provider setup cancelled.`,success:!0})}}function $n(){return[{name:`current`,description:`Show current provider`,source:`provider`},{name:`list`,description:`List provider profiles`,source:`provider`},{name:`switch`,description:`Hot-swap to another provider profile`,source:`provider`},{name:`add`,description:`Configure a provider profile`,source:`provider`},{name:`test`,description:`Test provider profile`,source:`provider`}]}function W(){return{name:`provider`,displayName:`Provider Setup`,description:`Manage provider profiles`,source:`provider`,modelInvocable:!1,argumentHint:`current | list | switch <profile> | add [type] | test [profile]`,subcommands:$n(),example:`/provider switch production`}}var er=class{name=`provider`;getCommands(){return[W()]}};function tr(e){let t=W();return{name:t.name,displayName:t.displayName,description:t.description,example:t.example,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:t.argumentHint,subcommands:t.subcommands,execute:async(t,n)=>qn(n,e)}}const nr={provider:{type:`pick`,getItems:()=>$n().map(e=>({label:e.name,value:e.name,description:e.description}))}};function rr(e){return{name:`agent-command-provider`,commandSources:[new er],systemCommands:[tr(e)],interactionHints:nr}}async function ir(e,t){let n=(await e(`
26
27
  Do you have an API key for an AI provider?
27
28
 
28
29
  1. Yes, I have an API key
@@ -49,14 +50,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
49
50
  When the server is running, come back here and press Enter to continue.
50
51
 
51
52
  ─────────────────────────────────────────────────────────────────────────────
52
- `),await e(` Press Enter when LM Studio server is running: `),{path:`local`,preselectedType:`gemma`}):{path:`has-key`}}async function Gn(t,n,r,i,a){let o=await Wn(r,i),s=Object.keys((0,e.readMergedProviderSettings)(t).providers??{}),c=(0,e.resolveSettingsPathForScope)(t,n.settingsScope),l;l=o.preselectedType===void 0?Ut(await r(Ht(a)),a):o.preselectedType,(0,e.applyProviderConfiguration)(c,await Wt(l,r,a,{existingProfileNames:s}),{providerDefinitions:a});let u=await r(` Response language (ko/en/ja/zh, default: en): `);if(u){let t=(0,e.readSettings)(c);t.language=u,(0,e.writeSettings)(c,t)}i.writeLine(`\n Config saved to ${c}\n`)}async function Kn(t,n,r,i,a,o){let s=(0,e.readMergedProviderSettings)(t);if((0,e.checkSettingsDocument)(n.provider===void 0?s:{...s,currentProvider:n.provider},a)===`valid`)return;if(!(o.isInteractive??(()=>!1))())throw Error(o.formatError(a));await Gn(t,qn(t,n),r,i,a);let c=(0,e.readMergedProviderSettings)(t);if((0,e.checkSettingsDocument)(n.provider===void 0?c:{...c,currentProvider:n.provider},a)!==`valid`)throw Error(o.formatError(a))}function qn(t,r){if(r.settingsScope!==void 0||r.provider!==void 0)return r;let i=Jn((0,e.getProviderSettingsPaths)(t));if(i===void 0)return r;let a=(0,n.join)(t,`.robota`,`settings.json`),o=(0,n.join)(t,`.robota`,`settings.local.json`);return i===a||i===o?{...r,settingsScope:`project-local`}:r}function Jn(t){for(let n=t.length-1;n>=0;--n){let r=t[n];if(r!==void 0&&typeof(0,e.readSettings)(r).currentProvider==`string`)return r}}function Yn(e,t){return{success:!0,message:`Reset requested.`,data:{resetRequested:!0},effects:[{type:`settings-reset-requested`}]}}function q(){return{name:`reset`,displayName:`Reset Settings`,description:`Delete settings`,source:`reset`,modelInvocable:!1}}function Xn(){let e=q();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!0,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Yn}}var Zn=class{name=`reset`;getCommands(){return[q()]}};function Qn(){return{name:`agent-command-reset`,commandSources:[new Zn],systemCommands:[Xn()]}}function J(){return{message:`Usage: rewind [list] | rewind inspect <checkpoint-id> | rewind restore <checkpoint-id> | rewind code <checkpoint-id> | rewind rollback <checkpoint-id>`,success:!1}}function $n(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=120?t:`${t.slice(0,117)}...`}function er(e){return{message:[`Edit checkpoints:`,...e.length>0?e.map(e=>`- ${e.id} files=${e.fileCount} ${e.createdAt} ${$n(e.prompt)}`):[`(no edit checkpoints)`]].join(`
53
- `),success:!0,data:{count:e.length,checkpoints:[...e]}}}function tr(e){return e.length>0?e.join(`, `):`(none)`}function nr(e){let t=e.capturedFiles.length>0?e.capturedFiles.map(e=>{let t=e.snapshotSizeBytes===void 0?``:` size=${e.snapshotSizeBytes}B`;return`- ${e.relativePath} action=${e.restoreAction} snapshot=${String(e.snapshotAvailable)}${t}`}):[`(no files captured)`];return{message:[`Checkpoint ${e.target.id}`,`Prompt: ${$n(e.target.prompt)}`,`Captured files:`,...t,`Restore later checkpoints: files=${e.restoreToCheckpoint.fileCount} checkpoints=${tr(e.restoreToCheckpoint.checkpointIds)}`,`Rollback through checkpoint: files=${e.rollbackThroughCheckpoint.fileCount} checkpoints=${tr(e.rollbackThroughCheckpoint.checkpointIds)}`].join(`
54
- `),success:!0,data:{inspection:e}}}function rr(e){return{message:[`Restored code to ${e.target.id}.`,`Restored files: ${e.restoredFileCount}`,`Rolled back checkpoints: ${e.restoredCheckpointCount}`].join(`
55
- `),success:!0,data:{target:e.target,restoredCheckpointCount:e.restoredCheckpointCount,restoredFileCount:e.restoredFileCount,removedCheckpointCount:e.removedCheckpointCount}}}function ir(e){return{message:[`Rolled back code through ${e.target.id}.`,`Restored files: ${e.restoredFileCount}`,`Removed checkpoints: ${e.removedCheckpointCount}`].join(`
56
- `),success:!0,data:{target:e.target,restoredCheckpointCount:e.restoredCheckpointCount,restoredFileCount:e.restoredFileCount,removedCheckpointCount:e.removedCheckpointCount}}}function Y(e){return{message:e instanceof Error?e.message:String(e),success:!1}}function ar(t,n){if(!n)return J();try{return nr((0,e.inspectCommandEditCheckpoint)(t,n))}catch(e){return Y(e instanceof Error?e:String(e))}}async function or(t,n){if(!n)return J();try{return rr(await(0,e.restoreCommandEditCheckpoint)(t,n))}catch(e){return Y(e instanceof Error?e:String(e))}}async function sr(t,n){if(!n)return J();try{return ir(await(0,e.rollbackCommandEditCheckpoint)(t,n))}catch(e){return Y(e instanceof Error?e:String(e))}}async function cr(t,n){let r=n.trim().split(/\s+/).filter(Boolean),i=r[0]??`list`;return i===`list`?er((0,e.listCommandEditCheckpoints)(t)):i===`inspect`?ar(t,r[1]):i===`restore`||i===`code`?or(t,r[1]):i===`rollback`?sr(t,r[1]):J()}function lr(){return{name:`rewind`,displayName:`Rewind History`,description:e.REWIND_COMMAND_DESCRIPTION,source:`rewind`,argumentHint:e.REWIND_COMMAND_ARGUMENT_HINT,modelInvocable:!1,safety:`write`,subcommands:(0,e.buildRewindCommandSubcommands)()}}function ur(){let e=lr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,argumentHint:e.argumentHint,userInvocable:!0,modelInvocable:!1,safety:`write`,subcommands:e.subcommands,execute:cr}}var dr=class{name=`rewind`;getCommands(){return[lr()]}};function fr(){return{name:`agent-command-rewind`,commandSources:[new dr],systemCommands:[ur()]}}const pr={"claude-opus-4-7":{inputPerMillion:15,outputPerMillion:75},"claude-opus-4-5":{inputPerMillion:15,outputPerMillion:75},"claude-sonnet-4-6":{inputPerMillion:3,outputPerMillion:15},"claude-sonnet-4-5":{inputPerMillion:3,outputPerMillion:15},"claude-haiku-4-5":{inputPerMillion:.8,outputPerMillion:4},"claude-3-5-sonnet-20241022":{inputPerMillion:3,outputPerMillion:15},"claude-3-5-haiku-20241022":{inputPerMillion:.8,outputPerMillion:4},"claude-3-opus-20240229":{inputPerMillion:15,outputPerMillion:75},"gpt-4o":{inputPerMillion:2.5,outputPerMillion:10},"gpt-4o-mini":{inputPerMillion:.15,outputPerMillion:.6},o1:{inputPerMillion:15,outputPerMillion:60},"o1-mini":{inputPerMillion:3,outputPerMillion:12},o3:{inputPerMillion:10,outputPerMillion:40},"o3-mini":{inputPerMillion:1.1,outputPerMillion:4.4},"deepseek-chat":{inputPerMillion:.14,outputPerMillion:.28},"deepseek-reasoner":{inputPerMillion:.55,outputPerMillion:2.19},"gemini-2.0-flash":{inputPerMillion:.1,outputPerMillion:.4},"gemini-2.0-flash-thinking":{inputPerMillion:.35,outputPerMillion:3.5},"gemini-1.5-pro":{inputPerMillion:1.25,outputPerMillion:5},"gemini-1.5-flash":{inputPerMillion:.075,outputPerMillion:.3}},mr=[{pattern:/claude-opus/i,price:{inputPerMillion:15,outputPerMillion:75}},{pattern:/claude-sonnet/i,price:{inputPerMillion:3,outputPerMillion:15}},{pattern:/claude-haiku/i,price:{inputPerMillion:.8,outputPerMillion:4}},{pattern:/gpt-4o-mini/i,price:{inputPerMillion:.15,outputPerMillion:.6}},{pattern:/gpt-4/i,price:{inputPerMillion:2.5,outputPerMillion:10}},{pattern:/deepseek/i,price:{inputPerMillion:.14,outputPerMillion:.28}},{pattern:/gemini-2/i,price:{inputPerMillion:.1,outputPerMillion:.4}},{pattern:/gemini-1/i,price:{inputPerMillion:1.25,outputPerMillion:5}}];function hr(e){let t=pr[e];if(t)return t;for(let{pattern:t,price:n}of mr)if(t.test(e))return n}function gr(e,t,n){let r=hr(e);if(r)return t/1e6*r.inputPerMillion+n/1e6*r.outputPerMillion}function X(e){return e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function _r(e){return e.toLocaleString(`en-US`)}const vr=`Conversation cleared.`;function yr(t,n){return(0,e.clearConversationHistory)(t),{success:!0,message:vr,effects:[{type:`conversation-history-cleared`}]}}function br(t,n){let r=(0,e.parseSessionNameArgument)(n);return r===void 0?{success:!1,message:e.RENAME_COMMAND_USAGE}:{success:!0,message:`Session renamed to "${r}".`,data:{name:r},effects:[(0,e.createSessionRenamedEffect)(r)]}}function xr(t,n){return{success:!0,message:`Opening session picker...`,data:{triggerResumePicker:!0},effects:[(0,e.createSessionPickerRequestedEffect)()]}}const Sr=`.robota/budget.json`;function Cr(e){let t=(0,n.join)(e,Sr);if(!(0,r.existsSync)(t))return;let i;try{i=(0,r.readFileSync)(t,`utf-8`)}catch{return}try{return JSON.parse(i)}catch{return}}function wr(e,t){(0,r.mkdirSync)((0,n.join)(e,`.robota`),{recursive:!0}),(0,r.writeFileSync)((0,n.join)(e,Sr),JSON.stringify(t,null,2))}function Tr(e){let t=(0,n.join)(e,Sr);(0,r.existsSync)(t)&&(0,r.writeFileSync)(t,`{}`)}function Er(t){let n=t.getSession(),r=(0,e.readCommandSessionInfo)(t),i=n.getSessionTokenUsage?.(),a=n.getModelId?.(),o=[`Session: ${r.sessionId}`,`Messages: ${r.messageCount}`],s={sessionId:r.sessionId,messageCount:r.messageCount};if(i){if(o.push(`Tokens: ${_r(i.inputTokens)} input / ${_r(i.outputTokens)} output`),s.inputTokens=i.inputTokens,s.outputTokens=i.outputTokens,a){let e=gr(a,i.inputTokens,i.outputTokens);if(e!==void 0){o.push(`Cost: ${X(e)} (${a})`),s.estimatedCostUsd=e;let n=Cr(t.getCwd());if(n?.monthly){let t=n.monthly-e,r=Math.min(100,Math.round(e/n.monthly*100));o.push(`Budget: ${X(t)} remaining of ${X(n.monthly)}/mo (${r}% used)`),s.budgetMonthly=n.monthly,s.budgetRemainingUsd=t}}}}else o.push(`Tokens: not yet available (no turns completed)`);return{lines:o,data:s}}function Dr(e,t){let n=t.trim();if(n.startsWith(`budget`)){let t=n.slice(6).trim();if(t===`clear`)return Tr(e.getCwd()),{success:!0,message:`Monthly budget cleared.`};if(t===``){let t=Cr(e.getCwd());return t?.monthly?{success:!0,message:`Monthly budget: ${X(t.monthly)}`}:{success:!0,message:`No budget set. Use: /cost budget <amount>`}}let r=parseFloat(t);return!Number.isFinite(r)||r<=0?{success:!1,message:`Usage: /cost budget <amount> (e.g. /cost budget 5.00)`}:(wr(e.getCwd(),{monthly:r}),{success:!0,message:`Monthly budget set to ${X(r)}.`})}let{lines:r,data:i}=Er(e);return{success:!0,message:r.join(`
57
- `),data:i}}function Or(t,n){let r=(0,e.validateCommandSessionReplayLog)(t);return{success:r.validation.ok,message:(0,e.formatCommandSessionReplayValidationReport)(r),data:{logFile:r.logFile,entryCount:r.entryCount,issueCount:r.validation.issues.length,ok:r.validation.ok}}}function kr(){return{name:`clear`,displayName:`Clear History`,description:e.CLEAR_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function Ar(){return{name:`rename`,displayName:`Rename Session`,description:e.RENAME_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function jr(){return{name:`resume`,displayName:`Resume Session`,description:e.RESUME_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function Mr(){return{name:`cost`,displayName:`Session Cost`,description:e.COST_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function Z(){return{name:`validate-session`,displayName:`Validate Session`,description:e.VALIDATE_SESSION_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function Nr(){let e=kr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:yr}}function Pr(){let e=Ar();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:br}}function Fr(){let e=jr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:xr}}function Ir(){let e=Mr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Dr}}function Lr(){let e=Z();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Or}}var Rr=class{name=`session`;getCommands(){return[kr(),Ar(),jr(),Mr(),Z()]}};const zr={clear:{type:`confirm`,message:`Clear conversation history?`}};function Br(){return{name:`agent-command-session`,commandSources:[new Rr],systemCommands:[Nr(),Pr(),Fr(),Ir(),Lr()],interactionHints:zr}}function Vr(){return{name:`settings`,displayName:`Settings`,description:`Open transport settings — enable/disable transports and configure options`,source:`settings`,modelInvocable:!1}}function Hr(){let e=Vr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:async()=>({success:!0,message:`Opening settings...`,effects:[{type:`settings-tui-requested`}]})}}var Ur=class{name=`settings`;getCommands(){return[Vr()]}};function Wr(){return{name:`agent-command-settings`,commandSources:[new Ur],systemCommands:[Hr()]}}const Gr=`Skill command. Before following a matching registered skill from the system prompt Skills section, invoke the projected skills command tool with args "<skill-name> [args]". Without arguments, list registered skills. With a skill name, activate that skill. Slash syntax is a UI input/display concern; the SDK command identity is "skills".`;function Kr(e){let t=[];return e.modelInvocable||t.push(`model-disabled`),e.userInvocable||t.push(`model-only`),e.context&&t.push(`context:${e.context}`),e.agent&&t.push(`agent:${e.agent}`),t.length>0?` [${t.join(`, `)}]`:``}function qr(e){let t=e.argumentHint?` ${e.argumentHint}`:``;return`- ${e.name}${t}: ${e.description}${Kr(e)}`}function Jr(e){return e.length===0?[`No skills are registered for this session.`,``,`Skills are metadata until activated. Do not invent or imitate a skill workflow when no matching registered skill exists.`].join(`
58
- `):[`Registered skills:`,...e.map(qr),``,`Activation contract:`,`- Use /skills <skill-name> [args] to activate a matching skill.`,`- Treat /<skill-name> as a virtual alias for /skills <skill-name>.`,`- The system prompt Skills section is skill selection metadata.`,`- Treat descriptions as selection metadata only, not as loaded SKILL.md content.`,`- Do not answer by merely naming, recommending, or imitating a matching skill.`,`- If no listed skill matches the task, continue without claiming a skill was activated.`].join(`
59
- `)}function Yr(e){let t=e.trim();if(t.length===0||t===`list`)return{action:`list`,skillArgs:``};let[n=``,...r]=t.split(/\s+/);return n.length===0?{action:`list`,skillArgs:``}:{action:`activate`,skillName:n,skillArgs:r.join(` `)}}async function Xr(e,t=``){let n=Yr(t);if(n.action===`activate`&&n.skillName!==void 0){if(!e.executeSkillCommandByName)return{success:!1,message:`Skill activation is not available in this session.`};let t=`/${n.skillName}${n.skillArgs?` ${n.skillArgs}`:``}`;return await e.executeSkillCommandByName(n.skillName,n.skillArgs,{invocationSource:e.getCommandInvocationSource?.()??`user`,displayInput:t,rawInput:t})??{success:!1,message:`Unknown skill: ${n.skillName}`}}let r=e.listSkills?.()??[];return{success:!0,message:Jr(r),data:{skills:r,activationContract:{activateWith:`/skills <skill-name> [args]`,activationRequiredBeforeWorkflow:!0,metadataIsNotSkillContent:!0}}}}function Zr(){return{name:`skills`,displayName:`Skills`,description:Gr,source:`skills`,modelInvocable:!0,userInvocable:!0,argumentHint:`[list | <skill-name> [args]]`,safety:`read-only`}}function Qr(){let e=Zr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!0,argumentHint:e.argumentHint,safety:e.safety,lifecycle:`inline`,execute:Xr}}var $r=class{name=`skills`;getCommands(){return[Zr()]}};function ei(t){let n=[new $r];return n.push(new e.SkillCommandSource(t.cwd)),{name:`agent-command-skills`,commandSources:n,systemCommands:[Qr()]}}const ti=[`Usage: /statusline on | off | reset | git on | git off`,`Fields: model, context, permission mode, message count, session name, thinking state, git branch.`].join(`
60
- `);function ni(t){let n=t.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0),[r,i]=n;return r===`on`&&i===void 0?{success:!0,message:`Status line enabled.`,patch:{enabled:!0}}:r===`off`&&i===void 0?{success:!0,message:`Status line disabled.`,patch:{enabled:!1}}:r===`reset`&&i===void 0?{success:!0,message:`Status line settings reset.`,patch:{...e.DEFAULT_STATUS_LINE_COMMAND_SETTINGS}}:r===`git`&&i===`on`&&n.length===2?{success:!0,message:`Status line git branch shown.`,patch:{gitBranch:!0}}:r===`git`&&i===`off`&&n.length===2?{success:!0,message:`Status line git branch hidden.`,patch:{gitBranch:!1}}:{success:!1,message:ti}}function ri(e,t){let n=ni(t);return n.success?{success:!0,message:n.message,effects:[{type:`statusline-settings-patch`,patch:n.patch}]}:{success:!1,message:n.message}}function ii(){return{name:`statusline`,displayName:`Status Line`,description:e.STATUSLINE_COMMAND_DESCRIPTION,source:`statusline`,argumentHint:e.STATUSLINE_COMMAND_ARGUMENT_HINT,subcommands:(0,e.buildStatusLineCommandSubcommands)(`statusline`),modelInvocable:!1}}function ai(){let e=ii();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:ri}}var oi=class{name=`statusline`;getCommands(){return[ii()]}};function si(){return{name:`agent-command-statusline`,commandSources:[new oi],systemCommands:[ai()]}}const ci=`Inspect Robota user-local storage and memory state.`,li=`storage list [--format json] | memory set/list/inspect/disable/delete`,Q=`Usage: user-local storage list [--format json] | user-local memory set <category> <key> <value> --summary <summary> --source <source> | user-local memory list [--format json] | user-local memory inspect <category> <key> [--format json] | user-local memory disable <category> <key> | user-local memory delete <category> <key>`;function ui(e){return e.length===0?`No user-local memory items.`:e.map(e=>`- ${e.category}/${e.key} (${e.enabled?`enabled`:`disabled`})`).join(`
61
- `)}function $(e){if(e===void 0)throw Error(`User-local memory category is required.`);return e}async function di(t,n){let r=await(0,e.listUserLocalMemoryItems)({activeRepositoryRoot:t});return{message:n.format===`json`?JSON.stringify(r,null,2):ui(r.items),success:!0,data:{list:r}}}async function fi(t,n){let[r,i,a]=n.positional,o=await(0,e.setUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``,value:a??``,summary:n.summary??``,source:n.source??``});return{message:`Stored user-local memory item ${o.category}/${o.key} at ${o.storageLocation}`,success:!0,data:{item:o}}}async function pi(t,n){let[r,i]=n.positional,a=await(0,e.inspectUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``});return{message:n.format===`json`?JSON.stringify(a,null,2):`${a.category}/${a.key}: ${a.summary}`,success:!0,data:{item:a}}}async function mi(t,n){let[r,i]=n.positional,a=await(0,e.disableUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``});return{message:`Disabled user-local memory item ${a.category}/${a.key}`,success:!0,data:{item:a}}}async function hi(t,n){let[r,i]=n.positional,a=await(0,e.deleteUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``});return{message:`Deleted user-local memory item ${a.category}/${a.key}`,success:!0,data:{result:a}}}async function gi(e,t){return(t.action??`list`)===`list`?di(e,t):t.action===`set`?fi(e,t):t.action===`inspect`?pi(e,t):t.action===`disable`?mi(e,t):t.action===`delete`?hi(e,t):{message:Q,success:!1}}function _i(e){if(e===void 0||e===`text`)return`text`;if(e===`json`)return`json`;throw Error(`Unsupported user-local output format: ${e}`)}function vi(e,t,n){return e===`--format`?{format:t[n+1],nextIndex:n+1}:e.startsWith(`--format=`)?{format:e.slice(9),nextIndex:n}:e===`--summary`?{summary:t[n+1],nextIndex:n+1}:e.startsWith(`--summary=`)?{summary:e.slice(10),nextIndex:n}:e===`--source`?{source:t[n+1],nextIndex:n+1}:e.startsWith(`--source=`)?{source:e.slice(9),nextIndex:n}:null}function yi(e,t={}){let n=t.format,r=t.summary,i=t.source,a=[];for(let t=0;t<e.length;t+=1){let o=e[t],s=vi(o,e,t);if(s!==null){n=s.format??n,r=s.summary??r,i=s.source??i,t=s.nextIndex;continue}a.push(o)}return{target:a[0],action:a[1],positional:a.slice(2),format:_i(n),summary:r,source:i}}function bi(e){return e.trim().split(/\s+/).filter(Boolean)}function xi(e,t){let n=t.map(e=>`- ${e.category}`);return[`User-local storage root: ${e}`,`Categories:`,...n].join(`
62
- `)}async function Si(t,n){if((n.action??`list`)!==`list`)return{message:Q,success:!1};let r=await(0,e.inspectUserLocalStorage)({activeRepositoryRoot:t});return{message:n.format===`json`?JSON.stringify(r,null,2):xi(r.root,r.categories),success:!0,data:{root:r.root,categories:r.categories,inspection:r}}}async function Ci(e,t){return t.target===`storage`?Si(e,t):t.target===`memory`?gi(e,t):{message:Q,success:!1}}function wi(e){return e.includes(`ENOENT`)?`User-local memory item not found.`:e}async function Ti(e){try{return await Ci(e.cwd,yi(e.argv,{format:e.format,summary:e.summary,source:e.source}))}catch(e){return{message:wi(e instanceof Error?e.message:String(e)),success:!1}}}async function Ei(e,t){try{return await Ci(e.getCwd(),yi(bi(t)))}catch(e){return{message:wi(e instanceof Error?e.message:String(e)),success:!1}}}function Di(){return{name:`user-local`,displayName:`User Config`,description:ci,source:`user-local`,argumentHint:li,modelInvocable:!1,safety:`read-only`,subcommands:[{name:`storage`,description:`Inspect user-local storage categories`,source:`user-local`},{name:`memory`,description:`Inspect and manage user-local memory items`,source:`user-local`}]}}function Oi(){let e=Di();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,safety:e.safety,subcommands:e.subcommands,execute:Ei}}var ki=class{name=`user-local`;getCommands(){return[Di()]}};function Ai(){return{name:`agent-command-user-local`,commandSources:[new ki],systemCommands:[Oi()]}}function ji({cwd:e,providerDefinitions:t,providerSettingsAdapter:n}){return[ei({cwd:e}),et(),ge(),Dt(),Ct(),ot(),xe(),vt(),Ai(),Ee(),Ue(),Ye(),Br(),Qn(),fr(),si(),Vt(),Wr(),Un({providerDefinitions:t,settings:n})]}function Mi(t){let r=(0,a.homedir)(),o=(0,n.join)(r,`.robota`,`plugins`),s=(0,n.join)(r,`.robota`,`settings.json`),c=(e,t)=>(0,i.execSync)(e,{timeout:t.timeout,stdio:t.stdio??`pipe`}),l=new e.PluginSettingsStore(s),u=new e.MarketplaceClient({pluginsDir:o,exec:c});return{cwd:t,marketplace:u,installer:new e.BundlePluginInstaller({pluginsDir:o,settingsStore:l,marketplaceClient:u,exec:c}),loader:new e.BundlePluginLoader(o),settingsStore:l}}async function Ni(e){let t=await e.loader.loadAll(),n=e.settingsStore.getEnabledPlugins();return t.map(e=>{let t=e.pluginDir.split(`/`),r=t.indexOf(`cache`),i=r>=0?t[r+1]??``:``,a=i?`${e.manifest.name}@${i}`:e.manifest.name;return{name:a,description:e.manifest.description,enabled:n[a]!==!1&&n[e.manifest.name]!==!1}})}async function Pi(e,t){let n;try{n=e.marketplace.fetchManifest(t)}catch{return[]}let r=e.installer.getInstalledPlugins(),i=new Set(Object.values(r).map(e=>e.pluginName));return n.plugins.map(e=>({name:e.name,description:e.description,installed:i.has(e.name)}))}async function Fi(t,r,a){let[o,s]=r.split(`@`);if(!o||!s)throw Error(`Plugin ID must be in format: name@marketplace`);if(a===`project`){let r=(0,n.join)(t.cwd,`.robota`,`plugins`);await new e.BundlePluginInstaller({pluginsDir:r,settingsStore:t.settingsStore,marketplaceClient:t.marketplace,exec:(e,t)=>(0,i.execSync)(e,{timeout:t.timeout,stdio:t.stdio??`pipe`})}).install(o,s);return}await t.installer.install(o,s)}async function Ii(e,t){let n=e.installer.getPluginsByMarketplace(t);for(let t of n)await e.installer.uninstall(`${t.pluginName}@${t.marketplace}`);e.marketplace.removeMarketplace(t)}function Li(e){return e.marketplace.listMarketplaces().map(e=>({name:e.name,type:e.source.type}))}function Ri(e){let t=Mi(e);return{listInstalled:()=>Ni(t),listAvailablePlugins:e=>Pi(t,e),install:(e,n)=>Fi(t,e,n),uninstall:async e=>t.installer.uninstall(e),enable:async e=>t.installer.enable(e),disable:async e=>t.installer.disable(e),marketplaceAdd:async e=>e.includes(`/`)&&!e.includes(`:`)?t.marketplace.addMarketplace({type:`github`,repo:e}):t.marketplace.addMarketplace({type:`git`,url:e}),marketplaceRemove:e=>Ii(t,e),marketplaceUpdate:async e=>t.marketplace.updateMarketplace(e),marketplaceList:async()=>Li(t),reloadPlugins:async()=>({loadedPluginCount:(await t.loader.loadAll()).length})}}const zi=`plugin`;function Bi(){return process.env.HOME??(0,a.homedir)()}function Vi(t){let r=new e.BundlePluginLoader((0,n.join)(Bi(),`.robota`,`plugins`));try{let n=r.loadPluginsSync();return n.length===0?(t.replaceSource(zi),0):(t.replaceSource(zi,new e.PluginCommandSource(n)),n.length)}catch{return t.replaceSource(zi),0}}exports.AgentCommandSource=he,exports.BackgroundCommandSource=be,exports.CLEAR_COMMAND_MESSAGE=vr,exports.CompactCommandSource=Te,exports.ContextCommandSource=He,exports.ExitCommandSource=qe,exports.HelpCommandSource=$e,exports.LanguageCommandSource=it,exports.MemoryCommandSource=_t,exports.ModeCommandSource=xt,exports.PermissionsCommandSource=Et,exports.PluginManagerCommandSource=Bt,exports.ProviderCommandSource=Bn,exports.RewindCommandSource=dr,exports.SKILLS_COMMAND_DESCRIPTION=Gr,exports.STATUSLINE_USAGE=ti,exports.SessionCommandSource=Rr,exports.SettingsCommandSource=Ur,exports.SkillsCommandSource=$r,exports.StatusLineCommandSource=oi,exports.USER_LOCAL_COMMAND_ARGUMENT_HINT=li,exports.USER_LOCAL_COMMAND_DESCRIPTION=ci,exports.USER_LOCAL_COMMAND_USAGE=Q,exports.UserLocalCommandSource=ki,exports.createAgentCommandEntry=_,exports.createAgentCommandModule=ge,exports.createAgentSystemCommand=me,exports.createBackgroundCommandEntry=v,exports.createBackgroundCommandModule=xe,exports.createClearCommandEntry=kr,exports.createCompactCommandEntry=y,exports.createCompactCommandModule=Ee,exports.createContextCommandEntry=D,exports.createContextCommandModule=Ue,exports.createCostCommandEntry=Mr,exports.createDefaultCommandModules=ji,exports.createDefaultPluginCommandAdapter=Ri,exports.createExitCommandEntry=Ge,exports.createExitCommandModule=Ye,exports.createHelpCommandEntry=Ze,exports.createHelpCommandModule=et,exports.createLanguageCommandEntry=nt,exports.createLanguageCommandModule=ot,exports.createMemoryCommandEntry=A,exports.createMemoryCommandModule=vt,exports.createModeCommandEntry=j,exports.createModeCommandModule=Ct,exports.createPermissionsCommandEntry=M,exports.createPermissionsCommandModule=Dt,exports.createPluginCommandEntry=I,exports.createPluginCommandModule=Vt,exports.createProviderCommandEntry=K,exports.createProviderCommandModule=Un,exports.createProviderSetupFlow=R,exports.createReloadPluginsCommandEntry=L,exports.createRenameCommandEntry=Ar,exports.createResetCommandEntry=q,exports.createResetCommandModule=Qn,exports.createResumeCommandEntry=jr,exports.createRewindCommandModule=fr,exports.createSessionCommandModule=Br,exports.createSettingsCommandEntry=Vr,exports.createSettingsCommandModule=Wr,exports.createSkillsCommandEntry=Zr,exports.createSkillsCommandModule=ei,exports.createStatusLineCommandEntry=ii,exports.createStatusLineCommandModule=si,exports.createUserLocalCommandEntry=Di,exports.createUserLocalCommandModule=Ai,exports.createValidateSessionCommandEntry=Z,exports.ensureProviderConfig=Kn,exports.executeAgentCommand=ue,exports.executeBackgroundCommand=ve,exports.executeClearCommand=yr,exports.executeCompactCommand=Ce,exports.executeContextCommand=Oe,exports.executeCostCommand=Dr,exports.executeExitCommand=We,exports.executeHelpCommand=Xe,exports.executeLanguageCommand=tt,exports.executeMemoryCommand=ht,exports.executeModeCommand=yt,exports.executePermissionsCommand=wt,exports.executePluginCommand=It,exports.executeProviderCommand=Nn,exports.executeReloadPluginsCommand=Lt,exports.executeRenameCommand=br,exports.executeResetCommand=Yn,exports.executeResumeCommand=xr,exports.executeRewindCommand=cr,exports.executeSkillsCommand=Xr,exports.executeStatusLineCommand=ri,exports.executeUserLocalCommand=Ei,exports.executeUserLocalDirectCommand=Ti,exports.executeValidateSessionCommand=Or,exports.formatProviderSetupChoiceLabel=V,exports.formatProviderSetupHelpLinks=H,exports.formatProviderSetupPromptLabel=Gt,exports.formatProviderSetupSelectionPrompt=Ht,exports.getProviderSetupStep=z,exports.reloadPluginCommandSource=Vi,exports.resolveProviderSetupSelection=Ut,exports.runProviderSetupPromptFlow=Wt,exports.runProviderStartupSetup=Gn,exports.submitProviderSetupValue=B,exports.validateProviderSetupValue=U;
53
+ `),await e(` Press Enter when LM Studio server is running: `),{path:`local`,preselectedType:`gemma`}):{path:`has-key`}}async function ar(t,n,r,i,a){let o=await ir(r,i),s=Object.keys((0,e.readMergedProviderSettings)(t).providers??{}),c=(0,e.resolveSettingsPathForScope)(t,n.settingsScope),l;l=o.preselectedType===void 0?rn(await r(nn(a)),a):o.preselectedType,(0,e.applyProviderConfiguration)(c,await an(l,r,a,{existingProfileNames:s}),{providerDefinitions:a});let u=await r(` Response language (ko/en/ja/zh, default: en): `);if(u){let t=(0,e.readSettings)(c);t.language=u,(0,e.writeSettings)(c,t)}i.writeLine(`\n Config saved to ${c}\n`)}async function or(t,n,r,i,a,o){let s=(0,e.readMergedProviderSettings)(t);if((0,e.checkSettingsDocument)(n.provider===void 0?s:{...s,currentProvider:n.provider},a)===`valid`||n.provider===void 0&&(0,e.resolveEnvDefaultProvider)(a,o.env)!==void 0)return;if(!(o.isInteractive??(()=>!1))())throw new e.ProviderConfigError(o.formatError(a));await ar(t,sr(t,n),r,i,a);let c=(0,e.readMergedProviderSettings)(t);if((0,e.checkSettingsDocument)(n.provider===void 0?c:{...c,currentProvider:n.provider},a)!==`valid`)throw new e.ProviderConfigError(o.formatError(a))}function sr(t,n){if(n.settingsScope!==void 0||n.provider!==void 0)return n;let i=cr((0,e.getProviderSettingsPaths)(t));if(i===void 0)return n;let a=(0,r.join)(t,`.robota`,`settings.json`),o=(0,r.join)(t,`.robota`,`settings.local.json`);return i===a||i===o?{...n,settingsScope:`project-local`}:n}function cr(t){for(let n=t.length-1;n>=0;--n){let r=t[n];if(r!==void 0&&typeof(0,e.readSettings)(r).currentProvider==`string`)return r}}function lr(e,t){return{success:!0,message:`Reset requested.`,data:{resetRequested:!0},effects:[{type:`settings-reset-requested`}]}}function G(){return{name:`reset`,displayName:`Reset Settings`,description:`Delete settings`,source:`reset`,modelInvocable:!1}}function ur(){let e=G();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!0,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:lr}}var dr=class{name=`reset`;getCommands(){return[G()]}};function fr(){return{name:`agent-command-reset`,commandSources:[new dr],systemCommands:[ur()]}}function K(){return{message:`Usage: rewind [list] | rewind inspect <checkpoint-id> | rewind restore <checkpoint-id> | rewind code <checkpoint-id> | rewind rollback <checkpoint-id>`,success:!1}}function pr(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=120?t:`${t.slice(0,117)}...`}function mr(e){return{message:[`Edit checkpoints:`,...e.length>0?e.map(e=>`- ${e.id} files=${e.fileCount} ${e.createdAt} ${pr(e.prompt)}`):[`(no edit checkpoints)`]].join(`
54
+ `),success:!0,data:{count:e.length,checkpoints:[...e]}}}function hr(e){return e.length>0?e.join(`, `):`(none)`}function gr(e){let t=e.capturedFiles.length>0?e.capturedFiles.map(e=>{let t=e.snapshotSizeBytes===void 0?``:` size=${e.snapshotSizeBytes}B`;return`- ${e.relativePath} action=${e.restoreAction} snapshot=${String(e.snapshotAvailable)}${t}`}):[`(no files captured)`];return{message:[`Checkpoint ${e.target.id}`,`Prompt: ${pr(e.target.prompt)}`,`Captured files:`,...t,`Restore later checkpoints: files=${e.restoreToCheckpoint.fileCount} checkpoints=${hr(e.restoreToCheckpoint.checkpointIds)}`,`Rollback through checkpoint: files=${e.rollbackThroughCheckpoint.fileCount} checkpoints=${hr(e.rollbackThroughCheckpoint.checkpointIds)}`].join(`
55
+ `),success:!0,data:{inspection:e}}}function _r(e){return{message:[`Restored code to ${e.target.id}.`,`Restored files: ${e.restoredFileCount}`,`Rolled back checkpoints: ${e.restoredCheckpointCount}`].join(`
56
+ `),success:!0,data:{target:e.target,restoredCheckpointCount:e.restoredCheckpointCount,restoredFileCount:e.restoredFileCount,removedCheckpointCount:e.removedCheckpointCount}}}function vr(e){return{message:[`Rolled back code through ${e.target.id}.`,`Restored files: ${e.restoredFileCount}`,`Removed checkpoints: ${e.removedCheckpointCount}`].join(`
57
+ `),success:!0,data:{target:e.target,restoredCheckpointCount:e.restoredCheckpointCount,restoredFileCount:e.restoredFileCount,removedCheckpointCount:e.removedCheckpointCount}}}function q(e){return{message:e instanceof Error?e.message:String(e),success:!1}}function yr(t,n){if(!n)return K();try{return gr((0,e.inspectCommandEditCheckpoint)(t,n))}catch(e){return q(e instanceof Error?e:String(e))}}async function br(t,n){if(!n)return K();try{return _r(await(0,e.restoreCommandEditCheckpoint)(t,n))}catch(e){return q(e instanceof Error?e:String(e))}}async function xr(t,n){if(!n)return K();try{return vr(await(0,e.rollbackCommandEditCheckpoint)(t,n))}catch(e){return q(e instanceof Error?e:String(e))}}async function Sr(t,n){let r=n.trim().split(/\s+/).filter(Boolean),i=r[0]??`list`;return i===`list`?mr((0,e.listCommandEditCheckpoints)(t)):i===`inspect`?yr(t,r[1]):i===`restore`||i===`code`?br(t,r[1]):i===`rollback`?xr(t,r[1]):K()}function Cr(){return{name:`rewind`,displayName:`Rewind History`,description:e.REWIND_COMMAND_DESCRIPTION,source:`rewind`,argumentHint:e.REWIND_COMMAND_ARGUMENT_HINT,modelInvocable:!1,safety:`write`,subcommands:(0,e.buildRewindCommandSubcommands)()}}function wr(){let e=Cr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,argumentHint:e.argumentHint,userInvocable:!0,modelInvocable:!1,safety:`write`,subcommands:e.subcommands,execute:Sr}}var Tr=class{name=`rewind`;getCommands(){return[Cr()]}};function Er(){return{name:`agent-command-rewind`,commandSources:[new Tr],systemCommands:[wr()]}}const Dr={s:1e3,m:6e4,h:36e5,d:864e5},J=`Usage: /schedule in <N><s|m|h|d> <instruction> | /schedule cron "<expr>" <instruction>`;function Or(e,t){let n=e.trim();if(n.length===0)return{ok:!1,error:J};if(n.startsWith(`in `)){let e=n.slice(3).trim(),r=e.indexOf(` `);if(r===-1)return{ok:!1,error:`Missing instruction. ${J}`};let i=e.slice(0,r),a=e.slice(r+1).trim(),o=/^(\d+)(s|m|h|d)$/.exec(i);if(!o)return{ok:!1,error:`Invalid duration "${i}". ${J}`};if(a.length===0)return{ok:!1,error:`Missing instruction. ${J}`};let s=parseInt(o[1],10)*Dr[o[2]];return{ok:!0,spec:{cronExpression:new Date(t+s).toISOString(),instruction:a,recurring:!1}}}if(n.startsWith(`cron `)){let e=n.slice(5).trim(),t=/^["']([^"']+)["']\s+(.+)$/.exec(e);if(!t)return{ok:!1,error:`cron form needs a quoted expression. ${J}`};let r=t[2].trim();return r.length===0?{ok:!1,error:`Missing instruction. ${J}`}:{ok:!0,spec:{cronExpression:t[1].trim(),instruction:r,recurring:!0}}}return{ok:!1,error:J}}function kr(e,t){return`${e}: ${t.slice(0,48)}${t.length>48?`…`:``}`}async function Ar(e,t,n=Date.now()){let r=Or(t,n);if(!r.ok)return{message:r.error,success:!1};let{cronExpression:i,instruction:a,recurring:o}=r.spec,s=await e.spawnScheduledWake({label:kr(`Scheduled`,a),cronExpression:i,agentInstruction:a});return{message:`Scheduled wake (${o?`cron \`${i}\``:`once at ${i}`}): "${a}" — task ${s.id}.`,success:!0,data:{taskId:s.id,cronExpression:i,recurring:o}}}function jr(e){let t=/^["']([^"']+)["']\s+["']([^"']+)["']\s+(.+)$/.exec(e.trim());if(!t)return null;let n=t[3].trim();return n.length===0?null:{command:t[1],matchPattern:t[2],instruction:n}}async function Mr(e,t){let n=jr(t);if(!n)return{message:`Usage: /monitor "<command>" "<pattern>" <instruction>`,success:!1};let r=await e.spawnMonitorWake({label:kr(`Monitor`,n.instruction),command:n.command,matchPattern:n.matchPattern,agentInstruction:n.instruction});return{message:`Monitoring \`${n.command}\` for /${n.matchPattern}/ — task ${r.id}.`,success:!0,data:{taskId:r.id,matchPattern:n.matchPattern}}}function Nr(e){let t=e.getAgentJobCapability?.();if(!t)throw Error(`Scheduling requires an active agent runtime.`);return t}function Y(){return{name:`schedule`,displayName:`Schedule Wake`,description:`Schedule the agent to wake and run an instruction on a timer (one-shot or cron).`,source:`schedule`,argumentHint:`in <N><s|m|h|d> <instruction> | cron "<expr>" <instruction>`,modelInvocable:!0}}function Pr(){return{name:`monitor`,displayName:`Monitor Process`,description:`Watch a process’s output and wake the agent when a line matches a pattern.`,source:`schedule`,argumentHint:`"<command>" "<pattern>" <instruction>`,modelInvocable:!0}}function Fr(){let e=Y();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!0,argumentHint:e.argumentHint,lifecycle:`inline`,execute:(e,t)=>Ar(Nr(e),t)}}function Ir(){let e=Pr();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!0,argumentHint:e.argumentHint,lifecycle:`inline`,execute:(e,t)=>Mr(Nr(e),t)}}var Lr=class{name=`schedule`;getCommands(){return[Y(),Pr()]}};function Rr(){return{name:`agent-command-schedule`,commandSources:[new Lr],systemCommands:[Fr(),Ir()],sessionRequirements:[`agent-runtime`]}}const zr={"claude-opus-4-7":{inputPerMillion:15,outputPerMillion:75},"claude-opus-4-5":{inputPerMillion:15,outputPerMillion:75},"claude-sonnet-4-6":{inputPerMillion:3,outputPerMillion:15},"claude-sonnet-4-5":{inputPerMillion:3,outputPerMillion:15},"claude-haiku-4-5":{inputPerMillion:.8,outputPerMillion:4},"claude-3-5-sonnet-20241022":{inputPerMillion:3,outputPerMillion:15},"claude-3-5-haiku-20241022":{inputPerMillion:.8,outputPerMillion:4},"claude-3-opus-20240229":{inputPerMillion:15,outputPerMillion:75},"gpt-4o":{inputPerMillion:2.5,outputPerMillion:10},"gpt-4o-mini":{inputPerMillion:.15,outputPerMillion:.6},o1:{inputPerMillion:15,outputPerMillion:60},"o1-mini":{inputPerMillion:3,outputPerMillion:12},o3:{inputPerMillion:10,outputPerMillion:40},"o3-mini":{inputPerMillion:1.1,outputPerMillion:4.4},"deepseek-chat":{inputPerMillion:.14,outputPerMillion:.28},"deepseek-reasoner":{inputPerMillion:.55,outputPerMillion:2.19},"gemini-2.0-flash":{inputPerMillion:.1,outputPerMillion:.4},"gemini-2.0-flash-thinking":{inputPerMillion:.35,outputPerMillion:3.5},"gemini-1.5-pro":{inputPerMillion:1.25,outputPerMillion:5},"gemini-1.5-flash":{inputPerMillion:.075,outputPerMillion:.3}},Br=[{pattern:/claude-opus/i,price:{inputPerMillion:15,outputPerMillion:75}},{pattern:/claude-sonnet/i,price:{inputPerMillion:3,outputPerMillion:15}},{pattern:/claude-haiku/i,price:{inputPerMillion:.8,outputPerMillion:4}},{pattern:/gpt-4o-mini/i,price:{inputPerMillion:.15,outputPerMillion:.6}},{pattern:/gpt-4/i,price:{inputPerMillion:2.5,outputPerMillion:10}},{pattern:/deepseek/i,price:{inputPerMillion:.14,outputPerMillion:.28}},{pattern:/gemini-2/i,price:{inputPerMillion:.1,outputPerMillion:.4}},{pattern:/gemini-1/i,price:{inputPerMillion:1.25,outputPerMillion:5}}];function Vr(e){let t=zr[e];if(t)return t;for(let{pattern:t,price:n}of Br)if(t.test(e))return n}function Hr(e,t,n){let r=Vr(e);if(r)return t/1e6*r.inputPerMillion+n/1e6*r.outputPerMillion}function X(e){return e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function Ur(e){return e.toLocaleString(`en-US`)}const Wr=`Conversation cleared.`;function Gr(t,n){return(0,e.clearConversationHistory)(t),{success:!0,message:Wr,effects:[{type:`conversation-history-cleared`}]}}function Kr(t,n){let r=(0,e.parseSessionNameArgument)(n);return r===void 0?{success:!1,message:e.RENAME_COMMAND_USAGE}:{success:!0,message:`Session renamed to "${r}".`,data:{name:r},effects:[(0,e.createSessionRenamedEffect)(r)]}}function qr(t,n){return{success:!0,message:`Opening session picker...`,data:{triggerResumePicker:!0},effects:[(0,e.createSessionPickerRequestedEffect)()]}}const Jr=`.robota/budget.json`;function Yr(e){let t=(0,r.join)(e,Jr);if(!(0,i.existsSync)(t))return;let n;try{n=(0,i.readFileSync)(t,`utf-8`)}catch{return}try{return JSON.parse(n)}catch{return}}function Xr(e,t){(0,i.mkdirSync)((0,r.join)(e,`.robota`),{recursive:!0}),(0,i.writeFileSync)((0,r.join)(e,Jr),JSON.stringify(t,null,2))}function Zr(e){let t=(0,r.join)(e,Jr);(0,i.existsSync)(t)&&(0,i.writeFileSync)(t,`{}`)}function Qr(t){let n=t.getSession(),r=(0,e.readCommandSessionInfo)(t),i=n.getSessionTokenUsage?.(),a=n.getModelId?.(),o=[`Session: ${r.sessionId}`,`Messages: ${r.messageCount}`],s={sessionId:r.sessionId,messageCount:r.messageCount};if(i){if(o.push(`Tokens: ${Ur(i.inputTokens)} input / ${Ur(i.outputTokens)} output`),s.inputTokens=i.inputTokens,s.outputTokens=i.outputTokens,a){let e=Hr(a,i.inputTokens,i.outputTokens);if(e!==void 0){o.push(`Cost: ${X(e)} (${a})`),s.estimatedCostUsd=e;let n=Yr(t.getCwd());if(n?.monthly){let t=n.monthly-e,r=Math.min(100,Math.round(e/n.monthly*100));o.push(`Budget: ${X(t)} remaining of ${X(n.monthly)}/mo (${r}% used)`),s.budgetMonthly=n.monthly,s.budgetRemainingUsd=t}}}}else o.push(`Tokens: not yet available (no turns completed)`);return{lines:o,data:s}}function $r(e,t){let n=t.trim();if(n.startsWith(`budget`)){let t=n.slice(6).trim();if(t===`clear`)return Zr(e.getCwd()),{success:!0,message:`Monthly budget cleared.`};if(t===``){let t=Yr(e.getCwd());return t?.monthly?{success:!0,message:`Monthly budget: ${X(t.monthly)}`}:{success:!0,message:`No budget set. Use: /cost budget <amount>`}}let r=parseFloat(t);return!Number.isFinite(r)||r<=0?{success:!1,message:`Usage: /cost budget <amount> (e.g. /cost budget 5.00)`}:(Xr(e.getCwd(),{monthly:r}),{success:!0,message:`Monthly budget set to ${X(r)}.`})}let{lines:r,data:i}=Qr(e);return{success:!0,message:r.join(`
58
+ `),data:i}}function ei(t,n){let r=(0,e.validateCommandSessionReplayLog)(t);return{success:r.validation.ok,message:(0,e.formatCommandSessionReplayValidationReport)(r),data:{logFile:r.logFile,entryCount:r.entryCount,issueCount:r.validation.issues.length,ok:r.validation.ok}}}function ti(){return{name:`clear`,displayName:`Clear History`,description:e.CLEAR_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function ni(){return{name:`rename`,displayName:`Rename Session`,description:e.RENAME_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function ri(){return{name:`resume`,displayName:`Resume Session`,description:e.RESUME_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function ii(){return{name:`cost`,displayName:`Session Cost`,description:e.COST_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function ai(){return{name:`validate-session`,displayName:`Validate Session`,description:e.VALIDATE_SESSION_COMMAND_DESCRIPTION,source:`session`,modelInvocable:!1}}function oi(){let e=ti();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Gr}}function si(){let e=ni();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:Kr}}function ci(){let e=ri();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:qr}}function li(){let e=ii();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:$r}}function ui(){let e=ai();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:ei}}var di=class{name=`session`;getCommands(){return[ti(),ni(),ri(),ii(),ai()]}};const fi={clear:{type:`confirm`,message:`Clear conversation history?`}};function pi(){return{name:`agent-command-session`,commandSources:[new di],systemCommands:[oi(),si(),ci(),li(),ui()],interactionHints:fi}}function Z(){return{name:`settings`,displayName:`Settings`,description:`Open transport settings — enable/disable transports and configure options`,source:`settings`,modelInvocable:!1}}function mi(){let e=Z();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,lifecycle:`inline`,execute:async()=>({success:!0,message:`Opening settings...`,effects:[{type:`settings-tui-requested`}]})}}var hi=class{name=`settings`;getCommands(){return[Z()]}};function gi(){return{name:`agent-command-settings`,commandSources:[new hi],systemCommands:[mi()]}}const _i=`Skill command. Before following a matching registered skill from the system prompt Skills section, invoke the projected skills command tool with args "<skill-name> [args]". Without arguments, list registered skills. With a skill name, activate that skill. Slash syntax is a UI input/display concern; the SDK command identity is "skills".`;function vi(e){let t=[];return e.modelInvocable||t.push(`model-disabled`),e.userInvocable||t.push(`model-only`),e.context&&t.push(`context:${e.context}`),e.agent&&t.push(`agent:${e.agent}`),t.length>0?` [${t.join(`, `)}]`:``}function yi(e){let t=e.argumentHint?` ${e.argumentHint}`:``;return`- ${e.name}${t}: ${e.description}${vi(e)}`}function bi(e){return e.length===0?[`No skills are registered for this session.`,``,`Skills are metadata until activated. Do not invent or imitate a skill workflow when no matching registered skill exists.`].join(`
59
+ `):[`Registered skills:`,...e.map(yi),``,`Activation contract:`,`- Use /skills <skill-name> [args] to activate a matching skill.`,`- Treat /<skill-name> as a virtual alias for /skills <skill-name>.`,`- The system prompt Skills section is skill selection metadata.`,`- Treat descriptions as selection metadata only, not as loaded SKILL.md content.`,`- Do not answer by merely naming, recommending, or imitating a matching skill.`,`- If no listed skill matches the task, continue without claiming a skill was activated.`].join(`
60
+ `)}function xi(e){let t=e.trim();if(t.length===0||t===`list`)return{action:`list`,skillArgs:``};let[n=``,...r]=t.split(/\s+/);return n.length===0?{action:`list`,skillArgs:``}:{action:`activate`,skillName:n,skillArgs:r.join(` `)}}async function Si(e,t=``){let n=xi(t);if(n.action===`activate`&&n.skillName!==void 0){if(!e.executeSkillCommandByName)return{success:!1,message:`Skill activation is not available in this session.`};let t=`/${n.skillName}${n.skillArgs?` ${n.skillArgs}`:``}`;return await e.executeSkillCommandByName(n.skillName,n.skillArgs,{invocationSource:e.getCommandInvocationSource?.()??`user`,displayInput:t,rawInput:t})??{success:!1,message:`Unknown skill: ${n.skillName}`}}let r=e.listSkills?.()??[];return{success:!0,message:bi(r),data:{skills:r,activationContract:{activateWith:`/skills <skill-name> [args]`,activationRequiredBeforeWorkflow:!0,metadataIsNotSkillContent:!0}}}}function Ci(){return{name:`skills`,displayName:`Skills`,description:_i,source:`skills`,modelInvocable:!0,userInvocable:!0,argumentHint:`[list | <skill-name> [args]]`,safety:`read-only`}}function wi(){let e=Ci();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!0,argumentHint:e.argumentHint,safety:e.safety,lifecycle:`inline`,execute:Si}}var Ti=class{name=`skills`;getCommands(){return[Ci()]}};function Ei(t){let n=[new Ti];return n.push(new e.SkillCommandSource(t.cwd)),{name:`agent-command-skills`,commandSources:n,systemCommands:[wi()]}}const Di=[`Usage: /statusline on | off | reset | git on | git off`,`Fields: model, context, permission mode, message count, session name, thinking state, git branch.`].join(`
61
+ `);function Oi(t){let n=t.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0),[r,i]=n;return r===`on`&&i===void 0?{success:!0,message:`Status line enabled.`,patch:{enabled:!0}}:r===`off`&&i===void 0?{success:!0,message:`Status line disabled.`,patch:{enabled:!1}}:r===`reset`&&i===void 0?{success:!0,message:`Status line settings reset.`,patch:{...e.DEFAULT_STATUS_LINE_COMMAND_SETTINGS}}:r===`git`&&i===`on`&&n.length===2?{success:!0,message:`Status line git branch shown.`,patch:{gitBranch:!0}}:r===`git`&&i===`off`&&n.length===2?{success:!0,message:`Status line git branch hidden.`,patch:{gitBranch:!1}}:{success:!1,message:Di}}function ki(e,t){let n=Oi(t);return n.success?{success:!0,message:n.message,effects:[{type:`statusline-settings-patch`,patch:n.patch}]}:{success:!1,message:n.message}}function Ai(){return{name:`statusline`,displayName:`Status Line`,description:e.STATUSLINE_COMMAND_DESCRIPTION,source:`statusline`,argumentHint:e.STATUSLINE_COMMAND_ARGUMENT_HINT,subcommands:(0,e.buildStatusLineCommandSubcommands)(`statusline`),modelInvocable:!1}}function ji(){let e=Ai();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,subcommands:e.subcommands,lifecycle:`inline`,execute:ki}}var Mi=class{name=`statusline`;getCommands(){return[Ai()]}};function Ni(){return{name:`agent-command-statusline`,commandSources:[new Mi],systemCommands:[ji()]}}const Pi=`Inspect Robota user-local storage and memory state.`,Fi=`storage list [--format json] | memory set/list/inspect/disable/delete`,Q=`Usage: user-local storage list [--format json] | user-local memory set <category> <key> <value> --summary <summary> --source <source> | user-local memory list [--format json] | user-local memory inspect <category> <key> [--format json] | user-local memory disable <category> <key> | user-local memory delete <category> <key>`;function Ii(e){return e.length===0?`No user-local memory items.`:e.map(e=>`- ${e.category}/${e.key} (${e.enabled?`enabled`:`disabled`})`).join(`
62
+ `)}function $(e){if(e===void 0)throw Error(`User-local memory category is required.`);return e}async function Li(t,n){let r=await(0,e.listUserLocalMemoryItems)({activeRepositoryRoot:t});return{message:n.format===`json`?JSON.stringify(r,null,2):Ii(r.items),success:!0,data:{list:r}}}async function Ri(t,n){let[r,i,a]=n.positional,o=await(0,e.setUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``,value:a??``,summary:n.summary??``,source:n.source??``});return{message:`Stored user-local memory item ${o.category}/${o.key} at ${o.storageLocation}`,success:!0,data:{item:o}}}async function zi(t,n){let[r,i]=n.positional,a=await(0,e.inspectUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``});return{message:n.format===`json`?JSON.stringify(a,null,2):`${a.category}/${a.key}: ${a.summary}`,success:!0,data:{item:a}}}async function Bi(t,n){let[r,i]=n.positional,a=await(0,e.disableUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``});return{message:`Disabled user-local memory item ${a.category}/${a.key}`,success:!0,data:{item:a}}}async function Vi(t,n){let[r,i]=n.positional,a=await(0,e.deleteUserLocalMemoryItem)({activeRepositoryRoot:t,category:$(r),key:i??``});return{message:`Deleted user-local memory item ${a.category}/${a.key}`,success:!0,data:{result:a}}}async function Hi(e,t){return(t.action??`list`)===`list`?Li(e,t):t.action===`set`?Ri(e,t):t.action===`inspect`?zi(e,t):t.action===`disable`?Bi(e,t):t.action===`delete`?Vi(e,t):{message:Q,success:!1}}function Ui(e){if(e===void 0||e===`text`)return`text`;if(e===`json`)return`json`;throw Error(`Unsupported user-local output format: ${e}`)}function Wi(e,t,n){return e===`--format`?{format:t[n+1],nextIndex:n+1}:e.startsWith(`--format=`)?{format:e.slice(9),nextIndex:n}:e===`--summary`?{summary:t[n+1],nextIndex:n+1}:e.startsWith(`--summary=`)?{summary:e.slice(10),nextIndex:n}:e===`--source`?{source:t[n+1],nextIndex:n+1}:e.startsWith(`--source=`)?{source:e.slice(9),nextIndex:n}:null}function Gi(e,t={}){let n=t.format,r=t.summary,i=t.source,a=[];for(let t=0;t<e.length;t+=1){let o=e[t],s=Wi(o,e,t);if(s!==null){n=s.format??n,r=s.summary??r,i=s.source??i,t=s.nextIndex;continue}a.push(o)}return{target:a[0],action:a[1],positional:a.slice(2),format:Ui(n),summary:r,source:i}}function Ki(e){return e.trim().split(/\s+/).filter(Boolean)}function qi(e,t){let n=t.map(e=>`- ${e.category}`);return[`User-local storage root: ${e}`,`Categories:`,...n].join(`
63
+ `)}async function Ji(t,n){if((n.action??`list`)!==`list`)return{message:Q,success:!1};let r=await(0,e.inspectUserLocalStorage)({activeRepositoryRoot:t});return{message:n.format===`json`?JSON.stringify(r,null,2):qi(r.root,r.categories),success:!0,data:{root:r.root,categories:r.categories,inspection:r}}}async function Yi(e,t){return t.target===`storage`?Ji(e,t):t.target===`memory`?Hi(e,t):{message:Q,success:!1}}function Xi(e){return e.includes(`ENOENT`)?`User-local memory item not found.`:e}async function Zi(e){try{return await Yi(e.cwd,Gi(e.argv,{format:e.format,summary:e.summary,source:e.source}))}catch(e){return{message:Xi(e instanceof Error?e.message:String(e)),success:!1}}}async function Qi(e,t){try{return await Yi(e.getCwd(),Gi(Ki(t)))}catch(e){return{message:Xi(e instanceof Error?e.message:String(e)),success:!1}}}function $i(){return{name:`user-local`,displayName:`User Config`,description:Pi,source:`user-local`,argumentHint:Fi,modelInvocable:!1,safety:`read-only`,subcommands:[{name:`storage`,description:`Inspect user-local storage categories`,source:`user-local`},{name:`memory`,description:`Inspect and manage user-local memory items`,source:`user-local`}]}}function ea(){let e=$i();return{name:e.name,displayName:e.displayName,description:e.description,requiresPermission:!1,userInvocable:!0,modelInvocable:!1,argumentHint:e.argumentHint,safety:e.safety,subcommands:e.subcommands,execute:Qi}}var ta=class{name=`user-local`;getCommands(){return[$i()]}};function na(){return{name:`agent-command-user-local`,commandSources:[new ta],systemCommands:[ea()]}}function ra(e,t,n){let r=e;if(t!==void 0){let e=new Set(t);r=r.filter(t=>e.has(t.name))}if(n!==void 0){let e=new Set(n);r=r.filter(t=>!e.has(t.name))}return r}function ia({cwd:e,providerDefinitions:t,providerSettingsAdapter:n,enabledCommandModules:r,disabledCommandModules:i}){return ra([Ei({cwd:e}),at(),ye(),Mt(),Ot(),tn(),dt(),Te(),Ct(),na(),je(),Je(),et(),pi(),fr(),Er(),Rr(),Ni(),Kt(),gi(),rr({providerDefinitions:t,settings:n})],r,i)}function aa(t){let n=(0,o.homedir)(),i=(0,r.join)(n,`.robota`,`plugins`),s=(0,r.join)(n,`.robota`,`settings.json`),c=(e,t)=>(0,a.execSync)(e,{timeout:t.timeout,stdio:t.stdio??`pipe`}),l=new e.PluginSettingsStore(s),u=new e.MarketplaceClient({pluginsDir:i,exec:c});return{cwd:t,marketplace:u,installer:new e.BundlePluginInstaller({pluginsDir:i,settingsStore:l,marketplaceClient:u,exec:c}),loader:new e.BundlePluginLoader(i),settingsStore:l}}async function oa(e){let t=await e.loader.loadAll(),n=e.settingsStore.getEnabledPlugins();return t.map(e=>{let t=e.pluginDir.split(`/`),r=t.indexOf(`cache`),i=r>=0?t[r+1]??``:``,a=i?`${e.manifest.name}@${i}`:e.manifest.name;return{name:a,description:e.manifest.description,enabled:n[a]!==!1&&n[e.manifest.name]!==!1}})}async function sa(e,t){let n;try{n=e.marketplace.fetchManifest(t)}catch{return[]}let r=e.installer.getInstalledPlugins(),i=new Set(Object.values(r).map(e=>e.pluginName));return n.plugins.map(e=>({name:e.name,description:e.description,installed:i.has(e.name)}))}async function ca(t,n,i){let[o,s]=n.split(`@`);if(!o||!s)throw Error(`Plugin ID must be in format: name@marketplace`);if(i===`project`){let n=(0,r.join)(t.cwd,`.robota`,`plugins`);await new e.BundlePluginInstaller({pluginsDir:n,settingsStore:t.settingsStore,marketplaceClient:t.marketplace,exec:(e,t)=>(0,a.execSync)(e,{timeout:t.timeout,stdio:t.stdio??`pipe`})}).install(o,s);return}await t.installer.install(o,s)}async function la(e,t){let n=e.installer.getPluginsByMarketplace(t);for(let t of n)await e.installer.uninstall(`${t.pluginName}@${t.marketplace}`);e.marketplace.removeMarketplace(t)}function ua(e){return e.marketplace.listMarketplaces().map(e=>({name:e.name,type:e.source.type}))}function da(e){let t=aa(e);return{listInstalled:()=>oa(t),listAvailablePlugins:e=>sa(t,e),install:(e,n)=>ca(t,e,n),uninstall:async e=>t.installer.uninstall(e),enable:async e=>t.installer.enable(e),disable:async e=>t.installer.disable(e),marketplaceAdd:async e=>e.includes(`/`)&&!e.includes(`:`)?t.marketplace.addMarketplace({type:`github`,repo:e}):t.marketplace.addMarketplace({type:`git`,url:e}),marketplaceRemove:e=>la(t,e),marketplaceUpdate:async e=>t.marketplace.updateMarketplace(e),marketplaceList:async()=>ua(t),reloadPlugins:async()=>({loadedPluginCount:(await t.loader.loadAll()).length})}}const fa=`plugin`;function pa(){return process.env.HOME??(0,o.homedir)()}function ma(t){let n=new e.BundlePluginLoader((0,r.join)(pa(),`.robota`,`plugins`));try{let r=n.loadPluginsSync();return r.length===0?(t.replaceSource(fa),0):(t.replaceSource(fa,new e.PluginCommandSource(r)),r.length)}catch{return t.replaceSource(fa),0}}exports.AgentCommandSource=ve,exports.BackgroundCommandSource=we,exports.CLEAR_COMMAND_MESSAGE=Wr,exports.CompactCommandSource=Ae,exports.ContextCommandSource=qe,exports.ExitCommandSource=Qe,exports.HelpCommandSource=it,exports.LanguageCommandSource=lt,exports.MemoryCommandSource=St,exports.ModeCommandSource=Et,exports.PermissionsCommandSource=jt,exports.PluginManagerCommandSource=Gt,exports.PresetCommandSource=$t,exports.ProviderCommandSource=er,exports.RewindCommandSource=Tr,exports.SKILLS_COMMAND_DESCRIPTION=_i,exports.STATUSLINE_USAGE=Di,exports.ScheduleCommandSource=Lr,exports.SessionCommandSource=di,exports.SettingsCommandSource=hi,exports.SkillsCommandSource=Ti,exports.StatusLineCommandSource=Mi,exports.USER_LOCAL_COMMAND_ARGUMENT_HINT=Fi,exports.USER_LOCAL_COMMAND_DESCRIPTION=Pi,exports.USER_LOCAL_COMMAND_USAGE=Q,exports.UserLocalCommandSource=ta,exports.createAgentCommandEntry=g,exports.createAgentCommandModule=ye,exports.createAgentSystemCommand=_e,exports.createBackgroundCommandEntry=Se,exports.createBackgroundCommandModule=Te,exports.createClearCommandEntry=ti,exports.createCompactCommandEntry=Oe,exports.createCompactCommandModule=je,exports.createContextCommandEntry=w,exports.createContextCommandModule=Je,exports.createCostCommandEntry=ii,exports.createDefaultCommandModules=ia,exports.createDefaultPluginCommandAdapter=da,exports.createExitCommandEntry=Xe,exports.createExitCommandModule=et,exports.createHelpCommandEntry=nt,exports.createHelpCommandModule=at,exports.createLanguageCommandEntry=st,exports.createLanguageCommandModule=dt,exports.createMemoryCommandEntry=D,exports.createMemoryCommandModule=Ct,exports.createModeCommandEntry=O,exports.createModeCommandModule=Ot,exports.createMonitorCommandEntry=Pr,exports.createPermissionsCommandEntry=k,exports.createPermissionsCommandModule=Mt,exports.createPluginCommandEntry=N,exports.createPluginCommandModule=Kt,exports.createPresetCommandEntry=F,exports.createPresetCommandModule=tn,exports.createProviderCommandEntry=W,exports.createProviderCommandModule=rr,exports.createProviderSetupFlow=I,exports.createReloadPluginsCommandEntry=P,exports.createRenameCommandEntry=ni,exports.createResetCommandEntry=G,exports.createResetCommandModule=fr,exports.createResumeCommandEntry=ri,exports.createRewindCommandModule=Er,exports.createScheduleCommandEntry=Y,exports.createScheduleCommandModule=Rr,exports.createSessionCommandModule=pi,exports.createSettingsCommandEntry=Z,exports.createSettingsCommandModule=gi,exports.createSkillsCommandEntry=Ci,exports.createSkillsCommandModule=Ei,exports.createStatusLineCommandEntry=Ai,exports.createStatusLineCommandModule=Ni,exports.createUserLocalCommandEntry=$i,exports.createUserLocalCommandModule=na,exports.createValidateSessionCommandEntry=ai,exports.ensureProviderConfig=or,exports.executeAgentCommand=pe,exports.executeBackgroundCommand=xe,exports.executeClearCommand=Gr,exports.executeCompactCommand=De,exports.executeContextCommand=Ne,exports.executeCostCommand=$r,exports.executeExitCommand=Ye,exports.executeHelpCommand=tt,exports.executeLanguageCommand=ot,exports.executeMemoryCommand=bt,exports.executeModeCommand=wt,exports.executeMonitorCommand=Mr,exports.executePermissionsCommand=kt,exports.executePluginCommand=Vt,exports.executePresetCommand=Xt,exports.executeProviderCommand=qn,exports.executeReloadPluginsCommand=Ht,exports.executeRenameCommand=Kr,exports.executeResetCommand=lr,exports.executeResumeCommand=qr,exports.executeRewindCommand=Sr,exports.executeScheduleCommand=Ar,exports.executeSkillsCommand=Si,exports.executeStatusLineCommand=ki,exports.executeUserLocalCommand=Qi,exports.executeUserLocalDirectCommand=Zi,exports.executeValidateSessionCommand=ei,exports.formatProviderSetupChoiceLabel=z,exports.formatProviderSetupHelpLinks=B,exports.formatProviderSetupPromptLabel=on,exports.formatProviderSetupSelectionPrompt=nn,exports.getProviderSetupStep=L,exports.parseScheduleSpec=Or,exports.reloadPluginCommandSource=ma,exports.resolveProviderSetupSelection=rn,exports.runProviderSetupPromptFlow=an,exports.runProviderStartupSetup=ar,exports.submitProviderSetupValue=R,exports.validateProviderSetupValue=V;
@@ -1,4 +1,5 @@
1
- import { CommandRegistry, IAgentJobHostContext, ICommand, ICommandHostContext, ICommandModule, ICommandPluginAdapter, ICommandResult, ICommandSource, IProviderCommandModuleOptions, IProviderCommandModuleOptions as IProviderCommandModuleOptions$1, IProviderCommandModuleOptions as IProviderCommandModuleOptions$2, IProviderCommandSettingsAdapter, IProviderCommandSettingsAdapter as IProviderCommandSettingsAdapter$1, IProviderSetupInput, ISystemCommand, TSettingsScope } from "@robota-sdk/agent-framework";
1
+ import { CommandRegistry, IAgentJobHostContext, ICommandHostContext, ICommandModule, IProviderCommandModuleOptions, IProviderCommandModuleOptions as IProviderCommandModuleOptions$1, IProviderCommandModuleOptions as IProviderCommandModuleOptions$2, IProviderCommandSettingsAdapter, IProviderCommandSettingsAdapter as IProviderCommandSettingsAdapter$1, IProviderSetupInput, ISystemCommand, TSettingsScope } from "@robota-sdk/agent-framework";
2
+ import { ICommand, ICommandPluginAdapter, ICommandResult, ICommandSource } from "@robota-sdk/agent-interface-transport";
2
3
  import { IProviderDefinition, IProviderSetupHelpLink, IProviderSetupStepDefinition, ITerminalOutput, TProviderSetupField } from "@robota-sdk/agent-core";
3
4
 
4
5
  //#region src/agent/agent-command-module.d.ts
@@ -18,11 +19,23 @@ interface IDefaultCommandModulesOptions {
18
19
  cwd: string;
19
20
  providerDefinitions: readonly IProviderDefinition[];
20
21
  providerSettingsAdapter: IProviderCommandSettingsAdapter$1;
22
+ /**
23
+ * Whitelist of module `name`s to keep. When provided, only modules whose `name`
24
+ * appears here survive. Omitted → all modules kept (no-regression).
25
+ */
26
+ enabledCommandModules?: readonly string[];
27
+ /**
28
+ * Blacklist of module `name`s to remove. Applied after the whitelist, so a name
29
+ * present in both is removed (deny > allow). Omitted → no modules removed.
30
+ */
31
+ disabledCommandModules?: readonly string[];
21
32
  }
22
33
  declare function createDefaultCommandModules({
23
34
  cwd,
24
35
  providerDefinitions,
25
- providerSettingsAdapter
36
+ providerSettingsAdapter,
37
+ enabledCommandModules,
38
+ disabledCommandModules
26
39
  }: IDefaultCommandModulesOptions): readonly ICommandModule[];
27
40
  //#endregion
28
41
  //#region src/background/background-command-module.d.ts
@@ -137,6 +150,17 @@ declare function createPluginCommandModule(): ICommandModule;
137
150
  declare function executePluginCommand(context: ICommandHostContext, args: string): Promise<ICommandResult>;
138
151
  declare function executeReloadPluginsCommand(context: ICommandHostContext, _args: string): Promise<ICommandResult>;
139
152
  //#endregion
153
+ //#region src/preset/preset-command-module.d.ts
154
+ declare function createPresetCommandEntry(): ICommand;
155
+ declare class PresetCommandSource implements ICommandSource {
156
+ readonly name = "preset";
157
+ getCommands(): ICommand[];
158
+ }
159
+ declare function createPresetCommandModule(): ICommandModule;
160
+ //#endregion
161
+ //#region src/preset/preset-command.d.ts
162
+ declare function executePresetCommand(context: ICommandHostContext, args: string): ICommandResult;
163
+ //#endregion
140
164
  //#region src/provider/provider-command-module.d.ts
141
165
  declare function createProviderCommandEntry(): ICommand;
142
166
  declare class ProviderCommandSource implements ICommandSource {
@@ -200,6 +224,8 @@ interface IProviderStartupContext {
200
224
  interface IEnsureProviderConfigOptions {
201
225
  formatError: (defs: readonly IProviderDefinition[]) => string;
202
226
  isInteractive?: () => boolean;
227
+ /** Environment map for env-default synthesis (test seam, default: process.env). */
228
+ env?: Record<string, string | undefined>;
203
229
  }
204
230
  declare function runProviderStartupSetup(cwd: string, ctx: IProviderStartupContext, promptInput: TPromptInput, terminal: ITerminalOutput, providerDefinitions: readonly IProviderDefinition[]): Promise<void>;
205
231
  declare function ensureProviderConfig(cwd: string, ctx: IProviderStartupContext, promptInput: TPromptInput, terminal: ITerminalOutput, providerDefinitions: readonly IProviderDefinition[], options: IEnsureProviderConfigOptions): Promise<void>;
@@ -221,6 +247,41 @@ declare function createRewindCommandModule(): ICommandModule;
221
247
  //#region src/rewind/rewind-command.d.ts
222
248
  declare function executeRewindCommand(context: ICommandHostContext, rawArgs: string): Promise<ICommandResult>;
223
249
  //#endregion
250
+ //#region src/schedule/schedule-command-module.d.ts
251
+ declare function createScheduleCommandEntry(): ICommand;
252
+ declare function createMonitorCommandEntry(): ICommand;
253
+ declare class ScheduleCommandSource implements ICommandSource {
254
+ readonly name = "schedule";
255
+ getCommands(): ICommand[];
256
+ }
257
+ declare function createScheduleCommandModule(): ICommandModule;
258
+ //#endregion
259
+ //#region src/schedule/schedule-command.d.ts
260
+ declare function executeScheduleCommand(host: IAgentJobHostContext, args: string, now?: number): Promise<ICommandResult>;
261
+ declare function executeMonitorCommand(host: IAgentJobHostContext, args: string): Promise<ICommandResult>;
262
+ //#endregion
263
+ //#region src/schedule/schedule-spec-parser.d.ts
264
+ /**
265
+ * FLOW-005: parse the `<when>` portion of `/schedule` into a cron expression croner accepts.
266
+ *
267
+ * Two forms:
268
+ * in <N><unit> <instruction> — one-shot, fires once at now + duration (s|m|h|d)
269
+ * cron "<expr>" <instruction> — recurring, a standard cron expression
270
+ */
271
+ interface IScheduleSpec {
272
+ cronExpression: string;
273
+ instruction: string;
274
+ recurring: boolean;
275
+ }
276
+ type TScheduleParseResult = {
277
+ ok: true;
278
+ spec: IScheduleSpec;
279
+ } | {
280
+ ok: false;
281
+ error: string;
282
+ };
283
+ declare function parseScheduleSpec(args: string, now: number): TScheduleParseResult;
284
+ //#endregion
224
285
  //#region src/session/session-command.d.ts
225
286
  declare const CLEAR_COMMAND_MESSAGE = "Conversation cleared.";
226
287
  declare function executeClearCommand(context: ICommandHostContext, _args: string): ICommandResult;
@@ -306,5 +367,5 @@ declare function createDefaultPluginCommandAdapter(cwd: string): ICommandPluginA
306
367
  //#region src/plugins/default-plugin-command-source-loader.d.ts
307
368
  declare function reloadPluginCommandSource(registry: CommandRegistry): number;
308
369
  //#endregion
309
- export { AgentCommandSource, BackgroundCommandSource, CLEAR_COMMAND_MESSAGE, CompactCommandSource, ContextCommandSource, ExitCommandSource, HelpCommandSource, type IDefaultCommandModulesOptions, type IEnsureProviderConfigOptions, type IProviderCommandModuleOptions, type IProviderCommandSettingsAdapter, type IProviderSetupFlowOptions, type IProviderSetupFlowState, type IProviderSetupPromptStep, type IProviderStartupContext, type IUserLocalDirectCommandOptions, LanguageCommandSource, MemoryCommandSource, ModeCommandSource, PermissionsCommandSource, PluginManagerCommandSource, ProviderCommandSource, RewindCommandSource, SKILLS_COMMAND_DESCRIPTION, STATUSLINE_USAGE, SessionCommandSource, SettingsCommandSource, SkillsCommandSource, StatusLineCommandSource, type TPromptInput, type TProviderSetupFlowSubmitResult, type TProviderSetupType, USER_LOCAL_COMMAND_ARGUMENT_HINT, USER_LOCAL_COMMAND_DESCRIPTION, USER_LOCAL_COMMAND_USAGE, UserLocalCommandSource, createAgentCommandEntry, createAgentCommandModule, createAgentSystemCommand, createBackgroundCommandEntry, createBackgroundCommandModule, createClearCommandEntry, createCompactCommandEntry, createCompactCommandModule, createContextCommandEntry, createContextCommandModule, createCostCommandEntry, createDefaultCommandModules, createDefaultPluginCommandAdapter, createExitCommandEntry, createExitCommandModule, createHelpCommandEntry, createHelpCommandModule, createLanguageCommandEntry, createLanguageCommandModule, createMemoryCommandEntry, createMemoryCommandModule, createModeCommandEntry, createModeCommandModule, createPermissionsCommandEntry, createPermissionsCommandModule, createPluginCommandEntry, createPluginCommandModule, createProviderCommandEntry, createProviderCommandModule, createProviderSetupFlow, createReloadPluginsCommandEntry, createRenameCommandEntry, createResetCommandEntry, createResetCommandModule, createResumeCommandEntry, createRewindCommandModule, createSessionCommandModule, createSettingsCommandEntry, createSettingsCommandModule, createSkillsCommandEntry, createSkillsCommandModule, createStatusLineCommandEntry, createStatusLineCommandModule, createUserLocalCommandEntry, createUserLocalCommandModule, createValidateSessionCommandEntry, ensureProviderConfig, executeAgentCommand, executeBackgroundCommand, executeClearCommand, executeCompactCommand, executeContextCommand, executeCostCommand, executeExitCommand, executeHelpCommand, executeLanguageCommand, executeMemoryCommand, executeModeCommand, executePermissionsCommand, executePluginCommand, executeProviderCommand, executeReloadPluginsCommand, executeRenameCommand, executeResetCommand, executeResumeCommand, executeRewindCommand, executeSkillsCommand, executeStatusLineCommand, executeUserLocalCommand, executeUserLocalDirectCommand, executeValidateSessionCommand, formatProviderSetupChoiceLabel, formatProviderSetupHelpLinks, formatProviderSetupPromptLabel, formatProviderSetupSelectionPrompt, getProviderSetupStep, reloadPluginCommandSource, resolveProviderSetupSelection, runProviderSetupPromptFlow, runProviderStartupSetup, submitProviderSetupValue, validateProviderSetupValue };
370
+ export { AgentCommandSource, BackgroundCommandSource, CLEAR_COMMAND_MESSAGE, CompactCommandSource, ContextCommandSource, ExitCommandSource, HelpCommandSource, type IDefaultCommandModulesOptions, type IEnsureProviderConfigOptions, type IProviderCommandModuleOptions, type IProviderCommandSettingsAdapter, type IProviderSetupFlowOptions, type IProviderSetupFlowState, type IProviderSetupPromptStep, type IProviderStartupContext, type IScheduleSpec, type IUserLocalDirectCommandOptions, LanguageCommandSource, MemoryCommandSource, ModeCommandSource, PermissionsCommandSource, PluginManagerCommandSource, PresetCommandSource, ProviderCommandSource, RewindCommandSource, SKILLS_COMMAND_DESCRIPTION, STATUSLINE_USAGE, ScheduleCommandSource, SessionCommandSource, SettingsCommandSource, SkillsCommandSource, StatusLineCommandSource, type TPromptInput, type TProviderSetupFlowSubmitResult, type TProviderSetupType, type TScheduleParseResult, USER_LOCAL_COMMAND_ARGUMENT_HINT, USER_LOCAL_COMMAND_DESCRIPTION, USER_LOCAL_COMMAND_USAGE, UserLocalCommandSource, createAgentCommandEntry, createAgentCommandModule, createAgentSystemCommand, createBackgroundCommandEntry, createBackgroundCommandModule, createClearCommandEntry, createCompactCommandEntry, createCompactCommandModule, createContextCommandEntry, createContextCommandModule, createCostCommandEntry, createDefaultCommandModules, createDefaultPluginCommandAdapter, createExitCommandEntry, createExitCommandModule, createHelpCommandEntry, createHelpCommandModule, createLanguageCommandEntry, createLanguageCommandModule, createMemoryCommandEntry, createMemoryCommandModule, createModeCommandEntry, createModeCommandModule, createMonitorCommandEntry, createPermissionsCommandEntry, createPermissionsCommandModule, createPluginCommandEntry, createPluginCommandModule, createPresetCommandEntry, createPresetCommandModule, createProviderCommandEntry, createProviderCommandModule, createProviderSetupFlow, createReloadPluginsCommandEntry, createRenameCommandEntry, createResetCommandEntry, createResetCommandModule, createResumeCommandEntry, createRewindCommandModule, createScheduleCommandEntry, createScheduleCommandModule, createSessionCommandModule, createSettingsCommandEntry, createSettingsCommandModule, createSkillsCommandEntry, createSkillsCommandModule, createStatusLineCommandEntry, createStatusLineCommandModule, createUserLocalCommandEntry, createUserLocalCommandModule, createValidateSessionCommandEntry, ensureProviderConfig, executeAgentCommand, executeBackgroundCommand, executeClearCommand, executeCompactCommand, executeContextCommand, executeCostCommand, executeExitCommand, executeHelpCommand, executeLanguageCommand, executeMemoryCommand, executeModeCommand, executeMonitorCommand, executePermissionsCommand, executePluginCommand, executePresetCommand, executeProviderCommand, executeReloadPluginsCommand, executeRenameCommand, executeResetCommand, executeResumeCommand, executeRewindCommand, executeScheduleCommand, executeSkillsCommand, executeStatusLineCommand, executeUserLocalCommand, executeUserLocalDirectCommand, executeValidateSessionCommand, formatProviderSetupChoiceLabel, formatProviderSetupHelpLinks, formatProviderSetupPromptLabel, formatProviderSetupSelectionPrompt, getProviderSetupStep, parseScheduleSpec, reloadPluginCommandSource, resolveProviderSetupSelection, runProviderSetupPromptFlow, runProviderStartupSetup, submitProviderSetupValue, validateProviderSetupValue };
310
371
  //# sourceMappingURL=index.d.ts.map