@av-pi-studio/protocol 0.0.91 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-capabilities.d.ts +1 -0
- package/dist/client-capabilities.js +3 -0
- package/dist/messages.d.ts +3276 -437
- package/dist/messages.js +133 -0
- package/package.json +1 -1
package/dist/messages.js
CHANGED
|
@@ -778,6 +778,129 @@ export const extensionPacksSetResponseSchema = z
|
|
|
778
778
|
})
|
|
779
779
|
.passthrough();
|
|
780
780
|
// ===========================================================================
|
|
781
|
+
// Provider auth (sprint-055, features/provider-auth-rpc.md) — remote-driven Pi login flows.
|
|
782
|
+
// Five request/response pairs get real schemas + union membership (durable, multi-client RPC
|
|
783
|
+
// surface). The per-session progress push, `provider_auth_flow_event`, is deliberately NOT a
|
|
784
|
+
// union member — like `checkout_status_update`/`file_changed`, it rides
|
|
785
|
+
// `sessionMessageBaseSchema`'s passthrough fallback. Do not "fix" that by adding a schema for it.
|
|
786
|
+
//
|
|
787
|
+
// Every response requires `ok`; a domain failure is `{ ok: false, error: "<reason>" }` in the
|
|
788
|
+
// payload, never a chosen `rpc_error` code (`ws/router.ts` only emits `unknown_message_type` /
|
|
789
|
+
// `handler_error`, both reserved for transport-level failures).
|
|
790
|
+
// ===========================================================================
|
|
791
|
+
export const providerAuthTypeSchema = z.enum(["api_key", "oauth"]);
|
|
792
|
+
/** One provider's auth capability + current state (`configured: "unknown"` = a bounded
|
|
793
|
+
* `checkAuth()` timed out — see sprint-054's `checkAuthBounded` precedent). */
|
|
794
|
+
export const providerAuthInfoSchema = z
|
|
795
|
+
.object({
|
|
796
|
+
id: z.string(),
|
|
797
|
+
name: z.string(),
|
|
798
|
+
authTypes: z.array(providerAuthTypeSchema),
|
|
799
|
+
oauthLoginLabel: z.string().optional(),
|
|
800
|
+
oauthIsSubscription: z.boolean().optional(),
|
|
801
|
+
configured: z.union([z.boolean(), z.literal("unknown")]),
|
|
802
|
+
configuredType: providerAuthTypeSchema.optional(),
|
|
803
|
+
configuredSource: z.string().optional(),
|
|
804
|
+
})
|
|
805
|
+
.passthrough();
|
|
806
|
+
export const providerAuthListRequestSchema = z
|
|
807
|
+
.object({
|
|
808
|
+
type: z.literal("provider_auth_list_request"),
|
|
809
|
+
requestId: z.string(),
|
|
810
|
+
})
|
|
811
|
+
.passthrough();
|
|
812
|
+
export const providerAuthListResponseSchema = z
|
|
813
|
+
.object({
|
|
814
|
+
type: z.literal("provider_auth_list_response"),
|
|
815
|
+
requestId: z.string(),
|
|
816
|
+
payload: z
|
|
817
|
+
.object({
|
|
818
|
+
ok: z.boolean(),
|
|
819
|
+
providers: z.array(providerAuthInfoSchema).default([]),
|
|
820
|
+
error: z.string().optional(),
|
|
821
|
+
})
|
|
822
|
+
.passthrough(),
|
|
823
|
+
})
|
|
824
|
+
.passthrough();
|
|
825
|
+
export const providerAuthLoginRequestSchema = z
|
|
826
|
+
.object({
|
|
827
|
+
type: z.literal("provider_auth_login_request"),
|
|
828
|
+
requestId: z.string(),
|
|
829
|
+
provider: z.string(),
|
|
830
|
+
authType: providerAuthTypeSchema,
|
|
831
|
+
})
|
|
832
|
+
.passthrough();
|
|
833
|
+
export const providerAuthLoginResponseSchema = z
|
|
834
|
+
.object({
|
|
835
|
+
type: z.literal("provider_auth_login_response"),
|
|
836
|
+
requestId: z.string(),
|
|
837
|
+
payload: z
|
|
838
|
+
.object({
|
|
839
|
+
ok: z.boolean(),
|
|
840
|
+
flowId: z.string().optional(),
|
|
841
|
+
error: z.string().optional(),
|
|
842
|
+
})
|
|
843
|
+
.passthrough(),
|
|
844
|
+
})
|
|
845
|
+
.passthrough();
|
|
846
|
+
export const providerAuthRespondRequestSchema = z
|
|
847
|
+
.object({
|
|
848
|
+
type: z.literal("provider_auth_respond_request"),
|
|
849
|
+
requestId: z.string(),
|
|
850
|
+
flowId: z.string(),
|
|
851
|
+
promptId: z.string(),
|
|
852
|
+
value: z.string(),
|
|
853
|
+
})
|
|
854
|
+
.passthrough();
|
|
855
|
+
export const providerAuthRespondResponseSchema = z
|
|
856
|
+
.object({
|
|
857
|
+
type: z.literal("provider_auth_respond_response"),
|
|
858
|
+
requestId: z.string(),
|
|
859
|
+
payload: z
|
|
860
|
+
.object({
|
|
861
|
+
ok: z.boolean(),
|
|
862
|
+
error: z.string().optional(),
|
|
863
|
+
})
|
|
864
|
+
.passthrough(),
|
|
865
|
+
})
|
|
866
|
+
.passthrough();
|
|
867
|
+
export const providerAuthCancelRequestSchema = z
|
|
868
|
+
.object({
|
|
869
|
+
type: z.literal("provider_auth_cancel_request"),
|
|
870
|
+
requestId: z.string(),
|
|
871
|
+
flowId: z.string(),
|
|
872
|
+
})
|
|
873
|
+
.passthrough();
|
|
874
|
+
/** Idempotent — `ok: true` even when the named flow was already gone. */
|
|
875
|
+
export const providerAuthCancelResponseSchema = z
|
|
876
|
+
.object({
|
|
877
|
+
type: z.literal("provider_auth_cancel_response"),
|
|
878
|
+
requestId: z.string(),
|
|
879
|
+
payload: z.object({ ok: z.boolean() }).passthrough(),
|
|
880
|
+
})
|
|
881
|
+
.passthrough();
|
|
882
|
+
export const providerAuthLogoutRequestSchema = z
|
|
883
|
+
.object({
|
|
884
|
+
type: z.literal("provider_auth_logout_request"),
|
|
885
|
+
requestId: z.string(),
|
|
886
|
+
provider: z.string(),
|
|
887
|
+
})
|
|
888
|
+
.passthrough();
|
|
889
|
+
/** `stillConfigured` flags an ambient credential (e.g. an env var) surviving the logout. */
|
|
890
|
+
export const providerAuthLogoutResponseSchema = z
|
|
891
|
+
.object({
|
|
892
|
+
type: z.literal("provider_auth_logout_response"),
|
|
893
|
+
requestId: z.string(),
|
|
894
|
+
payload: z
|
|
895
|
+
.object({
|
|
896
|
+
ok: z.boolean(),
|
|
897
|
+
stillConfigured: z.boolean().optional(),
|
|
898
|
+
error: z.string().optional(),
|
|
899
|
+
})
|
|
900
|
+
.passthrough(),
|
|
901
|
+
})
|
|
902
|
+
.passthrough();
|
|
903
|
+
// ===========================================================================
|
|
781
904
|
// RPC error
|
|
782
905
|
// ===========================================================================
|
|
783
906
|
export const rpcErrorSchema = z.object({
|
|
@@ -846,6 +969,16 @@ export const sessionMessageSchema = z.discriminatedUnion("type", [
|
|
|
846
969
|
extensionPacksListResponseSchema,
|
|
847
970
|
extensionPacksSetRequestSchema,
|
|
848
971
|
extensionPacksSetResponseSchema,
|
|
972
|
+
providerAuthListRequestSchema,
|
|
973
|
+
providerAuthListResponseSchema,
|
|
974
|
+
providerAuthLoginRequestSchema,
|
|
975
|
+
providerAuthLoginResponseSchema,
|
|
976
|
+
providerAuthRespondRequestSchema,
|
|
977
|
+
providerAuthRespondResponseSchema,
|
|
978
|
+
providerAuthCancelRequestSchema,
|
|
979
|
+
providerAuthCancelResponseSchema,
|
|
980
|
+
providerAuthLogoutRequestSchema,
|
|
981
|
+
providerAuthLogoutResponseSchema,
|
|
849
982
|
rpcErrorSchema,
|
|
850
983
|
]);
|
|
851
984
|
/**
|