scream-code 0.6.7 → 0.6.8

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.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
3
+ import { dirname as __cjsShimDirname } from 'node:path';
4
+ const __filename = __cjsShimFileURLToPath(import.meta.url);
5
+ const __dirname = __cjsShimDirname(__filename);
6
+ import "./suppress-sqlite-warning-C2VB0doZ.mjs";
7
+ //#region src/main.ts
8
+ try {
9
+ (await import("./app-NYV7g66W.mjs")).main();
10
+ } catch (error) {
11
+ process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
12
+ process.exit(1);
13
+ }
14
+ //#endregion
15
+ export {};
@@ -0,0 +1,2 @@
1
+
2
+ export { };
package/dist/main.mjs CHANGED
@@ -6,7 +6,7 @@ const __dirname = __cjsShimDirname(__filename);
6
6
  import "./suppress-sqlite-warning-C2VB0doZ.mjs";
7
7
  //#region src/main.ts
8
8
  try {
9
- (await import("./app-NYV7g66W.mjs")).main();
9
+ (await import("./app-w3Sui-3y.mjs")).main();
10
10
  } catch (error) {
11
11
  process.stderr.write(`${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
12
12
  process.exit(1);
@@ -0,0 +1,299 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
3
+ import { dirname as __cjsShimDirname } from 'node:path';
4
+ const __filename = __cjsShimFileURLToPath(import.meta.url);
5
+ const __dirname = __cjsShimDirname(__filename);
6
+ import { n as __esmMin } from "./chunk-apG1qJts.mjs";
7
+ import { a as File, i as init_esm_min, n as FormData, t as init_from } from "./from-CKE2n10i.mjs";
8
+ //#region ../../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js
9
+ function _fileName(headerValue) {
10
+ const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
11
+ if (!m) return;
12
+ const match = m[2] || m[3] || "";
13
+ let filename = match.slice(match.lastIndexOf("\\") + 1);
14
+ filename = filename.replace(/%22/g, "\"");
15
+ filename = filename.replace(/&#(\d{4});/g, (m, code) => {
16
+ return String.fromCharCode(code);
17
+ });
18
+ return filename;
19
+ }
20
+ async function toFormData(Body, ct) {
21
+ if (!/multipart/i.test(ct)) throw new TypeError("Failed to fetch");
22
+ const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
23
+ if (!m) throw new TypeError("no or bad content-type header, no multipart boundary");
24
+ const parser = new MultipartParser(m[1] || m[2]);
25
+ let headerField;
26
+ let headerValue;
27
+ let entryValue;
28
+ let entryName;
29
+ let contentType;
30
+ let filename;
31
+ const entryChunks = [];
32
+ const formData = new FormData();
33
+ const onPartData = (ui8a) => {
34
+ entryValue += decoder.decode(ui8a, { stream: true });
35
+ };
36
+ const appendToFile = (ui8a) => {
37
+ entryChunks.push(ui8a);
38
+ };
39
+ const appendFileToFormData = () => {
40
+ const file = new File(entryChunks, filename, { type: contentType });
41
+ formData.append(entryName, file);
42
+ };
43
+ const appendEntryToFormData = () => {
44
+ formData.append(entryName, entryValue);
45
+ };
46
+ const decoder = new TextDecoder("utf-8");
47
+ decoder.decode();
48
+ parser.onPartBegin = function() {
49
+ parser.onPartData = onPartData;
50
+ parser.onPartEnd = appendEntryToFormData;
51
+ headerField = "";
52
+ headerValue = "";
53
+ entryValue = "";
54
+ entryName = "";
55
+ contentType = "";
56
+ filename = null;
57
+ entryChunks.length = 0;
58
+ };
59
+ parser.onHeaderField = function(ui8a) {
60
+ headerField += decoder.decode(ui8a, { stream: true });
61
+ };
62
+ parser.onHeaderValue = function(ui8a) {
63
+ headerValue += decoder.decode(ui8a, { stream: true });
64
+ };
65
+ parser.onHeaderEnd = function() {
66
+ headerValue += decoder.decode();
67
+ headerField = headerField.toLowerCase();
68
+ if (headerField === "content-disposition") {
69
+ const m = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
70
+ if (m) entryName = m[2] || m[3] || "";
71
+ filename = _fileName(headerValue);
72
+ if (filename) {
73
+ parser.onPartData = appendToFile;
74
+ parser.onPartEnd = appendFileToFormData;
75
+ }
76
+ } else if (headerField === "content-type") contentType = headerValue;
77
+ headerValue = "";
78
+ headerField = "";
79
+ };
80
+ for await (const chunk of Body) parser.write(chunk);
81
+ parser.end();
82
+ return formData;
83
+ }
84
+ var s, S, f, F, LF, CR, SPACE, HYPHEN, COLON, A, Z, lower, noop, MultipartParser;
85
+ //#endregion
86
+ __esmMin((() => {
87
+ init_from();
88
+ init_esm_min();
89
+ s = 0;
90
+ S = {
91
+ START_BOUNDARY: s++,
92
+ HEADER_FIELD_START: s++,
93
+ HEADER_FIELD: s++,
94
+ HEADER_VALUE_START: s++,
95
+ HEADER_VALUE: s++,
96
+ HEADER_VALUE_ALMOST_DONE: s++,
97
+ HEADERS_ALMOST_DONE: s++,
98
+ PART_DATA_START: s++,
99
+ PART_DATA: s++,
100
+ END: s++
101
+ };
102
+ f = 1;
103
+ F = {
104
+ PART_BOUNDARY: f,
105
+ LAST_BOUNDARY: f *= 2
106
+ };
107
+ LF = 10;
108
+ CR = 13;
109
+ SPACE = 32;
110
+ HYPHEN = 45;
111
+ COLON = 58;
112
+ A = 97;
113
+ Z = 122;
114
+ lower = (c) => c | 32;
115
+ noop = () => {};
116
+ MultipartParser = class {
117
+ /**
118
+ * @param {string} boundary
119
+ */
120
+ constructor(boundary) {
121
+ this.index = 0;
122
+ this.flags = 0;
123
+ this.onHeaderEnd = noop;
124
+ this.onHeaderField = noop;
125
+ this.onHeadersEnd = noop;
126
+ this.onHeaderValue = noop;
127
+ this.onPartBegin = noop;
128
+ this.onPartData = noop;
129
+ this.onPartEnd = noop;
130
+ this.boundaryChars = {};
131
+ boundary = "\r\n--" + boundary;
132
+ const ui8a = new Uint8Array(boundary.length);
133
+ for (let i = 0; i < boundary.length; i++) {
134
+ ui8a[i] = boundary.charCodeAt(i);
135
+ this.boundaryChars[ui8a[i]] = true;
136
+ }
137
+ this.boundary = ui8a;
138
+ this.lookbehind = new Uint8Array(this.boundary.length + 8);
139
+ this.state = S.START_BOUNDARY;
140
+ }
141
+ /**
142
+ * @param {Uint8Array} data
143
+ */
144
+ write(data) {
145
+ let i = 0;
146
+ const length_ = data.length;
147
+ let previousIndex = this.index;
148
+ let { lookbehind, boundary, boundaryChars, index, state, flags } = this;
149
+ const boundaryLength = this.boundary.length;
150
+ const boundaryEnd = boundaryLength - 1;
151
+ const bufferLength = data.length;
152
+ let c;
153
+ let cl;
154
+ const mark = (name) => {
155
+ this[name + "Mark"] = i;
156
+ };
157
+ const clear = (name) => {
158
+ delete this[name + "Mark"];
159
+ };
160
+ const callback = (callbackSymbol, start, end, ui8a) => {
161
+ if (start === void 0 || start !== end) this[callbackSymbol](ui8a && ui8a.subarray(start, end));
162
+ };
163
+ const dataCallback = (name, clear) => {
164
+ const markSymbol = name + "Mark";
165
+ if (!(markSymbol in this)) return;
166
+ if (clear) {
167
+ callback(name, this[markSymbol], i, data);
168
+ delete this[markSymbol];
169
+ } else {
170
+ callback(name, this[markSymbol], data.length, data);
171
+ this[markSymbol] = 0;
172
+ }
173
+ };
174
+ for (i = 0; i < length_; i++) {
175
+ c = data[i];
176
+ switch (state) {
177
+ case S.START_BOUNDARY:
178
+ if (index === boundary.length - 2) {
179
+ if (c === HYPHEN) flags |= F.LAST_BOUNDARY;
180
+ else if (c !== CR) return;
181
+ index++;
182
+ break;
183
+ } else if (index - 1 === boundary.length - 2) {
184
+ if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
185
+ state = S.END;
186
+ flags = 0;
187
+ } else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
188
+ index = 0;
189
+ callback("onPartBegin");
190
+ state = S.HEADER_FIELD_START;
191
+ } else return;
192
+ break;
193
+ }
194
+ if (c !== boundary[index + 2]) index = -2;
195
+ if (c === boundary[index + 2]) index++;
196
+ break;
197
+ case S.HEADER_FIELD_START:
198
+ state = S.HEADER_FIELD;
199
+ mark("onHeaderField");
200
+ index = 0;
201
+ case S.HEADER_FIELD:
202
+ if (c === CR) {
203
+ clear("onHeaderField");
204
+ state = S.HEADERS_ALMOST_DONE;
205
+ break;
206
+ }
207
+ index++;
208
+ if (c === HYPHEN) break;
209
+ if (c === COLON) {
210
+ if (index === 1) return;
211
+ dataCallback("onHeaderField", true);
212
+ state = S.HEADER_VALUE_START;
213
+ break;
214
+ }
215
+ cl = lower(c);
216
+ if (cl < A || cl > Z) return;
217
+ break;
218
+ case S.HEADER_VALUE_START:
219
+ if (c === SPACE) break;
220
+ mark("onHeaderValue");
221
+ state = S.HEADER_VALUE;
222
+ case S.HEADER_VALUE:
223
+ if (c === CR) {
224
+ dataCallback("onHeaderValue", true);
225
+ callback("onHeaderEnd");
226
+ state = S.HEADER_VALUE_ALMOST_DONE;
227
+ }
228
+ break;
229
+ case S.HEADER_VALUE_ALMOST_DONE:
230
+ if (c !== LF) return;
231
+ state = S.HEADER_FIELD_START;
232
+ break;
233
+ case S.HEADERS_ALMOST_DONE:
234
+ if (c !== LF) return;
235
+ callback("onHeadersEnd");
236
+ state = S.PART_DATA_START;
237
+ break;
238
+ case S.PART_DATA_START:
239
+ state = S.PART_DATA;
240
+ mark("onPartData");
241
+ case S.PART_DATA:
242
+ previousIndex = index;
243
+ if (index === 0) {
244
+ i += boundaryEnd;
245
+ while (i < bufferLength && !(data[i] in boundaryChars)) i += boundaryLength;
246
+ i -= boundaryEnd;
247
+ c = data[i];
248
+ }
249
+ if (index < boundary.length) if (boundary[index] === c) {
250
+ if (index === 0) dataCallback("onPartData", true);
251
+ index++;
252
+ } else index = 0;
253
+ else if (index === boundary.length) {
254
+ index++;
255
+ if (c === CR) flags |= F.PART_BOUNDARY;
256
+ else if (c === HYPHEN) flags |= F.LAST_BOUNDARY;
257
+ else index = 0;
258
+ } else if (index - 1 === boundary.length) if (flags & F.PART_BOUNDARY) {
259
+ index = 0;
260
+ if (c === LF) {
261
+ flags &= ~F.PART_BOUNDARY;
262
+ callback("onPartEnd");
263
+ callback("onPartBegin");
264
+ state = S.HEADER_FIELD_START;
265
+ break;
266
+ }
267
+ } else if (flags & F.LAST_BOUNDARY) if (c === HYPHEN) {
268
+ callback("onPartEnd");
269
+ state = S.END;
270
+ flags = 0;
271
+ } else index = 0;
272
+ else index = 0;
273
+ if (index > 0) lookbehind[index - 1] = c;
274
+ else if (previousIndex > 0) {
275
+ const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
276
+ callback("onPartData", 0, previousIndex, _lookbehind);
277
+ previousIndex = 0;
278
+ mark("onPartData");
279
+ i--;
280
+ }
281
+ break;
282
+ case S.END: break;
283
+ default: throw new Error(`Unexpected state entered: ${state}`);
284
+ }
285
+ }
286
+ dataCallback("onHeaderField");
287
+ dataCallback("onHeaderValue");
288
+ dataCallback("onPartData");
289
+ this.index = index;
290
+ this.state = state;
291
+ this.flags = flags;
292
+ }
293
+ end() {
294
+ if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
295
+ else if (this.state !== S.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
296
+ }
297
+ };
298
+ }))();
299
+ export { toFormData };
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath as __cjsShimFileURLToPath } from 'node:url';
3
+ import { dirname as __cjsShimDirname } from 'node:path';
4
+ const __filename = __cjsShimFileURLToPath(import.meta.url);
5
+ const __dirname = __cjsShimDirname(__filename);
6
+ //#region src/utils/suppress-sqlite-warning.ts
7
+ /**
8
+ * Suppress Node's ExperimentalWarning for the built-in `node:sqlite` module.
9
+ *
10
+ * Node emits this warning while `node:sqlite` is loaded as a transitive
11
+ * dependency during ESM module evaluation, before any app code can intercept
12
+ * it via `process.emitWarning` or `process.on('warning')`. We filter the known
13
+ * warning text from stderr to keep startup output clean.
14
+ */
15
+ const originalWrite = process.stderr.write.bind(process.stderr);
16
+ let expectingTraceSuggestion = false;
17
+ function isSQLiteExperimentalWarning(line) {
18
+ return /^\(node:\d+\) ExperimentalWarning: SQLite is an experimental feature/.test(line);
19
+ }
20
+ function isTraceSuggestion(line) {
21
+ return line.startsWith("(Use `node --trace-warnings");
22
+ }
23
+ process.stderr.write = (chunk, ...args) => {
24
+ const lines = (typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8")).split("\n");
25
+ let changed = false;
26
+ const kept = [];
27
+ for (const line of lines) {
28
+ if (isSQLiteExperimentalWarning(line)) {
29
+ expectingTraceSuggestion = true;
30
+ changed = true;
31
+ continue;
32
+ }
33
+ if (expectingTraceSuggestion && isTraceSuggestion(line)) {
34
+ expectingTraceSuggestion = false;
35
+ changed = true;
36
+ continue;
37
+ }
38
+ expectingTraceSuggestion = false;
39
+ kept.push(line);
40
+ }
41
+ if (changed) {
42
+ const filtered = kept.join("\n");
43
+ if (filtered.length === 0) {
44
+ args.find((a) => typeof a === "function")?.();
45
+ return true;
46
+ }
47
+ return originalWrite(filtered, ...args);
48
+ }
49
+ return originalWrite(chunk, ...args);
50
+ };
51
+ //#endregion
52
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scream-code",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "A terminal-native AI agent for builders",
5
5
  "license": "MIT",
6
6
  "author": "ScreamCli",
@@ -39,7 +39,22 @@
39
39
  ]
40
40
  },
41
41
  "publishConfig": {
42
- "access": "public"
42
+ "access": "public",
43
+ "provenance": true
44
+ },
45
+ "scripts": {
46
+ "build": "tsdown",
47
+ "dev": "node scripts/dev.mjs",
48
+ "dev:cli-only": "tsx --import ../../build/register-raw-text-loader.mjs ./src/main.ts",
49
+ "dev:prod": "node dist/main.mjs",
50
+ "clean": "rm -rf dist",
51
+ "typecheck": "tsc -p tsconfig.json --noEmit",
52
+ "test": "pnpm -w run build:packages && vitest run",
53
+ "e2e": "pnpm -w run build:packages && SCREAM_E2E=1 vitest run test/e2e",
54
+ "e2e:real": "pnpm -w run build:packages && SCREAM_E2E_REAL=1 vitest run test/e2e/real-llm-smoke.e2e.test.ts",
55
+ "preinstall": "node -e \"console.log('\\n📦 正在安装 scream-code,请稍候...\\n')\"",
56
+ "postinstall": "node scripts/postinstall.mjs",
57
+ "smoke": "node dist/main.mjs --version"
43
58
  },
44
59
  "dependencies": {
45
60
  "@earendil-works/pi-tui": "^0.78.1",
@@ -53,29 +68,15 @@
53
68
  },
54
69
  "devDependencies": {
55
70
  "@modelcontextprotocol/sdk": "^1.29.0",
71
+ "@scream-cli/agent-core": "workspace:^",
72
+ "@scream-cli/config": "workspace:^",
73
+ "@scream-cli/migration-legacy": "workspace:^",
74
+ "@scream-cli/scream-code-sdk": "workspace:^",
75
+ "@scream-code/memory": "workspace:*",
56
76
  "@types/semver": "^7.7.0",
57
- "tsx": "^4.21.0",
58
- "@scream-cli/config": "^0.6.7",
59
- "@scream-cli/scream-code-sdk": "^0.6.7",
60
- "@scream-cli/agent-core": "^0.6.7",
61
- "@scream-cli/migration-legacy": "^0.6.7",
62
- "@scream-code/memory": "0.6.7"
77
+ "tsx": "^4.21.0"
63
78
  },
64
79
  "engines": {
65
80
  "node": ">=22.19.0"
66
- },
67
- "scripts": {
68
- "build": "tsdown",
69
- "dev": "node scripts/dev.mjs",
70
- "dev:cli-only": "tsx --import ../../build/register-raw-text-loader.mjs ./src/main.ts",
71
- "dev:prod": "node dist/main.mjs",
72
- "clean": "rm -rf dist",
73
- "typecheck": "tsc -p tsconfig.json --noEmit",
74
- "test": "pnpm -w run build:packages && vitest run",
75
- "e2e": "pnpm -w run build:packages && SCREAM_E2E=1 vitest run test/e2e",
76
- "e2e:real": "pnpm -w run build:packages && SCREAM_E2E_REAL=1 vitest run test/e2e/real-llm-smoke.e2e.test.ts",
77
- "preinstall": "node -e \"console.log('\\n📦 正在安装 scream-code,请稍候...\\n')\"",
78
- "postinstall": "node scripts/postinstall.mjs",
79
- "smoke": "node dist/main.mjs --version"
80
81
  }
81
- }
82
+ }
File without changes