@ottocode/web-sdk 0.1.252 → 0.1.254

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.
@@ -388,6 +388,7 @@ var TOOL_ICONS = {
388
388
  edit: FileEdit,
389
389
  multiedit: FileEdit,
390
390
  write: FileEdit,
391
+ copy_into: FileEdit,
391
392
  apply_patch: FileEdit,
392
393
  terminal: Terminal,
393
394
  git_commit: GitCommit,
@@ -1187,8 +1188,7 @@ var configMixin = {
1187
1188
  },
1188
1189
  async deleteProviderSettings(provider) {
1189
1190
  const response = await apiDeleteProviderSettings({
1190
- path: { provider },
1191
- query: { scope: "local" }
1191
+ path: { provider }
1192
1192
  });
1193
1193
  if (response.error)
1194
1194
  throw new Error(extractErrorMessage(response.error));
@@ -1806,6 +1806,9 @@ function applyFontFamily(fontFamily) {
1806
1806
  }
1807
1807
  document.documentElement.style.setProperty("--otto-font-family", cssFontFamily(fontFamily));
1808
1808
  document.documentElement.dataset.ottoFontFamily = fontFamily;
1809
+ if (window.self !== window.top) {
1810
+ window.parent.postMessage({ type: "otto-font-family-changed", fontFamily }, "*");
1811
+ }
1809
1812
  }
1810
1813
  function resolveInitialPreferences() {
1811
1814
  if (typeof window === "undefined") {
@@ -6950,6 +6953,7 @@ function normalizeToolTarget(toolName, args) {
6950
6953
  edit: ["path"],
6951
6954
  multiedit: ["path"],
6952
6955
  write: ["path"],
6956
+ copy_into: ["targetPath", "sourcePath"],
6953
6957
  apply_patch: ["path"],
6954
6958
  glob: ["pattern"],
6955
6959
  grep: ["query", "pattern"],
@@ -7058,10 +7062,11 @@ var ToolApprovalCard = memo7(function ToolApprovalCard2({
7058
7062
  })
7059
7063
  });
7060
7064
  }
7061
- if ((toolName === "edit" || toolName === "multiedit") && (primary?.value || filePath)) {
7065
+ if ((toolName === "edit" || toolName === "multiedit" || toolName === "copy_into") && (primary?.value || filePath)) {
7066
+ const message = toolName === "copy_into" ? `Lines ${String(args?.startLine ?? "?")}-${String(args?.endLine ?? "?")} from ${String(args?.sourcePath ?? "source")} will be copied into this file.` : toolName === "multiedit" ? "Multiple exact replacements will be applied atomically." : "An exact text replacement will be applied to this file.";
7062
7067
  return /* @__PURE__ */ jsx24("div", {
7063
7068
  className: "ml-6 text-xs text-muted-foreground",
7064
- children: toolName === "multiedit" ? "Multiple exact replacements will be applied atomically." : "An exact text replacement will be applied to this file."
7069
+ children: message
7065
7070
  });
7066
7071
  }
7067
7072
  if (isShellTool(normalizedToolName) && args?.cmd) {
@@ -11069,6 +11074,7 @@ var TOOL_NAME_ALIASES = {
11069
11074
  Edit: "edit",
11070
11075
  MultiEdit: "multiedit",
11071
11076
  Write: "write",
11077
+ CopyInto: "copy_into",
11072
11078
  Ls: "ls",
11073
11079
  Tree: "tree",
11074
11080
  Cd: "cd",
@@ -11099,6 +11105,7 @@ var COMPACT_DETAIL_TOOL_NAMES = new Set([
11099
11105
  "edit",
11100
11106
  "multiedit",
11101
11107
  "write",
11108
+ "copy_into",
11102
11109
  "apply_patch",
11103
11110
  "terminal"
11104
11111
  ]);
@@ -11137,6 +11144,7 @@ function ToolResultRenderer({
11137
11144
  });
11138
11145
  case "edit":
11139
11146
  case "multiedit":
11147
+ case "copy_into":
11140
11148
  return /* @__PURE__ */ jsx53(ApplyPatchRenderer, {
11141
11149
  ...props,
11142
11150
  toolName: normalizedName
@@ -11432,7 +11440,7 @@ var MessagePartItem = memo8(function MessagePartItem2({
11432
11440
  return /* @__PURE__ */ jsx54(FileText5, {
11433
11441
  className: "h-4 w-4 text-blue-600 dark:text-blue-300"
11434
11442
  });
11435
- if (toolName === "write")
11443
+ if (toolName === "write" || toolName === "copy_into")
11436
11444
  return /* @__PURE__ */ jsx54(FileEdit2, {
11437
11445
  className: "h-4 w-4 text-emerald-600 dark:text-emerald-300"
11438
11446
  });
@@ -12353,6 +12361,11 @@ var TOOL_CONFIG = {
12353
12361
  color: "text-purple-600 dark:text-purple-300",
12354
12362
  label: "Editing"
12355
12363
  },
12364
+ copy_into: {
12365
+ Icon: FileEdit3,
12366
+ color: "text-purple-600 dark:text-purple-300",
12367
+ label: "Copying"
12368
+ },
12356
12369
  terminal: {
12357
12370
  Icon: Terminal6,
12358
12371
  color: "text-amber-600 dark:text-amber-300",
@@ -12376,6 +12389,8 @@ function getTargetFromArgs(toolName, args) {
12376
12389
  return String(args.path || "");
12377
12390
  if (toolName === "edit" || toolName === "multiedit")
12378
12391
  return String(args.path || "");
12392
+ if (toolName === "copy_into")
12393
+ return String(args.targetPath || "");
12379
12394
  if (toolName === "apply_patch") {
12380
12395
  const patch = String(args.patch || "");
12381
12396
  return getPatchTarget(patch) || "";
@@ -12395,6 +12410,9 @@ function getTargetFromStream(toolName, raw) {
12395
12410
  if (toolName === "edit" || toolName === "multiedit") {
12396
12411
  return extractJsonStringField(raw, "path");
12397
12412
  }
12413
+ if (toolName === "copy_into") {
12414
+ return extractJsonStringField(raw, "targetPath");
12415
+ }
12398
12416
  if (toolName === "apply_patch") {
12399
12417
  const m = raw.match(/\*\*\*\s+(?:Update|Add|Delete|Replace in):\s+(.+?)(?:\\n|")/);
12400
12418
  return m ? m[1].trim() : "";
@@ -12656,6 +12674,8 @@ function getContentFromArgs(toolName, args) {
12656
12674
  return String(args.oldString || "");
12657
12675
  if (toolName === "multiedit")
12658
12676
  return "";
12677
+ if (toolName === "copy_into")
12678
+ return "";
12659
12679
  return "";
12660
12680
  }
12661
12681
  function extractJsonStringField(raw, field) {
@@ -12703,6 +12723,8 @@ function getContentFromStream(toolName, raw) {
12703
12723
  return extractJsonStringField(raw, "oldString");
12704
12724
  if (toolName === "multiedit")
12705
12725
  return "";
12726
+ if (toolName === "copy_into")
12727
+ return "";
12706
12728
  return "";
12707
12729
  }
12708
12730
 
@@ -13061,6 +13083,7 @@ var AssistantMessageGroup = memo9(function AssistantMessageGroup2({
13061
13083
  "edit",
13062
13084
  "multiedit",
13063
13085
  "write",
13086
+ "copy_into",
13064
13087
  "apply_patch",
13065
13088
  "terminal"
13066
13089
  ].includes(part.toolName || "")).map((part) => part.toolCallId).filter((callId) => Boolean(callId)));
@@ -13262,6 +13285,7 @@ var AssistantMessageGroup = memo9(function AssistantMessageGroup2({
13262
13285
  "edit",
13263
13286
  "multiedit",
13264
13287
  "write",
13288
+ "copy_into",
13265
13289
  "apply_patch",
13266
13290
  "terminal"
13267
13291
  ].includes(part.toolName || "");
@@ -21355,8 +21379,7 @@ function useAuthStatus() {
21355
21379
  ...data.apiKey ? { apiKey: data.apiKey } : {},
21356
21380
  compatibility: data.compatibility,
21357
21381
  models: data.models,
21358
- allowAnyModel: data.allowAnyModel,
21359
- scope: "local"
21382
+ allowAnyModel: data.allowAnyModel
21360
21383
  });
21361
21384
  await fetchAuthStatus();
21362
21385
  return result;
@@ -21638,6 +21661,32 @@ var COMMON_SYSTEM_FONTS = [
21638
21661
  "Ubuntu",
21639
21662
  "Verdana"
21640
21663
  ];
21664
+ function requestDesktopSystemFonts() {
21665
+ if (typeof window === "undefined" || window.self === window.top) {
21666
+ return Promise.resolve(null);
21667
+ }
21668
+ return new Promise((resolve, reject) => {
21669
+ const requestId = crypto.randomUUID();
21670
+ const timeout = window.setTimeout(() => {
21671
+ window.removeEventListener("message", handleMessage);
21672
+ resolve(null);
21673
+ }, 3000);
21674
+ function handleMessage(event) {
21675
+ if (event.data?.type !== "otto-system-fonts-result" || event.data.requestId !== requestId) {
21676
+ return;
21677
+ }
21678
+ window.clearTimeout(timeout);
21679
+ window.removeEventListener("message", handleMessage);
21680
+ if (event.data.error) {
21681
+ reject(new Error(event.data.error));
21682
+ return;
21683
+ }
21684
+ resolve(event.data.fonts ?? null);
21685
+ }
21686
+ window.addEventListener("message", handleMessage);
21687
+ window.parent.postMessage({ type: "otto-list-system-fonts", requestId }, "*");
21688
+ });
21689
+ }
21641
21690
  var SettingsSection = memo31(function SettingsSection2({
21642
21691
  title,
21643
21692
  icon,
@@ -21805,6 +21854,7 @@ var FontPickerRow = memo31(function FontPickerRow2({
21805
21854
  const [isLoadingFonts, setIsLoadingFonts] = useState39(false);
21806
21855
  const [fontError, setFontError] = useState39(null);
21807
21856
  const canQueryLocalFonts = typeof window !== "undefined" && typeof window.queryLocalFonts === "function";
21857
+ const canRequestDesktopFonts = typeof window !== "undefined" && window.self !== window.top;
21808
21858
  const fontOptions = useMemo22(() => {
21809
21859
  return Array.from(new Set([value, ...localFonts, ...COMMON_SYSTEM_FONTS].filter(Boolean))).sort((a, b) => a.localeCompare(b));
21810
21860
  }, [localFonts, value]);
@@ -21818,15 +21868,20 @@ var FontPickerRow = memo31(function FontPickerRow2({
21818
21868
  if (isLoadingFonts || localFonts.length > 0)
21819
21869
  return;
21820
21870
  const queryLocalFonts = window.queryLocalFonts;
21821
- if (!queryLocalFonts) {
21822
- setFontError("Local font access is not supported in this browser");
21823
- return;
21824
- }
21825
21871
  setIsLoadingFonts(true);
21826
21872
  setFontError(null);
21827
21873
  try {
21828
- const fonts = await queryLocalFonts();
21829
- setLocalFonts(Array.from(new Set(fonts.map((font) => font.family).filter(Boolean))));
21874
+ if (queryLocalFonts) {
21875
+ const fonts = await queryLocalFonts();
21876
+ setLocalFonts(Array.from(new Set(fonts.map((font) => font.family).filter(Boolean))));
21877
+ return;
21878
+ }
21879
+ const desktopFonts = await requestDesktopSystemFonts();
21880
+ if (desktopFonts?.length) {
21881
+ setLocalFonts(desktopFonts);
21882
+ return;
21883
+ }
21884
+ setFontError("Local font access is not supported in this browser");
21830
21885
  } catch (error) {
21831
21886
  setFontError(error instanceof Error ? error.message : "Unable to load local fonts");
21832
21887
  } finally {
@@ -21906,7 +21961,7 @@ var FontPickerRow = memo31(function FontPickerRow2({
21906
21961
  }),
21907
21962
  /* @__PURE__ */ jsx88("div", {
21908
21963
  className: "border-t border-border px-3 py-2 text-xs text-muted-foreground",
21909
- children: isLoadingFonts ? "Loading local fonts..." : fontError ? fontError : localFonts.length > 0 ? `${localFonts.length} local fonts found` : canQueryLocalFonts ? "Choose a font or allow local font access if prompted" : "Showing common system fonts"
21964
+ children: isLoadingFonts ? "Loading local fonts..." : fontError ? fontError : localFonts.length > 0 ? `${localFonts.length} local fonts found` : canQueryLocalFonts ? "Choose a font or allow local font access if prompted" : canRequestDesktopFonts ? "Loading desktop system fonts if available" : "Showing common system fonts"
21910
21965
  })
21911
21966
  ]
21912
21967
  })
@@ -27491,4 +27546,4 @@ export {
27491
27546
  AssistantMessageGroup
27492
27547
  };
27493
27548
 
27494
- //# debugId=B981D17F74D0602964756E2164756E21
27549
+ //# debugId=90A1703CE44547A964756E2164756E21