codebuff 1.0.286 → 1.0.287
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/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/common/__tests__/project-file-tree.test.d.ts +1 -0
- package/dist/common/__tests__/project-file-tree.test.js +251 -0
- package/dist/common/__tests__/project-file-tree.test.js.map +1 -0
- package/dist/common/actions.d.ts +34 -34
- package/dist/common/json-config/__tests__/__snapshots__/stringify-schema.test.js.snap +119 -0
- package/dist/common/types/agent-state.d.ts +8 -8
- package/dist/common/types/message.d.ts +6 -6
- package/dist/common/types/usage.d.ts +2 -2
- package/dist/common/util/credentials.d.ts +2 -2
- package/dist/common/util/process-stream.d.ts +7 -0
- package/dist/common/util/process-stream.js +162 -0
- package/dist/common/util/process-stream.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +72 -72
- package/dist/index.js +1 -7
- package/dist/utils/__tests__/__snapshots__/background-process-manager.test.js.snap +137 -0
- package/dist/utils/__tests__/file-paths.test.d.ts +1 -0
- package/dist/utils/__tests__/file-paths.test.js +37 -0
- package/dist/utils/__tests__/file-paths.test.js.map +1 -0
- package/dist/utils/__tests__/path.test.d.ts +1 -0
- package/dist/utils/__tests__/path.test.js +37 -0
- package/dist/utils/__tests__/path.test.js.map +1 -0
- package/dist/utils/file-paths.d.ts +9 -0
- package/dist/utils/file-paths.js +24 -0
- package/dist/utils/file-paths.js.map +1 -0
- package/dist/utils/path.d.ts +9 -0
- package/dist/utils/path.js +27 -0
- package/dist/utils/path.js.map +1 -0
- package/package.json +1 -1
- package/dist/slash-commands.d.ts +0 -7
- package/dist/slash-commands.js +0 -21
- package/dist/slash-commands.js.map +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`stringifySchema should correctly stringify StartupProcessSchema 1`] = `
|
|
4
|
+
"// Defines a single startup process.
|
|
5
|
+
{
|
|
6
|
+
// A user-friendly name for the process. Should be one word and unique.
|
|
7
|
+
"name": string,
|
|
8
|
+
|
|
9
|
+
// The actual shell command to execute.
|
|
10
|
+
"command": string,
|
|
11
|
+
|
|
12
|
+
// (optional): The working directory from which to run the command.
|
|
13
|
+
"cwd": string | undefined,
|
|
14
|
+
|
|
15
|
+
// (optional): Whether this process should be run, default: true
|
|
16
|
+
"enabled": boolean | undefined,
|
|
17
|
+
|
|
18
|
+
// (optional): Path to write the process's stdout. If not specified, stderr is not stored.
|
|
19
|
+
"stdoutFile": string | undefined,
|
|
20
|
+
|
|
21
|
+
// (optional): Path to write the process's stderr. If not specified, stderr will be put into the stdoutFile.
|
|
22
|
+
"stderrFile": string | undefined
|
|
23
|
+
}"
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`stringifySchema should correctly stringify CodebuffConfigSchema 1`] = `
|
|
27
|
+
"// Defines the overall Codebuff configuration file (e.g., codebuff.json). This schema defines the top-level structure of the configuration.
|
|
28
|
+
{
|
|
29
|
+
// (optional): Does nothing. Put any thing you want here!
|
|
30
|
+
"description": any | undefined,
|
|
31
|
+
|
|
32
|
+
// (optional): An array of startup processes.
|
|
33
|
+
"startupProcesses": [
|
|
34
|
+
|
|
35
|
+
// Defines a single startup process.
|
|
36
|
+
{
|
|
37
|
+
// A user-friendly name for the process. Should be one word and unique.
|
|
38
|
+
"name": string,
|
|
39
|
+
|
|
40
|
+
// The actual shell command to execute.
|
|
41
|
+
"command": string,
|
|
42
|
+
|
|
43
|
+
// (optional): The working directory from which to run the command.
|
|
44
|
+
"cwd": string | undefined,
|
|
45
|
+
|
|
46
|
+
// (optional): Whether this process should be run, default: true
|
|
47
|
+
"enabled": boolean | undefined,
|
|
48
|
+
|
|
49
|
+
// (optional): Path to write the process's stdout. If not specified, stderr is not stored.
|
|
50
|
+
"stdoutFile": string | undefined,
|
|
51
|
+
|
|
52
|
+
// (optional): Path to write the process's stderr. If not specified, stderr will be put into the stdoutFile.
|
|
53
|
+
"stderrFile": string | undefined
|
|
54
|
+
}
|
|
55
|
+
] | undefined
|
|
56
|
+
}"
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`stringifySchema should handle a more complex schema 1`] = `
|
|
60
|
+
"// A complex test schema
|
|
61
|
+
{
|
|
62
|
+
// Unique identifier
|
|
63
|
+
"id": string,
|
|
64
|
+
|
|
65
|
+
// A positive integer count
|
|
66
|
+
"count": number,
|
|
67
|
+
|
|
68
|
+
// Activity status
|
|
69
|
+
"isActive": boolean,
|
|
70
|
+
|
|
71
|
+
// (optional): Optional list of tags
|
|
72
|
+
"tags": [
|
|
73
|
+
|
|
74
|
+
string
|
|
75
|
+
] | undefined,
|
|
76
|
+
|
|
77
|
+
// A nested object structure
|
|
78
|
+
"nested": {
|
|
79
|
+
"value": string,
|
|
80
|
+
|
|
81
|
+
// Nested configuration
|
|
82
|
+
"config": {
|
|
83
|
+
// (optional): Number of retries, default: 3
|
|
84
|
+
"retries": number
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}"
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
exports[`stringifySchema should handle an empty object schema 1`] = `
|
|
91
|
+
"// An empty schema
|
|
92
|
+
{
|
|
93
|
+
}"
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
exports[`stringifySchema should handle schema with only optional fields 1`] = `
|
|
97
|
+
"// Schema with only optional fields
|
|
98
|
+
{
|
|
99
|
+
// (optional): Optional field 1
|
|
100
|
+
"field1": string | undefined,
|
|
101
|
+
|
|
102
|
+
// (optional): Optional field 2
|
|
103
|
+
"field2": number | undefined
|
|
104
|
+
}"
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
exports[`stringifySchema should handle schema with default values 1`] = `
|
|
108
|
+
"// Schema demonstrating default values
|
|
109
|
+
{
|
|
110
|
+
// (optional): Name with default, default: "anonymous"
|
|
111
|
+
"name": string,
|
|
112
|
+
|
|
113
|
+
// (optional): Level with default, default: 1
|
|
114
|
+
"level": number,
|
|
115
|
+
|
|
116
|
+
// (optional): Enabled with default, default: false
|
|
117
|
+
"enabled": boolean
|
|
118
|
+
}"
|
|
119
|
+
`;
|
|
@@ -6,12 +6,12 @@ export declare const ToolCallSchema: z.ZodObject<{
|
|
|
6
6
|
id: z.ZodString;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
name: string;
|
|
9
|
-
id: string;
|
|
10
9
|
parameters: Record<string, string>;
|
|
10
|
+
id: string;
|
|
11
11
|
}, {
|
|
12
12
|
name: string;
|
|
13
|
-
id: string;
|
|
14
13
|
parameters: Record<string, string>;
|
|
14
|
+
id: string;
|
|
15
15
|
}>;
|
|
16
16
|
export type ToolCall = z.infer<typeof ToolCallSchema>;
|
|
17
17
|
export declare const ToolResultSchema: z.ZodObject<{
|
|
@@ -206,15 +206,15 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
206
206
|
type: "ephemeral";
|
|
207
207
|
}>>;
|
|
208
208
|
}, "strip", z.ZodTypeAny, {
|
|
209
|
-
type: "tool_result";
|
|
210
209
|
content: string;
|
|
210
|
+
type: "tool_result";
|
|
211
211
|
tool_use_id: string;
|
|
212
212
|
cache_control?: {
|
|
213
213
|
type: "ephemeral";
|
|
214
214
|
} | undefined;
|
|
215
215
|
}, {
|
|
216
|
-
type: "tool_result";
|
|
217
216
|
content: string;
|
|
217
|
+
type: "tool_result";
|
|
218
218
|
tool_use_id: string;
|
|
219
219
|
cache_control?: {
|
|
220
220
|
type: "ephemeral";
|
|
@@ -278,8 +278,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
278
278
|
type: "ephemeral";
|
|
279
279
|
} | undefined;
|
|
280
280
|
} | {
|
|
281
|
-
type: "tool_result";
|
|
282
281
|
content: string;
|
|
282
|
+
type: "tool_result";
|
|
283
283
|
tool_use_id: string;
|
|
284
284
|
cache_control?: {
|
|
285
285
|
type: "ephemeral";
|
|
@@ -312,8 +312,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
312
312
|
type: "ephemeral";
|
|
313
313
|
} | undefined;
|
|
314
314
|
} | {
|
|
315
|
-
type: "tool_result";
|
|
316
315
|
content: string;
|
|
316
|
+
type: "tool_result";
|
|
317
317
|
tool_use_id: string;
|
|
318
318
|
cache_control?: {
|
|
319
319
|
type: "ephemeral";
|
|
@@ -378,8 +378,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
378
378
|
type: "ephemeral";
|
|
379
379
|
} | undefined;
|
|
380
380
|
} | {
|
|
381
|
-
type: "tool_result";
|
|
382
381
|
content: string;
|
|
382
|
+
type: "tool_result";
|
|
383
383
|
tool_use_id: string;
|
|
384
384
|
cache_control?: {
|
|
385
385
|
type: "ephemeral";
|
|
@@ -444,8 +444,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
444
444
|
type: "ephemeral";
|
|
445
445
|
} | undefined;
|
|
446
446
|
} | {
|
|
447
|
-
type: "tool_result";
|
|
448
447
|
content: string;
|
|
448
|
+
type: "tool_result";
|
|
449
449
|
tool_use_id: string;
|
|
450
450
|
cache_control?: {
|
|
451
451
|
type: "ephemeral";
|
|
@@ -61,15 +61,15 @@ declare const MessageContentObjectSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
61
61
|
type: "ephemeral";
|
|
62
62
|
}>>;
|
|
63
63
|
}, "strip", z.ZodTypeAny, {
|
|
64
|
-
type: "tool_result";
|
|
65
64
|
content: string;
|
|
65
|
+
type: "tool_result";
|
|
66
66
|
tool_use_id: string;
|
|
67
67
|
cache_control?: {
|
|
68
68
|
type: "ephemeral";
|
|
69
69
|
} | undefined;
|
|
70
70
|
}, {
|
|
71
|
-
type: "tool_result";
|
|
72
71
|
content: string;
|
|
72
|
+
type: "tool_result";
|
|
73
73
|
tool_use_id: string;
|
|
74
74
|
cache_control?: {
|
|
75
75
|
type: "ephemeral";
|
|
@@ -181,15 +181,15 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
181
181
|
type: "ephemeral";
|
|
182
182
|
}>>;
|
|
183
183
|
}, "strip", z.ZodTypeAny, {
|
|
184
|
-
type: "tool_result";
|
|
185
184
|
content: string;
|
|
185
|
+
type: "tool_result";
|
|
186
186
|
tool_use_id: string;
|
|
187
187
|
cache_control?: {
|
|
188
188
|
type: "ephemeral";
|
|
189
189
|
} | undefined;
|
|
190
190
|
}, {
|
|
191
|
-
type: "tool_result";
|
|
192
191
|
content: string;
|
|
192
|
+
type: "tool_result";
|
|
193
193
|
tool_use_id: string;
|
|
194
194
|
cache_control?: {
|
|
195
195
|
type: "ephemeral";
|
|
@@ -253,8 +253,8 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
253
253
|
type: "ephemeral";
|
|
254
254
|
} | undefined;
|
|
255
255
|
} | {
|
|
256
|
-
type: "tool_result";
|
|
257
256
|
content: string;
|
|
257
|
+
type: "tool_result";
|
|
258
258
|
tool_use_id: string;
|
|
259
259
|
cache_control?: {
|
|
260
260
|
type: "ephemeral";
|
|
@@ -287,8 +287,8 @@ export declare const MessageSchema: z.ZodObject<{
|
|
|
287
287
|
type: "ephemeral";
|
|
288
288
|
} | undefined;
|
|
289
289
|
} | {
|
|
290
|
-
type: "tool_result";
|
|
291
290
|
content: string;
|
|
291
|
+
type: "tool_result";
|
|
292
292
|
tool_use_id: string;
|
|
293
293
|
cache_control?: {
|
|
294
294
|
type: "ephemeral";
|
|
@@ -19,22 +19,22 @@ export declare const usageDataSchema: z.ZodObject<{
|
|
|
19
19
|
}>;
|
|
20
20
|
nextQuotaReset: z.ZodNullable<z.ZodDate>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
usageThisCycle: number;
|
|
22
23
|
balance: {
|
|
23
24
|
totalRemaining: number;
|
|
24
25
|
totalDebt: number;
|
|
25
26
|
netBalance: number;
|
|
26
27
|
breakdown: Partial<Record<"free" | "referral" | "purchase" | "admin", number>>;
|
|
27
28
|
};
|
|
28
|
-
usageThisCycle: number;
|
|
29
29
|
nextQuotaReset: Date | null;
|
|
30
30
|
}, {
|
|
31
|
+
usageThisCycle: number;
|
|
31
32
|
balance: {
|
|
32
33
|
totalRemaining: number;
|
|
33
34
|
totalDebt: number;
|
|
34
35
|
netBalance: number;
|
|
35
36
|
breakdown: Partial<Record<"free" | "referral" | "purchase" | "admin", number>>;
|
|
36
37
|
};
|
|
37
|
-
usageThisCycle: number;
|
|
38
38
|
nextQuotaReset: Date | null;
|
|
39
39
|
}>;
|
|
40
40
|
export type UsageData = z.infer<typeof usageDataSchema>;
|
|
@@ -7,15 +7,15 @@ export declare const userSchema: z.ZodObject<{
|
|
|
7
7
|
fingerprintId: z.ZodString;
|
|
8
8
|
fingerprintHash: z.ZodString;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
name: string | null;
|
|
11
10
|
email: string;
|
|
11
|
+
name: string | null;
|
|
12
12
|
id: string;
|
|
13
13
|
fingerprintId: string;
|
|
14
14
|
authToken: string;
|
|
15
15
|
fingerprintHash: string;
|
|
16
16
|
}, {
|
|
17
|
-
name: string | null;
|
|
18
17
|
email: string;
|
|
18
|
+
name: string | null;
|
|
19
19
|
id: string;
|
|
20
20
|
fingerprintId: string;
|
|
21
21
|
authToken: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function processStreamWithTags<T extends string>(stream: AsyncGenerator<T>, tags: {
|
|
2
|
+
[tagName: string]: {
|
|
3
|
+
attributeNames: string[];
|
|
4
|
+
onTagStart: (attributes: Record<string, string>) => void;
|
|
5
|
+
onTagEnd: (content: string, attributes: Record<string, string>) => boolean;
|
|
6
|
+
};
|
|
7
|
+
}): AsyncGenerator<string, void, unknown>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processStreamWithTags = processStreamWithTags;
|
|
4
|
+
const saxy_1 = require("./saxy");
|
|
5
|
+
async function* processStreamWithTags(stream, tags) {
|
|
6
|
+
const saxyParser = new saxy_1.Saxy();
|
|
7
|
+
let currentTagName = null;
|
|
8
|
+
let currentTagAttributes = {};
|
|
9
|
+
let currentTagContentBuffer = '';
|
|
10
|
+
let shouldStopProcessing = false;
|
|
11
|
+
const outputQueue = [];
|
|
12
|
+
const enqueueOutput = (str) => {
|
|
13
|
+
if (str) {
|
|
14
|
+
// Only enqueue non-empty strings
|
|
15
|
+
outputQueue.push(str);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
saxyParser.on('tagopen', (node) => {
|
|
19
|
+
if (shouldStopProcessing)
|
|
20
|
+
return;
|
|
21
|
+
if (currentTagName === null) {
|
|
22
|
+
// Not currently inside a tracked tag
|
|
23
|
+
if (tags[node.name]) {
|
|
24
|
+
// This is a tag we want to track
|
|
25
|
+
currentTagName = node.name;
|
|
26
|
+
try {
|
|
27
|
+
currentTagAttributes = saxy_1.Saxy.parseAttrs(node.attrs);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
// If attributes are malformed, default to empty or handle as error
|
|
31
|
+
// console.error(`Error parsing attributes for tag ${node.name}: "${node.attrs}"`, e);
|
|
32
|
+
currentTagAttributes = {}; // Default to empty attributes on parsing error
|
|
33
|
+
}
|
|
34
|
+
tags[currentTagName].onTagStart(currentTagAttributes);
|
|
35
|
+
currentTagContentBuffer = '';
|
|
36
|
+
if (node.isSelfClosing) {
|
|
37
|
+
const stop = tags[currentTagName].onTagEnd(currentTagContentBuffer, currentTagAttributes);
|
|
38
|
+
currentTagName = null;
|
|
39
|
+
currentTagAttributes = {};
|
|
40
|
+
if (stop) {
|
|
41
|
+
shouldStopProcessing = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// A non-tracked tag, pass it through
|
|
47
|
+
enqueueOutput(`<${node.name}${node.attrs ? ' ' + node.attrs : ''}${node.isSelfClosing ? ' /' : ''}>`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Inside a tracked tag, so this is nested content
|
|
52
|
+
currentTagContentBuffer += `<${node.name}${node.attrs ? ' ' + node.attrs : ''}${node.isSelfClosing ? ' /' : ''}>`;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
saxyParser.on('text', (node) => {
|
|
56
|
+
if (shouldStopProcessing)
|
|
57
|
+
return;
|
|
58
|
+
if (currentTagName !== null) {
|
|
59
|
+
currentTagContentBuffer += node.contents;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
enqueueOutput(node.contents);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
saxyParser.on('tagclose', (node) => {
|
|
66
|
+
if (shouldStopProcessing)
|
|
67
|
+
return;
|
|
68
|
+
if (currentTagName === node.name) {
|
|
69
|
+
const stop = tags[currentTagName].onTagEnd(currentTagContentBuffer, currentTagAttributes);
|
|
70
|
+
currentTagName = null;
|
|
71
|
+
currentTagAttributes = {};
|
|
72
|
+
currentTagContentBuffer = '';
|
|
73
|
+
if (stop) {
|
|
74
|
+
shouldStopProcessing = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (currentTagName !== null) {
|
|
78
|
+
// Closing a nested tag inside a tracked tag
|
|
79
|
+
currentTagContentBuffer += `</${node.name}>`;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// Closing a non-tracked tag, pass it through
|
|
83
|
+
enqueueOutput(`</${node.name}>`);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
saxyParser.on('cdata', (node) => {
|
|
87
|
+
if (shouldStopProcessing)
|
|
88
|
+
return;
|
|
89
|
+
const cdataStr = `<![CDATA[${node.contents}]]>`;
|
|
90
|
+
if (currentTagName !== null) {
|
|
91
|
+
currentTagContentBuffer += cdataStr;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
enqueueOutput(cdataStr);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
saxyParser.on('comment', (node) => {
|
|
98
|
+
if (shouldStopProcessing)
|
|
99
|
+
return;
|
|
100
|
+
const commentStr = `<!--${node.contents}-->`;
|
|
101
|
+
if (currentTagName !== null) {
|
|
102
|
+
currentTagContentBuffer += commentStr;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
enqueueOutput(commentStr);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
saxyParser.on('processinginstruction', (node) => {
|
|
109
|
+
if (shouldStopProcessing)
|
|
110
|
+
return;
|
|
111
|
+
const piStr = `<?${node.contents}?>`;
|
|
112
|
+
if (currentTagName !== null) {
|
|
113
|
+
currentTagContentBuffer += piStr;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
enqueueOutput(piStr);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
saxyParser.on('error', (err) => {
|
|
120
|
+
// Saxy might emit 'error' for issues not causing write/end to throw.
|
|
121
|
+
// This flag helps stop processing in such cases.
|
|
122
|
+
// console.error("Saxy parser emitted an error:", err);
|
|
123
|
+
shouldStopProcessing = true;
|
|
124
|
+
// The error might need to be explicitly thrown here if it's critical
|
|
125
|
+
// and not otherwise surfaced to the generator's caller.
|
|
126
|
+
// For now, this ensures processing stops.
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
for await (const chunk of stream) {
|
|
130
|
+
if (shouldStopProcessing)
|
|
131
|
+
break;
|
|
132
|
+
saxyParser.write(chunk); // Saxy events fill outputQueue
|
|
133
|
+
while (outputQueue.length > 0) {
|
|
134
|
+
// If stopping and not inside a tracked tag, clear queue to prevent further passthrough.
|
|
135
|
+
if (shouldStopProcessing && currentTagName === null) {
|
|
136
|
+
outputQueue.length = 0;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
yield outputQueue.shift();
|
|
140
|
+
}
|
|
141
|
+
// Re-check stop condition after yielding, as an event during write might have set it.
|
|
142
|
+
if (shouldStopProcessing)
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
if (!shouldStopProcessing) {
|
|
146
|
+
saxyParser.end(); // Finalize parsing
|
|
147
|
+
while (outputQueue.length > 0) {
|
|
148
|
+
if (shouldStopProcessing && currentTagName === null) {
|
|
149
|
+
outputQueue.length = 0;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
yield outputQueue.shift();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
// Catches errors from saxyParser.write() or saxyParser.end()
|
|
158
|
+
// console.error("Error during Saxy stream processing in generator:", error);
|
|
159
|
+
throw error; // Propagate error to the caller
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=process-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-stream.js","sourceRoot":"","sources":["../../src/util/process-stream.ts"],"names":[],"mappings":";;AAUA,sDAkLC;AA5LD,iCAQe;AAER,KAAK,SAAS,CAAC,CAAC,qBAAqB,CAC1C,MAAyB,EACzB,IAOC;IAED,MAAM,UAAU,GAAG,IAAI,WAAI,EAAE,CAAA;IAC7B,IAAI,cAAc,GAAkB,IAAI,CAAA;IACxC,IAAI,oBAAoB,GAA2B,EAAE,CAAA;IACrD,IAAI,uBAAuB,GAAW,EAAE,CAAA;IACxC,IAAI,oBAAoB,GAAG,KAAK,CAAA;IAEhC,MAAM,WAAW,GAAa,EAAE,CAAA;IAEhC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE;QACpC,IAAI,GAAG,EAAE,CAAC;YACR,iCAAiC;YACjC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACvB,CAAC;IACH,CAAC,CAAA;IAED,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAiB,EAAE,EAAE;QAC7C,IAAI,oBAAoB;YAAE,OAAM;QAEhC,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;YAC5B,qCAAqC;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