alink-cli 0.8.9 → 0.9.0
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/{Config-Bj2ZPCsP.mjs → Config-CxDW-52j.mjs} +2 -2
- package/dist/{Config-Bj2ZPCsP.mjs.map → Config-CxDW-52j.mjs.map} +1 -1
- package/dist/{NodeHttpServer-BGJlR_Kf.mjs → NodeHttpServer-D2VeYRw1.mjs} +5 -5
- package/dist/{NodeHttpServer-BGJlR_Kf.mjs.map → NodeHttpServer-D2VeYRw1.mjs.map} +1 -1
- package/dist/{NodeServices-DDZTiw5K.mjs → NodeServices-BtcL7AtO.mjs} +3 -3
- package/dist/{NodeServices-DDZTiw5K.mjs.map → NodeServices-BtcL7AtO.mjs.map} +1 -1
- package/dist/{NodeSocket-08w4osAf.mjs → NodeSocket-CLfrrutd.mjs} +2 -2
- package/dist/{NodeSocket-08w4osAf.mjs.map → NodeSocket-CLfrrutd.mjs.map} +1 -1
- package/dist/{NodeSqliteClient-Byu521pt.mjs → NodeSqliteClient-FfrElFAX.mjs} +4 -4
- package/dist/{NodeSqliteClient-Byu521pt.mjs.map → NodeSqliteClient-FfrElFAX.mjs.map} +1 -1
- package/dist/{Schema-B3i-HrZQ.mjs → Schema-B4KtKnpr.mjs} +34 -2
- package/dist/Schema-B4KtKnpr.mjs.map +1 -0
- package/dist/{SqlClient-DcM69ZvI.mjs → SqlClient-BQM_tAo_.mjs} +2 -2
- package/dist/{SqlClient-DcM69ZvI.mjs.map → SqlClient-BQM_tAo_.mjs.map} +1 -1
- package/dist/bin.mjs +1536 -564
- package/dist/bin.mjs.map +1 -1
- package/dist/daemon.js +8 -1
- package/package.json +2 -1
- package/dist/Schema-B3i-HrZQ.mjs.map +0 -1
package/dist/bin.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { $ as make$
|
|
4
|
-
import { $ as decodeUnknownExit, $
|
|
5
|
-
import { a as isQuitError, g as ChildProcessSpawner, h as make$
|
|
6
|
-
import { _ as withDefault$2, a as all$1, c as logLevel, d as option$1, f as port, g as url$1, i as TrueValues, l as map$10, m as string$4, n as FalseValues, o as boolean$3, p as schema$1, r as Record$1, s as int, t as Boolean$2, u as number } from "./Config-
|
|
7
|
-
import { c as getOption$1, d as make$
|
|
3
|
+
import { $ as make$65, A as withLoggerDisabled, At as matchStatus, B as limitsServices, Bt as post$1, C as update$2, Ct as setHeader, D as compression, Dt as uint8Array$1, Et as text$2, F as schemaHeaders, Ft as appendUrlParams, G as CloseEvent, Gt as setUrl, Ht as setBody, I as schemaSearchParams, It as bodyFormData, Jt as HttpClientErrorSchema, K as SocketError, Kt as DecodeError, L as toURL, Lt as bodyJson, M as ParsedSearchParams, O as cors$1, Ot as urlParams$1, P as schemaCookies, Pt as schemaBodyJson, Q as join$1, Rt as get$4, S as set$2, Sn as __commonJSMin, T as appendPreResponseHandler, Tt as stream, Ut as setHeader$1, Vt as prependUrl, Wt as setHeaders, X as makeWebSocket, Xt as isHttpClientError, Y as make$66, Yt as StatusCodeError, Z as awaitEmpty, Zt as empty$2, _ as get$3, _n as fromInput, _t as mergeCookies, a as layer$43, an as CurrentRedactedNames, b as makeUnsafe$3, bn as hasBody, cn as fromRecordUnsafe, d as HttpClient, dn as jsonUnsafe$1, en as set$3, et as run$4, f as TracerPropagationEnabled, g as transformResponse$1, gn as urlParams, gt as jsonUnsafe, h as retryTransient, hn as uint8Array, ht as isHttpServerResponse, j as HttpServerRequest, k as logger, kt as filterStatusOk, l as serve$1, ln as merge, lt as symbol$1, m as mapRequest, mn as text$1, mt as file, o as HttpServer, on as empty$3, ot as RouteNotFound, p as filterStatusOk$1, pt as empty$1, q as SocketErrorReason, qt as HttpClientError, r as Mime_default, rt as HttpServerError, sn as fromInput$1, t as layerWebSocketConstructor, tt as runtime, u as withLogAddress, un as isHttpBody, ut as toResponse, v as getAndSet, vn as schemaRecord, w as updateAndGet, wn as __require, wt as setHeaders$1, x as modify$2, xn as map$3, xt as schemaJson, y as make$63, yn as toRecord, yt as redirect, zt as make$64 } from "./NodeSocket-CLfrrutd.mjs";
|
|
4
|
+
import { $ as decodeUnknownExit, $a as flatMap$1, $d as hasProperty, $l as format$1, $o as scopedWith, $s as TaggedError, $t as Union$1, $u as add$2, A as StructWithRest, Aa as asVoid, Ac as _await, Ai as make$75, An as encodeBase64, Ao as matchEffect, Ar as mapEffect$1, As as withSpan, At as suspend$1, B as Union, Ba as catchTags, Bc as succeed$4, Bi as offerUnsafe, Bn as now$1, Bo as provide$1, Br as provideService$1, Bs as forever$1, Bt as value, C as Number$1, Ca as andThen, Cc as forkUnsafe, Cd as map$6, Cl as CurrentLoggers$1, Cn as parseJson, Co as map$4, Cs as useSpan, Ct as isTrimmed, Cu as flatMapNullishOr, D as String$1, Da as annotateSpans, Dc as MinimumLogLevel, Dd as Number$2, Di as pipeTo, Dn as decodeBase64String, Do as match$2, Dr as make$74, Ds as withFiber$1, Dt as mutable, E as Record, Ea as annotateLogsScoped, Ec as provide$2, Ed as some, Ei as mapEffect$2, Er as isStream, Es as withErrorReporting, Et as makeFilter, Eu as isReadonlyArrayNonEmpty, Fi as failCause$3, Fl as reportCauseUnsafe, Fn as isGreaterThan$1, Fo as onInterrupt, Fr as onExit$1, Fs as snapshotUnsafe, Ft as toJsonSchemaDocument, G as annotateKey, Ga as currentParentSpan, Gc as isFailure, Gi as takeAll, Gl as ParentSpan, Gn as InvalidValue$1, Go as result, Gr as runFoldEffect, Gs as isDoneCause, Gt as toJsonSchemaMultiDocument, Gu as getOrUndefined$2, H as UnknownFromJsonString$1, Hc as fail$4, Hd as toJson, Hi as shutdown$1, Hn as toEpochMillis, Ho as provideService, Hr as runCollect, Hs as passthrough, Ht as toMultiDocumentOpenApi3_1, Hu as fail$1, I as URLFromString, Ia as catchFilter, Ic as isDeferred, Id as isEffect$1, In as isGreaterThanOrEqualTo$1, Io as option, Is as timer, It as toType, Iu as map$7, J as decodeEffect, Ja as ensuring, Ji as shutdown$2, Jl as make$77, Jn as Path, Jo as runForkWith, Js as Clock, K as brand, Ka as die, Kc as isSuccess, Kd as equals, Ki as unbounded$2, Kl as Tracer, Ko as retry, Kr as runForEach, Ks as parse$2, Kt as escapeToken, Ku as isFailure$1, L as Uint8Array$1, La as catchIf, Ld as withFiber, Li as make$78, Ln as isLessThan$1, Lo as orDie, Lr as pipeThroughChannel, Ls as update$3, Lt as withConstructorDefault, M as TaggedStruct, Ma as callback, Md as setStackTraceLimit, Mi as bounded, Mn as encodeHex, Mo as onError, Mr as merge$2, Ms as yieldNow, Mt as toCodecJson, Mu as reverse, N as TemplateLiteral, Na as catchCause, Nc as fail$3, Nd as Prototype, Ni as end, Nn as add$3, No as onExit, Ns as zipWith, Nt as toCodecJsonAST, Nu as sort, O as StringFromUriComponent, Oa as as, Oc as TracerEnabled, Od as make$72, On as decodeBase64Url, Oo as matchCauseEffect, Or as map$8, Ot as optional$3, Ou as map$5, Pa as catchDefect, Pc as failCause$2, Pd as PipeInspectableProto, Pn as formatIso, Ps as counter, Pt as toCodecStringTree, Q as decodeUnknownEffect, Qa as filterOrFail, Qc as StackTrace, Qd as compose$1, Ql as days, Qo as scoped, Qr as toAsyncIterable, Qs as TaggedClass, Qt as isSchemaError, Qu as Service$2, R as Undefined, Ra as catchReason, Rc as make$73, Rd as assignProperty, Ri as offer$1, Rl as sync$1, Rn as make$71, Ro as orElseSucceed, Rs as withAttributes, Rt as withDecodingDefault, S as NullOr, Sa as all, Sc as closeUnsafe, Sd as isSome, Si as filterArray, Sl as ConsoleRef, Sn as onSome, So as makeSpanScoped, Sr as fromQueue, Ss as updateContext, St as isSchema, Su as findLast, T as OptionFromNullOr, Ta as annotateLogs, Tc as makeUnsafe$8, Td as none, Tl as consolePretty$1, Tn as stringifyJson, To as mapError, Tr as groupedWithin, Ts as whileLoop, Tt as make$70, Tu as isArrayNonEmpty, U as Void, Ua as context, Uc as failCause$4, Ud as format, Ui as sliding$1, Ul as MinimumTraceLevel, Un as toUtc, Uo as raceFirst, Ur as runDrain, Us as spaced, Ut as apply, Uu as failVoid, V as Unknown, Va as catch_, Vc as die$1, Vd as NodeInspectSymbol, Vn as toDate, Vo as provideContext, Vr as run$5, Vt as VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP, W as annotate$2, Wa as contextWith, Wc as interrupt$3, Wi as take$1, Wl as NativeSpan, Wn as Forbidden$1, Wo as repeat, Wr as runFold, Ws as catchDone, Wt as toRepresentations, Wu as getOrThrow, X as decodeSync, Xa as fail, Xi as subscribe, Xn as FileSystem, Xs as currentTimeNanos, Y as decodeExit, Ya as exit, Yc as void_$2, Yi as sliding, Yo as runPromiseWith, Ys as currentTimeMillis, Yu as succeed$2, Z as decodeTo, Za as failCause$1, Zc as NoSuchElementError, Zi as unbounded$1, Zo as scope, Zr as takeWhile, Zt as SchemaError, Zu as Reference, _c as unwrap, _d as fromUndefinedOr, _f as identity, _i as forEach$1, _l as map$9, _n as Transformation, _o as logDebug, _s as try_, _t as isMaxLength, _u as ensure, a as Class, aa as join$2, ac as effectContext, ad as getUnsafe$1, af as isTagged, al as findErrorOption, an as isLiteral, ao as forever, ar as debounce, as as succeedSome, at as encodeUnknownExit, b as NonEmptyString, ba as acquireUseRelease, bc as addFinalizerExit, bd as getOrUndefined, bi as mapInput, bl as squash, bn as transformOrFail, bo as logInfo, br as fromIterable$1, bs as uninterruptible, bt as isNonEmpty, bu as findFirst, c as Defect, ca as drop$1, cd as merge$1, cf as cast, ci as has, cl as hasInterrupts, cn as isOptional, co as forkScoped, cr as drain, cs as tap, ct as instanceOf, cu as minutes, d as ErrorClass, da as isEmpty$2, dc as provide, dd as exists, df as constTrue, dl as interruptors, dn as isVoid, do as ignore$1, ds as tapError, dt as isFinite, du as toMillis, ea as makeUnsafe$7, ec as taggedEnum, ed as empty$5, ef as isNotNull, el as combine$1, es as service, et as decodeUnknownOption, eu as fromInput$2, f as Exit, fa as size$2, fc as provideMerge, fd as filter, ff as constUndefined, fl as isCause, fn as resolveAt, fo as ignoreCause, fr as fail$5, fs as tapErrorTag, ft as isGreaterThan, g as Literals, gc as tap$1, gd as fromNullishOr, gi as drain$1, go as log$1, gr as fromAsyncIterable, gs as tryPromise, gt as isLessThanOrEqualTo, gu as empty$4, h as Literal, ha as PlatformError, hc as sync$2, hd as flatten, hf as dual, hn as toEncoded, ho as isEffect, hr as flatMap$2, ht as isLessThan, i as Cause, ic as effect, id as getOrUndefined$1, if as isString, ii as withSpan$1, in as isDeclaration, io as forEach, ir as concat, is as succeedNone, it as encodeUnknownEffect, j as TaggedErrorClass, ja as cached, jc as die$2, jd as getStackTraceLimit, ji as makeUnsafe$5, jl as fnUntraced$1, jn as encodeBase64Url, jo as never, jr as mapError$1, js as withTracerEnabled, jt as tag, ju as reduce, k as Struct, ka as asSome, kc as TracerTimingEnabled, ki as splitLines, kn as decodeBase64UrlString, kr as mapArrayEffect, ks as withParentSpan, kt as optionalKey, ku as match, l as Duration, la as empty$6, lc as launch, ld as omit, lf as compose, li as invalidate, ll as hasInterruptsOnly, ln as isSuspend, lo as fromResult, lr as empty$7, ls as tapCause, lt as is, lu as nanos, m as Int, mc as succeedContext, md as flatMap$3, mf as constant, mn as resolveIdentifier, mo as interruptible, mr as filter$2, ms as timeoutOption, mt as isInt, mu as allocate, n as ArraySchema, na as getCurrent, nc as build, nd as getOption, nf as isNullish, ni as transformPull, nn as getAST, no as fn, nr as catchCause$1, ns as sleep, nt as encodeEffect, nu as hours, o as DateTimeUtc, oa as runIn, oc as effectDiscard, od as make$68, on as isNull, oo as forkChild, or as decodeText, os as suspend, ot as fieldsAssign, ou as max, p as Finite, pa as toArray, pc as succeed$3, pd as firstSomeOf, pf as constVoid, pl as isFailReason, pn as resolveDescription, po as interrupt$1, pr as failCause$5, ps as timeout, pt as isGreaterThanOrEqualTo, pu as zero, q as declare, qc as match$3, qi as publish, ql as externalSpan, qn as makeFormatterDefault, qo as runFork, qr as runForEachArray, qs as round, qt as assign, qu as isSuccess$1, r as Boolean$1, ra as interrupt$4, rc as buildWithMemoMap, rd as getOrElse$1, rf as isObject$1, ri as unwrap$1, rl as fail$2, rn as getLastEncoding, ro as fnUntraced, rr as changes, rs as succeed$1, rt as encodeSync, s as DateTimeUtcFromString, sa as append$1, sc as empty$8, sd as makeUnsafe$4, si as get$6, sl as hasDies, sn as isObjects, so as forkIn, ss as sync, st as fromJsonString, su as millis, t as Any, ta as await_, tc as CurrentMemoMap, td as get$5, tf as isNotUndefined, to as flatten$1, tr as callback$1, ts as serviceOption, tt as encode$1, tu as fromInputUnsafe, u as DurationFromMillis, ua as head, uc as mergeAll, ud as contains, uf as constFalse, ui as make$69, ul as interrupt$2, un as isUnion, uo as gen, ur as encodeText, us as tapDefect, ut as isBetween, uu as seconds, v as Never, va as Transaction, vc as Scope, vd as getOrElse, vf as pipe, vl as pretty, vo as logError, vr as fromEffect, vs as tx, vt as isMaxProperties, vu as filter$1, w as Option, wa as annotateCurrentSpan, wc as make$76, wd as match$1, wi as fromTransform, wr as fromSubscription, ws as void_$1, wu as fromIterable, x as Null, xa as addFinalizer, xc as close, xd as isNone, xi as decodeText$1, xn as trim, xo as logWarning$1, xr as fromPubSub, xt as isPattern, xu as findFirstIndex, y as NonEmptyArray, ya as acquireRelease, yc as addFinalizer$1, yd as getOrNull, yf as pipeArguments, yl as prettyErrors, yn as transform$1, yo as logFatal, yr as fromEffectSchedule, ys as txRetry, yt as isMinLength, yu as filterMap, z as UndefinedOr, za as catchTag, zi as offerAll, zl as tracerLogger$1, zn as makeUnsafe$6, zo as promise, zr as provideContext$1, zs as addDelay, zt as make$67 } from "./Schema-B4KtKnpr.mjs";
|
|
5
|
+
import { a as isQuitError, g as ChildProcessSpawner, h as make$79, i as Terminal$1, l as Crypto, n as layer$44, o as Stdio, r as QuitError, s as make$80, u as fromReadable } from "./NodeServices-BtcL7AtO.mjs";
|
|
6
|
+
import { _ as withDefault$2, a as all$1, c as logLevel, d as option$1, f as port, g as url$1, i as TrueValues, l as map$10, m as string$4, n as FalseValues, o as boolean$3, p as schema$1, r as Record$1, s as int, t as Boolean$2, u as number } from "./Config-CxDW-52j.mjs";
|
|
7
|
+
import { c as getOption$1, d as make$81, f as makeWith$1, l as invalidate$1, n as SqlClient, p as set$4, s as get$7, u as keys } from "./SqlClient-BQM_tAo_.mjs";
|
|
8
|
+
import * as NodeModule from "node:module";
|
|
8
9
|
import * as NodeChildProcess from "node:child_process";
|
|
9
10
|
import * as NodeCrypto from "node:crypto";
|
|
10
11
|
import { createCipheriv, createDecipheriv, hkdfSync, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -17,7 +18,7 @@ import { fileURLToPath } from "node:url";
|
|
|
17
18
|
import * as NodeReadline from "node:readline";
|
|
18
19
|
import { parse } from "yaml";
|
|
19
20
|
import * as NodeNet from "node:net";
|
|
20
|
-
import { createRequire } from "module";
|
|
21
|
+
import { createRequire as createRequire$1 } from "module";
|
|
21
22
|
import * as NodeFSP from "node:fs/promises";
|
|
22
23
|
import { FileFinder } from "@ff-labs/fff-node";
|
|
23
24
|
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
@@ -5880,7 +5881,7 @@ const map$2 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(
|
|
|
5880
5881
|
* @category constructors
|
|
5881
5882
|
* @since 4.0.0
|
|
5882
5883
|
*/
|
|
5883
|
-
const password = (options) => basePrompt(options, "password").pipe(map$2(make$
|
|
5884
|
+
const password = (options) => basePrompt(options, "password").pipe(map$2(make$67));
|
|
5884
5885
|
/**
|
|
5885
5886
|
* Runs a prompt by reading terminal input and rendering prompt frames until the
|
|
5886
5887
|
* prompt submits a value.
|
|
@@ -10588,7 +10589,7 @@ const isCommand = (u) => hasProperty(u, TypeId$14);
|
|
|
10588
10589
|
* @category constructors
|
|
10589
10590
|
* @since 4.0.0
|
|
10590
10591
|
*/
|
|
10591
|
-
const make$
|
|
10592
|
+
const make$62 = (name, config, handler) => {
|
|
10592
10593
|
return makeCommand({
|
|
10593
10594
|
name,
|
|
10594
10595
|
config: parseConfig(config ?? {}),
|
|
@@ -11084,7 +11085,7 @@ const runWith = (command, config) => {
|
|
|
11084
11085
|
}
|
|
11085
11086
|
const services = match$1(logLevel, {
|
|
11086
11087
|
onNone: () => empty$5(),
|
|
11087
|
-
onSome: (level) => make$
|
|
11088
|
+
onSome: (level) => make$68(MinimumLogLevel, level)
|
|
11088
11089
|
});
|
|
11089
11090
|
yield* provideContext(program, services);
|
|
11090
11091
|
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$2(error) : fail$1(error), (error) => andThen(showHelp(command, error), fail(error))), catchFilter((e) => isQuitError(e) ? succeed$2(e) : fail$1(e), (_) => interrupt$1));
|
|
@@ -11102,7 +11103,7 @@ const closeServer = (server) => {
|
|
|
11102
11103
|
* NetService - Service tag for startup networking helpers.
|
|
11103
11104
|
*/
|
|
11104
11105
|
var NetService = class extends Service$2()("@t3tools/shared/Net/NetService") {};
|
|
11105
|
-
const make$
|
|
11106
|
+
const make$61 = () => {
|
|
11106
11107
|
/**
|
|
11107
11108
|
* Returns true when a TCP server can bind to {host, port}.
|
|
11108
11109
|
* `EADDRNOTAVAIL` is treated as available so IPv6-absent hosts don't fail
|
|
@@ -11211,7 +11212,7 @@ const make$58 = () => {
|
|
|
11211
11212
|
})
|
|
11212
11213
|
};
|
|
11213
11214
|
};
|
|
11214
|
-
const layer$
|
|
11215
|
+
const layer$42 = sync$2(NetService, make$61);
|
|
11215
11216
|
//#endregion
|
|
11216
11217
|
//#region package.json
|
|
11217
11218
|
var version = "0.0.31";
|
|
@@ -12086,7 +12087,7 @@ function parse$1(input) {
|
|
|
12086
12087
|
const FULL_PATH_REGEXP = /^https?:\/\/.*?\//;
|
|
12087
12088
|
const OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
|
|
12088
12089
|
/** @internal */
|
|
12089
|
-
const make$
|
|
12090
|
+
const make$60 = (options = {}) => new RouterImpl(options);
|
|
12090
12091
|
var RouterImpl = class {
|
|
12091
12092
|
constructor(options = {}) {
|
|
12092
12093
|
this.options = {
|
|
@@ -12605,7 +12606,7 @@ const httpMethods = [
|
|
|
12605
12606
|
* @since 1.0.0
|
|
12606
12607
|
* @category constructors
|
|
12607
12608
|
*/
|
|
12608
|
-
const make$
|
|
12609
|
+
const make$59 = make$60;
|
|
12609
12610
|
//#endregion
|
|
12610
12611
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/http/HttpRouter.js
|
|
12611
12612
|
/**
|
|
@@ -12640,8 +12641,8 @@ const HttpRouter = /*#__PURE__*/ Service$2("effect/http/HttpRouter");
|
|
|
12640
12641
|
* @category constructors
|
|
12641
12642
|
* @since 4.0.0
|
|
12642
12643
|
*/
|
|
12643
|
-
const make$
|
|
12644
|
-
const router = make$
|
|
12644
|
+
const make$58 = /*#__PURE__*/ gen(function* () {
|
|
12645
|
+
const router = make$59(yield* RouterConfig);
|
|
12645
12646
|
const middleware = /* @__PURE__ */ new Set();
|
|
12646
12647
|
const addAll = (routes) => contextWith((context) => {
|
|
12647
12648
|
const middleware = getMiddleware(context);
|
|
@@ -12807,7 +12808,7 @@ const add$1 = (method, path, handler, options) => use((router) => router.add(met
|
|
|
12807
12808
|
* @category layers
|
|
12808
12809
|
* @since 4.0.0
|
|
12809
12810
|
*/
|
|
12810
|
-
const layer$
|
|
12811
|
+
const layer$41 = /*#__PURE__*/ effect(HttpRouter)(make$58);
|
|
12811
12812
|
const RouteTypeId = "~effect/http/HttpRouter/Route";
|
|
12812
12813
|
const makeRoute = (options) => ({
|
|
12813
12814
|
...options,
|
|
@@ -12939,11 +12940,11 @@ var MiddlewareImpl = class MiddlewareImpl {
|
|
|
12939
12940
|
this.dependencies = dependencies;
|
|
12940
12941
|
const contextKey = `effect/http/HttpRouter/Middleware-${++middlewareId}`;
|
|
12941
12942
|
this.layer = effectContext(gen({ self: this }, function* () {
|
|
12942
|
-
const context$
|
|
12943
|
-
const stack = [context$
|
|
12943
|
+
const context$4 = yield* context();
|
|
12944
|
+
const stack = [context$4.mapUnsafe.get(fnContextKey)];
|
|
12944
12945
|
if (this.dependencies) {
|
|
12945
12946
|
const memoMap = yield* CurrentMemoMap;
|
|
12946
|
-
const scope = get$5(context$
|
|
12947
|
+
const scope = get$5(context$4, Scope);
|
|
12947
12948
|
const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope);
|
|
12948
12949
|
stack.push(...getMiddleware(depsContext));
|
|
12949
12950
|
}
|
|
@@ -12991,7 +12992,7 @@ const cors = (options) => middleware(cors$1(options), { global: true });
|
|
|
12991
12992
|
const serve = (appLayer, options) => {
|
|
12992
12993
|
let middleware = options?.middleware;
|
|
12993
12994
|
if (options?.disableLogger !== true) middleware = middleware ? compose(middleware, logger) : logger;
|
|
12994
|
-
const RouterLayer = options?.routerConfig ? provide(layer$
|
|
12995
|
+
const RouterLayer = options?.routerConfig ? provide(layer$41, succeed$3(RouterConfig)(options.routerConfig)) : layer$41;
|
|
12995
12996
|
return gen(function* () {
|
|
12996
12997
|
const handler = (yield* HttpRouter).asHttpEffect();
|
|
12997
12998
|
return middleware ? serve$1(handler, middleware) : serve$1(handler);
|
|
@@ -13098,7 +13099,7 @@ function makeProto$4(options) {
|
|
|
13098
13099
|
* @category constructors
|
|
13099
13100
|
* @since 4.0.0
|
|
13100
13101
|
*/
|
|
13101
|
-
const make$
|
|
13102
|
+
const make$57 = (method) => (identifier, path, options) => {
|
|
13102
13103
|
const disableCodecs = options?.disableCodecs ?? false;
|
|
13103
13104
|
const transformStringTree = disableCodecs ? identity : toCodecStringTree;
|
|
13104
13105
|
return makeProto$4({
|
|
@@ -13239,15 +13240,15 @@ function transformPayload(schema, method) {
|
|
|
13239
13240
|
* @category constructors
|
|
13240
13241
|
* @since 4.0.0
|
|
13241
13242
|
*/
|
|
13242
|
-
const get$2 = /*#__PURE__*/ make$
|
|
13243
|
+
const get$2 = /*#__PURE__*/ make$57("GET");
|
|
13243
13244
|
/**
|
|
13244
13245
|
* Creates a `POST` endpoint declaration.
|
|
13245
13246
|
*
|
|
13246
13247
|
* @category constructors
|
|
13247
13248
|
* @since 4.0.0
|
|
13248
13249
|
*/
|
|
13249
|
-
const post = /*#__PURE__*/ make$
|
|
13250
|
-
const del = /*#__PURE__*/ make$
|
|
13250
|
+
const post = /*#__PURE__*/ make$57("POST");
|
|
13251
|
+
const del = /*#__PURE__*/ make$57("DELETE");
|
|
13251
13252
|
//#endregion
|
|
13252
13253
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/httpapi/HttpApi.js
|
|
13253
13254
|
const TypeId$11 = "~effect/httpapi/HttpApi";
|
|
@@ -13322,7 +13323,7 @@ const makeProto$3 = (options) => {
|
|
|
13322
13323
|
* @category constructors
|
|
13323
13324
|
* @since 4.0.0
|
|
13324
13325
|
*/
|
|
13325
|
-
const make$
|
|
13326
|
+
const make$56 = (identifier) => makeProto$3({
|
|
13326
13327
|
identifier,
|
|
13327
13328
|
groups: {},
|
|
13328
13329
|
annotations: empty$5()
|
|
@@ -13461,7 +13462,7 @@ const makeProto$2 = (options) => {
|
|
|
13461
13462
|
* @category constructors
|
|
13462
13463
|
* @since 4.0.0
|
|
13463
13464
|
*/
|
|
13464
|
-
const make$
|
|
13465
|
+
const make$55 = (identifier, options) => makeProto$2({
|
|
13465
13466
|
identifier,
|
|
13466
13467
|
topLevel: options?.topLevel ?? false,
|
|
13467
13468
|
endpoints: {},
|
|
@@ -16172,11 +16173,11 @@ const RelayHealthResponse = Struct({
|
|
|
16172
16173
|
ok: Boolean$1,
|
|
16173
16174
|
service: Literal("relay")
|
|
16174
16175
|
});
|
|
16175
|
-
const RelayHealthGroup = make$
|
|
16176
|
+
const RelayHealthGroup = make$55("health").add(get$2("health", "/health", {
|
|
16176
16177
|
success: RelayHealthResponse,
|
|
16177
16178
|
error: RelayInternalError
|
|
16178
16179
|
}).annotate(Summary, "Check relay health")).annotate(Description, "Service health and readiness.");
|
|
16179
|
-
const RelayMetadataGroup = make$
|
|
16180
|
+
const RelayMetadataGroup = make$55("metadata").add(get$2("authorizationServer", "/.well-known/oauth-authorization-server", { success: RelayAuthorizationServerMetadata }).annotate(Summary, "Read OAuth authorization-server metadata"), get$2("protectedResource", "/.well-known/oauth-protected-resource", { success: RelayProtectedResourceMetadata }).annotate(Summary, "Read OAuth protected-resource metadata")).annotate(Description, "OAuth and DPoP discovery metadata.");
|
|
16180
16181
|
const RelayRegisterDeviceEndpoint = post("registerDevice", "/v1/mobile/devices", {
|
|
16181
16182
|
headers: RelayDpopRequestHeaders,
|
|
16182
16183
|
payload: RelayDeviceRegistrationRequest,
|
|
@@ -16200,8 +16201,8 @@ const RelayUnregisterDeviceEndpoint = del("unregisterDevice", "/v1/mobile/device
|
|
|
16200
16201
|
success: RelayOkResponse,
|
|
16201
16202
|
error: RelayAuthAndInternalErrors
|
|
16202
16203
|
}).annotate(Summary, "Unregister a mobile device");
|
|
16203
|
-
const RelayMobileGroup = make$
|
|
16204
|
-
const RelayClientGroup = make$
|
|
16204
|
+
const RelayMobileGroup = make$55("mobile").add(RelayRegisterDeviceEndpoint, RelayRegisterLiveActivityEndpoint, RelayAgentActivitySnapshotEndpoint, RelayUnregisterDeviceEndpoint).annotate(Description, "Mobile push-notification and Live Activity registration.").middleware(RelayDpopClientAuth);
|
|
16205
|
+
const RelayClientGroup = make$55("client").add(get$2("listEnvironments", "/v1/environments", {
|
|
16205
16206
|
headers: RelayBearerRequestHeaders,
|
|
16206
16207
|
success: RelayListEnvironmentsResponse,
|
|
16207
16208
|
error: RelayAuthAndInternalErrors
|
|
@@ -16236,7 +16237,7 @@ const RelayExchangeDpopAccessTokenEndpoint = post("exchangeDpopAccessToken", "/v
|
|
|
16236
16237
|
success: RelayDpopAccessTokenResponse,
|
|
16237
16238
|
error: RelayAuthAndInternalErrors
|
|
16238
16239
|
}).annotate(Summary, "Exchange a Clerk token for a DPoP access token").annotate(Description, "Bootstrap endpoint. Send the DPoP proof JWT in the dpop header and the Clerk token in subject_token. The returned access token is bound to the proof key.");
|
|
16239
|
-
const RelayTokenGroup = make$
|
|
16240
|
+
const RelayTokenGroup = make$55("token").add(RelayExchangeDpopAccessTokenEndpoint).annotate(Description, "OAuth token exchange for DPoP-bound client access.");
|
|
16240
16241
|
const RelayConnectEnvironmentEndpoint = post("connectEnvironment", "/v1/environments/:environmentId/connect", {
|
|
16241
16242
|
headers: RelayDpopRequestHeaders,
|
|
16242
16243
|
params: Struct({ environmentId: EnvironmentId }),
|
|
@@ -16250,8 +16251,8 @@ const RelayGetEnvironmentStatusEndpoint = post("getEnvironmentStatus", "/v1/envi
|
|
|
16250
16251
|
success: RelayEnvironmentStatusResponse,
|
|
16251
16252
|
error: RelayEnvironmentConnectErrors
|
|
16252
16253
|
}).annotate(Summary, "Check environment status");
|
|
16253
|
-
const RelayDpopClientGroup = make$
|
|
16254
|
-
const RelayServerGroup = make$
|
|
16254
|
+
const RelayDpopClientGroup = make$55("dpopClient").add(RelayConnectEnvironmentEndpoint, RelayGetEnvironmentStatusEndpoint).annotate(Description, "DPoP-authenticated client access to linked environments.").middleware(RelayDpopClientAuth);
|
|
16255
|
+
const RelayServerGroup = make$55("server").add(post("publishAgentActivity", "/v1/environments/:environmentId/threads/:threadId/agent-activity", {
|
|
16255
16256
|
params: Struct({
|
|
16256
16257
|
environmentId: EnvironmentId,
|
|
16257
16258
|
threadId: ThreadId
|
|
@@ -16260,7 +16261,7 @@ const RelayServerGroup = make$52("server").add(post("publishAgentActivity", "/v1
|
|
|
16260
16261
|
success: RelayPublishResponse,
|
|
16261
16262
|
error: RelayAgentActivityPublishErrors
|
|
16262
16263
|
}).annotate(Summary, "Publish agent activity")).annotate(Description, "Environment-authenticated activity publication.").middleware(RelayEnvironmentAuth);
|
|
16263
|
-
make$
|
|
16264
|
+
make$56("RelayApi").add(RelayHealthGroup, RelayMetadataGroup, RelayMobileGroup, RelayClientGroup, RelayTokenGroup, RelayDpopClientGroup, RelayServerGroup).annotate(Title$1, "AgentLink Relay API").annotate(Version, "1.0.0").annotate(Description, "Control-plane API for linking T3 environments, connecting authorized clients, and publishing agent activity.");
|
|
16264
16265
|
//#endregion
|
|
16265
16266
|
//#region ../t3-contracts/src/environmentHttp.ts
|
|
16266
16267
|
const OptionalBearerHeaders = Struct({
|
|
@@ -16438,8 +16439,8 @@ const EnvironmentCloudPreferencesRequest = Struct({ publishAgentActivity: Boolea
|
|
|
16438
16439
|
const AuthPairingLinkRevokeResult = Struct({ revoked: Boolean$1 });
|
|
16439
16440
|
const AuthClientSessionRevokeResult = Struct({ revoked: Boolean$1 });
|
|
16440
16441
|
const AuthOtherClientSessionsRevokeResult = Struct({ revokedCount: Number$1 });
|
|
16441
|
-
var EnvironmentMetadataHttpApi = class extends make$
|
|
16442
|
-
var EnvironmentAuthHttpApi = class extends make$
|
|
16442
|
+
var EnvironmentMetadataHttpApi = class extends make$55("metadata").add(get$2("descriptor", "/.well-known/t3/environment", { success: ExecutionEnvironmentDescriptor })) {};
|
|
16443
|
+
var EnvironmentAuthHttpApi = class extends make$55("auth").add(get$2("session", "/api/auth/session", {
|
|
16443
16444
|
headers: OptionalBearerHeaders,
|
|
16444
16445
|
success: AuthSessionState,
|
|
16445
16446
|
error: [EnvironmentInternalError]
|
|
@@ -16485,7 +16486,7 @@ var EnvironmentAuthHttpApi = class extends make$52("auth").add(get$2("session",
|
|
|
16485
16486
|
error: EnvironmentScopedOperationErrors
|
|
16486
16487
|
}).middleware(EnvironmentAuthenticatedAuth)) {};
|
|
16487
16488
|
const EnvironmentOrchestrationThreadSnapshotParams = Struct({ threadId: ThreadId });
|
|
16488
|
-
var EnvironmentOrchestrationHttpApi = class extends make$
|
|
16489
|
+
var EnvironmentOrchestrationHttpApi = class extends make$55("orchestration").add(get$2("snapshot", "/api/orchestration/snapshot", {
|
|
16489
16490
|
headers: OptionalBearerHeaders,
|
|
16490
16491
|
success: OrchestrationReadModel,
|
|
16491
16492
|
error: EnvironmentOrchestrationSnapshotErrors
|
|
@@ -16504,7 +16505,7 @@ var EnvironmentOrchestrationHttpApi = class extends make$52("orchestration").add
|
|
|
16504
16505
|
success: DispatchResult,
|
|
16505
16506
|
error: EnvironmentOrchestrationDispatchErrors
|
|
16506
16507
|
}).middleware(EnvironmentAuthenticatedAuth)) {};
|
|
16507
|
-
var EnvironmentConnectHttpApi = class extends make$
|
|
16508
|
+
var EnvironmentConnectHttpApi = class extends make$55("connect").add(post("linkProof", "/api/connect/link-proof", {
|
|
16508
16509
|
headers: OptionalBearerHeaders,
|
|
16509
16510
|
payload: RelayLinkProofRequest,
|
|
16510
16511
|
success: RelayEnvironmentLinkProof,
|
|
@@ -16540,7 +16541,7 @@ var EnvironmentConnectHttpApi = class extends make$52("connect").add(post("linkP
|
|
|
16540
16541
|
success: RelayEnvironmentMintResponse,
|
|
16541
16542
|
error: EnvironmentHttpCloudErrors
|
|
16542
16543
|
})) {};
|
|
16543
|
-
var EnvironmentHttpApi = class extends make$
|
|
16544
|
+
var EnvironmentHttpApi = class extends make$56("environment").add(EnvironmentMetadataHttpApi).add(EnvironmentAuthHttpApi).add(EnvironmentOrchestrationHttpApi).add(EnvironmentConnectHttpApi) {};
|
|
16544
16545
|
//#endregion
|
|
16545
16546
|
//#region ../t3-contracts/src/relayClient.ts
|
|
16546
16547
|
const RelayClientStatusSchema = Union([
|
|
@@ -16763,10 +16764,10 @@ const TypeId$7 = "~effect/LayerMap";
|
|
|
16763
16764
|
* @category constructors
|
|
16764
16765
|
* @since 3.14.0
|
|
16765
16766
|
*/
|
|
16766
|
-
const make$
|
|
16767
|
-
const context$
|
|
16768
|
-
const memoMap = CurrentMemoMap.forkOrCreate(context$
|
|
16769
|
-
const rcMap = yield* make$
|
|
16767
|
+
const make$54 = /*#__PURE__*/ fnUntraced(function* (lookup, options) {
|
|
16768
|
+
const context$3 = yield* context();
|
|
16769
|
+
const memoMap = CurrentMemoMap.forkOrCreate(context$3);
|
|
16770
|
+
const rcMap = yield* make$69({
|
|
16770
16771
|
lookup: (key) => contextWith((_) => buildWithMemoMap(lookup(key), memoMap, get$5(_, Scope))),
|
|
16771
16772
|
idleTimeToLive: options?.idleTimeToLive
|
|
16772
16773
|
});
|
|
@@ -16831,7 +16832,7 @@ const make$51 = /*#__PURE__*/ fnUntraced(function* (lookup, options) {
|
|
|
16831
16832
|
* @category constructors
|
|
16832
16833
|
* @since 3.14.0
|
|
16833
16834
|
*/
|
|
16834
|
-
const fromRecord$1 = (layers, options) => make$
|
|
16835
|
+
const fromRecord$1 = (layers, options) => make$54((key) => layers[key], {
|
|
16835
16836
|
...options,
|
|
16836
16837
|
preloadKeys: options?.preload ? Object.keys(layers) : void 0
|
|
16837
16838
|
});
|
|
@@ -16893,7 +16894,7 @@ const Service = () => (id, options) => {
|
|
|
16893
16894
|
Object.defineProperty(TagClass, "stack", { get() {
|
|
16894
16895
|
return creationError.stack;
|
|
16895
16896
|
} });
|
|
16896
|
-
TagClass_.layerNoDeps = effect(TagClass_)("lookup" in options ? make$
|
|
16897
|
+
TagClass_.layerNoDeps = effect(TagClass_)("lookup" in options ? make$54(options.lookup, options) : fromRecord$1(options.layers, options));
|
|
16897
16898
|
TagClass_.layer = options.dependencies && options.dependencies.length > 0 ? provide(TagClass_.layerNoDeps, options.dependencies) : TagClass_.layerNoDeps;
|
|
16898
16899
|
TagClass_.get = (key) => unwrap(map$4(TagClass_, (layerMap) => layerMap.get(key)));
|
|
16899
16900
|
TagClass_.contextEffect = (key) => flatMap$1(TagClass_, (layerMap) => layerMap.contextEffect(key));
|
|
@@ -17018,7 +17019,7 @@ const tracerLogger = tracerLogger$1;
|
|
|
17018
17019
|
* @category layers
|
|
17019
17020
|
* @since 4.0.0
|
|
17020
17021
|
*/
|
|
17021
|
-
const layer$
|
|
17022
|
+
const layer$40 = (loggers, options) => effect(CurrentLoggers, withFiber(fnUntraced$1(function* (fiber) {
|
|
17022
17023
|
const currentLoggers = new Set(options?.mergeWithExisting === true ? fiber.getRef(CurrentLoggers$1) : []);
|
|
17023
17024
|
for (const logger of loggers) currentLoggers.add(isEffect$1(logger) ? yield* logger : logger);
|
|
17024
17025
|
return currentLoggers;
|
|
@@ -17084,7 +17085,7 @@ const makeUnsafe$2 = (value) => {
|
|
|
17084
17085
|
* @category constructors
|
|
17085
17086
|
* @since 2.0.0
|
|
17086
17087
|
*/
|
|
17087
|
-
const make$
|
|
17088
|
+
const make$53 = (value) => sync(() => makeUnsafe$2(value));
|
|
17088
17089
|
/**
|
|
17089
17090
|
* Reads the current value synchronously, bypassing the `Effect` API and the
|
|
17090
17091
|
* ref's semaphore.
|
|
@@ -17169,7 +17170,7 @@ const TypeId$5 = "~effect/transactions/TxRef";
|
|
|
17169
17170
|
* @category constructors
|
|
17170
17171
|
* @since 2.0.0
|
|
17171
17172
|
*/
|
|
17172
|
-
const make$
|
|
17173
|
+
const make$52 = (initial) => sync(() => makeUnsafe$1(initial));
|
|
17173
17174
|
/**
|
|
17174
17175
|
* Creates a new `TxRef` synchronously with the specified initial value.
|
|
17175
17176
|
*
|
|
@@ -17397,7 +17398,7 @@ const TxChunkProto = {
|
|
|
17397
17398
|
* @category constructors
|
|
17398
17399
|
* @since 4.0.0
|
|
17399
17400
|
*/
|
|
17400
|
-
const empty = () => map$4(make$
|
|
17401
|
+
const empty = () => map$4(make$52(empty$6()), (ref) => makeUnsafe(ref));
|
|
17401
17402
|
/**
|
|
17402
17403
|
* Creates a new `TxChunk` with the specified TxRef.
|
|
17403
17404
|
*
|
|
@@ -17722,7 +17723,7 @@ const TxQueueProto = {
|
|
|
17722
17723
|
*/
|
|
17723
17724
|
const unbounded = () => gen(function* () {
|
|
17724
17725
|
const items = yield* empty();
|
|
17725
|
-
const stateRef = yield* make$
|
|
17726
|
+
const stateRef = yield* make$52({ _tag: "Open" });
|
|
17726
17727
|
const txQueue = Object.create(TxQueueProto);
|
|
17727
17728
|
txQueue.strategy = "unbounded";
|
|
17728
17729
|
txQueue.capacity = Number.POSITIVE_INFINITY;
|
|
@@ -22845,7 +22846,7 @@ const schema = /*#__PURE__*/ declare(isStream);
|
|
|
22845
22846
|
* @since 4.0.0
|
|
22846
22847
|
*/
|
|
22847
22848
|
function Stream(success, error) {
|
|
22848
|
-
return make$
|
|
22849
|
+
return make$70(schema.ast, {
|
|
22849
22850
|
[StreamSchemaTypeId]: StreamSchemaTypeId,
|
|
22850
22851
|
success,
|
|
22851
22852
|
error
|
|
@@ -22999,7 +23000,7 @@ const makeProto$1 = (options) => {
|
|
|
22999
23000
|
* @category constructors
|
|
23000
23001
|
* @since 4.0.0
|
|
23001
23002
|
*/
|
|
23002
|
-
const make$
|
|
23003
|
+
const make$51 = (tag, options) => {
|
|
23003
23004
|
const successSchema = options?.success ?? Void;
|
|
23004
23005
|
const errorSchema = options?.error ?? Never;
|
|
23005
23006
|
const defectSchema = options?.defect ?? Defect();
|
|
@@ -23155,7 +23156,7 @@ const RpcGroupProto = {
|
|
|
23155
23156
|
});
|
|
23156
23157
|
},
|
|
23157
23158
|
annotateRpcs(service, value) {
|
|
23158
|
-
return this.annotateRpcsMerge(make$
|
|
23159
|
+
return this.annotateRpcsMerge(make$68(service, value));
|
|
23159
23160
|
},
|
|
23160
23161
|
annotateMerge(context) {
|
|
23161
23162
|
return makeProto({
|
|
@@ -23182,7 +23183,7 @@ const makeProto = (options) => Object.assign(function() {}, RpcGroupProto, {
|
|
|
23182
23183
|
* @category constructors
|
|
23183
23184
|
* @since 4.0.0
|
|
23184
23185
|
*/
|
|
23185
|
-
const make$
|
|
23186
|
+
const make$50 = (...rpcs) => makeProto({
|
|
23186
23187
|
requests: new Map(rpcs.map((rpc) => [rpc._tag, rpc])),
|
|
23187
23188
|
annotations: empty$5()
|
|
23188
23189
|
});
|
|
@@ -23266,22 +23267,22 @@ const WS_METHODS = {
|
|
|
23266
23267
|
subscribeBackgroundPolicy: "subscribeBackgroundPolicy",
|
|
23267
23268
|
subscribeResourceTelemetry: "subscribeResourceTelemetry"
|
|
23268
23269
|
};
|
|
23269
|
-
const WsServerUpsertKeybindingRpc = make$
|
|
23270
|
+
const WsServerUpsertKeybindingRpc = make$51(WS_METHODS.serverUpsertKeybinding, {
|
|
23270
23271
|
payload: ServerUpsertKeybindingInput,
|
|
23271
23272
|
success: ServerUpsertKeybindingResult,
|
|
23272
23273
|
error: Union([KeybindingsConfigError, EnvironmentAuthorizationError])
|
|
23273
23274
|
});
|
|
23274
|
-
const WsServerRemoveKeybindingRpc = make$
|
|
23275
|
+
const WsServerRemoveKeybindingRpc = make$51(WS_METHODS.serverRemoveKeybinding, {
|
|
23275
23276
|
payload: ServerRemoveKeybindingInput,
|
|
23276
23277
|
success: ServerRemoveKeybindingResult,
|
|
23277
23278
|
error: Union([KeybindingsConfigError, EnvironmentAuthorizationError])
|
|
23278
23279
|
});
|
|
23279
|
-
const WsServerProbeRpc = make$
|
|
23280
|
+
const WsServerProbeRpc = make$51(WS_METHODS.serverProbe, {
|
|
23280
23281
|
payload: Struct({}),
|
|
23281
23282
|
success: Struct({}),
|
|
23282
23283
|
error: EnvironmentAuthorizationError
|
|
23283
23284
|
});
|
|
23284
|
-
const WsServerGetConfigRpc = make$
|
|
23285
|
+
const WsServerGetConfigRpc = make$51(WS_METHODS.serverGetConfig, {
|
|
23285
23286
|
payload: Struct({}),
|
|
23286
23287
|
success: ServerConfig$1,
|
|
23287
23288
|
error: Union([
|
|
@@ -23290,7 +23291,7 @@ const WsServerGetConfigRpc = make$48(WS_METHODS.serverGetConfig, {
|
|
|
23290
23291
|
EnvironmentAuthorizationError
|
|
23291
23292
|
])
|
|
23292
23293
|
});
|
|
23293
|
-
const WsServerRefreshProvidersRpc = make$
|
|
23294
|
+
const WsServerRefreshProvidersRpc = make$51(WS_METHODS.serverRefreshProviders, {
|
|
23294
23295
|
payload: Struct({
|
|
23295
23296
|
/**
|
|
23296
23297
|
* When supplied, only refresh this specific provider instance. When
|
|
@@ -23302,202 +23303,202 @@ instanceId: optional$3(ProviderInstanceId) }),
|
|
|
23302
23303
|
success: ServerProviderUpdatedPayload,
|
|
23303
23304
|
error: EnvironmentAuthorizationError
|
|
23304
23305
|
});
|
|
23305
|
-
const WsServerUpdateProviderRpc = make$
|
|
23306
|
+
const WsServerUpdateProviderRpc = make$51(WS_METHODS.serverUpdateProvider, {
|
|
23306
23307
|
payload: ServerProviderUpdateInput,
|
|
23307
23308
|
success: ServerProviderUpdatedPayload,
|
|
23308
23309
|
error: Union([ServerProviderUpdateError, EnvironmentAuthorizationError])
|
|
23309
23310
|
});
|
|
23310
|
-
const WsServerUpdateServerRpc = make$
|
|
23311
|
+
const WsServerUpdateServerRpc = make$51(WS_METHODS.serverUpdateServer, {
|
|
23311
23312
|
payload: ServerSelfUpdateInput,
|
|
23312
23313
|
success: ServerSelfUpdateResult,
|
|
23313
23314
|
error: Union([ServerSelfUpdateError, EnvironmentAuthorizationError])
|
|
23314
23315
|
});
|
|
23315
|
-
const WsServerUpdateServerWithProgressRpc = make$
|
|
23316
|
+
const WsServerUpdateServerWithProgressRpc = make$51(WS_METHODS.serverUpdateServerWithProgress, {
|
|
23316
23317
|
payload: ServerSelfUpdateInput,
|
|
23317
23318
|
success: ServerSelfUpdateProgressEvent,
|
|
23318
23319
|
error: Union([ServerSelfUpdateError, EnvironmentAuthorizationError]),
|
|
23319
23320
|
stream: true
|
|
23320
23321
|
});
|
|
23321
|
-
const WsServerGetSettingsRpc = make$
|
|
23322
|
+
const WsServerGetSettingsRpc = make$51(WS_METHODS.serverGetSettings, {
|
|
23322
23323
|
payload: Struct({}),
|
|
23323
23324
|
success: ServerSettings,
|
|
23324
23325
|
error: Union([ServerSettingsError, EnvironmentAuthorizationError])
|
|
23325
23326
|
});
|
|
23326
|
-
const WsServerUpdateSettingsRpc = make$
|
|
23327
|
+
const WsServerUpdateSettingsRpc = make$51(WS_METHODS.serverUpdateSettings, {
|
|
23327
23328
|
payload: Struct({ patch: ServerSettingsPatch }),
|
|
23328
23329
|
success: ServerSettings,
|
|
23329
23330
|
error: Union([ServerSettingsError, EnvironmentAuthorizationError])
|
|
23330
23331
|
});
|
|
23331
|
-
const WsServerDiscoverSourceControlRpc = make$
|
|
23332
|
+
const WsServerDiscoverSourceControlRpc = make$51(WS_METHODS.serverDiscoverSourceControl, {
|
|
23332
23333
|
payload: Struct({}),
|
|
23333
23334
|
success: SourceControlDiscoveryResult,
|
|
23334
23335
|
error: EnvironmentAuthorizationError
|
|
23335
23336
|
});
|
|
23336
|
-
const WsServerGetTraceDiagnosticsRpc = make$
|
|
23337
|
+
const WsServerGetTraceDiagnosticsRpc = make$51(WS_METHODS.serverGetTraceDiagnostics, {
|
|
23337
23338
|
payload: Struct({}),
|
|
23338
23339
|
success: ServerTraceDiagnosticsResult,
|
|
23339
23340
|
error: EnvironmentAuthorizationError
|
|
23340
23341
|
});
|
|
23341
|
-
const WsServerGetProcessDiagnosticsRpc = make$
|
|
23342
|
+
const WsServerGetProcessDiagnosticsRpc = make$51(WS_METHODS.serverGetProcessDiagnostics, {
|
|
23342
23343
|
payload: Struct({}),
|
|
23343
23344
|
success: ServerProcessDiagnosticsResult,
|
|
23344
23345
|
error: EnvironmentAuthorizationError
|
|
23345
23346
|
});
|
|
23346
|
-
const WsServerGetProcessResourceHistoryRpc = make$
|
|
23347
|
+
const WsServerGetProcessResourceHistoryRpc = make$51(WS_METHODS.serverGetProcessResourceHistory, {
|
|
23347
23348
|
payload: ServerProcessResourceHistoryInput,
|
|
23348
23349
|
success: ServerProcessResourceHistoryResult,
|
|
23349
23350
|
error: EnvironmentAuthorizationError
|
|
23350
23351
|
});
|
|
23351
|
-
const WsServerGetResourceTelemetryHistoryRpc = make$
|
|
23352
|
+
const WsServerGetResourceTelemetryHistoryRpc = make$51(WS_METHODS.serverGetResourceTelemetryHistory, {
|
|
23352
23353
|
payload: ResourceTelemetryHistoryInput,
|
|
23353
23354
|
success: ResourceTelemetryHistory,
|
|
23354
23355
|
error: EnvironmentAuthorizationError
|
|
23355
23356
|
});
|
|
23356
|
-
const WsServerRetryResourceTelemetryRpc = make$
|
|
23357
|
+
const WsServerRetryResourceTelemetryRpc = make$51(WS_METHODS.serverRetryResourceTelemetry, {
|
|
23357
23358
|
payload: Struct({}),
|
|
23358
23359
|
success: ResourceTelemetryRetryResult,
|
|
23359
23360
|
error: EnvironmentAuthorizationError
|
|
23360
23361
|
});
|
|
23361
|
-
const WsServerSignalProcessRpc = make$
|
|
23362
|
+
const WsServerSignalProcessRpc = make$51(WS_METHODS.serverSignalProcess, {
|
|
23362
23363
|
payload: ServerSignalProcessInput,
|
|
23363
23364
|
success: ServerSignalProcessResult,
|
|
23364
23365
|
error: EnvironmentAuthorizationError
|
|
23365
23366
|
});
|
|
23366
|
-
const WsCloudGetRelayClientStatusRpc = make$
|
|
23367
|
+
const WsCloudGetRelayClientStatusRpc = make$51(WS_METHODS.cloudGetRelayClientStatus, {
|
|
23367
23368
|
payload: Struct({}),
|
|
23368
23369
|
success: RelayClientStatusSchema,
|
|
23369
23370
|
error: EnvironmentAuthorizationError
|
|
23370
23371
|
});
|
|
23371
|
-
const WsCloudInstallRelayClientRpc = make$
|
|
23372
|
+
const WsCloudInstallRelayClientRpc = make$51(WS_METHODS.cloudInstallRelayClient, {
|
|
23372
23373
|
payload: Struct({}),
|
|
23373
23374
|
success: RelayClientInstallProgressEventSchema,
|
|
23374
23375
|
error: Union([RelayClientInstallFailedError, EnvironmentAuthorizationError]),
|
|
23375
23376
|
stream: true
|
|
23376
23377
|
});
|
|
23377
|
-
const WsServerReportClientActivityRpc = make$
|
|
23378
|
+
const WsServerReportClientActivityRpc = make$51(WS_METHODS.serverReportClientActivity, {
|
|
23378
23379
|
payload: ClientActivityReportInput,
|
|
23379
23380
|
error: EnvironmentAuthorizationError
|
|
23380
23381
|
});
|
|
23381
|
-
const WsServerReportHostPowerStateRpc = make$
|
|
23382
|
+
const WsServerReportHostPowerStateRpc = make$51(WS_METHODS.serverReportHostPowerState, {
|
|
23382
23383
|
payload: HostPowerSnapshot,
|
|
23383
23384
|
error: EnvironmentAuthorizationError
|
|
23384
23385
|
});
|
|
23385
|
-
const WsServerGetBackgroundPolicyRpc = make$
|
|
23386
|
+
const WsServerGetBackgroundPolicyRpc = make$51(WS_METHODS.serverGetBackgroundPolicy, {
|
|
23386
23387
|
payload: Struct({}),
|
|
23387
23388
|
success: BackgroundPolicySnapshot,
|
|
23388
23389
|
error: EnvironmentAuthorizationError
|
|
23389
23390
|
});
|
|
23390
|
-
const WsSourceControlLookupRepositoryRpc = make$
|
|
23391
|
+
const WsSourceControlLookupRepositoryRpc = make$51(WS_METHODS.sourceControlLookupRepository, {
|
|
23391
23392
|
payload: SourceControlRepositoryLookupInput,
|
|
23392
23393
|
success: SourceControlRepositoryInfo,
|
|
23393
23394
|
error: Union([SourceControlRepositoryError, EnvironmentAuthorizationError])
|
|
23394
23395
|
});
|
|
23395
|
-
const WsSourceControlCloneRepositoryRpc = make$
|
|
23396
|
+
const WsSourceControlCloneRepositoryRpc = make$51(WS_METHODS.sourceControlCloneRepository, {
|
|
23396
23397
|
payload: SourceControlCloneRepositoryInput,
|
|
23397
23398
|
success: SourceControlCloneRepositoryResult,
|
|
23398
23399
|
error: Union([SourceControlRepositoryError, EnvironmentAuthorizationError])
|
|
23399
23400
|
});
|
|
23400
|
-
const WsSourceControlPublishRepositoryRpc = make$
|
|
23401
|
+
const WsSourceControlPublishRepositoryRpc = make$51(WS_METHODS.sourceControlPublishRepository, {
|
|
23401
23402
|
payload: SourceControlPublishRepositoryInput,
|
|
23402
23403
|
success: SourceControlPublishRepositoryResult,
|
|
23403
23404
|
error: Union([SourceControlRepositoryError, EnvironmentAuthorizationError])
|
|
23404
23405
|
});
|
|
23405
|
-
const WsProjectsSearchEntriesRpc = make$
|
|
23406
|
+
const WsProjectsSearchEntriesRpc = make$51(WS_METHODS.projectsSearchEntries, {
|
|
23406
23407
|
payload: ProjectSearchEntriesInput,
|
|
23407
23408
|
success: ProjectSearchEntriesResult,
|
|
23408
23409
|
error: Union([ProjectSearchEntriesError, EnvironmentAuthorizationError])
|
|
23409
23410
|
});
|
|
23410
|
-
const WsProjectsSearchContentsRpc = make$
|
|
23411
|
+
const WsProjectsSearchContentsRpc = make$51(WS_METHODS.projectsSearchContents, {
|
|
23411
23412
|
payload: ProjectSearchContentsInput,
|
|
23412
23413
|
success: ProjectSearchContentsResult,
|
|
23413
23414
|
error: Union([ProjectSearchContentsError, EnvironmentAuthorizationError])
|
|
23414
23415
|
});
|
|
23415
|
-
const WsProjectsListEntriesRpc = make$
|
|
23416
|
+
const WsProjectsListEntriesRpc = make$51(WS_METHODS.projectsListEntries, {
|
|
23416
23417
|
payload: ProjectListEntriesInput,
|
|
23417
23418
|
success: ProjectListEntriesResult,
|
|
23418
23419
|
error: Union([ProjectListEntriesError, EnvironmentAuthorizationError])
|
|
23419
23420
|
});
|
|
23420
|
-
const WsProjectsReadFileRpc = make$
|
|
23421
|
+
const WsProjectsReadFileRpc = make$51(WS_METHODS.projectsReadFile, {
|
|
23421
23422
|
payload: ProjectReadFileInput,
|
|
23422
23423
|
success: ProjectReadFileResult,
|
|
23423
23424
|
error: Union([ProjectReadFileError, EnvironmentAuthorizationError])
|
|
23424
23425
|
});
|
|
23425
|
-
const WsProjectsWriteFileRpc = make$
|
|
23426
|
+
const WsProjectsWriteFileRpc = make$51(WS_METHODS.projectsWriteFile, {
|
|
23426
23427
|
payload: ProjectWriteFileInput,
|
|
23427
23428
|
success: ProjectWriteFileResult,
|
|
23428
23429
|
error: Union([ProjectWriteFileError, EnvironmentAuthorizationError])
|
|
23429
23430
|
});
|
|
23430
|
-
const WsShellOpenInEditorRpc = make$
|
|
23431
|
+
const WsShellOpenInEditorRpc = make$51(WS_METHODS.shellOpenInEditor, {
|
|
23431
23432
|
payload: LaunchEditorInput,
|
|
23432
23433
|
error: Union([ExternalLauncherError, EnvironmentAuthorizationError])
|
|
23433
23434
|
});
|
|
23434
|
-
const WsFilesystemBrowseRpc = make$
|
|
23435
|
+
const WsFilesystemBrowseRpc = make$51(WS_METHODS.filesystemBrowse, {
|
|
23435
23436
|
payload: FilesystemBrowseInput,
|
|
23436
23437
|
success: FilesystemBrowseResult,
|
|
23437
23438
|
error: Union([FilesystemBrowseError, EnvironmentAuthorizationError])
|
|
23438
23439
|
});
|
|
23439
|
-
const WsAssetsCreateUrlRpc = make$
|
|
23440
|
+
const WsAssetsCreateUrlRpc = make$51(WS_METHODS.assetsCreateUrl, {
|
|
23440
23441
|
payload: AssetCreateUrlInput,
|
|
23441
23442
|
success: AssetCreateUrlResult,
|
|
23442
23443
|
error: Union([AssetAccessError, EnvironmentAuthorizationError])
|
|
23443
23444
|
});
|
|
23444
|
-
const WsSubscribeVcsStatusRpc = make$
|
|
23445
|
+
const WsSubscribeVcsStatusRpc = make$51(WS_METHODS.subscribeVcsStatus, {
|
|
23445
23446
|
payload: VcsStatusInput,
|
|
23446
23447
|
success: VcsStatusStreamEvent,
|
|
23447
23448
|
error: Union([GitManagerServiceError, EnvironmentAuthorizationError]),
|
|
23448
23449
|
stream: true
|
|
23449
23450
|
});
|
|
23450
|
-
const WsVcsPullRpc = make$
|
|
23451
|
+
const WsVcsPullRpc = make$51(WS_METHODS.vcsPull, {
|
|
23451
23452
|
payload: VcsPullInput,
|
|
23452
23453
|
success: VcsPullResult,
|
|
23453
23454
|
error: Union([GitCommandError, EnvironmentAuthorizationError])
|
|
23454
23455
|
});
|
|
23455
|
-
const WsVcsRefreshStatusRpc = make$
|
|
23456
|
+
const WsVcsRefreshStatusRpc = make$51(WS_METHODS.vcsRefreshStatus, {
|
|
23456
23457
|
payload: VcsStatusInput,
|
|
23457
23458
|
success: VcsStatusResult,
|
|
23458
23459
|
error: Union([GitManagerServiceError, EnvironmentAuthorizationError])
|
|
23459
23460
|
});
|
|
23460
|
-
const WsGitRunStackedActionRpc = make$
|
|
23461
|
+
const WsGitRunStackedActionRpc = make$51(WS_METHODS.gitRunStackedAction, {
|
|
23461
23462
|
payload: GitRunStackedActionInput,
|
|
23462
23463
|
success: GitActionProgressEvent,
|
|
23463
23464
|
error: Union([GitManagerServiceError, EnvironmentAuthorizationError]),
|
|
23464
23465
|
stream: true
|
|
23465
23466
|
});
|
|
23466
|
-
const WsGitResolvePullRequestRpc = make$
|
|
23467
|
+
const WsGitResolvePullRequestRpc = make$51(WS_METHODS.gitResolvePullRequest, {
|
|
23467
23468
|
payload: GitPullRequestRefInput,
|
|
23468
23469
|
success: GitResolvePullRequestResult,
|
|
23469
23470
|
error: Union([GitManagerServiceError, EnvironmentAuthorizationError])
|
|
23470
23471
|
});
|
|
23471
|
-
const WsGitPreparePullRequestThreadRpc = make$
|
|
23472
|
+
const WsGitPreparePullRequestThreadRpc = make$51(WS_METHODS.gitPreparePullRequestThread, {
|
|
23472
23473
|
payload: GitPreparePullRequestThreadInput,
|
|
23473
23474
|
success: GitPreparePullRequestThreadResult,
|
|
23474
23475
|
error: Union([GitManagerServiceError, EnvironmentAuthorizationError])
|
|
23475
23476
|
});
|
|
23476
|
-
const WsVcsListRefsRpc = make$
|
|
23477
|
+
const WsVcsListRefsRpc = make$51(WS_METHODS.vcsListRefs, {
|
|
23477
23478
|
payload: VcsListRefsInput,
|
|
23478
23479
|
success: VcsListRefsResult,
|
|
23479
23480
|
error: Union([GitCommandError, EnvironmentAuthorizationError])
|
|
23480
23481
|
});
|
|
23481
|
-
const WsVcsCreateWorktreeRpc = make$
|
|
23482
|
+
const WsVcsCreateWorktreeRpc = make$51(WS_METHODS.vcsCreateWorktree, {
|
|
23482
23483
|
payload: VcsCreateWorktreeInput,
|
|
23483
23484
|
success: VcsCreateWorktreeResult,
|
|
23484
23485
|
error: Union([GitCommandError, EnvironmentAuthorizationError])
|
|
23485
23486
|
});
|
|
23486
|
-
const WsVcsRemoveWorktreeRpc = make$
|
|
23487
|
+
const WsVcsRemoveWorktreeRpc = make$51(WS_METHODS.vcsRemoveWorktree, {
|
|
23487
23488
|
payload: VcsRemoveWorktreeInput,
|
|
23488
23489
|
error: Union([GitCommandError, EnvironmentAuthorizationError])
|
|
23489
23490
|
});
|
|
23490
|
-
const WsVcsCreateRefRpc = make$
|
|
23491
|
+
const WsVcsCreateRefRpc = make$51(WS_METHODS.vcsCreateRef, {
|
|
23491
23492
|
payload: VcsCreateRefInput,
|
|
23492
23493
|
success: VcsCreateRefResult,
|
|
23493
23494
|
error: Union([GitCommandError, EnvironmentAuthorizationError])
|
|
23494
23495
|
});
|
|
23495
|
-
const WsVcsSwitchRefRpc = make$
|
|
23496
|
+
const WsVcsSwitchRefRpc = make$51(WS_METHODS.vcsSwitchRef, {
|
|
23496
23497
|
payload: VcsSwitchRefInput,
|
|
23497
23498
|
success: VcsSwitchRefResult,
|
|
23498
23499
|
error: Union([GitCommandError, EnvironmentAuthorizationError])
|
|
23499
23500
|
});
|
|
23500
|
-
const WsVcsInitRpc = make$
|
|
23501
|
+
const WsVcsInitRpc = make$51(WS_METHODS.vcsInit, {
|
|
23501
23502
|
payload: VcsInitInput,
|
|
23502
23503
|
error: Union([VcsError, EnvironmentAuthorizationError])
|
|
23503
23504
|
});
|
|
@@ -23506,159 +23507,159 @@ const WsVcsInitRpc = make$48(WS_METHODS.vcsInit, {
|
|
|
23506
23507
|
* Not the persisted T3 Review model. Future review sessions should use
|
|
23507
23508
|
* review.open* + review.getSnapshot.
|
|
23508
23509
|
*/
|
|
23509
|
-
const WsReviewGetDiffPreviewRpc = make$
|
|
23510
|
+
const WsReviewGetDiffPreviewRpc = make$51(WS_METHODS.reviewGetDiffPreview, {
|
|
23510
23511
|
payload: ReviewDiffPreviewInput,
|
|
23511
23512
|
success: ReviewDiffPreviewResult,
|
|
23512
23513
|
error: Union([ReviewDiffPreviewError, EnvironmentAuthorizationError])
|
|
23513
23514
|
});
|
|
23514
|
-
const WsReviewGetDiffFileContentsRpc = make$
|
|
23515
|
+
const WsReviewGetDiffFileContentsRpc = make$51(WS_METHODS.reviewGetDiffFileContents, {
|
|
23515
23516
|
payload: ReviewDiffFileContentsInput,
|
|
23516
23517
|
success: ReviewDiffFileContentsResult,
|
|
23517
23518
|
error: Union([ReviewDiffPreviewError, EnvironmentAuthorizationError])
|
|
23518
23519
|
});
|
|
23519
|
-
const WsTerminalOpenRpc = make$
|
|
23520
|
+
const WsTerminalOpenRpc = make$51(WS_METHODS.terminalOpen, {
|
|
23520
23521
|
payload: TerminalOpenInput,
|
|
23521
23522
|
success: TerminalSessionSnapshot,
|
|
23522
23523
|
error: Union([TerminalError, EnvironmentAuthorizationError])
|
|
23523
23524
|
});
|
|
23524
|
-
const WsTerminalAttachRpc = make$
|
|
23525
|
+
const WsTerminalAttachRpc = make$51(WS_METHODS.terminalAttach, {
|
|
23525
23526
|
payload: TerminalAttachInput,
|
|
23526
23527
|
success: TerminalAttachStreamEvent,
|
|
23527
23528
|
error: Union([TerminalError, EnvironmentAuthorizationError]),
|
|
23528
23529
|
stream: true
|
|
23529
23530
|
});
|
|
23530
|
-
const WsTerminalWriteRpc = make$
|
|
23531
|
+
const WsTerminalWriteRpc = make$51(WS_METHODS.terminalWrite, {
|
|
23531
23532
|
payload: TerminalWriteInput,
|
|
23532
23533
|
error: Union([TerminalError, EnvironmentAuthorizationError])
|
|
23533
23534
|
});
|
|
23534
|
-
const WsTerminalResizeRpc = make$
|
|
23535
|
+
const WsTerminalResizeRpc = make$51(WS_METHODS.terminalResize, {
|
|
23535
23536
|
payload: TerminalResizeInput,
|
|
23536
23537
|
error: Union([TerminalError, EnvironmentAuthorizationError])
|
|
23537
23538
|
});
|
|
23538
|
-
const WsTerminalClearRpc = make$
|
|
23539
|
+
const WsTerminalClearRpc = make$51(WS_METHODS.terminalClear, {
|
|
23539
23540
|
payload: TerminalClearInput,
|
|
23540
23541
|
error: Union([TerminalError, EnvironmentAuthorizationError])
|
|
23541
23542
|
});
|
|
23542
|
-
const WsTerminalRestartRpc = make$
|
|
23543
|
+
const WsTerminalRestartRpc = make$51(WS_METHODS.terminalRestart, {
|
|
23543
23544
|
payload: TerminalRestartInput,
|
|
23544
23545
|
success: TerminalSessionSnapshot,
|
|
23545
23546
|
error: Union([TerminalError, EnvironmentAuthorizationError])
|
|
23546
23547
|
});
|
|
23547
|
-
const WsTerminalCloseRpc = make$
|
|
23548
|
+
const WsTerminalCloseRpc = make$51(WS_METHODS.terminalClose, {
|
|
23548
23549
|
payload: TerminalCloseInput,
|
|
23549
23550
|
error: Union([TerminalError, EnvironmentAuthorizationError])
|
|
23550
23551
|
});
|
|
23551
|
-
const WsPreviewOpenRpc = make$
|
|
23552
|
+
const WsPreviewOpenRpc = make$51(WS_METHODS.previewOpen, {
|
|
23552
23553
|
payload: PreviewOpenInput,
|
|
23553
23554
|
success: PreviewSessionSnapshot,
|
|
23554
23555
|
error: Union([PreviewError, EnvironmentAuthorizationError])
|
|
23555
23556
|
});
|
|
23556
|
-
const WsPreviewNavigateRpc = make$
|
|
23557
|
+
const WsPreviewNavigateRpc = make$51(WS_METHODS.previewNavigate, {
|
|
23557
23558
|
payload: PreviewNavigateInput,
|
|
23558
23559
|
success: PreviewSessionSnapshot,
|
|
23559
23560
|
error: Union([PreviewError, EnvironmentAuthorizationError])
|
|
23560
23561
|
});
|
|
23561
|
-
const WsPreviewResizeRpc = make$
|
|
23562
|
+
const WsPreviewResizeRpc = make$51(WS_METHODS.previewResize, {
|
|
23562
23563
|
payload: PreviewResizeInput,
|
|
23563
23564
|
success: PreviewSessionSnapshot,
|
|
23564
23565
|
error: Union([PreviewError, EnvironmentAuthorizationError])
|
|
23565
23566
|
});
|
|
23566
|
-
const WsPreviewRefreshRpc = make$
|
|
23567
|
+
const WsPreviewRefreshRpc = make$51(WS_METHODS.previewRefresh, {
|
|
23567
23568
|
payload: PreviewRefreshInput,
|
|
23568
23569
|
error: Union([PreviewError, EnvironmentAuthorizationError])
|
|
23569
23570
|
});
|
|
23570
|
-
const WsPreviewCloseRpc = make$
|
|
23571
|
+
const WsPreviewCloseRpc = make$51(WS_METHODS.previewClose, {
|
|
23571
23572
|
payload: PreviewCloseInput,
|
|
23572
23573
|
error: Union([PreviewError, EnvironmentAuthorizationError])
|
|
23573
23574
|
});
|
|
23574
|
-
const WsPreviewListRpc = make$
|
|
23575
|
+
const WsPreviewListRpc = make$51(WS_METHODS.previewList, {
|
|
23575
23576
|
payload: PreviewListInput,
|
|
23576
23577
|
success: PreviewListResult,
|
|
23577
23578
|
error: EnvironmentAuthorizationError
|
|
23578
23579
|
});
|
|
23579
|
-
const WsPreviewReportStatusRpc = make$
|
|
23580
|
+
const WsPreviewReportStatusRpc = make$51(WS_METHODS.previewReportStatus, {
|
|
23580
23581
|
payload: PreviewReportStatusInput,
|
|
23581
23582
|
error: Union([PreviewError, EnvironmentAuthorizationError])
|
|
23582
23583
|
});
|
|
23583
|
-
const WsPreviewAutomationConnectRpc = make$
|
|
23584
|
+
const WsPreviewAutomationConnectRpc = make$51(WS_METHODS.previewAutomationConnect, {
|
|
23584
23585
|
payload: PreviewAutomationHost,
|
|
23585
23586
|
success: PreviewAutomationStreamEvent,
|
|
23586
23587
|
error: Union([PreviewAutomationError, EnvironmentAuthorizationError]),
|
|
23587
23588
|
stream: true
|
|
23588
23589
|
});
|
|
23589
|
-
const WsPreviewAutomationRespondRpc = make$
|
|
23590
|
+
const WsPreviewAutomationRespondRpc = make$51(WS_METHODS.previewAutomationRespond, {
|
|
23590
23591
|
payload: PreviewAutomationResponse,
|
|
23591
23592
|
error: Union([PreviewAutomationError, EnvironmentAuthorizationError])
|
|
23592
23593
|
});
|
|
23593
|
-
const WsPreviewAutomationFocusHostRpc = make$
|
|
23594
|
+
const WsPreviewAutomationFocusHostRpc = make$51(WS_METHODS.previewAutomationFocusHost, {
|
|
23594
23595
|
payload: PreviewAutomationHostFocus,
|
|
23595
23596
|
error: EnvironmentAuthorizationError
|
|
23596
23597
|
});
|
|
23597
|
-
const WsSubscribePreviewEventsRpc = make$
|
|
23598
|
+
const WsSubscribePreviewEventsRpc = make$51(WS_METHODS.subscribePreviewEvents, {
|
|
23598
23599
|
payload: Struct({}),
|
|
23599
23600
|
success: PreviewEvent,
|
|
23600
23601
|
error: EnvironmentAuthorizationError,
|
|
23601
23602
|
stream: true
|
|
23602
23603
|
});
|
|
23603
|
-
const WsSubscribeDiscoveredLocalServersRpc = make$
|
|
23604
|
+
const WsSubscribeDiscoveredLocalServersRpc = make$51(WS_METHODS.subscribeDiscoveredLocalServers, {
|
|
23604
23605
|
payload: Struct({}),
|
|
23605
23606
|
success: DiscoveredLocalServerList,
|
|
23606
23607
|
error: EnvironmentAuthorizationError,
|
|
23607
23608
|
stream: true
|
|
23608
23609
|
});
|
|
23609
|
-
const WsOrchestrationDispatchCommandRpc = make$
|
|
23610
|
+
const WsOrchestrationDispatchCommandRpc = make$51(ORCHESTRATION_WS_METHODS.dispatchCommand, {
|
|
23610
23611
|
payload: ClientOrchestrationCommand,
|
|
23611
23612
|
success: OrchestrationRpcSchemas.dispatchCommand.output,
|
|
23612
23613
|
error: Union([OrchestrationDispatchCommandError, EnvironmentAuthorizationError])
|
|
23613
23614
|
});
|
|
23614
|
-
const WsOrchestrationGetWorkflowScriptRpc = make$
|
|
23615
|
+
const WsOrchestrationGetWorkflowScriptRpc = make$51(ORCHESTRATION_WS_METHODS.getWorkflowScript, {
|
|
23615
23616
|
payload: OrchestrationRpcSchemas.getWorkflowScript.input,
|
|
23616
23617
|
success: OrchestrationRpcSchemas.getWorkflowScript.output,
|
|
23617
23618
|
error: Union([OrchestrationGetWorkflowScriptError, EnvironmentAuthorizationError])
|
|
23618
23619
|
});
|
|
23619
|
-
const WsOrchestrationGetTurnDiffRpc = make$
|
|
23620
|
+
const WsOrchestrationGetTurnDiffRpc = make$51(ORCHESTRATION_WS_METHODS.getTurnDiff, {
|
|
23620
23621
|
payload: OrchestrationGetTurnDiffInput,
|
|
23621
23622
|
success: OrchestrationRpcSchemas.getTurnDiff.output,
|
|
23622
23623
|
error: Union([OrchestrationGetTurnDiffError, EnvironmentAuthorizationError])
|
|
23623
23624
|
});
|
|
23624
|
-
const WsOrchestrationGetFullThreadDiffRpc = make$
|
|
23625
|
+
const WsOrchestrationGetFullThreadDiffRpc = make$51(ORCHESTRATION_WS_METHODS.getFullThreadDiff, {
|
|
23625
23626
|
payload: OrchestrationGetFullThreadDiffInput,
|
|
23626
23627
|
success: OrchestrationRpcSchemas.getFullThreadDiff.output,
|
|
23627
23628
|
error: Union([OrchestrationGetFullThreadDiffError, EnvironmentAuthorizationError])
|
|
23628
23629
|
});
|
|
23629
|
-
const WsOrchestrationSearchThreadsRpc = make$
|
|
23630
|
+
const WsOrchestrationSearchThreadsRpc = make$51(ORCHESTRATION_WS_METHODS.searchThreads, {
|
|
23630
23631
|
payload: OrchestrationSearchThreadsInput,
|
|
23631
23632
|
success: OrchestrationRpcSchemas.searchThreads.output,
|
|
23632
23633
|
error: Union([OrchestrationSearchThreadsError, EnvironmentAuthorizationError])
|
|
23633
23634
|
});
|
|
23634
|
-
const WsOrchestrationGetArchivedShellSnapshotRpc = make$
|
|
23635
|
+
const WsOrchestrationGetArchivedShellSnapshotRpc = make$51(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, {
|
|
23635
23636
|
payload: OrchestrationRpcSchemas.getArchivedShellSnapshot.input,
|
|
23636
23637
|
success: OrchestrationRpcSchemas.getArchivedShellSnapshot.output,
|
|
23637
23638
|
error: Union([OrchestrationGetSnapshotError, EnvironmentAuthorizationError])
|
|
23638
23639
|
});
|
|
23639
|
-
const WsOrchestrationSubscribeShellRpc = make$
|
|
23640
|
+
const WsOrchestrationSubscribeShellRpc = make$51(ORCHESTRATION_WS_METHODS.subscribeShell, {
|
|
23640
23641
|
payload: OrchestrationRpcSchemas.subscribeShell.input,
|
|
23641
23642
|
success: OrchestrationRpcSchemas.subscribeShell.output,
|
|
23642
23643
|
error: Union([OrchestrationGetSnapshotError, EnvironmentAuthorizationError]),
|
|
23643
23644
|
stream: true
|
|
23644
23645
|
});
|
|
23645
|
-
const WsOrchestrationSubscribeThreadRpc = make$
|
|
23646
|
+
const WsOrchestrationSubscribeThreadRpc = make$51(ORCHESTRATION_WS_METHODS.subscribeThread, {
|
|
23646
23647
|
payload: OrchestrationRpcSchemas.subscribeThread.input,
|
|
23647
23648
|
success: OrchestrationRpcSchemas.subscribeThread.output,
|
|
23648
23649
|
error: Union([OrchestrationGetSnapshotError, EnvironmentAuthorizationError]),
|
|
23649
23650
|
stream: true
|
|
23650
23651
|
});
|
|
23651
|
-
const WsRpcGroup = make$
|
|
23652
|
+
const WsRpcGroup = make$50(WsServerProbeRpc, WsServerGetConfigRpc, WsServerRefreshProvidersRpc, WsServerUpdateProviderRpc, WsServerUpdateServerRpc, WsServerUpdateServerWithProgressRpc, WsServerUpsertKeybindingRpc, WsServerRemoveKeybindingRpc, WsServerGetSettingsRpc, WsServerUpdateSettingsRpc, WsServerDiscoverSourceControlRpc, WsServerGetTraceDiagnosticsRpc, WsServerGetProcessDiagnosticsRpc, WsServerGetProcessResourceHistoryRpc, WsServerGetResourceTelemetryHistoryRpc, WsServerRetryResourceTelemetryRpc, WsServerSignalProcessRpc, WsServerReportClientActivityRpc, WsServerReportHostPowerStateRpc, WsServerGetBackgroundPolicyRpc, WsCloudGetRelayClientStatusRpc, WsCloudInstallRelayClientRpc, WsSourceControlLookupRepositoryRpc, WsSourceControlCloneRepositoryRpc, WsSourceControlPublishRepositoryRpc, WsProjectsListEntriesRpc, WsProjectsReadFileRpc, WsProjectsSearchContentsRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsShellOpenInEditorRpc, WsFilesystemBrowseRpc, WsAssetsCreateUrlRpc, WsSubscribeVcsStatusRpc, WsVcsPullRpc, WsVcsRefreshStatusRpc, WsGitRunStackedActionRpc, WsGitResolvePullRequestRpc, WsGitPreparePullRequestThreadRpc, WsVcsListRefsRpc, WsVcsCreateWorktreeRpc, WsVcsRemoveWorktreeRpc, WsVcsCreateRefRpc, WsVcsSwitchRefRpc, WsVcsInitRpc, WsReviewGetDiffPreviewRpc, WsReviewGetDiffFileContentsRpc, WsTerminalOpenRpc, WsTerminalAttachRpc, WsTerminalWriteRpc, WsTerminalResizeRpc, WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, make$51(WS_METHODS.subscribeTerminalEvents, {
|
|
23652
23653
|
payload: Struct({}),
|
|
23653
23654
|
success: TerminalEvent,
|
|
23654
23655
|
error: EnvironmentAuthorizationError,
|
|
23655
23656
|
stream: true
|
|
23656
|
-
}), make$
|
|
23657
|
+
}), make$51(WS_METHODS.subscribeTerminalMetadata, {
|
|
23657
23658
|
payload: Struct({}),
|
|
23658
23659
|
success: TerminalMetadataStreamEvent,
|
|
23659
23660
|
error: EnvironmentAuthorizationError,
|
|
23660
23661
|
stream: true
|
|
23661
|
-
}), WsPreviewOpenRpc, WsPreviewNavigateRpc, WsPreviewResizeRpc, WsPreviewRefreshRpc, WsPreviewCloseRpc, WsPreviewListRpc, WsPreviewReportStatusRpc, WsPreviewAutomationConnectRpc, WsPreviewAutomationRespondRpc, WsPreviewAutomationFocusHostRpc, WsSubscribePreviewEventsRpc, WsSubscribeDiscoveredLocalServersRpc, make$
|
|
23662
|
+
}), WsPreviewOpenRpc, WsPreviewNavigateRpc, WsPreviewResizeRpc, WsPreviewRefreshRpc, WsPreviewCloseRpc, WsPreviewListRpc, WsPreviewReportStatusRpc, WsPreviewAutomationConnectRpc, WsPreviewAutomationRespondRpc, WsPreviewAutomationFocusHostRpc, WsSubscribePreviewEventsRpc, WsSubscribeDiscoveredLocalServersRpc, make$51(WS_METHODS.subscribeServerConfig, {
|
|
23662
23663
|
payload: Struct({}),
|
|
23663
23664
|
success: ServerConfigStreamEvent,
|
|
23664
23665
|
error: Union([
|
|
@@ -23667,22 +23668,22 @@ const WsRpcGroup = make$47(WsServerProbeRpc, WsServerGetConfigRpc, WsServerRefre
|
|
|
23667
23668
|
EnvironmentAuthorizationError
|
|
23668
23669
|
]),
|
|
23669
23670
|
stream: true
|
|
23670
|
-
}), make$
|
|
23671
|
+
}), make$51(WS_METHODS.subscribeServerLifecycle, {
|
|
23671
23672
|
payload: Struct({}),
|
|
23672
23673
|
success: ServerLifecycleStreamEvent,
|
|
23673
23674
|
error: EnvironmentAuthorizationError,
|
|
23674
23675
|
stream: true
|
|
23675
|
-
}), make$
|
|
23676
|
+
}), make$51(WS_METHODS.subscribeAuthAccess, {
|
|
23676
23677
|
payload: Struct({}),
|
|
23677
23678
|
success: AuthAccessStreamEvent,
|
|
23678
23679
|
error: Union([AuthAccessStreamError, EnvironmentAuthorizationError]),
|
|
23679
23680
|
stream: true
|
|
23680
|
-
}), make$
|
|
23681
|
+
}), make$51(WS_METHODS.subscribeBackgroundPolicy, {
|
|
23681
23682
|
payload: Struct({}),
|
|
23682
23683
|
success: BackgroundPolicySnapshot,
|
|
23683
23684
|
error: EnvironmentAuthorizationError,
|
|
23684
23685
|
stream: true
|
|
23685
|
-
}), make$
|
|
23686
|
+
}), make$51(WS_METHODS.subscribeResourceTelemetry, {
|
|
23686
23687
|
payload: Struct({}),
|
|
23687
23688
|
success: ResourceTelemetrySnapshot,
|
|
23688
23689
|
error: EnvironmentAuthorizationError,
|
|
@@ -23750,8 +23751,8 @@ var ServerConfig = class extends Service$2()("t3/config/ServerConfig") {
|
|
|
23750
23751
|
/** @deprecated Import and use `layerTest` from this module. */
|
|
23751
23752
|
static layerTest = (cwd, baseDirOrPrefix) => layerTest$2(cwd, baseDirOrPrefix);
|
|
23752
23753
|
};
|
|
23753
|
-
const make$
|
|
23754
|
-
const layer$
|
|
23754
|
+
const make$49 = (config) => ServerConfig.of(config);
|
|
23755
|
+
const layer$39 = (config) => succeed$3(ServerConfig, make$49(config));
|
|
23755
23756
|
const deriveServerPaths = fn(function* (baseDir, devUrl, options = {}) {
|
|
23756
23757
|
const { join } = yield* Path;
|
|
23757
23758
|
const stateDir = join(baseDir, devUrl !== void 0 && !options.baseDirIsExplicit ? "dev" : "userdata");
|
|
@@ -23947,7 +23948,7 @@ function deriveAuthClientMetadata(input) {
|
|
|
23947
23948
|
//#endregion
|
|
23948
23949
|
//#region src/auth/EnvironmentAuthPolicy.ts
|
|
23949
23950
|
var EnvironmentAuthPolicy = class extends Service$2()("t3/auth/EnvironmentAuthPolicy") {};
|
|
23950
|
-
const layer$
|
|
23951
|
+
const layer$38 = effect(EnvironmentAuthPolicy, gen(function* () {
|
|
23951
23952
|
const config = yield* ServerConfig;
|
|
23952
23953
|
const isRemoteReachable = isRemoteReachableHost(config.host);
|
|
23953
23954
|
const policy = config.mode === "desktop" ? isRemoteReachable ? "remote-reachable" : "desktop-managed-local" : isRemoteReachable ? "remote-reachable" : "loopback-browser";
|
|
@@ -24159,7 +24160,7 @@ function toPersistenceSqlOrDecodeError$6(sqlOperation, decodeOperation, correlat
|
|
|
24159
24160
|
cause
|
|
24160
24161
|
});
|
|
24161
24162
|
}
|
|
24162
|
-
const layer$
|
|
24163
|
+
const layer$37 = effect(AuthPairingLinkRepository, gen(function* () {
|
|
24163
24164
|
const sql = yield* SqlClient;
|
|
24164
24165
|
const createPairingLinkRow = void_({
|
|
24165
24166
|
Request: CreateAuthPairingLinkInput,
|
|
@@ -24387,11 +24388,11 @@ const DEV_STARTUP_TTL_HOURS = hours(24);
|
|
|
24387
24388
|
const PAIRING_TOKEN_ALPHABET = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
24388
24389
|
const PAIRING_TOKEN_LENGTH = 12;
|
|
24389
24390
|
const PAIRING_TOKEN_REJECTION_LIMIT = Math.floor(256 / 32) * 32;
|
|
24390
|
-
const layer$
|
|
24391
|
+
const layer$36 = effect(PairingGrantStore, gen(function* () {
|
|
24391
24392
|
const crypto = yield* Crypto;
|
|
24392
24393
|
const config = yield* ServerConfig;
|
|
24393
24394
|
const pairingLinks = yield* AuthPairingLinkRepository;
|
|
24394
|
-
const seededGrantsRef = yield* make$
|
|
24395
|
+
const seededGrantsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
24395
24396
|
const changesPubSub = yield* unbounded$1();
|
|
24396
24397
|
const generatePairingToken = gen(function* () {
|
|
24397
24398
|
let credential = "";
|
|
@@ -24422,18 +24423,18 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24422
24423
|
id
|
|
24423
24424
|
}).pipe(asVoid);
|
|
24424
24425
|
if (config.desktopBootstrapToken) {
|
|
24425
|
-
const now
|
|
24426
|
+
const now = yield* now$1;
|
|
24426
24427
|
yield* seedGrant(config.desktopBootstrapToken, {
|
|
24427
24428
|
method: "desktop-bootstrap",
|
|
24428
24429
|
scopes: AuthAdministrativeScopes,
|
|
24429
24430
|
subject: "desktop-bootstrap",
|
|
24430
|
-
expiresAt: add$3(now
|
|
24431
|
+
expiresAt: add$3(now, { milliseconds: toMillis(DESKTOP_BOOTSTRAP_TTL_HOURS) }),
|
|
24431
24432
|
remainingUses: "unbounded"
|
|
24432
24433
|
});
|
|
24433
24434
|
}
|
|
24434
24435
|
const listActive = fn("PairingGrantStore.listActive")(function* () {
|
|
24435
|
-
const now
|
|
24436
|
-
return (yield* pairingLinks.listActive({ now
|
|
24436
|
+
const now = yield* now$1;
|
|
24437
|
+
return (yield* pairingLinks.listActive({ now })).map((row) => row.label ? {
|
|
24437
24438
|
id: row.id,
|
|
24438
24439
|
credential: row.credential,
|
|
24439
24440
|
scopes: row.scopes,
|
|
@@ -24451,7 +24452,7 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24451
24452
|
});
|
|
24452
24453
|
}, mapError((cause) => new ActivePairingLinksLoadError({ cause })));
|
|
24453
24454
|
const revoke = fn("PairingGrantStore.revoke")(function* (id) {
|
|
24454
|
-
const revokedAt = yield* now;
|
|
24455
|
+
const revokedAt = yield* now$1;
|
|
24455
24456
|
const revoked = yield* pairingLinks.revoke({
|
|
24456
24457
|
id,
|
|
24457
24458
|
revokedAt
|
|
@@ -24470,8 +24471,8 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24470
24471
|
const credential = yield* generatePairingToken;
|
|
24471
24472
|
const isDevStartupToken = config.devUrl !== void 0 && input?.purpose === "startup";
|
|
24472
24473
|
const ttl = input?.ttl ?? (isDevStartupToken ? DEV_STARTUP_TTL_HOURS : DEFAULT_ONE_TIME_TOKEN_TTL_MINUTES);
|
|
24473
|
-
const now
|
|
24474
|
-
const expiresAt = add$3(now
|
|
24474
|
+
const now = yield* now$1;
|
|
24475
|
+
const expiresAt = add$3(now, { milliseconds: toMillis(ttl) });
|
|
24475
24476
|
const issued = {
|
|
24476
24477
|
id,
|
|
24477
24478
|
credential,
|
|
@@ -24488,7 +24489,7 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24488
24489
|
subject,
|
|
24489
24490
|
label: input?.label ?? null,
|
|
24490
24491
|
proofKeyThumbprint: input?.proofKeyThumbprint ?? null,
|
|
24491
|
-
createdAt: now
|
|
24492
|
+
createdAt: now,
|
|
24492
24493
|
expiresAt
|
|
24493
24494
|
}).pipe(mapError((cause) => new PairingCredentialIssueError({
|
|
24494
24495
|
pairingLinkId: id,
|
|
@@ -24502,13 +24503,13 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24502
24503
|
scopes: input?.scopes ?? AuthStandardClientScopes,
|
|
24503
24504
|
subject: input?.subject ?? "one-time-token",
|
|
24504
24505
|
...input?.label ? { label: input.label } : {},
|
|
24505
|
-
createdAt: now
|
|
24506
|
+
createdAt: now,
|
|
24506
24507
|
expiresAt
|
|
24507
24508
|
});
|
|
24508
24509
|
return issued;
|
|
24509
24510
|
});
|
|
24510
24511
|
const consume = fn("PairingGrantStore.consume")(function* (credential, input) {
|
|
24511
|
-
const now
|
|
24512
|
+
const now = yield* now$1;
|
|
24512
24513
|
const seededResult = yield* modify$2(seededGrantsRef, (current) => {
|
|
24513
24514
|
const grant = current.get(credential);
|
|
24514
24515
|
if (!grant) return [{
|
|
@@ -24517,7 +24518,7 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24517
24518
|
error: new UnknownBootstrapCredentialError({})
|
|
24518
24519
|
}, current];
|
|
24519
24520
|
const next = new Map(current);
|
|
24520
|
-
if (isGreaterThanOrEqualTo$1(now
|
|
24521
|
+
if (isGreaterThanOrEqualTo$1(now, grant.expiresAt)) {
|
|
24521
24522
|
next.delete(credential);
|
|
24522
24523
|
return [{
|
|
24523
24524
|
_tag: "error",
|
|
@@ -24553,8 +24554,8 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24553
24554
|
const consumed = yield* pairingLinks.consumeAvailable({
|
|
24554
24555
|
credential,
|
|
24555
24556
|
proofKeyThumbprint: input?.proofKeyThumbprint ?? null,
|
|
24556
|
-
consumedAt: now
|
|
24557
|
-
now
|
|
24557
|
+
consumedAt: now,
|
|
24558
|
+
now
|
|
24558
24559
|
}).pipe(mapError((cause) => new BootstrapCredentialConsumeAvailableError({ cause })));
|
|
24559
24560
|
if (isSome(consumed)) {
|
|
24560
24561
|
yield* emitRemoved(consumed.value.id);
|
|
@@ -24571,7 +24572,7 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24571
24572
|
if (isNone(matching)) return yield* new UnknownBootstrapCredentialError({});
|
|
24572
24573
|
if (matching.value.revokedAt !== null) return yield* new UnavailableBootstrapCredentialError({});
|
|
24573
24574
|
if (matching.value.consumedAt !== null) return yield* new UnknownBootstrapCredentialError({});
|
|
24574
|
-
if (isGreaterThanOrEqualTo$1(now
|
|
24575
|
+
if (isGreaterThanOrEqualTo$1(now, matching.value.expiresAt)) return yield* new ExpiredBootstrapCredentialError({});
|
|
24575
24576
|
if (matching.value.proofKeyThumbprint !== null && matching.value.proofKeyThumbprint !== input?.proofKeyThumbprint) return yield* new BootstrapCredentialProofKeyMismatchError({});
|
|
24576
24577
|
return yield* new UnavailableBootstrapCredentialError({});
|
|
24577
24578
|
});
|
|
@@ -24584,7 +24585,7 @@ const layer$33 = effect(PairingGrantStore, gen(function* () {
|
|
|
24584
24585
|
revoke,
|
|
24585
24586
|
consume
|
|
24586
24587
|
});
|
|
24587
|
-
})).pipe(provideMerge(layer$
|
|
24588
|
+
})).pipe(provideMerge(layer$37));
|
|
24588
24589
|
//#endregion
|
|
24589
24590
|
//#region src/auth/ServerSecretStore.ts
|
|
24590
24591
|
const secretStoreErrorContext = {
|
|
@@ -24650,7 +24651,7 @@ const isSecretStoreError = is(Union([
|
|
|
24650
24651
|
const isPlatformError = (value) => isTagged(value, "PlatformError");
|
|
24651
24652
|
const isSecretAlreadyExistsError = (error) => "cause" in error && isPlatformError(error.cause) && error.cause.reason._tag === "AlreadyExists";
|
|
24652
24653
|
var ServerSecretStore = class extends Service$2()("t3/auth/ServerSecretStore") {};
|
|
24653
|
-
const layer$
|
|
24654
|
+
const layer$35 = effect(ServerSecretStore, gen(function* () {
|
|
24654
24655
|
const crypto = yield* Crypto;
|
|
24655
24656
|
const fileSystem = yield* FileSystem;
|
|
24656
24657
|
const path = yield* Path;
|
|
@@ -24831,7 +24832,7 @@ function toPersistenceSqlOrDecodeError$5(sqlOperation, decodeOperation, correlat
|
|
|
24831
24832
|
cause
|
|
24832
24833
|
});
|
|
24833
24834
|
}
|
|
24834
|
-
const layer$
|
|
24835
|
+
const layer$34 = effect(AuthSessionRepository, gen(function* () {
|
|
24835
24836
|
const sql = yield* SqlClient;
|
|
24836
24837
|
const createSessionRow = void_({
|
|
24837
24838
|
Request: CreateAuthSessionInput,
|
|
@@ -25197,13 +25198,13 @@ function toAuthClientSession(input) {
|
|
|
25197
25198
|
current: false
|
|
25198
25199
|
};
|
|
25199
25200
|
}
|
|
25200
|
-
const layer$
|
|
25201
|
+
const layer$33 = effect(SessionStore, gen(function* () {
|
|
25201
25202
|
const crypto = yield* Crypto;
|
|
25202
25203
|
const serverConfig = yield* ServerConfig;
|
|
25203
25204
|
const secretStore = yield* ServerSecretStore;
|
|
25204
25205
|
const authSessions = yield* AuthSessionRepository;
|
|
25205
25206
|
const signingSecret = yield* secretStore.getOrCreateRandom(SIGNING_SECRET_NAME$1, 32);
|
|
25206
|
-
const connectedSessionsRef = yield* make$
|
|
25207
|
+
const connectedSessionsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
25207
25208
|
const changesPubSub = yield* unbounded$1();
|
|
25208
25209
|
const cookieName = resolveSessionCookieName({
|
|
25209
25210
|
mode: serverConfig.mode,
|
|
@@ -25241,7 +25242,7 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25241
25242
|
const wasDisconnected = !next.has(sessionId);
|
|
25242
25243
|
next.set(sessionId, (next.get(sessionId) ?? 0) + 1);
|
|
25243
25244
|
return [wasDisconnected, next];
|
|
25244
|
-
}).pipe(flatMap$1((wasDisconnected) => wasDisconnected ? now.pipe(flatMap$1((lastConnectedAt) => authSessions.setLastConnectedAt({
|
|
25245
|
+
}).pipe(flatMap$1((wasDisconnected) => wasDisconnected ? now$1.pipe(flatMap$1((lastConnectedAt) => authSessions.setLastConnectedAt({
|
|
25245
25246
|
sessionId,
|
|
25246
25247
|
lastConnectedAt
|
|
25247
25248
|
}))) : void_$1), flatMap$1(() => loadActiveSession(sessionId)), flatMap$1((session) => isSome(session) ? emitUpsert(session.value) : void_$1), catchCause((cause) => logError("Failed to publish connected-session auth update.").pipe(annotateLogs({
|
|
@@ -25261,7 +25262,7 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25261
25262
|
const encodeClaims = encodeEffect(fromJsonString(SessionClaims));
|
|
25262
25263
|
const issue = fn("SessionStore.issue")(function* (input) {
|
|
25263
25264
|
const sessionId = AuthSessionId.make(yield* crypto.randomUUIDv4.pipe(mapError((cause) => new SessionCredentialIssueError({ cause }))));
|
|
25264
|
-
const issuedAt = yield* now;
|
|
25265
|
+
const issuedAt = yield* now$1;
|
|
25265
25266
|
const expiresAt = add$3(issuedAt, { milliseconds: toMillis(input?.ttl ?? DEFAULT_SESSION_TTL) });
|
|
25266
25267
|
const claims = {
|
|
25267
25268
|
v: 1,
|
|
@@ -25329,8 +25330,8 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25329
25330
|
if (!encodedPayload || !signature) return yield* new MalformedSessionTokenError({});
|
|
25330
25331
|
if (!timingSafeEqualBase64Url(signature, signPayload(encodedPayload, signingSecret))) return yield* new InvalidSessionTokenSignatureError({});
|
|
25331
25332
|
const claims = yield* decodeSessionClaims(base64UrlDecodeUtf8(encodedPayload)).pipe(mapError((cause) => new InvalidSessionTokenPayloadError({ cause })));
|
|
25332
|
-
const observedAt = yield* now;
|
|
25333
|
-
const expiresAt = make$
|
|
25333
|
+
const observedAt = yield* now$1;
|
|
25334
|
+
const expiresAt = make$71(claims.exp);
|
|
25334
25335
|
if (isNone(expiresAt)) return yield* new InvalidSessionExpirationClaimError({
|
|
25335
25336
|
sessionId: claims.sid,
|
|
25336
25337
|
expirationClaim: claims.exp
|
|
@@ -25362,7 +25363,7 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25362
25363
|
});
|
|
25363
25364
|
const encodeWsClaims = encodeEffect(fromJsonString(WebSocketClaims));
|
|
25364
25365
|
const issueWebSocketToken = fn("SessionStore.issueWebSocketToken")(function* (sessionId, input) {
|
|
25365
|
-
const issuedAt = yield* now;
|
|
25366
|
+
const issuedAt = yield* now$1;
|
|
25366
25367
|
const expiresAt = add$3(issuedAt, { milliseconds: toMillis(input?.ttl ?? DEFAULT_WEBSOCKET_TOKEN_TTL) });
|
|
25367
25368
|
const claims = {
|
|
25368
25369
|
v: 1,
|
|
@@ -25389,8 +25390,8 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25389
25390
|
if (!encodedPayload || !signature) return yield* new MalformedWebSocketTokenError({});
|
|
25390
25391
|
if (!timingSafeEqualBase64Url(signature, signPayload(encodedPayload, signingSecret))) return yield* new InvalidWebSocketTokenSignatureError({});
|
|
25391
25392
|
const claims = yield* decodeWebSocketClaims(base64UrlDecodeUtf8(encodedPayload)).pipe(mapError((cause) => new InvalidWebSocketTokenPayloadError({ cause })));
|
|
25392
|
-
const observedAt = yield* now;
|
|
25393
|
-
const expiresAt = make$
|
|
25393
|
+
const observedAt = yield* now$1;
|
|
25394
|
+
const expiresAt = make$71(claims.exp);
|
|
25394
25395
|
if (isNone(expiresAt)) return yield* new InvalidSessionExpirationClaimError({
|
|
25395
25396
|
sessionId: claims.sid,
|
|
25396
25397
|
expirationClaim: claims.exp
|
|
@@ -25425,9 +25426,9 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25425
25426
|
};
|
|
25426
25427
|
});
|
|
25427
25428
|
const listActive = fn("SessionStore.listActive")(function* () {
|
|
25428
|
-
const now
|
|
25429
|
+
const now = yield* now$1;
|
|
25429
25430
|
const connectedSessions = yield* get$3(connectedSessionsRef);
|
|
25430
|
-
return (yield* authSessions.listActive({ now
|
|
25431
|
+
return (yield* authSessions.listActive({ now })).map((row) => toAuthClientSession({
|
|
25431
25432
|
sessionId: row.sessionId,
|
|
25432
25433
|
subject: row.subject,
|
|
25433
25434
|
scopes: row.scopes,
|
|
@@ -25440,7 +25441,7 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25440
25441
|
}));
|
|
25441
25442
|
}, mapError((cause) => new ActiveSessionsListError({ cause })));
|
|
25442
25443
|
const revoke = fn("SessionStore.revoke")(function* (sessionId) {
|
|
25443
|
-
const revokedAt = yield* now;
|
|
25444
|
+
const revokedAt = yield* now$1;
|
|
25444
25445
|
const revoked = yield* authSessions.revoke({
|
|
25445
25446
|
sessionId,
|
|
25446
25447
|
revokedAt
|
|
@@ -25459,7 +25460,7 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25459
25460
|
return revoked;
|
|
25460
25461
|
});
|
|
25461
25462
|
const revokeAllExcept = fn("SessionStore.revokeAllExcept")(function* (sessionId) {
|
|
25462
|
-
const revokedAt = yield* now;
|
|
25463
|
+
const revokedAt = yield* now$1;
|
|
25463
25464
|
const revokedSessionIds = yield* authSessions.revokeAllExcept({
|
|
25464
25465
|
currentSessionId: sessionId,
|
|
25465
25466
|
revokedAt
|
|
@@ -25495,7 +25496,7 @@ const layer$30 = effect(SessionStore, gen(function* () {
|
|
|
25495
25496
|
markConnected,
|
|
25496
25497
|
markDisconnected
|
|
25497
25498
|
});
|
|
25498
|
-
})).pipe(provideMerge(layer$
|
|
25499
|
+
})).pipe(provideMerge(layer$34));
|
|
25499
25500
|
//#endregion
|
|
25500
25501
|
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/cryptoNode.js
|
|
25501
25502
|
/**
|
|
@@ -28246,12 +28247,12 @@ const verifyRequestDpopProof = (input) => gen(function* () {
|
|
|
28246
28247
|
const proof = input.request.headers.dpop;
|
|
28247
28248
|
const url = toURL(input.request);
|
|
28248
28249
|
if (isNone(url)) return yield* new ServerAuthInvalidCredentialError({ diagnostic: "Invalid DPoP request URL." });
|
|
28249
|
-
const now
|
|
28250
|
+
const now = yield* now$1;
|
|
28250
28251
|
const result = verifyDpopProof({
|
|
28251
28252
|
proof,
|
|
28252
28253
|
method: input.request.method,
|
|
28253
28254
|
url: url.value.href,
|
|
28254
|
-
nowEpochSeconds: Math.floor(now
|
|
28255
|
+
nowEpochSeconds: Math.floor(now.epochMilliseconds / 1e3),
|
|
28255
28256
|
...input.expectedThumbprint ? { expectedThumbprint: input.expectedThumbprint } : {},
|
|
28256
28257
|
...input.expectedAccessToken ? { expectedAccessToken: input.expectedAccessToken } : {}
|
|
28257
28258
|
});
|
|
@@ -28262,7 +28263,7 @@ const verifyRequestDpopProof = (input) => gen(function* () {
|
|
|
28262
28263
|
`thumbprint=${result.thumbprint}`,
|
|
28263
28264
|
`jti=${result.jti}`,
|
|
28264
28265
|
`iat=${result.iat}`,
|
|
28265
|
-
`consumedAt=${formatIso(now
|
|
28266
|
+
`consumedAt=${formatIso(now)}`
|
|
28266
28267
|
].join("\n"))).pipe(catchIf(isSecretStoreError, (error) => fail(mapDpopReplayStoreError(error))));
|
|
28267
28268
|
return result.thumbprint;
|
|
28268
28269
|
});
|
|
@@ -28281,7 +28282,7 @@ var MigrationError = class extends TaggedError("MigrationError") {};
|
|
|
28281
28282
|
* @category constructors
|
|
28282
28283
|
* @since 4.0.0
|
|
28283
28284
|
*/
|
|
28284
|
-
const make$
|
|
28285
|
+
const make$42 = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory, table = "effect_sql_migrations" }) => gen(function* () {
|
|
28285
28286
|
const sql = yield* SqlClient;
|
|
28286
28287
|
const ensureMigrationsTable = sql.onDialectOrElse({
|
|
28287
28288
|
mssql: () => sql`IF OBJECT_ID(N'${sql.literal(table)}', N'U') IS NULL
|
|
@@ -28370,7 +28371,7 @@ const make$39 = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory,
|
|
|
28370
28371
|
if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause((cause) => logInfo("Could not dump schema", cause)));
|
|
28371
28372
|
return completed;
|
|
28372
28373
|
});
|
|
28373
|
-
const migrationOrder = /*#__PURE__*/ make$
|
|
28374
|
+
const migrationOrder = /*#__PURE__*/ make$72(([a], [b]) => Number$2(a, b));
|
|
28374
28375
|
const isConstraintConflict = (error) => error.reason._tag === "ConstraintError" || error.reason._tag === "UniqueViolation";
|
|
28375
28376
|
/**
|
|
28376
28377
|
* Creates a migration loader from a record of migration effects keyed by
|
|
@@ -29937,7 +29938,7 @@ const makeMigrationLoader = (throughId) => fromRecord(Object.fromEntries(migrati
|
|
|
29937
29938
|
* Migrator run function - no schema dumping needed
|
|
29938
29939
|
* Uses the base Migrator.make without platform dependencies
|
|
29939
29940
|
*/
|
|
29940
|
-
const run = make$
|
|
29941
|
+
const run = make$42({});
|
|
29941
29942
|
/**
|
|
29942
29943
|
* Run all pending migrations.
|
|
29943
29944
|
*
|
|
@@ -29959,7 +29960,7 @@ effectDiscard(runMigrations());
|
|
|
29959
29960
|
//#region src/persistence/Layers/Sqlite.ts
|
|
29960
29961
|
const defaultSqliteClientLoaders = {
|
|
29961
29962
|
bun: () => import("@effect/sql-sqlite-bun/SqliteClient"),
|
|
29962
|
-
node: () => import("./NodeSqliteClient-
|
|
29963
|
+
node: () => import("./NodeSqliteClient-FfrElFAX.mjs")
|
|
29963
29964
|
};
|
|
29964
29965
|
const makeRuntimeSqliteLayer = fn("makeRuntimeSqliteLayer")(function* (config) {
|
|
29965
29966
|
const runtime = process.versions.bun !== void 0 ? "bun" : "node";
|
|
@@ -30184,7 +30185,7 @@ function parseDpopToken(request) {
|
|
|
30184
30185
|
const token = header.slice(5).trim();
|
|
30185
30186
|
return token.length > 0 ? token : null;
|
|
30186
30187
|
}
|
|
30187
|
-
const layer$
|
|
30188
|
+
const layer$32 = effect(EnvironmentAuth, gen(function* () {
|
|
30188
30189
|
const policy = yield* EnvironmentAuthPolicy;
|
|
30189
30190
|
const bootstrapCredentials = yield* PairingGrantStore;
|
|
30190
30191
|
const sessions = yield* SessionStore;
|
|
@@ -30261,7 +30262,7 @@ const layer$29 = effect(EnvironmentAuth, gen(function* () {
|
|
|
30261
30262
|
...grant.label ? { label: grant.label } : {}
|
|
30262
30263
|
}
|
|
30263
30264
|
}).pipe(mapError((cause) => new ServerAuthAuthenticatedAccessTokenIssueError({ cause })));
|
|
30264
|
-
})), flatMap$1((session) => now.pipe(map$4((now) => ({
|
|
30265
|
+
})), flatMap$1((session) => now$1.pipe(map$4((now) => ({
|
|
30265
30266
|
access_token: session.token,
|
|
30266
30267
|
issued_token_type: AuthAccessTokenType,
|
|
30267
30268
|
token_type: input?.proofKeyThumbprint ? "DPoP" : "Bearer",
|
|
@@ -30280,7 +30281,7 @@ const layer$29 = effect(EnvironmentAuth, gen(function* () {
|
|
|
30280
30281
|
expiresAt: issued.expiresAt
|
|
30281
30282
|
})));
|
|
30282
30283
|
const createPairingLink = fn("EnvironmentAuth.createPairingLink")(function* (input) {
|
|
30283
|
-
const createdAt = yield* now;
|
|
30284
|
+
const createdAt = yield* now$1;
|
|
30284
30285
|
const issued = yield* bootstrapCredentials.issueOneTimeToken({
|
|
30285
30286
|
scopes: input?.scopes ?? AuthStandardClientScopes,
|
|
30286
30287
|
subject: input?.subject ?? "one-time-token",
|
|
@@ -30392,9 +30393,9 @@ const layer$29 = effect(EnvironmentAuth, gen(function* () {
|
|
|
30392
30393
|
issueWebSocketTicket,
|
|
30393
30394
|
issueStartupPairingUrl
|
|
30394
30395
|
});
|
|
30395
|
-
})).pipe(provideMerge(layer$
|
|
30396
|
-
const storageLayer = mergeAll(layer$
|
|
30397
|
-
const runtimeLayer = layer$
|
|
30396
|
+
})).pipe(provideMerge(layer$36), provideMerge(layer$33), provideMerge(layer$38));
|
|
30397
|
+
const storageLayer = mergeAll(layer$35, layerConfig);
|
|
30398
|
+
const runtimeLayer = layer$32.pipe(provideMerge(storageLayer));
|
|
30398
30399
|
//#endregion
|
|
30399
30400
|
//#region src/cliAuthFormat.ts
|
|
30400
30401
|
const newline = "\n";
|
|
@@ -31791,7 +31792,7 @@ const runWithEnvironmentAuth = (flags, run, options) => gen(function* () {
|
|
|
31791
31792
|
const minimumLogLevel = options?.quietLogs ? "Error" : config.logLevel;
|
|
31792
31793
|
return yield* gen(function* () {
|
|
31793
31794
|
return yield* run(yield* EnvironmentAuth);
|
|
31794
|
-
}).pipe(provide$1(mergeAll(runtimeLayer).pipe(provide(layer$
|
|
31795
|
+
}).pipe(provide$1(mergeAll(runtimeLayer).pipe(provide(layer$39(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)))));
|
|
31795
31796
|
});
|
|
31796
31797
|
const ttlFlag$1 = string("ttl").pipe(withSchema(DurationFromString), withDescription$1("TTL, for example `5m`, `1h`, `30d`, or `15 minutes`."), optional);
|
|
31797
31798
|
const jsonFlag = boolean("json").pipe(withDescription$1("Emit JSON instead of human-readable output."), withDefault(false));
|
|
@@ -31799,7 +31800,7 @@ const labelFlag$1 = string("label").pipe(withDescription$1("Optional human-reada
|
|
|
31799
31800
|
const subjectFlag = string("subject").pipe(withDescription$1("Optional session subject."), optional);
|
|
31800
31801
|
const baseUrlFlag = string("base-url").pipe(withDescription$1("Optional public base URL used to print a ready `/pair#token=...` link."), optional);
|
|
31801
31802
|
const tokenOnlyFlag = boolean("token-only").pipe(withDescription$1("Print only the issued bearer token."), withDefault(false));
|
|
31802
|
-
const pairingCreateCommand = make$
|
|
31803
|
+
const pairingCreateCommand = make$62("create", {
|
|
31803
31804
|
...authLocationFlags,
|
|
31804
31805
|
ttl: ttlFlag$1,
|
|
31805
31806
|
label: labelFlag$1,
|
|
@@ -31817,26 +31818,26 @@ const pairingCreateCommand = make$59("create", {
|
|
|
31817
31818
|
});
|
|
31818
31819
|
yield* log(output);
|
|
31819
31820
|
}), { quietLogs: flags.json })));
|
|
31820
|
-
const pairingListCommand = make$
|
|
31821
|
+
const pairingListCommand = make$62("list", {
|
|
31821
31822
|
...authLocationFlags,
|
|
31822
31823
|
json: jsonFlag
|
|
31823
31824
|
}).pipe(withDescription("List active client pairing tokens without revealing their secrets."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
|
|
31824
31825
|
const pairingLinks = yield* environmentAuth.listPairingLinks({ excludeSubjects: [INTERNAL_ADMINISTRATIVE_BOOTSTRAP_SUBJECT] });
|
|
31825
31826
|
yield* log(formatPairingCredentialList(pairingLinks, { json: flags.json }));
|
|
31826
31827
|
}), { quietLogs: flags.json })));
|
|
31827
|
-
const pairingRevokeCommand = make$
|
|
31828
|
+
const pairingRevokeCommand = make$62("revoke", {
|
|
31828
31829
|
...authLocationFlags,
|
|
31829
31830
|
id: string$1("id").pipe(withDescription$2("Pairing credential id to revoke."))
|
|
31830
31831
|
}).pipe(withDescription("Revoke an active client pairing token."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
|
|
31831
31832
|
const revoked = yield* environmentAuth.revokePairingLink(flags.id);
|
|
31832
31833
|
yield* log(revoked ? `Revoked pairing credential ${flags.id}.\n` : `No active pairing credential found for ${flags.id}.\n`);
|
|
31833
31834
|
}))));
|
|
31834
|
-
const pairingCommand = make$
|
|
31835
|
+
const pairingCommand = make$62("pairing").pipe(withDescription("Manage one-time client pairing tokens."), withSubcommands([
|
|
31835
31836
|
pairingCreateCommand,
|
|
31836
31837
|
pairingListCommand,
|
|
31837
31838
|
pairingRevokeCommand
|
|
31838
31839
|
]));
|
|
31839
|
-
const sessionIssueCommand = make$
|
|
31840
|
+
const sessionIssueCommand = make$62("issue", {
|
|
31840
31841
|
...authLocationFlags,
|
|
31841
31842
|
ttl: ttlFlag$1,
|
|
31842
31843
|
label: labelFlag$1,
|
|
@@ -31855,26 +31856,26 @@ const sessionIssueCommand = make$59("issue", {
|
|
|
31855
31856
|
tokenOnly: flags.tokenOnly
|
|
31856
31857
|
}));
|
|
31857
31858
|
}), { quietLogs: flags.json || flags.tokenOnly })));
|
|
31858
|
-
const sessionListCommand = make$
|
|
31859
|
+
const sessionListCommand = make$62("list", {
|
|
31859
31860
|
...authLocationFlags,
|
|
31860
31861
|
json: jsonFlag
|
|
31861
31862
|
}).pipe(withDescription("List active sessions without revealing bearer tokens."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
|
|
31862
31863
|
const sessions = yield* environmentAuth.listSessions();
|
|
31863
31864
|
yield* log(formatSessionList(sessions, { json: flags.json }));
|
|
31864
31865
|
}), { quietLogs: flags.json })));
|
|
31865
|
-
const sessionRevokeCommand = make$
|
|
31866
|
+
const sessionRevokeCommand = make$62("revoke", {
|
|
31866
31867
|
...authLocationFlags,
|
|
31867
31868
|
sessionId: string$1("session-id").pipe(withDescription$2("Session id to revoke."), withSchema$1(AuthSessionId))
|
|
31868
31869
|
}).pipe(withDescription("Revoke an active session."), withHandler((flags) => runWithEnvironmentAuth(flags, (environmentAuth) => gen(function* () {
|
|
31869
31870
|
const revoked = yield* environmentAuth.revokeSession(flags.sessionId);
|
|
31870
31871
|
yield* log(revoked ? `Revoked session ${flags.sessionId}.\n` : `No active session found for ${flags.sessionId}.\n`);
|
|
31871
31872
|
}))));
|
|
31872
|
-
const sessionCommand = make$
|
|
31873
|
+
const sessionCommand = make$62("session").pipe(withDescription("Manage bearer sessions."), withSubcommands([
|
|
31873
31874
|
sessionIssueCommand,
|
|
31874
31875
|
sessionListCommand,
|
|
31875
31876
|
sessionRevokeCommand
|
|
31876
31877
|
]));
|
|
31877
|
-
const authCommand = make$
|
|
31878
|
+
const authCommand = make$62("auth").pipe(withDescription("Manage the local auth control plane for headless deployments."), withSubcommands([pairingCommand, sessionCommand]));
|
|
31878
31879
|
//#endregion
|
|
31879
31880
|
//#region ../t3-shared/src/devHome.ts
|
|
31880
31881
|
/**
|
|
@@ -32062,7 +32063,7 @@ const readTailscaleStatus = gen(function* () {
|
|
|
32062
32063
|
argumentCount: args.length
|
|
32063
32064
|
};
|
|
32064
32065
|
return yield* gen(function* () {
|
|
32065
|
-
const child = yield* spawner.spawn(make$
|
|
32066
|
+
const child = yield* spawner.spawn(make$79(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
|
|
32066
32067
|
...commandContext,
|
|
32067
32068
|
cause
|
|
32068
32069
|
})));
|
|
@@ -32106,7 +32107,7 @@ const runTailscaleCommand = (args, timeoutInput) => gen(function* () {
|
|
|
32106
32107
|
};
|
|
32107
32108
|
const timeout$1 = fromInputUnsafe(timeoutInput);
|
|
32108
32109
|
return yield* gen(function* () {
|
|
32109
|
-
const child = yield* spawner.spawn(make$
|
|
32110
|
+
const child = yield* spawner.spawn(make$79(executable, args)).pipe(mapError((cause) => new TailscaleCommandSpawnError({
|
|
32110
32111
|
...commandContext,
|
|
32111
32112
|
cause
|
|
32112
32113
|
})));
|
|
@@ -33121,7 +33122,7 @@ const decodePersistedServerRuntimeState = decodeUnknownEffect(fromJsonString(Per
|
|
|
33121
33122
|
const runtimeOriginForConfig = (config, port) => {
|
|
33122
33123
|
return `http://${config.host && !isWildcardHost(config.host) ? formatHostForUrl(config.host) : "127.0.0.1"}:${port}`;
|
|
33123
33124
|
};
|
|
33124
|
-
const makePersistedServerRuntimeState = (input) => map$4(now, (now) => ({
|
|
33125
|
+
const makePersistedServerRuntimeState = (input) => map$4(now$1, (now) => ({
|
|
33125
33126
|
version: 1,
|
|
33126
33127
|
pid: process.pid,
|
|
33127
33128
|
...input.config.host ? { host: input.config.host } : {},
|
|
@@ -33323,7 +33324,7 @@ const makePairServerConfig = fn(function* (input) {
|
|
|
33323
33324
|
const { baseDir, variant, state } = input.target;
|
|
33324
33325
|
const devUrl = state.devUrl !== void 0 ? new URL(state.devUrl) : void 0;
|
|
33325
33326
|
const derivedPaths = yield* deriveServerPaths(baseDir, variant === "dev" ? DEV_VARIANT_PLACEHOLDER_URL : void 0, {});
|
|
33326
|
-
return make$
|
|
33327
|
+
return make$49({
|
|
33327
33328
|
logLevel: input.logLevel,
|
|
33328
33329
|
traceMinLevel: "Info",
|
|
33329
33330
|
traceTimingEnabled: false,
|
|
@@ -33409,9 +33410,9 @@ const mintPairingLink = fn("pair.mintPairingLink")(function* (input) {
|
|
|
33409
33410
|
label: getOrElse(input.label, () => "t3 pair"),
|
|
33410
33411
|
...isSome(input.ttl) ? { ttl: input.ttl.value } : {}
|
|
33411
33412
|
});
|
|
33412
|
-
}).pipe(provide$1(runtimeLayer.pipe(provide(layer$
|
|
33413
|
+
}).pipe(provide$1(runtimeLayer.pipe(provide(layer$39(input.config)), provide(succeed$3(MinimumLogLevel, input.config.logLevel)))));
|
|
33413
33414
|
});
|
|
33414
|
-
const pairCommand = make$
|
|
33415
|
+
const pairCommand = make$62("pair", {
|
|
33415
33416
|
baseDir: baseDirFlag,
|
|
33416
33417
|
ttl: string("ttl").pipe(withSchema(DurationFromString), withDescription$1("Token TTL, for example `5m`, `1h`, or `15 minutes`. Defaults to 5 minutes."), optional),
|
|
33417
33418
|
label: string("label").pipe(withDescription$1("Optional label shown in the server's connections list."), optional),
|
|
@@ -33452,7 +33453,7 @@ const pairCommand = make$59("pair", {
|
|
|
33452
33453
|
expiresAt: issued.expiresAt,
|
|
33453
33454
|
notes
|
|
33454
33455
|
}));
|
|
33455
|
-
}).pipe(provide$1(layer$
|
|
33456
|
+
}).pipe(provide$1(layer$43))));
|
|
33456
33457
|
//#endregion
|
|
33457
33458
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.103_patch_hash=a18f963109656ddbeb2a99ca45f942ecf54830986259eb01ce6a970421c9c6a9/node_modules/effect/dist/unstable/encoding/Sse.js
|
|
33458
33459
|
const SseErrorTypeId = "~effect/encoding/Sse/SseError";
|
|
@@ -33798,7 +33799,7 @@ const makeClient = (api, options) => gen(function* () {
|
|
|
33798
33799
|
const encodeQuery = map$3(endpoint.query, encodeUnknownEffect);
|
|
33799
33800
|
const middlewareKeys = Array.from(onEndpointOptions.middleware, (tag) => `${tag.key}/Client`);
|
|
33800
33801
|
const endpointFn = fnUntraced(function* (request) {
|
|
33801
|
-
let httpRequest = make$
|
|
33802
|
+
let httpRequest = make$64(endpoint.method)(endpoint.path);
|
|
33802
33803
|
if (request !== void 0) {
|
|
33803
33804
|
if (encodeParams !== void 0) {
|
|
33804
33805
|
const params = yield* encodeParams(request.params);
|
|
@@ -33841,7 +33842,7 @@ const makeClient = (api, options) => gen(function* () {
|
|
|
33841
33842
|
* @category constructors
|
|
33842
33843
|
* @since 4.0.0
|
|
33843
33844
|
*/
|
|
33844
|
-
const make$
|
|
33845
|
+
const make$40 = (api, options) => flatMap$1(HttpClient, (httpClient) => makeWith(api, {
|
|
33845
33846
|
...options,
|
|
33846
33847
|
httpClient: options?.transformClient ? options.transformClient(httpClient) : httpClient
|
|
33847
33848
|
}));
|
|
@@ -34947,7 +34948,7 @@ function projectEvent(model, event) {
|
|
|
34947
34948
|
}
|
|
34948
34949
|
//#endregion
|
|
34949
34950
|
//#region src/orchestration/decider.ts
|
|
34950
|
-
const nowIso$4 = map$4(now, formatIso);
|
|
34951
|
+
const nowIso$4 = map$4(now$1, formatIso);
|
|
34951
34952
|
const QUEUED_TURN_START_GRACE_MS = 120 * 1e3;
|
|
34952
34953
|
/**
|
|
34953
34954
|
* Blocked-on-you work derived from the thread's retained activities: an
|
|
@@ -35954,7 +35955,7 @@ const OrchestrationEngineLive = effect(OrchestrationEngineService, gen(function*
|
|
|
35954
35955
|
const projectionPipeline = yield* OrchestrationProjectionPipeline;
|
|
35955
35956
|
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
|
35956
35957
|
const crypto = yield* Crypto;
|
|
35957
|
-
const nowIso = map$4(now, formatIso);
|
|
35958
|
+
const nowIso = map$4(now$1, formatIso);
|
|
35958
35959
|
let commandReadModel = createEmptyReadModel(yield* nowIso);
|
|
35959
35960
|
const commandQueue = yield* unbounded$2();
|
|
35960
35961
|
const eventPubSub = yield* unbounded$1();
|
|
@@ -36076,7 +36077,7 @@ const OrchestrationEngineLive = effect(OrchestrationEngineService, gen(function*
|
|
|
36076
36077
|
yield* logDebug("orchestration engine started").pipe(annotateLogs({ sequence: commandReadModel.snapshotSequence }));
|
|
36077
36078
|
const readEvents = (fromSequenceExclusive, limit) => eventStore.readFromSequence(fromSequenceExclusive, limit);
|
|
36078
36079
|
const dispatch = (command) => gen(function* () {
|
|
36079
|
-
const result = yield* make$
|
|
36080
|
+
const result = yield* make$73();
|
|
36080
36081
|
yield* offer$1(commandQueue, {
|
|
36081
36082
|
command,
|
|
36082
36083
|
result,
|
|
@@ -38506,7 +38507,7 @@ const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
|
38506
38507
|
"interrupted"
|
|
38507
38508
|
]);
|
|
38508
38509
|
var ThreadBackgroundLivenessService = class extends Service$2()("t3/orchestration/ThreadBackgroundLiveness/ThreadBackgroundLivenessService") {};
|
|
38509
|
-
function make$
|
|
38510
|
+
function make$39() {
|
|
38510
38511
|
const stateByThreadId = /* @__PURE__ */ new Map();
|
|
38511
38512
|
const stateFor = (threadId) => {
|
|
38512
38513
|
const existing = stateByThreadId.get(threadId);
|
|
@@ -38556,7 +38557,7 @@ function make$36() {
|
|
|
38556
38557
|
}
|
|
38557
38558
|
};
|
|
38558
38559
|
}
|
|
38559
|
-
const layer$
|
|
38560
|
+
const layer$31 = effect(ThreadBackgroundLivenessService, sync(make$39));
|
|
38560
38561
|
//#endregion
|
|
38561
38562
|
//#region ../t3-shared/src/sourceControl.ts
|
|
38562
38563
|
function parseRemoteHost(remoteUrl) {
|
|
@@ -38856,7 +38857,7 @@ const runProcessCore = fn("processRunner.runProcessCore")(function* (spawner, in
|
|
|
38856
38857
|
env: input.env,
|
|
38857
38858
|
extendEnv
|
|
38858
38859
|
});
|
|
38859
|
-
const child = yield* spawner.spawn(make$
|
|
38860
|
+
const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
|
|
38860
38861
|
...input.spawnCwd ?? input.cwd ? { cwd: input.spawnCwd ?? input.cwd } : {},
|
|
38861
38862
|
...input.env !== void 0 ? {
|
|
38862
38863
|
env: input.env,
|
|
@@ -38874,7 +38875,7 @@ const runProcessCore = fn("processRunner.runProcessCore")(function* (spawner, in
|
|
|
38874
38875
|
cause
|
|
38875
38876
|
})));
|
|
38876
38877
|
const stdin = input.stdin;
|
|
38877
|
-
const writeStdin = stdin === void 0 ? void_$1 : run$5(encodeText(make$
|
|
38878
|
+
const writeStdin = stdin === void 0 ? void_$1 : run$5(encodeText(make$74(stdin)), child.stdin).pipe(mapError((cause) => new ProcessStdinError({
|
|
38878
38879
|
command: input.command,
|
|
38879
38880
|
argumentCount: input.args.length,
|
|
38880
38881
|
cwd: input.cwd,
|
|
@@ -38924,7 +38925,7 @@ const runProcessCore = fn("processRunner.runProcessCore")(function* (spawner, in
|
|
|
38924
38925
|
stderrTruncated: stderr.truncated
|
|
38925
38926
|
};
|
|
38926
38927
|
});
|
|
38927
|
-
const layer$
|
|
38928
|
+
const layer$30 = effect(ProcessRunner, fn("ProcessRunner.make")(function* () {
|
|
38928
38929
|
const spawner = yield* ChildProcessSpawner;
|
|
38929
38930
|
const run = (input) => finalizeRunProcess(runProcessCore(spawner, input), input);
|
|
38930
38931
|
return ProcessRunner.of({ run });
|
|
@@ -39019,7 +39020,7 @@ const resolveRepositoryIdentityFromCacheKey = fn("RepositoryIdentityResolver.res
|
|
|
39019
39020
|
rootPath: cacheKey
|
|
39020
39021
|
}) : null;
|
|
39021
39022
|
});
|
|
39022
|
-
const layer$
|
|
39023
|
+
const layer$29 = effect(RepositoryIdentityResolver, fn("RepositoryIdentityResolver.make")(function* (options = {}) {
|
|
39023
39024
|
const processRunner = yield* ProcessRunner;
|
|
39024
39025
|
const repositoryIdentityCache = yield* makeWith$1((cacheKey) => resolveRepositoryIdentityFromCacheKey(cacheKey).pipe(provideService(ProcessRunner, processRunner)), {
|
|
39025
39026
|
capacity: options.cacheCapacity ?? DEFAULT_REPOSITORY_IDENTITY_CACHE_CAPACITY,
|
|
@@ -39033,7 +39034,7 @@ const layer$26 = effect(RepositoryIdentityResolver, fn("RepositoryIdentityResolv
|
|
|
39033
39034
|
return yield* get$7(repositoryIdentityCache, cacheKey);
|
|
39034
39035
|
});
|
|
39035
39036
|
return RepositoryIdentityResolver.of({ resolve });
|
|
39036
|
-
})()).pipe(provide(layer$
|
|
39037
|
+
})()).pipe(provide(layer$30));
|
|
39037
39038
|
//#endregion
|
|
39038
39039
|
//#region src/orchestration/Layers/ProjectionSnapshotQuery.ts
|
|
39039
39040
|
const decodeReadModel = decodeUnknownEffect(OrchestrationReadModel);
|
|
@@ -40469,7 +40470,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
|
|
|
40469
40470
|
getThreadDetailById,
|
|
40470
40471
|
getThreadDetailSnapshot
|
|
40471
40472
|
};
|
|
40472
|
-
})), mergeAll(OrchestrationEventStoreLive, OrchestrationCommandReceiptRepositoryLive), OrchestrationProjectionPipelineLive.pipe(provide(OrchestrationEventStoreLive))).pipe(provideMerge(layer$
|
|
40473
|
+
})), mergeAll(OrchestrationEventStoreLive, OrchestrationCommandReceiptRepositoryLive), OrchestrationProjectionPipelineLive.pipe(provide(OrchestrationEventStoreLive))).pipe(provideMerge(layer$31));
|
|
40473
40474
|
const OrchestrationLayerLive = mergeAll(OrchestrationInfrastructureLayerLive, OrchestrationEngineLive.pipe(provide(OrchestrationInfrastructureLayerLive)));
|
|
40474
40475
|
//#endregion
|
|
40475
40476
|
//#region ../t3-shared/src/keybindings.ts
|
|
@@ -40934,16 +40935,16 @@ function mergeWithDefaultKeybindings(custom) {
|
|
|
40934
40935
|
* Keybindings - Service tag for keybinding configuration operations.
|
|
40935
40936
|
*/
|
|
40936
40937
|
var Keybindings = class extends Service$2()("t3/keybindings") {};
|
|
40937
|
-
const layer$
|
|
40938
|
+
const layer$28 = effect(Keybindings, gen(function* () {
|
|
40938
40939
|
const { keybindingsConfigPath } = yield* ServerConfig;
|
|
40939
40940
|
const fs = yield* FileSystem;
|
|
40940
40941
|
const path = yield* Path;
|
|
40941
|
-
const upsertSemaphore = yield* make$
|
|
40942
|
+
const upsertSemaphore = yield* make$75(1);
|
|
40942
40943
|
const resolvedConfigCacheKey = "resolved";
|
|
40943
40944
|
const changesPubSub = yield* unbounded$1();
|
|
40944
|
-
const startedRef = yield* make$
|
|
40945
|
-
const startedDeferred = yield* make$
|
|
40946
|
-
const watcherScope = yield* make$
|
|
40945
|
+
const startedRef = yield* make$63(false);
|
|
40946
|
+
const startedDeferred = yield* make$73();
|
|
40947
|
+
const watcherScope = yield* make$76("sequential");
|
|
40947
40948
|
yield* addFinalizer(() => close(watcherScope, void_$2));
|
|
40948
40949
|
const emitChange = (configState) => publish(changesPubSub, configState).pipe(asVoid);
|
|
40949
40950
|
const readConfigExists = fs.exists(keybindingsConfigPath).pipe(mapError((cause) => new KeybindingsConfigError({
|
|
@@ -41043,7 +41044,7 @@ const layer$25 = effect(Keybindings, gen(function* () {
|
|
|
41043
41044
|
keybindings: mergeWithDefaultKeybindings(compileResolvedKeybindingsConfig(keybindings)),
|
|
41044
41045
|
issues
|
|
41045
41046
|
})));
|
|
41046
|
-
const resolvedConfigCache = yield* make$
|
|
41047
|
+
const resolvedConfigCache = yield* make$81({
|
|
41047
41048
|
capacity: 1,
|
|
41048
41049
|
lookup: () => loadConfigStateFromDisk
|
|
41049
41050
|
});
|
|
@@ -41386,7 +41387,7 @@ const resolveEditorLaunch = fn("resolveEditorLaunch")(function* (input) {
|
|
|
41386
41387
|
});
|
|
41387
41388
|
const launchAndUnref = fn("externalLauncher.launchAndUnref")(function* (launch, onError) {
|
|
41388
41389
|
const spawner = yield* ChildProcessSpawner;
|
|
41389
|
-
const command = make$
|
|
41390
|
+
const command = make$79(launch.command, launch.args, launch.options);
|
|
41390
41391
|
yield* spawner.spawn(command).pipe(flatMap$1((handle) => handle.unref), asVoid, scoped, mapError(onError));
|
|
41391
41392
|
});
|
|
41392
41393
|
const launchBrowser = fn("externalLauncher.launchBrowser")(function* (target) {
|
|
@@ -41423,7 +41424,7 @@ const launchEditorProcess = fn("externalLauncher.launchEditorProcess")(function*
|
|
|
41423
41424
|
cause
|
|
41424
41425
|
}));
|
|
41425
41426
|
});
|
|
41426
|
-
const layer$
|
|
41427
|
+
const layer$27 = effect(ExternalLauncher, gen(function* () {
|
|
41427
41428
|
const spawner = yield* ChildProcessSpawner;
|
|
41428
41429
|
const fileSystem = yield* FileSystem;
|
|
41429
41430
|
const path = yield* Path;
|
|
@@ -41451,9 +41452,9 @@ var OrchestrationReactor = class extends Service$2()("t3/orchestration/Services/
|
|
|
41451
41452
|
//#endregion
|
|
41452
41453
|
//#region src/serverLifecycleEvents.ts
|
|
41453
41454
|
var ServerLifecycleEvents = class extends Service$2()("t3/serverLifecycleEvents") {};
|
|
41454
|
-
const layer$
|
|
41455
|
+
const layer$26 = effect(ServerLifecycleEvents, gen(function* () {
|
|
41455
41456
|
const pubsub = yield* unbounded$1();
|
|
41456
|
-
const state = yield* make$
|
|
41457
|
+
const state = yield* make$63({
|
|
41457
41458
|
sequence: 0,
|
|
41458
41459
|
events: []
|
|
41459
41460
|
});
|
|
@@ -41530,7 +41531,7 @@ var ServerSettingsService = class extends Service$2()("t3/serverSettings/ServerS
|
|
|
41530
41531
|
const makeTest = (overrides = {}) => gen(function* () {
|
|
41531
41532
|
const { automaticGitFetchInterval, providerHealthRefreshInterval, ...overridesForMerge } = overrides;
|
|
41532
41533
|
const merged = deepMerge(DEFAULT_SERVER_SETTINGS, overridesForMerge);
|
|
41533
|
-
const currentSettingsRef = yield* make$
|
|
41534
|
+
const currentSettingsRef = yield* make$63(yield* normalizeServerSettings({
|
|
41534
41535
|
...merged,
|
|
41535
41536
|
...automaticGitFetchInterval !== void 0 ? { automaticGitFetchInterval } : {},
|
|
41536
41537
|
...providerHealthRefreshInterval !== void 0 ? { providerHealthRefreshInterval } : {}
|
|
@@ -41584,17 +41585,17 @@ function stripDefaultServerSettings(current, defaults) {
|
|
|
41584
41585
|
}
|
|
41585
41586
|
return Object.is(current, defaults) ? void 0 : current;
|
|
41586
41587
|
}
|
|
41587
|
-
const layer$
|
|
41588
|
+
const layer$25 = effect(ServerSettingsService, gen(function* () {
|
|
41588
41589
|
const { settingsPath } = yield* ServerConfig;
|
|
41589
41590
|
const fs = yield* FileSystem;
|
|
41590
41591
|
const pathService = yield* Path;
|
|
41591
41592
|
const secretStore = yield* ServerSecretStore;
|
|
41592
|
-
const writeSemaphore = yield* make$
|
|
41593
|
+
const writeSemaphore = yield* make$75(1);
|
|
41593
41594
|
const cacheKey = "settings";
|
|
41594
41595
|
const changesPubSub = yield* unbounded$1();
|
|
41595
|
-
const startedRef = yield* make$
|
|
41596
|
-
const startedDeferred = yield* make$
|
|
41597
|
-
const watcherScope = yield* make$
|
|
41596
|
+
const startedRef = yield* make$63(false);
|
|
41597
|
+
const startedDeferred = yield* make$73();
|
|
41598
|
+
const watcherScope = yield* make$76("sequential");
|
|
41598
41599
|
yield* addFinalizer(() => close(watcherScope, void_$2));
|
|
41599
41600
|
const emitChange = (settings) => publish(changesPubSub, settings).pipe(asVoid);
|
|
41600
41601
|
const readConfigExists = fs.exists(settingsPath).pipe(mapError((cause) => new ServerSettingsError({
|
|
@@ -41621,7 +41622,7 @@ const layer$22 = effect(ServerSettingsService, gen(function* () {
|
|
|
41621
41622
|
}
|
|
41622
41623
|
return decoded.value;
|
|
41623
41624
|
});
|
|
41624
|
-
const settingsCache = yield* make$
|
|
41625
|
+
const settingsCache = yield* make$81({
|
|
41625
41626
|
capacity: 1,
|
|
41626
41627
|
lookup: () => loadSettingsFromDisk
|
|
41627
41628
|
});
|
|
@@ -41981,16 +41982,16 @@ var AnalyticsService = class AnalyticsService extends Service$2()("t3/telemetry/
|
|
|
41981
41982
|
flush: void_$1
|
|
41982
41983
|
}));
|
|
41983
41984
|
};
|
|
41984
|
-
const layer$
|
|
41985
|
+
const layer$24 = effect(AnalyticsService, gen(function* () {
|
|
41985
41986
|
const telemetryConfig = yield* TelemetryEnvConfig;
|
|
41986
41987
|
const httpClient = yield* HttpClient;
|
|
41987
41988
|
const serverConfig = yield* ServerConfig;
|
|
41988
41989
|
const identifier = yield* getTelemetryIdentifier;
|
|
41989
|
-
const bufferRef = yield* make$
|
|
41990
|
+
const bufferRef = yield* make$63([]);
|
|
41990
41991
|
const clientType = serverConfig.mode === "desktop" ? "desktop-app" : "cli-web-client";
|
|
41991
41992
|
const hostPlatform = yield* HostProcessPlatform;
|
|
41992
41993
|
const hostArchitecture = yield* HostProcessArchitecture;
|
|
41993
|
-
const enqueueBufferedEvent = (event, properties) => flatMap$1(now, (now) => modify$2(bufferRef, (current) => {
|
|
41994
|
+
const enqueueBufferedEvent = (event, properties) => flatMap$1(now$1, (now) => modify$2(bufferRef, (current) => {
|
|
41994
41995
|
const appended = [...current, {
|
|
41995
41996
|
event,
|
|
41996
41997
|
...properties ? { properties } : {},
|
|
@@ -42186,7 +42187,7 @@ function platformArch(architecture) {
|
|
|
42186
42187
|
* state. It intentionally has no fallback Layer.succeed value: callers must
|
|
42187
42188
|
* provide the external platform services and a ServerConfig.
|
|
42188
42189
|
*/
|
|
42189
|
-
const layer$
|
|
42190
|
+
const layer$23 = effect(ServerEnvironment, gen(function* () {
|
|
42190
42191
|
const fileSystem = yield* FileSystem;
|
|
42191
42192
|
const path = yield* Path;
|
|
42192
42193
|
const serverConfig = yield* ServerConfig;
|
|
@@ -42240,7 +42241,7 @@ const layer$20 = effect(ServerEnvironment, gen(function* () {
|
|
|
42240
42241
|
getEnvironmentId: succeed$1(environmentId),
|
|
42241
42242
|
getDescriptor: succeed$1(descriptor)
|
|
42242
42243
|
});
|
|
42243
|
-
})).pipe(provide(layer$
|
|
42244
|
+
})).pipe(provide(layer$30));
|
|
42244
42245
|
//#endregion
|
|
42245
42246
|
//#region src/provider/Services/ProviderSessionReaper.ts
|
|
42246
42247
|
var ProviderSessionReaper = class extends Service$2()("t3/provider/Services/ProviderSessionReaper") {};
|
|
@@ -42254,7 +42255,7 @@ const forkParked = (effect) => gen(function* () {
|
|
|
42254
42255
|
yield* forkScoped(effect);
|
|
42255
42256
|
return;
|
|
42256
42257
|
}
|
|
42257
|
-
const parked = yield* make$
|
|
42258
|
+
const parked = yield* make$73();
|
|
42258
42259
|
yield* forkScoped(succeed$4(parked, void 0).pipe(andThen(activation), andThen(effect)));
|
|
42259
42260
|
yield* _await(parked);
|
|
42260
42261
|
});
|
|
@@ -42273,9 +42274,9 @@ var ServerRuntimeStartupError = class extends TaggedErrorClass()("ServerRuntimeS
|
|
|
42273
42274
|
var ServerRuntimeStartup = class extends Service$2()("t3/serverRuntimeStartup") {};
|
|
42274
42275
|
const settleQueuedCommand = (deferred, exit) => isSuccess(exit) ? succeed$4(deferred, exit.value) : failCause$2(deferred, exit.cause);
|
|
42275
42276
|
const makeCommandGate = gen(function* () {
|
|
42276
|
-
const commandReady = yield* make$
|
|
42277
|
+
const commandReady = yield* make$73();
|
|
42277
42278
|
const commandQueue = yield* unbounded$2();
|
|
42278
|
-
const commandReadinessState = yield* make$
|
|
42279
|
+
const commandReadinessState = yield* make$63("pending");
|
|
42279
42280
|
yield* forkScoped(forever(take$1(commandQueue).pipe(flatMap$1((command) => command.run))));
|
|
42280
42281
|
return {
|
|
42281
42282
|
awaitCommandReady: _await(commandReady),
|
|
@@ -42291,7 +42292,7 @@ const makeCommandGate = gen(function* () {
|
|
|
42291
42292
|
const readinessState = yield* get$3(commandReadinessState);
|
|
42292
42293
|
if (readinessState === "ready") return yield* effect;
|
|
42293
42294
|
if (readinessState !== "pending") return yield* readinessState;
|
|
42294
|
-
const result = yield* make$
|
|
42295
|
+
const result = yield* make$73();
|
|
42295
42296
|
yield* offer$1(commandQueue, { run: _await(commandReady).pipe(flatMap$1(() => effect), exit, flatMap$1((exit) => settleQueuedCommand(result, exit))) });
|
|
42296
42297
|
return yield* _await(result);
|
|
42297
42298
|
})
|
|
@@ -42335,7 +42336,7 @@ const resolveAutoBootstrapWelcomeTargets = gen(function* () {
|
|
|
42335
42336
|
let nextProjectId;
|
|
42336
42337
|
let nextProjectDefaultModelSelection;
|
|
42337
42338
|
if (isNone(existingProject)) {
|
|
42338
|
-
const createdAt = formatIso(yield* now);
|
|
42339
|
+
const createdAt = formatIso(yield* now$1);
|
|
42339
42340
|
nextProjectId = ProjectId.make(yield* randomUUID);
|
|
42340
42341
|
const bootstrapProjectTitle = path.basename(serverConfig.cwd) || "project";
|
|
42341
42342
|
nextProjectDefaultModelSelection = getAutoBootstrapDefaultModelSelection();
|
|
@@ -42354,7 +42355,7 @@ const resolveAutoBootstrapWelcomeTargets = gen(function* () {
|
|
|
42354
42355
|
}
|
|
42355
42356
|
const existingThreadId = yield* projectionReadModelQuery.getFirstActiveThreadIdByProjectId(nextProjectId);
|
|
42356
42357
|
if (isNone(existingThreadId)) {
|
|
42357
|
-
const createdAt = formatIso(yield* now);
|
|
42358
|
+
const createdAt = formatIso(yield* now$1);
|
|
42358
42359
|
const createdThreadId = ThreadId.make(yield* randomUUID);
|
|
42359
42360
|
yield* orchestrationEngine.dispatch({
|
|
42360
42361
|
type: "thread.create",
|
|
@@ -42394,7 +42395,7 @@ const maybeOpenBrowser = (target) => gen(function* () {
|
|
|
42394
42395
|
yield* (yield* ExternalLauncher).launchBrowser(target).pipe(catch_(() => logInfo("browser auto-open unavailable", { hint: `Open ${target} in your browser.` })));
|
|
42395
42396
|
});
|
|
42396
42397
|
const runStartupPhase = (phase, effect) => effect.pipe(annotateSpans({ "startup.phase": phase }), withSpan(`server.startup.${phase}`));
|
|
42397
|
-
const make$
|
|
42398
|
+
const make$30 = (options) => gen(function* () {
|
|
42398
42399
|
const serverConfig = yield* ServerConfig;
|
|
42399
42400
|
const keybindings = yield* Keybindings;
|
|
42400
42401
|
const orchestrationReactor = yield* OrchestrationReactor;
|
|
@@ -42404,8 +42405,8 @@ const make$27 = (options) => gen(function* () {
|
|
|
42404
42405
|
const serverEnvironment = yield* ServerEnvironment;
|
|
42405
42406
|
const crypto = yield* Crypto;
|
|
42406
42407
|
const commandGate = yield* makeCommandGate;
|
|
42407
|
-
const httpListening = yield* make$
|
|
42408
|
-
const reactorScope = yield* make$
|
|
42408
|
+
const httpListening = yield* make$73();
|
|
42409
|
+
const reactorScope = yield* make$76("sequential");
|
|
42409
42410
|
yield* addFinalizer(() => close(reactorScope, void_$2));
|
|
42410
42411
|
yield* forkScoped(exit(gen(function* () {
|
|
42411
42412
|
yield* logDebug("startup phase: starting keybindings runtime");
|
|
@@ -42480,7 +42481,7 @@ const make$27 = (options) => gen(function* () {
|
|
|
42480
42481
|
version: 1,
|
|
42481
42482
|
type: "ready",
|
|
42482
42483
|
payload: {
|
|
42483
|
-
at: formatIso(yield* now),
|
|
42484
|
+
at: formatIso(yield* now$1),
|
|
42484
42485
|
environment
|
|
42485
42486
|
}
|
|
42486
42487
|
}));
|
|
@@ -42508,7 +42509,7 @@ const make$27 = (options) => gen(function* () {
|
|
|
42508
42509
|
enqueueCommand: commandGate.enqueueCommand
|
|
42509
42510
|
};
|
|
42510
42511
|
});
|
|
42511
|
-
const layerWithOptions = (options) => effect(ServerRuntimeStartup, make$
|
|
42512
|
+
const layerWithOptions = (options) => effect(ServerRuntimeStartup, make$30(options));
|
|
42512
42513
|
layerWithOptions();
|
|
42513
42514
|
//#endregion
|
|
42514
42515
|
//#region src/workspace/WorkspacePaths.ts
|
|
@@ -42580,7 +42581,7 @@ function expandHomePath$2(input, path) {
|
|
|
42580
42581
|
if (input.startsWith("~/") || input.startsWith("~\\")) return path.join(NodeOS.homedir(), input.slice(2));
|
|
42581
42582
|
return input;
|
|
42582
42583
|
}
|
|
42583
|
-
const layer$
|
|
42584
|
+
const layer$21 = effect(WorkspacePaths, gen(function* () {
|
|
42584
42585
|
const fileSystem = yield* FileSystem;
|
|
42585
42586
|
const path = yield* Path;
|
|
42586
42587
|
const statWorkspaceRoot = fn("WorkspacePaths.statWorkspaceRoot")(function* (workspaceRoot, normalizedWorkspaceRoot, phase) {
|
|
@@ -42742,14 +42743,14 @@ const projectCommandUuid = Crypto.pipe(flatMap$1((crypto) => crypto.randomUUIDv4
|
|
|
42742
42743
|
operation: "generateProjectCommandId",
|
|
42743
42744
|
cause
|
|
42744
42745
|
})));
|
|
42745
|
-
const ProjectCliRuntimeLive = mergeAll(layer$
|
|
42746
|
+
const ProjectCliRuntimeLive = mergeAll(layer$21, OrchestrationLayerLive.pipe(provideMerge(layer$29), provideMerge(layerConfig)));
|
|
42746
42747
|
const PROJECT_CLI_LIVE_SERVER_TIMEOUT = seconds(1);
|
|
42747
42748
|
const withProjectCliSessionToken = (environmentAuth, run) => acquireUseRelease(environmentAuth.issueSession({
|
|
42748
42749
|
scopes: AuthAdministrativeScopes,
|
|
42749
42750
|
label: "t3 project cli"
|
|
42750
42751
|
}), (issued) => run(issued.token), (issued) => environmentAuth.revokeSession(issued.sessionId).pipe(ignore$1({ log: true })));
|
|
42751
42752
|
const withProjectCliLiveServerTimeout = (effect) => effect.pipe(timeout(PROJECT_CLI_LIVE_SERVER_TIMEOUT));
|
|
42752
|
-
const makeLiveServerClient = (origin) => make$
|
|
42753
|
+
const makeLiveServerClient = (origin) => make$40(EnvironmentHttpApi, { baseUrl: origin });
|
|
42753
42754
|
const normalizeWorkspaceRootForProjectCommand = fn("normalizeWorkspaceRootForProjectCommand")(function* (workspaceRoot) {
|
|
42754
42755
|
return yield* (yield* WorkspacePaths).normalizeWorkspaceRoot(workspaceRoot);
|
|
42755
42756
|
});
|
|
@@ -42832,7 +42833,7 @@ const runProjectMutation = fn("runProjectMutation")(function* (flags, run) {
|
|
|
42832
42833
|
});
|
|
42833
42834
|
yield* log(output);
|
|
42834
42835
|
}));
|
|
42835
|
-
const offlineRuntimeLayer = ProjectCliRuntimeLive.pipe(provide(layer$
|
|
42836
|
+
const offlineRuntimeLayer = ProjectCliRuntimeLive.pipe(provide(layer$39(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)));
|
|
42836
42837
|
return yield* gen(function* () {
|
|
42837
42838
|
const snapshot = yield* getOfflineSnapshot();
|
|
42838
42839
|
const orchestrationEngine = yield* OrchestrationEngineService;
|
|
@@ -42843,9 +42844,9 @@ const runProjectMutation = fn("runProjectMutation")(function* (flags, run) {
|
|
|
42843
42844
|
});
|
|
42844
42845
|
yield* log(output);
|
|
42845
42846
|
}).pipe(provide$1(offlineRuntimeLayer));
|
|
42846
|
-
}).pipe(provide$1(mergeAll(runtimeLayer, layer$
|
|
42847
|
+
}).pipe(provide$1(mergeAll(runtimeLayer, layer$21).pipe(provideMerge(layer$43), provide(layer$39(config)), provide(succeed$3(MinimumLogLevel, minimumLogLevel)))));
|
|
42847
42848
|
});
|
|
42848
|
-
const projectAddCommand = make$
|
|
42849
|
+
const projectAddCommand = make$62("add", {
|
|
42849
42850
|
...projectLocationFlags,
|
|
42850
42851
|
workspaceRoot: string$1("path").pipe(withDescription$2("Workspace root to add as a project.")),
|
|
42851
42852
|
title: string("title").pipe(withDescription$1("Optional project title."), optional)
|
|
@@ -42866,11 +42867,11 @@ const projectAddCommand = make$59("add", {
|
|
|
42866
42867
|
title,
|
|
42867
42868
|
workspaceRoot,
|
|
42868
42869
|
defaultModelSelection: getAutoBootstrapDefaultModelSelection(),
|
|
42869
|
-
createdAt: formatIso(yield* now)
|
|
42870
|
+
createdAt: formatIso(yield* now$1)
|
|
42870
42871
|
});
|
|
42871
42872
|
return `Added project ${projectId} (${title}) at ${workspaceRoot}.`;
|
|
42872
42873
|
}))));
|
|
42873
|
-
const projectRemoveCommand = make$
|
|
42874
|
+
const projectRemoveCommand = make$62("remove", {
|
|
42874
42875
|
...projectLocationFlags,
|
|
42875
42876
|
project: string$1("project").pipe(withDescription$2("Project id or workspace root to remove.")),
|
|
42876
42877
|
force: boolean("force").pipe(withDescription$1("Delete the project and all of its threads."), withDefault(false))
|
|
@@ -42887,7 +42888,7 @@ const projectRemoveCommand = make$59("remove", {
|
|
|
42887
42888
|
});
|
|
42888
42889
|
return `Removed project ${project.id} (${project.title}).`;
|
|
42889
42890
|
}))));
|
|
42890
|
-
const projectRenameCommand = make$
|
|
42891
|
+
const projectRenameCommand = make$62("rename", {
|
|
42891
42892
|
...projectLocationFlags,
|
|
42892
42893
|
project: string$1("project").pipe(withDescription$2("Project id or workspace root to rename.")),
|
|
42893
42894
|
title: string$1("title").pipe(withDescription$2("New project title."))
|
|
@@ -42906,7 +42907,7 @@ const projectRenameCommand = make$59("rename", {
|
|
|
42906
42907
|
});
|
|
42907
42908
|
return `Renamed project ${project.id} to ${nextTitle}.`;
|
|
42908
42909
|
}))));
|
|
42909
|
-
const projectCommand = make$
|
|
42910
|
+
const projectCommand = make$62("project").pipe(withDescription("Manage projects."), withSubcommands([
|
|
42910
42911
|
projectAddCommand,
|
|
42911
42912
|
projectRemoveCommand,
|
|
42912
42913
|
projectRenameCommand
|
|
@@ -42969,7 +42970,7 @@ function acquireDaemonLock(stateDir) {
|
|
|
42969
42970
|
* @category layers
|
|
42970
42971
|
* @since 4.0.0
|
|
42971
42972
|
*/
|
|
42972
|
-
const layer$
|
|
42973
|
+
const layer$20 = (api, options) => use(fnUntraced(function* (router) {
|
|
42973
42974
|
const services = yield* context();
|
|
42974
42975
|
const routes = [];
|
|
42975
42976
|
const availableGroups = Array.from(services.mapUnsafe.keys()).filter((key) => key.startsWith("effect/httpapi/HttpApiGroup/"));
|
|
@@ -43022,19 +43023,19 @@ const HandlersTypeId = "~effect/httpapi/HttpApiBuilder/Handlers";
|
|
|
43022
43023
|
*/
|
|
43023
43024
|
const securityDecode = (self) => {
|
|
43024
43025
|
switch (self._tag) {
|
|
43025
|
-
case "Http": return map$4(HttpServerRequest, (request) => make$
|
|
43026
|
+
case "Http": return map$4(HttpServerRequest, (request) => make$67(getAuthorizationCredential(request.headers.authorization, self.scheme) ?? ""));
|
|
43026
43027
|
case "ApiKey": {
|
|
43027
43028
|
const key = self.in === "header" ? self.key.toLowerCase() : self.key;
|
|
43028
43029
|
const schema = Struct({ [key]: String$1 });
|
|
43029
43030
|
return match$2(self.in === "query" ? schemaSearchParams(schema) : self.in === "cookie" ? schemaCookies(schema) : schemaHeaders(schema), {
|
|
43030
|
-
onFailure: () => make$
|
|
43031
|
-
onSuccess: (match) => make$
|
|
43031
|
+
onFailure: () => make$67(""),
|
|
43032
|
+
onSuccess: (match) => make$67(match[key])
|
|
43032
43033
|
});
|
|
43033
43034
|
}
|
|
43034
43035
|
case "Basic": {
|
|
43035
43036
|
const empty = {
|
|
43036
43037
|
username: "",
|
|
43037
|
-
password: make$
|
|
43038
|
+
password: make$67("")
|
|
43038
43039
|
};
|
|
43039
43040
|
return map$4(HttpServerRequest, (request) => {
|
|
43040
43041
|
const encoded = getAuthorizationCredential(request.headers.authorization, basicScheme);
|
|
@@ -43045,7 +43046,7 @@ const securityDecode = (self) => {
|
|
|
43045
43046
|
if (separator === -1) return empty;
|
|
43046
43047
|
return {
|
|
43047
43048
|
username: decoded.slice(0, separator),
|
|
43048
|
-
password: make$
|
|
43049
|
+
password: make$67(decoded.slice(separator + 1))
|
|
43049
43050
|
};
|
|
43050
43051
|
});
|
|
43051
43052
|
}
|
|
@@ -43209,17 +43210,17 @@ const makeSecurityMiddleware = (key, service) => {
|
|
|
43209
43210
|
let lastResult;
|
|
43210
43211
|
for (let i = 0; i < entries.length; i++) {
|
|
43211
43212
|
const { decode, middleware } = entries[i];
|
|
43212
|
-
const result$
|
|
43213
|
+
const result$2 = yield* result(flatMap$1(decode, (credential) => middleware(handler, {
|
|
43213
43214
|
credential,
|
|
43214
43215
|
endpoint: options.endpoint,
|
|
43215
43216
|
group: options.group
|
|
43216
43217
|
})));
|
|
43217
|
-
if (isFailure$1(result$
|
|
43218
|
-
if (isHandlerError(result$
|
|
43219
|
-
lastResult = result$
|
|
43218
|
+
if (isFailure$1(result$2)) {
|
|
43219
|
+
if (isHandlerError(result$2.failure)) return yield* fail(result$2.failure.error);
|
|
43220
|
+
lastResult = result$2;
|
|
43220
43221
|
continue;
|
|
43221
43222
|
}
|
|
43222
|
-
return result$
|
|
43223
|
+
return result$2.success;
|
|
43223
43224
|
}
|
|
43224
43225
|
return yield* fromResult(lastResult);
|
|
43225
43226
|
});
|
|
@@ -43583,18 +43584,18 @@ function requireDesktopTelemetryWriteProgress(fd, remainingBytes, written) {
|
|
|
43583
43584
|
remainingBytes
|
|
43584
43585
|
}));
|
|
43585
43586
|
}
|
|
43586
|
-
const layer$
|
|
43587
|
+
const layer$19 = effect(DesktopTelemetryReceiver, fn("resourceTelemetry.desktopTelemetryReceiver.make")(function* () {
|
|
43587
43588
|
const config = yield* ServerConfig;
|
|
43588
43589
|
const serverSettings = yield* ServerSettingsService;
|
|
43589
|
-
const latest = yield* make$
|
|
43590
|
-
const receiverStartedAt = yield* now;
|
|
43591
|
-
const lastContactAtMs = yield* make$
|
|
43592
|
-
const snapshotStaleAfterMs = yield* make$
|
|
43590
|
+
const latest = yield* make$63(none());
|
|
43591
|
+
const receiverStartedAt = yield* now$1;
|
|
43592
|
+
const lastContactAtMs = yield* make$63(initialDesktopTelemetryContactAt(config.desktopTelemetryFd, toEpochMillis(receiverStartedAt)));
|
|
43593
|
+
const snapshotStaleAfterMs = yield* make$63(resolveDesktopTelemetrySnapshotStaleAfterMs(DEFAULT_HOST_POWER_ACTIVE_INTERVAL_MS, DEFAULT_HOST_POWER_IDLE_INTERVAL_MS));
|
|
43593
43594
|
const changes = yield* sliding(8);
|
|
43594
43595
|
const healthChanges = yield* sliding(4);
|
|
43595
|
-
const controlMutex = yield* make$
|
|
43596
|
-
const snapshotMutex = yield* make$
|
|
43597
|
-
const health = yield* make$
|
|
43596
|
+
const controlMutex = yield* make$75(1);
|
|
43597
|
+
const snapshotMutex = yield* make$75(1);
|
|
43598
|
+
const health = yield* make$63({
|
|
43598
43599
|
status: config.desktopTelemetryFd === void 0 ? "unavailable" : "starting",
|
|
43599
43600
|
lastSampleAt: none(),
|
|
43600
43601
|
lastError: config.desktopTelemetryFd === void 0 ? some(new DesktopTelemetryDescriptorUnavailable({ mode: config.mode }).message) : none()
|
|
@@ -43668,7 +43669,7 @@ const layer$16 = effect(DesktopTelemetryReceiver, fn("resourceTelemetry.desktopT
|
|
|
43668
43669
|
}));
|
|
43669
43670
|
return decodeMessage(value).pipe(mapError((cause) => new DesktopTelemetryDecodeFailed({ cause })));
|
|
43670
43671
|
}), mapError$1(normalizeReceiverError)).pipe(runForEach((message) => {
|
|
43671
|
-
const recordContact = now.pipe(flatMap$1((now) => set$2(lastContactAtMs, some(toEpochMillis(now)))));
|
|
43672
|
+
const recordContact = now$1.pipe(flatMap$1((now) => set$2(lastContactAtMs, some(toEpochMillis(now)))));
|
|
43672
43673
|
if (message.type === "desktopTelemetryHello") return recordContact.pipe(andThen(updateHealth((current) => ({
|
|
43673
43674
|
...current,
|
|
43674
43675
|
status: "healthy",
|
|
@@ -43686,7 +43687,7 @@ const layer$16 = effect(DesktopTelemetryReceiver, fn("resourceTelemetry.desktopT
|
|
|
43686
43687
|
lastError: some(error.message)
|
|
43687
43688
|
}))), forkScoped);
|
|
43688
43689
|
yield* forever(sleep(STALE_CHECK_INTERVAL).pipe(andThen(snapshotMutex.withPermits(1)(gen(function* () {
|
|
43689
|
-
const nowMs = toEpochMillis(yield* now);
|
|
43690
|
+
const nowMs = toEpochMillis(yield* now$1);
|
|
43690
43691
|
const staleAfterMs = yield* get$3(snapshotStaleAfterMs);
|
|
43691
43692
|
const staleSnapshot = yield* modify$2(latest, (current) => {
|
|
43692
43693
|
if (isNone(current) || current.value.power.stale || nowMs - current.value.sampledAtUnixMs < staleAfterMs) return [none(), current];
|
|
@@ -43760,8 +43761,8 @@ const makeUnknownSnapshot = (source, updatedAt) => ({
|
|
|
43760
43761
|
function samePowerState(left, right) {
|
|
43761
43762
|
return left.source === right.source && left.idle === right.idle && left.locked === right.locked && left.suspended === right.suspended && left.onBattery === right.onBattery && left.lowPowerMode === right.lowPowerMode && left.thermalState === right.thermalState && left.stale === right.stale;
|
|
43762
43763
|
}
|
|
43763
|
-
const make$
|
|
43764
|
-
const latestRef = yield* make$
|
|
43764
|
+
const make$27 = fn("background.hostPower.make")(function* (initialSnapshot) {
|
|
43765
|
+
const latestRef = yield* make$63(initialSnapshot ?? makeUnknownSnapshot("unknown", yield* now$1));
|
|
43765
43766
|
const changes = yield* sliding(1);
|
|
43766
43767
|
const report = (snapshot) => modify$2(latestRef, (current) => {
|
|
43767
43768
|
if (isLessThan$1(snapshot.updatedAt, current.updatedAt)) return [none(), current];
|
|
@@ -43776,12 +43777,12 @@ const make$24 = fn("background.hostPower.make")(function* (initialSnapshot) {
|
|
|
43776
43777
|
streamChanges: fromPubSub(changes)
|
|
43777
43778
|
});
|
|
43778
43779
|
});
|
|
43779
|
-
const layer$
|
|
43780
|
+
const layer$18 = effect(HostPowerMonitor, gen(function* () {
|
|
43780
43781
|
const desktopSubscription = yield* (yield* DesktopTelemetryReceiver).subscribe;
|
|
43781
43782
|
const initial = desktopSubscription.latest;
|
|
43782
43783
|
const monitor = yield* match$1(initial, {
|
|
43783
|
-
onNone: () => make$
|
|
43784
|
-
onSome: (snapshot) => make$
|
|
43784
|
+
onNone: () => make$27(),
|
|
43785
|
+
onSome: (snapshot) => make$27(snapshot.power)
|
|
43785
43786
|
});
|
|
43786
43787
|
yield* desktopSubscription.changes.pipe(map$8((snapshot) => snapshot.power), runForEach(monitor.report), forkScoped);
|
|
43787
43788
|
return monitor;
|
|
@@ -43871,34 +43872,34 @@ function computeSnapshot(input) {
|
|
|
43871
43872
|
updatedAt: input.updatedAt
|
|
43872
43873
|
};
|
|
43873
43874
|
}
|
|
43874
|
-
const layer$
|
|
43875
|
+
const layer$17 = effect(BackgroundPolicy, fn("background.policy.make")(function* () {
|
|
43875
43876
|
const hostPowerMonitor = yield* HostPowerMonitor;
|
|
43876
43877
|
const serverSettings = yield* ServerSettingsService;
|
|
43877
|
-
const leasesRef = yield* make$
|
|
43878
|
+
const leasesRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
43878
43879
|
const changes = yield* sliding(1);
|
|
43879
|
-
const publishMutex = yield* make$
|
|
43880
|
+
const publishMutex = yield* make$75(1);
|
|
43880
43881
|
const backgroundActivitySettings = serverSettings.getSettings.pipe(map$4(resolveServerBackgroundActivitySettings), orElseSucceed(() => getBackgroundActivityPresetSettings("balanced")));
|
|
43881
43882
|
const snapshot = gen(function* () {
|
|
43882
|
-
const [hostPower, leases, now
|
|
43883
|
+
const [hostPower, leases, now, settings] = yield* all([
|
|
43883
43884
|
hostPowerMonitor.snapshot,
|
|
43884
43885
|
get$3(leasesRef),
|
|
43885
|
-
now,
|
|
43886
|
+
now$1,
|
|
43886
43887
|
backgroundActivitySettings
|
|
43887
43888
|
]);
|
|
43888
43889
|
return computeSnapshot({
|
|
43889
43890
|
hostPower,
|
|
43890
43891
|
leases,
|
|
43891
|
-
now
|
|
43892
|
+
now,
|
|
43892
43893
|
settings,
|
|
43893
|
-
updatedAt: now
|
|
43894
|
+
updatedAt: now
|
|
43894
43895
|
});
|
|
43895
43896
|
});
|
|
43896
43897
|
const publishSnapshotUnlocked = snapshot.pipe(flatMap$1((next) => publish(changes, next)));
|
|
43897
43898
|
const publishSnapshot = publishMutex.withPermits(1)(publishSnapshotUnlocked);
|
|
43898
43899
|
const reportClientActivity = (sessionId, rpcClientId, input) => publishMutex.withPermits(1)(gen(function* () {
|
|
43899
43900
|
const ttlMs = Math.min(Math.max(input.ttlMs ?? DEFAULT_LEASE_TTL_MS, 1e3), MAX_LEASE_TTL_MS);
|
|
43900
|
-
const now
|
|
43901
|
-
const expiresAt = add$3(now
|
|
43901
|
+
const now = yield* now$1;
|
|
43902
|
+
const expiresAt = add$3(now, { milliseconds: ttlMs });
|
|
43902
43903
|
const lease = {
|
|
43903
43904
|
sessionId,
|
|
43904
43905
|
rpcClientId,
|
|
@@ -43912,10 +43913,10 @@ const layer$14 = effect(BackgroundPolicy, fn("background.policy.make")(function*
|
|
|
43912
43913
|
...input.batteryState !== void 0 ? { batteryState: input.batteryState } : {},
|
|
43913
43914
|
...input.networkType !== void 0 ? { networkType: input.networkType } : {},
|
|
43914
43915
|
scopes: input.scopes,
|
|
43915
|
-
updatedAt: now
|
|
43916
|
+
updatedAt: now,
|
|
43916
43917
|
expiresAt
|
|
43917
43918
|
};
|
|
43918
|
-
yield* update$2(leasesRef, (leases) => upsertClientActivityLease(leases, lease, now
|
|
43919
|
+
yield* update$2(leasesRef, (leases) => upsertClientActivityLease(leases, lease, now));
|
|
43919
43920
|
yield* publishSnapshotUnlocked;
|
|
43920
43921
|
}));
|
|
43921
43922
|
const removeRpcClient = (sessionId, rpcClientId) => publishMutex.withPermits(1)(update$2(leasesRef, (leases) => {
|
|
@@ -43933,10 +43934,10 @@ const layer$14 = effect(BackgroundPolicy, fn("background.policy.make")(function*
|
|
|
43933
43934
|
yield* runForEach(hostPowerMonitor.streamChanges, () => publishSnapshot).pipe(forkScoped);
|
|
43934
43935
|
yield* runForEach(serverSettings.streamChanges, () => publishSnapshot).pipe(forkScoped);
|
|
43935
43936
|
yield* forever(sleep("15 seconds").pipe(andThen(publishMutex.withPermits(1)(gen(function* () {
|
|
43936
|
-
const now
|
|
43937
|
+
const now = yield* now$1;
|
|
43937
43938
|
yield* update$2(leasesRef, (leases) => {
|
|
43938
43939
|
const next = new Map(leases);
|
|
43939
|
-
for (const [key, lease] of next) if (!isLeaseActive(lease, now
|
|
43940
|
+
for (const [key, lease] of next) if (!isLeaseActive(lease, now)) next.delete(key);
|
|
43940
43941
|
return next;
|
|
43941
43942
|
});
|
|
43942
43943
|
yield* publishSnapshotUnlocked;
|
|
@@ -43964,8 +43965,8 @@ function nonNegativeInteger(value, fallback) {
|
|
|
43964
43965
|
if (!Number.isFinite(value)) return 0;
|
|
43965
43966
|
return Math.max(0, Math.round(value));
|
|
43966
43967
|
}
|
|
43967
|
-
const layer$
|
|
43968
|
-
const entries = yield* make$
|
|
43968
|
+
const layer$16 = effect(ResourceAttribution, fn("resourceTelemetry.resourceAttribution.make")(function* () {
|
|
43969
|
+
const entries = yield* make$63(/* @__PURE__ */ new Map());
|
|
43969
43970
|
const record = (input) => update$2(entries, (current) => {
|
|
43970
43971
|
const next = new Map(current);
|
|
43971
43972
|
const entryKey = key(input);
|
|
@@ -43984,7 +43985,7 @@ const layer$13 = effect(ResourceAttribution, fn("resourceTelemetry.resourceAttri
|
|
|
43984
43985
|
record,
|
|
43985
43986
|
snapshot: gen(function* () {
|
|
43986
43987
|
return {
|
|
43987
|
-
readAt: yield* now,
|
|
43988
|
+
readAt: yield* now$1,
|
|
43988
43989
|
entries: [...(yield* get$3(entries)).values()].toSorted((left, right) => right.logicalWriteBytes - left.logicalWriteBytes)
|
|
43989
43990
|
};
|
|
43990
43991
|
})
|
|
@@ -44101,7 +44102,7 @@ const layerFlusher = /*#__PURE__*/ sync$2(Flusher, () => {
|
|
|
44101
44102
|
* @category constructors
|
|
44102
44103
|
* @since 4.0.0
|
|
44103
44104
|
*/
|
|
44104
|
-
const make$
|
|
44105
|
+
const make$24 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
44105
44106
|
const services = yield* context();
|
|
44106
44107
|
const clock = get$5(services, Clock);
|
|
44107
44108
|
const scope = get$5(services, Scope);
|
|
@@ -44133,7 +44134,7 @@ const make$21 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
44133
44134
|
package: "@effect/opentelemetry",
|
|
44134
44135
|
module: options.label
|
|
44135
44136
|
}));
|
|
44136
|
-
const exportFibers = yield* make$
|
|
44137
|
+
const exportFibers = yield* make$65();
|
|
44137
44138
|
const runExportFork = yield* runtime(exportFibers)();
|
|
44138
44139
|
yield* (yield* Flusher).register(runExport);
|
|
44139
44140
|
yield* addFinalizer$1(scope, suspend(() => {
|
|
@@ -44171,7 +44172,7 @@ const make$21 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
44171
44172
|
* @category constructors
|
|
44172
44173
|
* @since 4.0.0
|
|
44173
44174
|
*/
|
|
44174
|
-
const make$
|
|
44175
|
+
const make$23 = (options) => {
|
|
44175
44176
|
const resourceAttributes = options.attributes ? entriesToAttributes(Object.entries(options.attributes)) : [];
|
|
44176
44177
|
resourceAttributes.push({
|
|
44177
44178
|
key: "service.name",
|
|
@@ -44218,7 +44219,7 @@ const fromConfig = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
44218
44219
|
};
|
|
44219
44220
|
delete attributes["service.name"];
|
|
44220
44221
|
delete attributes["service.version"];
|
|
44221
|
-
return make$
|
|
44222
|
+
return make$23({
|
|
44222
44223
|
serviceName,
|
|
44223
44224
|
serviceVersion,
|
|
44224
44225
|
attributes
|
|
@@ -44337,7 +44338,7 @@ const layerJson$1 = /*#__PURE__*/ succeed$3(OtlpSerialization, {
|
|
|
44337
44338
|
* @category constructors
|
|
44338
44339
|
* @since 4.0.0
|
|
44339
44340
|
*/
|
|
44340
|
-
const make$
|
|
44341
|
+
const make$22 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
44341
44342
|
const clock = yield* Clock;
|
|
44342
44343
|
const serialization = yield* OtlpSerialization;
|
|
44343
44344
|
const startTimeNanos = yield* clock.currentTimeNanos;
|
|
@@ -44618,7 +44619,7 @@ const make$19 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
44618
44619
|
}]
|
|
44619
44620
|
}] });
|
|
44620
44621
|
};
|
|
44621
|
-
yield* make$
|
|
44622
|
+
yield* make$24({
|
|
44622
44623
|
label: "OtlpMetrics",
|
|
44623
44624
|
url: options.url,
|
|
44624
44625
|
headers: options.headers,
|
|
@@ -44634,7 +44635,7 @@ const make$19 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
44634
44635
|
* @category layers
|
|
44635
44636
|
* @since 4.0.0
|
|
44636
44637
|
*/
|
|
44637
|
-
const layer$
|
|
44638
|
+
const layer$15 = (options) => effectDiscard(make$22(options)).pipe(provideMerge(layerFlusher));
|
|
44638
44639
|
/** Creates a unique key for a metric including its attributes */
|
|
44639
44640
|
const makeMetricKey = (id, attributes) => {
|
|
44640
44641
|
if (attributes === void 0 || Object.keys(attributes).length === 0) return id;
|
|
@@ -44729,11 +44730,11 @@ const EAggregationTemporality = {
|
|
|
44729
44730
|
* @category constructors
|
|
44730
44731
|
* @since 4.0.0
|
|
44731
44732
|
*/
|
|
44732
|
-
const make$
|
|
44733
|
+
const make$21 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
44733
44734
|
const otelResource = yield* fromConfig(options.resource);
|
|
44734
44735
|
const serialization = yield* OtlpSerialization;
|
|
44735
44736
|
const scope = { name: serviceNameUnsafe(otelResource) };
|
|
44736
|
-
const exporter = yield* make$
|
|
44737
|
+
const exporter = yield* make$24({
|
|
44737
44738
|
label: "OtlpTracer",
|
|
44738
44739
|
url: options.url,
|
|
44739
44740
|
headers: options.headers,
|
|
@@ -44755,7 +44756,7 @@ const make$18 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
44755
44756
|
if (!span.sampled) return;
|
|
44756
44757
|
exporter.push(makeOtlpSpan(span));
|
|
44757
44758
|
}
|
|
44758
|
-
return make$
|
|
44759
|
+
return make$77({
|
|
44759
44760
|
span(options) {
|
|
44760
44761
|
return makeSpan({
|
|
44761
44762
|
...options,
|
|
@@ -45273,8 +45274,8 @@ const makeLocalFileTracer = fn("makeLocalFileTracer")(function* (options) {
|
|
|
45273
45274
|
batchWindowMs: options.batchWindowMs,
|
|
45274
45275
|
...options.onFlush ? { onFlush: options.onFlush } : {}
|
|
45275
45276
|
}));
|
|
45276
|
-
const delegate = options.delegate ?? make$
|
|
45277
|
-
return make$
|
|
45277
|
+
const delegate = options.delegate ?? make$77({ span: (spanOptions) => new NativeSpan(spanOptions) });
|
|
45278
|
+
return make$77({
|
|
45278
45279
|
span(spanOptions) {
|
|
45279
45280
|
return new LocalFileSpan(spanOptions, delegate.span(spanOptions), sink.push);
|
|
45280
45281
|
},
|
|
@@ -45440,7 +45441,7 @@ const logT3ProjectFileLoadError = (error) => logWarning$1(error).pipe(annotateLo
|
|
|
45440
45441
|
filePath: error.filePath,
|
|
45441
45442
|
errorTag: error._tag
|
|
45442
45443
|
}));
|
|
45443
|
-
const layer$
|
|
45444
|
+
const layer$14 = effect(T3ProjectFileLoader, gen(function* () {
|
|
45444
45445
|
const fileSystem = yield* FileSystem;
|
|
45445
45446
|
const path = yield* Path;
|
|
45446
45447
|
const load = fn("T3ProjectFileLoader.load")(function* (workspaceRoot) {
|
|
@@ -45531,7 +45532,7 @@ function extractIconHref(source) {
|
|
|
45531
45532
|
return null;
|
|
45532
45533
|
}
|
|
45533
45534
|
const optionOnNotFound$1 = (effect) => effect.pipe(map$4(some), catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? succeed$1(none()) : fail(error) }));
|
|
45534
|
-
const layer$
|
|
45535
|
+
const layer$13 = effect(ProjectFaviconResolver, gen(function* () {
|
|
45535
45536
|
const fileSystem = yield* FileSystem;
|
|
45536
45537
|
const path = yield* Path;
|
|
45537
45538
|
const workspacePaths = yield* WorkspacePaths;
|
|
@@ -45873,10 +45874,10 @@ const resolveAsset = fn("AssetAccess.resolveAsset")(function* (token, relativePa
|
|
|
45873
45874
|
//#endregion
|
|
45874
45875
|
//#region src/observability/BrowserTraceCollector.ts
|
|
45875
45876
|
var BrowserTraceCollector = class extends Service$2()("t3/observability/BrowserTraceCollector") {};
|
|
45876
|
-
const make$
|
|
45877
|
+
const make$18 = (sink) => BrowserTraceCollector.of({ record: (records) => sync(() => {
|
|
45877
45878
|
for (const record of records) sink.push(record);
|
|
45878
45879
|
}) });
|
|
45879
|
-
const layer$
|
|
45880
|
+
const layer$12 = (sink) => succeed$3(BrowserTraceCollector, make$18(sink));
|
|
45880
45881
|
//#endregion
|
|
45881
45882
|
//#region src/auth/http.ts
|
|
45882
45883
|
const CREDENTIAL_RESPONSE_HEADERS = {
|
|
@@ -48793,7 +48794,7 @@ if (!(process.env.MSGPACKR_NATIVE_ACCELERATION_DISABLED !== void 0 && process.en
|
|
|
48793
48794
|
let extractor;
|
|
48794
48795
|
try {
|
|
48795
48796
|
if (typeof __require == "function") extractor = require_msgpackr_extract();
|
|
48796
|
-
else extractor = createRequire(import.meta.url)("msgpackr-extract");
|
|
48797
|
+
else extractor = createRequire$1(import.meta.url)("msgpackr-extract");
|
|
48797
48798
|
if (extractor) setExtractor(extractor.extractStrings);
|
|
48798
48799
|
} catch (error) {}
|
|
48799
48800
|
}
|
|
@@ -49198,6 +49199,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49198
49199
|
const services = yield* context();
|
|
49199
49200
|
const scope = get$5(services, Scope);
|
|
49200
49201
|
const entries = /* @__PURE__ */ new Map();
|
|
49202
|
+
const hooks = yield* serviceOption(RequestHooks);
|
|
49201
49203
|
let isShutdown = false;
|
|
49202
49204
|
yield* addFinalizer$1(scope, withFiber$1((parent) => {
|
|
49203
49205
|
isShutdown = true;
|
|
@@ -49228,6 +49230,11 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49228
49230
|
const onEffectRequest = (rpc, middleware, span, payload, headers, context, discard) => withFiber$1((parentFiber) => {
|
|
49229
49231
|
if (isShutdown) return interrupt$1;
|
|
49230
49232
|
const id = generateRequestId();
|
|
49233
|
+
const onStart = isSome(hooks) && hooks.value.onRequestStart ? hooks.value.onRequestStart({
|
|
49234
|
+
id,
|
|
49235
|
+
tag: rpc._tag,
|
|
49236
|
+
stream: false
|
|
49237
|
+
}) : void_$1;
|
|
49231
49238
|
const send = middleware((message) => options.onFromClient({
|
|
49232
49239
|
message,
|
|
49233
49240
|
context,
|
|
@@ -49244,7 +49251,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49244
49251
|
} : {},
|
|
49245
49252
|
headers: merge(parentFiber.getRef(CurrentHeaders), headers)
|
|
49246
49253
|
});
|
|
49247
|
-
if (discard) return send;
|
|
49254
|
+
if (discard) return onStart.pipe(andThen(send));
|
|
49248
49255
|
let fiber;
|
|
49249
49256
|
return onInterrupt(callback((resume) => {
|
|
49250
49257
|
const entry = {
|
|
@@ -49259,13 +49266,14 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49259
49266
|
}
|
|
49260
49267
|
};
|
|
49261
49268
|
entries.set(id, entry);
|
|
49262
|
-
fiber =
|
|
49269
|
+
fiber = onStart.pipe(andThen(send), span ? withParentSpan(span, { captureStackTrace: false }) : identity, runForkWith(parentFiber.context));
|
|
49263
49270
|
fiber.addObserver((exit) => {
|
|
49264
49271
|
if (exit._tag === "Failure") return resume(exit);
|
|
49265
49272
|
});
|
|
49266
49273
|
}), (interruptors) => {
|
|
49274
|
+
const entry = entries.get(id);
|
|
49267
49275
|
entries.delete(id);
|
|
49268
|
-
return andThen(interrupt$4(fiber), sendInterrupt(id, Array.from(interruptors), context));
|
|
49276
|
+
return andThen(interrupt$4(fiber), sendInterrupt(id, Array.from(interruptors), context, entry?.rpc._tag));
|
|
49269
49277
|
});
|
|
49270
49278
|
});
|
|
49271
49279
|
const onStreamRequest = fnUntraced(function* (rpc, middleware, payload, headers, streamBufferSize, context) {
|
|
@@ -49273,11 +49281,17 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49273
49281
|
const span = disableTracing ? void 0 : yield* makeSpanScoped(`${spanPrefix}.${rpc._tag}`, { attributes: options.spanAttributes });
|
|
49274
49282
|
const fiber = getCurrent();
|
|
49275
49283
|
const id = generateRequestId();
|
|
49284
|
+
const onStart = isSome(hooks) && hooks.value.onRequestStart ? hooks.value.onRequestStart({
|
|
49285
|
+
id,
|
|
49286
|
+
tag: rpc._tag,
|
|
49287
|
+
stream: true
|
|
49288
|
+
}) : void_$1;
|
|
49276
49289
|
const scope = getUnsafe$1(fiber.context, Scope);
|
|
49277
49290
|
yield* addFinalizerExit(scope, (exit) => {
|
|
49278
|
-
|
|
49291
|
+
const entry = entries.get(id);
|
|
49292
|
+
if (!entry) return void_$1;
|
|
49279
49293
|
entries.delete(id);
|
|
49280
|
-
return sendInterrupt(id, isFailure(exit) ? Array.from(interruptors(exit.cause)) : [], context);
|
|
49294
|
+
return sendInterrupt(id, isFailure(exit) ? Array.from(interruptors(exit.cause)) : [], context, entry.rpc._tag);
|
|
49281
49295
|
});
|
|
49282
49296
|
const queue = yield* bounded(streamBufferSize);
|
|
49283
49297
|
entries.set(id, {
|
|
@@ -49285,9 +49299,10 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49285
49299
|
rpc,
|
|
49286
49300
|
queue,
|
|
49287
49301
|
scope,
|
|
49288
|
-
context
|
|
49302
|
+
context,
|
|
49303
|
+
chunkCount: 0
|
|
49289
49304
|
});
|
|
49290
|
-
yield* middleware((message) => options.onFromClient({
|
|
49305
|
+
yield* onStart.pipe(andThen(middleware((message) => options.onFromClient({
|
|
49291
49306
|
message,
|
|
49292
49307
|
context,
|
|
49293
49308
|
discard: false
|
|
@@ -49302,7 +49317,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49302
49317
|
sampled: span.sampled
|
|
49303
49318
|
} : {},
|
|
49304
49319
|
headers: merge(fiber.getRef(CurrentHeaders), headers)
|
|
49305
|
-
}).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, catchCause((error) => failCause$3(queue, error)), interruptible, forkIn(scope, { startImmediately: true }));
|
|
49320
|
+
}))).pipe(span ? withParentSpan(span, { captureStackTrace: false }) : identity, catchCause((error) => failCause$3(queue, error)), interruptible, forkIn(scope, { startImmediately: true }));
|
|
49306
49321
|
return queue;
|
|
49307
49322
|
});
|
|
49308
49323
|
const getRpcClientMiddleware = (rpc) => {
|
|
@@ -49324,7 +49339,10 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49324
49339
|
});
|
|
49325
49340
|
};
|
|
49326
49341
|
};
|
|
49327
|
-
const sendInterrupt = (requestId, interruptors, context) =>
|
|
49342
|
+
const sendInterrupt = (requestId, interruptors, context, tag) => (isSome(hooks) && hooks.value.onRequestInterrupt ? hooks.value.onRequestInterrupt({
|
|
49343
|
+
id: requestId,
|
|
49344
|
+
tag
|
|
49345
|
+
}) : void_$1).pipe(andThen(callback((resume) => {
|
|
49328
49346
|
const parentFiber = getCurrent();
|
|
49329
49347
|
options.onFromClient({
|
|
49330
49348
|
message: {
|
|
@@ -49337,14 +49355,20 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49337
49355
|
}).pipe(timeout(1e3), runForkWith(parentFiber.context)).addObserver(() => {
|
|
49338
49356
|
resume(void_$1);
|
|
49339
49357
|
});
|
|
49340
|
-
});
|
|
49358
|
+
})));
|
|
49341
49359
|
const write = (message) => {
|
|
49342
49360
|
switch (message._tag) {
|
|
49343
49361
|
case "Chunk": {
|
|
49344
49362
|
const requestId = message.requestId;
|
|
49345
49363
|
const entry = entries.get(requestId);
|
|
49346
49364
|
if (!entry || entry._tag !== "Queue") return void_$1;
|
|
49347
|
-
|
|
49365
|
+
const chunkCount = entry.chunkCount += message.values.length;
|
|
49366
|
+
const onChunk = isSome(hooks) && hooks.value.onRequestChunk ? hooks.value.onRequestChunk({
|
|
49367
|
+
id: requestId,
|
|
49368
|
+
tag: entry.rpc._tag,
|
|
49369
|
+
chunkCount
|
|
49370
|
+
}) : void_$1;
|
|
49371
|
+
return offerAll(entry.queue, message.values).pipe(andThen(onChunk), supportsAck ? flatMap$1(() => options.onFromClient({
|
|
49348
49372
|
message: {
|
|
49349
49373
|
_tag: "Ack",
|
|
49350
49374
|
requestId: message.requestId
|
|
@@ -49358,11 +49382,16 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
49358
49382
|
const entry = entries.get(requestId);
|
|
49359
49383
|
if (!entry) return void_$1;
|
|
49360
49384
|
entries.delete(requestId);
|
|
49361
|
-
|
|
49385
|
+
const onExit = isSome(hooks) && hooks.value.onRequestExit ? hooks.value.onRequestExit({
|
|
49386
|
+
id: requestId,
|
|
49387
|
+
tag: entry.rpc._tag,
|
|
49388
|
+
stream: entry._tag === "Queue",
|
|
49389
|
+
exit: message.exit
|
|
49390
|
+
}) : void_$1;
|
|
49391
|
+
if (entry._tag === "Effect") return onExit.pipe(andThen(sync(() => {
|
|
49362
49392
|
entry.resume(message.exit);
|
|
49363
|
-
|
|
49364
|
-
|
|
49365
|
-
return message.exit._tag === "Success" ? end(entry.queue) : failCause$3(entry.queue, message.exit.cause);
|
|
49393
|
+
})));
|
|
49394
|
+
return onExit.pipe(andThen(message.exit._tag === "Success" ? end(entry.queue) : failCause$3(entry.queue, message.exit.cause)));
|
|
49366
49395
|
}
|
|
49367
49396
|
case "Defect": return clearEntries(die$1(message.defect));
|
|
49368
49397
|
case "ClientEnd": return void_$1;
|
|
@@ -49398,7 +49427,7 @@ let clientIdCounter = 0;
|
|
|
49398
49427
|
* @category constructors
|
|
49399
49428
|
* @since 4.0.0
|
|
49400
49429
|
*/
|
|
49401
|
-
const make$
|
|
49430
|
+
const make$17 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
49402
49431
|
const clientId = clientIdCounter++;
|
|
49403
49432
|
const { run, send, supportsAck, supportsTransferables } = yield* Protocol$1;
|
|
49404
49433
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -49543,6 +49572,11 @@ var Protocol$1 = class extends Service$2()("effect/rpc/RpcClient/Protocol") {
|
|
|
49543
49572
|
*/
|
|
49544
49573
|
static make = withRunClient;
|
|
49545
49574
|
};
|
|
49575
|
+
/**
|
|
49576
|
+
* @since 4.0.0
|
|
49577
|
+
* @category RequestHooks
|
|
49578
|
+
*/
|
|
49579
|
+
var RequestHooks = class extends Service$2()("effect/rpc/RpcClient/RequestHooks") {};
|
|
49546
49580
|
Service$2()("effect/rpc/RpcClient/ConnectionHooks");
|
|
49547
49581
|
const decodeDefect = /*#__PURE__*/ decodeSync(/*#__PURE__*/ Defect());
|
|
49548
49582
|
//#endregion
|
|
@@ -49565,7 +49599,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
49565
49599
|
const services = yield* context();
|
|
49566
49600
|
const scope = get$5(services, Scope);
|
|
49567
49601
|
const trackFiber = runIn(forkUnsafe(scope, "parallel"));
|
|
49568
|
-
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$
|
|
49602
|
+
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$75(concurrency);
|
|
49569
49603
|
const clients = /* @__PURE__ */ new Map();
|
|
49570
49604
|
let isShutdown = false;
|
|
49571
49605
|
const shutdownLatch = makeUnsafe$7(false);
|
|
@@ -49801,10 +49835,10 @@ const applyMiddleware = (context, handler, options) => {
|
|
|
49801
49835
|
* @category running
|
|
49802
49836
|
* @since 4.0.0
|
|
49803
49837
|
*/
|
|
49804
|
-
const make$
|
|
49838
|
+
const make$16 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
49805
49839
|
const { disconnects, end, run, send, supportsAck, supportsSpanPropagation, supportsTransferables } = yield* Protocol;
|
|
49806
49840
|
const services = yield* context();
|
|
49807
|
-
const scope = yield* make$
|
|
49841
|
+
const scope = yield* make$76();
|
|
49808
49842
|
const server = yield* makeNoSerialization(group, {
|
|
49809
49843
|
...options,
|
|
49810
49844
|
disableClientAcks: !supportsAck,
|
|
@@ -49992,12 +50026,12 @@ const makeProtocolWithHttpEffectWebsocket = /*#__PURE__*/ gen(function* () {
|
|
|
49992
50026
|
*/
|
|
49993
50027
|
const toHttpEffectWebsocket = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
49994
50028
|
const { httpEffect, protocol } = yield* makeProtocolWithHttpEffectWebsocket;
|
|
49995
|
-
yield* make$
|
|
50029
|
+
yield* make$16(group, options).pipe(provideService(Protocol, protocol), forkScoped);
|
|
49996
50030
|
return httpEffect;
|
|
49997
50031
|
});
|
|
49998
50032
|
const makeSocketProtocol = /*#__PURE__*/ gen(function* () {
|
|
49999
50033
|
const serialization = yield* RpcSerialization;
|
|
50000
|
-
const disconnects = yield* make$
|
|
50034
|
+
const disconnects = yield* make$78();
|
|
50001
50035
|
let clientId = 0;
|
|
50002
50036
|
const clients = /* @__PURE__ */ new Map();
|
|
50003
50037
|
const clientIds = /* @__PURE__ */ new Set();
|
|
@@ -50072,8 +50106,8 @@ var ProviderRegistry = class extends Service$2()("t3/provider/Services/ProviderR
|
|
|
50072
50106
|
//#endregion
|
|
50073
50107
|
//#region src/provider/providerMaintenanceCommandCoordinator.ts
|
|
50074
50108
|
const makeProviderMaintenanceCommandCoordinator = fn("makeProviderMaintenanceCommandCoordinator")(function* (input) {
|
|
50075
|
-
const runningTargetsRef = yield* make$
|
|
50076
|
-
const locksRef = yield* make$
|
|
50109
|
+
const runningTargetsRef = yield* make$63(/* @__PURE__ */ new Set());
|
|
50110
|
+
const locksRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
50077
50111
|
const acquireTarget = fn("acquireTarget")(function* (targetKey) {
|
|
50078
50112
|
return yield* modify$2(runningTargetsRef, (runningTargets) => {
|
|
50079
50113
|
if (runningTargets.has(targetKey)) return [false, runningTargets];
|
|
@@ -50090,7 +50124,7 @@ const makeProviderMaintenanceCommandCoordinator = fn("makeProviderMaintenanceCom
|
|
|
50090
50124
|
const getLock = fn("getProviderMaintenanceCommandLock")(function* (lockKey) {
|
|
50091
50125
|
const existing = (yield* get$3(locksRef)).get(lockKey);
|
|
50092
50126
|
if (existing) return existing;
|
|
50093
|
-
const lock = yield* make$
|
|
50127
|
+
const lock = yield* make$75(1);
|
|
50094
50128
|
return yield* modify$2(locksRef, (locks) => {
|
|
50095
50129
|
const current = locks.get(lockKey);
|
|
50096
50130
|
if (current) return [current, locks];
|
|
@@ -50416,11 +50450,11 @@ const resolveLatestProviderVersion = fn("resolveLatestProviderVersion")(function
|
|
|
50416
50450
|
if (!packageName) return null;
|
|
50417
50451
|
const latestVersionCache = yield* ProviderVersionCache;
|
|
50418
50452
|
const cached = latestVersionCache.get(packageName);
|
|
50419
|
-
const now
|
|
50420
|
-
if (cached && cached.expiresAt > now
|
|
50453
|
+
const now = toEpochMillis(yield* now$1);
|
|
50454
|
+
if (cached && cached.expiresAt > now) return cached.version;
|
|
50421
50455
|
const version = yield* fetchNpmLatestVersion(packageName);
|
|
50422
50456
|
latestVersionCache.set(packageName, {
|
|
50423
|
-
expiresAt: now
|
|
50457
|
+
expiresAt: now + LATEST_VERSION_CACHE_TTL_MS,
|
|
50424
50458
|
version
|
|
50425
50459
|
});
|
|
50426
50460
|
return version;
|
|
@@ -50443,7 +50477,7 @@ const enrichProviderSnapshotWithVersionAdvisory = fn("enrichProviderSnapshotWith
|
|
|
50443
50477
|
driver: snapshot.driver,
|
|
50444
50478
|
currentVersion: snapshot.version,
|
|
50445
50479
|
latestVersion,
|
|
50446
|
-
checkedAt: formatIso(yield* now),
|
|
50480
|
+
checkedAt: formatIso(yield* now$1),
|
|
50447
50481
|
maintenanceCapabilities: capabilities
|
|
50448
50482
|
})
|
|
50449
50483
|
};
|
|
@@ -50455,11 +50489,11 @@ const UPDATE_TIMEOUT_MS = 5 * 6e4;
|
|
|
50455
50489
|
const UPDATE_OUTPUT_MAX_BYTES = 1e4;
|
|
50456
50490
|
var ProviderMaintenanceRunner = class extends Service$2()("t3/provider/providerMaintenanceRunner") {};
|
|
50457
50491
|
var ProviderMaintenanceCommandError = class extends TaggedError("ProviderMaintenanceCommandError") {};
|
|
50458
|
-
const nowIso$3 = map$4(now, formatIso);
|
|
50492
|
+
const nowIso$3 = map$4(now$1, formatIso);
|
|
50459
50493
|
const runProviderMaintenanceCommandWithSpawner = fn("ProviderMaintenanceRunner.runCommand")(function* (input) {
|
|
50460
50494
|
return yield* fn("ProviderMaintenanceRunner.collectCommandResult")(function* () {
|
|
50461
50495
|
const resolved = yield* resolveSpawnCommand(input.command, input.args);
|
|
50462
|
-
const child = yield* input.spawner.spawn(make$
|
|
50496
|
+
const child = yield* input.spawner.spawn(make$79(resolved.command, resolved.args, { shell: resolved.shell })).pipe(mapError((cause) => new ProviderMaintenanceCommandError({
|
|
50463
50497
|
message: `Failed to run update command ${input.command}: ${cause.message}`,
|
|
50464
50498
|
cause
|
|
50465
50499
|
})));
|
|
@@ -50527,7 +50561,7 @@ function makeUpdateState(input) {
|
|
|
50527
50561
|
output: input.output ?? null
|
|
50528
50562
|
};
|
|
50529
50563
|
}
|
|
50530
|
-
const layer$
|
|
50564
|
+
const layer$11 = effect(ProviderMaintenanceRunner, fn("ProviderMaintenanceRunner.make")(function* () {
|
|
50531
50565
|
const providerRegistry = yield* ProviderRegistry;
|
|
50532
50566
|
const spawner = yield* ChildProcessSpawner;
|
|
50533
50567
|
const httpClient = yield* HttpClient;
|
|
@@ -50587,7 +50621,7 @@ const layer$8 = effect(ProviderMaintenanceRunner, fn("ProviderMaintenanceRunner.
|
|
|
50587
50621
|
})).pipe(asVoid);
|
|
50588
50622
|
const runProviderUpdate = fn("ProviderMaintenanceRunner.runProviderUpdate")(function* () {
|
|
50589
50623
|
const finish = (state) => setUpdateState(state).pipe(map$4((providers) => ({ providers })));
|
|
50590
|
-
const startedAtRef = yield* make$
|
|
50624
|
+
const startedAtRef = yield* make$63(null);
|
|
50591
50625
|
const runCommandAndVerify = fn("ProviderMaintenanceRunner.runCommandAndVerify")(function* () {
|
|
50592
50626
|
const startedAt = yield* nowIso$3;
|
|
50593
50627
|
yield* set$2(startedAtRef, startedAt);
|
|
@@ -50827,7 +50861,7 @@ const canonicalizeClientCommandTimestamps = (command, receivedAt) => {
|
|
|
50827
50861
|
};
|
|
50828
50862
|
};
|
|
50829
50863
|
const normalizeDispatchCommand = (command) => gen(function* () {
|
|
50830
|
-
const receivedAt = formatIso(yield* now);
|
|
50864
|
+
const receivedAt = formatIso(yield* now$1);
|
|
50831
50865
|
const canonicalCommand = canonicalizeClientCommandTimestamps(command, receivedAt);
|
|
50832
50866
|
const fileSystem = yield* FileSystem;
|
|
50833
50867
|
const path = yield* Path;
|
|
@@ -51159,7 +51193,7 @@ const waitForIndexReady = fn("WorkspaceSearchIndex.waitForIndexReady")(function*
|
|
|
51159
51193
|
timeout: WORKSPACE_INDEX_SCAN_TIMEOUT
|
|
51160
51194
|
});
|
|
51161
51195
|
});
|
|
51162
|
-
const make$
|
|
51196
|
+
const make$14 = fn("WorkspaceSearchIndex.make")(function* (cwd, variant = "paths") {
|
|
51163
51197
|
const finder = yield* acquireRelease(createFinder(cwd, variant), (finder) => try_({
|
|
51164
51198
|
try: () => finder.destroy(),
|
|
51165
51199
|
catch: (cause) => new WorkspaceSearchIndexDestroyFailed({
|
|
@@ -51288,12 +51322,12 @@ function parseWorkspaceSearchIndexKey(key) {
|
|
|
51288
51322
|
* idle cleanup; using a default cwd here would mix resources from different
|
|
51289
51323
|
* workspaces.
|
|
51290
51324
|
*/
|
|
51291
|
-
const layer$
|
|
51325
|
+
const layer$10 = (key) => {
|
|
51292
51326
|
const { cwd, variant } = parseWorkspaceSearchIndexKey(key);
|
|
51293
|
-
return effect(WorkspaceSearchIndex, make$
|
|
51327
|
+
return effect(WorkspaceSearchIndex, make$14(cwd, variant));
|
|
51294
51328
|
};
|
|
51295
51329
|
var WorkspaceSearchIndexMap = class extends Service()("t3/workspace/WorkspaceSearchIndexMap", {
|
|
51296
|
-
lookup: layer$
|
|
51330
|
+
lookup: layer$10,
|
|
51297
51331
|
idleTimeToLive: WORKSPACE_INDEX_IDLE_TTL
|
|
51298
51332
|
}) {};
|
|
51299
51333
|
//#endregion
|
|
@@ -51355,7 +51389,7 @@ const resolveBrowseTarget = fn("WorkspaceEntries.resolveBrowseTarget")(function*
|
|
|
51355
51389
|
if (!input.cwd) return yield* new WorkspaceEntriesCurrentProjectRequiredError({ partialPath: input.partialPath });
|
|
51356
51390
|
return path.resolve(expandHomePath$1(input.cwd, path), input.partialPath);
|
|
51357
51391
|
});
|
|
51358
|
-
const layer$
|
|
51392
|
+
const layer$9 = effect(WorkspaceEntries, gen(function* () {
|
|
51359
51393
|
const path = yield* Path;
|
|
51360
51394
|
const workspacePaths = yield* WorkspacePaths;
|
|
51361
51395
|
const workspaceSearchIndexes = yield* WorkspaceSearchIndexMap;
|
|
@@ -51508,7 +51542,7 @@ Union([
|
|
|
51508
51542
|
]);
|
|
51509
51543
|
/** Service tag for workspace file operations. */
|
|
51510
51544
|
var WorkspaceFileSystem = class extends Service$2()("t3/workspace/WorkspaceFileSystem") {};
|
|
51511
|
-
const layer$
|
|
51545
|
+
const layer$8 = effect(WorkspaceFileSystem, gen(function* () {
|
|
51512
51546
|
const fileSystem = yield* FileSystem;
|
|
51513
51547
|
const path = yield* Path;
|
|
51514
51548
|
const workspacePaths = yield* WorkspacePaths;
|
|
@@ -51641,6 +51675,605 @@ const layer$5 = effect(WorkspaceFileSystem, gen(function* () {
|
|
|
51641
51675
|
});
|
|
51642
51676
|
}));
|
|
51643
51677
|
//#endregion
|
|
51678
|
+
//#region src/workspace/GitWorkspace.ts
|
|
51679
|
+
const EMPTY_WORKING_TREE = {
|
|
51680
|
+
files: [],
|
|
51681
|
+
insertions: 0,
|
|
51682
|
+
deletions: 0
|
|
51683
|
+
};
|
|
51684
|
+
function parseGitStatus(output) {
|
|
51685
|
+
const records = output.split("\0").filter(Boolean);
|
|
51686
|
+
const branchRecord = records[0]?.startsWith("## ") ? records.shift().slice(3) : "";
|
|
51687
|
+
let refName = null;
|
|
51688
|
+
if (branchRecord.startsWith("No commits yet on ")) refName = branchRecord.slice(18).trim() || null;
|
|
51689
|
+
else if (!branchRecord.startsWith("HEAD ")) refName = branchRecord.split("...")[0]?.trim() || null;
|
|
51690
|
+
const aheadCount = Number(/ahead (\d+)/.exec(branchRecord)?.[1] ?? 0);
|
|
51691
|
+
const behindCount = Number(/behind (\d+)/.exec(branchRecord)?.[1] ?? 0);
|
|
51692
|
+
const files = [];
|
|
51693
|
+
for (let index = 0; index < records.length; index += 1) {
|
|
51694
|
+
const record = records[index];
|
|
51695
|
+
const path = record.length > 3 ? record.slice(3) : "";
|
|
51696
|
+
if (path) files.push(path);
|
|
51697
|
+
if (record[0] === "R" || record[1] === "R") index += 1;
|
|
51698
|
+
}
|
|
51699
|
+
return {
|
|
51700
|
+
refName,
|
|
51701
|
+
hasUpstream: branchRecord.includes("..."),
|
|
51702
|
+
aheadCount,
|
|
51703
|
+
behindCount,
|
|
51704
|
+
files
|
|
51705
|
+
};
|
|
51706
|
+
}
|
|
51707
|
+
function parseGitRefs(output, refKind, query = "", currentRef = null) {
|
|
51708
|
+
const normalizedQuery = query.toLowerCase();
|
|
51709
|
+
return output.split("\n").filter(Boolean).flatMap((line) => {
|
|
51710
|
+
const [fullName = "", name = "", head = "", worktreePath = ""] = line.split(" ");
|
|
51711
|
+
if (!name || fullName.endsWith("/HEAD") || !name.toLowerCase().includes(normalizedQuery)) return [];
|
|
51712
|
+
const isRemote = fullName.startsWith("refs/remotes/");
|
|
51713
|
+
if (refKind === "local" && isRemote) return [];
|
|
51714
|
+
if (refKind === "remote" && !isRemote) return [];
|
|
51715
|
+
const firstSlash = name.indexOf("/");
|
|
51716
|
+
return [{
|
|
51717
|
+
name,
|
|
51718
|
+
...isRemote ? {
|
|
51719
|
+
isRemote: true,
|
|
51720
|
+
remoteName: name.slice(0, firstSlash)
|
|
51721
|
+
} : {},
|
|
51722
|
+
current: head.trim() === "*" || name === currentRef,
|
|
51723
|
+
isDefault: false,
|
|
51724
|
+
worktreePath: worktreePath || null
|
|
51725
|
+
}];
|
|
51726
|
+
});
|
|
51727
|
+
}
|
|
51728
|
+
var GitWorkspace = class extends Service$2()("agentlink/workspace/GitWorkspace") {};
|
|
51729
|
+
const layer$7 = effect(GitWorkspace, gen(function* () {
|
|
51730
|
+
const runner = yield* ProcessRunner;
|
|
51731
|
+
const run = fn("GitWorkspace.run")(function* (cwd, operation, args, allowFailure = false) {
|
|
51732
|
+
const result = yield* runner.run({
|
|
51733
|
+
command: "git",
|
|
51734
|
+
args,
|
|
51735
|
+
cwd,
|
|
51736
|
+
timeout: "15 seconds",
|
|
51737
|
+
maxOutputBytes: 2 * 1024 * 1024,
|
|
51738
|
+
outputMode: "truncate"
|
|
51739
|
+
}).pipe(mapError((cause) => new GitCommandError({
|
|
51740
|
+
operation,
|
|
51741
|
+
command: "git",
|
|
51742
|
+
cwd,
|
|
51743
|
+
argumentCount: args.length,
|
|
51744
|
+
detail: cause.message,
|
|
51745
|
+
cause
|
|
51746
|
+
})));
|
|
51747
|
+
if (!allowFailure && result.code !== 0) return yield* new GitCommandError({
|
|
51748
|
+
operation,
|
|
51749
|
+
command: "git",
|
|
51750
|
+
cwd,
|
|
51751
|
+
argumentCount: args.length,
|
|
51752
|
+
exitCode: result.code ?? void 0,
|
|
51753
|
+
stdoutLength: result.stdout.length,
|
|
51754
|
+
stderrLength: result.stderr.length,
|
|
51755
|
+
outputLength: result.stdout.length + result.stderr.length,
|
|
51756
|
+
detail: result.stderr.trim() || result.stdout.trim() || "Git command failed."
|
|
51757
|
+
});
|
|
51758
|
+
return result;
|
|
51759
|
+
});
|
|
51760
|
+
const status = fn("GitWorkspace.status")(function* (cwd) {
|
|
51761
|
+
const repository = yield* run(cwd, "status.detect", ["rev-parse", "--is-inside-work-tree"], true);
|
|
51762
|
+
if (repository.code !== 0 || repository.stdout.trim() !== "true") return {
|
|
51763
|
+
isRepo: false,
|
|
51764
|
+
hasPrimaryRemote: false,
|
|
51765
|
+
isDefaultRef: false,
|
|
51766
|
+
refName: null,
|
|
51767
|
+
hasWorkingTreeChanges: false,
|
|
51768
|
+
workingTree: EMPTY_WORKING_TREE,
|
|
51769
|
+
hasUpstream: false,
|
|
51770
|
+
aheadCount: 0,
|
|
51771
|
+
behindCount: 0,
|
|
51772
|
+
aheadOfDefaultCount: 0,
|
|
51773
|
+
pr: null
|
|
51774
|
+
};
|
|
51775
|
+
const parsed = parseGitStatus((yield* run(cwd, "status", [
|
|
51776
|
+
"status",
|
|
51777
|
+
"--porcelain=v1",
|
|
51778
|
+
"-z",
|
|
51779
|
+
"--branch",
|
|
51780
|
+
"--untracked-files=normal"
|
|
51781
|
+
])).stdout);
|
|
51782
|
+
const [origin, defaultRef] = yield* all([run(cwd, "remote.origin", [
|
|
51783
|
+
"remote",
|
|
51784
|
+
"get-url",
|
|
51785
|
+
"origin"
|
|
51786
|
+
], true), run(cwd, "remote.default", [
|
|
51787
|
+
"symbolic-ref",
|
|
51788
|
+
"refs/remotes/origin/HEAD",
|
|
51789
|
+
"--short"
|
|
51790
|
+
], true)]);
|
|
51791
|
+
return {
|
|
51792
|
+
isRepo: true,
|
|
51793
|
+
hasPrimaryRemote: origin.code === 0,
|
|
51794
|
+
isDefaultRef: defaultRef.code === 0 && defaultRef.stdout.trim().replace(/^origin\//, "") === parsed.refName,
|
|
51795
|
+
refName: parsed.refName,
|
|
51796
|
+
hasWorkingTreeChanges: parsed.files.length > 0,
|
|
51797
|
+
workingTree: {
|
|
51798
|
+
files: parsed.files.map((path) => ({
|
|
51799
|
+
path,
|
|
51800
|
+
insertions: 0,
|
|
51801
|
+
deletions: 0
|
|
51802
|
+
})),
|
|
51803
|
+
insertions: 0,
|
|
51804
|
+
deletions: 0
|
|
51805
|
+
},
|
|
51806
|
+
hasUpstream: parsed.hasUpstream,
|
|
51807
|
+
aheadCount: parsed.aheadCount,
|
|
51808
|
+
behindCount: parsed.behindCount,
|
|
51809
|
+
aheadOfDefaultCount: 0,
|
|
51810
|
+
pr: null
|
|
51811
|
+
};
|
|
51812
|
+
});
|
|
51813
|
+
const listRefs = fn("GitWorkspace.listRefs")(function* (input) {
|
|
51814
|
+
const currentStatus = yield* status(input.cwd);
|
|
51815
|
+
if (!currentStatus.isRepo) return {
|
|
51816
|
+
refs: [],
|
|
51817
|
+
isRepo: false,
|
|
51818
|
+
hasPrimaryRemote: false,
|
|
51819
|
+
nextCursor: null,
|
|
51820
|
+
totalCount: 0
|
|
51821
|
+
};
|
|
51822
|
+
const refs = parseGitRefs((yield* run(input.cwd, "refs.list", [
|
|
51823
|
+
"for-each-ref",
|
|
51824
|
+
"--format=%(refname) %(refname:short) %(HEAD) %(worktreepath)",
|
|
51825
|
+
"refs/heads",
|
|
51826
|
+
"refs/remotes"
|
|
51827
|
+
])).stdout, input.refKind, input.query ?? "", currentStatus.refName);
|
|
51828
|
+
const cursor = input.cursor ?? 0;
|
|
51829
|
+
const limit = input.limit ?? 100;
|
|
51830
|
+
const page = refs.slice(cursor, cursor + limit);
|
|
51831
|
+
return {
|
|
51832
|
+
refs: page,
|
|
51833
|
+
isRepo: true,
|
|
51834
|
+
hasPrimaryRemote: currentStatus.hasPrimaryRemote,
|
|
51835
|
+
nextCursor: cursor + page.length < refs.length ? cursor + page.length : null,
|
|
51836
|
+
totalCount: refs.length
|
|
51837
|
+
};
|
|
51838
|
+
});
|
|
51839
|
+
const switchRef = fn("GitWorkspace.switchRef")(function* (input) {
|
|
51840
|
+
yield* run(input.cwd, "refs.switch", ["switch", input.refName]);
|
|
51841
|
+
return { refName: (yield* status(input.cwd)).refName };
|
|
51842
|
+
});
|
|
51843
|
+
return GitWorkspace.of({
|
|
51844
|
+
status,
|
|
51845
|
+
statusStream: (cwd) => fromEffectSchedule(status(cwd), spaced("3 seconds")).pipe(map$8((value) => ({
|
|
51846
|
+
_tag: "snapshot",
|
|
51847
|
+
local: {
|
|
51848
|
+
isRepo: value.isRepo,
|
|
51849
|
+
hasPrimaryRemote: value.hasPrimaryRemote,
|
|
51850
|
+
isDefaultRef: value.isDefaultRef,
|
|
51851
|
+
refName: value.refName,
|
|
51852
|
+
hasWorkingTreeChanges: value.hasWorkingTreeChanges,
|
|
51853
|
+
workingTree: value.workingTree
|
|
51854
|
+
},
|
|
51855
|
+
remote: value.isRepo ? {
|
|
51856
|
+
hasUpstream: value.hasUpstream,
|
|
51857
|
+
aheadCount: value.aheadCount,
|
|
51858
|
+
behindCount: value.behindCount,
|
|
51859
|
+
aheadOfDefaultCount: value.aheadOfDefaultCount,
|
|
51860
|
+
pr: value.pr
|
|
51861
|
+
} : null
|
|
51862
|
+
}))),
|
|
51863
|
+
listRefs,
|
|
51864
|
+
switchRef
|
|
51865
|
+
});
|
|
51866
|
+
})).pipe(provide(layer$30));
|
|
51867
|
+
//#endregion
|
|
51868
|
+
//#region src/terminal/PtyAdapter.ts
|
|
51869
|
+
/**
|
|
51870
|
+
* PtyAdapter - Terminal PTY adapter service contract.
|
|
51871
|
+
*
|
|
51872
|
+
* Defines the process primitives required by terminal session management
|
|
51873
|
+
* without binding to a specific PTY implementation.
|
|
51874
|
+
*
|
|
51875
|
+
* @module PtyAdapter
|
|
51876
|
+
*/
|
|
51877
|
+
/**
|
|
51878
|
+
* PtySpawnError - Error type for PTY spawn failures.
|
|
51879
|
+
*/
|
|
51880
|
+
var PtySpawnError = class extends TaggedErrorClass()("PtySpawnError", {
|
|
51881
|
+
adapter: String$1,
|
|
51882
|
+
shell: optional$3(String$1),
|
|
51883
|
+
attemptedShells: optional$3(ArraySchema(String$1)),
|
|
51884
|
+
cause: optional$3(Defect())
|
|
51885
|
+
}) {
|
|
51886
|
+
get message() {
|
|
51887
|
+
const shell = this.shell === void 0 ? "" : ` '${this.shell}'`;
|
|
51888
|
+
const attemptedShells = this.attemptedShells === void 0 || this.attemptedShells.length === 0 ? "" : ` Tried shells: ${this.attemptedShells.join(", ")}.`;
|
|
51889
|
+
return `Failed to spawn PTY process${shell} with ${this.adapter}.${attemptedShells}`;
|
|
51890
|
+
}
|
|
51891
|
+
};
|
|
51892
|
+
/**
|
|
51893
|
+
* PtyAdapter - Service tag for PTY process integration.
|
|
51894
|
+
*/
|
|
51895
|
+
var PtyAdapter = class extends Service$2()("t3/terminal/PtyAdapter") {};
|
|
51896
|
+
//#endregion
|
|
51897
|
+
//#region src/terminal/Manager.ts
|
|
51898
|
+
const DEFAULT_COLS = 120;
|
|
51899
|
+
const DEFAULT_ROWS = 30;
|
|
51900
|
+
var TerminalManager = class extends Service$2()("agentlink/terminal/TerminalManager") {};
|
|
51901
|
+
function sessionKey(threadId, terminalId) {
|
|
51902
|
+
return `${threadId}\0${terminalId}`;
|
|
51903
|
+
}
|
|
51904
|
+
function now() {
|
|
51905
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
51906
|
+
}
|
|
51907
|
+
function label(session) {
|
|
51908
|
+
return session.status === "running" ? "Terminal" : "Terminal (stopped)";
|
|
51909
|
+
}
|
|
51910
|
+
function snapshot(session) {
|
|
51911
|
+
return {
|
|
51912
|
+
threadId: session.threadId,
|
|
51913
|
+
terminalId: session.terminalId,
|
|
51914
|
+
cwd: session.cwd,
|
|
51915
|
+
worktreePath: session.worktreePath,
|
|
51916
|
+
status: session.status,
|
|
51917
|
+
pid: session.process?.pid ?? null,
|
|
51918
|
+
history: session.history,
|
|
51919
|
+
exitCode: session.exitCode,
|
|
51920
|
+
exitSignal: session.exitSignal,
|
|
51921
|
+
label: label(session),
|
|
51922
|
+
updatedAt: session.updatedAt,
|
|
51923
|
+
sequence: session.sequence
|
|
51924
|
+
};
|
|
51925
|
+
}
|
|
51926
|
+
function summary(session) {
|
|
51927
|
+
return {
|
|
51928
|
+
threadId: session.threadId,
|
|
51929
|
+
terminalId: session.terminalId,
|
|
51930
|
+
cwd: session.cwd,
|
|
51931
|
+
worktreePath: session.worktreePath,
|
|
51932
|
+
status: session.status,
|
|
51933
|
+
pid: session.process?.pid ?? null,
|
|
51934
|
+
exitCode: session.exitCode,
|
|
51935
|
+
exitSignal: session.exitSignal,
|
|
51936
|
+
hasRunningSubprocess: false,
|
|
51937
|
+
label: label(session),
|
|
51938
|
+
updatedAt: session.updatedAt
|
|
51939
|
+
};
|
|
51940
|
+
}
|
|
51941
|
+
function validateCwd(cwd) {
|
|
51942
|
+
return tryPromise({
|
|
51943
|
+
try: () => NodeFSP.stat(cwd),
|
|
51944
|
+
catch: (cause) => {
|
|
51945
|
+
return cause.code === "ENOENT" ? new TerminalCwdNotFoundError({ cwd }) : new TerminalCwdStatError({
|
|
51946
|
+
cwd,
|
|
51947
|
+
cause
|
|
51948
|
+
});
|
|
51949
|
+
}
|
|
51950
|
+
}).pipe(flatMap$1((stat) => stat.isDirectory() ? void_$1 : new TerminalCwdNotDirectoryError({ cwd })));
|
|
51951
|
+
}
|
|
51952
|
+
const layer$6 = effect(TerminalManager, gen(function* () {
|
|
51953
|
+
const pty = yield* PtyAdapter;
|
|
51954
|
+
const runFork = runForkWith(yield* context());
|
|
51955
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
51956
|
+
const eventListeners = /* @__PURE__ */ new Set();
|
|
51957
|
+
const metadataListeners = /* @__PURE__ */ new Set();
|
|
51958
|
+
const attachListeners = /* @__PURE__ */ new Map();
|
|
51959
|
+
const publish = (event) => {
|
|
51960
|
+
if (eventListeners.size > 0) runFork(forEach(eventListeners, (listener) => listener(event), { discard: true }));
|
|
51961
|
+
if (event.type !== "started") {
|
|
51962
|
+
const listeners = attachListeners.get(sessionKey(event.threadId, event.terminalId));
|
|
51963
|
+
if (listeners && listeners.size > 0) runFork(forEach(listeners, (listener) => listener(event), { discard: true }));
|
|
51964
|
+
}
|
|
51965
|
+
};
|
|
51966
|
+
const publishMetadata = (event) => {
|
|
51967
|
+
if (metadataListeners.size > 0) runFork(forEach(metadataListeners, (listener) => listener(event), { discard: true }));
|
|
51968
|
+
};
|
|
51969
|
+
const touch = (session) => {
|
|
51970
|
+
session.updatedAt = now();
|
|
51971
|
+
session.sequence += 1;
|
|
51972
|
+
};
|
|
51973
|
+
const stop = (session) => {
|
|
51974
|
+
session.unsubscribeData?.();
|
|
51975
|
+
session.unsubscribeExit?.();
|
|
51976
|
+
session.unsubscribeData = null;
|
|
51977
|
+
session.unsubscribeExit = null;
|
|
51978
|
+
if (session.process) {
|
|
51979
|
+
try {
|
|
51980
|
+
session.process.kill();
|
|
51981
|
+
} catch {}
|
|
51982
|
+
session.process = null;
|
|
51983
|
+
}
|
|
51984
|
+
};
|
|
51985
|
+
const spawn = fn("TerminalManager.spawn")(function* (session) {
|
|
51986
|
+
session.status = "starting";
|
|
51987
|
+
session.exitCode = null;
|
|
51988
|
+
session.exitSignal = null;
|
|
51989
|
+
touch(session);
|
|
51990
|
+
const candidates = [
|
|
51991
|
+
process.env.SHELL,
|
|
51992
|
+
process.platform === "win32" ? process.env.ComSpec : void 0,
|
|
51993
|
+
process.platform === "win32" ? "powershell.exe" : "/bin/zsh",
|
|
51994
|
+
process.platform === "win32" ? "cmd.exe" : "/bin/bash",
|
|
51995
|
+
process.platform === "win32" ? void 0 : "/bin/sh"
|
|
51996
|
+
].filter((candidate) => Boolean(candidate));
|
|
51997
|
+
let lastError = null;
|
|
51998
|
+
let child = null;
|
|
51999
|
+
for (const shell of [...new Set(candidates)]) {
|
|
52000
|
+
const result$1 = yield* result(pty.spawn({
|
|
52001
|
+
shell,
|
|
52002
|
+
cwd: session.cwd,
|
|
52003
|
+
cols: session.cols,
|
|
52004
|
+
rows: session.rows,
|
|
52005
|
+
env: {
|
|
52006
|
+
...process.env,
|
|
52007
|
+
...session.env,
|
|
52008
|
+
TERM: "xterm-256color"
|
|
52009
|
+
}
|
|
52010
|
+
}));
|
|
52011
|
+
if (result$1._tag === "Success") {
|
|
52012
|
+
child = result$1.success;
|
|
52013
|
+
break;
|
|
52014
|
+
}
|
|
52015
|
+
lastError = result$1.failure;
|
|
52016
|
+
}
|
|
52017
|
+
if (!child) {
|
|
52018
|
+
session.status = "error";
|
|
52019
|
+
touch(session);
|
|
52020
|
+
publish({
|
|
52021
|
+
type: "error",
|
|
52022
|
+
threadId: session.threadId,
|
|
52023
|
+
terminalId: session.terminalId,
|
|
52024
|
+
sequence: session.sequence,
|
|
52025
|
+
message: lastError instanceof Error ? lastError.message : "Could not start terminal."
|
|
52026
|
+
});
|
|
52027
|
+
publishMetadata({
|
|
52028
|
+
type: "upsert",
|
|
52029
|
+
terminal: summary(session)
|
|
52030
|
+
});
|
|
52031
|
+
return;
|
|
52032
|
+
}
|
|
52033
|
+
session.process = child;
|
|
52034
|
+
session.status = "running";
|
|
52035
|
+
touch(session);
|
|
52036
|
+
const childPid = child.pid;
|
|
52037
|
+
session.unsubscribeData = child.onData((data) => {
|
|
52038
|
+
if (session.process?.pid !== childPid) return;
|
|
52039
|
+
session.history = `${session.history}${data}`.slice(-524288);
|
|
52040
|
+
touch(session);
|
|
52041
|
+
publish({
|
|
52042
|
+
type: "output",
|
|
52043
|
+
threadId: session.threadId,
|
|
52044
|
+
terminalId: session.terminalId,
|
|
52045
|
+
sequence: session.sequence,
|
|
52046
|
+
data
|
|
52047
|
+
});
|
|
52048
|
+
});
|
|
52049
|
+
session.unsubscribeExit = child.onExit((event) => {
|
|
52050
|
+
if (session.process?.pid !== childPid) return;
|
|
52051
|
+
session.unsubscribeData?.();
|
|
52052
|
+
session.unsubscribeData = null;
|
|
52053
|
+
session.unsubscribeExit = null;
|
|
52054
|
+
session.process = null;
|
|
52055
|
+
session.status = "exited";
|
|
52056
|
+
session.exitCode = event.exitCode;
|
|
52057
|
+
session.exitSignal = event.signal;
|
|
52058
|
+
touch(session);
|
|
52059
|
+
publish({
|
|
52060
|
+
type: "exited",
|
|
52061
|
+
threadId: session.threadId,
|
|
52062
|
+
terminalId: session.terminalId,
|
|
52063
|
+
sequence: session.sequence,
|
|
52064
|
+
exitCode: event.exitCode,
|
|
52065
|
+
exitSignal: event.signal
|
|
52066
|
+
});
|
|
52067
|
+
publishMetadata({
|
|
52068
|
+
type: "upsert",
|
|
52069
|
+
terminal: summary(session)
|
|
52070
|
+
});
|
|
52071
|
+
});
|
|
52072
|
+
publish({
|
|
52073
|
+
type: "started",
|
|
52074
|
+
threadId: session.threadId,
|
|
52075
|
+
terminalId: session.terminalId,
|
|
52076
|
+
sequence: session.sequence,
|
|
52077
|
+
snapshot: snapshot(session)
|
|
52078
|
+
});
|
|
52079
|
+
publishMetadata({
|
|
52080
|
+
type: "upsert",
|
|
52081
|
+
terminal: summary(session)
|
|
52082
|
+
});
|
|
52083
|
+
});
|
|
52084
|
+
const get = (threadId, terminalId) => sessions.get(sessionKey(threadId, terminalId));
|
|
52085
|
+
const open = fn("TerminalManager.open")(function* (input) {
|
|
52086
|
+
const existing = get(input.threadId, input.terminalId);
|
|
52087
|
+
if (existing) return snapshot(existing);
|
|
52088
|
+
yield* validateCwd(input.cwd);
|
|
52089
|
+
const session = {
|
|
52090
|
+
threadId: input.threadId,
|
|
52091
|
+
terminalId: input.terminalId,
|
|
52092
|
+
cwd: input.cwd,
|
|
52093
|
+
worktreePath: input.worktreePath ?? null,
|
|
52094
|
+
status: "starting",
|
|
52095
|
+
process: null,
|
|
52096
|
+
history: "",
|
|
52097
|
+
exitCode: null,
|
|
52098
|
+
exitSignal: null,
|
|
52099
|
+
updatedAt: now(),
|
|
52100
|
+
sequence: 0,
|
|
52101
|
+
cols: input.cols ?? DEFAULT_COLS,
|
|
52102
|
+
rows: input.rows ?? DEFAULT_ROWS,
|
|
52103
|
+
env: input.env,
|
|
52104
|
+
unsubscribeData: null,
|
|
52105
|
+
unsubscribeExit: null
|
|
52106
|
+
};
|
|
52107
|
+
sessions.set(sessionKey(input.threadId, input.terminalId), session);
|
|
52108
|
+
yield* spawn(session);
|
|
52109
|
+
return snapshot(session);
|
|
52110
|
+
});
|
|
52111
|
+
const restart = fn("TerminalManager.restart")(function* (input) {
|
|
52112
|
+
yield* validateCwd(input.cwd);
|
|
52113
|
+
const session = get(input.threadId, input.terminalId);
|
|
52114
|
+
if (!session) return yield* new TerminalSessionLookupError({
|
|
52115
|
+
threadId: input.threadId,
|
|
52116
|
+
terminalId: input.terminalId
|
|
52117
|
+
});
|
|
52118
|
+
stop(session);
|
|
52119
|
+
session.cwd = input.cwd;
|
|
52120
|
+
session.worktreePath = input.worktreePath ?? null;
|
|
52121
|
+
session.cols = input.cols;
|
|
52122
|
+
session.rows = input.rows;
|
|
52123
|
+
session.env = input.env;
|
|
52124
|
+
session.history = "";
|
|
52125
|
+
yield* spawn(session);
|
|
52126
|
+
publish({
|
|
52127
|
+
type: "restarted",
|
|
52128
|
+
threadId: session.threadId,
|
|
52129
|
+
terminalId: session.terminalId,
|
|
52130
|
+
sequence: session.sequence,
|
|
52131
|
+
snapshot: snapshot(session)
|
|
52132
|
+
});
|
|
52133
|
+
return snapshot(session);
|
|
52134
|
+
});
|
|
52135
|
+
const attachStream = fn("TerminalManager.attachStream")(function* (input, listener) {
|
|
52136
|
+
let session = get(input.threadId, input.terminalId);
|
|
52137
|
+
if (!session && input.cwd) {
|
|
52138
|
+
yield* open({
|
|
52139
|
+
threadId: input.threadId,
|
|
52140
|
+
terminalId: input.terminalId,
|
|
52141
|
+
cwd: input.cwd,
|
|
52142
|
+
worktreePath: input.worktreePath ?? null,
|
|
52143
|
+
cols: input.cols,
|
|
52144
|
+
rows: input.rows,
|
|
52145
|
+
env: input.env
|
|
52146
|
+
});
|
|
52147
|
+
session = get(input.threadId, input.terminalId);
|
|
52148
|
+
}
|
|
52149
|
+
if (!session) return yield* new TerminalSessionLookupError({
|
|
52150
|
+
threadId: input.threadId,
|
|
52151
|
+
terminalId: input.terminalId
|
|
52152
|
+
});
|
|
52153
|
+
if (input.restartIfNotRunning && session.status !== "running" && input.cwd) yield* restart({
|
|
52154
|
+
threadId: input.threadId,
|
|
52155
|
+
terminalId: input.terminalId,
|
|
52156
|
+
cwd: input.cwd,
|
|
52157
|
+
worktreePath: input.worktreePath ?? null,
|
|
52158
|
+
cols: input.cols ?? session.cols,
|
|
52159
|
+
rows: input.rows ?? session.rows,
|
|
52160
|
+
env: input.env
|
|
52161
|
+
});
|
|
52162
|
+
yield* listener({
|
|
52163
|
+
type: "snapshot",
|
|
52164
|
+
snapshot: snapshot(session)
|
|
52165
|
+
});
|
|
52166
|
+
const key = sessionKey(input.threadId, input.terminalId);
|
|
52167
|
+
const listeners = attachListeners.get(key) ?? /* @__PURE__ */ new Set();
|
|
52168
|
+
listeners.add(listener);
|
|
52169
|
+
attachListeners.set(key, listeners);
|
|
52170
|
+
return () => {
|
|
52171
|
+
listeners.delete(listener);
|
|
52172
|
+
if (listeners.size === 0) attachListeners.delete(key);
|
|
52173
|
+
};
|
|
52174
|
+
});
|
|
52175
|
+
const write = (input) => gen(function* () {
|
|
52176
|
+
const session = get(input.threadId, input.terminalId);
|
|
52177
|
+
if (!session) return yield* new TerminalSessionLookupError({
|
|
52178
|
+
threadId: input.threadId,
|
|
52179
|
+
terminalId: input.terminalId
|
|
52180
|
+
});
|
|
52181
|
+
if (!session.process || session.status !== "running") return yield* new TerminalNotRunningError({
|
|
52182
|
+
threadId: input.threadId,
|
|
52183
|
+
terminalId: input.terminalId
|
|
52184
|
+
});
|
|
52185
|
+
yield* try_({
|
|
52186
|
+
try: () => session.process.write(input.data),
|
|
52187
|
+
catch: (cause) => new TerminalWriteError({
|
|
52188
|
+
threadId: input.threadId,
|
|
52189
|
+
terminalId: input.terminalId,
|
|
52190
|
+
terminalPid: session.process.pid,
|
|
52191
|
+
cause
|
|
52192
|
+
})
|
|
52193
|
+
});
|
|
52194
|
+
});
|
|
52195
|
+
const resize = (input) => gen(function* () {
|
|
52196
|
+
const session = get(input.threadId, input.terminalId);
|
|
52197
|
+
if (!session) return yield* new TerminalSessionLookupError({
|
|
52198
|
+
threadId: input.threadId,
|
|
52199
|
+
terminalId: input.terminalId
|
|
52200
|
+
});
|
|
52201
|
+
if (!session.process || session.status !== "running") return yield* new TerminalNotRunningError({
|
|
52202
|
+
threadId: input.threadId,
|
|
52203
|
+
terminalId: input.terminalId
|
|
52204
|
+
});
|
|
52205
|
+
yield* try_({
|
|
52206
|
+
try: () => session.process.resize(input.cols, input.rows),
|
|
52207
|
+
catch: (cause) => new TerminalResizeError({
|
|
52208
|
+
threadId: input.threadId,
|
|
52209
|
+
terminalId: input.terminalId,
|
|
52210
|
+
terminalPid: session.process.pid,
|
|
52211
|
+
cols: input.cols,
|
|
52212
|
+
rows: input.rows,
|
|
52213
|
+
cause
|
|
52214
|
+
})
|
|
52215
|
+
});
|
|
52216
|
+
session.cols = input.cols;
|
|
52217
|
+
session.rows = input.rows;
|
|
52218
|
+
});
|
|
52219
|
+
const clear = (input) => gen(function* () {
|
|
52220
|
+
const session = get(input.threadId, input.terminalId);
|
|
52221
|
+
if (!session) return yield* new TerminalSessionLookupError({
|
|
52222
|
+
threadId: input.threadId,
|
|
52223
|
+
terminalId: input.terminalId
|
|
52224
|
+
});
|
|
52225
|
+
session.history = "";
|
|
52226
|
+
touch(session);
|
|
52227
|
+
publish({
|
|
52228
|
+
type: "cleared",
|
|
52229
|
+
threadId: session.threadId,
|
|
52230
|
+
terminalId: session.terminalId,
|
|
52231
|
+
sequence: session.sequence
|
|
52232
|
+
});
|
|
52233
|
+
});
|
|
52234
|
+
const close = (input) => sync(() => {
|
|
52235
|
+
const targets = [...sessions.values()].filter((session) => session.threadId === input.threadId && (input.terminalId === void 0 || session.terminalId === input.terminalId));
|
|
52236
|
+
for (const session of targets) {
|
|
52237
|
+
stop(session);
|
|
52238
|
+
sessions.delete(sessionKey(session.threadId, session.terminalId));
|
|
52239
|
+
attachListeners.delete(sessionKey(session.threadId, session.terminalId));
|
|
52240
|
+
touch(session);
|
|
52241
|
+
publish({
|
|
52242
|
+
type: "closed",
|
|
52243
|
+
threadId: session.threadId,
|
|
52244
|
+
terminalId: session.terminalId,
|
|
52245
|
+
sequence: session.sequence
|
|
52246
|
+
});
|
|
52247
|
+
publishMetadata({
|
|
52248
|
+
type: "remove",
|
|
52249
|
+
threadId: session.threadId,
|
|
52250
|
+
terminalId: session.terminalId
|
|
52251
|
+
});
|
|
52252
|
+
}
|
|
52253
|
+
});
|
|
52254
|
+
return TerminalManager.of({
|
|
52255
|
+
open,
|
|
52256
|
+
attachStream,
|
|
52257
|
+
write,
|
|
52258
|
+
resize,
|
|
52259
|
+
clear,
|
|
52260
|
+
restart,
|
|
52261
|
+
close,
|
|
52262
|
+
subscribe: (listener) => sync(() => {
|
|
52263
|
+
eventListeners.add(listener);
|
|
52264
|
+
return () => eventListeners.delete(listener);
|
|
52265
|
+
}),
|
|
52266
|
+
subscribeMetadata: (listener) => gen(function* () {
|
|
52267
|
+
yield* listener({
|
|
52268
|
+
type: "snapshot",
|
|
52269
|
+
terminals: [...sessions.values()].map(summary)
|
|
52270
|
+
});
|
|
52271
|
+
metadataListeners.add(listener);
|
|
52272
|
+
return () => metadataListeners.delete(listener);
|
|
52273
|
+
})
|
|
52274
|
+
});
|
|
52275
|
+
}));
|
|
52276
|
+
//#endregion
|
|
51644
52277
|
//#region src/auth/RpcAuthorization.ts
|
|
51645
52278
|
/**
|
|
51646
52279
|
* Keep authorization coverage coupled to the RPC group itself. Adding an RPC to
|
|
@@ -51739,7 +52372,7 @@ function requiredScopeForRpcMethod(method) {
|
|
|
51739
52372
|
//#endregion
|
|
51740
52373
|
//#region src/ws.ts
|
|
51741
52374
|
const isOrchestrationDispatchCommandError = is(OrchestrationDispatchCommandError);
|
|
51742
|
-
const nowIso$2 = map$4(now, formatIso);
|
|
52375
|
+
const nowIso$2 = map$4(now$1, formatIso);
|
|
51743
52376
|
const EDITOR_DISCOVERY_TIMEOUT = seconds(5);
|
|
51744
52377
|
const resolveAvailableEditorsForConfig = (discovery) => discovery.pipe(timeoutOption(EDITOR_DISCOVERY_TIMEOUT), map$4(getOrElse(() => [])));
|
|
51745
52378
|
function unexpectedCompatibilityError(error) {
|
|
@@ -51870,11 +52503,7 @@ const UNSUPPORTED_STREAM_METHODS = /* @__PURE__ */ new Set([
|
|
|
51870
52503
|
WS_METHODS.serverUpdateServerWithProgress,
|
|
51871
52504
|
WS_METHODS.subscribeDiscoveredLocalServers,
|
|
51872
52505
|
WS_METHODS.subscribePreviewEvents,
|
|
51873
|
-
WS_METHODS.subscribeResourceTelemetry
|
|
51874
|
-
WS_METHODS.subscribeTerminalEvents,
|
|
51875
|
-
WS_METHODS.subscribeTerminalMetadata,
|
|
51876
|
-
WS_METHODS.subscribeVcsStatus,
|
|
51877
|
-
WS_METHODS.terminalAttach
|
|
52506
|
+
WS_METHODS.subscribeResourceTelemetry
|
|
51878
52507
|
]);
|
|
51879
52508
|
/**
|
|
51880
52509
|
* Generic stub value: each usage below reads `unsupportedRpc<Tag>` with an
|
|
@@ -51898,6 +52527,8 @@ const wsRpcServices = gen(function* () {
|
|
|
51898
52527
|
startup: yield* ServerRuntimeStartup,
|
|
51899
52528
|
workspaceEntries: yield* WorkspaceEntries,
|
|
51900
52529
|
workspaceFileSystem: yield* WorkspaceFileSystem,
|
|
52530
|
+
gitWorkspace: yield* GitWorkspace,
|
|
52531
|
+
terminalManager: yield* TerminalManager,
|
|
51901
52532
|
serverEnvironment: yield* ServerEnvironment,
|
|
51902
52533
|
backgroundPolicy: yield* BackgroundPolicy,
|
|
51903
52534
|
serverAuth: yield* EnvironmentAuth,
|
|
@@ -51907,9 +52538,9 @@ const wsRpcServices = gen(function* () {
|
|
|
51907
52538
|
});
|
|
51908
52539
|
const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
51909
52540
|
const currentSessionId = currentSession.sessionId;
|
|
51910
|
-
const { crypto, projectionSnapshotQuery, orchestrationEngine, keybindings, externalLauncher, providerRegistry, config, lifecycleEvents, serverSettings, startup, workspaceEntries, workspaceFileSystem, serverEnvironment, backgroundPolicy, serverAuth, bootstrapCredentials, sessions } = yield* wsRpcServices;
|
|
52541
|
+
const { crypto, projectionSnapshotQuery, orchestrationEngine, keybindings, externalLauncher, providerRegistry, config, lifecycleEvents, serverSettings, startup, workspaceEntries, workspaceFileSystem, gitWorkspace, terminalManager, serverEnvironment, backgroundPolicy, serverAuth, bootstrapCredentials, sessions } = yield* wsRpcServices;
|
|
51911
52542
|
const providerMaintenanceRunner = yield* ProviderMaintenanceRunner;
|
|
51912
|
-
const rpcClientIds = yield* make$
|
|
52543
|
+
const rpcClientIds = yield* make$63(/* @__PURE__ */ new Set());
|
|
51913
52544
|
yield* addFinalizer(() => get$3(rpcClientIds).pipe(flatMap$1((clientIds) => forEach(clientIds, (clientId) => backgroundPolicy.removeRpcClient(currentSessionId, clientId), { discard: true })), ignore$1));
|
|
51914
52545
|
const authorizationError = (requiredScope) => new EnvironmentAuthorizationError({
|
|
51915
52546
|
message: `The authenticated token is missing required scope: ${requiredScope}.`,
|
|
@@ -52124,7 +52755,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
|
52124
52755
|
if (input.afterSequence !== void 0) {
|
|
52125
52756
|
const afterSequence = input.afterSequence;
|
|
52126
52757
|
const replayGap = (yield* orchestrationEngine.latestSequence) - afterSequence;
|
|
52127
|
-
if (replayGap < 0 || replayGap > SHELL_RESUME_MAX_GAP) return concat(make$
|
|
52758
|
+
if (replayGap < 0 || replayGap > SHELL_RESUME_MAX_GAP) return concat(make$74({
|
|
52128
52759
|
kind: "snapshot",
|
|
52129
52760
|
snapshot: yield* loadSnapshot
|
|
52130
52761
|
}), synchronizedThenLive);
|
|
@@ -52133,7 +52764,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
|
52133
52764
|
cause
|
|
52134
52765
|
}))), synchronizedThenLive);
|
|
52135
52766
|
}
|
|
52136
|
-
return concat(make$
|
|
52767
|
+
return concat(make$74({
|
|
52137
52768
|
kind: "snapshot",
|
|
52138
52769
|
snapshot: yield* loadSnapshot
|
|
52139
52770
|
}), synchronizedThenLive);
|
|
@@ -52171,7 +52802,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
|
52171
52802
|
cause: input.threadId
|
|
52172
52803
|
});
|
|
52173
52804
|
const afterSnapshot = input.requestCompletionMarker === true ? concat(fromEffect(offer$1(liveBuffer, { kind: "synchronized" })).pipe(drain), bufferedLiveStream) : bufferedLiveStream;
|
|
52174
|
-
return concat(make$
|
|
52805
|
+
return concat(make$74({
|
|
52175
52806
|
kind: "snapshot",
|
|
52176
52807
|
snapshot: projectThreadDetailSnapshot(snapshot.value)
|
|
52177
52808
|
}), afterSnapshot);
|
|
@@ -52275,7 +52906,7 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
|
52275
52906
|
})));
|
|
52276
52907
|
yield* providerRegistry.refresh().pipe(ignoreCause({ log: true }), forkScoped);
|
|
52277
52908
|
const liveUpdates = merge$2(keybindingsUpdates, merge$2(providerStatuses, settingsUpdates));
|
|
52278
|
-
return concat(make$
|
|
52909
|
+
return concat(make$74({
|
|
52279
52910
|
version: 1,
|
|
52280
52911
|
type: "snapshot",
|
|
52281
52912
|
config: yield* loadServerConfig
|
|
@@ -52289,9 +52920,9 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
|
52289
52920
|
}), { "rpc.aggregate": "server" }),
|
|
52290
52921
|
[WS_METHODS.subscribeAuthAccess]: (_input) => observeRpcStreamEffect$1(WS_METHODS.subscribeAuthAccess, gen(function* () {
|
|
52291
52922
|
const initialSnapshot = yield* loadAuthAccessSnapshot();
|
|
52292
|
-
const revisionRef = yield* make$
|
|
52923
|
+
const revisionRef = yield* make$63(1);
|
|
52293
52924
|
const liveEvents = merge$2(bootstrapCredentials.streamChanges, sessions.streamChanges).pipe(mapEffect$1((change) => updateAndGet(revisionRef, (revision) => revision + 1).pipe(map$4((revision) => toAuthAccessStreamEvent(change, revision, currentSessionId)))));
|
|
52294
|
-
return concat(make$
|
|
52925
|
+
return concat(make$74({
|
|
52295
52926
|
version: 1,
|
|
52296
52927
|
revision: 1,
|
|
52297
52928
|
type: "snapshot",
|
|
@@ -52330,28 +52961,28 @@ const makeWsRpcLayer = (currentSession) => WsRpcGroup.toLayer(gen(function* () {
|
|
|
52330
52961
|
[WS_METHODS.subscribeDiscoveredLocalServers]: unsupportedRpc,
|
|
52331
52962
|
[WS_METHODS.subscribePreviewEvents]: unsupportedRpc,
|
|
52332
52963
|
[WS_METHODS.subscribeResourceTelemetry]: unsupportedRpc,
|
|
52333
|
-
[WS_METHODS.subscribeTerminalEvents]:
|
|
52334
|
-
[WS_METHODS.subscribeTerminalMetadata]:
|
|
52335
|
-
[WS_METHODS.subscribeVcsStatus]:
|
|
52336
|
-
[WS_METHODS.terminalAttach]:
|
|
52337
|
-
[WS_METHODS.terminalClear]:
|
|
52338
|
-
[WS_METHODS.terminalClose]:
|
|
52339
|
-
[WS_METHODS.terminalOpen]:
|
|
52340
|
-
[WS_METHODS.terminalResize]:
|
|
52341
|
-
[WS_METHODS.terminalRestart]:
|
|
52342
|
-
[WS_METHODS.terminalWrite]:
|
|
52964
|
+
[WS_METHODS.subscribeTerminalEvents]: (_input) => observeRpcStream$1(WS_METHODS.subscribeTerminalEvents, callback$1((queue) => acquireRelease(terminalManager.subscribe((event) => offer$1(queue, event)), (unsubscribe) => sync(unsubscribe))), { "rpc.aggregate": "terminal" }),
|
|
52965
|
+
[WS_METHODS.subscribeTerminalMetadata]: (_input) => observeRpcStream$1(WS_METHODS.subscribeTerminalMetadata, callback$1((queue) => acquireRelease(terminalManager.subscribeMetadata((event) => offer$1(queue, event)), (unsubscribe) => sync(unsubscribe))), { "rpc.aggregate": "terminal" }),
|
|
52966
|
+
[WS_METHODS.subscribeVcsStatus]: (input) => observeRpcStream$1(WS_METHODS.subscribeVcsStatus, gitWorkspace.statusStream(input.cwd), { "rpc.aggregate": "vcs" }),
|
|
52967
|
+
[WS_METHODS.terminalAttach]: (input) => observeRpcStream$1(WS_METHODS.terminalAttach, callback$1((queue) => acquireRelease(terminalManager.attachStream(input, (event) => offer$1(queue, event)), (unsubscribe) => sync(unsubscribe))), { "rpc.aggregate": "terminal" }),
|
|
52968
|
+
[WS_METHODS.terminalClear]: (input) => observeRpcEffect$1(WS_METHODS.terminalClear, terminalManager.clear(input), { "rpc.aggregate": "terminal" }),
|
|
52969
|
+
[WS_METHODS.terminalClose]: (input) => observeRpcEffect$1(WS_METHODS.terminalClose, terminalManager.close(input), { "rpc.aggregate": "terminal" }),
|
|
52970
|
+
[WS_METHODS.terminalOpen]: (input) => observeRpcEffect$1(WS_METHODS.terminalOpen, terminalManager.open(input), { "rpc.aggregate": "terminal" }),
|
|
52971
|
+
[WS_METHODS.terminalResize]: (input) => observeRpcEffect$1(WS_METHODS.terminalResize, terminalManager.resize(input), { "rpc.aggregate": "terminal" }),
|
|
52972
|
+
[WS_METHODS.terminalRestart]: (input) => observeRpcEffect$1(WS_METHODS.terminalRestart, terminalManager.restart(input), { "rpc.aggregate": "terminal" }),
|
|
52973
|
+
[WS_METHODS.terminalWrite]: (input) => observeRpcEffect$1(WS_METHODS.terminalWrite, terminalManager.write(input), { "rpc.aggregate": "terminal" }),
|
|
52343
52974
|
[WS_METHODS.vcsCreateRef]: unsupportedRpc,
|
|
52344
52975
|
[WS_METHODS.vcsCreateWorktree]: unsupportedRpc,
|
|
52345
52976
|
[WS_METHODS.vcsInit]: unsupportedRpc,
|
|
52346
|
-
[WS_METHODS.vcsListRefs]:
|
|
52977
|
+
[WS_METHODS.vcsListRefs]: (input) => observeRpcEffect$1(WS_METHODS.vcsListRefs, gitWorkspace.listRefs(input), { "rpc.aggregate": "vcs" }),
|
|
52347
52978
|
[WS_METHODS.vcsPull]: unsupportedRpc,
|
|
52348
|
-
[WS_METHODS.vcsRefreshStatus]:
|
|
52979
|
+
[WS_METHODS.vcsRefreshStatus]: (input) => observeRpcEffect$1(WS_METHODS.vcsRefreshStatus, gitWorkspace.status(input.cwd), { "rpc.aggregate": "vcs" }),
|
|
52349
52980
|
[WS_METHODS.vcsRemoveWorktree]: unsupportedRpc,
|
|
52350
|
-
[WS_METHODS.vcsSwitchRef]:
|
|
52981
|
+
[WS_METHODS.vcsSwitchRef]: (input) => observeRpcEffect$1(WS_METHODS.vcsSwitchRef, gitWorkspace.switchRef(input), { "rpc.aggregate": "vcs" }),
|
|
52351
52982
|
[ORCHESTRATION_WS_METHODS.getFullThreadDiff]: unsupportedRpc,
|
|
52352
52983
|
[ORCHESTRATION_WS_METHODS.getTurnDiff]: unsupportedRpc,
|
|
52353
52984
|
[ORCHESTRATION_WS_METHODS.getWorkflowScript]: unsupportedRpc,
|
|
52354
|
-
[WS_METHODS.subscribeBackgroundPolicy]: (_input) => observeRpcStream$1(WS_METHODS.subscribeBackgroundPolicy, unwrap$1(map$4(backgroundPolicy.subscribe, ({ latest, changes }) => concat(make$
|
|
52985
|
+
[WS_METHODS.subscribeBackgroundPolicy]: (_input) => observeRpcStream$1(WS_METHODS.subscribeBackgroundPolicy, unwrap$1(map$4(backgroundPolicy.subscribe, ({ latest, changes }) => concat(make$74(latest), changes))), { "rpc.aggregate": "server" })
|
|
52355
52986
|
});
|
|
52356
52987
|
}));
|
|
52357
52988
|
const websocketRpcRouteLayer = unwrap(gen(function* () {
|
|
@@ -52360,7 +52991,7 @@ const websocketRpcRouteLayer = unwrap(gen(function* () {
|
|
|
52360
52991
|
const serverAuth = yield* EnvironmentAuth;
|
|
52361
52992
|
const sessions = yield* SessionStore;
|
|
52362
52993
|
const session = yield* serverAuth.authenticateWebSocketUpgrade(request).pipe(catchIf(isServerAuthCredentialError, (error) => failEnvironmentAuthInvalid(serverAuthCredentialReason(error))), catchIf(isServerAuthInternalError, (error) => failEnvironmentInternal("internal_error", error)));
|
|
52363
|
-
const rpcWebSocketHttpEffect = yield* toHttpEffectWebsocket(WsRpcGroup, { disableTracing: true }).pipe(provide$1(makeWsRpcLayer(session).pipe(provideMerge(layerJson), provide(layer$
|
|
52994
|
+
const rpcWebSocketHttpEffect = yield* toHttpEffectWebsocket(WsRpcGroup, { disableTracing: true }).pipe(provide$1(makeWsRpcLayer(session).pipe(provideMerge(layerJson), provide(layer$11))));
|
|
52364
52995
|
return yield* acquireUseRelease(sessions.markConnected(session.sessionId), () => rpcWebSocketHttpEffect, () => sessions.markDisconnected(session.sessionId));
|
|
52365
52996
|
}).pipe(catchTags({
|
|
52366
52997
|
EnvironmentAuthInvalidError: toResponse,
|
|
@@ -52404,6 +53035,75 @@ function envelopeToUtf8(enckey, envelope) {
|
|
|
52404
53035
|
function isEnvelope(value) {
|
|
52405
53036
|
return typeof value === "object" && value !== null && value.e2e === 1 && typeof value.iv === "string" && typeof value.ct === "string";
|
|
52406
53037
|
}
|
|
53038
|
+
const AGENTLINK_FRAME_CHUNK_TAG = "agentlink-frame-chunk-v1";
|
|
53039
|
+
const AGENTLINK_FRAME_CHUNK_BYTES = 512 * 1024;
|
|
53040
|
+
const AGENTLINK_FRAME_MAX_CHUNKS = 64;
|
|
53041
|
+
const AGENTLINK_FRAME_MAX_IN_FLIGHT = 8;
|
|
53042
|
+
function chunkAgentLinkFrame(plaintext) {
|
|
53043
|
+
const bytes = Buffer.from(plaintext, "utf8");
|
|
53044
|
+
if (bytes.length <= AGENTLINK_FRAME_CHUNK_BYTES) return [plaintext];
|
|
53045
|
+
const id = randomBytes(12).toString("base64url");
|
|
53046
|
+
const total = Math.ceil(bytes.length / AGENTLINK_FRAME_CHUNK_BYTES);
|
|
53047
|
+
if (total > AGENTLINK_FRAME_MAX_CHUNKS) throw new Error("AgentLink frame is too large");
|
|
53048
|
+
const chunks = [];
|
|
53049
|
+
for (let index = 0; index < total; index++) {
|
|
53050
|
+
const start = index * AGENTLINK_FRAME_CHUNK_BYTES;
|
|
53051
|
+
chunks.push(JSON.stringify({
|
|
53052
|
+
__agentlink_chunk: AGENTLINK_FRAME_CHUNK_TAG,
|
|
53053
|
+
id,
|
|
53054
|
+
index,
|
|
53055
|
+
total,
|
|
53056
|
+
data: bytes.subarray(start, start + AGENTLINK_FRAME_CHUNK_BYTES).toString("base64url")
|
|
53057
|
+
}));
|
|
53058
|
+
}
|
|
53059
|
+
return chunks;
|
|
53060
|
+
}
|
|
53061
|
+
function makeAgentLinkFrameAssembler() {
|
|
53062
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
53063
|
+
return (plaintext) => {
|
|
53064
|
+
if (!plaintext.startsWith(`{"__agentlink_chunk":"${AGENTLINK_FRAME_CHUNK_TAG}"`)) return plaintext;
|
|
53065
|
+
let value;
|
|
53066
|
+
try {
|
|
53067
|
+
value = JSON.parse(plaintext);
|
|
53068
|
+
} catch {
|
|
53069
|
+
return plaintext;
|
|
53070
|
+
}
|
|
53071
|
+
if (typeof value !== "object" || value === null || value.__agentlink_chunk !== AGENTLINK_FRAME_CHUNK_TAG) return plaintext;
|
|
53072
|
+
const chunk = value;
|
|
53073
|
+
if (typeof chunk.id !== "string" || !Number.isInteger(chunk.index) || !Number.isInteger(chunk.total) || typeof chunk.data !== "string") throw new Error("invalid AgentLink frame chunk");
|
|
53074
|
+
const id = chunk.id;
|
|
53075
|
+
const index = chunk.index;
|
|
53076
|
+
const total = chunk.total;
|
|
53077
|
+
const data = chunk.data;
|
|
53078
|
+
if (total < 2 || total > AGENTLINK_FRAME_MAX_CHUNKS || index < 0 || index >= total) throw new Error("invalid AgentLink frame chunk");
|
|
53079
|
+
const part = Buffer.from(data, "base64url");
|
|
53080
|
+
let current = inFlight.get(id);
|
|
53081
|
+
if (!current) {
|
|
53082
|
+
if (inFlight.size >= AGENTLINK_FRAME_MAX_IN_FLIGHT) throw new Error("too many AgentLink frame chunks in flight");
|
|
53083
|
+
current = {
|
|
53084
|
+
total,
|
|
53085
|
+
parts: Array.from({ length: total }, () => void 0),
|
|
53086
|
+
bytes: 0
|
|
53087
|
+
};
|
|
53088
|
+
inFlight.set(id, current);
|
|
53089
|
+
}
|
|
53090
|
+
const state = current;
|
|
53091
|
+
if (state.total !== total) throw new Error("inconsistent AgentLink frame chunk");
|
|
53092
|
+
const previous = state.parts[index];
|
|
53093
|
+
if (previous) {
|
|
53094
|
+
if (!previous.equals(part)) throw new Error("duplicate AgentLink frame chunk differs");
|
|
53095
|
+
return null;
|
|
53096
|
+
}
|
|
53097
|
+
state.parts[index] = part;
|
|
53098
|
+
state.bytes += part.length;
|
|
53099
|
+
if (state.bytes > AGENTLINK_FRAME_CHUNK_BYTES * AGENTLINK_FRAME_MAX_CHUNKS) throw new Error("AgentLink frame is too large");
|
|
53100
|
+
if (!state.parts.every((item) => item !== void 0)) return null;
|
|
53101
|
+
if (state.parts.some((item) => item === void 0)) throw new Error("incomplete AgentLink frame chunk");
|
|
53102
|
+
const assembled = Buffer.concat(state.parts);
|
|
53103
|
+
inFlight.delete(id);
|
|
53104
|
+
return assembled.toString("utf8");
|
|
53105
|
+
};
|
|
53106
|
+
}
|
|
52407
53107
|
//#endregion
|
|
52408
53108
|
//#region src/tunnel/bridge.ts
|
|
52409
53109
|
const TUNNEL_SCOPES = [AuthOrchestrationReadScope, AuthOrchestrationOperateScope];
|
|
@@ -52447,7 +53147,7 @@ const ResponseDefectEncoded = (cause) => ({
|
|
|
52447
53147
|
});
|
|
52448
53148
|
const makeTunnelSocketProtocol = gen(function* () {
|
|
52449
53149
|
const serialization = yield* RpcSerialization;
|
|
52450
|
-
const disconnects = yield* make$
|
|
53150
|
+
const disconnects = yield* make$78();
|
|
52451
53151
|
let clientId = 0;
|
|
52452
53152
|
const clients = /* @__PURE__ */ new Map();
|
|
52453
53153
|
const clientIds = /* @__PURE__ */ new Set();
|
|
@@ -52529,7 +53229,7 @@ function encodeHttpTunnelResponseFrame(frame) {
|
|
|
52529
53229
|
}
|
|
52530
53230
|
const makeTunnelSocket = (input) => {
|
|
52531
53231
|
const runRaw = (handler, options) => scopedWith((scope) => gen(function* () {
|
|
52532
|
-
const fiberSet = yield* make$
|
|
53232
|
+
const fiberSet = yield* make$65().pipe(provide$2(scope));
|
|
52533
53233
|
const runFork = yield* runtime(fiberSet)();
|
|
52534
53234
|
const deliver = (frame) => {
|
|
52535
53235
|
const handled = handler(frame);
|
|
@@ -52540,10 +53240,10 @@ const makeTunnelSocket = (input) => {
|
|
|
52540
53240
|
if (options?.onOpen) yield* options.onOpen;
|
|
52541
53241
|
yield* _await(input.tunnel.closed).pipe(raceFirst(join$1(fiberSet)));
|
|
52542
53242
|
}));
|
|
52543
|
-
return make$
|
|
53243
|
+
return make$66({
|
|
52544
53244
|
runRaw,
|
|
52545
53245
|
writer: sync(() => (chunk) => sync(() => {
|
|
52546
|
-
if (typeof chunk === "string") input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey,
|
|
53246
|
+
if (typeof chunk === "string") for (const part of chunkAgentLinkFrame(chunk)) input.sendEncrypted(JSON.stringify(utf8ToEnvelope(input.enckey, part)));
|
|
52547
53247
|
}))
|
|
52548
53248
|
});
|
|
52549
53249
|
};
|
|
@@ -52619,8 +53319,8 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52619
53319
|
subject: "hub-tunnel",
|
|
52620
53320
|
method: "bearer-access-token",
|
|
52621
53321
|
scopes: [...TUNNEL_SCOPES]
|
|
52622
|
-
}).pipe(provideMerge(layerJson), provide(layer$
|
|
52623
|
-
yield* make$
|
|
53322
|
+
}).pipe(provideMerge(layerJson), provide(layer$11))).pipe(provideContext(currentContext));
|
|
53323
|
+
yield* make$16(WsRpcGroup, { disableTracing: true }).pipe(provideService(Protocol, protocol), provideContext(rpcContext));
|
|
52624
53324
|
}).pipe(tapCause((cause) => logError("hub tunnel: RPC server failed", { cause: String(cause) }))));
|
|
52625
53325
|
yield* forkScoped(onSocket(socketAdapter));
|
|
52626
53326
|
if (!writeHub(JSON.stringify({
|
|
@@ -52657,8 +53357,13 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52657
53357
|
const localBaseUrl = `http://127.0.0.1:${serverConfig.port}`;
|
|
52658
53358
|
const sendEncrypted = (frame) => {
|
|
52659
53359
|
try {
|
|
52660
|
-
const
|
|
52661
|
-
|
|
53360
|
+
for (const part of chunkAgentLinkFrame(encodeHttpTunnelResponseFrame(frame))) {
|
|
53361
|
+
const envelope = utf8ToEnvelope(config.enckey, part);
|
|
53362
|
+
if (!writeHub(`${tunnelId} ${JSON.stringify(envelope)}`)) {
|
|
53363
|
+
dropTunnel(tunnelId);
|
|
53364
|
+
return;
|
|
53365
|
+
}
|
|
53366
|
+
}
|
|
52662
53367
|
} catch {
|
|
52663
53368
|
dropTunnel(tunnelId);
|
|
52664
53369
|
}
|
|
@@ -52698,7 +53403,7 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52698
53403
|
if (lower === "authorization" || lower === "cookie") continue;
|
|
52699
53404
|
headers[lower] = value;
|
|
52700
53405
|
}
|
|
52701
|
-
let request = make$
|
|
53406
|
+
let request = make$64(requestFrame.method)(targetUrl).pipe(setHeaders(headers));
|
|
52702
53407
|
if (requestFrame.body !== null) request = setBody(uint8Array(Buffer.from(requestFrame.body, "base64")))(request);
|
|
52703
53408
|
const response = yield* httpClient.execute(request);
|
|
52704
53409
|
const responseBody = yield* response.arrayBuffer;
|
|
@@ -52751,13 +53456,14 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52751
53456
|
const tunnelId = control.tunnelId;
|
|
52752
53457
|
if (tunnels.has(tunnelId)) return;
|
|
52753
53458
|
return gen(function* () {
|
|
52754
|
-
const closed = yield* make$
|
|
53459
|
+
const closed = yield* make$73();
|
|
52755
53460
|
const purpose = control.purpose === "http" ? "http" : "rpc";
|
|
52756
53461
|
const live = {
|
|
52757
53462
|
closed,
|
|
52758
53463
|
pendingFrames: [],
|
|
52759
53464
|
purpose,
|
|
52760
|
-
onDecryptedFrame: null
|
|
53465
|
+
onDecryptedFrame: null,
|
|
53466
|
+
assembleFrame: makeAgentLinkFrameAssembler()
|
|
52761
53467
|
};
|
|
52762
53468
|
tunnels.set(tunnelId, live);
|
|
52763
53469
|
if (purpose === "http") yield* forkScoped(scoped(attachHttpTunnel(tunnelId, live)));
|
|
@@ -52765,6 +53471,7 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52765
53471
|
});
|
|
52766
53472
|
}
|
|
52767
53473
|
if (control.type === "tunnel_close" && typeof control.tunnelId === "string") dropTunnel(control.tunnelId);
|
|
53474
|
+
if (control.type === "enckey_upload_request") return sync(() => void runFork(upload));
|
|
52768
53475
|
return;
|
|
52769
53476
|
}
|
|
52770
53477
|
const framed = splitHubFrame(data);
|
|
@@ -52784,8 +53491,15 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52784
53491
|
} catch {
|
|
52785
53492
|
return dropTunnel(framed.tunnelId);
|
|
52786
53493
|
}
|
|
52787
|
-
|
|
52788
|
-
|
|
53494
|
+
let complete;
|
|
53495
|
+
try {
|
|
53496
|
+
complete = live.assembleFrame(frame);
|
|
53497
|
+
} catch {
|
|
53498
|
+
return dropTunnel(framed.tunnelId);
|
|
53499
|
+
}
|
|
53500
|
+
if (complete === null) return;
|
|
53501
|
+
if (live.onDecryptedFrame) live.onDecryptedFrame(complete);
|
|
53502
|
+
else if (live.pendingFrames.length < 16) live.pendingFrames.push(complete);
|
|
52789
53503
|
else dropTunnel(framed.tunnelId);
|
|
52790
53504
|
return;
|
|
52791
53505
|
}
|
|
@@ -52796,7 +53510,7 @@ const runHubTunnel = (config) => gen(function* () {
|
|
|
52796
53510
|
while: (error) => !(SocketError.is(error) && error.reason._tag === "SocketCloseError" && (error.reason.code === 4401 || error.reason.code === 4403))
|
|
52797
53511
|
});
|
|
52798
53512
|
}).pipe(tapDefect((cause) => logError("hub tunnel: worker defect", { cause: String(cause) })), catchCause((cause) => logError("hub tunnel: worker failed", { cause: String(cause) })));
|
|
52799
|
-
const layer$
|
|
53513
|
+
const layer$5 = (config) => effectDiscard(forkScoped(runHubTunnel(config)));
|
|
52800
53514
|
//#endregion
|
|
52801
53515
|
//#region src/persistence/ProviderSessionRuntime.ts
|
|
52802
53516
|
/**
|
|
@@ -52855,7 +53569,7 @@ function toPersistenceSqlOrDecodeError(sqlOperation, decodeOperation, correlatio
|
|
|
52855
53569
|
cause
|
|
52856
53570
|
});
|
|
52857
53571
|
}
|
|
52858
|
-
const layer$
|
|
53572
|
+
const layer$4 = effect(ProviderSessionRuntimeRepository, gen(function* () {
|
|
52859
53573
|
const sql = yield* SqlClient;
|
|
52860
53574
|
const upsertRuntimeRow = void_({
|
|
52861
53575
|
Request: ProviderSessionRuntimeDbRowSchema,
|
|
@@ -53138,7 +53852,7 @@ const ProviderSessionDirectoryLive = effect(ProviderSessionDirectory, gen(functi
|
|
|
53138
53852
|
operation: "ProviderSessionDirectory.upsert",
|
|
53139
53853
|
issue: "threadId must be a non-empty string."
|
|
53140
53854
|
});
|
|
53141
|
-
const now
|
|
53855
|
+
const now = formatIso(yield* now$1);
|
|
53142
53856
|
const providerChanged = existingRuntime !== void 0 && existingRuntime.providerName !== binding.provider;
|
|
53143
53857
|
const providerInstanceId = binding.providerInstanceId ?? (!providerChanged ? existingRuntime?.providerInstanceId : null);
|
|
53144
53858
|
if (providerInstanceId === null || providerInstanceId === void 0) return yield* new ProviderValidationError({
|
|
@@ -53152,7 +53866,7 @@ const ProviderSessionDirectoryLive = effect(ProviderSessionDirectory, gen(functi
|
|
|
53152
53866
|
adapterKey: binding.adapterKey ?? (providerChanged ? binding.provider : existingRuntime?.adapterKey ?? binding.provider),
|
|
53153
53867
|
runtimeMode: binding.runtimeMode ?? existingRuntime?.runtimeMode ?? "full-access",
|
|
53154
53868
|
status: binding.status ?? existingRuntime?.status ?? "running",
|
|
53155
|
-
lastSeenAt: now
|
|
53869
|
+
lastSeenAt: now,
|
|
53156
53870
|
resumeCursor: binding.resumeCursor !== void 0 ? binding.resumeCursor : existingRuntime?.resumeCursor ?? null,
|
|
53157
53871
|
runtimePayload: mergeRuntimePayload(existingRuntime?.runtimePayload ?? null, binding.runtimePayload)
|
|
53158
53872
|
}).pipe(mapError(toPersistenceError("ProviderSessionDirectory.upsert:upsert")));
|
|
@@ -53545,7 +54259,7 @@ const makeEventNdjsonLogStore = fnUntraced(function* (filePath, options = {}) {
|
|
|
53545
54259
|
filePath: failure.filePath,
|
|
53546
54260
|
errorTag: errorTag(failure.cause)
|
|
53547
54261
|
});
|
|
53548
|
-
const stateRef = yield* make$
|
|
54262
|
+
const stateRef = yield* make$53({
|
|
53549
54263
|
pending: [],
|
|
53550
54264
|
pendingBytes: 0,
|
|
53551
54265
|
sinks: /* @__PURE__ */ new Map(),
|
|
@@ -53553,7 +54267,7 @@ const makeEventNdjsonLogStore = fnUntraced(function* (filePath, options = {}) {
|
|
|
53553
54267
|
closed: false,
|
|
53554
54268
|
lastRetentionAt: initializedAt
|
|
53555
54269
|
});
|
|
53556
|
-
const timerScope = yield* make$
|
|
54270
|
+
const timerScope = yield* make$76();
|
|
53557
54271
|
const flush = fnUntraced(function* (timerFired, close) {
|
|
53558
54272
|
const startedAt = yield* currentTimeMillis;
|
|
53559
54273
|
const result = yield* modifyEffect(stateRef, (state) => sync(() => drainPending({
|
|
@@ -53599,7 +54313,7 @@ const makeEventNdjsonLogStore = fnUntraced(function* (filePath, options = {}) {
|
|
|
53599
54313
|
if (!shouldPersist(stream, event)) return;
|
|
53600
54314
|
const payload = yield* serializeEvent(event);
|
|
53601
54315
|
if (payload === void 0) return;
|
|
53602
|
-
const line = `[${yield* now.pipe(map$4(formatIso))}] ${resolveStreamLabel(stream)}: ${payload}\n`;
|
|
54316
|
+
const line = `[${yield* now$1.pipe(map$4(formatIso))}] ${resolveStreamLabel(stream)}: ${payload}\n`;
|
|
53603
54317
|
const bytes = Buffer.byteLength(line);
|
|
53604
54318
|
if ((yield* modifyEffect(stateRef, (state) => {
|
|
53605
54319
|
if (state.closed) return succeed$1([{ flush: false }, state]);
|
|
@@ -53686,7 +54400,7 @@ const NoOpProviderEventLoggers = {
|
|
|
53686
54400
|
native: void 0,
|
|
53687
54401
|
canonical: void 0
|
|
53688
54402
|
};
|
|
53689
|
-
const layer$
|
|
54403
|
+
const layer$3 = effect(ProviderEventLoggers, gen(function* () {
|
|
53690
54404
|
const { providerEventLogPath } = yield* ServerConfig;
|
|
53691
54405
|
const attribution = yield* ResourceAttribution;
|
|
53692
54406
|
const store = yield* makeEventNdjsonLogStore(providerEventLogPath, { attribution }).pipe(catch_((error) => logWarning$1(error.message, { error }).pipe(annotateLogs({ scope: "provider-observability" }), as(void 0))));
|
|
@@ -53785,7 +54499,7 @@ const ProviderServiceLive = effect(ProviderService, fn("makeProviderService")(fu
|
|
|
53785
54499
|
const registry = yield* ProviderAdapterRegistry;
|
|
53786
54500
|
const directory = yield* ProviderSessionDirectory;
|
|
53787
54501
|
const runtimeEventPubSub = yield* unbounded$1();
|
|
53788
|
-
const nowIso = map$4(now, formatIso);
|
|
54502
|
+
const nowIso = map$4(now$1, formatIso);
|
|
53789
54503
|
const publishRuntimeEvent = (event) => succeed$1(event).pipe(tap((canonicalEvent) => canonicalEventLogger ? canonicalEventLogger.write(canonicalEvent, canonicalEvent.threadId) : void_$1), flatMap$1((canonicalEvent) => publish(runtimeEventPubSub, canonicalEvent)), asVoid);
|
|
53790
54504
|
const requireBindingInstanceId = (operation, payload) => payload.providerInstanceId !== void 0 ? succeed$1(payload.providerInstanceId) : fail(toValidationError(operation, payload.provider ? `Provider instance id is required for provider '${payload.provider}'.` : "Provider instance id is required."));
|
|
53791
54505
|
const upsertSessionBinding = (session, threadId, extra) => gen(function* () {
|
|
@@ -53804,7 +54518,7 @@ const ProviderServiceLive = effect(ProviderService, fn("makeProviderService")(fu
|
|
|
53804
54518
|
provider: canonicalEvent.provider,
|
|
53805
54519
|
eventType: canonicalEvent.type
|
|
53806
54520
|
}).pipe(andThen(publishRuntimeEvent(canonicalEvent)))));
|
|
53807
|
-
const subscribedAdapters = yield* make$
|
|
54521
|
+
const subscribedAdapters = yield* make$63(/* @__PURE__ */ new Map());
|
|
53808
54522
|
const getAdapterEntries = get$3(subscribedAdapters).pipe(map$4((map) => Array.from(map.entries())));
|
|
53809
54523
|
const reconcileInstanceSubscriptions = gen(function* () {
|
|
53810
54524
|
const previous = yield* get$3(subscribedAdapters);
|
|
@@ -54352,7 +55066,7 @@ const makeTextGenerationFromRegistry = (registry) => TextGeneration.of({
|
|
|
54352
55066
|
generateBranchName: (input) => resolveInstance(registry, "generateBranchName", input.modelSelection.instanceId).pipe(flatMap$1((textGeneration) => textGeneration.generateBranchName(input))),
|
|
54353
55067
|
generateThreadTitle: (input) => resolveInstance(registry, "generateThreadTitle", input.modelSelection.instanceId).pipe(flatMap$1((textGeneration) => textGeneration.generateThreadTitle(input)))
|
|
54354
55068
|
});
|
|
54355
|
-
const layer$
|
|
55069
|
+
const layer$2 = effect(TextGeneration, gen(function* () {
|
|
54356
55070
|
const registry = yield* ProviderInstanceRegistry;
|
|
54357
55071
|
return makeTextGenerationFromRegistry(registry);
|
|
54358
55072
|
}));
|
|
@@ -55621,7 +56335,7 @@ const probeClaudeCapabilities = (claudeSettings, environment, cwd) => {
|
|
|
55621
56335
|
const runClaudeCommand = fn("runClaudeCommand")(function* (claudeSettings, args, environment) {
|
|
55622
56336
|
const claudeEnvironment = yield* makeClaudeEnvironment(claudeSettings, environment);
|
|
55623
56337
|
const spawnCommand = yield* resolveSpawnCommand(claudeSettings.binaryPath, args, { env: claudeEnvironment });
|
|
55624
|
-
const command = make$
|
|
56338
|
+
const command = make$79(spawnCommand.command, spawnCommand.args, {
|
|
55625
56339
|
env: claudeEnvironment,
|
|
55626
56340
|
shell: spawnCommand.shell
|
|
55627
56341
|
});
|
|
@@ -55629,7 +56343,7 @@ const runClaudeCommand = fn("runClaudeCommand")(function* (claudeSettings, args,
|
|
|
55629
56343
|
});
|
|
55630
56344
|
const checkClaudeProviderStatus = fn("checkClaudeProviderStatus")(function* (claudeSettings, resolveCapabilities, environment, cwd) {
|
|
55631
56345
|
const resolvedEnvironment = environment ?? process.env;
|
|
55632
|
-
const checkedAt = formatIso(yield* now);
|
|
56346
|
+
const checkedAt = formatIso(yield* now$1);
|
|
55633
56347
|
const allModels = providerModelsFromSettings(BUILT_IN_MODELS, claudeSettings.customModels, DEFAULT_CLAUDE_MODEL_CAPABILITIES);
|
|
55634
56348
|
if (!claudeSettings.enabled) return buildServerProvider({
|
|
55635
56349
|
presentation: CLAUDE_PRESENTATION,
|
|
@@ -55741,7 +56455,7 @@ const checkClaudeProviderStatus = fn("checkClaudeProviderStatus")(function* (cla
|
|
|
55741
56455
|
}
|
|
55742
56456
|
});
|
|
55743
56457
|
});
|
|
55744
|
-
const nowIso$1 = map$4(now, formatIso);
|
|
56458
|
+
const nowIso$1 = map$4(now$1, formatIso);
|
|
55745
56459
|
const makePendingClaudeProvider = (claudeSettings) => gen(function* () {
|
|
55746
56460
|
const checkedAt = yield* nowIso$1;
|
|
55747
56461
|
const models = providerModelsFromSettings(BUILT_IN_MODELS, claudeSettings.customModels, DEFAULT_CLAUDE_MODEL_CAPABILITIES);
|
|
@@ -55838,11 +56552,11 @@ const makeClaudeTextGeneration = fn("makeClaudeTextGeneration")(function* (claud
|
|
|
55838
56552
|
...settingsJson ? ["--settings", settingsJson] : [],
|
|
55839
56553
|
"--dangerously-skip-permissions"
|
|
55840
56554
|
], { env: claudeEnvironment });
|
|
55841
|
-
const command = make$
|
|
56555
|
+
const command = make$79(spawnCommand.command, spawnCommand.args, {
|
|
55842
56556
|
env: claudeEnvironment,
|
|
55843
56557
|
cwd,
|
|
55844
56558
|
shell: spawnCommand.shell,
|
|
55845
|
-
stdin: { stream: encodeText(make$
|
|
56559
|
+
stdin: { stream: encodeText(make$74(prompt)) }
|
|
55846
56560
|
});
|
|
55847
56561
|
const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("claude", operation, cause, "Failed to spawn Claude CLI process")));
|
|
55848
56562
|
const [stdout, stderr, exitCode] = yield* all([
|
|
@@ -56806,7 +57520,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
|
|
|
56806
57520
|
}));
|
|
56807
57521
|
const sessions = /* @__PURE__ */ new Map();
|
|
56808
57522
|
const runtimeEventQueue = yield* unbounded$2();
|
|
56809
|
-
const nowIso = map$4(now, formatIso);
|
|
57523
|
+
const nowIso = map$4(now$1, formatIso);
|
|
56810
57524
|
const randomUUIDv4 = crypto.randomUUIDv4.pipe(mapError((cause) => new ProviderAdapterRequestError({
|
|
56811
57525
|
provider: PROVIDER$2,
|
|
56812
57526
|
method: "crypto/randomUUIDv4",
|
|
@@ -58184,7 +58898,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
|
|
|
58184
58898
|
const taskAgents = /* @__PURE__ */ new Map();
|
|
58185
58899
|
const workflowMemberFingerprints = /* @__PURE__ */ new Map();
|
|
58186
58900
|
const liveTaskIds = /* @__PURE__ */ new Set();
|
|
58187
|
-
const contextRef = yield* make$
|
|
58901
|
+
const contextRef = yield* make$63(void 0);
|
|
58188
58902
|
/**
|
|
58189
58903
|
* Handle AskUserQuestion tool calls by emitting a `user-input.requested`
|
|
58190
58904
|
* runtime event and waiting for the user to respond via `respondToUserInput`.
|
|
@@ -58201,7 +58915,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
|
|
|
58201
58915
|
})) : [],
|
|
58202
58916
|
multiSelect: typeof q.multiSelect === "boolean" ? q.multiSelect : false
|
|
58203
58917
|
}));
|
|
58204
|
-
const answersDeferred = yield* make$
|
|
58918
|
+
const answersDeferred = yield* make$73();
|
|
58205
58919
|
let aborted = false;
|
|
58206
58920
|
const pendingInput = {
|
|
58207
58921
|
questions,
|
|
@@ -58297,7 +59011,7 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
|
|
|
58297
59011
|
const requestId = ApprovalRequestId.make(yield* randomUUIDv4);
|
|
58298
59012
|
const requestType = classifyRequestType(toolName);
|
|
58299
59013
|
const detail = summarizeToolRequest(toolName, toolInput);
|
|
58300
|
-
const decisionDeferred = yield* make$
|
|
59014
|
+
const decisionDeferred = yield* make$73();
|
|
58301
59015
|
const pendingApproval = {
|
|
58302
59016
|
requestType,
|
|
58303
59017
|
detail,
|
|
@@ -58702,15 +59416,15 @@ const makeClaudeAdapter = fn("makeClaudeAdapter")(function* (claudeSettings, opt
|
|
|
58702
59416
|
const makeManagedServerProvider = fn("makeManagedServerProvider")(function* (input) {
|
|
58703
59417
|
const backgroundPolicy = yield* BackgroundPolicy;
|
|
58704
59418
|
const serverSettings = yield* ServerSettingsService;
|
|
58705
|
-
const refreshSemaphore = yield* make$
|
|
59419
|
+
const refreshSemaphore = yield* make$75(1);
|
|
58706
59420
|
const changesPubSub = yield* acquireRelease(unbounded$1(), shutdown$2);
|
|
58707
59421
|
const initialSettings = yield* input.getSettings;
|
|
58708
|
-
const snapshotStateRef = yield* make$
|
|
59422
|
+
const snapshotStateRef = yield* make$63({
|
|
58709
59423
|
snapshot: yield* input.initialSnapshot(initialSettings),
|
|
58710
59424
|
enrichmentGeneration: 0
|
|
58711
59425
|
});
|
|
58712
|
-
const settingsRef = yield* make$
|
|
58713
|
-
const enrichmentFiberRef = yield* make$
|
|
59426
|
+
const settingsRef = yield* make$63(initialSettings);
|
|
59427
|
+
const enrichmentFiberRef = yield* make$63(null);
|
|
58714
59428
|
const scope$1 = yield* scope;
|
|
58715
59429
|
const publishEnrichedSnapshot = fn("publishEnrichedSnapshot")(function* (generation, nextSnapshot) {
|
|
58716
59430
|
const snapshotToPublish = yield* modify$2(snapshotStateRef, (state) => {
|
|
@@ -58901,7 +59615,7 @@ const ClaudeDriver = {
|
|
|
58901
59615
|
...eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}
|
|
58902
59616
|
});
|
|
58903
59617
|
const textGeneration = yield* makeClaudeTextGeneration(effectiveConfig, processEnv);
|
|
58904
|
-
const capabilitiesProbeCache = yield* make$
|
|
59618
|
+
const capabilitiesProbeCache = yield* make$81({
|
|
58905
59619
|
capacity: 1,
|
|
58906
59620
|
timeToLive: CAPABILITIES_PROBE_TTL,
|
|
58907
59621
|
lookup: () => probeClaudeCapabilities(effectiveConfig, processEnv, cwd).pipe(provideService(Path, path))
|
|
@@ -59037,14 +59751,14 @@ const makeCodexTextGeneration = fn("makeCodexTextGeneration")(function* (codexCo
|
|
|
59037
59751
|
...imagePaths.flatMap((imagePath) => ["--image", imagePath]),
|
|
59038
59752
|
"-"
|
|
59039
59753
|
], { env: resolvedEnvironment });
|
|
59040
|
-
const command = make$
|
|
59754
|
+
const command = make$79(spawnCommand.command, spawnCommand.args, {
|
|
59041
59755
|
env: {
|
|
59042
59756
|
...resolvedEnvironment,
|
|
59043
59757
|
...codexConfig.homePath ? { CODEX_HOME: expandHomePath(codexConfig.homePath) } : {}
|
|
59044
59758
|
},
|
|
59045
59759
|
cwd,
|
|
59046
59760
|
shell: spawnCommand.shell,
|
|
59047
|
-
stdin: { stream: encodeText(make$
|
|
59761
|
+
stdin: { stream: encodeText(make$74(prompt)) }
|
|
59048
59762
|
});
|
|
59049
59763
|
const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to spawn Codex CLI process")));
|
|
59050
59764
|
const [stdout, stderr, exitCode] = yield* all([
|
|
@@ -76997,10 +77711,10 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
|
|
|
76997
77711
|
const outgoing = yield* unbounded$2();
|
|
76998
77712
|
const incomingNotifications = yield* unbounded$2();
|
|
76999
77713
|
const incomingRequests = yield* unbounded$2();
|
|
77000
|
-
const pending = yield* make$
|
|
77001
|
-
const nextRequestId = yield* make$
|
|
77002
|
-
const remainder = yield* make$
|
|
77003
|
-
const terminationHandled = yield* make$
|
|
77714
|
+
const pending = yield* make$63(/* @__PURE__ */ new Map());
|
|
77715
|
+
const nextRequestId = yield* make$63(1);
|
|
77716
|
+
const remainder = yield* make$63("");
|
|
77717
|
+
const terminationHandled = yield* make$63(false);
|
|
77004
77718
|
const logProtocol = (event) => {
|
|
77005
77719
|
if (event.direction === "incoming" && !options.logIncoming) return void_$1;
|
|
77006
77720
|
if (event.direction === "outgoing" && !options.logOutgoing) return void_$1;
|
|
@@ -77099,7 +77813,7 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
|
|
|
77099
77813
|
yield* fromQueue(outgoing).pipe(run$5(options.stdio.stdout()), forkScoped);
|
|
77100
77814
|
const request = (method, payload) => gen(function* () {
|
|
77101
77815
|
const requestId = yield* modify$2(nextRequestId, (current) => [current, current + 1]);
|
|
77102
|
-
const deferred = yield* make$
|
|
77816
|
+
const deferred = yield* make$73();
|
|
77103
77817
|
yield* update$2(pending, (current) => new Map(current).set(String(requestId), {
|
|
77104
77818
|
deferred,
|
|
77105
77819
|
method
|
|
@@ -77127,7 +77841,7 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
|
|
|
77127
77841
|
//#endregion
|
|
77128
77842
|
//#region ../effect-codex-app-server/src/_internal/stdio.ts
|
|
77129
77843
|
const encoder$2 = new TextEncoder();
|
|
77130
|
-
const makeChildStdio$1 = (handle) => make$
|
|
77844
|
+
const makeChildStdio$1 = (handle) => make$80({
|
|
77131
77845
|
args: succeed$1([]),
|
|
77132
77846
|
stdin: handle.stdout,
|
|
77133
77847
|
stdout: () => mapInput(handle.stdin, (chunk) => typeof chunk === "string" ? encoder$2.encode(chunk) : chunk),
|
|
@@ -77138,7 +77852,7 @@ fn("makeInMemoryStdio")(function* () {
|
|
|
77138
77852
|
const output = yield* unbounded$2();
|
|
77139
77853
|
const decoder = new TextDecoder();
|
|
77140
77854
|
return {
|
|
77141
|
-
stdio: make$
|
|
77855
|
+
stdio: make$80({
|
|
77142
77856
|
args: succeed$1([]),
|
|
77143
77857
|
stdin: fromQueue(input),
|
|
77144
77858
|
stdout: () => forEach$1((chunk) => offer$1(output, typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }))),
|
|
@@ -77162,7 +77876,7 @@ const makeTerminationError$1 = (handle) => match$2(handle.exitCode, {
|
|
|
77162
77876
|
//#endregion
|
|
77163
77877
|
//#region ../effect-codex-app-server/src/client.ts
|
|
77164
77878
|
var CodexAppServerClient = class extends Service$2()("effect-codex-app-server/client/CodexAppServerClient") {};
|
|
77165
|
-
const make$
|
|
77879
|
+
const make$6 = fn("effect-codex-app-server/CodexAppServerClient.make")(function* (stdio, options = {}, terminationError) {
|
|
77166
77880
|
const requestHandlers = /* @__PURE__ */ new Map();
|
|
77167
77881
|
const notificationHandlers = /* @__PURE__ */ new Map();
|
|
77168
77882
|
let unknownRequestHandler;
|
|
@@ -77229,7 +77943,7 @@ const make$5 = fn("effect-codex-app-server/CodexAppServerClient.make")(function*
|
|
|
77229
77943
|
const layerChildProcess$1 = (handle, options = {}) => effect(CodexAppServerClient, makeChildProcessClient(handle, options));
|
|
77230
77944
|
const makeChildProcessClient = fn("effect-codex-app-server/CodexAppServerClient.makeChildProcessClient")(function* (handle, options) {
|
|
77231
77945
|
yield* runDrain(handle.stderr).pipe(ignore$1, forkScoped);
|
|
77232
|
-
return yield* make$
|
|
77946
|
+
return yield* make$6(makeChildStdio$1(handle), options, makeTerminationError$1(handle));
|
|
77233
77947
|
});
|
|
77234
77948
|
//#endregion
|
|
77235
77949
|
//#region src/provider/Layers/CodexProvider.ts
|
|
@@ -77425,7 +78139,7 @@ const probeCodexAppServerProvider = fn("probeCodexAppServerProvider")(function*
|
|
|
77425
78139
|
env: environment,
|
|
77426
78140
|
extendEnv: true
|
|
77427
78141
|
});
|
|
77428
|
-
const child = yield* spawner.spawn(make$
|
|
78142
|
+
const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
|
|
77429
78143
|
cwd: input.cwd,
|
|
77430
78144
|
env: environment,
|
|
77431
78145
|
extendEnv: true,
|
|
@@ -77477,7 +78191,7 @@ const emptyCodexModelsFromSettings = (codexSettings) => {
|
|
|
77477
78191
|
}));
|
|
77478
78192
|
};
|
|
77479
78193
|
const makePendingCodexProvider = (codexSettings) => gen(function* () {
|
|
77480
|
-
const checkedAt = yield* map$4(now, formatIso);
|
|
78194
|
+
const checkedAt = yield* map$4(now$1, formatIso);
|
|
77481
78195
|
const models = emptyCodexModelsFromSettings(codexSettings);
|
|
77482
78196
|
if (!codexSettings.enabled) return buildServerProvider({
|
|
77483
78197
|
presentation: CODEX_PRESENTATION,
|
|
@@ -77533,7 +78247,7 @@ function accountProbeStatus(account) {
|
|
|
77533
78247
|
}
|
|
77534
78248
|
const checkCodexProviderStatus = fn("checkCodexProviderStatus")(function* (codexSettings, probe = probeCodexAppServerProvider, environment) {
|
|
77535
78249
|
const resolvedEnvironment = environment ?? process.env;
|
|
77536
|
-
const checkedAt = formatIso(yield* now);
|
|
78250
|
+
const checkedAt = formatIso(yield* now$1);
|
|
77537
78251
|
const emptyModels = emptyCodexModelsFromSettings(codexSettings);
|
|
77538
78252
|
if (!codexSettings.enabled) return buildServerProvider({
|
|
77539
78253
|
presentation: CODEX_PRESENTATION,
|
|
@@ -78103,7 +78817,7 @@ function currentProviderThreadId(session) {
|
|
|
78103
78817
|
}
|
|
78104
78818
|
function updateSession(sessionRef, updates) {
|
|
78105
78819
|
return gen(function* () {
|
|
78106
|
-
const updatedAt = formatIso(yield* now);
|
|
78820
|
+
const updatedAt = formatIso(yield* now$1);
|
|
78107
78821
|
yield* update$2(sessionRef, (session) => ({
|
|
78108
78822
|
...session,
|
|
78109
78823
|
...updates,
|
|
@@ -78125,14 +78839,14 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78125
78839
|
const runtimeScope = yield* Scope;
|
|
78126
78840
|
const crypto = yield* Crypto;
|
|
78127
78841
|
const events = yield* unbounded$2();
|
|
78128
|
-
const pendingApprovalsRef = yield* make$
|
|
78129
|
-
const approvalCorrelationsRef = yield* make$
|
|
78130
|
-
const pendingUserInputsRef = yield* make$
|
|
78131
|
-
const collabReceiverTurnsRef = yield* make$
|
|
78132
|
-
const collabChildAgentsRef = yield* make$
|
|
78842
|
+
const pendingApprovalsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
78843
|
+
const approvalCorrelationsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
78844
|
+
const pendingUserInputsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
78845
|
+
const collabReceiverTurnsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
78846
|
+
const collabChildAgentsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
78133
78847
|
/** Child provider-thread id → its currently running provider turn id. */
|
|
78134
|
-
const collabChildLiveTurnsRef = yield* make$
|
|
78135
|
-
const closedRef = yield* make$
|
|
78848
|
+
const collabChildLiveTurnsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
78849
|
+
const closedRef = yield* make$63(false);
|
|
78136
78850
|
const resolvedHomePath = options.homePath ? expandHomePath(options.homePath) : void 0;
|
|
78137
78851
|
const env = {
|
|
78138
78852
|
...options.environment,
|
|
@@ -78144,7 +78858,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78144
78858
|
env,
|
|
78145
78859
|
extendEnv
|
|
78146
78860
|
});
|
|
78147
|
-
const child = yield* spawner.spawn(make$
|
|
78861
|
+
const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
|
|
78148
78862
|
cwd: options.cwd,
|
|
78149
78863
|
env,
|
|
78150
78864
|
extendEnv,
|
|
@@ -78157,13 +78871,13 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78157
78871
|
const clientContext = yield* layerChildProcess$1(child).pipe(build, provideService(Scope, runtimeScope));
|
|
78158
78872
|
const client = yield* service(CodexAppServerClient).pipe(provide$1(clientContext));
|
|
78159
78873
|
const serverNotifications = yield* unbounded$2();
|
|
78160
|
-
const nowIso = map$4(now, formatIso);
|
|
78874
|
+
const nowIso = map$4(now$1, formatIso);
|
|
78161
78875
|
const randomUUIDv4 = (purpose) => crypto.randomUUIDv4.pipe(mapError((cause) => new CodexAppServerIdentifierGenerationError({
|
|
78162
78876
|
purpose,
|
|
78163
78877
|
cause
|
|
78164
78878
|
})));
|
|
78165
78879
|
const sessionCreatedAt = yield* nowIso;
|
|
78166
|
-
const sessionRef = yield* make$
|
|
78880
|
+
const sessionRef = yield* make$63({
|
|
78167
78881
|
provider: PROVIDER$1,
|
|
78168
78882
|
...options.providerInstanceId ? { providerInstanceId: options.providerInstanceId } : {},
|
|
78169
78883
|
status: "connecting",
|
|
@@ -78491,7 +79205,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78491
79205
|
const requestId = ApprovalRequestId.make(yield* randomUUIDv4("command-approval-request"));
|
|
78492
79206
|
const turnId = TurnId.make(payload.turnId);
|
|
78493
79207
|
const itemId = ProviderItemId.make(payload.itemId);
|
|
78494
|
-
const decision = yield* make$
|
|
79208
|
+
const decision = yield* make$73();
|
|
78495
79209
|
yield* update$2(pendingApprovalsRef, (current) => {
|
|
78496
79210
|
const next = new Map(current);
|
|
78497
79211
|
next.set(requestId, {
|
|
@@ -78534,7 +79248,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78534
79248
|
const requestId = ApprovalRequestId.make(yield* randomUUIDv4("file-change-approval-request"));
|
|
78535
79249
|
const turnId = TurnId.make(payload.turnId);
|
|
78536
79250
|
const itemId = ProviderItemId.make(payload.itemId);
|
|
78537
|
-
const decision = yield* make$
|
|
79251
|
+
const decision = yield* make$73();
|
|
78538
79252
|
yield* update$2(pendingApprovalsRef, (current) => {
|
|
78539
79253
|
const next = new Map(current);
|
|
78540
79254
|
next.set(requestId, {
|
|
@@ -78577,7 +79291,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78577
79291
|
const requestId = ApprovalRequestId.make(yield* randomUUIDv4("user-input-request"));
|
|
78578
79292
|
const turnId = TurnId.make(payload.turnId);
|
|
78579
79293
|
const itemId = ProviderItemId.make(payload.itemId);
|
|
78580
|
-
const answers = yield* make$
|
|
79294
|
+
const answers = yield* make$73();
|
|
78581
79295
|
yield* update$2(pendingUserInputsRef, (current) => {
|
|
78582
79296
|
const next = new Map(current);
|
|
78583
79297
|
next.set(requestId, {
|
|
@@ -78610,7 +79324,7 @@ const makeCodexSessionRuntime = (options) => gen(function* () {
|
|
|
78610
79324
|
discard: true
|
|
78611
79325
|
});
|
|
78612
79326
|
yield* fromQueue(serverNotifications).pipe(runForEach(handleRawNotification), forkIn(runtimeScope));
|
|
78613
|
-
const stderrRemainderRef = yield* make$
|
|
79327
|
+
const stderrRemainderRef = yield* make$63("");
|
|
78614
79328
|
yield* child.stderr.pipe(decodeText(), runForEach((chunk) => modify$2(stderrRemainderRef, (current) => {
|
|
78615
79329
|
const lines = (current + chunk).split("\n");
|
|
78616
79330
|
const remainder = lines.pop() ?? "";
|
|
@@ -79796,7 +80510,7 @@ const makeCodexAdapter = fn("makeCodexAdapter")(function* (codexConfig, options)
|
|
|
79796
80510
|
...input.modelSelection?.instanceId === boundInstanceId ? { model: input.modelSelection.model } : {},
|
|
79797
80511
|
...serviceTier ? { serviceTier } : {}
|
|
79798
80512
|
};
|
|
79799
|
-
const sessionScope = yield* make$
|
|
80513
|
+
const sessionScope = yield* make$76("sequential");
|
|
79800
80514
|
let sessionScopeTransferred = false;
|
|
79801
80515
|
yield* addFinalizer(() => sessionScopeTransferred ? void_$1 : close(sessionScope, void_$2));
|
|
79802
80516
|
const runtime = yield* (options?.makeRuntime ?? makeCodexSessionRuntime)(runtimeInput).pipe(provideService(Scope, sessionScope), provideService(ChildProcessSpawner, childProcessSpawner), provideService(Crypto, crypto), mapError((cause) => new ProviderAdapterProcessError({
|
|
@@ -83566,9 +84280,9 @@ const makeAcpPatchedProtocol = fn("makeAcpPatchedProtocol")(function* (options)
|
|
|
83566
84280
|
const notificationQueue = yield* unbounded$2();
|
|
83567
84281
|
const disconnects = yield* unbounded$2();
|
|
83568
84282
|
const outgoing = yield* unbounded$2();
|
|
83569
|
-
const nextRequestId = yield* make$
|
|
83570
|
-
const terminationHandled = yield* make$
|
|
83571
|
-
const extPending = yield* make$
|
|
84283
|
+
const nextRequestId = yield* make$63(1);
|
|
84284
|
+
const terminationHandled = yield* make$63(false);
|
|
84285
|
+
const extPending = yield* make$63(/* @__PURE__ */ new Map());
|
|
83572
84286
|
const logProtocol = (event) => {
|
|
83573
84287
|
if (event.direction === "incoming" && !options.logIncoming) return void_$1;
|
|
83574
84288
|
if (event.direction === "outgoing" && !options.logOutgoing) return void_$1;
|
|
@@ -83786,7 +84500,7 @@ const makeAcpPatchedProtocol = fn("makeAcpPatchedProtocol")(function* (options)
|
|
|
83786
84500
|
},
|
|
83787
84501
|
request: fn("sendRequest")(function* (method, payload) {
|
|
83788
84502
|
const requestId = yield* modify$2(nextRequestId, (current) => [current, current + 1]);
|
|
83789
|
-
const deferred = yield* make$
|
|
84503
|
+
const deferred = yield* make$73();
|
|
83790
84504
|
yield* update$2(extPending, (pending) => new Map(pending).set(String(requestId), {
|
|
83791
84505
|
deferred,
|
|
83792
84506
|
method
|
|
@@ -83808,113 +84522,113 @@ function isProtocolError(value) {
|
|
|
83808
84522
|
}
|
|
83809
84523
|
//#endregion
|
|
83810
84524
|
//#region ../effect-acp/src/rpc.ts
|
|
83811
|
-
const InitializeRpc = make$
|
|
84525
|
+
const InitializeRpc = make$51(AGENT_METHODS.initialize, {
|
|
83812
84526
|
payload: InitializeRequest,
|
|
83813
84527
|
success: InitializeResponse,
|
|
83814
84528
|
error: Error$1
|
|
83815
84529
|
});
|
|
83816
|
-
const AuthenticateRpc = make$
|
|
84530
|
+
const AuthenticateRpc = make$51(AGENT_METHODS.authenticate, {
|
|
83817
84531
|
payload: AuthenticateRequest,
|
|
83818
84532
|
success: AuthenticateResponse,
|
|
83819
84533
|
error: Error$1
|
|
83820
84534
|
});
|
|
83821
|
-
const LogoutRpc = make$
|
|
84535
|
+
const LogoutRpc = make$51(AGENT_METHODS.logout, {
|
|
83822
84536
|
payload: LogoutRequest,
|
|
83823
84537
|
success: LogoutResponse,
|
|
83824
84538
|
error: Error$1
|
|
83825
84539
|
});
|
|
83826
|
-
const NewSessionRpc = make$
|
|
84540
|
+
const NewSessionRpc = make$51(AGENT_METHODS.session_new, {
|
|
83827
84541
|
payload: NewSessionRequest,
|
|
83828
84542
|
success: NewSessionResponse,
|
|
83829
84543
|
error: Error$1
|
|
83830
84544
|
});
|
|
83831
|
-
const LoadSessionRpc = make$
|
|
84545
|
+
const LoadSessionRpc = make$51(AGENT_METHODS.session_load, {
|
|
83832
84546
|
payload: LoadSessionRequest,
|
|
83833
84547
|
success: LoadSessionResponse,
|
|
83834
84548
|
error: Error$1
|
|
83835
84549
|
});
|
|
83836
|
-
const ListSessionsRpc = make$
|
|
84550
|
+
const ListSessionsRpc = make$51(AGENT_METHODS.session_list, {
|
|
83837
84551
|
payload: ListSessionsRequest,
|
|
83838
84552
|
success: ListSessionsResponse,
|
|
83839
84553
|
error: Error$1
|
|
83840
84554
|
});
|
|
83841
|
-
const ForkSessionRpc = make$
|
|
84555
|
+
const ForkSessionRpc = make$51(AGENT_METHODS.session_fork, {
|
|
83842
84556
|
payload: ForkSessionRequest,
|
|
83843
84557
|
success: ForkSessionResponse,
|
|
83844
84558
|
error: Error$1
|
|
83845
84559
|
});
|
|
83846
|
-
const ResumeSessionRpc = make$
|
|
84560
|
+
const ResumeSessionRpc = make$51(AGENT_METHODS.session_resume, {
|
|
83847
84561
|
payload: ResumeSessionRequest,
|
|
83848
84562
|
success: ResumeSessionResponse,
|
|
83849
84563
|
error: Error$1
|
|
83850
84564
|
});
|
|
83851
|
-
const CloseSessionRpc = make$
|
|
84565
|
+
const CloseSessionRpc = make$51(AGENT_METHODS.session_close, {
|
|
83852
84566
|
payload: CloseSessionRequest,
|
|
83853
84567
|
success: CloseSessionResponse,
|
|
83854
84568
|
error: Error$1
|
|
83855
84569
|
});
|
|
83856
|
-
const PromptRpc = make$
|
|
84570
|
+
const PromptRpc = make$51(AGENT_METHODS.session_prompt, {
|
|
83857
84571
|
payload: PromptRequest,
|
|
83858
84572
|
success: PromptResponse,
|
|
83859
84573
|
error: Error$1
|
|
83860
84574
|
});
|
|
83861
|
-
const SetSessionModelRpc = make$
|
|
84575
|
+
const SetSessionModelRpc = make$51(AGENT_METHODS.session_set_model, {
|
|
83862
84576
|
payload: SetSessionModelRequest,
|
|
83863
84577
|
success: SetSessionModelResponse,
|
|
83864
84578
|
error: Error$1
|
|
83865
84579
|
});
|
|
83866
|
-
const SetSessionConfigOptionRpc = make$
|
|
84580
|
+
const SetSessionConfigOptionRpc = make$51(AGENT_METHODS.session_set_config_option, {
|
|
83867
84581
|
payload: SetSessionConfigOptionRequest,
|
|
83868
84582
|
success: SetSessionConfigOptionResponse,
|
|
83869
84583
|
error: Error$1
|
|
83870
84584
|
});
|
|
83871
|
-
const ReadTextFileRpc = make$
|
|
84585
|
+
const ReadTextFileRpc = make$51(CLIENT_METHODS.fs_read_text_file, {
|
|
83872
84586
|
payload: ReadTextFileRequest,
|
|
83873
84587
|
success: ReadTextFileResponse,
|
|
83874
84588
|
error: Error$1
|
|
83875
84589
|
});
|
|
83876
|
-
const WriteTextFileRpc = make$
|
|
84590
|
+
const WriteTextFileRpc = make$51(CLIENT_METHODS.fs_write_text_file, {
|
|
83877
84591
|
payload: WriteTextFileRequest,
|
|
83878
84592
|
success: WriteTextFileResponse,
|
|
83879
84593
|
error: Error$1
|
|
83880
84594
|
});
|
|
83881
|
-
const RequestPermissionRpc = make$
|
|
84595
|
+
const RequestPermissionRpc = make$51(CLIENT_METHODS.session_request_permission, {
|
|
83882
84596
|
payload: RequestPermissionRequest,
|
|
83883
84597
|
success: RequestPermissionResponse,
|
|
83884
84598
|
error: Error$1
|
|
83885
84599
|
});
|
|
83886
|
-
const ElicitationRpc = make$
|
|
84600
|
+
const ElicitationRpc = make$51(CLIENT_METHODS.session_elicitation, {
|
|
83887
84601
|
payload: ElicitationRequest,
|
|
83888
84602
|
success: ElicitationResponse,
|
|
83889
84603
|
error: Error$1
|
|
83890
84604
|
});
|
|
83891
|
-
const CreateTerminalRpc = make$
|
|
84605
|
+
const CreateTerminalRpc = make$51(CLIENT_METHODS.terminal_create, {
|
|
83892
84606
|
payload: CreateTerminalRequest,
|
|
83893
84607
|
success: CreateTerminalResponse,
|
|
83894
84608
|
error: Error$1
|
|
83895
84609
|
});
|
|
83896
|
-
const TerminalOutputRpc = make$
|
|
84610
|
+
const TerminalOutputRpc = make$51(CLIENT_METHODS.terminal_output, {
|
|
83897
84611
|
payload: TerminalOutputRequest,
|
|
83898
84612
|
success: TerminalOutputResponse,
|
|
83899
84613
|
error: Error$1
|
|
83900
84614
|
});
|
|
83901
|
-
const ReleaseTerminalRpc = make$
|
|
84615
|
+
const ReleaseTerminalRpc = make$51(CLIENT_METHODS.terminal_release, {
|
|
83902
84616
|
payload: ReleaseTerminalRequest,
|
|
83903
84617
|
success: ReleaseTerminalResponse,
|
|
83904
84618
|
error: Error$1
|
|
83905
84619
|
});
|
|
83906
|
-
const WaitForTerminalExitRpc = make$
|
|
84620
|
+
const WaitForTerminalExitRpc = make$51(CLIENT_METHODS.terminal_wait_for_exit, {
|
|
83907
84621
|
payload: WaitForTerminalExitRequest,
|
|
83908
84622
|
success: WaitForTerminalExitResponse,
|
|
83909
84623
|
error: Error$1
|
|
83910
84624
|
});
|
|
83911
|
-
const KillTerminalRpc = make$
|
|
84625
|
+
const KillTerminalRpc = make$51(CLIENT_METHODS.terminal_kill, {
|
|
83912
84626
|
payload: KillTerminalRequest,
|
|
83913
84627
|
success: KillTerminalResponse,
|
|
83914
84628
|
error: Error$1
|
|
83915
84629
|
});
|
|
83916
|
-
const AgentRpcs = make$
|
|
83917
|
-
const ClientRpcs = make$
|
|
84630
|
+
const AgentRpcs = make$50(InitializeRpc, AuthenticateRpc, LogoutRpc, NewSessionRpc, LoadSessionRpc, ListSessionsRpc, ForkSessionRpc, ResumeSessionRpc, CloseSessionRpc, PromptRpc, SetSessionModelRpc, SetSessionConfigOptionRpc);
|
|
84631
|
+
const ClientRpcs = make$50(ReadTextFileRpc, WriteTextFileRpc, RequestPermissionRpc, ElicitationRpc, CreateTerminalRpc, TerminalOutputRpc, ReleaseTerminalRpc, WaitForTerminalExitRpc, KillTerminalRpc);
|
|
83918
84632
|
//#endregion
|
|
83919
84633
|
//#region ../effect-acp/src/_internal/shared.ts
|
|
83920
84634
|
const isError = is(Error$1);
|
|
@@ -83939,7 +84653,7 @@ ArraySchema(Unknown);
|
|
|
83939
84653
|
//#endregion
|
|
83940
84654
|
//#region ../effect-acp/src/_internal/stdio.ts
|
|
83941
84655
|
const encoder = new TextEncoder();
|
|
83942
|
-
const makeChildStdio = (handle) => make$
|
|
84656
|
+
const makeChildStdio = (handle) => make$80({
|
|
83943
84657
|
args: succeed$1([]),
|
|
83944
84658
|
stdin: handle.stdout,
|
|
83945
84659
|
stdout: () => mapInput(handle.stdin, (chunk) => typeof chunk === "string" ? encoder.encode(chunk) : chunk),
|
|
@@ -83950,7 +84664,7 @@ fn("makeInMemoryStdio")(function* () {
|
|
|
83950
84664
|
const output = yield* unbounded$2();
|
|
83951
84665
|
const decoder = new TextDecoder();
|
|
83952
84666
|
return {
|
|
83953
|
-
stdio: make$
|
|
84667
|
+
stdio: make$80({
|
|
83954
84668
|
args: succeed$1([]),
|
|
83955
84669
|
stdin: fromQueue(input),
|
|
83956
84670
|
stdout: () => forEach$1((chunk) => offer$1(output, typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true }))),
|
|
@@ -83974,7 +84688,7 @@ const makeTerminationError = (handle) => match$2(handle.exitCode, {
|
|
|
83974
84688
|
//#endregion
|
|
83975
84689
|
//#region ../effect-acp/src/client.ts
|
|
83976
84690
|
var AcpClient = class extends Service$2()("effect-acp/client/AcpClient") {};
|
|
83977
|
-
const make$
|
|
84691
|
+
const make$5 = fn("effect-acp/AcpClient.make")(function* (stdio, options = {}, terminationError) {
|
|
83978
84692
|
const coreHandlers = {};
|
|
83979
84693
|
const notificationHandlers = {
|
|
83980
84694
|
sessionUpdate: {
|
|
@@ -84042,9 +84756,9 @@ const make$4 = fn("effect-acp/AcpClient.make")(function* (stdio, options = {}, t
|
|
|
84042
84756
|
[CLIENT_METHODS.terminal_kill]: (payload) => runHandler(coreHandlers.terminalKill, payload, CLIENT_METHODS.terminal_kill).pipe(map$4((result) => result ?? {})),
|
|
84043
84757
|
[CLIENT_METHODS.terminal_release]: (payload) => runHandler(coreHandlers.terminalRelease, payload, CLIENT_METHODS.terminal_release).pipe(map$4((result) => result ?? {}))
|
|
84044
84758
|
}));
|
|
84045
|
-
yield* make$
|
|
84759
|
+
yield* make$16(ClientRpcs).pipe(provideService(Protocol, transport.serverProtocol), provide$1(clientHandlerLayer), forkScoped);
|
|
84046
84760
|
let nextRpcRequestId = 2 ** 32;
|
|
84047
|
-
const rpc = yield* make$
|
|
84761
|
+
const rpc = yield* make$17(AgentRpcs, { generateRequestId: () => RequestId$2(nextRpcRequestId++) }).pipe(provideService(Protocol$1, transport.clientProtocol));
|
|
84048
84762
|
return AcpClient.of({
|
|
84049
84763
|
raw: {
|
|
84050
84764
|
notifications: transport.incoming,
|
|
@@ -84131,9 +84845,152 @@ const make$4 = fn("effect-acp/AcpClient.make")(function* (stdio, options = {}, t
|
|
|
84131
84845
|
const layerChildProcess = (handle, options = {}) => {
|
|
84132
84846
|
const stdio = makeChildStdio(handle);
|
|
84133
84847
|
const terminationError = makeTerminationError(handle);
|
|
84134
|
-
return effect(AcpClient, make$
|
|
84848
|
+
return effect(AcpClient, make$5(stdio, options, terminationError));
|
|
84135
84849
|
};
|
|
84136
84850
|
//#endregion
|
|
84851
|
+
//#region src/provider/acp/AcpLocalToolHost.ts
|
|
84852
|
+
/**
|
|
84853
|
+
* AcpLocalToolHost — agentlink fork addition.
|
|
84854
|
+
*
|
|
84855
|
+
* Default client-side implementations of the ACP `fs/*` and `terminal/*`
|
|
84856
|
+
* methods. Some ACP agents (Kimi CLI, notably) do not execute their local
|
|
84857
|
+
* tools in-process; they delegate shell and file operations to the client
|
|
84858
|
+
* through `terminal/create` + `fs/read_text_file` / `fs/write_text_file`.
|
|
84859
|
+
* When the client doesn't advertise those capabilities every such tool call
|
|
84860
|
+
* fails ("ACP terminal capability is unavailable").
|
|
84861
|
+
*
|
|
84862
|
+
* `AcpSessionRuntime` registers these handlers and advertises the matching
|
|
84863
|
+
* client capabilities only when `hostLocalTools` is enabled for the agent
|
|
84864
|
+
* (see `AcpAgentDescriptor.hostLocalTools`). Agents that run tools in their
|
|
84865
|
+
* own process (Gemini/Qwen today) leave the flag off and are unaffected.
|
|
84866
|
+
*
|
|
84867
|
+
* @module provider/acp/AcpLocalToolHost
|
|
84868
|
+
*/
|
|
84869
|
+
/**
|
|
84870
|
+
* Fallback cap for retained terminal output when the agent does not send
|
|
84871
|
+
* `outputByteLimit`. The spec only bounds output when the agent asks; an
|
|
84872
|
+
* unbounded buffer would let a noisy command exhaust daemon memory, so a
|
|
84873
|
+
* generous default (2 MB) is applied instead of retaining everything.
|
|
84874
|
+
*/
|
|
84875
|
+
const DEFAULT_OUTPUT_BYTE_LIMIT = 2e6;
|
|
84876
|
+
const internalError = (message) => AcpRequestError.internalError(message);
|
|
84877
|
+
const unknownTerminal = (terminalId) => AcpRequestError.resourceNotFound(`Unknown ACP terminal: ${terminalId}`);
|
|
84878
|
+
const isNotFoundCause = (cause) => typeof cause === "object" && cause !== null && cause._tag === "SystemError" && cause.reason === "NotFound";
|
|
84879
|
+
const toFsError = (operation, filePath, cause) => isNotFoundCause(cause) ? AcpRequestError.resourceNotFound(`Failed to ${operation} file (not found): ${filePath}`) : internalError(`Failed to ${operation} file: ${filePath}`);
|
|
84880
|
+
/**
|
|
84881
|
+
* Registers local `fs/*` and `terminal/*` handlers on the ACP client.
|
|
84882
|
+
* Terminals are tied to the surrounding scope: when the session runtime
|
|
84883
|
+
* shuts down, every still-running terminal process is killed with it.
|
|
84884
|
+
*/
|
|
84885
|
+
const registerLocalToolHandlers = (input) => gen(function* () {
|
|
84886
|
+
const crypto = yield* Crypto;
|
|
84887
|
+
const fileSystem = yield* FileSystem;
|
|
84888
|
+
const path = yield* Path;
|
|
84889
|
+
const spawner = yield* ChildProcessSpawner;
|
|
84890
|
+
const scope = yield* Scope;
|
|
84891
|
+
const terminals = /* @__PURE__ */ new Map();
|
|
84892
|
+
const resolveFilePath = (filePath) => path.isAbsolute(filePath) ? filePath : path.join(input.cwd, filePath);
|
|
84893
|
+
yield* input.acp.handleReadTextFile((request) => gen(function* () {
|
|
84894
|
+
const filePath = resolveFilePath(request.path);
|
|
84895
|
+
const lines = (yield* fileSystem.readFileString(filePath).pipe(mapError((cause) => toFsError("read", filePath, cause)))).split("\n");
|
|
84896
|
+
const start = request.line !== void 0 && request.line !== null && request.line > 1 ? request.line - 1 : 0;
|
|
84897
|
+
return { content: (request.limit !== void 0 && request.limit !== null ? lines.slice(start, start + request.limit) : lines.slice(start)).join("\n") };
|
|
84898
|
+
}));
|
|
84899
|
+
yield* input.acp.handleWriteTextFile((request) => gen(function* () {
|
|
84900
|
+
const filePath = resolveFilePath(request.path);
|
|
84901
|
+
yield* fileSystem.makeDirectory(path.dirname(filePath), { recursive: true }).pipe(ignore$1);
|
|
84902
|
+
yield* fileSystem.writeFileString(filePath, request.content).pipe(mapError((cause) => toFsError("write", filePath, cause)));
|
|
84903
|
+
return {};
|
|
84904
|
+
}));
|
|
84905
|
+
yield* input.acp.handleCreateTerminal((request) => gen(function* () {
|
|
84906
|
+
const terminalId = yield* crypto.randomUUIDv4.pipe(mapError(() => internalError("Failed to allocate an ACP terminal id.")));
|
|
84907
|
+
const env = (request.env ?? []).reduce((acc, entry) => {
|
|
84908
|
+
acc[entry.name] = entry.value;
|
|
84909
|
+
return acc;
|
|
84910
|
+
}, {});
|
|
84911
|
+
const hasEnv = Object.keys(env).length > 0;
|
|
84912
|
+
const spawnCommand = yield* resolveSpawnCommand(request.command, request.args ?? [], hasEnv ? {
|
|
84913
|
+
env,
|
|
84914
|
+
extendEnv: true
|
|
84915
|
+
} : {});
|
|
84916
|
+
const handle = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
|
|
84917
|
+
cwd: request.cwd ?? input.cwd,
|
|
84918
|
+
...hasEnv ? {
|
|
84919
|
+
env,
|
|
84920
|
+
extendEnv: true
|
|
84921
|
+
} : {},
|
|
84922
|
+
shell: spawnCommand.shell
|
|
84923
|
+
})).pipe(provideService(Scope, scope), mapError(() => internalError(`Failed to spawn ACP terminal command: ${request.command}`)));
|
|
84924
|
+
const exited = yield* make$73();
|
|
84925
|
+
const state = {
|
|
84926
|
+
handle,
|
|
84927
|
+
exited,
|
|
84928
|
+
output: "",
|
|
84929
|
+
truncated: false,
|
|
84930
|
+
exitStatus: void 0,
|
|
84931
|
+
killSignal: void 0
|
|
84932
|
+
};
|
|
84933
|
+
const byteLimit = request.outputByteLimit ?? DEFAULT_OUTPUT_BYTE_LIMIT;
|
|
84934
|
+
const decoder = new TextDecoder();
|
|
84935
|
+
const appendOutput = (chunk) => {
|
|
84936
|
+
state.output += decoder.decode(chunk, { stream: true });
|
|
84937
|
+
if (state.output.length > byteLimit) {
|
|
84938
|
+
state.output = state.output.slice(state.output.length - byteLimit);
|
|
84939
|
+
state.truncated = true;
|
|
84940
|
+
}
|
|
84941
|
+
};
|
|
84942
|
+
yield* runForEach(handle.all, (chunk) => sync(() => appendOutput(chunk))).pipe(ignore$1, forkIn(scope));
|
|
84943
|
+
yield* handle.exitCode.pipe(match$2({
|
|
84944
|
+
onFailure: () => ({
|
|
84945
|
+
exitCode: null,
|
|
84946
|
+
signal: state.killSignal ?? null
|
|
84947
|
+
}),
|
|
84948
|
+
onSuccess: (code) => ({
|
|
84949
|
+
exitCode: Number(code),
|
|
84950
|
+
signal: state.killSignal ?? null
|
|
84951
|
+
})
|
|
84952
|
+
}), flatMap$1((exitStatus) => {
|
|
84953
|
+
state.exitStatus = exitStatus;
|
|
84954
|
+
return succeed$4(exited, exitStatus);
|
|
84955
|
+
}), ignore$1, forkIn(scope));
|
|
84956
|
+
terminals.set(terminalId, state);
|
|
84957
|
+
return { terminalId };
|
|
84958
|
+
}));
|
|
84959
|
+
yield* input.acp.handleTerminalOutput((request) => sync(() => {
|
|
84960
|
+
const state = terminals.get(request.terminalId);
|
|
84961
|
+
if (!state) return;
|
|
84962
|
+
return {
|
|
84963
|
+
output: state.output,
|
|
84964
|
+
truncated: state.truncated,
|
|
84965
|
+
...state.exitStatus ? { exitStatus: state.exitStatus } : {}
|
|
84966
|
+
};
|
|
84967
|
+
}).pipe(flatMap$1((result) => result === void 0 ? fail(unknownTerminal(request.terminalId)) : succeed$1(result))));
|
|
84968
|
+
yield* input.acp.handleTerminalWaitForExit((request) => gen(function* () {
|
|
84969
|
+
const state = terminals.get(request.terminalId);
|
|
84970
|
+
if (!state) return yield* unknownTerminal(request.terminalId);
|
|
84971
|
+
return yield* _await(state.exited);
|
|
84972
|
+
}));
|
|
84973
|
+
yield* input.acp.handleTerminalKill((request) => gen(function* () {
|
|
84974
|
+
const state = terminals.get(request.terminalId);
|
|
84975
|
+
if (!state) return yield* unknownTerminal(request.terminalId);
|
|
84976
|
+
if (state.exitStatus === void 0) {
|
|
84977
|
+
state.killSignal = "SIGTERM";
|
|
84978
|
+
yield* state.handle.kill().pipe(ignore$1);
|
|
84979
|
+
}
|
|
84980
|
+
return {};
|
|
84981
|
+
}));
|
|
84982
|
+
yield* input.acp.handleTerminalRelease((request) => gen(function* () {
|
|
84983
|
+
const state = terminals.get(request.terminalId);
|
|
84984
|
+
if (!state) return yield* unknownTerminal(request.terminalId);
|
|
84985
|
+
terminals.delete(request.terminalId);
|
|
84986
|
+
if (state.exitStatus === void 0) {
|
|
84987
|
+
state.killSignal = "SIGTERM";
|
|
84988
|
+
yield* state.handle.kill().pipe(ignore$1);
|
|
84989
|
+
}
|
|
84990
|
+
return {};
|
|
84991
|
+
}));
|
|
84992
|
+
});
|
|
84993
|
+
//#endregion
|
|
84137
84994
|
//#region ../t3-shared/src/toolActivity.ts
|
|
84138
84995
|
function asRecord(value) {
|
|
84139
84996
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -84591,23 +85448,23 @@ function formatConfigOptionValue(value) {
|
|
|
84591
85448
|
const defaultSessionLoadTimeout = seconds(90);
|
|
84592
85449
|
const defaultSessionLoadReplayIdleGap = seconds(2);
|
|
84593
85450
|
var AcpSessionRuntime = class extends Service$2()("t3/provider/acp/AcpSessionRuntime") {};
|
|
84594
|
-
const make$
|
|
85451
|
+
const make$4 = (options) => gen(function* () {
|
|
84595
85452
|
const crypto = yield* Crypto;
|
|
84596
85453
|
const spawner = yield* ChildProcessSpawner;
|
|
84597
85454
|
const runtimeScope = yield* Scope;
|
|
84598
85455
|
const eventQueue = yield* unbounded$2();
|
|
84599
|
-
const modeStateRef = yield* make$
|
|
84600
|
-
const toolCallsRef = yield* make$
|
|
85456
|
+
const modeStateRef = yield* make$63(void 0);
|
|
85457
|
+
const toolCallsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
84601
85458
|
const assistantItemRuntimeId = yield* crypto.randomUUIDv4.pipe(mapError((cause) => new AcpTransportError({
|
|
84602
85459
|
detail: "Failed to generate an ACP assistant item runtime identifier.",
|
|
84603
85460
|
cause
|
|
84604
85461
|
})));
|
|
84605
|
-
const assistantSegmentRef = yield* make$
|
|
84606
|
-
const configOptionsRef = yield* make$
|
|
84607
|
-
const startStateRef = yield* make$
|
|
84608
|
-
const promptSerializationSemaphore = yield* make$
|
|
84609
|
-
const activePromptFiberRef = yield* make$
|
|
84610
|
-
const sessionLoadGateRef = yield* make$
|
|
85462
|
+
const assistantSegmentRef = yield* make$63({ nextSegmentIndex: 0 });
|
|
85463
|
+
const configOptionsRef = yield* make$63(sessionConfigOptionsFromSetup(void 0));
|
|
85464
|
+
const startStateRef = yield* make$63({ _tag: "NotStarted" });
|
|
85465
|
+
const promptSerializationSemaphore = yield* make$75(1);
|
|
85466
|
+
const activePromptFiberRef = yield* make$63(none());
|
|
85467
|
+
const sessionLoadGateRef = yield* make$63(none());
|
|
84611
85468
|
const logRequest = (event) => options.requestLogger ? options.requestLogger(event) : void_$1;
|
|
84612
85469
|
const runLoggedRequest = (method, payload, effect) => logRequest({
|
|
84613
85470
|
method,
|
|
@@ -84628,7 +85485,7 @@ const make$3 = (options) => gen(function* () {
|
|
|
84628
85485
|
env: options.spawn.env,
|
|
84629
85486
|
extendEnv: true
|
|
84630
85487
|
} : {});
|
|
84631
|
-
const child = yield* spawner.spawn(make$
|
|
85488
|
+
const child = yield* spawner.spawn(make$79(spawnCommand.command, spawnCommand.args, {
|
|
84632
85489
|
...options.spawn.cwd ? { cwd: options.spawn.cwd } : {},
|
|
84633
85490
|
...options.spawn.env ? {
|
|
84634
85491
|
env: options.spawn.env,
|
|
@@ -84667,13 +85524,18 @@ const make$3 = (options) => gen(function* () {
|
|
|
84667
85524
|
params: notification
|
|
84668
85525
|
});
|
|
84669
85526
|
}));
|
|
85527
|
+
if (options.hostLocalTools === true) yield* registerLocalToolHandlers({
|
|
85528
|
+
acp,
|
|
85529
|
+
cwd: options.cwd
|
|
85530
|
+
});
|
|
85531
|
+
const hostLocalTools = options.hostLocalTools === true;
|
|
84670
85532
|
const initializeClientCapabilities = {
|
|
84671
85533
|
fs: {
|
|
84672
|
-
readTextFile:
|
|
84673
|
-
writeTextFile:
|
|
85534
|
+
readTextFile: hostLocalTools,
|
|
85535
|
+
writeTextFile: hostLocalTools,
|
|
84674
85536
|
...options.clientCapabilities?.fs
|
|
84675
85537
|
},
|
|
84676
|
-
terminal: options.clientCapabilities?.terminal ??
|
|
85538
|
+
terminal: options.clientCapabilities?.terminal ?? hostLocalTools,
|
|
84677
85539
|
...options.clientCapabilities?.auth ? { auth: options.clientCapabilities.auth } : {},
|
|
84678
85540
|
...options.clientCapabilities?.elicitation ? { elicitation: options.clientCapabilities.elicitation } : {},
|
|
84679
85541
|
...options.clientCapabilities?._meta ? { _meta: options.clientCapabilities._meta } : {}
|
|
@@ -84816,7 +85678,7 @@ const make$3 = (options) => gen(function* () {
|
|
|
84816
85678
|
};
|
|
84817
85679
|
});
|
|
84818
85680
|
const start = gen(function* () {
|
|
84819
|
-
const deferred = yield* make$
|
|
85681
|
+
const deferred = yield* make$73();
|
|
84820
85682
|
return yield* yield* modify$2(startStateRef, (state) => {
|
|
84821
85683
|
switch (state._tag) {
|
|
84822
85684
|
case "Started": return [succeed$1(state.result), state];
|
|
@@ -84850,7 +85712,7 @@ const make$3 = (options) => gen(function* () {
|
|
|
84850
85712
|
start: () => start,
|
|
84851
85713
|
getEvents: () => fromQueue(eventQueue),
|
|
84852
85714
|
drainEvents: gen(function* () {
|
|
84853
|
-
const acknowledge = yield* make$
|
|
85715
|
+
const acknowledge = yield* make$73();
|
|
84854
85716
|
yield* offer$1(eventQueue, {
|
|
84855
85717
|
_tag: "EventStreamBarrier",
|
|
84856
85718
|
acknowledge
|
|
@@ -84902,7 +85764,7 @@ const make$3 = (options) => gen(function* () {
|
|
|
84902
85764
|
notify: acp.raw.notify
|
|
84903
85765
|
};
|
|
84904
85766
|
});
|
|
84905
|
-
const layer = (options) => effect(AcpSessionRuntime, make$
|
|
85767
|
+
const layer$1 = (options) => effect(AcpSessionRuntime, make$4(options));
|
|
84906
85768
|
function sessionConfigOptionsFromSetup(response) {
|
|
84907
85769
|
return response?.configOptions ?? [];
|
|
84908
85770
|
}
|
|
@@ -85009,11 +85871,12 @@ function buildAcpAgentSpawnInput(descriptor, settings, cwd, environment) {
|
|
|
85009
85871
|
* never sent.
|
|
85010
85872
|
*/
|
|
85011
85873
|
const makeAcpAgentRuntime = (descriptor, input) => gen(function* () {
|
|
85012
|
-
const acpContext = yield* build(layer({
|
|
85874
|
+
const acpContext = yield* build(layer$1({
|
|
85013
85875
|
...input,
|
|
85014
85876
|
spawn: buildAcpAgentSpawnInput(descriptor, input.settings, input.cwd, input.environment),
|
|
85015
85877
|
authMethodId: "none",
|
|
85016
|
-
skipAuthentication: true
|
|
85878
|
+
skipAuthentication: true,
|
|
85879
|
+
hostLocalTools: descriptor.hostLocalTools === true
|
|
85017
85880
|
}).pipe(provide(succeed$3(ChildProcessSpawner, input.childProcessSpawner))));
|
|
85018
85881
|
return yield* service(AcpSessionRuntime).pipe(provide$1(acpContext));
|
|
85019
85882
|
});
|
|
@@ -85084,9 +85947,11 @@ const isTextGenerationError = is(TextGenerationError);
|
|
|
85084
85947
|
const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.env) => gen(function* () {
|
|
85085
85948
|
const crypto = yield* Crypto;
|
|
85086
85949
|
const commandSpawner = yield* ChildProcessSpawner;
|
|
85950
|
+
const fileSystem = yield* FileSystem;
|
|
85951
|
+
const path = yield* Path;
|
|
85087
85952
|
const runAcpAgentJson = ({ operation, cwd, prompt, outputSchemaJson, modelSelection }) => gen(function* () {
|
|
85088
85953
|
const resolvedModel = resolveAcpAgentModelId(descriptor, modelSelection.model);
|
|
85089
|
-
const outputRef = yield* make$
|
|
85954
|
+
const outputRef = yield* make$63("");
|
|
85090
85955
|
const runtime = yield* makeAcpAgentRuntime(descriptor, {
|
|
85091
85956
|
settings,
|
|
85092
85957
|
environment,
|
|
@@ -85096,7 +85961,7 @@ const makeAcpAgentTextGeneration = (descriptor, settings, environment = process.
|
|
|
85096
85961
|
name: "agentlink-text-generation",
|
|
85097
85962
|
version: "0.0.0"
|
|
85098
85963
|
}
|
|
85099
|
-
}).pipe(provideService(Crypto, crypto));
|
|
85964
|
+
}).pipe(provideService(Crypto, crypto), provideService(FileSystem, fileSystem), provideService(Path, path));
|
|
85100
85965
|
yield* runtime.handleSessionUpdate((notification) => {
|
|
85101
85966
|
const update = notification.update;
|
|
85102
85967
|
if (update.sessionUpdate !== "agent_message_chunk") return void_$1;
|
|
@@ -85435,7 +86300,7 @@ const makeAcpNativeLoggerFactory = fn("makeAcpNativeLoggerFactory")(function* ()
|
|
|
85435
86300
|
return (input) => {
|
|
85436
86301
|
const writeNativeAcpLog = (logInput) => gen(function* () {
|
|
85437
86302
|
if (!input.nativeEventLogger) return;
|
|
85438
|
-
const observedAt = formatIso(yield* now);
|
|
86303
|
+
const observedAt = formatIso(yield* now$1);
|
|
85439
86304
|
yield* input.nativeEventLogger.write({
|
|
85440
86305
|
observedAt,
|
|
85441
86306
|
event: {
|
|
@@ -85541,9 +86406,9 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
85541
86406
|
const managedNativeEventLogger = options?.nativeEventLogger === void 0 ? nativeEventLogger : void 0;
|
|
85542
86407
|
const makeAcpNativeLoggers = yield* makeAcpNativeLoggerFactory();
|
|
85543
86408
|
const sessions = /* @__PURE__ */ new Map();
|
|
85544
|
-
const threadLocksRef = yield* make$
|
|
86409
|
+
const threadLocksRef = yield* make$53(/* @__PURE__ */ new Map());
|
|
85545
86410
|
const runtimeEventPubSub = yield* unbounded$1();
|
|
85546
|
-
const nowIso = map$4(now, formatIso);
|
|
86411
|
+
const nowIso = map$4(now$1, formatIso);
|
|
85547
86412
|
const randomUUIDv4 = crypto.randomUUIDv4.pipe(mapError((cause) => new ProviderAdapterRequestError({
|
|
85548
86413
|
provider: PROVIDER,
|
|
85549
86414
|
method: "crypto/randomUUIDv4",
|
|
@@ -85562,7 +86427,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
85562
86427
|
const offerRuntimeEvent = (event) => publish(runtimeEventPubSub, event).pipe(asVoid);
|
|
85563
86428
|
const getThreadSemaphore = (threadId) => modifyEffect(threadLocksRef, (current) => {
|
|
85564
86429
|
return match$1(fromNullishOr(current.get(threadId)), {
|
|
85565
|
-
onNone: () => make$
|
|
86430
|
+
onNone: () => make$75(1).pipe(map$4((semaphore) => {
|
|
85566
86431
|
const next = new Map(current);
|
|
85567
86432
|
next.set(threadId, semaphore);
|
|
85568
86433
|
return [semaphore, next];
|
|
@@ -85745,7 +86610,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
85745
86610
|
const existing = sessions.get(input.threadId);
|
|
85746
86611
|
if (existing && !existing.stopped) yield* stopSessionInternal(existing);
|
|
85747
86612
|
const pendingApprovals = /* @__PURE__ */ new Map();
|
|
85748
|
-
const sessionScope = yield* make$
|
|
86613
|
+
const sessionScope = yield* make$76("sequential");
|
|
85749
86614
|
let sessionScopeTransferred = false;
|
|
85750
86615
|
yield* addFinalizer(() => sessionScopeTransferred ? void_$1 : close(sessionScope, void_$2));
|
|
85751
86616
|
const resumeSessionId = resolveResumeSessionId(descriptor, input.resumeCursor);
|
|
@@ -85765,7 +86630,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
85765
86630
|
version: "0.0.0"
|
|
85766
86631
|
},
|
|
85767
86632
|
...acpNativeLoggers
|
|
85768
|
-
}).pipe(provideService(Crypto, crypto), provideService(Scope, sessionScope), mapError((cause) => new ProviderAdapterProcessError({
|
|
86633
|
+
}).pipe(provideService(Crypto, crypto), provideService(FileSystem, fileSystem), provideService(Path, path), provideService(Scope, sessionScope), mapError((cause) => new ProviderAdapterProcessError({
|
|
85769
86634
|
provider: PROVIDER,
|
|
85770
86635
|
threadId: input.threadId,
|
|
85771
86636
|
detail: cause.message,
|
|
@@ -85784,7 +86649,7 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
85784
86649
|
const permissionRequest = parsePermissionRequest(params);
|
|
85785
86650
|
const requestId = ApprovalRequestId.make(yield* randomUUIDv4);
|
|
85786
86651
|
const runtimeRequestId = RuntimeRequestId.make(requestId);
|
|
85787
|
-
const decision = yield* make$
|
|
86652
|
+
const decision = yield* make$73();
|
|
85788
86653
|
const turnId = resolveSessionCallbackTurnId(sessions, input.threadId);
|
|
85789
86654
|
pendingApprovals.set(requestId, { decision });
|
|
85790
86655
|
yield* offerRuntimeEvent(makeAcpRequestOpenedEvent({
|
|
@@ -86041,10 +86906,10 @@ function makeAcpAgentAdapter(descriptor, settings, options) {
|
|
|
86041
86906
|
});
|
|
86042
86907
|
})));
|
|
86043
86908
|
}));
|
|
86044
|
-
const promptSettled = yield* make$
|
|
86045
|
-
const promptRpcSucceeded = yield* make$
|
|
86046
|
-
const promptResultRef = yield* make$
|
|
86047
|
-
const promptFailureMessageRef = yield* make$
|
|
86909
|
+
const promptSettled = yield* make$63(false);
|
|
86910
|
+
const promptRpcSucceeded = yield* make$63(false);
|
|
86911
|
+
const promptResultRef = yield* make$63(void 0);
|
|
86912
|
+
const promptFailureMessageRef = yield* make$63(void 0);
|
|
86048
86913
|
return yield* gen(function* () {
|
|
86049
86914
|
const result = yield* prepared.acp.prompt({ prompt: prepared.promptParts }).pipe(tap((promptResult) => all([set$2(promptRpcSucceeded, true), set$2(promptResultRef, promptResult)])), tapError((error) => set$2(promptFailureMessageRef, mapAcpToAdapterError(PROVIDER, input.threadId, "session/prompt", error).message).pipe(andThen(prepared.acp.drainEvents))), mapError((error) => mapAcpToAdapterError(PROVIDER, input.threadId, "session/prompt", error)));
|
|
86050
86915
|
return yield* withThreadLock(input.threadId, gen(function* () {
|
|
@@ -86271,7 +87136,7 @@ const VERSION_PROBE_TIMEOUT_MS = 4e3;
|
|
|
86271
87136
|
const ACP_MODEL_DISCOVERY_TIMEOUT_MS = 15e3;
|
|
86272
87137
|
function buildInitialAcpAgentProviderSnapshot(descriptor, settings) {
|
|
86273
87138
|
return gen(function* () {
|
|
86274
|
-
const checkedAt = yield* map$4(now, formatIso);
|
|
87139
|
+
const checkedAt = yield* map$4(now$1, formatIso);
|
|
86275
87140
|
const models = acpAgentModelsFromSettings(descriptor, settings.customModels);
|
|
86276
87141
|
if (!settings.enabled) return buildServerProvider({
|
|
86277
87142
|
presentation: descriptorPresentation(descriptor),
|
|
@@ -86344,13 +87209,13 @@ const discoverModelsViaAcp = (descriptor, settings, environment = process.env) =
|
|
|
86344
87209
|
const runVersionCommand = (descriptor, settings, environment = process.env) => gen(function* () {
|
|
86345
87210
|
const command = settings.binaryPath.trim() || descriptor.defaultBinary;
|
|
86346
87211
|
const spawnCommand = yield* resolveSpawnCommand(command, ["--version"], { env: environment });
|
|
86347
|
-
return yield* spawnAndCollect(command, make$
|
|
87212
|
+
return yield* spawnAndCollect(command, make$79(spawnCommand.command, spawnCommand.args, {
|
|
86348
87213
|
env: environment,
|
|
86349
87214
|
shell: spawnCommand.shell
|
|
86350
87215
|
}));
|
|
86351
87216
|
});
|
|
86352
87217
|
const checkAcpAgentProviderStatus = (descriptor, settings, environment = process.env) => gen(function* () {
|
|
86353
|
-
const checkedAt = formatIso(yield* now);
|
|
87218
|
+
const checkedAt = formatIso(yield* now$1);
|
|
86354
87219
|
const fallbackModels = acpAgentModelsFromSettings(descriptor, settings.customModels);
|
|
86355
87220
|
const presentation = descriptorPresentation(descriptor);
|
|
86356
87221
|
if (!settings.enabled) return buildServerProvider({
|
|
@@ -86597,7 +87462,8 @@ const KimiAcpAgent = {
|
|
|
86597
87462
|
acpArgs: ["acp"],
|
|
86598
87463
|
defaultModel: "kimi-k2",
|
|
86599
87464
|
builtInModels: ["kimi-k2", "kimi-for-coding"],
|
|
86600
|
-
supportsSessionLoad: false
|
|
87465
|
+
supportsSessionLoad: false,
|
|
87466
|
+
hostLocalTools: true
|
|
86601
87467
|
};
|
|
86602
87468
|
//#endregion
|
|
86603
87469
|
//#region src/provider/Drivers/KimiDriver.ts
|
|
@@ -86708,7 +87574,7 @@ var ProviderInstanceRegistryMutator = class extends Service$2()("t3/provider/Ser
|
|
|
86708
87574
|
*
|
|
86709
87575
|
* @module unavailableProviderSnapshot
|
|
86710
87576
|
*/
|
|
86711
|
-
const nowIso = map$4(now, formatIso);
|
|
87577
|
+
const nowIso = map$4(now$1, formatIso);
|
|
86712
87578
|
/**
|
|
86713
87579
|
* Produce a `ServerProvider` snapshot representing a configured instance
|
|
86714
87580
|
* whose driver the running build does not implement. The result is safe
|
|
@@ -86829,7 +87695,7 @@ const buildEntry = (input) => gen(function* () {
|
|
|
86829
87695
|
};
|
|
86830
87696
|
}
|
|
86831
87697
|
const typedConfig = decodeResult.success;
|
|
86832
|
-
const childScope = yield* make$
|
|
87698
|
+
const childScope = yield* make$76();
|
|
86833
87699
|
yield* addFinalizer$1(parentScope, close(childScope, void_$2).pipe(ignore$1));
|
|
86834
87700
|
const createResult = yield* driver.create({
|
|
86835
87701
|
instanceId,
|
|
@@ -86950,8 +87816,8 @@ const makeProviderInstanceRegistry = (input) => gen(function* () {
|
|
|
86950
87816
|
const driversById = new Map(input.drivers.map((driver) => [driver.driverKind, driver]));
|
|
86951
87817
|
const parentScope = yield* Scope;
|
|
86952
87818
|
const driverContext = yield* context();
|
|
86953
|
-
const entries = yield* make$
|
|
86954
|
-
const unavailable = yield* make$
|
|
87819
|
+
const entries = yield* make$63(/* @__PURE__ */ new Map());
|
|
87820
|
+
const unavailable = yield* make$63(/* @__PURE__ */ new Map());
|
|
86955
87821
|
const changes = yield* unbounded$1();
|
|
86956
87822
|
yield* addFinalizer(() => shutdown$2(changes));
|
|
86957
87823
|
const reconcileWithR = makeReconcile({
|
|
@@ -86986,7 +87852,7 @@ const makeProviderInstanceRegistry = (input) => gen(function* () {
|
|
|
86986
87852
|
* changes. Tests that exercise the mutator directly can pair this Layer
|
|
86987
87853
|
* with a test-local `ServerSettingsService`.
|
|
86988
87854
|
*/
|
|
86989
|
-
const ProviderInstanceRegistryMutableLayer = (input) => effectContext(makeProviderInstanceRegistry(input).pipe(map$4(({ registry, mutator }) => make$
|
|
87855
|
+
const ProviderInstanceRegistryMutableLayer = (input) => effectContext(makeProviderInstanceRegistry(input).pipe(map$4(({ registry, mutator }) => make$68(ProviderInstanceRegistry, registry).pipe(add$2(ProviderInstanceRegistryMutator, mutator)))));
|
|
86990
87856
|
//#endregion
|
|
86991
87857
|
//#region src/provider/Layers/ProviderInstanceRegistryHydration.ts
|
|
86992
87858
|
/**
|
|
@@ -87221,7 +88087,7 @@ effect(RuntimeReceiptBus, makeRuntimeReceiptBusTest);
|
|
|
87221
88087
|
*/
|
|
87222
88088
|
const makeDrainableWorker = (process) => gen(function* () {
|
|
87223
88089
|
const queue = yield* acquireRelease(unbounded(), shutdown);
|
|
87224
|
-
const outstanding = yield* make$
|
|
88090
|
+
const outstanding = yield* make$52(0);
|
|
87225
88091
|
yield* take(queue).pipe(tap((a) => ensuring(process(a), update$1(outstanding, (n) => n - 1))), forever, forkScoped);
|
|
87226
88092
|
const drain = get$1(outstanding).pipe(tap((n) => n > 0 ? txRetry : void_$1), tx);
|
|
87227
88093
|
const enqueue = (element) => offer(queue, element).pipe(tap(() => update$1(outstanding, (n) => n + 1)), tx);
|
|
@@ -87689,22 +88555,22 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
|
|
|
87689
88555
|
const projectionTurnRepository = yield* ProjectionTurnRepository;
|
|
87690
88556
|
const serverSettingsService = yield* ServerSettingsService;
|
|
87691
88557
|
const providerCommandId = (event, tag) => crypto.randomUUIDv4.pipe(map$4((uuid) => CommandId.make(`provider:${event.eventId}:${tag}:${uuid}`)));
|
|
87692
|
-
const turnMessageIdsByTurnKey = yield* make$
|
|
88558
|
+
const turnMessageIdsByTurnKey = yield* make$81({
|
|
87693
88559
|
capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
|
|
87694
88560
|
timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
|
|
87695
88561
|
lookup: () => succeed$1(/* @__PURE__ */ new Set())
|
|
87696
88562
|
});
|
|
87697
|
-
const bufferedAssistantTextByMessageId = yield* make$
|
|
88563
|
+
const bufferedAssistantTextByMessageId = yield* make$81({
|
|
87698
88564
|
capacity: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_CACHE_CAPACITY,
|
|
87699
88565
|
timeToLive: BUFFERED_MESSAGE_TEXT_BY_MESSAGE_ID_TTL,
|
|
87700
88566
|
lookup: () => succeed$1("")
|
|
87701
88567
|
});
|
|
87702
|
-
const assistantSegmentStateByTurnKey = yield* make$
|
|
88568
|
+
const assistantSegmentStateByTurnKey = yield* make$81({
|
|
87703
88569
|
capacity: TURN_MESSAGE_IDS_BY_TURN_CACHE_CAPACITY,
|
|
87704
88570
|
timeToLive: TURN_MESSAGE_IDS_BY_TURN_TTL,
|
|
87705
88571
|
lookup: () => die(/* @__PURE__ */ new Error("assistant segment state should be read through getOption before initialization"))
|
|
87706
88572
|
});
|
|
87707
|
-
const bufferedProposedPlanById = yield* make$
|
|
88573
|
+
const bufferedProposedPlanById = yield* make$81({
|
|
87708
88574
|
capacity: BUFFERED_PROPOSED_PLAN_BY_ID_CACHE_CAPACITY,
|
|
87709
88575
|
timeToLive: BUFFERED_PROPOSED_PLAN_BY_ID_TTL,
|
|
87710
88576
|
lookup: () => succeed$1({
|
|
@@ -87712,7 +88578,7 @@ const ProviderRuntimeIngestionLive = effect(ProviderRuntimeIngestionService, gen
|
|
|
87712
88578
|
createdAt: ""
|
|
87713
88579
|
})
|
|
87714
88580
|
});
|
|
87715
|
-
const taskDescriptionByTaskKey = yield* make$
|
|
88581
|
+
const taskDescriptionByTaskKey = yield* make$81({
|
|
87716
88582
|
capacity: TASK_DESCRIPTION_BY_TASK_CACHE_CAPACITY,
|
|
87717
88583
|
timeToLive: TASK_DESCRIPTION_BY_TASK_TTL,
|
|
87718
88584
|
lookup: () => succeed$1("")
|
|
@@ -88406,7 +89272,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
|
|
|
88406
89272
|
const serverSettingsService = yield* ServerSettingsService;
|
|
88407
89273
|
const serverCommandId = (tag) => crypto.randomUUIDv4.pipe(map$4((uuid) => CommandId.make(`server:${tag}:${uuid}`)));
|
|
88408
89274
|
const serverEventId = () => crypto.randomUUIDv4.pipe(map$4(EventId.make));
|
|
88409
|
-
const handledTurnStartKeys = yield* make$
|
|
89275
|
+
const handledTurnStartKeys = yield* make$81({
|
|
88410
89276
|
capacity: HANDLED_TURN_START_KEY_MAX,
|
|
88411
89277
|
timeToLive: HANDLED_TURN_START_KEY_TTL,
|
|
88412
89278
|
lookup: () => succeed$1(true)
|
|
@@ -89215,7 +90081,7 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
89215
90081
|
if (provider === void 0 || source === void 0) continue;
|
|
89216
90082
|
fallbackByInstance.set(source.instanceId, provider);
|
|
89217
90083
|
}
|
|
89218
|
-
const providersRef = yield* make$
|
|
90084
|
+
const providersRef = yield* make$63(yield* forEach(bootSources, (source) => gen(function* () {
|
|
89219
90085
|
const filePath = yield* resolveProviderStatusCachePath({
|
|
89220
90086
|
cacheDir: config.providerStatusCacheDir,
|
|
89221
90087
|
instanceId: source.instanceId
|
|
@@ -89238,9 +90104,9 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
89238
90104
|
return succeed$1(hydrateCachedProvider(correlation));
|
|
89239
90105
|
}));
|
|
89240
90106
|
}), { concurrency: "unbounded" }).pipe(map$4((providers) => orderProviderSnapshots(providers.filter((provider) => provider !== void 0)))));
|
|
89241
|
-
const maintenanceActionStatesRef = yield* make$
|
|
89242
|
-
const liveSubsRef = yield* make$
|
|
89243
|
-
const syncSemaphore = yield* make$
|
|
90107
|
+
const maintenanceActionStatesRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
90108
|
+
const liveSubsRef = yield* make$63(/* @__PURE__ */ new Map());
|
|
90109
|
+
const syncSemaphore = yield* make$75(1);
|
|
89244
90110
|
const getLiveSources = get$3(liveSubsRef).pipe(map$4((map) => Array.from(map.values(), buildSnapshotSource)));
|
|
89245
90111
|
const persistProvider = (provider) => gen(function* () {
|
|
89246
90112
|
const key = snapshotInstanceKey(provider);
|
|
@@ -89425,13 +90291,118 @@ const ProviderRegistryLive = effect(ProviderRegistry, gen(function* () {
|
|
|
89425
90291
|
};
|
|
89426
90292
|
}));
|
|
89427
90293
|
//#endregion
|
|
90294
|
+
//#region src/terminal/NodePtyAdapter.ts
|
|
90295
|
+
var NodePtyModuleLoadError = class extends TaggedErrorClass()("NodePtyModuleLoadError", {
|
|
90296
|
+
platform: String$1,
|
|
90297
|
+
architecture: String$1,
|
|
90298
|
+
cause: Defect()
|
|
90299
|
+
}) {
|
|
90300
|
+
get message() {
|
|
90301
|
+
return `Failed to load node-pty for ${this.platform}-${this.architecture}.`;
|
|
90302
|
+
}
|
|
90303
|
+
};
|
|
90304
|
+
let didEnsureSpawnHelperExecutable = false;
|
|
90305
|
+
const resolveNodePtySpawnHelperPath = gen(function* () {
|
|
90306
|
+
const requireForNodePty = NodeModule.createRequire(import.meta.url);
|
|
90307
|
+
const path = yield* Path;
|
|
90308
|
+
const fs = yield* FileSystem;
|
|
90309
|
+
const platform = yield* HostProcessPlatform;
|
|
90310
|
+
const architecture = yield* HostProcessArchitecture;
|
|
90311
|
+
const packageJsonPath = requireForNodePty.resolve("node-pty/package.json");
|
|
90312
|
+
const packageDir = path.dirname(packageJsonPath);
|
|
90313
|
+
const candidates = [
|
|
90314
|
+
path.join(packageDir, "build", "Release", "spawn-helper"),
|
|
90315
|
+
path.join(packageDir, "build", "Debug", "spawn-helper"),
|
|
90316
|
+
path.join(packageDir, "prebuilds", `${platform}-${architecture}`, "spawn-helper")
|
|
90317
|
+
];
|
|
90318
|
+
for (const candidate of candidates) if (yield* fs.exists(candidate)) return candidate;
|
|
90319
|
+
return null;
|
|
90320
|
+
}).pipe(orElseSucceed(() => null));
|
|
90321
|
+
const ensureNodePtySpawnHelperExecutable = fn(function* () {
|
|
90322
|
+
const fs = yield* FileSystem;
|
|
90323
|
+
if ((yield* HostProcessPlatform) === "win32") return;
|
|
90324
|
+
if (didEnsureSpawnHelperExecutable) return;
|
|
90325
|
+
const helperPath = yield* resolveNodePtySpawnHelperPath;
|
|
90326
|
+
if (!helperPath) return;
|
|
90327
|
+
didEnsureSpawnHelperExecutable = true;
|
|
90328
|
+
if (!(yield* fs.exists(helperPath))) return;
|
|
90329
|
+
yield* fs.chmod(helperPath, 493).pipe(orElseSucceed(() => void 0));
|
|
90330
|
+
});
|
|
90331
|
+
var NodePtyProcess = class {
|
|
90332
|
+
process;
|
|
90333
|
+
constructor(process) {
|
|
90334
|
+
this.process = process;
|
|
90335
|
+
}
|
|
90336
|
+
get pid() {
|
|
90337
|
+
return this.process.pid;
|
|
90338
|
+
}
|
|
90339
|
+
write(data) {
|
|
90340
|
+
this.process.write(data);
|
|
90341
|
+
}
|
|
90342
|
+
resize(cols, rows) {
|
|
90343
|
+
this.process.resize(cols, rows);
|
|
90344
|
+
}
|
|
90345
|
+
kill(signal) {
|
|
90346
|
+
this.process.kill(signal);
|
|
90347
|
+
}
|
|
90348
|
+
onData(callback) {
|
|
90349
|
+
const disposable = this.process.onData(callback);
|
|
90350
|
+
return () => {
|
|
90351
|
+
disposable.dispose();
|
|
90352
|
+
};
|
|
90353
|
+
}
|
|
90354
|
+
onExit(callback) {
|
|
90355
|
+
const disposable = this.process.onExit((event) => {
|
|
90356
|
+
callback({
|
|
90357
|
+
exitCode: event.exitCode,
|
|
90358
|
+
signal: event.signal ?? null
|
|
90359
|
+
});
|
|
90360
|
+
});
|
|
90361
|
+
return () => {
|
|
90362
|
+
disposable.dispose();
|
|
90363
|
+
};
|
|
90364
|
+
}
|
|
90365
|
+
};
|
|
90366
|
+
const layer = effect(PtyAdapter, fn("NodePtyAdapter.make")(function* (loadNodePtyModule = () => import("node-pty")) {
|
|
90367
|
+
const fs = yield* FileSystem;
|
|
90368
|
+
const path = yield* Path;
|
|
90369
|
+
const platform = yield* HostProcessPlatform;
|
|
90370
|
+
const architecture = yield* HostProcessArchitecture;
|
|
90371
|
+
const nodePty = yield* tryPromise({
|
|
90372
|
+
try: loadNodePtyModule,
|
|
90373
|
+
catch: (cause) => new NodePtyModuleLoadError({
|
|
90374
|
+
platform,
|
|
90375
|
+
architecture,
|
|
90376
|
+
cause
|
|
90377
|
+
})
|
|
90378
|
+
}).pipe(orDie);
|
|
90379
|
+
const ensureNodePtySpawnHelperExecutableCached = yield* cached(ensureNodePtySpawnHelperExecutable().pipe(provideService(FileSystem, fs), provideService(Path, path), provideService(HostProcessPlatform, platform), provideService(HostProcessArchitecture, architecture), orElseSucceed(() => void 0)));
|
|
90380
|
+
return PtyAdapter.of({ spawn: fn("NodePtyAdapter.spawn")(function* (input) {
|
|
90381
|
+
yield* ensureNodePtySpawnHelperExecutableCached;
|
|
90382
|
+
return new NodePtyProcess(yield* try_({
|
|
90383
|
+
try: () => nodePty.spawn(input.shell, input.args ?? [], {
|
|
90384
|
+
cwd: input.cwd,
|
|
90385
|
+
cols: input.cols,
|
|
90386
|
+
rows: input.rows,
|
|
90387
|
+
env: input.env,
|
|
90388
|
+
name: platform === "win32" ? "xterm-color" : "xterm-256color"
|
|
90389
|
+
}),
|
|
90390
|
+
catch: (cause) => new PtySpawnError({
|
|
90391
|
+
adapter: "node-pty",
|
|
90392
|
+
shell: input.shell,
|
|
90393
|
+
cause
|
|
90394
|
+
})
|
|
90395
|
+
}));
|
|
90396
|
+
}) });
|
|
90397
|
+
})());
|
|
90398
|
+
//#endregion
|
|
89428
90399
|
//#region ../t3-shared/src/httpObservability.ts
|
|
89429
90400
|
const httpHeaderRedactionLayer = effect(CurrentRedactedNames, map$4(CurrentRedactedNames, (names) => [...names, "dpop"]));
|
|
89430
90401
|
//#endregion
|
|
89431
90402
|
//#region src/serverLogger.ts
|
|
89432
90403
|
const ServerLoggerLive = gen(function* () {
|
|
89433
90404
|
const minimumLogLevelLayer = succeed$3(MinimumLogLevel, (yield* ServerConfig).logLevel);
|
|
89434
|
-
return mergeAll(layer$
|
|
90405
|
+
return mergeAll(layer$40([consolePretty(), tracerLogger], { mergeWithExisting: false }), minimumLogLevelLayer);
|
|
89435
90406
|
}).pipe(unwrap);
|
|
89436
90407
|
//#endregion
|
|
89437
90408
|
//#region src/observability/Layers/Observability.ts
|
|
@@ -89454,7 +90425,7 @@ const ObservabilityLive = unwrap(gen(function* () {
|
|
|
89454
90425
|
durationMs: stats.durationMs
|
|
89455
90426
|
})
|
|
89456
90427
|
});
|
|
89457
|
-
const delegate = config.otlpTracesUrl === void 0 ? void 0 : yield* make$
|
|
90428
|
+
const delegate = config.otlpTracesUrl === void 0 ? void 0 : yield* make$21({
|
|
89458
90429
|
url: config.otlpTracesUrl,
|
|
89459
90430
|
exportInterval: `${config.otlpExportIntervalMs} millis`,
|
|
89460
90431
|
resource: {
|
|
@@ -89472,9 +90443,9 @@ const ObservabilityLive = unwrap(gen(function* () {
|
|
|
89472
90443
|
batchWindowMs: config.traceBatchWindowMs,
|
|
89473
90444
|
sink,
|
|
89474
90445
|
...delegate ? { delegate } : {}
|
|
89475
|
-
})), layer$
|
|
90446
|
+
})), layer$12(sink));
|
|
89476
90447
|
})).pipe(provide(layerFlusher), provideMerge(otlpSerializationLayer));
|
|
89477
|
-
const metricsLayer = config.otlpMetricsUrl === void 0 ? empty$8 : layer$
|
|
90448
|
+
const metricsLayer = config.otlpMetricsUrl === void 0 ? empty$8 : layer$15({
|
|
89478
90449
|
url: config.otlpMetricsUrl,
|
|
89479
90450
|
exportInterval: `${config.otlpExportIntervalMs} millis`,
|
|
89480
90451
|
resource: {
|
|
@@ -89527,11 +90498,11 @@ const orchestrationHttpApiLayer = group(EnvironmentHttpApi, "orchestration", fnU
|
|
|
89527
90498
|
//#endregion
|
|
89528
90499
|
//#region src/server.ts
|
|
89529
90500
|
const HTTP_PREEMPTIVE_SHUTDOWN_GRACE_MS = 0;
|
|
89530
|
-
const ApplicationObservabilityLive = ObservabilityLive.pipe(provideMerge(layer$
|
|
89531
|
-
const ServerSettingsLayerLive = layer$
|
|
89532
|
-
const DesktopTelemetryReceiverLayerLive = layer$
|
|
89533
|
-
const HostPowerMonitorLayerLive = layer$
|
|
89534
|
-
const BackgroundLayerLive = layer$
|
|
90501
|
+
const ApplicationObservabilityLive = ObservabilityLive.pipe(provideMerge(layer$16));
|
|
90502
|
+
const ServerSettingsLayerLive = layer$25.pipe(provide(layer$35));
|
|
90503
|
+
const DesktopTelemetryReceiverLayerLive = layer$19.pipe(provideMerge(ServerSettingsLayerLive));
|
|
90504
|
+
const HostPowerMonitorLayerLive = layer$18.pipe(provide(DesktopTelemetryReceiverLayerLive));
|
|
90505
|
+
const BackgroundLayerLive = layer$17.pipe(provide(HostPowerMonitorLayerLive), provideMerge(ServerSettingsLayerLive));
|
|
89535
90506
|
const HttpServerLive = unwrap(gen(function* () {
|
|
89536
90507
|
const config = yield* ServerConfig;
|
|
89537
90508
|
if (typeof Bun !== "undefined") return (yield* promise(() => import("@effect/platform-bun/BunHttpServer"))).layer({
|
|
@@ -89544,7 +90515,7 @@ const HttpServerLive = unwrap(gen(function* () {
|
|
|
89544
90515
|
} }
|
|
89545
90516
|
});
|
|
89546
90517
|
else {
|
|
89547
|
-
const [NodeHttpServer, NodeHttp] = yield* all([promise(() => import("./NodeHttpServer-
|
|
90518
|
+
const [NodeHttpServer, NodeHttp] = yield* all([promise(() => import("./NodeHttpServer-D2VeYRw1.mjs")), promise(() => import("node:http"))]);
|
|
89548
90519
|
return NodeHttpServer.layer(NodeHttp.createServer, {
|
|
89549
90520
|
host: config.host ?? "127.0.0.1",
|
|
89550
90521
|
port: config.port,
|
|
@@ -89558,30 +90529,31 @@ const PlatformServicesLive = unwrap(gen(function* () {
|
|
|
89558
90529
|
const { layer } = yield* promise(() => import("@effect/platform-bun/BunServices"));
|
|
89559
90530
|
return layer;
|
|
89560
90531
|
} else {
|
|
89561
|
-
const { layer } = yield* promise(() => import("./NodeServices-
|
|
90532
|
+
const { layer } = yield* promise(() => import("./NodeServices-BtcL7AtO.mjs").then((n) => n.t));
|
|
89562
90533
|
return layer;
|
|
89563
90534
|
}
|
|
89564
90535
|
}));
|
|
89565
90536
|
const ReactorLayerLive = empty$8.pipe(provideMerge(OrchestrationReactorLive), provideMerge(ProviderRuntimeIngestionLive), provideMerge(ProviderCommandReactorLive), provideMerge(ThreadDeletionReactorLive), provideMerge(RuntimeReceiptBusLive));
|
|
89566
|
-
const ProviderSessionDirectoryLayerLive = ProviderSessionDirectoryLive.pipe(provide(layer$
|
|
90537
|
+
const ProviderSessionDirectoryLayerLive = ProviderSessionDirectoryLive.pipe(provide(layer$4));
|
|
89567
90538
|
const ProviderLayerLive = ProviderServiceLive.pipe(provide(ProviderAdapterRegistryLive), provideMerge(ProviderSessionDirectoryLayerLive));
|
|
89568
90539
|
const PersistenceLayerLive = empty$8.pipe(provideMerge(layerConfig));
|
|
89569
|
-
const WorkspaceEntriesLayerLive = layer$
|
|
89570
|
-
const WorkspaceLayerLive = mergeAll(layer$
|
|
89571
|
-
const
|
|
89572
|
-
const
|
|
90540
|
+
const WorkspaceEntriesLayerLive = layer$9.pipe(provide(layer$21));
|
|
90541
|
+
const WorkspaceLayerLive = mergeAll(layer$21, WorkspaceEntriesLayerLive, layer$8.pipe(provide(layer$21), provide(WorkspaceEntriesLayerLive)));
|
|
90542
|
+
const TerminalLayerLive = layer$6.pipe(provide(layer));
|
|
90543
|
+
const ProjectFaviconResolverLayerLive = layer$13.pipe(provide(layer$21), provide(layer$14));
|
|
90544
|
+
const AuthLayerLive = layer$32.pipe(provideMerge(PersistenceLayerLive), provide(layer$35));
|
|
89573
90545
|
const ProviderRuntimeLayerLive = ProviderSessionReaperLive.pipe(provideMerge(ProviderLayerLive), provideMerge(OrchestrationLayerLive));
|
|
89574
|
-
const RuntimeDependenciesLive = ReactorLayerLive.pipe(provideMerge(ServerSettingsLayerLive), provideMerge(ProviderRuntimeLayerLive), provideMerge(PersistenceLayerLive), provideMerge(layer$
|
|
90546
|
+
const RuntimeDependenciesLive = ReactorLayerLive.pipe(provideMerge(ServerSettingsLayerLive), provideMerge(ProviderRuntimeLayerLive), provideMerge(PersistenceLayerLive), provideMerge(layer$28), provideMerge(layer$2), provideMerge(ProviderRegistryLive), provideMerge(ProviderInstanceRegistryHydrationLive), provideMerge(layer$3), provideMerge(WorkspaceLayerLive), provideMerge(layer$7), provideMerge(TerminalLayerLive), provideMerge(ProjectFaviconResolverLayerLive), provideMerge(layer$29), provideMerge(layer$23), provideMerge(AuthLayerLive), provideMerge(layer$35)).pipe(provideMerge(BackgroundLayerLive), provideMerge(layer$24), provideMerge(layer$27), provideMerge(layer$26), provide(layer$42));
|
|
89575
90547
|
const commandReadinessLayer = middleware((httpEffect) => flatMap$1(ServerRuntimeStartup, (startup) => startup.awaitCommandReady.pipe(orDie, andThen(httpEffect))), { global: true });
|
|
89576
|
-
const makeRoutesLayer = mergeAll(layer$
|
|
90548
|
+
const makeRoutesLayer = mergeAll(layer$20(EnvironmentHttpApi).pipe(provide(authHttpApiLayer), provide(connectHttpApiLayer), provide(orchestrationHttpApiLayer), provide(serverEnvironmentHttpApiLayer), provide(environmentAuthenticatedAuthLayer)), otlpTracesProxyRouteLayer, assetRouteLayer, staticAndDevRouteLayer, websocketRpcRouteLayer).pipe(provide(commandReadinessLayer), provide(browserApiCorsLayer), provide(httpCompressionLayer));
|
|
89577
90549
|
const runServer = launch(unwrap(gen(function* () {
|
|
89578
90550
|
const config = yield* ServerConfig;
|
|
89579
|
-
const activation = yield* make$
|
|
90551
|
+
const activation = yield* make$73();
|
|
89580
90552
|
const awaitActivation = _await(activation);
|
|
89581
90553
|
const activationLayer = succeed$3(ServerActivation, awaitActivation);
|
|
89582
|
-
const runtimeStateParked = yield* make$
|
|
89583
|
-
const tailscaleParked = yield* make$
|
|
89584
|
-
const routesReady = yield* make$
|
|
90554
|
+
const runtimeStateParked = yield* make$73();
|
|
90555
|
+
const tailscaleParked = yield* make$73();
|
|
90556
|
+
const routesReady = yield* make$73();
|
|
89585
90557
|
yield* fixPath();
|
|
89586
90558
|
const httpListeningLayer = effectDiscard(gen(function* () {
|
|
89587
90559
|
yield* HttpServer;
|
|
@@ -89635,7 +90607,7 @@ const runServer = launch(unwrap(gen(function* () {
|
|
|
89635
90607
|
...config.tailscaleServeEnabled ? [_await(tailscaleParked)] : []
|
|
89636
90608
|
], { concurrency: "unbounded" }).pipe(asVoid)
|
|
89637
90609
|
}).pipe(provideMerge(RuntimeDependenciesLive));
|
|
89638
|
-
return mergeAll(serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }).pipe(tap$1(() => succeed$4(routesReady, void 0).pipe(orDie))), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, config.hubTunnel ? layer$
|
|
90610
|
+
return mergeAll(serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }).pipe(tap$1(() => succeed$4(routesReady, void 0).pipe(orDie))), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, config.hubTunnel ? layer$5(config.hubTunnel).pipe(provideMerge(runtimeServicesLive)) : empty$8).pipe(provideMerge(runtimeServicesLive), provide(activationLayer), provideMerge(HttpServerLive), provide(ApplicationObservabilityLive), provideMerge(layer$43), provideMerge(PlatformServicesLive));
|
|
89639
90611
|
})));
|
|
89640
90612
|
//#endregion
|
|
89641
90613
|
//#region src/cli/server.ts
|
|
@@ -89647,15 +90619,15 @@ const runServerCommand = (flags, options) => gen(function* () {
|
|
|
89647
90619
|
});
|
|
89648
90620
|
return yield* runServer.pipe(provideService(ServerConfig, config), ensuring(sync(releaseDaemonLock)));
|
|
89649
90621
|
});
|
|
89650
|
-
const startCommand = make$
|
|
89651
|
-
const serveCommand = make$
|
|
90622
|
+
const startCommand = make$62("start", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)));
|
|
90623
|
+
const serveCommand = make$62("serve", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server without opening a browser."), withHandler((flags) => runServerCommand(flags, {
|
|
89652
90624
|
startupPresentation: "headless",
|
|
89653
90625
|
forceAutoBootstrapProjectFromCwd: false
|
|
89654
90626
|
})));
|
|
89655
90627
|
//#endregion
|
|
89656
90628
|
//#region src/bin.ts
|
|
89657
|
-
const CliRuntimeLayer = mergeAll(layer$
|
|
89658
|
-
const makeCli = () => make$
|
|
90629
|
+
const CliRuntimeLayer = mergeAll(layer$44, layer$42);
|
|
90630
|
+
const makeCli = () => make$62("t3", { ...sharedServerCommandFlags }).pipe(withDescription("Run the T3 Code server."), withHandler((flags) => runServerCommand(flags)), withSubcommands([
|
|
89659
90631
|
startCommand,
|
|
89660
90632
|
serveCommand,
|
|
89661
90633
|
pairCommand,
|