@av-pi-studio/protocol 0.0.93 → 0.0.94
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 +3380 -13
- package/dist/messages.js +128 -0
- package/dist/provider-manifest.d.ts +8 -0
- package/dist/provider-manifest.js +8 -2
- package/package.json +1 -1
package/dist/messages.js
CHANGED
|
@@ -901,6 +901,128 @@ export const providerAuthLogoutResponseSchema = z
|
|
|
901
901
|
})
|
|
902
902
|
.passthrough();
|
|
903
903
|
// ===========================================================================
|
|
904
|
+
// Extension UI (features/extension-ui-rpc.md) — additive, new in sprint-066
|
|
905
|
+
// ===========================================================================
|
|
906
|
+
/**
|
|
907
|
+
* A pending extension-UI dialog awaiting a client answer (list/reconnect-catch-up shape). Method
|
|
908
|
+
* semantics (which fields `payload` carries, how to render it) are entirely Pi's business — the
|
|
909
|
+
* daemon never interprets `payload`, only correlates and forwards it.
|
|
910
|
+
*/
|
|
911
|
+
export const agentUiPendingRequestSchema = z
|
|
912
|
+
.object({
|
|
913
|
+
requestId: z.string(),
|
|
914
|
+
agentId: z.string(),
|
|
915
|
+
method: z.string(),
|
|
916
|
+
expectsResponse: z.boolean(),
|
|
917
|
+
payload: z.record(z.unknown()),
|
|
918
|
+
surfaceKey: z.string().optional(),
|
|
919
|
+
timeoutMs: z.number().optional(),
|
|
920
|
+
createdAt: wireTimestampSchema,
|
|
921
|
+
})
|
|
922
|
+
.passthrough();
|
|
923
|
+
/**
|
|
924
|
+
* A retained, last-value-wins extension-UI surface (status line, widget, title). Deleted (not
|
|
925
|
+
* listed) once its owning method sends a clearing update — see `agent_ui_request.removed`.
|
|
926
|
+
*/
|
|
927
|
+
export const agentUiSurfaceSchema = z
|
|
928
|
+
.object({
|
|
929
|
+
agentId: z.string(),
|
|
930
|
+
method: z.string(),
|
|
931
|
+
surfaceKey: z.string(),
|
|
932
|
+
payload: z.record(z.unknown()),
|
|
933
|
+
updatedAt: wireTimestampSchema,
|
|
934
|
+
})
|
|
935
|
+
.passthrough();
|
|
936
|
+
/**
|
|
937
|
+
* Agent-scoped broadcast to every client — one per provider UI event, exactly like
|
|
938
|
+
* `agentPermissionRequestSchema`, not the `sessionMessageBaseSchema` passthrough family (this is a
|
|
939
|
+
* per-agent broadcast, not a per-session subscription push). `requestId` is daemon-minted, never the
|
|
940
|
+
* provider's own id. `removed: true` marks a surface-clearing update (no `payload` fields to render).
|
|
941
|
+
*/
|
|
942
|
+
export const agentUiRequestSchema = z
|
|
943
|
+
.object({
|
|
944
|
+
type: z.literal("agent_ui_request"),
|
|
945
|
+
requestId: z.string(),
|
|
946
|
+
agentId: z.string(),
|
|
947
|
+
method: z.string(),
|
|
948
|
+
expectsResponse: z.boolean(),
|
|
949
|
+
payload: z.record(z.unknown()),
|
|
950
|
+
surfaceKey: z.string().optional(),
|
|
951
|
+
removed: z.boolean().optional(),
|
|
952
|
+
timeoutMs: z.number().optional(),
|
|
953
|
+
createdAt: wireTimestampSchema,
|
|
954
|
+
})
|
|
955
|
+
.passthrough();
|
|
956
|
+
/**
|
|
957
|
+
* Broadcast that lets every client dismiss a dialog once it is no longer answerable. `reason` is
|
|
958
|
+
* deliberately an open string (`answered` | `cancelled` | `timeout` | `aborted` documented, not
|
|
959
|
+
* enumerated) so the daemon can extend its taxonomy without narrowing the wire for older clients.
|
|
960
|
+
*/
|
|
961
|
+
export const agentUiResolvedSchema = z
|
|
962
|
+
.object({
|
|
963
|
+
type: z.literal("agent_ui_resolved"),
|
|
964
|
+
requestId: z.string(),
|
|
965
|
+
agentId: z.string(),
|
|
966
|
+
reason: z.string(),
|
|
967
|
+
})
|
|
968
|
+
.passthrough();
|
|
969
|
+
/**
|
|
970
|
+
* The answer body forwarded to the provider. Deliberately permissive (every field optional,
|
|
971
|
+
* `.passthrough()`): method → response-shape validation is Pi's business, and a strict union keyed
|
|
972
|
+
* on `method` would reject a shape a future Pi UI method introduces, blocking that extension forever
|
|
973
|
+
* on a response the daemon refused to forward.
|
|
974
|
+
*/
|
|
975
|
+
export const agentUiResponseSchema = z
|
|
976
|
+
.object({
|
|
977
|
+
value: z.string().optional(),
|
|
978
|
+
confirmed: z.boolean().optional(),
|
|
979
|
+
cancelled: z.boolean().optional(),
|
|
980
|
+
})
|
|
981
|
+
.passthrough();
|
|
982
|
+
export const agentUiRespondRequestSchema = z
|
|
983
|
+
.object({
|
|
984
|
+
type: z.literal("agent_ui_respond_request"),
|
|
985
|
+
requestId: z.string(),
|
|
986
|
+
uiRequestId: z.string(),
|
|
987
|
+
response: agentUiResponseSchema,
|
|
988
|
+
})
|
|
989
|
+
.passthrough();
|
|
990
|
+
/** `error` is an open string (`not_found` | `unsupported` documented, not enumerated). */
|
|
991
|
+
export const agentUiRespondResponseSchema = z
|
|
992
|
+
.object({
|
|
993
|
+
type: z.literal("agent_ui_respond_response"),
|
|
994
|
+
requestId: z.string(),
|
|
995
|
+
payload: z
|
|
996
|
+
.object({
|
|
997
|
+
ok: z.boolean(),
|
|
998
|
+
error: z.string().optional(),
|
|
999
|
+
})
|
|
1000
|
+
.passthrough(),
|
|
1001
|
+
})
|
|
1002
|
+
.passthrough();
|
|
1003
|
+
/** Reconnect catch-up: list current pending dialogs + retained surfaces, all agents or one. */
|
|
1004
|
+
export const agentUiListRequestSchema = z
|
|
1005
|
+
.object({
|
|
1006
|
+
type: z.literal("agent_ui_list_request"),
|
|
1007
|
+
requestId: z.string(),
|
|
1008
|
+
agentId: z.string().optional(),
|
|
1009
|
+
})
|
|
1010
|
+
.passthrough();
|
|
1011
|
+
export const agentUiListResponseSchema = z
|
|
1012
|
+
.object({
|
|
1013
|
+
type: z.literal("agent_ui_list_response"),
|
|
1014
|
+
requestId: z.string(),
|
|
1015
|
+
payload: z
|
|
1016
|
+
.object({
|
|
1017
|
+
ok: z.boolean(),
|
|
1018
|
+
pending: z.array(agentUiPendingRequestSchema),
|
|
1019
|
+
surfaces: z.array(agentUiSurfaceSchema),
|
|
1020
|
+
error: z.string().optional(),
|
|
1021
|
+
})
|
|
1022
|
+
.passthrough(),
|
|
1023
|
+
})
|
|
1024
|
+
.passthrough();
|
|
1025
|
+
// ===========================================================================
|
|
904
1026
|
// RPC error
|
|
905
1027
|
// ===========================================================================
|
|
906
1028
|
export const rpcErrorSchema = z.object({
|
|
@@ -979,6 +1101,12 @@ export const sessionMessageSchema = z.discriminatedUnion("type", [
|
|
|
979
1101
|
providerAuthCancelResponseSchema,
|
|
980
1102
|
providerAuthLogoutRequestSchema,
|
|
981
1103
|
providerAuthLogoutResponseSchema,
|
|
1104
|
+
agentUiRequestSchema,
|
|
1105
|
+
agentUiResolvedSchema,
|
|
1106
|
+
agentUiRespondRequestSchema,
|
|
1107
|
+
agentUiRespondResponseSchema,
|
|
1108
|
+
agentUiListRequestSchema,
|
|
1109
|
+
agentUiListResponseSchema,
|
|
982
1110
|
rpcErrorSchema,
|
|
983
1111
|
]);
|
|
984
1112
|
/**
|
|
@@ -23,6 +23,7 @@ export declare const agentCapabilityFlagsSchema: z.ZodObject<{
|
|
|
23
23
|
supportsRewindFiles: z.ZodOptional<z.ZodBoolean>;
|
|
24
24
|
supportsRewindBoth: z.ZodOptional<z.ZodBoolean>;
|
|
25
25
|
supportsSteering: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
supportsExtensionUi: z.ZodOptional<z.ZodBoolean>;
|
|
26
27
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
28
|
supportsStreaming: z.ZodBoolean;
|
|
28
29
|
supportsSessionPersistence: z.ZodBoolean;
|
|
@@ -34,6 +35,7 @@ export declare const agentCapabilityFlagsSchema: z.ZodObject<{
|
|
|
34
35
|
supportsRewindFiles: z.ZodOptional<z.ZodBoolean>;
|
|
35
36
|
supportsRewindBoth: z.ZodOptional<z.ZodBoolean>;
|
|
36
37
|
supportsSteering: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
supportsExtensionUi: z.ZodOptional<z.ZodBoolean>;
|
|
37
39
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
38
40
|
supportsStreaming: z.ZodBoolean;
|
|
39
41
|
supportsSessionPersistence: z.ZodBoolean;
|
|
@@ -45,6 +47,7 @@ export declare const agentCapabilityFlagsSchema: z.ZodObject<{
|
|
|
45
47
|
supportsRewindFiles: z.ZodOptional<z.ZodBoolean>;
|
|
46
48
|
supportsRewindBoth: z.ZodOptional<z.ZodBoolean>;
|
|
47
49
|
supportsSteering: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
supportsExtensionUi: z.ZodOptional<z.ZodBoolean>;
|
|
48
51
|
}, z.ZodTypeAny, "passthrough">>;
|
|
49
52
|
export type AgentCapabilityFlags = z.infer<typeof agentCapabilityFlagsSchema>;
|
|
50
53
|
/** UI metadata for a provider mode (plan/default/full-access/...). */
|
|
@@ -104,6 +107,7 @@ export declare const providerDefinitionSchema: z.ZodObject<{
|
|
|
104
107
|
supportsRewindFiles: z.ZodOptional<z.ZodBoolean>;
|
|
105
108
|
supportsRewindBoth: z.ZodOptional<z.ZodBoolean>;
|
|
106
109
|
supportsSteering: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
supportsExtensionUi: z.ZodOptional<z.ZodBoolean>;
|
|
107
111
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
108
112
|
supportsStreaming: z.ZodBoolean;
|
|
109
113
|
supportsSessionPersistence: z.ZodBoolean;
|
|
@@ -115,6 +119,7 @@ export declare const providerDefinitionSchema: z.ZodObject<{
|
|
|
115
119
|
supportsRewindFiles: z.ZodOptional<z.ZodBoolean>;
|
|
116
120
|
supportsRewindBoth: z.ZodOptional<z.ZodBoolean>;
|
|
117
121
|
supportsSteering: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
supportsExtensionUi: z.ZodOptional<z.ZodBoolean>;
|
|
118
123
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
119
124
|
supportsStreaming: z.ZodBoolean;
|
|
120
125
|
supportsSessionPersistence: z.ZodBoolean;
|
|
@@ -126,6 +131,7 @@ export declare const providerDefinitionSchema: z.ZodObject<{
|
|
|
126
131
|
supportsRewindFiles: z.ZodOptional<z.ZodBoolean>;
|
|
127
132
|
supportsRewindBoth: z.ZodOptional<z.ZodBoolean>;
|
|
128
133
|
supportsSteering: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
supportsExtensionUi: z.ZodOptional<z.ZodBoolean>;
|
|
129
135
|
}, z.ZodTypeAny, "passthrough">>;
|
|
130
136
|
}, "strip", z.ZodTypeAny, {
|
|
131
137
|
id: string;
|
|
@@ -150,6 +156,7 @@ export declare const providerDefinitionSchema: z.ZodObject<{
|
|
|
150
156
|
supportsRewindFiles?: boolean | undefined;
|
|
151
157
|
supportsRewindBoth?: boolean | undefined;
|
|
152
158
|
supportsSteering?: boolean | undefined;
|
|
159
|
+
supportsExtensionUi?: boolean | undefined;
|
|
153
160
|
} & {
|
|
154
161
|
[k: string]: unknown;
|
|
155
162
|
};
|
|
@@ -176,6 +183,7 @@ export declare const providerDefinitionSchema: z.ZodObject<{
|
|
|
176
183
|
supportsRewindFiles?: boolean | undefined;
|
|
177
184
|
supportsRewindBoth?: boolean | undefined;
|
|
178
185
|
supportsSteering?: boolean | undefined;
|
|
186
|
+
supportsExtensionUi?: boolean | undefined;
|
|
179
187
|
} & {
|
|
180
188
|
[k: string]: unknown;
|
|
181
189
|
};
|
|
@@ -11,7 +11,8 @@ export const providerIdSchema = z.string().regex(/^[a-z][a-z0-9-]*$/, "invalid p
|
|
|
11
11
|
/** Mode danger/intent tier driving UI color. */
|
|
12
12
|
export const colorTierSchema = z.enum(["safe", "moderate", "dangerous", "planning"]);
|
|
13
13
|
/** Per-provider capability flags. */
|
|
14
|
-
export const agentCapabilityFlagsSchema = z
|
|
14
|
+
export const agentCapabilityFlagsSchema = z
|
|
15
|
+
.object({
|
|
15
16
|
supportsStreaming: z.boolean(),
|
|
16
17
|
supportsSessionPersistence: z.boolean(),
|
|
17
18
|
supportsDynamicModes: z.boolean(),
|
|
@@ -25,7 +26,12 @@ export const agentCapabilityFlagsSchema = z.object({
|
|
|
25
26
|
// Steering capability (features/agent-sessions.md § Steering) — additive, optional. When true,
|
|
26
27
|
// the provider accepts `steer`/`follow_up` messages injected into a live turn.
|
|
27
28
|
supportsSteering: z.boolean().optional(),
|
|
28
|
-
|
|
29
|
+
// Extension UI capability (features/extension-ui-rpc.md) — additive, optional. When true, the
|
|
30
|
+
// provider's `AgentSession` implements `onUiRequest`/`respondToUi` and dialogs/fire-and-forget
|
|
31
|
+
// extension UI methods are forwarded to clients instead of being auto-cancelled/dropped.
|
|
32
|
+
supportsExtensionUi: z.boolean().optional(),
|
|
33
|
+
})
|
|
34
|
+
.passthrough();
|
|
29
35
|
/** UI metadata for a provider mode (plan/default/full-access/...). */
|
|
30
36
|
export const providerModeSchema = z.object({
|
|
31
37
|
id: z.string(),
|