@composable-os/cli 0.1.0-beta.11 → 0.1.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/{accounts-UHYLCLEY.js → accounts-GOCNY6WI.js} +17 -13
  2. package/dist/app-OSPZHKOI.js +43 -0
  3. package/dist/app-upload-LH4PXKI4.js +198 -0
  4. package/dist/{blocks-5IFU25J6.js → blocks-6DZIP47W.js} +207 -25
  5. package/dist/{chunk-XIDLW3EP.js → chunk-2B6YUYZV.js} +23499 -11766
  6. package/dist/{run-7P4RQALH.js → chunk-2CCHB37H.js} +9 -146
  7. package/dist/{chunk-DU6OIFOU.js → chunk-3OGDWKJ3.js} +530 -434
  8. package/dist/{chunk-DHS2CV2M.js → chunk-5D7BDF4Y.js} +15 -13
  9. package/dist/{chunk-MBIKVRAC.js → chunk-5YDYQM6V.js} +830 -47
  10. package/dist/{chunk-ZAWES2UD.js → chunk-6CM3WZG5.js} +13 -2483
  11. package/dist/{chunk-7D4GKZOX.js → chunk-CIBJGB5H.js} +422 -75
  12. package/dist/chunk-EPDTPGZJ.js +330 -0
  13. package/dist/{chunk-LAAL4YGR.js → chunk-HAYF4G5V.js} +66 -23
  14. package/dist/chunk-HCG6T53D.js +61904 -0
  15. package/dist/{chunk-K34UKWEI.js → chunk-JX4IFWNT.js} +64 -32
  16. package/dist/{chunk-6XTU2MTP.js → chunk-KFHKNXGH.js} +632 -418
  17. package/dist/chunk-KMFMD52Z.js +13276 -0
  18. package/dist/{chunk-E4WCYTCT.js → chunk-LX2TTLVY.js} +174 -55
  19. package/dist/{chunk-PDD2ETVF.js → chunk-O37YUZ52.js} +172 -16
  20. package/dist/{chunk-GYTEW66E.js → chunk-O3R4FS2J.js} +1 -1
  21. package/dist/{chunk-E64SG24J.js → chunk-Q6Y45DY6.js} +25 -2
  22. package/dist/chunk-RGKJKC5T.js +876 -0
  23. package/dist/{chunk-YFTLIEWU.js → chunk-RSEWEFAV.js} +12 -2
  24. package/dist/{chunk-2ABSVMGB.js → chunk-SMJZIK2O.js} +1 -1
  25. package/dist/{chunk-LO6WGU5Y.js → chunk-U72NEGCT.js} +8089 -3464
  26. package/dist/{chunk-P6UWZ6QQ.js → chunk-Z4IKF23A.js} +11 -7
  27. package/dist/{chunk-2IVEVPMY.js → chunk-Z7OVQ6BC.js} +105 -61
  28. package/dist/{chunk-6UWRT4VM.js → chunk-ZJSFX4RD.js} +175 -3
  29. package/dist/{cli-5UNY5G5L.js → cli-OKQHHSOE.js} +17 -25
  30. package/dist/{cli-UYZMVQMR.js → cli-VYSD2S4Z.js} +227 -81
  31. package/dist/cli.js +5 -5
  32. package/dist/{client-repo-SE4EKG6W.js → client-repo-MPCPTXLF.js} +7 -5
  33. package/dist/create.js +5 -5
  34. package/dist/{fields-FTWWMD7N.js → fields-GTHE6TTS.js} +27 -3
  35. package/dist/gateway-DPPEQZT4.js +25 -0
  36. package/dist/grants-6JY4XZO7.js +27 -0
  37. package/dist/invoke-MRONRZ5Q.js +33 -0
  38. package/dist/moves-UAUCMWL5.js +36 -0
  39. package/dist/{order-U4KZLLSJ.js → order-RKLGT74L.js} +2 -2
  40. package/dist/{person-UHLVBVLR.js → person-YOZTFV4Q.js} +11 -10
  41. package/dist/plan-on-sale-H4F26YIN.js +26 -0
  42. package/dist/platform/migrations/0730_practitioners.sql +79 -0
  43. package/dist/platform/migrations/0750_routine_mail.sql +98 -0
  44. package/dist/platform/migrations/0770_clear_fixed_role_grants.sql +64 -0
  45. package/dist/platform/migrations/0810_recurrence_exceptions.sql +66 -0
  46. package/dist/platform/migrations/0811_staff_time.sql +109 -0
  47. package/dist/platform/migrations/0812_staff_offers.sql +112 -0
  48. package/dist/platform/migrations/0813_pay_periods.sql +241 -0
  49. package/dist/platform/migrations/0814_staff_feed.sql +47 -0
  50. package/dist/platform/migrations/0815_checklists.sql +237 -0
  51. package/dist/platform/migrations/0816_checklist_schedules.sql +121 -0
  52. package/dist/platform/migrations/0817_checklist_day_window.sql +35 -0
  53. package/dist/platform/migrations/0850_agreements.sql +271 -0
  54. package/dist/platform/migrations/0851_agreement_acceptances.sql +387 -0
  55. package/dist/platform/migrations/0853_agreement_enforcement.sql +58 -0
  56. package/dist/platform/migrations/0854_agreement_copy.sql +149 -0
  57. package/dist/platform/migrations/0855_agreement_retention.sql +279 -0
  58. package/dist/platform/migrations/0856_subscription_cooling_off.sql +159 -0
  59. package/dist/platform/migrations/0857_agreement_copy_guardian.sql +337 -0
  60. package/dist/platform/migrations/0858_agreement_desk.sql +175 -0
  61. package/dist/platform/migrations/0910_routine_messages.sql +99 -0
  62. package/dist/platform/migrations/0911_texts.sql +60 -0
  63. package/dist/platform/migrations/0913_contact_consent.sql +93 -0
  64. package/dist/platform/migrations/0916_contact_mailbox_index.sql +29 -0
  65. package/dist/platform/migrations/0930_stock_movements.sql +95 -0
  66. package/dist/platform/migrations/0931_stock_low.sql +25 -0
  67. package/dist/platform/migrations/0932_order_delivery.sql +78 -0
  68. package/dist/platform/migrations/0950_order_adjustments.sql +111 -0
  69. package/dist/platform/migrations/0951_order_price_guards.sql +33 -0
  70. package/dist/platform/migrations/0952_order_paid_another_way.sql +194 -0
  71. package/dist/platform/migrations/0953_discount_uses.sql +183 -0
  72. package/dist/platform/migrations/0955_folded_addresses.sql +92 -0
  73. package/dist/platform/migrations/0970_published_text.sql +59 -0
  74. package/dist/platform/migrations/0971_publish_acks.sql +68 -0
  75. package/dist/platform/migrations/0990_customer_email_change.sql +65 -0
  76. package/dist/platform/migrations/1010_intake_links.sql +148 -0
  77. package/dist/platform/migrations/1030_invoices.sql +747 -0
  78. package/dist/platform/migrations/1031_invoice_orders.sql +327 -0
  79. package/dist/platform/migrations/1050_inbox_conversations.sql +83 -0
  80. package/dist/platform/migrations/1090_staff_hours.sql +43 -0
  81. package/dist/platform/migrations/1091_staff_time_margins.sql +12 -0
  82. package/dist/platform/migrations/1092_client_guard.sql +26 -0
  83. package/dist/platform/migrations/1095_thing_time.sql +70 -0
  84. package/dist/platform/migrations/1130_devices.sql +162 -0
  85. package/dist/platform/migrations/1135_person_codes.sql +88 -0
  86. package/dist/platform/migrations/1150_finance_periods.sql +316 -0
  87. package/dist/platform/migrations/1151_payouts.sql +202 -0
  88. package/dist/platform/migrations/1153_finance_money_dates.sql +18 -0
  89. package/dist/platform/migrations/1170_journeys.sql +318 -0
  90. package/dist/platform/migrations/1171_person_birthday.sql +52 -0
  91. package/dist/platform/migrations/1175_person_signals.sql +29 -0
  92. package/dist/platform/migrations/1190_restricted_values.sql +25 -0
  93. package/dist/platform/migrations/1230_note_levels.sql +113 -0
  94. package/dist/platform/migrations/1231_person_carers.sql +33 -0
  95. package/dist/platform/migrations/1232_note_kinds.sql +122 -0
  96. package/dist/platform/migrations/1270_time_entries.sql +145 -0
  97. package/dist/platform/migrations/1271_leave.sql +249 -0
  98. package/dist/platform/migrations/1273_time_entry_reopened.sql +21 -0
  99. package/dist/platform/migrations/1330_accounting.sql +260 -0
  100. package/dist/platform/migrations/1350_customer_feed.sql +24 -0
  101. package/dist/platform/migrations/1390_locations.sql +77 -0
  102. package/dist/platform/migrations/1410_outside_copy.sql +213 -0
  103. package/dist/platform/migrations/1430_inbox_activities.sql +231 -0
  104. package/dist/platform/migrations/1450_wrong_guesses.sql +23 -0
  105. package/dist/platform/sdk/acknowledge.ts +100 -0
  106. package/dist/platform/sdk/agreements.ts +185 -0
  107. package/dist/platform/sdk/allowance.ts +98 -8
  108. package/dist/platform/sdk/automation-check.ts +120 -9
  109. package/dist/platform/sdk/automation.ts +78 -10
  110. package/dist/platform/sdk/behaviour.ts +26 -6
  111. package/dist/platform/sdk/calendar-entry.ts +258 -0
  112. package/dist/platform/sdk/capacity.ts +1 -2
  113. package/dist/platform/sdk/checklists.ts +118 -0
  114. package/dist/platform/sdk/contract.ts +489 -27
  115. package/dist/platform/sdk/discount.ts +408 -0
  116. package/dist/platform/sdk/document.ts +4 -2
  117. package/dist/platform/sdk/field-types.ts +5 -0
  118. package/dist/platform/sdk/formula/compile.ts +10 -0
  119. package/dist/platform/sdk/index.ts +17 -0
  120. package/dist/platform/sdk/intake.ts +380 -0
  121. package/dist/platform/sdk/journey-signals.ts +215 -0
  122. package/dist/platform/sdk/manifest.ts +1236 -65
  123. package/dist/platform/sdk/mine.ts +161 -0
  124. package/dist/platform/sdk/occupies.ts +192 -0
  125. package/dist/platform/sdk/questions.ts +681 -0
  126. package/dist/platform/sdk/recurring.ts +90 -9
  127. package/dist/platform/sdk/restricted-fields.ts +129 -0
  128. package/dist/platform/sdk/rich-text.ts +112 -0
  129. package/dist/platform/sdk/routine-mail.ts +1272 -0
  130. package/dist/platform/sdk/runtime.ts +25 -12
  131. package/dist/platform/sdk/screens.ts +91 -0
  132. package/dist/platform/sdk/sellable.ts +344 -0
  133. package/dist/platform/sdk/slug.ts +7 -2
  134. package/dist/platform/sdk/staffed.ts +474 -0
  135. package/dist/platform/sdk/states.ts +68 -26
  136. package/dist/platform/sdk/stock.ts +332 -0
  137. package/dist/platform/sdk/team.ts +83 -0
  138. package/dist/platform/sdk/testing.ts +70 -6
  139. package/dist/platform/sdk/worked-on.ts +134 -0
  140. package/dist/{products-2H5DR232.js → products-GCQLSZ3U.js} +2 -2
  141. package/dist/run-7ID64RA6.js +65 -0
  142. package/dist/run-FH7OGGTV.js +131 -0
  143. package/dist/run-OYZIAP6M.js +3363 -0
  144. package/dist/{run-ZCGFMEZF.js → run-QOFRRSZV.js} +41 -60
  145. package/dist/{run-PO3W5BFA.js → run-TJAEWR5U.js} +21 -51
  146. package/dist/{src-I3IJ4NKC.js → src-52VERUPK.js} +306 -4
  147. package/dist/src-PHRELWN5.js +40 -0
  148. package/dist/{visibility-TVXZ67FD.js → visibility-SZCINPP4.js} +21 -4
  149. package/package.json +2 -2
  150. package/dist/chunk-2TWV3SVB.js +0 -349
  151. package/dist/chunk-2XC5JLBO.js +0 -1931
  152. package/dist/chunk-324WJXNP.js +0 -320
  153. package/dist/chunk-6ELZRNUU.js +0 -116
  154. package/dist/chunk-6WGFA2IV.js +0 -643
  155. package/dist/chunk-7CQGMVDO.js +0 -63
  156. package/dist/chunk-7OGCMQXG.js +0 -284
  157. package/dist/chunk-FJIZGS5Q.js +0 -698
  158. package/dist/chunk-UB4I2QKR.js +0 -31575
  159. package/dist/chunk-WHKJGF36.js +0 -2418
  160. package/dist/chunk-YNUZRTPH.js +0 -182
  161. package/dist/chunk-ZZFWMVJO.js +0 -704
  162. package/dist/grants-LOW6TSWD.js +0 -32
  163. package/dist/invoke-6KVT6WJI.js +0 -41
  164. package/dist/moves-E2HKYCTK.js +0 -41
  165. package/dist/plan-on-sale-TJPFCNL7.js +0 -26
  166. package/dist/src-CRO35DYY.js +0 -46
@@ -2,15 +2,29 @@
2
2
  // `defineExtension({...})`. Everything here is plain data plus tool/automation handlers, so the host
3
3
  // can turn it into a JSON manifest, validate it, diff it and reconcile it to tables.
4
4
  import type { z } from "zod";
5
+ import type { AcknowledgeSpec } from "./acknowledge.ts";
6
+ import type { AgreementsSpec, HealthNotesSpec } from "./agreements.ts";
5
7
  import type { AllowanceSpec } from "./allowance.ts";
6
8
  import type { AutomationSpec } from "./automation.ts";
9
+ import type { CalendarEntrySpec } from "./calendar-entry.ts";
7
10
  import type { CapacitySpec, ClaimsSpec } from "./capacity.ts";
11
+ import type { ChecklistsSpec } from "./checklists.ts";
12
+ import type { DiscountSpec } from "./discount.ts";
8
13
  import type { DocumentPathSpec, DocumentSchema } from "./document.ts";
9
14
  import type { FieldTypeName } from "./field-types.ts";
15
+ import type { IntakeSpec } from "./intake.ts";
16
+ import type { JourneySignalSpec } from "./journey-signals.ts";
17
+ import type { MineSpec } from "./mine.ts";
18
+ import type { OccupiesSpec } from "./occupies.ts";
10
19
  import type { RecurringScheduleSpec } from "./recurring.ts";
20
+ import type { RoutineMailModule, RoutineMailSpec } from "./routine-mail.ts";
11
21
  import type { SellableSpec } from "./sellable.ts";
22
+ import type { StaffedSpec } from "./staffed.ts";
12
23
  import type { StatesSpec } from "./states.ts";
24
+ import type { StockMovesSpec, StockSpec } from "./stock.ts";
25
+ import type { TeamSpec } from "./team.ts";
13
26
  import type { UniqueSpec } from "./unique.ts";
27
+ import type { WorkedOnSpec } from "./worked-on.ts";
14
28
 
15
29
  /** The contract version this SDK writes. The host accepts this and the previous version. */
16
30
  export const CONTRACT_VERSION = 1;
@@ -39,7 +53,15 @@ export const GATEKEEPER_MODULES = [
39
53
  export type GatekeeperModuleName = (typeof GATEKEEPER_MODULES)[number];
40
54
 
41
55
  /** Host modules an extension can ask for (ADR 0025). There is no HTTP module. */
42
- export const HOST_MODULES = ["ops", "storage", "log", "ai", ...GATEKEEPER_MODULES] as const;
56
+ export const HOST_MODULES = [
57
+ "ops",
58
+ "storage",
59
+ "log",
60
+ "ai",
61
+ // Routine mail (ADR 0590): a shipped pack's declared emails, in its automations only.
62
+ "routine-mail",
63
+ ...GATEKEEPER_MODULES,
64
+ ] as const;
43
65
  export type HostModuleName = (typeof HOST_MODULES)[number];
44
66
 
45
67
  /** Risk classes an extension tool may declare (schema and extension risks are host-only). */
@@ -166,6 +188,14 @@ export type FieldSpec =
166
188
  type: "richText";
167
189
  maxBytes?: number;
168
190
  })
191
+ | (Omit<FieldBase, "default" | "defaultSetting"> & {
192
+ /**
193
+ * A checklist (stage 45 step 4b, ADR 0650): one of the business's checklist templates
194
+ * (Settings → Checklists), by id; only an active one may be picked. Named by an object's
195
+ * `checklists.template`, it gives each record a run of it to tick off.
196
+ */
197
+ type: "checklist";
198
+ })
169
199
  | (Omit<FieldBase, "default" | "defaultSetting"> & {
170
200
  /**
171
201
  * A record's address (stage 28, ADR 0442): lowercase letters and digits in words joined
@@ -246,11 +276,30 @@ export interface ObjectSpec {
246
276
  capacity?: CapacitySpec;
247
277
  /** Something that can be bought, and what a paid line grants (see SellableSpec, ADR 0435). */
248
278
  sellable?: SellableSpec;
279
+ /** Things counted on a shelf, sold from a ledger the host keeps (see StockSpec, ADR 0680). */
280
+ stock?: StockSpec;
281
+ /** A record's state moves stock: received adds, a write-off removes, a count sets (see StockMovesSpec, ADR 0681). */
282
+ stockMoves?: StockMovesSpec;
249
283
  /**
250
284
  * Uses a record holds (a pass, a membership), or a record that spends one (a booking): see
251
285
  * AllowanceSpec, ADRs 0493 and 0494. The host counts and refuses a spend past the limit.
252
286
  */
253
287
  allowance?: AllowanceSpec;
288
+ /**
289
+ * Records that are discounts (see DiscountSpec, ADR 0693): a code or a member's price, worked out
290
+ * by the host when it prices an order, one deal per order, limits kept by the database.
291
+ */
292
+ discount?: DiscountSpec;
293
+ /**
294
+ * An agreement point (see AgreementsSpec, ADR 0641): where a business may need a person to have
295
+ * agreed to its documents first. The business attaches the documents; the pack names the place.
296
+ */
297
+ agreements?: AgreementsSpec;
298
+ /**
299
+ * A health-note list (see HealthNotesSpec, ADR 0643): this object's records make a list staff
300
+ * read (a class's bookings), on which the host may mark a yes on someone's health form.
301
+ */
302
+ healthNotes?: HealthNotesSpec;
254
303
  /** A fixed state machine (see StatesSpec, ADR 0425). An object has stages or states, not both. */
255
304
  states?: StatesSpec;
256
305
  /**
@@ -268,6 +317,48 @@ export interface ObjectSpec {
268
317
  * ADR 0500): a timetable's series and its classes.
269
318
  */
270
319
  recurring?: RecurringScheduleSpec;
320
+ /**
321
+ * A shift (see StaffedSpec, ADR 0621): who works the record, when, and on what kind of work.
322
+ * The host refuses, in the database, one account on two overlapping shifts, and answers each
323
+ * write with its warnings (away, not qualified, no one on it).
324
+ */
325
+ staffed?: StaffedSpec;
326
+ /**
327
+ * Time can be recorded against the record (see WorkedOnSpec, ADR 0850): a job. Its time is the
328
+ * staff's time entries against it, read through the host; it keeps no hours of its own.
329
+ */
330
+ workedOn?: WorkedOnSpec;
331
+ /**
332
+ * Who on the staff looks after the Person a record is about (see TeamSpec, ADR 0831): the
333
+ * accounts in its user fields while it is live. A pack role's `looksAfter` reaches records
334
+ * only for those People (ADR 0889). Only shipped extensions and an org's own may declare it.
335
+ */
336
+ team?: TeamSpec;
337
+ /**
338
+ * A claim on a thing (see OccupiesSpec, ADR 0765): while live, the record takes the room (or
339
+ * chair, or hall) it names for its time. The host refuses, in the database, a second live
340
+ * record on the same thing at an overlapping time, whatever object it is.
341
+ */
342
+ occupies?: OccupiesSpec;
343
+ /**
344
+ * Events in the customer's private calendar feed (see CalendarEntrySpec, ADR 0891): the record's
345
+ * start, end, public title and place as paths the customer may read, and the states in which it
346
+ * shows. The host reads them as the customer, through the visibility seam, and shows a live
347
+ * dependant's to their guardian. Only shipped extensions may declare it.
348
+ */
349
+ calendarEntry?: CalendarEntrySpec;
350
+ /**
351
+ * The public-write door (see IntakeSpec, ADR 0720): a form the public answers, the submission
352
+ * the host makes from the answers, or another pack's record a form may also make. Only the
353
+ * host's `intake.submit` creates a submission; nothing else opens a write to the public.
354
+ */
355
+ intake?: IntakeSpec;
356
+ /**
357
+ * A checklist the record's person ticks off (see ChecklistsSpec, ADR 0650): a run of the
358
+ * template its `template` field names, made by the host, ticked by the person (or by someone who
359
+ * rosters, for them), never changed once done, read only by the person and those who roster.
360
+ */
361
+ checklists?: ChecklistsSpec;
271
362
  /**
272
363
  * The record's owner: a `user` field of this object (ADR 0246, stage 14). Assignment rules set
273
364
  * it when a record is created without one, and stage 14's visibility policies read it.
@@ -286,9 +377,9 @@ export interface ObjectSpec {
286
377
  * What the public may read of this object (ADR 0438): the fields in `read`, of the records that
287
378
  * meet `when`. Deny by default: left out, the public sees nothing of it, and a record that does
288
379
  * not meet `when` is not found. A signed-in customer reads it too, unless the object declares a
289
- * `customer` (an object declares one or the other). The public reaches it only through a pack's
290
- * tool open to them (`public.list`, `public.get`). Only shipped extensions and an org's own may
291
- * declare it.
380
+ * `customer` (an object declares one or the other, except a publishable object with an author:
381
+ * see `publishable`). The public reaches it only through a pack's tool open to them
382
+ * (`public.list`, `public.get`). Only shipped extensions and an org's own may declare it.
292
383
  */
293
384
  public?: PublicSpec;
294
385
  /**
@@ -326,6 +417,14 @@ export interface ObjectSpec {
326
417
  * publish permission, never an AI actor); `record.versions` and `record.version` read them;
327
418
  * `record.restoreVersion` copies one back into the working copy. Editing the working copy
328
419
  * never changes a version. Records get read-only `publishedVersion` and `publishedAt`.
420
+ *
421
+ * With an author (ADR 0810): a publishable object may declare a `customer`, the record's author
422
+ * (a review's writer). The author reads and writes their working copy through `customer`; the
423
+ * public reads only the published version through `public` (which may then be declared too),
424
+ * listed by `content.list` and never by an address (no `slug`). The fields in `customer.write`
425
+ * are the author's alone: staff, the assistant, MCP clients, automations and the extension's own
426
+ * code are refused them on every path, so a published version is always the author's words.
427
+ * Staff still publish, unpublish and move the record's states.
329
428
  */
330
429
  publishable?: PublishableSpec;
331
430
  /** Position in the sidebar among extension objects (lower first). Default 100. */
@@ -360,7 +459,8 @@ export type StageType = (typeof STAGE_TYPES)[number];
360
459
  * operations, so it applies to every actor: people, MCP clients, Code Mode, extensions.
361
460
  *
362
461
  * - Entering a stage needs the stage's required fields and `requiredByType[type]` to have values;
363
- * otherwise the write is refused with a structured error naming the missing fields.
462
+ * otherwise the write is refused with a structured error naming the missing fields. A read-only
463
+ * field may be required: a fact the host sets, which no caller can supply (ADR 0750).
364
464
  * - `group` must match the stage's group; a record given only a group starts in its first stage.
365
465
  * - `probability.field` follows the stage's default probability unless it was set by hand
366
466
  * (`probability.overridden` is then true; clearing that flag resets it).
@@ -558,6 +658,11 @@ export interface ExtensionContext {
558
658
  ai: AiModule;
559
659
  /** A gatekeeper declared in permissions.modules, e.g. `ctx.gatekeeper("email-send")`. */
560
660
  gatekeeper(name: GatekeeperModuleName): GatekeeperModule;
661
+ /**
662
+ * Sends a routine email this extension declares (ADR 0590): in an automation of a shipped
663
+ * extension only. Declare the "routine-mail" module.
664
+ */
665
+ routineMail: RoutineMailModule;
561
666
  /** Who started this tool, from the host (ADR 0436). Absent in automations. */
562
667
  caller?: StartedBy;
563
668
  }
@@ -579,7 +684,8 @@ export interface ToolSpec<In extends z.ZodType = z.ZodType, Out extends z.ZodTyp
579
684
  */
580
685
  recordAction?: RecordActionSpec;
581
686
  /**
582
- * Who may call the tool: a non-empty subset of `staff`, `customer`, `public`. Left out, staff
687
+ * Who may call the tool: a non-empty subset of `staff`, `customer`, `public`, or `device` alone
688
+ * (an enrolled device whose device role holds the tool's `permission`, ADR 0781). Left out, staff
583
689
  * only. A tool open to `customer` or `public` must have risk `read` or `write`. Called by a
584
690
  * customer, the tool runs as that customer: `ctx.ops` reaches only their own records, through
585
691
  * `my.list`, `my.get`, `my.create` and `my.update`. Only shipped extensions and an org's own
@@ -597,9 +703,14 @@ export interface ToolSpec<In extends z.ZodType = z.ZodType, Out extends z.ZodTyp
597
703
  * a role of this extension to hold (`roles`, ADR 0436). Admins and members hold it as they hold
598
704
  * any tool (a viewer only when the tool's risk is `read`); a staff account given one of this
599
705
  * extension's roles holds it only when the role lists it. Only shipped extensions and an org's
600
- * own may declare it.
706
+ * own may declare it. A tool open to `device` names the permission a device role holds
707
+ * (`deviceRoles`, ADR 0781), and no staff role, grant or restriction names it.
708
+ *
709
+ * Or a list: any one of them opens the tool (ADR 0600). Bookings' day view is the coach's and
710
+ * the desk's (`["bookings:coach", "bookings:desk"]`): a coach reaches it through the role, held
711
+ * to the role's limits, and a coach granted the desk's permission reaches it through the grant.
601
712
  */
602
- permission?: string;
713
+ permission?: string | readonly string[];
603
714
  /**
604
715
  * Only a person may call it (ADR 0512): the assistant, an MCP client, an automation and other
605
716
  * extensions' code are refused by the host, as a core operation with `actors: ["human"]` is.
@@ -615,6 +726,42 @@ export interface ToolSpec<In extends z.ZodType = z.ZodType, Out extends z.ZodTyp
615
726
  * what an AI may propose but a person decides (cancelling a class). Staff only, and not a read.
616
727
  */
617
728
  personApproves?: boolean;
729
+ /**
730
+ * A tool naming both a permission one of this extension's roles holds and a grantable one
731
+ * (ADR 0600) says so on purpose: an account given the grant calls it without the role's limits
732
+ * (Bookings' `day`, the desk's any day). Without it, such a tool is refused by the check, so a
733
+ * grantable permission added to a role's own tool never lifts the role's limits by accident.
734
+ */
735
+ grantLiftsRoleLimits?: boolean;
736
+ /**
737
+ * Every staff account may call it, pack roles included (ADR 0652): a cleaner's `rostering.team`,
738
+ * a coach, the door, as well as admins and members. For a tool whose host operation decides
739
+ * who may do what by a rule of its own (Daily checklists' `today` and `tick`: the checklist's
740
+ * own "who may do it"), so no role or grant has to name it. A person's own act (`humanOnly`),
741
+ * for staff only, with no `permission` or `corePermission`. Only shipped extensions and an
742
+ * org's own may declare it.
743
+ */
744
+ anyStaff?: boolean;
745
+ /**
746
+ * A core permission a staff caller needs instead of `records:read` or `records:write` (ADR
747
+ * 0652): one an admin may grant one by one (`checklists:write`). Admins and those granted it
748
+ * call the tool; nobody else does, and no pack role reaches it (a pack role holds no core
749
+ * permission). For staff only, with no `permission`. Only shipped extensions and an org's own
750
+ * may declare it.
751
+ */
752
+ corePermission?: string;
753
+ /**
754
+ * Fields of the input the audit log never keeps (ADR 0626): a note about someone's leave. The
755
+ * call is still audited, with those fields shown as redacted. It only hides more, so any
756
+ * extension may declare it.
757
+ */
758
+ redact?: readonly string[];
759
+ /**
760
+ * Keys of the tool's answer the host never keeps (ADR 0628): a secret shown once, such as a
761
+ * calendar feed's address. Never in the audit log, an approval's stored result or a stored
762
+ * reply an HTTP retry replays. It only hides more, so any extension may declare it.
763
+ */
764
+ redactResult?: readonly string[];
618
765
  handler(input: z.output<In>, ctx: ExtensionContext): Promise<z.input<Out>> | z.input<Out>;
619
766
  }
620
767
 
@@ -643,39 +790,105 @@ export interface RoleSpec {
643
790
  * call the account makes and every call of a tool run it started. Other staff are not limited.
644
791
  */
645
792
  today?: Readonly<Record<string, string | { at: string; until?: string; zone?: string }>>;
793
+ /**
794
+ * Objects whose records the role reaches only for the People its holder looks after (ADR
795
+ * 0889), by object: its relation (one record) to `person`. Its holder looks after a Person
796
+ * when a live record of one of this extension's objects that declares a `team` names them in
797
+ * its staff fields (a client's assignment naming the coach). The host holds it on every call
798
+ * the account makes and every call of a tool run it started: a list holds only those People's
799
+ * records, a read or a change of another's is not found, a new record must be about one of
800
+ * them, and any other operation naming the object is refused. Other staff are not limited.
801
+ */
802
+ looksAfter?: Readonly<Record<string, string>>;
803
+ /**
804
+ * Objects whose records the role reaches only through a live record of this extension naming
805
+ * its holder (ADR 0755), by object: that record's object (`through`), its user field naming the
806
+ * holder (`who`), the relations from it to the object reached (`path`), the states in which it
807
+ * counts (`live`) and a window around its datetimes (`within`). Jobs' crew reaches the jobs on
808
+ * which it has a crew place, from a week before the visit to a week after. The host holds it on
809
+ * every call the account makes and every call of a tool run it started: a list holds only those
810
+ * records, a read or a change of another is not found, and so is a write naming another in a
811
+ * relation, a new record is refused, a change to a field that decides the reach is refused, and
812
+ * so is any other operation. Every field deciding it is `personApproves`. Other staff are not
813
+ * limited.
814
+ */
815
+ mine?: Readonly<Record<string, MineSpec>>;
816
+ }
817
+
818
+ /**
819
+ * A device role an extension declares (ADR 0781): what an enrolled device given it may do, with
820
+ * no person signed in. A human admin enrols a device for the role (`device.enrol { use: "role",
821
+ * role: "<id>.<name>" }`); its credential then calls exactly the tools whose permission the role
822
+ * lists (each open to `device` only) and `device.heartbeat`, and nothing else. It reads no
823
+ * record: its tools return only what their outputs declare. Bookings' check-in tablet:
824
+ * `{ permissions: ["bookings:checkin"], screen: { block: "bookings-checkin-tablet", export:
825
+ * "CheckInTablet" } }`. Only a shipped pack may declare one: a runtime extension's fails `cos ext
826
+ * check` and install, and is ignored at run time.
827
+ */
828
+ export interface DeviceRoleSpec {
829
+ label: string;
830
+ /** What the device is for, shown to the admin who enrols it. */
831
+ description: string;
832
+ /** Permissions of this extension's device tools (`<id>:<word>`) the role holds. */
833
+ permissions: readonly string[];
834
+ /** The device's screen: a web block of this pack and the component it exports. */
835
+ screen: { block: string; export: string };
646
836
  }
647
837
 
648
838
  /**
649
839
  * Who started a tool (ADR 0436), set by the host from the session it verified and never from the
650
- * input: a staff user, a signed-in customer or the public. A tool's own operation calls run as
651
- * the extension (or as the customer, ADR 0414); this is for recording who asked, such as who
652
- * checked a ticket in. Absent in automations and in a manifest evaluation.
840
+ * input: a staff user, a signed-in customer, the public, or an enrolled device holding one of
841
+ * this extension's device roles (ADR 0781: the device's id and the name an admin gave it, "Front
842
+ * door tablet"). A tool's own operation calls run as the extension (or as the customer, ADR
843
+ * 0414); this is for recording who asked, such as who checked a ticket in, or that a booking was
844
+ * ticked at the door. Absent in automations and in a manifest evaluation.
653
845
  */
654
846
  export type StartedBy =
655
847
  | { readonly kind: "staff"; readonly userId: string; readonly name: string }
656
848
  | { readonly kind: "customer" }
657
- | { readonly kind: "public" };
849
+ | { readonly kind: "public" }
850
+ | { readonly kind: "device"; readonly deviceId: string; readonly name: string };
658
851
 
659
- /** Who may call a tool. `staff` when nothing is declared (ADR 0402). */
660
- export const TOOL_AUDIENCES = ["staff", "customer", "public"] as const;
852
+ /**
853
+ * Who may call a tool. `staff` when nothing is declared (ADR 0402). `device` (ADR 0781): an
854
+ * enrolled device whose device role holds the tool's permission, on the desk origin only; a tool
855
+ * open to `device` is open to nobody else.
856
+ */
857
+ export const TOOL_AUDIENCES = ["staff", "customer", "public", "device"] as const;
661
858
  export type ToolAudience = (typeof TOOL_AUDIENCES)[number];
662
859
 
663
860
  /**
664
- * What the public may read of an object (ADR 0438). `when` is a condition on a state (a select
665
- * field) of the record itself, or, with `via`, of the record one of its relations points to: an
666
- * event while it is `on_sale`; a ticket type while its event is.
861
+ * One condition of a `public` or `signedIn` declaration's `when` (ADRs 0438 and 0689): a state (a
862
+ * select field) of the record itself, or, with `via`, of the record one of its relations points
863
+ * to; or, `via` alone (in `public` only), that the record it points to is one the public reads
864
+ * (published, if its object is publishable, and meeting its own `when`): a variant while its item
865
+ * is published.
866
+ */
867
+ export type PublicCondition =
868
+ | {
869
+ /** A relation of this object, to another object of this extension: test that record. */
870
+ via?: string;
871
+ /** A select field (of this record, or of the one `via` points to). */
872
+ field: string;
873
+ /** The values for which the record is public. */
874
+ in: readonly string[];
875
+ }
876
+ | {
877
+ /** A relation of this object, to another object of this extension that declares `public`. */
878
+ via: string;
879
+ field?: undefined;
880
+ in?: undefined;
881
+ };
882
+
883
+ /**
884
+ * What the public may read of an object (ADR 0438). `when` is a condition, or a list of up to
885
+ * three that must all hold (ADR 0689): an event while it is `on_sale`; a ticket type while its
886
+ * event is; a variant while it is `active` and its item is published.
667
887
  */
668
888
  export interface PublicSpec {
669
889
  read: readonly string[];
670
890
  /** Left out, every live record is public (a catalogue item). */
671
- when?: {
672
- /** A relation of this object, to another object of this extension: test that record. */
673
- via?: string;
674
- /** A select field (of this record, or of the one `via` points to). */
675
- field: string;
676
- /** The values for which the record is public. */
677
- in: readonly string[];
678
- };
891
+ when?: PublicCondition | readonly PublicCondition[];
679
892
  }
680
893
 
681
894
  /**
@@ -748,7 +961,9 @@ export interface PublishableSpec {
748
961
  /**
749
962
  * The record's address (stage 28, ADR 0442): a `slug` field of the object's own, not in
750
963
  * `content`. The public reads a record by it (`content.get`); a published record whose slug
751
- * changes keeps the old one as a redirect. Needed to declare `public`.
964
+ * changes keeps the old one as a redirect. Left out on an object the public reads, its records
965
+ * are listed only (`content.list`) and `content.get` finds none (ADR 0810). An object with an
966
+ * author (a `customer`) has none.
752
967
  */
753
968
  slug?: string;
754
969
  /**
@@ -757,6 +972,33 @@ export interface PublishableSpec {
757
972
  * Set, it is kept: an imported post keeps its date.
758
973
  */
759
974
  date?: string;
975
+ /**
976
+ * The states in which the record may be published (ADR 0810): values of the object's `states`
977
+ * field. A publish (or a scheduled one coming due) of a record in any other state is refused,
978
+ * and a record that moves out of them is unpublished in the same batch. A review without its
979
+ * author's consent is never published. Left out, any state.
980
+ */
981
+ publishIn?: readonly string[];
982
+ /**
983
+ * Read and understood (stage 38, ADR 0702): the staff who must read a record confirm its
984
+ * current version with one tap, and a person publishing a later version says whether it asks
985
+ * them again (`readAgain`) or is a small fix. `who` names a `document` field of the object's
986
+ * own, outside `content`, with the schema `MUST_READ_SCHEMA`. `manage` names a permission of
987
+ * this extension's tools that is restricted and grantable: who holds it, and admins, read who
988
+ * has confirmed and change who must read a published record. Not on an object the public or a
989
+ * customer reads. `managed`, `owner` and `notices` (ADR 0706): more fields guarded as who
990
+ * must read is, the user field told weekly who has not confirmed, and the pack's words for the
991
+ * notices the host sends (`AcknowledgeSpec` in `acknowledge.ts`).
992
+ */
993
+ acknowledge?: AcknowledgeSpec;
994
+ /**
995
+ * Staff read (stage 38, ADR 0701): every staff account reads the current published version,
996
+ * never the working copy, through `content.staffGet`, `content.staffList` and `content.search`,
997
+ * pack-role accounts (a coach, a cleaner, the door) included, which read nothing else outside
998
+ * their own pack. What they read is the `content` fields and the slug. Editors still edit the
999
+ * working copy on the record's page.
1000
+ */
1001
+ staffRead?: boolean;
760
1002
  }
761
1003
 
762
1004
  /** An object's customer: see `ObjectSpec.customer`. */
@@ -776,6 +1018,12 @@ export interface CustomerSpec {
776
1018
  * any tool.
777
1019
  */
778
1020
  createOnly?: readonly string[];
1021
+ /**
1022
+ * Whether a customer may put one of their own records in the Trash, through a pack tool's
1023
+ * `my.delete` (ADR 0414, amended 2026-11-24): a logged set ticked by mistake. Left out, they
1024
+ * cannot. A reviewed change, as `customer` is.
1025
+ */
1026
+ delete?: boolean;
779
1027
  /**
780
1028
  * The family link (ADR 0540): a signed-in guardian also reads their live dependants' records of
781
1029
  * this object (a child's bookings), with the same `read` fields. With `write: true` they also
@@ -884,13 +1132,227 @@ export interface ExtensionSpec {
884
1132
  automations?: Record<string, AutomationSpec<any>>;
885
1133
  /** Fixed staff roles an admin can give to a staff account (ADR 0436). */
886
1134
  roles?: Record<string, RoleSpec>;
1135
+ /**
1136
+ * Device roles an admin can enrol a device for (ADR 0781): the business's own tablet, signed in
1137
+ * as nobody, calling only the tools the role holds (`audiences: ["device"]`).
1138
+ */
1139
+ deviceRoles?: Record<string, DeviceRoleSpec>;
887
1140
  /**
888
1141
  * Permissions of this extension's tools (`<id>:<word>`) a human admin may grant to a staff
889
1142
  * account one by one (ADR 0449), on top of its role: a coach who is a member granted the
890
1143
  * permission of a tool a member could not otherwise call. Only shipped extensions and an org's
891
- * own may declare them.
1144
+ * own may declare them. An account holding one of the installed packs' roles may be granted
1145
+ * them too: what it holds is the role and its grants, added up (ADR 0600). A permission one of
1146
+ * this extension's roles holds cannot be grantable (a grant never lifts a role's limits).
892
1147
  */
893
1148
  grantable?: readonly string[];
1149
+ /**
1150
+ * Routine mail (ADR 0590): fixed emails about this extension's records that the host sends
1151
+ * without a person's approval, each a kind an admin can turn off. Only shipped extensions may
1152
+ * declare it, and only their automations send it (`ctx.routineMail.send`).
1153
+ */
1154
+ routineMail?: Record<string, RoutineMailSpec>;
1155
+ /**
1156
+ * Journey signals (stage 53, ADR 0802): moments about a Person that a journey can start or stop
1157
+ * on, each a record of this extension's objects created or entering a state, and the field
1158
+ * naming its Person (`started: { label: "Membership started", object: "membership" }`). The
1159
+ * host records the last time each Person had each one, in the write's own batch. Only shipped
1160
+ * extensions may declare them.
1161
+ */
1162
+ journeySignals?: Record<string, JourneySignalSpec>;
1163
+ /**
1164
+ * What each grantable permission gives, in plain words, shown to the admin who ticks it
1165
+ * (`{ "bookings:desk": "Works the front desk: ..." }`). Absent: the tools it opens are listed.
1166
+ */
1167
+ grantableLabels?: Readonly<Record<string, string>>;
1168
+ /**
1169
+ * Permissions of this extension's tools (`<id>:<word>`) that are **restricted** (stage 45, ADR
1170
+ * 0625): a tool naming one is held by admins, and by a staff account a human admin granted it
1171
+ * (declare it `grantable` too), and by nobody else. Without it, every member holds every tool
1172
+ * (a tool's own permission only adds a way in). For pay totals and rostering other people. A
1173
+ * tool naming a restricted permission names only restricted ones; no role holds one; it is
1174
+ * never called by an automation or another extension's code. Only shipped extensions and an
1175
+ * org's own may declare them.
1176
+ */
1177
+ restricted?: readonly string[];
1178
+ /**
1179
+ * The roster's rules this extension sets for the host (stage 45, ADR 0626): `rosters`, the
1180
+ * restricted permission whose holders roster other people's shifts (with admins: they are the
1181
+ * rosterers the host tells and lets roster), and the number settings of this extension the
1182
+ * host's rules read (the offer cut-off in minutes, the uncovered window in days). Only a
1183
+ * shipped extension or an org's own may declare it.
1184
+ */
1185
+ staffing?: StaffingRulesSpec;
1186
+ /**
1187
+ * The staff screens of a shipped pack (stage 47, ADR 0660), by key: each a web block of this
1188
+ * pack that the product's admin builds in and shows to whoever could call every tool in its
1189
+ * `opens`. Only a shipped pack may declare them: its blocks are code in the repository,
1190
+ * reviewed like the rest of it. A runtime extension declaring `screens` fails `cos ext check`
1191
+ * and install, and the key is ignored at run time.
1192
+ */
1193
+ screens?: Record<string, ScreenSpec>;
1194
+ /**
1195
+ * The numbers a shipped pack adds to the owner's Today (stage 60, ADR 0870), by key: each a
1196
+ * read-only query over `rec_*` views that the host runs for the business's local day and shows
1197
+ * to whoever could call every tool in its `opens`. Not `today`: that names a pack role's limit
1198
+ * (ADR 0553). Only a shipped pack may declare them, at most 8; a runtime extension declaring
1199
+ * `todayItems` fails `cos ext check` and install, and the key is ignored at run time.
1200
+ */
1201
+ todayItems?: Record<string, TodayItemSpec>;
1202
+ /**
1203
+ * The pack's sections of My account (stage 48, ADR 0710), by key: the customer's own area on
1204
+ * the business's website and in its app. Each names a web and a native block of this pack, the
1205
+ * objects whose records mean "this customer has some" (`has`), and where it sits. The host lists
1206
+ * a section to a customer only when they, or a child linked to them where the object opens to
1207
+ * guardians, have one of those records (`me.portal`); `cos add web-account` copies the blocks and
1208
+ * writes the wiring. Only a shipped pack may declare sections: a runtime extension declaring
1209
+ * `portal` fails `cos ext check` and install, and the key is ignored at run time.
1210
+ */
1211
+ portal?: Record<string, PortalSectionSpec>;
1212
+ }
1213
+
1214
+ /**
1215
+ * One section of My account a shipped pack adds (stage 48, ADR 0710). The client app's shell
1216
+ * renders `export` of the block, giving it the pack's hooks under the pack's id (`bookings`,
1217
+ * `memberships`) and the page's `returnUrl`: every other prop of the component is optional.
1218
+ */
1219
+ export interface PortalSectionSpec {
1220
+ /** The section's heading: "Memberships and passes". */
1221
+ label: string;
1222
+ /** The website's block: a web block of this pack, and the component it exports. */
1223
+ web?: { block: string; export: string };
1224
+ /** The app's block: a native block of this pack (`<id>-native-<name>`), and its component. */
1225
+ native?: { block: string; export: string };
1226
+ /**
1227
+ * Where it sits among the sections, lower first: 1 to 59, so a pack's come before the base
1228
+ * sections (Orders at 60 onward).
1229
+ */
1230
+ order: number;
1231
+ /**
1232
+ * This pack's objects (`<id>.<object>`) that declare a customer, whose records mean the
1233
+ * customer has something here: the section shows only then. Never empty: a page anyone may
1234
+ * open ("Buy a pass") is a page the client links to, not a section.
1235
+ */
1236
+ has: readonly string[];
1237
+ }
1238
+
1239
+ /** How a Today item's value is shown. Money is never a pack's: it is the host's (stage 52). */
1240
+ export const TODAY_ITEM_FORMATS = ["count", "percent"] as const;
1241
+ export type TodayItemFormat = (typeof TODAY_ITEM_FORMATS)[number];
1242
+
1243
+ /** What a Today item's value is compared with: the same time yesterday or a week ago, or nothing. */
1244
+ export const TODAY_ITEM_COMPARES = ["yesterday", "lastWeek", "none"] as const;
1245
+ export type TodayItemCompare = (typeof TODAY_ITEM_COMPARES)[number];
1246
+
1247
+ /** The parameters the host binds into a Today item's SQL: the local day `[from, to)` and now. */
1248
+ export const TODAY_ITEM_PARAMS = ["today_from", "today_to", "now"] as const;
1249
+
1250
+ /**
1251
+ * One number a shipped pack adds to Today (stage 60, ADR 0870). The host binds `:today_from`,
1252
+ * `:today_to` (the business's local day, as instants) and `:now`, runs `sql` under the widget
1253
+ * rules (one `SELECT` or `WITH` over `rec_*` views, bound parameters, row and time limits) and
1254
+ * shows its one column, `value`. For the comparison it binds the earlier day's window instead.
1255
+ */
1256
+ export interface TodayItemSpec {
1257
+ /** The card's label: "Came today". */
1258
+ label: string;
1259
+ /** Where it sits among every item on Today (lower first). Default 100. */
1260
+ order?: number;
1261
+ /** `count` or `percent`. No money format: a money number is a Finance reports figure. */
1262
+ format: TodayItemFormat;
1263
+ /** Read-only SQL returning one row with one column, `value`. */
1264
+ sql: string;
1265
+ /** Default `yesterday`. */
1266
+ compare?: TodayItemCompare;
1267
+ /** When the card needs attention: its value above or below a number. Left out, never. */
1268
+ attention?: { above: number } | { below: number };
1269
+ /**
1270
+ * The rows behind the number, at most 50: read-only SQL with the same parameters returning a
1271
+ * display column (`label`), optionally a secondary line (`detail`) and the id of a record of
1272
+ * `record.object` (one of this pack's objects, `person` or `organisation`) in column
1273
+ * `record.id`. Names and record ids only: never notes, health answers, pay or leave.
1274
+ */
1275
+ rows?: {
1276
+ sql: string;
1277
+ label: string;
1278
+ detail?: string;
1279
+ record: { object: string; id: string };
1280
+ };
1281
+ /**
1282
+ * This pack's own tools, every one of which the viewer must be able to call to see the item,
1283
+ * as a screen's `opens` (ADR 0660). At least one is for staff only.
1284
+ */
1285
+ opens: readonly string[];
1286
+ /** On the web, a card opens this screen of the pack (stage 47) rather than its rows. */
1287
+ web?: { screen: string };
1288
+ }
1289
+
1290
+ /**
1291
+ * One staff screen of a shipped pack (stage 47, ADR 0660). The admin renders `export` of the web
1292
+ * block `block` with the pack's hooks, inside its shell; the host lists the screen for a viewer
1293
+ * only when they could call every tool in `opens` (`screens.mine`).
1294
+ */
1295
+ export interface ScreenSpec {
1296
+ /** The screen's name in the navigation and on its page: "Front desk". */
1297
+ label: string;
1298
+ /** A web block of this pack (`packs/<id>/blocks/<block>/`), never a native one. */
1299
+ block: string;
1300
+ /** The component the block exports that renders the screen: "Desk". */
1301
+ export: string;
1302
+ /**
1303
+ * Where it sits in the admin's navigation: a section headed `group`, in `order`. Left out, the
1304
+ * screen is reached only from a record (`record`) or a link.
1305
+ */
1306
+ nav?: { group: string; order?: number };
1307
+ /**
1308
+ * The tools that decide who may open the screen: this pack's own, every one of which the viewer
1309
+ * must be able to call. Name those that decide (the screen's main read and the write its main
1310
+ * action makes), not every tool it calls: the host refuses the rest, and the block shows its own
1311
+ * state for that. "Could call these tools" is the gate, not a separate permission. At least one
1312
+ * is for staff only (never a customer's or the public's tool as the only gate), unless `writes`
1313
+ * gates the screen.
1314
+ */
1315
+ opens?: readonly string[];
1316
+ /**
1317
+ * Objects of this pack the screen writes through the host's record operations rather than a
1318
+ * tool (a builder saving a course): the viewer must be able to write them (`record.update`), so
1319
+ * a viewer or a pack role never gets the screen. Gates beside `opens`; one of the two names
1320
+ * something.
1321
+ */
1322
+ writes?: readonly string[];
1323
+ /**
1324
+ * A record screen: a tab on this object's record page (one of this pack's objects, `person` or
1325
+ * `organisation`), given the record's id as the prop `as`. With `nav` too, it is also listed in
1326
+ * the navigation, opened without a record: its block then chooses one itself.
1327
+ */
1328
+ record?: { object: string; as: string };
1329
+ }
1330
+
1331
+ /** The roster's rules an extension sets for the host (ADR 0626): see `ExtensionSpec.staffing`. */
1332
+ export interface StaffingRulesSpec {
1333
+ /** A restricted permission of this extension's tools: who holds it (and admins) roster. */
1334
+ rosters: string;
1335
+ /**
1336
+ * A restricted, grantable permission of this extension's tools: who holds it (and admins) read
1337
+ * who is counted for pay, the pay periods' totals, and lock, reopen and export them (ADR 0627).
1338
+ */
1339
+ pays?: string;
1340
+ /**
1341
+ * Settings of this extension the host reads, each `personApproves`; the host's defaults when
1342
+ * left out.
1343
+ */
1344
+ settings?: {
1345
+ /** Minutes before a shift starts that offers close (default 60). A number setting. */
1346
+ offerCutoffMinutes?: string;
1347
+ /** Days ahead a shift with nobody on it is warned about and told (default 14). A number. */
1348
+ uncoveredDays?: string;
1349
+ /** The pay period: a select of `weekly`, `fortnightly`, `monthly` (ADR 0627). */
1350
+ payPeriod?: string;
1351
+ /** The local date (YYYY-MM-DD) one weekly or fortnightly period starts: a text setting. */
1352
+ payPeriodStart?: string;
1353
+ /** The day of the month (1 to 28) a monthly period starts: a number setting. */
1354
+ payPeriodDay?: string;
1355
+ };
894
1356
  }
895
1357
 
896
1358
  const EXTENSION = Symbol.for("ops.extension");