refactor(provider-pi): move Pi into its own provider package (#17302)
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2c1160783e
commit
9b0df1358f
86 files changed
+475
-280
No files matched your search
@@ -69,6 +69,8 @@
|
||||
"@t3tools/mobile-markdown-text": "file:./modules/t3-markdown-text",
|
||||
"@t3tools/mobile-review-diff-native": "file:./modules/t3-review-diff",
|
||||
"@t3tools/mobile-terminal-native": "file:./modules/t3-terminal",
|
||||
"@t3tools/provider-core": "workspace:*",
|
||||
"@t3tools/provider-pi": "workspace:*",
|
||||
"@t3tools/shared": "workspace:*",
|
||||
"@tabler/icons-react-native": "^3.44.0",
|
||||
"clsx": "^2.1.1",
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useState } from "react";
|
||||
import { resolveOfficialAcpRegistryIconUrl } from "@t3tools/contracts";
|
||||
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
|
||||
import { AppText as Text } from "./AppText";
|
||||
import { getProviderClient } from "../lib/providerClients";
|
||||
|
||||
type ProviderIconProps = {
|
||||
readonly provider: string | null | undefined;
|
||||
@@ -131,16 +132,20 @@ export function ProviderIcon(props: ProviderIconProps) {
|
||||
);
|
||||
}
|
||||
|
||||
if (props.provider === "pi") {
|
||||
const foreground = isDarkMode ? "#F5F5F5" : "#0F0F0F";
|
||||
const packageIcon = getProviderClient(props.provider)?.icon;
|
||||
if (packageIcon) {
|
||||
const themeFill = (fill: { readonly light: string; readonly dark: string }) =>
|
||||
isDarkMode ? fill.dark : fill.light;
|
||||
return (
|
||||
<Svg width={size} height={size} viewBox="165.29 165.29 469.43 469.43" fill="none">
|
||||
<Path
|
||||
fill={foreground}
|
||||
fillRule="evenodd"
|
||||
d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"
|
||||
/>
|
||||
<Path fill={foreground} d="M517.36 400H634.72V634.72H517.36Z" />
|
||||
<Svg width={size} height={size} viewBox={packageIcon.viewBox} fill="none">
|
||||
{packageIcon.paths.map((path) => (
|
||||
<Path
|
||||
key={path.d}
|
||||
d={path.d}
|
||||
fillRule={path.fillRule}
|
||||
fill={themeFill(path.fill ?? packageIcon.fill)}
|
||||
/>
|
||||
))}
|
||||
</Svg>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { isProviderDriverKind } from "@t3tools/contracts";
|
||||
import { makeProviderClientRegistry } from "@t3tools/provider-core/client";
|
||||
import { piClient } from "@t3tools/provider-pi/client";
|
||||
|
||||
/** The provider client definitions this mobile build ships. */
|
||||
const providerClients = makeProviderClientRegistry([piClient]);
|
||||
|
||||
/** The client definition for a driver kind, or `undefined` for drivers drawn by hand. */
|
||||
export function getProviderClient(driver: string | null | undefined) {
|
||||
return isProviderDriverKind(driver) ? providerClients.get(driver) : undefined;
|
||||
}
|
||||
@@ -42,6 +42,7 @@
|
||||
"@opencode/protocol": "2.0.23",
|
||||
"@opencode/schema": "2.0.23",
|
||||
"@t3tools/provider-core": "workspace:*",
|
||||
"@t3tools/provider-pi": "workspace:*",
|
||||
"diff": "8.0.3",
|
||||
"effect": "catalog:",
|
||||
"jose": "catalog:",
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
import { ACP_PROTOCOL } from "../src/orchestration-v2/Adapters/AcpAdapterV2.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import type { ProviderAdapterV2SessionRuntime } from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import * as ProviderContinuationRequests from "../src/orchestration-v2/ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderAdapterRegistry from "../src/orchestration-v2/ProviderAdapterRegistry.ts";
|
||||
import { provideDeterministicTestRuntime } from "../src/orchestration-v2/testkit/DeterministicRuntime.ts";
|
||||
import { ORCHESTRATOR_REPLAY_FIXTURES } from "../src/orchestration-v2/testkit/fixtures/index.ts";
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
PiOrchestratorReplayHarness,
|
||||
} from "../src/orchestration-v2/Adapters/PiAdapterV2.testkit.ts";
|
||||
import * as PiAdapterV2Testkit from "../src/orchestration-v2/Adapters/PiAdapterV2.testkit.ts";
|
||||
import { PI_PROVIDER } from "../src/orchestration-v2/Adapters/PiAdapterV2.ts";
|
||||
import { PI_PROVIDER } from "@t3tools/provider-pi/server";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import { provideDeterministicTestRuntime } from "../src/orchestration-v2/testkit/DeterministicRuntime.ts";
|
||||
import { ORCHESTRATOR_REPLAY_FIXTURES } from "../src/orchestration-v2/testkit/fixtures/index.ts";
|
||||
|
||||
@@ -64,7 +64,7 @@ import {
|
||||
type ProviderAdapterV2TurnInput,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import * as ProviderAdapterRegistry from "../orchestration-v2/ProviderAdapterRegistry.ts";
|
||||
import * as ProviderContinuationRequests from "../orchestration-v2/ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { checkpointWorkspace } from "@t3tools/provider-testing/replayWorkspace";
|
||||
import * as ProviderReplayHarness from "../orchestration-v2/testkit/ProviderReplayHarness.ts";
|
||||
import {
|
||||
|
||||
@@ -71,7 +71,7 @@ import {
|
||||
type ProviderAdapterV2Event,
|
||||
type ProviderAdapterV2TurnInput,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import type { ProviderContinuationRequest } from "../ProviderContinuationRequests.ts";
|
||||
import type { ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import {
|
||||
AcpProviderCapabilitiesV2,
|
||||
acpProviderItemNativeId,
|
||||
|
||||
@@ -100,7 +100,7 @@ import {
|
||||
} from "@t3tools/provider-core/server/orchestrationInstructions";
|
||||
import { buildRuntimeInstructions } from "../../provider/RuntimeInstructions.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import { type ProviderContinuationRequest } from "../ProviderContinuationRequests.ts";
|
||||
import { type ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import {
|
||||
type BackgroundWork,
|
||||
type BackgroundWorkReport,
|
||||
|
||||
@@ -67,7 +67,7 @@ import {
|
||||
type ProviderAdapterV2Event,
|
||||
type ProviderAdapterV2TurnInput,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import type { ProviderContinuationRequest } from "../ProviderContinuationRequests.ts";
|
||||
import type { ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
|
||||
import * as ClaudeAdapterV2 from "./ClaudeAdapterV2.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
|
||||
@@ -132,7 +132,7 @@ import {
|
||||
type ProviderAdapterDriverCreateInput,
|
||||
} from "@t3tools/provider-core/server/adapterDriver";
|
||||
import { type BackgroundWorkReport, backgroundWorkNotification } from "../Notification.ts";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import {
|
||||
makeSubagentChildThread,
|
||||
makeSubagentConversationArtifacts,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as NodeOS from "node:os";
|
||||
|
||||
import { historyResponseItems } from "../ContextHandoffBudget.ts";
|
||||
import { historyResponseItems } from "@t3tools/provider-core/server/handoffBudget";
|
||||
import type { ProviderAdapterV2HistoricalContext } from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import {
|
||||
makeProviderTextDeltaCoalescer,
|
||||
@@ -70,7 +70,7 @@ import {
|
||||
type ProviderAdapterV2Event,
|
||||
type ProviderAdapterV2TurnInput,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import type { ProviderContinuationRequest } from "../ProviderContinuationRequests.ts";
|
||||
import type { ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as CodexAdapterV2 from "./CodexAdapterV2.ts";
|
||||
import { makeReplayServerConfig, withCodexReplayChildMetadata } from "./CodexAdapterV2.testkit.ts";
|
||||
import * as CodexAdapterV2Testkit from "./CodexAdapterV2.testkit.ts";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { revertCodexThread } from "../../provider/CodexThreadRevert.ts";
|
||||
import { historyResponseItems } from "../ContextHandoffBudget.ts";
|
||||
import { historyResponseItems } from "@t3tools/provider-core/server/handoffBudget";
|
||||
import { makeProviderTextDeltaCoalescer } from "./ProviderTextDeltaCoalescer.ts";
|
||||
import {
|
||||
mcpToolPresentation,
|
||||
@@ -125,7 +125,7 @@ import { IdAllocatorV2, type IdAllocatorV2Shape } from "@t3tools/provider-core/s
|
||||
import {
|
||||
type ProviderContinuationRequest,
|
||||
ProviderContinuationRequests,
|
||||
} from "../ProviderContinuationRequests.ts";
|
||||
} from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { backgroundWorkNotification } from "../Notification.ts";
|
||||
import {
|
||||
makeProviderFailure,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
} from "../../provider/acp/GrokAcpSupport.ts";
|
||||
import { makeXAiPromptCompletionRuntime } from "../../provider/acp/XAiAcpExtension.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
|
||||
import type { ProviderReplayGate } from "@t3tools/provider-testing/replayGate";
|
||||
import type { OrchestratorV2ProviderReplayHarness } from "../testkit/ProviderReplayHarness.ts";
|
||||
|
||||
@@ -58,7 +58,7 @@ import { acpPermissionDisposition } from "../../provider/acp/AcpClientPolicy.ts"
|
||||
import * as AcpSessionRuntime from "../../provider/acp/AcpSessionRuntime.ts";
|
||||
import * as ProviderEventLoggers from "../../provider/ProviderEventLoggers.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import {
|
||||
ProviderAdapterDriverCreateError,
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
type ProviderAdapterV2Event,
|
||||
type ProviderAdapterV2TurnInput,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import type { ProviderContinuationRequest } from "../ProviderContinuationRequests.ts";
|
||||
import type { ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { makeMuseAdapterV2, type MuseAdapterV2Options } from "./MuseAdapterV2.ts";
|
||||
|
||||
const testLayer = Layer.mergeAll(
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
} from "../../provider/museSdk.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import {
|
||||
makeReplayServerConfig,
|
||||
type OrchestratorV2ProviderReplayHarness,
|
||||
|
||||
@@ -96,7 +96,7 @@ import {
|
||||
type ProviderAdapterV2TurnMessage,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import { backgroundWorkNotification, type BackgroundWorkReport } from "../Notification.ts";
|
||||
import type * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import type * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
|
||||
import { turnScopedSelectionTransition } from "@t3tools/provider-core/server/selectionTransition";
|
||||
import { museItemStatus, museToolPresentation } from "./MuseItemPresentation.ts";
|
||||
|
||||
@@ -44,8 +44,8 @@ import type {
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import type { ProviderContinuationRequest } from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import type { ProviderContinuationRequest } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { OPENCODE_PROVIDER } from "./OpenCodeAdapterV2.ts";
|
||||
import { OPENCODE_2_STILL_STOPPING, t3McpServerName } from "./OpenCode2AdapterV2.ts";
|
||||
import { openCode2ReplayRuntime } from "./OpenCode2AdapterV2.testkit.ts";
|
||||
|
||||
@@ -88,7 +88,7 @@ import { causeErrorTag } from "@t3tools/shared/observability";
|
||||
import { providerMessageTextWithAttachmentPaths } from "../AttachmentPrompt.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import { backgroundWorkNotification, type BackgroundWorkReport } from "../Notification.ts";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
|
||||
import {
|
||||
makeSubagentChildThread,
|
||||
|
||||
@@ -35,7 +35,7 @@ import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import { ProviderAdapterDriverCreateError } from "@t3tools/provider-core/server/adapterDriver";
|
||||
import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
|
||||
import type { OrchestratorV2ProviderReplayHarness } from "../testkit/ProviderReplayHarness.ts";
|
||||
import { PI_PROVIDER, PiAdapterV2Driver } from "./PiAdapterV2.ts";
|
||||
import { PI_PROVIDER, PiAdapterV2Driver } from "@t3tools/provider-pi/server";
|
||||
|
||||
export const PI_RPC_REPLAY_PROTOCOL = "pi.rpc-jsonl";
|
||||
export const PI_REPLAY_ANY = "<any>";
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
historyResponseItems,
|
||||
selectHistory,
|
||||
historicalMessage,
|
||||
} from "./ContextHandoffBudget.ts";
|
||||
} from "@t3tools/provider-core/server/handoffBudget";
|
||||
import { projectContextHandoffForWire } from "./WireProjection.ts";
|
||||
import { deliverContextHandoffs } from "./ContextHandoffDelivery.ts";
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@ import type { ProviderAdapterV2HistoricalContext } from "@t3tools/provider-core/
|
||||
import { ContextHandoffBudgetError } from "@t3tools/provider-core/server/failure";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { historyCost, renderHistory, selectHistory } from "./ContextHandoffBudget.ts";
|
||||
import {
|
||||
historyCost,
|
||||
renderHistory,
|
||||
selectHistory,
|
||||
} from "@t3tools/provider-core/server/handoffBudget";
|
||||
|
||||
/**
|
||||
* Persist before/after injection: an ambiguous pending delivery requires a fresh native thread.
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
historicalMessage,
|
||||
renderHistory,
|
||||
selectHistory,
|
||||
} from "./ContextHandoffBudget.ts";
|
||||
} from "@t3tools/provider-core/server/handoffBudget";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
|
||||
export class ContextHandoffPrepareError extends Schema.TaggedError<ContextHandoffPrepareError>()(
|
||||
|
||||
@@ -67,7 +67,7 @@ import * as ProviderInstanceRegistry from "../provider/ProviderInstanceRegistry.
|
||||
import * as ProviderTurnStartServiceTestkit from "./ProviderTurnStartService.testkit.ts";
|
||||
import * as RuntimeLayer from "./runtimeLayer.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "./ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderContinuationService from "./ProviderContinuationService.ts";
|
||||
import * as ThreadManagementService from "./ThreadManagementService.ts";
|
||||
import * as McpSessionRegistry from "../mcp/McpSessionRegistry.ts";
|
||||
|
||||
@@ -109,7 +109,7 @@ import {
|
||||
} from "./ProjectionStore.ts";
|
||||
import type { ProviderAdapterV2Shape } from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import { ProviderAdapterRegistryV2 } from "./ProviderAdapterRegistry.ts";
|
||||
import { ProviderContinuationRequests } from "./ProviderContinuationRequests.ts";
|
||||
import { ProviderContinuationRequests } from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
|
||||
import * as RunExecutionService from "./RunExecutionService.ts";
|
||||
import { ProviderSessionManagerV2 } from "./ProviderSessionManager.ts";
|
||||
|
||||
@@ -19,7 +19,7 @@ import * as Semaphore from "effect/Semaphore";
|
||||
import * as TestClock from "effect/testing/TestClock";
|
||||
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "./ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderContinuationService from "./ProviderContinuationService.ts";
|
||||
import * as ThreadManagementService from "./ThreadManagementService.ts";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as Layer from "effect/Layer";
|
||||
import * as Ref from "effect/Ref";
|
||||
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "./ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ThreadManagementService from "./ThreadManagementService.ts";
|
||||
import { isUndeliveredMailboxSteer } from "./NotificationMailbox.ts";
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
contextUsageForHandoff,
|
||||
historicalMessage,
|
||||
latestNativeContextUsage,
|
||||
} from "./ContextHandoffBudget.ts";
|
||||
} from "@t3tools/provider-core/server/handoffBudget";
|
||||
import { deliverContextHandoffs } from "./ContextHandoffDelivery.ts";
|
||||
import {
|
||||
ProviderAdapterTurnStartError,
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
OpenCodeAdapterV2Driver,
|
||||
type OpenCodeAdapterV2DriverEnv,
|
||||
} from "./Adapters/OpenCodeAdapterV2.ts";
|
||||
import { PiAdapterV2Driver, type PiAdapterV2DriverEnv } from "./Adapters/PiAdapterV2.ts";
|
||||
import { PiAdapterV2Driver, type PiAdapterV2DriverEnv } from "@t3tools/provider-pi/server";
|
||||
import type { AnyProviderAdapterDriver } from "@t3tools/provider-core/server/adapterDriver";
|
||||
|
||||
export type BuiltInProviderAdapterDriversV2Env =
|
||||
|
||||
@@ -30,7 +30,7 @@ import * as ProjectionStore from "./ProjectionStore.ts";
|
||||
import * as ProjectionMaintenance from "./ProjectionMaintenance.ts";
|
||||
import * as ProjectStore from "./ProjectStore.ts";
|
||||
import * as ProviderAdapterRegistry from "./ProviderAdapterRegistry.ts";
|
||||
import * as ProviderContinuationRequests from "./ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderContinuationService from "./ProviderContinuationService.ts";
|
||||
import * as ThreadTitleRegenerationService from "./ThreadTitleRegenerationService.ts";
|
||||
import * as ProviderEventIngestor from "./ProviderEventIngestor.ts";
|
||||
|
||||
@@ -35,7 +35,7 @@ import * as ProjectionStore from "../ProjectionStore.ts";
|
||||
import * as ProjectStore from "../ProjectStore.ts";
|
||||
import * as ProviderAdapterRegistry from "../ProviderAdapterRegistry.ts";
|
||||
import * as ProviderAuthService from "../../provider/ProviderAuthService.ts";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as ProviderContinuationService from "../ProviderContinuationService.ts";
|
||||
import * as ProviderEventIngestor from "../ProviderEventIngestor.ts";
|
||||
import * as ProviderRuntimeRecoveryService from "../ProviderRuntimeRecoveryService.ts";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { vi } from "vite-plus/test";
|
||||
import { historyResponseItems } from "../ContextHandoffBudget.ts";
|
||||
import { historyResponseItems } from "@t3tools/provider-core/server/handoffBudget";
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import {
|
||||
CommandId,
|
||||
|
||||
@@ -19,7 +19,7 @@ import type * as EffectAcpErrors from "effect-acp/errors";
|
||||
import type * as EffectAcpSchema from "effect-acp/compat";
|
||||
|
||||
import type { AcpSessionRuntimeStartResult } from "./acp/AcpSessionRuntime.ts";
|
||||
import { makeManagedServerProvider } from "./makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import {
|
||||
makeManualOnlyProviderMaintenanceCapabilities,
|
||||
type ProviderMaintenanceCapabilities,
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from "../../orchestration-v2/Adapters/AcpRegistryAdapterV2.ts";
|
||||
import type { TextGeneration } from "../../textGeneration/TextGeneration.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
|
||||
import {
|
||||
defaultProviderContinuationIdentity,
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
import {
|
||||
type AcpRegistryAvailableCommands,
|
||||
type AcpRegistryConfigurationProbe,
|
||||
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
removeAntigravitySessionFiles,
|
||||
} from "../acp/AntigravitySessionFiles.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "../../orchestration-v2/ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { makeAntigravityAdapterV2 } from "../../orchestration-v2/Adapters/AntigravityAdapterV2.ts";
|
||||
import { makeAcpNativeLoggerFactory } from "../acp/AcpNativeLogging.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
probeClaudeCapabilities,
|
||||
probeClaudeWorkspaceSnapshot,
|
||||
} from "../ClaudeProvider.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import * as ModelManifest from "../ModelManifest.ts";
|
||||
import { resolveClaudeModelCatalog } from "../ClaudeModelCatalog.ts";
|
||||
import {
|
||||
@@ -63,7 +63,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
import {
|
||||
makeClaudeCapabilitiesCacheKey,
|
||||
makeClaudeContinuationGroupKey,
|
||||
|
||||
@@ -48,7 +48,7 @@ import {
|
||||
withCodexAppServerClient,
|
||||
} from "../CodexProvider.ts";
|
||||
import { resolveCodexLaunchArgs } from "../codexLaunchArgs.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import * as ModelManifest from "../ModelManifest.ts";
|
||||
import type { ProviderDriver, ProviderInstance } from "@t3tools/provider-core/server/driver";
|
||||
import { withInstanceIdentity } from "./instanceIdentity.ts";
|
||||
@@ -64,7 +64,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
import {
|
||||
codexContinuationIdentity,
|
||||
materializeCodexShadowHome,
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
makePendingCodexProvider,
|
||||
probeCodexSkillsForCwd,
|
||||
} from "../CodexProvider.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
|
||||
import {
|
||||
type ProviderDriverCreateInput,
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
checkCursorProviderStatus,
|
||||
} from "../CursorProvider.ts";
|
||||
import * as CursorSdkCatalog from "../CursorSdkCatalog.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import {
|
||||
defaultProviderContinuationIdentity,
|
||||
type ProviderDriver,
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
import { probeCursorSkills } from "./CursorSkills.ts";
|
||||
import { makeCursorAuth } from "../CursorAuth.ts";
|
||||
import * as CursorCredentialStore from "../CursorCredentialStore.ts";
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
enrichGrokSnapshot,
|
||||
} from "../GrokProvider.ts";
|
||||
import { readGrokAccount } from "../grokUsageLimits.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import {
|
||||
defaultProviderContinuationIdentity,
|
||||
type ProviderDriver,
|
||||
@@ -42,7 +42,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
const decodeGrokSettings = Schema.decodeSync(GrokSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("grok");
|
||||
|
||||
@@ -14,10 +14,10 @@ import { makeMuseTextGeneration } from "../../textGeneration/MuseTextGeneration.
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeMuseAdapterV2 } from "../../orchestration-v2/Adapters/MuseAdapterV2.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "../../orchestration-v2/ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import { checkMuseProviderStatus, makePendingMuseProvider } from "../MuseProvider.ts";
|
||||
import * as ProviderEventLoggers from "../ProviderEventLoggers.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import { enrichMuseSnapshot, latestMuseVersion, museMaintenance } from "../museMaintenance.ts";
|
||||
import { makeMuseEnvironment } from "../museSdk.ts";
|
||||
import {
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
import { withInstanceIdentity } from "./instanceIdentity.ts";
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("muse");
|
||||
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
openCodeSkillsToServerProviderSkills,
|
||||
openCodeCommandsToServerProviderSlashCommands,
|
||||
} from "../OpenCodeProvider.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import * as OpenCodeRuntime from "../opencodeRuntime.ts";
|
||||
import {
|
||||
makeOpenCodeRuntimeProbe,
|
||||
@@ -73,7 +73,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
const decodeOpenCodeSettings = Schema.decodeSync(OpenCodeSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("opencode");
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as ClaudeAdapterV2 from "../orchestration-v2/Adapters/ClaudeAdapterV2.t
|
||||
import * as CodexAdapterV2 from "../orchestration-v2/Adapters/CodexAdapterV2.ts";
|
||||
import * as CursorAgentSdk from "../orchestration-v2/Adapters/CursorAgentSdk.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderContinuationRequests from "../orchestration-v2/ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
|
||||
export type ProviderOrchestrationAdapterInfrastructure =
|
||||
| ClaudeAdapterV2.ClaudeAgentSdkQueryRunner
|
||||
|
||||
@@ -28,7 +28,7 @@ import { CursorDriver, type CursorDriverEnv } from "./Drivers/CursorDriver.ts";
|
||||
import { GrokDriver, type GrokDriverEnv } from "./Drivers/GrokDriver.ts";
|
||||
import { OpenCodeDriver, type OpenCodeDriverEnv } from "./Drivers/OpenCodeDriver.ts";
|
||||
import { MuseDriver, type MuseDriverEnv } from "./Drivers/MuseDriver.ts";
|
||||
import { PiDriver, type PiDriverEnv } from "./Drivers/PiDriver.ts";
|
||||
import { PiDriver, type PiDriverEnv } from "@t3tools/provider-pi/server";
|
||||
import type { AnyProviderDriver } from "@t3tools/provider-core/server/driver";
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"@t3tools/client-runtime": "workspace:*",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
"@t3tools/provider-core": "workspace:*",
|
||||
"@t3tools/provider-pi": "workspace:*",
|
||||
"@t3tools/shared": "workspace:*",
|
||||
"@tanstack/react-pacer": "^0.19.4",
|
||||
"@tanstack/react-router": "^1.160.2",
|
||||
|
||||
@@ -718,21 +718,6 @@ export const ACPRegistryIcon: Icon = ({ className, ...props }) => (
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const PiAgentIcon: Icon = ({ className, ...props }) => (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox="165.29 165.29 469.43 469.43"
|
||||
fill="none"
|
||||
className={cn("fill-[#0F0F0F] dark:fill-[#F5F5F5]", className)}
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"
|
||||
/>
|
||||
<path d="M517.36 400H634.72V634.72H517.36Z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
// Official two-color mark from https://forgejo.org/favicon.svg.
|
||||
export const ForgejoIcon: Icon = (props) => (
|
||||
<svg viewBox="0 0 212 212" aria-hidden="true" {...props}>
|
||||
|
||||
@@ -12,10 +12,11 @@ import {
|
||||
Icon,
|
||||
OpenAI,
|
||||
OpenCodeIcon,
|
||||
PiAgentIcon,
|
||||
} from "../Icons";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
import { providerClients } from "../settings/providerDriverMeta";
|
||||
import { ProviderPackageIcon } from "./ProviderPackageIcon";
|
||||
import {
|
||||
AcpRegistryAgentIcon,
|
||||
officialAcpRegistryIconUrlForAgentId,
|
||||
@@ -30,7 +31,6 @@ const PROVIDER_ICON_BY_PROVIDER: Partial<Record<ProviderDriverKind, Icon>> = {
|
||||
[ProviderDriverKind.make("grok")]: GrokIcon,
|
||||
[ProviderDriverKind.make("muse")]: MuseIcon,
|
||||
[ProviderDriverKind.make("antigravity")]: AntigravityIcon,
|
||||
[ProviderDriverKind.make("pi")]: PiAgentIcon,
|
||||
};
|
||||
|
||||
const PROVIDER_TEXT_COLOR_BY_PROVIDER: Partial<Record<ProviderDriverKind, string>> = {
|
||||
@@ -38,13 +38,24 @@ const PROVIDER_TEXT_COLOR_BY_PROVIDER: Partial<Record<ProviderDriverKind, string
|
||||
[ProviderDriverKind.make("claudeAgent")]: "text-[#d97757]",
|
||||
[ProviderDriverKind.make("cursor")]: "text-[#26251E] dark:text-[#EDECEC]",
|
||||
[ProviderDriverKind.make("grok")]: "text-[#0F0F0F] dark:text-[#F5F5F5]",
|
||||
[ProviderDriverKind.make("pi")]: "text-[#0F0F0F] dark:text-[#F5F5F5]",
|
||||
[ProviderDriverKind.make("opencode")]: "text-[#211E1E] dark:text-[#F1ECEC]",
|
||||
[ProviderDriverKind.make("antigravity")]: "text-[#5b87bf]",
|
||||
};
|
||||
|
||||
export function providerTextColorClassName(driverKind: ProviderDriverKind): string | undefined {
|
||||
return PROVIDER_TEXT_COLOR_BY_PROVIDER[driverKind];
|
||||
/** Brand text color for a provider label; package glyphs supply theirs as CSS variables. */
|
||||
export function providerTextColor(driverKind: ProviderDriverKind): {
|
||||
readonly className?: string;
|
||||
readonly style?: CSSProperties;
|
||||
} {
|
||||
const icon = providerClients.get(driverKind)?.icon;
|
||||
if (icon) {
|
||||
return {
|
||||
className: "text-(--icon-light) dark:text-(--icon-dark)",
|
||||
style: { "--icon-light": icon.fill.light, "--icon-dark": icon.fill.dark } as CSSProperties,
|
||||
};
|
||||
}
|
||||
const className = PROVIDER_TEXT_COLOR_BY_PROVIDER[driverKind];
|
||||
return className ? { className } : {};
|
||||
}
|
||||
|
||||
export function resolveProviderInstanceAcpRegistryIconUrl(input: {
|
||||
@@ -74,6 +85,7 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
|
||||
indicatorBackground?: string;
|
||||
}) {
|
||||
const Icon = PROVIDER_ICON_BY_PROVIDER[props.driverKind] ?? null;
|
||||
const packageIcon = providerClients.get(props.driverKind)?.icon;
|
||||
const indicatorBackground = props.indicatorBackground ?? "var(--card)";
|
||||
const accentStyle = props.accentColor
|
||||
? ({ "--provider-accent": props.accentColor } as CSSProperties)
|
||||
@@ -103,6 +115,12 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
|
||||
fallbackClassName="size-full"
|
||||
icon={acpRegistryIconUrl}
|
||||
/>
|
||||
) : packageIcon ? (
|
||||
<ProviderPackageIcon
|
||||
icon={packageIcon}
|
||||
className={cn("size-5 shrink-0", props.iconClassName)}
|
||||
aria-hidden
|
||||
/>
|
||||
) : Icon ? (
|
||||
<Icon className={cn("size-5 shrink-0", props.iconClassName)} aria-hidden />
|
||||
) : (
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import type { CSSProperties, SVGProps } from "react";
|
||||
|
||||
import type { ProviderIcon } from "@t3tools/provider-core/client";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
|
||||
/**
|
||||
* Draws a provider package's plain-data glyph. Theme colors travel as CSS
|
||||
* variables so the `.dark` class switches them without a re-render.
|
||||
*/
|
||||
export function ProviderPackageIcon({
|
||||
icon,
|
||||
className,
|
||||
...props
|
||||
}: { readonly icon: ProviderIcon } & SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox={icon.viewBox}
|
||||
fill="none"
|
||||
className={cn("fill-(--icon-light) dark:fill-(--icon-dark)", className)}
|
||||
style={
|
||||
{
|
||||
"--icon-light": icon.fill.light,
|
||||
"--icon-dark": icon.fill.dark,
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
{icon.paths.map((path) => (
|
||||
<path
|
||||
key={path.d}
|
||||
d={path.d}
|
||||
fillRule={path.fillRule}
|
||||
className={path.fill ? "fill-(--path-light) dark:fill-(--path-dark)" : undefined}
|
||||
style={
|
||||
path.fill
|
||||
? ({
|
||||
"--path-light": path.fill.light,
|
||||
"--path-dark": path.fill.dark,
|
||||
} as CSSProperties)
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";
|
||||
import { getProviderInstanceEntry } from "../../providerInstances";
|
||||
import { formatShortTimestamp } from "../../timestampFormat";
|
||||
import { getTriggerDisplayModelName } from "./providerIconUtils";
|
||||
import { ProviderInstanceIcon, providerTextColorClassName } from "./ProviderInstanceIcon";
|
||||
import { ProviderInstanceIcon, providerTextColor } from "./ProviderInstanceIcon";
|
||||
import { cn } from "~/lib/utils";
|
||||
import { TimelineSystemDivider } from "./TimelineSystemDivider";
|
||||
import { Button, InlineButton } from "../ui/button";
|
||||
@@ -587,6 +587,9 @@ function HandoffEndpoint(props: {
|
||||
: model !== undefined && model.length > 0
|
||||
? model
|
||||
: (entry?.displayName ?? props.instanceId);
|
||||
const labelColor = providerTextColor(
|
||||
entry?.driverKind ?? ProviderDriverKind.make(props.instanceId),
|
||||
);
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
@@ -603,12 +606,8 @@ function HandoffEndpoint(props: {
|
||||
iconClassName="size-3"
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
"truncate font-medium",
|
||||
providerTextColorClassName(
|
||||
entry?.driverKind ?? ProviderDriverKind.make(props.instanceId),
|
||||
),
|
||||
)}
|
||||
className={cn("truncate font-medium", labelColor.className)}
|
||||
style={labelColor.style}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
|
||||
@@ -6,11 +6,11 @@ import {
|
||||
CursorSettings,
|
||||
GrokSettings,
|
||||
OpenCodeSettings,
|
||||
PiSettings,
|
||||
MuseSettings,
|
||||
ProviderDriverKind,
|
||||
} from "@t3tools/contracts";
|
||||
import { makeProviderClientRegistry } from "@t3tools/provider-core/client";
|
||||
import { piClient } from "@t3tools/provider-pi/client";
|
||||
|
||||
/** The provider client definitions this web build ships, in presentation order. */
|
||||
export const providerClients = makeProviderClientRegistry([
|
||||
@@ -59,11 +59,7 @@ export const providerClients = makeProviderClientRegistry([
|
||||
settingsSchema: MuseSettings,
|
||||
badgeLabel: "Beta",
|
||||
},
|
||||
{
|
||||
driverKind: ProviderDriverKind.make("pi"),
|
||||
label: "Pi",
|
||||
settingsSchema: PiSettings,
|
||||
},
|
||||
piClient,
|
||||
{
|
||||
driverKind: ProviderDriverKind.make("acpRegistry"),
|
||||
label: "ACP Registry",
|
||||
|
||||
@@ -27,7 +27,7 @@ capabilities, never the driver kind.
|
||||
at runtime is a bug.
|
||||
- **Permission modes.** Offer only modes the provider enforces natively, through
|
||||
`supportedRuntimeModes` in the provider presentation ([Grok](../../apps/server/src/provider/GrokProvider.ts)
|
||||
and [Pi](../../apps/server/src/provider/PiProvider.ts) are examples). Do not imitate a missing
|
||||
and [Pi](../../packages/provider-pi/src/server/status.ts) are examples). Do not imitate a missing
|
||||
mode by answering approvals in T3: T3's check is weaker than the agent's own enforcement. The
|
||||
server runs an unoffered stored mode as Supervised
|
||||
([`RuntimePolicy.ts`](../../apps/server/src/orchestration-v2/RuntimePolicy.ts)).
|
||||
@@ -86,7 +86,7 @@ produce catches them.
|
||||
sending.
|
||||
- **Work the provider starts on its own.** Background commands, subagents, workflows, and goals can
|
||||
finish or start a turn after T3's turn settled. Offer a continuation through
|
||||
[`ProviderContinuationRequests`](../../apps/server/src/orchestration-v2/ProviderContinuationRequests.ts)
|
||||
[`ProviderContinuationRequests`](../../packages/provider-core/src/server/continuationRequests.ts)
|
||||
so the parent wakes, and report `hasPendingBackgroundWork` so the session is not released as
|
||||
idle. Dropping it, or killing the session, loses the result.
|
||||
- **Subagents outlive the run that launched them.** A child can report after its parent's turn
|
||||
@@ -103,16 +103,26 @@ produce catches them.
|
||||
|
||||
## Where a driver plugs in
|
||||
|
||||
- **Contracts:** settings schema, default model, and display name in
|
||||
[`packages/contracts`](../../packages/contracts/src). Instances store that config in
|
||||
`providerInstances`. New providers are off by default.
|
||||
- **Server:** the driver in [`provider/Drivers`](../../apps/server/src/provider/Drivers) and its entry
|
||||
in [`builtInDrivers.ts`](../../apps/server/src/provider/builtInDrivers.ts). Also its position in
|
||||
the [status order](../../apps/server/src/provider/providerStatusCache.ts), a compatibility policy
|
||||
in [`model-manifest.json`](../../apps/server/src/provider/model-manifest.json) (bump `updatedAt`;
|
||||
see [model manifest](./model-manifest.md)), and text generation for titles and commit messages.
|
||||
- **Clients:** web settings metadata and badge, provider icons on web and mobile, and settings
|
||||
search terms.
|
||||
A provider lives in its own `packages/provider-<name>` package, with
|
||||
[Pi](../../packages/provider-pi) as the reference. Drivers not moved yet still live in
|
||||
[`provider/Drivers`](../../apps/server/src/provider/Drivers).
|
||||
|
||||
- **Package exports.** `./settings` holds the instance settings schema, built with
|
||||
`makeProviderSettingsSchema` from contracts. `./client` exports a `ProviderClientDefinition`
|
||||
(label, settings schema, plain-data icon, badge) and must stay browser- and React Native-safe.
|
||||
`./server` exports the `ProviderDriver` and its adapter driver. Settings live in
|
||||
`providerInstances`; new providers are off by default.
|
||||
- **Package boundaries.** Server code imports only `@t3tools/provider-core/server/*`, contracts,
|
||||
and shared. It reaches the server through `ProviderHost` (paths, settings, background demand,
|
||||
attachments), never through `apps/server`. Tests use `@t3tools/provider-testing`.
|
||||
- **Server registration:** the driver's entry in
|
||||
[`builtInDrivers.ts`](../../apps/server/src/provider/builtInDrivers.ts) and the adapter driver's in
|
||||
[`builtInProviderAdapterDrivers.ts`](../../apps/server/src/orchestration-v2/builtInProviderAdapterDrivers.ts).
|
||||
Also its position in the [status order](../../apps/server/src/provider/providerStatusCache.ts), a
|
||||
compatibility policy in [`model-manifest.json`](../../apps/server/src/provider/model-manifest.json)
|
||||
(bump `updatedAt`; see [model manifest](./model-manifest.md)), and its default model in contracts.
|
||||
- **Client registration:** the client definition in the web and mobile provider registries, and
|
||||
settings search terms. Clients draw the package icon; do not add a per-driver icon branch.
|
||||
- **Docs:** a `docs/user/providers-<name>.md` guide in the product's voice, a row in the
|
||||
[install](../user/install.md#providers) table, and any provider difference that changes the
|
||||
[permission modes](../user/permission-modes.md) page.
|
||||
@@ -34,7 +34,7 @@ trust discovery. T3 injects only its namespaced MCP bridge, so a Pi session beha
|
||||
the Pi TUI. Pi session files back native resume, rollback, and same-instance thread forks.
|
||||
Forks use Pi's CLI in the destination directory because RPC session switching retains the source
|
||||
session's cwd. Provider switches still use portable handoff summaries.
|
||||
See the [adapter](../../apps/server/src/orchestration-v2/Adapters/PiAdapterV2.ts).
|
||||
See the [adapter](../../packages/provider-pi/src/server/adapter.ts).
|
||||
|
||||
Antigravity separates account profiles per instance while sharing installed executables across the
|
||||
environment. It forces file-based credential storage because the native macOS keychain entry would
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
"tc": "vp run -r --concurrency-limit 2 typecheck",
|
||||
"lint": "vp lint --report-unused-disable-directives",
|
||||
"knip": "knip --preprocessor ./scripts/knip-schemas.ts",
|
||||
"knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-testing --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
|
||||
"knip:check": "knip --include files,dependencies --no-config-hints && knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-testing --workspace packages/provider-pi --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
|
||||
"knip:production": "knip --production --preprocessor ./scripts/knip-schemas.ts",
|
||||
"lint:mobile": "node scripts/mobile-native-static-check.ts",
|
||||
"test": "vp run -r test",
|
||||
|
||||
@@ -525,7 +525,8 @@ export const UsageModelPriceOverride = Schema.Struct({
|
||||
});
|
||||
export type UsageModelPriceOverride = typeof UsageModelPriceOverride.Type;
|
||||
|
||||
const makeBinaryPathSetting = (fallback: string) =>
|
||||
/** A binary path setting that decodes empty input to the provider's default executable. */
|
||||
export const makeBinaryPathSetting = (fallback: string) =>
|
||||
TrimmedString.pipe(
|
||||
Schema.decodeTo(
|
||||
Schema.String,
|
||||
@@ -571,7 +572,8 @@ export type ProviderSettingsOrder<Fields extends Schema.Struct.Fields> = readonl
|
||||
string
|
||||
>[];
|
||||
|
||||
function makeProviderSettingsSchema<const Fields extends Schema.Struct.Fields>(
|
||||
/** A provider settings struct whose fields the settings form renders in `order`. */
|
||||
export function makeProviderSettingsSchema<const Fields extends Schema.Struct.Fields>(
|
||||
fields: Fields,
|
||||
options?: {
|
||||
readonly order?: ProviderSettingsOrder<Fields> | undefined;
|
||||
@@ -861,39 +863,6 @@ export const MuseSettings = makeProviderSettingsSchema(
|
||||
);
|
||||
export type MuseSettings = typeof MuseSettings.Type;
|
||||
|
||||
export const PiSettings = makeProviderSettingsSchema(
|
||||
{
|
||||
// Off by default like Cursor and Grok. Users opt in from Settings.
|
||||
enabled: Schema.Boolean.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(false)),
|
||||
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
||||
),
|
||||
binaryPath: makeBinaryPathSetting("pi").pipe(
|
||||
Schema.annotateKey({
|
||||
title: "Binary path",
|
||||
description: "Path to the Pi coding agent binary.",
|
||||
providerSettingsForm: { placeholder: "pi", clearWhenEmpty: "omit" },
|
||||
}),
|
||||
),
|
||||
launchArgs: TrimmedString.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed("")),
|
||||
Schema.annotateKey({
|
||||
title: "Launch arguments",
|
||||
description: "Additional CLI arguments passed to pi --mode rpc on session start.",
|
||||
providerSettingsForm: { clearWhenEmpty: "omit" },
|
||||
}),
|
||||
),
|
||||
customModels: Schema.Array(CustomModelSetting).pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed([])),
|
||||
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
||||
),
|
||||
},
|
||||
{
|
||||
order: ["binaryPath", "launchArgs"],
|
||||
},
|
||||
);
|
||||
export type PiSettings = typeof PiSettings.Type;
|
||||
|
||||
export const AcpRegistryDistributionPreference = Schema.Literals(["auto", "binary", "npx", "uvx"]);
|
||||
export type AcpRegistryDistributionPreference = typeof AcpRegistryDistributionPreference.Type;
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
"types": "./src/server/collectStreamText.ts",
|
||||
"import": "./src/server/collectStreamText.ts"
|
||||
},
|
||||
"./server/continuationRequests": {
|
||||
"types": "./src/server/continuationRequests.ts",
|
||||
"import": "./src/server/continuationRequests.ts"
|
||||
},
|
||||
"./server/driver": {
|
||||
"types": "./src/server/driver.ts",
|
||||
"import": "./src/server/driver.ts"
|
||||
@@ -31,6 +35,10 @@
|
||||
"types": "./src/server/failure.ts",
|
||||
"import": "./src/server/failure.ts"
|
||||
},
|
||||
"./server/handoffBudget": {
|
||||
"types": "./src/server/handoffBudget.ts",
|
||||
"import": "./src/server/handoffBudget.ts"
|
||||
},
|
||||
"./server/IdAllocator": {
|
||||
"types": "./src/server/IdAllocator.ts",
|
||||
"import": "./src/server/IdAllocator.ts"
|
||||
@@ -47,6 +55,10 @@
|
||||
"types": "./src/server/maintenanceResolver.ts",
|
||||
"import": "./src/server/maintenanceResolver.ts"
|
||||
},
|
||||
"./server/managedProvider": {
|
||||
"types": "./src/server/managedProvider.ts",
|
||||
"import": "./src/server/managedProvider.ts"
|
||||
},
|
||||
"./server/mcpSession": {
|
||||
"types": "./src/server/mcpSession.ts",
|
||||
"import": "./src/server/mcpSession.ts"
|
||||
@@ -91,6 +103,10 @@
|
||||
"types": "./src/server/snapshotProbe.ts",
|
||||
"import": "./src/server/snapshotProbe.ts"
|
||||
},
|
||||
"./server/snapshotSettings": {
|
||||
"types": "./src/server/snapshotSettings.ts",
|
||||
"import": "./src/server/snapshotSettings.ts"
|
||||
},
|
||||
"./server/textGeneration": {
|
||||
"types": "./src/server/textGeneration.ts",
|
||||
"import": "./src/server/textGeneration.ts"
|
||||
|
||||
@@ -31,9 +31,26 @@ export interface ProviderEnvironmentField {
|
||||
readonly sensitive?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A provider glyph as plain data, so web and mobile can each draw it with
|
||||
* their own SVG renderer. Colors are per theme; a path without a fill uses
|
||||
* the icon's `fill`.
|
||||
*/
|
||||
export interface ProviderIcon {
|
||||
readonly viewBox: string;
|
||||
readonly fill: { readonly light: string; readonly dark: string };
|
||||
readonly paths: ReadonlyArray<{
|
||||
readonly d: string;
|
||||
readonly fillRule?: "evenodd" | "nonzero";
|
||||
readonly fill?: { readonly light: string; readonly dark: string };
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface ProviderClientDefinition {
|
||||
readonly driverKind: ProviderDriverKind;
|
||||
readonly label: string;
|
||||
/** Omitted for drivers whose glyph a client still draws itself. */
|
||||
readonly icon?: ProviderIcon;
|
||||
readonly settingsSchema: ProviderSettingsSchema;
|
||||
readonly environmentFields?: ReadonlyArray<ProviderEnvironmentField>;
|
||||
/** Whether the driver has a default instance backed by legacy `providers.<kind>` settings. */
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ export interface ProviderContinuationRequest {
|
||||
export class ProviderContinuationRequests extends Context.Reference<{
|
||||
readonly offer: (request: ProviderContinuationRequest) => Effect.Effect<void>;
|
||||
readonly take: Effect.Effect<ProviderContinuationRequest>;
|
||||
}>("t3/orchestration-v2/ProviderContinuationRequests", {
|
||||
}>("@t3tools/provider-core/server/continuationRequests/ProviderContinuationRequests", {
|
||||
defaultValue: () => ({ offer: () => Effect.void, take: Effect.never }),
|
||||
}) {}
|
||||
|
||||
File renamed without changes.
+32
-73
@@ -1,4 +1,3 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { describe, it, assert } from "@effect/vitest";
|
||||
import {
|
||||
DEFAULT_SERVER_SETTINGS,
|
||||
@@ -7,7 +6,6 @@ import {
|
||||
type ServerProvider,
|
||||
} from "@t3tools/contracts";
|
||||
import { createModelCapabilities } from "@t3tools/shared/model";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Deferred from "effect/Deferred";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
@@ -18,14 +16,10 @@ import * as Ref from "effect/Ref";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { TestClock } from "effect/testing";
|
||||
|
||||
import * as BackgroundPolicy from "../background/BackgroundPolicy.ts";
|
||||
import * as ServerConfig from "../config.ts";
|
||||
import * as ServerSettings from "../serverSettings.ts";
|
||||
import { makeManagedServerProvider } from "./makeManagedServerProvider.ts";
|
||||
import * as ProviderHostLive from "./ProviderHostLive.ts";
|
||||
import { ProviderHost, type ProviderHostShape } from "./ProviderHost.ts";
|
||||
import { makeManagedServerProvider } from "./managedProvider.ts";
|
||||
|
||||
const emptyCapabilities = createModelCapabilities({ optionDescriptors: [] });
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
const fastModeCapabilities = createModelCapabilities({
|
||||
optionDescriptors: [
|
||||
{
|
||||
@@ -102,60 +96,33 @@ const refreshedSnapshotSecond: ServerProvider = {
|
||||
message: "Refreshed provider availability again.",
|
||||
};
|
||||
|
||||
function layerBackgroundPolicy(shouldRunScopeWork: boolean) {
|
||||
return Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
reportClientActivity: () => Effect.void,
|
||||
removeRpcClient: () => Effect.void,
|
||||
reportHostPowerState: () => Effect.void,
|
||||
snapshot: Effect.succeed({
|
||||
hostPower: {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
/** A host whose settings never change and whose background demand is fixed. */
|
||||
function layerProviderHost(input: {
|
||||
readonly runBackgroundWork: boolean;
|
||||
readonly settings?: Pick<ProviderHostShape, "settings">["settings"];
|
||||
}) {
|
||||
return Layer.succeed(
|
||||
ProviderHost,
|
||||
ProviderHost.of({
|
||||
paths: {
|
||||
cwd: process.cwd(),
|
||||
baseDir: "/t3",
|
||||
stateDir: "/t3/userdata",
|
||||
providerStatusCacheDir: "/t3/caches",
|
||||
},
|
||||
leases: [],
|
||||
activeForegroundLeaseCount: 0,
|
||||
activeScopeKeys: [],
|
||||
shouldRunOpportunisticWork: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
settings: input.settings ?? {
|
||||
get: Effect.succeed(DEFAULT_SERVER_SETTINGS),
|
||||
changes: Stream.empty,
|
||||
subscribe: Effect.succeed(Stream.empty),
|
||||
},
|
||||
shouldRunBackgroundWork: () => Effect.succeed(input.runBackgroundWork),
|
||||
resolveAttachmentPath: () => null,
|
||||
}),
|
||||
streamChanges: Stream.empty,
|
||||
hasDemand: () => Effect.succeed(shouldRunScopeWork),
|
||||
shouldRunScopeWork: () => Effect.succeed(shouldRunScopeWork),
|
||||
shouldRunOpportunisticWork: Effect.succeed(shouldRunScopeWork),
|
||||
});
|
||||
}
|
||||
|
||||
const layerBackgroundPolicyAlwaysRun = layerBackgroundPolicy(true);
|
||||
const layerBackgroundPolicyNeverRun = layerBackgroundPolicy(false);
|
||||
const layerServerSettingsTest = ServerSettings.layerTest();
|
||||
const layerServerConfigTest = ServerConfig.layerTest(process.cwd(), {
|
||||
prefix: "t3-managed-provider-test-",
|
||||
}).pipe(Layer.provide(NodeServices.layer));
|
||||
|
||||
function layerProviderHost<BE, BR, SE, SR>(
|
||||
layerBackground: Layer.Layer<BackgroundPolicy.BackgroundPolicy, BE, BR>,
|
||||
layerSettings: Layer.Layer<ServerSettings.ServerSettingsService, SE, SR>,
|
||||
) {
|
||||
return ProviderHostLive.layer.pipe(
|
||||
Layer.provideMerge(layerBackground),
|
||||
Layer.provideMerge(layerSettings),
|
||||
Layer.provide(layerServerConfigTest),
|
||||
);
|
||||
}
|
||||
|
||||
const layerAlwaysRunTest = layerProviderHost(
|
||||
layerBackgroundPolicyAlwaysRun,
|
||||
layerServerSettingsTest,
|
||||
);
|
||||
const layerNeverRunTest = layerProviderHost(layerBackgroundPolicyNeverRun, layerServerSettingsTest);
|
||||
const layerAlwaysRunTest = layerProviderHost({ runBackgroundWork: true });
|
||||
const layerNeverRunTest = layerProviderHost({ runBackgroundWork: false });
|
||||
|
||||
const enrichedSnapshotSecond: ServerProvider = {
|
||||
...refreshedSnapshotSecond,
|
||||
@@ -314,21 +281,13 @@ describe("makeManagedServerProvider", () => {
|
||||
};
|
||||
const serverSettingsRef = yield* Ref.make(initialServerSettings);
|
||||
const serverSettingsChanges = yield* PubSub.unbounded<typeof initialServerSettings>();
|
||||
const layerServerSettings = Layer.succeed(
|
||||
ServerSettings.ServerSettingsService,
|
||||
ServerSettings.ServerSettingsService.of({
|
||||
start: Effect.void,
|
||||
ready: Effect.void,
|
||||
getSettings: Ref.get(serverSettingsRef),
|
||||
updateSettings: () => Effect.die(new Error("unused in this test")),
|
||||
updateProviderInstance: () => Effect.die(new Error("unused in this test")),
|
||||
withSettingsSnapshot: (use) => Ref.get(serverSettingsRef).pipe(Effect.flatMap(use)),
|
||||
streamChanges: Stream.empty,
|
||||
subscribeChanges: PubSub.subscribe(serverSettingsChanges).pipe(
|
||||
Effect.map((subscription) => Stream.fromSubscription(subscription)),
|
||||
),
|
||||
}),
|
||||
);
|
||||
const hostSettings: ProviderHostShape["settings"] = {
|
||||
get: Ref.get(serverSettingsRef),
|
||||
changes: Stream.empty,
|
||||
subscribe: PubSub.subscribe(serverSettingsChanges).pipe(
|
||||
Effect.map((subscription) => Stream.fromSubscription(subscription)),
|
||||
),
|
||||
};
|
||||
const checkCalls = yield* Ref.make(0);
|
||||
const initialCheckDone = yield* Deferred.make<void>();
|
||||
const periodicCheckDone = yield* Deferred.make<void>();
|
||||
@@ -348,7 +307,7 @@ describe("makeManagedServerProvider", () => {
|
||||
Effect.as(refreshedSnapshot),
|
||||
),
|
||||
}).pipe(
|
||||
Effect.provide(layerProviderHost(layerBackgroundPolicyAlwaysRun, layerServerSettings)),
|
||||
Effect.provide(layerProviderHost({ runBackgroundWork: true, settings: hostSettings })),
|
||||
);
|
||||
|
||||
yield* Deferred.await(initialCheckDone);
|
||||
+3
-6
@@ -15,12 +15,9 @@ import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
|
||||
import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
|
||||
import {
|
||||
applyUsageLimitsUpdate,
|
||||
resolveUsageLimitsAfterProbe,
|
||||
} from "@t3tools/provider-core/server/usageLimits";
|
||||
import type { ServerProviderShape } from "@t3tools/provider-core/server/snapshot";
|
||||
import { ProviderHost } from "./ProviderHost.ts";
|
||||
import { applyUsageLimitsUpdate, resolveUsageLimitsAfterProbe } from "./usageLimits.ts";
|
||||
import type { ServerProviderShape } from "./snapshot.ts";
|
||||
|
||||
interface ProviderSnapshotState {
|
||||
readonly snapshot: ServerProvider;
|
||||
+1
-1
@@ -3,7 +3,7 @@ import * as Effect from "effect/Effect";
|
||||
import * as Equal from "effect/Equal";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
import type { ProviderHostShape } from "@t3tools/provider-core/server/ProviderHost";
|
||||
import type { ProviderHostShape } from "./ProviderHost.ts";
|
||||
|
||||
export interface ProviderSnapshotSettings<Settings> {
|
||||
readonly provider: Settings;
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@t3tools/provider-pi",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./client": {
|
||||
"types": "./src/client.ts",
|
||||
"import": "./src/client.ts"
|
||||
},
|
||||
"./settings": {
|
||||
"types": "./src/settings.ts",
|
||||
"import": "./src/settings.ts"
|
||||
},
|
||||
"./server": {
|
||||
"types": "./src/server.ts",
|
||||
"import": "./src/server.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vp test run --config ../../vite.config.ts --dir ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
"@t3tools/provider-core": "workspace:*",
|
||||
"@t3tools/shared": "workspace:*",
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@t3tools/provider-testing": "workspace:*",
|
||||
"@types/node": "catalog:",
|
||||
"vite-plus": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Pi's client definition: settings form, label, and glyph. Browser- and
|
||||
* React Native-safe.
|
||||
*
|
||||
* @module provider-pi/client
|
||||
*/
|
||||
import { ProviderDriverKind } from "@t3tools/contracts";
|
||||
import { defineProviderClient } from "@t3tools/provider-core/client";
|
||||
|
||||
import { PiSettings } from "./settings.ts";
|
||||
|
||||
export const piClient = defineProviderClient({
|
||||
driverKind: ProviderDriverKind.make("pi"),
|
||||
label: "Pi",
|
||||
settingsSchema: PiSettings,
|
||||
icon: {
|
||||
viewBox: "165.29 165.29 469.43 469.43",
|
||||
fill: { light: "#0F0F0F", dark: "#F5F5F5" },
|
||||
paths: [
|
||||
{
|
||||
d: "M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z",
|
||||
fillRule: "evenodd",
|
||||
},
|
||||
{ d: "M517.36 400H634.72V634.72H517.36Z" },
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Pi's server entry: the driver the server registers, plus the adapter
|
||||
* driver used by replay tests and the fixture recorder.
|
||||
*
|
||||
* @module provider-pi/server
|
||||
*/
|
||||
export { PiDriver, type PiDriverEnv } from "./server/driver.ts";
|
||||
export { PI_PROVIDER, PiAdapterV2Driver, type PiAdapterV2DriverEnv } from "./server/adapter.ts";
|
||||
+4
-4
@@ -35,7 +35,7 @@ import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
|
||||
|
||||
import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
|
||||
import { layerTestProviderHost } from "@t3tools/provider-testing/host";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import * as McpProviderSession from "@t3tools/provider-core/server/mcpSession";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import {
|
||||
@@ -43,14 +43,14 @@ import {
|
||||
type ProviderAdapterV2Event,
|
||||
type ProviderAdapterV2SessionRuntime,
|
||||
} from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import { handoffBudget } from "../ContextHandoffBudget.ts";
|
||||
import { handoffBudget } from "@t3tools/provider-core/server/handoffBudget";
|
||||
import {
|
||||
makePiAdapterV2,
|
||||
PiAdapterV2Driver,
|
||||
PI_PROVIDER,
|
||||
type PiAdapterV2Options,
|
||||
} from "./PiAdapterV2.ts";
|
||||
import { makePiRpcConnection, type PiRpcRecord } from "./PiRpc.ts";
|
||||
} from "./adapter.ts";
|
||||
import { makePiRpcConnection, type PiRpcRecord } from "./rpc.ts";
|
||||
|
||||
const layerTest = Layer.mergeAll(
|
||||
NodeServices.layer,
|
||||
+6
-6
@@ -27,7 +27,6 @@ import { HostProcessEnvironment } from "@t3tools/shared/hostProcess";
|
||||
import { getModelSelectionStringOptionValue } from "@t3tools/shared/model";
|
||||
import {
|
||||
defaultInstanceIdForDriver,
|
||||
PiSettings,
|
||||
ProviderDriverKind,
|
||||
type ChatAttachment,
|
||||
type ModelSelection,
|
||||
@@ -46,6 +45,7 @@ import {
|
||||
type ProviderInstanceId,
|
||||
type OrchestrationV2ProviderTurnTokenUsage,
|
||||
} from "@t3tools/contracts";
|
||||
import { PiSettings } from "../settings.ts";
|
||||
import * as Cause from "effect/Cause";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Deferred from "effect/Deferred";
|
||||
@@ -68,11 +68,11 @@ import {
|
||||
parsePiCompactCommand,
|
||||
parsePiDiscoveredCommands,
|
||||
type PiCompactCommand,
|
||||
} from "../../provider/PiCommands.ts";
|
||||
} from "./commands.ts";
|
||||
import { mergeProviderInstanceEnvironment } from "@t3tools/provider-core/server/instanceEnvironment";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
|
||||
import * as ProviderContinuationRequests from "../ProviderContinuationRequests.ts";
|
||||
import * as ProviderContinuationRequests from "@t3tools/provider-core/server/continuationRequests";
|
||||
import {
|
||||
ProviderAdapterDriverCreateError,
|
||||
type ProviderAdapterDriver,
|
||||
@@ -91,13 +91,13 @@ import {
|
||||
piRecordString as recordString,
|
||||
type PiRpcConnection,
|
||||
type PiRpcRecord,
|
||||
} from "./PiRpc.ts";
|
||||
} from "./rpc.ts";
|
||||
import {
|
||||
buildPiRpcLaunch,
|
||||
materializePiT3McpExtension,
|
||||
resolvePiLaunchArgs,
|
||||
} from "./piT3McpInjection.ts";
|
||||
import { PI_FILE_CHANGE_TOOLS } from "./piT3McpExtensionSource.ts";
|
||||
} from "./mcpInjection.ts";
|
||||
import { PI_FILE_CHANGE_TOOLS } from "./mcpExtensionSource.ts";
|
||||
|
||||
export const PI_PROVIDER = ProviderDriverKind.make("pi");
|
||||
const PI_DRIVER_KIND = PI_PROVIDER;
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
parsePiDiscoveredCommands,
|
||||
PI_COMPACT_SLASH_COMMAND,
|
||||
withPiBuiltinSlashCommands,
|
||||
} from "./PiCommands.ts";
|
||||
} from "./commands.ts";
|
||||
|
||||
it("maps current Pi skill metadata to T3's user and project skill scopes", () => {
|
||||
expect(
|
||||
File renamed without changes.
+10
-14
@@ -1,6 +1,6 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { ProviderInstanceId, type PiSettings } from "@t3tools/contracts";
|
||||
import { DEFAULT_SERVER_SETTINGS, ProviderInstanceId } from "@t3tools/contracts";
|
||||
import * as Deferred from "effect/Deferred";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Fiber from "effect/Fiber";
|
||||
@@ -13,28 +13,24 @@ import * as TestClock from "effect/testing/TestClock";
|
||||
import { HttpClient } from "effect/http";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
||||
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import * as ServerConfig from "../../config.ts";
|
||||
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
|
||||
import * as ServerSettings from "../../serverSettings.ts";
|
||||
import * as ProviderHostLive from "../ProviderHostLive.ts";
|
||||
import { PiDriver } from "./PiDriver.ts";
|
||||
import { layerTestProviderHost } from "@t3tools/provider-testing/host";
|
||||
import type { PiSettings } from "../settings.ts";
|
||||
import { PiDriver } from "./driver.ts";
|
||||
|
||||
const layerDeps = Layer.mergeAll(
|
||||
ServerConfig.layerTest("/machine", { prefix: "t3-pi-driver-" }),
|
||||
IdAllocator.layer,
|
||||
ServerSettings.layerTest({ enableProviderUpdateChecks: false }),
|
||||
Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
shouldRunScopeWork: () => Effect.succeed(false),
|
||||
const layerTest = Layer.mergeAll(
|
||||
layerTestProviderHost({
|
||||
cwd: "/machine",
|
||||
settings: { ...DEFAULT_SERVER_SETTINGS, enableProviderUpdateChecks: false },
|
||||
runBackgroundWork: false,
|
||||
}),
|
||||
IdAllocator.layer,
|
||||
Layer.succeed(
|
||||
HttpClient.HttpClient,
|
||||
HttpClient.make(() => Effect.die("Unexpected HTTP")),
|
||||
),
|
||||
).pipe(Layer.provideMerge(NodeServices.layer));
|
||||
|
||||
const layerTest = ProviderHostLive.layer.pipe(Layer.provideMerge(layerDeps));
|
||||
|
||||
const decodeRequest = Schema.decodeSync(
|
||||
Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown)),
|
||||
);
|
||||
+8
-10
@@ -6,7 +6,8 @@
|
||||
* Pi state (sessions, settings, extensions, auth) lives in the user's own
|
||||
* `~/.pi/agent`, so continuation identity uses the default instance grouping.
|
||||
*/
|
||||
import { PiSettings, ProviderDriverKind, type ServerProvider } from "@t3tools/contracts";
|
||||
import { ProviderDriverKind, type ServerProvider } from "@t3tools/contracts";
|
||||
import { PiSettings } from "../settings.ts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
import * as Path from "effect/Path";
|
||||
@@ -15,19 +16,16 @@ import { HttpClient } from "effect/http";
|
||||
import { ChildProcessSpawner } from "effect/process";
|
||||
|
||||
import { ProviderHost } from "@t3tools/provider-core/server/ProviderHost";
|
||||
import { makePiTextGeneration } from "../../textGeneration/PiTextGeneration.ts";
|
||||
import {
|
||||
PiAdapterV2Driver,
|
||||
type PiAdapterV2DriverEnv,
|
||||
} from "../../orchestration-v2/Adapters/PiAdapterV2.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makePiTextGeneration } from "./textGeneration.ts";
|
||||
import { PiAdapterV2Driver, type PiAdapterV2DriverEnv } from "./adapter.ts";
|
||||
import { ProviderDriverError } from "@t3tools/provider-core/server/errors";
|
||||
import {
|
||||
buildInitialPiProviderSnapshot,
|
||||
checkPiProviderStatus,
|
||||
discoverPiCommandsForCwd,
|
||||
enrichPiSnapshot,
|
||||
} from "../PiProvider.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
} from "./status.ts";
|
||||
import { makeManagedServerProvider } from "@t3tools/provider-core/server/managedProvider";
|
||||
import {
|
||||
defaultProviderContinuationIdentity,
|
||||
type ProviderDriver,
|
||||
@@ -44,7 +42,7 @@ import {
|
||||
haveProviderSnapshotSettingsChanged,
|
||||
makeProviderSnapshotSettingsSource,
|
||||
type ProviderSnapshotSettings,
|
||||
} from "../providerUpdateSettings.ts";
|
||||
} from "@t3tools/provider-core/server/snapshotSettings";
|
||||
|
||||
const decodePiSettings = Schema.decodeSync(PiSettings);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import * as NodeModule from "node:module";
|
||||
import * as NodeVM from "node:vm";
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
|
||||
import { PI_T3_MCP_EXTENSION_SOURCE } from "./piT3McpExtensionSource.ts";
|
||||
import { PI_T3_MCP_EXTENSION_SOURCE } from "./mcpExtensionSource.ts";
|
||||
|
||||
type RequestHook = (
|
||||
event: { payload: unknown },
|
||||
File renamed without changes.
+2
-2
@@ -9,12 +9,12 @@ import {
|
||||
T3_MCP_BEARER_ENV,
|
||||
T3_MCP_URL_ENV,
|
||||
T3_PI_RUNTIME_MODE_ENV,
|
||||
} from "./piT3McpExtensionSource.ts";
|
||||
} from "./mcpExtensionSource.ts";
|
||||
import {
|
||||
buildPiRpcLaunch,
|
||||
materializePiT3McpExtension,
|
||||
resolvePiLaunchArgs,
|
||||
} from "./piT3McpInjection.ts";
|
||||
} from "./mcpInjection.ts";
|
||||
|
||||
const threadId = ThreadId.make("thread-pi-t3-mcp");
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
T3_MCP_BEARER_ENV,
|
||||
T3_MCP_URL_ENV,
|
||||
T3_PI_RUNTIME_MODE_ENV,
|
||||
} from "./piT3McpExtensionSource.ts";
|
||||
} from "./mcpExtensionSource.ts";
|
||||
|
||||
const RESERVED_PI_LAUNCH_ARGUMENTS = new Set([
|
||||
"--continue",
|
||||
File renamed without changes.
+1
-1
@@ -5,7 +5,7 @@ import * as Sink from "effect/Sink";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
||||
|
||||
import { checkPiProviderStatus, MINIMUM_PI_VERSION } from "./PiProvider.ts";
|
||||
import { checkPiProviderStatus, MINIMUM_PI_VERSION } from "./status.ts";
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
*/
|
||||
import {
|
||||
type CustomModelSetting,
|
||||
type PiSettings,
|
||||
type ServerProvider,
|
||||
type ServerProviderModel,
|
||||
} from "@t3tools/contracts";
|
||||
import type { PiSettings } from "../settings.ts";
|
||||
import { causeErrorTag } from "@t3tools/shared/observability";
|
||||
import { resolveSpawnCommand } from "@t3tools/shared/shell";
|
||||
import { compareSemverVersions } from "@t3tools/shared/semver";
|
||||
@@ -26,17 +26,14 @@ import * as Result from "effect/Result";
|
||||
import { HttpClient } from "effect/http";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
||||
|
||||
import {
|
||||
buildPiRpcLaunch,
|
||||
resolvePiLaunchArgs,
|
||||
} from "../orchestration-v2/Adapters/piT3McpInjection.ts";
|
||||
import { buildPiRpcLaunch, resolvePiLaunchArgs } from "./mcpInjection.ts";
|
||||
import {
|
||||
makePiRpcConnection,
|
||||
PiRpcError,
|
||||
PiRpcTimeoutError,
|
||||
piRecordField as recordField,
|
||||
piRecordString as recordString,
|
||||
} from "../orchestration-v2/Adapters/PiRpc.ts";
|
||||
} from "./rpc.ts";
|
||||
import {
|
||||
buildServerProvider,
|
||||
isCommandMissingCause,
|
||||
@@ -52,12 +49,12 @@ import {
|
||||
import {
|
||||
EMPTY_PI_MODEL_CAPABILITIES,
|
||||
thinkingCapabilitiesForPiModel,
|
||||
} from "./piThinkingCapabilities.ts";
|
||||
} from "./thinkingCapabilities.ts";
|
||||
import {
|
||||
parsePiDiscoveredCommands,
|
||||
withPiBuiltinSlashCommands,
|
||||
type PiDiscoveredCommands,
|
||||
} from "./PiCommands.ts";
|
||||
} from "./commands.ts";
|
||||
|
||||
const PI_PRESENTATION = {
|
||||
displayName: "Pi",
|
||||
+1
-1
@@ -9,7 +9,7 @@ import * as Sink from "effect/Sink";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { ChildProcessSpawner } from "effect/process";
|
||||
|
||||
import { makePiTextGeneration } from "./PiTextGeneration.ts";
|
||||
import { makePiTextGeneration } from "./textGeneration.ts";
|
||||
|
||||
const decodeJsonLine = Schema.decodeUnknownSync(Schema.fromJsonString(Schema.Unknown));
|
||||
const encodeJsonLine = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
|
||||
+4
-6
@@ -10,13 +10,11 @@ import * as Queue from "effect/Queue";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { ChildProcessSpawner } from "effect/process";
|
||||
|
||||
import { TextGenerationError, type PiSettings } from "@t3tools/contracts";
|
||||
import { TextGenerationError } from "@t3tools/contracts";
|
||||
import type { PiSettings } from "../settings.ts";
|
||||
|
||||
import { makePiRpcConnection, parsePiModelSlug } from "../orchestration-v2/Adapters/PiRpc.ts";
|
||||
import {
|
||||
buildPiRpcLaunch,
|
||||
resolvePiLaunchArgs,
|
||||
} from "../orchestration-v2/Adapters/piT3McpInjection.ts";
|
||||
import { makePiRpcConnection, parsePiModelSlug } from "./rpc.ts";
|
||||
import { buildPiRpcLaunch, resolvePiLaunchArgs } from "./mcpInjection.ts";
|
||||
import * as TextGenerationOperations from "@t3tools/provider-core/server/textGenerationOperations";
|
||||
|
||||
const PI_TIMEOUT_MS = 180_000;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
|
||||
import { thinkingCapabilitiesForPiModel } from "./piThinkingCapabilities.ts";
|
||||
import { thinkingCapabilitiesForPiModel } from "./thinkingCapabilities.ts";
|
||||
|
||||
describe("thinkingCapabilitiesForPiModel", () => {
|
||||
it("gives every choice its real level id and tags Pi's default", () => {
|
||||
File renamed without changes.
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Pi instance settings. Shared by the server driver and the client settings
|
||||
* form, so it holds only browser-safe schema code.
|
||||
*
|
||||
* @module provider-pi/settings
|
||||
*/
|
||||
import {
|
||||
CustomModelSetting,
|
||||
makeBinaryPathSetting,
|
||||
makeProviderSettingsSchema,
|
||||
TrimmedString,
|
||||
} from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Schema from "effect/Schema";
|
||||
|
||||
export const PiSettings = makeProviderSettingsSchema(
|
||||
{
|
||||
// Off by default like Cursor and Grok. Users opt in from Settings.
|
||||
enabled: Schema.Boolean.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(false)),
|
||||
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
||||
),
|
||||
binaryPath: makeBinaryPathSetting("pi").pipe(
|
||||
Schema.annotateKey({
|
||||
title: "Binary path",
|
||||
description: "Path to the Pi coding agent binary.",
|
||||
providerSettingsForm: { placeholder: "pi", clearWhenEmpty: "omit" },
|
||||
}),
|
||||
),
|
||||
launchArgs: TrimmedString.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed("")),
|
||||
Schema.annotateKey({
|
||||
title: "Launch arguments",
|
||||
description: "Additional CLI arguments passed to pi --mode rpc on session start.",
|
||||
providerSettingsForm: { clearWhenEmpty: "omit" },
|
||||
}),
|
||||
),
|
||||
customModels: Schema.Array(CustomModelSetting).pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed([])),
|
||||
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
||||
),
|
||||
},
|
||||
{
|
||||
order: ["binaryPath", "launchArgs"],
|
||||
},
|
||||
);
|
||||
export type PiSettings = typeof PiSettings.Type;
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Generated
+43
@@ -353,6 +353,12 @@ importers:
|
||||
'@t3tools/mobile-terminal-native':
|
||||
specifier: file:./modules/t3-terminal
|
||||
version: file:apps/mobile/modules/t3-terminal
|
||||
'@t3tools/provider-core':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/provider-core
|
||||
'@t3tools/provider-pi':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/provider-pi
|
||||
'@t3tools/shared':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/shared
|
||||
@@ -597,6 +603,9 @@ importers:
|
||||
'@t3tools/provider-core':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/provider-core
|
||||
'@t3tools/provider-pi':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/provider-pi
|
||||
diff:
|
||||
specifier: 8.0.3
|
||||
version: 8.0.3
|
||||
@@ -724,6 +733,9 @@ importers:
|
||||
'@t3tools/provider-core':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/provider-core
|
||||
'@t3tools/provider-pi':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/provider-pi
|
||||
'@t3tools/shared':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/shared
|
||||
@@ -1087,6 +1099,37 @@ importers:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0(@types/[email protected])(@vitest/[email protected]([email protected]))([email protected])([email protected])([email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
packages/provider-pi:
|
||||
dependencies:
|
||||
'@t3tools/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../contracts
|
||||
'@t3tools/provider-core':
|
||||
specifier: workspace:*
|
||||
version: link:../provider-core
|
||||
'@t3tools/shared':
|
||||
specifier: workspace:*
|
||||
version: link:../shared
|
||||
effect:
|
||||
specifier: 4.0.1
|
||||
version: 4.0.1(patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f)
|
||||
devDependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.1
|
||||
version: 4.0.1([email protected])([email protected](patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.1
|
||||
version: 4.0.1(patch_hash=359f6fb2f7b3ec145bb72208edb9034f02489791aa2491a55cdbd69bd56ee0d2)(@types/[email protected])(@vitest/[email protected])([email protected])([email protected](patch_hash=a33cba07c41f32374c2aaa86ea4a84d3ab9a872a78c94b65e929b19f8361856f))([email protected])([email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
'@t3tools/provider-testing':
|
||||
specifier: workspace:*
|
||||
version: link:../provider-testing
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
vite-plus:
|
||||
specifier: 1.0.0
|
||||
version: 1.0.0(@types/[email protected])(@vitest/[email protected]([email protected]))([email protected])([email protected])([email protected])([email protected](@noble/[email protected]))([email protected](@types/[email protected])([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
|
||||
packages/provider-testing:
|
||||
dependencies:
|
||||
'@effect/platform-node':
|
||||
|
||||
@@ -30,6 +30,7 @@ const workspaceFiles = [
|
||||
"packages/tailscale/package.json",
|
||||
"packages/provider-core/package.json",
|
||||
"packages/provider-testing/package.json",
|
||||
"packages/provider-pi/package.json",
|
||||
"packages/effect-acp/package.json",
|
||||
"packages/effect-codex-app-server/package.json",
|
||||
"scripts/package.json",
|
||||
|
||||
Reference in new issue
Block a user