@cline/core 0.0.95 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ClineCore.d.ts +6 -1
- package/dist/account/rpc.d.ts +3 -1
- package/dist/cline-core/runtime-services.d.ts +4 -2
- package/dist/cloud/controller.d.ts +5 -2
- package/dist/cloud/hub-client.d.ts +51 -0
- package/dist/cloud/hub-protocol.d.ts +18 -0
- package/dist/cloud/index.d.ts +2 -0
- package/dist/cloud/index.js +16 -16
- package/dist/cloud/types.d.ts +4 -1
- package/dist/extensions/context/compaction-shared.d.ts +1 -0
- package/dist/extensions/context/compaction.d.ts +7 -0
- package/dist/extensions/context/summarize-conversation.d.ts +7 -0
- package/dist/extensions/context/summary-generation.d.ts +14 -0
- package/dist/extensions/mcp/apps.d.ts +16 -0
- package/dist/extensions/mcp/client.d.ts +1 -0
- package/dist/extensions/mcp/index.d.ts +5 -1
- package/dist/extensions/mcp/manager.d.ts +2 -1
- package/dist/extensions/mcp/session-apps.d.ts +28 -0
- package/dist/extensions/mcp/types.d.ts +22 -0
- package/dist/extensions/plugin/plugin-command-origin.d.ts +8 -0
- package/dist/extensions/plugin/plugin-registry.d.ts +1 -0
- package/dist/extensions/plugin/plugin-runtime.d.ts +7 -0
- package/dist/hub/client/index.d.ts +6 -0
- package/dist/hub/client/managed-hub-build-watcher.d.ts +2 -0
- package/dist/hub/client/plugin-commands.d.ts +4 -0
- package/dist/hub/client/session-client.d.ts +2 -0
- package/dist/hub/daemon/entry.js +241 -228
- package/dist/hub/index.d.ts +1 -0
- package/dist/hub/index.js +231 -218
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +6 -0
- package/dist/hub/server/cloud-session-service.d.ts +50 -0
- package/dist/hub/server/handlers/capability-handlers.d.ts +18 -1
- package/dist/hub/server/handlers/context.d.ts +13 -2
- package/dist/hub/server/handlers/mcp-apps-handlers.d.ts +5 -0
- package/dist/hub/server/hub-server-options.d.ts +3 -0
- package/dist/hub/server/hub-server-transport.d.ts +2 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +278 -258
- package/dist/plugin-runtime/node_modules/@cline/agents/dist/index.js +76 -0
- package/dist/plugin-runtime/node_modules/@cline/agents/package.json +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/ai-sdk-b1d8eb67.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/anthropic-33qvrctr.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/bedrock-paabhz8w.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/cline-yhsfqcy1.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/cloud/index.js +21 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/community-gqgs7446.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/foundation-models-embedding-model-strategy-SAVQFBF4-822304b0.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/foundation-models-language-model-strategy-BPQO66W7-hky2m2yx.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-bsd-sqf1kd37.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-bsd-tx1kp6xn.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-darwin-6cpgjxme.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-darwin-fxchqbze.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-linux-m3bzwmzc.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-linux-pr9sb5fr.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-unsupported-nckraycx.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-unsupported-w91yq3tm.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-win-xdyxc2tf.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/getMachineId-win-yxsvs11a.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/google-pgdk2dm9.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/hub/daemon/entry.js +1160 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/hub/index.js +1147 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-02jpyn9y.js +85 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-0cb4390m.js +137 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-0f8xrhgt.js +209 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-1f8vb421.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-28c7m0fv.js +16 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-2em3jg4q.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-4n1zpzbe.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-54eea0ex.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-5j92dtg5.js +16 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-6akf3a5d.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-6k6ep10s.js +136 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-71ym4q6s.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-91p1ghfk.js +14 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-9qkpjy7x.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-9swk4nej.js +3 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-aa2s5myc.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ae0ajw38.js +13 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bxvyzjhc.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-bzy863k0.js +6 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-d96n0s70.js +20 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-dsd6vt8c.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-e2q4azd9.js +119 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-egd18jj2.js +4 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-eh83hr16.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-ev9r2dy3.js +1204 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-f2mvvryf.js +190 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-h7gn5v3f.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-h7s1a560.js +12 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-hkhq3jtz.js +21 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-j8r18nfg.js +15 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-jhny555h.js +6 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m1gpa2eg.js +146 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m2ad6tgj.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-m7mks2jq.js +4 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-mcnngj50.js +62 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-n2srkkh0.js +39 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-nbs1tsny.js +142 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-nqjnz7m4.js +9 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-rmhzyxr8.js +3 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-rtzf3vvk.js +6 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-sw74pcm3.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-t3eanyjj.js +3 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-tseksj1v.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v0ctpcdr.js +12 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v4-dx8bd4wq.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v695918t.js +14 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-v96yy1pw.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-vfm7r9wk.js +65 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-xecthgrg.js +9 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-xn1xhp06.js +9 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-yfdscfdx.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index-yrnwqsdt.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/jiti-static-3mgy2y9y.js +473 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/jiti-w1xrs0vd.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/langfuse-stream-telemetry-9tppg77c.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/langfuse-telemetry-y658kpzy.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/mistral-cmhqd91b.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/multipart-parser-qkjjf8mm.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/ollama-8z6y9d1h.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/openai-cfmja1ez.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/openai-compatible-1t7n5sxj.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/orchestration-embedding-model-strategy-GT27AFII-k6yqgnyd.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/orchestration-language-model-strategy-YEQPUCOT-6rdyebbq.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/services/feature-flags/posthog.js +2 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/services/telemetry/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/token-1h068py9.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/token-util-7jchft51.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/dist/vertex-qfxfsrn4.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/core/package.json +1 -0
- package/dist/plugin-runtime/node_modules/@cline/llms/dist/index.browser.js +16 -0
- package/dist/plugin-runtime/node_modules/@cline/llms/dist/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/llms/package.json +1 -0
- package/dist/plugin-runtime/node_modules/@cline/sdk/dist/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/sdk/package.json +1 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/automation/index.js +57 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/db/index.js +127 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/index.browser.js +110 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/node.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/remote-config/index.js +68 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/storage/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/dist/types/index.js +1 -0
- package/dist/plugin-runtime/node_modules/@cline/shared/package.json +1 -0
- package/dist/plugin-runtime/package.json +1 -0
- package/dist/{extensions → plugin-runtime}/plugin-sandbox-bootstrap.js +129 -129
- package/dist/remote/remote-environments.d.ts +1 -0
- package/dist/runtime/config/agent-runtime-config-builder.d.ts +2 -0
- package/dist/runtime/host/local-runtime-host.d.ts +10 -0
- package/dist/runtime/host/runtime-host.d.ts +6 -0
- package/dist/runtime/orchestration/runtime-oauth-token-manager.d.ts +3 -0
- package/dist/runtime/orchestration/session-runtime-orchestrator.d.ts +10 -1
- package/dist/runtime/orchestration/session-runtime.d.ts +2 -0
- package/dist/runtime/tools/subprocess-sandbox.d.ts +22 -0
- package/dist/services/llms/cline-recommended-models.d.ts +2 -0
- package/dist/services/local-runtime-bootstrap.d.ts +1 -0
- package/dist/services/plugin-command-api.d.ts +47 -0
- package/dist/services/plugin-commands.d.ts +25 -27
- package/dist/services/skills-cli.d.ts +2 -0
- package/dist/services/telemetry/core-events.d.ts +26 -0
- package/dist/services/telemetry/index.js +1 -1
- package/dist/services/telemetry/run-health.d.ts +40 -0
- package/dist/services/telemetry/stall-signals.d.ts +12 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/session.d.ts +7 -0
- package/package.json +6 -5
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import{Jm,qw}from"./index-rtzf3vvk.js";import{vc,Et,ie,e,n,r,m,zs,ri,o,t,p,w,d,s,a,rn,si,Y,je}from"./index-mcnngj50.js";var se=["none","minimal","low","medium","high","xhigh","max"],Zt=s(se),Dn=Zt.exclude(["none"]),Wr=s([...se,"default"]).nullable(),_e=w("type",[t({type:a("toggle")}).strict(),t({type:a("effort"),values:o(Wr)}).strict(),t({type:a("budget_tokens"),min:n().min(-1).optional(),max:n().min(0).optional()}).strict().refine((i)=>i.min===void 0||i.max===void 0||i.min<=i.max,{message:"Minimum reasoning budget cannot exceed maximum",path:["min"]})]);var mo=s(["default","openai-responses","r1"]);var ho=s(["images","video","tools","streaming","prompt-cache","reasoning","reasoning-effort","computer-use","global-endpoint","structured_output","temperature","files"]),ft=s(["active","preview","deprecated","legacy"]),yt=t({input:n().optional(),output:n().optional(),cacheWrite:n().optional(),cacheRead:n().optional()}),xt=t({maxBudget:n().optional(),outputPrice:n().optional(),thinkingLevel:s(["low","high"]).optional()}),bt=t({reasoningDefaultOn:r().optional(),apiProtocol:s(["openai-chat","openai-responses","anthropic","gemini"]).optional()}).catchall(m()),Pe=s(["text","image","audio","video","pdf"]),go=t({input:o(Pe),output:o(Pe)});var fo=s(["language","image-generation","speech-generation","video-generation","transcription","realtime"]);function Df(i){let l=i.modalities?.input,c=i.modalities?.output;return l?.length===1&&l[0]==="audio"&&c?.length===1&&c[0]==="text"}var yo=s(["batch","streaming"]);function tr(i){return i.operation==="image-generation"}function Me(i,l,c){let u=i.capabilities;if(u===void 0||u.length===0)return c?.assumeWhenUnspecified??!1;return u.includes(l)}function ir(i){return Me(i,"tools",{assumeWhenUnspecified:!0})}function nr(i){return Me(i,"images",{assumeWhenUnspecified:!0})}var ae=t({id:e(),name:e().optional(),description:e().optional(),maxTokens:n().optional(),contextWindow:n().optional(),maxInputTokens:n().optional(),capabilities:o(ho).optional(),operation:fo.optional(),operationModes:o(yo).optional(),modalities:go.optional(),reasoningOptions:o(_e).optional(),apiFormat:mo.optional(),systemRole:s(["system","developer"]).optional(),temperature:n().optional(),pricing:yt.optional(),thinkingConfig:xt.optional(),status:ft.optional(),deprecationNotice:e().optional(),replacedBy:e().optional(),releaseDate:e().optional(),deprecationDate:e().optional(),family:e().optional(),metadata:bt.optional()});var Ct=[{name:"discord",description:"Discord interactions and gateway bridge backed by RPC runtime sessions"},{name:"gchat",description:"Google Chat webhook bridge backed by RPC runtime sessions"},{name:"linear",description:"Linear webhook bridge backed by RPC runtime sessions"},{name:"slack",description:"Slack webhook/socket bridge backed by RPC runtime sessions"},{name:"telegram",description:"Bridge Telegram bot messages into RPC chat sessions"},{name:"whatsapp",description:"Bridge WhatsApp webhook messages into RPC chat sessions"}];function mi(){return Ct.map((i)=>({...i}))}function xo(i,l){let c=i.includeWhen;if(!c)return!0;let u=l[c.flag]??"";if(c.equals!==void 0&&u!==c.equals)return!1;if(c.notEquals!==void 0&&u===c.notEquals)return!1;return!0}function ar(i,l,c){let u={};for(let f of i.fields){let h=l[f.flag];u[f.flag]=typeof h==="string"?h.trim():f.initialValue??""}let g=[];for(let f of i.fields){if(!xo(f,u))continue;let h=u[f.flag]??"";if(!h){if(f.required)throw Error(`${f.label} is required`);continue}g.push(f.flag,h)}if(c?.enabled===!0&&i.security){let f={};for(let h of i.security.fields){let x=c.values[h.key]?.trim();if(!x)throw Error(h.requiredMessage);let b=h.validate?.(x);if(b)throw Error(b);f[h.key]=x}g.push(...i.security.buildArgs(f))}return g}function $r(i,l){if(l.has(i))return{managed:!0,consumesNext:!0};for(let c of l)if(i.startsWith(`${c}=`))return{managed:!0,consumesNext:!1};return{managed:!1,consumesNext:!1}}function or(i,l,c,u){let g=new Set([...i.fields.flatMap((h)=>[h.flag,...h.aliases??[]]),...i.derivedReconnectFlags??[]]);if(u.replaceSecurityArgs)for(let h of i.security?.argumentFlags??[])g.add(h);let f=[];for(let h=0;h<l.length;h+=1){let x=l[h]??"",b=$r(x,g);if(!b.managed){f.push(x);continue}if(b.consumesNext)h+=1}return[...f,...c]}function rr(i=bo){let l=new Set(mi().map((c)=>c.name));return i.filter((c)=>l.has(c.id)).map((c)=>({id:c.id,name:c.name,type:c.type,hint:c.hint,fields:c.fields.map((u)=>({flag:u.flag,label:u.label,placeholder:u.placeholder,required:u.required,help:u.help,initialValue:u.initialValue,options:u.options,includeWhen:u.includeWhen})),security:c.security?{prompt:c.security.prompt,fields:c.security.fields.map((u)=>({key:u.key,label:u.label,placeholder:u.placeholder,help:u.help,requiredMessage:u.requiredMessage}))}:void 0}))}function Yr(i){return/^\d+$/.test(i)?void 0:"Telegram user ID must contain digits only"}function Jr(i){return/^T[A-Z0-9]+$/.test(i)?void 0:"Slack workspace ID must start with T and contain uppercase letters or digits only"}function Xr(i){return/^[UW][A-Z0-9]+$/.test(i)?void 0:"Slack member ID must start with U or W and contain uppercase letters or digits only"}var bo=[{id:"telegram",name:"Telegram",type:"polling",hint:"Easiest to set up. No public URL needed.",derivedReconnectFlags:["-m","--bot-username"],fields:[{flag:"-k",aliases:["--bot-token"],label:"Bot token",placeholder:"7123456789:AAH...",required:!0,help:["Open Telegram and start a chat with @BotFather","Send /newbot and follow the prompts","BotFather gives you this after creating the bot","It looks like 7123456789:AAHxxx..."]}],security:{prompt:"By default, anyone who finds your bot can message it and run tasks on your machine. Restrict access to your Telegram user ID?",fields:[{key:"userId",label:"Your Telegram user ID",placeholder:"123456789",help:["Message @userinfobot on Telegram","It will reply with your numeric user ID"],requiredMessage:"User ID is required to restrict access",validate:Yr}],argumentFlags:["--allowed-user-id","--hook-command"],buildArgs:({userId:i})=>["--allowed-user-id",i??""]}},{id:"slack",name:"Slack",type:"hybrid",hint:"Public URL for webhook mode; leave blank for socket mode.",fields:[{flag:"--bot-token",label:"Bot token",placeholder:"xoxb-...",required:!0,help:["Go to api.slack.com/apps and create a new app","Add Bot Token Scopes: chat:write, app_mentions:read, channels:history, channels:read, im:history, im:read, im:write, users:read","Install to workspace and copy the Bot Token"]},{flag:"--base-url",label:"Public base URL",placeholder:"leave blank for socket mode",help:["Enter a publicly accessible URL for webhook mode","Leave blank to use Slack socket mode instead"]},{flag:"--signing-secret",label:"Signing secret",required:!0,help:["Found in your app's Basic Information page"],includeWhen:{flag:"--base-url",notEquals:""}},{flag:"--app-token",label:"App-level token",placeholder:"xapp-...",required:!0,help:["Enable Socket Mode in the Slack app","Generate an app-level token with the connections:write scope"],includeWhen:{flag:"--base-url",equals:""}}],security:{prompt:"Restrict which Slack users can interact with the bot?",fields:[{key:"teamId",label:"Allowed Slack workspace ID",placeholder:"T01ABC123",help:["Open your Slack workspace URL in a browser","The workspace ID is the segment after /client/, for example T01ABC123"],requiredMessage:"Workspace ID is required to restrict access",validate:Jr},{key:"userId",label:"Allowed Slack member ID",placeholder:"U01ABC123",help:["Click a user's name in Slack, then View full profile","Click ... and Copy member ID"],requiredMessage:"Member ID is required to restrict access",validate:Xr}],argumentFlags:["--hook-command"],buildArgs:({teamId:i,userId:l})=>["--hook-command",`jq -r ".payload.actor.participantKey" | grep -qx "slack:team:${i}:user:${l}" && echo '{"action":"allow"}' || echo '{"action":"deny"}'`]}},{id:"discord",name:"Discord",type:"webhook",hint:"Requires a Discord app and public URL.",fields:[{flag:"--application-id",aliases:["--app-id"],label:"Application ID",required:!0,help:["Go to discord.com/developers/applications","Create a new app, copy the Application ID"]},{flag:"--bot-token",aliases:["--token"],label:"Bot token",required:!0,help:["Go to Bot section, create a bot, copy the token"]},{flag:"--public-key",label:"Public key",required:!0,help:["Found in General Information of your app"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0,help:["Base URL for the connector","For Discord, set the Interactions Endpoint URL to <base-url>/api/webhooks/discord"]}]},{id:"whatsapp",name:"WhatsApp",type:"webhook",hint:"Requires Meta developer account and public URL.",fields:[{flag:"--phone-number-id",label:"Phone number ID",required:!0,help:["From your WhatsApp Business account in Meta Developer portal"]},{flag:"--access-token",label:"Access token",required:!0,help:["Generate a permanent token in Meta Developer portal"]},{flag:"--app-secret",label:"App secret",required:!0,help:["Found in App Settings > Basic"]},{flag:"--verify-token",label:"Webhook verify token",placeholder:"my-verify-token",required:!0,help:["Any string you choose, used to verify webhook setup"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"gchat",name:"Google Chat",type:"webhook",hint:"Requires Google Cloud project and public URL.",fields:[{flag:"--credentials-json",label:"Service account credentials JSON",required:!0,help:["Create a service account in Google Cloud Console","Download the credentials JSON file","Paste the JSON content here"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]},{id:"linear",name:"Linear",type:"webhook",hint:"React to Linear issues and comments.",fields:[{flag:"--api-key",label:"API key",required:!0,help:["Go to Linear Settings > API > Personal API keys"]},{flag:"--webhook-secret",label:"Webhook signing secret",required:!0,help:["Go to Settings > API > Webhooks, create one","Copy the signing secret"]},{flag:"--base-url",label:"Public base URL",placeholder:"https://example.com",required:!0}]}];var Zr=[];function Em(i){Zr.push(i)}var Qr=["hooks","tools","commands","rules","skills","messageBuilders","providers","automationEvents","mcp"],oi=new Set(Qr);function kt(i,l){return i.name||`extension_${String(l).padStart(4,"0")}`}function Tt(i){return Array.isArray(i)&&i.every((l)=>typeof l==="string")}function St(i){if(!Array.isArray(i))return;let l=i.filter((c)=>typeof c==="string").map((c)=>c.trim()).filter((c)=>c.length>0);return l.length>0?l:void 0}function Rm(i){let l=St(i.providerIds),c=St(i.modelIds);return{...i,...l?{providerIds:l}:{},...c?{modelIds:c}:{}}}function ai(i,l){let c=kt(i,l),u=i.manifest;if(!u||typeof u!=="object")throw Error(`Invalid manifest for extension "${c}": manifest is required`);if(!Array.isArray(u.capabilities)||u.capabilities.length===0)throw Error(`Invalid manifest for extension "${c}": capabilities must be a non-empty array`);let g=new Set;for(let x of u.capabilities){if(!oi.has(x))throw Error(`Invalid manifest for extension "${c}": unsupported capability "${String(x)}"`);g.add(x)}if(Object.hasOwn(u,"providerIds")&&!Tt(u.providerIds))throw Error(`Invalid manifest for extension "${c}": providerIds must be a string array when provided`);if(Object.hasOwn(u,"modelIds")&&!Tt(u.modelIds))throw Error(`Invalid manifest for extension "${c}": modelIds must be a string array when provided`);let f=g.has("hooks");if(i.hooks!==void 0&&!f)throw Error(`Invalid manifest for extension "${c}": runtime hooks require the "hooks" capability`);return{capabilities:g,raw:Rm(u)}}function li(i,l){if(!i||typeof i!=="object")throw Error(`Invalid automation event contribution for extension "${l}": expected object`);let c=typeof i.eventType==="string"?i.eventType.trim():"",u=typeof i.source==="string"?i.source.trim():"";if(!c)throw Error(`Invalid automation event contribution for extension "${l}": eventType is required`);if(!u)throw Error(`Invalid automation event contribution for extension "${l}": source is required`);return{...i,eventType:c,source:u,examples:i.examples?[...i.examples]:void 0,metadata:i.metadata?{...i.metadata}:void 0}}class Om{extensions;registry={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]};normalized=[];phase="resolve";setupContext;constructor(i={}){this.extensions=i.extensions??[],this.setupContext=i.setupContext??{}}resolve(){if(this.phase!=="resolve")return;this.normalized=this.extensions.map((i,l)=>({extension:i,order:l,manifest:{capabilities:new Set,raw:i.manifest}})),this.phase="validate"}validate(){if(this.phase==="resolve")this.resolve();if(this.phase!=="validate")return;this.normalized=this.normalized.map((i)=>({...i,manifest:ai(i.extension,i.order)})),this.phase="setup"}async setup(i={}){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase!=="setup")return;let l,c=[];for(let u of this.normalized){let{extension:g}=u;if(g.disabled)continue;let f=kt(g,u.order),h={tools:[],commands:[],rules:[],messageBuilder:[],providers:[],automationEventTypes:[],mcpServers:[]},x={registerTool:(T)=>h.tools.push(T),registerCommand:(T)=>h.commands.push(T),registerRule:(T)=>{if(!u.manifest.capabilities.has("rules"))throw Error(`Invalid setup for extension "${f}": registerRule requires the "rules" capability`);h.rules.push(T)},registerMessageBuilder:(T)=>h.messageBuilder.push(T),registerProvider:(T)=>h.providers.push(T),registerAutomationEventType:(T)=>{if(!u.manifest.capabilities.has("automationEvents"))throw Error(`Invalid setup for extension "${f}": registerAutomationEventType requires the "automationEvents" capability`);h.automationEventTypes.push(li(T,f))},registerMcpServer:(T)=>{if(!u.manifest.capabilities.has("mcp"))throw Error(`Invalid setup for extension "${f}": registerMcpServer requires the "mcp" capability`);h.mcpServers.push({...T,metadata:{...T.metadata??{},source:"plugin",plugin:f}})}},b=u.manifest.capabilities.has("automationEvents")?this.setupContext:{...this.setupContext,automation:void 0};try{await g.setup?.(x,b),c.push(h)}catch(T){if(i.tolerateSetupErrors!==!0)throw T;l??=T}}if(l&&i.tolerateSetupErrors!==!0)throw l;for(let u of c)this.registry.tools.push(...u.tools),this.registry.commands.push(...u.commands),this.registry.rules.push(...u.rules),this.registry.messageBuilder.push(...u.messageBuilder),this.registry.providers.push(...u.providers),this.registry.automationEventTypes.push(...u.automationEventTypes),this.registry.mcpServers.push(...u.mcpServers);if(this.phase="activate",l)throw l}activate(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();if(this.phase==="setup")throw Error("Contribution registry setup must complete before activation");if(this.phase!=="activate")return;this.phase="run"}async initialize(i={}){this.resolve(),this.validate();try{await this.setup(i)}finally{if(this.phase==="activate")this.activate()}}isActivated(){return this.phase==="run"}getRegistrySnapshot(){return{tools:[...this.registry.tools],commands:[...this.registry.commands],rules:[...this.registry.rules],messageBuilder:[...this.registry.messageBuilder],providers:[...this.registry.providers],automationEventTypes:[...this.registry.automationEventTypes],mcpServers:[...this.registry.mcpServers]}}getRegisteredTools(){return[...this.registry.tools]}getRegisteredRules(){return[...this.registry.rules]}getRegisteredAutomationEventTypes(){return[...this.registry.automationEventTypes]}getRegisteredMcpServers(){return[...this.registry.mcpServers]}getValidatedExtensions(){if(this.phase==="resolve")this.resolve();if(this.phase==="validate")this.validate();return this.normalized.slice().sort((i,l)=>i.order-l.order).map(({extension:i})=>i)}}function Ut(i={}){return new Om(i)}var sr=[".js",".ts"];var Rt={CLINE_PASS:"ext-cline-pass",CODE_CLOUD_AGENTS:"code-cloud-agents",CODE_ONBOARDING_GITHUB:"code-onboarding-github",CLINE_COMPOSIO_BETA:"CLINE_COMPOSIO_BETA"},Ft={[Rt.CLINE_PASS]:!1,[Rt.CODE_CLOUD_AGENTS]:!1,[Rt.CODE_ONBOARDING_GITHUB]:!1,[Rt.CLINE_COMPOSIO_BETA]:!1},Ti=Object.values(Rt);var Wf=s(["agent_start","agent_resume","agent_abort","agent_end","agent_error","tool_call","tool_result","prompt_submit","pre_compact","session_shutdown"]),z=d(e(),e()),ci=t({toolName:e(),parameters:z}),di=t({toolName:e(),parameters:z,result:e(),success:r(),executionTimeMs:n()}),ui=t({prompt:e(),attachments:o(e())}),pi=t({taskMetadata:z}),gi=t({taskMetadata:z,previousState:z}),fi=t({taskMetadata:z}),yi=t({taskMetadata:z}),hi=t({taskId:e(),ulid:e(),contextSize:n(),compactionStrategy:e(),previousApiReqIndex:n(),tokensIn:n(),tokensOut:n(),tokensInCache:n(),tokensOutCache:n(),deletedRangeStart:n(),deletedRangeEnd:n(),contextJsonPath:e(),contextRawPath:e()}),Mf=t({clineVersion:e(),hookName:Wf,timestamp:e(),taskId:e(),sessionContext:t({rootSessionId:e().optional(),hookLogPath:e().optional()}).optional(),workspaceRoots:o(e()),workspaceInfo:Y().optional(),userId:e(),agent_id:e(),parent_agent_id:e().nullable(),iteration:n().optional(),reason:e().optional(),tool_call:t({id:e(),name:e(),input:m()}).optional(),tool_result:Y().optional(),turn:m().optional(),error:t({name:e(),message:e(),stack:e().optional()}).optional(),preToolUse:ci.optional(),postToolUse:di.optional(),userPromptSubmit:ui.optional(),taskStart:pi.optional(),taskResume:gi.optional(),taskCancel:fi.optional(),taskComplete:yi.optional(),preCompact:hi.optional()}).passthrough();function ba(i){let l=Mf.safeParse(i);if(!l.success)return;return l.data}var zi="v1",va="v1",wa="v1",hs=["client.register","client.list","session.create","session.list","session.get","session.run","session.abort","schedule.create","schedule.list","task.create","task.list","task.get","task.update","task.approve","task.cancel","task.run","task.automation.get","task.automation.set","settings.get","settings.set","connector.start","connector.stop","connector.supervised","run.enqueue","run.list","hub.drain","hub.status","plugins.list","plugins.status","plugins.reload","stream.replay"];function le(i){let l=/^v(\d+)$/.exec(i?.trim()??"");if(!l)return;return Number.parseInt(l[1]??"",10)}function Mt(i,l="v1"){let c=le(i.protocolVersion),u=le(l);if(c===void 0||u===void 0)return{compatible:!1,reason:"missing_protocol"};let g=le(i.minClientProtocolVersion)??c,f=le(i.maxClientProtocolVersion)??c;return u>=g&&u<=f?{compatible:!0}:{compatible:!1,reason:"unsupported_protocol"}}var gs="approval.respond",pe="0",fe="__hubScheduleRunAt",vt=["act","plan","yolo"];function xi(i){return vt.some((l)=>l===i)}function ka(i,l){if(!i||!Object.hasOwn(i,"mode"))return l;let c=i.mode;if(xi(c))return c;throw Error(`mode must be one of: ${vt.join(", ")}`)}var bi=30000,fs=5000;function Ci(i){switch(i){case"run.start":case"session.send_input":case"plugins.commands.run":return null;default:return bi}}function ei(i,l){return l===void 0?Ci(i):l}var Ri=["readFile","search","bash","webFetch","editor","applyPatch","skills","askQuestion","submit"],Ai=new Set(Ri);function vo(i){return typeof i==="string"&&Ai.has(i)}var Am="tool_executor.",Cm="custom_tool.",Pm="hook.",Dm="compaction.compact",Wm="checkpoint.create",Mm="mistake_limit.decide",Nm="user_instructions.snapshot";function cr(i,l="act"){return`<user_input mode="${l}">${i}</user_input>`}function ki(i,l){let c=i.trim(),u=new RegExp(`^<${l}\\b([^>]*)>([\\s\\S]*?)<\\/${l}>$`,"i").exec(c);if(!u)return;return{attrs:u[1]??"",content:u[2]??""}}function vi(i,l){return new RegExp(`${l}="([^"]+)"`,"i").exec(i)?.[1]?.trim()||void 0}function Nf(i){if(!i?.trim())return;let l=ki(i,"user_command");if(!l)return;let c=vi(l.attrs,"slash");if(!c)return;return{slash:c,content:l.content.trim()}}function ye(i){if(!i?.trim())return"";let l=i.trim();for(let c of["user_input","user_command"]){let u=Dt(l,c);l=(u!==l?u:l.replace(new RegExp(`<${c}[^>]*>`,"g"),"")).trim()}return l}function wo(i){if(!i?.trim())return"";return Pi(i,"mode_notice").trim()}function Pi(i,l){let c=`<${l}>`,u=`</${l}>`,g=i,f=g.indexOf(c);while(f!==-1){let h=g.indexOf(u,f+c.length);if(h===-1)break;g=g.slice(0,f)+g.slice(h+u.length),f=g.indexOf(c,f)}return g}function me(i){let l=wo(ye(i)),c=Nf(i);if(!c)return l;if(c.slash.toLowerCase()==="team"){let g=l.toLowerCase().startsWith("spawn a team of agents for the following task:")?l.slice(46).trim():l;return g?`/team ${g}`:"/team"}return l?`/${c.slash} ${l}`:`/${c.slash}`}var Pt=240,wt=480;function Lt(i,l){let c=i.replace(/\s+/gu," ").trim();if(c.length<=l)return c;return`${c.slice(0,l-1).trimEnd()}…`}function Wn(i){return Lt(me(i),Pt)}function lr(i,l){let c=l?.trim()??"",u=i.toLowerCase(),g=u==="user"||u==="session"?me(c):c;return Lt(g,wt)}function Dt(i,l){if(!i?.trim())return"";if(!l)return i;let c=new RegExp(`<${l}\\b[^>]*>([\\s\\S]*?)</${l}>`,"g");return i.replace(c,"$1")}var hn="[media omitted: invalid or exceeds size limit]";var Bt=s(["image","audio","video","file"]),Ht=w("type",[t({type:a("base64"),data:e().min(1)}),t({type:a("url"),url:e().url().refine((i)=>{let l=new URL(i).protocol;return l==="http:"||l==="https:"},"Generated media URLs must use HTTP or HTTPS")}),t({type:a("artifact"),artifactId:e().min(1)})]);function Mi(i){if(i.startsWith("image/"))return"image";if(i.startsWith("audio/"))return"audio";if(i.startsWith("video/"))return"video";return"file"}var Vt=t({id:e().min(1),modality:Bt,mediaType:e().min(1),source:Ht,name:e().min(1).optional(),sizeBytes:n().int().nonnegative().optional()}).refine((i)=>Mi(i.mediaType)===i.modality,{message:"Generated media modality must match its media type",path:["modality"]});function Lf(i){return Vt.safeParse(i).success}var we=["image/png","image/jpeg","image/gif","image/webp"],Kt=5242880,de=Kt,ue=6291456,Wt=8388608;function Yt(i){let l=i.endsWith("==")?2:i.endsWith("=")?1:0;return Math.floor(i.length*3/4)-l}function ko(i={}){return{maxImageEncodedBytes:i.maxImageEncodedBytes??de,maxImageDecodedBytes:i.maxImageDecodedBytes??ue,maxTotalMediaBytes:i.maxTotalMediaBytes??Wt}}function To(){return{totalEncodedBytes:0,keptImages:0,omittedImages:0,omittedReasons:{}}}function ce(i,l){i.omittedImages+=1,i.omittedReasons[l]=(i.omittedReasons[l]??0)+1}function Oe(i,l,c,u){let g=ko(c);if(i>g.maxImageEncodedBytes){let f={ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${g.maxImageEncodedBytes} byte encoded limit`};return ce(u,f.reason),f}if(l>g.maxImageDecodedBytes){let f={ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${g.maxImageDecodedBytes} byte decoded limit`};return ce(u,f.reason),f}if(u.totalEncodedBytes+i>g.maxTotalMediaBytes){let f={ok:!1,reason:"total_limit",message:`Image media exceeds the ${g.maxTotalMediaBytes} byte total media limit`};return ce(u,f.reason),f}return u.totalEncodedBytes+=i,u.keptImages+=1,null}function Jt(i){return i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||i===43||i===47}function wi(i,l,c){let u=c-l;if(u%4!==0)return!1;let g=c;if(u>=2&&i.charCodeAt(c-2)===61&&i.charCodeAt(c-1)===61)g-=2;else if(u>=1&&i.charCodeAt(c-1)===61)g-=1;for(let f=l;f<g;f++)if(!Jt(i.charCodeAt(f)))return!1;for(let f=g;f<c;f++)if(i.charCodeAt(f)!==61)return!1;return!0}function Oi(i,l,c){return c-l>=5&&(i.charCodeAt(l)|32)===100&&(i.charCodeAt(l+1)|32)===97&&(i.charCodeAt(l+2)|32)===116&&(i.charCodeAt(l+3)|32)===97&&i.charCodeAt(l+4)===58}function Ni(i){let l=0,c=i.length;while(l<c&&/\s/.test(i[l]??""))l+=1;while(c>l&&/\s/.test(i[c-1]??""))c-=1;return{start:l,end:c}}function Li(i,l,c){if(!Oi(i,l,c))return;let u=l+5,g=i.indexOf(",",u);if(g===-1||g>=c)return;if(g-u>128)return;let f=i.slice(u,g).toLowerCase(),h=";base64";if(!f.endsWith(h))return;let x=f.slice(0,-h.length);if(!x||x.includes(";"))return;return{mediaType:x,base64Start:g+1,base64End:c}}function Xt(i,l,c={}){let u=c.maxEncodedBytes??de,g=c.maxDecodedBytes??ue,f=new Set(c.supportedMediaTypes??we),h=i?.toLowerCase(),x=Ni(l),{start:b,end:T}=x,R=Li(l,x.start,x.end);if(R){if(h&&h!==R.mediaType)return{ok:!1,reason:"media_type_mismatch",message:`Image media type ${i} does not match data URL type ${R.mediaType}`};h=R.mediaType,b=R.base64Start,T=R.base64End}if(!h||!f.has(h))return{ok:!1,reason:"unsupported_media_type",message:`Unsupported image media type: ${i??"unknown"}`};let E=T-b;if(E===0)return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};if(E>u)return{ok:!1,reason:"encoded_limit",message:`Image media exceeds the ${u} byte encoded limit`};if(!wi(l,b,T))return{ok:!1,reason:"invalid_base64",message:"Image media must contain valid base64"};let I=l.slice(b,T),k=Yt(I);if(k>g)return{ok:!1,reason:"decoded_limit",message:`Image media exceeds the ${g} byte decoded limit`};return{ok:!0,mediaType:h,base64:I,encodedBytes:E,decodedBytes:k}}function _o(i,l,c,u){let g=Xt(i,l,{maxEncodedBytes:c.maxImageEncodedBytes,maxDecodedBytes:c.maxImageDecodedBytes});if(!g.ok)return ce(u,g.reason),g;let f=Oe(g.encodedBytes,g.decodedBytes,c,u);if(f)return f;return g}var ur="ERROR: EMPTY CONTENT";function Qt(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}function Mn(i,l){if(!i&&!l)return;let c=i?.metadata,u=l?.metadata,g={...i??{},...l??{}};if(Qt(c)&&Qt(u))g.metadata={...c,...u};return g}var fw=["web_search","image_generation"],Gi=["web_search"];function jt(i){return Math.max(1,Math.ceil(i/3))}var Io=1600;function Nn(){let i=0;return{replacer:(c,u)=>{if(u===null||typeof u!=="object"||u.type!=="image")return u;let g=u;if(typeof g.data==="string")return i+=1,{...g,data:""};if("image"in g)return i+=1,{...g,image:""};return u},imageCount:()=>i}}function Ne(i){let l=new WeakSet;try{return JSON.stringify(i,(c,u)=>{if(typeof u==="bigint")return u.toString();if(typeof u!=="object"||u===null)return u;if(l.has(u))return"[Circular]";return l.add(u),u})??""}catch{return String(i??"")}}function pr(i){let{replacer:l,imageCount:c}=Nn(),u,g=0;try{u=JSON.stringify({systemPrompt:i.systemPrompt,messages:i.messages,tools:i.tools},l),g=c()}catch{u=[Ne(i.systemPrompt),Ne(i.messages),Ne(i.tools)].join(`
|
|
2
|
+
`)}return jt(u.length)+g*Io}var Ln={debug:()=>{},log:()=>{},error:()=>{}};function ze(i){return typeof i==="number"&&Number.isFinite(i)}function Fi(i){return Math.min(Math.max(i,1),3600)}function Be(i){if(!ze(i))return 60;return Fi(i)}function Vi(i,l,c){let u=c?` (${c})`:"",g=Math.round(l/100)/10;return`MCP request to "${i}"${u} timed out after ${g}s. Increase the "timeout" field (in seconds) for this server in cline_mcp_settings.json.`}function $t(i){try{return JSON.parse(i)}catch{return}}function qi(i){if(typeof globalThis.atob==="function")try{let l=globalThis.atob(i),c=Uint8Array.from(l,(u)=>u.charCodeAt(0));return new TextDecoder().decode(c)}catch{return null}if(typeof Buffer<"u")try{return Buffer.from(i,"base64").toString("utf8")}catch{return null}return null}function ne(i){let l=i?.trim();if(!l)return null;try{let c=l.split(".");if(c.length!==3)return null;let u=c[1];if(!u)return null;let g=u.replace(/-/g,"+").replace(/_/g,"/"),f=g.padEnd(g.length+(4-g.length%4)%4,"="),h=qi(f);return h?JSON.parse(h):null}catch{return null}}import ji from"node:path";function qt(i){return i.split(ji.sep).join("/")}function en(i){let l=i.replaceAll("\\","/"),c=l.lastIndexOf("/");return(c>=0?l.slice(c+1):l).toLowerCase()}function _t(i){return i==="win32"?"powershell":"/bin/bash"}function So(i){let l=en(i);if(Ki(i)!==void 0)return"powershell";if(l==="cmd"||l==="cmd.exe")return"cmd";if(l==="wsl"||l==="wsl.exe")return"wsl";return"posix"}var Wi=new Set(["-nologo","-noninteractive","-noprofile"]),$i="-noprofile";function Zi(i,l){let c="";for(let u=0;u<i.length;u++){let g=i[u];if(g==="`"&&u+1<i.length){let f=i[u+1];if(f==="u"&&l==="core"&&i[u+2]==="{"){let h=i.indexOf("}",u+3),x=h>u+3?i.slice(u+3,h):"",b=Number.parseInt(x,16);if(x.length<=6&&/^[0-9a-fA-F]+$/.test(x)&&b<=1114111){c+=String.fromCodePoint(b),u=h;continue}}switch(f){case"n":c+=`
|
|
3
|
+
`;break;case"r":c+="\r";break;case"t":c+="\t";break;case"b":c+="\b";break;case"f":c+="\f";break;case"v":c+="\v";break;case"0":c+="\x00";break;case"a":c+="\x07";break;case"e":c+=l==="core"?"\x1B":"e";break;default:c+=f}u++;continue}if(g==='"'&&i[u+1]==='"'){c+='"',u++;continue}c+=g}return c}function es(i){let l=i[0];if(l!=="'"&&l!=='"')return;for(let c=1;c<i.length;c++){let u=i[c];if(l==='"'&&u==="`"){c++;continue}if(u===l){if(i[c+1]===l){c++;continue}if(i.slice(c+1).trim()!=="")return;return{quote:l,body:i.slice(1,c)}}}return}function Ki(i){let l=en(i);if(l==="powershell"||l==="powershell.exe")return"windows";if(l==="pwsh"||l==="pwsh.exe")return"core";return}function ts(i,l){let c=es(i);if(!c)return;let u=(c.quote==="'"?c.body.replaceAll("''","'"):Zi(c.body,l)).trim();return u.length>0?u:void 0}function ns(i,l){let c=/^[ \t]*(?:&[ \t]*(?:"([^"$`]*)"|'((?:[^']|'')*)')|(?:&[ \t]*)?([^\s$`"';&|<>(){}#@,]+))[ \t]+([\S\s]*)$/.exec(i);if(!c)return;let u=c[1]??c[2]?.replaceAll("''","'")??c[3],g=Ki(l);if(!g||!Ki(u))return;let f=c[4],h=!1;for(;;){let x=/^(-[^\s=]+)[ \t]*([\S\s]*)$/.exec(f);if(!x)return;let b=x[1].toLowerCase();if(b==="-command"){let T=h?ts(x[2],g):void 0;return T===void 0?void 0:{executable:u,script:T}}if(!Wi.has(b))return;if(b===$i)h=!0;f=x[2]}}function os(i,l){if(!/[\\/:]/.test(l)&&Ki(l)===Ki(i))return i;return l}function dr(i,l){switch(So(i)){case"powershell":{let c={executable:i,script:l};for(;;){let u=ns(c.script,c.executable);if(!u)break;c={executable:os(i,u.executable),script:u.script}}return{executable:c.executable,args:["-NoProfile","-NonInteractive","-Command","[Console]::InputEncoding=[Text.UTF8Encoding]::new();[Console]::OutputEncoding=[Text.UTF8Encoding]::new();$ErrorActionPreference='Stop';$c=[Console]::In.ReadToEnd();$c+=[Environment]::NewLine+'if(-not $?){exit 1}';& ([ScriptBlock]::Create($c))"],input:c.script}}case"cmd":return{executable:i,args:["/d","/s","/c",l]};case"wsl":return{executable:i,args:["bash","-c",l]};case"posix":return{executable:i,args:["-c",l]}}}function mr(i){return i.toLowerCase().replace(/[^\w.-]+/g,"_")}function tn(i,l){if(i.length<=l)return i;return`${i.slice(0,l-1)}…`}function Bn(i,l="/",c=100){if(!i||i.length<=c)return i||"";let u=i.split(l)?.shift()?.trim()?.slice(0,c-1);return u?`${u}…`:tn(i,c)}function he(i){return i.charCodeAt(0)===65279?i.slice(1):i}function y(i,l){let c=i.safeParse(l);if(!c.success)throw Error(vc(c.error));return c.data}function S(i){return Et(i)}function Le(i){return i==="cline"||i==="cline-pass"}var nn=`You are Cline, an AI coding agent. Your primary goal is to assist users with various coding tasks by leveraging your knowledge and the tools at your disposal. Given the user's prompt, you should use the tools available to you to answer user's question.
|
|
4
|
+
|
|
5
|
+
Always gather all the necessary context before starting to work on a task. For example, if you are generating a unit test or new code, make sure you understand the requirement, the naming conventions, frameworks and libraries used and aligned in the current codebase, and the environment and commands used to run and test the code etc. Always validate the new unit test at the end including running the code if possible for live feedback.
|
|
6
|
+
Review each question carefully and answer it with detailed, accurate information.
|
|
7
|
+
If you need more information, use one of the available tools or ask for clarification instead of making assumptions or lies.
|
|
8
|
+
|
|
9
|
+
Environment you are running in:
|
|
10
|
+
<env>
|
|
11
|
+
1. Platform: {{PLATFORM_NAME}}
|
|
12
|
+
2. Date: {{CURRENT_DATE}}
|
|
13
|
+
3. IDE: {{IDE_NAME}}
|
|
14
|
+
4. Working Directory: {{CWD}}
|
|
15
|
+
</env>
|
|
16
|
+
|
|
17
|
+
Remember:
|
|
18
|
+
- Always adhere to existing code conventions and patterns.
|
|
19
|
+
- Use only libraries and frameworks that are confirmed to be in use in the current codebase.
|
|
20
|
+
- Provide complete and functional code without omissions or placeholders.
|
|
21
|
+
- Be explicit about any assumptions or limitations in your solution.
|
|
22
|
+
- Always show your planning process before executing any task. This will help ensure that you have a clear understanding of the requirements and that your approach aligns with the user's needs.
|
|
23
|
+
- Always use absolute paths when referring to files.
|
|
24
|
+
- You can call multiple tools in a single response. Before using tools, identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now, either as multiple tool calls or as one batched input for tools that accept arrays. Do not wait for one independent result before requesting another. Do not split independent reads, searches, checks, or edits across separate turns.
|
|
25
|
+
- Good parallelism examples: read all known relevant files in one read_files call; run independent inspection commands in one run_commands call; emit independent read_files, search_codebase, and run_commands calls together in one response; emit multiple editor calls together when editing different files or non-overlapping regions.
|
|
26
|
+
- Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.
|
|
27
|
+
|
|
28
|
+
Begin by analyzing the user's input and gathering any necessary additional context. Then, present your plan at the start of your response along with tool calls before proceeding with the task. It's OK for this section to be quite long.
|
|
29
|
+
|
|
30
|
+
REMEMBER, be helpful and proactive! Don't ask for permission to do something when you can do it! Do not indicates you will be using a tool unless you are actually going to use it.
|
|
31
|
+
|
|
32
|
+
IMPORTANT: Always includes tool calls in your response until the task is completed. Response without tool calls will considered as completed with final answer.
|
|
33
|
+
|
|
34
|
+
When you have completed the task, please provide a summary of what you did and any relevant information that the user should know. This will help ensure that the user understands the changes made and can easily follow up if they have any questions or need further assistance. Do not indicate that you will perform an action without actually doing it. Always provide the final result in your response. Always validate your answer with checking the code and running it if possible.
|
|
35
|
+
|
|
36
|
+
If user asked a simple question without any coding context, answer it directly without using any tools.
|
|
37
|
+
{{CLINE_RULES}}
|
|
38
|
+
{{CLINE_METADATA}}`;var on=`You are Cline, a careful and helpful coding agent that works in the background.
|
|
39
|
+
You are tasked to solve an issue reported by the user who you cannot communicate with directly.
|
|
40
|
+
Your goal is to utilize the tools at your disposal to investigate and answer the question according to user's instructions with the aim to verify that the issue is resolved.
|
|
41
|
+
|
|
42
|
+
RULES:
|
|
43
|
+
- Always match output format exactly as shown in examples or existing files.
|
|
44
|
+
- Use only libraries and frameworks that are confirmed and compatible to be in use in the current codebase.
|
|
45
|
+
- Provide complete and functional code without omissions or placeholders.
|
|
46
|
+
- During thinking stage, show your planning process. Keep the plan to one short paragraph.
|
|
47
|
+
- Be proactive and avoid overthinking. Once the next action is clear, execute it. Do not seek perfect certainty, repeatedly compare alternatives, or revisit settled decisions without new evidence. Use focused tool calls to resolve uncertainty.
|
|
48
|
+
- If repeated fixes fail without new evidence, stop making similar edits. Test your assumptions with a focused check or minimal reproduction, then adjust your approach based on the result.
|
|
49
|
+
- Put complete code, commands, and edit payloads in the tool arguments. Do not draft them in full in your plan if you can execute them directly.
|
|
50
|
+
- Provide text response when it adds value: a brief plan summary for multi-step work, a meaningful progress update, concise task notes, a blocker, or the final result. Routine tool calls need no text preamble. Keep plan summaries and progress updates to one short paragraph, reporting decisions and new evidence rather than internal deliberation.
|
|
51
|
+
- Keep task notes focused on confirmed facts, decisions, and remaining work. Update existing notes when possible instead of repeating the task history.
|
|
52
|
+
- Always use absolute paths when referring to files.
|
|
53
|
+
- You can call multiple tools in a single response. Before using tools, identify every independent read, search, command, or edit needed for the next step and emit all of those tool calls now, either as multiple tool calls or as one batched input for tools that accept arrays. Do not wait for one independent result before requesting another. Do not split independent reads, searches, checks, or edits across separate turns.
|
|
54
|
+
- Good parallelism examples: read all known relevant files in one read_files call; run independent inspection commands in one run_commands call; emit independent read_files, search_codebase, and run_commands calls together in one response; emit multiple editor calls together when editing different files or non-overlapping regions.
|
|
55
|
+
- Always verify the files you have edited or created at the end of the task to ensure they are completed and working as expected.
|
|
56
|
+
|
|
57
|
+
Environment you are running in:
|
|
58
|
+
<env>
|
|
59
|
+
1. Platform: {{PLATFORM_NAME}}
|
|
60
|
+
2. Date: {{CURRENT_DATE}}
|
|
61
|
+
3. IDE: {{IDE_NAME}}
|
|
62
|
+
4. Working Directory: {{CWD}}
|
|
63
|
+
</env>
|
|
64
|
+
|
|
65
|
+
IMPORTANT:
|
|
66
|
+
- When the user describes a bug, unexpected behavior, or provides a bug report, your primary goal is to produce a correct fix in the source code that resolves the issue.
|
|
67
|
+
- A correct fix means the underlying behavior is fixed — not just the symptoms addressed superficially.
|
|
68
|
+
- Verify by execution, never by assumption. Before considering any task done, gather concrete evidence from your own tool output that every requirement is satisfied:
|
|
69
|
+
- If a test suite, tests, or assertions are provided or referenced, run them and confirm they pass. If they fail, analyze the failures, revise, and re-run until they pass.
|
|
70
|
+
- If no tests are provided, construct your own verification: actually run the program, script, or command you produced; confirm every required output file exists at the exact path requested; and confirm its contents match the expected format, data types, and values described in the task. Read the output back to confirm.
|
|
71
|
+
- Treat "this should work", "assume it works", or "probably correct" as a signal that you have NOT verified yet — go run the check instead of finishing.
|
|
72
|
+
- Do not consider the task complete until you have observed evidence that all stated requirements are met.
|
|
73
|
+
- Always includes tool calls in your response until the task is completed. You should only end the task when all the requirements are met by calling the 'submit_and_exit' tool.
|
|
74
|
+
- When you call 'submit_and_exit', set 'verified' to true only if your tool output shows the requirements are met; otherwise set it to false.
|
|
75
|
+
- Response without the submit_and_exit tool call will considered not completed and the task will continue.
|
|
76
|
+
{{CLINE_RULES}}
|
|
77
|
+
{{CLINE_METADATA}}`;var De={ACT:nn,YOLO:on};var He="# Workspace Configuration",an=`# Plan / Act Modes
|
|
78
|
+
|
|
79
|
+
User messages arrive wrapped in a <user_input mode="..."> tag. The mode attribute is the interaction mode the user was in when they sent that message: "plan" means plan-mode constraints applied (explore, analyze, and align on a plan -- no edits or state-changing commands), while "act" (or "yolo") means implementation was allowed. If the mode attribute changes between messages, the user switched modes -- the newest message's mode is what governs right now, regardless of what earlier messages allowed. A <mode_notice> block inside a message marks exactly when such a switch happened.`,ln=`# Plan Mode
|
|
80
|
+
|
|
81
|
+
You are in Plan mode. Your role is to explore, analyze, and plan -- not to execute.
|
|
82
|
+
|
|
83
|
+
- Read files, search the codebase, and gather context to understand the problem
|
|
84
|
+
- Ask clarifying questions when requirements are ambiguous
|
|
85
|
+
- Present your plan as a structured outline with clear steps
|
|
86
|
+
- Explain tradeoffs between different approaches when they exist
|
|
87
|
+
- Do NOT edit files, write code, run destructive commands, or make any changes
|
|
88
|
+
- Do NOT implement anything -- focus on understanding and alignment first
|
|
89
|
+
|
|
90
|
+
The run_commands tool remains available in plan mode strictly for read-only inspection -- listing files, searching (grep), reading configs, inspecting git history and diffs, checking tool versions, and the like. Never use it to change anything: no creating, modifying, or deleting files, no writing scripts that make changes, and no state-changing commands (installs, migrations, database or schema changes, container commands that mutate state, etc.). File-editing commands (rm/mv/cp, in-place edits like sed -i, output redirection to files outside /tmp, git commands that change the working tree, package installs) are hard-blocked in plan mode: they are not executed and return a tool error instead, so do not attempt them. If the task requires a mutation, put it in the plan; it happens only after the user switches to act mode.`,cn=`${ln}
|
|
91
|
+
|
|
92
|
+
Once the user has reviewed your plan and explicitly approved it in a follow-up message, use the switch_to_act_mode tool to switch to act mode and begin implementation. Calling switch_to_act_mode immediately starts execution, so never call it in the same turn you present a plan and never treat the original task request as approval -- end your turn after presenting the plan and wait for the user's response.`,dn=`${ln}
|
|
93
|
+
|
|
94
|
+
Once you have presented your plan, end your turn and wait for the user's response. You do NOT have the ability to switch to act mode yourself -- the user must do it manually with the Plan/Act toggle once they are satisfied with the plan. If the task requires tools that are only available in act mode, ask the user to "toggle to Act mode" (use those words).`;function rs(i){let l=i.indexOf("://");if(l<1)return i;let c=l+3,u=c;while(u<i.length){let f=i[u];if(f==="/"||f==="?"||f==="#"||f.charCodeAt(0)<=32)break;u++}let g=i.lastIndexOf("@",u-1);if(g<c)return i;return i.slice(0,c)+i.slice(g+1)}function Un(i){return JSON.stringify({workspaces:{[i.rootPath]:{hint:i.hint,associatedRemoteUrls:i.associatedRemoteUrls?.map(rs),latestGitCommitHash:i.latestGitCommitHash,latestGitBranchName:i.latestGitBranchName}}},null,2)}function sn(i,l,c){if(c?.trim()?.includes(He))return c.trim();let u=c||JSON.stringify({workspaces:{[i]:{hint:l||i.split("/").at(-1)||i}}},null,2);return`
|
|
95
|
+
${He}
|
|
96
|
+
${u}`}function Ge(i){let{ide:l="Terminal Shell",mode:c,platform:u="unknown",workspaceName:g,metadata:f,rules:h,overridePrompt:x,providerId:b,planModeSwitchTool:T=!0}=i,R=i.workspaceRoot??i.rootPath??"",E=Le(b||"");if(x?.trim()){let A=x.trim();if(E&&f?.trim()&&!A.includes(He))return`${A}
|
|
97
|
+
|
|
98
|
+
${sn(R,g,f)}`.trim();return A}let I=c==="yolo"?De.YOLO:De.ACT,k=[h,c==="yolo"?void 0:an,c==="plan"?T?cn:dn:void 0].filter(Boolean).join(`
|
|
99
|
+
|
|
100
|
+
`);return I.replace("{{PLATFORM_NAME}}",u).replace("{{CWD}}",R).replace("{{CURRENT_DATE}}",new Date().toLocaleDateString()).replace("{{IDE_NAME}}",l).replace("{{CLINE_METADATA}}",E?sn(R,g,f):"").replace("{{CLINE_RULES}}",k).trim()}function Ff(i){return i?.metadata?.apiKeyOptional===!0}function jf(i){let l=i?.metadata?.localCliCommand;if(typeof l!=="string"||!l.trim())return;return{command:l.trim(),docsUrl:i?.docsUrl}}var hr="anthropic/claude-sonnet-5.5";import{createHmac as is}from"node:crypto";import{basename as ss}from"node:path";var ol="enterprise.blobUpload",ge=new Map;function Ue(i,l){return{adapterType:i,accessKeyId:l.accessKeyId,secretAccessKey:l.secretAccessKey,region:l.region,bucket:l.bucket,endpoint:l.endpoint,accountId:l.accountId}}function pn(i){return{adapterType:i.adapterType,bucket:i.bucket,region:i.region,endpoint:i.endpoint,accountId:i.accountId}}function as(i){if(!i||i.enabled!==!0)return;if(i.type==="s3_access_keys"&&i.s3AccessSettings)return Ue("s3",i.s3AccessSettings);if(i.type==="r2_access_keys"&&i.r2AccessSettings)return Ue("r2",i.r2AccessSettings);if(i.type==="azure_access_keys"&&i.azureAccessSettings)return Ue("azure",i.azureAccessSettings);return}function mn(i){return as(i?.enterpriseTelemetry?.promptUploading)}function np(i,l){let c=mn(i);if(!c)return;return{version:1,storage:pn(c),userDistinctId:l}}function ap(i,l,c){let u=mn(l);if(!u){ge.delete(i);return}return ge.set(i,u),{version:1,storage:pn(u),userDistinctId:c}}function $f(i){ge.delete(i)}function xn(i,l,c){let u=`${l}/${c}`;return{async write(g,f){let h=await i.fetch(`${u}/${g}`,{method:"PUT",body:f,headers:{"Content-Type":"application/json; charset=utf-8"}});if(!h.ok)throw Error(`Failed to write ${g}: ${h.status}`)}}}function ls(i){let{bucket:l,accessKeyId:c,secretAccessKey:u}=i;if(!l||!c||!u)return;let g=i.region||"us-east-1",f=i.endpoint||`https://s3.${g}.amazonaws.com`;return xn(new Jm({region:g,accessKeyId:c,secretAccessKey:u}),f,l)}function cs(i){let{accountId:l,endpoint:c,bucket:u,accessKeyId:g,secretAccessKey:f}=i;if(!c&&!l||!u||!g||!f)return;return xn(new Jm({accessKeyId:g,secretAccessKey:f}),i.endpoint??`https://${l}.r2.cloudflarestorage.com`,u)}function ds(i,l,c,u,g){let f=g["Content-Length"]||"",h=g["Content-Type"]||"",x=Object.entries(g).filter(([I])=>I.toLowerCase().startsWith("x-ms-")).sort(([I],[k])=>I.toLowerCase().localeCompare(k.toLowerCase())).map(([I,k])=>`${I.toLowerCase()}:${k}`).join(`
|
|
101
|
+
`),b=`/${i}${u}`,T=[c,"","",f,"",h,"","","","","","",x,b].join(`
|
|
102
|
+
`),R=Buffer.from(l,"base64"),E=is("sha256",R).update(T,"utf8").digest("base64");return`SharedKey ${i}:${E}`}function us(i){let{accessKeyId:l,secretAccessKey:c,bucket:u}=i;if(!l||!c||!u)return;let g=i.endpoint||`https://${l}.blob.core.windows.net`;return{async write(f,h){let x=`/${u}/${f}`,b=new Date().toUTCString(),T=Buffer.from(h,"utf8"),R={"x-ms-date":b,"x-ms-version":"2024-11-04","x-ms-blob-type":"BlockBlob","Content-Type":"application/json; charset=utf-8","Content-Length":T.byteLength.toString()};R.Authorization=ds(l,c,"PUT",x,R);let E=await fetch(`${g}${x}`,{method:"PUT",body:T,headers:R});if(!E.ok){let I=await E.text().catch(()=>"");throw Error(`Failed to write ${f}: ${E.status} ${I}`.trim())}}}}function ps(i){if(i.adapterType==="s3")return ls(i);if(i.adapterType==="r2")return cs(i);if(i.adapterType==="azure")return us(i);return}function un(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}function qf(i){let l=i?.metadata?.[ol];if(!un(l))return;let c=l.storage;if(!un(c))return;let u=c.adapterType;if(u!=="s3"&&u!=="r2"&&u!=="azure")return;if(typeof c.bucket!=="string")return;return{version:1,storage:{adapterType:u,bucket:c.bucket,region:typeof c.region==="string"?c.region:void 0,endpoint:typeof c.endpoint==="string"?c.endpoint:void 0,accountId:typeof c.accountId==="string"?c.accountId:void 0},keyPrefix:typeof l.keyPrefix==="string"?l.keyPrefix:void 0,userDistinctId:typeof l.userDistinctId==="string"?l.userDistinctId:void 0}}function ms(i,l,c){return["sessions",c.userDistinctId?.trim()||"unknown",i,l?.endsWith("messages.json")?"messages.json":ss(l)].filter((f)=>Boolean(f?.trim())).join("/")}function zf(){let i=new Map;return{async uploadMessagesFile({sessionId:l,path:c,contents:u,row:g}){let f=qf(g);if(!f)return;let h=ge.get(l);if(!h)return;let x=JSON.stringify(h),b=i.get(x);if(!b){if(b=ps(h),!b)return;i.set(x,b)}await b.write(ms(l,c,f),u)}}}import H from"node:fs/promises";import Fe from"node:path";async function Ms(i){try{return await H.access(i),!0}catch{return!1}}class qe{filePath;constructor(i){this.filePath=i}async read(){try{return JSON.parse(await H.readFile(this.filePath,"utf8"))}catch(i){if(i.code==="ENOENT")return;throw i}}async write(i){await H.mkdir(Fe.dirname(this.filePath),{recursive:!0}),await H.writeFile(this.filePath,JSON.stringify(i,null,2),"utf8")}async clear(){await H.rm(this.filePath,{force:!0})}}class Ke{async writeText(i,l){await H.mkdir(Fe.dirname(i),{recursive:!0}),await H.writeFile(i,l,"utf8")}async remove(i){await H.rm(i,{recursive:!0,force:!0})}async removeChildren(i){if(!await Ms(i))return;let l=await H.readdir(i);await Promise.all(l.map((c)=>H.rm(Fe.join(i,c),{recursive:!0,force:!0})))}}function $e(i,l,c){return{id:`remote-config:${i}:${c}:${l.name}`,name:l.name,kind:i,contents:l.contents,alwaysEnabled:l.alwaysEnabled}}function bn(i){let l="",c=!1;for(let u of i.trim().toLowerCase()){let g=u.charCodeAt(0);if(g>=97&&g<=122||g>=48&&g<=57||u==="."||u==="_"||u==="-"){if(c&&l&&l[l.length-1]!=="-")l+="-";c=!1,l+=u}else c=!0;if(l.length>=80)break}while(l.endsWith("-"))l=l.slice(0,-1);while(l.startsWith("-"))l=l.slice(1);return l||"item"}function Ns(i){let l=i?.globalRules?.map((u,g)=>$e("rule",u,`${g}`))??[],c=i?.globalWorkflows?.map((u,g)=>$e("workflow",u,`${g}`))??[];return[...l,...c]}function Ls(i){return[...Ns(i.remoteConfig),...i.managedInstructions??[]]}function Ds(i){return i.map((l)=>{let c=`## ${l.name}`,u=l.alwaysEnabled?`_Always enabled_
|
|
103
|
+
`:"";return`${c}
|
|
104
|
+
|
|
105
|
+
${u}${l.contents.trim()}`}).join(`
|
|
106
|
+
|
|
107
|
+
`)}function Ye(i,l){return i.filter((c)=>c.kind===l)}class Je{async materialize(i){let l=Ls(i.bundle),c=Ye(l,"rule"),u=Ye(l,"workflow"),g=Ye(l,"skill");await i.artifactStore.removeChildren(i.paths.workflowsPath),await i.artifactStore.removeChildren(i.paths.skillsPath);let f=[];if(c.length>0)await i.artifactStore.writeText(i.paths.rulesFilePath,Ds(c)),f.push(...c.map((h)=>({kind:h.kind,filePath:i.paths.rulesFilePath,id:h.id,name:h.name})));else await i.artifactStore.remove(i.paths.rulesFilePath);for(let h of u){let x=`${i.paths.workflowsPath}/${bn(h.name.replace(/\.(md|markdown|txt)$/i,""))}.md`;await i.artifactStore.writeText(x,h.contents),f.push({kind:h.kind,filePath:x,id:h.id,name:h.name})}for(let h of g){let x=`${i.paths.skillsPath}/${bn(h.name)}/SKILL.md`;await i.artifactStore.writeText(x,h.contents),f.push({kind:h.kind,filePath:x,id:h.id,name:h.name})}return await i.artifactStore.writeText(i.paths.manifestPath,JSON.stringify({source:i.bundle.source,version:i.bundle.version,files:f},null,2)),{paths:i.paths,rulesFilePath:c.length>0?i.paths.rulesFilePath:void 0,files:f}}}import j from"node:path";var Bs="remote-config";function Cn(i){let l=i.pluginName??Bs,c=j.join(i.workspacePath,".cline",l);return{pluginName:l,pluginPath:c,workflowsPath:j.join(c,"workflows"),skillsPath:j.join(c,"skills"),bundleCachePath:j.join(c,"cache","bundle.json"),manifestPath:j.join(c,"managed.json"),rulesFilePath:j.join(c,"rules.md")}}function Tn(i){return{workflowsDirectories:[i.workflowsPath],skillsDirectories:[i.skillsPath]}}function Hs(i){if(!i)return;return{enabled:i.openTelemetryEnabled??!1,metricsExporter:i.openTelemetryMetricsExporter,logsExporter:i.openTelemetryLogsExporter,otlpProtocol:i.openTelemetryOtlpProtocol,otlpEndpoint:i.openTelemetryOtlpEndpoint,otlpHeaders:i.openTelemetryOtlpHeaders,otlpMetricsProtocol:i.openTelemetryOtlpMetricsProtocol,otlpMetricsEndpoint:i.openTelemetryOtlpMetricsEndpoint,otlpMetricsHeaders:i.openTelemetryOtlpMetricsHeaders,otlpLogsProtocol:i.openTelemetryOtlpLogsProtocol,otlpLogsEndpoint:i.openTelemetryOtlpLogsEndpoint,otlpLogsHeaders:i.openTelemetryOtlpLogsHeaders,metricExportInterval:i.openTelemetryMetricExportInterval,otlpInsecure:i.openTelemetryOtlpInsecure,logBatchSize:i.openTelemetryLogBatchSize,logBatchTimeout:i.openTelemetryLogBatchTimeout,logMaxQueueSize:i.openTelemetryLogMaxQueueSize}}function Rn(i){return typeof i==="object"&&i!==null&&!Array.isArray(i)}function F(i,l){let c=i[l];return typeof c==="string"?c:void 0}function Sn(i,l){let c=i[l];return typeof c==="boolean"?c:void 0}function be(i,l){let c=i[l];return typeof c==="number"&&Number.isFinite(c)?c:void 0}function Qe(i,l){let c=i[l];if(!Rn(c))return;let u=Object.entries(c).filter((g)=>typeof g[1]==="string");return u.length>0?Object.fromEntries(u):void 0}function Us(i){if(!Rn(i))return;let l={enabled:Sn(i,"enabled"),metricsExporter:F(i,"metricsExporter"),logsExporter:F(i,"logsExporter"),otlpProtocol:F(i,"otlpProtocol"),otlpEndpoint:F(i,"otlpEndpoint"),otlpHeaders:Qe(i,"otlpHeaders"),otlpMetricsProtocol:F(i,"otlpMetricsProtocol"),otlpMetricsEndpoint:F(i,"otlpMetricsEndpoint"),otlpMetricsHeaders:Qe(i,"otlpMetricsHeaders"),otlpLogsProtocol:F(i,"otlpLogsProtocol"),otlpLogsEndpoint:F(i,"otlpLogsEndpoint"),otlpLogsHeaders:Qe(i,"otlpLogsHeaders"),metricExportInterval:be(i,"metricExportInterval"),otlpInsecure:Sn(i,"otlpInsecure"),logBatchSize:be(i,"logBatchSize"),logBatchTimeout:be(i,"logBatchTimeout"),logMaxQueueSize:be(i,"logMaxQueueSize")};return Object.values(l).some((c)=>c!==void 0)?l:void 0}class tt{name="remote-config";resolveTelemetry(i,l){return{...Hs(i.remoteConfig),...Us(i.telemetry)}}}function En(i){return i?.claims}function An(i,l){if(!i)return[];if(l.claimsMapper)return l.claimsMapper.mapClaimsToRoles(i);return i.roles??[]}function Fs(i,l){return{...i,metadata:{...i.metadata??{},paths:l}}}class In{options;constructor(i){this.options=i}async sync(i){let l=await this.options.controlPlane.fetchBundle({workspacePath:i.workspacePath,rootPath:i.rootPath,context:i.context,signal:i.signal,now:i.now,logger:this.options.logger});if(!l)throw Error("Remote config control plane returned no bundle");await this.options.bundleStore.write(l);let c=await this.options.materializer.materialize({bundle:l,paths:i.paths,artifactStore:this.options.artifactStore}),u=this.options.telemetryAdapter?await this.options.telemetryAdapter.resolveTelemetry(l,{workspacePath:i.workspacePath,rootPath:i.rootPath,context:i.context,signal:i.signal,now:i.now,logger:this.options.logger}):void 0,g=En(l),f=An(g,this.options);return{bundle:l,materialized:c,telemetry:u,roles:f,claims:g}}}function Vs(i){let l=i?.name??"remote-config";return{name:l,manifest:{capabilities:["providers"]},async setup(c,u){c.registerProvider?.({name:l,description:"Remote-config managed runtime integration"}),await i?.setup?.(c,u)}}}async function Gf(i){let l=Cn({workspacePath:i.workspacePath,pluginName:i.pluginName}),c=i.bundleStore??new qe(l.bundleCachePath),u=i.artifactStore??new Ke,g=i.materializer??new Je,f=i.telemetryAdapter??new tt,h,x,b=[],T,R=!1,E=!1;if(i.controlPlane){let k=new In({controlPlane:i.controlPlane,bundleStore:c,artifactStore:u,materializer:g,telemetryAdapter:f,claimsMapper:i.claimsMapper,logger:i.logger});try{let A=await k.sync({workspacePath:i.workspacePath,rootPath:i.rootPath,context:i.context,paths:l,signal:i.signal,now:i.now});h=A.bundle,x=A.telemetry,b=A.roles,T=A.claims,E=!0}catch(A){if(i.useCachedBundle!==!1)h=await c.read(),R=Boolean(h);if(!h)throw A}}else if(i.useCachedBundle!==!1)h=await c.read(),R=Boolean(h);if(!h&&i.requireBundle)throw Error("Remote config runtime preparation requires a bundle");if(h){let k=Fs(h,l);if(await c.write(k),!E)await g.materialize({bundle:k,paths:l,artifactStore:u});T??=En(k),b=b.length>0?b:An(T,i),x??=await f.resolveTelemetry(k,{workspacePath:i.workspacePath,rootPath:i.rootPath,context:i.context,signal:i.signal,now:i.now,logger:i.logger}),h=k}let I=Tn(l);return{pluginName:l.pluginName,pluginDefinition:Vs({name:l.pluginName}),paths:l,bundle:h,telemetry:x,roles:b,claims:T,usedCachedBundle:R,workflowsDirectories:I.workflowsDirectories,skillsDirectories:I.skillsDirectories}}var Fn=25463,jn=25466;var gr=s(["reasoning","prompt-cache","tools","provider-tools","oauth","temperature","files","streaming","vision","computer-use","local-auth","popular"]),fr=s(["anthropic","gemini","openai-chat","openai-responses","openai-r1","ai-sdk"]),yr=s(["anthropic","ai-sdk","ai-sdk-community","openai","openai-compatible","openai-r1","gemini","bedrock","custom","fetch","vertex"]);import{basename as Gs}from"node:path";var Ce="CLINE_BUILD_ENV",kn="CLINE_DEBUG_HOST",vn="CLINE_DEBUG_PORT_BASE";function _n(i){let l=i?.trim().toLowerCase();if(l==="development"||l==="production")return l;return}function qs(i){for(let l=0;l<i.length;l+=1){let c=i[l]?.trim();if(!c)continue;if(c==="--conditions"&&i[l+1]?.trim()==="development")return!0;if(c.startsWith("--conditions=")&&c.slice(13).split(",").map((u)=>u.trim()).includes("development"))return!0}return!1}function js(i){if(!i?.trim())return!1;let l=Gs(i).toLowerCase();return l==="node"||l==="node.exe"||l==="bun"||l==="bun.exe"}function Ks(i){return i.some((l)=>l==="--inspect"||l.startsWith("--inspect=")||l==="--inspect-brk"||l.startsWith("--inspect-brk="))}function Ws(i){return i.some((l)=>l==="--enable-source-maps")}function $s(i){return i[kn]?.trim()||"127.0.0.1"}function Ys(i){let l=i[vn]?.trim();if(!l)return;let c=Number.parseInt(l,10);return Number.isInteger(c)&&c>0?c:void 0}function Js(i){switch(i){case"rpc":return 0;case"hook":return 1;case"plugin-sandbox":return 2;case"connector":return 3;case"sandbox":return 4;default:return 9}}function re(i={}){let l=i.env??process.env,c=i.execArgv??process.execArgv,u=_n(l[Ce]);if(u)return u;let g=l.NODE_ENV?.trim().toLowerCase();if(g==="production")return"production";if(g==="development")return"development";return qs(c)?"development":"production"}function We(i=process.env,l={}){if(_n(i[Ce]))return i;return{...i,[Ce]:re({env:i,execArgv:l.execArgv})}}function It(i,l={}){if(i.length===0||!js(i[0]))return[...i];if(re(l)!=="development")return[...i];let c=l.env??process.env,u=[...c.NODE_OPTIONS?.split(/\s+/).filter(Boolean)??[],...i.slice(1)],g=[];if(!Ks(u)){let f=$s(c),h=Ys(c),x=h===void 0?0:h+Js(l.debugRole);g.push(`--inspect=${f}:${x}`)}if(!Ws(u))g.push("--enable-source-maps");return[i[0],...g,...i.slice(1)]}function $n(i){let l=i?.trim();if(!l)return!1;if(l.startsWith("/$bunfs/"))return!0;return l.replace(/\\/g,"/").toLowerCase().startsWith("b:/~bun/")}function Xs(){return globalThis}function Hi(){return Xs().__clineClientIdentity}var nt={production:{environment:"production",appBaseUrl:"https://app.cline.bot",apiBaseUrl:"https://api.cline.bot",mcpBaseUrl:"https://api.cline.bot/v1/mcp",workOsClientId:"client_01K3A541FN8TA3EPPHTD2325AR"},staging:{environment:"staging",appBaseUrl:"https://staging-app.cline.bot",apiBaseUrl:"https://core-api.staging.int.cline.bot",mcpBaseUrl:"https://core-api.staging.int.cline.bot/v1/mcp",workOsClientId:"client_01K3A5415VF6QBQBG3XYCW91G6"},local:{environment:"local",appBaseUrl:"http://localhost:3000",apiBaseUrl:"http://localhost:7777",mcpBaseUrl:"http://localhost:7777/v1/mcp",workOsClientId:"client_01K6XQAY7JK6T5HXVSZW2S5VYK"}};function Pn(i){let l=i?.trim().toLowerCase();if(l==="production"||l==="staging"||l==="local")return l;return}function wn(){if(typeof process>"u"||!process?.env)return{};return process.env}function On(){let i=wn();return Pn(i.CLINE_ENVIRONMENT_OVERRIDE)??Pn(i.CLINE_ENVIRONMENT)??"production"}function Zs(i){if(typeof i==="string")return nt[i];return nt[On()]}function Qs(i,l){if(l.CLINE_API_BASE_URL)i={...i,apiBaseUrl:l.CLINE_API_BASE_URL,mcpBaseUrl:`${l.CLINE_API_BASE_URL}/v1/mcp`};return i}function ke(i){let l=Zs(i);return Qs(l,wn())}var ti="CLINE_RUN_AS_HUB_DAEMON";var rl="CLINE_CONNECTOR_STARTING_INSTANCE",sl="CLINE_CONNECTOR_SUPERVISED",Vf="CLINE_HUB_LAUNCHER_CLIENT",Kf="CLINE_HUB_LAUNCHER_VERSION",Hf="CLINE_HUB_LAUNCHER_TRANSPORT";function qn(i,l){if(i.CLINE_HUB_LAUNCHER_CLIENT?.trim())return i;let c=l?.client?.trim();if(!c)return i;let u=l?.version?.trim();return{...i,["CLINE_HUB_LAUNCHER_CLIENT"]:c,...u?{["CLINE_HUB_LAUNCHER_VERSION"]:u}:{},["CLINE_HUB_LAUNCHER_TRANSPORT"]:l?.transport??"local"}}function Qf(i=process.env){let l=Lm(i);return delete i.CLINE_HUB_LAUNCHER_CLIENT,delete i.CLINE_HUB_LAUNCHER_VERSION,delete i.CLINE_HUB_LAUNCHER_TRANSPORT,l}function Lm(i=process.env){let l=i.CLINE_HUB_LAUNCHER_CLIENT?.trim();if(!l)return;let c=i.CLINE_HUB_LAUNCHER_VERSION?.trim(),u=i.CLINE_HUB_LAUNCHER_TRANSPORT?.trim();return{client:l,...c?{version:c}:{},...u==="ssh"||u==="local"?{transport:u}:{}}}var ea;function zt(i){if(i)return i.CLINE_RUN_AS_HUB_DAEMON==="1";return ea??process.env.CLINE_RUN_AS_HUB_DAEMON==="1"}function Jf(i=process.env){let l=i.CLINE_CONNECTOR_STARTING_INSTANCE;if(!l)return;try{let c=JSON.parse(l);if(typeof c.channel!=="string"||!c.channel.trim()||typeof c.instanceId!=="string"||!c.instanceId.trim())return;return{channel:c.channel,instanceId:c.instanceId}}catch{return}}function Eo(i=process.env){let l=i.CLINE_CONNECTOR_CLI_LAUNCH;if(!l)return;try{let c=JSON.parse(l);if(typeof c.launcher!=="string"||!c.launcher.trim()||!Array.isArray(c.connectArgsPrefix)||!c.connectArgsPrefix.every((u)=>typeof u==="string")||typeof c.cwd!=="string"||!c.cwd.trim())return;return{launcher:c.launcher,connectArgsPrefix:c.connectArgsPrefix,cwd:c.cwd}}catch{return}}var ta=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"],Zn=["localhost","127.0.0.1","::1","[::1]"];function na(i){for(let l of ta){let c=i[l]?.trim();if(c)return c}return}function ot(i){return(i??"").split(",").map((l)=>l.trim()).filter((l)=>l.length>0)}function oa(i,l){let c=[],u=new Set;for(let g of[...ot(i),...ot(l),...Zn]){let f=g.toLowerCase();if(f!=="*"&&!u.has(f))u.add(f),c.push(g)}return c.join(",")}function Xn(i){return ot(i).includes("*")}function Xe(i=process.env){if(!na(i))return;let l=Xn(i.NO_PROXY),c=Xn(i.no_proxy);if(l&&c)return;let u=oa(i.NO_PROXY,i.no_proxy);if(!l)i.NO_PROXY=u;if(!c)i.no_proxy=u}var xr="agent.reasoning.unexpected_tokens",br="task.provider_request_started",vr="task.provider_stream_started",wr="task.first_chunk_received",kr="task.provider_stream_failed",Tr="task.cancelled",_r="task.max_tokens_recovery";var zn="sdk.error";var K=new Map;function ra(i,l){let c=typeof l.error_message==="string"?l.error_message:"";return[i,l.component,l.operation,l.error_type,l.error_code??"",l.error_status??"",c.replace(/\d+/g,"#").replace(/\s+/g," ").trim().toLowerCase().slice(0,256)].join("\x00")}function ia(i){let l=Date.now(),c=K.get(i);if(c&&l-c.startMs<3600000){if(c.emitted<5)return c.emitted+=1,{emit:!0,suppressed:0};return c.suppressed+=1,{emit:!1,suppressed:c.suppressed}}let u=c?.suppressed??0;if(K.delete(i),K.size>=512){let g=K.keys().next();if(!g.done)K.delete(g.value)}return K.set(i,{startMs:l,emitted:1,suppressed:0}),{emit:!0,suppressed:u}}function yw(i,l){i?.capture({event:"agent.reasoning.unexpected_tokens",properties:oo({sessionId:l.sessionId,agentId:l.agentId,runId:l.runId,iteration:l.iteration,providerId:l.providerId,modelId:l.modelId,requestedThinking:l.requestedThinking,reasoningTokenCount:l.reasoningTokenCount})})}function B(i,l){if(!i)return!1;let c=l.event??"sdk.error",u=Yf(l),g=0;try{let f=ia(ra(c,u));if(!f.emit)return!0;g=f.suppressed}catch{}return i.capture({event:c,properties:g>0?{...u,suppressed_count:g}:u}),!0}function Yf(i){return oo({...i.context??{},component:i.component,operation:i.operation,severity:i.severity??"error",handled:i.handled??!0,...Xf(i.error,i.messageLimit,i.errorMessage)})}function oo(i){let l={};for(let[c,u]of Object.entries(i))if(u!==void 0)l[c]=u;return l}function Xf(i,l=500,c){let u=to(i)?i:void 0,g=i instanceof Error?i:void 0,f=ee(c)??ee(g?.message)??ee(u?.message)??la(i)??"Unknown error",h=no(u?.code),x=[],b=new Set([i]),T=u?.cause;while(to(T)&&!b.has(T)&&x.length<8)b.add(T),x.push(T),T=T.cause;let R=x.map((I)=>no(I.code)).find((I)=>I!==void 0),E=rt(u?.status)??rt(u?.statusCode)??rt(u?.responseStatus);return{error_type:g?.name?.trim()||ee(u?.name)||g?.constructor?.name||"Error",error_message:aa(sa(f),l),...h!==void 0?{error_code:h}:{},...R!==void 0?{error_cause_code:R}:{},...typeof u?.isRetryable==="boolean"?{error_retryable:u.isRetryable}:{},...E!==void 0?{error_status:E}:{}}}function sa(i){return i.replace(/(authorization=Bearer\s+)[^&\s]+/gi,"$1[redacted]").replace(/(api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|password|secret)=([^&\s]+)/gi,"$1=[redacted]").replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+=*/gi,"$1[redacted]").replace(/\/Users\/[^/\s]+/g,"/Users/[redacted]").replace(/\/home\/[^/\s]+/g,"/home/[redacted]").replace(/([A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s]+/g,"$1[redacted]")}function aa(i,l){let c=Math.max(1,Math.floor(l));return i.length>c?i.substring(0,c):i}function to(i){return typeof i==="object"&&i!==null}function ee(i){return typeof i==="string"&&i.trim().length>0?i:void 0}function la(i){if(i instanceof Error)return;let l=typeof i==="string"?i:String(i);return l==="[object Object]"?void 0:ee(l)}function no(i){if(typeof i==="string"&&i.trim().length>0)return i;if(typeof i==="number"&&Number.isFinite(i))return i;return}function rt(i){return typeof i==="number"&&Number.isFinite(i)?i:void 0}var ro="_clineOtlpTraceRelay";function Gn(i){i[ro]=!0}function io(i){let l={};if(!i)return l;return i.split(",").forEach((c)=>{let u=c.indexOf("=");if(u<=0)return;try{let g=decodeURIComponent(c.substring(0,u).trim()),f=decodeURIComponent(c.substring(u+1).trim());if(!g||!f)return;l[g]=f}catch{}}),l}function ca(){if(!process.env)return{enabled:!1};return{enabled:process.env.OTEL_TELEMETRY_ENABLED==="1"||process.env.OTEL_TELEMETRY_ENABLED==="true",metricsExporter:process.env.OTEL_METRICS_EXPORTER||"otlp",logsExporter:process.env.OTEL_LOGS_EXPORTER||"otlp",tracesExporter:process.env.OTEL_TRACES_EXPORTER,otlpProtocol:process.env.OTEL_EXPORTER_OTLP_PROTOCOL||"http/json",otlpEndpoint:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,metricExportInterval:process.env.OTEL_METRIC_EXPORT_INTERVAL?Number.parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL,10):void 0,otlpHeaders:process.env.OTEL_EXPORTER_OTLP_HEADERS?io(process.env.OTEL_EXPORTER_OTLP_HEADERS):void 0}}function Zf(i={}){return{extension_version:"unknown",cline_type:"unknown",platform:"terminal",platform_version:process?.version||"unknown",os_type:process?.platform||"unknown",os_version:process?.platform==="win32"?process?.env?.OS??"unknown":"unknown",...i}}function Ir(i={}){return{...ca(),...i,metadata:Zf(i.metadata)}}function so(i){let l=i?.trim();return l?l:void 0}function ey(i,l){if(!i)return;let c=typeof i==="function"?i(l):i;if(!c)return;let u=so(c.rootSessionId);if(!u)return;return{rootSessionId:u}}function Vn(i){return so(i?.rootSessionId)}function P(i="",l=""){let c=qw("1234567890abcdefghijklmnopqrstuvwxyz",10);return`${i}${Date.now()}_${c(5)}${l}`}var Sr=["idle","running","pending","completed","failed","cancelled"];var it=["rules","skills","workflows","plugins","hooks"],ao=it,da=new Set(it);function lo(i){return typeof i==="string"&&da.has(i)}function Kn(i){if(!Array.isArray(i))return;let l=i.map((c)=>typeof c==="string"?c.trim():"").filter(lo);return[...new Set(l)]}function _i(i,l){return new Set(i??ao).has(l)}var ua=t({rootPath:e().min(1),hint:e().min(1).optional(),associatedRemoteUrls:o(e().min(1)).optional(),latestGitCommitHash:e().min(1).optional(),latestGitBranchName:e().min(1).optional()}),Ii=t({currentWorkspacePath:e().min(1).optional(),workspaces:d(e().min(1),ua)});function eS(){return{workspaces:{}}}function ys(i,l){let c={...i,workspaces:{...i.workspaces,[l.rootPath]:l}};if(!c.currentWorkspacePath)c.currentWorkspacePath=l.rootPath;return Ii.parse(c)}var cl="workspaces",ll="chat";function gn(i){let l=i.trim(),c=/^[A-Za-z]:[\\/]/.test(l)||l.startsWith("\\\\"),u=l.startsWith("/");if(!c&&!u)return!1;let g=l.split(c?/[\\/]+/:/\/+/).filter(Boolean),f=g.at(-1)??"",h=g.at(-2)??"",x=g.at(-3)??"";return(g.at(-4)??"")===".cline"&&x==="data"&&h==="workspaces"&&f==="chat"}var pa=["current_state","boundary_analysis","interface_proposal"],xs=3600000,bs=240,vs=400,L=je((i)=>i instanceof Date?i.toISOString():i,e().datetime()),W=s(["pending","in_progress","blocked","completed"]),co=s(["queued","running","completed","failed","cancelled","interrupted"]),Te=s(["draft","in_review","finalized"]),ga=t({agentId:e(),role:s(["lead","teammate"]),description:e().optional(),status:s(["idle","running","stopped"])}),Nd=t({agentId:e(),rolePrompt:e(),modelId:e().optional(),maxIterations:n().optional()});function v(i){return je((l)=>l===null?void 0:l,i.optional())}var Ta=t({agentId:e().min(1).describe("Teammate identifier"),rolePrompt:e().min(1).describe("System prompt describing teammate role")}).strict(),_a=t({agentId:e().min(1).describe("Teammate identifier"),reason:v(e().min(1)).describe("Optional shutdown reason")}),Ia=t({}),ma={create:["title","description"],list:[],claim:["taskId"],complete:["taskId","summary"],block:["taskId","reason"]},ws={create:["status","taskId","summary","reason"]},Sa=t({action:s(["create","list","claim","complete","block"]),title:v(e().min(1)).describe("Task title"),description:v(e().min(1)).describe("Task details"),dependsOn:v(o(e().describe("Dependency task ID"))).describe("Array of dependency task IDs"),assignee:v(e().min(1)).describe("Optional assignee"),status:v(s(["pending","in_progress","blocked","completed"])).describe("Optional task status filter"),taskId:v(e()).describe("Task ID"),summary:v(e().min(1)).describe("Completion summary"),reason:v(e().min(1)).describe("Blocking reason")}).superRefine((i,l)=>{for(let c of ma[i.action]){if(i[c]!==void 0)continue;l.addIssue({code:"custom",path:[c],message:`Field "${c}" is required when action=${i.action}`})}}),Ea=t({agentId:e().describe("Teammate agent ID"),task:e().min(1).describe("Task instructions for the teammate"),taskId:v(e()).describe("Optional shared task list ID"),runMode:v(s(["sync","async"])).describe("Execution mode: 'sync' blocks until the teammate finishes and returns the result (default if omitted); 'async' queues the run and returns a runId immediately — use team_await_runs to collect results later."),continueConversation:v(r()).describe("If true, continue the teammate conversation; otherwise start fresh")}),Ra=t({status:v(s(["queued","running","completed","failed","cancelled","interrupted"])).describe("Optional run status filter. Omit to include all statuses."),agentId:v(e().min(1)).describe("Optional teammate ID filter. Omit to include all teammates."),includeCompleted:v(r()).describe("Include completed/failed runs (default true)")}),Oa=t({runId:e().min(1).describe("Run ID"),reason:v(e().min(1)).describe("Optional cancellation reason")}),Aa=t({runId:v(e().min(1)).describe("Optional async run ID to await. Omit to wait for all active async runs.")}).strict(),Ca=t({toAgentId:e().min(1).describe("Recipient agent ID"),subject:e().min(1).describe("Message subject"),body:e().min(1).describe("Message body"),taskId:v(e().min(1)).describe("Optional task ID context")}),Pa=t({subject:e().min(1).describe("Message subject"),body:e().min(1).describe("Message body"),taskId:v(e().min(1)).describe("Optional task ID context")}),Da=t({unreadOnly:v(r()).describe("Only unread messages for read action (default true)")}),Wa=t({kind:s(["progress","handoff","blocked","decision","done","error"]),summary:e().min(1).describe("Update summary"),taskId:v(e().min(1)).describe("Optional task ID context"),evidence:v(o(e().min(1))).describe("Optional evidence links/snippets"),nextAction:v(e().min(1)).describe("Planned next step")}),Ma=t({}),Na=t({title:e().describe("Outcome title"),requiredSections:o(e()).default(pa).describe("Required sections for finalization gate (defaults to current_state,boundary_analysis,interface_proposal)")}),La=t({outcomeId:e().describe("Outcome ID"),section:e().describe("Section name"),sourceRunId:v(e()).describe("Optional source run ID"),content:e().describe("Section fragment content")}),Ba=t({fragmentId:e().describe("Fragment ID"),approved:r().describe("Review decision")}),Ua=t({outcomeId:e().describe("Outcome ID")}),Fa=t({}),ks=t({teamId:e(),teamName:e(),members:o(ga),taskCounts:d(W,n()),unreadMessages:n(),missionLogEntries:n(),activeRuns:n(),queuedRuns:n(),outcomeCounts:d(Te,n())}),fa=t({id:e(),title:e(),description:e(),status:W,createdAt:L,updatedAt:L,createdBy:e(),assignee:e().optional(),dependsOn:o(e()),summary:e().optional(),isReady:r(),blockedBy:o(e())}),Ot=w("action",[t({action:a("create"),taskId:e(),status:W,ignoredFields:o(e()).optional(),note:e().optional()}),t({action:a("list"),tasks:o(fa)}),t({action:a("claim"),taskId:e(),status:W,nextStep:e()}),t({action:a("complete"),taskId:e(),status:W}),t({action:a("block"),taskId:e(),status:W})]),Qi=t({agentId:e(),mode:s(["sync","async"]),status:s(["dispatched","running","queued","joined"]),dispatched:r(),message:e(),deduped:r().optional(),runId:e().optional(),text:e().optional(),iterations:n().optional()}),ya=t({textPreview:e(),iterations:n(),finishReason:e(),durationMs:n(),usage:t({inputTokens:n(),outputTokens:n(),cacheReadTokens:n().optional(),cacheWriteTokens:n().optional(),totalCost:n().optional()})}),Ji=t({id:e(),agentId:e(),taskId:e().optional(),status:co,messagePreview:e(),priority:n(),retryCount:n(),maxRetries:n(),nextAttemptAt:L.optional(),continueConversation:r().optional(),startedAt:L,endedAt:L.optional(),leaseOwner:e().optional(),heartbeatAt:L.optional(),lastProgressAt:L.optional(),lastProgressMessage:e().optional(),currentActivity:e().optional(),error:e().optional(),resultSummary:ya.optional()}),Ts=t({id:e(),teamId:e(),fromAgentId:e(),toAgentId:e(),subject:e(),body:e(),taskId:e().optional(),sentAt:L,readAt:L.optional()}),_s=t({id:e(),teamId:e(),title:e(),status:Te,requiredSections:o(e()),createdBy:e(),createdAt:L,finalizedAt:L.optional()}),Is=t({outcomeId:e(),status:Te,requiredSections:o(e())}),ja=t({agentId:e(),status:e()}),Ss=t({runId:e(),status:co}),Es=t({id:e(),toAgentId:e()}),Rs=t({delivered:n()}),Os=t({id:e()}),As=t({status:e()}),$a=t({fragmentId:e(),status:e()}),Cs=t({outcomeId:e(),status:Te});function ha(i){let{$schema:l,...c}=i;if(typeof c.type==="string")return c;if("properties"in c||"required"in c||"additionalProperties"in c)return{type:"object",...c};for(let u of["oneOf","anyOf","allOf"]){let g=c[u];if(!Array.isArray(g)||g.length===0)continue;if(u==="allOf"){if(g.some((x)=>x&&typeof x==="object"&&x.type==="object"))return{type:"object",...c};throw Error('Tool inputSchema must describe an object at the top level, but the schema has a top-level "allOf" with no branch that asserts type: "object". Add type: "object" to at least one allOf branch to make the object constraint explicit.')}if(g.every((h)=>h&&typeof h==="object"&&h.type==="object"))return{type:"object",...c};throw Error(`Tool inputSchema must describe an object at the top level, but the schema has a top-level "${u}" whose branches include non-object types. Pass the strict object schema as inputSchema and reserve union/coercion schemas for use inside execute().`)}return c}function _(i){let l=ha(i.inputSchema instanceof ie?S(i.inputSchema):i.inputSchema);return{name:i.name,resultPolicy:i.resultPolicy,description:i.description,inputSchema:l,lifecycle:i.lifecycle,successContext:i.successContext,executionMode:i.executionMode,timeoutMs:i.timeoutMs??30000,retryable:i.retryable??!0,maxRetries:i.maxRetries??3,execute:i.execute}}var uo=["401","403","unauthorized","forbidden","invalid token","expired token","authentication"];function Si(i){let l=(i instanceof Error?i.message:String(i)).toLowerCase();return uo.some((c)=>l.includes(c))}import{existsSync as xa,mkdirSync as el,readFileSync as tl,writeFileSync as nl}from"node:fs";import{dirname as il,resolve as al}from"node:path";var dl=new Set(["accesskeyid","secretaccesskey","idtoken","refreshtoken","accesstoken","access_token","refresh_token","apikey","api_key","authorization","password","secret","token","email","displayname","display_name","userinfo"]),pl=["id","balance","cost","secret"];function gl(i){let l=i.toLowerCase();if(dl.has(l))return!0;for(let c of pl){if(l===c)return!0;if(l.endsWith(c)&&l.length>c.length){let u=l[l.length-c.length-1];if(u==="_"||u==="-")return!0;let g=i[i.length-c.length];if(g&&g===g.toUpperCase()&&g!==g.toLowerCase())return!0}if(l.endsWith(`_${c}`))return!0}return!1}var ml=[{pattern:/AKIA[A-Z0-9]{16}/g,replacement:"AKIA_REDACTED"},{pattern:/\/Users\/[A-Za-z0-9._-]+/g,replacement:"/Users/REDACTED_USER"},{pattern:/\/home\/[A-Za-z0-9._-]+/g,replacement:"/home/REDACTED_USER"}];function Co(i){let l=i;for(let{pattern:c,replacement:u}of ml)l=l.replace(c,u);return l}function st(i){if(Array.isArray(i))return i.map(st);if(!i||typeof i!=="object")return i;return Object.fromEntries(Object.entries(i).sort(([l],[c])=>fl(l,c)).map(([l,c])=>[l,st(c)]))}function fl(i,l){if(i<l)return-1;if(i>l)return 1;return 0}function po(i){return JSON.stringify(st(i))}var yl=[{pattern:/tasks\/[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+\/api_conversation_history/g,replacement:"tasks/usr-test/taskid/api_conversation_history"},{pattern:/\/(org|usr|mbr|ses|gen|req|msg|tsk|sch|exe|srv|cli|wkr|evt|sub|tkn)-[A-Za-z0-9]{10,}(?=[/?#]|$)/g,replacement:"/$1-REDACTED"}];function at(i){let l=i;for(let{pattern:c,replacement:u}of yl)l=l.replace(c,u);return l}function J(i){if(i===null||i===void 0)return i;if(typeof i==="string"){try{let l=JSON.parse(i);if(typeof l==="object"&&l!==null)return JSON.stringify(J(l))}catch{}return Co(i)}if(Array.isArray(i))return i.map(J);if(typeof i==="object"){let l={};for(let[c,u]of Object.entries(i))if(gl(c)&&(typeof u==="string"||typeof u==="number"))l[c]="REDACTED";else l[c]=J(u);return l}return i}function hl(i){let l=new URLSearchParams(i),c=Array.from(l.entries());if(c.length===0||c.some(([g])=>g.length===0))return;let u={};for(let[g,f]of c){let h=u[g];if(h===void 0)u[g]=f;else if(Array.isArray(h))h.push(f);else u[g]=[h,f]}return u}function xl(i){return i?.toLowerCase().split(";")[0]?.trim()==="application/x-www-form-urlencoded"}function Ro(i,l){try{return po(J(JSON.parse(i)))}catch{if(xl(l)){let c=hl(i);if(c)return po(J(c))}return Co(i)}}function bl(i,l){let c={...i},u=l&&i.body!==void 0?Ro(i.body,i.requestContentType):void 0;if(delete c.body,delete c.requestContentType,u!==void 0)c.requestBody=u;if(typeof c.path==="string")c.path=at(c.path);if(c.response!==void 0)c.response=J(c.response);return c}function Ao(i){try{let l=new URL(i),c=`${l.protocol}//${l.host}`,u=l.pathname+l.search;return{scope:c,path:u}}catch{return{scope:"",path:i}}}function Po(i){if(typeof i==="string")return i;if(i instanceof URL)return i.toString();if(i&&typeof i.url==="string")return i.url;return String(i)}function Mo(i,l){if(l?.method)return l.method.toUpperCase();if(i&&typeof i.method==="string")return i.method.toUpperCase();return"GET"}function Cl(i){if(!i)return;return new Headers(i).get("content-type")??void 0}function Oo(i,l){let c=Cl(l?.headers);if(c)return c;if(l?.body instanceof URLSearchParams)return"application/x-www-form-urlencoded;charset=UTF-8";if(i instanceof Request)return i.headers.get("content-type")??void 0;return}async function No(i,l){if(l?.body){if(typeof l.body==="string")return l.body;if(l.body instanceof URLSearchParams)return l.body.toString();if(l.body instanceof ArrayBuffer)return new TextDecoder().decode(l.body);if(ArrayBuffer.isView(l.body))return new TextDecoder().decode(new Uint8Array(l.body.buffer,l.body.byteOffset,l.body.byteLength));return}if(i instanceof Request)try{return await i.clone().text()}catch{return}return}function Tl(i){if(!i)return null;if(!process.env.CLINE_VCR_CASSETTE)return process.stderr.write(`[VCR] No CLINE_VCR_CASSETTE: requests will not be recorded or played back.
|
|
108
|
+
`),null;if(i!=="record"&&i!=="playback")process.stderr.write(`[VCR] Invalid CLINE_VCR value: "${i}". Expected "record" or "playback".
|
|
109
|
+
`),process.exit(1);let l=al(process.env.CLINE_VCR_CASSETTE),c=process.env.CLINE_VCR_FILTER??"",u=process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="1"||process.env.CLINE_VCR_INCLUDE_REQUEST_BODY==="true";return{mode:i,cassettePath:l,filter:c,includeRequestBody:u}}function Sl(i,l,c){let u=[],g=[],f=globalThis.fetch;function h(R){if(R.finalized)return;R.finalized=!0;let E=new TextDecoder,I=R.chunks.map((A)=>E.decode(A,{stream:!0})).join("")+E.decode(),k;try{k=JSON.parse(I)}catch{k=I}u.push({scope:R.scope,method:R.method,path:R.path,body:R.body,requestContentType:R.requestContentType,status:R.status,response:k,responseIsBinary:!1,contentType:R.contentType})}globalThis.fetch=Object.assign(async(R,E)=>{let I=Po(R),k=Mo(R,E),{scope:A,path:G}=Ao(I),O=await No(R,E),Q=Oo(R,E),M=await f(R,E);if(l&&!G.includes(l))return M;let oe=M.headers.get("content-type")??void 0;if(!M.body)return u.push({scope:A,method:k,path:G,body:O??"",requestContentType:Q,status:M.status,response:"",responseIsBinary:!1,contentType:oe}),M;let ve={scope:A,method:k,path:G,body:O??"",requestContentType:Q,status:M.status,contentType:oe,chunks:[],finalized:!1};g.push(ve);let zr=M.body,qr=new TransformStream({transform(mt,Kr){ve.chunks.push(mt),Kr.enqueue(mt)},flush(){h(ve)}}),jr=zr.pipeThrough(qr);return new Response(jr,{status:M.status,statusText:M.statusText,headers:M.headers})},{preconnect:(R)=>{}});let x=l?`matching path "*${l}*"`:"all paths";process.stderr.write(`[VCR] Recording HTTP requests (${x}). Cassette will be saved to: ${i}
|
|
110
|
+
`);let b=!1;Em(()=>{if(b)return;b=!0,globalThis.fetch=f;for(let I of g)h(I);if(u.length===0){process.stderr.write(`[VCR] No HTTP requests${l?` matching "${l}"`:""} were recorded.
|
|
111
|
+
`);return}let R=il(i);el(R,{recursive:!0});let E=u.map((I)=>bl(I,c));nl(i,JSON.stringify(E,null,2)),process.stderr.write(`[VCR] Saved ${E.length} recorded HTTP interaction(s) to ${i}
|
|
112
|
+
`)})}function Rl(i){let l=[],c=i.split(/\n\n/);for(let u of c){let g=u.trim();if(g)l.push(`${g}
|
|
113
|
+
|
|
114
|
+
`)}return l}function El(i,l){let c=new TextEncoder,u=0;return new ReadableStream({async pull(g){if(u>=i.length){g.close();return}if(u>0&&l>0)await new Promise((h)=>setTimeout(h,l));let f=i[u];if(f===void 0){g.close();return}g.enqueue(c.encode(f)),u+=1}})}async function Al(i){if(i.recording.requestBody===void 0)return;let l=await No(i.requestInput,i.requestInit),c=Oo(i.requestInput,i.requestInit),u=Ro(l??"",c);if(u!==i.recording.requestBody)throw Error(`[VCR] Request body mismatch for ${i.method} ${i.path}.
|
|
115
|
+
expected: ${i.recording.requestBody}
|
|
116
|
+
actual: ${u}
|
|
117
|
+
Re-record the cassette if the request change is intentional.`)}function Il(i,l){if(!xa(i))process.stderr.write(`[VCR] Cassette file not found: ${i}
|
|
118
|
+
`),process.exit(1);let c=JSON.parse(tl(i,"utf-8")),u=Number.parseInt(process.env.CLINE_VCR_SSE_DELAY??"100",10),g=Array(c.length).fill(!1),f=globalThis.fetch;globalThis.fetch=Object.assign(async(x,b)=>{let T=Po(x),R=Mo(x,b),{path:E}=Ao(T),I=at(E);if(l&&!E.includes(l))return f(x,b);let k=c.findIndex((A,G)=>{if(g[G])return!1;let O=at(A.path);return A.method.toUpperCase()===R&&O===I});if(k>=0){let A=c[k];if(!A)return f(x,b);await Al({recording:A,requestInput:x,requestInit:b,method:R,path:I}),g[k]=!0;let G=typeof A.response==="string"?A.response:JSON.stringify(A.response),O=new Headers;if(A.contentType)O.set("content-type",A.contentType);else if(typeof A.response==="string"&&A.response.trimStart().startsWith("data:"))O.set("content-type","text/event-stream");else if(typeof A.response==="object")O.set("content-type","application/json");let Q=O.get("content-type")?.includes("text/event-stream")??!1;if(Q)O.set("cache-control","no-cache"),O.set("connection","keep-alive");if(Q&&typeof A.response==="string"){let M=Rl(A.response);if(M.length>1){let oe=El(M,u);return new Response(oe,{status:A.status,headers:O})}}return new Response(G,{status:A.status,headers:O})}if(!l)throw Error(`[VCR] No matching recording for ${R} ${T} (path: ${I}). ${c.length} recording(s) loaded from ${i}.`);return f(x,b)},{preconnect:(x)=>{}});let h=l?`(only paths matching "*${l}*", all other requests go through normally)`:"(all requests intercepted)";process.stderr.write(`[VCR] Playing back ${c.length} recorded HTTP interaction(s) from ${i} ${h}
|
|
119
|
+
`)}function ty(i){let l=Tl(i);if(!l)return;if(l.mode==="record")Sl(l.cassettePath,l.filter,l.includeRequestBody);else Il(l.cassettePath,l.filter)}var lt=t({id:e(),name:e(),execution:s(["client","provider"]).optional(),input:m(),output:m(),error:e().optional(),durationMs:n(),startedAt:ri(),endedAt:ri()});var kl=s(["completed","max_iterations","aborted","mistake_limit","error"]),vl=t({inputTokens:n(),outputTokens:n(),cacheReadTokens:n().optional(),cacheWriteTokens:n().optional(),totalCost:n().optional()}),Jd=t({text:e(),usage:vl,messages:o(Y()),toolCalls:o(lt),iterations:n(),finishReason:kl,model:t({id:e(),provider:e(),info:ae.optional()}),startedAt:ri(),endedAt:ri(),durationMs:n()}),Xd=t({distinctId:e().optional(),sessionId:e().optional(),providerId:e(),modelId:e(),apiKey:e().optional(),baseUrl:e().url().optional(),headers:d(e(),e()).optional(),knownModels:d(e(),ae).optional(),providerConfig:m().optional(),initialMessages:o(Y()).optional(),systemPrompt:e(),tools:o(Y()),modelTools:o(Y()).optional(),maxIterations:n().positive().optional(),maxParallelToolCalls:n().int().positive().default(8),maxTokensPerTurn:n().positive().optional(),temperature:n().nonnegative().optional(),apiTimeoutMs:n().positive().default(180000),userFileContentLoader:si().input([e()]).output(rn(e())).optional(),toolContextMetadata:d(e(),m()).optional(),execution:t({maxConsecutiveMistakes:n().int().positive().optional(),reminderAfterIterations:n().nonnegative().optional(),reminderText:e().optional(),loopDetection:p([a(!1),t({softThreshold:n().int().positive().optional(),hardThreshold:n().int().positive().optional()})]).optional()}).optional(),reasoningEffort:Dn.optional(),thinkingBudgetTokens:n().positive().optional(),thinking:r().optional(),onEvent:si().input([Y()]).output(zs()).optional(),hooks:Y().optional(),parentAgentId:e().optional(),extensions:o(Y()).optional(),hookErrorMode:s(["ignore","throw"]).default("ignore"),toolPolicies:d(e(),t({enabled:r().optional(),autoApprove:r().optional()})).optional(),requestToolApproval:si().input([t({sessionId:e(),agentId:e(),conversationId:e(),iteration:n(),toolCallId:e(),toolName:e(),input:m(),policy:t({enabled:r().optional(),autoApprove:r().optional()}).default({})})]).output(p([t({approved:r(),reason:e().optional()}),rn(t({approved:r(),reason:e().optional()}))])).optional(),onConsecutiveMistakeLimitReached:si().input([t({iteration:n().int().positive(),consecutiveMistakes:n().int().positive(),maxConsecutiveMistakes:n().int().positive(),reason:s(["api_error","invalid_tool_call","tool_execution_failed"]),details:e().optional()})]).output(p([t({action:a("continue"),guidance:e().optional()}),t({action:a("stop"),reason:e().optional()}),rn(p([t({action:a("continue"),guidance:e().optional()}),t({action:a("stop"),reason:e().optional()})]))])).optional(),logger:Y().optional(),extensionContext:Y().optional(),abortSignal:Y().optional()});var Lo=s(["connector.started","connector.stopping","session.authorize","message.received","message.denied","message.completed","message.failed","session.started","session.reused","session.reset","schedule.delivery.started","schedule.delivery.sent","schedule.delivery.failed"]),Do=t({id:e().optional(),label:e().optional(),role:e().optional(),participantKey:e().optional(),participantLabel:e().optional(),platformUserId:e().optional(),metadata:d(e(),m()).optional()}),Bo=t({source:e(),sourceEvent:e(),threadId:e(),channelId:e(),isDM:r(),sessionId:e().optional(),workspaceRoot:e().optional(),metadata:d(e(),m()).optional()}),_l=t({actor:Do,context:Bo,payload:d(e(),m()).optional()}),Pl=t({action:s(["allow","deny"]).default("allow"),message:e().optional(),reason:e().optional(),metadata:d(e(),m()).optional()}),Ml=t({adapter:e(),botUserName:e().optional(),event:Lo,payload:d(e(),m()),ts:e()});function Bf(i){if(i instanceof Error)return i.message;return String(i)}function Uf(i){if(i&&typeof i==="object"&&"code"in i&&typeof i.code==="string")return i.code;return""}var Ho=t({id:e(),temperature:n().optional(),maxTokens:n().optional(),contextWindow:n().optional(),inputPrice:n().optional(),outputPrice:n().optional(),supportsImages:r().optional()}),Uo=t({models:o(Ho).optional(),openAiBaseUrl:e().optional(),openAiHeaders:d(e(),e()).optional(),azureApiVersion:e().optional(),azureIdentity:r().optional()}),Fo=t({id:e(),thinkingBudgetTokens:n().optional()}),Vo=t({name:e(),baseModelId:e(),thinkingBudgetTokens:n().optional()}),Go=t({models:o(Fo).optional(),customModels:o(Vo).optional(),awsRegion:e().optional(),awsUseCrossRegionInference:r().optional(),awsUseGlobalInference:r().optional(),awsBedrockUsePromptCache:r().optional(),awsBedrockEndpoint:e().optional()}),zo=t({id:e()}),qo=t({models:o(zo).optional()}),jo=t({id:e(),thinkingBudgetTokens:n().optional()}),Ko=t({models:o(jo).optional(),vertexProjectId:e().optional(),vertexRegion:e().optional()}),Wo=t({id:e(),thinkingBudgetTokens:n().optional(),promptCachingEnabled:r().optional()}),$o=t({models:o(Wo).optional(),baseUrl:e().optional()}),Yo=t({id:e(),thinkingBudgetTokens:n().optional()}),Jo=t({models:o(Yo).optional(),baseUrl:e().optional()}),wl=t({OpenAiCompatible:Uo.optional(),AwsBedrock:Go.optional(),Cline:qo.optional(),Vertex:Ko.optional(),LiteLLM:$o.optional(),Anthropic:Jo.optional()}),Xo=t({id:e()}),Zo=t({name:e(),url:e(),alwaysEnabled:r().optional(),headers:d(e(),e()).optional()}),ct=t({alwaysEnabled:r(),name:e(),contents:e()}),Se=t({bucket:e(),accessKeyId:e(),secretAccessKey:e(),region:e().optional(),endpoint:e().optional(),accountId:e().optional()}),Qo=t({enabled:r().optional(),type:p([a("s3_access_keys"),a("r2_access_keys"),a("azure_access_keys")]).optional(),s3AccessSettings:Se.optional(),r2AccessSettings:Se.optional(),azureAccessSettings:Se.optional()}),er=t({promptUploading:Qo.optional()}),Ol=t({version:e(),providerSettings:wl.optional(),telemetryEnabled:r().optional(),kanbanEnabled:r().optional(),mcpMarketplaceEnabled:r().optional(),allowedMCPServers:o(Xo).optional(),remoteMCPServers:o(Zo).optional(),blockPersonalRemoteMCPServers:r().optional(),yoloModeAllowed:r().optional(),openTelemetryEnabled:r().optional(),openTelemetryMetricsExporter:e().optional(),openTelemetryLogsExporter:e().optional(),openTelemetryOtlpProtocol:e().optional(),openTelemetryOtlpEndpoint:e().optional(),openTelemetryOtlpHeaders:d(e(),e()).optional(),openTelemetryOtlpMetricsProtocol:e().optional(),openTelemetryOtlpMetricsEndpoint:e().optional(),openTelemetryOtlpMetricsHeaders:d(e(),e()).optional(),openTelemetryOtlpLogsProtocol:e().optional(),openTelemetryOtlpLogsEndpoint:e().optional(),openTelemetryOtlpLogsHeaders:d(e(),e()).optional(),openTelemetryMetricExportInterval:n().optional(),openTelemetryOtlpInsecure:r().optional(),openTelemetryLogBatchSize:n().optional(),openTelemetryLogBatchTimeout:n().optional(),openTelemetryLogMaxQueueSize:n().optional(),enterpriseTelemetry:er.optional(),globalRules:o(ct).optional(),globalWorkflows:o(ct).optional()}),Nl=d(e(),e());import{existsSync as te,readdirSync as Ll}from"node:fs";import{basename as Nr,dirname as Lr,join as Dr}from"node:path";var Dl=/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,Bl=" ";function Pr(i){return i.normalize("NFC").replace(Dl," ")}function Hl(i){let l=Nr(i),c=l.replace(/ (AM|PM)\./gi,`${Bl}$1.`);return c===l?i:Dr(Lr(i),c)}function Ul(i){return i.normalize("NFD")}function Mr(i){return i.replace(/'/g,"’")}function Fl(i){let l=Lr(i),c=Pr(Nr(i));try{for(let u of Ll(l))if(Pr(u)===c)return Dr(l,u)}catch{}return}function qa(i){if(te(i))return i;let l=Hl(i);if(l!==i&&te(l))return l;let c=Ul(i);if(c!==i&&te(c))return c;let u=Mr(i);if(u!==i&&te(u))return u;let g=Mr(c);if(g!==c&&g!==u&&te(g))return g;return Fl(i)}import{appendFileSync as Vl,existsSync as D,mkdirSync as ut,readdirSync as Gl,readFileSync as Br,statSync as X}from"node:fs";import{homedir as zl}from"node:os";import{basename as ql,dirname as Ee,extname as jl,isAbsolute as Kl,join as C,relative as Wl,resolve as U}from"node:path";var pt=".clinerules",Ae=".cline",$l=".claude",Ie=".agents",Yl=Ie,Bm="agents",op="hooks",Ze="skills",Um="rules",Yi="workflows",dt="plugins",ht="AGENTS.md",Gt="plugin.json";function za(){return C(Z(),cl,ll)}var iy="cline_mcp_settings.json",ny="settings.json";function Jl(){let i=process?.env?.HOME?.trim();if(i&&i!=="~")return i;let l=process?.env?.USERPROFILE?.trim();if(l)return l;let c=process?.env?.HOMEDRIVE?.trim(),u=process?.env?.HOMEPATH?.trim();if(c&&u)return`${c}${u}`;let g=zl().trim();if(g&&g!=="~")return g;return"~"}var V=Jl(),Hr=!1;function xw(i){let l=i.trim();if(!l)return;V=l,Hr=!0}function Ga(i){if(Hr)return;let l=i.trim();if(!l)return;V=l}var Re,Ur=!1;function bw(i){let l=i.trim();if(!l)return;Re=l,Ur=!0}function vw(i){if(Ur)return;let l=i.trim();if(!l)return;Re=l}function At(){if(Re)return Re;let i=process.env.CLINE_DIR?.trim();if(i)return i;return C(V,".cline")}function ay(){return C(V,"Documents","Cline")}function Ei(i){return C(ay(),i)}function Z(){let i=process.env.CLINE_DATA_DIR?.trim();if(i)return i;return C(At(),"data")}function Ve(){let i=process.env.CLINE_SESSION_DATA_DIR?.trim();if(i)return i;return C(Z(),"sessions")}function fn(){let i=process.env.CLINE_TEAM_DATA_DIR?.trim();if(i)return i;return C(Z(),"teams")}function Hn(){let i=process.env.CLINE_CONNECTOR_DATA_DIR?.trim();if(i)return i;return C(Z(),"connectors")}function Ps(i,l){let c=i.replace(/[^a-zA-Z0-9._-]+/g,"_"),u=l.replace(/[^a-zA-Z0-9._-]+/g,"_");return C(Z(),"logs","connectors",c,`${u}.log`)}function rp(){let i=process.env.CLINE_CONNECTOR_SETTINGS_PATH?.trim();if(i)return i;return C(Hn(),ny)}function xe(){let i=process.env.CLINE_DB_DATA_DIR?.trim();if(i)return i;return C(Z(),"db")}function sp(){let i=process.env.CLINE_CONNECTORS_DB_PATH?.trim();if(i)return i;return C(xe(),"connectors.db")}function Va(){let i=process.env.CLINE_CRON_DB_PATH?.trim();if(i)return i;return C(xe(),"cron.db")}function Ka(){let i=process.env.CLINE_TASKS_DB_PATH?.trim();if(i)return i;return C(xe(),"tasks.db")}function Ha(){return C(At(),"schedules")}function oy(){return C(At(),"tasks")}function ry(i){let l=i.trim();if(!l)throw Error("workspaceRoot is required for workspace task scope");return C(l,".cline","tasks")}function Qa(i){let l=i.taskSpecsDir?.trim();if(l)return l;if(i.scope==="workspace")return ry(i.workspaceRoot??"");return oy()}function sy(){return C(At(),"cron")}function Fm(i){return C(i,".cline","cron")}function Nt(i){if(typeof i==="string")return Fm(i);if(i?.cronSpecsDir?.trim())return i.cronSpecsDir.trim();if(i?.scope==="workspace"){let l=i.workspaceRoot?.trim();if(!l)throw Error("workspaceRoot is required for workspace cron scope");return Fm(l)}return sy()}function Ja(i){return C(Nt(i),"reports")}function ww(i){return C(Nt(i),"events")}function Ya(){let i=process.env.CLINE_PROVIDER_SETTINGS_PATH?.trim();if(i)return i;return C(Z(),"settings","providers.json")}function ii(){let i=process.env.CLINE_GLOBAL_SETTINGS_PATH?.trim();if(i)return i;return C(Z(),"settings","global-settings.json")}function yn(){let i=process.env.CLINE_MCP_SETTINGS_PATH?.trim();if(i)return i;return C(Z(),"settings",iy)}function q(i){let l=new Set,c=[];for(let u of i){if(!u||l.has(u))continue;l.add(u),c.push(u)}return c}function Xl(i){if(!i)return[];return[pt,Ae,$l,Ie].map((l)=>C(i,l,Ze))}function cy(){return C(At(),Bm)}function Xa(i){return q([i?C(i,Ae,Bm):"",cy()])}function Er(i){let l=[Ei("Hooks"),C(At(),op)];if(i)l.push(C(i,pt,op),C(i,Ae,op));return q(l)}function Rr(i){return q([...Xl(i),C(At(),Ze),C(V,Ie,Ze)])}function Qn(){return C(V,Ie,ht)}function ly(i){return[C(i,pt),C(i,Ae,Um)]}function Zl(){let i=[];for(let l of["OneDrive","OneDriveConsumer","OneDriveCommercial"]){let c=process.env[l]?.trim();if(c)i.push(C(c,"Documents"))}return i}function uy(){return q([C(At(),Um),C(V,"Cline","Rules"),Ei("Rules"),...Zl().map((i)=>C(i,"Cline","Rules"))])}function Or(i){let l=i?ly(i):[],c=i?[C(i,ht)]:[];return q([...c,...l,Qn(),...uy()])}function Ar(i){return q([i?C(i,".clinerules",Yi):"",Ei("Workflows"),C(At(),Yi),i?C(i,".cline",Yi):""])}function Za(i){return q([i?C(i,".cline",dt):"",C(At(),dt),Ei("Plugins")])}function eo(){return[C(V,Yl,dt)]}var Fr=new Set([".js",".ts"]),gt="package.json",Ql=["index.ts","index.js"],ec=new Set(["node_modules"]);function cp(i){try{return X(C(i,Gt)).isFile()}catch{return!1}}function Jn(i){let l=i.lastIndexOf(".");if(l===-1)return!1;return Fr.has(i.slice(l))}function Vr(i){try{let l=JSON.parse(Br(i,"utf8"));if(!l.cline||typeof l.cline!=="object")return null;return l.cline}catch{return null}}function Gr(i){let l=i?.plugins;if(!Array.isArray(l))return[];return l.flatMap((c)=>c.paths??[])}function ul(i){let l=U(i);if(!D(l)||!X(l).isDirectory())return null;if(cp(l))return null;let c=C(l,gt);if(D(c)){let u=Vr(c),g=Gr(u).map((f)=>U(l,f)).filter((f)=>D(f)&&X(f).isFile()&&Jn(f));if(g.length>0)return g}for(let u of Ql){let g=C(l,u);if(D(g)&&X(g).isFile())return[g]}return null}function tc(i){try{let l=JSON.parse(Br(i,"utf8"));return typeof l.name==="string"&&l.name.trim()?l.name.trim():void 0}catch{return}}function nc(i,l){let c=Wl(U(i),U(l));return c===""||!c.startsWith("..")&&!Kl(c)}function Xi(i,l){let c=Ee(i),u=U(l);while(nc(u,c)){let g=C(c,gt);if(D(g)){let h=tc(g);if(h)return h;break}let f=U(c,"..");if(f===c)break;c=f}return ql(i,jl(i))}function Yn(i){let l=U(i);if(!D(l))return[];if(cp(l))return[];let c=[],u=[l];while(u.length>0){let g=u.pop();if(!g)continue;let f;try{f=Gl(g,{withFileTypes:!0})}catch{continue}for(let h of f){let x=C(g,h.name);if(h.isDirectory()){if(cp(x))continue;if(ec.has(h.name)||h.name.startsWith("."))continue;let b=C(x,gt);if(D(b)){let T=Vr(b),R=Gr(T).map((E)=>U(x,E)).filter((E)=>D(E)&&X(E).isFile()&&Jn(E));if(R.length>0){c.push(...R);continue}}u.push(x);continue}if(h.name.startsWith("."))continue;if(h.isFile()&&Jn(x))c.push(x)}}return c.sort((g,f)=>g.localeCompare(f))}function ni(i,l){let c=[];for(let u of i){let g=u.trim();if(!g)continue;let f=U(l,g);if(!D(f))throw Error(`Plugin path does not exist: ${f}`);if(X(f).isDirectory()){let x=ul(f);if(x){c.push(...x);continue}c.push(...Yn(f));continue}if(!Jn(f))throw Error(`Plugin file must use a supported extension (${[...Fr].join(", ")}): ${f}`);c.push(f)}return c}function Cr(i){let l=Ee(i);if(!D(l))ut(l,{recursive:!0})}function kw(i){ut(Ee(i),{recursive:!0}),Vl(i,"")}function et(i){if(i?.trim())return Cr(i),Ee(i);let l=C(Z(),"logs");if(!D(l))ut(l,{recursive:!0});return l}export{Zt,Dn,mo,ho,go,fo,Df,yo,tr,ir,nr,mi,xo,ar,or,rr,bo,Em,Rm,Om,Ut,sr,Rt,Ft,Ti,Wf,Mf,ba,zi,va,wa,hs,Mt,gs,pe,fe,ka,fs,ei,vo,Am,Cm,Pm,Dm,Wm,Mm,Nm,cr,Nf,ye,wo,me,Wn,lr,hn,Lf,ko,To,_o,ur,Mn,fw,Gi,jt,Io,Nn,pr,Ln,ze,Be,Vi,Bf,Uf,$t,ne,qt,_t,So,Ki,dr,mr,Bn,he,y,S,Un,Ge,Ff,jf,hr,ol,np,ap,$f,qf,zf,Gf,Fn,jn,gr,fr,yr,re,We,It,$n,Hi,ke,ti,rl,sl,Vf,Kf,Hf,qn,Qf,Lm,zt,Jf,Eo,Xe,xr,br,vr,wr,kr,Tr,_r,zn,yw,B,Yf,Xf,Gn,Zf,Ir,ey,Vn,P,Sr,Kn,_i,Ii,eS,ys,cl,ll,gn,xs,bs,vs,Ta,_a,Ia,ws,Sa,Ea,Ra,Oa,Aa,Ca,Pa,Da,Wa,Ma,Na,La,Ba,Ua,Fa,ks,Ot,Qi,Ji,Ts,_s,Is,ja,Ss,Es,Rs,Os,As,$a,Cs,_,Si,ty,qa,Bm,op,Ze,Um,Yi,ht,Gt,za,iy,ny,xw,Ga,bw,vw,At,ay,Ei,Z,Ve,fn,Hn,Ps,rp,xe,sp,Va,Ka,Ha,oy,ry,Qa,sy,Fm,Nt,Ja,ww,Ya,ii,yn,cy,Xa,Er,Rr,Qn,ly,uy,Or,Ar,Za,eo,cp,Jn,ul,Xi,Yn,ni,Cr,kw,et};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{F,ve,lt,b,H,Q,I,Te,j,bn,Ct,Kt,Se,ge,C,vl,Po,Ee,ft,Km,u,l,k,A,vn,Lr,G,ee,oe,qe,E,te,yc,He}from"./index-6k6ep10s.js";import{e,n,r,L,o,t,p,w,d,s,a,Fe}from"./index-mcnngj50.js";var ae=t({messages:o(Fe()).nullish(),cached_tokens:n().nullish(),audio_tokens:n().nullish()}).catchall(Fe()),we=t({reasoning_tokens:n().nullish()}).catchall(Fe()),se=t({prompt_tokens:n(),completion_tokens:n(),total_tokens:n(),prompt_audio_seconds:n().nullish(),request_count:n().nullish(),service_tier:e().nullish(),num_cached_tokens:n().nullish(),prompt_tokens_details:ae.nullish(),prompt_token_details:ae.nullish(),completion_tokens_details:we.nullish()}).catchall(Fe());function W(g){if(g==null)return Ct();let{prompt_tokens:i,completion_tokens:m}=g,S=g.num_cached_tokens??g.prompt_tokens_details?.cached_tokens??g.prompt_token_details?.cached_tokens??0;return{inputTokens:{total:i,noCache:i-S,cacheRead:S||void 0,cacheWrite:void 0},outputTokens:{total:m,text:m,reasoning:void 0},raw:g}}function ie({part:g}){if(g.data.type==="url")return g.data.url.toString();if(g.data.type==="data")return`data:${ee({part:g})};base64,${j(g.data.data)}`;throw new b({functionality:`file part data type ${g.data.type}`})}function ne(g){let i=[];for(let m=0;m<g.length;m++){let{role:S,content:v}=g[m],c=m===g.length-1;switch(S){case"system":i.push({role:"system",content:v});break;case"user":i.push({role:"user",content:v.map((y)=>{switch(y.type){case"text":return{type:"text",text:y.text};case"file":switch(y.data.type){case"reference":throw new b({functionality:"file parts with provider references"});case"text":throw new b({functionality:"text file parts"});case"url":case"data":if(ge(y.mediaType)==="image")return{type:"image_url",image_url:ie({part:y})};else{if(y.data.type==="data"){if(ee({part:y})!=="application/pdf")throw new b({functionality:"Only images and PDF file parts are supported"})}else if(y.mediaType!=="application/pdf")throw new b({functionality:"Only images and PDF file parts are supported"});return{type:"document_url",document_url:ie({part:y})}}}}})});break;case"assistant":{let y="",x=!1,h=[],f=[];for(let _ of v)switch(_.type){case"text":y+=_.text,h.push({type:"text",text:_.text});break;case"tool-call":f.push({id:_.toolCallId,type:"function",function:{name:_.toolName,arguments:JSON.stringify(_.input)}});break;case"reasoning":x=!0,h.push({type:"thinking",thinking:[{type:"text",text:_.text}],closed:!0});break;default:throw Error(`Unsupported content type in assistant message: ${_.type}`)}i.push({role:"assistant",content:x?h:y,prefix:c?!0:void 0,tool_calls:f.length>0?f:void 0});break}case"tool":for(let y of v){if(y.type==="tool-approval-response")continue;let x=y.output,h;switch(x.type){case"text":case"error-text":h=x.value;break;case"execution-denied":h=x.reason??"Tool call execution denied.";break;case"content":case"json":case"error-json":h=JSON.stringify(x.value)}i.push({role:"tool",name:y.toolName,tool_call_id:y.toolCallId,content:h})}break;default:throw Error(`Unsupported role: ${S}`)}}return i}function re(g){switch(g){case"stop":return"stop";case"length":case"model_length":return"length";case"tool_calls":return"tool-calls";case"error":return"error";default:return"other"}}var de=()=>t({safePrompt:r().optional(),documentImageLimit:n().optional(),documentPageLimit:n().optional(),structuredOutputs:r().optional(),strictJsonSchema:r().optional(),parallelToolCalls:r().optional(),promptCacheKey:e().optional(),reasoningEffort:s(["high","none"]).optional()}),xe=u(()=>l(de())),Ce=u(()=>l(t({object:a("error"),message:e(),type:e(),param:e().nullable(),code:e().nullable()}))),B=oe({errorSchema:Ce,errorToMessage:(g)=>g.message});function ke({tools:g,toolChoice:i}){g=g?.length?g:void 0;let m=[];if(g==null)return{tools:void 0,toolChoice:void 0,toolWarnings:m};let S=[];for(let c of g)if(c.type==="provider")m.push({type:"unsupported",feature:`provider-defined tool ${c.id}`});else S.push({type:"function",function:{name:c.name,description:c.description,parameters:c.inputSchema,...c.strict!=null?{strict:c.strict}:{}}});if(i==null)return{tools:S,toolChoice:void 0,toolWarnings:m};let v=i.type;switch(v){case"auto":case"none":return{tools:S,toolChoice:v,toolWarnings:m};case"required":return{tools:S,toolChoice:"any",toolWarnings:m};case"tool":return{tools:S.filter((c)=>c.function.name===i.toolName),toolChoice:"any",toolWarnings:m};default:throw new b({functionality:`tool choice type: ${v}`})}}var Ie=new Set(["codestral-2508","codestral-latest","ministral-14b-2512","ministral-14b-latest","ministral-3b-2512","ministral-3b-latest","ministral-8b-2512","ministral-8b-latest","mistral-code-fim-latest","mistral-code-latest","mistral-large-latest","mistral-large-2512","voxtral-small-2507","voxtral-small-latest"]),je=class g{static[H](i){return te({modelId:i.modelId,config:i.config})}static[Q](i){return new g(i.modelId,i.config)}constructor(i,m){this.specificationVersion="v4",this.supportedUrls={"application/pdf":[/^https:\/\/.*$/]},this.modelId=i,this.config=m,this.generateId=m.generateId??C}get provider(){return this.config.provider}async getArgs({prompt:i,maxOutputTokens:m,temperature:S,topP:v,topK:c,frequencyPenalty:y,presencePenalty:x,reasoning:h,stopSequences:f,responseFormat:_,seed:T,providerOptions:P,tools:V,toolChoice:D}){let U=[],R=await k({provider:"mistral",providerOptions:P,schema:xe})??{};if(c!=null)U.push({type:"unsupported",feature:"topK"});let K=!Ie.has(this.modelId),O;if(K)O=R.reasoningEffort??(Ee(h)?h==="none"?"none":ft({reasoning:h,effortMap:{minimal:"high",low:"high",medium:"high",high:"high",xhigh:"high",max:"high"},warnings:U}):void 0);else if(Ee(h))U.push({type:"unsupported",feature:"reasoning",details:"This model does not support reasoning configuration."});let q=R.structuredOutputs??!0,M=R.strictJsonSchema??!1;if(_?.type==="json"&&(!q||_.schema==null))i=vl({messages:i,schema:_.schema});let N={model:this.modelId,safe_prompt:R.safePrompt,max_tokens:m,temperature:S,top_p:v,...y!=null?{frequency_penalty:y}:{},...x!=null?{presence_penalty:x}:{},stop:f,random_seed:T,reasoning_effort:O,response_format:_?.type==="json"?q&&_?.schema!=null?{type:"json_schema",json_schema:{schema:_.schema,strict:M,name:_.name??"response",description:_.description}}:{type:"json_object"}:void 0,document_image_limit:R.documentImageLimit,document_page_limit:R.documentPageLimit,...R.promptCacheKey!==void 0?{prompt_cache_key:R.promptCacheKey}:{},messages:ne(i)},{tools:J,toolChoice:Y,toolWarnings:X}=ke({tools:V,toolChoice:D});return{args:{...N,tools:J,tool_choice:Y,...J!=null&&R.parallelToolCalls!==void 0?{parallel_tool_calls:R.parallelToolCalls}:{}},warnings:[...U,...X]}}async doGenerate(i){let{args:m,warnings:S}=await this.getArgs(i),{responseHeaders:v,value:c,rawValue:y}=await A({url:`${this.config.baseURL}/chat/completions`,headers:I(this.config.headers?.(),i.headers),body:m,failedResponseHandler:B,successfulResponseHandler:E(Me),abortSignal:i.abortSignal,fetch:this.config.fetch}),x=c.choices[0],h=[];if(x.message.content!=null&&Array.isArray(x.message.content)){for(let f of x.message.content)if(f.type==="thinking"){let _=le(f.thinking);if(_.length>0)h.push({type:"reasoning",text:_})}else if(f.type==="text"){if(f.text.length>0)h.push({type:"text",text:f.text})}}else{let f=ce(x.message.content);if(f!=null&&f.length>0)h.push({type:"text",text:f})}if(x.message.tool_calls!=null)for(let f of x.message.tool_calls)h.push({type:"tool-call",toolCallId:f.id,toolName:f.function.name,input:f.function.arguments});return{content:h,finishReason:{unified:re(x.finish_reason),raw:x.finish_reason??void 0},usage:W(c.usage),request:{body:m},response:{...bn(c),headers:v,body:y},warnings:S}}async doStream(i){let{args:m,warnings:S}=await this.getArgs(i),v={...m,stream:!0},{responseHeaders:c,value:y}=await A({url:`${this.config.baseURL}/chat/completions`,headers:I(this.config.headers?.(),i.headers),body:v,failedResponseHandler:B,successfulResponseHandler:qe(Re),abortSignal:i.abortSignal,fetch:this.config.fetch}),x={unified:"interrupted",raw:void 0},h=void 0,f=!0,_=!1,T=null,P,V=this.generateId;return{stream:y.pipeThrough(new TransformStream({start(D){P=new yc(D,{generateId:V}),D.enqueue({type:"stream-start",warnings:S})},transform(D,U){if(i.includeRawChunks)U.enqueue({type:"raw",rawValue:D.rawValue});if(!D.success){x={unified:"error",raw:void 0},U.enqueue({type:"error",error:D.error});return}let R=D.value;if(f)f=!1,U.enqueue({type:"response-metadata",...bn(R)});if(R.usage!=null)h=R.usage;let K=R.choices[0],O=K.delta,q=ce(O.content);if(O.content!=null&&Array.isArray(O.content)){for(let M of O.content)if(M.type==="thinking"){let N=le(M.thinking);if(N.length>0){if(T==null){if(_)U.enqueue({type:"text-end",id:"0"}),_=!1;T=V(),U.enqueue({type:"reasoning-start",id:T})}U.enqueue({type:"reasoning-delta",id:T,delta:N})}}}if(q!=null&&q.length>0){if(!_){if(T!=null)U.enqueue({type:"reasoning-end",id:T}),T=null;U.enqueue({type:"text-start",id:"0"}),_=!0}U.enqueue({type:"text-delta",id:"0",delta:q})}if(O?.tool_calls!=null)for(let M of O.tool_calls)P.processDelta(M);if(K.finish_reason!=null)x={unified:re(K.finish_reason),raw:K.finish_reason}},flush(D){if(T!=null)D.enqueue({type:"reasoning-end",id:T});if(_)D.enqueue({type:"text-end",id:"0"});P.flush(),D.enqueue({type:"finish",finishReason:x,usage:W(h)})}})),request:{body:v},response:{headers:c}}}};function le(g){return g.filter((i)=>i.type==="text").map((i)=>i.text).join("")}function ce(g){if(typeof g==="string")return g;if(g==null)return;let i=[];for(let m of g){let{type:S}=m;switch(S){case"text":i.push(m.text);break;case"thinking":case"image_url":case"reference":break;default:throw Error(`Unsupported type: ${S}`)}}return i.length?i.join(""):void 0}var pe=()=>p([e(),o(w("type",[t({type:a("text"),text:e()}),t({type:a("image_url"),image_url:p([e(),t({url:e(),detail:e().nullable()})])}),t({type:a("reference"),reference_ids:o(p([e(),n()]))}),t({type:a("thinking"),thinking:o(t({type:a("text"),text:e()}))})]))]).nullish(),Me=u(()=>l(t({id:e().nullish(),created:n().nullish(),model:e().nullish(),choices:o(t({message:t({role:a("assistant"),content:pe(),tool_calls:o(t({id:e(),function:t({name:e(),arguments:e()})})).nullish()}),index:n(),finish_reason:e().nullish()})),object:a("chat.completion"),usage:se}))),Re=u(()=>l(t({id:e().nullish(),created:n().nullish(),model:e().nullish(),choices:o(t({delta:t({role:s(["assistant"]).optional(),content:pe(),tool_calls:o(t({index:n().nullish(),id:e().nullish(),function:t({name:e().nullish(),arguments:e().nullish()})})).nullish()}),finish_reason:e().nullish(),index:n()})),usage:se.nullish()})));function Oe(g,i){let m=[],S=[],v=new Set,c=(y)=>{if(v.has(y.toolCallId)){let h=null;if(y.output.type==="json"){let f=y.output.value,_=f!=null&&typeof f==="object"&&"info"in f?f.info:void 0;if(_!=null&&typeof _==="object"&&!Array.isArray(_))h="result"in _?_.result??_:_}m.push({type:"function.result",tool_call_id:y.toolCallId,result:typeof h==="string"?h:JSON.stringify(h)});return}let x=ne([{role:"tool",content:[y]}])[0];m.push({type:"function.result",tool_call_id:y.toolCallId,result:x.content})};for(let y of g)switch(y.role){case"system":S.push(y.content);break;case"user":{let x=ne([y])[0];if(x.role==="user")m.push({type:"message.input",role:"user",content:x.content});break}case"assistant":{let x=[],h=()=>{if(x.length>0)m.push({type:"message.input",role:"assistant",content:x}),x=[]};for(let f of y.content)switch(f.type){case"text":x.push({type:"text",text:f.text});break;case"reasoning":x.push({type:"thinking",thinking:[{type:"text",text:f.text}],closed:!0});break;case"tool-call":if(h(),f.providerExecuted){let _=f.providerOptions?.mistral?.function??f.providerOptions?.mistral?.name,T=f.input;m.push({type:"function.call",tool_call_id:f.toolCallId,name:typeof _==="string"?_:i.toProviderToolName(f.toolName),arguments:typeof T?.arguments==="string"?T.arguments:JSON.stringify(f.input)}),v.add(f.toolCallId)}else m.push({type:"function.call",tool_call_id:f.toolCallId,name:f.toolName,arguments:JSON.stringify(f.input)});break;case"tool-result":h(),c(f);break;default:throw new b({functionality:`assistant content type: ${f.type}`})}h();break}case"tool":for(let x of y.content){if(x.type==="tool-approval-response")continue;c(x)}}return{inputs:m,instructions:S.length>0?S.join(`
|
|
2
|
+
|
|
3
|
+
`):void 0}}var Ae=u(()=>l(de())),Z={"mistral.web_search":"web_search","mistral.web_search_premium":"web_search_premium"};function Le({tools:g,toolChoice:i}){g=g?.length?g:void 0;let m=[];if(g==null)return{tools:void 0,toolChoice:void 0,toolWarnings:m};let S=[];for(let c of g)if(c.type==="provider"){if(c.id==="mistral.web_search"||c.id==="mistral.web_search_premium"){S.push({type:Z[c.id]});continue}m.push({type:"unsupported",feature:`provider-defined tool ${c.id}`})}else S.push({type:"function",function:{name:c.name,description:c.description,parameters:c.inputSchema,...c.strict!=null?{strict:c.strict}:{}}});if(i==null)return{tools:S,toolChoice:void 0,toolWarnings:m};let v=i.type;switch(v){case"auto":case"none":return{tools:S,toolChoice:v,toolWarnings:m};case"required":return{tools:S,toolChoice:"any",toolWarnings:m};case"tool":{let c=Kt({tools:g,providerToolNames:Z}).toProviderToolName(i.toolName);return{tools:S.filter((y)=>y.type==="function"?y.function.name===c:y.type===c),toolChoice:"any",toolWarnings:m}}default:throw new b({functionality:`tool choice type: ${v}`})}}var Ne=new Set(["glm-5-2","labs-leanstral-1-5","labs-leanstral-1-5-1","magistral-medium-latest","magistral-small-latest","mistral-large-4","mistral-large-4-0","mistral-medium","mistral-medium-2604","mistral-medium-3","mistral-medium-3-5","mistral-medium-3.5","mistral-medium-latest","mistral-small-2603","mistral-small-latest","mistral-vibe-cli-fast","mistral-vibe-cli-latest","mistral-vibe-cli-with-tools","zai-glm-5-2"]),Ue=class g{static[H](i){return te({modelId:i.modelId,config:i.config})}static[Q](i){return new g(i.modelId,i.config)}constructor(i,m){this.specificationVersion="v4",this.supportedUrls={"application/pdf":[/^https:\/\/.*$/]},this.modelId=i,this.config=m,this.generateId=m.generateId??C}get provider(){return this.config.provider}async getArgs({prompt:i,maxOutputTokens:m,temperature:S,topP:v,topK:c,frequencyPenalty:y,presencePenalty:x,reasoning:h,stopSequences:f,responseFormat:_,seed:T,providerOptions:P,tools:V,toolChoice:D}){let U=[],R=await k({provider:"mistral",providerOptions:P,schema:Ae})??{};if(c!=null)U.push({type:"unsupported",feature:"topK"});let K=Ne.has(this.modelId),O;if(K)O=R.reasoningEffort??(Ee(h)?h==="none"?"none":ft({reasoning:h,effortMap:{minimal:"high",low:"high",medium:"high",high:"high",xhigh:"high",max:"high"},warnings:U}):void 0);else if(Ee(h))U.push({type:"unsupported",feature:"reasoning",details:"This model does not support reasoning configuration."});let q=R.structuredOutputs??!0,M=R.strictJsonSchema??!1;if(_?.type==="json"&&(!q||_.schema==null))i=vl({messages:i,schema:_.schema});let N={max_tokens:m,temperature:S,top_p:v,...y!=null?{frequency_penalty:y}:{},...x!=null?{presence_penalty:x}:{},stop:f,random_seed:T,reasoning_effort:O,response_format:_?.type==="json"?q&&_?.schema!=null?{type:"json_schema",json_schema:{schema:_.schema,strict:M,name:_.name??"response",description:_.description}}:{type:"json_object"}:void 0},{tools:J,toolChoice:Y,toolWarnings:X}=Le({tools:V,toolChoice:D});for(let[be,_e]of Object.entries({safePrompt:R.safePrompt,documentImageLimit:R.documentImageLimit,documentPageLimit:R.documentPageLimit,promptCacheKey:R.promptCacheKey,parallelToolCalls:R.parallelToolCalls}))if(_e!=null)U.push({type:"unsupported",feature:be,details:"Not supported by the Mistral Conversations API."});return{args:{model:this.modelId,store:!1,...Oe(i,Kt({tools:V,providerToolNames:Z})),tools:J,completion_args:{...N,tool_choice:Y}},warnings:[...U,...X]}}async doGenerate(i){let{args:m,warnings:S}=await this.getArgs(i),{value:v,rawValue:c,responseHeaders:y}=await A({url:`${this.config.baseURL}/conversations`,headers:I(this.config.headers?.(),i.headers),body:m,failedResponseHandler:B,successfulResponseHandler:E(Ve),abortSignal:i.abortSignal,fetch:this.config.fetch}),x=ue({tools:i.tools,generateId:this.generateId}),h=[],f=!1,_;for(let T of v.outputs)switch(T.type){case"tool.execution":h.push(...x.convertTool(T));break;case"function.call":f=!0,h.push({type:"tool-call",toolCallId:T.tool_call_id,toolName:T.name,input:typeof T.arguments==="string"?T.arguments:JSON.stringify(T.arguments)});break;case"message.output":_=T.model??_;for(let P of typeof T.content==="string"?[{type:"text",text:T.content}]:T.content)h.push(...x.convertChunk(P))}return{content:h,finishReason:{unified:f?"tool-calls":"stop",raw:void 0},usage:W(v.usage),request:{body:m},response:{id:v.conversation_id,modelId:_,headers:y,body:c},warnings:S}}async doStream(i){let{args:m,warnings:S}=await this.getArgs(i),v={...m,stream:!0},{value:c,responseHeaders:y}=await A({url:`${this.config.baseURL}/conversations`,headers:I(this.config.headers?.(),i.headers),body:v,failedResponseHandler:B,successfulResponseHandler:qe(Je),abortSignal:i.abortSignal,fetch:this.config.fetch}),x=ue({tools:i.tools,generateId:this.generateId}),h=new Map,f,_,T,P=!1,V=!1,D=!1,U=!1,R=(O)=>{if(_!=null)O.enqueue({type:_.type==="text"?"text-end":"reasoning-end",id:_.id}),_=void 0},K=this.generateId;return{stream:c.pipeThrough(new TransformStream({start(O){f=new yc(O,{generateId:K}),O.enqueue({type:"stream-start",warnings:S})},transform(O,q){if(i.includeRawChunks)q.enqueue({type:"raw",rawValue:O.rawValue});if(!O.success){V=!0,q.enqueue({type:"error",error:O.error});return}let M=O.value;switch(M.type){case"conversation.response.started":q.enqueue({type:"response-metadata",id:M.conversation_id,...M.created_at!=null?{timestamp:new Date(M.created_at)}:{}});break;case"conversation.response.done":T=M.usage??void 0,D=!0;break;case"conversation.response.error":V=!0,q.enqueue({type:"error",error:M});break;case"message.output.delta":if(!U&&M.model!=null)U=!0,q.enqueue({type:"response-metadata",modelId:M.model});for(let N of x.convertChunk(typeof M.content==="string"?{type:"text",text:M.content}:M.content))if(N.type==="text"||N.type==="reasoning"){let J=`${M.id}-${M.content_index??0}`;if(_?.id!==J||_.type!==N.type)R(q),_={id:J,type:N.type},q.enqueue({type:N.type==="text"?"text-start":"reasoning-start",id:J});q.enqueue({type:N.type==="text"?"text-delta":"reasoning-delta",id:J,delta:N.text})}else if(N.type==="source")q.enqueue(N);break;case"function.call.delta":R(q),P=!0,f.processDelta({id:M.tool_call_id,index:M.output_index,function:{name:M.name,arguments:M.arguments}});break;case"tool.execution.started":case"tool.execution.delta":{R(q);let N=h.get(M.id);if(N==null)h.set(M.id,{name:M.name,arguments:M.arguments,function:M.function}),q.enqueue({type:"tool-input-start",id:M.id,toolName:x.toolNameMapping.toCustomToolName(M.name),providerExecuted:!0});else N.arguments+=M.arguments;break}case"tool.execution.done":{let N=h.get(M.id);if(N==null){V=!0,q.enqueue({type:"error",error:Error(`Missing tool execution start for ${M.id}`)});break}q.enqueue({type:"tool-input-delta",id:M.id,delta:JSON.stringify({arguments:N.arguments})}),q.enqueue({type:"tool-input-end",id:M.id});for(let J of x.convertTool({type:"tool.execution",id:M.id,name:N.name,arguments:N.arguments,function:M.function??N.function,info:M.info}))q.enqueue(J);h.delete(M.id);break}}},flush(O){R(O),f.flush(),O.enqueue({type:"finish",finishReason:{unified:V||!D||h.size>0?"error":P?"tool-calls":"stop",raw:void 0},usage:W(T)})}})),request:{body:v},response:{headers:y}}}};function ue({tools:g,generateId:i}){let m=Kt({tools:g,providerToolNames:Z}),S=new Set;return{toolNameMapping:m,convertChunk(v){switch(v.type){case"text":return v.text.length>0?[{type:"text",text:v.text}]:[];case"thinking":{let y=v.thinking.map((x)=>x.text).join("");return y.length>0?[{type:"reasoning",text:y}]:[]}case"tool_reference":if(v.url==null||S.has(v.url))return[];let c=i();return S.add(v.url),[{type:"source",sourceType:"url",id:c,url:v.url,title:v.title??v.url}]}},convertTool(v){let c=m.toCustomToolName(v.name);return[{type:"tool-call",toolCallId:v.id,toolName:c,input:JSON.stringify({arguments:v.arguments}),providerExecuted:!0,providerMetadata:{mistral:{type:"tool.execution",name:v.name,...v.function!=null?{function:v.function}:{}}}},{type:"tool-result",toolCallId:v.id,toolName:c,result:{...v.info!=null?{info:v.info}:{}}}]}}}var me=()=>w("type",[t({type:a("text"),text:e()}),t({type:a("thinking"),thinking:o(t({type:a("text"),text:e()}))}),t({type:a("tool_reference"),tool:e().nullish(),title:e().nullish(),url:e().nullish()})]),$e=()=>p([e(),o(me())]),De=()=>t({type:a("tool.execution"),id:e(),name:e(),arguments:e(),function:e().nullish(),info:d(e(),Fe()).nullish()}),Pe=()=>t({type:a("function.call"),tool_call_id:e(),name:e(),arguments:p([e(),d(e(),Fe())])}),he=()=>se.extend({prompt_tokens:n().default(0),completion_tokens:n().default(0),total_tokens:n().default(0)}),Ve=u(()=>l(t({conversation_id:e(),outputs:o(w("type",[De(),Pe(),t({type:a("message.output"),content:$e(),model:e().nullish()})])),usage:he().nullish()}))),Je=u(()=>l(w("type",[t({type:a("conversation.response.started"),conversation_id:e(),created_at:e().nullish()}),t({type:a("conversation.response.done"),usage:he().nullish()}),t({type:a("conversation.response.error"),message:e(),code:n()}),t({type:a("message.output.delta"),id:e(),content_index:n().nullish(),content:p([e(),me()]),model:e().nullish()}),t({type:a("function.call.delta"),tool_call_id:e(),name:e(),arguments:e(),output_index:n().nullish()}),t({type:s(["tool.execution.started","tool.execution.delta"]),id:e(),name:e(),arguments:e(),function:e().nullish()}),t({type:a("tool.execution.done"),id:e(),name:e(),function:e().nullish(),info:d(e(),Fe()).nullish()})]))),Ke=t({metadata:d(e(),L()).optional(),outputDimension:n().int().positive().optional(),outputDtype:s(["float","int8","uint8","binary","ubinary"]).optional()}),Be=class g{get provider(){return this.config.provider}static[H](i){return te({modelId:i.modelId,config:i.config})}static[Q](i){return new g(i.modelId,i.config)}constructor(i,m){this.specificationVersion="v4",this.maxEmbeddingsPerCall=32,this.supportsParallelCalls=!1,this.modelId=i,this.config=m}async doEmbed({values:i,dimensions:m,abortSignal:S,headers:v,providerOptions:c}){if(i.length>this.maxEmbeddingsPerCall)throw new lt({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:i});let y=await k({provider:"mistral",providerOptions:c,schema:Ke})??{},{responseHeaders:x,value:h,rawValue:f}=await A({url:`${this.config.baseURL}/embeddings`,headers:I(this.config.headers?.(),v),body:{model:this.modelId,input:i,metadata:y.metadata,output_dimension:y.outputDimension??m,output_dtype:y.outputDtype,encoding_format:"float"},failedResponseHandler:B,successfulResponseHandler:E(ze),abortSignal:S,fetch:this.config.fetch});return{warnings:[],embeddings:h.data.map((_)=>_.embedding),usage:h.usage?{tokens:h.usage.prompt_tokens}:void 0,response:{headers:x,body:f}}}},ze=u(()=>l(t({data:o(t({embedding:o(n())})),usage:t({prompt_tokens:n()}).nullish()}))),We=u(()=>l(t({refAudio:e().min(1).optional(),expressiveness:n().min(1).max(5).optional(),phonemeHints:d(e().min(1),o(e().min(1)).min(1)).optional()}))),Ge=class g{static[H](i){return te({modelId:i.modelId,config:i.config})}static[Q](i){return new g(i.modelId,i.config)}get provider(){return this.config.provider}constructor(i,m){this.modelId=i,this.config=m,this.specificationVersion="v4"}async getArgs({text:i,voice:m,outputFormat:S="mp3",instructions:v,speed:c,language:y,providerOptions:x}){let h=[],f=await k({provider:"mistral",providerOptions:x,schema:We}),_="mp3";if(["pcm","wav","mp3","flac","opus"].includes(S))_=S;else h.push({type:"unsupported",feature:"outputFormat",details:`Unsupported output format: ${S}. Using mp3 instead.`});if(v!=null)h.push({type:"unsupported",feature:"instructions",details:"Mistral speech models do not support the `instructions` option. Use a reference audio clip to guide delivery."});if(c!=null)h.push({type:"unsupported",feature:"speed",details:"Mistral speech models do not support the `speed` option. It was ignored."});if(y!=null)h.push({type:"unsupported",feature:"language",details:"Mistral speech models do not support the `language` option. Language is inferred from the input text and voice."});let T=f?.refAudio,P={model:this.modelId,input:i,voice_id:T==null?m:void 0,ref_audio:T,expressiveness:f?.expressiveness,phoneme_hints:f?.phonemeHints,response_format:_,stream:!1};return{requestBody:P,requestBodyValues:{...P,ref_audio:T==null?void 0:"[redacted]"},warnings:h}}async doGenerate(i){let m=this.config._internal?.currentDate?.()??new Date,{requestBody:S,requestBodyValues:v,warnings:c}=await this.getArgs(i),{value:y,responseHeaders:x,rawValue:h}=await Lr({url:`${this.config.baseURL}/audio/speech`,headers:I({"Content-Type":"application/json"},this.config.headers?.(),i.headers),body:{content:JSON.stringify(S),values:v},failedResponseHandler:B,successfulResponseHandler:E(Ze),abortSignal:i.abortSignal,fetch:this.config.fetch});return{audio:y.audio_data,warnings:c,request:{body:JSON.stringify(v)},response:{timestamp:m,modelId:this.modelId,headers:x,body:h}}}},Ze=u(()=>l(t({audio_data:e()}))),Ye=u(()=>l(t({language:e().min(1).optional(),returnLanguage:r().optional(),temperature:n().optional(),timestampGranularities:o(s(["segment","word"])).min(1).optional(),diarize:r().optional(),contextBias:o(e().min(1)).optional()}))),Qe=class g{static[H](i){return te({modelId:i.modelId,config:i.config})}static[Q](i){return new g(i.modelId,i.config)}get provider(){return this.config.provider}constructor(i,m){this.modelId=i,this.config=m,this.specificationVersion="v4"}async getArgs({audio:i,mediaType:m,providerOptions:S}){let v=[],c=await k({provider:"mistral",providerOptions:S,schema:Ye});if(["voxtral-mini-2507","voxtral-mini-2602","voxtral-mini-latest"].includes(this.modelId)&&c?.language!=null&&c.timestampGranularities!=null)throw new F({argument:"providerOptions",message:"providerOptions.mistral.language cannot be combined with providerOptions.mistral.timestampGranularities"});if(c?.language!=null&&c.returnLanguage)throw new F({argument:"providerOptions",message:"providerOptions.mistral.language cannot be combined with providerOptions.mistral.returnLanguage"});let y=new FormData,x=i instanceof Uint8Array?new Blob([i]):new Blob([Te(i)]);if(y.append("model",this.modelId),y.append("file",new File([x],"audio",{type:m}),`audio.${Km(m)}`),c!=null)z(y,"language",c.language),z(y,"return_language",c.returnLanguage),z(y,"temperature",c.temperature),z(y,"timestamp_granularities",c.timestampGranularities),z(y,"diarize",c.diarize),z(y,"context_bias",c.contextBias);return{formData:y,warnings:v}}async doGenerate(i){let m=this.config._internal?.currentDate?.()??new Date,{formData:S,warnings:v}=await this.getArgs(i),{value:c,responseHeaders:y,rawValue:x}=await vn({url:`${this.config.baseURL}/audio/transcriptions`,headers:I(this.config.headers?.(),i.headers),formData:S,failedResponseHandler:B,successfulResponseHandler:E(Xe),abortSignal:i.abortSignal,fetch:this.config.fetch}),h=c.segments?.map((T)=>({text:T.text,startSecond:T.start,endSecond:T.end}))??[],f={};if(c.usage!=null)f.usage={...c.usage.prompt_tokens!=null&&{promptTokens:c.usage.prompt_tokens},...c.usage.completion_tokens!=null&&{completionTokens:c.usage.completion_tokens},...c.usage.total_tokens!=null&&{totalTokens:c.usage.total_tokens},...c.usage.prompt_audio_seconds!=null&&{promptAudioSeconds:c.usage.prompt_audio_seconds},...c.usage.request_count!=null&&{requestCount:c.usage.request_count}};let _=c.segments?.filter((T)=>T.type!=null||T.score!=null||T.speaker_id!=null).map((T)=>({text:T.text,startSecond:T.start,endSecond:T.end,...T.type!=null&&{type:T.type},...T.score!=null&&{score:T.score},...T.speaker_id!=null&&{speakerId:T.speaker_id}}));if(_!=null&&_.length>0)f.segments=_;return{text:c.text,segments:h,language:c.language??void 0,durationInSeconds:c.usage?.prompt_audio_seconds??h.at(-1)?.endSecond??void 0,warnings:v,...c.usage!=null&&{usage:c.usage},response:{timestamp:m,modelId:c.model,headers:y,body:x},...Object.keys(f).length>0&&{providerMetadata:{mistral:f}}}}};function z(g,i,m){if(m==null)return;if(Array.isArray(m)){for(let S of m)g.append(i,S);return}g.append(i,String(m))}var Xe=u(()=>l(t({model:e(),text:e(),language:e().nullish(),segments:o(t({type:a("transcription_segment").nullish(),text:e(),start:n(),end:n(),score:n().nullish(),speaker_id:e().nullish()})).nullish(),usage:t({prompt_tokens:n().nullish(),completion_tokens:n().nullish(),total_tokens:n().nullish(),prompt_audio_seconds:n().nullish(),request_count:n().nullish()}).nullish()}))),et="4.0.72",fe=u(()=>l(t({arguments:e()}))),ye=u(()=>l(t({info:d(e(),Fe()).optional()}))),tt=G({id:"mistral.web_search",inputSchema:fe,outputSchema:ye}),nt=G({id:"mistral.web_search_premium",inputSchema:fe,outputSchema:ye}),st=(g={})=>tt(g),ot=(g={})=>nt(g),at={webSearch:st,webSearchPremium:ot};function ml(g={}){let i=He(g.baseURL)??"https://api.mistral.ai/v1",m=()=>Se({Authorization:`Bearer ${Po({apiKey:g.apiKey,environmentVariableName:"MISTRAL_API_KEY",description:"Mistral"})}`,...g.headers},`ai-sdk-mistral/${et}`),S=(f)=>new je(f,{provider:"mistral.chat",baseURL:i,headers:m,fetch:g.fetch,generateId:g.generateId}),v=(f)=>new Be(f,{provider:"mistral.embedding",baseURL:i,headers:m,fetch:g.fetch}),c=(f)=>new Ue(f,{provider:"mistral.conversation",baseURL:i,headers:m,fetch:g.fetch,generateId:g.generateId}),y=(f)=>new Ge(f,{provider:"mistral.speech",baseURL:i,headers:m,fetch:g.fetch}),x=(f)=>new Qe(f,{provider:"mistral.transcription",baseURL:i,headers:m,fetch:g.fetch}),h=function(f){if(new.target)throw Error("The Mistral model function cannot be called with the new keyword.");return S(f)};return h.specificationVersion="v4",h.languageModel=S,h.chat=S,h.conversation=c,h.tools=at,h.embedding=v,h.embeddingModel=v,h.textEmbedding=v,h.textEmbeddingModel=v,h.speech=y,h.speechModel=y,h.transcription=x,h.transcriptionModel=x,h.imageModel=(f)=>{throw new ve({modelId:f,modelType:"imageModel"})},h}var dt=ml();
|
|
4
|
+
export{ml};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./index-mcnngj50.js";var R=i(function(Sr){var Lr=function(e){return e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL",e}({});Sr.DiagLogLevel=Lr});var w=i(function(wr){wr.VERSION="1.10.0"});var ie=i(function(yr){var mr=w(),ne=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function ae(e){let r=new Set([e]),t=new Set,o=e.match(ne);if(!o)return()=>!1;let n={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(n.prerelease!=null)return function(c){return c===e};function a(u){return t.add(u),!1}function s(u){return r.add(u),!0}return function(c){if(r.has(c))return!0;if(t.has(c))return!1;let _=c.match(ne);if(!_)return a(c);let g={major:+_[1],minor:+_[2],patch:+_[3],prerelease:_[4]};if(g.prerelease!=null)return a(c);if(n.major!==g.major)return a(c);if(n.major===0){if(n.minor===g.minor&&n.patch<=g.patch)return s(c);return a(c)}if(n.minor<=g.minor)return s(c);return a(c)}}var Vr=ae(mr.VERSION);yr._makeCompatibilityCheck=ae;yr.isCompatible=Vr});var l=i(function(Wr){var q=w(),Fr=ie(),$r=q.VERSION.split(".")[0],f=Symbol.for(`opentelemetry.js.api.${$r}`),h=typeof globalThis==="object"?globalThis:typeof self==="object"?self:typeof window==="object"?window:typeof global==="object"?global:{};function kr(){return Object.defineProperty({},"version",{value:q.VERSION,enumerable:!0,writable:!1,configurable:!1})}function jr(e,r,t,o=!1){var n;let a=h[f]=(n=h[f])!==null&&n!==void 0?n:kr();if(!o&&a[e]){let s=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return t.error(s.stack||s.message),!1}if(a.version!=="1.10.0"){let s=Error(`@opentelemetry/api: Registration of version v${a.version} for ${e} does not match previously registered API v${q.VERSION}`);return t.error(s.stack||s.message),!1}return a[e]=r,t.debug(`@opentelemetry/api: Registered a global for ${e} v${q.VERSION}.`),!0}var se;function Xr(e){let r=h[f];if(r==null)return;if(r!==se){if(!r.version||!Fr.isCompatible(r.version))return;se=r}return r[e]}function Kr(e,r){r.debug(`@opentelemetry/api: Unregistering a global for ${e} v${q.VERSION}.`);let t=h[f];if(t)delete t[e]}Wr.getGlobal=Xr;Wr.registerGlobal=jr;Wr.unregisterGlobal=Kr});var ce=i(function(Zr){var Qr=l(),Jr=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return E("debug",this._namespace,e)}error(...e){return E("error",this._namespace,e)}info(...e){return E("info",this._namespace,e)}warn(...e){return E("warn",this._namespace,e)}verbose(...e){return E("verbose",this._namespace,e)}};function E(e,r,t){let o=Qr.getGlobal("diag");if(!o)return;return o[e](r,...t)}Zr.DiagComponentLogger=Jr});var ue=i(function(tt){R();function rt(e,r){if(e<0)e=0;else if(e>9999)e=9999;r=r||{};function t(o,n){let a=r[o];if(typeof a==="function"&&e>=n)return a.bind(r);return function(){}}return{error:t("error",30),warn:t("warn",50),info:t("info",60),debug:t("debug",70),verbose:t("verbose",80)}}tt.createLogLevelDiagLogger=rt});var p=i(function(ct){var I=l(),nt=ce();R();var at=ue(),it="diag",st=class e{static instance(){if(!this._instance)this._instance=new e;return this._instance}constructor(){function r(n){return function(...a){let s=I.getGlobal("diag");if(!s)return;return s[n](...a)}}let t=this,o=(n,a={logLevel:60})=>{var s;if(n===t){var u;let x=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((u=x.stack)!==null&&u!==void 0?u:x.message),!1}if(typeof a==="number")a={logLevel:a};let c=I.getGlobal("diag"),_=at.createLogLevelDiagLogger((s=a.logLevel)!==null&&s!==void 0?s:60,n);if(c&&!a.suppressOverrideMessage){var g;let x=(g=Error().stack)!==null&&g!==void 0?g:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${x}`),_.warn(`Current logger will overwrite one already registered from ${x}`)}return I.registerGlobal("diag",_,t,!0)};t.setLogger=o,t.disable=()=>{I.unregisterGlobal(it,t)},t.createComponentLogger=(n)=>new nt.DiagComponentLogger(n),t.verbose=r("verbose"),t.debug=r("debug"),t.info=r("info"),t.warn=r("warn"),t.error=r("error")}};ct.DiagAPI=st});var _e=i(function(gt){var _t=class e{constructor(r){this._entries=r?new Map(r):new Map}getEntry(r){let t=this._entries.get(r);if(!t)return;return Object.assign({},t)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(r,t){let o=new e(this._entries);return o._entries.set(r,t),o}removeEntry(r){let t=new e(this._entries);return t._entries.delete(r),t}removeEntries(...r){let t=new e(this._entries);for(let o of r)t._entries.delete(o);return t}clear(){return new e}};gt.BaggageImpl=_t});var ge=i(function(dt){var pt=Symbol("BaggageEntryMetadata");dt.baggageEntryMetadataSymbol=pt});var G=i(function(ft){var qt=p(),Et=_e(),At=ge(),Pt=qt.DiagAPI.instance();function Tt(e={}){return new Et.BaggageImpl(new Map(Object.entries(e)))}function Rt(e){if(typeof e!=="string")Pt.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e="";return{__TYPE__:At.baggageEntryMetadataSymbol,toString(){return e}}}ft.baggageEntryMetadataFromString=Rt;ft.createBaggage=Tt});var A=i(function(Mt){function Nt(e){return Symbol.for(e)}var Ot=new class e{constructor(r){let t=this;t._currentContext=r?new Map(r):new Map,t.getValue=(o)=>t._currentContext.get(o),t.setValue=(o,n)=>{let a=new e(t._currentContext);return a._currentContext.set(o,n),a},t.deleteValue=(o)=>{let n=new e(t._currentContext);return n._currentContext.delete(o),n}}};Mt.ROOT_CONTEXT=Ot;Mt.createContextKey=Nt});var le=i(function(Lt){var m=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],N={};if(typeof console<"u"){for(let e of["error","warn","info","debug","trace","log"])if(typeof console[e]==="function")N[e]=console[e]}var bt=class{constructor(){function e(r){return function(...t){let o=N[r];if(typeof o!=="function")o=N.log;if(typeof o!=="function"&&console){if(o=console[r],typeof o!=="function")o=console.log}if(typeof o==="function")return o.apply(console,t)}}for(let r=0;r<m.length;r++)this[m[r].n]=e(m[r].c)}};Lt.DiagConsoleLogger=bt;Lt._originalConsoleMethods=N});var V=i(function(Gt){var pe=class{constructor(){}createGauge(e,r){return he}createHistogram(e,r){return Ie}createCounter(e,r){return fe}createUpDownCounter(e,r){return Ne}createObservableGauge(e,r){return Me}createObservableCounter(e,r){return Oe}createObservableUpDownCounter(e,r){return Ce}addBatchObservableCallback(e,r){}removeBatchObservableCallback(e){}},P=class{},de=class extends P{add(e,r){}},xe=class extends P{add(e,r){}},qe=class extends P{record(e,r){}},Ee=class extends P{record(e,r){}},M=class{addCallback(e){}removeCallback(e){}},Ae=class extends M{},Pe=class extends M{},Te=class extends M{},Re=new pe,fe=new de,he=new qe,Ie=new Ee,Ne=new xe,Oe=new Ae,Me=new Pe,Ce=new Te;function wt(){return Re}Gt.NOOP_COUNTER_METRIC=fe;Gt.NOOP_GAUGE_METRIC=he;Gt.NOOP_HISTOGRAM_METRIC=Ie;Gt.NOOP_METER=Re;Gt.NOOP_OBSERVABLE_COUNTER_METRIC=Oe;Gt.NOOP_OBSERVABLE_GAUGE_METRIC=Me;Gt.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=Ce;Gt.NOOP_UP_DOWN_COUNTER_METRIC=Ne;Gt.NoopCounterMetric=de;Gt.NoopGaugeMetric=qe;Gt.NoopHistogramMetric=Ee;Gt.NoopMeter=pe;Gt.NoopMetric=P;Gt.NoopObservableCounterMetric=Ae;Gt.NoopObservableGaugeMetric=Pe;Gt.NoopObservableMetric=M;Gt.NoopObservableUpDownCounterMetric=Te;Gt.NoopUpDownCounterMetric=xe;Gt.createNoopMeter=wt});var ve=i(function(to){var ro=function(e){return e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE",e}({});to.ValueType=ro});var C=i(function(ao){var be=class{emit(e){}enabled(){return!1}},Le=new be;function no(){return Le}ao.NOOP_LOGGER=Le;ao.NoopLogger=be;ao.createNoopLogger=no});var Se=i(function(_o){var uo=function(e){return e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4",e}({});_o.SeverityNumber=uo});var y=i(function(xo){var lo={get(e,r){if(e==null)return;return e[r]},keys(e){if(e==null)return[];return Object.keys(e)}},po={set(e,r,t){if(e==null)return;e[r]=t}};xo.defaultTextMapGetter=lo;xo.defaultTextMapSetter=po});var B=i(function(Po){var Ao=function(e){return e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED",e}({});Po.TraceFlags=Ao});var v=i(function(fo){B();var De="0000000000000000",we="00000000000000000000000000000000",Ro={traceId:we,spanId:De,traceFlags:0};fo.INVALID_SPANID=De;fo.INVALID_SPAN_CONTEXT=Ro;fo.INVALID_TRACEID=we});var b=i(function(Co){var Oo=v(),Mo=class{constructor(e=Oo.INVALID_SPAN_CONTEXT){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,r){return this}setAttributes(e){return this}addEvent(e,r){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,r){}};Co.NonRecordingSpan=Mo});var S=i(function(Do){v();var bo=b(),L=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function Ge(e,r){if(typeof e!=="string"||e.length!==r)return!1;let t=0;for(let o=0;o<e.length;o+=4)t+=(L[e.charCodeAt(o)]|0)+(L[e.charCodeAt(o+1)]|0)+(L[e.charCodeAt(o+2)]|0)+(L[e.charCodeAt(o+3)]|0);return t===r}function me(e){return Ge(e,32)&&e!=="00000000000000000000000000000000"}function Ve(e){return Ge(e,16)&&e!=="0000000000000000"}function Lo(e){return me(e.traceId)&&Ve(e.spanId)}function So(e){return new bo.NonRecordingSpan(e)}Do.isSpanContextValid=Lo;Do.isValidSpanId=Ve;Do.isValidTraceId=me;Do.wrapSpanContext=So});var ye=i(function(Uo){var yo=A(),Bo=class{active(){return yo.ROOT_CONTEXT}with(e,r,t,...o){return r.call(t,...o)}bind(e,r){return r}enable(){return this}disable(){return this}attach(e){return{dispose(){}}}};Uo.NoopContextManager=Bo});var T=i(function(Ko){var F=l(),U=p(),$o=ye(),ko=new $o.NoopContextManager,jo=Object.freeze({dispose:()=>{}}),Xo=class e{constructor(){this._attachUnsupportedWarned=!1}static getInstance(){if(!this._instance)this._instance=new e;return this._instance}setGlobalContextManager(r){return F.registerGlobal("context",r,U.DiagAPI.instance())}active(){return this._getContextManager().active()}with(r,t,o,...n){return this._getContextManager().with(r,t,o,...n)}bind(r,t){return this._getContextManager().bind(r,t)}attach(r){let t=this._getContextManager();if(t.attach)return t.attach(r);if(!this._attachUnsupportedWarned)this._attachUnsupportedWarned=!0,U.DiagAPI.instance().warn("The current ContextManager does not implement attach(). The context will not be attached. Use a ContextManager that supports attach() (e.g. AsyncLocalStorageContextManager) or use with()/bind() instead.");return jo}_getContextManager(){return F.getGlobal("context")||ko}disable(){this._getContextManager().disable(),F.unregisterGlobal("context",U.DiagAPI.instance())}};Ko.ContextAPI=Xo});var X=i(function(rn){var Yo=A(),Ho=T(),zo=b(),k=Yo.createContextKey("OpenTelemetry Context Key SPAN");function j(e){return e.getValue(k)||void 0}function Qo(){return j(Ho.ContextAPI.getInstance().active())}function Be(e,r){return e.setValue(k,r)}function Jo(e){return e.deleteValue(k)}function Zo(e,r){return Be(e,new zo.NonRecordingSpan(r))}function en(e){var r;return(r=j(e))===null||r===void 0?void 0:r.spanContext()}rn.deleteSpan=Jo;rn.getActiveSpan=Qo;rn.getSpan=j;rn.getSpanContext=en;rn.setSpan=Be;rn.setSpanContext=Zo});var Y=i(function(pn){var un=T(),K=b(),Ue=X(),_n=S(),W=un.ContextAPI.getInstance(),gn=class{startSpan(e,r,t=W.active()){if(Boolean(r===null||r===void 0?void 0:r.root))return new K.NonRecordingSpan;let o=t&&Ue.getSpanContext(t);if(ln(o)&&_n.isSpanContextValid(o))return new K.NonRecordingSpan(o);else return new K.NonRecordingSpan}startActiveSpan(e,r,t,o){var n;let a,s,u;if(arguments.length<2)return;else if(arguments.length===2)u=r;else if(arguments.length===3)a=r,u=t;else a=r,s=t,u=o;let c=(n=s)!==null&&n!==void 0?n:W.active(),_=this.startSpan(e,a,c),g=Ue.setSpan(c,_);return W.with(g,u,void 0,_)}};function ln(e){return e!==null&&typeof e==="object"&&"spanId"in e&&typeof e.spanId==="string"&&"traceId"in e&&typeof e.traceId==="string"&&"traceFlags"in e&&typeof e.traceFlags==="number"}pn.NoopTracer=gn});var H=i(function(En){var xn=new(Y()).NoopTracer,qn=class{constructor(e,r,t,o){this._provider=e,this.name=r,this.version=t,this.options=o}startSpan(e,r,t){return this._getTracer().startSpan(e,r,t)}startActiveSpan(e,r,t,o){let n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);if(!e)return xn;return this._delegate=e,this._delegate}};En.ProxyTracer=qn});var Fe=i(function(Tn){var Pn=function(e){return e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER",e}({});Tn.SpanKind=Pn});var $e=i(function(hn){var fn=function(e){return e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e}({});hn.SpanStatusCode=fn});var ke=i(function(bn){var Nn=new RegExp("^(?:[a-z][_0-9a-z-*/]{0,255}|[a-z0-9][_0-9a-z-*/]{0,240}@[a-z][_0-9a-z-*/]{0,13})$"),On=/^[ -~]{0,255}[!-~]$/,Mn=/,|=/;function Cn(e){return Nn.test(e)}function vn(e){return On.test(e)&&!Mn.test(e)}bn.validateKey=Cn;bn.validateValue=vn});var Xe=i(function(wn){var je=ke(),Dn=class e{constructor(r){if(this._internalState=new Map,r)this._parse(r)}set(r,t){let o=this._internalState.get(r),n=this.serialize().length;if(typeof o==="string")n+=t.length-o.length;else{if(this._internalState.size>=32)return this;n+=r.length+t.length+(this._internalState.size>0?2:1)}if(n>512)return this;let a=this._clone();if(a._internalState.has(r))a._internalState.delete(r);return a._internalState.set(r,t),a}unset(r){let t=this._clone();return t._internalState.delete(r),t}get(r){return this._internalState.get(r)}serialize(){return Array.from(this._internalState.keys()).reduceRight((r,t)=>(r.push(t+"="+this.get(t)),r),[]).join(",")}_parse(r){if(r.length>512)return;if(this._internalState=r.split(",").reduceRight((t,o)=>{let n=o.trim(),a=n.indexOf("=");if(a!==-1){let s=n.slice(0,a),u=n.slice(a+1,o.length);if(je.validateKey(s)&&je.validateValue(u))t.set(s,u)}return t},new Map),this._internalState.size>32)this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let r=new e;return r._internalState=new Map(this._internalState),r}};wn.TraceStateImpl=Dn});var Ke=i(function(yn){var mn=Xe();function Vn(e){return new mn.TraceStateImpl(e)}yn.createTraceState=Vn});var We=i(function($n){var Un=Y(),Fn=class{getTracer(e,r,t){return new Un.NoopTracer}};$n.NoopTracerProvider=Fn});var z=i(function(Wn){var jn=H(),Xn=new(We()).NoopTracerProvider,Kn=class{getTracer(e,r,t){var o;return(o=this.getDelegateTracer(e,r,t))!==null&&o!==void 0?o:new jn.ProxyTracer(this,e,r,t)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Xn}setDelegate(e){this._delegate=e}getDelegateTracer(e,r,t){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(e,r,t)}};Wn.ProxyTracerProvider=Kn});var Ye=i(function(zn){var Hn=function(e){return e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED",e}({});zn.SamplingDecision=Hn});var He=i(function(Zn){var Jn=T().ContextAPI.getInstance();Zn.context=Jn});var ze=i(function(ta){var ra=p().DiagAPI.instance();ta.diag=ra});var Je=i(function(ia){var na=C(),Qe=class{getLogger(e,r,t){return new na.NoopLogger}},aa=new Qe;ia.NOOP_LOGGER_PROVIDER=aa;ia.NoopLoggerProvider=Qe});var Ze=i(function(ga){var ua=C(),_a=class{constructor(e,r,t,o){this._provider=e,this.name=r,this.version=t,this.options=o}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);if(!e)return ua.NOOP_LOGGER;return this._delegate=e,this._delegate}};ga.ProxyLogger=_a});var er=i(function(qa){var pa=Je(),da=Ze(),xa=class{getLogger(e,r,t){var o;return(o=this._getDelegateLogger(e,r,t))!==null&&o!==void 0?o:new da.ProxyLogger(this,e,r,t)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:pa.NOOP_LOGGER_PROVIDER}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,t){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getLogger(e,r,t)}};qa.ProxyLoggerProvider=xa});var or=i(function(Pa){var Q=l(),rr=p(),tr=er(),Aa=class e{constructor(){this._proxyLoggerProvider=new tr.ProxyLoggerProvider}static getInstance(){if(!this._instance)this._instance=new e;return this._instance}setGlobalLoggerProvider(r){let t=Q.registerGlobal("logs",r,rr.DiagAPI.instance());if(t)this._proxyLoggerProvider._setDelegate(r);return t}getLoggerProvider(){return Q.getGlobal("logs")||this._proxyLoggerProvider}getLogger(r,t,o){return this.getLoggerProvider().getLogger(r,t,o)}disable(){Q.unregisterGlobal("logs",rr.DiagAPI.instance()),this._proxyLoggerProvider=new tr.ProxyLoggerProvider}};Pa.LogsAPI=Aa});var nr=i(function(fa){var Ra=or().LogsAPI.getInstance();fa.logs=Ra});var ir=i(function(Oa){var Ia=V(),ar=class{getMeter(e,r,t){return Ia.NOOP_METER}},Na=new ar;Oa.NOOP_METER_PROVIDER=Na;Oa.NoopMeterProvider=ar});var cr=i(function(La){var J=l(),sr=p(),va=ir(),ba=class e{constructor(){}static getInstance(){if(!this._instance)this._instance=new e;return this._instance}setGlobalMeterProvider(r){return J.registerGlobal("metrics",r,sr.DiagAPI.instance())}getMeterProvider(){return J.getGlobal("metrics")||va.NOOP_METER_PROVIDER}getMeter(r,t,o){return this.getMeterProvider().getMeter(r,t,o)}disable(){J.unregisterGlobal("metrics",sr.DiagAPI.instance())}};La.MetricsAPI=ba});var ur=i(function(wa){var Da=cr().MetricsAPI.getInstance();wa.metrics=Da});var _r=i(function(Va){var ma=class{inject(e,r){}extract(e,r){return e}fields(){return[]}};Va.NoopTextMapPropagator=ma});var lr=i(function(ja){var Ba=A(),Ua=T(),Z=Ba.createContextKey("OpenTelemetry Baggage Key");function gr(e){return e.getValue(Z)||void 0}function Fa(){return gr(Ua.ContextAPI.getInstance().active())}function $a(e,r){return e.setValue(Z,r)}function ka(e){return e.deleteValue(Z)}ja.deleteBaggage=ka;ja.getActiveBaggage=Fa;ja.getBaggage=gr;ja.setBaggage=$a});var xr=i(function(Za){var ee=l(),pr=p(),Ha=G(),dr=y(),za=_r(),D=lr(),Qa=new za.NoopTextMapPropagator,Ja=class e{constructor(){this.createBaggage=Ha.createBaggage,this.getBaggage=D.getBaggage,this.getActiveBaggage=D.getActiveBaggage,this.setBaggage=D.setBaggage,this.deleteBaggage=D.deleteBaggage}static getInstance(){if(!this._instance)this._instance=new e;return this._instance}setGlobalPropagator(r){return ee.registerGlobal("propagation",r,pr.DiagAPI.instance())}inject(r,t,o=dr.defaultTextMapSetter){return this._getGlobalPropagator().inject(r,t,o)}extract(r,t,o=dr.defaultTextMapGetter){return this._getGlobalPropagator().extract(r,t,o)}fields(){return this._getGlobalPropagator().fields()}disable(){ee.unregisterGlobal("propagation",pr.DiagAPI.instance())}_getGlobalPropagator(){return ee.getGlobal("propagation")||Qa}};Za.PropagationAPI=Ja});var qr=i(function(ti){var ri=xr().PropagationAPI.getInstance();ti.propagation=ri});var Tr=i(function(ai){var re=l(),Er=p(),d=X(),Pr=S(),Ar=z(),ni=class e{constructor(){this._proxyTracerProvider=new Ar.ProxyTracerProvider,this.wrapSpanContext=Pr.wrapSpanContext,this.isSpanContextValid=Pr.isSpanContextValid,this.deleteSpan=d.deleteSpan,this.getSpan=d.getSpan,this.getActiveSpan=d.getActiveSpan,this.getSpanContext=d.getSpanContext,this.setSpan=d.setSpan,this.setSpanContext=d.setSpanContext}static getInstance(){if(!this._instance)this._instance=new e;return this._instance}setGlobalTracerProvider(r){let t=re.registerGlobal("trace",this._proxyTracerProvider,Er.DiagAPI.instance());if(t)this._proxyTracerProvider.setDelegate(r);return t}getTracerProvider(){return re.getGlobal("trace")||this._proxyTracerProvider}getTracer(r,t){return this.getTracerProvider().getTracer(r,t)}disable(){re.unregisterGlobal("trace",Er.DiagAPI.instance()),this._proxyTracerProvider=new Ar.ProxyTracerProvider}};ai.TraceAPI=ni});var Rr=i(function(ci){var si=Tr().TraceAPI.getInstance();ci.trace=si});var O=i(function(br){Object.defineProperties(br,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var _i=R(),gi=G(),fr=A(),li=le(),pi=V(),di=ve(),xi=C(),qi=Se(),hr=y(),Ei=B(),te=v(),oe=S(),Ai=H(),Pi=Fe(),Ti=$e(),Ri=Ke(),fi=z(),hi=Ye(),Ir=He(),Nr=ze(),Or=nr(),Mr=ur(),Cr=qr(),vr=Rr(),Ii={context:Ir.context,diag:Nr.diag,logs:Or.logs,metrics:Mr.metrics,propagation:Cr.propagation,trace:vr.trace};br.DiagConsoleLogger=li.DiagConsoleLogger;br.DiagLogLevel=_i.DiagLogLevel;br.INVALID_SPANID=te.INVALID_SPANID;br.INVALID_SPAN_CONTEXT=te.INVALID_SPAN_CONTEXT;br.INVALID_TRACEID=te.INVALID_TRACEID;br.ProxyTracer=Ai.ProxyTracer;br.ProxyTracerProvider=fi.ProxyTracerProvider;br.ROOT_CONTEXT=fr.ROOT_CONTEXT;br.SamplingDecision=hi.SamplingDecision;br.SeverityNumber=qi.SeverityNumber;br.SpanKind=Pi.SpanKind;br.SpanStatusCode=Ti.SpanStatusCode;br.TraceFlags=Ei.TraceFlags;br.ValueType=di.ValueType;br.baggageEntryMetadataFromString=gi.baggageEntryMetadataFromString;br.context=Ir.context;br.createContextKey=fr.createContextKey;br.createNoopLogger=xi.createNoopLogger;br.createNoopMeter=pi.createNoopMeter;br.createTraceState=Ri.createTraceState;br.default=Ii;br.defaultTextMapGetter=hr.defaultTextMapGetter;br.defaultTextMapSetter=hr.defaultTextMapSetter;br.diag=Nr.diag;br.isSpanContextValid=oe.isSpanContextValid;br.isValidSpanId=oe.isValidSpanId;br.isValidTraceId=oe.isValidTraceId;br.logs=Or.logs;br.metrics=Mr.metrics;br.propagation=Cr.propagation;br.trace=vr.trace});
|
|
2
|
+
export{O};
|