feat(contracts,db): Pi upstream contracts and pi_upstream table
- contracts/pi.ts: 41 builtin provider ids + openai-compatible + fake, auth kinds, upstream row/view/create/update, provider capability table (oauth modes, termsNote), test/models/oauth start/complete schemas - settings.pi gains defaultUpstreamId; legacy single-upstream fields kept for fallback - api.ts: /pi/providers, /pi/upstreams CRUD, test, models, oauth start/complete/logout (writes and login are console-session only) - migration 0027: pi_upstream, agent_run.upstream_id, one-time conversion of saved legacy settings.pi into a default upstream Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
39a001c099
commit
b9dbd54e37
8 files changed
+665
-4
No files matched your search
@@ -182,6 +182,9 @@ export type PathBindingBindingKind = "entity" | "season";
|
||||
export type PathBindingStatus = "active" | "conflict" | "superseded";
|
||||
export type PathMappingViewKind = "downloader" | "media_server";
|
||||
export type PathMappingVerifyStatus = "unverified" | "ok" | "failed";
|
||||
export type PiUpstreamAuthKind = "api_key" | "oauth" | "none";
|
||||
export type PiUpstreamThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
||||
export type PiUpstreamStatus = "ok" | "auth_required" | "expired" | "error";
|
||||
export type PolicyRevisionKind = "acquisition" | "preference" | "retention" | "cleanup" | "instance" | "automation";
|
||||
export type PolicyRevisionStatus = "draft" | "published" | "superseded" | "rolled_back" | "archived";
|
||||
export type PreferenceTagKind = "soft" | "hard" | "version" | "target";
|
||||
@@ -340,6 +343,7 @@ export interface AgentRunTable {
|
||||
export interface AgentRunEventTable {
|
||||
run_id: string;
|
||||
seq: number;
|
||||
upstream_id: string | null;
|
||||
type: AgentRunEventType;
|
||||
at: GeneratedTimestamptz;
|
||||
payload: Generated<Json>;
|
||||
@@ -996,6 +1000,25 @@ export interface PolicyRevisionTable {
|
||||
policy_key: string;
|
||||
revision: number;
|
||||
kind: PolicyRevisionKind;
|
||||
export interface PiUpstreamTable {
|
||||
id: Generated<string>;
|
||||
name: string;
|
||||
provider: string;
|
||||
auth_kind: PiUpstreamAuthKind;
|
||||
secret_ref: string | null;
|
||||
base_url: string | null;
|
||||
default_model: string | null;
|
||||
thinking_level: Generated<PiUpstreamThinkingLevel>;
|
||||
extra: Generated<Json>;
|
||||
enabled: Generated<boolean>;
|
||||
status: Generated<PiUpstreamStatus>;
|
||||
last_error: string | null;
|
||||
last_verified_at: Timestamptz | null;
|
||||
oauth_expires_at: Timestamptz | null;
|
||||
created_at: GeneratedTimestamptz;
|
||||
updated_at: GeneratedTimestamptz;
|
||||
}
|
||||
|
||||
status: Generated<PolicyRevisionStatus>;
|
||||
title: string;
|
||||
summary: string | null;
|
||||
@@ -1446,6 +1469,7 @@ export type AgentRunMessageRow = Selectable<AgentRunMessageTable>;
|
||||
export type NewAgentRunMessage = Insertable<AgentRunMessageTable>;
|
||||
export type AgentRunMessageUpdate = Updateable<AgentRunMessageTable>;
|
||||
export type ApiKeyRow = Selectable<ApiKeyTable>;
|
||||
pi_upstream: PiUpstreamTable;
|
||||
export type NewApiKey = Insertable<ApiKeyTable>;
|
||||
export type ApiKeyUpdate = Updateable<ApiKeyTable>;
|
||||
export type ApprovalRow = Selectable<ApprovalTable>;
|
||||
@@ -1599,6 +1623,9 @@ export type SubscriptionRow = Selectable<SubscriptionTable>;
|
||||
export type NewSubscription = Insertable<SubscriptionTable>;
|
||||
export type SubscriptionUpdate = Updateable<SubscriptionTable>;
|
||||
export type SubscriptionHistoryRow = Selectable<SubscriptionHistoryTable>;
|
||||
export type PiUpstreamRow = Selectable<PiUpstreamTable>;
|
||||
export type NewPiUpstream = Insertable<PiUpstreamTable>;
|
||||
export type PiUpstreamUpdate = Updateable<PiUpstreamTable>;
|
||||
export type NewSubscriptionHistory = Insertable<SubscriptionHistoryTable>;
|
||||
export type SubscriptionHistoryUpdate = Updateable<SubscriptionHistoryTable>;
|
||||
export type TaskRow = Selectable<TaskTable>;
|
||||
|
||||
Reference in new issue
Block a user