t3code-cli 0.10.0 → 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.
Files changed (124) hide show
  1. package/README.md +33 -1
  2. package/dist/application.js +2 -2
  3. package/dist/auth.js +1 -1
  4. package/dist/bin.js +1566 -351
  5. package/dist/cli.js +1 -1
  6. package/dist/config.js +1 -1
  7. package/dist/connection.js +1 -11
  8. package/dist/index.js +1 -1
  9. package/dist/layout.js +1 -1
  10. package/dist/node.js +2 -0
  11. package/dist/orchestration.js +2 -2
  12. package/dist/rpc.js +2 -2
  13. package/dist/runtime.js +1 -1
  14. package/dist/scope.js +1 -1
  15. package/dist/shared.js +1740 -767
  16. package/dist/src/application/index.d.ts +3 -2
  17. package/dist/src/application/layer.d.ts +82 -841
  18. package/dist/src/application/model-selection.d.ts +15 -0
  19. package/dist/src/application/models.d.ts +1 -87
  20. package/dist/src/application/project-commands.d.ts +9 -0
  21. package/dist/src/application/projects.d.ts +13 -135
  22. package/dist/src/application/service.d.ts +84 -5
  23. package/dist/src/application/shell-sequence.d.ts +2 -12
  24. package/dist/src/application/terminals.d.ts +66 -0
  25. package/dist/src/application/thread-commands.d.ts +47 -0
  26. package/dist/src/application/thread-update.d.ts +8 -0
  27. package/dist/src/application/thread-wait.d.ts +3 -14
  28. package/dist/src/application/threads.d.ts +21 -50
  29. package/dist/src/cli/flags.d.ts +3 -0
  30. package/dist/src/cli/output-format.d.ts +2 -0
  31. package/dist/src/domain/error.d.ts +14 -1
  32. package/dist/src/domain/helpers.d.ts +0 -9
  33. package/dist/src/domain/model-config.d.ts +29 -3
  34. package/dist/src/domain/thread-lifecycle.d.ts +2 -10
  35. package/dist/src/node/index.d.ts +2 -0
  36. package/dist/src/orchestration/index.d.ts +1 -0
  37. package/dist/src/orchestration/layer.d.ts +177 -1032
  38. package/dist/src/orchestration/service.d.ts +1 -0
  39. package/dist/src/rpc/error.d.ts +4 -2
  40. package/dist/src/rpc/index.d.ts +5 -0
  41. package/dist/src/rpc/layer.d.ts +1097 -499
  42. package/dist/src/rpc/operation.d.ts +5752 -0
  43. package/dist/src/rpc/ws-group.d.ts +327 -147
  44. package/dist/src/runtime/layer.d.ts +1 -1
  45. package/dist/t3tools.js +2 -2
  46. package/dist/upstream-t3code/packages/contracts/src/environmentHttp.d.ts +10 -33
  47. package/dist/upstream-t3code/packages/contracts/src/ipc.d.ts +0 -6
  48. package/dist/upstream-t3code/packages/contracts/src/orchestration.d.ts +1 -657
  49. package/dist/upstream-t3code/packages/contracts/src/provider.d.ts +0 -14
  50. package/dist/upstream-t3code/packages/contracts/src/providerRuntime.d.ts +1 -175
  51. package/dist/upstream-t3code/packages/contracts/src/rpc.d.ts +0 -492
  52. package/dist/upstream-t3code/packages/contracts/src/server.d.ts +0 -45
  53. package/dist/upstream-t3code/packages/contracts/src/settings.d.ts +0 -21
  54. package/dist/upstream-t3code/packages/contracts/src/terminal.d.ts +3 -6
  55. package/package.json +6 -2
  56. package/src/application/index.ts +28 -2
  57. package/src/application/layer.ts +34 -5
  58. package/src/application/model-selection.ts +68 -2
  59. package/src/application/models.ts +14 -14
  60. package/src/application/project-commands.ts +15 -0
  61. package/src/application/projects.ts +43 -13
  62. package/src/application/service.ts +196 -77
  63. package/src/application/shell-sequence.ts +5 -7
  64. package/src/application/terminals.ts +207 -0
  65. package/src/application/thread-commands.test.ts +43 -0
  66. package/src/application/thread-commands.ts +81 -0
  67. package/src/application/thread-update.ts +72 -0
  68. package/src/application/thread-wait.ts +46 -47
  69. package/src/application/threads.test.ts +166 -0
  70. package/src/application/threads.ts +123 -40
  71. package/src/bin.ts +2 -0
  72. package/src/cli/app.ts +2 -0
  73. package/src/cli/confirm.ts +31 -0
  74. package/src/cli/error.ts +26 -3
  75. package/src/cli/flags.ts +15 -0
  76. package/src/cli/input/layer.ts +20 -0
  77. package/src/cli/input/service.ts +1 -0
  78. package/src/cli/output-format.ts +6 -2
  79. package/src/cli/project-format.ts +7 -0
  80. package/src/cli/project.ts +2 -1
  81. package/src/cli/projects/delete.ts +50 -0
  82. package/src/cli/self-action.ts +34 -0
  83. package/src/cli/terminal/attach.ts +32 -0
  84. package/src/cli/terminal/commands.test.ts +101 -0
  85. package/src/cli/terminal/create.ts +54 -0
  86. package/src/cli/terminal/destroy.ts +60 -0
  87. package/src/cli/terminal/encoding.test.ts +63 -0
  88. package/src/cli/terminal/encoding.ts +23 -0
  89. package/src/cli/terminal/error.ts +14 -0
  90. package/src/cli/terminal/io-node-layer.ts +82 -0
  91. package/src/cli/terminal/io-service.ts +25 -0
  92. package/src/cli/terminal/list.ts +35 -0
  93. package/src/cli/terminal/read.ts +102 -0
  94. package/src/cli/terminal/scope.ts +30 -0
  95. package/src/cli/terminal/shared.ts +250 -0
  96. package/src/cli/terminal/stream.ts +64 -0
  97. package/src/cli/terminal/wait.test.ts +146 -0
  98. package/src/cli/terminal/wait.ts +222 -0
  99. package/src/cli/terminal/write.ts +132 -0
  100. package/src/cli/terminal-format.ts +167 -0
  101. package/src/cli/terminal.ts +26 -0
  102. package/src/cli/thread-format.test.ts +32 -0
  103. package/src/cli/thread-format.ts +8 -1
  104. package/src/cli/thread.ts +8 -0
  105. package/src/cli/threads/archive.ts +11 -18
  106. package/src/cli/threads/delete.ts +61 -0
  107. package/src/cli/threads/interrupt.ts +52 -0
  108. package/src/cli/threads/list.test.ts +69 -0
  109. package/src/cli/threads/list.ts +15 -3
  110. package/src/cli/threads/send.ts +22 -2
  111. package/src/cli/threads/unarchive.ts +44 -0
  112. package/src/cli/threads/update.ts +150 -0
  113. package/src/domain/error.ts +20 -1
  114. package/src/domain/model-config.ts +4 -0
  115. package/src/domain/thread-lifecycle.ts +14 -0
  116. package/src/node/index.ts +2 -0
  117. package/src/orchestration/index.ts +1 -0
  118. package/src/orchestration/layer.ts +33 -85
  119. package/src/orchestration/service.ts +4 -0
  120. package/src/rpc/error.ts +10 -0
  121. package/src/rpc/index.ts +5 -0
  122. package/src/rpc/operation.ts +83 -0
  123. package/src/rpc/ws-group.ts +24 -0
  124. package/src/runtime/layer.ts +7 -2
@@ -1,11 +1,12 @@
1
1
  import * as Crypto from "effect/Crypto";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Path from "effect/Path";
4
+ import * as Stream from "effect/Stream";
4
5
  import { Environment } from "../environment/service.ts";
5
6
  import { T3Orchestration } from "../orchestration/service.ts";
6
- import { ProjectLookupError, ThreadSessionError } from "../domain/error.ts";
7
- import { type StartThreadInput } from "./service.ts";
8
- import type { SendThreadInput, CallbackThreadInput } from "./service.ts";
7
+ import { ProjectLookupError, ThreadLookupError, ThreadSessionError } from "../domain/error.ts";
8
+ import { type ListThreadsInclude, type StartThreadInput } from "./service.ts";
9
+ import type { CallbackThreadInput, SendThreadInput } from "./service.ts";
9
10
  import { derivePendingApprovals, derivePendingUserInputs } from "../domain/thread-activities.ts";
10
11
  import { type ThreadLifecycleStatus } from "../domain/thread-lifecycle.ts";
11
12
  import type { OrchestrationThread } from "#t3tools/contracts";
@@ -25,7 +26,22 @@ export declare const makeThreadApplication: () => Effect.Effect<{
25
26
  archiveThread: (threadId: string) => Effect.Effect<{
26
27
  readonly sequence: number;
27
28
  }, import("../rpc/error.ts").RpcError, never>;
28
- listThreads: (projectRef: string) => Effect.Effect<{
29
+ deleteThread: (threadId: string) => Effect.Effect<{
30
+ threadId: string;
31
+ dispatch: {
32
+ readonly sequence: number;
33
+ };
34
+ }, ThreadLookupError | import("../rpc/error.ts").RpcError, never>;
35
+ interruptThread: (threadId: string) => Effect.Effect<{
36
+ readonly sequence: number;
37
+ }, import("../rpc/error.ts").RpcError, never>;
38
+ updateThread: (input: import("./service.ts").UpdateThreadInput) => Effect.Effect<import("#t3tools/contracts").DispatchResult, import("./error.ts").ApplicationError>;
39
+ unarchiveThread: (threadId: string) => Effect.Effect<{
40
+ readonly sequence: number;
41
+ }, import("../rpc/error.ts").RpcError, never>;
42
+ listThreads: (projectRef: string, options?: {
43
+ readonly include?: ListThreadsInclude;
44
+ } | undefined) => Effect.Effect<{
29
45
  project: {
30
46
  readonly id: string & import("effect/Brand").Brand<"ProjectId">;
31
47
  readonly title: string;
@@ -102,15 +118,6 @@ export declare const makeThreadApplication: () => Effect.Effect<{
102
118
  readonly updatedAt: string;
103
119
  readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
104
120
  } | null;
105
- readonly goal: {
106
- readonly objective: string;
107
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
108
- readonly tokensUsed: number;
109
- readonly tokenBudget: number | null;
110
- readonly timeUsedSeconds: number;
111
- readonly createdAt: string;
112
- readonly updatedAt: string;
113
- } | null;
114
121
  readonly latestUserMessageAt: string | null;
115
122
  readonly hasPendingApprovals: boolean;
116
123
  readonly hasPendingUserInput: boolean;
@@ -149,15 +156,6 @@ export declare const makeThreadApplication: () => Effect.Effect<{
149
156
  readonly updatedAt: string;
150
157
  readonly archivedAt: string | null;
151
158
  readonly deletedAt: string | null;
152
- readonly goal: {
153
- readonly objective: string;
154
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
155
- readonly tokensUsed: number;
156
- readonly tokenBudget: number | null;
157
- readonly timeUsedSeconds: number;
158
- readonly createdAt: string;
159
- readonly updatedAt: string;
160
- } | null;
161
159
  readonly messages: readonly {
162
160
  readonly id: string & import("effect/Brand").Brand<"MessageId">;
163
161
  readonly role: "user" | "assistant" | "system";
@@ -274,15 +272,6 @@ export declare const makeThreadApplication: () => Effect.Effect<{
274
272
  readonly updatedAt: string;
275
273
  readonly archivedAt: string | null;
276
274
  readonly deletedAt: string | null;
277
- readonly goal: {
278
- readonly objective: string;
279
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
280
- readonly tokensUsed: number;
281
- readonly tokenBudget: number | null;
282
- readonly timeUsedSeconds: number;
283
- readonly createdAt: string;
284
- readonly updatedAt: string;
285
- } | null;
286
275
  readonly messages: readonly {
287
276
  readonly id: string & import("effect/Brand").Brand<"MessageId">;
288
277
  readonly role: "user" | "assistant" | "system";
@@ -460,15 +449,6 @@ export declare const makeThreadApplication: () => Effect.Effect<{
460
449
  readonly updatedAt: string;
461
450
  readonly archivedAt: string | null;
462
451
  readonly deletedAt: string | null;
463
- readonly goal: {
464
- readonly objective: string;
465
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
466
- readonly tokensUsed: number;
467
- readonly tokenBudget: number | null;
468
- readonly timeUsedSeconds: number;
469
- readonly createdAt: string;
470
- readonly updatedAt: string;
471
- } | null;
472
452
  readonly messages: readonly {
473
453
  readonly id: string & import("effect/Brand").Brand<"MessageId">;
474
454
  readonly role: "user" | "assistant" | "system";
@@ -530,7 +510,7 @@ export declare const makeThreadApplication: () => Effect.Effect<{
530
510
  } | null;
531
511
  };
532
512
  }, ProjectLookupError | import("../domain/error.ts").ModelSelectionError | ThreadSessionError | import("../rpc/error.ts").RpcError, never>;
533
- watchThread: (threadId: string) => import("effect/Stream").Stream<import("./service.ts").WaitEvent, ThreadSessionError | import("../rpc/error.ts").RpcError, never>;
513
+ watchThread: (threadId: string) => Stream.Stream<import("./service.ts").WaitEvent, ThreadSessionError | import("../rpc/error.ts").RpcError, never>;
534
514
  waitForThread: (threadId: string) => Effect.Effect<{
535
515
  readonly id: string & import("effect/Brand").Brand<"ThreadId">;
536
516
  readonly projectId: string & import("effect/Brand").Brand<"ProjectId">;
@@ -563,15 +543,6 @@ export declare const makeThreadApplication: () => Effect.Effect<{
563
543
  readonly updatedAt: string;
564
544
  readonly archivedAt: string | null;
565
545
  readonly deletedAt: string | null;
566
- readonly goal: {
567
- readonly objective: string;
568
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
569
- readonly tokensUsed: number;
570
- readonly tokenBudget: number | null;
571
- readonly timeUsedSeconds: number;
572
- readonly createdAt: string;
573
- readonly updatedAt: string;
574
- } | null;
575
546
  readonly messages: readonly {
576
547
  readonly id: string & import("effect/Brand").Brand<"MessageId">;
577
548
  readonly role: "user" | "assistant" | "system";
@@ -3,6 +3,9 @@ export declare const projectFlag: Flag.Flag<import("effect/Option").Option<strin
3
3
  export declare const threadFlag: Flag.Flag<import("effect/Option").Option<string>>;
4
4
  export declare const worktreeFlag: Flag.Flag<import("effect/Option").Option<string>>;
5
5
  export declare const projectPathFlag: Flag.Flag<string>;
6
+ export declare const yesFlag: Flag.Flag<boolean>;
7
+ export declare const forceFlag: Flag.Flag<boolean>;
8
+ export declare const selfActionForceFlag: Flag.Flag<boolean>;
6
9
  export declare const formatFlag: Flag.Flag<"auto" | "human" | "json">;
7
10
  export declare const threadFormatFlag: Flag.Flag<"auto" | "human" | "json" | "ndjson">;
8
11
  export declare const waitFormatFlag: Flag.Flag<"auto" | "human" | "ndjson">;
@@ -7,3 +7,5 @@ export type HumanNdjsonFormat = (typeof humanNdjsonFormatChoices)[number];
7
7
  export type HumanJsonNdjsonFormat = (typeof humanJsonNdjsonFormatChoices)[number];
8
8
  export declare function resolveOutputFormat<T extends "json" | "ndjson">(format: "auto" | "human" | T, environment: EnvironmentShape, nonHumanFormat: T): "human" | T;
9
9
  export declare function canRenderLiveTerminal(environment: EnvironmentShape): boolean;
10
+ export declare function isInteractiveHumanTerminal(environment: EnvironmentShape): boolean;
11
+ export declare function isAgentEnvironment(environment: EnvironmentShape): boolean;
@@ -21,11 +21,24 @@ declare const ThreadSessionError_base: Schema.Class<ThreadSessionError, Schema.T
21
21
  }>, import("effect/Cause").YieldableError>;
22
22
  export declare class ThreadSessionError extends ThreadSessionError_base {
23
23
  }
24
+ declare const ThreadLookupError_base: Schema.Class<ThreadLookupError, Schema.TaggedStruct<"ThreadLookupError", {
25
+ readonly message: Schema.String;
26
+ readonly threadId: Schema.String;
27
+ }>, import("effect/Cause").YieldableError>;
28
+ export declare class ThreadLookupError extends ThreadLookupError_base {
29
+ }
24
30
  declare const ProjectCreateVisibilityError_base: Schema.Class<ProjectCreateVisibilityError, Schema.TaggedStruct<"ProjectCreateVisibilityError", {
25
31
  readonly message: Schema.String;
26
32
  readonly projectId: Schema.String;
27
33
  }>, import("effect/Cause").YieldableError>;
28
34
  export declare class ProjectCreateVisibilityError extends ProjectCreateVisibilityError_base {
29
35
  }
30
- export type DomainError = ProjectLookupError | ModelSelectionError | ThreadEventError | ThreadSessionError | ProjectCreateVisibilityError;
36
+ declare const TerminalLookupError_base: Schema.Class<TerminalLookupError, Schema.TaggedStruct<"TerminalLookupError", {
37
+ readonly message: Schema.String;
38
+ readonly threadId: Schema.String;
39
+ readonly terminalId: Schema.String;
40
+ }>, import("effect/Cause").YieldableError>;
41
+ export declare class TerminalLookupError extends TerminalLookupError_base {
42
+ }
43
+ export type DomainError = ProjectLookupError | ModelSelectionError | ThreadEventError | ThreadSessionError | ThreadLookupError | ProjectCreateVisibilityError | TerminalLookupError;
31
44
  export {};
@@ -83,15 +83,6 @@ export declare const resolveProjectScope: (snapshot: {
83
83
  readonly updatedAt: string;
84
84
  readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
85
85
  } | null;
86
- readonly goal: {
87
- readonly objective: string;
88
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
89
- readonly tokensUsed: number;
90
- readonly tokenBudget: number | null;
91
- readonly timeUsedSeconds: number;
92
- readonly createdAt: string;
93
- readonly updatedAt: string;
94
- } | null;
95
86
  readonly latestUserMessageAt: string | null;
96
87
  readonly hasPendingApprovals: boolean;
97
88
  readonly hasPendingUserInput: boolean;
@@ -66,7 +66,6 @@ export declare function firstSelectableProvider(providers: ReadonlyArray<ServerP
66
66
  readonly groupKey: string;
67
67
  } | undefined;
68
68
  readonly showInteractionModeToggle?: boolean | undefined;
69
- readonly requiresNewThreadForModelChange?: boolean | undefined;
70
69
  readonly message?: string | undefined;
71
70
  readonly availability?: "available" | "unavailable" | undefined;
72
71
  readonly unavailableReason?: string | undefined;
@@ -116,6 +115,35 @@ export declare function firstSelectableModel(provider: ServerProvider): {
116
115
  readonly shortName?: string | undefined;
117
116
  readonly subProvider?: string | undefined;
118
117
  } | undefined;
118
+ export declare function findSelectableModel(provider: ServerProvider, slug: string): {
119
+ readonly slug: string;
120
+ readonly name: string;
121
+ readonly isCustom: boolean;
122
+ readonly capabilities: {
123
+ readonly optionDescriptors?: readonly ({
124
+ readonly type: "select";
125
+ readonly options: readonly {
126
+ readonly id: string;
127
+ readonly label: string;
128
+ readonly description?: string | undefined;
129
+ readonly isDefault?: boolean | undefined;
130
+ }[];
131
+ readonly id: string;
132
+ readonly label: string;
133
+ readonly currentValue?: string | undefined;
134
+ readonly promptInjectedValues?: readonly string[] | undefined;
135
+ readonly description?: string | undefined;
136
+ } | {
137
+ readonly type: "boolean";
138
+ readonly id: string;
139
+ readonly label: string;
140
+ readonly currentValue?: boolean | undefined;
141
+ readonly description?: string | undefined;
142
+ })[] | undefined;
143
+ } | null;
144
+ readonly shortName?: string | undefined;
145
+ readonly subProvider?: string | undefined;
146
+ } | undefined;
119
147
  export declare function findSelectableProvider(providers: ReadonlyArray<ServerProvider>, instanceId: string): {
120
148
  readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
121
149
  readonly driver: string & import("effect/Brand").Brand<"ProviderDriverKind">;
@@ -182,7 +210,6 @@ export declare function findSelectableProvider(providers: ReadonlyArray<ServerPr
182
210
  readonly groupKey: string;
183
211
  } | undefined;
184
212
  readonly showInteractionModeToggle?: boolean | undefined;
185
- readonly requiresNewThreadForModelChange?: boolean | undefined;
186
213
  readonly message?: string | undefined;
187
214
  readonly availability?: "available" | "unavailable" | undefined;
188
215
  readonly unavailableReason?: string | undefined;
@@ -273,7 +300,6 @@ export declare function filterProvidersForModelListing(input: {
273
300
  readonly groupKey: string;
274
301
  } | undefined;
275
302
  readonly showInteractionModeToggle?: boolean | undefined;
276
- readonly requiresNewThreadForModelChange?: boolean | undefined;
277
303
  readonly message?: string | undefined;
278
304
  readonly availability?: "available" | "unavailable" | undefined;
279
305
  readonly unavailableReason?: string | undefined;
@@ -1,4 +1,5 @@
1
- import { type OrchestrationEvent, type OrchestrationMessage as OrchestrationMessageType, type OrchestrationThread, type OrchestrationThreadShell } from "#t3tools/contracts";
1
+ import { type OrchestrationEvent, type OrchestrationMessage as OrchestrationMessageType, type OrchestrationSession, type OrchestrationThread, type OrchestrationThreadShell } from "#t3tools/contracts";
2
+ export declare function sessionNeedsStopBeforeDelete(session: OrchestrationSession | null): boolean;
2
3
  export declare function isThreadActive(thread: OrchestrationThreadShell | OrchestrationThread): boolean;
3
4
  export type ThreadLifecycleStatus = ReturnType<typeof threadStatus>;
4
5
  export declare function threadStatus(thread: OrchestrationThreadShell | OrchestrationThread): "unknown" | "error" | "idle" | "starting" | "running" | "ready" | "interrupted" | "stopped" | "completed" | "pending";
@@ -51,15 +52,6 @@ export declare function applyThreadEvent(current: OrchestrationThread, event: Or
51
52
  readonly updatedAt: string;
52
53
  readonly archivedAt: string | null;
53
54
  readonly deletedAt: string | null;
54
- readonly goal: {
55
- readonly objective: string;
56
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
57
- readonly tokensUsed: number;
58
- readonly tokenBudget: number | null;
59
- readonly timeUsedSeconds: number;
60
- readonly createdAt: string;
61
- readonly updatedAt: string;
62
- } | null;
63
55
  readonly messages: readonly {
64
56
  readonly id: string & import("effect/Brand").Brand<"MessageId">;
65
57
  readonly role: "user" | "assistant" | "system";
@@ -0,0 +1,2 @@
1
+ export { T3CodeNodeRpcLayer } from "../connection/node.ts";
2
+ export { NodeEnvironmentLive } from "../environment/layer.ts";
@@ -1,2 +1,3 @@
1
1
  export { T3Orchestration, type OpenThread, type Orchestration, type OrchestrationError, } from "./service.ts";
2
+ export { makeT3Orchestration, T3OrchestrationLive } from "./layer.ts";
2
3
  export { T3OrchestrationLayer } from "../runtime/layer.ts";