@standards/schema 0.0.0-stage → 1.0.0-alpha.382

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 (133) hide show
  1. package/LICENSE +111 -0
  2. package/README.md +8 -2
  3. package/dist/all-BgYwavNm.d.mts +2956 -0
  4. package/dist/all-DjdKldjX.d.ts +2956 -0
  5. package/dist/api/index.d.mts +11838 -0
  6. package/dist/api/index.d.ts +11838 -0
  7. package/dist/api/index.js +2 -0
  8. package/dist/api/index.mjs +2 -0
  9. package/dist/attribute-validators-DRqhAt2t.mjs +11 -0
  10. package/dist/attribute-validators-WAoJbap5.js +11 -0
  11. package/dist/attributes-aTeqx6cK.d.mts +557 -0
  12. package/dist/attributes-kAhQzg8-.d.ts +557 -0
  13. package/dist/checkbox-BZvZOraX.d.mts +11 -0
  14. package/dist/checkbox-n0YV1O13.d.ts +11 -0
  15. package/dist/config-BIxnbUN8.mjs +2 -0
  16. package/dist/config-DdjlHdPg.js +2 -0
  17. package/dist/core-397tQy5q.js +2 -0
  18. package/dist/core-BLHhNykL.mjs +2 -0
  19. package/dist/date-CxqDOhA0.d.mts +24 -0
  20. package/dist/date-D007KyTI.d.ts +24 -0
  21. package/dist/exceptions-DjPVyS-Q.d.mts +761 -0
  22. package/dist/exceptions-DjPVyS-Q.d.ts +761 -0
  23. package/dist/exceptions.d.mts +3 -0
  24. package/dist/exceptions.d.ts +3 -0
  25. package/dist/exceptions.js +2 -0
  26. package/dist/exceptions.mjs +2 -0
  27. package/dist/index-3HZjBOpj.d.mts +53 -0
  28. package/dist/index-BmNMneu3.d.mts +278 -0
  29. package/dist/index-Bu9xF5Nq.d.ts +278 -0
  30. package/dist/index-CiTBL4gH.d.ts +101 -0
  31. package/dist/index-D7TEaPqX.d.ts +16519 -0
  32. package/dist/index-DLO8JpnY.d.ts +53 -0
  33. package/dist/index-DPO5w-fC.d.mts +101 -0
  34. package/dist/index-DwQWBzYJ.d.mts +16519 -0
  35. package/dist/index.d.mts +15 -0
  36. package/dist/index.d.ts +15 -0
  37. package/dist/index.js +2 -0
  38. package/dist/index.mjs +2 -0
  39. package/dist/number-CgBxEbjI.d.mts +11 -0
  40. package/dist/number-DncH-WRO.d.ts +11 -0
  41. package/dist/object-DcgxLvip.js +4 -0
  42. package/dist/object-Dzl7sfq8.mjs +4 -0
  43. package/dist/objects-B4DgFZ82.d.ts +398 -0
  44. package/dist/objects-C9f6hFW_.d.mts +398 -0
  45. package/dist/phone-BB-tzcSr.js +2 -0
  46. package/dist/phone-Bca_xiOX.mjs +2 -0
  47. package/dist/record-aggregates-CzG86pUS.mjs +2 -0
  48. package/dist/record-aggregates-DwpIJ2Dv.js +2 -0
  49. package/dist/record-operation-BSXczk7v.js +2 -0
  50. package/dist/record-operation-C9oXHmfF.mjs +2 -0
  51. package/dist/text-A9AJ1wUO.js +2 -0
  52. package/dist/text-C8Lb-NFo.mjs +2 -0
  53. package/dist/text-DDoY_LcQ.d.ts +11 -0
  54. package/dist/text-DeUqCFp9.d.mts +11 -0
  55. package/dist/utils-B7Dlrtnx.d.ts +163 -0
  56. package/dist/utils-DbRMK8NI.d.mts +163 -0
  57. package/dist/utils-fXIvFFl6.mjs +2 -0
  58. package/dist/utils-gY3d9Dwp.js +2 -0
  59. package/dist/utils.d.mts +3 -0
  60. package/dist/utils.d.ts +3 -0
  61. package/dist/utils.js +2 -0
  62. package/dist/utils.mjs +2 -0
  63. package/dist/validation/all.d.mts +6 -0
  64. package/dist/validation/all.d.ts +6 -0
  65. package/dist/validation/all.js +2 -0
  66. package/dist/validation/all.mjs +2 -0
  67. package/dist/validation/complex/currency.d.mts +13 -0
  68. package/dist/validation/complex/currency.d.ts +13 -0
  69. package/dist/validation/complex/currency.js +2 -0
  70. package/dist/validation/complex/currency.mjs +2 -0
  71. package/dist/validation/complex/location.d.mts +20 -0
  72. package/dist/validation/complex/location.d.ts +20 -0
  73. package/dist/validation/complex/location.js +2 -0
  74. package/dist/validation/complex/location.mjs +2 -0
  75. package/dist/validation/complex/phone.d.mts +20 -0
  76. package/dist/validation/complex/phone.d.ts +20 -0
  77. package/dist/validation/complex/phone.js +2 -0
  78. package/dist/validation/complex/phone.mjs +2 -0
  79. package/dist/validation/complex/relation.d.mts +23 -0
  80. package/dist/validation/complex/relation.d.ts +23 -0
  81. package/dist/validation/complex/relation.js +2 -0
  82. package/dist/validation/complex/relation.mjs +2 -0
  83. package/dist/validation/complex/richtext.d.mts +11 -0
  84. package/dist/validation/complex/richtext.d.ts +11 -0
  85. package/dist/validation/complex/richtext.js +2 -0
  86. package/dist/validation/complex/richtext.mjs +2 -0
  87. package/dist/validation/complex/select.d.mts +18 -0
  88. package/dist/validation/complex/select.d.ts +18 -0
  89. package/dist/validation/complex/select.js +2 -0
  90. package/dist/validation/complex/select.mjs +2 -0
  91. package/dist/validation/complex/user.d.mts +11 -0
  92. package/dist/validation/complex/user.d.ts +11 -0
  93. package/dist/validation/complex/user.js +2 -0
  94. package/dist/validation/complex/user.mjs +2 -0
  95. package/dist/validation/computed/formula.d.mts +12 -0
  96. package/dist/validation/computed/formula.d.ts +12 -0
  97. package/dist/validation/computed/formula.js +2 -0
  98. package/dist/validation/computed/formula.mjs +2 -0
  99. package/dist/validation/computed/rollup.d.mts +12 -0
  100. package/dist/validation/computed/rollup.d.ts +12 -0
  101. package/dist/validation/computed/rollup.js +2 -0
  102. package/dist/validation/computed/rollup.mjs +2 -0
  103. package/dist/validation/config/index.d.mts +3 -0
  104. package/dist/validation/config/index.d.ts +3 -0
  105. package/dist/validation/config/index.js +2 -0
  106. package/dist/validation/config/index.mjs +2 -0
  107. package/dist/validation/core/index.d.mts +3 -0
  108. package/dist/validation/core/index.d.ts +3 -0
  109. package/dist/validation/core/index.js +2 -0
  110. package/dist/validation/core/index.mjs +2 -0
  111. package/dist/validation/object/index.d.mts +3 -0
  112. package/dist/validation/object/index.d.ts +3 -0
  113. package/dist/validation/object/index.js +2 -0
  114. package/dist/validation/object/index.mjs +2 -0
  115. package/dist/validation/primitives/checkbox.d.mts +3 -0
  116. package/dist/validation/primitives/checkbox.d.ts +3 -0
  117. package/dist/validation/primitives/checkbox.js +2 -0
  118. package/dist/validation/primitives/checkbox.mjs +2 -0
  119. package/dist/validation/primitives/date.d.mts +3 -0
  120. package/dist/validation/primitives/date.d.ts +3 -0
  121. package/dist/validation/primitives/date.js +2 -0
  122. package/dist/validation/primitives/date.mjs +2 -0
  123. package/dist/validation/primitives/number.d.mts +3 -0
  124. package/dist/validation/primitives/number.d.ts +3 -0
  125. package/dist/validation/primitives/number.js +2 -0
  126. package/dist/validation/primitives/number.mjs +2 -0
  127. package/dist/validation/primitives/text.d.mts +3 -0
  128. package/dist/validation/primitives/text.d.ts +3 -0
  129. package/dist/validation/primitives/text.js +2 -0
  130. package/dist/validation/primitives/text.mjs +2 -0
  131. package/dist/view-config.schema-BQ9tU_9G.js +2 -0
  132. package/dist/view-config.schema-BmjCQJ51.mjs +2 -0
  133. package/package.json +279 -3
@@ -0,0 +1,761 @@
1
+
2
+ import { z as z$1 } from "zod";
3
+ //#region src/lib/permission-grants.d.ts
4
+ declare const PERMISSION_ACTIONS: readonly ["read", "create", "update", "delete", "manage"];
5
+ /** The only definition of a valid grant (spec B1). */
6
+ declare const permissionGrantSchema: z$1.ZodObject<{
7
+ scope: z$1.ZodEnum<{
8
+ object: "object";
9
+ system: "system";
10
+ }>;
11
+ target: z$1.ZodString;
12
+ actions: z$1.ZodArray<z$1.ZodEnum<{
13
+ read: "read";
14
+ create: "create";
15
+ update: "update";
16
+ delete: "delete";
17
+ manage: "manage";
18
+ }>>;
19
+ }, z$1.core.$strict>;
20
+ type PermissionGrant = z$1.infer<typeof permissionGrantSchema>;
21
+ interface GrantIssue {
22
+ target: string;
23
+ reason: "shape" | "unknown-resource" | "off-level" | "split-capability" | "unknown-object" | "object-action";
24
+ }
25
+ declare function findGrantIssues(grants: readonly unknown[], context: {
26
+ objectNames: ReadonlySet<string>;
27
+ }): GrantIssue[];
28
+ //#endregion
29
+ //#region src/exceptions.d.ts
30
+ /**
31
+ * Error codes for schema exceptions
32
+ */
33
+ declare const SchemaErrorCode: {
34
+ readonly CONNECTOR_INVALID_SIGNATURE: "SCHEMA_CONNECTOR_INVALID_SIGNATURE";
35
+ readonly DRAFT_REVISION_CONFLICT: "DRAFT_REVISION_CONFLICT";
36
+ readonly UNKNOWN: "SCHEMA_UNKNOWN_ERROR";
37
+ readonly OBJECT_NOT_FOUND: "SCHEMA_OBJECT_NOT_FOUND";
38
+ readonly ATTRIBUTE_NOT_FOUND: "SCHEMA_ATTRIBUTE_NOT_FOUND";
39
+ readonly RECORD_NOT_FOUND: "SCHEMA_RECORD_NOT_FOUND";
40
+ readonly RECORD_ID_UNAVAILABLE: "SCHEMA_RECORD_ID_UNAVAILABLE";
41
+ readonly SOURCE_NOT_FOUND: "SCHEMA_SOURCE_NOT_FOUND";
42
+ readonly NEWS_ENTRY_NOT_FOUND: "NEWS_ENTRY_NOT_FOUND";
43
+ readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
44
+ readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
45
+ readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
46
+ readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
47
+ readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
48
+ /** A consumer declared, registered, bundled or sourced an object under a framework-native name (#3450). */
49
+ readonly RESERVED_OBJECT_NAME: "SCHEMA_RESERVED_OBJECT_NAME";
50
+ readonly PROTECTED_OBJECT: "SCHEMA_PROTECTED_OBJECT";
51
+ readonly PROTECTED_ATTRIBUTE: "SCHEMA_PROTECTED_ATTRIBUTE";
52
+ readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
53
+ readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
54
+ /** A saved permission grant is outside the permission catalog (spec B1). */
55
+ readonly PERMISSION_INVALID_GRANT: "SCHEMA_PERMISSION_INVALID_GRANT";
56
+ readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
57
+ readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
58
+ /**
59
+ * A workspace RULE refuses the write — the last owner cannot be removed.
60
+ *
61
+ * Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
62
+ * "should never happen" assertion, a bug signal nobody outside the codebase
63
+ * can act on. This is the opposite — a rule the caller can act on, reached
64
+ * by a request that was entirely well-formed, whose message tells them how.
65
+ */
66
+ readonly WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT";
67
+ /** The resource's own state refuses the operation — e.g. a draft already being sent. */
68
+ readonly STATE_GATE: "SCHEMA_STATE_GATE";
69
+ /** The operation needs an actor and the request carried none. */
70
+ readonly ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED";
71
+ /**
72
+ * The same refusal at the HTTP edge, answered 401 before a contract
73
+ * operation declaring `actor: "required"` runs: the request authenticated
74
+ * but carried no actor (a host on `auth.requireUser: false`). Unprefixed on
75
+ * the wire because the hand-written routes answered exactly this code.
76
+ */
77
+ readonly ACTOR_REQUIRED: "ACTOR_CONTEXT_REQUIRED";
78
+ /**
79
+ * An admin lever's body names a tenant other than the one the caller is
80
+ * authenticated in: the body confirms intent, it never selects a target.
81
+ */
82
+ readonly TENANT_CONFIRMATION_MISMATCH: "SCHEMA_TENANT_CONFIRMATION_MISMATCH";
83
+ /** `owner` asked for a workspace API key (#5074): only a personal key may hold it. */
84
+ readonly API_KEY_OWNER_ROLE_REFUSED: "SCHEMA_API_KEY_OWNER_ROLE_REFUSED";
85
+ readonly CONNECTOR_API_FAILED: "SCHEMA_CONNECTOR_API_FAILED";
86
+ readonly CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED";
87
+ readonly CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE";
88
+ /**
89
+ * The provider issued tokens and the flow failed AFTER that — resolving the
90
+ * connected address. Distinct from CONNECTOR_AUTH_FAILED because the user is
91
+ * left holding a real grant: consent happened, and it may still be live on the
92
+ * provider side even though no connection row exists here.
93
+ */
94
+ readonly CONNECTOR_GRANT_ORPHANED: "SCHEMA_CONNECTOR_GRANT_ORPHANED";
95
+ readonly SYNC_FAILED: "SCHEMA_SYNC_FAILED";
96
+ readonly SYNC_CONFLICT: "SCHEMA_SYNC_CONFLICT";
97
+ readonly SYNC_CASCADE: "SCHEMA_SYNC_CASCADE";
98
+ readonly ORPHAN_SYSTEM_ATTRIBUTE: "SCHEMA_ORPHAN_SYSTEM_ATTRIBUTE";
99
+ readonly SYSTEM_ENTITY_IMMUTABLE: "SCHEMA_SYSTEM_ENTITY_IMMUTABLE";
100
+ readonly AMBIGUOUS_CHANGE: "SCHEMA_AMBIGUOUS_CHANGE";
101
+ readonly RECORD_GRANT_ON_WORKSPACE: "RECORD_GRANT_ON_WORKSPACE";
102
+ readonly RECORD_GRANT_INVALID_ACTOR: "RECORD_GRANT_INVALID_ACTOR";
103
+ readonly RECORD_GRANT_UNSHAREABLE_OBJECT: "RECORD_GRANT_UNSHAREABLE_OBJECT";
104
+ readonly AGENT_GRANT_ON_WORKSPACE: "AGENT_GRANT_ON_WORKSPACE";
105
+ readonly AGENT_GRANT_INVALID_ACTOR: "AGENT_GRANT_INVALID_ACTOR";
106
+ readonly PAGE_GRANT_ON_WORKSPACE: "PAGE_GRANT_ON_WORKSPACE";
107
+ readonly PAGE_GRANT_INVALID_ACTOR: "PAGE_GRANT_INVALID_ACTOR";
108
+ readonly AGENT_SCHEDULE_AUDIENCE_ON_WORKSPACE: "AGENT_SCHEDULE_AUDIENCE_ON_WORKSPACE";
109
+ readonly AGENT_SCHEDULE_AUDIENCE_HARNESS: "AGENT_SCHEDULE_AUDIENCE_HARNESS";
110
+ readonly AGENT_SCHEDULE_AUDIENCE_TOOL: "AGENT_SCHEDULE_AUDIENCE_TOOL";
111
+ readonly RECORD_COUNT_GROUP_BY_MULTI_VALUED: "RECORD_COUNT_GROUP_BY_MULTI_VALUED";
112
+ readonly RECORD_COUNT_GROUP_BY_UNSUPPORTED: "RECORD_COUNT_GROUP_BY_UNSUPPORTED";
113
+ /** A sum or average over a currency attribute holding more than one currency. */
114
+ readonly AGGREGATE_MIXED_CURRENCY: "AGGREGATE_MIXED_CURRENCY";
115
+ /** An aggregate combined with a free-text search, which it does not support. */
116
+ readonly AGGREGATE_SEARCH_UNSUPPORTED: "AGGREGATE_SEARCH_UNSUPPORTED";
117
+ readonly PAGE_REFERENCED: "PAGE_REFERENCED";
118
+ readonly DUPLICATE: "SCHEMA_DUPLICATE";
119
+ readonly DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT";
120
+ readonly DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE";
121
+ /** A second live memory page with the same profile, subject or theme key. */
122
+ readonly MEMORY_PAGE_EXISTS: "SCHEMA_MEMORY_PAGE_EXISTS";
123
+ /** propose_memory called more than the hourly budget allows for one actor. */
124
+ readonly MEMORY_PROPOSAL_RATE_LIMITED: "SCHEMA_MEMORY_PROPOSAL_RATE_LIMITED";
125
+ readonly CONFLICT: "SCHEMA_CONFLICT";
126
+ /**
127
+ * A queued record operation was rolled back unsent because an earlier
128
+ * operation of the same tab on the same record failed (client-side).
129
+ */
130
+ readonly OPERATION_ABANDONED: "SCHEMA_OPERATION_ABANDONED";
131
+ readonly STORAGE_UPLOAD_FAILED: "SCHEMA_STORAGE_UPLOAD_FAILED";
132
+ readonly STORAGE_DOWNLOAD_FAILED: "SCHEMA_STORAGE_DOWNLOAD_FAILED";
133
+ readonly STORAGE_DELETE_FAILED: "SCHEMA_STORAGE_DELETE_FAILED";
134
+ readonly STORAGE_URL_FAILED: "SCHEMA_STORAGE_URL_FAILED";
135
+ readonly REPOSITORY_CREATE_FAILED: "SCHEMA_REPOSITORY_CREATE_FAILED";
136
+ readonly REPOSITORY_UPDATE_FAILED: "SCHEMA_REPOSITORY_UPDATE_FAILED";
137
+ readonly REPOSITORY_DELETE_FAILED: "SCHEMA_REPOSITORY_DELETE_FAILED";
138
+ readonly REPOSITORY_QUERY_FAILED: "SCHEMA_REPOSITORY_QUERY_FAILED";
139
+ readonly NOT_IMPLEMENTED: "SCHEMA_NOT_IMPLEMENTED";
140
+ readonly TIMEOUT: "SCHEMA_TIMEOUT";
141
+ /** A bounded read (a page block's aggregate or list) outran its statement timeout. 504. */
142
+ readonly QUERY_TIMEOUT: "QUERY_TIMEOUT";
143
+ readonly RECORD_REFERENCED: "SCHEMA_RECORD_REFERENCED";
144
+ readonly ATTRIBUTE_IN_USE: "SCHEMA_ATTRIBUTE_IN_USE";
145
+ readonly OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED";
146
+ readonly CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED";
147
+ readonly SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED";
148
+ readonly SEARCH_BACKEND_FAILED: "SEARCH_BACKEND_FAILED";
149
+ readonly SEARCH_BACKEND_REJECTED: "SEARCH_BACKEND_REJECTED";
150
+ readonly SEARCH_PATH_NOT_INDEXED: "SEARCH_PATH_NOT_INDEXED";
151
+ readonly INVARIANT_VIOLATION: "INVARIANT_VIOLATION";
152
+ readonly TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING";
153
+ /** A Hatchet run's metadata does not match the outbox row that produced it — a forged or replayed run (403). */
154
+ readonly JOB_RUN_METADATA_MISMATCH: "JOB_RUN_METADATA_MISMATCH";
155
+ /** A coalesced run failed and the coalescing primitive already handled it (items given back or dropped and reported). */
156
+ readonly JOB_COALESCED_FAILURE_HANDLED: "JOB_COALESCED_FAILURE_HANDLED";
157
+ readonly FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT";
158
+ readonly REALTIME_RATE_LIMITED: "REALTIME_RATE_LIMITED";
159
+ readonly REALTIME_DELIVERY_FAILED: "REALTIME_DELIVERY_FAILED";
160
+ readonly REALTIME_SUBSCRIPTION_FAILED: "REALTIME_SUBSCRIPTION_FAILED";
161
+ readonly AGENT_UNKNOWN: "AGENT_UNKNOWN";
162
+ readonly AGENT_DEPTH_EXCEEDED: "AGENT_DEPTH_EXCEEDED";
163
+ readonly AGENT_COST_LIMIT_EXCEEDED: "AGENT_COST_LIMIT_EXCEEDED";
164
+ readonly AGENT_TREE_COST_LIMIT_EXCEEDED: "AGENT_TREE_COST_LIMIT_EXCEEDED";
165
+ readonly CREDITS_EXHAUSTED: "CREDITS_EXHAUSTED";
166
+ readonly QUOTA_EXCEEDED: "QUOTA_EXCEEDED";
167
+ readonly EXPORT_TOO_LARGE: "EXPORT_TOO_LARGE";
168
+ readonly AGENT_SESSION_NOT_FOUND: "AGENT_SESSION_NOT_FOUND";
169
+ readonly AGENT_DEFINITION_NOT_FOUND: "AGENT_DEFINITION_NOT_FOUND";
170
+ readonly AGENT_RUN_CONFIG: "AGENT_RUN_CONFIG";
171
+ readonly AGENT_STREAMING: "AGENT_STREAMING";
172
+ readonly AGENT_MISSING_ACTOR: "AGENT_MISSING_ACTOR";
173
+ readonly AGENT_INVALID_STATE: "AGENT_INVALID_STATE";
174
+ /** A tool group grant names no native group or known `kind:id`, or a surface that is never granted. */
175
+ readonly AGENT_TRIGGER_THREAD_BUSY: "AGENT_TRIGGER_THREAD_BUSY";
176
+ readonly AGENT_TOOL_GROUP_UNKNOWN: "AGENT_TOOL_GROUP_UNKNOWN";
177
+ /** A private resource granted to a workspace definition (or one its owner cannot see). */
178
+ readonly AGENT_TOOL_GROUP_NOT_CONTAINED: "AGENT_TOOL_GROUP_NOT_CONTAINED";
179
+ /** A connection that does not hold the scope its kind needs (e.g. read). */
180
+ readonly AGENT_TOOL_GROUP_SCOPE_MISSING: "AGENT_TOOL_GROUP_SCOPE_MISSING";
181
+ /** A definition with a harness accepts only `memory` and trusted `mcp:<id>`. */
182
+ readonly AGENT_TOOL_GROUP_HARNESS: "AGENT_TOOL_GROUP_HARNESS";
183
+ /** A device or browser granted to a routine: its runs have nobody at the keyboard. */
184
+ readonly AGENT_TOOL_GROUP_NEEDS_PERSON: "AGENT_TOOL_GROUP_NEEDS_PERSON";
185
+ /** The `notifications` group granted to a non-routine: a conversation has no run to notify from. */
186
+ readonly AGENT_TOOL_GROUP_ROUTINE_ONLY: "AGENT_TOOL_GROUP_ROUTINE_ONLY";
187
+ /** A grant lacks a required tool group, such as GitHub without sandbox. */
188
+ readonly AGENT_TOOL_GROUP_REQUIRES: "AGENT_TOOL_GROUP_REQUIRES";
189
+ readonly AGENT_COMPACTION_IMPOSSIBLE: "AGENT_COMPACTION_IMPOSSIBLE";
190
+ readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
191
+ readonly AGENT_SESSION_OWNER_FENCED: "AGENT_SESSION_OWNER_FENCED";
192
+ readonly AGENT_TURN_RESUME_EXHAUSTED: "AGENT_TURN_RESUME_EXHAUSTED";
193
+ readonly AGENT_SESSION_STREAM_CURSOR_EXPIRED: "AGENT_SESSION_STREAM_CURSOR_EXPIRED";
194
+ readonly AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND";
195
+ readonly AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE";
196
+ readonly INVALID_TOOL_INPUT: "INVALID_TOOL_INPUT";
197
+ readonly TOOL_FAILED: "TOOL_FAILED";
198
+ readonly REFERENCE_NOT_FOUND: "REFERENCE_NOT_FOUND";
199
+ readonly REFERENCE_INVALID: "REFERENCE_INVALID";
200
+ readonly CAPABILITY_UNAVAILABLE: "CAPABILITY_UNAVAILABLE";
201
+ readonly EDIT_MATCH_NOT_FOUND: "EDIT_MATCH_NOT_FOUND";
202
+ readonly EDIT_MATCH_AMBIGUOUS: "EDIT_MATCH_AMBIGUOUS";
203
+ readonly EDIT_NO_CHANGE: "EDIT_NO_CHANGE";
204
+ readonly EDIT_TARGET_UNAVAILABLE: "EDIT_TARGET_UNAVAILABLE";
205
+ readonly EDIT_TARGET_UNSUPPORTED: "EDIT_TARGET_UNSUPPORTED";
206
+ readonly AGENT_EXECUTION_CANCELLED: "AGENT_EXECUTION_CANCELLED";
207
+ readonly AGENT_EXECUTION_TIMEOUT: "AGENT_EXECUTION_TIMEOUT";
208
+ readonly AGENT_TURN_FINALIZER_STALLED: "AGENT_TURN_FINALIZER_STALLED";
209
+ readonly ENVIRONMENT_NOT_READY: "ENVIRONMENT_NOT_READY";
210
+ readonly ENVIRONMENT_IN_USE: "ENVIRONMENT_IN_USE";
211
+ readonly ENVIRONMENT_MODEL_ACCESS_MISSING: "ENVIRONMENT_MODEL_ACCESS_MISSING";
212
+ readonly ENVIRONMENT_BUILD_FAILED: "ENVIRONMENT_BUILD_FAILED";
213
+ readonly ENVIRONMENT_RUN_FAILED: "ENVIRONMENT_RUN_FAILED";
214
+ readonly SANDBOX_PROVIDER_FAILED: "SANDBOX_PROVIDER_FAILED";
215
+ readonly CLOUD_BROWSER_LAUNCH_FAILED: "CLOUD_BROWSER_LAUNCH_FAILED";
216
+ readonly CLOUD_BROWSER_PROVIDER_FAILED: "CLOUD_BROWSER_PROVIDER_FAILED";
217
+ readonly CLOUD_BROWSER_EXTENSION_TIMEOUT: "CLOUD_BROWSER_EXTENSION_TIMEOUT";
218
+ readonly CLOUD_BROWSER_CLOSED: "CLOUD_BROWSER_CLOSED";
219
+ readonly BROWSER_PROFILE_LOCKED: "BROWSER_PROFILE_LOCKED";
220
+ readonly DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND";
221
+ readonly DEVICE_OFFLINE: "DEVICE_OFFLINE";
222
+ readonly DEVICE_CAPABILITY_MISMATCH: "DEVICE_CAPABILITY_MISMATCH";
223
+ readonly DEVICE_CHANNEL_PROTOCOL: "DEVICE_CHANNEL_PROTOCOL";
224
+ readonly DEVICE_CONTROL_ELSEWHERE: "DEVICE_CONTROL_ELSEWHERE";
225
+ readonly DEVICE_CONTROL_REVOKED: "DEVICE_CONTROL_REVOKED";
226
+ readonly AI_UNKNOWN: "AI_UNKNOWN";
227
+ readonly AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED";
228
+ readonly AI_INVALID_USAGE: "AI_INVALID_USAGE";
229
+ readonly AI_INVALID_MODEL: "AI_INVALID_MODEL";
230
+ readonly AI_INVALID_MODEL_INPUT: "AI_INVALID_MODEL_INPUT";
231
+ readonly AI_REPOSITORY_ERROR: "AI_REPOSITORY_ERROR";
232
+ readonly AI_GENERATION_FAILED: "AI_GENERATION_FAILED";
233
+ readonly AI_DECISION_FAILED: "AI_DECISION_FAILED";
234
+ readonly AI_IMAGE_USAGE_PENDING: "AI_IMAGE_USAGE_PENDING";
235
+ readonly AI_IMAGE_GENERATION_INDETERMINATE: "AI_IMAGE_GENERATION_INDETERMINATE";
236
+ readonly AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE: "AI_IMAGE_RESERVATION_CLEANUP_INDETERMINATE";
237
+ readonly AI_IMAGE_PUBLICATION_FAILED: "AI_IMAGE_PUBLICATION_FAILED";
238
+ readonly FILE_PUBLIC_NOT_ATTACHABLE: "FILE_PUBLIC_NOT_ATTACHABLE";
239
+ readonly DOCUMENT_MIME_NOT_ACCEPTED: "DOCUMENT_MIME_NOT_ACCEPTED";
240
+ readonly DOCUMENT_MULTIPLE_NOT_ALLOWED: "DOCUMENT_MULTIPLE_NOT_ALLOWED";
241
+ readonly DOCUMENT_NOT_FOUND_FOR_OPERATION: "DOCUMENT_NOT_FOUND_FOR_OPERATION";
242
+ readonly DOCUMENT_STORAGE_FAILED: "DOCUMENT_STORAGE_FAILED";
243
+ readonly DOCUMENT_SIZE_EXCEEDED: "DOCUMENT_SIZE_EXCEEDED";
244
+ readonly DOCUMENT_OCR_FAILED: "DOCUMENT_OCR_FAILED";
245
+ readonly DOCUMENT_BLOB_EMPTY: "DOCUMENT_BLOB_EMPTY";
246
+ readonly DOCUMENT_FILE_TOO_LARGE: "DOCUMENT_FILE_TOO_LARGE";
247
+ readonly DOCUMENT_FILE_NOT_FOUND: "DOCUMENT_FILE_NOT_FOUND";
248
+ readonly DOCUMENT_FILE_ALREADY_PACKED: "DOCUMENT_FILE_ALREADY_PACKED";
249
+ readonly DOCUMENT_RECORD_NOT_FOUND: "DOCUMENT_RECORD_NOT_FOUND";
250
+ readonly DOCUMENT_RECORD_OBJECT_MISMATCH: "DOCUMENT_RECORD_OBJECT_MISMATCH";
251
+ readonly DOCUMENT_FOLDER_SERVICE_UNAVAILABLE: "DOCUMENT_FOLDER_SERVICE_UNAVAILABLE";
252
+ readonly DOCUMENT_FOLDER_PATH_NOT_FOUND: "DOCUMENT_FOLDER_PATH_NOT_FOUND";
253
+ readonly EMAIL_PROVIDER_API_FAILED: "EMAIL_PROVIDER_API_FAILED";
254
+ readonly EMAIL_SEND_FAILED: "EMAIL_SEND_FAILED";
255
+ readonly EMAIL_SENT_NOT_STORED: "EMAIL_SENT_NOT_STORED";
256
+ readonly EMAIL_BATCH_ITEM_FAILED: "EMAIL_BATCH_ITEM_FAILED";
257
+ /** A read or write a mailbox-scoped EmailService cannot narrow to its granted mailboxes: refused rather than served tenant-wide. */
258
+ readonly EMAIL_SCOPE_UNSUPPORTED: "EMAIL_SCOPE_UNSUPPORTED";
259
+ /** A mailbox scope already holds the maximum number of custom categories. */
260
+ readonly EMAIL_CATEGORY_LIMIT: "EMAIL_CATEGORY_LIMIT";
261
+ readonly CALENDAR_PROVIDER_API_FAILED: "CALENDAR_PROVIDER_API_FAILED";
262
+ /** The embeddings feature is enabled but no Gateway credential is configured. */
263
+ readonly EMBEDDING_MODEL_UNAVAILABLE: "EMBEDDING_MODEL_UNAVAILABLE";
264
+ /** The provider returned vectors whose length differs from the configured dimensions. */
265
+ readonly EMBEDDING_DIMENSION_MISMATCH: "EMBEDDING_DIMENSION_MISMATCH";
266
+ };
267
+ type SchemaErrorCode = (typeof SchemaErrorCode)[keyof typeof SchemaErrorCode];
268
+ /**
269
+ * Base error class for all schema-related errors
270
+ */
271
+ /** What a `SchemaError` serialises to; a subclass may withhold `name` and `details`. */
272
+ interface SchemaErrorJson {
273
+ code: SchemaErrorCode;
274
+ message: string;
275
+ name?: string;
276
+ details?: Record<string, unknown>;
277
+ }
278
+ declare class SchemaError extends Error {
279
+ readonly code: SchemaErrorCode;
280
+ readonly details?: Record<string, unknown>;
281
+ constructor(message: string, code?: SchemaErrorCode, details?: Record<string, unknown>);
282
+ toJSON(): SchemaErrorJson;
283
+ }
284
+ /**
285
+ * Base class for "not found" errors
286
+ */
287
+ declare class NotFoundError extends SchemaError {
288
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
289
+ readonly _tag = "NotFoundError";
290
+ readonly resourceType: string;
291
+ readonly resourceId: string;
292
+ constructor(resourceType: string, resourceId: string, code?: SchemaErrorCode, message?: string);
293
+ }
294
+ /**
295
+ * Object not found error
296
+ */
297
+ declare class ObjectNotFoundError extends NotFoundError {
298
+ constructor(objectId: string);
299
+ }
300
+ /**
301
+ * Attribute not found error
302
+ */
303
+ declare class AttributeNotFoundError extends NotFoundError {
304
+ constructor(attributeId: string);
305
+ }
306
+ /**
307
+ * Record not found error
308
+ */
309
+ declare class RecordNotFoundError extends NotFoundError {
310
+ constructor(recordId: string);
311
+ }
312
+ /**
313
+ * Validation error with field-level details
314
+ */
315
+ interface ValidationErrorDetail {
316
+ path: string[];
317
+ message: string;
318
+ code?: string;
319
+ }
320
+ /**
321
+ * Validation error thrown when data fails schema validation
322
+ */
323
+ declare class ValidationError extends SchemaError {
324
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
325
+ readonly _tag = "ValidationError";
326
+ readonly errors: ValidationErrorDetail[];
327
+ constructor(message: string, errors: ValidationErrorDetail[]);
328
+ /**
329
+ * Create a validation error from Zod-style errors
330
+ */
331
+ static fromZodErrors(errors: Array<{
332
+ path: (string | number)[];
333
+ message: string;
334
+ }>): ValidationError;
335
+ }
336
+ /**
337
+ * A system attribute change the code alone cannot disambiguate: a stored
338
+ * system attribute that disappeared alongside a new one of the same type
339
+ * (rename or drop + add?), or a retype whose stored values the new type cannot
340
+ * read. Refused at boot and at source push; resolved by a hand-written SQL
341
+ * migration, by shipping a real removal and addition in separate deploys, or —
342
+ * on a source push, for a rename or a `text → phone` / `number → currency`
343
+ * retype — by the resolution the refusal names (#4362).
344
+ * HTTP status: 400 Bad Request.
345
+ *
346
+ * The first detail's `path[0]` is the declared attribute name, so the boot
347
+ * report pins the refusal to it.
348
+ */
349
+ declare class AmbiguousSchemaChangeError extends ValidationError {
350
+ readonly code: "SCHEMA_AMBIGUOUS_CHANGE";
351
+ constructor(message: string, errors: ValidationErrorDetail[]);
352
+ }
353
+ type AggregateErrorCode = typeof SchemaErrorCode.AGGREGATE_MIXED_CURRENCY | typeof SchemaErrorCode.AGGREGATE_SEARCH_UNSUPPORTED;
354
+ /**
355
+ * An aggregate request the runtime cannot answer (`AGGREGATE_*` codes).
356
+ * HTTP status: 400 Bad Request.
357
+ */
358
+ declare class AggregateValidationError extends ValidationError {
359
+ readonly code: AggregateErrorCode;
360
+ constructor(code: AggregateErrorCode, message: string, errors?: ValidationErrorDetail[]);
361
+ }
362
+ /** A `content.page` tab that references a page: the record view holding it. */
363
+ interface PageReference {
364
+ object: string;
365
+ view: string;
366
+ content: string;
367
+ }
368
+ /**
369
+ * A page that `content.page` tabs still reference: deleting it or making it
370
+ * private would leave those tabs pointing at nothing (or at a page their
371
+ * readers cannot see). Lists every referencing tab.
372
+ * HTTP status: 400 Bad Request.
373
+ */
374
+ declare class PageReferencedError extends ValidationError {
375
+ readonly code: "PAGE_REFERENCED";
376
+ readonly references: PageReference[];
377
+ constructor(message: string, references: PageReference[]);
378
+ }
379
+ type ToolGroupGrantErrorCode = typeof SchemaErrorCode.AGENT_TOOL_GROUP_UNKNOWN | typeof SchemaErrorCode.AGENT_TOOL_GROUP_NOT_CONTAINED | typeof SchemaErrorCode.AGENT_TOOL_GROUP_SCOPE_MISSING | typeof SchemaErrorCode.AGENT_TOOL_GROUP_HARNESS | typeof SchemaErrorCode.AGENT_TOOL_GROUP_NEEDS_PERSON | typeof SchemaErrorCode.AGENT_TOOL_GROUP_ROUTINE_ONLY | typeof SchemaErrorCode.AGENT_TOOL_GROUP_REQUIRES;
380
+ /**
381
+ * A `toolGroups` entry refused by `assertToolGroupsGrantable`.
382
+ * HTTP status: 400 Bad Request.
383
+ */
384
+ declare class ToolGroupGrantError extends ValidationError {
385
+ readonly code: ToolGroupGrantErrorCode;
386
+ readonly grant: string;
387
+ constructor(code: ToolGroupGrantErrorCode, grant: string, message: string);
388
+ }
389
+ /**
390
+ * Error thrown when attempting to modify a protected (system) resource
391
+ */
392
+ declare class ProtectedResourceError extends SchemaError {
393
+ readonly resourceType: "object" | "attribute" | "view";
394
+ readonly resourceName: string;
395
+ readonly operation: "delete" | "modify";
396
+ constructor(resourceType: "object" | "attribute" | "view", resourceName: string, operation: "delete" | "modify");
397
+ }
398
+ /**
399
+ * Error thrown during native object synchronization
400
+ */
401
+ declare class SyncError extends SchemaError {
402
+ readonly objectName: string;
403
+ readonly cause?: Error;
404
+ constructor(objectName: string, message: string, cause?: Error);
405
+ }
406
+ /**
407
+ * Thrown when code tries to mutate a system entity at runtime.
408
+ * System entities are declared in code and immutable at runtime.
409
+ * HTTP status: 403 Forbidden.
410
+ */
411
+ declare class SystemEntityImmutableError extends SchemaError {
412
+ readonly entityType: string;
413
+ readonly entityName: string;
414
+ constructor(entityType: string, entityName: string);
415
+ }
416
+ interface SyncConflictParams {
417
+ objectName: string;
418
+ attributeName?: string;
419
+ reason: string;
420
+ }
421
+ /**
422
+ * Thrown at boot when an auto-promote cannot proceed due to incompatible types
423
+ * or constraints. The dev must resolve manually (relax constraints, migrate
424
+ * values, or rename).
425
+ */
426
+ declare class SyncConflictError extends SchemaError {
427
+ readonly objectName: string;
428
+ readonly attributeName?: string;
429
+ readonly reason: string;
430
+ constructor(params: SyncConflictParams);
431
+ }
432
+ /**
433
+ * Thrown at boot when an object is being demoted but still has system attributes
434
+ * declared in code. The dev forgot to remove those attributes too, or kept the
435
+ * object inconsistently.
436
+ */
437
+ declare class SyncCascadeError extends SchemaError {
438
+ readonly objectName: string;
439
+ readonly conflictingAttributes: string[];
440
+ constructor(objectName: string, conflictingAttributes: string[]);
441
+ }
442
+ /**
443
+ * Thrown at boot when an attribute is system:true but its object parent is
444
+ * system:false. This invariant should never be violated — if seen, it's a bug
445
+ * in the boot reconciliation logic or in a manual DB mutation.
446
+ */
447
+ declare class OrphanSystemAttributeError extends SchemaError {
448
+ readonly objectName: string;
449
+ readonly attributeName: string;
450
+ constructor(objectName: string, attributeName: string);
451
+ }
452
+ /**
453
+ * Error thrown when attempting to create a duplicate resource.
454
+ *
455
+ * `resourceType` is free-form: pass `"object"`/`"attribute"` for schema
456
+ * resources (a specific code is selected automatically), or any domain label
457
+ * (`"tool"`, `"background job handler"`, …) for runtime registries, which fall
458
+ * back to the generic `DUPLICATE` code. The default message is
459
+ * `'<ResourceType> "<name>" already exists'`; pass a custom message when the
460
+ * domain reads better with different wording (e.g. "already registered for
461
+ * type X").
462
+ */
463
+ declare class DuplicateError extends SchemaError {
464
+ readonly resourceType: string;
465
+ readonly resourceName: string;
466
+ constructor(resourceType: string, resourceName: string, message?: string);
467
+ }
468
+ /**
469
+ * A consumer tried to build, register, bundle or source an object under a name
470
+ * the framework owns (`skill`, `memory`, `drives`, `artifact`, `meeting`).
471
+ * Raised at declaration time so the collision fails in the consumer's own
472
+ * tests, never at boot: the platform's `wealth-manager` bundle once shipped
473
+ * `meeting` and hid the native calendar object from every tenant for three
474
+ * days (#3450).
475
+ */
476
+ declare const RESERVED_NAME_CONTEXTS: {
477
+ readonly builder: "cannot be built by a consumer";
478
+ readonly registry: "cannot be registered by a consumer";
479
+ readonly bundle: "cannot be claimed by a bundle";
480
+ readonly source: "cannot be declared by a schema source";
481
+ };
482
+ declare class ReservedObjectNameError extends SchemaError {
483
+ readonly objectName: string;
484
+ constructor(objectName: string, context: keyof typeof RESERVED_NAME_CONTEXTS);
485
+ }
486
+ /**
487
+ * Check if an error is a SchemaError
488
+ */
489
+ declare function isSchemaError(error: unknown): error is SchemaError;
490
+ /**
491
+ * Check if an error is a NotFoundError
492
+ */
493
+ declare function isNotFoundError(error: unknown): error is NotFoundError;
494
+ /**
495
+ * Check if an error is a ValidationError
496
+ */
497
+ declare function isValidationError(error: unknown): error is ValidationError;
498
+ /**
499
+ * Check if an error is a ProtectedResourceError
500
+ */
501
+ declare function isProtectedResourceError(error: unknown): error is ProtectedResourceError;
502
+ /**
503
+ * Error thrown when a user lacks permission to perform an action.
504
+ *
505
+ * That, and nothing else (#2681) — its message is redacted, so it must not
506
+ * carry a refusal a permission grant would not lift: use `WORKSPACE_INVARIANT`,
507
+ * `STATE_GATE`, `ACTOR_CONTEXT_REQUIRED` or `SYSTEM_ENTITY_IMMUTABLE` instead.
508
+ */
509
+ declare class ForbiddenError extends SchemaError {
510
+ /** Literal discriminator for `Effect.catchTag`; a widened `string` breaks narrowing. */
511
+ readonly _tag = "ForbiddenError";
512
+ readonly objectName: string;
513
+ readonly action: string;
514
+ readonly userId?: string;
515
+ constructor(objectName: string, action: string, userId?: string);
516
+ }
517
+ /**
518
+ * Error thrown when trying to modify a protected role
519
+ */
520
+ declare class ProtectedRoleError extends SchemaError {
521
+ readonly roleName: string;
522
+ readonly operation: "delete" | "modify";
523
+ constructor(roleName: string, operation: "delete" | "modify");
524
+ }
525
+ /**
526
+ * Error thrown when a saved permission grant falls outside the permission
527
+ * catalog (spec B1): an unknown resource, a level the catalog never declared,
528
+ * a split capability, an unknown object, or a shape the schema rejects.
529
+ */
530
+ declare class InvalidPermissionGrantError extends SchemaError {
531
+ readonly issues: GrantIssue[];
532
+ readonly _tag = "InvalidPermissionGrantError";
533
+ constructor(issues: GrantIssue[]);
534
+ }
535
+ /**
536
+ * Role not found error
537
+ */
538
+ declare class RoleNotFoundError extends NotFoundError {
539
+ constructor(roleId: string);
540
+ }
541
+ /**
542
+ * Thrown when a record has been modified by another request between read and write.
543
+ * Clients should retry the operation with fresh data.
544
+ * Maps to HTTP 409 Conflict.
545
+ */
546
+ declare class ConcurrentModificationError extends SchemaError {
547
+ constructor(recordId: string);
548
+ }
549
+ /**
550
+ * Storage operation type for error context
551
+ */
552
+ type StorageOperation = "upload" | "download" | "delete" | "signedUrl";
553
+ /**
554
+ * Error thrown when a storage operation fails
555
+ */
556
+ declare class StorageError extends SchemaError {
557
+ readonly operation: StorageOperation;
558
+ readonly path?: string;
559
+ readonly cause?: string;
560
+ constructor(operation: StorageOperation, message: string, path?: string, cause?: string);
561
+ }
562
+ /**
563
+ * Error thrown when access to a resource is denied (e.g., tenant path mismatch)
564
+ */
565
+ declare class AccessDeniedError extends SchemaError {
566
+ readonly resource: string;
567
+ readonly reason?: string;
568
+ constructor(resource: string, reason?: string);
569
+ }
570
+ /**
571
+ * Repository operation type for error context
572
+ */
573
+ type RepositoryOperation = "create" | "update" | "delete" | "query";
574
+ /**
575
+ * Error thrown when a repository operation fails
576
+ */
577
+ declare class RepositoryError extends SchemaError {
578
+ readonly operation: RepositoryOperation;
579
+ readonly entity: string;
580
+ readonly cause?: string;
581
+ constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
582
+ }
583
+ /**
584
+ * Why a search backend call failed, as far as retrying is concerned.
585
+ *
586
+ * - `unavailable` — transport-level or otherwise transient: the backend was
587
+ * unreachable, answered garbage, or a task failed for a reason a later
588
+ * attempt may not meet. Worth retrying.
589
+ * - `capacity` — the backend is out of storage (disk full, database size
590
+ * limit). Every retry fails the same way, and on a full disk each one
591
+ * allocates more temporary files.
592
+ * - `rejected` — the backend refused this payload (malformed, too large).
593
+ * Deterministic: the same payload is refused again.
594
+ */
595
+ type SearchBackendFailureKind = "unavailable" | "capacity" | "rejected";
596
+ interface SearchBackendErrorOptions {
597
+ /** Defaults to `unavailable`. */
598
+ kind?: SearchBackendFailureKind;
599
+ /** The backend's own machine code, e.g. Meili's `malformed_payload`. */
600
+ backendCode?: string;
601
+ /**
602
+ * A fixed phrase the adapter chose from what it recognised — e.g.
603
+ * "No space left on device (os error 28)". Never raw backend text: the
604
+ * message is exported to telemetry as a template.
605
+ */
606
+ detail?: string;
607
+ }
608
+ /**
609
+ * Error thrown when a search backend call fails — e.g. the Meili client
610
+ * received a non-JSON body (`JSON.parse` SyntaxError), a network failure, or
611
+ * a write the backend refused. Translates an otherwise un-fingerprintable bare
612
+ * exception into a typed error with a stable `code` and a user-safe message.
613
+ * The original failure text is preserved in `cause`/`details`, never in the
614
+ * message.
615
+ *
616
+ * A refusal the backend will repeat (`capacity`, `rejected`, #4306) takes
617
+ * `SEARCH_BACKEND_REJECTED` and names the backend's code and the adapter's
618
+ * fixed `detail` in its message, so a full disk pages as itself rather than
619
+ * as a transient outage.
620
+ */
621
+ declare class SearchBackendError extends SchemaError {
622
+ readonly scope: string;
623
+ readonly cause?: string;
624
+ readonly kind: SearchBackendFailureKind;
625
+ readonly backendCode?: string;
626
+ constructor(scope: string, cause?: string, options?: SearchBackendErrorOptions);
627
+ }
628
+ /**
629
+ * A search read the backend refused because a filter or sort names a path it
630
+ * cannot filter or sort on yet: the index's settings lag the schema (a newly
631
+ * created attribute until its settings write lands). Retrying soon may
632
+ * succeed; the records query service answers the read through Postgres
633
+ * instead, so a search never returns a wrong or failed answer for it.
634
+ */
635
+ declare class SearchPathNotIndexedError extends SchemaError {
636
+ readonly scope: string;
637
+ readonly role: "filter" | "sort";
638
+ readonly cause?: string;
639
+ constructor(scope: string, role: "filter" | "sort", cause?: string);
640
+ }
641
+ /**
642
+ * Error thrown when a feature or method is not yet implemented
643
+ */
644
+ declare class NotImplementedError extends SchemaError {
645
+ readonly feature: string;
646
+ readonly milestone?: string;
647
+ constructor(feature: string, milestone?: string);
648
+ }
649
+ /**
650
+ * Memory entry not found error
651
+ */
652
+ declare class MemoryNotFoundError extends NotFoundError {
653
+ constructor(memoryId: string);
654
+ }
655
+ /**
656
+ * Reference information for a record that is blocking deletion.
657
+ */
658
+ interface RecordReference {
659
+ /** Technical name of the object (e.g., "contacts") */
660
+ objectName: string;
661
+ /** Display label of the object (e.g., "Contacts") */
662
+ objectLabel: string;
663
+ /** Number of records referencing the target */
664
+ count: number;
665
+ }
666
+ /**
667
+ * Thrown when attempting to delete a record that is referenced by other records.
668
+ *
669
+ * This implements the "Restrict" behavior: deletion is blocked and the user
670
+ * must first remove or update the referencing records.
671
+ */
672
+ declare class RecordReferencedError extends SchemaError {
673
+ readonly recordId: string;
674
+ readonly references: RecordReference[];
675
+ constructor(recordId: string, references: RecordReference[]);
676
+ }
677
+ /**
678
+ * Usage context where an attribute is being used.
679
+ */
680
+ type AttributeUsage = "labelExpression" | "embeddingExpression" | "view" | "filter";
681
+ /**
682
+ * Thrown when attempting to delete an attribute that is in use.
683
+ *
684
+ * Attributes cannot be deleted if they are referenced in:
685
+ * - The object's labelExpression template
686
+ * - A saved view's column configuration
687
+ * - A saved filter condition
688
+ */
689
+ declare class AttributeInUseError extends SchemaError {
690
+ readonly attributeName: string;
691
+ readonly usage: AttributeUsage;
692
+ /** Where exactly, when the usage alone would not let the caller find it. */
693
+ readonly location?: string;
694
+ constructor(attributeName: string, usage: AttributeUsage, location?: string);
695
+ }
696
+ /**
697
+ * Thrown when attempting to delete an object that is a relation target.
698
+ *
699
+ * Objects cannot be deleted if other objects have relation attributes
700
+ * pointing to them as a target.
701
+ */
702
+ declare class ObjectReferencedError extends SchemaError {
703
+ readonly objectName: string;
704
+ readonly referencingObjects: string[];
705
+ constructor(objectName: string, referencingObjects: string[]);
706
+ }
707
+ /**
708
+ * Supabase Realtime refused a publish because the channel was rate limited.
709
+ *
710
+ * Lives here rather than beside the publisher so the browser channel client and
711
+ * the server publisher can share one error vocabulary without either package
712
+ * depending on the other.
713
+ */
714
+ declare class RealtimeRateLimitedError extends SchemaError {
715
+ constructor();
716
+ }
717
+ /**
718
+ * A record export whose scope holds more rows than the export cap. Raised
719
+ * before the first CSV byte, so the transport can still answer JSON — or, when
720
+ * the scope grew past the cap during the read, mid-stream (`atLeast`: the
721
+ * total is a lower bound), where the transport destroys the connection.
722
+ */
723
+ declare class ExportTooLargeError extends SchemaError {
724
+ constructor(total: number, max: number, { atLeast }?: {
725
+ atLeast?: boolean;
726
+ });
727
+ }
728
+ /**
729
+ * A bounded read outran its `statement_timeout` (SQLSTATE 57014): a page
730
+ * block's aggregate or list. The caller may retry; nothing was written.
731
+ * HTTP status: 504 Gateway Timeout.
732
+ */
733
+ declare class QueryTimeoutError extends SchemaError {
734
+ constructor();
735
+ }
736
+ /**
737
+ * A Supabase Realtime publish did not reach the channel.
738
+ */
739
+ declare class RealtimeDeliveryError extends SchemaError {
740
+ constructor();
741
+ }
742
+ /**
743
+ * A Supabase Realtime channel could not be subscribed to.
744
+ */
745
+ declare class RealtimeSubscriptionError extends SchemaError {
746
+ constructor();
747
+ }
748
+ /**
749
+ * Check if an error is a RecordReferencedError
750
+ */
751
+ declare function isRecordReferencedError(error: unknown): error is RecordReferencedError;
752
+ /**
753
+ * Check if an error is an AttributeInUseError
754
+ */
755
+ declare function isAttributeInUseError(error: unknown): error is AttributeInUseError;
756
+ /**
757
+ * Check if an error is an ObjectReferencedError
758
+ */
759
+ declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
760
+ //#endregion
761
+ export { isObjectReferencedError as $, RepositoryError as A, SearchPathNotIndexedError as B, QueryTimeoutError as C, RecordNotFoundError as D, RealtimeSubscriptionError as E, SchemaErrorCode as F, SyncError as G, StorageOperation as H, SchemaErrorJson as I, ToolGroupGrantErrorCode as J, SystemEntityImmutableError as K, SearchBackendError as L, ReservedObjectNameError as M, RoleNotFoundError as N, RecordReference as O, SchemaError as P, isNotFoundError as Q, SearchBackendErrorOptions as R, ProtectedRoleError as S, RealtimeRateLimitedError as T, SyncCascadeError as U, StorageError as V, SyncConflictError as W, ValidationErrorDetail as X, ValidationError as Y, isAttributeInUseError as Z, ObjectReferencedError as _, AttributeInUseError as a, PERMISSION_ACTIONS as at, PageReferencedError as b, ConcurrentModificationError as c, permissionGrantSchema as ct, ForbiddenError as d, isProtectedResourceError as et, InvalidPermissionGrantError as f, ObjectNotFoundError as g, NotImplementedError as h, AmbiguousSchemaChangeError as i, GrantIssue as it, RepositoryOperation as j, RecordReferencedError as k, DuplicateError as l, NotFoundError as m, AggregateErrorCode as n, isSchemaError as nt, AttributeNotFoundError as o, PermissionGrant as ot, MemoryNotFoundError as p, ToolGroupGrantError as q, AggregateValidationError as r, isValidationError as rt, AttributeUsage as s, findGrantIssues as st, AccessDeniedError as t, isRecordReferencedError as tt, ExportTooLargeError as u, OrphanSystemAttributeError as v, RealtimeDeliveryError as w, ProtectedResourceError as x, PageReference as y, SearchBackendFailureKind as z };