@crossworks/client-types 0.706.3 → 0.708.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.706.3",
3
+ "version": "0.708.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -50,6 +50,11 @@ export type DecisionModelProfile = {
50
50
  /** A start value for passage scoring's threshold where Jev's 1.5 drops
51
51
  * right passages. Tune it with eval:route. */
52
52
  thresholdStart?: number;
53
+ /** Takes a picture in the state (an `image_url` part, PNG or JPEG, within
54
+ * DECISION_PICTURE_LIMITS). From OpenRouter's multimodal decisions table
55
+ * (2026-11-19) and one measured use (`scan_read_check`). `decide()`
56
+ * sends a picture only to such a model. */
57
+ pictures?: true;
53
58
  /** Its place in the shipped decider pool. A product decision (2026-10-30),
54
59
  * not a ranking: re-curation offers only these, in this order. */
55
60
  poolPosition?: number;
@@ -65,11 +70,12 @@ export const DECISION_MODEL_PROFILES: readonly DecisionModelProfile[] = [
65
70
  id: '~typesafe/jev-latest',
66
71
  status: 'works',
67
72
  privacy: 'zdr',
73
+ pictures: true,
68
74
  poolPosition: 0,
69
75
  note: 'the shipped default',
70
76
  },
71
- { id: 'typesafe/jev-1.14', status: 'works', privacy: 'zdr' },
72
- { id: 'typesafe/jev-1.13', status: 'works', privacy: 'zdr' },
77
+ { id: 'typesafe/jev-1.14', status: 'works', privacy: 'zdr', pictures: true },
78
+ { id: 'typesafe/jev-1.13', status: 'works', privacy: 'zdr', pictures: true },
73
79
  {
74
80
  id: 'perplexity/pplx-decider-v1.2',
75
81
  status: 'works',
@@ -160,6 +166,25 @@ export function decisionModelRefusal(model: string | null | undefined): string |
160
166
  );
161
167
  }
162
168
 
169
+ /** Whether a decision model takes a picture in its state (its profile says
170
+ * `pictures`). An untested model does not: a picture is never sent to it. */
171
+ export function decisionModelTakesPictures(model: string | null | undefined): boolean {
172
+ return decisionModelProfile(model)?.pictures === true;
173
+ }
174
+
175
+ /** What a picture in a decision state may be (OpenRouter's multimodal
176
+ * decisions table for TypeSafe, 2026-11-19): a PNG or JPEG data URL, 256 to
177
+ * 1,568 pixels a side, 78,400 to 2,458,624 pixels in all, 16 MiB at most.
178
+ * `decide()` refuses one outside these, sending nothing; the picture helper
179
+ * of @mantle/decisions shrinks a larger one first. */
180
+ export const DECISION_PICTURE_LIMITS = {
181
+ minSide: 256,
182
+ maxSide: 1568,
183
+ minPixels: 78_400,
184
+ maxPixels: 2_458_624,
185
+ maxBytes: 16 * 1024 * 1024,
186
+ } as const;
187
+
163
188
  /** The size of one decision request a model takes. Null = no limit is known,
164
189
  * so the use's own size stands. */
165
190
  export type DecisionRequestLimits = {
@@ -62,11 +62,12 @@ export type AccessKeyView = {
62
62
  revokedAt: string | null;
63
63
  };
64
64
 
65
- /** GET /api/access-keys. A member gets their own keys; an admin gets every
66
- * key on the brain. */
65
+ /** GET /api/access-keys. The keys area (a System user) gets every key on
66
+ * the brain; every other login gets its own. */
67
67
  export type AccessKeyList = {
68
68
  keys: AccessKeyView[];
69
- /** The caller's kind: an admin sees every key. */
69
+ /** The caller's kind, for display: which keys it sees follows the keys
70
+ * area, never this role. */
70
71
  role: AccessKeyRole;
71
72
  areas: AccessKeyArea[];
72
73
  /** The expiry a key gets when the create names none. */
@@ -224,7 +224,9 @@ export type AiWorkerKind =
224
224
  | 'search_advanced'
225
225
  | 'narrator'
226
226
  | 'suggester'
227
- | 'decider';
227
+ | 'decider'
228
+ | 'translator'
229
+ | 'scan_reader';
228
230
 
229
231
  /** An AI worker as returned by `GET /api/ai-workers`. `params` is jsonb (shape
230
232
  * varies by kind) — kept loose here; the form narrows per kind. */
@@ -18,7 +18,8 @@ import type { DataFileState, FileDatabaseReadBy } from './file-databases';
18
18
 
19
19
  /** Was the file's content read into the brain:
20
20
  * - `done`: read, in search (facts and mentions where the reader makes them);
21
- * - `partial`: read in part (a scan's first pages: `FileProcessing.extraction.pages`);
21
+ * - `partial`: read in part (rows, sheets, characters, pictures or pages left
22
+ * out: `FileProcessing.extraction.cuts`, its `hint` the sentence);
22
23
  * - `waiting`: not read yet (queued, retrying, or about to be queued);
23
24
  * - `failed`: the read failed (`FileProcessing.error` says why);
24
25
  * - `none`: not read on purpose: kept to its name, or nothing to read. */
@@ -62,8 +63,31 @@ export type FilePipelineRead = { id: string; name: string; version: string };
62
63
  export type FileProcessingExtraction = {
63
64
  state: 'indexed' | 'partial' | 'failed' | 'skipped' | 'pending' | 'name_only';
64
65
  reason?: string;
66
+ /** One sentence for a person (a `partial` file: what was left out, each
67
+ * cut in turn). The client shows it as is. */
65
68
  hint?: string;
66
69
  pages?: { read: number; total: number };
70
+ /** Pictures left out: the pictures kept and found (`more`: at least). */
71
+ pictures?: { kept: number; found: number; more?: true };
72
+ /** Each kind of cut (docs/files.md, "Read in part"). A `partial` file
73
+ * has the cuts that made it so; an `indexed` file may carry details
74
+ * only (`pictures_small`, `pictures_tiny`: icons and small pictures the
75
+ * size gate skipped), which are no reason for a partial badge. Each cut:
76
+ * its key (`sheet_rows`, `text_store`, `pictures_small`, `ocr_pages`,
77
+ * `pictures`, `page_pictures`, ...), the unit, how many were read of how many (`atLeast`: the total
78
+ * is a lower bound), the limit, and its own sentence. */
79
+ cuts?: FileReadCut[];
80
+ };
81
+
82
+ /** One kind of cut of a file read in part (FileProcessingExtraction.cuts). */
83
+ export type FileReadCut = {
84
+ key: string;
85
+ what: string;
86
+ read: number;
87
+ total?: number;
88
+ atLeast?: true;
89
+ limit?: number;
90
+ hint: string;
67
91
  };
68
92
 
69
93
  /** One item made from the file (its `data.sourceFileId`): an extracted
@@ -123,6 +147,24 @@ export type FileProcessing = {
123
147
  * `readBy`: the pipeline and version that built it (null before stamps
124
148
  * or when not built). `tables`: what it extracted, each tab and its
125
149
  * rows; only when built and readable by the caller (as the Data view). */
150
+ /** A PDF book (read by the book reader): how its pages were read, counted
151
+ * from its database (docs/ai-workers.md, "The Scan reader"): `text` (text
152
+ * layer), `ocr` (local OCR, a book read by an older reader), `blank`,
153
+ * `scanReader` (the Agent pdf-page-read's read of a scanned page),
154
+ * `vision` (its description of a figure), `unread` (marked for the Agent,
155
+ * with no text: not read yet, no Scan reader, or a read judged bad). Left
156
+ * out for any other file. */
157
+ bookPages?: {
158
+ text: number;
159
+ ocr: number;
160
+ blank: number;
161
+ scanReader: number;
162
+ vision: number;
163
+ unread: number;
164
+ /** There are unread pages and this brain has no Scan reader: that is
165
+ * why (an OpenRouter key and the Scan reader worker read them). */
166
+ noScanReader?: true;
167
+ };
126
168
  database: {
127
169
  state: DataFileState;
128
170
  bytes: number | null;
package/src/dto/logins.ts CHANGED
@@ -31,3 +31,13 @@ export type PasswordResetRefused = {
31
31
  reason: 'not-a-password-login';
32
32
  message: string;
33
33
  };
34
+
35
+ /** The 403 an act on a System user's login answers a caller who is not a
36
+ * System user (a password reset, a disable or enable, a session end, a
37
+ * role change, a device revoke, the company sign-in link, a delete; on
38
+ * the Users screen and on the Admin workspace's user list). Your own
39
+ * login is never refused. */
40
+ export type SystemUserTargetRefused = {
41
+ error: string;
42
+ code: 'system_user_target';
43
+ };
@@ -11,10 +11,11 @@ import type { AppTint } from '../app-nav';
11
11
  import type { LoginRole } from '../role-names';
12
12
 
13
13
  /** The Admin areas, the one list of them (the brain's SCOPE_AREAS,
14
- * adminUserSql and the route classes read it). An Admin
15
- * workspace user has all of them unless a per-user switch turns one off
16
- * (none can be switched off yet). In this order on the wire (the shell's
17
- * `areas`). */
14
+ * adminUserSql and the route classes read it). An Admin workspace user
15
+ * holds `users`; the other four (settings, assistants, connectors, keys)
16
+ * only while they are also a user of the System workspace. A per-user
17
+ * switch on the Admin row can turn one off (no screen sets it yet). In
18
+ * this order on the wire (the shell's `areas`). */
18
19
  export const WORKSPACE_AREAS = ['settings', 'users', 'assistants', 'connectors', 'keys'] as const;
19
20
  export type WorkspaceArea = (typeof WORKSPACE_AREAS)[number];
20
21
 
@@ -54,9 +55,15 @@ export type Workspace = WorkspaceLook & {
54
55
  assistant: { id: string; name: string } | null;
55
56
  /** The Admin workspace: its users manage the brain (requireArea). */
56
57
  isAdmin: boolean;
57
- /** The built-in workspace: Admin only since migration 0286 (Team too
58
- * before). It cannot be renamed or archived (hide Rename and Archive
59
- * there). Its connectors are attached here like any workspace's. */
58
+ /** The System workspace: a subset of the Admin users who hold the
59
+ * technical areas (settings, assistants, connectors, keys). Only a
60
+ * System user adds someone, and only an Admin user can be added; there
61
+ * is no Moderator tick to set (every user is one). Absent (read it as
62
+ * false) on any other workspace and from a brain before it. */
63
+ isSystem?: boolean;
64
+ /** The built-in workspaces: Admin, and System (Team too before 0286).
65
+ * They cannot be renamed or archived (hide Rename and Archive there).
66
+ * Their connectors are attached here like any workspace's. */
60
67
  builtIn: boolean;
61
68
  /** Always false since migration 0286 (it marked the built-in Team
62
69
  * workspace, where every Admin workspace user was a Moderator). */
@@ -222,6 +229,8 @@ export type ShellWorkspace = WorkspaceLook & {
222
229
  id: string;
223
230
  name: string;
224
231
  isAdmin: boolean;
232
+ /** The System workspace (see Workspace.isSystem). Absent on any other. */
233
+ isSystem?: true;
225
234
  moderator: boolean;
226
235
  /** The login's own private workspace ("<name> (only you)"): match on
227
236
  * this, never on the name. Absent on any other. */
@@ -305,6 +314,10 @@ export type WorkspaceErrorCode =
305
314
  | 'resource_exists'
306
315
  | 'landing_app_not_held'
307
316
  | 'landing_app_not_ready'
308
- | 'rate_limited';
317
+ | 'rate_limited'
318
+ | 'system_users_only'
319
+ | 'not_admin_user'
320
+ | 'last_system_user'
321
+ | 'system_user_target';
309
322
 
310
323
  export type WorkspaceError = { error: string; code: WorkspaceErrorCode };
package/src/index.ts CHANGED
@@ -217,6 +217,7 @@ export type {
217
217
  LoginRefused,
218
218
  LoginRefusedReason,
219
219
  PasswordResetRefused,
220
+ SystemUserTargetRefused,
220
221
  } from './dto/logins';
221
222
  // Inbound API keys (0232). Types at the root; the runtime ACCESS_KEY_AREAS
222
223
  // is the `@mantle/client-types/dto/access-keys` subpath.
@@ -1112,6 +1112,27 @@
1112
1112
  "rating": 2,
1113
1113
  "note": "intelligence index 37.3; busier than most of the ranked field; 1M+ context"
1114
1114
  },
1115
+ {
1116
+ "pool": "scan_reader",
1117
+ "position": 0,
1118
+ "name": "Meta: Llama 3.1 8B Instruct",
1119
+ "vendor": "Meta",
1120
+ "routes": [
1121
+ {
1122
+ "provider": "openrouter",
1123
+ "model": "meta-llama/llama-3.1-8b-instruct"
1124
+ }
1125
+ ],
1126
+ "pricing": {
1127
+ "inputPerM": 0.02,
1128
+ "outputPerM": 0.04,
1129
+ "currency": "USD",
1130
+ "capturedAt": "2026-11-19T09:00:00.000Z",
1131
+ "source": "openrouter"
1132
+ },
1133
+ "rating": 5,
1134
+ "note": "the shipped default: the text model behind the mistral-ocr PDF parser (params.engine), which bills $2 per 1,000 pages; it answers 16 tokens, the text is the parser's"
1135
+ },
1115
1136
  {
1116
1137
  "pool": "image_gen",
1117
1138
  "position": 0,
@@ -2018,6 +2039,69 @@
2018
2039
  "rating": 2,
2019
2040
  "note": "busier than most of the ranked field; free tier: rate-limited, use as a fallback not a default"
2020
2041
  },
2042
+ {
2043
+ "pool": "translator",
2044
+ "position": 0,
2045
+ "name": "Google: Gemini 3.1 Flash Lite",
2046
+ "vendor": "Google",
2047
+ "routes": [
2048
+ {
2049
+ "provider": "openrouter",
2050
+ "model": "google/gemini-3.1-flash-lite"
2051
+ }
2052
+ ],
2053
+ "pricing": {
2054
+ "inputPerM": 0.25,
2055
+ "outputPerM": 1.5,
2056
+ "currency": "USD",
2057
+ "capturedAt": "2026-11-19T00:00:00.000Z",
2058
+ "source": "openrouter"
2059
+ },
2060
+ "rating": 5,
2061
+ "note": "the shipped default for this pool (owner's pick 2026-11-19); 1M context, 65,536 output tokens"
2062
+ },
2063
+ {
2064
+ "pool": "translator",
2065
+ "position": 1,
2066
+ "name": "Mistral: Mistral Small 2603",
2067
+ "vendor": "Mistral",
2068
+ "routes": [
2069
+ {
2070
+ "provider": "openrouter",
2071
+ "model": "mistralai/mistral-small-2603"
2072
+ }
2073
+ ],
2074
+ "pricing": {
2075
+ "inputPerM": 0.15,
2076
+ "outputPerM": 0.6,
2077
+ "currency": "USD",
2078
+ "capturedAt": "2026-11-19T00:00:00.000Z",
2079
+ "source": "openrouter"
2080
+ },
2081
+ "rating": 4,
2082
+ "note": "the shipped fallback: takes a part only when the primary fails it; 262k context"
2083
+ },
2084
+ {
2085
+ "pool": "translator",
2086
+ "position": 2,
2087
+ "name": "Mistral: Mistral Medium 3.5",
2088
+ "vendor": "Mistral",
2089
+ "routes": [
2090
+ {
2091
+ "provider": "openrouter",
2092
+ "model": "mistralai/mistral-medium-3-5"
2093
+ }
2094
+ ],
2095
+ "pricing": {
2096
+ "inputPerM": 1.5,
2097
+ "outputPerM": 7.5,
2098
+ "currency": "USD",
2099
+ "capturedAt": "2026-11-19T00:00:00.000Z",
2100
+ "source": "openrouter"
2101
+ },
2102
+ "rating": 4,
2103
+ "note": "the shipped high model: quality 'high' only, for terminology or style work"
2104
+ },
2021
2105
  {
2022
2106
  "pool": "decider",
2023
2107
  "position": 0,
@@ -96,6 +96,14 @@ export const MODEL_POOLS: readonly ModelPoolDef[] = [
96
96
  group: 'workers',
97
97
  modality: { input: ['image'], output: 'text' },
98
98
  },
99
+ {
100
+ id: 'scan_reader',
101
+ label: 'Scan reader',
102
+ description:
103
+ 'Reads the text of every scanned page of a PDF book through the mistral-ocr PDF parser, at about half the vision price. This is the cheap text model the parsed page is handed to (its short answer is not used); text-only, so no picture is forwarded.',
104
+ group: 'workers',
105
+ modality: TEXT_OUT,
106
+ },
99
107
  {
100
108
  id: 'image_gen',
101
109
  label: 'Image generation',
@@ -150,6 +158,14 @@ export const MODEL_POOLS: readonly ModelPoolDef[] = [
150
158
  group: 'workers',
151
159
  modality: TEXT_OUT,
152
160
  },
161
+ {
162
+ id: 'translator',
163
+ label: 'Translator',
164
+ description:
165
+ 'Translates text and items for the translate tool. A long text goes in parts sized by the model\u2019s output limit, so a large output limit means fewer parts. The worker also names a fallback model and a high-quality model.',
166
+ group: 'workers',
167
+ modality: TEXT_OUT,
168
+ },
153
169
  {
154
170
  id: 'decider',
155
171
  label: 'Decider (typed decisions)',