plasalid 0.8.2 → 0.9.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.
Files changed (64) hide show
  1. package/README.md +4 -0
  2. package/dist/ai/personas.js +29 -6
  3. package/dist/ai/prompt-sections.d.ts +10 -0
  4. package/dist/ai/prompt-sections.js +29 -0
  5. package/dist/ai/system-prompt.js +10 -6
  6. package/dist/ai/tools/clarify.js +35 -0
  7. package/dist/ai/tools/common.js +3 -2
  8. package/dist/ai/tools/index.js +6 -3
  9. package/dist/ai/tools/ingest.js +47 -35
  10. package/dist/ai/tools/mutate.d.ts +2 -0
  11. package/dist/ai/tools/mutate.js +81 -0
  12. package/dist/cli/commands/accounts.d.ts +1 -4
  13. package/dist/cli/commands/accounts.js +12 -101
  14. package/dist/cli/commands/files.d.ts +7 -0
  15. package/dist/cli/commands/files.js +24 -0
  16. package/dist/cli/commands/rules.d.ts +4 -12
  17. package/dist/cli/commands/rules.js +33 -67
  18. package/dist/cli/commands/scan.js +14 -12
  19. package/dist/cli/commands/status.js +5 -3
  20. package/dist/cli/commands/transactions.d.ts +0 -2
  21. package/dist/cli/commands/transactions.js +10 -63
  22. package/dist/cli/format.js +22 -32
  23. package/dist/cli/helper.d.ts +9 -1
  24. package/dist/cli/helper.js +17 -2
  25. package/dist/cli/index.js +37 -32
  26. package/dist/cli/ink/FilesBrowser.d.ts +7 -0
  27. package/dist/cli/ink/FilesBrowser.js +103 -0
  28. package/dist/cli/ink/ListBrowser.d.ts +16 -1
  29. package/dist/cli/ink/ListBrowser.js +36 -49
  30. package/dist/cli/ink/PromptFrame.js +1 -1
  31. package/dist/cli/ink/RulesBrowser.d.ts +7 -0
  32. package/dist/cli/ink/RulesBrowser.js +67 -0
  33. package/dist/cli/ink/ScanDashboard.js +90 -68
  34. package/dist/cli/ink/hooks/useFooterText.js +14 -22
  35. package/dist/cli/ink/keys.d.ts +2 -0
  36. package/dist/cli/ink/keys.js +19 -0
  37. package/dist/db/queries/files.d.ts +29 -0
  38. package/dist/db/queries/files.js +34 -0
  39. package/dist/db/queries/questions.d.ts +17 -0
  40. package/dist/db/queries/questions.js +47 -9
  41. package/dist/db/queries/rules.d.ts +31 -0
  42. package/dist/db/queries/rules.js +55 -0
  43. package/dist/db/queries/transactions.d.ts +34 -0
  44. package/dist/db/queries/transactions.js +86 -0
  45. package/dist/db/schema.js +17 -0
  46. package/dist/scanner/clarifier-memory.d.ts +15 -3
  47. package/dist/scanner/clarifier-memory.js +38 -17
  48. package/dist/scanner/clarifier.d.ts +2 -1
  49. package/dist/scanner/clarifier.js +40 -26
  50. package/dist/scanner/commit-pipeline.d.ts +56 -0
  51. package/dist/scanner/commit-pipeline.js +204 -0
  52. package/dist/scanner/committer.d.ts +56 -0
  53. package/dist/scanner/committer.js +204 -0
  54. package/dist/scanner/parse.js +27 -7
  55. package/dist/scanner/recurrence-pipeline.d.ts +28 -0
  56. package/dist/scanner/recurrence-pipeline.js +126 -0
  57. package/dist/scanner/recurrence.d.ts +28 -0
  58. package/dist/scanner/recurrence.js +155 -0
  59. package/dist/scanner/rule-keys.d.ts +13 -0
  60. package/dist/scanner/rule-keys.js +28 -0
  61. package/dist/scanner/rules.d.ts +13 -0
  62. package/dist/scanner/rules.js +28 -0
  63. package/dist/scanner/worker.js +4 -2
  64. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Canonical signatures used as the `key` half of `rules` rows. Derived
3
+ * from the structural context of a question (merchant id, raw descriptor,
4
+ * account pair) — never from prompt prose, because prose embeds volatile
5
+ * data like dates and amounts that would prevent the rule from matching the
6
+ * next time the same pattern appears.
7
+ */
8
+ const NON_WORD = /[^\p{L}\p{N}]+/gu;
9
+ export function normalizeDescriptor(raw) {
10
+ return raw
11
+ .toLowerCase()
12
+ .replace(NON_WORD, " ")
13
+ .replace(/\s+/g, " ")
14
+ .trim();
15
+ }
16
+ export function merchantKey(merchantId) {
17
+ return `merchant:${merchantId}`;
18
+ }
19
+ export function descriptorKey(descriptor) {
20
+ return `descriptor:${normalizeDescriptor(descriptor)}`;
21
+ }
22
+ export function accountPairKey(a, b) {
23
+ const [lo, hi] = [a, b].sort();
24
+ return `account-pair:${lo}|${hi}`;
25
+ }
26
+ export function accountIdKey(id) {
27
+ return `account:${id}`;
28
+ }
@@ -43,8 +43,10 @@ export async function runScanWorker(deps, hooks) {
43
43
  }));
44
44
  hooks.onWorkerEnd?.(workerId, deps.chunk, outcome.ok);
45
45
  if (!outcome.ok) {
46
- // A worker whose in-flight call was cancelled by Ctrl+C is not a real
47
- // failure don't pollute the questions table with chunk_failed rows.
46
+ /**
47
+ * A worker whose in-flight call was cancelled by Ctrl+C is not a real
48
+ * failure — don't pollute the questions table with chunk_failed rows.
49
+ */
48
50
  if (deps.signal.aborted)
49
51
  return;
50
52
  recordChunkFailure(deps, outcome.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plasalid",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "Plasalid — The Harness Layer for Personal Finance",
5
5
  "keywords": [
6
6
  "finance",