@happyvertical/smrt-ledgers 0.60.14 → 0.60.15
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 +3 -3
- package/dist/index.js +5 -11
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/prompts.d.ts +6 -6
- package/dist/prompts.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +5 -5
- package/dist/smrt-knowledge.okf.md +2 -2
- package/package.json +5 -5
package/dist/manifest.json
CHANGED
package/dist/prompts.d.ts
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* Mirrors the pattern used by `@happyvertical/smrt-properties` (see
|
|
8
8
|
* `prompts.ts`) and `@happyvertical/smrt-content` (see `content-prompts.ts`).
|
|
9
9
|
*/
|
|
10
|
-
import { type ResolvedPromptAI } from '@happyvertical/smrt-prompts';
|
|
11
10
|
export declare const smrtLedgersJournalSummarizePrompt: import("@happyvertical/smrt-prompts").PromptDefinition;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Canonical helper lives in `@happyvertical/smrt-prompts` (#4751): it also
|
|
13
|
+
* forwards the resolution's `usageTags` (`promptKey`, `promptLayer`,
|
|
14
|
+
* `templateHash`). Re-exported here for existing importers.
|
|
15
|
+
*/
|
|
16
|
+
export { promptMessageOptions } from '@happyvertical/smrt-prompts';
|
|
17
17
|
//# sourceMappingURL=prompts.d.ts.map
|
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,eAAO,MAAM,iCAAiC,wDAiB5C,CAAC;AAEH;;;;GAIG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,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-ledgers",
|
|
6
|
-
"packageVersion": "0.60.
|
|
6
|
+
"packageVersion": "0.60.15",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
12
|
-
"agents": "
|
|
10
|
+
"manifest": "276720b485ee9966040dea3075c3f03777f0ab11b5dbd541ee033a8a3601f4fa",
|
|
11
|
+
"packageJson": "c6236dece4034d9777891f0cd189e17757caa2b8bb12c087611ca6a934b97bc1",
|
|
12
|
+
"agents": "72fcafd8b7f7f224d37687f9fb48587909b5b332e88d4b6f6806fff1541985ca"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
15
15
|
".",
|
|
@@ -3176,7 +3176,7 @@
|
|
|
3176
3176
|
"polymorphicAssociations": 0,
|
|
3177
3177
|
"uuidColumns": 26
|
|
3178
3178
|
},
|
|
3179
|
-
"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?)`. Stored in `ledger_accounts` (explicit `tableName`), never the derived `accounts`: smrt-messages declares an unrelated `Account` on that table (#3098). `src/migrations/ledger-accounts-table.ts` (`smrt db:migrate-ledger-accounts`) moves pre-#3098 rows; the README has the operator sequence.\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
|
|
3179
|
+
"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?)`. Stored in `ledger_accounts` (explicit `tableName`), never the derived `accounts`: smrt-messages declares an unrelated `Account` on that table (#3098). `src/migrations/ledger-accounts-table.ts` (`smrt db:migrate-ledger-accounts`) moves pre-#3098 rows; the README has the operator sequence.\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 | Tier | Variables |\n|-----|--------|------|-----------|\n| `smrtLedgers.journal.summarize` | `Journal.summarize()` | `good` | `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\nNamed `Ledger` scopes freeze owner, currency and balance mode at creation.\n`exact-integer` mode requires safe integer minor units and exact equality; assigned\naccounts freeze scope/owner/type and cannot be deleted. Posted scoped journals and\nlines are immutable, including void/delete; use compensating postings.\n`postReceivable`/`postPayable`/`postSettlement` require exact ledgers and use one\ntransactional claim per tenant/ledger/key with payload-digest replay validation.\nThe journal's unique `(tenantId, ledgerId, idempotencyKey)` row is the permanent\nrecord: a retry after the `runOnce` claim is pruned (#4067) returns the original\nposted journal on a digest match, and refuses a mismatch or a non-posted row.\nSee README for ownership, reversal, aging and dialect contracts.\n\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**This package is unit-agnostic** — `debit` / `credit` are plain DECIMAL numbers and the balance check only compares the two sides, so it holds for whatever unit the posting module uses. As of #2401, journals posted from `@happyvertical/smrt-commerce` (`Payment.recordPayment()`, `Invoice.recognizeRevenue()`) carry **integer minor units**, which balance exactly rather than merely within the epsilon. A consumer mixing modules that post in different units will get arithmetically balanced but semantically meaningless journals; pick one unit per ledger.\n\n`JournalEntryCollection.listPostedMovements({ tenantId, accountIds, from, to,\ncurrency })` is the bounded reporting input. It joins only rows whose entry and\njournal share the requested tenant, includes every posted source (including\nmanual journals), and excludes drafts and voids. Its debit, credit, and\n`creditMinusDebit` values are raw ledger units; commerce must verify its\nminor-unit convention before using them in an exact tax report. Each returned\nmovement retains the requested `tenantId` so consumers can reject a fact that\ncrosses the reporting boundary.\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- **Same-named `Account`**: reference the ledger model by constructor (`@foreignKey(Account)`) or qualified name (`@happyvertical/smrt-ledgers:Account`), never the bare string. The PostgreSQL lanes are `pnpm test:postgres` here (ledgers alone) and in smrt-messages (both packages loaded)\n",
|
|
3180
3180
|
"recipes": [
|
|
3181
3181
|
{
|
|
3182
3182
|
"id": "ledgers.bookkeeping",
|
|
@@ -5,10 +5,10 @@ description: "Double-entry accounting ledger for the SMRT framework"
|
|
|
5
5
|
status: "stable"
|
|
6
6
|
generated:
|
|
7
7
|
by: "smrt/scripts/generate-knowledge-okf.ts"
|
|
8
|
-
at: "2026-11-
|
|
8
|
+
at: "2026-11-08T08:43:50Z"
|
|
9
9
|
audience: "internal"
|
|
10
10
|
evidence_level: "source-inspected"
|
|
11
|
-
source_revision: "sha256:
|
|
11
|
+
source_revision: "sha256:878d4b24e297a7d957516c553d8c729e6aa8496e63c5a45b21737fe57a18c8f2"
|
|
12
12
|
sources:
|
|
13
13
|
- id: "manifest"
|
|
14
14
|
resource: "https://github.com/happyvertical/smrt/blob/main/packages/ledgers/package.json"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-ledgers",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.15",
|
|
4
4
|
"description": "Double-entry accounting ledger for the SMRT framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@happyvertical/smrt-core": "0.60.
|
|
42
|
-
"@happyvertical/smrt-prompts": "0.60.
|
|
43
|
-
"@happyvertical/smrt-tenancy": "0.60.
|
|
41
|
+
"@happyvertical/smrt-core": "0.60.15",
|
|
42
|
+
"@happyvertical/smrt-prompts": "0.60.15",
|
|
43
|
+
"@happyvertical/smrt-tenancy": "0.60.15"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@happyvertical/smrt-vitest": "0.60.
|
|
46
|
+
"@happyvertical/smrt-vitest": "0.60.15",
|
|
47
47
|
"@types/node": "24.13.6",
|
|
48
48
|
"typescript": "6.0.3",
|
|
49
49
|
"vite": "8.1.6",
|