@happyvertical/smrt-ledgers 0.30.0

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.
@@ -0,0 +1,871 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "generatedAt": "2026-06-23T01:11:29.252Z",
4
+ "packageName": "@happyvertical/smrt-ledgers",
5
+ "packageVersion": "0.30.0",
6
+ "sourceManifestPath": "dist/manifest.json",
7
+ "agentDocPath": "AGENTS.md",
8
+ "sourceHashes": {
9
+ "manifest": "35b4a72dacd29baf3c7e43cef68dcac0e16eb5f64035f519a2e4745c7aea7815",
10
+ "packageJson": "d105b820ab47841c43c33433bef2756ab69547d3f53d2721ac52df880f99507a",
11
+ "agents": "1627590d79f020c581a4b4da96ba06502d1c6411aaaed851d103bbb1be3c5fd2"
12
+ },
13
+ "exports": [
14
+ ".",
15
+ "./manifest",
16
+ "./manifest.json"
17
+ ],
18
+ "dependencies": {
19
+ "@happyvertical/smrt-core": "workspace:*",
20
+ "@happyvertical/smrt-prompts": "workspace:*",
21
+ "@happyvertical/smrt-tenancy": "workspace:*",
22
+ "@happyvertical/smrt-vitest": "workspace:*",
23
+ "@types/node": "25.0.9",
24
+ "fast-glob": "^3.3.3",
25
+ "typescript": "^5.9.3",
26
+ "vite": "^7.3.1",
27
+ "vitest": "^4.0.17"
28
+ },
29
+ "smrtDependencies": [
30
+ "@happyvertical/smrt-core",
31
+ "@happyvertical/smrt-prompts",
32
+ "@happyvertical/smrt-tenancy",
33
+ "@happyvertical/smrt-vitest"
34
+ ],
35
+ "sdkDependencies": [],
36
+ "tags": [],
37
+ "risks": [],
38
+ "objects": [
39
+ {
40
+ "name": "AccountCollection",
41
+ "qualifiedName": "@happyvertical/smrt-ledgers:AccountCollection",
42
+ "collection": "accounts",
43
+ "tableName": "account_collections",
44
+ "packageName": "@happyvertical/smrt-ledgers",
45
+ "extends": "SmrtCollection",
46
+ "fields": [],
47
+ "relationships": [],
48
+ "methods": [
49
+ "findActive",
50
+ "findByNumber",
51
+ "findByTenant",
52
+ "findByType",
53
+ "findChildren",
54
+ "findGlobal",
55
+ "findTopLevel",
56
+ "findWithGlobals",
57
+ "getDescendants",
58
+ "getOrCreateByNumber",
59
+ "getTree",
60
+ "groupByType"
61
+ ],
62
+ "surfaces": [],
63
+ "relationshipFeatures": [
64
+ "uuidColumns"
65
+ ],
66
+ "tags": [],
67
+ "risks": []
68
+ },
69
+ {
70
+ "name": "JournalEntryCollection",
71
+ "qualifiedName": "@happyvertical/smrt-ledgers:JournalEntryCollection",
72
+ "collection": "journalentries",
73
+ "tableName": "journal_entry_collections",
74
+ "packageName": "@happyvertical/smrt-ledgers",
75
+ "extends": "SmrtCollection",
76
+ "fields": [],
77
+ "relationships": [],
78
+ "methods": [
79
+ "findByAccount",
80
+ "findByAccounts",
81
+ "findByJournal",
82
+ "findByTenant",
83
+ "findGlobal",
84
+ "findWithGlobals",
85
+ "getAccountBalance",
86
+ "getAccountLedger",
87
+ "getTotalsForDateRange",
88
+ "getTrialBalance"
89
+ ],
90
+ "surfaces": [],
91
+ "relationshipFeatures": [
92
+ "uuidColumns"
93
+ ],
94
+ "tags": [],
95
+ "risks": []
96
+ },
97
+ {
98
+ "name": "JournalCollection",
99
+ "qualifiedName": "@happyvertical/smrt-ledgers:JournalCollection",
100
+ "collection": "journals",
101
+ "tableName": "journal_collections",
102
+ "packageName": "@happyvertical/smrt-ledgers",
103
+ "extends": "SmrtCollection",
104
+ "fields": [],
105
+ "relationships": [],
106
+ "methods": [
107
+ "createWithEntries",
108
+ "findByDateRange",
109
+ "findByMonth",
110
+ "findByNumber",
111
+ "findBySource",
112
+ "findBySourceRef",
113
+ "findByStatus",
114
+ "findByTenant",
115
+ "findDrafts",
116
+ "findGlobal",
117
+ "findPosted",
118
+ "findWithGlobals",
119
+ "post",
120
+ "void"
121
+ ],
122
+ "surfaces": [],
123
+ "relationshipFeatures": [
124
+ "uuidColumns"
125
+ ],
126
+ "tags": [],
127
+ "risks": []
128
+ },
129
+ {
130
+ "name": "Account",
131
+ "qualifiedName": "@happyvertical/smrt-ledgers:Account",
132
+ "collection": "accounts",
133
+ "tableName": "accounts",
134
+ "packageName": "@happyvertical/smrt-ledgers",
135
+ "extends": "SmrtHierarchical",
136
+ "fields": [
137
+ {
138
+ "name": "parentId",
139
+ "type": "foreignKey",
140
+ "required": false,
141
+ "related": "Account",
142
+ "columnType": "UUID"
143
+ },
144
+ {
145
+ "name": "tenantId",
146
+ "type": "text",
147
+ "required": false,
148
+ "columnType": "UUID"
149
+ },
150
+ {
151
+ "name": "number",
152
+ "type": "text",
153
+ "required": false,
154
+ "columnType": "TEXT"
155
+ },
156
+ {
157
+ "name": "name",
158
+ "type": "text",
159
+ "required": false,
160
+ "columnType": "TEXT"
161
+ },
162
+ {
163
+ "name": "description",
164
+ "type": "text",
165
+ "required": false,
166
+ "columnType": "TEXT"
167
+ },
168
+ {
169
+ "name": "type",
170
+ "type": "text",
171
+ "required": false,
172
+ "columnType": "TEXT"
173
+ },
174
+ {
175
+ "name": "active",
176
+ "type": "boolean",
177
+ "required": false,
178
+ "columnType": "BOOLEAN"
179
+ },
180
+ {
181
+ "name": "metadata",
182
+ "type": "json",
183
+ "required": false,
184
+ "columnType": "JSON"
185
+ }
186
+ ],
187
+ "relationships": [
188
+ {
189
+ "name": "parentId",
190
+ "type": "foreignKey",
191
+ "required": false,
192
+ "related": "Account",
193
+ "columnType": "UUID"
194
+ }
195
+ ],
196
+ "methods": [
197
+ "createChild",
198
+ "getAncestors",
199
+ "getBalance",
200
+ "getChildren",
201
+ "getDescendants",
202
+ "getFullPath",
203
+ "getHierarchy",
204
+ "getParent",
205
+ "isCreditNormal",
206
+ "isDebitNormal",
207
+ "isTopLevel",
208
+ "moveTo",
209
+ "toTreeNode"
210
+ ],
211
+ "surfaces": [
212
+ {
213
+ "kind": "api",
214
+ "name": "accounts.list",
215
+ "operation": "list",
216
+ "objectName": "@happyvertical/smrt-ledgers:Account",
217
+ "path": "/accounts",
218
+ "method": "GET"
219
+ },
220
+ {
221
+ "kind": "api",
222
+ "name": "accounts.get",
223
+ "operation": "get",
224
+ "objectName": "@happyvertical/smrt-ledgers:Account",
225
+ "path": "/accounts/[id]",
226
+ "method": "GET"
227
+ },
228
+ {
229
+ "kind": "api",
230
+ "name": "accounts.create",
231
+ "operation": "create",
232
+ "objectName": "@happyvertical/smrt-ledgers:Account",
233
+ "path": "/accounts",
234
+ "method": "POST"
235
+ },
236
+ {
237
+ "kind": "api",
238
+ "name": "accounts.update",
239
+ "operation": "update",
240
+ "objectName": "@happyvertical/smrt-ledgers:Account",
241
+ "path": "/accounts/[id]",
242
+ "method": "PATCH"
243
+ },
244
+ {
245
+ "kind": "api",
246
+ "name": "accounts.delete",
247
+ "operation": "delete",
248
+ "objectName": "@happyvertical/smrt-ledgers:Account",
249
+ "path": "/accounts/[id]",
250
+ "method": "DELETE"
251
+ },
252
+ {
253
+ "kind": "cli",
254
+ "name": "account_list",
255
+ "operation": "list",
256
+ "objectName": "@happyvertical/smrt-ledgers:Account"
257
+ },
258
+ {
259
+ "kind": "cli",
260
+ "name": "account_get",
261
+ "operation": "get",
262
+ "objectName": "@happyvertical/smrt-ledgers:Account"
263
+ },
264
+ {
265
+ "kind": "cli",
266
+ "name": "account_create",
267
+ "operation": "create",
268
+ "objectName": "@happyvertical/smrt-ledgers:Account"
269
+ },
270
+ {
271
+ "kind": "cli",
272
+ "name": "account_update",
273
+ "operation": "update",
274
+ "objectName": "@happyvertical/smrt-ledgers:Account"
275
+ },
276
+ {
277
+ "kind": "cli",
278
+ "name": "account_delete",
279
+ "operation": "delete",
280
+ "objectName": "@happyvertical/smrt-ledgers:Account"
281
+ },
282
+ {
283
+ "kind": "mcp",
284
+ "name": "account_list",
285
+ "operation": "list",
286
+ "objectName": "@happyvertical/smrt-ledgers:Account"
287
+ },
288
+ {
289
+ "kind": "mcp",
290
+ "name": "account_get",
291
+ "operation": "get",
292
+ "objectName": "@happyvertical/smrt-ledgers:Account"
293
+ },
294
+ {
295
+ "kind": "mcp",
296
+ "name": "account_create",
297
+ "operation": "create",
298
+ "objectName": "@happyvertical/smrt-ledgers:Account"
299
+ }
300
+ ],
301
+ "relationshipFeatures": [
302
+ "SmrtHierarchical",
303
+ "foreignKey",
304
+ "uuidColumns"
305
+ ],
306
+ "tags": [],
307
+ "risks": []
308
+ },
309
+ {
310
+ "name": "Journal",
311
+ "qualifiedName": "@happyvertical/smrt-ledgers:Journal",
312
+ "collection": "journals",
313
+ "tableName": "journals",
314
+ "packageName": "@happyvertical/smrt-ledgers",
315
+ "extends": "SmrtObject",
316
+ "fields": [
317
+ {
318
+ "name": "tenantId",
319
+ "type": "text",
320
+ "required": false,
321
+ "columnType": "UUID"
322
+ },
323
+ {
324
+ "name": "number",
325
+ "type": "text",
326
+ "required": false,
327
+ "columnType": "TEXT"
328
+ },
329
+ {
330
+ "name": "date",
331
+ "type": "datetime",
332
+ "required": false,
333
+ "columnType": "TIMESTAMP"
334
+ },
335
+ {
336
+ "name": "description",
337
+ "type": "text",
338
+ "required": false,
339
+ "columnType": "TEXT"
340
+ },
341
+ {
342
+ "name": "sourceModule",
343
+ "type": "text",
344
+ "required": false,
345
+ "columnType": "TEXT"
346
+ },
347
+ {
348
+ "name": "sourceRef",
349
+ "type": "text",
350
+ "required": false,
351
+ "columnType": "TEXT"
352
+ },
353
+ {
354
+ "name": "status",
355
+ "type": "text",
356
+ "required": false,
357
+ "columnType": "TEXT"
358
+ },
359
+ {
360
+ "name": "postedAt",
361
+ "type": "datetime",
362
+ "required": false,
363
+ "columnType": "TIMESTAMP"
364
+ },
365
+ {
366
+ "name": "voidedAt",
367
+ "type": "datetime",
368
+ "required": false,
369
+ "columnType": "TIMESTAMP"
370
+ },
371
+ {
372
+ "name": "voidReason",
373
+ "type": "text",
374
+ "required": false,
375
+ "columnType": "TEXT"
376
+ },
377
+ {
378
+ "name": "metadata",
379
+ "type": "json",
380
+ "required": false,
381
+ "columnType": "JSON"
382
+ }
383
+ ],
384
+ "relationships": [],
385
+ "methods": [
386
+ "addEntry",
387
+ "getEntries",
388
+ "getTotalCredits",
389
+ "getTotalDebits",
390
+ "isBalanced",
391
+ "isDraft",
392
+ "isEditable",
393
+ "isPosted",
394
+ "isVoided",
395
+ "post",
396
+ "summarize",
397
+ "void"
398
+ ],
399
+ "surfaces": [
400
+ {
401
+ "kind": "api",
402
+ "name": "journals.list",
403
+ "operation": "list",
404
+ "objectName": "@happyvertical/smrt-ledgers:Journal",
405
+ "path": "/journals",
406
+ "method": "GET"
407
+ },
408
+ {
409
+ "kind": "api",
410
+ "name": "journals.get",
411
+ "operation": "get",
412
+ "objectName": "@happyvertical/smrt-ledgers:Journal",
413
+ "path": "/journals/[id]",
414
+ "method": "GET"
415
+ },
416
+ {
417
+ "kind": "api",
418
+ "name": "journals.create",
419
+ "operation": "create",
420
+ "objectName": "@happyvertical/smrt-ledgers:Journal",
421
+ "path": "/journals",
422
+ "method": "POST"
423
+ },
424
+ {
425
+ "kind": "cli",
426
+ "name": "journal_list",
427
+ "operation": "list",
428
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
429
+ },
430
+ {
431
+ "kind": "cli",
432
+ "name": "journal_get",
433
+ "operation": "get",
434
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
435
+ },
436
+ {
437
+ "kind": "cli",
438
+ "name": "journal_create",
439
+ "operation": "create",
440
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
441
+ },
442
+ {
443
+ "kind": "cli",
444
+ "name": "journal_update",
445
+ "operation": "update",
446
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
447
+ },
448
+ {
449
+ "kind": "cli",
450
+ "name": "journal_delete",
451
+ "operation": "delete",
452
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
453
+ },
454
+ {
455
+ "kind": "mcp",
456
+ "name": "journal_list",
457
+ "operation": "list",
458
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
459
+ },
460
+ {
461
+ "kind": "mcp",
462
+ "name": "journal_get",
463
+ "operation": "get",
464
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
465
+ },
466
+ {
467
+ "kind": "mcp",
468
+ "name": "journal_create",
469
+ "operation": "create",
470
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
471
+ }
472
+ ],
473
+ "relationshipFeatures": [
474
+ "uuidColumns"
475
+ ],
476
+ "tags": [],
477
+ "risks": []
478
+ },
479
+ {
480
+ "name": "JournalEntry",
481
+ "qualifiedName": "@happyvertical/smrt-ledgers:JournalEntry",
482
+ "collection": "journalentries",
483
+ "tableName": "journal_entries",
484
+ "packageName": "@happyvertical/smrt-ledgers",
485
+ "extends": "SmrtObject",
486
+ "fields": [
487
+ {
488
+ "name": "tenantId",
489
+ "type": "text",
490
+ "required": false,
491
+ "columnType": "UUID"
492
+ },
493
+ {
494
+ "name": "journalId",
495
+ "type": "foreignKey",
496
+ "required": false,
497
+ "related": "Journal",
498
+ "columnType": "UUID"
499
+ },
500
+ {
501
+ "name": "accountId",
502
+ "type": "foreignKey",
503
+ "required": false,
504
+ "related": "Account",
505
+ "columnType": "UUID"
506
+ },
507
+ {
508
+ "name": "debit",
509
+ "type": "decimal",
510
+ "required": false,
511
+ "columnType": "REAL"
512
+ },
513
+ {
514
+ "name": "credit",
515
+ "type": "decimal",
516
+ "required": false,
517
+ "columnType": "REAL"
518
+ },
519
+ {
520
+ "name": "currency",
521
+ "type": "text",
522
+ "required": false,
523
+ "columnType": "TEXT"
524
+ },
525
+ {
526
+ "name": "exchangeRate",
527
+ "type": "decimal",
528
+ "required": false,
529
+ "columnType": "REAL"
530
+ },
531
+ {
532
+ "name": "memo",
533
+ "type": "text",
534
+ "required": false,
535
+ "columnType": "TEXT"
536
+ },
537
+ {
538
+ "name": "metadata",
539
+ "type": "json",
540
+ "required": false,
541
+ "columnType": "JSON"
542
+ }
543
+ ],
544
+ "relationships": [
545
+ {
546
+ "name": "journalId",
547
+ "type": "foreignKey",
548
+ "required": false,
549
+ "related": "Journal",
550
+ "columnType": "UUID"
551
+ },
552
+ {
553
+ "name": "accountId",
554
+ "type": "foreignKey",
555
+ "required": false,
556
+ "related": "Account",
557
+ "columnType": "UUID"
558
+ }
559
+ ],
560
+ "methods": [
561
+ "getAccount",
562
+ "getAmount",
563
+ "getBaseAmount",
564
+ "getDescription",
565
+ "getJournal",
566
+ "isCredit",
567
+ "isDebit"
568
+ ],
569
+ "surfaces": [
570
+ {
571
+ "kind": "api",
572
+ "name": "journalentries.list",
573
+ "operation": "list",
574
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry",
575
+ "path": "/journalentries",
576
+ "method": "GET"
577
+ },
578
+ {
579
+ "kind": "api",
580
+ "name": "journalentries.get",
581
+ "operation": "get",
582
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry",
583
+ "path": "/journalentries/[id]",
584
+ "method": "GET"
585
+ },
586
+ {
587
+ "kind": "cli",
588
+ "name": "journalentry_list",
589
+ "operation": "list",
590
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
591
+ },
592
+ {
593
+ "kind": "cli",
594
+ "name": "journalentry_get",
595
+ "operation": "get",
596
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
597
+ },
598
+ {
599
+ "kind": "cli",
600
+ "name": "journalentry_create",
601
+ "operation": "create",
602
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
603
+ },
604
+ {
605
+ "kind": "cli",
606
+ "name": "journalentry_update",
607
+ "operation": "update",
608
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
609
+ },
610
+ {
611
+ "kind": "cli",
612
+ "name": "journalentry_delete",
613
+ "operation": "delete",
614
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
615
+ },
616
+ {
617
+ "kind": "mcp",
618
+ "name": "journalentry_list",
619
+ "operation": "list",
620
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
621
+ },
622
+ {
623
+ "kind": "mcp",
624
+ "name": "journalentry_get",
625
+ "operation": "get",
626
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
627
+ }
628
+ ],
629
+ "relationshipFeatures": [
630
+ "foreignKey",
631
+ "uuidColumns"
632
+ ],
633
+ "tags": [],
634
+ "risks": []
635
+ }
636
+ ],
637
+ "surfaces": [
638
+ {
639
+ "kind": "api",
640
+ "name": "accounts.list",
641
+ "operation": "list",
642
+ "objectName": "@happyvertical/smrt-ledgers:Account",
643
+ "path": "/accounts",
644
+ "method": "GET"
645
+ },
646
+ {
647
+ "kind": "api",
648
+ "name": "accounts.get",
649
+ "operation": "get",
650
+ "objectName": "@happyvertical/smrt-ledgers:Account",
651
+ "path": "/accounts/[id]",
652
+ "method": "GET"
653
+ },
654
+ {
655
+ "kind": "api",
656
+ "name": "accounts.create",
657
+ "operation": "create",
658
+ "objectName": "@happyvertical/smrt-ledgers:Account",
659
+ "path": "/accounts",
660
+ "method": "POST"
661
+ },
662
+ {
663
+ "kind": "api",
664
+ "name": "accounts.update",
665
+ "operation": "update",
666
+ "objectName": "@happyvertical/smrt-ledgers:Account",
667
+ "path": "/accounts/[id]",
668
+ "method": "PATCH"
669
+ },
670
+ {
671
+ "kind": "api",
672
+ "name": "accounts.delete",
673
+ "operation": "delete",
674
+ "objectName": "@happyvertical/smrt-ledgers:Account",
675
+ "path": "/accounts/[id]",
676
+ "method": "DELETE"
677
+ },
678
+ {
679
+ "kind": "cli",
680
+ "name": "account_list",
681
+ "operation": "list",
682
+ "objectName": "@happyvertical/smrt-ledgers:Account"
683
+ },
684
+ {
685
+ "kind": "cli",
686
+ "name": "account_get",
687
+ "operation": "get",
688
+ "objectName": "@happyvertical/smrt-ledgers:Account"
689
+ },
690
+ {
691
+ "kind": "cli",
692
+ "name": "account_create",
693
+ "operation": "create",
694
+ "objectName": "@happyvertical/smrt-ledgers:Account"
695
+ },
696
+ {
697
+ "kind": "cli",
698
+ "name": "account_update",
699
+ "operation": "update",
700
+ "objectName": "@happyvertical/smrt-ledgers:Account"
701
+ },
702
+ {
703
+ "kind": "cli",
704
+ "name": "account_delete",
705
+ "operation": "delete",
706
+ "objectName": "@happyvertical/smrt-ledgers:Account"
707
+ },
708
+ {
709
+ "kind": "mcp",
710
+ "name": "account_list",
711
+ "operation": "list",
712
+ "objectName": "@happyvertical/smrt-ledgers:Account"
713
+ },
714
+ {
715
+ "kind": "mcp",
716
+ "name": "account_get",
717
+ "operation": "get",
718
+ "objectName": "@happyvertical/smrt-ledgers:Account"
719
+ },
720
+ {
721
+ "kind": "mcp",
722
+ "name": "account_create",
723
+ "operation": "create",
724
+ "objectName": "@happyvertical/smrt-ledgers:Account"
725
+ },
726
+ {
727
+ "kind": "api",
728
+ "name": "journals.list",
729
+ "operation": "list",
730
+ "objectName": "@happyvertical/smrt-ledgers:Journal",
731
+ "path": "/journals",
732
+ "method": "GET"
733
+ },
734
+ {
735
+ "kind": "api",
736
+ "name": "journals.get",
737
+ "operation": "get",
738
+ "objectName": "@happyvertical/smrt-ledgers:Journal",
739
+ "path": "/journals/[id]",
740
+ "method": "GET"
741
+ },
742
+ {
743
+ "kind": "api",
744
+ "name": "journals.create",
745
+ "operation": "create",
746
+ "objectName": "@happyvertical/smrt-ledgers:Journal",
747
+ "path": "/journals",
748
+ "method": "POST"
749
+ },
750
+ {
751
+ "kind": "cli",
752
+ "name": "journal_list",
753
+ "operation": "list",
754
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
755
+ },
756
+ {
757
+ "kind": "cli",
758
+ "name": "journal_get",
759
+ "operation": "get",
760
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
761
+ },
762
+ {
763
+ "kind": "cli",
764
+ "name": "journal_create",
765
+ "operation": "create",
766
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
767
+ },
768
+ {
769
+ "kind": "cli",
770
+ "name": "journal_update",
771
+ "operation": "update",
772
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
773
+ },
774
+ {
775
+ "kind": "cli",
776
+ "name": "journal_delete",
777
+ "operation": "delete",
778
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
779
+ },
780
+ {
781
+ "kind": "mcp",
782
+ "name": "journal_list",
783
+ "operation": "list",
784
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
785
+ },
786
+ {
787
+ "kind": "mcp",
788
+ "name": "journal_get",
789
+ "operation": "get",
790
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
791
+ },
792
+ {
793
+ "kind": "mcp",
794
+ "name": "journal_create",
795
+ "operation": "create",
796
+ "objectName": "@happyvertical/smrt-ledgers:Journal"
797
+ },
798
+ {
799
+ "kind": "api",
800
+ "name": "journalentries.list",
801
+ "operation": "list",
802
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry",
803
+ "path": "/journalentries",
804
+ "method": "GET"
805
+ },
806
+ {
807
+ "kind": "api",
808
+ "name": "journalentries.get",
809
+ "operation": "get",
810
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry",
811
+ "path": "/journalentries/[id]",
812
+ "method": "GET"
813
+ },
814
+ {
815
+ "kind": "cli",
816
+ "name": "journalentry_list",
817
+ "operation": "list",
818
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
819
+ },
820
+ {
821
+ "kind": "cli",
822
+ "name": "journalentry_get",
823
+ "operation": "get",
824
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
825
+ },
826
+ {
827
+ "kind": "cli",
828
+ "name": "journalentry_create",
829
+ "operation": "create",
830
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
831
+ },
832
+ {
833
+ "kind": "cli",
834
+ "name": "journalentry_update",
835
+ "operation": "update",
836
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
837
+ },
838
+ {
839
+ "kind": "cli",
840
+ "name": "journalentry_delete",
841
+ "operation": "delete",
842
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
843
+ },
844
+ {
845
+ "kind": "mcp",
846
+ "name": "journalentry_list",
847
+ "operation": "list",
848
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
849
+ },
850
+ {
851
+ "kind": "mcp",
852
+ "name": "journalentry_get",
853
+ "operation": "get",
854
+ "objectName": "@happyvertical/smrt-ledgers:JournalEntry"
855
+ }
856
+ ],
857
+ "prompts": [
858
+ {
859
+ "filePath": "src/prompts.ts"
860
+ }
861
+ ],
862
+ "relationshipsV2": {
863
+ "foreignKeyFields": 3,
864
+ "crossPackageRefFields": 0,
865
+ "junctionCollections": 0,
866
+ "hierarchicalObjects": 1,
867
+ "polymorphicAssociations": 0,
868
+ "uuidColumns": 12
869
+ },
870
+ "agentDoc": "# @happyvertical/smrt-ledgers\n\nDouble-entry accounting with chart of accounts, journal lifecycle, and balance enforcement.\n\n## Models\n\n- **Account**: 5 types (asset/liability/equity/revenue/expense). Hierarchical via `parentId`. Debit-normal (asset, expense) vs credit-normal (liability, equity, revenue). Methods: `getAncestors()`, `getFullPath()`, `toTreeNode()`, `getBalance(asOfDate?)`.\n- **Journal**: lifecycle `draft → posted → voided`. **Immutable after posting** (can only void, not edit). `sourceModule`/`sourceRef` for cross-package attribution. Auto-numbered (e.g., \"JNL-0001\"). `summarize()` is AI-powered via the smrt-prompts registry (see Prompt Registry below).\n- **JournalEntry**: debit XOR credit (not both, validated on save). Multi-currency via `exchangeRate`. Non-negative amounts required.\n\n## Key Methods\n\n- **`Journal.summarize()`**: Generates a natural-language summary via the registered `smrtLedgers.journal.summarize` prompt, resolved through `@happyvertical/smrt-prompts`. Tenants can override the template, model, temperature, or other params via `_smrt_prompt_overrides` without code changes. Only non-PII fields (number, date, description, status, aggregate total, entry count, balanced flag) reach the AI provider.\n\n## Prompt Registry\n\nRegistered at module-load time via `definePrompt()` in `src/prompts.ts`. Side-effect imported from `src/index.ts` so consumers automatically see the prompts after importing any export from this package.\n\n| Key | Method | Variables |\n|-----|--------|-----------|\n| `smrtLedgers.journal.summarize` | `Journal.summarize()` | `journalNumber`, `journalDate`, `journalDescription`, `journalStatus`, `journalTotal`, `entryCount`, `journalBalanced` |\n\nPII-conscious variable selection: `tenantId`, `sourceRef` (may reference customer/vendor identifiers), per-entry `accountId`/`id`, and the extensible `metadata` blob are intentionally NOT exposed as prompt variables. Tenants who need richer context should override the template via `PromptOverride` and supply their own variables through a custom call site.\n\n## Balance Enforcement\n\n`journal.post()` validates `Math.abs(totalDebits - totalCredits) < BALANCE_EPSILON` where `BALANCE_EPSILON = 0.01` (float rounding tolerance). Unbalanced journals cannot be posted.\n\n## Gotchas\n\n- **Float tolerance**: 0.01 epsilon for balance check — not exact equality\n- **Entry requires journalId**: save Journal first, then add entries\n- **Posted journals cannot be modified**: only voided (`voidReason`, `voidedAt`)\n- **Account types inherited by children**: child cannot differ from parent type\n- **getBalance() is async**: requires JournalEntryCollection query (not stored on Account)\n- **Optional tenancy** on all models\n"
871
+ }