@danypops/pi-papyrus 0.59.3 → 0.59.4
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/extension/src/index.ts +13 -12
- package/package.json +1 -1
package/extension/src/index.ts
CHANGED
|
@@ -924,16 +924,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
924
924
|
// agent_settled is intentionally later than agent_end: Pi guarantees that
|
|
925
925
|
// retry, compaction retry, and queued follow-up processing have finished.
|
|
926
926
|
|
|
927
|
-
pi.on("input",
|
|
927
|
+
pi.on("input", (event, ctx) => {
|
|
928
928
|
if (event.source === "extension") return;
|
|
929
929
|
taskContinuation.onHumanInput();
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
930
|
+
const sessionId = ctx.sessionManager.getSessionId();
|
|
931
|
+
// Input handlers are on Pi's prompt-submission path. Resume bookkeeping is
|
|
932
|
+
// opportunistic and must never hold the user's message behind daemon I/O.
|
|
933
|
+
void callService<Record<string, unknown>, { artifact: Artifact; status: string; pauseReason?: string } | null>("tasks.focused", {
|
|
934
|
+
session_id: sessionId,
|
|
935
|
+
})
|
|
936
|
+
.then(async (focus) => {
|
|
937
|
+
if (!focus || !shouldResumeFocusOnHumanInput(focus.status, focus.pauseReason)) return;
|
|
937
938
|
await callService("tasks.unpause", {
|
|
938
939
|
actor: "system",
|
|
939
940
|
source: "task-continuation",
|
|
@@ -947,10 +948,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
947
948
|
status: "unpaused",
|
|
948
949
|
effort: extractDeclaredEffort(focus.artifact.extra),
|
|
949
950
|
});
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
951
|
+
})
|
|
952
|
+
.catch(() => {
|
|
953
|
+
// The daemon may be unavailable during startup, reload, or shutdown.
|
|
954
|
+
});
|
|
954
955
|
});
|
|
955
956
|
pi.on("agent_start", () => {
|
|
956
957
|
taskContinuation.onAgentStart();
|
package/package.json
CHANGED