t3code-cli 0.12.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 +392 -630
- 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/rolldown-runtime.js +1 -1
- 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 +36722 -13117
- package/dist/t3tools.d.ts +2 -0
- package/dist/t3tools.js +2 -2
- package/package.json +46 -27
- package/src/application/thread-wait.ts +4 -0
- package/src/auth/error.ts +2 -8
- package/src/auth/index.ts +2 -0
- package/src/auth/pairing.ts +8 -5
- package/src/auth/remote-error.ts +17 -0
- package/src/auth/service.ts +2 -1
- package/src/auth/transport.ts +49 -114
- package/src/auth/type.ts +6 -0
- package/src/cli/auth.ts +7 -1
- package/src/connection/error.ts +4 -1
- package/src/connection/layer.ts +5 -2
- package/src/connection/prepared.ts +83 -0
- package/src/contracts/index.ts +8 -0
- package/src/orchestration/layer.ts +38 -1
- 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 +11 -16
- package/src/rpc/index.ts +3 -2
- package/src/rpc/layer.ts +18 -51
- package/src/rpc/operation.ts +21 -6
- package/src/rpc/service.ts +2 -1
- package/src/rpc/session.ts +168 -0
- package/src/rpc/ws-group.ts +18 -26
- package/src/runtime/index.ts +1 -0
- package/src/runtime/layer.ts +11 -3
- 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 -101
- 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 -111
- package/dist/src/application/threads.d.ts +0 -685
- package/dist/src/auth/error.d.ts +0 -51
- 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/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 -8
- package/dist/src/connection/index.d.ts +0 -4
- package/dist/src/connection/layer.d.ts +0 -3
- 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 -184
- package/dist/src/domain/model-config.d.ts +0 -325
- package/dist/src/domain/thread-activities.d.ts +0 -14
- package/dist/src/domain/thread-lifecycle.d.ts +0 -125
- 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 -1634
- package/dist/src/orchestration/service.d.ts +0 -28
- package/dist/src/rpc/error.d.ts +0 -18
- package/dist/src/rpc/index.d.ts +0 -5
- package/dist/src/rpc/layer.d.ts +0 -6271
- package/dist/src/rpc/operation.d.ts +0 -6280
- package/dist/src/rpc/service.d.ts +0 -15
- package/dist/src/rpc/ws-group.d.ts +0 -2725
- 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/src/rpc/layer.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import type { ConnectionAttemptError } from "@t3tools/client-runtime/connection";
|
|
1
2
|
import * as Context from "effect/Context";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
4
|
import * as Exit from "effect/Exit";
|
|
4
5
|
import * as Layer from "effect/Layer";
|
|
5
6
|
import * as Option from "effect/Option";
|
|
7
|
+
import * as Predicate from "effect/Predicate";
|
|
6
8
|
import * as Schedule from "effect/Schedule";
|
|
7
9
|
import * as Scope from "effect/Scope";
|
|
8
10
|
import * as SynchronizedRef from "effect/SynchronizedRef";
|
|
9
|
-
import { HttpClientRequest } from "effect/unstable/http";
|
|
10
|
-
import { RpcClient, RpcSerialization } from "effect/unstable/rpc";
|
|
11
|
-
import * as Socket from "effect/unstable/socket/Socket";
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { normalizeHttpBaseUrl, toWebSocketEndpointUrl } from "../config/url/url.ts";
|
|
16
|
-
import { CliWsRpcGroup } from "./ws-group.ts";
|
|
12
|
+
import { T3CodeConnectionError } from "../connection/error.ts";
|
|
13
|
+
import { T3PreparedConnectionProvider } from "../connection/prepared.ts";
|
|
17
14
|
import { RpcError } from "./error.ts";
|
|
15
|
+
import { T3RpcSessionFactory } from "./session.ts";
|
|
18
16
|
import { T3Rpc, type WsClient } from "./service.ts";
|
|
19
17
|
|
|
20
|
-
const
|
|
21
|
-
|
|
18
|
+
const connectionRetrySchedule = Schedule.exponential("100 millis").pipe(
|
|
19
|
+
Schedule.setInputType<ConnectionAttemptError | T3CodeConnectionError>(),
|
|
20
|
+
Schedule.upTo({ times: 4 }),
|
|
21
|
+
Schedule.while((metadata) => Predicate.isTagged(metadata.input, "ConnectionTransientError")),
|
|
22
|
+
);
|
|
22
23
|
|
|
23
24
|
type Connection = {
|
|
24
25
|
readonly scope: Scope.Closeable;
|
|
@@ -26,23 +27,19 @@ type Connection = {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export const makeT3RpcLayer = Effect.fn("makeT3RpcLayer")(function* () {
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const webSocketConstructor = yield* Socket.WebSocketConstructor;
|
|
30
|
+
const preparedConnectionProvider = yield* T3PreparedConnectionProvider;
|
|
31
|
+
const sessions = yield* T3RpcSessionFactory;
|
|
32
32
|
const parentScope = yield* Scope.Scope;
|
|
33
33
|
const connection = yield* SynchronizedRef.make(Option.none<Connection>());
|
|
34
34
|
const openConnection = Effect.fn("T3RpcLive.openConnection")(function* () {
|
|
35
35
|
const scope = yield* Scope.fork(parentScope);
|
|
36
36
|
return yield* Effect.gen(function* () {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
scope
|
|
41
|
-
|
|
42
|
-
const client =
|
|
43
|
-
Effect.provide(protocol),
|
|
44
|
-
Effect.provideService(Scope.Scope, scope),
|
|
45
|
-
);
|
|
37
|
+
const prepared = yield* preparedConnectionProvider.get;
|
|
38
|
+
const session = yield* sessions
|
|
39
|
+
.connect(prepared)
|
|
40
|
+
.pipe(Effect.provideService(Scope.Scope, scope));
|
|
41
|
+
yield* session.ready;
|
|
42
|
+
const client: WsClient = session.client;
|
|
46
43
|
return { scope, client } satisfies Connection;
|
|
47
44
|
}).pipe(
|
|
48
45
|
Effect.retry(connectionRetrySchedule),
|
|
@@ -74,36 +71,6 @@ export const makeT3RpcLayer = Effect.fn("makeT3RpcLayer")(function* () {
|
|
|
74
71
|
};
|
|
75
72
|
});
|
|
76
73
|
|
|
77
|
-
const makeWsUrl = Effect.fn("makeWsUrl")(function* (input: {
|
|
78
|
-
readonly authTransport: T3AuthTransport["Service"];
|
|
79
|
-
readonly connectionProvider: T3CodeConnectionProvider["Service"];
|
|
80
|
-
}) {
|
|
81
|
-
const connection = yield* input.connectionProvider.get;
|
|
82
|
-
const origin = yield* normalizeHttpBaseUrl(connection.origin.url);
|
|
83
|
-
const wsTicket = yield* input.authTransport.issueWebSocketTicket({
|
|
84
|
-
url: origin,
|
|
85
|
-
token: connection.auth.token,
|
|
86
|
-
});
|
|
87
|
-
const wsUrl = yield* toWebSocketEndpointUrl(origin, "/ws");
|
|
88
|
-
const request = HttpClientRequest.get(wsUrl).pipe(
|
|
89
|
-
HttpClientRequest.setUrlParam("wsTicket", wsTicket.ticket),
|
|
90
|
-
);
|
|
91
|
-
return Option.getOrThrow(HttpClientRequest.toUrl(request)).toString();
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
function makeProtocolLayer(
|
|
95
|
-
url: string,
|
|
96
|
-
webSocketConstructor: Socket.WebSocketConstructor["Service"],
|
|
97
|
-
) {
|
|
98
|
-
const socketLayer = Socket.layerWebSocket(url).pipe(
|
|
99
|
-
Layer.provide(Layer.succeed(Socket.WebSocketConstructor, webSocketConstructor)),
|
|
100
|
-
);
|
|
101
|
-
return RpcClient.layerProtocolSocket({ retryTransientErrors: true }).pipe(
|
|
102
|
-
Layer.provide(socketLayer),
|
|
103
|
-
Layer.provide(RpcSerialization.layerJson),
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
74
|
export const T3RpcLive = Layer.effectContext(
|
|
108
75
|
makeT3RpcLayer().pipe(Effect.map((rpc) => Context.make(T3Rpc, rpc))),
|
|
109
76
|
);
|
package/src/rpc/operation.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EnvironmentAuthorizationError,
|
|
3
|
+
KeybindingsConfigError,
|
|
4
|
+
OrchestrationDispatchCommandError,
|
|
5
|
+
OrchestrationGetSnapshotError,
|
|
6
|
+
PreviewAutomationError,
|
|
7
|
+
ServerSettingsError,
|
|
8
|
+
TerminalError,
|
|
9
|
+
} from "@t3tools/contracts";
|
|
1
10
|
import * as Context from "effect/Context";
|
|
2
11
|
import * as Effect from "effect/Effect";
|
|
3
12
|
import * as Layer from "effect/Layer";
|
|
@@ -8,15 +17,21 @@ import { RpcClientError } from "effect/unstable/rpc";
|
|
|
8
17
|
|
|
9
18
|
import { RpcError } from "./error.ts";
|
|
10
19
|
import { T3Rpc, type WsClient } from "./service.ts";
|
|
11
|
-
import type { CliRpcRequestError } from "./ws-group.ts";
|
|
12
20
|
|
|
13
|
-
export type CliRpcOperationError =
|
|
21
|
+
export type CliRpcOperationError =
|
|
22
|
+
| EnvironmentAuthorizationError
|
|
23
|
+
| KeybindingsConfigError
|
|
24
|
+
| OrchestrationDispatchCommandError
|
|
25
|
+
| OrchestrationGetSnapshotError
|
|
26
|
+
| PreviewAutomationError
|
|
27
|
+
| RpcClientError.RpcClientError
|
|
28
|
+
| ServerSettingsError
|
|
29
|
+
| TerminalError;
|
|
14
30
|
|
|
15
31
|
export const rpcRetrySchedule = Schedule.exponential("100 millis").pipe(
|
|
16
|
-
Schedule.
|
|
17
|
-
Schedule.
|
|
18
|
-
|
|
19
|
-
),
|
|
32
|
+
Schedule.setInputType<CliRpcOperationError | RpcError>(),
|
|
33
|
+
Schedule.upTo({ times: 4 }),
|
|
34
|
+
Schedule.while((metadata) => Predicate.isTagged(metadata.input, "RpcClientError")),
|
|
20
35
|
);
|
|
21
36
|
|
|
22
37
|
export type T3RpcOperationsService = {
|
package/src/rpc/service.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
import type * as Effect from "effect/Effect";
|
|
3
3
|
import type { RpcClient, RpcClientError } from "effect/unstable/rpc";
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import type { RpcError } from "./error.ts";
|
|
6
|
+
import type { CliWsRpcGroup } from "./ws-group.ts";
|
|
6
7
|
|
|
7
8
|
export type WsClient = RpcClient.FromGroup<typeof CliWsRpcGroup, RpcClientError.RpcClientError>;
|
|
8
9
|
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectionBlockedError,
|
|
3
|
+
type ConnectionAttemptError,
|
|
4
|
+
ConnectionTransientError,
|
|
5
|
+
type PreparedConnection,
|
|
6
|
+
} from "@t3tools/client-runtime/connection";
|
|
7
|
+
import { WS_METHODS } from "@t3tools/contracts";
|
|
8
|
+
import * as Context from "effect/Context";
|
|
9
|
+
import * as Deferred from "effect/Deferred";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Layer from "effect/Layer";
|
|
12
|
+
import * as Schedule from "effect/Schedule";
|
|
13
|
+
import type * as Scope from "effect/Scope";
|
|
14
|
+
import * as RpcClient from "effect/unstable/rpc/RpcClient";
|
|
15
|
+
import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
|
|
16
|
+
import * as Socket from "effect/unstable/socket/Socket";
|
|
17
|
+
|
|
18
|
+
import type { WsClient as CliWsClient } from "./service.ts";
|
|
19
|
+
import type { CliServerConfig } from "./ws-group.ts";
|
|
20
|
+
import { CliWsRpcGroup } from "./ws-group.ts";
|
|
21
|
+
|
|
22
|
+
interface T3RpcSession {
|
|
23
|
+
readonly client: CliWsClient;
|
|
24
|
+
readonly initialConfig: Effect.Effect<CliServerConfig, ConnectionAttemptError>;
|
|
25
|
+
readonly ready: Effect.Effect<void, ConnectionAttemptError>;
|
|
26
|
+
readonly probe: Effect.Effect<void, ConnectionAttemptError>;
|
|
27
|
+
readonly closed: Effect.Effect<never, ConnectionTransientError>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class T3RpcSessionFactory extends Context.Service<
|
|
31
|
+
T3RpcSessionFactory,
|
|
32
|
+
{
|
|
33
|
+
readonly connect: (
|
|
34
|
+
connection: PreparedConnection,
|
|
35
|
+
) => Effect.Effect<T3RpcSession, ConnectionAttemptError, Scope.Scope>;
|
|
36
|
+
}
|
|
37
|
+
>()("t3cli/T3RpcSessionFactory") {}
|
|
38
|
+
|
|
39
|
+
type SessionRpcError =
|
|
40
|
+
| Effect.Error<ReturnType<CliWsClient[typeof WS_METHODS.serverGetConfig]>>
|
|
41
|
+
| Effect.Error<ReturnType<CliWsClient[typeof WS_METHODS.serverProbe]>>;
|
|
42
|
+
|
|
43
|
+
const makeClient = RpcClient.make(CliWsRpcGroup);
|
|
44
|
+
|
|
45
|
+
const makeT3RpcSessionFactory = Effect.fn("makeT3RpcSessionFactory")(function* () {
|
|
46
|
+
const webSocketConstructor = yield* Socket.WebSocketConstructor;
|
|
47
|
+
|
|
48
|
+
const connect: T3RpcSessionFactory["Service"]["connect"] = Effect.fnUntraced(function* (
|
|
49
|
+
connection: PreparedConnection,
|
|
50
|
+
) {
|
|
51
|
+
yield* Effect.annotateCurrentSpan({
|
|
52
|
+
"connection.environment.id": connection.environmentId,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const connected = yield* Deferred.make<void>();
|
|
56
|
+
const disconnected = yield* Deferred.make<never, ConnectionTransientError>();
|
|
57
|
+
const hooks = RpcClient.ConnectionHooks.of({
|
|
58
|
+
onConnect: Deferred.succeed(connected, undefined).pipe(Effect.asVoid),
|
|
59
|
+
onDisconnect: Deferred.isDone(connected).pipe(
|
|
60
|
+
Effect.flatMap((wasConnected) =>
|
|
61
|
+
Deferred.fail(
|
|
62
|
+
disconnected,
|
|
63
|
+
new ConnectionTransientError({
|
|
64
|
+
reason: "transport",
|
|
65
|
+
detail: wasConnected
|
|
66
|
+
? `${connection.label} disconnected.`
|
|
67
|
+
: `${connection.label} could not establish a WebSocket connection.`,
|
|
68
|
+
}),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
Effect.asVoid,
|
|
72
|
+
),
|
|
73
|
+
});
|
|
74
|
+
const socketLayer = Socket.layerWebSocket(connection.socketUrl, {
|
|
75
|
+
openTimeout: "15 seconds",
|
|
76
|
+
}).pipe(Layer.provide(Layer.succeed(Socket.WebSocketConstructor, webSocketConstructor)));
|
|
77
|
+
const protocolLayer = Layer.effect(
|
|
78
|
+
RpcClient.Protocol,
|
|
79
|
+
RpcClient.makeProtocolSocket({
|
|
80
|
+
retryTransientErrors: false,
|
|
81
|
+
retryPolicy: Schedule.recurs(0),
|
|
82
|
+
}),
|
|
83
|
+
).pipe(
|
|
84
|
+
Layer.provide(
|
|
85
|
+
Layer.mergeAll(
|
|
86
|
+
socketLayer,
|
|
87
|
+
RpcSerialization.layerJson,
|
|
88
|
+
Layer.succeed(RpcClient.ConnectionHooks, hooks),
|
|
89
|
+
),
|
|
90
|
+
),
|
|
91
|
+
);
|
|
92
|
+
const protocolContext = yield* Layer.build(protocolLayer).pipe(
|
|
93
|
+
Effect.withSpan("environment.websocket.connect"),
|
|
94
|
+
);
|
|
95
|
+
const client = yield* makeClient.pipe(Effect.provide(protocolContext));
|
|
96
|
+
const initialConfig = yield* Effect.cached(
|
|
97
|
+
client[WS_METHODS.serverGetConfig]({}).pipe(
|
|
98
|
+
catchSessionRpcErrors,
|
|
99
|
+
Effect.withSpan("environment.initialSync"),
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
const probe = initialConfig.pipe(
|
|
103
|
+
Effect.flatMap((config) =>
|
|
104
|
+
Effect.gen(function* () {
|
|
105
|
+
if (config.environment.capabilities.connectionProbe) {
|
|
106
|
+
return yield* client[WS_METHODS.serverProbe]({});
|
|
107
|
+
}
|
|
108
|
+
return yield* client[WS_METHODS.serverGetConfig]({});
|
|
109
|
+
}).pipe(catchSessionRpcErrors),
|
|
110
|
+
),
|
|
111
|
+
Effect.asVoid,
|
|
112
|
+
Effect.withSpan("clientRuntime.connection.rpcSession.probe"),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
client,
|
|
117
|
+
initialConfig,
|
|
118
|
+
ready: Deferred.await(connected).pipe(
|
|
119
|
+
Effect.andThen(initialConfig),
|
|
120
|
+
Effect.asVoid,
|
|
121
|
+
Effect.raceFirst(Deferred.await(disconnected)),
|
|
122
|
+
),
|
|
123
|
+
probe,
|
|
124
|
+
closed: Deferred.await(disconnected),
|
|
125
|
+
} satisfies T3RpcSession;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return T3RpcSessionFactory.of({ connect });
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const T3RpcSessionFactoryLive = Layer.effect(T3RpcSessionFactory, makeT3RpcSessionFactory());
|
|
132
|
+
|
|
133
|
+
function catchSessionRpcErrors<A, R>(
|
|
134
|
+
effect: Effect.Effect<A, SessionRpcError, R>,
|
|
135
|
+
): Effect.Effect<A, ConnectionAttemptError, R> {
|
|
136
|
+
return effect.pipe(
|
|
137
|
+
Effect.catchTags({
|
|
138
|
+
EnvironmentAuthorizationError: (error) =>
|
|
139
|
+
Effect.fail(
|
|
140
|
+
new ConnectionBlockedError({
|
|
141
|
+
reason: "permission",
|
|
142
|
+
detail: error.message,
|
|
143
|
+
}),
|
|
144
|
+
),
|
|
145
|
+
KeybindingsConfigParseError: (error) =>
|
|
146
|
+
Effect.fail(
|
|
147
|
+
new ConnectionTransientError({
|
|
148
|
+
reason: "remote-unavailable",
|
|
149
|
+
detail: error.message,
|
|
150
|
+
}),
|
|
151
|
+
),
|
|
152
|
+
ServerSettingsError: (error) =>
|
|
153
|
+
Effect.fail(
|
|
154
|
+
new ConnectionTransientError({
|
|
155
|
+
reason: "remote-unavailable",
|
|
156
|
+
detail: error.message,
|
|
157
|
+
}),
|
|
158
|
+
),
|
|
159
|
+
RpcClientError: (error) =>
|
|
160
|
+
Effect.fail(
|
|
161
|
+
new ConnectionTransientError({
|
|
162
|
+
reason: "transport",
|
|
163
|
+
detail: error.message,
|
|
164
|
+
}),
|
|
165
|
+
),
|
|
166
|
+
}),
|
|
167
|
+
);
|
|
168
|
+
}
|
package/src/rpc/ws-group.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EnvironmentAuthorizationError,
|
|
3
3
|
KeybindingsConfigError,
|
|
4
|
-
OrchestrationDispatchCommandError,
|
|
5
|
-
OrchestrationGetSnapshotError,
|
|
6
|
-
ServerConfig,
|
|
7
4
|
ServerProviders,
|
|
8
5
|
ServerSettingsError,
|
|
9
|
-
TerminalCwdError,
|
|
10
|
-
TerminalHistoryError,
|
|
11
|
-
TerminalNotRunningError,
|
|
12
|
-
TerminalSessionLookupError,
|
|
13
6
|
WS_METHODS,
|
|
7
|
+
WsOrchestrationDispatchCommandRpc,
|
|
8
|
+
WsOrchestrationGetArchivedShellSnapshotRpc,
|
|
9
|
+
WsOrchestrationSubscribeShellRpc,
|
|
10
|
+
WsOrchestrationSubscribeThreadRpc,
|
|
11
|
+
WsPreviewAutomationConnectRpc,
|
|
12
|
+
WsPreviewAutomationFocusHostRpc,
|
|
13
|
+
WsPreviewAutomationRespondRpc,
|
|
14
|
+
WsServerProbeRpc,
|
|
14
15
|
WsSubscribeTerminalEventsRpc,
|
|
15
16
|
WsSubscribeTerminalMetadataRpc,
|
|
16
17
|
WsTerminalAttachRpc,
|
|
@@ -18,20 +19,18 @@ import {
|
|
|
18
19
|
WsTerminalOpenRpc,
|
|
19
20
|
WsTerminalResizeRpc,
|
|
20
21
|
WsTerminalWriteRpc,
|
|
21
|
-
WsOrchestrationDispatchCommandRpc,
|
|
22
|
-
WsOrchestrationGetArchivedShellSnapshotRpc,
|
|
23
|
-
WsOrchestrationSubscribeShellRpc,
|
|
24
|
-
WsOrchestrationSubscribeThreadRpc,
|
|
25
22
|
} from "@t3tools/contracts";
|
|
26
23
|
import * as Schema from "effect/Schema";
|
|
27
24
|
import { Rpc, RpcGroup } from "effect/unstable/rpc";
|
|
28
25
|
|
|
29
|
-
export const
|
|
26
|
+
export const CliServerConfig = Schema.Struct({
|
|
27
|
+
environment: Schema.Struct({
|
|
28
|
+
capabilities: Schema.Struct({
|
|
29
|
+
connectionProbe: Schema.Boolean,
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
30
32
|
providers: ServerProviders,
|
|
31
33
|
});
|
|
32
|
-
export type FallbackServerConfig = typeof FallbackServerConfig.Type;
|
|
33
|
-
|
|
34
|
-
export const CliServerConfig = Schema.Union([ServerConfig, FallbackServerConfig]);
|
|
35
34
|
export type CliServerConfig = typeof CliServerConfig.Type;
|
|
36
35
|
|
|
37
36
|
export const WsServerGetConfigRpc = Rpc.make(WS_METHODS.serverGetConfig, {
|
|
@@ -52,16 +51,9 @@ export const CliWsRpcGroup = RpcGroup.make(
|
|
|
52
51
|
WsOrchestrationGetArchivedShellSnapshotRpc,
|
|
53
52
|
WsOrchestrationSubscribeShellRpc,
|
|
54
53
|
WsOrchestrationSubscribeThreadRpc,
|
|
54
|
+
WsPreviewAutomationConnectRpc,
|
|
55
|
+
WsPreviewAutomationRespondRpc,
|
|
56
|
+
WsPreviewAutomationFocusHostRpc,
|
|
57
|
+
WsServerProbeRpc,
|
|
55
58
|
WsServerGetConfigRpc,
|
|
56
59
|
);
|
|
57
|
-
|
|
58
|
-
export type CliRpcRequestError =
|
|
59
|
-
| EnvironmentAuthorizationError
|
|
60
|
-
| KeybindingsConfigError
|
|
61
|
-
| OrchestrationDispatchCommandError
|
|
62
|
-
| OrchestrationGetSnapshotError
|
|
63
|
-
| TerminalCwdError
|
|
64
|
-
| TerminalHistoryError
|
|
65
|
-
| TerminalNotRunningError
|
|
66
|
-
| TerminalSessionLookupError
|
|
67
|
-
| ServerSettingsError;
|
package/src/runtime/index.ts
CHANGED
package/src/runtime/layer.ts
CHANGED
|
@@ -14,10 +14,13 @@ import * as Config from "../config/config.ts";
|
|
|
14
14
|
import * as Credential from "../config/credential/service.ts";
|
|
15
15
|
import * as Selection from "../config/selection/service.ts";
|
|
16
16
|
import { T3CodeConnectionError } from "../connection/error.ts";
|
|
17
|
+
import { T3PreparedConnectionProviderLive } from "../connection/prepared.ts";
|
|
17
18
|
import { T3CodeConnectionProvider, makeT3CodeConnectionProvider } from "../connection/service.ts";
|
|
18
19
|
import { T3OrchestrationLive } from "../orchestration/layer.ts";
|
|
20
|
+
import { T3PreviewAutomationLive } from "../preview/service.ts";
|
|
19
21
|
import { T3RpcLive } from "../rpc/layer.ts";
|
|
20
22
|
import { T3RpcOperationsLive } from "../rpc/operation.ts";
|
|
23
|
+
import { T3RpcSessionFactoryLive } from "../rpc/session.ts";
|
|
21
24
|
import { NodeSqlClientFactoryLive } from "../sql/node-sqlite-client.ts";
|
|
22
25
|
import { NodeCliPathLayer } from "../cli-path/layer.ts";
|
|
23
26
|
|
|
@@ -63,14 +66,18 @@ const T3ConfigConnectionProviderLayer = Layer.effect(
|
|
|
63
66
|
const T3RpcLayer = T3RpcLive.pipe(
|
|
64
67
|
Layer.provide(
|
|
65
68
|
Layer.mergeAll(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
T3PreparedConnectionProviderLive.pipe(
|
|
70
|
+
Layer.provide(Layer.mergeAll(T3ConfigConnectionProviderLayer, NodeHttpClient.layerUndici)),
|
|
71
|
+
),
|
|
72
|
+
T3RpcSessionFactoryLive.pipe(Layer.provide(NodeSocket.layerWebSocketConstructor)),
|
|
69
73
|
),
|
|
70
74
|
),
|
|
71
75
|
);
|
|
72
76
|
const T3RpcOperationsLayer = T3RpcOperationsLive.pipe(Layer.provide(T3RpcLayer));
|
|
73
77
|
export const T3OrchestrationLayer = T3OrchestrationLive.pipe(Layer.provide(T3RpcOperationsLayer));
|
|
78
|
+
export const T3PreviewAutomationLayer = T3PreviewAutomationLive.pipe(
|
|
79
|
+
Layer.provide(T3RpcOperationsLayer),
|
|
80
|
+
);
|
|
74
81
|
const T3ApplicationLayer = T3ApplicationLive.pipe(
|
|
75
82
|
Layer.provide(Layer.mergeAll(T3RpcOperationsLayer, T3OrchestrationLayer)),
|
|
76
83
|
);
|
|
@@ -81,6 +88,7 @@ export const BaseAppLayer = Layer.mergeAll(
|
|
|
81
88
|
T3RpcLayer,
|
|
82
89
|
T3RpcOperationsLayer,
|
|
83
90
|
T3OrchestrationLayer,
|
|
91
|
+
T3PreviewAutomationLayer,
|
|
84
92
|
T3ApplicationLayer,
|
|
85
93
|
NodeCliPathLayer,
|
|
86
94
|
);
|
|
@@ -91,6 +91,9 @@ export const makeNodeSqliteClient = Effect.fn("makeNodeSqliteClient")(function*
|
|
|
91
91
|
executeValues(sql, params) {
|
|
92
92
|
return runValues(sql, params);
|
|
93
93
|
},
|
|
94
|
+
executeValuesUnprepared(sql, params) {
|
|
95
|
+
return runValues(sql, params);
|
|
96
|
+
},
|
|
94
97
|
executeUnprepared(sql, params, rowTransform) {
|
|
95
98
|
const effect = runRows(sql, params);
|
|
96
99
|
return rowTransform === undefined ? effect : Effect.map(effect, rowTransform);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as Crypto from "effect/Crypto";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Path from "effect/Path";
|
|
4
|
-
import { type OrchestrationProjectShell, type ProjectScript } from "@t3tools/contracts";
|
|
5
|
-
import { T3Orchestration } from "../orchestration/service.ts";
|
|
6
|
-
import { T3TerminalApplication, type AddProjectActionInput, type ProjectActionSelector, type UpdateProjectActionInput } from "./service.ts";
|
|
7
|
-
export declare const makeActionApplication: () => Effect.Effect<{
|
|
8
|
-
addAction: (input: AddProjectActionInput) => Effect.Effect<import("./service.ts").ProjectActionMutationResult, import("./error.ts").ApplicationError>;
|
|
9
|
-
deleteAction: (input: {
|
|
10
|
-
readonly projectRef: string;
|
|
11
|
-
readonly selector: ProjectActionSelector;
|
|
12
|
-
}) => Effect.Effect<import("./service.ts").ProjectActionDeleteResult, import("./error.ts").ApplicationError>;
|
|
13
|
-
listActions: (projectRef: string) => Effect.Effect<{
|
|
14
|
-
readonly project: OrchestrationProjectShell;
|
|
15
|
-
readonly actions: ReadonlyArray<ProjectScript>;
|
|
16
|
-
}, import("./error.ts").ApplicationError>;
|
|
17
|
-
runAction: (input: {
|
|
18
|
-
readonly threadId: string;
|
|
19
|
-
readonly selector: ProjectActionSelector;
|
|
20
|
-
readonly terminalId?: string;
|
|
21
|
-
}) => Effect.Effect<import("./service.ts").ProjectActionRunResult, import("./error.ts").ApplicationError>;
|
|
22
|
-
updateAction: (input: UpdateProjectActionInput) => Effect.Effect<import("./service.ts").ProjectActionMutationResult, import("./error.ts").ApplicationError>;
|
|
23
|
-
}, never, T3Orchestration | Path.Path | Crypto.Crypto | T3TerminalApplication>;
|
|
24
|
-
export declare function nextProjectScriptId(name: string, existingIds: Iterable<string>): string;
|
|
25
|
-
export declare function resolveActionBySelector(scripts: ReadonlyArray<ProjectScript>, selector: ProjectActionSelector, projectId: string): ProjectScript;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { T3ActionApplication, T3Application, T3ModelApplication, T3ProjectApplication, T3TerminalApplication, T3ThreadApplication, } from "./service.ts";
|
|
2
|
-
export { makeT3Application, T3ActionApplicationLive, T3ApplicationLive, T3ApplicationSlicesLive, T3ModelApplicationLive, T3ProjectApplicationLive, T3TerminalApplicationLive, T3ThreadApplicationLive, } from "./layer.ts";
|
|
3
|
-
export type { AddProjectActionInput, ProjectActionDeleteResult, ProjectActionMutationResult, ProjectActionRunResult, ProjectActionSelector, SendThreadInput, StartThreadInput, StartThreadPolicy, T3ActionApplicationService, UpdateProjectActionInput, UpdateThreadInput, WaitEvent, } from "./service.ts";
|
|
4
|
-
export type { ApplicationError } from "./error.ts";
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
|
-
import { T3ActionApplication, T3Application, T3ModelApplication, T3ProjectApplication, T3TerminalApplication, T3ThreadApplication } from "./service.ts";
|
|
4
|
-
export declare const makeT3Application: () => Effect.Effect<{
|
|
5
|
-
listThreads: (projectRef: string, options?: {
|
|
6
|
-
readonly include?: import("./service.ts").ListThreadsInclude;
|
|
7
|
-
}) => Effect.Effect<{
|
|
8
|
-
readonly project: import("@t3tools/contracts").OrchestrationProjectShell;
|
|
9
|
-
readonly threads: ReadonlyArray<import("@t3tools/contracts").OrchestrationThreadShell>;
|
|
10
|
-
}, import("./error.ts").ApplicationError>;
|
|
11
|
-
getThreadMessages: (threadId: string) => Effect.Effect<import("@t3tools/contracts").OrchestrationThread, import("./error.ts").ApplicationError>;
|
|
12
|
-
showThread: (threadId: string) => Effect.Effect<import("./threads.ts").ThreadShow, import("./error.ts").ApplicationError>;
|
|
13
|
-
approveThread: (input: {
|
|
14
|
-
readonly threadId: string;
|
|
15
|
-
readonly requestId: string;
|
|
16
|
-
readonly decision: "accept" | "decline" | "cancel";
|
|
17
|
-
}) => Effect.Effect<{
|
|
18
|
-
readonly threadId: string;
|
|
19
|
-
readonly requestId: string;
|
|
20
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
21
|
-
}, import("./error.ts").ApplicationError>;
|
|
22
|
-
respondToThread: (input: {
|
|
23
|
-
readonly threadId: string;
|
|
24
|
-
readonly requestId: string;
|
|
25
|
-
readonly answers: import("@t3tools/contracts").ProviderUserInputAnswers;
|
|
26
|
-
}) => Effect.Effect<{
|
|
27
|
-
readonly threadId: string;
|
|
28
|
-
readonly requestId: string;
|
|
29
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
30
|
-
}, import("./error.ts").ApplicationError>;
|
|
31
|
-
archiveThread: (threadId: string) => Effect.Effect<import("@t3tools/contracts").DispatchResult, import("./error.ts").ApplicationError>;
|
|
32
|
-
interruptThread: (threadId: string) => Effect.Effect<import("@t3tools/contracts").DispatchResult, import("./error.ts").ApplicationError>;
|
|
33
|
-
unarchiveThread: (threadId: string) => Effect.Effect<import("@t3tools/contracts").DispatchResult, import("./error.ts").ApplicationError>;
|
|
34
|
-
deleteThread: (threadId: string) => Effect.Effect<{
|
|
35
|
-
readonly threadId: string;
|
|
36
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
37
|
-
}, import("./error.ts").ApplicationError>;
|
|
38
|
-
updateThread: (input: import("./service.ts").UpdateThreadInput) => Effect.Effect<import("@t3tools/contracts").DispatchResult, import("./error.ts").ApplicationError>;
|
|
39
|
-
startThread: (input: import("./service.ts").StartThreadInput, policy?: import("./service.ts").StartThreadPolicy) => Effect.Effect<{
|
|
40
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
41
|
-
readonly project: import("@t3tools/contracts").OrchestrationProjectShell;
|
|
42
|
-
readonly threadId: string;
|
|
43
|
-
readonly thread?: import("@t3tools/contracts").OrchestrationThread;
|
|
44
|
-
}, import("./error.ts").ApplicationError>;
|
|
45
|
-
sendThread: (input: import("./service.ts").SendThreadInput, policy?: import("./service.ts").StartThreadPolicy) => Effect.Effect<{
|
|
46
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
47
|
-
readonly threadId: string;
|
|
48
|
-
readonly thread?: import("@t3tools/contracts").OrchestrationThread;
|
|
49
|
-
}, import("./error.ts").ApplicationError>;
|
|
50
|
-
watchThread: (threadId: string) => import("effect/Stream").Stream<import("./service.ts").WaitEvent, import("./error.ts").ApplicationError>;
|
|
51
|
-
waitForThread: (threadId: string) => Effect.Effect<import("@t3tools/contracts").OrchestrationThread, import("./error.ts").ApplicationError>;
|
|
52
|
-
callbackThread: (input: import("./service.ts").CallbackThreadInput) => Effect.Effect<{
|
|
53
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
54
|
-
readonly targetThreadId: string;
|
|
55
|
-
}, import("./error.ts").ApplicationError>;
|
|
56
|
-
listTerminals: (threadId: string) => Effect.Effect<ReadonlyArray<import("@t3tools/contracts").TerminalSummary>, import("./error.ts").ApplicationError>;
|
|
57
|
-
getTerminal: (terminal: import("./service.ts").TerminalRef) => Effect.Effect<import("@t3tools/contracts").TerminalSummary, import("./error.ts").ApplicationError>;
|
|
58
|
-
createTerminal: (input: import("./service.ts").CreateTerminalInput) => Effect.Effect<import("@t3tools/contracts").TerminalSessionSnapshot, import("./error.ts").ApplicationError>;
|
|
59
|
-
attachTerminal: (input: {
|
|
60
|
-
readonly terminal: import("./service.ts").TerminalAttachTarget;
|
|
61
|
-
readonly cols?: number;
|
|
62
|
-
readonly rows?: number;
|
|
63
|
-
}) => import("effect/Stream").Stream<import("@t3tools/contracts").TerminalAttachStreamEvent, import("./error.ts").ApplicationError>;
|
|
64
|
-
watchTerminalMetadata: () => import("effect/Stream").Stream<import("@t3tools/contracts").TerminalMetadataStreamEvent, import("./error.ts").ApplicationError>;
|
|
65
|
-
writeTerminal: (input: {
|
|
66
|
-
readonly terminal: import("./service.ts").TerminalRef;
|
|
67
|
-
readonly data: string;
|
|
68
|
-
}) => Effect.Effect<void, import("./error.ts").ApplicationError>;
|
|
69
|
-
resizeTerminal: (input: {
|
|
70
|
-
readonly terminal: import("./service.ts").TerminalRef;
|
|
71
|
-
readonly cols: number;
|
|
72
|
-
readonly rows: number;
|
|
73
|
-
}) => Effect.Effect<void, import("./error.ts").ApplicationError>;
|
|
74
|
-
destroyTerminal: (terminal: import("./service.ts").TerminalRef) => Effect.Effect<void, import("./error.ts").ApplicationError>;
|
|
75
|
-
loadShell: () => Effect.Effect<import("@t3tools/contracts").OrchestrationShellSnapshot, import("./error.ts").ApplicationError>;
|
|
76
|
-
addProject: (input: {
|
|
77
|
-
readonly path: string;
|
|
78
|
-
readonly title?: string;
|
|
79
|
-
}) => Effect.Effect<{
|
|
80
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
81
|
-
readonly project: import("@t3tools/contracts").OrchestrationProjectShell;
|
|
82
|
-
}, import("./error.ts").ApplicationError>;
|
|
83
|
-
resolveProject: (projectRef: string) => Effect.Effect<import("@t3tools/contracts").OrchestrationProjectShell, import("./error.ts").ApplicationError>;
|
|
84
|
-
deleteProject: (input: {
|
|
85
|
-
readonly projectId: string;
|
|
86
|
-
readonly force?: boolean;
|
|
87
|
-
}) => Effect.Effect<{
|
|
88
|
-
readonly projectId: string;
|
|
89
|
-
readonly dispatch: import("@t3tools/contracts").DispatchResult;
|
|
90
|
-
}, import("./error.ts").ApplicationError>;
|
|
91
|
-
listModels: (input: {
|
|
92
|
-
readonly all?: boolean;
|
|
93
|
-
readonly provider?: string;
|
|
94
|
-
}) => Effect.Effect<ReadonlyArray<import("@t3tools/contracts").ServerProvider>, import("./error.ts").ApplicationError>;
|
|
95
|
-
listActions: (projectRef: string) => Effect.Effect<{
|
|
96
|
-
readonly project: import("@t3tools/contracts").OrchestrationProjectShell;
|
|
97
|
-
readonly actions: ReadonlyArray<import("@t3tools/contracts").ProjectScript>;
|
|
98
|
-
}, import("./error.ts").ApplicationError>;
|
|
99
|
-
addAction: (input: import("./service.ts").AddProjectActionInput) => Effect.Effect<import("./service.ts").ProjectActionMutationResult, import("./error.ts").ApplicationError>;
|
|
100
|
-
updateAction: (input: import("./service.ts").UpdateProjectActionInput) => Effect.Effect<import("./service.ts").ProjectActionMutationResult, import("./error.ts").ApplicationError>;
|
|
101
|
-
deleteAction: (input: {
|
|
102
|
-
readonly projectRef: string;
|
|
103
|
-
readonly selector: import("./service.ts").ProjectActionSelector;
|
|
104
|
-
}) => Effect.Effect<import("./service.ts").ProjectActionDeleteResult, import("./error.ts").ApplicationError>;
|
|
105
|
-
runAction: (input: {
|
|
106
|
-
readonly threadId: string;
|
|
107
|
-
readonly selector: import("./service.ts").ProjectActionSelector;
|
|
108
|
-
readonly terminalId?: string;
|
|
109
|
-
}) => Effect.Effect<import("./service.ts").ProjectActionRunResult, import("./error.ts").ApplicationError>;
|
|
110
|
-
}, never, T3ActionApplication | T3ModelApplication | T3ProjectApplication | T3ThreadApplication | T3TerminalApplication>;
|
|
111
|
-
export declare const T3ModelApplicationLive: Layer.Layer<T3ModelApplication, never, import("../orchestration/service.ts").T3Orchestration>;
|
|
112
|
-
export declare const T3ProjectApplicationLive: Layer.Layer<T3ProjectApplication, never, import("../cli/runtime/service.ts").CliRuntime | import("../orchestration/service.ts").T3Orchestration | import("effect/Path").Path | import("effect/Crypto").Crypto>;
|
|
113
|
-
export declare const T3TerminalApplicationLive: Layer.Layer<T3TerminalApplication, never, import("../orchestration/service.ts").T3Orchestration | import("effect/Crypto").Crypto | import("../rpc/operation.ts").T3RpcOperations>;
|
|
114
|
-
export declare const T3ActionApplicationLive: Layer.Layer<T3ActionApplication, never, import("../orchestration/service.ts").T3Orchestration | import("effect/Path").Path | import("effect/Crypto").Crypto | import("../rpc/operation.ts").T3RpcOperations>;
|
|
115
|
-
export declare const T3ThreadApplicationLive: Layer.Layer<T3ThreadApplication, never, import("../cli/runtime/service.ts").CliRuntime | import("../orchestration/service.ts").T3Orchestration | import("effect/Path").Path | import("effect/Crypto").Crypto>;
|
|
116
|
-
export declare const T3ApplicationSlicesLive: Layer.Layer<T3ActionApplication | T3ModelApplication | T3ProjectApplication | T3ThreadApplication | T3TerminalApplication, never, import("../cli/runtime/service.ts").CliRuntime | import("../orchestration/service.ts").T3Orchestration | import("effect/Path").Path | import("effect/Crypto").Crypto | import("../rpc/operation.ts").T3RpcOperations>;
|
|
117
|
-
export declare const T3ApplicationLive: Layer.Layer<T3Application, never, import("../cli/runtime/service.ts").CliRuntime | import("../orchestration/service.ts").T3Orchestration | import("effect/Path").Path | import("effect/Crypto").Crypto | import("../rpc/operation.ts").T3RpcOperations>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import { ModelSelection } from "@t3tools/contracts";
|
|
3
|
-
import type { OrchestrationProjectShell } from "@t3tools/contracts";
|
|
4
|
-
import { ModelSelectionError } from "../domain/error.ts";
|
|
5
|
-
import type { ServerConfigForCli } from "../orchestration/service.ts";
|
|
6
|
-
import type { StartThreadInput } from "./service.ts";
|
|
7
|
-
export declare function resolveModelSelection(input: {
|
|
8
|
-
readonly start: StartThreadInput;
|
|
9
|
-
readonly project: OrchestrationProjectShell;
|
|
10
|
-
readonly serverConfig: ServerConfigForCli;
|
|
11
|
-
}): Effect.Effect<{
|
|
12
|
-
readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
|
|
13
|
-
readonly model: string;
|
|
14
|
-
readonly options?: readonly {
|
|
15
|
-
readonly id: string;
|
|
16
|
-
readonly value: string | boolean;
|
|
17
|
-
}[];
|
|
18
|
-
}, ModelSelectionError, never>;
|
|
19
|
-
export declare function mergeModelOptions(selection: ModelSelection, options: NonNullable<ModelSelection["options"]>): ModelSelection;
|
|
20
|
-
export declare function resolveUpdateModelSelection(input: {
|
|
21
|
-
readonly current: ModelSelection;
|
|
22
|
-
readonly provider?: string;
|
|
23
|
-
readonly model?: string;
|
|
24
|
-
readonly options?: NonNullable<ModelSelection["options"]>;
|
|
25
|
-
readonly project: OrchestrationProjectShell;
|
|
26
|
-
readonly serverConfig: ServerConfigForCli;
|
|
27
|
-
}): Effect.Effect<{
|
|
28
|
-
readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
|
|
29
|
-
readonly model: string;
|
|
30
|
-
readonly options?: readonly {
|
|
31
|
-
readonly id: string;
|
|
32
|
-
readonly value: string | boolean;
|
|
33
|
-
}[];
|
|
34
|
-
}, ModelSelectionError, never>;
|