@happyvertical/smrt-support 0.60.17 → 0.60.18
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 +2 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +107 -90
- package/dist/models/service-time-entry.d.ts +3 -0
- package/dist/models/service-time-entry.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +23 -23
- package/dist/smrt-knowledge.okf.md +2 -2
- package/package.json +11 -11
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-support",
|
|
5
|
-
"packageVersion": "0.60.
|
|
5
|
+
"packageVersion": "0.60.18",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-support:ServiceTimeEntry": {
|
|
8
8
|
"name": "servicetimeentry",
|
|
@@ -31,11 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
"caseId": {
|
|
35
|
-
"type": "foreignKey",
|
|
36
|
-
"required": false,
|
|
37
|
-
"related": "SupportCase"
|
|
38
|
-
},
|
|
39
34
|
"workRefType": {
|
|
40
35
|
"type": "text",
|
|
41
36
|
"required": false,
|
|
@@ -50,15 +45,14 @@
|
|
|
50
45
|
"nullable": true
|
|
51
46
|
}
|
|
52
47
|
},
|
|
53
|
-
"specialistId": {
|
|
54
|
-
"type": "foreignKey",
|
|
55
|
-
"required": false,
|
|
56
|
-
"related": "SupportSpecialist"
|
|
57
|
-
},
|
|
58
48
|
"participantKind": {
|
|
59
49
|
"type": "text",
|
|
60
50
|
"required": false,
|
|
61
|
-
"_meta": {}
|
|
51
|
+
"_meta": {},
|
|
52
|
+
"enum": [
|
|
53
|
+
"human",
|
|
54
|
+
"agent"
|
|
55
|
+
]
|
|
62
56
|
},
|
|
63
57
|
"participantProfileId": {
|
|
64
58
|
"type": "crossPackageRef",
|
|
@@ -76,7 +70,13 @@
|
|
|
76
70
|
"source": {
|
|
77
71
|
"type": "text",
|
|
78
72
|
"required": false,
|
|
79
|
-
"_meta": {}
|
|
73
|
+
"_meta": {},
|
|
74
|
+
"enum": [
|
|
75
|
+
"timer",
|
|
76
|
+
"manual",
|
|
77
|
+
"import",
|
|
78
|
+
"agent"
|
|
79
|
+
]
|
|
80
80
|
},
|
|
81
81
|
"description": {
|
|
82
82
|
"type": "text",
|
|
@@ -106,7 +106,14 @@
|
|
|
106
106
|
"status": {
|
|
107
107
|
"type": "text",
|
|
108
108
|
"required": false,
|
|
109
|
-
"_meta": {}
|
|
109
|
+
"_meta": {},
|
|
110
|
+
"enum": [
|
|
111
|
+
"draft",
|
|
112
|
+
"submitted",
|
|
113
|
+
"approved",
|
|
114
|
+
"rejected",
|
|
115
|
+
"corrected"
|
|
116
|
+
]
|
|
110
117
|
},
|
|
111
118
|
"submittedAt": {
|
|
112
119
|
"type": "datetime",
|
|
@@ -163,6 +170,16 @@
|
|
|
163
170
|
"type": "text",
|
|
164
171
|
"required": false,
|
|
165
172
|
"_meta": {}
|
|
173
|
+
},
|
|
174
|
+
"caseId": {
|
|
175
|
+
"type": "foreignKey",
|
|
176
|
+
"required": false,
|
|
177
|
+
"related": "SupportCase"
|
|
178
|
+
},
|
|
179
|
+
"specialistId": {
|
|
180
|
+
"type": "foreignKey",
|
|
181
|
+
"required": false,
|
|
182
|
+
"related": "SupportSpecialist"
|
|
166
183
|
}
|
|
167
184
|
},
|
|
168
185
|
"methods": {
|
|
@@ -292,7 +309,7 @@
|
|
|
292
309
|
"collectionExportName": "ServiceTimeEntryCollection",
|
|
293
310
|
"schema": {
|
|
294
311
|
"tableName": "service_time_entries",
|
|
295
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"service_time_entries\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"
|
|
312
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"service_time_entries\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"work_ref_type\" TEXT,\n \"work_ref_id\" TEXT,\n \"participant_kind\" TEXT,\n \"participant_profile_id\" UUID,\n \"agent_ref\" TEXT,\n \"source\" TEXT,\n \"description\" TEXT,\n \"started_at\" TIMESTAMP,\n \"ended_at\" TIMESTAMP,\n \"duration_seconds\" INTEGER,\n \"evidence\" TEXT,\n \"status\" TEXT,\n \"submitted_at\" TIMESTAMP,\n \"submitted_by_profile_id\" UUID,\n \"approved_at\" TIMESTAMP,\n \"approved_by_profile_id\" UUID,\n \"approval_path\" TEXT,\n \"rejected_at\" TIMESTAMP,\n \"rejected_by_profile_id\" UUID,\n \"rejection_reason\" TEXT,\n \"correction_of_id\" UUID,\n \"metadata\" TEXT,\n \"case_id\" UUID,\n \"specialist_id\" UUID\n);",
|
|
296
313
|
"columns": {
|
|
297
314
|
"_sync_origin_device_id": {
|
|
298
315
|
"type": "TEXT"
|
|
@@ -331,18 +348,6 @@
|
|
|
331
348
|
"notNull": false,
|
|
332
349
|
"unique": false
|
|
333
350
|
},
|
|
334
|
-
"case_id": {
|
|
335
|
-
"type": "UUID",
|
|
336
|
-
"referenceKind": "foreignKey",
|
|
337
|
-
"notNull": false,
|
|
338
|
-
"unique": false,
|
|
339
|
-
"foreignKey": {
|
|
340
|
-
"table": "support_cases",
|
|
341
|
-
"column": "id",
|
|
342
|
-
"onDelete": "NO ACTION",
|
|
343
|
-
"onUpdate": "CASCADE"
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
351
|
"work_ref_type": {
|
|
347
352
|
"type": "TEXT",
|
|
348
353
|
"notNull": false,
|
|
@@ -353,18 +358,6 @@
|
|
|
353
358
|
"notNull": false,
|
|
354
359
|
"unique": false
|
|
355
360
|
},
|
|
356
|
-
"specialist_id": {
|
|
357
|
-
"type": "UUID",
|
|
358
|
-
"referenceKind": "foreignKey",
|
|
359
|
-
"notNull": false,
|
|
360
|
-
"unique": false,
|
|
361
|
-
"foreignKey": {
|
|
362
|
-
"table": "support_specialists",
|
|
363
|
-
"column": "id",
|
|
364
|
-
"onDelete": "NO ACTION",
|
|
365
|
-
"onUpdate": "CASCADE"
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
361
|
"participant_kind": {
|
|
369
362
|
"type": "TEXT",
|
|
370
363
|
"notNull": false,
|
|
@@ -475,6 +468,30 @@
|
|
|
475
468
|
"type": "TEXT",
|
|
476
469
|
"notNull": false,
|
|
477
470
|
"unique": false
|
|
471
|
+
},
|
|
472
|
+
"case_id": {
|
|
473
|
+
"type": "UUID",
|
|
474
|
+
"referenceKind": "foreignKey",
|
|
475
|
+
"notNull": false,
|
|
476
|
+
"unique": false,
|
|
477
|
+
"foreignKey": {
|
|
478
|
+
"table": "support_cases",
|
|
479
|
+
"column": "id",
|
|
480
|
+
"onDelete": "NO ACTION",
|
|
481
|
+
"onUpdate": "CASCADE"
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
"specialist_id": {
|
|
485
|
+
"type": "UUID",
|
|
486
|
+
"referenceKind": "foreignKey",
|
|
487
|
+
"notNull": false,
|
|
488
|
+
"unique": false,
|
|
489
|
+
"foreignKey": {
|
|
490
|
+
"table": "support_specialists",
|
|
491
|
+
"column": "id",
|
|
492
|
+
"onDelete": "NO ACTION",
|
|
493
|
+
"onUpdate": "CASCADE"
|
|
494
|
+
}
|
|
478
495
|
}
|
|
479
496
|
},
|
|
480
497
|
"indexes": [
|
|
@@ -495,18 +512,6 @@
|
|
|
495
512
|
"created_at"
|
|
496
513
|
]
|
|
497
514
|
},
|
|
498
|
-
{
|
|
499
|
-
"name": "service_time_entries_case_id_idx",
|
|
500
|
-
"columns": [
|
|
501
|
-
"case_id"
|
|
502
|
-
]
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
"name": "service_time_entries_specialist_id_idx",
|
|
506
|
-
"columns": [
|
|
507
|
-
"specialist_id"
|
|
508
|
-
]
|
|
509
|
-
},
|
|
510
515
|
{
|
|
511
516
|
"name": "service_time_entries_participant_profile_id_idx",
|
|
512
517
|
"columns": [
|
|
@@ -536,9 +541,21 @@
|
|
|
536
541
|
"columns": [
|
|
537
542
|
"correction_of_id"
|
|
538
543
|
]
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"name": "service_time_entries_case_id_idx",
|
|
547
|
+
"columns": [
|
|
548
|
+
"case_id"
|
|
549
|
+
]
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"name": "service_time_entries_specialist_id_idx",
|
|
553
|
+
"columns": [
|
|
554
|
+
"specialist_id"
|
|
555
|
+
]
|
|
539
556
|
}
|
|
540
557
|
],
|
|
541
|
-
"version": "
|
|
558
|
+
"version": "c4fd2d05"
|
|
542
559
|
},
|
|
543
560
|
"importPath": "@happyvertical/smrt-support"
|
|
544
561
|
},
|
|
@@ -621,7 +638,7 @@
|
|
|
621
638
|
],
|
|
622
639
|
"schema": {
|
|
623
640
|
"tableName": "service_time_entries",
|
|
624
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"service_time_entries\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"
|
|
641
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"service_time_entries\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"work_ref_type\" TEXT,\n \"work_ref_id\" TEXT,\n \"participant_kind\" TEXT,\n \"participant_profile_id\" UUID,\n \"agent_ref\" TEXT,\n \"source\" TEXT,\n \"description\" TEXT,\n \"started_at\" TIMESTAMP,\n \"ended_at\" TIMESTAMP,\n \"duration_seconds\" INTEGER,\n \"evidence\" TEXT,\n \"status\" TEXT,\n \"submitted_at\" TIMESTAMP,\n \"submitted_by_profile_id\" UUID,\n \"approved_at\" TIMESTAMP,\n \"approved_by_profile_id\" UUID,\n \"approval_path\" TEXT,\n \"rejected_at\" TIMESTAMP,\n \"rejected_by_profile_id\" UUID,\n \"rejection_reason\" TEXT,\n \"correction_of_id\" UUID,\n \"metadata\" TEXT,\n \"case_id\" UUID,\n \"specialist_id\" UUID\n);",
|
|
625
642
|
"columns": {
|
|
626
643
|
"_sync_origin_device_id": {
|
|
627
644
|
"type": "TEXT"
|
|
@@ -660,18 +677,6 @@
|
|
|
660
677
|
"notNull": false,
|
|
661
678
|
"unique": false
|
|
662
679
|
},
|
|
663
|
-
"case_id": {
|
|
664
|
-
"type": "UUID",
|
|
665
|
-
"referenceKind": "foreignKey",
|
|
666
|
-
"notNull": false,
|
|
667
|
-
"unique": false,
|
|
668
|
-
"foreignKey": {
|
|
669
|
-
"table": "support_cases",
|
|
670
|
-
"column": "id",
|
|
671
|
-
"onDelete": "NO ACTION",
|
|
672
|
-
"onUpdate": "CASCADE"
|
|
673
|
-
}
|
|
674
|
-
},
|
|
675
680
|
"work_ref_type": {
|
|
676
681
|
"type": "TEXT",
|
|
677
682
|
"notNull": false,
|
|
@@ -682,18 +687,6 @@
|
|
|
682
687
|
"notNull": false,
|
|
683
688
|
"unique": false
|
|
684
689
|
},
|
|
685
|
-
"specialist_id": {
|
|
686
|
-
"type": "UUID",
|
|
687
|
-
"referenceKind": "foreignKey",
|
|
688
|
-
"notNull": false,
|
|
689
|
-
"unique": false,
|
|
690
|
-
"foreignKey": {
|
|
691
|
-
"table": "support_specialists",
|
|
692
|
-
"column": "id",
|
|
693
|
-
"onDelete": "NO ACTION",
|
|
694
|
-
"onUpdate": "CASCADE"
|
|
695
|
-
}
|
|
696
|
-
},
|
|
697
690
|
"participant_kind": {
|
|
698
691
|
"type": "TEXT",
|
|
699
692
|
"notNull": false,
|
|
@@ -804,6 +797,30 @@
|
|
|
804
797
|
"type": "TEXT",
|
|
805
798
|
"notNull": false,
|
|
806
799
|
"unique": false
|
|
800
|
+
},
|
|
801
|
+
"case_id": {
|
|
802
|
+
"type": "UUID",
|
|
803
|
+
"referenceKind": "foreignKey",
|
|
804
|
+
"notNull": false,
|
|
805
|
+
"unique": false,
|
|
806
|
+
"foreignKey": {
|
|
807
|
+
"table": "support_cases",
|
|
808
|
+
"column": "id",
|
|
809
|
+
"onDelete": "NO ACTION",
|
|
810
|
+
"onUpdate": "CASCADE"
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
"specialist_id": {
|
|
814
|
+
"type": "UUID",
|
|
815
|
+
"referenceKind": "foreignKey",
|
|
816
|
+
"notNull": false,
|
|
817
|
+
"unique": false,
|
|
818
|
+
"foreignKey": {
|
|
819
|
+
"table": "support_specialists",
|
|
820
|
+
"column": "id",
|
|
821
|
+
"onDelete": "NO ACTION",
|
|
822
|
+
"onUpdate": "CASCADE"
|
|
823
|
+
}
|
|
807
824
|
}
|
|
808
825
|
},
|
|
809
826
|
"indexes": [
|
|
@@ -824,18 +841,6 @@
|
|
|
824
841
|
"created_at"
|
|
825
842
|
]
|
|
826
843
|
},
|
|
827
|
-
{
|
|
828
|
-
"name": "service_time_entries_case_id_idx",
|
|
829
|
-
"columns": [
|
|
830
|
-
"case_id"
|
|
831
|
-
]
|
|
832
|
-
},
|
|
833
|
-
{
|
|
834
|
-
"name": "service_time_entries_specialist_id_idx",
|
|
835
|
-
"columns": [
|
|
836
|
-
"specialist_id"
|
|
837
|
-
]
|
|
838
|
-
},
|
|
839
844
|
{
|
|
840
845
|
"name": "service_time_entries_participant_profile_id_idx",
|
|
841
846
|
"columns": [
|
|
@@ -865,9 +870,21 @@
|
|
|
865
870
|
"columns": [
|
|
866
871
|
"correction_of_id"
|
|
867
872
|
]
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"name": "service_time_entries_case_id_idx",
|
|
876
|
+
"columns": [
|
|
877
|
+
"case_id"
|
|
878
|
+
]
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
"name": "service_time_entries_specialist_id_idx",
|
|
882
|
+
"columns": [
|
|
883
|
+
"specialist_id"
|
|
884
|
+
]
|
|
868
885
|
}
|
|
869
886
|
],
|
|
870
|
-
"version": "
|
|
887
|
+
"version": "c4fd2d05"
|
|
871
888
|
},
|
|
872
889
|
"importPath": "@happyvertical/smrt-support"
|
|
873
890
|
},
|
|
@@ -12,6 +12,9 @@ import { type ServiceParticipantKind, type ServiceTimeEntrySource, type ServiceT
|
|
|
12
12
|
* smrt-projects re-exports), so the classes on this table stay one two-level
|
|
13
13
|
* inheritance chain. The shared fields are restated because package-isolated
|
|
14
14
|
* manifest scanning deliberately does not inspect dependency source trees.
|
|
15
|
+
* Restating is no longer required for the table definition (an own-table
|
|
16
|
+
* subclass carries its ancestors' fields, #4922) but is harmless: each
|
|
17
|
+
* column still appears once and this declaration wins.
|
|
15
18
|
* Runtime behavior is inherited from the shared model; every package
|
|
16
19
|
* addresses the same table and rows.
|
|
17
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-time-entry.d.ts","sourceRoot":"","sources":["../../src/models/service-time-entry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAIL,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,gBAAgB,IAAI,sBAAsB,EAC3C,MAAM,gCAAgC,CAAC;AAExC
|
|
1
|
+
{"version":3,"file":"service-time-entry.d.ts","sourceRoot":"","sources":["../../src/models/service-time-entry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAIL,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,gBAAgB,IAAI,sBAAsB,EAC3C,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,qBAOa,gBAAiB,SAAQ,sBAAsB;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IACf,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC3C,eAAe,EAAE,sBAAsB,CAAW;IAE3E,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClB,QAAQ,EAAE,MAAM,CAAM;IACtB,MAAM,EAAE,sBAAsB,CAAY;IAC1C,WAAW,EAAE,MAAM,CAAM;IAClD,SAAS,EAAE,IAAI,GAAG,IAAI,CAAQ;IAC9B,OAAO,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAK;IACV,QAAQ,EAAE,MAAM,CAAQ;IACxB,MAAM,EAAE,sBAAsB,CAAW;IAClE,WAAW,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEhC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC3C,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE/B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjB,YAAY,EAAE,MAAM,CAAM;IACnD,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE/B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjB,eAAe,EAAE,MAAM,CAAM;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5C,QAAQ,EAAE,MAAM,CAAQ;IAEjD,6EAA6E;cAC1D,gBAAgB,IAAI,SAAS,MAAM,EAAE;CAGzD;AAED,qBAAa,0BAA2B,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IAC9E,MAAM,CAAC,QAAQ,CAAC,UAAU,0BAAoB;IACxC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAGpD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAGhE,eAAe,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAMrD;AAED,eAAe,gBAAgB,CAAC"}
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-support",
|
|
6
|
-
"packageVersion": "0.60.
|
|
6
|
+
"packageVersion": "0.60.18",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
12
|
-
"agents": "
|
|
10
|
+
"manifest": "bc5bbf0511b78422d6e8601625a605cbcc4b701d700e0cec77af96b531e5b217",
|
|
11
|
+
"packageJson": "ae53fd4f74fa955d63f5f566658a4c03f87b6f8011c6b192e505da2519489c50",
|
|
12
|
+
"agents": "3dd412814a6bc456d6b23a015f2b5ad158efdb36e33dd294c2a4df83d33a9ad8"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
15
15
|
".",
|
|
@@ -85,13 +85,6 @@
|
|
|
85
85
|
"required": false,
|
|
86
86
|
"columnType": "UUID"
|
|
87
87
|
},
|
|
88
|
-
{
|
|
89
|
-
"name": "caseId",
|
|
90
|
-
"type": "foreignKey",
|
|
91
|
-
"required": false,
|
|
92
|
-
"related": "SupportCase",
|
|
93
|
-
"columnType": "UUID"
|
|
94
|
-
},
|
|
95
88
|
{
|
|
96
89
|
"name": "workRefType",
|
|
97
90
|
"type": "text",
|
|
@@ -104,13 +97,6 @@
|
|
|
104
97
|
"required": false,
|
|
105
98
|
"columnType": "TEXT"
|
|
106
99
|
},
|
|
107
|
-
{
|
|
108
|
-
"name": "specialistId",
|
|
109
|
-
"type": "foreignKey",
|
|
110
|
-
"required": false,
|
|
111
|
-
"related": "SupportSpecialist",
|
|
112
|
-
"columnType": "UUID"
|
|
113
|
-
},
|
|
114
100
|
{
|
|
115
101
|
"name": "participantKind",
|
|
116
102
|
"type": "text",
|
|
@@ -235,9 +221,7 @@
|
|
|
235
221
|
"type": "text",
|
|
236
222
|
"required": false,
|
|
237
223
|
"columnType": "TEXT"
|
|
238
|
-
}
|
|
239
|
-
],
|
|
240
|
-
"relationships": [
|
|
224
|
+
},
|
|
241
225
|
{
|
|
242
226
|
"name": "caseId",
|
|
243
227
|
"type": "foreignKey",
|
|
@@ -251,7 +235,9 @@
|
|
|
251
235
|
"required": false,
|
|
252
236
|
"related": "SupportSpecialist",
|
|
253
237
|
"columnType": "UUID"
|
|
254
|
-
}
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"relationships": [
|
|
255
241
|
{
|
|
256
242
|
"name": "participantProfileId",
|
|
257
243
|
"type": "crossPackageRef",
|
|
@@ -286,6 +272,20 @@
|
|
|
286
272
|
"required": false,
|
|
287
273
|
"related": "ServiceTimeEntry",
|
|
288
274
|
"columnType": "UUID"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"name": "caseId",
|
|
278
|
+
"type": "foreignKey",
|
|
279
|
+
"required": false,
|
|
280
|
+
"related": "SupportCase",
|
|
281
|
+
"columnType": "UUID"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "specialistId",
|
|
285
|
+
"type": "foreignKey",
|
|
286
|
+
"required": false,
|
|
287
|
+
"related": "SupportSpecialist",
|
|
288
|
+
"columnType": "UUID"
|
|
289
289
|
}
|
|
290
290
|
],
|
|
291
291
|
"methods": [
|
|
@@ -6036,7 +6036,7 @@
|
|
|
6036
6036
|
"polymorphicAssociations": 0,
|
|
6037
6037
|
"uuidColumns": 150
|
|
6038
6038
|
},
|
|
6039
|
-
"agentDoc": "# @happyvertical/smrt-support\n\nAI-first Support Cases for the SMRT framework (epic #1934). Every inbound\nsupport interaction — chat message or email — creates or joins one canonical,\ntenant-scoped **Support Case**; channels stay transports, never separate\nsystems of record. The package owns the case lifecycle, channel intake, the\nAutomated Support Response workflow with lossless **Human Handoff**,\nProject-qualified routing, **Service Target** clocks with timed escalation,\nand auditable **Service Time Entries** whose client charges and provider\ncompensation stay separate. Since #3288 the shared `ServiceTimeEntry` class\nis owned by `smrt-timesheets` (smrt-projects re-exports it); this package's\nsubtype extends it directly, adds `caseId` / `specialistId` (frozen on\napproval via `frozenFieldNames()`), and restates the shared fields for\nisolated manifest scanning. Every import uses the unchanged\n`service_time_entries` table, so no data is duplicated. Keep the subtype a\ndirect child of the timesheets entry: a third same-named level on the table\nbreaks single-table-family resolution.\n\n**Boundary (FR-29a):** Support owns tickets, interactions, routing, and\nservice targets. Delivery Operations owns repository work — a **Delivery\nHandoff** links a case to a Development Work Item (e.g.\n`@happyvertical/smrt-projects:Issue`) via a `SupportWorkLink` without ever\ndriving its execution; the delivery side reports status echoes back.\n\n## Models\n\nCase-side models are **internal**: generated API/CLI/MCP surfaces are\nread-only (`list`/`get`) and every write goes through the service facades\n(the `smrt-chat` `ChatService` idiom). Operational configuration models\n(bindings, policies, specialists, qualifications, availability) expose full\ngenerated CRUD; **commercial terms** (`SupportPlan`,\n`SupportCompensationPlan`) are read-only too — their writes flow through the\n`support.manage-plans`-gated `SupportPlanAdminService`.\n\n### Case core (#1926)\n\n- **SupportCase** (`support_cases`) — canonical ticket: `caseNumber`,\n `subject`, `status` (`new → triaged → assigned → in_progress →\n waiting_on_client|escalated → resolved → closed`, guarded at save time via\n the WeakMap + authoritative-DB-read idiom from S5 #1390), `priority`,\n `severity` (plan-defined key), `category`, `sensitive`, `channelKind`,\n `clientProfileId`/`openedByProfileId` (crossPackageRef → Profile),\n `projectId` (app-defined string — deliberately not an FK), `bindingId`,\n `threadKey` (create-or-join dedup key), `planId` + `planSnapshot` (terms\n frozen at apply time), assignment fields, response stamps\n (`acknowledgedAt`, `firstRespondedAt`), `humanRequestedAt`, resolution\n fields, `reopenCount`/`lastReopenedAt`, `aiEnabled`.\n- **SupportInteraction** (`support_interactions`,\n `conflictColumns: ['source_key']`) — channel-neutral transport record:\n `direction` (`inbound`/`outbound`/`internal`), `channelKind`, `actorKind`\n (`client`/`specialist`/`agent`/`system`), denormalized `body`, and the\n qualified `sourceType`/`sourceId` + globally unique `sourceKey`\n (`chat:<messageId>`, `email:<emailId>`, `manual:<uuid>`) that makes\n re-ingestion idempotent.\n- **SupportCaseEvent** (`support_case_events`) — append-only audit trail\n (transitions, assignments, AI runs, handoffs, escalations, target state,\n work links, reopens). Together with interactions this is the complete\n context a Human Handoff transfers.\n- **SupportChannelBinding** (`support_channel_bindings`,\n `conflictColumns: ['target_type','target_id']`) — marks a container as a\n support intake channel: `bindingKind` (`chat_room`/`email_account`),\n qualified `targetType` + `targetId`, default client/project/plan,\n `selfAddresses` (email direction heuristic). Unbound containers are never\n touched.\n- **SupportWorkLink** (`support_work_links`) — Support/Development Work Item\n links with a read-only `status` echo.\n\n### AI workflow (#1928)\n\n- **SupportPolicy** (`support_policies`) — what the AI may do without a\n human: `autoAcknowledge`/`autoClassify`/`autoAnswer` (on by default),\n `autoTroubleshoot`/`autoResolve` (off by default),\n `autoResolveMaxSeverity`, `confidenceThreshold`, `maxAutoAttempts`,\n `sensitiveCategories`, `allowedTools`, `autoSendEmailReplies` (off —\n email replies are drafted, not sent). Resolution is most-specific-wins on\n `(planId, projectId)`; no row → `DEFAULT_SUPPORT_POLICY` (conservative).\n- **SupportAiRun** (`support_ai_runs`) — append-only audit of each phase\n (`acknowledge`/`classify`/`answer`/`troubleshoot`/`resolve`) with\n `confidence`, classification output, knowledge refs, tool calls, outcome\n (`completed`/`skipped`/`failed`/`handed_off`), and `correlationId`.\n\n### Routing, targets, escalation (#1929)\n\n- **SupportSpecialist** (`support_specialists`) — specialist role record on a\n Profile (the commerce `Customer` role-record idiom): `languages`,\n `timezone`, `maxConcurrentCases`, `onCallPriority`, status.\n- **SupportQualification** (`support_qualifications`) — effective-dated\n Project Support Qualification (`trainee`/`qualified`/`expert`).\n- **SupportAvailability** (`support_availability_windows`) — weekly windows\n plus `on_call`/`time_off` spans.\n- **SupportPlan** (`support_plans`, `conflictColumns:\n ['tenant_id','plan_key']`) — the Managed Support Plan: coverage calendar +\n holidays + timezone, channels, severity definitions, per-severity\n acknowledgement/response/update/resolution target minutes, `pauseStatuses`\n (clocks pause only when the plan says so), escalation policy steps,\n availability fee, `includedMinutes`, `overageHourlyRate`,\n `onCallHourlyRate`, time-approval policy, optional\n `subscriptionPlanKey` binding (string, not a dependency).\n `snapshotTerms()` feeds `SupportCase.planSnapshot`.\n- **SupportServiceTarget** (`support_service_targets`,\n `conflictColumns: ['case_id','target_type','cycle']`) — one clock per\n target type (update clocks recur via `cycle`), with pause accounting and\n `escalationJobId` (the one-shot `_smrt_jobs` row scheduled at `dueAt`,\n cancelled on satisfy).\n- **SupportEscalation** (`support_escalations`) — the audit record of one\n escalation firing.\n- **SupportCompensationPlan** (`support_compensation_plans`) —\n effective-dated Support Specialist earning terms; specialist-specific plan\n wins over the tenant default at the work instant. Deliberately separate\n from `SupportPlan` (client pricing) so margin stays measurable.\n\n### Service time (#1930)\n\n- **ServiceTimeEntry** (`service_time_entries`) — auditable Professional\n Service duration: work-context-generic (`caseId` and/or polymorphic\n `workRefType`/`workRefId`), delivering Participant (`participantKind`\n `human`/`agent` + `participantProfileId`/`agentRef`), `source`\n (`timer`/`manual`/`import`/`agent` — one shared validation/audit\n contract), evidence JSON, and lifecycle `draft → submitted →\n approved|rejected`, `approved → corrected` only. **Approved entries are\n immutable**: the work-defining fields are frozen at save time (the\n `LicenseSale` WeakMap-freeze idiom, backed by an authoritative DB-row\n comparison); disputes create explicit corrections via `correctionOfId`.\n- **SupportCharge** / **SupportCompensation** (`support_charges` /\n `support_compensations`, one per time entry) — derived commercial\n snapshots: client amount from the Managed Support Plan (included-time\n consumption then metered overage) vs provider amount from the Support\n Compensation Plan, each with a frozen `rateSnapshot`. Margin = charge −\n compensation, computed by readers; settlement/invoicing composes at the\n app/accounting boundary (#1925) and is out of scope here.\n\n## Services\n\n- **SupportCaseService** — the closed write facade: `openCase`,\n `recordInteraction` (idempotent on `sourceKey`; stamps\n `acknowledgedAt`/`firstRespondedAt`; inbound un-parks\n `waiting_on_client`), `transition`, `assign`, `resolve`, `close`,\n `reopen` (preserves prior resolution in the reopen event), `requestHuman`,\n `linkWork`/`recordWorkStatus` (Delivery Handoff), `recordEvent`,\n `getTimeline` (merged interactions + events).\n- **SupportIntakeService** — create-or-join intake for both channels:\n `ingestChatMessage` (bound `ChatRoom`; `chat:<roomId>[:<threadId>]` thread\n keys; only `role: 'user'` messages), `ingestEmail` (bound `EmailAccount`;\n RFC-thread joins via `inReplyTo`; `selfAddresses` skip; unresolved senders\n park the case with `metadata.unresolvedClient`), plus\n `registerSupportIntake()` — an opt-in `GlobalInterceptors.afterSave`\n observer keyed on the `ChatMessage`/`Email` class names that never throws\n into the source package's save path. Join semantics: open case → join;\n resolved → reopen; closed → new case.\n- **SupportAiWorkflow** — the Automated Support Response (FR-28a):\n `processIntake`/`processCase` run acknowledge → classify → answer →\n resolve under the resolved `SupportPolicy` (conservative defaults), each\n phase writing a `SupportAiRun` + `ai_run` case event. AI calls go through\n the injected `SupportAiBoundary` (default uses `supportCase.do()` with\n defensive JSON parsing that fails toward the human); knowledge comes from\n the pluggable `SupportKnowledgeProvider` (default no-op). Classification\n never overwrites human triage; email answers are drafted\n (`metadata.draft`) unless the policy allows sending. Handoff triggers —\n `client_request`, `low_confidence`, `high_severity`, `sensitive`,\n `failed_resolution`, `policy` (attempt budget) — are always active.\n- **HumanHandoffService** — the lossless Human Handoff (FR-28b):\n `handoff` assembles the full context package (case state + compact\n timeline + AI runs) into the `handoff` event, stamps\n `metadata.activeHandoff` for the no-repeat guarantee (repeat triggers are\n deduped events), routes through the injected `assignSpecialist` seam\n (#1929's routing service plugs in; default queues `new` cases to\n `triaged`), and `releaseHandoff` clears the flag.\n- **ServiceTargetEngine** — Service Target clocks (FR-30/31):\n `startTargetsForCase` derives per-severity clocks from the case's\n `planSnapshot` (live plan fallback) with due times computed in covered\n time (`coverage-calendar.ts`: timezone-aware weekly windows + holidays;\n empty coverage = 24×7) and schedules one-shot `_smrt_jobs` escalation jobs\n at `dueAt`; `onInteractionRecorded` satisfies acknowledgement/response and\n recurs `update` cycles; `onCaseTransition` pauses/resumes clocks only when\n the plan's `pauseStatuses` say so (recomputing remaining covered minutes)\n and settles targets on resolve. Breach → `SupportServiceTarget.\n checkAndEscalate` (background-eligible, at-least-once-safe) marks the\n breach and escalates through the plan's policy steps (notify/reassign,\n delayed follow-up levels), transitioning the case to `escalated`.\n- **SupportPlanAdminService** — the permission-gated write surface for\n commercial terms: create/update/archive for Managed Support Plans and\n Support Compensation Plans, every act behind `support.manage-plans` with\n cross-tenant writes refused (generated CRUD on both models is read-only).\n- **SupportRoutingService** — explainable ranked routing (FR-30):\n `rankSpecialists` hard-filters on active status, effective Project\n Support Qualification, workload cap, and availability windows (specialist\n timezone), then scores preferred-specialist, qualification level, on-call,\n workload headroom, and language (weights in `ROUTING_WEIGHTS`; every\n factor recorded so ineligible specialists show why); `autoAssign` writes\n the assignment with its rationale; `reassign` is gated by\n `support.reassign-case` and refuses cross-tenant principals.\n- **ServiceTimeEntryService** — the ONE recording contract for all four\n entry sources (FR-40): `record` validates duration (explicit or derived\n from the period; `timer` needs both bounds), participant coherence\n (`human` → `participantProfileId`, `agent` → `agentRef`), and the work\n context (case and/or work ref; case entries copy the tenant and append a\n `time_recorded` event); `submit` stamps the submitter.\n- **TimeEntryApprovalService** — the approval gate and only writer of the\n commercial snapshots (FR-36): `approve` resolves the governing terms (case\n `planSnapshot` first, live plan fallback, zero-rate default), gates by\n policy path (`automatic`/`threshold`/`operator`/`client`; operator paths\n behind `support.approve-time-entry`; cross-tenant principals refused), then\n derives the `SupportCharge` (included time first, then overage/on-call) and\n `SupportCompensation` (effective-dated plan) rows; `reject` and `correct`\n (supersede + linked fresh draft via `correctionOfId`) round out the\n lifecycle. Case events carry the charge amount only — compensation never\n leaks case-side.\n\n## Permissions\n\nContributed to the runtime catalog on import (the\n`personas.activate-directive` pattern): `support.reassign-case`,\n`support.approve-time-entry`, `support.manage-plans`. Privileged service\noperations take a `SupportPrincipal` (`can(slug)`), built from explicit slugs\nor a `PermissionResolver`.\n\n## Svelte UI\n\n`@happyvertical/smrt-support/svelte` ships presentational Svelte 5 surfaces:\n`CaseQueue` (priority/status/assignment/channel at a glance, `onselect`),\n`CaseDetail` (header, meta, linked work, merged timeline), `TargetList`\n(Service Target clocks with due/paused/satisfied/breached badges),\n`RoutingRationale` (ranked specialists with eligibility + factor chips and\nan optional reassign action), and `TimeEntryApprovalQueue`\n(date/hours/description/worker/status/amount with\napprove/reject-with-reason actions on submitted rows; owned by\nsmrt-timesheets since #3288 and re-exported here). Hosts adapt models\nwith `toSupportCaseView` / `toCaseTimelineItemView` / `toServiceTargetView`\n/ `toSupportTimeEntryView` — the time-entry view's first eight fields\ndeliberately match the presentation `TimeEntry` contract, and\n`SupportTimeEntryView` extends smrt-timesheets' `TimeEntryApprovalView`.\nComponents use `smrt-ui` primitives (`smrtRawPrimitives: \"strict\"`).\n\n## Dependencies\n\nPackage dependencies: `smrt-core`, `smrt-tenancy`, `smrt-projects`,\n`smrt-timesheets`, `smrt-chat`, `smrt-messages`, `smrt-jobs`, `smrt-users`,\n`smrt-ui`,\n`@happyvertical/logger`, `@happyvertical/sql`. Profile and subscriptions\nreferences are `@crossPackageRef` string ids or plain string\nkeys. `smrt-projects` is the intentional shared delivery edge added by #1955;\n`smrt-timesheets` owns the shared time-entry evidence (#3288). No inter-`smrt-*` `peerDependencies`.\n\n## Validation\n\n```sh\npnpm --filter @happyvertical/smrt-support test\npnpm --filter @happyvertical/smrt-support test:postgres\npnpm --filter @happyvertical/smrt-support typecheck\npnpm --filter @happyvertical/smrt-support build\n```\n\n`test:postgres` is the lane that holds the money/rate line — SQLite's type\naffinity stores a REAL in an INTEGER column without complaint, so a money field\nthat reverted to DECIMAL passes every SQLite suite.\n\n## Money and rates\n\n- **Money is integer minor units** (cents) — `$19.99` is `1999`.\n `SupportPlan.availabilityFeeAmount`, `SupportCharge.amount` and\n `SupportCompensation.amount` initialize `= 0`, never `= 0.0`: the integer\n literal is what maps them to INTEGER columns (BIGINT on fresh PostgreSQL/DuckDB databases; #2401, #2373).\n- **Rates stay DECIMAL but their unit changed.**\n `SupportPlan.overageHourlyRate` / `onCallHourlyRate` and\n `SupportCompensationPlan.hourlyRate` are **minor units per hour**, so\n `hours * rate` yields minor units. INTEGER would truncate a sub-unit rate to\n zero, which is why they keep a decimal initializer.\n- **`roundMoney()` is the single rate↔money boundary.** It rounds\n `(seconds / 3600) * hourlyRate` to a whole minor unit, which is what lets the\n `thresholdAmount` comparison in `determinePath()` be an exact `>` with no\n tolerance. `TimeApprovalPolicy.thresholdAmount` is in the same unit as\n `SupportCharge.amount`.\n- **Migrating an existing database**: `preflightSupportMoneyMinorUnits(db)`\n reports which columns still hold major units and which rows would be rounded\n or exceed JavaScript's safe-integer range; `migrateSupportMoneyToMinorUnits(db)` converts them\n (idempotent via `_smrt_backfills`). The **rate columns are not in that list**\n — their type does not change, but their stored values must still be\n multiplied by the same scale in the same deploy step. Frozen `rateSnapshot`\n JSON on settled charges is history and is left alone. On SQLite the values\n are rescaled but the declared type needs the table-rebuild path (#2370).\n Fresh PostgreSQL/DuckDB INTEGER columns are BIGINT and hydration rejects\n values outside JavaScript's safe-integer range; existing PostgreSQL `int4`\n columns require #2424.\n\n## Gotchas\n\n- **Writes go through the facades** — the case-side generated routes are\n read-only on purpose; `create`/`update` on them is not a bug to \"fix\".\n- **`projectId` is an app-defined string** — the consuming app owns the\n Project concept; don't turn it into an FK or a crossPackageRef to\n `smrt-projects:Project` (that class is a provider board, not a client\n initiative).\n- **`SupportCase.threadKey` + `SupportInteraction.sourceKey` carry intake\n correctness** — `sourceKey` is globally unique (`conflictColumns`), so\n replayed transport rows are no-ops; new manual interactions must use a\n fresh `manual:<uuid>` key.\n- **High-volume models avoid the inherited `name` field** (`subject`,\n `displayName`, …) so the default `(slug, context, _meta_type)` unique index\n falls back to id-derived slugs; named config models carry\n `conflictColumns` instead (which replaces that index).\n- **Approved time entries never change** — corrections are new rows linked\n by `correctionOfId`; the original flips to `corrected` with its snapshot\n intact.\n- **Plan edits never rewrite history** — cases keep `planSnapshot`, charges\n and compensation keep `rateSnapshot`.\n- **Create-or-join and included-time consumption serialize in-process** —\n `SupportIntakeService` (per conversation key) and\n `TimeEntryApprovalService` (per case) use a `KeyedMutex`, which covers the\n single-app-process deployment these paths run in. Multi-replica\n deployments must serialize at the app layer (route a conversation's\n intake / a case's approvals through one worker, or add an app-level\n claim) — the framework exposes no cross-adapter transaction primitive at\n this seam. Escalation is additionally idempotent per `(target, level)`,\n so at-least-once job redelivery never stacks duplicate escalations.\n\n- **Recipe `support.tickets`** (`src/recipes.ts`, help in `src/tickets.recipe.md`): lists tickets, messages and the support team for the planner and other catalog hosts. Fields it shows carry `@field({ description })` in plain words; keep them when editing the models.\n",
|
|
6039
|
+
"agentDoc": "# @happyvertical/smrt-support\n\nAI-first Support Cases for the SMRT framework (epic #1934). Every inbound\nsupport interaction — chat message or email — creates or joins one canonical,\ntenant-scoped **Support Case**; channels stay transports, never separate\nsystems of record. The package owns the case lifecycle, channel intake, the\nAutomated Support Response workflow with lossless **Human Handoff**,\nProject-qualified routing, **Service Target** clocks with timed escalation,\nand auditable **Service Time Entries** whose client charges and provider\ncompensation stay separate. Since #3288 the shared `ServiceTimeEntry` class\nis owned by `smrt-timesheets` (smrt-projects re-exports it); this package's\nsubtype extends it directly, adds `caseId` / `specialistId` (frozen on\napproval via `frozenFieldNames()`), and restates the shared fields for\nisolated manifest scanning (no longer required for the table definition,\n#4922, but harmless: each column stays single). Every import uses the unchanged\n`service_time_entries` table, so no data is duplicated. Keep the subtype a\ndirect child of the timesheets entry: a third same-named level on the table\nbreaks single-table-family resolution.\n\n**Boundary (FR-29a):** Support owns tickets, interactions, routing, and\nservice targets. Delivery Operations owns repository work — a **Delivery\nHandoff** links a case to a Development Work Item (e.g.\n`@happyvertical/smrt-projects:Issue`) via a `SupportWorkLink` without ever\ndriving its execution; the delivery side reports status echoes back.\n\n## Models\n\nCase-side models are **internal**: generated API/CLI/MCP surfaces are\nread-only (`list`/`get`) and every write goes through the service facades\n(the `smrt-chat` `ChatService` idiom). Operational configuration models\n(bindings, policies, specialists, qualifications, availability) expose full\ngenerated CRUD; **commercial terms** (`SupportPlan`,\n`SupportCompensationPlan`) are read-only too — their writes flow through the\n`support.manage-plans`-gated `SupportPlanAdminService`.\n\n### Case core (#1926)\n\n- **SupportCase** (`support_cases`) — canonical ticket: `caseNumber`,\n `subject`, `status` (`new → triaged → assigned → in_progress →\n waiting_on_client|escalated → resolved → closed`, guarded at save time via\n the WeakMap + authoritative-DB-read idiom from S5 #1390), `priority`,\n `severity` (plan-defined key), `category`, `sensitive`, `channelKind`,\n `clientProfileId`/`openedByProfileId` (crossPackageRef → Profile),\n `projectId` (app-defined string — deliberately not an FK), `bindingId`,\n `threadKey` (create-or-join dedup key), `planId` + `planSnapshot` (terms\n frozen at apply time), assignment fields, response stamps\n (`acknowledgedAt`, `firstRespondedAt`), `humanRequestedAt`, resolution\n fields, `reopenCount`/`lastReopenedAt`, `aiEnabled`.\n- **SupportInteraction** (`support_interactions`,\n `conflictColumns: ['source_key']`) — channel-neutral transport record:\n `direction` (`inbound`/`outbound`/`internal`), `channelKind`, `actorKind`\n (`client`/`specialist`/`agent`/`system`), denormalized `body`, and the\n qualified `sourceType`/`sourceId` + globally unique `sourceKey`\n (`chat:<messageId>`, `email:<emailId>`, `manual:<uuid>`) that makes\n re-ingestion idempotent.\n- **SupportCaseEvent** (`support_case_events`) — append-only audit trail\n (transitions, assignments, AI runs, handoffs, escalations, target state,\n work links, reopens). Together with interactions this is the complete\n context a Human Handoff transfers.\n- **SupportChannelBinding** (`support_channel_bindings`,\n `conflictColumns: ['target_type','target_id']`) — marks a container as a\n support intake channel: `bindingKind` (`chat_room`/`email_account`),\n qualified `targetType` + `targetId`, default client/project/plan,\n `selfAddresses` (email direction heuristic). Unbound containers are never\n touched.\n- **SupportWorkLink** (`support_work_links`) — Support/Development Work Item\n links with a read-only `status` echo.\n\n### AI workflow (#1928)\n\n- **SupportPolicy** (`support_policies`) — what the AI may do without a\n human: `autoAcknowledge`/`autoClassify`/`autoAnswer` (on by default),\n `autoTroubleshoot`/`autoResolve` (off by default),\n `autoResolveMaxSeverity`, `confidenceThreshold`, `maxAutoAttempts`,\n `sensitiveCategories`, `allowedTools`, `autoSendEmailReplies` (off —\n email replies are drafted, not sent). Resolution is most-specific-wins on\n `(planId, projectId)`; no row → `DEFAULT_SUPPORT_POLICY` (conservative).\n- **SupportAiRun** (`support_ai_runs`) — append-only audit of each phase\n (`acknowledge`/`classify`/`answer`/`troubleshoot`/`resolve`) with\n `confidence`, classification output, knowledge refs, tool calls, outcome\n (`completed`/`skipped`/`failed`/`handed_off`), and `correlationId`.\n\n### Routing, targets, escalation (#1929)\n\n- **SupportSpecialist** (`support_specialists`) — specialist role record on a\n Profile (the commerce `Customer` role-record idiom): `languages`,\n `timezone`, `maxConcurrentCases`, `onCallPriority`, status.\n- **SupportQualification** (`support_qualifications`) — effective-dated\n Project Support Qualification (`trainee`/`qualified`/`expert`).\n- **SupportAvailability** (`support_availability_windows`) — weekly windows\n plus `on_call`/`time_off` spans.\n- **SupportPlan** (`support_plans`, `conflictColumns:\n ['tenant_id','plan_key']`) — the Managed Support Plan: coverage calendar +\n holidays + timezone, channels, severity definitions, per-severity\n acknowledgement/response/update/resolution target minutes, `pauseStatuses`\n (clocks pause only when the plan says so), escalation policy steps,\n availability fee, `includedMinutes`, `overageHourlyRate`,\n `onCallHourlyRate`, time-approval policy, optional\n `subscriptionPlanKey` binding (string, not a dependency).\n `snapshotTerms()` feeds `SupportCase.planSnapshot`.\n- **SupportServiceTarget** (`support_service_targets`,\n `conflictColumns: ['case_id','target_type','cycle']`) — one clock per\n target type (update clocks recur via `cycle`), with pause accounting and\n `escalationJobId` (the one-shot `_smrt_jobs` row scheduled at `dueAt`,\n cancelled on satisfy).\n- **SupportEscalation** (`support_escalations`) — the audit record of one\n escalation firing.\n- **SupportCompensationPlan** (`support_compensation_plans`) —\n effective-dated Support Specialist earning terms; specialist-specific plan\n wins over the tenant default at the work instant. Deliberately separate\n from `SupportPlan` (client pricing) so margin stays measurable.\n\n### Service time (#1930)\n\n- **ServiceTimeEntry** (`service_time_entries`) — auditable Professional\n Service duration: work-context-generic (`caseId` and/or polymorphic\n `workRefType`/`workRefId`), delivering Participant (`participantKind`\n `human`/`agent` + `participantProfileId`/`agentRef`), `source`\n (`timer`/`manual`/`import`/`agent` — one shared validation/audit\n contract), evidence JSON, and lifecycle `draft → submitted →\n approved|rejected`, `approved → corrected` only. **Approved entries are\n immutable**: the work-defining fields are frozen at save time (the\n `LicenseSale` WeakMap-freeze idiom, backed by an authoritative DB-row\n comparison); disputes create explicit corrections via `correctionOfId`.\n- **SupportCharge** / **SupportCompensation** (`support_charges` /\n `support_compensations`, one per time entry) — derived commercial\n snapshots: client amount from the Managed Support Plan (included-time\n consumption then metered overage) vs provider amount from the Support\n Compensation Plan, each with a frozen `rateSnapshot`. Margin = charge −\n compensation, computed by readers; settlement/invoicing composes at the\n app/accounting boundary (#1925) and is out of scope here.\n\n## Services\n\n- **SupportCaseService** — the closed write facade: `openCase`,\n `recordInteraction` (idempotent on `sourceKey`; stamps\n `acknowledgedAt`/`firstRespondedAt`; inbound un-parks\n `waiting_on_client`), `transition`, `assign`, `resolve`, `close`,\n `reopen` (preserves prior resolution in the reopen event), `requestHuman`,\n `linkWork`/`recordWorkStatus` (Delivery Handoff), `recordEvent`,\n `getTimeline` (merged interactions + events).\n- **SupportIntakeService** — create-or-join intake for both channels:\n `ingestChatMessage` (bound `ChatRoom`; `chat:<roomId>[:<threadId>]` thread\n keys; only `role: 'user'` messages), `ingestEmail` (bound `EmailAccount`;\n RFC-thread joins via `inReplyTo`; `selfAddresses` skip; unresolved senders\n park the case with `metadata.unresolvedClient`), plus\n `registerSupportIntake()` — an opt-in `GlobalInterceptors.afterSave`\n observer keyed on the `ChatMessage`/`Email` class names that never throws\n into the source package's save path. Join semantics: open case → join;\n resolved → reopen; closed → new case.\n- **SupportAiWorkflow** — the Automated Support Response (FR-28a):\n `processIntake`/`processCase` run acknowledge → classify → answer →\n resolve under the resolved `SupportPolicy` (conservative defaults), each\n phase writing a `SupportAiRun` + `ai_run` case event. AI calls go through\n the injected `SupportAiBoundary` (default uses `supportCase.do()` with\n defensive JSON parsing that fails toward the human); knowledge comes from\n the pluggable `SupportKnowledgeProvider` (default no-op). Classification\n never overwrites human triage; email answers are drafted\n (`metadata.draft`) unless the policy allows sending. Handoff triggers —\n `client_request`, `low_confidence`, `high_severity`, `sensitive`,\n `failed_resolution`, `policy` (attempt budget) — are always active.\n- **HumanHandoffService** — the lossless Human Handoff (FR-28b):\n `handoff` assembles the full context package (case state + compact\n timeline + AI runs) into the `handoff` event, stamps\n `metadata.activeHandoff` for the no-repeat guarantee (repeat triggers are\n deduped events), routes through the injected `assignSpecialist` seam\n (#1929's routing service plugs in; default queues `new` cases to\n `triaged`), and `releaseHandoff` clears the flag.\n- **ServiceTargetEngine** — Service Target clocks (FR-30/31):\n `startTargetsForCase` derives per-severity clocks from the case's\n `planSnapshot` (live plan fallback) with due times computed in covered\n time (`coverage-calendar.ts`: timezone-aware weekly windows + holidays;\n empty coverage = 24×7) and schedules one-shot `_smrt_jobs` escalation jobs\n at `dueAt`; `onInteractionRecorded` satisfies acknowledgement/response and\n recurs `update` cycles; `onCaseTransition` pauses/resumes clocks only when\n the plan's `pauseStatuses` say so (recomputing remaining covered minutes)\n and settles targets on resolve. Breach → `SupportServiceTarget.\n checkAndEscalate` (background-eligible, at-least-once-safe) marks the\n breach and escalates through the plan's policy steps (notify/reassign,\n delayed follow-up levels), transitioning the case to `escalated`.\n- **SupportPlanAdminService** — the permission-gated write surface for\n commercial terms: create/update/archive for Managed Support Plans and\n Support Compensation Plans, every act behind `support.manage-plans` with\n cross-tenant writes refused (generated CRUD on both models is read-only).\n- **SupportRoutingService** — explainable ranked routing (FR-30):\n `rankSpecialists` hard-filters on active status, effective Project\n Support Qualification, workload cap, and availability windows (specialist\n timezone), then scores preferred-specialist, qualification level, on-call,\n workload headroom, and language (weights in `ROUTING_WEIGHTS`; every\n factor recorded so ineligible specialists show why); `autoAssign` writes\n the assignment with its rationale; `reassign` is gated by\n `support.reassign-case` and refuses cross-tenant principals.\n- **ServiceTimeEntryService** — the ONE recording contract for all four\n entry sources (FR-40): `record` validates duration (explicit or derived\n from the period; `timer` needs both bounds), participant coherence\n (`human` → `participantProfileId`, `agent` → `agentRef`), and the work\n context (case and/or work ref; case entries copy the tenant and append a\n `time_recorded` event); `submit` stamps the submitter.\n- **TimeEntryApprovalService** — the approval gate and only writer of the\n commercial snapshots (FR-36): `approve` resolves the governing terms (case\n `planSnapshot` first, live plan fallback, zero-rate default), gates by\n policy path (`automatic`/`threshold`/`operator`/`client`; operator paths\n behind `support.approve-time-entry`; cross-tenant principals refused), then\n derives the `SupportCharge` (included time first, then overage/on-call) and\n `SupportCompensation` (effective-dated plan) rows; `reject` and `correct`\n (supersede + linked fresh draft via `correctionOfId`) round out the\n lifecycle. Case events carry the charge amount only — compensation never\n leaks case-side.\n\n## Permissions\n\nContributed to the runtime catalog on import (the\n`personas.activate-directive` pattern): `support.reassign-case`,\n`support.approve-time-entry`, `support.manage-plans`. Privileged service\noperations take a `SupportPrincipal` (`can(slug)`), built from explicit slugs\nor a `PermissionResolver`.\n\n## Svelte UI\n\n`@happyvertical/smrt-support/svelte` ships presentational Svelte 5 surfaces:\n`CaseQueue` (priority/status/assignment/channel at a glance, `onselect`),\n`CaseDetail` (header, meta, linked work, merged timeline), `TargetList`\n(Service Target clocks with due/paused/satisfied/breached badges),\n`RoutingRationale` (ranked specialists with eligibility + factor chips and\nan optional reassign action), and `TimeEntryApprovalQueue`\n(date/hours/description/worker/status/amount with\napprove/reject-with-reason actions on submitted rows; owned by\nsmrt-timesheets since #3288 and re-exported here). Hosts adapt models\nwith `toSupportCaseView` / `toCaseTimelineItemView` / `toServiceTargetView`\n/ `toSupportTimeEntryView` — the time-entry view's first eight fields\ndeliberately match the presentation `TimeEntry` contract, and\n`SupportTimeEntryView` extends smrt-timesheets' `TimeEntryApprovalView`.\nComponents use `smrt-ui` primitives (`smrtRawPrimitives: \"strict\"`).\n\n## Dependencies\n\nPackage dependencies: `smrt-core`, `smrt-tenancy`, `smrt-projects`,\n`smrt-timesheets`, `smrt-chat`, `smrt-messages`, `smrt-jobs`, `smrt-users`,\n`smrt-ui`,\n`@happyvertical/logger`, `@happyvertical/sql`. Profile and subscriptions\nreferences are `@crossPackageRef` string ids or plain string\nkeys. `smrt-projects` is the intentional shared delivery edge added by #1955;\n`smrt-timesheets` owns the shared time-entry evidence (#3288). No inter-`smrt-*` `peerDependencies`.\n\n## Validation\n\n```sh\npnpm --filter @happyvertical/smrt-support test\npnpm --filter @happyvertical/smrt-support test:postgres\npnpm --filter @happyvertical/smrt-support typecheck\npnpm --filter @happyvertical/smrt-support build\n```\n\n`test:postgres` is the lane that holds the money/rate line — SQLite's type\naffinity stores a REAL in an INTEGER column without complaint, so a money field\nthat reverted to DECIMAL passes every SQLite suite.\n\n## Money and rates\n\n- **Money is integer minor units** (cents) — `$19.99` is `1999`.\n `SupportPlan.availabilityFeeAmount`, `SupportCharge.amount` and\n `SupportCompensation.amount` initialize `= 0`, never `= 0.0`: the integer\n literal is what maps them to INTEGER columns (BIGINT on fresh PostgreSQL/DuckDB databases; #2401, #2373).\n- **Rates stay DECIMAL but their unit changed.**\n `SupportPlan.overageHourlyRate` / `onCallHourlyRate` and\n `SupportCompensationPlan.hourlyRate` are **minor units per hour**, so\n `hours * rate` yields minor units. INTEGER would truncate a sub-unit rate to\n zero, which is why they keep a decimal initializer.\n- **`roundMoney()` is the single rate↔money boundary.** It rounds\n `(seconds / 3600) * hourlyRate` to a whole minor unit, which is what lets the\n `thresholdAmount` comparison in `determinePath()` be an exact `>` with no\n tolerance. `TimeApprovalPolicy.thresholdAmount` is in the same unit as\n `SupportCharge.amount`.\n- **Migrating an existing database**: `preflightSupportMoneyMinorUnits(db)`\n reports which columns still hold major units and which rows would be rounded\n or exceed JavaScript's safe-integer range; `migrateSupportMoneyToMinorUnits(db)` converts them\n (idempotent via `_smrt_backfills`). The **rate columns are not in that list**\n — their type does not change, but their stored values must still be\n multiplied by the same scale in the same deploy step. Frozen `rateSnapshot`\n JSON on settled charges is history and is left alone. On SQLite the values\n are rescaled but the declared type needs the table-rebuild path (#2370).\n Fresh PostgreSQL/DuckDB INTEGER columns are BIGINT and hydration rejects\n values outside JavaScript's safe-integer range; existing PostgreSQL `int4`\n columns require #2424.\n\n## Gotchas\n\n- **Writes go through the facades** — the case-side generated routes are\n read-only on purpose; `create`/`update` on them is not a bug to \"fix\".\n- **`projectId` is an app-defined string** — the consuming app owns the\n Project concept; don't turn it into an FK or a crossPackageRef to\n `smrt-projects:Project` (that class is a provider board, not a client\n initiative).\n- **`SupportCase.threadKey` + `SupportInteraction.sourceKey` carry intake\n correctness** — `sourceKey` is globally unique (`conflictColumns`), so\n replayed transport rows are no-ops; new manual interactions must use a\n fresh `manual:<uuid>` key.\n- **High-volume models avoid the inherited `name` field** (`subject`,\n `displayName`, …) so the default `(slug, context, _meta_type)` unique index\n falls back to id-derived slugs; named config models carry\n `conflictColumns` instead (which replaces that index).\n- **Approved time entries never change** — corrections are new rows linked\n by `correctionOfId`; the original flips to `corrected` with its snapshot\n intact.\n- **Plan edits never rewrite history** — cases keep `planSnapshot`, charges\n and compensation keep `rateSnapshot`.\n- **Create-or-join and included-time consumption serialize in-process** —\n `SupportIntakeService` (per conversation key) and\n `TimeEntryApprovalService` (per case) use a `KeyedMutex`, which covers the\n single-app-process deployment these paths run in. Multi-replica\n deployments must serialize at the app layer (route a conversation's\n intake / a case's approvals through one worker, or add an app-level\n claim) — the framework exposes no cross-adapter transaction primitive at\n this seam. Escalation is additionally idempotent per `(target, level)`,\n so at-least-once job redelivery never stacks duplicate escalations.\n\n- **Recipe `support.tickets`** (`src/recipes.ts`, help in `src/tickets.recipe.md`): lists tickets, messages and the support team for the planner and other catalog hosts. Fields it shows carry `@field({ description })` in plain words; keep them when editing the models.\n",
|
|
6040
6040
|
"recipes": [
|
|
6041
6041
|
{
|
|
6042
6042
|
"id": "support.tickets",
|
|
@@ -5,10 +5,10 @@ description: "AI-first Support Cases: channel-neutral intake, lifecycle, routing
|
|
|
5
5
|
status: "stable"
|
|
6
6
|
generated:
|
|
7
7
|
by: "smrt/scripts/generate-knowledge-okf.ts"
|
|
8
|
-
at: "2026-11-
|
|
8
|
+
at: "2026-11-12T15:36:20Z"
|
|
9
9
|
audience: "internal"
|
|
10
10
|
evidence_level: "source-inspected"
|
|
11
|
-
source_revision: "sha256:
|
|
11
|
+
source_revision: "sha256:00390b98e4c9a392563b3a05c881f0426250c25a1c3d4977358fe88a42769dd8"
|
|
12
12
|
sources:
|
|
13
13
|
- id: "manifest"
|
|
14
14
|
resource: "https://github.com/happyvertical/smrt/blob/main/packages/support/package.json"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-support",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.18",
|
|
4
4
|
"smrtJsdoc": "strict",
|
|
5
5
|
"description": "AI-first Support Cases: channel-neutral intake, lifecycle, routing, service targets, and service time for the SMRT framework",
|
|
6
6
|
"type": "module",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@happyvertical/logger": "^0.112.2",
|
|
30
|
-
"@happyvertical/smrt-chat": "0.60.
|
|
31
|
-
"@happyvertical/smrt-core": "0.60.
|
|
32
|
-
"@happyvertical/smrt-jobs": "0.60.
|
|
33
|
-
"@happyvertical/smrt-messages": "0.60.
|
|
34
|
-
"@happyvertical/smrt-projects": "0.60.
|
|
35
|
-
"@happyvertical/smrt-tenancy": "0.60.
|
|
36
|
-
"@happyvertical/smrt-timesheets": "0.60.
|
|
37
|
-
"@happyvertical/smrt-ui": "0.60.
|
|
38
|
-
"@happyvertical/smrt-users": "0.60.
|
|
30
|
+
"@happyvertical/smrt-chat": "0.60.18",
|
|
31
|
+
"@happyvertical/smrt-core": "0.60.18",
|
|
32
|
+
"@happyvertical/smrt-jobs": "0.60.18",
|
|
33
|
+
"@happyvertical/smrt-messages": "0.60.18",
|
|
34
|
+
"@happyvertical/smrt-projects": "0.60.18",
|
|
35
|
+
"@happyvertical/smrt-tenancy": "0.60.18",
|
|
36
|
+
"@happyvertical/smrt-timesheets": "0.60.18",
|
|
37
|
+
"@happyvertical/smrt-ui": "0.60.18",
|
|
38
|
+
"@happyvertical/smrt-users": "0.60.18",
|
|
39
39
|
"@happyvertical/sql": "^0.112.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@happyvertical/smrt-vitest": "0.60.
|
|
50
|
+
"@happyvertical/smrt-vitest": "0.60.18",
|
|
51
51
|
"@sveltejs/package": "^2.5.8",
|
|
52
52
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
53
53
|
"@types/node": "24.13.6",
|