t3code-cli 0.2.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/error.d.ts +3 -0
- package/dist/src/application/layer.d.ts +776 -0
- package/dist/src/application/model-selection.d.ts +19 -0
- package/dist/src/application/models.d.ts +93 -0
- package/dist/src/application/project-commands.d.ts +15 -0
- package/dist/src/application/projects.d.ts +136 -0
- package/dist/src/application/service.d.ts +72 -0
- package/dist/src/application/shell-sequence.d.ts +91 -0
- package/dist/src/application/thread-commands.d.ts +84 -0
- package/dist/src/application/thread-wait.d.ts +104 -0
- package/dist/src/application/threads.d.ts +563 -0
- package/dist/src/auth/error.d.ts +50 -0
- package/dist/src/auth/layer.d.ts +23 -0
- package/dist/src/auth/local.d.ts +27 -0
- package/dist/src/auth/pairing.d.ts +22 -0
- package/dist/src/auth/schema.d.ts +58 -0
- package/dist/src/auth/service.d.ts +14 -0
- package/dist/src/auth/transport.d.ts +19 -0
- package/dist/src/auth/type.d.ts +25 -0
- package/dist/src/config/error.d.ts +18 -0
- package/dist/src/config/layer.d.ts +20 -0
- package/dist/src/config/service.d.ts +20 -0
- package/dist/src/config/url.d.ts +6 -0
- package/dist/src/domain/error.d.ts +31 -0
- package/dist/src/domain/helpers.d.ts +38 -0
- package/dist/src/domain/model-config.d.ts +293 -0
- package/dist/src/domain/thread-lifecycle.d.ts +114 -0
- package/dist/src/environment/layer.d.ts +3 -0
- package/dist/src/environment/service.d.ts +12 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/orchestration/layer.d.ts +2128 -0
- package/dist/src/orchestration/service.d.ts +27 -0
- package/dist/src/rpc/error.d.ts +15 -0
- package/dist/src/rpc/layer.d.ts +4678 -0
- package/dist/src/rpc/service.d.ts +15 -0
- package/dist/src/rpc/ws-group.d.ts +2238 -0
- package/dist/src/runtime.d.ts +3 -0
- 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 +441 -0
- package/dist/upstream-t3code/packages/contracts/src/baseSchemas.d.ts +38 -0
- package/dist/upstream-t3code/packages/contracts/src/desktopBootstrap.d.ts +14 -0
- package/dist/upstream-t3code/packages/contracts/src/editor.d.ts +124 -0
- package/dist/upstream-t3code/packages/contracts/src/environment.d.ts +64 -0
- package/dist/upstream-t3code/packages/contracts/src/environmentHttp.d.ts +762 -0
- package/dist/upstream-t3code/packages/contracts/src/filesystem.d.ts +26 -0
- package/dist/upstream-t3code/packages/contracts/src/git.d.ts +500 -0
- package/dist/upstream-t3code/packages/contracts/src/index.d.ts +25 -0
- package/dist/upstream-t3code/packages/contracts/src/ipc.d.ts +490 -0
- package/dist/upstream-t3code/packages/contracts/src/keybindings.d.ts +133 -0
- package/dist/upstream-t3code/packages/contracts/src/model.d.ts +112 -0
- package/dist/upstream-t3code/packages/contracts/src/orchestration.d.ts +6682 -0
- package/dist/upstream-t3code/packages/contracts/src/project.d.ts +45 -0
- package/dist/upstream-t3code/packages/contracts/src/provider.d.ts +116 -0
- package/dist/upstream-t3code/packages/contracts/src/providerInstance.d.ts +99 -0
- package/dist/upstream-t3code/packages/contracts/src/providerRuntime.d.ts +4276 -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/remoteAccess.d.ts +45 -0
- package/dist/upstream-t3code/packages/contracts/src/review.d.ts +37 -0
- package/dist/upstream-t3code/packages/contracts/src/rpc.d.ts +8218 -0
- package/dist/upstream-t3code/packages/contracts/src/server.d.ts +2291 -0
- package/dist/upstream-t3code/packages/contracts/src/settings.d.ts +271 -0
- package/dist/upstream-t3code/packages/contracts/src/sourceControl.d.ts +177 -0
- package/dist/upstream-t3code/packages/contracts/src/terminal.d.ts +330 -0
- package/dist/upstream-t3code/packages/contracts/src/vcs.d.ts +148 -0
- package/package.json +15 -7
- package/src/application/model-selection.ts +2 -2
- package/src/application/project-commands.ts +1 -1
- package/src/application/service.ts +1 -1
- package/src/application/shell-sequence.ts +1 -1
- package/src/application/thread-commands.ts +1 -1
- package/src/application/thread-wait.ts +1 -1
- 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/cli/model-format.ts +1 -1
- package/src/cli/project-format.ts +1 -1
- package/src/cli/thread-format.ts +1 -1
- package/src/domain/helpers.ts +1 -1
- package/src/domain/model-config.ts +1 -1
- package/src/domain/thread-lifecycle.ts +1 -1
- package/src/index.ts +3 -3
- package/src/orchestration/layer.ts +1 -1
- package/src/orchestration/service.ts +1 -1
- package/src/rpc/error.ts +1 -1
- package/src/rpc/layer.ts +2 -2
- package/src/rpc/ws-group.ts +1 -1
- package/src/runtime.ts +14 -1
- package/src/sql/node-sqlite-client.ts +141 -0
- package/src/sql/service.ts +21 -0
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
|
|