@plumbus/core 0.5.0 → 0.6.1

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 (99) hide show
  1. package/README.md +1 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/ai/ai/cost-tracker.d.ts +93 -0
  4. package/dist/ai/ai/derive-ledger-usage.d.ts +10 -0
  5. package/dist/ai/ai/model-pricing.d.ts +51 -0
  6. package/dist/ai/ai/provider.d.ts +214 -0
  7. package/dist/ai/ai/refusal.d.ts +27 -0
  8. package/dist/ai/ai/usage-client.d.ts +30 -0
  9. package/dist/ai/ai-service.d.ts +1 -1
  10. package/dist/ai/ai-service.d.ts.map +1 -1
  11. package/dist/ai/ai-service.js +21 -16
  12. package/dist/ai/ai-service.js.map +1 -1
  13. package/dist/ai/cost-tracker.d.ts +17 -1
  14. package/dist/ai/cost-tracker.d.ts.map +1 -1
  15. package/dist/ai/cost-tracker.js +8 -6
  16. package/dist/ai/cost-tracker.js.map +1 -1
  17. package/dist/ai/derive-ledger-usage.d.ts +11 -0
  18. package/dist/ai/derive-ledger-usage.d.ts.map +1 -0
  19. package/dist/ai/derive-ledger-usage.js +36 -0
  20. package/dist/ai/derive-ledger-usage.js.map +1 -0
  21. package/dist/ai/index.d.ts +1 -0
  22. package/dist/ai/index.d.ts.map +1 -1
  23. package/dist/ai/index.js +1 -0
  24. package/dist/ai/index.js.map +1 -1
  25. package/dist/ai/types/config.d.ts +72 -0
  26. package/dist/ai/types/enums.d.ts +73 -0
  27. package/dist/cli/cli.d.ts.map +1 -1
  28. package/dist/cli/cli.js +2 -1
  29. package/dist/cli/cli.js.map +1 -1
  30. package/dist/cli/commands/flow-schedule-list.d.ts +31 -0
  31. package/dist/cli/commands/flow-schedule-list.d.ts.map +1 -0
  32. package/dist/cli/commands/flow-schedule-list.js +93 -0
  33. package/dist/cli/commands/flow-schedule-list.js.map +1 -0
  34. package/dist/cli/commands/flow.d.ts.map +1 -1
  35. package/dist/cli/commands/flow.js +26 -0
  36. package/dist/cli/commands/flow.js.map +1 -1
  37. package/dist/cli/commands/index.d.ts +1 -0
  38. package/dist/cli/commands/index.d.ts.map +1 -1
  39. package/dist/cli/commands/index.js +1 -0
  40. package/dist/cli/commands/index.js.map +1 -1
  41. package/dist/cli/commands/init.d.ts +1 -1
  42. package/dist/cli/commands/init.d.ts.map +1 -1
  43. package/dist/cli/commands/init.js +43 -2
  44. package/dist/cli/commands/init.js.map +1 -1
  45. package/dist/cli/commands/translation.d.ts.map +1 -1
  46. package/dist/cli/commands/translation.js +20 -2
  47. package/dist/cli/commands/translation.js.map +1 -1
  48. package/dist/cli/commands/ui.d.ts +4 -1
  49. package/dist/cli/commands/ui.d.ts.map +1 -1
  50. package/dist/cli/commands/ui.js +4 -1
  51. package/dist/cli/commands/ui.js.map +1 -1
  52. package/dist/cli/commands/voice.d.ts +12 -0
  53. package/dist/cli/commands/voice.d.ts.map +1 -0
  54. package/dist/cli/commands/voice.js +109 -0
  55. package/dist/cli/commands/voice.js.map +1 -0
  56. package/dist/cli/mcp-serve-context.d.ts.map +1 -1
  57. package/dist/cli/mcp-serve-context.js +133 -126
  58. package/dist/cli/mcp-serve-context.js.map +1 -1
  59. package/dist/cli/templates/resources.d.ts +2 -0
  60. package/dist/cli/templates/resources.d.ts.map +1 -1
  61. package/dist/cli/templates/resources.js +22 -1
  62. package/dist/cli/templates/resources.js.map +1 -1
  63. package/dist/cli/voice-agent-bootstrap.d.ts +22 -0
  64. package/dist/cli/voice-agent-bootstrap.d.ts.map +1 -0
  65. package/dist/cli/voice-agent-bootstrap.js +12 -0
  66. package/dist/cli/voice-agent-bootstrap.js.map +1 -0
  67. package/dist/cli/voice-serve-context.d.ts +7 -0
  68. package/dist/cli/voice-serve-context.d.ts.map +1 -0
  69. package/dist/cli/voice-serve-context.js +26 -0
  70. package/dist/cli/voice-serve-context.js.map +1 -0
  71. package/dist/execution/context-factory.d.ts.map +1 -1
  72. package/dist/execution/context-factory.js +6 -0
  73. package/dist/execution/context-factory.js.map +1 -1
  74. package/dist/flows/engine.d.ts.map +1 -1
  75. package/dist/flows/engine.js +2 -0
  76. package/dist/flows/engine.js.map +1 -1
  77. package/dist/index.d.ts +2 -2
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/index.js.map +1 -1
  81. package/dist/server/bootstrap.d.ts.map +1 -1
  82. package/dist/server/bootstrap.js +6 -0
  83. package/dist/server/bootstrap.js.map +1 -1
  84. package/dist/testing/context.d.ts.map +1 -1
  85. package/dist/testing/context.js +2 -0
  86. package/dist/testing/context.js.map +1 -1
  87. package/dist/testing/e2e.d.ts +6 -0
  88. package/dist/testing/e2e.d.ts.map +1 -1
  89. package/dist/testing/e2e.js +2 -0
  90. package/dist/testing/e2e.js.map +1 -1
  91. package/dist/types/context.d.ts +15 -0
  92. package/dist/types/context.d.ts.map +1 -1
  93. package/instructions/cli.md +1 -0
  94. package/instructions/deployment.md +1 -0
  95. package/instructions/framework.md +1 -0
  96. package/instructions/mcp.md +1 -1
  97. package/instructions/peer-dependencies.md +46 -0
  98. package/instructions/translations.md +33 -3
  99. package/package.json +8 -4
@@ -0,0 +1,46 @@
1
+ # `@plumbus/core` peer dependency ranges
2
+
3
+ Read this file **before** editing `peerDependencies` in any `packages/*/package.json`.
4
+
5
+ ## CRITICAL rules
6
+
7
+ 1. **Copy literals — do not derive ranges.** Never compute semver ranges from intuition. Copy the exact string from the table below or from a canonical `package.json` (`packages/mcp/package.json`, `packages/api/package.json`).
8
+ 2. **Never use `^0.x` caret ranges** on `@plumbus/core` peers in add-on packages. npm treats `^0.5.0` as **0.5.x only** (`>=0.5.0 <0.6.0`), not "0.5 and above."
9
+ 3. **pnpm passing locally does not prove peers are correct.** Backend Docker images install production deps with **npm** (`deployment.md` Rule 7). Wrong peers break Docker builds even when `pnpm install` succeeds.
10
+ 4. **Do not copy from CHANGELOG history.** Older releases documented incorrect ranges (`^0.5.0 <0.7.0` claimed to support 0.6.x — it does not under npm). Use this file and the canonical `package.json` files instead.
11
+
12
+ ## Canonical `@plumbus/core` peer strings
13
+
14
+ | Package kind | `peerDependencies["@plumbus/core"]` | Canonical copy-from |
15
+ |---|---|---|
16
+ | Most add-ons (chat, chat-ui, knowledge-base, mcp, api, browser-extension) | `"0.5.x \|\| 0.6.x"` | `packages/mcp/package.json` |
17
+ | Voice only (requires core 0.6+ media/cost APIs) | `"^0.6.0 <0.7.0"` | `packages/voice/package.json` |
18
+
19
+ When adding a **new** publishable add-on under `packages/`, use `"0.5.x || 0.6.x"` unless the package genuinely requires core 0.6+ only (then use the voice pattern).
20
+
21
+ ## Forbidden patterns
22
+
23
+ | Range | Why it is wrong |
24
+ |---|---|
25
+ | `"^0.5.0 <0.7.0"` | npm resolves `^0.5.0` to 0.5.x only — **rejects `@plumbus/core@0.6.0`** |
26
+ | `"^0.5.0 <0.6.0"` | 0.5.x only — rejects 0.6.x |
27
+ | `"^0.6.x"` or `"^0.6.0"` alone | Too loose or wrong syntax for multi-line support; use the table literals |
28
+ | Widening an upper bound on a caret range | e.g. changing `<0.6.0` to `<0.7.0` on `^0.5.0` does **not** add 0.6.x support |
29
+
30
+ ## When `@plumbus/core` gets a new minor line (e.g. 0.7.0)
31
+
32
+ Before tagging a core release:
33
+
34
+ 1. Update the literal table in **this file** (add `0.7.x` to the union, e.g. `"0.5.x || 0.6.x || 0.7.x"`).
35
+ 2. Update `peerDependencies["@plumbus/core"]` in **every** publishable add-on under `packages/` — copy the new literal everywhere; do not edit packages one-off with different strings.
36
+ 3. Patch-bump and publish each affected add-on.
37
+ 4. Update add-on `instructions/framework.md` (or `conventions.md`) peer lines to match.
38
+ 5. Run `pnpm lint`, `pnpm format:check`, `pnpm typecheck`, `pnpm test` from repo root.
39
+
40
+ See also: `.agents/skills/bump-version/SKILL.md` (core **minor** bump checklist).
41
+
42
+ ## Related docs
43
+
44
+ - `deployment.md` Rule 7 — backend `proddeps` uses `npm install --omit=dev`
45
+ - `.agents/skills/new-package-instructions/SKILL.md` — new package `package.json` peers
46
+ - `packages/mcp/package.json` / `packages/api/package.json` — canonical examples
@@ -28,12 +28,33 @@ export const commonTranslation = defineTranslation({
28
28
 
29
29
  ## Rules
30
30
 
31
- - Place translation files in `app/translations/<name>.translation.ts`
32
- - Each file exports one `defineTranslation()` result
31
+ - Place translation files in `app/translations/<name>.translation.ts` (classic layout), **or** use the locale-folder layout below
32
+ - Each assembler exports one `defineTranslation()` result
33
33
  - All locales **must** have the same key set — mismatched keys throw at import time
34
34
  - Messages use ICU MessageFormat: `{name}` for interpolation, `{count, plural, ...}` for plurals, `{gender, select, ...}` for select
35
35
  - The `name` field is the namespace: keys resolve as `<namespace>.<key>` (e.g., `common.nav.overview`)
36
36
 
37
+ ## Locale-folder layout (optional)
38
+
39
+ For larger catalogs, keep one folder per locale and a thin assembler:
40
+
41
+ ```
42
+ app/translations/
43
+ en/common.messages.ts
44
+ he/common.messages.ts
45
+ common.translation.ts # imports en + he, calls defineTranslation()
46
+ ```
47
+
48
+ Scaffold with:
49
+
50
+ ```bash
51
+ plumbus translation new myNamespace --locale-folders
52
+ ```
53
+
54
+ Large namespaces (e.g. `staff`) can split further under `en/staff/*.messages.ts` and merge with a local `index.ts` before the assembler imports `./en/staff/index.js`.
55
+
56
+ Discovery still loads only `defineTranslation()` exports; plain `messages` objects in locale folders are ignored.
57
+
37
58
  ## Server-Side Usage
38
59
 
39
60
  In capability handlers, use `ctx.translations.t()`:
@@ -49,13 +70,22 @@ The locale is resolved from the request context.
49
70
  | Command | Description |
50
71
  |---------|-------------|
51
72
  | `plumbus translation new <name>` | Scaffold a new translation file |
73
+ | `plumbus translation new <name> --locale-folders` | Scaffold `en/`, `he/` message files + thin assembler |
52
74
  | `plumbus translation export` | Export to JSON or XLIFF 2.0 for professional translation |
53
75
  | `plumbus translation import` | Import translated JSON/XLIFF files back into source |
54
76
  | `plumbus translation status` | Report per-locale completion percentage |
55
77
 
56
78
  ## Frontend
57
79
 
58
- When translations exist, `plumbus ui generate` produces `generated/i18n/` with next-intl integration:
80
+ When translations exist, `plumbus ui generate` produces `{frontend}/i18n/` with next-intl integration.
81
+
82
+ Optional: emit per-locale bundles (same runtime API, smaller generated files):
83
+
84
+ ```bash
85
+ plumbus ui generate --out-dir frontend --split-locale-bundles
86
+ ```
87
+
88
+ Without the flag, output is unchanged — a single `i18n/messages.ts`.
59
89
 
60
90
  ```tsx
61
91
  import { useTranslations } from "next-intl";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumbus/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Plumbus framework core — types, SDK, runtime, CLI, test utilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@plumbus/api": "0.1.x",
73
- "@plumbus/mcp": "0.5.x",
73
+ "@plumbus/mcp": "0.5.x || 0.6.x",
74
74
  "cron-parser": "^4.9.0",
75
75
  "redis": "^4.7.0"
76
76
  },
@@ -92,12 +92,16 @@
92
92
  "@biomejs/biome": "^2.4.6",
93
93
  "@types/node": "^25.4.0",
94
94
  "@vitest/browser": "^3.0.0",
95
+ "esbuild": "^0.25.12",
95
96
  "typescript": "^5.7.0",
96
- "@plumbus/mcp": "0.5.0",
97
- "@plumbus/api": "0.1.1"
97
+ "@plumbus/api": "0.1.2",
98
+ "@plumbus/voice": "0.3.0",
99
+ "@plumbus/mcp": "0.5.1"
98
100
  },
99
101
  "scripts": {
100
102
  "build": "tsc -b",
103
+ "build:voice-cli": "node scripts/build-voice-cli.mjs",
104
+ "pretest": "pnpm run build:voice-cli",
101
105
  "dev": "tsc -b --watch",
102
106
  "test": "vitest run",
103
107
  "test:watch": "vitest",