@quanta-intellect/vessel-browser 0.1.97 → 0.1.99

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.
@@ -7692,9 +7692,10 @@ function uniqueQuickReplies(options) {
7692
7692
  return true;
7693
7693
  });
7694
7694
  }
7695
- const YES_NO_QUESTION_PATTERN = /\b(?:do you want|should (?:i|we|vessel)|would you like|is it okay|okay to|shall (?:i|we))\b/i;
7695
+ const YES_NO_QUESTION_PATTERN = /^\s*(?:do you want|should (?:i|we|vessel)|would you like|is it okay|okay to|shall (?:i|we))\b/i;
7696
7696
  const PROCEED_QUESTION_PATTERN = /\b(?:proceed|continue|use defaults?|make assumptions?|sensible defaults?)\b/i;
7697
- const EXPLICIT_OPTION_PREFIX = /^\s*(?:[-*•–—]|\d+[.)]|\(\d+\)|[A-Z][.)]|\([A-Z]\)|Option\s+\d+[::])\s+/i;
7697
+ const EXPLICIT_OPTION_PREFIX = /^\s*(?:[-*+•–—]|\d+[.)]|\(\d+\)|[A-Za-z][.)]|\([A-Za-z]\)|Option\s+\d+[::])\s+/i;
7698
+ const SENTENCE_STARTER = /^(?:Here|These|They|You|I\s|We\s|This|That|If|When|Because|Also|Please|Let|Will|Would|Could|Should|Can|May|Might|Must|Shall)\b/i;
7698
7699
  function makeQuickReply(label) {
7699
7700
  const cleaned = label.replace(EXPLICIT_OPTION_PREFIX, "").replace(/\s+/g, " ").trim().replace(/[.?!:]$/, "");
7700
7701
  if (cleaned.length < 2 || cleaned.length > 80) return null;
@@ -7710,22 +7711,81 @@ function isExplicitOptionLine(line) {
7710
7711
  return !/[?]$/.test(cleaned);
7711
7712
  }
7712
7713
  function extractDelimitedOptions(text2) {
7713
- return text2.split(/\s*(?:;|,|\/|\||\bor\b)\s*/i).map(makeQuickReply).filter((option) => option !== null);
7714
+ return text2.split(/\s*(?:;|,|\/|\||\s+-\s+|\bor\b)\s*/i).map(makeQuickReply).filter((option) => option !== null);
7714
7715
  }
7715
7716
  function extractFollowUpOptions(prompt) {
7716
7717
  const lines = prompt.split("\n");
7717
7718
  const options = [];
7718
7719
  for (let i = 0; i < lines.length - 1; i++) {
7719
7720
  const line = lines[i].trim();
7720
- const nextLine = lines[i + 1].trim();
7721
7721
  if (!line.includes("?")) continue;
7722
- if (!nextLine) continue;
7722
+ let j = i + 1;
7723
+ while (j < lines.length && !lines[j].trim()) j++;
7724
+ if (j >= lines.length) continue;
7725
+ const nextLine = lines[j].trim();
7723
7726
  if (EXPLICIT_OPTION_PREFIX.test(nextLine)) continue;
7724
7727
  if (!/[,;\/|]|\bor\b/.test(nextLine)) continue;
7725
7728
  options.push(...extractDelimitedOptions(nextLine));
7726
7729
  }
7727
7730
  return uniqueQuickReplies(options);
7728
7731
  }
7732
+ function extractInlineOptions(prompt) {
7733
+ const options = [];
7734
+ for (const line of prompt.split("\n")) {
7735
+ const trimmed = line.trim();
7736
+ if (!/\?/.test(trimmed)) continue;
7737
+ const afterQuestion = trimmed.slice(trimmed.lastIndexOf("?") + 1).trim();
7738
+ if (!afterQuestion) continue;
7739
+ if (/\b(?:options?|choices?|examples?|example answers?|examples? include|sample answers?|sample responses?)\b.*[::]/i.test(afterQuestion)) {
7740
+ continue;
7741
+ }
7742
+ const hasDelimiters = /[,;\/|]|\bor\b/.test(afterQuestion);
7743
+ const hasDashList = /\s+-\s+/.test(afterQuestion);
7744
+ if (!hasDelimiters && !hasDashList) continue;
7745
+ if (hasDelimiters) {
7746
+ options.push(...extractDelimitedOptions(afterQuestion));
7747
+ }
7748
+ if (hasDashList) {
7749
+ const parts = afterQuestion.split(/\s+-\s+/);
7750
+ for (const part of parts) {
7751
+ const option = makeQuickReply(part);
7752
+ if (option) options.push(option);
7753
+ }
7754
+ }
7755
+ }
7756
+ return uniqueQuickReplies(options);
7757
+ }
7758
+ function extractImplicitOptions(prompt) {
7759
+ const lines = prompt.split("\n");
7760
+ const options = [];
7761
+ let questionIdx = -1;
7762
+ for (let i2 = lines.length - 1; i2 >= 0; i2--) {
7763
+ if (lines[i2].includes("?")) {
7764
+ questionIdx = i2;
7765
+ break;
7766
+ }
7767
+ }
7768
+ if (questionIdx < 0) return [];
7769
+ let i = questionIdx + 1;
7770
+ while (i < lines.length && !lines[i].trim()) i++;
7771
+ const candidates = [];
7772
+ for (; i < lines.length; i++) {
7773
+ const line = lines[i].trim();
7774
+ if (!line) break;
7775
+ if (EXPLICIT_OPTION_PREFIX.test(line)) break;
7776
+ if (SENTENCE_STARTER.test(line)) break;
7777
+ const hasDelimiters = /[,;\/|]|\bor\b/.test(line);
7778
+ if (line.length > 80 && !hasDelimiters) break;
7779
+ candidates.push(line);
7780
+ }
7781
+ if (candidates.length >= 2 && candidates.length <= 6) {
7782
+ for (const candidate of candidates) {
7783
+ const option = makeQuickReply(candidate);
7784
+ if (option) options.push(option);
7785
+ }
7786
+ }
7787
+ return uniqueQuickReplies(options);
7788
+ }
7729
7789
  function extractExampleQuickReplies(prompt) {
7730
7790
  const options = [];
7731
7791
  for (const line of prompt.split("\n")) {
@@ -7753,9 +7813,22 @@ function extractExplicitQuickReplies(prompt) {
7753
7813
  if (inlineMatch) {
7754
7814
  options.push(...extractDelimitedOptions(inlineMatch[1]));
7755
7815
  }
7756
- const labelledMatch = prompt.match(/(?:options?|choices?)\s*[::]\s*(.+?)(?:\n|$)/i);
7757
- if (labelledMatch) {
7758
- options.push(...extractDelimitedOptions(labelledMatch[1]));
7816
+ options.push(...extractInlineOptions(prompt));
7817
+ const lines = prompt.split("\n");
7818
+ for (let i = 0; i < lines.length; i++) {
7819
+ if (!/\b(?:options?|choices?)\s*[::]/i.test(lines[i])) continue;
7820
+ const restOfLine = lines[i].replace(/^.*?\b(?:options?|choices?)\s*[::]\s*/i, "").trim();
7821
+ if (restOfLine) {
7822
+ options.push(...extractDelimitedOptions(restOfLine));
7823
+ }
7824
+ let j = i + 1;
7825
+ while (j < lines.length && !lines[j].trim()) j++;
7826
+ for (; j < lines.length; j++) {
7827
+ const line = lines[j].trim();
7828
+ if (!line) break;
7829
+ const option = makeQuickReply(line);
7830
+ if (option) options.push(option);
7831
+ }
7759
7832
  }
7760
7833
  options.push(...extractExampleQuickReplies(prompt));
7761
7834
  options.push(...extractFollowUpOptions(prompt));
@@ -7766,6 +7839,10 @@ function buildQuickReplies(prompt) {
7766
7839
  if (explicitOptions.length > 0) {
7767
7840
  return explicitOptions.slice(0, 6);
7768
7841
  }
7842
+ const implicitOptions = extractImplicitOptions(prompt);
7843
+ if (implicitOptions.length > 0) {
7844
+ return implicitOptions.slice(0, 6);
7845
+ }
7769
7846
  if (YES_NO_QUESTION_PATTERN.test(prompt)) {
7770
7847
  return [{
7771
7848
  label: "Yes",
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'self'; base-uri 'none'; object-src 'none'; frame-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; font-src 'self' data:; form-action 'self';" />
7
7
  <title>Vessel</title>
8
- <script type="module" crossorigin src="./assets/index-BLDCpaUR.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-DEcAiUVe.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-CzIBoLK8.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quanta-intellect/vessel-browser",
3
3
  "mcpName": "io.github.unmodeled-tyler/vessel-browser",
4
- "version": "0.1.97",
4
+ "version": "0.1.99",
5
5
  "description": "AI-native web browser runtime for autonomous agents with human supervision",
6
6
  "main": "./out/main/index.js",
7
7
  "bin": {