@ottocode/web-sdk 0.1.308 → 0.1.310

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.
@@ -1 +1 @@
1
- {"version":3,"file":"UserMessageGroup.d.ts","sourceRoot":"","sources":["../../../src/components/messages/UserMessageGroup.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAgB/C,UAAU,qBAAqB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC;AAkBD,eAAO,MAAM,gBAAgB,6DAwX5B,CAAC"}
1
+ {"version":3,"file":"UserMessageGroup.d.ts","sourceRoot":"","sources":["../../../src/components/messages/UserMessageGroup.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAiB/C,UAAU,qBAAqB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAChC;AAkBD,eAAO,MAAM,gBAAgB,6DA+Y5B,CAAC"}
package/dist/index.js CHANGED
@@ -8363,6 +8363,17 @@ var ChatInput = memo11(forwardRef5(function ChatInput2({
8363
8363
  onEnterSelect: handleSkillEnterSelect,
8364
8364
  onClose: handleSkillMentionClose
8365
8365
  }),
8366
+ showFileMention && /* @__PURE__ */ jsx25(MentionPopup, {
8367
+ agents: mentionAgents,
8368
+ skills: mentionSkills,
8369
+ files,
8370
+ changedFiles,
8371
+ query: mentionQuery,
8372
+ selectedIndex: mentionSelectedIndex,
8373
+ onSelect: handleMentionSelect,
8374
+ onEnterSelect: handleMentionEnterSelect,
8375
+ onClose: handleMentionClose
8376
+ }),
8366
8377
  /* @__PURE__ */ jsx25(AttachmentPreviewList, {
8367
8378
  images,
8368
8379
  documents,
@@ -8554,17 +8565,6 @@ var ChatInput = memo11(forwardRef5(function ChatInput2({
8554
8565
  })
8555
8566
  })
8556
8567
  }),
8557
- showFileMention && /* @__PURE__ */ jsx25(MentionPopup, {
8558
- agents: mentionAgents,
8559
- skills: mentionSkills,
8560
- files,
8561
- changedFiles,
8562
- query: mentionQuery,
8563
- selectedIndex: mentionSelectedIndex,
8564
- onSelect: handleMentionSelect,
8565
- onEnterSelect: handleMentionEnterSelect,
8566
- onClose: handleMentionClose
8567
- }),
8568
8568
  showShortcutsModal ? /* @__PURE__ */ jsx25(ShortcutsModal, {
8569
8569
  isOpen: true,
8570
8570
  onClose: handleCloseShortcutsModal
@@ -22105,15 +22105,30 @@ import ReactMarkdown3 from "react-markdown";
22105
22105
  import remarkGfm3 from "remark-gfm";
22106
22106
 
22107
22107
  // src/lib/skillMentions.ts
22108
- var SKILL_MENTION_REGEX = /(^|[\s([{])([$@])([a-z0-9]+(?:-[a-z0-9]+)*)/g;
22109
- function linkifyExplicitSkillMentions(content, skills) {
22108
+ var MESSAGE_MENTION_REGEX = /(^|[\s([{])(@[^\s@]+|\$[a-z0-9][a-z0-9-]*)/g;
22109
+ var TRAILING_PUNCTUATION_REGEX2 = /[.,;:!?)\]}'"`]+$/;
22110
+ function linkifyUserMessageMentions(content, skills) {
22110
22111
  if (!content.includes("$") && !content.includes("@"))
22111
22112
  return content;
22112
- const available = new Set(skills.filter((skill) => skill.enabled !== false).map((skill) => skill.name));
22113
- return content.replace(SKILL_MENTION_REGEX, (match, prefix, symbol, name) => {
22114
- if (!available.has(name))
22113
+ const availableSkills = new Set(skills.filter((skill) => skill.enabled !== false).map((skill) => skill.name));
22114
+ return content.replace(MESSAGE_MENTION_REGEX, (match, prefix, token) => {
22115
+ if (token.startsWith("$")) {
22116
+ const name2 = token.slice(1);
22117
+ if (!availableSkills.has(name2))
22118
+ return match;
22119
+ return `${prefix}[${token}](#otto-skill:${encodeURIComponent(name2)})`;
22120
+ }
22121
+ const trailing = token.slice(1).match(TRAILING_PUNCTUATION_REGEX2)?.[0] ?? "";
22122
+ const mentionToken = trailing ? token.slice(0, -trailing.length) : token;
22123
+ const name = mentionToken.slice(1);
22124
+ if (!name)
22115
22125
  return match;
22116
- return `${prefix}[${symbol}${name}](#otto-skill:${encodeURIComponent(name)})`;
22126
+ if (availableSkills.has(name)) {
22127
+ return `${prefix}[${mentionToken}](#otto-skill:${encodeURIComponent(name)})${trailing}`;
22128
+ }
22129
+ if (!name.includes("/") && !name.includes("."))
22130
+ return match;
22131
+ return `${prefix}[${mentionToken}](#otto-file:${encodeURIComponent(name)})${trailing}`;
22117
22132
  });
22118
22133
  }
22119
22134
 
@@ -22308,6 +22323,7 @@ var UserMessageGroup = memo19(function UserMessageGroup2({
22308
22323
  const { data: skillsConfig } = useSkills();
22309
22324
  const expandSkillsSidebar = useSkillsStore((state) => state.expandSidebar);
22310
22325
  const selectSkill = useSkillsStore((state) => state.selectSkill);
22326
+ const openFile = useFileBrowserStore((state) => state.openFile);
22311
22327
  const { isQueued, position } = useMessageQueuePosition(sessionId, nextAssistantMessageId ?? "");
22312
22328
  const setPendingRestoreText = useQueueStore((state) => state.setPendingRestoreText);
22313
22329
  const textParts = parts.filter((p) => p.type === "text");
@@ -22340,7 +22356,7 @@ var UserMessageGroup = memo19(function UserMessageGroup2({
22340
22356
  fileSelections: parsedFileSelections,
22341
22357
  cleanContent: contentAfterFileSelections
22342
22358
  } = parseFileSelections(content);
22343
- const renderedContent = linkifyExplicitSkillMentions(contentAfterFileSelections, skillsConfig?.items ?? []);
22359
+ const renderedContent = linkifyUserMessageMentions(contentAfterFileSelections, skillsConfig?.items ?? []);
22344
22360
  const images = [];
22345
22361
  for (const part of imageParts) {
22346
22362
  try {
@@ -22406,6 +22422,9 @@ var UserMessageGroup = memo19(function UserMessageGroup2({
22406
22422
  expandSkillsSidebar();
22407
22423
  selectSkill(skillName);
22408
22424
  };
22425
+ const handleFileClick = (filePath) => {
22426
+ openFile(filePath);
22427
+ };
22409
22428
  const handleDelete = async () => {
22410
22429
  if (!sessionId || !nextAssistantMessageId)
22411
22430
  return;
@@ -22551,6 +22570,7 @@ var UserMessageGroup = memo19(function UserMessageGroup2({
22551
22570
  ...props
22552
22571
  }) => {
22553
22572
  const skillHref = href?.startsWith("#otto-skill:") ? href.slice("#otto-skill:".length) : href?.startsWith("otto-skill:") ? href.slice("otto-skill:".length) : null;
22573
+ const fileHref = href?.startsWith("#otto-file:") ? href.slice("#otto-file:".length) : href?.startsWith("otto-file:") ? href.slice("otto-file:".length) : null;
22554
22574
  if (skillHref) {
22555
22575
  const skillName = decodeURIComponent(skillHref);
22556
22576
  return /* @__PURE__ */ jsx82("button", {
@@ -22561,6 +22581,16 @@ var UserMessageGroup = memo19(function UserMessageGroup2({
22561
22581
  children
22562
22582
  });
22563
22583
  }
22584
+ if (fileHref) {
22585
+ const filePath = decodeURIComponent(fileHref);
22586
+ return /* @__PURE__ */ jsx82("button", {
22587
+ type: "button",
22588
+ onClick: () => handleFileClick(filePath),
22589
+ className: `${mentionHighlightClasses.file} text-[0.92em] leading-normal transition-colors hover:bg-foreground/15`,
22590
+ title: filePath,
22591
+ children
22592
+ });
22593
+ }
22564
22594
  return /* @__PURE__ */ jsx82("a", {
22565
22595
  href,
22566
22596
  target: "_blank",
@@ -44919,4 +44949,4 @@ export {
44919
44949
  API_BASE_URL
44920
44950
  };
44921
44951
 
44922
- //# debugId=F892CC1F7A6D0E2A64756E2164756E21
44952
+ //# debugId=95A87165C36DED1464756E2164756E21