@slopus/happy-agent-client 0.0.3 → 0.0.4
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.
package/README.md
CHANGED
|
@@ -16,3 +16,7 @@ client never dials a socket itself or reads credentials from disk.
|
|
|
16
16
|
|
|
17
17
|
Protocol shapes live in `sources/protocol/`, one file per API chapter, with shared wire
|
|
18
18
|
values declared as TypeBox schemas and their TypeScript types derived with `Static`.
|
|
19
|
+
|
|
20
|
+
Tool calls expose the complete `ToolPresentation` discriminated union — exploration, command,
|
|
21
|
+
background-terminal interaction, file diff, and web/X search — together with an exported TypeBox
|
|
22
|
+
schema for each variant and `toolPresentationSchema` for the whole set.
|
|
@@ -4,87 +4,208 @@
|
|
|
4
4
|
* One message shape carries the whole conversation — history, send acceptances,
|
|
5
5
|
* and events all speak it.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { type Static } from "@sinclair/typebox";
|
|
8
|
+
import { type Cuid2, type EventCursor, type MessageMode, type Timestamp } from "./common.js";
|
|
8
9
|
import type { UsageBreakdown } from "./usage.js";
|
|
9
|
-
/** A tool call rendered for display, from a closed set every client implements once. */
|
|
10
|
-
export type ToolPresentation = ExplorationPresentation | ExecCommandPresentation | BackgroundTerminalInteractionPresentation | FileDiffPresentation | SearchPresentation;
|
|
11
|
-
/** Reading around the codebase: listings, file reads, and searches. */
|
|
12
|
-
export interface ExplorationPresentation {
|
|
13
|
-
type: "exploration";
|
|
14
|
-
operations: ExplorationOperation[];
|
|
15
|
-
}
|
|
16
10
|
/** One read the exploration performed: a listing, a file read, or a search. */
|
|
17
|
-
export
|
|
18
|
-
kind: "list"
|
|
19
|
-
target:
|
|
20
|
-
}
|
|
21
|
-
kind: "read"
|
|
22
|
-
name:
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
11
|
+
export declare const explorationOperationSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
12
|
+
kind: import("@sinclair/typebox").TLiteral<"list">;
|
|
13
|
+
target: import("@sinclair/typebox").TString;
|
|
14
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
15
|
+
kind: import("@sinclair/typebox").TLiteral<"read">;
|
|
16
|
+
name: import("@sinclair/typebox").TString;
|
|
17
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
18
|
+
command: import("@sinclair/typebox").TString;
|
|
19
|
+
kind: import("@sinclair/typebox").TLiteral<"search">;
|
|
20
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
21
|
+
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
|
+
}>]>;
|
|
23
|
+
/** One read the exploration performed: a listing, a file read, or a search. */
|
|
24
|
+
export type ExplorationOperation = Static<typeof explorationOperationSchema>;
|
|
25
|
+
/** Reading around the codebase: listings, file reads, and searches. */
|
|
26
|
+
export declare const explorationPresentationSchema: import("@sinclair/typebox").TObject<{
|
|
27
|
+
operations: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
28
|
+
kind: import("@sinclair/typebox").TLiteral<"list">;
|
|
29
|
+
target: import("@sinclair/typebox").TString;
|
|
30
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
31
|
+
kind: import("@sinclair/typebox").TLiteral<"read">;
|
|
32
|
+
name: import("@sinclair/typebox").TString;
|
|
33
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
34
|
+
command: import("@sinclair/typebox").TString;
|
|
35
|
+
kind: import("@sinclair/typebox").TLiteral<"search">;
|
|
36
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
37
|
+
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
38
|
+
}>]>>;
|
|
39
|
+
type: import("@sinclair/typebox").TLiteral<"exploration">;
|
|
40
|
+
}>;
|
|
41
|
+
/** Reading around the codebase: listings, file reads, and searches. */
|
|
42
|
+
export type ExplorationPresentation = Static<typeof explorationPresentationSchema>;
|
|
29
43
|
/** A shell command; `output` arrives on completion. */
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
output?: string | null;
|
|
44
|
+
export declare const execCommandPresentationSchema: import("@sinclair/typebox").TObject<{
|
|
45
|
+
command: import("@sinclair/typebox").TString;
|
|
46
|
+
output: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
34
47
|
/** Set when the command kept running and became a background terminal. */
|
|
35
|
-
terminalId
|
|
36
|
-
|
|
48
|
+
terminalId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
49
|
+
type: import("@sinclair/typebox").TLiteral<"exec_command">;
|
|
50
|
+
}>;
|
|
51
|
+
/** A shell command; `output` arrives on completion. */
|
|
52
|
+
export type ExecCommandPresentation = Static<typeof execCommandPresentationSchema>;
|
|
37
53
|
/** Input typed into an existing background terminal. */
|
|
38
|
-
export
|
|
39
|
-
type: "background_terminal_interaction";
|
|
40
|
-
terminalId: Cuid2;
|
|
54
|
+
export declare const backgroundTerminalInteractionPresentationSchema: import("@sinclair/typebox").TObject<{
|
|
41
55
|
/** What the terminal is running. */
|
|
42
|
-
command:
|
|
56
|
+
command: import("@sinclair/typebox").TString;
|
|
43
57
|
/** What was typed into it. */
|
|
44
|
-
input:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
input: import("@sinclair/typebox").TString;
|
|
59
|
+
terminalId: import("@sinclair/typebox").TString;
|
|
60
|
+
type: import("@sinclair/typebox").TLiteral<"background_terminal_interaction">;
|
|
61
|
+
}>;
|
|
62
|
+
/** Input typed into an existing background terminal. */
|
|
63
|
+
export type BackgroundTerminalInteractionPresentation = Static<typeof backgroundTerminalInteractionPresentationSchema>;
|
|
64
|
+
/** One line of a hunk. */
|
|
65
|
+
export declare const fileDiffLineSchema: import("@sinclair/typebox").TObject<{
|
|
66
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"context">, import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">]>;
|
|
67
|
+
text: import("@sinclair/typebox").TString;
|
|
68
|
+
}>;
|
|
69
|
+
/** One line of a hunk. */
|
|
70
|
+
export type FileDiffLine = Static<typeof fileDiffLineSchema>;
|
|
71
|
+
/** A contiguous run of diff lines, numbered against both sides. */
|
|
72
|
+
export declare const fileDiffHunkSchema: import("@sinclair/typebox").TObject<{
|
|
73
|
+
lines: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
74
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"context">, import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">]>;
|
|
75
|
+
text: import("@sinclair/typebox").TString;
|
|
76
|
+
}>>;
|
|
77
|
+
newStart: import("@sinclair/typebox").TInteger;
|
|
78
|
+
oldStart: import("@sinclair/typebox").TInteger;
|
|
79
|
+
}>;
|
|
80
|
+
/** A contiguous run of diff lines, numbered against both sides. */
|
|
81
|
+
export type FileDiffHunk = Static<typeof fileDiffHunkSchema>;
|
|
53
82
|
/** One file's changes inside a diff presentation. */
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
83
|
+
export declare const fileDiffSchema: import("@sinclair/typebox").TObject<{
|
|
84
|
+
added: import("@sinclair/typebox").TInteger;
|
|
85
|
+
deleted: import("@sinclair/typebox").TInteger;
|
|
86
|
+
hunks: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
87
|
+
lines: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
88
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"context">, import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">]>;
|
|
89
|
+
text: import("@sinclair/typebox").TString;
|
|
90
|
+
}>>;
|
|
91
|
+
newStart: import("@sinclair/typebox").TInteger;
|
|
92
|
+
oldStart: import("@sinclair/typebox").TInteger;
|
|
93
|
+
}>>;
|
|
94
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">, import("@sinclair/typebox").TLiteral<"update">]>;
|
|
57
95
|
/** For syntax highlighting, when the daemon could name the language. */
|
|
58
|
-
language
|
|
59
|
-
added: number;
|
|
60
|
-
deleted: number;
|
|
96
|
+
language: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
61
97
|
/** How many lines this file's hunks left out. */
|
|
62
|
-
omittedLines
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
export
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
omittedLines: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
99
|
+
path: import("@sinclair/typebox").TString;
|
|
100
|
+
}>;
|
|
101
|
+
/** One file's changes inside a diff presentation. */
|
|
102
|
+
export type FileDiff = Static<typeof fileDiffSchema>;
|
|
103
|
+
/** File changes, one or many files per call. */
|
|
104
|
+
export declare const fileDiffPresentationSchema: import("@sinclair/typebox").TObject<{
|
|
105
|
+
files: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
106
|
+
added: import("@sinclair/typebox").TInteger;
|
|
107
|
+
deleted: import("@sinclair/typebox").TInteger;
|
|
108
|
+
hunks: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
109
|
+
lines: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
110
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"context">, import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">]>;
|
|
111
|
+
text: import("@sinclair/typebox").TString;
|
|
112
|
+
}>>;
|
|
113
|
+
newStart: import("@sinclair/typebox").TInteger;
|
|
114
|
+
oldStart: import("@sinclair/typebox").TInteger;
|
|
115
|
+
}>>;
|
|
116
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">, import("@sinclair/typebox").TLiteral<"update">]>;
|
|
117
|
+
/** For syntax highlighting, when the daemon could name the language. */
|
|
118
|
+
language: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
119
|
+
/** How many lines this file's hunks left out. */
|
|
120
|
+
omittedLines: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
121
|
+
path: import("@sinclair/typebox").TString;
|
|
122
|
+
}>>;
|
|
123
|
+
/** How many files the call changed but the presentation left out. */
|
|
124
|
+
omittedFiles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
125
|
+
type: import("@sinclair/typebox").TLiteral<"file_diff">;
|
|
126
|
+
}>;
|
|
127
|
+
/** File changes, one or many files per call. */
|
|
128
|
+
export type FileDiffPresentation = Static<typeof fileDiffPresentationSchema>;
|
|
83
129
|
/** One source a search drew from. */
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
130
|
+
export declare const searchSourceSchema: import("@sinclair/typebox").TObject<{
|
|
131
|
+
title: import("@sinclair/typebox").TString;
|
|
132
|
+
url: import("@sinclair/typebox").TString;
|
|
133
|
+
}>;
|
|
134
|
+
/** One source a search drew from. */
|
|
135
|
+
export type SearchSource = Static<typeof searchSourceSchema>;
|
|
136
|
+
/** A web or X search; `sources` arrives on completion. */
|
|
137
|
+
export declare const searchPresentationSchema: import("@sinclair/typebox").TObject<{
|
|
138
|
+
query: import("@sinclair/typebox").TString;
|
|
139
|
+
sources: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
140
|
+
title: import("@sinclair/typebox").TString;
|
|
141
|
+
url: import("@sinclair/typebox").TString;
|
|
142
|
+
}>>>;
|
|
143
|
+
target: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"web">, import("@sinclair/typebox").TLiteral<"x">]>;
|
|
144
|
+
type: import("@sinclair/typebox").TLiteral<"search">;
|
|
145
|
+
}>;
|
|
146
|
+
/** A web or X search; `sources` arrives on completion. */
|
|
147
|
+
export type SearchPresentation = Static<typeof searchPresentationSchema>;
|
|
148
|
+
/** Every display-ready tool-call presentation the client understands. */
|
|
149
|
+
export declare const toolPresentationSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
150
|
+
operations: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
151
|
+
kind: import("@sinclair/typebox").TLiteral<"list">;
|
|
152
|
+
target: import("@sinclair/typebox").TString;
|
|
153
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
154
|
+
kind: import("@sinclair/typebox").TLiteral<"read">;
|
|
155
|
+
name: import("@sinclair/typebox").TString;
|
|
156
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
157
|
+
command: import("@sinclair/typebox").TString;
|
|
158
|
+
kind: import("@sinclair/typebox").TLiteral<"search">;
|
|
159
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
160
|
+
query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
161
|
+
}>]>>;
|
|
162
|
+
type: import("@sinclair/typebox").TLiteral<"exploration">;
|
|
163
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
164
|
+
command: import("@sinclair/typebox").TString;
|
|
165
|
+
output: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
166
|
+
/** Set when the command kept running and became a background terminal. */
|
|
167
|
+
terminalId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
168
|
+
type: import("@sinclair/typebox").TLiteral<"exec_command">;
|
|
169
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
170
|
+
/** What the terminal is running. */
|
|
171
|
+
command: import("@sinclair/typebox").TString;
|
|
172
|
+
/** What was typed into it. */
|
|
173
|
+
input: import("@sinclair/typebox").TString;
|
|
174
|
+
terminalId: import("@sinclair/typebox").TString;
|
|
175
|
+
type: import("@sinclair/typebox").TLiteral<"background_terminal_interaction">;
|
|
176
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
177
|
+
files: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
178
|
+
added: import("@sinclair/typebox").TInteger;
|
|
179
|
+
deleted: import("@sinclair/typebox").TInteger;
|
|
180
|
+
hunks: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
181
|
+
lines: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
182
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"context">, import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">]>;
|
|
183
|
+
text: import("@sinclair/typebox").TString;
|
|
184
|
+
}>>;
|
|
185
|
+
newStart: import("@sinclair/typebox").TInteger;
|
|
186
|
+
oldStart: import("@sinclair/typebox").TInteger;
|
|
187
|
+
}>>;
|
|
188
|
+
kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"add">, import("@sinclair/typebox").TLiteral<"delete">, import("@sinclair/typebox").TLiteral<"update">]>;
|
|
189
|
+
/** For syntax highlighting, when the daemon could name the language. */
|
|
190
|
+
language: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
191
|
+
/** How many lines this file's hunks left out. */
|
|
192
|
+
omittedLines: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
193
|
+
path: import("@sinclair/typebox").TString;
|
|
194
|
+
}>>;
|
|
195
|
+
/** How many files the call changed but the presentation left out. */
|
|
196
|
+
omittedFiles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
197
|
+
type: import("@sinclair/typebox").TLiteral<"file_diff">;
|
|
198
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
199
|
+
query: import("@sinclair/typebox").TString;
|
|
200
|
+
sources: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
201
|
+
title: import("@sinclair/typebox").TString;
|
|
202
|
+
url: import("@sinclair/typebox").TString;
|
|
203
|
+
}>>>;
|
|
204
|
+
target: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"web">, import("@sinclair/typebox").TLiteral<"x">]>;
|
|
205
|
+
type: import("@sinclair/typebox").TLiteral<"search">;
|
|
206
|
+
}>]>;
|
|
207
|
+
/** Every display-ready tool-call presentation the client understands. */
|
|
208
|
+
export type ToolPresentation = Static<typeof toolPresentationSchema>;
|
|
88
209
|
/** What is in a message, in order. */
|
|
89
210
|
export type MessageBlock = TextBlock | ImageBlock | ReasoningBlock | ToolCallBlock;
|
|
90
211
|
/** Plain text. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../sources/protocol/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../sources/protocol/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH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IACrB,kFAAkF;IAClF,MAAM,EAAE,WAAW,CAAC;CACvB;AAED,2DAA2D;AAC3D,MAAM,WAAW,mBAAmB;IAChC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,4DAA4D;IAC5D,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,yCAAyC;AACzC,MAAM,WAAW,sBAAsB;IACnC,qCAAqC;IACrC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB;;;OAGG;IACH,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -4,5 +4,86 @@
|
|
|
4
4
|
* One message shape carries the whole conversation — history, send acceptances,
|
|
5
5
|
* and events all speak it.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import { Type } from "@sinclair/typebox";
|
|
8
|
+
import { cuid2Schema, Nullable, } from "./common.js";
|
|
9
|
+
/** One read the exploration performed: a listing, a file read, or a search. */
|
|
10
|
+
export const explorationOperationSchema = Type.Union([
|
|
11
|
+
Type.Object({ kind: Type.Literal("list"), target: Type.String() }),
|
|
12
|
+
Type.Object({ kind: Type.Literal("read"), name: Type.String() }),
|
|
13
|
+
Type.Object({
|
|
14
|
+
command: Type.String(),
|
|
15
|
+
kind: Type.Literal("search"),
|
|
16
|
+
path: Type.Optional(Type.String()),
|
|
17
|
+
query: Type.Optional(Type.String()),
|
|
18
|
+
}),
|
|
19
|
+
]);
|
|
20
|
+
/** Reading around the codebase: listings, file reads, and searches. */
|
|
21
|
+
export const explorationPresentationSchema = Type.Object({
|
|
22
|
+
operations: Type.Array(explorationOperationSchema),
|
|
23
|
+
type: Type.Literal("exploration"),
|
|
24
|
+
});
|
|
25
|
+
/** A shell command; `output` arrives on completion. */
|
|
26
|
+
export const execCommandPresentationSchema = Type.Object({
|
|
27
|
+
command: Type.String(),
|
|
28
|
+
output: Type.Optional(Nullable(Type.String())),
|
|
29
|
+
/** Set when the command kept running and became a background terminal. */
|
|
30
|
+
terminalId: Type.Optional(Nullable(cuid2Schema)),
|
|
31
|
+
type: Type.Literal("exec_command"),
|
|
32
|
+
});
|
|
33
|
+
/** Input typed into an existing background terminal. */
|
|
34
|
+
export const backgroundTerminalInteractionPresentationSchema = Type.Object({
|
|
35
|
+
/** What the terminal is running. */
|
|
36
|
+
command: Type.String(),
|
|
37
|
+
/** What was typed into it. */
|
|
38
|
+
input: Type.String(),
|
|
39
|
+
terminalId: cuid2Schema,
|
|
40
|
+
type: Type.Literal("background_terminal_interaction"),
|
|
41
|
+
});
|
|
42
|
+
/** One line of a hunk. */
|
|
43
|
+
export const fileDiffLineSchema = Type.Object({
|
|
44
|
+
kind: Type.Union([Type.Literal("context"), Type.Literal("add"), Type.Literal("delete")]),
|
|
45
|
+
text: Type.String(),
|
|
46
|
+
});
|
|
47
|
+
/** A contiguous run of diff lines, numbered against both sides. */
|
|
48
|
+
export const fileDiffHunkSchema = Type.Object({
|
|
49
|
+
lines: Type.Array(fileDiffLineSchema),
|
|
50
|
+
newStart: Type.Integer({ minimum: 0 }),
|
|
51
|
+
oldStart: Type.Integer({ minimum: 0 }),
|
|
52
|
+
});
|
|
53
|
+
/** One file's changes inside a diff presentation. */
|
|
54
|
+
export const fileDiffSchema = Type.Object({
|
|
55
|
+
added: Type.Integer({ minimum: 0 }),
|
|
56
|
+
deleted: Type.Integer({ minimum: 0 }),
|
|
57
|
+
hunks: Type.Array(fileDiffHunkSchema),
|
|
58
|
+
kind: Type.Union([Type.Literal("add"), Type.Literal("delete"), Type.Literal("update")]),
|
|
59
|
+
/** For syntax highlighting, when the daemon could name the language. */
|
|
60
|
+
language: Type.Optional(Type.String()),
|
|
61
|
+
/** How many lines this file's hunks left out. */
|
|
62
|
+
omittedLines: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
63
|
+
path: Type.String(),
|
|
64
|
+
});
|
|
65
|
+
/** File changes, one or many files per call. */
|
|
66
|
+
export const fileDiffPresentationSchema = Type.Object({
|
|
67
|
+
files: Type.Array(fileDiffSchema),
|
|
68
|
+
/** How many files the call changed but the presentation left out. */
|
|
69
|
+
omittedFiles: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
70
|
+
type: Type.Literal("file_diff"),
|
|
71
|
+
});
|
|
72
|
+
/** One source a search drew from. */
|
|
73
|
+
export const searchSourceSchema = Type.Object({ title: Type.String(), url: Type.String() });
|
|
74
|
+
/** A web or X search; `sources` arrives on completion. */
|
|
75
|
+
export const searchPresentationSchema = Type.Object({
|
|
76
|
+
query: Type.String(),
|
|
77
|
+
sources: Type.Optional(Type.Array(searchSourceSchema)),
|
|
78
|
+
target: Type.Union([Type.Literal("web"), Type.Literal("x")]),
|
|
79
|
+
type: Type.Literal("search"),
|
|
80
|
+
});
|
|
81
|
+
/** Every display-ready tool-call presentation the client understands. */
|
|
82
|
+
export const toolPresentationSchema = Type.Union([
|
|
83
|
+
explorationPresentationSchema,
|
|
84
|
+
execCommandPresentationSchema,
|
|
85
|
+
backgroundTerminalInteractionPresentationSchema,
|
|
86
|
+
fileDiffPresentationSchema,
|
|
87
|
+
searchPresentationSchema,
|
|
88
|
+
]);
|
|
8
89
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../sources/protocol/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../sources/protocol/messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACH,WAAW,EACX,QAAQ,GAKX,MAAM,aAAa,CAAC;AAGrB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC,KAAK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