@happyvertical/smrt-core 0.57.18 → 0.57.20

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.
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-core",
5
- "packageVersion": "0.57.18",
5
+ "packageVersion": "0.57.20",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-core:SmrtClass": {
8
8
  "name": "smrtclass",
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-core",
6
- "packageVersion": "0.57.18",
6
+ "packageVersion": "0.57.20",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "a965c8c744f97ca30451c73ac7f4fca5a64805db17e154c612cc37d8a6a1b265",
11
- "packageJson": "77b04926cc881d684a07576ebcff7f378240b22d9762a0ab00873c360e014097",
10
+ "manifest": "3c19fb5fc649963e73c53171038837b87b8be3e4fcb2bc53a652d83bcc325d83",
11
+ "packageJson": "a6ae255c1e5d680f4f75daceec51367708bcec6986832dd32cbd4af0eccfbdc8",
12
12
  "agents": "3a78a0babd2884ac22e4b376a3c9618037ab818ad4bdd762751f82fa53c21d04",
13
13
  "moduleDoc:agents/object-runtime.md": "fd2748649e820c2fe5960fa4a44c5f3e2a5afa57da89925e8b4cb3b53d67a07b",
14
14
  "moduleDoc:agents/revision-guard.md": "f6ea32a6860964c98aba14b93587f40b33c8f7d0deccb2c54d21bff45db3da42",
@@ -27,7 +27,7 @@
27
27
  "moduleDoc:agents/run-once.md": "43c589a3cab2ff61147128014cc0084509faf623eb76860140d589539420a1f3",
28
28
  "moduleDoc:agents/recipes.md": "b8a0661d03d3f8df07874456164ef5648c62c775267d8e8340dac0a5d383a54e",
29
29
  "moduleDoc:agents/cookbook.md": "20c256f4f6219f9b2add6365ef930e0bb3eda37e7866ddbc4bdd466830f76e4f",
30
- "moduleDoc:agents/cookbook-engine.md": "4ea0b3cdb952788372596cbf1f51e326b0d696302f6358a21e3330402ef1f8aa",
30
+ "moduleDoc:agents/cookbook-engine.md": "f8e6869021b6cc214fe34da20b73a83509abc10bab71299ea9668b47a1c4307d",
31
31
  "moduleDoc:agents/browser-entry.md": "8d928babfe7308512c901a12c23fbfb7ff395f6b1cddce5cd069e4ece38743da",
32
32
  "moduleDoc:agents/test-types.md": "37c009ae2bd21001d83bba6cfab2047465fe32d5443de12661e24ba7d4e2d613"
33
33
  },
@@ -1238,7 +1238,7 @@
1238
1238
  {
1239
1239
  "path": "agents/cookbook-engine.md",
1240
1240
  "module": "cookbook-engine",
1241
- "content": "# Cookbook command engine (#3753)\n\n`@happyvertical/smrt-core/cookbook/engine` (`src/cookbook/engine/`) is the one\nplace the rules for changing a [cookbook](cookbook.md) live. A planner UI, a\nlocal Kitchen MCP server, the CLI and a website all call it; each is an adapter.\nIt imports only relative modules and `@happyvertical/smrt-types` types, so it\nruns in Node and in a browser. No SvelteKit, storage, singleton or inference.\n\nIt lives in `smrt-core` because the contract and validator (`./cookbook`) do and\nthe package DAG forbids a back edge: types -> core. A separate package would add\na node for pure functions with no other dependency.\n\n## API\n\n```ts\nimport { createCookbookEngine } from '@happyvertical/smrt-core/cookbook/engine';\nconst engine = createCookbookEngine({ catalog, cookbook?, state? });\nengine.run({ id?, name, input, expectedRevision? }) // CommandResult, never throws\nengine.batch({ id?, commands, expectedRevision? }) // BatchResult, atomic\nengine.snapshot() / .cookbook() / .state() / .subscribe(fn)\nengine.tools / engine.batchTool // JSON Schema tool definitions\n```\n\n- **Catalog is data** (`EngineCatalog`): `recipes` (manifest `RecipeDefinition`\n fits), `models` (`id, name, packageId, exposed?, fields?`), optional\n `cookbooks` (a library), `themePresets`, `currencies`, `settingTargets`.\n Nothing is bundled. Build it from published manifests or `smrt-knowledge.json`.\n- **Commands** (20, `COOKBOOK_COMMANDS_VERSION = 1`): `apply_cookbook` (select),\n `import_cookbook`, `add_cookbook`, `remove_cookbook`, `add_recipes`,\n `remove_recipes`, `add_features`, `remove_features`, `set_settings`,\n `set_policy`, `set_theme`, `reset_theme`, `set_name`, `rename_section`,\n `rename_item`, `hide`, `show`, `validate`, `export_cookbook`, `undo`. Navigation\n and focus are not commands: they are an adapter concern.\n- **`set_theme`** takes `preset`, `primary` (a brand colour that replaces the\n preset, see cookbook.md), `colorScheme`, `fontFamily` (`null` restores the\n preset font), and `borderRadius` (`none|sm|md|lg|xl|full`), `density`\n (`comfortable|touch`), `contrast` (`auto|standard|more`). Each is optional and\n only the fields given change; repeating the same input is an unchanged\n receipt. Values outside the enums are `invalid_input`. `snapshot().theme`\n reports the three new fields (`null` when unset); `reset_theme` clears them.\n- **Errors** are typed (`CommandError`: `code`, `message`, `path?`, `details?`):\n `unknown_command`, `invalid_input`, `not_found`, `confirmation_required`,\n `conflict`, `id_reuse`, `batch_failed`, `failed`.\n- **Result** carries the `receipt` (`name, id?, summary, changed, revisionBefore,\n revisionAfter, undoId?, changes?, warnings?`), the compact `snapshot` and\n optional `data` (`validate`, `export_cookbook`).\n\n## Execution contract\n\n- **Revisions** count applied changes (a no-op does not move it), so equal\n histories give equal revisions. `expectedRevision` that is not current fails\n `conflict` with `details.{expectedRevision,currentRevision}`: an older model\n action cannot overwrite a newer manual edit. Send it on every model action.\n- **Command ids**: a repeated `id` with the same command returns the first\n result with `replayed: true` and applies nothing (failures replay too: take a\n new id after re-reading). The same id with a different command is `id_reuse`.\n The journal keeps `maxJournal` (500) ids and is part of `state()`.\n- **Atomic batches** run on a working copy; one failure leaves the state\n byte-identical and returns `batch_failed` naming `details.index`. A batch that\n changes n times advances the revision by n, as n runs would, and has one undo.\n `undo` and per-command ids/revisions are not allowed inside a batch.\n- **Undo** restores the document from before the change; it is a `conflict`\n while the plan differs from what that change left, unless `force`.\n- **Recovery**: `state()` is plain JSON (revision, applied library id, document,\n journal); `createCookbookEngine({ catalog, state })` resumes it, retries\n included. Undo entries are not persisted.\n- **Canonical document**: ids sorted, policies sorted, empty sections absent,\n key order fixed, so two engines export identical text. Recipe/feature ids the\n catalog lacks stay in the document and show as `snapshot.unavailable`.\n\n## Deliberately not here\n\nPackage or starter version pinning (waits on #3604/#3754). Deep overview-widget\nand nav-id checks (smrt-svelte owns them; `import_cookbook` carries `overviews`\nand `layout` through unjudged, `validate` only flags layout ids the menu lacks).\nTyped diagnostics from `validateCookbook` itself (#3754): `validate` wraps its\nstrings as `invalid_document` until it returns them.\n\n## Becoming an adapter: what smrt-planner changes (after the smrt release)\n\nParity to hold: the planner's `tests/headless-planner.test.ts` scenario is\nported in `__tests__/engine.test.ts` (`SCRIPT`) over a data catalog.\n\n1. Depend on the released `@happyvertical/smrt-core`; build `EngineCatalog` from\n its catalog data (`recipes.json`/`catalog.json` -> `recipes`, `models`,\n `cookbooks`: the library wrapper keeps id/icon/keywords planner-side).\n2. Delete `commands/execute.ts`, `commands/runner.ts`, `commands/snapshot.ts`,\n `commands/schemas.ts` (keep `checkSchema` only if still used), `recipes/\n plan-data.ts`, `recipes/resolve.ts`, `settings/app-settings.ts` rules,\n `assistant/change.ts` apply* helpers, `cookbook/assemble.ts` and the\n `createPlainHost`. `createHeadlessPlanner` becomes `createCookbookEngine`\n behind the same `run/snapshot/subscribe/cookbook` names.\n3. The browser controller keeps: `focus` and the planner tab/section cells\n (snapshot `focus` is added by the adapter), reactive wrapping of\n `engine.subscribe`, `onReplaced` (regenerate sample data after\n `apply_cookbook`), and the `cookbookStore` <-> `engine.state()` sync\n (`engine.cookbook()` to persist; rebuild with `cookbook`/`state` on load).\n4. Command differences to absorb: `apply_cookbook`/`import_cookbook` report\n `changed` by content; `rename_*`/`hide`/`show` need the catalog `models`\n `packageId` for item ids; undo is whole-document (the old per-slice undo goes);\n `unsupported` is gone (the engine always has every slice); new `set_name`,\n `validate`; receipts gain `revisionBefore/After`; `expectedRevision` moves\n into the command (the option form still works).\n5. Overview customisation stays a planner/smrt-svelte concern; hold `overviews`\n in the document via `import_cookbook` and write them with a planner-side\n command until an engine command is agreed.\n6. MCP/Kitchen (#3752, done): `smrt kitchen mcp` holds one engine per plan id and\n serves `engine.batchTool`'s schema as `run_commands`; the plan reaches disk\n as `smrt.cookbook.json` through `cookbook apply` (`cli/agents/kitchen.md`).\n"
1241
+ "content": "# Cookbook command engine (#3753)\n\n`@happyvertical/smrt-core/cookbook/engine` (`src/cookbook/engine/`) is the one\nplace the rules for changing a [cookbook](cookbook.md) live. A planner UI, a\nlocal Kitchen MCP server, the CLI and a website all call it; each is an adapter.\nIt imports only relative modules and `@happyvertical/smrt-types` types, so it\nruns in Node and in a browser. No SvelteKit, storage, singleton or inference.\n\nIt lives in `smrt-core` because the contract and validator (`./cookbook`) do and\nthe package DAG forbids a back edge: types -> core. A separate package would add\na node for pure functions with no other dependency.\n\n## API\n\n```ts\nimport { createCookbookEngine } from '@happyvertical/smrt-core/cookbook/engine';\nconst engine = createCookbookEngine({ catalog, cookbook?, state? });\nengine.run({ id?, name, input, expectedRevision? }) // CommandResult, never throws\nengine.batch({ id?, commands, expectedRevision? }) // BatchResult, atomic\nengine.snapshot() / .cookbook() / .state() / .subscribe(fn)\nengine.tools / engine.batchTool // JSON Schema tool definitions\n```\n\n- **Catalog is data** (`EngineCatalog`): `recipes` (manifest `RecipeDefinition`\n fits), `models` (`id, name, packageId, exposed?, fields?`), optional\n `cookbooks` (a library), `themePresets`, `currencies`, `settingTargets`.\n Nothing is bundled. Build it from published manifests or `smrt-knowledge.json`.\n- **Commands** (20, `COOKBOOK_COMMANDS_VERSION = 1`): `apply_cookbook` (select),\n `import_cookbook`, `add_cookbook`, `remove_cookbook`, `add_recipes`,\n `remove_recipes`, `add_features`, `remove_features`, `set_settings`,\n `set_policy`, `set_theme`, `reset_theme`, `set_name` (name, description and `specs`, free-text requirements beyond\n the recipes; internal newlines are kept), `rename_section`,\n `rename_item`, `hide`, `show`, `validate`, `export_cookbook`, `undo`. Navigation\n and focus are not commands: they are an adapter concern.\n- **`set_theme`** takes `preset`, `primary` (a brand colour that replaces the\n preset, see cookbook.md), `colorScheme`, `fontFamily` (`null` restores the\n preset font), and `borderRadius` (`none|sm|md|lg|xl|full`), `density`\n (`comfortable|touch`), `contrast` (`auto|standard|more`). Each is optional and\n only the fields given change; repeating the same input is an unchanged\n receipt. Values outside the enums are `invalid_input`. `snapshot().theme`\n reports the three new fields (`null` when unset); `reset_theme` clears them.\n- **Errors** are typed (`CommandError`: `code`, `message`, `path?`, `details?`):\n `unknown_command`, `invalid_input`, `not_found`, `confirmation_required`,\n `conflict`, `id_reuse`, `batch_failed`, `failed`.\n- **Result** carries the `receipt` (`name, id?, summary, changed, revisionBefore,\n revisionAfter, undoId?, changes?, warnings?`), the compact `snapshot` and\n optional `data` (`validate`, `export_cookbook`).\n\n## Execution contract\n\n- **Revisions** count applied changes (a no-op does not move it), so equal\n histories give equal revisions. `expectedRevision` that is not current fails\n `conflict` with `details.{expectedRevision,currentRevision}`: an older model\n action cannot overwrite a newer manual edit. Send it on every model action.\n- **Command ids**: a repeated `id` with the same command returns the first\n result with `replayed: true` and applies nothing (failures replay too: take a\n new id after re-reading). The same id with a different command is `id_reuse`.\n The journal keeps `maxJournal` (500) ids and is part of `state()`.\n- **Atomic batches** run on a working copy; one failure leaves the state\n byte-identical and returns `batch_failed` naming `details.index`. A batch that\n changes n times advances the revision by n, as n runs would, and has one undo.\n `undo` and per-command ids/revisions are not allowed inside a batch.\n- **Undo** restores the document from before the change; it is a `conflict`\n while the plan differs from what that change left, unless `force`.\n- **Recovery**: `state()` is plain JSON (revision, applied library id, document,\n journal); `createCookbookEngine({ catalog, state })` resumes it, retries\n included. Undo entries are not persisted.\n- **Canonical document**: ids sorted, policies sorted, empty sections absent,\n key order fixed, so two engines export identical text. Recipe/feature ids the\n catalog lacks stay in the document and show as `snapshot.unavailable`.\n\n## Deliberately not here\n\nPackage or starter version pinning (waits on #3604/#3754). Deep overview-widget\nand nav-id checks (smrt-svelte owns them; `import_cookbook` carries `overviews`\nand `layout` through unjudged, `validate` only flags layout ids the menu lacks).\nTyped diagnostics from `validateCookbook` itself (#3754): `validate` wraps its\nstrings as `invalid_document` until it returns them.\n\n## Becoming an adapter: what smrt-planner changes (after the smrt release)\n\nParity to hold: the planner's `tests/headless-planner.test.ts` scenario is\nported in `__tests__/engine.test.ts` (`SCRIPT`) over a data catalog.\n\n1. Depend on the released `@happyvertical/smrt-core`; build `EngineCatalog` from\n its catalog data (`recipes.json`/`catalog.json` -> `recipes`, `models`,\n `cookbooks`: the library wrapper keeps id/icon/keywords planner-side).\n2. Delete `commands/execute.ts`, `commands/runner.ts`, `commands/snapshot.ts`,\n `commands/schemas.ts` (keep `checkSchema` only if still used), `recipes/\n plan-data.ts`, `recipes/resolve.ts`, `settings/app-settings.ts` rules,\n `assistant/change.ts` apply* helpers, `cookbook/assemble.ts` and the\n `createPlainHost`. `createHeadlessPlanner` becomes `createCookbookEngine`\n behind the same `run/snapshot/subscribe/cookbook` names.\n3. The browser controller keeps: `focus` and the planner tab/section cells\n (snapshot `focus` is added by the adapter), reactive wrapping of\n `engine.subscribe`, `onReplaced` (regenerate sample data after\n `apply_cookbook`), and the `cookbookStore` <-> `engine.state()` sync\n (`engine.cookbook()` to persist; rebuild with `cookbook`/`state` on load).\n4. Command differences to absorb: `apply_cookbook`/`import_cookbook` report\n `changed` by content; `rename_*`/`hide`/`show` need the catalog `models`\n `packageId` for item ids; undo is whole-document (the old per-slice undo goes);\n `unsupported` is gone (the engine always has every slice); new `set_name`,\n `validate`; receipts gain `revisionBefore/After`; `expectedRevision` moves\n into the command (the option form still works).\n5. Overview customisation stays a planner/smrt-svelte concern; hold `overviews`\n in the document via `import_cookbook` and write them with a planner-side\n command until an engine command is agreed.\n6. MCP/Kitchen (#3752, done): `smrt kitchen mcp` holds one engine per plan id and\n serves `engine.batchTool`'s schema as `run_commands`; the plan reaches disk\n as `smrt.cookbook.json` through `cookbook apply` (`cli/agents/kitchen.md`).\n"
1242
1242
  },
1243
1243
  {
1244
1244
  "path": "agents/browser-entry.md",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-core",
3
- "version": "0.57.18",
3
+ "version": "0.57.20",
4
4
  "description": "Core AI agent framework with standardized collections, object-relational mapping, and code generators",
5
5
  "author": "HappyVertical",
6
6
  "type": "module",
@@ -195,15 +195,15 @@
195
195
  "./dist/utils/json.js": "./dist/utils/json.browser.js"
196
196
  },
197
197
  "dependencies": {
198
- "@happyvertical/ai": "^0.105.5",
199
- "@happyvertical/files": "^0.105.5",
200
- "@happyvertical/json": "^0.105.5",
201
- "@happyvertical/logger": "^0.105.5",
202
- "@happyvertical/smrt-config": "0.57.18",
203
- "@happyvertical/smrt-scanner": "0.57.18",
204
- "@happyvertical/smrt-types": "0.57.18",
205
- "@happyvertical/sql": "^0.105.5",
206
- "@happyvertical/utils": "^0.105.5",
198
+ "@happyvertical/ai": "^0.106.0",
199
+ "@happyvertical/files": "^0.106.0",
200
+ "@happyvertical/json": "^0.106.0",
201
+ "@happyvertical/logger": "^0.106.0",
202
+ "@happyvertical/smrt-config": "0.57.20",
203
+ "@happyvertical/smrt-scanner": "0.57.20",
204
+ "@happyvertical/smrt-types": "0.57.20",
205
+ "@happyvertical/sql": "^0.106.0",
206
+ "@happyvertical/utils": "^0.106.0",
207
207
  "@noble/hashes": "^2.4.0",
208
208
  "@oxc-project/runtime": "^0.150.0",
209
209
  "cheerio": "^1.2.0",