@rfc0/patty 0.0.0-stage → 1.0.2

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 (465) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +214 -2
  3. package/dist/adapters/access-tokens.js +7 -0
  4. package/dist/adapters/accounts.js +37 -0
  5. package/dist/adapters/auth.js +11 -0
  6. package/dist/adapters/bills.js +32 -0
  7. package/dist/adapters/budgets.js +29 -0
  8. package/dist/adapters/categories.js +32 -0
  9. package/dist/adapters/client-grants.js +7 -0
  10. package/dist/adapters/credit-cards.js +33 -0
  11. package/dist/adapters/currencies.js +2 -0
  12. package/dist/adapters/currency-rates.js +18 -0
  13. package/dist/adapters/dashboards.js +43 -0
  14. package/dist/adapters/demo.js +13 -0
  15. package/dist/adapters/instance-settings.js +7 -0
  16. package/dist/adapters/invites.js +7 -0
  17. package/dist/adapters/recurring.js +55 -0
  18. package/dist/adapters/sessions.js +7 -0
  19. package/dist/adapters/settings.js +4 -0
  20. package/dist/adapters/setup-codes.js +7 -0
  21. package/dist/adapters/tags.js +9 -0
  22. package/dist/adapters/transactions.js +95 -0
  23. package/dist/adapters/users.js +7 -0
  24. package/dist/common/build-version.js +5 -0
  25. package/dist/common/errors.js +118 -0
  26. package/dist/common/net.js +71 -0
  27. package/dist/common/result.js +7 -0
  28. package/dist/composition/auth.js +106 -0
  29. package/dist/composition/boot.js +27 -0
  30. package/dist/composition/cli.js +86 -0
  31. package/dist/composition/demo/seed.js +92 -0
  32. package/dist/composition/demo/shell.js +107 -0
  33. package/dist/composition/export.js +89 -0
  34. package/dist/composition/http.js +110 -0
  35. package/dist/composition/import.js +55 -0
  36. package/dist/composition/lazy-modules.js +2 -0
  37. package/dist/composition/runtime.js +115 -0
  38. package/dist/composition/sign-in/interpreter.js +154 -0
  39. package/dist/composition/sign-in/server.js +36 -0
  40. package/dist/composition/sign-in/wiring.js +23 -0
  41. package/dist/composition/stdio.js +69 -0
  42. package/dist/config.js +136 -0
  43. package/dist/controllers/account/account.js +88 -0
  44. package/dist/controllers/account/transaction.js +119 -0
  45. package/dist/controllers/account/transfer.js +34 -0
  46. package/dist/controllers/aggregate.js +40 -0
  47. package/dist/controllers/auth/access-tokens.js +61 -0
  48. package/dist/controllers/auth/grants.js +136 -0
  49. package/dist/controllers/auth/key-export.js +20 -0
  50. package/dist/controllers/auth/owner.js +80 -0
  51. package/dist/controllers/auth/password.js +35 -0
  52. package/dist/controllers/auth/session.js +50 -0
  53. package/dist/controllers/auth/step-up.js +8 -0
  54. package/dist/controllers/auth/users.js +183 -0
  55. package/dist/controllers/budgets.js +87 -0
  56. package/dist/controllers/categories.js +67 -0
  57. package/dist/controllers/correlations.js +112 -0
  58. package/dist/controllers/credit-card/bill.js +105 -0
  59. package/dist/controllers/credit-card/credit-card.js +129 -0
  60. package/dist/controllers/credit-card/transaction.js +181 -0
  61. package/dist/controllers/currencies.js +1 -0
  62. package/dist/controllers/currency-rates.js +40 -0
  63. package/dist/controllers/dashboards.js +68 -0
  64. package/dist/controllers/demo/seed.js +31 -0
  65. package/dist/controllers/demo/tour.js +12 -0
  66. package/dist/controllers/deps.js +6 -0
  67. package/dist/controllers/instance.js +6 -0
  68. package/dist/controllers/merchants.js +12 -0
  69. package/dist/controllers/recurring.js +70 -0
  70. package/dist/controllers/resolve.js +37 -0
  71. package/dist/controllers/settings.js +47 -0
  72. package/dist/controllers/status.js +19 -0
  73. package/dist/controllers/summary.js +21 -0
  74. package/dist/controllers/tags.js +19 -0
  75. package/dist/controllers/transaction/bulk.js +6 -0
  76. package/dist/controllers/transaction/core.js +49 -0
  77. package/dist/controllers/transaction/read.js +28 -0
  78. package/dist/diplomat/auth/credentials.js +58 -0
  79. package/dist/diplomat/auth/sign-in-store.js +18 -0
  80. package/dist/diplomat/cli/commands/auth.js +100 -0
  81. package/dist/diplomat/cli/commands/db.js +72 -0
  82. package/dist/diplomat/cli/commands/demo.js +68 -0
  83. package/dist/diplomat/cli/commands/key.js +119 -0
  84. package/dist/diplomat/cli/commands/login.js +151 -0
  85. package/dist/diplomat/cli/commands/setup.js +132 -0
  86. package/dist/diplomat/cli/commands/users.js +123 -0
  87. package/dist/diplomat/cli/commands.js +61 -0
  88. package/dist/diplomat/cli/export-file.js +37 -0
  89. package/dist/diplomat/cli/import-file.js +44 -0
  90. package/dist/diplomat/cli/io.js +61 -0
  91. package/dist/diplomat/cli/key-export-approval.js +37 -0
  92. package/dist/diplomat/cli/messages.js +96 -0
  93. package/dist/diplomat/cli/prompt.js +74 -0
  94. package/dist/diplomat/cli/terminal.js +81 -0
  95. package/dist/diplomat/client-config/clients.js +150 -0
  96. package/dist/diplomat/client-config/merge.js +41 -0
  97. package/dist/diplomat/db/bootstrap.js +98 -0
  98. package/dist/diplomat/db/database-files.js +147 -0
  99. package/dist/diplomat/db/driver.js +167 -0
  100. package/dist/diplomat/db/effects.js +101 -0
  101. package/dist/diplomat/db/engine.js +9 -0
  102. package/dist/diplomat/db/export.js +22 -0
  103. package/dist/diplomat/db/file-lock.js +82 -0
  104. package/dist/diplomat/db/key-lock.js +14 -0
  105. package/dist/diplomat/db/locale-cache.js +23 -0
  106. package/dist/diplomat/db/migration-barrier.js +57 -0
  107. package/dist/diplomat/db/migration-journal.js +18 -0
  108. package/dist/diplomat/db/migration-lock.js +15 -0
  109. package/dist/diplomat/db/migrations.js +11 -0
  110. package/dist/diplomat/db/present.js +17 -0
  111. package/dist/diplomat/db/queries/aggregate-whitelist.js +35 -0
  112. package/dist/diplomat/db/queries/filters.js +59 -0
  113. package/dist/diplomat/db/queries/fts.js +18 -0
  114. package/dist/diplomat/db/queries/scope.js +8 -0
  115. package/dist/diplomat/db/queries/transaction-select.js +26 -0
  116. package/dist/diplomat/db/queries/tx-predicates.js +13 -0
  117. package/dist/diplomat/db/repos/access-tokens.js +27 -0
  118. package/dist/diplomat/db/repos/accounts.js +91 -0
  119. package/dist/diplomat/db/repos/bills.js +93 -0
  120. package/dist/diplomat/db/repos/budgets.js +72 -0
  121. package/dist/diplomat/db/repos/categories.js +53 -0
  122. package/dist/diplomat/db/repos/client-grants.js +67 -0
  123. package/dist/diplomat/db/repos/correlations.js +66 -0
  124. package/dist/diplomat/db/repos/credit-cards.js +67 -0
  125. package/dist/diplomat/db/repos/currencies.js +8 -0
  126. package/dist/diplomat/db/repos/currency-rates.js +40 -0
  127. package/dist/diplomat/db/repos/dashboards.js +123 -0
  128. package/dist/diplomat/db/repos/health.js +12 -0
  129. package/dist/diplomat/db/repos/instance-settings.js +14 -0
  130. package/dist/diplomat/db/repos/instance.js +58 -0
  131. package/dist/diplomat/db/repos/invites.js +43 -0
  132. package/dist/diplomat/db/repos/merchants.js +121 -0
  133. package/dist/diplomat/db/repos/recurring.js +29 -0
  134. package/dist/diplomat/db/repos/sessions.js +19 -0
  135. package/dist/diplomat/db/repos/settings.js +41 -0
  136. package/dist/diplomat/db/repos/setup-codes.js +28 -0
  137. package/dist/diplomat/db/repos/sub-categories.js +67 -0
  138. package/dist/diplomat/db/repos/tags.js +51 -0
  139. package/dist/diplomat/db/repos/transaction-tags.js +57 -0
  140. package/dist/diplomat/db/repos/transactions.js +163 -0
  141. package/dist/diplomat/db/repos/users.js +47 -0
  142. package/dist/diplomat/db/safety-copy.js +87 -0
  143. package/dist/diplomat/db/schema.js +348 -0
  144. package/dist/diplomat/db/seed/categories.js +112 -0
  145. package/dist/diplomat/db/seed/currencies.js +9 -0
  146. package/dist/diplomat/db/seed/demo/br.js +98 -0
  147. package/dist/diplomat/db/seed/demo/co.js +89 -0
  148. package/dist/diplomat/db/seed/demo/index.js +12 -0
  149. package/dist/diplomat/db/seed/demo/mx.js +90 -0
  150. package/dist/diplomat/db/seed/demo/shared.js +39 -0
  151. package/dist/diplomat/db/seed/demo/us.js +90 -0
  152. package/dist/diplomat/db/seed/merchant-rules.js +188 -0
  153. package/dist/diplomat/db/sqlite-errors.js +40 -0
  154. package/dist/diplomat/db/tenancy-integrity.js +45 -0
  155. package/dist/diplomat/db/version-guard.js +16 -0
  156. package/dist/diplomat/http/auth-pages.js +41 -0
  157. package/dist/diplomat/http/auth-paths.js +46 -0
  158. package/dist/diplomat/http/bearer.js +15 -0
  159. package/dist/diplomat/http/connect-pages.js +51 -0
  160. package/dist/diplomat/http/context.js +17 -0
  161. package/dist/diplomat/http/cookies.js +27 -0
  162. package/dist/diplomat/http/form-pages.js +38 -0
  163. package/dist/diplomat/http/hooks/auth.js +106 -0
  164. package/dist/diplomat/http/hooks/demo-marker.js +59 -0
  165. package/dist/diplomat/http/openapi.js +73 -0
  166. package/dist/diplomat/http/principal.js +1 -0
  167. package/dist/diplomat/http/rate-limiter.js +78 -0
  168. package/dist/diplomat/http/remedy.js +26 -0
  169. package/dist/diplomat/http/respond.js +50 -0
  170. package/dist/diplomat/http/routes/account.js +226 -0
  171. package/dist/diplomat/http/routes/aggregate.js +28 -0
  172. package/dist/diplomat/http/routes/auth.js +105 -0
  173. package/dist/diplomat/http/routes/budget.js +34 -0
  174. package/dist/diplomat/http/routes/category.js +109 -0
  175. package/dist/diplomat/http/routes/connect.js +124 -0
  176. package/dist/diplomat/http/routes/credit-card.js +263 -0
  177. package/dist/diplomat/http/routes/currency-rates.js +60 -0
  178. package/dist/diplomat/http/routes/currency.js +16 -0
  179. package/dist/diplomat/http/routes/dashboard.js +93 -0
  180. package/dist/diplomat/http/routes/invite.js +63 -0
  181. package/dist/diplomat/http/routes/recurring.js +65 -0
  182. package/dist/diplomat/http/routes/settings.js +38 -0
  183. package/dist/diplomat/http/routes/summary.js +23 -0
  184. package/dist/diplomat/http/routes/system.js +29 -0
  185. package/dist/diplomat/http/routes/tag.js +51 -0
  186. package/dist/diplomat/http/routes/tokens.js +72 -0
  187. package/dist/diplomat/http/routes/transaction.js +55 -0
  188. package/dist/diplomat/http/routes/transfer.js +35 -0
  189. package/dist/diplomat/http/routes/ui.js +110 -0
  190. package/dist/diplomat/http/routes/users.js +156 -0
  191. package/dist/diplomat/http/routes/well-known.js +26 -0
  192. package/dist/diplomat/http/routes.js +85 -0
  193. package/dist/diplomat/http/session.js +34 -0
  194. package/dist/diplomat/http/token-pages.js +75 -0
  195. package/dist/diplomat/http/ui-files.js +21 -0
  196. package/dist/diplomat/http/user-pages.js +93 -0
  197. package/dist/diplomat/mcp/annotations.js +8 -0
  198. package/dist/diplomat/mcp/auth-info.js +20 -0
  199. package/dist/diplomat/mcp/context.js +14 -0
  200. package/dist/diplomat/mcp/definition.js +3 -0
  201. package/dist/diplomat/mcp/gate.js +15 -0
  202. package/dist/diplomat/mcp/instructions.js +19 -0
  203. package/dist/diplomat/mcp/prompts.js +125 -0
  204. package/dist/diplomat/mcp/register.js +12 -0
  205. package/dist/diplomat/mcp/remedy.js +17 -0
  206. package/dist/diplomat/mcp/resources.js +93 -0
  207. package/dist/diplomat/mcp/respond.js +20 -0
  208. package/dist/diplomat/mcp/route.js +62 -0
  209. package/dist/diplomat/mcp/scopes.js +53 -0
  210. package/dist/diplomat/mcp/server.js +26 -0
  211. package/dist/diplomat/mcp/shared.js +5 -0
  212. package/dist/diplomat/mcp/stdio-session.js +94 -0
  213. package/dist/diplomat/mcp/stdio.js +23 -0
  214. package/dist/diplomat/mcp/tool-name.js +59 -0
  215. package/dist/diplomat/mcp/tools/account.js +218 -0
  216. package/dist/diplomat/mcp/tools/aggregate.js +32 -0
  217. package/dist/diplomat/mcp/tools/budget.js +99 -0
  218. package/dist/diplomat/mcp/tools/category.js +103 -0
  219. package/dist/diplomat/mcp/tools/correlations.js +70 -0
  220. package/dist/diplomat/mcp/tools/credit-card.js +239 -0
  221. package/dist/diplomat/mcp/tools/currency-rates.js +62 -0
  222. package/dist/diplomat/mcp/tools/dashboard.js +75 -0
  223. package/dist/diplomat/mcp/tools/index.js +31 -0
  224. package/dist/diplomat/mcp/tools/recurring.js +62 -0
  225. package/dist/diplomat/mcp/tools/summary.js +30 -0
  226. package/dist/diplomat/mcp/tools/system.js +83 -0
  227. package/dist/diplomat/mcp/tools/tag.js +48 -0
  228. package/dist/diplomat/mcp/tools/transaction.js +53 -0
  229. package/dist/diplomat/mcp/tools/transfer.js +28 -0
  230. package/dist/diplomat/mcp/tour.js +87 -0
  231. package/dist/logic/account.js +79 -0
  232. package/dist/logic/aggregate.js +37 -0
  233. package/dist/logic/auth/bearer.js +35 -0
  234. package/dist/logic/auth/grant.js +126 -0
  235. package/dist/logic/auth/key-export.js +10 -0
  236. package/dist/logic/auth/keychain.js +3 -0
  237. package/dist/logic/auth/message.js +22 -0
  238. package/dist/logic/auth/origin.js +57 -0
  239. package/dist/logic/auth/owner.js +22 -0
  240. package/dist/logic/auth/password.js +3 -0
  241. package/dist/logic/auth/redact.js +25 -0
  242. package/dist/logic/auth/revoke.js +28 -0
  243. package/dist/logic/auth/scope.js +17 -0
  244. package/dist/logic/auth/session.js +30 -0
  245. package/dist/logic/auth/sign-in-flow.js +305 -0
  246. package/dist/logic/auth/time.js +2 -0
  247. package/dist/logic/auth/token.js +74 -0
  248. package/dist/logic/auth/user-plans.js +84 -0
  249. package/dist/logic/auth/users.js +78 -0
  250. package/dist/logic/balance.js +2 -0
  251. package/dist/logic/bill.js +74 -0
  252. package/dist/logic/budget.js +78 -0
  253. package/dist/logic/category.js +37 -0
  254. package/dist/logic/classify.js +21 -0
  255. package/dist/logic/correlations.js +147 -0
  256. package/dist/logic/credit-card.js +2 -0
  257. package/dist/logic/currency-rate.js +69 -0
  258. package/dist/logic/dashboard.js +40 -0
  259. package/dist/logic/demo/database.js +30 -0
  260. package/dist/logic/demo/plan.js +308 -0
  261. package/dist/logic/demo/tour.js +33 -0
  262. package/dist/logic/export-destination.js +12 -0
  263. package/dist/logic/key-import.js +15 -0
  264. package/dist/logic/locale.js +5 -0
  265. package/dist/logic/localize.js +12 -0
  266. package/dist/logic/merchant.js +31 -0
  267. package/dist/logic/migration.js +1 -0
  268. package/dist/logic/money.js +12 -0
  269. package/dist/logic/period.js +45 -0
  270. package/dist/logic/persistence.js +48 -0
  271. package/dist/logic/recurring.js +51 -0
  272. package/dist/logic/resolve.js +44 -0
  273. package/dist/logic/summary.js +29 -0
  274. package/dist/logic/tag.js +13 -0
  275. package/dist/logic/transaction.js +197 -0
  276. package/dist/main.js +42 -0
  277. package/dist/models/account.js +197 -0
  278. package/dist/models/aggregate.js +61 -0
  279. package/dist/models/auth/bearer.js +11 -0
  280. package/dist/models/auth/entity.js +17 -0
  281. package/dist/models/auth/errors.js +42 -0
  282. package/dist/models/auth/grant.js +58 -0
  283. package/dist/models/auth/key-export.js +11 -0
  284. package/dist/models/auth/message.js +50 -0
  285. package/dist/models/auth/mode.js +7 -0
  286. package/dist/models/auth/origin.js +16 -0
  287. package/dist/models/auth/owner.js +36 -0
  288. package/dist/models/auth/password.js +24 -0
  289. package/dist/models/auth/principal.js +26 -0
  290. package/dist/models/auth/redact.js +4 -0
  291. package/dist/models/auth/scope.js +9 -0
  292. package/dist/models/auth/session.js +19 -0
  293. package/dist/models/auth/sign-in-flow.js +102 -0
  294. package/dist/models/auth/sign-in.js +41 -0
  295. package/dist/models/auth/time.js +5 -0
  296. package/dist/models/auth/token.js +50 -0
  297. package/dist/models/auth/users.js +52 -0
  298. package/dist/models/bill.js +55 -0
  299. package/dist/models/budget.js +106 -0
  300. package/dist/models/category.js +52 -0
  301. package/dist/models/client-config.js +18 -0
  302. package/dist/models/correlations.js +215 -0
  303. package/dist/models/credit-card.js +156 -0
  304. package/dist/models/currency-rate.js +83 -0
  305. package/dist/models/dashboard.js +54 -0
  306. package/dist/models/database.js +16 -0
  307. package/dist/models/date.js +8 -0
  308. package/dist/models/demo/core.js +58 -0
  309. package/dist/models/demo/tour.js +41 -0
  310. package/dist/models/encryption-key.js +2 -0
  311. package/dist/models/error.js +13 -0
  312. package/dist/models/export.js +9 -0
  313. package/dist/models/id.js +2 -0
  314. package/dist/models/instance.js +7 -0
  315. package/dist/models/key-import.js +6 -0
  316. package/dist/models/locale.js +25 -0
  317. package/dist/models/merchant.js +12 -0
  318. package/dist/models/money.js +14 -0
  319. package/dist/models/package.js +12 -0
  320. package/dist/models/page.js +56 -0
  321. package/dist/models/persistence.js +1 -0
  322. package/dist/models/prompts.js +5 -0
  323. package/dist/models/recurring.js +54 -0
  324. package/dist/models/remedy.js +17 -0
  325. package/dist/models/resolution.js +1 -0
  326. package/dist/models/startup.js +7 -0
  327. package/dist/models/summary.js +24 -0
  328. package/dist/models/tag.js +14 -0
  329. package/dist/models/tenancy.js +10 -0
  330. package/dist/models/transaction-tag.js +6 -0
  331. package/dist/models/transaction.js +275 -0
  332. package/dist/wire/db/access-tokens.js +1 -0
  333. package/dist/wire/db/accounts.js +7 -0
  334. package/dist/wire/db/aggregate.js +16 -0
  335. package/dist/wire/db/bills.js +14 -0
  336. package/dist/wire/db/budgets.js +33 -0
  337. package/dist/wire/db/categories.js +14 -0
  338. package/dist/wire/db/client-grants.js +1 -0
  339. package/dist/wire/db/correlations.js +49 -0
  340. package/dist/wire/db/credit-cards.js +1 -0
  341. package/dist/wire/db/currencies.js +1 -0
  342. package/dist/wire/db/currency-rates.js +1 -0
  343. package/dist/wire/db/dashboards.js +1 -0
  344. package/dist/wire/db/instance-settings.js +1 -0
  345. package/dist/wire/db/invites.js +1 -0
  346. package/dist/wire/db/merchants.js +18 -0
  347. package/dist/wire/db/recurring.js +19 -0
  348. package/dist/wire/db/sessions.js +1 -0
  349. package/dist/wire/db/settings.js +1 -0
  350. package/dist/wire/db/setup-codes.js +1 -0
  351. package/dist/wire/db/tags.js +1 -0
  352. package/dist/wire/db/tenancy.js +1 -0
  353. package/dist/wire/db/transactions.js +89 -0
  354. package/dist/wire/db/users.js +1 -0
  355. package/dist/wire/in/accounts.js +26 -0
  356. package/dist/wire/in/aggregate.js +10 -0
  357. package/dist/wire/in/auth.js +107 -0
  358. package/dist/wire/in/bills.js +11 -0
  359. package/dist/wire/in/budgets.js +11 -0
  360. package/dist/wire/in/categories.js +9 -0
  361. package/dist/wire/in/cli.js +106 -0
  362. package/dist/wire/in/coerce.js +6 -0
  363. package/dist/wire/in/common.js +17 -0
  364. package/dist/wire/in/credit-cards.js +16 -0
  365. package/dist/wire/in/currency-rates.js +8 -0
  366. package/dist/wire/in/period.js +7 -0
  367. package/dist/wire/in/recurring.js +6 -0
  368. package/dist/wire/in/settings.js +5 -0
  369. package/dist/wire/in/summary.js +5 -0
  370. package/dist/wire/in/tags.js +2 -0
  371. package/dist/wire/in/transactions.js +31 -0
  372. package/dist/wire/out/bills.js +9 -0
  373. package/dist/wire/out/budgets.js +10 -0
  374. package/dist/wire/out/client-config.js +2 -0
  375. package/dist/wire/out/common.js +4 -0
  376. package/dist/wire/out/credit-cards.js +15 -0
  377. package/dist/wire/out/currency-rates.js +11 -0
  378. package/dist/wire/out/errors.js +58 -0
  379. package/dist/wire/out/recurring.js +6 -0
  380. package/dist/wire/out/status.js +10 -0
  381. package/dist/wire/out/summary.js +9 -0
  382. package/dist/wire/out/transactions.js +52 -0
  383. package/drizzle/0000_futuristic_umar.sql +124 -0
  384. package/drizzle/0001_fts5_search.sql +23 -0
  385. package/drizzle/0002_rename_graph_to_history.sql +7 -0
  386. package/drizzle/0003_lyrical_hairball.sql +2 -0
  387. package/drizzle/0004_misty_ikaris.sql +7 -0
  388. package/drizzle/0005_credit-liability-accounts.sql +14 -0
  389. package/drizzle/0006_smart_aqueduct.sql +1 -0
  390. package/drizzle/0007_add_dashboards.sql +5 -0
  391. package/drizzle/0008_yummy_madripoor.sql +1 -0
  392. package/drizzle/0009_version_groundwork.sql +9 -0
  393. package/drizzle/0010_category_merchant_association_cascade.sql +16 -0
  394. package/drizzle/0011_dashboard_id_normalization.sql +16 -0
  395. package/drizzle/0012_hot_the_spike.sql +12 -0
  396. package/drizzle/0013_recurring_rules_merchant.sql +1 -0
  397. package/drizzle/0014_dashboard_source_discriminator.sql +17 -0
  398. package/drizzle/0015_currencies_decimals.sql +1 -0
  399. package/drizzle/0016_unusual_zaran.sql +13 -0
  400. package/drizzle/0017_premium_blur.sql +1 -0
  401. package/drizzle/0018_auth_identity.sql +39 -0
  402. package/drizzle/0019_access_tokens.sql +16 -0
  403. package/drizzle/0020_stdio_sign_in.sql +27 -0
  404. package/drizzle/0021_tenancy_data.sql +289 -0
  405. package/drizzle/0022_user_management.sql +17 -0
  406. package/drizzle/0023_instance_settings_row.sql +2 -0
  407. package/drizzle/0024_credentials_changed_at.sql +2 -0
  408. package/drizzle/0025_instance_kind.sql +2 -0
  409. package/drizzle/0026_demo_seeded_at.sql +2 -0
  410. package/drizzle/0027_demo_country.sql +2 -0
  411. package/drizzle/0028_reset_sign_ins.sql +2 -0
  412. package/drizzle/meta/0000_snapshot.json +894 -0
  413. package/drizzle/meta/0003_snapshot.json +910 -0
  414. package/drizzle/meta/0004_snapshot.json +951 -0
  415. package/drizzle/meta/0005_snapshot.json +991 -0
  416. package/drizzle/meta/0006_snapshot.json +998 -0
  417. package/drizzle/meta/0007_snapshot.json +1029 -0
  418. package/drizzle/meta/0008_snapshot.json +1049 -0
  419. package/drizzle/meta/0009_snapshot.json +1121 -0
  420. package/drizzle/meta/0010_snapshot.json +1121 -0
  421. package/drizzle/meta/0011_snapshot.json +1136 -0
  422. package/drizzle/meta/0012_snapshot.json +1227 -0
  423. package/drizzle/meta/0013_snapshot.json +1247 -0
  424. package/drizzle/meta/0014_snapshot.json +1267 -0
  425. package/drizzle/meta/0015_snapshot.json +1275 -0
  426. package/drizzle/meta/0016_snapshot.json +1371 -0
  427. package/drizzle/meta/0017_snapshot.json +1392 -0
  428. package/drizzle/meta/0018_snapshot.json +1603 -0
  429. package/drizzle/meta/0019_snapshot.json +1713 -0
  430. package/drizzle/meta/0020_snapshot.json +1904 -0
  431. package/drizzle/meta/0021_snapshot.json +2186 -0
  432. package/drizzle/meta/0022_snapshot.json +2311 -0
  433. package/drizzle/meta/0023_snapshot.json +2311 -0
  434. package/drizzle/meta/0024_snapshot.json +2318 -0
  435. package/drizzle/meta/0025_snapshot.json +2326 -0
  436. package/drizzle/meta/0026_snapshot.json +2333 -0
  437. package/drizzle/meta/0027_snapshot.json +2340 -0
  438. package/drizzle/meta/0028_snapshot.json +2340 -0
  439. package/drizzle/meta/_journal.json +209 -0
  440. package/package.json +106 -4
  441. package/skills/dashboard-building/SKILL.md +201 -0
  442. package/skills/patty-tour/SKILL.md +34 -0
  443. package/ui/app.css +758 -0
  444. package/ui/app.js +543 -0
  445. package/ui/connect-result.html +16 -0
  446. package/ui/connect.html +53 -0
  447. package/ui/dashboards/accounts.html +3189 -0
  448. package/ui/dashboards/budget.html +1734 -0
  449. package/ui/dashboards/cards.html +4032 -0
  450. package/ui/dashboards/categories.html +4694 -0
  451. package/ui/dashboards/comparative.html +2475 -0
  452. package/ui/dashboards/dashboards.html +839 -0
  453. package/ui/dashboards/overview.html +2405 -0
  454. package/ui/dashboards/pending.html +2973 -0
  455. package/ui/dashboards/projections.html +2528 -0
  456. package/ui/dashboards/tags.html +1365 -0
  457. package/ui/invite.html +44 -0
  458. package/ui/login.html +26 -0
  459. package/ui/money.js +175 -0
  460. package/ui/setup.html +29 -0
  461. package/ui/shell.html +96 -0
  462. package/ui/token-created.html +24 -0
  463. package/ui/tokens.html +58 -0
  464. package/ui/user-invited.html +27 -0
  465. package/ui/users.html +60 -0
package/ui/invite.html ADDED
@@ -0,0 +1,44 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — accept invite</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card">
11
+ <h1>Accept your invite</h1>
12
+ <p class="auth-lede">Enter the invite code you were given and choose a password. Your username is already set.</p>
13
+ {{error}}
14
+ <form class="auth-form" method="post" action="{{action}}">
15
+ <label
16
+ >Invite code
17
+ <input
18
+ name="code"
19
+ value="{{code}}"
20
+ autocomplete="off"
21
+ autocapitalize="characters"
22
+ spellcheck="false"
23
+ required
24
+ />
25
+ </label>
26
+ <label
27
+ >Password
28
+ <input
29
+ name="password"
30
+ type="password"
31
+ autocomplete="new-password"
32
+ minlength="{{passwordMinLength}}"
33
+ required
34
+ autofocus
35
+ />
36
+ </label>
37
+ <p class="auth-hint">
38
+ At least {{passwordMinLength}} characters. There are no other rules — a long passphrase is best.
39
+ </p>
40
+ <button type="submit">Create login</button>
41
+ </form>
42
+ </main>
43
+ </body>
44
+ </html>
package/ui/login.html ADDED
@@ -0,0 +1,26 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — log in</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card">
11
+ <h1>PATTY</h1>
12
+ <p class="auth-lede">Log in to continue.</p>
13
+ {{error}}
14
+ <form class="auth-form" method="post" action="{{action}}">
15
+ <input type="hidden" name="next" value="{{next}}" />
16
+ <label>Username
17
+ <input name="username" autocomplete="username" autocapitalize="none" spellcheck="false" required autofocus />
18
+ </label>
19
+ <label>Password
20
+ <input name="password" type="password" autocomplete="current-password" required />
21
+ </label>
22
+ <button type="submit">Log in</button>
23
+ </form>
24
+ </main>
25
+ </body>
26
+ </html>
package/ui/money.js ADDED
@@ -0,0 +1,175 @@
1
+ // Crypto-aware money formatter (ADR-026 Phase 1). A non-ISO code isn't reliably a throw: per
2
+ // ECMA-402, Intl.NumberFormat's currency style only rejects a syntactically-malformed code (not
3
+ // exactly 3 letters, e.g. 'USDC') — a syntactically-valid-but-unrecognized 3-letter code like 'BTC'
4
+ // silently formats with a fiat-shaped 2 decimals and no real symbol instead of throwing, which
5
+ // would flatten BTC's precision exactly like the gotcha this file exists to avoid. So the ISO check
6
+ // below is explicit (Intl.supportedValuesOf('currency')) rather than try/catch — a currency missing
7
+ // from that list falls back to its own symbol + decimals from /api/currencies metadata (cached on
8
+ // window.__appCurrencies, populated once at shell boot — see app.js).
9
+ (function () {
10
+ 'use strict';
11
+
12
+ // Last-resort DEFAULT_CURRENCY, used only until (or unless) the shell resolves the user's base
13
+ // currency from /api/preferences (ui/app.js sets window.DEFAULT_CURRENCY and BASE_CURRENCY).
14
+ var BRL = 'BRL';
15
+
16
+ var isoCurrencyCache = null;
17
+
18
+ function isIsoCurrency(code) {
19
+ if (typeof Intl.supportedValuesOf !== 'function') {
20
+ // Pre-Enumeration-API engine (no modern evergreen browser lacks this) — best-effort via
21
+ // throw/no-throw: correct for a malformed code like USDC, silently wrong precision for a
22
+ // well-formed-but-unrecognized 3-letter code like BTC until the engine is updated.
23
+ try {
24
+ // Constructed only to probe for a thrown RangeError.
25
+ new Intl.NumberFormat(undefined, { style: 'currency', currency: code });
26
+ return true;
27
+ } catch {
28
+ return false;
29
+ }
30
+ }
31
+ if (!isoCurrencyCache) isoCurrencyCache = Intl.supportedValuesOf('currency');
32
+ return isoCurrencyCache.indexOf(code) !== -1;
33
+ }
34
+
35
+ function metaFor(code) {
36
+ var meta = window.__appCurrencies;
37
+ return (meta && meta[code]) || null;
38
+ }
39
+
40
+ // Each peso formats in its own market's style (BRL pt-BR, MXN es-MX, COP es-CO); everything
41
+ // else defaults to en-US unless a call site passes an explicit locale (e.g. budget.html's
42
+ // app-locale-driven formatCurrency). The one literal per code lives here.
43
+ var DEFAULT_LOCALE = 'en-US';
44
+ var LOCALE_BY_CURRENCY = {
45
+ BRL: 'pt-BR',
46
+ MXN: 'es-MX',
47
+ COP: 'es-CO',
48
+ };
49
+
50
+ // Intl renders both pesos with a bare '$' in their own locale, indistinguishable from USD, so their
51
+ // currency part is swapped for the prefixed symbol (the same one the seed stores) while the locale's
52
+ // digit grouping stays. Keep in sync with diplomat/db/seed/currencies.ts (a unit test pins it).
53
+ var SYMBOL_BY_CURRENCY = {
54
+ MXN: 'MX$',
55
+ COP: 'COL$',
56
+ };
57
+
58
+ function formatIso(loc, code, amount) {
59
+ var formatter = new Intl.NumberFormat(loc, { style: 'currency', currency: code });
60
+ var symbol = SYMBOL_BY_CURRENCY[code];
61
+ if (!symbol) return formatter.format(amount);
62
+ return formatter
63
+ .formatToParts(amount)
64
+ .map(function (part) { return part.type === 'currency' ? symbol : part.value; })
65
+ .join('');
66
+ }
67
+
68
+ function defaultLocale(code) {
69
+ return LOCALE_BY_CURRENCY[code] || DEFAULT_LOCALE;
70
+ }
71
+
72
+ window.formatMoney = function (value, currencyCode, opts) {
73
+ opts = opts || {};
74
+ var amount = Number(value) || 0;
75
+ var loc = opts.locale || defaultLocale(currencyCode);
76
+ if (isIsoCurrency(currencyCode)) {
77
+ return formatIso(loc, currencyCode, amount);
78
+ }
79
+ var meta = metaFor(currencyCode);
80
+ var decimals = meta ? meta.decimals : 2;
81
+ var symbol = meta ? meta.symbol : currencyCode;
82
+ var numStr = new Intl.NumberFormat(loc, {
83
+ minimumFractionDigits: decimals,
84
+ maximumFractionDigits: decimals,
85
+ }).format(amount);
86
+ return symbol + ' ' + numStr;
87
+ };
88
+
89
+ // Currency-map arithmetic shared across dashboard fragments (issue #174) — every fragment that
90
+ // aggregates transactions keeps its own accumulator as a {currency: amount} map instead of a
91
+ // single blended scalar (docs/architecture.md: aggregations group per currency, never convert
92
+ // implicitly). These are locale-independent map operations (addMultiCurrency intentionally
93
+ // mutates its `map` argument in place — an accumulator, not a pure function — the rest don't
94
+ // mutate their inputs), so they live here instead of being copy-pasted into every fragment; each
95
+ // fragment still owns its own thin formatCurrency/formatMultiCurrency wrapper locally because
96
+ // those need the fragment's own resolved UI locale (e.g. budget.html's currentLocale), which this
97
+ // shell-loaded, load-once module has no access to.
98
+ window.DEFAULT_CURRENCY = BRL;
99
+
100
+ // Called by the shell once /api/preferences and the currency metadata are in: the user's base
101
+ // currency becomes the default, but only when it is a currency the instance knows (an unknown or
102
+ // empty code leaves the last-resort default untouched).
103
+ window.setBaseCurrency = function (code) {
104
+ if (!code || !metaFor(code)) return;
105
+ window.BASE_CURRENCY = code;
106
+ window.DEFAULT_CURRENCY = code;
107
+ };
108
+
109
+ window.addMultiCurrency = function (map, currency, amount) {
110
+ var c = currency || window.DEFAULT_CURRENCY;
111
+ map[c] = (map[c] || 0) + (Number(amount) || 0);
112
+ };
113
+
114
+ window.valueIn = function (map, currency) {
115
+ return (map && map[currency]) || 0;
116
+ };
117
+
118
+ // Multi-currency amounts are never converted or summed together — a single number (a KPI, a
119
+ // percentage, a chart value) can only ever read ONE real currency's own amount, never a
120
+ // blended/converted total. This picks which currency represents a row/cell for such comparisons:
121
+ // the user's base currency when the map has it, even at zero (window.BASE_CURRENCY, set by the shell only when
122
+ // the user chose one), else the one with the most activity (non-zero, then largest amount), else
123
+ // the first key alphabetically. An empty map falls back to DEFAULT_CURRENCY.
124
+ window.primaryCurrencyOf = function (map) {
125
+ var all = Object.keys(map || {});
126
+ if (window.BASE_CURRENCY && all.indexOf(window.BASE_CURRENCY) !== -1) return window.BASE_CURRENCY;
127
+ var keys = all.filter(function (c) { return map[c]; });
128
+ if (keys.length === 0) keys = all;
129
+ keys.sort(function (a, b) {
130
+ var activity = (map[b] ? 1 : 0) - (map[a] ? 1 : 0);
131
+ if (activity !== 0) return activity;
132
+ var amount = Math.abs(Number(map[b]) || 0) - Math.abs(Number(map[a]) || 0);
133
+ return amount !== 0 ? amount : a.localeCompare(b);
134
+ });
135
+ return keys[0] || window.DEFAULT_CURRENCY;
136
+ };
137
+
138
+ // Row/category sort order or "any activity" flag only, never a number shown to the user — a
139
+ // plain sum of raw units across currencies (deliberately not a currency conversion).
140
+ window.magnitudeOf = function (map) {
141
+ return Object.keys(map || {}).reduce(function (sum, c) { return sum + (Number(map[c]) || 0); }, 0);
142
+ };
143
+
144
+ // Additively merges any number of currency maps — Object.assign/spread would silently overwrite
145
+ // a currency present in more than one map instead of summing it (e.g. a category with both BRL
146
+ // effective and BRL pending amounts would lose one of the two).
147
+ window.mergeCurrencyMaps = function () {
148
+ var maps = Array.prototype.slice.call(arguments);
149
+ var result = {};
150
+ maps.forEach(function (map) {
151
+ Object.keys(map || {}).forEach(function (c) { window.addMultiCurrency(result, c, map[c]); });
152
+ });
153
+ return result;
154
+ };
155
+
156
+ // Renders every currency in a map side by side — never a single blended number — via the
157
+ // caller-supplied formatFn (each fragment passes its own locale-aware formatCurrency, which this
158
+ // shell-loaded, load-once module has no access to itself). A currency is skipped only when a
159
+ // real (non-zero) currency is ALSO present in the map: an all-zero map (e.g. a USD-only month
160
+ // whose income and expense net to exactly zero) still names its real currencies rather than
161
+ // falling through to the DEFAULT_CURRENCY zero fallback, which would silently relabel that USD
162
+ // zero as BRL — only a genuinely empty map (no keys at all) uses the DEFAULT_CURRENCY fallback.
163
+ window.formatMultiCurrencyWith = function (map, formatFn, delimiter) {
164
+ delimiter = delimiter || ' / ';
165
+ if (!map || Object.keys(map).length === 0) return formatFn(0, window.DEFAULT_CURRENCY);
166
+ var keys = Object.keys(map).sort(function (a, b) {
167
+ if (a === window.DEFAULT_CURRENCY) return -1;
168
+ if (b === window.DEFAULT_CURRENCY) return 1;
169
+ return a.localeCompare(b);
170
+ });
171
+ var nonZeroKeys = keys.filter(function (c) { return map[c]; });
172
+ var keysToShow = nonZeroKeys.length > 0 ? nonZeroKeys : keys;
173
+ return keysToShow.map(function (c) { return formatFn(map[c], c); }).join(delimiter);
174
+ };
175
+ })();
package/ui/setup.html ADDED
@@ -0,0 +1,29 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — set up</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card">
11
+ <h1>Set up PATTY</h1>
12
+ <p class="auth-lede">Enter the one-time setup code from the PATTY log, then choose your login, {{terminalHint}}.</p>
13
+ {{error}}
14
+ <form class="auth-form" method="post" action="{{action}}">
15
+ <label>Setup code
16
+ <input name="code" autocomplete="off" autocapitalize="characters" spellcheck="false" required autofocus />
17
+ </label>
18
+ <label>Username
19
+ <input name="username" autocomplete="username" autocapitalize="none" spellcheck="false" required />
20
+ </label>
21
+ <label>Password
22
+ <input name="password" type="password" autocomplete="new-password" minlength="{{passwordMinLength}}" required />
23
+ </label>
24
+ <p class="auth-hint">At least {{passwordMinLength}} characters. There are no other rules — a long passphrase is best.</p>
25
+ <button type="submit">Create login</button>
26
+ </form>
27
+ </main>
28
+ </body>
29
+ </html>
package/ui/shell.html ADDED
@@ -0,0 +1,96 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY</title>
7
+ <!-- Google Fonts: the CSS2 API response is generated per requesting User-Agent (different
8
+ @font-face src formats/URLs for different browsers), so there is no single fixed response
9
+ body that an SRI hash could pin — hashing today's response would break the stylesheet for any
10
+ browser whose UA gets a different variant, and Google may rotate the response at any time
11
+ regardless. No SRI is applied here for that reason; this is the accepted, documented gap
12
+ (#165). Chart.js/Flatpickr/Font Awesome below serve one fixed file per version and are
13
+ pinned + SRI'd. -->
14
+ <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap" rel="stylesheet" referrerpolicy="no-referrer" />
15
+ <!-- FontAwesome Icons -->
16
+ <link
17
+ rel="stylesheet"
18
+ referrerpolicy="no-referrer"
19
+ crossorigin="anonymous"
20
+ integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
21
+ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
22
+ />
23
+ <!-- Flatpickr CSS -->
24
+ <link
25
+ rel="stylesheet"
26
+ referrerpolicy="no-referrer"
27
+ crossorigin="anonymous"
28
+ integrity="sha384-RkASv+6KfBMW9eknReJIJ6b3UnjKOKC5bOUaNgIY778NFbQ8MtWq9Lr/khUgqtTt"
29
+ href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.css"
30
+ />
31
+ <link
32
+ rel="stylesheet"
33
+ referrerpolicy="no-referrer"
34
+ crossorigin="anonymous"
35
+ integrity="sha384-heUUtXw0Djj2DElfLOVPlASSWFKNL3JDY6s3FEqQD03GYyWOeophY5DsfEG40sYX"
36
+ href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/themes/dark.css"
37
+ />
38
+ <!-- Custom layout CSS -->
39
+ <link rel="stylesheet" href="/ui/assets/app.css" />
40
+
41
+ <!-- Chart.js CDN -->
42
+ <script
43
+ defer
44
+ referrerpolicy="no-referrer"
45
+ crossorigin="anonymous"
46
+ integrity="sha384-NrKB+u6Ts6AtkIhwPixiKTzgSKNblyhlk0Sohlgar9UHUBzai/sgnNNWWd291xqt"
47
+ src="https://cdn.jsdelivr.net/npm/chart.js@4.4.4/dist/chart.umd.min.js"
48
+ ></script>
49
+ <!-- Flatpickr JS -->
50
+ <script
51
+ defer
52
+ referrerpolicy="no-referrer"
53
+ crossorigin="anonymous"
54
+ integrity="sha384-5JqMv4L/Xa0hfvtF06qboNdhvuYXUku9ZrhZh3bSk8VXF0A/RuSLHpLsSV9Zqhl6"
55
+ src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.js"
56
+ ></script>
57
+ <script
58
+ defer
59
+ referrerpolicy="no-referrer"
60
+ crossorigin="anonymous"
61
+ integrity="sha384-agbVpcY312cNMSL1b3CUo060bj9FmbwUX8HUCNSE17+jOU/en4yz3w9ro9IWVusF"
62
+ src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/l10n/pt.js"
63
+ ></script>
64
+ </head>
65
+ <body>
66
+ <!-- Left Navigation Sidebar -->
67
+ <aside class="sidebar">
68
+ <div class="sidebar-brand">
69
+ <i class="fa-solid fa-wallet" style="color: var(--accent-primary);"></i>
70
+ </div>
71
+ <nav class="sidebar-menu" id="dashboard-menu" aria-label="Dashboards">
72
+ <p class="state">Loading menu…</p>
73
+ </nav>
74
+
75
+ <!-- Bottom options menu -->
76
+ <div class="sidebar-more-container" id="more-container">
77
+ <button class="sidebar-more-btn" id="more-btn" aria-label="More options" aria-haspopup="true" aria-controls="more-dropdown" aria-expanded="false">
78
+ <i class="fa-solid fa-ellipsis"></i>
79
+ </button>
80
+ <div class="sidebar-more-dropdown" id="more-dropdown">
81
+ <!-- Dynamically populated or static dropdown links -->
82
+ </div>
83
+ </div>
84
+ <!--patty:auth-controls-->
85
+ </aside>
86
+
87
+ <!-- Main Content Shell -->
88
+ <main id="content" aria-live="polite">
89
+ <p class="state">Loading…</p>
90
+ </main>
91
+
92
+ <script defer src="/ui/assets/money.js"></script>
93
+ <script defer src="/ui/assets/app.js"></script>
94
+ </body>
95
+ </html>
96
+
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — token created</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card tokens-card">
11
+ <h1>Token created</h1>
12
+ <p class="auth-lede">“{{name}}” — {{access}}.</p>
13
+ <p class="auth-warning" role="alert">
14
+ Copy it now: you won't see this token again. PATTY keeps only a hash of it.
15
+ </p>
16
+ <p class="token-secret" data-testid="token-secret">{{token}}</p>
17
+ <p class="auth-hint">
18
+ Select the whole token (a triple-click does it), copy it, then send it as
19
+ <code>Authorization: Bearer &lt;token&gt;</code>. Lose it and you'll revoke it and create another.
20
+ </p>
21
+ <p><a href="{{tokensPath}}">Back to your tokens</a></p>
22
+ </main>
23
+ </body>
24
+ </html>
package/ui/tokens.html ADDED
@@ -0,0 +1,58 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — access tokens</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card tokens-card">
11
+ <h1>Access tokens</h1>
12
+ <p class="auth-lede">
13
+ Personal access tokens let scripts and MCP clients call <code>/api</code> and <code>/mcp</code> with
14
+ <code>Authorization: Bearer ptk_…</code>. {{usersLink}}<a href="{{dashboards}}">Back to the dashboards</a>
15
+ </p>
16
+ {{error}}
17
+ <h2>Claude sign-ins</h2>
18
+ <p class="auth-hint">
19
+ Each Claude session that signed in with the browser (<code>/ui/connect</code> or <code>patty login</code>).
20
+ Revoking one takes effect on that client's next call; they expire on their own.
21
+ </p>
22
+ {{signIns}}
23
+ <h2>Personal access tokens</h2>
24
+ {{tokens}}
25
+ <h2>Create a token</h2>
26
+ <form class="auth-form" method="post" action="{{action}}">
27
+ <label
28
+ >Name
29
+ <input
30
+ name="name"
31
+ maxlength="{{nameMaxLength}}"
32
+ autocomplete="off"
33
+ placeholder="Claude Desktop on my laptop"
34
+ required
35
+ />
36
+ </label>
37
+ <label
38
+ >Access
39
+ <select name="access">
40
+ {{accessOptions}}
41
+ </select>
42
+ </label>
43
+ <label
44
+ >Expires
45
+ <select name="expiry">
46
+ {{expiryOptions}}
47
+ </select>
48
+ </label>
49
+ <label
50
+ >Your password
51
+ <input name="password" type="password" autocomplete="current-password" required />
52
+ </label>
53
+ <p class="auth-hint">Asked again so that nothing running in a dashboard page can create a token on its own.</p>
54
+ <button type="submit">Create token</button>
55
+ </form>
56
+ </main>
57
+ </body>
58
+ </html>
@@ -0,0 +1,27 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — invite</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card tokens-card">
11
+ <h1>{{heading}}</h1>
12
+ <p class="auth-lede">“{{username}}” — {{role}}. {{consequence}}</p>
13
+ <p class="auth-warning" role="alert">
14
+ Hand this over now: you won't see it again. PATTY keeps only a hash of the code, and it stops working on
15
+ {{expiresAt}} or as soon as it is used.
16
+ </p>
17
+ {{link}}
18
+ <p>Code</p>
19
+ <p class="token-secret" data-testid="invite-code">{{code}}</p>
20
+ <p class="auth-hint">
21
+ Whoever opens the link or types the code at <code>{{invitePath}}</code> chooses the password. Anyone who sees it
22
+ before them could claim the account — send it privately.
23
+ </p>
24
+ <p><a href="{{usersPath}}">Back to users</a></p>
25
+ </main>
26
+ </body>
27
+ </html>
package/ui/users.html ADDED
@@ -0,0 +1,60 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>PATTY — users</title>
7
+ <link rel="stylesheet" href="{{stylesheet}}" />
8
+ </head>
9
+ <body>
10
+ <main class="auth-card tokens-card">
11
+ <h1>Users</h1>
12
+ <p class="auth-lede">
13
+ Everyone who can sign in to this instance, each with a private set of finances. People choose their own password
14
+ by claiming an invite — you never see it. Users are disabled, never deleted.
15
+ <a href="{{tokensPath}}">Access tokens</a> · <a href="{{dashboards}}">Back to the dashboards</a>
16
+ </p>
17
+ {{error}} {{users}}
18
+ <h2>Invite a user</h2>
19
+ <form class="auth-form" method="post" action="{{inviteAction}}">
20
+ <label
21
+ >Username
22
+ <input name="username" autocomplete="off" autocapitalize="none" spellcheck="false" required />
23
+ </label>
24
+ <label
25
+ >Role
26
+ <select name="role">
27
+ {{roleOptions}}
28
+ </select>
29
+ </label>
30
+ <label
31
+ >Your password
32
+ <input name="password" type="password" autocomplete="current-password" required />
33
+ </label>
34
+ <p class="auth-hint">
35
+ You get a link and a code to hand over, valid for {{inviteHours}} hours and shown once. Your password is asked
36
+ again so that nothing running in a dashboard page can invite anyone on its own.
37
+ </p>
38
+ <button type="submit">Create invite</button>
39
+ </form>
40
+ <h2>Longest Claude sign-in</h2>
41
+ <p class="auth-hint">
42
+ The most a person may choose when they approve a Claude sign-in. Sign-ins already granted keep the expiry they
43
+ were given.
44
+ </p>
45
+ <form class="auth-form" method="post" action="{{capAction}}">
46
+ <label
47
+ >Maximum
48
+ <select name="maxSignInDuration">
49
+ {{capOptions}}
50
+ </select>
51
+ </label>
52
+ <label
53
+ >Your password
54
+ <input name="password" type="password" autocomplete="current-password" required />
55
+ </label>
56
+ <button type="submit">Save</button>
57
+ </form>
58
+ </main>
59
+ </body>
60
+ </html>