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
@@ -0,0 +1,19 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { ModelSelection } from "#t3tools/contracts";
3
+ import type { OrchestrationProjectShell } from "#t3tools/contracts";
4
+ import { ModelSelectionError } from "../domain/error.ts";
5
+ import type { ServerConfigForCli } from "../orchestration/service.ts";
6
+ import type { StartThreadInput } from "./service.ts";
7
+ export declare function resolveModelSelection(input: {
8
+ readonly start: StartThreadInput;
9
+ readonly project: OrchestrationProjectShell;
10
+ readonly serverConfig: ServerConfigForCli;
11
+ }): Effect.Effect<{
12
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
13
+ readonly model: string;
14
+ readonly options?: readonly {
15
+ readonly id: string;
16
+ readonly value: string | boolean;
17
+ }[];
18
+ }, ModelSelectionError, never>;
19
+ export declare function mergeModelOptions(selection: ModelSelection, options: NonNullable<ModelSelection["options"]>): ModelSelection;
@@ -0,0 +1,93 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { T3Orchestration } from "../orchestration/service.ts";
3
+ export declare const makeModelsApplication: () => Effect.Effect<{
4
+ listModels: (input: {
5
+ readonly all?: boolean;
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 message?: string | undefined;
74
+ readonly availability?: "available" | "unavailable" | undefined;
75
+ readonly unavailableReason?: string | undefined;
76
+ readonly versionAdvisory?: {
77
+ readonly status: "unknown" | "current" | "behind_latest";
78
+ readonly currentVersion: string | null;
79
+ readonly latestVersion: string | null;
80
+ readonly updateCommand: string | null;
81
+ readonly canUpdate: boolean;
82
+ readonly checkedAt: string | null;
83
+ readonly message: string | null;
84
+ };
85
+ readonly updateState?: {
86
+ readonly status: "idle" | "running" | "failed" | "queued" | "succeeded" | "unchanged";
87
+ readonly startedAt: string | null;
88
+ readonly finishedAt: string | null;
89
+ readonly message: string | null;
90
+ readonly output: string | null;
91
+ };
92
+ }[], import("../rpc/error.ts").RpcError, never>;
93
+ }, never, T3Orchestration>;
@@ -0,0 +1,15 @@
1
+ import * as Crypto from "effect/Crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Path from "effect/Path";
4
+ import { Environment } from "../environment/service.ts";
5
+ export declare const makeProjectCreateCommand: (input: {
6
+ readonly path: string;
7
+ readonly title?: string;
8
+ }) => Effect.Effect<{
9
+ type: "project.create";
10
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
11
+ projectId: string & import("effect/Brand").Brand<"ProjectId">;
12
+ title: string;
13
+ workspaceRoot: string;
14
+ createdAt: string;
15
+ }, never, Environment | Path.Path | Crypto.Crypto>;
@@ -0,0 +1,136 @@
1
+ import * as Crypto from "effect/Crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Path from "effect/Path";
4
+ import { Environment } from "../environment/service.ts";
5
+ import { T3Orchestration } from "../orchestration/service.ts";
6
+ import { ProjectCreateVisibilityError } from "../domain/error.ts";
7
+ 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 latestUserMessageAt: string | null;
87
+ readonly hasPendingApprovals: boolean;
88
+ readonly hasPendingUserInput: boolean;
89
+ readonly hasActionableProposedPlan: boolean;
90
+ }[];
91
+ readonly updatedAt: string;
92
+ }, import("../rpc/error.ts").RpcError, never>;
93
+ addProject: (projectInput: {
94
+ readonly path: string;
95
+ readonly title?: string;
96
+ }) => Effect.Effect<{
97
+ dispatch: {
98
+ readonly sequence: number;
99
+ };
100
+ project: {
101
+ readonly id: string & import("effect/Brand").Brand<"ProjectId">;
102
+ readonly title: string;
103
+ readonly workspaceRoot: string;
104
+ readonly defaultModelSelection: {
105
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
106
+ readonly model: string;
107
+ readonly options?: readonly {
108
+ readonly id: string;
109
+ readonly value: string | boolean;
110
+ }[];
111
+ } | null;
112
+ readonly scripts: readonly {
113
+ readonly id: string;
114
+ readonly name: string;
115
+ readonly command: string;
116
+ readonly icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
117
+ readonly runOnWorktreeCreate: boolean;
118
+ }[];
119
+ readonly createdAt: string;
120
+ readonly updatedAt: string;
121
+ readonly repositoryIdentity?: {
122
+ readonly canonicalKey: string;
123
+ readonly locator: {
124
+ readonly source: "git-remote";
125
+ readonly remoteName: string;
126
+ readonly remoteUrl: string;
127
+ };
128
+ readonly rootPath?: string;
129
+ readonly displayName?: string;
130
+ readonly provider?: string;
131
+ readonly owner?: string;
132
+ readonly name?: string;
133
+ } | null | undefined;
134
+ };
135
+ }, ProjectCreateVisibilityError | import("../rpc/error.ts").RpcError, never>;
136
+ }, never, Environment | Path.Path | Crypto.Crypto | T3Orchestration>;
@@ -0,0 +1,72 @@
1
+ import * as Context from "effect/Context";
2
+ import type * as Effect from "effect/Effect";
3
+ import type * as Stream from "effect/Stream";
4
+ import type { DispatchResult, ModelSelection, OrchestrationMessage, OrchestrationProjectShell, OrchestrationShellSnapshot, OrchestrationThread, OrchestrationThreadShell, ServerProvider } from "#t3tools/contracts";
5
+ import type { ApplicationError } from "./error.ts";
6
+ export type StartThreadInput = {
7
+ readonly projectRef: string;
8
+ readonly message: string;
9
+ readonly title?: string;
10
+ readonly provider?: string;
11
+ readonly model?: string;
12
+ readonly options?: NonNullable<ModelSelection["options"]>;
13
+ readonly worktreePath?: string;
14
+ };
15
+ export type SendThreadInput = {
16
+ readonly threadId: string;
17
+ readonly message: string;
18
+ readonly options?: NonNullable<ModelSelection["options"]>;
19
+ };
20
+ export type StartThreadPolicy = {
21
+ readonly until: "dispatch" | "visible" | "complete";
22
+ };
23
+ export type WaitEvent = {
24
+ readonly type: "thread";
25
+ readonly thread: OrchestrationThread;
26
+ } | {
27
+ readonly type: "message";
28
+ readonly message: OrchestrationMessage;
29
+ } | {
30
+ readonly type: "status";
31
+ readonly status: string;
32
+ readonly threadId: string;
33
+ } | {
34
+ readonly type: "done";
35
+ readonly thread: OrchestrationThread;
36
+ };
37
+ declare const T3Application_base: Context.ServiceClass<T3Application, "t3cli/T3Application", {
38
+ readonly loadShell: () => Effect.Effect<OrchestrationShellSnapshot, ApplicationError>;
39
+ readonly listModels: (input: {
40
+ readonly all?: boolean;
41
+ readonly provider?: string;
42
+ }) => Effect.Effect<ReadonlyArray<ServerProvider>, ApplicationError>;
43
+ readonly addProject: (input: {
44
+ readonly path: string;
45
+ readonly title?: string;
46
+ }) => Effect.Effect<{
47
+ readonly dispatch: DispatchResult;
48
+ readonly project: OrchestrationProjectShell;
49
+ }, ApplicationError>;
50
+ readonly listThreads: (projectRef: string) => Effect.Effect<{
51
+ readonly project: OrchestrationProjectShell;
52
+ readonly threads: ReadonlyArray<OrchestrationThreadShell>;
53
+ }, ApplicationError>;
54
+ readonly getThreadMessages: (threadId: string) => Effect.Effect<OrchestrationThread, ApplicationError>;
55
+ readonly archiveThread: (threadId: string) => Effect.Effect<DispatchResult, ApplicationError>;
56
+ readonly startThread: (input: StartThreadInput, policy?: StartThreadPolicy) => Effect.Effect<{
57
+ readonly dispatch: DispatchResult;
58
+ readonly project: OrchestrationProjectShell;
59
+ readonly threadId: string;
60
+ readonly thread?: OrchestrationThread;
61
+ }, ApplicationError>;
62
+ readonly sendThread: (input: SendThreadInput, policy?: StartThreadPolicy) => Effect.Effect<{
63
+ readonly dispatch: DispatchResult;
64
+ readonly threadId: string;
65
+ readonly thread?: OrchestrationThread;
66
+ }, ApplicationError>;
67
+ readonly watchThread: (threadId: string) => Stream.Stream<WaitEvent, ApplicationError>;
68
+ readonly waitForThread: (threadId: string) => Effect.Effect<OrchestrationThread, ApplicationError>;
69
+ }>;
70
+ export declare class T3Application extends T3Application_base {
71
+ }
72
+ export {};
@@ -0,0 +1,91 @@
1
+ import * as Effect from "effect/Effect";
2
+ import type { Orchestration } from "../orchestration/service.ts";
3
+ import { RpcError } from "../rpc/error.ts";
4
+ export declare function waitForShellSequence(input: {
5
+ readonly orchestration: Orchestration;
6
+ readonly sequence: number;
7
+ }): Effect.Effect<{
8
+ readonly snapshotSequence: number;
9
+ readonly projects: readonly {
10
+ readonly id: string & import("effect/Brand").Brand<"ProjectId">;
11
+ readonly title: string;
12
+ readonly workspaceRoot: string;
13
+ readonly defaultModelSelection: {
14
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
15
+ readonly model: string;
16
+ readonly options?: readonly {
17
+ readonly id: string;
18
+ readonly value: string | boolean;
19
+ }[];
20
+ } | null;
21
+ readonly scripts: readonly {
22
+ readonly id: string;
23
+ readonly name: string;
24
+ readonly command: string;
25
+ readonly icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
26
+ readonly runOnWorktreeCreate: boolean;
27
+ }[];
28
+ readonly createdAt: string;
29
+ readonly updatedAt: string;
30
+ readonly repositoryIdentity?: {
31
+ readonly canonicalKey: string;
32
+ readonly locator: {
33
+ readonly source: "git-remote";
34
+ readonly remoteName: string;
35
+ readonly remoteUrl: string;
36
+ };
37
+ readonly rootPath?: string;
38
+ readonly displayName?: string;
39
+ readonly provider?: string;
40
+ readonly owner?: string;
41
+ readonly name?: string;
42
+ } | null | undefined;
43
+ }[];
44
+ readonly threads: readonly {
45
+ readonly id: string & import("effect/Brand").Brand<"ThreadId">;
46
+ readonly projectId: string & import("effect/Brand").Brand<"ProjectId">;
47
+ readonly title: string;
48
+ readonly modelSelection: {
49
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
50
+ readonly model: string;
51
+ readonly options?: readonly {
52
+ readonly id: string;
53
+ readonly value: string | boolean;
54
+ }[];
55
+ };
56
+ readonly runtimeMode: "approval-required" | "auto-accept-edits" | "full-access";
57
+ readonly interactionMode: "default" | "plan";
58
+ readonly branch: string | null;
59
+ readonly worktreePath: string | null;
60
+ readonly latestTurn: {
61
+ readonly turnId: string & import("effect/Brand").Brand<"TurnId">;
62
+ readonly state: "error" | "running" | "interrupted" | "completed";
63
+ readonly requestedAt: string;
64
+ readonly startedAt: string | null;
65
+ readonly completedAt: string | null;
66
+ readonly assistantMessageId: (string & import("effect/Brand").Brand<"MessageId">) | null;
67
+ readonly sourceProposedPlan?: {
68
+ readonly threadId: string & import("effect/Brand").Brand<"ThreadId">;
69
+ readonly planId: string;
70
+ } | undefined;
71
+ } | null;
72
+ readonly createdAt: string;
73
+ readonly updatedAt: string;
74
+ readonly archivedAt: string | null;
75
+ readonly session: {
76
+ readonly threadId: string & import("effect/Brand").Brand<"ThreadId">;
77
+ readonly status: "error" | "idle" | "starting" | "running" | "ready" | "interrupted" | "stopped";
78
+ readonly providerName: string | null;
79
+ readonly runtimeMode: "approval-required" | "auto-accept-edits" | "full-access";
80
+ readonly activeTurnId: (string & import("effect/Brand").Brand<"TurnId">) | null;
81
+ readonly lastError: string | null;
82
+ readonly updatedAt: string;
83
+ readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
84
+ } | null;
85
+ readonly latestUserMessageAt: string | null;
86
+ readonly hasPendingApprovals: boolean;
87
+ readonly hasPendingUserInput: boolean;
88
+ readonly hasActionableProposedPlan: boolean;
89
+ }[];
90
+ readonly updatedAt: string;
91
+ }, RpcError, never>;
@@ -0,0 +1,84 @@
1
+ import * as Crypto from "effect/Crypto";
2
+ import * as Effect from "effect/Effect";
3
+ import { type ModelSelection, type OrchestrationProjectShell } from "#t3tools/contracts";
4
+ import type { ServerConfigForCli } from "../orchestration/service.ts";
5
+ import type { SendThreadInput, StartThreadInput } from "./service.ts";
6
+ export declare const makeThreadStartCommands: (input: {
7
+ readonly start: StartThreadInput;
8
+ readonly project: OrchestrationProjectShell;
9
+ readonly serverConfig: ServerConfigForCli;
10
+ }) => Effect.Effect<{
11
+ createCommand: {
12
+ type: "thread.create";
13
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
14
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
15
+ projectId: string & import("effect/Brand").Brand<"ProjectId">;
16
+ title: string;
17
+ modelSelection: {
18
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
19
+ readonly model: string;
20
+ readonly options?: readonly {
21
+ readonly id: string;
22
+ readonly value: string | boolean;
23
+ }[];
24
+ };
25
+ runtimeMode: "full-access";
26
+ interactionMode: "default";
27
+ branch: null;
28
+ worktreePath: string | null;
29
+ createdAt: string;
30
+ };
31
+ turnCommand: {
32
+ type: "thread.turn.start";
33
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
34
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
35
+ message: {
36
+ messageId: string & import("effect/Brand").Brand<"MessageId">;
37
+ role: "user";
38
+ text: string;
39
+ attachments: never[];
40
+ };
41
+ modelSelection: {
42
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
43
+ readonly model: string;
44
+ readonly options?: readonly {
45
+ readonly id: string;
46
+ readonly value: string | boolean;
47
+ }[];
48
+ };
49
+ titleSeed: string;
50
+ runtimeMode: "full-access";
51
+ interactionMode: "default";
52
+ createdAt: string;
53
+ };
54
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
55
+ }, import("../domain/error.ts").ModelSelectionError, Crypto.Crypto>;
56
+ export declare const makeThreadTurnContinueCommand: (input: SendThreadInput & {
57
+ readonly modelSelection?: ModelSelection;
58
+ }) => Effect.Effect<{
59
+ createdAt: string;
60
+ modelSelection?: {
61
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
62
+ readonly model: string;
63
+ readonly options?: readonly {
64
+ readonly id: string;
65
+ readonly value: string | boolean;
66
+ }[];
67
+ };
68
+ type: "thread.turn.start";
69
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
70
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
71
+ message: {
72
+ messageId: string & import("effect/Brand").Brand<"MessageId">;
73
+ role: "user";
74
+ text: string;
75
+ attachments: never[];
76
+ };
77
+ runtimeMode: "full-access";
78
+ interactionMode: "default";
79
+ }, never, Crypto.Crypto>;
80
+ export declare const makeThreadArchiveCommand: (threadId: string) => Effect.Effect<{
81
+ type: "thread.archive";
82
+ commandId: string & import("effect/Brand").Brand<"CommandId">;
83
+ threadId: string & import("effect/Brand").Brand<"ThreadId">;
84
+ }, never, Crypto.Crypto>;
@@ -0,0 +1,104 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Stream from "effect/Stream";
3
+ import { ThreadSessionError } from "../domain/error.ts";
4
+ import type { Orchestration } from "../orchestration/service.ts";
5
+ import type { WaitEvent } from "./service.ts";
6
+ export declare function watchThread(input: {
7
+ readonly orchestration: Orchestration;
8
+ readonly threadId: string;
9
+ }): Stream.Stream<WaitEvent, ThreadSessionError | import("../rpc/error.ts").RpcError, never>;
10
+ export declare function waitForThread(input: {
11
+ readonly orchestration: Orchestration;
12
+ readonly threadId: string;
13
+ }): Effect.Effect<{
14
+ readonly id: string & import("effect/Brand").Brand<"ThreadId">;
15
+ readonly projectId: string & import("effect/Brand").Brand<"ProjectId">;
16
+ readonly title: string;
17
+ readonly modelSelection: {
18
+ readonly instanceId: string & import("effect/Brand").Brand<"ProviderInstanceId">;
19
+ readonly model: string;
20
+ readonly options?: readonly {
21
+ readonly id: string;
22
+ readonly value: string | boolean;
23
+ }[];
24
+ };
25
+ readonly runtimeMode: "approval-required" | "auto-accept-edits" | "full-access";
26
+ readonly interactionMode: "default" | "plan";
27
+ readonly branch: string | null;
28
+ readonly worktreePath: string | null;
29
+ readonly latestTurn: {
30
+ readonly turnId: string & import("effect/Brand").Brand<"TurnId">;
31
+ readonly state: "error" | "running" | "interrupted" | "completed";
32
+ readonly requestedAt: string;
33
+ readonly startedAt: string | null;
34
+ readonly completedAt: string | null;
35
+ readonly assistantMessageId: (string & import("effect/Brand").Brand<"MessageId">) | null;
36
+ readonly sourceProposedPlan?: {
37
+ readonly threadId: string & import("effect/Brand").Brand<"ThreadId">;
38
+ readonly planId: string;
39
+ } | undefined;
40
+ } | null;
41
+ readonly createdAt: string;
42
+ readonly updatedAt: string;
43
+ readonly archivedAt: string | null;
44
+ readonly deletedAt: string | null;
45
+ readonly messages: readonly {
46
+ readonly id: string & import("effect/Brand").Brand<"MessageId">;
47
+ readonly role: "user" | "assistant" | "system";
48
+ readonly text: string;
49
+ readonly turnId: (string & import("effect/Brand").Brand<"TurnId">) | null;
50
+ readonly streaming: boolean;
51
+ readonly createdAt: string;
52
+ readonly updatedAt: string;
53
+ readonly attachments?: readonly {
54
+ readonly type: "image";
55
+ readonly id: string;
56
+ readonly name: string;
57
+ readonly mimeType: string;
58
+ readonly sizeBytes: number;
59
+ }[] | undefined;
60
+ }[];
61
+ readonly proposedPlans: readonly {
62
+ readonly id: string;
63
+ readonly turnId: (string & import("effect/Brand").Brand<"TurnId">) | null;
64
+ readonly planMarkdown: string;
65
+ readonly implementedAt: string | null;
66
+ readonly implementationThreadId: (string & import("effect/Brand").Brand<"ThreadId">) | null;
67
+ readonly createdAt: string;
68
+ readonly updatedAt: string;
69
+ }[];
70
+ readonly activities: readonly {
71
+ readonly id: string & import("effect/Brand").Brand<"EventId">;
72
+ readonly tone: "error" | "info" | "tool" | "approval";
73
+ readonly kind: string;
74
+ readonly summary: string;
75
+ readonly payload: unknown;
76
+ readonly turnId: (string & import("effect/Brand").Brand<"TurnId">) | null;
77
+ readonly createdAt: string;
78
+ readonly sequence?: number | undefined;
79
+ }[];
80
+ readonly checkpoints: readonly {
81
+ readonly turnId: string & import("effect/Brand").Brand<"TurnId">;
82
+ readonly checkpointTurnCount: number;
83
+ readonly checkpointRef: string & import("effect/Brand").Brand<"CheckpointRef">;
84
+ readonly status: "error" | "ready" | "missing";
85
+ readonly files: readonly {
86
+ readonly path: string;
87
+ readonly kind: string;
88
+ readonly additions: number;
89
+ readonly deletions: number;
90
+ }[];
91
+ readonly assistantMessageId: (string & import("effect/Brand").Brand<"MessageId">) | null;
92
+ readonly completedAt: string;
93
+ }[];
94
+ readonly session: {
95
+ readonly threadId: string & import("effect/Brand").Brand<"ThreadId">;
96
+ readonly status: "error" | "idle" | "starting" | "running" | "ready" | "interrupted" | "stopped";
97
+ readonly providerName: string | null;
98
+ readonly runtimeMode: "approval-required" | "auto-accept-edits" | "full-access";
99
+ readonly activeTurnId: (string & import("effect/Brand").Brand<"TurnId">) | null;
100
+ readonly lastError: string | null;
101
+ readonly updatedAt: string;
102
+ readonly providerInstanceId?: (string & import("effect/Brand").Brand<"ProviderInstanceId">) | undefined;
103
+ } | null;
104
+ }, ThreadSessionError | import("../rpc/error.ts").RpcError, never>;