acp-kernel 0.0.55 → 0.0.56-pr.212.63
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 +99 -2
- package/dist/index.js.map +1 -1
- package/dist/panel/index.js +3 -3
- package/dist/panel/index.js.map +1 -1
- package/dist/panel/panel.d.ts +7 -5
- package/dist/panel/panel.d.ts.map +1 -1
- package/dist/parse-compress-input.d.ts +2 -0
- package/dist/parse-compress-input.d.ts.map +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -284,6 +284,10 @@ function syncBlocks(messages, state) {
|
|
|
284
284
|
block.active = false;
|
|
285
285
|
continue;
|
|
286
286
|
}
|
|
287
|
+
if (block.expanded) {
|
|
288
|
+
block.active = false;
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
287
291
|
block.active = true;
|
|
288
292
|
const stillPresent = block.effectiveMessageIds.some((id) => presentIds.has(id)) || presentIds.has(summaryMessageId(block.blockId));
|
|
289
293
|
if (!stillPresent) {
|
|
@@ -3247,6 +3251,23 @@ function parseStringInput(raw, callId, diag) {
|
|
|
3247
3251
|
diag.rawPrefix = raw.slice(0, 800);
|
|
3248
3252
|
diag.length = raw.length;
|
|
3249
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) {
|
|
3250
3271
|
if (cleaned === "") {
|
|
3251
3272
|
diag.kind = "empty-input";
|
|
3252
3273
|
return finish([], diag);
|
|
@@ -3290,6 +3311,7 @@ function parseObjectValue(value, callId, diag) {
|
|
|
3290
3311
|
}
|
|
3291
3312
|
entries = parsed.entries;
|
|
3292
3313
|
salvaged = parsed.salvaged;
|
|
3314
|
+
if (parsed.quoteRepaired) diag.quoteSalvage = true;
|
|
3293
3315
|
} else {
|
|
3294
3316
|
diag.kind = "content-not-array";
|
|
3295
3317
|
return finish([], diag);
|
|
@@ -3311,7 +3333,17 @@ function parseObjectValue(value, callId, diag) {
|
|
|
3311
3333
|
}
|
|
3312
3334
|
function parseContentArray(s) {
|
|
3313
3335
|
const cleaned = stripFence(s.trim());
|
|
3314
|
-
|
|
3336
|
+
const direct = parseContentArrayCore(cleaned);
|
|
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);
|
|
3315
3347
|
if (typeof value === "string") {
|
|
3316
3348
|
value = tryParseLenient(stripFence(value));
|
|
3317
3349
|
}
|
|
@@ -3319,7 +3351,7 @@ function parseContentArray(s) {
|
|
|
3319
3351
|
return { entries: value, salvaged: false };
|
|
3320
3352
|
}
|
|
3321
3353
|
if (value === void 0) {
|
|
3322
|
-
const entries = salvageContentEntries('{"content": ' +
|
|
3354
|
+
const entries = salvageContentEntries('{"content": ' + s);
|
|
3323
3355
|
return { entries, salvaged: entries.length > 0 };
|
|
3324
3356
|
}
|
|
3325
3357
|
return null;
|
|
@@ -3392,6 +3424,71 @@ function tryParseLenient(s) {
|
|
|
3392
3424
|
}
|
|
3393
3425
|
return void 0;
|
|
3394
3426
|
}
|
|
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
|
+
}
|
|
3395
3492
|
function stripFence(s) {
|
|
3396
3493
|
if (!s.startsWith("```")) return s;
|
|
3397
3494
|
const firstNewline = s.indexOf("\n");
|