@kingsoftcloud/agentkit-harness-ui 0.0.0-stage → 0.0.2

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.
Files changed (56) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +116 -0
  3. package/README.md +292 -2
  4. package/markdown/build/build-markdown.cjs +66 -0
  5. package/markdown/dist/THIRD_PARTY_LICENSES.txt +2993 -0
  6. package/markdown/dist/markdown.css +1 -0
  7. package/markdown/dist/markdown.mjs +325 -0
  8. package/markdown/source/markdown-factory.mjs +613 -0
  9. package/markdown/source/markdown.css +288 -0
  10. package/markdown/source/table-factory.mjs +1588 -0
  11. package/markdown/source/table.css +487 -0
  12. package/package.json +96 -4
  13. package/src/activity-groups.mjs +74 -0
  14. package/src/browser-response-groups.mjs +57 -0
  15. package/src/command-output.mjs +57 -0
  16. package/src/components.mjs +9 -0
  17. package/src/context-markers.mjs +19 -0
  18. package/src/context-status.mjs +34 -0
  19. package/src/diff.mjs +240 -0
  20. package/src/explore-tool-call.mjs +139 -0
  21. package/src/file-preview.mjs +50 -0
  22. package/src/host/native-a2a.mjs +90 -0
  23. package/src/host/native-child-file-pane.mjs +49 -0
  24. package/src/host/native-child-pane.mjs +94 -0
  25. package/src/host/native-command-pane.mjs +64 -0
  26. package/src/host/native-run-panel.mjs +202 -0
  27. package/src/host/session-task-events.mjs +247 -0
  28. package/src/host/state/native-a2a.mjs +122 -0
  29. package/src/host/state/native-child-observation.mjs +35 -0
  30. package/src/host/state/native-children.mjs +93 -0
  31. package/src/host/state/native-outcome.mjs +35 -0
  32. package/src/host/state/native-recovery.mjs +187 -0
  33. package/src/host/state/native-runtime-route.mjs +26 -0
  34. package/src/host/state/native-session-stop.mjs +40 -0
  35. package/src/host/state/native-status-panel.mjs +23 -0
  36. package/src/host/state/native-task-read-model.mjs +89 -0
  37. package/src/host/state/task-links.mjs +40 -0
  38. package/src/host/task-timeline.mjs +185 -0
  39. package/src/index.mjs +52 -0
  40. package/src/input-preview.mjs +44 -0
  41. package/src/inspector.mjs +40 -0
  42. package/src/project.mjs +132 -0
  43. package/src/protocol.mjs +362 -0
  44. package/src/react-binding.mjs +486 -0
  45. package/src/reducer.mjs +355 -0
  46. package/src/renderers.mjs +644 -0
  47. package/src/status-panel.mjs +1156 -0
  48. package/src/styles.mjs +278 -0
  49. package/src/summary-playback.mjs +39 -0
  50. package/src/summary.mjs +160 -0
  51. package/src/terminal.mjs +157 -0
  52. package/src/tool-detail.mjs +208 -0
  53. package/src/tool-error.mjs +33 -0
  54. package/src/tool-identity.mjs +40 -0
  55. package/src/view.mjs +364 -0
  56. package/src/work-segments.mjs +41 -0
@@ -0,0 +1,66 @@
1
+ // Build-time dependency bundling. The browser uses only its host's React.
2
+ const fs = require('node:fs');
3
+ const path = require('node:path');
4
+ const {createRequire} = require('node:module');
5
+ const root = path.resolve(__dirname, '../..');
6
+ const source = path.join(root, 'markdown/source');
7
+ const dist = path.join(root, 'markdown/dist');
8
+ const requireBuild = createRequire(path.join(root, 'package.json'));
9
+ const esbuild = requireBuild('esbuild');
10
+ const externals = ['react', 'react-dom', 'react/jsx-runtime'];
11
+ const nodePaths = [];
12
+ for (let dir = root;; dir = path.dirname(dir)) {
13
+ nodePaths.push(path.join(dir, 'node_modules'));
14
+ if (path.dirname(dir) === dir) break;
15
+ }
16
+
17
+ async function main() {
18
+ fs.mkdirSync(dist, {recursive: true});
19
+ const result = await esbuild.build({
20
+ absWorkingDir: source, entryPoints: [path.join(source, 'markdown-factory.mjs')],
21
+ bundle: true, format: 'cjs', platform: 'neutral', conditions: ['import', 'module', 'default'],
22
+ mainFields: ['module', 'main'], target: ['es2022'], minify: true,
23
+ define: {'process.env.NODE_ENV': '"production"'}, external: externals,
24
+ nodePaths, write: false, metafile: true, legalComments: 'inline',
25
+ });
26
+ for (const output of Object.values(result.metafile.outputs))
27
+ for (const entry of output.imports) if (entry.external && !externals.includes(entry.path))
28
+ throw Error('Unexpected Markdown runtime dependency: ' + entry.path);
29
+ for (const file of Object.keys(result.metafile.inputs))
30
+ if (/(?:^|\/)node_modules\/(?:react|react-dom|react-is)\//.test(file))
31
+ throw Error('A React implementation was bundled: ' + file);
32
+ const css = await esbuild.build({
33
+ absWorkingDir: source, entryPoints: [path.join(source, 'markdown.css')], bundle: true,
34
+ nodePaths, write: false, minify: true, legalComments: 'inline',
35
+ });
36
+ const bundled = result.outputFiles[0].text;
37
+ const stylesheet = css.outputFiles[0].text;
38
+ const factory = `// Generated from markdown/source; see THIRD_PARTY_LICENSES.txt.\nexport const markdownStyles = ${JSON.stringify(stylesheet)};\nexport function createMarkdownComponents(React, ReactDOM) {\n if (!React?.createElement || !ReactDOM?.createPortal) throw new TypeError('The host React and ReactDOM are required');\n const module = {exports:{}};\n const jsx = (type, props, key) => React.createElement(type, key === undefined ? props : {...props, key});\n const jsxs = (type, props, key) => { const {children, ...rest} = props || {}; return React.createElement(type, key === undefined ? rest : {...rest, key}, ...(Array.isArray(children) ? children : [children])); };\n const runtime = {jsx, jsxs, jsxDEV:(type, props, key, staticChildren) => (staticChildren ? jsxs : jsx)(type, props, key), Fragment:React.Fragment};\n const require = id => {\n if (id === 'react') return React;\n if (id === 'react-dom') return ReactDOM;\n if (id === 'react/jsx-runtime') return runtime;\n throw new Error('Unexpected Markdown runtime import: ' + id);\n };\n${bundled}\n return module.exports.createMarkdownComponents(React, ReactDOM);\n}\n`;
39
+ fs.writeFileSync(path.join(dist, 'markdown.mjs'), factory);
40
+ fs.writeFileSync(path.join(dist, 'markdown.css'), stylesheet);
41
+ const packages = new Map();
42
+ for (const input of Object.keys(result.metafile.inputs)) {
43
+ let dir = path.dirname(path.resolve(source, input));
44
+ while (dir.includes('node_modules')) {
45
+ const manifest = path.join(dir, 'package.json');
46
+ if (fs.existsSync(manifest)) {
47
+ const item = JSON.parse(fs.readFileSync(manifest));
48
+ if (item.name) packages.set(item.name + '@' + item.version, {dir, item});
49
+ break;
50
+ }
51
+ dir = path.dirname(dir);
52
+ }
53
+ }
54
+ let notices = 'Bundled Markdown dependencies\n\n';
55
+ for (const [name, {dir, item}] of [...packages].sort(([a],[b]) => a.localeCompare(b))) {
56
+ const licenses = fs.readdirSync(dir).filter(name => /^licen[sc]e(?:[._-].*)?$/i.test(name) && fs.statSync(path.join(dir,name)).isFile());
57
+ notices += '\n===== ' + name + ' (' + String(item.license || 'see upstream notice') + ') =====\n';
58
+ for (const file of licenses) notices += '\n' + fs.readFileSync(path.join(dir,file),'utf8') + '\n';
59
+ if (!licenses.length) notices += 'Copyright/license notices are retained inline in markdown.mjs.\n';
60
+ }
61
+ fs.writeFileSync(path.join(dist, 'THIRD_PARTY_LICENSES.txt'), notices);
62
+ fs.mkdirSync(path.join(root, '.artifacts'), {recursive: true});
63
+ fs.writeFileSync(path.join(root, '.artifacts/markdown-meta.json'), JSON.stringify(result.metafile,null,2));
64
+ console.log(`Markdown: ${Buffer.byteLength(factory)} JS bytes, ${Buffer.byteLength(stylesheet)} CSS bytes, ${packages.size} dependency notices; React supplied by host.`);
65
+ }
66
+ main().catch(error => { console.error(error); process.exitCode = 1; });