@work-shape/catalyst-asset-schemas 0.8.0-rc.3 → 0.8.0-rc.30

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 (3) hide show
  1. package/dist/index.d.ts +2629 -29
  2. package/dist/index.js +1998 -88
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // src/asset-types.ts
2
+ var ASSET_ACCESS_VERBS = ["read", "write", "delete", "publish"];
2
3
  var localeCodes = ["en", "de"];
3
4
  var REASONING_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
4
5
  var SKILL_STARTERS_MAX = 2;
@@ -12,100 +13,302 @@ var SKILL_RESOURCE_MEDIA_TYPES = [
12
13
  "application/json",
13
14
  "application/yaml"
14
15
  ];
16
+ var APP_AUDIENCES = ["self", "workspace", "instance"];
15
17
 
16
- // src/contract-values.ts
17
- var AUTH_SCOPE_WILDCARD = "*";
18
- var CHAT_SESSION_AUTH_SCOPES = [
19
- "me:read",
20
- "me:delete",
21
- "config:read",
22
- "conversation:read",
23
- "conversation:write",
24
- "run:start",
25
- "run:observe",
26
- "run:cancel",
27
- "run:command"
28
- ];
29
- var FIRST_PARTY_AUTH_SCOPES = [
30
- AUTH_SCOPE_WILDCARD,
31
- ...CHAT_SESSION_AUTH_SCOPES,
32
- "collaboration_workspace:read",
33
- "collaboration_workspace:manage",
34
- "me:write",
35
- "governance:read",
36
- "governance:write",
37
- "user_admin:read",
38
- "user_admin:write",
39
- "api_access:read",
40
- "api_access:write",
41
- "config_assets:read",
42
- "config_assets:write",
43
- // Moving the published pointer of an asset. A credential that writes drafts with
44
- // `config_assets:write` publishes none of them without this one.
45
- "config_assets:publish",
46
- "config_assets:release",
47
- // The rows of a Data Store: reading them, and adding or loading them. The definition of a
48
- // store and its migrations stay under `config_assets:*`. A scope caps what a key may be
49
- // used for; whether its holder may do it is decided by the grants.
50
- "data_store_rows:read",
51
- "data_store_rows:write"
52
- ];
53
- var ACTIONS = [
18
+ // src/bedrock-profiles.ts
19
+ var BEDROCK_REGION = "eu-central-1";
20
+ var BEDROCK_ARN = /^arn:aws:bedrock:([a-z0-9-]*):(\d{12}):([a-z-]+)\/([a-zA-Z0-9.:_-]+)$/u;
21
+ var APPLICATION_INFERENCE_PROFILE = "application-inference-profile";
22
+ var AWS_ACCOUNT_ID = /^\d{12}$/u;
23
+ function bedrockProfileRefusal(model, accountId) {
24
+ const arn = BEDROCK_ARN.exec(model);
25
+ if (!arn) {
26
+ return "a model id or a shared inference profile such as 'eu.anthropic.\u2026' is not attributed to this consumer";
27
+ }
28
+ if (arn[3] !== APPLICATION_INFERENCE_PROFILE) {
29
+ return "the ARN names a foundation model or a shared inference profile, which is not attributed to this consumer";
30
+ }
31
+ if (arn[1] !== BEDROCK_REGION) {
32
+ return `the profile is in another region, and calls go to ${BEDROCK_REGION} only`;
33
+ }
34
+ if (arn[2] !== accountId) {
35
+ return "the profile belongs to another AWS account than the provider's 'accountId'";
36
+ }
37
+ return void 0;
38
+ }
39
+
40
+ // src/config-merge.ts
41
+ function mergeConfigObjects(base, overrides) {
42
+ const result = { ...base };
43
+ for (const [key2, override] of Object.entries(overrides)) {
44
+ if (key2 === "__proto__") {
45
+ continue;
46
+ }
47
+ const baseValue = result[key2];
48
+ result[key2] = isPlainConfigObject(baseValue) && isPlainConfigObject(override) ? mergeConfigObjects(baseValue, override) : override;
49
+ }
50
+ return result;
51
+ }
52
+ function isPlainConfigObject(value) {
53
+ if (typeof value !== "object" || value === null) {
54
+ return false;
55
+ }
56
+ const prototype = Object.getPrototypeOf(value);
57
+ return prototype === Object.prototype || prototype === null;
58
+ }
59
+
60
+ // src/contract-values/agent.ts
61
+ var AGENT_ACTIONS = [
54
62
  "agent.read",
55
63
  "agent.write",
56
64
  "agent.publish",
65
+ // Decides a held publish of an agent a workspace owns (WS-PUB-1b).
66
+ "agent.approve",
57
67
  "agent.delete",
68
+ // Converse with the agent where it is available (AGENT-USE-1).
69
+ "agent.use"
70
+ ];
71
+
72
+ // src/contract-values/skill.ts
73
+ var SKILL_ACTIONS = [
58
74
  "skill.read",
59
75
  "skill.write",
76
+ // A save of a team's or the instance's skill is live with it; without it, a request (SKILL-LIVE-1).
77
+ "skill.publish",
60
78
  "skill.delete",
61
- "skill.approve",
79
+ "skill.approve"
80
+ ];
81
+
82
+ // src/contract-values/connection.ts
83
+ var CONNECTION_ACTIONS = [
62
84
  "connection.read",
63
85
  "connection.use",
64
86
  "connection.write",
65
87
  "connection.delete",
66
- "connection.approve",
88
+ "connection.approve"
89
+ ];
90
+
91
+ // src/contract-values/app.ts
92
+ var APP_ACTIONS = [
67
93
  "app.read",
68
94
  "app.write",
69
95
  "app.publish",
70
96
  "app.approve",
71
97
  "app.delete",
72
- "app.use",
98
+ "app.use"
99
+ ];
100
+
101
+ // src/contract-values/workflow.ts
102
+ var WORKFLOW_ACTIONS = [
73
103
  "workflow.read",
74
104
  "workflow.write",
75
105
  "workflow.publish",
76
106
  "workflow.approve",
77
107
  "workflow.delete",
78
108
  "workflow.use",
79
- "workflow.read_run_data",
109
+ "workflow.read_run_data"
110
+ ];
111
+
112
+ // src/contract-values/data-store.ts
113
+ var DATA_STORE_ACTIONS = [
80
114
  "data_store.read",
81
115
  "data_store.write",
82
116
  "data_store.publish",
83
117
  "data_store.delete",
84
118
  "data_store.insert",
85
119
  "data_store.execute",
120
+ "data_store.records"
121
+ ];
122
+
123
+ // src/contract-values/knowledge-base.ts
124
+ var KNOWLEDGE_BASE_ACTIONS = [
86
125
  "knowledge_base.read",
87
126
  "knowledge_base.write",
127
+ "knowledge_base.ingest",
88
128
  "knowledge_base.publish",
89
129
  "knowledge_base.delete",
90
- "knowledge_base.use",
130
+ "knowledge_base.use"
131
+ ];
132
+
133
+ // src/contract-values/mail-sender.ts
134
+ var MAIL_SENDER_ACTIONS = [
135
+ // Sending e-mail as one sender of the instance (`mail.send`). The `admin` role holds it on
136
+ // the sender `system`; a member only by a grant.
137
+ "mail_sender.use"
138
+ ];
139
+
140
+ // src/contract-values/guardrail.ts
141
+ var GUARDRAIL_ACTIONS = [
91
142
  "guardrail.read",
92
143
  "guardrail.write",
93
144
  "guardrail.publish",
94
- "guardrail.delete",
95
- "operations.approve",
145
+ "guardrail.delete"
146
+ ];
147
+
148
+ // src/contract-values/operations.ts
149
+ var OPERATIONS_ACTIONS = ["operations.approve"];
150
+
151
+ // src/contract-values/feedback.ts
152
+ var FEEDBACK_ACTIONS = [
153
+ // Reading the written feedback on agent messages and marking it handled (LU-4): on the
154
+ // instance, or on one workspace for the agents it owns. No bundle carries it.
155
+ "feedback.review"
156
+ ];
157
+
158
+ // src/contract-values/administration.ts
159
+ var ADMINISTRATION_ACTIONS = [
96
160
  "users.manage",
161
+ // Deleting a person's account and their data, beside `users.manage` (RIGHTS-1e, D5). Its
162
+ // default sits with `superadmin` alone.
163
+ "users.delete",
97
164
  "usage.view",
165
+ // Setting the spend limits of the instance, of shared workspaces and of users (LU-2).
166
+ // Instance admins hold it; workspace owners do not.
167
+ "limits.manage",
168
+ // Setting the central policy of operations on Instance > Policies and locking "Always allow"
169
+ // (OP-2). Instance admins hold it.
170
+ "policy.manage",
171
+ // Usage by named person beyond one's own (LU-3, limits spec 3.4): the Users view of the
172
+ // instance, and an owner's figures per member of a workspace. A separate right because the
173
+ // works council has a say on it (BetrVG section 87(1) no. 6).
174
+ "usage.view_users",
98
175
  "audit.view",
176
+ // Seeing how the instance runs: its background jobs, its Operation Runs, its modules and what
177
+ // it runs on, the Settings group "System" (RIGHTS-1e; UX audit ruling 2). Its default sits
178
+ // with `superadmin` alone, so a customer's admin keeps the audit log and not these pages.
179
+ "system.view",
180
+ // Running a background job again that failed or died (RIGHTS-1e; UX audit ruling 2). Its
181
+ // default sits with `superadmin` alone.
182
+ "jobs.retry",
99
183
  "api_access.manage",
100
184
  // Creating service principals, giving and taking their rights, enabling and disabling them.
101
185
  // Their keys stay with `api_access.manage`.
102
186
  "service_principals.manage",
103
187
  "agent_models.manage",
188
+ // Editing and resetting the built-in roles `user` and `admin`, and deciding their pending
189
+ // actions (Felix, 2026-10-21). Its default sits with `superadmin` alone.
190
+ "roles.edit_built_in",
104
191
  "assets.release"
105
192
  ];
106
- var NAMESPACE_PREFIX_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*-$/u;
107
- var NAMESPACE_PREFIX_MIN_LENGTH = 2;
108
- var NAMESPACE_PREFIX_MAX_LENGTH = 32;
193
+
194
+ // src/contract-values/workspace.ts
195
+ var WORKSPACE_ACTIONS = [
196
+ // The two bundles of a workspace: one row each, expanded by the evaluator (`bundleCarries`).
197
+ "builder",
198
+ "publisher"
199
+ ];
200
+
201
+ // src/contract-values/project.ts
202
+ var PROJECT_ACTIONS = [
203
+ // A project's rights come from membership of its workspace alone (PRJ-1): no grant row, no
204
+ // role default and no bundle carries them, and its audience narrows them further.
205
+ "project.read",
206
+ "project.write",
207
+ "project.delete"
208
+ ];
209
+ var PROJECT_ASSET_KIND = "project";
210
+ var PROJECT_AUDIENCES = ["workspace", "private"];
211
+ var PROJECT_DELETION_CONVERSATIONS = ["keep", "delete"];
212
+ var PROJECT_FILE_ORIGINS = ["person", "agent", "upload"];
213
+ var PROJECT_FILE_CHANGES = [
214
+ "created",
215
+ "updated",
216
+ "deleted",
217
+ "restored",
218
+ "unchanged",
219
+ "conflict_copy"
220
+ ];
221
+ var PROJECT_FOLDER_WRITE_CHANGES = [
222
+ "created",
223
+ "updated",
224
+ "unchanged",
225
+ "conflict_copy"
226
+ ];
227
+ var PROJECT_TITLE_MAX_LENGTH = 120;
228
+ var PROJECT_DESCRIPTION_MAX_LENGTH = 500;
229
+ var PROJECT_SKILLS_MAX = 20;
230
+ var PROJECT_KNOWLEDGE_BASES_MAX = 20;
231
+ var PROJECT_CHOICE_REFUSALS = ["own_in_shared_project", "not_everyone_may_use"];
232
+ var PROJECT_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
233
+ var PROJECT_NAME_MAX_LENGTH = 64;
234
+
235
+ // src/contract-values.ts
236
+ var AUTH_SCOPE_WILDCARD = "*";
237
+ var CHAT_SESSION_AUTH_SCOPES = [
238
+ "me:read",
239
+ "me:delete",
240
+ "config:read",
241
+ "conversation:read",
242
+ "conversation:write",
243
+ "run:start",
244
+ "run:observe",
245
+ "run:cancel",
246
+ "run:command"
247
+ ];
248
+ var FIRST_PARTY_AUTH_SCOPES = [
249
+ AUTH_SCOPE_WILDCARD,
250
+ ...CHAT_SESSION_AUTH_SCOPES,
251
+ "collaboration_workspace:read",
252
+ "collaboration_workspace:manage",
253
+ "me:write",
254
+ "governance:read",
255
+ "governance:write",
256
+ "user_admin:read",
257
+ "user_admin:write",
258
+ // A personal key can check providers without reaching other user administration routes.
259
+ "infrastructure:check",
260
+ "api_access:read",
261
+ "api_access:write",
262
+ "config_assets:read",
263
+ "config_assets:write",
264
+ // Moving the published pointer of an asset. A credential that writes drafts with
265
+ // `config_assets:write` publishes none of them without this one.
266
+ "config_assets:publish",
267
+ "config_assets:release",
268
+ // The rows of a Data Store: reading them, and adding or loading them. The definition of a
269
+ // store and its migrations stay under `config_assets:*`. A scope caps what a key may be
270
+ // used for; whether its holder may do it is decided by the grants.
271
+ "data_store_rows:read",
272
+ "data_store_rows:write",
273
+ // What the use level of a personal key reaches of those rows (CLI-PARITY-4): a read of a
274
+ // store's rows, an insert and a query of a Knowledge Base, and nothing else under
275
+ // `data_store_rows:*`. Only a personal key's call is asked for it, through the operation's
276
+ // `personalKeyScope`; every other credential keeps the scopes above.
277
+ "data_store_rows:use",
278
+ // What the use level of a personal key reaches of Workflows: starting a run by hand, with
279
+ // `workflow.use` alone (CLI-PARITY-4 review). Only a personal key's call is asked for it, through
280
+ // the operation's `personalKeyScope`.
281
+ "workflow_runs:use",
282
+ // What the instance level of a personal key reads of the instance (CLI-PARITY-6a): usage,
283
+ // audit events, background jobs, Operation Runs, Modules and the last infrastructure check,
284
+ // each still asking the right of its own (`usage.view`, `audit.view`, `system.view`). Only
285
+ // a personal key's call is asked for it, through the operation's `personalKeyScope`.
286
+ "instance:inspect",
287
+ // What the account and workspaces level of a personal key reaches (CLI-PARITY-5): the
288
+ // person's name and model preference and the revocation of their own keys, never a new key,
289
+ // a confirmed connect code, the password or the account's deletion; and the Shared
290
+ // Workspaces as the person's role in each allows, never a workspace's usage. Only a personal
291
+ // key's call is asked for them, through the operation's `personalKeyScope`; `me:write` and
292
+ // `collaboration_workspace:*` stay off every key.
293
+ "account:manage",
294
+ "workspaces:manage"
295
+ ];
296
+ var ACTIONS = [
297
+ ...AGENT_ACTIONS,
298
+ ...SKILL_ACTIONS,
299
+ ...CONNECTION_ACTIONS,
300
+ ...APP_ACTIONS,
301
+ ...WORKFLOW_ACTIONS,
302
+ ...DATA_STORE_ACTIONS,
303
+ ...KNOWLEDGE_BASE_ACTIONS,
304
+ ...MAIL_SENDER_ACTIONS,
305
+ ...GUARDRAIL_ACTIONS,
306
+ ...OPERATIONS_ACTIONS,
307
+ ...FEEDBACK_ACTIONS,
308
+ ...ADMINISTRATION_ACTIONS,
309
+ ...WORKSPACE_ACTIONS,
310
+ ...PROJECT_ACTIONS
311
+ ];
109
312
  var APP_ERROR_STATUS_CODES = {
110
313
  BAD_REQUEST: 400,
111
314
  UNAUTHENTICATED: 401,
@@ -151,14 +354,37 @@ var CONNECTION_HEALTH_STATES = [
151
354
  "needs_configuration",
152
355
  "secret_unreadable"
153
356
  ];
357
+ var ASSET_OWNER_RUNGS = ["personal", "team", "everyone"];
358
+ var ASSET_MOVE_PATHS = ["direct", "request"];
359
+ var ASSET_MOVE_STATUSES = ["moved", "requested"];
360
+ var ASSET_MOVE_EDITORS = ["workspace_builders", "instance_builders"];
361
+ var ASSET_MOVE_USERS = ["workspace_members", "everyone_where_offered"];
154
362
  var GRANT_HOLDER_KINDS = ["user", "service_principal", "role", "group"];
155
- var GRANT_SCOPE_KINDS = ["instance", "workspace", "namespace", "asset"];
363
+ var GRANT_SCOPE_KINDS = ["instance", "workspace", "asset"];
364
+ var ROLE_GRANT_SCOPE_KINDS = [
365
+ "instance",
366
+ "workspace",
367
+ "asset"
368
+ ];
369
+ var ROLE_PENDING_CHANGES = ["added", "removed"];
370
+ var ROLE_PENDING_DECISIONS = ["apply", "dismiss"];
156
371
  var GRANT_EFFECTS = ["allow", "deny"];
157
372
  var ACCESS_SOURCES = ["role", "legacy_ref", "grant", "membership"];
158
373
  var POLICY_VALUES = ["allow", "confirm", "approval", "deny"];
159
374
  var AUTH_PRINCIPAL_KINDS = ["user", "service"];
160
375
  var ADMINISTERED_USER_STATUSES = ["active", "disabled", "deleting"];
161
376
  var SERVICE_PRINCIPAL_STATUSES = ["active", "disabled"];
377
+ var WORKFLOW_RIGHT_NEEDED_FOR = ["publish", "run"];
378
+ var WORKFLOW_RIGHTS_REVISIONS = ["draft", "published"];
379
+ var WORKFLOW_RUN_ACCOUNT_STATUSES = [...SERVICE_PRINCIPAL_STATUSES, "unknown"];
380
+ var WORKFLOW_RIGHT_REFUSALS = [
381
+ "not_grantable",
382
+ "not_administrator",
383
+ "not_held",
384
+ "account_unavailable",
385
+ "asset_unavailable",
386
+ "not_visible"
387
+ ];
162
388
  var SERVICE_PRINCIPAL_PERMISSIONS = [
163
389
  "config_assets.read",
164
390
  "config_assets.release"
@@ -188,7 +414,11 @@ var APP_ERROR_CODES = [
188
414
  "INTERNAL"
189
415
  ];
190
416
  var OPERATION_EFFECTS = ["reading", "changing"];
417
+ var CATALOGUE_PARTS = ["tools", "source"];
418
+ var CATALOGUE_CATEGORIES = ["mail", "files", "accounting", "databases", "other"];
191
419
  var OPERATION_TARGETS = ["live", "test", "dry_run"];
420
+ var DRAFT_TEST_TARGETS = ["present", "made_on_change"];
421
+ var PUBLISH_CHANGE_KINDS = ["new", "changed"];
192
422
  var OPERATION_RUN_STATUSES = [
193
423
  "running",
194
424
  "pending_confirmation",
@@ -250,6 +480,7 @@ var APPROVAL_EXECUTIONS = [
250
480
  ];
251
481
  var SKILL_CHANGE_TYPES = ["replace", "add", "new_resource"];
252
482
  var GUARDRAIL_OUTCOMES = ["allow", "warn", "require_approval", "block"];
483
+ var GUARDRAIL_CHECK_KINDS = ["pattern", "model_judge"];
253
484
  var APP_MODES = ["published", "draft"];
254
485
  var ASSET_NAME_REFUSAL_REASONS = ["name_invalid", "name_taken"];
255
486
  var ASSET_SYNC_CHANGE_TYPES = ["put", "delete"];
@@ -258,6 +489,7 @@ var ASSET_REPRESENTATIONS = ["config", "files"];
258
489
  var CONFIG_ASSET_KINDS = ["agent", "skill"];
259
490
  var CONFIG_ASSET_CHANGE_OPERATIONS = ["create", "update", "delete", "revert"];
260
491
  var AGENT_AVAILABILITY_MODES = ["all", "selected"];
492
+ var AGENT_USE_SETTINGS = ["everyone", "granted"];
261
493
  var AGENT_EDITABLE_FIELDS = [
262
494
  "displayName",
263
495
  "description",
@@ -298,6 +530,14 @@ var WORKSPACE_ACCENT_COLORS = [
298
530
  ];
299
531
  var COLLABORATION_WORKSPACE_KINDS = ["personal", "shared"];
300
532
  var WORKSPACE_ACCESS_STATES = ["member", "request_pending", "can_request"];
533
+ var WORKSPACE_BUNDLES = ["builder", "publisher"];
534
+ var MEMBER_BUNDLE_STATES = ["none", "requested", "held", "inherited"];
535
+ var MEMBER_BUNDLE_CHANGES = ["grant", "request", "revoke", "withdraw"];
536
+ var GRANT_REQUEST_STALE_REASONS = [
537
+ "member_left",
538
+ "member_inactive",
539
+ "already_held"
540
+ ];
301
541
  var DELETION_STATES = ["deleting", "deleted"];
302
542
  var WORKSPACE_SECTIONS = ["agents", "apps"];
303
543
  var MODEL_USAGE_TIERS = [
@@ -324,6 +564,7 @@ var OPENAI_COMPATIBLE_APIS = ["chat_completions", "responses"];
324
564
  var MODEL_PROVIDER_AUTH_MODES = ["bearer", "api-key"];
325
565
  var CONVERSATION_VISIBILITIES = ["workspace", "private"];
326
566
  var CONVERSATION_KINDS = ["chat", "run_thread"];
567
+ var CONVERSATION_TITLE_MAX_CHARS = 120;
327
568
  var WEB_SOURCE_PROVIDERS = [
328
569
  "openai-native",
329
570
  "serper",
@@ -343,8 +584,8 @@ var CONVERSATION_ATTACHMENT_STATUSES = [
343
584
  ];
344
585
  var ATTACHMENT_CREATE_OUTCOMES = ["created", "already_available"];
345
586
  var STRUCTURED_DATA_REVIEW_REASONS = ["uncertain", "conflicting"];
346
- var FOLLOW_UP_MODES = ["queue"];
347
- var FOLLOW_UP_STATUSES = ["pending", "dispatched", "cancelled"];
587
+ var FOLLOW_UP_MODES = ["queue", "steer"];
588
+ var FOLLOW_UP_STATUSES = ["pending", "dispatched", "consumed", "cancelled"];
348
589
  var AGENT_RUN_STATUSES = [
349
590
  "queued",
350
591
  "running",
@@ -368,6 +609,8 @@ var WAITING_OPERATION_RUN_STATUSES = [
368
609
  "pending_approval"
369
610
  ];
370
611
  var OPERATION_CONFIRMATION_DECISIONS = ["confirm", "decline"];
612
+ var PERSON_POLICY_SETTINGS = ["always_allow", "ask", "never"];
613
+ var OPERATION_CHANGE_CLASSES = ["reversible", "irreversible", "outward"];
371
614
  var TOOL_DECISION_MODES = ["confirm", "approval"];
372
615
  var TOOL_DECISION_OUTCOMES = ["confirmed", "declined", "expired", "cancelled"];
373
616
  var TOOL_CALL_STATES = [
@@ -418,6 +661,7 @@ var CONNECTION_OPERATION_STATUSES = [
418
661
  "disabled"
419
662
  ];
420
663
  var CONNECTION_SECRET_STATES = ["set", "not_set", "unreadable"];
664
+ var CONNECTION_TEST_CREDENTIAL_STATES = ["not_set", "set", "stale"];
421
665
  var CONNECTOR_TEST_STATUSES = [
422
666
  "ready",
423
667
  "unauthorized",
@@ -426,8 +670,16 @@ var CONNECTOR_TEST_STATUSES = [
426
670
  /** The server asks for an OAuth sign-in, or the Connection signs in and nobody has. */
427
671
  "oauth_required"
428
672
  ];
673
+ var CONNECTION_CREDENTIAL_MODES = ["shared", "user"];
429
674
  var CONNECTION_BINDING_STATES = ["connected", "needs_reconnect", "revoked"];
430
- var CONNECTION_OAUTH_REGISTRATIONS = ["dcr", "preregistered"];
675
+ var CONNECTION_PROPOSAL_STATES = ["ready", "needs_setup"];
676
+ var CONNECTION_PROPOSAL_BINDING_STATES = [
677
+ "connected",
678
+ "needs_reconnect",
679
+ "not_connected"
680
+ ];
681
+ var CONNECTION_SIGN_IN_NEEDS = ["not_connected", "needs_reconnect"];
682
+ var CONNECTION_OAUTH_REGISTRATIONS = ["dcr", "preregistered", "managed"];
431
683
  var CONNECTION_PROVIDER_REVOCATIONS = ["confirmed", "failed", "not_offered"];
432
684
  var CONNECTION_ORIGINS = ["release", "runtime"];
433
685
  var CONNECTION_NETWORKS = ["public", "private"];
@@ -452,11 +704,19 @@ var DATA_STORE_CONDITIONS = [
452
704
  var DATA_STORE_STATUSES = ["provisioning", "ready", "retired"];
453
705
  var DATA_STORE_MIGRATION_OUTCOMES = ["none", "pending", "applied", "failed"];
454
706
  var KNOWLEDGE_BASE_STATUSES = ["unchecked", "preparing", "ok", "needs_attention"];
707
+ var KNOWLEDGE_EMBEDDING_STATES = [
708
+ "current",
709
+ "reindex_needed",
710
+ "reindex_available",
711
+ "reindexing",
712
+ "none"
713
+ ];
455
714
  var KNOWLEDGE_DOCUMENT_STATES = ["pending", "indexed", "failed"];
715
+ var KNOWLEDGE_FILE_MAX_BYTES = 25 * 1024 * 1024;
456
716
  var KNOWLEDGE_DOCUMENT_FAILURE_CODES = [
457
717
  // The extractor does not read the file's format.
458
718
  "knowledge_file_format_unsupported",
459
- // The file is over a limit of the extraction: size, pages or time.
719
+ // The file is over a limit of the extraction: its size or the size of its text.
460
720
  "knowledge_file_over_limit",
461
721
  // The file is corrupt, encrypted, or not the format it claims.
462
722
  "knowledge_file_unreadable",
@@ -471,7 +731,14 @@ var KNOWLEDGE_DOCUMENT_FAILURE_CODES = [
471
731
  // No text to search, such as a scanned PDF without a text layer.
472
732
  "knowledge_text_empty",
473
733
  // Indexing failed on every attempt.
474
- "knowledge_index_failed"
734
+ "knowledge_index_failed",
735
+ // A PDF or DOCX with more pages than `knowledge.maxPagesPerDocument`, counted before its text
736
+ // is read.
737
+ "knowledge_file_too_many_pages",
738
+ // A built-in or Workflow processor returned output outside its contract.
739
+ "knowledge_processor_output_invalid",
740
+ // Conversion exceeded its page-aware deadline.
741
+ "knowledge_conversion_timeout"
475
742
  ];
476
743
  var KNOWLEDGE_DOCUMENT_WAIT_CODES = [
477
744
  // A usage limit of the instance or the workspace refuses the embedding calls. Indexing goes
@@ -486,7 +753,13 @@ var KNOWLEDGE_SOURCE_FAILURE_CODES = [
486
753
  // A fetch failed on every attempt.
487
754
  "knowledge_fetch_failed",
488
755
  // The Knowledge Base holds its document limit; the listing stopped discovering there.
489
- "knowledge_source_limit_reached"
756
+ "knowledge_source_limit_reached",
757
+ "knowledge_item_invalid",
758
+ "knowledge_fetch_not_allowed",
759
+ // The Workflow run that called `ingest` ended before the pass did; what it wrote stays.
760
+ "knowledge_ingest_cancelled",
761
+ // A person removed the item by hand: no pass puts it back until a publisher lifts the hold.
762
+ "knowledge_item_removed"
490
763
  ];
491
764
  var KNOWLEDGE_SOURCE_ITEM_FAILURE_CODES = [
492
765
  ...KNOWLEDGE_SOURCE_FAILURE_CODES,
@@ -499,8 +772,8 @@ var KNOWLEDGE_SOURCE_ITEM_STATES = [
499
772
  "failed",
500
773
  "withdrawn"
501
774
  ];
502
- var KNOWLEDGE_SYNC_MODES = ["initial", "changes", "full"];
503
- var KNOWLEDGE_SYNC_RUN_STATES = ["running", "done", "failed"];
775
+ var KNOWLEDGE_SYNC_MODES = ["initial", "changes", "full", "ingest"];
776
+ var KNOWLEDGE_SYNC_RUN_STATES = ["running", "done", "failed", "superseded"];
504
777
  var KNOWLEDGE_SYNC_COUNTS = [
505
778
  "discovered",
506
779
  "added",
@@ -518,6 +791,7 @@ var DATABASE_RELATION_TYPES = [
518
791
  "foreign_table"
519
792
  ];
520
793
  var WORKFLOW_RUN_STATUSES = [
794
+ "continued",
521
795
  "queued",
522
796
  "running",
523
797
  "waiting",
@@ -535,15 +809,48 @@ var WORKFLOW_STEP_TYPES = [
535
809
  "agent",
536
810
  "notify",
537
811
  /** Starts another Workflow as a child run and waits for it. */
538
- "workflow"
539
- ];
540
- var WORKFLOW_RESERVED_STEP_TYPES = [
541
- /** Reserved in the contract: drawn, and run by no engine yet. */
812
+ "workflow",
542
813
  "condition",
543
814
  "parallel"
544
815
  ];
545
- var WORKFLOW_TRIGGER_KINDS = ["manual", "schedule", "parent"];
816
+ var WORKFLOW_EXECUTED_STEP_TYPES = [...WORKFLOW_STEP_TYPES];
817
+ var WORKFLOW_RESERVED_STEP_TYPES = [];
818
+ var WORKFLOW_WEBHOOK_LIMITS = {
819
+ maxBodyBytes: 256 * 1024,
820
+ toleranceMs: 5 * 6e4,
821
+ perMinute: 60,
822
+ perMinuteMax: 600,
823
+ nonceMaxLength: 200
824
+ };
825
+ var WORKFLOW_WEBHOOK_HEADERS = {
826
+ timestamp: "catalyst-webhook-timestamp",
827
+ nonce: "catalyst-webhook-nonce",
828
+ signature: "catalyst-webhook-signature"
829
+ };
830
+ var WORKFLOW_TRIGGER_KINDS = [
831
+ "manual",
832
+ "schedule",
833
+ "parent",
834
+ "outside",
835
+ "webhook",
836
+ "platform_event"
837
+ ];
546
838
  var NOTIFY_CHANNELS = ["inbox", "mail"];
839
+ var WORKFLOW_STEP_SOURCE_KINDS = [
840
+ "connection",
841
+ "data_store",
842
+ "knowledge_base",
843
+ "workflow",
844
+ "mail_sender",
845
+ "other"
846
+ ];
847
+ var OPERATION_SOURCE_KINDS = [
848
+ "connection",
849
+ "data_store",
850
+ "knowledge_base",
851
+ "workflow",
852
+ "other"
853
+ ];
547
854
  var PRINCIPAL_HOLDER_KINDS = [
548
855
  "user",
549
856
  "service_principal"
@@ -553,11 +860,13 @@ var ASSET_OWNER_KINDS = [
553
860
  "workspace"
554
861
  ];
555
862
  var READING_POLICY_VALUES = ["allow", "deny"];
863
+ var ALWAYS_ALLOW_LOCK_SOURCES = ["release", "instance"];
556
864
  var CONNECTION_OPERATION_POLICIES = [
557
865
  "deny",
558
866
  "approval"
559
867
  ];
560
868
  var WORKFLOW_RUN_MODES = ["live", "test"];
869
+ var WORKFLOW_TEST_REVISIONS = ["draft", "published"];
561
870
  var APP_ACTION_CALL_STATUSES = [
562
871
  "done",
563
872
  "pending_approval"
@@ -600,6 +909,7 @@ var MESSAGE_FINISH_STATUSES = [
600
909
  "completed",
601
910
  "cancelled"
602
911
  ];
912
+ var MODEL_FALLBACK_REASONS = ["rate_limit", "unavailable"];
603
913
  var ENDED_AGENT_RUN_STATUSES = [
604
914
  "completed",
605
915
  "cancelled",
@@ -642,11 +952,68 @@ var WORKFLOW_STEP_RUN_STATUSES = [
642
952
  "cancelled"
643
953
  ];
644
954
  var WORKFLOW_ENDED_STATUSES = [
955
+ "continued",
645
956
  "done",
646
957
  "failed",
647
958
  "cancelled",
648
959
  "limit_reached"
649
960
  ];
961
+ var MANAGED_FILE_STATUSES = ["available", "released", "deleted"];
962
+ var WORKFLOW_KINDS = ["process", "data"];
963
+ var WORKFLOW_DATASET_DOWNLOAD_FORMATS = ["jsonl", "csv"];
964
+ var WORKSPACE_USE_ASSET_KINDS = ["knowledge_base", "connection"];
965
+ var PUBLISHED_DATA_CONSUMER_KINDS = ["app", "workflow", "knowledge_base"];
966
+ var SCHEDULED_START_STATES = ["active", "paused"];
967
+ var AGENT_PREVIEW_SOURCES = ["draft", "live"];
968
+ var PREVIEW_CAPTURE_SIZES = ["phone", "tablet", "desktop"];
969
+ var PREVIEW_CAPTURE_STATUSES = ["pending", "answering", "captured", "refused"];
970
+ var SERVER_PREVIEW_CAPTURE_REFUSALS = ["capture_busy", "capture_failed"];
971
+ var WORKFLOW_CAPABILITY_UNITS = [
972
+ "bytes",
973
+ "count",
974
+ "seconds",
975
+ "minutes",
976
+ "cpus",
977
+ "duration"
978
+ ];
979
+ var WORKFLOW_CODE_STEP_AVAILABILITY = ["available", "no_sandbox"];
980
+ var WORKFLOW_PACKAGE_MANIFEST_STATES = ["available", "missing", "invalid"];
981
+
982
+ // src/interface-paths.ts
983
+ function appInterfacePath(input) {
984
+ const area = input.mode === "draft" ? "app-drafts" : "apps";
985
+ return `/w/${encodeURIComponent(input.workspaceId)}/${area}/${encodeURIComponent(input.app)}`;
986
+ }
987
+ var STUDIO_KIND_PATHS = {
988
+ agent: "agents",
989
+ skill: "skills",
990
+ connection: "connections",
991
+ data_store: "data-stores",
992
+ knowledge_base: "knowledge-bases",
993
+ guardrail: "guardrails"
994
+ };
995
+ function assetPagePath(asset) {
996
+ const name2 = encodeURIComponent(asset.name);
997
+ if (Object.hasOwn(STUDIO_KIND_PATHS, asset.kind)) {
998
+ return `/build/${STUDIO_KIND_PATHS[asset.kind]}/${name2}`;
999
+ }
1000
+ if (asset.workspaceId === void 0) return void 0;
1001
+ if (asset.kind === "workflow") {
1002
+ return `/w/${encodeURIComponent(asset.workspaceId)}/workflows/${name2}`;
1003
+ }
1004
+ return asset.kind === "app" ? appInterfacePath({ workspaceId: asset.workspaceId, app: asset.name, mode: "draft" }) : void 0;
1005
+ }
1006
+ function conversationInterfacePath(input) {
1007
+ return `/w/${encodeURIComponent(input.workspaceId)}/c/${encodeURIComponent(input.conversationId)}`;
1008
+ }
1009
+ function inboxItemPath(itemId) {
1010
+ return `/inbox/${encodeURIComponent(itemId)}`;
1011
+ }
1012
+
1013
+ // src/is-record.ts
1014
+ function isRecord(value) {
1015
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1016
+ }
650
1017
 
651
1018
  // src/schemas.ts
652
1019
  import { z } from "zod";
@@ -672,6 +1039,7 @@ function yamlValueIssueSentence(issue, maxDepth) {
672
1039
  }
673
1040
 
674
1041
  // src/schemas.ts
1042
+ var providerRegionSchema = z.string().trim().min(1).max(32);
675
1043
  var localizedStringMapSchema = z.object({
676
1044
  en: z.string().min(1).optional(),
677
1045
  de: z.string().min(1).optional()
@@ -806,12 +1174,12 @@ var skillConfigObjectSchema = z.object({
806
1174
  icon: z.string().min(1).optional()
807
1175
  });
808
1176
  var skillConfigSchema = skillConfigObjectSchema.superRefine((skill, context) => {
809
- for (const key of SKILL_FRONTMATTER_FIELDS) {
810
- if (skill.frontmatter && Object.hasOwn(skill.frontmatter, key)) {
1177
+ for (const key2 of SKILL_FRONTMATTER_FIELDS) {
1178
+ if (skill.frontmatter && Object.hasOwn(skill.frontmatter, key2)) {
811
1179
  context.addIssue({
812
1180
  code: "custom",
813
- path: ["frontmatter", key],
814
- message: `Skill frontmatter cannot hold '${key}': it is a field of the skill itself`
1181
+ path: ["frontmatter", key2],
1182
+ message: `Skill frontmatter cannot hold '${key2}': it is a field of the skill itself`
815
1183
  });
816
1184
  }
817
1185
  }
@@ -844,7 +1212,7 @@ var welcomeSubtitleSchema = z.union([
844
1212
  message: "At least one localized value is required"
845
1213
  })
846
1214
  ]);
847
- var agentNameSchema = z.string().min(1).refine((name) => name !== "." && name !== "..", {
1215
+ var agentNameSchema = z.string().min(1).refine((name2) => name2 !== "." && name2 !== "..", {
848
1216
  message: "Agent name must not be '.' or '..'"
849
1217
  });
850
1218
  var agentConfigSchema = z.object({
@@ -854,10 +1222,16 @@ var agentConfigSchema = z.object({
854
1222
  welcomeMessage: localizedStringSchema.optional(),
855
1223
  welcomeSubtitle: welcomeSubtitleSchema.optional(),
856
1224
  instructions: z.string().min(1),
1225
+ /**
1226
+ * What the instance adds after the instructions of an agent that ships with the platform. A
1227
+ * release never ships or changes it, so the instructions keep taking each release's text.
1228
+ */
1229
+ additionalInstructions: z.string().optional(),
857
1230
  modelProviderId: z.string().min(1).optional(),
858
1231
  modelBindingId: z.string().min(1).optional(),
859
1232
  reasoningEffort: z.enum(REASONING_EFFORTS).optional(),
860
1233
  fastMode: z.boolean().optional(),
1234
+ useModelFallback: z.boolean().optional(),
861
1235
  userSelectableModelBindingIds: z.array(z.string().min(1)).optional(),
862
1236
  modelReasoningEfforts: z.record(z.string().min(1), z.enum(REASONING_EFFORTS)).optional(),
863
1237
  maxSteps: z.number().int().positive().optional(),
@@ -878,7 +1252,19 @@ var agentConfigSchema = z.object({
878
1252
  title: localizedStringSchema,
879
1253
  prompt: localizedStringSchema
880
1254
  })
881
- ).default([])
1255
+ ).default([]),
1256
+ /**
1257
+ * An agent that ships with the platform, such as Workshaper: the fields as the release
1258
+ * shipped them last. Only the release seed writes it, and every other write keeps it as
1259
+ * stored. A field the instance left as shipped takes what the next release ships; one it
1260
+ * changed stays the instance's.
1261
+ */
1262
+ shipped: z.record(z.string(), z.unknown()).optional(),
1263
+ /**
1264
+ * The fields of `shipped` the instance changed and a release then shipped anew. The release
1265
+ * seed adds a field; a save may only take one out.
1266
+ */
1267
+ shippedNewer: z.array(z.string()).optional()
882
1268
  });
883
1269
  var WORKFLOW_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,62}$/u;
884
1270
  var WORKFLOW_NAME_RULE = "A Workflow id starts with a lowercase letter and holds lowercase letters, digits, '_' and '-', at most 63 characters";
@@ -892,14 +1278,39 @@ var workflowConfigSchema = z.strictObject({
892
1278
  files: z.array(z.strictObject({ path: z.string(), content: z.string() })).optional()
893
1279
  });
894
1280
 
1281
+ // src/secret-names.ts
1282
+ var SECRET_NAME_MAX_LENGTH = 64;
1283
+ var SECRET_NAME_SINGLE_WORD_MAX_LENGTH = 12;
1284
+ var SECRET_NAME_WORD = /^[A-Z0-9]{1,16}$/u;
1285
+ var SECRET_NAME_WORD_MAX_DIGITS = 2;
1286
+ var CREDENTIAL_SHAPE = /^(?:(?:AKIA|ASIA)[A-Z0-9]{16}$|GH[OPRSU]_[A-Z0-9]{20,}|AIZA[A-Z0-9_-]{30,}|XOX[A-Z]-|EYJ[A-Z0-9_-]{16,})/iu;
1287
+ var SECRET_NAME_EXPECTATION = "expected the name of an environment variable such as MODEL_API_KEY (upper-case words joined by underscores, at most 64 characters); the value given does not read as one and looks like a credential value";
1288
+ function isSecretName(value) {
1289
+ if (value.length > SECRET_NAME_MAX_LENGTH || CREDENTIAL_SHAPE.test(value)) {
1290
+ return false;
1291
+ }
1292
+ const words = value.split("_");
1293
+ if (words.length === 1 && value.length > SECRET_NAME_SINGLE_WORD_MAX_LENGTH) {
1294
+ return false;
1295
+ }
1296
+ return /^[A-Z]/u.test(value) && words.every(isSecretNameWord);
1297
+ }
1298
+ function isSecretNameWord(word) {
1299
+ if (!SECRET_NAME_WORD.test(word)) {
1300
+ return false;
1301
+ }
1302
+ const digits = word.replace(/[A-Z]/gu, "").length;
1303
+ return digits === word.length ? word.length <= 4 : digits <= SECRET_NAME_WORD_MAX_DIGITS;
1304
+ }
1305
+
895
1306
  // src/skill-markdown.ts
896
1307
  import yaml from "js-yaml";
897
1308
 
898
1309
  // src/yaml-data.ts
899
- import { JSON_SCHEMA, YAMLException, load } from "js-yaml";
1310
+ import { JSON_SCHEMA, YAMLException, dump, load } from "js-yaml";
900
1311
  var YAML_DATA_MAX_VALUES = 1e5;
901
- function isStorableText(text) {
902
- return !text.includes("\0") && !/\p{Surrogate}/u.test(text);
1312
+ function isStorableText(text2) {
1313
+ return !text2.includes("\0") && !/\p{Surrogate}/u.test(text2);
903
1314
  }
904
1315
  function checkStorableTexts(value, maxValues) {
905
1316
  const pending = [value];
@@ -911,15 +1322,15 @@ function checkStorableTexts(value, maxValues) {
911
1322
  } else if (Array.isArray(next)) {
912
1323
  for (const entry of next) pending.push(entry);
913
1324
  } else if (typeof next === "object" && next !== null) {
914
- for (const [key, entry] of Object.entries(next)) {
915
- if (!isStorableText(key)) return "unstorable";
1325
+ for (const [key2, entry] of Object.entries(next)) {
1326
+ if (!isStorableText(key2)) return "unstorable";
916
1327
  pending.push(entry);
917
1328
  }
918
1329
  }
919
1330
  }
920
1331
  return "storable";
921
1332
  }
922
- function readYamlData(text, file, options = {}) {
1333
+ function readYamlData(text2, file, options = {}) {
923
1334
  const fail = (code, message, line, column) => ({
924
1335
  ok: false,
925
1336
  issue: {
@@ -931,7 +1342,7 @@ function readYamlData(text, file, options = {}) {
931
1342
  });
932
1343
  let value;
933
1344
  try {
934
- value = load(text, { schema: JSON_SCHEMA, filename: file });
1345
+ value = load(text2, { schema: JSON_SCHEMA, filename: file });
935
1346
  } catch (error) {
936
1347
  if (error instanceof YAMLException) {
937
1348
  const markLine = error.mark?.line;
@@ -960,6 +1371,15 @@ function readYamlData(text, file, options = {}) {
960
1371
  }
961
1372
  return { ok: true, value };
962
1373
  }
1374
+ function writeYamlData(value) {
1375
+ return dump(value, {
1376
+ schema: JSON_SCHEMA,
1377
+ lineWidth: -1,
1378
+ noCompatMode: true,
1379
+ noRefs: true,
1380
+ sortKeys: false
1381
+ });
1382
+ }
963
1383
  var YamlDataError = class extends Error {
964
1384
  issue;
965
1385
  constructor(issue) {
@@ -968,8 +1388,8 @@ var YamlDataError = class extends Error {
968
1388
  this.issue = issue;
969
1389
  }
970
1390
  };
971
- function loadYamlData(text, file) {
972
- const read = readYamlData(text, file);
1391
+ function loadYamlData(text2, file) {
1392
+ const read = readYamlData(text2, file);
973
1393
  if (!read.ok) throw new YamlDataError(read.issue);
974
1394
  return read.value;
975
1395
  }
@@ -1006,7 +1426,7 @@ function parseSkillMarkdown(contents, skillFile, skillPath) {
1006
1426
  }
1007
1427
  const content = (match[2] ?? "").trim();
1008
1428
  const { name: named, title, description, summary, starters, ...others } = frontmatter.data;
1009
- const name = named ?? deriveSkillName(skillPath);
1429
+ const name2 = named ?? deriveSkillName(skillPath);
1010
1430
  const json = JSON.stringify(others);
1011
1431
  if (json.length > SKILL_FRONTMATTER_MAX_BYTES) {
1012
1432
  throw new SkillMarkdownError(
@@ -1017,8 +1437,8 @@ function parseSkillMarkdown(contents, skillFile, skillPath) {
1017
1437
  }
1018
1438
  const kept = JSON.parse(json);
1019
1439
  return {
1020
- name,
1021
- title: title ?? deriveSkillTitle(name, content),
1440
+ name: name2,
1441
+ title: title ?? deriveSkillTitle(name2, content),
1022
1442
  description,
1023
1443
  ...summary === void 0 ? {} : { summary },
1024
1444
  ...starters === void 0 ? {} : { starters },
@@ -1026,8 +1446,8 @@ function parseSkillMarkdown(contents, skillFile, skillPath) {
1026
1446
  ...Object.keys(others).length > 0 ? { frontmatter: kept } : {}
1027
1447
  };
1028
1448
  }
1029
- function loadFrontmatter(text, skillFile) {
1030
- const read = readYamlData(text, skillFile, { refuseAliases: true });
1449
+ function loadFrontmatter(text2, skillFile) {
1450
+ const read = readYamlData(text2, skillFile, { refuseAliases: true });
1031
1451
  if (read.ok) return read.value;
1032
1452
  const { issue } = read;
1033
1453
  if (issue.code === "yaml_alias") {
@@ -1054,7 +1474,7 @@ function loadFrontmatter(text, skillFile) {
1054
1474
  { issues: [{ message: issue.message, path: [], line, column }] }
1055
1475
  );
1056
1476
  }
1057
- function deriveSkillTitle(name, content) {
1477
+ function deriveSkillTitle(name2, content) {
1058
1478
  let fence;
1059
1479
  for (const line of content.split(/\r?\n/u)) {
1060
1480
  const marker = /^\s{0,3}(`{3,}|~{3,})/u.exec(line)?.[1];
@@ -1065,8 +1485,8 @@ function deriveSkillTitle(name, content) {
1065
1485
  const heading = fence === void 0 ? /^ {0,3}#{1,6}\s+(.+?)(?:\s+#+)?\s*$/u.exec(line) : null;
1066
1486
  if (heading?.[1]) return heading[1];
1067
1487
  }
1068
- const words = name.replace(/[-_]+/gu, " ").trim();
1069
- return words === "" ? name : words.charAt(0).toUpperCase() + words.slice(1);
1488
+ const words = name2.replace(/[-_]+/gu, " ").trim();
1489
+ return words === "" ? name2 : words.charAt(0).toUpperCase() + words.slice(1);
1070
1490
  }
1071
1491
  function formatSkillMarkdown(skill) {
1072
1492
  const content = skill.content.trim();
@@ -1111,6 +1531,1255 @@ function withoutExtension(filename) {
1111
1531
  const dot = filename.lastIndexOf(".");
1112
1532
  return dot > 0 ? filename.slice(0, dot) : filename;
1113
1533
  }
1534
+
1535
+ // src/knowledge-write.ts
1536
+ import { z as z3 } from "zod";
1537
+
1538
+ // src/operation-batch.ts
1539
+ import { z as z2 } from "zod";
1540
+ var workflowDatasetReferenceSchema = z2.strictObject({
1541
+ $dataset: z2.string().min(1),
1542
+ rowCount: z2.number().int().min(0),
1543
+ // A view keeps the parent byte count as an upper bound.
1544
+ bytes: z2.number().int().min(0),
1545
+ /** Absolute offset in the parent; rowCount bounds the view. No rows are copied. */
1546
+ offset: z2.number().int().nonnegative().optional()
1547
+ });
1548
+ var workflowFileReferenceSchema = z2.strictObject({
1549
+ $file: z2.string().min(1),
1550
+ name: z2.string().min(1).max(200),
1551
+ mimeType: z2.string().min(1).max(200),
1552
+ bytes: z2.number().int().positive()
1553
+ });
1554
+ var operationBatchFailureSchema = z2.strictObject({
1555
+ item: z2.json(),
1556
+ code: z2.string().min(1),
1557
+ message: z2.string().min(1)
1558
+ });
1559
+ var operationBatchResultSchema = z2.strictObject({
1560
+ done: z2.number().int().min(0),
1561
+ failed: z2.number().int().min(0),
1562
+ failures: workflowDatasetReferenceSchema
1563
+ });
1564
+
1565
+ // src/knowledge-write.ts
1566
+ var id = z3.string().min(1).max(200);
1567
+ var count = z3.number().int().min(0);
1568
+ var hash = z3.string().regex(/^[a-f0-9]{64}$/u);
1569
+ var text = z3.string().max(KNOWLEDGE_FILE_MAX_BYTES).refine((value) => new TextEncoder().encode(value).byteLength <= KNOWLEDGE_FILE_MAX_BYTES, {
1570
+ message: `Document text exceeds ${KNOWLEDGE_FILE_MAX_BYTES} bytes`
1571
+ });
1572
+ var KNOWLEDGE_ORIGIN_LINK_MAX_CHARS = 4e3;
1573
+ var KNOWLEDGE_ORIGIN_LINK_CHANGES = ["set", "cleared"];
1574
+ var CREDENTIAL_PARAMETERS = /* @__PURE__ */ new Set([
1575
+ "access_token",
1576
+ "id_token",
1577
+ "refresh_token",
1578
+ "token",
1579
+ "auth",
1580
+ "authorization",
1581
+ "apikey",
1582
+ "api_key",
1583
+ "password",
1584
+ "secret",
1585
+ "client_secret",
1586
+ "sig",
1587
+ "signature",
1588
+ "x-amz-signature",
1589
+ "x-amz-credential",
1590
+ "x-amz-security-token",
1591
+ "x-goog-signature",
1592
+ "x-goog-credential"
1593
+ ]);
1594
+ function carriesCredential(link) {
1595
+ let url;
1596
+ try {
1597
+ url = new URL(link);
1598
+ } catch {
1599
+ return false;
1600
+ }
1601
+ if (url.username !== "" || url.password !== "") return true;
1602
+ const fragment = url.hash.startsWith("#") ? url.hash.slice(1) : url.hash;
1603
+ return [url.searchParams, new URLSearchParams(fragment)].some(
1604
+ (parameters) => [...parameters.keys()].some((key2) => CREDENTIAL_PARAMETERS.has(key2.toLowerCase()))
1605
+ );
1606
+ }
1607
+ var knowledgeOriginLinkSchema = z3.url({ protocol: /^https?$/u, error: "An origin link is an http or https address" }).max(KNOWLEDGE_ORIGIN_LINK_MAX_CHARS).refine((link) => !carriesCredential(link), {
1608
+ error: "An origin link names where the original is and carries no sign-in: leave out a user, a password and any token or signature parameter"
1609
+ });
1610
+ var knowledgeIngestFetchSchema = z3.strictObject({
1611
+ connection: id,
1612
+ operation: id,
1613
+ input: z3.record(z3.string(), z3.json())
1614
+ });
1615
+ var ingestItemIdentity = z3.strictObject({
1616
+ itemId: id,
1617
+ version: id,
1618
+ name: z3.string().min(1).max(1e3),
1619
+ path: z3.string().startsWith("/").max(4e3).optional(),
1620
+ originLink: knowledgeOriginLinkSchema.optional(),
1621
+ metadata: z3.record(z3.string(), z3.json()).optional(),
1622
+ text: z3.never().optional(),
1623
+ fileId: z3.never().optional(),
1624
+ fetch: z3.never().optional()
1625
+ });
1626
+ var knowledgeIngestItemSchema = z3.union(
1627
+ [
1628
+ ingestItemIdentity.extend({ text }),
1629
+ ingestItemIdentity.extend({ fileId: id }),
1630
+ ingestItemIdentity.extend({ fetch: knowledgeIngestFetchSchema })
1631
+ ],
1632
+ { error: "knowledge_item_invalid: Supply exactly one of text, fileId or fetch" }
1633
+ ).superRefine((item, context) => {
1634
+ if (item.fetch !== void 0)
1635
+ context.addIssue({
1636
+ code: "custom",
1637
+ path: ["fetch"],
1638
+ message: "not_supported_yet: fetch arrives with CONN-DL; supply text or fileId"
1639
+ });
1640
+ });
1641
+ var knowledgeIngestInputSchema = z3.union([
1642
+ z3.strictObject({ items: z3.array(knowledgeIngestItemSchema), complete: z3.boolean().optional() }),
1643
+ z3.strictObject({ dataset: workflowDatasetReferenceSchema, complete: z3.boolean().optional() })
1644
+ ]);
1645
+ var knowledgeIngestOutputSchema = operationBatchResultSchema.extend({
1646
+ accepted: count,
1647
+ withdrawn: count
1648
+ });
1649
+ var knowledgeWithdrawInputSchema = z3.strictObject({ itemIds: z3.array(id).min(1) });
1650
+ var knowledgeWithdrawOutputSchema = z3.strictObject({ withdrawn: count });
1651
+ var knowledgePendingInputSchema = z3.strictObject({
1652
+ type: id.optional(),
1653
+ since: z3.iso.datetime({ offset: true }).optional(),
1654
+ limit: z3.number().int().positive()
1655
+ });
1656
+ var knowledgePendingRowSchema = z3.strictObject({
1657
+ id,
1658
+ type: id,
1659
+ contentHash: hash,
1660
+ pages: workflowDatasetReferenceSchema
1661
+ });
1662
+ var knowledgePendingOutputSchema = z3.strictObject({
1663
+ documents: workflowDatasetReferenceSchema
1664
+ });
1665
+ var pageNumber = z3.number().int().positive();
1666
+ var range = z3.strictObject({ pageFrom: pageNumber, pageTo: pageNumber });
1667
+ var processorMetadataSchema = z3.strictObject({
1668
+ documents: z3.array(range).min(1),
1669
+ sections: z3.array(range.extend({ title: z3.string().min(1) })).optional(),
1670
+ fields: z3.record(z3.string(), z3.json())
1671
+ });
1672
+ var knowledgeProcessorOutputSchema = processorMetadataSchema.extend({
1673
+ // Count stays unbounded here: PROC-1/PROC-W must enforce the instance's
1674
+ // knowledge.maxPagesPerDocument at runtime (KB-ISO-3a), not a new contract cap.
1675
+ pages: z3.array(z3.strictObject({ page: pageNumber, text })).min(1)
1676
+ }).superRefine((output, context) => {
1677
+ const pages = new Set(output.pages.map((page) => page.page));
1678
+ if (output.pages.some(
1679
+ (page, index) => index > 0 && page.page <= (output.pages[index - 1]?.page ?? 0)
1680
+ )) {
1681
+ context.addIssue({
1682
+ code: "custom",
1683
+ path: ["pages"],
1684
+ message: "knowledge_processor_output_invalid: Pages must be ascending and unique"
1685
+ });
1686
+ }
1687
+ const bytes = output.pages.reduce(
1688
+ (size, page) => size + new TextEncoder().encode(page.text).byteLength,
1689
+ 0
1690
+ );
1691
+ if (bytes > KNOWLEDGE_FILE_MAX_BYTES)
1692
+ context.addIssue({
1693
+ code: "custom",
1694
+ path: ["pages"],
1695
+ message: "knowledge_processor_output_invalid: Document text exceeds the per-document limit"
1696
+ });
1697
+ for (const field of ["documents", "sections"]) {
1698
+ output[field]?.forEach((entry, index) => {
1699
+ if (entry.pageFrom > entry.pageTo || !pages.has(entry.pageFrom) || !pages.has(entry.pageTo)) {
1700
+ context.addIssue({
1701
+ code: "custom",
1702
+ path: [field, index],
1703
+ message: "knowledge_processor_output_invalid: Page range must be ordered and inside the document"
1704
+ });
1705
+ }
1706
+ });
1707
+ }
1708
+ });
1709
+ var knowledgePutProcessedInputSchema = z3.strictObject({
1710
+ items: z3.union([
1711
+ z3.array(
1712
+ z3.strictObject({
1713
+ documentId: id,
1714
+ contentHash: hash,
1715
+ workflowRevision: id,
1716
+ // Mirror pending: page text lives outside step values and item dataset rows.
1717
+ // PROC-W resolves the pages and validates the full processor output above.
1718
+ output: processorMetadataSchema.extend({ pages: workflowDatasetReferenceSchema })
1719
+ })
1720
+ ),
1721
+ workflowDatasetReferenceSchema
1722
+ ])
1723
+ });
1724
+ var knowledgeFieldValueSchema = z3.json();
1725
+ var knowledgeExtractFieldsInputSchema = z3.strictObject({
1726
+ documentId: id,
1727
+ schema: z3.record(z3.string(), knowledgeFieldValueSchema)
1728
+ });
1729
+ var knowledgeExtractFieldsOutputSchema = z3.strictObject({
1730
+ droppedFields: z3.number().int().nonnegative().optional(),
1731
+ failedFields: z3.number().int().nonnegative().optional(),
1732
+ path: z3.string(),
1733
+ date: z3.iso.date().nullable(),
1734
+ type: id,
1735
+ fields: z3.record(
1736
+ z3.string(),
1737
+ z3.strictObject({ value: knowledgeFieldValueSchema, page: pageNumber, quote: z3.string().min(1) })
1738
+ )
1739
+ });
1740
+ var knowledgeWorkflowSourceSchema = z3.strictObject({
1741
+ id: z3.string().startsWith("workflow:"),
1742
+ kind: z3.literal("workflow"),
1743
+ workflowId: z3.string().regex(/^[a-z][a-z0-9_-]{0,62}$/u)
1744
+ }).refine(
1745
+ (source) => source.id === `workflow:${source.workflowId}` || source.id.startsWith(`workflow:${source.workflowId}@`) && /^[1-9][0-9]{0,9}$/u.test(source.id.slice(`workflow:${source.workflowId}@`.length)),
1746
+ {
1747
+ path: ["id"],
1748
+ message: "A Workflow source id is workflow:<workflowId>@<the revision that created the Workflow>"
1749
+ }
1750
+ );
1751
+ var knowledgeWriteContracts = {
1752
+ ingest: {
1753
+ description: "Ingest items or a dataset into the calling data Workflow's source; complete promises a full pass, withdrawn only after the run succeeds.",
1754
+ inputSchema: knowledgeIngestInputSchema,
1755
+ outputSchema: knowledgeIngestOutputSchema,
1756
+ effect: "changing",
1757
+ right: "knowledge_base.ingest",
1758
+ keyLevel: "write",
1759
+ completion: "async",
1760
+ batch: true
1761
+ },
1762
+ withdraw: {
1763
+ description: "Withdraw item ids from the calling Workflow's source; removed from search immediately.",
1764
+ inputSchema: knowledgeWithdrawInputSchema,
1765
+ outputSchema: knowledgeWithdrawOutputSchema,
1766
+ effect: "changing",
1767
+ right: "knowledge_base.ingest",
1768
+ keyLevel: "write"
1769
+ },
1770
+ pending: {
1771
+ description: "Pull pending documents by type and time as a dataset; page text is another dataset reference.",
1772
+ inputSchema: knowledgePendingInputSchema,
1773
+ outputSchema: knowledgePendingOutputSchema,
1774
+ rowSchema: knowledgePendingRowSchema,
1775
+ effect: "reading",
1776
+ right: "knowledge_base.read",
1777
+ keyLevel: "read",
1778
+ dataset: true
1779
+ },
1780
+ put_processed: {
1781
+ description: "Write processor output by document, content hash and Workflow revision, with pages as a dataset reference like pending; the platform validates, chunks and indexes it, with per-item outcomes.",
1782
+ inputSchema: knowledgePutProcessedInputSchema,
1783
+ outputSchema: operationBatchResultSchema,
1784
+ effect: "changing",
1785
+ right: "knowledge_base.ingest",
1786
+ keyLevel: "write",
1787
+ batch: true
1788
+ },
1789
+ extract_fields: {
1790
+ description: "Extract fields by schema through the approved model binding within the Knowledge Base budget; each value carries page and quote evidence.",
1791
+ inputSchema: knowledgeExtractFieldsInputSchema,
1792
+ outputSchema: knowledgeExtractFieldsOutputSchema,
1793
+ effect: "reading",
1794
+ right: "knowledge_base.read",
1795
+ keyLevel: "read"
1796
+ }
1797
+ };
1798
+ var knowledgeRecordsRefusalSchema = z3.never({
1799
+ error: "'records' belongs in store.yaml. A data Workflow proposes fields into the Data Store's records mechanism."
1800
+ }).optional();
1801
+
1802
+ // src/knowledge-sources.ts
1803
+ import { z as z4 } from "zod";
1804
+ var sourceIdSchema = z4.union([
1805
+ z4.string().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u).max(63),
1806
+ // KBW-2c: a Workflow's source carries the revision that created the Workflow; one made
1807
+ // before that release carries none.
1808
+ knowledgeWorkflowSourceSchema.shape.id.regex(
1809
+ /^workflow:[a-z][a-z0-9_-]{0,62}(?:@[1-9][0-9]{0,9})?$/u
1810
+ )
1811
+ ]);
1812
+ var countSchema = z4.number().int().min(0);
1813
+ var countsSchema = z4.strictObject({
1814
+ discovered: countSchema,
1815
+ added: countSchema,
1816
+ changed: countSchema,
1817
+ moved: countSchema,
1818
+ withdrawn: countSchema,
1819
+ failed: countSchema,
1820
+ skipped: countSchema
1821
+ });
1822
+ var knowledgeSyncInputSchema = z4.strictObject({
1823
+ /** The `id` of the source in the definition. */
1824
+ source: sourceIdSchema,
1825
+ /** `changes` unless `full`. The initial import is started by publish, not by this call. */
1826
+ mode: z4.enum(["changes", "full"]).optional(),
1827
+ /**
1828
+ * Lets a first pass that waits for confirmation go on (KB-ISO-1b): a connector's first sync or
1829
+ * a Workflow's first `ingest` above 10,000 items. Needs `knowledge_base.publish`; audited with
1830
+ * the counts and the estimate.
1831
+ */
1832
+ confirm: z4.boolean().optional()
1833
+ });
1834
+ var knowledgeSyncResultSchema = z4.strictObject({
1835
+ syncRunId: z4.string(),
1836
+ source: z4.string(),
1837
+ mode: z4.enum(KNOWLEDGE_SYNC_MODES),
1838
+ /** Why a run is of another mode than asked, such as a cursor the source refused. */
1839
+ reason: z4.enum(["cursor_expired"]).optional(),
1840
+ state: z4.enum(KNOWLEDGE_SYNC_RUN_STATES),
1841
+ counts: countsSchema,
1842
+ bytesFetched: z4.number().int().min(0),
1843
+ /** Why the whole sync failed, for a run in state `failed`. */
1844
+ failureCode: z4.enum(KNOWLEDGE_SOURCE_FAILURE_CODES).optional(),
1845
+ startedAt: z4.string(),
1846
+ endedAt: z4.string().optional()
1847
+ });
1848
+ var KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES = [
1849
+ "discovered",
1850
+ "fetched",
1851
+ "indexed",
1852
+ "failed",
1853
+ "withdrawn"
1854
+ ];
1855
+ var itemFailureCodeSchema = z4.union([
1856
+ z4.enum(KNOWLEDGE_SOURCE_ITEM_FAILURE_CODES),
1857
+ z4.enum(KNOWLEDGE_DOCUMENT_FAILURE_CODES)
1858
+ ]);
1859
+ var rangeSchema = z4.strictObject({ min: z4.number().min(0), max: z4.number().min(0) });
1860
+ var knowledgeFirstPassConfirmationSchema = z4.strictObject({
1861
+ syncRunId: z4.string(),
1862
+ /** The items of the pass, listed or named, and their size in bytes. */
1863
+ items: countSchema,
1864
+ bytes: countSchema,
1865
+ /** How many it fetches and indexes before it waits. */
1866
+ stop: countSchema,
1867
+ /** Estimated from the listed sizes; absent where the Knowledge Base does not search by meaning. */
1868
+ tokens: rangeSchema.optional(),
1869
+ passages: rangeSchema.optional(),
1870
+ /** The embedding model it embeds with; absent where the Knowledge Base does not search by meaning. */
1871
+ model: z4.string().optional(),
1872
+ /** From the rate card; absent where nothing is embedded or the model has no price. */
1873
+ cost: rangeSchema.extend({ currency: z4.string() }).optional(),
1874
+ /**
1875
+ * Whether the store's size limit holds the high estimate of passages and vectors, and that
1876
+ * estimate; absent where nothing is embedded.
1877
+ */
1878
+ room: z4.boolean().optional(),
1879
+ storeBytes: countSchema,
1880
+ addedBytes: countSchema.optional(),
1881
+ limitBytes: countSchema.optional()
1882
+ });
1883
+ var sourceStatusSchema = z4.strictObject({
1884
+ id: z4.string(),
1885
+ /** The name of the Connection it reads through. */
1886
+ connection: z4.string(),
1887
+ kind: z4.literal("connector").optional(),
1888
+ /** Items by the state the page shows. */
1889
+ items: z4.strictObject({
1890
+ discovered: countSchema,
1891
+ fetched: countSchema,
1892
+ indexed: countSchema,
1893
+ failed: countSchema,
1894
+ withdrawn: countSchema
1895
+ }),
1896
+ /** Failed items per code. */
1897
+ failures: z4.array(z4.strictObject({ code: itemFailureCodeSchema, count: countSchema })),
1898
+ /** The sync that runs now, with its rate in items per minute and its estimated end. */
1899
+ running: z4.strictObject({
1900
+ syncRunId: z4.string(),
1901
+ mode: z4.enum(KNOWLEDGE_SYNC_MODES),
1902
+ startedAt: z4.string(),
1903
+ itemsPerMinute: z4.number().min(0).optional(),
1904
+ estimatedEndAt: z4.string().optional()
1905
+ }).optional(),
1906
+ /** The last sync that ended. */
1907
+ last: knowledgeSyncResultSchema.optional(),
1908
+ /** "Wartet auf Bestätigung": the running first pass stopped at 10,000 items. */
1909
+ confirmation: knowledgeFirstPassConfirmationSchema.optional(),
1910
+ /** "Letzte Änderung verarbeitet". */
1911
+ lastChangeAt: z4.string().optional(),
1912
+ /** "Älteste offene Änderung". */
1913
+ oldestOpenChangeAt: z4.string().optional()
1914
+ });
1915
+ var knowledgeSourcesOutputSchema = z4.strictObject({
1916
+ sources: z4.array(
1917
+ z4.union([
1918
+ sourceStatusSchema,
1919
+ knowledgeWorkflowSourceSchema.safeExtend(
1920
+ sourceStatusSchema.omit({ id: true, connection: true, kind: true }).shape
1921
+ )
1922
+ ])
1923
+ )
1924
+ });
1925
+ var knowledgeSourceItemsInputSchema = z4.strictObject({
1926
+ source: sourceIdSchema,
1927
+ state: z4.enum(KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES).optional(),
1928
+ failureCode: itemFailureCodeSchema.optional(),
1929
+ /** Items per page: 50 by default, at most 200. */
1930
+ limit: z4.coerce.number().int().min(1).max(200).optional(),
1931
+ cursor: z4.string().min(1).max(1e3).optional()
1932
+ });
1933
+ var knowledgeSourceItemsOutputSchema = z4.strictObject({
1934
+ /** Newest change first. */
1935
+ items: z4.array(
1936
+ z4.strictObject({
1937
+ /** The row in `source_items`: what `retry` and `locate` name. */
1938
+ id: z4.string(),
1939
+ /** The id of the item at the source. */
1940
+ itemId: z4.string(),
1941
+ name: z4.string(),
1942
+ path: z4.string(),
1943
+ state: z4.enum(KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES),
1944
+ failureCode: itemFailureCodeSchema.optional(),
1945
+ documentId: z4.string().optional(),
1946
+ originLink: z4.string().optional(),
1947
+ changedAt: z4.string()
1948
+ })
1949
+ ),
1950
+ nextCursor: z4.string().optional()
1951
+ });
1952
+ var RETRY_MAX = 100;
1953
+ var knowledgeRetryInputSchema = z4.union([
1954
+ z4.strictObject({ documentIds: z4.array(z4.string().min(1).max(200)).min(1).max(RETRY_MAX) }),
1955
+ z4.strictObject({
1956
+ source: sourceIdSchema,
1957
+ sourceItemIds: z4.array(z4.string().min(1).max(200)).min(1).max(RETRY_MAX)
1958
+ }),
1959
+ z4.strictObject({ source: sourceIdSchema, failureCode: itemFailureCodeSchema }),
1960
+ z4.strictObject({ source: sourceIdSchema, all: z4.literal(true) })
1961
+ ]);
1962
+ var knowledgeRetryOutputSchema = z4.strictObject({
1963
+ /** For a retry by document ids: each named document, with its state after the retry. */
1964
+ documents: z4.array(z4.strictObject({ id: z4.string(), state: z4.enum(KNOWLEDGE_DOCUMENT_STATES) })).optional(),
1965
+ /** How many contents or items were queued again. */
1966
+ queued: z4.number().int(),
1967
+ /**
1968
+ * For a Workflow-fed source: how many items removed by hand were allowed back. Its next pass
1969
+ * that names one takes it again (KBW-2b).
1970
+ */
1971
+ released: z4.number().int().optional()
1972
+ });
1973
+ var knowledgeLocateInputSchema = z4.strictObject({
1974
+ /** The row in `source_items`. */
1975
+ sourceItemId: z4.string().min(1).max(200)
1976
+ });
1977
+ var knowledgeLocateOutputSchema = z4.strictObject({
1978
+ sourceItemId: z4.string(),
1979
+ source: z4.string(),
1980
+ itemId: z4.string(),
1981
+ state: z4.enum(KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES),
1982
+ discoveredAt: z4.string(),
1983
+ fetchedAt: z4.string().optional(),
1984
+ withdrawnAt: z4.string().optional(),
1985
+ purgedAt: z4.string().optional(),
1986
+ /** A person removed it by hand; a pass leaves it out until a publisher lifts the hold. */
1987
+ removedAt: z4.string().optional()
1988
+ });
1989
+ var knowledgeWorkflowSourcesOutputSchema = z4.strictObject({
1990
+ knowledgeBases: z4.array(
1991
+ z4.strictObject({ name: z4.string(), title: z4.string(), documents: countSchema })
1992
+ ),
1993
+ hidden: z4.strictObject({ knowledgeBases: countSchema, documents: countSchema })
1994
+ });
1995
+
1996
+ // src/workflow-datasets.ts
1997
+ var WORKFLOW_DATASET_STATES = ["writing", "complete", "deleted"];
1998
+
1999
+ // src/operation-paging.ts
2000
+ import { z as z5 } from "zod";
2001
+ var operationPagingSchema = z5.discriminatedUnion("by", [
2002
+ z5.strictObject({
2003
+ by: z5.enum(["page", "offset"]),
2004
+ param: z5.string().min(1),
2005
+ sizeParam: z5.string().min(1),
2006
+ size: z5.number().int().min(1),
2007
+ start: z5.number().int().min(0).optional()
2008
+ }),
2009
+ z5.strictObject({
2010
+ by: z5.enum(["cursor", "next_link"]),
2011
+ param: z5.string().min(1),
2012
+ cursor: z5.string().min(1)
2013
+ })
2014
+ ]);
2015
+
2016
+ // src/workflow-data-flows.ts
2017
+ import { z as z6 } from "zod";
2018
+ var workflowDataFlowsSchema = z6.object({
2019
+ fills: z6.array(z6.object({ id: z6.string(), name: z6.string(), title: z6.string() })),
2020
+ processes: z6.array(z6.object({ id: z6.string(), name: z6.string(), title: z6.string() })),
2021
+ hidden: z6.object({ fills: z6.number().int().min(0), processes: z6.number().int().min(0) }),
2022
+ truncated: z6.boolean()
2023
+ });
2024
+
2025
+ // src/data-store-records.ts
2026
+ import { z as z7 } from "zod";
2027
+ var RECORDS_PROPOSE_MAX_ITEMS_PER_CALL = 1e3;
2028
+ var RECORDS_PROPOSE_MAX_FIELDS_PER_ITEM = 1e3;
2029
+ var RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE = 1e4;
2030
+ var name = z7.string().min(1);
2031
+ var id2 = z7.string().min(1).max(200);
2032
+ var key = z7.union([z7.string().min(1), z7.number(), z7.boolean()]);
2033
+ var dataStoreRecordsRuleSchema = z7.strictObject({
2034
+ table: name,
2035
+ key: z7.union([
2036
+ z7.strictObject({ column: name, fromPath: z7.string().startsWith("/").min(1) }),
2037
+ z7.strictObject({ column: name, fromField: name })
2038
+ ]),
2039
+ precedence: z7.array(name).default([]),
2040
+ review: z7.strictObject({ always: z7.array(name).default([]) }).prefault({}),
2041
+ retainWithoutSource: z7.boolean().default(false)
2042
+ }).superRefine((rule, context) => {
2043
+ if ("fromPath" in rule.key) {
2044
+ const placeholders = rule.key.fromPath.match(/\{[^{}]*\}/gu);
2045
+ if (placeholders?.length !== 1 || placeholders[0] !== `{${rule.key.column}}`) {
2046
+ context.addIssue({
2047
+ code: "custom",
2048
+ path: ["key", "fromPath"],
2049
+ message: "fromPath must contain exactly one placeholder naming the key column"
2050
+ });
2051
+ }
2052
+ }
2053
+ });
2054
+ var recordEvidenceResultSchema = z7.discriminatedUnion("status", [
2055
+ z7.strictObject({ status: z7.literal("passed") }),
2056
+ z7.strictObject({
2057
+ status: z7.literal("failed"),
2058
+ reason: z7.enum(["page_not_found", "quote_not_found", "value_not_parsed"])
2059
+ })
2060
+ ]);
2061
+ var RECORD_FIELD_STATES = ["extracted", "confirmed", "corrected", "conflict"];
2062
+ var RECORD_FLAG_REASONS = [
2063
+ "conflict",
2064
+ "not_evidenced",
2065
+ "confirmation_required",
2066
+ "key_unresolved"
2067
+ ];
2068
+ var RECORD_FIELD_FAILURE_CODES = ["record_field_unknown"];
2069
+ var fieldSchema = knowledgeExtractFieldsOutputSchema.shape.fields.valueType.extend({ name });
2070
+ var dataStoreRecordProposalItemSchema = z7.strictObject({
2071
+ // Document ids are scoped by their Knowledge Base. Both ids travel with every citation.
2072
+ knowledgeBaseId: id2,
2073
+ documentId: id2,
2074
+ kind: name,
2075
+ documentDate: z7.iso.date().nullable(),
2076
+ path: z7.string().startsWith("/").optional(),
2077
+ fields: z7.array(fieldSchema).min(1).max(
2078
+ RECORDS_PROPOSE_MAX_FIELDS_PER_ITEM,
2079
+ "At most 1000 fields per item (RECORDS_PROPOSE_MAX_FIELDS_PER_ITEM); split larger proposals into batches"
2080
+ )
2081
+ });
2082
+ var dataStoreRecordsProposeInputSchema = z7.strictObject({
2083
+ table: name,
2084
+ items: z7.array(dataStoreRecordProposalItemSchema).max(
2085
+ RECORDS_PROPOSE_MAX_ITEMS_PER_CALL,
2086
+ "At most 1000 items per call (RECORDS_PROPOSE_MAX_ITEMS_PER_CALL); send another batch"
2087
+ )
2088
+ });
2089
+ var decisionSchema = z7.strictObject({
2090
+ table: name,
2091
+ key,
2092
+ field: name,
2093
+ documentId: id2.optional(),
2094
+ knowledgeBaseId: id2.optional()
2095
+ });
2096
+ var dataStoreRecordsDecideInputSchema = z7.discriminatedUnion("action", [
2097
+ decisionSchema.extend({ action: z7.literal("confirm") }),
2098
+ decisionSchema.extend({ action: z7.literal("correct"), value: knowledgeFieldValueSchema }),
2099
+ decisionSchema.extend({ action: z7.literal("assign"), documentId: id2, knowledgeBaseId: id2 })
2100
+ ]).refine(
2101
+ (decision) => decision.documentId === void 0 === (decision.knowledgeBaseId === void 0),
2102
+ {
2103
+ path: ["documentId"],
2104
+ message: "A citation needs both knowledgeBaseId and documentId"
2105
+ }
2106
+ );
2107
+ var dataStoreRecordsDecideOutputSchema = z7.strictObject({ decided: z7.literal(true) });
2108
+ var dataStoreRecordsFlaggedInputSchema = z7.strictObject({
2109
+ table: name.optional(),
2110
+ cursor: z7.string().min(1).optional(),
2111
+ limit: z7.number().int().positive().max(
2112
+ RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE,
2113
+ "At most 10000 items per page (RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE); follow nextCursor"
2114
+ )
2115
+ });
2116
+ var dataStoreRecordFieldSchema = fieldSchema.extend({
2117
+ // `value` is what the document reads; a person's correction stands beside it, held exactly
2118
+ // while the state is `corrected` (REC-KEEP).
2119
+ correctedValue: knowledgeFieldValueSchema.nullable(),
2120
+ table: name,
2121
+ // Unresolved keys go to review, without writing a customer row.
2122
+ key: key.nullable(),
2123
+ knowledgeBaseId: id2,
2124
+ documentId: id2,
2125
+ kind: name,
2126
+ documentDate: z7.iso.date().nullable(),
2127
+ extractedAt: z7.iso.datetime({ offset: true }),
2128
+ evidence: recordEvidenceResultSchema,
2129
+ state: z7.enum(RECORD_FIELD_STATES),
2130
+ decidedBy: id2.nullable(),
2131
+ decidedAt: z7.iso.datetime({ offset: true }).nullable()
2132
+ });
2133
+ var dataStoreRecordsFlaggedOutputSchema = z7.strictObject({
2134
+ // A citation is shown only after checking access to its Knowledge Base, even for a
2135
+ // holder of data_store.records. Values/quotes never enter jobs, runs or audit metadata.
2136
+ items: z7.array(
2137
+ dataStoreRecordFieldSchema.extend({
2138
+ reason: z7.enum(RECORD_FLAG_REASONS),
2139
+ // REC-2: the cited document as its chip opens it, by the Knowledge Base's name. Absent
2140
+ // where the document is no longer there to open.
2141
+ document: z7.strictObject({ knowledgeBase: name, fileName: name }).optional(),
2142
+ // REC-KEEP: the person who decided, by the name the instance shows for them, read when
2143
+ // the list is. Absent where the account is gone or its deletion was requested.
2144
+ decidedByName: z7.string().min(1).optional()
2145
+ })
2146
+ ).max(RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE),
2147
+ nextCursor: z7.string().optional()
2148
+ });
2149
+ var scalarSchemas = {
2150
+ text: z7.string(),
2151
+ integer: z7.number().int(),
2152
+ number: z7.number(),
2153
+ boolean: z7.boolean(),
2154
+ date: z7.iso.date(),
2155
+ timestamp: z7.iso.datetime({ offset: true })
2156
+ };
2157
+ function recordColumnTakes(column, value) {
2158
+ return compatible(column, value);
2159
+ }
2160
+ function compatible(column, value) {
2161
+ if (column.generated || column.type === "other") return false;
2162
+ if (value === null) return column.nullable;
2163
+ for (const [type, schema] of Object.entries(scalarSchemas)) {
2164
+ if (column.type === type) return schema.safeParse(value).success;
2165
+ if (column.type === `${type}[]`) return z7.array(schema.nullable()).safeParse(value).success;
2166
+ }
2167
+ return false;
2168
+ }
2169
+ function proposalItemSchemaFor(columns) {
2170
+ const byName = new Map(columns.map((column) => [column.name, column]));
2171
+ return dataStoreRecordProposalItemSchema.superRefine((item, context) => {
2172
+ const seen = /* @__PURE__ */ new Set();
2173
+ item.fields.forEach((field, index) => {
2174
+ const column = byName.get(field.name);
2175
+ if (!column || !compatible(column, field.value) || seen.has(field.name)) {
2176
+ context.addIssue({
2177
+ code: "custom",
2178
+ path: ["fields", index],
2179
+ message: `record_field_unknown: Field '${field.name}' has no writable column of a compatible type, or occurs twice`
2180
+ });
2181
+ }
2182
+ seen.add(field.name);
2183
+ });
2184
+ });
2185
+ }
2186
+ var dataStoreRecordsContracts = {
2187
+ propose: {
2188
+ description: "Propose extracted fields with Knowledge Base/document/page/quote evidence. Validate each whole item against the published table before writing; failures are per item. Send at most 1000 items per call and 1000 fields per item; split larger work into batches. Merge by evidence precedence, then document date; unresolved keys and evidence go to review.",
2189
+ inputSchema: dataStoreRecordsProposeInputSchema,
2190
+ outputSchema: operationBatchResultSchema,
2191
+ itemSchemaFor: proposalItemSchemaFor,
2192
+ effect: "changing",
2193
+ right: "data_store.records",
2194
+ keyLevel: "write",
2195
+ batch: true
2196
+ },
2197
+ decide: {
2198
+ description: "Confirm or correct a field against its evidence, or assign a document to an object key. Decisions are pinned; audit table/field/action/actor only, never the value.",
2199
+ inputSchema: dataStoreRecordsDecideInputSchema,
2200
+ outputSchema: dataStoreRecordsDecideOutputSchema,
2201
+ effect: "changing",
2202
+ right: "data_store.records",
2203
+ keyLevel: "write"
2204
+ },
2205
+ flagged: {
2206
+ description: "Page through fields needing review, up to 10000 per call; pass nextCursor as cursor for the next page. Check Knowledge Base access before showing any document citation; the store right alone does not grant access to source documents.",
2207
+ inputSchema: dataStoreRecordsFlaggedInputSchema,
2208
+ outputSchema: dataStoreRecordsFlaggedOutputSchema,
2209
+ effect: "reading",
2210
+ right: "data_store.records",
2211
+ keyLevel: "read"
2212
+ }
2213
+ };
2214
+
2215
+ // src/usage-limits.ts
2216
+ var MODEL_USAGE_LIMIT_PERIODS = ["day", "month"];
2217
+ var MODEL_USAGE_LIMIT_METRICS = ["modelCallCount", "tokens", "costMicros"];
2218
+ var MODEL_USAGE_LIMIT_SCOPES = ["instance", "user", "system", "workspace"];
2219
+ var USAGE_SPEND_LIMIT_LEVELS = [
2220
+ "instance",
2221
+ "workspace_default",
2222
+ "workspace",
2223
+ "user_default",
2224
+ "user"
2225
+ ];
2226
+ var PERSONAL_WORKSPACES_KEY = "personal";
2227
+ var PERSONAL_AGENTS_KEY = ":personal";
2228
+ var USAGE_BREAKDOWN_DIMENSIONS = [
2229
+ "workspace",
2230
+ "agent",
2231
+ "app",
2232
+ "workflow",
2233
+ "model",
2234
+ "origin"
2235
+ ];
2236
+ var USAGE_ORIGINS = [
2237
+ "conversation",
2238
+ "app",
2239
+ "workflow",
2240
+ "knowledge_base",
2241
+ "system"
2242
+ ];
2243
+
2244
+ // src/workflow-text.ts
2245
+ var WORKFLOW_TEXT_FORMAT_MARKDOWN = "markdown";
2246
+ var WORKFLOW_TEXT_MAX_PARTS = 100;
2247
+ var WORKFLOW_MARKDOWN_MAX_ROWS = 100;
2248
+ var WORKFLOW_MARKDOWN_MAX_COLUMNS = 8;
2249
+
2250
+ // src/mail-send.ts
2251
+ import { z as z8 } from "zod";
2252
+ var MAIL_SEND_OPERATION = "mail.send";
2253
+ var MAIL_SENDER_RESOURCE_KIND = "mail_sender";
2254
+ var MAIL_SENDER_USE_ACTION = "mail_sender.use";
2255
+ var MAIL_SENDER_SYSTEM = "system";
2256
+ var MAIL_SENDER_CONNECTION_PREFIX = "connection.";
2257
+ var MAIL_SENDER_SYSTEM_ICON = "system-mail";
2258
+ var MAIL_WORKFLOW_MESSAGE_TEMPLATE = "workflow-message";
2259
+ var MAIL_SEND_MAX_ADDRESSES = 50;
2260
+ var MAIL_SUBJECT_MAX_LENGTH = 200;
2261
+ var MAIL_BODY_MAX_BYTES = 64 * 1024;
2262
+ var MAIL_SENDER_NAME_MAX_LENGTH = 80;
2263
+ var MAIL_ADDRESS_MAX_LENGTH = 254;
2264
+ var MAIL_OUTBOUND_DEFAULT_LIMITS = {
2265
+ perWorkflowPerHour: 200,
2266
+ perInstancePerDay: 1e3
2267
+ };
2268
+ var MAIL_OUTBOUND_FOOTER_MAX_LENGTH = 2e3;
2269
+ var MAIL_AUDIT_MAX_DOMAINS = 10;
2270
+ var MAIL_ATTACHMENTS_MAX_FILES = 10;
2271
+ var MAIL_ATTACHMENTS_MAX_BYTES = 10 * 1024 * 1024;
2272
+ var MAIL_SEND_ERROR_CODES = {
2273
+ recipientNotAllowed: "recipient_not_allowed",
2274
+ noRecipient: "no_recipient",
2275
+ mailRejected: "mail_rejected",
2276
+ workspaceNotAllowed: "workspace_not_allowed"
2277
+ };
2278
+ var MAIL_SEND_REFUSAL_REASONS = [
2279
+ MAIL_SEND_ERROR_CODES.recipientNotAllowed,
2280
+ MAIL_SEND_ERROR_CODES.noRecipient,
2281
+ MAIL_SEND_ERROR_CODES.mailRejected,
2282
+ MAIL_SEND_ERROR_CODES.workspaceNotAllowed
2283
+ ];
2284
+ var mailSendRefusalDetailsSchema = z8.discriminatedUnion("reason", [
2285
+ z8.strictObject({
2286
+ reason: z8.literal(MAIL_SEND_ERROR_CODES.recipientNotAllowed),
2287
+ domain: z8.string().min(1).max(MAIL_ADDRESS_MAX_LENGTH)
2288
+ }),
2289
+ z8.strictObject({ reason: z8.literal(MAIL_SEND_ERROR_CODES.noRecipient) }),
2290
+ z8.strictObject({ reason: z8.literal(MAIL_SEND_ERROR_CODES.workspaceNotAllowed) }),
2291
+ z8.strictObject({
2292
+ reason: z8.literal(MAIL_SEND_ERROR_CODES.mailRejected),
2293
+ providerCode: z8.string().min(1).max(100).optional()
2294
+ })
2295
+ ]);
2296
+ var MAIL_RECIPIENT_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/u;
2297
+ var principalId = z8.string().regex(MAIL_RECIPIENT_ID_PATTERN);
2298
+ var ONE_LINE_PATTERN = /^[^\u0000-\u001f\u007f\u2028\u2029]*$/u;
2299
+ var mailAddressSchema = z8.email().max(MAIL_ADDRESS_MAX_LENGTH);
2300
+ var MAIL_RECIPIENT_DOMAIN_PATTERN = /^(\*\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z]{2,63}|xn--[a-z0-9-]{1,59})$/u;
2301
+ var MAIL_RECIPIENT_DOMAINS_ANY = "*";
2302
+ var mailRecipientDomainSchema = z8.string().max(MAIL_ADDRESS_MAX_LENGTH).refine(
2303
+ (domain) => domain === MAIL_RECIPIENT_DOMAINS_ANY || MAIL_RECIPIENT_DOMAIN_PATTERN.test(domain),
2304
+ { message: "A recipient domain is lowercase, such as kanzlei.de or *.kanzlei.de, or * alone" }
2305
+ );
2306
+ var mailSenderIdSchema = z8.union([
2307
+ z8.literal(MAIL_SENDER_SYSTEM),
2308
+ z8.templateLiteral([MAIL_SENDER_CONNECTION_PREFIX, z8.string().regex(CONNECTION_NAME_PATTERN)])
2309
+ ]).superRefine((sender, context) => {
2310
+ if (sender !== MAIL_SENDER_SYSTEM)
2311
+ context.addIssue({
2312
+ code: "custom",
2313
+ message: "not_supported_yet: a Connection sender arrives with MAIL-M365S; send as system"
2314
+ });
2315
+ });
2316
+ var mailRecipientSchema = z8.union([
2317
+ z8.strictObject({ address: mailAddressSchema }),
2318
+ z8.strictObject({ user: principalId }),
2319
+ z8.strictObject({ workspace: principalId })
2320
+ ]);
2321
+ var recipientEntries = z8.array(
2322
+ z8.union([mailAddressSchema, mailRecipientSchema, z8.looseObject({ email: mailAddressSchema })])
2323
+ ).max(MAIL_SEND_MAX_ADDRESSES);
2324
+ var mailRecipientListSchema = z8.union([mailAddressSchema, recipientEntries.min(1)]);
2325
+ var mailCopyRecipientListSchema = z8.union([mailAddressSchema, recipientEntries]);
2326
+ var mailReplyToSchema = z8.union([
2327
+ mailAddressSchema,
2328
+ z8.strictObject({ address: mailAddressSchema }),
2329
+ z8.strictObject({ user: principalId })
2330
+ ]);
2331
+ var mailSubjectSchema = z8.string().min(1).max(MAIL_SUBJECT_MAX_LENGTH).regex(ONE_LINE_PATTERN, { message: "input_invalid: a subject is one line" }).refine((subject) => subject.trim().length > 0, { message: "input_invalid: a subject has text" });
2332
+ var mailBodySchema = z8.string().max(MAIL_BODY_MAX_BYTES).refine((body) => new TextEncoder().encode(body).byteLength <= MAIL_BODY_MAX_BYTES, {
2333
+ message: `input_invalid: the body exceeds ${MAIL_BODY_MAX_BYTES} bytes`
2334
+ }).meta({ format: WORKFLOW_TEXT_FORMAT_MARKDOWN });
2335
+ var mailSenderNameSchema = z8.string().min(1).max(MAIL_SENDER_NAME_MAX_LENGTH).regex(ONE_LINE_PATTERN, { message: "input_invalid: a sender name is one line" }).refine((name2) => !name2.includes("@"), {
2336
+ message: "input_invalid: a sender name holds no @"
2337
+ });
2338
+ var mailSendInputSchema = z8.strictObject({
2339
+ sender: mailSenderIdSchema.default(MAIL_SENDER_SYSTEM),
2340
+ to: mailRecipientListSchema,
2341
+ cc: mailCopyRecipientListSchema.optional(),
2342
+ bcc: mailCopyRecipientListSchema.optional(),
2343
+ subject: mailSubjectSchema,
2344
+ body: mailBodySchema,
2345
+ senderName: mailSenderNameSchema.optional(),
2346
+ replyTo: mailReplyToSchema.optional(),
2347
+ /** The language of the frame around the body; the instance's default unless set. */
2348
+ locale: z8.enum(localeCodes).optional()
2349
+ });
2350
+ var count2 = z8.number().int().min(0);
2351
+ var recipientCounts = z8.strictObject({ to: count2, cc: count2, bcc: count2 });
2352
+ var mailSendOutputSchema = z8.strictObject({
2353
+ sentAt: z8.iso.datetime({ offset: true }),
2354
+ messageId: z8.string().min(1).max(256).optional(),
2355
+ recipients: recipientCounts,
2356
+ skipped: count2,
2357
+ test: z8.literal(true).optional()
2358
+ });
2359
+ var mailPreviewRecipientSchema = z8.strictObject({
2360
+ kind: z8.enum(["person", "address"]),
2361
+ label: z8.string().min(1).max(MAIL_ADDRESS_MAX_LENGTH)
2362
+ });
2363
+ var mailSendPreviewSchema = z8.strictObject({
2364
+ from: z8.strictObject({ name: z8.string().min(1), address: mailAddressSchema }),
2365
+ replyTo: mailAddressSchema.optional(),
2366
+ to: z8.array(mailPreviewRecipientSchema),
2367
+ cc: z8.array(mailPreviewRecipientSchema),
2368
+ bcc: z8.array(mailPreviewRecipientSchema),
2369
+ skipped: count2,
2370
+ subject: z8.string(),
2371
+ html: z8.string(),
2372
+ text: z8.string()
2373
+ });
2374
+ var mailSendSimulatedOutputSchema = z8.strictObject({
2375
+ simulated: z8.literal(true),
2376
+ preview: mailSendPreviewSchema
2377
+ });
2378
+ var workflowMessageMailParamsSchema = z8.strictObject({
2379
+ subject: mailSubjectSchema,
2380
+ markdown: mailBodySchema,
2381
+ sentBy: z8.discriminatedUnion("kind", [
2382
+ z8.strictObject({ kind: z8.literal("workflow"), workflowName: z8.string().min(1).max(200) }),
2383
+ z8.strictObject({ kind: z8.literal("agent"), onBehalfOf: z8.string().min(1).max(200) })
2384
+ ]),
2385
+ test: z8.strictObject({
2386
+ intendedRecipients: z8.strictObject({
2387
+ to: z8.array(mailPreviewRecipientSchema),
2388
+ cc: z8.array(mailPreviewRecipientSchema),
2389
+ bcc: z8.array(mailPreviewRecipientSchema)
2390
+ })
2391
+ }).optional()
2392
+ });
2393
+ var workflowMailSenderFactSchema = z8.strictObject({
2394
+ sender: z8.string().min(1),
2395
+ title: z8.string().min(1),
2396
+ icon: z8.string().min(1),
2397
+ address: mailAddressSchema,
2398
+ recipientDomains: z8.array(mailRecipientDomainSchema)
2399
+ });
2400
+ var mailSendContract = {
2401
+ name: MAIL_SEND_OPERATION,
2402
+ description: "Send one e-mail as a sender of the instance (system unless set). Recipients are addresses, people of the instance and workspaces; an address outside the instance's recipient domains is refused. The body is Markdown in the instance's frame. A test run previews the mail and sends nothing.",
2403
+ inputSchema: mailSendInputSchema,
2404
+ outputSchema: mailSendOutputSchema,
2405
+ simulatedOutputSchema: mailSendSimulatedOutputSchema,
2406
+ effect: "changing",
2407
+ changeClass: "outward",
2408
+ right: MAIL_SENDER_USE_ACTION,
2409
+ resourceKind: MAIL_SENDER_RESOURCE_KIND,
2410
+ events: { after: "mail.sent", refused: "mail.refused" },
2411
+ errorCodes: MAIL_SEND_ERROR_CODES
2412
+ };
2413
+
2414
+ // src/data-scope.ts
2415
+ import { z as z9 } from "zod";
2416
+ var dataScopeNameSchema = z9.string().regex(/^[a-z][a-z0-9_]{0,62}$/u);
2417
+ var dataScopesSchema = z9.record(
2418
+ dataScopeNameSchema,
2419
+ z9.strictObject({
2420
+ label: z9.string().trim().min(1).max(120),
2421
+ valueType: z9.literal("text")
2422
+ })
2423
+ ).refine(
2424
+ (dimensions) => Object.keys(dimensions).length <= 1,
2425
+ "One data scope dimension is supported"
2426
+ );
2427
+ var scopeAssignmentInputSchema = z9.strictObject({
2428
+ dimension: dataScopeNameSchema,
2429
+ holderKind: z9.enum(["user", "group", "service_principal"]),
2430
+ holderId: z9.string().min(1).max(200).refine((value) => !value.includes("\0"), "NUL is not allowed"),
2431
+ effect: z9.enum(GRANT_EFFECTS),
2432
+ values: z9.union([
2433
+ z9.literal("all"),
2434
+ z9.array(
2435
+ z9.string().min(1).max(200).refine((value) => !value.includes("\0"), "NUL is not allowed")
2436
+ ).max(1e4)
2437
+ ])
2438
+ });
2439
+ var identifier = z9.string().regex(/^[a-z_][a-z0-9_]{0,62}$/u);
2440
+ var scopedTablesSchema = z9.record(
2441
+ identifier,
2442
+ z9.strictObject({
2443
+ scope: z9.record(dataScopeNameSchema, identifier).refine((scope) => Object.keys(scope).length === 1, "A scoped table names one dimension")
2444
+ })
2445
+ );
2446
+
2447
+ // src/feedback-values.ts
2448
+ var FEEDBACK_TEXT_MAX_LENGTH = 4e3;
2449
+ var FEEDBACK_SUMMARY_MAX_LENGTH = 1e3;
2450
+ var FEEDBACK_CATEGORY_MAX_LENGTH = 60;
2451
+ var FEEDBACK_NOTE_MAX_LENGTH = 2e3;
2452
+ var FEEDBACK_SUBJECT_KINDS = ["message", "app", "workflow_run"];
2453
+ var FEEDBACK_ASSET_KINDS = ["agent", "app", "workflow"];
2454
+ var FEEDBACK_STATES = ["new", "handled"];
2455
+
2456
+ // src/platform-report-values.ts
2457
+ var PLATFORM_REPORT_NOTE_MAX_LENGTH = 2e3;
2458
+
2459
+ // src/callable-operations.ts
2460
+ import { z as z10 } from "zod";
2461
+ var operationSourceSchema = z10.object({
2462
+ kind: z10.enum(OPERATION_SOURCE_KINDS),
2463
+ title: z10.string().optional(),
2464
+ /** The Connection's `service`, for its icon. */
2465
+ service: z10.string().optional()
2466
+ });
2467
+ var jsonSchemaObject = z10.record(z10.string(), z10.unknown());
2468
+ var callableOperationSchema = z10.object({
2469
+ /** What a step writes under `operation`. */
2470
+ name: z10.string(),
2471
+ effect: z10.enum(OPERATION_EFFECTS),
2472
+ title: z10.string(),
2473
+ /** The operation's own description, where its source gives one. */
2474
+ description: z10.string().optional(),
2475
+ source: operationSourceSchema,
2476
+ /** False where a call cannot reach its source now, such as a Connection that is off. */
2477
+ available: z10.boolean(),
2478
+ inputSchema: jsonSchemaObject.optional(),
2479
+ outputSchema: jsonSchemaObject.optional()
2480
+ });
2481
+ var callableOperationsPageSchema = z10.object({
2482
+ operations: z10.array(callableOperationSchema),
2483
+ /** Passed back as `cursor`, with the same filters, until it is absent. */
2484
+ nextCursor: z10.string().optional(),
2485
+ /** A source left operations out: a missing name proves no absence. */
2486
+ truncated: z10.boolean()
2487
+ });
2488
+
2489
+ // src/preview-capture.ts
2490
+ var PREVIEW_CAPTURE_TOOL_NAME = "preview.capture";
2491
+ var PREVIEW_CAPTURE_MAX_WIDTH = 1280;
2492
+ var PREVIEW_CAPTURE_MAX_HEIGHT = 1600;
2493
+ var PREVIEW_CAPTURE_MAX_BYTES = 4e5;
2494
+ var PREVIEW_CAPTURES_PER_RUN = 3;
2495
+ var PREVIEW_CAPTURES_PER_HOUR = 20;
2496
+ var PREVIEW_CAPTURE_WAIT_MS = 1e4;
2497
+ var PREVIEW_CAPTURE_REFUSALS = [
2498
+ "capture_limit",
2499
+ "capture_unavailable",
2500
+ "preview_not_viewed",
2501
+ "preview_personal_data"
2502
+ ];
2503
+ var ascii = (bytes, at, length) => String.fromCharCode(...bytes.subarray(at, at + length));
2504
+ var uint16 = (bytes, at) => (bytes[at] ?? 0) | (bytes[at + 1] ?? 0) << 8;
2505
+ var uint24 = (bytes, at) => uint16(bytes, at) | (bytes[at + 2] ?? 0) << 16;
2506
+ var uint32 = (bytes, at) => uint24(bytes, at) + (bytes[at + 3] ?? 0) * 2 ** 24;
2507
+ function readWebpSize(bytes) {
2508
+ if (bytes.byteLength < 30 || ascii(bytes, 0, 4) !== "RIFF" || ascii(bytes, 8, 4) !== "WEBP") {
2509
+ return void 0;
2510
+ }
2511
+ if (uint32(bytes, 4) + 8 !== bytes.byteLength) return void 0;
2512
+ const chunk = ascii(bytes, 12, 4);
2513
+ if (chunk === "VP8X") {
2514
+ if (((bytes[20] ?? 0) & 2) !== 0) return void 0;
2515
+ return { width: 1 + uint24(bytes, 24), height: 1 + uint24(bytes, 27) };
2516
+ }
2517
+ if (chunk === "VP8 ") {
2518
+ if (bytes[23] !== 157 || bytes[24] !== 1 || bytes[25] !== 42) return void 0;
2519
+ return { width: uint16(bytes, 26) & 16383, height: uint16(bytes, 28) & 16383 };
2520
+ }
2521
+ if (chunk === "VP8L") {
2522
+ if (bytes[20] !== 47) return void 0;
2523
+ const bits = uint32(bytes, 21);
2524
+ return { width: (bits & 16383) + 1, height: (Math.floor(bits / 2 ** 14) & 16383) + 1 };
2525
+ }
2526
+ return void 0;
2527
+ }
2528
+ function isPreviewCaptureWithinBounds(bytes) {
2529
+ if (bytes.byteLength > PREVIEW_CAPTURE_MAX_BYTES) return void 0;
2530
+ const size = readWebpSize(bytes);
2531
+ return size && size.width >= 1 && size.height >= 1 && size.width <= PREVIEW_CAPTURE_MAX_WIDTH && size.height <= PREVIEW_CAPTURE_MAX_HEIGHT ? size : void 0;
2532
+ }
2533
+
2534
+ // src/preview-report.ts
2535
+ import { z as z11 } from "zod";
2536
+ var PREVIEW_REPORT_MAX_ENTRIES = 10;
2537
+ var PREVIEW_REPORT_MAX_MESSAGE_CHARS = 200;
2538
+ var PREVIEW_REPORT_MAX_BYTES = 2048;
2539
+ var PREVIEW_REPORT_KEEP_MS = 24 * 60 * 60 * 1e3;
2540
+ var PREVIEW_REPORT_ENTRY_KINDS = [
2541
+ "error",
2542
+ "rejection",
2543
+ "console",
2544
+ "policy",
2545
+ "call"
2546
+ ];
2547
+ var PREVIEW_REPORT_BRIDGE_STATES = [
2548
+ "connected",
2549
+ "waiting",
2550
+ "not_connected",
2551
+ "not_used"
2552
+ ];
2553
+ var FILE_MAX_CHARS = 200;
2554
+ var CODE_PATTERN = /^[a-z0-9_.-]{1,64}$/u;
2555
+ var previewReportEntrySchema = z11.strictObject({
2556
+ kind: z11.enum(PREVIEW_REPORT_ENTRY_KINDS),
2557
+ /** The scrubbed message; for a failed call, the action's name. */
2558
+ message: z11.string().max(PREVIEW_REPORT_MAX_MESSAGE_CHARS),
2559
+ /** A failed call's refusal code. */
2560
+ code: z11.string().regex(CODE_PATTERN).optional(),
2561
+ /** The page's file the entry came from, relative to the page. */
2562
+ file: z11.string().min(1).max(FILE_MAX_CHARS).optional(),
2563
+ line: z11.number().int().min(0).max(1e7).optional(),
2564
+ /** One-based column; the server resolves bundle coordinates to authored source. */
2565
+ column: z11.number().int().min(0).max(1e7).optional(),
2566
+ count: z11.number().int().min(1).max(1e9)
2567
+ });
2568
+ var previewReportSchema = z11.strictObject({
2569
+ /** The page settled: after load, 1.5 seconds without a new entry, at most 8 seconds. */
2570
+ settled: z11.boolean(),
2571
+ /** The frame's document loaded. */
2572
+ loaded: z11.boolean(),
2573
+ bridge: z11.enum(PREVIEW_REPORT_BRIDGE_STATES),
2574
+ /** Whether the page drew nothing once it settled. Unknown before. */
2575
+ empty: z11.boolean().optional(),
2576
+ entries: z11.array(previewReportEntrySchema).max(PREVIEW_REPORT_MAX_ENTRIES),
2577
+ /** Entries that were not listed: past the limit or past the size. */
2578
+ more: z11.number().int().min(0).max(1e9)
2579
+ });
2580
+ var ELLIPSIS = "\u2026";
2581
+ var QUOTED = /"[^"\n]{25,}"|'[^'\n]{25,}'|`[^`\n]{25,}`|„[^“”\n]{25,}[“”]|“[^”\n]{25,}”|‘[^’\n]{25,}’|«[^»\n]{25,}»|»[^«\n]{25,}«/gu;
2582
+ var CONTENT_ADDRESS_IN_TEXT = /(?:\b[a-z][a-z0-9+.-]*:\/\/[^\s/"'`<>]*)?\/app-content\/[^/\s"'`<>]+\/[^/\s"'`<>]+\//giu;
2583
+ var ADDRESS_QUERY = /((?:\b[a-z][a-z0-9+.-]*:\/\/|\/)[^\s?#"'`<>]*)[?#][^\s"'`<>]*/giu;
2584
+ var MAIL = /[^\s@"'`<>()[\]{},;:]+(?:@|%40)[^\s@"'`<>()[\]{},;:]*/giu;
2585
+ var IBAN = /\b[a-z]{2}\d{2}(?:[a-z0-9]{11,30}|(?: [a-z0-9]{4}){2,7}(?: [a-z0-9]{1,4})?)\b/giu;
2586
+ var DIGIT_RUN = /\d(?:[ .,'/:-]?\d){3,}/gu;
2587
+ var CONTROL = new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029]+", "gu");
2588
+ function scrubPreviewText(text2) {
2589
+ const scrubbed = text2.replace(CONTROL, " ").replace(
2590
+ QUOTED,
2591
+ (quoted) => `${quoted.charAt(0)}${ELLIPSIS}${quoted.charAt(quoted.length - 1)}`
2592
+ ).replace(CONTENT_ADDRESS_IN_TEXT, "/").replace(ADDRESS_QUERY, `$1?${ELLIPSIS}`).replace(MAIL, ELLIPSIS).replace(IBAN, ELLIPSIS).replace(DIGIT_RUN, ELLIPSIS).replace(/\s+/gu, " ").trim();
2593
+ const characters = Array.from(scrubbed);
2594
+ return characters.length <= PREVIEW_REPORT_MAX_MESSAGE_CHARS ? scrubbed : `${characters.slice(0, PREVIEW_REPORT_MAX_MESSAGE_CHARS - 1).join("")}${ELLIPSIS}`;
2595
+ }
2596
+ var CONTENT_ADDRESS = /^.*\/app-content\/[^/]+\/[^/]+\//iu;
2597
+ var ORIGIN = /^[a-z][a-z0-9+.-]*:\/\/[^/]*/iu;
2598
+ var FILE_PATTERN = /^[\w./@~+-]+$/u;
2599
+ var BUILD_HASH = /-[A-Za-z0-9]{8}(?=\.[a-z]+$)/u;
2600
+ var LONG_DIGITS = /\d{5,}/u;
2601
+ function scrubPreviewFile(file) {
2602
+ if (file === void 0 || file.length === 0) return void 0;
2603
+ if (/^about:srcdoc/iu.test(file)) return "inline";
2604
+ const path = file.replace(/[?#].*$/su, "").replace(CONTENT_ADDRESS, "").replace(ORIGIN, "").replace(/^\/+(?=app-runtime\/)/u, "/");
2605
+ if (path.length === 0 || path.length > FILE_MAX_CHARS || !FILE_PATTERN.test(path)) {
2606
+ return void 0;
2607
+ }
2608
+ const unhashed = path.replace(BUILD_HASH, "");
2609
+ return LONG_DIGITS.test(unhashed) || unhashed.replace(MAIL, "").replace(IBAN, "") !== unhashed ? void 0 : path;
2610
+ }
2611
+ function scrubCode(code) {
2612
+ if (code === void 0) return void 0;
2613
+ const lower = code.toLowerCase();
2614
+ return CODE_PATTERN.test(lower) ? lower : "failed";
2615
+ }
2616
+ function byteLength(value) {
2617
+ return new TextEncoder().encode(JSON.stringify(value)).byteLength;
2618
+ }
2619
+ function wholeCount(value, fallback) {
2620
+ return value !== void 0 && Number.isFinite(value) ? Math.min(1e9, Math.max(0, Math.floor(value))) : fallback;
2621
+ }
2622
+ function boundPreviewReport(input) {
2623
+ const merged = [];
2624
+ const index = /* @__PURE__ */ new Map();
2625
+ let more = wholeCount(input.more, 0);
2626
+ for (const raw of input.entries) {
2627
+ const count3 = Math.max(1, wholeCount(raw.count, 1));
2628
+ const file = scrubPreviewFile(raw.file);
2629
+ const code = raw.kind === "call" ? scrubCode(raw.code ?? "failed") : void 0;
2630
+ const line = file !== void 0 && raw.line !== void 0 && Number.isInteger(raw.line) ? Math.min(1e7, Math.max(0, raw.line)) : void 0;
2631
+ const column = line !== void 0 && raw.column !== void 0 && Number.isInteger(raw.column) ? Math.min(1e7, Math.max(0, raw.column)) : void 0;
2632
+ const entry = {
2633
+ kind: raw.kind,
2634
+ message: scrubPreviewText(raw.message),
2635
+ ...code === void 0 ? {} : { code },
2636
+ ...file === void 0 ? {} : { file },
2637
+ ...line === void 0 ? {} : { line },
2638
+ ...column === void 0 ? {} : { column },
2639
+ count: count3
2640
+ };
2641
+ const key2 = JSON.stringify([
2642
+ entry.kind,
2643
+ entry.message,
2644
+ entry.code,
2645
+ entry.file,
2646
+ entry.line,
2647
+ entry.column
2648
+ ]);
2649
+ const at = index.get(key2);
2650
+ if (at !== void 0) {
2651
+ const kept = merged[at];
2652
+ if (kept) kept.count = Math.min(1e9, kept.count + count3);
2653
+ continue;
2654
+ }
2655
+ if (merged.length >= PREVIEW_REPORT_MAX_ENTRIES) {
2656
+ more += count3;
2657
+ continue;
2658
+ }
2659
+ index.set(key2, merged.length);
2660
+ merged.push(entry);
2661
+ }
2662
+ const report = {
2663
+ settled: input.settled,
2664
+ loaded: input.loaded,
2665
+ bridge: input.bridge,
2666
+ ...input.empty === void 0 ? {} : { empty: input.empty },
2667
+ entries: merged,
2668
+ more: Math.min(1e9, more)
2669
+ };
2670
+ while (byteLength(report) > PREVIEW_REPORT_MAX_BYTES && report.entries.length > 0) {
2671
+ const dropped = report.entries.pop();
2672
+ report.more = Math.min(1e9, report.more + (dropped?.count ?? 0));
2673
+ }
2674
+ return report;
2675
+ }
2676
+
2677
+ // src/data-store-description.ts
2678
+ import { z as z12 } from "zod";
2679
+ var DATA_STORE_DESCRIPTION_TOOL_NAME = "platform.data_stores.describe";
2680
+ var dataStoreDescriptionInputSchema = z12.strictObject({ store: z12.string().min(1) });
2681
+ var useSchema = z12.object({ kind: z12.string(), name: z12.string(), title: z12.string() });
2682
+ var dataStoreDescriptionSchema = z12.object({
2683
+ name: z12.string(),
2684
+ title: z12.string(),
2685
+ description: z12.string().optional(),
2686
+ owner: z12.union([
2687
+ z12.object({ kind: z12.literal("instance") }),
2688
+ z12.object({ kind: z12.literal("workspace"), workspaceId: z12.string() })
2689
+ ]),
2690
+ published: z12.boolean(),
2691
+ tables: z12.array(
2692
+ z12.object({
2693
+ name: z12.string(),
2694
+ description: z12.string().optional(),
2695
+ rowEstimate: z12.number().nullable(),
2696
+ fields: z12.array(
2697
+ z12.object({
2698
+ name: z12.string(),
2699
+ type: z12.string(),
2700
+ description: z12.string(),
2701
+ nullable: z12.boolean()
2702
+ })
2703
+ )
2704
+ })
2705
+ ),
2706
+ schemaAvailable: z12.boolean(),
2707
+ filledBy: z12.array(useSchema),
2708
+ readBy: z12.array(useSchema),
2709
+ usesTruncated: z12.boolean(),
2710
+ rights: z12.object({ read: z12.boolean(), add: z12.boolean(), change: z12.boolean() }),
2711
+ chat: z12.object({ canReadRows: z12.boolean(), reason: z12.string(), nextStep: z12.string().optional() })
2712
+ });
2713
+
2714
+ // src/server-preview-capture.ts
2715
+ import { z as z13 } from "zod";
2716
+ var serverPreviewCaptureInputSchema = z13.strictObject({
2717
+ themeColors: z13.strictObject({
2718
+ surfaceColor: z13.string().min(1).max(128),
2719
+ backgroundColor: z13.string().min(1).max(128),
2720
+ textColor: z13.string().min(1).max(128),
2721
+ mutedTextColor: z13.string().min(1).max(128),
2722
+ borderColor: z13.string().min(1).max(128),
2723
+ accentColor: z13.string().min(1).max(128),
2724
+ accentStrongColor: z13.string().min(1).max(128)
2725
+ }),
2726
+ contentPath: z13.string().max(1024).regex(/^\/app-content\/fset_[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+\/$/),
2727
+ session: z13.string().regex(/^capture:pcap_[A-Za-z0-9_-]+$/),
2728
+ deadline: z13.number().int().positive(),
2729
+ size: z13.enum(PREVIEW_CAPTURE_SIZES),
2730
+ theme: z13.enum(THEME_MODES),
2731
+ locale: z13.enum(localeCodes),
2732
+ number: z13.number().int().positive()
2733
+ });
2734
+ var serverPreviewCaptureOutcomeSchema = z13.discriminatedUnion("status", [
2735
+ z13.strictObject({
2736
+ status: z13.literal("done"),
2737
+ image: z13.string().max(54e4),
2738
+ report: z13.unknown(),
2739
+ blocked: z13.array(
2740
+ z13.strictObject({
2741
+ method: z13.string().max(16),
2742
+ host: z13.string().max(160),
2743
+ path: z13.string().max(240)
2744
+ })
2745
+ ).max(50),
2746
+ calls: z13.array(z13.strictObject({ name: z13.string().max(160), code: z13.string().max(80) })).max(20)
2747
+ }),
2748
+ z13.strictObject({
2749
+ status: z13.literal("refused"),
2750
+ code: z13.enum(SERVER_PREVIEW_CAPTURE_REFUSALS),
2751
+ message: z13.string().max(160).optional()
2752
+ })
2753
+ ]);
2754
+
2755
+ // src/html-pdf.ts
2756
+ import { z as z14 } from "zod";
2757
+ var HTML_PDF_MAX_HTML_BYTES = 4 * 1024 * 1024;
2758
+ var HTML_PDF_MAX_PDF_BYTES = 10 * 1024 * 1024;
2759
+ var HTML_PDF_MAX_PAGES = 50;
2760
+ var HTML_PDF_RENDER_MS = 2e4;
2761
+ var HTML_PDF_RENDERS_PER_MINUTE_PER_SESSION = 10;
2762
+ var HTML_PDF_OPTIONS_HEADER = "x-pdf-options";
2763
+ var HTML_PDF_PAGES_HEADER = "x-pdf-pages";
2764
+ var HTML_PDF_PAGE_FORMATS = ["A3", "A4", "A5", "Letter", "Legal"];
2765
+ var HTML_PDF_REFUSALS = [
2766
+ "pdf_unavailable",
2767
+ "pdf_too_large",
2768
+ "pdf_too_many_pages",
2769
+ "pdf_busy",
2770
+ "pdf_failed"
2771
+ ];
2772
+ var margin = z14.string().max(16).regex(/^(?:0|\d{1,3}(?:\.\d{1,2})?(?:mm|cm|in|px))$/u, "a length such as '12mm', '1in' or '0'");
2773
+ var htmlPdfOptionsSchema = z14.strictObject({
2774
+ format: z14.enum(HTML_PDF_PAGE_FORMATS).optional(),
2775
+ landscape: z14.boolean().optional(),
2776
+ margin: z14.strictObject({
2777
+ top: margin.optional(),
2778
+ right: margin.optional(),
2779
+ bottom: margin.optional(),
2780
+ left: margin.optional()
2781
+ }).optional()
2782
+ });
1114
2783
  export {
1115
2784
  ACCESS_SOURCES,
1116
2785
  ACTIONS,
@@ -1118,24 +2787,34 @@ export {
1118
2787
  ADMINISTERED_USER_STATUSES,
1119
2788
  AGENT_AVAILABILITY_MODES,
1120
2789
  AGENT_EDITABLE_FIELDS,
2790
+ AGENT_PREVIEW_SOURCES,
1121
2791
  AGENT_RUN_FAILURE_CATEGORIES,
1122
2792
  AGENT_RUN_STATUSES,
1123
2793
  AGENT_STARTERS_MAX,
2794
+ AGENT_USE_SETTINGS,
2795
+ ALWAYS_ALLOW_LOCK_SOURCES,
1124
2796
  API_CREDENTIAL_SCOPES,
1125
2797
  APPROVAL_CHECK_FAILURE_OUTCOMES,
1126
2798
  APPROVAL_CHECK_STATUSES,
1127
2799
  APPROVAL_EXECUTIONS,
1128
2800
  APPROVAL_REQUEST_STATUSES,
1129
2801
  APP_ACTION_CALL_STATUSES,
2802
+ APP_AUDIENCES,
1130
2803
  APP_ERROR_CODES,
1131
2804
  APP_ERROR_STATUS_CODES,
1132
2805
  APP_MODES,
1133
2806
  ARTIFACT_PREVIEW_IMAGE_FORMATS,
1134
2807
  ARTIFACT_PREVIEW_IMAGE_MIME_TYPES,
1135
2808
  ARTIFACT_PREVIEW_STATUSES,
2809
+ ASSET_ACCESS_VERBS,
1136
2810
  ASSET_LIFECYCLES,
2811
+ ASSET_MOVE_EDITORS,
2812
+ ASSET_MOVE_PATHS,
2813
+ ASSET_MOVE_STATUSES,
2814
+ ASSET_MOVE_USERS,
1137
2815
  ASSET_NAME_REFUSAL_REASONS,
1138
2816
  ASSET_OWNER_KINDS,
2817
+ ASSET_OWNER_RUNGS,
1139
2818
  ASSET_REPO_BUNDLE_KINDS,
1140
2819
  ASSET_REPRESENTATIONS,
1141
2820
  ASSET_SYNC_CHANGE_TYPES,
@@ -1146,12 +2825,17 @@ export {
1146
2825
  AUDIT_TIERS,
1147
2826
  AUTH_PRINCIPAL_KINDS,
1148
2827
  AUTH_SCOPE_WILDCARD,
2828
+ AWS_ACCOUNT_ID,
2829
+ BEDROCK_REGION,
2830
+ CATALOGUE_CATEGORIES,
2831
+ CATALOGUE_PARTS,
1149
2832
  CHAT_MESSAGE_ROLES,
1150
2833
  CHAT_SESSION_AUTH_SCOPES,
1151
2834
  COLLABORATION_WORKSPACE_KINDS,
1152
2835
  CONFIG_ASSET_CHANGE_OPERATIONS,
1153
2836
  CONFIG_ASSET_KINDS,
1154
2837
  CONNECTION_BINDING_STATES,
2838
+ CONNECTION_CREDENTIAL_MODES,
1155
2839
  CONNECTION_EXPOSURES,
1156
2840
  CONNECTION_HEALTH_STATES,
1157
2841
  CONNECTION_NAME_MAX_LENGTH,
@@ -1161,14 +2845,20 @@ export {
1161
2845
  CONNECTION_OPERATION_POLICIES,
1162
2846
  CONNECTION_OPERATION_STATUSES,
1163
2847
  CONNECTION_ORIGINS,
2848
+ CONNECTION_PROPOSAL_BINDING_STATES,
2849
+ CONNECTION_PROPOSAL_STATES,
1164
2850
  CONNECTION_PROVIDER_REVOCATIONS,
1165
2851
  CONNECTION_SECRET_STATES,
2852
+ CONNECTION_SIGN_IN_NEEDS,
2853
+ CONNECTION_TEST_CREDENTIAL_STATES,
1166
2854
  CONNECTOR_TEST_STATUSES,
1167
2855
  CONVERSATION_ATTACHMENT_STATUSES,
1168
2856
  CONVERSATION_KINDS,
2857
+ CONVERSATION_TITLE_MAX_CHARS,
1169
2858
  CONVERSATION_VISIBILITIES,
1170
2859
  DATABASE_RELATION_TYPES,
1171
2860
  DATA_STORE_CONDITIONS,
2861
+ DATA_STORE_DESCRIPTION_TOOL_NAME,
1172
2862
  DATA_STORE_INSERT_CONFLICT_MODES,
1173
2863
  DATA_STORE_LOAD_CONFLICT_MODES,
1174
2864
  DATA_STORE_MIGRATION_OUTCOMES,
@@ -1176,19 +2866,38 @@ export {
1176
2866
  DATA_STORE_STATUSES,
1177
2867
  DECIDED_APPROVAL_REQUEST_STATUSES,
1178
2868
  DELETION_STATES,
2869
+ DRAFT_TEST_TARGETS,
1179
2870
  ENDED_AGENT_RUN_STATUSES,
1180
2871
  ENDED_APPROVAL_EXECUTIONS,
1181
2872
  FAILED_JOB_STATUSES,
2873
+ FEEDBACK_ASSET_KINDS,
2874
+ FEEDBACK_CATEGORY_MAX_LENGTH,
2875
+ FEEDBACK_NOTE_MAX_LENGTH,
2876
+ FEEDBACK_STATES,
2877
+ FEEDBACK_SUBJECT_KINDS,
2878
+ FEEDBACK_SUMMARY_MAX_LENGTH,
2879
+ FEEDBACK_TEXT_MAX_LENGTH,
1182
2880
  FIRST_PARTY_AUTH_SCOPES,
1183
2881
  FOLLOW_UP_MODES,
1184
2882
  FOLLOW_UP_STATUSES,
1185
2883
  GRANT_EFFECTS,
1186
2884
  GRANT_HOLDER_KINDS,
2885
+ GRANT_REQUEST_STALE_REASONS,
1187
2886
  GRANT_SCOPE_KINDS,
2887
+ GUARDRAIL_CHECK_KINDS,
1188
2888
  GUARDRAIL_HIT_OUTCOMES,
1189
2889
  GUARDRAIL_NAME_MAX_LENGTH,
1190
2890
  GUARDRAIL_NAME_PATTERN,
1191
2891
  GUARDRAIL_OUTCOMES,
2892
+ HTML_PDF_MAX_HTML_BYTES,
2893
+ HTML_PDF_MAX_PAGES,
2894
+ HTML_PDF_MAX_PDF_BYTES,
2895
+ HTML_PDF_OPTIONS_HEADER,
2896
+ HTML_PDF_PAGES_HEADER,
2897
+ HTML_PDF_PAGE_FORMATS,
2898
+ HTML_PDF_REFUSALS,
2899
+ HTML_PDF_RENDERS_PER_MINUTE_PER_SESSION,
2900
+ HTML_PDF_RENDER_MS,
1192
2901
  IDEMPOTENCY_KEY_MAX_LENGTH,
1193
2902
  INFRASTRUCTURE_SECRET_STATES,
1194
2903
  INFRASTRUCTURE_WITHHELD_FIELDS,
@@ -1198,26 +2907,58 @@ export {
1198
2907
  KNOWLEDGE_DOCUMENT_FAILURE_CODES,
1199
2908
  KNOWLEDGE_DOCUMENT_STATES,
1200
2909
  KNOWLEDGE_DOCUMENT_WAIT_CODES,
2910
+ KNOWLEDGE_EMBEDDING_STATES,
2911
+ KNOWLEDGE_FILE_MAX_BYTES,
2912
+ KNOWLEDGE_ORIGIN_LINK_CHANGES,
2913
+ KNOWLEDGE_ORIGIN_LINK_MAX_CHARS,
1201
2914
  KNOWLEDGE_SEARCH_SIGNALS,
1202
2915
  KNOWLEDGE_SOURCE_FAILURE_CODES,
1203
2916
  KNOWLEDGE_SOURCE_ITEM_FAILURE_CODES,
2917
+ KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES,
1204
2918
  KNOWLEDGE_SOURCE_ITEM_STATES,
1205
2919
  KNOWLEDGE_SYNC_COUNTS,
1206
2920
  KNOWLEDGE_SYNC_MODES,
1207
2921
  KNOWLEDGE_SYNC_RUN_STATES,
1208
2922
  LISTED_DATA_STORE_STATUSES,
1209
2923
  LIVE_JOB_STATUSES,
2924
+ MAIL_ADDRESS_MAX_LENGTH,
2925
+ MAIL_ATTACHMENTS_MAX_BYTES,
2926
+ MAIL_ATTACHMENTS_MAX_FILES,
2927
+ MAIL_AUDIT_MAX_DOMAINS,
2928
+ MAIL_BODY_MAX_BYTES,
2929
+ MAIL_OUTBOUND_DEFAULT_LIMITS,
2930
+ MAIL_OUTBOUND_FOOTER_MAX_LENGTH,
2931
+ MAIL_RECIPIENT_DOMAINS_ANY,
2932
+ MAIL_RECIPIENT_DOMAIN_PATTERN,
2933
+ MAIL_RECIPIENT_ID_PATTERN,
2934
+ MAIL_SENDER_CONNECTION_PREFIX,
2935
+ MAIL_SENDER_NAME_MAX_LENGTH,
2936
+ MAIL_SENDER_RESOURCE_KIND,
2937
+ MAIL_SENDER_SYSTEM,
2938
+ MAIL_SENDER_SYSTEM_ICON,
2939
+ MAIL_SENDER_USE_ACTION,
2940
+ MAIL_SEND_ERROR_CODES,
2941
+ MAIL_SEND_MAX_ADDRESSES,
2942
+ MAIL_SEND_OPERATION,
2943
+ MAIL_SEND_REFUSAL_REASONS,
2944
+ MAIL_SUBJECT_MAX_LENGTH,
2945
+ MAIL_WORKFLOW_MESSAGE_TEMPLATE,
2946
+ MANAGED_FILE_STATUSES,
2947
+ MEMBER_BUNDLE_CHANGES,
2948
+ MEMBER_BUNDLE_STATES,
1210
2949
  MESSAGE_FINISH_STATUSES,
2950
+ MODEL_FALLBACK_REASONS,
1211
2951
  MODEL_PROVIDER_AUTH_MODES,
1212
2952
  MODEL_USAGE_EVENT_STATUSES,
2953
+ MODEL_USAGE_LIMIT_METRICS,
2954
+ MODEL_USAGE_LIMIT_PERIODS,
2955
+ MODEL_USAGE_LIMIT_SCOPES,
1213
2956
  MODEL_USAGE_SOURCES,
1214
2957
  MODEL_USAGE_TIERS,
1215
- NAMESPACE_PREFIX_MAX_LENGTH,
1216
- NAMESPACE_PREFIX_MIN_LENGTH,
1217
- NAMESPACE_PREFIX_PATTERN,
1218
2958
  NOTIFY_CHANNELS,
1219
2959
  OPENAI_COMPATIBLE_APIS,
1220
2960
  OPERATIONS_AUDIENCES,
2961
+ OPERATION_CHANGE_CLASSES,
1221
2962
  OPERATION_CONFIRMATION_DECISIONS,
1222
2963
  OPERATION_DENIAL_REASONS,
1223
2964
  OPERATION_EFFECTS,
@@ -1225,14 +2966,63 @@ export {
1225
2966
  OPERATION_RUN_DECISION_MODES,
1226
2967
  OPERATION_RUN_DECISION_REASONS,
1227
2968
  OPERATION_RUN_STATUSES,
2969
+ OPERATION_SOURCE_KINDS,
1228
2970
  OPERATION_TARGETS,
2971
+ PERSONAL_AGENTS_KEY,
2972
+ PERSONAL_WORKSPACES_KEY,
2973
+ PERSON_POLICY_SETTINGS,
2974
+ PLATFORM_REPORT_NOTE_MAX_LENGTH,
1229
2975
  POLICY_VALUES,
2976
+ PREVIEW_CAPTURES_PER_HOUR,
2977
+ PREVIEW_CAPTURES_PER_RUN,
2978
+ PREVIEW_CAPTURE_MAX_BYTES,
2979
+ PREVIEW_CAPTURE_MAX_HEIGHT,
2980
+ PREVIEW_CAPTURE_MAX_WIDTH,
2981
+ PREVIEW_CAPTURE_REFUSALS,
2982
+ PREVIEW_CAPTURE_SIZES,
2983
+ PREVIEW_CAPTURE_STATUSES,
2984
+ PREVIEW_CAPTURE_TOOL_NAME,
2985
+ PREVIEW_CAPTURE_WAIT_MS,
2986
+ PREVIEW_REPORT_BRIDGE_STATES,
2987
+ PREVIEW_REPORT_ENTRY_KINDS,
2988
+ PREVIEW_REPORT_KEEP_MS,
2989
+ PREVIEW_REPORT_MAX_BYTES,
2990
+ PREVIEW_REPORT_MAX_ENTRIES,
2991
+ PREVIEW_REPORT_MAX_MESSAGE_CHARS,
1230
2992
  PRINCIPAL_HOLDER_KINDS,
2993
+ PROJECT_ACTIONS,
2994
+ PROJECT_ASSET_KIND,
2995
+ PROJECT_AUDIENCES,
2996
+ PROJECT_CHOICE_REFUSALS,
2997
+ PROJECT_DELETION_CONVERSATIONS,
2998
+ PROJECT_DESCRIPTION_MAX_LENGTH,
2999
+ PROJECT_FILE_CHANGES,
3000
+ PROJECT_FILE_ORIGINS,
3001
+ PROJECT_FOLDER_WRITE_CHANGES,
3002
+ PROJECT_KNOWLEDGE_BASES_MAX,
3003
+ PROJECT_NAME_MAX_LENGTH,
3004
+ PROJECT_NAME_PATTERN,
3005
+ PROJECT_SKILLS_MAX,
3006
+ PROJECT_TITLE_MAX_LENGTH,
1231
3007
  PROVIDER_CHECK_ERROR_CLASSES,
1232
3008
  PROVIDER_PORTS,
1233
3009
  PROVIDER_REGIONS,
3010
+ PUBLISHED_DATA_CONSUMER_KINDS,
3011
+ PUBLISH_CHANGE_KINDS,
1234
3012
  READING_POLICY_VALUES,
1235
3013
  REASONING_EFFORTS,
3014
+ RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE,
3015
+ RECORDS_PROPOSE_MAX_FIELDS_PER_ITEM,
3016
+ RECORDS_PROPOSE_MAX_ITEMS_PER_CALL,
3017
+ RECORD_FIELD_FAILURE_CODES,
3018
+ RECORD_FIELD_STATES,
3019
+ RECORD_FLAG_REASONS,
3020
+ ROLE_GRANT_SCOPE_KINDS,
3021
+ ROLE_PENDING_CHANGES,
3022
+ ROLE_PENDING_DECISIONS,
3023
+ SCHEDULED_START_STATES,
3024
+ SECRET_NAME_EXPECTATION,
3025
+ SERVER_PREVIEW_CAPTURE_REFUSALS,
1236
3026
  SERVICE_PRINCIPAL_PERMISSIONS,
1237
3027
  SERVICE_PRINCIPAL_STATUSES,
1238
3028
  SKILL_CHANGE_TYPES,
@@ -1249,6 +3039,7 @@ export {
1249
3039
  SKILL_STARTER_LINE_MAX_LENGTH,
1250
3040
  SKILL_SUMMARY_MAX_LENGTH,
1251
3041
  STRUCTURED_DATA_REVIEW_REASONS,
3042
+ STUDIO_KIND_PATHS,
1252
3043
  SUPPORTED_IMAGE_MIME_TYPES,
1253
3044
  SkillMarkdownError,
1254
3045
  THEME_MODES,
@@ -1259,38 +3050,151 @@ export {
1259
3050
  TOOL_DISPLAY_MODES,
1260
3051
  TOOL_GROUPS,
1261
3052
  TOOL_INPUT_PARSE_ERROR_CODES,
3053
+ USAGE_BREAKDOWN_DIMENSIONS,
1262
3054
  USAGE_COST_STATUSES,
3055
+ USAGE_ORIGINS,
3056
+ USAGE_SPEND_LIMIT_LEVELS,
1263
3057
  USER_STATUSES,
1264
3058
  WAITING_OPERATION_RUN_STATUSES,
1265
3059
  WEB_SOURCE_PROVIDERS,
3060
+ WORKFLOW_CAPABILITY_UNITS,
3061
+ WORKFLOW_CODE_STEP_AVAILABILITY,
3062
+ WORKFLOW_DATASET_DOWNLOAD_FORMATS,
3063
+ WORKFLOW_DATASET_STATES,
1266
3064
  WORKFLOW_ENDED_STATUSES,
3065
+ WORKFLOW_EXECUTED_STEP_TYPES,
3066
+ WORKFLOW_KINDS,
3067
+ WORKFLOW_MARKDOWN_MAX_COLUMNS,
3068
+ WORKFLOW_MARKDOWN_MAX_ROWS,
1267
3069
  WORKFLOW_NAME_PATTERN,
1268
3070
  WORKFLOW_NAME_RULE,
3071
+ WORKFLOW_PACKAGE_MANIFEST_STATES,
1269
3072
  WORKFLOW_RESERVED_STEP_TYPES,
3073
+ WORKFLOW_RIGHTS_REVISIONS,
3074
+ WORKFLOW_RIGHT_NEEDED_FOR,
3075
+ WORKFLOW_RIGHT_REFUSALS,
3076
+ WORKFLOW_RUN_ACCOUNT_STATUSES,
1270
3077
  WORKFLOW_RUN_MODES,
1271
3078
  WORKFLOW_RUN_STATUSES,
1272
3079
  WORKFLOW_STEP_RUN_STATUSES,
3080
+ WORKFLOW_STEP_SOURCE_KINDS,
1273
3081
  WORKFLOW_STEP_TYPES,
3082
+ WORKFLOW_TEST_REVISIONS,
3083
+ WORKFLOW_TEXT_FORMAT_MARKDOWN,
3084
+ WORKFLOW_TEXT_MAX_PARTS,
1274
3085
  WORKFLOW_TRIGGER_KINDS,
3086
+ WORKFLOW_WEBHOOK_HEADERS,
3087
+ WORKFLOW_WEBHOOK_LIMITS,
1275
3088
  WORKSPACE_ACCENT_COLORS,
1276
3089
  WORKSPACE_ACCESS_STATES,
3090
+ WORKSPACE_BUNDLES,
1277
3091
  WORKSPACE_COMMAND_STATUSES,
1278
3092
  WORKSPACE_FILE_KINDS,
1279
3093
  WORKSPACE_MEMBERSHIP_ROLES,
1280
3094
  WORKSPACE_SECTIONS,
3095
+ WORKSPACE_USE_ASSET_KINDS,
1281
3096
  WORKSPACE_VISIBILITIES,
1282
3097
  YAML_DATA_MAX_VALUES,
1283
3098
  YamlDataError,
1284
3099
  agentConfigSchema,
3100
+ appInterfacePath,
3101
+ assetPagePath,
3102
+ bedrockProfileRefusal,
3103
+ boundPreviewReport,
3104
+ callableOperationSchema,
3105
+ callableOperationsPageSchema,
1285
3106
  checkStorableTexts,
3107
+ conversationInterfacePath,
3108
+ dataScopeNameSchema,
3109
+ dataScopesSchema,
3110
+ dataStoreDescriptionInputSchema,
3111
+ dataStoreDescriptionSchema,
3112
+ dataStoreRecordFieldSchema,
3113
+ dataStoreRecordProposalItemSchema,
3114
+ dataStoreRecordsContracts,
3115
+ dataStoreRecordsDecideInputSchema,
3116
+ dataStoreRecordsDecideOutputSchema,
3117
+ dataStoreRecordsFlaggedInputSchema,
3118
+ dataStoreRecordsFlaggedOutputSchema,
3119
+ dataStoreRecordsProposeInputSchema,
3120
+ dataStoreRecordsRuleSchema,
1286
3121
  deriveSkillTitle,
1287
3122
  formatSkillMarkdown,
3123
+ htmlPdfOptionsSchema,
3124
+ inboxItemPath,
3125
+ isPlainConfigObject,
3126
+ isPreviewCaptureWithinBounds,
3127
+ isRecord,
3128
+ isSecretName,
1288
3129
  isStorableText,
3130
+ knowledgeExtractFieldsInputSchema,
3131
+ knowledgeExtractFieldsOutputSchema,
3132
+ knowledgeFieldValueSchema,
3133
+ knowledgeFirstPassConfirmationSchema,
3134
+ knowledgeIngestFetchSchema,
3135
+ knowledgeIngestInputSchema,
3136
+ knowledgeIngestItemSchema,
3137
+ knowledgeIngestOutputSchema,
3138
+ knowledgeLocateInputSchema,
3139
+ knowledgeLocateOutputSchema,
3140
+ knowledgeOriginLinkSchema,
3141
+ knowledgePendingInputSchema,
3142
+ knowledgePendingOutputSchema,
3143
+ knowledgePendingRowSchema,
3144
+ knowledgeProcessorOutputSchema,
3145
+ knowledgePutProcessedInputSchema,
3146
+ knowledgeRecordsRefusalSchema,
3147
+ knowledgeRetryInputSchema,
3148
+ knowledgeRetryOutputSchema,
3149
+ knowledgeSourceItemsInputSchema,
3150
+ knowledgeSourceItemsOutputSchema,
3151
+ knowledgeSourcesOutputSchema,
3152
+ knowledgeSyncInputSchema,
3153
+ knowledgeSyncResultSchema,
3154
+ knowledgeWithdrawInputSchema,
3155
+ knowledgeWithdrawOutputSchema,
3156
+ knowledgeWorkflowSourceSchema,
3157
+ knowledgeWorkflowSourcesOutputSchema,
3158
+ knowledgeWriteContracts,
1289
3159
  loadYamlData,
1290
3160
  localeCodes,
1291
3161
  localizedStringSchema,
3162
+ mailAddressSchema,
3163
+ mailBodySchema,
3164
+ mailCopyRecipientListSchema,
3165
+ mailPreviewRecipientSchema,
3166
+ mailRecipientDomainSchema,
3167
+ mailRecipientListSchema,
3168
+ mailRecipientSchema,
3169
+ mailReplyToSchema,
3170
+ mailSendContract,
3171
+ mailSendInputSchema,
3172
+ mailSendOutputSchema,
3173
+ mailSendPreviewSchema,
3174
+ mailSendRefusalDetailsSchema,
3175
+ mailSendSimulatedOutputSchema,
3176
+ mailSenderIdSchema,
3177
+ mailSenderNameSchema,
3178
+ mailSubjectSchema,
3179
+ mergeConfigObjects,
3180
+ operationBatchFailureSchema,
3181
+ operationBatchResultSchema,
3182
+ operationPagingSchema,
3183
+ operationSourceSchema,
1292
3184
  parseSkillMarkdown,
3185
+ previewReportEntrySchema,
3186
+ previewReportSchema,
3187
+ providerRegionSchema,
3188
+ readWebpSize,
1293
3189
  readYamlData,
3190
+ recordColumnTakes,
3191
+ recordEvidenceResultSchema,
3192
+ scopeAssignmentInputSchema,
3193
+ scopedTablesSchema,
3194
+ scrubPreviewFile,
3195
+ scrubPreviewText,
3196
+ serverPreviewCaptureInputSchema,
3197
+ serverPreviewCaptureOutcomeSchema,
1294
3198
  skillConfigSchema,
1295
3199
  skillFileEntrySchema,
1296
3200
  skillFileFrontmatterSchema,
@@ -1301,6 +3205,12 @@ export {
1301
3205
  skillResourcePathSchema,
1302
3206
  skillStarterSchema,
1303
3207
  workflowConfigSchema,
3208
+ workflowDataFlowsSchema,
3209
+ workflowDatasetReferenceSchema,
3210
+ workflowFileReferenceSchema,
3211
+ workflowMailSenderFactSchema,
3212
+ workflowMessageMailParamsSchema,
3213
+ writeYamlData,
1304
3214
  yamlValueIssue,
1305
3215
  yamlValueIssueSentence
1306
3216
  };