feat(agent): per-upstream pi Models with isolated credential stores

- PiUpstreamClient: one Models per upstream holding only its provider; credential
  store adapter maps to that upstream's secret, so several accounts of one provider
  coexist; host env is only read for authKind none (ambient cloud creds)
- provider catalog from builtinProviders() plus static oauth modes, env fields and
  subscription terms notes; openai-compatible custom endpoints
- fake upstream provider with mock OAuth (browser paste / device approval)
- PiAgentRuntime accepts an upstream; thinking level clamped to the model

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-28 02:23:09 +08:00
1 parent b9dbd54e37
commit 743fe2486d
8 files changed
+1085 -5

No files matched your search

+21
View File
@@ -11,6 +11,14 @@ export {
} from "./capability/registry.ts";
export { capabilityIdToToolName, isCapabilityId, toolNameToCapabilityId } from "./capability/tool-name.ts";
export * from "./capability/types.ts";
export {
ENV_FIELDS,
OAUTH_CALLBACK_PORTS,
OAUTH_MODES,
PI_AI_VERSION,
providerCatalog,
providerInfo,
} from "./pi/catalog.ts";
export {
type CreateFakeRuntimeOptions,
createFakeRuntime,
@@ -22,6 +30,7 @@ export {
type FakeToolCall,
type FakeToolResult,
} from "./pi/fake.ts";
export { DEFAULT_FAKE_OAUTH, FakeOAuthControl } from "./pi/fake-upstream.ts";
export {
checkToolCall,
DEFAULT_COMPACTION_INSTRUCTIONS,
@@ -29,6 +38,18 @@ export {
type PiAgentRuntimeOptions,
} from "./pi/runtime.ts";
export { sessionPathFor } from "./pi/session.ts";
export {
classifyUpstreamError,
PiUpstreamClient,
type UpstreamAuthEvent,
type UpstreamAuthPrompt,
type UpstreamClientOptions,
type UpstreamCredential,
type UpstreamCredentialStore,
UpstreamError,
type UpstreamLoginInteraction,
type UpstreamSpec,
} from "./pi/upstream.ts";
export { isSensitiveKey, REDACTED, redactForModel, redactString, summarizeForLog } from "./redact.ts";
export * from "./runtime/port.ts";
export {