@meshagent/meshagent-tailwind 0.57.0 → 0.57.1

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.
@@ -108,62 +108,71 @@ class LiveToolCallAccumulator {
108
108
  return applyPatchStatusInfo({ arguments: call.arguments, deltaText });
109
109
  }
110
110
  }
111
- function applyPatchTextFromArguments(value) {
112
- if (typeof value === "string") {
113
- return value.trim() === "" ? void 0 : value;
114
- }
115
- if (Array.isArray(value)) {
116
- for (const nested of value) {
117
- const text = applyPatchTextFromArguments(nested);
118
- if (text != null) {
119
- return text;
120
- }
111
+ const maxArgumentDepth = 64;
112
+ const maxArgumentWork = 4096;
113
+ function searchToolArguments(value, pathOnly) {
114
+ const preferredKeys = pathOnly ? ["operation"] : ["patch", "input", "diff"];
115
+ const seen = /* @__PURE__ */ new WeakSet();
116
+ let remaining = maxArgumentWork;
117
+ let exhausted = false;
118
+ const step = () => {
119
+ if (exhausted || remaining-- <= 0) {
120
+ exhausted = true;
121
+ return false;
121
122
  }
122
- return void 0;
123
- }
124
- if (isRecord(value)) {
125
- for (const key of ["patch", "input", "diff"]) {
126
- const text = applyPatchTextFromArguments(value[key]);
127
- if (text != null) {
128
- return text;
129
- }
123
+ return true;
124
+ };
125
+ const find = (current, depth) => {
126
+ if (!step() || depth > maxArgumentDepth) {
127
+ exhausted = true;
128
+ return void 0;
130
129
  }
131
- for (const nested of Object.values(value)) {
132
- const text = applyPatchTextFromArguments(nested);
133
- if (text != null) {
134
- return text;
135
- }
130
+ if (typeof current === "string") {
131
+ return !pathOnly && current.trim() !== "" ? current : void 0;
136
132
  }
137
- }
138
- return void 0;
139
- }
140
- function applyPatchPathFromArguments(value) {
141
- if (Array.isArray(value)) {
142
- for (const nested of value) {
143
- const nestedPath = applyPatchPathFromArguments(nested);
144
- if (nestedPath != null) {
145
- return nestedPath;
133
+ if (!isRecord(current) && !Array.isArray(current)) {
134
+ return void 0;
135
+ }
136
+ if (seen.has(current)) {
137
+ return void 0;
138
+ }
139
+ seen.add(current);
140
+ if (Array.isArray(current)) {
141
+ for (const child of current) {
142
+ const result = find(child, depth + 1);
143
+ if (exhausted) return void 0;
144
+ if (result != null) return result;
146
145
  }
146
+ return void 0;
147
147
  }
148
- return void 0;
149
- }
150
- if (isRecord(value)) {
151
- const path = value.path;
152
- if (typeof path === "string" && path.trim() !== "") {
153
- return path.trim();
148
+ if (pathOnly) {
149
+ const path = current.path;
150
+ if (typeof path === "string" && path.trim() !== "") return path.trim();
154
151
  }
155
- const operationPath = applyPatchPathFromArguments(value.operation);
156
- if (operationPath != null) {
157
- return operationPath;
152
+ for (const key of preferredKeys) {
153
+ if (!step()) return void 0;
154
+ const child = current[key];
155
+ if (child == null) continue;
156
+ const result = find(child, depth + 1);
157
+ if (exhausted) return void 0;
158
+ if (result != null) return result;
158
159
  }
159
- for (const nested of Object.values(value)) {
160
- const nestedPath = applyPatchPathFromArguments(nested);
161
- if (nestedPath != null) {
162
- return nestedPath;
163
- }
160
+ for (const key in current) {
161
+ if (!step()) return void 0;
162
+ if (!Object.prototype.hasOwnProperty.call(current, key) || preferredKeys.includes(key)) continue;
163
+ const result = find(current[key], depth + 1);
164
+ if (exhausted) return void 0;
165
+ if (result != null) return result;
164
166
  }
165
- }
166
- return void 0;
167
+ return void 0;
168
+ };
169
+ return find(value, 0);
170
+ }
171
+ function applyPatchTextFromArguments(value) {
172
+ return searchToolArguments(value, false);
173
+ }
174
+ function applyPatchPathFromArguments(value) {
175
+ return searchToolArguments(value, true);
167
176
  }
168
177
  function applyPatchPathFromText(patch) {
169
178
  const filePattern = /^\*\*\* (?:Update|Add|Delete) File: (.+)$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-tailwind",
3
- "version": "0.57.0",
3
+ "version": "0.57.1",
4
4
  "description": "Meshagent Tailwind Components",
5
5
  "homepage": "https://github.com/meshagent/meshagent-tailwind",
6
6
  "scripts": {
@@ -35,10 +35,10 @@
35
35
  "CHANGELOG.md"
36
36
  ],
37
37
  "dependencies": {
38
- "@meshagent/meshagent": "^0.57.0",
39
- "@meshagent/meshagent-agents": "^0.57.0",
40
- "@meshagent/meshagent-react": "^0.57.0",
41
- "@meshagent/meshagent-livekit": "^0.57.0",
38
+ "@meshagent/meshagent": "^0.57.1",
39
+ "@meshagent/meshagent-agents": "^0.57.1",
40
+ "@meshagent/meshagent-react": "^0.57.1",
41
+ "@meshagent/meshagent-livekit": "^0.57.1",
42
42
  "@radix-ui/react-avatar": "^1.1.10",
43
43
  "@radix-ui/react-checkbox": "^1.3.2",
44
44
  "@radix-ui/react-dialog": "^1.1.14",