@stndrds/schema 1.0.0-alpha.280 → 1.0.0-alpha.282

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 (75) hide show
  1. package/dist/{all-Ig0ig9wp.d.ts → all-C3EaFLCU.d.ts} +7 -17
  2. package/dist/{all-C0hXd79K.d.mts → all-CQMswOrw.d.mts} +7 -17
  3. package/dist/{attributes-D8eHv5Kf.d.ts → attributes-CU871AfG.d.ts} +12 -12
  4. package/dist/{attributes--M1ifW8_.d.mts → attributes-DoiGyNFk.d.mts} +12 -12
  5. package/dist/{chunk-FAEOVIDJ.js → chunk-DIMTNM3F.js} +7 -3
  6. package/dist/{chunk-NUEIGMYS.mjs → chunk-EFSS7PGC.mjs} +1 -1
  7. package/dist/{chunk-XDA5PZRT.mjs → chunk-HOVUEYEQ.mjs} +34 -0
  8. package/dist/{chunk-MXYCCUNB.js → chunk-KIMECN6D.js} +68 -44
  9. package/dist/{chunk-M3WFXOA4.js → chunk-L4KLYMUI.js} +34 -0
  10. package/dist/{chunk-XTBGGJ3G.js → chunk-LBGLB443.js} +3 -3
  11. package/dist/{chunk-PUMM6SPY.mjs → chunk-PLTLAMWJ.mjs} +1 -1
  12. package/dist/{chunk-TBAD2T7Q.mjs → chunk-QGRYOIHT.mjs} +37 -13
  13. package/dist/{chunk-MSIGO7JA.mjs → chunk-R34LOMT7.mjs} +5 -1
  14. package/dist/{chunk-3PGLMGTR.js → chunk-V4MZOTLV.js} +4 -4
  15. package/dist/exceptions.d.mts +22 -3
  16. package/dist/exceptions.d.ts +22 -3
  17. package/dist/exceptions.js +39 -39
  18. package/dist/exceptions.mjs +1 -1
  19. package/dist/{helpers-DyoPqiSz.d.ts → helpers-BNr-Dppk.d.ts} +3 -3
  20. package/dist/{helpers-BiABdSxK.d.mts → helpers-CfEOUBmB.d.mts} +3 -3
  21. package/dist/{index-SpFpkWVC.d.ts → index-Br7koyHF.d.ts} +53 -27
  22. package/dist/{index-C3P5Dnwt.d.mts → index-D9XBjFnu.d.mts} +53 -27
  23. package/dist/index.d.mts +568 -151
  24. package/dist/index.d.ts +568 -151
  25. package/dist/index.js +1389 -292
  26. package/dist/index.mjs +1174 -99
  27. package/dist/{migrations-B1kkIhIX.d.ts → migrations-BGWgXHXb.d.ts} +1 -1
  28. package/dist/{migrations-BNlQVzDC.d.mts → migrations-C-GN1xx_.d.mts} +1 -1
  29. package/dist/{objects-DmMqHn3L.d.mts → objects-BRypaBpi.d.mts} +2 -4
  30. package/dist/{objects-DgFojgwH.d.ts → objects-BiOMwzLL.d.ts} +2 -4
  31. package/dist/{types-DHqXzkgW.d.mts → types-80c2rOUZ.d.mts} +1 -1
  32. package/dist/{types-DYYFto8d.d.ts → types-DqYz8Iv_.d.ts} +1 -1
  33. package/dist/utils.js +8 -8
  34. package/dist/utils.mjs +2 -2
  35. package/dist/validation/all.d.mts +7 -7
  36. package/dist/validation/all.d.ts +7 -7
  37. package/dist/validation/all.js +29 -29
  38. package/dist/validation/all.mjs +4 -4
  39. package/dist/validation/complex/currency.d.mts +2 -2
  40. package/dist/validation/complex/currency.d.ts +2 -2
  41. package/dist/validation/complex/location.d.mts +2 -2
  42. package/dist/validation/complex/location.d.ts +2 -2
  43. package/dist/validation/complex/phone.d.mts +2 -2
  44. package/dist/validation/complex/phone.d.ts +2 -2
  45. package/dist/validation/complex/relation.d.mts +2 -2
  46. package/dist/validation/complex/relation.d.ts +2 -2
  47. package/dist/validation/complex/richtext.d.mts +2 -2
  48. package/dist/validation/complex/richtext.d.ts +2 -2
  49. package/dist/validation/complex/select.d.mts +2 -2
  50. package/dist/validation/complex/select.d.ts +2 -2
  51. package/dist/validation/complex/user.d.mts +2 -2
  52. package/dist/validation/complex/user.d.ts +2 -2
  53. package/dist/validation/computed/formula.d.mts +2 -2
  54. package/dist/validation/computed/formula.d.ts +2 -2
  55. package/dist/validation/computed/rollup.d.mts +2 -2
  56. package/dist/validation/computed/rollup.d.ts +2 -2
  57. package/dist/validation/config/index.d.mts +4 -4
  58. package/dist/validation/config/index.d.ts +4 -4
  59. package/dist/validation/config/index.js +11 -11
  60. package/dist/validation/config/index.mjs +2 -2
  61. package/dist/validation/core/index.d.mts +3 -3
  62. package/dist/validation/core/index.d.ts +3 -3
  63. package/dist/validation/object/index.d.mts +5 -5
  64. package/dist/validation/object/index.d.ts +5 -5
  65. package/dist/validation/object/index.js +14 -14
  66. package/dist/validation/object/index.mjs +2 -2
  67. package/dist/validation/primitives/checkbox.d.mts +2 -2
  68. package/dist/validation/primitives/checkbox.d.ts +2 -2
  69. package/dist/validation/primitives/date.d.mts +2 -2
  70. package/dist/validation/primitives/date.d.ts +2 -2
  71. package/dist/validation/primitives/number.d.mts +2 -2
  72. package/dist/validation/primitives/number.d.ts +2 -2
  73. package/dist/validation/primitives/text.d.mts +2 -2
  74. package/dist/validation/primitives/text.d.ts +2 -2
  75. package/package.json +2 -2
@@ -21,8 +21,40 @@ var SchemaErrorCode = {
21
21
  PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW",
22
22
  PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE",
23
23
  // Permissions
24
+ //
25
+ // `FORBIDDEN` means "you lack permission", and only that (#2681).
24
26
  FORBIDDEN: "SCHEMA_FORBIDDEN",
25
27
  ACCESS_DENIED: "SCHEMA_ACCESS_DENIED",
28
+ // Refusals that are NOT permission denials (#2681)
29
+ //
30
+ // `FORBIDDEN`'s message is redacted to a neutral sentence (#2675), which is
31
+ // honest only while the code means one thing. It did not: a workspace
32
+ // invariant (the last owner), a state gate (a disarmed reflex), an
33
+ // immutability refusal (system forms) and a missing actor context each told
34
+ // a caller who holds every permission that they lack one, sending them to an
35
+ // administrator with nothing to grant. So a refusal a permission grant would
36
+ // NOT lift takes one of the codes below — plus `SYSTEM_ENTITY_IMMUTABLE`,
37
+ // which already existed — and keeps the explanatory message that names its
38
+ // remedy. Every one answers 403, exactly as it did while miscoded: the
39
+ // ruling changed the semantics, not a single HTTP status.
40
+ //
41
+ // A fifth site was seen and deliberately left alone: `ApiKeyService`'s
42
+ // missing-actor refusal answers 400 `VALIDATION_FAILED`, and moving it here
43
+ // would change a public HTTP status — which the ruling forbids. It stays at
44
+ // its 400 pending a ruling of its own.
45
+ /**
46
+ * A workspace RULE refuses the write — the last owner cannot be removed.
47
+ *
48
+ * Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
49
+ * "should never happen" assertion, a bug signal nobody outside the codebase
50
+ * can act on. This is the opposite — a rule the caller can act on, reached
51
+ * by a request that was entirely well-formed, whose message tells them how.
52
+ */
53
+ WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT",
54
+ /** The resource's own state refuses the operation — a disarmed reflex run. */
55
+ STATE_GATE: "SCHEMA_STATE_GATE",
56
+ /** The operation needs an actor and the request carried none. */
57
+ ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED",
26
58
  // Connectors
27
59
  CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED",
28
60
  CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE",
@@ -105,6 +137,8 @@ var SchemaErrorCode = {
105
137
  AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT",
106
138
  AGENT_LEASE_HELD: "AGENT_LEASE_HELD",
107
139
  AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED",
140
+ AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND",
141
+ AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE",
108
142
  // AI / LLM
109
143
  AI_UNKNOWN: "AI_UNKNOWN",
110
144
  AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED",
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.js');
3
+ var chunkL4KLYMUI_js = require('./chunk-L4KLYMUI.js');
4
4
 
5
5
  // src/utils/canonical-json.ts
6
6
  function canonicalStringify(value) {
@@ -17,10 +17,10 @@ function canonicalStringify(value) {
17
17
  case "object":
18
18
  break;
19
19
  default:
20
- throw new chunkM3WFXOA4_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
20
+ throw new chunkL4KLYMUI_js.ValidationError(`Cannot canonicalize value of type ${typeof v}`, []);
21
21
  }
22
22
  const obj = v;
23
- if (seen.has(obj)) throw new chunkM3WFXOA4_js.ValidationError("Cannot canonicalize circular structure", []);
23
+ if (seen.has(obj)) throw new chunkL4KLYMUI_js.ValidationError("Cannot canonicalize circular structure", []);
24
24
  seen.add(obj);
25
25
  try {
26
26
  if (Array.isArray(obj)) return `[${obj.map((e) => encode(e) ?? "null").join(",")}]`;
@@ -7,7 +7,7 @@ import { createCheckboxValidator } from './chunk-OSSGN43B.mjs';
7
7
  import { createDateValidator } from './chunk-Q44QKLN4.mjs';
8
8
  import { createNumberValidator } from './chunk-UANQJ2GH.mjs';
9
9
  import { createTextValidator } from './chunk-O73ROMWQ.mjs';
10
- import { ValidationError } from './chunk-XDA5PZRT.mjs';
10
+ import { ValidationError } from './chunk-HOVUEYEQ.mjs';
11
11
  import { createCurrencyValidator } from './chunk-AYVHMVKQ.mjs';
12
12
  import { createLocationValidator } from './chunk-YUFTHPOE.mjs';
13
13
  import { createPhoneValidator } from './chunk-R5LAJCBU.mjs';
@@ -1,5 +1,5 @@
1
- import { SCHEMA_LIMITS, iconNameSchema } from './chunk-MSIGO7JA.mjs';
2
- import { ValidationError } from './chunk-XDA5PZRT.mjs';
1
+ import { SCHEMA_LIMITS, iconNameSchema } from './chunk-R34LOMT7.mjs';
2
+ import { ValidationError } from './chunk-HOVUEYEQ.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  // src/types/system-attributes.ts
@@ -960,6 +960,8 @@ var fieldPresentationShape = {
960
960
  readOnly: z.boolean().optional()
961
961
  };
962
962
  var fieldSchema = z.object({
963
+ /** Stable slot identity. Optional: a builder may omit it, `ensureFieldIds` assigns it. */
964
+ id: z.string().optional(),
963
965
  attribute: z.string().optional(),
964
966
  attributeGroup: attributeGroupFieldSchema.optional(),
965
967
  ...fieldPresentationShape
@@ -984,15 +986,7 @@ var fieldGroupWriteSchema = z.object({
984
986
  type: z.literal("fields"),
985
987
  fields: z.array(fieldSchema).max(SCHEMA_LIMITS.fieldsPerGroup)
986
988
  }).strict();
987
- var relationGroupSchema = z.object({
988
- ...baseGroupShape,
989
- type: z.literal("relation"),
990
- attribute: z.string(),
991
- columns: z.array(z.string()).max(SCHEMA_LIMITS.columnsPerTab).optional(),
992
- readOnly: z.boolean().optional(),
993
- allowCreate: z.boolean().optional()
994
- }).strict();
995
- var groupWriteSchema = z.discriminatedUnion("type", [fieldGroupWriteSchema, relationGroupSchema]);
989
+ var groupWriteSchema = fieldGroupWriteSchema;
996
990
  var baseTabShape = {
997
991
  id: z.string(),
998
992
  name: z.string(),
@@ -1291,12 +1285,42 @@ var _listViewConfigSchema = z.object({
1291
1285
  hasDefault = true;
1292
1286
  });
1293
1287
  });
1288
+ var sidePanelPaneSchema = z.discriminatedUnion("kind", [
1289
+ z.object({
1290
+ kind: z.literal("fields"),
1291
+ id: z.string().optional(),
1292
+ label: z.string().optional(),
1293
+ attributes: z.array(z.string()).max(SCHEMA_LIMITS.sidePanelAttributes)
1294
+ }).strict(),
1295
+ z.object({
1296
+ kind: z.literal("activity"),
1297
+ id: z.string().optional(),
1298
+ label: z.string().optional()
1299
+ }).strict(),
1300
+ z.object({
1301
+ kind: z.literal("documents"),
1302
+ // Required here alone: the documents content keys its stored sort mode
1303
+ // on this id, so a pane without one would share the main-column
1304
+ // documents tab's sort.
1305
+ id: z.string(),
1306
+ label: z.string().optional(),
1307
+ allowUpload: z.boolean().optional(),
1308
+ allowRemove: z.boolean().optional()
1309
+ }).strict()
1310
+ ]);
1294
1311
  var _detailViewConfigSchema = z.object({
1295
1312
  tabs: z.array(detailTabSchema).min(1).max(SCHEMA_LIMITS.tabsPerView),
1296
1313
  sidePanel: z.object({
1297
- attributes: z.array(z.string()).max(SCHEMA_LIMITS.sidePanelAttributes),
1314
+ attributes: z.array(z.string()).max(SCHEMA_LIMITS.sidePanelAttributes).optional(),
1315
+ panes: z.array(sidePanelPaneSchema).max(SCHEMA_LIMITS.sidePanelPanes).optional(),
1298
1316
  width: z.number().optional()
1299
- }).strict().optional()
1317
+ }).strict().refine((sidePanel) => sidePanel.attributes !== void 0 || sidePanel.panes !== void 0, {
1318
+ message: "sidePanel requires attributes or panes"
1319
+ }).refine((sidePanel) => sidePanel.panes === void 0 || sidePanel.panes.length > 0, {
1320
+ message: "sidePanel panes must not be empty"
1321
+ }).refine((sidePanel) => sidePanel.attributes === void 0 || sidePanel.panes === void 0, {
1322
+ message: "sidePanel takes attributes or panes, not both"
1323
+ }).optional()
1300
1324
  }).strict().superRefine((config, ctx) => {
1301
1325
  addDuplicateIdIssues(config.tabs, ctx, ["tabs"]);
1302
1326
  addDuplicateNameIssues(config.tabs, ctx, ["tabs"]);
@@ -1,4 +1,4 @@
1
- import { ValidationError } from './chunk-XDA5PZRT.mjs';
1
+ import { ValidationError } from './chunk-HOVUEYEQ.mjs';
2
2
  import { z } from 'zod';
3
3
  import { ICONS, COLORS } from '@stndrds/constants';
4
4
 
@@ -316,6 +316,7 @@ var SCHEMA_LIMITS = {
316
316
  columnsPerTab: 50,
317
317
  optionsPerAttribute: 200,
318
318
  sidePanelAttributes: 100,
319
+ sidePanelPanes: 20,
319
320
  filterRulesPerTab: 50,
320
321
  sortsPerTab: 20,
321
322
  emailAttributesPerTab: 30,
@@ -510,6 +511,9 @@ var rollupConfigSchema = baseConfigSchema.extend({
510
511
  decimals: z.number().int().min(0).max(10).optional(),
511
512
  targetAttributeType: z.string().optional(),
512
513
  targetAttributeOptions: z.array(optionSchema).optional(),
514
+ // The sum's symbol (#2644) — declared here or `.strip()` eats it before
515
+ // storage, exactly the fate this schema spares its two siblings above.
516
+ targetCurrencyCode: z.string().length(3).optional(),
513
517
  optionsSource: computedOptionsSourceSchema.optional()
514
518
  });
515
519
  var propertySchemaPassthrough = z.object({ definitions: z.array(z.record(z.string(), z.unknown())) }).passthrough();
@@ -9,7 +9,7 @@ var chunk5WATIVCA_js = require('./chunk-5WATIVCA.js');
9
9
  var chunkSI34M4IC_js = require('./chunk-SI34M4IC.js');
10
10
  var chunkYIP5FJ5H_js = require('./chunk-YIP5FJ5H.js');
11
11
  var chunkZPFOKBIN_js = require('./chunk-ZPFOKBIN.js');
12
- var chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.js');
12
+ var chunkL4KLYMUI_js = require('./chunk-L4KLYMUI.js');
13
13
  var chunkACKMC6FL_js = require('./chunk-ACKMC6FL.js');
14
14
  var chunkE6JUYGJX_js = require('./chunk-E6JUYGJX.js');
15
15
  var chunkQ4SZAMJT_js = require('./chunk-Q4SZAMJT.js');
@@ -162,7 +162,7 @@ function validateObjectOrThrow(objectDef, data) {
162
162
  if (!result.success) {
163
163
  const errors = result.errors ?? [];
164
164
  const detail = errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("\n") || "Unknown validation error";
165
- throw new chunkM3WFXOA4_js.ValidationError(
165
+ throw new chunkL4KLYMUI_js.ValidationError(
166
166
  `Validation failed for ${objectDef.label}:
167
167
  ${detail}`,
168
168
  errors.map((err) => ({ path: err.path, message: err.message }))
@@ -189,7 +189,7 @@ function validateDraftOrThrow(objectDef, data) {
189
189
  if (!result.success) {
190
190
  const errors = result.errors ?? [];
191
191
  const detail = errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("\n") || "Unknown validation error";
192
- throw new chunkM3WFXOA4_js.ValidationError(
192
+ throw new chunkL4KLYMUI_js.ValidationError(
193
193
  `Draft validation failed for ${objectDef.label}:
194
194
  ${detail}`,
195
195
  errors.map((err) => ({ path: err.path, message: err.message }))
@@ -201,7 +201,7 @@ function rejectUnknownAttributesOrThrow(objectDef, data) {
201
201
  const knownNames = new Set(objectDef.attributes.map((a) => a.name));
202
202
  const unknownKeys = Object.keys(data).filter((key) => !knownNames.has(key));
203
203
  if (unknownKeys.length > 0) {
204
- throw new chunkM3WFXOA4_js.ValidationError(
204
+ throw new chunkL4KLYMUI_js.ValidationError(
205
205
  `Unknown attribute${unknownKeys.length > 1 ? "s" : ""} for ${objectDef.label}: ${unknownKeys.join(", ")}`,
206
206
  unknownKeys.map((key) => ({ path: [key], message: "Unknown attribute" }))
207
207
  );
@@ -1,5 +1,5 @@
1
- import { S as SchemaOperation } from './migrations-BNlQVzDC.mjs';
2
- import './attributes--M1ifW8_.mjs';
1
+ import { S as SchemaOperation } from './migrations-C-GN1xx_.mjs';
2
+ import './attributes-DoiGyNFk.mjs';
3
3
  import '@stndrds/constants';
4
4
  import './utils.mjs';
5
5
 
@@ -23,6 +23,19 @@ declare const SchemaErrorCode: {
23
23
  readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
24
24
  readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
25
25
  readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
26
+ /**
27
+ * A workspace RULE refuses the write — the last owner cannot be removed.
28
+ *
29
+ * Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
30
+ * "should never happen" assertion, a bug signal nobody outside the codebase
31
+ * can act on. This is the opposite — a rule the caller can act on, reached
32
+ * by a request that was entirely well-formed, whose message tells them how.
33
+ */
34
+ readonly WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT";
35
+ /** The resource's own state refuses the operation — a disarmed reflex run. */
36
+ readonly STATE_GATE: "SCHEMA_STATE_GATE";
37
+ /** The operation needs an actor and the request carried none. */
38
+ readonly ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED";
26
39
  readonly CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED";
27
40
  readonly CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE";
28
41
  /**
@@ -81,6 +94,8 @@ declare const SchemaErrorCode: {
81
94
  readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
82
95
  readonly AGENT_LEASE_HELD: "AGENT_LEASE_HELD";
83
96
  readonly AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED";
97
+ readonly AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND";
98
+ readonly AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE";
84
99
  readonly AI_UNKNOWN: "AI_UNKNOWN";
85
100
  readonly AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED";
86
101
  readonly AI_INVALID_USAGE: "AI_INVALID_USAGE";
@@ -325,7 +340,11 @@ declare function isValidationError(error: unknown): error is ValidationError;
325
340
  */
326
341
  declare function isProtectedResourceError(error: unknown): error is ProtectedResourceError;
327
342
  /**
328
- * Error thrown when a user lacks permission to perform an action
343
+ * Error thrown when a user lacks permission to perform an action.
344
+ *
345
+ * That, and nothing else (#2681) — its message is redacted, so it must not
346
+ * carry a refusal a permission grant would not lift: use `WORKSPACE_INVARIANT`,
347
+ * `STATE_GATE`, `ACTOR_CONTEXT_REQUIRED` or `SYSTEM_ENTITY_IMMUTABLE` instead.
329
348
  */
330
349
  declare class ForbiddenError extends SchemaError {
331
350
  readonly objectName: string;
@@ -1,5 +1,5 @@
1
- import { S as SchemaOperation } from './migrations-B1kkIhIX.js';
2
- import './attributes-D8eHv5Kf.js';
1
+ import { S as SchemaOperation } from './migrations-BGWgXHXb.js';
2
+ import './attributes-CU871AfG.js';
3
3
  import '@stndrds/constants';
4
4
  import './utils.js';
5
5
 
@@ -23,6 +23,19 @@ declare const SchemaErrorCode: {
23
23
  readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
24
24
  readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
25
25
  readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
26
+ /**
27
+ * A workspace RULE refuses the write — the last owner cannot be removed.
28
+ *
29
+ * Not `INVARIANT_VIOLATION`, despite the name: that one is an internal
30
+ * "should never happen" assertion, a bug signal nobody outside the codebase
31
+ * can act on. This is the opposite — a rule the caller can act on, reached
32
+ * by a request that was entirely well-formed, whose message tells them how.
33
+ */
34
+ readonly WORKSPACE_INVARIANT: "SCHEMA_WORKSPACE_INVARIANT";
35
+ /** The resource's own state refuses the operation — a disarmed reflex run. */
36
+ readonly STATE_GATE: "SCHEMA_STATE_GATE";
37
+ /** The operation needs an actor and the request carried none. */
38
+ readonly ACTOR_CONTEXT_REQUIRED: "SCHEMA_ACTOR_CONTEXT_REQUIRED";
26
39
  readonly CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED";
27
40
  readonly CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE";
28
41
  /**
@@ -81,6 +94,8 @@ declare const SchemaErrorCode: {
81
94
  readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
82
95
  readonly AGENT_LEASE_HELD: "AGENT_LEASE_HELD";
83
96
  readonly AGENT_WORK_MODE_REQUIRED: "AGENT_WORK_MODE_REQUIRED";
97
+ readonly AGENT_MESSAGE_NOT_FOUND: "AGENT_MESSAGE_NOT_FOUND";
98
+ readonly AGENT_MESSAGE_NOT_EDITABLE: "AGENT_MESSAGE_NOT_EDITABLE";
84
99
  readonly AI_UNKNOWN: "AI_UNKNOWN";
85
100
  readonly AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED";
86
101
  readonly AI_INVALID_USAGE: "AI_INVALID_USAGE";
@@ -325,7 +340,11 @@ declare function isValidationError(error: unknown): error is ValidationError;
325
340
  */
326
341
  declare function isProtectedResourceError(error: unknown): error is ProtectedResourceError;
327
342
  /**
328
- * Error thrown when a user lacks permission to perform an action
343
+ * Error thrown when a user lacks permission to perform an action.
344
+ *
345
+ * That, and nothing else (#2681) — its message is redacted, so it must not
346
+ * carry a refusal a permission grant would not lift: use `WORKSPACE_INVARIANT`,
347
+ * `STATE_GATE`, `ACTOR_CONTEXT_REQUIRED` or `SYSTEM_ENTITY_IMMUTABLE` instead.
329
348
  */
330
349
  declare class ForbiddenError extends SchemaError {
331
350
  readonly objectName: string;
@@ -1,158 +1,158 @@
1
1
  'use strict';
2
2
 
3
- var chunkM3WFXOA4_js = require('./chunk-M3WFXOA4.js');
3
+ var chunkL4KLYMUI_js = require('./chunk-L4KLYMUI.js');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "AccessDeniedError", {
8
8
  enumerable: true,
9
- get: function () { return chunkM3WFXOA4_js.AccessDeniedError; }
9
+ get: function () { return chunkL4KLYMUI_js.AccessDeniedError; }
10
10
  });
11
11
  Object.defineProperty(exports, "AttributeInUseError", {
12
12
  enumerable: true,
13
- get: function () { return chunkM3WFXOA4_js.AttributeInUseError; }
13
+ get: function () { return chunkL4KLYMUI_js.AttributeInUseError; }
14
14
  });
15
15
  Object.defineProperty(exports, "AttributeNotFoundError", {
16
16
  enumerable: true,
17
- get: function () { return chunkM3WFXOA4_js.AttributeNotFoundError; }
17
+ get: function () { return chunkL4KLYMUI_js.AttributeNotFoundError; }
18
18
  });
19
19
  Object.defineProperty(exports, "ChangeTypeNotSupportedError", {
20
20
  enumerable: true,
21
- get: function () { return chunkM3WFXOA4_js.ChangeTypeNotSupportedError; }
21
+ get: function () { return chunkL4KLYMUI_js.ChangeTypeNotSupportedError; }
22
22
  });
23
23
  Object.defineProperty(exports, "ConcurrentModificationError", {
24
24
  enumerable: true,
25
- get: function () { return chunkM3WFXOA4_js.ConcurrentModificationError; }
25
+ get: function () { return chunkL4KLYMUI_js.ConcurrentModificationError; }
26
26
  });
27
27
  Object.defineProperty(exports, "DestructiveSyncNotAllowedError", {
28
28
  enumerable: true,
29
- get: function () { return chunkM3WFXOA4_js.DestructiveSyncNotAllowedError; }
29
+ get: function () { return chunkL4KLYMUI_js.DestructiveSyncNotAllowedError; }
30
30
  });
31
31
  Object.defineProperty(exports, "DuplicateError", {
32
32
  enumerable: true,
33
- get: function () { return chunkM3WFXOA4_js.DuplicateError; }
33
+ get: function () { return chunkL4KLYMUI_js.DuplicateError; }
34
34
  });
35
35
  Object.defineProperty(exports, "ForbiddenError", {
36
36
  enumerable: true,
37
- get: function () { return chunkM3WFXOA4_js.ForbiddenError; }
37
+ get: function () { return chunkL4KLYMUI_js.ForbiddenError; }
38
38
  });
39
39
  Object.defineProperty(exports, "MemoryNotFoundError", {
40
40
  enumerable: true,
41
- get: function () { return chunkM3WFXOA4_js.MemoryNotFoundError; }
41
+ get: function () { return chunkL4KLYMUI_js.MemoryNotFoundError; }
42
42
  });
43
43
  Object.defineProperty(exports, "MigrationTimeoutError", {
44
44
  enumerable: true,
45
- get: function () { return chunkM3WFXOA4_js.MigrationTimeoutError; }
45
+ get: function () { return chunkL4KLYMUI_js.MigrationTimeoutError; }
46
46
  });
47
47
  Object.defineProperty(exports, "NotFoundError", {
48
48
  enumerable: true,
49
- get: function () { return chunkM3WFXOA4_js.NotFoundError; }
49
+ get: function () { return chunkL4KLYMUI_js.NotFoundError; }
50
50
  });
51
51
  Object.defineProperty(exports, "NotImplementedError", {
52
52
  enumerable: true,
53
- get: function () { return chunkM3WFXOA4_js.NotImplementedError; }
53
+ get: function () { return chunkL4KLYMUI_js.NotImplementedError; }
54
54
  });
55
55
  Object.defineProperty(exports, "ObjectNotFoundError", {
56
56
  enumerable: true,
57
- get: function () { return chunkM3WFXOA4_js.ObjectNotFoundError; }
57
+ get: function () { return chunkL4KLYMUI_js.ObjectNotFoundError; }
58
58
  });
59
59
  Object.defineProperty(exports, "ObjectReferencedError", {
60
60
  enumerable: true,
61
- get: function () { return chunkM3WFXOA4_js.ObjectReferencedError; }
61
+ get: function () { return chunkL4KLYMUI_js.ObjectReferencedError; }
62
62
  });
63
63
  Object.defineProperty(exports, "OrphanSystemAttributeError", {
64
64
  enumerable: true,
65
- get: function () { return chunkM3WFXOA4_js.OrphanSystemAttributeError; }
65
+ get: function () { return chunkL4KLYMUI_js.OrphanSystemAttributeError; }
66
66
  });
67
67
  Object.defineProperty(exports, "ProtectedResourceError", {
68
68
  enumerable: true,
69
- get: function () { return chunkM3WFXOA4_js.ProtectedResourceError; }
69
+ get: function () { return chunkL4KLYMUI_js.ProtectedResourceError; }
70
70
  });
71
71
  Object.defineProperty(exports, "ProtectedRoleError", {
72
72
  enumerable: true,
73
- get: function () { return chunkM3WFXOA4_js.ProtectedRoleError; }
73
+ get: function () { return chunkL4KLYMUI_js.ProtectedRoleError; }
74
74
  });
75
75
  Object.defineProperty(exports, "RecordNotFoundError", {
76
76
  enumerable: true,
77
- get: function () { return chunkM3WFXOA4_js.RecordNotFoundError; }
77
+ get: function () { return chunkL4KLYMUI_js.RecordNotFoundError; }
78
78
  });
79
79
  Object.defineProperty(exports, "RecordReferencedError", {
80
80
  enumerable: true,
81
- get: function () { return chunkM3WFXOA4_js.RecordReferencedError; }
81
+ get: function () { return chunkL4KLYMUI_js.RecordReferencedError; }
82
82
  });
83
83
  Object.defineProperty(exports, "RepositoryError", {
84
84
  enumerable: true,
85
- get: function () { return chunkM3WFXOA4_js.RepositoryError; }
85
+ get: function () { return chunkL4KLYMUI_js.RepositoryError; }
86
86
  });
87
87
  Object.defineProperty(exports, "RoleNotFoundError", {
88
88
  enumerable: true,
89
- get: function () { return chunkM3WFXOA4_js.RoleNotFoundError; }
89
+ get: function () { return chunkL4KLYMUI_js.RoleNotFoundError; }
90
90
  });
91
91
  Object.defineProperty(exports, "SchemaError", {
92
92
  enumerable: true,
93
- get: function () { return chunkM3WFXOA4_js.SchemaError; }
93
+ get: function () { return chunkL4KLYMUI_js.SchemaError; }
94
94
  });
95
95
  Object.defineProperty(exports, "SchemaErrorCode", {
96
96
  enumerable: true,
97
- get: function () { return chunkM3WFXOA4_js.SchemaErrorCode; }
97
+ get: function () { return chunkL4KLYMUI_js.SchemaErrorCode; }
98
98
  });
99
99
  Object.defineProperty(exports, "SchemaPlanNotFoundError", {
100
100
  enumerable: true,
101
- get: function () { return chunkM3WFXOA4_js.SchemaPlanNotFoundError; }
101
+ get: function () { return chunkL4KLYMUI_js.SchemaPlanNotFoundError; }
102
102
  });
103
103
  Object.defineProperty(exports, "SearchBackendError", {
104
104
  enumerable: true,
105
- get: function () { return chunkM3WFXOA4_js.SearchBackendError; }
105
+ get: function () { return chunkL4KLYMUI_js.SearchBackendError; }
106
106
  });
107
107
  Object.defineProperty(exports, "StorageError", {
108
108
  enumerable: true,
109
- get: function () { return chunkM3WFXOA4_js.StorageError; }
109
+ get: function () { return chunkL4KLYMUI_js.StorageError; }
110
110
  });
111
111
  Object.defineProperty(exports, "SyncCascadeError", {
112
112
  enumerable: true,
113
- get: function () { return chunkM3WFXOA4_js.SyncCascadeError; }
113
+ get: function () { return chunkL4KLYMUI_js.SyncCascadeError; }
114
114
  });
115
115
  Object.defineProperty(exports, "SyncConflictError", {
116
116
  enumerable: true,
117
- get: function () { return chunkM3WFXOA4_js.SyncConflictError; }
117
+ get: function () { return chunkL4KLYMUI_js.SyncConflictError; }
118
118
  });
119
119
  Object.defineProperty(exports, "SyncError", {
120
120
  enumerable: true,
121
- get: function () { return chunkM3WFXOA4_js.SyncError; }
121
+ get: function () { return chunkL4KLYMUI_js.SyncError; }
122
122
  });
123
123
  Object.defineProperty(exports, "SystemEntityImmutableError", {
124
124
  enumerable: true,
125
- get: function () { return chunkM3WFXOA4_js.SystemEntityImmutableError; }
125
+ get: function () { return chunkL4KLYMUI_js.SystemEntityImmutableError; }
126
126
  });
127
127
  Object.defineProperty(exports, "ValidationError", {
128
128
  enumerable: true,
129
- get: function () { return chunkM3WFXOA4_js.ValidationError; }
129
+ get: function () { return chunkL4KLYMUI_js.ValidationError; }
130
130
  });
131
131
  Object.defineProperty(exports, "isAttributeInUseError", {
132
132
  enumerable: true,
133
- get: function () { return chunkM3WFXOA4_js.isAttributeInUseError; }
133
+ get: function () { return chunkL4KLYMUI_js.isAttributeInUseError; }
134
134
  });
135
135
  Object.defineProperty(exports, "isNotFoundError", {
136
136
  enumerable: true,
137
- get: function () { return chunkM3WFXOA4_js.isNotFoundError; }
137
+ get: function () { return chunkL4KLYMUI_js.isNotFoundError; }
138
138
  });
139
139
  Object.defineProperty(exports, "isObjectReferencedError", {
140
140
  enumerable: true,
141
- get: function () { return chunkM3WFXOA4_js.isObjectReferencedError; }
141
+ get: function () { return chunkL4KLYMUI_js.isObjectReferencedError; }
142
142
  });
143
143
  Object.defineProperty(exports, "isProtectedResourceError", {
144
144
  enumerable: true,
145
- get: function () { return chunkM3WFXOA4_js.isProtectedResourceError; }
145
+ get: function () { return chunkL4KLYMUI_js.isProtectedResourceError; }
146
146
  });
147
147
  Object.defineProperty(exports, "isRecordReferencedError", {
148
148
  enumerable: true,
149
- get: function () { return chunkM3WFXOA4_js.isRecordReferencedError; }
149
+ get: function () { return chunkL4KLYMUI_js.isRecordReferencedError; }
150
150
  });
151
151
  Object.defineProperty(exports, "isSchemaError", {
152
152
  enumerable: true,
153
- get: function () { return chunkM3WFXOA4_js.isSchemaError; }
153
+ get: function () { return chunkL4KLYMUI_js.isSchemaError; }
154
154
  });
155
155
  Object.defineProperty(exports, "isValidationError", {
156
156
  enumerable: true,
157
- get: function () { return chunkM3WFXOA4_js.isValidationError; }
157
+ get: function () { return chunkL4KLYMUI_js.isValidationError; }
158
158
  });
@@ -1 +1 @@
1
- export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError } from './chunk-XDA5PZRT.mjs';
1
+ export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError } from './chunk-HOVUEYEQ.mjs';
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { A as Attribute } from './attributes-D8eHv5Kf.js';
3
- import { V as ValidationMessages, a as ValidationResult } from './types-DYYFto8d.js';
4
- import { O as ObjectDefinition } from './objects-DgFojgwH.js';
2
+ import { A as Attribute } from './attributes-CU871AfG.js';
3
+ import { V as ValidationMessages, a as ValidationResult } from './types-DqYz8Iv_.js';
4
+ import { O as ObjectDefinition } from './objects-BiOMwzLL.js';
5
5
 
6
6
  /**
7
7
  * Create a Zod schema for any attribute type.
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { A as Attribute } from './attributes--M1ifW8_.mjs';
3
- import { V as ValidationMessages, a as ValidationResult } from './types-DHqXzkgW.mjs';
4
- import { O as ObjectDefinition } from './objects-DmMqHn3L.mjs';
2
+ import { A as Attribute } from './attributes-DoiGyNFk.mjs';
3
+ import { V as ValidationMessages, a as ValidationResult } from './types-80c2rOUZ.mjs';
4
+ import { O as ObjectDefinition } from './objects-BRypaBpi.mjs';
5
5
 
6
6
  /**
7
7
  * Create a Zod schema for any attribute type.