@hasna/assistants 0.6.17 → 0.6.18

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.
package/dist/index.js CHANGED
@@ -45734,7 +45734,24 @@ function getToolContext(toolCall) {
45734
45734
  return truncate(String(input.pattern || ""), 20);
45735
45735
  case "grep":
45736
45736
  return truncate(String(input.pattern || ""), 20);
45737
+ case "schedule":
45738
+ return String(input.action || "");
45739
+ case "feedback":
45740
+ return String(input.type || "feedback");
45741
+ case "web_search":
45742
+ return truncate(String(input.query || ""), 20);
45743
+ case "web_fetch":
45744
+ case "curl":
45745
+ const url = String(input.url || "");
45746
+ try {
45747
+ return new URL(url).hostname;
45748
+ } catch {
45749
+ return truncate(url, 20);
45750
+ }
45737
45751
  default:
45752
+ const action = input.action || input.command || input.operation;
45753
+ if (action)
45754
+ return truncate(String(action), 20);
45738
45755
  return "";
45739
45756
  }
45740
45757
  }
@@ -45758,6 +45775,10 @@ function getToolDisplayName(toolCall) {
45758
45775
  return "grep";
45759
45776
  case "display_image":
45760
45777
  return "image";
45778
+ case "schedule":
45779
+ return "schedule";
45780
+ case "feedback":
45781
+ return "feedback";
45761
45782
  case "notion":
45762
45783
  case "gmail":
45763
45784
  case "googledrive":
@@ -45788,6 +45809,10 @@ function formatToolCall(toolCall) {
45788
45809
  return `Finding: ${truncate(String(input.pattern || ""), 60)}`;
45789
45810
  case "grep":
45790
45811
  return `Searching: ${truncate(String(input.pattern || ""), 60)}`;
45812
+ case "schedule":
45813
+ return formatScheduleCall(input);
45814
+ case "feedback":
45815
+ return formatFeedbackCall(input);
45791
45816
  case "notion":
45792
45817
  return `Notion: ${truncate(String(input.command || input.action || ""), 60)}`;
45793
45818
  case "gmail":
@@ -45801,9 +45826,44 @@ function formatToolCall(toolCall) {
45801
45826
  case "slack":
45802
45827
  return `Slack: ${truncate(String(input.command || input.action || ""), 60)}`;
45803
45828
  default:
45804
- return `${name}: ${truncate(JSON.stringify(input), 50)}`;
45829
+ if (name.startsWith("connect_") || name.includes("_")) {
45830
+ const action = String(input.command || input.action || input.operation || "");
45831
+ if (action) {
45832
+ return `${formatToolDisplayName(name)}: ${truncate(action, 50)}`;
45833
+ }
45834
+ }
45835
+ return `${formatToolDisplayName(name)}: ${truncate(JSON.stringify(input), 50)}`;
45836
+ }
45837
+ }
45838
+ function formatToolDisplayName(name) {
45839
+ return name.replace(/^connect_/, "").replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
45840
+ }
45841
+ function formatScheduleCall(input) {
45842
+ const action = String(input.action || "");
45843
+ switch (action) {
45844
+ case "list":
45845
+ return "Listing scheduled tasks";
45846
+ case "create":
45847
+ const cmd = truncate(String(input.command || ""), 30);
45848
+ const schedule = String(input.schedule || "");
45849
+ return `Creating schedule: "${cmd}" (${schedule})`;
45850
+ case "update":
45851
+ return `Updating schedule: ${input.id || "unknown"}`;
45852
+ case "delete":
45853
+ return `Deleting schedule: ${input.id || "unknown"}`;
45854
+ case "pause":
45855
+ return `Pausing schedule: ${input.id || "unknown"}`;
45856
+ case "resume":
45857
+ return `Resuming schedule: ${input.id || "unknown"}`;
45858
+ default:
45859
+ return `Schedule: ${action || "unknown action"}`;
45805
45860
  }
45806
45861
  }
45862
+ function formatFeedbackCall(input) {
45863
+ const type = String(input.type || "feedback");
45864
+ const title = truncate(String(input.title || ""), 40);
45865
+ return `Submitting ${type}: ${title}`;
45866
+ }
45807
45867
  function truncate(text, maxLength) {
45808
45868
  if (text.length <= maxLength)
45809
45869
  return text;
@@ -45811,8 +45871,12 @@ function truncate(text, maxLength) {
45811
45871
  }
45812
45872
  function truncateToolResult(toolResult, maxLines = 15, maxChars = 3000) {
45813
45873
  const toolName = toolResult.toolName || "tool";
45814
- const prefix = toolResult.isError ? `Error from ${toolName}: ` : `${toolName}: `;
45815
45874
  let content = String(toolResult.content || "");
45875
+ const formatted = formatToolResultNicely(toolName, content, toolResult.isError);
45876
+ if (formatted) {
45877
+ return formatted;
45878
+ }
45879
+ const prefix = toolResult.isError ? `Error: ` : "";
45816
45880
  content = content.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
45817
45881
  content = content.replace(/\t/g, " ");
45818
45882
  const lines = content.split(`
@@ -45827,6 +45891,129 @@ function truncateToolResult(toolResult, maxLines = 15, maxChars = 3000) {
45827
45891
  }
45828
45892
  return prefix + content.trim();
45829
45893
  }
45894
+ function formatToolResultNicely(toolName, content, isError) {
45895
+ if (isError) {
45896
+ if (content.includes("ENOENT") || content.includes("no such file")) {
45897
+ return "\u26A0 File not found";
45898
+ }
45899
+ if (content.includes("EACCES") || content.includes("permission denied")) {
45900
+ return "\u26A0 Permission denied";
45901
+ }
45902
+ if (content.includes("ETIMEDOUT") || content.includes("timeout")) {
45903
+ return "\u26A0 Request timed out";
45904
+ }
45905
+ return null;
45906
+ }
45907
+ switch (toolName) {
45908
+ case "schedule":
45909
+ return formatScheduleResult(content);
45910
+ case "feedback":
45911
+ return formatFeedbackResult(content);
45912
+ case "read":
45913
+ return formatReadResult(content);
45914
+ case "write":
45915
+ return formatWriteResult(content);
45916
+ case "glob":
45917
+ return formatGlobResult(content);
45918
+ case "grep":
45919
+ return formatGrepResult(content);
45920
+ case "bash":
45921
+ return formatBashResult(content);
45922
+ case "web_search":
45923
+ return formatSearchResult(content);
45924
+ default:
45925
+ return null;
45926
+ }
45927
+ }
45928
+ function formatScheduleResult(content) {
45929
+ const trimmed = content.trim().toLowerCase();
45930
+ if (trimmed === "no schedules found." || trimmed.includes("no schedules")) {
45931
+ return "\uD83D\uDCC5 No scheduled tasks";
45932
+ }
45933
+ if (trimmed.includes("created") || trimmed.includes("scheduled")) {
45934
+ return "\u2713 Schedule created";
45935
+ }
45936
+ if (trimmed.includes("deleted") || trimmed.includes("removed")) {
45937
+ return "\u2713 Schedule deleted";
45938
+ }
45939
+ if (trimmed.includes("paused")) {
45940
+ return "\u23F8 Schedule paused";
45941
+ }
45942
+ if (trimmed.includes("resumed")) {
45943
+ return "\u25B6 Schedule resumed";
45944
+ }
45945
+ if (content.includes("id:") || content.includes("command:")) {
45946
+ const lines = content.split(`
45947
+ `).filter((l) => l.trim());
45948
+ return `\uD83D\uDCC5 ${lines.length} scheduled task${lines.length !== 1 ? "s" : ""}`;
45949
+ }
45950
+ return null;
45951
+ }
45952
+ function formatFeedbackResult(content) {
45953
+ if (content.includes("submitted") || content.includes("created")) {
45954
+ return "\u2713 Feedback submitted";
45955
+ }
45956
+ return null;
45957
+ }
45958
+ function formatReadResult(content) {
45959
+ const lines = content.split(`
45960
+ `).length;
45961
+ if (lines > 20) {
45962
+ return `\uD83D\uDCC4 Read ${lines} lines`;
45963
+ }
45964
+ return null;
45965
+ }
45966
+ function formatWriteResult(content) {
45967
+ if (content.includes("written") || content.includes("saved") || content.includes("created")) {
45968
+ return "\u2713 File saved";
45969
+ }
45970
+ return null;
45971
+ }
45972
+ function formatGlobResult(content) {
45973
+ const lines = content.split(`
45974
+ `).filter((l) => l.trim());
45975
+ if (lines.length === 0) {
45976
+ return "\uD83D\uDD0D No files found";
45977
+ }
45978
+ if (lines.length > 10) {
45979
+ return `\uD83D\uDD0D Found ${lines.length} files`;
45980
+ }
45981
+ return null;
45982
+ }
45983
+ function formatGrepResult(content) {
45984
+ const lines = content.split(`
45985
+ `).filter((l) => l.trim());
45986
+ if (lines.length === 0) {
45987
+ return "\uD83D\uDD0D No matches found";
45988
+ }
45989
+ if (lines.length > 10) {
45990
+ return `\uD83D\uDD0D Found ${lines.length} matches`;
45991
+ }
45992
+ return null;
45993
+ }
45994
+ function formatBashResult(content) {
45995
+ const trimmed = content.trim();
45996
+ if (!trimmed) {
45997
+ return "\u2713 Command completed";
45998
+ }
45999
+ if (trimmed.length < 100 && !trimmed.includes(`
46000
+ `)) {
46001
+ return null;
46002
+ }
46003
+ const lines = trimmed.split(`
46004
+ `).length;
46005
+ if (lines > 20) {
46006
+ return `\u2713 Output: ${lines} lines`;
46007
+ }
46008
+ return null;
46009
+ }
46010
+ function formatSearchResult(content) {
46011
+ const resultCount = (content.match(/https?:\/\//g) || []).length;
46012
+ if (resultCount > 0) {
46013
+ return `\uD83D\uDD0D Found ${resultCount} result${resultCount !== 1 ? "s" : ""}`;
46014
+ }
46015
+ return null;
46016
+ }
45830
46017
 
45831
46018
  // packages/terminal/src/components/Status.tsx
45832
46019
  var import_react25 = __toESM(require_react(), 1);
@@ -47334,7 +47521,7 @@ function formatStreamEvent(chunk) {
47334
47521
 
47335
47522
  // packages/terminal/src/index.tsx
47336
47523
  var jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
47337
- var VERSION3 = "0.6.17";
47524
+ var VERSION3 = "0.6.18";
47338
47525
  function parseArgs(argv) {
47339
47526
  const args = argv.slice(2);
47340
47527
  const options = {
@@ -47497,4 +47684,4 @@ if (options.print !== null) {
47497
47684
  });
47498
47685
  }
47499
47686
 
47500
- //# debugId=36B3EC68850C35ED64756E2164756E21
47687
+ //# debugId=EED40350F624F85864756E2164756E21