Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(pi): extensions can keep Pi alive while their background work runs #24207

Closedshivamhwp(GitHub profile, opens in a new tab)wants to merge 21 commits intomain fromrefs/pull/24207/headopened View on GitHub

Showing 3 changed files with 131 additions and 0 deletions (loading 1).

x
0 of 3 viewed, 3 left
10 additions and 0 deletionsdocs/user/providers-pi.mdModified
View file
@@ -55,6 +55,16 @@
the work log. Extensions can publish status text near the composer. Terminal titles and generic
widgets do not have a T3 Code equivalent.
​
+T3 Code stops an idle Pi process after 30 minutes. An extension that keeps working after a turn
+ends, such as a background command, can keep the process alive by setting a non-empty status under
+the `t3:background` key, or `t3:background:<job>` for several jobs, until the work ends:
+`ctx.ui.setStatus("t3:background:build", "Build running")`, then
+`ctx.ui.setStatus("t3:background:build", undefined)`. While a status is set, the thread shows as
+waiting on that work and Stop ends the Pi process along with it. Without other activity, the
+process stays up for about four more hours. Switching Pi sessions drops these statuses, so clear
+them in your `session_shutdown` handler. When the extension wakes the agent with the result, the
+reply appears in the thread.
+​
## Permission Modes
​
T3 Code applies the composer permission mode through Pi's blocking tool hook:
121 additions and 0 deletionspackages/provider-pi/src/server/adapter.test.tsModified
View file
@@ -1030,6 +1030,127 @@
}).pipe(Effect.scoped, Effect.provide(layerTest)),
+ it.effect("lists extension background work as pending tasks on the bound thread", () =>
+ Effect.gen(function* () {
+ const fake = yield* makeFakePi;
+ const { runtime, takeEvent } = yield* openRuntime(fake);
+ const providerThread = yield* runtime.ensureThread({