@avocadostudio-ai/orchestrator-core 0.28.0 → 0.29.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.
@@ -21,7 +21,7 @@ import { mkdir, writeFile, readFile } from "node:fs/promises";
21
21
  import { resolve, basename } from "node:path";
22
22
  import { randomUUID } from "node:crypto";
23
23
  import { z } from "zod";
24
- import { operationSchema, blockManifestSchema, siteConfigSchema, declareBlockCatalogue, undeclaredBlockTypes, EDITOR_PROTOCOL_VERSION, withLoopbackSpellings, editorAllowHeaders, compareDraftSecret } from "@avocadostudio-ai/shared";
24
+ import { operationSchema, blockManifestSchema, siteConfigSchema, declareBlockCatalogue, undeclaredBlockTypes, EDITOR_PROTOCOL_VERSION, withLoopbackSpellings, editorAllowHeaders, compareDraftSecret, buildBlockManifest } from "@avocadostudio-ai/shared";
25
25
  import { keyFileHint } from "../env-file-location.js";
26
26
  import { chatRequestBodySchema } from "../nlp/intent-detection.js";
27
27
  import { applyOpsAtomically, pickFocusBlockId, pickUpdatedSlug, toErrorDetail, classifyGuardrailError } from "../ops/ops-engine.js";
@@ -65,6 +65,7 @@ import { resolveCapabilities } from "../cms/adapter.js";
65
65
  import { mediaSourceFromUnknown } from "../cms/media-sources.js";
66
66
  import { extractAccessToken, isAccessGateEnabled, isValidAccessToken, mintAccessToken, verifyAccessPassword } from "../http/access-tokens.js";
67
67
  import { editorCredentials } from "../http/editor-credentials.js";
68
+ import { OperationError } from "../errors.js";
68
69
  import { clearLibraryDispatch, declareLibraryMount, observeLibraryMount, registerLibraryDispatch } from "./library-mount.js";
69
70
  import { checkAuth, resolveAuth, CLOSED_HINT } from "./auth.js";
70
71
  import { setSiteAssetLister, invalidateSiteAssets } from "../state/site-assets.js";
@@ -1605,6 +1606,19 @@ export function createOrchestrator(config = {}) {
1605
1606
  manifest = pm.data;
1606
1607
  }
1607
1608
  }
1609
+ /*
1610
+ * No manifest in the request: use this mount's own. The editor sends one
1611
+ * with every chat turn, but an MCP agent or a script calling /ops sends
1612
+ * none, and without it every manifest check in the ops engine is skipped:
1613
+ * read-only fields, fixed blocks, list discriminators, and list rows in a
1614
+ * shape nothing renders. Library mode is the one host that already knows
1615
+ * the site's blocks, the same ones `GET /blocks/manifest` serves.
1616
+ */
1617
+ if (!manifest) {
1618
+ const own = buildBlockManifest();
1619
+ if (own.blocks.length > 0)
1620
+ manifest = own;
1621
+ }
1608
1622
  /*
1609
1623
  * Validate-only, before anything is snapshotted or bumped. This branch
1610
1624
  * did not exist: `dryRun` was parsed out of the body by nobody and the
@@ -1703,7 +1717,10 @@ export function createOrchestrator(config = {}) {
1703
1717
  }
1704
1718
  catch (error) {
1705
1719
  const reason = toErrorDetail(error);
1706
- return jsonResponse({ error: reason, errorCode: classifyGuardrailError(reason) }, { status: 400, cors });
1720
+ // An OperationError already knows its category; the text classifier is
1721
+ // for errors that do not, and called a refused list row "internal_error".
1722
+ const category = error instanceof OperationError ? error.category : undefined;
1723
+ return jsonResponse({ error: reason, errorCode: category ?? classifyGuardrailError(reason) }, { status: 400, cors });
1707
1724
  }
1708
1725
  }
1709
1726
  /*
@@ -831,7 +831,7 @@ function _requireKnownItemKeys(manifestByType, blockType, listKey, list, item) {
831
831
  if (unknown.length === 0)
832
832
  return;
833
833
  throw new OperationError(`${listKey} rows have no field ${unknown.map((k) => `"${k}"`).join(", ")}. ` +
834
- `Use the list's own fields: ${[...declared].join(", ")}`, { category: "schema_violation" });
834
+ `Use the list's own fields: ${[...declared].filter((key) => !key.startsWith("_")).join(", ")}`, { category: "schema_violation" });
835
835
  }
836
836
  function _requireManifestComponent(manifestByType, blockType, operationName) {
837
837
  if (manifestByType.size === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avocadostudio-ai/orchestrator-core",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./package.json": "./package.json",
@@ -22,8 +22,8 @@
22
22
  "openai": "^4.87.1",
23
23
  "sharp": "^0.35.4",
24
24
  "zod": "^4.3.6",
25
- "@avocadostudio-ai/migration-sdk": "^0.28.0",
26
- "@avocadostudio-ai/shared": "^0.28.0"
25
+ "@avocadostudio-ai/migration-sdk": "^0.29.1",
26
+ "@avocadostudio-ai/shared": "^0.29.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@anthropic-ai/claude-agent-sdk": "^0.3.220",