terminal-smart-cli 0.97.24 → 0.97.26
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/lib/agent.js +5 -0
- package/lib/meta.js +10 -2
- package/package.json +1 -1
package/lib/agent.js
CHANGED
|
@@ -553,6 +553,11 @@ function mutationBatchConflicts(toolCalls, cwd) {
|
|
|
553
553
|
for (const tc of (Array.isArray(toolCalls) ? toolCalls : [])) {
|
|
554
554
|
const name = tc && tc.function && tc.function.name;
|
|
555
555
|
if (!FILE_MUTATORS.has(name)) continue;
|
|
556
|
+
// Anchor edits are deterministic and this loop executes tool calls in
|
|
557
|
+
// order. Blocking a batch of independent source-code anchors made capable
|
|
558
|
+
// models stall on normal multi-part UI changes. Whole-file/document/sheet
|
|
559
|
+
// mutations remain protected because their batches can overwrite state.
|
|
560
|
+
if (name === 'editar_arquivo') continue;
|
|
556
561
|
let input = {}; try { input = JSON.parse(tc.function.arguments || '{}'); } catch (_) {}
|
|
557
562
|
const raw = input.caminho || input.path || input.arquivo;
|
|
558
563
|
if (!raw) continue;
|
package/lib/meta.js
CHANGED
|
@@ -1400,6 +1400,12 @@ async function run(goal, opts = {}) {
|
|
|
1400
1400
|
? (path.isAbsolute(expectedArtifact) ? expectedArtifact : path.resolve(dir, expectedArtifact))
|
|
1401
1401
|
: null;
|
|
1402
1402
|
const expectedBeforeHash = expectedOnDisk ? artifactHash(expectedOnDisk) : null;
|
|
1403
|
+
// Persist the starting fingerprint so a successful edit made immediately
|
|
1404
|
+
// before a pause is still provable in the next clean window.
|
|
1405
|
+
if (!item.artifactBaselineHash && expectedBeforeHash) {
|
|
1406
|
+
item.artifactBaselineHash = expectedBeforeHash;
|
|
1407
|
+
save(st, dir);
|
|
1408
|
+
}
|
|
1403
1409
|
if (!item.directArtifact && (item.attempts || 0) > 0 && expectedOnDisk && !fs.existsSync(expectedOnDisk)) {
|
|
1404
1410
|
item.directArtifact = true;
|
|
1405
1411
|
item.directModel = item.directModel || 'glm-5.2';
|
|
@@ -1656,7 +1662,9 @@ async function run(goal, opts = {}) {
|
|
|
1656
1662
|
const expectedNow = String(expectedArtifact || '').replace(/\\/g, '/').toLowerCase();
|
|
1657
1663
|
const expectedAfterHash = expectedOnDisk ? artifactHash(expectedOnDisk) : null;
|
|
1658
1664
|
const expectedChangedNow = !!expectedAfterHash && expectedAfterHash !== expectedBeforeHash;
|
|
1659
|
-
const
|
|
1665
|
+
const expectedChangedSinceBaseline = !!expectedAfterHash && !!item.artifactBaselineHash
|
|
1666
|
+
&& expectedAfterHash !== item.artifactBaselineHash;
|
|
1667
|
+
const wroteExpectedNow = expectedChangedNow || expectedChangedSinceBaseline || (out.actions || []).some(a => {
|
|
1660
1668
|
if (!['escrever_arquivo', 'editar_arquivo'].includes(a && a.name)) return false;
|
|
1661
1669
|
const target = String(a.target || '').replace(/\\/g, '/').toLowerCase();
|
|
1662
1670
|
return target === expectedNow || target.endsWith('/' + expectedNow);
|
|
@@ -1701,7 +1709,7 @@ async function run(goal, opts = {}) {
|
|
|
1701
1709
|
// A confined command may legitimately edit the project (formatter, codemod,
|
|
1702
1710
|
// migration script). Hash evidence ties that mutation to the exact expected
|
|
1703
1711
|
// artifact instead of trusting the command narrative.
|
|
1704
|
-
if (expectedChangedNow && expectedArtifact) written.push(String(expectedArtifact));
|
|
1712
|
+
if ((expectedChangedNow || expectedChangedSinceBaseline) && expectedArtifact) written.push(String(expectedArtifact));
|
|
1705
1713
|
const _basename = (p) => String(p).replace(/\\/g, '/').split('/').pop().toLowerCase();
|
|
1706
1714
|
const _fileHints = (txt) => (String(txt).match(/[\w.\-]+\.(kt|java|xml|gradle|json|md|txt|kts|properties|pro|png|webp|py|gd|js|ts|html|css|sh)\b/gi) || []).map(s => s.toLowerCase());
|
|
1707
1715
|
const itemFiles = _fileHints(item.desc);
|