@hasna/assistants 0.6.36 → 0.6.37

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
@@ -38989,10 +38989,20 @@ class FilesystemTools {
38989
38989
  }
38990
38990
  const glob = new Glob(pattern);
38991
38991
  const matches = [];
38992
- for await (const file of glob.scan({ cwd: validated.resolved })) {
38993
- matches.push(file);
38994
- if (matches.length >= 1000)
38995
- break;
38992
+ try {
38993
+ for await (const file of glob.scan({ cwd: validated.resolved })) {
38994
+ if (file.includes(".Trash") || file.includes(".Spotlight-V100") || file.includes(".fseventsd")) {
38995
+ continue;
38996
+ }
38997
+ matches.push(file);
38998
+ if (matches.length >= 1000)
38999
+ break;
39000
+ }
39001
+ } catch (scanError) {
39002
+ const errMsg = scanError instanceof Error ? scanError.message : String(scanError);
39003
+ if (errMsg.includes("operation not permitted") || errMsg.includes("EPERM") || errMsg.includes("EACCES")) {} else {
39004
+ throw scanError;
39005
+ }
38996
39006
  }
38997
39007
  if (matches.length === 0) {
38998
39008
  return "No files found matching pattern";
@@ -39094,22 +39104,32 @@ class FilesystemTools {
39094
39104
  const regex2 = new RegExp(pattern, flags);
39095
39105
  const results = [];
39096
39106
  const glob = new Glob(globPattern);
39097
- for await (const file of glob.scan({ cwd: validated.resolved })) {
39098
- const filePath = join4(validated.resolved, file);
39099
- try {
39100
- const content = await Bun.file(filePath).text();
39101
- const lines = content.split(`
39107
+ try {
39108
+ for await (const file of glob.scan({ cwd: validated.resolved })) {
39109
+ if (file.includes(".Trash") || file.includes(".Spotlight-V100") || file.includes(".fseventsd")) {
39110
+ continue;
39111
+ }
39112
+ const filePath = join4(validated.resolved, file);
39113
+ try {
39114
+ const content = await Bun.file(filePath).text();
39115
+ const lines = content.split(`
39102
39116
  `);
39103
- for (let i = 0;i < lines.length; i++) {
39104
- if (regex2.test(lines[i])) {
39105
- results.push(`${file}:${i + 1}: ${lines[i].trim()}`);
39106
- if (results.length >= 500)
39107
- break;
39117
+ for (let i = 0;i < lines.length; i++) {
39118
+ if (regex2.test(lines[i])) {
39119
+ results.push(`${file}:${i + 1}: ${lines[i].trim()}`);
39120
+ if (results.length >= 500)
39121
+ break;
39122
+ }
39108
39123
  }
39109
- }
39110
- } catch {}
39111
- if (results.length >= 500)
39112
- break;
39124
+ } catch {}
39125
+ if (results.length >= 500)
39126
+ break;
39127
+ }
39128
+ } catch (scanError) {
39129
+ const errMsg = scanError instanceof Error ? scanError.message : String(scanError);
39130
+ if (errMsg.includes("operation not permitted") || errMsg.includes("EPERM") || errMsg.includes("EACCES")) {} else {
39131
+ throw scanError;
39132
+ }
39113
39133
  }
39114
39134
  if (results.length === 0) {
39115
39135
  return "No matches found";
@@ -49007,13 +49027,15 @@ function stripAnsi3(text) {
49007
49027
  }
49008
49028
 
49009
49029
  // packages/terminal/src/components/messageLines.ts
49010
- function estimateToolPanelLines(toolCalls, toolResults, hasContent) {
49030
+ function estimateToolPanelLines(toolCalls, toolResults, hasContent, maxWidth) {
49011
49031
  if (!toolCalls || toolCalls.length === 0) {
49012
49032
  return 0;
49013
49033
  }
49034
+ const innerWidth = maxWidth ? Math.max(1, maxWidth - 4) : undefined;
49035
+ const resultWidth = innerWidth ? Math.max(1, innerWidth - 4) : undefined;
49014
49036
  const resultLines = new Map;
49015
49037
  for (const result of toolResults || []) {
49016
- resultLines.set(result.toolCallId, estimateToolResultLines(result));
49038
+ resultLines.set(result.toolCallId, estimateToolResultLines(result, resultWidth));
49017
49039
  }
49018
49040
  let lines = 3;
49019
49041
  if (hasContent) {
@@ -49028,13 +49050,14 @@ function estimateToolPanelLines(toolCalls, toolResults, hasContent) {
49028
49050
  }
49029
49051
  return lines;
49030
49052
  }
49031
- function estimateToolResultLines(result, maxLines = 4) {
49053
+ function estimateToolResultLines(result, maxWidth, maxLines = 4) {
49032
49054
  const content = truncateToolResult(result, maxLines, 400);
49033
49055
  if (!content)
49034
49056
  return 1;
49035
49057
  const lines = stripAnsi4(content).split(`
49036
49058
  `);
49037
- return Math.max(1, lines.length);
49059
+ const wrapped = countWrappedLines(lines, maxWidth);
49060
+ return Math.max(1, wrapped);
49038
49061
  }
49039
49062
  function estimateMessageLines(message, maxWidth) {
49040
49063
  if (message.role === "system") {
@@ -49049,7 +49072,7 @@ function estimateMessageLines(message, maxWidth) {
49049
49072
  const wrappedLines = typeof message.__lineCount === "number" ? message.__lineCount : contentLines.length > 0 ? countWrappedLines(contentLines, effectiveWidth) : 0;
49050
49073
  let lines = hasContent ? Math.max(1, wrappedLines) : 0;
49051
49074
  if (message.role === "assistant" && message.toolCalls?.length) {
49052
- lines += estimateToolPanelLines(message.toolCalls, message.toolResults, hasContent);
49075
+ lines += estimateToolPanelLines(message.toolCalls, message.toolResults, hasContent, maxWidth);
49053
49076
  }
49054
49077
  if (message.role === "user" || message.role === "assistant") {
49055
49078
  if (!isContinuationChunk(message.id)) {
@@ -51395,7 +51418,7 @@ function formatStreamEvent(chunk) {
51395
51418
 
51396
51419
  // packages/terminal/src/index.tsx
51397
51420
  var jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
51398
- var VERSION3 = "0.6.36";
51421
+ var VERSION3 = "0.6.37";
51399
51422
  process.env.ASSISTANTS_VERSION ??= VERSION3;
51400
51423
  function parseArgs(argv) {
51401
51424
  const args = argv.slice(2);
@@ -51551,4 +51574,4 @@ if (options.print !== null) {
51551
51574
  });
51552
51575
  }
51553
51576
 
51554
- //# debugId=D20D9C4F4FE5D66664756E2164756E21
51577
+ //# debugId=883CA92CA3B9183064756E2164756E21