hinacode 0.3.0-alpha.10 → 0.3.0-alpha.11

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.
@@ -3,11 +3,11 @@ globalThis.require ??= __createRequire(import.meta.url);
3
3
  import { execFile, spawn } from "node:child_process";
4
4
  import * as NFS from "node:fs";
5
5
  import NFS__default, { createReadStream, rmSync, existsSync, readFileSync, mkdirSync, writeFileSync, renameSync, mkdtempSync, watch, chmodSync, statSync, createWriteStream, readlinkSync } from "node:fs";
6
- import { createRequire } from "node:module";
7
6
  import { homedir, tmpdir, networkInterfaces, hostname, userInfo, loadavg, cpus, totalmem } from "node:os";
8
7
  import path__default, { join as join$1, sep, resolve as resolve$1, basename, relative, dirname, isAbsolute, extname, delimiter } from "node:path";
8
+ import { isSea } from "node:sea";
9
9
  import NodeUrl__default, { fileURLToPath } from "node:url";
10
- import { d as dual, ai as assignProperty, b8 as isFailure, au as succeed, av as fail$1, K as some, N as none, bl as hash, bm as equals, ad as pipeArguments, bn as NodeInspectSymbol, bo as toJson, g as format$2, Z as isSome, bp as withFiber, bq as uninterruptibleMask, br as get$6, bs as Scope, bt as flow$1, bu as fromInputUnsafe, bv as constant, bw as zero, be as as, bx as addFinalizerExit, v as void_, b2 as forEach, by as exit, bz as tap$1, $ as sync, aw as interrupt, p as fail$2, bA as ExceededCapacityError, bB as makeUnsafe$5, bC as makeUnsafe$6, bD as makeUnsafe$7, H as suspend, bE as runForkWith, bF as runIn, bG as hasInterrupts, bH as doneUnsafe, bI as getUnsafe$1, bJ as addFinalizer, ax as andThen, bK as _await, bL as getCurrent, bM as interrupt$1, bN as close, bO as isZero, bP as isFinite$1, bQ as Clock, bR as toMillis, _ as flatMap, bS as millis, a8 as ensuring, bT as void_$1, bU as getOrThrow, e as hasProperty, bV as BaseProto, aI as TaggedError, bW as Error$1, bX as toSeconds, bY as symbol$2, bZ as structure, b_ as symbol$3, b$ as redact$1, c0 as symbolRedactable, O as make$1q, R as Reference, c1 as strictEqual, c2 as map$1, c3 as try_, c4 as flatMap$1, c5 as combine, c6 as string$2, c7 as number$4, c8 as optimize, c9 as contextWith, ca as infinity, w as withFiber$1, b as sync$1, cb as PipeInspectableProto, cc as updateContext, cd as merge$3, ce as succeed$1, cf as exitHasInterrupts, cg as ClockRef, ch as forkUnsafe, ci as onExitUnsafe, cj as void_$2, ck as fiberInterrupt, cl as fiberJoin, cm as filterMap, cn as failVoid, co as isGreaterThanOrEqualTo$1, cp as LogLevelOrder, aN as acquireRelease, i as isEffect, cq as interruptAs, n as succeed$2, r as runFork, cr as isFailure$1, h as hasInterruptsOnly, cs as into, ct as asVoid, cu as done, cv as filterInterruptors, cw as interruptAllAs, cx as interruptAll, cy as empty$5, cz as forkUnsafe$1, cA as runPromise, cB as runPromiseWith, cC as runPromiseExit, cD as runPromiseExitWith, cE as runSync, cF as runSyncWith, cG as runSyncExit, cH as runSyncExitWith, cI as runCallback, cJ as runCallbackWith, cK as makeMemoMapUnsafe, aB as provideContext, cL as buildWithMemoMap, cM as flatten, cN as await_, cO as scopeRemoveFinalizerUnsafe, cP as die, cQ as isResult, cR as isSuccess$1, m as identity, cS as effect, aj as Service$1, cT as contextWith$1, cU as getOrUndefined, am as gen, cV as context, cW as make$1r, V as map$2, cX as fromQueue, cY as unwrap, aq as provideService, cZ as onExit, c_ as failCauseUnsafe, aV as offerUnsafe, T as TaggedError$1, U as Union, S as String$1, o as optional$7, D as Defect, P as Prototype, c$ as makeSpanUnsafe, d0 as TracerTimingEnabled, d1 as endSpan, d2 as makeSpanScoped, d3 as useSpan, d4 as constUndefined, d5 as provideService$1, d6 as ParentSpan, z as scoped, t as tapCause, y as fnUntraced, d7 as serviceOption, a3 as match, d8 as make$1s, d9 as provide$1, da as onError, db as catchIf, dc as scope$1, dd as getOption, de as onExitPrimitive, a as isSuccess$2, df as catchCause, dg as matchCauseEffect, dh as failCause, di as combine$1, a9 as orDie, dj as add$1, dk as makeUnsafe$8, dl as fromReasons, dm as isFailReason, dn as makeDieReason, dp as reasonAnnotations, dq as failCause$1, dr as yieldNow, ds as constTrue, dt as normalizeNonEmpty, du as unbounded, dv as publishUnsafe, dw as fromPubSub, dx as getDefaultExportFromCjs, a$ as all$1, M as match$1, b7 as promise$1, b6 as ProviderId, dy as now, dz as formatIso, a2 as pipe$2, dA as sort, Y as map$3, dB as flatMapNullishOr, dC as catch_, bh as map$4, dD as fromNullishOr, x as mapError, dE as logDebug, dF as annotateLogs, dG as withSpan, ay as catchTag, dH as logInfo, dI as catchDefect, dJ as filterOrFail, dK as make$1t, dL as Number$1, dM as encodeEffect, k as decodeUnknownEffect, aZ as succeedNone, a7 as isReadonlyArrayNonEmpty, dN as asSome, dO as mutable, A as ArraySchema, dP as NoSuchElementError, dQ as Literals, b1 as Number$2, b3 as NullOr, aD as Struct, dR as FileSystem, dS as orElseSucceed, dT as chatFolder, dU as Boolean$1, dV as ProjectKind, dW as ignore$1, dX as logWarning, aT as callback, dY as sleep$3, dZ as forkDetach, d_ as succeed$3, d$ as signedOutFailure, e0 as decodeUnknownOption, an as isNone, aL as fromJsonString, L as Literal, e1 as Unknown, e2 as toArray, aJ as seconds, f as optionalKey, e3 as cachedWithTTL, e4 as minutes, aO as unbounded$1, e5 as toAsyncIterable, bg as tryPromise, e6 as timeout, e7 as addFinalizer$1, e8 as callback$1, e9 as offer, ea as withPermit, eb as acquireUseRelease, aP as endUnsafe, ec as shutdownUnsafe, ed as make$1u, bd as try_$1, bi as tapError, ee as forkIn, ef as fromAsyncIterable, eg as runForEach, s as squash, eh as CLAUDE_EFFORT_LEVELS, ei as ensuring$1, ej as currentTimeMillis, ek as sum, el as race, em as publishedArtifactId, en as PUBLISH_DOCUMENT_TOOL, eo as PUBLISH_ARTIFACT_TOOL, ep as PUBLISH_WHITEBOARD_TOOL, eq as isDone, er as empty$6, es as succeed$4, et as fromIterable$2, eu as flatMap$2, ev as interruptWhen, ew as concat, ex as fromEffectDrain, ey as fromEffect, ez as fromIterableEffect, eA as suspend$1, eB as unlistedModel, eC as make$1v, eD as tap$2, eE as tick, eF as map$5, eG as drop, eH as merge$4, eI as onInterrupt, aS as timeoutOrElse, eJ as format$3, eK as getOrNull, eL as Record, eM as make$1w, aa as take, eN as join$2, ab as raceFirst, eO as end, eP as forkScoped, eQ as isObject$2, J as getOrElse, eR as repeat, ao as succeed$5, eS as subscribe, eT as fromSubscription, eU as applySettingsPatch, eV as publish, eW as defaultSettings, eX as Settings$2, eY as flatMapNullishOr$1, eZ as option, e_ as delay, e$ as PRIVATE_NETWORKS, f0 as RelayHostList, f1 as RelayMachineList, f2 as encodeSync, f3 as mergeAll, bb as PushEvent, f4 as makeUnsafe$9, f5 as effectDiscard, f6 as changes$1, f7 as Void, f8 as AppConnection, f9 as decodeEffect, fa as toCodecJson, fb as RecordFromUrlParams, fc as decodeTo, fd as externalSpan, fe as isOption, ff as isExit, af as fromUndefinedOr, fg as zero$1, fh as fromInput$1, fi as badArgument, fj as isSchemaError, fk as isNoSuchElementError, fl as StackTrace, fm as mapEager, fn as updateContext$1, fo as makeUnsafe$a, fp as tag$2, fq as Error$2, I as Int, fr as fromInputUnsafe$1, fs as Path, ft as run$6, fu as mebibytes, fv as Class, fw as constFalse, fx as withLogSpan, fy as log, ah as getOrUndefined$1, fz as Tracer, fA as nativeTracer, fB as hasInterrupts$1, fC as succeed$6, fD as setStackTraceLimit, fE as fail$3, fF as getStackTraceLimit, fG as fiberEnterUninterruptibleUnsafe, fH as contA, fI as effectIsExit, fJ as closeUnsafe, fK as contE, fL as reportCauseUnsafe, fM as matchCauseEffectEager, fN as flatMapEager, fO as provideMerge, fP as fromInput$2, fQ as fromReadable, fR as toArrayBuffer, G as cached$1, fS as provide$2, fT as layer$_, fU as pipeThroughDuplex, fV as toUint8Array, bk as layer$$, b0 as fromResult, fW as WebSocketServer, fX as orDie$1, fY as runForEachArray, fZ as interruptible, f_ as die$1, f$ as Duration, g0 as DateTimeUtc, g1 as withConstructorDefault, g2 as withDecodingDefault, g3 as Redacted, g4 as Tuple, g5 as isRedacted, g6 as MutableJson, ag as isNotUndefined, g7 as Never, ak as empty$7, g8 as toJsonSchemaDocument, g9 as effectContext, ga as annotateCurrentSpan, gb as isUndefined, az as result$1, gc as failCause$2, gd as forkChild, ge as catch_$1, gf as isSchemaError$1, gg as failCause$3, gh as mapEffect, gi as onEnd, gj as isSchema, aQ as encodeUnknownEffect, gk as annotate, gl as fail$4, aA as make$1x, gm as make$1y, gn as declare, go as isStream, gp as Class$1, gq as Exit, gr as getOrUndefinedUnsafe, bj as provide$3, gs as provideContext$1, gt as Opaque, gu as StructWithRest, gv as JsonObject$3, gw as transformOptional, gx as flatMap$3, gy as toType, gz as Any, gA as UndefinedOr, gB as Finite, gC as passthrough, gD as Uint8ArrayFromBase64, gE as Json, gF as TemplateLiteral, gG as decode$3, gH as withDefault, gI as isBetween, W as taggedEnum, gJ as take$1, gK as isNullish, gL as isString, gM as never$1, gN as bounded, gO as withParentSpan, gP as die$2, gQ as offerAll, gR as decodeSync, l as logError, gS as NonEmptyArray, gT as interrupt$2, gU as interruptors, gV as catchCauseIf, gW as decode$4, gX as decodeUnknownResult, gY as fn, gZ as isTagged, g_ as isReadonlyObject, g$ as IllegalArgumentError, h0 as encode$1, h1 as omit$1, h2 as merge$5, h3 as succeedContext, h4 as unwrap$1, h5 as CurrentMemoMap, h6 as fromIterable$3, h7 as reverse, a0 as empty$8, h8 as withFiberSucceed, h9 as fiberEnterInterruptibleUnsafe, ha as compose$1, hb as collect, hc as catchDone, hd as takeAll, he as fromArray, hf as whileLoop, hg as matchEffect, hh as defaultFormatter, hi as logFatal, hj as isDeferred, hk as hasDies, c as constVoid, hl as shutdown, hm as Scheduler$1, ae as catchTags, hn as CurrentLogLevel, q as is$2, ho as UnknownFromJsonString, hp as ignoreCause, hq as forever, hr as Class$2, hs as TaggedStruct, ht as toEncoded, hu as isMaxLength, hv as makeFilter, hw as isPattern, hx as runLast, hy as fromOption, hz as decodeUnknownSync, hA as spawnsSubagent, hB as isPublishArtifactTool, hC as outputText, hD as publishedArtifact, hE as toolArgument, hF as isPublishDocumentTool, hG as commonjsGlobal, hH as isRunAgentTool, hI as presetModels, hJ as filter$1, hK as take$2, hL as runDrain, hM as min, hN as ChildProcessSpawner, hO as make$1z, hP as mkString, hQ as decodeText$1, hR as ForkPoint, hS as TokenUsage, hT as MessagePart, hU as Message, hV as sliding, hW as parseGitHubPullRequestUrl, hX as PullRequestReviewer, hY as PullRequestLabel, hZ as PullRequestComment, h_ as DiffSide, h$ as subtract, i0 as PULL_REQUEST_REFRESH, i1 as parseGitHubRepository, i2 as request$2, i3 as Class$3, i4 as AgentProfile, i5 as AccountProviderId, i6 as ProjectAction, i7 as Project, i8 as BooleanFromBit, i9 as Worktree, bf as isThreadBusy, ia as timeoutOption, bc as ThreadStatus, ib as ScheduledMessage, ic as QueuedMessage, id as UsageLimit, aH as Thread, ie as getOrThrow$1, ig as PullRequestWatch, ih as PullRequestLink, ii as PullRequestStatus, ij as allWatchEventKinds, ik as enabledProviders, il as transcriptThreadId, im as resumeGraceMs, io as fail$5, ip as WAIT_AGENT_TOOL, iq as startingProvider, ir as kilobytes, is as monotonicTimeNanos, it as retry$3, iu as spaced, iv as die$3, iw as snakeToCamel, ix as camelToSnake, iy as UpdatableProviderId, iz as filter$2, iA as AgentAccount, iB as filter$3, iC as schedule, aR as RpcMethods, iD as BrowserFrame, iE as PagePick, iF as defaultClientSettings, iG as ClientSettings$1, iH as parsePairingUrl, iI as pairingUrl, iJ as Environment, iK as relayWebSocketUrl, iL as remoteWebSocketUrl, aW as WebSocket, aM as ServerFrame, iM as CHALLENGE_WAIT_MS, aU as methodKind, iN as dialPlan, iO as REMOTE_PROTOCOL_VERSION, iP as DIRECT_CHECK_INTERVAL_MS, iQ as DIRECT_CHECK_TIMEOUT_MS, iR as next, iS as bytes, iT as Timestamp, iU as RoutineSchedule, iV as RoutineRun, iW as launch, iX as uninterruptible, iY as parseUnsafe, iZ as RoutineWorkspace, i_ as LinearIssue, i$ as when$2, j0 as threadDeviceId, j1 as shownScreen, j2 as devicePlatformOf, ap as value$2, j3 as RUN_AGENT_TOOL, j4 as ARTIFACT_THEME_GUIDE, j5 as DeviceUrl, j6 as DeviceApp, j7 as DeviceButton, j8 as WatchEventKind, j9 as GuideGroup, ja as PullRequestGuide, jb as flatten$1, jc as diskFullness, jd as pretty, je as min$1, jf as exponential, jg as desktopOnlyPushes, jh as reachesPhone, ji as mutations, jj as desktopOnlyMethods, jk as isAddressNotUpYet, jl as ClientFrame, aY as REMOTE_MAX_FRAME_BYTES, aX as REMOTE_PATH, jm as empty$9, a_ as cliSocketPath, jn as BindHost, jo as take$3, jp as getAugmentedNamespace, jq as make$1A, jr as NativeSpan, js as currentTimeNanos, aC as MinimumLogLevel, jt as isPortInUse } from "./chunks/remote-pQ0bz_4K.js";
10
+ import { d as dual, ai as assignProperty, b8 as isFailure, au as succeed, av as fail$1, K as some, N as none, bm as hash, bn as equals, ad as pipeArguments, bo as NodeInspectSymbol, bp as toJson, g as format$2, Z as isSome, bq as withFiber, br as uninterruptibleMask, bs as get$6, bt as Scope, bu as flow$1, bv as fromInputUnsafe, bw as constant, bx as zero, be as as, by as addFinalizerExit, v as void_, b2 as forEach, bz as exit, bA as tap$1, $ as sync, aw as interrupt, p as fail$2, bB as ExceededCapacityError, bC as makeUnsafe$4, bD as makeUnsafe$5, bE as makeUnsafe$6, H as suspend, bF as runForkWith, bG as runIn, bH as hasInterrupts, bI as doneUnsafe, bJ as getUnsafe$1, bK as addFinalizer, ax as andThen, bL as _await, bM as getCurrent, bN as interrupt$1, bO as close, bP as isZero, bQ as isFinite$1, bR as Clock, bS as toMillis, _ as flatMap, bT as millis, a8 as ensuring, bU as void_$1, bV as getOrThrow, e as hasProperty, bW as BaseProto, aI as TaggedError, bX as Error$1, bY as toSeconds, bZ as symbol$2, b_ as structure, b$ as symbol$3, c0 as redact$1, c1 as symbolRedactable, O as make$1o, R as Reference, c2 as strictEqual, c3 as map$1, c4 as try_, c5 as flatMap$1, c6 as combine, c7 as string$2, c8 as number$4, c9 as optimize, ca as contextWith, cb as infinity, w as withFiber$1, b as sync$1, cc as PipeInspectableProto, cd as updateContext, ce as merge$3, cf as succeed$1, cg as exitHasInterrupts, ch as ClockRef, ci as forkUnsafe, cj as onExitUnsafe, ck as void_$2, cl as fiberInterrupt, cm as fiberJoin, cn as filterMap, co as failVoid, cp as isGreaterThanOrEqualTo$1, cq as LogLevelOrder, aN as acquireRelease, i as isEffect, cr as interruptAs, n as succeed$2, r as runFork, cs as isFailure$1, h as hasInterruptsOnly, ct as into, cu as asVoid, cv as done, cw as filterInterruptors, cx as interruptAllAs, cy as interruptAll, cz as empty$5, cA as forkUnsafe$1, cB as runPromise, cC as runPromiseWith, cD as runPromiseExit, cE as runPromiseExitWith, cF as runSync, cG as runSyncWith, cH as runSyncExit, cI as runSyncExitWith, cJ as runCallback, cK as runCallbackWith, cL as makeMemoMapUnsafe, aB as provideContext, cM as buildWithMemoMap, cN as flatten, cO as await_, cP as scopeRemoveFinalizerUnsafe, cQ as die, cR as isResult, cS as isSuccess$1, m as identity, cT as effect, aj as Service$1, cU as contextWith$1, cV as getOrUndefined, am as gen, cW as context, cX as make$1p, V as map$2, cY as fromQueue, cZ as unwrap, aq as provideService, c_ as onExit, c$ as failCauseUnsafe, aV as offerUnsafe, T as TaggedError$1, U as Union, S as String$1, o as optional$7, D as Defect, P as Prototype, d0 as makeSpanUnsafe, d1 as TracerTimingEnabled, d2 as endSpan, d3 as makeSpanScoped, d4 as useSpan, d5 as constUndefined, d6 as provideService$1, d7 as ParentSpan, z as scoped, t as tapCause, y as fnUntraced, d8 as serviceOption, a3 as match, d9 as make$1q, da as provide$1, db as onError, dc as catchIf, dd as scope$1, de as getOption, df as onExitPrimitive, a as isSuccess$2, dg as catchCause, dh as matchCauseEffect, di as failCause, dj as combine$1, a9 as orDie, dk as add$1, dl as makeUnsafe$7, dm as fromReasons, dn as isFailReason, dp as makeDieReason, dq as reasonAnnotations, dr as failCause$1, ds as yieldNow, dt as constTrue, du as normalizeNonEmpty, dv as unbounded, dw as publishUnsafe, dx as fromPubSub, dy as getDefaultExportFromCjs, a$ as all$1, M as match$1, b7 as promise$1, b6 as ProviderId, dz as now, dA as formatIso, a2 as pipe$2, dB as sort, Y as map$3, dC as flatMapNullishOr, dD as catch_, bh as map$4, dE as fromNullishOr, x as mapError, dF as logDebug, dG as annotateLogs, dH as withSpan, ay as catchTag, dI as logInfo, dJ as catchDefect, dK as filterOrFail, dL as make$1r, dM as Number$1, dN as encodeEffect, k as decodeUnknownEffect, aZ as succeedNone, a7 as isReadonlyArrayNonEmpty, dO as asSome, dP as mutable, A as ArraySchema, dQ as NoSuchElementError, dR as Literals, b1 as Number$2, b3 as NullOr, aD as Struct, dS as FileSystem, dT as orElseSucceed, dU as chatFolder, dV as Boolean$1, dW as ProjectKind, dX as ignore$1, dY as logWarning, aT as callback, dZ as sleep$3, d_ as forkDetach, d$ as succeed$3, e0 as signedOutFailure, e1 as decodeUnknownOption, an as isNone, aL as fromJsonString, L as Literal, e2 as Unknown, e3 as toArray, aJ as seconds, f as optionalKey, e4 as cachedWithTTL, e5 as minutes, aO as unbounded$1, e6 as toAsyncIterable, bg as tryPromise, e7 as timeout, e8 as addFinalizer$1, e9 as callback$1, ea as offer, eb as withPermit, ec as acquireUseRelease, aP as endUnsafe, ed as shutdownUnsafe, ee as make$1s, bd as try_$1, bj as tapError, ef as forkIn, eg as fromAsyncIterable, eh as runForEach, s as squash, ei as CLAUDE_EFFORT_LEVELS, ej as ensuring$1, ek as currentTimeMillis, el as sum, em as race, en as publishedArtifactId, eo as PUBLISH_DOCUMENT_TOOL, ep as PUBLISH_ARTIFACT_TOOL, eq as PUBLISH_WHITEBOARD_TOOL, er as isDone, es as empty$6, et as succeed$4, eu as fromIterable$2, ev as flatMap$2, ew as interruptWhen, ex as concat, ey as fromEffectDrain, ez as fromEffect, eA as fromIterableEffect, eB as suspend$1, eC as unlistedModel, eD as make$1t, eE as tap$2, eF as tick, eG as map$5, eH as drop, eI as merge$4, eJ as onInterrupt, aS as timeoutOrElse, eK as format$3, eL as getOrNull, eM as Record, eN as make$1u, aa as take, eO as join$2, ab as raceFirst, eP as end, eQ as forkScoped, eR as isObject$2, J as getOrElse, eS as repeat, ao as succeed$5, eT as subscribe, eU as fromSubscription, eV as applySettingsPatch, eW as publish, eX as defaultSettings, eY as Settings$2, eZ as flatMapNullishOr$1, e_ as option, e$ as delay, f0 as PRIVATE_NETWORKS, f1 as RelayHostList, f2 as RelayMachineList, f3 as encodeSync, f4 as mergeAll, bb as PushEvent, f5 as makeUnsafe$8, f6 as effectDiscard, f7 as changes$1, f8 as Void, f9 as AppConnection, fa as decodeEffect, fb as toCodecJson, fc as RecordFromUrlParams, fd as decodeTo, fe as externalSpan, ff as isOption, fg as isExit, af as fromUndefinedOr, fh as zero$1, fi as fromInput$1, fj as badArgument, fk as isSchemaError, fl as isNoSuchElementError, fm as StackTrace, fn as mapEager, fo as updateContext$1, fp as makeUnsafe$9, fq as tag$2, fr as Error$2, I as Int, fs as fromInputUnsafe$1, ft as Path, fu as run$5, fv as mebibytes, fw as Class, fx as constFalse, fy as withLogSpan, fz as log, ah as getOrUndefined$1, fA as Tracer, fB as nativeTracer, fC as hasInterrupts$1, fD as succeed$6, fE as setStackTraceLimit, fF as fail$3, fG as getStackTraceLimit, fH as fiberEnterUninterruptibleUnsafe, fI as contA, fJ as effectIsExit, fK as closeUnsafe, fL as contE, fM as reportCauseUnsafe, fN as matchCauseEffectEager, fO as flatMapEager, fP as provideMerge, fQ as fromInput$2, fR as fromReadable, fS as toArrayBuffer, G as cached$1, fT as provide$2, fU as layer$X, fV as pipeThroughDuplex, fW as toUint8Array, bl as layer$Y, b0 as fromResult, fX as WebSocketServer, fY as orDie$1, fZ as runForEachArray, f_ as interruptible, f$ as die$1, g0 as Duration, g1 as DateTimeUtc, g2 as withConstructorDefault, g3 as withDecodingDefault, g4 as Redacted, g5 as Tuple, g6 as isRedacted, g7 as MutableJson, ag as isNotUndefined, g8 as Never, ak as empty$7, g9 as toJsonSchemaDocument, ga as effectContext, gb as annotateCurrentSpan, gc as isUndefined, az as result$1, gd as failCause$2, ge as forkChild, gf as catch_$1, gg as isSchemaError$1, gh as failCause$3, gi as mapEffect, gj as onEnd, gk as isSchema, aQ as encodeUnknownEffect, gl as annotate, gm as fail$4, aA as make$1v, gn as make$1w, go as declare, gp as isStream, gq as Class$1, gr as Exit, gs as getOrUndefinedUnsafe, bk as provide$3, gt as provideContext$1, gu as Opaque, gv as StructWithRest, gw as JsonObject$3, gx as transformOptional, gy as flatMap$3, gz as toType, gA as Any, gB as UndefinedOr, gC as Finite, gD as passthrough, gE as Uint8ArrayFromBase64, gF as Json, gG as TemplateLiteral, gH as decode$3, gI as withDefault, gJ as isBetween, W as taggedEnum, gK as take$1, gL as isNullish, gM as isString, gN as never$1, gO as bounded, gP as withParentSpan, gQ as die$2, gR as offerAll, gS as decodeSync, l as logError, gT as NonEmptyArray, gU as interrupt$2, gV as interruptors, gW as catchCauseIf, gX as decode$4, gY as decodeUnknownResult, gZ as fn, g_ as isTagged, g$ as isReadonlyObject, h0 as IllegalArgumentError, h1 as encode$1, h2 as omit$1, h3 as merge$5, h4 as succeedContext, h5 as unwrap$1, h6 as CurrentMemoMap, h7 as fromIterable$3, h8 as reverse, a0 as empty$8, h9 as withFiberSucceed, ha as fiberEnterInterruptibleUnsafe, hb as compose$1, hc as collect, hd as catchDone, he as takeAll, hf as fromArray, hg as whileLoop, hh as matchEffect, hi as defaultFormatter, hj as logFatal, hk as isDeferred, hl as hasDies, c as constVoid, hm as shutdown, hn as Scheduler$1, ae as catchTags, ho as CurrentLogLevel, q as is$2, hp as UnknownFromJsonString, hq as ignoreCause, hr as forever, hs as Class$2, ht as TaggedStruct, hu as toEncoded, hv as isMaxLength, hw as makeFilter, hx as isPattern, hy as runLast, hz as fromOption, hA as decodeUnknownSync, hB as spawnsSubagent, hC as isPublishArtifactTool, hD as outputText, hE as publishedArtifact, hF as toolArgument, hG as isPublishDocumentTool, hH as commonjsGlobal, hI as isRunAgentTool, hJ as presetModels, hK as filter$1, hL as take$2, hM as runDrain, hN as min, hO as ChildProcessSpawner, hP as make$1x, hQ as mkString, hR as decodeText$1, hS as ForkPoint, hT as TokenUsage, hU as MessagePart, hV as Message, hW as parseGitHubPullRequestUrl, hX as PullRequestReviewer, hY as PullRequestLabel, hZ as PullRequestComment, h_ as DiffSide, h$ as subtract, i0 as PULL_REQUEST_REFRESH, i1 as parseGitHubRepository, i2 as request$2, i3 as Class$3, i4 as AgentProfile, i5 as AccountProviderId, i6 as ProjectAction, i7 as Project, i8 as BooleanFromBit, i9 as Worktree, ia as timeoutOption, bf as isThreadBusy, bc as ThreadStatus, ib as ScheduledMessage, ic as QueuedMessage, id as UsageLimit, aH as Thread, ie as getOrThrow$1, ig as PullRequestWatch, ih as PullRequestLink, ii as allWatchEventKinds, ij as enabledProviders, ik as transcriptThreadId, il as resumeGraceMs, im as fail$5, io as WAIT_AGENT_TOOL, ip as startingProvider, iq as kilobytes, ir as monotonicTimeNanos, is as retry$3, it as spaced, iu as die$3, iv as snakeToCamel, iw as camelToSnake, ix as UpdatableProviderId, iy as filter$2, iz as AgentAccount, iA as filter$3, iB as schedule, aR as RpcMethods, iC as BrowserFrame, iD as PagePick, iE as defaultClientSettings, iF as ClientSettings$1, iG as parsePairingUrl, iH as pairingUrl, iI as Environment, iJ as relayWebSocketUrl, iK as remoteWebSocketUrl, aW as WebSocket, aM as ServerFrame, iL as CHALLENGE_WAIT_MS, aU as methodKind, iM as dialPlan, iN as REMOTE_PROTOCOL_VERSION, iO as DIRECT_CHECK_INTERVAL_MS, iP as DIRECT_CHECK_TIMEOUT_MS, iQ as next, iR as bytes, iS as Timestamp, iT as RoutineSchedule, iU as RoutineRun, iV as launch, iW as uninterruptible, iX as parseUnsafe, iY as RoutineWorkspace, iZ as LinearIssue, i_ as when$2, i$ as threadDeviceId, j0 as shownScreen, j1 as devicePlatformOf, ap as value$2, j2 as RUN_AGENT_TOOL, j3 as ARTIFACT_THEME_GUIDE, j4 as DeviceUrl, j5 as DeviceApp, j6 as DeviceButton, j7 as WatchEventKind, j8 as GuideGroup, j9 as PullRequestGuide, ja as flatten$1, jb as diskFullness, jc as pretty, jd as min$1, je as exponential, jf as desktopOnlyPushes, jg as reachesPhone, jh as mutations, ji as desktopOnlyMethods, jj as isAddressNotUpYet, jk as ClientFrame, aY as REMOTE_MAX_FRAME_BYTES, aX as REMOTE_PATH, jl as empty$9, a_ as cliSocketPath, jm as BindHost, jn as getAugmentedNamespace, jo as make$1y, jp as NativeSpan, jq as currentTimeNanos, aC as MinimumLogLevel, bi as packageJson, jr as isPortInUse } from "./chunks/remote-bP8M4Xnc.js";
11
11
  import Ee__default from "fs";
12
12
  import require$$0 from "util";
13
13
  import require$$1$1 from "stream";
@@ -92,9 +92,9 @@ const compose = /* @__PURE__ */ dual(2, (left, right) => (input) => {
92
92
  if (isFailure(leftOut)) return leftOut;
93
93
  return right(leftOut.success);
94
94
  });
95
- const TypeId$t = "~effect/MutableHashMap";
95
+ const TypeId$s = "~effect/MutableHashMap";
96
96
  const MutableHashMapProto = {
97
- [TypeId$t]: TypeId$t,
97
+ [TypeId$s]: TypeId$s,
98
98
  [Symbol.iterator]() {
99
99
  return this.backing[Symbol.iterator]();
100
100
  },
@@ -120,7 +120,7 @@ const empty$4 = () => {
120
120
  self2.buckets = /* @__PURE__ */ new Map();
121
121
  return self2;
122
122
  };
123
- const make$1p = (...entries) => fromIterable$1(entries);
123
+ const make$1n = (...entries) => fromIterable$1(entries);
124
124
  const fromIterable$1 = (entries) => {
125
125
  const self2 = empty$4();
126
126
  for (const [key2, value2] of entries) {
@@ -209,9 +209,9 @@ const clear$2 = (self2) => {
209
209
  return self2;
210
210
  };
211
211
  const size = (self2) => self2.backing.size;
212
- const TypeId$s = "~effect/RcMap";
213
- const makeUnsafe$4 = (options) => ({
214
- [TypeId$s]: TypeId$s,
212
+ const TypeId$r = "~effect/RcMap";
213
+ const makeUnsafe$3 = (options) => ({
214
+ [TypeId$r]: TypeId$r,
215
215
  lookup: options.lookup,
216
216
  context: options.context,
217
217
  scope: options.scope,
@@ -225,10 +225,10 @@ const makeUnsafe$4 = (options) => ({
225
225
  return pipeArguments(this, arguments);
226
226
  }
227
227
  });
228
- const make$1o = (options) => withFiber((fiber) => {
228
+ const make$1m = (options) => withFiber((fiber) => {
229
229
  const context2 = fiber.context;
230
230
  const scope2 = get$6(context2, Scope);
231
- const self2 = makeUnsafe$4({
231
+ const self2 = makeUnsafe$3({
232
232
  lookup: options.lookup,
233
233
  context: context2,
234
234
  scope: scope2,
@@ -263,8 +263,8 @@ const get$4 = /* @__PURE__ */ dual(2, (self2, key2) => uninterruptibleMask((rest
263
263
  return fail$2(new ExceededCapacityError(`RcMap attempted to exceed capacity of ${self2.capacity}`));
264
264
  } else {
265
265
  entry = {
266
- deferred: makeUnsafe$6(),
267
- scope: makeUnsafe$5(),
266
+ deferred: makeUnsafe$5(),
267
+ scope: makeUnsafe$4(),
268
268
  idleTimeToLive: self2.idleTimeToLive(key2),
269
269
  finalizer: void 0,
270
270
  fiber: void 0,
@@ -278,7 +278,7 @@ const get$4 = /* @__PURE__ */ dual(2, (self2, key2) => uninterruptibleMask((rest
278
278
  context2.set(key3, value2);
279
279
  });
280
280
  context2.set(Scope.key, entry.scope);
281
- const lookupContext = makeUnsafe$7(context2);
281
+ const lookupContext = makeUnsafe$6(context2);
282
282
  suspend(() => self2.lookup(key2)).pipe(runForkWith(lookupContext), runIn(entry.scope)).addObserver((exit2) => {
283
283
  if (hasInterrupts(exit2)) removeInterrupted(self2, key2, entry, lookupContext);
284
284
  doneUnsafe(entry.deferred, exit2);
@@ -331,8 +331,8 @@ const release = (self2, key2, entry) => withFiber((fiber) => {
331
331
  })), runForkWith(fiber.context), runIn(self2.scope));
332
332
  return void_;
333
333
  });
334
- const TypeId$r = "~effect/http/Cookies";
335
- const isCookies = (u) => hasProperty(u, TypeId$r);
334
+ const TypeId$q = "~effect/http/Cookies";
335
+ const isCookies = (u) => hasProperty(u, TypeId$q);
336
336
  const CookieTypeId = "~effect/http/Cookies/Cookie";
337
337
  const CookieErrorTypeId = "~effect/http/Cookies/CookieError";
338
338
  class CookiesErrorReason extends Error$1 {
@@ -369,8 +369,8 @@ class CookiesError extends (/* @__PURE__ */ TaggedError("CookiesError")) {
369
369
  return this.reason._tag;
370
370
  }
371
371
  }
372
- const Proto$c = {
373
- [TypeId$r]: TypeId$r,
372
+ const Proto$b = {
373
+ [TypeId$q]: TypeId$q,
374
374
  ...BaseProto,
375
375
  toJSON() {
376
376
  return {
@@ -383,7 +383,7 @@ const Proto$c = {
383
383
  }
384
384
  };
385
385
  const fromReadonlyRecord = (cookies2) => {
386
- const self2 = Object.create(Proto$c);
386
+ const self2 = Object.create(Proto$b);
387
387
  self2.cookies = cookies2;
388
388
  return self2;
389
389
  };
@@ -536,10 +536,10 @@ const tryDecodeURIComponent = (str) => {
536
536
  return str;
537
537
  }
538
538
  };
539
- const TypeId$q = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
540
- const Proto$b = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
541
- [TypeId$q]: {
542
- value: TypeId$q
539
+ const TypeId$p = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
540
+ const Proto$a = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.create(null), {
541
+ [TypeId$p]: {
542
+ value: TypeId$p
543
543
  },
544
544
  [symbolRedactable]: {
545
545
  value(context2) {
@@ -568,20 +568,20 @@ const Proto$b = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.c
568
568
  value: BaseProto[NodeInspectSymbol]
569
569
  }
570
570
  });
571
- const make$1n = (input) => Object.assign(Object.create(Proto$b), input);
571
+ const make$1l = (input) => Object.assign(Object.create(Proto$a), input);
572
572
  const Equivalence = /* @__PURE__ */ makeEquivalence(/* @__PURE__ */ strictEqual());
573
- const empty$2 = /* @__PURE__ */ Object.create(Proto$b);
573
+ const empty$2 = /* @__PURE__ */ Object.create(Proto$a);
574
574
  const fromInput = (input) => {
575
575
  if (input === void 0) {
576
576
  return empty$2;
577
577
  } else if (Symbol.iterator in input) {
578
- const out2 = Object.create(Proto$b);
578
+ const out2 = Object.create(Proto$a);
579
579
  for (const [k, v] of input) {
580
580
  out2[k.toLowerCase()] = v;
581
581
  }
582
582
  return out2;
583
583
  }
584
- const out = Object.create(Proto$b);
584
+ const out = Object.create(Proto$a);
585
585
  for (const [k, v] of Object.entries(input)) {
586
586
  if (Array.isArray(v)) {
587
587
  out[k.toLowerCase()] = v.join(", ");
@@ -591,23 +591,23 @@ const fromInput = (input) => {
591
591
  }
592
592
  return out;
593
593
  };
594
- const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$b);
594
+ const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$a);
595
595
  const set$1 = /* @__PURE__ */ dual(3, (self2, key2, value2) => {
596
- const out = make$1n(self2);
596
+ const out = make$1l(self2);
597
597
  out[key2.toLowerCase()] = value2;
598
598
  return out;
599
599
  });
600
- const setAll = /* @__PURE__ */ dual(2, (self2, headers2) => make$1n({
600
+ const setAll = /* @__PURE__ */ dual(2, (self2, headers2) => make$1l({
601
601
  ...self2,
602
602
  ...fromInput(headers2)
603
603
  }));
604
604
  const merge$2 = /* @__PURE__ */ dual(2, (self2, headers2) => {
605
- const out = make$1n(self2);
605
+ const out = make$1l(self2);
606
606
  Object.assign(out, headers2);
607
607
  return out;
608
608
  });
609
609
  const remove$2 = /* @__PURE__ */ dual(2, (self2, key2) => {
610
- const out = make$1n(self2);
610
+ const out = make$1l(self2);
611
611
  delete out[key2.toLowerCase()];
612
612
  return out;
613
613
  });
@@ -619,12 +619,12 @@ const redact = /* @__PURE__ */ dual(2, (self2, key2) => {
619
619
  if (typeof key3 === "string") {
620
620
  const k = key3.toLowerCase();
621
621
  if (k in self2) {
622
- out[k] = make$1q(self2[k]);
622
+ out[k] = make$1o(self2[k]);
623
623
  }
624
624
  } else {
625
625
  for (const name in self2) {
626
626
  if (name.search(key3) !== -1) {
627
- out[name] = make$1q(self2[name]);
627
+ out[name] = make$1o(self2[name]);
628
628
  }
629
629
  }
630
630
  }
@@ -654,12 +654,12 @@ const isRedactedName = (name, patterns2) => {
654
654
  const CurrentRedactedNames = /* @__PURE__ */ Reference("effect/Headers/CurrentRedactedNames", {
655
655
  defaultValue: () => ["authorization", "cookie", "set-cookie", "x-api-key", "AWSAccessKeyId", "Signature", "sig", "X-Goog-Signature"]
656
656
  });
657
- const TypeId$p = "~effect/net/NetAddress";
657
+ const TypeId$o = "~effect/net/NetAddress";
658
658
  const ipv4Value = (self2) => self2.value;
659
659
  const ipv6Words = (self2) => self2;
660
660
  class NetAddressError extends (/* @__PURE__ */ TaggedError("NetAddressError")) {
661
661
  }
662
- const isAddress = (u) => hasProperty(u, TypeId$p);
662
+ const isAddress = (u) => hasProperty(u, TypeId$o);
663
663
  const isIpv4Address = (u) => isAddress(u) && u._tag === "Ipv4Address";
664
664
  const isIpv6Address = (u) => isAddress(u) && u._tag === "Ipv6Address";
665
665
  const isInetAddressV4 = (u) => isAddress(u) && u._tag === "InetAddressV4";
@@ -669,7 +669,7 @@ const isUnixPathAddress = (u) => isAddress(u) && u._tag === "UnixPathAddress";
669
669
  const Ipv4Proto = {
670
670
  ...BaseProto,
671
671
  _tag: "Ipv4Address",
672
- [TypeId$p]: TypeId$p,
672
+ [TypeId$o]: TypeId$o,
673
673
  [symbol$3](that) {
674
674
  return isIpv4Address(that) && ipv4Value(this) === ipv4Value(that);
675
675
  },
@@ -686,7 +686,7 @@ const Ipv4Proto = {
686
686
  const Ipv6Proto = {
687
687
  ...BaseProto,
688
688
  _tag: "Ipv6Address",
689
- [TypeId$p]: TypeId$p,
689
+ [TypeId$o]: TypeId$o,
690
690
  [symbol$3](that) {
691
691
  if (!isIpv6Address(that)) return false;
692
692
  const self2 = ipv6Words(this);
@@ -852,7 +852,7 @@ const isIpv4Mapped = (self2) => {
852
852
  const InetV4Proto = {
853
853
  ...BaseProto,
854
854
  _tag: "InetAddressV4",
855
- [TypeId$p]: TypeId$p,
855
+ [TypeId$o]: TypeId$o,
856
856
  [symbol$3](that) {
857
857
  return isInetAddressV4(that) && this.port === that.port && equals(this.address, that.address);
858
858
  },
@@ -869,7 +869,7 @@ const InetV4Proto = {
869
869
  const InetV6Proto = {
870
870
  ...BaseProto,
871
871
  _tag: "InetAddressV6",
872
- [TypeId$p]: TypeId$p,
872
+ [TypeId$o]: TypeId$o,
873
873
  [symbol$3](that) {
874
874
  return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && equals(this.address, that.address);
875
875
  },
@@ -935,7 +935,7 @@ const formatUrlUnsafe = (self2, scheme = "http") => getOrThrow(formatUrl(self2,
935
935
  const UnixPathProto = {
936
936
  ...BaseProto,
937
937
  _tag: "UnixPathAddress",
938
- [TypeId$p]: TypeId$p,
938
+ [TypeId$o]: TypeId$o,
939
939
  [symbol$3](that) {
940
940
  return isUnixPathAddress(that) && this.path === that.path;
941
941
  },
@@ -955,22 +955,22 @@ const unixPathAddress = (path2) => {
955
955
  return Object.freeze(self2);
956
956
  };
957
957
  const formatUnixPath = (self2) => `unix://${self2.path}`;
958
- const TypeId$o = "~effect/Cache";
958
+ const TypeId$n = "~effect/Cache";
959
959
  const makeWith$1 = (lookup2, options) => contextWith((context2) => {
960
- const self2 = Object.create(Proto$a);
960
+ const self2 = Object.create(Proto$9);
961
961
  self2.lookup = (key2) => updateContext(lookup2(key2), (input) => merge$3(context2, input));
962
- self2.map = make$1p();
962
+ self2.map = make$1n();
963
963
  self2.capacity = options.capacity;
964
964
  self2.timeToLive = options.timeToLive ? (exit2, key2) => fromInputUnsafe(options.timeToLive(exit2, key2)) : defaultTimeToLive;
965
965
  return succeed$1(self2);
966
966
  });
967
- const make$1m = (options) => makeWith$1(options.lookup, {
967
+ const make$1k = (options) => makeWith$1(options.lookup, {
968
968
  ...options,
969
969
  timeToLive: options.timeToLive !== void 0 ? () => options.timeToLive : defaultTimeToLive
970
970
  });
971
- const Proto$a = {
971
+ const Proto$9 = {
972
972
  ...PipeInspectableProto,
973
- [TypeId$o]: TypeId$o,
973
+ [TypeId$n]: TypeId$n,
974
974
  toJSON() {
975
975
  return {
976
976
  _id: "Cache",
@@ -1076,10 +1076,10 @@ const keys = (self2) => withFiber$1((fiber) => {
1076
1076
  const Order = LogLevelOrder;
1077
1077
  const isGreaterThanOrEqualTo = /* @__PURE__ */ isGreaterThanOrEqualTo$1(Order);
1078
1078
  const ignore = "~effect/ErrorReporter/ignore";
1079
- const TypeId$n = "~effect/FiberHandle";
1080
- const isFiberHandle = (u) => hasProperty(u, TypeId$n);
1081
- const Proto$9 = {
1082
- [TypeId$n]: TypeId$n,
1079
+ const TypeId$m = "~effect/FiberHandle";
1080
+ const isFiberHandle = (u) => hasProperty(u, TypeId$m);
1081
+ const Proto$8 = {
1082
+ [TypeId$m]: TypeId$m,
1083
1083
  ...PipeInspectableProto,
1084
1084
  toJSON() {
1085
1085
  return {
@@ -1088,28 +1088,28 @@ const Proto$9 = {
1088
1088
  };
1089
1089
  }
1090
1090
  };
1091
- const makeUnsafe$3 = () => {
1092
- const self2 = Object.create(Proto$9);
1091
+ const makeUnsafe$2 = () => {
1092
+ const self2 = Object.create(Proto$8);
1093
1093
  self2.state = {
1094
1094
  _tag: "Open",
1095
1095
  fiber: void 0
1096
1096
  };
1097
- self2.deferred = makeUnsafe$6();
1097
+ self2.deferred = makeUnsafe$5();
1098
1098
  return self2;
1099
1099
  };
1100
- const make$1l = () => acquireRelease(sync(() => makeUnsafe$3()), (handle) => {
1100
+ const make$1j = () => acquireRelease(sync(() => makeUnsafe$2()), (handle) => {
1101
1101
  const state = handle.state;
1102
1102
  if (state._tag === "Closed") return void_;
1103
1103
  handle.state = {
1104
1104
  _tag: "Closed"
1105
1105
  };
1106
- return state.fiber ? into(asVoid(interruptAs(state.fiber, internalFiberId$2)), handle.deferred) : done(handle.deferred, void_$1);
1106
+ return state.fiber ? into(asVoid(interruptAs(state.fiber, internalFiberId$1)), handle.deferred) : done(handle.deferred, void_$1);
1107
1107
  });
1108
- const internalFiberId$2 = -1;
1109
- const isInternalInterruption$2 = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has$1(internalFiberId$2)));
1108
+ const internalFiberId$1 = -1;
1109
+ const isInternalInterruption$1 = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has$1(internalFiberId$1)));
1110
1110
  const setUnsafe$2 = /* @__PURE__ */ dual((args) => isFiberHandle(args[0]), (self2, fiber, options) => {
1111
1111
  if (self2.state._tag === "Closed") {
1112
- fiber.interruptUnsafe(internalFiberId$2);
1112
+ fiber.interruptUnsafe(internalFiberId$1);
1113
1113
  return;
1114
1114
  }
1115
1115
  const previous = self2.state.fiber;
@@ -1117,17 +1117,17 @@ const setUnsafe$2 = /* @__PURE__ */ dual((args) => isFiberHandle(args[0]), (self
1117
1117
  if (previous === fiber) {
1118
1118
  return;
1119
1119
  } else if (options?.onlyIfMissing === true) {
1120
- fiber.interruptUnsafe(internalFiberId$2);
1120
+ fiber.interruptUnsafe(internalFiberId$1);
1121
1121
  return;
1122
1122
  }
1123
1123
  }
1124
1124
  self2.state.fiber = fiber;
1125
- previous?.interruptUnsafe(internalFiberId$2);
1125
+ previous?.interruptUnsafe(internalFiberId$1);
1126
1126
  fiber.addObserver((exit2) => {
1127
1127
  if (self2.state._tag === "Open" && fiber === self2.state.fiber) {
1128
1128
  self2.state.fiber = void 0;
1129
1129
  }
1130
- if (isFailure$1(exit2) && (options?.propagateInterruption === true ? !isInternalInterruption$2(exit2.cause) : !hasInterruptsOnly(exit2.cause))) {
1130
+ if (isFailure$1(exit2) && (options?.propagateInterruption === true ? !isInternalInterruption$1(exit2.cause) : !hasInterruptsOnly(exit2.cause))) {
1131
1131
  doneUnsafe(self2.deferred, exit2);
1132
1132
  }
1133
1133
  });
@@ -1137,13 +1137,13 @@ const clear$1 = (self2) => uninterruptibleMask((restore) => {
1137
1137
  return void_;
1138
1138
  }
1139
1139
  const fiber = self2.state.fiber;
1140
- return andThen(restore(interruptAs(fiber, internalFiberId$2)), sync(() => {
1140
+ return andThen(restore(interruptAs(fiber, internalFiberId$1)), sync(() => {
1141
1141
  if (self2.state._tag === "Open" && self2.state.fiber === fiber) {
1142
1142
  self2.state.fiber = void 0;
1143
1143
  }
1144
1144
  }));
1145
1145
  });
1146
- const constInterruptedFiber$2 = /* @__PURE__ */ (function() {
1146
+ const constInterruptedFiber$1 = /* @__PURE__ */ (function() {
1147
1147
  let fiber = void 0;
1148
1148
  return () => {
1149
1149
  if (fiber === void 0) {
@@ -1152,28 +1152,28 @@ const constInterruptedFiber$2 = /* @__PURE__ */ (function() {
1152
1152
  return fiber;
1153
1153
  };
1154
1154
  })();
1155
- const run$5 = function() {
1155
+ const run$4 = function() {
1156
1156
  const self2 = arguments[0];
1157
1157
  if (isEffect(arguments[1])) {
1158
- return runImpl$2(self2, arguments[1], arguments[2]);
1158
+ return runImpl$1(self2, arguments[1], arguments[2]);
1159
1159
  }
1160
1160
  const options = arguments[1];
1161
- return (effect2) => runImpl$2(self2, effect2, options);
1161
+ return (effect2) => runImpl$1(self2, effect2, options);
1162
1162
  };
1163
- const runImpl$2 = (self2, effect2, options) => withFiber((parent) => {
1163
+ const runImpl$1 = (self2, effect2, options) => withFiber((parent) => {
1164
1164
  if (self2.state._tag === "Closed") {
1165
1165
  return interrupt;
1166
1166
  } else if (self2.state.fiber !== void 0 && options?.onlyIfMissing === true) {
1167
- return sync(constInterruptedFiber$2);
1167
+ return sync(constInterruptedFiber$1);
1168
1168
  }
1169
1169
  const fiber = forkUnsafe(parent, effect2, options?.startImmediately ?? true, true);
1170
1170
  setUnsafe$2(self2, fiber, options);
1171
1171
  return succeed$2(fiber);
1172
1172
  });
1173
- const TypeId$m = "~effect/FiberMap";
1174
- const isFiberMap = (u) => hasProperty(u, TypeId$m);
1175
- const Proto$8 = {
1176
- [TypeId$m]: TypeId$m,
1173
+ const TypeId$l = "~effect/FiberMap";
1174
+ const isFiberMap = (u) => hasProperty(u, TypeId$l);
1175
+ const Proto$7 = {
1176
+ [TypeId$l]: TypeId$l,
1177
1177
  [Symbol.iterator]() {
1178
1178
  if (this.state._tag === "Closed") {
1179
1179
  return empty$5();
@@ -1188,8 +1188,8 @@ const Proto$8 = {
1188
1188
  };
1189
1189
  }
1190
1190
  };
1191
- const makeUnsafe$2 = (backing, deferred) => {
1192
- const self2 = Object.create(Proto$8);
1191
+ const makeUnsafe$1 = (backing, deferred) => {
1192
+ const self2 = Object.create(Proto$7);
1193
1193
  self2.state = {
1194
1194
  _tag: "Open",
1195
1195
  backing
@@ -1197,7 +1197,7 @@ const makeUnsafe$2 = (backing, deferred) => {
1197
1197
  self2.deferred = deferred;
1198
1198
  return self2;
1199
1199
  };
1200
- const make$1k = () => acquireRelease(sync(() => makeUnsafe$2(empty$4(), makeUnsafe$6())), (map2) => suspend(() => {
1200
+ const make$1i = () => acquireRelease(sync(() => makeUnsafe$1(empty$4(), makeUnsafe$5())), (map2) => suspend(() => {
1201
1201
  const state = map2.state;
1202
1202
  if (state._tag === "Closed") return void_;
1203
1203
  map2.state = {
@@ -1205,11 +1205,11 @@ const make$1k = () => acquireRelease(sync(() => makeUnsafe$2(empty$4(), makeUnsa
1205
1205
  };
1206
1206
  return interruptAll(values(state.backing)).pipe(into(map2.deferred));
1207
1207
  }));
1208
- const internalFiberId$1 = -1;
1209
- const isInternalInterruption$1 = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has$1(internalFiberId$1)));
1208
+ const internalFiberId = -1;
1209
+ const isInternalInterruption = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has$1(internalFiberId)));
1210
1210
  const setUnsafe$1 = /* @__PURE__ */ dual((args) => isFiberMap(args[0]), (self2, key2, fiber, options) => {
1211
1211
  if (self2.state._tag === "Closed") {
1212
- fiber.interruptUnsafe(internalFiberId$1);
1212
+ fiber.interruptUnsafe(internalFiberId);
1213
1213
  return;
1214
1214
  }
1215
1215
  const previous = get$5(self2.state.backing, key2);
@@ -1217,13 +1217,13 @@ const setUnsafe$1 = /* @__PURE__ */ dual((args) => isFiberMap(args[0]), (self2,
1217
1217
  if (previous.value === fiber) {
1218
1218
  return;
1219
1219
  } else if (options?.onlyIfMissing === true) {
1220
- fiber.interruptUnsafe(internalFiberId$1);
1220
+ fiber.interruptUnsafe(internalFiberId);
1221
1221
  return;
1222
1222
  }
1223
1223
  }
1224
1224
  set$2(self2.state.backing, key2, fiber);
1225
1225
  if (previous._tag === "Some") {
1226
- previous.value.interruptUnsafe(internalFiberId$1);
1226
+ previous.value.interruptUnsafe(internalFiberId);
1227
1227
  }
1228
1228
  fiber.addObserver((exit2) => {
1229
1229
  if (self2.state._tag === "Closed") {
@@ -1233,7 +1233,7 @@ const setUnsafe$1 = /* @__PURE__ */ dual((args) => isFiberMap(args[0]), (self2,
1233
1233
  if (isSome(current) && fiber === current.value) {
1234
1234
  remove$3(self2.state.backing, key2);
1235
1235
  }
1236
- if (isFailure$1(exit2) && (options?.propagateInterruption === true ? !isInternalInterruption$1(exit2.cause) : !hasInterruptsOnly(exit2.cause))) {
1236
+ if (isFailure$1(exit2) && (options?.propagateInterruption === true ? !isInternalInterruption(exit2.cause) : !hasInterruptsOnly(exit2.cause))) {
1237
1237
  doneUnsafe(self2.deferred, exit2);
1238
1238
  }
1239
1239
  });
@@ -1251,15 +1251,15 @@ const remove$1 = /* @__PURE__ */ dual(2, (self2, key2) => suspend(() => {
1251
1251
  if (fiber._tag === "None") {
1252
1252
  return void_;
1253
1253
  }
1254
- return interruptAs(fiber.value, internalFiberId$1);
1254
+ return interruptAs(fiber.value, internalFiberId);
1255
1255
  }));
1256
1256
  const clear = (self2) => suspend(() => {
1257
1257
  if (self2.state._tag === "Closed") {
1258
1258
  return void_;
1259
1259
  }
1260
- return interruptAllAs(values(self2.state.backing), internalFiberId$1);
1260
+ return interruptAllAs(values(self2.state.backing), internalFiberId);
1261
1261
  });
1262
- const constInterruptedFiber$1 = /* @__PURE__ */ (function() {
1262
+ const constInterruptedFiber = /* @__PURE__ */ (function() {
1263
1263
  let fiber = void 0;
1264
1264
  return () => {
1265
1265
  if (fiber === void 0) {
@@ -1268,111 +1268,30 @@ const constInterruptedFiber$1 = /* @__PURE__ */ (function() {
1268
1268
  return fiber;
1269
1269
  };
1270
1270
  })();
1271
- const run$4 = function() {
1271
+ const run$3 = function() {
1272
1272
  const self2 = arguments[0];
1273
1273
  if (isEffect(arguments[2])) {
1274
- return runImpl$1(self2, arguments[1], arguments[2], arguments[3]);
1274
+ return runImpl(self2, arguments[1], arguments[2], arguments[3]);
1275
1275
  }
1276
1276
  const key2 = arguments[1];
1277
1277
  const options = arguments[2];
1278
- return (effect2) => runImpl$1(self2, key2, effect2, options);
1278
+ return (effect2) => runImpl(self2, key2, effect2, options);
1279
1279
  };
1280
- const runImpl$1 = (self2, key2, effect2, options) => withFiber((parent) => {
1280
+ const runImpl = (self2, key2, effect2, options) => withFiber((parent) => {
1281
1281
  if (self2.state._tag === "Closed") {
1282
1282
  return interrupt;
1283
1283
  } else if (options?.onlyIfMissing === true && hasUnsafe(self2, key2)) {
1284
- return sync(constInterruptedFiber$1);
1285
- }
1286
- const fiber = forkUnsafe(parent, effect2, options?.startImmediately ?? true, true);
1287
- setUnsafe$1(self2, key2, fiber, options);
1288
- return succeed$2(fiber);
1289
- });
1290
- const TypeId$l = "~effect/FiberSet";
1291
- const isFiberSet = (u) => hasProperty(u, TypeId$l);
1292
- const Proto$7 = {
1293
- [TypeId$l]: TypeId$l,
1294
- [Symbol.iterator]() {
1295
- if (this.state._tag === "Closed") {
1296
- return empty$5();
1297
- }
1298
- return this.state.backing[Symbol.iterator]();
1299
- },
1300
- ...PipeInspectableProto,
1301
- toJSON() {
1302
- return {
1303
- _id: "FiberSet",
1304
- state: this.state
1305
- };
1306
- }
1307
- };
1308
- const makeUnsafe$1 = (backing, deferred) => {
1309
- const self2 = Object.create(Proto$7);
1310
- self2.state = {
1311
- _tag: "Open",
1312
- backing
1313
- };
1314
- self2.deferred = deferred;
1315
- return self2;
1316
- };
1317
- const make$1j = () => acquireRelease(sync(() => makeUnsafe$1(/* @__PURE__ */ new Set(), makeUnsafe$6())), (set2) => suspend(() => {
1318
- const state = set2.state;
1319
- if (state._tag === "Closed") return void_;
1320
- set2.state = {
1321
- _tag: "Closed"
1322
- };
1323
- const fibers = state.backing;
1324
- return interruptAll(fibers).pipe(into(set2.deferred));
1325
- }));
1326
- const internalFiberId = -1;
1327
- const isInternalInterruption = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has$1(internalFiberId)));
1328
- const addUnsafe = /* @__PURE__ */ dual((args) => isFiberSet(args[0]), (self2, fiber, options) => {
1329
- if (self2.state._tag === "Closed") {
1330
- fiber.interruptUnsafe(internalFiberId);
1331
- return;
1332
- } else if (self2.state.backing.has(fiber)) {
1333
- return;
1334
- }
1335
- self2.state.backing.add(fiber);
1336
- fiber.addObserver((exit2) => {
1337
- if (self2.state._tag === "Closed") {
1338
- return;
1339
- }
1340
- self2.state.backing.delete(fiber);
1341
- if (isFailure$1(exit2) && (options?.propagateInterruption === true ? !isInternalInterruption(exit2.cause) : !hasInterruptsOnly(exit2.cause))) {
1342
- doneUnsafe(self2.deferred, exit2);
1343
- }
1344
- });
1345
- });
1346
- const constInterruptedFiber = /* @__PURE__ */ (function() {
1347
- let fiber = void 0;
1348
- return () => {
1349
- if (fiber === void 0) {
1350
- fiber = runFork(interrupt);
1351
- }
1352
- return fiber;
1353
- };
1354
- })();
1355
- const run$3 = function() {
1356
- const self2 = arguments[0];
1357
- if (!isEffect(arguments[1])) {
1358
- const options = arguments[1];
1359
- return (effect2) => runImpl(self2, effect2, options);
1360
- }
1361
- return runImpl(self2, arguments[1], arguments[2]);
1362
- };
1363
- const runImpl = (self2, effect2, options) => withFiber((parent) => {
1364
- if (self2.state._tag === "Closed") {
1365
1284
  return sync(constInterruptedFiber);
1366
1285
  }
1367
1286
  const fiber = forkUnsafe(parent, effect2, options?.startImmediately ?? true, true);
1368
- addUnsafe(self2, fiber, options);
1287
+ setUnsafe$1(self2, key2, fiber, options);
1369
1288
  return succeed$2(fiber);
1370
1289
  });
1371
1290
  const symbol$1 = "~effect/PrimaryKey";
1372
1291
  const TypeId$k = "~effect/ManagedRuntime";
1373
- const make$1i = (layer2, options) => {
1292
+ const make$1h = (layer2, options) => {
1374
1293
  const memoMap = makeMemoMapUnsafe();
1375
- const scope2 = makeUnsafe$5("sequential");
1294
+ const scope2 = makeUnsafe$4("sequential");
1376
1295
  const layerScope = forkUnsafe$1(scope2, "sequential");
1377
1296
  const fiberScope = forkUnsafe$1(scope2, "parallel");
1378
1297
  const defaultRunOptions = {
@@ -1595,7 +1514,7 @@ const is = is$1;
1595
1514
  const exhaustive = exhaustive$1;
1596
1515
  const TypeId$i = "~effect/reactivity/Reactivity";
1597
1516
  const Reactivity = /* @__PURE__ */ Service$1("effect/reactivity/Reactivity");
1598
- const make$1h = /* @__PURE__ */ sync(() => {
1517
+ const make$1g = /* @__PURE__ */ sync(() => {
1599
1518
  const handlers2 = /* @__PURE__ */ new Map();
1600
1519
  const invalidateUnsafe = (keys2) => {
1601
1520
  keysToHashes(keys2, (hash2) => {
@@ -1641,7 +1560,7 @@ const make$1h = /* @__PURE__ */ sync(() => {
1641
1560
  const query = (keys2, effect2) => gen(function* () {
1642
1561
  const services = yield* context();
1643
1562
  const scope2 = get$6(services, Scope);
1644
- const results = yield* make$1r();
1563
+ const results = yield* make$1p();
1645
1564
  const runFork2 = flow$1(runForkWith(services), runIn(scope2));
1646
1565
  let running2 = false;
1647
1566
  let pending = false;
@@ -1695,7 +1614,7 @@ const make$1h = /* @__PURE__ */ sync(() => {
1695
1614
  });
1696
1615
  class PendingInvalidation extends (/* @__PURE__ */ Service$1()("effect/reactivity/Reactivity/PendingInvalidation")) {
1697
1616
  }
1698
- const layer$Z = /* @__PURE__ */ effect(Reactivity)(make$1h);
1617
+ const layer$W = /* @__PURE__ */ effect(Reactivity)(make$1g);
1699
1618
  function stringOrHash(u) {
1700
1619
  switch (typeof u) {
1701
1620
  case "string":
@@ -2138,7 +2057,7 @@ const recordUpdateHelperSingle = (value2, omit2) => Object.assign(Object.create(
2138
2057
  omit: omit2,
2139
2058
  returningIdentifier: void 0
2140
2059
  });
2141
- const make$1g = (acquirer, compiler, spanAttributes2, transformRows, borrower) => {
2060
+ const make$1f = (acquirer, compiler, spanAttributes2, transformRows, borrower) => {
2142
2061
  const cache2 = transformRows === void 0 ? constructorCache.noTransforms : constructorCache.transforms;
2143
2062
  if (cache2.has(acquirer)) {
2144
2063
  return cache2.get(acquirer);
@@ -2613,7 +2532,7 @@ const withStatement = (self2, span, f) => withFiber((fiber) => {
2613
2532
  if (transform2 === void 0) {
2614
2533
  return f(self2, fiber);
2615
2534
  }
2616
- return flatMap(transform2(self2, make$1g(self2.acquirer, self2.compiler, self2.spanAttributes, self2.transformRows, self2.borrower), fiber, span), (statement2) => f(statement2, fiber));
2535
+ return flatMap(transform2(self2, make$1f(self2.acquirer, self2.compiler, self2.spanAttributes, self2.transformRows, self2.borrower), fiber, span), (statement2) => f(statement2, fiber));
2617
2536
  });
2618
2537
  const isSegment = (u) => {
2619
2538
  if (!hasProperty(u, "_tag")) {
@@ -2688,7 +2607,7 @@ const TypeId$g = "~effect/sql/SqlClient";
2688
2607
  const SqlClient = /* @__PURE__ */ Service$1("effect/sql/SqlClient");
2689
2608
  let clientIdCounter$1 = 0;
2690
2609
  let transactionSemaphoreIdCounter = 0;
2691
- const make$1f = /* @__PURE__ */ fnUntraced(function* (options) {
2610
+ const make$1e = /* @__PURE__ */ fnUntraced(function* (options) {
2692
2611
  const transactionService = options.transactionService ?? TransactionConnection(clientIdCounter$1++);
2693
2612
  const getConnection = flatMap(serviceOption(transactionService), match({
2694
2613
  onNone: () => options.acquirer,
@@ -2705,7 +2624,7 @@ const make$1f = /* @__PURE__ */ fnUntraced(function* (options) {
2705
2624
  const withTransaction = makeWithTransaction({
2706
2625
  transactionService,
2707
2626
  spanAttributes: options.spanAttributes,
2708
- acquireConnection: flatMap(make$1s(), (scope2) => provide$1(transactionAcquirer, scope2).pipe(onError((cause) => close(scope2, failCause$1(cause))), map$2((conn) => [scope2, conn]))),
2627
+ acquireConnection: flatMap(make$1q(), (scope2) => provide$1(transactionAcquirer, scope2).pipe(onError((cause) => close(scope2, failCause$1(cause))), map$2((conn) => [scope2, conn]))),
2709
2628
  begin: (conn) => control(conn, beginTransaction),
2710
2629
  savepoint: (conn, id2) => control(conn, savepoint(`effect_sql_${id2}`)),
2711
2630
  releaseSavepoint: releaseSavepoint ? (conn, id2) => control(conn, releaseSavepoint(`effect_sql_${id2}`)) : void 0,
@@ -2719,7 +2638,7 @@ const make$1f = /* @__PURE__ */ fnUntraced(function* (options) {
2719
2638
  onNone: () => options.borrower(f),
2720
2639
  onSome: ([conn]) => f(conn)
2721
2640
  }));
2722
- const client2 = Object.assign(make$1g(getConnection, options.compiler, options.spanAttributes, options.transformRows, borrower), {
2641
+ const client2 = Object.assign(make$1f(getConnection, options.compiler, options.spanAttributes, options.transformRows, borrower), {
2723
2642
  [TypeId$g]: TypeId$g,
2724
2643
  safe: void 0,
2725
2644
  withTransaction,
@@ -2729,7 +2648,7 @@ const make$1f = /* @__PURE__ */ fnUntraced(function* (options) {
2729
2648
  if (options.transformRows === void 0) {
2730
2649
  return this;
2731
2650
  }
2732
- const statement2 = make$1g(getConnection, options.compiler.withoutTransform, options.spanAttributes, void 0, borrower);
2651
+ const statement2 = make$1f(getConnection, options.compiler.withoutTransform, options.spanAttributes, void 0, borrower);
2733
2652
  const client3 = Object.assign(statement2, {
2734
2653
  ...this,
2735
2654
  ...statement2
@@ -2799,7 +2718,7 @@ const makeWithTransaction = (options) => {
2799
2718
  const connOption = getOption(services, options.transactionService);
2800
2719
  const conn = connOption._tag === "Some" ? succeed$2([void 0, connOption.value[0]]) : options.acquireConnection;
2801
2720
  const id2 = connOption._tag === "Some" ? connOption.value[1] + 1 : 0;
2802
- const transaction = flatMap(conn, ([scope2, conn2]) => (id2 === 0 ? options.begin(conn2) : options.savepoint(conn2, id2)).pipe(flatMap(() => onExitPrimitive(provideContext(restore(effect2), services.pipe(add$1(options.transactionService, [conn2, id2]), add$1(transactionSemaphore, makeUnsafe$8(1)), add$1(ParentSpan, span))), (exit2) => {
2721
+ const transaction = flatMap(conn, ([scope2, conn2]) => (id2 === 0 ? options.begin(conn2) : options.savepoint(conn2, id2)).pipe(flatMap(() => onExitPrimitive(provideContext(restore(effect2), services.pipe(add$1(options.transactionService, [conn2, id2]), add$1(transactionSemaphore, makeUnsafe$7(1)), add$1(ParentSpan, span))), (exit2) => {
2803
2722
  let effect3;
2804
2723
  if (isSuccess$2(exit2)) {
2805
2724
  if (id2 === 0) {
@@ -2850,7 +2769,7 @@ const makeWith = (options) => {
2850
2769
  };
2851
2770
  const defaultKeyObject = {};
2852
2771
  const defaultKey = (_request) => defaultKeyObject;
2853
- const make$1e = (runAll) => makeWith({
2772
+ const make$1d = (runAll) => makeWith({
2854
2773
  batchKey: defaultKey,
2855
2774
  delay: yieldNow,
2856
2775
  collectWhile: constTrue,
@@ -2880,11 +2799,11 @@ const Proto$6 = {
2880
2799
  };
2881
2800
  }
2882
2801
  };
2883
- const make$1d = (value2) => map$2(unbounded({
2802
+ const make$1c = (value2) => map$2(unbounded({
2884
2803
  replay: 1
2885
2804
  }), (pubsub) => {
2886
2805
  const self2 = Object.create(Proto$6);
2887
- self2.semaphore = makeUnsafe$8(1);
2806
+ self2.semaphore = makeUnsafe$7(1);
2888
2807
  self2.value = value2;
2889
2808
  self2.pubsub = pubsub;
2890
2809
  publishUnsafe(self2.pubsub, value2);
@@ -7820,7 +7739,7 @@ const nowIso = map$2(now, formatIso);
7820
7739
  });
7821
7740
  class MigrationError extends (/* @__PURE__ */ TaggedError("MigrationError")) {
7822
7741
  }
7823
- const make$1c = ({
7742
+ const make$1b = ({
7824
7743
  dumpSchema = () => void_
7825
7744
  }) => ({
7826
7745
  loader,
@@ -7931,7 +7850,7 @@ const migrationsTableExists = (sql, table) => {
7931
7850
  const quotedTable = sql`${sql(table)}`.compile(true)[0];
7932
7851
  return map$2(sql`SELECT 1 AS found WHERE to_regclass(${quotedTable}) IS NOT NULL`.withoutTransform, (rows) => rows.length > 0);
7933
7852
  };
7934
- const migrationOrder = /* @__PURE__ */ make$1t(([a], [b]) => Number$1(a, b));
7853
+ const migrationOrder = /* @__PURE__ */ make$1r(([a], [b]) => Number$1(a, b));
7935
7854
  const isConstraintConflict = (error2) => error2.reason._tag === "ConstraintError" || error2.reason._tag === "UniqueViolation";
7936
7855
  const fromRecord = (migrations) => pipe$2(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$3(([key2, id2, name]) => [Number(id2), name, succeed$2(migrations[key2])]), sort(migrationOrder), succeed$2);
7937
7856
  const findAll = (options) => {
@@ -8368,7 +8287,7 @@ const kill = (pid) => gen(function* () {
8368
8287
  }
8369
8288
  yield* terminate(pid);
8370
8289
  });
8371
- const make$1b = gen(function* () {
8290
+ const make$1a = gen(function* () {
8372
8291
  const activeWorkspace = yield* makeActiveWorkspace;
8373
8292
  const listListening = (threadId, workspaceCwd, fresh) => gen(function* () {
8374
8293
  const workspacePath = workspaceCwd === null ? null : yield* promise$1(() => realpath(workspaceCwd).catch(() => workspaceCwd));
@@ -8398,7 +8317,7 @@ const make$1b = gen(function* () {
8398
8317
  );
8399
8318
  return Ports.of({ listForThread, kill, closeThread });
8400
8319
  });
8401
- const layer$Y = effect(Ports, make$1b);
8320
+ const layer$V = effect(Ports, make$1a);
8402
8321
  const noTokens = { inputTokens: 0, cacheWriteTokens: 0, cacheReadTokens: 0, outputTokens: 0 };
8403
8322
  const addTokens = (a, b) => ({
8404
8323
  inputTokens: a.inputTokens + b.inputTokens,
@@ -8474,7 +8393,7 @@ function makeApprovals(provider, emit) {
8474
8393
  }
8475
8394
  if (session.turn === null) return { behavior: "deny", message: "No active turn to approve this tool call" };
8476
8395
  const requestId = randomUUID();
8477
- const deferred = makeUnsafe$6();
8396
+ const deferred = makeUnsafe$5();
8478
8397
  pending.set(requestId, { session, scope: scope2, deferred });
8479
8398
  const onAbort = () => doneUnsafe(deferred, succeed$2({ decision: "deny" }));
8480
8399
  options.signal.addEventListener("abort", onAbort, { once: true });
@@ -44480,7 +44399,7 @@ function makeQuestions(provider, emit) {
44480
44399
  const decoded = decodeInput(input);
44481
44400
  if (isNone(decoded)) return { behavior: "deny", message: "HinaCode could not read these questions" };
44482
44401
  const requestId = randomUUID();
44483
- const deferred = makeUnsafe$6();
44402
+ const deferred = makeUnsafe$5();
44484
44403
  pending.set(requestId, deferred);
44485
44404
  const onAbort = () => doneUnsafe(deferred, succeed$2({}));
44486
44405
  options.signal.addEventListener("abort", onAbort, { once: true });
@@ -45040,7 +44959,10 @@ const toContextBreakdown = (usage2) => ({
45040
44959
  ({ name, tokens, kind }) => kind === "deferred" || tokens === 0 ? [] : [{ name, tokens, kind }]
45041
44960
  )
45042
44961
  });
44962
+ const BYPASS_REFUSED = "Claude Code refused full access because its settings set disableBypassPermissionsMode. Switch this thread to Auto or Supervised.";
44963
+ const refusedBypass = (session, reported) => session.unconfirmedLaunchMode === "bypassPermissions" && reported !== "bypassPermissions" && reported !== session.permissionMode;
45043
44964
  const isIdle$1 = (session) => session.turn === null && session.claims === 0 && session.unanswered.size === 0 && session.tasks.size === 0;
44965
+ const hasBackgroundWork = (session) => session.tasks.size > 0 || session.wakeup !== null;
45044
44966
  const startsByItself = (session, message2) => message2.type === "system" && message2.subtype === "session_state_changed" && message2.state === "running" && session.turn === null;
45045
44967
  const awaitsAnswer = (session) => [...session.turnPrompts].some((uuid2) => session.unanswered.has(uuid2));
45046
44968
  const externalServices = {
@@ -45229,7 +45151,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
45229
45151
  const sessionLocks = /* @__PURE__ */ new Map();
45230
45152
  const wakes = yield* unbounded$1();
45231
45153
  const backgroundTaskChanges = yield* unbounded$1();
45232
- const probedCommands = yield* make$1m({
45154
+ const probedCommands = yield* make$1k({
45233
45155
  lookup: probeCommands,
45234
45156
  capacity: 32,
45235
45157
  timeToLive: minutes(1)
@@ -45377,6 +45299,13 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
45377
45299
  } else if (stale) return;
45378
45300
  if (message2.type === "assistant" && message2.parent_tool_use_id === null) session.lastAssistantUuid = message2.uuid;
45379
45301
  if (message2.type === "system" && message2.subtype === "init") {
45302
+ const refused = refusedBypass(session, message2.permissionMode);
45303
+ session.unconfirmedLaunchMode = null;
45304
+ if (refused) {
45305
+ emit(session, { type: "turn_failed", message: BYPASS_REFUSED });
45306
+ closeSessionUnsafe(session);
45307
+ return;
45308
+ }
45380
45309
  session.sessionId = message2.session_id;
45381
45310
  resumable.set(session.threadId, {
45382
45311
  cwd: session.cwd,
@@ -45437,7 +45366,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
45437
45366
  const prompts = yield* unbounded$1();
45438
45367
  const abort = new AbortController();
45439
45368
  const stderr = { text: "" };
45440
- const stderrDrained = yield* make$1u();
45369
+ const stderrDrained = yield* make$1s();
45441
45370
  const markStderrDrained = () => runSync(succeed$3(stderrDrained, void 0));
45442
45371
  const previous = resumable.get(input.threadId);
45443
45372
  const resume = input.resumeSessionId ?? previous?.sessionId;
@@ -45506,6 +45435,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
45506
45435
  launch: launch2,
45507
45436
  settingsFile,
45508
45437
  permissionMode: mode2,
45438
+ unconfirmedLaunchMode: mode2,
45509
45439
  prompts,
45510
45440
  abort,
45511
45441
  stderr,
@@ -45544,15 +45474,26 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
45544
45474
  });
45545
45475
  const lockedSession = (threadId) => (effect2) => {
45546
45476
  let lock = sessionLocks.get(threadId);
45547
- if (lock === void 0) sessionLocks.set(threadId, lock = makeUnsafe$8(1));
45477
+ if (lock === void 0) sessionLocks.set(threadId, lock = makeUnsafe$7(1));
45548
45478
  return withPermit(lock, effect2);
45549
45479
  };
45480
+ const backgroundWorkBlocksRestart = (session) => {
45481
+ const labels = [...session.backgroundTasks, ...session.wakeup === null ? [] : [session.wakeup]].map(
45482
+ (task) => task.label
45483
+ );
45484
+ const running2 = labels.length > 0 ? labels.join(", ") : "background work";
45485
+ return new AgentError({
45486
+ provider: id2,
45487
+ message: `This change restarts Claude Code, which would stop ${running2}. Stop the background work on this thread first, or wait for it to finish.`
45488
+ });
45489
+ };
45550
45490
  const reuseOrStartSession = (input, mode2) => gen(function* () {
45551
45491
  const launch2 = yield* launchEnv(input);
45552
45492
  const existing2 = sessions.get(input.threadId);
45553
45493
  if (existing2 !== void 0) {
45554
45494
  if (sameContext(existing2, input) && sameLaunch(existing2.launch, launch2) && existing2.autoCompactTokens === input.autoCompactTokens)
45555
45495
  return claim2(existing2);
45496
+ if (hasBackgroundWork(existing2)) return yield* backgroundWorkBlocksRestart(existing2);
45556
45497
  yield* closeSession(existing2);
45557
45498
  }
45558
45499
  return yield* startSession(input, mode2, launch2);
@@ -45763,7 +45704,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
45763
45704
  };
45764
45705
  return provider;
45765
45706
  });
45766
- const layer$X = effect(
45707
+ const layer$U = effect(
45767
45708
  ClaudeProvider,
45768
45709
  gen(function* () {
45769
45710
  const cachedModels = yield* cachedWithTTL(
@@ -55922,7 +55863,7 @@ const playedSteps = {
55922
55863
  whiteboard: (prompt) => [...whiteboardSteps(prompt), finished()]
55923
55864
  };
55924
55865
  const awaitReply = (replies, id2) => {
55925
- const pending = makeUnsafe$6();
55866
+ const pending = makeUnsafe$5();
55926
55867
  replies.set(id2, pending);
55927
55868
  return _await(pending);
55928
55869
  };
@@ -56004,7 +55945,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
56004
55945
  answer: (request2) => awaitReply(questionReplies, request2.id),
56005
55946
  callTool: (name, args) => callMcpTool(input.mcpServer, name, args)
56006
55947
  });
56007
- return concat(make$1v(bound), played);
55948
+ return concat(make$1t(bound), played);
56008
55949
  }
56009
55950
  switch (scenario) {
56010
55951
  case "usage-limit":
@@ -56026,7 +55967,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
56026
55967
  concat(
56027
55968
  merge$4(progress, fromQueue(pushed)).pipe(interruptWhen(_await(stop)))
56028
55969
  ),
56029
- concat(make$1v(interrupted))
55970
+ concat(make$1t(interrupted))
56030
55971
  );
56031
55972
  })
56032
55973
  );
@@ -56038,7 +55979,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
56038
55979
  );
56039
55980
  return fromIterable$2(longTurn()).pipe(
56040
55981
  concat(streaming),
56041
- concat(make$1v(interrupted))
55982
+ concat(make$1t(interrupted))
56042
55983
  );
56043
55984
  }
56044
55985
  case "artifacts": {
@@ -56050,7 +55991,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
56050
55991
  (id2) => artifacts.set(input.threadId, id2)
56051
55992
  );
56052
55993
  const bound = { type: "session_bound", providerSessionId: `mock-artifacts-${input.threadId}` };
56053
- return concat(make$1v(bound, started), fromIterableEffect(published));
55994
+ return concat(make$1t(bound, started), fromIterableEffect(published));
56054
55995
  }
56055
55996
  case "documents": {
56056
55997
  const { started, finished: published } = documentTurn(
@@ -56061,7 +56002,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
56061
56002
  (document2) => documents.set(input.threadId, document2)
56062
56003
  );
56063
56004
  const bound = { type: "session_bound", providerSessionId: `mock-documents-${input.threadId}` };
56064
- return concat(make$1v(bound, started), fromIterableEffect(published));
56005
+ return concat(make$1t(bound, started), fromIterableEffect(published));
56065
56006
  }
56066
56007
  case "markdown":
56067
56008
  return fromIterable$2(markdownTurn());
@@ -56099,7 +56040,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
56099
56040
  copySession: () => void_,
56100
56041
  listCommands: () => succeed$2(commands),
56101
56042
  runTurn: (input) => suspend$1(() => {
56102
- const stop = makeUnsafe$6();
56043
+ const stop = makeUnsafe$5();
56103
56044
  stopped.set(input.threadId, stop);
56104
56045
  return runScenario(scenarioOf(input.prompt, defaultScenario), input, stop);
56105
56046
  }),
@@ -56221,7 +56162,7 @@ const makeCodexClient = (options) => gen(function* () {
56221
56162
  const request2 = (method2, params2, timeout2 = REQUEST_TIMEOUT$2) => suspend(() => {
56222
56163
  if (exitError !== void 0) return fail$2(exitError);
56223
56164
  const id2 = nextId++;
56224
- const deferred = makeUnsafe$6();
56165
+ const deferred = makeUnsafe$5();
56225
56166
  pending.set(id2, deferred);
56226
56167
  write({ method: method2, id: id2, params: params2 });
56227
56168
  return _await(deferred).pipe(
@@ -56756,9 +56697,9 @@ const copySession = (threadId, from, to) => tryPromise({
56756
56697
  const interruptedEvent$2 = { type: "turn_failed", message: "Turn interrupted" };
56757
56698
  const TERMINAL_POLL_INTERVAL = seconds(2);
56758
56699
  const sameTasks = (a, b) => a.length === b.length && a.every((task, index) => task.id === b[index]?.id);
56759
- const make$1a = gen(function* () {
56700
+ const make$19 = gen(function* () {
56760
56701
  const providerScope = yield* scope$1;
56761
- const clientLock = yield* make$1w(1);
56702
+ const clientLock = yield* make$1u(1);
56762
56703
  const clients = /* @__PURE__ */ new Map();
56763
56704
  const getClient = (home) => withPermit(
56764
56705
  clientLock,
@@ -56768,7 +56709,7 @@ const make$1a = gen(function* () {
56768
56709
  if (current?.client.isAlive()) return current.client;
56769
56710
  if (current) yield* close(current.scope, void_$1);
56770
56711
  const binaryPath = yield* installedBinary("codex", home?.binary ?? "codex");
56771
- const scope2 = yield* make$1s();
56712
+ const scope2 = yield* make$1q();
56772
56713
  const env = home === null ? { ...process.env } : { ...process.env, CODEX_HOME: home.dir };
56773
56714
  const client2 = yield* makeCodexClient({
56774
56715
  binaryPath,
@@ -57027,7 +56968,7 @@ const make$1a = gen(function* () {
57027
56968
  const runTurn = (input) => callback$1(
57028
56969
  (out) => gen(function* () {
57029
56970
  const emit = (event) => offer(out, event);
57030
- const run2 = { stop: yield* make$1u() };
56971
+ const run2 = { stop: yield* make$1s() };
57031
56972
  runs.set(input.threadId, run2);
57032
56973
  yield* addFinalizer$1(
57033
56974
  () => sync(() => runs.get(input.threadId) === run2 && runs.delete(input.threadId))
@@ -57144,7 +57085,7 @@ const make$1a = gen(function* () {
57144
57085
  );
57145
57086
  const requestUserInput = (rpcId, params2) => gen(function* () {
57146
57087
  const questionId = randomUUID();
57147
- const answers = yield* make$1u();
57088
+ const answers = yield* make$1s();
57148
57089
  questions.set(questionId, answers);
57149
57090
  questionIdByRpcId.set(rpcId, questionId);
57150
57091
  yield* emit({
@@ -57189,7 +57130,7 @@ const make$1a = gen(function* () {
57189
57130
  });
57190
57131
  const requestMcpToolApproval = (rpcId, params2) => gen(function* () {
57191
57132
  const approvalId = randomUUID();
57192
- const decision = yield* make$1u();
57133
+ const decision = yield* make$1s();
57193
57134
  approvals2.set(approvalId, decision);
57194
57135
  approvalIdByRpcId.set(rpcId, approvalId);
57195
57136
  yield* emit({
@@ -57215,7 +57156,7 @@ const make$1a = gen(function* () {
57215
57156
  });
57216
57157
  const requestApproval = (rpcId, method2, params2) => gen(function* () {
57217
57158
  const approvalId = randomUUID();
57218
- const decision = yield* make$1u();
57159
+ const decision = yield* make$1s();
57219
57160
  approvals2.set(approvalId, decision);
57220
57161
  approvalIdByRpcId.set(rpcId, approvalId);
57221
57162
  const isCommand = method2 === "item/commandExecution/requestApproval";
@@ -57532,7 +57473,7 @@ const toPlanLimits$1 = (response2, readAt) => {
57532
57473
  return { windows: [...toLimitWindow(snapshot.primary), ...toLimitWindow(snapshot.secondary)], readAt };
57533
57474
  };
57534
57475
  class CodexProvider extends Service$1()("hinacode/CodexProvider") {
57535
- static layer = effect(CodexProvider, make$1a);
57476
+ static layer = effect(CodexProvider, make$19);
57536
57477
  }
57537
57478
  const toolNames$1 = {
57538
57479
  bash: "Bash",
@@ -58946,9 +58887,9 @@ const leaveSession = (host, sessionId) => gen(function* () {
58946
58887
  }),
58947
58888
  scoped
58948
58889
  );
58949
- const make$19 = gen(function* () {
58890
+ const make$18 = gen(function* () {
58950
58891
  const providerScope = yield* scope$1;
58951
- const hostLock = yield* make$1w(1);
58892
+ const hostLock = yield* make$1u(1);
58952
58893
  let current;
58953
58894
  let planUsage;
58954
58895
  const decodePlanUsage = decodeUnknownOption(SubscriptionUsage);
@@ -58988,7 +58929,7 @@ const make$19 = gen(function* () {
58988
58929
  if (current?.host.isAlive()) return current;
58989
58930
  if (current) yield* close(current.scope, void_$1);
58990
58931
  const binaryPath = yield* installedBinary("muse", "muse");
58991
- const scope2 = yield* make$1s();
58932
+ const scope2 = yield* make$1q();
58992
58933
  const host = yield* makeMuseHost({
58993
58934
  binaryPath,
58994
58935
  args: HOST_ARGS,
@@ -59020,7 +58961,7 @@ const make$19 = gen(function* () {
59020
58961
  const threadSessions = /* @__PURE__ */ new Map();
59021
58962
  const subagentsByThread = /* @__PURE__ */ new Map();
59022
58963
  const probeSessions = /* @__PURE__ */ new Map();
59023
- const probeLock = yield* make$1w(1);
58964
+ const probeLock = yield* make$1u(1);
59024
58965
  const runs = /* @__PURE__ */ new Map();
59025
58966
  const grants = /* @__PURE__ */ new Map();
59026
58967
  const wakes = yield* unbounded$1();
@@ -59266,7 +59207,7 @@ const make$19 = gen(function* () {
59266
59207
  return yield* decide(approval, "allow");
59267
59208
  }
59268
59209
  approval.presented = true;
59269
- const deferred = yield* make$1u();
59210
+ const deferred = yield* make$1s();
59270
59211
  approvals2.set(approval.id, { approval, deferred });
59271
59212
  yield* emit({
59272
59213
  type: "approval_requested",
@@ -59298,7 +59239,7 @@ const make$19 = gen(function* () {
59298
59239
  const requestQuestion = (params2) => gen(function* () {
59299
59240
  if (pendingQuestions.has(params2.userInputId)) return;
59300
59241
  const id2 = randomUUID();
59301
- const answers = yield* make$1u();
59242
+ const answers = yield* make$1s();
59302
59243
  questions.set(id2, answers);
59303
59244
  pendingQuestions.set(params2.userInputId, { id: id2, params: params2 });
59304
59245
  yield* emit({
@@ -59518,7 +59459,7 @@ const make$19 = gen(function* () {
59518
59459
  const turnStream = (threadId, follow) => callback$1(
59519
59460
  (out) => gen(function* () {
59520
59461
  const emit = (event) => offer(out, event);
59521
- const run2 = { stop: yield* make$1u(), ended: false };
59462
+ const run2 = { stop: yield* make$1s(), ended: false };
59522
59463
  runs.set(threadId, run2);
59523
59464
  yield* addFinalizer$1(() => sync(() => runs.get(threadId) === run2 && runs.delete(threadId)));
59524
59465
  const stopped = yield* raceFirst(
@@ -59681,7 +59622,7 @@ const make$19 = gen(function* () {
59681
59622
  };
59682
59623
  });
59683
59624
  class MuseProvider extends Service$1()("hinacode/MuseProvider") {
59684
- static layer = effect(MuseProvider, make$19);
59625
+ static layer = effect(MuseProvider, make$18);
59685
59626
  }
59686
59627
  const StoredSecret = fromJsonString(Struct({ encrypted: Boolean$1, value: String$1 }));
59687
59628
  const rowKey = (name) => `secret.${name}`;
@@ -59698,7 +59639,7 @@ const noKeyring = succeed$5(
59698
59639
  );
59699
59640
  class Secrets extends Service$1()("hinacode/Secrets") {
59700
59641
  }
59701
- const make$18 = gen(function* () {
59642
+ const make$17 = gen(function* () {
59702
59643
  const sql = yield* SqlClient;
59703
59644
  const keyring = yield* Keyring;
59704
59645
  let warnedPlaintext = false;
@@ -59749,7 +59690,7 @@ const make$18 = gen(function* () {
59749
59690
  )
59750
59691
  });
59751
59692
  });
59752
- const layer$W = effect(Secrets, make$18);
59693
+ const layer$T = effect(Secrets, make$17);
59753
59694
  const readJson = (path2) => try_$1({
59754
59695
  try: () => {
59755
59696
  if (!existsSync(path2)) return void 0;
@@ -59774,7 +59715,7 @@ const readObject = (path2) => flatMap(
59774
59715
  const broken = (error2) => logWarning(`${error2.message}, using defaults`, error2.cause);
59775
59716
  const makeSettingStore = (schema2, defaults2, { path: path2, own: own2 = {} }) => gen(function* () {
59776
59717
  const written = yield* unbounded();
59777
- const writes = yield* make$1w(1);
59718
+ const writes = yield* make$1u(1);
59778
59719
  const ownFiles = Object.entries(own2).filter((entry) => entry[1] !== void 0);
59779
59720
  const ownKeys = new Set(ownFiles.map(([key2]) => key2));
59780
59721
  const files = [path2, ...ownFiles.map(([, file]) => file)].join(" and ");
@@ -59841,7 +59782,7 @@ const stampLegacyVmProvider = (path2) => {
59841
59782
  return;
59842
59783
  }
59843
59784
  };
59844
- const layer$V = (dataDir) => effect(
59785
+ const layer$S = (dataDir) => effect(
59845
59786
  Settings$1,
59846
59787
  gen(function* () {
59847
59788
  const path2 = join$1(dataDir, "settings.json");
@@ -60431,7 +60372,7 @@ const makeAcpClient = (options) => gen(function* () {
60431
60372
  const request2 = (method2, params2, timeout2 = REQUEST_TIMEOUT) => suspend(() => {
60432
60373
  if (exitError !== void 0) return fail$2(exitError);
60433
60374
  const id2 = nextId++;
60434
- const answer = makeUnsafe$6();
60375
+ const answer = makeUnsafe$5();
60435
60376
  pending.set(id2, { method: method2, answer });
60436
60377
  write({ id: id2, method: method2, params: params2 });
60437
60378
  const awaited = _await(answer).pipe(onInterrupt(() => sync(() => pending.delete(id2))));
@@ -60684,7 +60625,7 @@ const makeAcpProvider = (config2) => gen(function* () {
60684
60625
  return yield* answerPermission(run2, requestId, optionFor("allow", params2.options));
60685
60626
  }
60686
60627
  const approvalId = randomUUID();
60687
- const decision = yield* make$1u();
60628
+ const decision = yield* make$1s();
60688
60629
  approvals2.set(approvalId, decision);
60689
60630
  run2.permissions.set(requestId, { approvalId, options: params2.options });
60690
60631
  yield* emit({
@@ -60733,7 +60674,7 @@ const makeAcpProvider = (config2) => gen(function* () {
60733
60674
  const turnStream = (threadId, follow) => callback$1(
60734
60675
  (out) => gen(function* () {
60735
60676
  const emit = (event) => offer(out, event);
60736
- const run2 = { stop: yield* make$1u(), permissions: /* @__PURE__ */ new Map(), prompting: false };
60677
+ const run2 = { stop: yield* make$1s(), permissions: /* @__PURE__ */ new Map(), prompting: false };
60737
60678
  runs.set(threadId, run2);
60738
60679
  yield* addFinalizer$1(
60739
60680
  () => cancelPermissions(run2).pipe(
@@ -60804,7 +60745,7 @@ const makeAcpProvider = (config2) => gen(function* () {
60804
60745
  })
60805
60746
  );
60806
60747
  let probedModels;
60807
- const probeLock = yield* make$1w(1);
60748
+ const probeLock = yield* make$1u(1);
60808
60749
  const listModels = withPermit(
60809
60750
  probeLock,
60810
60751
  gen(function* () {
@@ -60825,7 +60766,7 @@ const makeAcpProvider = (config2) => gen(function* () {
60825
60766
  );
60826
60767
  const probeCommands2 = (cwd) => gen(function* () {
60827
60768
  const { client: client2 } = yield* startAgent;
60828
- const announced = yield* make$1u();
60769
+ const announced = yield* make$1s();
60829
60770
  yield* client2.subscribe((message2) => {
60830
60771
  const update2 = commandsOf(message2);
60831
60772
  if (update2 !== void 0) doneUnsafe(announced, succeed$2(update2));
@@ -60835,7 +60776,7 @@ const makeAcpProvider = (config2) => gen(function* () {
60835
60776
  timeoutOrElse({ duration: COMMANDS_WAIT, orElse: () => succeed$2([]) })
60836
60777
  );
60837
60778
  }).pipe(scoped);
60838
- const probedCommands = yield* make$1m({ lookup: probeCommands2, capacity: 32, timeToLive: minutes(1) });
60779
+ const probedCommands = yield* make$1k({ lookup: probeCommands2, capacity: 32, timeToLive: minutes(1) });
60839
60780
  const listCommands = ({ threadId, cwd }) => suspend(() => {
60840
60781
  const tracked = commands2.get(threadId);
60841
60782
  return tracked === void 0 ? get$3(probedCommands, cwd) : succeed$2(tracked);
@@ -61423,7 +61364,7 @@ const sameSecret = (expected, candidate) => {
61423
61364
  const b = Buffer.from(candidate);
61424
61365
  return a.length === b.length && timingSafeEqual(a, b);
61425
61366
  };
61426
- const make$17 = gen(function* () {
61367
+ const make$16 = gen(function* () {
61427
61368
  const secrets = yield* Secrets;
61428
61369
  const identity2 = yield* loadIdentity;
61429
61370
  const settings = yield* Settings$1;
@@ -61457,7 +61398,7 @@ const make$17 = gen(function* () {
61457
61398
  identity: identity2
61458
61399
  });
61459
61400
  });
61460
- const layer$U = effect(RemoteAccess, make$17);
61401
+ const layer$R = effect(RemoteAccess, make$16);
61461
61402
  const CLOUDFLARED_VERSION = "2026.10.3";
61462
61403
  const RELEASE = `https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}`;
61463
61404
  const ASSETS = {
@@ -61705,7 +61646,7 @@ const storedTunnel = gen(function* () {
61705
61646
  });
61706
61647
  return getOrNull(map$4(yield* find(TUNNEL_KEY), ({ value: value2 }) => value2));
61707
61648
  }).pipe(mapError(persistence("relay.load")));
61708
- const make$16 = ({
61649
+ const make$15 = ({
61709
61650
  serviceUrl = DEFAULT_RELAY_SERVICE_URL,
61710
61651
  fetch: fetch2 = globalThis.fetch,
61711
61652
  cloudflared = "cloudflared",
@@ -61717,11 +61658,11 @@ const make$16 = ({
61717
61658
  const secrets = yield* Secrets;
61718
61659
  const settings = yield* Settings$1;
61719
61660
  const access2 = yield* RemoteAccess;
61720
- const lock = yield* make$1w(1);
61721
- const connector = yield* make$1l();
61722
- const publisher = yield* make$1l();
61723
- const linking = yield* make$1l();
61724
- const status = yield* make$1d({ state: "off" });
61661
+ const lock = yield* make$1u(1);
61662
+ const connector = yield* make$1j();
61663
+ const publisher = yield* make$1j();
61664
+ const linking = yield* make$1j();
61665
+ const status = yield* make$1c({ state: "off" });
61725
61666
  let tunnel = yield* storedTunnel;
61726
61667
  let remote = (yield* settings.get).remote;
61727
61668
  const publish2 = (next2) => gen(function* () {
@@ -61771,7 +61712,7 @@ const make$16 = ({
61771
61712
  yield* service2.publishPairing(credential, pairing);
61772
61713
  yield* save({ ...tunnel, published });
61773
61714
  }).pipe(catch_((failure2) => logWarning("Cannot publish this machine's pairing", failure2.message)));
61774
- const republish = asVoid(run$5(publisher, publishPairing));
61715
+ const republish = asVoid(run$4(publisher, publishPairing));
61775
61716
  const runOnce = (binary, hostname2, token) => gen(function* () {
61776
61717
  const events2 = yield* unbounded$1();
61777
61718
  yield* acquireRelease(
@@ -61844,7 +61785,7 @@ const make$16 = ({
61844
61785
  yield* republish;
61845
61786
  if (!remote.enabled) return yield* publish2({ state: "paused", hostname: tunnel.hostname });
61846
61787
  yield* publish2({ state: "connecting", hostname: tunnel.hostname, error: null });
61847
- yield* run$5(connector, keepConnected(tunnel));
61788
+ yield* run$4(connector, keepConnected(tunnel));
61848
61789
  });
61849
61790
  const linked = (credential) => putTunnel(credential).pipe(andThen(apply2));
61850
61791
  const claimUntilApproved = (link) => gen(function* () {
@@ -61870,7 +61811,7 @@ const make$16 = ({
61870
61811
  const link = yield* service2.createLink(access2.identity.id, access2.identity.name);
61871
61812
  yield* publish2({ state: "linking", url: link.url, userCode: link.userCode });
61872
61813
  yield* onLink({ url: link.url, userCode: link.userCode });
61873
- return yield* run$5(linking, claimUntilApproved(link));
61814
+ return yield* run$4(linking, claimUntilApproved(link));
61874
61815
  })
61875
61816
  );
61876
61817
  if (pending !== null) yield* join$2(pending);
@@ -61919,7 +61860,7 @@ const make$16 = ({
61919
61860
  )
61920
61861
  });
61921
61862
  });
61922
- const layer$T = (options = {}) => effect(Relay, make$16(options));
61863
+ const layer$Q = (options = {}) => effect(Relay, make$15(options));
61923
61864
  class Events extends Service$1()(
61924
61865
  "hinacode/Events"
61925
61866
  ) {
@@ -61969,11 +61910,11 @@ const BEARER$1 = "Bearer ";
61969
61910
  class AppConnections extends Service$1()("hinacode/AppConnections") {
61970
61911
  }
61971
61912
  const sha256$1 = (value2) => createHash("sha256").update(value2).digest("hex");
61972
- const make$15 = gen(function* () {
61913
+ const make$14 = gen(function* () {
61973
61914
  const sql = yield* SqlClient;
61974
61915
  const access2 = yield* RemoteAccess;
61975
61916
  const events2 = yield* Events;
61976
- const expiry = yield* make$1l();
61917
+ const expiry = yield* make$1j();
61977
61918
  let waitingUntil = null;
61978
61919
  const requests = /* @__PURE__ */ new Map();
61979
61920
  const grants = /* @__PURE__ */ new Map();
@@ -62008,7 +61949,7 @@ const make$15 = gen(function* () {
62008
61949
  const connections = yield* findAll$1(void 0).pipe(mapError(persistence("appConnections.list")));
62009
61950
  return {
62010
61951
  url: getOrNull(map$4(yield* issuer, (origin) => `${origin}/mcp`)),
62011
- waitingUntil: waitingUntil === null ? null : formatIso(makeUnsafe$9(waitingUntil)),
61952
+ waitingUntil: waitingUntil === null ? null : formatIso(makeUnsafe$8(waitingUntil)),
62012
61953
  requests: [...requests].filter(([, pending]) => pending.answer.type === "waiting").map(([id2, { request: request22 }]) => ({ id: id2, name: request22.name, redirectHost: new URL(request22.redirectUri).host })),
62013
61954
  connections
62014
61955
  };
@@ -62019,7 +61960,7 @@ const make$15 = gen(function* () {
62019
61960
  );
62020
61961
  const start = gen(function* () {
62021
61962
  waitingUntil = (yield* currentTimeMillis) + toMillis(WAITING_LIFE);
62022
- yield* run$5(expiry, andThen(sleep$3(WAITING_LIFE), announce2));
61963
+ yield* run$4(expiry, andThen(sleep$3(WAITING_LIFE), announce2));
62023
61964
  yield* announce2;
62024
61965
  return yield* status;
62025
61966
  });
@@ -62117,7 +62058,7 @@ const make$15 = gen(function* () {
62117
62058
  port: () => port
62118
62059
  });
62119
62060
  });
62120
- const layer$S = effect(AppConnections, make$15);
62061
+ const layer$P = effect(AppConnections, make$14);
62121
62062
  const followRelayLayer = effectDiscard(
62122
62063
  gen(function* () {
62123
62064
  const relay2 = yield* Relay;
@@ -62151,7 +62092,7 @@ const fromFileInfo = (info) => {
62151
62092
  const fromFileWeb = (file) => {
62152
62093
  return `${file.size.toString(16)}-${file.lastModified.toString(16)}`;
62153
62094
  };
62154
- const layer$R = /* @__PURE__ */ succeed$5(Generator)({
62095
+ const layer$O = /* @__PURE__ */ succeed$5(Generator)({
62155
62096
  fromFileInfo(info) {
62156
62097
  return sync(() => ({
62157
62098
  _tag: "Strong",
@@ -62427,7 +62368,7 @@ const addHeaderAttributes = (span, phase, headers2, filter2, redactedNames) => {
62427
62368
  };
62428
62369
  const Proto$4 = /* @__PURE__ */ Object.getPrototypeOf(empty$2);
62429
62370
  const emptyMutableUnsafe = () => Object.create(Proto$4);
62430
- function make$14(strings, ...args) {
62371
+ function make$13(strings, ...args) {
62431
62372
  const argsLength = args.length;
62432
62373
  const values2 = new Array(argsLength);
62433
62374
  const effects = [];
@@ -62536,7 +62477,7 @@ const html = (strings, ...args) => {
62536
62477
  contentType: "text/html"
62537
62478
  });
62538
62479
  }
62539
- return map$2(make$14(strings, ...args), (_) => text$2(_, {
62480
+ return map$2(make$13(strings, ...args), (_) => text$2(_, {
62540
62481
  contentType: "text/html"
62541
62482
  }));
62542
62483
  };
@@ -63037,7 +62978,7 @@ const getType = (path2) => {
63037
62978
  };
63038
62979
  class HttpPlatform extends (/* @__PURE__ */ Service$1()("effect/http/HttpPlatform")) {
63039
62980
  }
63040
- const make$13 = /* @__PURE__ */ fnUntraced(function* (impl) {
62981
+ const make$12 = /* @__PURE__ */ fnUntraced(function* (impl) {
63041
62982
  const fs2 = yield* FileSystem;
63042
62983
  const etagGen = yield* Generator;
63043
62984
  return HttpPlatform.of({
@@ -63274,7 +63215,7 @@ const serverAbortError = /* @__PURE__ */ succeed$2(/* @__PURE__ */ empty({
63274
63215
  }));
63275
63216
  const TypeId$9 = "~effect/socket/Socket";
63276
63217
  const Socket = /* @__PURE__ */ Service$1("effect/socket/Socket");
63277
- const make$12 = (options) => Socket.of({
63218
+ const make$11 = (options) => Socket.of({
63278
63219
  [TypeId$9]: TypeId$9,
63279
63220
  reader: options.reader,
63280
63221
  writer: options.writer
@@ -63396,7 +63337,7 @@ const closeError = (code2, closeReason) => new SocketError({
63396
63337
  const isPausable = (ws) => "pause" in ws && typeof ws.pause === "function";
63397
63338
  const fromWebSocket = (acquire, options) => withFiber((fiber) => {
63398
63339
  let currentWS;
63399
- const latch = makeUnsafe$a(false);
63340
+ const latch = makeUnsafe$9(false);
63400
63341
  const acquireContext = fiber.context;
63401
63342
  const reader2 = gen(function* () {
63402
63343
  const scope2 = yield* scope$1;
@@ -63604,7 +63545,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber) => {
63604
63545
  write,
63605
63546
  writeAll
63606
63547
  });
63607
- return succeed$2(make$12({
63548
+ return succeed$2(make$11({
63608
63549
  reader: reader2,
63609
63550
  writer: writer2
63610
63551
  }));
@@ -63681,7 +63622,7 @@ for (let i = 32; i <= 126; i++) {
63681
63622
  for (let i = 128; i <= 255; i++) {
63682
63623
  constValueChars[i] = 1;
63683
63624
  }
63684
- function make$11() {
63625
+ function make$10() {
63685
63626
  const decoder = new TextDecoder();
63686
63627
  const state = {
63687
63628
  state: State$1.key,
@@ -63880,7 +63821,7 @@ function makeState(needle_) {
63880
63821
  matchIndex: 0
63881
63822
  };
63882
63823
  }
63883
- function make$10(needle, callback2, seed, minimumChunkLength) {
63824
+ function make$$(needle, callback2, seed, minimumChunkLength) {
63884
63825
  const state = makeState(needle);
63885
63826
  const minChunkLength = minimumChunkLength;
63886
63827
  if (seed !== void 0) {
@@ -64016,7 +63957,7 @@ function parseBoundary(headers2) {
64016
63957
  function noopOnChunk(_chunk) {
64017
63958
  }
64018
63959
  const toLimit = (input) => input === Infinity ? Infinity : Number(fromInputUnsafe$1(input));
64019
- function make$$({
63960
+ function make$_({
64020
63961
  headers: headers2,
64021
63962
  onFile: onPart,
64022
63963
  onField,
@@ -64069,8 +64010,8 @@ function make$$({
64069
64010
  }
64070
64011
  onError2(error2);
64071
64012
  }
64072
- const headerParser = make$11();
64073
- const split = make$10(`\r
64013
+ const headerParser = make$10();
64014
+ const split = make$$(`\r
64074
64015
  --${boundary}`, function(index, chunk) {
64075
64016
  if (state.stopped) {
64076
64017
  return;
@@ -64221,7 +64162,7 @@ function getDecoder(charset) {
64221
64162
  function decodeField$1(info, value2) {
64222
64163
  return getDecoder(info.contentTypeParameters.charset ?? "utf-8").decode(value2);
64223
64164
  }
64224
- const make$_ = make$$;
64165
+ const make$Z = make$_;
64225
64166
  const defaultIsFile = defaultIsFile$1;
64226
64167
  const decodeField = decodeField$1;
64227
64168
  const TypeId$8 = "~effect/http/Multipart";
@@ -64305,7 +64246,7 @@ let PartBase$1 = class PartBase extends Class {
64305
64246
  this[TypeId$8] = TypeId$8;
64306
64247
  }
64307
64248
  };
64308
- const defaultWriteFile = (path2, file) => flatMap(FileSystem, (fs2) => mapError(run$6(file.content, fs2.sink(path2)), toMultipartError));
64249
+ const defaultWriteFile = (path2, file) => flatMap(FileSystem, (fs2) => mapError(run$5(file.content, fs2.sink(path2)), toMultipartError));
64309
64250
  const toPersisted = (stream2, writeFile2 = defaultWriteFile) => gen(function* () {
64310
64251
  const fs2 = yield* FileSystem;
64311
64252
  const path_ = yield* Path;
@@ -64410,7 +64351,7 @@ const appendPreResponseHandlerUnsafe$1 = (request2, handler) => {
64410
64351
  const next2 = prev ? (request3, response2) => flatMap(prev(request3, response2), (response3) => handler(request3, response3)) : handler;
64411
64352
  requestPreResponseHandlers.set(request2.source, next2);
64412
64353
  };
64413
- const make$Z = (middleware2) => middleware2;
64354
+ const make$Y = (middleware2) => middleware2;
64414
64355
  const loggerDisabledRequests = /* @__PURE__ */ new WeakSet();
64415
64356
  const stripSearchAndHash = (url2) => {
64416
64357
  const queryIndex = url2.indexOf("?");
@@ -64437,7 +64378,7 @@ const SpanNameGenerator = /* @__PURE__ */ Reference("@effect/platform/HttpMiddle
64437
64378
  const TracerHeaderFilter = /* @__PURE__ */ Reference("effect/http/HttpMiddleware/TracerHeaderFilter", {
64438
64379
  defaultValue: () => constFalse
64439
64380
  });
64440
- const logger = /* @__PURE__ */ make$Z((httpApp) => withFiber((fiber) => {
64381
+ const logger = /* @__PURE__ */ make$Y((httpApp) => withFiber((fiber) => {
64441
64382
  const request2 = getUnsafe$1(fiber.context, HttpServerRequest);
64442
64383
  const path2 = stripSearchAndHash(request2.url);
64443
64384
  return withLogSpan(flatMap(exit(httpApp), (exit2) => {
@@ -64477,7 +64418,7 @@ const responseSpanExit = (request2, response2) => {
64477
64418
  setStackTraceLimit(stackTraceLimit);
64478
64419
  }
64479
64420
  };
64480
- const tracer = /* @__PURE__ */ make$Z((httpApp) => withFiber((fiber) => {
64421
+ const tracer = /* @__PURE__ */ make$Y((httpApp) => withFiber((fiber) => {
64481
64422
  const request2 = getUnsafe$1(fiber.context, HttpServerRequest);
64482
64423
  if (isTracerDisabledUnsafe(fiber, request2)) {
64483
64424
  return httpApp;
@@ -64623,7 +64564,7 @@ const toHandled = (self2, handleResponse2, middleware2) => {
64623
64564
  }
64624
64565
  return withFiber((fiber) => {
64625
64566
  fiberEnterUninterruptibleUnsafe(fiber);
64626
- const scope2 = makeUnsafe$5();
64567
+ const scope2 = makeUnsafe$4();
64627
64568
  const frame2 = new RequestFrame(scope2, fiber.context, getUnsafe$1(fiber.context, HttpServerRequest));
64628
64569
  fiber.setContext(add$1(frame2.prev, Scope, scope2));
64629
64570
  const currentTracer = fiber.cache.tracer;
@@ -64639,7 +64580,7 @@ const scopeEjected = /* @__PURE__ */ Symbol.for("effect/http/HttpEffect/scopeEje
64639
64580
  const appendPreResponseHandlerUnsafe = appendPreResponseHandlerUnsafe$1;
64640
64581
  class HttpServer extends (/* @__PURE__ */ Service$1()("effect/http/HttpServer")) {
64641
64582
  }
64642
- const make$Y = (options) => options;
64583
+ const make$X = (options) => options;
64643
64584
  const serve$2 = /* @__PURE__ */ dual((args) => isEffect(args[0]), (effect2, middleware2) => effectDiscard(HttpServer.use((server2) => server2.serve(effect2, middleware2))));
64644
64585
  const formatAddress = formatUrlUnsafe;
64645
64586
  const addressFormattedWith = (f) => flatMap(HttpServer, (server2) => f(formatAddress(server2.address)));
@@ -64761,7 +64702,7 @@ const compress = (data, algorithm, options) => callback((resume) => {
64761
64702
  }
64762
64703
  }
64763
64704
  });
64764
- const make$X = (fallback) => ({
64705
+ const make$W = (fallback) => ({
64765
64706
  algorithms: fallback.algorithms,
64766
64707
  compressResponse(response2, algorithm, options) {
64767
64708
  const body2 = response2.body;
@@ -64829,7 +64770,7 @@ const lazyReadable = (evaluate, onDestroy) => {
64829
64770
  });
64830
64771
  };
64831
64772
  const compressedBody = (response2, body2) => removeHeader(setBody(response2, body2), "content-length");
64832
- const compression = /* @__PURE__ */ make$X({
64773
+ const compression = /* @__PURE__ */ make$W({
64833
64774
  algorithms,
64834
64775
  compressResponse(response2, algorithm, options) {
64835
64776
  const body2 = response2.body;
@@ -64858,7 +64799,7 @@ const compression = /* @__PURE__ */ make$X({
64858
64799
  }
64859
64800
  }
64860
64801
  });
64861
- const make$W = /* @__PURE__ */ make$13({
64802
+ const make$V = /* @__PURE__ */ make$12({
64862
64803
  platform: "node",
64863
64804
  compression,
64864
64805
  fileResponse(path2, status, statusText, headers2, start, end2, contentLength) {
@@ -64887,7 +64828,7 @@ const make$W = /* @__PURE__ */ make$13({
64887
64828
  });
64888
64829
  }
64889
64830
  });
64890
- const layer$Q = /* @__PURE__ */ pipe$2(/* @__PURE__ */ effect(HttpPlatform)(make$W), /* @__PURE__ */ provide$2(layer$_), /* @__PURE__ */ provide$2(layer$R));
64831
+ const layer$N = /* @__PURE__ */ pipe$2(/* @__PURE__ */ effect(HttpPlatform)(make$V), /* @__PURE__ */ provide$2(layer$X), /* @__PURE__ */ provide$2(layer$O));
64891
64832
  class MultipartStream extends Duplex {
64892
64833
  _parser;
64893
64834
  _canWrite = true;
@@ -64898,7 +64839,7 @@ class MultipartStream extends Duplex {
64898
64839
  });
64899
64840
  let currentError;
64900
64841
  let currentFile;
64901
- this._parser = make$_({
64842
+ this._parser = make$Z({
64902
64843
  ...config2,
64903
64844
  onField: (info, value2) => {
64904
64845
  if (currentError !== void 0) return;
@@ -64959,7 +64900,7 @@ class MultipartStream extends Duplex {
64959
64900
  callback2();
64960
64901
  }
64961
64902
  }
64962
- const make$V = (config2) => new MultipartStream(config2);
64903
+ const make$U = (config2) => new MultipartStream(config2);
64963
64904
  class FileStream extends Readable {
64964
64905
  _tag = "File";
64965
64906
  filename;
@@ -64979,7 +64920,7 @@ class FileStream extends Readable {
64979
64920
  }
64980
64921
  const stream = (source, headers2) => makeConfig(headers2).pipe(map$2((config2) => fromReadable({
64981
64922
  evaluate() {
64982
- const parser2 = make$V(config2);
64923
+ const parser2 = make$U(config2);
64983
64924
  source.pipe(parser2);
64984
64925
  return parser2;
64985
64926
  },
@@ -65075,7 +65016,7 @@ function convertError(cause) {
65075
65016
  }
65076
65017
  }
65077
65018
  }
65078
- const make$U = /* @__PURE__ */ fnUntraced(function* (evaluate, options) {
65019
+ const make$T = /* @__PURE__ */ fnUntraced(function* (evaluate, options) {
65079
65020
  const scope2 = yield* scope$1;
65080
65021
  const server2 = evaluate();
65081
65022
  const shutdown2 = yield* callback((resume) => {
@@ -65118,7 +65059,7 @@ const make$U = /* @__PURE__ */ fnUntraced(function* (evaluate, options) {
65118
65059
  })), (wss2) => callback((resume) => {
65119
65060
  wss2.close(() => resume(void_));
65120
65061
  })).pipe(provide$1(scope2), cached$1);
65121
- return make$Y({
65062
+ return make$X({
65122
65063
  address: boundAddress,
65123
65064
  serve: fnUntraced(function* (httpApp, middleware2) {
65124
65065
  const serveScope = yield* scope$1;
@@ -65279,9 +65220,9 @@ class ServerRequestImpl extends NodeHttpIncomingMessage {
65279
65220
  });
65280
65221
  }
65281
65222
  }
65282
- const layerServer = /* @__PURE__ */ flow$1(make$U, /* @__PURE__ */ effect(HttpServer));
65283
- const layerHttpServices = /* @__PURE__ */ mergeAll(layer$Q, layerWeak, layer$$);
65284
- const layer$P = (evaluate, options) => mergeAll(layerServer(evaluate, options), layerHttpServices);
65223
+ const layerServer = /* @__PURE__ */ flow$1(make$T, /* @__PURE__ */ effect(HttpServer));
65224
+ const layerHttpServices = /* @__PURE__ */ mergeAll(layer$N, layerWeak, layer$Y);
65225
+ const layer$M = (evaluate, options) => mergeAll(layerServer(evaluate, options), layerHttpServices);
65285
65226
  const closeCode = (exit2) => isSuccess$2(exit2) ? 1e3 : hasInterruptsOnly(exit2.cause) ? 1001 : 1011;
65286
65227
  const upgradedResponse = /* @__PURE__ */ empty({
65287
65228
  status: 101
@@ -65385,7 +65326,7 @@ const handleResponse = (request2, response2) => {
65385
65326
  }
65386
65327
  case "Stream": {
65387
65328
  nodeResponse.writeHead(response2.status, response2.statusText, headers2);
65388
- const drainLatch = makeUnsafe$a();
65329
+ const drainLatch = makeUnsafe$9();
65389
65330
  nodeResponse.on("drain", () => drainLatch.openUnsafe());
65390
65331
  return body2.stream.pipe(orDie$1, runForEachArray((array2) => {
65391
65332
  const chunk = array2.length > 1 ? Buffer.concat(array2) : array2[0];
@@ -66079,7 +66020,7 @@ class AiError extends (/* @__PURE__ */ Error$2("effect/ai/AiError/AiError")({
66079
66020
  }
66080
66021
  const isAiError = (u) => hasProperty(u, TypeId$6);
66081
66022
  const isAiErrorReason = (u) => hasProperty(u, ReasonTypeId);
66082
- const make$T = (params2) => new AiError(params2);
66023
+ const make$S = (params2) => new AiError(params2);
66083
66024
  const TypeId$5 = "~effect/ai/Tool";
66084
66025
  const DynamicTypeId = "~effect/ai/Tool/Dynamic";
66085
66026
  const isDynamic = (u) => hasProperty(u, DynamicTypeId);
@@ -66131,7 +66072,7 @@ const userDefinedProto = (options) => {
66131
66072
  self2.id = `effect/ai/Tool/${options.name}`;
66132
66073
  return self2;
66133
66074
  };
66134
- const make$S = (name, options) => {
66075
+ const make$R = (name, options) => {
66135
66076
  const successSchema = options?.success ?? Void;
66136
66077
  const failureSchema = options?.failure ?? Never;
66137
66078
  return userDefinedProto({
@@ -66179,7 +66120,7 @@ const TypeId$4 = "~effect/ai/Toolkit";
66179
66120
  const FailureOrigin = /* @__PURE__ */ Reference("effect/ai/Toolkit/FailureOrigin", {
66180
66121
  defaultValue: () => "result"
66181
66122
  });
66182
- const failureCause = (error2, origin) => annotate(fail$4(error2), make$1x(FailureOrigin, origin));
66123
+ const failureCause = (error2, origin) => annotate(fail$4(error2), make$1v(FailureOrigin, origin));
66183
66124
  const Proto$1 = {
66184
66125
  .../* @__PURE__ */ Prototype({
66185
66126
  label: "Toolkit",
@@ -66212,7 +66153,7 @@ const Proto$1 = {
66212
66153
  parameters: params2
66213
66154
  });
66214
66155
  if (isUndefined(tool2)) {
66215
- return yield* make$T({
66156
+ return yield* make$S({
66216
66157
  module: "Toolkit",
66217
66158
  method: `${name}.handle`,
66218
66159
  reason: new ToolNotFoundError({
@@ -66222,7 +66163,7 @@ const Proto$1 = {
66222
66163
  });
66223
66164
  }
66224
66165
  const schemas = getSchemas(tool2);
66225
- const encodeResult = (result2, isFailure2) => schemas.encodeResult(result2, isFailure2).pipe(mapError((cause) => make$T({
66166
+ const encodeResult = (result2, isFailure2) => schemas.encodeResult(result2, isFailure2).pipe(mapError((cause) => make$S({
66226
66167
  module: "Toolkit",
66227
66168
  method: `${name}.handle`,
66228
66169
  reason: new ToolResultEncodingError({
@@ -66233,7 +66174,7 @@ const Proto$1 = {
66233
66174
  })));
66234
66175
  const decodedParamsResult = yield* result$1(schemas.decodeParameters(params2, options));
66235
66176
  if (isFailure(decodedParamsResult)) {
66236
- const error2 = make$T({
66177
+ const error2 = make$S({
66237
66178
  module: "Toolkit",
66238
66179
  method: `${name}.handle`,
66239
66180
  reason: new ToolParameterValidationError({
@@ -66253,7 +66194,7 @@ const Proto$1 = {
66253
66194
  })));
66254
66195
  }
66255
66196
  const decodedParams = decodedParamsResult.success;
66256
- const queue = yield* make$1r();
66197
+ const queue = yield* make$1p();
66257
66198
  const context2 = {
66258
66199
  toolCallId,
66259
66200
  preliminary: (result2) => asVoid(offer(queue, {
@@ -66271,14 +66212,14 @@ const Proto$1 = {
66271
66212
  onSuccess: () => end(queue)
66272
66213
  }), forkChild);
66273
66214
  const normalizeError = (error2) => {
66274
- const normalizedError = isSchemaError$1(error2) ? make$T({
66215
+ const normalizedError = isSchemaError$1(error2) ? make$S({
66275
66216
  module: "Toolkit",
66276
66217
  method: `${name}.handle`,
66277
66218
  reason: new InvalidToolResultError({
66278
66219
  toolName: name,
66279
66220
  description: `Tool handler returned invalid result: ${error2.message}`
66280
66221
  })
66281
- }) : isAiErrorReason(error2) ? make$T({
66222
+ }) : isAiErrorReason(error2) ? make$S({
66282
66223
  module: "Toolkit",
66283
66224
  method: `${name}.handle`,
66284
66225
  reason: error2
@@ -66327,7 +66268,7 @@ const Proto$1 = {
66327
66268
  });
66328
66269
  }
66329
66270
  }
66330
- return makeUnsafe$7(context$1);
66271
+ return makeUnsafe$6(context$1);
66331
66272
  });
66332
66273
  },
66333
66274
  toLayer(build) {
@@ -66351,7 +66292,7 @@ const resolveInput = (...tools) => {
66351
66292
  }
66352
66293
  return output;
66353
66294
  };
66354
- const make$R = (...tools) => makeProto$2(resolveInput(...tools));
66295
+ const make$Q = (...tools) => makeProto$2(resolveInput(...tools));
66355
66296
  const merge = (...toolkits) => {
66356
66297
  const tools = {};
66357
66298
  for (const toolkit of toolkits) {
@@ -66373,7 +66314,7 @@ function getStreamSchemas(schema2) {
66373
66314
  }
66374
66315
  const schema = /* @__PURE__ */ declare(isStream);
66375
66316
  function Stream2(success2, error2) {
66376
- return make$1y(schema.ast, {
66317
+ return make$1w(schema.ast, {
66377
66318
  [StreamSchemaTypeId]: StreamSchemaTypeId,
66378
66319
  success: success2,
66379
66320
  error: error2
@@ -66490,7 +66431,7 @@ const makeProto$1 = (options) => {
66490
66431
  Rpc.key = `effect/rpc/Rpc/${options._tag}`;
66491
66432
  return Rpc;
66492
66433
  };
66493
- const make$Q = (tag2, options) => {
66434
+ const make$P = (tag2, options) => {
66494
66435
  const successSchema = options?.success ?? Void;
66495
66436
  const errorSchema = options?.error ?? Never;
66496
66437
  const defectSchema = options?.defect ?? Defect();
@@ -66558,7 +66499,7 @@ const RpcGroupProto = {
66558
66499
  }
66559
66500
  return makeProto({
66560
66501
  requests,
66561
- annotations: makeUnsafe$7(annotations)
66502
+ annotations: makeUnsafe$6(annotations)
66562
66503
  });
66563
66504
  },
66564
66505
  omit(...tags2) {
@@ -66594,7 +66535,7 @@ const RpcGroupProto = {
66594
66535
  context: services
66595
66536
  });
66596
66537
  });
66597
- return makeUnsafe$7(contextMap);
66538
+ return makeUnsafe$6(contextMap);
66598
66539
  });
66599
66540
  },
66600
66541
  prefix(prefix2) {
@@ -66623,7 +66564,7 @@ const RpcGroupProto = {
66623
66564
  handler,
66624
66565
  context: services
66625
66566
  });
66626
- return makeUnsafe$7(contextMap);
66567
+ return makeUnsafe$6(contextMap);
66627
66568
  }));
66628
66569
  },
66629
66570
  accessHandler(service2) {
@@ -66648,7 +66589,7 @@ const RpcGroupProto = {
66648
66589
  });
66649
66590
  },
66650
66591
  annotateRpcs(service2, value2) {
66651
- return this.annotateRpcsMerge(make$1x(service2, value2));
66592
+ return this.annotateRpcsMerge(make$1v(service2, value2));
66652
66593
  },
66653
66594
  annotateMerge(context2) {
66654
66595
  return makeProto({
@@ -66672,7 +66613,7 @@ const makeProto = (options) => Object.assign(function() {
66672
66613
  requests: options.requests,
66673
66614
  annotations: options.annotations
66674
66615
  });
66675
- const make$P = (...rpcs) => makeProto({
66616
+ const make$O = (...rpcs) => makeProto({
66676
66617
  requests: new Map(rpcs.map((rpc2) => [rpc2._tag, rpc2])),
66677
66618
  annotations: empty$7()
66678
66619
  });
@@ -66971,7 +66912,7 @@ class InternalError extends (/* @__PURE__ */ Error$2("effect/ai/McpSchema/Intern
66971
66912
  });
66972
66913
  }
66973
66914
  const McpError$1 = /* @__PURE__ */ Union([ParseError2, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
66974
- let Ping$1 = class Ping extends (/* @__PURE__ */ make$Q("ping", {
66915
+ let Ping$1 = class Ping extends (/* @__PURE__ */ make$P("ping", {
66975
66916
  success: /* @__PURE__ */ Struct({}),
66976
66917
  error: McpError$1,
66977
66918
  payload: /* @__PURE__ */ UndefinedOr(RequestMeta$1)
@@ -66997,7 +66938,7 @@ let InitializeResult$4 = class InitializeResult extends (/* @__PURE__ */ Opaque(
66997
66938
  instructions: /* @__PURE__ */ optional$5(String$1)
66998
66939
  }))) {
66999
66940
  };
67000
- let Initialize$4 = class Initialize extends (/* @__PURE__ */ make$Q("initialize", {
66941
+ let Initialize$4 = class Initialize extends (/* @__PURE__ */ make$P("initialize", {
67001
66942
  success: InitializeResult$4,
67002
66943
  error: McpError$1,
67003
66944
  payload: {
@@ -67020,7 +66961,7 @@ let Initialize$4 = class Initialize extends (/* @__PURE__ */ make$Q("initialize"
67020
66961
  }
67021
66962
  })) {
67022
66963
  };
67023
- let CancelledNotification$1 = class CancelledNotification extends (/* @__PURE__ */ make$Q("notifications/cancelled", {
66964
+ let CancelledNotification$1 = class CancelledNotification extends (/* @__PURE__ */ make$P("notifications/cancelled", {
67024
66965
  payload: {
67025
66966
  ...NotificationMeta$1.fields,
67026
66967
  /**
@@ -67038,7 +66979,7 @@ let CancelledNotification$1 = class CancelledNotification extends (/* @__PURE__
67038
66979
  }
67039
66980
  })) {
67040
66981
  };
67041
- let ProgressNotification$2 = class ProgressNotification extends (/* @__PURE__ */ make$Q("notifications/progress", {
66982
+ let ProgressNotification$2 = class ProgressNotification extends (/* @__PURE__ */ make$P("notifications/progress", {
67042
66983
  payload: {
67043
66984
  ...NotificationMeta$1.fields,
67044
66985
  /**
@@ -67196,7 +67137,7 @@ let ReadResourceResult$2 = class ReadResourceResult extends (/* @__PURE__ */ Opa
67196
67137
  contents: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Union([TextResourceContents$2, BlobResourceContents$2]))
67197
67138
  }))) {
67198
67139
  };
67199
- let ReadResource$2 = class ReadResource extends (/* @__PURE__ */ make$Q("resources/read", {
67140
+ let ReadResource$2 = class ReadResource extends (/* @__PURE__ */ make$P("resources/read", {
67200
67141
  success: ReadResourceResult$2,
67201
67142
  error: McpError$1,
67202
67143
  payload: {
@@ -67209,11 +67150,11 @@ let ReadResource$2 = class ReadResource extends (/* @__PURE__ */ make$Q("resourc
67209
67150
  }
67210
67151
  })) {
67211
67152
  };
67212
- let ResourceListChangedNotification$1 = class ResourceListChangedNotification extends (/* @__PURE__ */ make$Q("notifications/resources/list_changed", {
67153
+ let ResourceListChangedNotification$1 = class ResourceListChangedNotification extends (/* @__PURE__ */ make$P("notifications/resources/list_changed", {
67213
67154
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta$1)
67214
67155
  })) {
67215
67156
  };
67216
- let Subscribe$1 = class Subscribe extends (/* @__PURE__ */ make$Q("resources/subscribe", {
67157
+ let Subscribe$1 = class Subscribe extends (/* @__PURE__ */ make$P("resources/subscribe", {
67217
67158
  success: /* @__PURE__ */ Struct({}),
67218
67159
  error: McpError$1,
67219
67160
  payload: {
@@ -67226,7 +67167,7 @@ let Subscribe$1 = class Subscribe extends (/* @__PURE__ */ make$Q("resources/sub
67226
67167
  }
67227
67168
  })) {
67228
67169
  };
67229
- let Unsubscribe$1 = class Unsubscribe extends (/* @__PURE__ */ make$Q("resources/unsubscribe", {
67170
+ let Unsubscribe$1 = class Unsubscribe extends (/* @__PURE__ */ make$P("resources/unsubscribe", {
67230
67171
  success: /* @__PURE__ */ Struct({}),
67231
67172
  error: McpError$1,
67232
67173
  payload: {
@@ -67239,7 +67180,7 @@ let Unsubscribe$1 = class Unsubscribe extends (/* @__PURE__ */ make$Q("resources
67239
67180
  }
67240
67181
  })) {
67241
67182
  };
67242
- let ResourceUpdatedNotification$1 = class ResourceUpdatedNotification extends (/* @__PURE__ */ make$Q("notifications/resources/updated", {
67183
+ let ResourceUpdatedNotification$1 = class ResourceUpdatedNotification extends (/* @__PURE__ */ make$P("notifications/resources/updated", {
67243
67184
  payload: {
67244
67185
  ...NotificationMeta$1.fields,
67245
67186
  /**
@@ -67370,7 +67311,7 @@ let GetPromptResult$4 = class GetPromptResult extends (/* @__PURE__ */ Class$1("
67370
67311
  description: /* @__PURE__ */ optional$5(String$1)
67371
67312
  })) {
67372
67313
  };
67373
- let GetPrompt$4 = class GetPrompt extends (/* @__PURE__ */ make$Q("prompts/get", {
67314
+ let GetPrompt$4 = class GetPrompt extends (/* @__PURE__ */ make$P("prompts/get", {
67374
67315
  success: GetPromptResult$4,
67375
67316
  error: McpError$1,
67376
67317
  payload: {
@@ -67387,7 +67328,7 @@ let GetPrompt$4 = class GetPrompt extends (/* @__PURE__ */ make$Q("prompts/get",
67387
67328
  }
67388
67329
  })) {
67389
67330
  };
67390
- let PromptListChangedNotification$1 = class PromptListChangedNotification extends (/* @__PURE__ */ make$Q("notifications/prompts/list_changed", {
67331
+ let PromptListChangedNotification$1 = class PromptListChangedNotification extends (/* @__PURE__ */ make$P("notifications/prompts/list_changed", {
67391
67332
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta$1)
67392
67333
  })) {
67393
67334
  };
@@ -67494,7 +67435,7 @@ let CallToolResult$4 = class CallToolResult extends (/* @__PURE__ */ Class$1("@e
67494
67435
  isError: /* @__PURE__ */ optional$5(Boolean$1)
67495
67436
  })) {
67496
67437
  };
67497
- let CallTool$4 = class CallTool extends (/* @__PURE__ */ make$Q("tools/call", {
67438
+ let CallTool$4 = class CallTool extends (/* @__PURE__ */ make$P("tools/call", {
67498
67439
  success: CallToolResult$4,
67499
67440
  error: McpError$1,
67500
67441
  payload: {
@@ -67504,12 +67445,12 @@ let CallTool$4 = class CallTool extends (/* @__PURE__ */ make$Q("tools/call", {
67504
67445
  }
67505
67446
  })) {
67506
67447
  };
67507
- let ToolListChangedNotification$1 = class ToolListChangedNotification extends (/* @__PURE__ */ make$Q("notifications/tools/list_changed", {
67448
+ let ToolListChangedNotification$1 = class ToolListChangedNotification extends (/* @__PURE__ */ make$P("notifications/tools/list_changed", {
67508
67449
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta$1)
67509
67450
  })) {
67510
67451
  };
67511
67452
  const LoggingLevel$1 = /* @__PURE__ */ Literals(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
67512
- let SetLevel$1 = class SetLevel extends (/* @__PURE__ */ make$Q("logging/setLevel", {
67453
+ let SetLevel$1 = class SetLevel extends (/* @__PURE__ */ make$P("logging/setLevel", {
67513
67454
  payload: {
67514
67455
  ...RequestMeta$1.fields,
67515
67456
  /**
@@ -67523,7 +67464,7 @@ let SetLevel$1 = class SetLevel extends (/* @__PURE__ */ make$Q("logging/setLeve
67523
67464
  error: McpError$1
67524
67465
  })) {
67525
67466
  };
67526
- let LoggingMessageNotification$1 = class LoggingMessageNotification extends (/* @__PURE__ */ make$Q("notifications/message", {
67467
+ let LoggingMessageNotification$1 = class LoggingMessageNotification extends (/* @__PURE__ */ make$P("notifications/message", {
67527
67468
  payload: /* @__PURE__ */ Struct({
67528
67469
  ...NotificationMeta$1.fields,
67529
67470
  /**
@@ -67664,7 +67605,7 @@ let CreateMessageResult$4 = class CreateMessageResult extends (/* @__PURE__ */ C
67664
67605
  stopReason: /* @__PURE__ */ optional$5(String$1)
67665
67606
  })) {
67666
67607
  };
67667
- let CreateMessage$4 = class CreateMessage extends (/* @__PURE__ */ make$Q("sampling/createMessage", {
67608
+ let CreateMessage$4 = class CreateMessage extends (/* @__PURE__ */ make$P("sampling/createMessage", {
67668
67609
  success: CreateMessageResult$4,
67669
67610
  error: McpError$1,
67670
67611
  payload: {
@@ -67763,7 +67704,7 @@ let ListRootsResult$2 = class ListRootsResult extends (/* @__PURE__ */ Class$1("
67763
67704
  roots: /* @__PURE__ */ ArraySchema(Root$2)
67764
67705
  })) {
67765
67706
  };
67766
- let ListRoots$2 = class ListRoots extends (/* @__PURE__ */ make$Q("roots/list", {
67707
+ let ListRoots$2 = class ListRoots extends (/* @__PURE__ */ make$P("roots/list", {
67767
67708
  success: ListRootsResult$2,
67768
67709
  error: McpError$1,
67769
67710
  payload: /* @__PURE__ */ UndefinedOr(RequestMeta$1)
@@ -67905,13 +67846,13 @@ class ElicitDeclineResult extends (/* @__PURE__ */ Class$1("@effect/ai/McpSchema
67905
67846
  })) {
67906
67847
  }
67907
67848
  const ElicitResult$2 = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
67908
- let Elicit$2 = class Elicit extends (/* @__PURE__ */ make$Q("elicitation/create", {
67849
+ let Elicit$2 = class Elicit extends (/* @__PURE__ */ make$P("elicitation/create", {
67909
67850
  success: ElicitResult$2,
67910
67851
  error: McpError$1,
67911
67852
  payload: ElicitRequestParams$1
67912
67853
  })) {
67913
67854
  };
67914
- let ElicitationCompleteNotification$1 = class ElicitationCompleteNotification extends (/* @__PURE__ */ make$Q("notifications/elicitation/complete", {
67855
+ let ElicitationCompleteNotification$1 = class ElicitationCompleteNotification extends (/* @__PURE__ */ make$P("notifications/elicitation/complete", {
67915
67856
  payload: {
67916
67857
  elicitationId: String$1
67917
67858
  }
@@ -67933,7 +67874,7 @@ class McpServerClient extends (/* @__PURE__ */ Service$1()("effect/ai/McpSchema/
67933
67874
  }
67934
67875
  class McpServerClientMiddleware extends (/* @__PURE__ */ Service()("effect/ai/McpSchema/McpServerClientMiddleware")) {
67935
67876
  }
67936
- let ServerNotificationRpcs$3 = class ServerNotificationRpcs extends (/* @__PURE__ */ make$P(CancelledNotification$1, ProgressNotification$2, LoggingMessageNotification$1, ResourceUpdatedNotification$1, ResourceListChangedNotification$1, ToolListChangedNotification$1, PromptListChangedNotification$1, ElicitationCompleteNotification$1)) {
67877
+ let ServerNotificationRpcs$3 = class ServerNotificationRpcs extends (/* @__PURE__ */ make$O(CancelledNotification$1, ProgressNotification$2, LoggingMessageNotification$1, ResourceUpdatedNotification$1, ResourceListChangedNotification$1, ToolListChangedNotification$1, PromptListChangedNotification$1, ElicitationCompleteNotification$1)) {
67937
67878
  };
67938
67879
  class EnabledWhen extends (/* @__PURE__ */ Service$1()("effect/ai/McpSchema/EnabledWhen")) {
67939
67880
  }
@@ -67963,7 +67904,7 @@ class PromptNotFound extends (/* @__PURE__ */ TaggedError("PromptNotFound")) {
67963
67904
  }
67964
67905
  const ClientNotification = /* @__PURE__ */ taggedEnum();
67965
67906
  const ServerNotification = /* @__PURE__ */ taggedEnum();
67966
- const make$O = /* @__PURE__ */ sync(() => {
67907
+ const make$N = /* @__PURE__ */ sync(() => {
67967
67908
  const registrations = /* @__PURE__ */ new Map();
67968
67909
  const resourceRegistrations = [];
67969
67910
  const resourceTemplateRegistrations = [];
@@ -68344,7 +68285,7 @@ function encodeJsonRpcMessage(response2) {
68344
68285
  const jsonRpcInternalError = -32603;
68345
68286
  const layerJsonRpc = (options) => succeed$5(RpcSerialization)(jsonRpc());
68346
68287
  const withRun = () => (f) => suspend(() => {
68347
- const semaphore = makeUnsafe$8(1);
68288
+ const semaphore = makeUnsafe$7(1);
68348
68289
  let buffer2 = [];
68349
68290
  let write = (...args) => contextWith$1((context2) => {
68350
68291
  buffer2.push([args, context2]);
@@ -68646,7 +68587,7 @@ const makeNoSerialization$1 = /* @__PURE__ */ fnUntraced(function* (group, optio
68646
68587
  };
68647
68588
  });
68648
68589
  let clientIdCounter = 0;
68649
- const make$N = /* @__PURE__ */ fnUntraced(function* (group, options) {
68590
+ const make$M = /* @__PURE__ */ fnUntraced(function* (group, options) {
68650
68591
  const clientId = clientIdCounter++;
68651
68592
  const {
68652
68593
  codecFor,
@@ -69022,7 +68963,7 @@ const isSubscriptionServerNotification = (notification) => {
69022
68963
  return false;
69023
68964
  }
69024
68965
  };
69025
- const make$M = (options) => {
68966
+ const make$L = (options) => {
69026
68967
  const payloadCodecsCache = /* @__PURE__ */ new WeakMap();
69027
68968
  const payloadCodecs = (rpc2) => {
69028
68969
  let codecs = payloadCodecsCache.get(rpc2);
@@ -69043,7 +68984,7 @@ const make$M = (options) => {
69043
68984
  options.runtime._tag === "Stateful" ? lifecycle : void 0,
69044
68985
  target.context
69045
68986
  ));
69046
- const makeReverseClient = (profile) => make$N(options.serverRequestRpcs, {
68987
+ const makeReverseClient = (profile) => make$M(options.serverRequestRpcs, {
69047
68988
  spanPrefix: "McpServer/Client"
69048
68989
  }).pipe(map$2((client2) => options.toReverseClient(profile, client2)));
69049
68990
  return {
@@ -69054,7 +68995,7 @@ const make$M = (options) => {
69054
68995
  };
69055
68996
  };
69056
68997
  const prefix = (protocol2) => `@effect/mcp/${encodeURIComponent(protocol2.protocolVersion)}/`;
69057
- const make$L = /* @__PURE__ */ fnUntraced(function* (protocols) {
68998
+ const make$K = /* @__PURE__ */ fnUntraced(function* (protocols) {
69058
68999
  if (protocols.length === 0) {
69059
69000
  return yield* new IllegalArgumentError("MCP protocol declaration must contain at least one MCP protocol");
69060
69001
  }
@@ -69106,7 +69047,7 @@ const makeSession = (registration) => ({
69106
69047
  level: registration.logLevel
69107
69048
  }
69108
69049
  });
69109
- const make$K = () => {
69050
+ const make$J = () => {
69110
69051
  const bySessionId = /* @__PURE__ */ new Map();
69111
69052
  const byClientId = /* @__PURE__ */ new Map();
69112
69053
  const initializedClientIds = /* @__PURE__ */ new Set();
@@ -69218,7 +69159,7 @@ const headerMismatch = (message2) => ({
69218
69159
  message: message2
69219
69160
  }
69220
69161
  });
69221
- const PingRpcs = /* @__PURE__ */ make$P(Ping$1);
69162
+ const PingRpcs = /* @__PURE__ */ make$O(Ping$1);
69222
69163
  const stateful = (transport2) => ({
69223
69164
  _tag: "Stateful",
69224
69165
  transport: transport2
@@ -69226,9 +69167,9 @@ const stateful = (transport2) => ({
69226
69167
  class ServerRuntime extends (/* @__PURE__ */ Service$1()("effect/ai/McpRuntime/ServerRuntime")) {
69227
69168
  }
69228
69169
  const selectStatefulProtocol = (protocols, offeredVersion) => protocols.find((protocol2) => protocol2.runtime._tag === "Stateful" && protocol2.protocolVersion === offeredVersion) ?? protocols.find((protocol2) => protocol2.runtime._tag === "Stateful");
69229
- const make$J = /* @__PURE__ */ fnUntraced(function* (protocols) {
69170
+ const make$I = /* @__PURE__ */ fnUntraced(function* (protocols) {
69230
69171
  const statefulProtocol = protocols.find((protocol2) => protocol2.runtime._tag === "Stateful");
69231
- const stateful2 = statefulProtocol === void 0 ? void 0 : make$K();
69172
+ const stateful2 = statefulProtocol === void 0 ? void 0 : make$J();
69232
69173
  const protocolVersions = protocols.map((protocol2) => protocol2.protocolVersion);
69233
69174
  let statelessDescriptor;
69234
69175
  let statelessProtocol;
@@ -69242,7 +69183,7 @@ const make$J = /* @__PURE__ */ fnUntraced(function* (protocols) {
69242
69183
  statelessDescriptor = protocol2.runtime;
69243
69184
  statelessProtocol = protocol2;
69244
69185
  }
69245
- const registry2 = yield* make$L(protocols);
69186
+ const registry2 = yield* make$K(protocols);
69246
69187
  const sessionTerminationListeners = /* @__PURE__ */ new Set();
69247
69188
  const unsupportedProtocolVersion = (requested) => ({
69248
69189
  code: UNSUPPORTED_PROTOCOL_VERSION_ERROR_CODE,
@@ -69628,11 +69569,11 @@ const make$J = /* @__PURE__ */ fnUntraced(function* (protocols) {
69628
69569
  };
69629
69570
  yield* protocol2.installHandlers(options.core, lifecycle, handlerTarget);
69630
69571
  }
69631
- return makeUnsafe$7(contextMap);
69572
+ return makeUnsafe$6(contextMap);
69632
69573
  })
69633
69574
  });
69634
69575
  });
69635
- const layer$O = (protocols) => effect(ServerRuntime)(make$J(protocols));
69576
+ const layer$L = (protocols) => effect(ServerRuntime)(make$I(protocols));
69636
69577
  const optional$4 = (schema2) => optionalKey(schema2).pipe(decodeTo(toType(optional$7(schema2)), {
69637
69578
  decode: passthrough(),
69638
69579
  encode: transformOptional(flatMap$3(fromUndefinedOr))
@@ -69858,13 +69799,13 @@ const ListRootsResult$1 = /* @__PURE__ */ Struct({
69858
69799
  ...ResultMeta2.fields,
69859
69800
  roots: /* @__PURE__ */ ArraySchema(Root$1)
69860
69801
  });
69861
- class Ping2 extends (/* @__PURE__ */ make$Q("ping", {
69802
+ class Ping2 extends (/* @__PURE__ */ make$P("ping", {
69862
69803
  success: ResultMeta2,
69863
69804
  error: McpError2,
69864
69805
  payload: /* @__PURE__ */ UndefinedOr(RequestMeta2)
69865
69806
  })) {
69866
69807
  }
69867
- let Initialize$3 = class Initialize2 extends (/* @__PURE__ */ make$Q("initialize", {
69808
+ let Initialize$3 = class Initialize2 extends (/* @__PURE__ */ make$P("initialize", {
69868
69809
  success: InitializeResult$3,
69869
69810
  error: McpError2,
69870
69811
  payload: {
@@ -69875,7 +69816,7 @@ let Initialize$3 = class Initialize2 extends (/* @__PURE__ */ make$Q("initialize
69875
69816
  }
69876
69817
  })) {
69877
69818
  };
69878
- let Complete$1 = class Complete extends (/* @__PURE__ */ make$Q("completion/complete", {
69819
+ let Complete$1 = class Complete extends (/* @__PURE__ */ make$P("completion/complete", {
69879
69820
  success: CompleteResult$1,
69880
69821
  error: McpError2,
69881
69822
  payload: {
@@ -69888,7 +69829,7 @@ let Complete$1 = class Complete extends (/* @__PURE__ */ make$Q("completion/comp
69888
69829
  }
69889
69830
  })) {
69890
69831
  };
69891
- class SetLevel2 extends (/* @__PURE__ */ make$Q("logging/setLevel", {
69832
+ class SetLevel2 extends (/* @__PURE__ */ make$P("logging/setLevel", {
69892
69833
  success: ResultMeta2,
69893
69834
  error: McpError2,
69894
69835
  payload: {
@@ -69897,7 +69838,7 @@ class SetLevel2 extends (/* @__PURE__ */ make$Q("logging/setLevel", {
69897
69838
  }
69898
69839
  })) {
69899
69840
  }
69900
- let GetPrompt$3 = class GetPrompt2 extends (/* @__PURE__ */ make$Q("prompts/get", {
69841
+ let GetPrompt$3 = class GetPrompt2 extends (/* @__PURE__ */ make$P("prompts/get", {
69901
69842
  success: GetPromptResult$3,
69902
69843
  error: McpError2,
69903
69844
  payload: {
@@ -69907,25 +69848,25 @@ let GetPrompt$3 = class GetPrompt2 extends (/* @__PURE__ */ make$Q("prompts/get"
69907
69848
  }
69908
69849
  })) {
69909
69850
  };
69910
- let ListPrompts$2 = class ListPrompts extends (/* @__PURE__ */ make$Q("prompts/list", {
69851
+ let ListPrompts$2 = class ListPrompts extends (/* @__PURE__ */ make$P("prompts/list", {
69911
69852
  success: ListPromptsResult$2,
69912
69853
  error: McpError2,
69913
69854
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
69914
69855
  })) {
69915
69856
  };
69916
- let ListResources$2 = class ListResources extends (/* @__PURE__ */ make$Q("resources/list", {
69857
+ let ListResources$2 = class ListResources extends (/* @__PURE__ */ make$P("resources/list", {
69917
69858
  success: ListResourcesResult$2,
69918
69859
  error: McpError2,
69919
69860
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
69920
69861
  })) {
69921
69862
  };
69922
- let ListResourceTemplates$2 = class ListResourceTemplates extends (/* @__PURE__ */ make$Q("resources/templates/list", {
69863
+ let ListResourceTemplates$2 = class ListResourceTemplates extends (/* @__PURE__ */ make$P("resources/templates/list", {
69923
69864
  success: ListResourceTemplatesResult$2,
69924
69865
  error: McpError2,
69925
69866
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
69926
69867
  })) {
69927
69868
  };
69928
- let ReadResource$1 = class ReadResource2 extends (/* @__PURE__ */ make$Q("resources/read", {
69869
+ let ReadResource$1 = class ReadResource2 extends (/* @__PURE__ */ make$P("resources/read", {
69929
69870
  success: ReadResourceResult$1,
69930
69871
  error: McpError2,
69931
69872
  payload: {
@@ -69934,7 +69875,7 @@ let ReadResource$1 = class ReadResource2 extends (/* @__PURE__ */ make$Q("resour
69934
69875
  }
69935
69876
  })) {
69936
69877
  };
69937
- class Subscribe2 extends (/* @__PURE__ */ make$Q("resources/subscribe", {
69878
+ class Subscribe2 extends (/* @__PURE__ */ make$P("resources/subscribe", {
69938
69879
  success: ResultMeta2,
69939
69880
  error: McpError2,
69940
69881
  payload: {
@@ -69943,7 +69884,7 @@ class Subscribe2 extends (/* @__PURE__ */ make$Q("resources/subscribe", {
69943
69884
  }
69944
69885
  })) {
69945
69886
  }
69946
- class Unsubscribe2 extends (/* @__PURE__ */ make$Q("resources/unsubscribe", {
69887
+ class Unsubscribe2 extends (/* @__PURE__ */ make$P("resources/unsubscribe", {
69947
69888
  success: ResultMeta2,
69948
69889
  error: McpError2,
69949
69890
  payload: {
@@ -69952,7 +69893,7 @@ class Unsubscribe2 extends (/* @__PURE__ */ make$Q("resources/unsubscribe", {
69952
69893
  }
69953
69894
  })) {
69954
69895
  }
69955
- let CallTool$3 = class CallTool2 extends (/* @__PURE__ */ make$Q("tools/call", {
69896
+ let CallTool$3 = class CallTool2 extends (/* @__PURE__ */ make$P("tools/call", {
69956
69897
  success: CallToolResult$3,
69957
69898
  error: McpError2,
69958
69899
  payload: {
@@ -69962,7 +69903,7 @@ let CallTool$3 = class CallTool2 extends (/* @__PURE__ */ make$Q("tools/call", {
69962
69903
  }
69963
69904
  })) {
69964
69905
  };
69965
- let CreateMessage$3 = class CreateMessage2 extends (/* @__PURE__ */ make$Q("sampling/createMessage", {
69906
+ let CreateMessage$3 = class CreateMessage2 extends (/* @__PURE__ */ make$P("sampling/createMessage", {
69966
69907
  success: CreateMessageResult$3,
69967
69908
  error: McpError2,
69968
69909
  payload: {
@@ -69978,13 +69919,13 @@ let CreateMessage$3 = class CreateMessage2 extends (/* @__PURE__ */ make$Q("samp
69978
69919
  }
69979
69920
  })) {
69980
69921
  };
69981
- let ListRoots$1 = class ListRoots2 extends (/* @__PURE__ */ make$Q("roots/list", {
69922
+ let ListRoots$1 = class ListRoots2 extends (/* @__PURE__ */ make$P("roots/list", {
69982
69923
  success: ListRootsResult$1,
69983
69924
  error: McpError2,
69984
69925
  payload: /* @__PURE__ */ UndefinedOr(RequestMeta2)
69985
69926
  })) {
69986
69927
  };
69987
- class CancelledNotification2 extends (/* @__PURE__ */ make$Q("notifications/cancelled", {
69928
+ class CancelledNotification2 extends (/* @__PURE__ */ make$P("notifications/cancelled", {
69988
69929
  payload: {
69989
69930
  ...NotificationMeta2.fields,
69990
69931
  requestId: RequestId,
@@ -69992,7 +69933,7 @@ class CancelledNotification2 extends (/* @__PURE__ */ make$Q("notifications/canc
69992
69933
  }
69993
69934
  })) {
69994
69935
  }
69995
- let ProgressNotification$1 = class ProgressNotification2 extends (/* @__PURE__ */ make$Q("notifications/progress", {
69936
+ let ProgressNotification$1 = class ProgressNotification2 extends (/* @__PURE__ */ make$P("notifications/progress", {
69996
69937
  payload: {
69997
69938
  ...NotificationMeta2.fields,
69998
69939
  progressToken: ProgressToken,
@@ -70001,15 +69942,15 @@ let ProgressNotification$1 = class ProgressNotification2 extends (/* @__PURE__ *
70001
69942
  }
70002
69943
  })) {
70003
69944
  };
70004
- class InitializedNotification extends (/* @__PURE__ */ make$Q("notifications/initialized", {
69945
+ class InitializedNotification extends (/* @__PURE__ */ make$P("notifications/initialized", {
70005
69946
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta2)
70006
69947
  })) {
70007
69948
  }
70008
- class RootsListChangedNotification extends (/* @__PURE__ */ make$Q("notifications/roots/list_changed", {
69949
+ class RootsListChangedNotification extends (/* @__PURE__ */ make$P("notifications/roots/list_changed", {
70009
69950
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta2)
70010
69951
  })) {
70011
69952
  }
70012
- class LoggingMessageNotification2 extends (/* @__PURE__ */ make$Q("notifications/message", {
69953
+ class LoggingMessageNotification2 extends (/* @__PURE__ */ make$P("notifications/message", {
70013
69954
  payload: {
70014
69955
  ...NotificationMeta2.fields,
70015
69956
  level: LoggingLevel,
@@ -70018,22 +69959,22 @@ class LoggingMessageNotification2 extends (/* @__PURE__ */ make$Q("notifications
70018
69959
  }
70019
69960
  })) {
70020
69961
  }
70021
- class ResourceUpdatedNotification2 extends (/* @__PURE__ */ make$Q("notifications/resources/updated", {
69962
+ class ResourceUpdatedNotification2 extends (/* @__PURE__ */ make$P("notifications/resources/updated", {
70022
69963
  payload: {
70023
69964
  ...NotificationMeta2.fields,
70024
69965
  uri: String$1
70025
69966
  }
70026
69967
  })) {
70027
69968
  }
70028
- class ResourceListChangedNotification2 extends (/* @__PURE__ */ make$Q("notifications/resources/list_changed", {
69969
+ class ResourceListChangedNotification2 extends (/* @__PURE__ */ make$P("notifications/resources/list_changed", {
70029
69970
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta2)
70030
69971
  })) {
70031
69972
  }
70032
- class ToolListChangedNotification2 extends (/* @__PURE__ */ make$Q("notifications/tools/list_changed", {
69973
+ class ToolListChangedNotification2 extends (/* @__PURE__ */ make$P("notifications/tools/list_changed", {
70033
69974
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta2)
70034
69975
  })) {
70035
69976
  }
70036
- class PromptListChangedNotification2 extends (/* @__PURE__ */ make$Q("notifications/prompts/list_changed", {
69977
+ class PromptListChangedNotification2 extends (/* @__PURE__ */ make$P("notifications/prompts/list_changed", {
70037
69978
  payload: /* @__PURE__ */ UndefinedOr(NotificationMeta2)
70038
69979
  })) {
70039
69980
  }
@@ -70098,7 +70039,7 @@ const CreateMessageResult$2 = /* @__PURE__ */ Struct({
70098
70039
  model: String$1,
70099
70040
  stopReason: /* @__PURE__ */ optional$3(String$1)
70100
70041
  });
70101
- let Initialize$2 = class Initialize3 extends (/* @__PURE__ */ make$Q("initialize", {
70042
+ let Initialize$2 = class Initialize3 extends (/* @__PURE__ */ make$P("initialize", {
70102
70043
  success: InitializeResult$2,
70103
70044
  error: McpError2,
70104
70045
  payload: {
@@ -70109,7 +70050,7 @@ let Initialize$2 = class Initialize3 extends (/* @__PURE__ */ make$Q("initialize
70109
70050
  }
70110
70051
  })) {
70111
70052
  };
70112
- let GetPrompt$2 = class GetPrompt3 extends (/* @__PURE__ */ make$Q("prompts/get", {
70053
+ let GetPrompt$2 = class GetPrompt3 extends (/* @__PURE__ */ make$P("prompts/get", {
70113
70054
  success: GetPromptResult$2,
70114
70055
  error: McpError2,
70115
70056
  payload: {
@@ -70119,13 +70060,13 @@ let GetPrompt$2 = class GetPrompt3 extends (/* @__PURE__ */ make$Q("prompts/get"
70119
70060
  }
70120
70061
  })) {
70121
70062
  };
70122
- let ListTools$2 = class ListTools extends (/* @__PURE__ */ make$Q("tools/list", {
70063
+ let ListTools$2 = class ListTools extends (/* @__PURE__ */ make$P("tools/list", {
70123
70064
  success: ListToolsResult$2,
70124
70065
  error: McpError2,
70125
70066
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
70126
70067
  })) {
70127
70068
  };
70128
- let CallTool$2 = class CallTool3 extends (/* @__PURE__ */ make$Q("tools/call", {
70069
+ let CallTool$2 = class CallTool3 extends (/* @__PURE__ */ make$P("tools/call", {
70129
70070
  success: CallToolResult$2,
70130
70071
  error: McpError2,
70131
70072
  payload: {
@@ -70135,7 +70076,7 @@ let CallTool$2 = class CallTool3 extends (/* @__PURE__ */ make$Q("tools/call", {
70135
70076
  }
70136
70077
  })) {
70137
70078
  };
70138
- let CreateMessage$2 = class CreateMessage3 extends (/* @__PURE__ */ make$Q("sampling/createMessage", {
70079
+ let CreateMessage$2 = class CreateMessage3 extends (/* @__PURE__ */ make$P("sampling/createMessage", {
70139
70080
  success: CreateMessageResult$2,
70140
70081
  error: McpError2,
70141
70082
  payload: {
@@ -70151,7 +70092,7 @@ let CreateMessage$2 = class CreateMessage3 extends (/* @__PURE__ */ make$Q("samp
70151
70092
  }
70152
70093
  })) {
70153
70094
  };
70154
- class ProgressNotification3 extends (/* @__PURE__ */ make$Q("notifications/progress", {
70095
+ class ProgressNotification3 extends (/* @__PURE__ */ make$P("notifications/progress", {
70155
70096
  payload: {
70156
70097
  ...NotificationMeta2.fields,
70157
70098
  progressToken: ProgressToken,
@@ -70161,13 +70102,13 @@ class ProgressNotification3 extends (/* @__PURE__ */ make$Q("notifications/progr
70161
70102
  }
70162
70103
  })) {
70163
70104
  }
70164
- let ClientRequestRpcs$5 = class ClientRequestRpcs extends (/* @__PURE__ */ make$P(Ping2, Initialize$2, Complete$1, SetLevel2, GetPrompt$2, ListPrompts$2, ListResources$2, ListResourceTemplates$2, ReadResource$1, Subscribe2, Unsubscribe2, CallTool$2, ListTools$2)) {
70105
+ let ClientRequestRpcs$5 = class ClientRequestRpcs extends (/* @__PURE__ */ make$O(Ping2, Initialize$2, Complete$1, SetLevel2, GetPrompt$2, ListPrompts$2, ListResources$2, ListResourceTemplates$2, ReadResource$1, Subscribe2, Unsubscribe2, CallTool$2, ListTools$2)) {
70165
70106
  };
70166
- let ClientNotificationRpcs$2 = class ClientNotificationRpcs extends (/* @__PURE__ */ make$P(CancelledNotification2, ProgressNotification3, InitializedNotification, RootsListChangedNotification)) {
70107
+ let ClientNotificationRpcs$2 = class ClientNotificationRpcs extends (/* @__PURE__ */ make$O(CancelledNotification2, ProgressNotification3, InitializedNotification, RootsListChangedNotification)) {
70167
70108
  };
70168
- let ServerRequestRpcs$2 = class ServerRequestRpcs extends (/* @__PURE__ */ make$P(Ping2, CreateMessage$2, ListRoots$1)) {
70109
+ let ServerRequestRpcs$2 = class ServerRequestRpcs extends (/* @__PURE__ */ make$O(Ping2, CreateMessage$2, ListRoots$1)) {
70169
70110
  };
70170
- let ServerNotificationRpcs$2 = class ServerNotificationRpcs2 extends (/* @__PURE__ */ make$P(CancelledNotification2, ProgressNotification3, LoggingMessageNotification2, ResourceUpdatedNotification2, ResourceListChangedNotification2, ToolListChangedNotification2, PromptListChangedNotification2)) {
70111
+ let ServerNotificationRpcs$2 = class ServerNotificationRpcs2 extends (/* @__PURE__ */ make$O(CancelledNotification2, ProgressNotification3, LoggingMessageNotification2, ResourceUpdatedNotification2, ResourceListChangedNotification2, ToolListChangedNotification2, PromptListChangedNotification2)) {
70171
70112
  };
70172
70113
  const ClientRequestRpcs$4 = /* @__PURE__ */ ClientRequestRpcs$5.omit("ping").middleware(McpServerClientMiddleware).add(Ping2);
70173
70114
  const ClientRpcs$2 = /* @__PURE__ */ ClientRequestRpcs$4.merge(ClientNotificationRpcs$2);
@@ -70238,7 +70179,7 @@ const projectResourceContents$1 = (content) => "text" in content ? {
70238
70179
  mimeType: content.mimeType,
70239
70180
  blob: encode$1(content.blob)
70240
70181
  };
70241
- const protocol$2 = /* @__PURE__ */ make$M({
70182
+ const protocol$2 = /* @__PURE__ */ make$L({
70242
70183
  protocolVersion: protocolVersion$2,
70243
70184
  runtime: /* @__PURE__ */ stateful({
70244
70185
  jsonRpc: {
@@ -70545,7 +70486,7 @@ const InitializeResult$1 = /* @__PURE__ */ Struct({
70545
70486
  serverInfo: Implementation$1,
70546
70487
  instructions: /* @__PURE__ */ optional$2(String$1)
70547
70488
  });
70548
- let Initialize$1 = class Initialize4 extends (/* @__PURE__ */ make$Q("initialize", {
70489
+ let Initialize$1 = class Initialize4 extends (/* @__PURE__ */ make$P("initialize", {
70549
70490
  success: InitializeResult$1,
70550
70491
  error: McpError2,
70551
70492
  payload: {
@@ -70583,7 +70524,7 @@ const CreateMessageResult$1 = /* @__PURE__ */ Struct({
70583
70524
  model: String$1,
70584
70525
  stopReason: /* @__PURE__ */ optional$2(String$1)
70585
70526
  });
70586
- let CreateMessage$1 = class CreateMessage4 extends (/* @__PURE__ */ make$Q("sampling/createMessage", {
70527
+ let CreateMessage$1 = class CreateMessage4 extends (/* @__PURE__ */ make$P("sampling/createMessage", {
70587
70528
  success: CreateMessageResult$1,
70588
70529
  error: McpError2,
70589
70530
  payload: {
@@ -70608,7 +70549,7 @@ const ResourceTemplateReference = /* @__PURE__ */ Struct({
70608
70549
  uri: String$1
70609
70550
  });
70610
70551
  const CompleteResult2 = CompleteResult$1;
70611
- class Complete2 extends (/* @__PURE__ */ make$Q("completion/complete", {
70552
+ class Complete2 extends (/* @__PURE__ */ make$P("completion/complete", {
70612
70553
  success: CompleteResult2,
70613
70554
  error: McpError2,
70614
70555
  payload: {
@@ -70649,19 +70590,19 @@ const ListToolsResult$1 = /* @__PURE__ */ Struct({
70649
70590
  ...PaginatedResult.fields,
70650
70591
  tools: /* @__PURE__ */ ArraySchema(Tool$1)
70651
70592
  });
70652
- let ListResources$1 = class ListResources2 extends (/* @__PURE__ */ make$Q("resources/list", {
70593
+ let ListResources$1 = class ListResources2 extends (/* @__PURE__ */ make$P("resources/list", {
70653
70594
  success: ListResourcesResult$1,
70654
70595
  error: McpError2,
70655
70596
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
70656
70597
  })) {
70657
70598
  };
70658
- let ListResourceTemplates$1 = class ListResourceTemplates2 extends (/* @__PURE__ */ make$Q("resources/templates/list", {
70599
+ let ListResourceTemplates$1 = class ListResourceTemplates2 extends (/* @__PURE__ */ make$P("resources/templates/list", {
70659
70600
  success: ListResourceTemplatesResult$1,
70660
70601
  error: McpError2,
70661
70602
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
70662
70603
  })) {
70663
70604
  };
70664
- class ReadResource3 extends (/* @__PURE__ */ make$Q("resources/read", {
70605
+ class ReadResource3 extends (/* @__PURE__ */ make$P("resources/read", {
70665
70606
  success: ReadResourceResult2,
70666
70607
  error: McpError2,
70667
70608
  payload: {
@@ -70670,13 +70611,13 @@ class ReadResource3 extends (/* @__PURE__ */ make$Q("resources/read", {
70670
70611
  }
70671
70612
  })) {
70672
70613
  }
70673
- let ListPrompts$1 = class ListPrompts2 extends (/* @__PURE__ */ make$Q("prompts/list", {
70614
+ let ListPrompts$1 = class ListPrompts2 extends (/* @__PURE__ */ make$P("prompts/list", {
70674
70615
  success: ListPromptsResult$1,
70675
70616
  error: McpError2,
70676
70617
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
70677
70618
  })) {
70678
70619
  };
70679
- let GetPrompt$1 = class GetPrompt4 extends (/* @__PURE__ */ make$Q("prompts/get", {
70620
+ let GetPrompt$1 = class GetPrompt4 extends (/* @__PURE__ */ make$P("prompts/get", {
70680
70621
  success: GetPromptResult$1,
70681
70622
  error: McpError2,
70682
70623
  payload: {
@@ -70686,13 +70627,13 @@ let GetPrompt$1 = class GetPrompt4 extends (/* @__PURE__ */ make$Q("prompts/get"
70686
70627
  }
70687
70628
  })) {
70688
70629
  };
70689
- let ListTools$1 = class ListTools2 extends (/* @__PURE__ */ make$Q("tools/list", {
70630
+ let ListTools$1 = class ListTools2 extends (/* @__PURE__ */ make$P("tools/list", {
70690
70631
  success: ListToolsResult$1,
70691
70632
  error: McpError2,
70692
70633
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
70693
70634
  })) {
70694
70635
  };
70695
- let CallTool$1 = class CallTool4 extends (/* @__PURE__ */ make$Q("tools/call", {
70636
+ let CallTool$1 = class CallTool4 extends (/* @__PURE__ */ make$P("tools/call", {
70696
70637
  success: CallToolResult$1,
70697
70638
  error: McpError2,
70698
70639
  payload: {
@@ -70740,7 +70681,7 @@ const RequestedSchema$1 = /* @__PURE__ */ Struct({
70740
70681
  properties: /* @__PURE__ */ Record(String$1, /* @__PURE__ */ Union([StringSchema$1, NumberSchema$1, BooleanSchema$1, EnumSchema$1])),
70741
70682
  required: /* @__PURE__ */ optional$2(/* @__PURE__ */ ArraySchema(String$1))
70742
70683
  });
70743
- let Elicit$1 = class Elicit2 extends (/* @__PURE__ */ make$Q("elicitation/create", {
70684
+ let Elicit$1 = class Elicit2 extends (/* @__PURE__ */ make$P("elicitation/create", {
70744
70685
  success: ElicitResult$1,
70745
70686
  error: McpError2,
70746
70687
  payload: {
@@ -70750,13 +70691,13 @@ let Elicit$1 = class Elicit2 extends (/* @__PURE__ */ make$Q("elicitation/create
70750
70691
  }
70751
70692
  })) {
70752
70693
  };
70753
- let ClientRequestRpcs$3 = class ClientRequestRpcs2 extends (/* @__PURE__ */ make$P(Ping2, Initialize$1, Complete2, SetLevel2, GetPrompt$1, ListPrompts$1, ListResources$1, ListResourceTemplates$1, ReadResource3, Subscribe2, Unsubscribe2, CallTool$1, ListTools$1)) {
70694
+ let ClientRequestRpcs$3 = class ClientRequestRpcs2 extends (/* @__PURE__ */ make$O(Ping2, Initialize$1, Complete2, SetLevel2, GetPrompt$1, ListPrompts$1, ListResources$1, ListResourceTemplates$1, ReadResource3, Subscribe2, Unsubscribe2, CallTool$1, ListTools$1)) {
70754
70695
  };
70755
- let ClientNotificationRpcs$1 = class ClientNotificationRpcs2 extends (/* @__PURE__ */ make$P(CancelledNotification2, ProgressNotification3, InitializedNotification, RootsListChangedNotification)) {
70696
+ let ClientNotificationRpcs$1 = class ClientNotificationRpcs2 extends (/* @__PURE__ */ make$O(CancelledNotification2, ProgressNotification3, InitializedNotification, RootsListChangedNotification)) {
70756
70697
  };
70757
- let ServerRequestRpcs$1 = class ServerRequestRpcs2 extends (/* @__PURE__ */ make$P(Ping2, CreateMessage$1, ListRoots$1, Elicit$1)) {
70698
+ let ServerRequestRpcs$1 = class ServerRequestRpcs2 extends (/* @__PURE__ */ make$O(Ping2, CreateMessage$1, ListRoots$1, Elicit$1)) {
70758
70699
  };
70759
- let ServerNotificationRpcs$1 = class ServerNotificationRpcs3 extends (/* @__PURE__ */ make$P(CancelledNotification2, ProgressNotification3, LoggingMessageNotification2, ResourceUpdatedNotification2, ResourceListChangedNotification2, ToolListChangedNotification2, PromptListChangedNotification2)) {
70700
+ let ServerNotificationRpcs$1 = class ServerNotificationRpcs3 extends (/* @__PURE__ */ make$O(CancelledNotification2, ProgressNotification3, LoggingMessageNotification2, ResourceUpdatedNotification2, ResourceListChangedNotification2, ToolListChangedNotification2, PromptListChangedNotification2)) {
70760
70701
  };
70761
70702
  const ClientRequestRpcs$2 = /* @__PURE__ */ ClientRequestRpcs$3.omit("ping").middleware(McpServerClientMiddleware).add(Ping2);
70762
70703
  const ClientRpcs$1 = /* @__PURE__ */ ClientRequestRpcs$2.merge(ClientNotificationRpcs$1);
@@ -70835,7 +70776,7 @@ const projectResourceContents = (content) => "text" in content ? {
70835
70776
  };
70836
70777
  const projectStructuredContent$1 = (content) => content === void 0 || isJsonObject$1(content) ? content : void 0;
70837
70778
  const isJsonObject$1 = (value2) => isReadonlyObject(value2);
70838
- const protocol$1 = /* @__PURE__ */ make$M({
70779
+ const protocol$1 = /* @__PURE__ */ make$L({
70839
70780
  protocolVersion: protocolVersion$1,
70840
70781
  runtime: /* @__PURE__ */ stateful({
70841
70782
  jsonRpc: {
@@ -71123,7 +71064,7 @@ const CallToolResult2 = /* @__PURE__ */ Struct({
71123
71064
  ...CallToolResult$1.fields,
71124
71065
  content: /* @__PURE__ */ ArraySchema(ContentBlock)
71125
71066
  });
71126
- class CallTool5 extends (/* @__PURE__ */ make$Q("tools/call", {
71067
+ class CallTool5 extends (/* @__PURE__ */ make$P("tools/call", {
71127
71068
  success: CallToolResult2,
71128
71069
  error: McpError2,
71129
71070
  payload: CallTool$1.payloadSchema
@@ -71159,7 +71100,7 @@ const CreateMessageResult2 = /* @__PURE__ */ Struct({
71159
71100
  model: String$1,
71160
71101
  stopReason: /* @__PURE__ */ optional$1(String$1)
71161
71102
  });
71162
- class CreateMessage5 extends (/* @__PURE__ */ make$Q("sampling/createMessage", {
71103
+ class CreateMessage5 extends (/* @__PURE__ */ make$P("sampling/createMessage", {
71163
71104
  success: CreateMessageResult2,
71164
71105
  error: McpError2,
71165
71106
  payload: {
@@ -71179,7 +71120,7 @@ const ListRootsResult2 = /* @__PURE__ */ Struct({
71179
71120
  ...ResultMeta2.fields,
71180
71121
  roots: /* @__PURE__ */ ArraySchema(Root2)
71181
71122
  });
71182
- class ListRoots3 extends (/* @__PURE__ */ make$Q("roots/list", {
71123
+ class ListRoots3 extends (/* @__PURE__ */ make$P("roots/list", {
71183
71124
  success: ListRootsResult2,
71184
71125
  error: McpError2,
71185
71126
  payload: /* @__PURE__ */ UndefinedOr(RequestMeta2)
@@ -71286,13 +71227,13 @@ const ElicitResult = /* @__PURE__ */ Struct({
71286
71227
  action: /* @__PURE__ */ Literals(["accept", "decline", "cancel"]),
71287
71228
  content: /* @__PURE__ */ optional$1(/* @__PURE__ */ Record(String$1, /* @__PURE__ */ Union([String$1, Finite, Boolean$1, /* @__PURE__ */ ArraySchema(String$1)])))
71288
71229
  });
71289
- class Elicit3 extends (/* @__PURE__ */ make$Q("elicitation/create", {
71230
+ class Elicit3 extends (/* @__PURE__ */ make$P("elicitation/create", {
71290
71231
  success: ElicitResult,
71291
71232
  error: McpError2,
71292
71233
  payload: ElicitRequestParams
71293
71234
  })) {
71294
71235
  }
71295
- class ElicitationCompleteNotification2 extends (/* @__PURE__ */ make$Q("notifications/elicitation/complete", {
71236
+ class ElicitationCompleteNotification2 extends (/* @__PURE__ */ make$P("notifications/elicitation/complete", {
71296
71237
  payload: {
71297
71238
  elicitationId: String$1
71298
71239
  }
@@ -71302,7 +71243,7 @@ const InitializeResult2 = /* @__PURE__ */ Struct({
71302
71243
  ...InitializeResult$1.fields,
71303
71244
  serverInfo: Implementation2
71304
71245
  });
71305
- class Initialize5 extends (/* @__PURE__ */ make$Q("initialize", {
71246
+ class Initialize5 extends (/* @__PURE__ */ make$P("initialize", {
71306
71247
  success: InitializeResult2,
71307
71248
  error: McpError2,
71308
71249
  payload: {
@@ -71332,25 +71273,25 @@ const ListToolsResult2 = /* @__PURE__ */ Struct({
71332
71273
  ...PaginatedResult.fields,
71333
71274
  tools: /* @__PURE__ */ ArraySchema(Tool2)
71334
71275
  });
71335
- class ListResources3 extends (/* @__PURE__ */ make$Q("resources/list", {
71276
+ class ListResources3 extends (/* @__PURE__ */ make$P("resources/list", {
71336
71277
  success: ListResourcesResult2,
71337
71278
  error: McpError2,
71338
71279
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
71339
71280
  })) {
71340
71281
  }
71341
- class ListResourceTemplates3 extends (/* @__PURE__ */ make$Q("resources/templates/list", {
71282
+ class ListResourceTemplates3 extends (/* @__PURE__ */ make$P("resources/templates/list", {
71342
71283
  success: ListResourceTemplatesResult2,
71343
71284
  error: McpError2,
71344
71285
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
71345
71286
  })) {
71346
71287
  }
71347
- class ListPrompts3 extends (/* @__PURE__ */ make$Q("prompts/list", {
71288
+ class ListPrompts3 extends (/* @__PURE__ */ make$P("prompts/list", {
71348
71289
  success: ListPromptsResult2,
71349
71290
  error: McpError2,
71350
71291
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
71351
71292
  })) {
71352
71293
  }
71353
- class GetPrompt5 extends (/* @__PURE__ */ make$Q("prompts/get", {
71294
+ class GetPrompt5 extends (/* @__PURE__ */ make$P("prompts/get", {
71354
71295
  success: GetPromptResult2,
71355
71296
  error: McpError2,
71356
71297
  payload: {
@@ -71360,19 +71301,19 @@ class GetPrompt5 extends (/* @__PURE__ */ make$Q("prompts/get", {
71360
71301
  }
71361
71302
  })) {
71362
71303
  }
71363
- class ListTools3 extends (/* @__PURE__ */ make$Q("tools/list", {
71304
+ class ListTools3 extends (/* @__PURE__ */ make$P("tools/list", {
71364
71305
  success: ListToolsResult2,
71365
71306
  error: McpError2,
71366
71307
  payload: /* @__PURE__ */ UndefinedOr(PaginatedRequest)
71367
71308
  })) {
71368
71309
  }
71369
- let ClientRequestRpcs$1 = class ClientRequestRpcs3 extends (/* @__PURE__ */ make$P(Ping2, Initialize5, Complete2, SetLevel2, GetPrompt5, ListPrompts3, ListResources3, ListResourceTemplates3, ReadResource3, Subscribe2, Unsubscribe2, CallTool5, ListTools3)) {
71310
+ let ClientRequestRpcs$1 = class ClientRequestRpcs3 extends (/* @__PURE__ */ make$O(Ping2, Initialize5, Complete2, SetLevel2, GetPrompt5, ListPrompts3, ListResources3, ListResourceTemplates3, ReadResource3, Subscribe2, Unsubscribe2, CallTool5, ListTools3)) {
71370
71311
  };
71371
- class ClientNotificationRpcs3 extends (/* @__PURE__ */ make$P(CancelledNotification2, ProgressNotification3, InitializedNotification, RootsListChangedNotification)) {
71312
+ class ClientNotificationRpcs3 extends (/* @__PURE__ */ make$O(CancelledNotification2, ProgressNotification3, InitializedNotification, RootsListChangedNotification)) {
71372
71313
  }
71373
- class ServerRequestRpcs3 extends (/* @__PURE__ */ make$P(Ping2, CreateMessage5, ListRoots3, Elicit3)) {
71314
+ class ServerRequestRpcs3 extends (/* @__PURE__ */ make$O(Ping2, CreateMessage5, ListRoots3, Elicit3)) {
71374
71315
  }
71375
- class ServerNotificationRpcs4 extends (/* @__PURE__ */ make$P(CancelledNotification2, ProgressNotification3, LoggingMessageNotification2, ResourceUpdatedNotification2, ResourceListChangedNotification2, ToolListChangedNotification2, PromptListChangedNotification2, ElicitationCompleteNotification2)) {
71316
+ class ServerNotificationRpcs4 extends (/* @__PURE__ */ make$O(CancelledNotification2, ProgressNotification3, LoggingMessageNotification2, ResourceUpdatedNotification2, ResourceListChangedNotification2, ToolListChangedNotification2, PromptListChangedNotification2, ElicitationCompleteNotification2)) {
71376
71317
  }
71377
71318
  const ClientRequestRpcs4 = /* @__PURE__ */ ClientRequestRpcs$1.omit("ping").middleware(McpServerClientMiddleware).add(Ping2);
71378
71319
  const ClientRpcs = /* @__PURE__ */ ClientRequestRpcs4.merge(ClientNotificationRpcs3);
@@ -71440,7 +71381,7 @@ const projectContent = /* @__PURE__ */ fnUntraced(function* (content) {
71440
71381
  });
71441
71382
  const projectStructuredContent = (content) => content === void 0 || isJsonObject(content) ? content : void 0;
71442
71383
  const isJsonObject = (value2) => isReadonlyObject(value2);
71443
- const protocol = /* @__PURE__ */ make$M({
71384
+ const protocol = /* @__PURE__ */ make$L({
71444
71385
  protocolVersion,
71445
71386
  runtime: /* @__PURE__ */ stateful({
71446
71387
  jsonRpc: {
@@ -71785,7 +71726,7 @@ const OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
71785
71726
  const emptyParamsArray = [];
71786
71727
  const CLEAN_SINGLE_PARAM_REGEXP = /^[^:*(]*\/:[^/:*(.-]+$/;
71787
71728
  const isCleanSingleTrailingParam = (path2) => CLEAN_SINGLE_PARAM_REGEXP.test(path2);
71788
- const make$I = (options = {}) => new RouterImpl(options);
71729
+ const make$H = (options = {}) => new RouterImpl(options);
71789
71730
  class RouterImpl {
71790
71731
  constructor(options = {}) {
71791
71732
  this.options = {
@@ -72474,11 +72415,11 @@ function safeDecodeURIComponent(uriComponent) {
72474
72415
  return uriComponent.slice(0, startIndex) + decoded + uriComponent.slice(lastIndex);
72475
72416
  }
72476
72417
  const httpMethods = ["ACL", "BIND", "CHECKOUT", "CONNECT", "COPY", "DELETE", "GET", "HEAD", "LINK", "LOCK", "M-SEARCH", "MERGE", "MKACTIVITY", "MKCALENDAR", "MKCOL", "MOVE", "NOTIFY", "OPTIONS", "PATCH", "POST", "PROPFIND", "PROPPATCH", "PURGE", "PUT", "QUERY", "REBIND", "REPORT", "SEARCH", "SOURCE", "SUBSCRIBE", "TRACE", "UNBIND", "UNLINK", "UNLOCK", "UNSUBSCRIBE"];
72477
- const make$H = make$I;
72418
+ const make$G = make$H;
72478
72419
  const TypeId$1 = "~effect/http/HttpRouter";
72479
72420
  const HttpRouter = /* @__PURE__ */ Service$1("effect/http/HttpRouter");
72480
- const make$G = /* @__PURE__ */ gen(function* () {
72481
- const router = make$H(yield* RouterConfig);
72421
+ const make$F = /* @__PURE__ */ gen(function* () {
72422
+ const router = make$G(yield* RouterConfig);
72482
72423
  const middleware2 = /* @__PURE__ */ new Set();
72483
72424
  const addAll = (routes2) => contextWith$1((context2) => {
72484
72425
  const middleware3 = getMiddleware(context2);
@@ -72592,7 +72533,7 @@ class RouteContext extends (/* @__PURE__ */ Service$1()("effect/http/HttpRouter/
72592
72533
  const params = /* @__PURE__ */ withFiberSucceed((fiber) => getUnsafe$1(fiber.context, RouteContext).params);
72593
72534
  const use = (f) => effectDiscard(flatMap(HttpRouter, f));
72594
72535
  const add = (method2, path2, handler, options) => use((router) => router.add(method2, path2, handler, options));
72595
- const layer$N = /* @__PURE__ */ effect(HttpRouter)(make$G);
72536
+ const layer$K = /* @__PURE__ */ effect(HttpRouter)(make$F);
72596
72537
  const RouteTypeId = "~effect/http/HttpRouter/Route";
72597
72538
  const makeRoute = (options) => ({
72598
72539
  ...options,
@@ -72633,7 +72574,7 @@ const makeMiddleware = (middleware2, options) => options?.global ? effectDiscard
72633
72574
  const router = yield* HttpRouter;
72634
72575
  const fn2 = isEffect(middleware2) ? yield* middleware2 : middleware2;
72635
72576
  yield* router.addGlobalMiddleware(fn2);
72636
- })) : new MiddlewareImpl(isEffect(middleware2) ? effectContext(map$2(middleware2, (fn2) => makeUnsafe$7(/* @__PURE__ */ new Map([[fnContextKey, fn2]])))) : succeedContext(makeUnsafe$7(/* @__PURE__ */ new Map([[fnContextKey, middleware2]]))));
72577
+ })) : new MiddlewareImpl(isEffect(middleware2) ? effectContext(map$2(middleware2, (fn2) => makeUnsafe$6(/* @__PURE__ */ new Map([[fnContextKey, fn2]])))) : succeedContext(makeUnsafe$6(/* @__PURE__ */ new Map([[fnContextKey, middleware2]]))));
72637
72578
  let middlewareId = 0;
72638
72579
  const fnContextKey = "effect/http/HttpRouter/MiddlewareFn";
72639
72580
  class MiddlewareImpl {
@@ -72655,7 +72596,7 @@ class MiddlewareImpl {
72655
72596
  const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope2);
72656
72597
  stack.push(...getMiddleware(depsContext));
72657
72598
  }
72658
- return makeUnsafe$7(/* @__PURE__ */ new Map([[contextKey, stack]]));
72599
+ return makeUnsafe$6(/* @__PURE__ */ new Map([[contextKey, stack]]));
72659
72600
  })).pipe(provide$2(this.layerFn));
72660
72601
  }
72661
72602
  layer;
@@ -72699,7 +72640,7 @@ const serve$1 = (appLayer, options) => {
72699
72640
  if (options?.disableLogger !== true) {
72700
72641
  middleware2 = middleware2 ? compose$1(middleware2, logger) : logger;
72701
72642
  }
72702
- const layerWithRouter = provideMerge(appLayer, options?.routerConfig ? provide$2(layer$N, succeed$5(RouterConfig)(options.routerConfig)) : layer$N);
72643
+ const layerWithRouter = provideMerge(appLayer, options?.routerConfig ? provide$2(layer$K, succeed$5(RouterConfig)(options.routerConfig)) : layer$K);
72703
72644
  return contextWith$1((context2) => {
72704
72645
  const memoMap = CurrentMemoMap.forkOrCreate(context2);
72705
72646
  return buildWithMemoMap(layerWithRouter, memoMap, get$6(context2, Scope));
@@ -72719,10 +72660,10 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
72719
72660
  const services = yield* context();
72720
72661
  const scope2 = get$6(services, Scope);
72721
72662
  const trackFiber = runIn(forkUnsafe$1(scope2, "parallel"));
72722
- const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$1w(concurrency);
72663
+ const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$1u(concurrency);
72723
72664
  const clients = /* @__PURE__ */ new Map();
72724
72665
  let isShutdown = false;
72725
- const shutdownLatch = makeUnsafe$a(false);
72666
+ const shutdownLatch = makeUnsafe$9(false);
72726
72667
  yield* addFinalizer(scope2, withFiber((parent) => {
72727
72668
  isShutdown = true;
72728
72669
  for (const client2 of clients.values()) {
@@ -72841,7 +72782,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
72841
72782
  }) : streamOrEffect;
72842
72783
  const withMiddleware = rpc2.middlewares.size === 0 ? handler : isStream2 ? flatMap(exit(applyMiddleware(services, handler, metadata2)), (exit2) => writeFailure ? failCause(writeFailure) : exit2) : applyMiddleware(services, handler, metadata2);
72843
72784
  let responded = false;
72844
- const scope3 = makeUnsafe$5();
72785
+ const scope3 = makeUnsafe$4();
72845
72786
  let deferred = void 0;
72846
72787
  let effect2 = onExit(withMiddleware, (exit2) => {
72847
72788
  responded = true;
@@ -72954,7 +72895,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
72954
72895
  client2.latches ??= /* @__PURE__ */ new Map();
72955
72896
  latch = client2.latches.get(request2.id);
72956
72897
  if (!latch) {
72957
- latch = makeUnsafe$a(false);
72898
+ latch = makeUnsafe$9(false);
72958
72899
  client2.latches.set(request2.id, latch);
72959
72900
  }
72960
72901
  }
@@ -73013,7 +72954,7 @@ const applyMiddleware = (context2, handler, options) => {
73013
72954
  }
73014
72955
  return handler;
73015
72956
  };
73016
- const make$F = /* @__PURE__ */ fnUntraced(function* (group, options) {
72957
+ const make$E = /* @__PURE__ */ fnUntraced(function* (group, options) {
73017
72958
  const {
73018
72959
  codecFor,
73019
72960
  disconnects,
@@ -73027,7 +72968,7 @@ const make$F = /* @__PURE__ */ fnUntraced(function* (group, options) {
73027
72968
  const encodeDefectUnsafe = encodeSync(codecFor(Defect()));
73028
72969
  const encodeUnknownRequestExit = encodeUnknownEffect(codecFor(Exit(Never, Never, Defect())));
73029
72970
  const services = yield* context();
73030
- const scope2 = yield* make$1s();
72971
+ const scope2 = yield* make$1q();
73031
72972
  const server2 = yield* makeNoSerialization(group, {
73032
72973
  ...options,
73033
72974
  disableClientAcks: !supportsAck,
@@ -73199,7 +73140,7 @@ const makeProtocolWithHttpEffect = /* @__PURE__ */ fnUntraced(function* (options
73199
73140
  const encodeDefectUnsafe = encodeSync(serialization.codecFor(Defect()));
73200
73141
  const includesFraming = serialization.includesFraming;
73201
73142
  const isBinary = !serialization.contentType.includes("json");
73202
- const disconnects = yield* make$1r();
73143
+ const disconnects = yield* make$1p();
73203
73144
  let writeRequest;
73204
73145
  let clientId = 0;
73205
73146
  const clients = /* @__PURE__ */ new Map();
@@ -73212,7 +73153,7 @@ const makeProtocolWithHttpEffect = /* @__PURE__ */ fnUntraced(function* (options
73212
73153
  const requestHeaders = Object.entries(request2.headers);
73213
73154
  const data = yield* orDie(isBinary ? map$2(request2.arrayBuffer, (buf) => new Uint8Array(buf)) : request2.text);
73214
73155
  const id2 = clientId++;
73215
- const queue = yield* make$1r({
73156
+ const queue = yield* make$1p({
73216
73157
  capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0
73217
73158
  });
73218
73159
  const parser2 = serialization.makeUnsafe();
@@ -73382,12 +73323,12 @@ class McpServer extends (/* @__PURE__ */ Service$1()("effect/ai/McpServer")) {
73382
73323
  * @since 4.0.0
73383
73324
  */
73384
73325
  static make = /* @__PURE__ */ gen(function* () {
73385
- const internalCore = yield* make$O;
73326
+ const internalCore = yield* make$N;
73386
73327
  const tools = empty$8();
73387
73328
  const resources = [];
73388
73329
  const resourceTemplates = [];
73389
73330
  const prompts = [];
73390
- const notificationsQueue = yield* make$1r();
73331
+ const notificationsQueue = yield* make$1p();
73391
73332
  const notificationDelivery = {
73392
73333
  consumers: 0,
73393
73334
  listChangeRevision: 0
@@ -73396,7 +73337,7 @@ class McpServer extends (/* @__PURE__ */ Service$1()("effect/ai/McpServer")) {
73396
73337
  const dispatcher2 = (yield* Scheduler$1).makeDispatcher();
73397
73338
  const notifications = yield* makeNoSerialization$1(BroadcastServerNotificationRpcs, {
73398
73339
  spanPrefix: "McpServer/Notifications",
73399
- onFromClient: (options) => make$1u().pipe(flatMap((delivered) => withFiber((fiber) => {
73340
+ onFromClient: (options) => make$1s().pipe(flatMap((delivered) => withFiber((fiber) => {
73400
73341
  const message2 = options.message;
73401
73342
  if (message2._tag !== "Request") {
73402
73343
  return void_;
@@ -73444,7 +73385,7 @@ class McpServer extends (/* @__PURE__ */ Service$1()("effect/ai/McpServer")) {
73444
73385
  notifyElicitationComplete: ({
73445
73386
  clientId,
73446
73387
  elicitationId
73447
- }) => make$1u().pipe(flatMap((delivered) => offer(notificationsQueue, {
73388
+ }) => make$1s().pipe(flatMap((delivered) => offer(notificationsQueue, {
73448
73389
  notification: ServerNotification.ElicitationComplete({
73449
73390
  elicitationId
73450
73391
  }),
@@ -73775,7 +73716,7 @@ const runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, t
73775
73716
  defaultLogLevel,
73776
73717
  serverInfo: options
73777
73718
  });
73778
- const clients = yield* make$1o({
73719
+ const clients = yield* make$1m({
73779
73720
  lookup: fnUntraced(function* (key2) {
73780
73721
  const selectedProtocol = runtime.selectProtocol(key2.profile.protocolVersion);
73781
73722
  let write;
@@ -74153,7 +74094,7 @@ const runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, t
74153
74094
  const previous = notificationTails.get(clientId);
74154
74095
  const isOrigin = clientId === (targetClientId ?? requestContext?.clientId);
74155
74096
  hasOriginDelivery ||= isOrigin;
74156
- const completed = isOrigin ? delivered : makeUnsafe$6();
74097
+ const completed = isOrigin ? delivered : makeUnsafe$5();
74157
74098
  notificationTails.set(clientId, completed);
74158
74099
  const delivery = gen(function* () {
74159
74100
  if (previous !== void 0) yield* _await(previous);
@@ -74200,7 +74141,7 @@ const runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, t
74200
74141
  startImmediately: true
74201
74142
  }));
74202
74143
  })), ignoreCause, forever, forkScoped);
74203
- return yield* make$F(runtime.clientRpcs, {
74144
+ return yield* make$E(runtime.clientRpcs, {
74204
74145
  spanPrefix: "McpServer",
74205
74146
  disableFatalDefects: true
74206
74147
  }).pipe(provideService(Protocol3, patchedProtocol), provideService(McpServerClientMiddleware, clientMiddleware), provide$3(handlers2));
@@ -74210,7 +74151,7 @@ const layerWithRuntime = (options, transport2) => effectDiscard(gen(function* ()
74210
74151
  yield* forkScoped(runWithRuntime(options, runtime, transport2));
74211
74152
  })).pipe(provideMerge(McpServer.layer));
74212
74153
  const layerHttp = (options) => {
74213
- const runtime = layer$O(options.protocols);
74154
+ const runtime = layer$L(options.protocols);
74214
74155
  return layerWithRuntime(options, "http").pipe(provide$2(layerMcpProtocolHttp(options)), provide$2(runtime), provide$2(layerJsonRpc()));
74215
74156
  };
74216
74157
  const layerMcpProtocolHttp = (options) => effect(Protocol3)(gen(function* () {
@@ -74397,7 +74338,7 @@ const mcpMediaTypes = (header2) => header2 === void 0 ? [] : header2.split(",").
74397
74338
  return [mediaType.trim().toLowerCase()];
74398
74339
  });
74399
74340
  const makeUriMatcher = () => {
74400
- const router = make$H({
74341
+ const router = make$G({
74401
74342
  ignoreTrailingSlash: true,
74402
74343
  ignoreDuplicateSlashes: true,
74403
74344
  caseSensitive: true
@@ -74881,9 +74822,9 @@ const searchThreads = (services, query, options) => gen(function* () {
74881
74822
  const BEARER = "Bearer ";
74882
74823
  class McpCredentials extends Service$1()("hinacode/McpCredentials") {
74883
74824
  }
74884
- const make$E = gen(function* () {
74825
+ const make$D = gen(function* () {
74885
74826
  const secrets = /* @__PURE__ */ new Map();
74886
- const url2 = yield* make$1u();
74827
+ const url2 = yield* make$1s();
74887
74828
  const secretFor = (threadId) => {
74888
74829
  let secret = secrets.get(threadId);
74889
74830
  if (secret === void 0) {
@@ -74911,7 +74852,7 @@ const make$E = gen(function* () {
74911
74852
  listening: (listeningUrl) => asVoid(succeed$3(url2, listeningUrl))
74912
74853
  });
74913
74854
  });
74914
- const layer$M = effect(McpCredentials, make$E);
74855
+ const layer$J = effect(McpCredentials, make$D);
74915
74856
  class CallingThread extends Service$1()("hinacode/mcp/CallingThread") {
74916
74857
  }
74917
74858
  const Output = Union([String$1, ArraySchema(ContentBlock$2)]);
@@ -74925,7 +74866,7 @@ const callingThreadId = (credentials) => map$2(
74925
74866
  (request2) => flatMap$3(request2, (current) => credentials.authenticate(current.headers["authorization"]))
74926
74867
  );
74927
74868
  const toolsFor = (caller, options) => {
74928
- const make2 = (name, { description: description2, parameters }) => make$S(name, { description: description2, parameters, success: Output, failure: Failure });
74869
+ const make2 = (name, { description: description2, parameters }) => make$R(name, { description: description2, parameters, success: Output, failure: Failure });
74929
74870
  const register2 = fnUntraced(function* (toolkit, annotations = empty$7()) {
74930
74871
  const server2 = yield* McpServer;
74931
74872
  const resolve2 = provide$3(options.resolve, yield* context());
@@ -74966,7 +74907,7 @@ const toolsFor = (caller, options) => {
74966
74907
  });
74967
74908
  return { make: make2, register: register2 };
74968
74909
  };
74969
- const { make: make$D, register } = toolsFor(CallingThread, {
74910
+ const { make: make$C, register } = toolsFor(CallingThread, {
74970
74911
  resolve: flatMap(McpCredentials, callingThreadId),
74971
74912
  invalid: invalidCredential
74972
74913
  });
@@ -75294,7 +75235,15 @@ const textTypes = {
75294
75235
  ".excalidraw": "application/json",
75295
75236
  ".svg": "image/svg+xml",
75296
75237
  ".txt": "text/plain",
75297
- ".md": "text/markdown"
75238
+ ".md": "text/markdown",
75239
+ ".csv": "text/plain",
75240
+ ".tsv": "text/plain",
75241
+ ".ts": "text/plain",
75242
+ ".toml": "text/plain",
75243
+ ".xml": "application/xml",
75244
+ ".yaml": "text/yaml",
75245
+ ".yml": "text/yaml",
75246
+ ".map": "application/json"
75298
75247
  };
75299
75248
  const binaryTypes = {
75300
75249
  ".png": "image/png",
@@ -75303,7 +75252,10 @@ const binaryTypes = {
75303
75252
  ".gif": "image/gif",
75304
75253
  ".webp": "image/webp",
75305
75254
  ".woff2": "font/woff2",
75306
- ".wasm": "application/wasm"
75255
+ ".wasm": "application/wasm",
75256
+ ".pdf": "application/pdf",
75257
+ ".mp4": "video/mp4",
75258
+ ".webm": "video/webm"
75307
75259
  };
75308
75260
  const contentType = (path2) => {
75309
75261
  const extension = extname(path2).toLowerCase();
@@ -77328,7 +77280,13 @@ const openArtifactStore = (root2, options = {}) => {
77328
77280
  if (artifact2.version === missingVersion) return null;
77329
77281
  try {
77330
77282
  const bytes2 = await readFile(join$1(root2, id2, String(artifact2.version), listed.path));
77331
- return { bytes: bytes2, type: listed.type, version: artifact2.version, revision: artifact2.revision, kind: artifact2.kind };
77283
+ return {
77284
+ bytes: bytes2,
77285
+ type: contentType(listed.path),
77286
+ version: artifact2.version,
77287
+ revision: artifact2.revision,
77288
+ kind: artifact2.kind
77289
+ };
77332
77290
  } catch (error2) {
77333
77291
  if (!(error2 instanceof Error) || !("code" in error2) || error2.code !== "ENOENT") return null;
77334
77292
  missingVersion = artifact2.version;
@@ -78524,6 +78482,8 @@ class CommandError extends TaggedError$1()("CommandError", {
78524
78482
  }
78525
78483
  }
78526
78484
  const TIMED_OUT_EXIT_CODE = 124;
78485
+ const COMMAND_NOT_FOUND_EXIT_CODE = 127;
78486
+ const DID_NOT_RUN_EXIT_CODE = -1;
78527
78487
  const DEFAULT_TIMEOUT = "5 minutes";
78528
78488
  const LONG_TIMEOUT = "1 hour";
78529
78489
  const REMOTE_GIT_ARGS = ["-c", "credential.helper=", "-c", "credential.helper=!gh auth git-credential"];
@@ -78540,9 +78500,18 @@ const failAfter = (timeout2, command, args) => timeoutOrElse({
78540
78500
  })
78541
78501
  )
78542
78502
  });
78503
+ const notRun = (command, args, cwd, { reason }) => {
78504
+ if (reason._tag === "NotFound" && reason.module === "ChildProcess") {
78505
+ return new CommandError({ command, args, exitCode: COMMAND_NOT_FOUND_EXIT_CODE, stderr: `${command} not found` });
78506
+ }
78507
+ if (reason._tag === "NotFound" && reason.pathOrDescriptor === cwd) {
78508
+ return new CommandError({ command, args, exitCode: DID_NOT_RUN_EXIT_CODE, stderr: `folder ${cwd} does not exist` });
78509
+ }
78510
+ return new CommandError({ command, args, exitCode: DID_NOT_RUN_EXIT_CODE, stderr: reason.message });
78511
+ };
78543
78512
  const makeExec = (spawner) => (command, args, cwd, options) => gen(function* () {
78544
78513
  const handle = yield* spawner.spawn(
78545
- make$1z(command, args, {
78514
+ make$1x(command, args, {
78546
78515
  cwd,
78547
78516
  stdin: "ignore",
78548
78517
  env: options?.env,
@@ -78567,10 +78536,7 @@ const makeExec = (spawner) => (command, args, cwd, options) => gen(function* ()
78567
78536
  }).pipe(
78568
78537
  scoped,
78569
78538
  failAfter(options?.timeout ?? DEFAULT_TIMEOUT, command, args),
78570
- catchTag(
78571
- "PlatformError",
78572
- (cause) => fail$2(new CommandError({ command, args, exitCode: -1, stderr: cause.message }))
78573
- ),
78539
+ catchTag("PlatformError", (cause) => fail$2(notRun(command, args, cwd, cause))),
78574
78540
  withSpan(`exec ${command}`, { attributes: { command: [command, ...args].join(" ") } })
78575
78541
  );
78576
78542
  const toChangedStatus = (letter) => {
@@ -78623,7 +78589,7 @@ const parseLog = (output) => {
78623
78589
  };
78624
78590
  class Git extends Service$1()("hinacode/Git") {
78625
78591
  }
78626
- const make$C = gen(function* () {
78592
+ const make$B = gen(function* () {
78627
78593
  const exec2 = makeExec(yield* ChildProcessSpawner);
78628
78594
  const run2 = (cwd, args, options) => exec2("git", ["-C", cwd, ...args], cwd, { ...options, env: { ...NO_OPTIONAL_LOCKS_ENV, ...options?.env } });
78629
78595
  const remote = (cwd, args) => run2(cwd, [...REMOTE_GIT_ARGS, ...args], { env: REMOTE_GIT_ENV, timeout: LONG_TIMEOUT });
@@ -78663,7 +78629,7 @@ const make$C = gen(function* () {
78663
78629
  ]).pipe(map$2(parseRawWithPatch));
78664
78630
  return Git.of({ run: run2, remote, log: log2, show });
78665
78631
  });
78666
- const layer$L = effect(Git, make$C);
78632
+ const layer$I = effect(Git, make$B);
78667
78633
  const MessageRow = Struct({
78668
78634
  ...Message.fields,
78669
78635
  parts: fromJsonString(ArraySchema(MessagePart)),
@@ -78672,7 +78638,7 @@ const MessageRow = Struct({
78672
78638
  });
78673
78639
  class Messages extends Service$1()("hinacode/Messages") {
78674
78640
  }
78675
- const make$B = gen(function* () {
78641
+ const make$A = gen(function* () {
78676
78642
  const sql = yield* SqlClient;
78677
78643
  const encodeRow = encodeEffect(MessageRow);
78678
78644
  const encodePart = encodeEffect(fromJsonString(MessagePart));
@@ -78801,11 +78767,7 @@ const make$B = gen(function* () {
78801
78767
  closeInterrupted
78802
78768
  });
78803
78769
  });
78804
- const layer$K = effect(Messages, make$B);
78805
- class EventBus extends Service$1()("hinacode/EventBus") {
78806
- }
78807
- const RING_CAPACITY = 256;
78808
- const layer$J = effect(EventBus, sliding(RING_CAPACITY));
78770
+ const layer$H = effect(Messages, make$A);
78809
78771
  const SEGMENT = /^[\w.-]+$/;
78810
78772
  const isProjectPath = (path2) => {
78811
78773
  const segments2 = path2.split("/");
@@ -79631,13 +79593,13 @@ const FINISHED_PULL_REQUEST_TTL = "1 hour";
79631
79593
  const FRESH_READ_WINDOW = "10 seconds";
79632
79594
  const MERGEABLE_RECHECK = "2 seconds";
79633
79595
  const MERGEABLE_RECHECKS = 5;
79634
- const make$A = gen(function* () {
79596
+ const make$z = gen(function* () {
79635
79597
  const exec2 = makeExec(yield* ChildProcessSpawner);
79636
79598
  const events2 = yield* Events;
79637
79599
  const layerScope = yield* scope$1;
79638
79600
  const ghUnpaused = (cwd, args, options) => exec2("gh", args, cwd, { timeout: GH_TIMEOUT, ...options, env: { GH_PROMPT_DISABLED: "1", NO_COLOR: "1" } }).pipe(
79639
79601
  mapError((error2) => {
79640
- if (error2.exitCode === -1) return new GitHubCliMissingError();
79602
+ if (error2.exitCode === COMMAND_NOT_FOUND_EXIT_CODE) return new GitHubCliMissingError();
79641
79603
  if (error2.exitCode === SIGNED_OUT_EXIT_CODE) return new GitHubSignedOutError();
79642
79604
  return error2;
79643
79605
  })
@@ -79646,7 +79608,7 @@ const make$A = gen(function* () {
79646
79608
  let secondaryHits = 0;
79647
79609
  let graphqlBudget = "ok";
79648
79610
  let warned = null;
79649
- const pausing = makeUnsafe$8(1);
79611
+ const pausing = makeUnsafe$7(1);
79650
79612
  const pauseFor = (now2, retryAfterSeconds) => {
79651
79613
  if (retryAfterSeconds !== void 0) {
79652
79614
  pausedUntil = Math.max(pausedUntil, now2 + retryAfterSeconds * 1e3);
@@ -79703,9 +79665,15 @@ const make$A = gen(function* () {
79703
79665
  });
79704
79666
  const ghApi = (args) => gen(function* () {
79705
79667
  yield* failIfPaused;
79706
- const response2 = parseApiResponse(
79707
- yield* ghUnpaused(homedir(), ["api", ...args, "--include"], { okExitCodes: [1] })
79708
- );
79668
+ let stderr = "";
79669
+ const stdout = yield* ghUnpaused(homedir(), ["api", ...args, "--include"], {
79670
+ okExitCodes: [1],
79671
+ onStderr: (chunk) => sync(() => void (stderr += chunk))
79672
+ });
79673
+ const response2 = parseApiResponse(stdout);
79674
+ if (!Number.isFinite(response2.status)) {
79675
+ return yield* new GitHubApiError({ detail: stderr.trim() || "gh api printed no response" });
79676
+ }
79709
79677
  const rateLimit = rateLimitOf(response2.headers);
79710
79678
  if (rateLimit !== null) yield* observe(rateLimit);
79711
79679
  const error2 = decodeApiErrorBody(response2.body);
@@ -79803,7 +79771,7 @@ const make$A = gen(function* () {
79803
79771
  { discard: true }
79804
79772
  );
79805
79773
  });
79806
- const pullRequestReads = make$1e(fetchPullRequests).pipe(
79774
+ const pullRequestReads = make$1d(fetchPullRequests).pipe(
79807
79775
  setDelayEffect(
79808
79776
  promise$1(() => new Promise((resolve2) => setTimeout(resolve2, BATCH_WINDOW_MS)))
79809
79777
  ),
@@ -79962,7 +79930,7 @@ const make$A = gen(function* () {
79962
79930
  repository
79963
79931
  });
79964
79932
  });
79965
- const layer$I = effect(GitHub, make$A);
79933
+ const layer$G = effect(GitHub, make$z);
79966
79934
  class GitLabCliMissingError extends TaggedError$1()("GitLabCliMissingError", {}) {
79967
79935
  get message() {
79968
79936
  return "The GitLab CLI (glab) is not installed. Install it from https://gitlab.com/gitlab-org/cli and sign in with glab auth login.";
@@ -80128,7 +80096,7 @@ const toPullRequestDetail = (reads) => ({
80128
80096
  });
80129
80097
  const GLAB_ERROR = /^glab: (?:(.*\S)\s+\()?HTTP (\d+)\)?/m;
80130
80098
  const gitLabErrorOf = (hostname2, error2) => {
80131
- if (error2.exitCode === -1) return new GitLabCliMissingError();
80099
+ if (error2.exitCode === COMMAND_NOT_FOUND_EXIT_CODE) return new GitLabCliMissingError();
80132
80100
  const http = GLAB_ERROR.exec(error2.stderr);
80133
80101
  if (!http) return error2;
80134
80102
  const [, detail, status] = http;
@@ -80147,7 +80115,7 @@ const requireMergeRequest = (raw2) => {
80147
80115
  const mergeRequest = parseGitLabMergeRequestUrl(raw2.trim());
80148
80116
  return mergeRequest ? succeed$2(mergeRequest) : fail$2(new PullRequestUrlInvalidError({ url: raw2 }));
80149
80117
  };
80150
- const make$z = gen(function* () {
80118
+ const make$y = gen(function* () {
80151
80119
  const exec2 = makeExec(yield* ChildProcessSpawner);
80152
80120
  const events2 = yield* Events;
80153
80121
  const glab = (hostname2, cwd, args, options) => exec2("glab", args, cwd, { timeout: GLAB_TIMEOUT, ...options, env: { NO_COLOR: "1" } }).pipe(
@@ -80275,7 +80243,7 @@ const make$z = gen(function* () {
80275
80243
  })
80276
80244
  });
80277
80245
  });
80278
- const layer$H = effect(GitLab, make$z);
80246
+ const layer$F = effect(GitLab, make$y);
80279
80247
  const requirePullRequestUrl = (raw2) => {
80280
80248
  const parsed = parsePullRequestUrl(raw2);
80281
80249
  return parsed === void 0 ? fail$2(new PullRequestUrlInvalidError({ url: raw2 })) : succeed$2(parsed.url);
@@ -80290,7 +80258,7 @@ const byUrl = (url2, onGitHub, onGitLab) => flatMap(
80290
80258
  hostOfUrl(url2),
80291
80259
  (host) => host === "gitlab" ? onGitLab() : onGitHub()
80292
80260
  );
80293
- const make$y = gen(function* () {
80261
+ const make$x = gen(function* () {
80294
80262
  const git2 = yield* Git;
80295
80263
  const github = yield* GitHub;
80296
80264
  const gitlab = yield* GitLab;
@@ -80343,11 +80311,11 @@ const make$y = gen(function* () {
80343
80311
  )
80344
80312
  });
80345
80313
  });
80346
- const layer$G = effect(SourceControl, make$y).pipe(provide$2(layer$H));
80314
+ const layer$E = effect(SourceControl, make$x).pipe(provide$2(layer$F));
80347
80315
  class AgentAccounts extends Service$1()("hinacode/AgentAccounts") {
80348
80316
  }
80349
80317
  const expandHome = (path2) => resolve$1(path2 === "~" || path2.startsWith("~/") ? join$1(homedir(), path2.slice(1)) : path2);
80350
- const make$x = gen(function* () {
80318
+ const make$w = gen(function* () {
80351
80319
  const sql = yield* SqlClient;
80352
80320
  const settings = yield* Settings$1;
80353
80321
  const findAll$1 = findAll({
@@ -80419,7 +80387,7 @@ const make$x = gen(function* () {
80419
80387
  home
80420
80388
  });
80421
80389
  });
80422
- const layer$F = effect(AgentAccounts, make$x);
80390
+ const layer$D = effect(AgentAccounts, make$w);
80423
80391
  const slugifyBranch = (text2) => text2.toLowerCase().replace(/[^a-z0-9._/-]+/g, "-").replace(/\.{2,}/g, ".").replace(/\/{2,}/g, "/").split("/").map((segment) => segment.replace(/^[-.]+|[-.]+$/g, "").replace(/\.lock$/, "")).filter((segment) => segment !== "").join("/").slice(0, 80);
80424
80392
  class Projects extends Service$1()("hinacode/Projects") {
80425
80393
  }
@@ -80445,7 +80413,7 @@ const ProjectRow = Struct({
80445
80413
  linearReview: BooleanFromBit,
80446
80414
  actions: fromJsonString(ArraySchema(ProjectAction))
80447
80415
  });
80448
- const make$w = gen(function* () {
80416
+ const make$v = gen(function* () {
80449
80417
  const sql = yield* SqlClient;
80450
80418
  const fs2 = yield* FileSystem;
80451
80419
  const git2 = yield* Git;
@@ -80483,7 +80451,7 @@ const make$w = gen(function* () {
80483
80451
  }),
80484
80452
  orElseSucceed(() => void 0)
80485
80453
  );
80486
- const repositories = yield* make$1m({ lookup: repositoryOf, capacity: 256 });
80454
+ const repositories = yield* make$1k({ lookup: repositoryOf, capacity: 256 });
80487
80455
  const ensureDirectory = (rootPath) => fs2.stat(rootPath).pipe(
80488
80456
  filterOrFail(
80489
80457
  (info) => info.type === "Directory",
@@ -80534,7 +80502,7 @@ const make$w = gen(function* () {
80534
80502
  const holdsClone = (rootPath, { owner: owner2, name }) => git2.run(rootPath, ["remote", "get-url", "origin"]).pipe(
80535
80503
  map$2((url2) => {
80536
80504
  const origin = parseGitHubRepository(url2);
80537
- return origin?.owner.toLowerCase() === owner2.toLowerCase() && origin.name === name;
80505
+ return origin !== null && `${origin.owner}/${origin.name}`.toLowerCase() === `${owner2}/${name}`.toLowerCase();
80538
80506
  }),
80539
80507
  orElseSucceed(() => false)
80540
80508
  );
@@ -80562,7 +80530,7 @@ const make$w = gen(function* () {
80562
80530
  );
80563
80531
  });
80564
80532
  const clone2 = ({ cloneId, repository, ...input }) => gen(function* () {
80565
- const cancel = yield* make$1u();
80533
+ const cancel = yield* make$1s();
80566
80534
  cloneCancels.set(cloneId, cancel);
80567
80535
  const rootPath = yield* resolveRoot(input.rootPath);
80568
80536
  const cancelled = _await(cancel).pipe(
@@ -80600,13 +80568,12 @@ const make$w = gen(function* () {
80600
80568
  });
80601
80569
  const update2 = (input) => gen(function* () {
80602
80570
  const current = yield* get2(input.id);
80603
- if (input.rootPath !== void 0 && input.rootPath !== current.rootPath) {
80604
- yield* ensureDirectory(input.rootPath);
80605
- }
80571
+ const rootPath = input.rootPath === void 0 ? current.rootPath : yield* resolveRoot(input.rootPath);
80572
+ if (rootPath !== current.rootPath) yield* ensureDirectory(rootPath);
80606
80573
  const next2 = {
80607
80574
  ...current,
80608
80575
  name: input.name ?? current.name,
80609
- rootPath: input.rootPath ?? current.rootPath,
80576
+ rootPath,
80610
80577
  setupScript: input.setupScript === void 0 ? current.setupScript : input.setupScript,
80611
80578
  linearReview: input.linearReview ?? current.linearReview,
80612
80579
  actions: input.actions ?? current.actions,
@@ -80650,7 +80617,7 @@ const make$w = gen(function* () {
80650
80617
  remove: (id2) => sql`DELETE FROM project WHERE id = ${id2}`.pipe(asVoid, mapError(persistence("projects.delete")))
80651
80618
  });
80652
80619
  });
80653
- const layer$E = effect(Projects, make$w);
80620
+ const layer$C = effect(Projects, make$v);
80654
80621
  const MAX_SLUG_LENGTH = 40;
80655
80622
  const REMOVING_SUFFIX = ".removing";
80656
80623
  const TMP_ROOT_HASH_LENGTH = 6;
@@ -80661,7 +80628,7 @@ const timestamp = (iso2) => new Date(iso2).toISOString().slice(0, 19).replace(/[
80661
80628
  const slug = (title2) => slugifyBranch(title2).replaceAll("/", "-").slice(0, MAX_SLUG_LENGTH).replace(/[-.]+$/, "") || "thread";
80662
80629
  class Scratch extends Service$1()("hinacode/Scratch") {
80663
80630
  }
80664
- const layer$D = (root2, {
80631
+ const layer$B = (root2, {
80665
80632
  tmpRoot = join$1(tmpdir(), `hc-${createHash("sha256").update(root2).digest("hex").slice(0, TMP_ROOT_HASH_LENGTH)}`),
80666
80633
  deleteFolder = deleteTree
80667
80634
  } = {}) => effect(
@@ -80971,7 +80938,7 @@ const quoteForShell = (shell, text2) => shell === "powershell.exe" ? `'${text2.r
80971
80938
  const typedLine = (shell, line) => line.includes("\n") ? `${shell} -c ${quoteForShell(shell, line)}` : line;
80972
80939
  class Terminals extends Service$1()("hinacode/Terminals") {
80973
80940
  }
80974
- const make$v = gen(function* () {
80941
+ const make$u = gen(function* () {
80975
80942
  const events2 = yield* Events;
80976
80943
  const activeWorkspace = yield* makeActiveWorkspace;
80977
80944
  const sessions = /* @__PURE__ */ new Map();
@@ -81085,7 +81052,7 @@ const make$v = gen(function* () {
81085
81052
  yield* addFinalizer$1(() => sync(() => sessions.forEach(end2)));
81086
81053
  return Terminals.of({ open: open2, write, resize, attach, close: close2, list, closeThread });
81087
81054
  });
81088
- const layer$C = effect(Terminals, make$v);
81055
+ const layer$A = effect(Terminals, make$u);
81089
81056
  const exists$2 = (path2) => access(path2).then(
81090
81057
  () => true,
81091
81058
  () => false
@@ -81113,7 +81080,7 @@ const parseCheckouts = (output) => output.split("\0\0").map((record2) => {
81113
81080
  const value2 = (key2) => fields.find((field2) => field2.startsWith(`${key2} `))?.slice(key2.length + 1);
81114
81081
  return { path: value2("worktree") ?? "", ref: value2("branch") ?? null };
81115
81082
  }).filter((checkout) => checkout.path !== "");
81116
- const make$u = fnUntraced(function* (setupTimeout) {
81083
+ const make$t = fnUntraced(function* (setupTimeout) {
81117
81084
  const sql = yield* SqlClient;
81118
81085
  const projects = yield* Projects;
81119
81086
  const git2 = yield* Git;
@@ -81167,7 +81134,7 @@ const make$u = fnUntraced(function* (setupTimeout) {
81167
81134
  UPDATE worktree SET status = 'failed', setup_log = setup_log || ${"\nSetup was interrupted when HinaCode quit.\n"}
81168
81135
  WHERE status = 'preparing'
81169
81136
  `.pipe(mapError(persistence("worktrees.failInterrupted")));
81170
- const lock = makeUnsafe$8(1);
81137
+ const lock = makeUnsafe$7(1);
81171
81138
  const exclusive = (effect2) => lock.withPermit(effect2);
81172
81139
  const get2 = (id2) => findById(id2).pipe(
81173
81140
  mapError(persistence("worktrees.get")),
@@ -81206,7 +81173,7 @@ const make$u = fnUntraced(function* (setupTimeout) {
81206
81173
  return -1;
81207
81174
  }
81208
81175
  const handle = yield* spawner.spawn(
81209
- make$1z(shell, ["-lc", script], {
81176
+ make$1x(shell, ["-lc", script], {
81210
81177
  cwd: worktree.path,
81211
81178
  env: {
81212
81179
  HINACODE_ROOT_PATH: project2.rootPath,
@@ -81521,16 +81488,15 @@ Setup script exited with code ${exitCode}
81521
81488
  if ((yield* git2.run(rootPath, ["status", "--porcelain"])).trim() !== "") return;
81522
81489
  yield* git2.run(rootPath, ["merge", "--ff-only", "--quiet", upstream], { timeout: LONG_TIMEOUT });
81523
81490
  }).pipe(exclusive, ignore$1);
81524
- const fetches = yield* make$1m({
81525
- lookup: (projectId) => gen(function* () {
81491
+ const fetches = yield* makeWith$1(
81492
+ (projectId) => gen(function* () {
81526
81493
  const { rootPath } = yield* projects.get(projectId);
81527
81494
  yield* git2.remote(rootPath, ["fetch", "--quiet", "origin"]);
81528
81495
  yield* fastForwardDefaultBranch(projectId, rootPath);
81529
81496
  return yield* currentTimeMillis;
81530
81497
  }),
81531
- capacity: 64,
81532
- timeToLive: FETCH_INTERVAL
81533
- });
81498
+ { capacity: 64, timeToLive: (exit2) => isSuccess$2(exit2) ? FETCH_INTERVAL : zero }
81499
+ );
81534
81500
  const fetch2 = (projectId) => get$3(fetches, projectId);
81535
81501
  return Worktrees.of({
81536
81502
  list: findAll$1(void 0).pipe(mapError(persistence("worktrees.list"))),
@@ -81555,8 +81521,8 @@ Setup script exited with code ${exitCode}
81555
81521
  stopSetup
81556
81522
  });
81557
81523
  });
81558
- const layerWithSetupTimeout = (setupTimeout) => effect(Worktrees, make$u(setupTimeout));
81559
- const layer$B = layerWithSetupTimeout(SETUP_TIMEOUT);
81524
+ const layerWithSetupTimeout = (setupTimeout) => effect(Worktrees, make$t(setupTimeout));
81525
+ const layer$z = layerWithSetupTimeout(SETUP_TIMEOUT);
81560
81526
  const MAX_LISTED_FILES = 5e4;
81561
81527
  const randomName = () => `thread-${randomUUID().slice(0, 5)}`;
81562
81528
  const ThreadRow$1 = Struct({
@@ -81584,7 +81550,7 @@ const startsWork = (from, to) => (from === "idle" || from === "limited") && to =
81584
81550
  const onlyArranges = (input) => Object.entries(input).every(([key2, value2]) => arranging.has(key2) || value2 === void 0);
81585
81551
  class Threads extends Service$1()("hinacode/Threads") {
81586
81552
  }
81587
- const make$t = gen(function* () {
81553
+ const make$s = gen(function* () {
81588
81554
  const sql = yield* SqlClient;
81589
81555
  const projects = yield* Projects;
81590
81556
  const worktrees = yield* Worktrees;
@@ -81673,7 +81639,15 @@ const make$t = gen(function* () {
81673
81639
  })
81674
81640
  )
81675
81641
  );
81676
- const insertThread = ({ worktree: worktreeInput, createdBy = "user", effort = null, fastMode = false, parentId, ...input }, status) => gen(function* () {
81642
+ const insertThread = ({
81643
+ worktree: worktreeInput,
81644
+ createdBy = "user",
81645
+ effort = null,
81646
+ fastMode = false,
81647
+ accessMode,
81648
+ parentId,
81649
+ ...input
81650
+ }, status) => gen(function* () {
81677
81651
  yield* projects.get(input.projectId);
81678
81652
  const parent = parentId === void 0 ? void 0 : yield* get2(parentId);
81679
81653
  const worktree = worktreeInput ? yield* worktrees.create({ projectId: input.projectId, ...worktreeInput }) : void 0;
@@ -81686,7 +81660,7 @@ const make$t = gen(function* () {
81686
81660
  worktreeId: worktree?.id ?? null,
81687
81661
  effort,
81688
81662
  fastMode,
81689
- accessMode: defaultAccessMode,
81663
+ accessMode: accessMode ?? defaultAccessMode,
81690
81664
  accountId: defaultAccount[input.provider],
81691
81665
  providerSessionId: null,
81692
81666
  forkedFrom: null,
@@ -81710,7 +81684,7 @@ const make$t = gen(function* () {
81710
81684
  return thread2;
81711
81685
  });
81712
81686
  const create = (input) => insertThread(input, "idle");
81713
- const drafting = makeUnsafe$8(1);
81687
+ const drafting = makeUnsafe$7(1);
81714
81688
  const draft = (input) => gen(function* () {
81715
81689
  const existing2 = yield* findDraft(input.projectId).pipe(mapError(persistence("threads.draft")));
81716
81690
  if (isNone(existing2)) return yield* insertThread({ ...input, createdBy: "user" }, "draft");
@@ -82137,7 +82111,7 @@ const make$t = gen(function* () {
82137
82111
  `.pipe(asVoid, mapError(persistence("threads.resetInterrupted")))
82138
82112
  });
82139
82113
  });
82140
- const layer$A = effect(Threads, make$t);
82114
+ const layer$y = effect(Threads, make$s);
82141
82115
  class NoBranchError extends TaggedError$1()("NoBranchError", { threadId: String$1 }) {
82142
82116
  get message() {
82143
82117
  return "This thread has no worktree branch to open a pull request from";
@@ -82147,14 +82121,11 @@ const LinkRow = Struct({
82147
82121
  ...PullRequestLink.fields,
82148
82122
  watch: NullOr(fromJsonString(PullRequestWatch))
82149
82123
  });
82150
- const UnsettledLink = Struct({ id: String$1, threadId: String$1, url: String$1 });
82151
- const ObservedStatus = Struct({ observedStatus: NullOr(PullRequestStatus) });
82152
82124
  class PullRequests extends Service$1()("hinacode/PullRequests") {
82153
82125
  }
82154
- const make$s = gen(function* () {
82126
+ const make$r = gen(function* () {
82155
82127
  const sql = yield* SqlClient;
82156
82128
  const events2 = yield* Events;
82157
- const bus = yield* EventBus;
82158
82129
  const threads = yield* Threads;
82159
82130
  const worktrees = yield* Worktrees;
82160
82131
  const git2 = yield* Git;
@@ -82182,29 +82153,6 @@ const make$s = gen(function* () {
82182
82153
  Result: LinkRow,
82183
82154
  execute: (linkId) => sql`SELECT * FROM pull_request_link WHERE id = ${linkId}`
82184
82155
  });
82185
- const findUnsettled = findAll({
82186
- Request: Void,
82187
- Result: UnsettledLink,
82188
- execute: () => sql`
82189
- SELECT id, thread_id, url FROM pull_request_link
82190
- WHERE observed_status IS NULL OR observed_status != 'merged'
82191
- `
82192
- });
82193
- const findObservedStatus = findOneOption({
82194
- Request: String$1,
82195
- Result: ObservedStatus,
82196
- execute: (linkId) => sql`SELECT observed_status FROM pull_request_link WHERE id = ${linkId}`
82197
- });
82198
- const observe = (linkId, status) => sql.withTransaction(
82199
- gen(function* () {
82200
- const current = yield* findObservedStatus(linkId);
82201
- if (current._tag === "None") return null;
82202
- const previous = current.value.observedStatus;
82203
- if (previous === status || previous === "merged") return null;
82204
- yield* sql`UPDATE pull_request_link SET observed_status = ${status} WHERE id = ${linkId}`;
82205
- return { previous };
82206
- })
82207
- ).pipe(mapError(persistence("pullRequests.observe")));
82208
82156
  const find = (linkId) => findById(linkId).pipe(
82209
82157
  mapError(persistence("pullRequests.find")),
82210
82158
  map$2((link2) => link2._tag === "Some" ? link2.value : null)
@@ -82214,13 +82162,10 @@ const make$s = gen(function* () {
82214
82162
  const url2 = yield* requirePullRequestUrl(raw2);
82215
82163
  const row = { id: randomUUID(), threadId, url: url2, createdAt: yield* nowIso, watch: null };
82216
82164
  const encoded = yield* encodeRow(row).pipe(mapError(persistence("pullRequests.link")));
82217
- const inserted = yield* sql`
82218
- INSERT INTO pull_request_link ${sql.insert(encoded)} ON CONFLICT (thread_id, url) DO NOTHING RETURNING id
82219
- `.pipe(mapError(persistence("pullRequests.link")));
82165
+ yield* sql`INSERT INTO pull_request_link ${sql.insert(encoded)} ON CONFLICT (thread_id, url) DO NOTHING`.pipe(
82166
+ mapError(persistence("pullRequests.link"))
82167
+ );
82220
82168
  yield* broadcast(threadId);
82221
- if (inserted.length > 0) {
82222
- yield* publish(bus, { topic: "pullRequest.linked", threadId, linkId: row.id, url: url2 });
82223
- }
82224
82169
  return url2;
82225
82170
  });
82226
82171
  const unlink = (threadId, raw2) => gen(function* () {
@@ -82291,8 +82236,6 @@ const make$s = gen(function* () {
82291
82236
  list,
82292
82237
  listAll: findAll$1(void 0).pipe(mapError(persistence("pullRequests.listAll"))),
82293
82238
  watched: findWatched(void 0).pipe(mapError(persistence("pullRequests.watched"))),
82294
- unsettled: findUnsettled(void 0).pipe(mapError(persistence("pullRequests.unsettled"))),
82295
- observe,
82296
82239
  find,
82297
82240
  link,
82298
82241
  unlink,
@@ -82302,7 +82245,7 @@ const make$s = gen(function* () {
82302
82245
  create
82303
82246
  });
82304
82247
  });
82305
- const layer$z = effect(PullRequests, make$s).pipe(provideMerge(layer$J));
82248
+ const layer$x = effect(PullRequests, make$r);
82306
82249
  const isInside = (root2, path2) => {
82307
82250
  const inside = relative(root2, path2);
82308
82251
  return isAbsolute(path2) && inside !== ".." && !inside.startsWith(`..${sep}`) && !isAbsolute(inside);
@@ -82388,7 +82331,7 @@ const attachment = (id2, name, path2, mime, bytes2) => ({
82388
82331
  kind: mime.startsWith("image/") ? "image" : "file",
82389
82332
  bytes: bytes2
82390
82333
  });
82391
- const layer$y = (root2) => succeed$5(Attachments, Attachments.of({ stage: stage(root2), read: read(root2) }));
82334
+ const layer$w = (root2) => succeed$5(Attachments, Attachments.of({ stage: stage(root2), read: read(root2) }));
82392
82335
  const Suggestion = Struct({ title: String$1, branch: String$1 });
82393
82336
  const SUGGESTION_JSON_SCHEMA = {
82394
82337
  type: "object",
@@ -82449,7 +82392,7 @@ ${firstAndLatest(prompt)}
82449
82392
  )
82450
82393
  );
82451
82394
  const userText = (messages) => messages.filter((message2) => message2.role === "user").map((message2) => message2.parts.flatMap((part) => part.type === "text" ? [part.text] : []).join("\n")).filter((text2) => text2.trim() !== "").join("\n\n---\n\n");
82452
- const make$r = gen(function* () {
82395
+ const make$q = gen(function* () {
82453
82396
  const threads = yield* Threads;
82454
82397
  const worktrees = yield* Worktrees;
82455
82398
  const settings = yield* Settings$1;
@@ -82483,7 +82426,7 @@ const make$r = gen(function* () {
82483
82426
  });
82484
82427
  return ThreadNaming.of({ nameFromPrompt, regenerateTitle });
82485
82428
  });
82486
- const layer$x = effect(ThreadNaming, make$r);
82429
+ const layer$v = effect(ThreadNaming, make$q);
82487
82430
  const PERSIST_INTERVAL_MS = 500;
82488
82431
  const RUN_AGENT_WAIT = minutes(4);
82489
82432
  const PERSIST_BYTES_PER_SECOND = 256 * 1024;
@@ -82564,7 +82507,7 @@ const withImagesSaved = (threadId, attachments, value2) => {
82564
82507
  ).pipe(map$2((entries) => Object.fromEntries(entries)));
82565
82508
  };
82566
82509
  const replaceLast = (messages, message2) => [...messages.slice(0, -1), message2];
82567
- const make$q = gen(function* () {
82510
+ const make$p = gen(function* () {
82568
82511
  const scope2 = yield* scope$1;
82569
82512
  const threads = yield* Threads;
82570
82513
  const worktrees = yield* Worktrees;
@@ -82600,7 +82543,7 @@ const make$q = gen(function* () {
82600
82543
  );
82601
82544
  return agentInstructions(experimental2, environment2, subagentChoices(listed, settingsValue.modelPresets, enabled));
82602
82545
  });
82603
- const cachedLimits = yield* make$1m({
82546
+ const cachedLimits = yield* make$1k({
82604
82547
  lookup: (key2) => {
82605
82548
  const { provider, accountId } = JSON.parse(key2);
82606
82549
  return accounts.home(accountId).pipe(
@@ -82612,8 +82555,8 @@ const make$q = gen(function* () {
82612
82555
  capacity: 64,
82613
82556
  timeToLive: minutes(1)
82614
82557
  });
82615
- const turns = yield* make$1k();
82616
- const deliveries = yield* make$1k();
82558
+ const turns = yield* make$1i();
82559
+ const deliveries = yield* make$1i();
82617
82560
  const busyThreads = /* @__PURE__ */ new Set();
82618
82561
  const pendingSends = /* @__PURE__ */ new Map();
82619
82562
  const pendingScheduledSends = /* @__PURE__ */ new Map();
@@ -82640,7 +82583,7 @@ const make$q = gen(function* () {
82640
82583
  const isBusy = (threadId) => busyThreads.has(threadId) || activeTurns.has(threadId) || pendingSends.has(threadId);
82641
82584
  const exclusive = (threadId) => (effect2) => {
82642
82585
  let lock = threadLocks.get(threadId);
82643
- if (lock === void 0) threadLocks.set(threadId, lock = makeUnsafe$8(1));
82586
+ if (lock === void 0) threadLocks.set(threadId, lock = makeUnsafe$7(1));
82644
82587
  return withPermit(lock, effect2);
82645
82588
  };
82646
82589
  const respondApproval = (requestId, decision, note) => suspend(() => {
@@ -82827,6 +82770,9 @@ const make$q = gen(function* () {
82827
82770
  forkPoint: { ...received.forkPoint, owner: { provider: provider.id, accountId: thread2.accountId } }
82828
82771
  } : received.type === "turn_failed" && (yield* isDone(stop)) ? { ...received, stopped: true } : received;
82829
82772
  if (event.type === "subagent_updated") return yield* updateSubagent2(thread2.id, event.subagent);
82773
+ if (event.type === "approval_requested" && (yield* threads.get(thread2.id)).accessMode === "full") {
82774
+ return yield* asVoid(providers[event.request.provider].respondApproval(event.request.id, "allow"));
82775
+ }
82830
82776
  yield* deltas.offer(event);
82831
82777
  }).pipe(exclusive(thread2.id));
82832
82778
  const steerHeld = gen(function* () {
@@ -83028,7 +82974,7 @@ const make$q = gen(function* () {
83028
82974
  message: "This thread's turn ended before the agent started."
83029
82975
  });
83030
82976
  }
83031
- const finalReply = makeUnsafe$6();
82977
+ const finalReply = makeUnsafe$5();
83032
82978
  agentRuns.set(id2, {
83033
82979
  threadId,
83034
82980
  stop: suspend(() => {
@@ -83220,14 +83166,14 @@ const make$q = gen(function* () {
83220
83166
  activeTurns.set(threadId, turn);
83221
83167
  pendingSends.delete(threadId);
83222
83168
  if (options.scheduledId !== void 0) pendingScheduledSends.delete(options.scheduledId);
83223
- yield* run$4(turns, threadId, turn.run(agentPrompt, attachments2, environment2));
83169
+ yield* run$3(turns, threadId, turn.run(agentPrompt, attachments2, environment2));
83224
83170
  if (pending.first && currentThread.createdBy === "user" && currentThread.sideOf === null && prompt.trim() !== "")
83225
83171
  yield* forkDetach(nameThreadWithPullRequestScope(currentThread, prompt));
83226
83172
  return true;
83227
83173
  }).pipe(exclusive(threadId));
83228
83174
  });
83229
83175
  const startClaimed = (threadId, prompt, attachments2, options, when2) => gen(function* () {
83230
- const stop = makeUnsafe$6();
83176
+ const stop = makeUnsafe$5();
83231
83177
  pendingSends.set(threadId, stop);
83232
83178
  if (options.scheduledId !== void 0) pendingScheduledSends.set(options.scheduledId, stop);
83233
83179
  const accepted = yield* activeWorkspace(threadId).pipe(
@@ -83419,7 +83365,7 @@ const make$q = gen(function* () {
83419
83365
  }).pipe(catch_((error2) => logWarning("could not deliver a scheduled message", error2)));
83420
83366
  const sendDue = (list, now2) => forEach(
83421
83367
  list.filter((thread2) => thread2.scheduled.some((message2) => isDue(message2, now2))),
83422
- (thread2) => run$4(deliveries, thread2.id, deliverDue(thread2.id), { onlyIfMissing: true }),
83368
+ (thread2) => run$3(deliveries, thread2.id, deliverDue(thread2.id), { onlyIfMissing: true }),
83423
83369
  { discard: true }
83424
83370
  );
83425
83371
  const sendDueSchedules = gen(function* () {
@@ -83531,11 +83477,11 @@ const make$q = gen(function* () {
83531
83477
  const assistant2 = openAssistantMessage(threadId, yield* nowIso);
83532
83478
  yield* insertMessage(assistant2);
83533
83479
  yield* updateThread({ id: threadId, status: "running" });
83534
- return makeTurn(thread2, source, cwd, home, assistant2, makeUnsafe$6());
83480
+ return makeTurn(thread2, source, cwd, home, assistant2, makeUnsafe$5());
83535
83481
  }).pipe(worktrees.exclusive, exclusive(threadId));
83536
83482
  if (turn === null) return;
83537
83483
  activeTurns.set(threadId, turn);
83538
- yield* run$4(turns, threadId, turn.follow(events2));
83484
+ yield* run$3(turns, threadId, turn.follow(events2));
83539
83485
  adopted = true;
83540
83486
  }).pipe(
83541
83487
  ensuring(
@@ -83680,7 +83626,7 @@ const make$q = gen(function* () {
83680
83626
  return yield* new AgentError({ provider: "hinacode", message: "No turn is running on this thread." });
83681
83627
  }
83682
83628
  const request2 = { id: randomUUID(), threadId, name, description: description2 };
83683
- const answer = yield* make$1u();
83629
+ const answer = yield* make$1s();
83684
83630
  secretRequests.set(request2.id, { request: request2, answer });
83685
83631
  yield* turn.handle({ type: "secret_requested", request: request2 });
83686
83632
  return yield* _await(answer).pipe(onInterrupt(() => resolveSecret(request2.id)));
@@ -83818,7 +83764,7 @@ const make$q = gen(function* () {
83818
83764
  })
83819
83765
  });
83820
83766
  });
83821
- const layer$w = effect(AgentRunner, make$q);
83767
+ const layer$u = effect(AgentRunner, make$p);
83822
83768
  const newThreadProvider = gen(function* () {
83823
83769
  const settings = yield* Settings$1.use((service2) => service2.get);
83824
83770
  return startingProvider(settings, yield* installedProviders);
@@ -83928,7 +83874,7 @@ const ThreadRow = Struct({
83928
83874
  body: String$1,
83929
83875
  at: String$1
83930
83876
  });
83931
- const make$p = (ripgrep) => gen(function* () {
83877
+ const make$o = (ripgrep) => gen(function* () {
83932
83878
  const sql = yield* SqlClient;
83933
83879
  const activeWorkspace = yield* makeActiveWorkspace;
83934
83880
  let rg = null;
@@ -84023,7 +83969,7 @@ const make$p = (ripgrep) => gen(function* () {
84023
83969
  });
84024
83970
  return Search.of({ threads, perThread, files });
84025
83971
  });
84026
- const layer$v = effect(Search, make$p(resolveRipgrep));
83972
+ const layer$t = effect(Search, make$o(resolveRipgrep));
84027
83973
  class CallingApp extends Service$1()("hinacode/apps/CallingApp") {
84028
83974
  }
84029
83975
  const AppTool = toolsFor(CallingApp, {
@@ -84033,7 +83979,7 @@ const AppTool = toolsFor(CallingApp, {
84033
83979
  const WAIT_LIMIT = seconds(60);
84034
83980
  const POLL_EVERY = seconds(1);
84035
83981
  const ThreadId = String$1.annotate({ description: "Id of a thread, from list_threads or search_threads." });
84036
- const AppTools = make$R(
83982
+ const AppTools = make$Q(
84037
83983
  AppTool.make("list_projects", {
84038
83984
  description: "List the projects on the developer's machine. Returns JSON with each project's id, name and folder path. Pass an id to list_threads or create_thread."
84039
83985
  }),
@@ -84195,7 +84141,7 @@ ${view}`;
84195
84141
  });
84196
84142
  })
84197
84143
  );
84198
- const layer$u = effectDiscard(AppTool.register(AppTools)).pipe(provide$2(appToolsLayer));
84144
+ const layer$s = effectDiscard(AppTool.register(AppTools)).pipe(provide$2(appToolsLayer));
84199
84145
  const CLIENT_KEY_SECRET = "apps.clientKey";
84200
84146
  const MAX_OAUTH_BODY = kilobytes(64);
84201
84147
  const MAX_MCP_BYTES = 1024 * 1024;
@@ -84463,7 +84409,7 @@ const routes$1 = effectDiscard(
84463
84409
  })
84464
84410
  );
84465
84411
  const httpServer$1 = serve$1(
84466
- mergeAll(layer$u, routes$1, gate).pipe(
84412
+ mergeAll(layer$s, routes$1, gate).pipe(
84467
84413
  provideMerge(
84468
84414
  layerHttp({
84469
84415
  name: "hinacode",
@@ -84475,7 +84421,7 @@ const httpServer$1 = serve$1(
84475
84421
  )
84476
84422
  ),
84477
84423
  { disableListenLog: true, disableLogger: true }
84478
- ).pipe(provideMerge(layer$P(createServer, { port: 0, host: "127.0.0.1" })));
84424
+ ).pipe(provideMerge(layer$M(createServer, { port: 0, host: "127.0.0.1" })));
84479
84425
  const announce$1 = effectDiscard(
84480
84426
  gen(function* () {
84481
84427
  const { address } = yield* HttpServer;
@@ -84484,13 +84430,13 @@ const announce$1 = effectDiscard(
84484
84430
  yield* (yield* AppConnections).listening(address.port);
84485
84431
  })
84486
84432
  );
84487
- const layer$t = announce$1.pipe(provide$2(httpServer$1));
84433
+ const layer$r = announce$1.pipe(provide$2(httpServer$1));
84488
84434
  const ATTR_DB_SYSTEM_NAME = "db.system.name";
84489
84435
  const MAX_BUSY_TIMEOUT = 2147483647;
84490
84436
  const NANOS_PER_MILLI = /* @__PURE__ */ BigInt(1e6);
84491
84437
  const TypeId = "~@effect/sql-sqlite-node/SqliteClient";
84492
84438
  const SqliteClient = /* @__PURE__ */ Service$1("@effect/sql-sqlite-node/SqliteClient");
84493
- const make$o = (options) => gen(function* () {
84439
+ const make$n = (options) => gen(function* () {
84494
84440
  const compiler = makeCompilerSqlite(options.transformQueryNames);
84495
84441
  const transformRows = options.transformResultNames ? defaultTransforms(options.transformResultNames).array : void 0;
84496
84442
  const makeConnection = gen(function* () {
@@ -84638,10 +84584,10 @@ const make$o = (options) => gen(function* () {
84638
84584
  transactionAcquirer
84639
84585
  } = makeSqliteAcquirers({
84640
84586
  connection: succeed$2(connection2),
84641
- semaphore: yield* make$1w(1),
84587
+ semaphore: yield* make$1u(1),
84642
84588
  isTransaction: (conn) => conn.isTransaction()
84643
84589
  });
84644
- return Object.assign(yield* make$1f({
84590
+ return Object.assign(yield* make$1e({
84645
84591
  acquirer,
84646
84592
  compiler,
84647
84593
  transactionAcquirer,
@@ -84657,7 +84603,7 @@ const make$o = (options) => gen(function* () {
84657
84603
  loadExtension: (path2) => scoped(flatMap(acquirer, (_) => _.loadExtension(path2)))
84658
84604
  });
84659
84605
  });
84660
- const layer$s = (config2) => effectContext(map$2(make$o(config2), (client2) => make$1x(SqliteClient, client2).pipe(add$1(SqlClient, client2)))).pipe(provide$2(layer$Z));
84606
+ const layer$q = (config2) => effectContext(map$2(make$n(config2), (client2) => make$1v(SqliteClient, client2).pipe(add$1(SqlClient, client2)))).pipe(provide$2(layer$W));
84661
84607
  const classifyError = (cause, message2, operation) => classifySqliteError(sqliteCauseWithErrno(cause), {
84662
84608
  message: message2,
84663
84609
  operation
@@ -85316,7 +85262,11 @@ const routines = gen(function* () {
85316
85262
  const [main2] = yield* sql`SELECT file FROM pragma_database_list WHERE name = 'main'`;
85317
85263
  if (main2?.file) moveListenerSetting(join$1(dirname(main2.file), "settings.json"));
85318
85264
  });
85319
- const run$2 = make$1c({});
85265
+ const dropPullRequestObservedStatus = gen(function* () {
85266
+ const sql = yield* SqlClient;
85267
+ yield* sql`ALTER TABLE pull_request_link DROP COLUMN observed_status`;
85268
+ });
85269
+ const run$2 = make$1b({});
85320
85270
  const runMigrations = run$2({
85321
85271
  loader: fromRecord({
85322
85272
  "1_init": init,
@@ -85364,7 +85314,8 @@ const runMigrations = run$2({
85364
85314
  "44_drop_thread_user_skills": dropThreadUserSkills,
85365
85315
  "45_magpie_provider": magpieProvider,
85366
85316
  "46_app_connection": appConnection,
85367
- "47_routines": routines
85317
+ "47_routines": routines,
85318
+ "48_drop_pull_request_observed_status": dropPullRequestObservedStatus
85368
85319
  })
85369
85320
  }).pipe(
85370
85321
  tap$1(
@@ -85379,9 +85330,9 @@ const setup = effectDiscard(
85379
85330
  yield* runMigrations;
85380
85331
  })
85381
85332
  );
85382
- const layer$r = (filename) => setup.pipe(
85333
+ const layer$p = (filename) => setup.pipe(
85383
85334
  provideMerge(
85384
- layer$s({
85335
+ layer$q({
85385
85336
  filename,
85386
85337
  transformQueryNames: camelToSnake,
85387
85338
  transformResultNames: snakeToCamel
@@ -85734,7 +85685,7 @@ const forgetIn = (cacheDir, accountId) => gen(function* () {
85734
85685
  if (isSome(yield* readCached(path2, accountId))) yield* remove(path2);
85735
85686
  }
85736
85687
  });
85737
- const make$n = (cacheDir) => gen(function* () {
85688
+ const make$m = (cacheDir) => gen(function* () {
85738
85689
  const accounts = yield* AgentAccounts;
85739
85690
  const settings = yield* Settings$1;
85740
85691
  const providers = {
@@ -85764,7 +85715,7 @@ const make$n = (cacheDir) => gen(function* () {
85764
85715
  });
85765
85716
  return AgentLogins.of({ account: account2, forget: (accountId) => forgetIn(cacheDir, accountId) });
85766
85717
  });
85767
- const layer$q = (cacheDir) => effect(AgentLogins, make$n(cacheDir));
85718
+ const layer$o = (cacheDir) => effect(AgentLogins, make$m(cacheDir));
85768
85719
  const kindNames = {
85769
85720
  page: "page",
85770
85721
  document: "document",
@@ -85819,7 +85770,7 @@ const ownerOf = (name, expected) => {
85819
85770
  const [id2 = "", file, ...rest] = name?.split(/[\\/]/) ?? [];
85820
85771
  return file === expected && rest.length === 0 && isArtifactId(id2) ? id2 : void 0;
85821
85772
  };
85822
- const make$m = (root2) => gen(function* () {
85773
+ const make$l = (root2) => gen(function* () {
85823
85774
  const events2 = yield* Events;
85824
85775
  const store2 = openArtifactStore(root2);
85825
85776
  const announced = /* @__PURE__ */ new Map();
@@ -85985,7 +85936,7 @@ const make$m = (root2) => gen(function* () {
85985
85936
  addDocumentImage
85986
85937
  });
85987
85938
  });
85988
- const layer$p = (root2) => effect(Artifacts, make$m(root2));
85939
+ const layer$n = (root2) => effect(Artifacts, make$l(root2));
85989
85940
  class ArtifactFeedbackError extends TaggedError$1()("ArtifactFeedbackError", {
85990
85941
  message: String$1
85991
85942
  }) {
@@ -86007,7 +85958,7 @@ const attempt = (run2) => tryPromise({ try: run2, catch: (cause) => cause }).pip
86007
85958
  (cause) => cause instanceof ArtifactError ? fail$2(new ArtifactFeedbackError({ message: cause.message })) : die(cause)
86008
85959
  )
86009
85960
  );
86010
- const make$l = gen(function* () {
85961
+ const make$k = gen(function* () {
86011
85962
  const { store: store2 } = yield* Artifacts;
86012
85963
  const runner = yield* AgentRunner;
86013
85964
  const threads = yield* Threads;
@@ -86073,7 +86024,7 @@ const make$l = gen(function* () {
86073
86024
  );
86074
86025
  return ArtifactFeedback.of({ feedback, comment, resolveComment });
86075
86026
  });
86076
- const layer$o = effect(ArtifactFeedback, make$l);
86027
+ const layer$m = effect(ArtifactFeedback, make$k);
86077
86028
  const INSPECTION_VIEWPORT = { width: 400 };
86078
86029
  class ArtifactInspector extends Service$1()("hinacode/ArtifactInspector") {
86079
86030
  }
@@ -86314,7 +86265,7 @@ const executablePath = async (override) => {
86314
86265
  }
86315
86266
  return void 0;
86316
86267
  };
86317
- const make$k = (options) => gen(function* () {
86268
+ const make$j = (options) => gen(function* () {
86318
86269
  const activeWorkspace = yield* makeActiveWorkspace;
86319
86270
  const attachments = yield* Attachments;
86320
86271
  const scope2 = yield* scope$1;
@@ -86942,13 +86893,13 @@ const make$k = (options) => gen(function* () {
86942
86893
  );
86943
86894
  return Browser.of({ open: open2, command, frame: frame2, close: close2 });
86944
86895
  });
86945
- const browserLayer = (options = {}) => effect(Browser, make$k(options));
86946
- const layer$n = browserLayer();
86896
+ const browserLayer = (options = {}) => effect(Browser, make$j(options));
86897
+ const layer$l = browserLayer();
86947
86898
  class ClientSettings extends Service$1()(
86948
86899
  "hinacode/ClientSettings"
86949
86900
  ) {
86950
86901
  }
86951
- const layer$m = (dataDir) => effect(
86902
+ const layer$k = (dataDir) => effect(
86952
86903
  ClientSettings,
86953
86904
  makeSettingStore(ClientSettings$1, defaultClientSettings, {
86954
86905
  path: join$1(dataDir, "client-settings.json"),
@@ -87202,7 +87153,7 @@ const opens = (url2) => callback((resume) => {
87202
87153
  return sync(() => socket.terminate());
87203
87154
  });
87204
87155
  const firstToOpen = (dials, timeoutMs) => gen(function* () {
87205
- const won = yield* make$1u();
87156
+ const won = yield* make$1s();
87206
87157
  let failed2 = 0;
87207
87158
  yield* forEach(
87208
87159
  dials,
@@ -87230,7 +87181,7 @@ const probe = (target, token, plainToken) => {
87230
87181
  const where = "relay" in target ? target.relay : `${target.host}:${target.port}`;
87231
87182
  const url2 = "relay" in target ? relayWebSocketUrl(target.relay) : remoteWebSocketUrl(target);
87232
87183
  return gen(function* () {
87233
- const answered = yield* make$1u();
87184
+ const answered = yield* make$1s();
87234
87185
  let reason = "the connection closed";
87235
87186
  let errorCode;
87236
87187
  const socket = yield* acquireRelease(
@@ -87278,7 +87229,7 @@ const probe = (target, token, plainToken) => {
87278
87229
  };
87279
87230
  const probeHosts = (pairing) => gen(function* () {
87280
87231
  const answers = [];
87281
- const graceOver = yield* make$1u();
87232
+ const graceOver = yield* make$1s();
87282
87233
  let graceStarted = false;
87283
87234
  const startGrace = suspend(() => {
87284
87235
  if (graceStarted) return void_;
@@ -87335,7 +87286,7 @@ const send$1 = (live, call2) => {
87335
87286
  live.socket.send(JSON.stringify(key2 === void 0 ? frame2 : { ...frame2, key: key2 }));
87336
87287
  };
87337
87288
  const environmentDialPlan = ({ host, port, relay: relay2 }) => dialPlan({ hosts: [host], port, relay: relay2 });
87338
- const make$j = gen(function* () {
87289
+ const make$i = gen(function* () {
87339
87290
  const sql = yield* SqlClient;
87340
87291
  const secrets = yield* Secrets;
87341
87292
  const events2 = yield* Events;
@@ -87421,7 +87372,7 @@ const make$j = gen(function* () {
87421
87372
  };
87422
87373
  const session = (cloud, token, url2, plainToken) => gen(function* () {
87423
87374
  const { id: id2, name } = cloud.environment;
87424
- const closed = yield* make$1u();
87375
+ const closed = yield* make$1s();
87425
87376
  let connectedAt = null;
87426
87377
  let otherProtocol = null;
87427
87378
  let heardAt = now2();
@@ -87561,7 +87512,7 @@ const make$j = gen(function* () {
87561
87512
  if (end2.connectedMs >= STABLE_MS) attempt2 = 0;
87562
87513
  }
87563
87514
  round = "both";
87564
- const wake = yield* make$1u();
87515
+ const wake = yield* make$1s();
87565
87516
  cloud.wake = wake;
87566
87517
  const woken = yield* race(
87567
87518
  sleep$3(reconnectDelay(attempt2)).pipe(as(false)),
@@ -87571,7 +87522,7 @@ const make$j = gen(function* () {
87571
87522
  attempt2 = woken ? 0 : attempt2 + 1;
87572
87523
  }
87573
87524
  }).pipe(catchCause((cause) => logWarning("environment connection stopped", cause)));
87574
- const connections = yield* make$1k();
87525
+ const connections = yield* make$1i();
87575
87526
  yield* addFinalizer$1(
87576
87527
  () => clear(connections).pipe(
87577
87528
  andThen(
@@ -87595,7 +87546,7 @@ const make$j = gen(function* () {
87595
87546
  };
87596
87547
  cloud.environment = environment2;
87597
87548
  clouds.set(environment2.id, cloud);
87598
- return run$4(connections, environment2.id, maintain(cloud));
87549
+ return run$3(connections, environment2.id, maintain(cloud));
87599
87550
  });
87600
87551
  const list = gen(function* () {
87601
87552
  const rows = yield* findAll$1(void 0).pipe(mapError(persistence("environments.list")));
@@ -87782,7 +87733,7 @@ const make$j = gen(function* () {
87782
87733
  })
87783
87734
  });
87784
87735
  });
87785
- const layer$l = effect(Environments, make$j);
87736
+ const layer$j = effect(Environments, make$i);
87786
87737
  const previewMimes = {
87787
87738
  png: "image/png",
87788
87739
  jpg: "image/jpeg",
@@ -87940,7 +87891,7 @@ const chatFolderParts = (root2) => {
87940
87891
  const parts = { chatsRoot: root2.slice(0, cut), threadId: root2.slice(cut + 1) };
87941
87892
  return cut > 0 && chatFolder(parts.chatsRoot, parts.threadId) === root2 ? parts : { chatsRoot: null, threadId: null };
87942
87893
  };
87943
- const make$i = gen(function* () {
87894
+ const make$h = gen(function* () {
87944
87895
  const sql = yield* SqlClient;
87945
87896
  const git2 = yield* Git;
87946
87897
  const events2 = yield* Events;
@@ -88138,7 +88089,7 @@ const make$i = gen(function* () {
88138
88089
  yield* addFinalizer$1(() => sync(() => [...watchers.keys()].forEach(closeAll)));
88139
88090
  return Files.of({ list, resolve: resolve2, read: read2, preview: preview2, write, create, rename: rename$1, remove: remove2, watch: watch$1 });
88140
88091
  });
88141
- const layer$k = effect(Files, make$i);
88092
+ const layer$i = effect(Files, make$h);
88142
88093
  const windowsDrive = /^[a-zA-Z]:[\\/]/;
88143
88094
  const isHomeRelative = (input) => input === "~" || input.startsWith("~/") || input.startsWith("~\\");
88144
88095
  const looksLikeDirectoryPath = (input) => isHomeRelative(input) || input.startsWith("/") || windowsDrive.test(input);
@@ -88269,8 +88220,8 @@ class Host {
88269
88220
  return string$2(this.hostname);
88270
88221
  }
88271
88222
  }
88272
- const make$h = gen(function* () {
88273
- const lookups = yield* make$1w(MAX_CONCURRENT_LOOKUPS);
88223
+ const make$g = gen(function* () {
88224
+ const lookups = yield* make$1u(MAX_CONCURRENT_LOOKUPS);
88274
88225
  const icons = yield* makeWith$1(
88275
88226
  (host) => withPermit(
88276
88227
  lookups,
@@ -88288,7 +88239,7 @@ const make$h = gen(function* () {
88288
88239
  }
88289
88240
  });
88290
88241
  });
88291
- const layer$j = effect(Favicons, make$h);
88242
+ const layer$h = effect(Favicons, make$g);
88292
88243
  class Scheduler extends Service$1()("hinacode/Scheduler") {
88293
88244
  }
88294
88245
  const LONGEST_NAP_MS = 6e4;
@@ -88306,14 +88257,14 @@ const loop = ({ id: id2, cron, nextRunAt, run: run2 }) => gen(function* () {
88306
88257
  dueAt = nextAt;
88307
88258
  }
88308
88259
  });
88309
- const make$g = gen(function* () {
88310
- const jobs = yield* make$1k();
88260
+ const make$f = gen(function* () {
88261
+ const jobs = yield* make$1i();
88311
88262
  return Scheduler.of({
88312
- put: (job) => asVoid(run$4(jobs, job.id, loop(job))),
88263
+ put: (job) => asVoid(run$3(jobs, job.id, loop(job))),
88313
88264
  remove: (id2) => remove$1(jobs, id2)
88314
88265
  });
88315
88266
  });
88316
- const layer$i = effect(Scheduler, make$g);
88267
+ const layer$g = effect(Scheduler, make$f);
88317
88268
  const hookPath = (routineId) => `/hooks/routines/${routineId}`;
88318
88269
  const SIGNATURE_HEADERS = ["x-hinacode-signature", "x-hub-signature-256"];
88319
88270
  const EVENT_KEY_HEADERS = ["idempotency-key", "x-github-delivery"];
@@ -88364,7 +88315,7 @@ const handleHook = (handlers2) => gen(function* () {
88364
88315
  const webhookServer = (address, handlers2) => serve$1(add("POST", "/hooks/routines/:id", handleHook(handlers2)), {
88365
88316
  disableListenLog: true,
88366
88317
  disableLogger: true
88367
- }).pipe(provide$2(layer$P(createServer, address)));
88318
+ }).pipe(provide$2(layer$M(createServer, address)));
88368
88319
  const WEBHOOK_SECRET = "routines.webhookSecret";
88369
88320
  const AUTO_PAUSE_FAILURES = 3;
88370
88321
  const MAX_ROUTINES = 100;
@@ -88429,7 +88380,7 @@ const validate = (input) => {
88429
88380
  if (input.prompt.trim() === "") return fail$2(new RoutineError({ reason: "Prompt is required" }));
88430
88381
  return void_;
88431
88382
  };
88432
- const make$f = gen(function* () {
88383
+ const make$e = gen(function* () {
88433
88384
  const sql = yield* SqlClient;
88434
88385
  const threads = yield* Threads;
88435
88386
  const worktrees = yield* Worktrees;
@@ -88646,7 +88597,7 @@ const make$f = gen(function* () {
88646
88597
  run: (dueAt, nextAt) => runScheduled(row.id, dueAt, nextAt)
88647
88598
  });
88648
88599
  };
88649
- const listener = yield* make$1l();
88600
+ const listener = yield* make$1j();
88650
88601
  let listenError = null;
88651
88602
  const webhookSecret = secrets.get(WEBHOOK_SECRET).pipe(
88652
88603
  map$2(getOrUndefined$1),
@@ -88670,7 +88621,7 @@ const make$f = gen(function* () {
88670
88621
  );
88671
88622
  yield* logInfo("routine webhooks listening", `${address2.bindHost}:${address2.port}`);
88672
88623
  yield* events2.publish({ type: "routines.changed" });
88673
- yield* run$5(
88624
+ yield* run$4(
88674
88625
  listener,
88675
88626
  launch(server2).pipe(
88676
88627
  catchCause((cause) => {
@@ -88787,7 +88738,7 @@ const make$f = gen(function* () {
88787
88738
  rotateWebhookSecret
88788
88739
  });
88789
88740
  });
88790
- const layer$h = effect(Routines, make$f);
88741
+ const layer$f = effect(Routines, make$e);
88791
88742
  const LINEAR_API_KEY_SECRET = "linear.apiKey";
88792
88743
  class LinearRequestError extends TaggedError$1()("LinearRequestError", {
88793
88744
  reason: String$1
@@ -88815,7 +88766,7 @@ const assignedIssuesQuery = `
88815
88766
  }
88816
88767
  `;
88817
88768
  const AssignedIssuesData = Struct({ issues: Struct({ nodes: ArraySchema(LinearIssue) }) });
88818
- const make$e = gen(function* () {
88769
+ const make$d = gen(function* () {
88819
88770
  const secrets = yield* Secrets;
88820
88771
  const client2 = flatMap(
88821
88772
  secrets.get(LINEAR_API_KEY_SECRET),
@@ -88841,7 +88792,7 @@ const make$e = gen(function* () {
88841
88792
  );
88842
88793
  return Linear.of({ client: client2, assignedIssues });
88843
88794
  });
88844
- const layer$g = effect(Linear, make$e);
88795
+ const layer$e = effect(Linear, make$d);
88845
88796
  const demoIssue = (identifier2, title2, state, priority, hoursAgo) => ({
88846
88797
  id: `demo-${identifier2}`,
88847
88798
  identifier: identifier2,
@@ -88875,7 +88826,7 @@ const describeDevice = (state) => `${state.device.name} (${state.device.id})`;
88875
88826
  const FRAME_WAIT_MS = 1e3;
88876
88827
  const messageOf = (cause) => cause instanceof Error ? cause.message : String(cause);
88877
88828
  const failure$1 = (cause) => cause instanceof DevicesError ? cause : new DevicesError({ message: messageOf(cause) });
88878
- const make$d = (options) => gen(function* () {
88829
+ const make$c = (options) => gen(function* () {
88879
88830
  const sql = yield* SqlClient;
88880
88831
  const events2 = yield* Events;
88881
88832
  const settings = yield* Settings$1;
@@ -89439,7 +89390,7 @@ const make$d = (options) => gen(function* () {
89439
89390
  })
89440
89391
  });
89441
89392
  });
89442
- const devicesLayer = (options) => effect(Devices, make$d(options));
89393
+ const devicesLayer = (options) => effect(Devices, make$c(options));
89443
89394
  class SbxNotConfiguredError extends TaggedError$1()("SbxNotConfiguredError", {}) {
89444
89395
  get message() {
89445
89396
  return "No sbx login found. Run `sbx login <url>` or set SBX_URL and SBX_TOKEN.";
@@ -89459,7 +89410,7 @@ const decodeConfig = decodeUnknownEffect(ConfigFile);
89459
89410
  const readLogin = (source) => {
89460
89411
  const url2 = source.env["SBX_URL"];
89461
89412
  const token = source.env["SBX_TOKEN"];
89462
- if (url2 && token) return succeed$2({ url: url2, token: make$1q(token) });
89413
+ if (url2 && token) return succeed$2({ url: url2, token: make$1o(token) });
89463
89414
  return tryPromise({
89464
89415
  try: () => readFile(source.configPath, "utf8"),
89465
89416
  catch: (cause) => cause.code === "ENOENT" ? new SbxNotConfiguredError() : new SbxError({ message: `Could not read ${source.configPath}: ${String(cause)}` })
@@ -89472,7 +89423,7 @@ const readLogin = (source) => {
89472
89423
  )
89473
89424
  )
89474
89425
  ),
89475
- map$2((config2) => ({ url: config2.url, token: make$1q(config2.token) }))
89426
+ map$2((config2) => ({ url: config2.url, token: make$1o(config2.token) }))
89476
89427
  );
89477
89428
  };
89478
89429
  const Sandbox = Struct({ id: String$1 });
@@ -90251,7 +90202,7 @@ const boatClient = (input) => {
90251
90202
  };
90252
90203
  class Boat extends Service$1()("hinacode/Boat") {
90253
90204
  }
90254
- const make$c = (env) => gen(function* () {
90205
+ const make$b = (env) => gen(function* () {
90255
90206
  const secrets = yield* Secrets;
90256
90207
  const resolveApiKey = (() => {
90257
90208
  const fromEnv = env["BOAT_API_KEY"];
@@ -90268,14 +90219,14 @@ const make$c = (env) => gen(function* () {
90268
90219
  })();
90269
90220
  const baseUrlRaw = env["BOAT_API_BASE"];
90270
90221
  const baseUrl = baseUrlRaw !== void 0 && baseUrlRaw.length > 0 ? baseUrlRaw : "https://boat.dev/api/v1";
90271
- const client2 = map$2(resolveApiKey, (apiKey) => boatClient({ baseUrl, apiKey: make$1q(apiKey) }));
90222
+ const client2 = map$2(resolveApiKey, (apiKey) => boatClient({ baseUrl, apiKey: make$1o(apiKey) }));
90272
90223
  const configured = match$1(resolveApiKey, {
90273
90224
  onFailure: () => false,
90274
90225
  onSuccess: () => true
90275
90226
  });
90276
90227
  return Boat.of({ client: client2, configured });
90277
90228
  });
90278
- const layer$f = (env) => effect(Boat, make$c(env));
90229
+ const layer$d = (env) => effect(Boat, make$b(env));
90279
90230
  class VmInputError extends TaggedError$1()("VmInputError", { message: String$1 }) {
90280
90231
  }
90281
90232
  class RfbError extends TaggedError$1()("RfbError", { message: String$1 }) {
@@ -90908,7 +90859,7 @@ const writeStoredProfile = (dataDir, bytes2, template2) => tryPromise({
90908
90859
  })
90909
90860
  )
90910
90861
  );
90911
- const make$b = (source, dataDir, desktopRedirect = true) => gen(function* () {
90862
+ const make$a = (source, dataDir, desktopRedirect = true) => gen(function* () {
90912
90863
  const scope2 = yield* scope$1;
90913
90864
  const events2 = yield* Events;
90914
90865
  const broadcast = yield* PushBroadcast;
@@ -90934,8 +90885,8 @@ const make$b = (source, dataDir, desktopRedirect = true) => gen(function* () {
90934
90885
  let setupScript = experimental2.tinyVmSetupScript;
90935
90886
  let profileEnabled = experimental2.tinyVmProfile;
90936
90887
  let profileOwner;
90937
- const profileSaves = yield* make$1w(1);
90938
- const boatMapLock = yield* make$1w(1);
90888
+ const profileSaves = yield* make$1u(1);
90889
+ const boatMapLock = yield* make$1u(1);
90939
90890
  const current = (threadId) => vms.get(threadId) ?? NONE;
90940
90891
  const runFork2 = runForkWith(yield* context());
90941
90892
  const publishUnsafe2 = (event) => runFork2(events2.publish(event));
@@ -91184,7 +91135,7 @@ ${output}` : ""}`
91184
91135
  if (pending) return _await(pending);
91185
91136
  const picked = templateOverride?.trim();
91186
91137
  const template2 = provider === "boat" ? isBoatSize(picked) ? picked : boatSize : picked || configuredTemplate;
91187
- const done2 = makeUnsafe$6();
91138
+ const done2 = makeUnsafe$5();
91188
91139
  creations.set(threadId, done2);
91189
91140
  return setVm(threadId, { status: "starting" }).pipe(
91190
91141
  andThen(forkIn(create(threadId, done2, template2), scope2)),
@@ -91253,7 +91204,7 @@ ${output}` : ""}`
91253
91204
  });
91254
91205
  const waitForHandBack = (threadId) => suspend(() => {
91255
91206
  let handBack = handBacks.get(threadId);
91256
- if (handBack === void 0) handBacks.set(threadId, handBack = makeUnsafe$6());
91207
+ if (handBack === void 0) handBacks.set(threadId, handBack = makeUnsafe$5());
91257
91208
  waiting.set(threadId, (waiting.get(threadId) ?? 0) + 1);
91258
91209
  return refreshWaiting(threadId).pipe(
91259
91210
  andThen(_await(handBack)),
@@ -91691,9 +91642,9 @@ ${output}` : ""}`
91691
91642
  closeScreen
91692
91643
  });
91693
91644
  });
91694
- const layer$e = (source, dataDir, options) => effect(TinyVm, make$b(source, dataDir, options?.desktopRedirect ?? true));
91695
- const AgentTools = make$R(
91696
- make$D(RUN_AGENT_TOOL, {
91645
+ const layer$c = (source, dataDir, options) => effect(TinyVm, make$a(source, dataDir, options?.desktopRedirect ?? true));
91646
+ const AgentTools = make$Q(
91647
+ make$C(RUN_AGENT_TOOL, {
91697
91648
  description: "Run a sub-agent on any provider HinaCode supports, such as Codex from a Claude thread, through its SDK in this thread's workspace. Use it instead of running the `codex` or `claude` CLI in a shell. It shows in this thread's Agents tab, where the user can watch and stop it. The call returns the agent's final reply, or, if the agent is still working after a few minutes, its id: then call `wait_agent` with that id, as often as needed, to keep waiting. The agent stops when this thread's turn ends. The `<agents>` block in your instructions lists each provider with its model ids and efforts; pass them exactly. Defaults to that provider's first model, or this thread's model on the same provider. opencode runs only the models the user picked for it in Settings.",
91698
91649
  parameters: Struct({
91699
91650
  provider: ProviderId,
@@ -91707,7 +91658,7 @@ const AgentTools = make$R(
91707
91658
  )
91708
91659
  })
91709
91660
  }).annotate(Readonly, true),
91710
- make$D(WAIT_AGENT_TOOL, {
91661
+ make$C(WAIT_AGENT_TOOL, {
91711
91662
  description: "Keep waiting for a sub-agent that `run_agent` handed back while it was still working. Returns its final reply, or says it is still running after a few minutes, so you can call this again.",
91712
91663
  parameters: Struct({
91713
91664
  agentId: String$1.annotate({ description: "The id `run_agent` or an earlier `wait_agent` returned." })
@@ -91805,8 +91756,8 @@ const Target = optionalKey(
91805
91756
  );
91806
91757
  const SWIPE_STEPS = 12;
91807
91758
  const SETTLE_MS$1 = 1e3;
91808
- const DeviceTools = make$R(
91809
- make$D("device_screenshot", {
91759
+ const DeviceTools = make$Q(
91760
+ make$C("device_screenshot", {
91810
91761
  description: `Take a screenshot of the thread's iOS simulator or Android emulator. ${STARTS$1}`,
91811
91762
  parameters: Struct({
91812
91763
  device: Target,
@@ -91817,11 +91768,11 @@ const DeviceTools = make$R(
91817
91768
  )
91818
91769
  })
91819
91770
  }),
91820
- make$D("device_tap", {
91771
+ make$C("device_tap", {
91821
91772
  description: `Tap the device screen at a point. ${STARTS$1} ${WAITS$1} ${SHOWS$1}`,
91822
91773
  parameters: Struct({ device: Target, x: Point("Horizontal position"), y: Point("Vertical position") })
91823
91774
  }),
91824
- make$D("device_swipe", {
91775
+ make$C("device_swipe", {
91825
91776
  description: `Swipe with one finger from one point to another, for example to scroll or go back from the left edge. ${STARTS$1} ${WAITS$1} ${SHOWS$1}`,
91826
91777
  parameters: Struct({
91827
91778
  device: Target,
@@ -91836,29 +91787,29 @@ const DeviceTools = make$R(
91836
91787
  )
91837
91788
  })
91838
91789
  }),
91839
- make$D("device_type", {
91790
+ make$C("device_type", {
91840
91791
  description: `Type text into the focused field. Tap the field first. ${STARTS$1} ${WAITS$1} ${SHOWS$1}`,
91841
91792
  parameters: Struct({
91842
91793
  device: Target,
91843
91794
  text: String$1.check(isMaxLength(1e4)).annotate({ description: "At most 10,000 characters." })
91844
91795
  })
91845
91796
  }),
91846
- make$D("device_button", {
91797
+ make$C("device_button", {
91847
91798
  description: `Press a hardware button. back and recents exist on Android only. ${STARTS$1} ${WAITS$1} ${SHOWS$1}`,
91848
91799
  parameters: Struct({ device: Target, button: DeviceButton })
91849
91800
  }),
91850
- make$D("device_launch", {
91801
+ make$C("device_launch", {
91851
91802
  description: `Launch an installed app by its iOS bundle id or Android package name. ${STARTS$1} ${SHOWS$1}`,
91852
91803
  parameters: Struct({ device: Target, app: DeviceApp })
91853
91804
  }),
91854
- make$D("device_open_url", {
91805
+ make$C("device_open_url", {
91855
91806
  description: `Open a URL on the device, such as a deep link like myapp://settings or an Expo dev server URL. ${STARTS$1} ${SHOWS$1}`,
91856
91807
  parameters: Struct({
91857
91808
  device: Target,
91858
91809
  url: DeviceUrl.annotate({ description: "A URL with a scheme, such as myapp://settings or https://example.com." })
91859
91810
  })
91860
91811
  }),
91861
- make$D("device_describe_ui", {
91812
+ make$C("device_describe_ui", {
91862
91813
  description: `List the accessibility elements on screen, one per line with role, label, identifier, value and frame in points. Cheaper than a screenshot for finding what to tap. ${STARTS$1}`,
91863
91814
  parameters: Struct({ device: Target })
91864
91815
  })
@@ -92065,8 +92016,8 @@ ${error2.message}`))
92065
92016
  };
92066
92017
  };
92067
92018
  const IssueKey = String$1.annotate({ description: "Linear issue identifier, for example ENG-123" });
92068
- const LinearTools = make$R(
92069
- make$D("linear_get_issue", {
92019
+ const LinearTools = make$Q(
92020
+ make$C("linear_get_issue", {
92070
92021
  description: "Read one or more Linear issues: title, state, assignee, priority, URL and description. An issue that cannot be read reports its error in place.",
92071
92022
  parameters: Struct({
92072
92023
  key: String$1.annotate({
@@ -92074,7 +92025,7 @@ const LinearTools = make$R(
92074
92025
  })
92075
92026
  })
92076
92027
  }),
92077
- make$D("linear_search_issues", {
92028
+ make$C("linear_search_issues", {
92078
92029
  description: "Search Linear issues by text, assignee and workflow state, in any combination. Returns identifier, title and URL per match.",
92079
92030
  parameters: Struct({
92080
92031
  query: optionalKey(String$1.annotate({ description: "Full-text search term" })),
@@ -92093,11 +92044,11 @@ const LinearTools = make$R(
92093
92044
  )
92094
92045
  })
92095
92046
  }),
92096
- make$D("linear_create_comment", {
92047
+ make$C("linear_create_comment", {
92097
92048
  description: "Post a markdown comment on a Linear issue.",
92098
92049
  parameters: Struct({ key: IssueKey, body: String$1.annotate({ description: "Markdown body" }) })
92099
92050
  }),
92100
- make$D("linear_update_issue_state", {
92051
+ make$C("linear_update_issue_state", {
92101
92052
  description: "Move a Linear issue to a workflow state of its team, matched by name (case-insensitive).",
92102
92053
  parameters: Struct({
92103
92054
  key: IssueKey,
@@ -92128,19 +92079,19 @@ const linearToolsLayer = LinearTools.toLayer(
92128
92079
  const PullRequestUrl = String$1.annotate({
92129
92080
  description: "GitHub pull request or GitLab merge request URL, for example https://github.com/owner/repo/pull/123 or https://gitlab.com/group/project/-/merge_requests/45"
92130
92081
  });
92131
- const PullRequestTools = make$R(
92132
- make$D("link_pull_request", {
92082
+ const PullRequestTools = make$Q(
92083
+ make$C("link_pull_request", {
92133
92084
  description: "Register a GitHub pull request or GitLab merge request you opened for this thread so the user sees it next to the thread. Call it right after creating the PR.",
92134
92085
  parameters: Struct({ url: PullRequestUrl })
92135
92086
  }),
92136
- make$D("list_thread_pull_requests", {
92087
+ make$C("list_thread_pull_requests", {
92137
92088
  description: "List the pull requests linked to this thread, marking the ones this thread is watching."
92138
92089
  }),
92139
- make$D("unlink_pull_request", {
92090
+ make$C("unlink_pull_request", {
92140
92091
  description: "Remove a pull request link from this thread. A watch on it ends with the link.",
92141
92092
  parameters: Struct({ url: PullRequestUrl })
92142
92093
  }),
92143
- make$D("watch_pull_request", {
92094
+ make$C("watch_pull_request", {
92144
92095
  description: "Watch a pull request for this thread instead of polling it yourself. HinaCode checks it every minute and sends this thread a new message when something you care about changes, so end your turn after calling this. The watch ends on its own when the pull request merges or closes. Links the pull request first when it is not linked yet.",
92145
92096
  parameters: Struct({
92146
92097
  url: PullRequestUrl,
@@ -92151,7 +92102,7 @@ const PullRequestTools = make$R(
92151
92102
  )
92152
92103
  })
92153
92104
  }),
92154
- make$D("unwatch_pull_request", {
92105
+ make$C("unwatch_pull_request", {
92155
92106
  description: "Stop watching a pull request for this thread. The link itself stays.",
92156
92107
  parameters: Struct({ url: PullRequestUrl })
92157
92108
  })
@@ -92238,8 +92189,8 @@ ${fenced("diff", baseDiff)}`);
92238
92189
  }
92239
92190
  return truncate$1(sections.join("\n\n"));
92240
92191
  });
92241
- const ReviewTools = make$R(
92242
- make$D("review_changes", {
92192
+ const ReviewTools = make$Q(
92193
+ make$C("review_changes", {
92243
92194
  description: "Review this thread's uncommitted and branch changes: git status plus the unified diff against HEAD and, in a worktree, against the merge-base with its base branch."
92244
92195
  })
92245
92196
  );
@@ -92260,8 +92211,8 @@ const reviewToolsLayer = ReviewTools.toLayer(
92260
92211
  const SecretName = String$1.check(isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/)).annotate({
92261
92212
  description: "File name the value is saved under, for example STRIPE_API_KEY. Letters, digits, dots, dashes and underscores."
92262
92213
  });
92263
- const SecretTools = make$R(
92264
- make$D("request_secret", {
92214
+ const SecretTools = make$Q(
92215
+ make$C("request_secret", {
92265
92216
  description: "Ask the user for a secret (API key, token, password) instead of asking them to paste it into the chat. Call it as soon as you need one, or when the user asks how to give you one, instead of explaining. HinaCode shows them a masked input in this thread, writes what they enter to a file in your scratch directory and returns its path. Read the file inside the command that needs the value, for example `STRIPE_API_KEY=\"$(cat '<path>')\" ./script`, and never print it. Blocks until they answer or the turn ends.",
92266
92217
  parameters: Struct({
92267
92218
  name: SecretName,
@@ -92339,11 +92290,11 @@ const describeTerminal = (session, index) => [
92339
92290
  ` cwd: ${session.cwd}`,
92340
92291
  ` status: ${terminalStatus(session)}`
92341
92292
  ].join("\n");
92342
- const TerminalTools = make$R(
92343
- make$D("list_terminals", {
92293
+ const TerminalTools = make$Q(
92294
+ make$C("list_terminals", {
92344
92295
  description: "List the terminals the user has open for this thread in HinaCode's terminal drawer, in the order of its tabs, with each one's id, cwd, status and the mention to write in your reply to point the user at it. For zsh, bash and fish the status names the command running in the foreground, or the exit code of the last one."
92345
92296
  }).annotate(Readonly, true),
92346
- make$D("read_terminal", {
92297
+ make$C("read_terminal", {
92347
92298
  description: "Read the recent output of one of this thread's terminals as plain text, without colors or cursor movement. Use it when the user mentions a terminal with @terminal:<id>. HinaCode keeps the last 256 KB of each terminal's output.",
92348
92299
  parameters: Struct({
92349
92300
  id: String$1.annotate({ description: "The terminal id, as in @terminal:<id> or list_terminals." }),
@@ -92389,7 +92340,7 @@ const ASK_TIMEOUT = "15 seconds";
92389
92340
  class Peers extends Service$1()("hinacode/Peers") {
92390
92341
  }
92391
92342
  const failure = (tag2, message2) => ({ error: { tag: tag2, message: message2 } });
92392
- const make$a = gen(function* () {
92343
+ const make$9 = gen(function* () {
92393
92344
  const environments2 = yield* Environments;
92394
92345
  const hubs = [];
92395
92346
  let nextId = 1;
@@ -92442,15 +92393,15 @@ const make$a = gen(function* () {
92442
92393
  };
92443
92394
  return Peers.of({ ask, join: join2 });
92444
92395
  });
92445
- const layer$d = effect(Peers, make$a);
92396
+ const layer$b = effect(Peers, make$9);
92446
92397
  const TargetThreadId = String$1.annotate({
92447
92398
  description: "Id of a thread in this project, on this machine or on another of the user's machines."
92448
92399
  });
92449
92400
  const AnyThreadId = String$1.annotate({
92450
92401
  description: "Id of a thread in any project on this machine, or in this project on another of the user's machines."
92451
92402
  });
92452
- const ThreadTools = make$R(
92453
- make$D("create_thread", {
92403
+ const ThreadTools = make$Q(
92404
+ make$C("create_thread", {
92454
92405
  description: "Start another thread in this project and send it a first prompt. It appears in the user's sidebar at once and runs on its own; this call returns its id without waiting for it. Defaults to this thread's provider and model, and the model's default effort. It shows nested under this thread in the sidebar unless `nested` is false. Pass `worktree` to run it in a new git worktree, and `machine` to run it on another of the user's machines. Follow up with read_thread to check on it, send_to_thread to steer it, and stop_thread to interrupt it.",
92455
92406
  parameters: Struct({
92456
92407
  title: String$1.annotate({ description: "Shown in the sidebar." }),
@@ -92471,27 +92422,27 @@ const ThreadTools = make$R(
92471
92422
  )
92472
92423
  })
92473
92424
  }),
92474
- make$D("list_machines", {
92425
+ make$C("list_machines", {
92475
92426
  description: "List the user's machines that HinaCode connects: id, name, and whether each has a project for this GitHub repository, which create_thread needs to run a thread there. `self` marks this machine. When a machine has no such project, ask the user to add it there."
92476
92427
  }),
92477
- make$D("list_threads", {
92428
+ make$C("list_threads", {
92478
92429
  description: "List the threads in this project that are not archived: id, title, status, provider, model, who created it, and its worktree branch. `self` marks this thread. Threads of the same GitHub repository on the user's other machines are included, with the `machine` they run on."
92479
92430
  }),
92480
- make$D("search_threads", {
92431
+ make$C("search_threads", {
92481
92432
  description: "Search the threads of every project on this machine, archived ones included, by title and message text. Returns JSON with each thread's id, title, status and project, a snippet of its latest matching message when one matches, and `self` on this thread. Title matches come first, then threads with the newest matching message. Pass an id to read_thread to read it.",
92482
92433
  parameters: Struct({
92483
92434
  query: String$1.annotate({ description: "Text to find." }),
92484
92435
  limit: optionalKey(SearchLimit)
92485
92436
  })
92486
92437
  }),
92487
- make$D("read_thread", {
92438
+ make$C("read_thread", {
92488
92439
  description: "Read another thread, of any project on this machine or of this project on another of the user's machines: its status, agent and model, project and workspace, linked pull requests, whether it is waiting on the user, and its latest messages.",
92489
92440
  parameters: Struct({
92490
92441
  threadId: AnyThreadId,
92491
92442
  limit: optionalKey(ReadLimit)
92492
92443
  })
92493
92444
  }),
92494
- make$D("send_to_thread", {
92445
+ make$C("send_to_thread", {
92495
92446
  description: "Send a message to another thread of this project, on this machine or on another of the user's machines. A running thread gets it as steering input in its current turn; an idle one starts a new turn with it. `effort` applies from this message on. `model` can only change before the thread's first turn starts.",
92496
92447
  parameters: Struct({
92497
92448
  threadId: TargetThreadId,
@@ -92500,7 +92451,7 @@ const ThreadTools = make$R(
92500
92451
  effort: optionalKey(Effort)
92501
92452
  })
92502
92453
  }),
92503
- make$D("stop_thread", {
92454
+ make$C("stop_thread", {
92504
92455
  description: "Interrupt the running turn of another thread in this project, on this machine or on another of the user's machines. Does nothing if it is idle.",
92505
92456
  parameters: Struct({ threadId: TargetThreadId })
92506
92457
  })
@@ -92598,6 +92549,7 @@ const threadToolsLayer = ThreadTools.toLayer(
92598
92549
  provider: provider ?? caller.provider,
92599
92550
  model: model ?? caller.model,
92600
92551
  effort,
92552
+ accessMode: caller.accessMode,
92601
92553
  worktree,
92602
92554
  createdBy: `thread:${threadId}`
92603
92555
  };
@@ -92780,8 +92732,8 @@ const STARTS = "Starts the thread's tiny VM on first use.";
92780
92732
  const WAITS = "While the user has control it waits for them to hand it back and then returns the screen without acting.";
92781
92733
  const SHOWS = "Returns a screenshot taken just after acting.";
92782
92734
  const HANDED_BACK = "The user had control and has handed it back. The screen may have changed, so this action was not performed. Look at the screenshot before you continue.";
92783
- const VmTools = make$R(
92784
- make$D("vm_screenshot", {
92735
+ const VmTools = make$Q(
92736
+ make$C("vm_screenshot", {
92785
92737
  description: `Take a screenshot of the tiny VM's desktop. ${STARTS}`,
92786
92738
  parameters: Struct({
92787
92739
  save: optionalKey(
@@ -92791,7 +92743,7 @@ const VmTools = make$R(
92791
92743
  )
92792
92744
  })
92793
92745
  }),
92794
- make$D("vm_click", {
92746
+ make$C("vm_click", {
92795
92747
  description: `Click in the tiny VM at a point of the latest screenshot. ${STARTS} ${WAITS} ${SHOWS}`,
92796
92748
  parameters: Struct({
92797
92749
  x: Coordinate("x", "Horizontal position"),
@@ -92804,14 +92756,14 @@ const VmTools = make$R(
92804
92756
  )
92805
92757
  })
92806
92758
  }),
92807
- make$D("vm_move", {
92759
+ make$C("vm_move", {
92808
92760
  description: `Move the tiny VM's pointer to a point of the latest screenshot, for example to hover. ${STARTS} ${WAITS} ${SHOWS}`,
92809
92761
  parameters: Struct({
92810
92762
  x: Coordinate("x", "Horizontal position"),
92811
92763
  y: Coordinate("y", "Vertical position")
92812
92764
  })
92813
92765
  }),
92814
- make$D("vm_drag", {
92766
+ make$C("vm_drag", {
92815
92767
  description: `Drag with the left button held from one point of the latest screenshot to another. ${STARTS} ${WAITS} ${SHOWS}`,
92816
92768
  parameters: Struct({
92817
92769
  x: Coordinate("x", "Start position"),
@@ -92820,7 +92772,7 @@ const VmTools = make$R(
92820
92772
  toY: Coordinate("y", "End position")
92821
92773
  })
92822
92774
  }),
92823
- make$D("vm_scroll", {
92775
+ make$C("vm_scroll", {
92824
92776
  description: `Scroll the mouse wheel in the tiny VM with the pointer at a point of the latest screenshot. ${STARTS} ${WAITS} ${SHOWS}`,
92825
92777
  parameters: Struct({
92826
92778
  x: Coordinate("x", "Pointer position"),
@@ -92833,19 +92785,19 @@ const VmTools = make$R(
92833
92785
  )
92834
92786
  })
92835
92787
  }),
92836
- make$D("vm_type", {
92788
+ make$C("vm_type", {
92837
92789
  description: `Type text into the tiny VM's focused window, as key presses. Any Unicode text works; "\\n" presses Return and "\\t" Tab. Click the field first. ${STARTS} ${WAITS} ${SHOWS}`,
92838
92790
  parameters: Struct({
92839
92791
  text: String$1.check(isMaxLength(1e4)).annotate({ description: "At most 10,000 characters." })
92840
92792
  })
92841
92793
  }),
92842
- make$D("vm_key", {
92794
+ make$C("vm_key", {
92843
92795
  description: `Press keys or shortcuts in the tiny VM, xdotool style: Return, Escape, BackSpace, Tab, Page_Down, F5, ctrl+l, ctrl+shift+t, alt+F4. Separate several with spaces to press them in order. ${STARTS} ${WAITS} ${SHOWS}`,
92844
92796
  parameters: Struct({
92845
92797
  keys: String$1.annotate({ description: "For example `ctrl+a BackSpace` or `Return`." })
92846
92798
  })
92847
92799
  }),
92848
- make$D("vm_exec", {
92800
+ make$C("vm_exec", {
92849
92801
  description: `Run a bash script in the tiny VM as \`user\` (passwordless sudo, DISPLAY=:0) and return its exit code, stdout and stderr. Start GUI programs and servers with \`background: true\`. ${STARTS}`,
92850
92802
  parameters: Struct({
92851
92803
  command: String$1.annotate({ description: "Run with bash -lc." }),
@@ -92859,10 +92811,10 @@ const VmTools = make$R(
92859
92811
  )
92860
92812
  })
92861
92813
  }),
92862
- make$D("vm_stop", {
92814
+ make$C("vm_stop", {
92863
92815
  description: "Stop the thread's tiny VM. On boat.dev its disk is snapshotted and billing stops, and the next VM tool call resumes it. On an sbx host the sandbox is deleted and the next call starts a fresh one. Call it when you are done with the desktop, and do not start the VM just to stop it."
92864
92816
  }),
92865
- make$D("vm_pull_file", {
92817
+ make$C("vm_pull_file", {
92866
92818
  description: `Copy a file or folder from the tiny VM to this machine, to hand back something made or downloaded there. It lands in a new folder HinaCode picks, and the result names the path; copy or move it from there yourself. At most ${MAX_TRANSFER_BYTES / 1024 / 1024} MB, so compress or split anything bigger first. Symlinks are skipped and files lose their execute bit. ${STARTS}`,
92867
92819
  parameters: Struct({
92868
92820
  path: String$1.annotate({
@@ -92942,7 +92894,7 @@ ${notice2}`;
92942
92894
  });
92943
92895
  })
92944
92896
  );
92945
- const layer$c = effectDiscard(
92897
+ const layer$a = effectDiscard(
92946
92898
  gen(function* () {
92947
92899
  const tinyVm = yield* TinyVm;
92948
92900
  const devices = yield* Devices;
@@ -92952,11 +92904,11 @@ const layer$c = effectDiscard(
92952
92904
  yield* registerArtifactTools;
92953
92905
  yield* register(
92954
92906
  VmTools,
92955
- make$1x(EnabledWhen, () => tinyVm.enabled())
92907
+ make$1v(EnabledWhen, () => tinyVm.enabled())
92956
92908
  );
92957
92909
  yield* register(
92958
92910
  DeviceTools,
92959
- make$1x(EnabledWhen, () => devices.enabled())
92911
+ make$1v(EnabledWhen, () => devices.enabled())
92960
92912
  );
92961
92913
  })
92962
92914
  ).pipe(
@@ -92995,7 +92947,7 @@ const requireCredential = middleware(
92995
92947
  { global: true }
92996
92948
  );
92997
92949
  const httpServer = serve$1(
92998
- mergeAll(layer$c, requireCredential).pipe(
92950
+ mergeAll(layer$a, requireCredential).pipe(
92999
92951
  provideMerge(
93000
92952
  layerHttp({
93001
92953
  name: "hinacode",
@@ -93007,7 +92959,7 @@ const httpServer = serve$1(
93007
92959
  )
93008
92960
  ),
93009
92961
  { disableListenLog: true, disableLogger: true }
93010
- ).pipe(provideMerge(layer$P(createServer, { port: 0, host: "127.0.0.1" })));
92962
+ ).pipe(provideMerge(layer$M(createServer, { port: 0, host: "127.0.0.1" })));
93011
92963
  const announce = effectDiscard(
93012
92964
  gen(function* () {
93013
92965
  const { address } = yield* HttpServer;
@@ -93017,9 +92969,9 @@ const announce = effectDiscard(
93017
92969
  yield* (yield* McpCredentials).listening(url2);
93018
92970
  })
93019
92971
  );
93020
- const layer$b = announce.pipe(provide$2(httpServer));
93021
- const credentialsLayer = mergeAll(layer$M, layer$z, layer$W);
93022
- const serverLayer = layer$b;
92972
+ const layer$9 = announce.pipe(provide$2(httpServer));
92973
+ const credentialsLayer = mergeAll(layer$J, layer$x, layer$T);
92974
+ const serverLayer = layer$9;
93023
92975
  const DEFAULT_CONFIG = {
93024
92976
  lang: void 0,
93025
92977
  message: void 0,
@@ -95895,7 +95847,7 @@ function analysisJsonSchema() {
95895
95847
  });
95896
95848
  const DIFF_LIMITS = { lines: 2e4, files: 300 };
95897
95849
  const diffTooLarge = ({ additions, deletions, changedFiles }) => additions + deletions > DIFF_LIMITS.lines || changedFiles > DIFF_LIMITS.files;
95898
- const SWEEP_INTERVAL$2 = "3 minutes";
95850
+ const SWEEP_INTERVAL$1 = "3 minutes";
95899
95851
  const ANALYSIS_TIMEOUT = minutes(10);
95900
95852
  const READ_ONLY_TOOLS = ["Read", "Grep", "Glob"];
95901
95853
  const Answer = Struct({ overallSummary: String$1, groups: ArraySchema(GuideGroup) });
@@ -95948,6 +95900,7 @@ const analyze = (detail, diff, options) => gen(function* () {
95948
95900
  for await (const message2 of stream2) {
95949
95901
  if (message2.type !== "result") continue;
95950
95902
  if (message2.subtype !== "success") throw new Error(message2.errors.join("\n") || message2.subtype);
95903
+ if (message2.is_error) throw new Error(message2.result || "Claude Code returned an error");
95951
95904
  return message2.structured_output;
95952
95905
  }
95953
95906
  throw new Error("Claude Code ended without a result");
@@ -95963,7 +95916,7 @@ const analyze = (detail, diff, options) => gen(function* () {
95963
95916
  groups: answer.groups
95964
95917
  };
95965
95918
  }).pipe(scoped);
95966
- const make$9 = gen(function* () {
95919
+ const make$8 = gen(function* () {
95967
95920
  const sql = yield* SqlClient;
95968
95921
  const github = yield* GitHub;
95969
95922
  const settings = yield* Settings$1;
@@ -95973,9 +95926,9 @@ const make$9 = gen(function* () {
95973
95926
  const events2 = yield* Events;
95974
95927
  const encodeRow = encodeEffect(GuideRow);
95975
95928
  const jobs = /* @__PURE__ */ new Map();
95976
- const latestWriterPerUrl = yield* make$1k();
95977
- const oneAnalysisAtATime = makeUnsafe$8(1);
95978
- const oneStartAtATime = makeUnsafe$8(1);
95929
+ const latestWriterPerUrl = yield* make$1i();
95930
+ const oneAnalysisAtATime = makeUnsafe$7(1);
95931
+ const oneStartAtATime = makeUnsafe$7(1);
95979
95932
  const mergedOrClosed = /* @__PURE__ */ new Set();
95980
95933
  const findGuide = findOneOption({
95981
95934
  Request: String$1,
@@ -96033,7 +95986,7 @@ const make$9 = gen(function* () {
96033
95986
  if (job?.head === detail.head && (job.status === "running" || !retry22)) return;
96034
95987
  if ((yield* stored(detail.url))?.head === detail.head) return;
96035
95988
  jobs.set(detail.url, { status: "running", head: detail.head });
96036
- yield* run$4(latestWriterPerUrl, detail.url, write(detail));
95989
+ yield* run$3(latestWriterPerUrl, detail.url, write(detail));
96037
95990
  yield* publish2(detail.url);
96038
95991
  }).pipe(
96039
95992
  oneStartAtATime.withPermits(1),
@@ -96057,7 +96010,7 @@ const make$9 = gen(function* () {
96057
96010
  { concurrency: 2, discard: true }
96058
96011
  );
96059
96012
  }).pipe(catchCause((cause) => logWarning("pull request guide sweep failed", cause)));
96060
- yield* schedule(sweep, spaced(SWEEP_INTERVAL$2)).pipe(forkScoped);
96013
+ yield* schedule(sweep, spaced(SWEEP_INTERVAL$1)).pipe(forkScoped);
96061
96014
  return PullRequestGuides.of({
96062
96015
  get: (raw2) => flatMap(requireGitHubPullRequestUrl(raw2), state),
96063
96016
  ensure,
@@ -96070,7 +96023,7 @@ const failureMessage = (cause) => {
96070
96023
  const message2 = error2 instanceof Error ? error2.message : String(error2);
96071
96024
  return message2.length > 500 ? `${message2.slice(0, 500)}…` : message2;
96072
96025
  };
96073
- const layer$a = effect(PullRequestGuides, make$9);
96026
+ const layer$8 = effect(PullRequestGuides, make$8);
96074
96027
  const idleLayer = succeed$5(
96075
96028
  PullRequestGuides,
96076
96029
  PullRequestGuides.of({
@@ -96134,13 +96087,13 @@ const downloadAvatar = (fetch2, imageUrl) => gen(function* () {
96134
96087
  if (bytes2.byteLength > AVATAR_MAX_BYTES) return yield* new RelayError({ message: "The avatar is too large." });
96135
96088
  return `data:${type2};base64,${Buffer.from(bytes2).toString("base64")}`;
96136
96089
  }).pipe(timeout(seconds(30)));
96137
- const make$8 = ({ serviceUrl, fetch: fetch2 = globalThis.fetch }) => gen(function* () {
96090
+ const make$7 = ({ serviceUrl, fetch: fetch2 = globalThis.fetch }) => gen(function* () {
96138
96091
  const service2 = relayService(fetch2, serviceUrl);
96139
96092
  const secrets = yield* Secrets;
96140
96093
  const environments2 = yield* Environments;
96141
96094
  const self2 = (yield* RemoteAccess).identity;
96142
- const lock = yield* make$1w(1);
96143
- const signingIn = yield* make$1l();
96095
+ const lock = yield* make$1u(1);
96096
+ const signingIn = yield* make$1j();
96144
96097
  const nobody = {
96145
96098
  name: null,
96146
96099
  email: null,
@@ -96197,7 +96150,7 @@ const make$8 = ({ serviceUrl, fetch: fetch2 = globalThis.fetch }) => gen(functio
96197
96150
  return yield* sync$12;
96198
96151
  });
96199
96152
  const signIn = ({ openUrl }) => gen(function* () {
96200
- const attempt2 = yield* run$5(signingIn, signInThroughBrowser(openUrl));
96153
+ const attempt2 = yield* run$4(signingIn, signInThroughBrowser(openUrl));
96201
96154
  const exit2 = yield* await_(attempt2);
96202
96155
  return hasInterrupts(exit2) ? yield* status : yield* exit2;
96203
96156
  });
@@ -96287,8 +96240,8 @@ const make$8 = ({ serviceUrl, fetch: fetch2 = globalThis.fetch }) => gen(functio
96287
96240
  approveOwnLink
96288
96241
  });
96289
96242
  });
96290
- const layer$9 = (options) => effect(RelayAccount, make$8(options));
96291
- const SWEEP_INTERVAL$1 = "3 minutes";
96243
+ const layer$7 = (options) => effect(RelayAccount, make$7(options));
96244
+ const SWEEP_INTERVAL = "3 minutes";
96292
96245
  const DAY_MS = 24 * 60 * 60 * 1e3;
96293
96246
  class Settle extends Service$1()("hinacode/Settle") {
96294
96247
  }
@@ -96300,7 +96253,7 @@ const olderThan = (timestamp2, days, now2) => now2 - Date.parse(timestamp2) >= d
96300
96253
  const isIdleFor = (thread2, days, now2) => canAutoSettle(thread2) && thread2.status === "idle" && olderThan(lastActivity(thread2), days, now2);
96301
96254
  const isSettledFor = (thread2, days, now2) => thread2.status === "idle" && thread2.pinnedAt === null && thread2.settledAt !== null && olderThan(thread2.settledAt, days, now2);
96302
96255
  const isOpen$1 = (pullRequest) => pullRequest.status === "open" || pullRequest.status === "draft";
96303
- const make$7 = gen(function* () {
96256
+ const make$6 = gen(function* () {
96304
96257
  const settings = yield* Settings$1;
96305
96258
  const threads = yield* Threads;
96306
96259
  const pullRequests = yield* PullRequests;
@@ -96418,10 +96371,10 @@ const make$7 = gen(function* () {
96418
96371
  yield* forEach(all2, (thread2) => archiveIfSettledLong(thread2, now2), { discard: true });
96419
96372
  }
96420
96373
  }).pipe(catchCause((cause) => logWarning("auto settle sweep failed", cause)));
96421
- yield* schedule(sweep, spaced(SWEEP_INTERVAL$1)).pipe(forkScoped);
96374
+ yield* schedule(sweep, spaced(SWEEP_INTERVAL)).pipe(forkScoped);
96422
96375
  return Settle.of({ settle: settle2, sweep });
96423
96376
  });
96424
- const layer$8 = effect(Settle, make$7);
96377
+ const layer$6 = effect(Settle, make$6);
96425
96378
  const INTERVAL = "5 seconds";
96426
96379
  const KEPT_SAMPLES = 120;
96427
96380
  class SystemResources extends Service$1()("hinacode/SystemResources") {
@@ -96457,7 +96410,7 @@ const disksUnder = (paths) => forEach(
96457
96410
  return [...byDevice.values()].toSorted((a, b) => diskFullness(b) - diskFullness(a));
96458
96411
  })
96459
96412
  );
96460
- const make$6 = gen(function* () {
96413
+ const make$5 = gen(function* () {
96461
96414
  let samples = [];
96462
96415
  let last = cpuTimes();
96463
96416
  const sample = gen(function* () {
@@ -96479,7 +96432,7 @@ const make$6 = gen(function* () {
96479
96432
  }));
96480
96433
  return SystemResources.of({ read: read2 });
96481
96434
  });
96482
- const layer$7 = effect(SystemResources, make$6);
96435
+ const layer$5 = effect(SystemResources, make$5);
96483
96436
  class Updates extends Service$1()("hinacode/Updates") {
96484
96437
  }
96485
96438
  const unsupported = (current) => Updates.of({
@@ -96488,9 +96441,10 @@ const unsupported = (current) => Updates.of({
96488
96441
  install: void_
96489
96442
  });
96490
96443
  const providerNames = { claude: "Claude Code", codex: "Codex" };
96444
+ const firstLineOf = (text2) => text2.split("\n").map((line) => line.trim()).find((line) => line !== "")?.slice(0, 80);
96491
96445
  class SessionImports extends Service$1()("hinacode/SessionImports") {
96492
96446
  }
96493
- const make$5 = gen(function* () {
96447
+ const make$4 = gen(function* () {
96494
96448
  const sql = yield* SqlClient;
96495
96449
  const projects = yield* Projects;
96496
96450
  const threads = yield* Threads;
@@ -96590,7 +96544,7 @@ const make$5 = gen(function* () {
96590
96544
  const history = yield* read2(provider, sessionId, cwd, yield* accounts.home(accountId));
96591
96545
  const model = history.model ?? (yield* defaultModel(provider));
96592
96546
  const firstPrompt = history.messages?.find((message2) => message2.role === "user")?.parts.find((part) => part.type === "text");
96593
- const title2 = history.title ?? (firstPrompt?.type === "text" ? firstPrompt.text.split("\n")[0].slice(0, 80) : "Imported session");
96547
+ const title2 = history.title ?? (firstPrompt?.type === "text" ? firstLineOf(firstPrompt.text) : void 0) ?? "Imported session";
96594
96548
  return yield* sql.withTransaction(
96595
96549
  gen(function* () {
96596
96550
  const raced = yield* boundThread(provider, sessionId);
@@ -96629,7 +96583,7 @@ const make$5 = gen(function* () {
96629
96583
  });
96630
96584
  return SessionImports.of({ list, import: importSession });
96631
96585
  });
96632
- const layer$6 = effect(SessionImports, make$5);
96586
+ const layer$4 = effect(SessionImports, make$4);
96633
96587
  const rememberNewThreadOptions = (thread2) => gen(function* () {
96634
96588
  if (yield* Threads.use((threads) => threads.started(thread2.id))) return;
96635
96589
  const settings = yield* Settings$1.use((service2) => service2.get);
@@ -96687,7 +96641,7 @@ const handlers = {
96687
96641
  );
96688
96642
  }),
96689
96643
  "threads.list": () => Threads.use((threads) => threads.list),
96690
- "threads.create": ({ projectId, title: title2, provider: chosenProvider, model, effort, worktree, createdBy }) => gen(function* () {
96644
+ "threads.create": ({ projectId, title: title2, provider: chosenProvider, model, effort, accessMode, worktree, createdBy }) => gen(function* () {
96691
96645
  const provider = chosenProvider ?? (yield* newThreadProvider);
96692
96646
  const defaults2 = model === void 0 ? yield* newThreadOptions(provider) : { model, effort: void 0, fastMode: void 0 };
96693
96647
  const thread2 = yield* Threads.use(
@@ -96697,6 +96651,7 @@ const handlers = {
96697
96651
  provider,
96698
96652
  ...defaults2,
96699
96653
  effort: effort ?? defaults2.effort,
96654
+ accessMode,
96700
96655
  worktree,
96701
96656
  createdBy
96702
96657
  })
@@ -97261,7 +97216,7 @@ const makePrivate = (folder) => {
97261
97216
  chmodSync(folder, 448);
97262
97217
  return true;
97263
97218
  };
97264
- const make$4 = (dataDir) => gen(function* () {
97219
+ const make$3 = (dataDir) => gen(function* () {
97265
97220
  const socketPath = cliSocketPath(dataDir);
97266
97221
  const access2 = yield* RemoteAccess;
97267
97222
  const windows = yield* WindowBroadcast;
@@ -97298,7 +97253,7 @@ const make$4 = (dataDir) => gen(function* () {
97298
97253
  yield* logInfo("cli socket listening", socketPath);
97299
97254
  }).pipe(catchCause((cause) => logWarning("cli socket failed", pretty(cause))));
97300
97255
  });
97301
- const layer$5 = (dataDir) => process.platform === "win32" ? empty$9 : effectDiscard(make$4(dataDir));
97256
+ const layer$3 = (dataDir) => process.platform === "win32" ? empty$9 : effectDiscard(make$3(dataDir));
97302
97257
  const AUTH_TIMEOUT = seconds(5);
97303
97258
  const describeCause = (cause) => describeError(squash(cause));
97304
97259
  const staysOnPrivateNetworks = (socket) => [socket.localAddress, socket.remoteAddress].every((address) => address !== void 0 && isPrivateAddress(address));
@@ -97327,7 +97282,7 @@ const forward = (port, request2, response2) => {
97327
97282
  response2.on("close", () => upstream.destroy());
97328
97283
  pipeline(request2, upstream, ignoreStreamEnd);
97329
97284
  };
97330
- const make$3 = gen(function* () {
97285
+ const make$2 = gen(function* () {
97331
97286
  const access2 = yield* RemoteAccess;
97332
97287
  const apps = yield* AppConnections;
97333
97288
  const broadcast = yield* PushBroadcast;
@@ -97416,12 +97371,12 @@ const make$3 = gen(function* () {
97416
97371
  scoped,
97417
97372
  ensuring(access2.report({ listening: false }))
97418
97373
  );
97419
- const listener = yield* make$1l();
97374
+ const listener = yield* make$1j();
97420
97375
  const apply2 = (remote) => gen(function* () {
97421
97376
  yield* clear$1(listener);
97422
97377
  yield* access2.report({ listenError: null });
97423
97378
  if (!remote.enabled) return;
97424
- yield* run$5(
97379
+ yield* run$4(
97425
97380
  listener,
97426
97381
  listen(remote).pipe(
97427
97382
  catchCause((cause) => {
@@ -97446,7 +97401,7 @@ const make$3 = gen(function* () {
97446
97401
  forkScoped
97447
97402
  );
97448
97403
  });
97449
- const layer$4 = effectDiscard(make$3);
97404
+ const layer$2 = effectDiscard(make$2);
97450
97405
  const envFlag = (env, name) => {
97451
97406
  const value2 = env[name];
97452
97407
  if (value2 === void 0 || value2 === "0" || value2 === "false") return false;
@@ -97526,55 +97481,6 @@ const linkInstructions = (url2) => [
97526
97481
  "Waiting for you to approve it…",
97527
97482
  ""
97528
97483
  ].join("\n");
97529
- const SWEEP_CONCURRENCY = 4;
97530
- class PullRequestLifecycle extends Service$1()("hinacode/PullRequestLifecycle") {
97531
- }
97532
- const make$2 = gen(function* () {
97533
- const sourceControl = yield* SourceControl;
97534
- const pullRequests = yield* PullRequests;
97535
- const settle2 = (linkId, pullRequest) => asVoid(pullRequests.observe(linkId, pullRequest.status));
97536
- const announce2 = ({ linkId, url: url2 }) => sourceControl.pullRequest(url2).pipe(
97537
- retry$3({ times: 2, schedule: spaced("5 seconds") }),
97538
- flatMap((pullRequest) => settle2(linkId, pullRequest)),
97539
- catchCause((cause) => logWarning("could not announce a linked pull request", url2, cause))
97540
- );
97541
- const sweep = gen(function* () {
97542
- const readable2 = yield* filter$3(yield* pullRequests.unsettled, (link) => sourceControl.installedFor(link.url));
97543
- const byUrl2 = Map.groupBy(readable2, (link) => link.url);
97544
- yield* forEach(
97545
- byUrl2,
97546
- ([url2, links]) => sourceControl.pullRequest(url2).pipe(
97547
- flatMap(
97548
- (pullRequest) => forEach(links, (link) => settle2(link.id, pullRequest), { discard: true })
97549
- ),
97550
- catchCause((cause) => logWarning("pull request lifecycle skipped a read", url2, cause))
97551
- ),
97552
- { concurrency: SWEEP_CONCURRENCY, discard: true }
97553
- );
97554
- }).pipe(catchCause((cause) => logWarning("pull request lifecycle sweep failed", cause)));
97555
- return PullRequestLifecycle.of({ announce: announce2, sweep });
97556
- });
97557
- const layer$3 = effect(PullRequestLifecycle, make$2);
97558
- const SWEEP_INTERVAL = "3 minutes";
97559
- const layer$2 = effectDiscard(
97560
- gen(function* () {
97561
- const bus = yield* EventBus;
97562
- const lifecycle = yield* PullRequestLifecycle;
97563
- const subscription = yield* subscribe(bus);
97564
- const reactions = yield* make$1j();
97565
- yield* take$3(subscription).pipe(
97566
- flatMap(
97567
- (event) => run$3(
97568
- reactions,
97569
- lifecycle.announce(event).pipe(catchCause((cause) => logWarning("reaction failed", event.topic, cause)))
97570
- )
97571
- ),
97572
- forever,
97573
- forkScoped
97574
- );
97575
- yield* schedule(lifecycle.sweep, spaced(SWEEP_INTERVAL)).pipe(forkScoped);
97576
- })
97577
- );
97578
97484
  const snapshotFromDetail = (detail) => ({
97579
97485
  status: detail.status,
97580
97486
  checks: detail.checks,
@@ -97702,7 +97608,7 @@ const make$1 = gen(function* () {
97702
97608
  const sourceControl = yield* SourceControl;
97703
97609
  const threads = yield* Threads;
97704
97610
  const runner = yield* AgentRunner;
97705
- const semaphore = makeUnsafe$8(1);
97611
+ const semaphore = makeUnsafe$7(1);
97706
97612
  const stillCurrent = (linkId, generation) => map$2(pullRequests.find(linkId), (current) => current?.watch?.generation === generation);
97707
97613
  const canDeliver = (link, generation) => threads.get(link.threadId).pipe(
97708
97614
  flatMap(
@@ -121834,7 +121740,7 @@ const traceLayer = (file, ledger) => {
121834
121740
  `);
121835
121741
  }
121836
121742
  }
121837
- return succeed$5(Tracer, make$1A({ span: (options) => new RecordedSpan(options) }));
121743
+ return succeed$5(Tracer, make$1y({ span: (options) => new RecordedSpan(options) }));
121838
121744
  };
121839
121745
  const STALL_MS = 100;
121840
121746
  const CHECK_INTERVAL$1 = "1 second";
@@ -121914,7 +121820,7 @@ const agentProviders = (env) => {
121914
121820
  simulated: claude !== void 0,
121915
121821
  simulatedProviders: new Set(claude === void 0 ? [] : ["claude"]),
121916
121822
  layer: mergeAll(
121917
- claude ?? layer$X,
121823
+ claude ?? layer$U,
121918
121824
  CodexProvider.layer,
121919
121825
  MuseProvider.layer,
121920
121826
  OpencodeProvider.layer,
@@ -121923,7 +121829,7 @@ const agentProviders = (env) => {
121923
121829
  };
121924
121830
  };
121925
121831
  const linearLayer = (env) => {
121926
- if (env["HINACODE_MOCK_LINEAR"] === void 0) return layer$g.pipe(provide$2(layer$W));
121832
+ if (env["HINACODE_MOCK_LINEAR"] === void 0) return layer$e.pipe(provide$2(layer$T));
121927
121833
  if (!env["HINACODE_USER_DATA"]) throw new Error("Linear simulation requires HINACODE_USER_DATA");
121928
121834
  return mockLayer;
121929
121835
  };
@@ -121937,7 +121843,7 @@ const makeAppLayer = ({
121937
121843
  artifactInspector = unavailable
121938
121844
  }) => {
121939
121845
  const providers = agentProviders(process.env);
121940
- const settings = layer$V(userData);
121846
+ const settings = layer$S(userData);
121941
121847
  const binaries = effect(
121942
121848
  AgentBinaries,
121943
121849
  gen(function* () {
@@ -121954,22 +121860,22 @@ const makeAppLayer = ({
121954
121860
  const spans = new SpanLedger(STALL_MS);
121955
121861
  const chats = effectDiscard(Projects.use((projects) => projects.ensureChats(join$1(userData, "chats"))));
121956
121862
  const domain = mergeAll(
121957
- layer$A.pipe(
121863
+ layer$y.pipe(
121958
121864
  provideMerge(chats),
121959
- provideMerge(layer$D(join$1(userData, "scratch"))),
121865
+ provideMerge(layer$B(join$1(userData, "scratch"))),
121866
+ provideMerge(layer$A),
121867
+ provideMerge(layer$z),
121960
121868
  provideMerge(layer$C),
121961
- provideMerge(layer$B),
121962
- provideMerge(layer$E),
121963
- provideMerge(layer$F),
121869
+ provideMerge(layer$D),
121964
121870
  provideMerge(settings)
121965
121871
  ),
121966
- layer$m(userData),
121967
- layer$K,
121968
- layer$y(join$1(userData, "attachments")),
121969
- layer$p(join$1(userData, "artifacts")),
121872
+ layer$k(userData),
121873
+ layer$H,
121874
+ layer$w(join$1(userData, "attachments")),
121875
+ layer$n(join$1(userData, "artifacts")),
121970
121876
  artifactInspector,
121971
- layer$v,
121972
- layer$k
121877
+ layer$t,
121878
+ layer$i
121973
121879
  );
121974
121880
  const naming = providers.simulated ? effect(
121975
121881
  ThreadNaming,
@@ -121977,19 +121883,19 @@ const makeAppLayer = ({
121977
121883
  nameFromPrompt: () => void_,
121978
121884
  regenerateTitle: (threadId) => threads.get(threadId)
121979
121885
  }))
121980
- ) : layer$x;
121981
- const remoteAccess = layer$U.pipe(provide$2(layer$W));
121886
+ ) : layer$v;
121887
+ const remoteAccess = layer$R.pipe(provide$2(layer$T));
121982
121888
  const relayServiceUrl = process.env["HINACODE_RELAY_URL"] ?? DEFAULT_RELAY_SERVICE_URL;
121983
- const relay2 = layer$T({ serviceUrl: relayServiceUrl, cloudflaredDir: join$1(userData, "cloudflared") }).pipe(
121984
- provide$2(mergeAll(remoteAccess, layer$W))
121889
+ const relay2 = layer$Q({ serviceUrl: relayServiceUrl, cloudflaredDir: join$1(userData, "cloudflared") }).pipe(
121890
+ provide$2(mergeAll(remoteAccess, layer$T))
121985
121891
  );
121986
- const boat = layer$f(process.env).pipe(provide$2(layer$W));
121987
- const tinyVm = layer$e({ configPath: sbxConfigPath, env: process.env }, join$1(userData, "tiny-vm"), {
121892
+ const boat = layer$d(process.env).pipe(provide$2(layer$T));
121893
+ const tinyVm = layer$c({ configPath: sbxConfigPath, env: process.env }, join$1(userData, "tiny-vm"), {
121988
121894
  desktopRedirect: serve2 === void 0
121989
121895
  }).pipe(provide$2(boat));
121990
- const peers = layer$d.pipe(
121991
- provideMerge(layer$l),
121992
- provide$2(mergeAll(remoteAccess, layer$W))
121896
+ const peers = layer$b.pipe(
121897
+ provideMerge(layer$j),
121898
+ provide$2(mergeAll(remoteAccess, layer$T))
121993
121899
  );
121994
121900
  const devices = devicesLayer({
121995
121901
  drivers: {
@@ -122000,44 +121906,43 @@ const makeAppLayer = ({
122000
121906
  });
122001
121907
  const features = mergeAll(
122002
121908
  credentialsLayer,
122003
- layer$Y,
122004
- layer$n,
122005
- layer$7,
121909
+ layer$V,
121910
+ layer$l,
121911
+ layer$5,
122006
121912
  naming,
122007
121913
  remoteAccess,
122008
121914
  relay2,
122009
- layer$S.pipe(provide$2(remoteAccess)),
121915
+ layer$P.pipe(provide$2(remoteAccess)),
122010
121916
  tinyVm,
122011
121917
  peers,
122012
121918
  devices,
122013
121919
  linearLayer(process.env)
122014
121920
  ).pipe(provide$2(domain));
122015
- const agents = layer$w.pipe(provideMerge(mergeAll(domain, features)));
121921
+ const agents = layer$u.pipe(provideMerge(mergeAll(domain, features)));
122016
121922
  const services = mergeAll(
122017
- layer$h.pipe(provide$2(layer$i)),
122018
- layer$8,
122019
- layer$o,
121923
+ layer$f.pipe(provide$2(layer$g)),
121924
+ layer$6,
121925
+ layer$m,
122020
121926
  layer$1,
122021
- layer$3,
122022
- providers.simulated ? idleLayer : layer$a,
121927
+ providers.simulated ? idleLayer : layer$8,
122023
121928
  updates,
122024
121929
  serverLayer,
122025
- layer$q(join$1(userData, "cache")),
122026
- layer$6,
122027
- layer$9({ serviceUrl: relayServiceUrl }).pipe(provide$2(layer$W)),
121930
+ layer$o(join$1(userData, "cache")),
121931
+ layer$4,
121932
+ layer$7({ serviceUrl: relayServiceUrl }).pipe(provide$2(layer$T)),
122028
121933
  followRelayLayer,
122029
- layer$t.pipe(provide$2(layer$W))
121934
+ layer$r.pipe(provide$2(layer$T))
122030
121935
  ).pipe(provideMerge(agents));
122031
- return mergeAll(layer$4, layer$5(userData), answerAsksLayer, layer$2).pipe(
121936
+ return mergeAll(layer$2, layer$3(userData), answerAsksLayer).pipe(
122032
121937
  provideMerge(effectDiscard(serve2 ? applyServeConfig(serve2) : void_)),
122033
121938
  provideMerge(services),
122034
- provide$2(providers.layer.pipe(provide$2(mergeAll(settings, layer$W, binaries)))),
121939
+ provide$2(providers.layer.pipe(provide$2(mergeAll(settings, layer$T, binaries)))),
122035
121940
  provideMerge(binaries),
122036
- provideMerge(layer$G),
122037
- provideMerge(mergeAll(layer$L, layer$I, layer$j, layer$J)),
121941
+ provideMerge(layer$E),
121942
+ provideMerge(mergeAll(layer$I, layer$G, layer$h)),
122038
121943
  provideMerge(makeEventsLayer()),
122039
- provide$2(mergeAll(layer$r(join$1(userData, "hinacode.sqlite")), keyring)),
122040
- provide$2(layer$$),
121944
+ provide$2(mergeAll(layer$p(join$1(userData, "hinacode.sqlite")), keyring)),
121945
+ provide$2(layer$Y),
122041
121946
  provideMerge(watchdogLayer(spans)),
122042
121947
  provideMerge(traceLayer(process.env["HINACODE_TRACE"], spans))
122043
121948
  );
@@ -122048,6 +121953,7 @@ const AUTO_INSTALL_INTERVAL = "1 minute";
122048
121953
  const INSTALL_TIMEOUT_MS = 10 * 6e4;
122049
121954
  const NpmRelease = Struct({ version: String$1 });
122050
121955
  const globalPrefix = (packageRoot2) => {
121956
+ if (packageRoot2 === void 0) return void 0;
122051
121957
  const nodeModules = dirname(packageRoot2);
122052
121958
  const lib2 = dirname(nodeModules);
122053
121959
  const isGlobal = basename(packageRoot2) === "hinacode" && basename(nodeModules) === "node_modules";
@@ -122070,7 +121976,7 @@ const make = ({ current, packageRoot: packageRoot2, registry: registry2, restart
122070
121976
  if (!response2.ok) throw new Error(`npm answered ${response2.status}`);
122071
121977
  return decodeUnknownSync(NpmRelease)(await response2.json()).version;
122072
121978
  });
122073
- const checkLock = yield* make$1w(1);
121979
+ const checkLock = yield* make$1u(1);
122074
121980
  const check = suspend(
122075
121981
  () => state.type === "downloading" ? void_ : set2({ type: "checking" }).pipe(
122076
121982
  andThen(latest),
@@ -122185,8 +122091,8 @@ const hydratePath = (env, cacheFile) => {
122185
122091
  };
122186
122092
  const QUIT_TIMEOUT_MS = 5e3;
122187
122093
  const LISTEN_TIMEOUT_MS = 5e3;
122188
- const { version } = createRequire(import.meta.url)("../../package.json");
122189
- const packageRoot = fileURLToPath(new URL("../..", import.meta.url));
122094
+ const { version } = packageJson;
122095
+ const packageRoot = isSea() ? void 0 : fileURLToPath(new URL("../..", import.meta.url));
122190
122096
  const appData = () => process.platform === "darwin" ? join$1(homedir(), "Library", "Application Support") : process.platform === "win32" ? process.env["APPDATA"] ?? join$1(homedir(), "AppData", "Roaming") : process.env["XDG_CONFIG_HOME"] ?? join$1(homedir(), ".config");
122191
122097
  const lockDataDir = (dir) => {
122192
122098
  const desktop = desktopPid(chromiumDir(dir));
@@ -122257,7 +122163,7 @@ const serve = async (flags, userData) => {
122257
122163
  mkdirSync(userData, { recursive: true, mode: 448 });
122258
122164
  lockDataDir(userData);
122259
122165
  await hydratePath(process.env).ready;
122260
- const runtime = make$1i(
122166
+ const runtime = make$1h(
122261
122167
  makeAppLayer({
122262
122168
  userData,
122263
122169
  sbxConfigPath: join$1(appData(), "sbx", "config.json"),
@@ -122318,10 +122224,10 @@ const pair = async (userData) => {
122318
122224
  process.exitCode = 1;
122319
122225
  };
122320
122226
  if (!existsSync(database)) return noCloud();
122321
- const runtime = make$1i(
122322
- layer$U.pipe(
122323
- provideMerge(mergeAll(layer$V(userData), layer$W)),
122324
- provideMerge(mergeAll(layer$r(database), noKeyring)),
122227
+ const runtime = make$1h(
122228
+ layer$R.pipe(
122229
+ provideMerge(mergeAll(layer$S(userData), layer$T)),
122230
+ provideMerge(mergeAll(layer$p(database), noKeyring)),
122325
122231
  provide$2(succeed$5(MinimumLogLevel, "Warn"))
122326
122232
  )
122327
122233
  );