Lines 53-93javascript
54`},_meta:{"hydra-acp":{synthetic:!0}}}}),{stopReason:"end_turn"}}let s=this.agentAdvertisedModes;if(s.length>0&&!s.some(r=>r.id===t)){let r=s.map(o=>o.id).join(", ");throw ne(new Error(`unknown mode: ${t} (known: ${r})`),k.InvalidParams)}return await this.forwardRequest("session/set_mode",{sessionId:this.sessionId,modeId:t}),this.applyModeChange(t),{stopReason:"end_turn"}}async handleConfigCommand(e){let t=e.slice(7).trim().match(/^(\S+)(?:\s+([\s\S]*))?$/),s=t?.[1],r=t?.[2]??"";if(!s){let d=this.buildConfigOptions();if(d.length===0)return this.recordAndBroadcast("session/update",{sessionId:th ...
55_(no config options advertised yet)_
56`},_meta:{"hydra-acp":{synthetic:!0}}}}),{stopReason:"end_turn"};let l=d.map(p=>Pr(p));return this.recordAndBroadcast("session/update",{sessionId:this.upstreamSessionId,update:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:`
60`},_meta:{"hydra-acp":{synthetic:!0}}}}),{stopReason:"end_turn"}}let o=this.buildConfigOptions(),i=o.find(d=>d.id===s);if(!i){let d=o.map(l=>l.id).join(`
61 `);return this.recordAndBroadcast("session/update",{sessionId:this.upstreamSessionId,update:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:`
62"${s}" is not a known config option.
65`},_meta:{"hydra-acp":{synthetic:!0}}}}),{stopReason:"end_turn"}}if(!r)return this.recordAndBroadcast("session/update",{sessionId:this.upstreamSessionId,update:{sessionUpdate:"agent_message_chunk",content:{type:"text",text:`
67`},_meta:{"hydra-acp":{synthetic:!0}}}}),{stopReason:"end_turn"};let a=i.options.map(d=>d.value),u=Nn(r,a),c=r;if(u.kind==="resolved")c=u.modelId;else if(u.kind==="ambiguous"||u.kind==="unknown"){let d=r.toLowerCase(),l=u.kind==="ambiguous"?u.candidates:a.filter(g=>g.toLowerCase().includes(d)),p=l.length>0?l:a,f=u.kind==="ambiguous"?`"${r}" matches multiple values for "${s}": ${u.candidates.join(", ")}`:l.length>0?`"${r}" is not a valid value for "${s}". Did you mean`:`"${r}" is not a valid value for "${s}"`,m=u.kind==="ambiguous"||l.length===0?"Valid values":"Matching values";return this.reco ...
72`},_meta:{"hydra-acp":{synthetic:!0}}}}),{stopReason:"end_turn"}}return s==="model"?(c!==this.currentModel&&await this.forwardRequest("session/set_model",{sessionId:this.sessionId,modelId:c}),this.applyModelChange(c),{stopReason:"end_turn"}):s==="mode"?(c!==this.currentMode&&await this.forwardRequest(
73`)),{stopReason:"end_turn"}}runUncompactCommand(){return this.enqueuePrompt(()=>this.runUncompactCommandInline())}async runUncompactCommandInline(){if(!this.uncompactHook)return this.emitExtensionReply("Rollback not available: uncompact hook not configured for this session."),{stopReason:"end_turn"};try{await this.uncompactHook(),this.emitExtensionReply("Rolled back to pre-compaction upstream. The session is now using the previous agent context.")}catch(e){this.emitExtensionReply(`Rollback failed: ${e instanceof Error?e.message:String(e)}`)}return{stopReason:"end_turn"}}async forceCancel(){if( ...
74`)}async seedFromImport(){await this.enqueuePrompt(async()=>{let e=await this.buildSwitchTranscript(this.agentId,{intro:"You are continuing a conversation that was imported from another hydra. Below is the transcript so far.",followup:"Each line is prefixed with its speaker. Treat this as context for the next user message; do not re-respond to earlier turns."});e&&await this.runInternalPrompt(e).catch(()=>{})})}async seedFromFork(e){await this.enqueuePrompt(
75`)&&t.startsWith("/")?t.split(/\s+/)[0]??"":"",r=s.startsWith("/")?s.slice(1):"",o=r.length>0&&this.aliasableBareVerbs().has(r);if(s==="/model"||s==="/mode"||s==="/sessions"||s==="/help"||s==="/hydra"||o){let a;if(s==="/sessions")a=await this.handleSessionsCommand();else if(s==="/help")a=await this.handleHelpCommand();else if(s==="/mode")a=await this.handleModeCommand(t);else if(s==="/model")a=await this.handleModelCommand(t);else if(o){let u=t.slice(s.length).trim(),c=u?`/hydra ${r} ${u}`:`/hydra ${r}`;a=await this.handleSlashCommand(c,e.messageId)}else a=await this.handleSlashCommand(t,e.mes ...
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/index.jsView on unpkg · L73 77`)}`}function Wn(n,e){for(let t of n.split(/\r?\n/)){let s=t.trim();if(s)return s.length>e?`${s.slice(0,e)}\u2026`
79 "title": "short summary, max 80 chars",
81 "goal": "the user's original ask",
82 "outcome": "what was concluded or shipped",
83 "rejected_approaches": ["things tried and abandoned"],
84 "open_threads": ["work started but not finished"]
87Use empty arrays/strings where a field doesn't apply.`;function Br(n){let e=n.trim();if(e.length===0)return;let t=Ve(e);if(t===void 0){let o=e.indexOf("{"),i=e.lastIndexOf("}");o>=0&&i>o&&(t=Ve(e.slice(o,i+1)))}if(t===void 0){let o=Dr(e);o!==void 0&&(t=Ve(o))}if(t===void 0||t===null||typeof t!="object")return;let s=t,r={};if(typeof s.title=="string"){let o=s.title.trim();o.length>0&&(r.title=o.slice(0,jr))}if(s.synopsis!==void 0&&s.synopsis!==null){let o=ft.safeParse(s.synopsis);o.success&&fd(o.data)&&(r.synopsis=o.data)}if(!(r.title===void 0&&r.synopsis===void 0))return r}var Vn=`Reply with O ...
89 "title": "short summary, max 80 chars",
90 "goal": "the user's original ask",
91 "outcome": "what was concluded or shipped",
92 "rejected_approaches": ["things tried and abandoned"],
93 "open_threads": ["work started but not finished"],
Long lines were clipped for display.