@flyle/ai-operator-mcp 0.7.0-develop.20261104124412.ga3090ef → 0.7.0-develop.20261104132049.g88cc33a

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.
Binary file
package/main.js CHANGED
@@ -75,7 +75,7 @@ Flyle AIオペレーターは、Web サイトのチャットや電話に寄せ
75
75
  - 口調や応答してはいけない話題を変えたい: common-settings → update_agent
76
76
  - 外部システムと連携したい: connectors
77
77
  - オペレーターへの引き継ぎを設定したい: operator-handoff / team-management
78
- - 応対の状況を知りたい: dashboard / improve → get_agent_conversation_summary / list_conversations`,hi={agents:[`create-agent`,`business-flow`],"agent-generation-jobs":[`create-agent`],"agent-generation-upload-urls":[`create-agent`],"agents/generation-jobs":[`create-agent`],"agents/configuration":[`business-flow`],"agents/flows":[`business-flow`],"agents/subflow-common-rules":[`business-flow`],"agents/connectors":[`connectors`],"agents/forms":[`form-options`,`business-flow`],"agents/knowledge-bases":[`knowledge`],"agents/knowledge-import-job-summary":[`knowledge`],"agents/synonym-groups":[`synonym-dictionary`],"agents/voice-dictionary-terms":[`voice-dictionary`],"agents/preview-builds":[`preview-chat`,`knowledge`],"agents/preview-chat-messages":[`preview-chat`],"agents/preview-conversations":[`preview-chat`],"agents/preview-voice-messages":[`preview-chat`,`audio-settings`],"agents/preview-form-submissions":[`preview-chat`,`form-options`],"agents/verification-cases":[`preview-chat`],"agents/verification-case-imports":[`preview-chat`],"agents/verification-images":[`preview-chat`],"agents/verification-runs":[`preview-chat`],"agents/verification-run-case-results":[`preview-chat`],"agents/verification-case-result-histories":[`preview-chat`],"agents/improvement-attempts":[`preview-chat`,`improve`],"agents/improvement-attempt-summary":[`preview-chat`,`improve`],"improvement-proposals":[`preview-chat`,`improve`],"agents/versions":[`history`],"agents/latest-publish":[`history`,`embed-publish`],"agents/publishes":[`history`,`embed-publish`],"agents/publish-readiness":[`embed-publish`,`preview-chat`],"agents/chat-designs":[`design`],"agents/chat-embeddability":[`design`],"agents/voice-settings":[`audio-settings`],"agents/voice-samples":[`audio-settings`],"agents/embed-sites":[`embed-publish`,`manage-embed-sites`,`security-model`],"agents/operator-handoff-settings":[`operator-handoff`],"team-names":[`team-management`,`operator-handoff`],"agents/conversation-summary":[`dashboard`],conversations:[`improve`,`operator`],"usage-limit":[`usage-limit`],"current-user":[`role-management`],"call-recording-settings":[`phone-channel`],"phone-numbers":[`phone-channel`],"sip-connections":[`phone-channel`],"tenant-settings":[`tenant-settings`]},gi=e=>{let[t,n]=e.split(`/`).filter(e=>e!==``&&!e.startsWith(`{`)).slice(2);return t===`agents`&&n!=null?`${t}/${n}`:t??``},_i=e=>{let t=hi[gi(e)];if(t==null)return null;let n=t.map(e=>`flygate/${e}`).join(`, `);return`操作の前に読む記事(${Y}): ${n}`},vi=e=>{let t=null,n=()=>(t??=e.loadArticles(),t),r=null,i=()=>(r??=ri(n().articles),r),a=e.withOverview?`${q} の一覧か ${J}`:J;return{knowledge:i,overviewOutcome:()=>{let{articles:e,productLabels:t}=n();return{isError:!1,payload:{guide:`${mi}\n\n# ご利用ガイドの記事一覧\n\n${ci(e,t)}`}}},searchOutcome:(e,t)=>({isError:!1,payload:{results:oi(i(),e,t)}}),readArticleOutcome:e=>{let t=ii(i(),e);return t==null?{isError:!0,payload:{error:{kind:`guide_article_not_found`,message:`記事 "${e}" はありません。${a} で記事を探し、"flygate/knowledge" の形式で指定してください。`}}}:{isError:!1,payload:{article:ni(t),title:t.title,group:t.group,url:t.url,body:si(t.body,t.url)}}}}},yi=()=>({isError:!0,payload:{error:{kind:`product_guide_required`,message:`製品の考え方を確認する前の操作は実行しません。先に ${q} を呼び、依頼に関係する記事を ${Y} で読んでから、この操作をやり直してください。`}}}),bi=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):null,xi={"tenant-root":e=>`${e}(テナント全体に対して)`,"any-resource":e=>`${e}(いずれかのエージェントで保持)`,"per-resource":e=>`${e}(対象エージェントに対して)`,"per-resource-all":e=>`${e} のすべて(対象エージェントに対して)`,"per-resource-any":e=>`${e} のいずれか(対象エージェントに対して)`},Si=e=>k(xi,e),Ci=e=>{if(!A(e))return null;let t=e.gate;if(t===`none`)return`認証のみ(ロール不要)`;let n=bi(e.action??e.actions);return n==null||typeof t!=`string`?null:Si(t)?`必要な権限: ${xi[t](n)}`:`必要な権限: ${n}`},wi={read:null,draft:`下書きへの変更です。公開版(訪問者への配信)には publish まで反映されません。`},Ti=e=>e.effect==null?null:wi[e.effect],Ei=(e,t)=>{let n=[e.summary];e.description!=null&&n.push(``,e.description),n.push(``,`HTTP: ${e.method} ${e.pathTemplate}`);let r=Ci(e.permission);r!=null&&n.push(r);let i=Ti(e);i!=null&&n.push(``,i),e.responseKind===`sse`&&n.push(``,`ストリーミング応答を終端まで収集してから返します(数分かかることがあります)。`),e.responseKind===`binary`&&n.push(``,t.binaryResponse),e.transfer?.kind===`download`&&n.push(``,t.downloadTransfer),e.transfer?.kind===`upload`&&n.push(``,t.uploadTransfer),e.wholeBodyField!=null&&n.push(``,`リクエストボディは "${e.wholeBodyField}" 引数にそのまま渡します(判別共用体)。`);for(let r of e.inlineFiles?.input??[])n.push(``,t.inlineInput(r));if((e.inlineFiles?.output.length??0)>0&&n.push(``,t.inlineOutput),e.sseOutcome!=null){let t=[...e.sseOutcome.requiredEvents,e.sseOutcome.successPointer==null?e.sseOutcome.terminalEvent:`${e.sseOutcome.terminalEvent}{${e.sseOutcome.successPointer}=${JSON.stringify(e.sseOutcome.successValue)}}`];n.push(``,`成功判定: ${t.join(` と `)} が揃ったときだけ outcome=success。欠落・異常終了・打ち切りは isError で返し、自動再送しません。`)}return e.method!==`GET`&&n.push(``,`この操作は自動再送しません。タイムアウト時は状態を再取得して確認してください。`),n.join(`
78
+ - 応対の状況を知りたい: dashboard / improve → get_agent_conversation_summary / list_conversations`,hi={agents:[`create-agent`,`business-flow`],"agent-generation-jobs":[`create-agent`],"agent-generation-upload-urls":[`create-agent`],"agents/generation-jobs":[`create-agent`],"agents/configuration":[`business-flow`],"agents/flows":[`business-flow`],"agents/subflow-common-rules":[`business-flow`],"agents/connectors":[`connectors`],"agents/forms":[`form-options`,`business-flow`],"agents/knowledge-bases":[`knowledge`],"agents/knowledge-import-job-summary":[`knowledge`],"agents/synonym-groups":[`synonym-dictionary`],"agents/voice-dictionary-terms":[`voice-dictionary`],"agents/preview-builds":[`preview-chat`,`knowledge`],"agents/preview-chat-messages":[`preview-chat`],"agents/preview-conversations":[`preview-chat`],"agents/preview-voice-messages":[`preview-chat`,`audio-settings`],"agents/preview-form-submissions":[`preview-chat`,`form-options`],"agents/verification-cases":[`preview-chat`],"agents/verification-case-imports":[`preview-chat`],"agents/verification-images":[`preview-chat`],"agents/verification-runs":[`preview-chat`],"agents/verification-run-case-results":[`preview-chat`],"agents/verification-case-result-histories":[`preview-chat`],"agents/improvement-attempts":[`preview-chat`,`improve`],"agents/improvement-attempt-summary":[`preview-chat`,`improve`],"improvement-proposals":[`preview-chat`,`improve`],"agents/versions":[`history`],"agents/latest-publish":[`history`,`embed-publish`],"agents/publishes":[`history`,`embed-publish`],"agents/publish-readiness":[`embed-publish`,`preview-chat`],"agents/chat-designs":[`design`],"agents/chat-embeddability":[`design`],"agents/voice-settings":[`audio-settings`],"agents/voice-samples":[`audio-settings`],"agents/embed-sites":[`embed-publish`,`manage-embed-sites`,`security-model`],"agents/operator-handoff-settings":[`operator-handoff`],"agents/conversation-hook-settings":[`common-settings`,`connectors`],"team-names":[`team-management`,`operator-handoff`],"agents/conversation-summary":[`dashboard`],conversations:[`improve`,`operator`],"usage-limit":[`usage-limit`],"current-user":[`role-management`],"call-recording-settings":[`phone-channel`],"phone-numbers":[`phone-channel`],"sip-connections":[`phone-channel`],"tenant-settings":[`tenant-settings`]},gi=e=>{let[t,n]=e.split(`/`).filter(e=>e!==``&&!e.startsWith(`{`)).slice(2);return t===`agents`&&n!=null?`${t}/${n}`:t??``},_i=e=>{let t=hi[gi(e)];if(t==null)return null;let n=t.map(e=>`flygate/${e}`).join(`, `);return`操作の前に読む記事(${Y}): ${n}`},vi=e=>{let t=null,n=()=>(t??=e.loadArticles(),t),r=null,i=()=>(r??=ri(n().articles),r),a=e.withOverview?`${q} の一覧か ${J}`:J;return{knowledge:i,overviewOutcome:()=>{let{articles:e,productLabels:t}=n();return{isError:!1,payload:{guide:`${mi}\n\n# ご利用ガイドの記事一覧\n\n${ci(e,t)}`}}},searchOutcome:(e,t)=>({isError:!1,payload:{results:oi(i(),e,t)}}),readArticleOutcome:e=>{let t=ii(i(),e);return t==null?{isError:!0,payload:{error:{kind:`guide_article_not_found`,message:`記事 "${e}" はありません。${a} で記事を探し、"flygate/knowledge" の形式で指定してください。`}}}:{isError:!1,payload:{article:ni(t),title:t.title,group:t.group,url:t.url,body:si(t.body,t.url)}}}}},yi=()=>({isError:!0,payload:{error:{kind:`product_guide_required`,message:`製品の考え方を確認する前の操作は実行しません。先に ${q} を呼び、依頼に関係する記事を ${Y} で読んでから、この操作をやり直してください。`}}}),bi=e=>typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`, `):null,xi={"tenant-root":e=>`${e}(テナント全体に対して)`,"any-resource":e=>`${e}(いずれかのエージェントで保持)`,"per-resource":e=>`${e}(対象エージェントに対して)`,"per-resource-all":e=>`${e} のすべて(対象エージェントに対して)`,"per-resource-any":e=>`${e} のいずれか(対象エージェントに対して)`},Si=e=>k(xi,e),Ci=e=>{if(!A(e))return null;let t=e.gate;if(t===`none`)return`認証のみ(ロール不要)`;let n=bi(e.action??e.actions);return n==null||typeof t!=`string`?null:Si(t)?`必要な権限: ${xi[t](n)}`:`必要な権限: ${n}`},wi={read:null,draft:`下書きへの変更です。公開版(訪問者への配信)には publish まで反映されません。`},Ti=e=>e.effect==null?null:wi[e.effect],Ei=(e,t)=>{let n=[e.summary];e.description!=null&&n.push(``,e.description),n.push(``,`HTTP: ${e.method} ${e.pathTemplate}`);let r=Ci(e.permission);r!=null&&n.push(r);let i=Ti(e);i!=null&&n.push(``,i),e.responseKind===`sse`&&n.push(``,`ストリーミング応答を終端まで収集してから返します(数分かかることがあります)。`),e.responseKind===`binary`&&n.push(``,t.binaryResponse),e.transfer?.kind===`download`&&n.push(``,t.downloadTransfer),e.transfer?.kind===`upload`&&n.push(``,t.uploadTransfer),e.wholeBodyField!=null&&n.push(``,`リクエストボディは "${e.wholeBodyField}" 引数にそのまま渡します(判別共用体)。`);for(let r of e.inlineFiles?.input??[])n.push(``,t.inlineInput(r));if((e.inlineFiles?.output.length??0)>0&&n.push(``,t.inlineOutput),e.sseOutcome!=null){let t=[...e.sseOutcome.requiredEvents,e.sseOutcome.successPointer==null?e.sseOutcome.terminalEvent:`${e.sseOutcome.terminalEvent}{${e.sseOutcome.successPointer}=${JSON.stringify(e.sseOutcome.successValue)}}`];n.push(``,`成功判定: ${t.join(` と `)} が揃ったときだけ outcome=success。欠落・異常終了・打ち切りは isError で返し、自動再送しません。`)}return e.method!==`GET`&&n.push(``,`この操作は自動再送しません。タイムアウト時は状態を再取得して確認してください。`),n.join(`
79
79
  `)},Di=e=>({readOnlyHint:e.method===`GET`,destructiveHint:e.method!==`GET`,idempotentHint:e.method===`GET`||e.method===`PUT`||e.method===`DELETE`,openWorldHint:!1}),Oi=new URL(`./guide-articles.json.br`,import.meta.url),ki=/* @__PURE__ */ Ne({productLabels:/* @__PURE__ */ Me(/* @__PURE__ */ I(),/* @__PURE__ */ I()),articles:/* @__PURE__ */ L(/* @__PURE__ */ De(/* @__PURE__ */ Ne({product:/* @__PURE__ */ I(),slug:/* @__PURE__ */ I(),title:/* @__PURE__ */ I(),description:/* @__PURE__ */ I(),group:/* @__PURE__ */ I(),order:/* @__PURE__ */ Ae(),body:/* @__PURE__ */ L(/* @__PURE__ */ De(/* @__PURE__ */ I()),/* @__PURE__ */ Ce(e=>e.join(`
80
80
  `))),url:/* @__PURE__ */ I()})),/* @__PURE__ */ Se())}),Ai=(e=Oi)=>{let t=/* @__PURE__ */ R(ki,$r(e,e=>new Ge(`guide articles at ${e}`)));if(!t.success)throw new Ge(`guide articles at ${e.pathname} has an unexpected shape`);return t.output},{knowledge:ji,overviewOutcome:Mi,searchOutcome:Ni,readArticleOutcome:Pi}=vi({loadArticles:()=>Ai(),withOverview:!0}),Fi=e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`),Ii=e=>Array.isArray(e),Li=(e,t)=>{if(t===``)return[{value:e,wildcardIndices:[]}];let n=t.split(`/`).slice(1).map(e=>Fi(e)),r=[{value:e,wildcardIndices:[]}];for(let e of n){let t=[];for(let{value:n,wildcardIndices:i}of r)if(e===`*`){if(Ii(n))for(let[e,r]of n.entries())t.push({value:r,wildcardIndices:[...i,e]})}else if(Ii(n)){let r=Number(e);Number.isInteger(r)&&r>=0&&r<n.length&&t.push({value:n[r],wildcardIndices:i})}else A(n)&&k(n,e)&&t.push({value:n[e],wildcardIndices:i});r=t}return r},Ri=(e,t)=>Li(e,t).map(e=>e.value),zi=e=>{if(!A(e))return{};let t={};for(let[n,r]of de(e))typeof r==`string`&&(t[n]=r);return t},Bi=e=>e.join(`/`),Vi=(e,t,n)=>{let r=t==null?[]:Li(e,t),i=r[0]?.wildcardIndices.length??0,a=new Map(r.map(e=>[Bi(e.wildcardIndices),n(e.value)]));return e=>a.get(Bi(e.slice(0,i)))},Hi=(e,t)=>{if(t==null)return[];let n=Li(e,t.urlPointer).filter(e=>typeof e.value==`string`),r=Vi(e,t.headersPointer,zi),i=Vi(e,t.namePointer,e=>typeof e==`string`?e:null);return n.map(e=>({url:e.value,kind:t.kind,headers:r(e.wildcardIndices)??{},name:i(e.wildcardIndices)??null}))},Ui=(e,t)=>{let n=``,r=0,i=e.indexOf(`{`);for(;i!==-1;){let a=e.indexOf(`}`,i+1);if(a===-1)break;n+=a===i+1?e.slice(r,a+1):e.slice(r,i)+t(e.slice(i+1,a)),r=a+1,i=e.indexOf(`{`,r)}return n+e.slice(r)},Wi=(e,t)=>{if(typeof t==`string`)return t;if(typeof t==`number`||typeof t==`boolean`)return String(t);throw new b(`argument "${e}" must be a string, number, or boolean`)},Gi=/* @__PURE__ */ new Set([`.`,`..`,`%2e`,`.%2e`,`%2e.`,`%2e%2e`]),Ki=(e,t)=>{if(t===``||Gi.has(t.toLowerCase()))throw new b(`path parameter "${e}" must not be empty, "." or ".."`);return encodeURIComponent(t)},qi=(e,t,n)=>{if(k(n,`tenantName`))throw new b(`"tenantName" is fixed by the server configuration`);let r=Ui(t.pathTemplate,t=>{if(t===`tenantName`)return encodeURIComponent(e.tenantName);let r=n[t];if(r==null)throw new b(`path parameter "${t}" is required`);return Ki(t,Wi(t,r))}),i=[];for(let e of t.queryParams){let t=n[e];if(t!=null){if(Array.isArray(t))for(let n of t)i.push([e,Wi(e,n)]);else i.push([e,Wi(e,t)])}}let a=null,o=!1;if(t.wholeBodyField!=null){if(!k(n,t.wholeBodyField))throw new b(`argument "${t.wholeBodyField}" is required`);a=n[t.wholeBodyField],o=!0}else if(t.bodyFields!=null){let e={};for(let r of t.bodyFields)k(n,r)&&(e[r]=n[r]);a=e,o=!0}return{method:t.method,path:r,query:i,hasBody:o,body:a,responseKind:t.responseKind}},Ji=async(e,t)=>{try{return await e.preflight(),{isError:!1,payload:await t()}}catch(t){let n=e.secrets(),r=JSON.parse(U(JSON.stringify(e.errorPayload(t,n)),n));return e.onFailure(t,r),{isError:!0,payload:r}}},Yi=(e,t,n)=>{let r=t.findIndex(t=>t.event===e.terminalEvent),i=r===-1?null:t[r],a=r===-1?t:t.slice(0,r),o=i==null?null:Ot(i.data),s=new Set(a.map(e=>e.event)),c=e.failureEvents.find(e=>s.has(e));if(c!=null)return{outcome:`failed`,reason:`received failure event "${c}"`,terminal:o};if(i==null)return n.truncated?{outcome:`unknown`,reason:`the stream was cut off by the client limit (${n.reason??`unknown`})`,terminal:o}:{outcome:`unknown`,reason:`the stream ended without the terminal event "${e.terminalEvent}"`,terminal:o};let l=e.successPointer==null?null:Ri(o,e.successPointer)[0];if(e.successPointer!=null&&l!==e.successValue)return{outcome:`failed`,reason:`"${e.terminalEvent}" ended with ${e.successPointer}=${JSON.stringify(l)} (expected ${JSON.stringify(e.successValue)})`,terminal:o};let u=e.requiredEvents.filter(e=>!s.has(e));return u.length>0?{outcome:`failed`,reason:`required event(s) missing before "${e.terminalEvent}": ${u.join(`, `)}`,terminal:o}:{outcome:`success`,reason:null,terminal:o}},Xi=e=>({event:e.event,data:Ot(e.data),...e.id==null?{}:{id:e.id}}),Zi=(e,t)=>{if(e instanceof S)return{isError:!0,payload:{error:{kind:`api`,...e.info}}};if(e instanceof C)return{isError:!0,payload:{error:{kind:`transport`,failure:e.kind,status:e.status,message:e.message}}};if(e instanceof w)return{isError:!0,payload:{error:{kind:`transfer`,failure:e.kind,status:e.status,message:e.message}}};if(e instanceof b)return{isError:!0,payload:{error:{kind:`invalid_arguments`,message:e.message}}};if(e instanceof T)return{isError:!0,payload:{error:{kind:`local_file`,failure:e.kind,message:e.message}}};if(e instanceof E)return{isError:!0,payload:{error:{kind:`inline_file`,failure:e.kind,message:e.message}}};if(e instanceof D)return{isError:!0,payload:{error:{kind:`workspace`,failure:e.kind,message:e.message}}};if(e instanceof x)return{isError:!0,payload:{error:{kind:`auth`,failure:e.kind,message:e.message}}};if(e instanceof se)return{isError:!0,payload:e.payload};if(e instanceof Error)return{isError:!0,payload:{error:{kind:`unexpected`,message:U(e.message,t)}}};throw e},Qi=e=>e instanceof S?e.info.status:e instanceof C?e.status:null,$i=e=>e instanceof S?e.info.code:e instanceof Error?e.name:`unknown`,ea=(e,t,n)=>Ji({preflight:e.preflight,secrets:()=>e.auth.secrets(),errorPayload:(e,t)=>Zi(e,t).payload,onFailure:n=>{e.logger.warn(`tool call failed`,{operationId:t,status:Qi(n),code:$i(n)})}},n),ta=async(e,t,n,{hooks:r,signal:i,canSend:a})=>{let o={attempts:0,requestBytes:0,responseBytes:0},s=async()=>{H(i??void 0);let s=await r.prepareArguments(t,n);H(i??void 0);let c=qi(e.config,t,s),l=await e.client.request(c,i??void 0,a??void 0,o);switch(l.kind){case`json`:{let e=await r.processJson(t,l.body);return{status:l.status,requestId:l.requestId,body:e.body,...e.extra}}case`empty`:return{status:l.status,requestId:l.requestId};case`sse`:{let e=await r.processSse(t,l.events),n={status:l.status,requestId:l.requestId,events:e.events.map(e=>Xi(e)),truncated:l.truncated,stopReason:l.reason,discardedIncomplete:l.discardedIncomplete,...e.extra};if(t.sseOutcome==null)return n;let i=Yi(t.sseOutcome,l.events,{truncated:l.truncated,reason:l.reason}),a={...n,outcome:i.outcome,outcomeReason:i.reason,terminal:i.terminal};if(i.outcome!==`success`)throw new se(i.reason??`operation failed`,{...a,retryHint:`Not retried automatically. Check the affected resource or execution history before running this operation again.`});return a}case`binary`:return{status:l.status,requestId:l.requestId,...await r.processBinary(t,l)};default:throw Error(`unknown response kind`)}};return{...await ea(e,t.operationId,()=>s().catch(e=>{throw H(i??void 0),e})),metrics:o}},na=/^[A-Za-z0-9+/]*={0,2}$/,ra=e=>typeof e==`string`&&e.length%4==0&&na.test(e),ia=(e,t)=>{if(!ra(e))throw new E(`invalid_base64`,`"${t}" is not valid base64`);return e},aa=/* @__PURE__ */ new Map([[`audio/mpeg`,`.mp3`],[`audio/mp4`,`.m4a`],[`audio/ogg`,`.ogg`],[`audio/wav`,`.wav`],[`audio/webm`,`.webm`],[`image/png`,`.png`],[`image/jpeg`,`.jpg`],[`image/webp`,`.webp`],[`application/pdf`,`.pdf`]]),oa=e=>e.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`),sa=async(e,t,n)=>{let r=async(e,t,i)=>{let[a,...o]=t;if(a==null)return n(e,i);if(a===`*`){if(!Array.isArray(e))return e;let t=[];for(let[n,a]of e.entries())t.push(await r(a,o,`${i}/${String(n)}`));return t}if(Array.isArray(e)){let t=Number(a);if(!Number.isInteger(t)||t<0||t>=e.length)return e;let n=[...e];return n[t]=await r(e[t],o,`${i}/${a}`),n}return A(e)&&k(e,a)?{...e,[a]:await r(e[a],o,`${i}/${a}`)}:e};return r(e,t.split(`/`).slice(1).map(e=>oa(e)),``)},ca=(e,t)=>{let n=/* @__PURE__ */ new Set,r=[];for(let i of e.output){if(i.event==null)continue;n.add(i.event);let e=t.filter(e=>e.event===i.event).flatMap(e=>Ri(Ot(e.data),i.pointer));e.length>0&&r.push({output:i,chunks:e})}return{events:t.filter(e=>e.event==null||!n.has(e.event)),outputs:r}},la=(e,t)=>e.output.flatMap(e=>{if(e.event!=null)return[];let n=Ri(t,e.pointer);return n.length===0?[]:[{output:e,chunks:n}]}),ua=(e,t,n)=>String.fromCodePoint(...e.subarray(t,n)),da=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),fa=e=>{if(e.length<12||ua(e,0,4)!==`RIFF`||ua(e,8,12)!==`WAVE`)throw new E(`not_wav`,`the file is not a RIFF/WAVE file`);let t=da(e),n=null,r=null,i=12;for(;i+8<=e.length;){let a=ua(e,i,i+4),o=t.getUint32(i+4,!0),s=i+8,c=s+o;if(c>e.length)throw new E(`not_wav`,`the "${a}" chunk claims more bytes than the file holds`);if(a===`fmt `){if(o<16)throw new E(`not_wav`,`the fmt chunk is truncated`);let e=t.getUint16(s,!0);if((e===65534&&o>=26?t.getUint16(s+24,!0):e)!==1)throw new E(`unsupported_format`,`unsupported WAV format code ${String(e)} (only PCM is accepted)`);n={channels:t.getUint16(s+2,!0),sampleRateHz:t.getUint32(s+4,!0),bitsPerSample:t.getUint16(s+14,!0)}}else a===`data`&&(r=e.subarray(s,c));i=c+o%2}if(n==null||r==null)throw new E(`not_wav`,`the WAV file lacks a fmt or data chunk`);if(n.channels===0||n.sampleRateHz===0)throw new E(`not_wav`,`the WAV file declares no channels or sample rate`);if(n.bitsPerSample!==16)throw new E(`unsupported_format`,`unsupported bit depth ${String(n.bitsPerSample)} (only 16-bit PCM is accepted)`);if(r.length===0)throw new E(`empty`,`the WAV file has no audio samples`);if(r.length%(2*n.channels)!=0)throw new E(`not_wav`,`the data chunk is not aligned to whole samples`);return{sampleRateHz:n.sampleRateHz,channels:n.channels,pcm:r}},pa=(e,t,n)=>{for(let r=0;r<n.length;r+=1)e[t+r]=n.codePointAt(r)??0},ma=(e,t)=>{let n=new Uint8Array(44+e.length),r=da(n),i=2*t.channels;return pa(n,0,`RIFF`),r.setUint32(4,36+e.length,!0),pa(n,8,`WAVE`),pa(n,12,`fmt `),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,t.channels,!0),r.setUint32(24,t.sampleRateHz,!0),r.setUint32(28,t.sampleRateHz*i,!0),r.setUint16(32,i,!0),r.setUint16(34,16,!0),pa(n,36,`data`),r.setUint32(40,e.length,!0),n.set(e,44),n},ha=(e,t)=>Math.round(e/(2*t.channels*t.sampleRateHz)*1e3),ga=e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength),_a=e=>{let t=fa(e);return{sampleRateHz:t.sampleRateHz,channels:t.channels,pcm:ga(t.pcm)}},va=(e,t)=>ga(ma(e,t)),ya=async(e,t,n,r)=>{let i=await fr(e,r.fileRoots,r.cwd,r.workspace);try{return await ur(i,t)}catch(e){throw e instanceof T&&e.kind===`too_large`?new E(`too_large`,`"${n}" exceeds ${String(t)} bytes`):e}},ba=async(e,t,n,r)=>{if(typeof t!=`string`||t===``)throw new E(`not_a_path`,`"${n}" must be a local file path`);let i=await ya(t,e.format===`wav-pcm16`?e.maxBytes+44:e.maxBytes,n,r);if(e.format===`base64`){if(i.length===0)throw new E(`empty`,`"${n}" points at an empty file`);return i.toString(`base64`)}let a=_a(i),o=e.pcm;if(o!=null&&(a.sampleRateHz!==o.sampleRateHz||a.channels!==o.channels))throw new E(`unsupported_format`,`"${n}" must be ${String(o.sampleRateHz)} Hz / ${String(o.channels)} channel PCM 16-bit WAV (got ${String(a.sampleRateHz)} Hz / ${String(a.channels)} channel)`);if(a.pcm.length>e.maxBytes)throw new E(`too_large`,`"${n}" holds ${String(a.pcm.length)} bytes of audio; at most ${String(e.maxBytes)} are accepted`);return{encoding:`pcm16le`,sampleRateHz:a.sampleRateHz,channels:a.channels,data:a.pcm.toString(`base64`)}},xa=async(e,t,n)=>{let r=t;for(let t of e.input)r=await sa(r,t.pointer,(e,r)=>ba(t,e,r,n));return A(r)?r:t},Sa=(e,t)=>Buffer.from(ia(e,t),`base64`),Ca=async(e,t,n)=>{let r=[],i=0;for(let[a,o]of t.entries()){let t=Sa(o,`${e.event??`body`}${e.pointer}[${String(a)}]`);if(e.format===`pcm16le`&&t.length%2!=0)throw new E(`unsupported_format`,`${e.event??`body`}${e.pointer} chunk ${String(a)} is not whole PCM 16-bit samples`);if(i+=t.length,i>n.maxBytes)throw new E(`too_large`,`inline output exceeds ${String(n.maxBytes)} bytes`);r.push(t)}let a=Buffer.concat(r),o=e.pcm,s=e.format===`pcm16le`&&o!=null,c=s?va(a,o):a,l=s?`audio/wav`:e.mediaType??`application/octet-stream`,u=s?`.wav`:aa.get(l)??`.bin`;return{...await Dr(new Blob([new Uint8Array(c)]).stream(),{outputDir:n.outputDir,fileName:wr(`${n.fileName}${u}`,`inline${u}`),maxBytes:n.maxBytes+44,timeoutMs:n.timeoutMs}),event:e.event,pointer:e.pointer,mediaType:l,chunks:t.length,durationMs:s?ha(a.length,o):null}},wa=async(e,t,n)=>{let r=ca(e,t),i=[];for(let{output:e,chunks:t}of r.outputs)i.push(await Ca(e,t,n));return{events:r.events,files:i}},Ta=async(e,t,n)=>{let r=t,i=[];for(let{output:a,chunks:o}of la(e,t)){let e=await Ca(a,o,n);i.push(e),r=await sa(r,a.pointer,()=>Promise.resolve(`[saved to ${e.path}]`))}return{body:r,files:i}},Ea={transferTimeoutMs:Ue,maxDownloadBytes:We,maxAutoDownloadsPerCall:20,maxInlineOutputBytes:33554432},Da=e=>({config:e.config,auth:e.auth,client:e.client,logger:e.logger,preflight:async()=>{await En(e.workspace,new Date(e.now())),await e.auth.assertLoggedIn()}}),Oa=async(e,t,n)=>ea(Da(e),t,n),ka=async(e,t,n,r)=>{let i=Hi(n,t.transfer);if(i.length===0)return{};let a=[],o=[],s=[],c=[];for(let n of i){let i;try{i=vr(n.url,e.config)}catch(e){c.push({url:n.url,reason:e instanceof Error?e.message:`rejected`});continue}if(n.kind===`upload`){e.registry.register(n.url,`upload`,n.headers),a.push(n.url);continue}if(o.length>=r.maxAutoDownloadsPerCall){e.registry.register(n.url,`download`,{});continue}let l=wr(n.name??i.pathname.split(`/`).at(-1)??null,`${t.operationId}.bin`),u;try{u=await Or({url:i,outputDir:e.config.outputDir,fileName:l,fetch:e.fetch,maxBytes:r.maxDownloadBytes,timeoutMs:r.transferTimeoutMs})}catch(r){if(!(r instanceof w))throw r;e.logger.warn(`automatic download failed`,{operationId:t.operationId,host:i.hostname,failure:r.kind}),e.registry.register(n.url,`download`,{}),s.push({url:n.url,failure:r.kind});continue}o.push({url:n.url,path:u.path,bytes:u.bytes,sha256Hex:u.sha256Hex,contentType:u.contentType})}return{...a.length===0?{}:{uploadUrls:a,uploadHint:`Call upload_file with one of these URLs and a local file path.`},...o.length===0?{}:{downloads:o},...s.length===0?{}:{failedDownloads:s,downloadHint:`The API response above is complete; only the automatic download failed. Retry it with download_file and the same URL.`},...c.length===0?{}:{rejectedTransferUrls:c}}},Aa=(e,t,n)=>({outputDir:e.config.outputDir,fileName:t.operationId,maxBytes:n.maxInlineOutputBytes,timeoutMs:n.transferTimeoutMs}),ja=e=>e.length===0?{}:{files:e},Ma=(e,t)=>({prepareArguments:async(t,n)=>t.inlineFiles==null?n:await xa(t.inlineFiles,n,{fileRoots:e.config.fileRoots,cwd:e.cwd,workspace:e.workspace}),processJson:async(n,r)=>{let i=await ka(e,n,r,t),a=n.inlineFiles==null?{body:r,files:[]}:await Ta(n.inlineFiles,r,Aa(e,n,t));return{body:a.body,extra:{...i,...ja(a.files)}}},processSse:async(n,r)=>{let i=n.inlineFiles==null?{events:r,files:[]}:await wa(n.inlineFiles,r,Aa(e,n,t));return{events:i.events,extra:ja(i.files)}},processBinary:async(n,r)=>({file:{...await Dr(r.body,{outputDir:e.config.outputDir,fileName:wr(r.fileName,`${n.operationId}.bin`),maxBytes:t.maxDownloadBytes,timeoutMs:t.transferTimeoutMs}),contentType:r.contentType,fileName:r.fileName}})}),Na=async(e,t,n,r=Ea)=>{let{isError:i,payload:a}=await ta(Da(e),t,n,{hooks:Ma(e,r),signal:null,canSend:null});return{isError:i,payload:a}},Pa=(e,t)=>`Flyle AIオペレーターの公開 API を呼ぶツール群です。
81
81
  - 作業を始める前に必ず ${q} で製品の考え方とご利用ガイドの記事一覧を確認し、依頼に関係する記事を ${Y} で読んでください。公開 API の操作は ${q} を呼ぶまで実行されません。ツールに無い操作は代わりの手順を組み立てず、該当する記事を示して管理画面での操作を案内してください。
package/manifest.json.br CHANGED
Binary file
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@flyle/ai-operator-mcp","version":"0.7.0-develop.20261104124412.ga3090ef","description":"MCP server for the Flyle AI Operator public API","keywords":["flyle","mcp","modelcontextprotocol"],"license":"SEE LICENSE IN LICENSE","author":"Flyle.inc","repository":{"type":"git","url":"git+https://github.com/flyle-io/flyle-nexus.git","directory":"apps/flygate/mcp"},"type":"module","engines":{"node":">=22.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"bin":{"flyle-ai-operator-mcp":"./main.js"},"dependencies":{"@modelcontextprotocol/server":"2.3.1"}}
1
+ {"name":"@flyle/ai-operator-mcp","version":"0.7.0-develop.20261104132049.g88cc33a","description":"MCP server for the Flyle AI Operator public API","keywords":["flyle","mcp","modelcontextprotocol"],"license":"SEE LICENSE IN LICENSE","author":"Flyle.inc","repository":{"type":"git","url":"git+https://github.com/flyle-io/flyle-nexus.git","directory":"apps/flygate/mcp"},"type":"module","engines":{"node":">=22.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"bin":{"flyle-ai-operator-mcp":"./main.js"},"dependencies":{"@modelcontextprotocol/server":"2.3.1"}}