@happyvertical/smrt-education 0.57.41 → 0.57.43
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.
- package/AGENTS.md +8 -0
- package/README.md +10 -0
- package/agents/group-sharing.md +278 -0
- package/agents/submission-service.md +10 -0
- package/dist/chunks/{workbook-photo-service-D5DUgh-C.js → workbook-photo-service-C6mbUUp6.js} +196 -65
- package/dist/chunks/workbook-photo-service-C6mbUUp6.js.map +1 -0
- package/dist/group-sharing-authorization.d.ts +67 -0
- package/dist/group-sharing-authorization.d.ts.map +1 -0
- package/dist/group-sharing-comments.d.ts +30 -0
- package/dist/group-sharing-comments.d.ts.map +1 -0
- package/dist/group-sharing-contracts.d.ts +201 -0
- package/dist/group-sharing-contracts.d.ts.map +1 -0
- package/dist/group-sharing-hash.d.ts +3 -0
- package/dist/group-sharing-hash.d.ts.map +1 -0
- package/dist/group-sharing-models.d.ts +106 -0
- package/dist/group-sharing-models.d.ts.map +1 -0
- package/dist/group-sharing-policy.d.ts +19 -0
- package/dist/group-sharing-policy.d.ts.map +1 -0
- package/dist/group-sharing-reader.d.ts +45 -0
- package/dist/group-sharing-reader.d.ts.map +1 -0
- package/dist/group-sharing-service.d.ts +108 -0
- package/dist/group-sharing-service.d.ts.map +1 -0
- package/dist/group-sharing-workspace.d.ts +10 -0
- package/dist/group-sharing-workspace.d.ts.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2032 -69
- package/dist/index.js.map +1 -1
- package/dist/ingestion.js +1 -1
- package/dist/manifest.json +2728 -1
- package/dist/recipes.d.ts +24 -0
- package/dist/recipes.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +1073 -12
- package/dist/submission-service.d.ts +2 -0
- package/dist/submission-service.d.ts.map +1 -1
- package/dist/workbook-service.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/chunks/workbook-photo-service-D5DUgh-C.js.map +0 -1
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-education",
|
|
6
|
-
"packageVersion": "0.57.
|
|
6
|
+
"packageVersion": "0.57.43",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
12
|
-
"agents": "
|
|
10
|
+
"manifest": "a6eecbfc912820d770a18d8af829874050f6b2aaf34833498305bdd8cacaecbe",
|
|
11
|
+
"packageJson": "e1037bf3b5afdceef3aa1628b2da1f2d18638240e148d1ab7d03b98dad2e8eb4",
|
|
12
|
+
"agents": "b61bd938822fa5be0b0c347da449b315ce4153ea104c5fadf3deb7901f6b885d",
|
|
13
13
|
"moduleDoc:agents/learner-service.md": "7da70d214547eb78fbf058e997599cc80ab86f5bb55748bd158a9a4b30070d3b",
|
|
14
|
-
"moduleDoc:agents/submission-service.md": "
|
|
14
|
+
"moduleDoc:agents/submission-service.md": "ae22d789d5e6a695787a2c64bf6720430c91196aab2bbc2892f831b3155bb1ce",
|
|
15
15
|
"moduleDoc:agents/workbook-service.md": "ae3a0f208b42766e417eac226e4a24ec15fe17c1ba9cde26a325ded982614278",
|
|
16
16
|
"moduleDoc:agents/photo-intake.md": "3b7057201ee30b2361aad23ea52e8a55c8ed5354e7a7e4a8193b7de17ca2f0db",
|
|
17
17
|
"moduleDoc:agents/source-import.md": "30ee823589d655442bcf1abcd86a2132172065b4bc5e3c4d89b1e8b7afcc66bc",
|
|
18
18
|
"moduleDoc:agents/family-intake.md": "540b6d37f438496acb0208b6ac7258264e2142bce3d2f986967b7741606fe4f7",
|
|
19
19
|
"moduleDoc:agents/catalog-previews.md": "5f4e0352274009b3ce00408017a16666036d24df695a7078c27317ba4e66f0a7",
|
|
20
|
-
"moduleDoc:agents/learner-plan.md": "2f2bc5b7e1f55a382c54c12187173790c14716029ad0b8ae7bbb04393bc2a2e5"
|
|
20
|
+
"moduleDoc:agents/learner-plan.md": "2f2bc5b7e1f55a382c54c12187173790c14716029ad0b8ae7bbb04393bc2a2e5",
|
|
21
|
+
"moduleDoc:agents/group-sharing.md": "3d352f511bcaa8996e25fb0b0a4dabd88db432ba7e9092593096b2bfd83acfc3"
|
|
21
22
|
},
|
|
22
23
|
"exports": [
|
|
23
24
|
".",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"smrt"
|
|
63
64
|
],
|
|
64
65
|
"risks": [
|
|
65
|
-
"cross-package-refs:
|
|
66
|
+
"cross-package-refs:21",
|
|
66
67
|
"sensitive-fields-excluded",
|
|
67
68
|
"sti-inheritance"
|
|
68
69
|
],
|
|
@@ -3184,6 +3185,1016 @@
|
|
|
3184
3185
|
"tags": [],
|
|
3185
3186
|
"risks": []
|
|
3186
3187
|
},
|
|
3188
|
+
{
|
|
3189
|
+
"name": "EducationGroup",
|
|
3190
|
+
"qualifiedName": "@happyvertical/smrt-education:EducationGroup",
|
|
3191
|
+
"displayLabelField": "name",
|
|
3192
|
+
"collection": "educationgroups",
|
|
3193
|
+
"description": "Independent group tenant metadata; no family authority is implied.",
|
|
3194
|
+
"tableName": "education_groups",
|
|
3195
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3196
|
+
"extends": "SmrtObject",
|
|
3197
|
+
"fields": [
|
|
3198
|
+
{
|
|
3199
|
+
"name": "tenantId",
|
|
3200
|
+
"type": "text",
|
|
3201
|
+
"required": true,
|
|
3202
|
+
"columnType": "UUID"
|
|
3203
|
+
},
|
|
3204
|
+
{
|
|
3205
|
+
"name": "name",
|
|
3206
|
+
"type": "text",
|
|
3207
|
+
"required": false,
|
|
3208
|
+
"columnType": "TEXT"
|
|
3209
|
+
},
|
|
3210
|
+
{
|
|
3211
|
+
"name": "active",
|
|
3212
|
+
"type": "boolean",
|
|
3213
|
+
"required": true,
|
|
3214
|
+
"columnType": "BOOLEAN",
|
|
3215
|
+
"default": true
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
"name": "creatorUserId",
|
|
3219
|
+
"type": "crossPackageRef",
|
|
3220
|
+
"required": true,
|
|
3221
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3222
|
+
"columnType": "UUID"
|
|
3223
|
+
},
|
|
3224
|
+
{
|
|
3225
|
+
"name": "creatorProfileId",
|
|
3226
|
+
"type": "crossPackageRef",
|
|
3227
|
+
"required": true,
|
|
3228
|
+
"related": "@happyvertical/smrt-profiles:Profile",
|
|
3229
|
+
"columnType": "UUID"
|
|
3230
|
+
}
|
|
3231
|
+
],
|
|
3232
|
+
"relationships": [
|
|
3233
|
+
{
|
|
3234
|
+
"name": "creatorUserId",
|
|
3235
|
+
"type": "crossPackageRef",
|
|
3236
|
+
"required": true,
|
|
3237
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3238
|
+
"columnType": "UUID"
|
|
3239
|
+
},
|
|
3240
|
+
{
|
|
3241
|
+
"name": "creatorProfileId",
|
|
3242
|
+
"type": "crossPackageRef",
|
|
3243
|
+
"required": true,
|
|
3244
|
+
"related": "@happyvertical/smrt-profiles:Profile",
|
|
3245
|
+
"columnType": "UUID"
|
|
3246
|
+
}
|
|
3247
|
+
],
|
|
3248
|
+
"methods": [
|
|
3249
|
+
"delete",
|
|
3250
|
+
"save"
|
|
3251
|
+
],
|
|
3252
|
+
"methodSignatures": [
|
|
3253
|
+
{
|
|
3254
|
+
"name": "delete",
|
|
3255
|
+
"async": true,
|
|
3256
|
+
"returns": "Promise<void>"
|
|
3257
|
+
},
|
|
3258
|
+
{
|
|
3259
|
+
"name": "save",
|
|
3260
|
+
"async": true,
|
|
3261
|
+
"params": [
|
|
3262
|
+
"options?: SmrtSaveOptions"
|
|
3263
|
+
],
|
|
3264
|
+
"returns": "Promise<this>"
|
|
3265
|
+
}
|
|
3266
|
+
],
|
|
3267
|
+
"tenant": {
|
|
3268
|
+
"scoped": true,
|
|
3269
|
+
"mode": "required",
|
|
3270
|
+
"field": "tenantId"
|
|
3271
|
+
},
|
|
3272
|
+
"conflictColumns": [
|
|
3273
|
+
"tenant_id"
|
|
3274
|
+
],
|
|
3275
|
+
"surfaces": [],
|
|
3276
|
+
"withheldSurfaces": [
|
|
3277
|
+
{
|
|
3278
|
+
"kind": "api",
|
|
3279
|
+
"operation": "delete",
|
|
3280
|
+
"code": "api-disabled",
|
|
3281
|
+
"reason": "api is disabled",
|
|
3282
|
+
"objectName": "@happyvertical/smrt-education:EducationGroup"
|
|
3283
|
+
},
|
|
3284
|
+
{
|
|
3285
|
+
"kind": "api",
|
|
3286
|
+
"operation": "save",
|
|
3287
|
+
"code": "api-disabled",
|
|
3288
|
+
"reason": "api is disabled",
|
|
3289
|
+
"objectName": "@happyvertical/smrt-education:EducationGroup"
|
|
3290
|
+
}
|
|
3291
|
+
],
|
|
3292
|
+
"relationshipFeatures": [
|
|
3293
|
+
"crossPackageRef",
|
|
3294
|
+
"uuidColumns"
|
|
3295
|
+
],
|
|
3296
|
+
"tags": [],
|
|
3297
|
+
"risks": []
|
|
3298
|
+
},
|
|
3299
|
+
{
|
|
3300
|
+
"name": "EducationGroupCollection",
|
|
3301
|
+
"qualifiedName": "@happyvertical/smrt-education:EducationGroupCollection",
|
|
3302
|
+
"collection": "educationgroups",
|
|
3303
|
+
"tableName": "education_groups",
|
|
3304
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3305
|
+
"extends": "SmrtCollection",
|
|
3306
|
+
"fields": [],
|
|
3307
|
+
"relationships": [],
|
|
3308
|
+
"methods": [],
|
|
3309
|
+
"surfaces": [],
|
|
3310
|
+
"relationshipFeatures": [
|
|
3311
|
+
"uuidColumns"
|
|
3312
|
+
],
|
|
3313
|
+
"tags": [],
|
|
3314
|
+
"risks": []
|
|
3315
|
+
},
|
|
3316
|
+
{
|
|
3317
|
+
"name": "GroupLearnerInvitation",
|
|
3318
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupLearnerInvitation",
|
|
3319
|
+
"collection": "grouplearnerinvitations",
|
|
3320
|
+
"description": "Group-owned target selectors are opaque until the exact parent accepts.",
|
|
3321
|
+
"tableName": "group_learner_invitations",
|
|
3322
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3323
|
+
"extends": "SmrtObject",
|
|
3324
|
+
"fields": [
|
|
3325
|
+
{
|
|
3326
|
+
"name": "tenantId",
|
|
3327
|
+
"type": "text",
|
|
3328
|
+
"required": true,
|
|
3329
|
+
"columnType": "UUID"
|
|
3330
|
+
},
|
|
3331
|
+
{
|
|
3332
|
+
"name": "groupId",
|
|
3333
|
+
"type": "foreignKey",
|
|
3334
|
+
"required": true,
|
|
3335
|
+
"related": "EducationGroup",
|
|
3336
|
+
"columnType": "UUID"
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
"name": "familyTenantId",
|
|
3340
|
+
"type": "crossPackageRef",
|
|
3341
|
+
"required": true,
|
|
3342
|
+
"related": "@happyvertical/smrt-users:Tenant",
|
|
3343
|
+
"columnType": "UUID"
|
|
3344
|
+
},
|
|
3345
|
+
{
|
|
3346
|
+
"name": "learnerId",
|
|
3347
|
+
"type": "text",
|
|
3348
|
+
"required": true,
|
|
3349
|
+
"columnType": "UUID"
|
|
3350
|
+
},
|
|
3351
|
+
{
|
|
3352
|
+
"name": "invitedParentUserId",
|
|
3353
|
+
"type": "crossPackageRef",
|
|
3354
|
+
"required": true,
|
|
3355
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3356
|
+
"columnType": "UUID"
|
|
3357
|
+
},
|
|
3358
|
+
{
|
|
3359
|
+
"name": "creatorUserId",
|
|
3360
|
+
"type": "crossPackageRef",
|
|
3361
|
+
"required": true,
|
|
3362
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3363
|
+
"columnType": "UUID"
|
|
3364
|
+
},
|
|
3365
|
+
{
|
|
3366
|
+
"name": "expiresAt",
|
|
3367
|
+
"type": "text",
|
|
3368
|
+
"required": false,
|
|
3369
|
+
"columnType": "TEXT"
|
|
3370
|
+
},
|
|
3371
|
+
{
|
|
3372
|
+
"name": "status",
|
|
3373
|
+
"type": "text",
|
|
3374
|
+
"required": false,
|
|
3375
|
+
"columnType": "TEXT",
|
|
3376
|
+
"default": "pending"
|
|
3377
|
+
},
|
|
3378
|
+
{
|
|
3379
|
+
"name": "acceptedMembershipId",
|
|
3380
|
+
"type": "foreignKey",
|
|
3381
|
+
"required": false,
|
|
3382
|
+
"related": "GroupLearnerMembership",
|
|
3383
|
+
"columnType": "UUID"
|
|
3384
|
+
},
|
|
3385
|
+
{
|
|
3386
|
+
"name": "acceptedPolicyDigest",
|
|
3387
|
+
"type": "text",
|
|
3388
|
+
"required": false,
|
|
3389
|
+
"columnType": "TEXT"
|
|
3390
|
+
}
|
|
3391
|
+
],
|
|
3392
|
+
"relationships": [
|
|
3393
|
+
{
|
|
3394
|
+
"name": "groupId",
|
|
3395
|
+
"type": "foreignKey",
|
|
3396
|
+
"required": true,
|
|
3397
|
+
"related": "EducationGroup",
|
|
3398
|
+
"columnType": "UUID"
|
|
3399
|
+
},
|
|
3400
|
+
{
|
|
3401
|
+
"name": "familyTenantId",
|
|
3402
|
+
"type": "crossPackageRef",
|
|
3403
|
+
"required": true,
|
|
3404
|
+
"related": "@happyvertical/smrt-users:Tenant",
|
|
3405
|
+
"columnType": "UUID"
|
|
3406
|
+
},
|
|
3407
|
+
{
|
|
3408
|
+
"name": "invitedParentUserId",
|
|
3409
|
+
"type": "crossPackageRef",
|
|
3410
|
+
"required": true,
|
|
3411
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3412
|
+
"columnType": "UUID"
|
|
3413
|
+
},
|
|
3414
|
+
{
|
|
3415
|
+
"name": "creatorUserId",
|
|
3416
|
+
"type": "crossPackageRef",
|
|
3417
|
+
"required": true,
|
|
3418
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3419
|
+
"columnType": "UUID"
|
|
3420
|
+
},
|
|
3421
|
+
{
|
|
3422
|
+
"name": "acceptedMembershipId",
|
|
3423
|
+
"type": "foreignKey",
|
|
3424
|
+
"required": false,
|
|
3425
|
+
"related": "GroupLearnerMembership",
|
|
3426
|
+
"columnType": "UUID"
|
|
3427
|
+
}
|
|
3428
|
+
],
|
|
3429
|
+
"methods": [
|
|
3430
|
+
"delete",
|
|
3431
|
+
"save"
|
|
3432
|
+
],
|
|
3433
|
+
"methodSignatures": [
|
|
3434
|
+
{
|
|
3435
|
+
"name": "delete",
|
|
3436
|
+
"async": true,
|
|
3437
|
+
"returns": "Promise<void>"
|
|
3438
|
+
},
|
|
3439
|
+
{
|
|
3440
|
+
"name": "save",
|
|
3441
|
+
"async": true,
|
|
3442
|
+
"params": [
|
|
3443
|
+
"options?: SmrtSaveOptions"
|
|
3444
|
+
],
|
|
3445
|
+
"returns": "Promise<this>"
|
|
3446
|
+
}
|
|
3447
|
+
],
|
|
3448
|
+
"tenant": {
|
|
3449
|
+
"scoped": true,
|
|
3450
|
+
"mode": "required",
|
|
3451
|
+
"field": "tenantId"
|
|
3452
|
+
},
|
|
3453
|
+
"conflictColumns": [
|
|
3454
|
+
"tenant_id",
|
|
3455
|
+
"slug",
|
|
3456
|
+
"context"
|
|
3457
|
+
],
|
|
3458
|
+
"surfaces": [],
|
|
3459
|
+
"withheldSurfaces": [
|
|
3460
|
+
{
|
|
3461
|
+
"kind": "api",
|
|
3462
|
+
"operation": "delete",
|
|
3463
|
+
"code": "api-disabled",
|
|
3464
|
+
"reason": "api is disabled",
|
|
3465
|
+
"objectName": "@happyvertical/smrt-education:GroupLearnerInvitation"
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
"kind": "api",
|
|
3469
|
+
"operation": "save",
|
|
3470
|
+
"code": "api-disabled",
|
|
3471
|
+
"reason": "api is disabled",
|
|
3472
|
+
"objectName": "@happyvertical/smrt-education:GroupLearnerInvitation"
|
|
3473
|
+
}
|
|
3474
|
+
],
|
|
3475
|
+
"relationshipFeatures": [
|
|
3476
|
+
"crossPackageRef",
|
|
3477
|
+
"foreignKey",
|
|
3478
|
+
"uuidColumns"
|
|
3479
|
+
],
|
|
3480
|
+
"tags": [],
|
|
3481
|
+
"risks": []
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
"name": "GroupLearnerInvitationCollection",
|
|
3485
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupLearnerInvitationCollection",
|
|
3486
|
+
"collection": "grouplearnerinvitations",
|
|
3487
|
+
"tableName": "group_learner_invitations",
|
|
3488
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3489
|
+
"extends": "SmrtCollection",
|
|
3490
|
+
"fields": [],
|
|
3491
|
+
"relationships": [],
|
|
3492
|
+
"methods": [],
|
|
3493
|
+
"surfaces": [],
|
|
3494
|
+
"relationshipFeatures": [
|
|
3495
|
+
"uuidColumns"
|
|
3496
|
+
],
|
|
3497
|
+
"tags": [],
|
|
3498
|
+
"risks": []
|
|
3499
|
+
},
|
|
3500
|
+
{
|
|
3501
|
+
"name": "GroupLearnerMembership",
|
|
3502
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupLearnerMembership",
|
|
3503
|
+
"collection": "grouplearnermemberships",
|
|
3504
|
+
"description": "Family-owned per-child consent edge, never a users membership.",
|
|
3505
|
+
"tableName": "group_learner_memberships",
|
|
3506
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3507
|
+
"extends": "SmrtObject",
|
|
3508
|
+
"fields": [
|
|
3509
|
+
{
|
|
3510
|
+
"name": "tenantId",
|
|
3511
|
+
"type": "text",
|
|
3512
|
+
"required": true,
|
|
3513
|
+
"columnType": "UUID"
|
|
3514
|
+
},
|
|
3515
|
+
{
|
|
3516
|
+
"name": "groupId",
|
|
3517
|
+
"type": "foreignKey",
|
|
3518
|
+
"required": true,
|
|
3519
|
+
"related": "EducationGroup",
|
|
3520
|
+
"columnType": "UUID"
|
|
3521
|
+
},
|
|
3522
|
+
{
|
|
3523
|
+
"name": "learnerId",
|
|
3524
|
+
"type": "foreignKey",
|
|
3525
|
+
"required": true,
|
|
3526
|
+
"related": "Learner",
|
|
3527
|
+
"columnType": "UUID"
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
"name": "consentParentUserId",
|
|
3531
|
+
"type": "crossPackageRef",
|
|
3532
|
+
"required": true,
|
|
3533
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3534
|
+
"columnType": "UUID"
|
|
3535
|
+
},
|
|
3536
|
+
{
|
|
3537
|
+
"name": "status",
|
|
3538
|
+
"type": "text",
|
|
3539
|
+
"required": false,
|
|
3540
|
+
"columnType": "TEXT",
|
|
3541
|
+
"default": "active"
|
|
3542
|
+
},
|
|
3543
|
+
{
|
|
3544
|
+
"name": "policyVersion",
|
|
3545
|
+
"type": "integer",
|
|
3546
|
+
"required": true,
|
|
3547
|
+
"columnType": "INTEGER",
|
|
3548
|
+
"default": 1,
|
|
3549
|
+
"constraints": {
|
|
3550
|
+
"min": 1
|
|
3551
|
+
}
|
|
3552
|
+
}
|
|
3553
|
+
],
|
|
3554
|
+
"relationships": [
|
|
3555
|
+
{
|
|
3556
|
+
"name": "groupId",
|
|
3557
|
+
"type": "foreignKey",
|
|
3558
|
+
"required": true,
|
|
3559
|
+
"related": "EducationGroup",
|
|
3560
|
+
"columnType": "UUID"
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
"name": "learnerId",
|
|
3564
|
+
"type": "foreignKey",
|
|
3565
|
+
"required": true,
|
|
3566
|
+
"related": "Learner",
|
|
3567
|
+
"columnType": "UUID"
|
|
3568
|
+
},
|
|
3569
|
+
{
|
|
3570
|
+
"name": "consentParentUserId",
|
|
3571
|
+
"type": "crossPackageRef",
|
|
3572
|
+
"required": true,
|
|
3573
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3574
|
+
"columnType": "UUID"
|
|
3575
|
+
}
|
|
3576
|
+
],
|
|
3577
|
+
"methods": [
|
|
3578
|
+
"delete",
|
|
3579
|
+
"save"
|
|
3580
|
+
],
|
|
3581
|
+
"methodSignatures": [
|
|
3582
|
+
{
|
|
3583
|
+
"name": "delete",
|
|
3584
|
+
"async": true,
|
|
3585
|
+
"returns": "Promise<void>"
|
|
3586
|
+
},
|
|
3587
|
+
{
|
|
3588
|
+
"name": "save",
|
|
3589
|
+
"async": true,
|
|
3590
|
+
"params": [
|
|
3591
|
+
"options?: SmrtSaveOptions"
|
|
3592
|
+
],
|
|
3593
|
+
"returns": "Promise<this>"
|
|
3594
|
+
}
|
|
3595
|
+
],
|
|
3596
|
+
"tenant": {
|
|
3597
|
+
"scoped": true,
|
|
3598
|
+
"mode": "required",
|
|
3599
|
+
"field": "tenantId"
|
|
3600
|
+
},
|
|
3601
|
+
"conflictColumns": [
|
|
3602
|
+
"tenant_id",
|
|
3603
|
+
"learner_id",
|
|
3604
|
+
"group_id"
|
|
3605
|
+
],
|
|
3606
|
+
"surfaces": [],
|
|
3607
|
+
"withheldSurfaces": [
|
|
3608
|
+
{
|
|
3609
|
+
"kind": "api",
|
|
3610
|
+
"operation": "delete",
|
|
3611
|
+
"code": "api-disabled",
|
|
3612
|
+
"reason": "api is disabled",
|
|
3613
|
+
"objectName": "@happyvertical/smrt-education:GroupLearnerMembership"
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
"kind": "api",
|
|
3617
|
+
"operation": "save",
|
|
3618
|
+
"code": "api-disabled",
|
|
3619
|
+
"reason": "api is disabled",
|
|
3620
|
+
"objectName": "@happyvertical/smrt-education:GroupLearnerMembership"
|
|
3621
|
+
}
|
|
3622
|
+
],
|
|
3623
|
+
"relationshipFeatures": [
|
|
3624
|
+
"crossPackageRef",
|
|
3625
|
+
"foreignKey",
|
|
3626
|
+
"uuidColumns"
|
|
3627
|
+
],
|
|
3628
|
+
"tags": [],
|
|
3629
|
+
"risks": []
|
|
3630
|
+
},
|
|
3631
|
+
{
|
|
3632
|
+
"name": "GroupLearnerMembershipCollection",
|
|
3633
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupLearnerMembershipCollection",
|
|
3634
|
+
"collection": "grouplearnermemberships",
|
|
3635
|
+
"tableName": "group_learner_memberships",
|
|
3636
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3637
|
+
"extends": "SmrtCollection",
|
|
3638
|
+
"fields": [],
|
|
3639
|
+
"relationships": [],
|
|
3640
|
+
"methods": [],
|
|
3641
|
+
"surfaces": [],
|
|
3642
|
+
"relationshipFeatures": [
|
|
3643
|
+
"uuidColumns"
|
|
3644
|
+
],
|
|
3645
|
+
"tags": [],
|
|
3646
|
+
"risks": []
|
|
3647
|
+
},
|
|
3648
|
+
{
|
|
3649
|
+
"name": "GroupSharingPolicy",
|
|
3650
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupSharingPolicy",
|
|
3651
|
+
"collection": "groupsharingpolicies",
|
|
3652
|
+
"description": "Immutable explicit policy snapshot.",
|
|
3653
|
+
"tableName": "group_sharing_policies",
|
|
3654
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3655
|
+
"extends": "SmrtObject",
|
|
3656
|
+
"fields": [
|
|
3657
|
+
{
|
|
3658
|
+
"name": "tenantId",
|
|
3659
|
+
"type": "text",
|
|
3660
|
+
"required": true,
|
|
3661
|
+
"columnType": "UUID"
|
|
3662
|
+
},
|
|
3663
|
+
{
|
|
3664
|
+
"name": "membershipId",
|
|
3665
|
+
"type": "foreignKey",
|
|
3666
|
+
"required": true,
|
|
3667
|
+
"related": "GroupLearnerMembership",
|
|
3668
|
+
"columnType": "UUID"
|
|
3669
|
+
},
|
|
3670
|
+
{
|
|
3671
|
+
"name": "version",
|
|
3672
|
+
"type": "integer",
|
|
3673
|
+
"required": true,
|
|
3674
|
+
"columnType": "INTEGER",
|
|
3675
|
+
"default": 1,
|
|
3676
|
+
"constraints": {
|
|
3677
|
+
"min": 1
|
|
3678
|
+
}
|
|
3679
|
+
},
|
|
3680
|
+
{
|
|
3681
|
+
"name": "schemaVersion",
|
|
3682
|
+
"type": "integer",
|
|
3683
|
+
"required": true,
|
|
3684
|
+
"columnType": "INTEGER",
|
|
3685
|
+
"default": 1,
|
|
3686
|
+
"constraints": {
|
|
3687
|
+
"min": 1,
|
|
3688
|
+
"max": 1
|
|
3689
|
+
}
|
|
3690
|
+
},
|
|
3691
|
+
{
|
|
3692
|
+
"name": "policyJson",
|
|
3693
|
+
"type": "text",
|
|
3694
|
+
"required": true,
|
|
3695
|
+
"columnType": "TEXT"
|
|
3696
|
+
},
|
|
3697
|
+
{
|
|
3698
|
+
"name": "actorUserId",
|
|
3699
|
+
"type": "crossPackageRef",
|
|
3700
|
+
"required": true,
|
|
3701
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3702
|
+
"columnType": "UUID"
|
|
3703
|
+
},
|
|
3704
|
+
{
|
|
3705
|
+
"name": "recordedAt",
|
|
3706
|
+
"type": "text",
|
|
3707
|
+
"required": false,
|
|
3708
|
+
"columnType": "TEXT"
|
|
3709
|
+
}
|
|
3710
|
+
],
|
|
3711
|
+
"relationships": [
|
|
3712
|
+
{
|
|
3713
|
+
"name": "membershipId",
|
|
3714
|
+
"type": "foreignKey",
|
|
3715
|
+
"required": true,
|
|
3716
|
+
"related": "GroupLearnerMembership",
|
|
3717
|
+
"columnType": "UUID"
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
"name": "actorUserId",
|
|
3721
|
+
"type": "crossPackageRef",
|
|
3722
|
+
"required": true,
|
|
3723
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3724
|
+
"columnType": "UUID"
|
|
3725
|
+
}
|
|
3726
|
+
],
|
|
3727
|
+
"methods": [
|
|
3728
|
+
"delete",
|
|
3729
|
+
"getPolicy",
|
|
3730
|
+
"save",
|
|
3731
|
+
"setPolicy"
|
|
3732
|
+
],
|
|
3733
|
+
"methodSignatures": [
|
|
3734
|
+
{
|
|
3735
|
+
"name": "delete",
|
|
3736
|
+
"async": true,
|
|
3737
|
+
"returns": "Promise<void>"
|
|
3738
|
+
},
|
|
3739
|
+
{
|
|
3740
|
+
"name": "getPolicy",
|
|
3741
|
+
"returns": "GroupSharingPolicyV1"
|
|
3742
|
+
},
|
|
3743
|
+
{
|
|
3744
|
+
"name": "save",
|
|
3745
|
+
"async": true,
|
|
3746
|
+
"params": [
|
|
3747
|
+
"options?: SmrtSaveOptions"
|
|
3748
|
+
],
|
|
3749
|
+
"returns": "Promise<this>"
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
"name": "setPolicy",
|
|
3753
|
+
"params": [
|
|
3754
|
+
"value: unknown"
|
|
3755
|
+
],
|
|
3756
|
+
"returns": "void"
|
|
3757
|
+
}
|
|
3758
|
+
],
|
|
3759
|
+
"tenant": {
|
|
3760
|
+
"scoped": true,
|
|
3761
|
+
"mode": "required",
|
|
3762
|
+
"field": "tenantId"
|
|
3763
|
+
},
|
|
3764
|
+
"conflictColumns": [
|
|
3765
|
+
"tenant_id",
|
|
3766
|
+
"membership_id",
|
|
3767
|
+
"version"
|
|
3768
|
+
],
|
|
3769
|
+
"surfaces": [],
|
|
3770
|
+
"withheldSurfaces": [
|
|
3771
|
+
{
|
|
3772
|
+
"kind": "api",
|
|
3773
|
+
"operation": "delete",
|
|
3774
|
+
"code": "api-disabled",
|
|
3775
|
+
"reason": "api is disabled",
|
|
3776
|
+
"objectName": "@happyvertical/smrt-education:GroupSharingPolicy"
|
|
3777
|
+
},
|
|
3778
|
+
{
|
|
3779
|
+
"kind": "api",
|
|
3780
|
+
"operation": "getPolicy",
|
|
3781
|
+
"code": "api-disabled",
|
|
3782
|
+
"reason": "api is disabled",
|
|
3783
|
+
"objectName": "@happyvertical/smrt-education:GroupSharingPolicy"
|
|
3784
|
+
},
|
|
3785
|
+
{
|
|
3786
|
+
"kind": "api",
|
|
3787
|
+
"operation": "save",
|
|
3788
|
+
"code": "api-disabled",
|
|
3789
|
+
"reason": "api is disabled",
|
|
3790
|
+
"objectName": "@happyvertical/smrt-education:GroupSharingPolicy"
|
|
3791
|
+
},
|
|
3792
|
+
{
|
|
3793
|
+
"kind": "api",
|
|
3794
|
+
"operation": "setPolicy",
|
|
3795
|
+
"code": "api-disabled",
|
|
3796
|
+
"reason": "api is disabled",
|
|
3797
|
+
"objectName": "@happyvertical/smrt-education:GroupSharingPolicy"
|
|
3798
|
+
}
|
|
3799
|
+
],
|
|
3800
|
+
"relationshipFeatures": [
|
|
3801
|
+
"crossPackageRef",
|
|
3802
|
+
"foreignKey",
|
|
3803
|
+
"uuidColumns"
|
|
3804
|
+
],
|
|
3805
|
+
"tags": [],
|
|
3806
|
+
"risks": []
|
|
3807
|
+
},
|
|
3808
|
+
{
|
|
3809
|
+
"name": "GroupSharingPolicyCollection",
|
|
3810
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupSharingPolicyCollection",
|
|
3811
|
+
"collection": "groupsharingpolicies",
|
|
3812
|
+
"tableName": "group_sharing_policies",
|
|
3813
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3814
|
+
"extends": "SmrtCollection",
|
|
3815
|
+
"fields": [],
|
|
3816
|
+
"relationships": [],
|
|
3817
|
+
"methods": [],
|
|
3818
|
+
"surfaces": [],
|
|
3819
|
+
"relationshipFeatures": [
|
|
3820
|
+
"uuidColumns"
|
|
3821
|
+
],
|
|
3822
|
+
"tags": [],
|
|
3823
|
+
"risks": []
|
|
3824
|
+
},
|
|
3825
|
+
{
|
|
3826
|
+
"name": "GroupRevisionComment",
|
|
3827
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupRevisionComment",
|
|
3828
|
+
"collection": "grouprevisioncomments",
|
|
3829
|
+
"description": "Attributed revision comment, separate from grading and evidence.",
|
|
3830
|
+
"tableName": "group_revision_comments",
|
|
3831
|
+
"packageName": "@happyvertical/smrt-education",
|
|
3832
|
+
"extends": "SmrtObject",
|
|
3833
|
+
"fields": [
|
|
3834
|
+
{
|
|
3835
|
+
"name": "tenantId",
|
|
3836
|
+
"type": "text",
|
|
3837
|
+
"required": true,
|
|
3838
|
+
"columnType": "UUID"
|
|
3839
|
+
},
|
|
3840
|
+
{
|
|
3841
|
+
"name": "membershipId",
|
|
3842
|
+
"type": "foreignKey",
|
|
3843
|
+
"required": true,
|
|
3844
|
+
"related": "GroupLearnerMembership",
|
|
3845
|
+
"columnType": "UUID"
|
|
3846
|
+
},
|
|
3847
|
+
{
|
|
3848
|
+
"name": "learnerId",
|
|
3849
|
+
"type": "foreignKey",
|
|
3850
|
+
"required": true,
|
|
3851
|
+
"related": "Learner",
|
|
3852
|
+
"columnType": "UUID"
|
|
3853
|
+
},
|
|
3854
|
+
{
|
|
3855
|
+
"name": "activityId",
|
|
3856
|
+
"type": "foreignKey",
|
|
3857
|
+
"required": true,
|
|
3858
|
+
"related": "WorkbookActivity",
|
|
3859
|
+
"columnType": "UUID"
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
"name": "attemptId",
|
|
3863
|
+
"type": "foreignKey",
|
|
3864
|
+
"required": true,
|
|
3865
|
+
"related": "WorkbookAttempt",
|
|
3866
|
+
"columnType": "UUID"
|
|
3867
|
+
},
|
|
3868
|
+
{
|
|
3869
|
+
"name": "revisionId",
|
|
3870
|
+
"type": "foreignKey",
|
|
3871
|
+
"required": true,
|
|
3872
|
+
"related": "WorkbookAssessmentRevision",
|
|
3873
|
+
"columnType": "UUID"
|
|
3874
|
+
},
|
|
3875
|
+
{
|
|
3876
|
+
"name": "authorUserId",
|
|
3877
|
+
"type": "crossPackageRef",
|
|
3878
|
+
"required": true,
|
|
3879
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3880
|
+
"columnType": "UUID"
|
|
3881
|
+
},
|
|
3882
|
+
{
|
|
3883
|
+
"name": "authorProfileId",
|
|
3884
|
+
"type": "crossPackageRef",
|
|
3885
|
+
"required": true,
|
|
3886
|
+
"related": "@happyvertical/smrt-profiles:Profile",
|
|
3887
|
+
"columnType": "UUID"
|
|
3888
|
+
},
|
|
3889
|
+
{
|
|
3890
|
+
"name": "body",
|
|
3891
|
+
"type": "text",
|
|
3892
|
+
"required": false,
|
|
3893
|
+
"columnType": "TEXT"
|
|
3894
|
+
},
|
|
3895
|
+
{
|
|
3896
|
+
"name": "recordedAt",
|
|
3897
|
+
"type": "text",
|
|
3898
|
+
"required": false,
|
|
3899
|
+
"columnType": "TEXT"
|
|
3900
|
+
},
|
|
3901
|
+
{
|
|
3902
|
+
"name": "childVisible",
|
|
3903
|
+
"type": "boolean",
|
|
3904
|
+
"required": true,
|
|
3905
|
+
"columnType": "BOOLEAN",
|
|
3906
|
+
"default": false
|
|
3907
|
+
},
|
|
3908
|
+
{
|
|
3909
|
+
"name": "visibilityActorUserId",
|
|
3910
|
+
"type": "crossPackageRef",
|
|
3911
|
+
"required": false,
|
|
3912
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3913
|
+
"columnType": "UUID"
|
|
3914
|
+
},
|
|
3915
|
+
{
|
|
3916
|
+
"name": "visibilityChangedAt",
|
|
3917
|
+
"type": "datetime",
|
|
3918
|
+
"required": false,
|
|
3919
|
+
"columnType": "TIMESTAMP"
|
|
3920
|
+
},
|
|
3921
|
+
{
|
|
3922
|
+
"name": "visibilityVersion",
|
|
3923
|
+
"type": "integer",
|
|
3924
|
+
"required": true,
|
|
3925
|
+
"columnType": "INTEGER",
|
|
3926
|
+
"default": 0,
|
|
3927
|
+
"constraints": {
|
|
3928
|
+
"min": 0
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
],
|
|
3932
|
+
"relationships": [
|
|
3933
|
+
{
|
|
3934
|
+
"name": "membershipId",
|
|
3935
|
+
"type": "foreignKey",
|
|
3936
|
+
"required": true,
|
|
3937
|
+
"related": "GroupLearnerMembership",
|
|
3938
|
+
"columnType": "UUID"
|
|
3939
|
+
},
|
|
3940
|
+
{
|
|
3941
|
+
"name": "learnerId",
|
|
3942
|
+
"type": "foreignKey",
|
|
3943
|
+
"required": true,
|
|
3944
|
+
"related": "Learner",
|
|
3945
|
+
"columnType": "UUID"
|
|
3946
|
+
},
|
|
3947
|
+
{
|
|
3948
|
+
"name": "activityId",
|
|
3949
|
+
"type": "foreignKey",
|
|
3950
|
+
"required": true,
|
|
3951
|
+
"related": "WorkbookActivity",
|
|
3952
|
+
"columnType": "UUID"
|
|
3953
|
+
},
|
|
3954
|
+
{
|
|
3955
|
+
"name": "attemptId",
|
|
3956
|
+
"type": "foreignKey",
|
|
3957
|
+
"required": true,
|
|
3958
|
+
"related": "WorkbookAttempt",
|
|
3959
|
+
"columnType": "UUID"
|
|
3960
|
+
},
|
|
3961
|
+
{
|
|
3962
|
+
"name": "revisionId",
|
|
3963
|
+
"type": "foreignKey",
|
|
3964
|
+
"required": true,
|
|
3965
|
+
"related": "WorkbookAssessmentRevision",
|
|
3966
|
+
"columnType": "UUID"
|
|
3967
|
+
},
|
|
3968
|
+
{
|
|
3969
|
+
"name": "authorUserId",
|
|
3970
|
+
"type": "crossPackageRef",
|
|
3971
|
+
"required": true,
|
|
3972
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3973
|
+
"columnType": "UUID"
|
|
3974
|
+
},
|
|
3975
|
+
{
|
|
3976
|
+
"name": "authorProfileId",
|
|
3977
|
+
"type": "crossPackageRef",
|
|
3978
|
+
"required": true,
|
|
3979
|
+
"related": "@happyvertical/smrt-profiles:Profile",
|
|
3980
|
+
"columnType": "UUID"
|
|
3981
|
+
},
|
|
3982
|
+
{
|
|
3983
|
+
"name": "visibilityActorUserId",
|
|
3984
|
+
"type": "crossPackageRef",
|
|
3985
|
+
"required": false,
|
|
3986
|
+
"related": "@happyvertical/smrt-users:User",
|
|
3987
|
+
"columnType": "UUID"
|
|
3988
|
+
}
|
|
3989
|
+
],
|
|
3990
|
+
"methods": [
|
|
3991
|
+
"delete",
|
|
3992
|
+
"save"
|
|
3993
|
+
],
|
|
3994
|
+
"methodSignatures": [
|
|
3995
|
+
{
|
|
3996
|
+
"name": "delete",
|
|
3997
|
+
"async": true,
|
|
3998
|
+
"returns": "Promise<void>"
|
|
3999
|
+
},
|
|
4000
|
+
{
|
|
4001
|
+
"name": "save",
|
|
4002
|
+
"async": true,
|
|
4003
|
+
"params": [
|
|
4004
|
+
"options?: SmrtSaveOptions"
|
|
4005
|
+
],
|
|
4006
|
+
"returns": "Promise<this>"
|
|
4007
|
+
}
|
|
4008
|
+
],
|
|
4009
|
+
"tenant": {
|
|
4010
|
+
"scoped": true,
|
|
4011
|
+
"mode": "required",
|
|
4012
|
+
"field": "tenantId"
|
|
4013
|
+
},
|
|
4014
|
+
"conflictColumns": [
|
|
4015
|
+
"tenant_id",
|
|
4016
|
+
"slug",
|
|
4017
|
+
"context"
|
|
4018
|
+
],
|
|
4019
|
+
"surfaces": [],
|
|
4020
|
+
"withheldSurfaces": [
|
|
4021
|
+
{
|
|
4022
|
+
"kind": "api",
|
|
4023
|
+
"operation": "delete",
|
|
4024
|
+
"code": "api-disabled",
|
|
4025
|
+
"reason": "api is disabled",
|
|
4026
|
+
"objectName": "@happyvertical/smrt-education:GroupRevisionComment"
|
|
4027
|
+
},
|
|
4028
|
+
{
|
|
4029
|
+
"kind": "api",
|
|
4030
|
+
"operation": "save",
|
|
4031
|
+
"code": "api-disabled",
|
|
4032
|
+
"reason": "api is disabled",
|
|
4033
|
+
"objectName": "@happyvertical/smrt-education:GroupRevisionComment"
|
|
4034
|
+
}
|
|
4035
|
+
],
|
|
4036
|
+
"relationshipFeatures": [
|
|
4037
|
+
"crossPackageRef",
|
|
4038
|
+
"foreignKey",
|
|
4039
|
+
"uuidColumns"
|
|
4040
|
+
],
|
|
4041
|
+
"tags": [],
|
|
4042
|
+
"risks": []
|
|
4043
|
+
},
|
|
4044
|
+
{
|
|
4045
|
+
"name": "GroupRevisionCommentCollection",
|
|
4046
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupRevisionCommentCollection",
|
|
4047
|
+
"collection": "grouprevisioncomments",
|
|
4048
|
+
"tableName": "group_revision_comments",
|
|
4049
|
+
"packageName": "@happyvertical/smrt-education",
|
|
4050
|
+
"extends": "SmrtCollection",
|
|
4051
|
+
"fields": [],
|
|
4052
|
+
"relationships": [],
|
|
4053
|
+
"methods": [],
|
|
4054
|
+
"surfaces": [],
|
|
4055
|
+
"relationshipFeatures": [
|
|
4056
|
+
"uuidColumns"
|
|
4057
|
+
],
|
|
4058
|
+
"tags": [],
|
|
4059
|
+
"risks": []
|
|
4060
|
+
},
|
|
4061
|
+
{
|
|
4062
|
+
"name": "GroupLearnerRosterEntry",
|
|
4063
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupLearnerRosterEntry",
|
|
4064
|
+
"collection": "grouplearnerrosterentries",
|
|
4065
|
+
"description": "Group-owned opaque roster index; authoritative consent remains family-owned.",
|
|
4066
|
+
"tableName": "group_learner_roster_entries",
|
|
4067
|
+
"packageName": "@happyvertical/smrt-education",
|
|
4068
|
+
"extends": "SmrtObject",
|
|
4069
|
+
"fields": [
|
|
4070
|
+
{
|
|
4071
|
+
"name": "tenantId",
|
|
4072
|
+
"type": "text",
|
|
4073
|
+
"required": true,
|
|
4074
|
+
"columnType": "UUID"
|
|
4075
|
+
},
|
|
4076
|
+
{
|
|
4077
|
+
"name": "groupId",
|
|
4078
|
+
"type": "foreignKey",
|
|
4079
|
+
"required": true,
|
|
4080
|
+
"related": "EducationGroup",
|
|
4081
|
+
"columnType": "UUID"
|
|
4082
|
+
},
|
|
4083
|
+
{
|
|
4084
|
+
"name": "familyTenantId",
|
|
4085
|
+
"type": "crossPackageRef",
|
|
4086
|
+
"required": true,
|
|
4087
|
+
"related": "@happyvertical/smrt-users:Tenant",
|
|
4088
|
+
"columnType": "UUID"
|
|
4089
|
+
},
|
|
4090
|
+
{
|
|
4091
|
+
"name": "learnerId",
|
|
4092
|
+
"type": "text",
|
|
4093
|
+
"required": true,
|
|
4094
|
+
"columnType": "UUID"
|
|
4095
|
+
},
|
|
4096
|
+
{
|
|
4097
|
+
"name": "membershipId",
|
|
4098
|
+
"type": "foreignKey",
|
|
4099
|
+
"required": true,
|
|
4100
|
+
"related": "GroupLearnerMembership",
|
|
4101
|
+
"columnType": "UUID"
|
|
4102
|
+
}
|
|
4103
|
+
],
|
|
4104
|
+
"relationships": [
|
|
4105
|
+
{
|
|
4106
|
+
"name": "groupId",
|
|
4107
|
+
"type": "foreignKey",
|
|
4108
|
+
"required": true,
|
|
4109
|
+
"related": "EducationGroup",
|
|
4110
|
+
"columnType": "UUID"
|
|
4111
|
+
},
|
|
4112
|
+
{
|
|
4113
|
+
"name": "familyTenantId",
|
|
4114
|
+
"type": "crossPackageRef",
|
|
4115
|
+
"required": true,
|
|
4116
|
+
"related": "@happyvertical/smrt-users:Tenant",
|
|
4117
|
+
"columnType": "UUID"
|
|
4118
|
+
},
|
|
4119
|
+
{
|
|
4120
|
+
"name": "membershipId",
|
|
4121
|
+
"type": "foreignKey",
|
|
4122
|
+
"required": true,
|
|
4123
|
+
"related": "GroupLearnerMembership",
|
|
4124
|
+
"columnType": "UUID"
|
|
4125
|
+
}
|
|
4126
|
+
],
|
|
4127
|
+
"methods": [
|
|
4128
|
+
"delete",
|
|
4129
|
+
"save"
|
|
4130
|
+
],
|
|
4131
|
+
"methodSignatures": [
|
|
4132
|
+
{
|
|
4133
|
+
"name": "delete",
|
|
4134
|
+
"async": true,
|
|
4135
|
+
"returns": "Promise<void>"
|
|
4136
|
+
},
|
|
4137
|
+
{
|
|
4138
|
+
"name": "save",
|
|
4139
|
+
"async": true,
|
|
4140
|
+
"params": [
|
|
4141
|
+
"options?: SmrtSaveOptions"
|
|
4142
|
+
],
|
|
4143
|
+
"returns": "Promise<this>"
|
|
4144
|
+
}
|
|
4145
|
+
],
|
|
4146
|
+
"tenant": {
|
|
4147
|
+
"scoped": true,
|
|
4148
|
+
"mode": "required",
|
|
4149
|
+
"field": "tenantId"
|
|
4150
|
+
},
|
|
4151
|
+
"conflictColumns": [
|
|
4152
|
+
"tenant_id",
|
|
4153
|
+
"group_id",
|
|
4154
|
+
"membership_id"
|
|
4155
|
+
],
|
|
4156
|
+
"surfaces": [],
|
|
4157
|
+
"withheldSurfaces": [
|
|
4158
|
+
{
|
|
4159
|
+
"kind": "api",
|
|
4160
|
+
"operation": "delete",
|
|
4161
|
+
"code": "api-disabled",
|
|
4162
|
+
"reason": "api is disabled",
|
|
4163
|
+
"objectName": "@happyvertical/smrt-education:GroupLearnerRosterEntry"
|
|
4164
|
+
},
|
|
4165
|
+
{
|
|
4166
|
+
"kind": "api",
|
|
4167
|
+
"operation": "save",
|
|
4168
|
+
"code": "api-disabled",
|
|
4169
|
+
"reason": "api is disabled",
|
|
4170
|
+
"objectName": "@happyvertical/smrt-education:GroupLearnerRosterEntry"
|
|
4171
|
+
}
|
|
4172
|
+
],
|
|
4173
|
+
"relationshipFeatures": [
|
|
4174
|
+
"crossPackageRef",
|
|
4175
|
+
"foreignKey",
|
|
4176
|
+
"uuidColumns"
|
|
4177
|
+
],
|
|
4178
|
+
"tags": [],
|
|
4179
|
+
"risks": []
|
|
4180
|
+
},
|
|
4181
|
+
{
|
|
4182
|
+
"name": "GroupLearnerRosterEntryCollection",
|
|
4183
|
+
"qualifiedName": "@happyvertical/smrt-education:GroupLearnerRosterEntryCollection",
|
|
4184
|
+
"collection": "grouplearnerrosterentries",
|
|
4185
|
+
"tableName": "group_learner_roster_entries",
|
|
4186
|
+
"packageName": "@happyvertical/smrt-education",
|
|
4187
|
+
"extends": "SmrtCollection",
|
|
4188
|
+
"fields": [],
|
|
4189
|
+
"relationships": [],
|
|
4190
|
+
"methods": [],
|
|
4191
|
+
"surfaces": [],
|
|
4192
|
+
"relationshipFeatures": [
|
|
4193
|
+
"uuidColumns"
|
|
4194
|
+
],
|
|
4195
|
+
"tags": [],
|
|
4196
|
+
"risks": []
|
|
4197
|
+
},
|
|
3187
4198
|
{
|
|
3188
4199
|
"name": "Learner",
|
|
3189
4200
|
"qualifiedName": "@happyvertical/smrt-education:Learner",
|
|
@@ -6769,14 +7780,14 @@
|
|
|
6769
7780
|
"surfaces": [],
|
|
6770
7781
|
"prompts": [],
|
|
6771
7782
|
"relationshipsV2": {
|
|
6772
|
-
"foreignKeyFields":
|
|
6773
|
-
"crossPackageRefFields":
|
|
7783
|
+
"foreignKeyFields": 92,
|
|
7784
|
+
"crossPackageRefFields": 21,
|
|
6774
7785
|
"junctionCollections": 2,
|
|
6775
7786
|
"hierarchicalObjects": 0,
|
|
6776
7787
|
"polymorphicAssociations": 0,
|
|
6777
|
-
"uuidColumns":
|
|
7788
|
+
"uuidColumns": 420
|
|
6778
7789
|
},
|
|
6779
|
-
"agentDoc": "# smrt-education\n\nCatalog objects are optional-tenant scoped and have no generated REST, CLI, MCP,\nor AI surface. Applications use `CatalogService`, supplying their actor-bound\nauthorization decision and the trusted `TenantCollection.withTenantCatalogReadScope`\nadapter from smrt-users. Catalog authorization receives the exact shared collection\nexecutor; live session/permission checks must use that executor. That read scope may widen only an allowlisted catalog\ncollection's `list` to self, ancestors, and globals; it never authorizes a get,\nwrite, raw query, sibling, or descendant read.\n\n`personal-use-copy` courses and all `answer-key` lesson assets are private\nfamily material. Do not publish them, promote them, or expose them through a\nlearner-facing result. `LessonAsset` is the sole owner join for lesson files;\ndo not add asset-id fields to lesson subclasses.\n\nLearner objects require exact tenant ownership and close generated surfaces.\n`LearnerService` owns actor/resource authorization and transactional planning and\nstart-progress; see [learner contract](agents/learner-service.md). Guardian\nrelationships require a host decision about their type and effective terms.\nNever expose direct collection writes as learner handlers, reset progress on a\nretry, or treat an unscored nullable decimal as zero.\n\nSubmission capture, guardian grading and private PDF packet splitting use\n`SubmissionService`; see [submission contract](agents/submission-service.md).\nKeep asset metadata on the same transaction and compensate only newly planned\nfiles after rollback; never expose source URIs or accept learner grade patches.\n\nValidation: `pnpm --filter @happyvertical/smrt-education test`,\n`test:postgres`, `typecheck`, and `build`.\n\nPhysical workbook capture, immutable assessment/feedback history and descriptive\nevidence use [WorkbookService](agents/workbook-service.md). Keep provisional\nsharing separate from guardian Grade authority. Photo-first receipt/context\ncapture uses [WorkbookPhotoService](agents/photo-intake.md); covers/references\nnever create learning evidence, and blank exercises need explicit work intent.\n\nSource import: [host boundary and transaction contract](agents/source-import.md).\n`SourceImportService` requires host opt-in, matching active actor/tenant and\nexplicit licensing authorization; never add a system/global write bypass.\n\nFamily-owned unassigned originals and audited learner adoption use\n[FamilyIntakeService](agents/family-intake.md). Keep family source scope immutable;\nassignment alone never creates learning history or grants learner inbox access.\n\nPublisher catalog previews use [the preview contract](agents/catalog-previews.md).\nKeep independent image rights and source revisions; serve via `CatalogPreviewService`\nwith live actor/tenant authorization, never direct provider image URLs.\n\nEnrollment Plan projections and guardian-only parent notes use\n[the Plan contract](agents/learner-plan.md). Keep awaiting review separate from\nContinue; note authority/provenance never grants learner access or learning evidence.\n",
|
|
7790
|
+
"agentDoc": "# smrt-education\n\nCatalog objects are optional-tenant scoped and have no generated REST, CLI, MCP,\nor AI surface. Applications use `CatalogService`, supplying their actor-bound\nauthorization decision and the trusted `TenantCollection.withTenantCatalogReadScope`\nadapter from smrt-users. Catalog authorization receives the exact shared collection\nexecutor; live session/permission checks must use that executor. That read scope may widen only an allowlisted catalog\ncollection's `list` to self, ancestors, and globals; it never authorizes a get,\nwrite, raw query, sibling, or descendant read.\n\n`personal-use-copy` courses and all `answer-key` lesson assets are private\nfamily material. Do not publish them, promote them, or expose them through a\nlearner-facing result. `LessonAsset` is the sole owner join for lesson files;\ndo not add asset-id fields to lesson subclasses.\n\nLearner objects require exact tenant ownership and close generated surfaces.\n`LearnerService` owns actor/resource authorization and transactional planning and\nstart-progress; see [learner contract](agents/learner-service.md). Guardian\nrelationships require a host decision about their type and effective terms.\nNever expose direct collection writes as learner handlers, reset progress on a\nretry, or treat an unscored nullable decimal as zero.\n\nSubmission capture, guardian grading and private PDF packet splitting use\n`SubmissionService`; see [submission contract](agents/submission-service.md).\nKeep asset metadata on the same transaction and compensate only newly planned\nfiles after rollback; never expose source URIs or accept learner grade patches.\n\nValidation: `pnpm --filter @happyvertical/smrt-education test`,\n`test:postgres`, `typecheck`, and `build`.\n\nPhysical workbook capture, immutable assessment/feedback history and descriptive\nevidence use [WorkbookService](agents/workbook-service.md). Keep provisional\nsharing separate from guardian Grade authority. Photo-first receipt/context\ncapture uses [WorkbookPhotoService](agents/photo-intake.md); covers/references\nnever create learning evidence, and blank exercises need explicit work intent.\n\nSource import: [host boundary and transaction contract](agents/source-import.md).\n`SourceImportService` requires host opt-in, matching active actor/tenant and\nexplicit licensing authorization; never add a system/global write bypass.\n\nFamily-owned unassigned originals and audited learner adoption use\n[FamilyIntakeService](agents/family-intake.md). Keep family source scope immutable;\nassignment alone never creates learning history or grants learner inbox access.\n\nPublisher catalog previews use [the preview contract](agents/catalog-previews.md).\nKeep independent image rights and source revisions; serve via `CatalogPreviewService`\nwith live actor/tenant authorization, never direct provider image URLs.\n\nEnrollment Plan projections and guardian-only parent notes use\n[the Plan contract](agents/learner-plan.md). Keep awaiting review separate from\nContinue; note authority/provenance never grants learner access or learning evidence.\n\nHomeschool group sharing uses [GroupSharingService](agents/group-sharing.md),\nits read-only reader and revision comment service. Group tenants never become\nfamily ancestors or guardians. Enumerate only the group-owned opaque roster index,\nthen revalidate each exact family edge and current policy. Media delivery must call\nthe reader on every request; signed storage URLs are not a sharing grant. Saved\nparent comment visibility applies on every child read. Progress with feedback\ndisabled contains counts only, never correctness, scores or concept labels.\n",
|
|
6780
7791
|
"moduleDocs": [
|
|
6781
7792
|
{
|
|
6782
7793
|
"path": "agents/learner-service.md",
|
|
@@ -6786,7 +7797,7 @@
|
|
|
6786
7797
|
{
|
|
6787
7798
|
"path": "agents/submission-service.md",
|
|
6788
7799
|
"module": "submission-service",
|
|
6789
|
-
"content": "# Submission and paper workflow\n\nConstruct `SubmissionService(db, authorizeLearner, authorizeCatalog, {storage,\nstoreOptions?, signAsset?})` from trusted server configuration. It extends\n`LearnerService`: the same active actor/tenant, memberships, linked person,\ndirected guardian relationship and host permission checks apply. The host must\nallow `education.learner.submit`, `education.learner.grade` or\n`education.learner.packet` as appropriate. Grade and packet actions always reject\nthe learner's own identity, even if the host authorizer returns true.\n\nThe protected transaction/auth hooks are internal owning-service extension\npoints. They are not handler APIs. All public service results remain data-only.\nUse the callback's service in `withTransaction`; escaped services are closed.\nSubmission operations share its serial queue, poison-on-failure behavior and\nPostgreSQL enrollment lock. No runtime schema creation occurs.\n\n## Capture and grading\n\n`captureSubmission` takes the learner request, `enrollmentId`, `lessonId`, a\nnonempty stable `requestKey`, and `pages` containing `name`, `mimeType` and Buffer\n`data`. Each upload becomes a fresh Asset owned by the learner's profile and\nexact tenant, joined solely through `SubmissionAsset`. Up to 100 uploads of\n25 MiB each are accepted (JPEG, PNG, WebP, or PDF). It atomically creates the\nsubmission/asset metadata and moves only that enrollment's progress to\n`submitted`, incrementing attempts once. Caller status, score, grader, asset ID,\nand answer-key flags are never patches. Equal request-key/content retries return\nthe existing submission; altered retries fail. Submitted/review/complete/skipped\nprogress rejects new captures. Content includes ordered filenames, MIME types,\nbytes and notes. Hosts should impose tighter request/body limits as needed.\n\n`captureBlankReference` records a workbook-page scan as immutable\n`blank_reference` evidence without advancing completion or creating a grade.\nTrusted ingestion scopes each receipt to the exact `enrollmentId` and calls\n`assertLessonAssignment` before reading retained evidence; it proves the active\ntenant, actor, learner, enrollment, and lesson without creating progress. A\nstable `intakeItemId` is claimed once in the durable tenant/item binding table,\nthen bound to the tenant, learner, lesson, progress, kind and predecessor; an\naltered retry fails. The binding is database-unique across enrollments while\nordinary uploads remain unbound. `resubmitSubmission` requires the current completed-work predecessor and\ncreates a new immutable `completed_work` attempt. Old pages, grades and feedback\nremain history; stale predecessors cannot be graded or replaced. A correction may\nreopen submitted, review or complete progress, while an AI proposal remains a\nnon-authoritative Grade until guardian review.\n\n`reviewSubmission` accepts an existing authorized submission and optional score\nand feedback. `attestLesson` creates/reuses an Attestation for a matching progress\nitem without requiring uploads. Both require a verified guardian and create a\nnew guardian Grade and set submission to `graded`. Ordinary non-workbook progress\nbecomes `complete`. Workbook-backed progress instead uses its explicit parent\ncompletion decision; grading alone leaves it in progress, including through a\nplain SubmissionService instance. Existing explicit completion on the current\nattempt is retained. The owning workbook join determines this policy, never a\ncaller flag.\nOmitted/null score is unscored; zero is a real score. The latest guardian grade\nwins over auto/AI/instructor proposals, and its score replaces progress's score.\nReview history is retained. ExternalCompletion is available for trusted server\npersistence; phase-zero learner handlers cannot forge reported scores. Online\nsubmissions and automatic grading are not implemented.\n\n`getSubmission` returns only submission metadata, page asset IDs and the selected\ngrade. It does not include catalog answers, extracted answers, storage paths,\nmodel objects, or database handles.\n\n## Storage and signed routes\n\nThe service creates an AssetRuntime bound to the operation's transaction. It\nrequires a resolved URI whose filename retains the fresh asset UUID and MIME\nextension; custom resolvers may choose its provider/directory but must route\nthat URI to the corresponding unique file. Shared existing locators are\nrejected before preservation or cleanup registration. It plans and persists\nthat unique asset URI before writing, registering that new\nasset for cleanup before the provider can partially write. After rollback,\nfiles are removed through the runtime store. Before deletion, the root database\nmust confirm that no asset owner committed: uncertain commit/read failures never\ncause committed bytes to be removed. Only this operation's newly created assets\nare candidates; pre-existing files are never adopted into its cleanup ledger.\n\nDatabase metadata is atomic; external storage uses compensation, not a database\ntransaction. If cleanup cannot complete, `SubmissionStorageCleanupError` contains\nfresh asset IDs and the original cause. Operators must reconcile those IDs in\nthe configured `education-page/<id>.<extension>` storage namespace (custom\nresolvers must retain their routing audit). A successful retry uses fresh IDs\nand cannot delete or reuse orphaned bytes. Process termination may also leave\nunreferenced files; hosts need storage orphan reconciliation. Do not suppress\ncleanup failures or claim crash-safe distributed atomicity.\n\n`signSubmissionAsset` verifies the submission/enrollment/learner ownership and\nits noun join, then verifies the Asset's tenant and learner profile before\ncalling the configured trusted signer. Claims contain actor, tenant, learner,\nenrollment, submission, asset and a five-minute expiry; no static source URI is\nreturned. The host signs every claim and its serving endpoint must verify the\nsignature, expiry, current actor/tenant and object authorization before serving.\nA bearer URL must never become a cross-family or sibling access bypass.\n\n`signLessonPrintable` signs only the exact authorized `printable` LessonAsset\njoin for an enrolled lesson. It never accepts an answer-key join and carries the\nsame tenant, actor, learner and enrollment scope as a submission claim.\n\n## Personal worksheet packets\n\n`splitWorksheetPacket` takes the guardian learner request, exact-owned\n`personal-use-copy` `courseId`, PDF bytes and ranges `{lessonId, firstPage,\nlastPage}`. Page bounds are inclusive and one-based. Ranges must be in bounds,\ndisjoint and target distinct Worksheet lessons in that private course. The\n50 MiB / 100-range limits are enforced before PDF parsing. `pdf-lib` extracts\nactual pages into independent PDFs and records private printable LessonAssets.\nAll resulting metadata commits together; storage failure compensates new PDFs.\nThe source packet is not retained. No shared/global course is accepted and no\nanswer-key join is created. A successful repeated packet upload intentionally\nadds another printable version; a failed upload can be retried safely.\n\nShared integration workflows run on SQLite and real PostgreSQL. Full DuckDB\nworkflow support remains outside the existing supported schema boundary.\n\n## Private asset boundary\n\nCaptured pages and split packet pages use `Asset.accessMode: 'private'` from their\ninitial insert. Ordinary generated Asset REST/MCP operations cannot list, hydrate,\nupdate or delete them, including through the parent STI model. The service opens\nan exact tenant/actor/learner-owner/asset-ID capability only after its normal learner\nrelationship checks. A host's signed serving route must repeat authorization and\nopen that exact capability before loading the asset. See the owning\n[private asset contract](../../assets/agents/private-assets.md).\n\nStorage must be private (including provider ACLs). Public HTTP(S) source locators\nare rejected; a hidden URL alone cannot protect publicly accessible bytes. Apply\nthe manifest migration adding `assets.access_mode` before deploying this runtime;\nlegacy ordinary assets retain the public default. Runtime creates no schema.\n\nPrivate lesson files must already be private Assets in the same tenant. Saving\nan answer-key join, or any join under a personal-use-copy course, requires the\nhost's exact actor/owner/asset capability; a public asset is never automatically\npromoted. Packet splitting retains this capability while creating each join.\nPersisted course tenant/license and section/lesson parent identity cannot change;\ncreate new structure and explicitly re-author its joins instead. Mandatory\nwrite predicates enforce this even for natural-key adoption and concurrent writes.\nOrdinary content and metadata refresh remains supported. This\nprevents existing public material being reclassified by moving its parent.\n\nFor pre-existing invalid joins, an authorized host must inventory private-material\njoins and remove invalid associations, recreate the bytes in private storage as a\nnew privately classified Asset, then re-author the join under its exact capability.\nDo not merely hide the URI, mutate access_mode with raw SQL, or delete shared\npublic bytes. This repair requires explicit storage/ownership authorization;\nnormal runtime does not migrate existing records.\n"
|
|
7800
|
+
"content": "# Submission and paper workflow\n\nConstruct `SubmissionService(db, authorizeLearner, authorizeCatalog, {storage,\nstoreOptions?, signAsset?})` from trusted server configuration. It extends\n`LearnerService`: the same active actor/tenant, memberships, linked person,\ndirected guardian relationship and host permission checks apply. The host must\nallow `education.learner.submit`, `education.learner.grade` or\n`education.learner.packet` as appropriate. Grade and packet actions always reject\nthe learner's own identity, even if the host authorizer returns true.\n\nThe protected transaction/auth hooks are internal owning-service extension\npoints. They are not handler APIs. All public service results remain data-only.\nUse the callback's service in `withTransaction`; escaped services are closed.\nSubmission operations share its serial queue, poison-on-failure behavior and\nPostgreSQL enrollment lock. No runtime schema creation occurs.\n\n## Capture and grading\n\n`captureSubmission` takes the learner request, `enrollmentId`, `lessonId`, a\nnonempty stable `requestKey`, and `pages` containing `name`, `mimeType` and Buffer\n`data`. Each upload becomes a fresh Asset owned by the learner's profile and\nexact tenant, joined solely through `SubmissionAsset`. Up to 100 uploads of\n25 MiB each are accepted (JPEG, PNG, WebP, or PDF). It atomically creates the\nsubmission/asset metadata and moves only that enrollment's progress to\n`submitted`, incrementing attempts once. Caller status, score, grader, asset ID,\nand answer-key flags are never patches. Equal request-key/content retries return\nthe existing submission; altered retries fail. Submitted/review/complete/skipped\nprogress rejects new captures. Content includes ordered filenames, MIME types,\nbytes and notes. Hosts should impose tighter request/body limits as needed.\n\n`captureBlankReference` records a workbook-page scan as immutable\n`blank_reference` evidence without advancing completion or creating a grade.\nTrusted ingestion scopes each receipt to the exact `enrollmentId` and calls\n`assertLessonAssignment` before reading retained evidence; it proves the active\ntenant, actor, learner, enrollment, and lesson without creating progress. A\nstable `intakeItemId` is claimed once in the durable tenant/item binding table,\nthen bound to the tenant, learner, lesson, progress, kind and predecessor; an\naltered retry fails. The binding is database-unique across enrollments while\nordinary uploads remain unbound. `resubmitSubmission` requires the current completed-work predecessor and\ncreates a new immutable `completed_work` attempt. Old pages, grades and feedback\nremain history; stale predecessors cannot be graded or replaced. A correction may\nreopen submitted, review or complete progress, while an AI proposal remains a\nnon-authoritative Grade until guardian review.\n\n`reviewSubmission` accepts an existing authorized submission and optional score\nand feedback. `attestLesson` creates/reuses an Attestation for a matching progress\nitem without requiring uploads. Both require a verified guardian and create a\nnew guardian Grade and set submission to `graded`. Ordinary non-workbook progress\nbecomes `complete`. Workbook-backed progress instead uses its explicit parent\ncompletion decision; grading alone leaves it in progress, including through a\nplain SubmissionService instance. Existing explicit completion on the current\nattempt is retained. The owning workbook join determines this policy, never a\ncaller flag.\nOmitted/null score is unscored; zero is a real score. The latest guardian grade\nwins over auto/AI/instructor proposals, and its score replaces progress's score.\nReview history is retained. ExternalCompletion is available for trusted server\npersistence; phase-zero learner handlers cannot forge reported scores. Online\nsubmissions and automatic grading are not implemented.\n\n`getSubmission` returns only submission metadata, page asset IDs and the selected\ngrade. It does not include catalog answers, extracted answers, storage paths,\nmodel objects, or database handles.\n\n`getLatestLessonSubmission` takes the learner request, `enrollmentId` and\n`lessonId`, repeats live read authorization and exact enrollment/catalog lesson\nscope, and returns the same safe view or `null` when no eligible work exists.\nIt reads at most one submission for that exact progress, choosing `completed_work`\nin `captured`, `needs_review` or `graded` status by `submittedAt DESC, id DESC`.\nBlank references, extracting and rejected work are excluded. Committed capture\nis retained evidence; it does not assert lesson completion. Hosts select completed\nlessons from authorized progress separately. An empty safe page list does not\nfall back to older work; asset signing still requires its own live authorization.\n\n## Storage and signed routes\n\nThe service creates an AssetRuntime bound to the operation's transaction. It\nrequires a resolved URI whose filename retains the fresh asset UUID and MIME\nextension; custom resolvers may choose its provider/directory but must route\nthat URI to the corresponding unique file. Shared existing locators are\nrejected before preservation or cleanup registration. It plans and persists\nthat unique asset URI before writing, registering that new\nasset for cleanup before the provider can partially write. After rollback,\nfiles are removed through the runtime store. Before deletion, the root database\nmust confirm that no asset owner committed: uncertain commit/read failures never\ncause committed bytes to be removed. Only this operation's newly created assets\nare candidates; pre-existing files are never adopted into its cleanup ledger.\n\nDatabase metadata is atomic; external storage uses compensation, not a database\ntransaction. If cleanup cannot complete, `SubmissionStorageCleanupError` contains\nfresh asset IDs and the original cause. Operators must reconcile those IDs in\nthe configured `education-page/<id>.<extension>` storage namespace (custom\nresolvers must retain their routing audit). A successful retry uses fresh IDs\nand cannot delete or reuse orphaned bytes. Process termination may also leave\nunreferenced files; hosts need storage orphan reconciliation. Do not suppress\ncleanup failures or claim crash-safe distributed atomicity.\n\n`signSubmissionAsset` verifies the submission/enrollment/learner ownership and\nits noun join, then verifies the Asset's tenant and learner profile before\ncalling the configured trusted signer. Claims contain actor, tenant, learner,\nenrollment, submission, asset and a five-minute expiry; no static source URI is\nreturned. The host signs every claim and its serving endpoint must verify the\nsignature, expiry, current actor/tenant and object authorization before serving.\nA bearer URL must never become a cross-family or sibling access bypass.\n\n`signLessonPrintable` signs only the exact authorized `printable` LessonAsset\njoin for an enrolled lesson. It never accepts an answer-key join and carries the\nsame tenant, actor, learner and enrollment scope as a submission claim.\n\n## Personal worksheet packets\n\n`splitWorksheetPacket` takes the guardian learner request, exact-owned\n`personal-use-copy` `courseId`, PDF bytes and ranges `{lessonId, firstPage,\nlastPage}`. Page bounds are inclusive and one-based. Ranges must be in bounds,\ndisjoint and target distinct Worksheet lessons in that private course. The\n50 MiB / 100-range limits are enforced before PDF parsing. `pdf-lib` extracts\nactual pages into independent PDFs and records private printable LessonAssets.\nAll resulting metadata commits together; storage failure compensates new PDFs.\nThe source packet is not retained. No shared/global course is accepted and no\nanswer-key join is created. A successful repeated packet upload intentionally\nadds another printable version; a failed upload can be retried safely.\n\nShared integration workflows run on SQLite and real PostgreSQL. Full DuckDB\nworkflow support remains outside the existing supported schema boundary.\n\n## Private asset boundary\n\nCaptured pages and split packet pages use `Asset.accessMode: 'private'` from their\ninitial insert. Ordinary generated Asset REST/MCP operations cannot list, hydrate,\nupdate or delete them, including through the parent STI model. The service opens\nan exact tenant/actor/learner-owner/asset-ID capability only after its normal learner\nrelationship checks. A host's signed serving route must repeat authorization and\nopen that exact capability before loading the asset. See the owning\n[private asset contract](../../assets/agents/private-assets.md).\n\nStorage must be private (including provider ACLs). Public HTTP(S) source locators\nare rejected; a hidden URL alone cannot protect publicly accessible bytes. Apply\nthe manifest migration adding `assets.access_mode` before deploying this runtime;\nlegacy ordinary assets retain the public default. Runtime creates no schema.\n\nPrivate lesson files must already be private Assets in the same tenant. Saving\nan answer-key join, or any join under a personal-use-copy course, requires the\nhost's exact actor/owner/asset capability; a public asset is never automatically\npromoted. Packet splitting retains this capability while creating each join.\nPersisted course tenant/license and section/lesson parent identity cannot change;\ncreate new structure and explicitly re-author its joins instead. Mandatory\nwrite predicates enforce this even for natural-key adoption and concurrent writes.\nOrdinary content and metadata refresh remains supported. This\nprevents existing public material being reclassified by moving its parent.\n\nFor pre-existing invalid joins, an authorized host must inventory private-material\njoins and remove invalid associations, recreate the bytes in private storage as a\nnew privately classified Asset, then re-author the join under its exact capability.\nDo not merely hide the URI, mutate access_mode with raw SQL, or delete shared\npublic bytes. This repair requires explicit storage/ownership authorization;\nnormal runtime does not migrate existing records.\n"
|
|
6790
7801
|
},
|
|
6791
7802
|
{
|
|
6792
7803
|
"path": "agents/workbook-service.md",
|
|
@@ -6817,6 +7828,11 @@
|
|
|
6817
7828
|
"path": "agents/learner-plan.md",
|
|
6818
7829
|
"module": "learner-plan",
|
|
6819
7830
|
"content": "# Enrollment Plan reads\n\n`LearnerPlanService(db, authorizeLearner, authorizeCatalog)` extends the existing\nLearnerService transaction/active actor boundary and adds private parent notes\n([notes contract](enrollment-notes.md)). Its `withTransaction` and `withExecutor`\nservices retain the Plan methods. Root exports `EnrollmentPlanView` and\n`PlanLessonView`; all results are data only.\n\n`listPlan(request)` returns exact learner enrollments ordered by sortOrder/id.\n`getEnrollmentPlan({...request,enrollmentId})` verifies that exact tenant,\nlearner, enrollment and curriculum before reading its course. Missing or denied\ncourse visibility returns `availability: 'unavailable'`, `course: null`, and\nempty lessons/evidence; it does not interrupt other authorized enrollments.\nActor/enrollment denial still rejects the request. Operational database errors\nare not disguised as missing material.\n\nThe course DTO contains only id, title, subject, summary, modality and sourceKey.\nTechnical unfiled capture scaffolding has sourceKey exactly `unfiled-work`;\nconsumers exclude it by identity, never by title. The DTO does not invent a cover\nor claim any source/asset preview binding. It returns no teacher or answer-key\nassets. Lessons preserve catalog section/lesson order and existing role-filtered\nprogress, including private workbook feedback rules. Optional workbookActivityId\nis resolved for the exact tenant/learner/enrollment/lesson; consumers route that\nwork to their workbook interface, not generic scan capture.\n\nWorkbook progress uses the same explicit parent completion projection as Work.\nOld grade-derived complete/skipped rows without a current decision project in\nprogress with completedAt null; they cannot contribute a completion timestamp to\nprogressEvidence. Later analysis of the same attempt retains a parent's decision;\na new correction or practice attempt reopens it. Ordinary lesson progress is\nunchanged. See [the workbook contract](workbook-service.md).\n\nFor required-online lessons, optional sourceUrl comes only from the same\ncatalog-authorized Lesson.externalUrl and must be HTTPS without credentials.\nAnswer URLs and asset locations are never projected. A missing or unsafe online\nURL is unavailable to Continue and cannot block a later usable lesson. Consumers\nrevalidate links at their own browser boundary and display honest unavailable\nmaterial states.\n\n`nextActionableLessonId` considers planned/active enrollments and only unstarted\nor in-progress lessons with usable material. Planned is usable because normal\n`enroll` creates planned enrollments and the base workflow has no activation API.\nPaused/completed/dropped enrollments have no next action. Complete/skipped lessons\nand submitted/needs_review work never instruct rework. `awaitingReviewLessonIds`\nis separate from Continue. Reads never change progress or create learning history.\n\n`progressEvidence` is nullable `{kind: 'started'|'completed',at,lessonId}` from\nvisible durable progress start/completion timestamps. It is the newest such\nrecorded timestamp, **not** latest actual work. Repeated starts preserve the\noriginal startedAt. Display it as “Last recorded start/completion”, never infer\nactivity from updatedAt, enrollment ordering, notes, or missing timestamps.\n\n```ts\nimport { LearnerPlanService, ENROLLMENT_NOTE_MAX_LENGTH, validateEnrollmentNote }\n from '@happyvertical/smrt-education';\nconst service = new LearnerPlanService(db, authorizeLearner, authorizeCatalog);\nconst plan = await service.listPlan(serverLearnerRequest);\nvalidateEnrollmentNote(text, requestKey); // input validation, not authorization\nconst note = await service.addEnrollmentNote({\n ...serverGuardianRequest, enrollmentId, text, requestKey,\n});\n```\n\nBuild before consuming the public package; deploy its ordinary additive manifest\nmigration before using notes. No runtime handler creates application schema.\nShared Plan and note workflows run against SQLite and PostgreSQL.\n"
|
|
7831
|
+
},
|
|
7832
|
+
{
|
|
7833
|
+
"path": "agents/group-sharing.md",
|
|
7834
|
+
"module": "group-sharing",
|
|
7835
|
+
"content": "# Homeschool group sharing contract\n\nArchitecture and pre-implementation test design for [SMRT #4469](https://github.com/happyvertical/smrt/issues/4469), consumed by Hearth #41. This document defines the intended contract; it is not a claim that implementation or validation has passed. Risk is high: explicit cross-tenant authorization, private child media, concurrent consent mutation and new persistent schema.\n\n## Ownership and boundary\n\nA group has an independent users `Tenant`, created with `TenantService` in the caller transaction, and ordinary users memberships/roles/permissions for its supervisors. Family tenants remain independent; do not make them descendants of the group. A supervisor never receives family membership, an inherited family role, a guardian relationship, or a family resource grant. Profiles remain canonical identities. Users `Group` is tenant-local RBAC, not the homeschool relationship.\n\nEducation owns a per-child group relationship in the child's exact family tenant. Its identity is `(familyTenantId, learnerId, groupTenantId)`, allowing several children and several groups without copying work. All work, immutable attempts/revisions, source files, releases, marks and comments stay family-owned. Revoking participation or narrowing a policy changes access, never deletes learning history or attribution.\n\n`ResourceGrantService.checkResourceOperationPermission` first requires permission in the resource's tenant. It cannot authorize these family reads without broadening supervisor authority. Reuse users permission checks in the group tenant; do not use ResourceGrant as a cache of policy matches. `TenantService` seeds roles during initialization and does not itself wrap create+ownership in a transaction; initialize/provision under the service's executor and reject partial creation.\n\nThe only cross-tenant entry is an explicit `GroupSharingService` operation. A trusted host authorizer receives the exact active executor and verifies current stored session, user, group membership and operation permission. Education then validates the persisted group, exact family/child edge and current policy before using exact family-scoped collection reads. No user-supplied SQL, cross-family list, system context, `allowCrossTenant` escape, synthesized guardian authorization, or direct collection handle is exposed. A reviewed scope switch may select only the already validated exact family and restore the caller context; it never turns a family collection into an unscoped query.\n\nGroup roster discovery uses only `GroupLearnerRosterEntry` enumerated with exact group tenant and group ID predicates. Its opaque selectors route to each exact family-owned membership and current policy, which are independently checked before any learner name or work is projected. A roster row is not an access grant: stale, revoked, corrupt or mismatched edges are denied. Never discover group participants by an unscoped query over family-owned memberships, invitations or work. Acceptance writes the roster index in the same transaction as the family edge/policy and invitation status. Revocation can retain that index for stable opaque history; it must confer no continued access. Concurrent acceptance/retry creates one index row, and rollback leaves none.\n\n## Closed persistence\n\nAll models disable API, MCP, CLI and AI mutation/discovery surfaces. Exports/manifests/recipe registration must preserve that closure. Use qualified cross-package references to users/profiles and local foreign keys inside education. Models are root-importable for generated registration. Tenant predicates are explicit on every family lookup, including foreign-key validation. Do not silently upsert immutable identities.\n\n| Model | Ownership and minimum fields | Invariants |\n| --- | --- | --- |\n| `EducationGroup` | Group tenant; name, active flag, creator user/profile | One record per group tenant. No family data. Group creation and users owner membership commit together. |\n| `GroupLearnerInvitation` | Group tenant; group, opaque familyTenantId/learnerId selectors, exact invited parent user, creator, expiry, status, accepted edge ID, accepted policy digest | Status pending/accepted/revoked/declined; expiry required; immutable scope. Group staff creates a targeted invitation without reading or confirming family/learner data. Validate the exact family/learner only at parent acceptance. ID selects an invitation, never proves parent identity. |\n| `GroupLearnerMembership` | Family tenant; group, learner, consent parent, status active/revoked, policyVersion | Unique family/learner/group tuple. Revocation is durable. A fresh invitation is required to reactivate a revoked edge; old accepted invitation cannot reactivate it. No one-child-only uniqueness. |\n| `GroupLearnerRosterEntry` | Group tenant; groupId, familyTenantId, learnerId, membershipId | Unique group/membership tuple; immutable opaque scope index, populated atomically with acceptance. Stores no names, work or policy payload and confers no access. |\n| `GroupSharingPolicy` | Family tenant; membership, monotonically increasing version, schemaVersion=1, canonical policy JSON, parent actor/time | Immutable append-only snapshots; edge points at current version. Unique membership/version. Explicit policy at acceptance; no implicit share-all. |\n| `GroupRevisionComment` | Family tenant; edge, learner, activity, attempt, exact revision, author user/profile, body, createdAt, childVisible=false, visibility parent/time/version=0 | Stable author and revision binding; cannot grade, alter assessment/evidence or silently move to a newer revision. Only parent changes child visibility. Group departure retains row. |\n\nUse guarded JSON getters/setters and runtime validation for policy documents. Enforce tuple uniqueness with database schema constraints. Validate status/version on model writes and revalidate persisted values on service reads, failing closed on corrupt or unknown values. The public model decorator does not expose SQL CHECK constraints; do not broaden core or claim database CHECK enforcement for these fields. Use normal manifest migrations; never create schema at runtime. Invitation delivery/authentication is host-owned; group invitations do not mint identity sessions, and acceptance requires an independently authenticated current parent. Initial release may use exact known parent IDs; mailbox identity onboarding is not implied by an invitation ID.\n\n## Service API and policy\n\nAll requests carry authenticated `actorUserId`, actor session/context binding and explicit resource selectors; none of those are accepted as authority merely because they are present. Proposed public operations:\n\n- `createGroup`, `getGroup`: current group administration/reading through users permissions; provision atomically.\n- `inviteLearner`: current group invitation authority creates a group-owned invitation for an exact known parent and opaque preknown family/learner selectors; it does not read family data, prove those selectors exist or require the inviter to be a guardian. `revokeInvitation` requires current group invitation authority. `declineInvitation` requires the exact currently authenticated invited parent and makes a pending invitation terminal without revealing learner data. `acceptInvitation({ invitationId, policy })`: the exact named parent must currently be guardian of the selected child in the selected family; acceptance requires explicit valid policy. Accept locks the invitation and child/group edge, rechecks active group, parent authority and expiry, inserts edge/policy/group-owned roster index and marks accepted atomically. The parent need not be a group member or supervisor.\n- `setSharingPolicy({ membershipId, expectedVersion, policy })`, `revokeMembership`: current family guardian only. An accepted retry returns the same edge only when parent and original canonical policy digest match and current edge remains active; it never resets policy changed later. Wrong-parent retries fail. Changed acceptance payload conflicts. Expired, revoked or declined pending invitations fail. Accepted historical retry may return original result after expiry only while its current edge is active and parent remains authorized.\n- `previewSharing({ membershipId, policy? })`: current parent; evaluates saved or explicitly proposed policy using exactly the evaluator and projection used for supervisor reads. Proposed preview does not persist or grant access. Return per-item allowed facets and parent-facing reasons.\n- `listSharedWork`, `getSharedWork`, `getSharedRevision`, `readSharedMedia`, `getSharedProgress`: current group supervisor, exact active edge and current policy, with bounded pagination. Reauthorize each call and each selected resource; no reusable authorization result escapes the invocation.\n- `addRevisionComment`, `listRevisionComments`: supervisor comment write requires currently shared exact work/revision and group comment permission; parent reads retained family comments independently of group revocation. Child reads require own learner identity and the current saved parent comment-visibility policy; version-zero comments inherit that policy. `setCommentChildVisibility({ commentId, expectedVersion, visible })` is parent-only.\n\nPolicy v1 has explicit booleans `shareWork`, `shareMedia`, `shareFeedback`, `shareProgress`, `parentReviewedOnly`; `historyFrom` is a required valid UTC instant; `commentVisibility` is required and accepts only `parent-only` or `learner-visible`; the host presents `parent-only` as the initial default but the service requires an explicit saved choice. `subjects` and `courseIds` are explicit selector objects (`all` or nonempty `include` values). Unknown version/keys/enums, malformed or missing required fields fail closed. Empty include selects nothing or is rejected consistently; it never means all. An explicit all selector intentionally allows unknown metadata; any restriction requires matching authoritative metadata. Subject comes from the retained activity's authorized course metadata, not a browser label or inferred assessment text. Course metadata is resolved through the same authorized self/ancestor/global catalog scope for options, preview and supervisor reads, after validating the child's exact family-owned enrollment. Catalog scope conveys no family or guardian authority to a supervisor. Synthetic routing courses for unfiled captures are excluded from selector options; unfiled capture facts retain unknown course and subject even if a technical placeholder has a label or subject. Genuine enrolled courses remain selectable before any capture. An unfiled activity or missing course/subject does not match a restricted selector. Both restrictions intersect when present.\n\nOne pure evaluator takes normalized policy and verified work/revision facts. All public reads and preview call it. History is based on immutable attempt capture time, inclusive at the cutoff; reanalysis/re-filing does not make old work new. Each correction attempt is evaluated separately. `parentReviewedOnly` requires a valid guardian revision of the selected attempt; AI analysis, child release acknowledgement or merely having some other reviewed attempt is insufficient. Feedback is projected only when enabled and the exact selected revision satisfies the review gate; work and media DTOs never incidentally contain feedback, marks or hidden historical question text. Progress may be enabled independently of feedback/work payloads: derive it only from permitted attempts/revisions, never from the whole-family summary. Media is allowed only for an allowed work attempt and the explicit media flag. New matching work appears automatically through evaluation, without per-work grants or background grant materialization.\n\nSupervisor projections contain stable activity/attempt/submission/revision IDs and authorized data only. They expose no writable models, family settings, sibling counts, source storage URLs, answer keys, personal-use catalog assets or ingestion scratch. Work identity does not authorize all revisions. Default omitted revision selects a deterministic permitted current revision; explicit unavailable revision refuses, never silently falls back. Policy flags remain independent; test every combination where one facet could leak through another.\n\n### Fixed exported contracts for implementation\n\nPut shared types and validators in `src/group-sharing-contracts.ts`; models import them, while the pure evaluator imports types only. The following names are the consumer contract, not alternate spellings for workers to invent:\n\n```ts\ntype GroupSharingSelector =\n | { mode: 'all' }\n | { mode: 'include'; values: string[] };\ninterface GroupSharingPolicyV1 {\n schemaVersion: 1;\n shareWork: boolean;\n shareMedia: boolean;\n shareFeedback: boolean;\n shareProgress: boolean;\n parentReviewedOnly: boolean;\n commentVisibility: 'parent-only' | 'learner-visible';\n historyFrom: string;\n subjects: GroupSharingSelector;\n courseIds: GroupSharingSelector;\n}\ninterface GroupSharingActor {\n actorUserId: string;\n sessionId: string;\n}\ninterface GroupSharingScope extends GroupSharingActor {\n groupId: string;\n familyTenantId: string;\n learnerId: string;\n}\ninterface GroupSharedWorkSelector extends GroupSharingScope {\n activityId: string;\n attemptId: string;\n revisionId?: string;\n}\ninterface GroupSharingWorkFacts {\n capturedAt: string;\n courseId: string | null;\n subject: string | null;\n parentReviewed: boolean;\n}\ninterface GroupSharingDecision {\n eligible: boolean;\n work: boolean;\n media: boolean;\n feedback: boolean;\n progress: boolean;\n reasons: string[];\n}\n```\n\nExport `validateGroupSharingPolicy`, `evaluateGroupSharingPolicy(policy, facts)`, `GroupSharingAuthorizationError`, and `GroupSharingConflictError`. `GroupSharingWorkFacts` is populated only by the owning reader, never request JSON. Return names are `EducationGroupView`, `GroupLearnerInvitationView`, `GroupLearnerMembershipView`, `GroupSharedWorkView`, `GroupSharedRevisionView`, `GroupSharingPreview`, `GroupSharedProgressView`, and `GroupRevisionCommentView`. Views are immutable data DTOs, with no model instances or executor. Use `familyTenantId` in requests; family-owned models store that as their required `tenantId`. Invitation and roster-index ownership are the explicit exceptions: its `tenantId` is the group tenant and `familyTenantId` is a distinct opaque scope field. Invitation group staff DTOs disclose only submitted selectors/status, never dereferenced family names, existence or child data. `groupId` references EducationGroup, whose `tenantId` is the users group tenant. Do not confuse these two tenant selectors.\n\nEligibility means course/subject/history/review gates pass; facets intersect eligibility with their explicit flag. `media` additionally requires `shareWork`, so the first implementation exposes original media only with work enabled. Progress can remain enabled while work/feedback DTOs are disabled. Assessment-derived text, answers, scores, computed answer regions and annotated renditions count as feedback. With feedback disabled but work/media enabled, the authorized original child submission bytes remain accessible: marks physically present in those original bytes are intrinsic source content, not a hidden assessment projection. Hosts must make that parent choice clear. A hidden guardian-origin reference/cover or answer-key file is never promoted to an original child submission merely by this toggle.\n\nThe authorization callback is `GroupSharingAuthorizer(request)` where request carries actor, exact group/family/learner selectors as applicable, a discriminated action and `executor: DatabaseInterface`. Actions are `education.group.create`, `education.group.manage`, `education.group.read`, `education.group.invite`, `education.group.share`, `education.group.review`, `education.group.comment`, and `education.group.child-comments`. The host verifies live identity and its effective permissions/guardian terms; the service independently verifies persisted resource scope, current edge/policy and exact selectors. Callback success never bypasses those checks. The reader accepts this callback, never a boolean token, and exposes only read/projection methods. No generic `authorizeAsGuardian` or arbitrary collection callback belongs to this API.\n\n## Owning workbook/media seams\n\nCurrent `WorkbookService` activity/timeline APIs require learner/guardian authority; replacing the authorizer with unconditional true would create a broad guardian backdoor. Add an explicit read-only owning projection seam with a required exact-resource authorization callback, invoked on its active executor before loading private data and again at final projection/delivery where appropriate. It must not expose mutation methods or accept an externally cached authorization boolean. This seam can live in a dedicated education sharing reader that uses owned collections with exact predicates; private workbook algorithms should be shared through an owning helper rather than copied or private-state access.\n\nThe selected attempt must belong to exact family/learner/activity/submission; selected revision must belong to that attempt. Original bytes must be owned through `SubmissionAsset`, match the retained source ID/hash and belong to the learner's private asset owner. Photo covers/reference-only receipts are not work. The ordinary `signSubmissionAsset` returns a signed URL after learner authorization; it is insufficient for this sharing contract. `readSharedMedia` must run current policy/role/session/edge checks for every HTTP delivery and open the exact `withPrivateAssetAccess` scope only within that request. Return bytes or execute a scoped streaming callback; never return public/presigned storage URLs or a long-lived capability. The host route must invoke it even for a replayed/direct URL and configure private storage/cache headers. No framework can revoke bytes already delivered; successful reads linearize at their final authority check. A revocation completed before a new request must always deny that request.\n\nShared progress recomputes from the permitted subset of current guardian evidence and never calls the full guardian summary then merely redacts its citations. With `shareProgress=true` and `shareFeedback=false`, its strict field allowlist is counts of shared completed work, distinct practice episodes, and assistance categories (independent/assisted/unknown) only. Completion here means a permitted work attempt exists as completed/captured work, never a correctness threshold or private Grade-derived completion decision. Do not expose correctness, points, possible points, scores, concept labels, question identities/text/answers, feedback or outcome-derived aggregates. No question-level evidence citations appear in this counts-only shape. This restriction must hold even for a single attempt, where an aggregate would reveal the entire withheld outcome. When feedback is also enabled, authorized descriptive concept evidence may additionally be projected with permitted citations and existing episode deduplication; it still cannot include hidden subject/history/sibling evidence.\n\nComments remain outside Grades, assessment revision bodies, scoring and progress evidence. Parent-only comments can be shown to their currently authorized author/supervisors and guardians; this means hidden from children by default, not anonymous. Parent can retrieve original author/time after revocation. Child comment access always checks the current saved policy: `parent-only` denies all child comment reads immediately, including previously visible comments; `learner-visible` permits default comments whose `visibilityVersion` is zero. A parent may additionally set an individual override: when `visibilityVersion > 0`, `childVisible` must be true as well as the saved policy being `learner-visible`. Thus a saved learner-visible choice needs no per-comment opt-in, an individual false override narrows it, and an individual true override can never broaden parent-only. Policy changes apply on the next read and never rewrite the original comment or its attribution.\n\n## Transaction and race semantics\n\nUse one active executor for current users/session checks, guardian relationship terms, group state, edge/policy and owned data. Authorization hooks must not capture the outer pool. Mutations run in the education transaction/composite queue with deterministic lock ordering (learner, group/edge, invitation/comment as applicable); acquire the learner lock in the same order as workbook capture/review. PostgreSQL must arbitrate with row locks or conditional writes plus unique keys; process-local locks alone are insufficient. SQLite serialization must not overlap statements on a single native handle. Failed nested operations poison/roll back the enclosing operation even if a callback catches an error.\n\nConcurrent identical acceptance converges to one active edge, one first policy, one group-owned roster entry and one accepted invitation result. Competing policies cannot both win; one conflicts. Concurrent policy updates using one expectedVersion produce one successor. Education-owned edge/policy/invitation mutations participate in the same lock/guard protocol: acceptance versus invitation revoke and comment writes versus edge revoke/policy narrowing are serialized, so the losing mutation cannot commit on stale education-owned state. External users sessions, roles/memberships and guardian-term writers do not participate in that protocol. Their authority linearizes at the final successful live authority read on the active executor, not at transaction commit. An operation authorized before a concurrent external revocation may finish; a new request starting after that revocation committed must deny. A same-executor callback or second read alone cannot close the final-check-to-commit window, and this contract does not claim otherwise. Do not use a transaction snapshot established before the request to satisfy a new request's current-authority check. Stronger commit-time exclusion would require an actual owning users/profiles writer protocol and is outside this contract. Media reads use final-check linearization; bytes already delivered cannot be recalled. Database, authorizer or asset failures propagate as failures, never authorize on fallback. Failed group creation, acceptance and policy append leave no partial tenant/owner/edge/policy/roster/acceptance state. No service starts containers.\n\n## Behavior-to-test matrix\n\nThis is the test-design-contract matrix. Every row requires recorded execution evidence before release. Common context abbreviations: P = independently authenticated current family guardian; S = authenticated group supervisor; C = own child; X = outsider, sibling or other-group actor. TX means the same exact executor for authorization and persistence. SQ/PG means in-process SQLite and PostgreSQL; Node is the supported server runtime. Browser is intentionally not an authorization runtime. Command S: `pnpm --filter @happyvertical/smrt-education exec vitest run src/__tests__/group-sharing-lifecycle.test.ts src/__tests__/group-sharing-adversarial.test.ts src/__tests__/group-sharing-reader.test.ts src/__tests__/group-sharing-comments.test.ts`; command P: `pnpm --filter @happyvertical/smrt-education test:postgres`; command M: `pnpm --filter @happyvertical/smrt-education exec vitest run src/__tests__/group-sharing-models.test.ts src/__tests__/group-sharing-manifest.test.ts`; command B: package `typecheck`, `build`, `verify:pack`. The shared behavioral harness must be imported by both SQLite and `group-sharing.optional.test.ts`; a skipped optional PG suite is not passing PG evidence.\n\n| ID / behavior | Reachable trigger | Positive | Negative / failure | Actor/context | Executor / transaction | Runtime / dialect | External edge | Level / command |\n| --- | --- | --- | --- | --- | --- | --- | --- | --- |\n| G01 isolated group | createGroup | owner membership and group in distinct tenant | rollback after tenant insert; no family membership/parent hierarchy | P, X | TX provision atomic | Node SQ/PG | TenantService failure, unknown permission | integration S/P |\n| G02 closed persistence | generated registration/discovery | package imports models/recipe | no REST/CLI/MCP/AI CRUD advertised | untrusted caller | manifest, no DB needed | Node; schema SQ/PG | packed root exports | contract M/B |\n| G03 edge cardinality | invite/accept multiple edges | two children × two groups coexist | duplicate tuple or rebinding learner/family | P, X | TX unique constraints | Node SQ/PG | malformed IDs | integration S/P |\n| G04 invite targeting | inviteLearner/accept | group inviter creates without family lookup; exact parent accepts with current effective guardian terms; exact parent declines | other parent, expired relationship, wrong family/group/sibling, expired/revoked/declined invite | P/X | TX current session + relationships | Node SQ/PG | absent/expired session, authorizer throw | adversarial S/P |\n| G05 explicit policy | acceptInvitation | valid explicit v1 choice | omitted policy, unknown version/key, malformed date/selector/boolean | P | TX no partial writes | Node SQ/PG | untrusted JSON | service S/P |\n| G06 retry | accept same invite | same edge/policy/result, even after later policy narrowing | changed payload/parent; revoked edge never reactivated | P/X | TX immutable digest | Node SQ/PG | request replay | integration S/P |\n| G07 acceptance race | two accepts | identical requests converge | differing policy, revoke/expiry wins; injected failure rolls all back | P | independent root connections PG, serialized SQ; unique arbiter | Node SQ/PG | failure between edge/policy/roster/accepted writes; retry leaves one index row | concurrency S/P |\n| G08 policy version | setSharingPolicy | append version and preserve previous snapshots | stale expected version, supervisor write, invalid payload | P/S | TX compare-and-set | Node SQ/PG | concurrent updates, upstream auth failure | concurrency S/P |\n| G09 automatic evaluator | new capture/list | matching new work appears without grant creation | unknown restricted subject/course; course and subject mismatch | S/P preview | TX exact family queries | Node SQ/PG | unfiled/missing metadata | unit + service S/P |\n| G10 history/review | get work/revision | inclusive cutoff and reviewed exact attempt | old attempt reanalysis, other attempt's review, provisional-only revision, malformed ancestry | S | TX immutable facts | Node SQ/PG | future/invalid dates, stale revision ID | unit + adversarial S/P |\n| G11 facet independence | every public DTO | explicit work/media/feedback/progress combinations | disabled feedback leaks through marks/status/comment or progress; disabled media via anchors | S | TX projection | Node SQ/PG | omitted optional payload fields | table-driven S/P |\n| G12 preview parity | preview and subsequent reads | identical allowed IDs/facets under same saved/proposed policy | unauthorized preview; proposal creates grant/write | P/S | same evaluator/TX | Node SQ/PG | policy parse failure | contract S/P |\n| G13 current authority | list/detail/revision/media/comment/summary | active S exact group+edge | stale session, removed role, inactive membership/group, wrong active context, sibling/group edge | S/X | current TX reads, cache:false | Node SQ/PG | every public service path | adversarial parameterized S/P |\n| G14 narrowing/revoke | reuse IDs/direct route after change | parent retains originals/history | previously allowed S denied after policy/edge/group/role/session revoke | P/S | TX; final check | Node SQ/PG | stale URL and request replay | service + host contract S/P |\n| G15 exact source ownership | readSharedMedia | exact SubmissionAsset retained hash and private owner | foreign asset/submission/revision, source cover, answer key, tampered hash, public URL | S/X | TX + exact private scope | Node SQ/PG | storage missing/failure; no leaked locator | integration S/P |\n| G16 immutable work IDs | list/get/correction/reanalysis | stable attempt/revision IDs and source citation | foreign revision, selector fallback, reanalysis counted as new practice | S | TX read-only | Node SQ/PG | workbook reader seam | integration S/P |\n| G17 scoped progress | getSharedProgress | counts-only allowlist without feedback; descriptive evidence with feedback; episodes deduped | single-attempt or multi-attempt withheld correctness/score/concept/question leakage; hidden evidence contributes counts | S | TX filtered evidence before aggregate | Node SQ/PG | nullable scores/unknown assistance | integration S/P |\n| G18 comment author/binding | add/list comments | exact visible revision, stored current author | forged author, hidden/foreign revision, supervisor grade/evidence mutation | S/P | TX immutable bind | Node SQ/PG | malformed/empty/oversize text | adversarial S/P |\n| G19 comment visibility | set visibility/child list | saved learner-visible exposes version-zero defaults; explicit false narrows; parent-only immediately hides all | missing/unknown policy field, default parent-only C read, sibling, supervisor visibility update, stale version | P/C/S/X | TX guarded visibility version | Node SQ/PG | visibilityVersion=0 inherits; >0 requires childVisible plus saved learner-visible | integration S/P |\n| G20 retained family records | revoke then family read | originals, revisions, comments/attribution remain | supervisor retains old access; cascade removes learning rows | P/S | TX family authority independent of group | Node SQ/PG | no byte cleanup on revoke | integration S/P |\n| G21 transaction affinity | host hooks in operation | all callbacks observe exact TX including nested reads | outer-pool hook usage, swallowed failure commits, closed service reuse | P/S | instrument executor; rollback injection | Node SQ/PG | callback failure | integration S/P |\n| G22 interleaving authorization | comment/media vs revoke/narrow | own edge/invite/policy mutations serialize; pre-external-revoke authorized operation may finish | stale own-edge check commits after winning revoke; new post-commit session/role/guardian-revoke request succeeds | P/S | independent PG transactions/barriers; SQ serial equivalent | Node SQ/PG | deterministic barriers for own-edge race and external final-check/new-request semantics | race S/P |\n| G23 migration compatibility | manifest upgrade + normal schema apply | six closed models migrate on empty/existing DB; old workbook history unchanged | missing schema fails without runtime DDL; duplicate edge/roster tuple blocked; corrupt status/version read denied | deploy | explicit migration TX | Node SQ/PG | native UUID FKs, migration failure | schema U/P/B |\n| G24 recipe/plugin contract | recipe discovery and packed import | group recipe registered, service/types usable | generated CRUD exposed or missing root symbol | host | N/A: static registration, no persistence | Node | downstream manifest/recipe consumer | contract M/B |\n| G25 bounded query scope | list pagination/direct service | exact group-owned roster enumeration then each exact family edge/policy check; bounded results/stable cursors | forged/stale roster grants access; caller limit hides deny; cursor reveals foreign work; raw cross-family edge query | S/X | TX group index read then exact family predicates | Node SQ/PG | invalid cursor/limit | adversarial S/P |\n| G26 staff group discovery | listMyGroups after login | own active groups; inactive group only for current manager | other user/session, removed membership, inactive nonmanager group | S/X with original session context | TX users own-membership enumeration then exact group scope | Node SQ/PG | unknown group tenant and authorizer error | integration S/P |\n| G27 family/child navigation | listLearnerMemberships access guardian/child | parent retained summaries; own child active group names | sibling, wrong actor, child guardian-policy/history escalation; revoked/disabled child edge | P/C/X | TX exact family/learner, current own-user proof | Node SQ/PG | invalid access selector | adversarial S/P |\n| G28 invitation preview/list | getInvitation/listInvitations | named guardian preview without group membership; staff opaque selectors | wrong invitee, missing guardian proof, staff family dereference | P/S/X | TX exact group invite; parent exact family proof | Node SQ/PG | parent/staff explicit access discriminator | integration S/P |\n| G29 retained policy history | getSharingPolicyHistory after leave | immutable versions/actors/time and scoped numeric pagination | supervisor/child read, malformed cursor/limit, foreign edge | P/S/C/X | TX exact family edge, guardian before/after | Node SQ/PG | unknown stored policy or version fails closed | integration S/P |\n| G30 opaque revision binding | feedback withheld; new revision before comment | work exposes immutable comment ID; comment remains on opened revision | foreign/provisional assessment under selected-review gate, hidden assessment payload | S | TX exact attempt/revision and current policy | Node SQ/PG | opaque comment selector independent of feedback | reader/comments S/P |\n\n| G31 pre-consent policy options | getSharingPolicyOptions exact family/learner before invite acceptance | current guardian receives labeled learner course/subject options without a group edge | child/supervisor/outsider, wrong family/learner, stale guardian/session, private answer/catalog data | P/S/C/X | TX exact family/learner guardian before/after; no policy mutation | Node SQ/PG | groupId omitted; current scoped metadata only | reader S/P |\n| G32 metadata/private capability isolation | ordinary member group home vs roster/work | education.group.read permits group metadata/discovery only; education.group.review permits authorized private scope | metadata-only member roster/work/revision/media/progress, role/action escalation | current stored ordinary member/S | TX role/session/group plus exact edge/policy before/after | Node SQ/PG | guardian review remains separate exact guardian proof | adversarial S/P |\n\n## Implementation ownership partitions\n\nCoordinate these partitions before editing; integrations are serial, not concurrent edits to the same file.\n\n1. Persistence/contracts worker: `src/group-sharing-models.ts`, `src/group-sharing-contracts.ts`, `src/__tests__/group-sharing-models.test.ts`. Own validation/types/closed models and unique schema; freeze exported interfaces first.\n2. Lifecycle worker: `src/group-sharing-service.ts`, `src/group-sharing-authorization.ts`, `src/__tests__/group-sharing-lifecycle-workflows.ts`. Own group/invitation/edge/policy state machine, shared transaction and current-authority boundary. Do not implement a second workbook reader.\n3. Read/projection worker: `src/group-sharing-reader.ts`, `src/group-sharing-policy.ts`, `src/__tests__/group-sharing-read-workflows.ts`. Own same evaluator for preview/reads, exact work/media projection and scoped summary. Any changes needed to `src/workbook-service.ts` or `src/submission-service.ts` belong exclusively to this worker after parent approves the owning seam. Do not widen LearnerAuthorizer.\n4. Integration owner: `src/group-sharing-comments.ts`, shared test runner `src/__tests__/group-sharing-workflows.ts`, SQLite/PG entrypoints, `src/index.ts`, `src/recipes.ts`, recipe help, package docs/AGENTS and generated artifacts. Integrate comment API after lifecycle/read interfaces stabilize, run full validation/review once. Could delegate comments as a separate non-overlapping worker after contracts freeze.\n5. Architecture owner: this document only. Record executable evidence/results through the parent session; proposed matrix rows do not substitute for executed tests.\n\n## Upstream/host contract gaps to resolve before release\n\n- Existing workbook guardian projections and signed asset API are not a sharing boundary. The new owning read seam and host authenticated media route are mandatory, not optional integration notes.\n- Host current-session/group permission and current guardian-term verification must use the provided transaction executor. No external app is permitted to supply an always-allow callback or stale role snapshot. Document exact action names/role seed in implementation.\n- Course.subject is a mutable string; define whether policy uses current authoritative metadata (recommended for immediate narrowing) or immutable metadata snapshots. This design uses current authoritative course metadata and immutable capture time. Missing/re-filed metadata is reevaluated each read.\n- PostgreSQL concurrent tests need independent connections and deterministic barriers. One connection or in-process mutex does not establish multi-process acceptance/revocation safety. Integration owner supplies the isolated existing test service; workers do not provision containers.\n- Public consumer contract must record the published SMRT version, exported types/actions, migration/recipe activation and media route obligations. Hearth consumes that release only; no local tarball or host shim.\n\n## Host integration and migrations\n\nThe public `GroupSharingService(db, authorize, options?)` facade owns lifecycle,\nreader and comment operations. Internal reader/comment classes are not root\nexports: their borrowed-executor flags are owning implementation details.\n`options` uses the normal `SubmissionServiceOptions` private storage adapter.\nThe facade supports atomic `withTransaction` composition; any failed queued\noperation poisons the complete transaction, and escaped services reject reuse.\n\n`updateGroup` changes the bounded display name or active flag under live\n`education.group.manage` authority. Management can reactivate an inactive group;\nnormal read, invitation and supervisor operations cannot use an inactive group.\nDisabling does not delete family rows. `removeLearner` is group-management\nrevocation, `leaveGroup`/`revokeMembership` are guardian revocation.\n`listMemberships` enumerates only the active group's roster index and rechecks\neach authoritative family edge under `education.group.review`. `getGroup` and\nactive `listMyGroups` use `education.group.read` for group metadata only; that\ncapability never authorizes child roster or shared work, revisions, media or\nprogress. Those private supervisor operations require `education.group.review`\nand the current exact family edge/policy. Hosts may grant ordinary members group\nmetadata reading without any private learner access. `listLearnerMemberships` is exact-family guardian\naccess. Neither method offers arbitrary cross-family education discovery.\n\nShared work includes an opaque `commentRevisionId` even when assessment feedback\nis withheld. Bind the comment form to that exact viewed revision and submit it\nunchanged; never resolve the latest assessment again when saving a comment.\nThe identifier grants no assessment access. Feedback and child comment visibility\nstill pass their independent current policy checks on every read.\n\nActivate `education.supervisor` through the host cookbook, rebuild registration\nand apply the host's normal manifest migrations before serving group routes.\nThe six additive tables use generated native UUID references and unique keys.\nDo not alter existing workbook rows or remove family data when a group leaves.\nA missing table is a migration error, never permission to create schema during\na request. Test schema generation uses the same structured manifest on SQLite\nand PostgreSQL; deployments retain their normal migration backup/rollback policy.\n\nHosts refresh the stored session and effective group permissions/guardian terms\non the callback's exact executor. Action strings above are capability names,\nnot a promise that any ordinary users role receives them automatically. Seed\nonly the desired group supervisor/admin roles and never grant family guardian\npermissions. Invitation delivery is host-owned; an invitation identifier alone\nis not a bearer credential. Parents can use only existing currently authorized\nlearners named by the immutable invitation.\n\nServe original bytes through `readSharedMedia` on every authenticated HTTP\nrequest, including direct bookmarks. The result carries `private, no-store`;\nhosts must also set safe MIME/disposition, sandbox CSP and `nosniff`, and never\ncache responses in a service worker or expose underlying asset paths. Uploaded\noriginals can contain marks physically present on paper even when generated\nassessment feedback sharing is disabled.\n\nHost navigation uses `listMyGroups(actor)` for the actor's current users memberships\nand `listLearnerMemberships({ ..., access: 'child' })` for an authenticated child's\nown active group edges. Child navigation uses `education.group.child-comments`\nand never grants guardian access to consent or policy history. Group discovery\nkeeps the original authenticated session context and derives exact group scopes\nfrom stored memberships; inactive groups require current management authority.\nStaff role assignment/removal uses the existing public users collections under\nhost authorization on the same executor. Education sharing never substitutes\nfor those users permission checks or gives staff family authority.\n\n`getSharingPolicyOptions({ actorUserId, sessionId, familyTenantId, learnerId })`\nreturns current course labels/subjects for a currently authorized guardian before\nconsent, without requiring a group or accepted invitation. It uses the same\nactive executor and exact learner ownership checks; it creates no grants or\npolicy history. Host guardian decisions must validate the supplied exact current\nrelationships/terms separately from a group's `education.group.review` role.\n\n## Trusted workspace-kind metadata\n\n`isGroupTenant(db, tenantId): Promise<boolean>` is a trusted host-only metadata\nlookup for an exact server-selected resource tenant. It uses the supplied current\nexecutor, verifies that the Tenant exists freshly, and checks the owning\n`education_groups` table for that exact tenant. Blank, malformed, missing or\nambiguous scope fails closed. The result is independent of group activation,\nTenant status, memberships and staff roles: disabling a group or removing a staff\nmembership never turns it into a family. The result contains no name, roster,\npermission or grant and creates no session or tenant context. It has no generated\nREST, MCP or CLI surface.\n\nOn PostgreSQL, the exact bounded group count and `row_security_active` check\nshare one statement on the caller's executor. One visible row establishes group\nkind; an ambiguous result fails closed. Zero rows establishes family kind only\nwhen PostgreSQL reports row security inactive for that relation and caller.\nUnder active RLS, zero rows is indeterminate and throws `Tenant kind is unavailable`,\nincluding for an actual family tenant. The host needs an already trusted metadata\nexecutor with provable unrestricted visibility to classify families. Policy-level\nbypass settings alone do not prove that visibility. The helper never changes\nroles, permissions, session settings or tenant context to obtain visibility.\n\nThis result is not authorization. Hosts must separately require a freshly ACTIVE\nTenant plus current signed-session, background-job or independent-proof authority\non the same relevant executor. Never pass a browser-selected tenant as authority,\ninterpret a missing Tenant as family, or use absence of group membership to infer\nfamily kind. The helper provides no arbitrary cross-tenant directory.\n\n| Behavior/invariant | Trigger | Positive | Negative/failure | Actor/context | Executor/transaction | Runtime/dialect | External edge | Level | Command |\n| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\n| G33 workspace kind | trusted exact resource lookup | existing family false; active/inactive group true | blank/malformed/absent tenant; ambiguous group rows; PostgreSQL RLS-hidden or indeterminate zero refuses family; database failures propagate | host-selected exact tenant, no synthetic session/context | caller-supplied executor, fresh reads; no writes | Node SQLite/PostgreSQL | status/membership/role absence never implies family or grants | integration | `pnpm --filter @happyvertical/smrt-education exec vitest run src/__tests__/group-sharing-workspace.test.ts` (same file with TEST_DB_ADAPTER=postgres and isolated DATABASE_URL) |\n"
|
|
6820
7836
|
}
|
|
6821
7837
|
],
|
|
6822
7838
|
"recipes": [
|
|
@@ -6907,6 +7923,51 @@
|
|
|
6907
7923
|
"Needs a server because its package depends on @happyvertical/smrt-agents, @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-reports, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3625, #3626, #3627)."
|
|
6908
7924
|
]
|
|
6909
7925
|
}
|
|
7926
|
+
},
|
|
7927
|
+
{
|
|
7928
|
+
"id": "education.supervisor",
|
|
7929
|
+
"className": "EducationSupervisorRecipe",
|
|
7930
|
+
"label": "Homeschool groups",
|
|
7931
|
+
"summary": "Review parent-authorized learning work and retain revision-bound comments.",
|
|
7932
|
+
"synonyms": [
|
|
7933
|
+
"homeschool groups",
|
|
7934
|
+
"supervisor review"
|
|
7935
|
+
],
|
|
7936
|
+
"models": [
|
|
7937
|
+
"@happyvertical/smrt-education:EducationGroup",
|
|
7938
|
+
"@happyvertical/smrt-education:GroupLearnerInvitation",
|
|
7939
|
+
"@happyvertical/smrt-education:GroupLearnerMembership",
|
|
7940
|
+
"@happyvertical/smrt-education:GroupLearnerRosterEntry",
|
|
7941
|
+
"@happyvertical/smrt-education:GroupSharingPolicy",
|
|
7942
|
+
"@happyvertical/smrt-education:GroupRevisionComment"
|
|
7943
|
+
],
|
|
7944
|
+
"nav": [
|
|
7945
|
+
{
|
|
7946
|
+
"label": "Groups",
|
|
7947
|
+
"model": "@happyvertical/smrt-education:EducationGroup",
|
|
7948
|
+
"icon": "users",
|
|
7949
|
+
"description": "Groups and currently authorized shared learning work.",
|
|
7950
|
+
"noun": "group"
|
|
7951
|
+
}
|
|
7952
|
+
],
|
|
7953
|
+
"requires": [],
|
|
7954
|
+
"section": {
|
|
7955
|
+
"id": "education",
|
|
7956
|
+
"label": "Education",
|
|
7957
|
+
"icon": "users",
|
|
7958
|
+
"description": "Courses and lessons for learning."
|
|
7959
|
+
},
|
|
7960
|
+
"help": {
|
|
7961
|
+
"markdown": "# Homeschool groups\n\nCompose `education.supervisor` with the education learner workflow to manage\nindependent group tenants and parent-approved links to existing family learners.\nRecipe discovery supplies models and navigation metadata; it grants no generated\nCRUD or family access.\n\nHosts use the closed group sharing services with a live session authorizer on\nthe supplied database executor. Supervisors remain group members, never family\nguardians. A parent must choose an explicit sharing policy when accepting a\ntargeted invitation. Work, revisions, source bytes and comment attribution remain\nfamily-owned after leaving a group.\n\nEvery roster, work, revision, media, comment and progress request must check\ncurrent authority and policy. Serve media through the authorized reader and a\nprivate, non-cacheable host response; never publish storage URLs. Saved parent\ncomment visibility defaults to parent-only. Supervisor comments cannot grade or\nchange learning evidence.\n\nSee the shipped `agents/group-sharing.md` contract for selectors, facet semantics,\ntransaction requirements and migration expectations.\n",
|
|
7962
|
+
"fieldRefs": []
|
|
7963
|
+
},
|
|
7964
|
+
"runtime": "both",
|
|
7965
|
+
"demo": {
|
|
7966
|
+
"mode": "server",
|
|
7967
|
+
"reasons": [
|
|
7968
|
+
"Needs a server because its package depends on @happyvertical/smrt-agents, @happyvertical/smrt-jobs, @happyvertical/smrt-profiles, @happyvertical/smrt-reports, @happyvertical/smrt-secrets, @happyvertical/smrt-tenancy, @happyvertical/smrt-users, which do not build for a browser (#3615, #3617, #3624, #3625, #3626, #3627)."
|
|
7969
|
+
]
|
|
7970
|
+
}
|
|
6910
7971
|
}
|
|
6911
7972
|
],
|
|
6912
7973
|
"browser": {
|