@enhance-eng/enhance-dev 0.1.20-dev.sha-56017ad1d100 → 0.1.20-dev.sha-e63643fbee08
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.mjs +1 -1
- package/dist/mcp-main.mjs +1 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -20,4 +20,4 @@ For transcript-led selection, inspect nearby --at-ms renders and reject transiti
|
|
|
20
20
|
Preview first: canvas render --node-id rec_<recording-uuid> --at-ms <integer>, then inspect its PNG. This command persists the accepted moment.
|
|
21
21
|
`).action(async e=>{let n=w.uuid().nullable().safeParse(e.clientToken??null),r=w.uuid().safeParse(e.recordingId);if(!n.success||!r.success)throw new d(`BAD_REQUEST`,`The recording id or client token is not a UUID.`,"Use the recording id from `recording list`; mint one client token per accepted moment.");t.output.result(await t.invocation.invoke({capability:R(t.catalog(),`recording.snapshot`),arguments:{canvasId:h(e.canvas),recordingId:r.data,atMs:jr(e.atMs,`--at-ms`,!1),timeoutMs:jr(e.timeoutMs,`--timeout-ms`,!0)},clientToken:n.data}))})},Nr=(e,t,n)=>{if(e!==`canvas.document.save`||typeof n!=`object`||!n||!(`outcome`in n)||n.outcome!==`conflict`)return n;throw new d(`CONFLICT`,`The canvas document changed before this save landed.`,`Run 'enhance canvas document get --canvas-id ${typeof t==`object`&&t&&`canvasId`in t&&typeof t.canvasId==`string`?t.canvasId:`<canvas-id>`}', merge your change into that document, then retry with its version.`)},Pr=(e,t)=>Ze(e,e=>({[e]:{query:async n=>t.query(e,n),mutate:async n=>Nr(e,n,await t.mutate(e,n))}})),Fr=(e,t)=>{let n=e.commands.find(e=>e.name()===`transcript`);if(n===void 0)throw TypeError(`the API router did not supply transcript commands`);n.command(`get`).description(`Read timestamped speech cues as candidate moments; render and inspect candidate PNGs before snapshotting.`).requiredOption(`--canvas <url-or-id>`,`Canvas URL or UUID containing the recording.`).requiredOption(`--recording-id <uuid>`,`Recording UUID returned by recording list.`).action(async e=>{let n=w.uuid().safeParse(e.recordingId);if(!n.success)throw new d(`BAD_REQUEST`,`--recording-id must be a UUID.`,"Use the recording id returned by `enhance recording list`.");t.output.result(await t.invocation.invoke({capability:R(t.catalog(),`transcript.read`),arguments:{canvasId:h(e.canvas),recordingId:n.data},clientToken:null}))})},Ir={jsonInput:`auto`,prompts:!1,logger:`ndjson`,errorMapping:`stable-exit-codes`},Lr=e=>{let t=e.state;return{logger:e.output.logger,prompts:Ir.prompts,process:Zn(),formatError:e=>{let n=_(e,t.pendingParserMessage);return t.exitCode=oe(n,!1,e),t.pendingParserMessage=null,JSON.stringify(n)}}},Rr=e=>typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):null,zr=e=>{let t=Rr(e),n=t===null?void 0:t.description;return typeof n==`string`&&n!==``?n:null},Br=e=>{let t=Re({router:e});return{descriptions:new Map(t.flatMap(([e,t])=>{let n=zr(t.meta);return n===null?[]:[[e,n]]})),mutationPaths:new Set(t.flatMap(([e,t])=>t.type===`mutation`?[e]:[]))}},Vr=()=>{let e=null;return()=>(e??=le(),e)},Hr=(e,t,n)=>{let r=nt(t.remote),i=Ae({remote:t.remote,mutationKey:t.mutationKey,configDirectory:t.configDirectory,now:()=>new Date,progress:t.output.result});ot(e,Oe(t.credentials,t.remote,Ce(t.remote)),t.output),gr(e,i,n,t.output),_r(e,{version:t.version,credentials:t.credentials,remote:t.remote,output:t.output}),Er(e,{screen:r,recording:tt(t.remote),world:rt(t.remote,r)},t.output),hr(e,t.output,n),Jn(e,{remote:t.remote,mutationKey:t.mutationKey,invocation:i,catalog:n,output:t.output,configDirectory:t.configDirectory,now:()=>new Date}),Mr(e,{invocation:i,catalog:n,output:t.output}),Ar(e,i,n,t.output),Fr(e,{invocation:i,catalog:n,output:t.output})},Ur=e=>{let t=fe(),n=Vr(),{descriptions:r,mutationPaths:i}=Br(t),a=Le({router:Pr(t,e.remote),name:e.commandName,version:e.version,description:`Operate Enhance as the authenticated person.`,jsonInput:Ir.jsonInput}),o=Lr(e),s=a.buildProgram(o);if(!(s instanceof Ie))throw TypeError(`trpc-cli did not return a Commander program`);fr(s),Hr(s,e,n),cr(s,{descriptions:r,mutationPaths:i,mutationKey:e.mutationKey,output:e.output}),s.description(`Operate Enhance as the authenticated person.`);let c=e.state;return{program:s,run:async()=>{try{await a.run(o,s)}catch(t){if(!(t instanceof y))throw t;if(t.requestedCode!==0&&c.pendingParserMessage!==null){let n=_(t,c.pendingParserMessage);c.exitCode=oe(n,!0),c.pendingParserMessage=null,e.output.failure(n)}throw t}}}},Wr=e=>T.exit(e),Gr=36e5,X=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Kr=e=>{if(Array.isArray(e))return e.map(e=>JSON.stringify(e));if(!X(e)||!Array.isArray(e.items))return[JSON.stringify(e)];let t=e.items;if(t.length===0)return[JSON.stringify(e)];let n=e.truncated===!0;return t.map(e=>JSON.stringify(X(e)?{...e,truncated:n}:{value:e,truncated:n}))},qr=e=>{let t=`${e.join(`
|
|
22
22
|
`)}\n`;if(!(t.length>25e3||e.some(e=>e.length>2e3))){T.stdout.write(t);return}let n=Ye(`sha256`).update(t).digest(`hex`).slice(0,16),r=O.join(Be(),`enhance-${n}.ndjson`);D(r,t,{mode:384}),T.stdout.write(`${JSON.stringify({path:r,characters:t.length,records:e.length})}\n`)},Jr=e=>{try{let t=new URL(e),n=new Set;for(let e of t.searchParams.keys())n.add(e.toLowerCase());return n.has(`x-amz-signature`)||n.has(`x-amz-credential`)||n.has(`x-amz-algorithm`)}catch{return!1}},Z=e=>typeof e==`string`?Jr(e):Array.isArray(e)?e.some(e=>Z(e)):X(e)?Object.values(e).some(e=>Z(e)):!1,Q=e=>{Ge(e,{recursive:!0,mode:448}),He(e,448)},Yr=e=>{if(!Ue(e))return;let t=Date.now()-Gr,n=qe(e,{withFileTypes:!0});for(let r of n){if(!r.isFile()||!r.name.startsWith(`result-`))continue;let n=O.join(e,r.name);We(n).mtimeMs<t&&Je(n)}},$=e=>({...e,sensitive:!0,cleanup:`unlink-after-use`,deleteAfter:new Date(Date.now()+Gr).toISOString()}),Xr=(e,t)=>{let n=Kr(e),r=`${n.join(`
|
|
23
|
-
`)}\n`;Q(t);let i=O.join(t,`result-${k()}.ndjson`);D(i,r,{mode:384,flag:`wx`}),T.stdout.write(`${JSON.stringify($({path:i,characters:r.length,records:n.length,reason:`signed-url`}))}\n`)},Zr=e=>X(e)?typeof e.token==`string`?{field:`token`,value:e.token}:typeof e.acceptToken==`string`?{field:`acceptToken`,value:e.acceptToken}:null:null,Qr=(e,t,n)=>{let r=`${t.value}\n`;Q(n);let i=O.join(n,`result-${k()}.token`);D(i,r,{mode:384,flag:`wx`});let a=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.field));T.stdout.write(`${JSON.stringify({...a,secret:$({path:i,field:t.field,characters:r.length})})}\n`)},$r=e=>e.includes(`Usage:`)||e.includes(`Options:`)||e.includes(`Commands:`),ei=ne.omit({fields:!0}).extend({remediation:w.string(),fields:w.array(w.object({path:w.string(),message:w.string()})).optional()}),ti=e=>{try{let t=JSON.parse(e),n=ei.safeParse(t);return n.success?{code:n.data.code,message:n.data.message,remediation:n.data.remediation,...n.data.fields!==void 0&&{fields:n.data.fields}}:null}catch{return null}},ni=(e,t)=>{if(typeof e==`string`&&$r(e)){T.stdout.write(e);return}let n=Zr(e);if(n!==null&&X(e)){Qr(e,n,t);return}if(Z(e)){Xr(e,t);return}let r=he(e);if(r!==null){let e=null;if(r.detail!==null){Q(t);let n=O.join(t,`result-${k()}.ndjson`),i=`${JSON.stringify(r.detail)}\n`;D(n,i,{mode:384,flag:`wx`}),e=$({path:n,characters:i.length,records:1})}T.stdout.write(`${JSON.stringify({...r.value,...e!==null&&{detail:e}})}\n`);return}qr(Kr(e))},ri=e=>{T.stderr.write(`${JSON.stringify(e)}\n`)},ii=(e,t,n=`enhance`)=>{let r=e,i=O.join(t,`sensitive`);return Yr(i),{result:e=>{ni(g(e,n),i)},failure:e=>{ri(xe(e,n))},logger:{info:(...e)=>{ni(g(e.length===1?e[0]:e,n),i)},error:(...e)=>{let t=String(g(e.map(String).join(``),n)),i=ti(t);i===null?r.pendingParserMessage=t:ri(i)}}}};(async()=>{let e={exitCode:1,pendingParserMessage:null},t=ii(e,S.configDirectory,S.commandName),n=Me(S.configDirectory),r=Pe(),i=Ur({version:`0.1.20-dev.sha-
|
|
23
|
+
`)}\n`;Q(t);let i=O.join(t,`result-${k()}.ndjson`);D(i,r,{mode:384,flag:`wx`}),T.stdout.write(`${JSON.stringify($({path:i,characters:r.length,records:n.length,reason:`signed-url`}))}\n`)},Zr=e=>X(e)?typeof e.token==`string`?{field:`token`,value:e.token}:typeof e.acceptToken==`string`?{field:`acceptToken`,value:e.acceptToken}:null:null,Qr=(e,t,n)=>{let r=`${t.value}\n`;Q(n);let i=O.join(n,`result-${k()}.token`);D(i,r,{mode:384,flag:`wx`});let a=Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.field));T.stdout.write(`${JSON.stringify({...a,secret:$({path:i,field:t.field,characters:r.length})})}\n`)},$r=e=>e.includes(`Usage:`)||e.includes(`Options:`)||e.includes(`Commands:`),ei=ne.omit({fields:!0}).extend({remediation:w.string(),fields:w.array(w.object({path:w.string(),message:w.string()})).optional()}),ti=e=>{try{let t=JSON.parse(e),n=ei.safeParse(t);return n.success?{code:n.data.code,message:n.data.message,remediation:n.data.remediation,...n.data.fields!==void 0&&{fields:n.data.fields}}:null}catch{return null}},ni=(e,t)=>{if(typeof e==`string`&&$r(e)){T.stdout.write(e);return}let n=Zr(e);if(n!==null&&X(e)){Qr(e,n,t);return}if(Z(e)){Xr(e,t);return}let r=he(e);if(r!==null){let e=null;if(r.detail!==null){Q(t);let n=O.join(t,`result-${k()}.ndjson`),i=`${JSON.stringify(r.detail)}\n`;D(n,i,{mode:384,flag:`wx`}),e=$({path:n,characters:i.length,records:1})}T.stdout.write(`${JSON.stringify({...r.value,...e!==null&&{detail:e}})}\n`);return}qr(Kr(e))},ri=e=>{T.stderr.write(`${JSON.stringify(e)}\n`)},ii=(e,t,n=`enhance`)=>{let r=e,i=O.join(t,`sensitive`);return Yr(i),{result:e=>{ni(g(e,n),i)},failure:e=>{ri(xe(e,n))},logger:{info:(...e)=>{ni(g(e.length===1?e[0]:e,n),i)},error:(...e)=>{let t=String(g(e.map(String).join(``),n)),i=ti(t);i===null?r.pendingParserMessage=t:ri(i)}}}};(async()=>{let e={exitCode:1,pendingParserMessage:null},t=ii(e,S.configDirectory,S.commandName),n=Me(S.configDirectory),r=Pe(),i=Ur({version:`0.1.20-dev.sha-e63643fbee08`,credentials:n,remote:ke(S.apiUrl,n,r),mutationKey:r,output:t,state:e,configDirectory:S.configDirectory,commandName:S.commandName});try{await i.run()}catch(n){n instanceof y&&Wr(n.requestedCode===0?0:e.exitCode),t.failure(_(n,null)),Wr(1)}})();export{};
|
package/dist/mcp-main.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{d as e,m as t,o as n}from"./cli-output-identity.lib-BxOq1eK4.mjs";import{a as r,i,m as a,n as o,o as s,r as c,t as l}from"./mutation-key.adapter-Cl4fSIbD.mjs";import{t as u}from"./mcp-server.adapter-CNtErk6p.mjs";import{z as d}from"zod";import f from"node:process";import{serveStdio as p}from"@modelcontextprotocol/server/stdio";const m=d.object({openBrowser:d.boolean()}),h=(e,t)=>{let i=a(e,t,r(t)),o=null,s=null;return{login:async e=>{if(o!==null)return o.ready;let t=m.parse(e),r=new AbortController,a=Promise.withResolvers();s=null;let c=(async()=>{try{await i.loginWithBrowser({label:`Agent plugin`,openBrowser:t.openBrowser,signal:r.signal,onReady:e=>{s={authenticated:!1,status:`waiting_for_browser`,url:e},a.resolve(s)}}),s=null}catch(e){s={authenticated:!1,status:`failed`,error:n(e,null)},a.reject(e)}finally{o=null}})();return o={controller:r,ready:a.promise,completion:c},a.promise},status:async()=>s===null?await e.read()===null?{authenticated:!1}:i.status():s,logout:async()=>(o?.controller.abort(),await o?.completion,s=null,i.logout())}},g=new Set([`auth.login`,`auth.logout`,`auth.status`,`doctor`]),_=async e=>{switch(e.capability){case`auth.login`:return e.auth.login(e.arguments);case`auth.logout`:return e.auth.logout();case`auth.status`:return e.auth.status();case`doctor`:{let[t,n]=await Promise.all([e.remote.health(),e.credentials.read()]);return{status:n!==null&&t.reachable?`ok`:`degraded`,runtimeVersion:e.version,api:{reachable:t.reachable,status:t.status,...t.error!==void 0&&{error:t.error}},credential:{present:n!==null}}}default:throw TypeError(`${e.capability} has no MCP transport execution`)}},v=(e,t,n,r)=>{let i=o(e,t,l()),a=h(t,i);return{invoke:async c=>{if(g.has(c.capability.id))return _({capability:c.capability.id,arguments:c.arguments,credentials:t,remote:i,version:r,auth:a});let u=l();return s({remote:o(e,t,u),mutationKey:u,configDirectory:n}).invoke(c)}}},y=d.object({authenticated:d.literal(!1)}),b=d.object({authenticated:d.literal(!1),status:d.literal(`waiting_for_browser`),url:d.url()}),x=d.object({authenticated:d.literal(!1),status:d.literal(`failed`),error:d.object({code:d.string(),message:d.string(),remediation:d.string()})}),S=d.object({authenticated:d.literal(!0),personId:d.uuid(),displayName:d.string().min(1),tokenId:d.uuid(),tokenLabel:d.string().min(1),expiresAt:d.iso.datetime().nullable()}),C=d.object({openBrowser:d.boolean().default(!0).describe(`Open the system browser for human sign-in; return its URL immediately.`)}),w=d.strictObject({}),T=d.union([b,x,y,S]),E=d.object({loggedOut:d.boolean()}),D=d.object({status:d.enum([`ok`,`degraded`]),runtimeVersion:d.string().min(1),api:d.object({reachable:d.boolean(),status:d.number().int().nullable(),error:d.string().optional()}),credential:d.object({present:d.boolean()})}),O=e=>({summary:e.summary,useWhen:e.useWhen,preconditions:[`Run through the local Enhance MCP runtime, which owns the user-scoped credential.`,`Keep credential values outside model-visible input and output.`],input:[],output:[],result:e.result,recovery:[`BAD_REQUEST: correct the named option and call again.`,`UNAUTHORIZED: start browser sign-in and let the person complete consent.`,`FORBIDDEN: leave the credential unchanged and report the governing account policy.`,`INTERNAL: call doctor, report the failing boundary, and stop repeating the call.`],next:e.next,examples:[{input:e.exampleInput,output:e.exampleOutput}]}),k=e=>t({...e,source:`composite`,idempotency:e.operation===`query`?`none`:`single`,execution:{kind:`composite`,procedures:[]},meta:{description:e.guide.summary},policy:{exposure:`mcp-transport`,reason:`The local MCP runtime owns its own authentication and installation diagnostics.`,owner:`mcp`},cliPath:null,inputExample:e.guide.examples[0]?.input,outputExample:e.guide.examples[0]?.output}),A=[k({id:`auth.login`,operation:`mutation`,effect:`external`,inputSchema:C,outputSchema:b,guide:O({summary:`Open browser sign-in and store a revocable user-scoped Enhance credential.`,useWhen:`Use when Enhance is not authenticated or its credential was revoked.`,result:`Returns waiting_for_browser and the exact sign-in URL immediately. Show this URL to the person if their browser restores another page. Consent continues in the background; auth.status reports completion or a failure.`,next:[`Show the sign-in URL, then check auth.status after the person finishes. Only report success after authenticated is true and a canvas read succeeds.`],exampleInput:{openBrowser:!0},exampleOutput:{authenticated:!1,status:`waiting_for_browser`,url:`https://app.example.test/oauth/authorize?client_id=client_enhance_cli`}})}),k({id:`auth.logout`,operation:`mutation`,effect:`delete`,inputSchema:w,outputSchema:E,guide:O({summary:`Remove the user-scoped local Enhance credential.`,useWhen:`Use only when the person asks to disconnect this local agent host.`,result:`Reports whether a local credential was removed without returning its value.`,next:[`Call auth.status to confirm the local runtime is disconnected.`],exampleInput:{},exampleOutput:{loggedOut:!0}})}),k({id:`auth.status`,operation:`query`,effect:`read`,inputSchema:w,outputSchema:T,guide:O({summary:`Check whether the local Enhance MCP runtime is authenticated.`,useWhen:`Use before a workflow or after login, logout, expiry, or an authorization failure.`,result:`Returns safe identity metadata, a pending sign-in URL, a sign-in failure, or authenticated false; never a credential value.`,next:[`While waiting_for_browser, show the URL and let the person finish. After failure, report the error before retrying auth.login. Continue the workflow only when authenticated is true.`],exampleInput:{},exampleOutput:{authenticated:!1}})}),k({id:`doctor`,operation:`query`,effect:`read`,inputSchema:w,outputSchema:D,guide:O({summary:`Check MCP runtime identity, API reachability, and credential presence without changes.`,useWhen:`Use after repeated connection, authentication, or compatibility failure.`,result:`Returns bounded diagnostics without machine paths, credentials, or customer data.`,next:[`Follow the failing boundary; do not repeat a mutation while diagnostics are degraded.`],exampleInput:{},exampleOutput:{status:`ok`,runtimeVersion:`0.1.20`,api:{reachable:!0,status:200},credential:{present:!0}}})})].toSorted((e,t)=>e.id.localeCompare(t.id)),j=()=>A,M=c(i.configDirectory),N=v(i.apiUrl,M,i.configDirectory,`0.1.20-dev.sha-
|
|
2
|
+
import{d as e,m as t,o as n}from"./cli-output-identity.lib-BxOq1eK4.mjs";import{a as r,i,m as a,n as o,o as s,r as c,t as l}from"./mutation-key.adapter-Cl4fSIbD.mjs";import{t as u}from"./mcp-server.adapter-CNtErk6p.mjs";import{z as d}from"zod";import f from"node:process";import{serveStdio as p}from"@modelcontextprotocol/server/stdio";const m=d.object({openBrowser:d.boolean()}),h=(e,t)=>{let i=a(e,t,r(t)),o=null,s=null;return{login:async e=>{if(o!==null)return o.ready;let t=m.parse(e),r=new AbortController,a=Promise.withResolvers();s=null;let c=(async()=>{try{await i.loginWithBrowser({label:`Agent plugin`,openBrowser:t.openBrowser,signal:r.signal,onReady:e=>{s={authenticated:!1,status:`waiting_for_browser`,url:e},a.resolve(s)}}),s=null}catch(e){s={authenticated:!1,status:`failed`,error:n(e,null)},a.reject(e)}finally{o=null}})();return o={controller:r,ready:a.promise,completion:c},a.promise},status:async()=>s===null?await e.read()===null?{authenticated:!1}:i.status():s,logout:async()=>(o?.controller.abort(),await o?.completion,s=null,i.logout())}},g=new Set([`auth.login`,`auth.logout`,`auth.status`,`doctor`]),_=async e=>{switch(e.capability){case`auth.login`:return e.auth.login(e.arguments);case`auth.logout`:return e.auth.logout();case`auth.status`:return e.auth.status();case`doctor`:{let[t,n]=await Promise.all([e.remote.health(),e.credentials.read()]);return{status:n!==null&&t.reachable?`ok`:`degraded`,runtimeVersion:e.version,api:{reachable:t.reachable,status:t.status,...t.error!==void 0&&{error:t.error}},credential:{present:n!==null}}}default:throw TypeError(`${e.capability} has no MCP transport execution`)}},v=(e,t,n,r)=>{let i=o(e,t,l()),a=h(t,i);return{invoke:async c=>{if(g.has(c.capability.id))return _({capability:c.capability.id,arguments:c.arguments,credentials:t,remote:i,version:r,auth:a});let u=l();return s({remote:o(e,t,u),mutationKey:u,configDirectory:n}).invoke(c)}}},y=d.object({authenticated:d.literal(!1)}),b=d.object({authenticated:d.literal(!1),status:d.literal(`waiting_for_browser`),url:d.url()}),x=d.object({authenticated:d.literal(!1),status:d.literal(`failed`),error:d.object({code:d.string(),message:d.string(),remediation:d.string()})}),S=d.object({authenticated:d.literal(!0),personId:d.uuid(),displayName:d.string().min(1),tokenId:d.uuid(),tokenLabel:d.string().min(1),expiresAt:d.iso.datetime().nullable()}),C=d.object({openBrowser:d.boolean().default(!0).describe(`Open the system browser for human sign-in; return its URL immediately.`)}),w=d.strictObject({}),T=d.union([b,x,y,S]),E=d.object({loggedOut:d.boolean()}),D=d.object({status:d.enum([`ok`,`degraded`]),runtimeVersion:d.string().min(1),api:d.object({reachable:d.boolean(),status:d.number().int().nullable(),error:d.string().optional()}),credential:d.object({present:d.boolean()})}),O=e=>({summary:e.summary,useWhen:e.useWhen,preconditions:[`Run through the local Enhance MCP runtime, which owns the user-scoped credential.`,`Keep credential values outside model-visible input and output.`],input:[],output:[],result:e.result,recovery:[`BAD_REQUEST: correct the named option and call again.`,`UNAUTHORIZED: start browser sign-in and let the person complete consent.`,`FORBIDDEN: leave the credential unchanged and report the governing account policy.`,`INTERNAL: call doctor, report the failing boundary, and stop repeating the call.`],next:e.next,examples:[{input:e.exampleInput,output:e.exampleOutput}]}),k=e=>t({...e,source:`composite`,idempotency:e.operation===`query`?`none`:`single`,execution:{kind:`composite`,procedures:[]},meta:{description:e.guide.summary},policy:{exposure:`mcp-transport`,reason:`The local MCP runtime owns its own authentication and installation diagnostics.`,owner:`mcp`},cliPath:null,inputExample:e.guide.examples[0]?.input,outputExample:e.guide.examples[0]?.output}),A=[k({id:`auth.login`,operation:`mutation`,effect:`external`,inputSchema:C,outputSchema:b,guide:O({summary:`Open browser sign-in and store a revocable user-scoped Enhance credential.`,useWhen:`Use when Enhance is not authenticated or its credential was revoked.`,result:`Returns waiting_for_browser and the exact sign-in URL immediately. Show this URL to the person if their browser restores another page. Consent continues in the background; auth.status reports completion or a failure.`,next:[`Show the sign-in URL, then check auth.status after the person finishes. Only report success after authenticated is true and a canvas read succeeds.`],exampleInput:{openBrowser:!0},exampleOutput:{authenticated:!1,status:`waiting_for_browser`,url:`https://app.example.test/oauth/authorize?client_id=client_enhance_cli`}})}),k({id:`auth.logout`,operation:`mutation`,effect:`delete`,inputSchema:w,outputSchema:E,guide:O({summary:`Remove the user-scoped local Enhance credential.`,useWhen:`Use only when the person asks to disconnect this local agent host.`,result:`Reports whether a local credential was removed without returning its value.`,next:[`Call auth.status to confirm the local runtime is disconnected.`],exampleInput:{},exampleOutput:{loggedOut:!0}})}),k({id:`auth.status`,operation:`query`,effect:`read`,inputSchema:w,outputSchema:T,guide:O({summary:`Check whether the local Enhance MCP runtime is authenticated.`,useWhen:`Use before a workflow or after login, logout, expiry, or an authorization failure.`,result:`Returns safe identity metadata, a pending sign-in URL, a sign-in failure, or authenticated false; never a credential value.`,next:[`While waiting_for_browser, show the URL and let the person finish. After failure, report the error before retrying auth.login. Continue the workflow only when authenticated is true.`],exampleInput:{},exampleOutput:{authenticated:!1}})}),k({id:`doctor`,operation:`query`,effect:`read`,inputSchema:w,outputSchema:D,guide:O({summary:`Check MCP runtime identity, API reachability, and credential presence without changes.`,useWhen:`Use after repeated connection, authentication, or compatibility failure.`,result:`Returns bounded diagnostics without machine paths, credentials, or customer data.`,next:[`Follow the failing boundary; do not repeat a mutation while diagnostics are degraded.`],exampleInput:{},exampleOutput:{status:`ok`,runtimeVersion:`0.1.20`,api:{reachable:!0,status:200},credential:{present:!0}}})})].toSorted((e,t)=>e.id.localeCompare(t.id)),j=()=>A,M=c(i.configDirectory),N=v(i.apiUrl,M,i.configDirectory,`0.1.20-dev.sha-e63643fbee08`),P=[...e(),...j()];p(()=>u({version:`0.1.20-dev.sha-e63643fbee08`,name:i.mcpServiceName,commandName:i.commandName,invocation:N,catalog:P,exposures:[`shared`,`mcp-transport`]}),{legacy:`serve`,onerror:()=>f.stderr.write(`${i.mcpServiceName} transport failure\n`)});export{};
|