@standards/schema 1.0.0-alpha.433 → 1.0.0-alpha.435

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.
@@ -1482,509 +1482,867 @@ export interface PresetNode {
1482
1482
  }
1483
1483
  /** Max depth allowed for preset.structure to keep instantiation predictable. */
1484
1484
  export declare const MAX_PRESET_DEPTH = 5;
1485
- /** What the reading actor may do with a resource (spec §6.6); records never produce `runner`. */
1486
- export declare const viewerAccessSchema: z$2.ZodEnum<{
1487
- editor: "editor";
1488
- owner: "owner";
1489
- reader: "reader";
1490
- runner: "runner";
1491
- workspace: "workspace";
1492
- }>;
1493
- type Values = readonly [string, ...string[]];
1494
- /** One beneficiary of a private resource: its effective role and every source that grants it. */
1495
- export declare function accessGrantSchema<const Role extends Values, const Source extends Values>(roles: Role, sources: Source): z$2.ZodObject<{
1496
- actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1497
- role: z$2.ZodEnum<{ [k in Role[number]]: k; } extends (infer T) ? { [k in keyof T]: T[k]; } : never>;
1498
- sources: z$2.ZodArray<z$2.ZodEnum<{ [k in Source[number]]: k; } extends (infer T_1) ? { [k in keyof T_1]: T_1[k]; } : never>>;
1499
- }, z$2.core.$strip>;
1500
- /** Who can reach a record beyond its owner (`GET /records/:object/:id/access`). */
1501
- export declare const recordAudienceSchema: z$2.ZodObject<{
1502
- recordId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1503
- visibility: z$2.ZodEnum<{
1504
- private: "private";
1505
- workspace: "workspace";
1506
- }>;
1507
- ownedBy: z$2.ZodNullable<z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>>;
1508
- viewerAccess: z$2.ZodEnum<{
1509
- editor: "editor";
1510
- owner: "owner";
1511
- reader: "reader";
1512
- runner: "runner";
1513
- workspace: "workspace";
1485
+ export declare const DOCUMENT_KINDS: readonly ["file", "folder"];
1486
+ export type DocumentKind = (typeof DOCUMENT_KINDS)[number];
1487
+ export declare const documentSchema: z$2.ZodObject<{
1488
+ id: z$2.ZodString;
1489
+ tenantId: z$2.ZodString;
1490
+ title: z$2.ZodString;
1491
+ kind: z$2.ZodEnum<{
1492
+ file: "file";
1493
+ folder: "folder";
1514
1494
  }>;
1515
- grants: z$2.ZodArray<z$2.ZodObject<{
1516
- actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1517
- role: z$2.ZodEnum<{
1518
- editor: "editor";
1519
- reader: "reader";
1520
- }>;
1521
- sources: z$2.ZodArray<z$2.ZodEnum<{
1522
- manual: "manual";
1523
- meeting_attendee: "meeting_attendee";
1524
- }>>;
1525
- }, z$2.core.$strip>>;
1495
+ parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1496
+ description: z$2.ZodOptional<z$2.ZodString>;
1497
+ contentHash: z$2.ZodOptional<z$2.ZodString>;
1498
+ createdBy: z$2.ZodOptional<z$2.ZodString>;
1499
+ updatedBy: z$2.ZodOptional<z$2.ZodString>;
1500
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1501
+ position: z$2.ZodNumber;
1502
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1503
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1526
1504
  }, z$2.core.$strip>;
1527
- /** Who may run commands on a device beyond its owner (`GET /devices/:id/access`). */
1528
- export declare const deviceAudienceSchema: z$2.ZodObject<{
1529
- deviceId: z$2.ZodString;
1530
- visibility: z$2.ZodEnum<{
1531
- private: "private";
1532
- workspace: "workspace";
1533
- }>;
1534
- ownedBy: z$2.ZodNullable<z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>>;
1535
- viewerAccess: z$2.ZodEnum<{
1536
- editor: "editor";
1537
- owner: "owner";
1538
- reader: "reader";
1539
- runner: "runner";
1540
- workspace: "workspace";
1505
+ export type Document = z$2.output<typeof documentSchema>;
1506
+ export declare const documentWithSubCountSchema: z$2.ZodObject<{
1507
+ id: z$2.ZodString;
1508
+ tenantId: z$2.ZodString;
1509
+ title: z$2.ZodString;
1510
+ kind: z$2.ZodEnum<{
1511
+ file: "file";
1512
+ folder: "folder";
1541
1513
  }>;
1542
- grants: z$2.ZodArray<z$2.ZodObject<{
1543
- actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1544
- role: z$2.ZodEnum<{
1545
- runner: "runner";
1546
- }>;
1547
- sources: z$2.ZodArray<z$2.ZodEnum<{
1548
- manual: "manual";
1549
- }>>;
1550
- }, z$2.core.$strip>>;
1514
+ parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1515
+ description: z$2.ZodOptional<z$2.ZodString>;
1516
+ contentHash: z$2.ZodOptional<z$2.ZodString>;
1517
+ createdBy: z$2.ZodOptional<z$2.ZodString>;
1518
+ updatedBy: z$2.ZodOptional<z$2.ZodString>;
1519
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1520
+ position: z$2.ZodNumber;
1521
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1522
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1523
+ subCount: z$2.ZodNullable<z$2.ZodNumber>;
1551
1524
  }, z$2.core.$strip>;
1552
- /** Who can reach a private page beyond its owner (`GET /pages/:id/access`). */
1553
- export declare const pageAudienceSchema: z$2.ZodObject<{
1554
- pageId: z$2.ZodString;
1555
- visibility: z$2.ZodEnum<{
1556
- private: "private";
1557
- workspace: "workspace";
1558
- }>;
1559
- ownedBy: z$2.ZodNullable<z$2.ZodString>;
1560
- viewerAccess: z$2.ZodEnum<{
1561
- editor: "editor";
1562
- owner: "owner";
1563
- reader: "reader";
1564
- runner: "runner";
1565
- workspace: "workspace";
1525
+ export type DocumentWithSubCount = z$2.output<typeof documentWithSubCountSchema>;
1526
+ /**
1527
+ * One hit of a drive-wide name search: a folder or a file of the record's
1528
+ * drive whose title contains the query, with the path that places it. The
1529
+ * walk is the agent tool's (`listRecordDrive` in query mode); this is what
1530
+ * the open-drive loupe reads (#3217).
1531
+ */
1532
+ export declare const recordDriveSearchHitSchema: z$2.ZodObject<{
1533
+ id: z$2.ZodString;
1534
+ kind: z$2.ZodEnum<{
1535
+ file: "file";
1536
+ folder: "folder";
1566
1537
  }>;
1567
- grants: z$2.ZodArray<z$2.ZodObject<{
1568
- actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1569
- role: z$2.ZodEnum<{
1570
- editor: "editor";
1571
- reader: "reader";
1538
+ title: z$2.ZodString;
1539
+ path: z$2.ZodString;
1540
+ parentId: z$2.ZodNullable<z$2.ZodString>;
1541
+ depth: z$2.ZodNumber;
1542
+ }, z$2.core.$strip>;
1543
+ export type RecordDriveSearchHit = z$2.output<typeof recordDriveSearchHitSchema>;
1544
+ export declare const recordDriveSearchResultSchema: z$2.ZodObject<{
1545
+ recordId: z$2.ZodString;
1546
+ hits: z$2.ZodArray<z$2.ZodObject<{
1547
+ id: z$2.ZodString;
1548
+ kind: z$2.ZodEnum<{
1549
+ file: "file";
1550
+ folder: "folder";
1572
1551
  }>;
1573
- sources: z$2.ZodArray<z$2.ZodEnum<{
1574
- manual: "manual";
1575
- }>>;
1552
+ title: z$2.ZodString;
1553
+ path: z$2.ZodString;
1554
+ parentId: z$2.ZodNullable<z$2.ZodString>;
1555
+ depth: z$2.ZodNumber;
1556
+ }, z$2.core.$strip>>;
1557
+ truncated: z$2.ZodOptional<z$2.ZodObject<{
1558
+ maxEntries: z$2.ZodNumber;
1559
+ returnedEntries: z$2.ZodNumber;
1576
1560
  }, z$2.core.$strip>>;
1577
1561
  }, z$2.core.$strip>;
1578
- export declare const ACTOR_TYPES: readonly ["user", "agent", "api_key", "system"];
1579
- export type ActorType = (typeof ACTOR_TYPES)[number];
1580
- export type ActorStatus = "active" | "suspended" | "deleted";
1581
- type SubjectActorType = Exclude<ActorType, "system">;
1562
+ export type RecordDriveSearchResult = z$2.output<typeof recordDriveSearchResultSchema>;
1582
1563
  /**
1583
- * An actor as every answer carries it, one branch per type and status so the
1584
- * type narrows on both (a discriminated union on `type`, then on `status`, so
1585
- * a check reads two keys rather than trying every branch): a subject actor
1586
- * names its subject until it is deleted (then the subject may be gone); the
1587
- * system actor has none. Timestamps travel as ISO strings and read as `Date`
1588
- * (`isoDateTime`).
1564
+ * Text-extraction lifecycle for a single file within a document pack.
1565
+ * `unsupported` is terminal and is not a failure: the file's type has no text
1566
+ * to extract (an Outlook `.msg`, a `.docx`, a `.zip`), so nothing is queued.
1589
1567
  */
1590
- export declare const actorSchema: z$2.ZodDiscriminatedUnion<[z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
1591
- id: z$2.ZodString;
1592
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1593
- displayName: z$2.ZodString;
1594
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1595
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1596
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1597
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1598
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1599
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1600
- } & {
1601
- type: z$2.ZodLiteral<"user">;
1602
- status: z$2.ZodLiteral<"active">;
1603
- subjectId: z$2.ZodString;
1604
- }, z$2.core.$strip>, z$2.ZodObject<{
1605
- id: z$2.ZodString;
1606
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1607
- displayName: z$2.ZodString;
1608
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1609
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1610
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1611
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1612
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1613
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1614
- } & {
1615
- type: z$2.ZodLiteral<"user">;
1616
- status: z$2.ZodLiteral<"suspended">;
1617
- subjectId: z$2.ZodString;
1618
- }, z$2.core.$strip>, z$2.ZodObject<{
1619
- id: z$2.ZodString;
1620
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1621
- displayName: z$2.ZodString;
1622
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1623
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1624
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1625
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1626
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1627
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1628
- } & {
1629
- type: z$2.ZodLiteral<"user">;
1630
- status: z$2.ZodLiteral<"deleted">;
1631
- subjectId: z$2.ZodNullable<z$2.ZodString>;
1632
- }, z$2.core.$strip>], "status">, z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
1633
- id: z$2.ZodString;
1634
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1635
- displayName: z$2.ZodString;
1636
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1637
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1638
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1639
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1640
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1641
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1642
- } & {
1643
- type: z$2.ZodLiteral<"agent">;
1644
- status: z$2.ZodLiteral<"active">;
1645
- subjectId: z$2.ZodString;
1646
- }, z$2.core.$strip>, z$2.ZodObject<{
1647
- id: z$2.ZodString;
1648
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1649
- displayName: z$2.ZodString;
1650
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1651
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1652
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1653
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1654
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1655
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1656
- } & {
1657
- type: z$2.ZodLiteral<"agent">;
1658
- status: z$2.ZodLiteral<"suspended">;
1659
- subjectId: z$2.ZodString;
1660
- }, z$2.core.$strip>, z$2.ZodObject<{
1661
- id: z$2.ZodString;
1662
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1663
- displayName: z$2.ZodString;
1664
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1665
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1666
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1667
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1668
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1669
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1670
- } & {
1671
- type: z$2.ZodLiteral<"agent">;
1672
- status: z$2.ZodLiteral<"deleted">;
1673
- subjectId: z$2.ZodNullable<z$2.ZodString>;
1674
- }, z$2.core.$strip>], "status">, z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
1675
- id: z$2.ZodString;
1676
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1677
- displayName: z$2.ZodString;
1678
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1679
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1680
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1681
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1682
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1683
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1684
- } & {
1685
- type: z$2.ZodLiteral<"api_key">;
1686
- status: z$2.ZodLiteral<"active">;
1687
- subjectId: z$2.ZodString;
1688
- }, z$2.core.$strip>, z$2.ZodObject<{
1689
- id: z$2.ZodString;
1690
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1691
- displayName: z$2.ZodString;
1692
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1693
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1694
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1695
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1696
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1697
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1698
- } & {
1699
- type: z$2.ZodLiteral<"api_key">;
1700
- status: z$2.ZodLiteral<"suspended">;
1701
- subjectId: z$2.ZodString;
1702
- }, z$2.core.$strip>, z$2.ZodObject<{
1703
- id: z$2.ZodString;
1704
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1705
- displayName: z$2.ZodString;
1706
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1707
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1708
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1709
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1710
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1711
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1712
- } & {
1713
- type: z$2.ZodLiteral<"api_key">;
1714
- status: z$2.ZodLiteral<"deleted">;
1715
- subjectId: z$2.ZodNullable<z$2.ZodString>;
1716
- }, z$2.core.$strip>], "status">, z$2.ZodObject<{
1717
- id: z$2.ZodString;
1718
- tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1719
- displayName: z$2.ZodString;
1720
- avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1721
- metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1722
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1723
- anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1724
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1725
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1726
- type: z$2.ZodLiteral<"system">;
1727
- status: z$2.ZodEnum<{
1728
- active: "active";
1729
- deleted: "deleted";
1730
- suspended: "suspended";
1731
- }>;
1732
- subjectId: z$2.ZodOptional<z$2.ZodNull>;
1733
- }, z$2.core.$strip>], "type">;
1734
- export type Actor = z$2.output<typeof actorSchema>;
1735
- interface CreateActorInputBase {
1736
- displayName: string;
1737
- avatarUrl?: string | null;
1738
- metadata?: Record<string, unknown>;
1739
- }
1740
- type CreateSubjectActorInput = { [Type in SubjectActorType]: {
1741
- type: Type;
1742
- subjectId: Uuid;
1743
- }; }[SubjectActorType];
1744
- export type CreateActorInput = (CreateActorInputBase & CreateSubjectActorInput) | (CreateActorInputBase & {
1745
- type: "system";
1746
- subjectId?: null;
1747
- });
1748
- export interface UpdateActorInput {
1749
- displayName?: string;
1750
- avatarUrl?: string | null;
1751
- status?: ActorStatus;
1752
- metadata?: Record<string, unknown>;
1753
- deletedAt?: Date | null;
1754
- anonymizedAt?: Date | null;
1755
- }
1756
- export interface ActorRoleAssignment {
1757
- id: Uuid;
1758
- tenantId: TenantId;
1759
- actorId: Uuid;
1760
- roleId: Uuid;
1761
- assignedBy?: Uuid | null;
1762
- createdAt: Date;
1763
- }
1764
- export interface AssignActorRoleInput {
1765
- actorId: Uuid;
1766
- roleId: Uuid;
1767
- assignedBy?: Uuid | null;
1768
- }
1769
- /**
1770
- * Legacy permission payload stored with an API key.
1771
- * Runtime authorization uses the API key actor's effective permissions.
1772
- */
1773
- export interface ApiKeyPermission {
1774
- scope: PermissionScope;
1775
- target: string;
1776
- actions: Action[];
1777
- }
1778
- /**
1779
- * A role an API key's actor holds — the identifying slice only, never the
1780
- * role's permissions.
1781
- */
1782
- export declare const apiKeyRoleSchema: z$2.ZodObject<{
1568
+ export declare const FILE_OCR_STATUSES: readonly ["pending", "processing", "completed", "failed", "unsupported"];
1569
+ export type FileOcrStatus = (typeof FILE_OCR_STATUSES)[number];
1570
+ /**
1571
+ * A single anonymous file belonging to a document pack.
1572
+ * Unlike the slot-based model, files carry no slot name — order within the
1573
+ * pack is `position` only, and `name` is provenance (originalName), never a
1574
+ * label rendered in the UI.
1575
+ */
1576
+ export declare const documentFileSchema: z$2.ZodObject<{
1783
1577
  id: z$2.ZodString;
1578
+ documentId: z$2.ZodString;
1579
+ position: z$2.ZodNumber;
1784
1580
  name: z$2.ZodString;
1785
- label: z$2.ZodString;
1581
+ mimeType: z$2.ZodString;
1582
+ size: z$2.ZodNumber;
1583
+ ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
1584
+ completed: "completed";
1585
+ failed: "failed";
1586
+ pending: "pending";
1587
+ processing: "processing";
1588
+ unsupported: "unsupported";
1589
+ }>>;
1590
+ ocrText: z$2.ZodNullable<z$2.ZodString>;
1591
+ ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
1592
+ processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
1786
1593
  }, z$2.core.$strip>;
1787
- export type ApiKeyRole = z$2.output<typeof apiKeyRoleSchema>;
1788
- /**
1789
- * An API key as every read answers it. Never its hash: the secret is shown
1790
- * once, by `apiKeyWithSecretSchema`, at creation. Its timestamps were always
1791
- * ISO strings, in the type as on the wire.
1792
- */
1793
- export declare const apiKeySchema: z$2.ZodObject<{
1794
- id: z$2.ZodString;
1795
- tenantId: z$2.ZodString;
1796
- userProfileId: z$2.ZodNullable<z$2.ZodString>;
1797
- name: z$2.ZodString;
1798
- prefix: z$2.ZodString;
1799
- expiresAt: z$2.ZodNullable<z$2.ZodString>;
1800
- lastUsedAt: z$2.ZodNullable<z$2.ZodString>;
1801
- revokedAt: z$2.ZodNullable<z$2.ZodString>;
1802
- createdAt: z$2.ZodString;
1803
- createdBy: z$2.ZodString;
1804
- roles: z$2.ZodOptional<z$2.ZodArray<z$2.ZodObject<{
1594
+ export type DocumentFile = z$2.output<typeof documentFileSchema>;
1595
+ /** What an attach did: a new pack, a file appended to a named pack, or the pack already holding the file linked. */
1596
+ export declare const ATTACH_FILE_ACTIONS: readonly ["created", "appended", "linked-existing"];
1597
+ export type AttachFileAction = (typeof ATTACH_FILE_ACTIONS)[number];
1598
+ /** What attaching a file to a record's document attribute answers: the pack, the file in it, and what happened. */
1599
+ export declare const attachedRecordDocumentSchema: z$2.ZodObject<{
1600
+ document: z$2.ZodObject<{
1601
+ id: z$2.ZodString;
1602
+ tenantId: z$2.ZodString;
1603
+ title: z$2.ZodString;
1604
+ kind: z$2.ZodEnum<{
1605
+ file: "file";
1606
+ folder: "folder";
1607
+ }>;
1608
+ parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1609
+ description: z$2.ZodOptional<z$2.ZodString>;
1610
+ contentHash: z$2.ZodOptional<z$2.ZodString>;
1611
+ createdBy: z$2.ZodOptional<z$2.ZodString>;
1612
+ updatedBy: z$2.ZodOptional<z$2.ZodString>;
1613
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1614
+ position: z$2.ZodNumber;
1615
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1616
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1617
+ }, z$2.core.$strip>;
1618
+ file: z$2.ZodObject<{
1805
1619
  id: z$2.ZodString;
1620
+ documentId: z$2.ZodString;
1621
+ position: z$2.ZodNumber;
1806
1622
  name: z$2.ZodString;
1807
- label: z$2.ZodString;
1808
- }, z$2.core.$strip>>>;
1809
- authorityActorId: z$2.ZodNullable<z$2.ZodString>;
1810
- detachedAt: z$2.ZodNullable<z$2.ZodString>;
1811
- detachedBy: z$2.ZodNullable<z$2.ZodString>;
1812
- mirrorsOwner: z$2.ZodBoolean;
1623
+ mimeType: z$2.ZodString;
1624
+ size: z$2.ZodNumber;
1625
+ ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
1626
+ completed: "completed";
1627
+ failed: "failed";
1628
+ pending: "pending";
1629
+ processing: "processing";
1630
+ unsupported: "unsupported";
1631
+ }>>;
1632
+ ocrText: z$2.ZodNullable<z$2.ZodString>;
1633
+ ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
1634
+ processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
1635
+ }, z$2.core.$strip>;
1636
+ action: z$2.ZodEnum<{
1637
+ appended: "appended";
1638
+ created: "created";
1639
+ "linked-existing": "linked-existing";
1640
+ }>;
1813
1641
  }, z$2.core.$strip>;
1814
- export type ApiKey = z$2.output<typeof apiKeySchema>;
1815
- /** Returned only at creation time — the only time the plaintext secret is available. */
1816
- export declare const apiKeyWithSecretSchema: z$2.ZodObject<{
1642
+ /** A pack file as a drive row lists it: everything but its OCR text, which only reads need. */
1643
+ export declare const driveFileSchema: z$2.ZodObject<{
1817
1644
  id: z$2.ZodString;
1818
- tenantId: z$2.ZodString;
1819
- userProfileId: z$2.ZodNullable<z$2.ZodString>;
1645
+ documentId: z$2.ZodString;
1646
+ position: z$2.ZodNumber;
1820
1647
  name: z$2.ZodString;
1821
- prefix: z$2.ZodString;
1822
- expiresAt: z$2.ZodNullable<z$2.ZodString>;
1823
- lastUsedAt: z$2.ZodNullable<z$2.ZodString>;
1824
- revokedAt: z$2.ZodNullable<z$2.ZodString>;
1825
- createdAt: z$2.ZodString;
1826
- createdBy: z$2.ZodString;
1827
- roles: z$2.ZodOptional<z$2.ZodArray<z$2.ZodObject<{
1828
- id: z$2.ZodString;
1829
- name: z$2.ZodString;
1830
- label: z$2.ZodString;
1831
- }, z$2.core.$strip>>>;
1832
- authorityActorId: z$2.ZodNullable<z$2.ZodString>;
1833
- detachedAt: z$2.ZodNullable<z$2.ZodString>;
1834
- detachedBy: z$2.ZodNullable<z$2.ZodString>;
1835
- mirrorsOwner: z$2.ZodBoolean;
1836
- secret: z$2.ZodString;
1648
+ mimeType: z$2.ZodString;
1649
+ size: z$2.ZodNumber;
1650
+ ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
1651
+ completed: "completed";
1652
+ failed: "failed";
1653
+ pending: "pending";
1654
+ processing: "processing";
1655
+ unsupported: "unsupported";
1656
+ }>>;
1657
+ ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
1658
+ processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
1837
1659
  }, z$2.core.$strip>;
1838
- export type ApiKeyWithSecret = z$2.output<typeof apiKeyWithSecretSchema>;
1660
+ export type DriveFile = z$2.output<typeof driveFileSchema>;
1661
+ export type DocumentWithFiles = Document & {
1662
+ files: DocumentFile[];
1663
+ };
1839
1664
  /**
1840
- * Returned by validateKey — provides everything downstream needs.
1841
- * Permissions come from actor-native effective permissions.
1665
+ * One row of a record's drive at a given level: the document with its sub
1666
+ * count and its pack files (#4332). A drive-only attachment, one that exists
1667
+ * only as a reference edge and is named nowhere in `record.values`, has no
1668
+ * other source for its files, and without them its row menu cannot offer
1669
+ * Download. A folder has no pack: its `files` is always `[]`.
1670
+ *
1671
+ * A root-level child also names where it sits on the record: the document
1672
+ * attribute whose edge holds it (`attachments` for a plain drive item) and
1673
+ * that edge's qualified properties. A nested child has no edge of its own and
1674
+ * carries neither.
1842
1675
  */
1843
- export interface ApiKeyAuthContext {
1844
- tenantId: string;
1845
- userId: string | null;
1846
- keyId: string;
1847
- actorId: string;
1848
- actorType: ActorType;
1849
- credentialActorId?: string;
1850
- credentialActorType?: "api_key";
1851
- permissions: ApiKeyPermission[];
1852
- createdBy: string;
1853
- /** The stored authority the key acts for; null when detached. */
1854
- authorityActorId: string | null;
1855
- /**
1856
- * The person a personal key works for, the root of its actor chain as a
1857
- * person is an agent's: what the key creates is theirs and it sees what
1858
- * they see, within the key's own grants. Null for a workspace key.
1859
- */
1860
- rootActorId: string | null;
1861
- }
1862
- export interface CreateApiKeyInput {
1863
- name: string;
1864
- /**
1865
- * Explicit role to bind the key's actor to.
1866
- * When omitted, the key's actor holds the `member` role.
1867
- */
1868
- roleId?: string;
1869
- expiresAt?: string;
1870
- userProfileId?: string;
1871
- actorMetadata?: Record<string, unknown>;
1872
- /**
1873
- * Bind the key to the caller's own profile without naming it — how the CLI
1874
- * creates personal keys by default. Refused (403) when the caller acts for
1875
- * no human (a detached workspace key, an agent).
1876
- */
1877
- personal?: boolean;
1878
- }
1879
- /**
1880
- * Type of mentionable entity
1881
- */
1882
- export type MentionEntityType = "user" | "record" | (string & {});
1676
+ export declare const recordDriveChildSchema: z$2.ZodObject<{
1677
+ id: z$2.ZodString;
1678
+ tenantId: z$2.ZodString;
1679
+ title: z$2.ZodString;
1680
+ kind: z$2.ZodEnum<{
1681
+ file: "file";
1682
+ folder: "folder";
1683
+ }>;
1684
+ parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1685
+ description: z$2.ZodOptional<z$2.ZodString>;
1686
+ contentHash: z$2.ZodOptional<z$2.ZodString>;
1687
+ createdBy: z$2.ZodOptional<z$2.ZodString>;
1688
+ updatedBy: z$2.ZodOptional<z$2.ZodString>;
1689
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1690
+ position: z$2.ZodNumber;
1691
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1692
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1693
+ subCount: z$2.ZodNullable<z$2.ZodNumber>;
1694
+ files: z$2.ZodArray<z$2.ZodObject<{
1695
+ id: z$2.ZodString;
1696
+ documentId: z$2.ZodString;
1697
+ position: z$2.ZodNumber;
1698
+ name: z$2.ZodString;
1699
+ mimeType: z$2.ZodString;
1700
+ size: z$2.ZodNumber;
1701
+ ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
1702
+ completed: "completed";
1703
+ failed: "failed";
1704
+ pending: "pending";
1705
+ processing: "processing";
1706
+ unsupported: "unsupported";
1707
+ }>>;
1708
+ ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
1709
+ processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
1710
+ }, z$2.core.$strip>>;
1711
+ attributeName: z$2.ZodOptional<z$2.ZodString>;
1712
+ properties: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>>;
1713
+ }, z$2.core.$strip>;
1714
+ export type RecordDriveChild = z$2.output<typeof recordDriveChildSchema>;
1883
1715
  /**
1884
- * A mention reference stored with a message
1716
+ * The orders a drive level is listed in. Every mode puts folders before
1717
+ * files, then sorts on its key, then on `id`:
1718
+ * - `manual`: `position` (the drag order);
1719
+ * - `name-asc` / `name-desc`: the title, numeric and case- and
1720
+ * accent-insensitive ("File 2" before "file 10", "Éa" equal to "ea");
1721
+ * - `date-desc` / `date-asc`: a file's `createdAt` (the date it was added)
1722
+ * to the millisecond, so a rename never moves it; folders keep `name-asc`'s
1723
+ * order in both directions.
1724
+ * The `id` tiebreak is ascending in every mode.
1885
1725
  */
1886
- export interface MentionReference {
1887
- /** Unique ID for this mention instance */
1888
- id: string;
1889
- /** Entity type (user, record, or custom) */
1890
- type: MentionEntityType;
1891
- /** Entity ID (user ID or record ID) */
1892
- entityId: string;
1893
- /** Display label at time of mention (cached for display even if entity is deleted) */
1894
- label: string;
1895
- /** Object name for records, undefined for users */
1896
- objectName?: string;
1897
- /** Start position in the message text */
1898
- startIndex: number;
1899
- /** End position in the message text */
1900
- endIndex: number;
1901
- }
1726
+ export declare const DOCUMENT_SORT_MODES: readonly ["manual", "name-asc", "name-desc", "date-desc", "date-asc"];
1727
+ export type DocumentSortMode = (typeof DOCUMENT_SORT_MODES)[number];
1728
+ /** Rows in a page of a drive level when the caller names no `limit`. */
1729
+ export declare const RECORD_DRIVE_PAGE_DEFAULT_LIMIT = 100;
1730
+ /** The most rows one page of a drive level holds; a larger `limit` is clamped. */
1731
+ export declare const RECORD_DRIVE_PAGE_MAX_LIMIT = 500;
1902
1732
  /**
1903
- * Context data for a mentioned entity (sent to AI)
1733
+ * The longest drive page cursor read back. An issued cursor carries one title
1734
+ * (at most 255 characters) plus a few short fields; anything longer is crafted.
1904
1735
  */
1905
- export interface MentionedEntityContext {
1906
- /** Entity type */
1907
- type: MentionEntityType;
1908
- /** Entity ID */
1909
- entityId: string;
1910
- /** Display label */
1911
- label: string;
1912
- /** Object name for records */
1913
- objectName?: string;
1914
- /** Additional context data (record values, user details, etc.) */
1915
- data?: Record<string, unknown>;
1916
- }
1736
+ export declare const RECORD_DRIVE_CURSOR_MAX_LENGTH = 2048;
1917
1737
  /**
1918
- * Full mention context for AI
1738
+ * One page of a record's drive level (#4985), in its sort mode's order.
1739
+ * `nextCursor` resumes strictly after the page's last row, and is `null` on
1740
+ * the last page. A cursor is opaque and only valid for the mode that issued it.
1919
1741
  */
1920
- export interface MentionedContext {
1921
- /** All mentioned entities with their context data */
1922
- entities: MentionedEntityContext[];
1923
- /** Summary text for AI system prompt */
1924
- summary: string;
1742
+ export declare const recordDriveChildrenPageSchema: z$2.ZodObject<{
1743
+ items: z$2.ZodArray<z$2.ZodObject<{
1744
+ id: z$2.ZodString;
1745
+ tenantId: z$2.ZodString;
1746
+ title: z$2.ZodString;
1747
+ kind: z$2.ZodEnum<{
1748
+ file: "file";
1749
+ folder: "folder";
1750
+ }>;
1751
+ parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1752
+ description: z$2.ZodOptional<z$2.ZodString>;
1753
+ contentHash: z$2.ZodOptional<z$2.ZodString>;
1754
+ createdBy: z$2.ZodOptional<z$2.ZodString>;
1755
+ updatedBy: z$2.ZodOptional<z$2.ZodString>;
1756
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1757
+ position: z$2.ZodNumber;
1758
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1759
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1760
+ subCount: z$2.ZodNullable<z$2.ZodNumber>;
1761
+ files: z$2.ZodArray<z$2.ZodObject<{
1762
+ id: z$2.ZodString;
1763
+ documentId: z$2.ZodString;
1764
+ position: z$2.ZodNumber;
1765
+ name: z$2.ZodString;
1766
+ mimeType: z$2.ZodString;
1767
+ size: z$2.ZodNumber;
1768
+ ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
1769
+ completed: "completed";
1770
+ failed: "failed";
1771
+ pending: "pending";
1772
+ processing: "processing";
1773
+ unsupported: "unsupported";
1774
+ }>>;
1775
+ ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
1776
+ processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
1777
+ }, z$2.core.$strip>>;
1778
+ attributeName: z$2.ZodOptional<z$2.ZodString>;
1779
+ properties: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>>;
1780
+ }, z$2.core.$strip>>;
1781
+ nextCursor: z$2.ZodNullable<z$2.ZodString>;
1782
+ }, z$2.core.$strip>;
1783
+ export type RecordDriveChildrenPage = z$2.output<typeof recordDriveChildrenPageSchema>;
1784
+ export interface CreateDocument {
1785
+ title: string;
1786
+ kind?: DocumentKind;
1787
+ parentId?: Uuid | null;
1788
+ description?: string;
1789
+ position?: number;
1925
1790
  }
1926
1791
  /**
1927
- * A span the person selected in an Artifact preview and carried into their
1928
- * next message as a removable chip (#4117).
1929
- *
1930
- * Deliberately NOT a {@link MentionReference}: that one requires `startIndex`
1931
- * and `endIndex` into the message text, so the transcript can place it inline.
1932
- * A quote chip is not in the text and has no honest value for them. It travels
1933
- * beside `attachments`, which is the message's existing shape for a removable
1934
- * chip that is not part of what was typed.
1792
+ * Reference to a record attribute that should atomically attach a freshly
1793
+ * created Document. Passed alongside `CreateDocument` to make creation
1794
+ * link-aware end-to-end (client → REST → service → repo).
1935
1795
  *
1936
- * `revision` is what closes the loop: `publish_artifact` already takes
1937
- * `artifactId` + `baseRevision`, so the agent can revise exactly the revision
1938
- * the span was read from rather than whatever is newest when it answers.
1796
+ * The server requires this — orphan Documents are not creatable through the
1797
+ * REST API.
1939
1798
  */
1940
- export interface ArtifactQuote {
1941
- /** Unique per chip, so removing one of two quotes of the same span works. */
1942
- id: string;
1943
- artifactId: string;
1944
- /** The revision the span was read from. */
1945
- revision: number;
1946
- selectedText: string;
1799
+ export interface CreateDocumentLink {
1800
+ objectName: string;
1801
+ sourceRecordId: string;
1802
+ attributeName: string;
1803
+ }
1804
+ export interface UpdateDocument {
1805
+ title?: string;
1806
+ parentId?: Uuid | null;
1807
+ position?: number;
1808
+ }
1809
+ export interface DocumentListOptions {
1810
+ limit?: number;
1811
+ offset?: number;
1812
+ }
1813
+ export interface RecordDocuments {
1814
+ /** Documents grouped by attribute name (includes system 'attachments' attribute) */
1815
+ byAttribute: Record<string, DocumentWithFiles[]>;
1947
1816
  }
1948
1817
  /**
1949
- * What a decision asks of its recipient (spec 2026-10-29 § 3): `question`,
1950
- * `approval`, `review` and `handoff` await an answer; `report` (work a
1951
- * routine did for you) and `fyi` are informational, shown under « Pour toi ».
1818
+ * One record that holds documents, with how much sits at its drive root and
1819
+ * when it last moved. The wire shape of `GET /documents/record-owners`.
1952
1820
  */
1953
- export declare const DECISION_KINDS: readonly ["question", "approval", "review", "handoff", "report", "fyi"];
1954
- export type DecisionKind = (typeof DECISION_KINDS)[number];
1955
- export declare const DECISION_INBOX_STATES: readonly ["unread", "read", "archived"];
1956
- export type DecisionInboxState = (typeof DECISION_INBOX_STATES)[number];
1957
- /** `pending` open, `completed` answered, `dismissed` withdrawn, `expired` expired; `none` informational. */
1958
- export declare const DECISION_WORK_STATES: readonly ["none", "pending", "completed", "dismissed", "expired"];
1959
- export type DecisionWorkState = (typeof DECISION_WORK_STATES)[number];
1960
- /** What `decisions.list` filters on (`state`); absent = everything not archived. */
1961
- export declare const DECISION_LIST_STATES: readonly [
1962
- /** Pending, not archived, not snoozed (`snoozed_until` null or past): « À trancher ». */
1963
- "open",
1964
- /** Pending and `snoozed_until` in the future: « Plus tard ». */
1965
- "snoozed",
1966
- /** Completed, dismissed or expired: « Tranchées ». */
1967
- "closed", "answered", "withdrawn", "expired", "unread", "read", "archived"];
1968
- export type DecisionListState = (typeof DECISION_LIST_STATES)[number];
1969
- /** What a decision can be about (§ 3): its links' target types. */
1970
- export declare const DECISION_LINK_TARGET_TYPES: readonly ["record", "session", "document", "agent", "routine", "page", "email_thread"];
1971
- export type DecisionLinkTargetType = (typeof DECISION_LINK_TARGET_TYPES)[number];
1972
- /** One thing a decision is about. `objectName` only on a `record` (its page is addressed by its object). */
1973
- export declare const decisionLinkSchema: z$2.ZodObject<{
1974
- targetType: z$2.ZodEnum<{
1975
- agent: "agent";
1976
- document: "document";
1977
- email_thread: "email_thread";
1978
- page: "page";
1979
- record: "record";
1980
- routine: "routine";
1981
- session: "session";
1982
- }>;
1983
- targetId: z$2.ZodString;
1984
- objectName: z$2.ZodOptional<z$2.ZodString>;
1985
- label: z$2.ZodOptional<z$2.ZodString>;
1986
- }, z$2.core.$strip>;
1987
- export type DecisionLink = z$2.output<typeof decisionLinkSchema>;
1821
+ export declare const documentRecordOwnerSchema: z$2.ZodObject<{
1822
+ recordId: z$2.ZodString;
1823
+ objectName: z$2.ZodString;
1824
+ label: z$2.ZodString;
1825
+ itemCount: z$2.ZodNumber;
1826
+ fileCount: z$2.ZodNumber;
1827
+ lastActivityAt: z$2.ZodString;
1828
+ }, z$2.core.$strip>;
1829
+ export type DocumentRecordOwner = z$2.output<typeof documentRecordOwnerSchema>;
1830
+ /** One page of {@link DocumentRecordOwner}s; `nextOffset: null` is the last page. */
1831
+ export declare const documentRecordOwnerPageSchema: z$2.ZodObject<{
1832
+ data: z$2.ZodArray<z$2.ZodObject<{
1833
+ recordId: z$2.ZodString;
1834
+ objectName: z$2.ZodString;
1835
+ label: z$2.ZodString;
1836
+ itemCount: z$2.ZodNumber;
1837
+ fileCount: z$2.ZodNumber;
1838
+ lastActivityAt: z$2.ZodString;
1839
+ }, z$2.core.$strip>>;
1840
+ nextOffset: z$2.ZodNullable<z$2.ZodNumber>;
1841
+ }, z$2.core.$strip>;
1842
+ export type DocumentRecordOwnerPage = z$2.output<typeof documentRecordOwnerPageSchema>;
1843
+ /** What the reading actor may do with a resource (spec §6.6); records never produce `runner`. */
1844
+ export declare const viewerAccessSchema: z$2.ZodEnum<{
1845
+ editor: "editor";
1846
+ owner: "owner";
1847
+ reader: "reader";
1848
+ runner: "runner";
1849
+ workspace: "workspace";
1850
+ }>;
1851
+ type Values = readonly [string, ...string[]];
1852
+ /** One beneficiary of a private resource: its effective role and every source that grants it. */
1853
+ export declare function accessGrantSchema<const Role extends Values, const Source extends Values>(roles: Role, sources: Source): z$2.ZodObject<{
1854
+ actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1855
+ role: z$2.ZodEnum<{ [k in Role[number]]: k; } extends (infer T) ? { [k in keyof T]: T[k]; } : never>;
1856
+ sources: z$2.ZodArray<z$2.ZodEnum<{ [k in Source[number]]: k; } extends (infer T_1) ? { [k in keyof T_1]: T_1[k]; } : never>>;
1857
+ }, z$2.core.$strip>;
1858
+ /** Who can reach a record beyond its owner (`GET /records/:object/:id/access`). */
1859
+ export declare const recordAudienceSchema: z$2.ZodObject<{
1860
+ recordId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1861
+ visibility: z$2.ZodEnum<{
1862
+ private: "private";
1863
+ workspace: "workspace";
1864
+ }>;
1865
+ ownedBy: z$2.ZodNullable<z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>>;
1866
+ viewerAccess: z$2.ZodEnum<{
1867
+ editor: "editor";
1868
+ owner: "owner";
1869
+ reader: "reader";
1870
+ runner: "runner";
1871
+ workspace: "workspace";
1872
+ }>;
1873
+ grants: z$2.ZodArray<z$2.ZodObject<{
1874
+ actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1875
+ role: z$2.ZodEnum<{
1876
+ editor: "editor";
1877
+ reader: "reader";
1878
+ }>;
1879
+ sources: z$2.ZodArray<z$2.ZodEnum<{
1880
+ manual: "manual";
1881
+ meeting_attendee: "meeting_attendee";
1882
+ }>>;
1883
+ }, z$2.core.$strip>>;
1884
+ }, z$2.core.$strip>;
1885
+ /** Who may run commands on a device beyond its owner (`GET /devices/:id/access`). */
1886
+ export declare const deviceAudienceSchema: z$2.ZodObject<{
1887
+ deviceId: z$2.ZodString;
1888
+ visibility: z$2.ZodEnum<{
1889
+ private: "private";
1890
+ workspace: "workspace";
1891
+ }>;
1892
+ ownedBy: z$2.ZodNullable<z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>>;
1893
+ viewerAccess: z$2.ZodEnum<{
1894
+ editor: "editor";
1895
+ owner: "owner";
1896
+ reader: "reader";
1897
+ runner: "runner";
1898
+ workspace: "workspace";
1899
+ }>;
1900
+ grants: z$2.ZodArray<z$2.ZodObject<{
1901
+ actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1902
+ role: z$2.ZodEnum<{
1903
+ runner: "runner";
1904
+ }>;
1905
+ sources: z$2.ZodArray<z$2.ZodEnum<{
1906
+ manual: "manual";
1907
+ }>>;
1908
+ }, z$2.core.$strip>>;
1909
+ }, z$2.core.$strip>;
1910
+ /** Who can reach a private page beyond its owner (`GET /pages/:id/access`). */
1911
+ export declare const pageAudienceSchema: z$2.ZodObject<{
1912
+ pageId: z$2.ZodString;
1913
+ visibility: z$2.ZodEnum<{
1914
+ private: "private";
1915
+ workspace: "workspace";
1916
+ }>;
1917
+ ownedBy: z$2.ZodNullable<z$2.ZodString>;
1918
+ viewerAccess: z$2.ZodEnum<{
1919
+ editor: "editor";
1920
+ owner: "owner";
1921
+ reader: "reader";
1922
+ runner: "runner";
1923
+ workspace: "workspace";
1924
+ }>;
1925
+ grants: z$2.ZodArray<z$2.ZodObject<{
1926
+ actorId: z$2.ZodType<string, string, z$2.core.$ZodTypeInternals<string, string>>;
1927
+ role: z$2.ZodEnum<{
1928
+ editor: "editor";
1929
+ reader: "reader";
1930
+ }>;
1931
+ sources: z$2.ZodArray<z$2.ZodEnum<{
1932
+ manual: "manual";
1933
+ }>>;
1934
+ }, z$2.core.$strip>>;
1935
+ }, z$2.core.$strip>;
1936
+ export declare const ACTOR_TYPES: readonly ["user", "agent", "api_key", "system"];
1937
+ export type ActorType = (typeof ACTOR_TYPES)[number];
1938
+ export type ActorStatus = "active" | "suspended" | "deleted";
1939
+ type SubjectActorType = Exclude<ActorType, "system">;
1940
+ /**
1941
+ * An actor as every answer carries it, one branch per type and status so the
1942
+ * type narrows on both (a discriminated union on `type`, then on `status`, so
1943
+ * a check reads two keys rather than trying every branch): a subject actor
1944
+ * names its subject until it is deleted (then the subject may be gone); the
1945
+ * system actor has none. Timestamps travel as ISO strings and read as `Date`
1946
+ * (`isoDateTime`).
1947
+ */
1948
+ export declare const actorSchema: z$2.ZodDiscriminatedUnion<[z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
1949
+ id: z$2.ZodString;
1950
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1951
+ displayName: z$2.ZodString;
1952
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1953
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1954
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1955
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1956
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1957
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1958
+ } & {
1959
+ type: z$2.ZodLiteral<"user">;
1960
+ status: z$2.ZodLiteral<"active">;
1961
+ subjectId: z$2.ZodString;
1962
+ }, z$2.core.$strip>, z$2.ZodObject<{
1963
+ id: z$2.ZodString;
1964
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1965
+ displayName: z$2.ZodString;
1966
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1967
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1968
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1969
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1970
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1971
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1972
+ } & {
1973
+ type: z$2.ZodLiteral<"user">;
1974
+ status: z$2.ZodLiteral<"suspended">;
1975
+ subjectId: z$2.ZodString;
1976
+ }, z$2.core.$strip>, z$2.ZodObject<{
1977
+ id: z$2.ZodString;
1978
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1979
+ displayName: z$2.ZodString;
1980
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1981
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1982
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1983
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1984
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1985
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1986
+ } & {
1987
+ type: z$2.ZodLiteral<"user">;
1988
+ status: z$2.ZodLiteral<"deleted">;
1989
+ subjectId: z$2.ZodNullable<z$2.ZodString>;
1990
+ }, z$2.core.$strip>], "status">, z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
1991
+ id: z$2.ZodString;
1992
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
1993
+ displayName: z$2.ZodString;
1994
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
1995
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
1996
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1997
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
1998
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
1999
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2000
+ } & {
2001
+ type: z$2.ZodLiteral<"agent">;
2002
+ status: z$2.ZodLiteral<"active">;
2003
+ subjectId: z$2.ZodString;
2004
+ }, z$2.core.$strip>, z$2.ZodObject<{
2005
+ id: z$2.ZodString;
2006
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
2007
+ displayName: z$2.ZodString;
2008
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
2009
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
2010
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2011
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2012
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2013
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2014
+ } & {
2015
+ type: z$2.ZodLiteral<"agent">;
2016
+ status: z$2.ZodLiteral<"suspended">;
2017
+ subjectId: z$2.ZodString;
2018
+ }, z$2.core.$strip>, z$2.ZodObject<{
2019
+ id: z$2.ZodString;
2020
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
2021
+ displayName: z$2.ZodString;
2022
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
2023
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
2024
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2025
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2026
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2027
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2028
+ } & {
2029
+ type: z$2.ZodLiteral<"agent">;
2030
+ status: z$2.ZodLiteral<"deleted">;
2031
+ subjectId: z$2.ZodNullable<z$2.ZodString>;
2032
+ }, z$2.core.$strip>], "status">, z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
2033
+ id: z$2.ZodString;
2034
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
2035
+ displayName: z$2.ZodString;
2036
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
2037
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
2038
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2039
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2040
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2041
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2042
+ } & {
2043
+ type: z$2.ZodLiteral<"api_key">;
2044
+ status: z$2.ZodLiteral<"active">;
2045
+ subjectId: z$2.ZodString;
2046
+ }, z$2.core.$strip>, z$2.ZodObject<{
2047
+ id: z$2.ZodString;
2048
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
2049
+ displayName: z$2.ZodString;
2050
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
2051
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
2052
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2053
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2054
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2055
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2056
+ } & {
2057
+ type: z$2.ZodLiteral<"api_key">;
2058
+ status: z$2.ZodLiteral<"suspended">;
2059
+ subjectId: z$2.ZodString;
2060
+ }, z$2.core.$strip>, z$2.ZodObject<{
2061
+ id: z$2.ZodString;
2062
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
2063
+ displayName: z$2.ZodString;
2064
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
2065
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
2066
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2067
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2068
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2069
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2070
+ } & {
2071
+ type: z$2.ZodLiteral<"api_key">;
2072
+ status: z$2.ZodLiteral<"deleted">;
2073
+ subjectId: z$2.ZodNullable<z$2.ZodString>;
2074
+ }, z$2.core.$strip>], "status">, z$2.ZodObject<{
2075
+ id: z$2.ZodString;
2076
+ tenantId: z$2.ZodType<TenantId, string, z$2.core.$ZodTypeInternals<TenantId, string>>;
2077
+ displayName: z$2.ZodString;
2078
+ avatarUrl: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
2079
+ metadata: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
2080
+ deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2081
+ anonymizedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
2082
+ createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2083
+ updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
2084
+ type: z$2.ZodLiteral<"system">;
2085
+ status: z$2.ZodEnum<{
2086
+ active: "active";
2087
+ deleted: "deleted";
2088
+ suspended: "suspended";
2089
+ }>;
2090
+ subjectId: z$2.ZodOptional<z$2.ZodNull>;
2091
+ }, z$2.core.$strip>], "type">;
2092
+ export type Actor = z$2.output<typeof actorSchema>;
2093
+ interface CreateActorInputBase {
2094
+ displayName: string;
2095
+ avatarUrl?: string | null;
2096
+ metadata?: Record<string, unknown>;
2097
+ }
2098
+ type CreateSubjectActorInput = { [Type in SubjectActorType]: {
2099
+ type: Type;
2100
+ subjectId: Uuid;
2101
+ }; }[SubjectActorType];
2102
+ export type CreateActorInput = (CreateActorInputBase & CreateSubjectActorInput) | (CreateActorInputBase & {
2103
+ type: "system";
2104
+ subjectId?: null;
2105
+ });
2106
+ export interface UpdateActorInput {
2107
+ displayName?: string;
2108
+ avatarUrl?: string | null;
2109
+ status?: ActorStatus;
2110
+ metadata?: Record<string, unknown>;
2111
+ deletedAt?: Date | null;
2112
+ anonymizedAt?: Date | null;
2113
+ }
2114
+ export interface ActorRoleAssignment {
2115
+ id: Uuid;
2116
+ tenantId: TenantId;
2117
+ actorId: Uuid;
2118
+ roleId: Uuid;
2119
+ assignedBy?: Uuid | null;
2120
+ createdAt: Date;
2121
+ }
2122
+ export interface AssignActorRoleInput {
2123
+ actorId: Uuid;
2124
+ roleId: Uuid;
2125
+ assignedBy?: Uuid | null;
2126
+ }
2127
+ /**
2128
+ * Legacy permission payload stored with an API key.
2129
+ * Runtime authorization uses the API key actor's effective permissions.
2130
+ */
2131
+ export interface ApiKeyPermission {
2132
+ scope: PermissionScope;
2133
+ target: string;
2134
+ actions: Action[];
2135
+ }
2136
+ /**
2137
+ * A role an API key's actor holds — the identifying slice only, never the
2138
+ * role's permissions.
2139
+ */
2140
+ export declare const apiKeyRoleSchema: z$2.ZodObject<{
2141
+ id: z$2.ZodString;
2142
+ name: z$2.ZodString;
2143
+ label: z$2.ZodString;
2144
+ }, z$2.core.$strip>;
2145
+ export type ApiKeyRole = z$2.output<typeof apiKeyRoleSchema>;
2146
+ /**
2147
+ * An API key as every read answers it. Never its hash: the secret is shown
2148
+ * once, by `apiKeyWithSecretSchema`, at creation. Its timestamps were always
2149
+ * ISO strings, in the type as on the wire.
2150
+ */
2151
+ export declare const apiKeySchema: z$2.ZodObject<{
2152
+ id: z$2.ZodString;
2153
+ tenantId: z$2.ZodString;
2154
+ userProfileId: z$2.ZodNullable<z$2.ZodString>;
2155
+ name: z$2.ZodString;
2156
+ prefix: z$2.ZodString;
2157
+ expiresAt: z$2.ZodNullable<z$2.ZodString>;
2158
+ lastUsedAt: z$2.ZodNullable<z$2.ZodString>;
2159
+ revokedAt: z$2.ZodNullable<z$2.ZodString>;
2160
+ createdAt: z$2.ZodString;
2161
+ createdBy: z$2.ZodString;
2162
+ roles: z$2.ZodOptional<z$2.ZodArray<z$2.ZodObject<{
2163
+ id: z$2.ZodString;
2164
+ name: z$2.ZodString;
2165
+ label: z$2.ZodString;
2166
+ }, z$2.core.$strip>>>;
2167
+ authorityActorId: z$2.ZodNullable<z$2.ZodString>;
2168
+ detachedAt: z$2.ZodNullable<z$2.ZodString>;
2169
+ detachedBy: z$2.ZodNullable<z$2.ZodString>;
2170
+ mirrorsOwner: z$2.ZodBoolean;
2171
+ }, z$2.core.$strip>;
2172
+ export type ApiKey = z$2.output<typeof apiKeySchema>;
2173
+ /** Returned only at creation time — the only time the plaintext secret is available. */
2174
+ export declare const apiKeyWithSecretSchema: z$2.ZodObject<{
2175
+ id: z$2.ZodString;
2176
+ tenantId: z$2.ZodString;
2177
+ userProfileId: z$2.ZodNullable<z$2.ZodString>;
2178
+ name: z$2.ZodString;
2179
+ prefix: z$2.ZodString;
2180
+ expiresAt: z$2.ZodNullable<z$2.ZodString>;
2181
+ lastUsedAt: z$2.ZodNullable<z$2.ZodString>;
2182
+ revokedAt: z$2.ZodNullable<z$2.ZodString>;
2183
+ createdAt: z$2.ZodString;
2184
+ createdBy: z$2.ZodString;
2185
+ roles: z$2.ZodOptional<z$2.ZodArray<z$2.ZodObject<{
2186
+ id: z$2.ZodString;
2187
+ name: z$2.ZodString;
2188
+ label: z$2.ZodString;
2189
+ }, z$2.core.$strip>>>;
2190
+ authorityActorId: z$2.ZodNullable<z$2.ZodString>;
2191
+ detachedAt: z$2.ZodNullable<z$2.ZodString>;
2192
+ detachedBy: z$2.ZodNullable<z$2.ZodString>;
2193
+ mirrorsOwner: z$2.ZodBoolean;
2194
+ secret: z$2.ZodString;
2195
+ }, z$2.core.$strip>;
2196
+ export type ApiKeyWithSecret = z$2.output<typeof apiKeyWithSecretSchema>;
2197
+ /**
2198
+ * Returned by validateKey — provides everything downstream needs.
2199
+ * Permissions come from actor-native effective permissions.
2200
+ */
2201
+ export interface ApiKeyAuthContext {
2202
+ tenantId: string;
2203
+ userId: string | null;
2204
+ keyId: string;
2205
+ actorId: string;
2206
+ actorType: ActorType;
2207
+ credentialActorId?: string;
2208
+ credentialActorType?: "api_key";
2209
+ permissions: ApiKeyPermission[];
2210
+ createdBy: string;
2211
+ /** The stored authority the key acts for; null when detached. */
2212
+ authorityActorId: string | null;
2213
+ /**
2214
+ * The person a personal key works for, the root of its actor chain as a
2215
+ * person is an agent's: what the key creates is theirs and it sees what
2216
+ * they see, within the key's own grants. Null for a workspace key.
2217
+ */
2218
+ rootActorId: string | null;
2219
+ }
2220
+ export interface CreateApiKeyInput {
2221
+ name: string;
2222
+ /**
2223
+ * Explicit role to bind the key's actor to.
2224
+ * When omitted, the key's actor holds the `member` role.
2225
+ */
2226
+ roleId?: string;
2227
+ expiresAt?: string;
2228
+ userProfileId?: string;
2229
+ actorMetadata?: Record<string, unknown>;
2230
+ /**
2231
+ * Bind the key to the caller's own profile without naming it — how the CLI
2232
+ * creates personal keys by default. Refused (403) when the caller acts for
2233
+ * no human (a detached workspace key, an agent).
2234
+ */
2235
+ personal?: boolean;
2236
+ }
2237
+ /**
2238
+ * Type of mentionable entity
2239
+ */
2240
+ export type MentionEntityType = "user" | "record" | (string & {});
2241
+ /**
2242
+ * A mention reference stored with a message
2243
+ */
2244
+ export interface MentionReference {
2245
+ /** Unique ID for this mention instance */
2246
+ id: string;
2247
+ /** Entity type (user, record, or custom) */
2248
+ type: MentionEntityType;
2249
+ /** Entity ID (user ID or record ID) */
2250
+ entityId: string;
2251
+ /** Display label at time of mention (cached for display even if entity is deleted) */
2252
+ label: string;
2253
+ /** Object name for records, undefined for users */
2254
+ objectName?: string;
2255
+ /** Start position in the message text */
2256
+ startIndex: number;
2257
+ /** End position in the message text */
2258
+ endIndex: number;
2259
+ }
2260
+ /**
2261
+ * Context data for a mentioned entity (sent to AI)
2262
+ */
2263
+ export interface MentionedEntityContext {
2264
+ /** Entity type */
2265
+ type: MentionEntityType;
2266
+ /** Entity ID */
2267
+ entityId: string;
2268
+ /** Display label */
2269
+ label: string;
2270
+ /** Object name for records */
2271
+ objectName?: string;
2272
+ /** Additional context data (record values, user details, etc.) */
2273
+ data?: Record<string, unknown>;
2274
+ }
2275
+ /**
2276
+ * Full mention context for AI
2277
+ */
2278
+ export interface MentionedContext {
2279
+ /** All mentioned entities with their context data */
2280
+ entities: MentionedEntityContext[];
2281
+ /** Summary text for AI system prompt */
2282
+ summary: string;
2283
+ }
2284
+ /**
2285
+ * A span the person selected in an Artifact preview and carried into their
2286
+ * next message as a removable chip (#4117).
2287
+ *
2288
+ * Deliberately NOT a {@link MentionReference}: that one requires `startIndex`
2289
+ * and `endIndex` into the message text, so the transcript can place it inline.
2290
+ * A quote chip is not in the text and has no honest value for them. It travels
2291
+ * beside `attachments`, which is the message's existing shape for a removable
2292
+ * chip that is not part of what was typed.
2293
+ *
2294
+ * `revision` is what closes the loop: `publish_artifact` already takes
2295
+ * `artifactId` + `baseRevision`, so the agent can revise exactly the revision
2296
+ * the span was read from rather than whatever is newest when it answers.
2297
+ */
2298
+ export interface ArtifactQuote {
2299
+ /** Unique per chip, so removing one of two quotes of the same span works. */
2300
+ id: string;
2301
+ artifactId: string;
2302
+ /** The revision the span was read from. */
2303
+ revision: number;
2304
+ selectedText: string;
2305
+ }
2306
+ /**
2307
+ * What a decision asks of its recipient (spec 2026-10-29 § 3): `question`,
2308
+ * `approval`, `review` and `handoff` await an answer; `report` (work a
2309
+ * routine did for you) and `fyi` are informational, shown under « Pour toi ».
2310
+ */
2311
+ export declare const DECISION_KINDS: readonly ["question", "approval", "review", "handoff", "report", "fyi"];
2312
+ export type DecisionKind = (typeof DECISION_KINDS)[number];
2313
+ export declare const DECISION_INBOX_STATES: readonly ["unread", "read", "archived"];
2314
+ export type DecisionInboxState = (typeof DECISION_INBOX_STATES)[number];
2315
+ /** `pending` open, `completed` answered, `dismissed` withdrawn, `expired` expired; `none` informational. */
2316
+ export declare const DECISION_WORK_STATES: readonly ["none", "pending", "completed", "dismissed", "expired"];
2317
+ export type DecisionWorkState = (typeof DECISION_WORK_STATES)[number];
2318
+ /** What `decisions.list` filters on (`state`); absent = everything not archived. */
2319
+ export declare const DECISION_LIST_STATES: readonly [
2320
+ /** Pending, not archived, not snoozed (`snoozed_until` null or past): « À trancher ». */
2321
+ "open",
2322
+ /** Pending and `snoozed_until` in the future: « Plus tard ». */
2323
+ "snoozed",
2324
+ /** Completed, dismissed or expired: « Tranchées ». */
2325
+ "closed", "answered", "withdrawn", "expired", "unread", "read", "archived"];
2326
+ export type DecisionListState = (typeof DECISION_LIST_STATES)[number];
2327
+ /** What a decision can be about (§ 3): its links' target types. */
2328
+ export declare const DECISION_LINK_TARGET_TYPES: readonly ["record", "session", "document", "agent", "routine", "page", "email_thread"];
2329
+ export type DecisionLinkTargetType = (typeof DECISION_LINK_TARGET_TYPES)[number];
2330
+ /** One thing a decision is about. `objectName` only on a `record` (its page is addressed by its object). */
2331
+ export declare const decisionLinkSchema: z$2.ZodObject<{
2332
+ targetType: z$2.ZodEnum<{
2333
+ agent: "agent";
2334
+ document: "document";
2335
+ email_thread: "email_thread";
2336
+ page: "page";
2337
+ record: "record";
2338
+ routine: "routine";
2339
+ session: "session";
2340
+ }>;
2341
+ targetId: z$2.ZodString;
2342
+ objectName: z$2.ZodOptional<z$2.ZodString>;
2343
+ label: z$2.ZodOptional<z$2.ZodString>;
2344
+ }, z$2.core.$strip>;
2345
+ export type DecisionLink = z$2.output<typeof decisionLinkSchema>;
1988
2346
  /** `record:<object>:<id>`, or `<targetType>:<id>`: the `link` filter's and `thread_key`'s text form. */
1989
2347
  export declare function formatDecisionLink(link: DecisionLink): string;
1990
2348
  /** The inverse of {@link formatDecisionLink}; `null` for anything else (unknown type, a record without its object, an empty id). */
@@ -2781,6 +3139,13 @@ export declare const objectDefinitionOutputSchema: z$2.ZodObject<{
2781
3139
  metadata: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>>;
2782
3140
  documentLayout: z$2.ZodOptional<z$2.ZodType<DocumentLayout, DocumentLayout, z$2.core.$ZodTypeInternals<DocumentLayout, DocumentLayout>>>;
2783
3141
  hierarchical: z$2.ZodOptional<z$2.ZodBoolean>;
3142
+ defaultDriveSort: z$2.ZodOptional<z$2.ZodEnum<{
3143
+ "date-asc": "date-asc";
3144
+ "date-desc": "date-desc";
3145
+ manual: "manual";
3146
+ "name-asc": "name-asc";
3147
+ "name-desc": "name-desc";
3148
+ }>>;
2784
3149
  }, z$2.core.$strip>;
2785
3150
  export declare const schemaGroupSchema: z$2.ZodObject<{
2786
3151
  kind: z$2.ZodLiteral<"bundle">;
@@ -6576,6 +6941,8 @@ export interface CreateCustomObjectInput {
6576
6941
  image?: ObjectImage;
6577
6942
  /** Its records may have a parent of this object. */
6578
6943
  hierarchical?: boolean;
6944
+ /** The order its records' drives rest in until a person chooses one. */
6945
+ defaultDriveSort?: DocumentSortMode;
6579
6946
  attributes?: (Attribute | {
6580
6947
  build: () => Attribute;
6581
6948
  })[];
@@ -6593,6 +6960,8 @@ export interface UpdateObjectInput {
6593
6960
  labelExpression?: string;
6594
6961
  embeddingExpression?: string;
6595
6962
  hierarchical?: boolean;
6963
+ /** The order its records' drives rest in until a person chooses one. */
6964
+ defaultDriveSort?: DocumentSortMode;
6596
6965
  metadata?: Record<string, unknown>;
6597
6966
  }
6598
6967
  export type RelationOption = z$1.output<typeof relationOptionSchema>;
@@ -10023,980 +10392,629 @@ export interface AIChatMessage {
10023
10392
  /** True on an assistant message whose turn speaks only through `send` ({@link SPEAKS_THROUGH_SEND_METADATA_KEY}). */
10024
10393
  speaksThroughSend?: boolean;
10025
10394
  /** True on an assistant message of a turn a wake's message alone started ({@link WAKE_TURN_METADATA_KEY}). */
10026
- wakeTurn?: boolean;
10027
- }
10028
- /**
10029
- * Question types supported by the agent
10030
- */
10031
- export type AIQuestionType = "text" | "choice" | "confirm" | "multiselect";
10032
- /**
10033
- * Option for choice/multiselect questions
10034
- */
10035
- export interface AIQuestionOption {
10036
- value: string;
10037
- label: string;
10038
- description?: string;
10039
- }
10040
- /**
10041
- * Question from the agent to the user
10042
- */
10043
- export interface AIQuestion {
10044
- /** Unique question ID */
10045
- id: string;
10046
- /** Question type */
10047
- type: AIQuestionType;
10048
- /** Question text */
10049
- question: string;
10050
- /** Options for choice/multiselect */
10051
- options?: AIQuestionOption[];
10052
- /** Placeholder for text input */
10053
- placeholder?: string;
10054
- /** Whether answer is required */
10055
- required?: boolean;
10056
- /** Min selections for multiselect */
10057
- minSelections?: number;
10058
- /** Max selections for multiselect */
10059
- maxSelections?: number;
10060
- }
10061
- /**
10062
- * Answer format for questions
10063
- */
10064
- export type AIQuestionAnswer = {
10065
- type: "text";
10066
- value: string;
10067
- } | {
10068
- type: "choice";
10069
- value: string;
10070
- } | {
10071
- type: "confirm";
10072
- value: boolean;
10073
- } | {
10074
- type: "multiselect";
10075
- value: string[];
10076
- };
10077
- /**
10078
- * Option for batch questions
10079
- */
10080
- export interface AIBatchQuestionOption {
10081
- /** Value returned when selected */
10082
- value: string;
10083
- /** Display label */
10084
- label: string;
10085
- /**
10086
- * What choosing this option means, or what it costs. Rendered under the
10087
- * label, in the quiet weight: a batch of bare labels asks the human to
10088
- * infer the trade-off the agent already knows.
10089
- */
10090
- description?: string;
10091
- }
10092
- /**
10093
- * Kind of field a batch question is answered with.
10094
- *
10095
- * `record` (constraining the answer to a real `recordId`) is deliberately
10096
- * absent: it needs a record selector, which is a feature of its own rather
10097
- * than a field variant.
10098
- */
10099
- export type AIBatchQuestionType = "choice" | "text";
10100
- /**
10101
- * Question in a batch (for ask_questions tool)
10102
- */
10103
- export interface AIBatchQuestion {
10104
- /** Unique question ID */
10105
- id: string;
10106
- /** Question text to display */
10107
- question: string;
10108
- /**
10109
- * What the person needs to know to answer this question, in a sentence or
10110
- * two, read under it. Optional: a question that speaks for itself has none.
10111
- */
10112
- context?: string;
10113
- /**
10114
- * Kind of field to answer with. Optional for backwards compatibility: when
10115
- * absent it is derived from the shape — `options` present means `choice`,
10116
- * otherwise `text`.
10117
- */
10118
- type?: AIBatchQuestionType;
10119
- /** Predefined options (if provided, displayed as buttons) */
10120
- options?: AIBatchQuestionOption[];
10121
- /**
10122
- * Several options may be chosen at once, and the answer comes back as an
10123
- * array. Decided by the agent per question, because only it knows whether
10124
- * the choices are mutually exclusive; a human forced to pick one of three
10125
- * non-exclusive options answers a question nobody asked.
10126
- */
10127
- multiSelect?: boolean;
10128
- /** Allow custom text input in addition to options */
10129
- allowCustomAnswer?: boolean;
10130
- /** Placeholder for custom input field */
10131
- placeholder?: string;
10132
- }
10133
- /**
10134
- * A single answer, in the type the question asked for. A `multiSelect`
10135
- * question answers with the array: joining it into `"a, b"` would hand the
10136
- * server a string to split back apart, and one whose separator can appear
10137
- * inside a value.
10138
- */
10139
- export type AIBatchAnswerValue = string | string[];
10140
- /**
10141
- * Answer returned by the AgentQuestions widget
10142
- */
10143
- export interface AIBatchQuestionAnswer {
10144
- /** True if user skipped all questions */
10145
- skipped: boolean;
10146
- /** Map of question ID to the answer given, in the question's own type */
10147
- answers: Record<string, AIBatchAnswerValue>;
10148
- /**
10149
- * The precisions a person added to the options they chose, by question ID
10150
- * then option value: « Gagné », precised « facturer en deux fois ». Rare and
10151
- * optional; only a chosen option's precision is kept.
10152
- */
10153
- notes?: Record<string, Record<string, string>>;
10154
- }
10155
- /**
10156
- * Todo item status
10157
- */
10158
- export declare const TODO_STATUSES: readonly ["pending", "in_progress", "completed", "blocked"];
10159
- export type AITodoStatus = (typeof TODO_STATUSES)[number];
10160
- /**
10161
- * Todo item in a task list
10162
- */
10163
- export interface AITodoItem {
10164
- id: string;
10165
- description: string;
10166
- status: AITodoStatus;
10167
- updatedAt?: number;
10168
- /**
10169
- * What an architect build todo is anchored on in the draft. A targeted
10170
- * todo's status is the server's: `draft_schema` recomputes it from the
10171
- * folded draft, and `write_todos` keeps the stored one.
10172
- */
10173
- target?: AITodoTarget;
10174
- }
10175
- /**
10176
- * The phases of an architect build, always worked in this order: a plan
10177
- * whose targeted todos run out of this order is refused.
10178
- */
10179
- export declare const TODO_PHASES: readonly ["objects", "fields", "relations", "views", "samples"];
10180
- export type AITodoPhase = (typeof TODO_PHASES)[number];
10181
- /** Where a build todo is anchored, by phase. */
10182
- export type AITodoTarget =
10183
- /** Completed when the folded draft has the object. */
10184
- {
10185
- phase: "objects";
10186
- objectName: string;
10187
- } |
10188
- /** Completed when every named attribute is on the object. */
10189
- {
10190
- phase: "fields";
10191
- objectName: string;
10192
- attributes: string[];
10193
- } |
10194
- /** Completed when every named relation attribute is on the object. */
10195
- {
10196
- phase: "relations";
10197
- objectName: string;
10198
- attributes: string[];
10199
- } |
10200
- /**
10201
- * Completed when an executed operation of the draft writes that view (and,
10202
- * when named, that content). The empty default views `add_object` folds do
10203
- * not count, nor does a view that is merely published.
10204
- */
10205
- {
10206
- phase: "views";
10207
- objectName: string;
10208
- viewName: string;
10209
- contentName?: string;
10210
- } | {
10211
- phase: "views";
10212
- pageId: string;
10213
- } |
10214
- /** Completed when the draft holds at least one sample record of the object. */
10215
- {
10216
- phase: "samples";
10217
- objectName: string;
10218
- };
10219
- /**
10220
- * A todo as clients read it: a target is exposed by its phase, which the
10221
- * progress surfaces read, and by its object when it names one, which picks the
10222
- * builder the cursor follows (R17).
10223
- */
10224
- export interface AgentTodoPlanViewItem extends Omit<AITodoItem, "target"> {
10225
- target?: {
10226
- phase: AITodoPhase;
10227
- objectName?: string;
10228
- };
10395
+ wakeTurn?: boolean;
10229
10396
  }
10230
10397
  /**
10231
- * Persisted bounds on a todo, beside the type they constrain.
10232
- *
10233
- * Both sides of the wire enforce them: the runtime zod schema when it writes,
10234
- * and the React projection parser when it reads an untrusted payload back.
10235
- * React cannot import the runtime, which is why these numbers used to be
10236
- * copied there under a "keep aligned with the canonical persisted schema"
10237
- * comment — a synchronisation the compiler could not check.
10398
+ * Question types supported by the agent
10238
10399
  */
10239
- export declare const MAX_TODOS = 50;
10240
- export declare const MAX_TODO_ID_CHARS = 80;
10241
- export declare const MAX_TODO_DESCRIPTION_CHARS = 500;
10400
+ export type AIQuestionType = "text" | "choice" | "confirm" | "multiselect";
10242
10401
  /**
10243
- * Todo list managed by the agent
10402
+ * Option for choice/multiselect questions
10244
10403
  */
10245
- export interface AITodoList {
10246
- items: AITodoItem[];
10247
- progress: number;
10248
- isComplete: boolean;
10404
+ export interface AIQuestionOption {
10405
+ value: string;
10406
+ label: string;
10407
+ description?: string;
10249
10408
  }
10250
10409
  /**
10251
- * Compaction summary for conversation history compression
10410
+ * Question from the agent to the user
10252
10411
  */
10253
- export interface AICompactionSummary {
10412
+ export interface AIQuestion {
10413
+ /** Unique question ID */
10254
10414
  id: string;
10255
- tenantId: string;
10256
- userId: string;
10257
- conversationId: string;
10258
- summary: string;
10259
- originalMessageCount: number;
10260
- tokenCountBefore: number;
10261
- tokenCountAfter: number;
10262
- compactedAt: Date;
10415
+ /** Question type */
10416
+ type: AIQuestionType;
10417
+ /** Question text */
10418
+ question: string;
10419
+ /** Options for choice/multiselect */
10420
+ options?: AIQuestionOption[];
10421
+ /** Placeholder for text input */
10422
+ placeholder?: string;
10423
+ /** Whether answer is required */
10424
+ required?: boolean;
10425
+ /** Min selections for multiselect */
10426
+ minSelections?: number;
10427
+ /** Max selections for multiselect */
10428
+ maxSelections?: number;
10263
10429
  }
10264
- /** Create-response metadata; these grants were added by this transaction, not prior grants. */
10265
- export type CreateAgentTriggerResult = z$1.output<typeof createAgentTriggerResultSchema>;
10266
10430
  /**
10267
- * The device channel wire protocol, shared by the API server and the CLI
10268
- * shell worker. The server only ever emits `capability: "shell"` and
10269
- * `kind: "shell"`; the enums keep `"browser"` for one more release because
10270
- * every installed CLI parses these frames strictly against that enum.
10431
+ * Answer format for questions
10271
10432
  */
10272
- /** Absolute path of the channel on the API origin (the `/v1` prefix included). */
10273
- export declare const DEVICE_CHANNEL_PATH = "/v1/device-worker/channel";
10274
- export declare const DEVICE_CHANNEL_MAX_FRAME_BYTES = 262144;
10275
- /** A socket that has not sent `authenticate` within this budget is closed 1008. */
10276
- export declare const DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS = 10000;
10277
- /** The server leases the next queued command from the store on this cadence while idle. */
10278
- export declare const DEVICE_CHANNEL_IDLE_POLL_MS = 2000;
10279
- /** The server re-validates the credential and refreshes presence on this cadence. */
10280
- export declare const DEVICE_CHANNEL_PRESENCE_MS = 2000;
10433
+ export type AIQuestionAnswer = {
10434
+ type: "text";
10435
+ value: string;
10436
+ } | {
10437
+ type: "choice";
10438
+ value: string;
10439
+ } | {
10440
+ type: "confirm";
10441
+ value: boolean;
10442
+ } | {
10443
+ type: "multiselect";
10444
+ value: string[];
10445
+ };
10281
10446
  /**
10282
- * The server sends `{ type: "ping" }` plus a control ping on this cadence; a
10283
- * socket that has not answered the control ping by the next tick is dropped.
10447
+ * Option for batch questions
10284
10448
  */
10285
- export declare const DEVICE_CHANNEL_KEEPALIVE_MS = 20000;
10449
+ export interface AIBatchQuestionOption {
10450
+ /** Value returned when selected */
10451
+ value: string;
10452
+ /** Display label */
10453
+ label: string;
10454
+ /**
10455
+ * What choosing this option means, or what it costs. Rendered under the
10456
+ * label, in the quiet weight: a batch of bare labels asks the human to
10457
+ * infer the trade-off the agent already knows.
10458
+ */
10459
+ description?: string;
10460
+ }
10286
10461
  /**
10287
- * The code a worker closes with when a frame breaks the protocol. A browser
10288
- * `WebSocket` only accepts 1000 and 3000-4999, so the private-use mirror of
10289
- * 1008 is the one code every worker can actually send.
10462
+ * Kind of field a batch question is answered with.
10463
+ *
10464
+ * `record` (constraining the answer to a real `recordId`) is deliberately
10465
+ * absent: it needs a record selector, which is a feature of its own rather
10466
+ * than a field variant.
10290
10467
  */
10291
- export declare const DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION = 4008;
10292
- /** Where an exponential backoff starts, and where it stops doubling. */
10293
- export interface RetryBounds {
10294
- initialMs: number;
10295
- maxMs: number;
10296
- }
10468
+ export type AIBatchQuestionType = "choice" | "text";
10297
10469
  /**
10298
- * Where the channel is: the path is absolute on the API origin, so a profile's
10299
- * `apiUrl` keeps only its host and the scheme swaps to the socket one. Written
10300
- * as an explicit map rather than a rewrite of the origin string, because a
10301
- * two-letter scheme literal reads to the SDK's egress scan as the `ws` package.
10470
+ * Question in a batch (for ask_questions tool)
10302
10471
  */
10303
- export declare function deviceChannelUrl(apiUrl: string): string;
10304
- /** Exponential backoff within the given bounds, plus the shared jitter window. */
10305
- export declare function computeRetryDelay(attempt: number, random: () => number, bounds: RetryBounds): number;
10306
- /** When to reconnect to the channel: 1 s doubling up to 30 s, plus jitter. */
10307
- export declare function computeReconnectDelay(attempt: number, random?: () => number): number;
10308
- export declare const DEVICE_COMMAND_ERROR_CODES: readonly ["worker_disconnected", "cancelled", "timed_out", "execution_failed"];
10309
- export type DeviceCommandErrorCode = (typeof DEVICE_COMMAND_ERROR_CODES)[number];
10310
- export declare class DeviceChannelProtocolError extends SchemaError {
10311
- readonly _tag = "DeviceChannelProtocolError";
10312
- constructor(message: string);
10313
- }
10314
- /** The shells a worker can open a session in; announced at `authenticate`. */
10315
- export declare const DEVICE_SHELLS: readonly ["zsh", "bash", "sh", "fish", "pwsh", "powershell"];
10316
- export type DeviceShell = (typeof DEVICE_SHELLS)[number];
10317
- /** Whether the machine can drive its desktop through `agent-desktop`. */
10318
- export declare const DEVICE_DESKTOP_STATES: readonly ["ready", "permission_missing", "no_session", "unavailable"];
10319
- export type DeviceDesktopState = (typeof DEVICE_DESKTOP_STATES)[number];
10320
- export declare const DeviceDesktopStatusSchema: z$2.ZodObject<{
10321
- state: z$2.ZodEnum<{
10322
- no_session: "no_session";
10323
- permission_missing: "permission_missing";
10324
- ready: "ready";
10325
- unavailable: "unavailable";
10326
- }>;
10327
- version: z$2.ZodString;
10328
- }, z$2.core.$strict>;
10329
- export type DeviceDesktopStatus = z$2.infer<typeof DeviceDesktopStatusSchema>;
10330
- export declare const DeviceChannelWorkerFrameSchema: z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
10331
- type: z$2.ZodLiteral<"authenticate">;
10332
- credential: z$2.ZodString;
10333
- protocol: z$2.ZodOptional<z$2.ZodNumber>;
10334
- desktop: z$2.ZodOptional<z$2.ZodObject<{
10335
- state: z$2.ZodEnum<{
10336
- no_session: "no_session";
10337
- permission_missing: "permission_missing";
10338
- ready: "ready";
10339
- unavailable: "unavailable";
10340
- }>;
10341
- version: z$2.ZodString;
10342
- }, z$2.core.$strict>>;
10343
- shell: z$2.ZodOptional<z$2.ZodEnum<{
10344
- bash: "bash";
10345
- fish: "fish";
10346
- powershell: "powershell";
10347
- pwsh: "pwsh";
10348
- sh: "sh";
10349
- zsh: "zsh";
10350
- }>>;
10351
- }, z$2.core.$strict>, z$2.ZodObject<{
10352
- id: z$2.ZodUUID;
10353
- leaseToken: z$2.ZodString;
10354
- type: z$2.ZodLiteral<"running">;
10355
- }, z$2.core.$strict>, z$2.ZodObject<{
10356
- id: z$2.ZodUUID;
10357
- leaseToken: z$2.ZodString;
10358
- type: z$2.ZodLiteral<"heartbeat">;
10359
- }, z$2.core.$strict>, z$2.ZodObject<{
10360
- id: z$2.ZodUUID;
10361
- leaseToken: z$2.ZodString;
10362
- type: z$2.ZodLiteral<"output">;
10363
- stdout: z$2.ZodOptional<z$2.ZodString>;
10364
- stderr: z$2.ZodOptional<z$2.ZodString>;
10365
- }, z$2.core.$strict>, z$2.ZodObject<{
10366
- id: z$2.ZodUUID;
10367
- leaseToken: z$2.ZodString;
10368
- type: z$2.ZodLiteral<"complete">;
10369
- result: z$2.ZodObject<{
10370
- stdout: z$2.ZodOptional<z$2.ZodString>;
10371
- stderr: z$2.ZodOptional<z$2.ZodString>;
10372
- exitCode: z$2.ZodNumber;
10373
- success: z$2.ZodBoolean;
10374
- errorCode: z$2.ZodOptional<z$2.ZodEnum<{
10375
- cancelled: "cancelled";
10376
- execution_failed: "execution_failed";
10377
- timed_out: "timed_out";
10378
- worker_disconnected: "worker_disconnected";
10379
- }>>;
10380
- }, z$2.core.$strict>;
10381
- background: z$2.ZodOptional<z$2.ZodObject<{
10382
- pid: z$2.ZodNumber;
10383
- logPath: z$2.ZodString;
10384
- }, z$2.core.$strict>>;
10385
- }, z$2.core.$strict>, z$2.ZodObject<{
10386
- type: z$2.ZodLiteral<"pong">;
10387
- }, z$2.core.$strict>], "type">;
10388
- export declare const DeviceChannelServerFrameSchema: z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
10389
- type: z$2.ZodLiteral<"ready">;
10390
- device: z$2.ZodObject<{
10391
- id: z$2.ZodString;
10392
- name: z$2.ZodString;
10393
- capability: z$2.ZodEnum<{
10394
- browser: "browser";
10395
- shell: "shell";
10396
- }>;
10397
- }, z$2.core.$strict>;
10398
- protocol: z$2.ZodOptional<z$2.ZodNumber>;
10399
- }, z$2.core.$strict>, z$2.ZodObject<{
10400
- id: z$2.ZodUUID;
10401
- leaseToken: z$2.ZodString;
10402
- type: z$2.ZodLiteral<"command">;
10403
- kind: z$2.ZodEnum<{
10404
- browser: "browser";
10405
- shell: "shell";
10406
- }>;
10407
- intent: z$2.ZodString;
10408
- timeoutMs: z$2.ZodNumber;
10409
- command: z$2.ZodOptional<z$2.ZodString>;
10410
- cwd: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10411
- rootSessionId: z$2.ZodOptional<z$2.ZodString>;
10412
- background: z$2.ZodOptional<z$2.ZodBoolean>;
10413
- }, z$2.core.$strict>, z$2.ZodObject<{
10414
- type: z$2.ZodLiteral<"release_session">;
10415
- rootSessionId: z$2.ZodString;
10416
- }, z$2.core.$strict>, z$2.ZodObject<{
10417
- type: z$2.ZodLiteral<"cancel">;
10418
- id: z$2.ZodUUID;
10419
- reason: z$2.ZodEnum<{
10420
- cancelled: "cancelled";
10421
- revoked: "revoked";
10422
- timed_out: "timed_out";
10423
- }>;
10424
- }, z$2.core.$strict>, z$2.ZodObject<{
10425
- type: z$2.ZodLiteral<"reauthenticate">;
10426
- }, z$2.core.$strict>, z$2.ZodObject<{
10427
- type: z$2.ZodLiteral<"revoked">;
10428
- }, z$2.core.$strict>, z$2.ZodObject<{
10429
- type: z$2.ZodLiteral<"ping">;
10430
- }, z$2.core.$strict>], "type">;
10431
- export type DeviceChannelWorkerFrame = z$2.infer<typeof DeviceChannelWorkerFrameSchema>;
10432
- export type DeviceChannelServerFrame = z$2.infer<typeof DeviceChannelServerFrameSchema>;
10433
- /** Parses one text frame; a non-JSON or off-protocol frame is a `DeviceChannelProtocolError`. */
10434
- export declare function parseDeviceChannelFrame<T>(schema: z$2.ZodType<T>, raw: string): T;
10435
- export declare function parseWorkerFrame(raw: string): DeviceChannelWorkerFrame;
10436
- export declare function parseServerFrame(raw: string): DeviceChannelServerFrame;
10472
+ export interface AIBatchQuestion {
10473
+ /** Unique question ID */
10474
+ id: string;
10475
+ /** Question text to display */
10476
+ question: string;
10477
+ /**
10478
+ * What the person needs to know to answer this question, in a sentence or
10479
+ * two, read under it. Optional: a question that speaks for itself has none.
10480
+ */
10481
+ context?: string;
10482
+ /**
10483
+ * Kind of field to answer with. Optional for backwards compatibility: when
10484
+ * absent it is derived from the shape — `options` present means `choice`,
10485
+ * otherwise `text`.
10486
+ */
10487
+ type?: AIBatchQuestionType;
10488
+ /** Predefined options (if provided, displayed as buttons) */
10489
+ options?: AIBatchQuestionOption[];
10490
+ /**
10491
+ * Several options may be chosen at once, and the answer comes back as an
10492
+ * array. Decided by the agent per question, because only it knows whether
10493
+ * the choices are mutually exclusive; a human forced to pick one of three
10494
+ * non-exclusive options answers a question nobody asked.
10495
+ */
10496
+ multiSelect?: boolean;
10497
+ /** Allow custom text input in addition to options */
10498
+ allowCustomAnswer?: boolean;
10499
+ /** Placeholder for custom input field */
10500
+ placeholder?: string;
10501
+ }
10437
10502
  /**
10438
- * The minimum every capability predicate in this file reads: the type, plus
10439
- * whatever else of a full `Attribute` the caller happens to hold. Exported so
10440
- * callers that only have a partial attribute — a plan's proposed attribute, a
10441
- * schema snapshot row — can ask the same questions as callers holding the real
10442
- * thing, instead of restating the rules.
10503
+ * A single answer, in the type the question asked for. A `multiSelect`
10504
+ * question answers with the array: joining it into `"a, b"` would hand the
10505
+ * server a string to split back apart, and one whose separator can appear
10506
+ * inside a value.
10443
10507
  */
10444
- export type AttributeLike = Pick<Attribute, "type"> & Partial<Attribute>;
10445
- export type AttributeLifecycleCapabilities = {
10446
- active: boolean;
10447
- deprecated: boolean;
10448
- visibleInArchitect: boolean;
10449
- visibleInRuntime: boolean;
10450
- warningWhenDeprecated: boolean;
10451
- };
10452
- export type AttributeStorageMode = "value" | "edge" | "computed";
10453
- export type AttributeCardinality = "one" | "many";
10454
- export type AttributePolymorphicCapability = "none" | "code-only" | "internal";
10455
- export type AttributeStorageCapabilities = {
10456
- mode: AttributeStorageMode;
10457
- cardinality: AttributeCardinality;
10458
- edgeBacked: boolean;
10459
- preservesExistingValues: boolean;
10460
- qualifiedProperties: boolean;
10461
- polymorphic: AttributePolymorphicCapability;
10462
- maxItems: boolean;
10463
- };
10464
- export type AttributeRequiredCapability = "allowed" | "forbidden";
10465
- export type AttributeDefaultValueCapability = "static" | "automatic" | "forbidden";
10466
- export type AttributeAuthoringCapabilities = {
10467
- editable: boolean;
10468
- readOnly: boolean;
10469
- directEdit: boolean;
10470
- required: AttributeRequiredCapability;
10471
- defaultValue: AttributeDefaultValueCapability;
10472
- placeholder: boolean;
10473
- maxItems: boolean;
10474
- };
10475
- export type AttributePresentationCapabilities = {
10476
- formField: boolean;
10477
- tableCell: boolean;
10478
- defaultColumn: boolean;
10479
- compactDisplay: boolean;
10480
- popoverEditor: boolean;
10481
- placeholder: boolean;
10482
- warningWhenDeprecated: boolean;
10483
- };
10484
- export type AttributeQueryCapabilities = {
10485
- filterable: boolean;
10486
- searchable: boolean;
10487
- sortable: boolean;
10488
- groupable: boolean;
10489
- kanbanGroupable: boolean;
10490
- operators: readonly FilterOperator[];
10491
- };
10492
- export type AttributeAgentCapabilities = {
10493
- readable: boolean;
10494
- writable: boolean;
10495
- compactReadable: boolean;
10496
- contentReadable: boolean;
10497
- requiresDedicatedTool: boolean;
10498
- };
10499
- export type AttributeExchangeCapabilities = {
10500
- importable: boolean;
10501
- exportable: boolean;
10502
- schemaExportable: boolean;
10503
- metadataExportable: boolean;
10504
- };
10505
- export type AttributeCapabilities = {
10506
- lifecycle: AttributeLifecycleCapabilities;
10507
- storage: AttributeStorageCapabilities;
10508
- authoring: AttributeAuthoringCapabilities;
10509
- presentation: AttributePresentationCapabilities;
10510
- query: AttributeQueryCapabilities;
10511
- agent: AttributeAgentCapabilities;
10512
- exchange: AttributeExchangeCapabilities;
10513
- };
10508
+ export type AIBatchAnswerValue = string | string[];
10514
10509
  /**
10515
- * The parts of a location a filter may address (#3118). A location is a
10516
- * JSONB object with no operators of its own; a rule names one of these parts
10517
- * through `property` and compares it as text — `country` holds the ISO3 code.
10510
+ * Answer returned by the AgentQuestions widget
10518
10511
  */
10519
- export declare const LOCATION_FILTER_PROPERTIES: readonly ["city", "postalCode", "country"];
10520
- export type LocationFilterProperty = (typeof LOCATION_FILTER_PROPERTIES)[number];
10521
- export declare function isLocationFilterProperty(name: string): name is LocationFilterProperty;
10522
- export declare const ATTRIBUTE_FILTER_OPERATORS: Readonly<Record<Exclude<AttributeType, "rollup">, readonly FilterOperator[]>>;
10512
+ export interface AIBatchQuestionAnswer {
10513
+ /** True if user skipped all questions */
10514
+ skipped: boolean;
10515
+ /** Map of question ID to the answer given, in the question's own type */
10516
+ answers: Record<string, AIBatchAnswerValue>;
10517
+ /**
10518
+ * The precisions a person added to the options they chose, by question ID
10519
+ * then option value: « Gagné », precised « facturer en deux fois ». Rare and
10520
+ * optional; only a chosen option's precision is kept.
10521
+ */
10522
+ notes?: Record<string, Record<string, string>>;
10523
+ /**
10524
+ * The files the person added on the card to go with the answer, each a
10525
+ * `file:<id>` or `document:<id>` ref; empty when none was. Files the
10526
+ * question itself attached are not among them.
10527
+ */
10528
+ addedFiles?: string[];
10529
+ }
10523
10530
  /**
10524
- * What an attribute type's value is — the per-type fact most rules branch on:
10525
- * - `plain`: typed in by hand (text, number, date, phone, currency, location)
10526
- * - `boolean`: a checkbox, always true or false, never empty
10527
- * - `options`: a code (or codes) from the attribute's own `options`
10528
- * - `reference`: ids of users, records or files, stored as edges
10529
- * - `computed`: derived from other values (formula, rollup), never written
10531
+ * Todo item status
10530
10532
  */
10531
- export type AttributeValueKind = "plain" | "boolean" | "options" | "reference" | "computed";
10533
+ export declare const TODO_STATUSES: readonly ["pending", "in_progress", "completed", "blocked"];
10534
+ export type AITodoStatus = (typeof TODO_STATUSES)[number];
10532
10535
  /**
10533
- * - `placeholder`: the editor shows a configurable placeholder
10534
- * - `searchable` / `sortable` / `groupable`: the query surfaces it offers
10535
- * - `content`: a body read whole (rich text, files), not a table cell
10536
- * - `qualified`: its edges may carry qualified properties
10536
+ * Todo item in a task list
10537
10537
  */
10538
- export type AttributeTypeTrait = "placeholder" | "searchable" | "sortable" | "groupable" | "content" | "qualified";
10539
- export interface AttributeTypeDescriptor {
10540
- readonly value: AttributeValueKind;
10541
- readonly traits: readonly AttributeTypeTrait[];
10538
+ export interface AITodoItem {
10539
+ id: string;
10540
+ description: string;
10541
+ status: AITodoStatus;
10542
+ updatedAt?: number;
10543
+ /**
10544
+ * What an architect build todo is anchored on in the draft. A targeted
10545
+ * todo's status is the server's: `draft_schema` recomputes it from the
10546
+ * folded draft, and `write_todos` keeps the stored one.
10547
+ */
10548
+ target?: AITodoTarget;
10542
10549
  }
10543
10550
  /**
10544
- * The one per-type registry: a new attribute type cannot be added without
10545
- * deciding each of these. Rich text is searched as plain words (the search
10546
- * adapter strips its markdown).
10551
+ * The phases of an architect build, always worked in this order: a plan
10552
+ * whose targeted todos run out of this order is refused.
10547
10553
  */
10548
- export declare const ATTRIBUTE_TYPE_DESCRIPTORS: {
10549
- readonly text: {
10550
- readonly value: "plain";
10551
- readonly traits: readonly ["placeholder", "searchable", "sortable"];
10552
- };
10553
- readonly richtext: {
10554
- readonly value: "plain";
10555
- readonly traits: readonly ["searchable", "content"];
10556
- };
10557
- readonly number: {
10558
- readonly value: "plain";
10559
- readonly traits: readonly ["placeholder", "sortable"];
10560
- };
10561
- readonly checkbox: {
10562
- readonly value: "boolean";
10563
- readonly traits: readonly ["sortable"];
10564
- };
10565
- readonly date: {
10566
- readonly value: "plain";
10567
- readonly traits: readonly ["placeholder", "sortable"];
10568
- };
10569
- readonly phone: {
10570
- readonly value: "plain";
10571
- readonly traits: readonly ["placeholder", "searchable", "sortable"];
10572
- };
10573
- readonly currency: {
10574
- readonly value: "plain";
10575
- readonly traits: readonly ["placeholder", "sortable", "groupable"];
10576
- };
10577
- readonly status: {
10578
- readonly value: "options";
10579
- readonly traits: readonly ["searchable", "sortable", "groupable"];
10580
- };
10581
- readonly location: {
10582
- readonly value: "plain";
10583
- readonly traits: readonly [];
10584
- };
10585
- readonly select: {
10586
- readonly value: "options";
10587
- readonly traits: readonly ["placeholder", "searchable", "sortable"];
10588
- };
10589
- readonly multiselect: {
10590
- readonly value: "options";
10591
- readonly traits: readonly ["placeholder", "searchable"];
10592
- };
10593
- readonly user: {
10594
- readonly value: "reference";
10595
- readonly traits: readonly [];
10596
- };
10597
- readonly relation: {
10598
- readonly value: "reference";
10599
- readonly traits: readonly ["qualified"];
10600
- };
10601
- readonly formula: {
10602
- readonly value: "computed";
10603
- readonly traits: readonly [];
10604
- };
10605
- readonly rollup: {
10606
- readonly value: "computed";
10607
- readonly traits: readonly [];
10608
- };
10609
- readonly document: {
10610
- readonly value: "reference";
10611
- readonly traits: readonly ["content", "qualified"];
10612
- };
10613
- };
10614
- /** The attribute types whose value is of `kind`, as a literal union. */
10615
- export type AttributeTypeOfKind<K extends AttributeValueKind> = { [T in AttributeType]: (typeof ATTRIBUTE_TYPE_DESCRIPTORS)[T]["value"] extends K ? T : never; }[AttributeType];
10616
- /** Whether `type`'s value is of `kind` (`"computed"`: formula and rollup). */
10617
- export declare function isValueKindType<K extends AttributeValueKind>(type: string, kind: K): type is AttributeTypeOfKind<K>;
10618
- /** Whether `attribute`'s value is of `kind`, narrowing it to the matching attribute types. */
10619
- export declare function hasValueKind<A extends {
10620
- type: string;
10621
- }, K extends AttributeValueKind>(attribute: A, kind: K): attribute is A & {
10622
- type: AttributeTypeOfKind<K>;
10554
+ export declare const TODO_PHASES: readonly ["objects", "fields", "relations", "views", "samples"];
10555
+ export type AITodoPhase = (typeof TODO_PHASES)[number];
10556
+ /** Where a build todo is anchored, by phase. */
10557
+ export type AITodoTarget =
10558
+ /** Completed when the folded draft has the object. */
10559
+ {
10560
+ phase: "objects";
10561
+ objectName: string;
10562
+ } |
10563
+ /** Completed when every named attribute is on the object. */
10564
+ {
10565
+ phase: "fields";
10566
+ objectName: string;
10567
+ attributes: string[];
10568
+ } |
10569
+ /** Completed when every named relation attribute is on the object. */
10570
+ {
10571
+ phase: "relations";
10572
+ objectName: string;
10573
+ attributes: string[];
10574
+ } |
10575
+ /**
10576
+ * Completed when an executed operation of the draft writes that view (and,
10577
+ * when named, that content). The empty default views `add_object` folds do
10578
+ * not count, nor does a view that is merely published.
10579
+ */
10580
+ {
10581
+ phase: "views";
10582
+ objectName: string;
10583
+ viewName: string;
10584
+ contentName?: string;
10585
+ } | {
10586
+ phase: "views";
10587
+ pageId: string;
10588
+ } |
10589
+ /** Completed when the draft holds at least one sample record of the object. */
10590
+ {
10591
+ phase: "samples";
10592
+ objectName: string;
10623
10593
  };
10624
- /** Whether `type` carries `trait`. */
10625
- export declare function hasTypeTrait(type: string, trait: AttributeTypeTrait): boolean;
10626
- export declare function getAttributeCapabilities(attribute: AttributeLike): AttributeCapabilities;
10627
- export declare function getAttributeFilterOperators(attribute: AttributeLike): readonly FilterOperator[];
10628
- export declare function isAttributeFilterable(attribute: AttributeLike): boolean;
10629
- export declare function isAttributeSearchable(attribute: AttributeLike): boolean;
10630
- export declare function isAttributeGroupable(attribute: AttributeLike): boolean;
10631
- export declare function isAttributeKanbanGroupable(attribute: AttributeLike): boolean;
10632
10594
  /**
10633
- * The type a filter on this attribute actually compares against. Identity for
10634
- * every ordinary attribute; for a rollup it unfolds the aggregation:
10635
- * `earliest`/`latest` compare dates, `original` compares the target attribute's
10636
- * own type, and every other function (count/sum/avg/min/max/…) compares numbers.
10595
+ * A todo as clients read it: a target is exposed by its phase, which the
10596
+ * progress surfaces read, and by its object when it names one, which picks the
10597
+ * builder the cursor follows (R17).
10598
+ */
10599
+ export interface AgentTodoPlanViewItem extends Omit<AITodoItem, "target"> {
10600
+ target?: {
10601
+ phase: AITodoPhase;
10602
+ objectName?: string;
10603
+ };
10604
+ }
10605
+ /**
10606
+ * Persisted bounds on a todo, beside the type they constrain.
10637
10607
  *
10638
- * This is the single place that knowledge lives: operator resolution and value
10639
- * canonicalization both read it, so a rollup can never be offered numeric
10640
- * operators while its value is canonicalized as something else.
10608
+ * Both sides of the wire enforce them: the runtime zod schema when it writes,
10609
+ * and the React projection parser when it reads an untrusted payload back.
10610
+ * React cannot import the runtime, which is why these numbers used to be
10611
+ * copied there under a "keep aligned with the canonical persisted schema"
10612
+ * comment — a synchronisation the compiler could not check.
10641
10613
  */
10642
- export declare function resolveEffectiveFilterType(attribute: AttributeLike): AttributeType;
10643
- export declare const DOCUMENT_KINDS: readonly ["file", "folder"];
10644
- export type DocumentKind = (typeof DOCUMENT_KINDS)[number];
10645
- export declare const documentSchema: z$2.ZodObject<{
10646
- id: z$2.ZodString;
10647
- tenantId: z$2.ZodString;
10648
- title: z$2.ZodString;
10649
- kind: z$2.ZodEnum<{
10650
- file: "file";
10651
- folder: "folder";
10652
- }>;
10653
- parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10654
- description: z$2.ZodOptional<z$2.ZodString>;
10655
- contentHash: z$2.ZodOptional<z$2.ZodString>;
10656
- createdBy: z$2.ZodOptional<z$2.ZodString>;
10657
- updatedBy: z$2.ZodOptional<z$2.ZodString>;
10658
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
10659
- position: z$2.ZodNumber;
10660
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10661
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10662
- }, z$2.core.$strip>;
10663
- export type Document = z$2.output<typeof documentSchema>;
10664
- export declare const documentWithSubCountSchema: z$2.ZodObject<{
10665
- id: z$2.ZodString;
10666
- tenantId: z$2.ZodString;
10667
- title: z$2.ZodString;
10668
- kind: z$2.ZodEnum<{
10669
- file: "file";
10670
- folder: "folder";
10671
- }>;
10672
- parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10673
- description: z$2.ZodOptional<z$2.ZodString>;
10674
- contentHash: z$2.ZodOptional<z$2.ZodString>;
10675
- createdBy: z$2.ZodOptional<z$2.ZodString>;
10676
- updatedBy: z$2.ZodOptional<z$2.ZodString>;
10677
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
10678
- position: z$2.ZodNumber;
10679
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10680
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10681
- subCount: z$2.ZodNullable<z$2.ZodNumber>;
10682
- }, z$2.core.$strip>;
10683
- export type DocumentWithSubCount = z$2.output<typeof documentWithSubCountSchema>;
10614
+ export declare const MAX_TODOS = 50;
10615
+ export declare const MAX_TODO_ID_CHARS = 80;
10616
+ export declare const MAX_TODO_DESCRIPTION_CHARS = 500;
10684
10617
  /**
10685
- * One hit of a drive-wide name search: a folder or a file of the record's
10686
- * drive whose title contains the query, with the path that places it. The
10687
- * walk is the agent tool's (`listRecordDrive` in query mode); this is what
10688
- * the open-drive loupe reads (#3217).
10618
+ * Todo list managed by the agent
10689
10619
  */
10690
- export declare const recordDriveSearchHitSchema: z$2.ZodObject<{
10691
- id: z$2.ZodString;
10692
- kind: z$2.ZodEnum<{
10693
- file: "file";
10694
- folder: "folder";
10695
- }>;
10696
- title: z$2.ZodString;
10697
- path: z$2.ZodString;
10698
- parentId: z$2.ZodNullable<z$2.ZodString>;
10699
- depth: z$2.ZodNumber;
10700
- }, z$2.core.$strip>;
10701
- export type RecordDriveSearchHit = z$2.output<typeof recordDriveSearchHitSchema>;
10702
- export declare const recordDriveSearchResultSchema: z$2.ZodObject<{
10703
- recordId: z$2.ZodString;
10704
- hits: z$2.ZodArray<z$2.ZodObject<{
10705
- id: z$2.ZodString;
10706
- kind: z$2.ZodEnum<{
10707
- file: "file";
10708
- folder: "folder";
10709
- }>;
10710
- title: z$2.ZodString;
10711
- path: z$2.ZodString;
10712
- parentId: z$2.ZodNullable<z$2.ZodString>;
10713
- depth: z$2.ZodNumber;
10714
- }, z$2.core.$strip>>;
10715
- truncated: z$2.ZodOptional<z$2.ZodObject<{
10716
- maxEntries: z$2.ZodNumber;
10717
- returnedEntries: z$2.ZodNumber;
10718
- }, z$2.core.$strip>>;
10719
- }, z$2.core.$strip>;
10720
- export type RecordDriveSearchResult = z$2.output<typeof recordDriveSearchResultSchema>;
10620
+ export interface AITodoList {
10621
+ items: AITodoItem[];
10622
+ progress: number;
10623
+ isComplete: boolean;
10624
+ }
10721
10625
  /**
10722
- * Text-extraction lifecycle for a single file within a document pack.
10723
- * `unsupported` is terminal and is not a failure: the file's type has no text
10724
- * to extract (an Outlook `.msg`, a `.docx`, a `.zip`), so nothing is queued.
10626
+ * Compaction summary for conversation history compression
10725
10627
  */
10726
- export declare const FILE_OCR_STATUSES: readonly ["pending", "processing", "completed", "failed", "unsupported"];
10727
- export type FileOcrStatus = (typeof FILE_OCR_STATUSES)[number];
10628
+ export interface AICompactionSummary {
10629
+ id: string;
10630
+ tenantId: string;
10631
+ userId: string;
10632
+ conversationId: string;
10633
+ summary: string;
10634
+ originalMessageCount: number;
10635
+ tokenCountBefore: number;
10636
+ tokenCountAfter: number;
10637
+ compactedAt: Date;
10638
+ }
10639
+ /** Create-response metadata; these grants were added by this transaction, not prior grants. */
10640
+ export type CreateAgentTriggerResult = z$1.output<typeof createAgentTriggerResultSchema>;
10728
10641
  /**
10729
- * A single anonymous file belonging to a document pack.
10730
- * Unlike the slot-based model, files carry no slot name — order within the
10731
- * pack is `position` only, and `name` is provenance (originalName), never a
10732
- * label rendered in the UI.
10642
+ * The device channel wire protocol, shared by the API server and the CLI
10643
+ * shell worker. The server only ever emits `capability: "shell"` and
10644
+ * `kind: "shell"`; the enums keep `"browser"` for one more release because
10645
+ * every installed CLI parses these frames strictly against that enum.
10733
10646
  */
10734
- export declare const documentFileSchema: z$2.ZodObject<{
10735
- id: z$2.ZodString;
10736
- documentId: z$2.ZodString;
10737
- position: z$2.ZodNumber;
10738
- name: z$2.ZodString;
10739
- mimeType: z$2.ZodString;
10740
- size: z$2.ZodNumber;
10741
- ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
10742
- completed: "completed";
10743
- failed: "failed";
10744
- pending: "pending";
10745
- processing: "processing";
10746
- unsupported: "unsupported";
10747
- }>>;
10748
- ocrText: z$2.ZodNullable<z$2.ZodString>;
10749
- ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
10750
- processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
10751
- }, z$2.core.$strip>;
10752
- export type DocumentFile = z$2.output<typeof documentFileSchema>;
10753
- /** What an attach did: a new pack, a file appended to a named pack, or the pack already holding the file linked. */
10754
- export declare const ATTACH_FILE_ACTIONS: readonly ["created", "appended", "linked-existing"];
10755
- export type AttachFileAction = (typeof ATTACH_FILE_ACTIONS)[number];
10756
- /** What attaching a file to a record's document attribute answers: the pack, the file in it, and what happened. */
10757
- export declare const attachedRecordDocumentSchema: z$2.ZodObject<{
10758
- document: z$2.ZodObject<{
10759
- id: z$2.ZodString;
10760
- tenantId: z$2.ZodString;
10761
- title: z$2.ZodString;
10762
- kind: z$2.ZodEnum<{
10763
- file: "file";
10764
- folder: "folder";
10647
+ /** Absolute path of the channel on the API origin (the `/v1` prefix included). */
10648
+ export declare const DEVICE_CHANNEL_PATH = "/v1/device-worker/channel";
10649
+ export declare const DEVICE_CHANNEL_MAX_FRAME_BYTES = 262144;
10650
+ /** A socket that has not sent `authenticate` within this budget is closed 1008. */
10651
+ export declare const DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS = 10000;
10652
+ /** The server leases the next queued command from the store on this cadence while idle. */
10653
+ export declare const DEVICE_CHANNEL_IDLE_POLL_MS = 2000;
10654
+ /** The server re-validates the credential and refreshes presence on this cadence. */
10655
+ export declare const DEVICE_CHANNEL_PRESENCE_MS = 2000;
10656
+ /**
10657
+ * The server sends `{ type: "ping" }` plus a control ping on this cadence; a
10658
+ * socket that has not answered the control ping by the next tick is dropped.
10659
+ */
10660
+ export declare const DEVICE_CHANNEL_KEEPALIVE_MS = 20000;
10661
+ /**
10662
+ * The code a worker closes with when a frame breaks the protocol. A browser
10663
+ * `WebSocket` only accepts 1000 and 3000-4999, so the private-use mirror of
10664
+ * 1008 is the one code every worker can actually send.
10665
+ */
10666
+ export declare const DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION = 4008;
10667
+ /** Where an exponential backoff starts, and where it stops doubling. */
10668
+ export interface RetryBounds {
10669
+ initialMs: number;
10670
+ maxMs: number;
10671
+ }
10672
+ /**
10673
+ * Where the channel is: the path is absolute on the API origin, so a profile's
10674
+ * `apiUrl` keeps only its host and the scheme swaps to the socket one. Written
10675
+ * as an explicit map rather than a rewrite of the origin string, because a
10676
+ * two-letter scheme literal reads to the SDK's egress scan as the `ws` package.
10677
+ */
10678
+ export declare function deviceChannelUrl(apiUrl: string): string;
10679
+ /** Exponential backoff within the given bounds, plus the shared jitter window. */
10680
+ export declare function computeRetryDelay(attempt: number, random: () => number, bounds: RetryBounds): number;
10681
+ /** When to reconnect to the channel: 1 s doubling up to 30 s, plus jitter. */
10682
+ export declare function computeReconnectDelay(attempt: number, random?: () => number): number;
10683
+ export declare const DEVICE_COMMAND_ERROR_CODES: readonly ["worker_disconnected", "cancelled", "timed_out", "execution_failed"];
10684
+ export type DeviceCommandErrorCode = (typeof DEVICE_COMMAND_ERROR_CODES)[number];
10685
+ export declare class DeviceChannelProtocolError extends SchemaError {
10686
+ readonly _tag = "DeviceChannelProtocolError";
10687
+ constructor(message: string);
10688
+ }
10689
+ /** The shells a worker can open a session in; announced at `authenticate`. */
10690
+ export declare const DEVICE_SHELLS: readonly ["zsh", "bash", "sh", "fish", "pwsh", "powershell"];
10691
+ export type DeviceShell = (typeof DEVICE_SHELLS)[number];
10692
+ /** Whether the machine can drive its desktop through `agent-desktop`. */
10693
+ export declare const DEVICE_DESKTOP_STATES: readonly ["ready", "permission_missing", "no_session", "unavailable"];
10694
+ export type DeviceDesktopState = (typeof DEVICE_DESKTOP_STATES)[number];
10695
+ export declare const DeviceDesktopStatusSchema: z$2.ZodObject<{
10696
+ state: z$2.ZodEnum<{
10697
+ no_session: "no_session";
10698
+ permission_missing: "permission_missing";
10699
+ ready: "ready";
10700
+ unavailable: "unavailable";
10701
+ }>;
10702
+ version: z$2.ZodString;
10703
+ }, z$2.core.$strict>;
10704
+ export type DeviceDesktopStatus = z$2.infer<typeof DeviceDesktopStatusSchema>;
10705
+ export declare const DeviceChannelWorkerFrameSchema: z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
10706
+ type: z$2.ZodLiteral<"authenticate">;
10707
+ credential: z$2.ZodString;
10708
+ protocol: z$2.ZodOptional<z$2.ZodNumber>;
10709
+ desktop: z$2.ZodOptional<z$2.ZodObject<{
10710
+ state: z$2.ZodEnum<{
10711
+ no_session: "no_session";
10712
+ permission_missing: "permission_missing";
10713
+ ready: "ready";
10714
+ unavailable: "unavailable";
10765
10715
  }>;
10766
- parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10767
- description: z$2.ZodOptional<z$2.ZodString>;
10768
- contentHash: z$2.ZodOptional<z$2.ZodString>;
10769
- createdBy: z$2.ZodOptional<z$2.ZodString>;
10770
- updatedBy: z$2.ZodOptional<z$2.ZodString>;
10771
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
10772
- position: z$2.ZodNumber;
10773
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10774
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10775
- }, z$2.core.$strip>;
10776
- file: z$2.ZodObject<{
10716
+ version: z$2.ZodString;
10717
+ }, z$2.core.$strict>>;
10718
+ shell: z$2.ZodOptional<z$2.ZodEnum<{
10719
+ bash: "bash";
10720
+ fish: "fish";
10721
+ powershell: "powershell";
10722
+ pwsh: "pwsh";
10723
+ sh: "sh";
10724
+ zsh: "zsh";
10725
+ }>>;
10726
+ }, z$2.core.$strict>, z$2.ZodObject<{
10727
+ id: z$2.ZodUUID;
10728
+ leaseToken: z$2.ZodString;
10729
+ type: z$2.ZodLiteral<"running">;
10730
+ }, z$2.core.$strict>, z$2.ZodObject<{
10731
+ id: z$2.ZodUUID;
10732
+ leaseToken: z$2.ZodString;
10733
+ type: z$2.ZodLiteral<"heartbeat">;
10734
+ }, z$2.core.$strict>, z$2.ZodObject<{
10735
+ id: z$2.ZodUUID;
10736
+ leaseToken: z$2.ZodString;
10737
+ type: z$2.ZodLiteral<"output">;
10738
+ stdout: z$2.ZodOptional<z$2.ZodString>;
10739
+ stderr: z$2.ZodOptional<z$2.ZodString>;
10740
+ }, z$2.core.$strict>, z$2.ZodObject<{
10741
+ id: z$2.ZodUUID;
10742
+ leaseToken: z$2.ZodString;
10743
+ type: z$2.ZodLiteral<"complete">;
10744
+ result: z$2.ZodObject<{
10745
+ stdout: z$2.ZodOptional<z$2.ZodString>;
10746
+ stderr: z$2.ZodOptional<z$2.ZodString>;
10747
+ exitCode: z$2.ZodNumber;
10748
+ success: z$2.ZodBoolean;
10749
+ errorCode: z$2.ZodOptional<z$2.ZodEnum<{
10750
+ cancelled: "cancelled";
10751
+ execution_failed: "execution_failed";
10752
+ timed_out: "timed_out";
10753
+ worker_disconnected: "worker_disconnected";
10754
+ }>>;
10755
+ }, z$2.core.$strict>;
10756
+ background: z$2.ZodOptional<z$2.ZodObject<{
10757
+ pid: z$2.ZodNumber;
10758
+ logPath: z$2.ZodString;
10759
+ }, z$2.core.$strict>>;
10760
+ }, z$2.core.$strict>, z$2.ZodObject<{
10761
+ type: z$2.ZodLiteral<"pong">;
10762
+ }, z$2.core.$strict>], "type">;
10763
+ export declare const DeviceChannelServerFrameSchema: z$2.ZodDiscriminatedUnion<[z$2.ZodObject<{
10764
+ type: z$2.ZodLiteral<"ready">;
10765
+ device: z$2.ZodObject<{
10777
10766
  id: z$2.ZodString;
10778
- documentId: z$2.ZodString;
10779
- position: z$2.ZodNumber;
10780
10767
  name: z$2.ZodString;
10781
- mimeType: z$2.ZodString;
10782
- size: z$2.ZodNumber;
10783
- ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
10784
- completed: "completed";
10785
- failed: "failed";
10786
- pending: "pending";
10787
- processing: "processing";
10788
- unsupported: "unsupported";
10789
- }>>;
10790
- ocrText: z$2.ZodNullable<z$2.ZodString>;
10791
- ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
10792
- processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
10793
- }, z$2.core.$strip>;
10794
- action: z$2.ZodEnum<{
10795
- appended: "appended";
10796
- created: "created";
10797
- "linked-existing": "linked-existing";
10768
+ capability: z$2.ZodEnum<{
10769
+ browser: "browser";
10770
+ shell: "shell";
10771
+ }>;
10772
+ }, z$2.core.$strict>;
10773
+ protocol: z$2.ZodOptional<z$2.ZodNumber>;
10774
+ }, z$2.core.$strict>, z$2.ZodObject<{
10775
+ id: z$2.ZodUUID;
10776
+ leaseToken: z$2.ZodString;
10777
+ type: z$2.ZodLiteral<"command">;
10778
+ kind: z$2.ZodEnum<{
10779
+ browser: "browser";
10780
+ shell: "shell";
10798
10781
  }>;
10799
- }, z$2.core.$strip>;
10800
- /** A pack file as a drive row lists it: everything but its OCR text, which only reads need. */
10801
- export declare const driveFileSchema: z$2.ZodObject<{
10802
- id: z$2.ZodString;
10803
- documentId: z$2.ZodString;
10804
- position: z$2.ZodNumber;
10805
- name: z$2.ZodString;
10806
- mimeType: z$2.ZodString;
10807
- size: z$2.ZodNumber;
10808
- ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
10809
- completed: "completed";
10810
- failed: "failed";
10811
- pending: "pending";
10812
- processing: "processing";
10813
- unsupported: "unsupported";
10814
- }>>;
10815
- ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
10816
- processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
10817
- }, z$2.core.$strip>;
10818
- export type DriveFile = z$2.output<typeof driveFileSchema>;
10819
- export type DocumentWithFiles = Document & {
10820
- files: DocumentFile[];
10821
- };
10782
+ intent: z$2.ZodString;
10783
+ timeoutMs: z$2.ZodNumber;
10784
+ command: z$2.ZodOptional<z$2.ZodString>;
10785
+ cwd: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10786
+ rootSessionId: z$2.ZodOptional<z$2.ZodString>;
10787
+ background: z$2.ZodOptional<z$2.ZodBoolean>;
10788
+ }, z$2.core.$strict>, z$2.ZodObject<{
10789
+ type: z$2.ZodLiteral<"release_session">;
10790
+ rootSessionId: z$2.ZodString;
10791
+ }, z$2.core.$strict>, z$2.ZodObject<{
10792
+ type: z$2.ZodLiteral<"cancel">;
10793
+ id: z$2.ZodUUID;
10794
+ reason: z$2.ZodEnum<{
10795
+ cancelled: "cancelled";
10796
+ revoked: "revoked";
10797
+ timed_out: "timed_out";
10798
+ }>;
10799
+ }, z$2.core.$strict>, z$2.ZodObject<{
10800
+ type: z$2.ZodLiteral<"reauthenticate">;
10801
+ }, z$2.core.$strict>, z$2.ZodObject<{
10802
+ type: z$2.ZodLiteral<"revoked">;
10803
+ }, z$2.core.$strict>, z$2.ZodObject<{
10804
+ type: z$2.ZodLiteral<"ping">;
10805
+ }, z$2.core.$strict>], "type">;
10806
+ export type DeviceChannelWorkerFrame = z$2.infer<typeof DeviceChannelWorkerFrameSchema>;
10807
+ export type DeviceChannelServerFrame = z$2.infer<typeof DeviceChannelServerFrameSchema>;
10808
+ /** Parses one text frame; a non-JSON or off-protocol frame is a `DeviceChannelProtocolError`. */
10809
+ export declare function parseDeviceChannelFrame<T>(schema: z$2.ZodType<T>, raw: string): T;
10810
+ export declare function parseWorkerFrame(raw: string): DeviceChannelWorkerFrame;
10811
+ export declare function parseServerFrame(raw: string): DeviceChannelServerFrame;
10822
10812
  /**
10823
- * One row of a record's drive at a given level: the document with its sub
10824
- * count and its pack files (#4332). A drive-only attachment, one that exists
10825
- * only as a reference edge and is named nowhere in `record.values`, has no
10826
- * other source for its files, and without them its row menu cannot offer
10827
- * Download. A folder has no pack: its `files` is always `[]`.
10828
- *
10829
- * A root-level child also names where it sits on the record: the document
10830
- * attribute whose edge holds it (`attachments` for a plain drive item) and
10831
- * that edge's qualified properties. A nested child has no edge of its own and
10832
- * carries neither.
10813
+ * The minimum every capability predicate in this file reads: the type, plus
10814
+ * whatever else of a full `Attribute` the caller happens to hold. Exported so
10815
+ * callers that only have a partial attribute — a plan's proposed attribute, a
10816
+ * schema snapshot row — can ask the same questions as callers holding the real
10817
+ * thing, instead of restating the rules.
10833
10818
  */
10834
- export declare const recordDriveChildSchema: z$2.ZodObject<{
10835
- id: z$2.ZodString;
10836
- tenantId: z$2.ZodString;
10837
- title: z$2.ZodString;
10838
- kind: z$2.ZodEnum<{
10839
- file: "file";
10840
- folder: "folder";
10841
- }>;
10842
- parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10843
- description: z$2.ZodOptional<z$2.ZodString>;
10844
- contentHash: z$2.ZodOptional<z$2.ZodString>;
10845
- createdBy: z$2.ZodOptional<z$2.ZodString>;
10846
- updatedBy: z$2.ZodOptional<z$2.ZodString>;
10847
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
10848
- position: z$2.ZodNumber;
10849
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10850
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10851
- subCount: z$2.ZodNullable<z$2.ZodNumber>;
10852
- files: z$2.ZodArray<z$2.ZodObject<{
10853
- id: z$2.ZodString;
10854
- documentId: z$2.ZodString;
10855
- position: z$2.ZodNumber;
10856
- name: z$2.ZodString;
10857
- mimeType: z$2.ZodString;
10858
- size: z$2.ZodNumber;
10859
- ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
10860
- completed: "completed";
10861
- failed: "failed";
10862
- pending: "pending";
10863
- processing: "processing";
10864
- unsupported: "unsupported";
10865
- }>>;
10866
- ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
10867
- processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
10868
- }, z$2.core.$strip>>;
10869
- attributeName: z$2.ZodOptional<z$2.ZodString>;
10870
- properties: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>>;
10871
- }, z$2.core.$strip>;
10872
- export type RecordDriveChild = z$2.output<typeof recordDriveChildSchema>;
10819
+ export type AttributeLike = Pick<Attribute, "type"> & Partial<Attribute>;
10820
+ export type AttributeLifecycleCapabilities = {
10821
+ active: boolean;
10822
+ deprecated: boolean;
10823
+ visibleInArchitect: boolean;
10824
+ visibleInRuntime: boolean;
10825
+ warningWhenDeprecated: boolean;
10826
+ };
10827
+ export type AttributeStorageMode = "value" | "edge" | "computed";
10828
+ export type AttributeCardinality = "one" | "many";
10829
+ export type AttributePolymorphicCapability = "none" | "code-only" | "internal";
10830
+ export type AttributeStorageCapabilities = {
10831
+ mode: AttributeStorageMode;
10832
+ cardinality: AttributeCardinality;
10833
+ edgeBacked: boolean;
10834
+ preservesExistingValues: boolean;
10835
+ qualifiedProperties: boolean;
10836
+ polymorphic: AttributePolymorphicCapability;
10837
+ maxItems: boolean;
10838
+ };
10839
+ export type AttributeRequiredCapability = "allowed" | "forbidden";
10840
+ export type AttributeDefaultValueCapability = "static" | "automatic" | "forbidden";
10841
+ export type AttributeAuthoringCapabilities = {
10842
+ editable: boolean;
10843
+ readOnly: boolean;
10844
+ directEdit: boolean;
10845
+ required: AttributeRequiredCapability;
10846
+ defaultValue: AttributeDefaultValueCapability;
10847
+ placeholder: boolean;
10848
+ maxItems: boolean;
10849
+ };
10850
+ export type AttributePresentationCapabilities = {
10851
+ formField: boolean;
10852
+ tableCell: boolean;
10853
+ defaultColumn: boolean;
10854
+ compactDisplay: boolean;
10855
+ popoverEditor: boolean;
10856
+ placeholder: boolean;
10857
+ warningWhenDeprecated: boolean;
10858
+ };
10859
+ export type AttributeQueryCapabilities = {
10860
+ filterable: boolean;
10861
+ searchable: boolean;
10862
+ sortable: boolean;
10863
+ groupable: boolean;
10864
+ kanbanGroupable: boolean;
10865
+ operators: readonly FilterOperator[];
10866
+ };
10867
+ export type AttributeAgentCapabilities = {
10868
+ readable: boolean;
10869
+ writable: boolean;
10870
+ compactReadable: boolean;
10871
+ contentReadable: boolean;
10872
+ requiresDedicatedTool: boolean;
10873
+ };
10874
+ export type AttributeExchangeCapabilities = {
10875
+ importable: boolean;
10876
+ exportable: boolean;
10877
+ schemaExportable: boolean;
10878
+ metadataExportable: boolean;
10879
+ };
10880
+ export type AttributeCapabilities = {
10881
+ lifecycle: AttributeLifecycleCapabilities;
10882
+ storage: AttributeStorageCapabilities;
10883
+ authoring: AttributeAuthoringCapabilities;
10884
+ presentation: AttributePresentationCapabilities;
10885
+ query: AttributeQueryCapabilities;
10886
+ agent: AttributeAgentCapabilities;
10887
+ exchange: AttributeExchangeCapabilities;
10888
+ };
10873
10889
  /**
10874
- * The orders a drive level is listed in. Every mode puts folders before
10875
- * files, then sorts on its key, then on `id`:
10876
- * - `manual`: `position` (the drag order);
10877
- * - `name-asc` / `name-desc`: the title, numeric and case- and
10878
- * accent-insensitive ("File 2" before "file 10", "Éa" equal to "ea");
10879
- * - `date-desc` / `date-asc`: `updatedAt ?? createdAt` to the millisecond,
10880
- * a row with neither last in both directions.
10881
- * The `id` tiebreak is ascending in every mode.
10890
+ * The parts of a location a filter may address (#3118). A location is a
10891
+ * JSONB object with no operators of its own; a rule names one of these parts
10892
+ * through `property` and compares it as text — `country` holds the ISO3 code.
10882
10893
  */
10883
- export declare const DOCUMENT_SORT_MODES: readonly ["manual", "name-asc", "name-desc", "date-desc", "date-asc"];
10884
- export type DocumentSortMode = (typeof DOCUMENT_SORT_MODES)[number];
10885
- /** Rows in a page of a drive level when the caller names no `limit`. */
10886
- export declare const RECORD_DRIVE_PAGE_DEFAULT_LIMIT = 100;
10887
- /** The most rows one page of a drive level holds; a larger `limit` is clamped. */
10888
- export declare const RECORD_DRIVE_PAGE_MAX_LIMIT = 500;
10894
+ export declare const LOCATION_FILTER_PROPERTIES: readonly ["city", "postalCode", "country"];
10895
+ export type LocationFilterProperty = (typeof LOCATION_FILTER_PROPERTIES)[number];
10896
+ export declare function isLocationFilterProperty(name: string): name is LocationFilterProperty;
10897
+ export declare const ATTRIBUTE_FILTER_OPERATORS: Readonly<Record<Exclude<AttributeType, "rollup">, readonly FilterOperator[]>>;
10889
10898
  /**
10890
- * The longest drive page cursor read back. An issued cursor carries one title
10891
- * (at most 255 characters) plus a few short fields; anything longer is crafted.
10899
+ * What an attribute type's value is — the per-type fact most rules branch on:
10900
+ * - `plain`: typed in by hand (text, number, date, phone, currency, location)
10901
+ * - `boolean`: a checkbox, always true or false, never empty
10902
+ * - `options`: a code (or codes) from the attribute's own `options`
10903
+ * - `reference`: ids of users, records or files, stored as edges
10904
+ * - `computed`: derived from other values (formula, rollup), never written
10892
10905
  */
10893
- export declare const RECORD_DRIVE_CURSOR_MAX_LENGTH = 2048;
10906
+ export type AttributeValueKind = "plain" | "boolean" | "options" | "reference" | "computed";
10894
10907
  /**
10895
- * One page of a record's drive level (#4985), in its sort mode's order.
10896
- * `nextCursor` resumes strictly after the page's last row, and is `null` on
10897
- * the last page. A cursor is opaque and only valid for the mode that issued it.
10908
+ * - `placeholder`: the editor shows a configurable placeholder
10909
+ * - `searchable` / `sortable` / `groupable`: the query surfaces it offers
10910
+ * - `content`: a body read whole (rich text, files), not a table cell
10911
+ * - `qualified`: its edges may carry qualified properties
10898
10912
  */
10899
- export declare const recordDriveChildrenPageSchema: z$2.ZodObject<{
10900
- items: z$2.ZodArray<z$2.ZodObject<{
10901
- id: z$2.ZodString;
10902
- tenantId: z$2.ZodString;
10903
- title: z$2.ZodString;
10904
- kind: z$2.ZodEnum<{
10905
- file: "file";
10906
- folder: "folder";
10907
- }>;
10908
- parentId: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodString>>;
10909
- description: z$2.ZodOptional<z$2.ZodString>;
10910
- contentHash: z$2.ZodOptional<z$2.ZodString>;
10911
- createdBy: z$2.ZodOptional<z$2.ZodString>;
10912
- updatedBy: z$2.ZodOptional<z$2.ZodString>;
10913
- deletedAt: z$2.ZodOptional<z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>>;
10914
- position: z$2.ZodNumber;
10915
- createdAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10916
- updatedAt: z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>;
10917
- subCount: z$2.ZodNullable<z$2.ZodNumber>;
10918
- files: z$2.ZodArray<z$2.ZodObject<{
10919
- id: z$2.ZodString;
10920
- documentId: z$2.ZodString;
10921
- position: z$2.ZodNumber;
10922
- name: z$2.ZodString;
10923
- mimeType: z$2.ZodString;
10924
- size: z$2.ZodNumber;
10925
- ocrStatus: z$2.ZodNullable<z$2.ZodEnum<{
10926
- completed: "completed";
10927
- failed: "failed";
10928
- pending: "pending";
10929
- processing: "processing";
10930
- unsupported: "unsupported";
10931
- }>>;
10932
- ocrConfidence: z$2.ZodNullable<z$2.ZodNumber>;
10933
- processedAt: z$2.ZodNullable<z$2.ZodCodec<z$2.ZodISODateTime, z$2.ZodDate>>;
10934
- }, z$2.core.$strip>>;
10935
- attributeName: z$2.ZodOptional<z$2.ZodString>;
10936
- properties: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>>;
10937
- }, z$2.core.$strip>>;
10938
- nextCursor: z$2.ZodNullable<z$2.ZodString>;
10939
- }, z$2.core.$strip>;
10940
- export type RecordDriveChildrenPage = z$2.output<typeof recordDriveChildrenPageSchema>;
10941
- export interface CreateDocument {
10942
- title: string;
10943
- kind?: DocumentKind;
10944
- parentId?: Uuid | null;
10945
- description?: string;
10946
- position?: number;
10913
+ export type AttributeTypeTrait = "placeholder" | "searchable" | "sortable" | "groupable" | "content" | "qualified";
10914
+ export interface AttributeTypeDescriptor {
10915
+ readonly value: AttributeValueKind;
10916
+ readonly traits: readonly AttributeTypeTrait[];
10947
10917
  }
10948
10918
  /**
10949
- * Reference to a record attribute that should atomically attach a freshly
10950
- * created Document. Passed alongside `CreateDocument` to make creation
10951
- * link-aware end-to-end (client → REST → service → repo).
10952
- *
10953
- * The server requires this — orphan Documents are not creatable through the
10954
- * REST API.
10919
+ * The one per-type registry: a new attribute type cannot be added without
10920
+ * deciding each of these. Rich text is searched as plain words (the search
10921
+ * adapter strips its markdown).
10955
10922
  */
10956
- export interface CreateDocumentLink {
10957
- objectName: string;
10958
- sourceRecordId: string;
10959
- attributeName: string;
10960
- }
10961
- export interface UpdateDocument {
10962
- title?: string;
10963
- parentId?: Uuid | null;
10964
- position?: number;
10965
- }
10966
- export interface DocumentListOptions {
10967
- limit?: number;
10968
- offset?: number;
10969
- }
10970
- export interface RecordDocuments {
10971
- /** Documents grouped by attribute name (includes system 'attachments' attribute) */
10972
- byAttribute: Record<string, DocumentWithFiles[]>;
10973
- }
10923
+ export declare const ATTRIBUTE_TYPE_DESCRIPTORS: {
10924
+ readonly text: {
10925
+ readonly value: "plain";
10926
+ readonly traits: readonly ["placeholder", "searchable", "sortable"];
10927
+ };
10928
+ readonly richtext: {
10929
+ readonly value: "plain";
10930
+ readonly traits: readonly ["searchable", "content"];
10931
+ };
10932
+ readonly number: {
10933
+ readonly value: "plain";
10934
+ readonly traits: readonly ["placeholder", "sortable"];
10935
+ };
10936
+ readonly checkbox: {
10937
+ readonly value: "boolean";
10938
+ readonly traits: readonly ["sortable"];
10939
+ };
10940
+ readonly date: {
10941
+ readonly value: "plain";
10942
+ readonly traits: readonly ["placeholder", "sortable"];
10943
+ };
10944
+ readonly phone: {
10945
+ readonly value: "plain";
10946
+ readonly traits: readonly ["placeholder", "searchable", "sortable"];
10947
+ };
10948
+ readonly currency: {
10949
+ readonly value: "plain";
10950
+ readonly traits: readonly ["placeholder", "sortable", "groupable"];
10951
+ };
10952
+ readonly status: {
10953
+ readonly value: "options";
10954
+ readonly traits: readonly ["searchable", "sortable", "groupable"];
10955
+ };
10956
+ readonly location: {
10957
+ readonly value: "plain";
10958
+ readonly traits: readonly [];
10959
+ };
10960
+ readonly select: {
10961
+ readonly value: "options";
10962
+ readonly traits: readonly ["placeholder", "searchable", "sortable"];
10963
+ };
10964
+ readonly multiselect: {
10965
+ readonly value: "options";
10966
+ readonly traits: readonly ["placeholder", "searchable"];
10967
+ };
10968
+ readonly user: {
10969
+ readonly value: "reference";
10970
+ readonly traits: readonly [];
10971
+ };
10972
+ readonly relation: {
10973
+ readonly value: "reference";
10974
+ readonly traits: readonly ["qualified"];
10975
+ };
10976
+ readonly formula: {
10977
+ readonly value: "computed";
10978
+ readonly traits: readonly [];
10979
+ };
10980
+ readonly rollup: {
10981
+ readonly value: "computed";
10982
+ readonly traits: readonly [];
10983
+ };
10984
+ readonly document: {
10985
+ readonly value: "reference";
10986
+ readonly traits: readonly ["content", "qualified"];
10987
+ };
10988
+ };
10989
+ /** The attribute types whose value is of `kind`, as a literal union. */
10990
+ export type AttributeTypeOfKind<K extends AttributeValueKind> = { [T in AttributeType]: (typeof ATTRIBUTE_TYPE_DESCRIPTORS)[T]["value"] extends K ? T : never; }[AttributeType];
10991
+ /** Whether `type`'s value is of `kind` (`"computed"`: formula and rollup). */
10992
+ export declare function isValueKindType<K extends AttributeValueKind>(type: string, kind: K): type is AttributeTypeOfKind<K>;
10993
+ /** Whether `attribute`'s value is of `kind`, narrowing it to the matching attribute types. */
10994
+ export declare function hasValueKind<A extends {
10995
+ type: string;
10996
+ }, K extends AttributeValueKind>(attribute: A, kind: K): attribute is A & {
10997
+ type: AttributeTypeOfKind<K>;
10998
+ };
10999
+ /** Whether `type` carries `trait`. */
11000
+ export declare function hasTypeTrait(type: string, trait: AttributeTypeTrait): boolean;
11001
+ export declare function getAttributeCapabilities(attribute: AttributeLike): AttributeCapabilities;
11002
+ export declare function getAttributeFilterOperators(attribute: AttributeLike): readonly FilterOperator[];
11003
+ export declare function isAttributeFilterable(attribute: AttributeLike): boolean;
11004
+ export declare function isAttributeSearchable(attribute: AttributeLike): boolean;
11005
+ export declare function isAttributeGroupable(attribute: AttributeLike): boolean;
11006
+ export declare function isAttributeKanbanGroupable(attribute: AttributeLike): boolean;
10974
11007
  /**
10975
- * One record that holds documents, with how much sits at its drive root and
10976
- * when it last moved. The wire shape of `GET /documents/record-owners`.
11008
+ * The type a filter on this attribute actually compares against. Identity for
11009
+ * every ordinary attribute; for a rollup it unfolds the aggregation:
11010
+ * `earliest`/`latest` compare dates, `original` compares the target attribute's
11011
+ * own type, and every other function (count/sum/avg/min/max/…) compares numbers.
11012
+ *
11013
+ * This is the single place that knowledge lives: operator resolution and value
11014
+ * canonicalization both read it, so a rollup can never be offered numeric
11015
+ * operators while its value is canonicalized as something else.
10977
11016
  */
10978
- export declare const documentRecordOwnerSchema: z$2.ZodObject<{
10979
- recordId: z$2.ZodString;
10980
- objectName: z$2.ZodString;
10981
- label: z$2.ZodString;
10982
- itemCount: z$2.ZodNumber;
10983
- fileCount: z$2.ZodNumber;
10984
- lastActivityAt: z$2.ZodString;
10985
- }, z$2.core.$strip>;
10986
- export type DocumentRecordOwner = z$2.output<typeof documentRecordOwnerSchema>;
10987
- /** One page of {@link DocumentRecordOwner}s; `nextOffset: null` is the last page. */
10988
- export declare const documentRecordOwnerPageSchema: z$2.ZodObject<{
10989
- data: z$2.ZodArray<z$2.ZodObject<{
10990
- recordId: z$2.ZodString;
10991
- objectName: z$2.ZodString;
10992
- label: z$2.ZodString;
10993
- itemCount: z$2.ZodNumber;
10994
- fileCount: z$2.ZodNumber;
10995
- lastActivityAt: z$2.ZodString;
10996
- }, z$2.core.$strip>>;
10997
- nextOffset: z$2.ZodNullable<z$2.ZodNumber>;
10998
- }, z$2.core.$strip>;
10999
- export type DocumentRecordOwnerPage = z$2.output<typeof documentRecordOwnerPageSchema>;
11017
+ export declare function resolveEffectiveFilterType(attribute: AttributeLike): AttributeType;
11000
11018
  export declare const FORM_FORBIDDEN_ATTRIBUTE_TYPES: readonly ["relation", "multiRelation", "formula", "rollup", "document", "richtext", "user"];
11001
11019
  export interface FormSlotFieldRef {
11002
11020
  type: "slot";
@@ -11929,6 +11947,8 @@ export interface DBObject extends Timestamps {
11929
11947
  documentLayout?: DocumentLayout;
11930
11948
  /** Records of this object may have a parent record of the same object. Stored in `metadata`. */
11931
11949
  hierarchical?: boolean;
11950
+ /** The order its records' drives rest in until a person chooses one. Stored in `metadata`. */
11951
+ defaultDriveSort?: DocumentSortMode;
11932
11952
  }
11933
11953
  /**
11934
11954
  * Data for creating a new object.
@@ -11948,6 +11968,7 @@ export interface CreateDBObject {
11948
11968
  metadata?: Record<string, unknown>;
11949
11969
  documentLayout?: DocumentLayout;
11950
11970
  hierarchical?: boolean;
11971
+ defaultDriveSort?: DocumentSortMode;
11951
11972
  }
11952
11973
  export interface UpdateDBObject {
11953
11974
  label?: string;
@@ -11963,6 +11984,7 @@ export interface UpdateDBObject {
11963
11984
  metadata?: Record<string, unknown>;
11964
11985
  documentLayout?: DocumentLayout;
11965
11986
  hierarchical?: boolean;
11987
+ defaultDriveSort?: DocumentSortMode;
11966
11988
  }
11967
11989
  /**
11968
11990
  * Data for upserting an object.
@@ -13213,6 +13235,10 @@ export declare const ASK_QUESTIONS_MAX_BATCH = 4;
13213
13235
  export declare const ASK_QUESTIONS_ANSWER_MAX_LENGTH = 2000;
13214
13236
  /** Most values one multi-select answer may carry: its options plus one "Other". */
13215
13237
  export declare const ASK_QUESTIONS_ANSWER_MAX_VALUES = 50;
13238
+ /** Most files a person may add to one answer: as many as one chat message carries. */
13239
+ export declare const ASK_QUESTIONS_MAX_ADDED_FILES = 10;
13240
+ /** A file a person added to an answer: a stored file or a document, by ref. */
13241
+ export declare const ASK_QUESTIONS_FILE_REF: RegExp;
13216
13242
  /**
13217
13243
  * One answer of an `ask_questions` result, written on the call by the server
13218
13244
  * (#5229). Each carries the option's value AND its label, so the model reads
@@ -13256,6 +13282,7 @@ export declare const askQuestionsOutputSchema: z$2.ZodObject<{
13256
13282
  id: z$2.ZodString;
13257
13283
  name: z$2.ZodString;
13258
13284
  }, z$2.core.$strip>>;
13285
+ addedFiles: z$2.ZodOptional<z$2.ZodArray<z$2.ZodString>>;
13259
13286
  }, z$2.core.$strip>;
13260
13287
  export type AskQuestionsAnswer = z$2.infer<typeof askQuestionsAnswerSchema>;
13261
13288
  export type AskQuestionsResult = z$2.infer<typeof askQuestionsOutputSchema>;
@@ -20991,6 +21018,12 @@ export type MailboxAccount = z$2.output<typeof mailboxAccountSchema>;
20991
21018
  /** How the mailbox lists mail: one row per conversation, or one row per message. */
20992
21019
  export declare const MAILBOX_LIST_MODES: readonly ["threads", "messages"];
20993
21020
  export type MailboxListMode = (typeof MAILBOX_LIST_MODES)[number];
21021
+ /**
21022
+ * Where an opened mail reads, as Gmail offers: in a `panel` beside the list,
21023
+ * or `fullscreen` in the list's place, walked with the arrow keys.
21024
+ */
21025
+ export declare const MAILBOX_READER_LAYOUTS: readonly ["panel", "fullscreen"];
21026
+ export type MailboxReaderLayout = (typeof MAILBOX_READER_LAYOUTS)[number];
20994
21027
  /** Narrows a wire or form value to a list mode without a cast at the call site. */
20995
21028
  export declare function isMailboxListMode(value: unknown): value is MailboxListMode;
20996
21029
  export declare const mailboxCursorSchema: z$2.ZodObject<{
@@ -25378,7 +25411,7 @@ export declare const CORE_PREFERENCES: readonly [PreferenceDeclaration<"workPost
25378
25411
  model: string;
25379
25412
  } | undefined;
25380
25413
  routing?: "auto" | undefined;
25381
- }>, PreferenceDeclaration<"conversationSurface", "fullscreen" | "panel">, PreferenceDeclaration<"mailboxListMode", "messages" | "threads">, PreferenceDeclaration<"home", string | null>, PreferenceDeclaration<"memory.learnFromEmail", boolean>, PreferenceDeclaration<"memory.shareWithTeam", boolean>, PreferenceDeclaration<"onboarding.completed", boolean>, PreferenceDeclaration<"decisions.seenAt", string | null>, PreferenceDeclaration<"decisions.delivery", DecisionDelivery>];
25414
+ }>, PreferenceDeclaration<"conversationSurface", "fullscreen" | "panel">, PreferenceDeclaration<"mailboxListMode", "messages" | "threads">, PreferenceDeclaration<"mailboxReaderLayout", "fullscreen" | "panel">, PreferenceDeclaration<"home", string | null>, PreferenceDeclaration<"memory.learnFromEmail", boolean>, PreferenceDeclaration<"memory.shareWithTeam", boolean>, PreferenceDeclaration<"onboarding.completed", boolean>, PreferenceDeclaration<"decisions.seenAt", string | null>, PreferenceDeclaration<"decisions.delivery", DecisionDelivery>];
25382
25415
  export type CorePreference = (typeof CORE_PREFERENCES)[number];
25383
25416
  export type PreferenceKey = CorePreference["key"];
25384
25417
  export type PreferenceValue<Key extends PreferenceKey> = Extract<CorePreference, {
@@ -28611,6 +28644,11 @@ export interface ObjectDefinition {
28611
28644
  documentLayout?: DocumentLayout;
28612
28645
  /** Records of this object may have a parent record of the same object (a tree). */
28613
28646
  hierarchical?: boolean;
28647
+ /**
28648
+ * The order a record's drive rests in for anyone who never chose one on
28649
+ * that object and tab. Absent, the drive rests in `manual`.
28650
+ */
28651
+ defaultDriveSort?: DocumentSortMode;
28614
28652
  }
28615
28653
  /**
28616
28654
  * Links an attribute to an object