@agentick/core 0.0.1 → 0.1.9
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/dist/.tsbuildinfo.build +1 -1
- package/package.json +8 -3
- package/dist/.tsbuildinfo +0 -1
- package/dist/agent.d.ts +0 -32
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -26
- package/dist/agent.js.map +0 -1
- package/dist/aidk-instance.d.ts +0 -294
- package/dist/aidk-instance.d.ts.map +0 -1
- package/dist/aidk-instance.js +0 -340
- package/dist/aidk-instance.js.map +0 -1
- package/dist/compiler/content-block-registry.d.ts +0 -11
- package/dist/compiler/content-block-registry.d.ts.map +0 -1
- package/dist/compiler/content-block-registry.js +0 -312
- package/dist/compiler/content-block-registry.js.map +0 -1
- package/dist/compiler/extractors.d.ts +0 -68
- package/dist/compiler/extractors.d.ts.map +0 -1
- package/dist/compiler/extractors.js +0 -547
- package/dist/compiler/extractors.js.map +0 -1
- package/dist/compiler/fiber.d.ts +0 -61
- package/dist/compiler/fiber.d.ts.map +0 -1
- package/dist/compiler/fiber.js +0 -244
- package/dist/compiler/fiber.js.map +0 -1
- package/dist/component/tentickle-component.d.ts +0 -185
- package/dist/component/tentickle-component.d.ts.map +0 -1
- package/dist/component/tentickle-component.js +0 -182
- package/dist/component/tentickle-component.js.map +0 -1
- package/dist/core/channel-helpers.d.ts +0 -31
- package/dist/core/channel-helpers.d.ts.map +0 -1
- package/dist/core/channel-helpers.js +0 -62
- package/dist/core/channel-helpers.js.map +0 -1
- package/dist/core/channel.d.ts +0 -164
- package/dist/core/channel.d.ts.map +0 -1
- package/dist/core/channel.js +0 -199
- package/dist/core/channel.js.map +0 -1
- package/dist/core/context.d.ts +0 -412
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/context.js +0 -290
- package/dist/core/context.js.map +0 -1
- package/dist/core/event-buffer.d.ts +0 -212
- package/dist/core/event-buffer.d.ts.map +0 -1
- package/dist/core/event-buffer.js +0 -346
- package/dist/core/event-buffer.js.map +0 -1
- package/dist/core/execution-helpers.d.ts +0 -179
- package/dist/core/execution-helpers.d.ts.map +0 -1
- package/dist/core/execution-helpers.js +0 -212
- package/dist/core/execution-helpers.js.map +0 -1
- package/dist/core/execution-tracker.d.ts +0 -53
- package/dist/core/execution-tracker.d.ts.map +0 -1
- package/dist/core/execution-tracker.js +0 -309
- package/dist/core/execution-tracker.js.map +0 -1
- package/dist/core/index.d.ts +0 -58
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -58
- package/dist/core/index.js.map +0 -1
- package/dist/core/logger.d.ts +0 -341
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/logger.js +0 -346
- package/dist/core/logger.js.map +0 -1
- package/dist/core/metrics-helpers.d.ts +0 -40
- package/dist/core/metrics-helpers.d.ts.map +0 -1
- package/dist/core/metrics-helpers.js +0 -72
- package/dist/core/metrics-helpers.js.map +0 -1
- package/dist/core/otel-provider.d.ts +0 -54
- package/dist/core/otel-provider.d.ts.map +0 -1
- package/dist/core/otel-provider.js +0 -107
- package/dist/core/otel-provider.js.map +0 -1
- package/dist/core/procedure-graph.d.ts +0 -136
- package/dist/core/procedure-graph.d.ts.map +0 -1
- package/dist/core/procedure-graph.js +0 -272
- package/dist/core/procedure-graph.js.map +0 -1
- package/dist/core/procedure.d.ts +0 -755
- package/dist/core/procedure.d.ts.map +0 -1
- package/dist/core/procedure.js +0 -899
- package/dist/core/procedure.js.map +0 -1
- package/dist/core/stream.d.ts +0 -106
- package/dist/core/stream.d.ts.map +0 -1
- package/dist/core/stream.js +0 -186
- package/dist/core/stream.js.map +0 -1
- package/dist/core/telemetry.d.ts +0 -182
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js +0 -124
- package/dist/core/telemetry.js.map +0 -1
- package/dist/engine/execution-graph.d.ts +0 -104
- package/dist/engine/execution-graph.d.ts.map +0 -1
- package/dist/engine/execution-graph.js +0 -257
- package/dist/engine/execution-graph.js.map +0 -1
- package/dist/hooks/policy-context.d.ts.map +0 -1
- package/dist/jsx/components/agent.d.ts +0 -64
- package/dist/jsx/components/agent.d.ts.map +0 -1
- package/dist/jsx/components/agent.js +0 -80
- package/dist/jsx/components/agent.js.map +0 -1
- package/dist/model/simple-adapter.d.ts +0 -176
- package/dist/model/simple-adapter.d.ts.map +0 -1
- package/dist/model/simple-adapter.js +0 -264
- package/dist/model/simple-adapter.js.map +0 -1
- package/dist/state/boundary.d.ts +0 -347
- package/dist/state/boundary.d.ts.map +0 -1
- package/dist/state/boundary.js +0 -341
- package/dist/state/boundary.js.map +0 -1
- package/dist/state/context.d.ts +0 -138
- package/dist/state/context.d.ts.map +0 -1
- package/dist/state/context.js +0 -139
- package/dist/state/context.js.map +0 -1
- package/dist/state/hooks.d.ts +0 -798
- package/dist/state/hooks.d.ts.map +0 -1
- package/dist/state/hooks.js +0 -1437
- package/dist/state/hooks.js.map +0 -1
- package/dist/state/index.d.ts +0 -72
- package/dist/state/index.d.ts.map +0 -1
- package/dist/state/index.js +0 -73
- package/dist/state/index.js.map +0 -1
- package/dist/state/signal.d.ts +0 -223
- package/dist/state/signal.d.ts.map +0 -1
- package/dist/state/signal.js +0 -699
- package/dist/state/signal.js.map +0 -1
- package/dist/state/use-state.d.ts +0 -210
- package/dist/state/use-state.d.ts.map +0 -1
- package/dist/state/use-state.js +0 -327
- package/dist/state/use-state.js.map +0 -1
- package/dist/tentickle-instance.d.ts +0 -285
- package/dist/tentickle-instance.d.ts.map +0 -1
- package/dist/tentickle-instance.js +0 -700
- package/dist/tentickle-instance.js.map +0 -1
- package/dist/testing/test-model.d.ts +0 -132
- package/dist/testing/test-model.d.ts.map +0 -1
- package/dist/testing/test-model.js +0 -260
- package/dist/testing/test-model.js.map +0 -1
- package/dist/v2/reconciler/host-config.d.ts +0 -31
- package/dist/v2/reconciler/host-config.d.ts.map +0 -1
- package/dist/v2/reconciler/host-config.js +0 -197
- package/dist/v2/reconciler/host-config.js.map +0 -1
- package/dist/v2/reconciler/index.d.ts +0 -7
- package/dist/v2/reconciler/index.d.ts.map +0 -1
- package/dist/v2/reconciler/index.js +0 -7
- package/dist/v2/reconciler/index.js.map +0 -1
- package/dist/v2/reconciler/reconciler.d.ts +0 -39
- package/dist/v2/reconciler/reconciler.d.ts.map +0 -1
- package/dist/v2/reconciler/reconciler.js +0 -54
- package/dist/v2/reconciler/reconciler.js.map +0 -1
- package/dist/v2/reconciler/types.d.ts +0 -64
- package/dist/v2/reconciler/types.d.ts.map +0 -1
- package/dist/v2/reconciler/types.js +0 -20
- package/dist/v2/reconciler/types.js.map +0 -1
- package/dist/v2/renderers/index.d.ts +0 -7
- package/dist/v2/renderers/index.d.ts.map +0 -1
- package/dist/v2/renderers/index.js +0 -7
- package/dist/v2/renderers/index.js.map +0 -1
- package/dist/v2/renderers/markdown.d.ts +0 -16
- package/dist/v2/renderers/markdown.d.ts.map +0 -1
- package/dist/v2/renderers/markdown.js +0 -65
- package/dist/v2/renderers/markdown.js.map +0 -1
- package/dist/v2/renderers/types.d.ts +0 -26
- package/dist/v2/renderers/types.d.ts.map +0 -1
- package/dist/v2/renderers/types.js +0 -6
- package/dist/v2/renderers/types.js.map +0 -1
- package/dist/v2/renderers/xml.d.ts +0 -17
- package/dist/v2/renderers/xml.d.ts.map +0 -1
- package/dist/v2/renderers/xml.js +0 -73
- package/dist/v2/renderers/xml.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-block-registry.js","sourceRoot":"","sources":["../../src/compiler/content-block-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAA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C,SAAS,CAAC;QACjE,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,MAAM;YACN,KAAK;YACL,IAAI;YACJ,EAAE;YACF,OAAO;YACP,IAAI;SACW,CAAC;IACpB,CAAC,EACD,cAAc,CACf,CAAC;IAEF,yEAAyE;IACzE,yDAAyD;IACzD,4EAA4E;AAC9E,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { type JSX } from "../jsx/jsx-runtime";
|
|
2
|
-
import type { SemanticNode, Formatter } from "../renderers/base";
|
|
3
|
-
/**
|
|
4
|
-
* Fiber-like structure for text extraction.
|
|
5
|
-
* Legacy interface kept for backward compatibility.
|
|
6
|
-
*/
|
|
7
|
-
export interface FiberLike {
|
|
8
|
-
type: any;
|
|
9
|
-
props: any;
|
|
10
|
-
children: FiberLike[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Extracts semantic node tree from JSX element or fiber-like structure.
|
|
14
|
-
* Builds a semantic tree structure that preserves formatting information
|
|
15
|
-
* without applying any specific formatting syntax.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```tsx
|
|
19
|
-
* <Text>Hello <strong>world</strong> with <inlineCode>code</inlineCode></Text>
|
|
20
|
-
* ```
|
|
21
|
-
* Returns:
|
|
22
|
-
* ```typescript
|
|
23
|
-
* {
|
|
24
|
-
* children: [
|
|
25
|
-
* { text: 'Hello ' },
|
|
26
|
-
* { semantic: 'strong', children: [{ text: 'world' }] },
|
|
27
|
-
* { text: ' with ' },
|
|
28
|
-
* { semantic: 'code', children: [{ text: 'code' }] }
|
|
29
|
-
* ]
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function extractSemanticNode(fiber: FiberLike, currentFormatter?: Formatter): SemanticNode;
|
|
34
|
-
/**
|
|
35
|
-
* Extracts semantic node from JSX element (for use in content block registry).
|
|
36
|
-
* Only extracts from props.children (not fiber.children).
|
|
37
|
-
*
|
|
38
|
-
* @param element - The JSX element to extract from
|
|
39
|
-
* @param currentFormatter - The current formatter function (from FormatterBoundary)
|
|
40
|
-
*/
|
|
41
|
-
export declare function extractSemanticNodeFromElement(element: JSX.Element, currentFormatter?: Formatter): SemanticNode;
|
|
42
|
-
/**
|
|
43
|
-
* Extracts plain text from JSX element recursively (no formatting).
|
|
44
|
-
* Used for extracting text from table cells, list items, etc.
|
|
45
|
-
*/
|
|
46
|
-
export declare function extractTextFromElement(element: JSX.Element): string;
|
|
47
|
-
/**
|
|
48
|
-
* Extracts table structure from a Table JSX element.
|
|
49
|
-
* Handles both props-based (headers/rows) and children-based (Row/Column) definitions.
|
|
50
|
-
*/
|
|
51
|
-
export declare function extractTableStructure(tableElement: JSX.Element): {
|
|
52
|
-
headers: string[];
|
|
53
|
-
rows: string[][];
|
|
54
|
-
alignments?: ("left" | "center" | "right")[];
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Extracts list structure from a List JSX element.
|
|
58
|
-
*/
|
|
59
|
-
export declare function extractListStructure(listElement: JSX.Element): {
|
|
60
|
-
ordered: boolean;
|
|
61
|
-
task?: boolean;
|
|
62
|
-
items: (string | {
|
|
63
|
-
text: string;
|
|
64
|
-
checked?: boolean;
|
|
65
|
-
nested?: any;
|
|
66
|
-
})[];
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=extractors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractors.d.ts","sourceRoot":"","sources":["../../src/compiler/extractors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAa,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAgB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG/E;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB;AAkDD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,SAAS,GAAG,YAAY,CAwGhG;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,GAAG,CAAC,OAAO,EACpB,gBAAgB,CAAC,EAAE,SAAS,GAC3B,YAAY,CAyOd;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CA6BnE;AAwCD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,GAAG,CAAC,OAAO,GAAG;IAChE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC;CAC9C,CAkDA;AA6CD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,GAAG;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,CAAC,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,EAAE,CAAC;CACvE,CA4BA"}
|
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
import { isElement } from "../jsx/jsx-runtime";
|
|
2
|
-
import { Row, Column, List, ListItem } from "../jsx/components/semantic";
|
|
3
|
-
import { isBoundaryProvider, getBoundaryData } from "../state/boundary";
|
|
4
|
-
/**
|
|
5
|
-
* Map of inline element types to their semantic types.
|
|
6
|
-
* Used to convert JSX element types to semantic formatting hints.
|
|
7
|
-
*
|
|
8
|
-
* Design principle:
|
|
9
|
-
* - Capitalized components (Text, Image, Audio, Video, Document) are STRUCTURAL
|
|
10
|
-
* and create native ContentBlocks at the top level
|
|
11
|
-
* - Lowercase HTML elements (img, audio, video) are SEMANTIC and get converted
|
|
12
|
-
* to inline representations (markdown) when nested inside text content
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Single source of truth for semantic element types.
|
|
16
|
-
* These elements are handled automatically when nested inside text content.
|
|
17
|
-
* They should NOT be used at the top level - use structural components instead.
|
|
18
|
-
*/
|
|
19
|
-
const INLINE_SEMANTIC_TYPES = {
|
|
20
|
-
// Inline text formatting
|
|
21
|
-
inlineCode: "code",
|
|
22
|
-
code: "code",
|
|
23
|
-
strong: "strong",
|
|
24
|
-
b: "strong",
|
|
25
|
-
em: "em",
|
|
26
|
-
i: "em",
|
|
27
|
-
mark: "mark",
|
|
28
|
-
u: "underline",
|
|
29
|
-
s: "strikethrough",
|
|
30
|
-
del: "strikethrough",
|
|
31
|
-
sub: "subscript",
|
|
32
|
-
sup: "superscript",
|
|
33
|
-
small: "small",
|
|
34
|
-
// Links and semantic elements
|
|
35
|
-
a: "link",
|
|
36
|
-
q: "quote",
|
|
37
|
-
cite: "citation",
|
|
38
|
-
kbd: "keyboard",
|
|
39
|
-
var: "variable",
|
|
40
|
-
// Block-level semantic containers
|
|
41
|
-
p: "paragraph",
|
|
42
|
-
blockquote: "blockquote",
|
|
43
|
-
// Native HTML media elements (semantic, converted to inline markdown)
|
|
44
|
-
img: "image",
|
|
45
|
-
audio: "audio",
|
|
46
|
-
video: "video",
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Extracts semantic node tree from JSX element or fiber-like structure.
|
|
50
|
-
* Builds a semantic tree structure that preserves formatting information
|
|
51
|
-
* without applying any specific formatting syntax.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```tsx
|
|
55
|
-
* <Text>Hello <strong>world</strong> with <inlineCode>code</inlineCode></Text>
|
|
56
|
-
* ```
|
|
57
|
-
* Returns:
|
|
58
|
-
* ```typescript
|
|
59
|
-
* {
|
|
60
|
-
* children: [
|
|
61
|
-
* { text: 'Hello ' },
|
|
62
|
-
* { semantic: 'strong', children: [{ text: 'world' }] },
|
|
63
|
-
* { text: ' with ' },
|
|
64
|
-
* { semantic: 'code', children: [{ text: 'code' }] }
|
|
65
|
-
* ]
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export function extractSemanticNode(fiber, currentFormatter) {
|
|
70
|
-
const extract = (node, formatterContext) => {
|
|
71
|
-
if (typeof node === "string") {
|
|
72
|
-
return { text: node };
|
|
73
|
-
}
|
|
74
|
-
if (node && typeof node === "object") {
|
|
75
|
-
if (isElement(node)) {
|
|
76
|
-
// Get the element type as a string for lookup
|
|
77
|
-
const typeName = typeof node.type === "string" ? node.type : node.type?.name?.toLowerCase?.() || "";
|
|
78
|
-
// Extract children first
|
|
79
|
-
const children = node.props?.children;
|
|
80
|
-
let childNodes = [];
|
|
81
|
-
if (Array.isArray(children)) {
|
|
82
|
-
childNodes = children.map((child) => extract(child, formatterContext)).flat();
|
|
83
|
-
}
|
|
84
|
-
else if (children !== undefined && children !== null) {
|
|
85
|
-
const extracted = extract(children, formatterContext);
|
|
86
|
-
childNodes = Array.isArray(extracted) ? extracted : [extracted];
|
|
87
|
-
}
|
|
88
|
-
// Check if this is an inline formatting element
|
|
89
|
-
const semanticType = INLINE_SEMANTIC_TYPES[typeName];
|
|
90
|
-
if (semanticType) {
|
|
91
|
-
// For media types, capture props for inline rendering
|
|
92
|
-
if (semanticType === "image" || semanticType === "audio" || semanticType === "video") {
|
|
93
|
-
return {
|
|
94
|
-
semantic: semanticType,
|
|
95
|
-
props: node.props || {},
|
|
96
|
-
children: childNodes,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
// Return semantic node with children
|
|
100
|
-
return {
|
|
101
|
-
semantic: semanticType,
|
|
102
|
-
children: childNodes,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
// Non-semantic element - return children flattened
|
|
106
|
-
return childNodes;
|
|
107
|
-
}
|
|
108
|
-
else if ("text" in node) {
|
|
109
|
-
return { text: node.text };
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return { text: "" };
|
|
113
|
-
};
|
|
114
|
-
const children = [];
|
|
115
|
-
// Extract from props.children
|
|
116
|
-
if (fiber.props?.children) {
|
|
117
|
-
const propsChildren = Array.isArray(fiber.props.children)
|
|
118
|
-
? fiber.props.children
|
|
119
|
-
: [fiber.props.children];
|
|
120
|
-
for (const child of propsChildren) {
|
|
121
|
-
const extracted = extract(child);
|
|
122
|
-
if (Array.isArray(extracted)) {
|
|
123
|
-
children.push(...extracted);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
children.push(extracted);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// Also extract from fiber.children (semantic primitives can have children in the fiber tree)
|
|
131
|
-
for (const child of fiber.children) {
|
|
132
|
-
if (child.props?.children) {
|
|
133
|
-
const fiberChildren = Array.isArray(child.props.children)
|
|
134
|
-
? child.props.children
|
|
135
|
-
: [child.props.children];
|
|
136
|
-
for (const fiberChild of fiberChildren) {
|
|
137
|
-
const extracted = extract(fiberChild);
|
|
138
|
-
if (Array.isArray(extracted)) {
|
|
139
|
-
children.push(...extracted);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
children.push(extracted);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// Return container with children (even if single child, preserve structure)
|
|
148
|
-
if (children.length === 0) {
|
|
149
|
-
return currentFormatter ? { formatter: currentFormatter, children: [] } : { text: "" };
|
|
150
|
-
}
|
|
151
|
-
// If we have formatter context and no child has formatter, attach it to root
|
|
152
|
-
const hasFormatterInChildren = children.some((n) => n && typeof n === "object" && "formatter" in n && n.formatter !== undefined);
|
|
153
|
-
const rootNode = { children };
|
|
154
|
-
if (currentFormatter && !hasFormatterInChildren) {
|
|
155
|
-
rootNode.formatter = currentFormatter;
|
|
156
|
-
}
|
|
157
|
-
return rootNode;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Extracts semantic node from JSX element (for use in content block registry).
|
|
161
|
-
* Only extracts from props.children (not fiber.children).
|
|
162
|
-
*
|
|
163
|
-
* @param element - The JSX element to extract from
|
|
164
|
-
* @param currentFormatter - The current formatter function (from FormatterBoundary)
|
|
165
|
-
*/
|
|
166
|
-
export function extractSemanticNodeFromElement(element, currentFormatter) {
|
|
167
|
-
const extract = (node, formatterContext) => {
|
|
168
|
-
if (typeof node === "string") {
|
|
169
|
-
return { text: node };
|
|
170
|
-
}
|
|
171
|
-
if (node && typeof node === "object") {
|
|
172
|
-
if (isElement(node)) {
|
|
173
|
-
const typeName = typeof node.type === "string" ? node.type : node.type?.name?.toLowerCase?.() || "";
|
|
174
|
-
// Check for boundary provider (new pattern for XML, Markdown, etc.)
|
|
175
|
-
// Formatter boundaries have value.formatter function
|
|
176
|
-
if (isBoundaryProvider(node.type)) {
|
|
177
|
-
const boundaryData = getBoundaryData(node.type);
|
|
178
|
-
if (boundaryData.class === "formatter") {
|
|
179
|
-
const formatterValue = node.props?.value;
|
|
180
|
-
if (formatterValue?.formatter) {
|
|
181
|
-
const children = node.props?.children;
|
|
182
|
-
let childNodes = [];
|
|
183
|
-
if (Array.isArray(children)) {
|
|
184
|
-
childNodes = children
|
|
185
|
-
.map((child) => extract(child, formatterValue.formatter))
|
|
186
|
-
.flat();
|
|
187
|
-
}
|
|
188
|
-
else if (children !== undefined && children !== null) {
|
|
189
|
-
const extracted = extract(children, formatterValue.formatter);
|
|
190
|
-
childNodes = Array.isArray(extracted) ? extracted : [extracted];
|
|
191
|
-
}
|
|
192
|
-
return {
|
|
193
|
-
formatter: formatterValue.formatter,
|
|
194
|
-
children: childNodes,
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
// Check for wrapper components that return boundary providers (e.g., XML, Markdown functions)
|
|
200
|
-
if (typeof node.type === "function") {
|
|
201
|
-
// Call the component to see what it returns
|
|
202
|
-
const rendered = node.type(node.props);
|
|
203
|
-
// Check if returned element is a boundary provider
|
|
204
|
-
if (rendered &&
|
|
205
|
-
typeof rendered === "object" &&
|
|
206
|
-
"type" in rendered &&
|
|
207
|
-
isBoundaryProvider(rendered.type)) {
|
|
208
|
-
const boundaryData = getBoundaryData(rendered.type);
|
|
209
|
-
if (boundaryData.class === "formatter") {
|
|
210
|
-
const formatterValue = rendered.props?.value;
|
|
211
|
-
if (formatterValue?.formatter) {
|
|
212
|
-
const children = rendered.props?.children || node.props?.children;
|
|
213
|
-
let childNodes = [];
|
|
214
|
-
if (Array.isArray(children)) {
|
|
215
|
-
childNodes = children
|
|
216
|
-
.map((child) => extract(child, formatterValue.formatter))
|
|
217
|
-
.flat();
|
|
218
|
-
}
|
|
219
|
-
else if (children !== undefined && children !== null) {
|
|
220
|
-
const extracted = extract(children, formatterValue.formatter);
|
|
221
|
-
childNodes = Array.isArray(extracted) ? extracted : [extracted];
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
formatter: formatterValue.formatter,
|
|
225
|
-
children: childNodes,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
// Legacy: Check if returned element is a Renderer (has instance prop)
|
|
231
|
-
// This handles both direct <Renderer> usage and wrappers that return <Renderer>
|
|
232
|
-
if (rendered &&
|
|
233
|
-
typeof rendered === "object" &&
|
|
234
|
-
"props" in rendered &&
|
|
235
|
-
rendered.props?.instance) {
|
|
236
|
-
const rendererInstance = rendered.props.instance;
|
|
237
|
-
// Convert ContentRenderer to Formatter function
|
|
238
|
-
const formatter = (blocks) => rendererInstance.format(blocks);
|
|
239
|
-
const children = rendered.props?.children || node.props?.children;
|
|
240
|
-
let childNodes = [];
|
|
241
|
-
if (Array.isArray(children)) {
|
|
242
|
-
childNodes = children.map((child) => extract(child, formatter)).flat();
|
|
243
|
-
}
|
|
244
|
-
else if (children !== undefined && children !== null) {
|
|
245
|
-
const extracted = extract(children, formatter);
|
|
246
|
-
childNodes = Array.isArray(extracted) ? extracted : [extracted];
|
|
247
|
-
}
|
|
248
|
-
// Return a node with formatter attached - this marks the formatter boundary
|
|
249
|
-
return {
|
|
250
|
-
formatter: formatter,
|
|
251
|
-
children: childNodes,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
// If component returned an element but it's not a Renderer or boundary, extract from it
|
|
255
|
-
// BUT: Avoid infinite recursion when a component returns createElement(itself, props)
|
|
256
|
-
// e.g., Text(props) returns createElement(Text, props) - don't recurse into same type
|
|
257
|
-
if (rendered && typeof rendered === "object" && "type" in rendered) {
|
|
258
|
-
// Skip if the rendered element has the same type as the original - this would loop forever
|
|
259
|
-
// Check both reference equality and name equality (for cross-module scenarios)
|
|
260
|
-
const isSelfReferential = rendered.type === node.type ||
|
|
261
|
-
(typeof rendered.type === "function" &&
|
|
262
|
-
typeof node.type === "function" &&
|
|
263
|
-
rendered.type.name === node.type.name &&
|
|
264
|
-
rendered.type.name !== "");
|
|
265
|
-
if (isSelfReferential) {
|
|
266
|
-
// Instead of recursing, extract from children
|
|
267
|
-
const children = node.props?.children;
|
|
268
|
-
if (children !== undefined && children !== null) {
|
|
269
|
-
if (Array.isArray(children)) {
|
|
270
|
-
return children.map((child) => extract(child, formatterContext)).flat();
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
const extracted = extract(children, formatterContext);
|
|
274
|
-
return Array.isArray(extracted) ? extracted : [extracted];
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return { text: "" };
|
|
278
|
-
}
|
|
279
|
-
return extract(rendered, formatterContext);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
// Fallback: Check for Renderer by name (for direct usage when type is not a function)
|
|
283
|
-
if (node.type?.name === "Renderer" || typeName === "renderer") {
|
|
284
|
-
const rendererInstance = node.props?.instance;
|
|
285
|
-
// Convert ContentRenderer to Formatter function if present
|
|
286
|
-
const formatter = rendererInstance
|
|
287
|
-
? (blocks) => rendererInstance.format(blocks)
|
|
288
|
-
: undefined;
|
|
289
|
-
const children = node.props?.children;
|
|
290
|
-
let childNodes = [];
|
|
291
|
-
if (Array.isArray(children)) {
|
|
292
|
-
childNodes = children.map((child) => extract(child, formatter)).flat();
|
|
293
|
-
}
|
|
294
|
-
else if (children !== undefined && children !== null) {
|
|
295
|
-
const extracted = extract(children, formatter);
|
|
296
|
-
childNodes = Array.isArray(extracted) ? extracted : [extracted];
|
|
297
|
-
}
|
|
298
|
-
return {
|
|
299
|
-
formatter: formatter,
|
|
300
|
-
children: childNodes,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
const children = node.props?.children;
|
|
304
|
-
let childNodes = [];
|
|
305
|
-
if (Array.isArray(children)) {
|
|
306
|
-
childNodes = children.map((child) => extract(child, formatterContext)).flat();
|
|
307
|
-
}
|
|
308
|
-
else if (children !== undefined && children !== null) {
|
|
309
|
-
const extracted = extract(children, formatterContext);
|
|
310
|
-
childNodes = Array.isArray(extracted) ? extracted : [extracted];
|
|
311
|
-
}
|
|
312
|
-
const semanticType = INLINE_SEMANTIC_TYPES[typeName];
|
|
313
|
-
if (semanticType) {
|
|
314
|
-
// Only capture props that are actually needed for specific semantic types
|
|
315
|
-
let props;
|
|
316
|
-
if (semanticType === "link" && node.props?.href) {
|
|
317
|
-
props = { href: node.props.href };
|
|
318
|
-
}
|
|
319
|
-
else if ((semanticType === "image" || semanticType === "audio" || semanticType === "video") &&
|
|
320
|
-
node.props) {
|
|
321
|
-
// Capture media-specific props (src, alt, etc.) but exclude children
|
|
322
|
-
props = Object.fromEntries(Object.entries(node.props).filter(([key]) => key !== "children"));
|
|
323
|
-
}
|
|
324
|
-
// For other semantic types (strong, em, code, etc.), no props needed
|
|
325
|
-
return {
|
|
326
|
-
semantic: semanticType,
|
|
327
|
-
...(props && Object.keys(props).length > 0 ? { props } : {}),
|
|
328
|
-
children: childNodes,
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
// Unknown element - treat as custom, preserve props and tag name
|
|
332
|
-
if (typeName) {
|
|
333
|
-
return {
|
|
334
|
-
semantic: "custom",
|
|
335
|
-
props: { ...node.props, _tagName: typeName },
|
|
336
|
-
children: childNodes,
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
return childNodes;
|
|
340
|
-
}
|
|
341
|
-
else if ("text" in node) {
|
|
342
|
-
return { text: node.text };
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
return { text: "" };
|
|
346
|
-
};
|
|
347
|
-
const props = element.props || {};
|
|
348
|
-
if (props.children !== undefined && props.children !== null) {
|
|
349
|
-
const children = Array.isArray(props.children) ? props.children : [props.children];
|
|
350
|
-
const extracted = children.map((child) => extract(child, currentFormatter)).flat();
|
|
351
|
-
if (extracted.length === 0) {
|
|
352
|
-
return currentFormatter && currentFormatter !== undefined
|
|
353
|
-
? { formatter: currentFormatter, children: [] }
|
|
354
|
-
: { text: "" };
|
|
355
|
-
}
|
|
356
|
-
// If we have formatter context and root doesn't have formatter, attach it
|
|
357
|
-
const rootNode = { children: extracted };
|
|
358
|
-
if (currentFormatter &&
|
|
359
|
-
!extracted.some((n) => n && typeof n === "object" && "formatter" in n)) {
|
|
360
|
-
rootNode.formatter = currentFormatter;
|
|
361
|
-
}
|
|
362
|
-
return rootNode;
|
|
363
|
-
}
|
|
364
|
-
return currentFormatter && currentFormatter !== undefined
|
|
365
|
-
? { formatter: currentFormatter, children: [] }
|
|
366
|
-
: { text: "" };
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Extracts plain text from JSX element recursively (no formatting).
|
|
370
|
-
* Used for extracting text from table cells, list items, etc.
|
|
371
|
-
*/
|
|
372
|
-
export function extractTextFromElement(element) {
|
|
373
|
-
const extract = (node) => {
|
|
374
|
-
if (typeof node === "string") {
|
|
375
|
-
return node;
|
|
376
|
-
}
|
|
377
|
-
if (node && typeof node === "object") {
|
|
378
|
-
if (isElement(node)) {
|
|
379
|
-
const children = node.props?.children;
|
|
380
|
-
if (Array.isArray(children)) {
|
|
381
|
-
return children.map(extract).join("");
|
|
382
|
-
}
|
|
383
|
-
else if (children !== undefined && children !== null) {
|
|
384
|
-
return extract(children);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
else if ("text" in node) {
|
|
388
|
-
return node.text;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return "";
|
|
392
|
-
};
|
|
393
|
-
const props = element.props || {};
|
|
394
|
-
if (props.children !== undefined && props.children !== null) {
|
|
395
|
-
const children = Array.isArray(props.children) ? props.children : [props.children];
|
|
396
|
-
return children.map(extract).join("");
|
|
397
|
-
}
|
|
398
|
-
return "";
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Extracts cell data from a Row element.
|
|
402
|
-
*/
|
|
403
|
-
function extractRowData(rowElement) {
|
|
404
|
-
const cells = [];
|
|
405
|
-
const alignments = [];
|
|
406
|
-
const props = rowElement.props || {};
|
|
407
|
-
const rawChildren = props.children;
|
|
408
|
-
const children = Array.isArray(rawChildren)
|
|
409
|
-
? rawChildren.flat()
|
|
410
|
-
: rawChildren
|
|
411
|
-
? [rawChildren]
|
|
412
|
-
: [];
|
|
413
|
-
for (const child of children) {
|
|
414
|
-
if (!isElement(child)) {
|
|
415
|
-
// Plain string child
|
|
416
|
-
if (typeof child === "string") {
|
|
417
|
-
cells.push(child);
|
|
418
|
-
alignments.push("left");
|
|
419
|
-
}
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
if (child.type === Column || child.type === "column") {
|
|
423
|
-
const text = extractTextFromElement(child);
|
|
424
|
-
cells.push(text);
|
|
425
|
-
alignments.push(child.props?.align || "left");
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return { cells, alignments };
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Extracts table structure from a Table JSX element.
|
|
432
|
-
* Handles both props-based (headers/rows) and children-based (Row/Column) definitions.
|
|
433
|
-
*/
|
|
434
|
-
export function extractTableStructure(tableElement) {
|
|
435
|
-
const props = tableElement.props || {};
|
|
436
|
-
// If headers/rows are provided as props, use those directly
|
|
437
|
-
if (props.headers && props.rows) {
|
|
438
|
-
return {
|
|
439
|
-
headers: props.headers,
|
|
440
|
-
rows: props.rows,
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
// Otherwise, extract from Row/Column children
|
|
444
|
-
const headers = [];
|
|
445
|
-
const rows = [];
|
|
446
|
-
const alignments = [];
|
|
447
|
-
const rawChildren = props.children;
|
|
448
|
-
const children = Array.isArray(rawChildren)
|
|
449
|
-
? rawChildren.flat()
|
|
450
|
-
: rawChildren
|
|
451
|
-
? [rawChildren]
|
|
452
|
-
: [];
|
|
453
|
-
for (const child of children) {
|
|
454
|
-
if (!isElement(child))
|
|
455
|
-
continue;
|
|
456
|
-
if (child.type === Row || child.type === "row") {
|
|
457
|
-
const rowData = extractRowData(child);
|
|
458
|
-
if (child.props?.header) {
|
|
459
|
-
// This is a header row
|
|
460
|
-
headers.push(...rowData.cells);
|
|
461
|
-
if (rowData.alignments.length > 0 && alignments.length === 0) {
|
|
462
|
-
alignments.push(...rowData.alignments);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
else {
|
|
466
|
-
rows.push(rowData.cells);
|
|
467
|
-
// Capture alignments from first data row if not already set
|
|
468
|
-
if (rowData.alignments.length > 0 && alignments.length === 0) {
|
|
469
|
-
alignments.push(...rowData.alignments);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
return {
|
|
475
|
-
headers,
|
|
476
|
-
rows,
|
|
477
|
-
alignments: alignments.length > 0 ? alignments : undefined,
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Extracts data from a ListItem element, including nested lists and checked state.
|
|
482
|
-
*/
|
|
483
|
-
function extractListItemData(itemElement) {
|
|
484
|
-
const props = itemElement.props || {};
|
|
485
|
-
const rawChildren = props.children;
|
|
486
|
-
const children = Array.isArray(rawChildren)
|
|
487
|
-
? rawChildren.flat()
|
|
488
|
-
: rawChildren
|
|
489
|
-
? [rawChildren]
|
|
490
|
-
: [];
|
|
491
|
-
let text = "";
|
|
492
|
-
let nested = undefined;
|
|
493
|
-
const checked = props.checked;
|
|
494
|
-
for (const child of children) {
|
|
495
|
-
if (typeof child === "string") {
|
|
496
|
-
text += child;
|
|
497
|
-
}
|
|
498
|
-
else if (isElement(child)) {
|
|
499
|
-
if (child.type === List || child.type === "list") {
|
|
500
|
-
// Nested list
|
|
501
|
-
nested = extractListStructure(child);
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
// Other element - extract text
|
|
505
|
-
text += extractTextFromElement(child);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
// Return object form if we have nested list or checked state
|
|
510
|
-
if (nested !== undefined || checked !== undefined) {
|
|
511
|
-
return {
|
|
512
|
-
text: text.trim(),
|
|
513
|
-
...(checked !== undefined ? { checked } : {}),
|
|
514
|
-
...(nested !== undefined ? { nested } : {}),
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
return text.trim();
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Extracts list structure from a List JSX element.
|
|
521
|
-
*/
|
|
522
|
-
export function extractListStructure(listElement) {
|
|
523
|
-
const props = listElement.props || {};
|
|
524
|
-
const ordered = props.ordered === true;
|
|
525
|
-
const task = props.task === true ? true : undefined;
|
|
526
|
-
const items = [];
|
|
527
|
-
const rawChildren = props.children;
|
|
528
|
-
const children = Array.isArray(rawChildren)
|
|
529
|
-
? rawChildren.flat()
|
|
530
|
-
: rawChildren
|
|
531
|
-
? [rawChildren]
|
|
532
|
-
: [];
|
|
533
|
-
for (const child of children) {
|
|
534
|
-
if (!isElement(child)) {
|
|
535
|
-
if (typeof child === "string") {
|
|
536
|
-
items.push(child);
|
|
537
|
-
}
|
|
538
|
-
continue;
|
|
539
|
-
}
|
|
540
|
-
if (child.type === ListItem || child.type === "li" || child.type === "listitem") {
|
|
541
|
-
const itemData = extractListItemData(child);
|
|
542
|
-
items.push(itemData);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
return { ordered, ...(task ? { task } : {}), items };
|
|
546
|
-
}
|
|
547
|
-
//# sourceMappingURL=extractors.js.map
|