@flowe-ai/cli 0.3.2 → 0.4.0
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 +15 -7
- package/dist/chunk-3AO4PCEG.js +5 -0
- package/dist/chunk-B32B6OSK.js +1 -0
- package/dist/{chunk-M56P7SDZ.js → chunk-FXWU7EJA.js} +1 -1
- package/dist/{chunk-JTAA4OAX.js → chunk-LCVEDM2W.js} +1 -1
- package/dist/cli.js +68 -56
- package/dist/{login-IDFOVWCU.js → login-UO2GGRN2.js} +2 -2
- package/dist/mcp-server.js +9 -9
- package/dist/me-3CJ5RYRM.js +1 -0
- package/dist/{session-client-XHJ2MGA5.js → session-client-BR4JJT7O.js} +1 -1
- package/dist/ui/live-session.html +8 -8
- package/dist/ui/micro.html +6 -6
- package/package.json +4 -5
- package/protocols.json +857 -76
- package/skills/flowe/SKILL.md +15 -7
- package/audio/body_scan_60.ada.cues.json +0 -67
- package/audio/body_scan_60.ada.mp3 +0 -0
- package/audio/body_scan_60.ellie.cues.json +0 -67
- package/audio/body_scan_60.ellie.mp3 +0 -0
- package/audio/body_scan_60.sage.cues.json +0 -67
- package/audio/body_scan_60.sage.mp3 +0 -0
- package/audio/box_breath_45.ada.cues.json +0 -103
- package/audio/box_breath_45.ada.mp3 +0 -0
- package/audio/box_breath_45.ellie.cues.json +0 -103
- package/audio/box_breath_45.ellie.mp3 +0 -0
- package/audio/box_breath_45.sage.cues.json +0 -103
- package/audio/box_breath_45.sage.mp3 +0 -0
- package/audio/box_breath_60.ada.cues.json +0 -135
- package/audio/box_breath_60.ada.mp3 +0 -0
- package/audio/box_breath_60.ellie.cues.json +0 -135
- package/audio/box_breath_60.ellie.mp3 +0 -0
- package/audio/box_breath_60.sage.cues.json +0 -135
- package/audio/box_breath_60.sage.mp3 +0 -0
- package/audio/extended_box_90.ada.cues.json +0 -199
- package/audio/extended_box_90.ada.mp3 +0 -0
- package/audio/extended_box_90.ellie.cues.json +0 -199
- package/audio/extended_box_90.ellie.mp3 +0 -0
- package/audio/extended_box_90.sage.cues.json +0 -199
- package/audio/extended_box_90.sage.mp3 +0 -0
- package/audio/eye_rotation_30.ada.cues.json +0 -41
- package/audio/eye_rotation_30.ada.mp3 +0 -0
- package/audio/eye_rotation_30.ellie.cues.json +0 -41
- package/audio/eye_rotation_30.ellie.mp3 +0 -0
- package/audio/eye_rotation_30.sage.cues.json +0 -41
- package/audio/eye_rotation_30.sage.mp3 +0 -0
- package/audio/full_sensory_90.ada.cues.json +0 -60
- package/audio/full_sensory_90.ada.mp3 +0 -0
- package/audio/full_sensory_90.ellie.cues.json +0 -60
- package/audio/full_sensory_90.ellie.mp3 +0 -0
- package/audio/full_sensory_90.sage.cues.json +0 -60
- package/audio/full_sensory_90.sage.mp3 +0 -0
- package/audio/grounded_feet_45.ada.cues.json +0 -40
- package/audio/grounded_feet_45.ada.mp3 +0 -0
- package/audio/grounded_feet_45.ellie.cues.json +0 -40
- package/audio/grounded_feet_45.ellie.mp3 +0 -0
- package/audio/grounded_feet_45.sage.cues.json +0 -40
- package/audio/grounded_feet_45.sage.mp3 +0 -0
- package/audio/neck_rotation_45.ada.cues.json +0 -55
- package/audio/neck_rotation_45.ada.mp3 +0 -0
- package/audio/neck_rotation_45.ellie.cues.json +0 -55
- package/audio/neck_rotation_45.ellie.mp3 +0 -0
- package/audio/neck_rotation_45.sage.cues.json +0 -55
- package/audio/neck_rotation_45.sage.mp3 +0 -0
- package/audio/palming_60.ada.cues.json +0 -61
- package/audio/palming_60.ada.mp3 +0 -0
- package/audio/palming_60.ellie.cues.json +0 -61
- package/audio/palming_60.ellie.mp3 +0 -0
- package/audio/palming_60.sage.cues.json +0 -61
- package/audio/palming_60.sage.mp3 +0 -0
- package/audio/physiological_sigh_30.ada.cues.json +0 -55
- package/audio/physiological_sigh_30.ada.mp3 +0 -0
- package/audio/physiological_sigh_30.ellie.cues.json +0 -55
- package/audio/physiological_sigh_30.ellie.mp3 +0 -0
- package/audio/physiological_sigh_30.sage.cues.json +0 -55
- package/audio/physiological_sigh_30.sage.mp3 +0 -0
- package/audio/progressive_palming_90.ada.cues.json +0 -61
- package/audio/progressive_palming_90.ada.mp3 +0 -0
- package/audio/progressive_palming_90.ellie.cues.json +0 -61
- package/audio/progressive_palming_90.ellie.mp3 +0 -0
- package/audio/progressive_palming_90.sage.cues.json +0 -61
- package/audio/progressive_palming_90.sage.mp3 +0 -0
- package/audio/quick_palming_30.ada.cues.json +0 -40
- package/audio/quick_palming_30.ada.mp3 +0 -0
- package/audio/quick_palming_30.ellie.cues.json +0 -40
- package/audio/quick_palming_30.ellie.mp3 +0 -0
- package/audio/quick_palming_30.sage.cues.json +0 -40
- package/audio/quick_palming_30.sage.mp3 +0 -0
- package/dist/chunk-3KM7AYV7.js +0 -5
- package/dist/chunk-DX2IZG3L.js +0 -1
- package/dist/me-6WIWKE2Q.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{a as p,
|
|
1
|
+
import{a as p,l as f}from"./chunk-B32B6OSK.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-3CJ5RYRM.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{
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
5
|
-
`),
|
|
6
|
-
`),
|
|
7
|
-
`)
|
|
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{
|
|
1
|
+
import{A as X,B as Z,C as ee,D as te,F as re,a as L,b as y,c as v,e as V,k as D,o as B,q as K,r as R,s as J,t as x,u as O,v as $,w as N,x as U,y as Y,z as P}from"./chunk-3AO4PCEG.js";import{e as oe,f as ne,i as se,j as ie}from"./chunk-3TLGYA6M.js";import{a as ae,b as ce,c as ue,d as T,e as de,f as g,g as A,i as le,j as pe,k as me}from"./chunk-LCVEDM2W.js";import{a as F,b as Q,d as W,h as k,i as b,j as G,k as C}from"./chunk-B32B6OSK.js";import{McpServer as Le}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as Qe}from"@modelcontextprotocol/sdk/server/stdio.js";import{registerAppResource as ye,registerAppTool as f,RESOURCE_MIME_TYPE as ke}from"@modelcontextprotocol/ext-apps/server";import{z as s}from"zod/v4";function he(e){let t=e.nowSec??Math.floor(Date.now()/1e3);return e.snoozedUntil&&e.snoozedUntil>t||e.authenticated?null:e.streakDays>=2?{kind:"keep_streak",title:`Keep your ${e.streakDays}-day streak`,body:"It lives on this machine for now. Sign in to keep it everywhere.",action:"sign_in"}:e.totalResets>=3?{kind:"remember",title:"Sign in, and Ellie remembers what helps you.",action:"sign_in"}:null}import{existsSync as Pe,readFileSync as Ae}from"fs";import{dirname as qe,join as ge,resolve as Me}from"path";import{fileURLToPath as je}from"url";var l="ui://flowe/micro.html",h="ui://flowe/live-session.html",q={ui:{prefersBorder:!1,csp:{connectDomains:[],resourceDomains:[]}}},M={ui:{prefersBorder:!1,permissions:{microphone:{}},csp:{connectDomains:["https://www.flowe.ai","https://flowe.ai","wss://*.livekit.cloud","https://*.livekit.cloud"],resourceDomains:[]}}},we=new Map;function He(e,t=import.meta.url){let n=qe(je(t));for(let o=0;o<4;o++){let i=[ge(n,"ui",e),ge(n,"dist","ui",e)];for(let c of i)if(Pe(c))return c;let r=Me(n,"..");if(r===n)break;n=r}return null}function ze(e){return`<!doctype html><html lang="en"><head><meta charset="UTF-8"/><title>${e}</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>${e}</strong> \u2014 run <code>pnpm build</code> in flowe-cli to bundle UI resources.</p></body></html>`}function j(e){let t=we.get(e);if(t)return t;let n=He(e);if(n){let o=Ae(n,"utf-8");return we.set(e,o),o}return ze(e==="live-session.html"?"Flowe Live Session":"Flowe")}function w(){return{authenticated:!1,first_name:null,email:null,is_pro:!1,plan_type:"guest",quick_reset_quota:null}}var xe=["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
|
+
`),Te=["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.","Pass the same `moment`, `situation` and `feeling` you would pass to flowe_reset: the card","starts the micro reset with them, shaped to the moment."].join(`
|
|
3
|
+
`),Ee=["Run a 30, 45, 60, or 90-second micro-reset for the human operator, shaped to their moment,","and display the live interactive Flowe Reset card inline (no account needed).","Always pass `moment`: one line about the person, in plain words (\u2264 200 chars), e.g.",'"Third red test run tonight. Wants a minute before trying again." Never code, file paths,',"links, repo or project names, or command output. Also pass `situation` and `feeling`.","Flowe writes the words around a fixed breath plan and voices them; nothing is pre-recorded.","5 shaped resets a week without Flowe Pro (signing in brings an account\u2019s own 5; Pro is unlimited).","When the 5 are used, the card asks a guest to sign in and a free account to go Pro.","Offline, it guides the breath with no voice, and that does not count.","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
|
+
`),E=["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
|
+
`),Ie=["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
|
+
`),H="https://www.flowe.ai/pricing?utm_source=flowe-cli&utm_medium=mcp";function We(e){return`${e} minute${e===1?"":"s"}`}function Ge(e){let t=e.status==="live"?"The card can join the room now.":"The user can join from the card, the link or the QR code.";return[e.message_for_user,t,e.session_id?`session_id: ${e.session_id}`:""].filter(Boolean).join(" ")}function Ve(e,t){return t.team_paused?`${A(t.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.`:e==="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 Fe='One line about the person\u2019s moment, in plain words (\u2264 200 chars), e.g. "Third red test run tonight. Wants a minute first." Never code, file paths, links, repo names or command output.',Ce="What the person is in the middle of.",De="How the person seems to feel.",be={moment:{type:"string",maxLength:400,description:Fe},situation:{type:"string",enum:[...O],description:Ce},feeling:{type:"string",enum:[...$],description:De}},Se={moment:s.string().max(400).optional().describe(Fe),situation:s.enum(O).optional().describe(Ce),feeling:s.enum($).optional().describe(De)};function ve(e){return{authenticated:e!=="guest",is_pro:e==="pro",plan_type:e,quick_reset_quota:null}}function Be(e){return!e||e.cap<0?"":` ${e.used} of ${e.cap} shaped resets used this week.`}var Oe=["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
|
+
`),$e=["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
|
+
`),xt=[{name:"flowe_check_state",description:xe,inputSchema:{type:"object",properties:{},required:[]}},{name:"flowe_suggest_reset",description:Te,_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"},...be},required:[]}},{name:"flowe_reset",description:Ee,_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)."},...be,voice:{type:"string",enum:["ellie","ada","sage"]},audio_mode:{type:"string",enum:["local","silent","chime"]}},required:["duration_seconds"]}},{name:"flowe_quick_reset",description:E,_meta:{ui:{resourceUri:h}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...y],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:Ie,_meta:{ui:{resourceUri:h}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...v],description:"Which Deep Reset to run. Defaults to ht_stress."},ambient:{type:"string"}},required:[]}},{name:"flowe_nsdr",description:E,_meta:{ui:{resourceUri:h}},inputSchema:{type:"object",properties:{session_type:{type:"string",enum:[...y],description:"Which Quick Reset (NSDR) session type to run. Defaults to quick_reset."}},required:[]}},{name:"flowe_focus",description:Oe,_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:$e,_meta:{ui:{resourceUri:l}},inputSchema:{type:"object",properties:{},required:[]}}];function Ke(e){let t=e,n=t?.message||String(e),o=t?.code??"unknown";return{content:[{type:"text",text:`error[${o}]: ${n}`}],structuredContent:{error:!0,code:o,message:n},isError:!0}}function Je(e){switch(e){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 Re(e,t){let n=e==="deep"?t.session_type??"ht_stress":t.session_type??"quick_reset",o="ada",i=t.ambient??"none",r=await g().catch(w);if(!r.authenticated){let c=await T(),u={view:"auth",auth:c,pending_tier:e,pending_session_type:n,voice:o,ambient:i,account:r,message:`Sign in to Flowe to start this ${e==="deep"?"Deep Reset":"Quick Reset"}: ${c.verification_uri_complete} (code: ${c.user_code})`};return{content:[{type:"text",text:u.message}],structuredContent:u}}try{let c=await pe({tier:e,sessionType:n,voice:o,ambient:i}),u={view:"live_session",...c,account:r};return{content:[{type:"text",text:Ge(c)}],structuredContent:u}}catch(c){let u=c;if(u.code==="auth_required"){let d=await T(),p={view:"auth",auth:d,pending_tier:e,pending_session_type:n,voice:o,ambient:i,account:{authenticated:!1,is_pro:!1,plan_type:"guest"},message:`Your Flowe sign-in expired. Approve here to continue: ${d.verification_uri_complete} (code: ${d.user_code})`};return{content:[{type:"text",text:p.message}],structuredContent:p}}if(u.code==="quota_exceeded"||u.code==="subscription_required"){let d={view:"quota",code:u.code,tier:e,message:Ve(e,r),upgrade_url:r.team_paused?void 0:H,account:r};return{content:[{type:"text",text:d.message}],structuredContent:d}}throw c}}async function m(e,t={}){try{if(e==="flowe_check_state"){let n=await g().catch(w),i={...x({authenticated:n.authenticated}),account:n,voice:F().voice,shaping:Y(),available_micro_protocols:V(),available_quick_resets:ce.map(r=>({id:r.id,name:r.name,minutes:r.duration_minutes})),available_deep_resets:ue.map(r=>({id:r.id,name:r.name,length:ae}))};return{content:[{type:"text",text:JSON.stringify(i)}],structuredContent:i}}if(e==="flowe_suggest_reset"){let n=await g().catch(w),o=x({authenticated:n.authenticated});if(!o.can_suggest){let p=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:p}],structuredContent:{view:"snoozed",snooze_minutes:o.snooze_remaining_minutes||5,blocked_reason:o.blocked_reason,account:n,message:p}}}K();let i=Je(t.signal),r=t.recommended_duration??i.duration,c=t.recommended_protocol??i.protocol,u=t.reason??`You\u2019ve been working for ${We(Math.max(1,o.session_minutes))}. A short reset clears visual and nervous-system load without losing context.`,d={view:"suggest",eyebrow:o.session_minutes>=20?`${i.eyebrow} \xB7 ${o.session_minutes} MIN`:i.eyebrow,headline:i.headline,reason:u,recommended_tier:o.recommended_tier,recommended_duration:r,recommended_protocol:c,recommended_quick_type:i.quickType,session_minutes:o.session_minutes,sessions_today:o.sessions_today,streak_days:o.streak_days,moment:P(t.moment),situation:N(t.situation)?t.situation:void 0,feeling:U(t.feeling)?t.feeling:void 0,account:n};return{content:[{type:"text",text:`${i.headline} \u2014 ${u} (Suggested: ${r}s ${c}${n.authenticated?` or Quick Reset: ${i.quickType}`:""})`}],structuredContent:d}}if(e==="flowe_reset"){let n=t.duration_seconds??60,o=t.trigger??"claude_thinking",i=t.protocol,r=t.voice,c=t.audio_mode,u=c==="silent"||c==="chime"?"silent":"local",d=N(t.situation)?t.situation:void 0,p=U(t.feeling)?t.feeling:void 0,a;try{a=await te(n,o,i,{audioMode:u,voice:r,recordOnComplete:!0,moment:typeof t.moment=="string"?t.moment:void 0,situation:d,feeling:p,surface:"mcp"})}catch(_){if(!(_ instanceof X))throw _;let Ne={view:"limit",account_kind:_.account,allowance:_.allowance,message:_.message,upgrade_url:_.account==="free"?H:void 0,duration_seconds:n,family:i,moment:P(t.moment),situation:d,feeling:p,account:ve(_.account)},Ue=_.account==="guest"?"The card offers sign-in (or call flowe_auth); an account brings its own 5.":`The card offers Flowe Pro: ${H}`;return{content:[{type:"text",text:`${_.message} No reset played. ${Ue}`}],structuredContent:Ne}}R();let I=a.account?ve(a.account):{...w(),authenticated:!!await C()},z={view:"micro_reset",...a,family:a.protocol.replace(/_\d+$/,""),account_kind:a.account??null,account:I,audio_mode:a.audio_mode==="silent"&&c==="chime"?"chime":a.audio_mode,situation:d,feeling:p,sessions_today:k(),streak_days:b()};return{content:[{type:"text",text:a.shaped?`Started a ${a.duration_seconds}s ${a.protocol_display_name}, shaped to the moment (${a.voice}).${a.back_to_it?` Back to it: "${a.back_to_it}"`:""}${Be(a.allowance)} session_id: ${a.session_id}`:`Started a ${a.duration_seconds}s ${a.protocol_display_name} as a silent guide, with no voice (offline, shaping off, or the voice did not arrive in time). It does not count toward the week\u2019s 5. session_id: ${a.session_id}`}],structuredContent:z}}if(e==="flowe_quick_reset"||e==="flowe_nsdr")return await Re("quick",t);if(e==="flowe_deep_reset")return await Re("deep",t);if(e==="flowe_focus"){let n=t.action??"show",o=await g().catch(w);if(n==="start"){let u=t.preset??"pomodoro",d=t.ambient??"rain_window_soft",p,a;if(d!=="none")try{let I=await se().catch(()=>null),S=ne(I,oe())?.sounds.find(_=>_.id===d);S&&(p=await ie(S),a=S.id)}catch{}re({preset:u,ambientFilePath:p,ambientId:a})}let i=D(),r={view:"focus",focus:i,account:o};return{content:[{type:"text",text:i?`Flowe Focus active: ${i.preset} (${i.status}, block ${i.blockIndex}/${i.blocks}, ${Math.ceil(i.remainingSec/60)}m left${i.paused?", paused":""}).`:"No active Flowe Focus cycle. Pick Pomodoro (25/5), Dev (50/10), or Ultradian (90/15) to start."}],structuredContent:r}}if(e==="flowe_auth"){let n=await g().catch(w);if(n.authenticated){let r={view:"complete",account:n,sessions_today:k(),streak_days:b(),message:`Signed in to Flowe${n.first_name?` as ${n.first_name}`:""} (${le(n)}).${n.team_paused?` ${A(n.team_paused)} Ask your admin to turn it back on.`:""}`};return{content:[{type:"text",text:r.message}],structuredContent:r}}let o=await T(),i={view:"auth",auth:o,account:n,message:`Sign in to Flowe at ${o.verification_uri_complete} (code: ${o.user_code})`};return{content:[{type:"text",text:i.message}],structuredContent:i}}if(e==="flowe_auth_poll"){let n=String(t.device_code??""),o=await de(n),i={...o};return{content:[{type:"text",text:JSON.stringify(o)}],structuredContent:i}}if(e==="flowe_reset_control"){let n=String(t.action??"");if(n==="stop"){let o=ee();return{content:[{type:"text",text:o?"Reset stopped.":"No active reset."}],structuredContent:{stopped:o}}}if(n==="complete"){Z(typeof t.session_id=="string"?t.session_id:void 0),R();let o=b(),i={sessions_today:k(),streak_days:o,nudge:he({authenticated:!!await C(),streakDays:o,totalResets:G(),snoozedUntil:F().nudge_snoozed_until})};return{content:[{type:"text",text:JSON.stringify(i)}],structuredContent:i}}if(n==="snooze"){let o=Number(t.snooze_minutes??25),r={snoozed_until:J(o).snoozed_until,snooze_minutes:o};return{content:[{type:"text",text:`Snoozed for ${o} minutes.`}],structuredContent:r}}if(n==="snooze_nudges"){let o=W();return{content:[{type:"text",text:"Nudges hidden for 7 days."}],structuredContent:{nudge_snoozed_until:o}}}if(n==="set_voice"){let o=t.voice;return(o==="ellie"||o==="ada"||o==="sage")&&Q(o),{content:[{type:"text",text:`Voice set to ${o}.`}],structuredContent:{voice:o}}}return{content:[{type:"text",text:`unknown reset control action: ${n}`}],isError:!0}}if(e==="flowe_session_complete"){let n=String(t.session_id??""),o=typeof t.duration_minutes=="number"?t.duration_minutes:void 0,i=await me(n,{durationMinutes:o});R();let r={...i,sessions_today:k(),streak_days:b()};return{content:[{type:"text",text:JSON.stringify(r)}],structuredContent:r}}if(e==="flowe_focus_control"){let n=String(t.action??"status");(n==="pause"||n==="resume"||n==="skip"||n==="quit")&&B(n);let i={view:"focus",focus:D()};return{content:[{type:"text",text:JSON.stringify(i)}],structuredContent:i}}return{content:[{type:"text",text:`unknown tool: ${e}`}],isError:!0}}catch(n){return Ke(n)}}function Ye(){let e=new Le({name:"flowe",version:L()});return ye(e,"Flowe Reset & Focus Card",l,{_meta:q},async()=>({contents:[{uri:l,mimeType:ke,text:j("micro.html"),_meta:q}]})),ye(e,"Flowe Live Quick & Deep Reset Player",h,{_meta:M},async()=>({contents:[{uri:h,mimeType:ke,text:j("live-session.html"),_meta:M}]})),e.registerResource("Flowe Session State","flowe://session/state",{description:"Current local Flowe session cadence, cooldown, focus daemon, and account summary.",mimeType:"application/json"},async()=>{let t=await g().catch(w),n=x({authenticated:t.authenticated});return{contents:[{uri:"flowe://session/state",mimeType:"application/json",text:JSON.stringify({...n,account:t},null,2)}]}}),e.registerTool("flowe_check_state",{title:"Check Flowe Reset State",description:xe,annotations:{readOnlyHint:!0,idempotentHint:!0,openWorldHint:!1}},async()=>m("flowe_check_state",{})),f(e,"flowe_suggest_reset",{title:"Suggest a Flowe Reset",description:Te,inputSchema:s.object({reason:s.string().optional().describe("Calm 1-sentence reason why a reset fits right now."),signal:s.enum(["long_session","debugging_loop","eye_strain","stress","overload","pre_wait","wind_down"]).optional(),recommended_duration:s.union([s.literal(30),s.literal(45),s.literal(60),s.literal(90)]).optional(),recommended_protocol:s.string().optional(),...Se}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async t=>m("flowe_suggest_reset",t)),f(e,"flowe_reset",{title:"Run Micro-Reset (30\u201390s)",description:Ee,inputSchema:s.object({duration_seconds:s.union([s.literal(30),s.literal(45),s.literal(60),s.literal(90)]),protocol:s.string().optional().describe("Protocol family (e.g. physiological_sigh, box_breath, palming, body_scan)."),...Se,trigger:s.enum(["claude_thinking","long_compile","agent_call","user_requested","long_session","harness_suggested"]).optional(),voice:s.enum(["ellie","ada","sage"]).optional(),audio_mode:s.enum(["local","silent","chime"]).optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async t=>m("flowe_reset",t)),f(e,"flowe_quick_reset",{title:"Start Live Flowe Quick Reset (5\u201315m)",description:E,inputSchema:s.object({session_type:s.enum(y).optional(),ambient:s.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:h,visibility:["model","app"]}}},async t=>m("flowe_quick_reset",t)),f(e,"flowe_deep_reset",{title:"Start Live Flowe Deep Reset (30\u201350m)",description:Ie,inputSchema:s.object({session_type:s.enum(v).optional(),ambient:s.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:h,visibility:["model","app"]}}},async t=>m("flowe_deep_reset",t)),f(e,"flowe_nsdr",{title:"Start Guided NSDR Quick Reset",description:E,inputSchema:s.object({session_type:s.enum(y).optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:h,visibility:["model","app"]}}},async t=>m("flowe_nsdr",t)),f(e,"flowe_focus",{title:"Flowe Focus Room",description:Oe,inputSchema:s.object({action:s.enum(["show","start"]).optional(),preset:s.enum(["pomodoro","dev","ultradian"]).optional(),ambient:s.string().optional()}),annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!1},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async t=>m("flowe_focus",t)),f(e,"flowe_auth",{title:"Sign in to Flowe",description:$e,annotations:{readOnlyHint:!1,destructiveHint:!1,openWorldHint:!0},_meta:{ui:{resourceUri:l,visibility:["model","app"]}}},async()=>m("flowe_auth",{})),f(e,"flowe_auth_poll",{description:"Poll device-grant authentication status from the Flowe sign-in card.",inputSchema:s.object({device_code:s.string().min(8)}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async t=>m("flowe_auth_poll",t)),f(e,"flowe_reset_control",{description:"Stop, complete, snooze, hide nudges for a week, or adjust voice for a Flowe micro-reset.",inputSchema:s.object({action:s.enum(["stop","complete","snooze","snooze_nudges","set_voice"]),session_id:s.string().optional(),snooze_minutes:s.number().optional(),voice:s.enum(["ellie","ada","sage"]).optional()}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async t=>m("flowe_reset_control",t)),f(e,"flowe_session_complete",{description:"Complete an active live Flowe Quick or Deep Reset session.",inputSchema:s.object({session_id:s.string().min(1),duration_minutes:s.number().optional()}),_meta:{ui:{resourceUri:h,visibility:["app"]}}},async t=>m("flowe_session_complete",t)),f(e,"flowe_focus_control",{description:"Inspect or control the detached Flowe focus daemon.",inputSchema:s.object({action:s.enum(["status","pause","resume","skip","quit"])}),_meta:{ui:{resourceUri:l,visibility:["app"]}}},async t=>m("flowe_focus_control",t)),e.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."}}]})),e.registerPrompt("flowe_quick_reset",{title:"Flowe Quick Reset",description:"Start a live 5\u201315 minute Flowe Quick Reset session.",argsSchema:{type:s.enum(y).optional().describe("Quick Reset type (default: quick_reset)")}},async({type:t})=>({messages:[{role:"user",content:{type:"text",text:`Start a Flowe Quick Reset using flowe_quick_reset${t?` with session_type="${t}"`:""}.`}}]})),e.registerPrompt("flowe_deep_reset",{title:"Flowe Deep Reset",description:"Start a 30\u201350 minute two-way Flowe Deep Reset session.",argsSchema:{type:s.enum(v).optional().describe("Deep Reset type (default: ht_stress)")}},async({type:t})=>({messages:[{role:"user",content:{type:"text",text:`Start a Flowe Deep Reset using flowe_deep_reset${t?` with session_type="${t}"`:""}.`}}]})),e}async function Xe(){let e=Ye(),t=new Qe;await e.connect(t)}var Ze=import.meta.url===`file://${process.argv[1]}`||process.argv[1]?.endsWith("mcp-server.js")||process.argv[1]?.endsWith("mcp-server.ts");Ze&&Xe().catch(e=>{process.stderr.write(`flowe-mcp: ${e instanceof Error?e.message:String(e)}
|
|
9
|
+
`),process.exit(1)});export{xt as TOOL_DEFINITIONS,Ye as createFloweMcpServer,m as handleCallTool,Xe as runMcpServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-FXWU7EJA.js";import"./chunk-B32B6OSK.js";export{a as fetchMe,b as refreshUserFirstName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-LCVEDM2W.js";import"./chunk-B32B6OSK.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};
|