@openviking/react 0.1.4 → 0.1.6

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 (139) hide show
  1. package/README.md +15 -11
  2. package/dist/28~0.js +15 -0
  3. package/dist/2~0.js +6 -3
  4. package/dist/37~0.js +27 -0
  5. package/dist/3c~0.js +17 -9
  6. package/dist/3~0.js +4 -2
  7. package/dist/ae~0.js +6 -2
  8. package/dist/a~0.js +79 -72
  9. package/dist/ck~0.js +4 -0
  10. package/dist/client/paths.d.ts +4 -0
  11. package/dist/client/provider.d.ts +10 -6
  12. package/dist/components/agent-connect/agent-connect-code-block.d.ts +14 -0
  13. package/dist/components/agent-connect/agent-connect-copy.d.ts +3 -0
  14. package/dist/components/agent-connect/agent-connect-design.d.ts +1 -1
  15. package/dist/components/agent-connect/agent-connect-installer.d.ts +1 -0
  16. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +4 -6
  17. package/dist/components/agent-connect/agent-connect-instructions.d.ts +13 -0
  18. package/dist/components/agent-connect/agent-connect-markdown.d.ts +8 -2
  19. package/dist/components/agent-connect/agent-connect-mask.d.ts +10 -0
  20. package/dist/components/agent-connect/agent-connect.d.ts +1 -1
  21. package/dist/components/agent-connect/locales/en-US.d.ts +3 -0
  22. package/dist/components/agent-connect/style.css +163 -5
  23. package/dist/components/agent-connect/types.d.ts +5 -3
  24. package/dist/components/agent-connect/use-agent-connect-copy.d.ts +6 -0
  25. package/dist/components/directory-tour/style.css +46 -2
  26. package/dist/components/directory-tour/types.d.ts +2 -1
  27. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  28. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  29. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  30. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  31. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  32. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  33. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  34. package/dist/components/experience-dashboard/index.d.ts +2 -0
  35. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  36. package/dist/components/experience-dashboard/style.css +699 -0
  37. package/dist/components/experience-dashboard/style.js +0 -0
  38. package/dist/components/experience-dashboard/types.d.ts +106 -0
  39. package/dist/components/experience-dashboard.js +1 -0
  40. package/dist/components/file-browser-entries/file-browser-entries.d.ts +1 -1
  41. package/dist/components/file-browser-entries/style.css +259 -13
  42. package/dist/components/file-browser-entries/types.d.ts +2 -2
  43. package/dist/components/file-preview/style.css +48 -4
  44. package/dist/components/file-preview/types.d.ts +2 -2
  45. package/dist/components/file-tree/style.css +63 -4
  46. package/dist/components/file-tree/types.d.ts +2 -2
  47. package/dist/components/scope-switcher/scope-switcher.d.ts +2 -2
  48. package/dist/components/scope-switcher/style.css +48 -4
  49. package/dist/components/scope-switcher/types.d.ts +5 -5
  50. package/dist/components/scope-switcher.js +1 -1
  51. package/dist/components/style.css +2451 -139
  52. package/dist/components/tui/style.css +122 -36
  53. package/dist/components/tui/tui.d.ts +1 -1
  54. package/dist/components/tui/types.d.ts +2 -2
  55. package/dist/components/viking-bot/ark-message-list-view.d.ts +4 -1
  56. package/dist/components/viking-bot/interaction/types.d.ts +2 -2
  57. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
  58. package/dist/components/viking-bot/session-actions.d.ts +2 -2
  59. package/dist/components/viking-bot/style.css +159 -12
  60. package/dist/components/viking-bot/types.d.ts +7 -7
  61. package/dist/components/viking-bot/viking-bot.d.ts +1 -1
  62. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  63. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  64. package/dist/components/wiki-dashboard/style.css +741 -0
  65. package/dist/components/wiki-dashboard/style.js +0 -0
  66. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  67. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  68. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  69. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  70. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  71. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  72. package/dist/components/wiki-dashboard.js +1 -0
  73. package/dist/c~0.js +169 -155
  74. package/dist/e~0.js +3 -1
  75. package/dist/fi~0.js +354 -0
  76. package/dist/fj~0.js +503 -0
  77. package/dist/f~0.js +661 -309
  78. package/dist/icons/index.d.ts +28 -0
  79. package/dist/icons.js +1 -1
  80. package/dist/index.d.ts +4 -0
  81. package/dist/index.js +3 -1
  82. package/dist/k~0.js +277 -1
  83. package/dist/lk~0.js +55 -13
  84. package/dist/l~0.js +1096 -187
  85. package/dist/modules/console/console.d.ts +1 -1
  86. package/dist/modules/console/index.d.ts +1 -2
  87. package/dist/modules/console/style.css +377 -56
  88. package/dist/modules/console/types.d.ts +2 -2
  89. package/dist/modules/console/use-console.d.ts +1 -1
  90. package/dist/modules/console.js +1 -1
  91. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  92. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  93. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  94. package/dist/modules/file-browser/dashboard-model.d.ts +14 -0
  95. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  96. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  97. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  98. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  99. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +3 -2
  100. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  101. package/dist/modules/file-browser/fs-directories.d.ts +8 -0
  102. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  103. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  104. package/dist/modules/file-browser/fs-model.d.ts +12 -2
  105. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  106. package/dist/modules/file-browser/fs-selection.d.ts +4 -0
  107. package/dist/modules/file-browser/index.d.ts +2 -2
  108. package/dist/modules/file-browser/style.css +1883 -25
  109. package/dist/modules/file-browser/types.d.ts +64 -2
  110. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  111. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  112. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  113. package/dist/modules/file-browser/use-file-browser.d.ts +2 -45
  114. package/dist/modules/file-browser/use-fs-tree.d.ts +2 -0
  115. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  116. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  117. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  118. package/dist/modules/file-browser.js +1 -1
  119. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  120. package/dist/modules/scope-cascade/index.d.ts +1 -2
  121. package/dist/modules/scope-cascade/scope-cascade.d.ts +2 -2
  122. package/dist/modules/scope-cascade/style.css +48 -4
  123. package/dist/modules/scope-cascade/types.d.ts +9 -4
  124. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  125. package/dist/modules/scope-cascade.js +1 -1
  126. package/dist/modules/style.css +2459 -192
  127. package/dist/n~0.js +16 -130
  128. package/dist/rt~0.js +152 -0
  129. package/dist/r~0.js +17 -38
  130. package/dist/shared/components/popover/popover.d.ts +1 -1
  131. package/dist/shared/components/popover/types.d.ts +7 -1
  132. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  133. package/dist/shared/locale-context.d.ts +8 -0
  134. package/dist/static/image/dashboard-background.png +0 -0
  135. package/dist/style.css +9445 -4822
  136. package/dist/u~0.js +324 -96
  137. package/dist/viking-bot-composer~0.js +4 -2
  138. package/dist/viking-bot-interaction~0.js +3 -1
  139. package/package.json +14 -2
package/dist/u~0.js CHANGED
@@ -1,6 +1,12 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Fragment as external_react_Fragment, useCallback, useId, useRef, useState } from "react";
2
+ import { Children, createContext, isValidElement, useCallback, useContext, useId, useRef, useState } from "react";
3
+ import react_markdown from "react-markdown";
4
+ import rehype_raw from "rehype-raw";
5
+ import rehype_sanitize from "rehype-sanitize";
6
+ import remark_gfm from "remark-gfm";
3
7
  import { resolveLocale } from "./nx~0.js";
8
+ import { checkreact } from "./0~0.js";
9
+ import { useLocale } from "./28~0.js";
4
10
  const SvgCodexDetail = (props)=>/*#__PURE__*/ jsxs("svg", {
5
11
  xmlns: "http://www.w3.org/2000/svg",
6
12
  xmlnsXlink: "http://www.w3.org/1999/xlink",
@@ -58,6 +64,9 @@ const messages = {
58
64
  instructions: 'Full instructions',
59
65
  copy: 'Copy and send to Agent',
60
66
  copyMarkdown: 'Copy as Markdown',
67
+ copyCode: 'Copy code',
68
+ showApiKey: 'Show API Key',
69
+ hideApiKey: 'Hide API Key',
61
70
  copied: 'Copied',
62
71
  failed: 'Copy failed. Please retry.',
63
72
  notice: 'Connected agents can read content available to you in OpenViking. Overseas services may transfer data abroad.',
@@ -86,6 +95,9 @@ const zh_CN_messages = {
86
95
  instructions: '完整指令',
87
96
  copy: '复制并发送给 Agent',
88
97
  copyMarkdown: '复制为 Markdown',
98
+ copyCode: '复制代码',
99
+ showApiKey: '显示 API Key',
100
+ hideApiKey: '隐藏 API Key',
89
101
  copied: '已复制',
90
102
  failed: '复制失败,请重试',
91
103
  notice: '接入后 Agent 能读到你在 OpenViking 里能看到的内容,若接入境外服务数据有可能传到境外。',
@@ -490,8 +502,11 @@ const INSTALLER_HARNESSES = {
490
502
  function shellArgument(value) {
491
503
  return `'${value.replace(/'/g, "'\"'\"'")}'`;
492
504
  }
505
+ function getInstallerCommand(harness, locale, apiKey, baseUrl) {
506
+ return `curl -fsSL https://openviking.ai/install | bash -s -- --yes --lang ${'zh-CN' === locale ? 'zh' : 'en'} --harness ${harness},cli --url ${shellArgument(baseUrl)} --api-key ${shellArgument(apiKey)}`;
507
+ }
493
508
  function getInstallerInstructions(name, harness, locale, apiKey, baseUrl) {
494
- const command = `curl -fsSL https://openviking.ai/install | bash -s -- --yes --lang ${'zh-CN' === locale ? 'zh' : 'en'} --harness ${harness},cli --url ${shellArgument(baseUrl)} --api-key ${shellArgument(apiKey)}`;
509
+ const command = getInstallerCommand(harness, locale, apiKey, baseUrl);
495
510
  return resolveAgentConnectLabels(locale).installerInstructions(name, command);
496
511
  }
497
512
  const DEFAULT_BASE_URL = 'https://api.vikingdb.cn-beijing.volces.com/openviking';
@@ -510,7 +525,11 @@ function getAgentConnectInstructions(id, locale, apiKey, baseUrl, guideId) {
510
525
  return {
511
526
  fixed: true,
512
527
  display: instructions('••••••••'),
513
- copy: instructions(apiKey)
528
+ copy: instructions(apiKey),
529
+ command: {
530
+ display: getInstallerCommand(harness, locale, '••••••••', baseUrl),
531
+ copy: getInstallerCommand(harness, locale, apiKey, baseUrl)
532
+ }
514
533
  };
515
534
  }
516
535
  const guide = content.guides.find((item)=>item.id === guideId);
@@ -521,6 +540,12 @@ function getAgentConnectInstructions(id, locale, apiKey, baseUrl, guideId) {
521
540
  }
522
541
  if (!/\{\{OPENVIKING_API_KEY/.test(template)) template += '\n\nBase URL: {{OPENVIKING_BASE_URL}}\n\nAPI Key:\n\n{{OPENVIKING_API_KEY_BLOCK}}';
523
542
  const pathBaseUrl = baseUrl.replace(/\/+$/, '');
543
+ let keyToken = 'OV_API_KEY_TOKEN';
544
+ while([
545
+ template,
546
+ baseUrl,
547
+ apiKey
548
+ ].some((value)=>value.includes(keyToken)))keyToken += '_';
524
549
  function hydrate(key) {
525
550
  return template.replace(/\{\{OPENVIKING_BASE_URL\}\}|\{\{OPENVIKING_API_KEY_BLOCK\}\}|\{\{OPENVIKING_API_KEY\}\}|<API_KEY>|https:\/\/api\.vikingdb\.cn-beijing\.volces\.com\/openviking/g, (token, offset)=>{
526
551
  if ('{{OPENVIKING_API_KEY_BLOCK}}' === token) {
@@ -534,7 +559,9 @@ function getAgentConnectInstructions(id, locale, apiKey, baseUrl, guideId) {
534
559
  return {
535
560
  fixed: false,
536
561
  display: hydrate('••••••••'),
537
- copy: hydrate(apiKey)
562
+ copy: hydrate(apiKey),
563
+ markdown: hydrate(keyToken),
564
+ keyToken
538
565
  };
539
566
  }
540
567
  const SvgCopy = (props)=>/*#__PURE__*/ jsxs("svg", {
@@ -550,7 +577,7 @@ const SvgCopy = (props)=>/*#__PURE__*/ jsxs("svg", {
550
577
  children: /*#__PURE__*/ jsx("g", {
551
578
  clipPath: "url(#copy_svg__b)",
552
579
  children: /*#__PURE__*/ jsx("path", {
553
- fill: "#fff",
580
+ fill: "currentColor",
554
581
  fillRule: "evenodd",
555
582
  d: "M10.667 4c.368 0 .666.299.666.667v9.407c0 .328-.278.593-.622.593H2.622c-.343 0-.622-.265-.622-.593V4.593C2 4.265 2.279 4 2.622 4zM10 5.334H3.333v8H10zm3.333-4c.368 0 .667.298.667.666v8.334c0 .184-.15.333-.333.333H13a.333.333 0 0 1-.333-.333V2.667H6.333A.333.333 0 0 1 6 2.334v-.667c0-.184.15-.334.333-.334z",
556
583
  clipRule: "evenodd"
@@ -578,102 +605,54 @@ const SvgCopy = (props)=>/*#__PURE__*/ jsxs("svg", {
578
605
  ]
579
606
  });
580
607
  const copyreact = SvgCopy;
581
- function Inline({ text }) {
582
- return text.split(/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\(https?:\/\/[^)]+\))/g).map((part, index)=>{
583
- const link = /^\[([^\]]+)\]\((https?:\/\/[^)]+)\)$/.exec(part);
584
- if (link) return /*#__PURE__*/ jsx("a", {
585
- href: link[2],
586
- target: "_blank",
587
- rel: "noopener noreferrer",
588
- children: link[1]
589
- }, index);
590
- if (part.startsWith('`')) return /*#__PURE__*/ jsx("code", {
591
- children: part.slice(1, -1)
592
- }, index);
593
- if (part.startsWith('**')) return /*#__PURE__*/ jsx("strong", {
594
- children: part.slice(2, -2)
595
- }, index);
596
- return /*#__PURE__*/ jsx(external_react_Fragment, {
597
- children: part
598
- }, index);
599
- });
600
- }
601
- function Prose({ text }) {
602
- const lines = text.split('\n').filter((line)=>!/^\s*!\[/.test(line));
603
- const blocks = [];
604
- let current = '';
605
- for (const line of lines)if (line.trim()) if (/^#{1,6}\s/.test(line)) {
606
- if (current) blocks.push(current);
607
- blocks.push(line);
608
- current = '';
609
- } else current += `${current ? '\n' : ''}${line}`;
610
- else {
611
- if (current) blocks.push(current);
612
- current = '';
613
- }
614
- if (current) blocks.push(current);
615
- return blocks.map((block, index)=>{
616
- if (/^#{1,6}\s/.test(block)) return /*#__PURE__*/ jsx("h5", {
617
- children: /*#__PURE__*/ jsx(Inline, {
618
- text: block.replace(/^#{1,6}\s/, '')
619
- })
620
- }, index);
621
- if (block.startsWith('|')) {
622
- const rows = block.split('\n').filter((row)=>!/^\|[\s:|-]+\|$/.test(row));
623
- return /*#__PURE__*/ jsx("table", {
624
- children: /*#__PURE__*/ jsx("tbody", {
625
- children: rows.map((row, rowIndex)=>/*#__PURE__*/ jsx("tr", {
626
- children: row.split('|').slice(1, -1).map((cell, column)=>0 === rowIndex ? /*#__PURE__*/ jsx("th", {
627
- children: /*#__PURE__*/ jsx(Inline, {
628
- text: cell.trim()
629
- })
630
- }, column) : /*#__PURE__*/ jsx("td", {
631
- children: /*#__PURE__*/ jsx(Inline, {
632
- text: cell.trim()
633
- })
634
- }, column))
635
- }, rowIndex))
636
- })
637
- }, index);
638
- }
639
- return /*#__PURE__*/ jsx("p", {
640
- children: /*#__PURE__*/ jsx(Inline, {
641
- text: block
608
+ const SvgEye = (props)=>/*#__PURE__*/ jsxs("svg", {
609
+ xmlns: "http://www.w3.org/2000/svg",
610
+ fill: "none",
611
+ stroke: "currentColor",
612
+ strokeWidth: 4,
613
+ viewBox: "0 0 48 48",
614
+ ...props,
615
+ children: [
616
+ /*#__PURE__*/ jsx("path", {
617
+ d: "M24 37q9.94 0 18-13-8.06-13-18-13T6 24q8.06 13 18 13Z",
618
+ clipRule: "evenodd"
619
+ }),
620
+ /*#__PURE__*/ jsx("path", {
621
+ d: "M29 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"
642
622
  })
643
- }, index);
623
+ ]
644
624
  });
645
- }
646
- function AgentConnectMarkdown({ text }) {
647
- return /*#__PURE__*/ jsx("div", {
648
- className: "ov-agent-connect__markdown",
649
- children: text.split(/(^[ \t]*```[^\n]*\n[\s\S]*?^[ \t]*```[ \t]*$)/gm).map((part, index)=>{
650
- const code = /^[ \t]*```[^\n]*\n([\s\S]*?)\n[ \t]*```[ \t]*$/.exec(part);
651
- return code ? /*#__PURE__*/ jsx("pre", {
652
- children: /*#__PURE__*/ jsx("code", {
653
- children: code[1]
654
- })
655
- }, index) : /*#__PURE__*/ jsx(Prose, {
656
- text: part
657
- }, index);
658
- })
625
+ const eyereact = SvgEye;
626
+ const SvgEyeInvisible = (props)=>/*#__PURE__*/ jsxs("svg", {
627
+ xmlns: "http://www.w3.org/2000/svg",
628
+ fill: "none",
629
+ stroke: "currentColor",
630
+ strokeWidth: 4,
631
+ viewBox: "0 0 48 48",
632
+ ...props,
633
+ children: [
634
+ /*#__PURE__*/ jsx("path", {
635
+ d: "M14 14.5c-2.69 2-5.415 5.33-8 9.5q8.06 13 18 13 4.987 0 9.5-3.271M17.463 12.5C19 11 21.75 11 24 11q9.94 0 18 13-2.649 4.272-5.5 7.14"
636
+ }),
637
+ /*#__PURE__*/ jsx("path", {
638
+ d: "M29 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0ZM6.852 7.103l34.294 34.294"
639
+ })
640
+ ]
659
641
  });
660
- }
661
- function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCopy }) {
642
+ const eye_invisiblereact = SvgEyeInvisible;
643
+ function useAgentConnectCopy(text, onCopy) {
662
644
  const [status, setStatus] = useState('idle');
663
645
  const pending = useRef(false);
664
646
  const mounted = useRef(false);
665
647
  const setRoot = useCallback((node)=>{
666
648
  mounted.current = null !== node;
667
649
  }, []);
668
- const labels = resolveAgentConnectLabels(locale);
669
- const message = 'copied' === status ? labels.copied : 'failed' === status ? labels.failed : '';
670
- const copyLabel = instructions.fixed ? labels.copy : labels.copyMarkdown;
671
- async function handleCopy() {
650
+ async function copy() {
672
651
  if (pending.current) return;
673
652
  pending.current = true;
674
653
  setStatus('pending');
675
654
  try {
676
- await navigator.clipboard.writeText(instructions.copy);
655
+ await navigator.clipboard.writeText(text);
677
656
  } catch {
678
657
  if (mounted.current) setStatus('failed');
679
658
  return;
@@ -682,8 +661,241 @@ function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCo
682
661
  }
683
662
  if (!mounted.current) return;
684
663
  setStatus('copied');
685
- onCopy?.(instructions.copy);
664
+ onCopy?.(text);
686
665
  }
666
+ return {
667
+ status,
668
+ setRoot,
669
+ copy
670
+ };
671
+ }
672
+ function AgentConnectCodeBlock({ display, copyText, language, locale, visibleBlockId, onReveal, onCopy }) {
673
+ const id = useId();
674
+ const revealed = visibleBlockId === id;
675
+ const hasKey = display !== copyText;
676
+ const labels = resolveAgentConnectLabels(locale);
677
+ const { status, setRoot, copy } = useAgentConnectCopy(copyText, onCopy);
678
+ const revealLabel = revealed ? labels.hideApiKey : labels.showApiKey;
679
+ const copyLabel = 'copied' === status ? labels.copied : labels.copyCode;
680
+ const RevealIcon = revealed ? eye_invisiblereact : eyereact;
681
+ const ClipboardIcon = 'copied' === status ? checkreact : copyreact;
682
+ const feedback = 'failed' === status ? labels.failed : 'copied' === status ? labels.copied : '';
683
+ return /*#__PURE__*/ jsxs("div", {
684
+ ref: setRoot,
685
+ className: "ov-agent-connect__code-block",
686
+ children: [
687
+ /*#__PURE__*/ jsxs("div", {
688
+ className: "ov-agent-connect__code-header",
689
+ children: [
690
+ /*#__PURE__*/ jsx("span", {
691
+ children: language || 'text'
692
+ }),
693
+ /*#__PURE__*/ jsxs("div", {
694
+ className: "ov-agent-connect__code-actions",
695
+ children: [
696
+ hasKey ? /*#__PURE__*/ jsx("button", {
697
+ type: "button",
698
+ "aria-pressed": revealed,
699
+ "aria-label": revealLabel,
700
+ title: revealLabel,
701
+ onClick: ()=>onReveal(revealed ? null : id),
702
+ children: /*#__PURE__*/ jsx(RevealIcon, {
703
+ "aria-hidden": "true"
704
+ })
705
+ }) : null,
706
+ /*#__PURE__*/ jsx("button", {
707
+ type: "button",
708
+ disabled: 'pending' === status,
709
+ "aria-label": copyLabel,
710
+ title: copyLabel,
711
+ onClick: ()=>void copy(),
712
+ children: /*#__PURE__*/ jsx(ClipboardIcon, {
713
+ "aria-hidden": "true"
714
+ })
715
+ })
716
+ ]
717
+ })
718
+ ]
719
+ }),
720
+ /*#__PURE__*/ jsx("pre", {
721
+ children: /*#__PURE__*/ jsx("code", {
722
+ children: revealed ? copyText : display
723
+ })
724
+ }),
725
+ /*#__PURE__*/ jsx("span", {
726
+ className: 'failed' === status ? 'ov-agent-connect__feedback ov-agent-connect__feedback--error' : 'ov-agent-connect__code-feedback',
727
+ role: "status",
728
+ "aria-live": "polite",
729
+ children: feedback
730
+ })
731
+ ]
732
+ });
733
+ }
734
+ function remarkMaskApiKey({ keyToken }) {
735
+ return (tree)=>{
736
+ function mask(node) {
737
+ if (('text' === node.type || 'inlineCode' === node.type || 'html' === node.type) && node.value) node.value = node.value.split(keyToken).join('••••••••');
738
+ node.children?.forEach(mask);
739
+ }
740
+ mask(tree);
741
+ };
742
+ }
743
+ const markdownHtmlSchema = {
744
+ attributes: {
745
+ a: [
746
+ 'href',
747
+ 'title'
748
+ ],
749
+ code: [
750
+ [
751
+ 'className',
752
+ /^language-[\w-]+$/
753
+ ]
754
+ ],
755
+ details: [
756
+ 'open'
757
+ ],
758
+ td: [
759
+ 'align',
760
+ 'colSpan',
761
+ 'rowSpan'
762
+ ],
763
+ th: [
764
+ 'align',
765
+ 'colSpan',
766
+ 'rowSpan'
767
+ ]
768
+ },
769
+ protocols: {
770
+ href: [
771
+ 'http',
772
+ 'https',
773
+ 'mailto'
774
+ ]
775
+ },
776
+ tagNames: [
777
+ 'a',
778
+ 'b',
779
+ 'blockquote',
780
+ 'br',
781
+ 'code',
782
+ 'del',
783
+ 'details',
784
+ 'em',
785
+ 'h1',
786
+ 'h2',
787
+ 'h3',
788
+ 'h4',
789
+ 'h5',
790
+ 'h6',
791
+ 'hr',
792
+ 'li',
793
+ 'ol',
794
+ 'p',
795
+ 'pre',
796
+ 's',
797
+ 'strong',
798
+ 'summary',
799
+ 'table',
800
+ 'tbody',
801
+ 'td',
802
+ 'th',
803
+ 'thead',
804
+ 'tr',
805
+ 'ul'
806
+ ]
807
+ };
808
+ const components = {
809
+ h1: ({ children })=>/*#__PURE__*/ jsx("h5", {
810
+ children: children
811
+ }),
812
+ h2: ({ children })=>/*#__PURE__*/ jsx("h5", {
813
+ children: children
814
+ }),
815
+ h3: ({ children })=>/*#__PURE__*/ jsx("h5", {
816
+ children: children
817
+ }),
818
+ h4: ({ children })=>/*#__PURE__*/ jsx("h5", {
819
+ children: children
820
+ }),
821
+ h5: ({ children })=>/*#__PURE__*/ jsx("h5", {
822
+ children: children
823
+ }),
824
+ h6: ({ children })=>/*#__PURE__*/ jsx("h5", {
825
+ children: children
826
+ }),
827
+ a: ({ children, href, title })=>/*#__PURE__*/ jsx("a", {
828
+ href: href,
829
+ title: title,
830
+ target: "_blank",
831
+ rel: "noopener noreferrer",
832
+ children: children
833
+ }),
834
+ pre: MarkdownCodeBlock
835
+ };
836
+ const codeBlockContext = /*#__PURE__*/ createContext(null);
837
+ function MarkdownCodeBlock({ children }) {
838
+ const context = useContext(codeBlockContext);
839
+ const child = Children.toArray(children)[0];
840
+ if (!context || !/*#__PURE__*/ isValidElement(child) || 'string' != typeof child.props.children) return /*#__PURE__*/ jsx("pre", {
841
+ children: children
842
+ });
843
+ const { keyToken, apiKey, ...controls } = context;
844
+ const code = child.props.children.replace(/\n$/, '');
845
+ return /*#__PURE__*/ jsx(AgentConnectCodeBlock, {
846
+ ...controls,
847
+ language: child.props.className?.replace(/^language-/, ''),
848
+ display: code.split(keyToken).join('••••••••'),
849
+ copyText: code.split(keyToken).join(apiKey)
850
+ });
851
+ }
852
+ function AgentConnectMarkdown({ text, ...context }) {
853
+ return /*#__PURE__*/ jsx("div", {
854
+ className: "ov-agent-connect__markdown",
855
+ children: /*#__PURE__*/ jsx(codeBlockContext.Provider, {
856
+ value: context,
857
+ children: /*#__PURE__*/ jsx(react_markdown, {
858
+ remarkPlugins: [
859
+ [
860
+ remark_gfm,
861
+ {
862
+ singleTilde: false
863
+ }
864
+ ],
865
+ [
866
+ remarkMaskApiKey,
867
+ {
868
+ keyToken: context.keyToken
869
+ }
870
+ ]
871
+ ],
872
+ rehypePlugins: [
873
+ rehype_raw,
874
+ [
875
+ rehype_sanitize,
876
+ markdownHtmlSchema
877
+ ]
878
+ ],
879
+ components: components,
880
+ children: text
881
+ })
882
+ })
883
+ });
884
+ }
885
+ function AgentConnectInstructionsView({ instructions, apiKey, locale, agreementUrl, onCopy }) {
886
+ const [visibleBlockId, onReveal] = useState(null);
887
+ const { status, setRoot, copy } = useAgentConnectCopy(instructions.copy, onCopy);
888
+ const controls = {
889
+ locale,
890
+ visibleBlockId,
891
+ onReveal,
892
+ onCopy
893
+ };
894
+ const command = instructions.command;
895
+ const commandOffset = command ? instructions.display.indexOf(command.display) : -1;
896
+ const labels = resolveAgentConnectLabels(locale);
897
+ const message = 'copied' === status ? labels.copied : 'failed' === status ? labels.failed : '';
898
+ const copyLabel = instructions.fixed ? labels.copy : labels.copyMarkdown;
687
899
  return /*#__PURE__*/ jsxs("div", {
688
900
  ref: setRoot,
689
901
  className: "ov-agent-connect__instructions",
@@ -699,7 +911,7 @@ function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCo
699
911
  className: "ov-agent-connect__copy",
700
912
  type: "button",
701
913
  disabled: 'pending' === status,
702
- onClick: ()=>void handleCopy(),
914
+ onClick: ()=>void copy(),
703
915
  children: [
704
916
  /*#__PURE__*/ jsx(copyreact, {
705
917
  "aria-hidden": "true"
@@ -711,8 +923,22 @@ function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCo
711
923
  }),
712
924
  /*#__PURE__*/ jsx("div", {
713
925
  className: "ov-agent-connect__body",
714
- children: instructions.fixed ? instructions.display : /*#__PURE__*/ jsx(AgentConnectMarkdown, {
715
- text: instructions.display
926
+ children: command ? /*#__PURE__*/ jsxs(Fragment, {
927
+ children: [
928
+ instructions.display.slice(0, commandOffset),
929
+ /*#__PURE__*/ jsx(AgentConnectCodeBlock, {
930
+ ...controls,
931
+ language: "bash",
932
+ display: command.display,
933
+ copyText: command.copy
934
+ }),
935
+ instructions.display.slice(commandOffset + command.display.length)
936
+ ]
937
+ }) : /*#__PURE__*/ jsx(AgentConnectMarkdown, {
938
+ ...controls,
939
+ text: instructions.markdown,
940
+ keyToken: instructions.keyToken,
941
+ apiKey: apiKey
716
942
  })
717
943
  }),
718
944
  /*#__PURE__*/ jsx("span", {
@@ -809,6 +1035,7 @@ function AgentConnectDetailView({ selected, apiKey, locale, baseUrl, agreementUr
809
1035
  }) : null,
810
1036
  /*#__PURE__*/ jsx(AgentConnectInstructionsView, {
811
1037
  instructions: instructions,
1038
+ apiKey: apiKey,
812
1039
  locale: locale,
813
1040
  agreementUrl: agreementUrl,
814
1041
  onCopy: onCopy
@@ -1466,7 +1693,7 @@ const custom = [
1466
1693
  Icon: sdkreact
1467
1694
  }
1468
1695
  ];
1469
- function getAgentConnectDesign(locale) {
1696
+ function getAgentConnectDesign(locale, showOverseasTag = false) {
1470
1697
  const content = getAgentConnectContent(locale);
1471
1698
  const labels = resolveAgentConnectLabels(locale);
1472
1699
  return {
@@ -1485,7 +1712,7 @@ function getAgentConnectDesign(locale) {
1485
1712
  ...content[item.id],
1486
1713
  tags: [
1487
1714
  ...content[item.id].tags,
1488
- ...overseasAgents.has(item.id) ? [
1715
+ ...showOverseasTag && overseasAgents.has(item.id) ? [
1489
1716
  labels.overseas
1490
1717
  ] : []
1491
1718
  ]
@@ -1496,7 +1723,8 @@ function getAgentConnectDesign(locale) {
1496
1723
  }))
1497
1724
  };
1498
1725
  }
1499
- function AgentConnect({ apiKey, locale, baseUrl = DEFAULT_BASE_URL, agreementUrl, activeTabId: controlledTabId, selectedId: controlledSelectedId, onTabChange, onSelect, onCopy, className, ...rest }) {
1726
+ function AgentConnect({ apiKey, locale: localeProp, baseUrl = DEFAULT_BASE_URL, agreementUrl, showOverseasTag = false, activeTabId: controlledTabId, selectedId: controlledSelectedId, onTabChange, onSelect, onCopy, className, ...rest }) {
1727
+ const locale = useLocale(localeProp);
1500
1728
  const id = useId();
1501
1729
  const [localTabId, setLocalTabId] = useState('mainstream');
1502
1730
  const [localSelection, setLocalSelection] = useState({
@@ -1505,7 +1733,7 @@ function AgentConnect({ apiKey, locale, baseUrl = DEFAULT_BASE_URL, agreementUrl
1505
1733
  });
1506
1734
  const activeTabId = controlledTabId ?? localTabId;
1507
1735
  const selectedId = controlledSelectedId ?? localSelection[activeTabId];
1508
- const design = getAgentConnectDesign(locale);
1736
+ const design = getAgentConnectDesign(locale, showOverseasTag);
1509
1737
  const labels = resolveAgentConnectLabels(locale);
1510
1738
  const tabs = design.tabs;
1511
1739
  const items = design[activeTabId];
@@ -1,11 +1,12 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Sender } from "@ark-design/ui/sender";
3
3
  import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
4
- import { Tooltip } from "./r~0.js";
4
+ import { Tooltip } from "./rt~0.js";
5
5
  import { VikingBotIcon } from "./lg~0.js";
6
6
  import { resolveVikingBotLabels, BotPopover, useQuickInput, QuickInputs } from "./c~0.js";
7
7
  import { usePortalTheme } from "./9~0.js";
8
8
  import { FileTree as file_tree_FileTree } from "./n~0.js";
9
+ import { useLocale } from "./28~0.js";
9
10
  const SvgSend = (props)=>/*#__PURE__*/ jsx("svg", {
10
11
  xmlns: "http://www.w3.org/2000/svg",
11
12
  fill: "none",
@@ -374,7 +375,8 @@ function composerCaret(sender) {
374
375
  const { doc, selection } = editor.state;
375
376
  return doc.textBetween(0, selection.from, '\n', '\n').length;
376
377
  }
377
- const viking_bot_composer_VikingBotComposerView = /*#__PURE__*/ forwardRef(function({ value, locale, className, attachments = [], disabled, disabledReason, isSending, variant = 'default', accept, maxAttachments = 10, actions, quickInputs, onQuickInputSelect, references, onValueChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, labels: overrides }, ref) {
378
+ const viking_bot_composer_VikingBotComposerView = /*#__PURE__*/ forwardRef(function({ value, locale: localeProp, className, attachments = [], disabled, disabledReason, isSending, variant = 'default', accept, maxAttachments = 10, actions, quickInputs, onQuickInputSelect, references, onValueChange, onFilesAdded, onAttachmentRemove, onSend, onCancel, labels: overrides }, ref) {
379
+ const locale = useLocale(localeProp);
378
380
  const labels = resolveVikingBotLabels(locale, overrides);
379
381
  const senderRef = useRef(null);
380
382
  const writing = useRef(false);
@@ -1,6 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { AskHuman } from "@ark-design/ui/ask-human";
3
3
  import { useState } from "react";
4
+ import { useLocale } from "./28~0.js";
4
5
  import { resolveInteractionLabels } from "./c7~0.js";
5
6
  const toFields = (request, other)=>{
6
7
  if ('choice' === request.kind) return [
@@ -193,7 +194,8 @@ const TextInput = ({ request, label, disabled, onChange })=>/*#__PURE__*/ jsxs(F
193
194
  })
194
195
  ]
195
196
  });
196
- function VikingBotInteractionView({ request, className, requestKey, index = 0, total = 1, disabled, submitting, error, onSubmit, onCancel, locale, labels: overrides }) {
197
+ function VikingBotInteractionView({ request, className, requestKey, index = 0, total = 1, disabled, submitting, error, onSubmit, onCancel, locale: localeProp, labels: overrides }) {
198
+ const locale = useLocale(localeProp);
197
199
  const labels = resolveInteractionLabels(locale, overrides);
198
200
  const blocked = Boolean(disabled || submitting);
199
201
  const formKey = requestKey ?? `${request.kind}:${index}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openviking/react",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -96,7 +96,17 @@
96
96
  "types": "./dist/components/directory-tour/index.d.ts",
97
97
  "import": "./dist/components/directory-tour.js"
98
98
  },
99
- "./components/directory-tour/style.css": "./dist/components/directory-tour/style.css"
99
+ "./components/directory-tour/style.css": "./dist/components/directory-tour/style.css",
100
+ "./components/wiki-dashboard": {
101
+ "types": "./dist/components/wiki-dashboard/index.d.ts",
102
+ "import": "./dist/components/wiki-dashboard.js"
103
+ },
104
+ "./components/wiki-dashboard/style.css": "./dist/components/wiki-dashboard/style.css",
105
+ "./components/experience-dashboard": {
106
+ "types": "./dist/components/experience-dashboard/index.d.ts",
107
+ "import": "./dist/components/experience-dashboard.js"
108
+ },
109
+ "./components/experience-dashboard/style.css": "./dist/components/experience-dashboard/style.css"
100
110
  },
101
111
  "scripts": {
102
112
  "dev": "rslib build --watch",
@@ -122,6 +132,8 @@
122
132
  "react-focus-lock": "^2.13.7",
123
133
  "react-markdown": "^10.1.0",
124
134
  "react-transition-group": "^4.4.5",
135
+ "rehype-raw": "^7.0.0",
136
+ "rehype-sanitize": "^6.0.0",
125
137
  "remark-gfm": "^4.0.1"
126
138
  }
127
139
  }