t3code-cli 0.8.0 → 0.9.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 (59) hide show
  1. package/README.md +90 -35
  2. package/dist/application.js +1 -1
  3. package/dist/auth.js +1 -2
  4. package/dist/bin.js +189 -44
  5. package/dist/cli.js +1 -1
  6. package/dist/config.js +1 -3
  7. package/dist/connection.js +1 -4
  8. package/dist/index.js +1 -4
  9. package/dist/layout.js +1 -1
  10. package/dist/orchestration.js +1 -1
  11. package/dist/rpc.js +1 -1
  12. package/dist/runtime.js +1 -2
  13. package/dist/scope.js +1 -1
  14. package/dist/shared.js +85492 -0
  15. package/dist/src/application/layer.d.ts +25 -2
  16. package/dist/src/application/projects.d.ts +1 -1
  17. package/dist/src/application/service.d.ts +21 -1
  18. package/dist/src/application/thread-commands.d.ts +27 -1
  19. package/dist/src/application/threads.d.ts +50 -1
  20. package/dist/src/domain/thread-activities.d.ts +14 -0
  21. package/dist/src/domain/thread-lifecycle.d.ts +1 -0
  22. package/dist/src/runtime/layer.d.ts +1 -1
  23. package/dist/t3tools.js +1 -1
  24. package/package.json +1 -1
  25. package/src/application/service.ts +19 -0
  26. package/src/application/thread-commands.ts +45 -0
  27. package/src/application/threads.ts +85 -0
  28. package/src/cli/error.ts +15 -0
  29. package/src/cli/message-input.ts +30 -0
  30. package/src/cli/thread-format.ts +47 -0
  31. package/src/cli/thread.ts +6 -0
  32. package/src/cli/threads/approve.ts +61 -0
  33. package/src/cli/threads/archive.ts +18 -3
  34. package/src/cli/threads/respond.ts +70 -0
  35. package/src/cli/threads/show.ts +43 -0
  36. package/src/domain/thread-activities.test.ts +321 -0
  37. package/src/domain/thread-activities.ts +244 -0
  38. package/src/domain/thread-lifecycle.ts +2 -0
  39. package/dist/Context-DueQ9iMH.js +0 -4916
  40. package/dist/Path-D8WPdPwR.js +0 -11406
  41. package/dist/Schema-DsQxYh6_.js +0 -13581
  42. package/dist/UrlParams-BA6gBvaY.js +0 -205
  43. package/dist/base-dir-R12OMDso.js +0 -20
  44. package/dist/error-BHRnjLux.js +0 -15
  45. package/dist/error-ChTsLQTu.js +0 -169
  46. package/dist/error-CjADNVm8.js +0 -54
  47. package/dist/flags-CM7_iGdA.js +0 -13371
  48. package/dist/layer-CMo36MrX.js +0 -29466
  49. package/dist/layer-DHhKS5jd.js +0 -13
  50. package/dist/layer-DUv99vsS.js +0 -72
  51. package/dist/layer-Do8wK1t6.js +0 -1508
  52. package/dist/layer-DwI3Skkh.js +0 -1223
  53. package/dist/scope-GycYiJ54.js +0 -29
  54. package/dist/service-CLmRO2Dp.js +0 -8
  55. package/dist/service-ybOWV9pL.js +0 -5
  56. package/dist/src-aiFPmAG7.js +0 -9030
  57. package/dist/transport-MI0Z3d2T.js +0 -539
  58. package/dist/url-SlsaG8nY.js +0 -165
  59. /package/dist/{chunk-B5meny8j.js → rolldown-runtime.js} +0 -0
@@ -1,205 +0,0 @@
1
- import { J as make$1, On as dual, Xt as symbol, Y as strictEqual, Zt as array, in as symbol$1, it as PipeInspectableProto } from "./Context-DueQ9iMH.js";
2
- import { Gr as append, Jr as filter, Yr as fromIterable, ci as makeEquivalence$1, ei as makeEquivalence, li as fail, on as TaggedError, pi as succeed } from "./Path-D8WPdPwR.js";
3
- import "./Schema-DsQxYh6_.js";
4
- //#region node_modules/.pnpm/effect@4.0.0-beta.78/node_modules/effect/dist/unstable/http/UrlParams.js
5
- /**
6
- * Immutable URL query parameters represented as ordered string pairs.
7
- *
8
- * This module is the shared query-parameter model for HTTP client request
9
- * queries, URL-encoded form bodies, and server-side decoding. A `UrlParams`
10
- * value can be built from records, iterables, or native `URLSearchParams`, then
11
- * inspected, appended, replaced, removed, serialized, converted to a `URL`, or
12
- * decoded with schemas.
13
- *
14
- * **Mental model**
15
- *
16
- * The core representation is a list of `[key, value]` string pairs. Duplicate
17
- * keys and pair order are preserved by `make`, `fromInput`, iteration, and
18
- * append-style operations. Record input is a convenience layer: primitive values
19
- * become strings, arrays become repeated parameters, nested records use bracket
20
- * notation, and `undefined` fields are skipped.
21
- *
22
- * **Common tasks**
23
- *
24
- * - Build query parameters from plain records, tuples, or `URLSearchParams`.
25
- * - Read the first, last, or all values for a key.
26
- * - Replace, append, transform, or remove keys without mutating the original.
27
- * - Serialize a query string, merge parameters into a URL, or decode records and
28
- * JSON fields with schemas.
29
- *
30
- * **Gotchas**
31
- *
32
- * Use `getAll` when every duplicate value matters. `set` and `setAll` replace
33
- * existing values for matching keys, while `append` and `appendAll` preserve
34
- * them. Serialization through `toString` and `makeUrl` delegates to the platform
35
- * `URLSearchParams` / `URL` implementations, so pass decoded strings rather
36
- * than pre-encoded query fragments. Record-based and schema-based conversions
37
- * collapse repeated keys into string arrays and do not preserve the full global
38
- * pair ordering; `schemaJsonField` reads the first matching value for the
39
- * selected field.
40
- *
41
- * @since 4.0.0
42
- */
43
- const TypeId = "~effect/http/UrlParams";
44
- const Proto = {
45
- ...PipeInspectableProto,
46
- [TypeId]: TypeId,
47
- [Symbol.iterator]() {
48
- return this.params[Symbol.iterator]();
49
- },
50
- toJSON() {
51
- return {
52
- _id: "UrlParams",
53
- params: Object.fromEntries(this.params)
54
- };
55
- },
56
- [symbol](that) {
57
- return Equivalence(this, that);
58
- },
59
- [symbol$1]() {
60
- return array(this.params.flat());
61
- }
62
- };
63
- /**
64
- * Creates `UrlParams` from ordered string key-value pairs.
65
- *
66
- * **Details**
67
- *
68
- * The input pairs are used as-is and are not coerced or normalized.
69
- *
70
- * @category constructors
71
- * @since 4.0.0
72
- */
73
- const make = (params) => {
74
- const self = Object.create(Proto);
75
- self.params = params;
76
- return self;
77
- };
78
- /**
79
- * Creates `UrlParams` from a supported input shape.
80
- *
81
- * **Details**
82
- *
83
- * Primitive values are converted to strings, arrays produce repeated parameters,
84
- * nested records use bracket notation, and `undefined` values are omitted.
85
- *
86
- * @category constructors
87
- * @since 4.0.0
88
- */
89
- const fromInput = (input) => {
90
- const parsed = fromInputNested(input);
91
- const out = [];
92
- for (let i = 0; i < parsed.length; i++) if (Array.isArray(parsed[i][0])) {
93
- const [keys, value] = parsed[i];
94
- out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
95
- } else out.push(parsed[i]);
96
- return make(out);
97
- };
98
- const fromInputNested = (input) => {
99
- const entries = typeof input[Symbol.iterator] === "function" ? fromIterable(input) : Object.entries(input);
100
- const out = [];
101
- for (const [key, value] of entries) if (Array.isArray(value)) {
102
- for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, String(value[i])]);
103
- } else if (typeof value === "object") {
104
- const nested = fromInputNested(value);
105
- for (const [k, v] of nested) out.push([[key, ...typeof k === "string" ? [k] : k], v]);
106
- } else if (value !== void 0) out.push([key, String(value)]);
107
- return out;
108
- };
109
- /**
110
- * Provides an order-sensitive `Equivalence` instance for `UrlParams`.
111
- *
112
- * **Details**
113
- *
114
- * Two values are equivalent when they contain the same key-value pairs in the same
115
- * order.
116
- *
117
- * @category instances
118
- * @since 4.0.0
119
- */
120
- const Equivalence = /*#__PURE__*/ make$1((a, b) => arrayEquivalence(a.params, b.params));
121
- const arrayEquivalence = /*#__PURE__*/ makeEquivalence(/*#__PURE__*/ makeEquivalence$1([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ strictEqual()]));
122
- /**
123
- * An empty `UrlParams` value.
124
- *
125
- * @category constructors
126
- * @since 4.0.0
127
- */
128
- const empty = /*#__PURE__*/ make([]);
129
- /**
130
- * Sets a query parameter to a single value.
131
- *
132
- * **Details**
133
- *
134
- * Existing values for the same key are removed, and the new value is appended to
135
- * the end.
136
- *
137
- * @category combinators
138
- * @since 4.0.0
139
- */
140
- const set = /*#__PURE__*/ dual(3, (self, key, value) => make(append(filter(self.params, ([k]) => k !== key), [key, String(value)])));
141
- /**
142
- * Sets multiple query parameters from input.
143
- *
144
- * **Details**
145
- *
146
- * Keys present in the input replace existing values for those keys, while
147
- * unmentioned existing parameters are preserved.
148
- *
149
- * @category combinators
150
- * @since 4.0.0
151
- */
152
- const setAll = /*#__PURE__*/ dual(2, (self, input) => {
153
- const out = fromInput(input);
154
- const params = out.params;
155
- const keys = /* @__PURE__ */ new Set();
156
- for (let i = 0; i < params.length; i++) keys.add(params[i][0]);
157
- for (let i = 0; i < self.params.length; i++) {
158
- if (keys.has(self.params[i][0])) continue;
159
- params.push(self.params[i]);
160
- }
161
- return out;
162
- });
163
- /**
164
- * Error returned when constructing a `URL` from `UrlParams` fails.
165
- *
166
- * @category errors
167
- * @since 4.0.0
168
- */
169
- var UrlParamsError = class extends TaggedError("UrlParamsError") {};
170
- /**
171
- * Creates a `URL` safely by appending `UrlParams` and an optional hash to a URL string.
172
- *
173
- * **Details**
174
- *
175
- * Returns a `Result` that fails with `UrlParamsError` if the URL cannot be
176
- * constructed.
177
- *
178
- * @category converting
179
- * @since 4.0.0
180
- */
181
- const makeUrl = (url, params, hash) => {
182
- try {
183
- const urlInstance = new URL(url, baseUrl());
184
- for (let i = 0; i < params.params.length; i++) {
185
- const [key, value] = params.params[i];
186
- if (value !== void 0) urlInstance.searchParams.append(key, value);
187
- }
188
- if (hash !== void 0) urlInstance.hash = hash;
189
- return succeed(urlInstance);
190
- } catch (e) {
191
- return fail(new UrlParamsError({ cause: e }));
192
- }
193
- };
194
- /**
195
- * Serializes `UrlParams` to a URL query string without a leading question mark.
196
- *
197
- * @category converting
198
- * @since 4.0.0
199
- */
200
- const toString = (self) => new URLSearchParams(self.params).toString();
201
- const baseUrl = () => {
202
- if ("location" in globalThis && globalThis.location !== void 0 && globalThis.location.origin !== void 0 && globalThis.location.pathname !== void 0) return location.origin + location.pathname;
203
- };
204
- //#endregion
205
- export { setAll as a, set as i, fromInput as n, toString as o, makeUrl as r, empty as t };
@@ -1,20 +0,0 @@
1
- import { P as fn, t as Path } from "./Path-D8WPdPwR.js";
2
- import { homedir } from "node:os";
3
- //#region src/layout/base-dir.ts
4
- function readT3LayoutFromNodeProcess() {
5
- return {
6
- cwd: process.cwd(),
7
- homeDir: homedir(),
8
- t3codeHome: process.env["T3CODE_HOME"]
9
- };
10
- }
11
- const resolveT3BaseDir = fn("resolveT3BaseDir")(function* (input) {
12
- const path = yield* Path;
13
- const raw = input.baseDir ?? input.layout.t3codeHome;
14
- if (raw === void 0 || raw.length === 0) return path.join(input.layout.homeDir, ".t3");
15
- if (raw === "~") return input.layout.homeDir;
16
- if (raw.startsWith("~/") || raw.startsWith("~\\")) return path.join(input.layout.homeDir, raw.slice(2));
17
- return path.resolve(input.layout.cwd, raw);
18
- });
19
- //#endregion
20
- export { resolveT3BaseDir as n, readT3LayoutFromNodeProcess as t };
@@ -1,15 +0,0 @@
1
- import { cn as IllegalArgumentError, i as PlatformError } from "./Path-D8WPdPwR.js";
2
- import { R as instanceOf, T as Union, et as optionalKey, st as SchemaError, x as TaggedErrorClass, y as String } from "./Schema-DsQxYh6_.js";
3
- //#region src/config/error.ts
4
- const ConfigErrorCauseSchema = Union([instanceOf(PlatformError), instanceOf(SchemaError)]);
5
- var UrlError = class extends TaggedErrorClass()("UrlError", {
6
- message: String,
7
- protocol: optionalKey(String),
8
- cause: optionalKey(instanceOf(IllegalArgumentError))
9
- }) {};
10
- var ConfigError = class extends TaggedErrorClass()("ConfigError", {
11
- message: String,
12
- cause: optionalKey(ConfigErrorCauseSchema)
13
- }) {};
14
- //#endregion
15
- export { UrlError as n, ConfigError as t };
@@ -1,169 +0,0 @@
1
- import { $ as optional, E as Unknown, R as instanceOf, T as Union, a as Defect, et as optionalKey, nt as tag, s as ErrorClass, st as SchemaError, x as TaggedErrorClass, y as String } from "./Schema-DsQxYh6_.js";
2
- import { Rl as HttpClientErrorSchema, Uu as EnvironmentAuthorizationError, _s as OrchestrationDispatchCommandError, ji as KeybindingsConfigError, ui as ServerSettingsError, vl as SocketErrorReason, ws as OrchestrationGetSnapshotError } from "./src-aiFPmAG7.js";
3
- import { n as UrlError } from "./error-BHRnjLux.js";
4
- import { s as AuthTransportError } from "./error-CjADNVm8.js";
5
- //#region node_modules/.pnpm/effect@4.0.0-beta.78/node_modules/effect/dist/unstable/workers/WorkerError.js
6
- const TypeId$1 = "~effect/workers/WorkerError";
7
- /**
8
- * Worker error reason for failures while spawning or setting up a worker.
9
- *
10
- * @category models
11
- * @since 4.0.0
12
- */
13
- var WorkerSpawnError = class extends ErrorClass("effect/workers/WorkerError/WorkerSpawnError")({
14
- _tag: /*#__PURE__*/ tag("WorkerSpawnError"),
15
- message: String,
16
- cause: /*#__PURE__*/ optional(/*#__PURE__*/ Defect())
17
- }) {};
18
- /**
19
- * Worker error reason for failures while sending a message to a worker.
20
- *
21
- * @category models
22
- * @since 4.0.0
23
- */
24
- var WorkerSendError = class extends ErrorClass("effect/workers/WorkerError/WorkerSendError")({
25
- _tag: /*#__PURE__*/ tag("WorkerSendError"),
26
- message: String,
27
- cause: /*#__PURE__*/ optional(/*#__PURE__*/ Defect())
28
- }) {};
29
- /**
30
- * Worker error reason for failures while receiving or handling a message from a
31
- * worker.
32
- *
33
- * @category models
34
- * @since 4.0.0
35
- */
36
- var WorkerReceiveError = class extends ErrorClass("effect/workers/WorkerError/WorkerReceiveError")({
37
- _tag: /*#__PURE__*/ tag("WorkerReceiveError"),
38
- message: String,
39
- cause: /*#__PURE__*/ optional(/*#__PURE__*/ Defect())
40
- }) {};
41
- /**
42
- * Worker error reason for an unclassified worker failure.
43
- *
44
- * @category models
45
- * @since 4.0.0
46
- */
47
- var WorkerUnknownError = class extends ErrorClass("effect/workers/WorkerError/WorkerUnknownError")({
48
- _tag: /*#__PURE__*/ tag("WorkerUnknownError"),
49
- message: String,
50
- cause: /*#__PURE__*/ optional(/*#__PURE__*/ Defect())
51
- }) {};
52
- /**
53
- * Schema for decoding and encoding all supported worker error reason variants.
54
- *
55
- * @category models
56
- * @since 4.0.0
57
- */
58
- const WorkerErrorReason = /*#__PURE__*/ Union([
59
- WorkerSpawnError,
60
- WorkerSendError,
61
- WorkerReceiveError,
62
- WorkerUnknownError
63
- ]);
64
- ErrorClass(TypeId$1)({
65
- _tag: /*#__PURE__*/ tag("WorkerError"),
66
- reason: WorkerErrorReason
67
- });
68
- //#endregion
69
- //#region node_modules/.pnpm/effect@4.0.0-beta.78/node_modules/effect/dist/unstable/rpc/RpcClientError.js
70
- /**
71
- * Client-side protocol failures reported by unstable RPC transports.
72
- *
73
- * `RpcClientError` is the error type generated clients use when a call fails
74
- * before a remote handler can return its declared typed error. Its `reason`
75
- * covers built-in transport failures from HTTP, sockets, and workers, plus
76
- * `RpcClientDefect` values for malformed or incompatible protocol data.
77
- *
78
- * **Mental model**
79
- *
80
- * Handler errors belong to the RPC's declared error schema and are decoded from
81
- * the response exit. Client errors describe the client or transport boundary:
82
- * unavailable transport, aborted connections, unreadable response bodies,
83
- * failed response decoding, or protocol shapes that do not match the RPC group
84
- * the client was built for. Treat them as infrastructure or compatibility
85
- * failures rather than business-domain failures.
86
- *
87
- * **Common tasks**
88
- *
89
- * Inspect `error.reason._tag` to decide whether to retry, reconnect, report a
90
- * transport issue, or surface a schema or codec mismatch. Custom protocols can
91
- * use `RpcClientDefect` to put invalid client-side protocol state in the same
92
- * public error channel used by the built-in transports.
93
- *
94
- * **Gotchas**
95
- *
96
- * Server defects are sent through protocol messages and normally fail the call
97
- * as defects rather than as declared RPC errors. Serialization and schema
98
- * decode failures can appear as client defects because the client cannot safely
99
- * produce the typed success or error value promised by the RPC definition.
100
- *
101
- * @since 4.0.0
102
- */
103
- const TypeId = "~effect/rpc/RpcClientError";
104
- /**
105
- * Represents a client-side RPC defect, such as a protocol violation or
106
- * decoding failure, with a message and original cause.
107
- *
108
- * @category errors
109
- * @since 4.0.0
110
- */
111
- var RpcClientDefect = class extends ErrorClass("effect/rpc/RpcClientError/RpcClientDefect")({
112
- _tag: /*#__PURE__*/ tag("RpcClientDefect"),
113
- message: String,
114
- cause: /*#__PURE__*/ Defect()
115
- }) {};
116
- /**
117
- * Error wrapper for RPC client failures, including worker, socket, HTTP client,
118
- * and client protocol defect failures.
119
- *
120
- * @category errors
121
- * @since 4.0.0
122
- */
123
- var RpcClientError = class extends ErrorClass(TypeId)({
124
- _tag: /*#__PURE__*/ tag("RpcClientError"),
125
- reason: /*#__PURE__*/ Union([
126
- WorkerErrorReason,
127
- SocketErrorReason,
128
- HttpClientErrorSchema,
129
- RpcClientDefect
130
- ])
131
- }) {
132
- /**
133
- * Marks this value as an RPC client error for runtime guards.
134
- *
135
- * @since 4.0.0
136
- */
137
- [TypeId] = TypeId;
138
- get message() {
139
- return `${this.reason._tag}: ${this.reason.message}`;
140
- }
141
- };
142
- //#endregion
143
- //#region src/connection/error.ts
144
- var T3CodeConnectionError = class extends TaggedErrorClass()("T3CodeConnectionError", {
145
- message: String,
146
- cause: optionalKey(Unknown)
147
- }) {};
148
- //#endregion
149
- //#region src/rpc/error.ts
150
- const RpcErrorCauseSchema = Union([
151
- RpcClientError,
152
- EnvironmentAuthorizationError,
153
- KeybindingsConfigError,
154
- OrchestrationDispatchCommandError,
155
- OrchestrationGetSnapshotError,
156
- ServerSettingsError,
157
- AuthTransportError,
158
- T3CodeConnectionError,
159
- HttpClientErrorSchema,
160
- UrlError,
161
- instanceOf(SchemaError)
162
- ]);
163
- var RpcError = class extends TaggedErrorClass()("RpcError", {
164
- message: String,
165
- method: optionalKey(String),
166
- cause: optionalKey(RpcErrorCauseSchema)
167
- }) {};
168
- //#endregion
169
- export { RpcClientError as i, T3CodeConnectionError as n, RpcClientDefect as r, RpcError as t };
@@ -1,54 +0,0 @@
1
- import { cn as IllegalArgumentError, i as PlatformError } from "./Path-D8WPdPwR.js";
2
- import { R as instanceOf, T as Union, d as Literals, et as optionalKey, st as SchemaError, x as TaggedErrorClass, y as String } from "./Schema-DsQxYh6_.js";
3
- import { Rl as HttpClientErrorSchema } from "./src-aiFPmAG7.js";
4
- import { n as UrlError, t as ConfigError } from "./error-BHRnjLux.js";
5
- //#region src/auth/error.ts
6
- var AuthPairingUrlError = class extends TaggedErrorClass()("AuthPairingUrlError", {
7
- message: String,
8
- cause: optionalKey(instanceOf(IllegalArgumentError))
9
- }) {};
10
- var AuthConfigError = class extends TaggedErrorClass()("AuthConfigError", {
11
- message: String,
12
- cause: optionalKey(Union([ConfigError, UrlError]))
13
- }) {};
14
- var AuthTransportError = class extends TaggedErrorClass()("AuthTransportError", {
15
- message: String,
16
- cause: optionalKey(Union([
17
- HttpClientErrorSchema,
18
- instanceOf(SchemaError),
19
- UrlError
20
- ]))
21
- }) {};
22
- const AuthLocalErrorCauseSchema = Union([
23
- instanceOf(PlatformError),
24
- instanceOf(SchemaError),
25
- UrlError
26
- ]);
27
- var AuthLocalSecretError = class extends TaggedErrorClass()("AuthLocalSecretError", {
28
- message: String,
29
- cause: optionalKey(instanceOf(PlatformError))
30
- }) {};
31
- var AuthLocalDatabaseError = class extends TaggedErrorClass()("AuthLocalDatabaseError", {
32
- operation: Literals([
33
- "connect",
34
- "query",
35
- "schema"
36
- ]),
37
- message: String
38
- }) {};
39
- var AuthLocalSigningError = class extends TaggedErrorClass()("AuthLocalSigningError", {
40
- operation: Literals(["sign"]),
41
- message: String,
42
- cause: optionalKey(instanceOf(PlatformError))
43
- }) {};
44
- var AuthLocalError = class extends TaggedErrorClass()("AuthLocalError", {
45
- message: String,
46
- cause: optionalKey(Union([
47
- AuthLocalErrorCauseSchema,
48
- AuthLocalSecretError,
49
- AuthLocalDatabaseError,
50
- AuthLocalSigningError
51
- ]))
52
- }) {};
53
- //#endregion
54
- export { AuthLocalSigningError as a, AuthLocalSecretError as i, AuthLocalDatabaseError as n, AuthPairingUrlError as o, AuthLocalError as r, AuthTransportError as s, AuthConfigError as t };