@anthropic-ai/claude-agent-sdk 0.3.325 → 0.3.326

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
2
 
3
- // Version: 0.3.325
3
+ // Version: 0.3.326
4
4
 
5
5
  //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
6
  if (typeof Symbol.dispose !== 'symbol') {
@@ -13,4 +13,4 @@ if (typeof Symbol.asyncDispose !== 'symbol') {
13
13
  Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
14
  } catch {}
15
15
  }
16
- import{qe}from"./core-fxa8mwbm.mjs";import"./core-gbbw9cgm.mjs";import"./core-msnqqcc2.mjs";export{qe as getWorktreePathsPortable};
16
+ import{it}from"./core-ya1m7gzj.mjs";import"./core-td7rt8zt.mjs";import"./core-dnsvg8nc.mjs";export{it as getWorktreePathsPortable};
@@ -0,0 +1,20 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{c,s,g,o,S,Ze,z,T,At,Bn,en,Ce,tn,Kn,Gn,nt,jn,B}from"./core-dnsvg8nc.mjs";import"./core-td7rt8zt.mjs";import"./core-ya1m7gzj.mjs";import"./core-9sxfsmzx.mjs";import{st,xe,Z,Re,It,dn}from"./core-qbjntcdf.mjs";import{e}from"./core-rn7tc54w.mjs";class D{projectDirCache=new Map;agentTranscriptSubdirs=new Map;formerProjectDirs=new Set;cacheProjectDir(n,t){this.projectDirCache.set(n,t)}clearProjectDirCache(){this.projectDirCache.clear()}setAgentTranscriptSubdir(n,t){this.agentTranscriptSubdirs.set(n,t)}clearAgentTranscriptSubdir(n){this.agentTranscriptSubdirs.delete(n)}}var ye=new s(()=>new D);import{readFile as K}from"fs/promises";import{dirname as U,join as H}from"path";import*as y from"zod/v4";var F=200;function _(n){return[...n.replace(/[\x00-\x1f\x7f-\x9f]/g,"")].slice(0,F).join("")}function v(n){return _(Ze(n.trim())).trim()}var W=e(()=>y.object({customTitle:y.string()}));function G(n,t){return H(U(n),t,"custom-title.json")}async function P(n,t,a){let i=await J(G(n,t),a);if(i===void 0)return;let r;try{r=JSON.parse(i)}catch{return}let d=W().safeParse(r);if(!d.success)return;return v(d.data.customTitle)||void 0}async function J(n,t){if(c()&&t!==void 0)try{let a=Re(n);if(a!==void 0){let i=await t.readText([a]);if(!i.ok)return;let r=i.value.items[0];return r.found?r.value:void 0}}catch{return}if(g())return;try{return await K(n,"utf8")}catch{return}}import*as f from"zod/v4";var Ue=e(()=>f.looseObject({type:f.literal("continued-in"),continuedInSessionId:f.string()})),He=e(()=>f.looseObject({type:f.literal("assistant"),isApiErrorMessage:f.boolean().optional(),message:f.looseObject({stop_reason:f.string().nullish()}).optional()}));function I(n,t,a,i,r){let{head:d,tail:u,mtime:l,size:m}=t,p=d.indexOf(`
17
+ `),h=p>=0?d.slice(0,p):d;if(h.includes('"isSidechain":true')||h.includes('"isSidechain": true'))return null;let w=Ce(u,"custom-title")||i||Ce(d,"custom-title")||Ce(u,"ai-title")||Ce(d,"ai-title")||void 0,b=Kn(d)||void 0,k=At(d,"timestamp"),j;if(k){let C=Date.parse(k);if(!Number.isNaN(C))j=C}let x=w||tn(u,"lastPrompt")||tn(u,"summary")||b||Gn(d);if(!x)return null;let L=Bn(u,"gitBranch")||At(d,"gitBranch")||void 0,A=en(u,"relocated","relocatedCwd")||At(d,"cwd")||a||void 0,N=Ce(u,"tag")||void 0;return{sessionId:n,summary:x,lastModified:l,fileSize:m,customTitle:w,firstPrompt:b,gitBranch:L,cwd:A,tag:N,createdAt:j,archived:dn(r,t)}}async function O(n,t={},a,i){let r=T(n);if(!r)return;let d=c(),u=d?a:void 0,l=await jn(r,t.dir,xe(u),d,i);if(!l)return;let m=await nt(l.filePath,Z(st(l.filePath,u)));if(!m)return;let[p,h]=await Promise.all([Ce(m.tail,"custom-title")===void 0?P(l.filePath,r,u):void 0,It(l.filePath,r,u)]);return I(r,m,l.projectPath,p,h)??void 0}async function Ht(n,t){if(t?.sessionStore)return V(t.sessionStore,n,t);return O(n,t)}function Y(n){return n.map((t)=>o(t)).join(`
18
+ `)+`
19
+ `}function X(n,t){let a=Buffer.from(n,"utf-8"),i=a.length,r=a.subarray(0,z).toString("utf-8"),d=i>z?a.subarray(i-z).toString("utf-8"):r;return{mtime:t,size:i,head:r,tail:d}}function q(n){let t=n.trimEnd(),a=t.slice(t.lastIndexOf(`
20
+ `)+1);try{let i=S(a);if(typeof i==="object"&&i!==null&&"timestamp"in i&&typeof i.timestamp==="string"){let r=Date.parse(i.timestamp);if(!Number.isNaN(r))return r}}catch{}return Date.now()}async function Q(n,t,a){let i=B(a),r=await n.load({projectKey:i,sessionId:t});if(!r||r.length===0)return null;return Y(r)}async function V(n,t,a){if(!T(t))return;let i=await Q(n,t,a.dir);if(!i)return;let r=X(i,q(i));return I(t,r)??void 0}export{Ht as getSessionInfo};
@@ -0,0 +1,18 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{c,s,g,ft,i,ht,S,vn,l,de,Qt,tt,ce,N,I,Wn}from"./core-dnsvg8nc.mjs";import{Pt,Lt}from"./core-9sxfsmzx.mjs";import{e}from"./core-rn7tc54w.mjs";import{isAbsolute as q,sep as L}from"path";function X(n){let t=process.cwd();return t.endsWith(L)?t+n:t+L+n}function w(n){return(t)=>n.hostFiles.realPath(ht.workspace(t===""||q(t)?t:X(t)),{native:!0})}import{basename as V,dirname as B,isAbsolute as At,join as an,relative as Ot,sep as Kt}from"path";class _{available=void 0;probing=void 0;procUnreadableLogged=!1}var it=new s(()=>new _);function te(n){return i(n,"expected a segment that is not empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}function b(n){if(typeof n!=="object"||n===null)return i("key","expected a key object");let t=ye(n);if(t!==void 0)return t;let o=rn(n);if(o===void 0)return i("key",`${n.namespace} is not a storage namespace`);return re("key",o)}function re(n,t){for(let[o,a,u]of t){let d=`${n}.${o}`;if(a===void 0){if(u!=="optional")return i(d,"required")}else if(ae(o)){if(!(n==="scope"&&o==="agentRelPath"&&Array.isArray(a)&&a.length===0)&&(!Array.isArray(a)||!Qt(a)))return i(d,"expected a non-empty array of segments, none empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}else if(typeof a!=="string"||!de(a))return te(d)}return}function ae(n){return n==="relPath"||n==="agentRelPath"}var x=["commands","agents","output-styles","skills","workflows","routines","themes","rules","session-env","uploads","mcp-skill-archives","usage-data","mcp-discovery-cache"];var se=new Set(x),oe=`must be one of the userConfigDir directory names (${x.join(", ")})`,A=["installed","marketplaces","flagged","catalog","inUseSweep"];var ie=new Set(A),ue=`must be one of the pluginRegistry files (${A.join(", ")})`,O=["manifest","catalog"];var le=new Set(O),fe=`must be one of the marketplaceCache forms (${O.join(", ")})`;var K=["world"];var pe=new Set(K),me=`must be one of the session journal names (${K.join(", ")})`;function ge(n){return pe.has(n)}function he(n){return typeof n==="string"&&/^[0-9a-f]{64}$/.test(n)}function ye(n){if(n.namespace==="transcript")return je(n);if(n.namespace==="pluginAssetCache"&&!he(n.digest))return i("key.digest","must be a SHA-256 digest: 64 lowercase hexadecimal characters");if(n.namespace==="globalConfig"&&"kind"in n){if(!ke(n.kind))return i("key.kind",Ee);if(typeof n.stamp!=="string")return i("key.stamp","a recovery copy key carries its stamp")}if(n.namespace==="task")return Ye(n);if(n.namespace==="sidecar"){let t=j("key.sessionId",n.sessionId);if(t!==void 0)return t;if(H(n.relPath))return i("key.relPath",R);return _e(n.relPath)?i("key.relPath",we):void 0}if(n.namespace==="recording")return j("key.sessionId",n.sessionId)??(M(n.stamp)?void 0:i("key.stamp",Le));if(n.namespace==="jobsRoot")return We(n);if(n.namespace==="userConfigDir"&&!se.has(n.dir))return i("key.dir",oe);if(n.namespace==="fileHistory")return be(n);if(n.namespace==="settings"&&!He(n.layer))return i("key.layer","must be user, project or local");if(n.namespace==="log")return Be(n);if(n.namespace==="job"&&ze(n.relPath))return i("key.relPath",Je);if(n.namespace==="sessionLog")return nn("key",n)??(en(n.logName)?void 0:i("key.logName","must be the session-log stem <sessionId8>[-<title-slug>]: up to eight word characters, then lower-case a-z / 0-9 runs joined by single hyphens; not a bare device name"));if(n.namespace==="pluginRegistry"&&!ie.has(n.file))return i("key.file",ue);if(n.namespace==="marketplaceCache"){if(!("relPath"in n))return le.has(n.form)?void 0:i("key.form",fe);return n.form===void 0?void 0:i("key.form","a tree file key carries relPath, not form")}if(n.namespace!=="agentMemory")return;if(!Se(n.layer))return i("key.layer","must be user, project or local");if(n.layer==="user"&&"projectKey"in n)return i("key.projectKey","the user layer is not keyed by project");if(n.layer!=="user"&&typeof n.projectKey!=="string")return i("key.projectKey","required for the project and local layers");return typeof n.agentType==="string"?void 0:i("key.agentType","an agent memory key names its agent")}function be(n){return typeof n.backupFileName!=="string"||!Wn.test(n.backupFileName)?i("key.backupFileName","must be a backup file name the engine has ever written (hex hash @v version)"):void 0}function Se(n){return n==="user"||n==="project"||n==="local"}var F=["backup","corrupted"];var Ie=new Set(F),Ee=`must be one of the global-config copy kinds (${F.join(", ")})`;function ke(n){return Ie.has(n)}function je(n){let t=j("key.sessionId",n.sessionId);if(t!==void 0)return t;if(H(n.agentRelPath))return i("key.agentRelPath",R);if("sessionJournal"in n){if(typeof n.sessionJournal!=="string"||!ge(n.sessionJournal))return i("key.sessionJournal",me);return n.agentId===void 0&&n.agentRelPath===void 0&&!("journal"in n)?void 0:i("key.sessionJournal","a session journal key names the session's own journal: no agentId, agentRelPath or run journal")}if("journal"in n){if(n.journal!==!0)return i("key.journal","must be true");if(!Array.isArray(n.agentRelPath))return i("key.agentRelPath","a run journal key carries its run directory");return n.agentId===void 0?void 0:i("key.agentId","a transcript key names an agent transcript or the run journal, never both")}return n.agentRelPath!==void 0&&n.agentId===void 0?i("key.agentRelPath","requires agentId or journal"):void 0}var Pe="cloud-snapshots";var T=new Set(["memory","tiny_memory","bagel",Pe,"connector-downloads","bridge-pointer.json",".session-aliases"]),Ce=/^[0-9]{1,16}$/,Le="must be the recording stamp: 1 to 16 decimal digits (epoch milliseconds)",y=".cast",we=`<stamp>${y} inside a session's folder is that session's terminal recording stream: address it as keys.recording(projectKey, sessionId, stamp)`;function M(n){return typeof n==="string"&&Ce.test(n)}function _e(n){return Array.isArray(n)&&typeof n[0]==="string"&&ce(n[0]).some((t)=>ve(t)!==void 0)}function ve(n){if(!n.endsWith(y))return;let t=n.slice(0,-y.length);return M(t)?t:void 0}var D=[".ccr-tip.json",".precompact.json",y],Ae=`must not end with ${D.join(", ")}: those name a session's project-level sibling files`;function Oe(n){return ce(n).some((t)=>D.some((o)=>t.endsWith(o)))}var G=".dir-sync.json",Ke=`must not end with ${G}: that name is reserved for a cloud session's record at the project level`;function Fe(n){return ce(n).some((t)=>t.endsWith(G))}var Ne=`${[...T].join(", ")} are reserved: they name project-level entries, not sessions`;function Te(n){return ce(n).some((t)=>T.has(t))}function j(n,t){if(typeof t!=="string")return;if(Te(t))return i(n,Ne);if(Oe(t))return i(n,Ae);if(Fe(t))return i(n,Ke);return tt(t)?i(n,R):void 0}var Me=".meta.json",De=".meta is reserved for the list metadata key, under every spelling that opens its file";function Ge(n){return $e(`${n}.json`)}function $e(n){return ce(n).includes(Me)}var R="names a .jsonl stream, which only a transcript key addresses";function H(n){return Array.isArray(n)&&n.some((t)=>typeof t==="string"&&tt(t))}function He(n){return n==="user"||n==="project"||n==="local"}var Ue="must be debug, telemetry or apiDump";function Ve(n){return n==="debug"||n==="telemetry"||n==="apiDump"}function Be(n){if(!Ve(n.channel))return i("key.channel",Ue);if(n.channel!=="apiDump")return;for(let t of["agentId","runId"])if(t in n&&n[t]!==void 0)return i(`key.${t}`,"an apiDump key names its dump by one id — the agent's for a subagent's requests, else the session's (today's dump-prompts/<id>.jsonl); agentId and runId nest nothing on this channel");return}function Ye(n){if("taskId"in n&&(("meta"in n)||("highWaterMark"in n)))return i("key.taskId","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in n&&"highWaterMark"in n)return i("key.highWaterMark","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in n&&n.meta!==!0)return i("key.meta","must be true");if("highWaterMark"in n&&n.highWaterMark!==!0)return i("key.highWaterMark","must be true");if(typeof n.listId!=="string")return i("key.listId","a task key carries its listId");if("meta"in n||"highWaterMark"in n)return;if(typeof n.taskId!=="string")return i("key.taskId","a task item key carries its taskId");if(Ge(n.taskId))return i("key.taskId",De);return}function We(n){if("file"in n&&"draftKey"in n)return i("key.draftKey","a jobs-root key names the pins file or one draft, never both");if("file"in n)return n.file==="pins"?void 0:i("key.file","must be pins");if(typeof n.draftKey!=="string")return i("key.draftKey","a jobs-root draft key carries its draftKey");return tn.test(n.draftKey)?void 0:i("key.draftKey","must be 8 lowercase hex characters")}var U="timeline.jsonl",Je=`${U} is the job's timeline stream: address it as keys.jobTimeline(jobId)`;function ze(n){return Array.isArray(n)&&typeof n[0]==="string"&&ce(n[0]).includes(U)}var qe=/^\d{4}$/,v=/^\d{2}$/,Xe=/^[A-Za-z0-9_-]{1,8}(?:-[a-z0-9]+)*$/,Ze=128,Qe=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i;function en(n){return typeof n==="string"&&n.length<=Ze&&Xe.test(n)&&!Qe.test(n)}function nn(n,t){if(t.year!==void 0&&!k(qe,t.year))return i(`${n}.year`,"must be four digits (YYYY)");if(t.month!==void 0&&!k(v,t.month))return i(`${n}.month`,"must be two digits (MM)");if(t.day!==void 0&&!k(v,t.day))return i(`${n}.day`,"must be two digits (DD)");return}function k(n,t){return typeof t==="string"&&n.test(t)}var tn=/^[0-9a-f]{8}$/;function rn(n){switch(n.namespace){case"transcript":return[["projectKey",n.projectKey],["sessionId",n.sessionId],["agentId",n.agentId,"optional"],["agentRelPath",n.agentRelPath,"optional"]];case"history":case"identity":return[];case"globalConfig":return"kind"in n?[["stamp",n.stamp]]:[];case"settings":return n.layer==="user"?[]:n.layer==="project"?[["projectKey",n.projectKey]]:[["consentRootKey",n.consentRootKey]];case"task":return"taskId"in n?[["listId",n.listId],["taskId",n.taskId]]:[["listId",n.listId]];case"memory":return[["projectKey",n.projectKey],["relPath",n.relPath]];case"pluginRegistry":return[];case"marketplaceCache":return"relPath"in n?[["marketplace",n.marketplace],["relPath",n.relPath]]:[["marketplace",n.marketplace]];case"pluginCache":return[["marketplace",n.marketplace],["plugin",n.plugin],["version",n.version],["relPath",n.relPath]];case"cache":return[["store",n.store],["id",n.id]];case"paste":return[["id",n.id]];case"pluginAssetCache":return[["digest",n.digest]];case"state":return[["id",n.id]];case"plan":return[["name",n.name]];case"feedbackDraft":return[["draftId",n.draftId]];case"agentMemory":return[...n.layer==="user"?[]:[["projectKey",n.projectKey]],["agentType",n.agentType],["relPath",n.relPath]];case"team":return[["team",n.team]];case"sidecar":return[["projectKey",n.projectKey],["sessionId",n.sessionId],["relPath",n.relPath]];case"scratch":return[["sessionId",n.sessionId],["relPath",n.relPath]];case"userConfigDir":return[["relPath",n.relPath]];case"fileHistory":return[["sessionId",n.sessionId],["backupFileName",n.backupFileName]];case"job":return[["jobId",n.jobId],["relPath",n.relPath]];case"daemon":return[["relPath",n.relPath]];case"jobsRoot":return"file"in n?[]:[["draftKey",n.draftKey]];case"session":return[["file",n.file]];case"bridgePointer":case"sessionAliases":return[["projectKey",n.projectKey]];case"dirSyncRecord":return[["projectKey",n.projectKey],["sessionId",n.sessionId]];case"mailbox":return[["team",n.team],["teammate",n.teammate]];case"log":return[["sessionId",n.sessionId],["agentId",n.agentId,"optional"],["runId",n.runId,"optional"]];case"jobTimeline":return[["jobId",n.jobId]];case"recording":return[["projectKey",n.projectKey],["sessionId",n.sessionId],["stamp",n.stamp]];case"sessionLog":return[["projectKey",n.projectKey],["year",n.year],["month",n.month],["day",n.day],["logName",n.logName]]}return}function sn(n){return n.namespace!=="transcript"||n.journal!==void 0||n.sessionJournal!==void 0?void 0:n.agentId??null}function st(n,t){if(!c()||t===void 0)return;if(typeof n!=="string")return sn(n.key)===null?{backend:t,key:n.key}:void 0;if(!n.endsWith(".jsonl"))return;let o=B(n);if(B(o)!==I())return;let a=V(o),u=V(n,".jsonl");if(n!==an(I(),a,`${u}.jsonl`))return;let d=N.transcript(a,u);return b(d)===void 0?{backend:t,key:d}:void 0}function xe(n){if(!c()||n===void 0)return;return{backend:n,transcriptKey:N.transcript,isKeySegment:de,realWorkspacePath:w(n)}}function Z(n){return n===void 0?void 0:{source:n,hoverRestOn:c()}}import{dirname as un,join as cn}from"path";import*as r from"zod/v4";import{basename as Y,dirname as W}from"path";var on=6;function Re(n){let t=Y(n);if(tt(t))return;let o=I(),a=[t],u=W(n);while(u!==o&&a.length<=on+1){let E=W(u);if(E===u)return;a.unshift(Y(u)),u=E}if(u!==o||a.length<3)return;let[d,m,...f]=a;if(!de(d)||!de(m)||f.length===0||!f.every(de))return;let h=N.sidecar(d,m,f);return b(h)===void 0?h:void 0}var ln=e(()=>r.object({archived:r.boolean(),at:r.iso.datetime({offset:!0})})),P=4096;function vt(n,t){return cn(un(n),t,"archived.json")}async function It(n,t,o){try{let a=vt(n,t),u=c()&&o!==void 0?Re(a):void 0,d;if(u!==void 0&&o!==void 0){let f=await o.readText([{key:u,offset:0,length:P+1}]),h=f.ok?f.value.items[0]:void 0;if(!h?.found||h.totalBytes>P)return;d=h.value}else if(g())return;else{let f=await l().readFileFdGated(a,P);if(f===null)return;d=f.content}let m=ln().safeParse(S(d));return m.success?{archived:m.data.archived,atMs:Date.parse(m.data.at)}:void 0}catch{return}}function dn(n,t){if(!n?.archived)return n?.archived;return!(J(t.tail,n.atMs)||t.head!==t.tail&&J(t.head,n.atMs))}function J(n,t){return n.split(`
17
+ `).some((o)=>{if(!(o.includes('"user"')||o.includes('"queued_command"'))||o.includes('"tool_result"'))return!1;let a;try{a=vn(o)}catch{return!1}let u=gn(a);return u!==void 0&&u>t})}var fn=["human","sdk","unknown"],pn=e(()=>{let n=r.object({kind:r.string()}).optional(),t=r.literal(!1).optional();return r.discriminatedUnion("type",[r.object({type:r.literal("user"),timestamp:r.string(),message:r.object({content:r.unknown()}),origin:n,promptSource:r.string().optional(),persist:r.undefined().optional(),turnOrigin:r.enum(fn).optional(),toolUseResult:r.null().optional(),isCompactSummary:t,isSidechain:t,isVirtual:t,isVisibleInTranscriptOnly:t,isMeta:t,textNotTyped:t,handedOff:t,queueSkipAttachments:t,wakeupSource:r.undefined().optional(),scheduledTaskId:r.undefined().optional()}),r.object({type:r.literal("attachment"),timestamp:r.string(),isSidechain:t,attachment:r.object({type:r.literal("queued_command"),prompt:r.unknown(),origin:n,commandMode:r.enum(["prompt","bash"]).optional(),isMeta:t})})])}),mn=e(()=>r.array(r.looseObject({type:r.string()})));function gn(n,t=!1){let o=pn().safeParse(n);if(!o.success)return;let{data:a}=o,[u,d]=a.type==="user"?[a.message.content,a.origin]:[a.attachment.prompt,a.attachment.origin];if(d!==void 0&&d.kind!=="human")return;let m=typeof u==="string"?[{type:"text",text:u}]:mn().safeParse(u).data??[];if(m.some((p)=>p.type==="tool_result"))return;let f=m.map((p)=>typeof p.text==="string"?p.text.trimStart():""),z=(d!==void 0||t&&a.type==="user"&&a.promptSource!==void 0?f.some((p)=>p!=="")&&!f.some((p)=>p.startsWith(`<${Pt}>`)):ft({type:"user",message:{content:u}},{commandFallback:""})!==void 0||f.some((p)=>p.startsWith(`<${Lt}>`)))||m.some((p)=>p.type==="image"||p.type==="document"),C=Date.parse(a.timestamp);return z&&!Number.isNaN(C)?C:void 0}
18
+ export{st,xe,Z,Re,vt,It,dn};
@@ -0,0 +1,17 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{u,r,me,x}from"./core-dnsvg8nc.mjs";import{lstat as n,rm as s,rmdir as m,unlink as f}from"fs/promises";var a=new Set(["EPERM","EACCES","EBUSY"]),E=50;async function cn(t){for(let o=1;;o++){let i=!0;try{await s(t,{recursive:!0,force:!0})}catch(e){if(r(e)!=="ENOTEMPTY")throw e;i=!1}try{await n(t)}catch(e){if(me(e)||i&&process.platform==="win32"&&a.has(r(e)))return;throw e}if(o===3)throw Object.assign(new u(`'${t}' is still on disk after three tries to delete it. A program may be writing to it, such as a running Claude Code session, or you may not have permission to change it. Stop that program or fix the permissions, then delete it yourself.`,"removeTree: still on disk after three tries"),{code:"ENOTEMPTY"});await x(o*E)}}
17
+ export{cn};
@@ -0,0 +1,17 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{createHash as n}from"crypto";function Ke(t){if(typeof t!=="string"&&!ArrayBuffer.isView(t))throw Object.assign(TypeError("sha256Hex: the data is neither text nor bytes"),{code:"ERR_INVALID_ARG_TYPE"});return n("sha256").update(t).digest("hex")}class i{resetters=[];built=[];lazy(t){let r,s=()=>{r=void 0};return this.resetters.push(s),()=>{if(r===void 0)r=t(),this.built.push(s);return r}}builtCount(){return this.built.length}releaseBuiltSince(t){for(let r of this.built.splice(t))r()}reset(){for(let t of this.resetters)t();this.built.length=0}}var o=new i;function e(t){return o.lazy(t)}
17
+ export{Ke,e};
@@ -0,0 +1,18 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{c,u,r,g,o,Te,T,Rt,Ot,I,He,rt,Tt,wt,ke,rn,B}from"./core-dnsvg8nc.mjs";import"./core-td7rt8zt.mjs";import{it}from"./core-ya1m7gzj.mjs";import"./core-9sxfsmzx.mjs";import{Be}from"./core-2h2qc9qv.mjs";import"./core-rn7tc54w.mjs";import{xe,Z,Re,vt}from"./core-qbjntcdf.mjs";import{cn}from"./core-qj4dtgyt.mjs";import{randomUUID as F}from"crypto";import{constants as P}from"fs";import{open as U,readdir as j,rm as K,stat as z}from"fs/promises";import{join as l}from"path";import{mkdir as N}from"fs/promises";import{dirname as R}from"path";async function v(e,t,n,i){let s=vt(e,t),a=o({archived:n.archived,at:new Date().toISOString(),by:n.by});if(c()&&i!==void 0){let d=Re(s);if(d!==void 0){let f=await i.write(d,a,{mode:384});if(!f.ok)throw Error("Session archive: record not writable via storage",{cause:f.error});return}}if(g())throw Error("Session archive: this process keeps no files");await N(R(s),{recursive:!0,mode:448}),await Be(s,a,384)}var V=64;function h(e){return c()?e:void 0}async function O(e,t,n={},i){if(!T(e))throw Error(`Invalid sessionId: ${e}`);if(!t.trim())throw Error("title must be non-empty");let s=o({type:"custom-title",customTitle:t.trim(),sessionId:e})+`
17
+ `;await A(e,s,n,h(i))}async function b(e,t,n={},i){if(!T(e))throw Error(`Invalid sessionId: ${e}`);if(t!==null){let a=Te(t).trim();if(!a)throw Error("tag must be non-empty (use null to clear)");t=a}let s=o({type:"tag",tag:t??"",sessionId:e})+`
18
+ `;await A(e,s,n,h(i))}async function k(e,t,n={},i){if(!T(e))throw new u(`Invalid sessionId: ${e}`,"setSessionArchived: invalid sessionId (must be a UUID)");let s=c(),a=s?i:void 0,d=new Set;for await(let{filePath:m}of rn(e,n.dir,xe(a),s))d.add(m);if(d.size===0)throw new u(n.dir?`Session ${e} not found in project directory for ${n.dir}`:`Session ${e} not found in any project directory`,"setSessionArchived: session not found");let p=(await Promise.allSettled([...d].map((m)=>v(m,e,{archived:t,by:"sdk"},a)))).find((m)=>m.status==="rejected");if(p)throw p.reason}async function D(e,t={},n){if(!T(e))throw Error(`Invalid sessionId: ${e}`);let i=h(n);for(let s of await L(t,i)){if(c()&&i!==void 0){let f=rt(s,i.isKeySegment);if(f!==void 0){if(await H(f,e,i))return;continue}}let a=l(s,`${e}.jsonl`),d;try{({size:d}=await z(a))}catch(f){let p=r(f);if(p==="ENOENT"||p==="ENOTDIR")continue;throw f}if(d===0)continue;await K(a,{force:!0}),await cn(l(s,e));return}throw Error(t.dir?`Session ${e} not found in project directory for ${t.dir}`:`Session ${e} not found in any project directory`)}async function H(e,t,n){let{backend:i,transcriptKey:s}=n,a=s(e,t),d=await i.statMeta(a);if(!d.ok){if(d.error.code==="NotFound")return!1;throw Error("Session delete: transcript unreadable via storage",{cause:d.error})}if((d.value.storedBytes??d.value.size)===0)return!1;for(let p of["transcript","sidecar"]){let m=await i.deleteScope({namespace:p,projectKey:e,sessionId:t});if(!m.ok)throw Error("Session delete: session directory not deletable via storage",{cause:m.error})}let f=await i.delete(a);if(!f.ok)throw Error("Session delete: transcript not deletable via storage",{cause:f.error});return!0}async function L(e,t){if(e.dir){let i=await Tt(e.dir,Rt(t,c())),s=await E(i,t),a;try{a=await it(i)}catch{a=[]}for(let d of a){if(d===i)continue;s.push(...await E(d,t))}return s}let n=I();if(c()&&t!==void 0){let i=await _(t);if(i===void 0)return[];if(i.laterPageFailed)throw Error("Session delete: project listing incomplete via storage");return i.names.map((s)=>l(n,s))}try{return(await j(n,{withFileTypes:!0})).filter((s)=>s.isDirectory()||s.isSymbolicLink()).map((s)=>l(n,s.name))}catch{return[]}}async function E(e,t){let n=Z(t);if(n===void 0||!n.hoverRestOn)return ke(e);let i=await ke(e,n),s=He(e),a=process.platform==="win32",d=[];for(let f of i)if(f===s||await wt(f,e,a,n))d.push(f);return d}async function _(e){let t=[],n,i=0;try{do{let s=await e.backend.listEntries({namespace:"transcript"},{skipScopeStats:!0,...n!==void 0&&{cursor:n}});if(!s.ok)return i===0?void 0:{names:t,laterPageFailed:!0};for(let a of s.value.items){let d=Ot(a,e.isKeySegment);if(d!==void 0)t.push(d)}n=s.value.cursor}while(n&&++i<V);return{names:t,laterPageFailed:Boolean(n)}}catch{return i===0&&t.length===0?void 0:{names:t,laterPageFailed:!0}}}async function A(e,t,n,i){let s=`${e}.jsonl`;if(n.dir){let f=await Tt(n.dir,Rt(i,c()));for(let m of await ke(f,Z(i)))if(await w(l(m,s),t,y(m,e,i)))return;let p;try{p=await it(f)}catch{p=[]}for(let m of p){if(m===f)continue;for(let S of await ke(m,Z(i)))if(await w(l(S,s),t,y(S,e,i)))return}throw Error(`Session ${e} not found in project directory for ${n.dir}`)}let a=I();if(c()&&i!==void 0){let f=await _(i);if(f===void 0)throw new u(`Session ${e} not found (no projects directory)`,"Session not found (no projects directory)");let{names:p}=f;for(let m of p){let S=l(a,m);if(await w(l(S,s),t,y(S,e,i)))return}throw new u(`Session ${e} not found in any project directory`,"Session not found in any project directory")}let d;try{d=await j(a)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let f of d)if(await w(l(a,f,s),t))return;throw Error(`Session ${e} not found in any project directory`)}async function w(e,t,n){if(c()&&n!==void 0)return C(n,t);let i;try{i=await U(e,P.O_WRONLY|P.O_APPEND)}catch(s){let a=r(s);if(a==="ENOENT"||a==="ENOTDIR")return!1;throw s}try{let{size:s}=await i.stat();if(s===0)return!1;let a=process.platform==="win32"?s:void 0,d=Buffer.from(t,"utf8"),f=0;while(f<d.length){let{bytesWritten:p}=await i.write(d,f,d.length-f,a);if(p<=0)throw new u(`tryAppend: short write to ${e} stalled with ${d.length-f} bytes remaining`,"tryAppend: zero-progress short write");if(f+=p,a!==void 0)a+=p}return!0}finally{await i.close()}}async function C({backend:e,key:t},n){let i=await e.append(t,[{data:n}],{precondition:{type:"ifExists",nonEmpty:!0}});if(!i.ok){if(i.error.code==="NotFound")return!1;throw Error("Session append: transcript not writable via storage",{cause:i.error})}return!0}function y(e,t,n){if(!c()||n===void 0)return;let i=rt(e,n.isKeySegment);return i===void 0?void 0:{backend:n.backend,key:n.transcriptKey(i,t)}}async function je(e,t,n){if(n?.sessionStore)return W(n.sessionStore,e,t,n.dir);return O(e,t,n)}async function Oe(e,t,n){if(n?.sessionStore)return G(n.sessionStore,e,t,n.dir);return b(e,t,n)}async function be(e,t){return M(e,!0,t)}async function De(e,t){return M(e,!1,t)}async function $e(e,t){if(!T(e))throw new u(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(t?.sessionStore){if(!t.sessionStore.delete)return;let n=B(t.dir);await t.sessionStore.delete({projectKey:n,sessionId:e});return}return D(e,t)}async function M(e,t,n){if(n?.sessionStore)throw new u("Archiving is not supported with sessionStore: a SessionStore holds transcript entries, and the archived mark is not one","setSessionArchived: sessionStore is not supported");return k(e,t,n)}async function W(e,t,n,i){if(!T(t))throw new u(`Invalid sessionId: ${t}`,"renameSession: invalid sessionId (must be a UUID)");if(!n.trim())throw Error("title must be non-empty");let s=B(i);await e.append({projectKey:s,sessionId:t},[{type:"custom-title",customTitle:n.trim(),sessionId:t,uuid:F(),timestamp:new Date().toISOString()}])}async function G(e,t,n,i){if(!T(t))throw new u(`Invalid sessionId: ${t}`,"tagSession: invalid sessionId (must be a UUID)");if(n!==null){let a=Te(n).trim();if(!a)throw Error("tag must be non-empty (use null to clear)");n=a}let s=B(i);await e.append({projectKey:s,sessionId:t},[{type:"tag",tag:n??"",sessionId:t,uuid:F(),timestamp:new Date().toISOString()}])}export{be as archiveSession,$e as deleteSession,je as renameSession,Oe as tagSession,De as unarchiveSession};
@@ -0,0 +1,17 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{f,s,r,me,Y,Ut,Ft,ct,Ht,A,G}from"./core-dnsvg8nc.mjs";import{lstatSync as T,statSync as Z}from"fs";import{delimiter as J,dirname as Q,extname as x,isAbsolute as ee,join as te,resolve as ne}from"path";function se(){return process.platform==="win32"}class D{resolved=new Map;envKey=void 0;cwdKey=void 0;skippedFolders;foldersReadFailed;namesMaybeMissed=new Set;vettedFolders=new Map;constructor(e){this.skippedFolders=e?.skippedFolders??new Map,this.foldersReadFailed=e?.foldersReadFailed??new Map}lookup(e){return this.resolved.get(e)}remember(e,n){this.resolved.set(e,n)}forget(e){this.resolved.delete(e)}}var N=new s(()=>new D),k=[".com",".exe",".bat",".cmd"],E=5000;function b(e){return P(e,process.hrtime.bigint())}function P(e,n){return Number(n-e)/1e6}var L=new Set(["EACCES","EPERM","ENOTDIR","ELOOP","ENAMETOOLONG","EINVAL"]),H=600000,re=250;function ie(e,n=process.platform){return n==="win32"?e.replaceAll('"',""):e}function oe(e){if(!ee(e))return!1;return process.platform!=="win32"||/^(?:[a-zA-Z]:[\\/]|[\\/]{2})/.test(e)}function de(e){let n=ie(e,"win32").trim();if(!oe(n)||Y(n))return null;let t=ne(n);return Y(t)?null:t}function ae(e){return e.split(J).flatMap((n)=>{let t=de(n);return t===null?[]:[t]})}function le(e,n,t){return{eisdirIsFolder:"onAnyDrive",allowLocalWsl:ct(e),report:n,singleTry:t}}var ue=512;function ce(e,n,t){let o=n.get(e);if(o===void 0)return!1;for(let i of o){if(t.has(i.path))continue;let d;try{d=T(i.path,{bigint:!0,throwIfNoEntry:!1})}catch{}if(!d?.isDirectory()||d.dev!==i.dev||d.ino!==i.ino)return n.delete(e),!1;t.add(i.path)}return!0}function fe(e,n){let t=n.chain;return t!==void 0&&!n.metLink&&t.length>0&&t.at(-1)?.path===e&&t.every((o)=>o.ino!==0n)?t:void 0}function V(e,n,t,o){let i=process.hrtime.bigint(),d=n.get(e),a=P(t,i),g=(d?.spentMs??0)+(a>re?a:0),c=o||d!==void 0&&d.stands&&P(d.lastAt,i)<=H;return n.set(e,{lastAt:i,spentMs:g,stands:c}),g>E?{verdict:"stalled",missing:!1,settled:!0}:{verdict:"unreadable"}}function K(e,n,t,o){let i=process.hrtime.bigint(),d=()=>b(i)>E;if(ce(e,n,t))return o.delete(e),{verdict:"pass",plainDir:!0};let a=o.get(e),g=a!==void 0&&a.stands&&b(a.lastAt)<=H,c={};if(Ht(e,le(e,c,g))){let p=c.unclassifiable;if(p===void 0)return{verdict:"refused"};if(d())return{verdict:"stalled",missing:!1,settled:L.has(p)};if(L.has(p))return V(e,o,i,!g&&(p==="EACCES"||p==="EPERM"));return{verdict:"unsure",code:p}}if(c.endedMissing===!0&&d())return{verdict:"stalled",missing:!0,settled:!1};let F=c.chain?.at(-1)?.path===e;if(F)o.delete(e);let u=fe(e,c);if(u!==void 0){if(n.size>=ue)n.clear();n.set(e,u);for(let p of u)t.add(p.path)}return{verdict:"pass",plainDir:F}}function B(e,n,t,o){let i=`${n??""}\x00${t??""}`;if(e.envKey!==i)e.envKey=i,e.resolved.clear(),e.skippedFolders.clear(),e.foldersReadFailed.clear(),e.namesMaybeMissed.clear();if(e.cwdKey!==o)e.cwdKey=o,e.resolved.clear(),e.namesMaybeMissed.clear()}function pe(e,n=!1){let t=N.of(A().host),o=G("PATH"),i=G("PATHEXT"),d;try{d=process.cwd()}catch{return t.namesMaybeMissed.add(e),null}B(t,o,i,d);let a=t.lookup(e);if(a!==void 0)if(a!==null){let g=Q(a),c=t.skippedFolders.get(g)==="denied"?{verdict:"refused"}:K(g,t.vettedFolders,new Set,new Map);switch(c.verdict){case"stalled":if(t.skippedFolders.set(g,"unreachable"),c.missing)return a;if(c.settled)t.forget(e);break;case"pass":{let m;try{m=T(a,{throwIfNoEntry:!1})}catch(F){let u=r(F),p=(u==="EACCES"||u==="EPERM")&&!Ft(g);if(!me(F)&&!p)return a}if(c.plainDir){if(t.foldersReadFailed.delete(g),t.skippedFolders.get(g)==="unreachable")t.skippedFolders.delete(g)}if(m!==void 0&&(m.isFile()||m.isSymbolicLink())&&!Ut(a,d,m))return a;t.forget(e);break}case"refused":case"unreadable":case"unsure":t.forget(e);break;default:}}else{if(!n)return a;t.forget(e)}if(n)t.skippedFolders.clear(),t.foldersReadFailed.clear();return U(e,o,i,d,t,t.vettedFolders,ge)}function pn(e,n){let t;try{t=process.cwd()}catch{return null}let o=N.of(A().host),i=G("PATH"),d=G("PATHEXT"),a=n===i;if(a)B(o,i,d,t);return U(e,n,d,t,new D(a?o:void 0),o.vettedFolders,he)}var ge={searchCwdFirst:!0},he={searchCwdFirst:!1};function U(e,n,t,o,i,d,a){if(i.namesMaybeMissed.delete(e),e===""||/[*?"<>|:\\/]/.test(e))return i.remember(e,null),null;try{let g=[...a.searchCwdFirst?[o]:[],...ae(n??"")],c=t?.split(";").map((l)=>l.trim().toLowerCase()),m=c===void 0?k:f(c).filter((l)=>k.includes(l)),F=[...k.includes(x(e).toLowerCase())?[e]:[],...m.map((l)=>e+l)],u=!1,p=m.length<k.length||n===void 0,h=!1,X=new Set;for(let l of g){if(i.skippedFolders.has(l)){if(i.skippedFolders.get(l)==="denied")p=!0;else u=h=!0;continue}let S=K(l,d,X,i.foldersReadFailed);switch(S.verdict){case"pass":break;case"stalled":i.skippedFolders.set(l,"unreachable"),u=h=!0;continue;case"refused":i.skippedFolders.set(l,"denied"),p=!0;continue;case"unreadable":p=!0;continue;case"unsure":u=h=!0;continue;default:}let O,M,W=process.hrtime.bigint();if(!S.plainDir)try{O=Z(l,{throwIfNoEntry:!1})}catch(w){M=r(w)??"UNKNOWN"}if(!S.plainDir&&!O?.isDirectory()){if(b(W)>E)i.skippedFolders.set(l,"unreachable"),u=h=!0;else if(M!==void 0)if(L.has(M))if(V(l,i.foldersReadFailed,W,!1).verdict==="stalled")i.skippedFolders.set(l,"unreachable"),u=h=!0;else p=!0;else u=h=!0;continue}if(!S.plainDir)i.foldersReadFailed.delete(l);let _=l.toLowerCase().split(/[\\/]+/).filter(Boolean),q=_.at(-1)==="windowsapps"&&_.at(-2)==="microsoft";for(let w of F){let R=te(l,w),y,v=!1,z=process.hrtime.bigint();try{y=T(R,{throwIfNoEntry:!1})}catch(j){let C=r(j),I=(C==="EACCES"||C==="EPERM")&&q;if(!I)u=h=!0;v=I}if(!v&&y===void 0){if(b(z)>E){i.skippedFolders.set(l,"unreachable"),u=h=!0;break}continue}if(!v&&!(y?.isFile()||y?.isSymbolicLink()))continue;if(Ut(R,o,y??null)){u=!0;continue}if(!h)i.remember(e,R);return R}}if(u||p)i.namesMaybeMissed.add(e);if(!u)i.remember(e,null);return null}catch{return i.namesMaybeMissed.add(e),null}}function fn(e,n=!1){if(!se())return e;if(e.includes("/")||e.includes("\\"))return e;return pe(e,n)}
17
+ export{pn,fn};
@@ -1,6 +1,6 @@
1
1
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
2
 
3
- // Version: 0.3.325
3
+ // Version: 0.3.326
4
4
 
5
5
  //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
6
  if (typeof Symbol.dispose !== 'symbol') {
@@ -13,5 +13,5 @@ if (typeof Symbol.asyncDispose !== 'symbol') {
13
13
  Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
14
  } catch {}
15
15
  }
16
- import{u}from"./core-msnqqcc2.mjs";var h=["us","eu","apac","jp","au","us-gov","global"],Rn=["us","eu","apac","jp","au","global"];function b(e,n,t){if(e===n)return 0;let i=e.length,o=n.length,r=t+1;if(Math.abs(i-o)>t)return r;let s=new Int32Array(o+2).fill(r),a=new Int32Array(o+2).fill(r),d=new Int32Array(o+2).fill(r);for(let l=0;l<=Math.min(o,t);l++)a[l]=l;for(let l=1;l<=i;l++){let f=Math.max(1,l-t),M=Math.min(o,l+t);d[f-1]=f===1?Math.min(l,r):r;let g=d[f-1];for(let c=f;c<=M;c++){let m=Math.min(a[c]+1,d[c-1]+1,a[c-1]+(e[l-1]===n[c-1]?0:1),r);if(l>1&&c>1&&e[l-1]===n[c-2]&&e[l-2]===n[c-1])m=Math.min(m,s[c-2]+1);d[c]=m,g=Math.min(g,m)}if(d[M+1]=r,g>t)return r;[s,a,d]=[a,d,s]}return a[o]}var On=["claude-3-5-haiku","claude-3-5-sonnet","claude-3-7-sonnet","claude-fable-5","claude-fable-5-1","claude-fable-5-2","claude-haiku-4-5","claude-haiku-5-5","claude-mythos-5","claude-mythos-5-1","claude-mythos-5-2","claude-opus-4-0","claude-opus-4-1","claude-opus-4-5","claude-opus-4-6","claude-opus-4-7","claude-opus-4-8","claude-opus-5","claude-opus-5-5","claude-sonnet-4-0","claude-sonnet-4-5","claude-sonnet-4-6","claude-sonnet-5","claude-sonnet-5-5"],x=["sonnet","opus","haiku","fable","best","sonnet[1m]","opus[1m]","fable[1m]","opusplan"],ge=["sonnet","opus","haiku","fable"];function ft(e){return x.includes(e)}function Bt(e){return e.replace(/\[1m\]$/i,"")}function y(e){return e.replace(/\[(1|2)m\]/gi,"")}function be(e){return ge.includes(e)}function V(e){let n=e.trim().toLowerCase();if(n===""||/\s/.test(n))return null;n=n.replace(/\[[12]m\]$/,"");let t=n.lastIndexOf("/");if(t!==-1)n=n.slice(t+1);let i=/^(?:([a-z-]+)\.)?anthropic\.(claude-.*)$/.exec(n);if(i){let[,a,d=""]=i;if(a!==void 0&&!h.includes(a))return null;n=d}let o=I(n);if(!o)return null;let r=n.slice(o.base.length);if(r!==""&&!/^[-@]/.test(r))return null;let s={family:o.family,major:o.major,legacyVersionFirst:o.legacyVersionFirst,base:o.base};if(o.minor!==void 0)s.minor=o.minor;if(!E(r))s.trailer=r;else{let a=/(?:-v\d+@|[-@])(\d{8})/.exec(r)?.[1];if(a!==void 0)s.date=a}return s}function E(e){return/^(?:-fast|-latest)?(?:-v\d{1,3}@\d{8}|[-@]\d{8})?(?:-v\d{1,3}(?::\d{1,3})?)?$/.test(e)}function Tn(e,n){return e.major-n.major||(e.minor??0)-(n.minor??0)}function I(e){let n=/^claude-([a-z]+)-(\d{1,2})(?!\d)(?:-(\d{1,2})(?!\d))?/.exec(e);if(n){let[i,o="",r="",s]=n;return{family:o,major:Number(r),minor:s===void 0?void 0:Number(s),legacyVersionFirst:!1,base:i}}let t=/^claude-(\d{1,2})(?!\d)(?:-(\d{1,2})(?!\d))?-([a-z]+)/.exec(e);if(t){let[i,o="",r,s=""]=t;return{family:s,major:Number(o),minor:r===void 0?void 0:Number(r),legacyVersionFirst:!0,base:i}}return null}function D(e){let n=e.replace(/[\u0000-\u001f\u007f-\u009f]/g,"?");return n.length>128?`${n.slice(0,128)}…`:n}function A(){let e=[...ge],n=e.pop();return e.length===0?n??"":`${e.join(", ")} or ${n}`}function p(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ye(e){let n=e.trim().toLowerCase(),t=y(n).trim(),i=t!==n?" Context-size tags such as [1m] are ignored: the entry blocks the model at every context size.":"";if(t==="")return{entry:null,warning:"An empty deniedModels entry was ignored."};if(be(t))return{entry:{kind:"family",family:t},...i!==""&&{warning:`"${D(e)}" blocks every ${p(t)} model.${i}`}};if(ft(t)||t==="default")return{entry:null,warning:`"${D(e)}" was ignored: it names a different model depending on the release and settings. Name the model instead, for example "claude-opus-5-5".`};let o=V(t),r=o!==null||t.startsWith("claude-")?t:`claude-${t}`,s=o??(r!==t?V(r):null);if(s){let a=r.lastIndexOf(s.base),d=a===-1?"":r.slice(a+s.base.length),l=s.trailer===void 0&&d!==""?` "${D(d)}" is ignored.`:"";return{entry:{kind:"model",id:s},...(i!==""||l!=="")&&{warning:`"${D(e)}" blocks ${w(s)}.${l}${i}`}}}return{entry:{kind:"literal",value:t},warning:_(e,t)}}function w(e){let n=p(e.family);return e.minor===void 0?`every ${n} ${e.major}.x model`:`${n} ${e.major}.${e.minor} in every spelling and snapshot`}function _(e,n){let t=`"${D(e)}" blocks only the exact model name "${D(n)}"; other spellings of the same model are not blocked.`,i=n.replace(/(\d)\.(\d)/g,"$1-$2");if(i!==n){let r=i.startsWith("claude-")?i:`claude-${i}`;if(V(r)!==null)return`${t} To block a version, write it with a hyphen: "${D(r)}".`}let o=new RegExp(`^(${ge.join("|")})\\s+(\\d+)(?:\\.(\\d+))?$`).exec(n);if(o){let[,r,s,a]=o;return a!==void 0?`${t} To block a version, write its model ID, for example "claude-${r}-${s}-${a}".`:`${t} To block only version ${s}, write "claude-${r}-${s}-0"; "claude-${r}-${s}" blocks every ${p(r)} ${s}.x model.`}if(/^[a-z]+$/.test(n)){let r=ge.find((s)=>b(n,s,1)===1);return r!==void 0?`${t} If you meant the ${p(r)} family, write "${r}".`:`${t} To block a model family other than ${A()}, list its versioned IDs.`}return t}function S(e,n){if(e.family!==n.family||e.major!==n.major)return!1;if(e.minor!==void 0&&(n.minor??0)!==e.minor)return!1;if(e.trailer===void 0)return!0;let t=n.trailer??"";return t===e.trailer||t.startsWith(`${e.trailer}-`)}function k(e,n){for(let t=e.indexOf(n);t!==-1;t=e.indexOf(n,t+1)){let i=t===0||!/[a-z0-9]/i.test(e[t-1]),o=t+n.length,r=o===e.length||!/[a-z0-9]/i.test(e[o]);if(i&&r)return!0}return!1}function O(e,n,t){switch(e.kind){case"literal":return n===e.value;case"family":return t?.family===e.family||k(n,e.family);case"model":return t!==null&&S(e.id,t)}}function L(e,n){let t=y(e.trim()).toLowerCase(),i=V(t);return n.some((o)=>{let{entry:r}=Ye(o);return r!==null&&O(r,t,i)})}var gt='"deniedModels" was present but is not a list of model names, so it was ignored and blocks no models until it is fixed.';function mt(e){let n=[],t=[];for(let i of e)if(typeof i==="string")n.push(i);else t.push(`"deniedModels" contained a non-string entry (${i===null?"null":typeof i}); the entry was ignored.`);return{entries:n,notes:t}}function xn(e,n){let t=Array.isArray(e)?e:[],i=Array.isArray(e)?t.flatMap((a)=>typeof a==="string"?[]:`"models" contained a non-string entry (${a===null?"null":typeof a}), which is not a model name, so it cannot be matched.`):['"models" is not a list of model names, so nothing was matched.'],o=n??[];if(!Array.isArray(o))return{denied:t.map(()=>!1),warnings:u([gt,...i])};let{entries:r,notes:s}=mt(o);return{denied:t.map((a)=>typeof a==="string"&&L(a,r)),warnings:u([...s,...r.flatMap((a)=>Ye(a).warning??[]),...i])}}
17
- export{Rn,On,ge,ft,Bt,be,V,Tn,D,Ye,gt,mt,xn};
16
+ import{f}from"./core-dnsvg8nc.mjs";var h=["us","eu","apac","jp","au","us-gov","global"],qn=["us","eu","apac","jp","au","global"];function b(e,n,t){if(e===n)return 0;let i=e.length,o=n.length,r=t+1;if(Math.abs(i-o)>t)return r;let s=new Int32Array(o+2).fill(r),a=new Int32Array(o+2).fill(r),d=new Int32Array(o+2).fill(r);for(let l=0;l<=Math.min(o,t);l++)a[l]=l;for(let l=1;l<=i;l++){let c=Math.max(1,l-t),M=Math.min(o,l+t);d[c-1]=c===1?Math.min(l,r):r;let g=d[c-1];for(let u=c;u<=M;u++){let m=Math.min(a[u]+1,d[u-1]+1,a[u-1]+(e[l-1]===n[u-1]?0:1),r);if(l>1&&u>1&&e[l-1]===n[u-2]&&e[l-2]===n[u-1])m=Math.min(m,s[u-2]+1);d[u]=m,g=Math.min(g,m)}if(d[M+1]=r,g>t)return r;[s,a,d]=[a,d,s]}return a[o]}var Xn=["claude-3-5-haiku","claude-3-5-sonnet","claude-3-7-sonnet","claude-fable-5","claude-fable-5-1","claude-fable-5-2","claude-haiku-4-5","claude-haiku-5-5","claude-mythos-5","claude-mythos-5-1","claude-mythos-5-2","claude-opus-4-0","claude-opus-4-1","claude-opus-4-5","claude-opus-4-6","claude-opus-4-7","claude-opus-4-8","claude-opus-5","claude-opus-5-5","claude-sonnet-4-0","claude-sonnet-4-5","claude-sonnet-4-6","claude-sonnet-5","claude-sonnet-5-5"],x=["sonnet","opus","haiku","fable","best","sonnet[1m]","opus[1m]","fable[1m]","opusplan"],Ae=["sonnet","opus","haiku","fable"];function kt(e){return x.includes(e)}function ln(e){return e.replace(/\[1m\]$/i,"")}function y(e){return e.replace(/\[(1|2)m\]/gi,"")}function De(e){return Ae.includes(e)}function J(e){let n=e.trim().toLowerCase();if(n===""||/\s/.test(n))return null;n=n.replace(/\[[12]m\]$/,"");let t=n.lastIndexOf("/");if(t!==-1)n=n.slice(t+1);let i=/^(?:([a-z-]+)\.)?anthropic\.(claude-.*)$/.exec(n);if(i){let[,a,d=""]=i;if(a!==void 0&&!h.includes(a))return null;n=d}let o=I(n);if(!o)return null;let r=n.slice(o.base.length);if(r!==""&&!/^[-@]/.test(r))return null;let s={family:o.family,major:o.major,legacyVersionFirst:o.legacyVersionFirst,base:o.base};if(o.minor!==void 0)s.minor=o.minor;if(!E(r))s.trailer=r;else{let a=/(?:-v\d+@|[-@])(\d{8})/.exec(r)?.[1];if(a!==void 0)s.date=a}return s}function E(e){return/^(?:-fast|-latest)?(?:-v\d{1,3}@\d{8}|[-@]\d{8})?(?:-v\d{1,3}(?::\d{1,3})?)?$/.test(e)}function Jn(e,n){return e.major-n.major||(e.minor??0)-(n.minor??0)}function I(e){let n=/^claude-([a-z]+)-(\d{1,2})(?!\d)(?:-(\d{1,2})(?!\d))?/.exec(e);if(n){let[i,o="",r="",s]=n;return{family:o,major:Number(r),minor:s===void 0?void 0:Number(s),legacyVersionFirst:!1,base:i}}let t=/^claude-(\d{1,2})(?!\d)(?:-(\d{1,2})(?!\d))?-([a-z]+)/.exec(e);if(t){let[i,o="",r,s=""]=t;return{family:s,major:Number(o),minor:r===void 0?void 0:Number(r),legacyVersionFirst:!0,base:i}}return null}function P(e){let n=e.replace(/[\u0000-\u001f\u007f-\u009f]/g,"?");return n.length>128?`${n.slice(0,128)}…`:n}function A(){let e=[...Ae],n=e.pop();return e.length===0?n??"":`${e.join(", ")} or ${n}`}function p(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ot(e){let n=e.trim().toLowerCase(),t=y(n).trim(),i=t!==n?" Context-size tags such as [1m] are ignored: the entry blocks the model at every context size.":"";if(t==="")return{entry:null,warning:"An empty deniedModels entry was ignored."};if(De(t))return{entry:{kind:"family",family:t},...i!==""&&{warning:`"${P(e)}" blocks every ${p(t)} model.${i}`}};if(kt(t)||t==="default")return{entry:null,warning:`"${P(e)}" was ignored: it names a different model depending on the release and settings. Name the model instead, for example "claude-opus-5-5".`};let o=J(t),r=o!==null||t.startsWith("claude-")?t:`claude-${t}`,s=o??(r!==t?J(r):null);if(s){let a=r.lastIndexOf(s.base),d=a===-1?"":r.slice(a+s.base.length),l=s.trailer===void 0&&d!==""?` "${P(d)}" is ignored.`:"";return{entry:{kind:"model",id:s},...(i!==""||l!=="")&&{warning:`"${P(e)}" blocks ${D(s)}.${l}${i}`}}}return{entry:{kind:"literal",value:t},warning:w(e,t)}}function D(e){let n=p(e.family);return e.minor===void 0?`every ${n} ${e.major}.x model`:`${n} ${e.major}.${e.minor} in every spelling and snapshot`}function w(e,n){let t=`"${P(e)}" blocks only the exact model name "${P(n)}"; other spellings of the same model are not blocked.`,i=n.replace(/(\d)\.(\d)/g,"$1-$2");if(i!==n){let r=i.startsWith("claude-")?i:`claude-${i}`;if(J(r)!==null)return`${t} To block a version, write it with a hyphen: "${P(r)}".`}let o=new RegExp(`^(${Ae.join("|")})\\s+(\\d+)(?:\\.(\\d+))?$`).exec(n);if(o){let[,r,s,a]=o;return a!==void 0?`${t} To block a version, write its model ID, for example "claude-${r}-${s}-${a}".`:`${t} To block only version ${s}, write "claude-${r}-${s}-0"; "claude-${r}-${s}" blocks every ${p(r)} ${s}.x model.`}if(/^[a-z]+$/.test(n)){let r=Ae.find((s)=>b(n,s,1)===1);return r!==void 0?`${t} If you meant the ${p(r)} family, write "${r}".`:`${t} To block a model family other than ${A()}, list its versioned IDs.`}return t}function _(e,n){if(e.family!==n.family||e.major!==n.major)return!1;if(e.minor!==void 0&&(n.minor??0)!==e.minor)return!1;if(e.trailer===void 0)return!0;let t=n.trailer??"";return t===e.trailer||t.startsWith(`${e.trailer}-`)}function S(e,n){for(let t=e.indexOf(n);t!==-1;t=e.indexOf(n,t+1)){let i=t===0||!/[a-z0-9]/i.test(e[t-1]),o=t+n.length,r=o===e.length||!/[a-z0-9]/i.test(e[o]);if(i&&r)return!0}return!1}function k(e,n,t){switch(e.kind){case"literal":return n===e.value;case"family":return t?.family===e.family||S(n,e.family);case"model":return t!==null&&_(e.id,t)}}function O(e,n){let t=y(e.trim()).toLowerCase(),i=J(t);return n.some((o)=>{let{entry:r}=ot(o);return r!==null&&k(r,t,i)})}var Dt='"deniedModels" was present but is not a list of model names, so it was ignored and blocks no models until it is fixed.';function xt(e){let n=[],t=[];for(let i of e)if(typeof i==="string")n.push(i);else t.push(`"deniedModels" contained a non-string entry (${i===null?"null":typeof i}); the entry was ignored.`);return{entries:n,notes:t}}function tr(e,n){let t=Array.isArray(e)?e:[],i=Array.isArray(e)?t.flatMap((a)=>typeof a==="string"?[]:`"models" contained a non-string entry (${a===null?"null":typeof a}), which is not a model name, so it cannot be matched.`):['"models" is not a list of model names, so nothing was matched.'],o=n??[];if(!Array.isArray(o))return{denied:t.map(()=>!1),warnings:f([Dt,...i])};let{entries:r,notes:s}=xt(o);return{denied:t.map((a)=>typeof a==="string"&&O(a,r)),warnings:f([...s,...r.flatMap((a)=>ot(a).warning??[]),...i])}}
17
+ export{qn,Xn,Ae,kt,ln,De,J,Jn,P,ot,Dt,xt,tr};
@@ -0,0 +1,16 @@
1
+ // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
+
3
+ // Version: 0.3.326
4
+
5
+ //! symbol-dispose-prelude: defines Symbol.dispose and Symbol.asyncDispose if missing, for this bundle's `using`.
6
+ if (typeof Symbol.dispose !== 'symbol') {
7
+ try {
8
+ Symbol.dispose = Symbol.for('Symbol.dispose')
9
+ } catch {}
10
+ }
11
+ if (typeof Symbol.asyncDispose !== 'symbol') {
12
+ try {
13
+ Symbol.asyncDispose = Symbol.for('Symbol.asyncDispose')
14
+ } catch {}
15
+ }
16
+ import{r}from"./core-dnsvg8nc.mjs";import{fe}from"./core-9sxfsmzx.mjs";import{Be}from"./core-2h2qc9qv.mjs";import{AsyncLocalStorage as y}from"async_hooks";import{constants as b}from"fs";import{appendFile as w,copyFile as P,lstat as S,mkdir as h,open as d,readdir as l,readFile as c,stat as B,unlink as v,writeFile as a}from"fs/promises";class p{read(e){return c(e,"utf8")}readBytes(e){return c(e)}write(e,t,i){return a(e,t,{encoding:"utf8",mode:i})}async mkdir(e,t){try{await h(e,{recursive:!0,mode:t})}catch(i){if(r(i)!=="EEXIST")throw i}}atomicWrite(e,t,i){return Be(e,t,i)}delete(e){return v(e)}list(e){return l(e)}append(e,t,i){return w(e,t,{encoding:"utf8",mode:i})}writeExclusive(e,t,i){return a(e,t,{encoding:"utf8",flag:"wx",mode:i})}writeBytesExclusive(e,t,i){return a(e,t,{flag:"wx",mode:i})}copy(e,t){return P(e,t)}async stat(e){return{mtimeMs:(await B(e)).mtimeMs}}async lstat(e){try{let t=await S(e);return{isSymbolicLink:t.isSymbolicLink(),isFile:t.isFile(),isDirectory:t.isDirectory(),mtimeMs:t.mtimeMs,nlink:t.nlink}}catch(t){if(r(t)==="ENOENT")return;throw t}}async listEntries(e){return(await l(e,{withFileTypes:!0})).map((i)=>({name:i.name,isDirectory:i.isDirectory(),isFile:i.isFile()}))}async readRange(e,t,i){m("readRange","offset",t),m("readRange","length",i);let s=await d(e,"r");try{return await f(s,t,i)}finally{await s.close()}}async readTail(e,t,i){m("readTail","maxBytes",t);let s=i?.noFollow?b.O_RDONLY|fe:"r",n=await d(e,s);try{let o=await n.stat();if(i?.noFollow&&!o.isFile())throw Object.assign(Error("ENXIO: not a regular file"),{code:"ENXIO",path:e});let{size:g}=o,u=Math.min(t,g);return await f(n,g-u,u)}finally{await n.close()}}}function m(e,t,i){if(!Number.isInteger(i)||i<0)throw RangeError(`${e}: ${t} must be a non-negative integer, got ${i}`)}async function f(e,t,i){if(i===0)return Buffer.alloc(0);let s=Buffer.alloc(i),n=0;while(n<i){let{bytesRead:o}=await e.read(s,n,i-n,t+n);if(o===0)break;n+=o}return n===i?s:Buffer.from(s.subarray(0,n))}var F=new y;function T(){return F.getStore()??new p}export{T as getStorageBackend};