@mossbear/protocol 0.1.0-alpha.114 → 0.1.0-alpha.116

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 (73) hide show
  1. package/dist/bundles.d.ts +662 -0
  2. package/dist/bundles.d.ts.map +1 -0
  3. package/dist/bundles.js +454 -0
  4. package/dist/bundles.js.map +1 -0
  5. package/dist/bundles.test.d.ts +2 -0
  6. package/dist/bundles.test.d.ts.map +1 -0
  7. package/dist/bundles.test.js +61 -0
  8. package/dist/bundles.test.js.map +1 -0
  9. package/dist/comments.d.ts +1405 -0
  10. package/dist/comments.d.ts.map +1 -0
  11. package/dist/comments.js +683 -0
  12. package/dist/comments.js.map +1 -0
  13. package/dist/comments.test.d.ts +2 -0
  14. package/dist/comments.test.d.ts.map +1 -0
  15. package/dist/comments.test.js +64 -0
  16. package/dist/comments.test.js.map +1 -0
  17. package/dist/guideHistory.d.ts +643 -0
  18. package/dist/guideHistory.d.ts.map +1 -0
  19. package/dist/guideHistory.js +343 -0
  20. package/dist/guideHistory.js.map +1 -0
  21. package/dist/guideHistory.test.d.ts +2 -0
  22. package/dist/guideHistory.test.d.ts.map +1 -0
  23. package/dist/guideHistory.test.js +35 -0
  24. package/dist/guideHistory.test.js.map +1 -0
  25. package/dist/guideImport.d.ts +398 -0
  26. package/dist/guideImport.d.ts.map +1 -0
  27. package/dist/guideImport.js +350 -0
  28. package/dist/guideImport.js.map +1 -0
  29. package/dist/guideImport.test.d.ts +2 -0
  30. package/dist/guideImport.test.d.ts.map +1 -0
  31. package/dist/guideImport.test.js +62 -0
  32. package/dist/guideImport.test.js.map +1 -0
  33. package/dist/guideSnapshot.d.ts +105 -0
  34. package/dist/guideSnapshot.d.ts.map +1 -0
  35. package/dist/guideSnapshot.js +101 -0
  36. package/dist/guideSnapshot.js.map +1 -0
  37. package/dist/guideSnapshot.test.d.ts +2 -0
  38. package/dist/guideSnapshot.test.d.ts.map +1 -0
  39. package/dist/guideSnapshot.test.js +49 -0
  40. package/dist/guideSnapshot.test.js.map +1 -0
  41. package/dist/schemas.d.ts +5122 -11710
  42. package/dist/schemas.d.ts.map +1 -1
  43. package/dist/schemas.js +61 -2816
  44. package/dist/schemas.js.map +1 -1
  45. package/dist/search.d.ts +1222 -0
  46. package/dist/search.d.ts.map +1 -0
  47. package/dist/search.js +474 -0
  48. package/dist/search.js.map +1 -0
  49. package/dist/search.test.d.ts +2 -0
  50. package/dist/search.test.d.ts.map +1 -0
  51. package/dist/search.test.js +64 -0
  52. package/dist/search.test.js.map +1 -0
  53. package/dist/sessionContracts.test.d.ts +2 -0
  54. package/dist/sessionContracts.test.d.ts.map +1 -0
  55. package/dist/sessionContracts.test.js +75 -0
  56. package/dist/sessionContracts.test.js.map +1 -0
  57. package/dist/sessionDigest.d.ts +149 -0
  58. package/dist/sessionDigest.d.ts.map +1 -0
  59. package/dist/sessionDigest.js +57 -0
  60. package/dist/sessionDigest.js.map +1 -0
  61. package/dist/sessionGrade.d.ts +184 -0
  62. package/dist/sessionGrade.d.ts.map +1 -0
  63. package/dist/sessionGrade.js +130 -0
  64. package/dist/sessionGrade.js.map +1 -0
  65. package/dist/types.d.ts +4 -27
  66. package/dist/types.d.ts.map +1 -1
  67. package/dist/types.js.map +1 -1
  68. package/dist/usageOnly.d.ts +5 -5
  69. package/dist/wirePrimitives.d.ts +173 -0
  70. package/dist/wirePrimitives.d.ts.map +1 -0
  71. package/dist/wirePrimitives.js +210 -0
  72. package/dist/wirePrimitives.js.map +1 -0
  73. package/package.json +1 -1
@@ -0,0 +1,1222 @@
1
+ import * as v from 'valibot';
2
+ /**
3
+ * The corpora a search can reach today.
4
+ *
5
+ * `guides` is guide bodies and their author-written eval criteria; `verdicts`
6
+ * is the grader's reasoning for why a session did or did not follow a guide;
7
+ * `content` is the name and body of the documents saved in bundles; `comments`
8
+ * is the text of comments left on guides and documents and, for a caller that
9
+ * reads them (`SearchRequest.sessionComments`), on its own sessions; `turns` is what the
10
+ * caller themself said to their agents, redacted; `sessions` is the grader's
11
+ * summary of the caller's own sessions and the agent's closing report. One
12
+ * registry on the server declares how each is matched and scoped; this list is
13
+ * only what a caller may name.
14
+ */
15
+ export declare const SEARCH_CORPUS_IDS: readonly ["guides", "verdicts", "content", "comments", "turns", "sessions"];
16
+ export declare const SearchCorpusIdSchema: v.PicklistSchema<readonly ["guides", "verdicts", "content", "comments", "turns", "sessions"], undefined>;
17
+ export type SearchCorpusId = v.InferOutput<typeof SearchCorpusIdSchema>;
18
+ /**
19
+ * Every stored text no search reaches yet — the actions and their narration.
20
+ * Every response names them, so "nothing found" can never be read as covering
21
+ * them. (Earlier wordings of a guide are deliberately never searched, which is a
22
+ * different thing from not yet.)
23
+ */
24
+ export declare const SEARCH_UNIMPLEMENTED_CORPORA: readonly ["actions"];
25
+ /**
26
+ * What a response still names as not searched for a caller that did not say it
27
+ * reads session comments (`SearchRequest.sessionComments`): they were left out
28
+ * of its `comments`, so saying otherwise would read a zero as covering them.
29
+ */
30
+ export declare const SEARCH_SESSION_COMMENTS_UNSEARCHED: "session-comments";
31
+ export declare const SearchUnimplementedCorpusSchema: v.PicklistSchema<readonly ["actions"], undefined>;
32
+ /** Hits returned per corpus when the caller does not say. */
33
+ export declare const SEARCH_DEFAULT_LIMIT = 10;
34
+ /** The most hits one corpus returns. Totals are counted past it. */
35
+ export declare const SEARCH_MAX_LIMIT = 25;
36
+ /**
37
+ * The term. Literal, case-insensitive, with `*` and `?` as the only wildcards —
38
+ * not a regex, which an unindexed shared database cannot afford.
39
+ *
40
+ * At least two characters after trimming, not counting wildcards: every row
41
+ * matches one character (or `**`), so a shorter term is a scan with no question
42
+ * behind it.
43
+ */
44
+ export declare const SearchTermSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 2, "q must be at least 2 characters">, v.MaxLengthAction<string, 200, "q must be at most 200 characters">, v.CheckAction<string, "q must not contain control characters">, v.CheckAction<string, "q must contain at least 2 characters besides * and ?">]>;
45
+ /**
46
+ * How much of each guide hit to return — progressive disclosure, so a search
47
+ * costs an agent little context until it asks for more.
48
+ *
49
+ * - `excerpt` (the default): a short window around the match, kept inside the
50
+ * match's Markdown section, plus the section's heading path. A short section
51
+ * comes back whole, and a longer one says how long it is (`sectionChars`).
52
+ * - `section`: the whole section that holds the match, capped. Meant for one
53
+ * hit at a time — pass the hit's `fileId` in `fileIds`.
54
+ */
55
+ export declare const SEARCH_DETAILS: readonly ["excerpt", "section"];
56
+ export declare const SearchDetailSchema: v.PicklistSchema<readonly ["excerpt", "section"], undefined>;
57
+ export type SearchDetail = v.InferOutput<typeof SearchDetailSchema>;
58
+ /** Frontmatter filters a `content` search accepts at once. */
59
+ export declare const SEARCH_MAX_FRONTMATTER_FILTERS = 3;
60
+ /**
61
+ * One top-level frontmatter field a `content` item must carry, by exact scalar
62
+ * value (`type: recipe`). The key is a plain YAML key so it can be matched
63
+ * without being interpreted; the value is literal text, compared
64
+ * case-insensitively.
65
+ */
66
+ export declare const SearchFrontmatterSchema: v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "frontmatter keys are plain names">]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a frontmatter value must not be empty">, v.MaxLengthAction<string, 100, "a frontmatter value must be at most 100 characters">, v.CheckAction<string, "a frontmatter value must not contain control characters">]>, undefined>, v.CheckAction<{
67
+ [x: string]: string;
68
+ }, "frontmatter takes between 1 and 3 fields">]>;
69
+ export type SearchFrontmatter = v.InferOutput<typeof SearchFrontmatterSchema>;
70
+ /** Who wrote a comment: a person, an agent, or Mossbear itself. */
71
+ export declare const SEARCH_COMMENT_AUTHOR_KINDS: ["person", "agent", "mossbear"];
72
+ export declare const SearchCommentAuthorKindSchema: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
73
+ export type SearchCommentAuthorKind = v.InferOutput<typeof SearchCommentAuthorKindSchema>;
74
+ /**
75
+ * What a comment is attached to. `artifact` is a guide or a document; `session`
76
+ * is a run the caller made. Session comments are the caller's own and never reach
77
+ * a workspace-mate.
78
+ */
79
+ /**
80
+ * The subject kinds a client names in a search: `artifact`, never its older
81
+ * name `item`.
82
+ */
83
+ export declare const SEARCH_COMMENT_SUBJECT_KIND_NAMES: readonly ["artifact", "session"];
84
+ export declare const SearchCommentSubjectKindFilterSchema: v.PicklistSchema<readonly ["artifact", "session"], undefined>;
85
+ export type SearchCommentSubjectKindFilter = v.InferOutput<typeof SearchCommentSubjectKindFilterSchema>;
86
+ export type SearchCommentSubjectKindName = (typeof SEARCH_COMMENT_SUBJECT_KIND_NAMES)[number];
87
+ /**
88
+ * What a user turn was, as the session classifier labels it. The same
89
+ * vocabulary the classifier writes; a `turns` search may keep only some.
90
+ */
91
+ export declare const SEARCH_STEERING_LABELS: readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"];
92
+ export declare const SearchSteeringLabelSchema: v.PicklistSchema<readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"], undefined>;
93
+ export type SearchSteeringLabel = v.InferOutput<typeof SearchSteeringLabelSchema>;
94
+ /**
95
+ * One exact value a `sessions` search filters on — a head sha, a branch name or
96
+ * a repo digest. Compared as written, so it is trimmed and bounded but never
97
+ * case-folded or treated as a pattern.
98
+ */
99
+ export declare const SearchSessionFilterValueSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>;
100
+ export declare const SearchRequestObjectSchema: v.ObjectSchema<{
101
+ /**
102
+ * The term. Optional only for a `sessions` search that names a filter (`headSha`,
103
+ * `branch` or `repoId`): "which session ended at this commit" has no words to match.
104
+ */
105
+ readonly q: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 2, "q must be at least 2 characters">, v.MaxLengthAction<string, 200, "q must be at most 200 characters">, v.CheckAction<string, "q must not contain control characters">, v.CheckAction<string, "q must contain at least 2 characters besides * and ?">]>, undefined>;
106
+ /** Which corpora to search; every one when absent. */
107
+ readonly corpora: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["guides", "verdicts", "content", "comments", "turns", "sessions"], undefined>, undefined>, v.MinLengthAction<("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[], 1, undefined>]>, undefined>;
108
+ /**
109
+ * The bundles a scoped caller may read content from — `mossbear mcp
110
+ * --bundles` resolved to ids by the CLI, since the server never sees that
111
+ * flag. **Present means narrowed**, even when empty: an allowlist that
112
+ * reaches no bundle narrows the content corpora to nothing, never to
113
+ * everything. Absent means the caller is not bundle-scoped.
114
+ */
115
+ readonly bundleIds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.MaxLengthAction<string[], 200, undefined>]>, undefined>;
116
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 25, undefined>]>, undefined>;
117
+ /** How much of each guide hit to return; `excerpt` when absent. */
118
+ readonly detail: v.OptionalSchema<v.PicklistSchema<readonly ["excerpt", "section"], undefined>, undefined>;
119
+ /**
120
+ * Restrict the guides corpus to these guide files — the `fileId`s of earlier
121
+ * hits, to expand them. Narrows within the caller's scope, never past it: an
122
+ * id the caller cannot read matches nothing. Does not touch other corpora.
123
+ */
124
+ readonly fileIds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.MinLengthAction<string[], 1, undefined>, v.MaxLengthAction<string[], 25, undefined>]>, undefined>;
125
+ /**
126
+ * Restrict the `content` corpus to items whose frontmatter carries every one
127
+ * of these fields. Does not touch other corpora.
128
+ */
129
+ readonly frontmatter: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "frontmatter keys are plain names">]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a frontmatter value must not be empty">, v.MaxLengthAction<string, 100, "a frontmatter value must be at most 100 characters">, v.CheckAction<string, "a frontmatter value must not contain control characters">]>, undefined>, v.CheckAction<{
130
+ [x: string]: string;
131
+ }, "frontmatter takes between 1 and 3 fields">]>, undefined>;
132
+ /**
133
+ * Restrict the `comments` corpus to comments written by these kinds of
134
+ * author. Does not touch other corpora.
135
+ */
136
+ readonly authorKinds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["person", "agent", "mossbear"], undefined>, undefined>, v.MinLengthAction<("person" | "agent" | "mossbear")[], 1, undefined>]>, undefined>;
137
+ /**
138
+ * Restrict the `comments` corpus to comments on these kinds of subject. Does
139
+ * not touch other corpora.
140
+ */
141
+ readonly subjectKinds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["artifact", "session"], undefined>, undefined>, v.MinLengthAction<("artifact" | "session")[], 1, undefined>]>, undefined>;
142
+ /**
143
+ * Restrict the `turns` corpus to turns the classifier gave one of these
144
+ * labels. A turn with no label never matches. Does not touch other corpora.
145
+ */
146
+ readonly steeringLabels: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"], undefined>, undefined>, v.MinLengthAction<("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[], 1, undefined>]>, undefined>;
147
+ /**
148
+ * Restrict the `sessions` corpus to sessions whose recorded head was exactly
149
+ * this commit when they closed. A commit made mid-session matches nothing:
150
+ * the head is the one observed at close. Does not touch other corpora.
151
+ */
152
+ readonly headSha: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>, undefined>;
153
+ /** Restrict the `sessions` corpus to sessions that closed on exactly this branch. Does not touch other corpora. */
154
+ readonly branch: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>, undefined>;
155
+ /** Restrict the `sessions` corpus to sessions recorded under exactly this repo id. Does not touch other corpora. */
156
+ readonly repoId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>, undefined>;
157
+ /**
158
+ * Whether the caller can read a `comments` hit on a session. A client from
159
+ * before session comments were searchable validates the whole response
160
+ * strictly and would reject one, so the server returns them only to a caller
161
+ * that says it can, and tells every other caller they were not searched.
162
+ * Absent means it cannot.
163
+ */
164
+ readonly sessionComments: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
165
+ }, undefined>;
166
+ /**
167
+ * A request with no term searches the caller's sessions by filter alone, so it
168
+ * must name one, and must not name another corpus (which has nothing to match).
169
+ */
170
+ export declare const SearchRequestSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
171
+ /**
172
+ * The term. Optional only for a `sessions` search that names a filter (`headSha`,
173
+ * `branch` or `repoId`): "which session ended at this commit" has no words to match.
174
+ */
175
+ readonly q: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 2, "q must be at least 2 characters">, v.MaxLengthAction<string, 200, "q must be at most 200 characters">, v.CheckAction<string, "q must not contain control characters">, v.CheckAction<string, "q must contain at least 2 characters besides * and ?">]>, undefined>;
176
+ /** Which corpora to search; every one when absent. */
177
+ readonly corpora: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["guides", "verdicts", "content", "comments", "turns", "sessions"], undefined>, undefined>, v.MinLengthAction<("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[], 1, undefined>]>, undefined>;
178
+ /**
179
+ * The bundles a scoped caller may read content from — `mossbear mcp
180
+ * --bundles` resolved to ids by the CLI, since the server never sees that
181
+ * flag. **Present means narrowed**, even when empty: an allowlist that
182
+ * reaches no bundle narrows the content corpora to nothing, never to
183
+ * everything. Absent means the caller is not bundle-scoped.
184
+ */
185
+ readonly bundleIds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.MaxLengthAction<string[], 200, undefined>]>, undefined>;
186
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 25, undefined>]>, undefined>;
187
+ /** How much of each guide hit to return; `excerpt` when absent. */
188
+ readonly detail: v.OptionalSchema<v.PicklistSchema<readonly ["excerpt", "section"], undefined>, undefined>;
189
+ /**
190
+ * Restrict the guides corpus to these guide files — the `fileId`s of earlier
191
+ * hits, to expand them. Narrows within the caller's scope, never past it: an
192
+ * id the caller cannot read matches nothing. Does not touch other corpora.
193
+ */
194
+ readonly fileIds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>, v.MinLengthAction<string[], 1, undefined>, v.MaxLengthAction<string[], 25, undefined>]>, undefined>;
195
+ /**
196
+ * Restrict the `content` corpus to items whose frontmatter carries every one
197
+ * of these fields. Does not touch other corpora.
198
+ */
199
+ readonly frontmatter: v.OptionalSchema<v.SchemaWithPipe<readonly [v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "frontmatter keys are plain names">]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a frontmatter value must not be empty">, v.MaxLengthAction<string, 100, "a frontmatter value must be at most 100 characters">, v.CheckAction<string, "a frontmatter value must not contain control characters">]>, undefined>, v.CheckAction<{
200
+ [x: string]: string;
201
+ }, "frontmatter takes between 1 and 3 fields">]>, undefined>;
202
+ /**
203
+ * Restrict the `comments` corpus to comments written by these kinds of
204
+ * author. Does not touch other corpora.
205
+ */
206
+ readonly authorKinds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["person", "agent", "mossbear"], undefined>, undefined>, v.MinLengthAction<("person" | "agent" | "mossbear")[], 1, undefined>]>, undefined>;
207
+ /**
208
+ * Restrict the `comments` corpus to comments on these kinds of subject. Does
209
+ * not touch other corpora.
210
+ */
211
+ readonly subjectKinds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["artifact", "session"], undefined>, undefined>, v.MinLengthAction<("artifact" | "session")[], 1, undefined>]>, undefined>;
212
+ /**
213
+ * Restrict the `turns` corpus to turns the classifier gave one of these
214
+ * labels. A turn with no label never matches. Does not touch other corpora.
215
+ */
216
+ readonly steeringLabels: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"], undefined>, undefined>, v.MinLengthAction<("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[], 1, undefined>]>, undefined>;
217
+ /**
218
+ * Restrict the `sessions` corpus to sessions whose recorded head was exactly
219
+ * this commit when they closed. A commit made mid-session matches nothing:
220
+ * the head is the one observed at close. Does not touch other corpora.
221
+ */
222
+ readonly headSha: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>, undefined>;
223
+ /** Restrict the `sessions` corpus to sessions that closed on exactly this branch. Does not touch other corpora. */
224
+ readonly branch: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>, undefined>;
225
+ /** Restrict the `sessions` corpus to sessions recorded under exactly this repo id. Does not touch other corpora. */
226
+ readonly repoId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, "a session filter must not be empty">, v.MaxLengthAction<string, 200, "a session filter must be at most 200 characters">, v.CheckAction<string, "a session filter must not contain control characters">]>, undefined>;
227
+ /**
228
+ * Whether the caller can read a `comments` hit on a session. A client from
229
+ * before session comments were searchable validates the whole response
230
+ * strictly and would reject one, so the server returns them only to a caller
231
+ * that says it can, and tells every other caller they were not searched.
232
+ * Absent means it cannot.
233
+ */
234
+ readonly sessionComments: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
235
+ }, undefined>, v.BaseValidation<{
236
+ q?: string | undefined;
237
+ corpora?: ("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[] | undefined;
238
+ bundleIds?: string[] | undefined;
239
+ limit?: number | undefined;
240
+ detail?: "excerpt" | "section" | undefined;
241
+ fileIds?: string[] | undefined;
242
+ frontmatter?: {
243
+ [x: string]: string;
244
+ } | undefined;
245
+ authorKinds?: ("person" | "agent" | "mossbear")[] | undefined;
246
+ subjectKinds?: ("artifact" | "session")[] | undefined;
247
+ steeringLabels?: ("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[] | undefined;
248
+ headSha?: string | undefined;
249
+ branch?: string | undefined;
250
+ repoId?: string | undefined;
251
+ sessionComments?: boolean | undefined;
252
+ }, {
253
+ q?: string | undefined;
254
+ corpora?: ("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[] | undefined;
255
+ bundleIds?: string[] | undefined;
256
+ limit?: number | undefined;
257
+ detail?: "excerpt" | "section" | undefined;
258
+ fileIds?: string[] | undefined;
259
+ frontmatter?: {
260
+ [x: string]: string;
261
+ } | undefined;
262
+ authorKinds?: ("person" | "agent" | "mossbear")[] | undefined;
263
+ subjectKinds?: ("artifact" | "session")[] | undefined;
264
+ steeringLabels?: ("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[] | undefined;
265
+ headSha?: string | undefined;
266
+ branch?: string | undefined;
267
+ repoId?: string | undefined;
268
+ sessionComments?: boolean | undefined;
269
+ }, v.CheckIssue<{
270
+ q?: string | undefined;
271
+ corpora?: ("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[] | undefined;
272
+ bundleIds?: string[] | undefined;
273
+ limit?: number | undefined;
274
+ detail?: "excerpt" | "section" | undefined;
275
+ fileIds?: string[] | undefined;
276
+ frontmatter?: {
277
+ [x: string]: string;
278
+ } | undefined;
279
+ authorKinds?: ("person" | "agent" | "mossbear")[] | undefined;
280
+ subjectKinds?: ("artifact" | "session")[] | undefined;
281
+ steeringLabels?: ("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[] | undefined;
282
+ headSha?: string | undefined;
283
+ branch?: string | undefined;
284
+ repoId?: string | undefined;
285
+ sessionComments?: boolean | undefined;
286
+ }>>, v.BaseValidation<{
287
+ q?: string | undefined;
288
+ corpora?: ("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[] | undefined;
289
+ bundleIds?: string[] | undefined;
290
+ limit?: number | undefined;
291
+ detail?: "excerpt" | "section" | undefined;
292
+ fileIds?: string[] | undefined;
293
+ frontmatter?: {
294
+ [x: string]: string;
295
+ } | undefined;
296
+ authorKinds?: ("person" | "agent" | "mossbear")[] | undefined;
297
+ subjectKinds?: ("artifact" | "session")[] | undefined;
298
+ steeringLabels?: ("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[] | undefined;
299
+ headSha?: string | undefined;
300
+ branch?: string | undefined;
301
+ repoId?: string | undefined;
302
+ sessionComments?: boolean | undefined;
303
+ }, {
304
+ q?: string | undefined;
305
+ corpora?: ("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[] | undefined;
306
+ bundleIds?: string[] | undefined;
307
+ limit?: number | undefined;
308
+ detail?: "excerpt" | "section" | undefined;
309
+ fileIds?: string[] | undefined;
310
+ frontmatter?: {
311
+ [x: string]: string;
312
+ } | undefined;
313
+ authorKinds?: ("person" | "agent" | "mossbear")[] | undefined;
314
+ subjectKinds?: ("artifact" | "session")[] | undefined;
315
+ steeringLabels?: ("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[] | undefined;
316
+ headSha?: string | undefined;
317
+ branch?: string | undefined;
318
+ repoId?: string | undefined;
319
+ sessionComments?: boolean | undefined;
320
+ }, v.CheckIssue<{
321
+ q?: string | undefined;
322
+ corpora?: ("comments" | "sessions" | "content" | "guides" | "verdicts" | "turns")[] | undefined;
323
+ bundleIds?: string[] | undefined;
324
+ limit?: number | undefined;
325
+ detail?: "excerpt" | "section" | undefined;
326
+ fileIds?: string[] | undefined;
327
+ frontmatter?: {
328
+ [x: string]: string;
329
+ } | undefined;
330
+ authorKinds?: ("person" | "agent" | "mossbear")[] | undefined;
331
+ subjectKinds?: ("artifact" | "session")[] | undefined;
332
+ steeringLabels?: ("correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence")[] | undefined;
333
+ headSha?: string | undefined;
334
+ branch?: string | undefined;
335
+ repoId?: string | undefined;
336
+ sessionComments?: boolean | undefined;
337
+ }>>]>;
338
+ export type SearchRequest = v.InferOutput<typeof SearchRequestSchema>;
339
+ /** The exact-match filters a `sessions` search accepts, as the server hands them to the corpus. */
340
+ export type SearchSessionFilters = Pick<SearchRequest, 'headSha' | 'branch' | 'repoId'>;
341
+ /**
342
+ * Why a corpus was not searched. Codes, never prose: each caller writes its own
343
+ * sentence, and the dashboard's has to be a translatable one.
344
+ */
345
+ export declare const SearchSkipReasonSchema: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
346
+ export type SearchSkipReason = v.InferOutput<typeof SearchSkipReasonSchema>;
347
+ /** Why a searched corpus covered less than the caller's whole scope. */
348
+ export declare const SearchNarrowingSchema: v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>;
349
+ /** A guide file whose text matched. The excerpt is wrapped in `untrusted`'s markers. */
350
+ export declare const SearchGuideHitSchema: v.ObjectSchema<{
351
+ readonly guideId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
352
+ /** Wrapped in `untrusted`'s markers; null when nothing names the guide. */
353
+ readonly guideTitle: v.NullableSchema<v.StringSchema<undefined>, undefined>;
354
+ readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
355
+ readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
356
+ /** The guide's own body, or its author-written eval criteria. */
357
+ readonly part: v.PicklistSchema<["body", "criteria"], undefined>;
358
+ /**
359
+ * The heading path of the Markdown section that holds the match, joined with
360
+ * `SECTION_PATH_SEPARATOR` and wrapped in `untrusted`'s markers — a heading is
361
+ * file text. Null when the match sits above the first heading. Optional
362
+ * because a server that predates sections does not send it.
363
+ */
364
+ readonly section: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
365
+ /**
366
+ * The whole section's length in characters, present only when `excerpt` is
367
+ * less than all of it — what expanding the hit would add. Null when the
368
+ * excerpt is the whole section. Optional for the same reason as `section`.
369
+ */
370
+ readonly sectionChars: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
371
+ /**
372
+ * Around the match, cut with `…`, never past its section. By default a short
373
+ * window, or the whole section when that is short too; for `detail:
374
+ * 'section'`, the whole section, capped.
375
+ */
376
+ readonly excerpt: v.StringSchema<undefined>;
377
+ }, undefined>;
378
+ export type SearchGuideHit = v.InferOutput<typeof SearchGuideHitSchema>;
379
+ /** One session's verdict on one guide whose reasoning matched, wrapped in markers. */
380
+ export declare const SearchVerdictHitSchema: v.ObjectSchema<{
381
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
382
+ readonly guideId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
383
+ /**
384
+ * Wrapped in `untrusted`'s markers. Null when the guide is no longer one the
385
+ * caller can read, or nothing names it.
386
+ */
387
+ readonly guideTitle: v.NullableSchema<v.StringSchema<undefined>, undefined>;
388
+ readonly verdict: v.PicklistSchema<readonly ["aligned", "misaligned", "not_applicable"], undefined>;
389
+ readonly occurredAt: v.StringSchema<undefined>;
390
+ readonly reasoning: v.StringSchema<undefined>;
391
+ }, undefined>;
392
+ export type SearchVerdictHit = v.InferOutput<typeof SearchVerdictHitSchema>;
393
+ /**
394
+ * A saved document whose name or body matched — an artifact `read_artifact`
395
+ * reads by its `itemId`. The name, workspace name and excerpt are wrapped in
396
+ * `untrusted`'s markers.
397
+ */
398
+ export declare const SearchContentHitSchema: v.ObjectSchema<{
399
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
400
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
401
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
402
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
403
+ /** Wrapped in `untrusted`'s markers. */
404
+ readonly workspaceName: v.StringSchema<undefined>;
405
+ /**
406
+ * Slugs of the bundles that hold the item and that the caller may read — the
407
+ * `bundle` argument `pull_artifacts` takes to read the bundle. Never more than
408
+ * a scoped caller's allowlist reaches.
409
+ */
410
+ readonly bundles: v.ArraySchema<v.StringSchema<undefined>, undefined>;
411
+ readonly updatedAt: v.StringSchema<undefined>;
412
+ /**
413
+ * Where the item opens on the dashboard. Added by the CLI, which knows the
414
+ * dashboard's address; the server does not send it.
415
+ */
416
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
417
+ /** A window around the match, wrapped in `untrusted`'s markers. */
418
+ readonly excerpt: v.StringSchema<undefined>;
419
+ }, undefined>;
420
+ export type SearchContentHit = v.InferOutput<typeof SearchContentHitSchema>;
421
+ /**
422
+ * A comment on a guide or document that matched. `body` and `itemName` and
423
+ * `workspaceName` are wrapped in `untrusted`'s markers.
424
+ */
425
+ export declare const SearchArtifactCommentHitSchema: v.ObjectSchema<{
426
+ readonly subjectKind: v.LiteralSchema<"artifact", undefined>;
427
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
428
+ /**
429
+ * The guide the item belongs to, or null for a standalone document. A comment
430
+ * on a guide sits on its body file, so this is the id the dashboard's guide
431
+ * page takes; `itemId` is the one a document page takes.
432
+ */
433
+ readonly guideId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
434
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
435
+ readonly itemName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
436
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
437
+ /** Wrapped in `untrusted`'s markers. */
438
+ readonly workspaceName: v.StringSchema<undefined>;
439
+ /** Whether the item has been edited since the comment was written. */
440
+ readonly itemChangedSince: v.BooleanSchema<undefined>;
441
+ /**
442
+ * Where the match is. A current server always says `body`; `suggestion` is
443
+ * what an older one said for a match in a comment's suggested edit, accepted
444
+ * so a CLI talking to one mid-rollout still parses the report. Nothing reads
445
+ * the difference.
446
+ */
447
+ readonly matchedIn: v.PicklistSchema<["body", "suggestion"], undefined>;
448
+ /**
449
+ * Whether a Mossbear finding's owner handed it to their agents. Nothing hands
450
+ * one over any more, so a current server sends `false`. It does not say
451
+ * whether an agent may act on it: every open finding is ready unless
452
+ * dismissed. Absent on a person's or an agent's comment and on a reply.
453
+ */
454
+ readonly approved: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
455
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
456
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
457
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
458
+ readonly resolved: v.BooleanSchema<undefined>;
459
+ readonly createdAt: v.StringSchema<undefined>;
460
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
461
+ readonly excerpt: v.StringSchema<undefined>;
462
+ }, undefined>;
463
+ /**
464
+ * A comment on one of the caller's own sessions that matched. It has no
465
+ * workspace and no item: `sessionId` is the id the dashboard's session page
466
+ * takes. The excerpt is wrapped in `untrusted`'s markers.
467
+ */
468
+ export declare const SearchSessionCommentHitSchema: v.ObjectSchema<{
469
+ readonly subjectKind: v.LiteralSchema<"session", undefined>;
470
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
471
+ readonly matchedIn: v.LiteralSchema<"body", undefined>;
472
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
473
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
474
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
475
+ readonly resolved: v.BooleanSchema<undefined>;
476
+ readonly createdAt: v.StringSchema<undefined>;
477
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
478
+ readonly excerpt: v.StringSchema<undefined>;
479
+ }, undefined>;
480
+ export declare const SearchCommentHitSchema: v.VariantSchema<"subjectKind", [v.ObjectSchema<{
481
+ readonly subjectKind: v.LiteralSchema<"artifact", undefined>;
482
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
483
+ /**
484
+ * The guide the item belongs to, or null for a standalone document. A comment
485
+ * on a guide sits on its body file, so this is the id the dashboard's guide
486
+ * page takes; `itemId` is the one a document page takes.
487
+ */
488
+ readonly guideId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
489
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
490
+ readonly itemName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
491
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
492
+ /** Wrapped in `untrusted`'s markers. */
493
+ readonly workspaceName: v.StringSchema<undefined>;
494
+ /** Whether the item has been edited since the comment was written. */
495
+ readonly itemChangedSince: v.BooleanSchema<undefined>;
496
+ /**
497
+ * Where the match is. A current server always says `body`; `suggestion` is
498
+ * what an older one said for a match in a comment's suggested edit, accepted
499
+ * so a CLI talking to one mid-rollout still parses the report. Nothing reads
500
+ * the difference.
501
+ */
502
+ readonly matchedIn: v.PicklistSchema<["body", "suggestion"], undefined>;
503
+ /**
504
+ * Whether a Mossbear finding's owner handed it to their agents. Nothing hands
505
+ * one over any more, so a current server sends `false`. It does not say
506
+ * whether an agent may act on it: every open finding is ready unless
507
+ * dismissed. Absent on a person's or an agent's comment and on a reply.
508
+ */
509
+ readonly approved: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
510
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
511
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
512
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
513
+ readonly resolved: v.BooleanSchema<undefined>;
514
+ readonly createdAt: v.StringSchema<undefined>;
515
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
516
+ readonly excerpt: v.StringSchema<undefined>;
517
+ }, undefined>, v.ObjectSchema<{
518
+ readonly subjectKind: v.LiteralSchema<"session", undefined>;
519
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
520
+ readonly matchedIn: v.LiteralSchema<"body", undefined>;
521
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
522
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
523
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
524
+ readonly resolved: v.BooleanSchema<undefined>;
525
+ readonly createdAt: v.StringSchema<undefined>;
526
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
527
+ readonly excerpt: v.StringSchema<undefined>;
528
+ }, undefined>], undefined>;
529
+ export type SearchArtifactCommentHit = v.InferOutput<typeof SearchArtifactCommentHitSchema>;
530
+ export type SearchSessionCommentHit = v.InferOutput<typeof SearchSessionCommentHitSchema>;
531
+ export type SearchCommentHit = v.InferOutput<typeof SearchCommentHitSchema>;
532
+ /**
533
+ * One thing the caller said to an agent, redacted at the source. `excerpt` and
534
+ * `projectId` and `branch` are wrapped in `untrusted`'s markers: a turn is text a
535
+ * person typed (or pasted) and a branch name is whatever git was told.
536
+ */
537
+ export declare const SearchTurnHitSchema: v.ObjectSchema<{
538
+ /** The agent's own session id — the key a session digest takes. */
539
+ readonly agentSessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
540
+ /**
541
+ * The dashboard's id for the session, which its session page takes. Null when
542
+ * the session has not been recorded as a run yet.
543
+ */
544
+ readonly sessionId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
545
+ /** Which turn of the session this was, counting from 1. */
546
+ readonly ordinal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
547
+ /** Null when the classifier has not labelled the turn. */
548
+ readonly steeringLabel: v.NullableSchema<v.PicklistSchema<readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"], undefined>, undefined>;
549
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
550
+ readonly projectId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
551
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
552
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
553
+ readonly createdAt: v.StringSchema<undefined>;
554
+ /**
555
+ * Where the session opens on the dashboard. Added by the CLI, which knows the
556
+ * dashboard's address; the server does not send it.
557
+ */
558
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
559
+ /** A window around the match, wrapped in `untrusted`'s markers. */
560
+ readonly excerpt: v.StringSchema<undefined>;
561
+ }, undefined>;
562
+ export type SearchTurnHit = v.InferOutput<typeof SearchTurnHitSchema>;
563
+ /** Which of a session's stored texts a `sessions` hit matched. */
564
+ export declare const SEARCH_SESSION_MATCH_FIELDS: readonly ["grade", "self_report"];
565
+ export declare const SearchSessionMatchFieldSchema: v.PicklistSchema<readonly ["grade", "self_report"], undefined>;
566
+ export type SearchSessionMatchField = v.InferOutput<typeof SearchSessionMatchFieldSchema>;
567
+ /**
568
+ * One of the caller's own sessions, found by what the grader said about it or
569
+ * what the agent reported at the end. `repoId`, `projectId`, `branch`,
570
+ * `headSha` and `excerpt` are wrapped in `untrusted`'s markers: the first four
571
+ * are whatever a checkout reported, and the excerpt is model-authored or
572
+ * written by an agent.
573
+ */
574
+ export declare const SearchSessionHitSchema: v.ObjectSchema<{
575
+ /** The agent's own session id — the key a session digest takes. */
576
+ readonly agentSessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
577
+ /** The dashboard's id for the session, which its session page takes. */
578
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
579
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
580
+ readonly repoId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
581
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
582
+ readonly projectId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
583
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
584
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
585
+ /**
586
+ * The head observed when the session closed, wrapped in `untrusted`'s
587
+ * markers; null where none was observed. A commit made mid-session is not it.
588
+ */
589
+ readonly headSha: v.NullableSchema<v.StringSchema<undefined>, undefined>;
590
+ readonly startedAt: v.StringSchema<undefined>;
591
+ /** Null when the search named no term, only filters. */
592
+ readonly matchedIn: v.NullableSchema<v.PicklistSchema<readonly ["grade", "self_report"], undefined>, undefined>;
593
+ /**
594
+ * Where the session opens on the dashboard. Added by the CLI, which knows the
595
+ * dashboard's address; the server does not send it.
596
+ */
597
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
598
+ /** A window around the match, wrapped in `untrusted`'s markers; null when the search named no term. */
599
+ readonly excerpt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
600
+ }, undefined>;
601
+ export type SearchSessionHit = v.InferOutput<typeof SearchSessionHitSchema>;
602
+ export declare const SearchGuidesReportSchema: v.VariantSchema<"status", [v.ObjectSchema<{
603
+ readonly status: v.LiteralSchema<"searched", undefined>;
604
+ /** Every match in scope, counted past the returned page. */
605
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
606
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
607
+ /** Newest first, at most the request's limit. */
608
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
609
+ readonly guideId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
610
+ /** Wrapped in `untrusted`'s markers; null when nothing names the guide. */
611
+ readonly guideTitle: v.NullableSchema<v.StringSchema<undefined>, undefined>;
612
+ readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
613
+ readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
614
+ /** The guide's own body, or its author-written eval criteria. */
615
+ readonly part: v.PicklistSchema<["body", "criteria"], undefined>;
616
+ /**
617
+ * The heading path of the Markdown section that holds the match, joined with
618
+ * `SECTION_PATH_SEPARATOR` and wrapped in `untrusted`'s markers — a heading is
619
+ * file text. Null when the match sits above the first heading. Optional
620
+ * because a server that predates sections does not send it.
621
+ */
622
+ readonly section: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
623
+ /**
624
+ * The whole section's length in characters, present only when `excerpt` is
625
+ * less than all of it — what expanding the hit would add. Null when the
626
+ * excerpt is the whole section. Optional for the same reason as `section`.
627
+ */
628
+ readonly sectionChars: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
629
+ /**
630
+ * Around the match, cut with `…`, never past its section. By default a short
631
+ * window, or the whole section when that is short too; for `detail:
632
+ * 'section'`, the whole section, capped.
633
+ */
634
+ readonly excerpt: v.StringSchema<undefined>;
635
+ }, undefined>, undefined>;
636
+ }, undefined>, v.ObjectSchema<{
637
+ readonly status: v.LiteralSchema<"skipped", undefined>;
638
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
639
+ }, undefined>], undefined>;
640
+ export declare const SearchVerdictsReportSchema: v.VariantSchema<"status", [v.ObjectSchema<{
641
+ readonly status: v.LiteralSchema<"searched", undefined>;
642
+ /** Every match in scope, counted past the returned page. */
643
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
644
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
645
+ /** Newest first, at most the request's limit. */
646
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
647
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
648
+ readonly guideId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
649
+ /**
650
+ * Wrapped in `untrusted`'s markers. Null when the guide is no longer one the
651
+ * caller can read, or nothing names it.
652
+ */
653
+ readonly guideTitle: v.NullableSchema<v.StringSchema<undefined>, undefined>;
654
+ readonly verdict: v.PicklistSchema<readonly ["aligned", "misaligned", "not_applicable"], undefined>;
655
+ readonly occurredAt: v.StringSchema<undefined>;
656
+ readonly reasoning: v.StringSchema<undefined>;
657
+ }, undefined>, undefined>;
658
+ }, undefined>, v.ObjectSchema<{
659
+ readonly status: v.LiteralSchema<"skipped", undefined>;
660
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
661
+ }, undefined>], undefined>;
662
+ export declare const SearchContentReportSchema: v.VariantSchema<"status", [v.ObjectSchema<{
663
+ readonly status: v.LiteralSchema<"searched", undefined>;
664
+ /** Every match in scope, counted past the returned page. */
665
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
666
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
667
+ /** Newest first, at most the request's limit. */
668
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
669
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
670
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
671
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
672
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
673
+ /** Wrapped in `untrusted`'s markers. */
674
+ readonly workspaceName: v.StringSchema<undefined>;
675
+ /**
676
+ * Slugs of the bundles that hold the item and that the caller may read — the
677
+ * `bundle` argument `pull_artifacts` takes to read the bundle. Never more than
678
+ * a scoped caller's allowlist reaches.
679
+ */
680
+ readonly bundles: v.ArraySchema<v.StringSchema<undefined>, undefined>;
681
+ readonly updatedAt: v.StringSchema<undefined>;
682
+ /**
683
+ * Where the item opens on the dashboard. Added by the CLI, which knows the
684
+ * dashboard's address; the server does not send it.
685
+ */
686
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
687
+ /** A window around the match, wrapped in `untrusted`'s markers. */
688
+ readonly excerpt: v.StringSchema<undefined>;
689
+ }, undefined>, undefined>;
690
+ }, undefined>, v.ObjectSchema<{
691
+ readonly status: v.LiteralSchema<"skipped", undefined>;
692
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
693
+ }, undefined>], undefined>;
694
+ export declare const SearchCommentsReportSchema: v.VariantSchema<"status", [v.ObjectSchema<{
695
+ readonly status: v.LiteralSchema<"searched", undefined>;
696
+ /** Every match in scope, counted past the returned page. */
697
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
698
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
699
+ /** Newest first, at most the request's limit. */
700
+ readonly hits: v.ArraySchema<v.VariantSchema<"subjectKind", [v.ObjectSchema<{
701
+ readonly subjectKind: v.LiteralSchema<"artifact", undefined>;
702
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
703
+ /**
704
+ * The guide the item belongs to, or null for a standalone document. A comment
705
+ * on a guide sits on its body file, so this is the id the dashboard's guide
706
+ * page takes; `itemId` is the one a document page takes.
707
+ */
708
+ readonly guideId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
709
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
710
+ readonly itemName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
711
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
712
+ /** Wrapped in `untrusted`'s markers. */
713
+ readonly workspaceName: v.StringSchema<undefined>;
714
+ /** Whether the item has been edited since the comment was written. */
715
+ readonly itemChangedSince: v.BooleanSchema<undefined>;
716
+ /**
717
+ * Where the match is. A current server always says `body`; `suggestion` is
718
+ * what an older one said for a match in a comment's suggested edit, accepted
719
+ * so a CLI talking to one mid-rollout still parses the report. Nothing reads
720
+ * the difference.
721
+ */
722
+ readonly matchedIn: v.PicklistSchema<["body", "suggestion"], undefined>;
723
+ /**
724
+ * Whether a Mossbear finding's owner handed it to their agents. Nothing hands
725
+ * one over any more, so a current server sends `false`. It does not say
726
+ * whether an agent may act on it: every open finding is ready unless
727
+ * dismissed. Absent on a person's or an agent's comment and on a reply.
728
+ */
729
+ readonly approved: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
730
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
731
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
732
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
733
+ readonly resolved: v.BooleanSchema<undefined>;
734
+ readonly createdAt: v.StringSchema<undefined>;
735
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
736
+ readonly excerpt: v.StringSchema<undefined>;
737
+ }, undefined>, v.ObjectSchema<{
738
+ readonly subjectKind: v.LiteralSchema<"session", undefined>;
739
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
740
+ readonly matchedIn: v.LiteralSchema<"body", undefined>;
741
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
742
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
743
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
744
+ readonly resolved: v.BooleanSchema<undefined>;
745
+ readonly createdAt: v.StringSchema<undefined>;
746
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
747
+ readonly excerpt: v.StringSchema<undefined>;
748
+ }, undefined>], undefined>, undefined>;
749
+ }, undefined>, v.ObjectSchema<{
750
+ readonly status: v.LiteralSchema<"skipped", undefined>;
751
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
752
+ }, undefined>], undefined>;
753
+ export declare const SearchTurnsReportSchema: v.VariantSchema<"status", [v.ObjectSchema<{
754
+ readonly status: v.LiteralSchema<"searched", undefined>;
755
+ /** Every match in scope, counted past the returned page. */
756
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
757
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
758
+ /** Newest first, at most the request's limit. */
759
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
760
+ /** The agent's own session id — the key a session digest takes. */
761
+ readonly agentSessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
762
+ /**
763
+ * The dashboard's id for the session, which its session page takes. Null when
764
+ * the session has not been recorded as a run yet.
765
+ */
766
+ readonly sessionId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
767
+ /** Which turn of the session this was, counting from 1. */
768
+ readonly ordinal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
769
+ /** Null when the classifier has not labelled the turn. */
770
+ readonly steeringLabel: v.NullableSchema<v.PicklistSchema<readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"], undefined>, undefined>;
771
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
772
+ readonly projectId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
773
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
774
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
775
+ readonly createdAt: v.StringSchema<undefined>;
776
+ /**
777
+ * Where the session opens on the dashboard. Added by the CLI, which knows the
778
+ * dashboard's address; the server does not send it.
779
+ */
780
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
781
+ /** A window around the match, wrapped in `untrusted`'s markers. */
782
+ readonly excerpt: v.StringSchema<undefined>;
783
+ }, undefined>, undefined>;
784
+ }, undefined>, v.ObjectSchema<{
785
+ readonly status: v.LiteralSchema<"skipped", undefined>;
786
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
787
+ }, undefined>], undefined>;
788
+ export declare const SearchSessionsReportSchema: v.VariantSchema<"status", [v.ObjectSchema<{
789
+ readonly status: v.LiteralSchema<"searched", undefined>;
790
+ /** Every match in scope, counted past the returned page. */
791
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
792
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
793
+ /** Newest first, at most the request's limit. */
794
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
795
+ /** The agent's own session id — the key a session digest takes. */
796
+ readonly agentSessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
797
+ /** The dashboard's id for the session, which its session page takes. */
798
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
799
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
800
+ readonly repoId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
801
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
802
+ readonly projectId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
803
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
804
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
805
+ /**
806
+ * The head observed when the session closed, wrapped in `untrusted`'s
807
+ * markers; null where none was observed. A commit made mid-session is not it.
808
+ */
809
+ readonly headSha: v.NullableSchema<v.StringSchema<undefined>, undefined>;
810
+ readonly startedAt: v.StringSchema<undefined>;
811
+ /** Null when the search named no term, only filters. */
812
+ readonly matchedIn: v.NullableSchema<v.PicklistSchema<readonly ["grade", "self_report"], undefined>, undefined>;
813
+ /**
814
+ * Where the session opens on the dashboard. Added by the CLI, which knows the
815
+ * dashboard's address; the server does not send it.
816
+ */
817
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
818
+ /** A window around the match, wrapped in `untrusted`'s markers; null when the search named no term. */
819
+ readonly excerpt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
820
+ }, undefined>, undefined>;
821
+ }, undefined>, v.ObjectSchema<{
822
+ readonly status: v.LiteralSchema<"skipped", undefined>;
823
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
824
+ }, undefined>], undefined>;
825
+ export type SearchGuidesReport = v.InferOutput<typeof SearchGuidesReportSchema>;
826
+ export type SearchVerdictsReport = v.InferOutput<typeof SearchVerdictsReportSchema>;
827
+ export type SearchContentReport = v.InferOutput<typeof SearchContentReportSchema>;
828
+ export type SearchCommentsReport = v.InferOutput<typeof SearchCommentsReportSchema>;
829
+ export type SearchTurnsReport = v.InferOutput<typeof SearchTurnsReportSchema>;
830
+ export type SearchSessionsReport = v.InferOutput<typeof SearchSessionsReportSchema>;
831
+ /**
832
+ * A search's answer: **a report per corpus, never a bare list.**
833
+ *
834
+ * Keyed by corpus so every corpus is always accounted for — searched with its
835
+ * total, or skipped with its reason — and `notYetSearchable` names the ones no
836
+ * search reaches. A caller reading zero hits therefore always knows what the
837
+ * zero covers, which is the difference between "nothing matched here" and "you
838
+ * never said this".
839
+ */
840
+ export declare const SearchResponseSchema: v.ObjectSchema<{
841
+ readonly corpora: v.ObjectSchema<{
842
+ readonly guides: v.VariantSchema<"status", [v.ObjectSchema<{
843
+ readonly status: v.LiteralSchema<"searched", undefined>;
844
+ /** Every match in scope, counted past the returned page. */
845
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
846
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
847
+ /** Newest first, at most the request's limit. */
848
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
849
+ readonly guideId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
850
+ /** Wrapped in `untrusted`'s markers; null when nothing names the guide. */
851
+ readonly guideTitle: v.NullableSchema<v.StringSchema<undefined>, undefined>;
852
+ readonly fileId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
853
+ readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
854
+ /** The guide's own body, or its author-written eval criteria. */
855
+ readonly part: v.PicklistSchema<["body", "criteria"], undefined>;
856
+ /**
857
+ * The heading path of the Markdown section that holds the match, joined with
858
+ * `SECTION_PATH_SEPARATOR` and wrapped in `untrusted`'s markers — a heading is
859
+ * file text. Null when the match sits above the first heading. Optional
860
+ * because a server that predates sections does not send it.
861
+ */
862
+ readonly section: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
863
+ /**
864
+ * The whole section's length in characters, present only when `excerpt` is
865
+ * less than all of it — what expanding the hit would add. Null when the
866
+ * excerpt is the whole section. Optional for the same reason as `section`.
867
+ */
868
+ readonly sectionChars: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
869
+ /**
870
+ * Around the match, cut with `…`, never past its section. By default a short
871
+ * window, or the whole section when that is short too; for `detail:
872
+ * 'section'`, the whole section, capped.
873
+ */
874
+ readonly excerpt: v.StringSchema<undefined>;
875
+ }, undefined>, undefined>;
876
+ }, undefined>, v.ObjectSchema<{
877
+ readonly status: v.LiteralSchema<"skipped", undefined>;
878
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
879
+ }, undefined>], undefined>;
880
+ readonly verdicts: v.VariantSchema<"status", [v.ObjectSchema<{
881
+ readonly status: v.LiteralSchema<"searched", undefined>;
882
+ /** Every match in scope, counted past the returned page. */
883
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
884
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
885
+ /** Newest first, at most the request's limit. */
886
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
887
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
888
+ readonly guideId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
889
+ /**
890
+ * Wrapped in `untrusted`'s markers. Null when the guide is no longer one the
891
+ * caller can read, or nothing names it.
892
+ */
893
+ readonly guideTitle: v.NullableSchema<v.StringSchema<undefined>, undefined>;
894
+ readonly verdict: v.PicklistSchema<readonly ["aligned", "misaligned", "not_applicable"], undefined>;
895
+ readonly occurredAt: v.StringSchema<undefined>;
896
+ readonly reasoning: v.StringSchema<undefined>;
897
+ }, undefined>, undefined>;
898
+ }, undefined>, v.ObjectSchema<{
899
+ readonly status: v.LiteralSchema<"skipped", undefined>;
900
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
901
+ }, undefined>], undefined>;
902
+ /**
903
+ * Optional because a server that predates the `content` corpus does not
904
+ * send it — and then did not search it, which a caller must say rather
905
+ * than read as zero hits.
906
+ */
907
+ readonly content: v.OptionalSchema<v.VariantSchema<"status", [v.ObjectSchema<{
908
+ readonly status: v.LiteralSchema<"searched", undefined>;
909
+ /** Every match in scope, counted past the returned page. */
910
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
911
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
912
+ /** Newest first, at most the request's limit. */
913
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
914
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
915
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
916
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
917
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
918
+ /** Wrapped in `untrusted`'s markers. */
919
+ readonly workspaceName: v.StringSchema<undefined>;
920
+ /**
921
+ * Slugs of the bundles that hold the item and that the caller may read — the
922
+ * `bundle` argument `pull_artifacts` takes to read the bundle. Never more than
923
+ * a scoped caller's allowlist reaches.
924
+ */
925
+ readonly bundles: v.ArraySchema<v.StringSchema<undefined>, undefined>;
926
+ readonly updatedAt: v.StringSchema<undefined>;
927
+ /**
928
+ * Where the item opens on the dashboard. Added by the CLI, which knows the
929
+ * dashboard's address; the server does not send it.
930
+ */
931
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
932
+ /** A window around the match, wrapped in `untrusted`'s markers. */
933
+ readonly excerpt: v.StringSchema<undefined>;
934
+ }, undefined>, undefined>;
935
+ }, undefined>, v.ObjectSchema<{
936
+ readonly status: v.LiteralSchema<"skipped", undefined>;
937
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
938
+ }, undefined>], undefined>, undefined>;
939
+ /** Optional for the same reason as `content`. Covers comments on guides and documents, and the caller's own comments on their sessions. */
940
+ readonly comments: v.OptionalSchema<v.VariantSchema<"status", [v.ObjectSchema<{
941
+ readonly status: v.LiteralSchema<"searched", undefined>;
942
+ /** Every match in scope, counted past the returned page. */
943
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
944
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
945
+ /** Newest first, at most the request's limit. */
946
+ readonly hits: v.ArraySchema<v.VariantSchema<"subjectKind", [v.ObjectSchema<{
947
+ readonly subjectKind: v.LiteralSchema<"artifact", undefined>;
948
+ readonly itemId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
949
+ /**
950
+ * The guide the item belongs to, or null for a standalone document. A comment
951
+ * on a guide sits on its body file, so this is the id the dashboard's guide
952
+ * page takes; `itemId` is the one a document page takes.
953
+ */
954
+ readonly guideId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
955
+ /** Wrapped in `untrusted`'s markers; null when the item has no name. */
956
+ readonly itemName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
957
+ readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
958
+ /** Wrapped in `untrusted`'s markers. */
959
+ readonly workspaceName: v.StringSchema<undefined>;
960
+ /** Whether the item has been edited since the comment was written. */
961
+ readonly itemChangedSince: v.BooleanSchema<undefined>;
962
+ /**
963
+ * Where the match is. A current server always says `body`; `suggestion` is
964
+ * what an older one said for a match in a comment's suggested edit, accepted
965
+ * so a CLI talking to one mid-rollout still parses the report. Nothing reads
966
+ * the difference.
967
+ */
968
+ readonly matchedIn: v.PicklistSchema<["body", "suggestion"], undefined>;
969
+ /**
970
+ * Whether a Mossbear finding's owner handed it to their agents. Nothing hands
971
+ * one over any more, so a current server sends `false`. It does not say
972
+ * whether an agent may act on it: every open finding is ready unless
973
+ * dismissed. Absent on a person's or an agent's comment and on a reply.
974
+ */
975
+ readonly approved: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
976
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
977
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
978
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
979
+ readonly resolved: v.BooleanSchema<undefined>;
980
+ readonly createdAt: v.StringSchema<undefined>;
981
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
982
+ readonly excerpt: v.StringSchema<undefined>;
983
+ }, undefined>, v.ObjectSchema<{
984
+ readonly subjectKind: v.LiteralSchema<"session", undefined>;
985
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
986
+ readonly matchedIn: v.LiteralSchema<"body", undefined>;
987
+ readonly commentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
988
+ readonly threadId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
989
+ readonly authorKind: v.PicklistSchema<["person", "agent", "mossbear"], undefined>;
990
+ readonly resolved: v.BooleanSchema<undefined>;
991
+ readonly createdAt: v.StringSchema<undefined>;
992
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
993
+ readonly excerpt: v.StringSchema<undefined>;
994
+ }, undefined>], undefined>, undefined>;
995
+ }, undefined>, v.ObjectSchema<{
996
+ readonly status: v.LiteralSchema<"skipped", undefined>;
997
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
998
+ }, undefined>], undefined>, undefined>;
999
+ /** Optional for the same reason as `content`. The caller's own turns, never a workspace-mate's. */
1000
+ readonly turns: v.OptionalSchema<v.VariantSchema<"status", [v.ObjectSchema<{
1001
+ readonly status: v.LiteralSchema<"searched", undefined>;
1002
+ /** Every match in scope, counted past the returned page. */
1003
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1004
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
1005
+ /** Newest first, at most the request's limit. */
1006
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
1007
+ /** The agent's own session id — the key a session digest takes. */
1008
+ readonly agentSessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1009
+ /**
1010
+ * The dashboard's id for the session, which its session page takes. Null when
1011
+ * the session has not been recorded as a run yet.
1012
+ */
1013
+ readonly sessionId: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>, undefined>;
1014
+ /** Which turn of the session this was, counting from 1. */
1015
+ readonly ordinal: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
1016
+ /** Null when the classifier has not labelled the turn. */
1017
+ readonly steeringLabel: v.NullableSchema<v.PicklistSchema<readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"], undefined>, undefined>;
1018
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
1019
+ readonly projectId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1020
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
1021
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1022
+ readonly createdAt: v.StringSchema<undefined>;
1023
+ /**
1024
+ * Where the session opens on the dashboard. Added by the CLI, which knows the
1025
+ * dashboard's address; the server does not send it.
1026
+ */
1027
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1028
+ /** A window around the match, wrapped in `untrusted`'s markers. */
1029
+ readonly excerpt: v.StringSchema<undefined>;
1030
+ }, undefined>, undefined>;
1031
+ }, undefined>, v.ObjectSchema<{
1032
+ readonly status: v.LiteralSchema<"skipped", undefined>;
1033
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
1034
+ }, undefined>], undefined>, undefined>;
1035
+ /** Optional for the same reason as `content`. The caller's own sessions, never a workspace-mate's. */
1036
+ readonly sessions: v.OptionalSchema<v.VariantSchema<"status", [v.ObjectSchema<{
1037
+ readonly status: v.LiteralSchema<"searched", undefined>;
1038
+ /** Every match in scope, counted past the returned page. */
1039
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
1040
+ readonly narrowedBy: v.NullableSchema<v.PicklistSchema<["narrowed-by-bundle-allowlist"], undefined>, undefined>;
1041
+ /** Newest first, at most the request's limit. */
1042
+ readonly hits: v.ArraySchema<v.ObjectSchema<{
1043
+ /** The agent's own session id — the key a session digest takes. */
1044
+ readonly agentSessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1045
+ /** The dashboard's id for the session, which its session page takes. */
1046
+ readonly sessionId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1047
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
1048
+ readonly repoId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1049
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
1050
+ readonly projectId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1051
+ /** Wrapped in `untrusted`'s markers; null where the session recorded none. */
1052
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1053
+ /**
1054
+ * The head observed when the session closed, wrapped in `untrusted`'s
1055
+ * markers; null where none was observed. A commit made mid-session is not it.
1056
+ */
1057
+ readonly headSha: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1058
+ readonly startedAt: v.StringSchema<undefined>;
1059
+ /** Null when the search named no term, only filters. */
1060
+ readonly matchedIn: v.NullableSchema<v.PicklistSchema<readonly ["grade", "self_report"], undefined>, undefined>;
1061
+ /**
1062
+ * Where the session opens on the dashboard. Added by the CLI, which knows the
1063
+ * dashboard's address; the server does not send it.
1064
+ */
1065
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1066
+ /** A window around the match, wrapped in `untrusted`'s markers; null when the search named no term. */
1067
+ readonly excerpt: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1068
+ }, undefined>, undefined>;
1069
+ }, undefined>, v.ObjectSchema<{
1070
+ readonly status: v.LiteralSchema<"skipped", undefined>;
1071
+ readonly reason: v.PicklistSchema<["excluded-by-caller", "timed-out", "not-granted", "not-yet-searchable"], undefined>;
1072
+ }, undefined>], undefined>, undefined>;
1073
+ }, undefined>;
1074
+ readonly notYetSearchable: v.ArraySchema<v.PicklistSchema<["actions", "comments", "session-comments", "turns", "sessions"], undefined>, undefined>;
1075
+ readonly untrusted: v.ObjectSchema<{
1076
+ readonly token: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1077
+ readonly startMarker: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1078
+ readonly endMarker: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
1079
+ readonly note: v.StringSchema<undefined>;
1080
+ }, undefined>;
1081
+ }, undefined>;
1082
+ export type SearchResponse = v.InferOutput<typeof SearchResponseSchema>;
1083
+ export declare function parseSearchResponse(data: unknown): {
1084
+ corpora: {
1085
+ guides: {
1086
+ status: "searched";
1087
+ total: number;
1088
+ narrowedBy: "narrowed-by-bundle-allowlist" | null;
1089
+ hits: {
1090
+ guideId: string;
1091
+ guideTitle: string | null;
1092
+ fileId: string;
1093
+ path: string | null;
1094
+ part: "body" | "criteria";
1095
+ section?: string | null | undefined;
1096
+ sectionChars?: number | null | undefined;
1097
+ excerpt: string;
1098
+ }[];
1099
+ } | {
1100
+ status: "skipped";
1101
+ reason: "excluded-by-caller" | "timed-out" | "not-granted" | "not-yet-searchable";
1102
+ };
1103
+ verdicts: {
1104
+ status: "searched";
1105
+ total: number;
1106
+ narrowedBy: "narrowed-by-bundle-allowlist" | null;
1107
+ hits: {
1108
+ sessionId: string;
1109
+ guideId: string;
1110
+ guideTitle: string | null;
1111
+ verdict: "aligned" | "misaligned" | "not_applicable";
1112
+ occurredAt: string;
1113
+ reasoning: string;
1114
+ }[];
1115
+ } | {
1116
+ status: "skipped";
1117
+ reason: "excluded-by-caller" | "timed-out" | "not-granted" | "not-yet-searchable";
1118
+ };
1119
+ content?: {
1120
+ status: "searched";
1121
+ total: number;
1122
+ narrowedBy: "narrowed-by-bundle-allowlist" | null;
1123
+ hits: {
1124
+ itemId: string;
1125
+ name: string | null;
1126
+ workspaceId: string;
1127
+ workspaceName: string;
1128
+ bundles: string[];
1129
+ updatedAt: string;
1130
+ url?: string | undefined;
1131
+ excerpt: string;
1132
+ }[];
1133
+ } | {
1134
+ status: "skipped";
1135
+ reason: "excluded-by-caller" | "timed-out" | "not-granted" | "not-yet-searchable";
1136
+ } | undefined;
1137
+ comments?: {
1138
+ status: "searched";
1139
+ total: number;
1140
+ narrowedBy: "narrowed-by-bundle-allowlist" | null;
1141
+ hits: ({
1142
+ subjectKind: "artifact";
1143
+ itemId: string;
1144
+ guideId: string | null;
1145
+ itemName: string | null;
1146
+ workspaceId: string;
1147
+ workspaceName: string;
1148
+ itemChangedSince: boolean;
1149
+ matchedIn: "body" | "suggestion";
1150
+ approved?: boolean | undefined;
1151
+ commentId: string;
1152
+ threadId: string;
1153
+ authorKind: "person" | "agent" | "mossbear";
1154
+ resolved: boolean;
1155
+ createdAt: string;
1156
+ url?: string | undefined;
1157
+ excerpt: string;
1158
+ } | {
1159
+ subjectKind: "session";
1160
+ sessionId: string;
1161
+ matchedIn: "body";
1162
+ commentId: string;
1163
+ threadId: string;
1164
+ authorKind: "person" | "agent" | "mossbear";
1165
+ resolved: boolean;
1166
+ createdAt: string;
1167
+ url?: string | undefined;
1168
+ excerpt: string;
1169
+ })[];
1170
+ } | {
1171
+ status: "skipped";
1172
+ reason: "excluded-by-caller" | "timed-out" | "not-granted" | "not-yet-searchable";
1173
+ } | undefined;
1174
+ turns?: {
1175
+ status: "searched";
1176
+ total: number;
1177
+ narrowedBy: "narrowed-by-bundle-allowlist" | null;
1178
+ hits: {
1179
+ agentSessionId: string;
1180
+ sessionId: string | null;
1181
+ ordinal: number;
1182
+ steeringLabel: "correction" | "steering" | "new request" | "acknowledgement" | "insufficient evidence" | null;
1183
+ projectId: string | null;
1184
+ branch: string | null;
1185
+ createdAt: string;
1186
+ url?: string | undefined;
1187
+ excerpt: string;
1188
+ }[];
1189
+ } | {
1190
+ status: "skipped";
1191
+ reason: "excluded-by-caller" | "timed-out" | "not-granted" | "not-yet-searchable";
1192
+ } | undefined;
1193
+ sessions?: {
1194
+ status: "searched";
1195
+ total: number;
1196
+ narrowedBy: "narrowed-by-bundle-allowlist" | null;
1197
+ hits: {
1198
+ agentSessionId: string;
1199
+ sessionId: string;
1200
+ repoId: string | null;
1201
+ projectId: string | null;
1202
+ branch: string | null;
1203
+ headSha: string | null;
1204
+ startedAt: string;
1205
+ matchedIn: "grade" | "self_report" | null;
1206
+ url?: string | undefined;
1207
+ excerpt: string | null;
1208
+ }[];
1209
+ } | {
1210
+ status: "skipped";
1211
+ reason: "excluded-by-caller" | "timed-out" | "not-granted" | "not-yet-searchable";
1212
+ } | undefined;
1213
+ };
1214
+ notYetSearchable: ("comments" | "sessions" | "turns" | "actions" | "session-comments")[];
1215
+ untrusted: {
1216
+ token: string;
1217
+ startMarker: string;
1218
+ endMarker: string;
1219
+ note: string;
1220
+ };
1221
+ };
1222
+ //# sourceMappingURL=search.d.ts.map