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

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-wadgcjfh.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.325
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,i,c,n,m,s,rt,o,_e,re,Mt,$e,oe,N,U,dt,ct,v,Ie,Ve,ut,pt,ye,Sn,En,se}from"./core-msnqqcc2.mjs";import"./core-gbbw9cgm.mjs";import{qe}from"./core-fxa8mwbm.mjs";import{Le}from"./core-ds2jqcef.mjs";import{Kt,e}from"./core-x20yarwf.mjs";import{randomUUID as pe}from"crypto";import{constants as ne}from"fs";import{open as Fn,readdir as ae,rm as Nn,stat as Tn}from"fs/promises";import{join as b}from"path";import{mkdir as On}from"fs/promises";import{dirname as xn}from"path";import{dirname as Cn,join as _n}from"path";import*as p from"zod/v4";import{basename as z,dirname as J}from"path";class x{available=void 0;probing=void 0;procUnreadableLogged=!1}var Ot=new i(()=>new x);function Ee(t){return s(t,"expected a segment that is not empty or made only of dots and spaces, with no path separator, NUL or set-aside shape")}function P(t){if(typeof t!=="object"||t===null)return s("key","expected a key object");let r=Ne(t);if(r!==void 0)return r;let a=Pn(t);if(a===void 0)return s("key",`${t.namespace} is not a storage namespace`);return ke("key",a)}function ke(t,r){for(let[a,u,d]of r){let l=`${t}.${a}`;if(u===void 0){if(d!=="optional")return s(l,"required")}else if(je(a)){if(!(t==="scope"&&a==="agentRelPath"&&Array.isArray(u)&&u.length===0)&&(!Array.isArray(u)||!Mt(u)))return s(l,"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 u!=="string"||!re(u))return Ee(l)}return}function je(t){return t==="relPath"||t==="agentRelPath"}var K=["commands","agents","output-styles","skills","workflows","routines","themes","rules","session-env","uploads","mcp-skill-archives","usage-data","mcp-discovery-cache"];var we=new Set(K),Re=`must be one of the userConfigDir directory names (${K.join(", ")})`,F=["installed","marketplaces","flagged","catalog","inUseSweep"];var Pe=new Set(F),ve=`must be one of the pluginRegistry files (${F.join(", ")})`,T=["manifest","catalog"];var Ce=new Set(T),Oe=`must be one of the marketplaceCache forms (${T.join(", ")})`;var M=["world"];var xe=new Set(M),Ae=`must be one of the session journal names (${M.join(", ")})`;function Ke(t){return xe.has(t)}function Fe(t){return typeof t==="string"&&/^[0-9a-f]{64}$/.test(t)}function Ne(t){if(t.namespace==="transcript")return Ue(t);if(t.namespace==="pluginAssetCache"&&!Fe(t.digest))return s("key.digest","must be a SHA-256 digest: 64 lowercase hexadecimal characters");if(t.namespace==="globalConfig"&&"kind"in t){if(!Ge(t.kind))return s("key.kind",He);if(typeof t.stamp!=="string")return s("key.stamp","a recovery copy key carries its stamp")}if(t.namespace==="task")return pn(t);if(t.namespace==="sidecar"){let r=R("key.sessionId",t.sessionId);if(r!==void 0)return r;if(Y(t.relPath))return s("key.relPath",C);return Je(t.relPath)?s("key.relPath",ze):void 0}if(t.namespace==="recording")return R("key.sessionId",t.sessionId)??(G(t.stamp)?void 0:s("key.stamp",We));if(t.namespace==="jobsRoot")return mn(t);if(t.namespace==="userConfigDir"&&!we.has(t.dir))return s("key.dir",Re);if(t.namespace==="fileHistory")return Te(t);if(t.namespace==="settings"&&!un(t.layer))return s("key.layer","must be user, project or local");if(t.namespace==="log")return fn(t);if(t.namespace==="job"&&hn(t.relPath))return s("key.relPath",gn);if(t.namespace==="sessionLog")return wn("key",t)??(jn(t.logName)?void 0:s("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(t.namespace==="pluginRegistry"&&!Pe.has(t.file))return s("key.file",ve);if(t.namespace==="marketplaceCache"){if(!("relPath"in t))return Ce.has(t.form)?void 0:s("key.form",Oe);return t.form===void 0?void 0:s("key.form","a tree file key carries relPath, not form")}if(t.namespace!=="agentMemory")return;if(!Me(t.layer))return s("key.layer","must be user, project or local");if(t.layer==="user"&&"projectKey"in t)return s("key.projectKey","the user layer is not keyed by project");if(t.layer!=="user"&&typeof t.projectKey!=="string")return s("key.projectKey","required for the project and local layers");return typeof t.agentType==="string"?void 0:s("key.agentType","an agent memory key names its agent")}function Te(t){return typeof t.backupFileName!=="string"||!En.test(t.backupFileName)?s("key.backupFileName","must be a backup file name the engine has ever written (hex hash @v version)"):void 0}function Me(t){return t==="user"||t==="project"||t==="local"}var D=["backup","corrupted"];var De=new Set(D),He=`must be one of the global-config copy kinds (${D.join(", ")})`;function Ge(t){return De.has(t)}function Ue(t){let r=R("key.sessionId",t.sessionId);if(r!==void 0)return r;if(Y(t.agentRelPath))return s("key.agentRelPath",C);if("sessionJournal"in t){if(typeof t.sessionJournal!=="string"||!Ke(t.sessionJournal))return s("key.sessionJournal",Ae);return t.agentId===void 0&&t.agentRelPath===void 0&&!("journal"in t)?void 0:s("key.sessionJournal","a session journal key names the session's own journal: no agentId, agentRelPath or run journal")}if("journal"in t){if(t.journal!==!0)return s("key.journal","must be true");if(!Array.isArray(t.agentRelPath))return s("key.agentRelPath","a run journal key carries its run directory");return t.agentId===void 0?void 0:s("key.agentId","a transcript key names an agent transcript or the run journal, never both")}return t.agentRelPath!==void 0&&t.agentId===void 0?s("key.agentRelPath","requires agentId or journal"):void 0}var Be="cloud-snapshots";var H=new Set(["memory","tiny_memory","bagel",Be,"connector-downloads","bridge-pointer.json",".session-aliases"]),Ye=/^[0-9]{1,16}$/,We="must be the recording stamp: 1 to 16 decimal digits (epoch milliseconds)",I=".cast",ze=`<stamp>${I} inside a session's folder is that session's terminal recording stream: address it as keys.recording(projectKey, sessionId, stamp)`;function G(t){return typeof t==="string"&&Ye.test(t)}function Je(t){return Array.isArray(t)&&typeof t[0]==="string"&&oe(t[0]).some((r)=>Xe(r)!==void 0)}function Xe(t){if(!t.endsWith(I))return;let r=t.slice(0,-I.length);return G(r)?r:void 0}var V=[".ccr-tip.json",".precompact.json",I],Ze=`must not end with ${V.join(", ")}: those name a session's project-level sibling files`;function Qe(t){return oe(t).some((r)=>V.some((a)=>r.endsWith(a)))}var B=".dir-sync.json",en=`must not end with ${B}: that name is reserved for a cloud session's record at the project level`;function nn(t){return oe(t).some((r)=>r.endsWith(B))}var tn=`${[...H].join(", ")} are reserved: they name project-level entries, not sessions`;function rn(t){return oe(t).some((r)=>H.has(r))}function R(t,r){if(typeof r!=="string")return;if(rn(r))return s(t,tn);if(Qe(r))return s(t,Ze);if(nn(r))return s(t,en);return $e(r)?s(t,C):void 0}var on=".meta.json",sn=".meta is reserved for the list metadata key, under every spelling that opens its file";function an(t){return cn(`${t}.json`)}function cn(t){return oe(t).includes(on)}var C="names a .jsonl stream, which only a transcript key addresses";function Y(t){return Array.isArray(t)&&t.some((r)=>typeof r==="string"&&$e(r))}function un(t){return t==="user"||t==="project"||t==="local"}var dn="must be debug, telemetry or apiDump";function ln(t){return t==="debug"||t==="telemetry"||t==="apiDump"}function fn(t){if(!ln(t.channel))return s("key.channel",dn);if(t.channel!=="apiDump")return;for(let r of["agentId","runId"])if(r in t&&t[r]!==void 0)return s(`key.${r}`,"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 pn(t){if("taskId"in t&&(("meta"in t)||("highWaterMark"in t)))return s("key.taskId","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in t&&"highWaterMark"in t)return s("key.highWaterMark","a task key names an item, the list metadata or the list high-water mark, never more than one");if("meta"in t&&t.meta!==!0)return s("key.meta","must be true");if("highWaterMark"in t&&t.highWaterMark!==!0)return s("key.highWaterMark","must be true");if(typeof t.listId!=="string")return s("key.listId","a task key carries its listId");if("meta"in t||"highWaterMark"in t)return;if(typeof t.taskId!=="string")return s("key.taskId","a task item key carries its taskId");if(an(t.taskId))return s("key.taskId",sn);return}function mn(t){if("file"in t&&"draftKey"in t)return s("key.draftKey","a jobs-root key names the pins file or one draft, never both");if("file"in t)return t.file==="pins"?void 0:s("key.file","must be pins");if(typeof t.draftKey!=="string")return s("key.draftKey","a jobs-root draft key carries its draftKey");return Rn.test(t.draftKey)?void 0:s("key.draftKey","must be 8 lowercase hex characters")}var W="timeline.jsonl",gn=`${W} is the job's timeline stream: address it as keys.jobTimeline(jobId)`;function hn(t){return Array.isArray(t)&&typeof t[0]==="string"&&oe(t[0]).includes(W)}var yn=/^\d{4}$/,A=/^\d{2}$/,bn=/^[A-Za-z0-9_-]{1,8}(?:-[a-z0-9]+)*$/,In=128,kn=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i;function jn(t){return typeof t==="string"&&t.length<=In&&bn.test(t)&&!kn.test(t)}function wn(t,r){if(r.year!==void 0&&!w(yn,r.year))return s(`${t}.year`,"must be four digits (YYYY)");if(r.month!==void 0&&!w(A,r.month))return s(`${t}.month`,"must be two digits (MM)");if(r.day!==void 0&&!w(A,r.day))return s(`${t}.day`,"must be two digits (DD)");return}function w(t,r){return typeof r==="string"&&t.test(r)}var Rn=/^[0-9a-f]{8}$/;function Pn(t){switch(t.namespace){case"transcript":return[["projectKey",t.projectKey],["sessionId",t.sessionId],["agentId",t.agentId,"optional"],["agentRelPath",t.agentRelPath,"optional"]];case"history":case"identity":return[];case"globalConfig":return"kind"in t?[["stamp",t.stamp]]:[];case"settings":return t.layer==="user"?[]:t.layer==="project"?[["projectKey",t.projectKey]]:[["consentRootKey",t.consentRootKey]];case"task":return"taskId"in t?[["listId",t.listId],["taskId",t.taskId]]:[["listId",t.listId]];case"memory":return[["projectKey",t.projectKey],["relPath",t.relPath]];case"pluginRegistry":return[];case"marketplaceCache":return"relPath"in t?[["marketplace",t.marketplace],["relPath",t.relPath]]:[["marketplace",t.marketplace]];case"pluginCache":return[["marketplace",t.marketplace],["plugin",t.plugin],["version",t.version],["relPath",t.relPath]];case"cache":return[["store",t.store],["id",t.id]];case"paste":return[["id",t.id]];case"pluginAssetCache":return[["digest",t.digest]];case"state":return[["id",t.id]];case"plan":return[["name",t.name]];case"feedbackDraft":return[["draftId",t.draftId]];case"agentMemory":return[...t.layer==="user"?[]:[["projectKey",t.projectKey]],["agentType",t.agentType],["relPath",t.relPath]];case"team":return[["team",t.team]];case"sidecar":return[["projectKey",t.projectKey],["sessionId",t.sessionId],["relPath",t.relPath]];case"scratch":return[["sessionId",t.sessionId],["relPath",t.relPath]];case"userConfigDir":return[["relPath",t.relPath]];case"fileHistory":return[["sessionId",t.sessionId],["backupFileName",t.backupFileName]];case"job":return[["jobId",t.jobId],["relPath",t.relPath]];case"daemon":return[["relPath",t.relPath]];case"jobsRoot":return"file"in t?[]:[["draftKey",t.draftKey]];case"session":return[["file",t.file]];case"bridgePointer":case"sessionAliases":return[["projectKey",t.projectKey]];case"dirSyncRecord":return[["projectKey",t.projectKey],["sessionId",t.sessionId]];case"mailbox":return[["team",t.team],["teammate",t.teammate]];case"log":return[["sessionId",t.sessionId],["agentId",t.agentId,"optional"],["runId",t.runId,"optional"]];case"jobTimeline":return[["jobId",t.jobId]];case"recording":return[["projectKey",t.projectKey],["sessionId",t.sessionId],["stamp",t.stamp]];case"sessionLog":return[["projectKey",t.projectKey],["year",t.year],["month",t.month],["day",t.day],["logName",t.logName]]}return}var vn=6;function _(t){let r=z(t);if($e(r))return;let a=v(),u=[r],d=J(t);while(d!==a&&u.length<=vn+1){let S=J(d);if(S===d)return;u.unshift(z(d)),d=S}if(d!==a||u.length<3)return;let[l,g,...h]=u;if(!re(l)||!re(g)||h.length===0||!h.every(re))return;let y=N.sidecar(l,g,h);return P(y)===void 0?y:void 0}var yr=e(()=>p.object({archived:p.boolean(),at:p.iso.datetime({offset:!0})}));function q(t,r){return _n(Cn(t),r,"archived.json")}var Ln=["human","sdk","unknown"],Sr=e(()=>{let t=p.object({kind:p.string()}).optional(),r=p.literal(!1).optional();return p.discriminatedUnion("type",[p.object({type:p.literal("user"),timestamp:p.string(),message:p.object({content:p.unknown()}),origin:t,promptSource:p.string().optional(),persist:p.undefined().optional(),turnOrigin:p.enum(Ln).optional(),toolUseResult:p.null().optional(),isCompactSummary:r,isSidechain:r,isVirtual:r,isVisibleInTranscriptOnly:r,isMeta:r,textNotTyped:r,handedOff:r,queueSkipAttachments:r,wakeupSource:p.undefined().optional(),scheduledTaskId:p.undefined().optional()}),p.object({type:p.literal("attachment"),timestamp:p.string(),isSidechain:r,attachment:p.object({type:p.literal("queued_command"),prompt:p.unknown(),origin:t,commandMode:p.enum(["prompt","bash"]).optional(),isMeta:r})})])}),br=e(()=>p.array(p.looseObject({type:p.string()})));async function X(t,r,a,u){let d=q(t,r),l=o({archived:a.archived,at:new Date().toISOString(),by:a.by});if(f()&&u!==void 0){let g=_(d);if(g!==void 0){let h=await u.write(g,l,{mode:384});if(!h.ok)throw Error("Session archive: record not writable via storage",{cause:h.error});return}}if(m())throw Error("Session archive: this process keeps no files");await On(xn(d),{recursive:!0,mode:448}),await Le(d,l,384)}import{isAbsolute as An,sep as Z}from"path";function Kn(t){let r=process.cwd();return r.endsWith(Z)?r+t:r+Z+t}function Q(t){return(r)=>t.hostFiles.realPath(rt.workspace(r===""||An(r)?r:Kn(r)),{native:!0})}function ee(t){if(!f()||t===void 0)return;return{backend:t,transcriptKey:N.transcript,isKeySegment:re,realWorkspacePath:Q(t)}}function k(t){return t===void 0?void 0:{source:t,hoverRestOn:f()}}var Mn=64;function O(t){return f()?t:void 0}async function ie(t,r,a={},u){if(!U(t))throw Error(`Invalid sessionId: ${t}`);if(!r.trim())throw Error("title must be non-empty");let d=o({type:"custom-title",customTitle:r.trim(),sessionId:t})+`
17
- `;await fe(t,d,a,O(u))}async function ce(t,r,a={},u){if(!U(t))throw Error(`Invalid sessionId: ${t}`);if(r!==null){let l=_e(r).trim();if(!l)throw Error("tag must be non-empty (use null to clear)");r=l}let d=o({type:"tag",tag:r??"",sessionId:t})+`
18
- `;await fe(t,d,a,O(u))}async function ue(t,r,a={},u){if(!U(t))throw new c(`Invalid sessionId: ${t}`,"setSessionArchived: invalid sessionId (must be a UUID)");let d=f(),l=d?u:void 0,g=new Set;for await(let{filePath:S}of Sn(t,a.dir,ee(l),d))g.add(S);if(g.size===0)throw new c(a.dir?`Session ${t} not found in project directory for ${a.dir}`:`Session ${t} not found in any project directory`,"setSessionArchived: session not found");let y=(await Promise.allSettled([...g].map((S)=>X(S,t,{archived:r,by:"sdk"},l)))).find((S)=>S.status==="rejected");if(y)throw y.reason}async function de(t,r={},a){if(!U(t))throw Error(`Invalid sessionId: ${t}`);let u=O(a);for(let d of await $n(r,u)){if(f()&&u!==void 0){let h=Ve(d,u.isKeySegment);if(h!==void 0){if(await Dn(h,t,u))return;continue}}let l=b(d,`${t}.jsonl`),g;try{({size:g}=await Tn(l))}catch(h){let y=n(h);if(y==="ENOENT"||y==="ENOTDIR")continue;throw h}if(g===0)continue;await Nn(l,{force:!0}),await Kt(b(d,t));return}throw Error(r.dir?`Session ${t} not found in project directory for ${r.dir}`:`Session ${t} not found in any project directory`)}async function Dn(t,r,a){let{backend:u,transcriptKey:d}=a,l=d(t,r),g=await u.statMeta(l);if(!g.ok){if(g.error.code==="NotFound")return!1;throw Error("Session delete: transcript unreadable via storage",{cause:g.error})}if((g.value.storedBytes??g.value.size)===0)return!1;for(let y of["transcript","sidecar"]){let S=await u.deleteScope({namespace:y,projectKey:t,sessionId:r});if(!S.ok)throw Error("Session delete: session directory not deletable via storage",{cause:S.error})}let h=await u.delete(l);if(!h.ok)throw Error("Session delete: transcript not deletable via storage",{cause:h.error});return!0}async function $n(t,r){if(t.dir){let u=await ut(t.dir,dt(r,f())),d=await te(u,r),l;try{l=await qe(u)}catch{l=[]}for(let g of l){if(g===u)continue;d.push(...await te(g,r))}return d}let a=v();if(f()&&r!==void 0){let u=await le(r);if(u===void 0)return[];if(u.laterPageFailed)throw Error("Session delete: project listing incomplete via storage");return u.names.map((d)=>b(a,d))}try{return(await ae(a,{withFileTypes:!0})).filter((d)=>d.isDirectory()||d.isSymbolicLink()).map((d)=>b(a,d.name))}catch{return[]}}async function te(t,r){let a=k(r);if(a===void 0||!a.hoverRestOn)return ye(t);let u=await ye(t,a),d=Ie(t),l=process.platform==="win32",g=[];for(let h of u)if(h===d||await pt(h,t,l,a))g.push(h);return g}async function le(t){let r=[],a,u=0;try{do{let d=await t.backend.listEntries({namespace:"transcript"},{skipScopeStats:!0,...a!==void 0&&{cursor:a}});if(!d.ok)return u===0?void 0:{names:r,laterPageFailed:!0};for(let l of d.value.items){let g=ct(l,t.isKeySegment);if(g!==void 0)r.push(g)}a=d.value.cursor}while(a&&++u<Mn);return{names:r,laterPageFailed:Boolean(a)}}catch{return u===0&&r.length===0?void 0:{names:r,laterPageFailed:!0}}}async function fe(t,r,a,u){let d=`${t}.jsonl`;if(a.dir){let h=await ut(a.dir,dt(u,f()));for(let S of await ye(h,k(u)))if(await j(b(S,d),r,L(S,t,u)))return;let y;try{y=await qe(h)}catch{y=[]}for(let S of y){if(S===h)continue;for(let E of await ye(S,k(u)))if(await j(b(E,d),r,L(E,t,u)))return}throw Error(`Session ${t} not found in project directory for ${a.dir}`)}let l=v();if(f()&&u!==void 0){let h=await le(u);if(h===void 0)throw new c(`Session ${t} not found (no projects directory)`,"Session not found (no projects directory)");let{names:y}=h;for(let S of y){let E=b(l,S);if(await j(b(E,d),r,L(E,t,u)))return}throw new c(`Session ${t} not found in any project directory`,"Session not found in any project directory")}let g;try{g=await ae(l)}catch{throw Error(`Session ${t} not found (no projects directory)`)}for(let h of g)if(await j(b(l,h,d),r))return;throw Error(`Session ${t} not found in any project directory`)}async function j(t,r,a){if(f()&&a!==void 0)return Hn(a,r);let u;try{u=await Fn(t,ne.O_WRONLY|ne.O_APPEND)}catch(d){let l=n(d);if(l==="ENOENT"||l==="ENOTDIR")return!1;throw d}try{let{size:d}=await u.stat();if(d===0)return!1;let l=process.platform==="win32"?d:void 0,g=Buffer.from(r,"utf8"),h=0;while(h<g.length){let{bytesWritten:y}=await u.write(g,h,g.length-h,l);if(y<=0)throw new c(`tryAppend: short write to ${t} stalled with ${g.length-h} bytes remaining`,"tryAppend: zero-progress short write");if(h+=y,l!==void 0)l+=y}return!0}finally{await u.close()}}async function Hn({backend:t,key:r},a){let u=await t.append(r,[{data:a}],{precondition:{type:"ifExists",nonEmpty:!0}});if(!u.ok){if(u.error.code==="NotFound")return!1;throw Error("Session append: transcript not writable via storage",{cause:u.error})}return!0}function L(t,r,a){if(!f()||a===void 0)return;let u=Ve(t,a.isKeySegment);return u===void 0?void 0:{backend:a.backend,key:a.transcriptKey(u,r)}}async function so(t,r,a){if(a?.sessionStore)return Gn(a.sessionStore,t,r,a.dir);return ie(t,r,a)}async function ao(t,r,a){if(a?.sessionStore)return Un(a.sessionStore,t,r,a.dir);return ce(t,r,a)}async function io(t,r){return me(t,!0,r)}async function co(t,r){return me(t,!1,r)}async function uo(t,r){if(!U(t))throw new c(`Invalid sessionId: ${t}`,"deleteSession: invalid sessionId (must be a UUID)");if(r?.sessionStore){if(!r.sessionStore.delete)return;let a=se(r.dir);await r.sessionStore.delete({projectKey:a,sessionId:t});return}return de(t,r)}async function me(t,r,a){if(a?.sessionStore)throw new c("Archiving is not supported with sessionStore: a SessionStore holds transcript entries, and the archived mark is not one","setSessionArchived: sessionStore is not supported");return ue(t,r,a)}async function Gn(t,r,a,u){if(!U(r))throw new c(`Invalid sessionId: ${r}`,"renameSession: invalid sessionId (must be a UUID)");if(!a.trim())throw Error("title must be non-empty");let d=se(u);await t.append({projectKey:d,sessionId:r},[{type:"custom-title",customTitle:a.trim(),sessionId:r,uuid:pe(),timestamp:new Date().toISOString()}])}async function Un(t,r,a,u){if(!U(r))throw new c(`Invalid sessionId: ${r}`,"tagSession: invalid sessionId (must be a UUID)");if(a!==null){let l=_e(a).trim();if(!l)throw Error("tag must be non-empty (use null to clear)");a=l}let d=se(u);await t.append({projectKey:d,sessionId:r},[{type:"tag",tag:a??"",sessionId:r,uuid:pe(),timestamp:new Date().toISOString()}])}export{io as archiveSession,uo as deleteSession,so as renameSession,ao as tagSession,co as unarchiveSession};
package/core-x20yarwf.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.325
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,n,ce,w}from"./core-msnqqcc2.mjs";import{lstat as a,rm as u,rmdir as m,unlink as T}from"fs/promises";var E=new Set(["EPERM","EACCES","EBUSY"]),f=50;async function Kt(t){for(let r=1;;r++){let s=!0;try{await u(t,{recursive:!0,force:!0})}catch(i){if(n(i)!=="ENOTEMPTY")throw i;s=!1}try{await a(t)}catch(i){if(ce(i)||s&&process.platform==="win32"&&E.has(n(i)))return;throw i}if(r===3)throw Object.assign(new c(`'${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 w(r*f)}}class o{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 l=new o;function e(t){return l.lazy(t)}import{createHash as h}from"crypto";function Pe(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 h("sha256").update(t).digest("hex")}
17
- export{Kt,e,Pe};