spacecode 2.5.0 → 2.5.1
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 -2
- package/dist/index.js.map +1 -1
- package/dist/repl.mjs +15 -16
- package/package.json +1 -1
package/dist/repl.mjs
CHANGED
|
@@ -5320,7 +5320,7 @@ function applyPlan(input, decisions, maxCoreChars = MAX_CORE_CHARS) {
|
|
|
5320
5320
|
if (!bySlug.has(d.slug)) throw new AdaptPlanError(`plan names unknown section "${d.slug}"`);
|
|
5321
5321
|
if (seen.has(d.slug)) throw new AdaptPlanError(`plan decides section "${d.slug}" twice`);
|
|
5322
5322
|
seen.add(d.slug);
|
|
5323
|
-
if (d.decision === "drop" && !(d.reason && d.reason.trim())) throw new AdaptPlanError(`
|
|
5323
|
+
if (d.decision === "drop" && !(d.reason && d.reason.trim())) throw new AdaptPlanError(`flagged section "${d.slug}" has no reason`);
|
|
5324
5324
|
if (d.decision === "on_demand" && !(d.summary && d.summary.trim())) throw new AdaptPlanError(`on-demand section "${d.slug}" has no summary`);
|
|
5325
5325
|
}
|
|
5326
5326
|
const missing = input.sections.filter((s) => !seen.has(s.slug)).map((s) => s.slug);
|
|
@@ -5331,13 +5331,17 @@ function applyPlan(input, decisions, maxCoreChars = MAX_CORE_CHARS) {
|
|
|
5331
5331
|
const assemble = () => {
|
|
5332
5332
|
const kept = [];
|
|
5333
5333
|
const onDemand2 = [];
|
|
5334
|
-
const
|
|
5334
|
+
const flagged2 = [];
|
|
5335
5335
|
const index = [];
|
|
5336
5336
|
for (const d of decisions) {
|
|
5337
5337
|
const s = bySlug.get(d.slug);
|
|
5338
5338
|
if (keptSlugs.has(d.slug)) kept.push(s.text);
|
|
5339
|
-
else if (d.decision === "drop")
|
|
5340
|
-
|
|
5339
|
+
else if (d.decision === "drop") {
|
|
5340
|
+
const reason = d.reason.trim().replace(/\s+/g, " ");
|
|
5341
|
+
flagged2.push({ slug: s.slug, title: s.title, reason, unsupported: s.unsupported });
|
|
5342
|
+
onDemand2.push({ slug: s.slug, title: s.title, text: s.text });
|
|
5343
|
+
index.push(`- ${s.slug}: ${s.title} \u2014 written for Claude Code, may not apply here (${reason})`);
|
|
5344
|
+
} else {
|
|
5341
5345
|
onDemand2.push({ slug: s.slug, title: s.title, text: s.text });
|
|
5342
5346
|
index.push(`- ${s.slug}: ${s.title} \u2014 ${summaries.get(s.slug) || `read when working on: ${s.title}`}`);
|
|
5343
5347
|
}
|
|
@@ -5347,19 +5351,19 @@ function applyPlan(input, decisions, maxCoreChars = MAX_CORE_CHARS) {
|
|
|
5347
5351
|
Use the instructions_read tool with a section name to read one before acting in that area:
|
|
5348
5352
|
${index.join("\n")}
|
|
5349
5353
|
` : "";
|
|
5350
|
-
return { core: input.preamble + kept.join("") + indexBlock, onDemand: onDemand2,
|
|
5354
|
+
return { core: input.preamble + kept.join("") + indexBlock, onDemand: onDemand2, flagged: flagged2 };
|
|
5351
5355
|
};
|
|
5352
|
-
let { core, onDemand,
|
|
5356
|
+
let { core, onDemand, flagged } = assemble();
|
|
5353
5357
|
while (core.length > maxCoreChars && keptSlugs.size > 0) {
|
|
5354
5358
|
const largest = [...keptSlugs].map((slug) => bySlug.get(slug)).sort((a, b2) => b2.chars - a.chars)[0];
|
|
5355
5359
|
keptSlugs.delete(largest.slug);
|
|
5356
5360
|
demoted.push({ slug: largest.slug, title: largest.title });
|
|
5357
|
-
({ core, onDemand,
|
|
5361
|
+
({ core, onDemand, flagged } = assemble());
|
|
5358
5362
|
}
|
|
5359
5363
|
if (core.length > maxCoreChars) throw new AdaptPlanError(`core is ${core.length} chars, over the ${maxCoreChars} budget even with every section on demand`);
|
|
5360
5364
|
const translated = input.preamble + input.sections.map((s) => s.text).join("");
|
|
5361
|
-
const coverage = checkCoverage(translated, [core, ...onDemand.map((o) => o.text)],
|
|
5362
|
-
return { core, onDemand,
|
|
5365
|
+
const coverage = checkCoverage(translated, [core, ...onDemand.map((o) => o.text)], []);
|
|
5366
|
+
return { core, onDemand, flagged, coverage, coreChars: core.length, demoted };
|
|
5363
5367
|
}
|
|
5364
5368
|
var AdaptPlanError, MAX_CORE_CHARS;
|
|
5365
5369
|
var init_adapt_plan = __esm({
|
|
@@ -5569,16 +5573,11 @@ async function sha12(text) {
|
|
|
5569
5573
|
return [...new Uint8Array(d)].slice(0, 6).map((b2) => b2.toString(16).padStart(2, "0")).join("");
|
|
5570
5574
|
}
|
|
5571
5575
|
function formatAdaptReport(r, before, replaced) {
|
|
5572
|
-
const lines2 = [`Adapted instructions: ${before} chars -> core ${r.coreChars} chars + ${r.onDemand.length} on-demand section(s), ${r.
|
|
5576
|
+
const lines2 = [`Adapted instructions: ${before} chars -> core ${r.coreChars} chars + ${r.onDemand.length} on-demand section(s), ${r.flagged.length} of them flagged as Claude Code-specific. Nothing is removed.`];
|
|
5573
5577
|
for (const x2 of replaced) lines2.push(` tool name ${x2.from} -> ${x2.to} (${x2.count}x)`);
|
|
5574
5578
|
for (const d of r.demoted) lines2.push(` demoted ${d.slug}: kept by the model but moved on demand to fit the core budget`);
|
|
5575
5579
|
for (const o of r.onDemand) lines2.push(` on demand ${o.slug} (${o.text.length} chars)`);
|
|
5576
|
-
for (const d of r.
|
|
5577
|
-
if (r.coverage.droppedRules.length > 0) {
|
|
5578
|
-
lines2.push(` ${r.coverage.droppedRules.length} rule line(s) exist only in dropped sections:`);
|
|
5579
|
-
for (const rule of r.coverage.droppedRules.slice(0, 12)) lines2.push(` - ${rule.slice(0, 140)}`);
|
|
5580
|
-
if (r.coverage.droppedRules.length > 12) lines2.push(` ... and ${r.coverage.droppedRules.length - 12} more`);
|
|
5581
|
-
}
|
|
5580
|
+
for (const d of r.flagged) lines2.push(` flagged ${d.slug}: ${d.reason}${d.unsupported.length ? ` [${d.unsupported.join("; ")}]` : ""}`);
|
|
5582
5581
|
return lines2;
|
|
5583
5582
|
}
|
|
5584
5583
|
async function adaptInstructions(deps, original) {
|