t3code-cli 0.3.0 → 0.4.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 +1 -1
- package/dist/bin.js +412 -87
- package/dist/index.js +1 -1
- package/dist/{runtime-CMPZpQaG.js → runtime-Cq64iuZr.js} +4768 -2040
- package/dist/src/application/layer.d.ts +3 -3
- package/dist/src/application/models.d.ts +1 -1
- package/dist/src/application/projects.d.ts +1 -1
- package/dist/src/application/threads.d.ts +1 -1
- package/dist/src/auth/error.d.ts +20 -1
- package/dist/src/auth/layer.d.ts +9 -22
- package/dist/src/auth/local.d.ts +23 -15
- package/dist/src/auth/pairing.d.ts +20 -2
- package/dist/src/auth/schema.d.ts +25 -34
- package/dist/src/auth/service.d.ts +2 -2
- package/dist/src/auth/transport.d.ts +13 -20
- package/dist/src/auth/type.d.ts +0 -1
- package/dist/src/domain/model-config.d.ts +3 -3
- package/dist/src/orchestration/layer.d.ts +3 -3
- package/dist/src/rpc/layer.d.ts +6 -6
- package/dist/src/rpc/ws-group.d.ts +3 -3
- package/dist/src/runtime.d.ts +2 -2
- package/dist/src/sql/node-sqlite-client.d.ts +10 -0
- package/dist/src/sql/service.d.ts +17 -0
- package/dist/upstream-t3code/packages/contracts/src/auth.d.ts +14 -12
- package/dist/upstream-t3code/packages/contracts/src/environmentHttp.d.ts +167 -7
- package/dist/upstream-t3code/packages/contracts/src/index.d.ts +1 -0
- package/dist/upstream-t3code/packages/contracts/src/ipc.d.ts +24 -0
- package/dist/upstream-t3code/packages/contracts/src/providerRuntime.d.ts +90 -0
- package/dist/upstream-t3code/packages/contracts/src/relay.d.ts +1262 -0
- package/dist/upstream-t3code/packages/contracts/src/relayClient.d.ts +48 -0
- package/dist/upstream-t3code/packages/contracts/src/rpc.d.ts +78 -9
- package/dist/upstream-t3code/packages/contracts/src/server.d.ts +3 -3
- package/package.json +3 -3
- package/src/auth/error.ts +33 -1
- package/src/auth/layer.ts +11 -76
- package/src/auth/local.ts +342 -208
- package/src/auth/pairing.ts +44 -2
- package/src/auth/schema.ts +21 -28
- package/src/auth/service.ts +2 -2
- package/src/auth/transport.ts +59 -22
- package/src/auth/type.ts +0 -1
- package/src/cli/auth.ts +1 -3
- package/src/rpc/layer.ts +2 -2
- package/src/runtime.ts +14 -1
- package/src/sql/node-sqlite-client.ts +141 -0
- package/src/sql/service.ts +21 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export declare const RelayClientStatusSchema: Schema.Union<readonly [Schema.Struct<{
|
|
3
|
+
readonly status: Schema.Literal<"available">;
|
|
4
|
+
readonly executablePath: Schema.String;
|
|
5
|
+
readonly source: Schema.Literals<readonly ["override", "managed", "path"]>;
|
|
6
|
+
readonly version: Schema.String;
|
|
7
|
+
}>, Schema.Struct<{
|
|
8
|
+
readonly status: Schema.Literal<"missing">;
|
|
9
|
+
readonly version: Schema.String;
|
|
10
|
+
}>, Schema.Struct<{
|
|
11
|
+
readonly status: Schema.Literal<"unsupported">;
|
|
12
|
+
readonly platform: Schema.String;
|
|
13
|
+
readonly arch: Schema.String;
|
|
14
|
+
readonly version: Schema.String;
|
|
15
|
+
}>]>;
|
|
16
|
+
export type RelayClientStatus = typeof RelayClientStatusSchema.Type;
|
|
17
|
+
export declare const RelayClientInstallProgressStageSchema: Schema.Literals<readonly ["checking", "waiting_for_lock", "downloading", "verifying", "installing", "validating", "activating"]>;
|
|
18
|
+
export type RelayClientInstallProgressStage = typeof RelayClientInstallProgressStageSchema.Type;
|
|
19
|
+
export declare const RelayClientInstallProgressEventSchema: Schema.Union<readonly [Schema.Struct<{
|
|
20
|
+
readonly type: Schema.Literal<"progress">;
|
|
21
|
+
readonly stage: Schema.Literals<readonly ["checking", "waiting_for_lock", "downloading", "verifying", "installing", "validating", "activating"]>;
|
|
22
|
+
}>, Schema.Struct<{
|
|
23
|
+
readonly type: Schema.Literal<"complete">;
|
|
24
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
25
|
+
readonly status: Schema.Literal<"available">;
|
|
26
|
+
readonly executablePath: Schema.String;
|
|
27
|
+
readonly source: Schema.Literals<readonly ["override", "managed", "path"]>;
|
|
28
|
+
readonly version: Schema.String;
|
|
29
|
+
}>, Schema.Struct<{
|
|
30
|
+
readonly status: Schema.Literal<"missing">;
|
|
31
|
+
readonly version: Schema.String;
|
|
32
|
+
}>, Schema.Struct<{
|
|
33
|
+
readonly status: Schema.Literal<"unsupported">;
|
|
34
|
+
readonly platform: Schema.String;
|
|
35
|
+
readonly arch: Schema.String;
|
|
36
|
+
readonly version: Schema.String;
|
|
37
|
+
}>]>;
|
|
38
|
+
}>]>;
|
|
39
|
+
export type RelayClientInstallProgressEvent = typeof RelayClientInstallProgressEventSchema.Type;
|
|
40
|
+
export declare const RelayClientInstallFailureReasonSchema: Schema.Literals<readonly ["download_failed", "invalid_checksum", "install_locked", "override_missing", "unsupported_platform", "validation_failed", "write_failed"]>;
|
|
41
|
+
export type RelayClientInstallFailureReason = typeof RelayClientInstallFailureReasonSchema.Type;
|
|
42
|
+
declare const RelayClientInstallFailedError_base: Schema.Class<RelayClientInstallFailedError, Schema.TaggedStruct<"RelayClientInstallFailedError", {
|
|
43
|
+
readonly reason: Schema.Literals<readonly ["download_failed", "invalid_checksum", "install_locked", "override_missing", "unsupported_platform", "validation_failed", "write_failed"]>;
|
|
44
|
+
readonly message: Schema.String;
|
|
45
|
+
}>, import("effect/Cause").YieldableError>;
|
|
46
|
+
export declare class RelayClientInstallFailedError extends RelayClientInstallFailedError_base {
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -7,6 +7,7 @@ import { FilesystemBrowseError } from "./filesystem.ts";
|
|
|
7
7
|
import { GitCommandError } from "./git.ts";
|
|
8
8
|
import { KeybindingsConfigError } from "./keybindings.ts";
|
|
9
9
|
import { OrchestrationDispatchCommandError, OrchestrationGetFullThreadDiffError, OrchestrationGetSnapshotError, OrchestrationGetTurnDiffError, OrchestrationReplayEventsError } from "./orchestration.ts";
|
|
10
|
+
import { RelayClientInstallFailedError } from "./relayClient.ts";
|
|
10
11
|
import { ProjectSearchEntriesError, ProjectWriteFileError } from "./project.ts";
|
|
11
12
|
import { ServerProviderUpdateError } from "./server.ts";
|
|
12
13
|
import { ServerSettingsError } from "./settings.ts";
|
|
@@ -50,6 +51,8 @@ export declare const WS_METHODS: {
|
|
|
50
51
|
readonly serverGetProcessDiagnostics: "server.getProcessDiagnostics";
|
|
51
52
|
readonly serverGetProcessResourceHistory: "server.getProcessResourceHistory";
|
|
52
53
|
readonly serverSignalProcess: "server.signalProcess";
|
|
54
|
+
readonly cloudGetRelayClientStatus: "cloud.getRelayClientStatus";
|
|
55
|
+
readonly cloudInstallRelayClient: "cloud.installRelayClient";
|
|
53
56
|
readonly sourceControlLookupRepository: "sourceControl.lookupRepository";
|
|
54
57
|
readonly sourceControlCloneRepository: "sourceControl.cloneRepository";
|
|
55
58
|
readonly sourceControlPublishRepository: "sourceControl.publishRepository";
|
|
@@ -161,7 +164,7 @@ export declare const WsServerGetConfigRpc: Rpc.Rpc<"server.getConfig", Schema.St
|
|
|
161
164
|
readonly auth: Schema.Struct<{
|
|
162
165
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
163
166
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
164
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
167
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
165
168
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
166
169
|
}>;
|
|
167
170
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -906,6 +909,40 @@ export declare const WsServerSignalProcessRpc: Rpc.Rpc<"server.signalProcess", S
|
|
|
906
909
|
readonly signaled: Schema.Boolean;
|
|
907
910
|
readonly message: Schema.Option<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
908
911
|
}>, typeof EnvironmentAuthorizationError, never, never>;
|
|
912
|
+
export declare const WsCloudGetRelayClientStatusRpc: Rpc.Rpc<"cloud.getRelayClientStatus", Schema.Struct<{}>, Schema.Union<readonly [Schema.Struct<{
|
|
913
|
+
readonly status: Schema.Literal<"available">;
|
|
914
|
+
readonly executablePath: Schema.String;
|
|
915
|
+
readonly source: Schema.Literals<readonly ["override", "managed", "path"]>;
|
|
916
|
+
readonly version: Schema.String;
|
|
917
|
+
}>, Schema.Struct<{
|
|
918
|
+
readonly status: Schema.Literal<"missing">;
|
|
919
|
+
readonly version: Schema.String;
|
|
920
|
+
}>, Schema.Struct<{
|
|
921
|
+
readonly status: Schema.Literal<"unsupported">;
|
|
922
|
+
readonly platform: Schema.String;
|
|
923
|
+
readonly arch: Schema.String;
|
|
924
|
+
readonly version: Schema.String;
|
|
925
|
+
}>]>, typeof EnvironmentAuthorizationError, never, never>;
|
|
926
|
+
export declare const WsCloudInstallRelayClientRpc: Rpc.Rpc<"cloud.installRelayClient", Schema.Struct<{}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.Struct<{
|
|
927
|
+
readonly type: Schema.Literal<"progress">;
|
|
928
|
+
readonly stage: Schema.Literals<readonly ["checking", "waiting_for_lock", "downloading", "verifying", "installing", "validating", "activating"]>;
|
|
929
|
+
}>, Schema.Struct<{
|
|
930
|
+
readonly type: Schema.Literal<"complete">;
|
|
931
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
932
|
+
readonly status: Schema.Literal<"available">;
|
|
933
|
+
readonly executablePath: Schema.String;
|
|
934
|
+
readonly source: Schema.Literals<readonly ["override", "managed", "path"]>;
|
|
935
|
+
readonly version: Schema.String;
|
|
936
|
+
}>, Schema.Struct<{
|
|
937
|
+
readonly status: Schema.Literal<"missing">;
|
|
938
|
+
readonly version: Schema.String;
|
|
939
|
+
}>, Schema.Struct<{
|
|
940
|
+
readonly status: Schema.Literal<"unsupported">;
|
|
941
|
+
readonly platform: Schema.String;
|
|
942
|
+
readonly arch: Schema.String;
|
|
943
|
+
readonly version: Schema.String;
|
|
944
|
+
}>]>;
|
|
945
|
+
}>]>, Schema.Union<readonly [typeof RelayClientInstallFailedError, typeof EnvironmentAuthorizationError]>>, Schema.Never, never, never>;
|
|
909
946
|
export declare const WsSourceControlLookupRepositoryRpc: Rpc.Rpc<"sourceControl.lookupRepository", Schema.Struct<{
|
|
910
947
|
readonly provider: Schema.Literals<readonly ["github", "gitlab", "azure-devops", "bitbucket", "unknown"]>;
|
|
911
948
|
readonly repository: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -3597,7 +3634,7 @@ export declare const WsSubscribeServerConfigRpc: Rpc.Rpc<"subscribeServerConfig"
|
|
|
3597
3634
|
readonly auth: Schema.Struct<{
|
|
3598
3635
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
3599
3636
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
3600
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
3637
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
3601
3638
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
3602
3639
|
}>;
|
|
3603
3640
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -4064,7 +4101,7 @@ export declare const WsSubscribeAuthAccessRpc: Rpc.Rpc<"subscribeAuthAccess", Sc
|
|
|
4064
4101
|
readonly sessionId: Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "AuthSessionId">;
|
|
4065
4102
|
readonly subject: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
4066
4103
|
readonly scopes: Schema.$Array<Schema.Literals<readonly ["orchestration:read", "orchestration:operate", "terminal:operate", "review:write", "access:read", "access:write", "relay:read", "relay:write"]>>;
|
|
4067
|
-
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>;
|
|
4104
|
+
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>;
|
|
4068
4105
|
readonly client: Schema.Struct<{
|
|
4069
4106
|
readonly label: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
4070
4107
|
readonly ipAddress: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -4108,7 +4145,7 @@ export declare const WsSubscribeAuthAccessRpc: Rpc.Rpc<"subscribeAuthAccess", Sc
|
|
|
4108
4145
|
readonly sessionId: Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "AuthSessionId">;
|
|
4109
4146
|
readonly subject: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
4110
4147
|
readonly scopes: Schema.$Array<Schema.Literals<readonly ["orchestration:read", "orchestration:operate", "terminal:operate", "review:write", "access:read", "access:write", "relay:read", "relay:write"]>>;
|
|
4111
|
-
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>;
|
|
4148
|
+
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>;
|
|
4112
4149
|
readonly client: Schema.Struct<{
|
|
4113
4150
|
readonly label: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
4114
4151
|
readonly ipAddress: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -4230,7 +4267,7 @@ export declare const WsRpcGroup: RpcGroup.RpcGroup<Rpc.Rpc<"server.upsertKeybind
|
|
|
4230
4267
|
readonly auth: Schema.Struct<{
|
|
4231
4268
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
4232
4269
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
4233
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
4270
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
4234
4271
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
4235
4272
|
}>;
|
|
4236
4273
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -4965,7 +5002,39 @@ export declare const WsRpcGroup: RpcGroup.RpcGroup<Rpc.Rpc<"server.upsertKeybind
|
|
|
4965
5002
|
readonly signal: Schema.Literals<readonly ["SIGINT", "SIGKILL"]>;
|
|
4966
5003
|
readonly signaled: Schema.Boolean;
|
|
4967
5004
|
readonly message: Schema.Option<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
4968
|
-
}>, typeof EnvironmentAuthorizationError, never, never> | Rpc.Rpc<"
|
|
5005
|
+
}>, typeof EnvironmentAuthorizationError, never, never> | Rpc.Rpc<"cloud.getRelayClientStatus", Schema.Struct<{}>, Schema.Union<readonly [Schema.Struct<{
|
|
5006
|
+
readonly status: Schema.Literal<"available">;
|
|
5007
|
+
readonly executablePath: Schema.String;
|
|
5008
|
+
readonly source: Schema.Literals<readonly ["override", "managed", "path"]>;
|
|
5009
|
+
readonly version: Schema.String;
|
|
5010
|
+
}>, Schema.Struct<{
|
|
5011
|
+
readonly status: Schema.Literal<"missing">;
|
|
5012
|
+
readonly version: Schema.String;
|
|
5013
|
+
}>, Schema.Struct<{
|
|
5014
|
+
readonly status: Schema.Literal<"unsupported">;
|
|
5015
|
+
readonly platform: Schema.String;
|
|
5016
|
+
readonly arch: Schema.String;
|
|
5017
|
+
readonly version: Schema.String;
|
|
5018
|
+
}>]>, typeof EnvironmentAuthorizationError, never, never> | Rpc.Rpc<"cloud.installRelayClient", Schema.Struct<{}>, import("effect/unstable/rpc/RpcSchema").Stream<Schema.Union<readonly [Schema.Struct<{
|
|
5019
|
+
readonly type: Schema.Literal<"progress">;
|
|
5020
|
+
readonly stage: Schema.Literals<readonly ["checking", "waiting_for_lock", "downloading", "verifying", "installing", "validating", "activating"]>;
|
|
5021
|
+
}>, Schema.Struct<{
|
|
5022
|
+
readonly type: Schema.Literal<"complete">;
|
|
5023
|
+
readonly status: Schema.Union<readonly [Schema.Struct<{
|
|
5024
|
+
readonly status: Schema.Literal<"available">;
|
|
5025
|
+
readonly executablePath: Schema.String;
|
|
5026
|
+
readonly source: Schema.Literals<readonly ["override", "managed", "path"]>;
|
|
5027
|
+
readonly version: Schema.String;
|
|
5028
|
+
}>, Schema.Struct<{
|
|
5029
|
+
readonly status: Schema.Literal<"missing">;
|
|
5030
|
+
readonly version: Schema.String;
|
|
5031
|
+
}>, Schema.Struct<{
|
|
5032
|
+
readonly status: Schema.Literal<"unsupported">;
|
|
5033
|
+
readonly platform: Schema.String;
|
|
5034
|
+
readonly arch: Schema.String;
|
|
5035
|
+
readonly version: Schema.String;
|
|
5036
|
+
}>]>;
|
|
5037
|
+
}>]>, Schema.Union<readonly [typeof RelayClientInstallFailedError, typeof EnvironmentAuthorizationError]>>, Schema.Never, never, never> | Rpc.Rpc<"sourceControl.lookupRepository", Schema.Struct<{
|
|
4969
5038
|
readonly provider: Schema.Literals<readonly ["github", "gitlab", "azure-devops", "bitbucket", "unknown"]>;
|
|
4970
5039
|
readonly repository: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
4971
5040
|
readonly cwd: Schema.optional<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -7615,7 +7684,7 @@ export declare const WsRpcGroup: RpcGroup.RpcGroup<Rpc.Rpc<"server.upsertKeybind
|
|
|
7615
7684
|
readonly auth: Schema.Struct<{
|
|
7616
7685
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
7617
7686
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
7618
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
7687
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
7619
7688
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
7620
7689
|
}>;
|
|
7621
7690
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -8080,7 +8149,7 @@ export declare const WsRpcGroup: RpcGroup.RpcGroup<Rpc.Rpc<"server.upsertKeybind
|
|
|
8080
8149
|
readonly sessionId: Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "AuthSessionId">;
|
|
8081
8150
|
readonly subject: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
8082
8151
|
readonly scopes: Schema.$Array<Schema.Literals<readonly ["orchestration:read", "orchestration:operate", "terminal:operate", "review:write", "access:read", "access:write", "relay:read", "relay:write"]>>;
|
|
8083
|
-
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>;
|
|
8152
|
+
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>;
|
|
8084
8153
|
readonly client: Schema.Struct<{
|
|
8085
8154
|
readonly label: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
8086
8155
|
readonly ipAddress: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -8124,7 +8193,7 @@ export declare const WsRpcGroup: RpcGroup.RpcGroup<Rpc.Rpc<"server.upsertKeybind
|
|
|
8124
8193
|
readonly sessionId: Schema.brand<Schema.decodeTo<Schema.String, Schema.String, never, never>, "AuthSessionId">;
|
|
8125
8194
|
readonly subject: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
8126
8195
|
readonly scopes: Schema.$Array<Schema.Literals<readonly ["orchestration:read", "orchestration:operate", "terminal:operate", "review:write", "access:read", "access:write", "relay:read", "relay:write"]>>;
|
|
8127
|
-
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>;
|
|
8196
|
+
readonly method: Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>;
|
|
8128
8197
|
readonly client: Schema.Struct<{
|
|
8129
8198
|
readonly label: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
8130
8199
|
readonly ipAddress: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
@@ -546,7 +546,7 @@ export declare const ServerConfig: Schema.Struct<{
|
|
|
546
546
|
readonly auth: Schema.Struct<{
|
|
547
547
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
548
548
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
549
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
549
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
550
550
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
551
551
|
}>;
|
|
552
552
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -1222,7 +1222,7 @@ export declare const ServerConfigStreamSnapshotEvent: Schema.Struct<{
|
|
|
1222
1222
|
readonly auth: Schema.Struct<{
|
|
1223
1223
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
1224
1224
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
1225
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
1225
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
1226
1226
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1227
1227
|
}>;
|
|
1228
1228
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
@@ -1655,7 +1655,7 @@ export declare const ServerConfigStreamEvent: Schema.Union<readonly [Schema.Stru
|
|
|
1655
1655
|
readonly auth: Schema.Struct<{
|
|
1656
1656
|
readonly policy: Schema.Literals<readonly ["desktop-managed-local", "loopback-browser", "remote-reachable", "unsafe-no-auth"]>;
|
|
1657
1657
|
readonly bootstrapMethods: Schema.$Array<Schema.Literals<readonly ["desktop-bootstrap", "one-time-token"]>>;
|
|
1658
|
-
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token"]>>;
|
|
1658
|
+
readonly sessionMethods: Schema.$Array<Schema.Literals<readonly ["browser-session-cookie", "bearer-access-token", "dpop-access-token"]>>;
|
|
1659
1659
|
readonly sessionCookieName: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
1660
1660
|
}>;
|
|
1661
1661
|
readonly cwd: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "t3code-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CLI for t3code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@effect/platform-node": "4.0.0-beta.
|
|
44
|
-
"effect": "4.0.0-beta.
|
|
43
|
+
"@effect/platform-node": "4.0.0-beta.78",
|
|
44
|
+
"effect": "4.0.0-beta.78"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@changesets/cli": "^2.31.0",
|
package/src/auth/error.ts
CHANGED
|
@@ -38,9 +38,41 @@ const AuthLocalErrorCauseSchema = Schema.Union([
|
|
|
38
38
|
UrlError,
|
|
39
39
|
]);
|
|
40
40
|
|
|
41
|
+
export class AuthLocalSecretError extends Schema.TaggedErrorClass<AuthLocalSecretError>()(
|
|
42
|
+
"AuthLocalSecretError",
|
|
43
|
+
{
|
|
44
|
+
message: Schema.String,
|
|
45
|
+
cause: Schema.optionalKey(Schema.instanceOf(PlatformError)),
|
|
46
|
+
},
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
export class AuthLocalDatabaseError extends Schema.TaggedErrorClass<AuthLocalDatabaseError>()(
|
|
50
|
+
"AuthLocalDatabaseError",
|
|
51
|
+
{
|
|
52
|
+
operation: Schema.Literals(["connect", "query", "schema"]),
|
|
53
|
+
message: Schema.String,
|
|
54
|
+
},
|
|
55
|
+
) {}
|
|
56
|
+
|
|
57
|
+
export class AuthLocalSigningError extends Schema.TaggedErrorClass<AuthLocalSigningError>()(
|
|
58
|
+
"AuthLocalSigningError",
|
|
59
|
+
{
|
|
60
|
+
operation: Schema.Literals(["sign"]),
|
|
61
|
+
message: Schema.String,
|
|
62
|
+
cause: Schema.optionalKey(Schema.instanceOf(PlatformError)),
|
|
63
|
+
},
|
|
64
|
+
) {}
|
|
65
|
+
|
|
41
66
|
export class AuthLocalError extends Schema.TaggedErrorClass<AuthLocalError>()("AuthLocalError", {
|
|
42
67
|
message: Schema.String,
|
|
43
|
-
cause: Schema.optionalKey(
|
|
68
|
+
cause: Schema.optionalKey(
|
|
69
|
+
Schema.Union([
|
|
70
|
+
AuthLocalErrorCauseSchema,
|
|
71
|
+
AuthLocalSecretError,
|
|
72
|
+
AuthLocalDatabaseError,
|
|
73
|
+
AuthLocalSigningError,
|
|
74
|
+
]),
|
|
75
|
+
),
|
|
44
76
|
}) {}
|
|
45
77
|
|
|
46
78
|
export type AuthError = AuthPairingUrlError | AuthConfigError | AuthTransportError | AuthLocalError;
|
package/src/auth/layer.ts
CHANGED
|
@@ -1,83 +1,18 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as FileSystem from "effect/FileSystem";
|
|
3
2
|
import * as Layer from "effect/Layer";
|
|
4
|
-
import * as Path from "effect/Path";
|
|
5
|
-
import * as Scope from "effect/Scope";
|
|
6
|
-
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
7
3
|
|
|
8
4
|
import { T3Config } from "../config/service.ts";
|
|
9
|
-
import { Environment } from "../environment/service.ts";
|
|
10
5
|
import { AuthConfigError } from "./error.ts";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import { T3LocalAuth } from "./local.ts";
|
|
7
|
+
import { T3AuthPairing } from "./pairing.ts";
|
|
13
8
|
import { T3Auth } from "./service.ts";
|
|
14
|
-
import {
|
|
15
|
-
import type { LocalAuthInput } from "./type.ts";
|
|
9
|
+
import { T3AuthTransport } from "./transport.ts";
|
|
16
10
|
|
|
17
11
|
export const makeT3Auth = Effect.fn("makeT3Auth")(function* () {
|
|
18
12
|
const config = yield* T3Config;
|
|
19
|
-
const transport = yield*
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const path = yield* Path.Path;
|
|
23
|
-
const environment = yield* Environment;
|
|
24
|
-
const scope = yield* Scope.Scope;
|
|
25
|
-
|
|
26
|
-
const pair = Effect.fn("T3AuthLive.pair")(function* (pairingUrl: string) {
|
|
27
|
-
const parsed = yield* parsePairingUrl(pairingUrl);
|
|
28
|
-
const result = yield* transport.bootstrapBearer(parsed);
|
|
29
|
-
const existing = yield* config.readStored().pipe(
|
|
30
|
-
Effect.catchTags({
|
|
31
|
-
ConfigError: (error) =>
|
|
32
|
-
Effect.fail(new AuthConfigError({ message: "auth config failed", cause: error })),
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
|
-
yield* config
|
|
36
|
-
.writeStored({ ...existing, url: parsed.baseUrl, token: result.sessionToken })
|
|
37
|
-
.pipe(
|
|
38
|
-
Effect.catchTags({
|
|
39
|
-
ConfigError: (error) =>
|
|
40
|
-
Effect.fail(new AuthConfigError({ message: "auth config failed", cause: error })),
|
|
41
|
-
}),
|
|
42
|
-
);
|
|
43
|
-
return { url: parsed.baseUrl, role: result.role, expiresAt: result.expiresAt };
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const local = Effect.fn("T3AuthLive.local")(function* (input: LocalAuthInput) {
|
|
47
|
-
const issued = yield* issueLocalSession(input).pipe(
|
|
48
|
-
Effect.provideService(ChildProcessSpawner, spawner),
|
|
49
|
-
Effect.provideService(FileSystem.FileSystem, fs),
|
|
50
|
-
Effect.provideService(Path.Path, path),
|
|
51
|
-
Effect.provideService(Environment, environment),
|
|
52
|
-
Effect.provideService(Scope.Scope, scope),
|
|
53
|
-
);
|
|
54
|
-
const url = yield* resolveLocalOrigin({
|
|
55
|
-
baseDir: issued.baseDir,
|
|
56
|
-
...(input.origin !== undefined ? { origin: input.origin } : {}),
|
|
57
|
-
}).pipe(
|
|
58
|
-
Effect.provideService(FileSystem.FileSystem, fs),
|
|
59
|
-
Effect.provideService(Path.Path, path),
|
|
60
|
-
);
|
|
61
|
-
const existing = yield* config.readStored().pipe(
|
|
62
|
-
Effect.catchTags({
|
|
63
|
-
ConfigError: (error) =>
|
|
64
|
-
Effect.fail(new AuthConfigError({ message: "auth config failed", cause: error })),
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
yield* config.writeStored({ ...existing, url, token: issued.session.token }).pipe(
|
|
68
|
-
Effect.catchTags({
|
|
69
|
-
ConfigError: (error) =>
|
|
70
|
-
Effect.fail(new AuthConfigError({ message: "auth config failed", cause: error })),
|
|
71
|
-
}),
|
|
72
|
-
);
|
|
73
|
-
return {
|
|
74
|
-
url,
|
|
75
|
-
role: issued.session.role,
|
|
76
|
-
expiresAt: issued.session.expiresAt,
|
|
77
|
-
source: "local" as const,
|
|
78
|
-
baseDir: issued.baseDir,
|
|
79
|
-
};
|
|
80
|
-
});
|
|
13
|
+
const transport = yield* T3AuthTransport;
|
|
14
|
+
const localAuth = yield* T3LocalAuth;
|
|
15
|
+
const pairing = yield* T3AuthPairing;
|
|
81
16
|
|
|
82
17
|
const status = Effect.fn("T3AuthLive.status")(function* () {
|
|
83
18
|
const resolved = yield* config.resolve().pipe(
|
|
@@ -91,7 +26,7 @@ export const makeT3Auth = Effect.fn("makeT3Auth")(function* () {
|
|
|
91
26
|
return yield* transport.getSession(resolved);
|
|
92
27
|
});
|
|
93
28
|
|
|
94
|
-
const
|
|
29
|
+
const issueWebSocketTicket = Effect.fn("T3AuthLive.issueWebSocketTicket")(function* () {
|
|
95
30
|
const resolved = yield* config.resolve().pipe(
|
|
96
31
|
Effect.catchTags({
|
|
97
32
|
ConfigError: (error) =>
|
|
@@ -100,14 +35,14 @@ export const makeT3Auth = Effect.fn("makeT3Auth")(function* () {
|
|
|
100
35
|
Effect.fail(new AuthConfigError({ message: "auth config failed", cause: error })),
|
|
101
36
|
}),
|
|
102
37
|
);
|
|
103
|
-
return yield* transport.
|
|
38
|
+
return yield* transport.issueWebSocketTicket(resolved);
|
|
104
39
|
});
|
|
105
40
|
|
|
106
41
|
return {
|
|
107
|
-
pair,
|
|
108
|
-
local,
|
|
42
|
+
pair: pairing.pair,
|
|
43
|
+
local: localAuth.local,
|
|
109
44
|
status,
|
|
110
|
-
|
|
45
|
+
issueWebSocketTicket,
|
|
111
46
|
};
|
|
112
47
|
});
|
|
113
48
|
|