@coze/cli 0.3.5-alpha.d901b8 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/cli.js +3 -3
- package/lib/session-task-refresh.worker.js +1 -1
- package/lib/task-worker-D2YCSpjC.js +1 -0
- package/package.json +3 -3
- package/skills/coze-agent-collaboration/SKILL.md +94 -0
- package/skills/coze-agent-collaboration/agents/openai.yaml +4 -0
- package/skills/coze-agent-collaboration/references/at-agent-contract.md +90 -0
- package/skills/manifest.json +10 -6
- package/skills/using-coze-cli/SKILL.md +2 -2
- package/skills/using-coze-cli/coze-claw/MODULE.md +1 -1
- package/skills/using-coze-cli/coze-code/MODULE.md +9 -6
- package/skills/using-coze-cli/coze-code/references/coze-code-project.md +19 -5
- package/skills/using-coze-cli/coze-file/MODULE.md +1 -1
- package/skills/using-coze-cli/coze-generate/MODULE.md +1 -1
- package/lib/task-worker-Dyc4tIXZ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("process"),r=require("./task-worker-
|
|
1
|
+
"use strict";const e=require("process"),r=require("./task-worker-D2YCSpjC.js");require("path"),require("child_process"),require("undici"),require("./fetch-client-DmaLBNmf.js"),require("form-data"),require("crypto"),require("url"),require("net"),require("tls"),require("assert"),require("tty"),require("util"),require("events"),require("http"),require("https"),require("http2"),require("stream"),require("zlib"),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-DmaLBNmf.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=["upgrade.cache"];function g(e){return m.some((t=>e===t||e.startsWith(`${t}.`)))}const E=l.join(p(),"config.json"),w=l.join(h(),"config.json"),T=l.join(process.cwd(),".cozerc.json"),f={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",upgrade:{mode:"auto",channel:"latest"},skill:{mode:"auto"}};function S(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function R(e,t){return t.split(".").reduce(((e,t)=>{if(S(e))return e[t]}),e)}function P(e,t){const s={...e};for(const[e,i]of Object.entries(t)){const t=s[e];S(t)&&S(i)?s[e]=P(t,i):s[e]=i}return s}function A(e,t){const s=t.split("."),i=[];let a=e;for(let e=0;e<s.length-1;e++){if(!S(a))return!1;i.push(a),a=a[s[e]]}if(!S(a))return!1;const r=s[s.length-1];if(!(r in a))return!1;delete a[r],i.push(a);for(let e=s.length-2;e>=0;e--){const t=i[e+1];if(!S(t)||0!==Object.keys(t).length)break;delete i[e][s[e]]}return!0}function U(e,t=""){const s={};if(!S(e))return s;for(const[i,a]of Object.entries(e)){const e=t?`${t}.${i}`:i;S(a)?Object.assign(s,U(a,e)):s[e]=a}return s}async function L(e){try{const t=await d.readFile(e,"utf8");return JSON.parse(t)}catch(e){return}}async function I(){return await async function(e,t){return null!=e?e:await t()}(await L(E),(async()=>await L(w)))}function C(){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_DISABLE_TELEMETRY&&(e.disableTelemetry="true"===process.env.COZE_DISABLE_TELEMETRY),e}async function O(e){const t=process.env.COZE_CONFIG_FILE,[s,i,a,r]=await Promise.all([I(),L(T),t?L(t):void 0,e?L(e):void 0]),n=C();return{...f,...s,...i,...a,...r,...n}}async function v(e,t=function(e,t){return null!=e?e:t()}(C().configScope,(()=>"global"))){const s=process.env.COZE_CONFIG_FILE,i=s||("global"===t?E:T),a=l.dirname(i);try{await d.mkdir(a,{recursive:!0});const t=P(await L(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 y(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 B=e=>e.endsWith("/")?e:`${e}/`,b=(e,t)=>{t&&Object.entries(t).forEach((([t,s])=>{null!=s&&e.searchParams.set(t,String(s))}))},z=async(e,t)=>{const s=await e.text();return s?a.safeJsonParse(s,t):t},q=(e,t,s={})=>{if(e.ok)return;const i=s.serviceName||"Service";throw new Error(y([t,"optionalAccess",e=>e.msg])||`${i} API request failed: ${e.status} ${e.statusText}`)},D=e=>e.headers.get("x-tt-logid")||void 0,k=e=>e?{"x-use-ppe":"1","x-tt-env":e}:{},N=e=>{const t=y([e,"optionalAccess",e=>e.trim,"call",e=>e()]);return t?{"x-coze-account":t}:{}},G=e=>{try{return"www.coze.cn"===new URL(e).hostname}catch(e){return!1}},F="coze-account",j=({getOrganizationId:e,organizationId:t})=>{if(!e&&!y([t,"optionalAccess",e=>e.trim,"call",e=>e()]))return void a.customFetch.removeScopedHeadersProvider(F);const s=e||(()=>t);a.customFetch.setScopedHeadersProvider(F,((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&&G(i)?N(s()):{}}))};const x=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}},M=({api:e})=>async({url:t})=>await x({url:t,api:e})||t;const H=({accountId:e,authConfigured:t})=>({authConfigured:t,authValid:!1,clawId:void 0,accountId:e,updatedAt:void 0});function W(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 V=({api:e,resolveClawId:t})=>async(s={})=>{const i=s.clawId||await t();return(W([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))},Y=e=>async({progressId:t,clawId:s})=>(await e({clawId:s})).find((e=>e.progressId===t))||null,$=({listProgresses:e,runtimeStatusStore:t})=>async({sessionId:s,clawId:i})=>{const a=await e({clawId:i}),r=t.getLive(s),n=W([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:W([r,"optionalAccess",e=>e.updatedAt])}};class J extends Error{constructor(e,t){super(e),this.code=t,this.name="SessionServiceError"}}const Z=()=>new J("Session token is missing or invalid","SESSION_AUTH_INVALID");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 X=({api:e,resolveClawId:t})=>async()=>{const s=await t(),i=await e.createSession({claw_id:s}),a=K([i,"access",e=>e.data,"optionalAccess",e=>e.session,"optionalAccess",e=>e.id]);if(!a)throw new J(i.msg||"Failed to create session","SESSION_CREATE_FAILED");return{clawId:s,sessionId:String(a)}},Q=({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 J(a.msg||"Failed to list sessions","SESSION_LIST_FAILED");const r=K([a,"access",e=>e.data,"optionalAccess",e=>e.session_list])||[],n=K([a,"access",e=>e.data,"optionalAccess",e=>e.next_offset]);return{items:r,nextOffset:n,hasMore:Boolean(n)}},ee=({api:e,updateSessionRuntimeStatus:t})=>async({sessionId:s,content:i,files:a})=>{const r=await e.chat({session_id:s,content:i,files:a}),n=K([r,"access",e=>e.data,"optionalAccess",e=>e.message_id]);if(!n)throw new J(r.msg||"Failed to send session message","SESSION_MESSAGE_FAILED");return await t({sessionId:s,status:"working"}),{sessionId:s,messageId:n,status:"accepted"}};var te,se,ie,ae,re,ne,oe,ce,le,de,_e,ue,pe,he,me,ge,Ee,we,Te,fe,Se,Re,Pe,Ae,Ue,Le,Ie,Ce,Oe,ve,ye,Be,be,ze,qe,De,ke,Ne,Ge,Fe,je,xe,Me,He,We,Ve,Ye,$e,Je,Ze,Ke,Xe,Qe,et,tt,st,it,at,rt,nt,ot;function ct(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";e[e.CozeTeamAdvanced=2200]="CozeTeamAdvanced";e[e.CozeTeamPro=2300]="CozeTeamPro";e[e.CozeTeamUltra=2400]="CozeTeamUltra"}(te||(te={})),function(e){e[e.Resume=1]="Resume";e[e.Terminate=2]="Terminate"}(se||(se={})),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"}(ie||(ie={})),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"}(ae||(ae={})),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"}(re||(re={})),function(e){e[e.Owner=1]="Owner";e[e.Member=10]="Member"}(ne||(ne={})),function(e){e[e.User=1]="User";e[e.Agent=2]="Agent"}(oe||(oe={})),function(e){e[e.Unread=1]="Unread";e[e.Read=2]="Read";e[e.Overdue=3]="Overdue"}(ce||(ce={})),function(e){e[e.Chat=1]="Chat"}(le||(le={})),function(e){e[e.All=0]="All";e[e.Private=1]="Private";e[e.NormalProject=2]="NormalProject";e[e.VideoProject=3]="VideoProject"}(de||(de={})),function(e){e[e.Common=1]="Common";e[e.Video=2]="Video"}(_e||(_e={})),function(e){e[e.History=0]="History";e[e.Private=1]="Private";e[e.Project=2]="Project"}(ue||(ue={})),function(e){e[e.Asset=1]="Asset";e[e.Material=2]="Material"}(pe||(pe={})),function(e){e[e.Running=1]="Running";e[e.Waiting=2]="Waiting";e[e.Terminated=3]="Terminated";e[e.Finish=4]="Finish"}(he||(he={})),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"}(me||(me={})),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"}(ge||(ge={})),function(e){e[e.Managed=1]="Managed";e[e.Cloud=2]="Cloud";e[e.Local=3]="Local"}(Ee||(Ee={})),function(e){e[e.AgentFrameworkCozeClaw=0]="AgentFrameworkCozeClaw";e[e.AgentFrameworkClaudeCode=1]="AgentFrameworkClaudeCode";e[e.AgentFrameworkCodex=2]="AgentFrameworkCodex";e[e.AgentFrameworkOpenClaw=3]="AgentFrameworkOpenClaw";e[e.AgentFrameworkHermes=4]="AgentFrameworkHermes"}(we||(we={})),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"}(Te||(Te={})),function(e){e[e.CreateModeTemplate=1]="CreateModeTemplate";e[e.CreateModeCloudThirdParty=2]="CreateModeCloudThirdParty";e[e.CreateModeLocalThirdParty=3]="CreateModeLocalThirdParty"}(fe||(fe={})),function(e){e[e.ACCOUNT_QUOTA_ZERO=1]="ACCOUNT_QUOTA_ZERO";e[e.MOBILE_LIMIT_EXCEEDED=2]="MOBILE_LIMIT_EXCEEDED"}(Se||(Se={})),function(e){e[e.Terminate=1]="Terminate"}(Re||(Re={})),function(e){e[e.CANCEL=1]="CANCEL"}(Pe||(Pe={})),function(e){e[e.Success=1]="Success";e[e.Failed=2]="Failed";e[e.Timeout=3]="Timeout"}(Ae||(Ae={})),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"}(Ue||(Ue={})),function(e){e[e.Unset=0]="Unset";e[e.Disabled=1]="Disabled";e[e.Enabled=2]="Enabled"}(Le||(Le={})),function(e){e[e.PENDING=0]="PENDING";e[e.APPROVED=1]="APPROVED";e[e.REJECTED=2]="REJECTED"}(Ie||(Ie={})),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"}(Ce||(Ce={})),function(e){e[e.LOCAL_STORAGE=1]="LOCAL_STORAGE";e[e.CLOUD_STORAGE=2]="CLOUD_STORAGE"}(Oe||(Oe={})),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"}(ve||(ve={})),function(e){e[e.MOBILE=1]="MOBILE";e[e.COMPUTER=2]="COMPUTER"}(ye||(ye={})),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";e[e.SUSPENDED=13]="SUSPENDED"}(Be||(Be={})),function(e){e[e.AGENT=0]="AGENT";e[e.DEPLOY_TARGET=1]="DEPLOY_TARGET"}(be||(be={})),function(e){e[e.HEALTHY=1]="HEALTHY";e[e.WARNING=2]="WARNING";e[e.CRITICAL=3]="CRITICAL"}(ze||(ze={})),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"}(qe||(qe={})),function(e){e[e.Send=1]="Send";e[e.Received=2]="Received";e[e.Spam=3]="Spam"}(De||(De={})),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"}(ke||(ke={})),function(e){e[e.Normal=0]="Normal";e[e.Sending=1]="Sending";e[e.Failed=2]="Failed"}(Ne||(Ne={})),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"}(Ge||(Ge={})),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";e[e.FILE_TAG_ALL=4]="FILE_TAG_ALL"}(Fe||(Fe={})),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"}(je||(je={})),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"}(xe||(xe={})),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"}(Me||(Me={})),function(e){e[e.Chat=1]="Chat";e[e.ApiTemplate=2]="ApiTemplate"}(He||(He={})),function(e){e[e.Add=1]="Add";e[e.Remove=2]="Remove"}(We||(We={})),function(e){e[e.User=1]="User";e[e.Agent=2]="Agent";e[e.Project=3]="Project"}(Ve||(Ve={})),function(e){e[e.Grant=1]="Grant";e[e.Revoke=2]="Revoke";e[e.UpdateScope=3]="UpdateScope"}(Ye||(Ye={})),function(e){e[e.Single=1]="Single";e[e.Desktop=2]="Desktop";e[e.All=3]="All"}($e||($e={})),function(e){e[e.Session=1]="Session";e[e.Agent=2]="Agent"}(Je||(Je={})),function(e){e[e.Approve=1]="Approve";e[e.Reject=2]="Reject";e[e.Ignore=3]="Ignore"}(Ze||(Ze={})),function(e){e[e.PDF=1]="PDF";e[e.PPT=2]="PPT";e[e.ImageEditablePpt=3]="ImageEditablePpt"}(Ke||(Ke={})),function(e){e[e.PDF=1]="PDF";e[e.DOCX=2]="DOCX"}(Xe||(Xe={})),function(e){e[e.POSITION=0]="POSITION";e[e.ELEMENT=1]="ELEMENT"}(Qe||(Qe={})),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"}(et||(et={})),function(e){e[e.ACCOUNT_QUOTA_ZERO=1]="ACCOUNT_QUOTA_ZERO";e[e.RESOURCE_LIMIT_EXCEEDED=2]="RESOURCE_LIMIT_EXCEEDED"}(tt||(tt={})),function(e){e[e.MOBILE=1]="MOBILE";e[e.COMPUTER=2]="COMPUTER"}(st||(st={})),function(e){e[e.Delete=1]="Delete";e[e.Read=2]="Read";e[e.ClearAt=3]="ClearAt";e[e.Hide=4]="Hide"}(it||(it={})),function(e){e[e.Delete=0]="Delete";e[e.Running=1]="Running";e[e.Idle=2]="Idle";e[e.Ban=3]="Ban"}(at||(at={})),function(e){e[e.Pin=1]="Pin";e[e.Unpin=2]="Unpin";e[e.Delete=3]="Delete"}(rt||(rt={})),function(e){e[e.Running=1]="Running";e[e.Idle=2]="Idle"}(nt||(nt={})),function(e){e[e.Valid=1]="Valid";e[e.Delete=2]="Delete"}(ot||(ot={}));class lt{__init(){this.request=a.request}__init2(){this.baseURL=""}constructor(e){lt.prototype.__init.call(this),lt.prototype.__init2.call(this),this.request=ct([e,"optionalAccess",e=>e.request])||this.request,this.baseURL=ct([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,quick_reply:s.quick_reply};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,keyword:s.keyword};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,purpose:s.purpose};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,pat_token:s.pat_token,product_id:s.product_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,pat_token:s.pat_token};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,support_economy_mode:s.support_economy_mode};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,purpose:s.purpose,mode:s.mode};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,include_inaccessible_models:s.include_inaccessible_models};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,set_auto_fallback:s.set_auto_fallback};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,purpose:s.purpose,mode:s.mode};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,deploy_types_enum:s.deploy_types_enum};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)}UpgradeBridge(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/upgrade_bridge"),a={agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}ListRecentInvitees(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/list_recent"),a={project_id:s.project_id,limit:s.limit,offset:s.offset};return this.request({url:i,method:"POST",data:a},t)}GetSkillEnvs(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/skill/get_skill_envs"),a={agent_id:s.agent_id,skill_id:s.skill_id};return this.request({url:i,method:"POST",data:a},t)}GetAgentPermissionMode(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/get_permission_mode"),a={agent_id:s.agent_id,session_id:s.session_id,is_project_session:s.is_project_session};return this.request({url:i,method:"POST",data:a},t)}MGetAgentPermissionMode(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/mget_permission_mode"),a={session_id:s.session_id,agent_ids:s.agent_ids,is_project_session:s.is_project_session};return this.request({url:i,method:"POST",data:a},t)}SetAgentPermissionMode(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/set_permission_mode"),a={agent_id:s.agent_id,session_id:s.session_id,permission_mode:s.permission_mode,is_project_session:s.is_project_session};return this.request({url:i,method:"POST",data:a},t)}DeleteAgent(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/delete"),a={agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}UpdateMessageReaction(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/reaction/update"),a={message_id:s.message_id,name:s.name,action:s.action};return this.request({url:i,method:"POST",data:a},t)}GetMessageReactionConfig(e,t){const s=this.genBaseURL("/api/coze_claw/message/reaction_config");return this.request({url:s,method:"POST"},t)}UpgradeGuide(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/upgrade_guide"),a={agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}GetPcClientUsageStatus(e,t){const s=this.genBaseURL("/api/coze_claw/user/pc_client_usage_status");return this.request({url:s,method:"POST"},t)}ListJoinApplies(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_join/list_apply"),a={project_id:s.project_id,limit:s.limit,offset:s.offset,status:s.status};return this.request({url:i,method:"POST",data:a},t)}ApplyJoinProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_join/apply"),a={token:s.token};return this.request({url:i,method:"POST",data:a},t)}HandleJoinApply(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_join/handle_apply"),a={action:s.action,project_id:s.project_id,apply_id:s.apply_id};return this.request({url:i,method:"POST",data:a},t)}GetJoinLanding(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_join/landing"),a={token:s.token};return this.request({url:i,method:"GET",params:a},t)}GenProjectJoinLink(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_join/gen_join_link"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}AtAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/at"),a={project_id:s.project_id,source_claw_id:s.source_claw_id,targets:s.targets,reply_to_message_id:s.reply_to_message_id,mode:s.mode,response_message:s.response_message};return this.request({url:i,method:"POST",data:a},t)}}const dt=new lt({});function _t(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 ut=Ke.PPT,pt=Ke.ImageEditablePpt,ht=e=>e.replace(/\s+/g," ").trim(),mt=e=>ht(e.replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")),gt=e=>{const t=e.match(/<title[^>]*>([\s\S]*?)<\/title>/i),s=_t([t,"optionalAccess",e=>e[1]])?mt(t[1]):"";if(s)return s;const i=mt(e);return i?i.split(" ")[0]:void 0},Et=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 _t([t,"optionalAccess",e=>e.length])?t.map((e=>e.trim())).filter(Boolean):[e.trim()].filter(Boolean)})(e).map(((e,t)=>({page:t+1,title:gt(e),previewText:mt(e)})));return{type:"html",pageCount:t.length,pages:t}},wt=(e,t)=>{if(!(t.length>=80||void 0===e))if("string"!=typeof e)Array.isArray(e)?e.forEach((e=>wt(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)&&wt(s,t)}));else{const s=ht(e);s&&t.push(s)}},Tt=({api:e})=>async({fileUri:t,exportType:s="ppt"})=>{const i=await e.exportPPT({source_uri:t,export_type:"editable"===s?pt:ut});if(void 0!==i.code&&0!==i.code&&"0"!==i.code)throw new J(i.msg||"Failed to export PPT","SESSION_PPT_EXPORT_FAILED");const a=_t([i,"access",e=>e.data,"optionalAccess",e=>e.url]);if(!a)throw new J(i.msg||"PPT export response missing download URL","SESSION_PPT_EXPORT_FAILED");return{uri:_t([i,"access",e=>e.data,"optionalAccess",e=>e.uri]),url:a,exportType:s}};function ft(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 St=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=ft([i,"optionalAccess",e=>e.message_data,"optionalAccess",e=>e.reply]),o=void 0===ft([i,"optionalAccess",e=>e.create_time_ms])?void 0:String(i.create_time_ms);return{messageId:t,sessionId:"string"==typeof ft([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 ft([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 ft([i,"optionalAccess",e=>e.message_type])?i.message_type:void 0,replyToMessageId:"string"==typeof ft([n,"optionalAccess",e=>e.reply_to_message_id])?n.reply_to_message_id:void 0,raw:e};var c};const Rt=({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 J(s.msg||"Failed to resolve session file URL","SESSION_FILE_URL_FAILED");return i};const Pt=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([new Uint8Array(e)]);if(e instanceof Uint8Array)return new Blob([new Uint8Array(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)},At=({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(B(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}/`:B(e))({baseUrl:e.baseUrl,webOrigin:e.webOrigin}),e.xSpaceWebId&&(s["x-space-webid"]=e.xSpaceWebId),Object.assign(s,k(e.xTTEnv)),s},Ut=e=>async(t,s={})=>{const i=new URL("/api/coze_claw/file/upload",B(e.baseUrl)),r=new FormData;await Pt({formData:r,request:t});const n=At({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 z(c,{});return q(c,l,{serviceName:"Session"}),l};const Lt=async({baseUrl:e,params:t,requestOptions:s={},responseFallback:i,xTTEnv:r})=>{const n=new URL(t.url,B(e));b(n,t.params);const o={"Content-Type":"application/json",...(c=s.headers,l=()=>({}),null!=c?c:l()),...k(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(D(u)||"")]);const p=await z(u,i);return q(u,p,{serviceName:"Session"}),p},It=e=>{const t=async(t,s={})=>await Lt({baseUrl:e.baseUrl,params:t,requestOptions:s,responseFallback:{},xTTEnv:e.xTTEnv}),s=new lt({baseURL:B(e.baseUrl),request:(e,s={})=>t(e,s)}),i=new lt({baseURL:B(e.baseUrl),request:(e,s={})=>t(e,s)});return{getUserClawInfo:(t,s)=>Lt({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:Ut(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)}},Ct=e=>{const t=It({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)}},Ot=()=>({async get(){const e=await O();return{sessionId:e.sessionId,sessionClawId:e.sessionClawId}},async save(e){await v(e)}});function vt(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 yt=[".report.html",".podcast.html",".webdoc.html",".socmed.html",".pptx.html",".poster.html",".resume.html",".chart.html"],Bt=({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")&&!yt.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`},bt=async({files:e,clawId:t,webOrigin:s,api:i})=>e&&0!==e.length?await Promise.all(e.map((async(e,a)=>{const r=Bt({file:e,fileIndex:a,clawId:t,webOrigin:s});return{...e,preview_url:await x({url:r,api:i})}}))):[],zt=async({files:e,clawId:t,apiBaseUrl:s,sessionApiBaseUrl:i,xTTEnv:a,service:r,deps:n})=>{if(!e||0===e.length)return e;const o=vt([n,"optionalAccess",e=>e.store])||Ot(),{sessionClawId:c}=await o.get(),l=t||c||(await r.getStatus()).clawId,d=(vt([n,"optionalAccess",e=>e.createApi])||It)({baseUrl:i||s,xTTEnv:a}),_=vt([n,"optionalAccess",e=>e.resolveFiles])||bt;return await _({files:e,clawId:l,webOrigin:i||s,api:{getWebUrl:e=>d.getWebUrl(e)}})},qt=e=>"running"!==e,Dt=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 kt=l.join(p(),"tasks","session-progress-tasks.json");class Nt extends Error{constructor(e){super(e),this.name="SessionTaskStoreError"}}class Gt extends Error{constructor(e){super(`Session task expired: ${e}`),this.taskId=e,this.name="SessionTaskExpiredError"}}class Ft extends Error{constructor(e){super(`Session task not found: ${e}`),this.taskId=e,this.name="SessionTaskNotFoundError"}}const jt=(e,t)=>Object.entries(t).reduce(((e,[t,s])=>void 0===s?e:{...e,[t]:s}),{...e}),xt=e=>{const t=a.safeJsonParse(e,void 0);if(void 0===t)throw new Nt("Failed to parse session task store");if(s=t,!Boolean(s)||"object"!=typeof s||Array.isArray(s)||!Array.isArray(t.items))throw new Nt("Failed to parse session task store");var s;return{version:1,items:t.items}},Mt=({filePath:e=kt,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 xt(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 Nt)throw e;throw new Nt(`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(!qt(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 Ft(i);if(!s&&e(a))throw new Gt(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=jt(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 Ft(e);const[r]=s.items.slice(i,i+1),n=jt(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}},Ht=({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 H({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}):H({accountId:a,authConfigured:!0})}catch(e){return H({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:Z,getStatus:n,getStoredConfig:async()=>t.get()}),c=V({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=(ft([n,"access",e=>e.data,"optionalAccess",e=>e.messages])||[]).map((e=>St(e))).filter((e=>null!==e)),c=ft([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 J(e,"SESSION_MESSAGE_LIST_FAILED")});return{getStatus:n,createSession:X({api:e,resolveClawId:o}),listSessions:Q({api:e,resolveClawId:o}),listMessages:l,listRepliesByMessage:d,sendMessage:ee({api:e,updateSessionRuntimeStatus:r}),listProgresses:c,getProgress:Y(c),getSessionDisplayStatus:$({listProgresses:c,runtimeStatusStore:a}),resolveFileUrl:Rt({api:e}),exportPpt:Tt({api:e}),shortenWebUrl:M({api:e}),updateSessionRuntimeStatus:r}},Wt=e=>{const t=Ot();return Ht({api:Ct(e),store:t,authConfigured:()=>Boolean(e.accessToken),fallbackAccountId:e.organizationId})};function Vt(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 Yt=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},$t=e=>{if(!e)return;const t=e.trim();return t?t.length>200?`${t.slice(0,197)}...`:t:void 0},Jt=({apiBaseUrl:e,now:t=Date.now,resolveReplyFiles:s,service:i,sessionApiBaseUrl:a,store:r=Mt(),xTTEnv:n})=>({async createOrUpdateTaskFromMessageWait({answerMessageId:e,content:s,files:i,messageId:a,progress:n,sessionId:o}){const c=t(),l=s,d=Yt(l),_="running"!==n.progressStatus,u=_?$t(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:Dt(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(qt(l.status))return l;try{const c=await i.getProgress({progressId:l.progressId}),d=t();if(c)return await r.patch(o,{contentPreview:Yt(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=zt,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:$t(o.content)}})({apiBaseUrl:e,resolveReplyFiles:s,service:i,sessionApiBaseUrl:a,task:l,xTTEnv:n});return await r.patch(o,{answerMessageId:Vt([_,"optionalAccess",e=>e.answerMessageId]),artifacts:Vt([_,"optionalAccess",e=>e.files])?Dt(_.files):void 0,contentPreview:Yt(Vt([_,"optionalAccess",e=>e.replyContent])),finishedAt:d,lastProgressStatus:"finished",lastRefreshError:void 0,replyContent:Vt([_,"optionalAccess",e=>e.replyContent]),resultSummary:Vt([_,"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 Zt(e,t){return null!=e?e:t()}const Kt=({elapsedMs:e})=>e>=3e5?3e4:1e4;exports.Claw=dt,exports.DEFAULT_CONFIG=f,exports.SessionServiceError=J,exports.SessionTaskExpiredError=Gt,exports.SessionTaskNotFoundError=Ft,exports.SessionTaskStoreError=Nt,exports.appendSearchParams=b,exports.buildPatchByPath=function(e,t){const s=e.split("."),i={};let a=i;return s.forEach(((e,i)=>{if(i===s.length-1)a[e]=t;else{const t={};a[e]=t,a=t}})),i},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 J("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=Wt,exports.createSessionApiClient=It,exports.createSessionConfigStore=Ot,exports.createSessionTaskService=Jt,exports.createSessionUploadFile=Ut,exports.deleteConfig=async function(e){const t=process.env.COZE_CONFIG_FILE;if(t){const s=await L(t);if(s&&void 0!==R(s,e)){A(s,e);try{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=T,i=await L(s);if(i&&void 0!==R(i,e)||(s=E,i=await I()),i&&void 0!==R(i,e)){A(i,e);try{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 J(`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 J(`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 J(`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=N,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=k,exports.getServiceResponseLogId=D,exports.installScopedCozeAccountFetchHeader=j,exports.isInternalConfigPath=g,exports.isSessionTaskTerminal=qt,exports.listConfigs=async function(){const e=process.env.COZE_CONFIG_FILE,[t,s,i]=await Promise.all([I(),L(T),e?L(e):void 0]),a=[{name:"env",flat:U(C())},{name:"env-file",flat:U(i)},{name:"local",flat:U(s)},{name:"global",flat:U(t)},{name:"default",flat:U(f)}],r=new Set;for(const{flat:e}of a)Object.keys(e).forEach((e=>r.add(e)));const n=[];for(const e of Array.from(r)){if(g(e))continue;let t,s="default";for(const{name:i,flat:r}of a)if(e in r&&void 0!==r[e]){t="env"===i?r[e]:String(r[e]),s=i;break}n.push({key:e,value:t,source:s})}return n},exports.loadConfig=O,exports.normalizeBaseUrl=B,exports.parseServiceResponseBody=z,exports.parseSessionPptContent=e=>{const t=e.trim(),s=(e=>{const t=a.safeJsonParse(e,null),s=Array.isArray(_t([t,"optionalAccess",e=>e.pages]))?t.pages:Array.isArray(_t([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=[];wt(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:ht(s.join(" "))||(i?`preview_url: ${i}`:"")}}))}:null})(t);return s||(/<html[\s>]/i.test(t)||t.includes("\x3c!--SPLIT_HTML--\x3e")?Et(t):{type:"unknown",pageCount:0,pages:[]})},exports.resolveStoredSessionReplyFiles=zt,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=Jt({apiBaseUrl:t.apiBaseUrl,service:Wt({accessToken:t.accessToken,apiBaseUrl:t.apiBaseUrl,organizationId:t.organizationId,sessionApiBaseUrl:Zt(t.sessionApiBaseUrl,(()=>"")),xTTEnv:t.xTTEnv}),sessionApiBaseUrl:t.sessionApiBaseUrl,store:Mt(),xTTEnv:t.xTTEnv})})=>{const n=new i.EnvHttpProxyAgent;a.customFetch.setDispatcher(n),a.customFetch.setHeaders({Authorization:`Bearer ${t.accessToken}`}),j({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(qt(i.status))return;c=Kt({elapsedMs:e()-o})}}finally{await r.patchTask(t.taskId,{workerPid:void 0})}})({payload:s})},exports.saveConfig=v,exports.shouldInjectCozeAccountHeader=G,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.3.5
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Coze CLI - A command-line interface for Coze platform",
|
|
6
6
|
"license": "MIT",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"@coze-coding/lambda": "workspace:*",
|
|
69
69
|
"@emnapi/runtime": "^1.11.1",
|
|
70
70
|
"@rollup/plugin-commonjs": "^28.0.2",
|
|
71
|
-
"@rollup/plugin-json": "~6.
|
|
71
|
+
"@rollup/plugin-json": "~6.1.0",
|
|
72
72
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
73
|
-
"@rollup/plugin-replace": "^6.0.
|
|
73
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
74
74
|
"@rollup/plugin-sucrase": "^5.1.0",
|
|
75
75
|
"@rollup/plugin-terser": "^0.4.4",
|
|
76
76
|
"@types/lodash": "^4.17.24",
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coze-agent-collaboration
|
|
3
|
+
version: 0.3.5
|
|
4
|
+
description: "CRITICAL Coze project Agent collaboration protocol: use `coze agent at --mode request` to delegate to peer Agents and `coze agent at --mode response` to return a result for an inbound Agent-targeted request. A visible @mention never dispatches or responds. Also use this skill to discover Agent members, consume collaboration responses without creating a loop, or retry an unchanged call after an unknown transport outcome."
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["coze"]
|
|
8
|
+
cliHelp: "coze agent at --help"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Coze Agent Collaboration
|
|
12
|
+
|
|
13
|
+
Use `coze agent at` for both halves of project-group Agent collaboration:
|
|
14
|
+
|
|
15
|
+
- `--mode request` delegates work to one or more peer Agents.
|
|
16
|
+
- `--mode response` returns completed work for the current inbound Agent request.
|
|
17
|
+
|
|
18
|
+
An `at://agent:<claw_id>` link or visible `@name` mention only controls display; it neither dispatches nor responds. Never report delivery unless `coze agent at` returned an accepted response.
|
|
19
|
+
|
|
20
|
+
Treat the command as asynchronous dispatch: an accepted response means delivery was queued, not that the delegated work has finished.
|
|
21
|
+
|
|
22
|
+
## Preconditions
|
|
23
|
+
|
|
24
|
+
- Run only inside a current Coze project Agent turn.
|
|
25
|
+
- Obtain `account_id`, `group_id`, `agent_id`, and `reply_to_message_id` from the trusted current-turn context. Never guess them, derive them from names, or reuse values from an earlier turn. In response mode, `reply_to_message_id` must be the message ID of the current inbound AtAgent request.
|
|
26
|
+
- Map context fields exactly: non-zero `account_id` -> global `--org-id`, `group_id` -> `--project-id`, `agent_id` -> `--source-claw-id`, and `reply_to_message_id` -> `--reply-to-message-id`. Omit `--org-id` only when `account_id` is `0` for a personal account.
|
|
27
|
+
- Keep `account_id`, `group_id`, `agent_id`, and every `target_claw_id` as decimal strings. Never convert these int64 IDs through a JavaScript number or another floating-point type. Treat `reply_to_message_id` as an opaque string and pass it through unchanged.
|
|
28
|
+
- Keep `reply_to_message_id` within 256 UTF-8 bytes, each target message within 4,000 Unicode code points, and all target messages together within 32 KiB.
|
|
29
|
+
- Check authentication with `coze auth status --format json` when the CLI reports an authentication error.
|
|
30
|
+
- Do not apply Coze App version checks. CLI availability is independent of the App UI version gate.
|
|
31
|
+
|
|
32
|
+
## Choose the mode
|
|
33
|
+
|
|
34
|
+
- Initiating new delegated work: use `request`.
|
|
35
|
+
- Completing an inbound `mode=request` whose `response_target_type=agent`: use `response` exactly once after the work is complete.
|
|
36
|
+
- Receiving `mode=response`: consume the result and continue synthesis for the user. Do **not** call `coze agent at` again; that would create a collaboration loop.
|
|
37
|
+
- Handling an inbound request whose `response_target_type=user`: reply normally to the user. Do not call response mode.
|
|
38
|
+
|
|
39
|
+
## Request workflow
|
|
40
|
+
|
|
41
|
+
1. Refresh current project members before each dispatch:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
coze --org-id "<account_id>" agent member list --project-id "<group_id>" --format json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Select only members with `user_type=2` and a non-empty `claw_id`. Exclude the current `agent_id` (the `source_claw_id`). Delegate to at most three Agents per request.
|
|
48
|
+
3. Give every target a concrete, self-contained task. Do not forward secrets or unrelated conversation text.
|
|
49
|
+
4. Call `coze agent at --mode request` with the exact current-turn identifiers and a JSON array:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
coze --org-id "<account_id>" agent at \
|
|
53
|
+
--mode request \
|
|
54
|
+
--project-id "<group_id>" \
|
|
55
|
+
--source-claw-id "<agent_id>" \
|
|
56
|
+
--reply-to-message-id "<reply_to_message_id>" \
|
|
57
|
+
--targets '[{"target_claw_id":"<target_claw_id>","message":"Review the API contract and return concrete issues.","response_target_type":"agent"}]' \
|
|
58
|
+
--format json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
5. Require `code=0`, `data.status="accepted"`, and a non-empty `data.message_id` before treating dispatch as accepted. An `at://agent:<claw_id>` mention without this command result is not a dispatch. Preserve `logid` for diagnostics.
|
|
62
|
+
6. Continue according to `response_target_type`:
|
|
63
|
+
- `agent` (default): the target reports back in a later collaboration turn. Do not block or poll after `accepted`, and do not dispatch a duplicate; incorporate the later response before final synthesis when the task depends on it.
|
|
64
|
+
- `user`: the target delivers directly to the user; use only when direct independent delivery was explicitly intended.
|
|
65
|
+
|
|
66
|
+
## Response workflow
|
|
67
|
+
|
|
68
|
+
1. Confirm the current turn is an inbound AtAgent `mode=request` with `response_target_type=agent`. Never use response mode for a normal user message or an inbound `mode=response`.
|
|
69
|
+
2. Complete the requested work, then call response mode without `--targets`:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
coze --org-id "<account_id>" agent at \
|
|
73
|
+
--mode response \
|
|
74
|
+
--project-id "<group_id>" \
|
|
75
|
+
--source-claw-id "<agent_id>" \
|
|
76
|
+
--reply-to-message-id "<current_at_agent_request_message_id>" \
|
|
77
|
+
--response-message "<completed result for the requesting Agent>" \
|
|
78
|
+
--format json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Require `code=0`, `data.status="accepted"`, and a non-empty `data.message_id`. After acceptance, do not send a second request or a visible `@source` message as an acknowledgement.
|
|
82
|
+
|
|
83
|
+
## Safety and retry rules
|
|
84
|
+
|
|
85
|
+
- Never target the source Agent itself.
|
|
86
|
+
- Always pass explicit `--mode request` or `--mode response`.
|
|
87
|
+
- Request mode requires `--targets` and forbids `--response-message`; response mode requires `--response-message` and forbids `--targets`.
|
|
88
|
+
- Do not invent an `idempotency_key`; the service derives idempotency from trusted request context.
|
|
89
|
+
- On a transport timeout with no response, retry the exact same request. Keep identifiers, target order, messages, and response targets unchanged.
|
|
90
|
+
- Do not retry validation, permission, or membership errors until the underlying input or authorization is corrected.
|
|
91
|
+
- Do not report delegated work as complete from the `accepted` response alone.
|
|
92
|
+
- Prefer one focused request containing all independent targets over several duplicate calls.
|
|
93
|
+
|
|
94
|
+
Read [references/at-agent-contract.md](references/at-agent-contract.md) for the full input/output contract and failure handling.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# `coze agent at` contract
|
|
2
|
+
|
|
3
|
+
## Command input
|
|
4
|
+
|
|
5
|
+
| Option | Required | Meaning |
|
|
6
|
+
|---|---:|---|
|
|
7
|
+
| `--org-id` | for organization accounts | Global option populated from the current context's non-zero `account_id`; it becomes the `x-coze-account` request header. Omit it only when `account_id` is `0` for a personal account. |
|
|
8
|
+
| `--mode` | yes | `request` to delegate new work; `response` to complete the current inbound Agent-targeted request. |
|
|
9
|
+
| `--project-id` | yes | Current context's `group_id`, passed as a decimal string. |
|
|
10
|
+
| `--source-claw-id` | yes | Current context's `agent_id` (the calling Agent's `claw_id`), passed as a decimal string. |
|
|
11
|
+
| `--reply-to-message-id` | yes | Current context's `reply_to_message_id`. In response mode it must identify the current inbound AtAgent request message. It must be 1 to 256 UTF-8 bytes. |
|
|
12
|
+
| `--targets` | request only | JSON array with 1 to 3 target objects. Forbidden in response mode. |
|
|
13
|
+
| `--response-message` | response only | Non-empty completed result for the requesting Agent. Forbidden in request mode. |
|
|
14
|
+
|
|
15
|
+
Each target object has:
|
|
16
|
+
|
|
17
|
+
| Field | Required | Meaning |
|
|
18
|
+
|---|---:|---|
|
|
19
|
+
| `target_claw_id` | yes | Target project Agent's `claw_id`, encoded as a string. |
|
|
20
|
+
| `message` | yes | Non-empty delegated task, at most 4,000 Unicode code points. All target messages together must be at most 32 KiB in UTF-8. |
|
|
21
|
+
| `response_target_type` | no | `agent` (default) or `user`. |
|
|
22
|
+
|
|
23
|
+
Example with parallel targets:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
coze --org-id "7491196930349875252" agent at \
|
|
27
|
+
--mode request \
|
|
28
|
+
--project-id "7600000000000000001" \
|
|
29
|
+
--source-claw-id "7600000000000000002" \
|
|
30
|
+
--reply-to-message-id "msg_current_turn" \
|
|
31
|
+
--targets '[{"target_claw_id":"7600000000000000003","message":"Audit the API for security risks.","response_target_type":"agent"},{"target_claw_id":"7600000000000000004","message":"Check the user-facing copy and report edits.","response_target_type":"agent"}]' \
|
|
32
|
+
--format json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Response example:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
coze --org-id "7491196930349875252" agent at \
|
|
39
|
+
--mode response \
|
|
40
|
+
--project-id "7600000000000000001" \
|
|
41
|
+
--source-claw-id "7600000000000000003" \
|
|
42
|
+
--reply-to-message-id "at_agent_request_message_id" \
|
|
43
|
+
--response-message "Audit complete: no blocking security risks were found." \
|
|
44
|
+
--format json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The response target is derived by the service from the referenced request. Never pass `--targets` in response mode.
|
|
48
|
+
|
|
49
|
+
## Success output
|
|
50
|
+
|
|
51
|
+
The command emits one JSON envelope:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"code": 0,
|
|
56
|
+
"msg": "success",
|
|
57
|
+
"data": {
|
|
58
|
+
"message_id": "generated_dispatch_message_id",
|
|
59
|
+
"status": "accepted",
|
|
60
|
+
"idempotency_replayed": false
|
|
61
|
+
},
|
|
62
|
+
"logid": "request_log_id"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- `message_id` identifies the visible project collaboration message.
|
|
67
|
+
- `status=accepted` means asynchronous dispatch was accepted.
|
|
68
|
+
- `idempotency_replayed=true` means the same logical request was already accepted; do not send a new variant merely to force another execution.
|
|
69
|
+
- `logid` is the primary diagnostic key.
|
|
70
|
+
|
|
71
|
+
## Failure handling
|
|
72
|
+
|
|
73
|
+
| Failure | Action |
|
|
74
|
+
|---|---|
|
|
75
|
+
| Invalid JSON or malformed target | Fix locally; do not call again unchanged. |
|
|
76
|
+
| Target is not an Agent project member | Refresh `coze agent member list`; choose an active Agent member. |
|
|
77
|
+
| Target equals source | Choose a different Agent. |
|
|
78
|
+
| Permission/authentication failure | Refresh authentication or trusted runtime context; do not broaden credentials. |
|
|
79
|
+
| Transport timeout, response unknown | Retry the byte-equivalent logical request. |
|
|
80
|
+
| Service error with a `logid` | Preserve the full JSON envelope and diagnose using the `logid`. |
|
|
81
|
+
|
|
82
|
+
## Context discipline
|
|
83
|
+
|
|
84
|
+
Map trusted current-turn context fields exactly: non-zero `account_id` -> global `--org-id`, `group_id` -> `--project-id`, `agent_id` -> `--source-claw-id`, and `reply_to_message_id` -> `--reply-to-message-id`. Use the same organization context for member discovery and dispatch. Omit `--org-id` only when `account_id` is `0` for a personal account.
|
|
85
|
+
|
|
86
|
+
`reply_to_message_id` is an opaque identifier and must refer to the message currently being processed. In request mode this is the current triggering message. In response mode this is the current inbound AtAgent request message ID. Pass it through unchanged. It is not an unrelated dispatch result, a previous turn's message, a session ID, or a generated random value.
|
|
87
|
+
|
|
88
|
+
Rendering an `at://agent:<claw_id>` link or a visible `@name` mention does not call this contract. A real request or response requires executing `coze agent at` in the corresponding mode and receiving `code=0`, `data.status="accepted"`, and a non-empty `data.message_id`.
|
|
89
|
+
|
|
90
|
+
An inbound `mode=response` is already the peer Agent's result. Consume it and synthesize; never answer it with another AtAgent response.
|
package/skills/manifest.json
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cliVersion": "0.3.5
|
|
2
|
+
"cliVersion": "0.3.5",
|
|
3
3
|
"skills": {
|
|
4
|
+
"coze-agent-collaboration": {
|
|
5
|
+
"path": "coze-agent-collaboration/SKILL.md",
|
|
6
|
+
"hash": "sha256:887131fa6e098c1d47c40acf33722fe26271d59255ecec1b677f578bc46830c0"
|
|
7
|
+
},
|
|
4
8
|
"using-coze-cli": {
|
|
5
9
|
"path": "using-coze-cli/SKILL.md",
|
|
6
|
-
"hash": "sha256:
|
|
10
|
+
"hash": "sha256:8463b600e35a3e5c9e5414601f8e5e836797134d9967bb2b7595bfc9d26b731a"
|
|
7
11
|
},
|
|
8
12
|
"coze-claw": {
|
|
9
13
|
"path": "using-coze-cli/coze-claw/MODULE.md",
|
|
10
|
-
"hash": "sha256:
|
|
14
|
+
"hash": "sha256:071e643e840e90e257f3a65f9bcb6c39e8e4f74022511a637383175810681c80"
|
|
11
15
|
},
|
|
12
16
|
"coze-code": {
|
|
13
17
|
"path": "using-coze-cli/coze-code/MODULE.md",
|
|
14
|
-
"hash": "sha256:
|
|
18
|
+
"hash": "sha256:c433349f1e561703268d0f508a4682f80c78ac83855d4285b8c7d8727e70488b"
|
|
15
19
|
},
|
|
16
20
|
"coze-file": {
|
|
17
21
|
"path": "using-coze-cli/coze-file/MODULE.md",
|
|
18
|
-
"hash": "sha256:
|
|
22
|
+
"hash": "sha256:b55b46b45fc28e77c5e32cc430d6952d9467d6b0930c8c68f0017afc40393113"
|
|
19
23
|
},
|
|
20
24
|
"coze-generate": {
|
|
21
25
|
"path": "using-coze-cli/coze-generate/MODULE.md",
|
|
22
|
-
"hash": "sha256:
|
|
26
|
+
"hash": "sha256:e8fb588c9b3bdfe62e18a7609d3e75451dd16c0e9d08bdf85fd018035be6d88f"
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: using-coze-cli
|
|
3
|
-
version: 0.3.5
|
|
3
|
+
version: 0.3.5
|
|
4
4
|
description: "【核心触发·软件开发】当用户意图是开发、修改、调试、运行或迭代软件产品时,加载本技能并通过 coze code 调起;典型场景:创建或迭代网页、Web App、App、小程序等可运行、可维护、可迭代的工程项目。判定边界:仅当用户明确想做可维护、可迭代的产品/工程项目时才导流到扣子编程;不要因请求中出现 CLI、文件读写、HTML、可视化、卡片、报告、图片等词就导流。其它子模块(满足任一即触发,无需显式点名 coze):coze code 还覆盖 Agent/工作流/skill 及发需求、预览、部署、环境变量/域名/数据库;coze generate—文生图/语音 TTS/视频;coze session(Claw)—对话、PPT、播客、长任务产物;coze file—本地文件转在线链接;输入以 /coze-cli、/coze 开头(仅作路由)。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
@@ -358,7 +358,7 @@ fi
|
|
|
358
358
|
|
|
359
359
|
- `COZE_ORG_ID`、`COZE_SPACE_ID` 环境变量可临时覆盖配置,无需修改持久化配置。
|
|
360
360
|
- `--org-id`、`--space-id` 全局参数也可以临时覆盖。
|
|
361
|
-
- **项目访问链接的域名由项目类型决定**:`web` / `app` / `miniprogram` / `skill`(coze 3.0 项目)使用 `www.coze.cn`,其它类型(agent / workflow / assistant 等)使用 `code.coze.cn`。各命令输出的 URL(如 `project_url`、部署/预览链接)已由 CLI 据此生成,直接透传即可。
|
|
361
|
+
- **项目访问链接的域名由项目类型决定**:`web` / `app` / `miniprogram` / `skill` / `general`(coze 3.0 项目)使用 `www.coze.cn`,其它类型(agent / workflow / assistant 等)使用 `code.coze.cn`。各命令输出的 URL(如 `project_url`、部署/预览链接)已由 CLI 据此生成,直接透传即可。
|
|
362
362
|
- `COZE_CLI_PLATFORM` 环境变量仅在**无法获知项目类型**的少数场景作为域名回退依据(取值 `ecs` / `vefaas` 时回退到 `www.coze.cn`,否则 `code.coze.cn`),不再覆盖按类型决定的链接。
|
|
363
363
|
|
|
364
364
|
## 配置管理概要
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: coze-code
|
|
3
|
-
version: 0.3.5
|
|
3
|
+
version: 0.3.5
|
|
4
4
|
description: "Coze Coding 项目开发工作流:创建项目、发送需求消息、查询状态、预览、部署、环境变量管理、域名管理、技能管理、数据库管理。当用户需要创建/管理 Coze 项目、发送开发需求、部署应用、管理数据库、或使用 coze code * 任意命令时触发。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
@@ -68,7 +68,7 @@ coze code project create --message "创建一个聊天机器人" --type web --cr
|
|
|
68
68
|
|
|
69
69
|
- `--message` 和 `--type` 均为**必填参数**(`--message` 无 `-m` 短别名)。
|
|
70
70
|
- **必须带 `--create-source`**:按自身身份如实取值——身份含 `扣子`/`Coze`/`coze` 传 `coze_agent_cli`,其它 agent(如 `Claude Code` / `Cursor`)传 `agent_cli`,不传则记为人工 `cli`。**不要伪报**。(Coze Claw 环境下 CLI 会据 `COZE_CLAW_AGENT_ID` 自动判为 `coze_agent_cli`。)
|
|
71
|
-
- **`--type` 接受**:`agent | workflow | app | skill | web | miniprogram | assistant`(源码 `resolveProjectType` 还兼容 `webapp`)。其中 `web` / `app` 是最常用类型;`assistant`
|
|
71
|
+
- **`--type` 接受**:`agent | workflow | app | skill | web | miniprogram | assistant | general`(源码 `resolveProjectType` 还兼容 `webapp`)。其中 `web` / `app` 是最常用类型;`assistant` 走模板复制创建;`general` 是后端泛化类型(真实形态由 `general_project_tag` 区分),**仅在用户明确要求时使用,正常创建请按形态词选具体类型**(见 Step 1.1)。传入未知类型会报 `E1005`。
|
|
72
72
|
- 其它可选项:`--chat-mode <ask|agent|dangerous_confirm|plan>`、`--model-name`、`--tool-name`(可多次传)、`--design`(`--chat-mode plan` 时自动开启)。
|
|
73
73
|
- `--wait` 选项会等待项目创建完成(包括首次 AI 消息响应)后再返回。
|
|
74
74
|
- 记录返回的 `projectId`。
|
|
@@ -93,6 +93,8 @@ coze code project create --message "创建一个聊天机器人" --type web --cr
|
|
|
93
93
|
| "技能 / skill 插件" | `skill` |
|
|
94
94
|
| "助手 / assistant" | `assistant` |
|
|
95
95
|
|
|
96
|
+
> `general` **不在形态词判定表内**:它是后端泛化类型,用户没有点名时**绝不**用它兜底——没有形态词就反问,见下方判定要点第 3 条。
|
|
97
|
+
|
|
96
98
|
判定要点:
|
|
97
99
|
- **「小程序」是强信号**:只要文本里出现"小程序"三字,一律 `--type miniprogram`,**绝不**因为前面带"抽奖 / 商城 / 聊天"等功能词而归成 `web`。
|
|
98
100
|
- **「App / 应用」**(而非"网页 / 网站 / 页面")一律 `--type app`;仅当用户明确说"Web 应用 / 网页应用"时才用 `web`。
|
|
@@ -112,7 +114,7 @@ coze code project create --message "创建一个聊天机器人" --type web --cr
|
|
|
112
114
|
|
|
113
115
|
项目创建成功后(无论是否 `--wait`),回复用户时**必须**附上「打开项目」入口,链接指向项目对话页面,方便用户直接跳转,省去在项目列表 / 历史会话中二次查找。
|
|
114
116
|
|
|
115
|
-
**链接来源**:`project create` 的 `--format json` 返回值中已含 `project_url` 字段(CLI 按**项目类型**自动生成域名:`web` / `app` / `miniprogram` / `skill` 为 `https://www.coze.cn/p/<project_id>`,其它类型为 `https://code.coze.cn/p/<project_id>`)。**直接读取 `project_url` 透传给用户,不要自行拼接链接。**
|
|
117
|
+
**链接来源**:`project create` 的 `--format json` 返回值中已含 `project_url` 字段(CLI 按**项目类型**自动生成域名:`web` / `app` / `miniprogram` / `skill` / `general` 为 `https://www.coze.cn/p/<project_id>`,其它类型为 `https://code.coze.cn/p/<project_id>`)。**直接读取 `project_url` 透传给用户,不要自行拼接链接。**
|
|
116
118
|
|
|
117
119
|
回复模板(创建成功、AI 仍在后台开发时,`<project_url>` 取自返回值):
|
|
118
120
|
|
|
@@ -233,7 +235,8 @@ coze code preview <project-id>
|
|
|
233
235
|
- 不要被功能词带偏项目类型——`--type` 由**产品形态词**(小程序 / App / 网页 …)决定,不由功能品类词(抽奖 / 商城 / 聊天 …)决定;尤其"X 小程序"一律 `--type miniprogram`、"App / 应用"一律 `--type app`,**绝不**默认 `web`,无形态词时先反问(见 Step 1.1)
|
|
234
236
|
- 不要在 message 仍为 **processing** 时直接部署
|
|
235
237
|
- 不要对 deploy 使用 **`--project-id`**(它是位置参数!)
|
|
236
|
-
- 不要给 project create 的 **`--type`** 传受支持列表(`agent|workflow|app|skill|web|miniprogram|assistant`)以外的值,否则报 `E1005`
|
|
238
|
+
- 不要给 project create 的 **`--type`** 传受支持列表(`agent|workflow|app|skill|web|miniprogram|assistant|general`)以外的值,否则报 `E1005`
|
|
239
|
+
- 不要把 **`general`** 当作"拿不准时的默认值"——它是后端泛化类型,只在用户明确点名时才传,拿不准形态一律先反问
|
|
237
240
|
- 不要在 `project create` 时**漏掉 `--create-source`** 或**伪报来源**——按自身身份如实取值(扣子/Coze 系→`coze_agent_cli`,其它 agent→`agent_cli`),它是来源分类的依据
|
|
238
241
|
- 不要在没有 `--stdin` 时指望管道输入被读取(`message send` 必须显式加 `--stdin` 才读 stdin)
|
|
239
242
|
- 不要忽略 **NDJSON 事件流的逐行解析要求**
|
|
@@ -300,7 +303,7 @@ AI 开发(首次 `project create`、`message send`)属于**分钟级到几
|
|
|
300
303
|
|
|
301
304
|
| 意图 | 推荐命令 | 备注 |
|
|
302
305
|
|------|---------|------|
|
|
303
|
-
| 创建新项目 | `coze code project create` | 必带 `--create-source`(扣子/Coze 系→coze_agent_cli,否则 agent_cli);`--type` 支持 agent/workflow/app/skill/web/miniprogram/assistant(常用 web/app
|
|
306
|
+
| 创建新项目 | `coze code project create` | 必带 `--create-source`(扣子/Coze 系→coze_agent_cli,否则 agent_cli);`--type` 支持 agent/workflow/app/skill/web/miniprogram/assistant/general(常用 web/app;general 仅用户点名时用) |
|
|
304
307
|
| 列出/查看项目 | `coze code project list/get` | 支持按类型/名称筛选 |
|
|
305
308
|
| 删除项目 | `coze code project delete` | 不可逆操作 |
|
|
306
309
|
| 导入项目 | `coze code project import -s <github\|local>` | 导入后自动发后台初始化 query(可用 `message status` 跟进),返回值含 `project_url` |
|
|
@@ -381,7 +384,7 @@ AI 开发(首次 `project create`、`message send`)属于**分钟级到几
|
|
|
381
384
|
|
|
382
385
|
### 错误 4:project create --type 传了不支持的类型
|
|
383
386
|
|
|
384
|
-
- 问题:`--type` 只接受 `agent | workflow | app | skill | web | miniprogram | assistant`(源码另兼容 `webapp`);传入其它字符串会报 `E1005 Unknown project type`。
|
|
387
|
+
- 问题:`--type` 只接受 `agent | workflow | app | skill | web | miniprogram | assistant | general`(源码另兼容 `webapp`);传入其它字符串会报 `E1005 Unknown project type`。
|
|
385
388
|
- 修正:从受支持列表中选择类型;常用 `web` / `app`。
|
|
386
389
|
|
|
387
390
|
### 错误 5:message send 管道输入未加 --stdin
|