hinacode 0.3.0-alpha.6 → 0.3.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/server/chunks/{remote-DE8gPkc-.js → remote-Cc8fvZ8_.js} +216 -213
- package/out/server/chunks/sdk-DZclv7I1.js +33693 -0
- package/out/server/cli.js +1 -1
- package/out/server/daemon.js +958 -294
- package/package.json +1 -1
- package/out/server/chunks/sdk-BjcPK2t_.js +0 -30502
package/out/server/daemon.js
CHANGED
|
@@ -7,15 +7,15 @@ import { createRequire } from "node:module";
|
|
|
7
7
|
import { homedir, networkInterfaces, tmpdir, userInfo, hostname, loadavg, cpus, totalmem } from "node:os";
|
|
8
8
|
import path__default, { join as join$1, sep, resolve as resolve$1, basename, relative, dirname, isAbsolute, extname, delimiter } from "node:path";
|
|
9
9
|
import NodeUrl__default, { fileURLToPath } from "node:url";
|
|
10
|
-
import { bk as Tuple, d as dual, ai as assignProperty, b6 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, bd 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 BaseProto, bV as toSeconds, aI as TaggedError, bW as Error$1, bX as symbol$2, bY as structure, bZ as symbol$3, b_ as redact$1, b$ as symbolRedactable, O as make$1m, R as Reference, c0 as strictEqual, e as hasProperty, c1 as fromIterable$2, c2 as PipeInspectableProto, c3 as array$2, c4 as make$1n, c5 as makeEquivalence$2, c6 as getOrThrow, c7 as map$1, c8 as try_, c9 as flatMap$1, ca as combine, cb as string$2, cc as number$4, cd as optimize, n as succeed$1, ce as Random$1, cf as contextWith, cg as infinity, w as withFiber$1, b as sync$1, ch as updateContext, ci as merge$3, cj as succeed$2, ck as exitHasInterrupts, cl as ClockRef, cm as forkUnsafe, cn as onExitUnsafe, co as void_$2, cp as fiberInterrupt, cq as fiberJoin, cr as filterMap, cs as failVoid, ct as isGreaterThanOrEqualTo$1, cu as LogLevelOrder, aN as acquireRelease, i as isEffect, cv as interruptAs, r as runFork, cw as isFailure$1, h as hasInterruptsOnly, cx as into, cy as asVoid, cz as done, cA as filterInterruptors, cB as interruptAllAs, cC as interruptAll, cD as empty$5, cE as forkUnsafe$1, cF as runPromise, cG as runPromiseWith, cH as runPromiseExit, cI as runPromiseExitWith, cJ as runSync, cK as runSyncWith, cL as runSyncExit, cM as runSyncExitWith, cN as runCallback, cO as runCallbackWith, cP as makeMemoMapUnsafe, aB as provideContext, cQ as buildWithMemoMap, cR as flatten, cS as await_, cT as scopeRemoveFinalizerUnsafe, cU as die, cV as isResult, cW as isSuccess, m as identity, cX as effect, aj as Service$1, cY as contextWith$1, cZ as getOrUndefined, am as gen, c_ as context, c$ as make$1o, V as map$2, d0 as fromQueue, d1 as unwrap, aq as provideService, d2 as onExit, d3 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, d4 as makeSpanUnsafe, d5 as TracerTimingEnabled, d6 as endSpan, d7 as makeSpanScoped, d8 as useSpan, d9 as constUndefined, da as provideService$1, db as ParentSpan, z as scoped, t as tapCause, y as fnUntraced, dc as serviceOption, a3 as match, dd as make$1p, de as provide$1, df as onError, dg as catchIf, dh as scope$1, di as getOption, dj as onExitPrimitive, a as isSuccess$1, dk as catchCause, dl as matchCauseEffect, dm as failCause, dn as combine$1, a9 as orDie, dp as add$1, dq as makeUnsafe$8, dr as fromReasons, ds as isFailReason, dt as makeDieReason, du as reasonAnnotations, dv as failCause$1, dw as yieldNow, dx as constTrue, dy as normalizeNonEmpty, dz as unbounded, dA as publishUnsafe, dB as fromPubSub, dC as getDefaultExportFromCjs, a$ as all$1, M as match$1, b5 as promise$1, b4 as ProviderId, dD as now, dE as formatIso, a2 as pipe$2, dF as sort, Y as map$3, dG as flatMapNullishOr, dH as catch_, bg as map$4, dI as fromNullishOr, x as mapError, dJ as logDebug, dK as annotateLogs, dL as withSpan, ay as catchTag, dM as logInfo, dN as catchDefect, dO as filterOrFail, dP as make$1q, dQ as Number$1, dR as encodeEffect, k as decodeUnknownEffect, aZ as succeedNone, a7 as isReadonlyArrayNonEmpty, dS as asSome, dT as mutable, A as ArraySchema, dU as NoSuchElementError, dV as Literals, b1 as Number$2, ba as NullOr, aD as Struct, dW as FileSystem, dX as orElseSucceed, dY as chatFolder, dZ as Boolean$1, d_ as ProjectKind, d$ as ignore$1, e0 as logWarning, aT as callback, e1 as sleep$3, e2 as forkDetach, e3 as succeed$3, e4 as signedOutFailure, e5 as decodeUnknownOption, an as isNone, aL as fromJsonString, L as Literal, e6 as Unknown, e7 as toArray, aJ as seconds, f as optionalKey, e8 as cachedWithTTL, e9 as minutes, aO as unbounded$1, ea as toAsyncIterable, bf as tryPromise, eb as timeout, ec as addFinalizer$1, ed as callback$1, ee as offer, ef as withPermit, eg as acquireUseRelease, aP as endUnsafe, eh as shutdownUnsafe, bc as try_$1, ei as forkIn, ej as fromAsyncIterable, ek as runForEach, el as pretty, em as CLAUDE_EFFORT_LEVELS, en as ensuring$1, eo as currentTimeMillis, ep as sum, eq as publishedArtifactId, er as PUBLISH_DOCUMENT_TOOL, es as PUBLISH_ARTIFACT_TOOL, et as PUBLISH_WHITEBOARD_TOOL, eu as isDone, ev as empty$6, ew as succeed$4, ex as fromIterable$3, ey as flatMap$2, ez as interruptWhen, eA as concat, eB as fromEffectDrain, eC as fromEffect, eD as fromIterableEffect, eE as suspend$1, eF as unlistedModel, eG as make$1r, eH as tap$2, eI as tick, eJ as map$5, eK as drop, eL as merge$4, eM as onInterrupt, aS as timeoutOrElse, eN as format$3, eO as getOrNull, eP as Record, eQ as make$1s, eR as make$1t, aa as take, eS as join$2, ab as raceFirst, eT as end, eU as forkScoped, eV as isObject$2, J as getOrElse, eW as repeat, ao as succeed$5, eX as subscribe, eY as fromSubscription, eZ as publish, e_ as defaultSettings, e$ as Settings$2, f0 as flatMapNullishOr$1, f1 as option, f2 as delay, f3 as effectContext, aA as make$1u, f4 as provide$2, f5 as monotonicTimeNanos, f6 as retry$3, f7 as spaced, f8 as die$1, f9 as PRIVATE_NETWORKS, fa as effectDiscard, fb as provideMerge, fc as UpdatableProviderId, fd as decodeUnknownSync, fe as spawnsSubagent, ff as isPublishArtifactTool, fg as outputText, fh as publishedArtifact, fi as toolArgument, fj as isPublishDocumentTool, fk as AgentProfile, fl as Void, fm as AccountProviderId, fn as filter$1, fo as AgentAccount, fp as commonjsGlobal, fq as isRunAgentTool, fr as presetModels, fs as encodeSync, ft as mergeAll, b9 as PushEvent, fu as filter$2, fv as take$1, fw as runDrain, fx as forever, fy as never$1, fz as min, l as logError, fA as ChildProcessSpawner, fB as make$1v, fC as mkString, fD as decodeText$1, fE as ForkPoint, fF as TokenUsage, fG as MessagePart, fH as Message, fI as sliding, fJ as PullRequestReviewer, fK as PullRequestLabel, fL as PullRequestComment, fM as DiffSide, fN as omit$1, fO as subtract, fP as PULL_REQUEST_REFRESH, ae as catchTags, fQ as parseGitHubRepository, fR as parseGitHubPullRequestUrl, I as Int, fS as request$2, fT as Class, fU as ProjectAction, fV as Project, fW as BooleanFromBit, fX as Worktree, fY as timeoutOption, be as isThreadBusy, bb as ThreadStatus, fZ as ScheduledMessage, f_ as QueuedMessage, f$ as UsageLimit, aH as Thread, g0 as getOrThrow$1, g1 as PullRequestWatch, g2 as PullRequestLink, g3 as PullRequestStatus, g4 as allWatchEventKinds, g5 as enabledProviders, g6 as transcriptThreadId, g7 as resumeGraceMs, g8 as fail$3, g9 as WAIT_AGENT_TOOL, bh as tapError, ga as filter$3, gb as isMaxLength, gc as schedule, aR as RpcMethods, gd as BrowserFrame, ge as PagePick, gf as defaultClientSettings, gg as ClientSettings$1, gh as parsePairingUrl, gi as pairingUrl, gj as Environment, ah as getOrUndefined$1, az as result$1, gk as relayWebSocketUrl, gl as remoteWebSocketUrl, aW as WebSocket, aM as ServerFrame, gm as CHALLENGE_WAIT_MS, aU as methodKind, gn as race, go as dialPlan, gp as REMOTE_PROTOCOL_VERSION, gq as DIRECT_CHECK_INTERVAL_MS, gr as DIRECT_CHECK_TIMEOUT_MS, gs as LinearIssue, gt as externalSpan, af as fromUndefinedOr, gu as zero$1, gv as fromInput$2, gw as badArgument, gx as isSchemaError, gy as isNoSuchElementError, gz as StackTrace, gA as mapEager, gB as updateContext$1, gC as makeUnsafe$9, gD as tag$2, gE as Error$2, gF as fromInputUnsafe$1, gG as Path, gH as run$6, gI as mebibytes, gJ as Class$1, gK as constFalse, gL as withLogSpan, gM as log, gN as Tracer, gO as nativeTracer, gP as hasInterrupts$1, gQ as succeed$6, gR as setStackTraceLimit, gS as fail$4, gT as getStackTraceLimit, gU as fiberEnterUninterruptibleUnsafe, gV as contA, gW as effectIsExit, gX as closeUnsafe, gY as contE, gZ as reportCauseUnsafe, g_ as matchCauseEffectEager, g$ as flatMapEager, h0 as fromReadable, h1 as toArrayBuffer, G as cached$1, h2 as layer$U, h3 as pipeThroughDuplex, h4 as toUint8Array, bj as layer$V, b0 as fromResult, h5 as WebSocketServer, h6 as orDie$1, h7 as runForEachArray, h8 as interruptible, h9 as die$2, ha as merge$5, hb as succeedContext, hc as unwrap$1, hd as withFiberSucceed, he as reverse, hf as getOrUndefinedUnsafe, hg as CurrentMemoMap, a0 as empty$7, hh as fiberEnterInterruptibleUnsafe, hi as compose$1, hj as Timestamp, hk as AutomationTrigger, hl as AutomationRun, hm as isPolledTrigger, hn as launch, s as squash, ho as Duration, hp as DateTimeUtc, hq as withConstructorDefault, hr as withDecodingDefault, hs as Redacted, ht as Tuple$1, hu as isRedacted, hv as MutableJson, ag as isNotUndefined, hw as Never, ak as empty$8, hx as toJsonSchemaDocument, hy as annotateCurrentSpan, hz as isUndefined, hA as failCause$2, hB as forkChild, hC as catch_$1, hD as isSchemaError$1, hE as failCause$3, hF as mapEffect, hG as onEnd, hH as isSchema, aQ as encodeUnknownEffect, hI as annotate, hJ as fail$5, hK as make$1w, hL as declare, hM as isStream, hN as Class$2, hO as Exit, bi as provide$3, hP as provideContext$1, hQ as StructWithRest, hR as JsonObject$3, hS as Opaque, hT as decodeTo, hU as transformOptional, hV as flatMap$3, hW as toType, hX as Any, hY as UndefinedOr, hZ as Finite, h_ as passthrough, h$ as Uint8ArrayFromBase64, i0 as Json, i1 as TemplateLiteral, i2 as decode$3, i3 as withDefault, i4 as isBetween, W as taggedEnum, i5 as take$2, i6 as toCodecJson, i7 as isNullish, i8 as isString, i9 as bounded, ia as withParentSpan, ib as die$3, ic as offerAll, id as interrupt$2, ie as interruptors, ig as decodeSync, ih as catchCauseIf, ii as NonEmptyArray, ij as decode$4, ik as decodeUnknownResult, il as fn, im as isTagged, io as isReadonlyObject, ip as IllegalArgumentError, iq as encode$1, ir as collect, is as catchDone, it as takeAll, iu as fromArray, iv as whileLoop, iw as isExit, ix as matchEffect, iy as defaultFormatter, iz as logFatal, iA as isDeferred, iB as hasDies, c as constVoid, iC as shutdown, iD as Scheduler, iE as CurrentLogLevel, q as is$2, iF as decodeEffect, iG as UnknownFromJsonString, iH as ignoreCause, iI as Class$3, iJ as TaggedStruct, iK as toEncoded, iL as when$2, iM as threadDeviceId, iN as devicePlatformOf, ap as value$2, iO as runLast, iP as fromOption, iQ as RUN_AGENT_TOOL, iR as ARTIFACT_THEME_GUIDE, iS as DeviceUrl, iT as DeviceApp, iU as DeviceButton, iV as WatchEventKind, iW as isPattern, iX as RelayHostList, iY as RelayMachineList, iZ as GuideGroup, i_ as PullRequestGuide, i$ as uninterruptible, j0 as flatten$1, j1 as diskFullness, j2 as startingProvider, j3 as min$1, j4 as exponential, j5 as desktopOnlyPushes, j6 as reachesPhone, j7 as mutations, j8 as desktopOnlyMethods, j9 as isAddressNotUpYet, ja as ClientFrame, aY as REMOTE_MAX_FRAME_BYTES, aX as REMOTE_PATH, jb as empty$9, a_ as cliSocketPath, jc as BindHost, jd as take$3, je as getAugmentedNamespace, jf as make$1x, jg as NativeSpan, jh as currentTimeNanos, aC as MinimumLogLevel, ji as isPortInUse } from "./chunks/remote-DE8gPkc-.js";
|
|
11
|
-
import
|
|
10
|
+
import { bk as Tuple, d as dual, ai as assignProperty, b6 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, bd 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 BaseProto, bV as toSeconds, aI as TaggedError, bW as Error$1, bX as symbol$2, bY as structure, bZ as symbol$3, b_ as redact$1, b$ as symbolRedactable, O as make$1o, R as Reference, c0 as strictEqual, e as hasProperty, c1 as fromIterable$2, c2 as PipeInspectableProto, c3 as array$2, c4 as make$1p, c5 as makeEquivalence$2, c6 as getOrThrow, c7 as map$1, c8 as try_, c9 as flatMap$1, ca as combine, cb as string$2, cc as number$4, cd as optimize, n as succeed$1, ce as Random$1, cf as contextWith, cg as infinity, w as withFiber$1, b as sync$1, ch as updateContext, ci as merge$3, cj as succeed$2, ck as exitHasInterrupts, cl as ClockRef, cm as forkUnsafe, cn as onExitUnsafe, co as void_$2, cp as fiberInterrupt, cq as fiberJoin, cr as filterMap, cs as failVoid, ct as isGreaterThanOrEqualTo$1, cu as LogLevelOrder, aN as acquireRelease, i as isEffect, cv as interruptAs, r as runFork, cw as isFailure$1, h as hasInterruptsOnly, cx as into, cy as asVoid, cz as done, cA as filterInterruptors, cB as interruptAllAs, cC as interruptAll, cD as empty$5, cE as forkUnsafe$1, cF as runPromise, cG as runPromiseWith, cH as runPromiseExit, cI as runPromiseExitWith, cJ as runSync, cK as runSyncWith, cL as runSyncExit, cM as runSyncExitWith, cN as runCallback, cO as runCallbackWith, cP as makeMemoMapUnsafe, aB as provideContext, cQ as buildWithMemoMap, cR as flatten, cS as await_, cT as scopeRemoveFinalizerUnsafe, cU as die, cV as isResult, cW as isSuccess, m as identity, cX as effect, aj as Service$1, cY as contextWith$1, cZ as getOrUndefined, am as gen, c_ as context, c$ as make$1q, V as map$2, d0 as fromQueue, d1 as unwrap, aq as provideService, d2 as onExit, d3 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, d4 as makeSpanUnsafe, d5 as TracerTimingEnabled, d6 as endSpan, d7 as makeSpanScoped, d8 as useSpan, d9 as constUndefined, da as provideService$1, db as ParentSpan, z as scoped, t as tapCause, y as fnUntraced, dc as serviceOption, a3 as match, dd as make$1r, de as provide$1, df as onError, dg as catchIf, dh as scope$1, di as getOption, dj as onExitPrimitive, a as isSuccess$1, dk as catchCause, dl as matchCauseEffect, dm as failCause, dn as combine$1, a9 as orDie, dp as add$1, dq as makeUnsafe$8, dr as fromReasons, ds as isFailReason, dt as makeDieReason, du as reasonAnnotations, dv as failCause$1, dw as yieldNow, dx as constTrue, dy as normalizeNonEmpty, dz as unbounded, dA as publishUnsafe, dB as fromPubSub, dC as getDefaultExportFromCjs, a$ as all$1, M as match$1, b5 as promise$1, b4 as ProviderId, dD as now, dE as formatIso, a2 as pipe$2, dF as sort, Y as map$3, dG as flatMapNullishOr, dH as catch_, bg as map$4, dI as fromNullishOr, x as mapError, dJ as logDebug, dK as annotateLogs, dL as withSpan, ay as catchTag, dM as logInfo, dN as catchDefect, dO as filterOrFail, dP as make$1s, dQ as Number$1, dR as encodeEffect, k as decodeUnknownEffect, aZ as succeedNone, a7 as isReadonlyArrayNonEmpty, dS as asSome, dT as mutable, A as ArraySchema, dU as NoSuchElementError, dV as Literals, b1 as Number$2, ba as NullOr, aD as Struct, dW as FileSystem, dX as orElseSucceed, dY as chatFolder, dZ as Boolean$1, d_ as ProjectKind, d$ as ignore$1, e0 as logWarning, aT as callback, e1 as sleep$3, e2 as forkDetach, e3 as succeed$3, e4 as signedOutFailure, e5 as decodeUnknownOption, an as isNone, aL as fromJsonString, L as Literal, e6 as Unknown, e7 as toArray, aJ as seconds, f as optionalKey, e8 as cachedWithTTL, e9 as minutes, aO as unbounded$1, ea as toAsyncIterable, bf as tryPromise, eb as timeout, ec as addFinalizer$1, ed as callback$1, ee as offer, ef as withPermit, eg as acquireUseRelease, aP as endUnsafe, eh as shutdownUnsafe, ei as make$1t, bc as try_$1, ej as forkIn, ek as fromAsyncIterable, el as runForEach, s as squash, em as CLAUDE_EFFORT_LEVELS, en as ensuring$1, eo as currentTimeMillis, ep as sum, eq as race, er as publishedArtifactId, es as PUBLISH_DOCUMENT_TOOL, et as PUBLISH_ARTIFACT_TOOL, eu as PUBLISH_WHITEBOARD_TOOL, ev as isDone, ew as empty$6, ex as succeed$4, ey as fromIterable$3, ez as flatMap$2, eA as interruptWhen, eB as concat, eC as fromEffectDrain, eD as fromEffect, eE as fromIterableEffect, eF as suspend$1, eG as unlistedModel, eH as make$1u, eI as tap$2, eJ as tick, eK as map$5, eL as drop, eM as merge$4, eN as onInterrupt, aS as timeoutOrElse, eO as format$3, eP as getOrNull, eQ as Record, eR as make$1v, aa as take, eS as join$2, ab as raceFirst, eT as end, eU as forkScoped, eV as isObject$2, J as getOrElse, eW as repeat, ao as succeed$5, eX as subscribe, eY as fromSubscription, eZ as publish, e_ as defaultSettings, e$ as Settings$2, f0 as flatMapNullishOr$1, f1 as option, f2 as delay, f3 as effectContext, aA as make$1w, f4 as provide$2, f5 as monotonicTimeNanos, f6 as retry$3, f7 as spaced, f8 as die$1, f9 as PRIVATE_NETWORKS, fa as effectDiscard, fb as provideMerge, fc as UpdatableProviderId, fd as decodeUnknownSync, fe as spawnsSubagent, ff as isPublishArtifactTool, fg as outputText, fh as publishedArtifact, fi as toolArgument, fj as isPublishDocumentTool, fk as AgentProfile, fl as Void, fm as AccountProviderId, fn as filter$1, fo as AgentAccount, fp as commonjsGlobal, fq as isRunAgentTool, fr as presetModels, fs as encodeSync, ft as mergeAll, b9 as PushEvent, fu as filter$2, fv as take$1, fw as runDrain, fx as forever, fy as never$1, fz as min, l as logError, fA as ChildProcessSpawner, fB as make$1x, fC as mkString, fD as decodeText$1, fE as ForkPoint, fF as TokenUsage, fG as MessagePart, fH as Message, fI as sliding, fJ as parseGitHubPullRequestUrl, fK as PullRequestReviewer, fL as PullRequestLabel, fM as PullRequestComment, fN as DiffSide, fO as omit$1, fP as subtract, fQ as PULL_REQUEST_REFRESH, ae as catchTags, fR as parseGitHubRepository, I as Int, fS as request$2, fT as Class, fU as ProjectAction, fV as Project, fW as BooleanFromBit, fX as Worktree, fY as timeoutOption, be as isThreadBusy, bb as ThreadStatus, fZ as ScheduledMessage, f_ as QueuedMessage, f$ as UsageLimit, aH as Thread, g0 as getOrThrow$1, g1 as PullRequestWatch, g2 as PullRequestLink, g3 as PullRequestStatus, g4 as allWatchEventKinds, g5 as enabledProviders, g6 as transcriptThreadId, g7 as resumeGraceMs, g8 as fail$3, g9 as WAIT_AGENT_TOOL, bh as tapError, ga as filter$3, gb as isMaxLength, gc as schedule, aR as RpcMethods, gd as BrowserFrame, ge as PagePick, gf as defaultClientSettings, gg as ClientSettings$1, gh as parsePairingUrl, gi as pairingUrl, gj as Environment, ah as getOrUndefined$1, az as result$1, gk as relayWebSocketUrl, gl as remoteWebSocketUrl, aW as WebSocket, aM as ServerFrame, gm as CHALLENGE_WAIT_MS, aU as methodKind, gn as dialPlan, go as REMOTE_PROTOCOL_VERSION, gp as DIRECT_CHECK_INTERVAL_MS, gq as DIRECT_CHECK_TIMEOUT_MS, gr as LinearIssue, gs as externalSpan, af as fromUndefinedOr, gt as zero$1, gu as fromInput$2, gv as badArgument, gw as isSchemaError, gx as isNoSuchElementError, gy as StackTrace, gz as mapEager, gA as updateContext$1, gB as makeUnsafe$9, gC as tag$2, gD as Error$2, gE as fromInputUnsafe$1, gF as Path, gG as run$6, gH as mebibytes, gI as Class$1, gJ as constFalse, gK as withLogSpan, gL as log, gM as Tracer, gN as nativeTracer, gO as hasInterrupts$1, gP as succeed$6, gQ as setStackTraceLimit, gR as fail$4, gS as getStackTraceLimit, gT as fiberEnterUninterruptibleUnsafe, gU as contA, gV as effectIsExit, gW as closeUnsafe, gX as contE, gY as reportCauseUnsafe, gZ as matchCauseEffectEager, g_ as flatMapEager, g$ as fromReadable, h0 as toArrayBuffer, G as cached$1, h1 as layer$W, h2 as pipeThroughDuplex, h3 as toUint8Array, bj as layer$X, b0 as fromResult, h4 as WebSocketServer, h5 as orDie$1, h6 as runForEachArray, h7 as interruptible, h8 as die$2, h9 as merge$5, ha as succeedContext, hb as unwrap$1, hc as withFiberSucceed, hd as reverse, he as getOrUndefinedUnsafe, hf as CurrentMemoMap, a0 as empty$7, hg as fiberEnterInterruptibleUnsafe, hh as compose$1, hi as Timestamp, hj as AutomationTrigger, hk as AutomationRun, hl as isPolledTrigger, hm as launch, hn as Duration, ho as DateTimeUtc, hp as withConstructorDefault, hq as withDecodingDefault, hr as Redacted, hs as Tuple$1, ht as isRedacted, hu as MutableJson, ag as isNotUndefined, hv as Never, ak as empty$8, hw as toJsonSchemaDocument, hx as annotateCurrentSpan, hy as isUndefined, hz as failCause$2, hA as forkChild, hB as catch_$1, hC as isSchemaError$1, hD as failCause$3, hE as mapEffect, hF as onEnd, hG as isSchema, aQ as encodeUnknownEffect, hH as annotate, hI as fail$5, hJ as make$1y, hK as declare, hL as isStream, hM as Class$2, hN as Exit, bi as provide$3, hO as provideContext$1, hP as StructWithRest, hQ as JsonObject$3, hR as Opaque, hS as decodeTo, hT as transformOptional, hU as flatMap$3, hV as toType, hW as Any, hX as UndefinedOr, hY as Finite, hZ as passthrough, h_ as Uint8ArrayFromBase64, h$ as Json, i0 as TemplateLiteral, i1 as decode$3, i2 as withDefault, i3 as isBetween, W as taggedEnum, i4 as take$2, i5 as toCodecJson, i6 as isNullish, i7 as isString, i8 as bounded, i9 as withParentSpan, ia as die$3, ib as offerAll, ic as interrupt$2, id as interruptors, ie as decodeSync, ig as catchCauseIf, ih as NonEmptyArray, ii as decode$4, ij as decodeUnknownResult, ik as fn, il as isTagged, im as isReadonlyObject, io as IllegalArgumentError, ip as encode$1, iq as collect, ir as catchDone, is as takeAll, it as fromArray, iu as whileLoop, iv as isExit, iw as matchEffect, ix as defaultFormatter, iy as logFatal, iz as isDeferred, iA as hasDies, c as constVoid, iB as shutdown, iC as Scheduler, iD as CurrentLogLevel, q as is$2, iE as decodeEffect, iF as UnknownFromJsonString, iG as ignoreCause, iH as Class$3, iI as TaggedStruct, iJ as toEncoded, iK as when$2, iL as threadDeviceId, iM as devicePlatformOf, ap as value$2, iN as runLast, iO as fromOption, iP as RUN_AGENT_TOOL, iQ as ARTIFACT_THEME_GUIDE, iR as DeviceUrl, iS as DeviceApp, iT as DeviceButton, iU as WatchEventKind, iV as isPattern, iW as RelayHostList, iX as RelayMachineList, iY as GuideGroup, iZ as PullRequestGuide, i_ as uninterruptible, i$ as flatten$1, j0 as diskFullness, j1 as pretty, j2 as startingProvider, j3 as min$1, j4 as exponential, j5 as desktopOnlyPushes, j6 as reachesPhone, j7 as mutations, j8 as desktopOnlyMethods, j9 as isAddressNotUpYet, ja as ClientFrame, aY as REMOTE_MAX_FRAME_BYTES, aX as REMOTE_PATH, jb as empty$9, a_ as cliSocketPath, jc as BindHost, jd as take$3, je as getAugmentedNamespace, jf as make$1z, jg as NativeSpan, jh as currentTimeNanos, aC as MinimumLogLevel, ji as isPortInUse } from "./chunks/remote-Cc8fvZ8_.js";
|
|
11
|
+
import Ee__default from "fs";
|
|
12
12
|
import require$$0 from "util";
|
|
13
13
|
import require$$1$1 from "stream";
|
|
14
14
|
import require$$0$1 from "zlib";
|
|
15
15
|
import require$$0$2 from "assert";
|
|
16
16
|
import require$$0$3 from "buffer";
|
|
17
|
-
import fs, { realpath, readlink, stat, mkdir, cp, readdir,
|
|
18
|
-
import
|
|
17
|
+
import fs, { readFile, realpath, readlink, stat, mkdir, cp, readdir, writeFile, rename, rm, access, copyFile, constants as constants$8, open as open$1, lstat, mkdtemp, chmod, statfs } from "node:fs/promises";
|
|
18
|
+
import Pe__default from "path";
|
|
19
19
|
import crypto__default, { randomUUID, createHash, randomBytes, timingSafeEqual, createHmac } from "node:crypto";
|
|
20
20
|
import { createInterface } from "node:readline";
|
|
21
21
|
import require$$0$5 from "node:assert";
|
|
@@ -124,7 +124,7 @@ const empty$4 = () => {
|
|
|
124
124
|
self2.buckets = /* @__PURE__ */ new Map();
|
|
125
125
|
return self2;
|
|
126
126
|
};
|
|
127
|
-
const make$
|
|
127
|
+
const make$1n = (...entries) => fromIterable$1(entries);
|
|
128
128
|
const fromIterable$1 = (entries) => {
|
|
129
129
|
const self2 = empty$4();
|
|
130
130
|
for (const [key2, value2] of entries) {
|
|
@@ -229,7 +229,7 @@ const makeUnsafe$4 = (options) => ({
|
|
|
229
229
|
return pipeArguments(this, arguments);
|
|
230
230
|
}
|
|
231
231
|
});
|
|
232
|
-
const make$
|
|
232
|
+
const make$1m = (options) => withFiber((fiber) => {
|
|
233
233
|
const context2 = fiber.context;
|
|
234
234
|
const scope2 = get$6(context2, Scope);
|
|
235
235
|
const self2 = makeUnsafe$4({
|
|
@@ -543,7 +543,7 @@ const Proto$c = /* @__PURE__ */ Object.defineProperties(/* @__PURE__ */ Object.c
|
|
|
543
543
|
value: BaseProto[NodeInspectSymbol]
|
|
544
544
|
}
|
|
545
545
|
});
|
|
546
|
-
const make$
|
|
546
|
+
const make$1l = (input) => Object.assign(Object.create(Proto$c), input);
|
|
547
547
|
const Equivalence$1 = /* @__PURE__ */ makeEquivalence(/* @__PURE__ */ strictEqual());
|
|
548
548
|
const empty$2 = /* @__PURE__ */ Object.create(Proto$c);
|
|
549
549
|
const fromInput$1 = (input) => {
|
|
@@ -568,21 +568,21 @@ const fromInput$1 = (input) => {
|
|
|
568
568
|
};
|
|
569
569
|
const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$c);
|
|
570
570
|
const set$1 = /* @__PURE__ */ dual(3, (self2, key2, value2) => {
|
|
571
|
-
const out = make$
|
|
571
|
+
const out = make$1l(self2);
|
|
572
572
|
out[key2.toLowerCase()] = value2;
|
|
573
573
|
return out;
|
|
574
574
|
});
|
|
575
|
-
const setAll = /* @__PURE__ */ dual(2, (self2, headers2) => make$
|
|
575
|
+
const setAll = /* @__PURE__ */ dual(2, (self2, headers2) => make$1l({
|
|
576
576
|
...self2,
|
|
577
577
|
...fromInput$1(headers2)
|
|
578
578
|
}));
|
|
579
579
|
const merge$2 = /* @__PURE__ */ dual(2, (self2, headers2) => {
|
|
580
|
-
const out = make$
|
|
580
|
+
const out = make$1l(self2);
|
|
581
581
|
Object.assign(out, headers2);
|
|
582
582
|
return out;
|
|
583
583
|
});
|
|
584
584
|
const remove$2 = /* @__PURE__ */ dual(2, (self2, key2) => {
|
|
585
|
-
const out = make$
|
|
585
|
+
const out = make$1l(self2);
|
|
586
586
|
delete out[key2.toLowerCase()];
|
|
587
587
|
return out;
|
|
588
588
|
});
|
|
@@ -594,12 +594,12 @@ const redact = /* @__PURE__ */ dual(2, (self2, key2) => {
|
|
|
594
594
|
if (typeof key3 === "string") {
|
|
595
595
|
const k = key3.toLowerCase();
|
|
596
596
|
if (k in self2) {
|
|
597
|
-
out[k] = make$
|
|
597
|
+
out[k] = make$1o(self2[k]);
|
|
598
598
|
}
|
|
599
599
|
} else {
|
|
600
600
|
for (const name in self2) {
|
|
601
601
|
if (name.search(key3) !== -1) {
|
|
602
|
-
out[name] = make$
|
|
602
|
+
out[name] = make$1o(self2[name]);
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
}
|
|
@@ -650,7 +650,7 @@ const Proto$b = {
|
|
|
650
650
|
return array$2(this.params.flat());
|
|
651
651
|
}
|
|
652
652
|
};
|
|
653
|
-
const make$
|
|
653
|
+
const make$1k = (params2) => {
|
|
654
654
|
const self2 = Object.create(Proto$b);
|
|
655
655
|
self2.params = params2;
|
|
656
656
|
return self2;
|
|
@@ -669,7 +669,7 @@ const fromInput = (input) => {
|
|
|
669
669
|
out.push(parsed[i]);
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
return make$
|
|
672
|
+
return make$1k(out);
|
|
673
673
|
};
|
|
674
674
|
const fromInputNested = (input) => {
|
|
675
675
|
const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$2(input) : Object.entries(input);
|
|
@@ -692,7 +692,7 @@ const fromInputNested = (input) => {
|
|
|
692
692
|
}
|
|
693
693
|
return out;
|
|
694
694
|
};
|
|
695
|
-
const Equivalence = /* @__PURE__ */ make$
|
|
695
|
+
const Equivalence = /* @__PURE__ */ make$1p((a, b) => arrayEquivalence(a.params, b.params));
|
|
696
696
|
const arrayEquivalence = /* @__PURE__ */ makeEquivalence$2(/* @__PURE__ */ makeEquivalence$1([/* @__PURE__ */ strictEqual(), /* @__PURE__ */ strictEqual()]));
|
|
697
697
|
const TypeId$p = "~effect/net/NetAddress";
|
|
698
698
|
const ipv4Value = (self2) => self2.value;
|
|
@@ -1009,12 +1009,12 @@ const TypeId$o = "~effect/Cache";
|
|
|
1009
1009
|
const makeWith$1 = (lookup2, options) => contextWith((context2) => {
|
|
1010
1010
|
const self2 = Object.create(Proto$a);
|
|
1011
1011
|
self2.lookup = (key2) => updateContext(lookup2(key2), (input) => merge$3(context2, input));
|
|
1012
|
-
self2.map = make$
|
|
1012
|
+
self2.map = make$1n();
|
|
1013
1013
|
self2.capacity = options.capacity;
|
|
1014
1014
|
self2.timeToLive = options.timeToLive ? (exit2, key2) => fromInputUnsafe(options.timeToLive(exit2, key2)) : defaultTimeToLive;
|
|
1015
1015
|
return succeed$2(self2);
|
|
1016
1016
|
});
|
|
1017
|
-
const make$
|
|
1017
|
+
const make$1j = (options) => makeWith$1(options.lookup, {
|
|
1018
1018
|
...options,
|
|
1019
1019
|
timeToLive: options.timeToLive !== void 0 ? () => options.timeToLive : defaultTimeToLive
|
|
1020
1020
|
});
|
|
@@ -1147,7 +1147,7 @@ const makeUnsafe$3 = () => {
|
|
|
1147
1147
|
self2.deferred = makeUnsafe$6();
|
|
1148
1148
|
return self2;
|
|
1149
1149
|
};
|
|
1150
|
-
const make$
|
|
1150
|
+
const make$1i = () => acquireRelease(sync(() => makeUnsafe$3()), (handle) => {
|
|
1151
1151
|
const state = handle.state;
|
|
1152
1152
|
if (state._tag === "Closed") return void_;
|
|
1153
1153
|
handle.state = {
|
|
@@ -1247,7 +1247,7 @@ const makeUnsafe$2 = (backing, deferred) => {
|
|
|
1247
1247
|
self2.deferred = deferred;
|
|
1248
1248
|
return self2;
|
|
1249
1249
|
};
|
|
1250
|
-
const make$
|
|
1250
|
+
const make$1h = () => acquireRelease(sync(() => makeUnsafe$2(empty$4(), makeUnsafe$6())), (map2) => suspend(() => {
|
|
1251
1251
|
const state = map2.state;
|
|
1252
1252
|
if (state._tag === "Closed") return void_;
|
|
1253
1253
|
map2.state = {
|
|
@@ -1364,7 +1364,7 @@ const makeUnsafe$1 = (backing, deferred) => {
|
|
|
1364
1364
|
self2.deferred = deferred;
|
|
1365
1365
|
return self2;
|
|
1366
1366
|
};
|
|
1367
|
-
const make$
|
|
1367
|
+
const make$1g = () => acquireRelease(sync(() => makeUnsafe$1(/* @__PURE__ */ new Set(), makeUnsafe$6())), (set2) => suspend(() => {
|
|
1368
1368
|
const state = set2.state;
|
|
1369
1369
|
if (state._tag === "Closed") return void_;
|
|
1370
1370
|
set2.state = {
|
|
@@ -1420,7 +1420,7 @@ const runImpl = (self2, effect2, options) => withFiber((parent) => {
|
|
|
1420
1420
|
});
|
|
1421
1421
|
const symbol$1 = "~effect/PrimaryKey";
|
|
1422
1422
|
const TypeId$k = "~effect/ManagedRuntime";
|
|
1423
|
-
const make$
|
|
1423
|
+
const make$1f = (layer2, options) => {
|
|
1424
1424
|
const memoMap = makeMemoMapUnsafe();
|
|
1425
1425
|
const scope2 = makeUnsafe$5("sequential");
|
|
1426
1426
|
const layerScope = forkUnsafe$1(scope2, "sequential");
|
|
@@ -1645,7 +1645,7 @@ const is = is$1;
|
|
|
1645
1645
|
const exhaustive = exhaustive$1;
|
|
1646
1646
|
const TypeId$i = "~effect/reactivity/Reactivity";
|
|
1647
1647
|
const Reactivity = /* @__PURE__ */ Service$1("effect/reactivity/Reactivity");
|
|
1648
|
-
const make$
|
|
1648
|
+
const make$1e = /* @__PURE__ */ sync(() => {
|
|
1649
1649
|
const handlers2 = /* @__PURE__ */ new Map();
|
|
1650
1650
|
const invalidateUnsafe = (keys2) => {
|
|
1651
1651
|
keysToHashes(keys2, (hash2) => {
|
|
@@ -1691,7 +1691,7 @@ const make$1c = /* @__PURE__ */ sync(() => {
|
|
|
1691
1691
|
const query = (keys2, effect2) => gen(function* () {
|
|
1692
1692
|
const services = yield* context();
|
|
1693
1693
|
const scope2 = get$6(services, Scope);
|
|
1694
|
-
const results = yield* make$
|
|
1694
|
+
const results = yield* make$1q();
|
|
1695
1695
|
const runFork2 = flow$1(runForkWith(services), runIn(scope2));
|
|
1696
1696
|
let running2 = false;
|
|
1697
1697
|
let pending = false;
|
|
@@ -1745,7 +1745,7 @@ const make$1c = /* @__PURE__ */ sync(() => {
|
|
|
1745
1745
|
});
|
|
1746
1746
|
class PendingInvalidation extends (/* @__PURE__ */ Service$1()("effect/reactivity/Reactivity/PendingInvalidation")) {
|
|
1747
1747
|
}
|
|
1748
|
-
const layer$
|
|
1748
|
+
const layer$V = /* @__PURE__ */ effect(Reactivity)(make$1e);
|
|
1749
1749
|
function stringOrHash(u) {
|
|
1750
1750
|
switch (typeof u) {
|
|
1751
1751
|
case "string":
|
|
@@ -2188,7 +2188,7 @@ const recordUpdateHelperSingle = (value2, omit2) => Object.assign(Object.create(
|
|
|
2188
2188
|
omit: omit2,
|
|
2189
2189
|
returningIdentifier: void 0
|
|
2190
2190
|
});
|
|
2191
|
-
const make$
|
|
2191
|
+
const make$1d = (acquirer, compiler, spanAttributes2, transformRows, borrower) => {
|
|
2192
2192
|
const cache2 = transformRows === void 0 ? constructorCache.noTransforms : constructorCache.transforms;
|
|
2193
2193
|
if (cache2.has(acquirer)) {
|
|
2194
2194
|
return cache2.get(acquirer);
|
|
@@ -2663,7 +2663,7 @@ const withStatement = (self2, span, f) => withFiber((fiber) => {
|
|
|
2663
2663
|
if (transform2 === void 0) {
|
|
2664
2664
|
return f(self2, fiber);
|
|
2665
2665
|
}
|
|
2666
|
-
return flatMap(transform2(self2, make$
|
|
2666
|
+
return flatMap(transform2(self2, make$1d(self2.acquirer, self2.compiler, self2.spanAttributes, self2.transformRows, self2.borrower), fiber, span), (statement2) => f(statement2, fiber));
|
|
2667
2667
|
});
|
|
2668
2668
|
const isSegment = (u) => {
|
|
2669
2669
|
if (!hasProperty(u, "_tag")) {
|
|
@@ -2738,7 +2738,7 @@ const TypeId$g = "~effect/sql/SqlClient";
|
|
|
2738
2738
|
const SqlClient = /* @__PURE__ */ Service$1("effect/sql/SqlClient");
|
|
2739
2739
|
let clientIdCounter$1 = 0;
|
|
2740
2740
|
let transactionSemaphoreIdCounter = 0;
|
|
2741
|
-
const make$
|
|
2741
|
+
const make$1c = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
2742
2742
|
const transactionService = options.transactionService ?? TransactionConnection(clientIdCounter$1++);
|
|
2743
2743
|
const getConnection = flatMap(serviceOption(transactionService), match({
|
|
2744
2744
|
onNone: () => options.acquirer,
|
|
@@ -2755,7 +2755,7 @@ const make$1a = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
2755
2755
|
const withTransaction = makeWithTransaction({
|
|
2756
2756
|
transactionService,
|
|
2757
2757
|
spanAttributes: options.spanAttributes,
|
|
2758
|
-
acquireConnection: flatMap(make$
|
|
2758
|
+
acquireConnection: flatMap(make$1r(), (scope2) => provide$1(transactionAcquirer, scope2).pipe(onError((cause) => close(scope2, failCause$1(cause))), map$2((conn) => [scope2, conn]))),
|
|
2759
2759
|
begin: (conn) => control(conn, beginTransaction),
|
|
2760
2760
|
savepoint: (conn, id2) => control(conn, savepoint(`effect_sql_${id2}`)),
|
|
2761
2761
|
releaseSavepoint: releaseSavepoint ? (conn, id2) => control(conn, releaseSavepoint(`effect_sql_${id2}`)) : void 0,
|
|
@@ -2769,7 +2769,7 @@ const make$1a = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
2769
2769
|
onNone: () => options.borrower(f),
|
|
2770
2770
|
onSome: ([conn]) => f(conn)
|
|
2771
2771
|
}));
|
|
2772
|
-
const client2 = Object.assign(make$
|
|
2772
|
+
const client2 = Object.assign(make$1d(getConnection, options.compiler, options.spanAttributes, options.transformRows, borrower), {
|
|
2773
2773
|
[TypeId$g]: TypeId$g,
|
|
2774
2774
|
safe: void 0,
|
|
2775
2775
|
withTransaction,
|
|
@@ -2779,7 +2779,7 @@ const make$1a = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
2779
2779
|
if (options.transformRows === void 0) {
|
|
2780
2780
|
return this;
|
|
2781
2781
|
}
|
|
2782
|
-
const statement2 = make$
|
|
2782
|
+
const statement2 = make$1d(getConnection, options.compiler.withoutTransform, options.spanAttributes, void 0, borrower);
|
|
2783
2783
|
const client3 = Object.assign(statement2, {
|
|
2784
2784
|
...this,
|
|
2785
2785
|
...statement2
|
|
@@ -2900,7 +2900,7 @@ const makeWith = (options) => {
|
|
|
2900
2900
|
};
|
|
2901
2901
|
const defaultKeyObject = {};
|
|
2902
2902
|
const defaultKey = (_request) => defaultKeyObject;
|
|
2903
|
-
const make$
|
|
2903
|
+
const make$1b = (runAll) => makeWith({
|
|
2904
2904
|
batchKey: defaultKey,
|
|
2905
2905
|
delay: yieldNow,
|
|
2906
2906
|
collectWhile: constTrue,
|
|
@@ -2930,7 +2930,7 @@ const Proto$6 = {
|
|
|
2930
2930
|
};
|
|
2931
2931
|
}
|
|
2932
2932
|
};
|
|
2933
|
-
const make$
|
|
2933
|
+
const make$1a = (value2) => map$2(unbounded({
|
|
2934
2934
|
replay: 1
|
|
2935
2935
|
}), (pubsub) => {
|
|
2936
2936
|
const self2 = Object.create(Proto$6);
|
|
@@ -6971,7 +6971,7 @@ function requirePng() {
|
|
|
6971
6971
|
if (hasRequiredPng) return png$1;
|
|
6972
6972
|
hasRequiredPng = 1;
|
|
6973
6973
|
(function(exports) {
|
|
6974
|
-
const fs2 =
|
|
6974
|
+
const fs2 = Ee__default;
|
|
6975
6975
|
const PNG = requirePng$1().PNG;
|
|
6976
6976
|
const Utils = requireUtils$3();
|
|
6977
6977
|
exports.render = function render(qrData, options) {
|
|
@@ -7093,7 +7093,7 @@ function requireUtf8$1() {
|
|
|
7093
7093
|
cb = options;
|
|
7094
7094
|
options = void 0;
|
|
7095
7095
|
}
|
|
7096
|
-
const fs2 =
|
|
7096
|
+
const fs2 = Ee__default;
|
|
7097
7097
|
const utf82 = exports.render(qrData, options);
|
|
7098
7098
|
fs2.writeFile(path2, utf82, cb);
|
|
7099
7099
|
};
|
|
@@ -7276,7 +7276,7 @@ function requireSvg() {
|
|
|
7276
7276
|
cb = options;
|
|
7277
7277
|
options = void 0;
|
|
7278
7278
|
}
|
|
7279
|
-
const fs2 =
|
|
7279
|
+
const fs2 = Ee__default;
|
|
7280
7280
|
const svgTag2 = exports.render(qrData, options);
|
|
7281
7281
|
const xmlStr = '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag2;
|
|
7282
7282
|
fs2.writeFile(path2, xmlStr, cb);
|
|
@@ -7666,7 +7666,7 @@ function requireLib() {
|
|
|
7666
7666
|
if (hasRequiredLib) return lib;
|
|
7667
7667
|
hasRequiredLib = 1;
|
|
7668
7668
|
const { isexe, sync: isexeSync } = requireIndex_min();
|
|
7669
|
-
const { join: join2, delimiter: delimiter2, sep: sep2, posix } =
|
|
7669
|
+
const { join: join2, delimiter: delimiter2, sep: sep2, posix } = Pe__default;
|
|
7670
7670
|
const isWindows = process.platform === "win32";
|
|
7671
7671
|
const rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
|
|
7672
7672
|
const rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -7815,7 +7815,7 @@ const AgentBinaries = Reference("hinacode/AgentBinaries", {
|
|
|
7815
7815
|
const binaryOwner = (provider) => ProviderId.literals.find((candidate) => providerInfo[candidate].binary === providerInfo[provider].binary) ?? provider;
|
|
7816
7816
|
const expandHome$1 = (path2) => path2 === "~" || path2.startsWith("~/") ? join$1(homedir(), path2.slice(1)) : path2;
|
|
7817
7817
|
const commandFor = (provider, name) => gen(function* () {
|
|
7818
|
-
if (name !== providerInfo[provider].binary) return name;
|
|
7818
|
+
if (name !== providerInfo[provider].binary) return expandHome$1(name);
|
|
7819
7819
|
const configured = yield* (yield* AgentBinaries).configured;
|
|
7820
7820
|
return expandHome$1(configured[binaryOwner(provider)] ?? name);
|
|
7821
7821
|
});
|
|
@@ -7825,10 +7825,10 @@ const installedBinary = (provider, name) => gen(function* () {
|
|
|
7825
7825
|
const key2 = `${command}\0${process.env["PATH"] ?? ""}`;
|
|
7826
7826
|
const path2 = found.get(key2) ?? (yield* promise$1(() => findBinary(command)));
|
|
7827
7827
|
if (path2 === void 0) {
|
|
7828
|
-
const { name: label, installUrl } = providerInfo[provider];
|
|
7828
|
+
const { name: label, installUrl, binary } = providerInfo[provider];
|
|
7829
7829
|
return yield* new AgentError({
|
|
7830
7830
|
provider,
|
|
7831
|
-
message: command ===
|
|
7831
|
+
message: command === binary ? `${label} is not installed. Install it from ${installUrl}, then try again` : name === binary ? `${label} was not found at ${command}. Fix its CLI path in Settings > Providers` : `${label} was not found at ${command}, the account's binary path`
|
|
7832
7832
|
});
|
|
7833
7833
|
}
|
|
7834
7834
|
found.set(key2, path2);
|
|
@@ -7870,7 +7870,7 @@ const nowIso = map$2(now, formatIso);
|
|
|
7870
7870
|
});
|
|
7871
7871
|
class MigrationError extends (/* @__PURE__ */ TaggedError("MigrationError")) {
|
|
7872
7872
|
}
|
|
7873
|
-
const make$
|
|
7873
|
+
const make$19 = ({
|
|
7874
7874
|
dumpSchema = () => void_
|
|
7875
7875
|
}) => ({
|
|
7876
7876
|
loader,
|
|
@@ -7981,7 +7981,7 @@ const migrationsTableExists = (sql, table) => {
|
|
|
7981
7981
|
const quotedTable = sql`${sql(table)}`.compile(true)[0];
|
|
7982
7982
|
return map$2(sql`SELECT 1 AS found WHERE to_regclass(${quotedTable}) IS NOT NULL`.withoutTransform, (rows) => rows.length > 0);
|
|
7983
7983
|
};
|
|
7984
|
-
const migrationOrder = /* @__PURE__ */ make$
|
|
7984
|
+
const migrationOrder = /* @__PURE__ */ make$1s(([a], [b]) => Number$1(a, b));
|
|
7985
7985
|
const isConstraintConflict = (error2) => error2.reason._tag === "ConstraintError" || error2.reason._tag === "UniqueViolation";
|
|
7986
7986
|
const fromRecord = (migrations) => pipe$2(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$3(([key2, id2, name]) => [Number(id2), name, succeed$1(migrations[key2])]), sort(migrationOrder), succeed$1);
|
|
7987
7987
|
const findAll = (options) => {
|
|
@@ -8242,18 +8242,35 @@ const parseLsofFields = (text2) => {
|
|
|
8242
8242
|
}
|
|
8243
8243
|
return processes;
|
|
8244
8244
|
};
|
|
8245
|
-
const
|
|
8245
|
+
const psParentPids = exec("ps", ["-axo", "pid=,ppid="]).pipe(
|
|
8246
8246
|
map$2(
|
|
8247
8247
|
(text2) => new Map(
|
|
8248
8248
|
text2.split("\n").map((line) => line.trim().split(/\s+/).map(Number)).filter((fields) => fields.length === 2 && fields.every(Number.isInteger))
|
|
8249
8249
|
)
|
|
8250
8250
|
)
|
|
8251
8251
|
);
|
|
8252
|
+
const procParentOf = (pid) => readFile(`/proc/${pid}/stat`, "utf8").then(
|
|
8253
|
+
(stat2) => Number(stat2.slice(stat2.lastIndexOf(")") + 2).split(" ")[1]),
|
|
8254
|
+
() => void 0
|
|
8255
|
+
);
|
|
8256
|
+
const procParentPids = (pids) => promise$1(async () => {
|
|
8257
|
+
const parents = /* @__PURE__ */ new Map();
|
|
8258
|
+
await Promise.all(
|
|
8259
|
+
pids.map(async (pid) => {
|
|
8260
|
+
for (let child = pid; child > 1 && !parents.has(child); ) {
|
|
8261
|
+
const parent = await procParentOf(child);
|
|
8262
|
+
if (parent === void 0 || !Number.isInteger(parent)) return;
|
|
8263
|
+
parents.set(child, parent);
|
|
8264
|
+
child = parent;
|
|
8265
|
+
}
|
|
8266
|
+
})
|
|
8267
|
+
);
|
|
8268
|
+
return parents;
|
|
8269
|
+
});
|
|
8252
8270
|
const attribute$1 = (listeners, parentsOf, cwds, include) => gen(function* () {
|
|
8253
8271
|
if (listeners.length === 0) return [];
|
|
8254
|
-
const
|
|
8255
|
-
|
|
8256
|
-
});
|
|
8272
|
+
const pids = [...new Set(listeners.map(({ pid }) => pid))];
|
|
8273
|
+
const [parents, cwdOf] = yield* all$1([parentsOf(pids), cwds(pids)], { concurrency: 2 });
|
|
8257
8274
|
const ancestorsOf = ancestorsIn(parents);
|
|
8258
8275
|
return uniqueByPortAndPid(
|
|
8259
8276
|
listeners.flatMap(({ pid, command, port }) => {
|
|
@@ -8275,7 +8292,32 @@ const procCwds = (pids) => promise$1(
|
|
|
8275
8292
|
const lsofCwds = (pids) => exec("lsof", ["-a", "-p", pids.join(","), "-d", "cwd", "-Fn"]).pipe(
|
|
8276
8293
|
map$2((text2) => new Map(parseLsofFields(text2).map(({ pid, names: names2 }) => [pid, names2[0] ?? null])))
|
|
8277
8294
|
);
|
|
8278
|
-
const
|
|
8295
|
+
const TCP_LISTEN = "0A";
|
|
8296
|
+
const listeningSockets = (procNetTcp) => procNetTcp.split("\n").slice(1).flatMap((line) => {
|
|
8297
|
+
const [, local, , state, , , , , , inode] = line.trim().split(/\s+/);
|
|
8298
|
+
return state === TCP_LISTEN ? [`${local}/${inode}`] : [];
|
|
8299
|
+
});
|
|
8300
|
+
const socketsFingerprint = (tables2) => tables2.some((table) => "error" in table && table.error.code !== "ENOENT") ? null : tables2.flatMap((table) => "text" in table ? listeningSockets(table.text) : []).toSorted().join(" ");
|
|
8301
|
+
const procListeningSockets = promise$1(
|
|
8302
|
+
() => Promise.all(
|
|
8303
|
+
["/proc/net/tcp", "/proc/net/tcp6"].map(
|
|
8304
|
+
(table) => readFile(table, "utf8").then(
|
|
8305
|
+
(text2) => ({ text: text2 }),
|
|
8306
|
+
(error2) => ({ error: error2 })
|
|
8307
|
+
)
|
|
8308
|
+
)
|
|
8309
|
+
)
|
|
8310
|
+
).pipe(map$2(socketsFingerprint));
|
|
8311
|
+
let ssForSockets;
|
|
8312
|
+
const scanSs = exec("ss", ["-Hltnp"]).pipe(map$2(parseSs));
|
|
8313
|
+
const ssListeners = (fresh) => gen(function* () {
|
|
8314
|
+
const key2 = yield* procListeningSockets;
|
|
8315
|
+
if (!fresh && key2 !== null && ssForSockets?.key === key2) return ssForSockets.listeners;
|
|
8316
|
+
const listeners = yield* scanSs;
|
|
8317
|
+
if (key2 !== null) ssForSockets = { key: key2, listeners };
|
|
8318
|
+
return listeners;
|
|
8319
|
+
});
|
|
8320
|
+
const findListeningPortsWithSs = (include, fresh) => ssListeners(fresh).pipe(flatMap((listeners) => attribute$1(listeners, procParentPids, procCwds, include)));
|
|
8279
8321
|
const findListeningPortsWithLsof = (include) => (
|
|
8280
8322
|
// FIXME: lsof cuts the command name to nine characters unless given +c 0
|
|
8281
8323
|
exec("lsof", ["-nP", "+c", "0", "-iTCP", "-sTCP:LISTEN", "-Fpcn"]).pipe(
|
|
@@ -8284,7 +8326,7 @@ const findListeningPortsWithLsof = (include) => (
|
|
|
8284
8326
|
({ pid, command, names: names2 }) => names2.map(portOf$1).filter(Number.isInteger).map((port) => ({ pid, command, port }))
|
|
8285
8327
|
)
|
|
8286
8328
|
),
|
|
8287
|
-
flatMap((listeners) => attribute$1(listeners,
|
|
8329
|
+
flatMap((listeners) => attribute$1(listeners, () => psParentPids, lsofCwds, include))
|
|
8288
8330
|
)
|
|
8289
8331
|
);
|
|
8290
8332
|
const LISTENING_REMOTE = /^(0\.0\.0\.0|\[::\]):0$/;
|
|
@@ -8321,7 +8363,7 @@ const findListeningPortsWithNetstat = (include) => gen(function* () {
|
|
|
8321
8363
|
const table = yield* windowsProcessesFor(sockets.map(({ pid }) => pid));
|
|
8322
8364
|
const listeners = sockets.map(({ pid, port }) => ({ pid, port, command: table.get(pid)?.command ?? "" }));
|
|
8323
8365
|
const parents = new Map([...table].map(([pid, { parent }]) => [pid, parent]));
|
|
8324
|
-
return yield* attribute$1(listeners, succeed$1(parents), noCwds, include);
|
|
8366
|
+
return yield* attribute$1(listeners, () => succeed$1(parents), noCwds, include);
|
|
8325
8367
|
});
|
|
8326
8368
|
const isInside$1 = (path2, root2) => path2 === root2 || path2.startsWith(root2.endsWith(sep) ? root2 : root2 + sep);
|
|
8327
8369
|
const belongsToWorkspace = ({
|
|
@@ -8370,28 +8412,31 @@ const terminate = (pid) => gen(function* () {
|
|
|
8370
8412
|
);
|
|
8371
8413
|
});
|
|
8372
8414
|
const kill = (pid) => gen(function* () {
|
|
8373
|
-
const listening2 = yield* scanListening((proc) => proc.pid === pid);
|
|
8415
|
+
const listening2 = yield* scanListening((proc) => proc.pid === pid, true);
|
|
8374
8416
|
if (listening2.length === 0) {
|
|
8375
8417
|
return yield* new PortsError({ message: `Process ${pid} is not listening on a port` });
|
|
8376
8418
|
}
|
|
8377
8419
|
yield* terminate(pid);
|
|
8378
8420
|
});
|
|
8379
|
-
const make$
|
|
8421
|
+
const make$18 = gen(function* () {
|
|
8380
8422
|
const activeWorkspace = yield* makeActiveWorkspace;
|
|
8381
|
-
const listListening = (threadId, workspaceCwd) => gen(function* () {
|
|
8423
|
+
const listListening = (threadId, workspaceCwd, fresh) => gen(function* () {
|
|
8382
8424
|
const workspacePath = workspaceCwd === null ? null : yield* promise$1(() => realpath(workspaceCwd).catch(() => workspaceCwd));
|
|
8383
8425
|
const listening2 = yield* scanListening(
|
|
8384
8426
|
belongsToWorkspace({
|
|
8385
8427
|
workspacePath,
|
|
8386
8428
|
agentPids: agentPidsOf(threadId),
|
|
8387
8429
|
selfPid: process.pid
|
|
8388
|
-
})
|
|
8430
|
+
}),
|
|
8431
|
+
fresh
|
|
8389
8432
|
);
|
|
8390
8433
|
return listening2.map(({ port, pid, command, cwd }) => ({ port, pid, command, cwd }));
|
|
8391
8434
|
});
|
|
8392
|
-
const listForThread = (threadId) => activeWorkspace(threadId).pipe(
|
|
8435
|
+
const listForThread = (threadId, options) => activeWorkspace(threadId).pipe(
|
|
8436
|
+
flatMap((workspace) => listListening(threadId, workspace.cwd, options?.fresh === true))
|
|
8437
|
+
);
|
|
8393
8438
|
const listOwnedByThread = (threadId) => activeWorkspace(threadId).pipe(
|
|
8394
|
-
flatMap((workspace) => listListening(threadId, workspace.worktreeRemoved ? null : workspace.cwd))
|
|
8439
|
+
flatMap((workspace) => listListening(threadId, workspace.worktreeRemoved ? null : workspace.cwd, true))
|
|
8395
8440
|
);
|
|
8396
8441
|
const closeThread = (threadId) => listOwnedByThread(threadId).pipe(
|
|
8397
8442
|
flatMap(
|
|
@@ -8403,7 +8448,7 @@ const make$16 = gen(function* () {
|
|
|
8403
8448
|
);
|
|
8404
8449
|
return Ports.of({ listForThread, kill, closeThread });
|
|
8405
8450
|
});
|
|
8406
|
-
const layer$
|
|
8451
|
+
const layer$U = effect(Ports, make$18);
|
|
8407
8452
|
const noTokens = { inputTokens: 0, cacheWriteTokens: 0, cacheReadTokens: 0, outputTokens: 0 };
|
|
8408
8453
|
const addTokens = (a, b) => ({
|
|
8409
8454
|
inputTokens: a.inputTokens + b.inputTokens,
|
|
@@ -8469,7 +8514,7 @@ function sessionScope$1(tool2, input) {
|
|
|
8469
8514
|
return { tool: tool2, kind: "tool", value: tool2 };
|
|
8470
8515
|
}
|
|
8471
8516
|
const grantKey$1 = (scope2) => JSON.stringify([scope2.tool, scope2.kind, scope2.value]);
|
|
8472
|
-
function makeApprovals(emit) {
|
|
8517
|
+
function makeApprovals(provider, emit) {
|
|
8473
8518
|
const pending = /* @__PURE__ */ new Map();
|
|
8474
8519
|
const ask = async (session, toolName2, input, options) => {
|
|
8475
8520
|
const scope2 = sessionScope$1(toolName2, input);
|
|
@@ -8488,7 +8533,7 @@ function makeApprovals(emit) {
|
|
|
8488
8533
|
request: {
|
|
8489
8534
|
id: requestId,
|
|
8490
8535
|
threadId: session.threadId,
|
|
8491
|
-
provider
|
|
8536
|
+
provider,
|
|
8492
8537
|
kind: approvalKind(toolName2),
|
|
8493
8538
|
title: options.title ?? options.displayName ?? toolName2,
|
|
8494
8539
|
detail: options.description ?? approvalDetail(input),
|
|
@@ -8621,6 +8666,12 @@ function mapMessage(message2, state, now2) {
|
|
|
8621
8666
|
if (FILE_EDIT_TOOLS$1.has(block.name) && typeof path2 === "string") {
|
|
8622
8667
|
state.pendingEdits.set(block.id, path2);
|
|
8623
8668
|
}
|
|
8669
|
+
if (block.name === "Agent" || block.name === "Task") {
|
|
8670
|
+
state.subagentRequests.set(block.id, {
|
|
8671
|
+
...typeof input?.model === "string" && { model: input.model },
|
|
8672
|
+
...typeof input?.effort === "string" && { effort: input.effort }
|
|
8673
|
+
});
|
|
8674
|
+
}
|
|
8624
8675
|
return [
|
|
8625
8676
|
{
|
|
8626
8677
|
type: "tool_call_started",
|
|
@@ -8659,8 +8710,11 @@ function mapMessage(message2, state, now2) {
|
|
|
8659
8710
|
const isSubagent = (message2) => message2.task_type === "local_agent" && message2.ambient !== true && message2.skip_transcript !== true;
|
|
8660
8711
|
function subagentStarted(message2, state, now2) {
|
|
8661
8712
|
if (!isSubagent(message2)) return [];
|
|
8713
|
+
const requested = message2.tool_use_id === void 0 ? void 0 : state.subagentRequests.get(message2.tool_use_id);
|
|
8662
8714
|
return updateSubagent(state, {
|
|
8663
8715
|
id: message2.task_id,
|
|
8716
|
+
model: requested?.model ?? state.model,
|
|
8717
|
+
...requested?.effort && { effort: requested.effort },
|
|
8664
8718
|
label: message2.description,
|
|
8665
8719
|
callId: message2.tool_use_id ?? null,
|
|
8666
8720
|
status: "running",
|
|
@@ -8736,6 +8790,7 @@ function wakeupOf(message2, call2, now2) {
|
|
|
8736
8790
|
}
|
|
8737
8791
|
const limitErrorText = /^(?:error:\s*)?(?:you['’]ve hit your (?:(?:usage )?limit|org['’]s monthly spend limit)|usage limit reached|(?:claude(?: api)? )?rate limit reached|api error:\s*429\b)/i;
|
|
8738
8792
|
const orgSpendLimitText = /^(?:error:\s*)?you['’]ve hit your org['’]s monthly spend limit/i;
|
|
8793
|
+
const lostSessionText = /^No conversation found with session ID: /m;
|
|
8739
8794
|
function mapResult(result2, state) {
|
|
8740
8795
|
const { limitMessage, limitResetAt: resetAt } = state;
|
|
8741
8796
|
if (result2.subtype !== "success" || result2.is_error) {
|
|
@@ -8749,6 +8804,15 @@ function mapResult(result2, state) {
|
|
|
8749
8804
|
limit: { kind, message: message2, reset: resetAt === null ? null : { at: resetAt, autoResume: false } }
|
|
8750
8805
|
};
|
|
8751
8806
|
}
|
|
8807
|
+
if (lostSessionText.test(reason)) {
|
|
8808
|
+
return {
|
|
8809
|
+
type: "turn_failed",
|
|
8810
|
+
message: `${reason}
|
|
8811
|
+
|
|
8812
|
+
Your next message starts a new Claude session that gets this thread's transcript, without tool output.`,
|
|
8813
|
+
sessionLost: true
|
|
8814
|
+
};
|
|
8815
|
+
}
|
|
8752
8816
|
return {
|
|
8753
8817
|
type: "turn_failed",
|
|
8754
8818
|
message: message2,
|
|
@@ -44457,7 +44521,7 @@ const toQuestion$2 = (question) => ({
|
|
|
44457
44521
|
allowsText: true,
|
|
44458
44522
|
secret: false
|
|
44459
44523
|
});
|
|
44460
|
-
function makeQuestions(emit) {
|
|
44524
|
+
function makeQuestions(provider, emit) {
|
|
44461
44525
|
const pending = /* @__PURE__ */ new Map();
|
|
44462
44526
|
const ask = async (session, input, options) => {
|
|
44463
44527
|
if (options.signal.aborted) return { behavior: "deny", message: "The question request was cancelled" };
|
|
@@ -44474,7 +44538,7 @@ function makeQuestions(emit) {
|
|
|
44474
44538
|
request: {
|
|
44475
44539
|
id: requestId,
|
|
44476
44540
|
threadId: session.threadId,
|
|
44477
|
-
provider
|
|
44541
|
+
provider,
|
|
44478
44542
|
questions: decoded.value.questions.map(toQuestion$2)
|
|
44479
44543
|
}
|
|
44480
44544
|
});
|
|
@@ -44798,7 +44862,7 @@ const shorten$1 = (text2, length) => {
|
|
|
44798
44862
|
};
|
|
44799
44863
|
const recordedCwd = (cwd) => realpath(cwd).catch(() => cwd);
|
|
44800
44864
|
const listClaudeSessions = async (home, cwd) => {
|
|
44801
|
-
const { listSessions: listSessions2 } = await import("./chunks/sdk-
|
|
44865
|
+
const { listSessions: listSessions2 } = await import("./chunks/sdk-DZclv7I1.js");
|
|
44802
44866
|
const folder = await recordedCwd(cwd);
|
|
44803
44867
|
const sessions = await listSessions2({ dir: folder, sessionStore: homeStore(home), limit: LISTED_SESSIONS });
|
|
44804
44868
|
return sessions.filter((session) => session.cwd === void 0 || session.cwd === folder).map((session) => ({
|
|
@@ -44997,7 +45061,7 @@ const fallbackModel = (id2, label) => ({
|
|
|
44997
45061
|
});
|
|
44998
45062
|
const FALLBACK_MODELS = [
|
|
44999
45063
|
fallbackModel("claude-opus-5-5", "Opus 5.5"),
|
|
45000
|
-
fallbackModel("claude-fable-5-
|
|
45064
|
+
fallbackModel("claude-fable-5-2", "Fable 5.2"),
|
|
45001
45065
|
fallbackModel("claude-sonnet-5-5", "Sonnet 5.5"),
|
|
45002
45066
|
fallbackModel("claude-haiku-5-5", "Haiku 5.5")
|
|
45003
45067
|
];
|
|
@@ -45010,6 +45074,14 @@ const withUltrathink = (prompt, effort) => effort === ULTRATHINK ? `${prompt}
|
|
|
45010
45074
|
${ULTRATHINK}`.trimStart() : prompt;
|
|
45011
45075
|
const effortsOf = (levels) => levels.length === 0 ? [] : [...levels, ULTRATHINK, ...levels.includes("xhigh") ? [ULTRACODE] : []];
|
|
45012
45076
|
const IDLE_SESSION_TTL = seconds(60);
|
|
45077
|
+
const STDERR_DRAIN_GRACE = millis(200);
|
|
45078
|
+
const stderrGrace = promise$1(
|
|
45079
|
+
() => new Promise((resolve2) => setTimeout(resolve2, toMillis(STDERR_DRAIN_GRACE)).unref())
|
|
45080
|
+
);
|
|
45081
|
+
const withStderr = (message2, stderr) => {
|
|
45082
|
+
const tail2 = stderr.text.trim();
|
|
45083
|
+
return tail2 === "" ? message2 : `${message2}. stderr: ${tail2}`;
|
|
45084
|
+
};
|
|
45013
45085
|
const toContextBreakdown = (usage2) => ({
|
|
45014
45086
|
usedTokens: usage2.totalTokens,
|
|
45015
45087
|
maxTokens: usage2.rawMaxTokens,
|
|
@@ -45065,10 +45137,8 @@ const commandsKey = (cwd, home) => JSON.stringify({ cwd, home });
|
|
|
45065
45137
|
const sameHome = (a, b) => a?.dir === b?.dir && a?.binary === b?.binary;
|
|
45066
45138
|
const sameContext = (a, b) => a.cwd === b.cwd && sameHome(a.home, b.home) && a.instructions === b.instructions;
|
|
45067
45139
|
const homeEnv = (home) => home === null ? { ...process.env } : { ...process.env, CLAUDE_CONFIG_DIR: home.dir };
|
|
45068
|
-
const
|
|
45069
|
-
|
|
45070
|
-
message: `${message2}: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
45071
|
-
});
|
|
45140
|
+
const errorMessage$1 = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
45141
|
+
const agentError = (message2) => (cause) => new AgentError({ provider: "claude", message: `${message2}: ${errorMessage$1(cause)}` });
|
|
45072
45142
|
const copySession$1 = (sessionId, from, to) => tryPromise({
|
|
45073
45143
|
try: () => copyTranscripts(sessionId, from?.dir ?? claudeHome(), to?.dir ?? claudeHome()),
|
|
45074
45144
|
catch: agentError("Failed to copy Claude transcripts")
|
|
@@ -45126,7 +45196,7 @@ const baseOptions = (home) => map$2(installedBinary("claude", home?.binary ?? "c
|
|
|
45126
45196
|
const probe$2 = (read2, failure2, home, options = {}) => gen(function* () {
|
|
45127
45197
|
const prompts = yield* unbounded$1();
|
|
45128
45198
|
const base = yield* baseOptions(home);
|
|
45129
|
-
const { query } = yield* promise$1(() => import("./chunks/sdk-
|
|
45199
|
+
const { query } = yield* promise$1(() => import("./chunks/sdk-DZclv7I1.js"));
|
|
45130
45200
|
const cli = query({
|
|
45131
45201
|
prompt: toAsyncIterable(fromQueue(prompts)),
|
|
45132
45202
|
options: { ...base, settingSources: [], persistSession: false, ...options }
|
|
@@ -45200,7 +45270,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45200
45270
|
const sessionLocks = /* @__PURE__ */ new Map();
|
|
45201
45271
|
const wakes = yield* unbounded$1();
|
|
45202
45272
|
const backgroundTaskChanges = yield* unbounded$1();
|
|
45203
|
-
const probedCommands = yield* make$
|
|
45273
|
+
const probedCommands = yield* make$1j({
|
|
45204
45274
|
lookup: probeCommands,
|
|
45205
45275
|
capacity: 32,
|
|
45206
45276
|
timeToLive: minutes(1)
|
|
@@ -45208,7 +45278,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45208
45278
|
const emit = (session, event) => {
|
|
45209
45279
|
if (session.turn === null) return;
|
|
45210
45280
|
if ((event.type === "turn_failed" || event.type === "turn_limited") && session.interrupted)
|
|
45211
|
-
event = { type: "turn_failed", message: "Interrupted" };
|
|
45281
|
+
event = event.type === "turn_failed" && event.sessionLost ? { type: "turn_failed", message: "Interrupted", sessionLost: true } : { type: "turn_failed", message: "Interrupted" };
|
|
45212
45282
|
if (event.type === "turn_completed" && session.sessionId !== null && session.lastAssistantUuid !== null)
|
|
45213
45283
|
event = { ...event, forkPoint: { sessionId: session.sessionId, checkpoint: session.lastAssistantUuid } };
|
|
45214
45284
|
offerUnsafe(session.turn, event);
|
|
@@ -45219,8 +45289,8 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45219
45289
|
session.heldEnd = null;
|
|
45220
45290
|
}
|
|
45221
45291
|
};
|
|
45222
|
-
const approvals2 = makeApprovals(emit);
|
|
45223
|
-
const questions = makeQuestions(emit);
|
|
45292
|
+
const approvals2 = makeApprovals(id2, emit);
|
|
45293
|
+
const questions = makeQuestions(id2, emit);
|
|
45224
45294
|
const cancelExpiry = (session) => {
|
|
45225
45295
|
session.expiry?.interruptUnsafe();
|
|
45226
45296
|
session.expiry = null;
|
|
@@ -45358,10 +45428,27 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45358
45428
|
});
|
|
45359
45429
|
}
|
|
45360
45430
|
for (const event of mapMessage(message2, session, (/* @__PURE__ */ new Date()).toISOString())) {
|
|
45431
|
+
if (event.type === "turn_failed" && event.sessionLost) {
|
|
45432
|
+
session.sessionId = null;
|
|
45433
|
+
resumable.delete(session.threadId);
|
|
45434
|
+
emit(session, event);
|
|
45435
|
+
closeSessionUnsafe(session);
|
|
45436
|
+
continue;
|
|
45437
|
+
}
|
|
45361
45438
|
if (isTerminal$1(event) && session.reportsState) session.heldEnd = event;
|
|
45362
45439
|
else emit(session, event);
|
|
45363
45440
|
}
|
|
45364
45441
|
};
|
|
45442
|
+
const endTurn = (session, message2) => race(_await(session.stderrDrained), stderrGrace).pipe(
|
|
45443
|
+
andThen(
|
|
45444
|
+
sync(
|
|
45445
|
+
() => emit(session, {
|
|
45446
|
+
type: "turn_failed",
|
|
45447
|
+
message: withStderr(message2, session.stderr)
|
|
45448
|
+
})
|
|
45449
|
+
)
|
|
45450
|
+
)
|
|
45451
|
+
);
|
|
45365
45452
|
const pump = (session) => fromAsyncIterable(
|
|
45366
45453
|
// FIXME: the Query's return() closes the transport, the raw generator's does not
|
|
45367
45454
|
{ [Symbol.asyncIterator]: () => session.query },
|
|
@@ -45372,17 +45459,11 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45372
45459
|
andThen(armExpiry(session))
|
|
45373
45460
|
)
|
|
45374
45461
|
),
|
|
45375
|
-
catchCause(
|
|
45376
|
-
(cause) => sync(() => emit(session, { type: "turn_failed", message: pretty(cause) }))
|
|
45377
|
-
),
|
|
45462
|
+
catchCause((cause) => endTurn(session, errorMessage$1(squash(cause)))),
|
|
45378
45463
|
ensuring(
|
|
45379
|
-
suspend(
|
|
45380
|
-
|
|
45381
|
-
|
|
45382
|
-
message: "Claude Code session ended unexpectedly"
|
|
45383
|
-
});
|
|
45384
|
-
return closeSession(session);
|
|
45385
|
-
})
|
|
45464
|
+
suspend(
|
|
45465
|
+
() => endTurn(session, "Claude Code session ended unexpectedly").pipe(andThen(closeSession(session)))
|
|
45466
|
+
)
|
|
45386
45467
|
)
|
|
45387
45468
|
);
|
|
45388
45469
|
const permissionModeFor = (accessMode, model) => accessMode === "auto" ? map$2(
|
|
@@ -45395,12 +45476,15 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45395
45476
|
const startSession = (input, mode2, launch2) => gen(function* () {
|
|
45396
45477
|
const prompts = yield* unbounded$1();
|
|
45397
45478
|
const abort = new AbortController();
|
|
45479
|
+
const stderr = { text: "" };
|
|
45480
|
+
const stderrDrained = yield* make$1t();
|
|
45481
|
+
const markStderrDrained = () => runSync(succeed$3(stderrDrained, void 0));
|
|
45398
45482
|
const previous = resumable.get(input.threadId);
|
|
45399
45483
|
const resume = input.resumeSessionId ?? previous?.sessionId;
|
|
45400
45484
|
const keepsGrants = previous !== void 0 && previous.sessionId === resume && sameContext(previous, input);
|
|
45401
45485
|
const base = yield* baseOptions(input.home);
|
|
45402
45486
|
const effort = effortLevelOf(input.effort);
|
|
45403
|
-
const { query } = yield* promise$1(() => import("./chunks/sdk-
|
|
45487
|
+
const { query } = yield* promise$1(() => import("./chunks/sdk-DZclv7I1.js"));
|
|
45404
45488
|
const handle = yield* try_$1({
|
|
45405
45489
|
try: () => query({
|
|
45406
45490
|
prompt: toAsyncIterable(fromQueue(prompts)),
|
|
@@ -45430,9 +45514,15 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45430
45514
|
canUseTool: (toolName2, toolInput2, options) => toolName2 === QUESTION_TOOL ? questions.ask(session, toolInput2, options) : approvals2.ask(session, toolName2, toolInput2, options),
|
|
45431
45515
|
mcpServers: { hinacode: hinacodeMcpServer(input.mcpServer) },
|
|
45432
45516
|
abortController: abort,
|
|
45433
|
-
// FIXME: the SDK
|
|
45517
|
+
// FIXME: the SDK keeps a stderr tail only for a CLI it spawns itself
|
|
45434
45518
|
spawnClaudeCodeProcess: ({ command, args, cwd, env, signal: signal2 }) => {
|
|
45435
|
-
const child = spawn(command, args, { cwd, env, signal: signal2, stdio: ["pipe", "pipe", "
|
|
45519
|
+
const child = spawn(command, args, { cwd, env, signal: signal2, stdio: ["pipe", "pipe", "pipe"] });
|
|
45520
|
+
child.stderr.setEncoding("utf8");
|
|
45521
|
+
child.stderr.on("data", (chunk) => {
|
|
45522
|
+
stderr.text = (stderr.text + chunk).slice(-2e3);
|
|
45523
|
+
});
|
|
45524
|
+
child.stderr.once("close", markStderrDrained);
|
|
45525
|
+
child.once("exit", () => setTimeout(markStderrDrained, toMillis(STDERR_DRAIN_GRACE)).unref());
|
|
45436
45526
|
child.once(
|
|
45437
45527
|
"exit",
|
|
45438
45528
|
registerAgentPid(input.threadId, () => child.pid)
|
|
@@ -45456,6 +45546,8 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45456
45546
|
permissionMode: mode2,
|
|
45457
45547
|
prompts,
|
|
45458
45548
|
abort,
|
|
45549
|
+
stderr,
|
|
45550
|
+
stderrDrained,
|
|
45459
45551
|
query: handle,
|
|
45460
45552
|
sessionGrants: keepsGrants ? previous.sessionGrants : /* @__PURE__ */ new Set(),
|
|
45461
45553
|
attachmentPaths: keepsGrants ? previous.attachmentPaths : /* @__PURE__ */ new Set(),
|
|
@@ -45464,6 +45556,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45464
45556
|
limitResetAt: null,
|
|
45465
45557
|
signedOut: false,
|
|
45466
45558
|
subagents: /* @__PURE__ */ new Map(),
|
|
45559
|
+
subagentRequests: /* @__PURE__ */ new Map(),
|
|
45467
45560
|
lastRequest: null,
|
|
45468
45561
|
sessionId: resume ?? null,
|
|
45469
45562
|
lastAssistantUuid: null,
|
|
@@ -45708,7 +45801,7 @@ const makeClaudeHarness = ({ id: id2, listModels, launchEnv }) => gen(function*
|
|
|
45708
45801
|
};
|
|
45709
45802
|
return provider;
|
|
45710
45803
|
});
|
|
45711
|
-
const layer$
|
|
45804
|
+
const layer$T = effect(
|
|
45712
45805
|
ClaudeProvider,
|
|
45713
45806
|
gen(function* () {
|
|
45714
45807
|
const cachedModels = yield* cachedWithTTL(
|
|
@@ -55410,6 +55503,8 @@ const scripts = [
|
|
|
55410
55503
|
id: "mock-agent-flaky",
|
|
55411
55504
|
label: "Reproduce the flaky macOS job",
|
|
55412
55505
|
provider: "codex",
|
|
55506
|
+
model: "gpt-6.1-sol",
|
|
55507
|
+
effort: "medium",
|
|
55413
55508
|
prompt: "Run the e2e suite for threads.feature five times and report which scenario fails.",
|
|
55414
55509
|
status: "running",
|
|
55415
55510
|
startedSecondsAgo: 128,
|
|
@@ -55424,6 +55519,46 @@ const scripts = [
|
|
|
55424
55519
|
bash("pnpm test:e2e --grep threads", "11 passed, 1 failed (46s)")
|
|
55425
55520
|
]
|
|
55426
55521
|
},
|
|
55522
|
+
{
|
|
55523
|
+
id: "mock-agent-magpie-claude",
|
|
55524
|
+
label: "Trace the settle race",
|
|
55525
|
+
provider: "magpie",
|
|
55526
|
+
model: "claude/claude-opus-5-5",
|
|
55527
|
+
effort: "high",
|
|
55528
|
+
prompt: "Find where settle and auto-archive can run on the same thread at once.",
|
|
55529
|
+
status: "running",
|
|
55530
|
+
startedSecondsAgo: 64,
|
|
55531
|
+
steps: [grep("autoArchive", "src/main/services/Threads.ts:412: autoArchive(thread)")],
|
|
55532
|
+
upcoming: [
|
|
55533
|
+
read$1("src/main/services/Threads.ts", "const settle = (threadId: string) =>"),
|
|
55534
|
+
bash("pnpm test src/main/services/Threads.integration.test.ts", "21 passed")
|
|
55535
|
+
],
|
|
55536
|
+
report: "Settle holds the thread lock before it archives, so the two cannot interleave."
|
|
55537
|
+
},
|
|
55538
|
+
{
|
|
55539
|
+
id: "mock-agent-magpie-codex",
|
|
55540
|
+
label: "Profile idle CPU",
|
|
55541
|
+
provider: "magpie",
|
|
55542
|
+
model: "codex/gpt-6.1-sol",
|
|
55543
|
+
effort: "xhigh",
|
|
55544
|
+
prompt: "Measure idle CPU with 50 threads open and name the busiest timer.",
|
|
55545
|
+
status: "running",
|
|
55546
|
+
startedSecondsAgo: 95,
|
|
55547
|
+
steps: [bash("node scripts/perf/measure.ts idle", "renderer 3.1% main 0.4%")],
|
|
55548
|
+
upcoming: [grep("setInterval", "src/renderer/components/ThreadAgents.tsx:61: setInterval(tick, 1000)")]
|
|
55549
|
+
},
|
|
55550
|
+
{
|
|
55551
|
+
id: "mock-agent-magpie-kimi",
|
|
55552
|
+
label: "Translate the new strings",
|
|
55553
|
+
provider: "magpie",
|
|
55554
|
+
model: "openrouter/moonshotai/kimi-k3",
|
|
55555
|
+
prompt: "Add ja, zh-TW and zh-CN for the keys added on this branch.",
|
|
55556
|
+
status: "completed",
|
|
55557
|
+
startedSecondsAgo: 210,
|
|
55558
|
+
ranSeconds: 40,
|
|
55559
|
+
steps: [read$1("messages/en.json", '"agents_empty": "No agents yet"')],
|
|
55560
|
+
report: "Added 4 keys to each catalog."
|
|
55561
|
+
},
|
|
55427
55562
|
{
|
|
55428
55563
|
id: "mock-agent-migrations",
|
|
55429
55564
|
label: "Review the project actions migration",
|
|
@@ -55511,6 +55646,8 @@ function mockSubagents(now2) {
|
|
|
55511
55646
|
update2({
|
|
55512
55647
|
id: script.id,
|
|
55513
55648
|
...script.provider && { provider: script.provider },
|
|
55649
|
+
...script.model && { model: script.model },
|
|
55650
|
+
...script.effort && { effort: script.effort },
|
|
55514
55651
|
label: script.label,
|
|
55515
55652
|
callId: callIdOf(script),
|
|
55516
55653
|
status: "running",
|
|
@@ -55553,6 +55690,7 @@ function play(steps, controls) {
|
|
|
55553
55690
|
const state = {
|
|
55554
55691
|
pendingEdits: /* @__PURE__ */ new Map(),
|
|
55555
55692
|
subagents: /* @__PURE__ */ new Map(),
|
|
55693
|
+
subagentRequests: /* @__PURE__ */ new Map(),
|
|
55556
55694
|
lastRequest: null,
|
|
55557
55695
|
home: null,
|
|
55558
55696
|
model: mockModel,
|
|
@@ -55650,7 +55788,7 @@ const mockScenarioDescriptions = {
|
|
|
55650
55788
|
stream: "Stream thinking, six reads and a long reply quickly.",
|
|
55651
55789
|
activity: "Start background shells, a sub-agent and tasks, then wait for Stop.",
|
|
55652
55790
|
"long-turn": "Replay 400 steps, then stream until Stop.",
|
|
55653
|
-
subagents: "Run
|
|
55791
|
+
subagents: "Run nine sub-agents, three on magpie, that report progress every two seconds.",
|
|
55654
55792
|
artifacts: "Publish an artifact named after the prompt.",
|
|
55655
55793
|
documents: "Publish a document named after the prompt. The next message updates it from the version it last saw.",
|
|
55656
55794
|
comments: "Publish a document and ask about a quote in it. Answer each comment on the document.",
|
|
@@ -55863,6 +56001,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
|
|
|
55863
56001
|
const state = {
|
|
55864
56002
|
pendingEdits: /* @__PURE__ */ new Map(),
|
|
55865
56003
|
subagents: /* @__PURE__ */ new Map(),
|
|
56004
|
+
subagentRequests: /* @__PURE__ */ new Map(),
|
|
55866
56005
|
lastRequest: null,
|
|
55867
56006
|
home: null,
|
|
55868
56007
|
model: mockModel,
|
|
@@ -55903,7 +56042,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
|
|
|
55903
56042
|
answer: (request2) => awaitReply(questionReplies, request2.id),
|
|
55904
56043
|
callTool: (name, args) => callMcpTool(input.mcpServer, name, args)
|
|
55905
56044
|
});
|
|
55906
|
-
return concat(make$
|
|
56045
|
+
return concat(make$1u(bound), played);
|
|
55907
56046
|
}
|
|
55908
56047
|
switch (scenario) {
|
|
55909
56048
|
case "usage-limit":
|
|
@@ -55925,7 +56064,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
|
|
|
55925
56064
|
concat(
|
|
55926
56065
|
merge$4(progress, fromQueue(pushed)).pipe(interruptWhen(_await(stop)))
|
|
55927
56066
|
),
|
|
55928
|
-
concat(make$
|
|
56067
|
+
concat(make$1u(interrupted))
|
|
55929
56068
|
);
|
|
55930
56069
|
})
|
|
55931
56070
|
);
|
|
@@ -55937,7 +56076,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
|
|
|
55937
56076
|
);
|
|
55938
56077
|
return fromIterable$3(longTurn()).pipe(
|
|
55939
56078
|
concat(streaming),
|
|
55940
|
-
concat(make$
|
|
56079
|
+
concat(make$1u(interrupted))
|
|
55941
56080
|
);
|
|
55942
56081
|
}
|
|
55943
56082
|
case "artifacts": {
|
|
@@ -55949,7 +56088,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
|
|
|
55949
56088
|
(id2) => artifacts.set(input.threadId, id2)
|
|
55950
56089
|
);
|
|
55951
56090
|
const bound = { type: "session_bound", providerSessionId: `mock-artifacts-${input.threadId}` };
|
|
55952
|
-
return concat(make$
|
|
56091
|
+
return concat(make$1u(bound, started), fromIterableEffect(published));
|
|
55953
56092
|
}
|
|
55954
56093
|
case "documents": {
|
|
55955
56094
|
const { started, finished: published } = documentTurn(
|
|
@@ -55960,7 +56099,7 @@ const usageLimitLayer = (defaultScenario = "usage-limit", resetAfterMs = 6e4) =>
|
|
|
55960
56099
|
(document2) => documents.set(input.threadId, document2)
|
|
55961
56100
|
);
|
|
55962
56101
|
const bound = { type: "session_bound", providerSessionId: `mock-documents-${input.threadId}` };
|
|
55963
|
-
return concat(make$
|
|
56102
|
+
return concat(make$1u(bound, started), fromIterableEffect(published));
|
|
55964
56103
|
}
|
|
55965
56104
|
case "markdown":
|
|
55966
56105
|
return fromIterable$3(markdownTurn());
|
|
@@ -56309,6 +56448,7 @@ function applyParentItem(subagents, item, now2) {
|
|
|
56309
56448
|
if (current !== void 0) return [];
|
|
56310
56449
|
const started = {
|
|
56311
56450
|
id: id2,
|
|
56451
|
+
...item.model && { model: item.model },
|
|
56312
56452
|
label: nameFromPath(item.agentPath),
|
|
56313
56453
|
callId: id2,
|
|
56314
56454
|
status: "running",
|
|
@@ -56654,9 +56794,9 @@ const copySession = (threadId, from, to) => tryPromise({
|
|
|
56654
56794
|
const interruptedEvent$2 = { type: "turn_failed", message: "Turn interrupted" };
|
|
56655
56795
|
const TERMINAL_POLL_INTERVAL = seconds(2);
|
|
56656
56796
|
const sameTasks = (a, b) => a.length === b.length && a.every((task, index) => task.id === b[index]?.id);
|
|
56657
|
-
const make$
|
|
56797
|
+
const make$17 = gen(function* () {
|
|
56658
56798
|
const providerScope = yield* scope$1;
|
|
56659
|
-
const clientLock = yield* make$
|
|
56799
|
+
const clientLock = yield* make$1v(1);
|
|
56660
56800
|
const clients = /* @__PURE__ */ new Map();
|
|
56661
56801
|
const getClient = (home) => withPermit(
|
|
56662
56802
|
clientLock,
|
|
@@ -56666,7 +56806,7 @@ const make$15 = gen(function* () {
|
|
|
56666
56806
|
if (current?.client.isAlive()) return current.client;
|
|
56667
56807
|
if (current) yield* close(current.scope, void_$1);
|
|
56668
56808
|
const binaryPath = yield* installedBinary("codex", home?.binary ?? "codex");
|
|
56669
|
-
const scope2 = yield* make$
|
|
56809
|
+
const scope2 = yield* make$1r();
|
|
56670
56810
|
const env = home === null ? { ...process.env } : { ...process.env, CODEX_HOME: home.dir };
|
|
56671
56811
|
const client2 = yield* makeCodexClient({
|
|
56672
56812
|
binaryPath,
|
|
@@ -57426,7 +57566,7 @@ const toPlanLimits$1 = (response2, readAt) => {
|
|
|
57426
57566
|
return { windows: [...toLimitWindow(snapshot.primary), ...toLimitWindow(snapshot.secondary)], readAt };
|
|
57427
57567
|
};
|
|
57428
57568
|
class CodexProvider extends Service$1()("hinacode/CodexProvider") {
|
|
57429
|
-
static layer = effect(CodexProvider, make$
|
|
57569
|
+
static layer = effect(CodexProvider, make$17);
|
|
57430
57570
|
}
|
|
57431
57571
|
const toolNames$1 = {
|
|
57432
57572
|
bash: "Bash",
|
|
@@ -58840,9 +58980,9 @@ const leaveSession = (host, sessionId) => gen(function* () {
|
|
|
58840
58980
|
}),
|
|
58841
58981
|
scoped
|
|
58842
58982
|
);
|
|
58843
|
-
const make$
|
|
58983
|
+
const make$16 = gen(function* () {
|
|
58844
58984
|
const providerScope = yield* scope$1;
|
|
58845
|
-
const hostLock = yield* make$
|
|
58985
|
+
const hostLock = yield* make$1v(1);
|
|
58846
58986
|
let current;
|
|
58847
58987
|
let planUsage;
|
|
58848
58988
|
const decodePlanUsage = decodeUnknownOption(SubscriptionUsage);
|
|
@@ -58881,7 +59021,7 @@ const make$14 = gen(function* () {
|
|
|
58881
59021
|
if (current?.host.isAlive()) return current;
|
|
58882
59022
|
if (current) yield* close(current.scope, void_$1);
|
|
58883
59023
|
const binaryPath = yield* installedBinary("muse", "muse");
|
|
58884
|
-
const scope2 = yield* make$
|
|
59024
|
+
const scope2 = yield* make$1r();
|
|
58885
59025
|
const host = yield* makeMuseHost({
|
|
58886
59026
|
binaryPath,
|
|
58887
59027
|
args: HOST_ARGS,
|
|
@@ -58913,7 +59053,7 @@ const make$14 = gen(function* () {
|
|
|
58913
59053
|
const threadSessions = /* @__PURE__ */ new Map();
|
|
58914
59054
|
const subagentsByThread = /* @__PURE__ */ new Map();
|
|
58915
59055
|
const probeSessions = /* @__PURE__ */ new Map();
|
|
58916
|
-
const probeLock = yield* make$
|
|
59056
|
+
const probeLock = yield* make$1v(1);
|
|
58917
59057
|
const runs = /* @__PURE__ */ new Map();
|
|
58918
59058
|
const grants = /* @__PURE__ */ new Map();
|
|
58919
59059
|
const wakes = yield* unbounded$1();
|
|
@@ -59570,7 +59710,7 @@ const make$14 = gen(function* () {
|
|
|
59570
59710
|
};
|
|
59571
59711
|
});
|
|
59572
59712
|
class MuseProvider extends Service$1()("hinacode/MuseProvider") {
|
|
59573
|
-
static layer = effect(MuseProvider, make$
|
|
59713
|
+
static layer = effect(MuseProvider, make$16);
|
|
59574
59714
|
}
|
|
59575
59715
|
const StoredSecret = fromJsonString(Struct({ encrypted: Boolean$1, value: String$1 }));
|
|
59576
59716
|
const rowKey = (name) => `secret.${name}`;
|
|
@@ -59587,7 +59727,7 @@ const noKeyring = succeed$5(
|
|
|
59587
59727
|
);
|
|
59588
59728
|
class Secrets extends Service$1()("hinacode/Secrets") {
|
|
59589
59729
|
}
|
|
59590
|
-
const make$
|
|
59730
|
+
const make$15 = gen(function* () {
|
|
59591
59731
|
const sql = yield* SqlClient;
|
|
59592
59732
|
const keyring = yield* Keyring;
|
|
59593
59733
|
let warnedPlaintext = false;
|
|
@@ -59638,7 +59778,7 @@ const make$13 = gen(function* () {
|
|
|
59638
59778
|
)
|
|
59639
59779
|
});
|
|
59640
59780
|
});
|
|
59641
|
-
const layer$
|
|
59781
|
+
const layer$S = effect(Secrets, make$15);
|
|
59642
59782
|
const readJson = (path2) => try_$1({
|
|
59643
59783
|
try: () => {
|
|
59644
59784
|
if (!existsSync(path2)) return void 0;
|
|
@@ -59663,7 +59803,7 @@ const readObject = (path2) => flatMap(
|
|
|
59663
59803
|
const broken = (error2) => logWarning(`${error2.message}, using defaults`, error2.cause);
|
|
59664
59804
|
const makeSettingStore = (schema2, defaults2, { path: path2, own: own2 = {} }) => gen(function* () {
|
|
59665
59805
|
const written = yield* unbounded();
|
|
59666
|
-
const writes = yield* make$
|
|
59806
|
+
const writes = yield* make$1v(1);
|
|
59667
59807
|
const ownFiles = Object.entries(own2).filter((entry) => entry[1] !== void 0);
|
|
59668
59808
|
const ownKeys = new Set(ownFiles.map(([key2]) => key2));
|
|
59669
59809
|
const files = [path2, ...ownFiles.map(([, file]) => file)].join(" and ");
|
|
@@ -59726,7 +59866,7 @@ const stampLegacyVmProvider = (path2) => {
|
|
|
59726
59866
|
return;
|
|
59727
59867
|
}
|
|
59728
59868
|
};
|
|
59729
|
-
const layer$
|
|
59869
|
+
const layer$R = (dataDir) => effect(
|
|
59730
59870
|
Settings$1,
|
|
59731
59871
|
gen(function* () {
|
|
59732
59872
|
const path2 = join$1(dataDir, "settings.json");
|
|
@@ -60684,7 +60824,7 @@ const makeAcpProvider = (config2) => gen(function* () {
|
|
|
60684
60824
|
})
|
|
60685
60825
|
);
|
|
60686
60826
|
let probedModels;
|
|
60687
|
-
const probeLock = yield* make$
|
|
60827
|
+
const probeLock = yield* make$1v(1);
|
|
60688
60828
|
const listModels = withPermit(
|
|
60689
60829
|
probeLock,
|
|
60690
60830
|
gen(function* () {
|
|
@@ -60761,7 +60901,7 @@ const MAX_BUSY_TIMEOUT = 2147483647;
|
|
|
60761
60901
|
const NANOS_PER_MILLI = /* @__PURE__ */ BigInt(1e6);
|
|
60762
60902
|
const TypeId$d = "~@effect/sql-sqlite-node/SqliteClient";
|
|
60763
60903
|
const SqliteClient = /* @__PURE__ */ Service$1("@effect/sql-sqlite-node/SqliteClient");
|
|
60764
|
-
const make$
|
|
60904
|
+
const make$14 = (options) => gen(function* () {
|
|
60765
60905
|
const compiler = makeCompilerSqlite(options.transformQueryNames);
|
|
60766
60906
|
const transformRows = options.transformResultNames ? defaultTransforms(options.transformResultNames).array : void 0;
|
|
60767
60907
|
const makeConnection = gen(function* () {
|
|
@@ -60909,10 +61049,10 @@ const make$12 = (options) => gen(function* () {
|
|
|
60909
61049
|
transactionAcquirer
|
|
60910
61050
|
} = makeSqliteAcquirers({
|
|
60911
61051
|
connection: succeed$1(connection2),
|
|
60912
|
-
semaphore: yield* make$
|
|
61052
|
+
semaphore: yield* make$1v(1),
|
|
60913
61053
|
isTransaction: (conn) => conn.isTransaction()
|
|
60914
61054
|
});
|
|
60915
|
-
return Object.assign(yield* make$
|
|
61055
|
+
return Object.assign(yield* make$1c({
|
|
60916
61056
|
acquirer,
|
|
60917
61057
|
compiler,
|
|
60918
61058
|
transactionAcquirer,
|
|
@@ -60928,7 +61068,7 @@ const make$12 = (options) => gen(function* () {
|
|
|
60928
61068
|
loadExtension: (path2) => scoped(flatMap(acquirer, (_) => _.loadExtension(path2)))
|
|
60929
61069
|
});
|
|
60930
61070
|
});
|
|
60931
|
-
const layer$
|
|
61071
|
+
const layer$Q = (config2) => effectContext(map$2(make$14(config2), (client2) => make$1w(SqliteClient, client2).pipe(add$1(SqlClient, client2)))).pipe(provide$2(layer$V));
|
|
60932
61072
|
const classifyError = (cause, message2, operation) => classifySqliteError(sqliteCauseWithErrno(cause), {
|
|
60933
61073
|
message: message2,
|
|
60934
61074
|
operation
|
|
@@ -61528,7 +61668,7 @@ const magpieProvider = gen(function* () {
|
|
|
61528
61668
|
yield* sql`ALTER TABLE automation DROP COLUMN provider`;
|
|
61529
61669
|
yield* sql`ALTER TABLE automation RENAME COLUMN next_provider TO provider`;
|
|
61530
61670
|
});
|
|
61531
|
-
const run$2 = make$
|
|
61671
|
+
const run$2 = make$19({});
|
|
61532
61672
|
const runMigrations = run$2({
|
|
61533
61673
|
loader: fromRecord({
|
|
61534
61674
|
"1_init": init,
|
|
@@ -61589,9 +61729,9 @@ const setup = effectDiscard(
|
|
|
61589
61729
|
yield* runMigrations;
|
|
61590
61730
|
})
|
|
61591
61731
|
);
|
|
61592
|
-
const layer$
|
|
61732
|
+
const layer$P = (filename) => setup.pipe(
|
|
61593
61733
|
provideMerge(
|
|
61594
|
-
layer$
|
|
61734
|
+
layer$Q({
|
|
61595
61735
|
filename,
|
|
61596
61736
|
transformQueryNames: camelToSnake,
|
|
61597
61737
|
transformResultNames: snakeToCamel
|
|
@@ -62186,7 +62326,7 @@ function compactSubagentWork(messages, callId) {
|
|
|
62186
62326
|
class AgentAccounts extends Service$1()("hinacode/AgentAccounts") {
|
|
62187
62327
|
}
|
|
62188
62328
|
const expandHome = (path2) => resolve$1(path2 === "~" || path2.startsWith("~/") ? join$1(homedir(), path2.slice(1)) : path2);
|
|
62189
|
-
const make$
|
|
62329
|
+
const make$13 = gen(function* () {
|
|
62190
62330
|
const sql = yield* SqlClient;
|
|
62191
62331
|
const settings = yield* Settings$1;
|
|
62192
62332
|
const findAll$1 = findAll({
|
|
@@ -62258,7 +62398,7 @@ const make$11 = gen(function* () {
|
|
|
62258
62398
|
home
|
|
62259
62399
|
});
|
|
62260
62400
|
});
|
|
62261
|
-
const layer$
|
|
62401
|
+
const layer$O = effect(AgentAccounts, make$13);
|
|
62262
62402
|
class AgentLogins extends Service$1()("hinacode/AgentLogins") {
|
|
62263
62403
|
}
|
|
62264
62404
|
const CachedAccount = fromJsonString(
|
|
@@ -62293,7 +62433,7 @@ const forgetIn = (cacheDir, accountId) => gen(function* () {
|
|
|
62293
62433
|
if (isSome(yield* readCached(path2, accountId))) yield* remove(path2);
|
|
62294
62434
|
}
|
|
62295
62435
|
});
|
|
62296
|
-
const make$
|
|
62436
|
+
const make$12 = (cacheDir) => gen(function* () {
|
|
62297
62437
|
const accounts = yield* AgentAccounts;
|
|
62298
62438
|
const settings = yield* Settings$1;
|
|
62299
62439
|
const providers = {
|
|
@@ -62323,7 +62463,7 @@ const make$10 = (cacheDir) => gen(function* () {
|
|
|
62323
62463
|
});
|
|
62324
62464
|
return AgentLogins.of({ account: account2, forget: (accountId) => forgetIn(cacheDir, accountId) });
|
|
62325
62465
|
});
|
|
62326
|
-
const layer$
|
|
62466
|
+
const layer$N = (cacheDir) => effect(AgentLogins, make$12(cacheDir));
|
|
62327
62467
|
const ArtifactFileSchema = object$2({
|
|
62328
62468
|
path: string$1(),
|
|
62329
62469
|
type: string$1(),
|
|
@@ -62866,7 +63006,7 @@ var hasRequiredGracefulFs;
|
|
|
62866
63006
|
function requireGracefulFs() {
|
|
62867
63007
|
if (hasRequiredGracefulFs) return gracefulFs;
|
|
62868
63008
|
hasRequiredGracefulFs = 1;
|
|
62869
|
-
var fs2 =
|
|
63009
|
+
var fs2 = Ee__default;
|
|
62870
63010
|
var polyfills2 = requirePolyfills();
|
|
62871
63011
|
var legacy = requireLegacyStreams();
|
|
62872
63012
|
var clone2 = requireClone();
|
|
@@ -63693,7 +63833,7 @@ var hasRequiredLockfile;
|
|
|
63693
63833
|
function requireLockfile() {
|
|
63694
63834
|
if (hasRequiredLockfile) return lockfile;
|
|
63695
63835
|
hasRequiredLockfile = 1;
|
|
63696
|
-
const path2 =
|
|
63836
|
+
const path2 = Pe__default;
|
|
63697
63837
|
const fs2 = requireGracefulFs();
|
|
63698
63838
|
const retry2 = requireRetry();
|
|
63699
63839
|
const onExit2 = requireSignalExit();
|
|
@@ -64570,22 +64710,61 @@ const currentMarkdown = async (store2, id2) => {
|
|
|
64570
64710
|
return file === null ? "" : new TextDecoder().decode(file.bytes);
|
|
64571
64711
|
};
|
|
64572
64712
|
const describeSourcePath = (holds) => `The absolute path of a file on this machine that holds ${holds}. It is copied when you publish, so publish again after you change it.`;
|
|
64573
|
-
const
|
|
64713
|
+
const cannotRead = (sourcePath, error2) => error2 instanceof ArtifactError ? error2 : new ArtifactError(`Cannot read sourcePath "${sourcePath}": ${String(error2)}`);
|
|
64714
|
+
const sourceSize = async (sourcePath) => {
|
|
64574
64715
|
if (!isAbsolute(sourcePath)) throw new ArtifactError(`sourcePath must be absolute, but got "${sourcePath}".`);
|
|
64575
64716
|
try {
|
|
64576
64717
|
const source = await stat(sourcePath);
|
|
64577
64718
|
if (!source.isFile()) throw new ArtifactError(`sourcePath "${sourcePath}" is not a file.`);
|
|
64578
|
-
|
|
64579
|
-
throw new ArtifactError(
|
|
64580
|
-
`"${sourcePath}" is ${source.size} bytes. A version holds at most ${MAX_ARTIFACT_BYTES} bytes.`
|
|
64581
|
-
);
|
|
64582
|
-
}
|
|
64583
|
-
return await readFile(sourcePath);
|
|
64719
|
+
return source.size;
|
|
64584
64720
|
} catch (error2) {
|
|
64585
|
-
|
|
64586
|
-
throw new ArtifactError(`Cannot read sourcePath "${sourcePath}": ${String(error2)}`);
|
|
64721
|
+
throw cannotRead(sourcePath, error2);
|
|
64587
64722
|
}
|
|
64588
64723
|
};
|
|
64724
|
+
const readSources = async (sourcePaths, inlineBytes = 0) => {
|
|
64725
|
+
const sizes = await Promise.all(sourcePaths.map(sourceSize));
|
|
64726
|
+
const total2 = sizes.reduce((sum2, size2) => sum2 + size2, inlineBytes);
|
|
64727
|
+
if (total2 > MAX_ARTIFACT_BYTES) {
|
|
64728
|
+
throw new ArtifactError(`The files are ${total2} bytes. A version holds at most ${MAX_ARTIFACT_BYTES} bytes.`);
|
|
64729
|
+
}
|
|
64730
|
+
return Promise.all(
|
|
64731
|
+
sourcePaths.map(
|
|
64732
|
+
(sourcePath) => readFile(sourcePath).catch((error2) => Promise.reject(cannotRead(sourcePath, error2)))
|
|
64733
|
+
)
|
|
64734
|
+
);
|
|
64735
|
+
};
|
|
64736
|
+
const base64Codes = new Uint8Array(128);
|
|
64737
|
+
for (const character of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/-_")
|
|
64738
|
+
base64Codes[character.charCodeAt(0)] = 1;
|
|
64739
|
+
const base64Padding = "=".charCodeAt(0);
|
|
64740
|
+
const decodedBase64Size = (content) => {
|
|
64741
|
+
let codes = 0;
|
|
64742
|
+
for (let index = 0; index < content.length; index++) {
|
|
64743
|
+
const code2 = content.charCodeAt(index);
|
|
64744
|
+
if (code2 === base64Padding) break;
|
|
64745
|
+
if (code2 < base64Codes.length && base64Codes[code2] === 1) codes += 1;
|
|
64746
|
+
}
|
|
64747
|
+
return Math.floor(codes * 3 / 4);
|
|
64748
|
+
};
|
|
64749
|
+
const inlineSize = (file) => {
|
|
64750
|
+
if (file.content === void 0) return 0;
|
|
64751
|
+
return file.encoding === "base64" ? decodedBase64Size(file.content) : Buffer.byteLength(file.content, "utf8");
|
|
64752
|
+
};
|
|
64753
|
+
const strictUtf8 = new TextDecoder("utf-8", { fatal: true });
|
|
64754
|
+
const utf8Text = (bytes) => {
|
|
64755
|
+
try {
|
|
64756
|
+
return strictUtf8.decode(bytes);
|
|
64757
|
+
} catch {
|
|
64758
|
+
return null;
|
|
64759
|
+
}
|
|
64760
|
+
};
|
|
64761
|
+
const markdownIn = (sourcePath, bytes) => {
|
|
64762
|
+
const text2 = utf8Text(bytes);
|
|
64763
|
+
if (text2 === null || text2.includes("\0")) {
|
|
64764
|
+
throw new ArtifactError(`"${sourcePath}" is not UTF-8 text. A document's sourcePath must be Markdown.`);
|
|
64765
|
+
}
|
|
64766
|
+
return text2;
|
|
64767
|
+
};
|
|
64589
64768
|
const newNeedsTitle = { message: "Give a new artifact a title.", path: ["title"] };
|
|
64590
64769
|
const describeTitle = (example) => `The artifact's name, two to four words, such as "${example}". Required for a new one. Omit it when you update, to keep the name the developer may have changed.`;
|
|
64591
64770
|
const authorName = (author) => author.kind === "developer" ? "developer" : author.threadId === void 0 ? "agent" : `agent (thread ${author.threadId})`;
|
|
@@ -64641,14 +64820,14 @@ const artifactTools = {
|
|
|
64641
64820
|
auto_open: autoOpen
|
|
64642
64821
|
}).refine((input) => input.id !== void 0 || input.title !== void 0, newNeedsTitle),
|
|
64643
64822
|
handle: async (store2, { auto_open: _autoOpen, ...input }, { threadId }) => {
|
|
64644
|
-
const
|
|
64645
|
-
|
|
64646
|
-
|
|
64647
|
-
|
|
64648
|
-
|
|
64649
|
-
|
|
64650
|
-
|
|
64651
|
-
)
|
|
64823
|
+
const sourced = input.files.flatMap(({ sourcePath }) => sourcePath === void 0 ? [] : [sourcePath]);
|
|
64824
|
+
const contents = await readSources(
|
|
64825
|
+
sourced,
|
|
64826
|
+
input.files.reduce((sum2, file) => sum2 + inlineSize(file), 0)
|
|
64827
|
+
);
|
|
64828
|
+
const read2 = new Map(sourced.map((sourcePath, index) => [sourcePath, contents[index]]));
|
|
64829
|
+
const files = input.files.map(
|
|
64830
|
+
({ sourcePath, ...file }) => sourcePath === void 0 ? { ...file, content: file.content ?? "" } : { path: file.path, content: read2.get(sourcePath)?.toString("base64") ?? "", encoding: "base64" }
|
|
64652
64831
|
);
|
|
64653
64832
|
const artifact2 = await store2.publish({ ...input, files, ...threadId === void 0 ? {} : { threadId } });
|
|
64654
64833
|
return `Published artifact ${artifact2.id} version ${artifact2.version}: "${artifact2.title}". Pass id "${artifact2.id}" to publish_artifact to update it.`;
|
|
@@ -64673,7 +64852,8 @@ const artifactTools = {
|
|
|
64673
64852
|
path: ["revision"]
|
|
64674
64853
|
}).refine((input) => input.id !== void 0 || input.title !== void 0, newNeedsTitle),
|
|
64675
64854
|
handle: async (store2, { id: id2, revision, title: title2, markdown, sourcePath }, { threadId }) => {
|
|
64676
|
-
const
|
|
64855
|
+
const [bytes = Buffer.alloc(0)] = sourcePath === void 0 ? [] : await readSources([sourcePath]);
|
|
64856
|
+
const contents = sourcePath === void 0 ? markdown ?? "" : markdownIn(sourcePath, bytes);
|
|
64677
64857
|
try {
|
|
64678
64858
|
const document2 = await store2.publish({
|
|
64679
64859
|
kind: "document",
|
|
@@ -65283,10 +65463,16 @@ const latestForkPoint = (provider, history) => history.findLast(
|
|
|
65283
65463
|
const isAt = (forkedFrom) => (message2) => message2.forkPoint?.sessionId === forkedFrom.sessionId && message2.forkPoint.checkpoint === forkedFrom.checkpoint;
|
|
65284
65464
|
const unseenSince = (history, forkedFrom) => forkedFrom === null ? history : history.slice(history.findIndex(isAt(forkedFrom)) + 1);
|
|
65285
65465
|
function sidechatPrompt(input) {
|
|
65466
|
+
const earlier = renderTranscript(input.history);
|
|
65286
65467
|
const transcript = renderTranscript(input.unseen);
|
|
65287
65468
|
return [
|
|
65288
65469
|
"<side_chat>",
|
|
65289
65470
|
"This is a side chat. The developer asks you something while the main agent keeps working on this conversation in the same workspace. Answer it, and do not edit files or run commands that change anything.",
|
|
65471
|
+
...earlier === "" ? [] : [
|
|
65472
|
+
"This side chat ran in an earlier session that you cannot resume. Here is what was said in it, oldest first. Tool output is left out.",
|
|
65473
|
+
"",
|
|
65474
|
+
earlier
|
|
65475
|
+
],
|
|
65290
65476
|
...transcript === "" ? [] : [
|
|
65291
65477
|
"The main conversation went on after your history ends. Here is the rest, oldest first. Tool output is left out, and the last message may still be in progress.",
|
|
65292
65478
|
"",
|
|
@@ -65302,6 +65488,7 @@ You are running inside HinaCode, which shows the pull requests linked to each th
|
|
|
65302
65488
|
|
|
65303
65489
|
Pull requests:
|
|
65304
65490
|
- Right after you open a pull request for this thread, call the hinacode \`link_pull_request\` tool with its full URL. Opening it with \`gh\`, another CLI or the GitHub API does not link it.
|
|
65491
|
+
- On a GitLab project a merge request is the pull request: open it with \`glab mr create\`, then link and watch its URL the same way.
|
|
65305
65492
|
- Also link an existing pull request when you start working on it. Linking one that is already linked is safe.
|
|
65306
65493
|
- When a pull request needs babysitting, call \`watch_pull_request\` with its URL instead of polling \`gh\` yourself. HinaCode checks it every minute and sends this thread a new message when checks fail or pass, the review changes, the branch conflicts, or the pull request merges or closes. Act on that message when it arrives, then stop. Call \`unwatch_pull_request\` when the user asks you to stop watching.
|
|
65307
65494
|
- Before you finish pull request work, call \`list_thread_pull_requests\` and link any of yours that is missing.
|
|
@@ -65467,7 +65654,7 @@ const subagentReport = (subagent2) => {
|
|
|
65467
65654
|
const BEARER = "Bearer ";
|
|
65468
65655
|
class McpCredentials extends Service$1()("hinacode/McpCredentials") {
|
|
65469
65656
|
}
|
|
65470
|
-
const make
|
|
65657
|
+
const make$11 = gen(function* () {
|
|
65471
65658
|
const secrets = /* @__PURE__ */ new Map();
|
|
65472
65659
|
const url2 = yield* make$1t();
|
|
65473
65660
|
const secretFor = (threadId) => {
|
|
@@ -65497,7 +65684,7 @@ const make$$ = gen(function* () {
|
|
|
65497
65684
|
listening: (listeningUrl) => asVoid(succeed$3(url2, listeningUrl))
|
|
65498
65685
|
});
|
|
65499
65686
|
});
|
|
65500
|
-
const layer$
|
|
65687
|
+
const layer$M = effect(McpCredentials, make$11);
|
|
65501
65688
|
class Events extends Service$1()(
|
|
65502
65689
|
"hinacode/Events"
|
|
65503
65690
|
) {
|
|
@@ -65645,7 +65832,7 @@ const failAfter = (timeout2, command, args) => timeoutOrElse({
|
|
|
65645
65832
|
});
|
|
65646
65833
|
const makeExec = (spawner) => (command, args, cwd, options) => gen(function* () {
|
|
65647
65834
|
const handle = yield* spawner.spawn(
|
|
65648
|
-
make$
|
|
65835
|
+
make$1x(command, args, {
|
|
65649
65836
|
cwd,
|
|
65650
65837
|
stdin: "ignore",
|
|
65651
65838
|
env: options?.env,
|
|
@@ -65726,7 +65913,7 @@ const parseLog = (output) => {
|
|
|
65726
65913
|
};
|
|
65727
65914
|
class Git extends Service$1()("hinacode/Git") {
|
|
65728
65915
|
}
|
|
65729
|
-
const make$
|
|
65916
|
+
const make$10 = gen(function* () {
|
|
65730
65917
|
const exec2 = makeExec(yield* ChildProcessSpawner);
|
|
65731
65918
|
const run2 = (cwd, args, options) => exec2("git", ["-C", cwd, ...args], cwd, { ...options, env: { ...NO_OPTIONAL_LOCKS_ENV, ...options?.env } });
|
|
65732
65919
|
const remote = (cwd, args) => run2(cwd, [...REMOTE_GIT_ARGS, ...args], { env: REMOTE_GIT_ENV, timeout: LONG_TIMEOUT });
|
|
@@ -65766,7 +65953,7 @@ const make$_ = gen(function* () {
|
|
|
65766
65953
|
]).pipe(map$2(parseRawWithPatch));
|
|
65767
65954
|
return Git.of({ run: run2, remote, log: log2, show });
|
|
65768
65955
|
});
|
|
65769
|
-
const layer$
|
|
65956
|
+
const layer$L = effect(Git, make$10);
|
|
65770
65957
|
const MessageRow = Struct({
|
|
65771
65958
|
...Message.fields,
|
|
65772
65959
|
parts: fromJsonString(ArraySchema(MessagePart)),
|
|
@@ -65775,7 +65962,7 @@ const MessageRow = Struct({
|
|
|
65775
65962
|
});
|
|
65776
65963
|
class Messages extends Service$1()("hinacode/Messages") {
|
|
65777
65964
|
}
|
|
65778
|
-
const make
|
|
65965
|
+
const make$$ = gen(function* () {
|
|
65779
65966
|
const sql = yield* SqlClient;
|
|
65780
65967
|
const encodeRow = encodeEffect(MessageRow);
|
|
65781
65968
|
const encodePart = encodeEffect(fromJsonString(MessagePart));
|
|
@@ -65904,11 +66091,53 @@ const make$Z = gen(function* () {
|
|
|
65904
66091
|
closeInterrupted
|
|
65905
66092
|
});
|
|
65906
66093
|
});
|
|
65907
|
-
const layer$
|
|
66094
|
+
const layer$K = effect(Messages, make$$);
|
|
65908
66095
|
class EventBus extends Service$1()("hinacode/EventBus") {
|
|
65909
66096
|
}
|
|
65910
66097
|
const RING_CAPACITY = 256;
|
|
65911
|
-
const layer$
|
|
66098
|
+
const layer$J = effect(EventBus, sliding(RING_CAPACITY));
|
|
66099
|
+
const SEGMENT = /^[\w.-]+$/;
|
|
66100
|
+
const isProjectPath = (path2) => {
|
|
66101
|
+
const segments2 = path2.split("/");
|
|
66102
|
+
return segments2.length >= 2 && segments2.every((segment) => SEGMENT.test(segment) && !/^\.+$/.test(segment));
|
|
66103
|
+
};
|
|
66104
|
+
const parseGitLabMergeRequestUrl = (raw2) => {
|
|
66105
|
+
if (!URL.canParse(raw2)) return void 0;
|
|
66106
|
+
const url2 = new URL(raw2);
|
|
66107
|
+
if (url2.protocol !== "https:" || url2.username !== "" || url2.password !== "") return void 0;
|
|
66108
|
+
const match2 = /^\/(.+?)\/-\/merge_requests\/([1-9]\d*)(?:\/.*)?$/.exec(url2.pathname);
|
|
66109
|
+
if (!match2) return void 0;
|
|
66110
|
+
const [, path2 = "", iid] = match2;
|
|
66111
|
+
if (!isProjectPath(path2)) return void 0;
|
|
66112
|
+
return { hostname: url2.host, path: path2, iid: Number(iid) };
|
|
66113
|
+
};
|
|
66114
|
+
const gitLabMergeRequestUrl = ({ hostname: hostname2, path: path2, iid }) => `https://${hostname2}/${path2}/-/merge_requests/${iid}`;
|
|
66115
|
+
const parsePullRequestUrl = (raw2) => {
|
|
66116
|
+
const text2 = raw2.trim();
|
|
66117
|
+
const github = parseGitHubPullRequestUrl(text2);
|
|
66118
|
+
if (github) return { host: "github", url: github };
|
|
66119
|
+
const gitlab = parseGitLabMergeRequestUrl(text2);
|
|
66120
|
+
return gitlab ? { host: "gitlab", url: gitLabMergeRequestUrl(gitlab) } : void 0;
|
|
66121
|
+
};
|
|
66122
|
+
const codeHostOfUrl = (url2) => parsePullRequestUrl(url2)?.host;
|
|
66123
|
+
const SSH_REMOTE = /^(?:ssh|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/;
|
|
66124
|
+
const SCP_REMOTE = /^(?:[^@/]+@)?([^/:]+):(?!\/)(.+)$/;
|
|
66125
|
+
const remoteParts = (remote) => {
|
|
66126
|
+
if (/^https?:\/\//.test(remote)) {
|
|
66127
|
+
if (!URL.canParse(remote)) return void 0;
|
|
66128
|
+
const url2 = new URL(remote);
|
|
66129
|
+
return [url2.host, url2.pathname.slice(1)];
|
|
66130
|
+
}
|
|
66131
|
+
const match2 = SSH_REMOTE.exec(remote) ?? SCP_REMOTE.exec(remote);
|
|
66132
|
+
return match2 ? [match2[1] ?? "", match2[2] ?? ""] : void 0;
|
|
66133
|
+
};
|
|
66134
|
+
const parseRemote = (remote) => {
|
|
66135
|
+
const parts = remoteParts(remote.trim());
|
|
66136
|
+
if (!parts) return void 0;
|
|
66137
|
+
const hostname2 = parts[0].toLowerCase();
|
|
66138
|
+
const path2 = parts[1].replace(/\/+$/, "").replace(/\.git$/, "");
|
|
66139
|
+
return hostname2 !== "" && isProjectPath(path2) ? { hostname: hostname2, path: path2 } : void 0;
|
|
66140
|
+
};
|
|
65912
66141
|
const GIT_DIFF_HEADER_RE = /^diff --git a\/.* b\/(.*)$/;
|
|
65913
66142
|
const QUOTED_GIT_DIFF_HEADER_RE = /^diff --git "a\/(?:[^"\\]|\\.)*" "b\/((?:[^"\\]|\\.)*)"$/;
|
|
65914
66143
|
const C_ESCAPES = {
|
|
@@ -66156,7 +66385,7 @@ class PullRequestUrlInvalidError extends TaggedError$1()(
|
|
|
66156
66385
|
{ url: String$1 }
|
|
66157
66386
|
) {
|
|
66158
66387
|
get message() {
|
|
66159
|
-
return `${this.url} is not a GitHub pull request URL (https://github.com/<owner>/<repo>/pull/<number>)`;
|
|
66388
|
+
return `${this.url} is not a GitHub pull request URL (https://github.com/<owner>/<repo>/pull/<number>) or a GitLab merge request URL (https://<host>/<project>/-/merge_requests/<iid>)`;
|
|
66160
66389
|
}
|
|
66161
66390
|
}
|
|
66162
66391
|
class PullRequestDiffTooLargeError extends TaggedError$1()(
|
|
@@ -66176,7 +66405,7 @@ const parseCloneProgress = (chunk) => {
|
|
|
66176
66405
|
}
|
|
66177
66406
|
return void 0;
|
|
66178
66407
|
};
|
|
66179
|
-
const
|
|
66408
|
+
const requireGitHubPullRequestUrl = (raw2) => {
|
|
66180
66409
|
const url2 = parseGitHubPullRequestUrl(raw2.trim());
|
|
66181
66410
|
return url2 === void 0 ? fail$2(new PullRequestUrlInvalidError({ url: raw2 })) : succeed$1(url2);
|
|
66182
66411
|
};
|
|
@@ -66417,7 +66646,7 @@ const toComment = ({ id: id2, body: body2, createdAt, url: url2, author, viewerD
|
|
|
66417
66646
|
url: url2,
|
|
66418
66647
|
location: location2
|
|
66419
66648
|
});
|
|
66420
|
-
const toComments = ({
|
|
66649
|
+
const toComments$1 = ({
|
|
66421
66650
|
comments,
|
|
66422
66651
|
reviews,
|
|
66423
66652
|
reviewThreads
|
|
@@ -66476,7 +66705,7 @@ const fromGraphQL = ({
|
|
|
66476
66705
|
reviewDecision: reviewDecision ?? "",
|
|
66477
66706
|
author: author ?? { login: "ghost" },
|
|
66478
66707
|
statusCheckRollup: (commits.nodes[0]?.commit.statusCheckRollup?.contexts.nodes ?? []).map(toRollupEntry),
|
|
66479
|
-
comments: toComments({ comments, reviews, reviewThreads }),
|
|
66708
|
+
comments: toComments$1({ comments, reviews, reviewThreads }),
|
|
66480
66709
|
labels: labels.nodes,
|
|
66481
66710
|
assignees: assignees.nodes.map(({ login }) => login),
|
|
66482
66711
|
reviewers: toReviewers({ reviewRequests, latestOpinionatedReviews, latestReviews }, author?.login ?? "ghost")
|
|
@@ -66504,7 +66733,7 @@ const reviewStatus = {
|
|
|
66504
66733
|
};
|
|
66505
66734
|
const pullRequestStatus = (state, isDraft) => state === "OPEN" ? isDraft ? "draft" : "open" : state === "MERGED" ? "merged" : "closed";
|
|
66506
66735
|
const mergeable = { MERGEABLE: "mergeable", CONFLICTING: "conflicting" };
|
|
66507
|
-
const toPullRequest = (json2) => {
|
|
66736
|
+
const toPullRequest$1 = (json2) => {
|
|
66508
66737
|
const status = pullRequestStatus(json2.state, json2.isDraft);
|
|
66509
66738
|
return {
|
|
66510
66739
|
url: json2.url,
|
|
@@ -66522,7 +66751,7 @@ const toPullRequest = (json2) => {
|
|
|
66522
66751
|
mergedAt: json2.mergedAt ?? null
|
|
66523
66752
|
};
|
|
66524
66753
|
};
|
|
66525
|
-
const CHECK_RUN_ORDER = { failing: 0, pending: 1, passing: 2, skipped: 3 };
|
|
66754
|
+
const CHECK_RUN_ORDER$1 = { failing: 0, pending: 1, passing: 2, skipped: 3 };
|
|
66526
66755
|
const toCheckRun = (entry) => {
|
|
66527
66756
|
const { name, workflowName } = entry;
|
|
66528
66757
|
return {
|
|
@@ -66531,8 +66760,8 @@ const toCheckRun = (entry) => {
|
|
|
66531
66760
|
url: entry.detailsUrl || entry.targetUrl || null
|
|
66532
66761
|
};
|
|
66533
66762
|
};
|
|
66534
|
-
const toPullRequestDetail = (json2) => ({
|
|
66535
|
-
...toPullRequest(json2),
|
|
66763
|
+
const toPullRequestDetail$1 = (json2) => ({
|
|
66764
|
+
...toPullRequest$1(json2),
|
|
66536
66765
|
body: json2.body,
|
|
66537
66766
|
baseRef: json2.baseRefName,
|
|
66538
66767
|
headRef: json2.headRefName,
|
|
@@ -66542,7 +66771,7 @@ const toPullRequestDetail = (json2) => ({
|
|
|
66542
66771
|
labels: json2.labels,
|
|
66543
66772
|
assignees: json2.assignees,
|
|
66544
66773
|
reviewers: json2.reviewers,
|
|
66545
|
-
checkRuns: json2.statusCheckRollup.map(toCheckRun).toSorted((a, b) => CHECK_RUN_ORDER[a.status] - CHECK_RUN_ORDER[b.status])
|
|
66774
|
+
checkRuns: json2.statusCheckRollup.map(toCheckRun).toSorted((a, b) => CHECK_RUN_ORDER$1[a.status] - CHECK_RUN_ORDER$1[b.status])
|
|
66546
66775
|
});
|
|
66547
66776
|
const pullRequestFiles = (diff) => forEach(
|
|
66548
66777
|
diff.split(/^(?=diff --git )/m).filter((section) => section.startsWith("diff --git ")),
|
|
@@ -66692,7 +66921,7 @@ const FINISHED_PULL_REQUEST_TTL = "1 hour";
|
|
|
66692
66921
|
const FRESH_READ_WINDOW = "10 seconds";
|
|
66693
66922
|
const MERGEABLE_RECHECK = "2 seconds";
|
|
66694
66923
|
const MERGEABLE_RECHECKS = 5;
|
|
66695
|
-
const make$
|
|
66924
|
+
const make$_ = gen(function* () {
|
|
66696
66925
|
const exec2 = makeExec(yield* ChildProcessSpawner);
|
|
66697
66926
|
const events2 = yield* Events;
|
|
66698
66927
|
const layerScope = yield* scope$1;
|
|
@@ -66797,7 +67026,7 @@ const make$Y = gen(function* () {
|
|
|
66797
67026
|
);
|
|
66798
67027
|
const view = (cwd, selector) => gh(cwd, ["pr", "view", selector, "--json", PULL_REQUEST_FIELDS]).pipe(
|
|
66799
67028
|
flatMap(decodePullRequest),
|
|
66800
|
-
map$2(toPullRequest)
|
|
67029
|
+
map$2(toPullRequest$1)
|
|
66801
67030
|
);
|
|
66802
67031
|
const branchPullRequest = (cwd, branch) => view(cwd, branch).pipe(
|
|
66803
67032
|
catchIf(
|
|
@@ -66837,7 +67066,7 @@ const make$Y = gen(function* () {
|
|
|
66837
67066
|
asVoid
|
|
66838
67067
|
);
|
|
66839
67068
|
};
|
|
66840
|
-
const ghByUrl = (raw2, args) => flatMap(
|
|
67069
|
+
const ghByUrl = (raw2, args) => flatMap(requireGitHubPullRequestUrl(raw2), (url2) => gh(homedir(), args(url2)));
|
|
66841
67070
|
const lastRead = /* @__PURE__ */ new Map();
|
|
66842
67071
|
const mergeableRechecks = /* @__PURE__ */ new Map();
|
|
66843
67072
|
const fetchPullRequests = (entries) => gen(function* () {
|
|
@@ -66864,7 +67093,7 @@ const make$Y = gen(function* () {
|
|
|
66864
67093
|
{ discard: true }
|
|
66865
67094
|
);
|
|
66866
67095
|
});
|
|
66867
|
-
const pullRequestReads = make$
|
|
67096
|
+
const pullRequestReads = make$1b(fetchPullRequests).pipe(
|
|
66868
67097
|
setDelayEffect(
|
|
66869
67098
|
promise$1(() => new Promise((resolve2) => setTimeout(resolve2, BATCH_WINDOW_MS)))
|
|
66870
67099
|
),
|
|
@@ -66915,7 +67144,7 @@ const make$Y = gen(function* () {
|
|
|
66915
67144
|
timeToLive: (exit2) => isFailure$1(exit2) ? 0 : FRESH_READ_WINDOW
|
|
66916
67145
|
});
|
|
66917
67146
|
const read2 = (raw2, fresh = false) => flatMap(
|
|
66918
|
-
|
|
67147
|
+
requireGitHubPullRequestUrl(raw2),
|
|
66919
67148
|
(url2) => fresh ? andThen(get$3(freshReads, url2), get$3(reads, url2)) : get$3(reads, url2)
|
|
66920
67149
|
);
|
|
66921
67150
|
const openInRepository = (url2) => map$2(keys(reads), (keys2) => {
|
|
@@ -66924,7 +67153,7 @@ const make$Y = gen(function* () {
|
|
|
66924
67153
|
return [.../* @__PURE__ */ new Set([url2, ...open2])];
|
|
66925
67154
|
});
|
|
66926
67155
|
const ghWrite = (raw2, args, affected = (url2) => succeed$1([url2])) => flatMap(
|
|
66927
|
-
|
|
67156
|
+
requireGitHubPullRequestUrl(raw2),
|
|
66928
67157
|
(url2) => gh(homedir(), args(url2)).pipe(
|
|
66929
67158
|
onExit(
|
|
66930
67159
|
(exit2) => flatMap(
|
|
@@ -66946,9 +67175,9 @@ const make$Y = gen(function* () {
|
|
|
66946
67175
|
map$2((stdout) => stdout.trim())
|
|
66947
67176
|
),
|
|
66948
67177
|
run: gh,
|
|
66949
|
-
pullRequest: (raw2) => map$2(read2(raw2), toPullRequest),
|
|
67178
|
+
pullRequest: (raw2) => map$2(read2(raw2), toPullRequest$1),
|
|
66950
67179
|
pullRequestOpenedAt: (raw2) => map$2(read2(raw2), (json2) => json2.createdAt),
|
|
66951
|
-
pullRequestDetail: (raw2, options) => map$2(read2(raw2, options?.fresh), toPullRequestDetail),
|
|
67180
|
+
pullRequestDetail: (raw2, options) => map$2(read2(raw2, options?.fresh), toPullRequestDetail$1),
|
|
66952
67181
|
pullRequestDiff: (raw2) => ghByUrl(raw2, (url2) => ["pr", "diff", url2, "--color=never"]).pipe(
|
|
66953
67182
|
catchIf(
|
|
66954
67183
|
(error2) => error2._tag === "CommandError" && error2.stderr.includes("too_large"),
|
|
@@ -66963,7 +67192,7 @@ const make$Y = gen(function* () {
|
|
|
66963
67192
|
close: (raw2) => ghWrite(raw2, (url2) => ["pr", "close", url2]),
|
|
66964
67193
|
comment: (raw2, body2) => ghWrite(raw2, (url2) => ["pr", "comment", url2, "--body", body2]),
|
|
66965
67194
|
pullRequestCandidates: (raw2) => gen(function* () {
|
|
66966
|
-
const [, owner2 = "", name = ""] = new URL(yield*
|
|
67195
|
+
const [, owner2 = "", name = ""] = new URL(yield* requireGitHubPullRequestUrl(raw2)).pathname.split("/");
|
|
66967
67196
|
const { body: body2 } = yield* ghApi([
|
|
66968
67197
|
"graphql",
|
|
66969
67198
|
"-f",
|
|
@@ -67024,7 +67253,396 @@ const make$Y = gen(function* () {
|
|
|
67024
67253
|
repository
|
|
67025
67254
|
});
|
|
67026
67255
|
});
|
|
67027
|
-
const layer$
|
|
67256
|
+
const layer$I = effect(GitHub, make$_);
|
|
67257
|
+
class GitLabCliMissingError extends TaggedError$1()("GitLabCliMissingError", {}) {
|
|
67258
|
+
get message() {
|
|
67259
|
+
return "The GitLab CLI (glab) is not installed. Install it from https://gitlab.com/gitlab-org/cli and sign in with glab auth login.";
|
|
67260
|
+
}
|
|
67261
|
+
}
|
|
67262
|
+
class GitLabSignedOutError extends TaggedError$1()("GitLabSignedOutError", {
|
|
67263
|
+
hostname: String$1
|
|
67264
|
+
}) {
|
|
67265
|
+
get message() {
|
|
67266
|
+
return `glab is not signed in to ${this.hostname}. Run glab auth login --hostname ${this.hostname} in a terminal.`;
|
|
67267
|
+
}
|
|
67268
|
+
}
|
|
67269
|
+
class GitLabApiError extends TaggedError$1()("GitLabApiError", { detail: String$1 }) {
|
|
67270
|
+
get message() {
|
|
67271
|
+
return `GitLab refused the request: ${this.detail}`;
|
|
67272
|
+
}
|
|
67273
|
+
}
|
|
67274
|
+
class GitLabMergeMethodError extends TaggedError$1()("GitLabMergeMethodError", {}) {
|
|
67275
|
+
get message() {
|
|
67276
|
+
return "GitLab merges with the method the project is configured for. Choose Merge or Squash and merge.";
|
|
67277
|
+
}
|
|
67278
|
+
}
|
|
67279
|
+
class GitLab extends Service$1()("hinacode/GitLab") {
|
|
67280
|
+
}
|
|
67281
|
+
const Author = Struct({ username: String$1, bot: optionalKey(Boolean$1) });
|
|
67282
|
+
const MergeRequestJson = Struct({
|
|
67283
|
+
iid: Number$2,
|
|
67284
|
+
title: String$1,
|
|
67285
|
+
description: NullOr(String$1),
|
|
67286
|
+
state: Literals(["opened", "closed", "locked", "merged"]),
|
|
67287
|
+
draft: Boolean$1,
|
|
67288
|
+
has_conflicts: Boolean$1,
|
|
67289
|
+
detailed_merge_status: String$1,
|
|
67290
|
+
sha: NullOr(String$1),
|
|
67291
|
+
source_branch: String$1,
|
|
67292
|
+
target_branch: String$1,
|
|
67293
|
+
merged_at: NullOr(String$1),
|
|
67294
|
+
created_at: String$1,
|
|
67295
|
+
author: Author,
|
|
67296
|
+
head_pipeline: optionalKey(NullOr(Struct({ id: Number$2, status: String$1 })))
|
|
67297
|
+
});
|
|
67298
|
+
const ApprovalsJson = Struct({
|
|
67299
|
+
approved: Boolean$1,
|
|
67300
|
+
approved_by: ArraySchema(Struct({ user: Struct({ username: String$1 }) }))
|
|
67301
|
+
});
|
|
67302
|
+
const DiffsJson = ArraySchema(Struct({ diff: String$1 }));
|
|
67303
|
+
const JobsJson = ArraySchema(
|
|
67304
|
+
Struct({ name: String$1, status: String$1, allow_failure: Boolean$1, web_url: String$1 })
|
|
67305
|
+
);
|
|
67306
|
+
const NotesJson = ArraySchema(
|
|
67307
|
+
Struct({
|
|
67308
|
+
id: Number$2,
|
|
67309
|
+
body: String$1,
|
|
67310
|
+
author: Author,
|
|
67311
|
+
created_at: String$1,
|
|
67312
|
+
system: Boolean$1,
|
|
67313
|
+
position: optionalKey(
|
|
67314
|
+
NullOr(
|
|
67315
|
+
Struct({
|
|
67316
|
+
new_path: String$1,
|
|
67317
|
+
new_line: NullOr(Number$2),
|
|
67318
|
+
old_path: String$1,
|
|
67319
|
+
old_line: NullOr(Number$2)
|
|
67320
|
+
})
|
|
67321
|
+
)
|
|
67322
|
+
)
|
|
67323
|
+
})
|
|
67324
|
+
);
|
|
67325
|
+
const MergeRequestList = ArraySchema(Struct({ iid: Number$2 }));
|
|
67326
|
+
const User = Struct({ username: String$1 });
|
|
67327
|
+
const decodeJson = (schema2) => decodeUnknownEffect(fromJsonString(schema2));
|
|
67328
|
+
const decodeMergeRequest = decodeJson(MergeRequestJson);
|
|
67329
|
+
const decodeApprovals = decodeJson(ApprovalsJson);
|
|
67330
|
+
const decodeDiffs = decodeJson(DiffsJson);
|
|
67331
|
+
const decodeJobs = decodeJson(JobsJson);
|
|
67332
|
+
const decodeNotes = decodeJson(NotesJson);
|
|
67333
|
+
const decodeMergeRequestList = decodeJson(MergeRequestList);
|
|
67334
|
+
const decodeUser = decodeJson(User);
|
|
67335
|
+
const mergeRequestStatus = ({ state, draft }) => {
|
|
67336
|
+
if (state === "merged") return "merged";
|
|
67337
|
+
if (state === "opened") return draft ? "draft" : "open";
|
|
67338
|
+
return "closed";
|
|
67339
|
+
};
|
|
67340
|
+
const PASSING = /* @__PURE__ */ new Set(["success"]);
|
|
67341
|
+
const FAILING = /* @__PURE__ */ new Set(["failed", "canceled"]);
|
|
67342
|
+
const NOT_RUN = /* @__PURE__ */ new Set(["skipped", "manual"]);
|
|
67343
|
+
const pipelineChecks = (status) => {
|
|
67344
|
+
if (status === void 0 || NOT_RUN.has(status)) return null;
|
|
67345
|
+
if (PASSING.has(status)) return "passing";
|
|
67346
|
+
if (FAILING.has(status)) return "failing";
|
|
67347
|
+
return "pending";
|
|
67348
|
+
};
|
|
67349
|
+
const reviewOf = ({ detailed_merge_status }, approvals2) => {
|
|
67350
|
+
if (detailed_merge_status === "requested_changes") return "changesRequested";
|
|
67351
|
+
if (approvals2.approved && approvals2.approved_by.length > 0) return "approved";
|
|
67352
|
+
if (detailed_merge_status === "not_approved") return "reviewRequired";
|
|
67353
|
+
return null;
|
|
67354
|
+
};
|
|
67355
|
+
const STILL_CHECKING = /* @__PURE__ */ new Set(["checking", "unchecked", "preparing"]);
|
|
67356
|
+
const mergeableOf = ({ has_conflicts, detailed_merge_status }) => {
|
|
67357
|
+
if (has_conflicts) return "conflicting";
|
|
67358
|
+
return STILL_CHECKING.has(detailed_merge_status) ? "unknown" : "mergeable";
|
|
67359
|
+
};
|
|
67360
|
+
const diffStat = (diffs) => {
|
|
67361
|
+
let additions = 0;
|
|
67362
|
+
let deletions = 0;
|
|
67363
|
+
for (const { diff } of diffs) {
|
|
67364
|
+
for (const line of diff.split("\n")) {
|
|
67365
|
+
if (line.startsWith("+")) additions += 1;
|
|
67366
|
+
else if (line.startsWith("-")) deletions += 1;
|
|
67367
|
+
}
|
|
67368
|
+
}
|
|
67369
|
+
return { additions, deletions };
|
|
67370
|
+
};
|
|
67371
|
+
const toPullRequest = ({ url: url2, mergeRequest, approvals: approvals2, diffs }) => ({
|
|
67372
|
+
url: url2,
|
|
67373
|
+
number: mergeRequest.iid,
|
|
67374
|
+
title: mergeRequest.title,
|
|
67375
|
+
status: mergeRequestStatus(mergeRequest),
|
|
67376
|
+
checks: pipelineChecks(mergeRequest.head_pipeline?.status),
|
|
67377
|
+
review: reviewOf(mergeRequest, approvals2),
|
|
67378
|
+
mergeable: mergeableOf(mergeRequest),
|
|
67379
|
+
author: mergeRequest.author.username,
|
|
67380
|
+
headRefName: mergeRequest.source_branch,
|
|
67381
|
+
baseRefName: mergeRequest.target_branch,
|
|
67382
|
+
...diffStat(diffs),
|
|
67383
|
+
mergedAt: mergeRequest.merged_at
|
|
67384
|
+
});
|
|
67385
|
+
const jobStatus = ({ status, allow_failure }) => {
|
|
67386
|
+
if (status === "failed" && allow_failure) return "skipped";
|
|
67387
|
+
if (NOT_RUN.has(status)) return "skipped";
|
|
67388
|
+
return pipelineChecks(status) ?? "skipped";
|
|
67389
|
+
};
|
|
67390
|
+
const CHECK_RUN_ORDER = { failing: 0, pending: 1, passing: 2, skipped: 3 };
|
|
67391
|
+
const toCheckRuns = (jobs) => jobs.map((job) => ({ name: job.name, status: jobStatus(job), url: job.web_url })).toSorted((a, b) => CHECK_RUN_ORDER[a.status] - CHECK_RUN_ORDER[b.status]);
|
|
67392
|
+
const noteLocation = (position) => {
|
|
67393
|
+
if (!position) return null;
|
|
67394
|
+
if (position.new_line === null && position.old_line !== null) {
|
|
67395
|
+
return { path: position.old_path, line: position.old_line, side: "LEFT" };
|
|
67396
|
+
}
|
|
67397
|
+
return { path: position.new_path, line: position.new_line, side: "RIGHT" };
|
|
67398
|
+
};
|
|
67399
|
+
const toComments = (url2, notes, viewer) => notes.filter((note) => !note.system).map((note) => ({
|
|
67400
|
+
id: String(note.id),
|
|
67401
|
+
author: note.author.username,
|
|
67402
|
+
authorKind: note.author.bot ? "bot" : note.author.username === viewer ? "you" : "human",
|
|
67403
|
+
body: note.body,
|
|
67404
|
+
createdAt: note.created_at,
|
|
67405
|
+
url: `${url2}#note_${note.id}`,
|
|
67406
|
+
location: noteLocation(note.position)
|
|
67407
|
+
}));
|
|
67408
|
+
const toPullRequestDetail = (reads) => ({
|
|
67409
|
+
...toPullRequest(reads),
|
|
67410
|
+
body: reads.mergeRequest.description ?? "",
|
|
67411
|
+
baseRef: reads.mergeRequest.target_branch,
|
|
67412
|
+
headRef: reads.mergeRequest.source_branch,
|
|
67413
|
+
head: reads.mergeRequest.sha ?? "",
|
|
67414
|
+
checkRuns: toCheckRuns(reads.jobs),
|
|
67415
|
+
changedFiles: reads.changedFiles,
|
|
67416
|
+
comments: toComments(reads.url, reads.notes, reads.viewer),
|
|
67417
|
+
labels: [],
|
|
67418
|
+
assignees: [],
|
|
67419
|
+
reviewers: []
|
|
67420
|
+
});
|
|
67421
|
+
const GLAB_ERROR = /^glab: (?:(.*\S)\s+\()?HTTP (\d+)\)?/m;
|
|
67422
|
+
const gitLabErrorOf = (hostname2, error2) => {
|
|
67423
|
+
if (error2.exitCode === -1) return new GitLabCliMissingError();
|
|
67424
|
+
const http = GLAB_ERROR.exec(error2.stderr);
|
|
67425
|
+
if (!http) return error2;
|
|
67426
|
+
const [, detail, status] = http;
|
|
67427
|
+
if (status === "401") return new GitLabSignedOutError({ hostname: hostname2 });
|
|
67428
|
+
return new GitLabApiError({ detail: detail ?? `HTTP ${status}` });
|
|
67429
|
+
};
|
|
67430
|
+
const mergeRequestUrlIn = (output) => {
|
|
67431
|
+
const mergeRequest = output.split(/\s+/).map(parseGitLabMergeRequestUrl).find((parsed) => parsed !== void 0);
|
|
67432
|
+
return mergeRequest && gitLabMergeRequestUrl(mergeRequest);
|
|
67433
|
+
};
|
|
67434
|
+
const GLAB_TIMEOUT = "1 minute";
|
|
67435
|
+
const PROBE_TIMEOUT = "10 seconds";
|
|
67436
|
+
const projectApi = ({ path: path2 }) => `projects/${encodeURIComponent(path2)}`;
|
|
67437
|
+
const mergeRequestApi = (mergeRequest) => `${projectApi(mergeRequest)}/merge_requests/${mergeRequest.iid}`;
|
|
67438
|
+
const requireMergeRequest = (raw2) => {
|
|
67439
|
+
const mergeRequest = parseGitLabMergeRequestUrl(raw2.trim());
|
|
67440
|
+
return mergeRequest ? succeed$1(mergeRequest) : fail$2(new PullRequestUrlInvalidError({ url: raw2 }));
|
|
67441
|
+
};
|
|
67442
|
+
const make$Z = gen(function* () {
|
|
67443
|
+
const exec2 = makeExec(yield* ChildProcessSpawner);
|
|
67444
|
+
const events2 = yield* Events;
|
|
67445
|
+
const glab = (hostname2, cwd, args, options) => exec2("glab", args, cwd, { timeout: GLAB_TIMEOUT, ...options, env: { NO_COLOR: "1" } }).pipe(
|
|
67446
|
+
mapError((error2) => gitLabErrorOf(hostname2, error2))
|
|
67447
|
+
);
|
|
67448
|
+
const api2 = (hostname2, args, options) => glab(hostname2, homedir(), ["api", "--hostname", hostname2, ...args], options);
|
|
67449
|
+
const hostAnswers = /* @__PURE__ */ new Map([
|
|
67450
|
+
["gitlab.com", true],
|
|
67451
|
+
["github.com", false]
|
|
67452
|
+
]);
|
|
67453
|
+
const isGitLabHost = (hostname2) => {
|
|
67454
|
+
const known = hostAnswers.get(hostname2);
|
|
67455
|
+
if (known !== void 0) return succeed$1(known);
|
|
67456
|
+
return api2(hostname2, ["version"], { timeout: PROBE_TIMEOUT }).pipe(
|
|
67457
|
+
as(true),
|
|
67458
|
+
catchTag("GitLabSignedOutError", () => succeed$1(true)),
|
|
67459
|
+
orElseSucceed(() => false),
|
|
67460
|
+
tap$1((answer) => sync(() => hostAnswers.set(hostname2, answer)))
|
|
67461
|
+
);
|
|
67462
|
+
};
|
|
67463
|
+
const viewers = /* @__PURE__ */ new Map();
|
|
67464
|
+
const viewer = (hostname2) => {
|
|
67465
|
+
if (viewers.has(hostname2)) return succeed$1(viewers.get(hostname2) ?? null);
|
|
67466
|
+
return api2(hostname2, ["user"]).pipe(
|
|
67467
|
+
flatMap(decodeUser),
|
|
67468
|
+
map$2((user) => user.username),
|
|
67469
|
+
orElseSucceed(() => null),
|
|
67470
|
+
tap$1((username) => sync(() => viewers.set(hostname2, username)))
|
|
67471
|
+
);
|
|
67472
|
+
};
|
|
67473
|
+
const readMergeRequest = (mergeRequest) => api2(mergeRequest.hostname, [mergeRequestApi(mergeRequest)]).pipe(flatMap(decodeMergeRequest));
|
|
67474
|
+
const readDiffs = (mergeRequest) => api2(mergeRequest.hostname, ["--include", `${mergeRequestApi(mergeRequest)}/diffs?per_page=100`]).pipe(
|
|
67475
|
+
flatMap((stdout) => {
|
|
67476
|
+
const { headers: headers2, body: body2 } = parseApiResponse(stdout);
|
|
67477
|
+
return map$2(decodeDiffs(body2), (diffs) => ({
|
|
67478
|
+
diffs,
|
|
67479
|
+
changedFiles: Number(headers2.get("x-total")) || diffs.length
|
|
67480
|
+
}));
|
|
67481
|
+
})
|
|
67482
|
+
);
|
|
67483
|
+
const readSummary = (mergeRequest) => all$1(
|
|
67484
|
+
{
|
|
67485
|
+
mergeRequest: readMergeRequest(mergeRequest),
|
|
67486
|
+
approvals: api2(mergeRequest.hostname, [`${mergeRequestApi(mergeRequest)}/approvals`]).pipe(
|
|
67487
|
+
flatMap(decodeApprovals)
|
|
67488
|
+
),
|
|
67489
|
+
diffs: readDiffs(mergeRequest)
|
|
67490
|
+
},
|
|
67491
|
+
{ concurrency: "unbounded" }
|
|
67492
|
+
);
|
|
67493
|
+
const pullRequestOf = (mergeRequest) => map$2(
|
|
67494
|
+
readSummary(mergeRequest),
|
|
67495
|
+
({ diffs, ...reads }) => toPullRequest({ ...reads, diffs: diffs.diffs, url: gitLabMergeRequestUrl(mergeRequest) })
|
|
67496
|
+
);
|
|
67497
|
+
const readJobs = (hostname2, project2, pipeline2) => pipeline2 ? api2(hostname2, [`${projectApi(project2)}/pipelines/${pipeline2.id}/jobs?per_page=100`]).pipe(
|
|
67498
|
+
flatMap(decodeJobs)
|
|
67499
|
+
) : succeed$1([]);
|
|
67500
|
+
const readNotes = (mergeRequest) => api2(mergeRequest.hostname, [`${mergeRequestApi(mergeRequest)}/notes?sort=asc&per_page=100`]).pipe(
|
|
67501
|
+
flatMap(decodeNotes),
|
|
67502
|
+
catchTag("GitLabSignedOutError", () => succeed$1([]))
|
|
67503
|
+
);
|
|
67504
|
+
const pullRequestDetail = (url2) => gen(function* () {
|
|
67505
|
+
const mergeRequest = yield* requireMergeRequest(url2);
|
|
67506
|
+
const [summary2, notes, signedIn] = yield* all$1(
|
|
67507
|
+
[readSummary(mergeRequest), readNotes(mergeRequest), viewer(mergeRequest.hostname)],
|
|
67508
|
+
{ concurrency: "unbounded" }
|
|
67509
|
+
);
|
|
67510
|
+
const jobs = yield* readJobs(mergeRequest.hostname, mergeRequest, summary2.mergeRequest.head_pipeline);
|
|
67511
|
+
return toPullRequestDetail({
|
|
67512
|
+
url: gitLabMergeRequestUrl(mergeRequest),
|
|
67513
|
+
mergeRequest: summary2.mergeRequest,
|
|
67514
|
+
approvals: summary2.approvals,
|
|
67515
|
+
diffs: summary2.diffs.diffs,
|
|
67516
|
+
changedFiles: summary2.diffs.changedFiles,
|
|
67517
|
+
jobs,
|
|
67518
|
+
notes,
|
|
67519
|
+
viewer: signedIn
|
|
67520
|
+
});
|
|
67521
|
+
});
|
|
67522
|
+
const mutate2 = (url2, args) => gen(function* () {
|
|
67523
|
+
const mergeRequest = yield* requireMergeRequest(url2);
|
|
67524
|
+
yield* api2(mergeRequest.hostname, args(mergeRequest));
|
|
67525
|
+
yield* events2.publish({ type: "github.pullRequest", url: gitLabMergeRequestUrl(mergeRequest) });
|
|
67526
|
+
});
|
|
67527
|
+
return GitLab.of({
|
|
67528
|
+
installed: promise$1(() => findBinary("glab")).pipe(map$2((path2) => path2 !== void 0)),
|
|
67529
|
+
isGitLabHost,
|
|
67530
|
+
pullRequest: (url2) => flatMap(requireMergeRequest(url2), pullRequestOf),
|
|
67531
|
+
pullRequestOpenedAt: (url2) => requireMergeRequest(url2).pipe(
|
|
67532
|
+
flatMap(readMergeRequest),
|
|
67533
|
+
map$2((mergeRequest) => mergeRequest.created_at)
|
|
67534
|
+
),
|
|
67535
|
+
pullRequestDetail,
|
|
67536
|
+
merge: (url2, method2) => method2 === "rebase" ? fail$2(new GitLabMergeMethodError()) : mutate2(url2, (mergeRequest) => [
|
|
67537
|
+
"-X",
|
|
67538
|
+
"PUT",
|
|
67539
|
+
`${mergeRequestApi(mergeRequest)}/merge`,
|
|
67540
|
+
...method2 === "squash" ? ["-f", "squash=true"] : []
|
|
67541
|
+
]),
|
|
67542
|
+
close: (url2) => mutate2(url2, (mergeRequest) => ["-X", "PUT", mergeRequestApi(mergeRequest), "-f", "state_event=close"]),
|
|
67543
|
+
comment: (url2, body2) => mutate2(url2, (mergeRequest) => ["-X", "POST", `${mergeRequestApi(mergeRequest)}/notes`, "-f", `body=${body2}`]),
|
|
67544
|
+
branchPullRequest: (project2, branch) => gen(function* () {
|
|
67545
|
+
const query = new URLSearchParams({
|
|
67546
|
+
source_branch: branch,
|
|
67547
|
+
state: "all",
|
|
67548
|
+
order_by: "created_at",
|
|
67549
|
+
sort: "desc",
|
|
67550
|
+
per_page: "1"
|
|
67551
|
+
});
|
|
67552
|
+
const [latest] = yield* api2(project2.hostname, [`${projectApi(project2)}/merge_requests?${query}`]).pipe(
|
|
67553
|
+
flatMap(decodeMergeRequestList)
|
|
67554
|
+
);
|
|
67555
|
+
return latest ? yield* pullRequestOf({ ...project2, iid: latest.iid }) : null;
|
|
67556
|
+
}),
|
|
67557
|
+
createPullRequest: (project2, cwd, { head: head2, base }) => gen(function* () {
|
|
67558
|
+
const output = yield* glab(
|
|
67559
|
+
project2.hostname,
|
|
67560
|
+
cwd,
|
|
67561
|
+
["mr", "create", "--source-branch", head2, "--target-branch", base, "--fill", "--yes"],
|
|
67562
|
+
{ timeout: LONG_TIMEOUT }
|
|
67563
|
+
);
|
|
67564
|
+
const url2 = mergeRequestUrlIn(output);
|
|
67565
|
+
if (url2 === void 0) {
|
|
67566
|
+
return yield* new GitLabApiError({ detail: `glab mr create printed no merge request URL: ${output.trim()}` });
|
|
67567
|
+
}
|
|
67568
|
+
return url2;
|
|
67569
|
+
})
|
|
67570
|
+
});
|
|
67571
|
+
});
|
|
67572
|
+
const layer$H = effect(GitLab, make$Z);
|
|
67573
|
+
const requirePullRequestUrl = (raw2) => {
|
|
67574
|
+
const parsed = parsePullRequestUrl(raw2);
|
|
67575
|
+
return parsed === void 0 ? fail$2(new PullRequestUrlInvalidError({ url: raw2 })) : succeed$1(parsed.url);
|
|
67576
|
+
};
|
|
67577
|
+
class SourceControl extends Service$1()("hinacode/SourceControl") {
|
|
67578
|
+
}
|
|
67579
|
+
const hostOfUrl = (url2) => {
|
|
67580
|
+
const parsed = parsePullRequestUrl(url2);
|
|
67581
|
+
return parsed === void 0 ? fail$2(new PullRequestUrlInvalidError({ url: url2 })) : succeed$1(parsed.host);
|
|
67582
|
+
};
|
|
67583
|
+
const byUrl = (url2, onGitHub, onGitLab) => flatMap(
|
|
67584
|
+
hostOfUrl(url2),
|
|
67585
|
+
(host) => host === "gitlab" ? onGitLab() : onGitHub()
|
|
67586
|
+
);
|
|
67587
|
+
const make$Y = gen(function* () {
|
|
67588
|
+
const git2 = yield* Git;
|
|
67589
|
+
const github = yield* GitHub;
|
|
67590
|
+
const gitlab = yield* GitLab;
|
|
67591
|
+
const repository = (cwd) => gen(function* () {
|
|
67592
|
+
const origin = yield* git2.run(cwd, ["remote", "get-url", "origin"]).pipe(
|
|
67593
|
+
map$2((stdout) => parseRemote(stdout)),
|
|
67594
|
+
orElseSucceed(() => void 0)
|
|
67595
|
+
);
|
|
67596
|
+
if (origin === void 0 || origin.hostname === "github.com") return { host: "github" };
|
|
67597
|
+
return (yield* gitlab.isGitLabHost(origin.hostname)) ? { host: "gitlab", project: origin } : { host: "github" };
|
|
67598
|
+
});
|
|
67599
|
+
return SourceControl.of({
|
|
67600
|
+
installedFor: (url2) => {
|
|
67601
|
+
const host = parsePullRequestUrl(url2)?.host;
|
|
67602
|
+
if (host === void 0) return succeed$1(false);
|
|
67603
|
+
return host === "gitlab" ? gitlab.installed : github.installed;
|
|
67604
|
+
},
|
|
67605
|
+
pullRequest: (url2) => byUrl(
|
|
67606
|
+
url2,
|
|
67607
|
+
() => github.pullRequest(url2),
|
|
67608
|
+
() => gitlab.pullRequest(url2)
|
|
67609
|
+
),
|
|
67610
|
+
pullRequestOpenedAt: (url2) => byUrl(
|
|
67611
|
+
url2,
|
|
67612
|
+
() => github.pullRequestOpenedAt(url2),
|
|
67613
|
+
() => gitlab.pullRequestOpenedAt(url2)
|
|
67614
|
+
),
|
|
67615
|
+
pullRequestDetail: (url2, options) => byUrl(
|
|
67616
|
+
url2,
|
|
67617
|
+
() => github.pullRequestDetail(url2, options),
|
|
67618
|
+
() => gitlab.pullRequestDetail(url2)
|
|
67619
|
+
),
|
|
67620
|
+
merge: (url2, method2) => byUrl(
|
|
67621
|
+
url2,
|
|
67622
|
+
() => github.merge(url2, method2),
|
|
67623
|
+
() => gitlab.merge(url2, method2)
|
|
67624
|
+
),
|
|
67625
|
+
close: (url2) => byUrl(
|
|
67626
|
+
url2,
|
|
67627
|
+
() => github.close(url2),
|
|
67628
|
+
() => gitlab.close(url2)
|
|
67629
|
+
),
|
|
67630
|
+
comment: (url2, body2) => byUrl(
|
|
67631
|
+
url2,
|
|
67632
|
+
() => github.comment(url2, body2),
|
|
67633
|
+
() => gitlab.comment(url2, body2)
|
|
67634
|
+
),
|
|
67635
|
+
branchPullRequest: (cwd, branch) => flatMap(
|
|
67636
|
+
repository(cwd),
|
|
67637
|
+
(repo) => repo.host === "gitlab" ? gitlab.branchPullRequest(repo.project, branch) : github.branchPullRequest(cwd, branch)
|
|
67638
|
+
),
|
|
67639
|
+
createPullRequest: (cwd, branches) => flatMap(
|
|
67640
|
+
repository(cwd),
|
|
67641
|
+
(repo) => repo.host === "gitlab" ? gitlab.createPullRequest(repo.project, cwd, branches) : github.createPullRequest(cwd, branches)
|
|
67642
|
+
)
|
|
67643
|
+
});
|
|
67644
|
+
});
|
|
67645
|
+
const layer$G = effect(SourceControl, make$Y).pipe(provide$2(layer$H));
|
|
67028
67646
|
const PLACEHOLDER = /\{\{\s*([\w$-]+(?:\.[\w$-]+)*)\s*\}\}/g;
|
|
67029
67647
|
const lookup$1 = (payload, path2) => path2.split(".").reduce(
|
|
67030
67648
|
(value2, key2) => typeof value2 === "object" && value2 !== null ? Reflect.get(value2, key2) : void 0,
|
|
@@ -67105,7 +67723,7 @@ const make$X = gen(function* () {
|
|
|
67105
67723
|
}),
|
|
67106
67724
|
orElseSucceed(() => void 0)
|
|
67107
67725
|
);
|
|
67108
|
-
const repositories = yield* make$
|
|
67726
|
+
const repositories = yield* make$1j({ lookup: repositoryOf, capacity: 256 });
|
|
67109
67727
|
const ensureDirectory = (rootPath) => fs2.stat(rootPath).pipe(
|
|
67110
67728
|
filterOrFail(
|
|
67111
67729
|
(info) => info.type === "Directory",
|
|
@@ -67739,7 +68357,7 @@ const make$V = fnUntraced(function* (setupTimeout) {
|
|
|
67739
68357
|
const sql = yield* SqlClient;
|
|
67740
68358
|
const projects = yield* Projects;
|
|
67741
68359
|
const git2 = yield* Git;
|
|
67742
|
-
const
|
|
68360
|
+
const sourceControl = yield* SourceControl;
|
|
67743
68361
|
const events2 = yield* Events;
|
|
67744
68362
|
const spawner = yield* ChildProcessSpawner;
|
|
67745
68363
|
const fs2 = yield* FileSystem;
|
|
@@ -67828,7 +68446,7 @@ const make$V = fnUntraced(function* (setupTimeout) {
|
|
|
67828
68446
|
return -1;
|
|
67829
68447
|
}
|
|
67830
68448
|
const handle = yield* spawner.spawn(
|
|
67831
|
-
make$
|
|
68449
|
+
make$1x(shell, ["-lc", script], {
|
|
67832
68450
|
cwd: worktree.path,
|
|
67833
68451
|
env: {
|
|
67834
68452
|
HINACODE_ROOT_PATH: project2.rootPath,
|
|
@@ -68008,16 +68626,16 @@ Setup script exited with code ${exitCode}
|
|
|
68008
68626
|
return yield* new WorktreeBusyError({ path: worktree.path, reason: "shared" });
|
|
68009
68627
|
}
|
|
68010
68628
|
});
|
|
68011
|
-
const
|
|
68012
|
-
const pullRequest2 = yield*
|
|
68629
|
+
const mergedOnHost = (rootPath, branch) => gen(function* () {
|
|
68630
|
+
const pullRequest2 = yield* sourceControl.branchPullRequest(rootPath, branch);
|
|
68013
68631
|
if (pullRequest2?.status !== "merged") return false;
|
|
68014
|
-
const { head: head2 } = yield*
|
|
68632
|
+
const { head: head2 } = yield* sourceControl.pullRequestDetail(pullRequest2.url);
|
|
68015
68633
|
yield* git2.run(rootPath, ["merge-base", "--is-ancestor", `refs/heads/${branch}`, head2]);
|
|
68016
68634
|
return true;
|
|
68017
68635
|
}).pipe(orElseSucceed(() => false));
|
|
68018
68636
|
const deleteIfMerged = (rootPath, worktree) => gen(function* () {
|
|
68019
68637
|
if (!(yield* branchExists(rootPath, worktree.branch))) return;
|
|
68020
|
-
const merged = (yield* isMerged(rootPath, worktree.branch, worktree.baseRef)) || (yield*
|
|
68638
|
+
const merged = (yield* isMerged(rootPath, worktree.branch, worktree.baseRef)) || (yield* mergedOnHost(rootPath, worktree.branch));
|
|
68021
68639
|
if (merged) yield* git2.run(rootPath, ["branch", "-D", worktree.branch]);
|
|
68022
68640
|
});
|
|
68023
68641
|
const pruneMergedBranches = (rootPath, projectId) => gen(function* () {
|
|
@@ -68093,7 +68711,7 @@ Setup script exited with code ${exitCode}
|
|
|
68093
68711
|
const pullRequest = (id2) => gen(function* () {
|
|
68094
68712
|
const worktree = yield* get2(id2);
|
|
68095
68713
|
const { rootPath } = yield* projects.get(worktree.projectId);
|
|
68096
|
-
return yield*
|
|
68714
|
+
return yield* sourceControl.branchPullRequest(rootPath, worktree.branch);
|
|
68097
68715
|
});
|
|
68098
68716
|
const currentBranch2 = (projectId) => projects.get(projectId).pipe(
|
|
68099
68717
|
flatMap(({ rootPath }) => git2.run(rootPath, ["rev-parse", "--abbrev-ref", "HEAD"])),
|
|
@@ -68127,7 +68745,7 @@ Setup script exited with code ${exitCode}
|
|
|
68127
68745
|
)
|
|
68128
68746
|
)
|
|
68129
68747
|
);
|
|
68130
|
-
const fetches = yield* make$
|
|
68748
|
+
const fetches = yield* make$1j({
|
|
68131
68749
|
lookup: (rootPath) => git2.remote(rootPath, ["fetch", "--quiet", "origin"]).pipe(andThen(currentTimeMillis)),
|
|
68132
68750
|
capacity: 64,
|
|
68133
68751
|
timeToLive: FETCH_INTERVAL
|
|
@@ -68493,7 +69111,7 @@ const make$U = gen(function* () {
|
|
|
68493
69111
|
pinnedAt: settling ? null : input.pinned === void 0 ? current.pinnedAt : input.pinned ? current.pinnedAt ?? now2 : null,
|
|
68494
69112
|
snoozedUntil: settling ? null : input.snoozedUntil !== void 0 ? input.snoozedUntil : arranges ? current.snoozedUntil : null,
|
|
68495
69113
|
settledAt: settling ? now2 : reopening || input.pinned === true || input.status !== void 0 && startsWork(current.status, input.status) ? null : current.settledAt,
|
|
68496
|
-
providerSessionId: input.provider !== void 0 && input.provider !== current.provider ? null : input.providerSessionId
|
|
69114
|
+
providerSessionId: input.provider !== void 0 && input.provider !== current.provider ? null : input.providerSessionId === void 0 ? current.providerSessionId : input.providerSessionId,
|
|
68497
69115
|
forkedFrom: input.providerSessionId !== void 0 || (input.provider ?? current.provider) !== current.provider ? null : current.forkedFrom,
|
|
68498
69116
|
queue: input.queue ?? current.queue,
|
|
68499
69117
|
scheduled: input.scheduled ?? current.scheduled,
|
|
@@ -68650,7 +69268,16 @@ const make$U = gen(function* () {
|
|
|
68650
69268
|
const unarchive = (id2) => gen(function* () {
|
|
68651
69269
|
const thread2 = yield* get2(id2);
|
|
68652
69270
|
yield* syncChatFolder(thread2, true);
|
|
68653
|
-
|
|
69271
|
+
const now2 = yield* nowIso;
|
|
69272
|
+
yield* sql`
|
|
69273
|
+
UPDATE thread
|
|
69274
|
+
SET status = 'idle', usage_limit = NULL, snoozed_until = NULL, settled_at = NULL,
|
|
69275
|
+
work_started_at = ${now2}, updated_at = ${now2}
|
|
69276
|
+
WHERE id = ${id2} AND status = 'archived'
|
|
69277
|
+
`.pipe(mapError(persistence("threads.unarchive")));
|
|
69278
|
+
const reopened = yield* get2(id2);
|
|
69279
|
+
yield* publish(written, reopened);
|
|
69280
|
+
return reopened;
|
|
68654
69281
|
});
|
|
68655
69282
|
const settle2 = (id2) => gen(function* () {
|
|
68656
69283
|
const thread2 = yield* get2(id2);
|
|
@@ -68658,6 +69285,13 @@ const make$U = gen(function* () {
|
|
|
68658
69285
|
if (thread2.status === "archived") return thread2;
|
|
68659
69286
|
return yield* write(thread2, { id: id2, settled: true });
|
|
68660
69287
|
});
|
|
69288
|
+
const settleIf = (id2, stillDue) => worktrees.exclusive(
|
|
69289
|
+
gen(function* () {
|
|
69290
|
+
const thread2 = yield* get2(id2);
|
|
69291
|
+
if (!stillDue(thread2)) return none();
|
|
69292
|
+
return some(yield* write(thread2, { id: id2, settled: true }));
|
|
69293
|
+
})
|
|
69294
|
+
);
|
|
68661
69295
|
const settleMerged = (id2, stillDue) => worktrees.exclusive(
|
|
68662
69296
|
gen(function* () {
|
|
68663
69297
|
const isDue2 = gen(function* () {
|
|
@@ -68712,6 +69346,7 @@ const make$U = gen(function* () {
|
|
|
68712
69346
|
archiveIf,
|
|
68713
69347
|
unarchive,
|
|
68714
69348
|
settle: settle2,
|
|
69349
|
+
settleIf,
|
|
68715
69350
|
settleMerged,
|
|
68716
69351
|
unsettle,
|
|
68717
69352
|
workStartedAt,
|
|
@@ -68742,7 +69377,7 @@ const make$T = gen(function* () {
|
|
|
68742
69377
|
const threads = yield* Threads;
|
|
68743
69378
|
const worktrees = yield* Worktrees;
|
|
68744
69379
|
const git2 = yield* Git;
|
|
68745
|
-
const
|
|
69380
|
+
const sourceControl = yield* SourceControl;
|
|
68746
69381
|
const encodeRow = encodeEffect(LinkRow);
|
|
68747
69382
|
const encodeWatch = encodeEffect(NullOr(fromJsonString(PullRequestWatch)));
|
|
68748
69383
|
const findByThread = findAll({
|
|
@@ -68808,7 +69443,7 @@ const make$T = gen(function* () {
|
|
|
68808
69443
|
return url2;
|
|
68809
69444
|
});
|
|
68810
69445
|
const unlink = (threadId, raw2) => gen(function* () {
|
|
68811
|
-
const url2 =
|
|
69446
|
+
const url2 = parsePullRequestUrl(raw2)?.url ?? raw2;
|
|
68812
69447
|
yield* sql`DELETE FROM pull_request_link WHERE thread_id = ${threadId} AND url = ${url2}`.pipe(
|
|
68813
69448
|
mapError(persistence("pullRequests.unlink"))
|
|
68814
69449
|
);
|
|
@@ -68822,11 +69457,11 @@ const make$T = gen(function* () {
|
|
|
68822
69457
|
yield* broadcast(current.threadId);
|
|
68823
69458
|
return { ...current, watch: watch22 };
|
|
68824
69459
|
});
|
|
68825
|
-
const
|
|
69460
|
+
const byUrl2 = (threadId, url2) => map$2(list(threadId), (links) => links.find((candidate) => candidate.url === url2) ?? null);
|
|
68826
69461
|
const watch2 = (threadId, raw2, requested = []) => gen(function* () {
|
|
68827
69462
|
const url2 = yield* requirePullRequestUrl(raw2);
|
|
68828
69463
|
yield* link(threadId, url2);
|
|
68829
|
-
const current = yield*
|
|
69464
|
+
const current = yield* byUrl2(threadId, url2);
|
|
68830
69465
|
if (current === null) {
|
|
68831
69466
|
return yield* die(new Error(`pull request link for ${url2} vanished right after linking`));
|
|
68832
69467
|
}
|
|
@@ -68842,8 +69477,8 @@ const make$T = gen(function* () {
|
|
|
68842
69477
|
});
|
|
68843
69478
|
});
|
|
68844
69479
|
const unwatch = (threadId, raw2) => gen(function* () {
|
|
68845
|
-
const url2 =
|
|
68846
|
-
const current = yield*
|
|
69480
|
+
const url2 = parsePullRequestUrl(raw2)?.url ?? raw2;
|
|
69481
|
+
const current = yield* byUrl2(threadId, url2);
|
|
68847
69482
|
if (current === null || current.watch === null) return;
|
|
68848
69483
|
yield* setWatch(current, null);
|
|
68849
69484
|
});
|
|
@@ -68865,7 +69500,7 @@ const make$T = gen(function* () {
|
|
|
68865
69500
|
const worktree = yield* worktrees.get(worktreeId);
|
|
68866
69501
|
if (worktree.status !== "ready") return yield* new NoBranchError({ threadId });
|
|
68867
69502
|
yield* git2.run(worktree.path, ["push", "--set-upstream", "origin", worktree.branch], { timeout: LONG_TIMEOUT });
|
|
68868
|
-
const url2 = yield*
|
|
69503
|
+
const url2 = yield* sourceControl.createPullRequest(worktree.path, {
|
|
68869
69504
|
head: worktree.branch,
|
|
68870
69505
|
base: worktree.baseRef.replace(/^origin\//, "")
|
|
68871
69506
|
});
|
|
@@ -68886,7 +69521,7 @@ const make$T = gen(function* () {
|
|
|
68886
69521
|
create
|
|
68887
69522
|
});
|
|
68888
69523
|
});
|
|
68889
|
-
const layer$A = effect(PullRequests, make$T).pipe(provideMerge(layer$
|
|
69524
|
+
const layer$A = effect(PullRequests, make$T).pipe(provideMerge(layer$J));
|
|
68890
69525
|
const isInside = (root2, path2) => {
|
|
68891
69526
|
const inside = relative(root2, path2);
|
|
68892
69527
|
return isAbsolute(path2) && inside !== ".." && !inside.startsWith(`..${sep}`) && !isAbsolute(inside);
|
|
@@ -68995,7 +69630,7 @@ const suggest$1 = (model, prompt) => gen(function* () {
|
|
|
68995
69630
|
try: async (signal2) => {
|
|
68996
69631
|
const abortController = new AbortController();
|
|
68997
69632
|
signal2.addEventListener("abort", () => abortController.abort());
|
|
68998
|
-
const { query } = await import("./chunks/sdk-
|
|
69633
|
+
const { query } = await import("./chunks/sdk-DZclv7I1.js");
|
|
68999
69634
|
const stream2 = query({
|
|
69000
69635
|
prompt: `<messages>
|
|
69001
69636
|
${firstAndLatest(prompt)}
|
|
@@ -69016,6 +69651,7 @@ ${firstAndLatest(prompt)}
|
|
|
69016
69651
|
for await (const message2 of stream2) {
|
|
69017
69652
|
if (message2.type !== "result") continue;
|
|
69018
69653
|
if (message2.subtype !== "success") throw new Error(message2.errors.join("\n") || message2.subtype);
|
|
69654
|
+
if (message2.is_error) throw new Error(message2.result || "Claude Code returned an error");
|
|
69019
69655
|
return message2.structured_output;
|
|
69020
69656
|
}
|
|
69021
69657
|
throw new Error("Claude Code ended without a result");
|
|
@@ -69184,7 +69820,7 @@ const make$R = gen(function* () {
|
|
|
69184
69820
|
subagentChoices(listed, settingsValue.modelPresets, enabledProviders(settingsValue))
|
|
69185
69821
|
);
|
|
69186
69822
|
});
|
|
69187
|
-
const cachedLimits = yield* make$
|
|
69823
|
+
const cachedLimits = yield* make$1j({
|
|
69188
69824
|
lookup: (key2) => {
|
|
69189
69825
|
const { provider, accountId } = JSON.parse(key2);
|
|
69190
69826
|
return accounts.home(accountId).pipe(
|
|
@@ -69196,8 +69832,8 @@ const make$R = gen(function* () {
|
|
|
69196
69832
|
capacity: 64,
|
|
69197
69833
|
timeToLive: minutes(1)
|
|
69198
69834
|
});
|
|
69199
|
-
const turns = yield* make$
|
|
69200
|
-
const deliveries = yield* make$
|
|
69835
|
+
const turns = yield* make$1h();
|
|
69836
|
+
const deliveries = yield* make$1h();
|
|
69201
69837
|
const busyThreads = /* @__PURE__ */ new Set();
|
|
69202
69838
|
const pendingSends = /* @__PURE__ */ new Map();
|
|
69203
69839
|
const pendingScheduledSends = /* @__PURE__ */ new Map();
|
|
@@ -69386,6 +70022,8 @@ const make$R = gen(function* () {
|
|
|
69386
70022
|
if (event.type === "session_bound" && event.providerSessionId !== thread2.providerSessionId) {
|
|
69387
70023
|
yield* updateThread({ id: thread2.id, providerSessionId: event.providerSessionId });
|
|
69388
70024
|
}
|
|
70025
|
+
if (event.type === "turn_failed" && event.sessionLost)
|
|
70026
|
+
yield* updateThread({ id: thread2.id, providerSessionId: null });
|
|
69389
70027
|
if (event.type === "turn_completed" || event.type === "turn_failed") completed = event.type === "turn_completed";
|
|
69390
70028
|
const resolvedStatus = statusAfter(event);
|
|
69391
70029
|
const nextStatus = resolvedStatus === "running" && waitsOnUser(thread2.id) ? "awaiting_approval" : resolvedStatus;
|
|
@@ -69422,6 +70060,7 @@ const make$R = gen(function* () {
|
|
|
69422
70060
|
}
|
|
69423
70061
|
}).pipe(catch_((error2) => logWarning("held message did not steer", error2)));
|
|
69424
70062
|
const steer = (text2, attachments2, when2) => gen(function* () {
|
|
70063
|
+
if (finishing) return "finished";
|
|
69425
70064
|
if (provider.steer === void 0 || !(yield* when2)) return false;
|
|
69426
70065
|
if (!waitsOnUser(thread2.id)) {
|
|
69427
70066
|
yield* steerTurn(text2, attachments2, "now");
|
|
@@ -69572,6 +70211,7 @@ const make$R = gen(function* () {
|
|
|
69572
70211
|
const provider = providers[request2.provider];
|
|
69573
70212
|
const sameProvider = request2.provider === thread2.provider;
|
|
69574
70213
|
const model = yield* subagentModel(request2, sameProvider ? thread2.model : null);
|
|
70214
|
+
const effort = request2.effort ?? (yield* provider.listModels.pipe(orElseSucceed(() => []))).find((listed) => listed.id === model)?.defaultEffort;
|
|
69575
70215
|
const workspace = yield* activeWorkspace(threadId);
|
|
69576
70216
|
const [home, environment2, mcpServer, { experimental: experimental2, autoCompactTokens }, startedAt2] = yield* all$1([
|
|
69577
70217
|
accounts.home(sameProvider ? thread2.accountId : null),
|
|
@@ -69587,6 +70227,8 @@ const make$R = gen(function* () {
|
|
|
69587
70227
|
let subagent2 = {
|
|
69588
70228
|
id: id2,
|
|
69589
70229
|
provider: request2.provider,
|
|
70230
|
+
model,
|
|
70231
|
+
...effort && { effort },
|
|
69590
70232
|
label: request2.description,
|
|
69591
70233
|
callId,
|
|
69592
70234
|
status: "running",
|
|
@@ -69708,7 +70350,8 @@ const make$R = gen(function* () {
|
|
|
69708
70350
|
if (thread2.providerSessionId !== null) return prompt;
|
|
69709
70351
|
if (thread2.sideOf !== null) {
|
|
69710
70352
|
const unseen = unseenSince(yield* liveMessages(thread2.sideOf), thread2.forkedFrom);
|
|
69711
|
-
|
|
70353
|
+
const history2 = yield* messages.list(thread2.id);
|
|
70354
|
+
return sidechatPrompt({ history: history2, unseen, prompt });
|
|
69712
70355
|
}
|
|
69713
70356
|
if (thread2.forkedFrom !== null) return prompt;
|
|
69714
70357
|
const history = yield* messages.list(thread2.id);
|
|
@@ -69858,10 +70501,16 @@ const make$R = gen(function* () {
|
|
|
69858
70501
|
)
|
|
69859
70502
|
)
|
|
69860
70503
|
);
|
|
69861
|
-
const steerWhen = (
|
|
70504
|
+
const steerWhen = (input) => suspend(() => {
|
|
70505
|
+
const { threadId, text: text2, attachments: attachments2, when: when2 } = input;
|
|
69862
70506
|
const turn = activeTurns.get(threadId);
|
|
69863
70507
|
if (turn === void 0) return sendWhen(threadId, text2, attachments2, {}, when2);
|
|
69864
|
-
if (turn.provider.steer !== void 0)
|
|
70508
|
+
if (turn.provider.steer !== void 0) {
|
|
70509
|
+
return flatMap(
|
|
70510
|
+
turn.steer(text2, attachments2, when2),
|
|
70511
|
+
(steered) => steered === "finished" ? steerWhen(input) : succeed$1(steered)
|
|
70512
|
+
);
|
|
70513
|
+
}
|
|
69865
70514
|
return flatMap(
|
|
69866
70515
|
when2,
|
|
69867
70516
|
(ready) => ready ? as(queue(threadId, text2, attachments2), true) : succeed$1(false)
|
|
@@ -70298,6 +70947,7 @@ const make$R = gen(function* () {
|
|
|
70298
70947
|
})
|
|
70299
70948
|
)
|
|
70300
70949
|
),
|
|
70950
|
+
isBusy: (threadId) => sync(() => isBusy(threadId)),
|
|
70301
70951
|
release: release2,
|
|
70302
70952
|
warm,
|
|
70303
70953
|
setAccessMode: (threadId, accessMode) => gen(function* () {
|
|
@@ -70624,11 +71274,14 @@ const make$P = gen(function* () {
|
|
|
70624
71274
|
const { store: store2 } = yield* Artifacts;
|
|
70625
71275
|
const runner = yield* AgentRunner;
|
|
70626
71276
|
const threads = yield* Threads;
|
|
71277
|
+
const events2 = yield* Events;
|
|
70627
71278
|
const existing2 = (id2) => flatMap(
|
|
70628
71279
|
promise$1(() => store2.get(id2)),
|
|
70629
71280
|
(artifact2) => artifact2 === null ? fail$2(new NotFoundError({ entity: "artifact", id: id2 })) : succeed$1(artifact2)
|
|
70630
71281
|
);
|
|
71282
|
+
const reopenArchived = (thread2) => thread2.status === "archived" ? threads.unarchive(thread2.id).pipe(flatMap((reopened) => events2.publish({ type: "thread.updated", thread: reopened }))) : void_;
|
|
70631
71283
|
const deliver = (threadId, prompt, attachments) => threads.get(threadId).pipe(
|
|
71284
|
+
flatMap(reopenArchived),
|
|
70632
71285
|
andThen(
|
|
70633
71286
|
runner.steer(threadId, prompt, attachments).pipe(catchTag("AgentError", () => runner.queue(threadId, prompt, attachments)))
|
|
70634
71287
|
),
|
|
@@ -72726,7 +73379,7 @@ const make$M = gen(function* () {
|
|
|
72726
73379
|
attempt2 = woken ? 0 : attempt2 + 1;
|
|
72727
73380
|
}
|
|
72728
73381
|
}).pipe(catchCause((cause) => logWarning("environment connection stopped", cause)));
|
|
72729
|
-
const connections = yield* make$
|
|
73382
|
+
const connections = yield* make$1h();
|
|
72730
73383
|
yield* addFinalizer$1(
|
|
72731
73384
|
() => clear(connections).pipe(
|
|
72732
73385
|
andThen(
|
|
@@ -73421,7 +74074,7 @@ class Host {
|
|
|
73421
74074
|
}
|
|
73422
74075
|
}
|
|
73423
74076
|
const make$K = gen(function* () {
|
|
73424
|
-
const lookups = yield* make$
|
|
74077
|
+
const lookups = yield* make$1v(MAX_CONCURRENT_LOOKUPS);
|
|
73425
74078
|
const icons = yield* makeWith$1(
|
|
73426
74079
|
(host) => withPermit(
|
|
73427
74080
|
lookups,
|
|
@@ -76300,7 +76953,7 @@ const make$z = /* @__PURE__ */ make$I({
|
|
|
76300
76953
|
});
|
|
76301
76954
|
}
|
|
76302
76955
|
});
|
|
76303
|
-
const layer$m = /* @__PURE__ */ pipe$2(/* @__PURE__ */ effect(HttpPlatform)(make$z), /* @__PURE__ */ provide$2(layer$
|
|
76956
|
+
const layer$m = /* @__PURE__ */ pipe$2(/* @__PURE__ */ effect(HttpPlatform)(make$z), /* @__PURE__ */ provide$2(layer$W), /* @__PURE__ */ provide$2(layer$n));
|
|
76304
76957
|
class MultipartStream extends Duplex {
|
|
76305
76958
|
_parser;
|
|
76306
76959
|
_canWrite = true;
|
|
@@ -76693,7 +77346,7 @@ class ServerRequestImpl extends NodeHttpIncomingMessage {
|
|
|
76693
77346
|
}
|
|
76694
77347
|
}
|
|
76695
77348
|
const layerServer = /* @__PURE__ */ flow$1(make$x, /* @__PURE__ */ effect(HttpServer));
|
|
76696
|
-
const layerHttpServices = /* @__PURE__ */ mergeAll(layer$m, layerWeak, layer$
|
|
77349
|
+
const layerHttpServices = /* @__PURE__ */ mergeAll(layer$m, layerWeak, layer$X);
|
|
76697
77350
|
const layer$l = (evaluate, options) => mergeAll(layerServer(evaluate, options), layerHttpServices);
|
|
76698
77351
|
const closeCode = (exit2) => isSuccess$1(exit2) ? 1e3 : hasInterruptsOnly(exit2.cause) ? 1001 : 1011;
|
|
76699
77352
|
const upgradedResponse = /* @__PURE__ */ empty({
|
|
@@ -78144,9 +78797,9 @@ const make$t = gen(function* () {
|
|
|
78144
78797
|
yield* sleep$3(POLL_INTERVAL_MS + (yield* nextIntBetween(-POLL_JITTER_MS, POLL_JITTER_MS)));
|
|
78145
78798
|
}
|
|
78146
78799
|
});
|
|
78147
|
-
const pollers = yield* make$
|
|
78800
|
+
const pollers = yield* make$1h();
|
|
78148
78801
|
const supervise = (automation) => automation.enabled && isPolledTrigger(automation.trigger) ? asVoid(run$4(pollers, automation.id, pollLoop(automation.id))) : remove$1(pollers, automation.id);
|
|
78149
|
-
const listener = yield* make$
|
|
78802
|
+
const listener = yield* make$1i();
|
|
78150
78803
|
let listenError = null;
|
|
78151
78804
|
const webhookTarget = (id2) => gen(function* () {
|
|
78152
78805
|
const automation = yield* getRow(id2);
|
|
@@ -79049,7 +79702,7 @@ const TypeId$2 = "~effect/ai/Toolkit";
|
|
|
79049
79702
|
const FailureOrigin = /* @__PURE__ */ Reference("effect/ai/Toolkit/FailureOrigin", {
|
|
79050
79703
|
defaultValue: () => "result"
|
|
79051
79704
|
});
|
|
79052
|
-
const failureCause = (error2, origin) => annotate(fail$5(error2), make$
|
|
79705
|
+
const failureCause = (error2, origin) => annotate(fail$5(error2), make$1w(FailureOrigin, origin));
|
|
79053
79706
|
const Proto$1 = {
|
|
79054
79707
|
.../* @__PURE__ */ Prototype({
|
|
79055
79708
|
label: "Toolkit",
|
|
@@ -79123,7 +79776,7 @@ const Proto$1 = {
|
|
|
79123
79776
|
})));
|
|
79124
79777
|
}
|
|
79125
79778
|
const decodedParams = decodedParamsResult.success;
|
|
79126
|
-
const queue = yield* make$
|
|
79779
|
+
const queue = yield* make$1q();
|
|
79127
79780
|
const context2 = {
|
|
79128
79781
|
toolCallId,
|
|
79129
79782
|
preliminary: (result2) => asVoid(offer(queue, {
|
|
@@ -79243,7 +79896,7 @@ function getStreamSchemas(schema2) {
|
|
|
79243
79896
|
}
|
|
79244
79897
|
const schema = /* @__PURE__ */ declare(isStream);
|
|
79245
79898
|
function Stream2(success2, error2) {
|
|
79246
|
-
return make$
|
|
79899
|
+
return make$1y(schema.ast, {
|
|
79247
79900
|
[StreamSchemaTypeId]: StreamSchemaTypeId,
|
|
79248
79901
|
success: success2,
|
|
79249
79902
|
error: error2
|
|
@@ -79518,7 +80171,7 @@ const RpcGroupProto = {
|
|
|
79518
80171
|
});
|
|
79519
80172
|
},
|
|
79520
80173
|
annotateRpcs(service2, value2) {
|
|
79521
|
-
return this.annotateRpcsMerge(make$
|
|
80174
|
+
return this.annotateRpcsMerge(make$1w(service2, value2));
|
|
79522
80175
|
},
|
|
79523
80176
|
annotateMerge(context2) {
|
|
79524
80177
|
return makeProto({
|
|
@@ -84570,7 +85223,7 @@ const makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options
|
|
|
84570
85223
|
const services = yield* context();
|
|
84571
85224
|
const scope2 = get$6(services, Scope);
|
|
84572
85225
|
const trackFiber = runIn(forkUnsafe$1(scope2, "parallel"));
|
|
84573
|
-
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$
|
|
85226
|
+
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$1v(concurrency);
|
|
84574
85227
|
const clients = /* @__PURE__ */ new Map();
|
|
84575
85228
|
let isShutdown = false;
|
|
84576
85229
|
const shutdownLatch = makeUnsafe$9(false);
|
|
@@ -84878,7 +85531,7 @@ const make$h = /* @__PURE__ */ fnUntraced(function* (group, options) {
|
|
|
84878
85531
|
const encodeDefectUnsafe = encodeSync(codecFor(Defect()));
|
|
84879
85532
|
const encodeUnknownRequestExit = encodeUnknownEffect(codecFor(Exit(Never, Never, Defect())));
|
|
84880
85533
|
const services = yield* context();
|
|
84881
|
-
const scope2 = yield* make$
|
|
85534
|
+
const scope2 = yield* make$1r();
|
|
84882
85535
|
const server2 = yield* makeNoSerialization(group, {
|
|
84883
85536
|
...options,
|
|
84884
85537
|
disableClientAcks: !supportsAck,
|
|
@@ -85050,7 +85703,7 @@ const makeProtocolWithHttpEffect = /* @__PURE__ */ fnUntraced(function* (options
|
|
|
85050
85703
|
const encodeDefectUnsafe = encodeSync(serialization.codecFor(Defect()));
|
|
85051
85704
|
const includesFraming = serialization.includesFraming;
|
|
85052
85705
|
const isBinary = !serialization.contentType.includes("json");
|
|
85053
|
-
const disconnects = yield* make$
|
|
85706
|
+
const disconnects = yield* make$1q();
|
|
85054
85707
|
let writeRequest;
|
|
85055
85708
|
let clientId = 0;
|
|
85056
85709
|
const clients = /* @__PURE__ */ new Map();
|
|
@@ -85063,7 +85716,7 @@ const makeProtocolWithHttpEffect = /* @__PURE__ */ fnUntraced(function* (options
|
|
|
85063
85716
|
const requestHeaders = Object.entries(request2.headers);
|
|
85064
85717
|
const data = yield* orDie(isBinary ? map$2(request2.arrayBuffer, (buf) => new Uint8Array(buf)) : request2.text);
|
|
85065
85718
|
const id2 = clientId++;
|
|
85066
|
-
const queue = yield* make$
|
|
85719
|
+
const queue = yield* make$1q({
|
|
85067
85720
|
capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0
|
|
85068
85721
|
});
|
|
85069
85722
|
const parser2 = serialization.makeUnsafe();
|
|
@@ -85238,7 +85891,7 @@ class McpServer extends (/* @__PURE__ */ Service$1()("effect/ai/McpServer")) {
|
|
|
85238
85891
|
const resources = [];
|
|
85239
85892
|
const resourceTemplates = [];
|
|
85240
85893
|
const prompts = [];
|
|
85241
|
-
const notificationsQueue = yield* make$
|
|
85894
|
+
const notificationsQueue = yield* make$1q();
|
|
85242
85895
|
const notificationDelivery = {
|
|
85243
85896
|
consumers: 0,
|
|
85244
85897
|
listChangeRevision: 0
|
|
@@ -85626,7 +86279,7 @@ const runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, t
|
|
|
85626
86279
|
defaultLogLevel,
|
|
85627
86280
|
serverInfo: options
|
|
85628
86281
|
});
|
|
85629
|
-
const clients = yield* make$
|
|
86282
|
+
const clients = yield* make$1m({
|
|
85630
86283
|
lookup: fnUntraced(function* (key2) {
|
|
85631
86284
|
const selectedProtocol = runtime.selectProtocol(key2.profile.protocolVersion);
|
|
85632
86285
|
let write;
|
|
@@ -86858,7 +87511,7 @@ const decodeConfig = decodeUnknownEffect(ConfigFile);
|
|
|
86858
87511
|
const readLogin = (source) => {
|
|
86859
87512
|
const url2 = source.env["SBX_URL"];
|
|
86860
87513
|
const token = source.env["SBX_TOKEN"];
|
|
86861
|
-
if (url2 && token) return succeed$1({ url: url2, token: make$
|
|
87514
|
+
if (url2 && token) return succeed$1({ url: url2, token: make$1o(token) });
|
|
86862
87515
|
return tryPromise({
|
|
86863
87516
|
try: () => readFile(source.configPath, "utf8"),
|
|
86864
87517
|
catch: (cause) => cause.code === "ENOENT" ? new SbxNotConfiguredError() : new SbxError({ message: `Could not read ${source.configPath}: ${String(cause)}` })
|
|
@@ -86871,7 +87524,7 @@ const readLogin = (source) => {
|
|
|
86871
87524
|
)
|
|
86872
87525
|
)
|
|
86873
87526
|
),
|
|
86874
|
-
map$2((config2) => ({ url: config2.url, token: make$
|
|
87527
|
+
map$2((config2) => ({ url: config2.url, token: make$1o(config2.token) }))
|
|
86875
87528
|
);
|
|
86876
87529
|
};
|
|
86877
87530
|
const Sandbox = Struct({ id: String$1 });
|
|
@@ -87664,7 +88317,7 @@ const make$f = (env) => gen(function* () {
|
|
|
87664
88317
|
})();
|
|
87665
88318
|
const baseUrlRaw = env["BOAT_API_BASE"];
|
|
87666
88319
|
const baseUrl = baseUrlRaw !== void 0 && baseUrlRaw.length > 0 ? baseUrlRaw : "https://boat.dev/api/v1";
|
|
87667
|
-
const client2 = map$2(resolveApiKey, (apiKey) => boatClient({ baseUrl, apiKey: make$
|
|
88320
|
+
const client2 = map$2(resolveApiKey, (apiKey) => boatClient({ baseUrl, apiKey: make$1o(apiKey) }));
|
|
87668
88321
|
const configured = match$1(resolveApiKey, {
|
|
87669
88322
|
onFailure: () => false,
|
|
87670
88323
|
onSuccess: () => true
|
|
@@ -88319,8 +88972,8 @@ const make$e = (source, dataDir, desktopRedirect = true) => gen(function* () {
|
|
|
88319
88972
|
let setupScript = experimental2.tinyVmSetupScript;
|
|
88320
88973
|
let profileEnabled = experimental2.tinyVmProfile;
|
|
88321
88974
|
let profileOwner;
|
|
88322
|
-
const profileSaves = yield* make$
|
|
88323
|
-
const boatMapLock = yield* make$
|
|
88975
|
+
const profileSaves = yield* make$1v(1);
|
|
88976
|
+
const boatMapLock = yield* make$1v(1);
|
|
88324
88977
|
const current = (threadId) => vms.get(threadId) ?? NONE;
|
|
88325
88978
|
const runFork2 = runForkWith(yield* context());
|
|
88326
88979
|
const publishUnsafe2 = (event) => runFork2(events2.publish(event));
|
|
@@ -89561,11 +90214,11 @@ const linearToolsLayer = LinearTools.toLayer(
|
|
|
89561
90214
|
})
|
|
89562
90215
|
);
|
|
89563
90216
|
const PullRequestUrl = String$1.annotate({
|
|
89564
|
-
description: "GitHub pull request URL, for example https://github.com/owner/repo/pull/123"
|
|
90217
|
+
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"
|
|
89565
90218
|
});
|
|
89566
90219
|
const PullRequestTools = make$q(
|
|
89567
90220
|
make$d("link_pull_request", {
|
|
89568
|
-
description: "Register a GitHub pull request you opened for this thread so the user sees it next to the thread. Call it right after creating the PR.",
|
|
90221
|
+
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.",
|
|
89569
90222
|
parameters: Struct({ url: PullRequestUrl })
|
|
89570
90223
|
}),
|
|
89571
90224
|
make$d("list_thread_pull_requests", {
|
|
@@ -90687,11 +91340,11 @@ const layer$d = effectDiscard(
|
|
|
90687
91340
|
yield* registerArtifactTools;
|
|
90688
91341
|
yield* register(
|
|
90689
91342
|
VmTools,
|
|
90690
|
-
make$
|
|
91343
|
+
make$1w(EnabledWhen, () => tinyVm.enabled())
|
|
90691
91344
|
);
|
|
90692
91345
|
yield* register(
|
|
90693
91346
|
DeviceTools,
|
|
90694
|
-
make$
|
|
91347
|
+
make$1w(EnabledWhen, () => devices.enabled())
|
|
90695
91348
|
);
|
|
90696
91349
|
})
|
|
90697
91350
|
).pipe(
|
|
@@ -90753,7 +91406,7 @@ const announce = effectDiscard(
|
|
|
90753
91406
|
})
|
|
90754
91407
|
);
|
|
90755
91408
|
const layer$c = announce.pipe(provide$2(httpServer));
|
|
90756
|
-
const credentialsLayer = mergeAll(layer$
|
|
91409
|
+
const credentialsLayer = mergeAll(layer$M, layer$A, layer$S);
|
|
90757
91410
|
const serverLayer = layer$c;
|
|
90758
91411
|
const CLOUDFLARED_VERSION = "2026.10.3";
|
|
90759
91412
|
const RELEASE = `https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}`;
|
|
@@ -91003,11 +91656,11 @@ const make$a = ({
|
|
|
91003
91656
|
const secrets = yield* Secrets;
|
|
91004
91657
|
const settings = yield* Settings$1;
|
|
91005
91658
|
const access2 = yield* RemoteAccess;
|
|
91006
|
-
const lock = yield* make$
|
|
91007
|
-
const connector = yield* make$
|
|
91008
|
-
const publisher = yield* make$
|
|
91009
|
-
const linking = yield* make$
|
|
91010
|
-
const status = yield* make$
|
|
91659
|
+
const lock = yield* make$1v(1);
|
|
91660
|
+
const connector = yield* make$1i();
|
|
91661
|
+
const publisher = yield* make$1i();
|
|
91662
|
+
const linking = yield* make$1i();
|
|
91663
|
+
const status = yield* make$1a({ state: "off" });
|
|
91011
91664
|
let tunnel = yield* storedTunnel;
|
|
91012
91665
|
let remote = (yield* settings.get).remote;
|
|
91013
91666
|
const publish2 = (next) => gen(function* () {
|
|
@@ -94104,7 +94757,7 @@ const analyze = (detail, diff, options) => gen(function* () {
|
|
|
94104
94757
|
try: async (signal2) => {
|
|
94105
94758
|
const abortController = new AbortController();
|
|
94106
94759
|
signal2.addEventListener("abort", () => abortController.abort());
|
|
94107
|
-
const { query } = await import("./chunks/sdk-
|
|
94760
|
+
const { query } = await import("./chunks/sdk-DZclv7I1.js");
|
|
94108
94761
|
const stream2 = query({
|
|
94109
94762
|
prompt: buildAnalysisPrompt(payload, options.locale),
|
|
94110
94763
|
options: {
|
|
@@ -94150,7 +94803,7 @@ const make$9 = gen(function* () {
|
|
|
94150
94803
|
const events2 = yield* Events;
|
|
94151
94804
|
const encodeRow = encodeEffect(GuideRow);
|
|
94152
94805
|
const jobs = /* @__PURE__ */ new Map();
|
|
94153
|
-
const latestWriterPerUrl = yield* make$
|
|
94806
|
+
const latestWriterPerUrl = yield* make$1h();
|
|
94154
94807
|
const oneAnalysisAtATime = makeUnsafe$8(1);
|
|
94155
94808
|
const oneStartAtATime = makeUnsafe$8(1);
|
|
94156
94809
|
const mergedOrClosed = /* @__PURE__ */ new Set();
|
|
@@ -94236,7 +94889,7 @@ const make$9 = gen(function* () {
|
|
|
94236
94889
|
}).pipe(catchCause((cause) => logWarning("pull request guide sweep failed", cause)));
|
|
94237
94890
|
yield* schedule(sweep, spaced(SWEEP_INTERVAL$2)).pipe(forkScoped);
|
|
94238
94891
|
return PullRequestGuides.of({
|
|
94239
|
-
get: (raw2) => flatMap(
|
|
94892
|
+
get: (raw2) => flatMap(requireGitHubPullRequestUrl(raw2), state),
|
|
94240
94893
|
ensure,
|
|
94241
94894
|
retry: retry2,
|
|
94242
94895
|
sweep
|
|
@@ -94316,8 +94969,8 @@ const make$8 = ({ serviceUrl, fetch: fetch2 = globalThis.fetch }) => gen(functio
|
|
|
94316
94969
|
const secrets = yield* Secrets;
|
|
94317
94970
|
const environments2 = yield* Environments;
|
|
94318
94971
|
const self2 = (yield* RemoteAccess).identity;
|
|
94319
|
-
const lock = yield* make$
|
|
94320
|
-
const signingIn = yield* make$
|
|
94972
|
+
const lock = yield* make$1v(1);
|
|
94973
|
+
const signingIn = yield* make$1i();
|
|
94321
94974
|
const nobody = {
|
|
94322
94975
|
name: null,
|
|
94323
94976
|
email: null,
|
|
@@ -94481,7 +95134,7 @@ const make$7 = gen(function* () {
|
|
|
94481
95134
|
const settings = yield* Settings$1;
|
|
94482
95135
|
const threads = yield* Threads;
|
|
94483
95136
|
const pullRequests = yield* PullRequests;
|
|
94484
|
-
const
|
|
95137
|
+
const sourceControl = yield* SourceControl;
|
|
94485
95138
|
const events2 = yield* Events;
|
|
94486
95139
|
const worktrees = yield* Worktrees;
|
|
94487
95140
|
const runner = yield* AgentRunner;
|
|
@@ -94493,7 +95146,7 @@ const make$7 = gen(function* () {
|
|
|
94493
95146
|
const subagents = yield* runner.subagents(threadId);
|
|
94494
95147
|
return tasks.length > 0 || subagents.some((subagent2) => subagent2.status === "running");
|
|
94495
95148
|
});
|
|
94496
|
-
const hasListeningPort = (threadId) => ports.listForThread(threadId).pipe(
|
|
95149
|
+
const hasListeningPort = (threadId) => ports.listForThread(threadId, { fresh: true }).pipe(
|
|
94497
95150
|
map$2((open2) => open2.length > 0),
|
|
94498
95151
|
catchTag("FolderMissingError", () => succeed$1(false))
|
|
94499
95152
|
);
|
|
@@ -94515,7 +95168,7 @@ const make$7 = gen(function* () {
|
|
|
94515
95168
|
const thread2 = yield* threads.get(threadId);
|
|
94516
95169
|
if (!canAutoSettle(thread2) || (yield* hasAgentWork(threadId))) return;
|
|
94517
95170
|
const branch = yield* ownBranch(thread2.worktreeId);
|
|
94518
|
-
const found2 = yield* forEach(links, (link) =>
|
|
95171
|
+
const found2 = yield* forEach(links, (link) => sourceControl.pullRequest(link.url), { concurrency: 4 });
|
|
94519
95172
|
const isOwn = (pullRequest) => branch === null || branch === pullRequest.headRefName || branch === forkPullRequestBranch(pullRequest.number);
|
|
94520
95173
|
const allFinished = found2.every(
|
|
94521
95174
|
(pullRequest, index) => isFinished(pullRequest) || !isOwn(pullRequest) && links[index].watch === null
|
|
@@ -94532,13 +95185,15 @@ const make$7 = gen(function* () {
|
|
|
94532
95185
|
}).pipe(catchCause((cause) => logWarning("auto settle skipped a thread", threadId, cause)));
|
|
94533
95186
|
const settleIfIdle = (thread2, links, days, now2) => gen(function* () {
|
|
94534
95187
|
if (!isIdleFor(thread2, days, now2) || (yield* hasAgentWork(thread2.id))) return;
|
|
94535
|
-
const found2 = yield* forEach(links, (link) =>
|
|
95188
|
+
const found2 = yield* forEach(links, (link) => sourceControl.pullRequest(link.url), { concurrency: 4 });
|
|
94536
95189
|
if (found2.some(isOpen$1) || (yield* hasListeningPort(thread2.id))) return;
|
|
94537
|
-
const
|
|
94538
|
-
if (
|
|
94539
|
-
const settled =
|
|
94540
|
-
|
|
94541
|
-
|
|
95190
|
+
const isStillIdle = (latest) => latest.updatedAt === thread2.updatedAt && isIdleFor(latest, days, now2);
|
|
95191
|
+
if (!isStillIdle(yield* threads.get(thread2.id))) return;
|
|
95192
|
+
const settled = flatten$1(
|
|
95193
|
+
yield* runner.release(
|
|
95194
|
+
thread2.id,
|
|
95195
|
+
stopProcesses(thread2.id).pipe(andThen(threads.settleIf(thread2.id, isStillIdle)))
|
|
95196
|
+
)
|
|
94542
95197
|
);
|
|
94543
95198
|
if (isSome(settled)) yield* events2.publish({ type: "thread.updated", thread: settled.value });
|
|
94544
95199
|
}).pipe(catchCause((cause) => logWarning("idle settle skipped a thread", thread2.id, cause)));
|
|
@@ -94557,7 +95212,7 @@ const make$7 = gen(function* () {
|
|
|
94557
95212
|
const archiveIfStillDue = threads.archiveIf(
|
|
94558
95213
|
thread2.id,
|
|
94559
95214
|
(latest) => gen(function* () {
|
|
94560
|
-
if (yield* losesUncommittedWork(latest)) return false;
|
|
95215
|
+
if ((yield* losesUncommittedWork(latest)) || (yield* runner.isBusy(latest.id))) return false;
|
|
94561
95216
|
return yield* isArchiveDue(latest, now2);
|
|
94562
95217
|
})
|
|
94563
95218
|
);
|
|
@@ -94570,8 +95225,15 @@ const make$7 = gen(function* () {
|
|
|
94570
95225
|
const { archive: archive2 } = yield* settings.get;
|
|
94571
95226
|
const now2 = yield* currentTimeMillis;
|
|
94572
95227
|
const byThread = Map.groupBy(yield* pullRequests.listAll, (link) => link.threadId);
|
|
94573
|
-
if (archive2.whenMerged
|
|
94574
|
-
yield* forEach(
|
|
95228
|
+
if (archive2.whenMerged) {
|
|
95229
|
+
yield* forEach(
|
|
95230
|
+
byThread,
|
|
95231
|
+
([threadId, links]) => flatMap(
|
|
95232
|
+
forEach(links, (link) => sourceControl.installedFor(link.url)),
|
|
95233
|
+
(installed) => installed.every(Boolean) ? settleIfDone(threadId, links) : void_
|
|
95234
|
+
),
|
|
95235
|
+
{ discard: true }
|
|
95236
|
+
);
|
|
94575
95237
|
}
|
|
94576
95238
|
const all2 = yield* threads.list;
|
|
94577
95239
|
const { settleAfterIdleDays } = archive2;
|
|
@@ -94831,8 +95493,9 @@ const knownRoot = (root2) => gen(function* () {
|
|
|
94831
95493
|
if (!known) return yield* new UnknownRootError({ root: root2 });
|
|
94832
95494
|
return root2;
|
|
94833
95495
|
});
|
|
95496
|
+
const announceThread = (thread2) => Events.use((events2) => events2.publish({ type: "thread.updated", thread: thread2 }));
|
|
94834
95497
|
const closeTerminals = (threadId) => Terminals.use((terminals) => terminals.closeThread(threadId));
|
|
94835
|
-
const startGuideForHead = (detail) => PullRequestGuides.use((guides) => guides.ensure(detail));
|
|
95498
|
+
const startGuideForHead = (detail) => codeHostOfUrl(detail.url) === "github" ? PullRequestGuides.use((guides) => guides.ensure(detail)) : void_;
|
|
94836
95499
|
const handlers = {
|
|
94837
95500
|
"browser.open": (input) => Browser.use((browser2) => browser2.open(input)),
|
|
94838
95501
|
"browser.command": (input) => Browser.use((browser2) => browser2.command(input)),
|
|
@@ -94928,18 +95591,14 @@ const handlers = {
|
|
|
94928
95591
|
"worktrees.pullRequest": ({ id: id2 }) => Worktrees.use((worktrees) => worktrees.pullRequest(id2)),
|
|
94929
95592
|
"threads.changes": ({ threadId, scope: scope2 }) => Threads.use((threads) => threads.changes(threadId, scope2)),
|
|
94930
95593
|
"threads.undoTurn": ({ threadId }) => Threads.use((threads) => threads.undoTurn(threadId)),
|
|
94931
|
-
"threads.archive": ({ threadId }) => Threads.use((threads) => threads.archive(threadId)),
|
|
94932
|
-
"threads.unarchive": ({ threadId }) => Threads.use((threads) => threads.unarchive(threadId)),
|
|
94933
|
-
"threads.settle": ({ threadId }) => Settle.use((settle2) => settle2.settle(threadId)),
|
|
94934
|
-
"threads.unsettle": ({ threadId }) => Threads.use((threads) => threads.unsettle(threadId)),
|
|
95594
|
+
"threads.archive": ({ threadId }) => Threads.use((threads) => threads.archive(threadId)).pipe(tap$1(announceThread)),
|
|
95595
|
+
"threads.unarchive": ({ threadId }) => Threads.use((threads) => threads.unarchive(threadId)).pipe(tap$1(announceThread)),
|
|
95596
|
+
"threads.settle": ({ threadId }) => Settle.use((settle2) => settle2.settle(threadId)).pipe(tap$1(announceThread)),
|
|
95597
|
+
"threads.unsettle": ({ threadId }) => Threads.use((threads) => threads.unsettle(threadId)).pipe(tap$1(announceThread)),
|
|
94935
95598
|
"threads.regenerateTitle": ({ threadId }) => ThreadNaming.use((naming) => naming.regenerateTitle(threadId)),
|
|
94936
|
-
"threads.fork": ({ threadId, messageId }) => Threads.use((threads) => threads.fork(threadId, messageId)).pipe(
|
|
94937
|
-
tap$1((thread2) => Events.use((events2) => events2.publish({ type: "thread.updated", thread: thread2 })))
|
|
94938
|
-
),
|
|
95599
|
+
"threads.fork": ({ threadId, messageId }) => Threads.use((threads) => threads.fork(threadId, messageId)).pipe(tap$1(announceThread)),
|
|
94939
95600
|
"sessions.listExternal": ({ projectId }) => SessionImports.use((imports) => imports.list(projectId)),
|
|
94940
|
-
"sessions.import": (input) => SessionImports.use((imports) => imports.import(input)).pipe(
|
|
94941
|
-
tap$1((thread2) => Events.use((events2) => events2.publish({ type: "thread.updated", thread: thread2 })))
|
|
94942
|
-
),
|
|
95601
|
+
"sessions.import": (input) => SessionImports.use((imports) => imports.import(input)).pipe(tap$1(announceThread)),
|
|
94943
95602
|
"threads.sidechat": ({ threadId }) => Threads.use((threads) => threads.sidechat(threadId)),
|
|
94944
95603
|
"projects.currentBranch": ({ id: id2 }) => Worktrees.use((worktrees) => worktrees.currentBranch(id2)),
|
|
94945
95604
|
"projects.defaultBranch": ({ id: id2 }) => Worktrees.use((worktrees) => worktrees.defaultBranch(id2)),
|
|
@@ -95089,14 +95748,16 @@ const handlers = {
|
|
|
95089
95748
|
"pullRequests.watch": ({ threadId, url: url2 }) => PullRequests.use((pullRequests) => pullRequests.watch(threadId, url2)),
|
|
95090
95749
|
"pullRequests.unwatch": ({ threadId, url: url2 }) => PullRequests.use((pullRequests) => pullRequests.unwatch(threadId, url2)),
|
|
95091
95750
|
"github.auth": () => GitHub.use((github) => github.auth),
|
|
95092
|
-
"github.pullRequest": ({ url: url2 }) =>
|
|
95093
|
-
"github.pullRequestDetail": ({ url: url2, fresh }) =>
|
|
95751
|
+
"github.pullRequest": ({ url: url2 }) => SourceControl.use((sourceControl) => sourceControl.pullRequest(url2)),
|
|
95752
|
+
"github.pullRequestDetail": ({ url: url2, fresh }) => SourceControl.use((sourceControl) => sourceControl.pullRequestDetail(url2, { fresh })).pipe(
|
|
95753
|
+
tap$1(startGuideForHead)
|
|
95754
|
+
),
|
|
95094
95755
|
"github.pullRequestFiles": ({ url: url2 }) => GitHub.use((github) => github.pullRequestDiff(url2)).pipe(flatMap(pullRequestFiles)),
|
|
95095
95756
|
"pullRequestGuides.get": ({ url: url2 }) => PullRequestGuides.use((guides) => guides.get(url2)),
|
|
95096
95757
|
"pullRequestGuides.retry": ({ url: url2 }) => PullRequestGuides.use((guides) => guides.retry(url2)),
|
|
95097
|
-
"github.merge": ({ url: url2, method: method2 }) =>
|
|
95098
|
-
"github.close": ({ url: url2 }) =>
|
|
95099
|
-
"github.comment": ({ url: url2, body: body2 }) =>
|
|
95758
|
+
"github.merge": ({ url: url2, method: method2 }) => SourceControl.use((sourceControl) => sourceControl.merge(url2, method2)),
|
|
95759
|
+
"github.close": ({ url: url2 }) => SourceControl.use((sourceControl) => sourceControl.close(url2)),
|
|
95760
|
+
"github.comment": ({ url: url2, body: body2 }) => SourceControl.use((sourceControl) => sourceControl.comment(url2, body2)),
|
|
95100
95761
|
"github.pullRequestCandidates": ({ url: url2 }) => GitHub.use((github) => github.pullRequestCandidates(url2)),
|
|
95101
95762
|
"github.editPullRequest": ({ url: url2, edit }) => GitHub.use((github) => github.editPullRequest(url2, edit)),
|
|
95102
95763
|
"github.fileContent": ({ url: url2, ref: ref2, path: path2 }) => GitHub.use((github) => github.fileContent(url2, ref2, path2)),
|
|
@@ -95547,7 +96208,7 @@ const make$3 = gen(function* () {
|
|
|
95547
96208
|
scoped,
|
|
95548
96209
|
ensuring(access2.report({ listening: false }))
|
|
95549
96210
|
);
|
|
95550
|
-
const listener = yield* make$
|
|
96211
|
+
const listener = yield* make$1i();
|
|
95551
96212
|
const apply2 = (remote) => gen(function* () {
|
|
95552
96213
|
yield* clear$1(listener);
|
|
95553
96214
|
yield* access2.report({ listenError: null });
|
|
@@ -95673,7 +96334,7 @@ const settledTopic = (status) => {
|
|
|
95673
96334
|
};
|
|
95674
96335
|
const make$2 = gen(function* () {
|
|
95675
96336
|
const bus = yield* EventBus;
|
|
95676
|
-
const
|
|
96337
|
+
const sourceControl = yield* SourceControl;
|
|
95677
96338
|
const pullRequests = yield* PullRequests;
|
|
95678
96339
|
const threads = yield* Threads;
|
|
95679
96340
|
const settle2 = (link, pullRequest, openedByThread) => gen(function* () {
|
|
@@ -95684,20 +96345,23 @@ const make$2 = gen(function* () {
|
|
|
95684
96345
|
yield* publish(bus, { topic, threadId: link.threadId, pullRequest });
|
|
95685
96346
|
});
|
|
95686
96347
|
const announce2 = ({ threadId, linkId, url: url2 }) => gen(function* () {
|
|
95687
|
-
const [pullRequest, openedAt] = yield* all$1(
|
|
95688
|
-
|
|
95689
|
-
|
|
96348
|
+
const [pullRequest, openedAt] = yield* all$1(
|
|
96349
|
+
[sourceControl.pullRequest(url2), sourceControl.pullRequestOpenedAt(url2)],
|
|
96350
|
+
{
|
|
96351
|
+
concurrency: "unbounded"
|
|
96352
|
+
}
|
|
96353
|
+
).pipe(retry$3({ times: 2, schedule: spaced("5 seconds") }));
|
|
95690
96354
|
const thread2 = yield* threads.get(threadId);
|
|
95691
96355
|
const openedByThread = Date.parse(openedAt) >= Date.parse(thread2.createdAt);
|
|
95692
96356
|
if (openedByThread) yield* publish(bus, { topic: "pullRequest.opened", threadId, pullRequest });
|
|
95693
96357
|
yield* settle2({ id: linkId, threadId }, pullRequest, openedByThread);
|
|
95694
96358
|
}).pipe(catchCause((cause) => logWarning("could not announce a linked pull request", url2, cause)));
|
|
95695
96359
|
const sweep = gen(function* () {
|
|
95696
|
-
|
|
95697
|
-
const
|
|
96360
|
+
const readable2 = yield* filter$3(yield* pullRequests.unsettled, (link) => sourceControl.installedFor(link.url));
|
|
96361
|
+
const byUrl2 = Map.groupBy(readable2, (link) => link.url);
|
|
95698
96362
|
yield* forEach(
|
|
95699
|
-
|
|
95700
|
-
([url2, links]) =>
|
|
96363
|
+
byUrl2,
|
|
96364
|
+
([url2, links]) => sourceControl.pullRequest(url2).pipe(
|
|
95701
96365
|
flatMap(
|
|
95702
96366
|
(pullRequest) => forEach(links, (link) => settle2(link, pullRequest, false), { discard: true })
|
|
95703
96367
|
),
|
|
@@ -95726,7 +96390,7 @@ const layer$2 = effectDiscard(
|
|
|
95726
96390
|
}
|
|
95727
96391
|
};
|
|
95728
96392
|
const subscription = yield* subscribe(bus);
|
|
95729
|
-
const reactions = yield* make$
|
|
96393
|
+
const reactions = yield* make$1g();
|
|
95730
96394
|
yield* take$3(subscription).pipe(
|
|
95731
96395
|
flatMap(
|
|
95732
96396
|
(event) => run$3(
|
|
@@ -95857,7 +96521,7 @@ class PullRequestWatcher extends Service$1()(
|
|
|
95857
96521
|
}
|
|
95858
96522
|
const make$1 = gen(function* () {
|
|
95859
96523
|
const pullRequests = yield* PullRequests;
|
|
95860
|
-
const
|
|
96524
|
+
const sourceControl = yield* SourceControl;
|
|
95861
96525
|
const threads = yield* Threads;
|
|
95862
96526
|
const runner = yield* AgentRunner;
|
|
95863
96527
|
const semaphore = makeUnsafe$8(1);
|
|
@@ -95897,14 +96561,14 @@ const make$1 = gen(function* () {
|
|
|
95897
96561
|
const watch2 = link.watch;
|
|
95898
96562
|
if (watch2 === null) return;
|
|
95899
96563
|
const now2 = yield* nowIso;
|
|
95900
|
-
const read2 = yield* result$1(
|
|
96564
|
+
const read2 = yield* result$1(sourceControl.pullRequestDetail(link.url));
|
|
95901
96565
|
if (read2._tag === "Failure") {
|
|
95902
96566
|
const failures = watch2.failures + 1;
|
|
95903
96567
|
if (failures >= MAX_FAILURES) {
|
|
95904
96568
|
yield* stopWithWake(
|
|
95905
96569
|
link,
|
|
95906
96570
|
watch2,
|
|
95907
|
-
`
|
|
96571
|
+
`The pull request could not be read ${MAX_FAILURES} times in a row (last error: ${read2.failure.message}).`
|
|
95908
96572
|
);
|
|
95909
96573
|
} else {
|
|
95910
96574
|
yield* record2(link, watch2, { failures, lastPolledAt: now2 });
|
|
@@ -95943,8 +96607,7 @@ Watching has ended after ${MAX_WAKES} updates. Call the hinacode \`watch_pull_re
|
|
|
95943
96607
|
const sweep = withPermit(
|
|
95944
96608
|
semaphore,
|
|
95945
96609
|
gen(function* () {
|
|
95946
|
-
|
|
95947
|
-
const links = yield* pullRequests.watched;
|
|
96610
|
+
const links = yield* filter$3(yield* pullRequests.watched, (link) => sourceControl.installedFor(link.url));
|
|
95948
96611
|
yield* forEach(links, poll, { concurrency: 4, discard: true });
|
|
95949
96612
|
}).pipe(catchCause((cause) => logWarning("pull request watch sweep failed", cause)))
|
|
95950
96613
|
);
|
|
@@ -96537,7 +97200,7 @@ function requireTlsHelpers() {
|
|
|
96537
97200
|
Object.defineProperty(tlsHelpers, "__esModule", { value: true });
|
|
96538
97201
|
tlsHelpers.CIPHER_SUITES = void 0;
|
|
96539
97202
|
tlsHelpers.getDefaultRootsData = getDefaultRootsData;
|
|
96540
|
-
const fs2 =
|
|
97203
|
+
const fs2 = Ee__default;
|
|
96541
97204
|
tlsHelpers.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES;
|
|
96542
97205
|
const DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH;
|
|
96543
97206
|
let defaultRootsData = null;
|
|
@@ -107895,8 +108558,8 @@ function requireUtil() {
|
|
|
107895
108558
|
hasRequiredUtil = 1;
|
|
107896
108559
|
Object.defineProperty(util, "__esModule", { value: true });
|
|
107897
108560
|
util.addCommonProtos = util.loadProtosWithOptionsSync = util.loadProtosWithOptions = void 0;
|
|
107898
|
-
const fs2 =
|
|
107899
|
-
const path2 =
|
|
108561
|
+
const fs2 = Ee__default;
|
|
108562
|
+
const path2 = Pe__default;
|
|
107900
108563
|
const Protobuf = requireProtobufjs();
|
|
107901
108564
|
function addIncludePathResolver(root2, includePaths) {
|
|
107902
108565
|
const originalResolvePath = root2.resolvePath;
|
|
@@ -117052,7 +117715,7 @@ function requireCertificateProvider() {
|
|
|
117052
117715
|
hasRequiredCertificateProvider = 1;
|
|
117053
117716
|
Object.defineProperty(certificateProvider, "__esModule", { value: true });
|
|
117054
117717
|
certificateProvider.FileWatcherCertificateProvider = void 0;
|
|
117055
|
-
const fs2 =
|
|
117718
|
+
const fs2 = Ee__default;
|
|
117056
117719
|
const logging2 = requireLogging();
|
|
117057
117720
|
const constants_1 = requireConstants();
|
|
117058
117721
|
const util_1 = require$$0;
|
|
@@ -119990,7 +120653,7 @@ const traceLayer = (file, ledger) => {
|
|
|
119990
120653
|
`);
|
|
119991
120654
|
}
|
|
119992
120655
|
}
|
|
119993
|
-
return succeed$5(Tracer, make$
|
|
120656
|
+
return succeed$5(Tracer, make$1z({ span: (options) => new RecordedSpan(options) }));
|
|
119994
120657
|
};
|
|
119995
120658
|
const STALL_MS = 100;
|
|
119996
120659
|
const CHECK_INTERVAL$1 = "1 second";
|
|
@@ -120070,7 +120733,7 @@ const agentProviders = (env) => {
|
|
|
120070
120733
|
simulated: claude !== void 0,
|
|
120071
120734
|
simulatedProviders: new Set(claude === void 0 ? [] : ["claude"]),
|
|
120072
120735
|
layer: mergeAll(
|
|
120073
|
-
claude ?? layer$
|
|
120736
|
+
claude ?? layer$T,
|
|
120074
120737
|
CodexProvider.layer,
|
|
120075
120738
|
MuseProvider.layer,
|
|
120076
120739
|
OpencodeProvider.layer,
|
|
@@ -120079,7 +120742,7 @@ const agentProviders = (env) => {
|
|
|
120079
120742
|
};
|
|
120080
120743
|
};
|
|
120081
120744
|
const linearLayer = (env) => {
|
|
120082
|
-
if (env["HINACODE_MOCK_LINEAR"] === void 0) return layer$o.pipe(provide$2(layer$
|
|
120745
|
+
if (env["HINACODE_MOCK_LINEAR"] === void 0) return layer$o.pipe(provide$2(layer$S));
|
|
120083
120746
|
if (!env["HINACODE_USER_DATA"]) throw new Error("Linear simulation requires HINACODE_USER_DATA");
|
|
120084
120747
|
return mockLayer;
|
|
120085
120748
|
};
|
|
@@ -120093,7 +120756,7 @@ const makeAppLayer = ({
|
|
|
120093
120756
|
artifactInspector = unavailable
|
|
120094
120757
|
}) => {
|
|
120095
120758
|
const providers = agentProviders(process.env);
|
|
120096
|
-
const settings = layer$
|
|
120759
|
+
const settings = layer$R(userData);
|
|
120097
120760
|
const binaries = effect(
|
|
120098
120761
|
AgentBinaries,
|
|
120099
120762
|
gen(function* () {
|
|
@@ -120116,11 +120779,11 @@ const makeAppLayer = ({
|
|
|
120116
120779
|
provideMerge(layer$D),
|
|
120117
120780
|
provideMerge(layer$C),
|
|
120118
120781
|
provideMerge(layer$F),
|
|
120119
|
-
provideMerge(layer$
|
|
120782
|
+
provideMerge(layer$O),
|
|
120120
120783
|
provideMerge(settings)
|
|
120121
120784
|
),
|
|
120122
120785
|
layer$t(userData),
|
|
120123
|
-
layer$
|
|
120786
|
+
layer$K,
|
|
120124
120787
|
layer$z(join$1(userData, "attachments")),
|
|
120125
120788
|
layer$w(join$1(userData, "artifacts")),
|
|
120126
120789
|
artifactInspector,
|
|
@@ -120134,18 +120797,18 @@ const makeAppLayer = ({
|
|
|
120134
120797
|
regenerateTitle: (threadId) => threads.get(threadId)
|
|
120135
120798
|
}))
|
|
120136
120799
|
) : layer$y;
|
|
120137
|
-
const remoteAccess = layer$s.pipe(provide$2(layer$
|
|
120800
|
+
const remoteAccess = layer$s.pipe(provide$2(layer$S));
|
|
120138
120801
|
const relayServiceUrl = process.env["HINACODE_RELAY_URL"] ?? DEFAULT_RELAY_SERVICE_URL;
|
|
120139
120802
|
const relay2 = layer$b({ serviceUrl: relayServiceUrl, cloudflaredDir: join$1(userData, "cloudflared") }).pipe(
|
|
120140
|
-
provide$2(mergeAll(remoteAccess, layer$
|
|
120803
|
+
provide$2(mergeAll(remoteAccess, layer$S))
|
|
120141
120804
|
);
|
|
120142
|
-
const boat = layer$h(process.env).pipe(provide$2(layer$
|
|
120805
|
+
const boat = layer$h(process.env).pipe(provide$2(layer$S));
|
|
120143
120806
|
const tinyVm = layer$g({ configPath: sbxConfigPath, env: process.env }, join$1(userData, "tiny-vm"), {
|
|
120144
120807
|
desktopRedirect: serve2 === void 0
|
|
120145
120808
|
}).pipe(provide$2(boat));
|
|
120146
120809
|
const peers = layer$f.pipe(
|
|
120147
120810
|
provideMerge(layer$r),
|
|
120148
|
-
provide$2(mergeAll(remoteAccess, layer$
|
|
120811
|
+
provide$2(mergeAll(remoteAccess, layer$S))
|
|
120149
120812
|
);
|
|
120150
120813
|
const devices = devicesLayer({
|
|
120151
120814
|
drivers: {
|
|
@@ -120156,7 +120819,7 @@ const makeAppLayer = ({
|
|
|
120156
120819
|
});
|
|
120157
120820
|
const features = mergeAll(
|
|
120158
120821
|
credentialsLayer,
|
|
120159
|
-
layer$
|
|
120822
|
+
layer$U,
|
|
120160
120823
|
layer$u,
|
|
120161
120824
|
layer$7,
|
|
120162
120825
|
naming,
|
|
@@ -120177,19 +120840,20 @@ const makeAppLayer = ({
|
|
|
120177
120840
|
providers.simulated ? idleLayer : layer$a,
|
|
120178
120841
|
updates,
|
|
120179
120842
|
serverLayer,
|
|
120180
|
-
layer$
|
|
120843
|
+
layer$N(join$1(userData, "cache")),
|
|
120181
120844
|
layer$6,
|
|
120182
|
-
layer$9({ serviceUrl: relayServiceUrl }).pipe(provide$2(layer$
|
|
120845
|
+
layer$9({ serviceUrl: relayServiceUrl }).pipe(provide$2(layer$S))
|
|
120183
120846
|
).pipe(provideMerge(agents));
|
|
120184
120847
|
return mergeAll(layer$4, layer$5(userData), answerAsksLayer, layer$2).pipe(
|
|
120185
120848
|
provideMerge(effectDiscard(serve2 ? applyServeConfig(serve2) : void_)),
|
|
120186
120849
|
provideMerge(services),
|
|
120187
|
-
provide$2(providers.layer.pipe(provide$2(mergeAll(settings, layer$
|
|
120850
|
+
provide$2(providers.layer.pipe(provide$2(mergeAll(settings, layer$S, binaries)))),
|
|
120188
120851
|
provideMerge(binaries),
|
|
120189
|
-
provideMerge(
|
|
120852
|
+
provideMerge(layer$G),
|
|
120853
|
+
provideMerge(mergeAll(layer$L, layer$I, layer$p, layer$J)),
|
|
120190
120854
|
provideMerge(makeEventsLayer()),
|
|
120191
|
-
provide$2(mergeAll(layer$
|
|
120192
|
-
provide$2(layer$
|
|
120855
|
+
provide$2(mergeAll(layer$P(join$1(userData, "hinacode.sqlite")), keyring)),
|
|
120856
|
+
provide$2(layer$X),
|
|
120193
120857
|
provideMerge(watchdogLayer(spans)),
|
|
120194
120858
|
provideMerge(traceLayer(process.env["HINACODE_TRACE"], spans))
|
|
120195
120859
|
);
|
|
@@ -120222,7 +120886,7 @@ const make = ({ current, packageRoot: packageRoot2, registry: registry2, restart
|
|
|
120222
120886
|
if (!response2.ok) throw new Error(`npm answered ${response2.status}`);
|
|
120223
120887
|
return decodeUnknownSync(NpmRelease)(await response2.json()).version;
|
|
120224
120888
|
});
|
|
120225
|
-
const checkLock = yield* make$
|
|
120889
|
+
const checkLock = yield* make$1v(1);
|
|
120226
120890
|
const check = suspend(
|
|
120227
120891
|
() => state.type === "downloading" ? void_ : set2({ type: "checking" }).pipe(
|
|
120228
120892
|
andThen(latest),
|
|
@@ -120409,7 +121073,7 @@ const serve = async (flags, userData) => {
|
|
|
120409
121073
|
mkdirSync(userData, { recursive: true, mode: 448 });
|
|
120410
121074
|
lockDataDir(userData);
|
|
120411
121075
|
await hydratePath(process.env).ready;
|
|
120412
|
-
const runtime = make$
|
|
121076
|
+
const runtime = make$1f(
|
|
120413
121077
|
makeAppLayer({
|
|
120414
121078
|
userData,
|
|
120415
121079
|
sbxConfigPath: join$1(appData(), "sbx", "config.json"),
|
|
@@ -120470,10 +121134,10 @@ const pair = async (userData) => {
|
|
|
120470
121134
|
process.exitCode = 1;
|
|
120471
121135
|
};
|
|
120472
121136
|
if (!existsSync(database)) return noCloud();
|
|
120473
|
-
const runtime = make$
|
|
121137
|
+
const runtime = make$1f(
|
|
120474
121138
|
layer$s.pipe(
|
|
120475
|
-
provideMerge(mergeAll(layer$
|
|
120476
|
-
provideMerge(mergeAll(layer$
|
|
121139
|
+
provideMerge(mergeAll(layer$R(userData), layer$S)),
|
|
121140
|
+
provideMerge(mergeAll(layer$P(database), noKeyring)),
|
|
120477
121141
|
provide$2(succeed$5(MinimumLogLevel, "Warn"))
|
|
120478
121142
|
)
|
|
120479
121143
|
);
|