@avocadostudio-ai/orchestrator-core 0.11.6 → 0.11.8

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.
@@ -2998,7 +2998,7 @@ export async function runChatPipeline(ctx, body, options) {
2998
2998
  markPlanningStart();
2999
2999
  try {
3000
3000
  emitStatusTone("planning");
3001
- const demoPlan = withKeylessNotice(demoPlanFromMessageImpl(plannerMessage, effectiveSlug, planningActiveBlockId, body.activeBlockType), keyFileHint());
3001
+ const demoPlan = withKeylessNotice(demoPlanFromMessageImpl(plannerMessage, effectiveSlug, planningActiveBlockId, body.activeBlockType, current), keyFileHint());
3002
3002
  markPlanningFinish();
3003
3003
  const outcome = await respondFromPlan(demoPlan, "demo", applyMode, undefined, "demo");
3004
3004
  if (outcome.done)
@@ -19,7 +19,15 @@ export declare function postEditSuggestions(args: {
19
19
  current: PageDoc;
20
20
  body: ChatRequestBody;
21
21
  }): string[];
22
- export declare function demoPlanFromMessage(message: string, slug: string, activeBlockId?: string, activeBlockType?: string): EditPlan;
22
+ export declare function demoPlanFromMessage(message: string, slug: string, activeBlockId?: string, activeBlockType?: string,
23
+ /**
24
+ * The page being edited, so a heading edit can find its own target.
25
+ *
26
+ * Without it the heading branch below could only act on an already-selected
27
+ * block, and a first-run user's first typed sentence is almost never sent
28
+ * with anything selected. See the comment there.
29
+ */
30
+ page?: PageDoc): EditPlan;
23
31
  export declare function titleCaseSentence(text: string): string;
24
32
  export declare function pageMetaContractSummary(): {
25
33
  op: string;
@@ -233,7 +233,15 @@ export function postEditSuggestions(args) {
233
233
  pushUniqueSuggestion("Add Stats");
234
234
  return suggestions.slice(0, 4);
235
235
  }
236
- export function demoPlanFromMessage(message, slug, activeBlockId, activeBlockType) {
236
+ export function demoPlanFromMessage(message, slug, activeBlockId, activeBlockType,
237
+ /**
238
+ * The page being edited, so a heading edit can find its own target.
239
+ *
240
+ * Without it the heading branch below could only act on an already-selected
241
+ * block, and a first-run user's first typed sentence is almost never sent
242
+ * with anything selected. See the comment there.
243
+ */
244
+ page) {
237
245
  const lower = message.toLowerCase();
238
246
  const quoted = /"([^"]+)"/.exec(message)?.[1];
239
247
  // SEO metadata patterns — checked early so "seo title" isn't mistaken for hero heading
@@ -334,25 +342,55 @@ export function demoPlanFromMessage(message, slug, activeBlockId, activeBlockTyp
334
342
  ]
335
343
  };
336
344
  }
337
- if ((lower.includes("title") || lower.includes("heading")) && activeBlockId && activeBlockType === "Hero") {
338
- const headingText = quoted ??
339
- message
340
- .replace(/change/i, "")
341
- .replace(/hero/i, "")
342
- .replace(/title/i, "")
343
- .replace(/heading/i, "")
344
- .replace(/\bto\b/i, "")
345
- .trim();
346
- if (headingText) {
345
+ /*
346
+ * "Change the headline to X" — the single most likely first message, and it
347
+ * used to be refused twice over.
348
+ *
349
+ * The notice on the first screen says *"Only simple, literal edits work"*, and
350
+ * a literal assignment to the thing at the top of the page is the most
351
+ * literal edit there is. It failed for two independent reasons:
352
+ *
353
+ * 1. **"headline" was not a keyword.** The test was `title || heading`, and
354
+ * "headline" contains neither. The word the product's own suggestion chips
355
+ * use — "Rewrite the hero headline" — did not match.
356
+ * 2. **It required a selection.** `activeBlockId && activeBlockType === "Hero"`
357
+ * means a block must already be selected, and a user's *typed* first
358
+ * message is almost never sent with anything selected — especially since
359
+ * click-to-select defaults off. So the path was reachable only after
360
+ * discovering an unlabelled toggle and clicking the exact block.
361
+ *
362
+ * Now it resolves its own target: the selected block when there is one,
363
+ * otherwise the first block on the page carrying a `heading` prop. A quoted
364
+ * value is required when nothing is selected, because without quotes the
365
+ * stripping below is guesswork and this planner's whole contract is that it
366
+ * only does the unambiguous thing.
367
+ */
368
+ const mentionsHeading = lower.includes("title") || lower.includes("heading") || lower.includes("headline");
369
+ if (mentionsHeading) {
370
+ const selectedIsHeadingBlock = Boolean(activeBlockId) && activeBlockType === "Hero";
371
+ const fallback = page?.blocks.find((b) => b.props && typeof b.props.heading === "string");
372
+ const targetId = selectedIsHeadingBlock ? activeBlockId : fallback?.id;
373
+ const headingText = selectedIsHeadingBlock
374
+ ? quoted ??
375
+ message
376
+ .replace(/change/i, "")
377
+ .replace(/hero/i, "")
378
+ .replace(/title/i, "")
379
+ .replace(/heading/i, "")
380
+ .replace(/headline/i, "")
381
+ .replace(/\bto\b/i, "")
382
+ .trim()
383
+ : quoted;
384
+ if (targetId && headingText) {
347
385
  return {
348
386
  intent: "edit_plan",
349
- summary_for_user: "Updated the hero title.",
350
- change_log: [`Changed hero heading to "${headingText}".`],
387
+ summary_for_user: "Updated the heading.",
388
+ change_log: [`Changed heading to "${headingText}".`],
351
389
  ops: [
352
390
  {
353
391
  op: "update_props",
354
392
  pageSlug: slug,
355
- blockId: activeBlockId,
393
+ blockId: targetId,
356
394
  patch: { heading: headingText }
357
395
  }
358
396
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avocadostudio-ai/orchestrator-core",
3
- "version": "0.11.6",
3
+ "version": "0.11.8",
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.11.6",
26
- "@avocadostudio-ai/shared": "^0.11.6"
25
+ "@avocadostudio-ai/migration-sdk": "^0.11.8",
26
+ "@avocadostudio-ai/shared": "^0.11.8"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@anthropic-ai/claude-agent-sdk": "^0.3.220",