@anthropic-ai/claude-agent-sdk 0.3.323 → 0.3.324

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/core-bw1q6326.mjs DELETED
@@ -1,17 +0,0 @@
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.323
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,o,t,de,se,Ut,Ft,st,Ht,E,V}from"./core-1tccd4gq.mjs";import{lstatSync as A,statSync as X}from"fs";import{delimiter as z,dirname as j,extname as Z,isAbsolute as G,join as J,resolve as Q}from"path";function Y(){return process.platform==="win32"}class P{resolved=new Map;envKey=void 0;cwdKey=void 0;skippedFolders=new Map;namesMaybeMissed=new Set;vettedFolders=new Map;lookup(e){return this.resolved.get(e)}remember(e,r){this.resolved.set(e,r)}forget(e){this.resolved.delete(e)}}var I=new o(()=>new P),k=[".com",".exe",".bat",".cmd"],R=5000;function b(e){return Number(process.hrtime.bigint()-e)/1e6}var N=new Set(["EACCES","EPERM","ENOTDIR","ELOOP","ENAMETOOLONG","EINVAL"]);function x(e,r=process.platform){return r==="win32"?e.replaceAll('"',""):e}function ee(e){if(!G(e))return!1;return process.platform!=="win32"||/^(?:[a-zA-Z]:[\\/]|[\\/]{2})/.test(e)}function te(e){let r=x(e,"win32").trim();if(!ee(r)||se(r))return null;let n=Q(r);return se(n)?null:n}function ne(e){return e.split(z).flatMap((r)=>{let n=te(r);return n===null?[]:[n]})}function re(e,r){return{eisdirIsFolder:"onAnyDrive",allowLocalWsl:st(e),report:r}}var ie=512;function oe(e,r,n){let u=r.get(e);if(u===void 0)return!1;for(let s of u){if(n.has(s.path))continue;let i;try{i=A(s.path,{bigint:!0,throwIfNoEntry:!1})}catch{}if(!i?.isDirectory()||i.dev!==s.dev||i.ino!==s.ino)return r.delete(e),!1;n.add(s.path)}return!0}function le(e,r){let n=r.chain;return n!==void 0&&!r.metLink&&n.length>0&&n.at(-1)?.path===e&&n.every((u)=>u.ino!==0n)?n:void 0}function C(e,r,n){let u=process.hrtime.bigint(),s=()=>b(u)>R;if(oe(e,r,n))return{verdict:"pass",plainDir:!0};let i={};if(Ht(e,re(e,i))){let p=i.unclassifiable;if(p===void 0||N.has(p))return{verdict:"refused"};return s()?{verdict:"stalled"}:{verdict:"unsure",code:p}}if(i.endedMissing===!0&&s())return{verdict:"stalled"};let l=i.chain?.at(-1)?.path===e,f=le(e,i);if(f!==void 0){if(r.size>=ie)r.clear();r.set(e,f);for(let p of f)n.add(p.path)}return{verdict:"pass",plainDir:l}}function ae(e,r=!1){let n=I.of(E().host),u=V("PATH"),s=V("PATHEXT"),i;try{i=process.cwd()}catch{return n.namesMaybeMissed.add(e),null}let y=`${u??""}\x00${s??""}`;if(n.envKey!==y)n.envKey=y,n.resolved.clear(),n.skippedFolders.clear(),n.namesMaybeMissed.clear();if(n.cwdKey!==i)n.cwdKey=i,n.resolved.clear(),n.namesMaybeMissed.clear();let l=n.lookup(e);if(l!==void 0)if(l!==null){let f=j(l),p=n.skippedFolders.get(f)==="denied"?{verdict:"refused"}:C(f,n.vettedFolders,new Set);if(p.verdict==="stalled")return n.skippedFolders.set(f,"unreachable"),l;if(p.verdict==="pass"){let h;try{h=A(l,{throwIfNoEntry:!1})}catch(a){let m=t(a),g=(m==="EACCES"||m==="EPERM")&&!Ft(f);if(!de(a)&&!g)return l}if(h!==void 0&&(h.isFile()||h.isSymbolicLink())&&!Ut(l,i,h))return l}n.forget(e)}else{if(!r)return l;n.forget(e)}if(r)n.skippedFolders.clear();return H(e,u,s,i,n,n.vettedFolders,ce)}function fn(e,r){let n;try{n=process.cwd()}catch{return null}return H(e,r,V("PATHEXT"),n,new P,I.of(E().host).vettedFolders,ue)}var ce={searchCwdFirst:!0},ue={searchCwdFirst:!1};function H(e,r,n,u,s,i,y){if(s.namesMaybeMissed.delete(e),e===""||/[*?"<>|:\\/]/.test(e))return s.remember(e,null),null;try{let l=[...y.searchCwdFirst?[u]:[],...ne(r??"")],f=n?.split(";").map((d)=>d.trim().toLowerCase()),p=f===void 0?k:c(f).filter((d)=>k.includes(d)),h=[...k.includes(Z(e).toLowerCase())?[e]:[],...p.map((d)=>e+d)],a=!1,m=p.length<k.length||r===void 0,g=!1,_=new Set;for(let d of l){if(s.skippedFolders.has(d)){if(s.skippedFolders.get(d)==="denied")m=!0;else a=g=!0;continue}let S=C(d,i,_);if(S.verdict!=="pass"){if(S.verdict==="stalled")s.skippedFolders.set(d,"unreachable"),a=g=!0;else if(S.verdict==="refused")s.skippedFolders.set(d,"denied"),m=!0;else a=g=!0;continue}let T,v,K=process.hrtime.bigint();if(!S.plainDir)try{T=X(d,{throwIfNoEntry:!1})}catch(M){v=t(M)??"UNKNOWN"}if(!S.plainDir&&!T?.isDirectory()){if(b(K)>R)s.skippedFolders.set(d,"unreachable"),a=g=!0;else if(v!==void 0)if(N.has(v))s.skippedFolders.set(d,"denied"),m=!0;else a=g=!0;continue}let O=d.toLowerCase().split(/[\\/]+/).filter(Boolean),U=O.at(-1)==="windowsapps"&&O.at(-2)==="microsoft";for(let M of h){let F=J(d,M),w,L=!1,q=process.hrtime.bigint();try{w=A(F,{throwIfNoEntry:!1})}catch(B){let W=t(B),D=(W==="EACCES"||W==="EPERM")&&U;if(!D)a=g=!0;L=D}if(!L&&w===void 0){if(b(q)>R){s.skippedFolders.set(d,"unreachable"),a=g=!0;break}continue}if(!L&&!(w?.isFile()||w?.isSymbolicLink()))continue;if(Ut(F,u,w??null)){a=!0;continue}if(!g)s.remember(e,F);return F}}if(a||m)s.namesMaybeMissed.add(e);if(!a)s.remember(e,null);return null}catch{return s.namesMaybeMissed.add(e),null}}function gn(e,r=!1){if(!Y())return e;if(e.includes("/")||e.includes("\\"))return e;return ae(e,r)}
17
- export{fn,gn};
package/core-m9ncxr5j.mjs DELETED
@@ -1,16 +0,0 @@
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.323
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{t}from"./core-1tccd4gq.mjs";import"./core-72zgz5fc.mjs";import{ie}from"./core-2hdsr9k2.mjs";import{zt}from"./core-5pb9fh9v.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(r){return c(r,"utf8")}readBytes(r){return c(r)}write(r,e,i){return a(r,e,{encoding:"utf8",mode:i})}async mkdir(r,e){try{await h(r,{recursive:!0,mode:e})}catch(i){if(t(i)!=="EEXIST")throw i}}atomicWrite(r,e,i){return zt(r,e,i)}delete(r){return v(r)}list(r){return l(r)}append(r,e,i){return w(r,e,{encoding:"utf8",mode:i})}writeExclusive(r,e,i){return a(r,e,{encoding:"utf8",flag:"wx",mode:i})}writeBytesExclusive(r,e,i){return a(r,e,{flag:"wx",mode:i})}copy(r,e){return P(r,e)}async stat(r){return{mtimeMs:(await B(r)).mtimeMs}}async lstat(r){try{let e=await S(r);return{isSymbolicLink:e.isSymbolicLink(),isFile:e.isFile(),isDirectory:e.isDirectory(),mtimeMs:e.mtimeMs,nlink:e.nlink}}catch(e){if(t(e)==="ENOENT")return;throw e}}async listEntries(r){return(await l(r,{withFileTypes:!0})).map((i)=>({name:i.name,isDirectory:i.isDirectory(),isFile:i.isFile()}))}async readRange(r,e,i){m("readRange","offset",e),m("readRange","length",i);let s=await d(r,"r");try{return await f(s,e,i)}finally{await s.close()}}async readTail(r,e,i){m("readTail","maxBytes",e);let s=i?.noFollow?b.O_RDONLY|ie:"r",n=await d(r,s);try{let o=await n.stat();if(i?.noFollow&&!o.isFile())throw Object.assign(Error("ENXIO: not a regular file"),{code:"ENXIO",path:r});let{size:g}=o,u=Math.min(e,g);return await f(n,g-u,u)}finally{await n.close()}}}function m(r,e,i){if(!Number.isInteger(i)||i<0)throw RangeError(`${r}: ${e} must be a non-negative integer, got ${i}`)}async function f(r,e,i){if(i===0)return Buffer.alloc(0);let s=Buffer.alloc(i),n=0;while(n<i){let{bytesRead:o}=await r.read(s,n,i-n,e+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};
package/core-whmb256v.mjs DELETED
@@ -1,18 +0,0 @@
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.323
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,o,d,t}from"./core-1tccd4gq.mjs";import{r,_e,U,Et,bt,Z,Be,tt,Ct,nt,Ke,Q}from"./core-72zgz5fc.mjs";import"./core-bw1q6326.mjs";import{$e}from"./core-0nt0tzhe.mjs";import"./core-2hdsr9k2.mjs";import{$t}from"./core-zs2stfwr.mjs";import{randomUUID as N}from"crypto";import{constants as v}from"fs";import{open as X,readdir as L,rm as z,stat as ee}from"fs/promises";import{join as g}from"path";class I{available=void 0;probing=void 0;procUnreadableLogged=!1}var We=new o(()=>new I);var j=["commands","agents","output-styles","skills","workflows","routines","themes","rules","session-env","uploads","mcp-skill-archives","usage-data","mcp-discovery-cache"];var gn=new Set(j),hn=`must be one of the userConfigDir directory names (${j.join(", ")})`,k=["installed","marketplaces","flagged","catalog","inUseSweep"];var yn=new Set(k),Sn=`must be one of the pluginRegistry files (${k.join(", ")})`,w=["manifest","catalog"];var bn=new Set(w),En=`must be one of the marketplaceCache forms (${w.join(", ")})`;var R=["world"];var In=new Set(R),jn=`must be one of the session journal names (${R.join(", ")})`;var P=["backup","corrupted"];var kn=new Set(P),wn=`must be one of the global-config copy kinds (${P.join(", ")})`;var Y="cloud-snapshots";var B=new Set(["memory","tiny_memory","bagel",Y,"connector-downloads","bridge-pointer.json",".session-aliases"]);var C=".cast",Rn=`<stamp>${C} inside a session's folder is that session's terminal recording stream: address it as keys.recording(projectKey, sessionId, stamp)`;var W=[".ccr-tip.json",".precompact.json",C],Pn=`must not end with ${W.join(", ")}: those name a session's project-level sibling files`;var J=".dir-sync.json",Cn=`must not end with ${J}: that name is reserved for a cloud session's record at the project level`;var vn=`${[...B].join(", ")} are reserved: they name project-level entries, not sessions`;var q="timeline.jsonl",_n=`${q} is the job's timeline stream: address it as keys.jobTimeline(jobId)`;function y(e){return e===void 0?void 0:{source:e,hoverRestOn:u()}}var ne=64;function E(e){return u()?e:void 0}async function O(e,n,a={},s){if(!U(e))throw Error(`Invalid sessionId: ${e}`);if(!n.trim())throw Error("title must be non-empty");let i=r({type:"custom-title",customTitle:n.trim(),sessionId:e})+`
17
- `;await F(e,i,a,E(s))}async function x(e,n,a={},s){if(!U(e))throw Error(`Invalid sessionId: ${e}`);if(n!==null){let c=_e(n).trim();if(!c)throw Error("tag must be non-empty (use null to clear)");n=c}let i=r({type:"tag",tag:n??"",sessionId:e})+`
18
- `;await F(e,i,a,E(s))}async function K(e,n={},a){if(!U(e))throw Error(`Invalid sessionId: ${e}`);let s=E(a);for(let i of await te(n,s)){if(u()&&s!==void 0){let l=tt(i,s.isKeySegment);if(l!==void 0){if(await re(l,e,s))return;continue}}let c=g(i,`${e}.jsonl`),f;try{({size:f}=await ee(c))}catch(l){let p=t(l);if(p==="ENOENT"||p==="ENOTDIR")continue;throw l}if(f===0)continue;await z(c,{force:!0}),await $t(g(i,e));return}throw Error(n.dir?`Session ${e} not found in project directory for ${n.dir}`:`Session ${e} not found in any project directory`)}async function re(e,n,a){let{backend:s,transcriptKey:i}=a,c=i(e,n),f=await s.statMeta(c);if(!f.ok){if(f.error.code==="NotFound")return!1;throw Error("Session delete: transcript unreadable via storage",{cause:f.error})}if((f.value.storedBytes??f.value.size)===0)return!1;for(let p of["transcript","sidecar"]){let m=await s.deleteScope({namespace:p,projectKey:e,sessionId:n});if(!m.ok)throw Error("Session delete: session directory not deletable via storage",{cause:m.error})}let l=await s.delete(c);if(!l.ok)throw Error("Session delete: transcript not deletable via storage",{cause:l.error});return!0}async function te(e,n){if(e.dir){let s=await Ct(e.dir,Et(n,u())),i=await _(s,n),c;try{c=await $e(s)}catch{c=[]}for(let f of c){if(f===s)continue;i.push(...await _(f,n))}return i}let a=Z();if(u()&&n!==void 0){let s=await A(n);if(s===void 0)return[];if(s.laterPageFailed)throw Error("Session delete: project listing incomplete via storage");return s.names.map((i)=>g(a,i))}try{return(await L(a,{withFileTypes:!0})).filter((i)=>i.isDirectory()||i.isSymbolicLink()).map((i)=>g(a,i.name))}catch{return[]}}async function _(e,n){let a=y(n);if(a===void 0||!a.hoverRestOn)return Ke(e);let s=await Ke(e,a),i=Be(e),c=process.platform==="win32",f=[];for(let l of s)if(l===i||await nt(l,e,c,a))f.push(l);return f}async function A(e){let n=[],a,s=0;try{do{let i=await e.backend.listEntries({namespace:"transcript"},{skipScopeStats:!0,...a!==void 0&&{cursor:a}});if(!i.ok)return s===0?void 0:{names:n,laterPageFailed:!0};for(let c of i.value.items){let f=bt(c,e.isKeySegment);if(f!==void 0)n.push(f)}a=i.value.cursor}while(a&&++s<ne);return{names:n,laterPageFailed:Boolean(a)}}catch{return s===0&&n.length===0?void 0:{names:n,laterPageFailed:!0}}}async function F(e,n,a,s){let i=`${e}.jsonl`;if(a.dir){let l=await Ct(a.dir,Et(s,u()));for(let m of await Ke(l,y(s)))if(await S(g(m,i),n,b(m,e,s)))return;let p;try{p=await $e(l)}catch{p=[]}for(let m of p){if(m===l)continue;for(let h of await Ke(m,y(s)))if(await S(g(h,i),n,b(h,e,s)))return}throw Error(`Session ${e} not found in project directory for ${a.dir}`)}let c=Z();if(u()&&s!==void 0){let l=await A(s);if(l===void 0)throw new d(`Session ${e} not found (no projects directory)`,"Session not found (no projects directory)");let{names:p}=l;for(let m of p){let h=g(c,m);if(await S(g(h,i),n,b(h,e,s)))return}throw new d(`Session ${e} not found in any project directory`,"Session not found in any project directory")}let f;try{f=await L(c)}catch{throw Error(`Session ${e} not found (no projects directory)`)}for(let l of f)if(await S(g(c,l,i),n))return;throw Error(`Session ${e} not found in any project directory`)}async function S(e,n,a){if(u()&&a!==void 0)return ae(a,n);let s;try{s=await X(e,v.O_WRONLY|v.O_APPEND)}catch(i){let c=t(i);if(c==="ENOENT"||c==="ENOTDIR")return!1;throw i}try{let{size:i}=await s.stat();if(i===0)return!1;let c=process.platform==="win32"?i:void 0,f=Buffer.from(n,"utf8"),l=0;while(l<f.length){let{bytesWritten:p}=await s.write(f,l,f.length-l,c);if(p<=0)throw new d(`tryAppend: short write to ${e} stalled with ${f.length-l} bytes remaining`,"tryAppend: zero-progress short write");if(l+=p,c!==void 0)c+=p}return!0}finally{await s.close()}}async function ae({backend:e,key:n},a){let s=await e.append(n,[{data:a}],{precondition:{type:"ifExists",nonEmpty:!0}});if(!s.ok){if(s.error.code==="NotFound")return!1;throw Error("Session append: transcript not writable via storage",{cause:s.error})}return!0}function b(e,n,a){if(!u()||a===void 0)return;let s=tt(e,a.isKeySegment);return s===void 0?void 0:{backend:a.backend,key:a.transcriptKey(s,n)}}async function cr(e,n,a){if(a?.sessionStore)return se(a.sessionStore,e,n,a.dir);return O(e,n,a)}async function ur(e,n,a){if(a?.sessionStore)return oe(a.sessionStore,e,n,a.dir);return x(e,n,a)}async function dr(e,n){if(!U(e))throw new d(`Invalid sessionId: ${e}`,"deleteSession: invalid sessionId (must be a UUID)");if(n?.sessionStore){if(!n.sessionStore.delete)return;let a=Q(n.dir);await n.sessionStore.delete({projectKey:a,sessionId:e});return}return K(e,n)}async function se(e,n,a,s){if(!U(n))throw new d(`Invalid sessionId: ${n}`,"renameSession: invalid sessionId (must be a UUID)");if(!a.trim())throw Error("title must be non-empty");let i=Q(s);await e.append({projectKey:i,sessionId:n},[{type:"custom-title",customTitle:a.trim(),sessionId:n,uuid:N(),timestamp:new Date().toISOString()}])}async function oe(e,n,a,s){if(!U(n))throw new d(`Invalid sessionId: ${n}`,"tagSession: invalid sessionId (must be a UUID)");if(a!==null){let c=_e(a).trim();if(!c)throw Error("tag must be non-empty (use null to clear)");a=c}let i=Q(s);await e.append({projectKey:i,sessionId:n},[{type:"tag",tag:a??"",sessionId:n,uuid:N(),timestamp:new Date().toISOString()}])}export{dr as deleteSession,cr as renameSession,ur as tagSession};
package/core-zs2stfwr.mjs DELETED
@@ -1,17 +0,0 @@
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.323
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{d,t,de,T}from"./core-1tccd4gq.mjs";import{lstat as s,rm as n,rmdir as m,unlink as h}from"fs/promises";var a=new Set(["EPERM","EACCES","EBUSY"]),E=50;async function $t(e){for(let o=1;;o++){let i=!0;try{await n(e,{recursive:!0,force:!0})}catch(r){if(t(r)!=="ENOTEMPTY")throw r;i=!1}try{await s(e)}catch(r){if(de(r)||i&&process.platform==="win32"&&a.has(t(r)))return;throw r}if(o===3)throw Object.assign(new d(`'${e}' 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 T(o*E)}}import{createHash as c}from"crypto";function Pe(e){if(typeof e!=="string"&&!ArrayBuffer.isView(e))throw Object.assign(TypeError("sha256Hex: the data is neither text nor bytes"),{code:"ERR_INVALID_ARG_TYPE"});return c("sha256").update(e).digest("hex")}
17
- export{$t,Pe};