t3code-cli 0.13.0 → 0.14.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/README.md +87 -1
- package/dist/application.d.ts +2 -0
- package/dist/application.js +1 -1
- package/dist/auth.d.ts +50 -0
- package/dist/auth.js +1 -1
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +348 -603
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +1 -1
- package/dist/client-runtime/authorization.d.ts +2 -0
- package/dist/client-runtime/authorization.js +2 -0
- package/dist/client-runtime/connection.d.ts +2 -0
- package/dist/client-runtime/connection.js +2 -0
- package/dist/client-runtime/environment.d.ts +57 -0
- package/dist/client-runtime/environment.js +2 -0
- package/dist/client-runtime/errors.d.ts +28 -0
- package/dist/client-runtime/errors.js +35 -0
- package/dist/client-runtime/operations/projects.d.ts +2 -0
- package/dist/client-runtime/operations/projects.js +2 -0
- package/dist/client-runtime/operations.d.ts +2 -0
- package/dist/client-runtime/operations.js +2 -0
- package/dist/client-runtime/platform.d.ts +26 -0
- package/dist/client-runtime/platform.js +74 -0
- package/dist/client-runtime/relay.d.ts +121 -0
- package/dist/client-runtime/relay.js +245 -0
- package/dist/client-runtime/rpc.d.ts +2 -0
- package/dist/client-runtime/rpc.js +2 -0
- package/dist/client-runtime/state/assets.d.ts +40 -0
- package/dist/client-runtime/state/assets.js +53 -0
- package/dist/client-runtime/state/auth.d.ts +98 -0
- package/dist/client-runtime/state/auth.js +48 -0
- package/dist/client-runtime/state/connections.d.ts +2 -0
- package/dist/client-runtime/state/connections.js +52 -0
- package/dist/client-runtime/state/entities.d.ts +33 -0
- package/dist/client-runtime/state/entities.js +2 -0
- package/dist/client-runtime/state/filesystem.d.ts +42 -0
- package/dist/client-runtime/state/filesystem.js +48 -0
- package/dist/client-runtime/state/git.d.ts +43 -0
- package/dist/client-runtime/state/git.js +18 -0
- package/dist/client-runtime/state/models.d.ts +2 -0
- package/dist/client-runtime/state/models.js +2 -0
- package/dist/client-runtime/state/orchestration.d.ts +128 -0
- package/dist/client-runtime/state/orchestration.js +20 -0
- package/dist/client-runtime/state/presentation.d.ts +277 -0
- package/dist/client-runtime/state/presentation.js +34 -0
- package/dist/client-runtime/state/preview.d.ts +447 -0
- package/dist/client-runtime/state/preview.js +103 -0
- package/dist/client-runtime/state/project-grouping.d.ts +26 -0
- package/dist/client-runtime/state/project-grouping.js +73 -0
- package/dist/client-runtime/state/projects.d.ts +192 -0
- package/dist/client-runtime/state/projects.js +2 -0
- package/dist/client-runtime/state/relay.d.ts +10 -0
- package/dist/client-runtime/state/relay.js +19 -0
- package/dist/client-runtime/state/review.d.ts +28 -0
- package/dist/client-runtime/state/review.js +11 -0
- package/dist/client-runtime/state/runtime.d.ts +2 -0
- package/dist/client-runtime/state/runtime.js +2 -0
- package/dist/client-runtime/state/server.d.ts +1495 -0
- package/dist/client-runtime/state/server.js +207 -0
- package/dist/client-runtime/state/session.d.ts +532 -0
- package/dist/client-runtime/state/session.js +21 -0
- package/dist/client-runtime/state/shell.d.ts +529 -0
- package/dist/client-runtime/state/shell.js +2 -0
- package/dist/client-runtime/state/source-control.d.ts +92 -0
- package/dist/client-runtime/state/source-control.js +36 -0
- package/dist/client-runtime/state/terminal.d.ts +237 -0
- package/dist/client-runtime/state/terminal.js +173 -0
- package/dist/client-runtime/state/thread-settled.d.ts +104 -0
- package/dist/client-runtime/state/thread-settled.js +157 -0
- package/dist/client-runtime/state/thread-sort.d.ts +23 -0
- package/dist/client-runtime/state/thread-sort.js +47 -0
- package/dist/client-runtime/state/threads.d.ts +538 -0
- package/dist/client-runtime/state/threads.js +934 -0
- package/dist/client-runtime/state/vcs.d.ts +442 -0
- package/dist/client-runtime/state/vcs.js +756 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +1 -1
- package/dist/connection.d.ts +7 -0
- package/dist/connection.js +1 -1
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/node.d.ts +6 -0
- package/dist/node.js +1 -1
- package/dist/orchestration.d.ts +1420 -0
- package/dist/orchestration.js +1 -1
- package/dist/preview.d.ts +2 -0
- package/dist/preview.js +2 -0
- package/dist/rpc.d.ts +6043 -0
- package/dist/rpc.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -2
- package/dist/shared/DrainableWorker.d.ts +28 -0
- package/dist/shared/DrainableWorker.js +24 -0
- package/dist/shared/KeyedCoalescingWorker.d.ts +13 -0
- package/dist/shared/KeyedCoalescingWorker.js +89 -0
- package/dist/shared/Net.d.ts +43 -0
- package/dist/shared/Net.js +126 -0
- package/dist/shared/String.d.ts +4 -0
- package/dist/shared/String.js +8 -0
- package/dist/shared/Struct.d.ts +5 -0
- package/dist/shared/Struct.js +2 -0
- package/dist/shared/advertisedEndpoint.d.ts +2 -0
- package/dist/shared/advertisedEndpoint.js +2 -0
- package/dist/shared/agentAwareness.d.ts +27 -0
- package/dist/shared/agentAwareness.js +54 -0
- package/dist/shared/backgroundActivitySettings.d.ts +23 -0
- package/dist/shared/backgroundActivitySettings.js +2 -0
- package/dist/shared/chatList.d.ts +12 -0
- package/dist/shared/chatList.js +14 -0
- package/dist/shared/cliArgs.d.ts +33 -0
- package/dist/shared/cliArgs.js +103 -0
- package/dist/shared/composerInlineTokens.d.ts +20 -0
- package/dist/shared/composerInlineTokens.js +72 -0
- package/dist/shared/composerTrigger.d.ts +26 -0
- package/dist/shared/composerTrigger.js +97 -0
- package/dist/shared/connectAuth.d.ts +58 -0
- package/dist/shared/connectAuth.js +89 -0
- package/dist/shared/devHome.d.ts +21 -0
- package/dist/shared/devHome.js +65 -0
- package/dist/shared/devProxy.d.ts +15 -0
- package/dist/shared/devProxy.js +22 -0
- package/dist/shared/dpop.d.ts +32 -0
- package/dist/shared/dpop.js +2724 -0
- package/dist/shared/dpopCommon.d.ts +2 -0
- package/dist/shared/dpopCommon.js +2 -0
- package/dist/shared/filePreview.d.ts +8 -0
- package/dist/shared/filePreview.js +31 -0
- package/dist/shared/git.d.ts +41 -0
- package/dist/shared/git.js +2 -0
- package/dist/shared/hostProcess.d.ts +13 -0
- package/dist/shared/hostProcess.js +2 -0
- package/dist/shared/httpObservability.d.ts +5 -0
- package/dist/shared/httpObservability.js +2 -0
- package/dist/shared/httpReadiness.d.ts +38 -0
- package/dist/shared/httpReadiness.js +110 -0
- package/dist/shared/keybindings.d.ts +35 -0
- package/dist/shared/keybindings.js +330 -0
- package/dist/shared/logging.d.ts +39 -0
- package/dist/shared/logging.js +2 -0
- package/dist/shared/model.d.ts +44 -0
- package/dist/shared/model.js +2 -0
- package/dist/shared/oauthScope.d.ts +23 -0
- package/dist/shared/oauthScope.js +2 -0
- package/dist/shared/observability.d.ts +105 -0
- package/dist/shared/observability.js +346 -0
- package/dist/shared/orchestrationTiming.d.ts +16 -0
- package/dist/shared/orchestrationTiming.js +32 -0
- package/dist/shared/path.d.ts +2 -0
- package/dist/shared/path.js +2 -0
- package/dist/shared/preview.d.ts +35 -0
- package/dist/shared/preview.js +103 -0
- package/dist/shared/previewViewport.d.ts +16 -0
- package/dist/shared/previewViewport.js +159 -0
- package/dist/shared/projectFavicon.d.ts +5 -0
- package/dist/shared/projectFavicon.js +13 -0
- package/dist/shared/projectScripts.d.ts +19 -0
- package/dist/shared/projectScripts.js +18 -0
- package/dist/shared/qrCode.d.ts +87 -0
- package/dist/shared/qrCode.js +870 -0
- package/dist/shared/relayAuth.d.ts +27 -0
- package/dist/shared/relayAuth.js +83 -0
- package/dist/shared/relayClient.d.ts +58 -0
- package/dist/shared/relayClient.js +245 -0
- package/dist/shared/relayJwt.d.ts +39 -0
- package/dist/shared/relayJwt.js +2 -0
- package/dist/shared/relaySigning.d.ts +4 -0
- package/dist/shared/relaySigning.js +2 -0
- package/dist/shared/relayTracing.d.ts +25 -0
- package/dist/shared/relayTracing.js +2 -0
- package/dist/shared/relayUrl.d.ts +5 -0
- package/dist/shared/relayUrl.js +2 -0
- package/dist/shared/remote.d.ts +57 -0
- package/dist/shared/remote.js +2 -0
- package/dist/shared/schemaJson.d.ts +35 -0
- package/dist/shared/schemaJson.js +2 -0
- package/dist/shared/schemaYaml.d.ts +86 -0
- package/dist/shared/schemaYaml.js +99 -0
- package/dist/shared/searchRanking.d.ts +30 -0
- package/dist/shared/searchRanking.js +99 -0
- package/dist/shared/semver.d.ts +23 -0
- package/dist/shared/semver.js +124 -0
- package/dist/shared/serverSettings.d.ts +19 -0
- package/dist/shared/serverSettings.js +103 -0
- package/dist/shared/shell.d.ts +51 -0
- package/dist/shared/shell.js +408 -0
- package/dist/shared/sourceControl.d.ts +26 -0
- package/dist/shared/sourceControl.js +2 -0
- package/dist/shared/t3ProjectFile.d.ts +27 -0
- package/dist/shared/t3ProjectFile.js +25 -0
- package/dist/shared/terminalLabels.d.ts +16 -0
- package/dist/shared/terminalLabels.js +28 -0
- package/dist/shared/toolActivity.d.ts +16 -0
- package/dist/shared/toolActivity.js +159 -0
- package/dist/shared.d.ts +43036 -0
- package/dist/shared.js +25428 -12277
- package/dist/t3tools.d.ts +2 -0
- package/dist/t3tools.js +1 -1
- package/package.json +39 -21
- package/src/auth/index.ts +2 -0
- package/src/auth/pairing.ts +8 -5
- package/src/auth/service.ts +2 -1
- package/src/auth/transport.ts +4 -0
- package/src/auth/type.ts +6 -0
- package/src/cli/auth.ts +7 -1
- package/src/contracts/index.ts +8 -0
- package/src/orchestration/layer.ts +36 -0
- package/src/orchestration/service.ts +5 -0
- package/src/preview/index.ts +11 -0
- package/src/preview/service.ts +52 -0
- package/src/rpc/error.ts +2 -0
- package/src/rpc/layer.ts +5 -4
- package/src/rpc/operation.ts +5 -4
- package/src/rpc/ws-group.ts +6 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/layer.ts +5 -0
- package/src/sql/node-sqlite-client.ts +3 -0
- package/dist/src/application/actions.d.ts +0 -25
- package/dist/src/application/error.d.ts +0 -3
- package/dist/src/application/index.d.ts +0 -4
- package/dist/src/application/layer.d.ts +0 -117
- package/dist/src/application/model-selection.d.ts +0 -34
- package/dist/src/application/models.d.ts +0 -8
- package/dist/src/application/project-commands.d.ts +0 -44
- package/dist/src/application/projects.d.ts +0 -23
- package/dist/src/application/service.d.ts +0 -243
- package/dist/src/application/shell-sequence.d.ts +0 -96
- package/dist/src/application/terminals.d.ts +0 -66
- package/dist/src/application/thread-commands.d.ts +0 -157
- package/dist/src/application/thread-update.d.ts +0 -8
- package/dist/src/application/thread-wait.d.ts +0 -106
- package/dist/src/application/threads.d.ts +0 -660
- package/dist/src/auth/error.d.ts +0 -50
- package/dist/src/auth/index.d.ts +0 -10
- package/dist/src/auth/layer.d.ts +0 -53
- package/dist/src/auth/local-base-dir.d.ts +0 -8
- package/dist/src/auth/local-origin.d.ts +0 -18
- package/dist/src/auth/local-token.d.ts +0 -26
- package/dist/src/auth/local.d.ts +0 -24
- package/dist/src/auth/pairing.d.ts +0 -22
- package/dist/src/auth/remote-error.d.ts +0 -3
- package/dist/src/auth/schema.d.ts +0 -58
- package/dist/src/auth/service.d.ts +0 -27
- package/dist/src/auth/transport.d.ts +0 -22
- package/dist/src/auth/type.d.ts +0 -83
- package/dist/src/cli/env/flag.d.ts +0 -2
- package/dist/src/cli/env/index.d.ts +0 -2
- package/dist/src/cli/env/selection-layer.d.ts +0 -3
- package/dist/src/cli/flags.d.ts +0 -20
- package/dist/src/cli/format/index.d.ts +0 -1
- package/dist/src/cli/format/output.d.ts +0 -12
- package/dist/src/cli/index.d.ts +0 -5
- package/dist/src/cli/runtime/index.d.ts +0 -1
- package/dist/src/cli/runtime/service.d.ts +0 -16
- package/dist/src/cli/scope/index.d.ts +0 -1
- package/dist/src/cli/scope/resolve.d.ts +0 -20
- package/dist/src/cli-path/layer.d.ts +0 -3
- package/dist/src/cli-path/service.d.ts +0 -8
- package/dist/src/config/config.d.ts +0 -49
- package/dist/src/config/credential/cipher-node.d.ts +0 -3
- package/dist/src/config/credential/cipher-web.d.ts +0 -3
- package/dist/src/config/credential/cipher.d.ts +0 -29
- package/dist/src/config/credential/env.d.ts +0 -3
- package/dist/src/config/credential/error.d.ts +0 -8
- package/dist/src/config/credential/index.d.ts +0 -6
- package/dist/src/config/credential/service.d.ts +0 -34
- package/dist/src/config/env/env.d.ts +0 -55
- package/dist/src/config/env/index.d.ts +0 -2
- package/dist/src/config/env/layout.d.ts +0 -11
- package/dist/src/config/environment-name/index.d.ts +0 -1
- package/dist/src/config/environment-name/name.d.ts +0 -10
- package/dist/src/config/error.d.ts +0 -11
- package/dist/src/config/index.d.ts +0 -10
- package/dist/src/config/keystore/error.d.ts +0 -8
- package/dist/src/config/keystore/file.d.ts +0 -9
- package/dist/src/config/keystore/index.d.ts +0 -4
- package/dist/src/config/keystore/keyring-node.d.ts +0 -4
- package/dist/src/config/keystore/service.d.ts +0 -33
- package/dist/src/config/paths/index.d.ts +0 -1
- package/dist/src/config/paths/paths.d.ts +0 -6
- package/dist/src/config/persist/file-mode.d.ts +0 -4
- package/dist/src/config/persist/migration.d.ts +0 -68
- package/dist/src/config/persist/persist.d.ts +0 -40
- package/dist/src/config/persist/schema.d.ts +0 -68
- package/dist/src/config/resolve/resolve.d.ts +0 -40
- package/dist/src/config/selection/index.d.ts +0 -1
- package/dist/src/config/selection/resolve.d.ts +0 -4
- package/dist/src/config/selection/service.d.ts +0 -10
- package/dist/src/config/types.d.ts +0 -36
- package/dist/src/config/url/error.d.ts +0 -10
- package/dist/src/config/url/index.d.ts +0 -2
- package/dist/src/config/url/url.d.ts +0 -6
- package/dist/src/connection/error.d.ts +0 -10
- package/dist/src/connection/index.d.ts +0 -4
- package/dist/src/connection/layer.d.ts +0 -3
- package/dist/src/connection/prepared.d.ts +0 -14
- package/dist/src/connection/service.d.ts +0 -13
- package/dist/src/connection/type.d.ts +0 -10
- package/dist/src/contracts/index.d.ts +0 -1
- package/dist/src/domain/error.d.ts +0 -57
- package/dist/src/domain/helpers.d.ts +0 -179
- package/dist/src/domain/model-config.d.ts +0 -330
- package/dist/src/domain/thread-activities.d.ts +0 -14
- package/dist/src/domain/thread-lifecycle.d.ts +0 -120
- package/dist/src/index.d.ts +0 -3
- package/dist/src/node/connection.d.ts +0 -2
- package/dist/src/node/index.d.ts +0 -1
- package/dist/src/orchestration/index.d.ts +0 -2
- package/dist/src/orchestration/layer.d.ts +0 -1419
- package/dist/src/orchestration/service.d.ts +0 -28
- package/dist/src/rpc/error.d.ts +0 -16
- package/dist/src/rpc/index.d.ts +0 -6
- package/dist/src/rpc/layer.d.ts +0 -5862
- package/dist/src/rpc/operation.d.ts +0 -24
- package/dist/src/rpc/service.d.ts +0 -15
- package/dist/src/rpc/session.d.ts +0 -22
- package/dist/src/rpc/ws-group.d.ts +0 -1984
- package/dist/src/runtime/index.d.ts +0 -1
- package/dist/src/runtime/layer.d.ts +0 -15
- package/dist/src/sql/node-sqlite-client.d.ts +0 -10
- package/dist/src/sql/service.d.ts +0 -17
- package/dist/src/t3tools/index.d.ts +0 -1
package/dist/rpc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gi as T3RpcOperations, Gn as T3RpcLive, Ji as T3Rpc, Ki as T3RpcOperationsLive, Kn as makeT3RpcLayer, Yi as RpcError, qi as makeT3RpcOperations } from "./shared.js";
|
|
2
2
|
export { RpcError, T3Rpc, T3RpcLive, T3RpcOperations, T3RpcOperationsLive, makeT3RpcLayer, makeT3RpcOperations };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { An as T3LocalAuthTokenLayer, Cn as BaseAppLayer, Dn as T3AuthTransportLayer, En as T3AuthPairingLayer, Mn as T3PreviewAutomationLayer, On as T3LocalAuthLayer, Sn as AuthAppLayer, Tn as T3AuthLayer, jn as T3OrchestrationLayer, kn as T3LocalAuthOriginLayer, wn as BaseAuthAppLayer, xn as AppLayer } from "./shared.js";
|
|
2
|
+
export { AppLayer, AuthAppLayer, BaseAppLayer, BaseAuthAppLayer, T3AuthLayer, T3AuthPairingLayer, T3AuthTransportLayer, T3LocalAuthLayer, T3LocalAuthOriginLayer, T3LocalAuthTokenLayer, T3OrchestrationLayer, T3PreviewAutomationLayer };
|
package/dist/runtime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AppLayer, AuthAppLayer, BaseAppLayer, BaseAuthAppLayer, T3AuthLayer, T3AuthPairingLayer, T3AuthTransportLayer, T3LocalAuthLayer, T3LocalAuthOriginLayer, T3LocalAuthTokenLayer, T3OrchestrationLayer };
|
|
1
|
+
import { Bn as T3LocalAuthLayer, Fn as BaseAppLayer, Hn as T3LocalAuthTokenLayer, In as BaseAuthAppLayer, Ln as T3AuthLayer, Nn as AppLayer, Pn as AuthAppLayer, Rn as T3AuthPairingLayer, Un as T3OrchestrationLayer, Vn as T3LocalAuthOriginLayer, Wn as T3PreviewAutomationLayer, zn as T3AuthTransportLayer } from "./shared.js";
|
|
2
|
+
export { AppLayer, AuthAppLayer, BaseAppLayer, BaseAuthAppLayer, T3AuthLayer, T3AuthPairingLayer, T3AuthTransportLayer, T3LocalAuthLayer, T3LocalAuthOriginLayer, T3LocalAuthTokenLayer, T3OrchestrationLayer, T3PreviewAutomationLayer };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Scope from "effect/Scope";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/DrainableWorker.d.ts
|
|
4
|
+
interface DrainableWorker<A> {
|
|
5
|
+
/**
|
|
6
|
+
* Enqueue a work item and track it for `drain()`.
|
|
7
|
+
*
|
|
8
|
+
* This wraps `Queue.offer` so drain state is updated atomically with the
|
|
9
|
+
* enqueue path instead of inferring it from queue internals.
|
|
10
|
+
*/
|
|
11
|
+
readonly enqueue: (item: A) => Effect.Effect<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves when the queue is empty and the worker is idle (not processing).
|
|
14
|
+
*/
|
|
15
|
+
readonly drain: Effect.Effect<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a drainable worker that processes items from an unbounded queue.
|
|
19
|
+
*
|
|
20
|
+
* The worker is forked into the current scope and will be interrupted when
|
|
21
|
+
* the scope closes. A finalizer shuts down the queue.
|
|
22
|
+
*
|
|
23
|
+
* @param process - The effect to run for each queued item.
|
|
24
|
+
* @returns A `DrainableWorker` with `queue` and `drain`.
|
|
25
|
+
*/
|
|
26
|
+
declare const makeDrainableWorker: <A, E, R>(process: (item: A) => Effect.Effect<void, E, R>) => Effect.Effect<DrainableWorker<A>, never, Scope.Scope | R>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { DrainableWorker, makeDrainableWorker };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FO as tx, IO as txRetry, LD as acquireRelease, RO as void_, ZD as ensuring, _v as unbounded, aO as gen, gv as take, hv as shutdown, iO as forkScoped, kO as tap, mv as offer, rO as forever, vv as get, xv as update, yv as make } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/DrainableWorker.ts
|
|
3
|
+
/**
|
|
4
|
+
* Create a drainable worker that processes items from an unbounded queue.
|
|
5
|
+
*
|
|
6
|
+
* The worker is forked into the current scope and will be interrupted when
|
|
7
|
+
* the scope closes. A finalizer shuts down the queue.
|
|
8
|
+
*
|
|
9
|
+
* @param process - The effect to run for each queued item.
|
|
10
|
+
* @returns A `DrainableWorker` with `queue` and `drain`.
|
|
11
|
+
*/
|
|
12
|
+
const makeDrainableWorker = (process) => gen(function* () {
|
|
13
|
+
const queue = yield* acquireRelease(unbounded(), shutdown);
|
|
14
|
+
const outstanding = yield* make(0);
|
|
15
|
+
yield* take(queue).pipe(tap((a) => ensuring(process(a), update(outstanding, (n) => n - 1))), forever, forkScoped);
|
|
16
|
+
const drain = get(outstanding).pipe(tap((n) => n > 0 ? txRetry : void_), tx);
|
|
17
|
+
const enqueue = (element) => offer(queue, element).pipe(tap(() => update(outstanding, (n) => n + 1)), tx);
|
|
18
|
+
return {
|
|
19
|
+
enqueue,
|
|
20
|
+
drain
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { makeDrainableWorker };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Scope from "effect/Scope";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/KeyedCoalescingWorker.d.ts
|
|
4
|
+
interface KeyedCoalescingWorker<K, V> {
|
|
5
|
+
readonly enqueue: (key: K, value: V) => Effect.Effect<void>;
|
|
6
|
+
readonly drainKey: (key: K) => Effect.Effect<void>;
|
|
7
|
+
}
|
|
8
|
+
declare const makeKeyedCoalescingWorker: <K, V, E, R>(options: {
|
|
9
|
+
readonly merge: (current: V, next: V) => V;
|
|
10
|
+
readonly process: (key: K, value: V) => Effect.Effect<void, E, R>;
|
|
11
|
+
}) => Effect.Effect<KeyedCoalescingWorker<K, V>, never, Scope.Scope | R>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { KeyedCoalescingWorker, makeKeyedCoalescingWorker };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { $D as flatMap, FO as tx, GD as catchCause, IO as txRetry, LD as acquireRelease, RO as void_, UD as asVoid, _v as unbounded, aO as gen, bv as modify, gv as take, hv as shutdown, iO as forkScoped, kO as tap, mv as offer, rO as forever, vv as get, yv as make } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/KeyedCoalescingWorker.ts
|
|
3
|
+
const makeKeyedCoalescingWorker = (options) => gen(function* () {
|
|
4
|
+
const queue = yield* acquireRelease(unbounded(), shutdown);
|
|
5
|
+
const stateRef = yield* make({
|
|
6
|
+
latestByKey: /* @__PURE__ */ new Map(),
|
|
7
|
+
queuedKeys: /* @__PURE__ */ new Set(),
|
|
8
|
+
activeKeys: /* @__PURE__ */ new Set()
|
|
9
|
+
});
|
|
10
|
+
const processKey = (key, value) => options.process(key, value).pipe(flatMap(() => modify(stateRef, (state) => {
|
|
11
|
+
const nextValue = state.latestByKey.get(key);
|
|
12
|
+
if (nextValue === void 0) {
|
|
13
|
+
const activeKeys = new Set(state.activeKeys);
|
|
14
|
+
activeKeys.delete(key);
|
|
15
|
+
return [null, {
|
|
16
|
+
...state,
|
|
17
|
+
activeKeys
|
|
18
|
+
}];
|
|
19
|
+
}
|
|
20
|
+
const latestByKey = new Map(state.latestByKey);
|
|
21
|
+
latestByKey.delete(key);
|
|
22
|
+
return [nextValue, {
|
|
23
|
+
...state,
|
|
24
|
+
latestByKey
|
|
25
|
+
}];
|
|
26
|
+
}).pipe(tx)), flatMap((nextValue) => nextValue === null ? void_ : processKey(key, nextValue)));
|
|
27
|
+
const cleanupFailedKey = (key) => modify(stateRef, (state) => {
|
|
28
|
+
const activeKeys = new Set(state.activeKeys);
|
|
29
|
+
activeKeys.delete(key);
|
|
30
|
+
if (state.latestByKey.has(key) && !state.queuedKeys.has(key)) {
|
|
31
|
+
const queuedKeys = new Set(state.queuedKeys);
|
|
32
|
+
queuedKeys.add(key);
|
|
33
|
+
return [true, {
|
|
34
|
+
...state,
|
|
35
|
+
activeKeys,
|
|
36
|
+
queuedKeys
|
|
37
|
+
}];
|
|
38
|
+
}
|
|
39
|
+
return [false, {
|
|
40
|
+
...state,
|
|
41
|
+
activeKeys
|
|
42
|
+
}];
|
|
43
|
+
}).pipe(tx, flatMap((shouldRequeue) => shouldRequeue ? offer(queue, key) : void_));
|
|
44
|
+
yield* take(queue).pipe(flatMap((key) => modify(stateRef, (state) => {
|
|
45
|
+
const queuedKeys = new Set(state.queuedKeys);
|
|
46
|
+
queuedKeys.delete(key);
|
|
47
|
+
const value = state.latestByKey.get(key);
|
|
48
|
+
if (value === void 0) return [null, {
|
|
49
|
+
...state,
|
|
50
|
+
queuedKeys
|
|
51
|
+
}];
|
|
52
|
+
const latestByKey = new Map(state.latestByKey);
|
|
53
|
+
latestByKey.delete(key);
|
|
54
|
+
const activeKeys = new Set(state.activeKeys);
|
|
55
|
+
activeKeys.add(key);
|
|
56
|
+
return [{
|
|
57
|
+
key,
|
|
58
|
+
value
|
|
59
|
+
}, {
|
|
60
|
+
...state,
|
|
61
|
+
latestByKey,
|
|
62
|
+
queuedKeys,
|
|
63
|
+
activeKeys
|
|
64
|
+
}];
|
|
65
|
+
}).pipe(tx)), flatMap((item) => item === null ? void_ : processKey(item.key, item.value).pipe(catchCause(() => cleanupFailedKey(item.key)))), forever, forkScoped);
|
|
66
|
+
const enqueue = (key, value) => modify(stateRef, (state) => {
|
|
67
|
+
const latestByKey = new Map(state.latestByKey);
|
|
68
|
+
const existing = latestByKey.get(key);
|
|
69
|
+
latestByKey.set(key, existing === void 0 ? value : options.merge(existing, value));
|
|
70
|
+
if (state.queuedKeys.has(key) || state.activeKeys.has(key)) return [false, {
|
|
71
|
+
...state,
|
|
72
|
+
latestByKey
|
|
73
|
+
}];
|
|
74
|
+
const queuedKeys = new Set(state.queuedKeys);
|
|
75
|
+
queuedKeys.add(key);
|
|
76
|
+
return [true, {
|
|
77
|
+
...state,
|
|
78
|
+
latestByKey,
|
|
79
|
+
queuedKeys
|
|
80
|
+
}];
|
|
81
|
+
}).pipe(flatMap((shouldOffer) => shouldOffer ? offer(queue, key) : void_), tx, asVoid);
|
|
82
|
+
const drainKey = (key) => get(stateRef).pipe(tap((state) => state.latestByKey.has(key) || state.queuedKeys.has(key) || state.activeKeys.has(key) ? txRetry : void_), asVoid, tx);
|
|
83
|
+
return {
|
|
84
|
+
enqueue,
|
|
85
|
+
drainKey
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { makeKeyedCoalescingWorker };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
//#region upstream-t3code/packages/shared/src/Net.d.ts
|
|
5
|
+
declare const NetError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
6
|
+
readonly _tag: "NetError";
|
|
7
|
+
} & Readonly<A>;
|
|
8
|
+
declare class NetError extends NetError_base<{
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly cause?: unknown;
|
|
11
|
+
}> {}
|
|
12
|
+
interface NetServiceShape {
|
|
13
|
+
/**
|
|
14
|
+
* Returns true when a TCP server can bind to {host, port}.
|
|
15
|
+
*/
|
|
16
|
+
readonly canListenOnHost: (port: number, host: string) => Effect.Effect<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Checks loopback availability on both IPv4 and IPv6 localhost addresses.
|
|
19
|
+
*/
|
|
20
|
+
readonly isPortAvailableOnLoopback: (port: number) => Effect.Effect<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Reserve an ephemeral loopback port and release it immediately.
|
|
23
|
+
*/
|
|
24
|
+
readonly reserveLoopbackPort: (host?: string) => Effect.Effect<number, NetError>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve an available listening port, preferring the provided port first.
|
|
27
|
+
*/
|
|
28
|
+
readonly findAvailablePort: (preferred: number) => Effect.Effect<number, NetError>;
|
|
29
|
+
}
|
|
30
|
+
declare const NetService_base: Context.ServiceClass<NetService, "@t3tools/shared/Net/NetService", NetServiceShape>;
|
|
31
|
+
/**
|
|
32
|
+
* NetService - Service tag for startup networking helpers.
|
|
33
|
+
*/
|
|
34
|
+
declare class NetService extends NetService_base {}
|
|
35
|
+
declare const make: () => {
|
|
36
|
+
canListenOnHost: (port: number, host: string) => Effect.Effect<boolean>;
|
|
37
|
+
isPortAvailableOnLoopback: (port: number) => Effect.Effect<boolean>;
|
|
38
|
+
reserveLoopbackPort: (host?: string) => Effect.Effect<number, NetError>;
|
|
39
|
+
findAvailablePort: (preferred: number) => Effect.Effect<number, NetError, never>;
|
|
40
|
+
};
|
|
41
|
+
declare const layer: Layer.Layer<NetService, never, never>;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { NetError, NetService, NetServiceShape, layer, make };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { $k as hasProperty, BO as zipWith, EO as succeed, KO as TaggedError, OO as sync, QD as fail, WD as callback, aO as gen, iA as isString, kk as Service, rA as isObject, rk as sync$1 } from "../shared.js";
|
|
2
|
+
import * as NodeNet from "node:net";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/Net.ts
|
|
4
|
+
var NetError = class extends TaggedError("NetError") {};
|
|
5
|
+
const isErrnoExceptionWithCode = (cause) => isObject(cause) && hasProperty(cause, "code") && isString(cause.code);
|
|
6
|
+
const closeServer = (server) => {
|
|
7
|
+
try {
|
|
8
|
+
server.close();
|
|
9
|
+
} catch {}
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* NetService - Service tag for startup networking helpers.
|
|
13
|
+
*/
|
|
14
|
+
var NetService = class extends Service()("@t3tools/shared/Net/NetService") {};
|
|
15
|
+
const make = () => {
|
|
16
|
+
/**
|
|
17
|
+
* Returns true when a TCP server can bind to {host, port}.
|
|
18
|
+
* `EADDRNOTAVAIL` is treated as available so IPv6-absent hosts don't fail
|
|
19
|
+
* loopback availability checks.
|
|
20
|
+
*/
|
|
21
|
+
const canListenOnHost = (port, host) => callback((resume) => {
|
|
22
|
+
const server = NodeNet.createServer();
|
|
23
|
+
let settled = false;
|
|
24
|
+
const settle = (value) => {
|
|
25
|
+
if (settled) return;
|
|
26
|
+
settled = true;
|
|
27
|
+
resume(succeed(value));
|
|
28
|
+
};
|
|
29
|
+
server.unref();
|
|
30
|
+
server.once("error", (cause) => {
|
|
31
|
+
if (isErrnoExceptionWithCode(cause) && cause.code === "EADDRNOTAVAIL") {
|
|
32
|
+
settle(true);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
settle(false);
|
|
36
|
+
});
|
|
37
|
+
server.once("listening", () => {
|
|
38
|
+
server.close(() => {
|
|
39
|
+
settle(true);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
server.listen({
|
|
43
|
+
host,
|
|
44
|
+
port
|
|
45
|
+
});
|
|
46
|
+
return sync(() => {
|
|
47
|
+
closeServer(server);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const hasListenerOnHost = (port, host) => callback((resume) => {
|
|
51
|
+
const socket = NodeNet.createConnection({
|
|
52
|
+
host,
|
|
53
|
+
port
|
|
54
|
+
});
|
|
55
|
+
let settled = false;
|
|
56
|
+
const settle = (value) => {
|
|
57
|
+
if (settled) return;
|
|
58
|
+
settled = true;
|
|
59
|
+
socket.destroy();
|
|
60
|
+
resume(succeed(value));
|
|
61
|
+
};
|
|
62
|
+
socket.unref();
|
|
63
|
+
socket.setTimeout(250);
|
|
64
|
+
socket.once("connect", () => {
|
|
65
|
+
settle(true);
|
|
66
|
+
});
|
|
67
|
+
socket.once("error", () => {
|
|
68
|
+
settle(false);
|
|
69
|
+
});
|
|
70
|
+
socket.once("timeout", () => {
|
|
71
|
+
settle(false);
|
|
72
|
+
});
|
|
73
|
+
return sync(() => {
|
|
74
|
+
socket.destroy();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
const isPortAvailableOnLoopback = (port) => gen(function* () {
|
|
78
|
+
if (yield* zipWith(hasListenerOnHost(port, "127.0.0.1"), hasListenerOnHost(port, "::1"), (ipv4, ipv6) => ipv4 || ipv6)) return false;
|
|
79
|
+
return yield* zipWith(canListenOnHost(port, "127.0.0.1"), canListenOnHost(port, "::1"), (ipv4, ipv6) => ipv4 && ipv6);
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Reserve an ephemeral loopback port and release it immediately.
|
|
83
|
+
* Returns the reserved port number.
|
|
84
|
+
*/
|
|
85
|
+
const reserveLoopbackPort = (host = "127.0.0.1") => callback((resume) => {
|
|
86
|
+
const probe = NodeNet.createServer();
|
|
87
|
+
let settled = false;
|
|
88
|
+
const settle = (effect) => {
|
|
89
|
+
if (settled) return;
|
|
90
|
+
settled = true;
|
|
91
|
+
resume(effect);
|
|
92
|
+
};
|
|
93
|
+
probe.once("error", (cause) => {
|
|
94
|
+
settle(fail(new NetError({
|
|
95
|
+
message: "Failed to reserve loopback port",
|
|
96
|
+
cause
|
|
97
|
+
})));
|
|
98
|
+
});
|
|
99
|
+
probe.listen(0, host, () => {
|
|
100
|
+
const address = probe.address();
|
|
101
|
+
const port = typeof address === "object" && address !== null ? address.port : 0;
|
|
102
|
+
probe.close(() => {
|
|
103
|
+
if (port > 0) {
|
|
104
|
+
settle(succeed(port));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
settle(fail(new NetError({ message: "Failed to reserve loopback port" })));
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
return sync(() => {
|
|
111
|
+
closeServer(probe);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
canListenOnHost,
|
|
116
|
+
isPortAvailableOnLoopback,
|
|
117
|
+
reserveLoopbackPort,
|
|
118
|
+
findAvailablePort: (preferred) => gen(function* () {
|
|
119
|
+
if (preferred > 0 && (yield* isPortAvailableOnLoopback(preferred))) return preferred;
|
|
120
|
+
return yield* reserveLoopbackPort();
|
|
121
|
+
})
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const layer = sync$1(NetService, make);
|
|
125
|
+
//#endregion
|
|
126
|
+
export { NetError, NetService, layer, make };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/String.ts
|
|
2
|
+
function truncate(text, maxLength = 50) {
|
|
3
|
+
const trimmed = text.trim();
|
|
4
|
+
if (trimmed.length <= maxLength) return trimmed;
|
|
5
|
+
return `${trimmed.slice(0, maxLength)}...`;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { truncate };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/Struct.d.ts
|
|
2
|
+
type DeepPartial<T> = T extends readonly (infer U)[] ? readonly DeepPartial<U>[] : T extends object ? { [K in keyof T]?: DeepPartial<T[K]>; } : T;
|
|
3
|
+
declare function deepMerge<T extends Record<string, unknown>>(current: T, patch: DeepPartial<T>): T;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { DeepPartial, deepMerge };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _n as classifyHostedHttpsCompatibility, bn as normalizeHttpBaseUrl, gn as CreateAdvertisedEndpointInput, vn as createAdvertisedEndpoint, yn as deriveWsBaseUrl } from "../shared.js";
|
|
2
|
+
export { CreateAdvertisedEndpointInput, classifyHostedHttpsCompatibility, createAdvertisedEndpoint, deriveWsBaseUrl, normalizeHttpBaseUrl };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { $T as ThreadId, _v as OrchestrationThreadShell, tv as OrchestrationProjectShell, zT as EnvironmentId } from "../shared.js";
|
|
2
|
+
//#region upstream-t3code/packages/shared/src/agentAwareness.d.ts
|
|
3
|
+
type AgentAwarenessPhase = "starting" | "running" | "waiting_for_approval" | "waiting_for_input" | "completed" | "failed" | "stale";
|
|
4
|
+
interface AgentAwarenessState {
|
|
5
|
+
readonly environmentId: EnvironmentId;
|
|
6
|
+
readonly threadId: ThreadId;
|
|
7
|
+
readonly projectTitle: string;
|
|
8
|
+
readonly threadTitle: string;
|
|
9
|
+
readonly phase: AgentAwarenessPhase;
|
|
10
|
+
readonly headline: string;
|
|
11
|
+
readonly detail?: string;
|
|
12
|
+
readonly modelTitle: string;
|
|
13
|
+
readonly updatedAt: string;
|
|
14
|
+
readonly deepLink: string;
|
|
15
|
+
}
|
|
16
|
+
interface ProjectThreadAwarenessInput {
|
|
17
|
+
readonly environmentId: EnvironmentId;
|
|
18
|
+
readonly project: Pick<OrchestrationProjectShell, "title">;
|
|
19
|
+
readonly thread: Pick<OrchestrationThreadShell, "id" | "title" | "modelSelection" | "session" | "latestTurn" | "updatedAt" | "hasPendingApprovals" | "hasPendingUserInput">;
|
|
20
|
+
}
|
|
21
|
+
declare function buildAgentAwarenessDeepLink(input: {
|
|
22
|
+
readonly environmentId: EnvironmentId;
|
|
23
|
+
readonly threadId: ThreadId;
|
|
24
|
+
}): string;
|
|
25
|
+
declare function projectThreadAwareness(input: ProjectThreadAwarenessInput): AgentAwarenessState | null;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { AgentAwarenessPhase, AgentAwarenessState, ProjectThreadAwarenessInput, buildAgentAwarenessDeepLink, projectThreadAwareness };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/agentAwareness.ts
|
|
2
|
+
function buildAgentAwarenessDeepLink(input) {
|
|
3
|
+
return `/threads/${encodeURIComponent(input.environmentId)}/${encodeURIComponent(input.threadId)}`;
|
|
4
|
+
}
|
|
5
|
+
function projectThreadAwareness(input) {
|
|
6
|
+
const { environmentId, project, thread } = input;
|
|
7
|
+
const phase = resolveThreadAwarenessPhase(thread);
|
|
8
|
+
if (!phase) return null;
|
|
9
|
+
const detail = detailForPhase(phase, thread);
|
|
10
|
+
return {
|
|
11
|
+
environmentId,
|
|
12
|
+
threadId: thread.id,
|
|
13
|
+
projectTitle: project.title,
|
|
14
|
+
threadTitle: thread.title,
|
|
15
|
+
phase,
|
|
16
|
+
headline: headlineForPhase(phase),
|
|
17
|
+
...detail === void 0 ? {} : { detail },
|
|
18
|
+
modelTitle: thread.modelSelection.model,
|
|
19
|
+
updatedAt: thread.updatedAt,
|
|
20
|
+
deepLink: buildAgentAwarenessDeepLink({
|
|
21
|
+
environmentId,
|
|
22
|
+
threadId: thread.id
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function resolveThreadAwarenessPhase(thread) {
|
|
27
|
+
if (thread.hasPendingApprovals) return "waiting_for_approval";
|
|
28
|
+
if (thread.hasPendingUserInput) return "waiting_for_input";
|
|
29
|
+
if (thread.session?.status === "error" || thread.latestTurn?.state === "error") return "failed";
|
|
30
|
+
if (thread.session?.status === "starting") return "starting";
|
|
31
|
+
if (thread.session?.status === "running" || thread.latestTurn?.state === "running") return "running";
|
|
32
|
+
if (thread.latestTurn?.state === "completed") return "completed";
|
|
33
|
+
if (thread.latestTurn?.state === "interrupted" && thread.latestTurn.completedAt !== null) return "completed";
|
|
34
|
+
if (thread.session?.status === "ready" || thread.session?.status === "idle") return "completed";
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function headlineForPhase(phase) {
|
|
38
|
+
switch (phase) {
|
|
39
|
+
case "starting": return "Starting agent";
|
|
40
|
+
case "running": return "Agent is working";
|
|
41
|
+
case "waiting_for_approval": return "Approval needed";
|
|
42
|
+
case "waiting_for_input": return "Waiting for input";
|
|
43
|
+
case "completed": return "Agent finished";
|
|
44
|
+
case "failed": return "Agent failed";
|
|
45
|
+
case "stale": return "Update delayed";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function detailForPhase(phase, thread) {
|
|
49
|
+
if (phase === "failed") return thread.session?.lastError ?? void 0;
|
|
50
|
+
if (phase === "completed") return "Review the completed task.";
|
|
51
|
+
if (phase === "running" && thread.session?.providerName) return `${thread.session.providerName} is active.`;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { buildAgentAwarenessDeepLink, projectThreadAwareness };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Sg as BackgroundActivitySettings, bg as BackgroundActivityProfile, i_ as ServerSettings } from "../shared.js";
|
|
2
|
+
import * as Duration from "effect/Duration";
|
|
3
|
+
//#region upstream-t3code/packages/shared/src/backgroundActivitySettings.d.ts
|
|
4
|
+
interface ResolvedBackgroundActivitySettings {
|
|
5
|
+
readonly profile: BackgroundActivityProfile;
|
|
6
|
+
readonly automaticGitFetchInterval: Duration.Duration;
|
|
7
|
+
readonly providerHealthRefreshInterval: Duration.Duration;
|
|
8
|
+
readonly hostPowerMonitorActiveInterval: Duration.Duration;
|
|
9
|
+
readonly hostPowerMonitorIdleInterval: Duration.Duration;
|
|
10
|
+
readonly idleClientTtl: Duration.Duration;
|
|
11
|
+
readonly pauseWhenHostLocked: boolean;
|
|
12
|
+
readonly pauseWhenHostLowPower: boolean;
|
|
13
|
+
readonly pauseWhenClientLowPower: boolean;
|
|
14
|
+
readonly pauseWhenOnBattery: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function getBackgroundActivityPresetSettings(profile: BackgroundActivityProfile): ResolvedBackgroundActivitySettings;
|
|
17
|
+
declare function getBackgroundActivityBaseProfile(backgroundActivity: BackgroundActivitySettings): BackgroundActivityProfile;
|
|
18
|
+
declare function resolveBackgroundActivitySettings(backgroundActivity: BackgroundActivitySettings): ResolvedBackgroundActivitySettings;
|
|
19
|
+
declare function normalizeBackgroundActivitySettings(backgroundActivity: BackgroundActivitySettings): BackgroundActivitySettings;
|
|
20
|
+
declare function resolveServerBackgroundActivitySettings(settings: ServerSettings): ResolvedBackgroundActivitySettings;
|
|
21
|
+
declare function normalizeServerBackgroundActivitySettings(settings: ServerSettings): BackgroundActivitySettings;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ResolvedBackgroundActivitySettings, getBackgroundActivityBaseProfile, getBackgroundActivityPresetSettings, normalizeBackgroundActivitySettings, normalizeServerBackgroundActivitySettings, resolveBackgroundActivitySettings, resolveServerBackgroundActivitySettings };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as getBackgroundActivityPresetSettings, c as resolveBackgroundActivitySettings, i as getBackgroundActivityBaseProfile, l as resolveServerBackgroundActivitySettings, o as normalizeBackgroundActivitySettings, s as normalizeServerBackgroundActivitySettings } from "../shared.js";
|
|
2
|
+
export { getBackgroundActivityBaseProfile, getBackgroundActivityPresetSettings, normalizeBackgroundActivitySettings, normalizeServerBackgroundActivitySettings, resolveBackgroundActivitySettings, resolveServerBackgroundActivitySettings };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/chatList.d.ts
|
|
2
|
+
declare const CHAT_LIST_ANCHOR_OFFSET = 16;
|
|
3
|
+
interface ChatListAnchoredEndSpace {
|
|
4
|
+
readonly anchorIndex: number;
|
|
5
|
+
readonly anchorOffset: number;
|
|
6
|
+
}
|
|
7
|
+
interface ChatListAnchorOptions {
|
|
8
|
+
readonly anchorOffset?: number;
|
|
9
|
+
}
|
|
10
|
+
declare function resolveChatListAnchoredEndSpace<Item, AnchorId>(items: ReadonlyArray<Item>, anchorId: AnchorId | null, getAnchorId: (item: Item) => AnchorId | null, options?: ChatListAnchorOptions): ChatListAnchoredEndSpace | undefined;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { CHAT_LIST_ANCHOR_OFFSET, ChatListAnchorOptions, ChatListAnchoredEndSpace, resolveChatListAnchoredEndSpace };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/chatList.ts
|
|
2
|
+
const CHAT_LIST_ANCHOR_OFFSET = 16;
|
|
3
|
+
function resolveChatListAnchoredEndSpace(items, anchorId, getAnchorId, options = {}) {
|
|
4
|
+
if (anchorId === null) return;
|
|
5
|
+
for (let index = items.length - 1; index >= 0; index -= 1) {
|
|
6
|
+
const item = items[index];
|
|
7
|
+
if (item !== void 0 && getAnchorId(item) === anchorId) return {
|
|
8
|
+
anchorIndex: index,
|
|
9
|
+
anchorOffset: options.anchorOffset ?? 16
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CHAT_LIST_ANCHOR_OFFSET, resolveChatListAnchoredEndSpace };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/cliArgs.d.ts
|
|
2
|
+
interface ParsedCliArgs {
|
|
3
|
+
readonly flags: Record<string, string | null>;
|
|
4
|
+
readonly positionals: string[];
|
|
5
|
+
}
|
|
6
|
+
interface ParseCliArgsOptions {
|
|
7
|
+
readonly booleanFlags?: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
declare function tokenizeCliArgs(args?: string): ReadonlyArray<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Parse CLI-style arguments into flags and positionals.
|
|
12
|
+
*
|
|
13
|
+
* Accepts a string (quote-aware tokenized) or a pre-split argv array.
|
|
14
|
+
* Supports `--key value`, `--key=value`, and `--flag` (boolean) syntax.
|
|
15
|
+
*
|
|
16
|
+
* parseCliArgs("")
|
|
17
|
+
* → { flags: {}, positionals: [] }
|
|
18
|
+
*
|
|
19
|
+
* parseCliArgs("--chrome")
|
|
20
|
+
* → { flags: { chrome: null }, positionals: [] }
|
|
21
|
+
*
|
|
22
|
+
* parseCliArgs("--chrome --effort high")
|
|
23
|
+
* → { flags: { chrome: null, effort: "high" }, positionals: [] }
|
|
24
|
+
*
|
|
25
|
+
* parseCliArgs("--effort=high")
|
|
26
|
+
* → { flags: { effort: "high" }, positionals: [] }
|
|
27
|
+
*
|
|
28
|
+
* parseCliArgs(["1.2.3", "--root", "/path", "--github-output"], { booleanFlags: ["github-output"] })
|
|
29
|
+
* → { flags: { root: "/path", "github-output": null }, positionals: ["1.2.3"] }
|
|
30
|
+
*/
|
|
31
|
+
declare function parseCliArgs(args: string | readonly string[], options?: ParseCliArgsOptions): ParsedCliArgs;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ParseCliArgsOptions, ParsedCliArgs, parseCliArgs, tokenizeCliArgs };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region upstream-t3code/packages/shared/src/cliArgs.ts
|
|
2
|
+
function tokenizeCliArgs(args) {
|
|
3
|
+
const input = args?.trim();
|
|
4
|
+
if (!input) return [];
|
|
5
|
+
const tokens = [];
|
|
6
|
+
let current = "";
|
|
7
|
+
let quote;
|
|
8
|
+
let quoted = false;
|
|
9
|
+
for (let index = 0; index < input.length; index++) {
|
|
10
|
+
const char = input[index];
|
|
11
|
+
if (char === void 0) continue;
|
|
12
|
+
if (quote) {
|
|
13
|
+
if (char === quote) {
|
|
14
|
+
quote = void 0;
|
|
15
|
+
quoted = true;
|
|
16
|
+
} else if (char === "\\" && quote === "\"") {
|
|
17
|
+
const next = input[index + 1];
|
|
18
|
+
if (next !== void 0 && [
|
|
19
|
+
"\"",
|
|
20
|
+
"\\",
|
|
21
|
+
"$",
|
|
22
|
+
"`"
|
|
23
|
+
].includes(next)) {
|
|
24
|
+
current += next;
|
|
25
|
+
index++;
|
|
26
|
+
} else current += char;
|
|
27
|
+
} else current += char;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (char === "'" || char === "\"") {
|
|
31
|
+
quote = char;
|
|
32
|
+
quoted = true;
|
|
33
|
+
} else if (/\s/.test(char)) {
|
|
34
|
+
if (current || quoted) {
|
|
35
|
+
tokens.push(current);
|
|
36
|
+
current = "";
|
|
37
|
+
quoted = false;
|
|
38
|
+
}
|
|
39
|
+
} else if (char === "\\") {
|
|
40
|
+
const next = input[index + 1];
|
|
41
|
+
if (next !== void 0 && /\s/.test(next)) {
|
|
42
|
+
current += next;
|
|
43
|
+
index++;
|
|
44
|
+
} else current += char;
|
|
45
|
+
} else current += char;
|
|
46
|
+
}
|
|
47
|
+
if (current || quoted) tokens.push(current);
|
|
48
|
+
return tokens;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Parse CLI-style arguments into flags and positionals.
|
|
52
|
+
*
|
|
53
|
+
* Accepts a string (quote-aware tokenized) or a pre-split argv array.
|
|
54
|
+
* Supports `--key value`, `--key=value`, and `--flag` (boolean) syntax.
|
|
55
|
+
*
|
|
56
|
+
* parseCliArgs("")
|
|
57
|
+
* → { flags: {}, positionals: [] }
|
|
58
|
+
*
|
|
59
|
+
* parseCliArgs("--chrome")
|
|
60
|
+
* → { flags: { chrome: null }, positionals: [] }
|
|
61
|
+
*
|
|
62
|
+
* parseCliArgs("--chrome --effort high")
|
|
63
|
+
* → { flags: { chrome: null, effort: "high" }, positionals: [] }
|
|
64
|
+
*
|
|
65
|
+
* parseCliArgs("--effort=high")
|
|
66
|
+
* → { flags: { effort: "high" }, positionals: [] }
|
|
67
|
+
*
|
|
68
|
+
* parseCliArgs(["1.2.3", "--root", "/path", "--github-output"], { booleanFlags: ["github-output"] })
|
|
69
|
+
* → { flags: { root: "/path", "github-output": null }, positionals: ["1.2.3"] }
|
|
70
|
+
*/
|
|
71
|
+
function parseCliArgs(args, options) {
|
|
72
|
+
const tokens = typeof args === "string" ? tokenizeCliArgs(args) : Array.from(args);
|
|
73
|
+
const booleanSet = options?.booleanFlags ? new Set(options.booleanFlags) : void 0;
|
|
74
|
+
const flags = {};
|
|
75
|
+
const positionals = [];
|
|
76
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
77
|
+
const token = tokens[i];
|
|
78
|
+
if (token.startsWith("--")) {
|
|
79
|
+
const rest = token.slice(2);
|
|
80
|
+
if (!rest) continue;
|
|
81
|
+
const eqIndex = rest.indexOf("=");
|
|
82
|
+
if (eqIndex !== -1) {
|
|
83
|
+
flags[rest.slice(0, eqIndex)] = rest.slice(eqIndex + 1);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (booleanSet?.has(rest)) {
|
|
87
|
+
flags[rest] = null;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const next = tokens[i + 1];
|
|
91
|
+
if (next !== void 0 && !next.startsWith("--")) {
|
|
92
|
+
flags[rest] = next;
|
|
93
|
+
i++;
|
|
94
|
+
} else flags[rest] = null;
|
|
95
|
+
} else positionals.push(token);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
flags,
|
|
99
|
+
positionals
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { parseCliArgs, tokenizeCliArgs };
|