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.
Files changed (101) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +412 -87
  3. package/dist/index.js +1 -1
  4. package/dist/{runtime-CMPZpQaG.js → runtime-Cq64iuZr.js} +4768 -2040
  5. package/dist/src/application/error.d.ts +3 -0
  6. package/dist/src/application/layer.d.ts +776 -0
  7. package/dist/src/application/model-selection.d.ts +19 -0
  8. package/dist/src/application/models.d.ts +93 -0
  9. package/dist/src/application/project-commands.d.ts +15 -0
  10. package/dist/src/application/projects.d.ts +136 -0
  11. package/dist/src/application/service.d.ts +72 -0
  12. package/dist/src/application/shell-sequence.d.ts +91 -0
  13. package/dist/src/application/thread-commands.d.ts +84 -0
  14. package/dist/src/application/thread-wait.d.ts +104 -0
  15. package/dist/src/application/threads.d.ts +563 -0
  16. package/dist/src/auth/error.d.ts +50 -0
  17. package/dist/src/auth/layer.d.ts +23 -0
  18. package/dist/src/auth/local.d.ts +27 -0
  19. package/dist/src/auth/pairing.d.ts +22 -0
  20. package/dist/src/auth/schema.d.ts +58 -0
  21. package/dist/src/auth/service.d.ts +14 -0
  22. package/dist/src/auth/transport.d.ts +19 -0
  23. package/dist/src/auth/type.d.ts +25 -0
  24. package/dist/src/config/error.d.ts +18 -0
  25. package/dist/src/config/layer.d.ts +20 -0
  26. package/dist/src/config/service.d.ts +20 -0
  27. package/dist/src/config/url.d.ts +6 -0
  28. package/dist/src/domain/error.d.ts +31 -0
  29. package/dist/src/domain/helpers.d.ts +38 -0
  30. package/dist/src/domain/model-config.d.ts +293 -0
  31. package/dist/src/domain/thread-lifecycle.d.ts +114 -0
  32. package/dist/src/environment/layer.d.ts +3 -0
  33. package/dist/src/environment/service.d.ts +12 -0
  34. package/dist/src/index.d.ts +6 -0
  35. package/dist/src/orchestration/layer.d.ts +2128 -0
  36. package/dist/src/orchestration/service.d.ts +27 -0
  37. package/dist/src/rpc/error.d.ts +15 -0
  38. package/dist/src/rpc/layer.d.ts +4678 -0
  39. package/dist/src/rpc/service.d.ts +15 -0
  40. package/dist/src/rpc/ws-group.d.ts +2238 -0
  41. package/dist/src/runtime.d.ts +3 -0
  42. package/dist/src/sql/node-sqlite-client.d.ts +10 -0
  43. package/dist/src/sql/service.d.ts +17 -0
  44. package/dist/upstream-t3code/packages/contracts/src/auth.d.ts +441 -0
  45. package/dist/upstream-t3code/packages/contracts/src/baseSchemas.d.ts +38 -0
  46. package/dist/upstream-t3code/packages/contracts/src/desktopBootstrap.d.ts +14 -0
  47. package/dist/upstream-t3code/packages/contracts/src/editor.d.ts +124 -0
  48. package/dist/upstream-t3code/packages/contracts/src/environment.d.ts +64 -0
  49. package/dist/upstream-t3code/packages/contracts/src/environmentHttp.d.ts +762 -0
  50. package/dist/upstream-t3code/packages/contracts/src/filesystem.d.ts +26 -0
  51. package/dist/upstream-t3code/packages/contracts/src/git.d.ts +500 -0
  52. package/dist/upstream-t3code/packages/contracts/src/index.d.ts +25 -0
  53. package/dist/upstream-t3code/packages/contracts/src/ipc.d.ts +490 -0
  54. package/dist/upstream-t3code/packages/contracts/src/keybindings.d.ts +133 -0
  55. package/dist/upstream-t3code/packages/contracts/src/model.d.ts +112 -0
  56. package/dist/upstream-t3code/packages/contracts/src/orchestration.d.ts +6682 -0
  57. package/dist/upstream-t3code/packages/contracts/src/project.d.ts +45 -0
  58. package/dist/upstream-t3code/packages/contracts/src/provider.d.ts +116 -0
  59. package/dist/upstream-t3code/packages/contracts/src/providerInstance.d.ts +99 -0
  60. package/dist/upstream-t3code/packages/contracts/src/providerRuntime.d.ts +4276 -0
  61. package/dist/upstream-t3code/packages/contracts/src/relay.d.ts +1262 -0
  62. package/dist/upstream-t3code/packages/contracts/src/relayClient.d.ts +48 -0
  63. package/dist/upstream-t3code/packages/contracts/src/remoteAccess.d.ts +45 -0
  64. package/dist/upstream-t3code/packages/contracts/src/review.d.ts +37 -0
  65. package/dist/upstream-t3code/packages/contracts/src/rpc.d.ts +8218 -0
  66. package/dist/upstream-t3code/packages/contracts/src/server.d.ts +2291 -0
  67. package/dist/upstream-t3code/packages/contracts/src/settings.d.ts +271 -0
  68. package/dist/upstream-t3code/packages/contracts/src/sourceControl.d.ts +177 -0
  69. package/dist/upstream-t3code/packages/contracts/src/terminal.d.ts +330 -0
  70. package/dist/upstream-t3code/packages/contracts/src/vcs.d.ts +148 -0
  71. package/package.json +15 -7
  72. package/src/application/model-selection.ts +2 -2
  73. package/src/application/project-commands.ts +1 -1
  74. package/src/application/service.ts +1 -1
  75. package/src/application/shell-sequence.ts +1 -1
  76. package/src/application/thread-commands.ts +1 -1
  77. package/src/application/thread-wait.ts +1 -1
  78. package/src/auth/error.ts +33 -1
  79. package/src/auth/layer.ts +11 -76
  80. package/src/auth/local.ts +342 -208
  81. package/src/auth/pairing.ts +44 -2
  82. package/src/auth/schema.ts +21 -28
  83. package/src/auth/service.ts +2 -2
  84. package/src/auth/transport.ts +59 -22
  85. package/src/auth/type.ts +0 -1
  86. package/src/cli/auth.ts +1 -3
  87. package/src/cli/model-format.ts +1 -1
  88. package/src/cli/project-format.ts +1 -1
  89. package/src/cli/thread-format.ts +1 -1
  90. package/src/domain/helpers.ts +1 -1
  91. package/src/domain/model-config.ts +1 -1
  92. package/src/domain/thread-lifecycle.ts +1 -1
  93. package/src/index.ts +3 -3
  94. package/src/orchestration/layer.ts +1 -1
  95. package/src/orchestration/service.ts +1 -1
  96. package/src/rpc/error.ts +1 -1
  97. package/src/rpc/layer.ts +2 -2
  98. package/src/rpc/ws-group.ts +1 -1
  99. package/src/runtime.ts +14 -1
  100. package/src/sql/node-sqlite-client.ts +141 -0
  101. 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 { issueLocalSession, resolveLocalOrigin } from "./local.ts";
12
- import { parsePairingUrl } from "./pairing.ts";
6
+ import { T3LocalAuth } from "./local.ts";
7
+ import { T3AuthPairing } from "./pairing.ts";
13
8
  import { T3Auth } from "./service.ts";
14
- import { makeAuthTransport } from "./transport.ts";
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* makeAuthTransport();
20
- const spawner = yield* ChildProcessSpawner;
21
- const fs = yield* FileSystem.FileSystem;
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 issueWebSocketToken = Effect.fn("T3AuthLive.issueWebSocketToken")(function* () {
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.issueWebSocketToken(resolved);
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
- issueWebSocketToken,
45
+ issueWebSocketTicket,
111
46
  };
112
47
  });
113
48