@flowe-ai/cli 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -8
- package/dist/{chunk-ZP43LZEQ.js → chunk-3KM7AYV7.js} +4 -4
- package/dist/chunk-DX2IZG3L.js +1 -0
- package/dist/chunk-JTAA4OAX.js +1 -0
- package/dist/{chunk-3HG2U5YK.js → chunk-M56P7SDZ.js} +1 -1
- package/dist/cli.js +59 -58
- package/dist/{login-Q4QMATEN.js → login-IDFOVWCU.js} +2 -2
- package/dist/mcp-server.js +9 -9
- package/dist/me-6WIWKE2Q.js +1 -0
- package/dist/session-client-XHJ2MGA5.js +1 -0
- package/dist/{setup-harness-RR77VO5C.js → setup-harness-DWVJK4N5.js} +1 -1
- package/dist/ui/live-session.html +1 -1
- package/dist/ui/micro.html +6 -6
- package/package.json +1 -1
- package/skills/flowe/SKILL.md +3 -2
- package/dist/chunk-EC5WRPZP.js +0 -1
- package/dist/chunk-QVIYCUHZ.js +0 -1
- package/dist/me-SZLS6RWX.js +0 -1
- package/dist/session-client-74I2RBYA.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{a as p,j as f}from"./chunk-
|
|
1
|
+
import{a as p,j as f}from"./chunk-DX2IZG3L.js";function a(t,o){return Object.assign(new Error(o),{code:t})}async function h(t){try{let{spawn:o}=await import("child_process"),{platform:i}=await import("process"),[n,...c]=i==="darwin"?["open",t]:i==="win32"?["cmd","/c","start",'""',t]:["xdg-open",t];return o(n,c,{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}function _(t){return new Promise(o=>setTimeout(o,t))}async function R(t={}){let o=p(),i=t.fetch??globalThis.fetch,n=t.write??(e=>process.stdout.write(e)),c=t.openBrowser??h,d=t.sleep??_,u=t.now??(()=>Date.now()),g=t.maxWaitSeconds??900,s;try{let e=await i(`${o.backend_url}/api/v1/cli/auth/start`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!e.ok)throw a("START_FAILED",`server returned ${e.status} when requesting device code`);s=await e.json()}catch(e){let r=e;throw r.code?r:a("NETWORK",`could not reach ${o.backend_url}: ${e.message}`)}n(`
|
|
2
2
|
Enter this code in your browser: ${s.user_code}
|
|
3
3
|
`),n(` Open: ${s.verification_uri_complete}
|
|
4
4
|
|
|
5
5
|
`),await c(s.verification_uri_complete)||n(` (could not open browser automatically \u2014 copy the URL above)
|
|
6
6
|
|
|
7
7
|
`),n(` Waiting for approval...
|
|
8
|
-
`);let w=u()+g*1e3,m=Math.max(1,s.interval)*1e3;for(;await d(m),!(u()>=w);){let e;try{let r=await i(`${o.backend_url}/api/v1/cli/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:s.device_code})});if(r.status===410)throw a("EXPIRED","device code expired \u2014 run `flowe login` again");if(!r.ok)throw a("POLL_FAILED",`server returned ${r.status} when polling`);e=await r.json()}catch(r){let l=r;throw l.code?l:a("NETWORK",`poll failed: ${r.message}`)}if(e.status==="authorized"&&e.token&&e.user_id){await f(e.token);try{let{refreshUserFirstName:r}=await import("./me-
|
|
8
|
+
`);let w=u()+g*1e3,m=Math.max(1,s.interval)*1e3;for(;await d(m),!(u()>=w);){let e;try{let r=await i(`${o.backend_url}/api/v1/cli/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:s.device_code})});if(r.status===410)throw a("EXPIRED","device code expired \u2014 run `flowe login` again");if(!r.ok)throw a("POLL_FAILED",`server returned ${r.status} when polling`);e=await r.json()}catch(r){let l=r;throw l.code?l:a("NETWORK",`poll failed: ${r.message}`)}if(e.status==="authorized"&&e.token&&e.user_id){await f(e.token);try{let{refreshUserFirstName:r}=await import("./me-6WIWKE2Q.js");await r({fetch:i,authToken:e.token})}catch{}return n(`
|
|
9
9
|
Signed in.
|
|
10
10
|
`),{token:e.token,user_id:e.user_id}}}throw a("TIMEOUT","timed out waiting for approval")}export{R as runLogin};
|
package/dist/mcp-server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
5
|
-
`),
|
|
6
|
-
`),
|
|
7
|
-
`),
|
|
8
|
-
`),gt=[{name:"flowe_check_state",description:me,inputSchema:{type:"object",properties:{},required:[]}},{name:"flowe_suggest_reset",description:fe,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{reason:{type:"string",description:"Short, calm explanation of why a reset helps right now."},signal:{type:"string",enum:["long_session","debugging_loop","eye_strain","stress","overload","pre_wait","wind_down"],description:"Observed context signal."},recommended_duration:{type:"number",enum:[30,45,60,90]},recommended_protocol:{type:"string"}},required:[]}},{name:"flowe_reset",description:ge,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{duration_seconds:{type:"number",enum:[30,45,60,90],description:"Length of the micro-reset in seconds."},protocol:{type:"string",description:"Optional protocol family (e.g. physiological_sigh, box_breath, palming, body_scan)."},trigger:{type:"string",enum:["claude_thinking","long_compile","agent_call","user_requested","long_session","harness_suggested"],description:"Why this reset fired (analytics only)."},voice:{type:"string",enum:["ellie","ada","sage"]},audio_mode:{type:"string",enum:["local","silent","chime"]}},required:["duration_seconds"]}},{name:"flowe_quick_reset",description:I,_meta:{ui:{resourceUri:m}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...b],description:"Which Quick Reset to run. Defaults to quick_reset."},voice:{type:"string",enum:["ellie","ada","sage"]},ambient:{type:"string",description:'Optional ambient scene id or "none".'}},required:[]}},{name:"flowe_deep_reset",description:he,_meta:{ui:{resourceUri:m}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...x],description:"Which Deep Reset to run. Defaults to ht_stress."},voice:{type:"string",enum:["ellie","ada","sage"]},ambient:{type:"string"}},required:[]}},{name:"flowe_nsdr",description:I,_meta:{ui:{resourceUri:m}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...b],description:"Which Quick Reset (NSDR) session type to run. Defaults to quick_reset."}},required:[]}},{name:"flowe_focus",description:ye,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{action:{type:"string",enum:["show","start"]},preset:{type:"string",enum:["pomodoro","dev","ultradian"]},ambient:{type:"string"}},required:[]}},{name:"flowe_auth",description:we,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{},required:[]}}];function Pe(t){let e=t,s=e?.message||String(t),o=e?.code??"unknown";return{content:[{type:"text",text:`error[${o}]: ${s}`}],structuredContent:{error:!0,code:o,message:s},isError:!0}}function $e(t){switch(t){case"debugging_loop":return{eyebrow:"DEBUGGING LOOP",headline:"Break the loop for 30 seconds",protocol:"physiological_sigh",duration:30,quickType:"logic_lock"};case"eye_strain":return{eyebrow:"SCREEN FATIGUE",headline:"Give your eyes a minute of dark rest",protocol:"palming",duration:60,quickType:"context_switch"};case"stress":return{eyebrow:"HIGH STAKES",headline:"Steady your breath before you ship",protocol:"box_breath",duration:60,quickType:"deploy_anxiety"};case"overload":return{eyebrow:"COGNITIVE LOAD",headline:"Clear working memory before picking a path",protocol:"body_scan",duration:60,quickType:"executive_reset"};case"wind_down":return{eyebrow:"END OF BLOCK",headline:"Step down smoothly from deep work",protocol:"progressive_palming",duration:90,quickType:"shutdown"};default:return{eyebrow:"LONG SESSION",headline:"Take a short breath while your agent works",protocol:"physiological_sigh",duration:30,quickType:"quick_reset"}}}async function pe(t,e){let s=t==="deep"?e.session_type??"ht_stress":e.session_type??"quick_reset",o=e.voice,n=e.ambient??"none",r=await y().catch(()=>({authenticated:!1,is_pro:!1,plan_type:"guest",quick_reset_quota:null}));if(!r.authenticated){let a=await E(),c={view:"auth",auth:a,pending_tier:t,pending_session_type:s,voice:o,ambient:n,account:r,message:`Sign in to Flowe to start this ${t==="deep"?"Deep Reset":"Quick Reset"}: ${a.verification_uri_complete} (code: ${a.user_code})`};return{content:[{type:"text",text:c.message}],structuredContent:c}}try{let a=await ee({tier:t,sessionType:s,voice:o,ambient:n}),c={view:"live_session",...a,account:r};return{content:[{type:"text",text:JSON.stringify(a)}],structuredContent:c}}catch(a){let c=a;if(c.code==="auth_required"){let u=await E(),d={view:"auth",auth:u,pending_tier:t,pending_session_type:s,voice:o,ambient:n,account:{authenticated:!1,is_pro:!1,plan_type:"guest"},message:`Your Flowe sign-in expired. Approve here to continue: ${u.verification_uri_complete} (code: ${u.user_code})`};return{content:[{type:"text",text:d.message}],structuredContent:d}}if(c.code==="quota_exceeded"||c.code==="subscription_required"){let u={view:"quota",code:c.code,message:c.message??"Flowe Pro unlocks unlimited live Quick and Deep Resets.",account:r};return{content:[{type:"text",text:u.message}],structuredContent:u}}throw a}}async function p(t,e={}){try{if(t==="flowe_check_state"){let s=await y().catch(()=>({authenticated:!1,is_pro:!1,plan_type:"guest",quick_reset_quota:null})),n={...M({authenticated:s.authenticated}),account:s,voice:A().voice,available_micro_protocols:z(),available_quick_resets:Y.map(r=>({id:r.id,name:r.name,minutes:r.duration_minutes})),available_deep_resets:X.map(r=>({id:r.id,name:r.name,minutes:r.duration_minutes}))};return{content:[{type:"text",text:JSON.stringify(n)}],structuredContent:n}}if(t==="flowe_suggest_reset"){let s=await y().catch(()=>({authenticated:!1,is_pro:!1,plan_type:"guest",quick_reset_quota:null})),o=M({authenticated:s.authenticated});if(!o.can_suggest){let d=o.blocked_reason==="snoozed"?`Flowe suggestions are snoozed for ${o.snooze_remaining_minutes}m.`:o.blocked_reason==="cooldown"?`Flowe reset cooldown active (${o.cooldown_remaining_seconds}s remaining).`:o.blocked_reason==="focus_break_active"?"A Flowe focus break is already active.":"Flowe resets are opted out via FLOWE_OPT_OUT.";return{content:[{type:"text",text:d}],structuredContent:{view:"snoozed",snooze_minutes:o.snooze_remaining_minutes||5,blocked_reason:o.blocked_reason,account:s,message:d}}}re();let n=$e(e.signal),r=e.recommended_duration??n.duration,a=e.recommended_protocol??n.protocol,c=e.reason??`You\u2019ve been working for ${Math.max(1,o.session_minutes)} minutes. A short reset clears visual and nervous-system load without losing context.`,u={view:"suggest",eyebrow:o.session_minutes>=20?`${n.eyebrow} \xB7 ${o.session_minutes} MIN`:n.eyebrow,headline:n.headline,reason:c,recommended_tier:o.recommended_tier,recommended_duration:r,recommended_protocol:a,recommended_quick_type:n.quickType,session_minutes:o.session_minutes,sessions_today:o.sessions_today,streak_days:o.streak_days,account:s};return{content:[{type:"text",text:`${n.headline} \u2014 ${c} (Suggested: ${r}s ${a}${s.authenticated?` or Quick Reset: ${n.quickType}`:""})`}],structuredContent:u}}if(t==="flowe_reset"){let s=e.duration_seconds??60,o=e.trigger??"claude_thinking",n=e.protocol,r=e.voice,a=e.audio_mode,u=await Q(s,o,n,{audioMode:a==="silent"||a==="chime"?"silent":"local",voice:r,recordOnComplete:!0});C();let d={view:"micro_reset",...u,audio_mode:a??"local",sessions_today:g(),streak_days:h()};return{content:[{type:"text",text:JSON.stringify(u)}],structuredContent:d}}if(t==="flowe_quick_reset"||t==="flowe_nsdr")return await pe("quick",e);if(t==="flowe_deep_reset")return await pe("deep",e);if(t==="flowe_focus"){let s=e.action??"show",o=await y().catch(()=>({authenticated:!1,is_pro:!1,plan_type:"guest",quick_reset_quota:null}));if(s==="start"){let c=e.preset??"pomodoro",u=e.ambient??"rain_window_soft",d,k;if(u!=="none")try{let f=await G().catch(()=>null),S=V(f,W())?.sounds.find(Se=>Se.id===u);S&&(d=await J(S),k=S.id)}catch{}K({preset:c,ambientFilePath:d,ambientId:k})}let n=v(),r={view:"focus",focus:n,account:o};return{content:[{type:"text",text:n?`Flowe Focus active: ${n.preset} (${n.status}, block ${n.blockIndex}/${n.blocks}, ${Math.ceil(n.remainingSec/60)}m left${n.paused?", paused":""}).`:"No active Flowe Focus cycle. Pick Pomodoro (25/5), Dev (50/10), or Ultradian (90/15) to start."}],structuredContent:r}}if(t==="flowe_auth"){let s=await y().catch(_e);if(s.authenticated){let r={view:"complete",account:s,sessions_today:g(),streak_days:h(),message:`Signed in to Flowe${s.first_name?` as ${s.first_name}`:""} (${s.is_pro?"Flowe Pro":s.plan_type}).`};return{content:[{type:"text",text:r.message}],structuredContent:r}}let o=await E(),n={view:"auth",auth:o,account:s,message:`Sign in to Flowe at ${o.verification_uri_complete} (code: ${o.user_code})`};return{content:[{type:"text",text:n.message}],structuredContent:n}}if(t==="flowe_auth_poll"){let s=String(e.device_code??""),o=await Z(s),n={...o};return{content:[{type:"text",text:JSON.stringify(o)}],structuredContent:n}}if(t==="flowe_reset_control"){let s=String(e.action??"");if(s==="stop"){let o=L();return{content:[{type:"text",text:o?"Reset stopped.":"No active reset."}],structuredContent:{stopped:o}}}if(s==="complete"){$(),C();let o={sessions_today:g(),streak_days:h()};return{content:[{type:"text",text:JSON.stringify(o)}],structuredContent:o}}if(s==="snooze"){let o=Number(e.snooze_minutes??25),r={snoozed_until:ae(o).snoozed_until,snooze_minutes:o};return{content:[{type:"text",text:`Snoozed for ${o} minutes.`}],structuredContent:r}}if(s==="set_voice"){let o=e.voice;return(o==="ellie"||o==="ada"||o==="sage")&&P(o),{content:[{type:"text",text:`Voice set to ${o}.`}],structuredContent:{voice:o}}}return{content:[{type:"text",text:`unknown reset control action: ${s}`}],isError:!0}}if(t==="flowe_session_complete"){let s=String(e.session_id??""),o=typeof e.duration_minutes=="number"?e.duration_minutes:void 0,n=await te(s,{durationMinutes:o});C();let r={...n,sessions_today:g(),streak_days:h()};return{content:[{type:"text",text:JSON.stringify(r)}],structuredContent:r}}if(t==="flowe_focus_control"){let s=String(e.action??"status");(s==="pause"||s==="resume"||s==="skip"||s==="quit")&&B(s);let n={view:"focus",focus:v()};return{content:[{type:"text",text:JSON.stringify(n)}],structuredContent:n}}return{content:[{type:"text",text:`unknown tool: ${t}`}],isError:!0}}catch(s){return Pe(s)}}function je(){let t=new Ne({name:"flowe",version:N()});return le(t,"Flowe Reset & Focus Card",l,{_meta:D},async()=>({contents:[{uri:l,mimeType:de,text:U("micro.html"),_meta:D}]})),le(t,"Flowe Live Quick & Deep Reset Player",m,{_meta:q},async()=>({contents:[{uri:m,mimeType:de,text:U("live-session.html"),_meta:q}]})),t.registerResource("Flowe Session State","flowe://session/state",{description:"Current local Flowe session cadence, cooldown, focus daemon, and account summary.",mimeType:"application/json"},async()=>{let e=await y().catch(_e),s=M({authenticated:e.authenticated});return{contents:[{uri:"flowe://session/state",mimeType:"application/json",text:JSON.stringify({...s,account:e},null,2)}]}}),t.registerTool("flowe_check_state",{title:"Check Flowe Reset State",description:me,annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1}},async()=>p("flowe_check_state",{})),_(t,"flowe_suggest_reset",{title:"Suggest a Flowe Reset",description:fe,inputSchema:i.object({reason:i.string().optional().describe("Calm 1-sentence reason why a reset fits right now."),signal:i.enum(["long_session","debugging_loop","eye_strain","stress","overload","pre_wait","wind_down"]).optional(),recommended_duration:i.union([i.literal(30),i.literal(45),i.literal(60),i.literal(90)]).optional(),recommended_protocol:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async e=>p("flowe_suggest_reset",e)),_(t,"flowe_reset",{title:"Run Micro-Reset (30\u201390s)",description:ge,inputSchema:i.object({duration_seconds:i.union([i.literal(30),i.literal(45),i.literal(60),i.literal(90)]),protocol:i.string().optional().describe("Protocol family (e.g. physiological_sigh, box_breath, palming, body_scan)."),trigger:i.enum(["claude_thinking","long_compile","agent_call","user_requested","long_session","harness_suggested"]).optional(),voice:i.enum(["ellie","ada","sage"]).optional(),audio_mode:i.enum(["local","silent","chime"]).optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async e=>p("flowe_reset",e)),_(t,"flowe_quick_reset",{title:"Start Live Flowe Quick Reset (5\u201315m)",description:I,inputSchema:i.object({session_type:i.enum(b).optional(),voice:i.enum(["ellie","ada","sage"]).optional(),ambient:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:m,visibility:["model","app"]}}},async e=>p("flowe_quick_reset",e)),_(t,"flowe_deep_reset",{title:"Start Live Flowe Deep Reset (15\u201325m)",description:he,inputSchema:i.object({session_type:i.enum(x).optional(),voice:i.enum(["ellie","ada","sage"]).optional(),ambient:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:m,visibility:["model","app"]}}},async e=>p("flowe_deep_reset",e)),_(t,"flowe_nsdr",{title:"Start Guided NSDR Quick Reset",description:I,inputSchema:i.object({session_type:i.enum(b).optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:m,visibility:["model","app"]}}},async e=>p("flowe_nsdr",e)),_(t,"flowe_focus",{title:"Flowe Focus Room",description:ye,inputSchema:i.object({action:i.enum(["show","start"]).optional(),preset:i.enum(["pomodoro","dev","ultradian"]).optional(),ambient:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async e=>p("flowe_focus",e)),_(t,"flowe_auth",{title:"Sign in to Flowe",description:we,annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async()=>p("flowe_auth",{})),_(t,"flowe_auth_poll",{description:"Poll device-grant authentication status from the Flowe sign-in card.",inputSchema:i.object({device_code:i.string().min(8)}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async e=>p("flowe_auth_poll",e)),_(t,"flowe_reset_control",{description:"Stop, complete, snooze, or adjust voice for a Flowe micro-reset.",inputSchema:i.object({action:i.enum(["stop","complete","snooze","set_voice"]),session_id:i.string().optional(),snooze_minutes:i.number().optional(),voice:i.enum(["ellie","ada","sage"]).optional()}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async e=>p("flowe_reset_control",e)),_(t,"flowe_session_complete",{description:"Complete an active live Flowe Quick or Deep Reset session.",inputSchema:i.object({session_id:i.string().min(1),duration_minutes:i.number().optional()}),_meta:{ui:{resourceUri:m,visibility:["app"]}}},async e=>p("flowe_session_complete",e)),_(t,"flowe_focus_control",{description:"Inspect or control the detached Flowe focus daemon.",inputSchema:i.object({action:i.enum(["status","pause","resume","skip","quit"])}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async e=>p("flowe_focus_control",e)),t.registerPrompt("flowe_checkin",{title:"Flowe Reset Check-in",description:"Check session fatigue and suggest the right Flowe reset."},async()=>({messages:[{role:"user",content:{type:"text",text:"Call flowe_check_state and, if appropriate, call flowe_suggest_reset with a calm one-sentence reason matching what we have been working on."}}]})),t.registerPrompt("flowe_quick_reset",{title:"Flowe Quick Reset",description:"Start a live 5\u201315 minute Flowe Quick Reset session.",argsSchema:{type:i.enum(b).optional().describe("Quick Reset type (default: quick_reset)")}},async({type:e})=>({messages:[{role:"user",content:{type:"text",text:`Start a Flowe Quick Reset using flowe_quick_reset${e?` with session_type="${e}"`:""}.`}}]})),t.registerPrompt("flowe_deep_reset",{title:"Flowe Deep Reset",description:"Start an interactive 15\u201325 minute Flowe Deep Reset session.",argsSchema:{type:i.enum(x).optional().describe("Deep Reset type (default: ht_stress)")}},async({type:e})=>({messages:[{role:"user",content:{type:"text",text:`Start a Flowe Deep Reset using flowe_deep_reset${e?` with session_type="${e}"`:""}.`}}]})),t}async function ze(){let t=je(),e=new Ae;await t.connect(e)}var He=import.meta.url===`file://${process.argv[1]}`||process.argv[1]?.endsWith("mcp-server.js")||process.argv[1]?.endsWith("mcp-server.ts");He&&ze().catch(t=>{process.stderr.write(`flowe-mcp: ${t instanceof Error?t.message:String(t)}
|
|
9
|
-
`),process.exit(1)});export{
|
|
1
|
+
import{a as P,b as k,c as E,e as L,j as Q,k as W,l as V,m as D,o as R,s as Y,v as X}from"./chunk-3KM7AYV7.js";import{e as G,f as B,i as J,j as K}from"./chunk-3TLGYA6M.js";import{a as Z,b as ee,c as te,d as T,e as oe,f as w,g as U,i as se,j as ne,k as ie}from"./chunk-JTAA4OAX.js";import{a as q,b as j,e as z,f as g,g as h,h as H}from"./chunk-DX2IZG3L.js";import{McpServer as qe}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as je}from"@modelcontextprotocol/sdk/server/stdio.js";import{registerAppResource as _e,registerAppTool as m,RESOURCE_MIME_TYPE as fe}from"@modelcontextprotocol/ext-apps/server";import{z as i}from"zod/v4";import{existsSync as ce,mkdirSync as Re,readFileSync as xe,renameSync as Ee,writeFileSync as Te}from"fs";import{join as Fe}from"path";var Ce="mcp-session.json",Me=300*1e3,Ie=14400*1e3;function ue(){return Fe(D(),Ce)}function F(t){return{version:1,session_started_at:t,last_reset_at:null,last_suggested_at:null,snoozed_until:null,resets_this_session:0}}function C(t=Date.now()){let e=ue();if(!ce(e)){let o=F(t);return y(o),o}try{let o=JSON.parse(xe(e,"utf-8"));if(o.version!==1||typeof o.session_started_at!="number"){let n=F(t);return y(n),n}let s=Math.max(o.session_started_at,o.last_reset_at??0,o.last_suggested_at??0);if(t-s>Ie){let n=F(t);return y(n),n}return{version:1,session_started_at:o.session_started_at,last_reset_at:o.last_reset_at??null,last_suggested_at:o.last_suggested_at??null,snoozed_until:o.snoozed_until??null,resets_this_session:o.resets_this_session??0}}catch{let o=F(t);return y(o),o}}function y(t){let e=D();ce(e)||Re(e,{recursive:!0});let o=ue(),s=`${o}.tmp`;Te(s,JSON.stringify(t,null,2),"utf-8"),Ee(s,o)}function le(t=Date.now()){let e=C(t);return e.last_suggested_at=t,y(e),e}function M(t=Date.now()){let e=C(t);return e.last_reset_at=t,e.resets_this_session+=1,y(e),e}function de(t,e=Date.now()){let o=Math.max(1,Math.min(240,Math.round(t))),s=C(e);return s.snoozed_until=e+o*60*1e3,y(s),s}function I(t={}){let e=t.nowMs??Date.now(),o=t.cooldownMs??Me,s=C(e),n=R({now:()=>e}),r=Q(),a=Math.max(0,Math.round((e-s.session_started_at)/6e4)),c=s.last_reset_at!==null?Math.max(0,e-s.last_reset_at):null,u=c!==null?Math.round(c/6e4):null,d=c!==null?Math.max(0,o-c):0,v=s.snoozed_until!==null?Math.max(0,s.snoozed_until-e):0,f=null;r?f="opted_out":v>0?f="snoozed":n&&(n.status==="BREAK"||n.status==="LONG_BREAK")?f="focus_break_active":d>0&&(f="cooldown");let x="micro";if(t.authenticated){let S=u??a;S>=120?x="deep":S>=45&&(x="quick")}return{opted_out:r,can_suggest:f===null,blocked_reason:f,session_minutes:a,minutes_since_last_reset:u,cooldown_remaining_seconds:Math.ceil(d/1e3),snooze_remaining_minutes:Math.ceil(v/6e4),resets_this_session:s.resets_this_session,sessions_today:g(new Date(e)),streak_days:h(new Date(e)),total_sessions:H(),active_focus:n,recommended_tier:x}}import{existsSync as Oe,readFileSync as De}from"fs";import{dirname as Ue,join as pe,resolve as Ae}from"path";import{fileURLToPath as Ne}from"url";var l="ui://flowe/micro.html",_="ui://flowe/live-session.html",A={ui:{prefersBorder:!1,csp:{connectDomains:[],resourceDomains:[]}}},N={ui:{prefersBorder:!1,permissions:{microphone:{}},csp:{connectDomains:["https://www.flowe.ai","https://flowe.ai","wss://*.livekit.cloud","https://*.livekit.cloud"],resourceDomains:[]}}},me=new Map;function $e(t,e=import.meta.url){let o=Ue(Ne(e));for(let s=0;s<4;s++){let n=[pe(o,"ui",t),pe(o,"dist","ui",t)];for(let a of n)if(Oe(a))return a;let r=Ae(o,"..");if(r===o)break;o=r}return null}function Pe(t){return`<!doctype html><html lang="en"><head><meta charset="UTF-8"/><title>${t}</title><style>body{margin:0;padding:16px;font-family:-apple-system,BlinkMacSystemFont,sans-serif;background:#fff4e8;color:#1a1611}@media(prefers-color-scheme:dark){body{background:#15120f;color:#fff5e3}}</style></head><body><p><strong>${t}</strong> \u2014 run <code>pnpm build</code> in flowe-cli to bundle UI resources.</p></body></html>`}function $(t){let e=me.get(t);if(e)return e;let o=$e(t);if(o){let s=De(o,"utf-8");return me.set(t,s),s}return Pe(t==="live-session.html"?"Flowe Live Session":"Flowe")}function b(){return{authenticated:!1,first_name:null,email:null,is_pro:!1,plan_type:"guest",quick_reset_quota:null}}var he=["Check the human operator\u2019s Flowe state before suggesting a reset.","Returns session duration, time since last reset, cooldown/snooze status,","active focus cycle state, streak, and whether they are signed in to Flowe","(plus remaining free Quick Resets / Flowe Pro status).","Read-only and fast \u2014 call this before calling flowe_suggest_reset during long sessions."].join(`
|
|
2
|
+
`),we=["Render a calm, non-intrusive inline Flowe reset suggestion card in the host UI","when the human has been working for a long stretch, hit a frustrating debugging loop,","or is about to wait on a long build/agent task.","Unlike flowe_reset, this NEVER plays audio unexpectedly \u2014 it explains why now and lets","the user start a 30\u201390s Micro-Reset, launch a real 5\u201315m Quick Reset, or Snooze 25m."].join(`
|
|
3
|
+
`),ye=["Run an instant 30, 45, 60, or 90-second micro-reset for the human operator (no account needed)","and display the live interactive Flowe Reset Runner inline.","Pick a protocol family that matches what you observed:","\xB7 physiological_sigh (30s) when frustrated or stuck on errors","\xB7 quick_palming (30s) / palming (60s) / progressive_palming (90s) for eye fatigue","\xB7 box_breath (45s, 60s) / extended_box (90s) for stress or composure","\xB7 body_scan (60s) / full_sensory (90s) for cognitive overload","\xB7 neck_rotation (45s) / grounded_feet (45s) / eye_rotation (30s) for physical/screen reset","Returns immediately (non-blocking). Prefer flowe_suggest_reset unless the user asked for a reset directly."].join(`
|
|
4
|
+
`),O=["Start a real, authenticated Flowe Quick Reset (5\u201315 min live AI-guided NSDR voice session)","and render the live Flowe Quick Reset player inline (with automatic QR/Web handoff fallback).","If the user is not signed in yet, renders an inline Flowe device sign-in card that automatically","launches the Quick Reset as soon as they approve in their browser.","A free account gets 5 Quick Resets a week; Flowe Pro, alone or through a team, is unlimited.","Session types:","\xB7 quick_reset (Reset, 10m) \u2014 mental refresh between tasks","\xB7 deploy_anxiety (Calm Down, 5m) \u2014 heart racing, high stakes","\xB7 logic_lock (Unstuck, 10m) \u2014 when a problem keeps circling","\xB7 context_switch (Clear, 8m) \u2014 after meetings, before code","\xB7 sprint_prep (Lock In, 10m) \u2014 before deep work","\xB7 executive_reset (Defog, 12m) \u2014 brain fog, decision fatigue","\xB7 presentation_prep (Steady, 8m) \u2014 before speaking / a big meeting","\xB7 shutdown (Wind Down, 15m) \u2014 end of day, sleep transition"].join(`
|
|
5
|
+
`),Se=["Start a real, authenticated Flowe Deep Reset (30\u201350 min two-way voice session with Ada, for what keeps coming back;","needs Flowe Pro, alone or through a team)","and render the live Flowe Deep Reset player inline (or seamless Desktop/Web/Phone QR handoff).","If the user is not signed in yet, renders an inline Flowe sign-in card first.","Session types: ht_stress, ht_anxiety, ht_burnout, ht_procrastination, ht_confidence,","ht_people_pleasing, ht_relationships, ht_fears, ht_anger."].join(`
|
|
6
|
+
`),ze="https://www.flowe.ai/pricing?utm_source=flowe-cli&utm_medium=mcp";function He(t){return`${t} minute${t===1?"":"s"}`}function Le(t){let e=t.status==="live"?"The card can join the room now.":"The user can join from the card, the link or the QR code.";return[t.message_for_user,e,t.session_id?`session_id: ${t.session_id}`:""].filter(Boolean).join(" ")}function Qe(t,e){return e.team_paused?`${U(e.team_paused)} Ask your admin to turn it back on. Until then you are on the free plan: micro-resets, and five Quick Resets a week.`:t==="deep"?"Deep Resets come with Flowe Pro. Quick Resets and micro-resets stay open on the free plan.":"You used this week\u2019s five free Quick Resets. They come back on Monday. Micro-resets stay free, and Flowe Pro gives unlimited live resets."}var ke=["Show or start a detached Flowe Focus cycle (pomodoro 25/5, dev 50/10, ultradian 90/15)","with optional ambient soundscape and render live Pause/Resume/Skip/End controls inline.","Focus cycles are opt-in: ask or show the Focus Room card rather than starting unprompted."].join(`
|
|
7
|
+
`),be=["Sign in to a Flowe account right inside the AI harness via OAuth device grant","(renders a calm inline card with browser link, short code, and QR code), or check current sign-in status."].join(`
|
|
8
|
+
`),vt=[{name:"flowe_check_state",description:he,inputSchema:{type:"object",properties:{},required:[]}},{name:"flowe_suggest_reset",description:we,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{reason:{type:"string",description:"Short, calm explanation of why a reset helps right now."},signal:{type:"string",enum:["long_session","debugging_loop","eye_strain","stress","overload","pre_wait","wind_down"],description:"Observed context signal."},recommended_duration:{type:"number",enum:[30,45,60,90]},recommended_protocol:{type:"string"}},required:[]}},{name:"flowe_reset",description:ye,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{duration_seconds:{type:"number",enum:[30,45,60,90],description:"Length of the micro-reset in seconds."},protocol:{type:"string",description:"Optional protocol family (e.g. physiological_sigh, box_breath, palming, body_scan)."},trigger:{type:"string",enum:["claude_thinking","long_compile","agent_call","user_requested","long_session","harness_suggested"],description:"Why this reset fired (analytics only)."},voice:{type:"string",enum:["ellie","ada","sage"]},audio_mode:{type:"string",enum:["local","silent","chime"]}},required:["duration_seconds"]}},{name:"flowe_quick_reset",description:O,_meta:{ui:{resourceUri:_}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...k],description:"Which Quick Reset to run. Defaults to quick_reset."},ambient:{type:"string",description:'Optional ambient scene id or "none".'}},required:[]}},{name:"flowe_deep_reset",description:Se,_meta:{ui:{resourceUri:_}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...E],description:"Which Deep Reset to run. Defaults to ht_stress."},ambient:{type:"string"}},required:[]}},{name:"flowe_nsdr",description:O,_meta:{ui:{resourceUri:_}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...k],description:"Which Quick Reset (NSDR) session type to run. Defaults to quick_reset."}},required:[]}},{name:"flowe_focus",description:ke,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{action:{type:"string",enum:["show","start"]},preset:{type:"string",enum:["pomodoro","dev","ultradian"]},ambient:{type:"string"}},required:[]}},{name:"flowe_auth",description:be,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{},required:[]}}];function We(t){let e=t,o=e?.message||String(t),s=e?.code??"unknown";return{content:[{type:"text",text:`error[${s}]: ${o}`}],structuredContent:{error:!0,code:s,message:o},isError:!0}}function Ve(t){switch(t){case"debugging_loop":return{eyebrow:"DEBUGGING LOOP",headline:"Break the loop for 30 seconds",protocol:"physiological_sigh",duration:30,quickType:"logic_lock"};case"eye_strain":return{eyebrow:"SCREEN FATIGUE",headline:"Give your eyes a minute of dark rest",protocol:"palming",duration:60,quickType:"context_switch"};case"stress":return{eyebrow:"HIGH STAKES",headline:"Steady your breath before you ship",protocol:"box_breath",duration:60,quickType:"deploy_anxiety"};case"overload":return{eyebrow:"COGNITIVE LOAD",headline:"Clear working memory before picking a path",protocol:"body_scan",duration:60,quickType:"executive_reset"};case"wind_down":return{eyebrow:"END OF BLOCK",headline:"Step down smoothly from deep work",protocol:"progressive_palming",duration:90,quickType:"shutdown"};default:return{eyebrow:"LONG SESSION",headline:"Take a short breath while your agent works",protocol:"physiological_sigh",duration:30,quickType:"quick_reset"}}}async function ge(t,e){let o=t==="deep"?e.session_type??"ht_stress":e.session_type??"quick_reset",s="ada",n=e.ambient??"none",r=await w().catch(b);if(!r.authenticated){let a=await T(),c={view:"auth",auth:a,pending_tier:t,pending_session_type:o,voice:s,ambient:n,account:r,message:`Sign in to Flowe to start this ${t==="deep"?"Deep Reset":"Quick Reset"}: ${a.verification_uri_complete} (code: ${a.user_code})`};return{content:[{type:"text",text:c.message}],structuredContent:c}}try{let a=await ne({tier:t,sessionType:o,voice:s,ambient:n}),c={view:"live_session",...a,account:r};return{content:[{type:"text",text:Le(a)}],structuredContent:c}}catch(a){let c=a;if(c.code==="auth_required"){let u=await T(),d={view:"auth",auth:u,pending_tier:t,pending_session_type:o,voice:s,ambient:n,account:{authenticated:!1,is_pro:!1,plan_type:"guest"},message:`Your Flowe sign-in expired. Approve here to continue: ${u.verification_uri_complete} (code: ${u.user_code})`};return{content:[{type:"text",text:d.message}],structuredContent:d}}if(c.code==="quota_exceeded"||c.code==="subscription_required"){let u={view:"quota",code:c.code,tier:t,message:Qe(t,r),upgrade_url:r.team_paused?void 0:ze,account:r};return{content:[{type:"text",text:u.message}],structuredContent:u}}throw a}}async function p(t,e={}){try{if(t==="flowe_check_state"){let o=await w().catch(b),n={...I({authenticated:o.authenticated}),account:o,voice:q().voice,available_micro_protocols:L(),available_quick_resets:ee.map(r=>({id:r.id,name:r.name,minutes:r.duration_minutes})),available_deep_resets:te.map(r=>({id:r.id,name:r.name,length:Z}))};return{content:[{type:"text",text:JSON.stringify(n)}],structuredContent:n}}if(t==="flowe_suggest_reset"){let o=await w().catch(b),s=I({authenticated:o.authenticated});if(!s.can_suggest){let d=s.blocked_reason==="snoozed"?`Flowe suggestions are snoozed for ${s.snooze_remaining_minutes}m.`:s.blocked_reason==="cooldown"?`Flowe reset cooldown active (${s.cooldown_remaining_seconds}s remaining).`:s.blocked_reason==="focus_break_active"?"A Flowe focus break is already active.":"Flowe resets are opted out via FLOWE_OPT_OUT.";return{content:[{type:"text",text:d}],structuredContent:{view:"snoozed",snooze_minutes:s.snooze_remaining_minutes||5,blocked_reason:s.blocked_reason,account:o,message:d}}}le();let n=Ve(e.signal),r=e.recommended_duration??n.duration,a=e.recommended_protocol??n.protocol,c=e.reason??`You\u2019ve been working for ${He(Math.max(1,s.session_minutes))}. A short reset clears visual and nervous-system load without losing context.`,u={view:"suggest",eyebrow:s.session_minutes>=20?`${n.eyebrow} \xB7 ${s.session_minutes} MIN`:n.eyebrow,headline:n.headline,reason:c,recommended_tier:s.recommended_tier,recommended_duration:r,recommended_protocol:a,recommended_quick_type:n.quickType,session_minutes:s.session_minutes,sessions_today:s.sessions_today,streak_days:s.streak_days,account:o};return{content:[{type:"text",text:`${n.headline} \u2014 ${c} (Suggested: ${r}s ${a}${o.authenticated?` or Quick Reset: ${n.quickType}`:""})`}],structuredContent:u}}if(t==="flowe_reset"){let o=e.duration_seconds??60,s=e.trigger??"claude_thinking",n=e.protocol,r=e.voice,a=e.audio_mode,u=await V(o,s,n,{audioMode:a==="silent"||a==="chime"?"silent":"local",voice:r,recordOnComplete:!0});M();let d={view:"micro_reset",...u,audio_mode:a??"local",sessions_today:g(),streak_days:h()};return{content:[{type:"text",text:JSON.stringify(u)}],structuredContent:d}}if(t==="flowe_quick_reset"||t==="flowe_nsdr")return await ge("quick",e);if(t==="flowe_deep_reset")return await ge("deep",e);if(t==="flowe_focus"){let o=e.action??"show",s=await w().catch(b);if(o==="start"){let c=e.preset??"pomodoro",u=e.ambient??"rain_window_soft",d,v;if(u!=="none")try{let f=await J().catch(()=>null),S=B(f,G())?.sounds.find(ve=>ve.id===u);S&&(d=await K(S),v=S.id)}catch{}X({preset:c,ambientFilePath:d,ambientId:v})}let n=R(),r={view:"focus",focus:n,account:s};return{content:[{type:"text",text:n?`Flowe Focus active: ${n.preset} (${n.status}, block ${n.blockIndex}/${n.blocks}, ${Math.ceil(n.remainingSec/60)}m left${n.paused?", paused":""}).`:"No active Flowe Focus cycle. Pick Pomodoro (25/5), Dev (50/10), or Ultradian (90/15) to start."}],structuredContent:r}}if(t==="flowe_auth"){let o=await w().catch(b);if(o.authenticated){let r={view:"complete",account:o,sessions_today:g(),streak_days:h(),message:`Signed in to Flowe${o.first_name?` as ${o.first_name}`:""} (${se(o)}).${o.team_paused?` ${U(o.team_paused)} Ask your admin to turn it back on.`:""}`};return{content:[{type:"text",text:r.message}],structuredContent:r}}let s=await T(),n={view:"auth",auth:s,account:o,message:`Sign in to Flowe at ${s.verification_uri_complete} (code: ${s.user_code})`};return{content:[{type:"text",text:n.message}],structuredContent:n}}if(t==="flowe_auth_poll"){let o=String(e.device_code??""),s=await oe(o),n={...s};return{content:[{type:"text",text:JSON.stringify(s)}],structuredContent:n}}if(t==="flowe_reset_control"){let o=String(e.action??"");if(o==="stop"){let s=W();return{content:[{type:"text",text:s?"Reset stopped.":"No active reset."}],structuredContent:{stopped:s}}}if(o==="complete"){z(),M();let s={sessions_today:g(),streak_days:h()};return{content:[{type:"text",text:JSON.stringify(s)}],structuredContent:s}}if(o==="snooze"){let s=Number(e.snooze_minutes??25),r={snoozed_until:de(s).snoozed_until,snooze_minutes:s};return{content:[{type:"text",text:`Snoozed for ${s} minutes.`}],structuredContent:r}}if(o==="set_voice"){let s=e.voice;return(s==="ellie"||s==="ada"||s==="sage")&&j(s),{content:[{type:"text",text:`Voice set to ${s}.`}],structuredContent:{voice:s}}}return{content:[{type:"text",text:`unknown reset control action: ${o}`}],isError:!0}}if(t==="flowe_session_complete"){let o=String(e.session_id??""),s=typeof e.duration_minutes=="number"?e.duration_minutes:void 0,n=await ie(o,{durationMinutes:s});M();let r={...n,sessions_today:g(),streak_days:h()};return{content:[{type:"text",text:JSON.stringify(r)}],structuredContent:r}}if(t==="flowe_focus_control"){let o=String(e.action??"status");(o==="pause"||o==="resume"||o==="skip"||o==="quit")&&Y(o);let n={view:"focus",focus:R()};return{content:[{type:"text",text:JSON.stringify(n)}],structuredContent:n}}return{content:[{type:"text",text:`unknown tool: ${t}`}],isError:!0}}catch(o){return We(o)}}function Ge(){let t=new qe({name:"flowe",version:P()});return _e(t,"Flowe Reset & Focus Card",l,{_meta:A},async()=>({contents:[{uri:l,mimeType:fe,text:$("micro.html"),_meta:A}]})),_e(t,"Flowe Live Quick & Deep Reset Player",_,{_meta:N},async()=>({contents:[{uri:_,mimeType:fe,text:$("live-session.html"),_meta:N}]})),t.registerResource("Flowe Session State","flowe://session/state",{description:"Current local Flowe session cadence, cooldown, focus daemon, and account summary.",mimeType:"application/json"},async()=>{let e=await w().catch(b),o=I({authenticated:e.authenticated});return{contents:[{uri:"flowe://session/state",mimeType:"application/json",text:JSON.stringify({...o,account:e},null,2)}]}}),t.registerTool("flowe_check_state",{title:"Check Flowe Reset State",description:he,annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1}},async()=>p("flowe_check_state",{})),m(t,"flowe_suggest_reset",{title:"Suggest a Flowe Reset",description:we,inputSchema:i.object({reason:i.string().optional().describe("Calm 1-sentence reason why a reset fits right now."),signal:i.enum(["long_session","debugging_loop","eye_strain","stress","overload","pre_wait","wind_down"]).optional(),recommended_duration:i.union([i.literal(30),i.literal(45),i.literal(60),i.literal(90)]).optional(),recommended_protocol:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async e=>p("flowe_suggest_reset",e)),m(t,"flowe_reset",{title:"Run Micro-Reset (30\u201390s)",description:ye,inputSchema:i.object({duration_seconds:i.union([i.literal(30),i.literal(45),i.literal(60),i.literal(90)]),protocol:i.string().optional().describe("Protocol family (e.g. physiological_sigh, box_breath, palming, body_scan)."),trigger:i.enum(["claude_thinking","long_compile","agent_call","user_requested","long_session","harness_suggested"]).optional(),voice:i.enum(["ellie","ada","sage"]).optional(),audio_mode:i.enum(["local","silent","chime"]).optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async e=>p("flowe_reset",e)),m(t,"flowe_quick_reset",{title:"Start Live Flowe Quick Reset (5\u201315m)",description:O,inputSchema:i.object({session_type:i.enum(k).optional(),ambient:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:_,visibility:["model","app"]}}},async e=>p("flowe_quick_reset",e)),m(t,"flowe_deep_reset",{title:"Start Live Flowe Deep Reset (30\u201350m)",description:Se,inputSchema:i.object({session_type:i.enum(E).optional(),ambient:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:_,visibility:["model","app"]}}},async e=>p("flowe_deep_reset",e)),m(t,"flowe_nsdr",{title:"Start Guided NSDR Quick Reset",description:O,inputSchema:i.object({session_type:i.enum(k).optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:_,visibility:["model","app"]}}},async e=>p("flowe_nsdr",e)),m(t,"flowe_focus",{title:"Flowe Focus Room",description:ke,inputSchema:i.object({action:i.enum(["show","start"]).optional(),preset:i.enum(["pomodoro","dev","ultradian"]).optional(),ambient:i.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async e=>p("flowe_focus",e)),m(t,"flowe_auth",{title:"Sign in to Flowe",description:be,annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async()=>p("flowe_auth",{})),m(t,"flowe_auth_poll",{description:"Poll device-grant authentication status from the Flowe sign-in card.",inputSchema:i.object({device_code:i.string().min(8)}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async e=>p("flowe_auth_poll",e)),m(t,"flowe_reset_control",{description:"Stop, complete, snooze, or adjust voice for a Flowe micro-reset.",inputSchema:i.object({action:i.enum(["stop","complete","snooze","set_voice"]),session_id:i.string().optional(),snooze_minutes:i.number().optional(),voice:i.enum(["ellie","ada","sage"]).optional()}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async e=>p("flowe_reset_control",e)),m(t,"flowe_session_complete",{description:"Complete an active live Flowe Quick or Deep Reset session.",inputSchema:i.object({session_id:i.string().min(1),duration_minutes:i.number().optional()}),_meta:{ui:{resourceUri:_,visibility:["app"]}}},async e=>p("flowe_session_complete",e)),m(t,"flowe_focus_control",{description:"Inspect or control the detached Flowe focus daemon.",inputSchema:i.object({action:i.enum(["status","pause","resume","skip","quit"])}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async e=>p("flowe_focus_control",e)),t.registerPrompt("flowe_checkin",{title:"Flowe Reset Check-in",description:"Check session fatigue and suggest the right Flowe reset."},async()=>({messages:[{role:"user",content:{type:"text",text:"Call flowe_check_state and, if appropriate, call flowe_suggest_reset with a calm one-sentence reason matching what we have been working on."}}]})),t.registerPrompt("flowe_quick_reset",{title:"Flowe Quick Reset",description:"Start a live 5\u201315 minute Flowe Quick Reset session.",argsSchema:{type:i.enum(k).optional().describe("Quick Reset type (default: quick_reset)")}},async({type:e})=>({messages:[{role:"user",content:{type:"text",text:`Start a Flowe Quick Reset using flowe_quick_reset${e?` with session_type="${e}"`:""}.`}}]})),t.registerPrompt("flowe_deep_reset",{title:"Flowe Deep Reset",description:"Start a 30\u201350 minute two-way Flowe Deep Reset session.",argsSchema:{type:i.enum(E).optional().describe("Deep Reset type (default: ht_stress)")}},async({type:e})=>({messages:[{role:"user",content:{type:"text",text:`Start a Flowe Deep Reset using flowe_deep_reset${e?` with session_type="${e}"`:""}.`}}]})),t}async function Be(){let t=Ge(),e=new je;await t.connect(e)}var Je=import.meta.url===`file://${process.argv[1]}`||process.argv[1]?.endsWith("mcp-server.js")||process.argv[1]?.endsWith("mcp-server.ts");Je&&Be().catch(t=>{process.stderr.write(`flowe-mcp: ${t instanceof Error?t.message:String(t)}
|
|
9
|
+
`),process.exit(1)});export{vt as TOOL_DEFINITIONS,Ge as createFloweMcpServer,p as handleCallTool,Be as runMcpServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-M56P7SDZ.js";import"./chunk-DX2IZG3L.js";export{a as fetchMe,b as refreshUserFirstName};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-JTAA4OAX.js";import"./chunk-DX2IZG3L.js";export{c as DEEP_RESET_CATALOG,a as DEEP_RESET_LENGTH,b as QUICK_RESET_CATALOG,l as cancelLiveSession,k as completeLiveSession,j as createAndStartLiveSession,f as fetchAccountStatus,i as planWords,e as pollDeviceAuth,d as startDeviceAuth,h as teamLine,g as teamStoppedSentence};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as d,mkdirSync as l,readFileSync as f,writeFileSync as u}from"fs";import{homedir as g,platform as m}from"os";import{dirname as v,join as n}from"path";var P=["claude-desktop","claude-code","antigravity","codex","cursor","vscode"];function b(e=g(),r=process.cwd(),s=m()){return{"claude-desktop":{id:"claude-desktop",label:"Claude Desktop",configPath:s==="darwin"?n(e,"Library","Application Support","Claude","claude_desktop_config.json"):s==="win32"?n(e,"AppData","Roaming","Claude","claude_desktop_config.json"):n(e,".config","Claude","claude_desktop_config.json"),format:"json-mcpServers",supportsMcpApps:!0},"claude-code":{id:"claude-code",label:"Claude Code",configPath:n(e,".claude.json"),format:"json-mcpServers",supportsMcpApps:!1},antigravity:{id:"antigravity",label:"Antigravity",configPath:n(e,".gemini","antigravity","mcp_config.json"),format:"json-mcpServers",supportsMcpApps:!0},codex:{id:"codex",label:"Codex",configPath:n(e,".codex","config.toml"),format:"toml-codex",supportsMcpApps:!
|
|
1
|
+
import{existsSync as d,mkdirSync as l,readFileSync as f,writeFileSync as u}from"fs";import{homedir as g,platform as m}from"os";import{dirname as v,join as n}from"path";var P=["claude-desktop","claude-code","antigravity","codex","cursor","vscode"];function b(e=g(),r=process.cwd(),s=m()){return{"claude-desktop":{id:"claude-desktop",label:"Claude Desktop",configPath:s==="darwin"?n(e,"Library","Application Support","Claude","claude_desktop_config.json"):s==="win32"?n(e,"AppData","Roaming","Claude","claude_desktop_config.json"):n(e,".config","Claude","claude_desktop_config.json"),format:"json-mcpServers",supportsMcpApps:!0},"claude-code":{id:"claude-code",label:"Claude Code",configPath:n(e,".claude.json"),format:"json-mcpServers",supportsMcpApps:!1},antigravity:{id:"antigravity",label:"Antigravity",configPath:n(e,".gemini","antigravity","mcp_config.json"),format:"json-mcpServers",supportsMcpApps:!0},codex:{id:"codex",label:"Codex",configPath:n(e,".codex","config.toml"),format:"toml-codex",supportsMcpApps:!0},cursor:{id:"cursor",label:"Cursor",configPath:n(e,".cursor","mcp.json"),format:"json-mcpServers",supportsMcpApps:!0},vscode:{id:"vscode",label:"VS Code (Copilot)",configPath:n(r,".vscode","mcp.json"),format:"json-servers",supportsMcpApps:!0}}}function S(e,r="flowe",s=["mcp"]){if(e.format==="toml-codex"){let t=s.map(o=>`"${o}"`).join(", ");return`[mcp_servers.flowe]
|
|
2
2
|
command = "${r}"
|
|
3
3
|
args = [${t}]
|
|
4
4
|
`}return e.format==="json-servers"?JSON.stringify({servers:{flowe:{type:"stdio",command:r,args:s}}},null,2):JSON.stringify({mcpServers:{flowe:{command:r,args:s}}},null,2)}function k(e,r={}){let s=r.command??"flowe",t=r.args??["mcp"],o=d(e.configPath)?f(e.configPath,"utf-8"):"",i;if(e.format==="toml-codex")if(/^\s*\[mcp_servers\.flowe\]/m.test(o))i=o;else{let c=o.length>0&&!o.endsWith(`
|