llmz 0.0.11 → 0.0.13

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.
Files changed (92) hide show
  1. package/dist/chat.d.ts +17 -0
  2. package/dist/chunk-276Q6EWP.cjs +224 -0
  3. package/dist/chunk-4L6D2A6O.cjs +283 -0
  4. package/dist/chunk-4MNIJGK6.js +224 -0
  5. package/dist/chunk-7WRN4E42.js +3087 -0
  6. package/dist/chunk-BEPRLBPK.cjs +3123 -0
  7. package/dist/chunk-C6WNNTEV.cjs +212 -0
  8. package/dist/chunk-D3ESDRLH.js +3123 -0
  9. package/dist/chunk-GGWM6X2K.js +184 -0
  10. package/dist/chunk-GWFYZDUR.cjs +105 -0
  11. package/dist/chunk-HJKOSEH2.cjs +722 -0
  12. package/dist/chunk-IH2WQFO5.js +283 -0
  13. package/dist/chunk-IKSIOIIP.cjs +28 -0
  14. package/dist/chunk-JAGB2AOU.js +212 -0
  15. package/dist/chunk-JDABP4SD.cjs +161 -0
  16. package/dist/chunk-JGVAZO4X.cjs +152 -0
  17. package/dist/chunk-JKVVQN2P.js +161 -0
  18. package/dist/chunk-JMSZKB4T.js +105 -0
  19. package/dist/chunk-JQBT7UWN.js +28 -0
  20. package/dist/chunk-KH6JQYQA.js +796 -0
  21. package/dist/chunk-KMZDFWYZ.cjs +33 -0
  22. package/dist/chunk-ORQP26SZ.js +33 -0
  23. package/dist/chunk-PRVFVXT4.js +722 -0
  24. package/dist/chunk-SHJDRZF5.cjs +796 -0
  25. package/dist/chunk-SNDVQU5A.js +152 -0
  26. package/dist/chunk-UQOBUJIQ.cjs +3087 -0
  27. package/dist/chunk-ZRCU35UV.cjs +184 -0
  28. package/dist/citations.d.ts +63 -0
  29. package/dist/compiler/compiler.d.ts +28 -0
  30. package/dist/compiler/index.d.ts +2 -0
  31. package/dist/compiler/plugins/async-iterator.d.ts +4 -0
  32. package/dist/compiler/plugins/braces-tsx.d.ts +3 -0
  33. package/dist/compiler/plugins/jsx-preserve-newlines.d.ts +5 -0
  34. package/dist/compiler/plugins/line-tracking.d.ts +5 -0
  35. package/dist/compiler/plugins/replace-comment.d.ts +5 -0
  36. package/dist/compiler/plugins/return-async.d.ts +4 -0
  37. package/dist/compiler/plugins/track-tool-calls.d.ts +16 -0
  38. package/dist/compiler/plugins/variable-extraction.d.ts +5 -0
  39. package/dist/component-R4WTW6DZ.cjs +18 -0
  40. package/dist/component-WFVDVSDK.js +18 -0
  41. package/dist/component.d.ts +66 -0
  42. package/dist/component.default.d.ts +316 -0
  43. package/dist/context.d.ts +176 -0
  44. package/dist/dual-modes-T53P72CH.js +12 -0
  45. package/dist/dual-modes-VLIGPIHX.cjs +12 -0
  46. package/dist/errors.d.ts +64 -0
  47. package/dist/exit-TRXEU4OU.cjs +8 -0
  48. package/dist/exit-YORW76T3.js +8 -0
  49. package/dist/exit.d.ts +26 -0
  50. package/dist/formatting.d.ts +5 -0
  51. package/dist/getter.d.ts +2 -0
  52. package/dist/handlers.d.ts +10 -0
  53. package/dist/hoist.d.ts +2 -0
  54. package/dist/index.cjs +921 -0
  55. package/dist/index.d.ts +23 -0
  56. package/dist/index.js +921 -0
  57. package/dist/inspect.d.ts +6 -0
  58. package/dist/jsx-AEHVFB3L.js +13 -0
  59. package/dist/jsx-AJAXBWFE.cjs +13 -0
  60. package/dist/jsx.d.ts +11 -0
  61. package/dist/llmz-QLZBDG2Z.cjs +576 -0
  62. package/dist/llmz-ROOX7RYI.js +576 -0
  63. package/dist/llmz.d.ts +40 -0
  64. package/dist/objects.d.ts +24 -0
  65. package/dist/prompts/chat-mode/system.md.d.ts +2 -0
  66. package/dist/prompts/chat-mode/user.md.d.ts +2 -0
  67. package/dist/prompts/common.d.ts +6 -0
  68. package/dist/prompts/dual-modes.d.ts +2 -0
  69. package/dist/prompts/prompt.d.ts +55 -0
  70. package/dist/prompts/worker-mode/system.md.d.ts +2 -0
  71. package/dist/prompts/worker-mode/user.md.d.ts +2 -0
  72. package/dist/result.d.ts +33 -0
  73. package/dist/snapshots.d.ts +69 -0
  74. package/dist/stack-traces.d.ts +1 -0
  75. package/dist/tool-N6ODRRGH.js +11 -0
  76. package/dist/tool-QP4MVRWI.cjs +11 -0
  77. package/dist/tool.d.ts +56 -0
  78. package/dist/transcript.d.ts +36 -0
  79. package/dist/truncator-DUMWEGQO.cjs +10 -0
  80. package/dist/truncator-IY2MXOMC.js +10 -0
  81. package/dist/truncator.d.ts +20 -0
  82. package/dist/types.d.ts +105 -0
  83. package/dist/typings-2CPHOFDN.cjs +10 -0
  84. package/dist/typings-GDMY6VY2.js +10 -0
  85. package/dist/typings.d.ts +5 -0
  86. package/dist/utils-A7WNEFTA.cjs +39 -0
  87. package/dist/utils-N24IHDFA.js +39 -0
  88. package/dist/utils.d.ts +23 -0
  89. package/dist/vm-2DLG7V4G.cjs +12 -0
  90. package/dist/vm-FLBMZUA2.js +12 -0
  91. package/dist/vm.d.ts +3 -0
  92. package/package.json +4 -4
@@ -0,0 +1,152 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunk276Q6EWPcjs = require('./chunk-276Q6EWP.cjs');
4
+
5
+ // src/truncator.ts
6
+ var DEFAULT_REMOVE_CHUNK = 250;
7
+ var WRAP_OPEN_TAG_1 = "\u3010TRUNCATE";
8
+ var WRAP_OPEN_TAG_2 = "\u3011";
9
+ var WRAP_CLOSE_TAG = "\u3010/TRUNCATE\u3011";
10
+ var getRegex = () => new RegExp(`(${WRAP_OPEN_TAG_1}(?:\\s+[\\w:]+)*\\s*${WRAP_OPEN_TAG_2})([\\s\\S]*?)(${WRAP_CLOSE_TAG})`, "g");
11
+ var DEFAULT_TRUNCATE_OPTIONS = {
12
+ preserve: "top",
13
+ flex: 1,
14
+ minTokens: 0
15
+ };
16
+ function wrapContent(content, options) {
17
+ const preserve = _nullishCoalesce((options == null ? void 0 : options.preserve), () => ( DEFAULT_TRUNCATE_OPTIONS.preserve));
18
+ const flex = _nullishCoalesce((options == null ? void 0 : options.flex), () => ( DEFAULT_TRUNCATE_OPTIONS.flex));
19
+ const minTokens = _nullishCoalesce((options == null ? void 0 : options.minTokens), () => ( DEFAULT_TRUNCATE_OPTIONS.minTokens));
20
+ return `${WRAP_OPEN_TAG_1} preserve:${preserve} flex:${flex} min:${minTokens} ${WRAP_OPEN_TAG_2}${content}${WRAP_CLOSE_TAG}`;
21
+ }
22
+ function truncateWrappedContent({
23
+ messages,
24
+ tokenLimit,
25
+ throwOnFailure = true
26
+ }) {
27
+ var _a, _b, _c;
28
+ const tokenizer = _chunk276Q6EWPcjs.getTokenizer.call(void 0, );
29
+ const parts = [];
30
+ for (const msg of messages) {
31
+ const current = [];
32
+ const content = typeof msg.content === "string" ? msg.content : "";
33
+ let match;
34
+ const regex = getRegex();
35
+ let lastIndex = 0;
36
+ while ((match = regex.exec(content)) !== null) {
37
+ const attributes = match[1].split(/\s+/).slice(1).filter((x) => x !== WRAP_OPEN_TAG_2).map((x) => x.split(":")).reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
38
+ if (match.index > lastIndex) {
39
+ const nonTruncatableContent = content.slice(lastIndex, match.index);
40
+ current.push({
41
+ content: nonTruncatableContent,
42
+ tokens: tokenizer.count(nonTruncatableContent),
43
+ truncatable: false
44
+ });
45
+ }
46
+ const wrappedContent = match[2];
47
+ current.push({
48
+ content: wrappedContent,
49
+ tokens: tokenizer.count(wrappedContent),
50
+ truncatable: true,
51
+ attributes: {
52
+ preserve: attributes.preserve,
53
+ flex: Number(attributes.flex) || DEFAULT_TRUNCATE_OPTIONS.flex,
54
+ minTokens: Number(attributes.min) || DEFAULT_TRUNCATE_OPTIONS.minTokens
55
+ }
56
+ });
57
+ lastIndex = regex.lastIndex;
58
+ }
59
+ if (lastIndex < content.length) {
60
+ const remainingContent = content.slice(lastIndex);
61
+ current.push({
62
+ content: remainingContent,
63
+ tokens: tokenizer.count(remainingContent),
64
+ truncatable: false
65
+ });
66
+ }
67
+ parts.push(current);
68
+ }
69
+ const getCount = () => parts.reduce((acc, x) => acc + x.reduce((acc2, y) => acc2 + y.tokens, 0), 0);
70
+ const getTwoBiggestTruncatables = () => {
71
+ var _a2, _b2;
72
+ let biggest = null;
73
+ let secondBiggest = null;
74
+ for (const part of parts.flat()) {
75
+ if (part.truncatable) {
76
+ const flex = _nullishCoalesce(((_a2 = part.attributes) == null ? void 0 : _a2.flex), () => ( DEFAULT_TRUNCATE_OPTIONS.flex));
77
+ const tokens = part.tokens * flex;
78
+ if (part.tokens <= (_nullishCoalesce(((_b2 = part.attributes) == null ? void 0 : _b2.minTokens), () => ( 0)))) {
79
+ continue;
80
+ }
81
+ if (!biggest || tokens > biggest.tokens) {
82
+ secondBiggest = biggest;
83
+ biggest = part;
84
+ } else if (!secondBiggest || tokens > secondBiggest.tokens) {
85
+ secondBiggest = part;
86
+ }
87
+ }
88
+ }
89
+ return { biggest, secondBiggest };
90
+ };
91
+ let currentCount = getCount();
92
+ while (currentCount > tokenLimit) {
93
+ const { biggest, secondBiggest } = getTwoBiggestTruncatables();
94
+ if (!biggest || !biggest.truncatable || biggest.tokens <= 0) {
95
+ if (throwOnFailure) {
96
+ throw new Error(`Cannot truncate further, current count: ${getCount()}`);
97
+ } else {
98
+ break;
99
+ }
100
+ }
101
+ const delta = Math.max(biggest.tokens - (_nullishCoalesce((secondBiggest == null ? void 0 : secondBiggest.tokens), () => ( 0))), DEFAULT_REMOVE_CHUNK);
102
+ const room = Math.min(delta, biggest.tokens);
103
+ let toRemove = Math.min(room, currentCount - tokenLimit);
104
+ if (toRemove <= 0) {
105
+ if (throwOnFailure) {
106
+ throw new Error(`Cannot truncate further, current count: ${getCount()}`);
107
+ } else {
108
+ break;
109
+ }
110
+ }
111
+ if (biggest.tokens - toRemove < (_nullishCoalesce(((_a = biggest.attributes) == null ? void 0 : _a.minTokens), () => ( 0)))) {
112
+ toRemove = biggest.tokens - (_nullishCoalesce(((_b = biggest.attributes) == null ? void 0 : _b.minTokens), () => ( 0)));
113
+ }
114
+ const preserve = _nullishCoalesce(((_c = biggest.attributes) == null ? void 0 : _c.preserve), () => ( DEFAULT_TRUNCATE_OPTIONS.preserve));
115
+ const split = tokenizer.split(biggest.content);
116
+ if (preserve === "bottom") {
117
+ biggest.content = split.slice(toRemove).join("");
118
+ } else if (preserve === "top") {
119
+ biggest.content = split.slice(0, -toRemove).join("");
120
+ } else {
121
+ const anchor = Math.ceil(split.length / 2);
122
+ const radius = Math.ceil(toRemove / 2);
123
+ const left = anchor - radius;
124
+ const right = anchor + radius;
125
+ biggest.content = split.slice(0, left).join("") + split.slice(right).join("");
126
+ }
127
+ biggest.tokens -= toRemove;
128
+ currentCount -= toRemove;
129
+ }
130
+ const removeRedundantWrappers = (content) => {
131
+ return content.replace(getRegex(), "$2");
132
+ };
133
+ return messages.map((msg, i) => {
134
+ const p = parts[i];
135
+ return {
136
+ ...msg,
137
+ content: typeof msg.content === "string" ? removeRedundantWrappers(
138
+ p.map((part) => {
139
+ if (part.truncatable) {
140
+ return part.content;
141
+ }
142
+ return part.content;
143
+ }).join("")
144
+ ) : msg.content
145
+ };
146
+ });
147
+ }
148
+
149
+
150
+
151
+
152
+ exports.wrapContent = wrapContent; exports.truncateWrappedContent = truncateWrappedContent;
@@ -0,0 +1,161 @@
1
+ import {
2
+ cleanStackTrace
3
+ } from "./chunk-JQBT7UWN.js";
4
+
5
+ // src/errors.ts
6
+ var errorClasses = {};
7
+ function registerErrorClass(name, errorClass) {
8
+ errorClasses[name] = errorClass;
9
+ }
10
+ var tryParseMessage = (str) => {
11
+ try {
12
+ return JSON.parse(str);
13
+ } catch {
14
+ return str;
15
+ }
16
+ };
17
+ var Signals;
18
+ ((Signals2) => {
19
+ function isWrappedError(error) {
20
+ var _a, _b;
21
+ const isAlreadyWrapped = error.name === "Error" && ((_a = error == null ? void 0 : error.message) == null ? void 0 : _a.startsWith("{")) && ((_b = error == null ? void 0 : error.message) == null ? void 0 : _b.endsWith("}"));
22
+ return isAlreadyWrapped;
23
+ }
24
+ Signals2.isWrappedError = isWrappedError;
25
+ function serializeError(error) {
26
+ if (isWrappedError(error)) {
27
+ const msg = tryParseMessage(error.message);
28
+ return JSON.stringify({
29
+ ...typeof msg === "object" ? msg : { message: msg },
30
+ properties: { ...error }
31
+ });
32
+ }
33
+ return JSON.stringify({
34
+ name: error.constructor.name,
35
+ message: error.message,
36
+ stack: cleanStackTrace(error.stack ?? ""),
37
+ properties: { ...error }
38
+ });
39
+ }
40
+ Signals2.serializeError = serializeError;
41
+ function maybeDeserializeError(error) {
42
+ const errorIsAlreadyDeserialized = error instanceof Error && error.name in errorClasses;
43
+ if (errorIsAlreadyDeserialized) {
44
+ return error;
45
+ }
46
+ const serializedError = error instanceof Error ? error.message : typeof error === "string" ? error : (error == null ? void 0 : error.toString()) ?? "";
47
+ try {
48
+ const parsed = JSON.parse(serializedError);
49
+ if (parsed && parsed.name && parsed.message) {
50
+ const { name, message, properties = {} } = parsed;
51
+ const ErrorClass = errorClasses[name] || Error;
52
+ const errorInstance = new ErrorClass(message);
53
+ errorInstance.message = message;
54
+ errorInstance.name = name;
55
+ errorInstance.stack = cleanStackTrace((error == null ? void 0 : error.stack) ?? "");
56
+ Object.assign(errorInstance, properties);
57
+ if (isWrappedError(errorInstance)) {
58
+ return maybeDeserializeError(errorInstance);
59
+ }
60
+ return errorInstance;
61
+ }
62
+ } catch {
63
+ }
64
+ return error;
65
+ }
66
+ Signals2.maybeDeserializeError = maybeDeserializeError;
67
+ })(Signals || (Signals = {}));
68
+ var VMSignal = class extends Error {
69
+ constructor(message) {
70
+ super(message);
71
+ this.message = message;
72
+ this.message = Signals.serializeError(this);
73
+ }
74
+ /**
75
+ * The code that was executed by the VM up to the point of the signal
76
+ */
77
+ truncatedCode = "";
78
+ /** The current tool call, if any */
79
+ toolCall;
80
+ /**
81
+ * Contains all the declared and executed variables during the VM execution
82
+ * See file plugins/variable-extraction.ts for more details
83
+ */
84
+ variables = {};
85
+ };
86
+ var SnapshotSignal = class extends VMSignal {
87
+ constructor(message) {
88
+ super(message);
89
+ this.message = Signals.serializeError(this);
90
+ }
91
+ };
92
+ var VMLoopSignal = class extends VMSignal {
93
+ constructor(message) {
94
+ super(message);
95
+ this.message = Signals.serializeError(this);
96
+ }
97
+ };
98
+ var ThinkSignal = class extends VMLoopSignal {
99
+ constructor(reason, context) {
100
+ super("Think signal received: " + reason);
101
+ this.reason = reason;
102
+ this.context = context;
103
+ this.message = Signals.serializeError(this);
104
+ }
105
+ toString() {
106
+ return Signals.serializeError(this);
107
+ }
108
+ };
109
+ var CodeExecutionError = class extends Error {
110
+ constructor(message, code, stacktrace) {
111
+ super(message);
112
+ this.code = code;
113
+ this.stacktrace = stacktrace;
114
+ this.message = Signals.serializeError(this);
115
+ }
116
+ };
117
+ var InvalidCodeError = class extends Error {
118
+ constructor(message, code) {
119
+ super(message);
120
+ this.code = code;
121
+ this.message = Signals.serializeError(this);
122
+ }
123
+ };
124
+ var LoopExceededError = class extends Error {
125
+ constructor() {
126
+ super("Loop exceeded error");
127
+ this.message = Signals.serializeError(this);
128
+ }
129
+ };
130
+ var CodeFormattingError = class extends Error {
131
+ constructor(message, code) {
132
+ super(message, {
133
+ cause: "Code formatting error"
134
+ });
135
+ this.code = code;
136
+ }
137
+ };
138
+ var AssignmentError = class extends Error {
139
+ constructor(message) {
140
+ super(message);
141
+ this.message = Signals.serializeError(this);
142
+ }
143
+ };
144
+ registerErrorClass("VMSignal", VMSignal);
145
+ registerErrorClass("SnapshotSignal", SnapshotSignal);
146
+ registerErrorClass("VMLoopSignal", VMLoopSignal);
147
+ registerErrorClass("ThinkSignal", ThinkSignal);
148
+ registerErrorClass("CodeExecutionError", CodeExecutionError);
149
+ registerErrorClass("AssignmentError", AssignmentError);
150
+
151
+ export {
152
+ Signals,
153
+ VMSignal,
154
+ SnapshotSignal,
155
+ ThinkSignal,
156
+ CodeExecutionError,
157
+ InvalidCodeError,
158
+ LoopExceededError,
159
+ CodeFormattingError,
160
+ AssignmentError
161
+ };
@@ -0,0 +1,105 @@
1
+ import {
2
+ isJsonSchema,
3
+ isValidIdentifier,
4
+ isZuiSchema
5
+ } from "./chunk-4MNIJGK6.js";
6
+ import {
7
+ uniq_default
8
+ } from "./chunk-7WRN4E42.js";
9
+
10
+ // src/exit.ts
11
+ import { transforms } from "@bpinternal/zui";
12
+ var Exit = class _Exit {
13
+ name;
14
+ aliases = [];
15
+ description;
16
+ metadata;
17
+ schema;
18
+ get zSchema() {
19
+ return this.schema ? transforms.fromJSONSchemaLegacy(this.schema) : void 0;
20
+ }
21
+ rename(name) {
22
+ const before = this.name;
23
+ if (!isValidIdentifier(name)) {
24
+ throw new Error(
25
+ `Invalid name for exit ${name}. An exit name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
26
+ );
27
+ }
28
+ this.name = name;
29
+ this.aliases = uniq_default([name, ...this.aliases.map((alias) => alias === before ? name : alias)]);
30
+ return this;
31
+ }
32
+ clone() {
33
+ return new _Exit({
34
+ name: this.name,
35
+ aliases: [...this.aliases],
36
+ description: this.description,
37
+ metadata: JSON.parse(JSON.stringify(this.metadata)),
38
+ schema: this.zSchema
39
+ });
40
+ }
41
+ is(exit) {
42
+ return this.name === exit.name;
43
+ }
44
+ match(result) {
45
+ return result.exit instanceof _Exit && this.name === result.exit.name;
46
+ }
47
+ constructor(props) {
48
+ if (!isValidIdentifier(props.name)) {
49
+ throw new Error(
50
+ `Invalid name for exit ${props.name}. A exit name must start with a letter and contain only letters, numbers, and underscores. It must be 1-50 characters long.`
51
+ );
52
+ }
53
+ if (typeof props.description !== "string" || props.description.trim().length === 0) {
54
+ throw new Error(
55
+ `Invalid description for exit ${props.name}. Expected a non-empty string, but got type "${typeof props.description}"`
56
+ );
57
+ }
58
+ if (props.metadata !== void 0 && typeof props.metadata !== "object") {
59
+ throw new Error(
60
+ `Invalid metadata for exit ${props.name}. Expected an object, but got type "${typeof props.metadata}"`
61
+ );
62
+ }
63
+ if (props.aliases !== void 0 && !Array.isArray(props.aliases)) {
64
+ throw new Error(
65
+ `Invalid aliases for exit ${props.name}. Expected an array, but got type "${typeof props.aliases}"`
66
+ );
67
+ }
68
+ if (props.aliases && props.aliases.some((alias) => !isValidIdentifier(alias))) {
69
+ throw new Error(`Invalid aliases for exit ${props.name}. Expected an array of valid identifiers.`);
70
+ }
71
+ if (typeof props.schema !== "undefined") {
72
+ if (isZuiSchema(props.schema)) {
73
+ this.schema = transforms.toJSONSchemaLegacy(props.schema);
74
+ } else if (isJsonSchema(props.schema)) {
75
+ this.schema = props.schema;
76
+ } else {
77
+ throw new Error(
78
+ `Invalid input schema for exit ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.schema}"`
79
+ );
80
+ }
81
+ }
82
+ this.name = props.name;
83
+ this.aliases = uniq_default([props.name, ...props.aliases ?? []]);
84
+ this.description = props.description;
85
+ this.metadata = props.metadata ?? {};
86
+ }
87
+ static withUniqueNames = (exits) => {
88
+ const names = /* @__PURE__ */ new Set();
89
+ return exits.map((exit) => {
90
+ if (exits.filter((t) => t.name === exit.name).length === 1) {
91
+ return exit;
92
+ }
93
+ let counter = 1;
94
+ let exitName = exit.name + counter;
95
+ while (names.has(exitName)) {
96
+ exitName = `${exit.name}${++counter}`;
97
+ }
98
+ return exit.rename(exitName);
99
+ });
100
+ };
101
+ };
102
+
103
+ export {
104
+ Exit
105
+ };
@@ -0,0 +1,28 @@
1
+ // src/stack-traces.ts
2
+ var isInternalLine = (line) => {
3
+ return line.includes("/llmz/") || line.includes("\\llmz\\src\\") || line.includes("node_modules");
4
+ };
5
+ function cleanStackTrace(stack, cleanInternal = true) {
6
+ const lines = stack.split("\n");
7
+ for (let i = 0; i < lines.length; i++) {
8
+ const line = lines[i];
9
+ let llmzIndex = line.indexOf("/llmz/");
10
+ if (llmzIndex === -1) {
11
+ llmzIndex = line.indexOf("\\llmz\\");
12
+ }
13
+ if (llmzIndex === -1) {
14
+ continue;
15
+ }
16
+ let lastSpaceIndex = line.lastIndexOf(" ", llmzIndex);
17
+ if (lastSpaceIndex === -1) {
18
+ lastSpaceIndex = 0;
19
+ }
20
+ const maybeParen = line[lastSpaceIndex + 1] === "(" ? "(" : "";
21
+ lines[i] = line.slice(0, lastSpaceIndex + 1) + maybeParen + line.slice(llmzIndex);
22
+ }
23
+ return lines.filter((x) => !cleanInternal || !isInternalLine(x)).join("\n");
24
+ }
25
+
26
+ export {
27
+ cleanStackTrace
28
+ };