@cmmd-center/forge 0.10.12 → 0.10.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.
- package/dist/{BunHttpServer-CjwNydcy.cjs → BunHttpServer-BhE7Szci.cjs} +6 -6
- package/dist/{BunHttpServer-GM72b26K.mjs → BunHttpServer-VI75aqJw.mjs} +6 -6
- package/dist/{BunPTY-B4Ra6mph.cjs → BunPTY-86ttlTi6.cjs} +3 -3
- package/dist/{BunPTY-C_ONQ8rt.mjs → BunPTY-oVISucl_.mjs} +3 -3
- package/dist/{BunServices-CUeOgVUt.cjs → BunServices-BwE9KexF.cjs} +3 -3
- package/dist/{BunServices-B-6JkR0Q.mjs → BunServices-D0JTDujL.mjs} +3 -3
- package/dist/{Cache-D56wNKiH.cjs → Cache-CWlxNDbC.cjs} +6 -6
- package/dist/{Cache-da-A9JAa.mjs → Cache-p0X77SKw.mjs} +3 -3
- package/dist/{Config-D0zF6ChD.mjs → Config-AqUR_lhX.mjs} +2 -2
- package/dist/{Config-e5bi-5Ut.cjs → Config-CkEzdD9L.cjs} +2 -2
- package/dist/{HttpServer-B-QOc7bR.cjs → HttpServer-DGoLR-kU.cjs} +4 -4
- package/dist/{HttpServer-HhjqDZlB.mjs → HttpServer-DNGCTTdk.mjs} +3 -3
- package/dist/{NodeHttpServer-Cy1XvkSE.cjs → NodeHttpServer-BPjxt_DT.cjs} +7 -7
- package/dist/{NodeHttpServer-DmEyd0J4.mjs → NodeHttpServer-Dw7ivXfX.mjs} +7 -7
- package/dist/{NodePTY-DU_KoZdd.mjs → NodePTY-CVH2yNYl.mjs} +4 -4
- package/dist/{NodePTY-wATyTf3M.cjs → NodePTY-Cps0jsDA.cjs} +4 -4
- package/dist/{NodeServices-DeNLW36O.mjs → NodeServices-CBNXOYLG.mjs} +3 -3
- package/dist/{NodeServices-pfwgkiUu.cjs → NodeServices-Cw6SxEbl.cjs} +3 -3
- package/dist/{NodeServices-BqfcuvmN.cjs → NodeServices-Ddr-tYRu.cjs} +1 -1
- package/dist/{NodeSqliteClient-PZ6NN2gq.cjs → NodeSqliteClient-CmxPzcBf.cjs} +7 -7
- package/dist/{NodeSqliteClient-BqUcml1B.mjs → NodeSqliteClient-DGInbxQ3.mjs} +6 -6
- package/dist/{NodeTerminal-DfKMT-mE.cjs → NodeTerminal-5iWbO0B2.cjs} +6 -6
- package/dist/{NodeTerminal-DBDxXuu0.mjs → NodeTerminal-BEGtoMSS.mjs} +3 -3
- package/dist/{PTY-DB-DmqyE.cjs → PTY-BxYDiW3h.cjs} +2 -2
- package/dist/{PTY-DdjcAGrF.mjs → PTY-rIPf52QR.mjs} +2 -2
- package/dist/{Path-CHDjKLrB.cjs → Path-Be7zSwar.cjs} +281 -54
- package/dist/{Path-B0vKGzx2.mjs → Path-C6Zb2WHp.mjs} +271 -58
- package/dist/{Schema-BK7-mN_J.mjs → Schema-CJyk7ah1.mjs} +65 -3
- package/dist/{Schema-Cf_uEUQU.cjs → Schema-dLi7Qssy.cjs} +76 -2
- package/dist/{SqlError-Du_dEWbw.cjs → SqlError-Bt0Bcd5C.cjs} +4 -4
- package/dist/{SqlError-LFObCDir.mjs → SqlError-cyJT2IRY.mjs} +3 -3
- package/dist/{SqliteClient-D4Srj6O8.cjs → SqliteClient-B08FzZM4.cjs} +6 -6
- package/dist/{SqliteClient-DdItRZUr.mjs → SqliteClient-CIsITMoQ.mjs} +5 -5
- package/dist/bin.cjs +164 -70
- package/dist/bin.mjs +291 -197
- package/dist/client/assets/{CanvasPanel-mbL7UwXT.js → CanvasPanel-Cogtmutb.js} +2 -2
- package/dist/client/assets/{CompositeItem-Dm91tFrl.js → CompositeItem-D6h2WFmU.js} +2 -2
- package/dist/client/assets/{DiffPanel-Wf-m_tDJ.js → DiffPanel-Bnkifxef.js} +3 -3
- package/dist/client/assets/{DiffPanel.logic-Bvxf3m-9.js → DiffPanel.logic-Bk4d9mRT.js} +2 -2
- package/dist/client/assets/{DiffPanelShell-Cs-XLDgV.js → DiffPanelShell-D_nSDbjF.js} +104 -104
- package/dist/client/assets/{DiffWorkerPoolProvider-KeQJ1rQG.js → DiffWorkerPoolProvider-BO-u17g1.js} +9 -9
- package/dist/client/assets/{PullRequestCodePanel-BtdEznt0.js → PullRequestCodePanel-Bbuxcu5g.js} +3 -3
- package/dist/client/assets/{Virtualizer-C4HGxrvR.js → Virtualizer-BxZHsCOD.js} +2 -2
- package/dist/client/assets/{canvasStateStore-CqQQvGP5.js → canvasStateStore-DUZyBLSv.js} +2 -2
- package/dist/client/assets/{cmmdAuthRedirect-Dm6mOZMB.js → cmmdAuthRedirect-Bkc6Luqb.js} +2 -2
- package/dist/client/assets/{index-CUmbThfW.css → index-BMcOaHS_.css} +1 -1
- package/dist/client/assets/{index-DOFEIuQg.js → index-BeMh8T3m.js} +59 -59
- package/dist/client/assets/src-BlF9iHm-.js +3 -0
- package/dist/client/assets/{toggle-dld7kzOP.js → toggle-CWmPePti.js} +2 -2
- package/dist/client/assets/{useTriggerFocusGuards-DPZ1smix.js → useTriggerFocusGuards-O7DUCec0.js} +2 -2
- package/dist/client/index.html +11 -11
- package/dist/forge-build.json +1 -1
- package/dist/{open-D8mGyWmt.mjs → open-FIgTDosf.mjs} +3 -3
- package/package.json +1 -1
- package/dist/client/assets/src-BOr7-dep.js +0 -3
package/dist/bin.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-C5ckVeoz.mjs";
|
|
4
|
-
import { $ as encodeEffect, $c as
|
|
5
|
-
import { $ as toAsyncIterable, A as make$45, At as
|
|
6
|
-
import { _ as ChildProcessSpawner, a as Stdio, g as make$
|
|
7
|
-
import { n as layer$7 } from "./NodeServices-
|
|
8
|
-
import { $ as file, A as SocketErrorReason, At as merge$5, Bt as set$2, Ct as HttpClientErrorSchema, Dt as empty$7, Ft as getAndSet, G as TracerPropagationEnabled, Ht as updateAndGet, I as HttpServerError, It as getUnsafe$2, J as transformResponse, K as filterStatusOk$1, Lt as make$
|
|
9
|
-
import { _ as withDefault$3, a as all$1, c as logLevel, d as option$1, f as port, g as url$2, i as TrueValues, l as map$8, m as string$7, n as FalseValues, o as boolean$5, p as schema$2, r as Record$1, s as int$2, t as Boolean$2, u as number$2 } from "./Config-
|
|
10
|
-
import { a as make$
|
|
11
|
-
import { S as layer$9, _ as defaultEscape, a as DeadlockError, b as makeCompiler$1, c as SqlError, d as UnknownError, g as custom, h as make$
|
|
4
|
+
import { $ as encodeEffect, $a as make$39, $c as fromUndefinedOr, $i as spaced, $l as constUndefined, $n as filterMapOrFail, $r as runPromise, $s as min, $t as stringifyJson, Aa as Scope$1, Ac as fail$1, Ai as void_$1, An as cached$3, Ar as match$1, As as uninterruptibleMask, At as withConstructorDefault, Ba as CurrentLogSpans, Bc as empty$1, Bi as counter, Bl as hasProperty, Bn as catch_, Bo as addFinalizer, Br as orDie, Bs as make$42, Bt as head, C as Record, Ca as mergeAll, Ci as tx$1, Cl as isEffect$1, Cn as andThen, Co as hasDies, Cr as logInfo, Cs as sleep$3, Ct as optionalKey, D as TaggedStruct, Da as succeedContext, Di as uninterruptibleMask$1, Dl as NodeInspectSymbol, Dn as as$3, Do as interruptors, Ds as suspend, Dt as toCodecStringTree, E as TaggedErrorClass, Ea as succeed$2, Ei as uninterruptible, En as annotateSpans, Eo as interrupt$2, Er as map$3, Et as toCodecJson, F as UndefinedOr, Fa as forkUnsafe, Fi as withParentSpan, Fn as catchFilter, Fr as onError$1, Fs as MinimumTraceLevel, G as decodeExit, Ga as done, Gc as make$35, Gi as withAttributes, Gl as isObject$1, Gn as die$1, Gr as provideService, Gs as format$1, Gt as Transformation, H as declare, Hi as snapshotUnsafe, Hl as isNotNullish, Hn as contextWith, Ho as as$2, Hr as promise, Ht as size$2, I as Union, Ia as make$37, Ic as succeed$1, Ii as withSpan, In as catchIf, Io as ConsoleRef, Ir as onExit, Is as NativeSpan, It as assign, J as decodeUnknownEffect, Ja as failCause$3, Ji as exponential, Jn as exit, Jr as repeat, Jt as transformOrFail, K as decodeSync, Kc as makeUnsafe$3, Ki as addDelay, Kl as isTagged, Ko as consolePretty$1, Kr as race, Ks as fromInput, L as Unknown, La as makeUnsafe$4, Lc as Reference$1, Li as withTracerEnabled, Ln as catchReason, Lo as CurrentLoggers$1, Ls as ParentSpan, Lt as append$1, M as URLFromString, Ma as addFinalizerExit, Mi as whileLoop, Mn as callback, Mo as pretty, Ms as void_$2, Na as close, Nc as isFailure$1, Ni as withFiber$1, Nl as equals, Nn as catchCause, No as prettyErrors, Nr as matchEffect, O as TemplateLiteral, Oa as sync$2, Ol as toJson, On as asSome, Or as mapError, Os as sync, Ot as toJsonSchemaDocument, P as Undefined, Pa as closeUnsafe, Pc as isSuccess$1, Pn as catchDefect, Po as squash, Pr as never$1, Q as encode$4, Qc as fromNullishOr, Qi as recurs, Ql as constTrue, Qn as filter$1, Qr as runForkWith, Qs as millis, R as UnknownFromJsonString$1, Ra as provide$2, Rc as Service$1, Ri as yieldNow, Rn as catchTag, Rr as onInterrupt, Rs as Tracer, Rt as drop$1, S as Option, Sa as merge$3, Si as try_, Sn as all, Sr as logFatal, Ss as scopeAddFinalizerExit, St as optional$4, T as Struct, Ta as provideMerge, Ti as undefined_, Tn as annotateLogs, To as hasInterruptsOnly, Tr as makeSpanScoped, Tt as tag, Ua as TracerTimingEnabled, Ui as timer, Ul as isNotUndefined, Un as currentSpan, Ur as provide, Ut as toArray, V as brand, Va as MinimumLogLevel, Vc as get$3, Vi as gauge, Vl as isNotNull, Vn as context, Vo as andThen$1, Vr as orElseSucceed, Vt as isEmpty$2, W as decodeEffect, Wa as _await, Wc as getUnsafe$1, Wi as update$3, Wl as isNullish, Wr as provideContext, Ws as days, X as decodeUnknownOption, Xc as flatMap$2, Xl as compose, Xn as failCause$1, Xr as retry, Xt as onSome, Y as decodeUnknownExit, Yc as firstSomeOf, Yi as forever$2, Yl as cast, Yn as fail, Yr as result, Z as decodeUnknownSync, Za as isDeferred, Zc as flatten$1, Zi as passthrough$1, Zr as runFork, Zs as max, Zt as parseJson$1, _ as NonEmptyArray, _a as effectContext, _i as tapErrorTag, _n as toUtc, _t as isSchemaError, a as DateTimeUtc, aa as Random$1, ac as zero, al as map$5, an as value, ao as interrupt$3, ar as fnUntraced, at as isBetween, au as pipe$1, b as NullOr, bc as reverse, bi as timeoutOrElse, bn as acquireUseRelease, br as logDebug, bs as reportCauseUnsafe, bt as makeFilter, c as Defect, ca as Clock, cc as ensure, ci as sleep$4, cl as some, cn as add$3, co as match$2, cr as forkChild, cs as flatMap$1, ct as isGreaterThanOrEqualTo, d as Exit, dc as fromIterable, di as succeedSome, dn as isGreaterThanOrEqualTo$1, dr as forkScoped, ds as forkDetach, dt as isMaxLength, ea as catchDone, ec as minutes, el as getOrElse, er as filterOrFail, et as encodeSync, eu as constVoid, fa as TaggedError, fi as suspend$1, fn as make$38, fr as gen, ft as isMaxProperties, g as Never, ga as effect, gi as tapError, gl as YieldableProto, gn as toEpochMillis, gr as interruptible, gt as isSchema, h as Literals, ha as buildWithMemoMap, hi as tapCause, hl as PipeInspectableProto, hn as toDate, hr as interrupt$1, ht as isPattern, i as Class, ic as toSeconds, ii as scoped, il as isSome, in as make$40, io as failCause$2, ir as fn$1, it as is$1, iu as identity, ja as addFinalizer$1, jn as cachedWithTTL, jo as map$6, jr as matchCauseEffect, jt as withDecodingDefault, k as Trim, ka as unwrap, ki as useSpan, kl as format, kn as asVoid, ks as tracerLogger$1, kt as toType, l as Duration, la as currentTimeMillis, lc as filter, li as succeed, ll as Number$2, ln as distance, lr as forkDetach$1, ls as fnUntraced$1, lt as isInt, m as Literal, ma as build, mc as isReadonlyArrayNonEmpty, mi as tap, mn as now, mo as StackTrace, mr as ignoreCause, ms as loggerMake, mt as isNonEmpty, n as ArraySchema, nc as times, nl as getOrUndefined, no as die$2, nt as encodeUnknownExit, nu as dual, o as DateTimeUtcFromString, oa as clamp, oc as allocate, oi as service, ol as match, oo as isFailure, or as forEach, ot as isFinite$1, ou as pipeArguments, p as Int$1, pa as CurrentMemoMap, pc as isArrayNonEmpty, pi as sync$1, pn as makeUnsafe$5, po as NoSuchElementError, pr as ignore, pt as isMinLength, q as decodeTo, qa as fail$3, qc as merge$2, qi as both, qn as ensuring, qr as raceFirst, qs as fromInputUnsafe, r as Boolean$1, ra as isDoneCause, rc as toMillis, ri as scope$1, rl as isNone, rn as makeFormatterDefault, ro as fail$2, rr as flatten$2, rt as fromJsonString, sa as parse$6, sc as empty$3, si as serviceOption, sl as none$4, sn as encodeBase64Url$2, so as isSuccess, sr as forever$1, st as isGreaterThan, t as Any, tc as seconds, ti as runPromiseWith, tl as getOrNull, tn as InvalidValue$1, to as succeed$3, tr as flatMap, ts as fiberInterrupt, tt as encodeUnknownEffect, tu as constant, u as ErrorClass, ua as Class$1, uc as flatMapNullishOr, ui as succeedNone, ul as make$41, un as formatIso, uo as void_$3, ur as forkIn, us as forever, ut as isLessThanOrEqualTo, v as NonEmptyString, va as effectDiscard, vc as map$4, vi as timeout$1, vn as Transaction$1, vo as done$1, vr as isEffect, w as String$1, wa as provide$1, wi as txRetry, wl as withFiber, wn as annotateCurrentSpan, wo as hasInterrupts, wr as logWarning$1, wt as suspend$2, x as Number$1, xa as launch$1, xc as sort, xi as tryPromise, xn as addFinalizer$2, xr as logError, xs as scope, xt as mutable, y as Null, ya as empty$4, yi as timeoutOption, yn as acquireRelease, yo as fail$4, yr as log$4, yt as make$36, z as Void, za as CurrentLogAnnotations, zc as add$2, zi as zipWith, zl as compose$1, zn as catchTags, zr as option, zs as externalSpan, zt as empty$2 } from "./Schema-CJyk7ah1.mjs";
|
|
5
|
+
import { $ as toAsyncIterable, A as make$45, At as make$44, Bt as publish, C as fromEffect, Ct as make$43, E as fromQueue, Et as end, F as merge$4, Ft as shutdown$1, G as runFold, H as run$2, Ht as subscribe$1, It as sliding, Jt as getCurrent, K as runForEach, Kt as makeUnsafe$7, Lt as take$1, M as mapAccum, Mt as offerAll, N as mapEffect$1, Nt as offerUnsafe, O as fromSubscription, Ot as failCause$4, Q as tick, R as onExit$1, Rt as takeAll, S as fromChannel, T as fromPubSub, Tt as bounded, U as runCollect, Ut as unbounded$1, V as provideContext$1, Vt as shutdown$2, W as runDrain, Y as succeed$4, Yt as interrupt$4, Z as takeWhile, Zt as runIn, _t as mapInput, at as make$46, b as flatMap$3, bt as fromTransform, c as callback$1, d as debounce$1, f as decodeText$1, g as ensuring$1, h as encodeText, it as get$4, j as map$7, jt as offer$1, k as isStream, l as catchCause$1, m as empty$5, mt as forEach$1, ot as get$5, pt as drain, q as runForEachArray, qt as await_, r as FileSystem, rt as unwrap$1, st as make$47, t as Path$2, u as concat$2, v as failCause$5, w as fromIterable$1, wt as makeUnsafe$6, x as fromAsyncIterable, y as filter$2, yt as fromSubscriptionArray, zt as unbounded$2 } from "./Path-C6Zb2WHp.mjs";
|
|
6
|
+
import { _ as ChildProcessSpawner, a as Stdio, g as make$48, o as make$49, r as isQuitError } from "./NodeTerminal-BEGtoMSS.mjs";
|
|
7
|
+
import { n as layer$7 } from "./NodeServices-CBNXOYLG.mjs";
|
|
8
|
+
import { $ as file, A as SocketErrorReason, At as merge$5, Bt as set$2, Ct as HttpClientErrorSchema, Dt as empty$7, Ft as getAndSet, G as TracerPropagationEnabled, Ht as updateAndGet, I as HttpServerError, It as getUnsafe$2, J as transformResponse, K as filterStatusOk$1, Lt as make$50, Ot as fromInput$1, Pt as get$6, Q as empty$6, Rt as makeUnsafe$8, St as setBody, Tt as jsonUnsafe$1, U as layer$8, Vt as update$4, W as HttpClient, Z as symbol$1, _ as schemaBodyUrlParams, _t as acceptJson, a as withLogAddress, at as setCookie, bt as get$7, ct as stream, d as logger$1, dt as filterStatusOk, et as isHttpServerResponse, f as withLoggerDisabled, ft as matchStatus, g as schemaBodyJson, gt as schemaBodyJson$1, i as serve$1, it as schemaJson, kt as fromRecordUnsafe, lt as text$2, m as ParsedSearchParams, nt as raw, ot as setCookies, p as HttpServerRequest, q as retryTransient, rt as redirect, st as setHeader, t as HttpServer, tt as jsonUnsafe, u as cors, ut as uint8Array, v as schemaHeaders, vt as bearerToken, wt as isHttpClientError, xt as post, y as toURL, yt as bodyJson, z as RouteNotFound, zt as modify$3 } from "./HttpServer-DNGCTTdk.mjs";
|
|
9
|
+
import { _ as withDefault$3, a as all$1, c as logLevel, d as option$1, f as port, g as url$2, i as TrueValues, l as map$8, m as string$7, n as FalseValues, o as boolean$5, p as schema$2, r as Record$1, s as int$2, t as Boolean$2, u as number$2 } from "./Config-AqUR_lhX.mjs";
|
|
10
|
+
import { a as make$51, i as keys, n as getOption, o as makeWith$1, r as invalidate, s as set$3, t as get$8 } from "./Cache-p0X77SKw.mjs";
|
|
11
|
+
import { S as layer$9, _ as defaultEscape, a as DeadlockError, b as makeCompiler$1, c as SqlError, d as UnknownError, g as custom, h as make$52, i as ConstraintError, l as SqlSyntaxError, m as SqlClient, n as AuthorizationError, o as LockTimeoutError, r as ConnectionError, s as SerializationError, t as AuthenticationError, u as StatementTimeoutError, v as defaultTransforms, y as fragment } from "./SqlError-cyJT2IRY.mjs";
|
|
12
12
|
import { r as wrapper_default, t as Mime_default } from "./Mime-Dq9IoNiV.mjs";
|
|
13
13
|
import { a as diag, c as SpanKind$1, d as TraceFlags, f as ROOT_CONTEXT, i as propagation, l as isSpanContextValid, m as DiagLogLevel, n as init_esm$1, o as context$1, p as createContextKey, r as trace, s as SpanStatusCode, t as esm_exports$1 } from "./esm-wLIF-u3N.mjs";
|
|
14
14
|
import { a as verifyCmmdAuthRuntimeTicket, c as verifyCmmdRuntimeTicket, d as setRuntimeGrantToken, f as createReadOnceFileTokenAccessor, i as sendRuntimeControlHeartbeat, l as verifyCmmdRuntimeTicketRefreshProof, n as bootstrapRuntimeControlAuthorityFromNarrowGrant, o as verifyCmmdClaudeReadinessTicket, r as readRuntimeControlAuthority, s as verifyCmmdClaudeUsageTicket, t as bootstrapRuntimeControlAuthority, u as runtimeGrantToken } from "./runtimeControlAuthority-COHmz_WT.mjs";
|
|
15
|
-
import { n as PtySpawnError, t as PtyAdapter } from "./PTY-
|
|
15
|
+
import { n as PtySpawnError, t as PtyAdapter } from "./PTY-rIPf52QR.mjs";
|
|
16
16
|
import { createRequire } from "node:module";
|
|
17
17
|
import * as HE from "node:child_process";
|
|
18
18
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -22,7 +22,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicK
|
|
|
22
22
|
import * as FS$1 from "node:fs";
|
|
23
23
|
import fs, { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, mkdtempSync, promises, readFile, readFileSync, readdir, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
24
24
|
import * as NodeOS from "node:os";
|
|
25
|
-
import
|
|
25
|
+
import os, { homedir, networkInterfaces, tmpdir } from "node:os";
|
|
26
26
|
import * as Path$1 from "node:path";
|
|
27
27
|
import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
28
28
|
import { pathToFileURL } from "node:url";
|
|
@@ -18601,16 +18601,71 @@ const CLAUDE_CODE_EFFORT_OPTIONS = [
|
|
|
18601
18601
|
const CODEX_DEFAULT_MODEL = "gpt-6-astra";
|
|
18602
18602
|
const CODEX_SPARK_MODEL = "gpt-5.3-codex-spark";
|
|
18603
18603
|
const CLAUDE_DEFAULT_MODEL = "claude-fable-5-1";
|
|
18604
|
-
const
|
|
18604
|
+
const ProviderOptionSelection = Struct({
|
|
18605
|
+
id: TrimmedNonEmptyString,
|
|
18606
|
+
value: Union([TrimmedNonEmptyString, Boolean$1])
|
|
18607
|
+
});
|
|
18608
|
+
/**
|
|
18609
|
+
* The object form on its own, exported so callers that need the individual
|
|
18610
|
+
* field schemas can reach them. The exported `CodexModelOptions` below is a
|
|
18611
|
+
* union and has no `.fields`.
|
|
18612
|
+
*/
|
|
18613
|
+
const CodexModelOptionsObject = Struct({
|
|
18605
18614
|
reasoningEffort: optional$4(Literals(CODEX_REASONING_EFFORT_OPTIONS)),
|
|
18606
18615
|
fastMode: optional$4(Boolean$1)
|
|
18607
18616
|
});
|
|
18608
|
-
|
|
18617
|
+
/** The object form on its own; see {@link CodexModelOptionsObject}. */
|
|
18618
|
+
const ClaudeModelOptionsObject = Struct({
|
|
18609
18619
|
thinking: optional$4(Boolean$1),
|
|
18610
18620
|
effort: optional$4(Literals(CLAUDE_CODE_EFFORT_OPTIONS)),
|
|
18611
18621
|
fastMode: optional$4(Boolean$1),
|
|
18612
18622
|
contextWindow: optional$4(String$1)
|
|
18613
18623
|
});
|
|
18624
|
+
/**
|
|
18625
|
+
* `[{ id, value }]` folded into `{ [id]: value }`.
|
|
18626
|
+
*
|
|
18627
|
+
* Duplicate ids keep the last, which is what an object literal would have done
|
|
18628
|
+
* had the sender used one.
|
|
18629
|
+
*/
|
|
18630
|
+
function selectionArrayToRecord(selections) {
|
|
18631
|
+
const record = {};
|
|
18632
|
+
for (const { id, value } of selections) record[id] = value;
|
|
18633
|
+
return record;
|
|
18634
|
+
}
|
|
18635
|
+
function recordToSelectionArray(value) {
|
|
18636
|
+
if (typeof value !== "object" || value === null) return [];
|
|
18637
|
+
return Object.entries(value).flatMap(([id, entry]) => typeof entry === "string" || typeof entry === "boolean" ? [{
|
|
18638
|
+
id,
|
|
18639
|
+
value: entry
|
|
18640
|
+
}] : []);
|
|
18641
|
+
}
|
|
18642
|
+
/**
|
|
18643
|
+
* Also accept the option array that t3code-derived clients send.
|
|
18644
|
+
*
|
|
18645
|
+
* Forge's own surfaces send `{ reasoningEffort: "high" }`. The vendored mobile
|
|
18646
|
+
* client encodes the same choice as `[{ id: "reasoningEffort", value: "high" }]`,
|
|
18647
|
+
* its canonical shape, and the two contract packages never compare notes. So a
|
|
18648
|
+
* person picking a reasoning effort on the phone produced a `startTurn` payload
|
|
18649
|
+
* the server refused outright with "Expected object, got [...]" — not a dropped
|
|
18650
|
+
* option, a turn that never ran at all.
|
|
18651
|
+
*
|
|
18652
|
+
* Tolerated here rather than changed in the vendored encoder: this accepts both
|
|
18653
|
+
* shapes from any client, while `@t3tools/contracts` keeps the canonical form
|
|
18654
|
+
* it shares with upstream. The array is normalised into the object the provider
|
|
18655
|
+
* adapters already read, so nothing downstream learns a second shape.
|
|
18656
|
+
*
|
|
18657
|
+
* The object member stays first because it is what every Forge surface sends.
|
|
18658
|
+
* `Schema.Struct` rejects an array outright rather than decoding it to an empty
|
|
18659
|
+
* object, so an array falls through to the member built for it.
|
|
18660
|
+
*/
|
|
18661
|
+
const CodexModelOptions = Union([CodexModelOptionsObject, ArraySchema(ProviderOptionSelection).pipe(decodeTo(CodexModelOptionsObject, transformOrFail({
|
|
18662
|
+
decode: (selections) => succeed(selectionArrayToRecord(selections)),
|
|
18663
|
+
encode: (value) => succeed(recordToSelectionArray(value))
|
|
18664
|
+
})))]);
|
|
18665
|
+
const ClaudeModelOptions = Union([ClaudeModelOptionsObject, ArraySchema(ProviderOptionSelection).pipe(decodeTo(ClaudeModelOptionsObject, transformOrFail({
|
|
18666
|
+
decode: (selections) => succeed(selectionArrayToRecord(selections)),
|
|
18667
|
+
encode: (value) => succeed(recordToSelectionArray(value))
|
|
18668
|
+
})))]);
|
|
18614
18669
|
Struct({
|
|
18615
18670
|
codex: optional$4(CodexModelOptions),
|
|
18616
18671
|
claudeAgent: optional$4(ClaudeModelOptions),
|
|
@@ -18637,10 +18692,6 @@ const ModelCapabilities = Struct({
|
|
|
18637
18692
|
contextWindowOptions: ArraySchema(ContextWindowOption),
|
|
18638
18693
|
promptInjectedEffortLevels: ArraySchema(TrimmedNonEmptyString)
|
|
18639
18694
|
});
|
|
18640
|
-
const ProviderOptionSelection = Struct({
|
|
18641
|
-
id: TrimmedNonEmptyString,
|
|
18642
|
-
value: Union([TrimmedNonEmptyString, Boolean$1])
|
|
18643
|
-
});
|
|
18644
18695
|
function effortLabel(value) {
|
|
18645
18696
|
switch (value) {
|
|
18646
18697
|
case "xhigh": return "Extra High";
|
|
@@ -22201,14 +22252,14 @@ var ServerSettingsError = class extends TaggedErrorClass()("ServerSettingsError"
|
|
|
22201
22252
|
...DEFAULT_CLIENT_SETTINGS
|
|
22202
22253
|
});
|
|
22203
22254
|
const CodexModelOptionsPatch = Struct({
|
|
22204
|
-
reasoningEffort: optionalKey(
|
|
22205
|
-
fastMode: optionalKey(
|
|
22255
|
+
reasoningEffort: optionalKey(CodexModelOptionsObject.fields.reasoningEffort),
|
|
22256
|
+
fastMode: optionalKey(CodexModelOptionsObject.fields.fastMode)
|
|
22206
22257
|
});
|
|
22207
22258
|
const ClaudeModelOptionsPatch = Struct({
|
|
22208
|
-
thinking: optionalKey(
|
|
22209
|
-
effort: optionalKey(
|
|
22210
|
-
fastMode: optionalKey(
|
|
22211
|
-
contextWindow: optionalKey(
|
|
22259
|
+
thinking: optionalKey(ClaudeModelOptionsObject.fields.thinking),
|
|
22260
|
+
effort: optionalKey(ClaudeModelOptionsObject.fields.effort),
|
|
22261
|
+
fastMode: optionalKey(ClaudeModelOptionsObject.fields.fastMode),
|
|
22262
|
+
contextWindow: optionalKey(ClaudeModelOptionsObject.fields.contextWindow)
|
|
22212
22263
|
});
|
|
22213
22264
|
const ModelSelectionPatch = Union([Struct({
|
|
22214
22265
|
provider: optionalKey(Literal("codex")),
|
|
@@ -50056,7 +50107,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
50056
50107
|
const min = forceColor || 0;
|
|
50057
50108
|
if (env.TERM === "dumb") return min;
|
|
50058
50109
|
if (process$1.platform === "win32") {
|
|
50059
|
-
const osRelease =
|
|
50110
|
+
const osRelease = os.release().split(".");
|
|
50060
50111
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
50061
50112
|
return 1;
|
|
50062
50113
|
}
|
|
@@ -52499,7 +52550,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
52499
52550
|
exports.processDetector = void 0;
|
|
52500
52551
|
const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
|
|
52501
52552
|
const semconv_1 = require_semconv$1();
|
|
52502
|
-
const os$
|
|
52553
|
+
const os$4 = __require("os");
|
|
52503
52554
|
/**
|
|
52504
52555
|
* ProcessDetector will be used to detect the resources related current process running
|
|
52505
52556
|
* and being instrumented from the NodeJS Process module.
|
|
@@ -52521,7 +52572,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
52521
52572
|
};
|
|
52522
52573
|
if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
52523
52574
|
try {
|
|
52524
|
-
const userInfo = os$
|
|
52575
|
+
const userInfo = os$4.userInfo();
|
|
52525
52576
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
|
|
52526
52577
|
} catch (e) {
|
|
52527
52578
|
api_1.diag.debug(`error obtaining process owner: ${e}`);
|
|
@@ -65444,7 +65495,7 @@ function normalizeNumberish(value) {
|
|
|
65444
65495
|
}
|
|
65445
65496
|
//#endregion
|
|
65446
65497
|
//#region package.json
|
|
65447
|
-
var version$1 = "0.10.
|
|
65498
|
+
var version$1 = "0.10.14";
|
|
65448
65499
|
//#endregion
|
|
65449
65500
|
//#region src/sentry.ts
|
|
65450
65501
|
const SERVER_APP_NAME = "forge-server";
|
|
@@ -74181,7 +74232,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
74181
74232
|
var fs$6 = __require("fs");
|
|
74182
74233
|
var path$5 = __require("path");
|
|
74183
74234
|
var url$1 = __require("url");
|
|
74184
|
-
var os$
|
|
74235
|
+
var os$3 = __require("os");
|
|
74185
74236
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
74186
74237
|
var vars = process.config && process.config.variables || {};
|
|
74187
74238
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
@@ -74189,8 +74240,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
74189
74240
|
var abi = versions.modules;
|
|
74190
74241
|
if (versions.deno || process.isBun) abi = "unsupported";
|
|
74191
74242
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
74192
|
-
var arch = process.env.npm_config_arch || os$
|
|
74193
|
-
var platform = process.env.npm_config_platform || os$
|
|
74243
|
+
var arch = process.env.npm_config_arch || os$3.arch();
|
|
74244
|
+
var platform = process.env.npm_config_platform || os$3.platform();
|
|
74194
74245
|
var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
|
|
74195
74246
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
74196
74247
|
var uv = (versions.uv || "").split(".")[0];
|
|
@@ -77382,10 +77433,10 @@ function updateSuccessfulEntry(input) {
|
|
|
77382
77433
|
return next;
|
|
77383
77434
|
}
|
|
77384
77435
|
const makeSourceControlRateLimit = gen(function* () {
|
|
77385
|
-
const entries = yield* make$
|
|
77436
|
+
const entries = yield* make$50(/* @__PURE__ */ new Map());
|
|
77386
77437
|
const check = fn$1("SourceControlRateLimit.check")(function* (input, options) {
|
|
77387
77438
|
const now = yield* currentTimeMillis;
|
|
77388
|
-
const entry = (yield* get$
|
|
77439
|
+
const entry = (yield* get$6(entries)).get(normalizedKey(input));
|
|
77389
77440
|
if (entry !== void 0 && entry.retryAt > now && options?.allowPaused !== true) return yield* new SourceControlRateLimitPausedError$1({
|
|
77390
77441
|
provider: input.provider,
|
|
77391
77442
|
host: input.host.trim().toLowerCase(),
|
|
@@ -82372,7 +82423,7 @@ const makePullRequestService = gen(function* () {
|
|
|
82372
82423
|
const staleList = staleWhileRevalidate(LIST_STALE_WINDOW, LIST_CACHE_CAPACITY);
|
|
82373
82424
|
const list = (input) => {
|
|
82374
82425
|
const key = listCacheKey(input, listingsEpoch);
|
|
82375
|
-
return staleList(key, get$
|
|
82426
|
+
return staleList(key, get$8(listCache, key));
|
|
82376
82427
|
};
|
|
82377
82428
|
const detailCache = yield* makeWith$1((key) => {
|
|
82378
82429
|
const [, projectId, repository, number] = JSON.parse(key);
|
|
@@ -82393,7 +82444,7 @@ const makePullRequestService = gen(function* () {
|
|
|
82393
82444
|
input.repository,
|
|
82394
82445
|
input.number
|
|
82395
82446
|
]);
|
|
82396
|
-
return staleDetail(key, get$
|
|
82447
|
+
return staleDetail(key, get$8(detailCache, key));
|
|
82397
82448
|
};
|
|
82398
82449
|
const activityCache = yield* makeWith$1((key) => {
|
|
82399
82450
|
const [, projectId, repository, number] = JSON.parse(key);
|
|
@@ -82414,7 +82465,7 @@ const makePullRequestService = gen(function* () {
|
|
|
82414
82465
|
input.repository,
|
|
82415
82466
|
input.number
|
|
82416
82467
|
]);
|
|
82417
|
-
return staleActivity(key, get$
|
|
82468
|
+
return staleActivity(key, get$8(activityCache, key));
|
|
82418
82469
|
};
|
|
82419
82470
|
const diffCache = yield* makeWith$1((key) => {
|
|
82420
82471
|
const [, projectId, repository, number, cursor, commit] = JSON.parse(key);
|
|
@@ -82442,7 +82493,7 @@ const makePullRequestService = gen(function* () {
|
|
|
82442
82493
|
input.cursor ?? null,
|
|
82443
82494
|
input.commit ?? null
|
|
82444
82495
|
]);
|
|
82445
|
-
return staleDiff(key, get$
|
|
82496
|
+
return staleDiff(key, get$8(diffCache, key));
|
|
82446
82497
|
};
|
|
82447
82498
|
const listStatsCache = yield* makeWith$1((key) => {
|
|
82448
82499
|
const [, refs] = JSON.parse(key);
|
|
@@ -82463,7 +82514,7 @@ const makePullRequestService = gen(function* () {
|
|
|
82463
82514
|
ref.repository,
|
|
82464
82515
|
ref.number
|
|
82465
82516
|
]).toSorted((left, right) => `${left[0]} ${left[1]} ${left[2]}`.localeCompare(`${right[0]} ${right[1]} ${right[2]}`))]);
|
|
82466
|
-
return staleListStats(key, get$
|
|
82517
|
+
return staleListStats(key, get$8(listStatsCache, key));
|
|
82467
82518
|
};
|
|
82468
82519
|
const invalidate = (input) => sync$1(() => {
|
|
82469
82520
|
if (input.reference === void 0) {
|
|
@@ -82581,12 +82632,12 @@ function resolveGithubWriteIdentity(getSettings) {
|
|
|
82581
82632
|
}
|
|
82582
82633
|
var ServerSettingsService = class ServerSettingsService extends Service$1()("forge/serverSettings/ServerSettingsService") {
|
|
82583
82634
|
static layerTest = (overrides = {}) => effect(ServerSettingsService, gen(function* () {
|
|
82584
|
-
const currentSettingsRef = yield* make$
|
|
82635
|
+
const currentSettingsRef = yield* make$50(deepMerge$1(DEFAULT_SERVER_SETTINGS, overrides));
|
|
82585
82636
|
return {
|
|
82586
82637
|
start: void_$1,
|
|
82587
82638
|
ready: void_$1,
|
|
82588
|
-
getSettings: get$
|
|
82589
|
-
updateSettings: (patch) => get$
|
|
82639
|
+
getSettings: get$6(currentSettingsRef),
|
|
82640
|
+
updateSettings: (patch) => get$6(currentSettingsRef).pipe(map$3((currentSettings) => deepMerge$1(currentSettings, patch)), tap((nextSettings) => set$2(currentSettingsRef, nextSettings))),
|
|
82590
82641
|
streamChanges: empty$5
|
|
82591
82642
|
};
|
|
82592
82643
|
}));
|
|
@@ -82642,7 +82693,7 @@ const ServerSettingsLive = effect(ServerSettingsService, gen(function* () {
|
|
|
82642
82693
|
const writeSemaphore = yield* make$43(1);
|
|
82643
82694
|
const cacheKey = "settings";
|
|
82644
82695
|
const changesPubSub = yield* unbounded$1();
|
|
82645
|
-
const startedRef = yield* make$
|
|
82696
|
+
const startedRef = yield* make$50(false);
|
|
82646
82697
|
const startedDeferred = yield* make$39();
|
|
82647
82698
|
const watcherScope = yield* make$37("sequential");
|
|
82648
82699
|
yield* addFinalizer$2(() => close(watcherScope, void_$3));
|
|
@@ -82670,11 +82721,11 @@ const ServerSettingsLive = effect(ServerSettingsService, gen(function* () {
|
|
|
82670
82721
|
}
|
|
82671
82722
|
return decoded.value;
|
|
82672
82723
|
});
|
|
82673
|
-
const settingsCache = yield* make$
|
|
82724
|
+
const settingsCache = yield* make$51({
|
|
82674
82725
|
capacity: 1,
|
|
82675
82726
|
lookup: () => loadSettingsFromDisk
|
|
82676
82727
|
});
|
|
82677
|
-
const getSettingsFromCache = get$
|
|
82728
|
+
const getSettingsFromCache = get$8(settingsCache, cacheKey);
|
|
82678
82729
|
const writeSettingsAtomically = (settings) => {
|
|
82679
82730
|
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
|
82680
82731
|
const sparseSettings = stripDefaultServerSettings(settings, DEFAULT_SERVER_SETTINGS) ?? {};
|
|
@@ -91471,7 +91522,7 @@ const KeybindingsLive = effect(Keybindings, gen(function* () {
|
|
|
91471
91522
|
const upsertSemaphore = yield* make$43(1);
|
|
91472
91523
|
const resolvedConfigCacheKey = "resolved";
|
|
91473
91524
|
const changesPubSub = yield* unbounded$1();
|
|
91474
|
-
const startedRef = yield* make$
|
|
91525
|
+
const startedRef = yield* make$50(false);
|
|
91475
91526
|
const startedDeferred = yield* make$39();
|
|
91476
91527
|
const watcherScope = yield* make$37("sequential");
|
|
91477
91528
|
yield* addFinalizer$2(() => close(watcherScope, void_$3));
|
|
@@ -91571,11 +91622,11 @@ const KeybindingsLive = effect(Keybindings, gen(function* () {
|
|
|
91571
91622
|
keybindings: mergeWithDefaultKeybindings(compileResolvedKeybindingsConfig(keybindings)),
|
|
91572
91623
|
issues
|
|
91573
91624
|
})));
|
|
91574
|
-
const resolvedConfigCache = yield* make$
|
|
91625
|
+
const resolvedConfigCache = yield* make$51({
|
|
91575
91626
|
capacity: 1,
|
|
91576
91627
|
lookup: () => loadConfigStateFromDisk
|
|
91577
91628
|
});
|
|
91578
|
-
const loadConfigStateFromCacheOrDisk = get$
|
|
91629
|
+
const loadConfigStateFromCacheOrDisk = get$8(resolvedConfigCache, resolvedConfigCacheKey);
|
|
91579
91630
|
const revalidateAndEmit = upsertSemaphore.withPermits(1)(gen(function* () {
|
|
91580
91631
|
yield* invalidate(resolvedConfigCache, resolvedConfigCacheKey);
|
|
91581
91632
|
yield* emitChange(yield* loadConfigStateFromCacheOrDisk);
|
|
@@ -91655,7 +91706,7 @@ const KeybindingsLive = effect(Keybindings, gen(function* () {
|
|
|
91655
91706
|
});
|
|
91656
91707
|
return {
|
|
91657
91708
|
start: gen(function* () {
|
|
91658
|
-
if (yield* get$
|
|
91709
|
+
if (yield* get$6(startedRef)) return yield* _await(startedDeferred);
|
|
91659
91710
|
yield* set$2(startedRef, true);
|
|
91660
91711
|
const startupExit = yield* exit(gen(function* () {
|
|
91661
91712
|
yield* startWatcher;
|
|
@@ -91920,7 +91971,7 @@ const launchDetached = (launch) => gen(function* () {
|
|
|
91920
91971
|
});
|
|
91921
91972
|
const OpenLive = effect(Open, gen(function* () {
|
|
91922
91973
|
const open = yield* tryPromise({
|
|
91923
|
-
try: () => import("./open-
|
|
91974
|
+
try: () => import("./open-FIgTDosf.mjs"),
|
|
91924
91975
|
catch: (cause) => new OpenError$1({
|
|
91925
91976
|
message: "failed to load browser opener",
|
|
91926
91977
|
cause
|
|
@@ -92499,7 +92550,7 @@ var ProviderRegistry = class extends Service$1()("forge/provider/Services/Provid
|
|
|
92499
92550
|
var ServerLifecycleEvents = class extends Service$1()("forge/serverLifecycleEvents") {};
|
|
92500
92551
|
const ServerLifecycleEventsLive = effect(ServerLifecycleEvents, gen(function* () {
|
|
92501
92552
|
const pubsub = yield* unbounded$1();
|
|
92502
|
-
const state = yield* make$
|
|
92553
|
+
const state = yield* make$50({
|
|
92503
92554
|
sequence: 0,
|
|
92504
92555
|
events: []
|
|
92505
92556
|
});
|
|
@@ -92515,7 +92566,7 @@ const ServerLifecycleEventsLive = effect(ServerLifecycleEvents, gen(function* ()
|
|
|
92515
92566
|
events: nextEvent.type === "welcome" ? [nextEvent, ...current.events.filter((entry) => entry.type !== "welcome")] : [nextEvent, ...current.events.filter((entry) => entry.type !== "ready")]
|
|
92516
92567
|
}];
|
|
92517
92568
|
}).pipe(tap((event) => publish(pubsub, event))),
|
|
92518
|
-
snapshot: get$
|
|
92569
|
+
snapshot: get$6(state),
|
|
92519
92570
|
get stream() {
|
|
92520
92571
|
return fromPubSub(pubsub);
|
|
92521
92572
|
}
|
|
@@ -97796,10 +97847,10 @@ const runUsageScanWarmup = (options) => gen(function* () {
|
|
|
97796
97847
|
const now = options.now ?? currentTimeMillis;
|
|
97797
97848
|
const startDelayMs = options.startDelayMs ?? 2e4;
|
|
97798
97849
|
const intervalMs = options.intervalMs ?? 36e5;
|
|
97799
|
-
const scanning = yield* make$
|
|
97850
|
+
const scanning = yield* make$50(false);
|
|
97800
97851
|
yield* sleep(startDelayMs);
|
|
97801
97852
|
return yield* forever$1(gen(function* () {
|
|
97802
|
-
if (yield* get$
|
|
97853
|
+
if (yield* get$6(scanning)) yield* logInfo("usage scan warm-up skipped; the previous scan is still running");
|
|
97803
97854
|
else {
|
|
97804
97855
|
yield* set$2(scanning, true);
|
|
97805
97856
|
yield* forkChild(scanOnce(options, now).pipe(ensuring(set$2(scanning, false))));
|
|
@@ -97815,7 +97866,7 @@ const settleQueuedCommand = (deferred, exit) => isSuccess(exit) ? succeed$3(defe
|
|
|
97815
97866
|
const makeCommandGate = gen(function* () {
|
|
97816
97867
|
const commandReady = yield* make$39();
|
|
97817
97868
|
const commandQueue = yield* unbounded$2();
|
|
97818
|
-
const commandReadinessState = yield* make$
|
|
97869
|
+
const commandReadinessState = yield* make$50("pending");
|
|
97819
97870
|
yield* forkScoped(forever$1(take$1(commandQueue).pipe(flatMap((command) => command.run))));
|
|
97820
97871
|
return {
|
|
97821
97872
|
awaitCommandReady: _await(commandReady),
|
|
@@ -97828,7 +97879,7 @@ const makeCommandGate = gen(function* () {
|
|
|
97828
97879
|
yield* fail$3(commandReady, error).pipe(orDie);
|
|
97829
97880
|
}),
|
|
97830
97881
|
enqueueCommand: (effect) => gen(function* () {
|
|
97831
|
-
const readinessState = yield* get$
|
|
97882
|
+
const readinessState = yield* get$6(commandReadinessState);
|
|
97832
97883
|
if (readinessState === "ready") return yield* effect;
|
|
97833
97884
|
if (readinessState !== "pending") return yield* readinessState;
|
|
97834
97885
|
const result = yield* make$39();
|
|
@@ -99187,19 +99238,19 @@ function previewUrlForPort(port) {
|
|
|
99187
99238
|
return `http://127.0.0.1:${port}/`;
|
|
99188
99239
|
}
|
|
99189
99240
|
const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
|
|
99190
|
-
const byThreadId = yield* make$
|
|
99191
|
-
const usedPorts = yield* make$
|
|
99241
|
+
const byThreadId = yield* make$50(/* @__PURE__ */ new Map());
|
|
99242
|
+
const usedPorts = yield* make$50(/* @__PURE__ */ new Set());
|
|
99192
99243
|
const allocateNextPort = gen(function* () {
|
|
99193
|
-
const used = yield* get$
|
|
99244
|
+
const used = yield* get$6(usedPorts);
|
|
99194
99245
|
for (let port = DEFAULT_PORT_MIN; port <= DEFAULT_PORT_MAX; port += 1) if (!used.has(port)) return port;
|
|
99195
99246
|
return yield* new ThreadDevRuntimeError({ detail: `No dev ports available in range ${DEFAULT_PORT_MIN}-${DEFAULT_PORT_MAX}.` });
|
|
99196
99247
|
});
|
|
99197
99248
|
return {
|
|
99198
99249
|
get: (input) => gen(function* () {
|
|
99199
|
-
return (yield* get$
|
|
99250
|
+
return (yield* get$6(byThreadId)).get(input.threadId) ?? null;
|
|
99200
99251
|
}),
|
|
99201
99252
|
allocatePort: (input) => gen(function* () {
|
|
99202
|
-
const existing = (yield* get$
|
|
99253
|
+
const existing = (yield* get$6(byThreadId)).get(input.threadId);
|
|
99203
99254
|
if (existing && existing.status !== "released") return existing;
|
|
99204
99255
|
const port = yield* allocateNextPort;
|
|
99205
99256
|
const record = {
|
|
@@ -99222,7 +99273,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
|
|
|
99222
99273
|
return record;
|
|
99223
99274
|
}),
|
|
99224
99275
|
release: (input) => gen(function* () {
|
|
99225
|
-
const existing = (yield* get$
|
|
99276
|
+
const existing = (yield* get$6(byThreadId)).get(input.threadId);
|
|
99226
99277
|
if (!existing) return;
|
|
99227
99278
|
yield* update$4(byThreadId, (current) => {
|
|
99228
99279
|
const next = new Map(current);
|
|
@@ -99240,7 +99291,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
|
|
|
99240
99291
|
});
|
|
99241
99292
|
}),
|
|
99242
99293
|
setRunning: (threadId, patch) => gen(function* () {
|
|
99243
|
-
const existing = (yield* get$
|
|
99294
|
+
const existing = (yield* get$6(byThreadId)).get(threadId);
|
|
99244
99295
|
if (!existing && patch.allocatedPort === void 0) return yield* new ThreadDevRuntimeError({ detail: `No dev runtime record for thread ${threadId}.` });
|
|
99245
99296
|
const allocatedPort = patch.allocatedPort ?? existing?.allocatedPort;
|
|
99246
99297
|
if (allocatedPort === void 0) return yield* new ThreadDevRuntimeError({ detail: `No dev runtime port is available for thread ${threadId}.` });
|
|
@@ -105024,7 +105075,7 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(g
|
|
|
105024
105075
|
}), { "rpc.aggregate": "server" }),
|
|
105025
105076
|
[WS_METHODS.subscribeAuthAccess]: (_input) => observeRpcStreamEffect(WS_METHODS.subscribeAuthAccess, gen(function* () {
|
|
105026
105077
|
const initialSnapshot = yield* loadAuthAccessSnapshot();
|
|
105027
|
-
const revisionRef = yield* make$
|
|
105078
|
+
const revisionRef = yield* make$50(1);
|
|
105028
105079
|
const liveEvents = merge$4(bootstrapCredentials.streamChanges, sessions.streamChanges).pipe(mapEffect$1((change) => updateAndGet(revisionRef, (revision) => revision + 1).pipe(map$3((revision) => toAuthAccessStreamEvent(change, revision, currentSessionId)))));
|
|
105029
105080
|
return concat$2(make$45({
|
|
105030
105081
|
version: 1,
|
|
@@ -112359,7 +112410,7 @@ const makeWith = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
112359
112410
|
const compiler = makeCompiler(options.transformQueryNames, options.transformJson);
|
|
112360
112411
|
const transformRows = options.transformResultNames ? defaultTransforms(options.transformResultNames, options.transformJson).array : void 0;
|
|
112361
112412
|
const config = options.config;
|
|
112362
|
-
return Object.assign(yield* make$
|
|
112413
|
+
return Object.assign(yield* make$52({
|
|
112363
112414
|
acquirer: options.acquirer,
|
|
112364
112415
|
transactionAcquirer: options.transactionAcquirer,
|
|
112365
112416
|
compiler,
|
|
@@ -116110,8 +116161,8 @@ effectDiscard(runMigrations());
|
|
|
116110
116161
|
//#endregion
|
|
116111
116162
|
//#region src/persistence/Layers/Sqlite.ts
|
|
116112
116163
|
const defaultSqliteClientLoaders = {
|
|
116113
|
-
bun: () => import("./SqliteClient-
|
|
116114
|
-
node: () => import("./NodeSqliteClient-
|
|
116164
|
+
bun: () => import("./SqliteClient-CIsITMoQ.mjs"),
|
|
116165
|
+
node: () => import("./NodeSqliteClient-DGInbxQ3.mjs")
|
|
116115
116166
|
};
|
|
116116
116167
|
const makeRuntimeSqliteLayer = fn$1("makeRuntimeSqliteLayer")(function* (config) {
|
|
116117
116168
|
const loader = defaultSqliteClientLoaders[process.versions.bun !== void 0 ? "bun" : "node"];
|
|
@@ -147323,7 +147374,7 @@ const AnalyticsServiceLayerLive = effect(AnalyticsService, gen(function* () {
|
|
|
147323
147374
|
const httpClient = yield* HttpClient;
|
|
147324
147375
|
const serverConfig = yield* ServerConfig;
|
|
147325
147376
|
const identifier = yield* getTelemetryIdentifier;
|
|
147326
|
-
const bufferRef = yield* make$
|
|
147377
|
+
const bufferRef = yield* make$50([]);
|
|
147327
147378
|
const clientType = serverConfig.mode === "desktop" ? "desktop-app" : "cli-web-client";
|
|
147328
147379
|
const enqueueBufferedEvent = (event, properties) => flatMap(now, (now) => modify$3(bufferRef, (current) => {
|
|
147329
147380
|
const appended = [...current, {
|
|
@@ -149739,6 +149790,23 @@ function issueCmmdLocalUserProviderEgressCredential(input) {
|
|
|
149739
149790
|
});
|
|
149740
149791
|
}
|
|
149741
149792
|
//#endregion
|
|
149793
|
+
//#region src/provider/codexAccountTransition.ts
|
|
149794
|
+
function explicitProviderAccountTransition(fromAccountId, toAccountId) {
|
|
149795
|
+
if (!fromAccountId || !toAccountId || fromAccountId === toAccountId) return void 0;
|
|
149796
|
+
return {
|
|
149797
|
+
fromAccountId,
|
|
149798
|
+
toAccountId
|
|
149799
|
+
};
|
|
149800
|
+
}
|
|
149801
|
+
function permitsCodexAccountTransition(input) {
|
|
149802
|
+
const { transition, requestedAccountId, prior, current } = input;
|
|
149803
|
+
if (!transition || transition.fromAccountId === transition.toAccountId || transition.toAccountId !== requestedAccountId || prior.identity.kind !== "provider_account" || current.identity.kind !== "provider_account" || prior.identity.provider !== "codex" || current.identity.provider !== "codex") return false;
|
|
149804
|
+
return providerDeliveryBindingsEqual({
|
|
149805
|
+
...prior,
|
|
149806
|
+
identity: current.identity
|
|
149807
|
+
}, current);
|
|
149808
|
+
}
|
|
149809
|
+
//#endregion
|
|
149742
149810
|
//#region src/providerAuth/codexLocalAccountIdentity.ts
|
|
149743
149811
|
const ACCOUNT_IDENTITY_PATH = "/api/forge/context/providers/codex/account-identity";
|
|
149744
149812
|
const PROVIDER_ACCOUNT_IDENTITY$1 = /^pai_v1_[A-Za-z0-9_-]{43}$/;
|
|
@@ -150236,7 +150304,12 @@ var CodexAppServerManager = class extends EventEmitter$1 {
|
|
|
150236
150304
|
const rawPriorDeliveryBinding = input.resumeCursor.providerDeliveryBinding;
|
|
150237
150305
|
const priorDeliveryBinding = readProviderDeliveryBinding(rawPriorDeliveryBinding);
|
|
150238
150306
|
if (rawPriorDeliveryBinding !== void 0 && rawPriorDeliveryBinding !== null && !priorDeliveryBinding) throw new Error("Existing Codex history cannot resume because its persisted delivered provider account binding is unreadable.");
|
|
150239
|
-
if (priorDeliveryBinding && !providerDeliveryBindingsEqual(priorDeliveryBinding, currentDeliveryBinding)
|
|
150307
|
+
if (priorDeliveryBinding && !providerDeliveryBindingsEqual(priorDeliveryBinding, currentDeliveryBinding) && !permitsCodexAccountTransition({
|
|
150308
|
+
transition: input.accountTransition,
|
|
150309
|
+
requestedAccountId: input.providerAccountId,
|
|
150310
|
+
prior: priorDeliveryBinding,
|
|
150311
|
+
current: currentDeliveryBinding
|
|
150312
|
+
})) throw new Error("Existing Codex history cannot resume because the delivered provider account changed.");
|
|
150240
150313
|
}
|
|
150241
150314
|
const initialResumeCursor = initialCodexResumeCursor({
|
|
150242
150315
|
resumeCursor: input.resumeCursor,
|
|
@@ -188933,7 +189006,7 @@ var Vce = {
|
|
|
188933
189006
|
function Ve() {
|
|
188934
189007
|
return Vce;
|
|
188935
189008
|
}
|
|
188936
|
-
var Us =
|
|
189009
|
+
var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
|
|
188937
189010
|
let t = path.join(Us, "Library");
|
|
188938
189011
|
return {
|
|
188939
189012
|
data: path.join(t, "Application Support", e),
|
|
@@ -199133,12 +199206,12 @@ function qZ(e, t) {
|
|
|
199133
199206
|
}
|
|
199134
199207
|
return n;
|
|
199135
199208
|
}
|
|
199136
|
-
var os$
|
|
199209
|
+
var os$2 = "https://code.claude.com/docs/en", kKe = [
|
|
199137
199210
|
{
|
|
199138
199211
|
matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
|
|
199139
199212
|
tip: {
|
|
199140
199213
|
suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
|
|
199141
|
-
docLink: `${os$
|
|
199214
|
+
docLink: `${os$2}/iam#permission-modes`
|
|
199142
199215
|
}
|
|
199143
199216
|
},
|
|
199144
199217
|
{
|
|
@@ -199153,7 +199226,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199153
199226
|
matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
|
|
199154
199227
|
tip: {
|
|
199155
199228
|
suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
|
|
199156
|
-
docLink: `${os$
|
|
199229
|
+
docLink: `${os$2}/settings#environment-variables`
|
|
199157
199230
|
}
|
|
199158
199231
|
},
|
|
199159
199232
|
{
|
|
@@ -199164,14 +199237,14 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199164
199237
|
matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
|
|
199165
199238
|
tip: {
|
|
199166
199239
|
suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
|
|
199167
|
-
docLink: `${os$
|
|
199240
|
+
docLink: `${os$2}/hooks`
|
|
199168
199241
|
}
|
|
199169
199242
|
},
|
|
199170
199243
|
{
|
|
199171
199244
|
matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
|
|
199172
199245
|
tip: {
|
|
199173
199246
|
suggestion: "Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {\"type\": \"command\", \"command\": \"echo\", \"args\": [\"hi\"]}. For shell form, set `command` to the full shell string: {\"type\": \"command\", \"command\": \"echo hi\"}.",
|
|
199174
|
-
docLink: `${os$
|
|
199247
|
+
docLink: `${os$2}/hooks#exec-form-and-shell-form`
|
|
199175
199248
|
}
|
|
199176
199249
|
},
|
|
199177
199250
|
{
|
|
@@ -199186,7 +199259,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199186
199259
|
matches: (e) => e.code === "unrecognized_keys",
|
|
199187
199260
|
tip: {
|
|
199188
199261
|
suggestion: "Check for typos or refer to the documentation for valid fields",
|
|
199189
|
-
docLink: `${os$
|
|
199262
|
+
docLink: `${os$2}/settings`
|
|
199190
199263
|
}
|
|
199191
199264
|
},
|
|
199192
199265
|
{
|
|
@@ -199201,13 +199274,13 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
|
|
|
199201
199274
|
matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
|
|
199202
199275
|
tip: {
|
|
199203
199276
|
suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
|
|
199204
|
-
docLink: `${os$
|
|
199277
|
+
docLink: `${os$2}/iam#working-directories`
|
|
199205
199278
|
}
|
|
199206
199279
|
}
|
|
199207
199280
|
], AKe = {
|
|
199208
|
-
permissions: `${os$
|
|
199209
|
-
env: `${os$
|
|
199210
|
-
hooks: `${os$
|
|
199281
|
+
permissions: `${os$2}/iam#configuring-permissions`,
|
|
199282
|
+
env: `${os$2}/settings#environment-variables`,
|
|
199283
|
+
hooks: `${os$2}/hooks`
|
|
199211
199284
|
};
|
|
199212
199285
|
function GZ(e) {
|
|
199213
199286
|
let t = kKe.find((r) => r.matches(e));
|
|
@@ -209090,7 +209163,7 @@ const MODEL_LIST_PROBE_TIMEOUT_MS = 5e3;
|
|
|
209090
209163
|
const probeCliModels = (input) => gen(function* () {
|
|
209091
209164
|
const useShell = process.platform === "win32";
|
|
209092
209165
|
if (useShell && !isShellSafeCommandPath(input.binaryPath)) return;
|
|
209093
|
-
const command = make$
|
|
209166
|
+
const command = make$48(input.binaryPath, [...input.args], {
|
|
209094
209167
|
shell: useShell,
|
|
209095
209168
|
env: scrubForgeProviderChildEnvSecrets(process.env)
|
|
209096
209169
|
});
|
|
@@ -210383,6 +210456,7 @@ const makeCodexAdapter = fn$1("makeCodexAdapter")(function* (options) {
|
|
|
210383
210456
|
...browserToolEnvironmentId !== void 0 ? { environmentId: browserToolEnvironmentId } : {}
|
|
210384
210457
|
};
|
|
210385
210458
|
const managerInput = {
|
|
210459
|
+
...input.accountTransition ? { accountTransition: input.accountTransition } : {},
|
|
210386
210460
|
threadId: input.threadId,
|
|
210387
210461
|
provider: "codex",
|
|
210388
210462
|
...input.cwd !== void 0 ? { cwd: input.cwd } : {},
|
|
@@ -210716,14 +210790,14 @@ const makeManagedServerProvider = fn$1("makeManagedServerProvider")(function* (i
|
|
|
210716
210790
|
const refreshSemaphore = yield* make$43(1);
|
|
210717
210791
|
const changesPubSub = yield* acquireRelease(unbounded$1(), shutdown$2);
|
|
210718
210792
|
const initialSettings = yield* input.getSettings;
|
|
210719
|
-
const snapshotRef = yield* make$
|
|
210720
|
-
const settingsRef = yield* make$
|
|
210793
|
+
const snapshotRef = yield* make$50(input.initialSnapshot(initialSettings));
|
|
210794
|
+
const settingsRef = yield* make$50(initialSettings);
|
|
210721
210795
|
const applySnapshotBase = fn$1("applySnapshot")(function* (nextSettings, options) {
|
|
210722
210796
|
const forceRefresh = options?.forceRefresh === true;
|
|
210723
|
-
const previousSettings = yield* get$
|
|
210797
|
+
const previousSettings = yield* get$6(settingsRef);
|
|
210724
210798
|
if (!forceRefresh && !input.haveSettingsChanged(previousSettings, nextSettings)) {
|
|
210725
210799
|
yield* set$2(settingsRef, nextSettings);
|
|
210726
|
-
return yield* get$
|
|
210800
|
+
return yield* get$6(snapshotRef);
|
|
210727
210801
|
}
|
|
210728
210802
|
const nextSnapshot = yield* input.checkProvider;
|
|
210729
210803
|
yield* set$2(settingsRef, nextSettings);
|
|
@@ -210736,9 +210810,9 @@ const makeManagedServerProvider = fn$1("makeManagedServerProvider")(function* (i
|
|
|
210736
210810
|
return yield* applySnapshot(yield* input.getSettings, { forceRefresh: true });
|
|
210737
210811
|
});
|
|
210738
210812
|
yield* runForEach(input.streamSettings, (nextSettings) => asVoid(applySnapshot(nextSettings))).pipe(forkScoped);
|
|
210739
|
-
const refreshFailureCount = yield* make$
|
|
210813
|
+
const refreshFailureCount = yield* make$50(0);
|
|
210740
210814
|
yield* forever$1(gen(function* () {
|
|
210741
|
-
const failureCount = yield* get$
|
|
210815
|
+
const failureCount = yield* get$6(refreshFailureCount);
|
|
210742
210816
|
const baseMs = 6e4;
|
|
210743
210817
|
yield* sleep$4(millis(Math.min(baseMs * Math.pow(2, failureCount), 3e5)));
|
|
210744
210818
|
if (isFailure(yield* refreshSnapshot().pipe(tapError((e) => sync$1(() => captureServerError(e))), exit))) {
|
|
@@ -211281,7 +211355,7 @@ const runClaudeCommand = fn$1("runClaudeCommand")(function* (args) {
|
|
|
211281
211355
|
}));
|
|
211282
211356
|
const claudeSettings = yield* service(ServerSettingsService).pipe(flatMap((service) => service.getSettings), map$3((settings) => settings.providers.claudeAgent));
|
|
211283
211357
|
const effectiveConfigPath = claudeSettings.configPath || config.forgeClaudeConfigPath || process.env.CLAUDE_CONFIG_DIR || void 0;
|
|
211284
|
-
const command = make$
|
|
211358
|
+
const command = make$48(claudeSettings.binaryPath, [...args], {
|
|
211285
211359
|
shell: process.platform === "win32",
|
|
211286
211360
|
env: scrubForgeProviderChildEnvSecrets({
|
|
211287
211361
|
...process.env,
|
|
@@ -211465,7 +211539,7 @@ const makePendingClaudeProvider = (claudeSettings) => {
|
|
|
211465
211539
|
const ClaudeProviderLive = effect(ClaudeProvider, gen(function* () {
|
|
211466
211540
|
const serverSettings = yield* ServerSettingsService;
|
|
211467
211541
|
const spawner = yield* ChildProcessSpawner;
|
|
211468
|
-
const subscriptionProbeCache = yield* make$
|
|
211542
|
+
const subscriptionProbeCache = yield* make$51({
|
|
211469
211543
|
capacity: 4,
|
|
211470
211544
|
timeToLive: minutes(5),
|
|
211471
211545
|
lookup: (key) => {
|
|
@@ -211476,7 +211550,7 @@ const ClaudeProviderLive = effect(ClaudeProvider, gen(function* () {
|
|
|
211476
211550
|
});
|
|
211477
211551
|
}
|
|
211478
211552
|
});
|
|
211479
|
-
const getDiscovery = (input) => get$
|
|
211553
|
+
const getDiscovery = (input) => get$8(subscriptionProbeCache, JSON.stringify([input.binaryPath, input.configPath]));
|
|
211480
211554
|
const checkProvider = checkClaudeProviderStatus((input) => getDiscovery(input).pipe(map$3((probe) => probe?.subscriptionType)), (input) => getDiscovery(input).pipe(map$3((probe) => probe?.slashCommands)), (input) => getDiscovery(input).pipe(map$3((probe) => probe?.models))).pipe(provideService(ServerSettingsService, serverSettings), provideService(ChildProcessSpawner, spawner));
|
|
211481
211555
|
return yield* makeManagedServerProvider({
|
|
211482
211556
|
getSettings: serverSettings.getSettings.pipe(map$3((settings) => settings.providers.claudeAgent), orDie),
|
|
@@ -214373,7 +214447,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
214373
214447
|
});
|
|
214374
214448
|
const makeCanUseTool = (contextRef, runtimeMode, pendingApprovals, pendingUserInputs, runFork, runPromise) => {
|
|
214375
214449
|
const canUseToolEffect = fn$1("canUseTool")(function* (toolName, toolInput, callbackOptions) {
|
|
214376
|
-
const context = yield* get$
|
|
214450
|
+
const context = yield* get$6(contextRef);
|
|
214377
214451
|
if (!context) return {
|
|
214378
214452
|
behavior: "deny",
|
|
214379
214453
|
message: "Claude session context is unavailable."
|
|
@@ -214515,7 +214589,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
|
|
|
214515
214589
|
const pendingApprovals = /* @__PURE__ */ new Map();
|
|
214516
214590
|
const pendingUserInputs = /* @__PURE__ */ new Map();
|
|
214517
214591
|
const inFlightTools = /* @__PURE__ */ new Map();
|
|
214518
|
-
const contextRef = yield* make$
|
|
214592
|
+
const contextRef = yield* make$50(void 0);
|
|
214519
214593
|
const canUseTool = makeCanUseTool(contextRef, input.runtimeMode, pendingApprovals, pendingUserInputs, runFork, runPromise);
|
|
214520
214594
|
const serverSettings = yield* serverSettingsService.getSettings.pipe(mapError((error) => new ProviderAdapterProcessError({
|
|
214521
214595
|
provider: PROVIDER$11,
|
|
@@ -218790,9 +218864,9 @@ const makeAcpPatchedProtocol = fn$1("makeAcpPatchedProtocol")(function* (options
|
|
|
218790
218864
|
const notificationQueue = yield* sliding(1024);
|
|
218791
218865
|
const disconnects = yield* unbounded$2();
|
|
218792
218866
|
const outgoing = yield* unbounded$2();
|
|
218793
|
-
const nextRequestId = yield* make$
|
|
218794
|
-
const terminationHandled = yield* make$
|
|
218795
|
-
const extPending = yield* make$
|
|
218867
|
+
const nextRequestId = yield* make$50(1n);
|
|
218868
|
+
const terminationHandled = yield* make$50(false);
|
|
218869
|
+
const extPending = yield* make$50(/* @__PURE__ */ new Map());
|
|
218796
218870
|
const logProtocol = (event) => {
|
|
218797
218871
|
if (event.direction === "incoming" && !options.logIncoming) return void_$1;
|
|
218798
218872
|
if (event.direction === "outgoing" && !options.logOutgoing) return void_$1;
|
|
@@ -218908,7 +218982,7 @@ const makeAcpPatchedProtocol = fn$1("makeAcpPatchedProtocol")(function* (options
|
|
|
218908
218982
|
if (!options.serverRequestMethods.has(message.tag)) return handleExtRequest(message).pipe(catch_(() => respondWithError(message.id, AcpRequestError.internalError())), asVoid);
|
|
218909
218983
|
return offer$1(serverQueue, message).pipe(asVoid);
|
|
218910
218984
|
};
|
|
218911
|
-
const handleExitEncoded = (message) => get$
|
|
218985
|
+
const handleExitEncoded = (message) => get$6(extPending).pipe(flatMap((pending) => {
|
|
218912
218986
|
if (!pending.has(message.requestId)) return offer$1(clientQueue, message).pipe(asVoid);
|
|
218913
218987
|
if (message.exit._tag === "Success") return completeExtPendingSuccess(message.requestId, message.exit.value);
|
|
218914
218988
|
const failure = message.exit.cause.find((entry) => entry._tag === "Fail");
|
|
@@ -218919,7 +218993,7 @@ const makeAcpPatchedProtocol = fn$1("makeAcpPatchedProtocol")(function* (options
|
|
|
218919
218993
|
switch (message._tag) {
|
|
218920
218994
|
case "Request": return handleRequestEncoded(message);
|
|
218921
218995
|
case "Exit": return handleExitEncoded(message);
|
|
218922
|
-
case "Chunk": return get$
|
|
218996
|
+
case "Chunk": return get$6(extPending).pipe(flatMap((pending) => pending.has(message.requestId) ? completeExtPendingFailure(message.requestId, AcpRequestError.internalError("Streaming extension responses are not supported")) : offer$1(clientQueue, message).pipe(asVoid)));
|
|
218923
218997
|
case "Defect":
|
|
218924
218998
|
case "ClientProtocolError":
|
|
218925
218999
|
case "Pong": return offer$1(clientQueue, message).pipe(asVoid);
|
|
@@ -219161,7 +219235,7 @@ ArraySchema(Unknown);
|
|
|
219161
219235
|
//#endregion
|
|
219162
219236
|
//#region ../../packages/effect-acp/src/_internal/stdio.ts
|
|
219163
219237
|
const encoder$1 = new TextEncoder();
|
|
219164
|
-
const makeChildStdio = (handle) => make$
|
|
219238
|
+
const makeChildStdio = (handle) => make$49({
|
|
219165
219239
|
args: succeed([]),
|
|
219166
219240
|
stdin: handle.stdout,
|
|
219167
219241
|
stdout: () => mapInput(handle.stdin, (chunk) => typeof chunk === "string" ? encoder$1.encode(chunk) : chunk),
|
|
@@ -219172,7 +219246,7 @@ fn$1("makeInMemoryStdio")(function* () {
|
|
|
219172
219246
|
const output = yield* unbounded$2();
|
|
219173
219247
|
const decoder = new TextDecoder();
|
|
219174
219248
|
return {
|
|
219175
|
-
stdio: make$
|
|
219249
|
+
stdio: make$49({
|
|
219176
219250
|
args: succeed([]),
|
|
219177
219251
|
stdin: fromQueue(input),
|
|
219178
219252
|
stdout: () => forEach$1((chunk) => offer$1(output, typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }))),
|
|
@@ -219363,11 +219437,11 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219363
219437
|
const spawner = yield* ChildProcessSpawner;
|
|
219364
219438
|
const runtimeScope = yield* Scope$1;
|
|
219365
219439
|
const eventQueue = yield* unbounded$2();
|
|
219366
|
-
const modeStateRef = yield* make$
|
|
219367
|
-
const toolCallsRef = yield* make$
|
|
219368
|
-
const assistantSegmentRef = yield* make$
|
|
219369
|
-
const configOptionsRef = yield* make$
|
|
219370
|
-
const startStateRef = yield* make$
|
|
219440
|
+
const modeStateRef = yield* make$50(void 0);
|
|
219441
|
+
const toolCallsRef = yield* make$50(/* @__PURE__ */ new Map());
|
|
219442
|
+
const assistantSegmentRef = yield* make$50({ nextSegmentIndex: 0 });
|
|
219443
|
+
const configOptionsRef = yield* make$50(sessionConfigOptionsFromSetup(void 0));
|
|
219444
|
+
const startStateRef = yield* make$50({ _tag: "NotStarted" });
|
|
219371
219445
|
const logRequest = (event) => options.requestLogger ? options.requestLogger(event) : void_$1;
|
|
219372
219446
|
const runLoggedRequest = (method, payload, effect) => logRequest({
|
|
219373
219447
|
method,
|
|
@@ -219389,7 +219463,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219389
219463
|
command: options.spawn.command,
|
|
219390
219464
|
cause: /* @__PURE__ */ new Error(`Refusing to spawn ACP child process: command path contains shell metacharacters that cmd.exe would interpret as additional commands. Adjust the provider \`binaryPath\` setting to an unquoted absolute path.`)
|
|
219391
219465
|
});
|
|
219392
|
-
const acpContext = yield* build(layerChildProcess(yield* spawner.spawn(make$
|
|
219466
|
+
const acpContext = yield* build(layerChildProcess(yield* spawner.spawn(make$48(options.spawn.command, [...options.spawn.args], {
|
|
219393
219467
|
...options.spawn.cwd ? { cwd: options.spawn.cwd } : {},
|
|
219394
219468
|
env: scrubForgeProviderChildEnvSecrets({
|
|
219395
219469
|
...process.env,
|
|
@@ -219424,7 +219498,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219424
219498
|
...options.clientCapabilities?._meta ? { _meta: options.clientCapabilities._meta } : {}
|
|
219425
219499
|
};
|
|
219426
219500
|
const getStartedState = gen(function* () {
|
|
219427
|
-
const state = yield* get$
|
|
219501
|
+
const state = yield* get$6(startStateRef);
|
|
219428
219502
|
if (state._tag === "Started") return state.result;
|
|
219429
219503
|
return yield* new AcpTransportError({
|
|
219430
219504
|
detail: "ACP session runtime has not been started",
|
|
@@ -219432,7 +219506,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219432
219506
|
});
|
|
219433
219507
|
});
|
|
219434
219508
|
const validateConfigOptionValue = (configId, value) => gen(function* () {
|
|
219435
|
-
const configOption = findSessionConfigOption(yield* get$
|
|
219509
|
+
const configOption = findSessionConfigOption(yield* get$6(configOptionsRef), configId);
|
|
219436
219510
|
if (!configOption) return;
|
|
219437
219511
|
if (configOption.type === "boolean") {
|
|
219438
219512
|
if (typeof value === "boolean") return;
|
|
@@ -219472,7 +219546,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219472
219546
|
...current,
|
|
219473
219547
|
currentModeId: modeId
|
|
219474
219548
|
} : current);
|
|
219475
|
-
const setConfigOption = (configId, value) => validateConfigOptionValue(configId, value).pipe(flatMap(() => getStartedState), flatMap((started) => get$
|
|
219549
|
+
const setConfigOption = (configId, value) => validateConfigOptionValue(configId, value).pipe(flatMap(() => getStartedState), flatMap((started) => get$6(configOptionsRef).pipe(flatMap((configOptions) => {
|
|
219476
219550
|
const existing = findSessionConfigOption(configOptions, configId);
|
|
219477
219551
|
if (existing && configOptionCurrentValueMatches(existing, value)) return succeed({ configOptions });
|
|
219478
219552
|
const requestPayload = typeof value === "boolean" ? {
|
|
@@ -219553,8 +219627,8 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219553
219627
|
handleExtNotification: acp.handleExtNotification,
|
|
219554
219628
|
start: () => start,
|
|
219555
219629
|
getEvents: () => fromQueue(eventQueue),
|
|
219556
|
-
getModeState: get$
|
|
219557
|
-
getConfigOptions: get$
|
|
219630
|
+
getModeState: get$6(modeStateRef),
|
|
219631
|
+
getConfigOptions: get$6(configOptionsRef),
|
|
219558
219632
|
prompt: (payload) => getStartedState.pipe(flatMap((started) => {
|
|
219559
219633
|
const requestPayload = {
|
|
219560
219634
|
sessionId: started.sessionId,
|
|
@@ -219569,7 +219643,7 @@ const makeAcpSessionRuntime = (options) => gen(function* () {
|
|
|
219569
219643
|
})));
|
|
219570
219644
|
})),
|
|
219571
219645
|
cancel: getStartedState.pipe(flatMap((started) => acp.agent.cancel({ sessionId: started.sessionId }))),
|
|
219572
|
-
setMode: (modeId) => get$
|
|
219646
|
+
setMode: (modeId) => get$6(modeStateRef).pipe(flatMap((modeState) => {
|
|
219573
219647
|
if (modeState?.currentModeId === modeId) return succeed({});
|
|
219574
219648
|
return getStartedState.pipe(flatMap((started) => {
|
|
219575
219649
|
if (sessionResponseHasModeState(started.sessionSetupResult)) {
|
|
@@ -219661,7 +219735,7 @@ const handleSessionUpdate = ({ queue, modeStateRef, toolCallsRef, assistantSegme
|
|
|
219661
219735
|
}
|
|
219662
219736
|
if (event._tag === "ContentDelta") {
|
|
219663
219737
|
if (event.text.trim().length === 0) {
|
|
219664
|
-
if (!(yield* get$
|
|
219738
|
+
if (!(yield* get$6(assistantSegmentRef)).activeItemId) continue;
|
|
219665
219739
|
}
|
|
219666
219740
|
const itemId = yield* ensureActiveAssistantSegment({
|
|
219667
219741
|
queue,
|
|
@@ -219713,7 +219787,7 @@ const closeActiveAssistantSegment = ({ queue, assistantSegmentRef }) => modify$3
|
|
|
219713
219787
|
}, { nextSegmentIndex: current.nextSegmentIndex }];
|
|
219714
219788
|
}).pipe(flatMap((event) => event ? offer$1(queue, event) : void_$1));
|
|
219715
219789
|
const makeStartCoordinator = (startStateRef, startOnce) => gen(function* () {
|
|
219716
|
-
const currentState = yield* get$
|
|
219790
|
+
const currentState = yield* get$6(startStateRef);
|
|
219717
219791
|
if (currentState._tag === "Started") return currentState.result;
|
|
219718
219792
|
if (currentState._tag === "Starting") return yield* _await(currentState.deferred);
|
|
219719
219793
|
const deferred = yield* make$39();
|
|
@@ -219838,7 +219912,7 @@ const readCursorApiKey = (_settings) => process.env.CURSOR_API_KEY || null;
|
|
|
219838
219912
|
const runCursorCommand = fn$1("runCursorCommand")(function* (binaryPath, args) {
|
|
219839
219913
|
const useShell = process.platform === "win32";
|
|
219840
219914
|
if (useShell && !isShellSafeCommandPath(binaryPath)) return yield* fail(/* @__PURE__ */ new Error(`Refusing to spawn cursor-agent: \`binaryPath\` contains shell metacharacters that cmd.exe would interpret as additional commands.`));
|
|
219841
|
-
return yield* spawnAndCollect(binaryPath, make$
|
|
219915
|
+
return yield* spawnAndCollect(binaryPath, make$48(binaryPath, [...args], {
|
|
219842
219916
|
shell: useShell,
|
|
219843
219917
|
env: scrubForgeProviderChildEnvSecrets(process.env)
|
|
219844
219918
|
}));
|
|
@@ -227657,7 +227731,7 @@ const makeOpenCodeRuntime = gen(function* () {
|
|
|
227657
227731
|
const netService = yield* NetService;
|
|
227658
227732
|
const runOpenCodeCommand = (input) => gen(function* () {
|
|
227659
227733
|
yield* rejectUnsafeWindowsBinaryPath("runOpenCodeCommand", input.binaryPath);
|
|
227660
|
-
const child = yield* spawner.spawn(make$
|
|
227734
|
+
const child = yield* spawner.spawn(make$48(input.binaryPath, [...input.args], {
|
|
227661
227735
|
shell: process.platform === "win32",
|
|
227662
227736
|
env: input.environment ?? process.env
|
|
227663
227737
|
}));
|
|
@@ -227692,7 +227766,7 @@ const makeOpenCodeRuntime = gen(function* () {
|
|
|
227692
227766
|
`--hostname=${hostname}`,
|
|
227693
227767
|
`--port=${port}`
|
|
227694
227768
|
];
|
|
227695
|
-
const child = yield* spawner.spawn(make$
|
|
227769
|
+
const child = yield* spawner.spawn(make$48(input.binaryPath, args, {
|
|
227696
227770
|
detached: process.platform !== "win32",
|
|
227697
227771
|
shell: process.platform === "win32",
|
|
227698
227772
|
env: {
|
|
@@ -227713,8 +227787,8 @@ const makeOpenCodeRuntime = gen(function* () {
|
|
|
227713
227787
|
} catch {}
|
|
227714
227788
|
});
|
|
227715
227789
|
yield* addFinalizer$1(runtimeScope, killOpenCodeProcessGroup("SIGTERM").pipe(andThen(sleep$4("1 second")), andThen(killOpenCodeProcessGroup("SIGKILL")), ignore));
|
|
227716
|
-
const stdoutRef = yield* make$
|
|
227717
|
-
const stderrRef = yield* make$
|
|
227790
|
+
const stdoutRef = yield* make$50("");
|
|
227791
|
+
const stderrRef = yield* make$50("");
|
|
227718
227792
|
const readyDeferred = yield* make$39();
|
|
227719
227793
|
const setReadyFromStdoutChunk = (chunk) => updateAndGet(stdoutRef, (stdout) => `${stdout}${chunk}`).pipe(flatMap((nextStdout) => {
|
|
227720
227794
|
const parsed = parseServerUrlFromOutput(nextStdout);
|
|
@@ -227723,8 +227797,8 @@ const makeOpenCodeRuntime = gen(function* () {
|
|
|
227723
227797
|
const stdoutFiber = yield* child.stdout.pipe(decodeText$1(), runForEach(setReadyFromStdoutChunk), ignore, forkIn(runtimeScope));
|
|
227724
227798
|
const stderrFiber = yield* child.stderr.pipe(decodeText$1(), runForEach((chunk) => update$4(stderrRef, (stderr) => `${stderr}${chunk}`)), ignore, forkIn(runtimeScope));
|
|
227725
227799
|
const exitFiber = yield* child.exitCode.pipe(flatMap((code) => gen(function* () {
|
|
227726
|
-
const stdout = yield* get$
|
|
227727
|
-
const stderr = yield* get$
|
|
227800
|
+
const stdout = yield* get$6(stdoutRef);
|
|
227801
|
+
const stderr = yield* get$6(stderrRef);
|
|
227728
227802
|
const exitCode = Number(code);
|
|
227729
227803
|
yield* fail$3(readyDeferred, new OpenCodeRuntimeError({
|
|
227730
227804
|
operation: "startOpenCodeServerProcess",
|
|
@@ -228385,12 +228459,12 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
|
|
|
228385
228459
|
}
|
|
228386
228460
|
}))).pipe(exit, flatMap((exit) => gen(function* () {
|
|
228387
228461
|
/* v8 ignore next -- session-scope interruption timing is a defensive cleanup path. */
|
|
228388
|
-
if (eventsAbortController.signal.aborted || (yield* get$
|
|
228462
|
+
if (eventsAbortController.signal.aborted || (yield* get$6(context.stopped))) return;
|
|
228389
228463
|
if (isFailure(exit)) yield* emitUnexpectedExit(context, openCodeRuntimeErrorDetail(squash(exit.cause)));
|
|
228390
228464
|
})), forkIn(context.sessionScope));
|
|
228391
228465
|
if (!context.server.external && context.server.exitCode !== null) yield* context.server.exitCode.pipe(flatMap((code) => gen(function* () {
|
|
228392
228466
|
/* v8 ignore next -- server-exit watcher can lose the race to an already-stopped context. */
|
|
228393
|
-
if (yield* get$
|
|
228467
|
+
if (yield* get$6(context.stopped)) return;
|
|
228394
228468
|
yield* emitUnexpectedExit(context, `OpenCode server exited unexpectedly (${code}).`);
|
|
228395
228469
|
})), forkIn(context.sessionScope));
|
|
228396
228470
|
});
|
|
@@ -228473,7 +228547,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
|
|
|
228473
228547
|
activeTurnId: void 0,
|
|
228474
228548
|
activeAgent: void 0,
|
|
228475
228549
|
activeVariant: void 0,
|
|
228476
|
-
stopped: yield* make$
|
|
228550
|
+
stopped: yield* make$50(false),
|
|
228477
228551
|
sessionScope: started.sessionScope
|
|
228478
228552
|
};
|
|
228479
228553
|
sessions.set(input.threadId, context);
|
|
@@ -228832,6 +228906,8 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
|
|
|
228832
228906
|
const canonicalEventLogger = options?.canonicalEventLogger ?? (options?.canonicalEventLogPath !== void 0 ? yield* makeEventNdjsonLogger(options.canonicalEventLogPath, { stream: "canonical" }) : void 0);
|
|
228833
228907
|
const registry = yield* ProviderAdapterRegistry;
|
|
228834
228908
|
const directory = yield* ProviderSessionDirectory;
|
|
228909
|
+
const sessionLocks = yield* make$47({ lookup: (_threadId) => make$43(1) });
|
|
228910
|
+
const withSessionLock = (threadId, effect) => get$5(sessionLocks, threadId).pipe(flatMap((lock) => lock.withPermit(effect)), scoped);
|
|
228835
228911
|
const runtimeEventPubSub = yield* unbounded$1();
|
|
228836
228912
|
const assertProviderExecutable = options?.assertProviderExecutable ?? (() => succeed(null));
|
|
228837
228913
|
const assertCurrentProviderDelivery = fn$1("assertCurrentProviderDelivery")(function* (input) {
|
|
@@ -229004,18 +229080,19 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
|
|
|
229004
229080
|
"provider.runtime_mode": input.runtimeMode
|
|
229005
229081
|
});
|
|
229006
229082
|
const persistedBinding = getOrUndefined(yield* directory.getBinding(threadId));
|
|
229007
|
-
yield*
|
|
229083
|
+
const adapter = yield* registry.getByProvider(effectiveProvider);
|
|
229084
|
+
const priorAccountId = readPersistedProviderAccountId(persistedBinding?.runtimePayload);
|
|
229085
|
+
const requestedAccountId = readProviderAccountIdFromModelSelection(input.modelSelection);
|
|
229086
|
+
if (effectiveProvider !== "codex" || persistedBinding?.provider !== effectiveProvider || (yield* adapter.hasSession(threadId))) yield* assertProviderAccountBoundary({
|
|
229008
229087
|
operation: "ProviderService.startSession",
|
|
229009
229088
|
threadId,
|
|
229010
|
-
persistedAccountId:
|
|
229011
|
-
requestedAccountId
|
|
229089
|
+
persistedAccountId: priorAccountId,
|
|
229090
|
+
requestedAccountId
|
|
229012
229091
|
});
|
|
229013
|
-
const effectiveResumeCursor = input.resumeCursor ?? (persistedBinding?.provider === effectiveProvider ? persistedBinding.resumeCursor : void 0);
|
|
229014
|
-
const adapter = yield* registry.getByProvider(effectiveProvider);
|
|
229015
229092
|
const boundResumeCursor = yield* bindProviderDeliveryToResumeCursor({
|
|
229016
229093
|
operation: "ProviderService.startSession",
|
|
229017
229094
|
provider: effectiveProvider,
|
|
229018
|
-
resumeCursor:
|
|
229095
|
+
resumeCursor: input.resumeCursor ?? (persistedBinding?.provider === effectiveProvider ? persistedBinding.resumeCursor : void 0),
|
|
229019
229096
|
currentBinding: yield* assertProviderExecutable({
|
|
229020
229097
|
threadId,
|
|
229021
229098
|
provider: effectiveProvider,
|
|
@@ -229024,6 +229101,7 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
|
|
|
229024
229101
|
});
|
|
229025
229102
|
const session = yield* adapter.startSession({
|
|
229026
229103
|
...input,
|
|
229104
|
+
accountTransition: explicitProviderAccountTransition(priorAccountId, requestedAccountId),
|
|
229027
229105
|
...boundResumeCursor !== void 0 ? { resumeCursor: boundResumeCursor } : {}
|
|
229028
229106
|
});
|
|
229029
229107
|
if (session.provider !== adapter.provider) return yield* toValidationError("ProviderService.startSession", `Adapter/provider mismatch: requested '${adapter.provider}', received '${session.provider}'.`);
|
|
@@ -229324,15 +229402,15 @@ const makeProviderService = fn$1("makeProviderService")(function* (options) {
|
|
|
229324
229402
|
});
|
|
229325
229403
|
yield* addFinalizer$2(() => catch_(runStopAll(), (cause) => logWarning$1("failed to stop provider service", { cause })));
|
|
229326
229404
|
return {
|
|
229327
|
-
startSession,
|
|
229328
|
-
sendTurn,
|
|
229329
|
-
interruptTurn,
|
|
229330
|
-
respondToRequest,
|
|
229331
|
-
respondToUserInput,
|
|
229332
|
-
stopSession,
|
|
229405
|
+
startSession: (threadId, input) => withSessionLock(threadId, startSession(threadId, input)),
|
|
229406
|
+
sendTurn: (input) => withSessionLock(input?.threadId, sendTurn(input)),
|
|
229407
|
+
interruptTurn: (input) => withSessionLock(input?.threadId, interruptTurn(input)),
|
|
229408
|
+
respondToRequest: (input) => withSessionLock(input?.threadId, respondToRequest(input)),
|
|
229409
|
+
respondToUserInput: (input) => withSessionLock(input?.threadId, respondToUserInput(input)),
|
|
229410
|
+
stopSession: (input) => withSessionLock(input?.threadId, stopSession(input)),
|
|
229333
229411
|
listSessions,
|
|
229334
229412
|
getCapabilities,
|
|
229335
|
-
rollbackConversation,
|
|
229413
|
+
rollbackConversation: (input) => withSessionLock(input?.threadId, rollbackConversation(input)),
|
|
229336
229414
|
get streamEvents() {
|
|
229337
229415
|
return fromPubSub(runtimeEventPubSub);
|
|
229338
229416
|
}
|
|
@@ -230531,7 +230609,7 @@ const createTrace2Monitor = fn$1("createTrace2Monitor")(function* (input, progre
|
|
|
230531
230609
|
suffix: ".json"
|
|
230532
230610
|
});
|
|
230533
230611
|
const hookStartByChildKey = /* @__PURE__ */ new Map();
|
|
230534
|
-
const traceTailState = yield* make$
|
|
230612
|
+
const traceTailState = yield* make$50({
|
|
230535
230613
|
processedChars: 0,
|
|
230536
230614
|
remainder: ""
|
|
230537
230615
|
});
|
|
@@ -230706,7 +230784,7 @@ const GitCoreLive = effect(GitCore, fn$1("makeGitCore")(function* (options) {
|
|
|
230706
230784
|
const truncateOutputAtMaxBytes = input.truncateOutputAtMaxBytes ?? false;
|
|
230707
230785
|
return yield* fn$1("runGitCommand")(function* () {
|
|
230708
230786
|
const trace2Monitor = yield* createTrace2Monitor(commandInput, input.progress).pipe(provideService(Path$2, path$10), provideService(FileSystem, fileSystem), mapError(toGitCommandError(commandInput, "failed to create trace2 monitor.")));
|
|
230709
|
-
const child = yield* commandSpawner.spawn(make$
|
|
230787
|
+
const child = yield* commandSpawner.spawn(make$48("git", commandInput.args, {
|
|
230710
230788
|
cwd: commandInput.cwd,
|
|
230711
230789
|
env: withRepositoryOwnershipTrust({
|
|
230712
230790
|
...process.env,
|
|
@@ -230867,7 +230945,7 @@ const GitCoreLive = effect(GitCore, fn$1("makeGitCore")(function* (options) {
|
|
|
230867
230945
|
const refreshStatusUpstreamIfStale = fn$1("refreshStatusUpstreamIfStale")(function* (cwd) {
|
|
230868
230946
|
const upstream = yield* resolveCurrentUpstream(cwd);
|
|
230869
230947
|
if (!upstream) return;
|
|
230870
|
-
yield* get$
|
|
230948
|
+
yield* get$8(statusRemoteRefreshCache, new StatusRemoteRefreshCacheKey({
|
|
230871
230949
|
gitCommonDir: yield* resolveGitCommonDir(cwd),
|
|
230872
230950
|
remoteName: upstream.remoteName
|
|
230873
230951
|
}));
|
|
@@ -232071,10 +232149,10 @@ const GitStatusBroadcasterLive = effect(GitStatusBroadcaster, gen(function* () {
|
|
|
232071
232149
|
const gitManager = yield* GitManager;
|
|
232072
232150
|
const changesPubSub = yield* acquireRelease(unbounded$1(), (pubsub) => shutdown$2(pubsub));
|
|
232073
232151
|
const broadcasterScope = yield* acquireRelease(make$37(), (scope) => close(scope, void_$3));
|
|
232074
|
-
const cacheRef = yield* make$
|
|
232152
|
+
const cacheRef = yield* make$50(/* @__PURE__ */ new Map());
|
|
232075
232153
|
const pollersRef = yield* make$32(/* @__PURE__ */ new Map());
|
|
232076
232154
|
const getCachedStatus = fn$1("getCachedStatus")(function* (cwd) {
|
|
232077
|
-
return yield* get$
|
|
232155
|
+
return yield* get$6(cacheRef).pipe(map$3((cache) => cache.get(cwd) ?? null));
|
|
232078
232156
|
});
|
|
232079
232157
|
const updateCachedLocalStatus = fn$1("updateCachedLocalStatus")(function* (cwd, local, options) {
|
|
232080
232158
|
const nextLocal = {
|
|
@@ -232697,7 +232775,7 @@ const runCodexCommand = fn$1("runCodexCommand")(function* (args) {
|
|
|
232697
232775
|
}));
|
|
232698
232776
|
const codexSettings = yield* (yield* ServerSettingsService).getSettings.pipe(map$3((settings) => settings.providers.codex));
|
|
232699
232777
|
const effectiveHomePath = codexSettings.homePath || config.forgeCodexHomePath || process.env.CODEX_HOME || void 0;
|
|
232700
|
-
const command = make$
|
|
232778
|
+
const command = make$48(codexSettings.binaryPath, [...args], {
|
|
232701
232779
|
shell: process.platform === "win32",
|
|
232702
232780
|
env: scrubForgeProviderChildEnvSecrets({
|
|
232703
232781
|
...process.env,
|
|
@@ -232925,7 +233003,7 @@ const CodexProviderLive = effect(CodexProvider, gen(function* () {
|
|
|
232925
233003
|
const fileSystem = yield* FileSystem;
|
|
232926
233004
|
const path = yield* Path$2;
|
|
232927
233005
|
const spawner = yield* ChildProcessSpawner;
|
|
232928
|
-
const accountProbeCache = yield* make$
|
|
233006
|
+
const accountProbeCache = yield* make$51({
|
|
232929
233007
|
capacity: 4,
|
|
232930
233008
|
timeToLive: minutes(5),
|
|
232931
233009
|
lookup: (key) => {
|
|
@@ -232937,7 +233015,7 @@ const CodexProviderLive = effect(CodexProvider, gen(function* () {
|
|
|
232937
233015
|
});
|
|
232938
233016
|
}
|
|
232939
233017
|
});
|
|
232940
|
-
const getDiscovery = (input) => get$
|
|
233018
|
+
const getDiscovery = (input) => get$8(accountProbeCache, JSON.stringify([
|
|
232941
233019
|
input.binaryPath,
|
|
232942
233020
|
input.homePath,
|
|
232943
233021
|
input.cwd
|
|
@@ -233079,7 +233157,7 @@ const CodexTextGenerationLive = effect(TextGeneration, gen(function* () {
|
|
|
233079
233157
|
...threadId ? { threadId } : {},
|
|
233080
233158
|
authSessionId
|
|
233081
233159
|
});
|
|
233082
|
-
const command = make$
|
|
233160
|
+
const command = make$48(codexSettings?.binaryPath || "codex", [
|
|
233083
233161
|
"exec",
|
|
233084
233162
|
"--ephemeral",
|
|
233085
233163
|
"--skip-git-repo-check",
|
|
@@ -233317,7 +233395,7 @@ const ClaudeTextGenerationLive = effect(TextGeneration, gen(function* () {
|
|
|
233317
233395
|
};
|
|
233318
233396
|
const claudeSettings = yield* map$3(serverSettingsService.getSettings, (settings) => settings.providers.claudeAgent).pipe(catch_(() => undefined_));
|
|
233319
233397
|
const rawStdout = yield* fn$1("runClaudeJson.runClaudeCommand")(function* () {
|
|
233320
|
-
const command = make$
|
|
233398
|
+
const command = make$48(claudeSettings?.binaryPath || "claude", [
|
|
233321
233399
|
"-p",
|
|
233322
233400
|
"--output-format",
|
|
233323
233401
|
"json",
|
|
@@ -265134,7 +265212,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
265134
265212
|
var dgram = __require("dgram");
|
|
265135
265213
|
var thunky = require_thunky();
|
|
265136
265214
|
var events = __require("events");
|
|
265137
|
-
var os = __require("os");
|
|
265215
|
+
var os$1 = __require("os");
|
|
265138
265216
|
var noop = function() {};
|
|
265139
265217
|
module.exports = function(opts) {
|
|
265140
265218
|
if (!opts) opts = {};
|
|
@@ -265265,14 +265343,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
265265
265343
|
return that;
|
|
265266
265344
|
};
|
|
265267
265345
|
function defaultInterface() {
|
|
265268
|
-
var networks = os.networkInterfaces();
|
|
265346
|
+
var networks = os$1.networkInterfaces();
|
|
265269
265347
|
var names = Object.keys(networks);
|
|
265270
265348
|
for (var i = 0; i < names.length; i++) {
|
|
265271
265349
|
var net = networks[names[i]];
|
|
265272
265350
|
for (var j = 0; j < net.length; j++) {
|
|
265273
265351
|
var iface = net[j];
|
|
265274
265352
|
if (isIPv4(iface.family) && !iface.internal) {
|
|
265275
|
-
if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
|
|
265353
|
+
if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
|
|
265276
265354
|
return "0.0.0.0";
|
|
265277
265355
|
}
|
|
265278
265356
|
}
|
|
@@ -265280,7 +265358,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
265280
265358
|
return "127.0.0.1";
|
|
265281
265359
|
}
|
|
265282
265360
|
function allInterfaces() {
|
|
265283
|
-
var networks = os.networkInterfaces();
|
|
265361
|
+
var networks = os$1.networkInterfaces();
|
|
265284
265362
|
var names = Object.keys(networks);
|
|
265285
265363
|
var res = [];
|
|
265286
265364
|
for (var i = 0; i < names.length; i++) {
|
|
@@ -282835,7 +282913,7 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
|
|
|
282835
282913
|
});
|
|
282836
282914
|
const resolveDefaultBranch = fn$1("resolveDefaultBranch")(function* (cwd, localDefaultBranch) {
|
|
282837
282915
|
if (localDefaultBranch && localDefaultBranch.length > 0) return localDefaultBranch;
|
|
282838
|
-
const fromGh = yield* get$
|
|
282916
|
+
const fromGh = yield* get$8(defaultBranchFallbackCache, normalizeStatusCacheKey(cwd));
|
|
282839
282917
|
if (fromGh && fromGh.length > 0) return fromGh;
|
|
282840
282918
|
return DEFAULT_BASE_BRANCH_FALLBACK;
|
|
282841
282919
|
});
|
|
@@ -283215,10 +283293,10 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
|
|
|
283215
283293
|
};
|
|
283216
283294
|
});
|
|
283217
283295
|
const localStatus = fn$1("localStatus")(function* (input) {
|
|
283218
|
-
return yield* get$
|
|
283296
|
+
return yield* get$8(localStatusResultCache, normalizeStatusCacheKey(input.cwd));
|
|
283219
283297
|
});
|
|
283220
283298
|
const remoteStatus = fn$1("remoteStatus")(function* (input) {
|
|
283221
|
-
return yield* get$
|
|
283299
|
+
return yield* get$8(remoteStatusResultCache, normalizeStatusCacheKey(input.cwd));
|
|
283222
283300
|
});
|
|
283223
283301
|
const status = fn$1("status")(function* (input) {
|
|
283224
283302
|
const [local, remote] = yield* all([localStatus(input), remoteStatus(input)]);
|
|
@@ -283369,7 +283447,7 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
|
|
|
283369
283447
|
preparePullRequestThread,
|
|
283370
283448
|
runStackedAction: fn$1("runStackedAction")(function* (input, options) {
|
|
283371
283449
|
const progress = createProgressEmitter(input, options);
|
|
283372
|
-
const currentPhase = yield* make$
|
|
283450
|
+
const currentPhase = yield* make$50(none$4());
|
|
283373
283451
|
return yield* fn$1("runStackedAction.runAction")(function* () {
|
|
283374
283452
|
const initialStatus = yield* gitCore.statusDetails(input.cwd);
|
|
283375
283453
|
const wantsCommit = isCommitAction(input.action);
|
|
@@ -283458,7 +283536,7 @@ const GitManagerLive = effect(GitManager, fn$1("makeGitManager")(function* () {
|
|
|
283458
283536
|
result
|
|
283459
283537
|
});
|
|
283460
283538
|
return result;
|
|
283461
|
-
})().pipe(ensuring(invalidateStatus(input.cwd)), tapError((error) => flatMap(get$
|
|
283539
|
+
})().pipe(ensuring(invalidateStatus(input.cwd)), tapError((error) => flatMap(get$6(currentPhase), (phase) => progress.emit({
|
|
283462
283540
|
kind: "action_failed",
|
|
283463
283541
|
phase: getOrNull(phase),
|
|
283464
283542
|
message: error.message
|
|
@@ -286547,7 +286625,7 @@ function normalizeCount(count) {
|
|
|
286547
286625
|
return Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
|
|
286548
286626
|
}
|
|
286549
286627
|
const makeRuntimeDrainState = gen(function* () {
|
|
286550
|
-
const stateRef = yield* make$
|
|
286628
|
+
const stateRef = yield* make$50(initialState);
|
|
286551
286629
|
const update = (f) => updateAndGet(stateRef, f).pipe(map$3(snapshotFromState));
|
|
286552
286630
|
return {
|
|
286553
286631
|
beginTurn: (input) => update((state) => {
|
|
@@ -286598,8 +286676,8 @@ const makeRuntimeDrainState = gen(function* () {
|
|
|
286598
286676
|
drainTargetImageVersion: input.drainTargetImageVersion ?? state.drainTargetImageVersion,
|
|
286599
286677
|
drainForceRequired: input.drainForceRequired ?? state.drainForceRequired
|
|
286600
286678
|
})),
|
|
286601
|
-
snapshot: get$
|
|
286602
|
-
isDraining: get$
|
|
286679
|
+
snapshot: get$6(stateRef).pipe(map$3(snapshotFromState)),
|
|
286680
|
+
isDraining: get$6(stateRef).pipe(map$3((state) => state.draining))
|
|
286603
286681
|
};
|
|
286604
286682
|
});
|
|
286605
286683
|
var RuntimeDrainState = class extends Service$1()("forge/runtimeDrain/RuntimeDrainState") {};
|
|
@@ -287152,17 +287230,17 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, fn$
|
|
|
287152
287230
|
const browserManager = yield* BrowserManager;
|
|
287153
287231
|
const runtimeDrainState = yield* RuntimeDrainState;
|
|
287154
287232
|
const runtimeDrainReporter = yield* RuntimeDrainReporter;
|
|
287155
|
-
const turnMessageIdsByTurnKey = yield* make$
|
|
287233
|
+
const turnMessageIdsByTurnKey = yield* make$51({
|
|
287156
287234
|
capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
|
|
287157
287235
|
timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
|
|
287158
287236
|
lookup: () => succeed(/* @__PURE__ */ new Set())
|
|
287159
287237
|
});
|
|
287160
|
-
const bufferedAssistantTextByMessageId = yield* make$
|
|
287238
|
+
const bufferedAssistantTextByMessageId = yield* make$51({
|
|
287161
287239
|
capacity: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_CACHE_CAPACITY,
|
|
287162
287240
|
timeToLive: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_TTL,
|
|
287163
287241
|
lookup: () => succeed("")
|
|
287164
287242
|
});
|
|
287165
|
-
const bufferedProposedPlanById = yield* make$
|
|
287243
|
+
const bufferedProposedPlanById = yield* make$51({
|
|
287166
287244
|
capacity: BUFFERED_PROPOSED_PLAN_BY_ID_CACHE_CAPACITY,
|
|
287167
287245
|
timeToLive: BUFFERED_PROPOSED_PLAN_BY_ID_TTL,
|
|
287168
287246
|
lookup: () => succeed({
|
|
@@ -288001,7 +288079,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
|
|
|
288001
288079
|
const serverSettingsService = yield* ServerSettingsService;
|
|
288002
288080
|
const serverConfig = yield* ServerConfig;
|
|
288003
288081
|
const runtimeDrainState = yield* RuntimeDrainState;
|
|
288004
|
-
const handledTurnStartKeys = yield* make$
|
|
288082
|
+
const handledTurnStartKeys = yield* make$51({
|
|
288005
288083
|
capacity: HANDLED_TURN_START_KEY_MAX,
|
|
288006
288084
|
timeToLive: HANDLED_TURN_START_KEY_TTL,
|
|
288007
288085
|
lookup: () => succeed(true)
|
|
@@ -290793,7 +290871,7 @@ const readOpenCodeApiKey = (_settings) => process.env.OPENCODE_API_KEY || proces
|
|
|
290793
290871
|
const runOpenCodeCommand = fn$1("runOpenCodeCommand")(function* (binaryPath, args) {
|
|
290794
290872
|
const useShell = process.platform === "win32";
|
|
290795
290873
|
if (useShell && !isShellSafeCommandPath(binaryPath)) return yield* fail(/* @__PURE__ */ new Error(`Refusing to spawn opencode: \`binaryPath\` contains shell metacharacters that cmd.exe would interpret as additional commands.`));
|
|
290796
|
-
return yield* spawnAndCollect(binaryPath, make$
|
|
290874
|
+
return yield* spawnAndCollect(binaryPath, make$48(binaryPath, [...args], {
|
|
290797
290875
|
shell: useShell,
|
|
290798
290876
|
env: scrubForgeProviderChildEnvSecrets(process.env)
|
|
290799
290877
|
}));
|
|
@@ -291036,7 +291114,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
291036
291114
|
provider
|
|
291037
291115
|
})]));
|
|
291038
291116
|
const fallbackByProvider = new Map(fallbackProviders.map((provider) => [provider.provider, provider]));
|
|
291039
|
-
const providersRef = yield* make$
|
|
291117
|
+
const providersRef = yield* make$50(yield* forEach(PROVIDER_CACHE_IDS, (provider) => {
|
|
291040
291118
|
const filePath = cachePathByProvider.get(provider);
|
|
291041
291119
|
const fallbackProvider = fallbackByProvider.get(provider);
|
|
291042
291120
|
return readProviderStatusCache(filePath).pipe(provideService(FileSystem, fileSystem), map$3((cachedProvider) => {
|
|
@@ -291094,7 +291172,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
291094
291172
|
], {
|
|
291095
291173
|
concurrency: "unbounded",
|
|
291096
291174
|
discard: true
|
|
291097
|
-
}).pipe(andThen(get$
|
|
291175
|
+
}).pipe(andThen(get$6(providersRef)));
|
|
291098
291176
|
}
|
|
291099
291177
|
});
|
|
291100
291178
|
yield* runForEach(codexProvider.streamChanges, (provider) => syncProvider(provider)).pipe(forkScoped);
|
|
@@ -291105,7 +291183,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
291105
291183
|
yield* runForEach(cursorProvider.streamChanges, (provider) => syncProvider(provider)).pipe(forkScoped);
|
|
291106
291184
|
yield* runForEach(opencodeProvider.streamChanges, (provider) => syncProvider(provider)).pipe(forkScoped);
|
|
291107
291185
|
return {
|
|
291108
|
-
getProviders: get$
|
|
291186
|
+
getProviders: get$6(providersRef),
|
|
291109
291187
|
refresh: (provider) => refresh(provider).pipe(tapError(logError), orElseSucceed(() => [])),
|
|
291110
291188
|
get streamChanges() {
|
|
291111
291189
|
return fromPubSub(changesPubSub);
|
|
@@ -291475,7 +291553,7 @@ const RepositoryIdentityResolverLive = effect(RepositoryIdentityResolver, fn$1("
|
|
|
291475
291553
|
});
|
|
291476
291554
|
return { resolve: fn$1("RepositoryIdentityResolver.resolve")(function* (cwd) {
|
|
291477
291555
|
const location = yield* promise(() => resolveRepositoryLocation(cwd));
|
|
291478
|
-
const baseIdentity = yield* get$
|
|
291556
|
+
const baseIdentity = yield* get$8(repositoryIdentityCache, location.cacheKey);
|
|
291479
291557
|
if (baseIdentity === null) return null;
|
|
291480
291558
|
return location.subpath === null ? baseIdentity : {
|
|
291481
291559
|
...baseIdentity,
|
|
@@ -291784,7 +291862,7 @@ const WorkspaceEntriesLive = effect(WorkspaceEntries, gen(function* () {
|
|
|
291784
291862
|
if (normalizedCwd !== cwd) yield* invalidate(workspaceIndexCache, normalizedCwd);
|
|
291785
291863
|
});
|
|
291786
291864
|
const search = fn$1("WorkspaceEntries.search")(function* (input) {
|
|
291787
|
-
return yield* get$
|
|
291865
|
+
return yield* get$8(workspaceIndexCache, yield* normalizeWorkspaceRoot(input.cwd)).pipe(map$3((index) => {
|
|
291788
291866
|
const normalizedQuery = normalizeSearchQuery(input.query, { trimLeadingPattern: /^[@./]+/ });
|
|
291789
291867
|
const limit = Math.max(0, Math.floor(input.limit));
|
|
291790
291868
|
const rankedEntries = [];
|
|
@@ -291808,7 +291886,7 @@ const WorkspaceEntriesLive = effect(WorkspaceEntries, gen(function* () {
|
|
|
291808
291886
|
return {
|
|
291809
291887
|
invalidate: invalidate$1,
|
|
291810
291888
|
list: fn$1("WorkspaceEntries.list")(function* (input) {
|
|
291811
|
-
const index = yield* get$
|
|
291889
|
+
const index = yield* get$8(workspaceIndexCache, yield* normalizeWorkspaceRoot(input.cwd));
|
|
291812
291890
|
return {
|
|
291813
291891
|
entries: index.entries.map((entry) => ({
|
|
291814
291892
|
path: entry.path,
|
|
@@ -293442,7 +293520,7 @@ function resolveBuildCommitFromEnv(env) {
|
|
|
293442
293520
|
* environment descriptor down instead of reporting an honest "unknown".
|
|
293443
293521
|
*/
|
|
293444
293522
|
function readBakedBuildCommit() {
|
|
293445
|
-
return "
|
|
293523
|
+
return "fe3ee5efe095539824d092372a8dde00f1e2f98c";
|
|
293446
293524
|
}
|
|
293447
293525
|
async function resolveServerBuildCommit(input) {
|
|
293448
293526
|
if (isFullCommitSha(input.baked)) return input.baked;
|
|
@@ -293616,7 +293694,7 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
|
|
|
293616
293694
|
return yield* decodeUnknownEffect(EnvironmentMetadata)(parsed).pipe(orElseSucceed(() => ({ displayName: null })));
|
|
293617
293695
|
});
|
|
293618
293696
|
const writeMetadata = (metadata) => fileSystem.writeFileString(serverConfig.environmentMetadataPath, `${JSON.stringify(metadata, null, 2)}\n`);
|
|
293619
|
-
const displayNameOverrideRef = yield* make$
|
|
293697
|
+
const displayNameOverrideRef = yield* make$50(normalizeDisplayName((yield* readMetadata).displayName ?? null));
|
|
293620
293698
|
const posthog = yield* PosthogPublicConfig.asEffect();
|
|
293621
293699
|
const buildCommit = yield* promise(() => resolveServerBuildCommit({
|
|
293622
293700
|
baked: readBakedBuildCommit(),
|
|
@@ -293625,7 +293703,7 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
|
|
|
293625
293703
|
}));
|
|
293626
293704
|
const deviceRuntimeId = resolveDescriptorDeviceRuntimeId(serverConfig);
|
|
293627
293705
|
const buildDescriptor = gen(function* () {
|
|
293628
|
-
const displayNameOverride = yield* get$
|
|
293706
|
+
const displayNameOverride = yield* get$6(displayNameOverrideRef);
|
|
293629
293707
|
const os = platformOs();
|
|
293630
293708
|
return {
|
|
293631
293709
|
environmentId,
|
|
@@ -294861,7 +294939,7 @@ const generatePairingToken = () => {
|
|
|
294861
294939
|
const BootstrapCredentialServiceLive = effect(BootstrapCredentialService, gen(function* () {
|
|
294862
294940
|
const config = yield* ServerConfig;
|
|
294863
294941
|
const pairingLinks = yield* AuthPairingLinkRepository;
|
|
294864
|
-
const seededGrantsRef = yield* make$
|
|
294942
|
+
const seededGrantsRef = yield* make$50(/* @__PURE__ */ new Map());
|
|
294865
294943
|
const changesPubSub = yield* unbounded$1();
|
|
294866
294944
|
const invalidBootstrapCredentialError = (message) => new BootstrapCredentialError({
|
|
294867
294945
|
message,
|
|
@@ -295306,7 +295384,7 @@ const SessionCredentialServiceLive = effect(SessionCredentialService, gen(functi
|
|
|
295306
295384
|
if (serverConfig.forgeCloudShellMode === true && configuredSigningKey === null) return yield* die$1(/* @__PURE__ */ new Error("FORGE_SESSION_SIGNING_KEY must decode to at least 32 bytes in cloud-shell mode. Forge Cloud refuses to issue restart-unsafe or replica-local sessions."));
|
|
295307
295385
|
const signingSecret = configuredSigningKey ?? (yield* secretStore.getOrCreateRandom(SIGNING_SECRET_NAME, 32));
|
|
295308
295386
|
const statelessCookieSessions = configuredSigningKey !== null;
|
|
295309
|
-
const connectedSessionsRef = yield* make$
|
|
295387
|
+
const connectedSessionsRef = yield* make$50(/* @__PURE__ */ new Map());
|
|
295310
295388
|
const changesPubSub = yield* unbounded$1();
|
|
295311
295389
|
const cookieName = resolveSessionCookieName({
|
|
295312
295390
|
mode: serverConfig.mode,
|
|
@@ -295328,7 +295406,7 @@ const SessionCredentialServiceLive = effect(SessionCredentialService, gen(functi
|
|
|
295328
295406
|
const loadActiveSession = (sessionId) => gen(function* () {
|
|
295329
295407
|
const row = yield* authSessions.getById({ sessionId });
|
|
295330
295408
|
if (isNone(row) || row.value.revokedAt !== null) return none$4();
|
|
295331
|
-
const connectedSessions = yield* get$
|
|
295409
|
+
const connectedSessions = yield* get$6(connectedSessionsRef);
|
|
295332
295410
|
return some(toAuthClientSession({
|
|
295333
295411
|
sessionId: row.value.sessionId,
|
|
295334
295412
|
subject: row.value.subject,
|
|
@@ -295493,7 +295571,7 @@ const SessionCredentialServiceLive = effect(SessionCredentialService, gen(functi
|
|
|
295493
295571
|
})));
|
|
295494
295572
|
const listActive = () => gen(function* () {
|
|
295495
295573
|
const now$1 = yield* now;
|
|
295496
|
-
const connectedSessions = yield* get$
|
|
295574
|
+
const connectedSessions = yield* get$6(connectedSessionsRef);
|
|
295497
295575
|
return (yield* authSessions.listActive({ now: now$1 })).map((row) => toAuthClientSession({
|
|
295498
295576
|
sessionId: row.sessionId,
|
|
295499
295577
|
subject: row.subject,
|
|
@@ -296503,6 +296581,19 @@ function toProjectorDecodeError(eventType) {
|
|
|
296503
296581
|
});
|
|
296504
296582
|
}
|
|
296505
296583
|
//#endregion
|
|
296584
|
+
//#region src/orchestration/turnAccountSelection.ts
|
|
296585
|
+
/** A per-turn account choice remains local to the thread and cannot change its provider. */
|
|
296586
|
+
function turnAccountSelection(current, requested) {
|
|
296587
|
+
if (!requested || requested.provider !== current.provider) return void 0;
|
|
296588
|
+
if (requested.provider !== "codex" && requested.provider !== "claudeAgent") return void 0;
|
|
296589
|
+
const currentAccountId = "providerAccountId" in current ? current.providerAccountId : void 0;
|
|
296590
|
+
if (requested.providerAccountId === void 0 || requested.providerAccountId === currentAccountId) return void 0;
|
|
296591
|
+
return {
|
|
296592
|
+
...current,
|
|
296593
|
+
providerAccountId: requested.providerAccountId
|
|
296594
|
+
};
|
|
296595
|
+
}
|
|
296596
|
+
//#endregion
|
|
296506
296597
|
//#region src/orchestration/commandInvariants.ts
|
|
296507
296598
|
function invariantError(commandType, detail) {
|
|
296508
296599
|
return new OrchestrationCommandInvariantError({
|
|
@@ -297041,7 +297132,9 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
|
|
|
297041
297132
|
createdAt: command.createdAt
|
|
297042
297133
|
}
|
|
297043
297134
|
};
|
|
297044
|
-
|
|
297135
|
+
const shouldUpdateAnchor = targetThread.anchorKind !== nextAnchor.anchorKind || targetThread.anchorCmmdId !== nextAnchor.anchorCmmdId;
|
|
297136
|
+
const accountSelection = turnAccountSelection(targetThread.modelSelection, command.modelSelection);
|
|
297137
|
+
if (!shouldUpdateAnchor && !accountSelection) return [userMessageEvent, turnStartRequestedEvent];
|
|
297045
297138
|
return [
|
|
297046
297139
|
{
|
|
297047
297140
|
...withEventBase({
|
|
@@ -297055,6 +297148,7 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
|
|
|
297055
297148
|
threadId: command.threadId,
|
|
297056
297149
|
anchorKind: nextAnchor.anchorKind,
|
|
297057
297150
|
anchorCmmdId: nextAnchor.anchorCmmdId,
|
|
297151
|
+
...accountSelection ? { modelSelection: accountSelection } : {},
|
|
297058
297152
|
updatedAt: command.createdAt
|
|
297059
297153
|
}
|
|
297060
297154
|
},
|
|
@@ -306738,7 +306832,7 @@ const RuntimeReplicationLive = effect(RuntimeReplication, gen(function* () {
|
|
|
306738
306832
|
const terminal = yield* serviceOption(TerminalManager);
|
|
306739
306833
|
const activeHourMeter = yield* ActiveHourMeter;
|
|
306740
306834
|
const runtimeId = resolveRuntimeReplicationRuntimeId(config);
|
|
306741
|
-
const outboxWarningActive = yield* make$
|
|
306835
|
+
const outboxWarningActive = yield* make$50(false);
|
|
306742
306836
|
const enqueueInventoryPayload = (payload) => runtimeId ? outbox.enqueue({
|
|
306743
306837
|
runtimeId,
|
|
306744
306838
|
streamKey: "inventory",
|
|
@@ -307993,7 +308087,7 @@ const isActiveHourMeteringEnabled = gen(function* () {
|
|
|
307993
308087
|
}).pipe(catch_(() => succeed(false)));
|
|
307994
308088
|
const ActiveHourMeterLive = effect(ActiveHourMeter, gen(function* () {
|
|
307995
308089
|
const outbox = yield* RuntimeReplicationOutbox;
|
|
307996
|
-
const statesByRuntime = yield* make$
|
|
308090
|
+
const statesByRuntime = yield* make$50(/* @__PURE__ */ new Map());
|
|
307997
308091
|
const markAwake = (runtimeId) => gen(function* () {
|
|
307998
308092
|
if (!(yield* isActiveHourMeteringEnabled)) return;
|
|
307999
308093
|
yield* update$4(statesByRuntime, (states) => {
|
|
@@ -310380,11 +310474,11 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
|
|
|
310380
310474
|
if (!preparedHandoffMatchesRun(preparedHandoff, input.runId)) return yield* coordinatorError("registerHandoff", "PIPELINE_HANDOFF_PREPARATION_INVALID", "The pipeline handoff preparation is missing, belongs to another run, or was already consumed.");
|
|
310381
310475
|
preparedHandoffs.delete(input.preparedHandoff);
|
|
310382
310476
|
const ownedProviderAuthorityInstallations = /* @__PURE__ */ new Set();
|
|
310383
|
-
const preparedAuthorityRef = yield* make$
|
|
310477
|
+
const preparedAuthorityRef = yield* make$50({
|
|
310384
310478
|
authority: preparedHandoff.authority,
|
|
310385
310479
|
preparation: preparedHandoff.providerAuthorityPreparation
|
|
310386
310480
|
});
|
|
310387
|
-
const acceptingHeartbeatRef = yield* make$
|
|
310481
|
+
const acceptingHeartbeatRef = yield* make$50(true);
|
|
310388
310482
|
const heartbeatPublicationSemaphore = yield* make$43(1);
|
|
310389
310483
|
if ((yield* store.getByRunId(input.runId)) !== null) return yield* coordinatorError("registerHandoff", "PIPELINE_HANDOFF_ALREADY_BOUND", "The CMMD run already has a Forge task thread and must use the authority rebind contract.");
|
|
310390
310484
|
const snapshot = preparedHandoff.snapshot;
|
|
@@ -310419,7 +310513,7 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
|
|
|
310419
310513
|
contextHash: preparedHandoff.authority.contextHash,
|
|
310420
310514
|
contextSnapshot: snapshot.run.contextSnapshot
|
|
310421
310515
|
}).pipe(mapError((cause) => coordinatorError("registerHandoff", "PIPELINE_CONTEXT_ARTIFACT_FAILED", "The immutable CMMD run context could not be materialized for the provider.", cause)));
|
|
310422
|
-
const latestPreparedAuthority = yield* heartbeatPublicationSemaphore.withPermits(1)(set$2(acceptingHeartbeatRef, false).pipe(andThen(get$
|
|
310516
|
+
const latestPreparedAuthority = yield* heartbeatPublicationSemaphore.withPermits(1)(set$2(acceptingHeartbeatRef, false).pipe(andThen(get$6(preparedAuthorityRef))));
|
|
310423
310517
|
const persistedAuthority = yield* persistAuthoritySecret({
|
|
310424
310518
|
runId: input.runId,
|
|
310425
310519
|
organizationId: latestPreparedAuthority.authority.organizationId,
|
|
@@ -310493,7 +310587,7 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
|
|
|
310493
310587
|
executionSessionInstallations.set(input.runId, rollbackSession);
|
|
310494
310588
|
}), gen(function* () {
|
|
310495
310589
|
yield* sleep$4(seconds(30));
|
|
310496
|
-
const currentAuthority = (yield* get$
|
|
310590
|
+
const currentAuthority = (yield* get$6(preparedAuthorityRef)).authority;
|
|
310497
310591
|
const heartbeat = yield* client.heartbeat({
|
|
310498
310592
|
runId: input.runId,
|
|
310499
310593
|
authority: currentAuthority,
|
|
@@ -310505,7 +310599,7 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
|
|
|
310505
310599
|
heartbeat
|
|
310506
310600
|
});
|
|
310507
310601
|
yield* heartbeatPublicationSemaphore.withPermits(1)(gen(function* () {
|
|
310508
|
-
if (!(yield* get$
|
|
310602
|
+
if (!(yield* get$6(acceptingHeartbeatRef))) return;
|
|
310509
310603
|
yield* set$2(preparedAuthorityRef, {
|
|
310510
310604
|
authority: heartbeat.refreshedAuthority,
|
|
310511
310605
|
preparation
|
|
@@ -315229,9 +315323,9 @@ const AgentProtocolReactorLive = effect(AgentProtocolReactor, gen(function* () {
|
|
|
315229
315323
|
const PRUNE_GRACE_MS = 6e4;
|
|
315230
315324
|
const makeUserSlot = gen(function* () {
|
|
315231
315325
|
return {
|
|
315232
|
-
snapshotRef: yield* make$
|
|
315326
|
+
snapshotRef: yield* make$50(null),
|
|
315233
315327
|
pubsub: yield* unbounded$1(),
|
|
315234
|
-
subscriberCountRef: yield* make$
|
|
315328
|
+
subscriberCountRef: yield* make$50(0)
|
|
315235
315329
|
};
|
|
315236
315330
|
});
|
|
315237
315331
|
const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function* () {
|
|
@@ -315271,14 +315365,14 @@ const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function
|
|
|
315271
315365
|
*/
|
|
315272
315366
|
const schedulePrune = (userId, slot) => gen(function* () {
|
|
315273
315367
|
yield* sleep$4(millis(PRUNE_GRACE_MS));
|
|
315274
|
-
if ((yield* get$
|
|
315275
|
-
if ((yield* get$
|
|
315368
|
+
if ((yield* get$6(slot.subscriberCountRef)) > 0) return;
|
|
315369
|
+
if ((yield* get$6(slot.snapshotRef))?.phase !== "app-ready") return;
|
|
315276
315370
|
yield* shutdown$2(slot.pubsub);
|
|
315277
315371
|
yield* removeSlot(userId);
|
|
315278
315372
|
}).pipe(forkIn(pruneScope), asVoid);
|
|
315279
315373
|
const update = (userId, event) => gen(function* () {
|
|
315280
315374
|
const slot = yield* getOrCreateSlot(userId);
|
|
315281
|
-
const previous = yield* get$
|
|
315375
|
+
const previous = yield* get$6(slot.snapshotRef);
|
|
315282
315376
|
if (previous !== null && event.ts < previous.ts) return;
|
|
315283
315377
|
yield* set$2(slot.snapshotRef, event);
|
|
315284
315378
|
yield* publish(slot.pubsub, event);
|
|
@@ -315287,7 +315381,7 @@ const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function
|
|
|
315287
315381
|
const snapshot = (userId) => gen(function* () {
|
|
315288
315382
|
const slot = (yield* get$2(slotsRef)).get(userId);
|
|
315289
315383
|
if (!slot) return null;
|
|
315290
|
-
return yield* get$
|
|
315384
|
+
return yield* get$6(slot.snapshotRef);
|
|
315291
315385
|
});
|
|
315292
315386
|
/**
|
|
315293
315387
|
* Stream of phase events for `userId`. Emits the current snapshot first
|
|
@@ -315296,7 +315390,7 @@ const WorkspaceReadinessStateLive = effect(WorkspaceReadinessState, gen(function
|
|
|
315296
315390
|
*/
|
|
315297
315391
|
const subscribe = (userId) => unwrap$1(gen(function* () {
|
|
315298
315392
|
const slot = yield* getOrCreateSlot(userId);
|
|
315299
|
-
const initial = yield* get$
|
|
315393
|
+
const initial = yield* get$6(slot.snapshotRef);
|
|
315300
315394
|
const live = fromPubSub(slot.pubsub);
|
|
315301
315395
|
const stream = initial === null ? live : concat$2(succeed$4(initial), live);
|
|
315302
315396
|
yield* update$4(slot.subscriberCountRef, (n) => n + 1);
|
|
@@ -316272,13 +316366,13 @@ const gitUrlCloneRouteLayer = add$1("POST", "/api/cloud/git/clone-url", gen(func
|
|
|
316272
316366
|
//#endregion
|
|
316273
316367
|
//#region src/server.ts
|
|
316274
316368
|
const PtyAdapterLive = unwrap(gen(function* () {
|
|
316275
|
-
if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunPTY-
|
|
316276
|
-
else return (yield* promise(() => import("./NodePTY-
|
|
316369
|
+
if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunPTY-oVISucl_.mjs"))).layer;
|
|
316370
|
+
else return (yield* promise(() => import("./NodePTY-CVH2yNYl.mjs"))).layer;
|
|
316277
316371
|
}));
|
|
316278
316372
|
const HttpServerLive = unwrap(gen(function* () {
|
|
316279
316373
|
const config = yield* ServerConfig;
|
|
316280
|
-
if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunHttpServer-
|
|
316281
|
-
const [NodeHttpServer, NodeHttp] = yield* all([promise(() => import("./NodeHttpServer-
|
|
316374
|
+
if (typeof Bun !== "undefined") return (yield* promise(() => import("./BunHttpServer-VI75aqJw.mjs"))).layer(bunHttpServerOptions(config));
|
|
316375
|
+
const [NodeHttpServer, NodeHttp] = yield* all([promise(() => import("./NodeHttpServer-Dw7ivXfX.mjs")), promise(() => import("node:http"))]);
|
|
316282
316376
|
return NodeHttpServer.layer(NodeHttp.createServer, {
|
|
316283
316377
|
host: config.host,
|
|
316284
316378
|
port: config.port
|
|
@@ -316286,10 +316380,10 @@ const HttpServerLive = unwrap(gen(function* () {
|
|
|
316286
316380
|
}));
|
|
316287
316381
|
const PlatformServicesLive = unwrap(gen(function* () {
|
|
316288
316382
|
if (typeof Bun !== "undefined") {
|
|
316289
|
-
const { layer } = yield* promise(() => import("./BunServices-
|
|
316383
|
+
const { layer } = yield* promise(() => import("./BunServices-D0JTDujL.mjs"));
|
|
316290
316384
|
return layer;
|
|
316291
316385
|
} else {
|
|
316292
|
-
const { layer } = yield* promise(() => import("./NodeServices-
|
|
316386
|
+
const { layer } = yield* promise(() => import("./NodeServices-CBNXOYLG.mjs").then((n) => n.t));
|
|
316293
316387
|
return layer;
|
|
316294
316388
|
}
|
|
316295
316389
|
}));
|
|
@@ -316974,12 +317068,12 @@ const findActiveProjectTarget = fn$1("findActiveProjectTarget")(function* (input
|
|
|
316974
317068
|
workspaceRoot: resolved.workspaceRoot
|
|
316975
317069
|
};
|
|
316976
317070
|
});
|
|
316977
|
-
const fetchLiveOrchestrationSnapshot = (origin, bearerToken$1) => runLiveServerRequest(get$
|
|
317071
|
+
const fetchLiveOrchestrationSnapshot = (origin, bearerToken$1) => runLiveServerRequest(get$7(`${origin}/api/orchestration/snapshot`).pipe(acceptJson, bearerToken(bearerToken$1)), matchStatus({
|
|
316978
317072
|
"2xx": decodeOrchestrationReadModelResponse,
|
|
316979
317073
|
orElse: (response) => readErrorMessageFromResponse(response).pipe(flatMap((message) => fail(new Error(message))))
|
|
316980
317074
|
}));
|
|
316981
317075
|
const ProjectLeadExplanationEnvelope = Struct({ data: ProjectLeadExplanationSchema });
|
|
316982
|
-
const fetchLiveProjectLeadExplanation = (origin, bearerToken$3, projectId) => runLiveServerRequest(get$
|
|
317076
|
+
const fetchLiveProjectLeadExplanation = (origin, bearerToken$3, projectId) => runLiveServerRequest(get$7(`${origin}/api/cmmd/projects/${projectId}/project-lead/explain`).pipe(acceptJson, bearerToken(bearerToken$3)), matchStatus({
|
|
316983
317077
|
"2xx": (response) => schemaBodyJson$1(ProjectLeadExplanationEnvelope)(response).pipe(map$3((body) => body.data)),
|
|
316984
317078
|
orElse: (response) => readErrorMessageFromResponse(response).pipe(flatMap((message) => fail(new Error(message))))
|
|
316985
317079
|
}));
|
|
@@ -317284,7 +317378,7 @@ const connectLoginCommand = make$34("login", {
|
|
|
317284
317378
|
})).json();
|
|
317285
317379
|
},
|
|
317286
317380
|
openBrowser: async (url) => {
|
|
317287
|
-
const open = (await import("./open-
|
|
317381
|
+
const open = (await import("./open-FIgTDosf.mjs")).default;
|
|
317288
317382
|
await open(url);
|
|
317289
317383
|
return true;
|
|
317290
317384
|
},
|