@ai-matrx/rich-content 0.2.35 → 0.2.37

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.37
4
+
5
+ - `space_build_result`, `space_database_design` and `space_notion_import` join the FE-synthesized and shape block types: the Spaces agents' answers (`spaces.build`, `spaces.design_database`, `spaces.move_in`) are registered kinds now, rendered by one compiled component each instead of the generic viewer.
6
+
7
+ **Consumer action:** none (matrx-frontend registers the dispatch entries).
8
+
9
+ ## 0.2.36
10
+
11
+ - `tableToDelimited(table, "\t")` goes through THE one writer (kit `toDelimited`, formula-guarded like the CSV): a cell holding a tab, a quote or a line break is quoted instead of collapsed to a space.
12
+ - The diagram block's "Screenshot" PDF variants are a picture of a surface: Alchemy `renderElement` → `pagesToPdf` → kit `downloadFile` (as the org chart's export), no longer html2canvas `captureToPDF` (AP-2 fifth check).
13
+
14
+ **Consumer action:** a test asserting the old flattened TSV (`z w` for `z\tw`) now reads `"z\tw"` quoted.
15
+
3
16
  ## 0.2.35
4
17
 
5
18
  Automatic changed-only republish (docs/metadata drift since the last tag — see
@@ -2,8 +2,10 @@
2
2
  * Diagram Block Printer
3
3
  *
4
4
  * Two output strategies:
5
- * 1. "capture" variants — screenshot the live ReactFlow canvas via
6
- * dom-capture-print-utils (handles oklch/lab CSS) → PDF
5
+ * 1. "capture" variants — a picture of the live ReactFlow surface: Alchemy's
6
+ * `renderElement` (the SVG foreignObject renderer, so oklch/lab CSS paints as
7
+ * the browser paints it) → print's `pagesToPdf` (through /operate/capture)
8
+ * → kit `downloadFile` — the same path as the org chart's export
7
9
  * 2. "svg-export" variant — walk the diagram JSON and emit a pure SVG
8
10
  * placed inside a styled print document → browser print dialog
9
11
  *
@@ -2,18 +2,22 @@ import {
2
2
  openPrintWindow
3
3
  } from "@ai-matrx/print/core";
4
4
  async function captureDiagramToPDF(element, diagram, settings) {
5
- const { captureToPDF } = await import("@ai-matrx/print/pdf");
5
+ const { renderElement, pagesToPdf } = await import("@ai-matrx/alchemy/operate/capture");
6
+ const { downloadFile } = await import("@ai-matrx/kit/download");
6
7
  const orientation = settings["orientation"] ?? "landscape";
7
8
  const paperSize = settings["paperSize"] ?? "a4";
8
9
  const isDark = settings["darkMode"] ?? false;
9
10
  const background = isDark ? "#111827" : "#ffffff";
10
- await captureToPDF(element, {
11
- orientation,
12
- paperSize,
13
- background,
14
- filename: diagram.title.replace(/[^a-z0-9]/gi, "_").toLowerCase() || "diagram",
15
- scale: settings["highRes"] ? 3 : 2
11
+ const canvas = await renderElement(element, {
12
+ pixelRatio: settings["highRes"] ? 3 : 2,
13
+ backgroundColor: background
16
14
  });
15
+ const pdf = await pagesToPdf(
16
+ [{ image: canvas, imageType: "JPEG", quality: 0.92, compression: "FAST", placement: { top: 24, right: 24, bottom: 24, left: 24 } }],
17
+ { orientation, unit: "pt", format: paperSize }
18
+ );
19
+ const name = diagram.title.replace(/[^a-z0-9]/gi, "_").toLowerCase() || "diagram";
20
+ downloadFile(`${name}.pdf`, pdf, "application/pdf");
17
21
  }
18
22
  const SVG_COLORS = {
19
23
  start: { bg: "#dcfce7", border: "#16a34a", text: "#14532d" },
@@ -320,7 +320,7 @@ export declare function isBlockLoading(block: {
320
320
  * hid impossible to miss: an UNDECLARED column type (never a synonym for
321
321
  * "string") and a SILENT truncation.
322
322
  */
323
- export type FeSynthesizedBlockType = "directive_receipt" | "decision_questions" | "speech_script" | "input_remarks" | "media_block" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "applet_build_result" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
323
+ export type FeSynthesizedBlockType = "directive_receipt" | "decision_questions" | "speech_script" | "input_remarks" | "media_block" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "applet_build_result" | "space_build_result" | "space_database_design" | "space_notion_import" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
324
324
  /**
325
325
  * Detector-owned protocol tokens (crosswalk rows sourced ONLY from the
326
326
  * splitter/accumulator ATTR_XML_TAGS tables — no TS render-block union
@@ -332,7 +332,7 @@ export type ProtocolBlockType = ServerProtocolRenderBlock["type"] | "directive_r
332
332
  /** Crosswalk classification: scalar_generic — text/code/table/media primitives. */
333
333
  export type ScalarGenericBlockType = ServerScalarGenericRenderBlock["type"] | "text" | "code" | "table" | "image" | "video" | "tree" | "accent-divider" | "heavy-divider" | "audio" | "youtube" | "svg" | "media_block";
334
334
  /** Crosswalk classification: shape — structured content (kinds + candidates). */
335
- export type ShapeBlockType = ServerShapeRenderBlock["type"] | "decision_questions" | "speech_script" | "input_remarks" | "flashcards" | "quiz" | "presentation" | "cooking_recipe" | "timeline" | "progress_tracker" | "comparison_table" | "troubleshooting" | "resources" | "decision_tree" | "research" | "diagram" | "mermaid" | "math_problem" | "questionnaire" | "tasks" | "transcript" | "structured_info" | "item_presentation" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "chart" | "map" | "stats" | "diff" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "applet_build_result" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
335
+ export type ShapeBlockType = ServerShapeRenderBlock["type"] | "decision_questions" | "speech_script" | "input_remarks" | "flashcards" | "quiz" | "presentation" | "cooking_recipe" | "timeline" | "progress_tracker" | "comparison_table" | "troubleshooting" | "resources" | "decision_tree" | "research" | "diagram" | "mermaid" | "math_problem" | "questionnaire" | "tasks" | "transcript" | "structured_info" | "item_presentation" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "chart" | "map" | "stats" | "diff" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "applet_build_result" | "space_build_result" | "space_database_design" | "space_notion_import" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
336
336
  /** Crosswalk classification: intentionally_opaque — deliberately untyped. */
337
337
  export type OpaqueBlockType = ServerOpaqueRenderBlock["type"];
338
338
  export type KnownBlockType = ProtocolBlockType | ScalarGenericBlockType | ShapeBlockType | OpaqueBlockType;
@@ -1,4 +1,5 @@
1
1
  import { tableToCsv } from "../../display/tables/table-csv.js";
2
+ import { toDelimited } from "@ai-matrx/kit/delimited";
2
3
  import { unwrapCodeSpans } from "@ai-matrx/content-ir/source";
3
4
  import {
4
5
  findTableEnd,
@@ -29,8 +30,7 @@ function parseFirstMarkdownTable(content) {
29
30
  }
30
31
  function tableToDelimited(table, delimiter) {
31
32
  if (delimiter === ",") return tableToCsv(table.headers, table.rows);
32
- const flat = (value) => value.replace(/[\t\r\n]+/g, " ");
33
- return [table.headers, ...table.rows].map((row) => row.map(flat).join(" ")).join("\n");
33
+ return toDelimited([table.headers, ...table.rows], { format: "tsv" });
34
34
  }
35
35
  export {
36
36
  cleanCell,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-content",
3
- "version": "0.2.35",
3
+ "version": "0.2.37",
4
4
  "description": "The AI Matrx formatted-text engine: the one markdown renderer, streaming markdown, the block splitter and renderer, the generic blocks, <RichContent> levels, the rich-document action registry and menus, copy, and the selection toolbar — as portable React.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -130,21 +130,21 @@
130
130
  "unist-util-visit": "^5.1.0",
131
131
  "unist-util-visit-parents": "^6.0.2",
132
132
  "yaml": "^2.9.1",
133
+ "@ai-matrx/agents": "latest",
133
134
  "@ai-matrx/alchemy": "latest",
134
- "@ai-matrx/content-ir": "latest",
135
135
  "@ai-matrx/canvas": "latest",
136
+ "@ai-matrx/content-ir": "latest",
136
137
  "@ai-matrx/content-ir-react": "latest",
137
138
  "@ai-matrx/data": "latest",
138
- "@ai-matrx/design-system": "latest",
139
139
  "@ai-matrx/diff": "latest",
140
- "@ai-matrx/agents": "latest",
141
- "@ai-matrx/icons": "latest",
140
+ "@ai-matrx/design-system": "latest",
141
+ "@ai-matrx/kit": "latest",
142
142
  "@ai-matrx/media": "latest",
143
+ "@ai-matrx/icons": "latest",
143
144
  "@ai-matrx/print": "latest",
144
145
  "@ai-matrx/records": "latest",
145
146
  "@ai-matrx/records-ui": "latest",
146
- "@ai-matrx/tap-target": "latest",
147
- "@ai-matrx/kit": "latest"
147
+ "@ai-matrx/tap-target": "latest"
148
148
  },
149
149
  "peerDependencies": {
150
150
  "react": ">=19.0.0",