hinacode 0.3.0-alpha.12 → 0.3.0-alpha.14

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.
@@ -15986,7 +15986,7 @@ function defaultShouldQuit(input) {
15986
15986
  }
15987
15987
  const layer$1 = layer$2;
15988
15988
  const layer = /* @__PURE__ */ provideMerge(layer$b, /* @__PURE__ */ mergeAll$1(layer$7, layer$9, layer$5, layer$3, layer$1));
15989
- const version = "0.3.0-alpha.12";
15989
+ const version = "0.3.0-alpha.14";
15990
15990
  const packageJson = {
15991
15991
  version
15992
15992
  };
@@ -21609,7 +21609,7 @@ const RpcMethods = {
21609
21609
  "subagents.list": rpc(Struct({ threadId: String$1 }), ArraySchema(Subagent)),
21610
21610
  "subagents.stop": rpc(Struct({ threadId: String$1, subagentId: String$1 }), Void2),
21611
21611
  "subagents.transcript": rpc(
21612
- Struct({ threadId: String$1, callId: String$1 }),
21612
+ Struct({ threadId: String$1, callId: String$1, compact: optional(Boolean$1) }),
21613
21613
  Struct({
21614
21614
  spawn: NullOr(MessagePart),
21615
21615
  calls: ArraySchema(MessagePart),
@@ -22898,13 +22898,13 @@ export {
22898
22898
  PullRequestWatch as im,
22899
22899
  PullRequestLink as io,
22900
22900
  allWatchEventKinds as ip,
22901
- enabledProviders as iq,
22902
- transcriptThreadId$1 as ir,
22903
- resumeGraceMs as is,
22904
- fail$2 as it,
22905
- isDoneUnsafe as iu,
22906
- filter$2 as iv,
22907
- WAIT_AGENT_TOOL as iw,
22901
+ WAIT_AGENT_TOOL as iq,
22902
+ enabledProviders as ir,
22903
+ transcriptThreadId$1 as is,
22904
+ resumeGraceMs as it,
22905
+ fail$2 as iu,
22906
+ isDoneUnsafe as iv,
22907
+ filter$2 as iw,
22908
22908
  startingProvider as ix,
22909
22909
  kilobytes as iy,
22910
22910
  monotonicTimeNanos as iz,
package/out/server/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "node:module";
2
2
  globalThis.require ??= __createRequire(import.meta.url);
3
- import { d as dual, r as runFork, t as tapCause, h as hasInterruptsOnly, v as void_, s as squash, l as logError, c as constVoid, i as isEffect, a as isSuccess, w as withFiber, C as ConsoleRef, b as sync, T as TaggedError, A as ArraySchema, S as String$6, U as Union, e as hasProperty, o as optional$3, L as Literal, f as optionalKey, D as Defect, g as format, j as toCodecStringTree, k as decodeUnknownEffect, m as identity, n as succeed$2, p as fail, q as is, u as TrueLiterals, F as FalseLiterals, x as mapError, B as BooleanLiterals, I as Int$4, R as Reference, y as fnUntraced, z as scoped, Q as QuitError, E as Terminal, G as cached, H as suspend, P as Prototype, J as getOrElse, K as some, M as match, N as none, O as make$2, V as map$2, W as taggedEnum, X as match$1, Y as map$3, Z as isSome, _ as flatMap$1, $ as sync$1, a0 as empty, a1 as reduce, a2 as pipe, a3 as match$2, a4 as findFirstIndex, a5 as findFirst, a6 as findLast, a7 as isReadonlyArrayNonEmpty, a8 as ensuring, a9 as orDie, aa as take, ab as raceFirst, ac as round, ad as pipeArguments, ae as catchTags, af as fromUndefinedOr, ag as isNotUndefined, ah as getOrUndefined, ai as assignProperty, aj as Service, ak as empty$1, al as exists, am as gen, an as isNone, ao as succeed$3, ap as value, aq as provideService, ar as Stdio, as as catchFilter, at as isQuitError, au as succeed$4, av as fail$1, aw as interrupt, ax as andThen, ay as catchTag, az as result, aA as make$3, aB as provideContext, aC as MinimumLogLevel, aD as Struct, aE as ApprovalRequest, aF as QuestionRequest, aG as SecretRequest, aH as Thread, aI as TaggedError$1, aJ as seconds, aK as decodeUnknownExit, aL as fromJsonString, aM as ServerFrame, aN as acquireRelease, aO as unbounded, aP as endUnsafe, aQ as encodeUnknownEffect, aR as RpcMethods, aS as timeoutOrElse, aT as callback, aU as methodKind, aV as offerUnsafe, aW as WebSocket, aX as REMOTE_PATH, aY as REMOTE_MAX_FRAME_BYTES, aZ as succeedNone, a_ as cliSocketPath, a$ as all, b0 as fromResult, b1 as Number$2, b2 as forEach, b3 as NullOr, b4 as Routine, b5 as AccessMode, b6 as ProviderId, b7 as promise, b8 as isFailure, b9 as toCheckoutTarget, ba as noticeEvents, bb as PushEvent, bc as ThreadStatus, bd as try_, be as as, bf as isThreadBusy, bg as tryPromise, bh as map$4, bi as packageJson, bj as tapError, bk as provide, bl as layer$1 } from "./chunks/remote-ghM8OLgn.js";
3
+ import { d as dual, r as runFork, t as tapCause, h as hasInterruptsOnly, v as void_, s as squash, l as logError, c as constVoid, i as isEffect, a as isSuccess, w as withFiber, C as ConsoleRef, b as sync, T as TaggedError, A as ArraySchema, S as String$6, U as Union, e as hasProperty, o as optional$3, L as Literal, f as optionalKey, D as Defect, g as format, j as toCodecStringTree, k as decodeUnknownEffect, m as identity, n as succeed$2, p as fail, q as is, u as TrueLiterals, F as FalseLiterals, x as mapError, B as BooleanLiterals, I as Int$4, R as Reference, y as fnUntraced, z as scoped, Q as QuitError, E as Terminal, G as cached, H as suspend, P as Prototype, J as getOrElse, K as some, M as match, N as none, O as make$2, V as map$2, W as taggedEnum, X as match$1, Y as map$3, Z as isSome, _ as flatMap$1, $ as sync$1, a0 as empty, a1 as reduce, a2 as pipe, a3 as match$2, a4 as findFirstIndex, a5 as findFirst, a6 as findLast, a7 as isReadonlyArrayNonEmpty, a8 as ensuring, a9 as orDie, aa as take, ab as raceFirst, ac as round, ad as pipeArguments, ae as catchTags, af as fromUndefinedOr, ag as isNotUndefined, ah as getOrUndefined, ai as assignProperty, aj as Service, ak as empty$1, al as exists, am as gen, an as isNone, ao as succeed$3, ap as value, aq as provideService, ar as Stdio, as as catchFilter, at as isQuitError, au as succeed$4, av as fail$1, aw as interrupt, ax as andThen, ay as catchTag, az as result, aA as make$3, aB as provideContext, aC as MinimumLogLevel, aD as Struct, aE as ApprovalRequest, aF as QuestionRequest, aG as SecretRequest, aH as Thread, aI as TaggedError$1, aJ as seconds, aK as decodeUnknownExit, aL as fromJsonString, aM as ServerFrame, aN as acquireRelease, aO as unbounded, aP as endUnsafe, aQ as encodeUnknownEffect, aR as RpcMethods, aS as timeoutOrElse, aT as callback, aU as methodKind, aV as offerUnsafe, aW as WebSocket, aX as REMOTE_PATH, aY as REMOTE_MAX_FRAME_BYTES, aZ as succeedNone, a_ as cliSocketPath, a$ as all, b0 as fromResult, b1 as Number$2, b2 as forEach, b3 as NullOr, b4 as Routine, b5 as AccessMode, b6 as ProviderId, b7 as promise, b8 as isFailure, b9 as toCheckoutTarget, ba as noticeEvents, bb as PushEvent, bc as ThreadStatus, bd as try_, be as as, bf as isThreadBusy, bg as tryPromise, bh as map$4, bi as packageJson, bj as tapError, bk as provide, bl as layer$1 } from "./chunks/remote-CuntvZqY.js";
4
4
  import { homedir } from "node:os";
5
5
  import { resolve, sep, join } from "node:path";
6
6
  import { randomUUID } from "node:crypto";
@@ -7,7 +7,7 @@ import { homedir, tmpdir, networkInterfaces, hostname, userInfo, loadavg, cpus,
7
7
  import path__default, { join as join$1, sep, resolve as resolve$1, basename, relative, dirname, isAbsolute, extname, delimiter } from "node:path";
8
8
  import { isSea } from "node:sea";
9
9
  import NodeUrl__default, { fileURLToPath } from "node:url";
10
- import { d as dual, ai as assignProperty, b8 as isFailure, au as succeed, av as fail$1, K as some, N as none, bm as hash, bn as equals, ad as pipeArguments, bo as NodeInspectSymbol, bp as toJson, g as format$2, Z as isSome, bq as withFiber, br as uninterruptibleMask, bs as get$7, bt as Scope, bu as flow$1, bv as fromInputUnsafe, bw as constant, bx as zero, be as as, by as addFinalizerExit, v as void_, b2 as forEach, bz as exit, bA as tap$1, $ as sync, aw as interrupt, p as fail$2, bB as ExceededCapacityError, bC as makeUnsafe$5, bD as makeUnsafe$6, bE as makeUnsafe$7, H as suspend, bF as runForkWith, bG as runIn, bH as hasInterrupts, bI as doneUnsafe, bJ as getUnsafe$1, bK as addFinalizer, ax as andThen, bL as _await, bM as getCurrent, bN as interrupt$1, bO as close, bP as isZero, bQ as isFinite$1, bR as Clock, bS as toMillis, _ as flatMap, bT as millis, a8 as ensuring, bU as void_$1, bV as getOrThrow, e as hasProperty, bW as BaseProto, aI as TaggedError, bX as Error$1, bY as toSeconds, bZ as symbol$2, b_ as structure, b$ as symbol$3, c0 as redact$1, c1 as symbolRedactable, O as make$1p, R as Reference, c2 as strictEqual, c3 as map$1, c4 as try_, c5 as flatMap$1, c6 as combine, c7 as string$2, c8 as number$4, c9 as optimize, ca as contextWith, w as withFiber$1, b as sync$1, cb as infinity, cc as PipeInspectableProto, cd as updateContext, ce as merge$4, cf as succeed$1, cg as exitHasInterrupts, ch as ClockRef, ci as forkUnsafe, cj as onExitUnsafe, ck as void_$2, cl as fiberInterrupt, cm as fiberJoin, cn as filterMap, co as failVoid, cp as isGreaterThanOrEqualTo$1, cq as LogLevelOrder, aN as acquireRelease, i as isEffect, cr as interruptAs, n as succeed$2, r as runFork, cs as isFailure$1, h as hasInterruptsOnly, ct as into, cu as asVoid, cv as done, cw as filterInterruptors, cx as interruptAllAs, cy as interruptAll, cz as empty$5, cA as forkUnsafe$1, cB as runPromise, cC as runPromiseWith, cD as runPromiseExit, cE as runPromiseExitWith, cF as runSync, cG as runSyncWith, cH as runSyncExit, cI as runSyncExitWith, cJ as runCallback, cK as runCallbackWith, cL as makeMemoMapUnsafe, aB as provideContext, cM as buildWithMemoMap, cN as flatten, cO as await_, cP as scopeRemoveFinalizerUnsafe, cQ as die, cR as isResult, cS as isSuccess$1, m as identity, cT as set$5, cU as make$1q, cV as effect, aj as Service$1, cW as contextWith$1, cX as getOrUndefined, am as gen, cY as context, cZ as make$1r, V as map$2, c_ as fromQueue, c$ as unwrap, aq as provideService, d0 as onExit, d1 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, d2 as makeSpanUnsafe, d3 as TracerTimingEnabled, d4 as endSpan, d5 as makeSpanScoped, d6 as useSpan, d7 as constUndefined, d8 as provideService$1, d9 as ParentSpan, z as scoped, t as tapCause, y as fnUntraced, da as serviceOption, a3 as match, db as make$1s, dc as provide$1, dd as onError, de as catchIf, df as scope$1, dg as getOption, dh as onExitPrimitive, a as isSuccess$2, di as catchCause, dj as matchCauseEffect, dk as failCause, dl as combine$1, a9 as orDie, dm as add$1, dn as makeUnsafe$8, dp as fromReasons, dq as isFailReason, dr as makeDieReason, ds as reasonAnnotations, dt as failCause$1, du as yieldNow, dv as constTrue, dw as normalizeNonEmpty, dx as unbounded, dy as publishUnsafe, dz as fromPubSub, dA as getDefaultExportFromCjs, a$ as all$1, M as match$1, b7 as promise$1, b6 as ProviderId, dB as now, dC as formatIso, a2 as pipe$2, dD as sort, Y as map$3, dE as flatMapNullishOr, dF as catch_, bh as map$4, dG as fromNullishOr, x as mapError, dH as logDebug, dI as annotateLogs, dJ as withSpan, ay as catchTag, dK as logInfo, dL as catchDefect, dM as filterOrFail, dN as make$1t, dO as Number$1, dP as encodeEffect, k as decodeUnknownEffect, aZ as succeedNone, a7 as isReadonlyArrayNonEmpty, dQ as asSome, dR as mutable, A as ArraySchema, dS as NoSuchElementError, dT as Literals, b1 as Number$2, b3 as NullOr, aD as Struct, dU as FileSystem, dV as orElseSucceed, dW as chatFolder, dX as Boolean$1, dY as ProjectKind, dZ as ignore$1, d_ as logWarning, aT as callback, d$ as sleep$3, e0 as forkDetach, e1 as signedOutFailure, e2 as succeed$3, e3 as decodeUnknownOption, an as isNone, aL as fromJsonString, L as Literal, e4 as Unknown, e5 as toArray, aJ as seconds, f as optionalKey, e6 as cachedWithTTL, e7 as minutes, aO as unbounded$1, e8 as toAsyncIterable, bg as tryPromise, e9 as timeout, ea as addFinalizer$1, eb as callback$1, ec as offer, ed as withPermit, ee as acquireUseRelease, aP as endUnsafe, ef as shutdownUnsafe, eg as make$1u, bd as try_$1, bj as tapError, eh as forkIn, ei as fromAsyncIterable, ej as runForEach, s as squash, ek as CLAUDE_EFFORT_LEVELS, el as ensuring$1, em as currentTimeMillis, en as sum, eo as race, ep as publishedArtifactId, eq as PUBLISH_DOCUMENT_TOOL, er as PUBLISH_ARTIFACT_TOOL, es as PUBLISH_WHITEBOARD_TOOL, et as isDone, eu as empty$6, ev as succeed$4, ew as fromIterable$2, ex as flatMap$2, ey as interruptWhen, ez as concat, eA as fromEffectDrain, eB as fromEffect, eC as fromIterableEffect, eD as suspend$1, eE as unlistedModel, eF as make$1v, eG as tap$2, eH as tick, eI as map$5, eJ as drop, eK as merge$5, eL as onInterrupt, aS as timeoutOrElse, eM as format$3, eN as getOrNull, eO as Record, eP as make$1w, aa as take, eQ as join$2, ab as raceFirst, eR as end, eS as takeUnsafe, eT as forkScoped, eU as isObject$2, J as getOrElse, eV as repeat, ao as succeed$5, eW as subscribe, eX as fromSubscription, eY as applySettingsPatch, eZ as publish, e_ as defaultSettings, e$ as Settings$2, f0 as vmProviderBeforeTheChoice, f1 as flatMapNullishOr$1, f2 as option, f3 as delay, f4 as isTailscaleHost, f5 as PRIVATE_NETWORKS, f6 as RelayHostList, f7 as RelayMachineList, f8 as encodeSync, f9 as mergeAll, bb as PushEvent, fa as makeUnsafe$9, fb as effectDiscard, fc as changes$1, fd as Void, fe as AppConnection, ff as decodeEffect, fg as toCodecJson, fh as RecordFromUrlParams, fi as decodeTo, fj as externalSpan, fk as isOption, fl as isExit, af as fromUndefinedOr, fm as zero$1, fn as fromInput$1, fo as badArgument, fp as isSchemaError, fq as isNoSuchElementError, fr as StackTrace, fs as mapEager, ft as updateContext$1, fu as makeUnsafe$a, fv as tag$2, fw as Error$2, I as Int, fx as fromInputUnsafe$1, fy as Path, fz as run$5, fA as mebibytes, fB as Class, fC as constFalse, fD as withLogSpan, fE as log, ah as getOrUndefined$1, fF as Tracer, fG as nativeTracer, fH as hasInterrupts$1, fI as succeed$6, fJ as setStackTraceLimit, fK as fail$3, fL as getStackTraceLimit, fM as fiberEnterUninterruptibleUnsafe, fN as contA, fO as effectIsExit, fP as closeUnsafe, fQ as contE, fR as reportCauseUnsafe, fS as matchCauseEffectEager, fT as flatMapEager, fU as provideMerge, fV as fromInput$2, fW as fromReadable, fX as toArrayBuffer, G as cached$1, fY as provide$2, fZ as layer$X, f_ as pipeThroughDuplex, f$ as toUint8Array, bl as layer$Y, b0 as fromResult, g0 as WebSocketServer, g1 as orDie$1, g2 as runForEachArray, g3 as interruptible, g4 as die$1, g5 as Duration, g6 as DateTimeUtc, g7 as withConstructorDefault, g8 as withDecodingDefault, g9 as Redacted, ga as Tuple, gb as isRedacted, gc as MutableJson, ag as isNotUndefined, gd as Never, ak as empty$7, ge as toJsonSchemaDocument, gf as effectContext, gg as annotateCurrentSpan, gh as isUndefined, az as result$1, gi as failCause$2, gj as forkChild, gk as catch_$1, gl as isSchemaError$1, gm as failCause$3, gn as mapEffect, go as onEnd, gp as isSchema, aQ as encodeUnknownEffect, gq as annotate, gr as fail$4, aA as make$1x, gs as make$1y, gt as declare, gu as isStream, gv as Class$1, gw as Exit, gx as getOrUndefinedUnsafe, bk as provide$3, gy as provideContext$1, gz as Opaque, gA as StructWithRest, gB as JsonObject$3, gC as transformOptional, gD as flatMap$3, gE as toType, gF as Any, gG as UndefinedOr, gH as Finite, gI as passthrough, gJ as Uint8ArrayFromBase64, gK as Json, gL as TemplateLiteral, gM as decode$3, gN as withDefault, gO as isBetween, W as taggedEnum, gP as take$1, gQ as isNullish, gR as isString, gS as never$1, gT as bounded, gU as withParentSpan, gV as die$2, gW as offerAll, gX as decodeSync, l as logError, gY as NonEmptyArray, gZ as interrupt$2, g_ as interruptors, g$ as catchCauseIf, h0 as decode$4, h1 as decodeUnknownResult, h2 as fn, h3 as isTagged, h4 as isReadonlyObject, h5 as IllegalArgumentError, h6 as encode$1, h7 as omit$1, h8 as merge$6, h9 as succeedContext, ha as unwrap$1, hb as CurrentMemoMap, hc as fromIterable$3, hd as reverse, a0 as empty$8, he as withFiberSucceed, hf as fiberEnterInterruptibleUnsafe, hg as compose$1, hh as collect, hi as catchDone, hj as takeAll, hk as fromArray, hl as whileLoop, hm as matchEffect, hn as defaultFormatter, ho as logFatal, hp as isDeferred, hq as hasDies, c as constVoid, hr as shutdown, hs as Scheduler$1, ae as catchTags, ht as CurrentLogLevel, q as is$2, hu as UnknownFromJsonString, hv as ignoreCause, hw as forever, hx as Class$2, hy as TaggedStruct, hz as toEncoded, hA as isMaxLength, hB as makeFilter, hC as isPattern, hD as runLast, hE as fromOption, hF as decodeUnknownSync, hG as spawnsSubagent, hH as isPublishArtifactTool, hI as outputText, hJ as publishedArtifact, hK as toolArgument, hL as isPublishDocumentTool, hM as commonjsGlobal, hN as isRunAgentTool, hO as presetModels, hP as filter$1, hQ as take$2, hR as runDrain, hS as min, hT as ChildProcessSpawner, hU as make$1z, hV as mkString, hW as decodeText$1, hX as ForkPoint, hY as TokenUsage, hZ as MessagePart, h_ as Message, h$ as parseGitHubPullRequestUrl, i0 as PullRequestReviewer, i1 as PullRequestLabel, i2 as PullRequestComment, i3 as DiffSide, i4 as subtract, i5 as PULL_REQUEST_REFRESH, i6 as parseGitHubIssueUrl, i7 as parseGitHubRepository, i8 as request$2, i9 as Class$3, ia as AgentProfile, ib as AccountProviderId, ic as ProjectAction, id as Project, ie as BooleanFromBit, ig as Worktree, ih as timeoutOption, bf as isThreadBusy, bc as ThreadStatus, ii as ScheduledMessage, ij as QueuedMessage, ik as UsageLimit, aH as Thread, il as getOrThrow$1, im as PullRequestWatch, io as PullRequestLink, ip as allWatchEventKinds, iq as enabledProviders, ir as transcriptThreadId, is as resumeGraceMs, it as fail$5, iu as isDoneUnsafe, iv as filter$2, iw as WAIT_AGENT_TOOL, ix as startingProvider, iy as kilobytes, iz as monotonicTimeNanos, iA as retry$3, iB as spaced, iC as die$3, iD as snakeToCamel, iE as camelToSnake, iF as UpdatableProviderId, iG as filter$3, iH as AgentAccount, iI as schedule, aR as RpcMethods, iJ as BrowserFrame, iK as PagePick, iL as defaultClientSettings, iM as ClientSettings$1, iN as parsePairingUrl, iO as pairingUrl, aM as ServerFrame, iP as Environment, iQ as relayWebSocketUrl, iR as remoteWebSocketUrl, aW as WebSocket$1, iS as CHALLENGE_WAIT_MS, aU as methodKind, iT as dialPlan, iU as REMOTE_PROTOCOL_VERSION, iV as DIRECT_CHECK_INTERVAL_MS, iW as DIRECT_CHECK_TIMEOUT_MS, iX as next, iY as bytes, iZ as Timestamp, i_ as RoutineSchedule, i$ as RoutineRun, j0 as launch, j1 as uninterruptible, j2 as parseUnsafe, j3 as RoutineWorkspace, j4 as LinearIssue, j5 as when$2, j6 as threadDeviceId, j7 as shownScreen, j8 as devicePlatformOf, ap as value$2, j9 as BoatVmSize, ja as RUN_AGENT_TOOL, jb as ARTIFACT_THEME_GUIDE, jc as DeviceUrl, jd as DeviceApp, je as DeviceButton, jf as WatchEventKind, jg as GuideGroup, jh as PullRequestGuide, ji as flatten$1, jj as diskFullness, jk as pretty, jl as min$1, jm as exponential, jn as desktopOnlyPushes, jo as reachesPhone, jp as mutations, jq as desktopOnlyMethods, jr as isAddressNotUpYet, js as ClientFrame, aY as REMOTE_MAX_FRAME_BYTES, aX as REMOTE_PATH, jt as empty$9, a_ as cliSocketPath, ju as RemoteFeature, jv as BindHost, jw as getAugmentedNamespace, jx as make$1A, jy as NativeSpan, jz as currentTimeNanos, aC as MinimumLogLevel, bi as packageJson, jA as isPortInUse } from "./chunks/remote-ghM8OLgn.js";
10
+ import { d as dual, ai as assignProperty, b8 as isFailure, au as succeed, av as fail$1, K as some, N as none, bm as hash, bn as equals, ad as pipeArguments, bo as NodeInspectSymbol, bp as toJson, g as format$2, Z as isSome, bq as withFiber, br as uninterruptibleMask, bs as get$7, bt as Scope, bu as flow$1, bv as fromInputUnsafe, bw as constant, bx as zero, be as as, by as addFinalizerExit, v as void_, b2 as forEach, bz as exit, bA as tap$1, $ as sync, aw as interrupt, p as fail$2, bB as ExceededCapacityError, bC as makeUnsafe$5, bD as makeUnsafe$6, bE as makeUnsafe$7, H as suspend, bF as runForkWith, bG as runIn, bH as hasInterrupts, bI as doneUnsafe, bJ as getUnsafe$1, bK as addFinalizer, ax as andThen, bL as _await, bM as getCurrent, bN as interrupt$1, bO as close, bP as isZero, bQ as isFinite$1, bR as Clock, bS as toMillis, _ as flatMap, bT as millis, a8 as ensuring, bU as void_$1, bV as getOrThrow, e as hasProperty, bW as BaseProto, aI as TaggedError, bX as Error$1, bY as toSeconds, bZ as symbol$2, b_ as structure, b$ as symbol$3, c0 as redact$1, c1 as symbolRedactable, O as make$1p, R as Reference, c2 as strictEqual, c3 as map$1, c4 as try_, c5 as flatMap$1, c6 as combine, c7 as string$2, c8 as number$4, c9 as optimize, ca as contextWith, w as withFiber$1, b as sync$1, cb as infinity, cc as PipeInspectableProto, cd as updateContext, ce as merge$4, cf as succeed$1, cg as exitHasInterrupts, ch as ClockRef, ci as forkUnsafe, cj as onExitUnsafe, ck as void_$2, cl as fiberInterrupt, cm as fiberJoin, cn as filterMap, co as failVoid, cp as isGreaterThanOrEqualTo$1, cq as LogLevelOrder, aN as acquireRelease, i as isEffect, cr as interruptAs, n as succeed$2, r as runFork, cs as isFailure$1, h as hasInterruptsOnly, ct as into, cu as asVoid, cv as done, cw as filterInterruptors, cx as interruptAllAs, cy as interruptAll, cz as empty$5, cA as forkUnsafe$1, cB as runPromise, cC as runPromiseWith, cD as runPromiseExit, cE as runPromiseExitWith, cF as runSync, cG as runSyncWith, cH as runSyncExit, cI as runSyncExitWith, cJ as runCallback, cK as runCallbackWith, cL as makeMemoMapUnsafe, aB as provideContext, cM as buildWithMemoMap, cN as flatten, cO as await_, cP as scopeRemoveFinalizerUnsafe, cQ as die, cR as isResult, cS as isSuccess$1, m as identity, cT as set$5, cU as make$1q, cV as effect, aj as Service$1, cW as contextWith$1, cX as getOrUndefined, am as gen, cY as context, cZ as make$1r, V as map$2, c_ as fromQueue, c$ as unwrap, aq as provideService, d0 as onExit, d1 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, d2 as makeSpanUnsafe, d3 as TracerTimingEnabled, d4 as endSpan, d5 as makeSpanScoped, d6 as useSpan, d7 as constUndefined, d8 as provideService$1, d9 as ParentSpan, z as scoped, t as tapCause, y as fnUntraced, da as serviceOption, a3 as match, db as make$1s, dc as provide$1, dd as onError, de as catchIf, df as scope$1, dg as getOption, dh as onExitPrimitive, a as isSuccess$2, di as catchCause, dj as matchCauseEffect, dk as failCause, dl as combine$1, a9 as orDie, dm as add$1, dn as makeUnsafe$8, dp as fromReasons, dq as isFailReason, dr as makeDieReason, ds as reasonAnnotations, dt as failCause$1, du as yieldNow, dv as constTrue, dw as normalizeNonEmpty, dx as unbounded, dy as publishUnsafe, dz as fromPubSub, dA as getDefaultExportFromCjs, a$ as all$1, M as match$1, b7 as promise$1, b6 as ProviderId, dB as now, dC as formatIso, a2 as pipe$2, dD as sort, Y as map$3, dE as flatMapNullishOr, dF as catch_, bh as map$4, dG as fromNullishOr, x as mapError, dH as logDebug, dI as annotateLogs, dJ as withSpan, ay as catchTag, dK as logInfo, dL as catchDefect, dM as filterOrFail, dN as make$1t, dO as Number$1, dP as encodeEffect, k as decodeUnknownEffect, aZ as succeedNone, a7 as isReadonlyArrayNonEmpty, dQ as asSome, dR as mutable, A as ArraySchema, dS as NoSuchElementError, dT as Literals, b1 as Number$2, b3 as NullOr, aD as Struct, dU as FileSystem, dV as orElseSucceed, dW as chatFolder, dX as Boolean$1, dY as ProjectKind, dZ as ignore$1, d_ as logWarning, aT as callback, d$ as sleep$3, e0 as forkDetach, e1 as signedOutFailure, e2 as succeed$3, e3 as decodeUnknownOption, an as isNone, aL as fromJsonString, L as Literal, e4 as Unknown, e5 as toArray, aJ as seconds, f as optionalKey, e6 as cachedWithTTL, e7 as minutes, aO as unbounded$1, e8 as toAsyncIterable, bg as tryPromise, e9 as timeout, ea as addFinalizer$1, eb as callback$1, ec as offer, ed as withPermit, ee as acquireUseRelease, aP as endUnsafe, ef as shutdownUnsafe, eg as make$1u, bd as try_$1, bj as tapError, eh as forkIn, ei as fromAsyncIterable, ej as runForEach, s as squash, ek as CLAUDE_EFFORT_LEVELS, el as ensuring$1, em as currentTimeMillis, en as sum, eo as race, ep as publishedArtifactId, eq as PUBLISH_DOCUMENT_TOOL, er as PUBLISH_ARTIFACT_TOOL, es as PUBLISH_WHITEBOARD_TOOL, et as isDone, eu as empty$6, ev as succeed$4, ew as fromIterable$2, ex as flatMap$2, ey as interruptWhen, ez as concat, eA as fromEffectDrain, eB as fromEffect, eC as fromIterableEffect, eD as suspend$1, eE as unlistedModel, eF as make$1v, eG as tap$2, eH as tick, eI as map$5, eJ as drop, eK as merge$5, eL as onInterrupt, aS as timeoutOrElse, eM as format$3, eN as getOrNull, eO as Record, eP as make$1w, aa as take, eQ as join$2, ab as raceFirst, eR as end, eS as takeUnsafe, eT as forkScoped, eU as isObject$2, J as getOrElse, eV as repeat, ao as succeed$5, eW as subscribe, eX as fromSubscription, eY as applySettingsPatch, eZ as publish, e_ as defaultSettings, e$ as Settings$2, f0 as vmProviderBeforeTheChoice, f1 as flatMapNullishOr$1, f2 as option, f3 as delay, f4 as isTailscaleHost, f5 as PRIVATE_NETWORKS, f6 as RelayHostList, f7 as RelayMachineList, f8 as encodeSync, f9 as mergeAll, bb as PushEvent, fa as makeUnsafe$9, fb as effectDiscard, fc as changes$1, fd as Void, fe as AppConnection, ff as decodeEffect, fg as toCodecJson, fh as RecordFromUrlParams, fi as decodeTo, fj as externalSpan, fk as isOption, fl as isExit, af as fromUndefinedOr, fm as zero$1, fn as fromInput$1, fo as badArgument, fp as isSchemaError, fq as isNoSuchElementError, fr as StackTrace, fs as mapEager, ft as updateContext$1, fu as makeUnsafe$a, fv as tag$2, fw as Error$2, I as Int, fx as fromInputUnsafe$1, fy as Path, fz as run$5, fA as mebibytes, fB as Class, fC as constFalse, fD as withLogSpan, fE as log, ah as getOrUndefined$1, fF as Tracer, fG as nativeTracer, fH as hasInterrupts$1, fI as succeed$6, fJ as setStackTraceLimit, fK as fail$3, fL as getStackTraceLimit, fM as fiberEnterUninterruptibleUnsafe, fN as contA, fO as effectIsExit, fP as closeUnsafe, fQ as contE, fR as reportCauseUnsafe, fS as matchCauseEffectEager, fT as flatMapEager, fU as provideMerge, fV as fromInput$2, fW as fromReadable, fX as toArrayBuffer, G as cached$1, fY as provide$2, fZ as layer$X, f_ as pipeThroughDuplex, f$ as toUint8Array, bl as layer$Y, b0 as fromResult, g0 as WebSocketServer, g1 as orDie$1, g2 as runForEachArray, g3 as interruptible, g4 as die$1, g5 as Duration, g6 as DateTimeUtc, g7 as withConstructorDefault, g8 as withDecodingDefault, g9 as Redacted, ga as Tuple, gb as isRedacted, gc as MutableJson, ag as isNotUndefined, gd as Never, ak as empty$7, ge as toJsonSchemaDocument, gf as effectContext, gg as annotateCurrentSpan, gh as isUndefined, az as result$1, gi as failCause$2, gj as forkChild, gk as catch_$1, gl as isSchemaError$1, gm as failCause$3, gn as mapEffect, go as onEnd, gp as isSchema, aQ as encodeUnknownEffect, gq as annotate, gr as fail$4, aA as make$1x, gs as make$1y, gt as declare, gu as isStream, gv as Class$1, gw as Exit, gx as getOrUndefinedUnsafe, bk as provide$3, gy as provideContext$1, gz as Opaque, gA as StructWithRest, gB as JsonObject$3, gC as transformOptional, gD as flatMap$3, gE as toType, gF as Any, gG as UndefinedOr, gH as Finite, gI as passthrough, gJ as Uint8ArrayFromBase64, gK as Json, gL as TemplateLiteral, gM as decode$3, gN as withDefault, gO as isBetween, W as taggedEnum, gP as take$1, gQ as isNullish, gR as isString, gS as never$1, gT as bounded, gU as withParentSpan, gV as die$2, gW as offerAll, gX as decodeSync, l as logError, gY as NonEmptyArray, gZ as interrupt$2, g_ as interruptors, g$ as catchCauseIf, h0 as decode$4, h1 as decodeUnknownResult, h2 as fn, h3 as isTagged, h4 as isReadonlyObject, h5 as IllegalArgumentError, h6 as encode$1, h7 as omit$1, h8 as merge$6, h9 as succeedContext, ha as unwrap$1, hb as CurrentMemoMap, hc as fromIterable$3, hd as reverse, a0 as empty$8, he as withFiberSucceed, hf as fiberEnterInterruptibleUnsafe, hg as compose$1, hh as collect, hi as catchDone, hj as takeAll, hk as fromArray, hl as whileLoop, hm as matchEffect, hn as defaultFormatter, ho as logFatal, hp as isDeferred, hq as hasDies, c as constVoid, hr as shutdown, hs as Scheduler$1, ae as catchTags, ht as CurrentLogLevel, q as is$2, hu as UnknownFromJsonString, hv as ignoreCause, hw as forever, hx as Class$2, hy as TaggedStruct, hz as toEncoded, hA as isMaxLength, hB as makeFilter, hC as isPattern, hD as runLast, hE as fromOption, hF as decodeUnknownSync, hG as spawnsSubagent, hH as isPublishArtifactTool, hI as outputText, hJ as publishedArtifact, hK as toolArgument, hL as isPublishDocumentTool, hM as commonjsGlobal, hN as isRunAgentTool, hO as presetModels, hP as filter$1, hQ as take$2, hR as runDrain, hS as min, hT as ChildProcessSpawner, hU as make$1z, hV as mkString, hW as decodeText$1, hX as ForkPoint, hY as TokenUsage, hZ as MessagePart, h_ as Message, h$ as parseGitHubPullRequestUrl, i0 as PullRequestReviewer, i1 as PullRequestLabel, i2 as PullRequestComment, i3 as DiffSide, i4 as subtract, i5 as PULL_REQUEST_REFRESH, i6 as parseGitHubIssueUrl, i7 as parseGitHubRepository, i8 as request$2, i9 as Class$3, ia as AgentProfile, ib as AccountProviderId, ic as ProjectAction, id as Project, ie as BooleanFromBit, ig as Worktree, ih as timeoutOption, bf as isThreadBusy, bc as ThreadStatus, ii as ScheduledMessage, ij as QueuedMessage, ik as UsageLimit, aH as Thread, il as getOrThrow$1, im as PullRequestWatch, io as PullRequestLink, ip as allWatchEventKinds, iq as WAIT_AGENT_TOOL, ir as enabledProviders, is as transcriptThreadId, it as resumeGraceMs, iu as fail$5, iv as isDoneUnsafe, iw as filter$2, ix as startingProvider, iy as kilobytes, iz as monotonicTimeNanos, iA as retry$3, iB as spaced, iC as die$3, iD as snakeToCamel, iE as camelToSnake, iF as UpdatableProviderId, iG as filter$3, iH as AgentAccount, iI as schedule, aR as RpcMethods, iJ as BrowserFrame, iK as PagePick, iL as defaultClientSettings, iM as ClientSettings$1, iN as parsePairingUrl, iO as pairingUrl, aM as ServerFrame, iP as Environment, iQ as relayWebSocketUrl, iR as remoteWebSocketUrl, aW as WebSocket$1, iS as CHALLENGE_WAIT_MS, aU as methodKind, iT as dialPlan, iU as REMOTE_PROTOCOL_VERSION, iV as DIRECT_CHECK_INTERVAL_MS, iW as DIRECT_CHECK_TIMEOUT_MS, iX as next, iY as bytes, iZ as Timestamp, i_ as RoutineSchedule, i$ as RoutineRun, j0 as launch, j1 as uninterruptible, j2 as parseUnsafe, j3 as RoutineWorkspace, j4 as LinearIssue, j5 as when$2, j6 as threadDeviceId, j7 as shownScreen, j8 as devicePlatformOf, ap as value$2, j9 as BoatVmSize, ja as RUN_AGENT_TOOL, jb as ARTIFACT_THEME_GUIDE, jc as DeviceUrl, jd as DeviceApp, je as DeviceButton, jf as WatchEventKind, jg as GuideGroup, jh as PullRequestGuide, ji as flatten$1, jj as diskFullness, jk as pretty, jl as min$1, jm as exponential, jn as desktopOnlyPushes, jo as reachesPhone, jp as mutations, jq as desktopOnlyMethods, jr as isAddressNotUpYet, js as ClientFrame, aY as REMOTE_MAX_FRAME_BYTES, aX as REMOTE_PATH, jt as empty$9, a_ as cliSocketPath, ju as RemoteFeature, jv as BindHost, jw as getAugmentedNamespace, jx as make$1A, jy as NativeSpan, jz as currentTimeNanos, aC as MinimumLogLevel, bi as packageJson, jA as isPortInUse } from "./chunks/remote-CuntvZqY.js";
11
11
  import Ee__default from "fs";
12
12
  import require$$0 from "util";
13
13
  import require$$1$1 from "stream";
@@ -2083,11 +2083,11 @@ const make$1f = (acquirer, compiler, spanAttributes2, transformRows, borrower) =
2083
2083
  if (cache2.has(acquirer)) {
2084
2084
  return cache2.get(acquirer);
2085
2085
  }
2086
- const self2 = Object.assign(function sql(strings, ...args) {
2087
- if (typeof strings === "string") {
2088
- return identifier(strings);
2089
- } else if (Array.isArray(strings) && "raw" in strings) {
2090
- return statement(acquirer, compiler, strings, args, spanAttributes2, transformRows, borrower);
2086
+ const self2 = Object.assign(function sql(strings2, ...args) {
2087
+ if (typeof strings2 === "string") {
2088
+ return identifier(strings2);
2089
+ } else if (Array.isArray(strings2) && "raw" in strings2) {
2090
+ return statement(acquirer, compiler, strings2, args, spanAttributes2, transformRows, borrower);
2091
2091
  }
2092
2092
  throw "absurd";
2093
2093
  }, {
@@ -2125,8 +2125,8 @@ const constructorCache = {
2125
2125
  transforms: /* @__PURE__ */ new WeakMap(),
2126
2126
  noTransforms: /* @__PURE__ */ new WeakMap()
2127
2127
  };
2128
- const statement = (acquirer, compiler, strings, args, spanAttributes2, transformRows, borrower) => {
2129
- const segments2 = strings[0].length > 0 ? [literal$1(strings[0])] : [];
2128
+ const statement = (acquirer, compiler, strings2, args, spanAttributes2, transformRows, borrower) => {
2129
+ const segments2 = strings2[0].length > 0 ? [literal$1(strings2[0])] : [];
2130
2130
  for (let i = 0; i < args.length; i++) {
2131
2131
  const arg = args[i];
2132
2132
  if (isFragment(arg)) {
@@ -2136,8 +2136,8 @@ const statement = (acquirer, compiler, strings, args, spanAttributes2, transform
2136
2136
  } else {
2137
2137
  segments2.push(parameter(arg));
2138
2138
  }
2139
- if (strings[i + 1].length > 0) {
2140
- segments2.push(literal$1(strings[i + 1]));
2139
+ if (strings2[i + 1].length > 0) {
2140
+ segments2.push(literal$1(strings2[i + 1]));
2141
2141
  }
2142
2142
  }
2143
2143
  return makeUnsafe(segments2, acquirer, compiler, spanAttributes2, transformRows, borrower);
@@ -8718,6 +8718,7 @@ const parseMention = (token) => {
8718
8718
  const segmentText = (segment) => segment.kind === "fence" ? [segment.open, ...segment.lines, ...segment.close === null ? [] : [segment.close]].join("\n") : segment.text;
8719
8719
  const FENCE$1 = /^\s*```\s*([^\s`]*)/;
8720
8720
  const BULLET = /^(\s*)([-*+]|\d+[.)])(?=\s)/;
8721
+ const QUOTE$1 = "> ";
8721
8722
  const RULE = /^ {0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/;
8722
8723
  const NAME = String.raw`[\w:-]+(?:\.[\w:-]+)*`;
8723
8724
  const INLINE = new RegExp(
@@ -8787,6 +8788,10 @@ function highlight(text2, known) {
8787
8788
  segments2.push({ kind: "rule", text: line });
8788
8789
  continue;
8789
8790
  }
8791
+ if (line.startsWith(QUOTE$1)) {
8792
+ segments2.push({ kind: "quote", text: QUOTE$1 }, ...inline(line.slice(QUOTE$1.length), known));
8793
+ continue;
8794
+ }
8790
8795
  const bullet2 = BULLET.exec(line);
8791
8796
  const markerEnd = bullet2 ? bullet2[0].length : 0;
8792
8797
  if (bullet2) segments2.push({ kind: "text", text: bullet2[1] ?? "" }, { kind: "bullet", text: bullet2[2] ?? "" });
@@ -9088,8 +9093,8 @@ function cleanRegex(source) {
9088
9093
  const end2 = source.endsWith("$") ? source.length - 1 : source.length;
9089
9094
  return source.slice(start, end2);
9090
9095
  }
9091
- function floatSafeRemainder(val, step) {
9092
- const ratio = val / step;
9096
+ function floatSafeRemainder(val, step2) {
9097
+ const ratio = val / step2;
9093
9098
  const roundedRatio = Math.round(ratio);
9094
9099
  const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
9095
9100
  if (Math.abs(ratio - roundedRatio) < tolerance)
@@ -55612,11 +55617,11 @@ const scripts = [
55612
55617
  ];
55613
55618
  const secondsAgo = (now2, seconds2) => new Date(now2 - seconds2 * 1e3).toISOString();
55614
55619
  const callIdOf = (script) => `${script.id}-call`;
55615
- const stepEvents = (script, step, index) => {
55620
+ const stepEvents = (script, step2, index) => {
55616
55621
  const callId = `${script.id}-step-${index}`;
55617
55622
  return [
55618
- { type: "tool_call_started", callId, name: step.name, input: step.input, parentCallId: callIdOf(script) },
55619
- { type: "tool_call_finished", callId, output: step.output, isError: false }
55623
+ { type: "tool_call_started", callId, name: step2.name, input: step2.input, parentCallId: callIdOf(script) },
55624
+ { type: "tool_call_finished", callId, output: step2.output, isError: false }
55620
55625
  ];
55621
55626
  };
55622
55627
  function mockSubagents(now2) {
@@ -55649,7 +55654,7 @@ function mockSubagents(now2) {
55649
55654
  name: "Agent",
55650
55655
  input: { description: script.label, prompt: script.prompt, subagent_type: "general-purpose" }
55651
55656
  },
55652
- ...script.steps.flatMap((step, index) => stepEvents(script, step, index)),
55657
+ ...script.steps.flatMap((step2, index) => stepEvents(script, step2, index)),
55653
55658
  update2({
55654
55659
  id: script.id,
55655
55660
  ...script.provider && { provider: script.provider },
@@ -55674,14 +55679,14 @@ function mockSubagents(now2) {
55674
55679
  const current = agents.get(script.id);
55675
55680
  if (current?.status !== "running") return [];
55676
55681
  const done2 = progress.get(script.id) ?? 0;
55677
- const step = script.upcoming?.[done2];
55678
- if (step === void 0) return script.report ? finish(script, "completed", at, script.report) : [];
55682
+ const step2 = script.upcoming?.[done2];
55683
+ if (step2 === void 0) return script.report ? finish(script, "completed", at, script.report) : [];
55679
55684
  progress.set(script.id, done2 + 1);
55680
55685
  return [
55681
- ...stepEvents(script, step, script.steps.length + done2),
55686
+ ...stepEvents(script, step2, script.steps.length + done2),
55682
55687
  update2({
55683
55688
  ...current,
55684
- lastTool: step.name,
55689
+ lastTool: step2.name,
55685
55690
  toolUses: (current.toolUses ?? 0) + 1,
55686
55691
  tokens: (current.tokens ?? 0) + 2400
55687
55692
  })
@@ -55709,15 +55714,15 @@ function play(steps, controls) {
55709
55714
  };
55710
55715
  const map2 = (message2) => mapMessage(message2, state, (/* @__PURE__ */ new Date()).toISOString());
55711
55716
  let requests = 0;
55712
- const run2 = (step) => {
55713
- switch (step.type) {
55717
+ const run2 = (step2) => {
55718
+ switch (step2.type) {
55714
55719
  case "sdk":
55715
- return fromIterable$2(map2(step.message));
55720
+ return fromIterable$2(map2(step2.message));
55716
55721
  case "pause":
55717
- return fromEffectDrain(controls.sleep(step.ms));
55722
+ return fromEffectDrain(controls.sleep(step2.ms));
55718
55723
  case "approval": {
55719
55724
  const request2 = {
55720
- ...step.request,
55725
+ ...step2.request,
55721
55726
  id: `mock-approval-${controls.threadId}-${++requests}`,
55722
55727
  threadId: controls.threadId,
55723
55728
  provider: "claude"
@@ -55725,7 +55730,7 @@ function play(steps, controls) {
55725
55730
  const resolved = controls.approve(request2).pipe(
55726
55731
  map$2((reply2) => {
55727
55732
  const denied = reply2.decision === "deny";
55728
- const result2 = toolResult$3(step.callId, denied ? deniedOutput(reply2) : step.output, { isError: denied });
55733
+ const result2 = toolResult$3(step2.callId, denied ? deniedOutput(reply2) : step2.output, { isError: denied });
55729
55734
  return [{ type: "approval_resolved", requestId: request2.id }, ...map2(result2)];
55730
55735
  })
55731
55736
  );
@@ -55739,7 +55744,7 @@ function play(steps, controls) {
55739
55744
  id: `mock-question-${controls.threadId}-${++requests}`,
55740
55745
  threadId: controls.threadId,
55741
55746
  provider: "claude",
55742
- questions: step.questions
55747
+ questions: step2.questions
55743
55748
  };
55744
55749
  return concat(
55745
55750
  succeed$4({ type: "question_requested", request: request2 }),
@@ -55750,16 +55755,16 @@ function play(steps, controls) {
55750
55755
  }
55751
55756
  case "mcp": {
55752
55757
  const callId = nextCallId();
55753
- const called = controls.callTool(step.name, step.input).pipe(
55758
+ const called = controls.callTool(step2.name, step2.input).pipe(
55754
55759
  map$2(
55755
55760
  (result2) => concat(
55756
55761
  fromIterable$2(map2(toolResult$3(callId, result2.output, { isError: result2.isError }))),
55757
- fromIterable$2(step.next?.(result2) ?? []).pipe(flatMap$2(run2))
55762
+ fromIterable$2(step2.next?.(result2) ?? []).pipe(flatMap$2(run2))
55758
55763
  )
55759
55764
  )
55760
55765
  );
55761
55766
  return concat(
55762
- fromIterable$2(map2(toolUse(callId, `mcp__hinacode__${step.name}`, step.input))),
55767
+ fromIterable$2(map2(toolUse(callId, `mcp__hinacode__${step2.name}`, step2.input))),
55763
55768
  unwrap(called)
55764
55769
  );
55765
55770
  }
@@ -56945,10 +56950,13 @@ const copySession = (threadId, from, to) => tryPromise({
56945
56950
  )
56946
56951
  )
56947
56952
  );
56948
- const TERMINAL_POLL_INTERVAL = seconds(2);
56953
+ const TerminalPollInterval = Reference("hinacode/CodexTerminalPollInterval", {
56954
+ defaultValue: () => seconds(2)
56955
+ });
56949
56956
  const sameTasks = (a, b) => a.length === b.length && a.every((task, index) => task.id === b[index]?.id);
56950
56957
  const make$19 = gen(function* () {
56951
56958
  const providerScope = yield* scope$1;
56959
+ const terminalPollInterval = yield* TerminalPollInterval;
56952
56960
  const clientLock = yield* make$1w(1);
56953
56961
  const clients = /* @__PURE__ */ new Map();
56954
56962
  const getClient = (home) => withPermit(
@@ -57056,7 +57064,7 @@ const make$19 = gen(function* () {
57056
57064
  terminalsByThread.set(threadId, terminals);
57057
57065
  terminals.poll = yield* gen(function* () {
57058
57066
  while (true) {
57059
- yield* sleep$3(TERMINAL_POLL_INTERVAL);
57067
+ yield* sleep$3(terminalPollInterval);
57060
57068
  const tasks = yield* refreshTerminals(threadId, terminals);
57061
57069
  if (tasks.length === 0 && !runs.has(threadId)) return;
57062
57070
  }
@@ -62737,7 +62745,7 @@ const addHeaderAttributes = (span, phase, headers2, filter2, redactedNames) => {
62737
62745
  };
62738
62746
  const Proto$4 = /* @__PURE__ */ Object.getPrototypeOf(empty$2);
62739
62747
  const emptyMutableUnsafe = () => Object.create(Proto$4);
62740
- function make$13(strings, ...args) {
62748
+ function make$13(strings2, ...args) {
62741
62749
  const argsLength = args.length;
62742
62750
  const values2 = new Array(argsLength);
62743
62751
  const effects = [];
@@ -62754,14 +62762,14 @@ function make$13(strings, ...args) {
62754
62762
  }
62755
62763
  }
62756
62764
  if (effects.length === 0) {
62757
- return succeed$2(consolidate(strings, values2));
62765
+ return succeed$2(consolidate(strings2, values2));
62758
62766
  }
62759
62767
  return map$2(forEach(effects, ([index, effect2]) => tap$1(effect2, (value2) => sync(() => {
62760
62768
  values2[index] = primitiveToString(value2);
62761
62769
  })), {
62762
62770
  concurrency: "unbounded",
62763
62771
  discard: true
62764
- }), (_) => consolidate(strings, values2));
62772
+ }), (_) => consolidate(strings2, values2));
62765
62773
  }
62766
62774
  function primitiveToString(value2) {
62767
62775
  if (Array.isArray(value2)) {
@@ -62783,13 +62791,13 @@ function primitiveToString(value2) {
62783
62791
  }
62784
62792
  }
62785
62793
  }
62786
- function consolidate(strings, values2) {
62794
+ function consolidate(strings2, values2) {
62787
62795
  let out = "";
62788
62796
  for (let i = 0, len = values2.length; i < len; i++) {
62789
- out += strings[i];
62797
+ out += strings2[i];
62790
62798
  out += values2[i];
62791
62799
  }
62792
- return out + strings[strings.length - 1];
62800
+ return out + strings2[strings2.length - 1];
62793
62801
  }
62794
62802
  function isSuccess(u) {
62795
62803
  return isExit(u) && u._tag === "Success";
@@ -62840,13 +62848,13 @@ const text$2 = (body2, options) => {
62840
62848
  body: text$3(body2, getContentType(options, headers2))
62841
62849
  });
62842
62850
  };
62843
- const html = (strings, ...args) => {
62844
- if (typeof strings === "string") {
62845
- return text$2(strings, {
62851
+ const html = (strings2, ...args) => {
62852
+ if (typeof strings2 === "string") {
62853
+ return text$2(strings2, {
62846
62854
  contentType: "text/html"
62847
62855
  });
62848
62856
  }
62849
- return map$2(make$13(strings, ...args), (_) => text$2(_, {
62857
+ return map$2(make$13(strings2, ...args), (_) => text$2(_, {
62850
62858
  contentType: "text/html"
62851
62859
  }));
62852
62860
  };
@@ -74928,8 +74936,8 @@ class Markup {
74928
74936
  }
74929
74937
  }
74930
74938
  const escapeHtml = (value2) => value2.replace(/[&<>"']/g, (character) => `&#${character.charCodeAt(0)};`);
74931
- const markup = (strings, ...values2) => new Markup(
74932
- strings.reduce((html2, part, index) => {
74939
+ const markup = (strings2, ...values2) => new Markup(
74940
+ strings2.reduce((html2, part, index) => {
74933
74941
  const value2 = values2[index - 1];
74934
74942
  const rendered = typeof value2 === "string" ? escapeHtml(value2) : value2 instanceof Markup ? value2.html : value2.map((item) => item.html).join("");
74935
74943
  return html2 + rendered + part;
@@ -75594,7 +75602,8 @@ const compactMessage = (message2) => ({
75594
75602
  ...message2,
75595
75603
  parts: compactParts(message2.parts)
75596
75604
  });
75597
- const compactParts = (parts) => parts.filter((part) => part.type !== "tool_call" || part.parentCallId === void 0).map(compactPart);
75605
+ const isOwnPart = (part) => part.type !== "tool_call" || part.parentCallId === void 0;
75606
+ const compactParts = (parts) => parts.filter(isOwnPart).map(compactPart);
75598
75607
  function compactPushes() {
75599
75608
  const subagentCallIdsByThread = /* @__PURE__ */ new Map();
75600
75609
  return (push) => {
@@ -75646,6 +75655,8 @@ const previewPart = (part) => {
75646
75655
  return preview2 === void 0 ? part : { ...part, ...preview2 };
75647
75656
  };
75648
75657
  const previewMessage = (message2) => ({ ...message2, parts: message2.parts.map(previewPart) });
75658
+ const settledSubagentCall = (part) => !isOwnPart(part) && part.type === "tool_call" && part.status !== "running";
75659
+ const previewTranscriptMessage = (message2) => message2.completedAt === null ? previewMessage(message2) : { ...message2, parts: message2.parts.filter((part) => !settledSubagentCall(part)).map(previewPart) };
75649
75660
  function previewPush(push) {
75650
75661
  if (push.type !== "thread.event") return { ...push, message: previewMessage(push.message) };
75651
75662
  if (push.event.type !== "tool_call_finished") return push;
@@ -78890,7 +78901,7 @@ const makeExec = (spawner) => (command, args, cwd, options) => gen(function* ()
78890
78901
  stdin: "ignore",
78891
78902
  env: options?.env,
78892
78903
  extendEnv: true,
78893
- forceKillAfter: "3 seconds"
78904
+ forceKillAfter: options?.forceKillAfter ?? "3 seconds"
78894
78905
  })
78895
78906
  );
78896
78907
  const [stdout, stderr, exitCode] = yield* all$1(
@@ -79146,6 +79157,13 @@ const make$A = gen(function* () {
79146
79157
  });
79147
79158
  });
79148
79159
  const layer$H = effect(Messages, make$A);
79160
+ const PULL_REQUEST_COMMAND = /\bgh\b[^\n;&|]*\bpr\s+(merge|close|reopen|ready)\b|\bgh\s+api\b[^\n;&|]*\bpulls\b|\bglab\b[^\n;&|]*\bmr\s+(merge|close|reopen)\b|\bgit\b[^\n;&|]*\bpush\b/;
79161
+ const strings = (value2) => {
79162
+ if (typeof value2 === "string") return [value2];
79163
+ if (typeof value2 === "object" && value2 !== null) return Object.values(value2).flatMap(strings);
79164
+ return [];
79165
+ };
79166
+ const touchesPullRequest = (input) => strings(input).some((text2) => PULL_REQUEST_COMMAND.test(text2));
79149
79167
  const SEGMENT = /^[\w.-]+$/;
79150
79168
  const isProjectPath = (path2) => {
79151
79169
  const segments2 = path2.split("/");
@@ -80297,6 +80315,11 @@ const make$z = gen(function* () {
80297
80315
  return url2 === void 0 ? fail$2(new IssueUrlInvalidError({ url: raw2 })) : get$4(issueReads, url2);
80298
80316
  },
80299
80317
  pullRequestDetail: (raw2, options) => map$2(read2(raw2, options?.fresh), toPullRequestDetail$1),
80318
+ refresh: (url2) => {
80319
+ const state = lastRead.get(url2)?.state;
80320
+ if (state === void 0) return events2.publish({ type: "github.pullRequest", url: url2 });
80321
+ return state === "MERGED" ? void_ : ignore$1(reread(url2));
80322
+ },
80300
80323
  pullRequestDiff: (raw2) => ghByUrl(raw2, (url2) => ["pr", "diff", url2, "--color=never"]).pipe(
80301
80324
  catchIf(
80302
80325
  (error2) => error2._tag === "CommandError" && error2.stderr.includes("too_large"),
@@ -80648,6 +80671,7 @@ const make$y = gen(function* () {
80648
80671
  isGitLabHost,
80649
80672
  pullRequest: (url2) => flatMap(requireMergeRequest(url2), pullRequestOf),
80650
80673
  pullRequestDetail,
80674
+ refresh: (url2) => events2.publish({ type: "github.pullRequest", url: url2 }),
80651
80675
  merge: (url2, method2) => method2 === "rebase" ? fail$2(new GitLabMergeMethodError()) : mutate2(url2, (mergeRequest) => [
80652
80676
  "-X",
80653
80677
  "PUT",
@@ -80727,6 +80751,13 @@ const make$x = gen(function* () {
80727
80751
  () => github.pullRequestDetail(url2, options),
80728
80752
  () => gitlab.pullRequestDetail(url2)
80729
80753
  ),
80754
+ refresh: (url2) => ignore$1(
80755
+ byUrl(
80756
+ url2,
80757
+ () => github.refresh(url2),
80758
+ () => gitlab.refresh(url2)
80759
+ )
80760
+ ),
80730
80761
  merge: (url2, method2) => byUrl(
80731
80762
  url2,
80732
80763
  () => github.merge(url2, method2),
@@ -81506,9 +81537,12 @@ const gitBash = async () => {
81506
81537
  return void 0;
81507
81538
  };
81508
81539
  const scriptShell = async () => process.platform === "win32" ? gitBash() : process.env["SHELL"] || "/bin/sh";
81509
- const SETUP_TIMEOUT = "60 seconds";
81540
+ const SETUP_TIMING = {
81541
+ timeout: "60 seconds",
81542
+ forceKillAfter: "3 seconds",
81543
+ outputDrainTimeout: "1 second"
81544
+ };
81510
81545
  const FETCH_INTERVAL = "5 minutes";
81511
- const SETUP_OUTPUT_DRAIN_TIMEOUT = "1 second";
81512
81546
  const GIT_BASH_MISSING = "Setup scripts on Windows run in Git Bash, which comes with Git for Windows. Install it from https://git-scm.com, then try again.";
81513
81547
  class Worktrees extends Service$1()("hinacode/Worktrees") {
81514
81548
  }
@@ -81521,7 +81555,7 @@ const parseCheckouts = (output) => output.split("\0\0").map((record2) => {
81521
81555
  const value2 = (key2) => fields.find((field2) => field2.startsWith(`${key2} `))?.slice(key2.length + 1);
81522
81556
  return { path: value2("worktree") ?? "", ref: value2("branch") ?? null };
81523
81557
  }).filter((checkout) => checkout.path !== "");
81524
- const make$t = fnUntraced(function* (setupTimeout) {
81558
+ const make$t = fnUntraced(function* (setupTiming) {
81525
81559
  const sql = yield* SqlClient;
81526
81560
  const projects = yield* Projects;
81527
81561
  const git2 = yield* Git;
@@ -81623,7 +81657,7 @@ const make$t = fnUntraced(function* (setupTimeout) {
81623
81657
  },
81624
81658
  extendEnv: true,
81625
81659
  stdin: "ignore",
81626
- forceKillAfter: "3 seconds"
81660
+ forceKillAfter: setupTiming.forceKillAfter
81627
81661
  })
81628
81662
  );
81629
81663
  const logging2 = yield* handle.all.pipe(
@@ -81632,7 +81666,7 @@ const make$t = fnUntraced(function* (setupTimeout) {
81632
81666
  forkScoped
81633
81667
  );
81634
81668
  const exitCode = yield* handle.exitCode;
81635
- const drained = yield* join$2(logging2).pipe(timeoutOption(SETUP_OUTPUT_DRAIN_TIMEOUT));
81669
+ const drained = yield* join$2(logging2).pipe(timeoutOption(setupTiming.outputDrainTimeout));
81636
81670
  if (isNone(drained)) {
81637
81671
  yield* reportSetup(
81638
81672
  worktree,
@@ -81649,9 +81683,9 @@ const make$t = fnUntraced(function* (setupTimeout) {
81649
81683
  const setup2 = (worktree, project2) => gen(function* () {
81650
81684
  const script = project2.setupScript?.trim();
81651
81685
  if (!script) return yield* setStatus2(worktree.id, "ready");
81652
- const finished2 = yield* runSetupScript(worktree, project2, script).pipe(timeoutOption(setupTimeout));
81686
+ const finished2 = yield* runSetupScript(worktree, project2, script).pipe(timeoutOption(setupTiming.timeout));
81653
81687
  if (isNone(finished2)) {
81654
- const after = format$3(fromInputUnsafe(setupTimeout));
81688
+ const after = format$3(fromInputUnsafe(setupTiming.timeout));
81655
81689
  yield* reportSetup(worktree, "timedOut", `
81656
81690
  Setup script timed out after ${after} and was stopped.
81657
81691
  `);
@@ -81962,8 +81996,8 @@ Setup script exited with code ${exitCode}
81962
81996
  stopSetup
81963
81997
  });
81964
81998
  });
81965
- const layerWithSetupTimeout = (setupTimeout) => effect(Worktrees, make$t(setupTimeout));
81966
- const layer$z = layerWithSetupTimeout(SETUP_TIMEOUT);
81999
+ const layerWithSetupTiming = (setupTiming) => effect(Worktrees, make$t(setupTiming));
82000
+ const layer$z = layerWithSetupTiming(SETUP_TIMING);
81967
82001
  const MAX_LISTED_FILES = 5e4;
81968
82002
  const randomName = () => `thread-${randomUUID().slice(0, 5)}`;
81969
82003
  const ThreadRow$1 = Struct({
@@ -82868,23 +82902,12 @@ const make$q = gen(function* () {
82868
82902
  return ThreadNaming.of({ nameFromPrompt, regenerateTitle });
82869
82903
  });
82870
82904
  const layer$v = effect(ThreadNaming, make$q);
82871
- const PERSIST_INTERVAL_MS = 500;
82872
- const RUN_AGENT_WAIT = minutes(4);
82873
- const PERSIST_BYTES_PER_SECOND = 256 * 1024;
82874
- const interruptedSend = () => new AgentError({ provider: "hinacode", message: "Message send interrupted" });
82875
- const resumeAt = (thread2) => {
82876
- const reset = thread2.usageLimit?.reset;
82877
- if (thread2.status !== "limited" || reset?.autoResume !== true) return void 0;
82878
- return Date.parse(reset.at) + resumeGraceMs;
82879
- };
82880
- const resumeIsDue = (thread2, now2) => (resumeAt(thread2) ?? Infinity) <= Date.parse(now2);
82881
- const deliveryAt = (message2) => message2.failure === void 0 ? Date.parse(message2.sendAt) : void 0;
82882
- const isDue = (message2, now2) => (deliveryAt(message2) ?? Infinity) <= Date.parse(now2);
82883
- const nextDeadline = (thread2) => earliest([resumeAt(thread2), ...thread2.scheduled.map(deliveryAt)]);
82884
- const bySendAt = (messages) => messages.toSorted((a, b) => Date.parse(a.sendAt) - Date.parse(b.sendAt));
82885
- class AgentRunner extends Service$1()("hinacode/AgentRunner") {
82886
- }
82887
- const statusAfter = (event) => {
82905
+ const initialTurnState = (resumedSessionId) => ({
82906
+ status: "running",
82907
+ outcome: null,
82908
+ resumedSessionId
82909
+ });
82910
+ const statusAfter = (event, { waitsOnUser }) => {
82888
82911
  switch (event.type) {
82889
82912
  case "approval_requested":
82890
82913
  case "question_requested":
@@ -82893,7 +82916,7 @@ const statusAfter = (event) => {
82893
82916
  case "approval_resolved":
82894
82917
  case "question_resolved":
82895
82918
  case "secret_resolved":
82896
- return "running";
82919
+ return waitsOnUser ? "awaiting_approval" : "running";
82897
82920
  case "turn_completed":
82898
82921
  case "turn_failed":
82899
82922
  return "idle";
@@ -82903,6 +82926,48 @@ const statusAfter = (event) => {
82903
82926
  return void 0;
82904
82927
  }
82905
82928
  };
82929
+ const outcomeAfter = (event, outcome) => {
82930
+ if (event.type === "turn_completed") return "completed";
82931
+ if (event.type === "turn_failed") return "failed";
82932
+ return outcome;
82933
+ };
82934
+ const sessionEffects = (state, event) => {
82935
+ if (event.type === "session_bound" && event.providerSessionId !== state.resumedSessionId) {
82936
+ return [{ type: "bind_session", providerSessionId: event.providerSessionId }];
82937
+ }
82938
+ if (event.type === "turn_failed" && event.sessionLost) return [{ type: "drop_session" }];
82939
+ return [];
82940
+ };
82941
+ const releasesUser = (event) => event.type === "approval_resolved" || event.type === "question_resolved" || event.type === "secret_resolved";
82942
+ const step = (state, event, inputs) => {
82943
+ const next2 = statusAfter(event, inputs);
82944
+ const status = next2 ?? state.status;
82945
+ const statusEffects = next2 === void 0 || next2 === state.status ? [] : [{ type: "set_status", status, ...event.type === "turn_limited" && { usageLimit: event.limit } }];
82946
+ return [
82947
+ { ...state, status, outcome: outcomeAfter(event, state.outcome) },
82948
+ [
82949
+ ...sessionEffects(state, event),
82950
+ ...statusEffects,
82951
+ ...releasesUser(event) ? [{ type: "steer_held" }] : []
82952
+ ]
82953
+ ];
82954
+ };
82955
+ const PERSIST_INTERVAL_MS = 500;
82956
+ const RUN_AGENT_WAIT = minutes(4);
82957
+ const PERSIST_BYTES_PER_SECOND = 256 * 1024;
82958
+ const interruptedSend = () => new AgentError({ provider: "hinacode", message: "Message send interrupted" });
82959
+ const resumeAt = (thread2) => {
82960
+ const reset = thread2.usageLimit?.reset;
82961
+ if (thread2.status !== "limited" || reset?.autoResume !== true) return void 0;
82962
+ return Date.parse(reset.at) + resumeGraceMs;
82963
+ };
82964
+ const resumeIsDue = (thread2, now2) => (resumeAt(thread2) ?? Infinity) <= Date.parse(now2);
82965
+ const deliveryAt = (message2) => message2.failure === void 0 ? Date.parse(message2.sendAt) : void 0;
82966
+ const isDue = (message2, now2) => (deliveryAt(message2) ?? Infinity) <= Date.parse(now2);
82967
+ const nextDeadline = (thread2) => earliest([resumeAt(thread2), ...thread2.scheduled.map(deliveryAt)]);
82968
+ const bySendAt = (messages) => messages.toSorted((a, b) => Date.parse(a.sendAt) - Date.parse(b.sendAt));
82969
+ class AgentRunner extends Service$1()("hinacode/AgentRunner") {
82970
+ }
82906
82971
  const userMessage = (threadId, text2, attachments, now2, id2 = randomUUID()) => ({
82907
82972
  id: id2,
82908
82973
  threadId,
@@ -82956,6 +83021,7 @@ const make$p = gen(function* () {
82956
83021
  const attachments = yield* Attachments;
82957
83022
  const git2 = yield* Git;
82958
83023
  const pullRequests = yield* PullRequests;
83024
+ const sourceControl = yield* SourceControl;
82959
83025
  const messages = yield* Messages;
82960
83026
  const sql = yield* SqlClient;
82961
83027
  const push = yield* Events;
@@ -83151,15 +83217,22 @@ const make$p = gen(function* () {
83151
83217
  };
83152
83218
  return input;
83153
83219
  });
83220
+ const refreshPullRequests = (thread2, { branch }) => gen(function* () {
83221
+ const linked = (yield* pullRequests.list(thread2.id)).map((link) => link.url);
83222
+ yield* forEach(linked, sourceControl.refresh, { concurrency: "unbounded", discard: true });
83223
+ if (!branch || thread2.worktreeId === null) return;
83224
+ const pullRequest = yield* worktrees.pullRequest(thread2.worktreeId);
83225
+ if (pullRequest !== null && !linked.includes(pullRequest.url)) yield* sourceControl.refresh(pullRequest.url);
83226
+ }).pipe(ignore$1, forkIn(scope2), asVoid);
83154
83227
  const insertMessage = (message2) => messages.insert(message2).pipe(andThen(publishTranscript({ type: "message.created", message: message2 })));
83155
83228
  const makeTurn = (thread2, provider, cwd, home, initial, stop) => {
83156
83229
  let turnMessages = [initial];
83157
- let status = "running";
83158
- let completed = false;
83230
+ let state = initialTurnState(thread2.providerSessionId);
83159
83231
  let persistedAt = Date.now();
83160
83232
  let persistedBytes = 0;
83161
83233
  const dirty = /* @__PURE__ */ new Map();
83162
83234
  const subagentCalls = /* @__PURE__ */ new Set();
83235
+ const pullRequestCalls = /* @__PURE__ */ new Set();
83163
83236
  const persist = suspend(() => {
83164
83237
  const changed = turnMessages.flatMap((message2) => {
83165
83238
  const previous = dirty.get(message2.id);
@@ -83187,6 +83260,10 @@ const make$p = gen(function* () {
83187
83260
  };
83188
83261
  const apply2 = (event) => gen(function* () {
83189
83262
  if (event.type === "tool_call_started" && spawnsSubagent(event)) subagentCalls.add(event.callId);
83263
+ if (event.type === "tool_call_started" && touchesPullRequest(event.input)) pullRequestCalls.add(event.callId);
83264
+ if (event.type === "tool_call_finished" && pullRequestCalls.delete(event.callId)) {
83265
+ yield* refreshPullRequests(thread2, { branch: true });
83266
+ }
83190
83267
  const whole = event.type === "tool_call_finished" && subagentCalls.has(event.callId);
83191
83268
  yield* publishTranscript({ type: "thread.event", threadId: thread2.id, event }, { whole });
83192
83269
  setTurnMessages(foldTranscript(turnMessages, event, yield* nowIso));
@@ -83194,28 +83271,31 @@ const make$p = gen(function* () {
83194
83271
  if (event.type === "approval_resolved") approvals2.delete(event.requestId);
83195
83272
  if (event.type === "question_requested") questions.set(event.request.id, event.request);
83196
83273
  if (event.type === "question_resolved") questions.delete(event.requestId);
83197
- if (event.type === "session_bound" && event.providerSessionId !== thread2.providerSessionId) {
83198
- yield* updateThread({ id: thread2.id, providerSessionId: event.providerSessionId });
83199
- }
83200
- if (event.type === "turn_failed" && event.sessionLost)
83201
- yield* updateThread({ id: thread2.id, providerSessionId: null });
83202
- if (event.type === "turn_completed" || event.type === "turn_failed") completed = event.type === "turn_completed";
83203
- const resolvedStatus = statusAfter(event);
83204
- const nextStatus = resolvedStatus === "running" && waitsOnUser(thread2.id) ? "awaiting_approval" : resolvedStatus;
83205
- if (nextStatus !== void 0 && nextStatus !== status) {
83206
- status = nextStatus;
83207
- yield* updateThread({
83208
- id: thread2.id,
83209
- status,
83210
- ...event.type === "turn_limited" ? { usageLimit: event.limit } : {}
83211
- });
83212
- }
83213
- if (event.type === "approval_resolved" || event.type === "question_resolved" || event.type === "secret_resolved") {
83214
- yield* steerHeld;
83274
+ const [after, effects] = step(state, event, { waitsOnUser: waitsOnUser(thread2.id) });
83275
+ yield* forEach(effects, perform, { discard: true });
83276
+ state = after;
83277
+ if (event.type === "turn_completed" || event.type === "turn_failed") {
83278
+ yield* refreshPullRequests(thread2, { branch: false });
83215
83279
  }
83216
83280
  const interval = Math.max(PERSIST_INTERVAL_MS, persistedBytes / PERSIST_BYTES_PER_SECOND * 1e3);
83217
83281
  if (dirty.size > 0 && Date.now() - persistedAt >= interval) yield* persist;
83218
83282
  });
83283
+ const perform = (effect2) => {
83284
+ switch (effect2.type) {
83285
+ case "bind_session":
83286
+ return updateThread({ id: thread2.id, providerSessionId: effect2.providerSessionId });
83287
+ case "drop_session":
83288
+ return updateThread({ id: thread2.id, providerSessionId: null });
83289
+ case "set_status":
83290
+ return updateThread({
83291
+ id: thread2.id,
83292
+ status: effect2.status,
83293
+ ...effect2.usageLimit !== void 0 && { usageLimit: effect2.usageLimit }
83294
+ });
83295
+ case "steer_held":
83296
+ return steerHeld;
83297
+ }
83298
+ };
83219
83299
  const deltas = makeDeltaCoalescer({ apply: apply2, exclusive: exclusive(thread2.id), scope: scope2 });
83220
83300
  const handle = (received) => gen(function* () {
83221
83301
  const event = received.type === "tool_call_finished" ? { ...received, output: yield* withImagesSaved(thread2.id, attachments, received.output) } : received.type === "turn_completed" && received.forkPoint !== void 0 ? {
@@ -83261,7 +83341,7 @@ const make$p = gen(function* () {
83261
83341
  }
83262
83342
  });
83263
83343
  const afterRefusedTurn = (text2, attachments2, when2, messageId) => suspend(
83264
- () => completed && !isDoneUnsafe(stop) ? succeed$2("finished") : gen(function* () {
83344
+ () => state.outcome === "completed" && !isDoneUnsafe(stop) ? succeed$2("finished") : gen(function* () {
83265
83345
  if (!(yield* when2)) return false;
83266
83346
  const { queue: queue2 } = yield* threads.get(thread2.id);
83267
83347
  yield* updateThread({ id: thread2.id, queue: [...queue2, { id: messageId, text: text2, attachments: attachments2 }] });
@@ -83326,8 +83406,8 @@ const make$p = gen(function* () {
83326
83406
  setTurnMessages(replaceLast(turnMessages, closed));
83327
83407
  yield* persist;
83328
83408
  if (closed !== last) yield* publishTranscript({ type: "message.updated", message: closed });
83329
- if (isThreadBusy(status)) yield* updateThread({ id: thread2.id, status: "idle" });
83330
- if (!completed || (yield* isDone(stop))) return;
83409
+ if (isThreadBusy(state.status)) yield* updateThread({ id: thread2.id, status: "idle" });
83410
+ if (state.outcome !== "completed" || (yield* isDone(stop))) return;
83331
83411
  next2 = yield* nextQueued(thread2.id);
83332
83412
  }).pipe(
83333
83413
  catch_((error2) => logError("failed to finish turn", error2)),
@@ -83543,6 +83623,9 @@ const make$p = gen(function* () {
83543
83623
  flatMap(exit(execution), (exit2) => done(finalReply, exit2)),
83544
83624
  scope2
83545
83625
  );
83626
+ if (request2.background === true) {
83627
+ return `The agent runs in the background. Call ${WAIT_AGENT_TOOL} with agentId "${id2}" for its reply before you end your turn, because it stops when the turn ends.`;
83628
+ }
83546
83629
  return yield* waitForAgent(threadId, id2);
83547
83630
  });
83548
83631
  const liveMessages = (threadId) => messages.list(threadId).pipe(
@@ -86161,6 +86244,10 @@ function compactSubagentWork(messages, callId) {
86161
86244
  const { spawn: spawn2, calls, startedAt: startedAt2 } = findSubagentWork(messages, callId);
86162
86245
  return { spawn: spawn2 ?? null, calls: calls.map(compactPart), startedAt: startedAt2 ?? null };
86163
86246
  }
86247
+ function previewSubagentWork(messages, callId) {
86248
+ const { spawn: spawn2, calls, startedAt: startedAt2 } = findSubagentWork(messages, callId);
86249
+ return { spawn: spawn2 ?? null, calls: calls.map(previewPart), startedAt: startedAt2 ?? null };
86250
+ }
86164
86251
  class AgentLogins extends Service$1()("hinacode/AgentLogins") {
86165
86252
  }
86166
86253
  const CachedAccount = fromJsonString(
@@ -86726,7 +86813,7 @@ function pickElement() {
86726
86813
  const target = document.elementFromPoint(event.clientX, event.clientY);
86727
86814
  if (target) finish(target);
86728
86815
  };
86729
- const step = (key2, element) => {
86816
+ const step2 = (key2, element) => {
86730
86817
  if (key2 === "ArrowUp") return element.parentElement === document.documentElement ? null : element.parentElement;
86731
86818
  if (key2 === "ArrowDown") return element.firstElementChild;
86732
86819
  if (key2 === "ArrowLeft") return element.previousElementSibling;
@@ -86742,7 +86829,7 @@ function pickElement() {
86742
86829
  finish(current);
86743
86830
  } else if (event.key.startsWith("Arrow")) {
86744
86831
  swallow(event);
86745
- const next2 = current ? step(event.key, current) : document.elementFromPoint(innerWidth / 2, innerHeight / 2);
86832
+ const next2 = current ? step2(event.key, current) : document.elementFromPoint(innerWidth / 2, innerHeight / 2);
86746
86833
  if (!next2) return;
86747
86834
  next2.scrollIntoView({ block: "nearest", inline: "nearest" });
86748
86835
  show(next2);
@@ -86836,6 +86923,7 @@ const executablePath = async (override) => {
86836
86923
  return void 0;
86837
86924
  };
86838
86925
  const make$j = (options) => gen(function* () {
86926
+ const clock = yield* Clock;
86839
86927
  const activeWorkspace = yield* makeActiveWorkspace;
86840
86928
  const attachments = yield* Attachments;
86841
86929
  const scope2 = yield* scope$1;
@@ -87260,7 +87348,7 @@ const make$j = (options) => gen(function* () {
87260
87348
  if (!live || live.closed || live.threadId !== threadId) {
87261
87349
  throw new BrowserError({ message: "Browser session does not belong to this thread or has expired" });
87262
87350
  }
87263
- live.lease = Date.now();
87351
+ live.lease = clock.currentTimeMillisUnsafe();
87264
87352
  return live;
87265
87353
  };
87266
87354
  const open2 = (input) => gen(function* () {
@@ -87297,7 +87385,7 @@ const make$j = (options) => gen(function* () {
87297
87385
  viewport: { width: input.width, height: input.height },
87298
87386
  latest: null,
87299
87387
  sequence: 0,
87300
- lease: Date.now(),
87388
+ lease: clock.currentTimeMillisUnsafe(),
87301
87389
  casting: false,
87302
87390
  closed: false,
87303
87391
  pickEpoch: 0,
@@ -87448,7 +87536,9 @@ const make$j = (options) => gen(function* () {
87448
87536
  catch: failure$2
87449
87537
  });
87450
87538
  const sweep = promise$1(async () => {
87451
- const expired = [...sessions.values()].filter((live) => Date.now() - live.lease > (options.leaseMs ?? 6e4));
87539
+ const expired = [...sessions.values()].filter(
87540
+ (live) => clock.currentTimeMillisUnsafe() - live.lease > (options.leaseMs ?? 6e4)
87541
+ );
87452
87542
  await Promise.all(expired.map((live) => closeLive(live)));
87453
87543
  }).pipe(catchCause((cause) => logWarning("browser cleanup failed", cause)));
87454
87544
  yield* sweep.pipe(schedule(spaced(options.sweepMs ?? 1e4)), forkScoped);
@@ -88769,8 +88859,8 @@ const fetchIcon = async (url2, deadline2) => {
88769
88859
  const type2 = truncated ? null : sniffImage(bytes2);
88770
88860
  return type2 && `data:${type2};base64,${bytes2.toString("base64")}`;
88771
88861
  };
88772
- const lookup = async (origin) => {
88773
- const deadline2 = AbortSignal.timeout(LOOKUP_TIMEOUT_MS);
88862
+ const lookup = async (origin, lookupTimeoutMs) => {
88863
+ const deadline2 = AbortSignal.timeout(lookupTimeoutMs);
88774
88864
  const page2 = await get(new URL("/", origin), deadline2).catch(() => null);
88775
88865
  const html2 = page2 ? (await readUpTo(page2.response, PAGE_LIMIT_BYTES)).bytes.toString("utf8") : "";
88776
88866
  const linked = page2 && linkedIcon(html2, page2.url);
@@ -88793,12 +88883,12 @@ class Host {
88793
88883
  return string$2(this.hostname);
88794
88884
  }
88795
88885
  }
88796
- const make$g = gen(function* () {
88886
+ const make$g = fnUntraced(function* (lookupTimeoutMs) {
88797
88887
  const lookups = yield* make$1w(MAX_CONCURRENT_LOOKUPS);
88798
88888
  const icons = yield* makeWith$1(
88799
88889
  (host) => withPermit(
88800
88890
  lookups,
88801
- promise$1(() => lookup(host.origin).catch(() => null))
88891
+ promise$1(() => lookup(host.origin, lookupTimeoutMs).catch(() => null))
88802
88892
  ),
88803
88893
  {
88804
88894
  capacity: CACHE_CAPACITY,
@@ -88812,7 +88902,8 @@ const make$g = gen(function* () {
88812
88902
  }
88813
88903
  });
88814
88904
  });
88815
- const layer$h = effect(Favicons, make$g);
88905
+ const layerWithLookupTimeout = (lookupTimeoutMs) => effect(Favicons, make$g(lookupTimeoutMs));
88906
+ const layer$h = layerWithLookupTimeout(LOOKUP_TIMEOUT_MS);
88816
88907
  class Scheduler extends Service$1()("hinacode/Scheduler") {
88817
88908
  }
88818
88909
  const LONGEST_NAP_MS = 6e4;
@@ -89549,7 +89640,7 @@ const make$c = (options) => gen(function* () {
89549
89640
  }
89550
89641
  return state;
89551
89642
  };
89552
- const onStep = (step) => place({ phase: "preparing", deviceId, name, owned, step });
89643
+ const onStep = (step2) => place({ phase: "preparing", deviceId, name, owned, step: step2 });
89553
89644
  const pending = Promise.resolve().then(async () => {
89554
89645
  try {
89555
89646
  deviceId = await start(onStep);
@@ -90406,6 +90497,8 @@ const errorOf = (status, body2, sandboxId) => {
90406
90497
  };
90407
90498
  const boatClient = (input) => {
90408
90499
  const base = input.baseUrl.replace(/\/+$/, "");
90500
+ const pollSeconds = input.pollSeconds ?? WAIT_READY_POLL_SECONDS;
90501
+ const signedRetrySeconds = input.signedRetrySeconds ?? SIGNED_FETCH_RETRY_SECONDS;
90409
90502
  const authorization = () => `Bearer ${value$2(input.apiKey)}`;
90410
90503
  const request2 = (method2, path2, options = {}) => tryPromise({
90411
90504
  try: (signal2) => fetch(`${base}${path2}`, {
@@ -90469,7 +90562,7 @@ const boatClient = (input) => {
90469
90562
  return fail$2(
90470
90563
  new BoatError({ message: `boat sandbox ${id2} did not become ready; last state is ${sandbox.state}` })
90471
90564
  );
90472
- return sleep$3(`${WAIT_READY_POLL_SECONDS} seconds`).pipe(andThen(poll(attempt2 + 1)));
90565
+ return sleep$3(`${pollSeconds} seconds`).pipe(andThen(poll(attempt2 + 1)));
90473
90566
  });
90474
90567
  return poll(1);
90475
90568
  };
@@ -90488,7 +90581,7 @@ const boatClient = (input) => {
90488
90581
  );
90489
90582
  const retrySigned = (once2) => {
90490
90583
  const attempt2 = (index) => catch_(once2, ({ retryable, error: error2 }) => {
90491
- const delay2 = SIGNED_FETCH_RETRY_SECONDS[index];
90584
+ const delay2 = signedRetrySeconds[index];
90492
90585
  return retryable && delay2 !== void 0 ? sleep$3(`${delay2} seconds`).pipe(andThen(attempt2(index + 1))) : fail$2(error2);
90493
90586
  });
90494
90587
  return attempt2(0);
@@ -90707,7 +90800,7 @@ const boatClient = (input) => {
90707
90800
  if (response2.provisioning !== true && candidate.length > 0) return succeed$2(withOverlayZero(candidate));
90708
90801
  if (remaining <= 1)
90709
90802
  return fail$2(new BoatError({ message: "boat desktop is still provisioning. Try again in a moment." }));
90710
- return sleep$3(`${WAIT_READY_POLL_SECONDS} seconds`).pipe(andThen(attempt2(remaining - 1)));
90803
+ return sleep$3(`${pollSeconds} seconds`).pipe(andThen(attempt2(remaining - 1)));
90711
90804
  })
90712
90805
  );
90713
90806
  return attempt2(DESKTOP_MAX_ATTEMPTS);
@@ -91038,7 +91131,7 @@ const handshake = (socket, head2) => tryPromise({
91038
91131
  });
91039
91132
  const writeSteps = (socket, steps) => forEach(
91040
91133
  steps,
91041
- (step) => step instanceof Uint8Array ? sync(() => void socket.write(step)) : sleep$3(step.pauseMs),
91134
+ (step2) => step2 instanceof Uint8Array ? sync(() => void socket.write(step2)) : sleep$3(step2.pauseMs),
91042
91135
  { discard: true }
91043
91136
  );
91044
91137
  class TarError extends TaggedError$1()("TarError", { message: String$1 }) {
@@ -92227,7 +92320,7 @@ ${output}` : ""}`
92227
92320
  const layer$c = (source, dataDir, options) => effect(TinyVm, make$a(source, dataDir, options?.desktopRedirect ?? true));
92228
92321
  const AgentTools = make$Q(
92229
92322
  make$C(RUN_AGENT_TOOL, {
92230
- description: "Run a sub-agent on any provider HinaCode supports, such as Codex from a Claude thread, through its SDK in this thread's workspace. Use it instead of running the `codex` or `claude` CLI in a shell. It shows in this thread's Agents tab, where the user can watch and stop it. The call returns the agent's final reply, or, if the agent is still working after a few minutes, its id: then call `wait_agent` with that id, as often as needed, to keep waiting. The agent stops when this thread's turn ends. The `<agents>` block in your instructions lists each provider with its model ids and efforts; pass them exactly. Defaults to that provider's first model, or this thread's model on the same provider. opencode runs only the models the user picked for it in Settings.",
92323
+ description: "Run a sub-agent on any provider HinaCode supports, such as Codex from a Claude thread, through its SDK in this thread's workspace. Use it instead of running the `codex` or `claude` CLI in a shell. It shows in this thread's Agents tab, where the user can watch and stop it. The call returns the agent's final reply, or, if the agent is still working after a few minutes, its id: then call `wait_agent` with that id, as often as needed, to keep waiting. Pass `background` to get the id at once and keep working while it runs. The agent stops when this thread's turn ends. The `<agents>` block in your instructions lists each provider with its model ids and efforts; pass them exactly. Defaults to that provider's first model, or this thread's model on the same provider. opencode runs only the models the user picked for it in Settings.",
92231
92324
  parameters: Struct({
92232
92325
  provider: ProviderId,
92233
92326
  description: String$1.annotate({ description: "A few words shown as the sub-agent's label." }),
@@ -92237,6 +92330,11 @@ const AgentTools = make$Q(
92237
92330
  ),
92238
92331
  effort: optionalKey(
92239
92332
  String$1.annotate({ description: "Reasoning effort, one the model lists in `<agents>`." })
92333
+ ),
92334
+ background: optionalKey(
92335
+ Boolean$1.annotate({
92336
+ description: "Return the agent's id at once instead of waiting, so you can keep working and call `wait_agent` for its reply later in this turn."
92337
+ })
92240
92338
  )
92241
92339
  })
92242
92340
  }).annotate(Readonly, true),
@@ -97406,7 +97504,7 @@ const handlers = {
97406
97504
  "updates.install": () => Updates.use((updates) => updates.install),
97407
97505
  "threads.transcript": ({ threadId, compact = false, page: page2 }) => AgentRunner.use((runner) => runner.transcript(threadId)).pipe(
97408
97506
  map$2((transcript) => {
97409
- const messages = transcript.messages.map(compact ? compactMessage : previewMessage);
97507
+ const messages = transcript.messages.map(compact ? compactMessage : previewTranscriptMessage);
97410
97508
  return page2 === void 0 ? { ...transcript, messages } : { ...transcript, ...transcriptPage(messages, page2.before) };
97411
97509
  })
97412
97510
  ),
@@ -97437,8 +97535,8 @@ const handlers = {
97437
97535
  "secrets.clear": ({ name }) => Secrets.use((secrets) => secrets.clear(name)),
97438
97536
  "subagents.list": ({ threadId }) => AgentRunner.use((runner) => runner.subagents(threadId)),
97439
97537
  "subagents.stop": ({ threadId, subagentId }) => AgentRunner.use((runner) => runner.stopSubagent(threadId, subagentId)),
97440
- "subagents.transcript": ({ threadId, callId }) => AgentRunner.use((runner) => runner.transcript(threadId)).pipe(
97441
- map$2(({ messages }) => compactSubagentWork(messages, callId))
97538
+ "subagents.transcript": ({ threadId, callId, compact = true }) => AgentRunner.use((runner) => runner.transcript(threadId)).pipe(
97539
+ map$2(({ messages }) => (compact ? compactSubagentWork : previewSubagentWork)(messages, callId))
97442
97540
  ),
97443
97541
  "backgroundTasks.list": ({ threadId }) => AgentRunner.use((runner) => runner.backgroundTasks(threadId)),
97444
97542
  "backgroundTasks.stop": ({ threadId, taskId }) => AgentRunner.use((runner) => runner.stopBackgroundTask(threadId, taskId)),
@@ -100782,10 +100880,10 @@ function __generator(e, r) {
100782
100880
  }), h;
100783
100881
  function verb(e2) {
100784
100882
  return function(r2) {
100785
- return step([e2, r2]);
100883
+ return step2([e2, r2]);
100786
100884
  };
100787
100885
  }
100788
- function step(a) {
100886
+ function step2(a) {
100789
100887
  if (i) throw new TypeError("Generator is already executing.");
100790
100888
  while (h && (h = 0, a[0] && (t = 0)), t) try {
100791
100889
  if (i = 1, n && (s = a[0] & 2 ? n["return"] : a[0] ? n["throw"] || ((s = n["return"]) && s.call(n), 0) : n.next) && !(s = s.call(n, a[1])).done) return s;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hinacode",
3
- "version": "0.3.0-alpha.12",
3
+ "version": "0.3.0-alpha.14",
4
4
  "description": "Run coding agents on this machine and drive them from the HinaCode desktop or phone app",
5
5
  "license": "MIT",
6
6
  "repository": {