Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fe64274
feat: add durable cloud Pi runtime sessions
jonathanlab Jul 22, 2026
69695d8
fix: harden cloud Pi session lifecycle
jonathanlab Jul 23, 2026
e1814d6
fix(agent): bind Pi credentials to the configured run
jonathanlab Jul 23, 2026
65e04c1
feat: show cloud Pi provisioning progress
jonathanlab Jul 23, 2026
8dd767a
fix(ui): settle completed Pi provisioning steps
jonathanlab Jul 23, 2026
f56b0d0
feat(pi): use provider model catalog for tasks
jonathanlab Jul 23, 2026
cedae81
refactor(pi): simplify cloud runtime boundaries
jonathanlab Jul 23, 2026
3629baf
refactor(pi): simplify cloud session delivery
jonathanlab Jul 24, 2026
a450577
fix(pi): stabilize cloud reconnect composer
jonathanlab Jul 24, 2026
4deff6f
feat(pi): stream native command lifecycle
jonathanlab Jul 24, 2026
5905445
fix(pi): harden cloud command delivery
jonathanlab Jul 24, 2026
4376c27
fix(pi): authenticate session persistence
jonathanlab Jul 27, 2026
e75b283
feat(pi): add cloud lifecycle recovery
jonathanlab Jul 27, 2026
d59247c
feat(pi): smooth cloud token streaming
jonathanlab Jul 27, 2026
818f8fb
feat(pi): add durable single-message queue
jonathanlab Jul 27, 2026
103fa6e
feat(pi): improve cloud error recovery
jonathanlab Jul 27, 2026
d18f3b2
feat(pi): show native session usage
jonathanlab Jul 28, 2026
01907db
Merge remote-tracking branch 'origin/main' into feat/pi-cloud-runtime…
jonathanlab Jul 28, 2026
7a3e023
fix(pi): disable cloud shell RPC
jonathanlab Jul 28, 2026
462ee21
Revert "fix(pi): disable cloud shell RPC"
jonathanlab Jul 28, 2026
3f07f99
fix(agent): await Pi RPC shutdown
jonathanlab Jul 28, 2026
f566936
fix(agent): handle Pi bootstrap pipe closure
jonathanlab Jul 28, 2026
a77aaae
chore(visual): update storybook baselines
posthog[bot] Jul 28, 2026
3890211
fix(pi): address cloud runtime review findings
jonathanlab Jul 28, 2026
ad82239
fix(pi): recover stale cloud sessions
jonathanlab Jul 28, 2026
1c8d720
refactor(pi): remove frontend runtime heuristics
jonathanlab Jul 28, 2026
c47d64d
fix(agent): keep Pi event translation browser-safe
jonathanlab Jul 28, 2026
894534d
fix(pi): restore cold session controls from TaskSession
jonathanlab Jul 29, 2026
6854588
Merge remote-tracking branch 'origin/main' into feat/pi-cloud-runtime…
jonathanlab Jul 29, 2026
97cd41c
fix(pi): disable unsupported harness extensions
jonathanlab Jul 29, 2026
589d56f
Merge remote-tracking branch 'origin/main' into feat/pi-cloud-runtime…
jonathanlab Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions apps/code/src/renderer/di/bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
type AutoresearchSessionClient,
type AutoresearchStorageClient,
} from "@posthog/core/autoresearch/identifiers";
import {
CLOUD_TASK_CLIENT,
type CloudTaskClient,
} from "@posthog/core/cloud-task/cloudTaskClient";
import {
CODE_REVIEW_WORKSPACE_CLIENT,
REVERT_HUNK_SERVICE,
Expand Down Expand Up @@ -76,8 +80,10 @@ import {
import { PI_RUNNER } from "@posthog/core/pi-runtime/identifiers";
import type { PiRunner } from "@posthog/core/pi-runtime/piRunner";
import {
PI_SESSION_CLIENT,
type PiSessionClient,
LOCAL_PI_SESSION_FACTORY,
PI_SESSION_PROVIDER,
type PiSessionFactory,
type PiSessionProvider,
} from "@posthog/core/pi-runtime/piSessionController";
import {
type BundleLocalSkill,
Expand Down Expand Up @@ -295,7 +301,9 @@ export interface RendererBindings {
[ANALYTICS_TRACKER]: AnalyticsTracker;
[TASK_CREATION_HOST]: ITaskCreationHost;
[PI_RUNNER]: PiRunner;
[PI_SESSION_CLIENT]: PiSessionClient;
[PI_SESSION_PROVIDER]: PiSessionProvider;
[LOCAL_PI_SESSION_FACTORY]: PiSessionFactory;
[CLOUD_TASK_CLIENT]: CloudTaskClient;
[TASK_CREATION_EFFECTS]: TaskCreationEffects;
[RENDERER_TASK_SERVICE]: TaskService;
[TASK_SERVICE]: TaskService;
Expand Down
14 changes: 10 additions & 4 deletions apps/code/src/renderer/di/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import "reflect-metadata";
import { useDevFlagsStore } from "@features/dev-toolbar/devFlagsStore";
import { TypedContainer } from "@inversifyjs/strongly-typed";
import type { TrpcRouter } from "@main/trpc/router";
import {
CLOUD_TASK_CLIENT,
type CloudTaskClient,
} from "@posthog/core/cloud-task/cloudTaskClient";
import {
CODE_REVIEW_WORKSPACE_CLIENT,
REVERT_HUNK_SERVICE,
Expand Down Expand Up @@ -35,7 +39,7 @@ import type { LocalMcpWorkspaceClient } from "@posthog/core/local-mcp/localMcpIm
import { PI_RUNNER } from "@posthog/core/pi-runtime/identifiers";
import { piRuntimeModule } from "@posthog/core/pi-runtime/pi-runtime.module";
import type { PiRunner } from "@posthog/core/pi-runtime/piRunner";
import { PI_SESSION_CLIENT } from "@posthog/core/pi-runtime/piSessionController";
import { LOCAL_PI_SESSION_FACTORY } from "@posthog/core/pi-runtime/piSessionController";
import {
CLOUD_ARTIFACT_BUNDLE_LOCAL_SKILL,
CLOUD_ARTIFACT_READ_FILE_AS_BASE64,
Expand Down Expand Up @@ -89,7 +93,9 @@ import {
import { WorkspaceSetupService } from "@posthog/core/workspace/WorkspaceSetupService";
import { setRootContainer } from "@posthog/di/container";
import { HOST_TRPC_CLIENT } from "@posthog/host-router/client";
import { TrpcPiSessionClient } from "@posthog/host-router/pi-session-client";
import { TrpcCloudTaskClient } from "@posthog/host-router/cloud-task-client";
import { TrpcPiRunner } from "@posthog/host-router/pi-runner";
import { TrpcPiSessionFactory } from "@posthog/host-router/pi-session-factory";
import {
BROWSER_TABS_CLIENT,
type BrowserTabsClient,
Expand Down Expand Up @@ -156,7 +162,6 @@ import { trpcClient } from "@renderer/trpc";
import { hostTrpcClient } from "@renderer/trpc/client";
import type { TRPCClient } from "@trpc/client";
import { hostLog, logger } from "@utils/logger";
import { TrpcPiRunner } from "../platform-adapters/trpc-pi-runner";
import type { RendererBindings } from "./bindings";
import { TASK_SERVICE as RENDERER_TASK_SERVICE, TRPC_CLIENT } from "./tokens";

Expand Down Expand Up @@ -297,7 +302,8 @@ container
// Bind services
container.bind<ITaskCreationHost>(TASK_CREATION_HOST).to(TrpcTaskCreationHost);
container.bind<PiRunner>(PI_RUNNER).to(TrpcPiRunner);
container.bind(PI_SESSION_CLIENT).to(TrpcPiSessionClient);
container.bind(LOCAL_PI_SESSION_FACTORY).to(TrpcPiSessionFactory);
container.bind<CloudTaskClient>(CLOUD_TASK_CLIENT).to(TrpcCloudTaskClient);
container.load(piRuntimeModule);
container.bind(TASK_CREATION_EFFECTS).toConstantValue(taskCreationEffects);
container.bind<TaskService>(RENDERER_TASK_SERVICE).to(TaskService);
Expand Down
25 changes: 20 additions & 5 deletions apps/web/src/web-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import { canvasCoreModule } from "@posthog/core/canvas/canvas.module";
import { taskThreadCoreModule } from "@posthog/core/canvas/taskThread.module";
import type { CloudTaskService } from "@posthog/core/cloud-task/cloud-task";
import { cloudTaskModule } from "@posthog/core/cloud-task/cloud-task.module";
import {
CLOUD_TASK_CLIENT,
type CloudTaskClient,
} from "@posthog/core/cloud-task/cloudTaskClient";
import {
CLOUD_TASK_AUTH,
CLOUD_TASK_SERVICE,
Expand Down Expand Up @@ -86,10 +90,14 @@ import {
type GithubConnectClient as OnboardingGithubConnectContract,
} from "@posthog/core/onboarding/identifiers";
import { onboardingModule } from "@posthog/core/onboarding/onboarding.module";
import { PI_RUNNER } from "@posthog/core/pi-runtime/identifiers";
import { piRuntimeModule } from "@posthog/core/pi-runtime/pi-runtime.module";
import type { PiRunner } from "@posthog/core/pi-runtime/piRunner";
import {
PI_SESSION_CLIENT,
type PiSessionClient,
LOCAL_PI_SESSION_FACTORY,
PI_SESSION_PROVIDER,
type PiSessionFactory,
type PiSessionProvider,
} from "@posthog/core/pi-runtime/piSessionController";
import {
type BundleLocalSkill,
Expand Down Expand Up @@ -161,7 +169,9 @@ import {
HOST_TRPC_CLIENT,
type HostTrpcClient,
} from "@posthog/host-router/client";
import { TrpcPiSessionClient } from "@posthog/host-router/pi-session-client";
import { TrpcCloudTaskClient } from "@posthog/host-router/cloud-task-client";
import { TrpcPiRunner } from "@posthog/host-router/pi-runner";
import { TrpcPiSessionFactory } from "@posthog/host-router/pi-session-factory";
import {
ANALYTICS_SERVICE,
type IAnalytics,
Expand Down Expand Up @@ -314,7 +324,10 @@ import { hostTrpcClient } from "./web-trpc";

interface WebBindings {
[HOST_TRPC_CLIENT]: HostTrpcClient;
[PI_SESSION_CLIENT]: PiSessionClient;
[PI_SESSION_PROVIDER]: PiSessionProvider;
[LOCAL_PI_SESSION_FACTORY]: PiSessionFactory;
[CLOUD_TASK_CLIENT]: CloudTaskClient;
[PI_RUNNER]: PiRunner;
[ROOT_LOGGER]: RootLogger;
[HOST_LOGGER]: HostLogger;
[FEATURE_FLAGS]: FeatureFlags;
Expand Down Expand Up @@ -395,7 +408,9 @@ export const container = new TypedContainer<WebBindings>({
// Keystone: the same typed host client the renderer binds — served in-process
// here (web-trpc.ts) instead of over Electron IPC.
container.bind(HOST_TRPC_CLIENT).toConstantValue(hostTrpcClient);
container.bind(PI_SESSION_CLIENT).to(TrpcPiSessionClient);
container.bind(LOCAL_PI_SESSION_FACTORY).to(TrpcPiSessionFactory);
container.bind(CLOUD_TASK_CLIENT).to(TrpcCloudTaskClient);
container.bind(PI_RUNNER).to(TrpcPiRunner);
container.load(piRuntimeModule);

// Logger: web uses console; electron uses electron-log. Same RootLogger shape.
Expand Down
17 changes: 17 additions & 0 deletions apps/web/src/web-host-router.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { fetchPosthogPiModelCatalog } from "@posthog/agent/pi/model-catalog";
import { getLlmGatewayUrl } from "@posthog/agent/posthog-api";
import type { AuthService } from "@posthog/core/auth/auth";
import { AUTH_SERVICE } from "@posthog/core/auth/auth.module";
import { TEAM_SKILLS_SERVICE } from "@posthog/core/skills/identifiers";
import type { TeamSkillsService } from "@posthog/core/skills/teamSkillsService";
import { resolveService } from "@posthog/di/container";
Expand Down Expand Up @@ -134,6 +138,19 @@ const agentStubRouter = router({
}),
// Called by resetSessionService() on logout/project switch.
resetAll: publicProcedure.mutation(() => undefined),
getPiModelCatalog: publicProcedure
.input(
z.object({ apiHost: z.string(), region: z.enum(["us", "eu", "dev"]) }),
)
.query(async ({ input }) => {
const auth = resolveService<AuthService>(AUTH_SERVICE);
const { accessToken } = await auth.getValidAccessToken();
return fetchPosthogPiModelCatalog(
getLlmGatewayUrl(input.apiHost),
input.region,
accessToken,
);
}),
// Model/mode/effort options for the task-input preview + cloud run creation
// (a cloud run requires a model). Real: fetched from the CORS-open PostHog LLM
// gateway, same logic the desktop main process runs (see web-agent-config.ts).
Expand Down
14 changes: 13 additions & 1 deletion packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
"types": "./dist/pi/rpc-client.d.ts",
"import": "./dist/pi/rpc-client.js"
},
"./pi/rpc-transport": {
"types": "./dist/pi/rpc-transport.d.ts",
"import": "./dist/pi/rpc-transport.js"
},
"./pi/remote-rpc-client": {
"types": "./dist/pi/remote-rpc-client.d.ts",
"import": "./dist/pi/remote-rpc-client.js"
},
"./pi/conversation": {
"types": "./dist/pi/conversation/translatePiConversation.d.ts",
"import": "./dist/pi/conversation/translatePiConversation.js"
Expand All @@ -44,6 +52,10 @@
"types": "./dist/pi/types.d.ts",
"import": "./dist/pi/types.js"
},
"./pi/model-catalog": {
"types": "./dist/pi/model-catalog.d.ts",
"import": "./dist/pi/model-catalog.js"
},
"./pr-url-detector": {
"types": "./dist/pr-url-detector.d.ts",
"import": "./dist/pr-url-detector.js"
Expand Down Expand Up @@ -114,7 +126,7 @@
}
},
"bin": {
"agent-server": "./dist/server/bin.cjs"
"agent-server": "./dist/server/bin.js"
},
"type": "module",
"keywords": [
Expand Down
Loading
Loading