@composable-os/pack-programs 0.1.0-beta.10 → 0.1.0-beta.13

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 (31) hide show
  1. package/dist/authoring.d.ts +4 -1
  2. package/dist/authoring.js +65 -5
  3. package/dist/blocks/programs-builder/program-builder.d.ts +12 -3
  4. package/dist/blocks/programs-builder/program-builder.js +16 -3
  5. package/dist/blocks/programs-class-today/class-today.d.ts +1 -1
  6. package/dist/blocks/programs-coach-client/coach-client.d.ts +1 -1
  7. package/dist/blocks/programs-history/history.d.ts +11 -0
  8. package/dist/blocks/programs-history/history.js +84 -0
  9. package/dist/blocks/programs-native-class-today/class-today-screen.js +3 -2
  10. package/dist/blocks/programs-native-coach-client/coach-client-screen.js +2 -2
  11. package/dist/blocks/programs-native-history/history-screen.d.ts +11 -0
  12. package/dist/blocks/programs-native-history/history-screen.js +98 -0
  13. package/dist/blocks/programs-native-progress/progress-screen.js +4 -4
  14. package/dist/blocks/programs-native-session/session-screen.d.ts +6 -2
  15. package/dist/blocks/programs-native-session/session-screen.js +214 -88
  16. package/dist/blocks/programs-native-today/today-screen.d.ts +1 -1
  17. package/dist/blocks/programs-native-today/today-screen.js +22 -3
  18. package/dist/blocks/programs-session/session-view.d.ts +7 -3
  19. package/dist/blocks/programs-session/session-view.js +139 -81
  20. package/dist/blocks/programs-today/today.d.ts +1 -1
  21. package/dist/client/index.d.ts +367 -12
  22. package/dist/client/index.js +393 -12
  23. package/dist/client/logging.d.ts +289 -0
  24. package/dist/client/logging.js +558 -0
  25. package/dist/index.d.ts +152 -6
  26. package/dist/index.js +141 -6
  27. package/dist/layout.d.ts +3 -1
  28. package/dist/layout.js +10 -2
  29. package/dist/tools.d.ts +25 -2
  30. package/dist/tools.js +269 -37
  31. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { type BankExercise, type ImportResult as ProgramTextResult, type ProgramKind, readProgramText, type UnreadLine, } from "./authoring.ts";
2
+ export { type Item, LAYOUT_SCHEMA, type Layout, type Level, type Prescription, type SetTarget, } from "./layout.ts";
1
3
  declare const _default: import("@composable-os/sdk").Extension<{
2
4
  readonly id: "programs";
3
5
  readonly version: "0.1.0";
@@ -218,10 +220,25 @@ declare const _default: import("@composable-os/sdk").Extension<{
218
220
  };
219
221
  };
220
222
  };
223
+ readonly importKey: {
224
+ readonly type: "text";
225
+ readonly label: "Import key";
226
+ readonly readOnly: true;
227
+ readonly description: "The name its text had where it came from: one program per key.";
228
+ };
229
+ readonly importedHash: {
230
+ readonly type: "text";
231
+ readonly label: "Imported content";
232
+ readonly readOnly: true;
233
+ readonly description: "What the text import last wrote, so a re-run never overwrites an edit.";
234
+ };
221
235
  };
222
236
  readonly publishable: {
223
237
  readonly content: readonly ["title", "kind", "theme", "guidance", "layout"];
224
238
  };
239
+ readonly unique: readonly [{
240
+ readonly fields: readonly ["importKey"];
241
+ }];
225
242
  readonly indexes: readonly [readonly ["kind"]];
226
243
  };
227
244
  readonly classtype: {
@@ -337,8 +354,19 @@ declare const _default: import("@composable-os/sdk").Extension<{
337
354
  readonly type: "text";
338
355
  readonly label: "Assigned by (name)";
339
356
  };
357
+ readonly coach: {
358
+ readonly type: "user";
359
+ readonly label: "Coach";
360
+ readonly description: string;
361
+ readonly personApproves: true;
362
+ };
340
363
  };
341
364
  readonly requireOneOf: readonly [readonly ["person", "classType"]];
365
+ readonly team: {
366
+ readonly person: "person";
367
+ readonly staff: readonly ["coach"];
368
+ readonly live: readonly ["generating", "active"];
369
+ };
342
370
  readonly states: {
343
371
  readonly field: "state";
344
372
  readonly initial: "generating";
@@ -371,7 +399,7 @@ declare const _default: import("@composable-os/sdk").Extension<{
371
399
  };
372
400
  };
373
401
  readonly timelineLinks: readonly ["person"];
374
- readonly indexes: readonly [readonly ["person", "state"], readonly ["kind", "state"], readonly ["classType", "state"], readonly ["program"]];
402
+ readonly indexes: readonly [readonly ["person", "state"], readonly ["kind", "state"], readonly ["classType", "state"], readonly ["program"], readonly ["coach", "state"]];
375
403
  };
376
404
  readonly session: {
377
405
  readonly label: "Session";
@@ -390,7 +418,7 @@ declare const _default: import("@composable-os/sdk").Extension<{
390
418
  readonly type: "relation";
391
419
  readonly label: "Assignment";
392
420
  readonly to: "programs.assignment";
393
- readonly required: true;
421
+ readonly description: "Every session but an imported one is an assignment's.";
394
422
  };
395
423
  readonly program: {
396
424
  readonly type: "relation";
@@ -507,7 +535,22 @@ declare const _default: import("@composable-os/sdk").Extension<{
507
535
  readonly type: "text";
508
536
  readonly label: "Marked by (name)";
509
537
  };
538
+ readonly source: {
539
+ readonly type: "select";
540
+ readonly label: "Where it came from";
541
+ readonly description: "Imported: brought in from before the platform; it started nothing when it was.";
542
+ readonly options: readonly [{
543
+ readonly value: "import";
544
+ readonly label: "Imported";
545
+ }];
546
+ };
547
+ readonly imported: {
548
+ readonly type: "formula";
549
+ readonly label: "Imported";
550
+ readonly expression: "coalesce(source, \"\") = \"import\"";
551
+ };
510
552
  };
553
+ readonly requireOneOf: readonly [readonly ["assignment", "source"]];
511
554
  readonly states: {
512
555
  readonly field: "state";
513
556
  readonly initial: "planned";
@@ -523,11 +566,12 @@ declare const _default: import("@composable-os/sdk").Extension<{
523
566
  readonly from: readonly ["done", "skipped"];
524
567
  readonly to: "planned";
525
568
  readonly by: readonly ["staff", "customer"];
569
+ readonly staffOnly: "imported";
526
570
  }];
527
571
  };
528
572
  readonly customer: {
529
573
  readonly field: "person";
530
- readonly read: readonly ["name", "assignment", "program", "programVersion", "kind", "classType", "programTitle", "classTypeName", "date", "week", "day", "position", "focus", "plan", "state", "completedAt"];
574
+ readonly read: readonly ["name", "assignment", "program", "programVersion", "kind", "classType", "programTitle", "classTypeName", "date", "week", "day", "position", "focus", "plan", "state", "completedAt", "source"];
531
575
  readonly write: readonly [];
532
576
  };
533
577
  readonly signedIn: {
@@ -678,11 +722,29 @@ declare const _default: import("@composable-os/sdk").Extension<{
678
722
  readonly type: "text";
679
723
  readonly label: "Recorded by (name)";
680
724
  };
725
+ readonly setKey: {
726
+ readonly type: "text";
727
+ readonly label: "Set key";
728
+ readonly description: string;
729
+ };
730
+ readonly source: {
731
+ readonly type: "select";
732
+ readonly label: "Where it came from";
733
+ readonly description: "Imported: brought in from before the platform; it started nothing when it was.";
734
+ readonly options: readonly [{
735
+ readonly value: "import";
736
+ readonly label: "Imported";
737
+ }];
738
+ };
681
739
  };
740
+ readonly unique: readonly [{
741
+ readonly fields: readonly ["person", "setKey"];
742
+ }];
682
743
  readonly customer: {
683
744
  readonly field: "person";
684
- readonly read: readonly ["label", "session", "assignment", "exercise", "exerciseName", "item", "setNumber", "level", "date", "targetReps", "targetSeconds", "targetLoad", "actualReps", "actualSeconds", "actualLoad", "rpe", "note", "recordedAs", "recordedByName"];
745
+ readonly read: readonly ["label", "session", "assignment", "exercise", "exerciseName", "item", "setNumber", "level", "date", "targetReps", "targetSeconds", "targetLoad", "actualReps", "actualSeconds", "actualLoad", "rpe", "note", "recordedAs", "recordedByName", "source"];
685
746
  readonly write: readonly ["actualReps", "actualSeconds", "actualLoad", "rpe", "note"];
747
+ readonly delete: true;
686
748
  };
687
749
  readonly timelineLinks: readonly ["person"];
688
750
  readonly indexes: readonly [readonly ["person", "exercise", "date"], readonly ["session"], readonly ["exercise", "date"], readonly ["person", "date"]];
@@ -832,6 +894,19 @@ declare const _default: import("@composable-os/sdk").Extension<{
832
894
  readonly order: 41;
833
895
  };
834
896
  };
897
+ readonly roles: {
898
+ readonly coach: {
899
+ readonly label: "Coach";
900
+ readonly description: string;
901
+ readonly permissions: readonly ["programs:coach"];
902
+ readonly read: readonly ["programs.assignment", "programs.session"];
903
+ readonly looksAfter: {
904
+ readonly "programs.assignment": "person";
905
+ readonly "programs.session": "person";
906
+ readonly "programs.log": "person";
907
+ };
908
+ };
909
+ };
835
910
  readonly tools: {
836
911
  readonly assign: import("@composable-os/sdk").ToolSpec<import("zod").ZodObject<{
837
912
  programId: import("zod").ZodString;
@@ -1013,6 +1088,16 @@ declare const _default: import("@composable-os/sdk").Extension<{
1013
1088
  recordedByName: import("zod").ZodNullable<import("zod").ZodString>;
1014
1089
  exerciseName: import("zod").ZodNullable<import("zod").ZodString>;
1015
1090
  }, import("zod/v4/core").$strip>>;
1091
+ readonly logRemove: import("@composable-os/sdk").ToolSpec<import("zod").ZodObject<{
1092
+ sessionId: import("zod").ZodString;
1093
+ item: import("zod").ZodString;
1094
+ exerciseId: import("zod").ZodString;
1095
+ setNumber: import("zod").ZodNumber;
1096
+ personId: import("zod").ZodOptional<import("zod").ZodString>;
1097
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1098
+ removed: import("zod").ZodNumber;
1099
+ waiting: import("zod").ZodNumber;
1100
+ }, import("zod/v4/core").$strip>>;
1016
1101
  readonly logUpdate: import("@composable-os/sdk").ToolSpec<import("zod").ZodObject<{
1017
1102
  logId: import("zod").ZodString;
1018
1103
  actual: import("zod").ZodOptional<import("zod").ZodObject<{
@@ -1158,24 +1243,85 @@ declare const _default: import("@composable-os/sdk").Extension<{
1158
1243
  readonly importText: import("@composable-os/sdk").ToolSpec<import("zod").ZodObject<{
1159
1244
  text: import("zod").ZodString;
1160
1245
  title: import("zod").ZodOptional<import("zod").ZodString>;
1161
- kind: import("zod").ZodDefault<import("zod").ZodEnum<{
1246
+ kind: import("zod").ZodOptional<import("zod").ZodEnum<{
1162
1247
  class: "class";
1163
1248
  client: "client";
1164
1249
  course: "course";
1165
1250
  }>>;
1251
+ key: import("zod").ZodOptional<import("zod").ZodString>;
1252
+ dryRun: import("zod").ZodDefault<import("zod").ZodBoolean>;
1166
1253
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1167
- programId: import("zod").ZodString;
1168
1254
  title: import("zod").ZodString;
1169
1255
  weeks: import("zod").ZodNumber;
1170
1256
  sessions: import("zod").ZodNumber;
1171
1257
  published: import("zod").ZodLiteral<false>;
1258
+ programId: import("zod").ZodNullable<import("zod").ZodString>;
1259
+ outcome: import("zod").ZodEnum<{
1260
+ created: "created";
1261
+ updated: "updated";
1262
+ unchanged: "unchanged";
1263
+ conflict: "conflict";
1264
+ invalid: "invalid";
1265
+ }>;
1172
1266
  items: import("zod").ZodNumber;
1173
1267
  unread: import("zod").ZodArray<import("zod").ZodObject<{
1174
1268
  line: import("zod").ZodNumber;
1175
1269
  text: import("zod").ZodString;
1176
1270
  reason: import("zod").ZodString;
1177
1271
  }, import("zod/v4/core").$strip>>;
1272
+ faults: import("zod").ZodArray<import("zod").ZodObject<{
1273
+ path: import("zod").ZodString;
1274
+ message: import("zod").ZodString;
1275
+ }, import("zod/v4/core").$strip>>;
1178
1276
  }, import("zod/v4/core").$strip>>;
1179
1277
  };
1278
+ readonly screens: {
1279
+ readonly bank: {
1280
+ readonly label: "Exercise bank";
1281
+ readonly block: "programs-bank";
1282
+ readonly export: "ExerciseBank";
1283
+ readonly nav: {
1284
+ readonly group: "Programs";
1285
+ readonly order: 10;
1286
+ };
1287
+ readonly writes: readonly ["programs.exercise"];
1288
+ };
1289
+ readonly builder: {
1290
+ readonly label: "Program builder";
1291
+ readonly block: "programs-builder";
1292
+ readonly export: "ProgramWorkspace";
1293
+ readonly nav: {
1294
+ readonly group: "Programs";
1295
+ readonly order: 20;
1296
+ };
1297
+ readonly opens: readonly ["importText"];
1298
+ readonly writes: readonly ["programs.program"];
1299
+ };
1300
+ readonly client: {
1301
+ readonly label: "Programs";
1302
+ readonly block: "programs-coach-client";
1303
+ readonly export: "CoachClient";
1304
+ readonly opens: readonly ["logAdd", "logRemove", "sessionComplete"];
1305
+ readonly record: {
1306
+ readonly object: "person";
1307
+ readonly as: "personId";
1308
+ };
1309
+ };
1310
+ };
1311
+ readonly portal: {
1312
+ readonly training: {
1313
+ readonly label: "Training";
1314
+ readonly web: {
1315
+ readonly block: "programs-progress";
1316
+ readonly export: "Progress";
1317
+ };
1318
+ readonly native: {
1319
+ readonly block: "programs-native-progress";
1320
+ readonly export: "ProgressScreen";
1321
+ };
1322
+ readonly order: 50;
1323
+ readonly has: readonly ["programs.assignment", "programs.log"];
1324
+ };
1325
+ };
1180
1326
  }>;
1181
1327
  export default _default;
package/dist/index.js CHANGED
@@ -12,12 +12,25 @@
12
12
  // read by every signed-in member (`signedIn`, ADR 0447); the bank and the class types are
13
13
  // read by every signed-in member; a member writes a log only against a session they can see;
14
14
  // - an assignment and a session move through fixed states (`states`), each move made from a
15
- // current read (ADR 0437).
15
+ // current read (ADR 0437);
16
+ // - a session is an assignment's, or one brought in from before by an import (`source`), whose
17
+ // writes start no automation and send no message (the import door, ADR 0470).
16
18
  // The tools in tools.ts compose the host's operations and add no rules of their own.
17
19
  import { defineExtension } from "@composable-os/sdk";
18
20
  import { programsDashboards } from "./dashboards.js";
19
21
  import { LAYOUT_SCHEMA, SESSION_PLAN_SCHEMA } from "./layout.js";
20
- import { assign, classToday, draft, history, importText, logAdd, logUpdate, progress, sessionComplete, sessionGet, today, } from "./tools.js";
22
+ import { assign, classToday, draft, history, importText, logAdd, logRemove, logUpdate, progress, sessionComplete, sessionGet, today, } from "./tools.js";
23
+ // The pack's public entry: its shorthand reader, for an import that reads a folder of programs
24
+ // (`cos programs import`) as `x.programs.importText` reads one.
25
+ export { readProgramText, } from "./authoring.js";
26
+ export { LAYOUT_SCHEMA, } from "./layout.js";
27
+ /** Where a session or a set came from: left empty for the platform's own, `import` for before. */
28
+ const source = {
29
+ type: "select",
30
+ label: "Where it came from",
31
+ description: "Imported: brought in from before the platform; it started nothing when it was.",
32
+ options: [{ value: "import", label: "Imported" }],
33
+ };
21
34
  const kind = {
22
35
  type: "select",
23
36
  label: "For",
@@ -187,8 +200,22 @@ export default defineExtension({
187
200
  maxBytes: 524_288,
188
201
  paths: { weekCount: { label: "Weeks", path: "weeks", count: true } },
189
202
  },
203
+ importKey: {
204
+ type: "text",
205
+ label: "Import key",
206
+ readOnly: true,
207
+ description: "The name its text had where it came from: one program per key.",
208
+ },
209
+ importedHash: {
210
+ type: "text",
211
+ label: "Imported content",
212
+ readOnly: true,
213
+ description: "What the text import last wrote, so a re-run never overwrites an edit.",
214
+ },
190
215
  },
191
216
  publishable: { content: ["title", "kind", "theme", "guidance", "layout"] },
217
+ // `x.programs.importText` with a key: one live program per key, however many run at once.
218
+ unique: [{ fields: ["importKey"] }],
192
219
  indexes: [["kind"]],
193
220
  },
194
221
  classtype: {
@@ -241,8 +268,20 @@ export default defineExtension({
241
268
  },
242
269
  assignedBy: { type: "user", label: "Assigned by" },
243
270
  assignedByName: { type: "text", label: "Assigned by (name)" },
271
+ coach: {
272
+ type: "user",
273
+ label: "Coach",
274
+ description: "Who looks after this client on it. With the coach role, they see and log this " +
275
+ "person's training while it is active, and no one else's. A person chooses it: " +
276
+ "anyone else's change waits for a person.",
277
+ // Who reaches whose training is access (ADR 0889): a person's to set.
278
+ personApproves: true,
279
+ },
244
280
  },
245
281
  requireOneOf: [["person", "classType"]],
282
+ // Who looks after whom (ADR 0831): a client's coach while their program is live. What the
283
+ // coach role reaches through it is the host's (`roles.coach.looksAfter`, ADR 0889).
284
+ team: { person: "person", staff: ["coach"], live: ["generating", "active"] },
246
285
  states: {
247
286
  field: "state",
248
287
  initial: "generating",
@@ -263,7 +302,14 @@ export default defineExtension({
263
302
  },
264
303
  timelineLinks: ["person"],
265
304
  // A member reads their own (person) or the shared (kind): one index for each side of the OR.
266
- indexes: [["person", "state"], ["kind", "state"], ["classType", "state"], ["program"]],
305
+ // The coach's People are read on every call of the coach role: one index for it.
306
+ indexes: [
307
+ ["person", "state"],
308
+ ["kind", "state"],
309
+ ["classType", "state"],
310
+ ["program"],
311
+ ["coach", "state"],
312
+ ],
267
313
  },
268
314
  session: {
269
315
  label: "Session",
@@ -271,7 +317,7 @@ export default defineExtension({
271
317
  icon: "calendar-check",
272
318
  titleField: "name",
273
319
  description: "One dated session of an assignment: its plan as the assigned version had it, and " +
274
- "whether it was done.",
320
+ "whether it was done. Or one done before the platform, brought in by an import.",
275
321
  navigation: "none",
276
322
  fields: {
277
323
  name: { type: "text", label: "Name", required: true },
@@ -279,7 +325,7 @@ export default defineExtension({
279
325
  type: "relation",
280
326
  label: "Assignment",
281
327
  to: "programs.assignment",
282
- required: true,
328
+ description: "Every session but an imported one is an assignment's.",
283
329
  },
284
330
  program: { type: "relation", label: "Program", to: "programs.program" },
285
331
  programVersion: { type: "number", label: "Version", readOnly: true },
@@ -329,14 +375,28 @@ export default defineExtension({
329
375
  completedAt: { type: "datetime", label: "Marked at" },
330
376
  completedBy: { type: "user", label: "Marked by" },
331
377
  completedByName: { type: "text", label: "Marked by (name)" },
378
+ source,
379
+ // Done before the platform: only staff move it back (a member reopening it is not theirs).
380
+ imported: {
381
+ type: "formula",
382
+ label: "Imported",
383
+ expression: 'coalesce(source, "") = "import"',
384
+ },
332
385
  },
386
+ // An assignment's, or brought in from before (`source: import`).
387
+ requireOneOf: [["assignment", "source"]],
333
388
  states: {
334
389
  field: "state",
335
390
  initial: "planned",
336
391
  moves: [
337
392
  { from: "planned", to: "done", by: ["staff", "customer"] },
338
393
  { from: "planned", to: "skipped", by: ["staff", "customer"] },
339
- { from: ["done", "skipped"], to: "planned", by: ["staff", "customer"] },
394
+ {
395
+ from: ["done", "skipped"],
396
+ to: "planned",
397
+ by: ["staff", "customer"],
398
+ staffOnly: "imported",
399
+ },
340
400
  ],
341
401
  },
342
402
  customer: {
@@ -359,6 +419,7 @@ export default defineExtension({
359
419
  "plan",
360
420
  "state",
361
421
  "completedAt",
422
+ "source",
362
423
  ],
363
424
  write: [],
364
425
  },
@@ -438,7 +499,18 @@ export default defineExtension({
438
499
  },
439
500
  recordedBy: { type: "user", label: "Recorded by (coach)" },
440
501
  recordedByName: { type: "text", label: "Recorded by (name)" },
502
+ setKey: {
503
+ type: "text",
504
+ label: "Set key",
505
+ description: "Session, item, exercise and set number: one row per set and person, however many " +
506
+ "saves of it arrive.",
507
+ },
508
+ source,
441
509
  },
510
+ // One row per set and person (ADR 0448, amended 2026-11-24): a retried save, or two at once,
511
+ // changes the set instead of logging it twice. Rows logged before the key have none and are
512
+ // not counted; `x.programs.logAdd` finds those by their fields.
513
+ unique: [{ fields: ["person", "setKey"] }],
442
514
  customer: {
443
515
  field: "person",
444
516
  read: [
@@ -461,8 +533,11 @@ export default defineExtension({
461
533
  "note",
462
534
  "recordedAs",
463
535
  "recordedByName",
536
+ "source",
464
537
  ],
465
538
  write: ["actualReps", "actualSeconds", "actualLoad", "rpe", "note"],
539
+ // A set ticked by mistake is taken back (`x.programs.logRemove`): to the Trash.
540
+ delete: true,
466
541
  },
467
542
  timelineLinks: ["person"],
468
543
  indexes: [
@@ -594,12 +669,32 @@ export default defineExtension({
594
669
  order: 41,
595
670
  },
596
671
  },
672
+ // The coach role (ADR 0889): a coach's own clients, in the app: their sessions and sets, logging
673
+ // and marking for them, their history and progress. Only the People an active assignment names
674
+ // them coach of; nothing else: no class sessions, no programs or the builder, no assigning, no
675
+ // people, no settings.
676
+ roles: {
677
+ coach: {
678
+ label: "Coach",
679
+ description: "Sees the clients they coach (an active program naming them their coach): their " +
680
+ "sessions, sets, history and progress, and logs sets and marks sessions for them. " +
681
+ "Nothing else: no other clients, no class sessions, no programs, no assigning, no people.",
682
+ permissions: ["programs:coach"],
683
+ read: ["programs.assignment", "programs.session"],
684
+ looksAfter: {
685
+ "programs.assignment": "person",
686
+ "programs.session": "person",
687
+ "programs.log": "person",
688
+ },
689
+ },
690
+ },
597
691
  tools: {
598
692
  assign,
599
693
  today,
600
694
  sessionGet,
601
695
  classToday,
602
696
  logAdd,
697
+ logRemove,
603
698
  logUpdate,
604
699
  sessionComplete,
605
700
  history,
@@ -607,4 +702,44 @@ export default defineExtension({
607
702
  draft,
608
703
  importText,
609
704
  },
705
+ // Staff screens in the product's admin (stage 47, ADR 0660), each gated by what it writes or
706
+ // calls: the bank its exercises and the builder its programs (core record writes: any member,
707
+ // never a viewer or a pack role), the builder's import too; the client view, a tab on Person, by
708
+ // logging and completing a client's sessions (`programs:coach`, which the coach role holds too,
709
+ // ADR 0889; the role never opens a Person's page).
710
+ screens: {
711
+ bank: {
712
+ label: "Exercise bank",
713
+ block: "programs-bank",
714
+ export: "ExerciseBank",
715
+ nav: { group: "Programs", order: 10 },
716
+ writes: ["programs.exercise"],
717
+ },
718
+ builder: {
719
+ label: "Program builder",
720
+ block: "programs-builder",
721
+ export: "ProgramWorkspace",
722
+ nav: { group: "Programs", order: 20 },
723
+ opens: ["importText"],
724
+ writes: ["programs.program"],
725
+ },
726
+ client: {
727
+ label: "Programs",
728
+ block: "programs-coach-client",
729
+ export: "CoachClient",
730
+ opens: ["logAdd", "logRemove", "sessionComplete"],
731
+ record: { object: "person", as: "personId" },
732
+ },
733
+ },
734
+ // Its section of My account (stage 48, ADR 0710): a member's progress, shown once they have a
735
+ // program or a logged set.
736
+ portal: {
737
+ training: {
738
+ label: "Training",
739
+ web: { block: "programs-progress", export: "Progress" },
740
+ native: { block: "programs-native-progress", export: "ProgressScreen" },
741
+ order: 50,
742
+ has: ["programs.assignment", "programs.log"],
743
+ },
744
+ },
610
745
  });
package/dist/layout.d.ts CHANGED
@@ -51,6 +51,8 @@ export type Item = {
51
51
  } | {
52
52
  kind: "levels";
53
53
  label: string;
54
+ /** Done by everyone beside the levels. */
55
+ exercises?: Prescription[];
54
56
  levels: Level[];
55
57
  notes?: Note[];
56
58
  };
@@ -80,7 +82,7 @@ export interface Layout {
80
82
  }
81
83
  /** The exercises of a level, whatever its mode. */
82
84
  export declare function levelExercises(level: Level): Prescription[];
83
- /** Every prescription of a session, with the item label and level it is under. */
85
+ /** Every prescription of a session, with the item label and level it is under (null: everyone's). */
84
86
  export declare function prescriptions(session: Session): {
85
87
  item: string;
86
88
  level: number | null;
package/dist/layout.js CHANGED
@@ -149,9 +149,14 @@ const ITEM = {
149
149
  },
150
150
  levels: {
151
151
  type: "object",
152
- description: "Up to five levels, possibly sparse (only 1 and 5)",
152
+ description: "Up to five levels, possibly sparse (only 1 and 5), and optionally exercises for everyone",
153
153
  fields: {
154
154
  label: { type: "text", min: 1, max: 6 },
155
+ exercises: {
156
+ ...EXERCISES(1),
157
+ optional: true,
158
+ description: "Done by everyone, whatever level they take",
159
+ },
155
160
  levels: {
156
161
  type: "array",
157
162
  min: 1,
@@ -246,7 +251,7 @@ export const SESSION_PLAN_SCHEMA = { defs: DEFS, root: SESSION };
246
251
  export function levelExercises(level) {
247
252
  return level.mode === "one" ? [level.exercise] : level.exercises;
248
253
  }
249
- /** Every prescription of a session, with the item label and level it is under. */
254
+ /** Every prescription of a session, with the item label and level it is under (null: everyone's). */
250
255
  export function prescriptions(session) {
251
256
  const out = [];
252
257
  for (const block of session.blocks) {
@@ -256,6 +261,9 @@ export function prescriptions(session) {
256
261
  out.push({ item: item.label, level: null, prescription: p });
257
262
  }
258
263
  else {
264
+ for (const p of item.exercises ?? []) {
265
+ out.push({ item: item.label, level: null, prescription: p });
266
+ }
259
267
  for (const level of item.levels) {
260
268
  for (const p of levelExercises(level)) {
261
269
  out.push({ item: item.label, level: level.level, prescription: p });
package/dist/tools.d.ts CHANGED
@@ -210,6 +210,16 @@ export declare const logUpdate: import("@composable-os/sdk").ToolSpec<z.ZodObjec
210
210
  recordedByName: z.ZodNullable<z.ZodString>;
211
211
  exerciseName: z.ZodNullable<z.ZodString>;
212
212
  }, z.core.$strip>>;
213
+ export declare const logRemove: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
214
+ sessionId: z.ZodString;
215
+ item: z.ZodString;
216
+ exerciseId: z.ZodString;
217
+ setNumber: z.ZodNumber;
218
+ personId: z.ZodOptional<z.ZodString>;
219
+ }, z.core.$strip>, z.ZodObject<{
220
+ removed: z.ZodNumber;
221
+ waiting: z.ZodNumber;
222
+ }, z.core.$strip>>;
213
223
  export declare const sessionComplete: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
214
224
  sessionId: z.ZodString;
215
225
  state: z.ZodDefault<z.ZodEnum<{
@@ -324,21 +334,34 @@ export declare const draft: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
324
334
  export declare const importText: import("@composable-os/sdk").ToolSpec<z.ZodObject<{
325
335
  text: z.ZodString;
326
336
  title: z.ZodOptional<z.ZodString>;
327
- kind: z.ZodDefault<z.ZodEnum<{
337
+ kind: z.ZodOptional<z.ZodEnum<{
328
338
  class: "class";
329
339
  client: "client";
330
340
  course: "course";
331
341
  }>>;
342
+ key: z.ZodOptional<z.ZodString>;
343
+ dryRun: z.ZodDefault<z.ZodBoolean>;
332
344
  }, z.core.$strip>, z.ZodObject<{
333
- programId: z.ZodString;
334
345
  title: z.ZodString;
335
346
  weeks: z.ZodNumber;
336
347
  sessions: z.ZodNumber;
337
348
  published: z.ZodLiteral<false>;
349
+ programId: z.ZodNullable<z.ZodString>;
350
+ outcome: z.ZodEnum<{
351
+ created: "created";
352
+ updated: "updated";
353
+ unchanged: "unchanged";
354
+ conflict: "conflict";
355
+ invalid: "invalid";
356
+ }>;
338
357
  items: z.ZodNumber;
339
358
  unread: z.ZodArray<z.ZodObject<{
340
359
  line: z.ZodNumber;
341
360
  text: z.ZodString;
342
361
  reason: z.ZodString;
343
362
  }, z.core.$strip>>;
363
+ faults: z.ZodArray<z.ZodObject<{
364
+ path: z.ZodString;
365
+ message: z.ZodString;
366
+ }, z.core.$strip>>;
344
367
  }, z.core.$strip>>;