@pontia/pi-client-plugin 0.6.15 → 0.7.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/package.json +2 -2
- package/src/index.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pontia/pi-client-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Pi extension that connects coding-agent sessions to Pontia.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typecheck": "tsc --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
39
|
+
"@earendil-works/pi-coding-agent": "^1.5.0",
|
|
40
40
|
"@types/node": "^22.15.3",
|
|
41
41
|
"oxfmt": "^0.70.0",
|
|
42
42
|
"typescript": "^5.8.3",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import type { HistoryContext } from "./history.js";
|
|
4
5
|
import { PiCompaction } from "./compaction.js";
|
|
@@ -525,7 +526,7 @@ export function createPontiaPiExtension(
|
|
|
525
526
|
}
|
|
526
527
|
|
|
527
528
|
pi.on("before_agent_start", async (event) => {
|
|
528
|
-
pendingPrompt = event.prompt;
|
|
529
|
+
pendingPrompt = event.messageType === "user" ? event.prompt : undefined;
|
|
529
530
|
if (reportingDisabled || !(await confirmManagedPane())) return;
|
|
530
531
|
try {
|
|
531
532
|
const profilePrompt = await loadProfileSystemPrompt(
|
|
@@ -745,7 +746,7 @@ export function createPontiaPiExtension(
|
|
|
745
746
|
|
|
746
747
|
pi.on("agent_start", async (_event, ctx) => {
|
|
747
748
|
const topologyContext = topologyContextFromHookContext(ctx);
|
|
748
|
-
const
|
|
749
|
+
const previousLeafId = leafIdFromHookContext(ctx);
|
|
749
750
|
if (reportingDisabled) return;
|
|
750
751
|
try {
|
|
751
752
|
const dispatch = directInput.getStore();
|
|
@@ -755,7 +756,7 @@ export function createPontiaPiExtension(
|
|
|
755
756
|
: undefined;
|
|
756
757
|
if (dispatch) dispatch.consumed = true;
|
|
757
758
|
const logFile = currentHookLogFile();
|
|
758
|
-
if (!
|
|
759
|
+
if (!previousLeafId) {
|
|
759
760
|
activeTurn = undefined;
|
|
760
761
|
pendingPrompt = undefined;
|
|
761
762
|
await logDiagnostic(logFile, {
|
|
@@ -830,9 +831,10 @@ export function createPontiaPiExtension(
|
|
|
830
831
|
}
|
|
831
832
|
const reporter = makeReporter(logFile);
|
|
832
833
|
lastContextUsageJson = undefined;
|
|
834
|
+
// Editing and replaying input can start another run from the same Pi leaf.
|
|
833
835
|
const started = await reporter.report(
|
|
834
836
|
turnContext,
|
|
835
|
-
buildTurnStartedEvent(turnContext,
|
|
837
|
+
buildTurnStartedEvent(turnContext, randomUUID(), previousLeafId, topologyContext),
|
|
836
838
|
);
|
|
837
839
|
const canonicalTurnId = typeof started === "boolean" ? turnContext.turnId : started.turnId;
|
|
838
840
|
if (!reportAccepted(started) || !canonicalTurnId) {
|