acp-kernel 0.0.56-pr.212.63 → 0.0.56-pr.215.65
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 +2 -95
- package/dist/index.js.map +1 -1
- package/dist/parse-compress-input.d.ts +0 -2
- package/dist/parse-compress-input.d.ts.map +1 -1
- package/dist/wire/index.d.ts +1 -0
- package/dist/wire/index.d.ts.map +1 -1
- package/dist/wire/index.js +69 -0
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/strip-images.d.ts +11 -0
- package/dist/wire/strip-images.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3251,23 +3251,6 @@ function parseStringInput(raw, callId, diag) {
|
|
|
3251
3251
|
diag.rawPrefix = raw.slice(0, 800);
|
|
3252
3252
|
diag.length = raw.length;
|
|
3253
3253
|
const cleaned = stripFence(raw.trim());
|
|
3254
|
-
const first = parseStringCore(cleaned, callId, diag);
|
|
3255
|
-
if (first.ranges.length === 0 || first.diagnostics.invalidItems > 0) {
|
|
3256
|
-
const normalized = normalizeSingleQuotes(cleaned);
|
|
3257
|
-
if (normalized !== void 0) {
|
|
3258
|
-
const retryDiag = { ok: false, kind: "ok", invalidItems: 0 };
|
|
3259
|
-
retryDiag.rawPrefix = diag.rawPrefix;
|
|
3260
|
-
retryDiag.length = diag.length;
|
|
3261
|
-
const retry = parseStringCore(normalized, callId, retryDiag);
|
|
3262
|
-
if (retry.ranges.length > first.ranges.length) {
|
|
3263
|
-
retryDiag.quoteSalvage = true;
|
|
3264
|
-
return retry;
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
|
-
return first;
|
|
3269
|
-
}
|
|
3270
|
-
function parseStringCore(cleaned, callId, diag) {
|
|
3271
3254
|
if (cleaned === "") {
|
|
3272
3255
|
diag.kind = "empty-input";
|
|
3273
3256
|
return finish([], diag);
|
|
@@ -3311,7 +3294,6 @@ function parseObjectValue(value, callId, diag) {
|
|
|
3311
3294
|
}
|
|
3312
3295
|
entries = parsed.entries;
|
|
3313
3296
|
salvaged = parsed.salvaged;
|
|
3314
|
-
if (parsed.quoteRepaired) diag.quoteSalvage = true;
|
|
3315
3297
|
} else {
|
|
3316
3298
|
diag.kind = "content-not-array";
|
|
3317
3299
|
return finish([], diag);
|
|
@@ -3333,17 +3315,7 @@ function parseObjectValue(value, callId, diag) {
|
|
|
3333
3315
|
}
|
|
3334
3316
|
function parseContentArray(s) {
|
|
3335
3317
|
const cleaned = stripFence(s.trim());
|
|
3336
|
-
|
|
3337
|
-
if (direct !== null && direct.entries.length > 0) return direct;
|
|
3338
|
-
const normalized = normalizeSingleQuotes(cleaned);
|
|
3339
|
-
if (normalized !== void 0) {
|
|
3340
|
-
const retry = parseContentArrayCore(normalized);
|
|
3341
|
-
if (retry !== null && retry.entries.length > 0) return { ...retry, quoteRepaired: true };
|
|
3342
|
-
}
|
|
3343
|
-
return direct;
|
|
3344
|
-
}
|
|
3345
|
-
function parseContentArrayCore(s) {
|
|
3346
|
-
let value = s === "" ? void 0 : tryParseLenient(s);
|
|
3318
|
+
let value = cleaned === "" ? void 0 : tryParseLenient(cleaned);
|
|
3347
3319
|
if (typeof value === "string") {
|
|
3348
3320
|
value = tryParseLenient(stripFence(value));
|
|
3349
3321
|
}
|
|
@@ -3351,7 +3323,7 @@ function parseContentArrayCore(s) {
|
|
|
3351
3323
|
return { entries: value, salvaged: false };
|
|
3352
3324
|
}
|
|
3353
3325
|
if (value === void 0) {
|
|
3354
|
-
const entries = salvageContentEntries('{"content": ' +
|
|
3326
|
+
const entries = salvageContentEntries('{"content": ' + cleaned);
|
|
3355
3327
|
return { entries, salvaged: entries.length > 0 };
|
|
3356
3328
|
}
|
|
3357
3329
|
return null;
|
|
@@ -3424,71 +3396,6 @@ function tryParseLenient(s) {
|
|
|
3424
3396
|
}
|
|
3425
3397
|
return void 0;
|
|
3426
3398
|
}
|
|
3427
|
-
function normalizeSingleQuotes(raw) {
|
|
3428
|
-
if (!raw.includes("'") || !raw.includes("{") && !raw.includes("[")) return void 0;
|
|
3429
|
-
let out = "";
|
|
3430
|
-
let changed = false;
|
|
3431
|
-
let inDouble = false;
|
|
3432
|
-
let inSingle = false;
|
|
3433
|
-
for (let i = 0; i < raw.length; i++) {
|
|
3434
|
-
const ch = raw.charAt(i);
|
|
3435
|
-
if (inDouble) {
|
|
3436
|
-
out += ch;
|
|
3437
|
-
if (ch === "\\" && i + 1 < raw.length) {
|
|
3438
|
-
out += raw.charAt(i + 1);
|
|
3439
|
-
i++;
|
|
3440
|
-
} else if (ch === '"') {
|
|
3441
|
-
inDouble = false;
|
|
3442
|
-
}
|
|
3443
|
-
continue;
|
|
3444
|
-
}
|
|
3445
|
-
if (inSingle) {
|
|
3446
|
-
if (ch === "\\" && i + 1 < raw.length) {
|
|
3447
|
-
const next = raw.charAt(i + 1);
|
|
3448
|
-
out += next === "'" ? "'" : "\\" + next;
|
|
3449
|
-
i++;
|
|
3450
|
-
continue;
|
|
3451
|
-
}
|
|
3452
|
-
if (ch === "'") {
|
|
3453
|
-
out += '"';
|
|
3454
|
-
inSingle = false;
|
|
3455
|
-
changed = true;
|
|
3456
|
-
continue;
|
|
3457
|
-
}
|
|
3458
|
-
if (ch === '"') {
|
|
3459
|
-
out += '\\"';
|
|
3460
|
-
continue;
|
|
3461
|
-
}
|
|
3462
|
-
if (ch === "\n") {
|
|
3463
|
-
out += "\\n";
|
|
3464
|
-
continue;
|
|
3465
|
-
}
|
|
3466
|
-
if (ch === "\r") {
|
|
3467
|
-
out += "\\r";
|
|
3468
|
-
continue;
|
|
3469
|
-
}
|
|
3470
|
-
if (ch === " ") {
|
|
3471
|
-
out += "\\t";
|
|
3472
|
-
continue;
|
|
3473
|
-
}
|
|
3474
|
-
out += ch;
|
|
3475
|
-
continue;
|
|
3476
|
-
}
|
|
3477
|
-
if (ch === '"') {
|
|
3478
|
-
inDouble = true;
|
|
3479
|
-
out += ch;
|
|
3480
|
-
continue;
|
|
3481
|
-
}
|
|
3482
|
-
if (ch === "'") {
|
|
3483
|
-
inSingle = true;
|
|
3484
|
-
out += '"';
|
|
3485
|
-
changed = true;
|
|
3486
|
-
continue;
|
|
3487
|
-
}
|
|
3488
|
-
out += ch;
|
|
3489
|
-
}
|
|
3490
|
-
return changed ? out : void 0;
|
|
3491
|
-
}
|
|
3492
3399
|
function stripFence(s) {
|
|
3493
3400
|
if (!s.startsWith("```")) return s;
|
|
3494
3401
|
const firstNewline = s.indexOf("\n");
|