@crossworks/client-types 0.600.2 → 0.607.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/client-types",
3
- "version": "0.600.2",
3
+ "version": "0.607.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/auth.ts CHANGED
@@ -63,6 +63,11 @@ export type SsoSetupStatusDTO =
63
63
  mode: 'setup' | 'optional' | 'required';
64
64
  issuer: string;
65
65
  clientId: string;
66
+ /** Where the issuer and the client id come from: the box .env, or the
67
+ * setup row a Control Center staged (a .env line wins). A box before
68
+ * them sends neither. */
69
+ issuerFrom?: 'env' | 'row' | 'none';
70
+ clientIdFrom?: 'env' | 'row' | 'none';
66
71
  /** The redirect URI to register with the provider; '' with no usable
67
72
  * MANTLE_PUBLIC_URL. */
68
73
  redirectUri: string;
@@ -20,6 +20,10 @@ export type FileDatabaseTab = {
20
20
  columns: { name: string; type: string }[];
21
21
  };
22
22
 
23
+ /** Which pipeline read the file into its database (its id), at which version (its
24
+ * stamp, docs/pipelines.md). Null for a database built before stamps. */
25
+ export type FileDatabaseReadBy = { pipeline: string; version: string };
26
+
23
27
  export type FileDatabaseResponse =
24
28
  | {
25
29
  kind: 'describe';
@@ -28,6 +32,7 @@ export type FileDatabaseResponse =
28
32
  description?: string;
29
33
  tabs: FileDatabaseTab[];
30
34
  hint: string;
35
+ readBy: FileDatabaseReadBy | null;
31
36
  }
32
37
  | {
33
38
  kind: 'rows';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The Control Center's Default Model (docs/control-center.md, "Default
3
+ * Model"): one model provider and one of this brain's keys for it. The CC
4
+ * lists that provider's models with that key, and every place on the Fleet
5
+ * screen that picks a model picks from that list. A BRAIN preference
6
+ * (`fleetDefaultModel`): one choice for every admin and browser.
7
+ *
8
+ * Nothing here is a secret: a key is named by its id, its name and the
9
+ * masked hint the keys screen shows (first 4 and last 4 of a long token).
10
+ */
11
+
12
+ /** What is stored: the provider id and the key id. `null` clears it. */
13
+ export type StoredFleetDefaultModel = {
14
+ provider: string;
15
+ keyId: string;
16
+ };
17
+
18
+ /** One of this brain's keys, as the Default Model card names it. */
19
+ export type FleetDefaultModelKey = {
20
+ id: string;
21
+ name: string;
22
+ label: string;
23
+ /** The keys screen's hint, never the key. */
24
+ masked: string;
25
+ };
26
+
27
+ /** A chat provider this brain holds at least one key for. */
28
+ export type FleetDefaultModelChoice = {
29
+ provider: string;
30
+ providerName: string;
31
+ keys: FleetDefaultModelKey[];
32
+ };
33
+
34
+ /** GET /api/fleet/default-model and control_default_model_get. */
35
+ export type FleetDefaultModelView = {
36
+ /** The stored provider, or null when none is set. */
37
+ provider: string | null;
38
+ providerName: string | null;
39
+ /** The stored key while it is still this brain's key for the provider. */
40
+ key: FleetDefaultModelKey | null;
41
+ /** Set, but the key was deleted or is no longer the provider's: the
42
+ * pickers say so and point to the card. */
43
+ problem: 'key-missing' | null;
44
+ /** What the card can pick from. */
45
+ choices: FleetDefaultModelChoice[];
46
+ };
@@ -0,0 +1,277 @@
1
+ /**
2
+ * The pipelines of a brain, as the Settings screen reads them
3
+ * (docs/pipelines.md). GET /api/pipelines answers a `PipelineList`; the MCP
4
+ * tool `pipeline_list` gives the same list. PATCH /api/pipelines/:id takes a
5
+ * `PipelineSetBody` and answers the `PipelineRow`; the MCP tool
6
+ * `pipeline_set` does the same. POST /api/pipelines/:id/reread takes a
7
+ * `PipelineRereadBody` and answers a `PipelineRunAnswer`; the MCP tool
8
+ * `pipeline_reread` does the same.
9
+ *
10
+ * An Admin installs an own pipeline with POST /api/pipelines (a
11
+ * `PipelineInstallBody`; the MCP tool `pipeline_install`), reads its
12
+ * package with GET /api/pipelines/:id/package (`pipeline_get`) and removes
13
+ * it with DELETE /api/pipelines/:id (`pipeline_remove`); each answers a
14
+ * `PipelineInstallAnswer` or the package.
15
+ *
16
+ * A pipeline is a built-in or an own one (`source`). A reader reads a file into its database; an
17
+ * `after` pipeline adds tabs to a database a reader made; a router names the
18
+ * kind of a file, and the reader that claims the kind reads it. The counts
19
+ * are numbers only: no file name and no id.
20
+ */
21
+
22
+ /** One option, as a manifest declares it. A copy of the contract's type
23
+ * (@mantle/files, pipelines/contract.ts): the client does not load that
24
+ * package. There is no pattern type, by choice. */
25
+ export type PipelineOptionSpec =
26
+ | { type: 'number'; label: string; help?: string; default: number; min: number; max: number }
27
+ | { type: 'bool'; label: string; help?: string; default: boolean }
28
+ | {
29
+ type: 'words';
30
+ label: string;
31
+ help?: string;
32
+ default: readonly string[];
33
+ /** At most 200. */
34
+ maxItems: number;
35
+ /** Of one word, at most 16. */
36
+ maxChars: number;
37
+ };
38
+
39
+ /** The files a pipeline read at one version, from its stamp. `version` null:
40
+ * read before versions were recorded (a database with no stamp). */
41
+ export type PipelineVersionCount = { version: string | null; files: number };
42
+
43
+ export type PipelineRow = {
44
+ id: string;
45
+ name: string;
46
+ /** What it reads and what it writes, in one or two plain sentences. */
47
+ description: string;
48
+ version: string;
49
+ source: 'builtin' | 'curated' | 'own';
50
+ /** Why this pipeline does not run on this box, in one plain sentence (an
51
+ * installed pipeline whose id or extension a built-in took, or whose
52
+ * manifest no longer passes the check). Null: it runs. Always null for a
53
+ * built-in. A server before this field sends none: read a missing one as
54
+ * null (`row.problem ?? null`). */
55
+ problem?: string | null;
56
+ /** The same problem as a short fixed word (PipelineProblemCode), so a
57
+ * client can offer its act without reading the sentence: `not-on-disk`
58
+ * gets "Write the files again". Null or missing: no problem, or a
59
+ * server before this field. */
60
+ problemCode?: PipelineProblemCode | null;
61
+ start: 'upload' | 'demand';
62
+ /** A reader reads files; an `after` pipeline adds tabs to a reader's
63
+ * database; a router names the kind of a file and writes no tabs. A
64
+ * router has no options, no workspace list, no run and no re-read. A
65
+ * later server may add a word: show an unknown one as a plain row.
66
+ * People read `after` as Transformer. */
67
+ kind: 'reader' | 'after' | 'router';
68
+ /** The file extensions it reads (a router: the file types it names a
69
+ * kind for). */
70
+ reads: string[];
71
+ /** A router: the kinds it can name. `decider`: named only by the
72
+ * decider's answer, for a file the rules left unsure. Empty for a
73
+ * pipeline. */
74
+ names: { kind: string; decider: boolean }[];
75
+ /** A reader: the kinds it claims, so it reads a file of its types only
76
+ * when the router names one of them. Empty: it takes its files by
77
+ * extension alone. */
78
+ claims: string[];
79
+ weight: 'light' | 'heavy';
80
+ /** The tab shapes it promises. */
81
+ shapes: string[];
82
+ /** The AI worker kinds it may ask. */
83
+ workers: string[];
84
+ /** The brain tools it may call. */
85
+ tools: string[];
86
+ /** Always 'all' since the server of milestone WO: a pipeline is on in
87
+ * every workspace but those in `offIn`. Kept for older clients: read
88
+ * `offIn`. */
89
+ workspaces: 'all' | string[];
90
+ /** The ids of the workspaces the pipeline is switched off in. Empty: on
91
+ * in every workspace. Always empty for a router, which has no switch. */
92
+ offIn: string[];
93
+ /** For an `after` pipeline: the shape it reads. Null for a reader. */
94
+ after: string | null;
95
+ /** The tabs an `after` pipeline writes. */
96
+ tabs: string[];
97
+ /** Each declared option, its spec, and the value in force on this box. */
98
+ options: { name: string; spec: PipelineOptionSpec; value: unknown }[];
99
+ /** Files with a database of this pipeline; null when not counted (a
100
+ * router is never counted: it has no database of its own). */
101
+ files: number | null;
102
+ /** Of those, not current: read at an older version, before stamps, or with
103
+ * other options. POST /api/pipelines/:id/reread reads them again. */
104
+ older: number | null;
105
+ /** `files` by the version in their stamp, highest first; `null` (read
106
+ * before versions were recorded) last. For an `after` pipeline, the
107
+ * versions of its entries. From the same look as `files`, with the same
108
+ * cap (`countsPartial`). Empty when not counted. */
109
+ versions: PipelineVersionCount[];
110
+ /** How many times it wrote its result into a file's database on this box:
111
+ * a reader's build, an `after` pipeline's patch (an upload, a sketch
112
+ * read's rebuild, a run on demand, a re-read). A skip, a word with no
113
+ * rows, a failure and a test count none. A router: how many times it
114
+ * named the kind of a file in a real read, a document too. Today that
115
+ * is an upload and `dwg-reindex --pdf`; a run on demand and a re-read
116
+ * count for PDF drawings too since MV5, when the router runs. A
117
+ * test and the sketch read count none. Read with the state on every
118
+ * call, never kept. */
119
+ runs: number | null;
120
+ /** When it last wrote, as an ISO time; null before its first run. */
121
+ lastRunAt: string | null;
122
+ };
123
+
124
+ /** Why an own pipeline does not run, as a fixed word: its files are not on
125
+ * disk (`not-on-disk`: install it again with the same files), the box runs
126
+ * curated pipelines only, a built-in has its id now, a reader before it
127
+ * reads one of its extensions, or its manifest does not pass. A later
128
+ * server may add a word: show the `problem` sentence for an unknown one. */
129
+ export type PipelineProblemCode =
130
+ 'not-on-disk' | 'curated-only' | 'builtin-id' | 'ext-taken' | 'manifest';
131
+
132
+ export type PipelineList = {
133
+ /** The contract version. */
134
+ api: number;
135
+ pipelines: PipelineRow[];
136
+ /** The scan stopped at its cap: the counts are of the first files only. */
137
+ countsPartial: boolean;
138
+ };
139
+
140
+ /**
141
+ * What an Admin changes on one pipeline. A field left out stays as it is.
142
+ * `options` merge into the stored ones. `offIn` replaces the list of the
143
+ * workspaces the pipeline is off in; `[]` switches it on everywhere. A
144
+ * router refuses `offIn`: it is used wherever its readers are.
145
+ */
146
+ export type PipelineSetBody = {
147
+ options?: Record<string, unknown>;
148
+ offIn?: string[];
149
+ /** Refused by the server since milestone WO, with a sentence that names
150
+ * `offIn` (an old allow list sent as it was would do the opposite).
151
+ * Kept so an older client still compiles. */
152
+ workspaces?: string[];
153
+ };
154
+
155
+ /** Why a run on demand did not take a file: the extension or the tabs do
156
+ * not match, no database for an `after` pipeline, `not-attached`: the
157
+ * pipeline is off in the file's home workspace (the word is older than
158
+ * the off list, and stays), no checksum, a private file, or the reader of a
159
+ * PDF drawing: `pdf`, which no server gives since MV5 (the word stays).
160
+ * `text` (the re-read, from P3-2): a file whose Reader gave its text and
161
+ * no tabs; a re-read keeps a file's text, so its new text needs a
162
+ * re-extract. A later server may add a word: count an unknown one as
163
+ * skipped. */
164
+ export type PipelineRunSkip =
165
+ 'no-match' | 'no-database' | 'not-attached' | 'no-sha' | 'private' | 'pdf' | 'text';
166
+
167
+ /** The body of POST /api/files/files/:id/run and /api/files/folders/:id/run.
168
+ * With no `apply`, the dry run. `pipeline` is needed with `apply`. */
169
+ export type PipelineRunBody = {
170
+ pipeline?: string;
171
+ apply?: boolean;
172
+ /** The most files one call looks at: 100 by default, at most 1000. */
173
+ limit?: number;
174
+ /** Go on after this file id: the `next` of the call before. */
175
+ after?: string;
176
+ };
177
+
178
+ /** The body of POST /api/pipelines/:id/reread: read the older files of one
179
+ * pipeline again. With no `apply`, the dry run. */
180
+ export type PipelineRereadBody = {
181
+ apply?: boolean;
182
+ /** The most older files one call takes: 100 by default, at most 1000. */
183
+ limit?: number;
184
+ /** Go on after this file id: the `next` of the call before. */
185
+ after?: string;
186
+ };
187
+
188
+ /** The answer of a run on demand, the dry run and the run alike. An older
189
+ * server has no run route (404). The re-read of the older files
190
+ * (POST /api/pipelines/:id/reread) gives the same answer, with one choice:
191
+ * its `files` are the older files found in this page. */
192
+ export type PipelineRunAnswer = {
193
+ apply: boolean;
194
+ /** The extract queue is busy: nothing was queued. */
195
+ busy: boolean;
196
+ /** The pipelines that can run on these files, with the count each takes.
197
+ * `refused`: always null since MV5 (the field stays; an older server
198
+ * gave 'pdf' for the reader of a PDF drawing). */
199
+ choices: { pipeline: string; name: string; files: number; refused: string | null }[];
200
+ /** The files queued. Each one's stamp shows the run when it is done. */
201
+ queued: number;
202
+ /** The files the named pipeline does not take, by PipelineRunSkip word. */
203
+ skipped: Record<string, number>;
204
+ /** The last file id looked at, when there are more: send it as `after`. */
205
+ next: string | null;
206
+ };
207
+
208
+ /** What an Admin sends to test one pipeline on one file. `options`, when
209
+ * given, are used in place of the saved ones (checked the same way), so a
210
+ * value is tried before the save. Nothing is written. */
211
+ export type PipelineTestBody = {
212
+ fileId: string;
213
+ options?: Record<string, unknown>;
214
+ /** A draft package to test in place of the installed one (its id may be
215
+ * one that is not installed). Nothing is written but its draft folder,
216
+ * which goes when the test ends. */
217
+ files?: PipelinePackage['files'];
218
+ };
219
+
220
+ /** One file of an own package: text as it is, or binary bytes as base64.
221
+ * A copy of the contract's type (@mantle/files, pipelines/contract.ts). */
222
+ export type PipelinePackageFile = string | { base64: string };
223
+
224
+ /** An own package: path -> file. `pipeline.json` is its manifest. */
225
+ export type PipelinePackage = { files: Record<string, PipelinePackageFile> };
226
+
227
+ /** What an Admin sends to install an own pipeline: the whole package. */
228
+ export type PipelineInstallBody = PipelinePackage;
229
+
230
+ /** The answer of an install or a remove. `row`: the pipeline as the list
231
+ * shows it (no counts); null after a remove. `note`: one plain line to
232
+ * show with it. */
233
+ export type PipelineInstallAnswer = {
234
+ row: PipelineRow | null;
235
+ note: string;
236
+ };
237
+
238
+ /**
239
+ * The result of a test of one pipeline on one file
240
+ * (POST /api/pipelines/:id/test, the MCP tool `pipeline_test`). Nothing was
241
+ * written: no database, no row, no stamp.
242
+ */
243
+ export type PipelineTestResult = {
244
+ /** `not_mine`: the pipeline does not take this file. `unsure`: a PDF the
245
+ * rules left unsure; no model was asked. `busy`: the parser was busy, try
246
+ * again; it is no failure. */
247
+ status: 'ok' | 'not_mine' | 'unsure' | 'failed' | 'busy';
248
+ pipeline: string;
249
+ version: string;
250
+ ms: number;
251
+ /** For each tab: its row count, its columns, and its first 5 rows (a cell
252
+ * is cut at 200 characters). */
253
+ tabs: { name: string; rows: number; columns: string[]; first: unknown[][] }[];
254
+ shapes: string[];
255
+ warnings: string[];
256
+ /** The calls it would make, shown and not done. For a built-in: ['file_tabs_write']. */
257
+ writes: string[];
258
+ /** A Reader that gives a file's text (an own Reader with `produces.text`,
259
+ * for a format the core has no text reader for): the length of the text
260
+ * its run gave, in characters. Missing for any other pipeline, and from
261
+ * a server before P3-2. */
262
+ textLength?: number;
263
+ /** A fixed word when there is no result. With `not_mine`, the refusal
264
+ * file_sql gives the file, when it gives one ('private': the file stays
265
+ * out of the brain). */
266
+ word:
267
+ | 'no-database'
268
+ | 'no-match'
269
+ | 'too-large'
270
+ | 'unreadable'
271
+ | 'no-rows'
272
+ | 'not-table-type'
273
+ | 'no-sha'
274
+ | 'email-attachment'
275
+ | 'private'
276
+ | null;
277
+ };
package/src/dto/rows.ts CHANGED
@@ -14,6 +14,7 @@ import type { AppNav, AppOpenStat, AppTint } from '../app-nav';
14
14
  import type { HistoryActor } from '../role-names';
15
15
  import type { ListChips, ListWorkspace } from './grants';
16
16
  import type { StoredUpdateNotice } from './update-notice';
17
+ import type { StoredFleetDefaultModel } from './fleet-default-model';
17
18
  import type { TaskSubmission } from '../task-submissions';
18
19
 
19
20
  // ── Row/DTO shapes moved from the server packages (jackdaw split P0) ─────────
@@ -628,6 +629,10 @@ export type ProfilePreferences = {
628
629
  * a BRAIN key. Read via projectUpdateNotice, never raw; a write of `null`
629
630
  * switches it off. Whether it still counts is updateNoticeOn's to say. */
630
631
  updateNotice?: StoredUpdateNotice | null;
632
+ /** The Control Center's Default Model (dto/fleet-default-model.ts): a
633
+ * BRAIN key. Read via projectFleetDefaultModel, never raw; written only
634
+ * through setFleetDefaultModel (it checks the key); `null` clears it. */
635
+ fleetDefaultModel?: StoredFleetDefaultModel | null;
631
636
  /** Tags the owner curates as Dashboard sections on the /team overview: each
632
637
  * tag renders a section of up to 5 team-visible shared pages carrying it
633
638
  * (newest-updated first, title + summary + /s link). Order here = section
package/src/index.ts CHANGED
@@ -37,6 +37,7 @@ export * from './dto/contact-shares';
37
37
  export * from './dto/services';
38
38
  export * from './dto/box-status';
39
39
  export * from './dto/update-notice';
40
+ export * from './dto/fleet-default-model';
40
41
  export * from './dto/present-checks';
41
42
  export * from './task-files';
42
43
  export * from './task-submissions';
@@ -160,9 +161,28 @@ export type {
160
161
  DataFileRow,
161
162
  DataFileState,
162
163
  DataFilesResponse,
164
+ FileDatabaseReadBy,
163
165
  FileDatabaseResponse,
164
166
  FileDatabaseTab,
165
167
  } from './dto/file-databases';
168
+ export type {
169
+ PipelineList,
170
+ PipelineOptionSpec,
171
+ PipelineRereadBody,
172
+ PipelineProblemCode,
173
+ PipelineRow,
174
+ PipelineRunAnswer,
175
+ PipelineRunBody,
176
+ PipelineRunSkip,
177
+ PipelineSetBody,
178
+ PipelineTestBody,
179
+ PipelineInstallAnswer,
180
+ PipelineInstallBody,
181
+ PipelinePackage,
182
+ PipelinePackageFile,
183
+ PipelineTestResult,
184
+ PipelineVersionCount,
185
+ } from './dto/pipelines';
166
186
 
167
187
  export type { MemberItemKind, ClientItemKind, ClientItemFilter } from './member-kinds';
168
188
  export type {