wicked-crew-api-types 0.126.0 → 0.127.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +94 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -11125,3 +11125,97 @@ export interface McpInspectLogResponse {
11125
11125
  state: McpInspectState;
11126
11126
  error: string | null;
11127
11127
  }
11128
+
11129
+ // ── Global search (`GET /search`; api-types 0.127.0) ─────────────────────────────────────────────
11130
+ //
11131
+ // One query over every major entity the daemon can read, answered grouped by type, ranked, with a
11132
+ // snippet per hit. The daemon keeps an in-memory text index it builds lazily on the first search
11133
+ // (off the request path) and keeps current from its own writes and engine frames. A query never
11134
+ // holds the event loop: it yields while it scans, stops at a hard time budget (`partial: true`)
11135
+ // and stops early when the client disconnects (a superseded query).
11136
+
11137
+ /** The searchable entity types, in the order the daemon answers them. */
11138
+ export type SearchType = 'run' | 'project' | 'repo' | 'transcript' | 'rule' | 'memory' | 'doc';
11139
+
11140
+ /** A half-open `[start, end)` UTF-16 range of matched text inside a hit's `title` or `snippet`. */
11141
+ export type SearchSpan = [number, number];
11142
+
11143
+ /** Where a hit opens. A skin maps each kind to its own address. */
11144
+ export type SearchTarget =
11145
+ | { kind: 'run'; run_id: string; chat_id: string | null }
11146
+ | { kind: 'project'; project_id: string }
11147
+ | { kind: 'repo'; repo_id: string }
11148
+ /** A chat's transcript (a live chat: chat transcripts are kept only while the chat is open). */
11149
+ | { kind: 'chat'; chat_id: string }
11150
+ /** One unit's captured output (its transcript) inside a run. */
11151
+ | { kind: 'unit'; run_id: string; ord: number; chat_id: string | null }
11152
+ | { kind: 'rule'; rule_id: string; steering_type: string | null }
11153
+ | { kind: 'memory'; memory_id: string; scope: string }
11154
+ | { kind: 'doc'; project_id: string; doc: string };
11155
+
11156
+ export interface SearchHit {
11157
+ type: SearchType;
11158
+ /** Unique within `type`. */
11159
+ id: string;
11160
+ title: string;
11161
+ /** The matched ranges in `title`. */
11162
+ title_spans: SearchSpan[];
11163
+ /** A short window of the matched body text (whitespace collapsed, `…` where cut); `null` when the hit has no body. */
11164
+ snippet: string | null;
11165
+ snippet_spans: SearchSpan[];
11166
+ /** Higher is better; comparable only within one group. */
11167
+ score: number;
11168
+ /** Unix MILLIS of the entity's last known change, when the daemon knows it. */
11169
+ updated_at: number | null;
11170
+ project_id: string | null;
11171
+ /** The entity's own state word where it has one (a run's status, `retired`, `archived`), else `null`. */
11172
+ status: string | null;
11173
+ target: SearchTarget;
11174
+ }
11175
+
11176
+ export interface SearchGroup {
11177
+ type: SearchType;
11178
+ /** Every match the query found in this type (a lower bound when `partial`). */
11179
+ total: number;
11180
+ /** This page, best first. */
11181
+ hits: SearchHit[];
11182
+ /** Pass back as `cursor` (with `types=<this type>`) for the next page; `null` on the last page. */
11183
+ next_cursor: string | null;
11184
+ }
11185
+
11186
+ /**
11187
+ * How much of a type the index holds. `indexing`: the first read of that source is still running
11188
+ * (search again shortly); `unavailable`: the source could not be read (`note` says why), so the
11189
+ * type was not searched.
11190
+ */
11191
+ export interface SearchSourceState {
11192
+ type: SearchType;
11193
+ state: 'ready' | 'indexing' | 'unavailable';
11194
+ /** Entities of this type the index holds. */
11195
+ indexed: number;
11196
+ note: string | null;
11197
+ }
11198
+
11199
+ /**
11200
+ * `GET /search?q=&types=&limit=&cursor=` → 200.
11201
+ *
11202
+ * - `q` (required, 2–256 chars after trimming): words (each must match, case-insensitive, anywhere
11203
+ * in a title or body) and `"quoted phrases"`. 400 when missing, too short or too long.
11204
+ * - `types`: comma-separated `SearchType`s (default every type). 400 on an unknown type.
11205
+ * - `limit`: hits per group, 1–50 (default 5).
11206
+ * - `cursor`: a group's `next_cursor`; needs exactly one type in `types` (400 otherwise).
11207
+ *
11208
+ * Unit transcripts are indexed from a capped head and tail of each output (the full output stays at
11209
+ * `GET /runs/:id/units/:unit/output`); the oldest transcripts leave the index first when its text
11210
+ * budget is full.
11211
+ */
11212
+ export interface SearchResponse {
11213
+ query: string;
11214
+ /** One group per searched type with at least one hit, in `SearchType` order. */
11215
+ groups: SearchGroup[];
11216
+ /** One row per requested type. */
11217
+ sources: SearchSourceState[];
11218
+ /** The time budget ran out before every type was scanned: totals are lower bounds. */
11219
+ partial: boolean;
11220
+ took_ms: number;
11221
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wicked-crew-api-types",
3
- "version": "0.126.0",
3
+ "version": "0.127.0",
4
4
  "description": "The wire contract of the wicked-crew daemon's /api/v1 REST surface and /ws CoreEvent frames \u2014 types only, zero runtime",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",