t3code-cli 0.9.1 → 0.11.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 +52 -14
- package/dist/application.js +2 -2
- package/dist/auth.js +1 -1
- package/dist/bin.js +1556 -341
- package/dist/cli.js +1 -1
- package/dist/config.js +1 -1
- package/dist/connection.js +1 -11
- package/dist/index.js +1 -1
- package/dist/layout.js +1 -1
- package/dist/node.js +2 -0
- package/dist/orchestration.js +2 -2
- package/dist/rpc.js +2 -2
- package/dist/runtime.js +1 -1
- package/dist/scope.js +1 -1
- package/dist/shared.js +1734 -756
- package/dist/src/application/index.d.ts +3 -2
- package/dist/src/application/layer.d.ts +82 -841
- package/dist/src/application/model-selection.d.ts +15 -0
- package/dist/src/application/models.d.ts +1 -87
- package/dist/src/application/project-commands.d.ts +9 -0
- package/dist/src/application/projects.d.ts +13 -135
- package/dist/src/application/service.d.ts +84 -5
- package/dist/src/application/shell-sequence.d.ts +2 -12
- package/dist/src/application/terminals.d.ts +66 -0
- package/dist/src/application/thread-commands.d.ts +47 -0
- package/dist/src/application/thread-update.d.ts +8 -0
- package/dist/src/application/thread-wait.d.ts +3 -14
- package/dist/src/application/threads.d.ts +21 -50
- package/dist/src/cli/flags.d.ts +3 -0
- package/dist/src/cli/output-format.d.ts +2 -0
- package/dist/src/domain/error.d.ts +14 -1
- package/dist/src/domain/helpers.d.ts +0 -9
- package/dist/src/domain/model-config.d.ts +29 -3
- package/dist/src/domain/thread-lifecycle.d.ts +2 -10
- package/dist/src/node/index.d.ts +2 -0
- package/dist/src/orchestration/index.d.ts +1 -0
- package/dist/src/orchestration/layer.d.ts +177 -1032
- package/dist/src/orchestration/service.d.ts +1 -0
- package/dist/src/rpc/error.d.ts +4 -2
- package/dist/src/rpc/index.d.ts +5 -0
- package/dist/src/rpc/layer.d.ts +1097 -499
- package/dist/src/rpc/operation.d.ts +5752 -0
- package/dist/src/rpc/ws-group.d.ts +327 -147
- package/dist/src/runtime/layer.d.ts +1 -1
- package/dist/t3tools.js +2 -2
- package/dist/upstream-t3code/packages/contracts/src/environmentHttp.d.ts +10 -33
- package/dist/upstream-t3code/packages/contracts/src/ipc.d.ts +0 -6
- package/dist/upstream-t3code/packages/contracts/src/orchestration.d.ts +1 -657
- package/dist/upstream-t3code/packages/contracts/src/provider.d.ts +0 -14
- package/dist/upstream-t3code/packages/contracts/src/providerRuntime.d.ts +1 -175
- package/dist/upstream-t3code/packages/contracts/src/rpc.d.ts +0 -492
- package/dist/upstream-t3code/packages/contracts/src/server.d.ts +0 -45
- package/dist/upstream-t3code/packages/contracts/src/settings.d.ts +0 -21
- package/dist/upstream-t3code/packages/contracts/src/terminal.d.ts +3 -6
- package/package.json +6 -2
- package/src/application/index.ts +28 -2
- package/src/application/layer.ts +34 -5
- package/src/application/model-selection.ts +68 -2
- package/src/application/models.ts +14 -14
- package/src/application/project-commands.ts +15 -0
- package/src/application/projects.ts +43 -13
- package/src/application/service.ts +196 -77
- package/src/application/shell-sequence.ts +5 -7
- package/src/application/terminals.ts +207 -0
- package/src/application/thread-commands.test.ts +43 -0
- package/src/application/thread-commands.ts +81 -0
- package/src/application/thread-update.ts +72 -0
- package/src/application/thread-wait.ts +46 -47
- package/src/application/threads.test.ts +166 -0
- package/src/application/threads.ts +123 -40
- package/src/bin.ts +2 -0
- package/src/cli/app.ts +14 -0
- package/src/cli/confirm.ts +31 -0
- package/src/cli/error.ts +26 -3
- package/src/cli/flags.ts +15 -0
- package/src/cli/input/layer.ts +20 -0
- package/src/cli/input/service.ts +1 -0
- package/src/cli/output-format.ts +6 -2
- package/src/cli/project-format.ts +7 -0
- package/src/cli/project.ts +2 -1
- package/src/cli/projects/delete.ts +50 -0
- package/src/cli/self-action.ts +34 -0
- package/src/cli/terminal/attach.ts +32 -0
- package/src/cli/terminal/commands.test.ts +101 -0
- package/src/cli/terminal/create.ts +54 -0
- package/src/cli/terminal/destroy.ts +60 -0
- package/src/cli/terminal/encoding.test.ts +63 -0
- package/src/cli/terminal/encoding.ts +23 -0
- package/src/cli/terminal/error.ts +14 -0
- package/src/cli/terminal/io-node-layer.ts +82 -0
- package/src/cli/terminal/io-service.ts +25 -0
- package/src/cli/terminal/list.ts +35 -0
- package/src/cli/terminal/read.ts +102 -0
- package/src/cli/terminal/scope.ts +30 -0
- package/src/cli/terminal/shared.ts +250 -0
- package/src/cli/terminal/stream.ts +64 -0
- package/src/cli/terminal/wait.test.ts +146 -0
- package/src/cli/terminal/wait.ts +222 -0
- package/src/cli/terminal/write.ts +132 -0
- package/src/cli/terminal-format.ts +167 -0
- package/src/cli/terminal.ts +26 -0
- package/src/cli/thread-format.test.ts +32 -0
- package/src/cli/thread-format.ts +8 -1
- package/src/cli/thread.ts +9 -13
- package/src/cli/threads/archive.ts +11 -18
- package/src/cli/threads/delete.ts +61 -0
- package/src/cli/threads/interrupt.ts +52 -0
- package/src/cli/threads/list.test.ts +69 -0
- package/src/cli/threads/list.ts +15 -3
- package/src/cli/threads/messages.ts +3 -3
- package/src/cli/threads/send.ts +22 -2
- package/src/cli/threads/unarchive.ts +44 -0
- package/src/cli/threads/update.ts +150 -0
- package/src/domain/error.ts +20 -1
- package/src/domain/model-config.ts +4 -0
- package/src/domain/thread-lifecycle.test.ts +35 -0
- package/src/domain/thread-lifecycle.ts +29 -6
- package/src/node/index.ts +2 -0
- package/src/orchestration/index.ts +1 -0
- package/src/orchestration/layer.ts +33 -85
- package/src/orchestration/service.ts +4 -0
- package/src/rpc/error.ts +10 -0
- package/src/rpc/index.ts +5 -0
- package/src/rpc/operation.ts +83 -0
- package/src/rpc/ws-group.ts +24 -0
- package/src/runtime/layer.ts +7 -2
|
@@ -126,7 +126,6 @@ export declare const ServerProvider: Schema.Struct<{
|
|
|
126
126
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
127
127
|
}>>;
|
|
128
128
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
129
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
130
129
|
readonly enabled: Schema.Boolean;
|
|
131
130
|
readonly installed: Schema.Boolean;
|
|
132
131
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -214,7 +213,6 @@ export declare const ServerProviders: Schema.$Array<Schema.Struct<{
|
|
|
214
213
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
215
214
|
}>>;
|
|
216
215
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
217
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
218
216
|
readonly enabled: Schema.Boolean;
|
|
219
217
|
readonly installed: Schema.Boolean;
|
|
220
218
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -597,7 +595,6 @@ export declare const ServerConfig: Schema.Struct<{
|
|
|
597
595
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
598
596
|
}>>;
|
|
599
597
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
600
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
601
598
|
readonly enabled: Schema.Boolean;
|
|
602
599
|
readonly installed: Schema.Boolean;
|
|
603
600
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -725,11 +722,6 @@ export declare const ServerConfig: Schema.Struct<{
|
|
|
725
722
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
726
723
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
727
724
|
}>, never>;
|
|
728
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
729
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
730
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
731
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
732
|
-
}>, never>;
|
|
733
725
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
734
726
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
735
727
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -868,7 +860,6 @@ export declare const ServerConfigUpdatedPayload: Schema.Struct<{
|
|
|
868
860
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
869
861
|
}>>;
|
|
870
862
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
871
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
872
863
|
readonly enabled: Schema.Boolean;
|
|
873
864
|
readonly installed: Schema.Boolean;
|
|
874
865
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -987,11 +978,6 @@ export declare const ServerConfigUpdatedPayload: Schema.Struct<{
|
|
|
987
978
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
988
979
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
989
980
|
}>, never>;
|
|
990
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
991
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
992
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
993
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
994
|
-
}>, never>;
|
|
995
981
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
996
982
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
997
983
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -1068,7 +1054,6 @@ export declare const ServerConfigProviderStatusesPayload: Schema.Struct<{
|
|
|
1068
1054
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1069
1055
|
}>>;
|
|
1070
1056
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
1071
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
1072
1057
|
readonly enabled: Schema.Boolean;
|
|
1073
1058
|
readonly installed: Schema.Boolean;
|
|
1074
1059
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -1190,11 +1175,6 @@ export declare const ServerConfigSettingsUpdatedPayload: Schema.Struct<{
|
|
|
1190
1175
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
1191
1176
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1192
1177
|
}>, never>;
|
|
1193
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
1194
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1195
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
1196
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1197
|
-
}>, never>;
|
|
1198
1178
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
1199
1179
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1200
1180
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -1291,7 +1271,6 @@ export declare const ServerConfigStreamSnapshotEvent: Schema.Struct<{
|
|
|
1291
1271
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1292
1272
|
}>>;
|
|
1293
1273
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
1294
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
1295
1274
|
readonly enabled: Schema.Boolean;
|
|
1296
1275
|
readonly installed: Schema.Boolean;
|
|
1297
1276
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -1419,11 +1398,6 @@ export declare const ServerConfigStreamSnapshotEvent: Schema.Struct<{
|
|
|
1419
1398
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
1420
1399
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1421
1400
|
}>, never>;
|
|
1422
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
1423
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1424
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
1425
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1426
|
-
}>, never>;
|
|
1427
1401
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
1428
1402
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1429
1403
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -1508,7 +1482,6 @@ export declare const ServerConfigStreamProviderStatusesEvent: Schema.Struct<{
|
|
|
1508
1482
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1509
1483
|
}>>;
|
|
1510
1484
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
1511
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
1512
1485
|
readonly enabled: Schema.Boolean;
|
|
1513
1486
|
readonly installed: Schema.Boolean;
|
|
1514
1487
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -1634,11 +1607,6 @@ export declare const ServerConfigStreamSettingsUpdatedEvent: Schema.Struct<{
|
|
|
1634
1607
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
1635
1608
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1636
1609
|
}>, never>;
|
|
1637
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
1638
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1639
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
1640
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1641
|
-
}>, never>;
|
|
1642
1610
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
1643
1611
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1644
1612
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -1736,7 +1704,6 @@ export declare const ServerConfigStreamEvent: Schema.Union<readonly [Schema.Stru
|
|
|
1736
1704
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1737
1705
|
}>>;
|
|
1738
1706
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
1739
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
1740
1707
|
readonly enabled: Schema.Boolean;
|
|
1741
1708
|
readonly installed: Schema.Boolean;
|
|
1742
1709
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -1864,11 +1831,6 @@ export declare const ServerConfigStreamEvent: Schema.Union<readonly [Schema.Stru
|
|
|
1864
1831
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
1865
1832
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1866
1833
|
}>, never>;
|
|
1867
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
1868
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1869
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
1870
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
1871
|
-
}>, never>;
|
|
1872
1834
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
1873
1835
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
1874
1836
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -1949,7 +1911,6 @@ export declare const ServerConfigStreamEvent: Schema.Union<readonly [Schema.Stru
|
|
|
1949
1911
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1950
1912
|
}>>;
|
|
1951
1913
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
1952
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
1953
1914
|
readonly enabled: Schema.Boolean;
|
|
1954
1915
|
readonly installed: Schema.Boolean;
|
|
1955
1916
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -2073,11 +2034,6 @@ export declare const ServerConfigStreamEvent: Schema.Union<readonly [Schema.Stru
|
|
|
2073
2034
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
2074
2035
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
2075
2036
|
}>, never>;
|
|
2076
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
2077
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
2078
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
2079
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
2080
|
-
}>, never>;
|
|
2081
2037
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
2082
2038
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
2083
2039
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -2241,7 +2197,6 @@ export declare const ServerProviderUpdatedPayload: Schema.Struct<{
|
|
|
2241
2197
|
readonly groupKey: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
2242
2198
|
}>>;
|
|
2243
2199
|
readonly showInteractionModeToggle: Schema.optional<Schema.Boolean>;
|
|
2244
|
-
readonly requiresNewThreadForModelChange: Schema.optional<Schema.Boolean>;
|
|
2245
2200
|
readonly enabled: Schema.Boolean;
|
|
2246
2201
|
readonly installed: Schema.Boolean;
|
|
2247
2202
|
readonly version: Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -3,9 +3,6 @@ import * as Schema from "effect/Schema";
|
|
|
3
3
|
export declare const TimestampFormat: Schema.Literals<readonly ["locale", "12-hour", "24-hour"]>;
|
|
4
4
|
export type TimestampFormat = typeof TimestampFormat.Type;
|
|
5
5
|
export declare const DEFAULT_TIMESTAMP_FORMAT: TimestampFormat;
|
|
6
|
-
export declare const ContextMenuStyle: Schema.Literals<readonly ["default", "native", "custom"]>;
|
|
7
|
-
export type ContextMenuStyle = typeof ContextMenuStyle.Type;
|
|
8
|
-
export declare const DEFAULT_CONTEXT_MENU_STYLE: ContextMenuStyle;
|
|
9
6
|
export declare const SidebarProjectSortOrder: Schema.Literals<readonly ["updated_at", "created_at", "manual"]>;
|
|
10
7
|
export type SidebarProjectSortOrder = typeof SidebarProjectSortOrder.Type;
|
|
11
8
|
export declare const DEFAULT_SIDEBAR_PROJECT_SORT_ORDER: SidebarProjectSortOrder;
|
|
@@ -24,7 +21,6 @@ export declare const ClientSettingsSchema: Schema.Struct<{
|
|
|
24
21
|
readonly autoOpenPlanSidebar: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
25
22
|
readonly confirmThreadArchive: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
26
23
|
readonly confirmThreadDelete: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
27
|
-
readonly contextMenuStyle: Schema.withDecodingDefault<Schema.Literals<readonly ["default", "native", "custom"]>, never>;
|
|
28
24
|
readonly dismissedProviderUpdateNotificationKeys: Schema.withDecodingDefault<Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, never>;
|
|
29
25
|
readonly diffIgnoreWhitespace: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
30
26
|
readonly diffWordWrap: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
@@ -92,12 +88,6 @@ export declare const CursorSettings: Schema.Struct<{
|
|
|
92
88
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
93
89
|
}>;
|
|
94
90
|
export type CursorSettings = typeof CursorSettings.Type;
|
|
95
|
-
export declare const GrokSettings: Schema.Struct<{
|
|
96
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
97
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
98
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
99
|
-
}>;
|
|
100
|
-
export type GrokSettings = typeof GrokSettings.Type;
|
|
101
91
|
export declare const OpenCodeSettings: Schema.Struct<{
|
|
102
92
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
103
93
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -154,11 +144,6 @@ export declare const ServerSettings: Schema.Struct<{
|
|
|
154
144
|
readonly apiEndpoint: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.String, never, never>, never>;
|
|
155
145
|
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
156
146
|
}>, never>;
|
|
157
|
-
readonly grok: Schema.withDecodingDefault<Schema.Struct<{
|
|
158
|
-
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
159
|
-
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
160
|
-
readonly customModels: Schema.withDecodingDefault<Schema.$Array<Schema.String>, never>;
|
|
161
|
-
}>, never>;
|
|
162
147
|
readonly opencode: Schema.withDecodingDefault<Schema.Struct<{
|
|
163
148
|
readonly enabled: Schema.withDecodingDefault<Schema.Boolean, never>;
|
|
164
149
|
readonly binaryPath: Schema.withDecodingDefault<Schema.decodeTo<Schema.String, Schema.decodeTo<Schema.String, Schema.String, never, never>, never, never>, never>;
|
|
@@ -238,11 +223,6 @@ export declare const ServerSettingsPatch: Schema.Struct<{
|
|
|
238
223
|
readonly apiEndpoint: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
239
224
|
readonly customModels: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
240
225
|
}>>;
|
|
241
|
-
readonly grok: Schema.optionalKey<Schema.Struct<{
|
|
242
|
-
readonly enabled: Schema.optionalKey<Schema.Boolean>;
|
|
243
|
-
readonly binaryPath: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
244
|
-
readonly customModels: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
245
|
-
}>>;
|
|
246
226
|
readonly opencode: Schema.optionalKey<Schema.Struct<{
|
|
247
227
|
readonly enabled: Schema.optionalKey<Schema.Boolean>;
|
|
248
228
|
readonly binaryPath: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -270,7 +250,6 @@ export declare const ClientSettingsPatch: Schema.Struct<{
|
|
|
270
250
|
readonly autoOpenPlanSidebar: Schema.optionalKey<Schema.Boolean>;
|
|
271
251
|
readonly confirmThreadArchive: Schema.optionalKey<Schema.Boolean>;
|
|
272
252
|
readonly confirmThreadDelete: Schema.optionalKey<Schema.Boolean>;
|
|
273
|
-
readonly contextMenuStyle: Schema.optionalKey<Schema.Literals<readonly ["default", "native", "custom"]>>;
|
|
274
253
|
readonly diffIgnoreWhitespace: Schema.optionalKey<Schema.Boolean>;
|
|
275
254
|
readonly diffWordWrap: Schema.optionalKey<Schema.Boolean>;
|
|
276
255
|
readonly favorites: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
@@ -21,11 +21,10 @@ export declare const TerminalOpenInput: Schema.Struct<{
|
|
|
21
21
|
readonly cols: Schema.optional<Schema.Int>;
|
|
22
22
|
readonly rows: Schema.optional<Schema.Int>;
|
|
23
23
|
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
24
|
-
readonly projectId: Schema.optional<Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "ProjectId">>;
|
|
25
24
|
readonly terminalId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
26
25
|
readonly threadId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
27
26
|
}>;
|
|
28
|
-
export type TerminalOpenInput = typeof TerminalOpenInput
|
|
27
|
+
export type TerminalOpenInput = Schema.Codec.Encoded<typeof TerminalOpenInput>;
|
|
29
28
|
export declare const TerminalAttachInput: Schema.Struct<{
|
|
30
29
|
readonly cwd: Schema.optional<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
31
30
|
readonly worktreePath: Schema.optional<Schema.NullOr<Schema.decodeTo<Schema.String, Schema.String, never, never>>>;
|
|
@@ -33,11 +32,10 @@ export declare const TerminalAttachInput: Schema.Struct<{
|
|
|
33
32
|
readonly rows: Schema.optional<Schema.Int>;
|
|
34
33
|
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
35
34
|
readonly restartIfNotRunning: Schema.optional<Schema.Boolean>;
|
|
36
|
-
readonly projectId: Schema.optional<Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "ProjectId">>;
|
|
37
35
|
readonly terminalId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
38
36
|
readonly threadId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
39
37
|
}>;
|
|
40
|
-
export type TerminalAttachInput = typeof TerminalAttachInput
|
|
38
|
+
export type TerminalAttachInput = Schema.Codec.Encoded<typeof TerminalAttachInput>;
|
|
41
39
|
export declare const TerminalWriteInput: Schema.Struct<{
|
|
42
40
|
readonly data: Schema.String;
|
|
43
41
|
readonly terminalId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -62,11 +60,10 @@ export declare const TerminalRestartInput: Schema.Struct<{
|
|
|
62
60
|
readonly cols: Schema.Int;
|
|
63
61
|
readonly rows: Schema.Int;
|
|
64
62
|
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
65
|
-
readonly projectId: Schema.optional<Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "ProjectId">>;
|
|
66
63
|
readonly terminalId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
67
64
|
readonly threadId: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
68
65
|
}>;
|
|
69
|
-
export type TerminalRestartInput = typeof TerminalRestartInput
|
|
66
|
+
export type TerminalRestartInput = Schema.Codec.Encoded<typeof TerminalRestartInput>;
|
|
70
67
|
export declare const TerminalCloseInput: Schema.Struct<{
|
|
71
68
|
readonly terminalId: Schema.optional<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
72
69
|
readonly deleteHistory: Schema.optional<Schema.Boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "t3code-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "CLI for t3code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -70,6 +70,10 @@
|
|
|
70
70
|
"types": "./dist/src/layout/index.d.ts",
|
|
71
71
|
"default": "./dist/layout.js"
|
|
72
72
|
},
|
|
73
|
+
"./node": {
|
|
74
|
+
"types": "./dist/src/node/index.d.ts",
|
|
75
|
+
"default": "./dist/node.js"
|
|
76
|
+
},
|
|
73
77
|
"./orchestration": {
|
|
74
78
|
"types": "./dist/src/orchestration/index.d.ts",
|
|
75
79
|
"default": "./dist/orchestration.js"
|
|
@@ -98,7 +102,7 @@
|
|
|
98
102
|
"@types/node": "^25.9.1",
|
|
99
103
|
"typescript": "^6.0.3",
|
|
100
104
|
"vite-plus": "^0.1.24",
|
|
101
|
-
"@t3tools/contracts": "0.0.
|
|
105
|
+
"@t3tools/contracts": "0.0.24"
|
|
102
106
|
},
|
|
103
107
|
"engines": {
|
|
104
108
|
"node": ">=24.0.0"
|
package/src/application/index.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
1
|
+
export {
|
|
2
|
+
T3Application,
|
|
3
|
+
T3ModelApplication,
|
|
4
|
+
T3ProjectApplication,
|
|
5
|
+
T3TerminalApplication,
|
|
6
|
+
T3ThreadApplication,
|
|
7
|
+
} from "./service.ts";
|
|
8
|
+
export {
|
|
9
|
+
makeT3Application,
|
|
10
|
+
T3ApplicationLive,
|
|
11
|
+
T3ApplicationSlicesLive,
|
|
12
|
+
T3ModelApplicationLive,
|
|
13
|
+
T3ProjectApplicationLive,
|
|
14
|
+
T3TerminalApplicationLive,
|
|
15
|
+
T3ThreadApplicationLive,
|
|
16
|
+
} from "./layer.ts";
|
|
17
|
+
export type {
|
|
18
|
+
SendThreadInput,
|
|
19
|
+
StartThreadInput,
|
|
20
|
+
StartThreadPolicy,
|
|
21
|
+
T3ApplicationService,
|
|
22
|
+
T3ModelApplicationService,
|
|
23
|
+
T3ProjectApplicationService,
|
|
24
|
+
T3TerminalApplicationService,
|
|
25
|
+
T3ThreadApplicationService,
|
|
26
|
+
UpdateThreadInput,
|
|
27
|
+
WaitEvent,
|
|
28
|
+
} from "./service.ts";
|
|
3
29
|
export type { ApplicationError } from "./error.ts";
|
package/src/application/layer.ts
CHANGED
|
@@ -3,18 +3,47 @@ import * as Layer from "effect/Layer";
|
|
|
3
3
|
|
|
4
4
|
import { makeModelsApplication } from "./models.ts";
|
|
5
5
|
import { makeProjectApplication } from "./projects.ts";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
T3Application,
|
|
8
|
+
T3ModelApplication,
|
|
9
|
+
T3ProjectApplication,
|
|
10
|
+
T3TerminalApplication,
|
|
11
|
+
T3ThreadApplication,
|
|
12
|
+
} from "./service.ts";
|
|
13
|
+
import { makeTerminalApplication } from "./terminals.ts";
|
|
7
14
|
import { makeThreadApplication } from "./threads.ts";
|
|
8
15
|
|
|
9
16
|
export const makeT3Application = Effect.fn("makeT3Application")(function* () {
|
|
10
|
-
const models = yield*
|
|
11
|
-
const projects = yield*
|
|
12
|
-
const
|
|
17
|
+
const models = yield* T3ModelApplication;
|
|
18
|
+
const projects = yield* T3ProjectApplication;
|
|
19
|
+
const terminals = yield* T3TerminalApplication;
|
|
20
|
+
const threads = yield* T3ThreadApplication;
|
|
13
21
|
return {
|
|
14
22
|
...models,
|
|
15
23
|
...projects,
|
|
24
|
+
...terminals,
|
|
16
25
|
...threads,
|
|
17
26
|
};
|
|
18
27
|
});
|
|
19
28
|
|
|
20
|
-
export const
|
|
29
|
+
export const T3ModelApplicationLive = Layer.effect(T3ModelApplication, makeModelsApplication());
|
|
30
|
+
export const T3ProjectApplicationLive = Layer.effect(
|
|
31
|
+
T3ProjectApplication,
|
|
32
|
+
makeProjectApplication(),
|
|
33
|
+
);
|
|
34
|
+
export const T3TerminalApplicationLive = Layer.effect(
|
|
35
|
+
T3TerminalApplication,
|
|
36
|
+
makeTerminalApplication(),
|
|
37
|
+
);
|
|
38
|
+
export const T3ThreadApplicationLive = Layer.effect(T3ThreadApplication, makeThreadApplication());
|
|
39
|
+
|
|
40
|
+
export const T3ApplicationSlicesLive = Layer.mergeAll(
|
|
41
|
+
T3ModelApplicationLive,
|
|
42
|
+
T3ProjectApplicationLive,
|
|
43
|
+
T3TerminalApplicationLive,
|
|
44
|
+
T3ThreadApplicationLive,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const T3ApplicationLive = Layer.effect(T3Application, makeT3Application()).pipe(
|
|
48
|
+
Layer.provide(T3ApplicationSlicesLive),
|
|
49
|
+
);
|
|
@@ -5,6 +5,7 @@ import * as Schema from "effect/Schema";
|
|
|
5
5
|
|
|
6
6
|
import { ModelSelectionError } from "../domain/error.ts";
|
|
7
7
|
import {
|
|
8
|
+
findSelectableModel,
|
|
8
9
|
findSelectableProvider,
|
|
9
10
|
firstSelectableModel,
|
|
10
11
|
firstSelectableProvider,
|
|
@@ -75,10 +76,67 @@ export function mergeModelOptions(
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
function withModelOptions(input: StartThreadInput, selection: ModelSelection): ModelSelection {
|
|
78
|
-
|
|
79
|
+
return applyModelOptions(selection, input.options);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function applyModelOptions(
|
|
83
|
+
selection: ModelSelection,
|
|
84
|
+
options: NonNullable<ModelSelection["options"]> | undefined,
|
|
85
|
+
): ModelSelection {
|
|
86
|
+
if (options === undefined || options.length === 0) {
|
|
79
87
|
return selection;
|
|
80
88
|
}
|
|
81
|
-
return mergeModelOptions(selection,
|
|
89
|
+
return mergeModelOptions(selection, options);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function resolveUpdateModelSelection(input: {
|
|
93
|
+
readonly current: ModelSelection;
|
|
94
|
+
readonly provider?: string;
|
|
95
|
+
readonly model?: string;
|
|
96
|
+
readonly options?: NonNullable<ModelSelection["options"]>;
|
|
97
|
+
readonly project: OrchestrationProjectShell;
|
|
98
|
+
readonly serverConfig: ServerConfigForCli;
|
|
99
|
+
}) {
|
|
100
|
+
return Effect.gen(function* () {
|
|
101
|
+
const hasProvider = input.provider !== undefined && input.provider.length > 0;
|
|
102
|
+
const hasModel = input.model !== undefined && input.model.length > 0;
|
|
103
|
+
if (hasProvider && hasModel) {
|
|
104
|
+
return applyModelOptions(
|
|
105
|
+
{
|
|
106
|
+
instanceId: ProviderInstanceId.make(input.provider),
|
|
107
|
+
model: input.model,
|
|
108
|
+
},
|
|
109
|
+
input.options,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (hasProvider) {
|
|
113
|
+
const provider = yield* findProvider(input.serverConfig, input.provider);
|
|
114
|
+
const model = findSelectableModel(provider, input.current.model);
|
|
115
|
+
if (model === undefined) {
|
|
116
|
+
return yield* failMissingCurrentModel({
|
|
117
|
+
provider: input.provider,
|
|
118
|
+
model: input.current.model,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return applyModelOptions(
|
|
122
|
+
{
|
|
123
|
+
instanceId: ProviderInstanceId.make(input.provider),
|
|
124
|
+
model: model.slug,
|
|
125
|
+
},
|
|
126
|
+
input.options,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
if (hasModel) {
|
|
130
|
+
return applyModelOptions(
|
|
131
|
+
{
|
|
132
|
+
instanceId: input.current.instanceId,
|
|
133
|
+
model: input.model,
|
|
134
|
+
},
|
|
135
|
+
input.options,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
return applyModelOptions(input.current, input.options);
|
|
139
|
+
});
|
|
82
140
|
}
|
|
83
141
|
|
|
84
142
|
function firstAvailableModel(serverConfig: ServerConfigForCli) {
|
|
@@ -105,3 +163,11 @@ function failNoAvailableModel() {
|
|
|
105
163
|
}),
|
|
106
164
|
);
|
|
107
165
|
}
|
|
166
|
+
|
|
167
|
+
function failMissingCurrentModel(input: { readonly provider: string; readonly model: string }) {
|
|
168
|
+
return Effect.fail(
|
|
169
|
+
new ModelSelectionError({
|
|
170
|
+
message: `provider ${input.provider} does not have current model ${input.model}; pass --model`,
|
|
171
|
+
}),
|
|
172
|
+
);
|
|
173
|
+
}
|
|
@@ -2,25 +2,25 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
|
|
3
3
|
import { filterProvidersForModelListing } from "../domain/model-config.ts";
|
|
4
4
|
import { T3Orchestration } from "../orchestration/service.ts";
|
|
5
|
+
import type { T3ModelApplicationService } from "./service.ts";
|
|
5
6
|
|
|
6
7
|
export const makeModelsApplication = Effect.fn("makeModelsApplication")(function* () {
|
|
7
8
|
const orchestration = yield* T3Orchestration;
|
|
8
9
|
|
|
9
|
-
const listModels = Effect.fn("T3Application.listModels")(
|
|
10
|
-
readonly all?: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
10
|
+
const listModels: T3ModelApplicationService["listModels"] = Effect.fn("T3Application.listModels")(
|
|
11
|
+
function* (input: { readonly all?: boolean; readonly provider?: string }) {
|
|
12
|
+
const config = yield* orchestration.getServerConfig();
|
|
13
|
+
return filterProvidersForModelListing({
|
|
14
|
+
providers: config.providers,
|
|
15
|
+
all: input.all === true,
|
|
16
|
+
...(input.provider !== undefined && input.provider.length > 0
|
|
17
|
+
? { provider: input.provider }
|
|
18
|
+
: {}),
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
22
|
|
|
23
23
|
return {
|
|
24
24
|
listModels,
|
|
25
|
-
};
|
|
25
|
+
} satisfies T3ModelApplicationService;
|
|
26
26
|
});
|
|
@@ -28,3 +28,18 @@ export const makeProjectCreateCommand = Effect.fn("makeProjectCreateCommand")(fu
|
|
|
28
28
|
createdAt,
|
|
29
29
|
} satisfies Extract<ClientOrchestrationCommand, { readonly type: "project.create" }>;
|
|
30
30
|
});
|
|
31
|
+
|
|
32
|
+
export const makeProjectDeleteCommand = Effect.fn("makeProjectDeleteCommand")(function* (input: {
|
|
33
|
+
readonly projectId: string;
|
|
34
|
+
readonly force?: boolean;
|
|
35
|
+
}) {
|
|
36
|
+
const crypto = yield* Crypto.Crypto;
|
|
37
|
+
return {
|
|
38
|
+
type: "project.delete",
|
|
39
|
+
commandId: CommandId.make(
|
|
40
|
+
`t3cli:project-delete:${yield* crypto.randomUUIDv4.pipe(Effect.orDie)}`,
|
|
41
|
+
),
|
|
42
|
+
projectId: ProjectId.make(input.projectId),
|
|
43
|
+
...(input.force === true ? { force: true } : {}),
|
|
44
|
+
} satisfies Extract<ClientOrchestrationCommand, { readonly type: "project.delete" }>;
|
|
45
|
+
});
|
|
@@ -4,33 +4,51 @@ import * as Path from "effect/Path";
|
|
|
4
4
|
|
|
5
5
|
import { Environment } from "../environment/service.ts";
|
|
6
6
|
import { T3Orchestration } from "../orchestration/service.ts";
|
|
7
|
-
import { ProjectCreateVisibilityError } from "../domain/error.ts";
|
|
8
|
-
import { findProjectById } from "../domain/helpers.ts";
|
|
9
|
-
import { makeProjectCreateCommand } from "./project-commands.ts";
|
|
7
|
+
import { ProjectCreateVisibilityError, ProjectLookupError } from "../domain/error.ts";
|
|
8
|
+
import { findProjectById, resolveProjectScope } from "../domain/helpers.ts";
|
|
9
|
+
import { makeProjectCreateCommand, makeProjectDeleteCommand } from "./project-commands.ts";
|
|
10
10
|
import { waitForShellSequence } from "./shell-sequence.ts";
|
|
11
|
+
import type { T3ProjectApplicationService } from "./service.ts";
|
|
11
12
|
|
|
12
13
|
export const makeProjectApplication = Effect.fn("makeProjectApplication")(function* () {
|
|
13
14
|
const orchestration = yield* T3Orchestration;
|
|
14
15
|
const crypto = yield* Crypto.Crypto;
|
|
15
16
|
const path = yield* Path.Path;
|
|
16
17
|
const environment = yield* Environment;
|
|
17
|
-
const loadShell = Effect.fn(
|
|
18
|
+
const loadShell: T3ProjectApplicationService["loadShell"] = Effect.fn(
|
|
19
|
+
"T3ApplicationLive.loadShell",
|
|
20
|
+
)(function* () {
|
|
18
21
|
return yield* orchestration.getShellSnapshot();
|
|
19
22
|
});
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const resolveProject: T3ProjectApplicationService["resolveProject"] = Effect.fn(
|
|
24
|
+
"T3ApplicationLive.resolveProject",
|
|
25
|
+
)(function* (projectRef: string) {
|
|
26
|
+
const snapshot = yield* orchestration.getShellSnapshot();
|
|
27
|
+
const scope = yield* resolveProjectScope(snapshot, {
|
|
28
|
+
ref: projectRef,
|
|
29
|
+
}).pipe(Effect.provideService(Path.Path, path));
|
|
30
|
+
if (scope === undefined) {
|
|
31
|
+
return yield* Effect.fail(
|
|
32
|
+
new ProjectLookupError({
|
|
33
|
+
message: `project not found: ${projectRef}`,
|
|
34
|
+
ref: projectRef,
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return scope.project;
|
|
39
|
+
});
|
|
40
|
+
const addProject: T3ProjectApplicationService["addProject"] = Effect.fn(
|
|
41
|
+
"T3ApplicationLive.addProject",
|
|
42
|
+
)(function* (projectInput: { readonly path: string; readonly title?: string }) {
|
|
24
43
|
const command = yield* makeProjectCreateCommand(projectInput).pipe(
|
|
25
44
|
Effect.provideService(Path.Path, path),
|
|
26
45
|
Effect.provideService(Crypto.Crypto, crypto),
|
|
27
46
|
Effect.provideService(Environment, environment),
|
|
28
47
|
);
|
|
29
48
|
const dispatch = yield* orchestration.dispatch(command);
|
|
30
|
-
const snapshot = yield* waitForShellSequence({
|
|
31
|
-
orchestration,
|
|
32
|
-
|
|
33
|
-
});
|
|
49
|
+
const snapshot = yield* waitForShellSequence({ sequence: dispatch.sequence }).pipe(
|
|
50
|
+
Effect.provideService(T3Orchestration, orchestration),
|
|
51
|
+
);
|
|
34
52
|
const project = findProjectById(snapshot, command.projectId);
|
|
35
53
|
if (project === null) {
|
|
36
54
|
return yield* Effect.fail(
|
|
@@ -42,9 +60,21 @@ export const makeProjectApplication = Effect.fn("makeProjectApplication")(functi
|
|
|
42
60
|
}
|
|
43
61
|
return { dispatch, project };
|
|
44
62
|
});
|
|
63
|
+
const deleteProject: T3ProjectApplicationService["deleteProject"] = Effect.fn(
|
|
64
|
+
"T3ApplicationLive.deleteProject",
|
|
65
|
+
)(function* (input: { readonly projectId: string; readonly force?: boolean }) {
|
|
66
|
+
const command = yield* makeProjectDeleteCommand({
|
|
67
|
+
projectId: input.projectId,
|
|
68
|
+
...(input.force === true ? { force: true } : {}),
|
|
69
|
+
}).pipe(Effect.provideService(Crypto.Crypto, crypto));
|
|
70
|
+
const dispatch = yield* orchestration.dispatch(command);
|
|
71
|
+
return { projectId: input.projectId, dispatch };
|
|
72
|
+
});
|
|
45
73
|
|
|
46
74
|
return {
|
|
47
75
|
loadShell,
|
|
48
76
|
addProject,
|
|
49
|
-
|
|
77
|
+
resolveProject,
|
|
78
|
+
deleteProject,
|
|
79
|
+
} satisfies T3ProjectApplicationService;
|
|
50
80
|
});
|