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
@@ -17,3 +17,18 @@ export declare function resolveModelSelection(input: {
17
17
  }[];
18
18
  }, ModelSelectionError, never>;
19
19
  export declare function mergeModelOptions(selection: ModelSelection, options: NonNullable<ModelSelection["options"]>): ModelSelection;
20
+ export declare function resolveUpdateModelSelection(input: {
21
+ readonly current: ModelSelection;
22
+ readonly provider?: string;
23
+ readonly model?: string;
24
+ readonly options?: NonNullable<ModelSelection["options"]>;
25
+ readonly project: OrchestrationProjectShell;
26
+ readonly serverConfig: ServerConfigForCli;
27
+ }): Effect.Effect<{
28
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
29
+ readonly model: string;
30
+ readonly options?: readonly {
31
+ readonly id: string;
32
+ readonly value: string | boolean;
33
+ }[];
34
+ }, ModelSelectionError, never>;
@@ -4,91 +4,5 @@ export declare const makeModelsApplication: () => Effect.Effect<{
4
4
  listModels: (input: {
5
5
  readonly all?: boolean;
6
6
  readonly provider?: string;
7
- }) => Effect.Effect<{
8
- readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
9
- readonly driver: string & import("effect/Brand").Brand<"ProviderDriverKind">;
10
- readonly enabled: boolean;
11
- readonly installed: boolean;
12
- readonly version: string | null;
13
- readonly status: "error" | "ready" | "warning" | "disabled";
14
- readonly auth: {
15
- readonly status: "authenticated" | "unknown" | "unauthenticated";
16
- readonly type?: string | undefined;
17
- readonly label?: string | undefined;
18
- readonly email?: string | undefined;
19
- };
20
- readonly checkedAt: string;
21
- readonly models: readonly {
22
- readonly slug: string;
23
- readonly name: string;
24
- readonly isCustom: boolean;
25
- readonly capabilities: {
26
- readonly optionDescriptors?: readonly ({
27
- readonly type: "select";
28
- readonly options: readonly {
29
- readonly id: string;
30
- readonly label: string;
31
- readonly description?: string | undefined;
32
- readonly isDefault?: boolean | undefined;
33
- }[];
34
- readonly id: string;
35
- readonly label: string;
36
- readonly currentValue?: string | undefined;
37
- readonly promptInjectedValues?: readonly string[] | undefined;
38
- readonly description?: string | undefined;
39
- } | {
40
- readonly type: "boolean";
41
- readonly id: string;
42
- readonly label: string;
43
- readonly currentValue?: boolean | undefined;
44
- readonly description?: string | undefined;
45
- })[] | undefined;
46
- } | null;
47
- readonly shortName?: string | undefined;
48
- readonly subProvider?: string | undefined;
49
- }[];
50
- readonly slashCommands: readonly {
51
- readonly name: string;
52
- readonly description?: string | undefined;
53
- readonly input?: {
54
- readonly hint: string;
55
- } | undefined;
56
- }[];
57
- readonly skills: readonly {
58
- readonly name: string;
59
- readonly path: string;
60
- readonly enabled: boolean;
61
- readonly description?: string | undefined;
62
- readonly scope?: string | undefined;
63
- readonly displayName?: string | undefined;
64
- readonly shortDescription?: string | undefined;
65
- }[];
66
- readonly displayName?: string | undefined;
67
- readonly accentColor?: string | undefined;
68
- readonly badgeLabel?: string | undefined;
69
- readonly continuation?: {
70
- readonly groupKey: string;
71
- } | undefined;
72
- readonly showInteractionModeToggle?: boolean | undefined;
73
- readonly requiresNewThreadForModelChange?: boolean | undefined;
74
- readonly message?: string | undefined;
75
- readonly availability?: "available" | "unavailable" | undefined;
76
- readonly unavailableReason?: string | undefined;
77
- readonly versionAdvisory?: {
78
- readonly status: "unknown" | "current" | "behind_latest";
79
- readonly currentVersion: string | null;
80
- readonly latestVersion: string | null;
81
- readonly updateCommand: string | null;
82
- readonly canUpdate: boolean;
83
- readonly checkedAt: string | null;
84
- readonly message: string | null;
85
- };
86
- readonly updateState?: {
87
- readonly status: "idle" | "running" | "failed" | "queued" | "succeeded" | "unchanged";
88
- readonly startedAt: string | null;
89
- readonly finishedAt: string | null;
90
- readonly message: string | null;
91
- readonly output: string | null;
92
- };
93
- }[], import("../rpc/error.ts").RpcError, never>;
7
+ }) => Effect.Effect<ReadonlyArray<import("#t3tools/contracts").ServerProvider>, import("./error.ts").ApplicationError>;
94
8
  }, never, T3Orchestration>;
@@ -13,3 +13,12 @@ export declare const makeProjectCreateCommand: (input: {
13
13
  workspaceRoot: string;
14
14
  createdAt: string;
15
15
  }, never, Environment | Path.Path | Crypto.Crypto>;
16
+ export declare const makeProjectDeleteCommand: (input: {
17
+ readonly projectId: string;
18
+ readonly force?: boolean;
19
+ }) => Effect.Effect<{
20
+ force?: true;
21
+ type: "project.delete";
22
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
23
+ projectId: string & import("effect/Brand").Brand<"ProjectId">;
24
+ }, never, Crypto.Crypto>;
@@ -3,143 +3,21 @@ import * as Effect from "effect/Effect";
3
3
  import * as Path from "effect/Path";
4
4
  import { Environment } from "../environment/service.ts";
5
5
  import { T3Orchestration } from "../orchestration/service.ts";
6
- import { ProjectCreateVisibilityError } from "../domain/error.ts";
7
6
  export declare const makeProjectApplication: () => Effect.Effect<{
8
- loadShell: () => Effect.Effect<{
9
- readonly snapshotSequence: number;
10
- readonly projects: readonly {
11
- readonly id: string & import("effect/Brand").Brand<"ProjectId">;
12
- readonly title: string;
13
- readonly workspaceRoot: string;
14
- readonly defaultModelSelection: {
15
- readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
16
- readonly model: string;
17
- readonly options?: readonly {
18
- readonly id: string;
19
- readonly value: string | boolean;
20
- }[];
21
- } | null;
22
- readonly scripts: readonly {
23
- readonly id: string;
24
- readonly name: string;
25
- readonly command: string;
26
- readonly icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
27
- readonly runOnWorktreeCreate: boolean;
28
- }[];
29
- readonly createdAt: string;
30
- readonly updatedAt: string;
31
- readonly repositoryIdentity?: {
32
- readonly canonicalKey: string;
33
- readonly locator: {
34
- readonly source: "git-remote";
35
- readonly remoteName: string;
36
- readonly remoteUrl: string;
37
- };
38
- readonly rootPath?: string;
39
- readonly displayName?: string;
40
- readonly provider?: string;
41
- readonly owner?: string;
42
- readonly name?: string;
43
- } | null | undefined;
44
- }[];
45
- readonly threads: readonly {
46
- readonly id: string & import("effect/Brand").Brand<"ThreadId">;
47
- readonly projectId: string & import("effect/Brand").Brand<"ProjectId">;
48
- readonly title: string;
49
- readonly modelSelection: {
50
- readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
51
- readonly model: string;
52
- readonly options?: readonly {
53
- readonly id: string;
54
- readonly value: string | boolean;
55
- }[];
56
- };
57
- readonly runtimeMode: "approval-required" | "auto-accept-edits" | "full-access";
58
- readonly interactionMode: "default" | "plan";
59
- readonly branch: string | null;
60
- readonly worktreePath: string | null;
61
- readonly latestTurn: {
62
- readonly turnId: string & import("effect/Brand").Brand<"TurnId">;
63
- readonly state: "error" | "running" | "interrupted" | "completed";
64
- readonly requestedAt: string;
65
- readonly startedAt: string | null;
66
- readonly completedAt: string | null;
67
- readonly assistantMessageId: (string & import("effect/Brand").Brand<"MessageId">) | null;
68
- readonly sourceProposedPlan?: {
69
- readonly threadId: string & import("effect/Brand").Brand<"ThreadId">;
70
- readonly planId: string;
71
- } | undefined;
72
- } | null;
73
- readonly createdAt: string;
74
- readonly updatedAt: string;
75
- readonly archivedAt: string | null;
76
- readonly session: {
77
- readonly threadId: string & import("effect/Brand").Brand<"ThreadId">;
78
- readonly status: "error" | "idle" | "starting" | "running" | "ready" | "interrupted" | "stopped";
79
- readonly providerName: string | null;
80
- readonly runtimeMode: "approval-required" | "auto-accept-edits" | "full-access";
81
- readonly activeTurnId: (string & import("effect/Brand").Brand<"TurnId">) | null;
82
- readonly lastError: string | null;
83
- readonly updatedAt: string;
84
- readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
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
- readonly latestUserMessageAt: string | null;
96
- readonly hasPendingApprovals: boolean;
97
- readonly hasPendingUserInput: boolean;
98
- readonly hasActionableProposedPlan: boolean;
99
- }[];
100
- readonly updatedAt: string;
101
- }, import("../rpc/error.ts").RpcError, never>;
102
- addProject: (projectInput: {
7
+ loadShell: () => Effect.Effect<import("#t3tools/contracts").OrchestrationShellSnapshot, import("./error.ts").ApplicationError>;
8
+ addProject: (input: {
103
9
  readonly path: string;
104
10
  readonly title?: string;
105
11
  }) => Effect.Effect<{
106
- dispatch: {
107
- readonly sequence: number;
108
- };
109
- project: {
110
- readonly id: string & import("effect/Brand").Brand<"ProjectId">;
111
- readonly title: string;
112
- readonly workspaceRoot: string;
113
- readonly defaultModelSelection: {
114
- readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
115
- readonly model: string;
116
- readonly options?: readonly {
117
- readonly id: string;
118
- readonly value: string | boolean;
119
- }[];
120
- } | null;
121
- readonly scripts: readonly {
122
- readonly id: string;
123
- readonly name: string;
124
- readonly command: string;
125
- readonly icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
126
- readonly runOnWorktreeCreate: boolean;
127
- }[];
128
- readonly createdAt: string;
129
- readonly updatedAt: string;
130
- readonly repositoryIdentity?: {
131
- readonly canonicalKey: string;
132
- readonly locator: {
133
- readonly source: "git-remote";
134
- readonly remoteName: string;
135
- readonly remoteUrl: string;
136
- };
137
- readonly rootPath?: string;
138
- readonly displayName?: string;
139
- readonly provider?: string;
140
- readonly owner?: string;
141
- readonly name?: string;
142
- } | null | undefined;
143
- };
144
- }, ProjectCreateVisibilityError | import("../rpc/error.ts").RpcError, never>;
12
+ readonly dispatch: import("#t3tools/contracts").DispatchResult;
13
+ readonly project: import("#t3tools/contracts").OrchestrationProjectShell;
14
+ }, import("./error.ts").ApplicationError>;
15
+ resolveProject: (projectRef: string) => Effect.Effect<import("#t3tools/contracts").OrchestrationProjectShell, import("./error.ts").ApplicationError>;
16
+ deleteProject: (input: {
17
+ readonly projectId: string;
18
+ readonly force?: boolean;
19
+ }) => Effect.Effect<{
20
+ readonly projectId: string;
21
+ readonly dispatch: import("#t3tools/contracts").DispatchResult;
22
+ }, import("./error.ts").ApplicationError>;
145
23
  }, never, Environment | T3Orchestration | Path.Path | Crypto.Crypto>;
@@ -1,7 +1,7 @@
1
1
  import * as Context from "effect/Context";
2
2
  import type * as Effect from "effect/Effect";
3
3
  import type * as Stream from "effect/Stream";
4
- import type { DispatchResult, ModelSelection, OrchestrationMessage, OrchestrationProjectShell, OrchestrationShellSnapshot, OrchestrationThread, OrchestrationThreadShell, ProviderUserInputAnswers, ServerProvider } from "#t3tools/contracts";
4
+ import type { DispatchResult, ModelSelection, OrchestrationMessage, OrchestrationProjectShell, OrchestrationShellSnapshot, OrchestrationThread, OrchestrationThreadShell, ProviderUserInputAnswers, ServerProvider, TerminalAttachStreamEvent, TerminalMetadataStreamEvent, TerminalSessionSnapshot, TerminalSummary } from "#t3tools/contracts";
5
5
  import type { ApplicationError } from "./error.ts";
6
6
  import type { ThreadShow } from "./threads.ts";
7
7
  export type StartThreadInput = {
@@ -13,6 +13,19 @@ export type StartThreadInput = {
13
13
  readonly options?: NonNullable<ModelSelection["options"]>;
14
14
  readonly worktreePath?: string;
15
15
  };
16
+ export type CreateTerminalInput = {
17
+ readonly threadId: string;
18
+ readonly terminalId?: string;
19
+ readonly command?: string;
20
+ };
21
+ export type TerminalRef = {
22
+ readonly threadId: string;
23
+ readonly terminalId: string;
24
+ };
25
+ export type TerminalAttachTarget = TerminalRef & {
26
+ readonly cwd: string;
27
+ readonly worktreePath: string | null;
28
+ };
16
29
  export type SendThreadInput = {
17
30
  readonly threadId: string;
18
31
  readonly message: string;
@@ -23,6 +36,16 @@ export type CallbackThreadInput = {
23
36
  readonly targetThreadId: string;
24
37
  readonly prompt: string;
25
38
  };
39
+ export type ListThreadsInclude = "active" | "archived" | "all";
40
+ export type UpdateThreadInput = {
41
+ readonly threadId: string;
42
+ readonly title?: string;
43
+ readonly provider?: string;
44
+ readonly model?: string;
45
+ readonly options?: NonNullable<ModelSelection["options"]>;
46
+ readonly branch?: string | null;
47
+ readonly worktreePath?: string | null;
48
+ };
26
49
  export type StartThreadPolicy = {
27
50
  readonly until: "dispatch" | "visible" | "complete";
28
51
  };
@@ -40,12 +63,17 @@ export type WaitEvent = {
40
63
  readonly type: "done";
41
64
  readonly thread: OrchestrationThread;
42
65
  };
43
- declare const T3Application_base: Context.ServiceClass<T3Application, "t3cli/T3Application", {
44
- readonly loadShell: () => Effect.Effect<OrchestrationShellSnapshot, ApplicationError>;
66
+ export type T3ModelApplicationService = {
45
67
  readonly listModels: (input: {
46
68
  readonly all?: boolean;
47
69
  readonly provider?: string;
48
70
  }) => Effect.Effect<ReadonlyArray<ServerProvider>, ApplicationError>;
71
+ };
72
+ declare const T3ModelApplication_base: Context.ServiceClass<T3ModelApplication, "t3cli/T3ModelApplication", T3ModelApplicationService>;
73
+ export declare class T3ModelApplication extends T3ModelApplication_base {
74
+ }
75
+ export type T3ProjectApplicationService = {
76
+ readonly loadShell: () => Effect.Effect<OrchestrationShellSnapshot, ApplicationError>;
49
77
  readonly addProject: (input: {
50
78
  readonly path: string;
51
79
  readonly title?: string;
@@ -53,7 +81,22 @@ declare const T3Application_base: Context.ServiceClass<T3Application, "t3cli/T3A
53
81
  readonly dispatch: DispatchResult;
54
82
  readonly project: OrchestrationProjectShell;
55
83
  }, ApplicationError>;
56
- readonly listThreads: (projectRef: string) => Effect.Effect<{
84
+ readonly resolveProject: (projectRef: string) => Effect.Effect<OrchestrationProjectShell, ApplicationError>;
85
+ readonly deleteProject: (input: {
86
+ readonly projectId: string;
87
+ readonly force?: boolean;
88
+ }) => Effect.Effect<{
89
+ readonly projectId: string;
90
+ readonly dispatch: DispatchResult;
91
+ }, ApplicationError>;
92
+ };
93
+ declare const T3ProjectApplication_base: Context.ServiceClass<T3ProjectApplication, "t3cli/T3ProjectApplication", T3ProjectApplicationService>;
94
+ export declare class T3ProjectApplication extends T3ProjectApplication_base {
95
+ }
96
+ export type T3ThreadApplicationService = {
97
+ readonly listThreads: (projectRef: string, options?: {
98
+ readonly include?: ListThreadsInclude;
99
+ }) => Effect.Effect<{
57
100
  readonly project: OrchestrationProjectShell;
58
101
  readonly threads: ReadonlyArray<OrchestrationThreadShell>;
59
102
  }, ApplicationError>;
@@ -78,6 +121,13 @@ declare const T3Application_base: Context.ServiceClass<T3Application, "t3cli/T3A
78
121
  readonly dispatch: DispatchResult;
79
122
  }, ApplicationError>;
80
123
  readonly archiveThread: (threadId: string) => Effect.Effect<DispatchResult, ApplicationError>;
124
+ readonly interruptThread: (threadId: string) => Effect.Effect<DispatchResult, ApplicationError>;
125
+ readonly unarchiveThread: (threadId: string) => Effect.Effect<DispatchResult, ApplicationError>;
126
+ readonly deleteThread: (threadId: string) => Effect.Effect<{
127
+ readonly threadId: string;
128
+ readonly dispatch: DispatchResult;
129
+ }, ApplicationError>;
130
+ readonly updateThread: (input: UpdateThreadInput) => Effect.Effect<DispatchResult, ApplicationError>;
81
131
  readonly startThread: (input: StartThreadInput, policy?: StartThreadPolicy) => Effect.Effect<{
82
132
  readonly dispatch: DispatchResult;
83
133
  readonly project: OrchestrationProjectShell;
@@ -95,7 +145,36 @@ declare const T3Application_base: Context.ServiceClass<T3Application, "t3cli/T3A
95
145
  readonly dispatch: DispatchResult;
96
146
  readonly targetThreadId: string;
97
147
  }, ApplicationError>;
98
- }>;
148
+ };
149
+ declare const T3ThreadApplication_base: Context.ServiceClass<T3ThreadApplication, "t3cli/T3ThreadApplication", T3ThreadApplicationService>;
150
+ export declare class T3ThreadApplication extends T3ThreadApplication_base {
151
+ }
152
+ export type T3TerminalApplicationService = {
153
+ readonly listTerminals: (threadId: string) => Effect.Effect<ReadonlyArray<TerminalSummary>, ApplicationError>;
154
+ readonly getTerminal: (terminal: TerminalRef) => Effect.Effect<TerminalSummary, ApplicationError>;
155
+ readonly createTerminal: (input: CreateTerminalInput) => Effect.Effect<TerminalSessionSnapshot, ApplicationError>;
156
+ readonly attachTerminal: (input: {
157
+ readonly terminal: TerminalAttachTarget;
158
+ readonly cols?: number;
159
+ readonly rows?: number;
160
+ }) => Stream.Stream<TerminalAttachStreamEvent, ApplicationError>;
161
+ readonly watchTerminalMetadata: () => Stream.Stream<TerminalMetadataStreamEvent, ApplicationError>;
162
+ readonly writeTerminal: (input: {
163
+ readonly terminal: TerminalRef;
164
+ readonly data: string;
165
+ }) => Effect.Effect<void, ApplicationError>;
166
+ readonly resizeTerminal: (input: {
167
+ readonly terminal: TerminalRef;
168
+ readonly cols: number;
169
+ readonly rows: number;
170
+ }) => Effect.Effect<void, ApplicationError>;
171
+ readonly destroyTerminal: (terminal: TerminalRef) => Effect.Effect<void, ApplicationError>;
172
+ };
173
+ declare const T3TerminalApplication_base: Context.ServiceClass<T3TerminalApplication, "t3cli/T3TerminalApplication", T3TerminalApplicationService>;
174
+ export declare class T3TerminalApplication extends T3TerminalApplication_base {
175
+ }
176
+ export type T3ApplicationService = T3ModelApplicationService & T3ProjectApplicationService & T3ThreadApplicationService & T3TerminalApplicationService;
177
+ declare const T3Application_base: Context.ServiceClass<T3Application, "t3cli/T3Application", T3ApplicationService>;
99
178
  export declare class T3Application extends T3Application_base {
100
179
  }
101
180
  export {};
@@ -1,8 +1,7 @@
1
1
  import * as Effect from "effect/Effect";
2
- import type { Orchestration } from "../orchestration/service.ts";
2
+ import { T3Orchestration } from "../orchestration/service.ts";
3
3
  import { RpcError } from "../rpc/error.ts";
4
4
  export declare function waitForShellSequence(input: {
5
- readonly orchestration: Orchestration;
6
5
  readonly sequence: number;
7
6
  }): Effect.Effect<{
8
7
  readonly snapshotSequence: number;
@@ -82,19 +81,10 @@ export declare function waitForShellSequence(input: {
82
81
  readonly updatedAt: string;
83
82
  readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
84
83
  } | null;
85
- readonly goal: {
86
- readonly objective: string;
87
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
88
- readonly tokensUsed: number;
89
- readonly tokenBudget: number | null;
90
- readonly timeUsedSeconds: number;
91
- readonly createdAt: string;
92
- readonly updatedAt: string;
93
- } | null;
94
84
  readonly latestUserMessageAt: string | null;
95
85
  readonly hasPendingApprovals: boolean;
96
86
  readonly hasPendingUserInput: boolean;
97
87
  readonly hasActionableProposedPlan: boolean;
98
88
  }[];
99
89
  readonly updatedAt: string;
100
- }, RpcError, never>;
90
+ }, RpcError, T3Orchestration>;
@@ -0,0 +1,66 @@
1
+ import * as Crypto from "effect/Crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Stream from "effect/Stream";
4
+ import { TerminalLookupError, ThreadLookupError } from "../domain/error.ts";
5
+ import { T3Orchestration } from "../orchestration/service.ts";
6
+ import { RpcError } from "../rpc/error.ts";
7
+ import { T3RpcOperations } from "../rpc/operation.ts";
8
+ import type { CreateTerminalInput, TerminalRef } from "./service.ts";
9
+ export declare const makeTerminalApplication: () => Effect.Effect<{
10
+ attachTerminal: (input: {
11
+ readonly terminal: import("./service.ts").TerminalAttachTarget;
12
+ readonly cols?: number;
13
+ readonly rows?: number;
14
+ }) => Stream.Stream<import("#t3tools/contracts").TerminalAttachStreamEvent, import("./error.ts").ApplicationError>;
15
+ createTerminal: (input: CreateTerminalInput) => Effect.Effect<{
16
+ readonly threadId: string;
17
+ readonly terminalId: string;
18
+ readonly cwd: string;
19
+ readonly worktreePath: string | null;
20
+ readonly status: "error" | "starting" | "running" | "exited";
21
+ readonly pid: number | null;
22
+ readonly history: string;
23
+ readonly exitCode: number | null;
24
+ readonly exitSignal: number | null;
25
+ readonly label: string;
26
+ readonly updatedAt: string;
27
+ readonly sequence?: number | undefined;
28
+ }, import("./error.ts").ApplicationError, never>;
29
+ destroyTerminal: (terminal: TerminalRef) => Effect.Effect<void, RpcError, never>;
30
+ getTerminal: (terminal: TerminalRef) => Effect.Effect<{
31
+ readonly threadId: string;
32
+ readonly terminalId: string;
33
+ readonly cwd: string;
34
+ readonly worktreePath: string | null;
35
+ readonly status: "error" | "starting" | "running" | "exited";
36
+ readonly pid: number | null;
37
+ readonly exitCode: number | null;
38
+ readonly exitSignal: number | null;
39
+ readonly hasRunningSubprocess: boolean;
40
+ readonly label: string;
41
+ readonly updatedAt: string;
42
+ }, ThreadLookupError | TerminalLookupError | RpcError, never>;
43
+ listTerminals: (threadId: string) => Effect.Effect<{
44
+ readonly threadId: string;
45
+ readonly terminalId: string;
46
+ readonly cwd: string;
47
+ readonly worktreePath: string | null;
48
+ readonly status: "error" | "starting" | "running" | "exited";
49
+ readonly pid: number | null;
50
+ readonly exitCode: number | null;
51
+ readonly exitSignal: number | null;
52
+ readonly hasRunningSubprocess: boolean;
53
+ readonly label: string;
54
+ readonly updatedAt: string;
55
+ }[], ThreadLookupError | RpcError, never>;
56
+ resizeTerminal: (input: {
57
+ readonly terminal: TerminalRef;
58
+ readonly cols: number;
59
+ readonly rows: number;
60
+ }) => Effect.Effect<void, RpcError, never>;
61
+ watchTerminalMetadata: () => Stream.Stream<import("#t3tools/contracts").TerminalMetadataStreamEvent, import("./error.ts").ApplicationError>;
62
+ writeTerminal: (input: {
63
+ readonly terminal: TerminalRef;
64
+ readonly data: string;
65
+ }) => Effect.Effect<void, RpcError, never>;
66
+ }, never, T3Orchestration | Crypto.Crypto | T3RpcOperations>;
@@ -82,6 +82,32 @@ export declare const makeThreadArchiveCommand: (threadId: string) => Effect.Effe
82
82
  commandId: string & import("effect/Brand").Brand<"CommandId">;
83
83
  threadId: string & import("effect/Brand").Brand<"ThreadId">;
84
84
  }, never, Crypto.Crypto>;
85
+ export declare const makeThreadUnarchiveCommand: (threadId: string) => Effect.Effect<{
86
+ type: "thread.unarchive";
87
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
88
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
89
+ }, never, Crypto.Crypto>;
90
+ export declare const makeThreadSessionStopCommand: (threadId: string) => Effect.Effect<{
91
+ type: "thread.session.stop";
92
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
93
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
94
+ createdAt: string;
95
+ }, never, Crypto.Crypto>;
96
+ export declare const makeThreadDeleteCommand: (threadId: string) => Effect.Effect<{
97
+ type: "thread.delete";
98
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
99
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
100
+ }, never, Crypto.Crypto>;
101
+ export declare const makeThreadInterruptCommand: (input: {
102
+ readonly threadId: string;
103
+ readonly turnId?: string;
104
+ }) => Effect.Effect<{
105
+ createdAt: string;
106
+ turnId?: string & import("effect/Brand").Brand<"TurnId">;
107
+ type: "thread.turn.interrupt";
108
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
109
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
110
+ }, never, Crypto.Crypto>;
85
111
  export declare const makeThreadApprovalRespondCommand: (input: {
86
112
  readonly threadId: string;
87
113
  readonly requestId: string;
@@ -108,3 +134,24 @@ export declare const makeThreadUserInputRespondCommand: (input: {
108
134
  };
109
135
  createdAt: string;
110
136
  }, never, Crypto.Crypto>;
137
+ export declare const makeThreadMetaUpdateCommand: (threadId: string, input: {
138
+ readonly title?: string;
139
+ readonly modelSelection?: ModelSelection;
140
+ readonly branch?: string | null;
141
+ readonly worktreePath?: string | null;
142
+ }) => Effect.Effect<{
143
+ worktreePath?: string | null;
144
+ branch?: string | null;
145
+ modelSelection?: {
146
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
147
+ readonly model: string;
148
+ readonly options?: readonly {
149
+ readonly id: string;
150
+ readonly value: string | boolean;
151
+ }[];
152
+ };
153
+ title?: string;
154
+ type: "thread.meta.update";
155
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
156
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
157
+ }, never, Crypto.Crypto>;
@@ -0,0 +1,8 @@
1
+ import * as Crypto from "effect/Crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import { ModelSelectionError, ThreadEventError } from "../domain/error.ts";
4
+ import { T3Orchestration } from "../orchestration/service.ts";
5
+ import type { UpdateThreadInput } from "./service.ts";
6
+ export declare function makeUpdateThread(): (input: UpdateThreadInput) => Effect.Effect<{
7
+ readonly sequence: number;
8
+ }, ModelSelectionError | ThreadEventError | import("../rpc/error.ts").RpcError, T3Orchestration | Crypto.Crypto>;
@@ -1,14 +1,12 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Stream from "effect/Stream";
3
3
  import { ThreadSessionError } from "../domain/error.ts";
4
- import type { Orchestration } from "../orchestration/service.ts";
4
+ import { T3Orchestration } from "../orchestration/service.ts";
5
5
  import type { WaitEvent } from "./service.ts";
6
6
  export declare function watchThread(input: {
7
- readonly orchestration: Orchestration;
8
7
  readonly threadId: string;
9
- }): Stream.Stream<WaitEvent, ThreadSessionError | import("../rpc/error.ts").RpcError, never>;
8
+ }): Stream.Stream<WaitEvent, ThreadSessionError | import("../rpc/error.ts").RpcError, T3Orchestration>;
10
9
  export declare function waitForThread(input: {
11
- readonly orchestration: Orchestration;
12
10
  readonly threadId: string;
13
11
  }): Effect.Effect<{
14
12
  readonly id: string & import("effect/Brand").Brand<"ThreadId">;
@@ -42,15 +40,6 @@ export declare function waitForThread(input: {
42
40
  readonly updatedAt: string;
43
41
  readonly archivedAt: string | null;
44
42
  readonly deletedAt: string | null;
45
- readonly goal: {
46
- readonly objective: string;
47
- readonly status: "active" | "paused" | "budgetLimited" | "complete";
48
- readonly tokensUsed: number;
49
- readonly tokenBudget: number | null;
50
- readonly timeUsedSeconds: number;
51
- readonly createdAt: string;
52
- readonly updatedAt: string;
53
- } | null;
54
43
  readonly messages: readonly {
55
44
  readonly id: string & import("effect/Brand").Brand<"MessageId">;
56
45
  readonly role: "user" | "assistant" | "system";
@@ -110,4 +99,4 @@ export declare function waitForThread(input: {
110
99
  readonly updatedAt: string;
111
100
  readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
112
101
  } | null;
113
- }, ThreadSessionError | import("../rpc/error.ts").RpcError, never>;
102
+ }, ThreadSessionError | import("../rpc/error.ts").RpcError, T3Orchestration>;