@standards/schema 1.0.0-alpha.392 → 1.0.0-alpha.394

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 (93) hide show
  1. package/dist/{all-C9fzvM0e.d.ts → all-Bvjhv6Gx.d.ts} +10 -10
  2. package/dist/{all-DSB4gTCU.d.mts → all-CGQkHUAG.d.mts} +10 -10
  3. package/dist/api/index.d.mts +95 -197
  4. package/dist/api/index.d.ts +95 -197
  5. package/dist/api/index.js +1 -1
  6. package/dist/api/index.mjs +1 -1
  7. package/dist/{attributes-D1VjqvO5.d.ts → attributes-DHbSq5-c.d.ts} +1 -1
  8. package/dist/{attributes-1HV1p4Xw.d.mts → attributes-ybI2RY0p.d.mts} +1 -1
  9. package/dist/{checkbox-Bywsfist.d.ts → checkbox-BgyfKv2J.d.ts} +2 -2
  10. package/dist/{checkbox-BBcPJrxb.d.mts → checkbox-DvtCTshQ.d.mts} +2 -2
  11. package/dist/config-DqidiszP.mjs +2 -0
  12. package/dist/config-oKDg40Iz.js +2 -0
  13. package/dist/{date-Bj8voQf-.d.mts → date-B9livx2w.d.mts} +2 -2
  14. package/dist/{date-DEqIFzxi.d.ts → date-CDg8dTJA.d.ts} +2 -2
  15. package/dist/{exceptions-CPpO7bl9.d.mts → exceptions-CeP0QxYo.d.mts} +13 -4
  16. package/dist/{exceptions-CPpO7bl9.d.ts → exceptions-CeP0QxYo.d.ts} +13 -4
  17. package/dist/exceptions.d.mts +2 -2
  18. package/dist/exceptions.d.ts +2 -2
  19. package/dist/exceptions.js +1 -1
  20. package/dist/exceptions.mjs +1 -1
  21. package/dist/{index-DsYudW8B.d.ts → index-B5IBbAwy.d.ts} +994 -866
  22. package/dist/{index-BdOS1g9i.d.mts → index-BttvvaQY.d.mts} +3 -3
  23. package/dist/{index-DCpxmDHb.d.mts → index-Csfui8Qm.d.mts} +2 -2
  24. package/dist/{index-s0zR7PJ9.d.ts → index-D4KxKEL_.d.ts} +2 -2
  25. package/dist/{index-DoLzTeu1.d.mts → index-DICp0at8.d.mts} +1 -1
  26. package/dist/{index-zjcfmatR.d.mts → index-Dpcmxf-Y.d.mts} +994 -866
  27. package/dist/{index-DNQspfYW.d.ts → index-Jjt6ggWu.d.ts} +3 -3
  28. package/dist/{index-DP-x7d5U.d.ts → index-ea_C0sbY.d.ts} +1 -1
  29. package/dist/index.d.mts +14 -14
  30. package/dist/index.d.ts +14 -14
  31. package/dist/index.js +1 -1
  32. package/dist/index.mjs +1 -1
  33. package/dist/{number-CCfz8McR.d.mts → number-CASI8GSl.d.mts} +2 -2
  34. package/dist/{number-DlR6jvKt.d.ts → number-MnY5CLQ-.d.ts} +2 -2
  35. package/dist/{objects-BF1wXeoe.d.ts → objects-DgAAilNd.d.ts} +2 -2
  36. package/dist/{objects-DytubYla.d.mts → objects-q1d_wU_1.d.mts} +2 -2
  37. package/dist/{attribute-validators-CUqsP1j_.js → primitives-BBtVhLdq.js} +4 -4
  38. package/dist/{attribute-validators-COsyRG9V.mjs → primitives-D9A6pmXV.mjs} +4 -4
  39. package/dist/record-operation-BFMdsHM3.js +2 -0
  40. package/dist/record-operation-DAUsRSxK.mjs +2 -0
  41. package/dist/{text-BUFRXrWY.d.mts → text-BjaTSXw_.d.mts} +2 -2
  42. package/dist/{text-C6KKZDNh.d.ts → text-CIY_GzA4.d.ts} +2 -2
  43. package/dist/{utils-C2dIMiOB.d.mts → utils-BrTiR8t6.d.mts} +1 -1
  44. package/dist/{utils-CydvpWQ3.d.ts → utils-DDQvppjN.d.ts} +1 -1
  45. package/dist/utils.d.mts +1 -1
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/validation/all.d.mts +4 -4
  48. package/dist/validation/all.d.ts +4 -4
  49. package/dist/validation/all.js +1 -1
  50. package/dist/validation/all.mjs +1 -1
  51. package/dist/validation/complex/currency.d.mts +2 -2
  52. package/dist/validation/complex/currency.d.ts +2 -2
  53. package/dist/validation/complex/location.d.mts +2 -2
  54. package/dist/validation/complex/location.d.ts +2 -2
  55. package/dist/validation/complex/phone.d.mts +2 -2
  56. package/dist/validation/complex/phone.d.ts +2 -2
  57. package/dist/validation/complex/relation.d.mts +2 -2
  58. package/dist/validation/complex/relation.d.ts +2 -2
  59. package/dist/validation/complex/richtext.d.mts +2 -2
  60. package/dist/validation/complex/richtext.d.ts +2 -2
  61. package/dist/validation/complex/select.d.mts +2 -2
  62. package/dist/validation/complex/select.d.ts +2 -2
  63. package/dist/validation/complex/user.d.mts +2 -2
  64. package/dist/validation/complex/user.d.ts +2 -2
  65. package/dist/validation/computed/formula.d.mts +2 -2
  66. package/dist/validation/computed/formula.d.ts +2 -2
  67. package/dist/validation/computed/rollup.d.mts +2 -2
  68. package/dist/validation/computed/rollup.d.ts +2 -2
  69. package/dist/validation/config/index.d.mts +1 -1
  70. package/dist/validation/config/index.d.ts +1 -1
  71. package/dist/validation/config/index.js +1 -1
  72. package/dist/validation/config/index.mjs +1 -1
  73. package/dist/validation/core/index.d.mts +1 -1
  74. package/dist/validation/core/index.d.ts +1 -1
  75. package/dist/validation/object/index.d.mts +1 -1
  76. package/dist/validation/object/index.d.ts +1 -1
  77. package/dist/validation/primitives/checkbox.d.mts +1 -1
  78. package/dist/validation/primitives/checkbox.d.ts +1 -1
  79. package/dist/validation/primitives/date.d.mts +1 -1
  80. package/dist/validation/primitives/date.d.ts +1 -1
  81. package/dist/validation/primitives/number.d.mts +1 -1
  82. package/dist/validation/primitives/number.d.ts +1 -1
  83. package/dist/validation/primitives/text.d.mts +1 -1
  84. package/dist/validation/primitives/text.d.ts +1 -1
  85. package/dist/view-config.schema-Cbq9lhVg.js +2 -0
  86. package/dist/view-config.schema-D7TH6B1r.mjs +2 -0
  87. package/package.json +2 -2
  88. package/dist/config-DGw5vxzO.mjs +0 -2
  89. package/dist/config-DWvtyZbu.js +0 -2
  90. package/dist/record-operation-CI4g4_0b.mjs +0 -2
  91. package/dist/record-operation-FgJuRZP7.js +0 -2
  92. package/dist/view-config.schema-BfBy0nTj.mjs +0 -2
  93. package/dist/view-config.schema-CDyKFQJc.js +0 -2
@@ -1,10 +1,10 @@
1
1
 
2
- import { SchemaError, SchemaErrorCode, ValidationError } from "./exceptions-CPpO7bl9.js";
3
- import { TenantId, Uuid } from "./utils-CydvpWQ3.js";
4
- import { DocumentLayout, ImageShape, ListViewTabVisibility, ObjectDefinition, ObjectImage, ObjectRecord, RecordAppearance, ResourceVisibility, Timestamps, ViewerAccess } from "./objects-BF1wXeoe.js";
5
- import { Attribute, AttributeType, BilateralConfig, CheckboxAttribute, Currency, CurrencyAttribute, DateAttribute, DatePrecision, DateRangeValue, DocumentAttribute, FormulaAttribute, FormulaReturnType, Location, LocationAttribute, LocationGranularity, MultiRelationAttribute, MultiselectAttribute, NumberAttribute, Option, Phone, PhoneAttribute, PropertyAttribute, PropertySchema, RelationAttribute, RelationTarget, RichtextAttribute, RollupAttribute, RollupFunction, SelectAttribute, SingleRelationAttribute, StatusAttribute, TextAttribute, TimeFormat, UserAttribute, UserReferenceType } from "./attributes-D1VjqvO5.js";
6
- import { ActivityContentDefinition, BLOCK_PERIODS, BlockContext, BlockDefinition, BlockInput, BlockWidth, CollectionAction, CollectionContentDefinition, CollectionContentSource, ColumnReference, ContentConfiguration, ContentCreateMode, ContentField, ContentFieldGroup, ContentOpenMode, ContentViewContext, ContentViewDefinition, CustomContentDefinition, DocumentsContentDefinition, DynamicValue, Eager, EmailsContentDefinition, FilterOperator, FilterRule, FilterState, FilterValue, FormContentDefinition, FormDensity, FormsContentDefinition, GridPosition, GridViolation, HeightMode, InferAttributeValue, InferQualifiedProps, InputShape, LayoutTraits, ListableBlockInput, MeetingsContentDefinition, ObjectBuilderLike, ObjectViewContext, ObjectViewDefinition, PageContentDefinition, PageViewDefinition, QualifiedDocumentAttributeBuilder, QualifiedDocumentBrand, RecordMetadata, RecordQuery, RecordQueryDefinition, RelativeDateValue, RichtextContentDefinition, SortRule, ViewContentDefinition, WithCustomAttributes, WithCustomRecordAttributes, WithoutSystemFields } from "./all-C9fzvM0e.js";
7
- import { UpdateObjectInput } from "./index-s0zR7PJ9.js";
2
+ import { SchemaError, SchemaErrorCode, ValidationError } from "./exceptions-CeP0QxYo.js";
3
+ import { TenantId, Uuid } from "./utils-DDQvppjN.js";
4
+ import { DocumentLayout, ImageShape, ListViewTabVisibility, ObjectDefinition, ObjectImage, ObjectRecord, RecordAppearance, ResourceVisibility, Timestamps, ViewerAccess } from "./objects-DgAAilNd.js";
5
+ import { Attribute, AttributeType, BilateralConfig, CheckboxAttribute, Currency, CurrencyAttribute, DateAttribute, DatePrecision, DateRangeValue, DocumentAttribute, FormulaAttribute, FormulaReturnType, Location, LocationAttribute, LocationGranularity, MultiRelationAttribute, MultiselectAttribute, NumberAttribute, Option, Phone, PhoneAttribute, PropertyAttribute, PropertySchema, RelationAttribute, RelationTarget, RichtextAttribute, RollupAttribute, RollupFunction, SelectAttribute, SingleRelationAttribute, StatusAttribute, TextAttribute, TimeFormat, UserAttribute, UserReferenceType } from "./attributes-DHbSq5-c.js";
6
+ import { ActivityContentDefinition, BLOCK_PERIODS, BlockContext, BlockDefinition, BlockInput, BlockWidth, CollectionAction, CollectionContentDefinition, CollectionContentSource, ColumnReference, ContentConfiguration, ContentCreateMode, ContentField, ContentFieldGroup, ContentOpenMode, ContentViewContext, ContentViewDefinition, CustomContentDefinition, DocumentsContentDefinition, DynamicValue, Eager, EmailsContentDefinition, FilterOperator, FilterRule, FilterState, FilterValue, FormContentDefinition, FormDensity, FormsContentDefinition, GridPosition, GridViolation, HeightMode, InferAttributeValue, InferQualifiedProps, InputShape, LayoutTraits, ListableBlockInput, MeetingsContentDefinition, ObjectBuilderLike, ObjectViewContext, ObjectViewDefinition, PageContentDefinition, PageViewDefinition, QualifiedDocumentAttributeBuilder, QualifiedDocumentBrand, RecordMetadata, RecordQuery, RecordQueryDefinition, RelativeDateValue, RichtextContentDefinition, SortRule, ViewContentDefinition, WithCustomAttributes, WithCustomRecordAttributes, WithoutSystemFields } from "./all-Bvjhv6Gx.js";
7
+ import { UpdateObjectInput } from "./index-D4KxKEL_.js";
8
8
  import * as z$2 from "zod";
9
9
  import z, { z as z$1 } from "zod";
10
10
  import { ColorId, CountryIso3, CurrencyCode, IconName, MimeType } from "@standards/constants";
@@ -3148,7 +3148,7 @@ export declare function harnessModelChoices(harness: EnvironmentHarnessId, model
3148
3148
  * Typed agent references: `<kind>:<id>`. The one parser shared by the runtime
3149
3149
  * verbs and the UI tool views; it never guesses a kind from a bare id.
3150
3150
  */
3151
- export declare const REFERENCE_KINDS: readonly ["record", "document", "file", "email", "thread", "event", "memory", "skill", "schema", "user", "guide", "catalog", "draft"];
3151
+ export declare const REFERENCE_KINDS: readonly ["record", "document", "file", "email", "thread", "event", "memory", "skill", "schema", "user", "guide", "bundle", "draft"];
3152
3152
  export type ReferenceKind = (typeof REFERENCE_KINDS)[number];
3153
3153
  export type Reference = {
3154
3154
  kind: ReferenceKind;
@@ -4969,6 +4969,16 @@ export declare function isAgentNotificationMetadata(metadata: Readonly<Record<st
4969
4969
  export declare const AGENT_MESSAGE_KIND = "agent-message";
4970
4970
  /** Whether a message's metadata marks it as written by another agent. */
4971
4971
  export declare function isAgentMessageMetadata(metadata: Readonly<Record<string, unknown>> | null | undefined): boolean;
4972
+ /**
4973
+ * `metadata.kind` of a `user` row the server writes into a session when a
4974
+ * publication of the session's architect draft ends: what was published, or
4975
+ * why it was refused. Its own kind, not the subagent notification, whose
4976
+ * contract tracks child sessions and turn outcomes. Like the agent's message,
4977
+ * it is the turn's input but nothing a person gave.
4978
+ */
4979
+ export declare const ARCHITECT_PUBLICATION_KIND = "architect-publication";
4980
+ /** Whether a message's metadata marks it as the outcome of a draft's publication. */
4981
+ export declare function isArchitectPublicationMetadata(metadata: Readonly<Record<string, unknown>> | null | undefined): boolean;
4972
4982
  /**
4973
4983
  * Narrow, UI-ready projection of an `agent-notification` message. Derived by the
4974
4984
  * react mapper from the raw `AgentSessionMessage.metadata` so the UI never has to
@@ -6045,248 +6055,710 @@ export declare function isManagedSystemAttribute(attribute: {
6045
6055
  }): boolean;
6046
6056
  //#endregion
6047
6057
  //#region src/types/schema-groups.d.ts
6048
- export type SchemaGroupKind = "bundle" | "source";
6049
- interface SchemaGroupBase {
6050
- id: string;
6051
- label: string | null;
6052
- icon: IconName | null;
6053
- /** Names `composeTenantSchema(...).owners` gives this group, in composition order. */
6054
- objectNames: string[];
6055
- }
6056
- export interface BundleSchemaGroup extends SchemaGroupBase {
6058
+ /** A synced bundle (core excepted) that owns objects: one sidebar section, label only. */
6059
+ export interface SchemaGroup {
6057
6060
  kind: "bundle";
6058
- /** A `tenant_bundles` row with status "active". */
6059
- installed: boolean;
6060
- appliedVersion: number | null;
6061
- availableVersion: number;
6062
- /** `selectUpdatable` on the row; false when not installed. */
6063
- updateAvailable: boolean;
6064
- }
6065
- export interface SourceSchemaGroup extends SchemaGroupBase {
6066
- kind: "source";
6067
- appliedAt: string;
6061
+ name: string;
6062
+ label: string;
6063
+ /** Names `composeTenantSchema(...).owners` gives this bundle, in composition order. */
6064
+ objectNames: string[];
6068
6065
  }
6069
- export type SchemaGroup = BundleSchemaGroup | SourceSchemaGroup;
6070
6066
  export interface SchemaGroupList {
6071
6067
  groups: SchemaGroup[];
6072
6068
  }
6073
- /** Presentation a bundle or a source declares. A key left out (or `undefined`) means "unchanged". */
6069
+ /** Presentation a bundle declares. A key left out (or `undefined`) means "unchanged". */
6074
6070
  export interface SchemaGroupPresentation {
6075
6071
  label?: string | null;
6076
- icon?: IconName | null;
6077
6072
  }
6078
- export declare function schemaGroupKey(group: Pick<SchemaGroup, "kind" | "id">): string;
6079
- /** The one presentation rule, shared by `defineBundle`, `defineSchemaSource` and the source PUT. */
6073
+ /** A group's key: the owner its objects carry (`bundle:<name>`). */
6074
+ export declare function schemaGroupKey(group: Pick<SchemaGroup, "kind" | "name">): string;
6075
+ /** The one presentation rule a synced bundle's label goes through. */
6080
6076
  export declare function parseSchemaGroupPresentation(input: unknown): SchemaGroupPresentation;
6081
6077
  //#endregion
6082
- //#region src/types/bundles.d.ts
6083
- /** A bundle assigned to the current tenant, as the bundles routes answer it. */
6084
- export interface TenantBundle {
6085
- id: Uuid;
6086
- tenantId: TenantId;
6087
- bundleId: string;
6088
- appliedVersion: number | null;
6089
- status: "active" | "inactive";
6090
- createdAt: string;
6091
- updatedAt: string;
6092
- }
6093
- /** A bundle assignment whose declared version is ahead of what the tenant applied. */
6094
- export interface UpdatableBundle {
6095
- bundleId: string;
6096
- appliedVersion: number | null;
6097
- availableVersion: number;
6098
- }
6099
- /** What applying or uninstalling bundles reports: the counts of the schema sync it ran. */
6100
- export interface BundleSyncResult {
6101
- success: boolean;
6102
- objectsSynced: number;
6103
- objectsDeleted: number;
6104
- attributesSynced: number;
6105
- objectsCreated: number;
6106
- objectsUpdated: number;
6107
- attributesCreated: number;
6108
- attributesUpdated: number;
6109
- attributesDeleted: number;
6110
- errors: Array<{
6111
- objectName: string;
6112
- attribute?: string;
6113
- error: string;
6114
- }>;
6115
- }
6116
- //#endregion
6117
- //#region src/types/catalog.d.ts
6118
- /** The languages a catalog piece compiles in; the routes accept no other. */
6119
- export declare const CATALOG_LOCALES: readonly ["fr", "en"];
6120
- export type CatalogLocale = (typeof CATALOG_LOCALES)[number];
6121
- /** What a catalog entry installs; the `kind` filter of `catalog.list` accepts no other. */
6122
- export declare const CATALOG_KINDS: readonly ["object", "view", "agent"];
6123
- export type CatalogEntryKind = (typeof CATALOG_KINDS)[number];
6124
- /** Where an installed piece came from; stamped on every draft operation it produces. */
6125
- export interface OperationOrigin {
6126
- entryId: string;
6127
- version: number;
6128
- packId?: string;
6129
- /** The language the piece was compiled in; its install row records it. */
6130
- locale: CatalogLocale;
6131
- }
6132
- export interface CatalogSummary {
6133
- label: string;
6134
- description: string;
6135
- icon: IconName;
6136
- category?: string;
6137
- }
6138
- export interface CatalogEntrySummary extends CatalogSummary {
6139
- id: string;
6140
- kind: CatalogEntryKind;
6141
- version: number;
6142
- requires: string[];
6143
- installed: boolean;
6144
- }
6145
- export interface CatalogPackSummary extends CatalogSummary {
6146
- id: string;
6147
- version: number;
6148
- entries: string[];
6149
- hasSamples: boolean;
6150
- installed: boolean;
6151
- }
6152
- /** A summary plus the ids it pulls in when installed. */
6153
- export type CatalogEntryDetail = (CatalogEntrySummary | CatalogPackSummary) & {
6154
- closure: string[];
6078
+ //#region src/views/page-layout.d.ts
6079
+ /** A cell on the page grid; field names match react-grid-layout's `LayoutItem`. */
6080
+ export type LayoutCell = GridPosition & {
6081
+ i: string;
6082
+ static?: boolean;
6155
6083
  };
6156
- export interface CatalogSelection {
6157
- entries?: string[];
6158
- packs?: string[];
6084
+ /** One change read-time repair made to a stored grid. */
6085
+ export interface GridRepair {
6086
+ name: string;
6087
+ kind: "width" | "height" | "pushed" | "fill" | "dropped";
6088
+ from?: GridPosition;
6089
+ to?: GridPosition;
6159
6090
  }
6160
- export type CatalogDecision = "bind" | "skip" | {
6161
- rename: string;
6091
+ type TraitsOf = (i: string) => LayoutTraits;
6092
+ /**
6093
+ * The nearest allowed width in `[minWidth, 12 - x]`; a tie rounds up. When no
6094
+ * step fits after `x`, the narrowest step at least `minWidth` (the caller then
6095
+ * moves the cell left).
6096
+ */
6097
+ export declare function snapWidth(w: number, x: number, minWidth: BlockWidth): BlockWidth;
6098
+ /**
6099
+ * Packs by gravity in `(y, x)` order: each movable cell rises until it meets
6100
+ * another cell, then is pushed below anything it overlaps. `static` cells never
6101
+ * move. `heights` gives a cell's effective height (measured for `fit`), which
6102
+ * the returned cell carries.
6103
+ */
6104
+ export declare function packLayout<T extends LayoutCell>(cells: readonly T[], heights?: ReadonlyMap<string, number>): T[];
6105
+ /**
6106
+ * A layout write laid over the page: the `sent` cells take their place, a cell
6107
+ * left out that one of them overlaps moves down below it (never sideways, as
6108
+ * react-grid-layout pushes while dragging), then the page is packed. `static`
6109
+ * cells never move: a sent cell that lands on one moves below it instead.
6110
+ */
6111
+ export declare function settleLayout<T extends LayoutCell>(cells: readonly T[], sent: ReadonlySet<string>): T[];
6112
+ /** react-grid-layout's `Compactor`, structurally: vertical gravity via `packLayout`. */
6113
+ export declare function pageCompactor(): {
6114
+ type: "vertical";
6115
+ allowOverlap: false;
6116
+ preventCollision: false;
6117
+ compact<T extends LayoutCell>(layout: readonly T[], cols: number): T[];
6162
6118
  };
6163
- export interface CatalogPlanPiece {
6164
- entryId: string;
6165
- kind: CatalogEntryKind;
6166
- status: "new" | "collides";
6167
- existingName?: string;
6168
- installable: boolean;
6169
- reason?: string;
6170
- inverseRelations?: {
6171
- objectName: string;
6172
- attributeName: string;
6173
- }[];
6174
- }
6175
- export interface CatalogInstallPlan {
6176
- pieces: CatalogPlanPiece[];
6177
- fingerprint: string;
6178
- }
6179
- export interface CatalogInstallInput {
6180
- selection: CatalogSelection;
6181
- locale: CatalogLocale;
6182
- withSamples: boolean;
6183
- decisions: Record<string, CatalogDecision>;
6184
- fingerprint: string;
6185
- }
6186
- export interface CatalogInstallResult {
6187
- installed: {
6188
- entryId: string;
6189
- version: number;
6190
- targetKind: CatalogEntryKind;
6191
- targetId: string;
6192
- }[];
6193
- failed: {
6194
- entryId: string;
6195
- reason: string;
6196
- }[];
6197
- }
6119
+ /**
6120
+ * react-grid-layout's `LayoutConstraint`, structurally: a resize lands on a
6121
+ * width step and a `flexible` height within its bounds; a `fit` height is
6122
+ * the content's, so it never changes by hand.
6123
+ */
6124
+ export declare function widthStepConstraint(traitsOf: TraitsOf): {
6125
+ name: "width-steps";
6126
+ constrainSize(item: LayoutCell, w: number, h: number): {
6127
+ w: number;
6128
+ h: number;
6129
+ };
6130
+ };
6131
+ /**
6132
+ * Read-time repair of a stored grid; never throws. `flexible` heights come
6133
+ * within their bounds, widths snap to steps (and widen to `minWidth`) within
6134
+ * the grid, overlaps are resolved by push, the grid is packed, and only the
6135
+ * first movable `fill` block in reading order keeps `fill` (the others are
6136
+ * reported and render `flexible`). `static` cells are kept.
6137
+ */
6138
+ export declare function repairPageGrid(cells: readonly LayoutCell[], traitsOf: TraitsOf): {
6139
+ cells: LayoutCell[];
6140
+ repairs: GridRepair[];
6141
+ };
6142
+ /**
6143
+ * The one block of a page that keeps `fill`: the first movable `fill` block in
6144
+ * reading order. A static (a block hidden from the viewer, whose traits the
6145
+ * read view never sees) never keeps it, so the server and the read view
6146
+ * choose alike. Any other `fill` block renders `flexible` at its stored height.
6147
+ */
6148
+ export declare function keptFill(cells: readonly LayoutCell[], traitsOf: TraitsOf): string | undefined;
6149
+ /**
6150
+ * The 6-column layout: cells in reading order at half width (never below
6151
+ * their `minWidth`, never above 6), laid left to right, then packed.
6152
+ */
6153
+ export declare function deriveLayout6(cells: readonly LayoutCell[], traitsOf: TraitsOf): LayoutCell[];
6154
+ /**
6155
+ * Where an added block goes: a figure next to the existing top-level figures,
6156
+ * else at the top (the caller pushes the rest down); anything else at the end,
6157
+ * full left, with its default size.
6158
+ */
6159
+ export declare function placeNew(cells: readonly LayoutCell[], name: string, traits: LayoutTraits, figures: ReadonlySet<string>): LayoutCell;
6198
6160
  //#endregion
6199
- //#region src/types/schema-state.d.ts
6200
- type Without<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
6201
- export type ViewSourceOwner = "core" | `bundle:${string}` | `source:${string}`;
6202
- export type SchemaStateAddress = ["object", string] | ["attribute", string, string] | ["view", string, string] | ["content", string, string, string];
6203
- export type SchemaStateDefinition = Omit<ObjectDefinition, "id" | "name" | "system" | "attributes"> | Without<Attribute, "id" | "objectId" | "name" | "system"> | (Omit<ContentViewDefinition, "object" | "name" | "contents"> & {
6204
- contents: string[];
6205
- }) | Without<ViewContentDefinition, "name">;
6206
- export interface SchemaStateEntry {
6207
- address: SchemaStateAddress;
6208
- source: SchemaStateDefinition | null;
6209
- effective: SchemaStateDefinition | null;
6210
- status: "source" | "runtime" | "copy" | "suppressed";
6211
- sourceOwner: ViewSourceOwner | null;
6212
- guard: {
6213
- id: string;
6214
- revision: number;
6215
- } | {
6216
- id: string;
6217
- updatedAt: string;
6218
- } | null;
6219
- }
6220
- export interface SchemaState {
6221
- modelVersion: 1;
6222
- hashVersion: 1;
6223
- tenant: string;
6224
- sourceFingerprint: string;
6225
- entries: SchemaStateEntry[];
6161
+ //#region src/views/content-state.d.ts
6162
+ type WithoutName<T> = T extends unknown ? Omit<T, "name"> : never;
6163
+ export type StoredContentDefinition = WithoutName<ViewContentDefinition>;
6164
+ export interface DraftContentState {
6165
+ sourceDefinition: StoredContentDefinition | null;
6166
+ workspaceDefinition: StoredContentDefinition | null;
6167
+ suppressed: boolean;
6168
+ sourcePosition: number | null;
6169
+ workspacePosition: number | null;
6170
+ /** A page block's cell as code declares it; `null` off a page or for a workspace block. */
6171
+ sourceGrid: GridPosition | null;
6172
+ /** A page block's cell once the page's grid is customized; `null` otherwise. */
6173
+ workspaceGrid: GridPosition | null;
6226
6174
  }
6227
- export type SchemaStateChange = SchemaStateEntry & {
6228
- change: "added" | "removed" | "changed" | "copied" | "suppressed";
6229
- };
6230
- export interface SchemaStateDiff {
6231
- modelVersion: 1;
6232
- tenant: string;
6233
- sourceFingerprint: string;
6234
- changes: SchemaStateChange[];
6175
+ export interface DraftViewAuthoring {
6176
+ origin: "code" | "runtime";
6177
+ mainOrderCustomized: boolean;
6178
+ asideOrderCustomized: boolean;
6179
+ /** Set once the page's grid is moved: every block then sits at its `workspaceGrid`. */
6180
+ gridCustomized: boolean;
6181
+ /** Set once the architect chose the tenant Home: wins over code's `.home()` at sync. */
6182
+ homeCustomized: boolean;
6183
+ contents: Record<string, DraftContentState>;
6235
6184
  }
6236
- //#endregion
6237
- //#region src/types/ai-usage.d.ts
6238
- /** Client-safe AI usage and wallet vocabulary, shared by the journal, the API and the composer. */
6239
- export type UsageModality = "text" | "image" | "audio" | "video" | "embedding" | "decision";
6240
- /** Whose usage a report covers: the caller's own (agents folded into their principal) or the whole workspace. */
6241
- export type UsageScope = "me" | "workspace";
6242
- /** One aggregate of journal rows; money as decimal strings, counts as integers. */
6243
- export interface UsageBucket {
6244
- /** Money the Gateway reported or looked up (`cost_source` gateway-response / gateway-lookup). */
6245
- confirmedCostUsd: string;
6185
+ export declare function contentDefinition(name: string, state: Pick<DraftContentState, "sourceDefinition" | "workspaceDefinition" | "suppressed">): ViewContentDefinition | null;
6186
+ export declare function storedContentDefinition<T extends ViewContentDefinition>(content: T): WithoutName<T>;
6187
+ /** The authoring of a view that exists only in the workspace; `grid` places a page's blocks. */
6188
+ export declare function workspaceViewAuthoring(contents: readonly ViewContentDefinition[], grid?: Readonly<Record<string, GridPosition>>): DraftViewAuthoring;
6189
+ export interface ResolvedPageGrid {
6190
+ grid: Record<string, GridPosition>;
6246
6191
  /**
6247
- * Cost of successful rows the Gateway never priced: catalogue estimates, else
6248
- * the admission estimate of a row whose cost stayed pending or unknown. Open
6249
- * holds, failed and expired rows count nothing here.
6192
+ * What read-time repair changed, for the runtime to log once per revision.
6193
+ * Consumers apply two kinds the grid cannot carry: a `fill` repair renders
6194
+ * that block `flexible` at its stored height, and a `dropped` content is
6195
+ * left out of the page altogether (it has no cell in `grid`).
6250
6196
  */
6251
- estimatedCostUsd: string;
6252
- /** Successful rows whose cost is still pending plus rows still open (reserved, in flight, indeterminate). */
6253
- pendingCount: number;
6254
- calls: number;
6255
- inputTokens: number;
6256
- outputTokens: number;
6257
- audioInputMs: number;
6258
- outputCount: number;
6197
+ repairs: GridRepair[];
6259
6198
  }
6260
- /** `GET /ai/usage`: totals and breakdowns over an inclusive UTC day window. */
6261
- export interface UsageReport {
6262
- from: string;
6263
- to: string;
6264
- scope: UsageScope;
6265
- totals: UsageBucket;
6266
- /** Every day of the window, zeros included. */
6267
- byDay: Array<{
6268
- day: string;
6269
- } & UsageBucket>;
6270
- byModality: Array<{
6271
- modality: UsageModality;
6272
- } & UsageBucket>;
6273
- /** `model` is the executed model when known, else the requested one. */
6274
- byModel: Array<{
6275
- model: string;
6276
- provider: string | null;
6277
- } & UsageBucket>;
6278
- /** Workspace scope only. */
6279
- byMember?: Array<{
6280
- actorId: string;
6281
- displayName: string;
6282
- } & UsageBucket>;
6283
- /** Absent under metering-only. */
6284
- wallet?: WalletState;
6199
+ export interface ResolvePageGridOptions {
6200
+ /** Blocks that never move (hidden from the viewer): repair and packing keep their cells. */
6201
+ statics?: ReadonlySet<string>;
6202
+ /** A content's layout traits; defaults to `layoutTraitsOf` over the global block registry. */
6203
+ traitsOf?: (name: string) => LayoutTraits;
6285
6204
  }
6286
- export type UsageCostSource = "gateway-response" | "gateway-lookup" | "catalog-estimate";
6287
6205
  /**
6288
- * Unknown billing evidence is never represented by a zero-dollar charge.
6289
- * `usd` is a decimal string, never a float.
6206
+ * A page's effective grid, the twin of {@link resolveViewContents}'s ordering.
6207
+ * Once the grid is customized every block sits at its `workspaceGrid`. Before,
6208
+ * code blocks sit at their `sourceGrid`, and a workspace block at its own
6209
+ * `workspaceGrid` where that cell is still free. A block left without a cell
6210
+ * (a code block added after customization, a workspace block whose cell code
6211
+ * now covers) is stacked below the last row, by name. Grouped members have no
6212
+ * cell: their group holds it, and a group whose members are all gone has
6213
+ * none. The result is then repaired (`repairPageGrid`:
6214
+ * width steps, push, packing, extra fills) with `statics` kept in place, and
6215
+ * contents beyond the page limit are left out; never throws.
6216
+ */
6217
+ export declare function resolvePageGrid(authoring: Pick<DraftViewAuthoring, "contents" | "gridCustomized">, options?: ResolvePageGridOptions): ResolvedPageGrid;
6218
+ /** The contents read-time repair left out of a page (beyond its limit). */
6219
+ export declare function droppedContents(repairs: readonly GridRepair[]): Set<string>;
6220
+ /** What ordering reads of a content: its definitions and its positions, not its grid cell. */
6221
+ type OrderedContentState = Omit<DraftContentState, "sourceGrid" | "workspaceGrid">;
6222
+ /** One ordering resolver shared by persisted rows and the authoring fold. */
6223
+ export declare function resolveViewContents(authoring: Pick<DraftViewAuthoring, "mainOrderCustomized" | "asideOrderCustomized"> & {
6224
+ contents: Readonly<Record<string, OrderedContentState>>;
6225
+ }): ViewContentDefinition[];
6226
+ //#endregion
6227
+ //#region src/architect/operation-types.d.ts
6228
+ /**
6229
+ * Where an operation is visible. Drives live navigation: the client turns a
6230
+ * focus into a route and, when following, goes there before rendering the
6231
+ * overlay.
6232
+ */
6233
+ export interface DraftFocus {
6234
+ objectName?: string;
6235
+ viewName?: string;
6236
+ /** A page is addressed by id: pages are never addressed by name. */
6237
+ pageId?: string;
6238
+ /**
6239
+ * The page's label when the operation itself carries one (`create_page`, a
6240
+ * labelled `duplicate_page`), for a step shown before the fold names it.
6241
+ * Display only: never an address.
6242
+ */
6243
+ pageName?: string;
6244
+ contentName?: string;
6245
+ objectId?: string;
6246
+ /** Attribute identity within objectId, used for exact compare snapshots. */
6247
+ attributeId?: string;
6248
+ /** Attribute identity by NAME within objectId — for operations that address an existing attribute. */
6249
+ attributeName?: string;
6250
+ recordId?: string;
6251
+ }
6252
+ export type ArchitectImpact = "atomic" | "local" | "structural";
6253
+ export type ArchitectNavigation = "none" | "if-not-visible" | "follow";
6254
+ export interface ArchitectPresentation {
6255
+ impact: ArchitectImpact;
6256
+ navigation: ArchitectNavigation;
6257
+ focus: DraftFocus & {
6258
+ propertyPath?: readonly string[];
6259
+ };
6260
+ }
6261
+ export interface ArchitectChange {
6262
+ operationId: string;
6263
+ operationType: string;
6264
+ presentation: ArchitectPresentation;
6265
+ before: unknown;
6266
+ after: unknown;
6267
+ /** The agent's note on this operation, when it wrote one (D9). */
6268
+ note?: string;
6269
+ /** Set when the operation was produced by adding a bundle. */
6270
+ origin?: OperationOrigin;
6271
+ }
6272
+ /** One operation of a draft as stored and sent: its shared fields plus its type's payload. */
6273
+ export type ViewOperation = BaseOperation & Record<string, unknown>;
6274
+ /** What the fold adds to every view: identity, revisions and the authoring baseline. */
6275
+ interface DraftableViewState {
6276
+ authoring: DraftViewAuthoring;
6277
+ id: string;
6278
+ revision: number;
6279
+ contentRevisions: Record<string, number>;
6280
+ contentIds: Record<string, string>;
6281
+ /**
6282
+ * Set on the two views `add_object` folds. While present, the view is a pure
6283
+ * function of the object's attributes and `add_attribute` regenerates it.
6284
+ * The first explicit view operation removes the key. Never persisted:
6285
+ * `fromDraftableView` ignores it, so the client and server folds agree.
6286
+ */
6287
+ derived?: true;
6288
+ }
6289
+ /**
6290
+ * A record or collection view as the fold sees it. The object is referenced by
6291
+ * NAME: `ViewDefinition` references its object by name throughout this
6292
+ * codebase; carrying an id here would force every reader to invent a mapping
6293
+ * that does not exist in the data.
6294
+ */
6295
+ export type DraftableObjectView = ObjectViewDefinition & DraftableViewState;
6296
+ /** A page as the fold sees it, with the access facts its operations check. */
6297
+ export type DraftablePageView = PageViewDefinition & DraftableViewState & {
6298
+ visibility: "workspace" | "private";
6299
+ /** The actor owning a private page; `null` for a shared one. */
6300
+ ownedBy: string | null;
6301
+ };
6302
+ /** A view as the fold sees it — published shape, no persistence concerns. */
6303
+ export type DraftableView = DraftableObjectView | DraftablePageView;
6304
+ /**
6305
+ * An object as the fold sees it.
6306
+ *
6307
+ * The four settings are composed from {@link UpdateObjectInput} rather than
6308
+ * retyped: that interface is the canonical list the service writes, so a field
6309
+ * that gains a type there cannot drift here. `metadata` stays out — an open bag
6310
+ * has no place in a contract two folds must agree on — and `label` and `icon`
6311
+ * are declared locally: `label` is required on a draftable object, and `icon`
6312
+ * stays a plain `string` rather than `IconName`, deliberately local so the
6313
+ * draft contract never depends on the icon catalogue.
6314
+ */
6315
+ export interface DraftableObject extends Omit<UpdateObjectInput, "metadata" | "label" | "icon"> {
6316
+ id: string;
6317
+ name: string;
6318
+ label: string;
6319
+ icon?: string;
6320
+ }
6321
+ export interface DraftableAttribute {
6322
+ id: string;
6323
+ objectId: string;
6324
+ name: string;
6325
+ label: string;
6326
+ attributeType: string;
6327
+ /** Type-specific configuration (relation targets, select options, ...). */
6328
+ config?: Record<string, unknown>;
6329
+ }
6330
+ /** Whether a new sample is display-only or explicitly requested real data. */
6331
+ export type SamplePublication = "preview" | "requested-data";
6332
+ export interface DraftableSampleRecord {
6333
+ id: string;
6334
+ objectId: string;
6335
+ values: Record<string, unknown>;
6336
+ /** Absent on historical drafts; publication requires an explicit legacy choice. */
6337
+ publication?: SamplePublication;
6338
+ }
6339
+ /**
6340
+ * Everything an operation may read or write.
6341
+ *
6342
+ * The client folds a draft over this shape to render the overlay; the server
6343
+ * folds the same draft over the same shape at publish time. One fold, so a
6344
+ * preview is the result rather than a prediction of it.
6345
+ */
6346
+ export interface DraftableState {
6347
+ objects: DraftableObject[];
6348
+ attributes: DraftableAttribute[];
6349
+ views: DraftableView[];
6350
+ sampleRecords: DraftableSampleRecord[];
6351
+ }
6352
+ /** Context passed to `describe` so summaries can be localised. */
6353
+ export interface LabelContext {
6354
+ locale: "fr" | "en";
6355
+ }
6356
+ /** The shape every operation payload shares. */
6357
+ export interface BaseOperation {
6358
+ /** This operation's own id, used to remove it from a draft. */
6359
+ id: string;
6360
+ type: string;
6361
+ /** The architect's own sentence — what it does and why; ≤ 160 chars. Persisted with the operation. */
6362
+ note?: string;
6363
+ /** Set on every operation adding a bundle produced; the publish records it in `installed_bundle_pieces`. */
6364
+ origin?: OperationOrigin;
6365
+ }
6366
+ //#endregion
6367
+ //#region src/builders/placeable-content.d.ts
6368
+ /** What a placed `custom` content keeps of its block: enough to validate its placement. */
6369
+ export type PlacedBlock = Pick<BlockDefinition, "name" | "contexts" | "parameters" | "refine">;
6370
+ /** What a view tab or a page cell places: a literal configuration, or a builder of one. */
6371
+ export type PlaceableContent = ContentConfiguration | {
6372
+ build(): ContentConfiguration;
6373
+ readonly extension?: PlacedBlock;
6374
+ };
6375
+ /** A page cell given an explicit width, in grid columns (`.span(n)`). */
6376
+ export interface SpannedContent {
6377
+ readonly content: PlaceableContent;
6378
+ readonly span: BlockWidth;
6379
+ }
6380
+ type BuiltContent<B> = B extends {
6381
+ build(): infer C;
6382
+ } ? C : B;
6383
+ //#endregion
6384
+ //#region src/builders/page-builder.d.ts
6385
+ /** A page as the schema declares it: standalone (`O` undefined) or a record page of `O`. */
6386
+ export interface PageDeclaration<N extends string = string, O extends string | undefined = string | undefined> {
6387
+ kind: "view";
6388
+ definition: Omit<PageViewDefinition, "name" | "object"> & {
6389
+ name: N;
6390
+ } & (O extends string ? {
6391
+ object: O;
6392
+ } : {
6393
+ object?: undefined;
6394
+ });
6395
+ }
6396
+ /** One row of a page: blocks named by their keys, in order. */
6397
+ export type PageRow = Readonly<Record<string, PlaceableContent | SpannedContent>>;
6398
+ /** A row's group: its name (`group_<smallest member key>` by default) and its title. */
6399
+ export interface PageRowGroup {
6400
+ name?: string;
6401
+ label?: string;
6402
+ }
6403
+ /** How a row is placed: `group` puts its blocks in one group (a band or a shared card). */
6404
+ export interface PageRowOptions {
6405
+ group?: PageRowGroup;
6406
+ }
6407
+ /**
6408
+ * A heading's name (`heading_<slug of its title>` by default) and what it
6409
+ * shows under and beside its title.
6410
+ */
6411
+ export interface PageHeadingMeta {
6412
+ name?: string;
6413
+ description?: string;
6414
+ icon?: IconName;
6415
+ }
6416
+ type PageSection = {
6417
+ kind: "row";
6418
+ blocks: PageRow;
6419
+ group?: PageRowGroup;
6420
+ } | {
6421
+ kind: "heading";
6422
+ title: string;
6423
+ meta: PageHeadingMeta;
6424
+ };
6425
+ interface PageData$1<N extends string, O extends string | undefined> {
6426
+ name: N;
6427
+ label: string;
6428
+ object: O;
6429
+ icon?: IconName;
6430
+ description?: string;
6431
+ home?: boolean;
6432
+ sections: readonly PageSection[];
6433
+ }
6434
+ /**
6435
+ * A page: rows of named blocks on a 12-column grid. The builder computes every
6436
+ * position; blocks are named by their keys, as AI SDK tools are.
6437
+ *
6438
+ * `H` records whether `.home()` was called, so `.home()` and `.for()` exclude
6439
+ * each other by type; `build()` refuses the pair for untyped callers too.
6440
+ */
6441
+ export declare class PageBuilder<N extends string, O extends string | undefined = undefined, H extends boolean = false> {
6442
+ readonly kind = "view";
6443
+ readonly _home?: H;
6444
+ private readonly data;
6445
+ constructor(data: PageData$1<N, O>);
6446
+ icon(icon: IconName): PageBuilder<N, O, H>;
6447
+ description(description: string): PageBuilder<N, O, H>;
6448
+ /** The workspace's home. Only a standalone page can be. */
6449
+ home(this: PageBuilder<N, undefined, boolean>): PageBuilder<N, undefined, true>;
6450
+ /** Makes this a record page of `object`, rendered for one of its records. */
6451
+ for<const B extends ObjectBuilderLike>(this: PageBuilder<N, undefined, false>, object: B): PageBuilder<N, B["_types"]["name"], false>;
6452
+ for<const S extends string>(this: PageBuilder<N, undefined, false>, object: S): PageBuilder<N, S, false>;
6453
+ /**
6454
+ * A row of blocks: the columns a `.span(n)` leaves free are shared in width
6455
+ * steps. `{ group: { name?, label? } }` puts the row's blocks in one group,
6456
+ * named `group_<smallest member key>` unless told.
6457
+ */
6458
+ row(blocks: PageRow, options?: PageRowOptions): PageBuilder<N, O, H>;
6459
+ /**
6460
+ * A heading on its own row, named `meta.name`, else `heading_<slug of its
6461
+ * title>` (`_2`, `_3`… for a title already used, in order).
6462
+ */
6463
+ heading(title: string, meta?: PageHeadingMeta): PageBuilder<N, O, H>;
6464
+ build(): PageDeclaration<N, O>;
6465
+ }
6466
+ /** A page of the workspace: standalone until `.for(object)` makes it a record page. */
6467
+ declare function page$1<const N extends string>(name: N, label: string): PageBuilder<N>;
6468
+ //#endregion
6469
+ //#region src/utils/schema-source-resolution.d.ts
6470
+ /**
6471
+ * A change to a system attribute that the code alone cannot state, resolved by
6472
+ * the push that carries it (#4362): the rename that keeps its values, or one of
6473
+ * the two retypes a push knows how to convert. It travels with the source's
6474
+ * `PUT`, outside the source hash, and is shared by the runtime and
6475
+ * `@standards/client` so both read one shape.
6476
+ */
6477
+ export type SchemaSourceResolution = SchemaSourceRename | SchemaSourceRetype;
6478
+ /** Keep the stored attribute `from`, and its record values, under the name `to`. */
6479
+ export interface SchemaSourceRename {
6480
+ kind: "rename";
6481
+ object: string;
6482
+ from: string;
6483
+ to: string;
6484
+ }
6485
+ /** Convert a stored `text` attribute and its values to `phone`. */
6486
+ export interface SchemaSourcePhoneRetype {
6487
+ kind: "retype";
6488
+ object: string;
6489
+ attribute: string;
6490
+ to: "phone";
6491
+ /** The country a number written without its calling code belongs to. */
6492
+ defaultCountryCode: CountryIso3;
6493
+ }
6494
+ /** Convert a stored `number` attribute and its values to `currency`. */
6495
+ export interface SchemaSourceCurrencyRetype {
6496
+ kind: "retype";
6497
+ object: string;
6498
+ attribute: string;
6499
+ to: "currency";
6500
+ /** The currency every converted amount is stored in. */
6501
+ currencyCode: CurrencyCode;
6502
+ }
6503
+ export type SchemaSourceRetype = SchemaSourcePhoneRetype | SchemaSourceCurrencyRetype;
6504
+ /** The stored type each retype a push supports converts from. */
6505
+ export declare const SCHEMA_SOURCE_RETYPE_FROM: {
6506
+ readonly phone: "text";
6507
+ readonly currency: "number";
6508
+ };
6509
+ /**
6510
+ * The shape gate of a push's `resolutions`, run before anything reads the
6511
+ * store: an array of at most {@link SCHEMA_SOURCE_MAX_RESOLUTIONS} entries,
6512
+ * each exactly one of the three shapes, no two of the same kind on one
6513
+ * attribute. Whether each one applies is the push's to decide, against the
6514
+ * stored schema.
6515
+ *
6516
+ * @throws ValidationError naming `resolutions.<index>.<field>`
6517
+ */
6518
+ export declare function assertSchemaSourceResolutions(value: unknown): asserts value is SchemaSourceResolution[];
6519
+ /** A stored value converted by a retype, or `undefined` when it cannot be. */
6520
+ type ConvertedValue = {
6521
+ value: Phone | Currency | null;
6522
+ } | undefined;
6523
+ /**
6524
+ * One stored value as the retyped attribute stores it (#4362): `null` stays
6525
+ * `null`; a text parses as a phone number (the resolution's country when it
6526
+ * carries none of its own); a finite number becomes an amount in the
6527
+ * resolution's currency — a negative one only when the declared attribute
6528
+ * allows it. Anything else — a text that is not a possible number, carries an
6529
+ * extension or no country, a value of another JSON type — is not converted.
6530
+ */
6531
+ export declare function convertRetypedValue(resolution: SchemaSourceRetype, value: unknown, declared?: {
6532
+ allowNegative?: boolean;
6533
+ }): ConvertedValue;
6534
+ //#endregion
6535
+ //#region src/types/bundle.d.ts
6536
+ /** The locales a bundle ships translation tables for; the bundle routes accept no other. */
6537
+ export declare const BUNDLE_LOCALES: readonly ["fr", "en"];
6538
+ export type BundleLocale = (typeof BUNDLE_LOCALES)[number];
6539
+ /**
6540
+ * Translation key -> translated string, for one locale; a missing key keeps
6541
+ * the default string. Keys: `label`, `description`;
6542
+ * `objects.<object>.label | pluralLabel | attributes.<attribute>.label |
6543
+ * attributes.<attribute>.options.<value>`;
6544
+ * `views.<object>.<view>.label | contents.<content>.label | markdown`;
6545
+ * `pages.<page>.label | contents.<content>.label | markdown`;
6546
+ * `agents.<agent>.label | description | systemPrompt`;
6547
+ * `samples.<sample id>.<attribute>`.
6548
+ */
6549
+ export type BundleTranslationTable = Record<string, string>;
6550
+ /** What `bundle(...).build()` returns: plain, serializable, hashed over its pieces only. */
6551
+ export interface BuiltBundle {
6552
+ name: string;
6553
+ label: string;
6554
+ description: string | null;
6555
+ /** sha256 hex of the canonical pieces (objects, views, pages, agents, sorted by name). */
6556
+ hash: string;
6557
+ objects: ObjectDefinition[];
6558
+ views: ContentViewDefinition[];
6559
+ pages: PageDeclaration[];
6560
+ agents: AgentBlueprint[];
6561
+ /** Names of the bundles this one uses. */
6562
+ uses: string[];
6563
+ samples: DraftableSampleRecord[];
6564
+ translations: Partial<Record<BundleLocale, BundleTranslationTable>>;
6565
+ }
6566
+ /** How a bundle sits in a workspace: synced keeps owning its pieces, added is a copy the workspace owns. */
6567
+ export type BundleMode = "synced" | "added";
6568
+ /** Where a synced bundle came from: declared in the host's code, or pushed over HTTP. */
6569
+ export type BundleOrigin = "code" | "http";
6570
+ /** One installed bundle, as `bundles.list` and `bundles.get` answer it. */
6571
+ export interface InstalledBundleSummary {
6572
+ name: string;
6573
+ label: string;
6574
+ description: string | null;
6575
+ mode: BundleMode;
6576
+ /** `null` for an added bundle. */
6577
+ origin: BundleOrigin | null;
6578
+ /** The version the workspace holds; `null` for an added bundle. */
6579
+ hash: string | null;
6580
+ /** Names of the bundles a synced bundle uses; empty for an added one. */
6581
+ uses: string[];
6582
+ installedAt: string;
6583
+ updatedAt: string;
6584
+ /** The actor who installed it; `null` when the system did. */
6585
+ installedBy: string | null;
6586
+ }
6587
+ /** A bundle the workspace may add, localized for the asked locale. */
6588
+ export interface AvailableBundleSummary {
6589
+ name: string;
6590
+ label: string;
6591
+ description: string | null;
6592
+ /** Names of the bundles adding this one pulls in. */
6593
+ uses: string[];
6594
+ hasSamples: boolean;
6595
+ installed: boolean;
6596
+ }
6597
+ /**
6598
+ * What `PUT /bundles/:name` carries: the built bundle, plus the renames and
6599
+ * retypes this sync resolves (#4362). `resolutions` travel outside the hash: a
6600
+ * bundle whose hash is already held is not pushed, and its resolutions with it.
6601
+ * The path `:name` is authoritative: a body `name`, when present, must equal it.
6602
+ */
6603
+ export type SyncBundleInput = Omit<BuiltBundle, "name"> & {
6604
+ name?: string;
6605
+ resolutions?: SchemaSourceResolution[];
6606
+ };
6607
+ /** What a sync reports; `applied: false` when the workspace already held this hash. */
6608
+ export interface SyncBundleResult {
6609
+ applied: boolean;
6610
+ hash: string;
6611
+ objects?: {
6612
+ created: number;
6613
+ updated: number;
6614
+ deleted: number;
6615
+ };
6616
+ views?: {
6617
+ created: number;
6618
+ updated: number;
6619
+ adopted: number;
6620
+ released: number;
6621
+ };
6622
+ }
6623
+ export type BundlePieceKind = "object" | "view" | "agent";
6624
+ /** One piece an added install would write, and whether it collides with the workspace. */
6625
+ export interface BundlePlanPiece {
6626
+ /** The key `decisions` use for this piece. */
6627
+ pieceId: string;
6628
+ /** The bundle that declares the piece. */
6629
+ bundleName: string;
6630
+ kind: BundlePieceKind;
6631
+ status: "new" | "collides";
6632
+ existingName?: string;
6633
+ installable: boolean;
6634
+ reason?: string;
6635
+ inverseRelations?: {
6636
+ objectName: string;
6637
+ attributeName: string;
6638
+ }[];
6639
+ }
6640
+ export interface BundleAddPlan {
6641
+ pieces: BundlePlanPiece[];
6642
+ /** Ties `bundles.add` to the workspace this preview saw. */
6643
+ fingerprint: string;
6644
+ }
6645
+ /** What adding wrote: one entry per object, view or agent created, under the bundle that declares it. */
6646
+ export interface BundleAddResult {
6647
+ added: {
6648
+ bundleName: string;
6649
+ targetKind: BundlePieceKind;
6650
+ targetId: string;
6651
+ }[];
6652
+ /** Always empty in phase 1: a piece that fails rolls the whole add back. */
6653
+ failed: {
6654
+ pieceId: string;
6655
+ reason: string;
6656
+ }[];
6657
+ }
6658
+ /** Where an added piece came from; stamped on every draft operation it produces. */
6659
+ export interface OperationOrigin {
6660
+ /** The bundle that declares the piece. */
6661
+ bundleName: string;
6662
+ /** The language the piece was compiled in; its provenance row records it. */
6663
+ locale: BundleLocale;
6664
+ }
6665
+ //#endregion
6666
+ //#region src/types/schema-state.d.ts
6667
+ type Without<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
6668
+ /** Who declares a schema piece: the runtime's core, or a bundle by name. */
6669
+ export type SchemaOwner = "core" | `bundle:${string}`;
6670
+ /** The one owner rule, shared by the zod validator, the Postgres mapper and the mock. */
6671
+ export declare const SCHEMA_OWNER_PATTERN: RegExp;
6672
+ /** Narrows a stored or wire owner string; throws `ValidationError` on any other shape. */
6673
+ export declare function parseSchemaOwner(value: string | null): SchemaOwner | null;
6674
+ export type SchemaStateAddress = ["object", string] | ["attribute", string, string] | ["view", string, string] | ["content", string, string, string];
6675
+ export type SchemaStateDefinition = Omit<ObjectDefinition, "id" | "name" | "system" | "attributes"> | Without<Attribute, "id" | "objectId" | "name" | "system"> | (Omit<ContentViewDefinition, "object" | "name" | "contents"> & {
6676
+ contents: string[];
6677
+ }) | Without<ViewContentDefinition, "name">;
6678
+ export interface SchemaStateEntry {
6679
+ address: SchemaStateAddress;
6680
+ source: SchemaStateDefinition | null;
6681
+ effective: SchemaStateDefinition | null;
6682
+ status: "source" | "runtime" | "copy" | "suppressed";
6683
+ sourceOwner: SchemaOwner | null;
6684
+ guard: {
6685
+ id: string;
6686
+ revision: number;
6687
+ } | {
6688
+ id: string;
6689
+ updatedAt: string;
6690
+ } | null;
6691
+ }
6692
+ export interface SchemaState {
6693
+ modelVersion: 1;
6694
+ hashVersion: 1;
6695
+ tenant: string;
6696
+ sourceFingerprint: string;
6697
+ entries: SchemaStateEntry[];
6698
+ }
6699
+ export type SchemaStateChange = SchemaStateEntry & {
6700
+ change: "added" | "removed" | "changed" | "copied" | "suppressed";
6701
+ };
6702
+ export interface SchemaStateDiff {
6703
+ modelVersion: 1;
6704
+ tenant: string;
6705
+ sourceFingerprint: string;
6706
+ changes: SchemaStateChange[];
6707
+ }
6708
+ //#endregion
6709
+ //#region src/types/ai-usage.d.ts
6710
+ /** Client-safe AI usage and wallet vocabulary, shared by the journal, the API and the composer. */
6711
+ export type UsageModality = "text" | "image" | "audio" | "video" | "embedding" | "decision";
6712
+ /** Whose usage a report covers: the caller's own (agents folded into their principal) or the whole workspace. */
6713
+ export type UsageScope = "me" | "workspace";
6714
+ /** One aggregate of journal rows; money as decimal strings, counts as integers. */
6715
+ export interface UsageBucket {
6716
+ /** Money the Gateway reported or looked up (`cost_source` gateway-response / gateway-lookup). */
6717
+ confirmedCostUsd: string;
6718
+ /**
6719
+ * Cost of successful rows the Gateway never priced: catalogue estimates, else
6720
+ * the admission estimate of a row whose cost stayed pending or unknown. Open
6721
+ * holds, failed and expired rows count nothing here.
6722
+ */
6723
+ estimatedCostUsd: string;
6724
+ /** Successful rows whose cost is still pending plus rows still open (reserved, in flight, indeterminate). */
6725
+ pendingCount: number;
6726
+ calls: number;
6727
+ inputTokens: number;
6728
+ outputTokens: number;
6729
+ audioInputMs: number;
6730
+ outputCount: number;
6731
+ }
6732
+ /** `GET /ai/usage`: totals and breakdowns over an inclusive UTC day window. */
6733
+ export interface UsageReport {
6734
+ from: string;
6735
+ to: string;
6736
+ scope: UsageScope;
6737
+ totals: UsageBucket;
6738
+ /** Every day of the window, zeros included. */
6739
+ byDay: Array<{
6740
+ day: string;
6741
+ } & UsageBucket>;
6742
+ byModality: Array<{
6743
+ modality: UsageModality;
6744
+ } & UsageBucket>;
6745
+ /** `model` is the executed model when known, else the requested one. */
6746
+ byModel: Array<{
6747
+ model: string;
6748
+ provider: string | null;
6749
+ } & UsageBucket>;
6750
+ /** Workspace scope only. */
6751
+ byMember?: Array<{
6752
+ actorId: string;
6753
+ displayName: string;
6754
+ } & UsageBucket>;
6755
+ /** Absent under metering-only. */
6756
+ wallet?: WalletState;
6757
+ }
6758
+ export type UsageCostSource = "gateway-response" | "gateway-lookup" | "catalog-estimate";
6759
+ /**
6760
+ * Unknown billing evidence is never represented by a zero-dollar charge.
6761
+ * `usd` is a decimal string, never a float.
6290
6762
  */
6291
6763
  export type UsageCost = {
6292
6764
  status: "confirmed";
@@ -7001,12 +7473,12 @@ export interface EnvironmentList {
7001
7473
  /**
7002
7474
  * Type of resource that can be audited
7003
7475
  */
7004
- export declare const AUDIT_RESOURCE_TYPES: readonly ["record", "object", "attribute", "view", "user", "role", "settings", "file", "agent", "schema_source", "tenant_invitation", "api_key"];
7476
+ export declare const AUDIT_RESOURCE_TYPES: readonly ["record", "object", "attribute", "view", "user", "role", "settings", "file", "agent", "bundle", "tenant_invitation", "api_key"];
7005
7477
  export type AuditResourceType = (typeof AUDIT_RESOURCE_TYPES)[number];
7006
7478
  /**
7007
7479
  * Actions that can be audited
7008
7480
  */
7009
- export declare const AUDIT_ACTIONS: readonly ["record.created", "record.updated", "record.deleted", "record.restored", "record.purged", "record.access_changed", "agent.access_changed", "object.created", "object.updated", "object.deleted", "attribute.created", "attribute.updated", "attribute.deleted", "view.created", "view.updated", "view.deleted", "schema_source.applied", "schema_source.presented", "schema_source.removed", "user.created", "user.invited", "user.updated", "user.deleted", "user.login", "user.logout", "tenant_invitation.created", "tenant_invitation.delivery_failed", "tenant_invitation.resent", "tenant_invitation.revoked", "tenant_invitation.accepted", "role.created", "role.updated", "role.deleted", "role.assigned", "role.revoked", "api_key.detached", "settings.updated", "file.uploaded", "file.updated", "file.deleted"];
7481
+ export declare const AUDIT_ACTIONS: readonly ["record.created", "record.updated", "record.deleted", "record.restored", "record.purged", "record.access_changed", "agent.access_changed", "object.created", "object.updated", "object.deleted", "attribute.created", "attribute.updated", "attribute.deleted", "view.created", "view.updated", "view.deleted", "bundle.synced", "bundle.removed", "bundle.added", "user.created", "user.invited", "user.updated", "user.deleted", "user.login", "user.logout", "tenant_invitation.created", "tenant_invitation.delivery_failed", "tenant_invitation.resent", "tenant_invitation.revoked", "tenant_invitation.accepted", "role.created", "role.updated", "role.deleted", "role.assigned", "role.revoked", "api_key.detached", "settings.updated", "file.uploaded", "file.updated", "file.deleted"];
7010
7482
  export type AuditAction = (typeof AUDIT_ACTIONS)[number];
7011
7483
  /**
7012
7484
  * Actor type - who performed the action
@@ -7940,7 +8412,7 @@ export type PageBlockData = {
7940
8412
  * block name. Blocks that read no record data through the page (people,
7941
8413
  * layout, context) and blocks hidden from the viewer are absent.
7942
8414
  */
7943
- interface PageData$1 {
8415
+ export interface PageData {
7944
8416
  blocks: Record<string, PageBlockData>;
7945
8417
  }
7946
8418
  /** What `POST /pages/:id/data` is asked: the reader's timezone, the record a record page shows. */
@@ -9752,15 +10224,213 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
9752
10224
  optional(): DocumentAttributeBuilder<TName, false, TProps>;
9753
10225
  }
9754
10226
  /**
9755
- * Create a document attribute.
9756
- *
9757
- * @example
9758
- * ```typescript
9759
- * document("identityDocument", "Pièce d'identité")
9760
- * .required()
9761
- * ```
10227
+ * Create a document attribute.
10228
+ *
10229
+ * @example
10230
+ * ```typescript
10231
+ * document("identityDocument", "Pièce d'identité")
10232
+ * .required()
10233
+ * ```
10234
+ */
10235
+ export declare function document<TName extends string>(name: TName, label: string): DocumentAttributeBuilder<TName, false>;
10236
+ //#endregion
10237
+ //#region src/builders/view-builder.d.ts
10238
+ export interface ViewDeclaration<N extends string = string, O extends string = string, C extends ObjectViewContext = ObjectViewContext, T extends ViewContentDefinition[] = ViewContentDefinition[]> {
10239
+ kind: "view";
10240
+ definition: Omit<ObjectViewDefinition, "name" | "object" | "context" | "contents"> & {
10241
+ name: N;
10242
+ object: O;
10243
+ context: C;
10244
+ contents: T;
10245
+ };
10246
+ }
10247
+ /** One canonical view model; factories differ only in their explicit record context. */
10248
+ export declare class ViewBuilder<N extends string, O extends string | undefined, C extends ObjectViewContext, T extends ViewContentDefinition[] = []> {
10249
+ readonly kind = "view";
10250
+ private readonly data;
10251
+ private readonly extensions;
10252
+ constructor(data: {
10253
+ name: N;
10254
+ label: string;
10255
+ object: O;
10256
+ context: C;
10257
+ contents: T;
10258
+ description?: string;
10259
+ icon?: IconName;
10260
+ default?: boolean;
10261
+ }, extensions?: readonly (PlacedBlock | undefined)[]);
10262
+ /** The object this view belongs to, by object builder or API name. */
10263
+ for<const B extends ObjectBuilderLike>(object: B): ViewBuilder<N, B["_types"]["name"], C, T>;
10264
+ for<const Name extends string>(object: Name): ViewBuilder<N, Name, C, T>;
10265
+ default(): ViewBuilder<N, O, C, T>;
10266
+ description(description: string): ViewBuilder<N, O, C, T>;
10267
+ icon(icon: IconName): ViewBuilder<N, O, C, T>;
10268
+ private place;
10269
+ tab<const Name extends string, const Label extends string, B extends PlaceableContent>(name: Name, label: Label, content: B): ViewBuilder<N, O, C, [...T, (BuiltContent<B> & {
10270
+ name: Name;
10271
+ label: Label;
10272
+ placement: "main";
10273
+ } & FormContentDefinition) | (BuiltContent<B> & {
10274
+ name: Name;
10275
+ label: Label;
10276
+ placement: "main";
10277
+ } & CollectionContentDefinition) | (BuiltContent<B> & {
10278
+ name: Name;
10279
+ label: Label;
10280
+ placement: "main";
10281
+ } & CustomContentDefinition) | (BuiltContent<B> & {
10282
+ name: Name;
10283
+ label: Label;
10284
+ placement: "main";
10285
+ } & ActivityContentDefinition) | (BuiltContent<B> & {
10286
+ name: Name;
10287
+ label: Label;
10288
+ placement: "main";
10289
+ } & RichtextContentDefinition) | (BuiltContent<B> & {
10290
+ name: Name;
10291
+ label: Label;
10292
+ placement: "main";
10293
+ } & DocumentsContentDefinition) | (BuiltContent<B> & {
10294
+ name: Name;
10295
+ label: Label;
10296
+ placement: "main";
10297
+ } & FormsContentDefinition) | (BuiltContent<B> & {
10298
+ name: Name;
10299
+ label: Label;
10300
+ placement: "main";
10301
+ } & EmailsContentDefinition) | (BuiltContent<B> & {
10302
+ name: Name;
10303
+ label: Label;
10304
+ placement: "main";
10305
+ } & MeetingsContentDefinition) | (BuiltContent<B> & {
10306
+ name: Name;
10307
+ label: Label;
10308
+ placement: "main";
10309
+ } & PageContentDefinition)]>;
10310
+ aside<const Name extends string, const Label extends string, B extends PlaceableContent>(name: Name, label: Label, content: B): ViewBuilder<N, O, C, [...T, (BuiltContent<B> & {
10311
+ name: Name;
10312
+ label: Label;
10313
+ placement: "aside";
10314
+ } & FormContentDefinition) | (BuiltContent<B> & {
10315
+ name: Name;
10316
+ label: Label;
10317
+ placement: "aside";
10318
+ } & CollectionContentDefinition) | (BuiltContent<B> & {
10319
+ name: Name;
10320
+ label: Label;
10321
+ placement: "aside";
10322
+ } & CustomContentDefinition) | (BuiltContent<B> & {
10323
+ name: Name;
10324
+ label: Label;
10325
+ placement: "aside";
10326
+ } & ActivityContentDefinition) | (BuiltContent<B> & {
10327
+ name: Name;
10328
+ label: Label;
10329
+ placement: "aside";
10330
+ } & RichtextContentDefinition) | (BuiltContent<B> & {
10331
+ name: Name;
10332
+ label: Label;
10333
+ placement: "aside";
10334
+ } & DocumentsContentDefinition) | (BuiltContent<B> & {
10335
+ name: Name;
10336
+ label: Label;
10337
+ placement: "aside";
10338
+ } & FormsContentDefinition) | (BuiltContent<B> & {
10339
+ name: Name;
10340
+ label: Label;
10341
+ placement: "aside";
10342
+ } & EmailsContentDefinition) | (BuiltContent<B> & {
10343
+ name: Name;
10344
+ label: Label;
10345
+ placement: "aside";
10346
+ } & MeetingsContentDefinition) | (BuiltContent<B> & {
10347
+ name: Name;
10348
+ label: Label;
10349
+ placement: "aside";
10350
+ } & PageContentDefinition)]>;
10351
+ build(this: ViewBuilder<N, O & string, C, T>): ViewDeclaration<N, O & string, C, T>;
10352
+ }
10353
+ export declare function detailView<const N extends string>(name: N, label: string): ViewBuilder<N, undefined, "record", []>;
10354
+ export declare function listView<const N extends string>(name: N, label: string): ViewBuilder<N, undefined, "collection", []>;
10355
+ //#endregion
10356
+ //#region src/builders/bundle-builder.d.ts
10357
+ type AnyViewBuilder = ViewBuilder<string, string, ObjectViewContext, ViewContentDefinition[]>;
10358
+ type AnyPageBuilder = PageBuilder<string, string | undefined, boolean>;
10359
+ /** Anything `.add()` accepts; the bundle sorts it by what it builds to. */
10360
+ export type BundlePiece = ObjectBuilderLike | ViewDeclaration | AnyViewBuilder | PageDeclaration | AnyPageBuilder | AgentBuilder;
10361
+ /** The object builders among a tuple of pieces, in order: what the typed client infers from. */
10362
+ export type ObjectsIn<P extends readonly unknown[]> = P extends readonly [infer Head, ...infer Tail] ? Head extends ObjectBuilderLike ? [Head, ...ObjectsIn<Tail>] : ObjectsIn<Tail> : [];
10363
+ /** What `builtBundleFromPieces` assembles: the pieces already built. */
10364
+ export interface BundlePiecesInput {
10365
+ name: string;
10366
+ label: string;
10367
+ description?: string | null;
10368
+ objects: ObjectDefinition[];
10369
+ views: ContentViewDefinition[];
10370
+ pages: PageDeclaration[];
10371
+ agents: AgentBlueprint[];
10372
+ uses?: string[];
10373
+ samples?: DraftableSampleRecord[];
10374
+ translations?: Partial<Record<BundleLocale, BundleTranslationTable>>;
10375
+ }
10376
+ /**
10377
+ * sha256 hex over the canonical JSON of the pieces, each list sorted by identity,
10378
+ * with Web Crypto (Node >= 20, Edge, browsers). Client and server share it, so
10379
+ * the digest a sync sends is the one the server recomputes.
9762
10380
  */
9763
- export declare function document<TName extends string>(name: TName, label: string): DocumentAttributeBuilder<TName, false>;
10381
+ export declare function hashBundlePieces(pieces: {
10382
+ objects: ObjectDefinition[];
10383
+ views: ContentViewDefinition[];
10384
+ pages: PageDeclaration[];
10385
+ agents: AgentBlueprint[];
10386
+ }): Promise<string>;
10387
+ /**
10388
+ * The one assembly every built bundle goes through: validates the name,
10389
+ * normalizes the views, refuses duplicate pieces and native names, then
10390
+ * hashes. `core`, the framework's own bundle, is the only one that may carry
10391
+ * native objects.
10392
+ */
10393
+ export declare function builtBundleFromPieces(input: BundlePiecesInput): Promise<BuiltBundle>;
10394
+ type AnyBundleBuilder = BundleBuilder<string, readonly ObjectBuilderLike[]>;
10395
+ /**
10396
+ * The brand every bundle carries. A global symbol, so a bundle is recognized
10397
+ * across copies of this package (a global CLI, nested versions, duplicates),
10398
+ * where `instanceof` would silently fail.
10399
+ */
10400
+ declare const BUNDLE_BRAND: unique symbol;
10401
+ /** Whether a value is a bundle declared with `bundle()`, whichever copy of this package built it. */
10402
+ export declare function isBundle(value: unknown): value is AnyBundleBuilder;
10403
+ /**
10404
+ * A bundle: objects, views, pages and agents declared as one value. Nothing
10405
+ * registers globally; `build()` returns the plain artifact a sync sends.
10406
+ */
10407
+ export declare class BundleBuilder<N extends string, TObjects extends readonly ObjectBuilderLike[]> {
10408
+ readonly [BUNDLE_BRAND] = true;
10409
+ readonly name: N;
10410
+ /** The object builders, kept for type inference of the typed client (`db.<camelCaseName>`). */
10411
+ readonly objectBuilders: TObjects;
10412
+ private readonly label;
10413
+ private readonly pieces;
10414
+ private readonly used;
10415
+ private descriptionText;
10416
+ private sampleRecords;
10417
+ private readonly translationTables;
10418
+ private built;
10419
+ constructor(name: N, label: string);
10420
+ description(value: string): this;
10421
+ add<const P extends readonly BundlePiece[]>(...pieces: P): BundleBuilder<N, [...TObjects, ...ObjectsIn<P>]>;
10422
+ uses(...bundles: AnyBundleBuilder[]): this;
10423
+ samples(records: DraftableSampleRecord[]): this;
10424
+ translations(locale: BundleLocale, table: BundleTranslationTable): this;
10425
+ /** Builds, validates and hashes once; the result is shared until the bundle changes. */
10426
+ build(): Promise<BuiltBundle>;
10427
+ private changed;
10428
+ private assemble;
10429
+ /** One owner per piece: refuses an object a used bundle, at any depth, declares too. */
10430
+ private assertNotInUsed;
10431
+ }
10432
+ /** Declares a bundle: its identity as two positional arguments, the rest chained. */
10433
+ export declare function bundle<const N extends string>(name: N, label: string): BundleBuilder<N, []>;
9764
10434
  //#endregion
9765
10435
  //#region src/builders/attribute-validators.d.ts
9766
10436
  export declare const OBJECT_NAME_SCHEMA: z$2.ZodString;
@@ -10251,164 +10921,28 @@ export declare class ObjectBuilder<TRecord extends Record<string, unknown> = {},
10251
10921
  /**
10252
10922
  * Create a new object builder with type inference
10253
10923
  *
10254
- * @example
10255
- * ```typescript
10256
- * import { object, text, number } from "@standards/schema";
10257
- * import type { ExtractRecord } from "@standards/schema";
10258
- *
10259
- * // Define object with fluent API (system:true by default — immutable at runtime)
10260
- * const PRODUCT = object("products", "Product")
10261
- * .attribute(text("name", "Name").required())
10262
- * .attribute(number("price", "Price"));
10263
- *
10264
- * // Extract the inferred record type
10265
- * type ProductRecord = ExtractRecord<typeof PRODUCT>;
10266
- * // → { name: string; price?: number }
10267
- *
10268
- * // Full autocompletion when creating records! ✨
10269
- * const product: ProductRecord = {
10270
- * name: "Nike Air Max", // required
10271
- * price: 129.99 // optional
10272
- * };
10273
- * ```
10274
- */
10275
- export declare function object<const N extends string>(name: N & (N extends NativeObjectName ? never : unknown), label: string): ObjectBuilder<{}, N>;
10276
- //#endregion
10277
- //#region src/builders/placeable-content.d.ts
10278
- /** What a placed `custom` content keeps of its block: enough to validate its placement. */
10279
- export type PlacedBlock = Pick<BlockDefinition, "name" | "contexts" | "parameters" | "refine">;
10280
- /** What a view tab or a page cell places: a literal configuration, or a builder of one. */
10281
- export type PlaceableContent = ContentConfiguration | {
10282
- build(): ContentConfiguration;
10283
- readonly extension?: PlacedBlock;
10284
- };
10285
- /** A page cell given an explicit width, in grid columns (`.span(n)`). */
10286
- export interface SpannedContent {
10287
- readonly content: PlaceableContent;
10288
- readonly span: BlockWidth;
10289
- }
10290
- type BuiltContent<B> = B extends {
10291
- build(): infer C;
10292
- } ? C : B;
10293
- //#endregion
10294
- //#region src/builders/view-builder.d.ts
10295
- export interface ViewDeclaration<N extends string = string, O extends string = string, C extends ObjectViewContext = ObjectViewContext, T extends ViewContentDefinition[] = ViewContentDefinition[]> {
10296
- kind: "view";
10297
- definition: Omit<ObjectViewDefinition, "name" | "object" | "context" | "contents"> & {
10298
- name: N;
10299
- object: O;
10300
- context: C;
10301
- contents: T;
10302
- };
10303
- }
10304
- /** One canonical view model; factories differ only in their explicit record context. */
10305
- export declare class ViewBuilder<N extends string, O extends string | undefined, C extends ObjectViewContext, T extends ViewContentDefinition[] = []> {
10306
- readonly kind = "view";
10307
- private readonly data;
10308
- private readonly extensions;
10309
- constructor(data: {
10310
- name: N;
10311
- label: string;
10312
- object: O;
10313
- context: C;
10314
- contents: T;
10315
- description?: string;
10316
- icon?: IconName;
10317
- default?: boolean;
10318
- }, extensions?: readonly (PlacedBlock | undefined)[]);
10319
- /** The object this view belongs to, by object builder or API name. */
10320
- for<const B extends ObjectBuilderLike>(object: B): ViewBuilder<N, B["_types"]["name"], C, T>;
10321
- for<const Name extends string>(object: Name): ViewBuilder<N, Name, C, T>;
10322
- default(): ViewBuilder<N, O, C, T>;
10323
- description(description: string): ViewBuilder<N, O, C, T>;
10324
- icon(icon: IconName): ViewBuilder<N, O, C, T>;
10325
- private place;
10326
- tab<const Name extends string, const Label extends string, B extends PlaceableContent>(name: Name, label: Label, content: B): ViewBuilder<N, O, C, [...T, (BuiltContent<B> & {
10327
- name: Name;
10328
- label: Label;
10329
- placement: "main";
10330
- } & FormContentDefinition) | (BuiltContent<B> & {
10331
- name: Name;
10332
- label: Label;
10333
- placement: "main";
10334
- } & CollectionContentDefinition) | (BuiltContent<B> & {
10335
- name: Name;
10336
- label: Label;
10337
- placement: "main";
10338
- } & CustomContentDefinition) | (BuiltContent<B> & {
10339
- name: Name;
10340
- label: Label;
10341
- placement: "main";
10342
- } & ActivityContentDefinition) | (BuiltContent<B> & {
10343
- name: Name;
10344
- label: Label;
10345
- placement: "main";
10346
- } & RichtextContentDefinition) | (BuiltContent<B> & {
10347
- name: Name;
10348
- label: Label;
10349
- placement: "main";
10350
- } & DocumentsContentDefinition) | (BuiltContent<B> & {
10351
- name: Name;
10352
- label: Label;
10353
- placement: "main";
10354
- } & FormsContentDefinition) | (BuiltContent<B> & {
10355
- name: Name;
10356
- label: Label;
10357
- placement: "main";
10358
- } & EmailsContentDefinition) | (BuiltContent<B> & {
10359
- name: Name;
10360
- label: Label;
10361
- placement: "main";
10362
- } & MeetingsContentDefinition) | (BuiltContent<B> & {
10363
- name: Name;
10364
- label: Label;
10365
- placement: "main";
10366
- } & PageContentDefinition)]>;
10367
- aside<const Name extends string, const Label extends string, B extends PlaceableContent>(name: Name, label: Label, content: B): ViewBuilder<N, O, C, [...T, (BuiltContent<B> & {
10368
- name: Name;
10369
- label: Label;
10370
- placement: "aside";
10371
- } & FormContentDefinition) | (BuiltContent<B> & {
10372
- name: Name;
10373
- label: Label;
10374
- placement: "aside";
10375
- } & CollectionContentDefinition) | (BuiltContent<B> & {
10376
- name: Name;
10377
- label: Label;
10378
- placement: "aside";
10379
- } & CustomContentDefinition) | (BuiltContent<B> & {
10380
- name: Name;
10381
- label: Label;
10382
- placement: "aside";
10383
- } & ActivityContentDefinition) | (BuiltContent<B> & {
10384
- name: Name;
10385
- label: Label;
10386
- placement: "aside";
10387
- } & RichtextContentDefinition) | (BuiltContent<B> & {
10388
- name: Name;
10389
- label: Label;
10390
- placement: "aside";
10391
- } & DocumentsContentDefinition) | (BuiltContent<B> & {
10392
- name: Name;
10393
- label: Label;
10394
- placement: "aside";
10395
- } & FormsContentDefinition) | (BuiltContent<B> & {
10396
- name: Name;
10397
- label: Label;
10398
- placement: "aside";
10399
- } & EmailsContentDefinition) | (BuiltContent<B> & {
10400
- name: Name;
10401
- label: Label;
10402
- placement: "aside";
10403
- } & MeetingsContentDefinition) | (BuiltContent<B> & {
10404
- name: Name;
10405
- label: Label;
10406
- placement: "aside";
10407
- } & PageContentDefinition)]>;
10408
- build(this: ViewBuilder<N, O & string, C, T>): ViewDeclaration<N, O & string, C, T>;
10409
- }
10410
- export declare function detailView<const N extends string>(name: N, label: string): ViewBuilder<N, undefined, "record", []>;
10411
- export declare function listView<const N extends string>(name: N, label: string): ViewBuilder<N, undefined, "collection", []>;
10924
+ * @example
10925
+ * ```typescript
10926
+ * import { object, text, number } from "@standards/schema";
10927
+ * import type { ExtractRecord } from "@standards/schema";
10928
+ *
10929
+ * // Define object with fluent API (system:true by default — immutable at runtime)
10930
+ * const PRODUCT = object("products", "Product")
10931
+ * .attribute(text("name", "Name").required())
10932
+ * .attribute(number("price", "Price"));
10933
+ *
10934
+ * // Extract the inferred record type
10935
+ * type ProductRecord = ExtractRecord<typeof PRODUCT>;
10936
+ * // → { name: string; price?: number }
10937
+ *
10938
+ * // Full autocompletion when creating records! ✨
10939
+ * const product: ProductRecord = {
10940
+ * name: "Nike Air Max", // required
10941
+ * price: 129.99 // optional
10942
+ * };
10943
+ * ```
10944
+ */
10945
+ export declare function object<const N extends string>(name: N & (N extends NativeObjectName ? never : unknown), label: string): ObjectBuilder<{}, N>;
10412
10946
  //#endregion
10413
10947
  //#region src/blocks/native-blocks.d.ts
10414
10948
  /** The artifact record view's preview tab. */
@@ -11383,91 +11917,6 @@ declare function meetingsUpcoming(): BlockContentBuilder;
11383
11917
  /** The viewer's email threads, newest first; every thread until a verb narrows them. */
11384
11918
  declare function mailbox(): MailboxBuilder;
11385
11919
  //#endregion
11386
- //#region src/builders/page-builder.d.ts
11387
- /** A page as the schema declares it: standalone (`O` undefined) or a record page of `O`. */
11388
- export interface PageDeclaration<N extends string = string, O extends string | undefined = string | undefined> {
11389
- kind: "view";
11390
- definition: Omit<PageViewDefinition, "name" | "object"> & {
11391
- name: N;
11392
- } & (O extends string ? {
11393
- object: O;
11394
- } : {
11395
- object?: undefined;
11396
- });
11397
- }
11398
- /** One row of a page: blocks named by their keys, in order. */
11399
- export type PageRow = Readonly<Record<string, PlaceableContent | SpannedContent>>;
11400
- /** A row's group: its name (`group_<smallest member key>` by default) and its title. */
11401
- export interface PageRowGroup {
11402
- name?: string;
11403
- label?: string;
11404
- }
11405
- /** How a row is placed: `group` puts its blocks in one group (a band or a shared card). */
11406
- export interface PageRowOptions {
11407
- group?: PageRowGroup;
11408
- }
11409
- /**
11410
- * A heading's name (`heading_<slug of its title>` by default) and what it
11411
- * shows under and beside its title.
11412
- */
11413
- export interface PageHeadingMeta {
11414
- name?: string;
11415
- description?: string;
11416
- icon?: IconName;
11417
- }
11418
- type PageSection = {
11419
- kind: "row";
11420
- blocks: PageRow;
11421
- group?: PageRowGroup;
11422
- } | {
11423
- kind: "heading";
11424
- title: string;
11425
- meta: PageHeadingMeta;
11426
- };
11427
- interface PageData<N extends string, O extends string | undefined> {
11428
- name: N;
11429
- label: string;
11430
- object: O;
11431
- icon?: IconName;
11432
- description?: string;
11433
- home?: boolean;
11434
- sections: readonly PageSection[];
11435
- }
11436
- /**
11437
- * A page: rows of named blocks on a 12-column grid. The builder computes every
11438
- * position; blocks are named by their keys, as AI SDK tools are.
11439
- *
11440
- * `H` records whether `.home()` was called, so `.home()` and `.for()` exclude
11441
- * each other by type; `build()` refuses the pair for untyped callers too.
11442
- */
11443
- export declare class PageBuilder<N extends string, O extends string | undefined = undefined, H extends boolean = false> {
11444
- readonly kind = "view";
11445
- readonly _home?: H;
11446
- private readonly data;
11447
- constructor(data: PageData<N, O>);
11448
- icon(icon: IconName): PageBuilder<N, O, H>;
11449
- description(description: string): PageBuilder<N, O, H>;
11450
- /** The workspace's home. Only a standalone page can be. */
11451
- home(this: PageBuilder<N, undefined, boolean>): PageBuilder<N, undefined, true>;
11452
- /** Makes this a record page of `object`, rendered for one of its records. */
11453
- for<const B extends ObjectBuilderLike>(this: PageBuilder<N, undefined, false>, object: B): PageBuilder<N, B["_types"]["name"], false>;
11454
- for<const S extends string>(this: PageBuilder<N, undefined, false>, object: S): PageBuilder<N, S, false>;
11455
- /**
11456
- * A row of blocks: the columns a `.span(n)` leaves free are shared in width
11457
- * steps. `{ group: { name?, label? } }` puts the row's blocks in one group,
11458
- * named `group_<smallest member key>` unless told.
11459
- */
11460
- row(blocks: PageRow, options?: PageRowOptions): PageBuilder<N, O, H>;
11461
- /**
11462
- * A heading on its own row, named `meta.name`, else `heading_<slug of its
11463
- * title>` (`_2`, `_3`… for a title already used, in order).
11464
- */
11465
- heading(title: string, meta?: PageHeadingMeta): PageBuilder<N, O, H>;
11466
- build(): PageDeclaration<N, O>;
11467
- }
11468
- /** A page of the workspace: standalone until `.for(object)` makes it a record page. */
11469
- declare function page$1<const N extends string>(name: N, label: string): PageBuilder<N>;
11470
- //#endregion
11471
11920
  //#region src/builders/content-builder.d.ts
11472
11921
  type SetFields<T extends {
11473
11922
  type: string;
@@ -11726,178 +12175,29 @@ export declare const content: {
11726
12175
  /**
11727
12176
  * Standard Schema vendor identifier
11728
12177
  */
11729
- export declare const STANDARD_SCHEMA_VENDOR = "@standards/schema";
11730
- /**
11731
- * Standard Schema issue type
11732
- */
11733
- export type StandardSchemaIssue = StandardSchemaV1$1.Issue;
11734
- /**
11735
- * Standard Schema result type
11736
- */
11737
- export type StandardSchemaResult<T> = StandardSchemaV1$1.Result<T>;
11738
- /**
11739
- * Create Standard Schema ~standard props from a Zod schema.
11740
- *
11741
- * Since Zod v4 already implements Standard Schema natively, we delegate
11742
- * validation to Zod and wrap the result with our vendor identifier.
11743
- *
11744
- * @param zodSchema - The Zod schema to wrap
11745
- * @returns Standard Schema v1 props
11746
- */
11747
- export declare function createStandardSchemaProps<T>(zodSchema: z.ZodType<T>): StandardSchemaV1$1.Props<unknown, T>;
11748
- /**
11749
- * Type guard to check if an object implements Standard Schema v1
11750
- */
11751
- export declare function isStandardSchema<T>(obj: unknown): obj is StandardSchemaV1$1<unknown, T>;
11752
- //#endregion
11753
- //#region src/views/page-layout.d.ts
11754
- /** A cell on the page grid; field names match react-grid-layout's `LayoutItem`. */
11755
- export type LayoutCell = GridPosition & {
11756
- i: string;
11757
- static?: boolean;
11758
- };
11759
- /** One change read-time repair made to a stored grid. */
11760
- export interface GridRepair {
11761
- name: string;
11762
- kind: "width" | "height" | "pushed" | "fill" | "dropped";
11763
- from?: GridPosition;
11764
- to?: GridPosition;
11765
- }
11766
- type TraitsOf = (i: string) => LayoutTraits;
11767
- /**
11768
- * The nearest allowed width in `[minWidth, 12 - x]`; a tie rounds up. When no
11769
- * step fits after `x`, the narrowest step at least `minWidth` (the caller then
11770
- * moves the cell left).
11771
- */
11772
- export declare function snapWidth(w: number, x: number, minWidth: BlockWidth): BlockWidth;
11773
- /**
11774
- * Packs by gravity in `(y, x)` order: each movable cell rises until it meets
11775
- * another cell, then is pushed below anything it overlaps. `static` cells never
11776
- * move. `heights` gives a cell's effective height (measured for `fit`), which
11777
- * the returned cell carries.
11778
- */
11779
- export declare function packLayout<T extends LayoutCell>(cells: readonly T[], heights?: ReadonlyMap<string, number>): T[];
11780
- /**
11781
- * A layout write laid over the page: the `sent` cells take their place, a cell
11782
- * left out that one of them overlaps moves down below it (never sideways, as
11783
- * react-grid-layout pushes while dragging), then the page is packed. `static`
11784
- * cells never move: a sent cell that lands on one moves below it instead.
11785
- */
11786
- export declare function settleLayout<T extends LayoutCell>(cells: readonly T[], sent: ReadonlySet<string>): T[];
11787
- /** react-grid-layout's `Compactor`, structurally: vertical gravity via `packLayout`. */
11788
- export declare function pageCompactor(): {
11789
- type: "vertical";
11790
- allowOverlap: false;
11791
- preventCollision: false;
11792
- compact<T extends LayoutCell>(layout: readonly T[], cols: number): T[];
11793
- };
11794
- /**
11795
- * react-grid-layout's `LayoutConstraint`, structurally: a resize lands on a
11796
- * width step and a `flexible` height within its bounds; a `fit` height is
11797
- * the content's, so it never changes by hand.
11798
- */
11799
- export declare function widthStepConstraint(traitsOf: TraitsOf): {
11800
- name: "width-steps";
11801
- constrainSize(item: LayoutCell, w: number, h: number): {
11802
- w: number;
11803
- h: number;
11804
- };
11805
- };
11806
- /**
11807
- * Read-time repair of a stored grid; never throws. `flexible` heights come
11808
- * within their bounds, widths snap to steps (and widen to `minWidth`) within
11809
- * the grid, overlaps are resolved by push, the grid is packed, and only the
11810
- * first movable `fill` block in reading order keeps `fill` (the others are
11811
- * reported and render `flexible`). `static` cells are kept.
11812
- */
11813
- export declare function repairPageGrid(cells: readonly LayoutCell[], traitsOf: TraitsOf): {
11814
- cells: LayoutCell[];
11815
- repairs: GridRepair[];
11816
- };
11817
- /**
11818
- * The one block of a page that keeps `fill`: the first movable `fill` block in
11819
- * reading order. A static (a block hidden from the viewer, whose traits the
11820
- * read view never sees) never keeps it, so the server and the read view
11821
- * choose alike. Any other `fill` block renders `flexible` at its stored height.
11822
- */
11823
- export declare function keptFill(cells: readonly LayoutCell[], traitsOf: TraitsOf): string | undefined;
11824
- /**
11825
- * The 6-column layout: cells in reading order at half width (never below
11826
- * their `minWidth`, never above 6), laid left to right, then packed.
11827
- */
11828
- export declare function deriveLayout6(cells: readonly LayoutCell[], traitsOf: TraitsOf): LayoutCell[];
11829
- /**
11830
- * Where an added block goes: a figure next to the existing top-level figures,
11831
- * else at the top (the caller pushes the rest down); anything else at the end,
11832
- * full left, with its default size.
11833
- */
11834
- export declare function placeNew(cells: readonly LayoutCell[], name: string, traits: LayoutTraits, figures: ReadonlySet<string>): LayoutCell;
11835
- //#endregion
11836
- //#region src/views/content-state.d.ts
11837
- type WithoutName<T> = T extends unknown ? Omit<T, "name"> : never;
11838
- export type StoredContentDefinition = WithoutName<ViewContentDefinition>;
11839
- export interface DraftContentState {
11840
- sourceDefinition: StoredContentDefinition | null;
11841
- workspaceDefinition: StoredContentDefinition | null;
11842
- suppressed: boolean;
11843
- sourcePosition: number | null;
11844
- workspacePosition: number | null;
11845
- /** A page block's cell as code declares it; `null` off a page or for a workspace block. */
11846
- sourceGrid: GridPosition | null;
11847
- /** A page block's cell once the page's grid is customized; `null` otherwise. */
11848
- workspaceGrid: GridPosition | null;
11849
- }
11850
- export interface DraftViewAuthoring {
11851
- origin: "code" | "runtime";
11852
- mainOrderCustomized: boolean;
11853
- asideOrderCustomized: boolean;
11854
- /** Set once the page's grid is moved: every block then sits at its `workspaceGrid`. */
11855
- gridCustomized: boolean;
11856
- /** Set once the architect chose the tenant Home: wins over code's `.home()` at sync. */
11857
- homeCustomized: boolean;
11858
- contents: Record<string, DraftContentState>;
11859
- }
11860
- export declare function contentDefinition(name: string, state: Pick<DraftContentState, "sourceDefinition" | "workspaceDefinition" | "suppressed">): ViewContentDefinition | null;
11861
- export declare function storedContentDefinition<T extends ViewContentDefinition>(content: T): WithoutName<T>;
11862
- /** The authoring of a view that exists only in the workspace; `grid` places a page's blocks. */
11863
- export declare function workspaceViewAuthoring(contents: readonly ViewContentDefinition[], grid?: Readonly<Record<string, GridPosition>>): DraftViewAuthoring;
11864
- export interface ResolvedPageGrid {
11865
- grid: Record<string, GridPosition>;
11866
- /**
11867
- * What read-time repair changed, for the runtime to log once per revision.
11868
- * Consumers apply two kinds the grid cannot carry: a `fill` repair renders
11869
- * that block `flexible` at its stored height, and a `dropped` content is
11870
- * left out of the page altogether (it has no cell in `grid`).
11871
- */
11872
- repairs: GridRepair[];
11873
- }
11874
- export interface ResolvePageGridOptions {
11875
- /** Blocks that never move (hidden from the viewer): repair and packing keep their cells. */
11876
- statics?: ReadonlySet<string>;
11877
- /** A content's layout traits; defaults to `layoutTraitsOf` over the global block registry. */
11878
- traitsOf?: (name: string) => LayoutTraits;
11879
- }
12178
+ export declare const STANDARD_SCHEMA_VENDOR = "@standards/schema";
11880
12179
  /**
11881
- * A page's effective grid, the twin of {@link resolveViewContents}'s ordering.
11882
- * Once the grid is customized every block sits at its `workspaceGrid`. Before,
11883
- * code blocks sit at their `sourceGrid`, and a workspace block at its own
11884
- * `workspaceGrid` where that cell is still free. A block left without a cell
11885
- * (a code block added after customization, a workspace block whose cell code
11886
- * now covers) is stacked below the last row, by name. Grouped members have no
11887
- * cell: their group holds it, and a group whose members are all gone has
11888
- * none. The result is then repaired (`repairPageGrid`:
11889
- * width steps, push, packing, extra fills) with `statics` kept in place, and
11890
- * contents beyond the page limit are left out; never throws.
12180
+ * Standard Schema issue type
11891
12181
  */
11892
- export declare function resolvePageGrid(authoring: Pick<DraftViewAuthoring, "contents" | "gridCustomized">, options?: ResolvePageGridOptions): ResolvedPageGrid;
11893
- /** The contents read-time repair left out of a page (beyond its limit). */
11894
- export declare function droppedContents(repairs: readonly GridRepair[]): Set<string>;
11895
- /** What ordering reads of a content: its definitions and its positions, not its grid cell. */
11896
- type OrderedContentState = Omit<DraftContentState, "sourceGrid" | "workspaceGrid">;
11897
- /** One ordering resolver shared by persisted rows and the authoring fold. */
11898
- export declare function resolveViewContents(authoring: Pick<DraftViewAuthoring, "mainOrderCustomized" | "asideOrderCustomized"> & {
11899
- contents: Readonly<Record<string, OrderedContentState>>;
11900
- }): ViewContentDefinition[];
12182
+ export type StandardSchemaIssue = StandardSchemaV1$1.Issue;
12183
+ /**
12184
+ * Standard Schema result type
12185
+ */
12186
+ export type StandardSchemaResult<T> = StandardSchemaV1$1.Result<T>;
12187
+ /**
12188
+ * Create Standard Schema ~standard props from a Zod schema.
12189
+ *
12190
+ * Since Zod v4 already implements Standard Schema natively, we delegate
12191
+ * validation to Zod and wrap the result with our vendor identifier.
12192
+ *
12193
+ * @param zodSchema - The Zod schema to wrap
12194
+ * @returns Standard Schema v1 props
12195
+ */
12196
+ export declare function createStandardSchemaProps<T>(zodSchema: z.ZodType<T>): StandardSchemaV1$1.Props<unknown, T>;
12197
+ /**
12198
+ * Type guard to check if an object implements Standard Schema v1
12199
+ */
12200
+ export declare function isStandardSchema<T>(obj: unknown): obj is StandardSchemaV1$1<unknown, T>;
11901
12201
  //#endregion
11902
12202
  //#region src/views/content-policy.d.ts
11903
12203
  export declare function requireRecordContentContext(name: string, context: ContentViewContext, path: string[]): void;
@@ -12344,80 +12644,20 @@ export declare function validateObjectImage(definition: {
12344
12644
  })[];
12345
12645
  }): void;
12346
12646
  //#endregion
12347
- //#region src/utils/schema-source-id.d.ts
12348
- /**
12349
- * A schema source id is a lowercase slug: it becomes part of an ownership token
12350
- * (`source:<id>`), so the server and `@standards/client` must agree on the shape
12351
- * character for character. One pattern, one message, defined here.
12352
- */
12353
- export declare const SCHEMA_SOURCE_ID_PATTERN: RegExp;
12354
- export declare function assertSchemaSourceId(sourceId: string): void;
12647
+ //#region src/utils/sha256.d.ts
12648
+ /** sha256 hex of a string's UTF-8 bytes, with Web Crypto (Node >= 20, Edge, browsers). */
12649
+ export declare function sha256Hex(text: string): Promise<string>;
12355
12650
  //#endregion
12356
- //#region src/utils/schema-source-resolution.d.ts
12357
- /**
12358
- * A change to a system attribute that the code alone cannot state, resolved by
12359
- * the push that carries it (#4362): the rename that keeps its values, or one of
12360
- * the two retypes a push knows how to convert. It travels with the source's
12361
- * `PUT`, outside the source hash, and is shared by the runtime and
12362
- * `@standards/client` so both read one shape.
12363
- */
12364
- export type SchemaSourceResolution = SchemaSourceRename | SchemaSourceRetype;
12365
- /** Keep the stored attribute `from`, and its record values, under the name `to`. */
12366
- export interface SchemaSourceRename {
12367
- kind: "rename";
12368
- object: string;
12369
- from: string;
12370
- to: string;
12371
- }
12372
- /** Convert a stored `text` attribute and its values to `phone`. */
12373
- export interface SchemaSourcePhoneRetype {
12374
- kind: "retype";
12375
- object: string;
12376
- attribute: string;
12377
- to: "phone";
12378
- /** The country a number written without its calling code belongs to. */
12379
- defaultCountryCode: CountryIso3;
12380
- }
12381
- /** Convert a stored `number` attribute and its values to `currency`. */
12382
- export interface SchemaSourceCurrencyRetype {
12383
- kind: "retype";
12384
- object: string;
12385
- attribute: string;
12386
- to: "currency";
12387
- /** The currency every converted amount is stored in. */
12388
- currencyCode: CurrencyCode;
12389
- }
12390
- export type SchemaSourceRetype = SchemaSourcePhoneRetype | SchemaSourceCurrencyRetype;
12391
- /** The stored type each retype a push supports converts from. */
12392
- export declare const SCHEMA_SOURCE_RETYPE_FROM: {
12393
- readonly phone: "text";
12394
- readonly currency: "number";
12395
- };
12396
- /**
12397
- * The shape gate of a push's `resolutions`, run before anything reads the
12398
- * store: an array of at most {@link SCHEMA_SOURCE_MAX_RESOLUTIONS} entries,
12399
- * each exactly one of the three shapes, no two of the same kind on one
12400
- * attribute. Whether each one applies is the push's to decide, against the
12401
- * stored schema.
12402
- *
12403
- * @throws ValidationError naming `resolutions.<index>.<field>`
12404
- */
12405
- export declare function assertSchemaSourceResolutions(value: unknown): asserts value is SchemaSourceResolution[];
12406
- /** A stored value converted by a retype, or `undefined` when it cannot be. */
12407
- type ConvertedValue = {
12408
- value: Phone | Currency | null;
12409
- } | undefined;
12651
+ //#region src/utils/bundle-name.d.ts
12410
12652
  /**
12411
- * One stored value as the retyped attribute stores it (#4362): `null` stays
12412
- * `null`; a text parses as a phone number (the resolution's country when it
12413
- * carries none of its own); a finite number becomes an amount in the
12414
- * resolution's currency — a negative one only when the declared attribute
12415
- * allows it. Anything else — a text that is not a possible number, carries an
12416
- * extension or no country, a value of another JSON type — is not converted.
12653
+ * A bundle name is a lowercase slug: it becomes part of an ownership token, so
12654
+ * the server and `@standards/client` must agree on the shape character for
12655
+ * character. One pattern, one message, defined here.
12417
12656
  */
12418
- export declare function convertRetypedValue(resolution: SchemaSourceRetype, value: unknown, declared?: {
12419
- allowNegative?: boolean;
12420
- }): ConvertedValue;
12657
+ export declare const BUNDLE_NAME_PATTERN: RegExp;
12658
+ /** The framework's own bundle: built by the runtime, never declared by a consumer. */
12659
+ export declare const CORE_BUNDLE_NAME = "core";
12660
+ export declare function assertBundleName(name: string): void;
12421
12661
  //#endregion
12422
12662
  //#region src/utils/calendar-day.d.ts
12423
12663
  /**
@@ -12520,146 +12760,6 @@ export declare function normalizePhoneNumber(phoneNumber: string, countryIso3: C
12520
12760
  */
12521
12761
  export declare function formatPhoneForDisplay(phone: Phone): string;
12522
12762
  //#endregion
12523
- //#region src/architect/operation-types.d.ts
12524
- /**
12525
- * Where an operation is visible. Drives live navigation: the client turns a
12526
- * focus into a route and, when following, goes there before rendering the
12527
- * overlay.
12528
- */
12529
- export interface DraftFocus {
12530
- objectName?: string;
12531
- viewName?: string;
12532
- /** A page is addressed by id: pages are never addressed by name. */
12533
- pageId?: string;
12534
- /**
12535
- * The page's label when the operation itself carries one (`create_page`, a
12536
- * labelled `duplicate_page`), for a step shown before the fold names it.
12537
- * Display only: never an address.
12538
- */
12539
- pageName?: string;
12540
- contentName?: string;
12541
- objectId?: string;
12542
- /** Attribute identity within objectId, used for exact compare snapshots. */
12543
- attributeId?: string;
12544
- /** Attribute identity by NAME within objectId — for operations that address an existing attribute. */
12545
- attributeName?: string;
12546
- recordId?: string;
12547
- }
12548
- export type ArchitectImpact = "atomic" | "local" | "structural";
12549
- export type ArchitectNavigation = "none" | "if-not-visible" | "follow";
12550
- export interface ArchitectPresentation {
12551
- impact: ArchitectImpact;
12552
- navigation: ArchitectNavigation;
12553
- focus: DraftFocus & {
12554
- propertyPath?: readonly string[];
12555
- };
12556
- }
12557
- export interface ArchitectChange {
12558
- operationId: string;
12559
- operationType: string;
12560
- presentation: ArchitectPresentation;
12561
- before: unknown;
12562
- after: unknown;
12563
- /** The agent's note on this operation, when it wrote one (D9). */
12564
- note?: string;
12565
- /** Set when the operation was produced by a catalog install. */
12566
- origin?: OperationOrigin;
12567
- }
12568
- /** One operation of a draft as stored and sent: its shared fields plus its type's payload. */
12569
- export type ViewOperation = BaseOperation & Record<string, unknown>;
12570
- /** What the fold adds to every view: identity, revisions and the authoring baseline. */
12571
- interface DraftableViewState {
12572
- authoring: DraftViewAuthoring;
12573
- id: string;
12574
- revision: number;
12575
- contentRevisions: Record<string, number>;
12576
- contentIds: Record<string, string>;
12577
- /**
12578
- * Set on the two views `add_object` folds. While present, the view is a pure
12579
- * function of the object's attributes and `add_attribute` regenerates it.
12580
- * The first explicit view operation removes the key. Never persisted:
12581
- * `fromDraftableView` ignores it, so the client and server folds agree.
12582
- */
12583
- derived?: true;
12584
- }
12585
- /**
12586
- * A record or collection view as the fold sees it. The object is referenced by
12587
- * NAME: `ViewDefinition` references its object by name throughout this
12588
- * codebase; carrying an id here would force every reader to invent a mapping
12589
- * that does not exist in the data.
12590
- */
12591
- export type DraftableObjectView = ObjectViewDefinition & DraftableViewState;
12592
- /** A page as the fold sees it, with the access facts its operations check. */
12593
- export type DraftablePageView = PageViewDefinition & DraftableViewState & {
12594
- visibility: "workspace" | "private";
12595
- /** The actor owning a private page; `null` for a shared one. */
12596
- ownedBy: string | null;
12597
- };
12598
- /** A view as the fold sees it — published shape, no persistence concerns. */
12599
- export type DraftableView = DraftableObjectView | DraftablePageView;
12600
- /**
12601
- * An object as the fold sees it.
12602
- *
12603
- * The four settings are composed from {@link UpdateObjectInput} rather than
12604
- * retyped: that interface is the canonical list the service writes, so a field
12605
- * that gains a type there cannot drift here. `metadata` stays out — an open bag
12606
- * has no place in a contract two folds must agree on — and `label` and `icon`
12607
- * are declared locally: `label` is required on a draftable object, and `icon`
12608
- * stays a plain `string` rather than `IconName`, deliberately local so the
12609
- * draft contract never depends on the icon catalogue.
12610
- */
12611
- export interface DraftableObject extends Omit<UpdateObjectInput, "metadata" | "label" | "icon"> {
12612
- id: string;
12613
- name: string;
12614
- label: string;
12615
- icon?: string;
12616
- }
12617
- export interface DraftableAttribute {
12618
- id: string;
12619
- objectId: string;
12620
- name: string;
12621
- label: string;
12622
- attributeType: string;
12623
- /** Type-specific configuration (relation targets, select options, ...). */
12624
- config?: Record<string, unknown>;
12625
- }
12626
- /** Whether a new sample is display-only or explicitly requested real data. */
12627
- export type SamplePublication = "preview" | "requested-data";
12628
- export interface DraftableSampleRecord {
12629
- id: string;
12630
- objectId: string;
12631
- values: Record<string, unknown>;
12632
- /** Absent on historical drafts; publication requires an explicit legacy choice. */
12633
- publication?: SamplePublication;
12634
- }
12635
- /**
12636
- * Everything an operation may read or write.
12637
- *
12638
- * The client folds a draft over this shape to render the overlay; the server
12639
- * folds the same draft over the same shape at publish time. One fold, so a
12640
- * preview is the result rather than a prediction of it.
12641
- */
12642
- export interface DraftableState {
12643
- objects: DraftableObject[];
12644
- attributes: DraftableAttribute[];
12645
- views: DraftableView[];
12646
- sampleRecords: DraftableSampleRecord[];
12647
- }
12648
- /** Context passed to `describe` so summaries can be localised. */
12649
- export interface LabelContext {
12650
- locale: "fr" | "en";
12651
- }
12652
- /** The shape every operation payload shares. */
12653
- export interface BaseOperation {
12654
- /** This operation's own id, used to remove it from a draft. */
12655
- id: string;
12656
- type: string;
12657
- /** The architect's own sentence — what it does and why; ≤ 160 chars. Persisted with the operation. */
12658
- note?: string;
12659
- /** Set on every operation a catalog install produced; the publish records it in `catalog_installs`. */
12660
- origin?: OperationOrigin;
12661
- }
12662
- //#endregion
12663
12763
  //#region src/architect/proposal-types.d.ts
12664
12764
  export interface ProposalRevision {
12665
12765
  draftId: string;
@@ -12826,6 +12926,34 @@ export interface DraftAppendReceipt extends MutationReceipt {
12826
12926
  export interface DraftPublishCommand {
12827
12927
  revision: ProposalRevision;
12828
12928
  legacyExamples: "keep" | "omit" | null;
12929
+ /**
12930
+ * Publish over what was published meanwhile (#5936): each conflicting
12931
+ * target's key, with the `seen` of the change the person was shown. A
12932
+ * target changed again since then still conflicts.
12933
+ */
12934
+ accept?: Readonly<Record<string, string>>;
12935
+ }
12936
+ /** What a target a publish found published meanwhile can be (`DraftConflictChange.kind`). */
12937
+ export declare const DRAFT_CONFLICT_KINDS: readonly ["object", "attribute", "view", "content", "sample"];
12938
+ /**
12939
+ * One target a publish found changed since the draft captured it: the
12940
+ * `details.changes` of a `DRAFT_REVISION_CONFLICT` refusal (#5936).
12941
+ */
12942
+ export interface DraftConflictChange {
12943
+ /** The baseline key the draft captured it under. */
12944
+ key: string;
12945
+ kind: (typeof DRAFT_CONFLICT_KINDS)[number];
12946
+ /** What the person knows it by: its label as the draft captured it, else its name. */
12947
+ label: string;
12948
+ /** Set when its label is what changed. */
12949
+ relabelled?: {
12950
+ from: string;
12951
+ to: string;
12952
+ };
12953
+ /** Set when it no longer exists. */
12954
+ removed?: true;
12955
+ /** What `DraftPublishCommand.accept` echoes to publish over exactly this change. */
12956
+ seen: string;
12829
12957
  }
12830
12958
  export interface ProposalTarget {
12831
12959
  key: string;
@@ -14004,8 +14132,8 @@ export declare const todoItemSchema: z$2.ZodObject<{
14004
14132
  phase: z$2.ZodEnum<{
14005
14133
  fields: "fields";
14006
14134
  relations: "relations";
14007
- views: "views";
14008
14135
  objects: "objects";
14136
+ views: "views";
14009
14137
  samples: "samples";
14010
14138
  }>;
14011
14139
  }, z$2.core.$strict>>;
@@ -14033,8 +14161,8 @@ export declare const todoPlanSchema: z$2.ZodObject<{
14033
14161
  phase: z$2.ZodEnum<{
14034
14162
  fields: "fields";
14035
14163
  relations: "relations";
14036
- views: "views";
14037
14164
  objects: "objects";
14165
+ views: "views";
14038
14166
  samples: "samples";
14039
14167
  }>;
14040
14168
  }, z$2.core.$strict>>;
@@ -17142,4 +17270,4 @@ export type RecordOperationResult = {
17142
17270
  inverse: RecordOperation | null;
17143
17271
  };
17144
17272
  //#endregion
17145
- export { PageData$1 as PageData, type StandardSchemaV1$1 as StandardSchemaV1, form$1 as form, page$1 as page, richtext$1 as richtext, text$1 as text };
17273
+ export { type StandardSchemaV1$1 as StandardSchemaV1, form$1 as form, page$1 as page, richtext$1 as richtext, text$1 as text };