veryfront 0.1.369 → 0.1.371
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/esm/cli/commands/build/command.d.ts.map +1 -1
- package/esm/cli/commands/build/command.js +2 -0
- package/esm/cli/shared/ensure-content-transformer.d.ts +10 -0
- package/esm/cli/shared/ensure-content-transformer.d.ts.map +1 -0
- package/esm/cli/shared/ensure-content-transformer.js +16 -0
- package/esm/cli/shared/server-startup.d.ts.map +1 -1
- package/esm/cli/shared/server-startup.js +10 -3
- package/esm/deno.js +2 -1
- package/esm/extensions/ext-mdx/src/compiler/markdown-compile.d.ts +3 -0
- package/esm/extensions/ext-mdx/src/compiler/markdown-compile.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/compiler/markdown-compile.js +99 -0
- package/esm/extensions/ext-mdx/src/compiler/mdx-compile.d.ts +3 -0
- package/esm/extensions/ext-mdx/src/compiler/mdx-compile.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/compiler/mdx-compile.js +47 -0
- package/esm/extensions/ext-mdx/src/index.d.ts +30 -0
- package/esm/extensions/ext-mdx/src/index.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/index.js +52 -0
- package/esm/extensions/ext-mdx/src/plugins/plugin-loader.d.ts +4 -0
- package/esm/extensions/ext-mdx/src/plugins/plugin-loader.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/plugins/plugin-loader.js +18 -0
- package/esm/extensions/ext-mdx/src/plugins/rehype-node-positions.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/plugins/remark-headings.d.ts.map +1 -0
- package/esm/extensions/ext-mdx/src/plugins/remark-mdx-utils.d.ts.map +1 -0
- package/esm/src/agent/fork-runtime-stream.d.ts +4 -4
- package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/hosted-child-fork-runtime-start.d.ts +18 -0
- package/esm/src/agent/hosted-child-fork-runtime-start.d.ts.map +1 -0
- package/esm/src/agent/hosted-child-fork-runtime-start.js +41 -0
- package/esm/src/agent/hosted-child-status.d.ts +3 -2
- package/esm/src/agent/hosted-child-status.d.ts.map +1 -1
- package/esm/src/agent/index.d.ts +2 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -0
- package/esm/src/extensions/interfaces/content-transformer.d.ts +75 -24
- package/esm/src/extensions/interfaces/content-transformer.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/content-transformer.js +13 -0
- package/esm/src/extensions/interfaces/index.d.ts +1 -1
- package/esm/src/extensions/interfaces/index.d.ts.map +1 -1
- package/esm/src/integrations/schema.d.ts +4 -4
- package/esm/src/transforms/md/compiler/md-compiler.d.ts +2 -2
- package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
- package/esm/src/transforms/md/compiler/md-compiler.js +11 -106
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts +1 -1
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/index.d.ts +3 -3
- package/esm/src/transforms/mdx/compiler/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts +2 -2
- package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.js +10 -52
- package/esm/src/transforms/plugins/plugin-loader.d.ts +15 -0
- package/esm/src/transforms/plugins/plugin-loader.d.ts.map +1 -1
- package/esm/src/transforms/plugins/plugin-loader.js +20 -14
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/cli/commands/build/command.ts +2 -0
- package/src/cli/shared/ensure-content-transformer.ts +17 -0
- package/src/cli/shared/server-startup.ts +10 -3
- package/src/deno.js +2 -1
- package/src/extensions/ext-mdx/src/compiler/markdown-compile.ts +127 -0
- package/src/extensions/ext-mdx/src/compiler/mdx-compile.ts +73 -0
- package/src/extensions/ext-mdx/src/index.ts +63 -0
- package/src/extensions/ext-mdx/src/plugins/plugin-loader.ts +21 -0
- package/src/src/agent/fork-runtime-stream.ts +9 -4
- package/src/src/agent/hosted-child-fork-runtime-start.ts +84 -0
- package/src/src/agent/hosted-child-status.ts +6 -2
- package/src/src/agent/index.ts +7 -0
- package/src/src/extensions/interfaces/content-transformer.ts +74 -20
- package/src/src/extensions/interfaces/index.ts +5 -2
- package/src/src/transforms/md/compiler/md-compiler.ts +17 -137
- package/src/src/transforms/mdx/compiler/import-rewriter.ts +1 -1
- package/src/src/transforms/mdx/compiler/index.ts +11 -3
- package/src/src/transforms/mdx/compiler/mdx-compiler.ts +15 -70
- package/src/src/transforms/plugins/plugin-loader.ts +22 -24
- package/src/src/utils/version-constant.ts +1 -1
- package/esm/src/transforms/mdx/compiler/types.d.ts +0 -16
- package/esm/src/transforms/mdx/compiler/types.d.ts.map +0 -1
- package/esm/src/transforms/mdx/compiler/types.js +0 -1
- package/esm/src/transforms/plugins/rehype-node-positions.d.ts.map +0 -1
- package/esm/src/transforms/plugins/remark-headings.d.ts.map +0 -1
- package/esm/src/transforms/plugins/remark-mdx-utils.d.ts.map +0 -1
- package/src/src/transforms/mdx/compiler/types.ts +0 -12
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/rehype-node-positions.d.ts +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/rehype-node-positions.js +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-headings.d.ts +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-headings.js +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-mdx-utils.d.ts +0 -0
- /package/esm/{src/transforms → extensions/ext-mdx/src}/plugins/remark-mdx-utils.js +0 -0
- /package/src/{src/transforms → extensions/ext-mdx/src}/plugins/rehype-node-positions.ts +0 -0
- /package/src/{src/transforms → extensions/ext-mdx/src}/plugins/remark-headings.ts +0 -0
- /package/src/{src/transforms → extensions/ext-mdx/src}/plugins/remark-mdx-utils.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build/command.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFjE"}
|
|
@@ -7,6 +7,7 @@ import { displayBuildConfig, displayBuildStart } from "./config-display.js";
|
|
|
7
7
|
import { handleBuildError } from "./error-handler.js";
|
|
8
8
|
import { displayBuildSuccess } from "./stats-display.js";
|
|
9
9
|
import { isJsonMode, streamJsonLine } from "../../shared/json-output.js";
|
|
10
|
+
import { ensureBuiltinContentTransformer } from "../../shared/ensure-content-transformer.js";
|
|
10
11
|
export function buildCommand(options) {
|
|
11
12
|
return withSpan("cli.command.build", async () => {
|
|
12
13
|
const outputDir = options.outputDir ?? join(options.projectDir, "dist");
|
|
@@ -21,6 +22,7 @@ export function buildCommand(options) {
|
|
|
21
22
|
}
|
|
22
23
|
const adapter = await runtime.get();
|
|
23
24
|
await getConfig(options.projectDir, adapter);
|
|
25
|
+
ensureBuiltinContentTransformer();
|
|
24
26
|
if (isJsonMode()) {
|
|
25
27
|
streamJsonLine({ type: "step", name: "config", status: "completed" });
|
|
26
28
|
streamJsonLine({ type: "step", name: "build", status: "started" });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI ships ext-mdx baked in so the compiled binary can render MDX/Markdown
|
|
3
|
+
* pages out of the box. Library consumers (programmatic `startProductionServer`)
|
|
4
|
+
* still opt in via `veryfront.config.ts` extensions. Bootstrap's
|
|
5
|
+
* `setupAll → teardownAll → reset()` clears the contract registry, so this
|
|
6
|
+
* must run *after* the server-start (or `getConfig`) call returns. We skip
|
|
7
|
+
* registration when a user-provided extension already supplied the contract.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureBuiltinContentTransformer(): void;
|
|
10
|
+
//# sourceMappingURL=ensure-content-transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-content-transformer.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/ensure-content-transformer.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,IAAI,IAAI,CAGtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { tryResolve } from "../../src/extensions/index.js";
|
|
2
|
+
import { register } from "../../src/extensions/contracts.js";
|
|
3
|
+
import { MdxContentTransformer } from "../../extensions/ext-mdx/src/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* The CLI ships ext-mdx baked in so the compiled binary can render MDX/Markdown
|
|
6
|
+
* pages out of the box. Library consumers (programmatic `startProductionServer`)
|
|
7
|
+
* still opt in via `veryfront.config.ts` extensions. Bootstrap's
|
|
8
|
+
* `setupAll → teardownAll → reset()` clears the contract registry, so this
|
|
9
|
+
* must run *after* the server-start (or `getConfig`) call returns. We skip
|
|
10
|
+
* registration when a user-provided extension already supplied the contract.
|
|
11
|
+
*/
|
|
12
|
+
export function ensureBuiltinContentTransformer() {
|
|
13
|
+
if (tryResolve("ContentTransformer"))
|
|
14
|
+
return;
|
|
15
|
+
register("ContentTransformer", new MdxContentTransformer());
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-startup.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/server-startup.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,cAAc,EACd,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,E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C3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAuB5D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getEnv, runtime, setEnv } from "../../src/platform/index.js";
|
|
2
2
|
import { startDevServer, startProductionServer, } from "../../src/server/index.js";
|
|
3
|
+
import { ensureBuiltinContentTransformer } from "./ensure-content-transformer.js";
|
|
3
4
|
function buildDiscoveryConfig(options) {
|
|
4
5
|
const token = getEnv("VERYFRONT_API_TOKEN") ?? "";
|
|
5
6
|
const slug = getEnv("VERYFRONT_PROJECT_SLUG") ?? options.fallbackProjectSlug ?? "";
|
|
@@ -19,7 +20,7 @@ export async function startCliProxyModeServer(options) {
|
|
|
19
20
|
if (!getEnv("NODE_ENV") && !getEnv("DENO_ENV")) {
|
|
20
21
|
setEnv("NODE_ENV", "development");
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
const result = await startProductionServer({
|
|
23
24
|
port: options.port,
|
|
24
25
|
projectDir: options.projectDir,
|
|
25
26
|
signal: options.signal,
|
|
@@ -28,6 +29,8 @@ export async function startCliProxyModeServer(options) {
|
|
|
28
29
|
defaultProjectId: options.defaultProjectId,
|
|
29
30
|
discoveryConfig: buildDiscoveryConfig(options),
|
|
30
31
|
});
|
|
32
|
+
ensureBuiltinContentTransformer();
|
|
33
|
+
return result;
|
|
31
34
|
}
|
|
32
35
|
export async function startCliDevServer(options) {
|
|
33
36
|
const devOptions = {
|
|
@@ -37,7 +40,9 @@ export async function startCliDevServer(options) {
|
|
|
37
40
|
enableFastRefresh: options.enableFastRefresh,
|
|
38
41
|
signal: options.signal,
|
|
39
42
|
};
|
|
40
|
-
|
|
43
|
+
const result = await startDevServer(devOptions);
|
|
44
|
+
ensureBuiltinContentTransformer();
|
|
45
|
+
return result;
|
|
41
46
|
}
|
|
42
47
|
export async function startCliProductionServer(options) {
|
|
43
48
|
const adapter = options.adapter ?? (await runtime.get());
|
|
@@ -59,5 +64,7 @@ export async function startCliProductionServer(options) {
|
|
|
59
64
|
// through `/_veryfront/rsc/module?` for non-local deployments, so no
|
|
60
65
|
// `localProjects` entry is required for the compiled binary to work.
|
|
61
66
|
};
|
|
62
|
-
|
|
67
|
+
const result = await startProductionServer(serverOptions);
|
|
68
|
+
ensureBuiltinContentTransformer();
|
|
69
|
+
return result;
|
|
63
70
|
}
|
package/esm/deno.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.371",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"workspace": [
|
|
7
7
|
"./extensions/ext-anthropic",
|
|
8
8
|
"./extensions/ext-babel",
|
|
9
9
|
"./extensions/ext-jwt",
|
|
10
|
+
"./extensions/ext-mdx",
|
|
10
11
|
"./extensions/ext-node-compat",
|
|
11
12
|
"./extensions/ext-openai",
|
|
12
13
|
"./extensions/ext-opentelemetry",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-compile.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/compiler/markdown-compile.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAkDlH,wBAAsB,eAAe,CACnC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA4D/B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { unified } from "unified";
|
|
2
|
+
import remarkParse from "remark-parse";
|
|
3
|
+
import remarkGfm from "remark-gfm";
|
|
4
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
5
|
+
import remarkRehype from "remark-rehype";
|
|
6
|
+
import rehypeStarryNight from "rehype-starry-night";
|
|
7
|
+
import rehypeSlug from "rehype-slug";
|
|
8
|
+
import rehypeRaw from "rehype-raw";
|
|
9
|
+
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
|
|
10
|
+
import rehypeStringify from "rehype-stringify";
|
|
11
|
+
import { visit } from "unist-util-visit";
|
|
12
|
+
import { toString } from "mdast-util-to-string";
|
|
13
|
+
import Slugger from "github-slugger";
|
|
14
|
+
import { extractFrontmatter } from "../../../../src/transforms/mdx/compiler/frontmatter-extractor.js";
|
|
15
|
+
import { isMarkdownPreview } from "../../../../src/transforms/md/utils.js";
|
|
16
|
+
import { rehypeNodePositions } from "../plugins/rehype-node-positions.js";
|
|
17
|
+
function remarkExtractHeadings(headings) {
|
|
18
|
+
const slugger = new Slugger();
|
|
19
|
+
return (tree) => {
|
|
20
|
+
visit(tree, "heading", (node) => {
|
|
21
|
+
const text = toString(node);
|
|
22
|
+
const id = slugger.slug(text);
|
|
23
|
+
headings.push({ id, text, level: node.depth });
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function escapeForJsString(str) {
|
|
28
|
+
return str.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
29
|
+
}
|
|
30
|
+
function createCompiledCode(escapedHtml, isPreview) {
|
|
31
|
+
const injector = `dangerouslySetInnerHTML: { __html: \`${escapedHtml}\` }`;
|
|
32
|
+
if (isPreview) {
|
|
33
|
+
return `import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
|
+
export default function MDContent({ components, params, ...props }) {
|
|
35
|
+
return _jsx("div", {
|
|
36
|
+
className: "markdown-body",
|
|
37
|
+
${injector}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
return `import { jsx as _jsx } from "react/jsx-runtime";
|
|
43
|
+
export default function MDContent({ components, params, className, ...props }) {
|
|
44
|
+
return _jsx("div", {
|
|
45
|
+
className,
|
|
46
|
+
${injector}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
export async function compileMarkdown(options) {
|
|
52
|
+
const { content, frontmatter: providedFrontmatter, filePath, studioEmbed } = options;
|
|
53
|
+
const { body, frontmatter: extractedFrontmatter } = extractFrontmatter(content, providedFrontmatter);
|
|
54
|
+
const headings = [];
|
|
55
|
+
const pipeline = unified()
|
|
56
|
+
.use(remarkParse)
|
|
57
|
+
.use(remarkGfm)
|
|
58
|
+
.use(remarkFrontmatter)
|
|
59
|
+
.use(remarkExtractHeadings, headings)
|
|
60
|
+
.use(remarkRehype, { allowDangerousHtml: true })
|
|
61
|
+
.use(rehypeStarryNight)
|
|
62
|
+
.use(rehypeSlug);
|
|
63
|
+
pipeline.use(rehypeRaw);
|
|
64
|
+
if (studioEmbed && filePath) {
|
|
65
|
+
pipeline.use(rehypeNodePositions, { filePath });
|
|
66
|
+
}
|
|
67
|
+
const sanitizeSchema = studioEmbed
|
|
68
|
+
? {
|
|
69
|
+
...defaultSchema,
|
|
70
|
+
attributes: {
|
|
71
|
+
...defaultSchema.attributes,
|
|
72
|
+
"*": [
|
|
73
|
+
...(defaultSchema.attributes?.["*"] ?? []),
|
|
74
|
+
"data-node-file",
|
|
75
|
+
"data-node-name",
|
|
76
|
+
"data-node-line",
|
|
77
|
+
"data-node-column",
|
|
78
|
+
"data-node-source",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
}
|
|
82
|
+
: defaultSchema;
|
|
83
|
+
const result = await pipeline
|
|
84
|
+
.use(rehypeSanitize, sanitizeSchema)
|
|
85
|
+
.use(rehypeStringify)
|
|
86
|
+
.process(body);
|
|
87
|
+
const html = String(result);
|
|
88
|
+
const escapedHtml = escapeForJsString(html);
|
|
89
|
+
const isPreview = isMarkdownPreview(filePath, extractedFrontmatter);
|
|
90
|
+
const compiledCode = createCompiledCode(escapedHtml, isPreview);
|
|
91
|
+
return {
|
|
92
|
+
compiledCode,
|
|
93
|
+
frontmatter: extractedFrontmatter,
|
|
94
|
+
globals: {},
|
|
95
|
+
headings,
|
|
96
|
+
nodeMap: new Map(),
|
|
97
|
+
rawHtml: html,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-compile.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/compiler/mdx-compile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAQlH,wBAAsB,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA8D9F"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { compile } from "@mdx-js/mdx";
|
|
2
|
+
import { extractFrontmatter } from "../../../../src/transforms/mdx/compiler/frontmatter-extractor.js";
|
|
3
|
+
import { rewriteBodyImports, rewriteCompiledImports } from "../../../../src/transforms/mdx/compiler/import-rewriter.js";
|
|
4
|
+
import { getRehypePlugins, getRemarkPlugins } from "../plugins/plugin-loader.js";
|
|
5
|
+
import { rehypeNodePositions } from "../plugins/rehype-node-positions.js";
|
|
6
|
+
export async function compileMdx(options) {
|
|
7
|
+
const { projectDir, content, frontmatter: providedFrontmatter, filePath, target = "server", baseUrl, studioEmbed, } = options;
|
|
8
|
+
const remarkPlugins = getRemarkPlugins();
|
|
9
|
+
const rehypePlugins = getRehypePlugins();
|
|
10
|
+
if (studioEmbed && filePath) {
|
|
11
|
+
rehypePlugins.push([rehypeNodePositions, { filePath }]);
|
|
12
|
+
}
|
|
13
|
+
const { body: extractedBody, frontmatter: extractedFrontmatter } = extractFrontmatter(content, providedFrontmatter);
|
|
14
|
+
const shouldRewriteImports = Boolean(filePath) &&
|
|
15
|
+
(target === "browser" || target === "server");
|
|
16
|
+
const body = shouldRewriteImports
|
|
17
|
+
? rewriteBodyImports(extractedBody, { filePath: filePath, target, baseUrl, projectDir })
|
|
18
|
+
: extractedBody;
|
|
19
|
+
const compiled = await compile(body, {
|
|
20
|
+
outputFormat: "program",
|
|
21
|
+
// Always false: @mdx-js/mdx development mode emits extra JSX
|
|
22
|
+
// transforms that break the existing rendering pipeline.
|
|
23
|
+
development: false,
|
|
24
|
+
remarkPlugins,
|
|
25
|
+
rehypePlugins,
|
|
26
|
+
providerImportSource: undefined,
|
|
27
|
+
jsxImportSource: "react",
|
|
28
|
+
});
|
|
29
|
+
const headings = compiled.data?.headings ??
|
|
30
|
+
[];
|
|
31
|
+
const compiledString = String(compiled);
|
|
32
|
+
const compiledCode = shouldRewriteImports
|
|
33
|
+
? rewriteCompiledImports(compiledString, {
|
|
34
|
+
filePath: filePath,
|
|
35
|
+
target,
|
|
36
|
+
baseUrl,
|
|
37
|
+
projectDir,
|
|
38
|
+
})
|
|
39
|
+
: compiledString;
|
|
40
|
+
return {
|
|
41
|
+
compiledCode,
|
|
42
|
+
frontmatter: extractedFrontmatter,
|
|
43
|
+
globals: {},
|
|
44
|
+
headings,
|
|
45
|
+
nodeMap: new Map(),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-mdx — ContentTransformer implementation backed by MDX + remark/rehype.
|
|
3
|
+
*
|
|
4
|
+
* Provides the `ContentTransformer` contract:
|
|
5
|
+
* - `compileMdx(options)` — runs @mdx-js/mdx through veryfront's remark +
|
|
6
|
+
* rehype plugin stack and returns compiled ESM plus extracted headings
|
|
7
|
+
* and frontmatter.
|
|
8
|
+
* - `compileMarkdown(options)` — runs a unified markdown pipeline
|
|
9
|
+
* (remark-parse → remark-rehype → rehype-sanitize → rehype-stringify)
|
|
10
|
+
* producing sanitized HTML wrapped in a React component.
|
|
11
|
+
*
|
|
12
|
+
* Core's `src/transforms/md/compiler` and `src/transforms/mdx/compiler`
|
|
13
|
+
* resolve this contract at call time. When the extension is not installed,
|
|
14
|
+
* core throws an actionable install message (see
|
|
15
|
+
* `src/extensions/recommendations.ts`).
|
|
16
|
+
*
|
|
17
|
+
* @module extensions/ext-mdx
|
|
18
|
+
*/
|
|
19
|
+
import type { ExtensionFactory } from "../../../src/extensions/index.js";
|
|
20
|
+
import type { ContentCompileOptions, ContentPlugin, ContentRuntimeBundle, ContentTransformer } from "../../../src/extensions/interfaces/index.js";
|
|
21
|
+
declare class MdxContentTransformer implements ContentTransformer {
|
|
22
|
+
compileMdx(options: ContentCompileOptions): Promise<ContentRuntimeBundle>;
|
|
23
|
+
compileMarkdown(options: ContentCompileOptions): Promise<ContentRuntimeBundle>;
|
|
24
|
+
getRemarkPlugins(): ContentPlugin[];
|
|
25
|
+
getRehypePlugins(): ContentPlugin[];
|
|
26
|
+
}
|
|
27
|
+
declare const extMdx: ExtensionFactory;
|
|
28
|
+
export default extMdx;
|
|
29
|
+
export { MdxContentTransformer };
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-mdx/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,6CAA6C,CAAC;AAKrD,cAAM,qBAAsB,YAAW,kBAAkB;IACvD,UAAU,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAGzE,eAAe,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAG9E,gBAAgB,IAAI,aAAa,EAAE;IAGnC,gBAAgB,IAAI,aAAa,EAAE;CAGpC;AAED,QAAA,MAAM,MAAM,EAAE,gBAcb,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ext-mdx — ContentTransformer implementation backed by MDX + remark/rehype.
|
|
3
|
+
*
|
|
4
|
+
* Provides the `ContentTransformer` contract:
|
|
5
|
+
* - `compileMdx(options)` — runs @mdx-js/mdx through veryfront's remark +
|
|
6
|
+
* rehype plugin stack and returns compiled ESM plus extracted headings
|
|
7
|
+
* and frontmatter.
|
|
8
|
+
* - `compileMarkdown(options)` — runs a unified markdown pipeline
|
|
9
|
+
* (remark-parse → remark-rehype → rehype-sanitize → rehype-stringify)
|
|
10
|
+
* producing sanitized HTML wrapped in a React component.
|
|
11
|
+
*
|
|
12
|
+
* Core's `src/transforms/md/compiler` and `src/transforms/mdx/compiler`
|
|
13
|
+
* resolve this contract at call time. When the extension is not installed,
|
|
14
|
+
* core throws an actionable install message (see
|
|
15
|
+
* `src/extensions/recommendations.ts`).
|
|
16
|
+
*
|
|
17
|
+
* @module extensions/ext-mdx
|
|
18
|
+
*/
|
|
19
|
+
import { compileMdx } from "./compiler/mdx-compile.js";
|
|
20
|
+
import { compileMarkdown } from "./compiler/markdown-compile.js";
|
|
21
|
+
import { getRehypePlugins, getRemarkPlugins } from "./plugins/plugin-loader.js";
|
|
22
|
+
class MdxContentTransformer {
|
|
23
|
+
compileMdx(options) {
|
|
24
|
+
return compileMdx(options);
|
|
25
|
+
}
|
|
26
|
+
compileMarkdown(options) {
|
|
27
|
+
return compileMarkdown(options);
|
|
28
|
+
}
|
|
29
|
+
getRemarkPlugins() {
|
|
30
|
+
return getRemarkPlugins();
|
|
31
|
+
}
|
|
32
|
+
getRehypePlugins() {
|
|
33
|
+
return getRehypePlugins();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const extMdx = () => {
|
|
37
|
+
const impl = new MdxContentTransformer();
|
|
38
|
+
return {
|
|
39
|
+
name: "ext-mdx",
|
|
40
|
+
version: "0.1.0",
|
|
41
|
+
capabilities: [{ type: "contract", name: "ContentTransformer" }],
|
|
42
|
+
setup(ctx) {
|
|
43
|
+
ctx.provide("ContentTransformer", impl);
|
|
44
|
+
ctx.logger.info("[ext-mdx] ContentTransformer registered");
|
|
45
|
+
},
|
|
46
|
+
teardown() {
|
|
47
|
+
// No resources to release.
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default extMdx;
|
|
52
|
+
export { MdxContentTransformer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQzC,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAQ9C;AAED,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAE9C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import rehypeHighlight from "rehype-highlight";
|
|
2
|
+
import rehypeSlug from "rehype-slug";
|
|
3
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
4
|
+
import remarkGfm from "remark-gfm";
|
|
5
|
+
import { remarkMdxHeadings } from "./remark-headings.js";
|
|
6
|
+
import { remarkCodeBlocks, remarkMdxRemoveParagraphs } from "./remark-mdx-utils.js";
|
|
7
|
+
export function getRemarkPlugins() {
|
|
8
|
+
return [
|
|
9
|
+
remarkGfm,
|
|
10
|
+
remarkFrontmatter,
|
|
11
|
+
remarkMdxHeadings,
|
|
12
|
+
remarkMdxRemoveParagraphs,
|
|
13
|
+
remarkCodeBlocks,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
export function getRehypePlugins() {
|
|
17
|
+
return [rehypeHighlight, rehypeSlug];
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-node-positions.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/rehype-node-positions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,aAAa,CAAC;AAGjD,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAoCtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-headings.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/remark-headings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AA0BnC,wBAAgB,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CA8DrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-mdx-utils.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/ext-mdx/src/plugins/remark-mdx-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAoGnC;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CA6EhE;AAYD,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAmBvD;AAQD,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAmBpE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HostToolSet, type Tool, type TraceHostToolsOptions } from "../tool/index.js";
|
|
1
|
+
import { type HostToolSet, type HostToolTraceAttributes, type Tool, type TraceHostToolsOptions } from "../tool/index.js";
|
|
2
2
|
import type { AgUiRuntimeStreamEvent } from "./ag-ui-browser-encoder.js";
|
|
3
3
|
import type { AgentResponse, Message as AgentMessage } from "./schemas/index.js";
|
|
4
4
|
interface ForkStreamPart {
|
|
@@ -146,13 +146,13 @@ export type StartAgentRuntimeForkInput = {
|
|
|
146
146
|
prepareStep?: ForkRuntimeStepPreparer;
|
|
147
147
|
runStep?: AgentRuntimeForkStepRunner;
|
|
148
148
|
};
|
|
149
|
-
export type StartAgentRuntimeForkWithHostToolsInput = Omit<StartAgentRuntimeForkInput, "forkToolNames" | "model" | "runtimeTools"> & {
|
|
149
|
+
export type StartAgentRuntimeForkWithHostToolsInput<TAttributes extends HostToolTraceAttributes = HostToolTraceAttributes> = Omit<StartAgentRuntimeForkInput, "forkToolNames" | "model" | "runtimeTools"> & {
|
|
150
150
|
provider: string;
|
|
151
151
|
forkModel: string;
|
|
152
152
|
forkTools: HostToolSet;
|
|
153
|
-
traceTools?: TraceHostToolsOptions
|
|
153
|
+
traceTools?: TraceHostToolsOptions<TAttributes>;
|
|
154
154
|
};
|
|
155
|
-
export declare function startAgentRuntimeForkWithHostTools(input: StartAgentRuntimeForkWithHostToolsInput): {
|
|
155
|
+
export declare function startAgentRuntimeForkWithHostTools<TAttributes extends HostToolTraceAttributes = HostToolTraceAttributes>(input: StartAgentRuntimeForkWithHostToolsInput<TAttributes>): {
|
|
156
156
|
streamResult: ForkRuntimeStreamResult;
|
|
157
157
|
forkToolNames: string[];
|
|
158
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork-runtime-stream.d.ts","sourceRoot":"","sources":["../../../src/src/agent/fork-runtime-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,IAAI,EAET,KAAK,qBAAqB,EAC3B,M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AA0B,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,uCAAuC,
|
|
1
|
+
{"version":3,"file":"fork-runtime-stream.d.ts","sourceRoot":"","sources":["../../../src/src/agent/fork-runtime-stream.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EAET,KAAK,qBAAqB,EAC3B,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAazE,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjF,UAAU,cAAc;IACtB,IAAI,EAAE,iBAAiB,GAAG,YAAY,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,UAAU,iBAAiB;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,KAAK,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,6BAA6B,GACnC,QAAQ,EAAE,CAqJZ;AAED,2DAA2D;AAC3D,wBAAgB,0BAA0B,CACxC,KAAK,GAAE;IAAE,MAAM,CAAC,EAAE,uBAAuB,CAAA;CAAO,GAC/C,6BAA6B,CAE/B;AAED,sDAAsD;AACtD,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,sBAAsB,EAC7B,KAAK,EAAE,6BAA6B,GACnC,QAAQ,EAAE,CAEZ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HostToolTraceAttributes } from "../tool/index.js";
|
|
2
|
+
import { type ForkRuntimeStreamResult, type StartAgentRuntimeForkWithHostToolsInput } from "./fork-runtime-stream.js";
|
|
3
|
+
import { type HostedChildRunIdentifiers, type MonitorHostedChildRunStatusInput } from "./hosted-child-status.js";
|
|
4
|
+
export type HostedChildRunStatusMonitor = (input: MonitorHostedChildRunStatusInput) => Promise<void>;
|
|
5
|
+
export type StartHostedChildForkRuntimeWithHostToolsInput<TAttributes extends HostToolTraceAttributes = HostToolTraceAttributes> = StartAgentRuntimeForkWithHostToolsInput<TAttributes> & {
|
|
6
|
+
durableChildRun?: HostedChildRunIdentifiers;
|
|
7
|
+
childRunMonitorPollIntervalMs?: number;
|
|
8
|
+
monitorChildRunStatus?: HostedChildRunStatusMonitor;
|
|
9
|
+
};
|
|
10
|
+
export interface StartedHostedChildForkRuntime {
|
|
11
|
+
forkStreamAbortController: AbortController;
|
|
12
|
+
childRunMonitorAbortController: AbortController | null;
|
|
13
|
+
childRunMonitorPromise: Promise<void>;
|
|
14
|
+
streamResult: ForkRuntimeStreamResult;
|
|
15
|
+
forkToolNames: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function startHostedChildForkRuntimeWithHostTools<TAttributes extends HostToolTraceAttributes = HostToolTraceAttributes>(input: StartHostedChildForkRuntimeWithHostToolsInput<TAttributes>): StartedHostedChildForkRuntime;
|
|
18
|
+
//# sourceMappingURL=hosted-child-fork-runtime-start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-child-fork-runtime-start.d.ts","sourceRoot":"","sources":["../../../src/src/agent/hosted-child-fork-runtime-start.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,KAAK,uBAAuB,EAE5B,KAAK,uCAAuC,EAC7C,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,yBAAyB,EAE9B,KAAK,gCAAgC,EACtC,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,2BAA2B,GAAG,CACxC,KAAK,EAAE,gCAAgC,KACpC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,MAAM,6CAA6C,CACvD,WAAW,SAAS,uBAAuB,GAAG,uBAAuB,IACnE,uCAAuC,CAAC,WAAW,CAAC,GAAG;IACzD,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,qBAAqB,CAAC,EAAE,2BAA2B,CAAC;CACrD,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C,yBAAyB,EAAE,eAAe,CAAC;IAC3C,8BAA8B,EAAE,eAAe,GAAG,IAAI,CAAC;IACvD,sBAAsB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,YAAY,EAAE,uBAAuB,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAgB,wCAAwC,CACtD,WAAW,SAAS,uBAAuB,GAAG,uBAAuB,EAErE,KAAK,EAAE,6CAA6C,CAAC,WAAW,CAAC,GAChE,6BAA6B,CA8C/B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { startAgentRuntimeForkWithHostTools, } from "./fork-runtime-stream.js";
|
|
2
|
+
import { monitorHostedChildRunStatus, } from "./hosted-child-status.js";
|
|
3
|
+
import { composeAbortSignals } from "./hosted-child-stream-watchdog.js";
|
|
4
|
+
export function startHostedChildForkRuntimeWithHostTools(input) {
|
|
5
|
+
const { durableChildRun, childRunMonitorPollIntervalMs, monitorChildRunStatus, abortSignal, ...runtimeInput } = input;
|
|
6
|
+
const forkStreamAbortController = new AbortController();
|
|
7
|
+
const forkStreamAbortSignal = composeAbortSignals([
|
|
8
|
+
abortSignal,
|
|
9
|
+
forkStreamAbortController.signal,
|
|
10
|
+
]);
|
|
11
|
+
const childRunMonitorAbortController = durableChildRun ? new AbortController() : null;
|
|
12
|
+
const childRunMonitorSignal = childRunMonitorAbortController
|
|
13
|
+
? composeAbortSignals([abortSignal, childRunMonitorAbortController.signal])
|
|
14
|
+
: undefined;
|
|
15
|
+
const monitor = monitorChildRunStatus ?? monitorHostedChildRunStatus;
|
|
16
|
+
const childRunMonitorPromise = durableChildRun
|
|
17
|
+
? monitor({
|
|
18
|
+
authToken: runtimeInput.authToken,
|
|
19
|
+
apiUrl: runtimeInput.apiUrl,
|
|
20
|
+
identifiers: durableChildRun,
|
|
21
|
+
abortSignal: childRunMonitorSignal,
|
|
22
|
+
pollIntervalMs: childRunMonitorPollIntervalMs ?? 2_000,
|
|
23
|
+
onTerminal: (error) => {
|
|
24
|
+
if (!forkStreamAbortController.signal.aborted) {
|
|
25
|
+
forkStreamAbortController.abort(error);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
: Promise.resolve();
|
|
30
|
+
const { streamResult, forkToolNames } = startAgentRuntimeForkWithHostTools({
|
|
31
|
+
...runtimeInput,
|
|
32
|
+
abortSignal: forkStreamAbortSignal,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
forkStreamAbortController,
|
|
36
|
+
childRunMonitorAbortController,
|
|
37
|
+
childRunMonitorPromise,
|
|
38
|
+
streamResult,
|
|
39
|
+
forkToolNames,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -21,13 +21,14 @@ export declare class HostedChildTerminalStateError extends Error {
|
|
|
21
21
|
constructor(status: HostedChildTerminalStatus, identifiers: HostedChildRunIdentifiers);
|
|
22
22
|
}
|
|
23
23
|
export declare function resolveHostedChildTerminalErrorCode(status: HostedChildTerminalStatus): HostedChildTerminalErrorCode;
|
|
24
|
-
export
|
|
24
|
+
export interface MonitorHostedChildRunStatusInput {
|
|
25
25
|
authToken: string;
|
|
26
26
|
apiUrl: string;
|
|
27
27
|
identifiers: HostedChildRunIdentifiers;
|
|
28
28
|
abortSignal?: AbortSignal;
|
|
29
29
|
pollIntervalMs: number;
|
|
30
30
|
onTerminal: (error: HostedChildTerminalStateError) => void;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
|
+
export declare function monitorHostedChildRunStatus(input: MonitorHostedChildRunStatusInput): Promise<void>;
|
|
32
33
|
export {};
|
|
33
34
|
//# sourceMappingURL=hosted-child-status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-child-status.d.ts","sourceRoot":"","sources":["../../../src/src/agent/hosted-child-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,yBAAyB,EAAsB,MAAM,cAAc,CAAC;AAElF,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B,EAAE,MAAM,CAAC;CACrC;AAED,KAAK,2BAA2B,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;AAEvE,eAAO,MAAM,6BAA6B;;;;EAIxC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GACtC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAErF,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,4BAA4B,CAMvC;AAED,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,2BAA2B,EAC3B,WAAW,GAAG,QAA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AAyB,GAChC,4BAA4B,CAS9B;AA2BD,MAAM,WAAW,gCAAgC;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,yBAAyB,CAAC;IACvC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,CAAC,KAAK,EAAE,6BAA6B,KAAK,IAAI,CAAC;CAC5D;AAED,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,gCAAgC,GACtC,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
package/esm/src/agent/index.d.ts
CHANGED
|
@@ -140,7 +140,8 @@ export { type ActiveConversationRunStatus, appendConversationRunEvents, AppendCo
|
|
|
140
140
|
export { buildInvokeAgentChildRunLifecycleCustomEvent, buildInvokeAgentChildRunProgressEvents, buildInvokeAgentChildRunStateDelta, type InvokeAgentChildRunLifecycleCustomEvent, InvokeAgentChildRunLifecycleCustomEventSchema, type InvokeAgentChildRunLifecycleValue, InvokeAgentChildRunLifecycleValueSchema, type InvokeAgentChildRunProgressEvent, type InvokeAgentChildRunProgressInput, type InvokeAgentChildRunStateDelta, InvokeAgentChildRunStateDeltaSchema, publishInvokeAgentChildRunProgress, } from "./invoke-agent-child-runs.js";
|
|
141
141
|
export { type HostedChildExecutionLifecycleOptions, type HostedChildExecutionLifecycleResult, type HostedChildLifecycleAdapter, type HostedChildLifecycleRunnerOptions, type HostedChildLifecycleRunResult, type HostedChildLifecycleTerminalState, runHostedChildExecutionLifecycle, runHostedChildLifecycle, shouldSkipHostedChildTerminalPersistence, } from "./hosted-child-lifecycle.js";
|
|
142
142
|
export { appendHostedChildMirrorChunk, closeHostedChildReasoningSegment, closeHostedChildTextSegment, createHostedChildMirrorContext, type HostedChildChunkMirror, type HostedChildMirrorContext, type HostedChildMirrorPart, type HostedChildMirrorState, isAlreadyMirroredHostedChunk, toMirroredHostedStreamPart, } from "./hosted-child-mirror.js";
|
|
143
|
-
export { type
|
|
143
|
+
export { type HostedChildRunStatusMonitor, type StartedHostedChildForkRuntime, startHostedChildForkRuntimeWithHostTools, type StartHostedChildForkRuntimeWithHostToolsInput, } from "./hosted-child-fork-runtime-start.js";
|
|
144
|
+
export { type HostedChildRunIdentifiers, type HostedChildTerminalErrorCode, hostedChildTerminalErrorCodes, HostedChildTerminalStateError, type HostedChildTerminalStatus, isHostedChildTerminalErrorCode, monitorHostedChildRunStatus, type MonitorHostedChildRunStatusInput, resolveHostedChildTerminalErrorCode, } from "./hosted-child-status.js";
|
|
144
145
|
export { type HostedLifecycleAdapter, type HostedLifecycleExecution, type HostedLifecycleRunnerOptions, type HostedLifecycleRunResult, type HostedLifecycleTerminalState, runHostedLifecycle, } from "./hosted-lifecycle.js";
|
|
145
146
|
export { type HostedResponseStreamHeartbeat, type HostedResponseStreamHeartbeatState, type HostedResponseStreamWriter, runHostedResponseStreamWithHeartbeat, } from "./hosted-response-stream.js";
|
|
146
147
|
export { mergeToolCallInput, mergeToolInputDelta, parseDataStreamSseEvents, parseToolInputObject, streamDataStreamEvents, stripLeadingEmptyObjectPlaceholder, } from "./data-stream.js";
|