@mariozechner/pi-coding-agent 0.63.0 → 0.63.2
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/CHANGELOG.md +35 -0
- package/README.md +2 -2
- package/dist/core/agent-session.d.ts +4 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +65 -10
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +18 -17
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +10 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +34 -18
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +3 -3
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +50 -25
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +7 -17
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +23 -98
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +5 -10
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +2 -7
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +27 -64
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/extensions.md +44 -1
- package/docs/skills.md +3 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/trigger-compact.ts +11 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -1270,6 +1270,7 @@ export class AgentSession {
|
|
|
1270
1270
|
this._disconnectFromAgent();
|
|
1271
1271
|
await this.abort();
|
|
1272
1272
|
this._compactionAbortController = new AbortController();
|
|
1273
|
+
this._emit({ type: "compaction_start", reason: "manual" });
|
|
1273
1274
|
try {
|
|
1274
1275
|
if (!this.model) {
|
|
1275
1276
|
throw new Error("No model selected");
|
|
@@ -1339,12 +1340,33 @@ export class AgentSession {
|
|
|
1339
1340
|
fromExtension,
|
|
1340
1341
|
});
|
|
1341
1342
|
}
|
|
1342
|
-
|
|
1343
|
+
const compactionResult = {
|
|
1343
1344
|
summary,
|
|
1344
1345
|
firstKeptEntryId,
|
|
1345
1346
|
tokensBefore,
|
|
1346
1347
|
details,
|
|
1347
1348
|
};
|
|
1349
|
+
this._emit({
|
|
1350
|
+
type: "compaction_end",
|
|
1351
|
+
reason: "manual",
|
|
1352
|
+
result: compactionResult,
|
|
1353
|
+
aborted: false,
|
|
1354
|
+
willRetry: false,
|
|
1355
|
+
});
|
|
1356
|
+
return compactionResult;
|
|
1357
|
+
}
|
|
1358
|
+
catch (error) {
|
|
1359
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1360
|
+
const aborted = message === "Compaction cancelled" || (error instanceof Error && error.name === "AbortError");
|
|
1361
|
+
this._emit({
|
|
1362
|
+
type: "compaction_end",
|
|
1363
|
+
reason: "manual",
|
|
1364
|
+
result: undefined,
|
|
1365
|
+
aborted,
|
|
1366
|
+
willRetry: false,
|
|
1367
|
+
errorMessage: aborted ? undefined : `Compaction failed: ${message}`,
|
|
1368
|
+
});
|
|
1369
|
+
throw error;
|
|
1348
1370
|
}
|
|
1349
1371
|
finally {
|
|
1350
1372
|
this._compactionAbortController = undefined;
|
|
@@ -1400,7 +1422,8 @@ export class AgentSession {
|
|
|
1400
1422
|
if (sameModel && isContextOverflow(assistantMessage, contextWindow)) {
|
|
1401
1423
|
if (this._overflowRecoveryAttempted) {
|
|
1402
1424
|
this._emit({
|
|
1403
|
-
type: "
|
|
1425
|
+
type: "compaction_end",
|
|
1426
|
+
reason: "overflow",
|
|
1404
1427
|
result: undefined,
|
|
1405
1428
|
aborted: false,
|
|
1406
1429
|
willRetry: false,
|
|
@@ -1450,23 +1473,41 @@ export class AgentSession {
|
|
|
1450
1473
|
*/
|
|
1451
1474
|
async _runAutoCompaction(reason, willRetry) {
|
|
1452
1475
|
const settings = this.settingsManager.getCompactionSettings();
|
|
1453
|
-
this._emit({ type: "
|
|
1476
|
+
this._emit({ type: "compaction_start", reason });
|
|
1454
1477
|
this._autoCompactionAbortController = new AbortController();
|
|
1455
1478
|
try {
|
|
1456
1479
|
if (!this.model) {
|
|
1457
|
-
this._emit({
|
|
1480
|
+
this._emit({
|
|
1481
|
+
type: "compaction_end",
|
|
1482
|
+
reason,
|
|
1483
|
+
result: undefined,
|
|
1484
|
+
aborted: false,
|
|
1485
|
+
willRetry: false,
|
|
1486
|
+
});
|
|
1458
1487
|
return;
|
|
1459
1488
|
}
|
|
1460
1489
|
const authResult = await this._modelRegistry.getApiKeyAndHeaders(this.model);
|
|
1461
1490
|
if (!authResult.ok || !authResult.apiKey) {
|
|
1462
|
-
this._emit({
|
|
1491
|
+
this._emit({
|
|
1492
|
+
type: "compaction_end",
|
|
1493
|
+
reason,
|
|
1494
|
+
result: undefined,
|
|
1495
|
+
aborted: false,
|
|
1496
|
+
willRetry: false,
|
|
1497
|
+
});
|
|
1463
1498
|
return;
|
|
1464
1499
|
}
|
|
1465
1500
|
const { apiKey, headers } = authResult;
|
|
1466
1501
|
const pathEntries = this.sessionManager.getBranch();
|
|
1467
1502
|
const preparation = prepareCompaction(pathEntries, settings);
|
|
1468
1503
|
if (!preparation) {
|
|
1469
|
-
this._emit({
|
|
1504
|
+
this._emit({
|
|
1505
|
+
type: "compaction_end",
|
|
1506
|
+
reason,
|
|
1507
|
+
result: undefined,
|
|
1508
|
+
aborted: false,
|
|
1509
|
+
willRetry: false,
|
|
1510
|
+
});
|
|
1470
1511
|
return;
|
|
1471
1512
|
}
|
|
1472
1513
|
let extensionCompaction;
|
|
@@ -1480,7 +1521,13 @@ export class AgentSession {
|
|
|
1480
1521
|
signal: this._autoCompactionAbortController.signal,
|
|
1481
1522
|
}));
|
|
1482
1523
|
if (extensionResult?.cancel) {
|
|
1483
|
-
this._emit({
|
|
1524
|
+
this._emit({
|
|
1525
|
+
type: "compaction_end",
|
|
1526
|
+
reason,
|
|
1527
|
+
result: undefined,
|
|
1528
|
+
aborted: true,
|
|
1529
|
+
willRetry: false,
|
|
1530
|
+
});
|
|
1484
1531
|
return;
|
|
1485
1532
|
}
|
|
1486
1533
|
if (extensionResult?.compaction) {
|
|
@@ -1508,7 +1555,13 @@ export class AgentSession {
|
|
|
1508
1555
|
details = compactResult.details;
|
|
1509
1556
|
}
|
|
1510
1557
|
if (this._autoCompactionAbortController.signal.aborted) {
|
|
1511
|
-
this._emit({
|
|
1558
|
+
this._emit({
|
|
1559
|
+
type: "compaction_end",
|
|
1560
|
+
reason,
|
|
1561
|
+
result: undefined,
|
|
1562
|
+
aborted: true,
|
|
1563
|
+
willRetry: false,
|
|
1564
|
+
});
|
|
1512
1565
|
return;
|
|
1513
1566
|
}
|
|
1514
1567
|
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromExtension);
|
|
@@ -1530,7 +1583,7 @@ export class AgentSession {
|
|
|
1530
1583
|
tokensBefore,
|
|
1531
1584
|
details,
|
|
1532
1585
|
};
|
|
1533
|
-
this._emit({ type: "
|
|
1586
|
+
this._emit({ type: "compaction_end", reason, result, aborted: false, willRetry });
|
|
1534
1587
|
if (willRetry) {
|
|
1535
1588
|
const messages = this.agent.state.messages;
|
|
1536
1589
|
const lastMsg = messages[messages.length - 1];
|
|
@@ -1552,7 +1605,8 @@ export class AgentSession {
|
|
|
1552
1605
|
catch (error) {
|
|
1553
1606
|
const errorMessage = error instanceof Error ? error.message : "compaction failed";
|
|
1554
1607
|
this._emit({
|
|
1555
|
-
type: "
|
|
1608
|
+
type: "compaction_end",
|
|
1609
|
+
reason,
|
|
1556
1610
|
result: undefined,
|
|
1557
1611
|
aborted: false,
|
|
1558
1612
|
willRetry: false,
|
|
@@ -1722,6 +1776,7 @@ export class AgentSession {
|
|
|
1722
1776
|
}, {
|
|
1723
1777
|
getModel: () => this.model,
|
|
1724
1778
|
isIdle: () => !this.isStreaming,
|
|
1779
|
+
getSignal: () => this.agent.signal,
|
|
1725
1780
|
abort: () => this.abort(),
|
|
1726
1781
|
hasPendingMessages: () => this.pendingMessageCount > 0,
|
|
1727
1782
|
shutdown: () => {
|