@coze/cli 0.2.0-alpha.9f6611 → 0.2.0-alpha.af0037

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.
@@ -1 +1 @@
1
- "use strict";const e=require("process"),r=require("undici"),t=require("./fetch-client-DC0c3ox3.js"),i=require("./index-CkTEdvpA.js");require("form-data"),require("crypto"),require("url"),require("http"),require("https"),require("http2"),require("util"),require("stream"),require("assert"),require("tty"),require("zlib"),require("events"),require("lodash"),require("mitt"),require("path"),require("fs"),require("fs/promises"),async function(){try{const s=e.argv[2];if(!s)throw new Error("No payload provided");const o=t.safeJsonParse(s,void 0);if(!o)throw new Error("Invalid payload");const u=new r.EnvHttpProxyAgent;t.customFetch.setDispatcher(u),t.customFetch.setHeaders({Authorization:`Bearer ${o.accessToken}`}),o.xTTEnv&&t.customFetch.setHeaders({"x-use-ppe":"1","x-tt-env":o.xTTEnv||""}),await i.sendProjectChatMessage(o),e.exit(0)}catch(r){console.error("❌ Worker error:",r),e.exit(1)}}();
1
+ "use strict";const e=require("process"),r=require("undici"),t=require("./fetch-client-DC0c3ox3.js"),i=require("./index-DNmOe3vH.js");require("form-data"),require("crypto"),require("url"),require("http"),require("https"),require("http2"),require("util"),require("stream"),require("assert"),require("tty"),require("zlib"),require("events"),require("lodash"),require("mitt"),require("path"),require("fs"),require("fs/promises"),async function(){try{const s=e.argv[2];if(!s)throw new Error("No payload provided");const o=t.safeJsonParse(s,void 0);if(!o)throw new Error("Invalid payload");const u=new r.EnvHttpProxyAgent;t.customFetch.setDispatcher(u),t.customFetch.setHeaders({Authorization:`Bearer ${o.accessToken}`}),o.xTTEnv&&t.customFetch.setHeaders({"x-use-ppe":"1","x-tt-env":o.xTTEnv||""}),await i.sendProjectChatMessage(o),e.exit(0)}catch(r){console.error("❌ Worker error:",r),e.exit(1)}}();
@@ -1 +1 @@
1
- "use strict";const e=require("process"),r=require("./task-worker-C2ZfSQY6.js");require("path"),require("child_process"),require("undici"),require("./fetch-client-DC0c3ox3.js"),require("form-data"),require("crypto"),require("url"),require("http"),require("https"),require("http2"),require("util"),require("stream"),require("assert"),require("tty"),require("zlib"),require("events"),require("lodash"),require("node:path"),require("node:os"),require("node:fs/promises"),require("node:fs"),async function(){try{await r.runSessionTaskRefreshWorkerCli(),e.exit(0)}catch(r){console.error("❌ Session task refresh worker error:",r),e.exit(1)}}();
1
+ "use strict";const e=require("process"),r=require("./task-worker-C08RI2za.js");require("path"),require("child_process"),require("undici"),require("./fetch-client-DC0c3ox3.js"),require("form-data"),require("crypto"),require("url"),require("http"),require("https"),require("http2"),require("util"),require("stream"),require("assert"),require("tty"),require("zlib"),require("events"),require("lodash"),require("node:path"),require("node:fs/promises"),require("node:os"),require("node:fs"),async function(){try{await r.runSessionTaskRefreshWorkerCli(),e.exit(0)}catch(r){console.error("❌ Session task refresh worker error:",r),e.exit(1)}}();
@@ -0,0 +1 @@
1
+ "use strict";const e=require("process"),t=require("path"),s=require("child_process"),i=require("undici"),a=require("./fetch-client-DC0c3ox3.js"),r=require("node:path"),n=require("node:fs/promises"),o=require("node:os");function c(e){const t=Object.create(null);if(e)for(const s in e)if("default"!==s){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}return t.default=e,Object.freeze(t)}require("node:fs");const l=c(r),d=c(n),_=c(o),u=()=>l.join(_.homedir(),".coze"),p=()=>l.join(u(),"cli"),h=()=>u();const m=l.join(p(),"config.json"),g=l.join(h(),"config.json"),E=l.join(process.cwd(),".cozerc.json"),w={apiBaseUrl:"https://code.coze.cn/",sessionApiBaseUrl:"https://www.coze.cn/",openApiBaseUrl:"https://api.coze.cn",integrationApiBaseUrl:"https://integration.coze.cn",clientId:"95438868623436343239609434490626.app.coze",defaultOutputFormat:"json"};async function T(e){try{const t=await d.readFile(e,"utf8");return JSON.parse(t)}catch(e){return}}async function f(){return await async function(e,t){return null!=e?e:await t()}(await T(m),(async()=>await T(g)))}function S(){const e={};return process.env.COZE_API_TOKEN&&(e.accessToken=process.env.COZE_API_TOKEN),process.env.COZE_ORG_ID&&(e.organizationId=process.env.COZE_ORG_ID),process.env.COZE_ENTERPRISE_ID&&(e.enterpriseId=process.env.COZE_ENTERPRISE_ID),process.env.COZE_SPACE_ID&&(e.spaceId=process.env.COZE_SPACE_ID),process.env.COZE_SESSION_SPACE_WEB_ID&&(e.sessionSpaceWebId=process.env.COZE_SESSION_SPACE_WEB_ID),"global"!==process.env.COZE_CONFIG_SCOPE&&"local"!==process.env.COZE_CONFIG_SCOPE||(e.configScope=process.env.COZE_CONFIG_SCOPE),process.env.COZE_AUTO_CHECK_UPDATE&&(e.autoCheckUpdate="true"===process.env.COZE_AUTO_CHECK_UPDATE),process.env.COZE_DISABLE_TELEMETRY&&(e.disableTelemetry="true"===process.env.COZE_DISABLE_TELEMETRY),e}async function R(e){const t=process.env.COZE_CONFIG_FILE,[s,i,a,r]=await Promise.all([f(),T(E),t?T(t):void 0,e?T(e):void 0]),n=S();return{...w,...s,...i,...a,...r,...n}}async function P(e,t=function(e,t){return null!=e?e:t()}(S().configScope,(()=>"global"))){const s=process.env.COZE_CONFIG_FILE,i=s||("global"===t?m:E),a=l.dirname(i);try{await d.mkdir(a,{recursive:!0});const t={...await T(i)||{},...e};await d.writeFile(i,JSON.stringify(t,null,2),"utf8")}catch(e){throw new Error(`Failed to save config to ${i}: ${e}`)}}function A(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const I=e=>e.endsWith("/")?e:`${e}/`,U=(e,t)=>{t&&Object.entries(t).forEach((([t,s])=>{null!=s&&e.searchParams.set(t,String(s))}))},C=async(e,t)=>{const s=await e.text();return s?a.safeJsonParse(s,t):t},L=(e,t,s={})=>{if(e.ok)return;const i=s.serviceName||"Service";throw new Error(A([t,"optionalAccess",e=>e.msg])||`${i} API request failed: ${e.status} ${e.statusText}`)},O=e=>e.headers.get("x-tt-logid")||void 0,v=e=>e?{"x-use-ppe":"1","x-tt-env":e}:{},y=e=>{const t=A([e,"optionalAccess",e=>e.trim,"call",e=>e()]);return t?{"x-coze-account":t}:{}},B=e=>{try{return"www.coze.cn"===new URL(e).hostname}catch(e){return!1}},b="coze-account",z=({getOrganizationId:e,organizationId:t})=>{if(!e&&!A([t,"optionalAccess",e=>e.trim,"call",e=>e()]))return void a.customFetch.removeScopedHeadersProvider(b);const s=e||(()=>t);a.customFetch.setScopedHeadersProvider(b,((e,t)=>{const i=(e=>"string"==typeof e?e:e instanceof URL?e.toString():"object"==typeof e&&e&&"url"in e?String(e.url):void 0)(e);return i&&B(i)?y(s()):{}}))};const D=async({url:e,api:t})=>{if(!e||!t.getWebUrl)return e;try{return function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([await t.getWebUrl({original_url:e,exchange_for_short_url:!0}),"access",e=>e.data,"optionalAccess",e=>e.short_url])||e}catch(t){return e}},N=({api:e})=>async({url:t})=>await D({url:t,api:e})||t;const q=({accountId:e,authConfigured:t})=>({authConfigured:t,authValid:!1,clawId:void 0,accountId:e,updatedAt:void 0});function k(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const F=({api:e,resolveClawId:t})=>async(s={})=>{const i=s.clawId||await t();return(k([await e.listProcess({claw_id:i,size:s.size||100}),"access",e=>e.data,"optionalAccess",e=>e.processes])||[]).map((e=>(e=>{const t=String(e.id||"");if(!t)return null;const s=e;return{progressId:t,name:"string"==typeof e.name?e.name:void 0,type:"string"==typeof s.type?s.type:void 0,progressStatus:"running",raw:e}})(e))).filter((e=>null!==e))},G=e=>async({progressId:t,clawId:s})=>(await e({clawId:s})).find((e=>e.progressId===t))||null,j=({listProgresses:e,runtimeStatusStore:t})=>async({sessionId:s,clawId:i})=>{const a=await e({clawId:i}),r=t.getLive(s),n=k([r,"optionalAccess",e=>e.status])||"idle",o=a.length;return{sessionId:s,displayStatus:"working"===n?"working":"idle",clawBusy:o>0,clawProgressCount:o,runtimeStatus:n,updatedAt:k([r,"optionalAccess",e=>e.updatedAt])}};class x extends Error{constructor(e,t){super(e),this.code=t,this.name="SessionServiceError"}}const M=()=>new x("Session token is missing or invalid","SESSION_AUTH_INVALID");function H(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const W=({api:e,resolveClawId:t})=>async()=>{const s=await t(),i=await e.createSession({claw_id:s}),a=H([i,"access",e=>e.data,"optionalAccess",e=>e.session,"optionalAccess",e=>e.id]);if(!a)throw new x(i.msg||"Failed to create session","SESSION_CREATE_FAILED");return{clawId:s,sessionId:String(a)}},V=({api:e,resolveClawId:t})=>async(s={})=>{const i=await t(),a=await e.listSession({claw_id:i,offset:s.offset,limit:s.limit});if(0!==a.code&&void 0!==a.code)throw new x(a.msg||"Failed to list sessions","SESSION_LIST_FAILED");const r=H([a,"access",e=>e.data,"optionalAccess",e=>e.session_list])||[],n=H([a,"access",e=>e.data,"optionalAccess",e=>e.next_offset]);return{items:r,nextOffset:n,hasMore:Boolean(n)}},Y=({api:e,updateSessionRuntimeStatus:t})=>async({sessionId:s,content:i,files:a})=>{const r=await e.chat({session_id:s,content:i,files:a}),n=H([r,"access",e=>e.data,"optionalAccess",e=>e.message_id]);if(!n)throw new x(r.msg||"Failed to send session message","SESSION_MESSAGE_FAILED");return await t({sessionId:s,status:"working"}),{sessionId:s,messageId:n,status:"accepted"}};var $,Z,K,J,X,Q,ee,te,se,ie,ae,re,ne,oe,ce,le,de,_e,ue,pe,he,me,ge,Ee,we,Te,fe,Se,Re,Pe,Ae,Ie,Ue,Ce,Le,Oe,ve,ye,Be,be,ze,De,Ne,qe,ke,Fe,Ge,je,xe,Me,He,We,Ve,Ye,$e,Ze,Ke;function Je(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}!function(e){e[e.Free=0]="Free";e[e.PremiumLite=10]="PremiumLite";e[e.Premium=15]="Premium";e[e.PremiumPlus=20]="PremiumPlus";e[e.V1ProInstance=100]="V1ProInstance";e[e.ProPersonal=110]="ProPersonal";e[e.CozePersonalPlus=112]="CozePersonalPlus";e[e.CozePersonalAdvanced=114]="CozePersonalAdvanced";e[e.CozePersonalPro=116]="CozePersonalPro";e[e.CozePersonalUltra=118]="CozePersonalUltra";e[e.Team=120]="Team";e[e.EnterpriseBasic=125]="EnterpriseBasic";e[e.Enterprise=130]="Enterprise";e[e.EnterprisePro=135]="EnterprisePro"}($||($={})),function(e){e[e.Resume=1]="Resume";e[e.Terminate=2]="Terminate"}(Z||(Z={})),function(e){e[e.CAL_TYPE_UNSPECIFIED=0]="CAL_TYPE_UNSPECIFIED";e[e.CAL_TYPE_CRON=1]="CAL_TYPE_CRON";e[e.CAL_TYPE_HEARTBEAT=2]="CAL_TYPE_HEARTBEAT";e[e.CAL_TYPE_ONCE=3]="CAL_TYPE_ONCE";e[e.CAL_TYPE_DEFAULT=4]="CAL_TYPE_DEFAULT"}(K||(K={})),function(e){e[e.EVENT_STATUS_UNSPECIFIED=0]="EVENT_STATUS_UNSPECIFIED";e[e.EVENT_STATUS_PENDING=1]="EVENT_STATUS_PENDING";e[e.EVENT_STATUS_RUNNING=2]="EVENT_STATUS_RUNNING";e[e.EVENT_STATUS_COMPLETED=3]="EVENT_STATUS_COMPLETED";e[e.EVENT_STATUS_PAUSED=4]="EVENT_STATUS_PAUSED";e[e.EVENT_STATUS_FAILED=5]="EVENT_STATUS_FAILED"}(J||(J={})),function(e){e[e.UnknownTask=0]="UnknownTask";e[e.SubagentTask=1]="SubagentTask";e[e.CronTask=2]="CronTask";e[e.MobileUseTask=3]="MobileUseTask";e[e.BrowserUseTask=4]="BrowserUseTask";e[e.ComputerUseTask=5]="ComputerUseTask"}(X||(X={})),function(e){e[e.Owner=1]="Owner";e[e.Member=10]="Member"}(Q||(Q={})),function(e){e[e.User=1]="User";e[e.Agent=2]="Agent"}(ee||(ee={})),function(e){e[e.Unread=1]="Unread";e[e.Read=2]="Read";e[e.Overdue=3]="Overdue"}(te||(te={})),function(e){e[e.Chat=1]="Chat"}(se||(se={})),function(e){e[e.All=0]="All";e[e.Private=1]="Private";e[e.NormalProject=2]="NormalProject";e[e.VideoProject=3]="VideoProject"}(ie||(ie={})),function(e){e[e.Common=1]="Common";e[e.Video=2]="Video"}(ae||(ae={})),function(e){e[e.History=0]="History";e[e.Private=1]="Private";e[e.Project=2]="Project"}(re||(re={})),function(e){e[e.Asset=1]="Asset";e[e.Material=2]="Material"}(ne||(ne={})),function(e){e[e.Running=1]="Running";e[e.Waiting=2]="Waiting";e[e.Terminated=3]="Terminated";e[e.Finish=4]="Finish"}(oe||(oe={})),function(e){e[e.PENDING=0]="PENDING";e[e.RUNNING=1]="RUNNING";e[e.COMPLETED=2]="COMPLETED";e[e.FAILED=3]="FAILED";e[e.INTERRUPTED=4]="INTERRUPTED";e[e.CANCELLED=5]="CANCELLED";e[e.TIMEOUT=6]="TIMEOUT";e[e.RESUMED=7]="RESUMED"}(ce||(ce={})),function(e){e[e.PENDING=0]="PENDING";e[e.RUNNING=1]="RUNNING";e[e.COMPLETED=2]="COMPLETED";e[e.FAILED=3]="FAILED";e[e.INTERRUPTED=4]="INTERRUPTED";e[e.RESUMED=5]="RESUMED";e[e.CANCELLED=6]="CANCELLED"}(le||(le={})),function(e){e[e.Managed=1]="Managed";e[e.Cloud=2]="Cloud";e[e.Local=3]="Local"}(de||(de={})),function(e){e[e.AgentFrameworkCozeClaw=0]="AgentFrameworkCozeClaw";e[e.AgentFrameworkClaudeCode=1]="AgentFrameworkClaudeCode";e[e.AgentFrameworkCodex=2]="AgentFrameworkCodex";e[e.AgentFrameworkOpenClaw=3]="AgentFrameworkOpenClaw"}(_e||(_e={})),function(e){e[e.Offline=0]="Offline";e[e.Online=1]="Online";e[e.Busy=2]="Busy";e[e.Starting=3]="Starting";e[e.Error=4]="Error"}(ue||(ue={})),function(e){e[e.CreateModeTemplate=1]="CreateModeTemplate";e[e.CreateModeCloudThirdParty=2]="CreateModeCloudThirdParty";e[e.CreateModeLocalThirdParty=3]="CreateModeLocalThirdParty"}(pe||(pe={})),function(e){e[e.ACCOUNT_QUOTA_ZERO=1]="ACCOUNT_QUOTA_ZERO";e[e.MOBILE_LIMIT_EXCEEDED=2]="MOBILE_LIMIT_EXCEEDED"}(he||(he={})),function(e){e[e.Terminate=1]="Terminate"}(me||(me={})),function(e){e[e.CANCEL=1]="CANCEL"}(ge||(ge={})),function(e){e[e.Success=1]="Success";e[e.Failed=2]="Failed";e[e.Timeout=3]="Timeout"}(Ee||(Ee={})),function(e){e[e.Init=1]="Init";e[e.Online=2]="Online";e[e.Busy=3]="Busy";e[e.Offline=4]="Offline";e[e.Error=5]="Error"}(we||(we={})),function(e){e[e.Unset=0]="Unset";e[e.Disabled=1]="Disabled";e[e.Enabled=2]="Enabled"}(Te||(Te={})),function(e){e[e.PENDING=0]="PENDING";e[e.APPROVED=1]="APPROVED";e[e.REJECTED=2]="REJECTED"}(fe||(fe={})),function(e){e[e.IDLE=1]="IDLE";e[e.INTERRUPTED=2]="INTERRUPTED";e[e.REBOOTING=3]="REBOOTING";e[e.INITIALIZING=4]="INITIALIZING";e[e.ARREARS=5]="ARREARS";e[e.RUNNING=6]="RUNNING";e[e.RESERVED=7]="RESERVED";e[e.SCALING=8]="SCALING";e[e.ASSIGN_FAILED=9]="ASSIGN_FAILED";e[e.BUSY=10]="BUSY"}(Se||(Se={})),function(e){e[e.PHONE_8C24G=1]="PHONE_8C24G";e[e.PHONE_4C12G=2]="PHONE_4C12G";e[e.PHONE_2C6G=3]="PHONE_2C6G";e[e.PC_2C4G=101]="PC_2C4G";e[e.PC_4C8G=102]="PC_4C8G";e[e.PC_8C16G=103]="PC_8C16G";e[e.PC_16C32G=104]="PC_16C32G";e[e.PC_32C64G=105]="PC_32C64G"}(Re||(Re={})),function(e){e[e.MOBILE=1]="MOBILE";e[e.COMPUTER=2]="COMPUTER"}(Pe||(Pe={})),function(e){e[e.SUBSCRIBING=0]="SUBSCRIBING";e[e.BOOTING=1]="BOOTING";e[e.REBOOTING=2]="REBOOTING";e[e.IDLE=3]="IDLE";e[e.BUSY=4]="BUSY";e[e.INTERRUPTED=5]="INTERRUPTED";e[e.RELEASING=6]="RELEASING";e[e.RELEASED=7]="RELEASED";e[e.OFFLINE=8]="OFFLINE";e[e.ARREARS=9]="ARREARS";e[e.RESERVED=10]="RESERVED";e[e.SCALING=11]="SCALING";e[e.ASSIGN_FAILED=12]="ASSIGN_FAILED"}(Ae||(Ae={})),function(e){e[e.HEALTHY=1]="HEALTHY";e[e.WARNING=2]="WARNING";e[e.CRITICAL=3]="CRITICAL"}(Ie||(Ie={})),function(e){e[e.AVAILABLE=1]="AVAILABLE";e[e.NEED_UPGRADE_PLAN=2]="NEED_UPGRADE_PLAN";e[e.NOT_ALLOWED_DOWNGRADE=3]="NOT_ALLOWED_DOWNGRADE";e[e.CURRENT_SPEC=4]="CURRENT_SPEC"}(Ue||(Ue={})),function(e){e[e.Send=1]="Send";e[e.Received=2]="Received";e[e.Spam=3]="Spam"}(Ce||(Ce={})),function(e){e[e.Normal=0]="Normal";e[e.Spoof=1]="Spoof";e[e.Phishing=2]="Phishing";e[e.Spam=3]="Spam";e[e.Malicious=4]="Malicious"}(Le||(Le={})),function(e){e[e.Normal=0]="Normal";e[e.Sending=1]="Sending";e[e.Failed=2]="Failed"}(Oe||(Oe={})),function(e){e[e.FILE_PARTITION_UNSPECIFIED=0]="FILE_PARTITION_UNSPECIFIED";e[e.FILE_PARTITION_USER_MEMORY=1]="FILE_PARTITION_USER_MEMORY";e[e.FILE_PARTITION_AGENT_ALL=2]="FILE_PARTITION_AGENT_ALL";e[e.FILE_PARTITION_USER_ALL=3]="FILE_PARTITION_USER_ALL";e[e.FILE_PARTITION_TRASH=9]="FILE_PARTITION_TRASH"}(ve||(ve={})),function(e){e[e.FILE_TAG_UNSPECIFIED=0]="FILE_TAG_UNSPECIFIED";e[e.FILE_TAG_FAVORITE=1]="FILE_TAG_FAVORITE";e[e.FILE_TAG_MEMORY=2]="FILE_TAG_MEMORY";e[e.FILE_TAG_TRASH=3]="FILE_TAG_TRASH"}(ye||(ye={})),function(e){e[e.FILE_TYPE_UNSPECIFIED=0]="FILE_TYPE_UNSPECIFIED";e[e.FILE_TYPE_FAVORITE=1]="FILE_TYPE_FAVORITE";e[e.FILE_TYPE_TEMPLATE=2]="FILE_TYPE_TEMPLATE";e[e.FILE_TYPE_TEMPLATE_COVER=3]="FILE_TYPE_TEMPLATE_COVER";e[e.FILE_TYPE_PLAN_TEMPLATE=4]="FILE_TYPE_PLAN_TEMPLATE";e[e.FILE_TYPE_ARTICLE=5]="FILE_TYPE_ARTICLE"}(Be||(Be={})),function(e){e[e.FOLDER_ARCHIVE_STATUS_UNSPECIFIED=0]="FOLDER_ARCHIVE_STATUS_UNSPECIFIED";e[e.FOLDER_ARCHIVE_STATUS_PENDING=1]="FOLDER_ARCHIVE_STATUS_PENDING";e[e.FOLDER_ARCHIVE_STATUS_RUNNING=2]="FOLDER_ARCHIVE_STATUS_RUNNING";e[e.FOLDER_ARCHIVE_STATUS_SUCCEEDED=3]="FOLDER_ARCHIVE_STATUS_SUCCEEDED";e[e.FOLDER_ARCHIVE_STATUS_FAILED=4]="FOLDER_ARCHIVE_STATUS_FAILED";e[e.FOLDER_ARCHIVE_STATUS_REJECTED=5]="FOLDER_ARCHIVE_STATUS_REJECTED";e[e.FOLDER_ARCHIVE_STATUS_EXPIRED=6]="FOLDER_ARCHIVE_STATUS_EXPIRED"}(be||(be={})),function(e){e[e.WORKSPACE_SEARCH_TAB_UNSPECIFIED=0]="WORKSPACE_SEARCH_TAB_UNSPECIFIED";e[e.WORKSPACE_SEARCH_TAB_ALL=1]="WORKSPACE_SEARCH_TAB_ALL";e[e.WORKSPACE_SEARCH_TAB_DOC=2]="WORKSPACE_SEARCH_TAB_DOC";e[e.WORKSPACE_SEARCH_TAB_SHEET=3]="WORKSPACE_SEARCH_TAB_SHEET";e[e.WORKSPACE_SEARCH_TAB_PPT=4]="WORKSPACE_SEARCH_TAB_PPT";e[e.WORKSPACE_SEARCH_TAB_IMAGE=5]="WORKSPACE_SEARCH_TAB_IMAGE";e[e.WORKSPACE_SEARCH_TAB_WEB=6]="WORKSPACE_SEARCH_TAB_WEB";e[e.WORKSPACE_SEARCH_TAB_VIDEO=7]="WORKSPACE_SEARCH_TAB_VIDEO";e[e.WORKSPACE_SEARCH_TAB_PODCAST=8]="WORKSPACE_SEARCH_TAB_PODCAST"}(ze||(ze={})),function(e){e[e.Chat=1]="Chat";e[e.ApiTemplate=2]="ApiTemplate"}(De||(De={})),function(e){e[e.User=1]="User";e[e.Agent=2]="Agent";e[e.Project=3]="Project"}(Ne||(Ne={})),function(e){e[e.Grant=1]="Grant";e[e.Revoke=2]="Revoke";e[e.UpdateScope=3]="UpdateScope"}(qe||(qe={})),function(e){e[e.Single=1]="Single";e[e.Desktop=2]="Desktop";e[e.All=3]="All"}(ke||(ke={})),function(e){e[e.Session=1]="Session";e[e.Agent=2]="Agent"}(Fe||(Fe={})),function(e){e[e.PDF=1]="PDF";e[e.PPT=2]="PPT";e[e.ImageEditablePpt=3]="ImageEditablePpt"}(Ge||(Ge={})),function(e){e[e.PDF=1]="PDF";e[e.DOCX=2]="DOCX"}(je||(je={})),function(e){e[e.POSITION=0]="POSITION";e[e.ELEMENT=1]="ELEMENT"}(xe||(xe={})),function(e){e[e.STORAGE_RESOURCE_TYPE_UNSPECIFIED=0]="STORAGE_RESOURCE_TYPE_UNSPECIFIED";e[e.STORAGE_RESOURCE_TYPE_AGENT=1]="STORAGE_RESOURCE_TYPE_AGENT";e[e.STORAGE_RESOURCE_TYPE_PROJECT=2]="STORAGE_RESOURCE_TYPE_PROJECT";e[e.STORAGE_RESOURCE_TYPE_VIDEO_PROJECT=3]="STORAGE_RESOURCE_TYPE_VIDEO_PROJECT";e[e.STORAGE_RESOURCE_TYPE_CODING_PROJECT=4]="STORAGE_RESOURCE_TYPE_CODING_PROJECT"}(Me||(Me={})),function(e){e[e.ACCOUNT_QUOTA_ZERO=1]="ACCOUNT_QUOTA_ZERO";e[e.RESOURCE_LIMIT_EXCEEDED=2]="RESOURCE_LIMIT_EXCEEDED"}(He||(He={})),function(e){e[e.MOBILE=1]="MOBILE";e[e.COMPUTER=2]="COMPUTER"}(We||(We={})),function(e){e[e.Delete=1]="Delete";e[e.Read=2]="Read";e[e.ClearAt=3]="ClearAt"}(Ve||(Ve={})),function(e){e[e.Delete=0]="Delete";e[e.Running=1]="Running";e[e.Idle=2]="Idle"}(Ye||(Ye={})),function(e){e[e.Pin=1]="Pin";e[e.Unpin=2]="Unpin";e[e.Delete=3]="Delete"}($e||($e={})),function(e){e[e.Running=1]="Running";e[e.Idle=2]="Idle"}(Ze||(Ze={})),function(e){e[e.Valid=1]="Valid";e[e.Delete=2]="Delete"}(Ke||(Ke={}));class Xe{__init(){this.request=a.request}__init2(){this.baseURL=""}constructor(e){Xe.prototype.__init.call(this),Xe.prototype.__init2.call(this),this.request=Je([e,"optionalAccess",e=>e.request])||this.request,this.baseURL=Je([e,"optionalAccess",e=>e.baseURL])||this.baseURL}genBaseURL(e){return"string"==typeof this.baseURL?this.baseURL+e:this.baseURL(e)}ListMessage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/list"),a={session_id:s.session_id,cursor:s.cursor,size:s.size,asc_mode:s.asc_mode,need_reference:s.need_reference,conversation_id:s.conversation_id};return this.request({url:i,method:"POST",data:a},t)}ListSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/list"),a={claw_id:s.claw_id,limit:s.limit,offset:s.offset,is_pin:s.is_pin,order_by:s.order_by};return this.request({url:i,method:"POST",data:a},t)}ListProcess(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/process/list"),a={claw_id:s.claw_id,size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}OperateSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/operate"),a={session_id:s.session_id,operate_type:s.operate_type,conversation_id:s.conversation_id};return this.request({url:i,method:"POST",data:a},t)}UpdateSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/update"),a={session_id:s.session_id,name:s.name,is_pin:s.is_pin};return this.request({url:i,method:"POST",data:a},t)}Chat(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/chat"),a={session_id:s.session_id,content:s.content,files:s.files,skill_ids:s.skill_ids,reference_message_id:s.reference_message_id,at_members:s.at_members,conversation_id:s.conversation_id,video_option:s.video_option};return this.request({url:i,method:"POST",data:a},t)}CreateMessageShare(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/create_share"),a={session_id:s.session_id,message_ids:s.message_ids,share_file:s.share_file};return this.request({url:i,method:"POST",data:a},t)}CreateSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/create"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetMainSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/get_main"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}EmailList(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/list"),a={claw_id:s.claw_id,email_type:s.email_type,contact_address:s.contact_address,size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}CreateMailAddress(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/create_address"),a={claw_id:s.claw_id,address:s.address};return this.request({url:i,method:"POST",data:a},t)}BatchGetEmails(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/batch"),a={claw_id:s.claw_id,email_ids:s.email_ids};return this.request({url:i,method:"POST",data:a},t)}GetMailAddressInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/get_address"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}UpdateUserClawInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/claw/update_info"),a={claw_id:s.claw_id,file_name:s.file_name,file_content:s.file_content,model_name:s.model_name};return this.request({url:i,method:"POST",data:a},t)}ReceivedCallback(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/received_callback"),a={app_id:s.app_id,app_email:s.app_email,mail_id:s.mail_id,ouid:s.ouid,mail_message:s.mail_message,create_time:s.create_time};return this.request({url:i,method:"POST",data:a},t)}ListChannel(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/list"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetUrl(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/get_url"),a={uris:s.uris,share_id:s.share_id};return this.request({url:i,method:"POST",data:a},t)}GetUserClawInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/claw/info"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}CalendarQueryRange(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/query_range"),a={start_date:s.start_date,end_date:s.end_date,timezone:s.timezone,claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}GetRecentFiles(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/recent"),a={limit:s.limit,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}FileUpload(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/upload"),a={file_name:s.file_name,file_content:s.file_content,file_type:s.file_type,tags:s.tags,claw_id:s.claw_id,session_id:s.session_id,project_id:s.project_id,project_dir:s.project_dir};return this.request({url:i,method:"POST",data:a},t)}GetFileTree(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/tree"),a={partition:s.partition,depth:s.depth,claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}ListFiles(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/list"),a={tag:s.tag,limit:s.limit,offset:s.offset,sort_by:s.sort_by,sort_order:s.sort_order,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}GetFrontierKey(e,t){const s=this.genBaseURL("/api/coze_claw/resource/get_frontier_key");return this.request({url:s,method:"GET"},t)}GetContacts(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/get_contacts"),a={claw_id:s.claw_id,size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}CalendarBatchGetEvents(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/batch_get_events"),a={uids:s.uids,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}UpdateFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/update"),a={file_path:s.file_path,file_content:s.file_content,claw_id:s.claw_id,file_uri:s.file_uri,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetFileVersions(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/versions"),a={file_path:s.file_path,claw_id:s.claw_id,file_uri:s.file_uri};return this.request({url:i,method:"GET",params:a},t)}GetSessionInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/get_info"),a={session_id:s.session_id};return this.request({url:i,method:"POST",data:a},t)}GetMobileSTSCredentials(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/sts_credentials"),a={pod_id:s.pod_id};return this.request({url:i,method:"GET",params:a},t)}ListMobileTask(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/mobile/list_task"),a={size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}FileSearch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/search"),a={keyword:s.keyword,file_type:s.file_type,tags:s.tags,trash_only:s.trash_only,partition:s.partition,sort_by:s.sort_by,sort_order:s.sort_order,page_size:s.page_size,page_token:s.page_token,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}OperateMobileTask(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/operate_task"),a={mobile_task_id:s.mobile_task_id,action:s.action,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}Reset(e,t){const s=this.genBaseURL("/api/coze_claw/resource/reset");return this.request({url:s,method:"POST"},t)}ListMobile(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/mobile/list"),a={mobile_ids:s.mobile_ids};return this.request({url:i,method:"GET",params:a},t)}EmailSendCallback(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/email/send_callback"),a={otid:s.otid,ouid:s.ouid,mail_id:s.mail_id,message_id:s.message_id,time_stamp:s.time_stamp,from_address:s.from_address,recipient_address:s.recipient_address,event:s.event,src_ip:s.src_ip,return_code:s.return_code,return_msg:s.return_msg,last_update_time_stamp:s.last_update_time_stamp,delivery_error_classify:s.delivery_error_classify};return this.request({url:i,method:"POST",data:a},t)}UnsubscribeMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/unsubscribe"),a={mobile_id:s.mobile_id};return this.request({url:i,method:"POST",data:a},t)}SubscribeMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/subscribe"),a={name:s.name};return this.request({url:i,method:"POST",data:a},t)}OperateMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/operate"),a={mobile_id:s.mobile_id,action:s.action,reason:s.reason,new_name:s.new_name};return this.request({url:i,method:"POST",data:a},t)}CalendarListRecurringEvents(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/list_recurring_events"),a={claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}CalendarGetEventDebugURL(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/get_event_debug_url"),a={calendar_event_uid:s.calendar_event_uid,instance_start:s.instance_start};return this.request({url:i,method:"GET",params:a},t)}GetFeishuAuthInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/auth_info"),a={claw_id:s.claw_id,bot_name:s.bot_name,redirect_url:s.redirect_url};return this.request({url:i,method:"POST",data:a},t)}ExchangeFeishuAuthCode(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/exchange_code"),a={code:s.code,verify_state:s.verify_state};return this.request({url:i,method:"POST",data:a},t)}FeishuAuthCallback(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/auth_callback"),a={code:s.code,verify_state:s.verify_state};return this.request({url:i,method:"POST",data:a},t)}CancelFeishuAuth(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/cancel_auth"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}ApiTemplate(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/image/api_template"),a={session_id:s.session_id,prompt:s.prompt,files:s.files,type:s.type};return this.request({url:i,method:"POST",data:a},t)}CreateFeishuApp(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/create_app"),a={claw_id:s.claw_id,bot_name:s.bot_name,recreate:s.recreate};return this.request({url:i,method:"POST",data:a},t)}GetWebUrl(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/get_web_url"),a={original_url:s.original_url,exchange_for_short_url:s.exchange_for_short_url,exchange_for_qr_code:s.exchange_for_qr_code,exchange_for_long_url:s.exchange_for_long_url};return this.request({url:i,method:"GET",params:a},t)}CalendarDelete(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/delete"),a={uid:s.uid,instance_start:s.instance_start,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}CalendarResume(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/resume"),a={uid:s.uid,instance_start:s.instance_start,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}CalendarPause(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/pause"),a={uid:s.uid,instance_start:s.instance_start,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}DetailMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/detail"),a={mobile_id:s.mobile_id};return this.request({url:i,method:"GET",params:a},t)}MGetMessage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/mget"),a={session_id:s.session_id,message_ids:s.message_ids};return this.request({url:i,method:"POST",data:a},t)}GenCover(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/resource/gen_cover"),a={original_file_uri:s.original_file_uri,resolution:s.resolution,mode:s.mode,selector_str:s.selector_str,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GenDoc(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/resource/gen_doc"),a={target_file_type:s.target_file_type,original_file_uri:s.original_file_uri,resource_map:s.resource_map,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}ShareDocs(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/share_docs"),a={uris:s.uris};return this.request({url:i,method:"POST",data:a},t)}TerminateProcess(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/process/terminate"),a={claw_id:s.claw_id,process_id:s.process_id};return this.request({url:i,method:"POST",data:a},t)}SearchMessage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/search_message"),a={session_id:s.session_id,query:s.query,limit:s.limit};return this.request({url:i,method:"POST",data:a},t)}WorkspaceSearch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/workspace_search"),a={keyword:s.keyword,tab:s.tab,page_size:s.page_size,page_token:s.page_token,session_id:s.session_id,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}ExportPPT(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/export_ppt"),a={source_uri:s.source_uri,export_type:s.export_type};return this.request({url:i,method:"POST",data:a},t)}CreateFolderArchive(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/archive/create"),a={claw_id:s.claw_id,file_path:s.file_path,partition:s.partition,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetFolderArchiveStatus(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/archive/status"),a={claw_id:s.claw_id,job_id:s.job_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}GetSandboxToken(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/browser_use/get_sandbox_token"),a={session_id:s.session_id,claw_id:s.claw_id,session_key:s.session_key,computer_id:s.computer_id};return this.request({url:i,method:"POST",data:a},t)}OperateBrowserUse(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/browser_use/operate"),a={session_id:s.session_id,claw_id:s.claw_id,action:s.action};return this.request({url:i,method:"POST",data:a},t)}ListBrowserUseMessage(e,t){const s=this.genBaseURL("/api/coze_claw/browser_use/list_message");return this.request({url:s,method:"GET"},t)}IntentRecognition(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/image/intent_recognition"),a={session_id:s.session_id,files:s.files,query:s.query};return this.request({url:i,method:"POST",data:a},t)}RestoreFileVersion(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/versions/restore"),a={file_path:s.file_path,claw_id:s.claw_id,file_uri:s.file_uri,version_id:s.version_id};return this.request({url:i,method:"POST",data:a},t)}GetFileVersionURL(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/versions/url"),a={file_path:s.file_path,claw_id:s.claw_id,file_uri:s.file_uri,version_id:s.version_id};return this.request({url:i,method:"GET",params:a},t)}ExportPPTSandbox(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/export_ppt_sandbox"),a={sandbox_identity_ticket:s.sandbox_identity_ticket,html_content:s.html_content,title:s.title,export_type:s.export_type};return this.request({url:i,method:"POST",data:a},t)}CheckSubscribe(e,t){const s=this.genBaseURL("/api/coze_claw/mobile/check_subscribe");return this.request({url:s,method:"GET"},t)}GetMessageShare(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/get_share"),a={share_id:s.share_id,need_reference:s.need_reference};return this.request({url:i,method:"POST",data:a},t)}GetModelConfig(e,t){const s=this.genBaseURL("/api/coze_claw/resource/get_model_config");return this.request({url:s,method:"POST"},t)}CheckResourceSubscribe(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/check_subscribe"),a={resource_types:s.resource_types};return this.request({url:i,method:"GET",params:a},t)}UnsubscribeComputer(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/unsubscribe"),a={computer_id:s.computer_id};return this.request({url:i,method:"POST",data:a},t)}ListComputer(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/computer/list"),a={computer_ids:s.computer_ids};return this.request({url:i,method:"GET",params:a},t)}SubscribeComputer(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/subscribe"),a={name:s.name};return this.request({url:i,method:"POST",data:a},t)}OperateComputer(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/operate"),a={computer_id:s.computer_id,action:s.action,new_name:s.new_name};return this.request({url:i,method:"POST",data:a},t)}WechatBindWait(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/bind_wait"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}WechatWebhook(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/wechat/webhook"),a={app_id:s.app_id,wechat_messages:s.wechat_messages};return this.request({url:i,method:"POST",data:a},t)}WechatBindStart(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/bind_start"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}WechatUnbind(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/unbind"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}OperateVideoTask(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/video/operate_task"),a={video_task_id:s.video_task_id,action:s.action,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}ListVideoTask(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/video/list_task"),a={size:s.size,cursor:s.cursor,claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}WechatUnbindInternal(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/unbind_internal"),a={app_id:s.app_id};return this.request({url:i,method:"POST",data:a},t)}GetEmailSettings(e,t){const s=this.genBaseURL("/api/coze_claw/email/get_settings");return this.request({url:s,method:"POST"},t)}GetFileTreeV2(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/tree_v2"),a={partition:s.partition,depth:s.depth,claw_id:s.claw_id,file_path:s.file_path,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}SandboxSkillHubAdd(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/skill/skill_hub_add"),a={sandbox_identity_ticket:s.sandbox_identity_ticket,skill_id:s.skill_id,agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}SandboxSkillHubShopSearch(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/skill/skill_hub_shop_search"),a={sandbox_identity_ticket:s.sandbox_identity_ticket,keyword:s.keyword};return this.request({url:i,method:"POST",data:a},t)}GetStorageUsage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/storage_usage"),a={claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}MobileScreenShot(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/screenshot"),a={mobile_id:s.mobile_id};return this.request({url:i,method:"GET",params:a},t)}OperateComputerTask(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/operate_task"),a={run_id:s.run_id,action:s.action};return this.request({url:i,method:"POST",data:a},t)}ListComputerTask(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/computer/list_task"),a={size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}ListClaw(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/list_claw"),a={project_id:s.project_id,limit:s.limit,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}ListProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/list"),a={type:s.type,limit:s.limit,offset:s.offset,is_pin:s.is_pin};return this.request({url:i,method:"POST",data:a},t)}RemoveProjectMember(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/remove"),a={project_id:s.project_id,project_member:s.project_member};return this.request({url:i,method:"POST",data:a},t)}UpdateInviteProjectUser(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/update"),a={project_id:s.project_id,is_accept:s.is_accept};return this.request({url:i,method:"POST",data:a},t)}CreateProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/create"),a={claw_ids:s.claw_ids,name:s.name,source_message_ids:s.source_message_ids,source_msg_id:s.source_msg_id,sub_type:s.sub_type};return this.request({url:i,method:"POST",data:a},t)}InviteProjectUser(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/invite"),a={project_id:s.project_id,invite_member:s.invite_member,invite_agent:s.invite_agent};return this.request({url:i,method:"POST",data:a},t)}DeleteProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/delete"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}AddProjectMember(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/add"),a={project_id:s.project_id,members:s.members};return this.request({url:i,method:"POST",data:a},t)}CreateClaw(e,t){const s=this.genBaseURL("/api/coze_claw/project/create_claw");return this.request({url:s,method:"POST"},t)}UpdateProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/update"),a={project_id:s.project_id,name:s.name,description:s.description,is_pin:s.is_pin};return this.request({url:i,method:"POST",data:a},t)}LeaveProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/leave"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetDeviceCreatePreflight(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/device/create/preflight"),a={cloud_device_type:s.cloud_device_type,cloud_device_id:s.cloud_device_id,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}ListInvitedProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/list_project"),a={limit:s.limit,offset:s.offset};return this.request({url:i,method:"POST",data:a},t)}ListProjectInvitee(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/list_invitee"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetGlobalFileTree(e,t){const s=this.genBaseURL("/api/coze_claw/file/global_tree");return this.request({url:s,method:"GET"},t)}EnterpriseGetDeviceStats(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/stats"),a={enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}ListBackgroundSession(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/session/list_background"),a={session_id:s.session_id,filter_running:s.filter_running,cursor:s.cursor,size:s.size};return this.request({url:i,method:"POST",data:a},t)}EnterpriseListMyDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/my"),a={cursor:s.cursor,page_size:s.page_size,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}EnterpriseGetAutoApprove(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/auto_approve"),a={enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}EnterpriseAssignDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/assign"),a={cloud_device_id:s.cloud_device_id,target_user_uid:s.target_user_uid,organization_id:s.organization_id,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}GetPairResult(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/get_pair_result"),a={pair_code:s.pair_code};return this.request({url:i,method:"POST",data:a},t)}GetAgentStatus(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/get_status"),a={agent_ids:s.agent_ids};return this.request({url:i,method:"POST",data:a},t)}GetGlobalStorageUsage(e,t){const s=this.genBaseURL("/api/coze_claw/resource/global_storage_usage");return this.request({url:s,method:"GET"},t)}EnterpriseClaimDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim"),a={devices:s.devices,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseEditDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/edit"),a={cloud_device_id:s.cloud_device_id,device_name:s.device_name,spec:s.spec,confirm_price_change:s.confirm_price_change,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}SubscribeDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/device/subscribe"),a={cloud_device_type:s.cloud_device_type,spec:s.spec,name:s.name};return this.request({url:i,method:"POST",data:a},t)}ChangeDeviceSpec(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/device/change_spec"),a={cloud_device_type:s.cloud_device_type,cloud_device_id:s.cloud_device_id,target_spec:s.target_spec,name:s.name};return this.request({url:i,method:"POST",data:a},t)}EnterpriseListDeviceClaimRecord(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim/list"),a={cursor:s.cursor,page_size:s.page_size,status:s.status,keyword:s.keyword,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}GeneratePairCode(e,t){const s=this.genBaseURL("/api/coze_claw/agent/generate_pair_code");return this.request({url:s,method:"POST"},t)}EnterpriseRejectDeviceClaim(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim/reject"),a={claim_record_id:s.claim_record_id,reason:s.reason,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseDeleteDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/delete"),a={cloud_device_id:s.cloud_device_id,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseApproveDeviceClaim(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim/approve"),a={claim_record_id:s.claim_record_id,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseListDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/list"),a={cursor:s.cursor,page_size:s.page_size,keyword:s.keyword,cloud_device_type:s.cloud_device_type,status:s.status,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}EnterpriseListAvailableDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/available"),a={cursor:s.cursor,page_size:s.page_size,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}CreateAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/create"),a={agent_name:s.agent_name,create_mode:s.create_mode,template_id:s.template_id,target_device_id:s.target_device_id,framework:s.framework,pair_code:s.pair_code,local_agents:s.local_agents,description:s.description,icon:s.icon};return this.request({url:i,method:"POST",data:a},t)}ListDeviceAgents(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/device/binding/list_by_device"),a={cloud_device_id:s.cloud_device_id,cloud_device_type:s.cloud_device_type,cursor:s.cursor,page_size:s.page_size};return this.request({url:i,method:"GET",params:a},t)}EnterpriseReassignDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/reassign"),a={cloud_device_id:s.cloud_device_id,new_user_uid:s.new_user_uid,new_organization_id:s.new_organization_id,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseSetAutoApprove(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/auto_approve"),a={enabled:s.enabled,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}GetHotWords(e,t){const s=this.genBaseURL("/api/coze_claw/asr/get_hot_words");return this.request({url:s,method:"GET"},t)}GetModelList(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/get_model_list"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}SelectModel(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/select_model"),a={claw_id:s.claw_id,name:s.name};return this.request({url:i,method:"POST",data:a},t)}CreateSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/create"),a={session_id:s.session_id,name:s.name,description:s.description};return this.request({url:i,method:"POST",data:a},t)}OperateSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/operate"),a={session_conversation_id:s.session_conversation_id,operate_type:s.operate_type};return this.request({url:i,method:"POST",data:a},t)}MessageCardAction(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message_card/action"),a={name:s.name,surface_id:s.surface_id,source_component_id:s.source_component_id,timestamp:s.timestamp,context:s.context,message_id:s.message_id,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}UpdateSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/update"),a={session_conversation_id:s.session_conversation_id,name:s.name,description:s.description};return this.request({url:i,method:"POST",data:a},t)}ListConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/conversation/list"),a={type:s.type,is_pin:s.is_pin,limit:s.limit,offset:s.offset,top_claw_id:s.top_claw_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseBatchCreateDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/batch_create"),a={cloud_device_type:s.cloud_device_type,device_name:s.device_name,spec:s.spec,quantity:s.quantity,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}ListSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/list"),a={session_id:s.session_id,limit:s.limit,offset:s.offset};return this.request({url:i,method:"POST",data:a},t)}GetAgentFileContent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/file/content"),a={agent_id:s.agent_id,file_path:s.file_path,file_token:s.file_token};return this.request({url:i,method:"GET",params:a},t)}GetProjectInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/info"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}OperateDesktop(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/operate"),a={device_id:s.device_id,action:s.action,new_name:s.new_name};return this.request({url:i,method:"POST",data:a},t)}DesktopHeartbeat(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/heartbeat"),a={device_id:s.device_id,version:s.version,status:s.status,os:s.os,desktop_name:s.desktop_name};return this.request({url:i,method:"POST",data:a},t)}ReportDesktopCommandResult(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/report_command_result"),a={command_id:s.command_id,status:s.status,data:s.data,upload_file:s.upload_file};return this.request({url:i,method:"POST",data:a},t)}ListDesktop(e,t){const s=this.genBaseURL("/api/coze_claw/desktop/list");return this.request({url:s,method:"GET"},t)}SearchProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/search"),a={type:s.type,keyword:s.keyword,limit:s.limit,cursor:s.cursor};return this.request({url:i,method:"GET",params:a},t)}GetProjectMembers(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/list"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}UpdateAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/update"),a={agent_id:s.agent_id,agent_name:s.agent_name,description:s.description,file_name:s.file_name,file_content:s.file_content};return this.request({url:i,method:"POST",data:a},t)}ListAgents(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/list"),a={page_size:s.page_size,cursor:s.cursor,deploy_types:s.deploy_types,order_by:s.order_by};return this.request({url:i,method:"POST",data:a},t)}GetAgentDetail(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/detail"),a={agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}ReconnectAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/reconnect"),a={agent_id:s.agent_id,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}DisconnectAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/disconnect"),a={agent_id:s.agent_id,reason:s.reason,force:s.force};return this.request({url:i,method:"POST",data:a},t)}GetCozeClawUserInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/user/info"),a={need_onboarding_status:s.need_onboarding_status};return this.request({url:i,method:"POST",data:a},t)}SetCozeClawUserOnboardingStatus(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/user/set_onboarding_status"),a={onboarding_status:s.onboarding_status};return this.request({url:i,method:"POST",data:a},t)}GetGlobalUnread(e,t){const s=this.genBaseURL("/api/coze_claw/unread/get_total");return this.request({url:s,method:"POST"},t)}GenerateAgentName(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/generate_name"),a={create_mode:s.create_mode,template_id:s.template_id,framework:s.framework};return this.request({url:i,method:"POST",data:a},t)}ListProjectFiles(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/list"),a={project_id:s.project_id,file_path:s.file_path,depth:s.depth};return this.request({url:i,method:"POST",data:a},t)}WriteProjectFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/write"),a={project_id:s.project_id,file_path:s.file_path,content:s.content};return this.request({url:i,method:"POST",data:a},t)}ReadProjectFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/read"),a={project_id:s.project_id,file_path:s.file_path,offset:s.offset,limit:s.limit};return this.request({url:i,method:"POST",data:a},t)}EditProjectFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/edit"),a={project_id:s.project_id,file_path:s.file_path,mode:s.mode,old_string:s.old_string,new_string:s.new_string,append_content:s.append_content};return this.request({url:i,method:"POST",data:a},t)}ComputerScreenShot(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/screenshot"),a={computer_id:s.computer_id};return this.request({url:i,method:"GET",params:a},t)}CancelProjectInvite(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/cancel"),a={project_id:s.project_id,invite_member:s.invite_member};return this.request({url:i,method:"POST",data:a},t)}GenerateAgentIcon(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/generate_icon"),a={agent_name:s.agent_name,description:s.description};return this.request({url:i,method:"POST",data:a},t)}ListPermission(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/permission/list"),a={session_id:s.session_id};return this.request({url:i,method:"GET",params:a},t)}OperatePermission(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/permission/operate"),a={session_id:s.session_id,action:s.action,target:s.target,permission_id:s.permission_id,desktop_id:s.desktop_id,scope:s.scope,claw_id:s.claw_id,file_path:s.file_path};return this.request({url:i,method:"POST",data:a},t)}RepairAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/repair"),a={agent_id:s.agent_id,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}ResetAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/reset"),a={agent_id:s.agent_id,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}MGetConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/conversation/mget"),a={session_ids:s.session_ids,option:s.option,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetProjectByClawID(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/get_by_claw_id"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetDesktopCommand(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/get_command"),a={command_id:s.command_id};return this.request({url:i,method:"GET",params:a},t)}OperateVideoConversation(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/video/operate_conversation"),a={session_id:s.session_id,conversation_id:s.conversation_id,action:s.action};return this.request({url:i,method:"POST",data:a},t)}ValidateAgentName(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/validate_name"),a={agent_name:s.agent_name};return this.request({url:i,method:"POST",data:a},t)}GetLocalFileAccess(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/local_file_access"),a={device_id:s.device_id};return this.request({url:i,method:"GET",params:a},t)}UpdateLocalFileAccess(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/update_local_file_access"),a={device_id:s.device_id,status:s.status};return this.request({url:i,method:"POST",data:a},t)}AgentFileUpload(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/agent_upload"),a={file_name:s.file_name,file_content:s.file_content,file_type:s.file_type,tags:s.tags,agent_id:s.agent_id,session_id:s.session_id};return this.request({url:i,method:"POST",data:a},t)}SetNewFeaturePopupStatus(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/user/set_new_feature_popup_status"),a={new_feature_popup_status:s.new_feature_popup_status};return this.request({url:i,method:"POST",data:a},t)}DownloadFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/download"),a={file_url:s.file_url};return this.request({url:i,method:"GET",params:a},t)}DownloadImage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/file/download_image"),a={file_content:s.file_content,file_name:s.file_name,file_uri:s.file_uri};return this.request({url:i,method:"POST",data:a},t)}ResetV2(e,t){const s=this.genBaseURL("/api/coze_claw/resource/reset_v2");return this.request({url:s,method:"POST"},t)}AgentWebSearch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/web_search"),a={agent_id:s.agent_id,query_list:s.query_list,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}AgentWebFetch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/web_fetch"),a={agent_id:s.agent_id,url:s.url,project_id:s.project_id,response_length:s.response_length};return this.request({url:i,method:"POST",data:a},t)}}const Qe=new Xe({});function et(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const tt=Ge.PPT,st=Ge.ImageEditablePpt,it=e=>e.replace(/\s+/g," ").trim(),at=e=>it(e.replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'")),rt=e=>{const t=e.match(/<title[^>]*>([\s\S]*?)<\/title>/i),s=et([t,"optionalAccess",e=>e[1]])?at(t[1]):"";if(s)return s;const i=at(e);return i?i.split(" ")[0]:void 0},nt=e=>{const t=(e=>{if(e.includes("\x3c!--SPLIT_HTML--\x3e"))return e.split("\x3c!--SPLIT_HTML--\x3e").map((e=>e.trim())).filter(Boolean);const t=e.match(/<html[\s\S]*?<\/html>/gi);return et([t,"optionalAccess",e=>e.length])?t.map((e=>e.trim())).filter(Boolean):[e.trim()].filter(Boolean)})(e).map(((e,t)=>({page:t+1,title:rt(e),previewText:at(e)})));return{type:"html",pageCount:t.length,pages:t}},ot=(e,t)=>{if(!(t.length>=80||void 0===e))if("string"!=typeof e)Array.isArray(e)?e.forEach((e=>ot(e,t))):e&&"object"==typeof e&&Object.entries(e).forEach((([e,s])=>{(["title","text","content","description","name"].includes(e)||Array.isArray(s)||s&&"object"==typeof s)&&ot(s,t)}));else{const s=it(e);s&&t.push(s)}},ct=({api:e})=>async({fileUri:t,exportType:s="ppt"})=>{const i=await e.exportPPT({source_uri:t,export_type:"editable"===s?st:tt});if(void 0!==i.code&&0!==i.code&&"0"!==i.code)throw new x(i.msg||"Failed to export PPT","SESSION_PPT_EXPORT_FAILED");const a=et([i,"access",e=>e.data,"optionalAccess",e=>e.url]);if(!a)throw new x(i.msg||"PPT export response missing download URL","SESSION_PPT_EXPORT_FAILED");return{uri:et([i,"access",e=>e.data,"optionalAccess",e=>e.uri]),url:a,exportType:s}};function lt(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const dt=e=>{const t=String(e.id||"");if(!t)return null;const s="string"==typeof e.content?e.content:"",i=(r=s,a.safeJsonParse(r,void 0));var r;const n=lt([i,"optionalAccess",e=>e.message_data,"optionalAccess",e=>e.reply]),o=void 0===lt([i,"optionalAccess",e=>e.create_time_ms])?void 0:String(i.create_time_ms);return{messageId:t,sessionId:"string"==typeof lt([i,"optionalAccess",e=>e.session_id])?i.session_id:void 0,source:(c=e.source,1===Number(c)?"user":2===Number(c)?"agent":"unknown"),content:"string"==typeof lt([n,"optionalAccess",e=>e.content])&&n.content?n.content:s,files:Array.isArray(e.files)?e.files:void 0,createTime:"string"==typeof e.create_time?e.create_time:o,messageType:"string"==typeof lt([i,"optionalAccess",e=>e.message_type])?i.message_type:void 0,replyToMessageId:"string"==typeof lt([n,"optionalAccess",e=>e.reply_to_message_id])?n.reply_to_message_id:void 0,raw:e};var c};const _t=({api:e})=>async({fileUri:t})=>{const s=await e.getUrl({uris:[t]}),i=function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([s,"access",e=>e.data,"optionalAccess",e=>e.urls,"optionalAccess",e=>e[0]]);if(!i)throw new x(s.msg||"Failed to resolve session file URL","SESSION_FILE_URL_FAILED");return i};const ut=async({formData:e,request:t})=>{e.append("file_name",t.fileName);const s=await(async e=>{if(e instanceof Blob)return e;if(Buffer.isBuffer(e))return new Blob([e]);if(e instanceof Uint8Array)return new Blob([e]);if(e instanceof ArrayBuffer)return new Blob([e]);if("string"==typeof e)return new Blob([e]);throw new TypeError("Unsupported session upload file content type")})(t.fileContent),i=(a=t.fileContent)instanceof Blob&&a.type?a.type:void 0;var a;const r=i&&s.type!==i?new Blob([s],{type:i}):s;e.append("file_content",r,t.fileName),e.append("claw_id",t.clawId),t.projectId&&e.append("project_id",t.projectId),t.projectDir&&e.append("project_dir",t.projectDir),t.sessionId&&e.append("session_id",t.sessionId)},pt=({options:e,requestOptions:t})=>{const s={...(i=t.headers,a=()=>({}),null!=i?i:a())};var i,a;const r=(({baseUrl:e,webOrigin:t})=>{if(t)return t;try{return new URL(I(e)).origin}catch(e){return}})({baseUrl:e.baseUrl,webOrigin:e.webOrigin});return r&&(s.Origin=r),s.Referer=(({baseUrl:e,webOrigin:t})=>t?t.endsWith("/")?t:`${t}/`:I(e))({baseUrl:e.baseUrl,webOrigin:e.webOrigin}),e.xSpaceWebId&&(s["x-space-webid"]=e.xSpaceWebId),Object.assign(s,v(e.xTTEnv)),s},ht=e=>async(t,s={})=>{const i=new URL("/api/coze_claw/file/upload",I(e.baseUrl)),r=new FormData;await ut({formData:r,request:t});const n=pt({options:e,requestOptions:s}),o=a.customFetch.getRequestHeaders(i.toString(),{headers:n}),c=await globalThis.fetch(i.toString(),{method:"POST",headers:o,body:r});!function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}}([s,"access",e=>e.onGetLogId,"optionalCall",e=>e(c.headers.get("x-tt-logid")||"")]);const l=await C(c,{});return L(c,l,{serviceName:"Session"}),l};const mt=async({baseUrl:e,params:t,requestOptions:s={},responseFallback:i,xTTEnv:r})=>{const n=new URL(t.url,I(e));U(n,t.params);const o={"Content-Type":"application/json",...(c=s.headers,l=()=>({}),null!=c?c:l()),...v(r)};var c,l;const d=t.method.toUpperCase(),_="GET"===d?void 0:JSON.stringify(void 0===t.data?{}:t.data),u=await a.customFetch.fetch(n.toString(),{method:d,headers:o,body:_});!function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}}([s,"access",e=>e.onGetLogId,"optionalCall",e=>e(O(u)||"")]);const p=await C(u,i);return L(u,p,{serviceName:"Session"}),p},gt=e=>{const t=async(t,s={})=>await mt({baseUrl:e.baseUrl,params:t,requestOptions:s,responseFallback:{},xTTEnv:e.xTTEnv}),s=new Xe({baseURL:I(e.baseUrl),request:(e,s={})=>t(e,s)}),i=new Xe({baseURL:I(e.baseUrl),request:(e,s={})=>t(e,s)});return{getUserClawInfo:(t,s)=>mt({baseUrl:e.baseUrl,params:{url:"/api/coze_claw/claw/info",method:"POST",data:t},requestOptions:s,responseFallback:{},xTTEnv:e.xTTEnv}),createSession:(e,t)=>s.CreateSession(e,t),listSession:(e,t)=>s.ListSession(e,t),listMessage:(e,t)=>s.ListMessage(e,t),uploadFile:ht(e),getWebUrl:(e,t)=>i.GetWebUrl(e,t),getUrl:(e,t)=>i.GetUrl(e,t),exportPPT:(e,t)=>i.ExportPPT(e,t),chat:(e,t)=>s.Chat(e,t),listProcess:(e,t)=>s.ListProcess(e,t)}},Et=e=>{const t=gt({baseUrl:e.sessionApiBaseUrl||e.apiBaseUrl,webOrigin:e.sessionApiBaseUrl||e.apiBaseUrl,xSpaceWebId:e.sessionSpaceWebId,xTTEnv:e.xTTEnv});return{getUserClawInfo:(e,s)=>t.getUserClawInfo(e,s),createSession:(e,s)=>t.createSession(e,s),listSession:(e,s)=>t.listSession(e,s),listMessage:(e,s)=>t.listMessage(e,s),uploadFile:(e,s)=>t.uploadFile(e,s),getWebUrl:(e,s)=>t.getWebUrl(e,s),getUrl:(e,s)=>t.getUrl(e,s),exportPPT:(e,s)=>t.exportPPT(e,s),chat:(e,s)=>t.chat(e,s),listProcess:(e,s)=>t.listProcess(e,s)}},wt=()=>({async get(){const e=await R();return{sessionId:e.sessionId,sessionClawId:e.sessionClawId}},async save(e){await P(e)}});function Tt(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const ft=[".report.html",".podcast.html",".webdoc.html",".socmed.html",".pptx.html",".poster.html",".resume.html",".chart.html"],St=({file:e,fileIndex:t,clawId:s,webOrigin:i})=>{const a=e.file_uri;if(!a||!s)return;const r=new URL(i).origin;const n=e.file_name||a.split("/").pop()||"";return(e=>e.endsWith(".html")&&!ft.some((t=>e.endsWith(t))))(n||a)?`${r}/web?is_shared=1&uri=${encodeURIComponent(a)}&is_claw=1`:`${r}/share-product/${s}?index=${t}&uri=${encodeURIComponent(a)}&filename=${encodeURIComponent(n)}&only_content=1&is_claw=1`},Rt=async({files:e,clawId:t,webOrigin:s,api:i})=>e&&0!==e.length?await Promise.all(e.map((async(e,a)=>{const r=St({file:e,fileIndex:a,clawId:t,webOrigin:s});return{...e,preview_url:await D({url:r,api:i})}}))):[],Pt=async({files:e,clawId:t,apiBaseUrl:s,sessionApiBaseUrl:i,xTTEnv:a,service:r,deps:n})=>{if(!e||0===e.length)return e;const o=Tt([n,"optionalAccess",e=>e.store])||wt(),{sessionClawId:c}=await o.get(),l=t||c||(await r.getStatus()).clawId,d=(Tt([n,"optionalAccess",e=>e.createApi])||gt)({baseUrl:i||s,xTTEnv:a}),_=Tt([n,"optionalAccess",e=>e.resolveFiles])||Rt;return await _({files:e,clawId:l,webOrigin:i||s,api:{getWebUrl:e=>d.getWebUrl(e)}})},At=e=>"running"!==e,It=e=>{if(e&&0!==e.length)return e.map((e=>({fileName:e.file_name,fileUrl:e.file_url,previewUrl:e.preview_url,fileUri:e.file_uri})))};const Ut=l.join(p(),"tasks","session-progress-tasks.json");class Ct extends Error{constructor(e){super(e),this.name="SessionTaskStoreError"}}class Lt extends Error{constructor(e){super(`Session task expired: ${e}`),this.taskId=e,this.name="SessionTaskExpiredError"}}class Ot extends Error{constructor(e){super(`Session task not found: ${e}`),this.taskId=e,this.name="SessionTaskNotFoundError"}}const vt=(e,t)=>Object.entries(t).reduce(((e,[t,s])=>void 0===s?e:{...e,[t]:s}),{...e}),yt=e=>{const t=a.safeJsonParse(e,void 0);if(void 0===t)throw new Ct("Failed to parse session task store");if(s=t,!Boolean(s)||"object"!=typeof s||Array.isArray(s)||!Array.isArray(t.items))throw new Ct("Failed to parse session task store");var s;return{version:1,items:t.items}},Bt=({filePath:e=Ut,now:t=Date.now,retentionMs:s=6048e5,writeDocument:i=async(e,t)=>{await(async({content:e,filePath:t})=>{await n.mkdir(r.dirname(t),{recursive:!0});const s=`${t}.tmp.${Date.now()}.${process.pid}`,i=await n.open(s,"w");try{await i.writeFile(e,"utf8"),await i.sync()}finally{await i.close()}try{await n.rename(s,t)}catch(e){throw await n.rm(s,{force:!0}).catch((()=>{})),e}})({content:t,filePath:e})}}={})=>{const a=(e=>async()=>{try{const t=await n.readFile(e,"utf8");return yt(t)}catch(e){if("ENOENT"===function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([e,"optionalAccess",e=>e.code]))return{version:1,items:[]};if(e instanceof Ct)throw e;throw new Ct(`Failed to read session task store: ${String(e)}`)}})(e),o=(({filePath:e,writeDocument:t})=>async s=>{await t(e,JSON.stringify(s,null,2))})({filePath:e,writeDocument:i}),c=e=>{if(!At(e.status))return!1;const i=(a=e.finishedAt,r=()=>e.updatedAt,null!=a?a:r());var a,r;return t()-i>s},l=(({isExpired:e,readDocument:t})=>async({includeExpired:s,taskId:i})=>{const a=(await t()).items.find((e=>e.taskId===i));if(!a)throw new Ot(i);if(!s&&e(a))throw new Lt(i);return a})({isExpired:c,readDocument:a});return{list:async(e={})=>(await a()).items.filter((t=>!(!e.includeExpired&&c(t))&&((!e.sessionId||t.sessionId===e.sessionId)&&(!e.status||t.status===e.status)))).sort(((e,t)=>t.updatedAt-e.updatedAt)),get:async(e,t={})=>await l({includeExpired:t.includeExpired,taskId:e}),async upsert(e){const t=await a(),s=t.items.findIndex((t=>t.taskId===e.taskId));if(s>=0){const[i]=t.items.slice(s,s+1),a=vt(i,e);t.items.splice(s,1,a)}else t.items.push(e);return await o(t),await l({includeExpired:!0,taskId:e.taskId})},async patch(e,t){const s=await a(),i=s.items.findIndex((t=>t.taskId===e));if(i<0)throw new Ot(e);const[r]=s.items.slice(i,i+1),n=vt(r,t);return s.items.splice(i,1,n),await o(s),await l({includeExpired:!0,taskId:e})},async remove(e){const t=await a();t.items=t.items.filter((t=>t.taskId!==e)),await o(t)},async gc(){const e=await a(),t=e.items.filter(c);return e.items=e.items.filter((e=>!c(e))),await o(e),t},isExpired:c}},bt=({api:e,store:t,authConfigured:s=()=>!0,fallbackAccountId:i})=>{const a=(({now:e=Date.now,workingTtlMs:t=3e4}={})=>{const s=new Map;return{clear(){s.clear()},getLive(i){const a=s.get(i);if(a){if(!(e()-a.updatedAt>t))return a;s.delete(i)}},markIdle(e){s.delete(e)},markWorking(t){s.set(t,{status:"working",updatedAt:e()})}}})(),r=(e=>async({sessionId:t,status:s})=>{"idle"!==s?e.markWorking(t):e.markIdle(t)})(a),n=(({api:e,authConfigured:t,fallbackAccountId:s,store:i})=>async()=>{const a=s;if(!t())return q({accountId:a,authConfigured:!1});try{const t=a?{account_id:a}:{},s=function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([await e.getUserClawInfo(t),"access",e=>e.data,"optionalAccess",e=>e.user_claw_info,"optionalAccess",e=>e.claw_id]);return s?(await i.save({sessionClawId:s}),{authConfigured:!0,authValid:!0,clawId:s,accountId:a,updatedAt:void 0}):q({accountId:a,authConfigured:!0})}catch(e){return q({accountId:a,authConfigured:!0})}})({api:e,authConfigured:s,fallbackAccountId:i,store:t}),o=(({createAuthInvalidError:e,getStatus:t,getStoredConfig:s})=>async()=>{const i=await s();if(i.sessionClawId)return i.sessionClawId;const a=await t();if(!a.authValid||!a.clawId)throw e();return a.clawId})({createAuthInvalidError:M,getStatus:n,getStoredConfig:async()=>t.get()}),c=F({api:e,resolveClawId:o}),{listMessages:l,listRepliesByMessage:d}=(({api:e,createListError:t})=>{const s=async({sessionId:s,cursor:i,size:a=10,ascMode:r})=>{const n=await e.listMessage({session_id:s,cursor:i,size:a,asc_mode:r});if(0!==n.code&&void 0!==n.code)throw t(n.msg||"Failed to list session messages");const o=(lt([n,"access",e=>e.data,"optionalAccess",e=>e.messages])||[]).map((e=>dt(e))).filter((e=>null!==e)),c=lt([n,"access",e=>e.data,"optionalAccess",e=>e.next_cursor]);return{items:o,nextCursor:c,hasMore:Boolean(c)}};return{listMessages:s,listRepliesByMessage:async({sessionId:e,messageId:t,size:i=10,maxPages:a=100})=>{let r,n=!1;const o=[];for(let c=0;c<a;c+=1){const a=await s({sessionId:e,cursor:r,size:i});if(a.items.forEach((e=>{e.messageId===t&&(n=!0),e.replyToMessageId===t&&o.push(e)})),n||!a.hasMore||!a.nextCursor)break;r=a.nextCursor}return{sessionId:e,requestMessageId:t,requestMessageFound:n,items:o.reverse()}}}})({api:e,createListError:e=>new x(e,"SESSION_MESSAGE_LIST_FAILED")});return{getStatus:n,createSession:W({api:e,resolveClawId:o}),listSessions:V({api:e,resolveClawId:o}),listMessages:l,listRepliesByMessage:d,sendMessage:Y({api:e,updateSessionRuntimeStatus:r}),listProgresses:c,getProgress:G(c),getSessionDisplayStatus:j({listProgresses:c,runtimeStatusStore:a}),resolveFileUrl:_t({api:e}),exportPpt:ct({api:e}),shortenWebUrl:N({api:e}),updateSessionRuntimeStatus:r}},zt=e=>{const t=wt();return bt({api:Et(e),store:t,authConfigured:()=>Boolean(e.accessToken),fallbackAccountId:e.organizationId})};function Dt(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const Nt=e=>{if(!e)return;const t=(e=>e.replace(/\s+/g," ").trim())(e);return t?t.length>120?`${t.slice(0,117)}...`:t:void 0},qt=e=>{if(!e)return;const t=e.trim();return t?t.length>200?`${t.slice(0,197)}...`:t:void 0},kt=({apiBaseUrl:e,now:t=Date.now,resolveReplyFiles:s,service:i,sessionApiBaseUrl:a,store:r=Bt(),xTTEnv:n})=>({async createOrUpdateTaskFromMessageWait({answerMessageId:e,content:s,files:i,messageId:a,progress:n,sessionId:o}){const c=t(),l=s,d=Nt(l),_="running"!==n.progressStatus,u=_?qt(l):void 0;return await r.upsert({taskId:(p=n.progressId,`stp_${p}`),kind:"session_progress",sessionId:o,messageId:a,progressId:n.progressId,status:_?"finished":"running",contentPreview:d,answerMessageId:e,replyContent:l,resultSummary:u,artifacts:It(i),lastProgressStatus:n.progressStatus,createdAt:c,updatedAt:c,finishedAt:_?c:void 0});var p},getTask:async(e,t)=>await r.get(e,t),patchTask:async(e,t)=>await r.patch(e,t),listTasks:async e=>await r.list(e),async refreshTask(o,c){const l=await r.get(o,c);if(At(l.status))return l;try{const c=await i.getProgress({progressId:l.progressId}),d=t();if(c)return await r.patch(o,{contentPreview:Nt(l.replyContent),lastProgressStatus:c.progressStatus,lastRefreshError:void 0,resultSummary:void 0,status:"running"===c.progressStatus?"running":"finished",updatedAt:d});const _=await(async({apiBaseUrl:e,resolveReplyFiles:t=Pt,service:s,sessionApiBaseUrl:i,task:a,xTTEnv:r})=>{const n=await s.listRepliesByMessage({sessionId:a.sessionId,messageId:a.messageId}),o=n.items[n.items.length-1];if(!o)return null;const c=o.files&&o.files.length>0?await t({files:o.files,apiBaseUrl:e,sessionApiBaseUrl:i,service:s,xTTEnv:r}):o.files;return{answerMessageId:o.messageId,files:c,replyContent:o.content,resultSummary:qt(o.content)}})({apiBaseUrl:e,resolveReplyFiles:s,service:i,sessionApiBaseUrl:a,task:l,xTTEnv:n});return await r.patch(o,{answerMessageId:Dt([_,"optionalAccess",e=>e.answerMessageId]),artifacts:Dt([_,"optionalAccess",e=>e.files])?It(_.files):void 0,contentPreview:Nt(Dt([_,"optionalAccess",e=>e.replyContent])),finishedAt:d,lastProgressStatus:"finished",lastRefreshError:void 0,replyContent:Dt([_,"optionalAccess",e=>e.replyContent]),resultSummary:Dt([_,"optionalAccess",e=>e.resultSummary]),status:"finished",updatedAt:d})}catch(e){return await r.patch(o,{lastRefreshError:e instanceof Error?e.message:String(e),updatedAt:t()})}},gcTasks:async()=>await r.gc()});function Ft(e,t){return null!=e?e:t()}const Gt=({elapsedMs:e})=>e>=3e5?3e4:1e4;exports.Claw=Qe,exports.DEFAULT_CONFIG=w,exports.SessionServiceError=x,exports.SessionTaskExpiredError=Lt,exports.SessionTaskNotFoundError=Ot,exports.SessionTaskStoreError=Ct,exports.appendSearchParams=U,exports.buildSessionPptSlideUrl=({origin:e,fileUri:t,taskId:s,baseHeight:i=720,baseWidth:a=1280})=>{const r=s||(e=>e.split("/").filter(Boolean)[0])(t);if(!r)throw new x("Missing PPT task id for share URL","SESSION_PPT_SHARE_FAILED");const n=new URL(`/slide/${encodeURIComponent(r)}`,(e=>e.endsWith("/")?e.slice(0,-1):e)(e));return n.searchParams.set("uri",t),n.searchParams.set("baseHeight",String(i)),n.searchParams.set("baseWidth",String(a)),n.searchParams.set("is_claw","1"),n.toString()},exports.createDefaultSessionService=zt,exports.createSessionApiClient=gt,exports.createSessionConfigStore=wt,exports.createSessionTaskService=kt,exports.createSessionUploadFile=ht,exports.deleteConfig=async function(e){const t=process.env.COZE_CONFIG_FILE;if(t){const s=await T(t);if(s&&e in s){try{delete s[e],await d.writeFile(t,JSON.stringify(s,null,2),"utf8")}catch(e){throw new Error(`Failed to delete config from ${t}: ${e}`)}return}}let s=E,i=await T(s);if(i&&e in i||(s=m,i=await f()),i&&e in i)try{delete i[e],await d.writeFile(s,JSON.stringify(i,null,2),"utf8")}catch(e){throw new Error(`Failed to delete config from ${s}: ${e}`)}},exports.fetchSessionPptContent=async({url:e,fetchImpl:t=e=>a.customFetch.fetch(e),maxBytes:s=10485760})=>{const i=await t(e);if(!i.ok)throw new x(`Failed to fetch PPT content: ${i.status} ${i.statusText}`,"SESSION_PPT_FETCH_FAILED");const r=i.headers.get("content-length");if(r){const e=Number.parseInt(r,10);if(Number.isFinite(e)&&e>s)throw new x(`PPT content is too large: ${e} bytes exceeds ${s} bytes`,"SESSION_PPT_FETCH_FAILED")}const n=await i.text(),o=Buffer.byteLength(n,"utf8");if(o>s)throw new x(`PPT content is too large: ${o} bytes exceeds ${s} bytes`,"SESSION_PPT_FETCH_FAILED");return n},exports.formatServiceErrorWithLogId=({fallback:e,logId:t,message:s})=>{const i=s||e;return t?`${i}\n LogID: ${t}`:i},exports.formatSessionPptEditQuery=({pages:e,query:t})=>{const s=[...new Set(e)].sort(((e,t)=>e-t));return 1===s.length?`对第${s[0]}页进行变更:<${t}>`:`对第${s.join("、")}页进行变更:<${t}>`},exports.getCozeAccountHeaders=y,exports.getGlobalCompletionFile=()=>l.join(p(),"completion.sh"),exports.getGlobalConfigDir=p,exports.getGlobalLogsDir=()=>l.join(p(),"logs"),exports.getGlobalSkillLockFile=()=>l.join(p(),".skill-lock.json"),exports.getLegacyGlobalConfigDir=h,exports.getPpeHeaders=v,exports.getServiceResponseLogId=O,exports.installScopedCozeAccountFetchHeader=z,exports.isSessionTaskTerminal=At,exports.listConfigs=async function(){const e=process.env.COZE_CONFIG_FILE,[t,s,i]=await Promise.all([f(),T(E),e?T(e):void 0]),a=S(),r=new Set([...Object.keys(w),...Object.keys(t||{}),...Object.keys(s||{}),...Object.keys(i||{}),...Object.keys(a)]),n=[];for(const e of Array.from(r)){const r=e;let o,c="default";r in a&&void 0!==a[r]?(o=a[r],c="env"):i&&r in i&&void 0!==i[r]?(o=String(i[r]),c="env-file"):s&&r in s&&void 0!==s[r]?(o=String(s[r]),c="local"):t&&r in t&&void 0!==t[r]?(o=String(t[r]),c="global"):r in w&&(o=String(w[r]),c="default"),n.push({key:e,value:o,source:c})}return n},exports.loadConfig=R,exports.normalizeBaseUrl=I,exports.parseServiceResponseBody=C,exports.parseSessionPptContent=e=>{const t=e.trim(),s=(e=>{const t=a.safeJsonParse(e,null),s=Array.isArray(et([t,"optionalAccess",e=>e.pages]))?t.pages:Array.isArray(et([t,"optionalAccess",e=>e.data,"optionalAccess",e=>e.pages]))?t.data.pages:null;return s?{type:"json",pageCount:s.length,pages:s.map(((e,t)=>{const s=[];ot(e,s);const i=((e,t)=>{if(!e||"object"!=typeof e)return;const s=e;for(const e of t){const t=s[e];if("string"==typeof t&&t.trim())return t}})(e,["image_url","export_image_url","preview_url","thumbnail_url"]);return{page:t+1,title:s[0]||`第${t+1}页`,previewUrl:i,previewText:it(s.join(" "))||(i?`preview_url: ${i}`:"")}}))}:null})(t);return s||(/<html[\s>]/i.test(t)||t.includes("\x3c!--SPLIT_HTML--\x3e")?nt(t):{type:"unknown",pageCount:0,pages:[]})},exports.resolveStoredSessionReplyFiles=Pt,exports.runSessionTaskRefreshWorkerCli=async()=>{const t=e.argv[2];if(!t)throw new Error("No payload provided");const s=a.safeJsonParse(t,void 0);if(!s)throw new Error("Invalid payload");await(async({now:e=Date.now,payload:t,sleep:s=async e=>await new Promise((t=>setTimeout(t,e))),taskService:r=kt({apiBaseUrl:t.apiBaseUrl,service:zt({accessToken:t.accessToken,apiBaseUrl:t.apiBaseUrl,organizationId:t.organizationId,sessionApiBaseUrl:Ft(t.sessionApiBaseUrl,(()=>"")),xTTEnv:t.xTTEnv}),sessionApiBaseUrl:t.sessionApiBaseUrl,store:Bt(),xTTEnv:t.xTTEnv})})=>{const n=new i.EnvHttpProxyAgent;a.customFetch.setDispatcher(n),a.customFetch.setHeaders({Authorization:`Bearer ${t.accessToken}`}),z({organizationId:t.organizationId}),t.xTTEnv&&a.customFetch.setHeaders({"x-use-ppe":"1","x-tt-env":t.xTTEnv});const o=e();let c=3e3;try{for(;;){await s(c);const i=await r.refreshTask(t.taskId,{includeExpired:!0});if(At(i.status))return;c=Gt({elapsedMs:e()-o})}}finally{await r.patchTask(t.taskId,{workerPid:void 0})}})({payload:s})},exports.saveConfig=P,exports.shouldInjectCozeAccountHeader=B,exports.startDetachedSessionTaskRefreshWorker=async({payload:i,spawnImpl:a=s.spawn})=>{const r=a(e.execPath,[t.resolve(__dirname,"./session-task-refresh.worker.js"),JSON.stringify(i)],{detached:!0,stdio:"ignore"});return r.unref(),r.pid};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze/cli",
3
- "version": "0.2.0-alpha.9f6611",
3
+ "version": "0.2.0-alpha.af0037",
4
4
  "private": false,
5
5
  "description": "Coze CLI - A command-line interface for Coze platform",
6
6
  "license": "MIT",
@@ -45,6 +45,8 @@
45
45
  "mitt": "~3.0.1",
46
46
  "omelette": "~0.4.17",
47
47
  "openapi-typescript": "~7.4.0",
48
+ "skills": "latest",
49
+ "swagger2openapi": "^7.0.8",
48
50
  "undici": "~7.24.5",
49
51
  "ws": "~8.20.0"
50
52
  },
@@ -73,6 +75,7 @@
73
75
  "@rollup/plugin-terser": "^0.4.4",
74
76
  "@types/lodash": "~4.17.24",
75
77
  "@types/node": "^24",
78
+ "@types/swagger2openapi": "^7.0.4",
76
79
  "@vitest/coverage-v8": "~4.1.7",
77
80
  "knip": "^5.30.1",
78
81
  "rollup": "^4.60.1",
@@ -1,29 +1,25 @@
1
1
  {
2
- "cliVersion": "0.2.0-alpha.9f6611",
2
+ "cliVersion": "0.2.0-alpha.af0037",
3
3
  "skills": {
4
4
  "using-coze-cli": {
5
5
  "path": "using-coze-cli/SKILL.md",
6
- "hash": "sha256:3b2a1e316a066ab384af3302be95e4ce833800fd56d6fb18fc37884f73306479"
6
+ "hash": "sha256:10efa9264773560eecfe80df64727b63fe85527c7fbc871b2109688d9c6184a0"
7
7
  },
8
8
  "coze-claw": {
9
9
  "path": "using-coze-cli/coze-claw/MODULE.md",
10
- "hash": "sha256:306d0519c88ca186fd501a43ae9fae5194ad9e9047a5befd76ea709a626b7033"
10
+ "hash": "sha256:7428f735c0b2170a84ff9039d4f621debf1ce33171062c6b5ff05b8d91b4df16"
11
11
  },
12
12
  "coze-code": {
13
13
  "path": "using-coze-cli/coze-code/MODULE.md",
14
- "hash": "sha256:6bd741dd0e5c5c316c4ccdf78a6cf27a37d0a4aef6d7530e43ec92a1d1cb9ef7"
14
+ "hash": "sha256:fd5c186eba9e072f4b2e68876c7fa245afac894960a106b7764d065fbcbfe72d"
15
15
  },
16
16
  "coze-file": {
17
17
  "path": "using-coze-cli/coze-file/MODULE.md",
18
- "hash": "sha256:0764d74b19584d1c71760affecb2948e0b7c25ad5dd8179b07b034f1689be7dc"
18
+ "hash": "sha256:e8ecd802ae7573ab4f83e9ec4046787da75d7fd628e3a9fbdc219ff9bed207d5"
19
19
  },
20
20
  "coze-generate": {
21
21
  "path": "using-coze-cli/coze-generate/MODULE.md",
22
- "hash": "sha256:39feef5743e693b1ea7fc2a75dcdb46f99618667e70ad128d00c478da1ce96c3"
23
- },
24
- "coze-project": {
25
- "path": "using-coze-cli/coze-project/MODULE.md",
26
- "hash": "sha256:dc7f1dabf852eafd4afbf385f3ed9f468374b3f1fa3df4ca768914823e582e0f"
22
+ "hash": "sha256:288ac8a32e49c49c54996f76475445c32aeea4fda2731492a002a5d0720ef178"
27
23
  }
28
24
  }
29
25
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: using-coze-cli
3
- version: 0.2.0-alpha.9f6611
3
+ version: 0.2.0-alpha.af0037
4
4
  description: "Coze CLI 共享基础:安装、认证登录(OAuth)、组织与空间切换、配置管理、全局执行原则、安全规则、错误码处理、代理配置。当用户首次使用 coze-cli、需要登录授权、遇到权限不足、切换组织/空间、操作 Coze Claw Session/coze session *,或任何操作前的基础检查时触发。"
5
5
  metadata:
6
6
  requires:
@@ -30,7 +30,6 @@ metadata:
30
30
  - `coze code *`:先读 [coze-code/MODULE.md](coze-code/MODULE.md)
31
31
  - `coze file *`:先读 [coze-file/MODULE.md](coze-file/MODULE.md)
32
32
  - `coze generate *`:先读 [coze-generate/MODULE.md](coze-generate/MODULE.md)
33
- - `coze agent *`(群聊协作,`<coze-context>` 标识为"群聊消息"时):先读 [coze-project/MODULE.md](coze-project/MODULE.md)
34
33
 
35
34
  约束:
36
35
 
@@ -328,14 +327,14 @@ fi
328
327
 
329
328
  - 切换组织时会**自动清空 Space ID**,需要重新选择工作空间。
330
329
  - 指定不存在的组织 ID 会**报错且不修改配置**。
331
- - 省略 org_id 可切换到个人账户模式(需要个人账户可用)。
330
+ - 切换到个人账户有三种等价写法:`coze organization use`(省略 org_id)、`coze organization use ""`(显式空串)、`coze organization unset`(别名 `coze organization reset`)。均会清空 `organizationId`/`enterpriseId`(及 `spaceId`),且**不再校验个人账户是否可用**。
332
331
  - CLI 的自动上下文补全**仅作用于空间**:未配置空间时,首次执行需要上下文的命令会自动选择第一个可用空间(结果可能不是期望的,建议始终显式设置)。**组织不会自动选择**——未显式设置组织时按上文的个人账户模式处理。
333
332
 
334
333
  ### 遇到 `No permission` 的修正顺序
335
334
 
336
335
  1. `coze config list` — 查看当前配置
337
336
  2. `coze organization list` — 查看可用组织
338
- 3. `coze organization use <org_id>` — 切换到正确的组织(或 `coze organization use` 切换到个人账户)
337
+ 3. `coze organization use <org_id>` — 切换到正确的组织(或 `coze organization unset` / `coze organization use` 切换到个人账户)
339
338
  4. `coze space list` — 查看当前组织下的空间
340
339
  5. `coze space use <space_id>` — 切换到正确的空间
341
340
 
@@ -343,7 +342,8 @@ fi
343
342
 
344
343
  - `COZE_ORG_ID`、`COZE_SPACE_ID` 环境变量可临时覆盖配置,无需修改持久化配置。
345
344
  - `--org-id`、`--space-id` 全局参数也可以临时覆盖。
346
- - `COZE_CLI_PLATFORM` 环境变量决定**项目访问链接的域名**:取值为 `ecs` `vefaas`(忽略大小写)时,所有项目访问链接(创建、部署、预览等命令输出的 URL)使用 `www.coze.cn` 域名;其它取值或为空时使用默认的 `code.coze.cn` 域名。
345
+ - **项目访问链接的域名由项目类型决定**:`web` / `app` / `miniprogram`(coze 3.0 项目)使用 `www.coze.cn`,其它类型(agent / workflow / skill / assistant 等)使用 `code.coze.cn`。各命令输出的 URL(如 `project_url`、部署/预览链接)已由 CLI 据此生成,直接透传即可。
346
+ - `COZE_CLI_PLATFORM` 环境变量仅在**无法获知项目类型**的少数场景作为域名回退依据(取值 `ecs` / `vefaas` 时回退到 `www.coze.cn`,否则 `code.coze.cn`),不再覆盖按类型决定的链接。
347
347
 
348
348
  ## 配置管理概要
349
349
 
@@ -422,7 +422,6 @@ Agent 在判断命令执行结果时,应根据退出码判断:
422
422
  | [`coze-claw`](./coze-claw/MODULE.md) | Claw Session 对话、回复监听、后台 progress、文件/PPT/播客产物 | `coze session *` |
423
423
  | [`coze-generate`](./coze-generate/MODULE.md) | 生成图片、语音合成(TTS)、视频生成 | `coze generate *` |
424
424
  | [`coze-file`](./coze-file/MODULE.md) | 上传本地文件获取在线访问地址 | `coze file upload` |
425
- | [`coze-project`](./coze-project/MODULE.md) | 群聊协作:查群成员/群历史、读写编辑群文件、把协作产出衔接给用户(`<coze-context>` 为"群聊消息"时) | `coze agent *` |
426
425
 
427
426
  ## 典型错误速查(基础类)
428
427
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: coze-claw
3
- version: 0.2.0-alpha.9f6611
3
+ version: 0.2.0-alpha.af0037
4
4
  description: "Coze Claw Session 会话工作流:创建/找回 claw session、发送 session message、监听回复、查询后台 progress、处理文件/PPT/播客产物。当用户需要使用 coze session * 任意命令时触发。"
5
5
  metadata:
6
6
  requires:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: coze-code
3
- version: 0.2.0-alpha.9f6611
3
+ version: 0.2.0-alpha.af0037
4
4
  description: "Coze Coding 项目开发工作流:创建项目、发送需求消息、查询状态、预览、部署、环境变量管理、域名管理、技能管理、数据库管理。当用户需要创建/管理 Coze 项目、发送开发需求、部署应用、管理数据库、或使用 coze code * 任意命令时触发。"
5
5
  metadata:
6
6
  requires:
@@ -72,6 +72,75 @@ coze code project create --message "创建一个聊天机器人" --type web --fo
72
72
  - `--wait` 选项会等待项目创建完成(包括首次 AI 消息响应)后再返回。
73
73
  - 记录返回的 `projectId`。
74
74
 
75
+ #### Step 1.1: 准确识别项目类型(App vs 网页)
76
+
77
+ 创建前**必须**先根据用户的自然语言意图确定 `--type`,**不要默认用 `web`**。只要用户表达「创建 App / 应用」,一律走 `--type app` 进入 App 项目创建流程,避免被误建成网页项目;判断不清时主动反问确认。
78
+
79
+ | 用户表达(示例) | 推荐 `--type` |
80
+ |------------------|--------------|
81
+ | "创建一个 App / 应用"、"做个 App"、"开发一款应用"、"移动端应用"、"手机 App"、"原生应用" | `app` |
82
+ | "创建网页 / 网站"、"做个 Web 页面"、"落地页"、"官网"、"H5 页面" | `web` |
83
+ | "小程序"、"微信小程序" | `miniprogram` |
84
+ | "智能体 / Agent / 机器人 / 客服 bot" | `agent` |
85
+ | "工作流 / 自动化流程" | `workflow` |
86
+ | "技能 / skill 插件" | `skill` |
87
+ | "助手 / assistant" | `assistant` |
88
+
89
+ - 只要用户明确提到 **App / 应用** 字样(而非"网页/网站/页面"),一律用 `--type app`。
90
+ - "应用"在「移动端 App」语境下指 `app`;仅当用户明确说"Web 应用 / 网页应用"时才用 `web`。
91
+ - 用户意图含糊(如只说"帮我做个东西")时,**先反问是 App 还是网页**,确认后再创建。
92
+
93
+ #### Step 1.2: 仅创建项目,默认不自动部署
94
+
95
+ - `project create` **只负责创建项目并触发首次 AI 开发**,**绝不**自动部署。创建成功后**不要**主动执行 `deploy`。
96
+ - 部署是独立动作,**必须**由用户明确要求"部署 / 上线",且 `message status` 为 `done` 时才执行(见 Step 3 / Step 4)。
97
+
98
+ #### Step 1.3: 创建成功后的标准回复(含「打开项目」入口)
99
+
100
+ 项目创建成功后(无论是否 `--wait`),回复用户时**必须**附上「打开项目」入口,链接指向项目对话页面,方便用户直接跳转,省去在项目列表 / 历史会话中二次查找。
101
+
102
+ **链接来源**:`project create` 的 `--format json` 返回值中已含 `project_url` 字段(CLI 按**项目类型**自动生成域名:`web` / `app` / `miniprogram` 为 `https://www.coze.cn/p/<project_id>`,其它类型为 `https://code.coze.cn/p/<project_id>`)。**直接读取 `project_url` 透传给用户,不要自行拼接链接。**
103
+
104
+ 回复模板(创建成功、AI 仍在后台开发时,`<project_url>` 取自返回值):
105
+
106
+ ```
107
+ ✅ 项目已创建成功,正在为你开发中…
108
+ - 🔗 打开项目:<project_url>
109
+ - 可继续发送需求迭代,或稍候查看开发结果。
110
+ ```
111
+
112
+ #### Step 1.4: 开发任务完成后的引导文案
113
+
114
+ **创建后必须主动跟进到开发完成**,不能停在"正在开发中"就结束。查询状态**优先使用主动轮询**的方式:
115
+ - **首选**:创建后**主动轮询** `coze code message status -p <project_id> --format json`(`message status` 无 `--wait`,需自行间隔轮询),直到状态为 `done`,**不要**让用户自己去查状态。
116
+ - 备选:创建时加 `--wait` 让 CLI 等到首次 AI 开发完成再返回(仅在确有需要时使用,状态跟进仍以主动轮询为准)。
117
+
118
+ 待状态为 `done` 后,向用户给出后续操作引导(**不要**自动执行部署):
119
+
120
+ **「预览效果」一行仅 `web` 类型项目才显示**。当 `--type web` 时,**先主动获取预览地址再给引导**:执行 `coze code preview <project_id> --format json`,读取返回的 `preview_url`,把预览地址**直接展示**给用户,而不是只丢一条 `coze code preview` 命令让用户自己跑。
121
+
122
+ - 沙盒初始化通常需 **1-3 分钟**,若 `preview_url` 暂未就绪可稍后重试一次。
123
+ - **非 `web` 类型**(`app` / `miniprogram` / `agent` / `workflow` / `skill` / `assistant`)一律**省略「预览效果」整行**,不展示预览地址。
124
+
125
+ 引导文案(`<project_url>` / `<preview_url>` 取自返回值):
126
+
127
+ ```
128
+ ✅ 开发任务已完成,未自动部署,你可以继续选择:
129
+ - 🛠 继续对话修改页面/文案/功能
130
+ - 🔗 打开项目:<project_url>
131
+ - 👀 预览效果:<preview_url> # 仅 web 类型显示此行
132
+ - 🚀 确认后发起部署
133
+ ```
134
+
135
+ #### Step 1.5: 创建失败场景的文案提示
136
+
137
+ 当 `project create` 失败(如报错、未返回 `project_id`、上下文缺失等)时,**不要**只把原始错误堆栈丢给用户,按以下模板友好提示并引导用户补充信息后重试:
138
+
139
+ ```
140
+ 项目创建失败
141
+ 你可以重新发起创建,或补充更明确的项目类型、页面需求和目标空间后再试。
142
+ ```
143
+
75
144
  ### Step 2: 发送需求
76
145
 
77
146
  详细参数和示例参见 [`coze-code-message.md`](references/coze-code-message.md)。
@@ -129,6 +198,10 @@ coze code preview <project-id>
129
198
 
130
199
  ## Agent 禁止行为
131
200
 
201
+ - 不要在 `project create` 后**自动部署**——创建只完成项目创建与首次 AI 开发,部署须等用户明确要求
202
+ - 不要在 `project create` 后**停在"正在开发中"就结束**——查询状态优先主动轮询 `message status` 到 `done`(`--wait` 仅备选),再给出完成引导文案(Step 1.4),不要让用户自己查状态
203
+ - 不要在项目创建成功后**漏掉「打开项目」入口**——回复必须附上返回值里的 `project_url`(不要自行拼接链接)
204
+ - 不要在用户表达「创建 App / 应用」时误用 `--type web`——应识别为 `--type app`,意图含糊先反问
132
205
  - 不要在 message 仍为 **processing** 时直接部署
133
206
  - 不要对 deploy 使用 **`--project-id`**(它是位置参数!)
134
207
  - 不要给 project create 的 **`--type`** 传受支持列表(`agent|workflow|app|skill|web|miniprogram|assistant`)以外的值,否则报 `E1005`
@@ -50,9 +50,43 @@ coze code project create --message "移动端应用" --type app --format json
50
50
  coze code project create --message "电商网站" --type web --wait --format json
51
51
  ```
52
52
 
53
+ ### 项目类型识别(App vs 网页)
54
+
55
+ 创建前**必须**先根据用户意图选准 `--type`,**不要默认 `web`**。用户表达「创建 App / 应用」时一律用 `--type app` 进入 App 创建流程,避免误建成网页项目;意图含糊先反问确认。
56
+
57
+ | 用户表达(示例) | 推荐 `--type` |
58
+ |------------------|--------------|
59
+ | "App / 应用 / 移动端应用 / 手机 App / 原生应用" | `app` |
60
+ | "网页 / 网站 / Web 页面 / 落地页 / 官网 / H5" | `web` |
61
+ | "小程序 / 微信小程序" | `miniprogram` |
62
+ | "智能体 / Agent / 机器人 / 客服 bot" | `agent` |
63
+ | "工作流 / 自动化流程" | `workflow` |
64
+ | "技能 / skill 插件" | `skill` |
65
+ | "助手 / assistant" | `assistant` |
66
+
53
67
  ### 返回值
54
68
 
55
- `--format json` 时返回 `{ project_id, type }`。**务必记录 project_id** 供后续 message/deploy/preview 使用。
69
+ `--format json` 时返回 `{ project_id, type, project_url }`:
70
+ - `project_id`:**务必记录**,供后续 message/deploy/preview 使用。
71
+ - `project_url`:CLI 已按平台生成好的项目对话页面链接,**直接读取此字段透传给用户,不要自行拼接**。
72
+
73
+ ### 创建成功后的回复要求
74
+
75
+ - **默认不触发部署**:`project create` 只完成项目创建与首次 AI 开发,**绝不**自动 `deploy`;部署须等用户明确要求且 `message status` 为 `done`。
76
+ - **必须附上「打开项目」入口**:回复中给出 CLI 返回的 `project_url`,方便用户直接跳转到项目对话页面,省去在项目列表 / 历史会话中二次查找。
77
+ - `project_url` 由 CLI 按**项目类型**自动生成(`web` / `app` / `miniprogram` 为 `https://www.coze.cn/p/<project_id>`;其它类型为 `https://code.coze.cn/p/<project_id>`),**优先直接使用该字段**。
78
+ - **必须主动跟进到开发完成**:创建后不能停在"正在开发中"。查询状态**优先主动轮询** `coze code message status -p <project_id>` 直到 `done`(`--wait` 仅备选),不要让用户自己查状态。
79
+ - **开发任务完成后**(轮询到 `done`)给出后续引导:继续开发(`message send`)、部署应用(`deploy`,需要时再执行)、打开项目(`project_url`)。
80
+ - **「预览效果」一行仅 `web` 类型显示**:当 `--type web` 时,先执行 `coze code preview <project_id> --format json` 取回 `preview_url`,把预览地址**直接展示**给用户(沙盒初始化需 1-3 分钟,未就绪可重试一次);非 `web` 类型(`app` / `miniprogram` / `agent` / `workflow` / `skill` / `assistant`)**省略整行**,不展示预览地址。
81
+
82
+ ### 创建失败时的回复
83
+
84
+ 当 `project create` 失败(如报错、未返回 `project_id`、上下文缺失等)时,**不要**只把原始错误堆栈丢给用户,按以下模板友好提示并引导用户补充信息后重试:
85
+
86
+ ```
87
+ 项目创建失败
88
+ 你可以重新发起创建,或补充更明确的项目类型、页面需求和目标空间后再试。
89
+ ```
56
90
 
57
91
  ### 坑点
58
92
 
@@ -60,7 +94,7 @@ coze code project create --message "电商网站" --type web --wait --format jso
60
94
  - `--message` 没有 `-m` 短别名,必须写全。
61
95
  - 不带 `--wait` 时命令会立即返回 project_id,但首次 AI 消息仍在后台处理中。
62
96
  - `web` / `app` / `miniprogram` 三种类型默认以 **Coze 3.0 方式**创建;其它类型使用原有创建方式。
63
- - 项目访问域名由环境变量 `COZE_CLI_PLATFORM` 决定(`ecs` / `vefaas` 时为 `www.coze.cn`,否则 `code.coze.cn`),详见 [`../../SKILL.md`](../../SKILL.md) 的「环境变量覆盖」。
97
+ - 项目访问域名由**项目类型**决定(`web` / `app` / `miniprogram` `www.coze.cn`,其它类型为 `code.coze.cn`);`COZE_CLI_PLATFORM` 仅在无法获知类型时作回退,详见 [`../../SKILL.md`](../../SKILL.md) 的「环境变量覆盖」。
64
98
 
65
99
  ---
66
100
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: coze-file
3
- version: 0.2.0-alpha.9f6611
3
+ version: 0.2.0-alpha.af0037
4
4
  description: "Coze 文件操作:上传本地文件获取在线访问地址。当用户需要上传文件、或将本地生成的文件转换为在线可访问链接时触发。"
5
5
  metadata:
6
6
  requires:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: coze-generate
3
- version: 0.2.0-alpha.9f6611
3
+ version: 0.2.0-alpha.af0037
4
4
  description: "Coze 媒体生成:文本生成图片、文本转语音(TTS)、视频生成。当用户需要使用 coze generate image/audio/video 生成音频、图片或视频时触发。"
5
5
  metadata:
6
6
  requires: