@av-pi-studio/protocol 0.0.114 → 0.0.116

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.
Files changed (70) hide show
  1. package/README.md +3 -3
  2. package/dist/client-capabilities.d.ts +1 -0
  3. package/dist/client-capabilities.js +3 -0
  4. package/dist/messages.d.ts +13446 -0
  5. package/dist/messages.js +172 -1
  6. package/fixtures/external-clients/.signatures.json +559 -0
  7. package/fixtures/external-clients/CHANGELOG.md +18 -0
  8. package/fixtures/external-clients/README.md +94 -0
  9. package/fixtures/external-clients/agent_archived.json +17 -0
  10. package/fixtures/external-clients/agent_deleted.json +16 -0
  11. package/fixtures/external-clients/agent_session_stats_request.json +17 -0
  12. package/fixtures/external-clients/agent_session_stats_response.json +30 -0
  13. package/fixtures/external-clients/agent_status.json +17 -0
  14. package/fixtures/external-clients/agent_stream.assistant_message.json +29 -0
  15. package/fixtures/external-clients/agent_stream.compaction.json +29 -0
  16. package/fixtures/external-clients/agent_stream.error.json +22 -0
  17. package/fixtures/external-clients/agent_stream.reasoning.json +22 -0
  18. package/fixtures/external-clients/agent_stream.tool_call.json +27 -0
  19. package/fixtures/external-clients/agent_stream.tool_call.partial.json +28 -0
  20. package/fixtures/external-clients/agent_stream.turn_canceled.json +22 -0
  21. package/fixtures/external-clients/agent_stream.turn_completed.json +22 -0
  22. package/fixtures/external-clients/agent_stream.turn_failed.json +23 -0
  23. package/fixtures/external-clients/agent_stream.turn_started.json +22 -0
  24. package/fixtures/external-clients/agent_stream.user_message.json +28 -0
  25. package/fixtures/external-clients/agent_timeline_reset.json +17 -0
  26. package/fixtures/external-clients/agent_ui_list_request.json +17 -0
  27. package/fixtures/external-clients/agent_ui_list_response.json +50 -0
  28. package/fixtures/external-clients/agent_ui_request.confirm.json +24 -0
  29. package/fixtures/external-clients/agent_ui_request.editor.json +24 -0
  30. package/fixtures/external-clients/agent_ui_request.input.json +24 -0
  31. package/fixtures/external-clients/agent_ui_request.notify.json +23 -0
  32. package/fixtures/external-clients/agent_ui_request.select.json +24 -0
  33. package/fixtures/external-clients/agent_ui_request.setStatus.json +24 -0
  34. package/fixtures/external-clients/agent_ui_request.setStatus.removed.json +23 -0
  35. package/fixtures/external-clients/agent_ui_resolved.aborted.json +18 -0
  36. package/fixtures/external-clients/agent_ui_resolved.answered.json +18 -0
  37. package/fixtures/external-clients/agent_ui_resolved.cancelled.json +18 -0
  38. package/fixtures/external-clients/agent_ui_resolved.timeout.json +18 -0
  39. package/fixtures/external-clients/agent_ui_respond_request.confirm.json +20 -0
  40. package/fixtures/external-clients/agent_ui_respond_request.select.json +20 -0
  41. package/fixtures/external-clients/agent_ui_respond_response.not_found.json +20 -0
  42. package/fixtures/external-clients/agent_ui_respond_response.ok.json +19 -0
  43. package/fixtures/external-clients/agent_update.json +18 -0
  44. package/fixtures/external-clients/agent_update.model.json +18 -0
  45. package/fixtures/external-clients/daemon_log_lines.json +23 -0
  46. package/fixtures/external-clients/daemon_logs_subscribe_request.json +18 -0
  47. package/fixtures/external-clients/daemon_logs_subscribe_response.json +34 -0
  48. package/fixtures/external-clients/daemon_logs_unsubscribe_request.json +16 -0
  49. package/fixtures/external-clients/daemon_logs_unsubscribe_response.json +19 -0
  50. package/fixtures/external-clients/daemon_status_request.json +16 -0
  51. package/fixtures/external-clients/daemon_status_response.json +60 -0
  52. package/fixtures/external-clients/daemon_status_subscribe_request.json +16 -0
  53. package/fixtures/external-clients/daemon_status_subscribe_response.json +64 -0
  54. package/fixtures/external-clients/daemon_status_unsubscribe_request.json +16 -0
  55. package/fixtures/external-clients/daemon_status_unsubscribe_response.json +19 -0
  56. package/fixtures/external-clients/daemon_status_update.json +58 -0
  57. package/fixtures/external-clients/fetch_agent_timeline_request.json +19 -0
  58. package/fixtures/external-clients/fetch_agent_timeline_response.json +55 -0
  59. package/fixtures/external-clients/health.json +16 -0
  60. package/fixtures/external-clients/hello.json +19 -0
  61. package/fixtures/external-clients/interrupt_agent.json +17 -0
  62. package/fixtures/external-clients/interrupt_response.json +18 -0
  63. package/fixtures/external-clients/list_agents_request.json +16 -0
  64. package/fixtures/external-clients/list_agents_response.json +39 -0
  65. package/fixtures/external-clients/manifest.json +321 -0
  66. package/fixtures/external-clients/ping.json +14 -0
  67. package/fixtures/external-clients/pong.json +16 -0
  68. package/fixtures/external-clients/rpc_error.json +18 -0
  69. package/fixtures/external-clients/status.server_info.json +27 -0
  70. package/package.json +5 -3
package/dist/messages.js CHANGED
@@ -241,6 +241,14 @@ export const agentStreamEventSchema = z.discriminatedUnion("kind", [
241
241
  callId: z.string().optional(),
242
242
  tool: toolCallDetailSchema,
243
243
  status: z.string().optional(),
244
+ /**
245
+ * Ephemeral in-flight output snapshot (Pi `tool_execution_update`). Producer contract: broadcast
246
+ * with no `seq`, never appended to the timeline, never replayed from history, and never sent
247
+ * after the call's terminal event. Consumer contract: upsert by `callId` and let the snapshot
248
+ * supersede earlier output — never accumulate. Describes the delivery, not the tool call, so a
249
+ * client must not store it on its row model.
250
+ */
251
+ partial: z.boolean().optional(),
244
252
  }),
245
253
  z.object({ kind: z.literal("turn_started"), turnId: z.string().optional() }),
246
254
  z.object({ kind: z.literal("turn_completed"), turnId: z.string().optional() }),
@@ -311,7 +319,8 @@ export const fetchAgentTimelineResponseSchema = z.object({
311
319
  endCursor: z.string().nullable().optional(),
312
320
  });
313
321
  // ===========================================================================
314
- // Tool-call permissions
322
+ // Tool-call permissions — RETIRED (sprint-086): schemas kept (append-only), never read or
323
+ // registered by the daemon; every type here answers `rpc_error unknown_message_type`.
315
324
  // ===========================================================================
316
325
  export const agentPermissionRequestSchema = z.object({
317
326
  type: z.literal("agent_permission_request"),
@@ -1054,6 +1063,156 @@ export const viewerSettingsUpdateSchema = z
1054
1063
  })
1055
1064
  .passthrough();
1056
1065
  // ===========================================================================
1066
+ // Daemon status (swe/features/daemon-status-rpc.md) — read-only process observability:
1067
+ // one-shot `daemon_status_request`, plus a per-session subscription that pushes
1068
+ // `daemon_status_update` every 5 s to subscribers only. The gating flag
1069
+ // is `daemonObservability` (shared with the log family); `daemonStatusRpc` stays untouched and
1070
+ // handler-less. `transport` is a strict enum: both values are daemon-defined.
1071
+ // ===========================================================================
1072
+ export const daemonClientInfoSchema = z
1073
+ .object({
1074
+ clientId: z.string(),
1075
+ clientType: z.string(),
1076
+ appVersion: z.string().optional(),
1077
+ connectedAt: z.number(),
1078
+ remoteAddress: z.string().optional(),
1079
+ transport: z.enum(["direct", "relay"]),
1080
+ })
1081
+ .passthrough();
1082
+ export const daemonStatusSchema = z
1083
+ .object({
1084
+ version: z.string(),
1085
+ startedAt: z.number(),
1086
+ uptimeMs: z.number(),
1087
+ pid: z.number(),
1088
+ nodeVersion: z.string(),
1089
+ memory: z
1090
+ .object({ rss: z.number(), heapUsed: z.number(), heapTotal: z.number() })
1091
+ .passthrough(),
1092
+ cpuPercent: z.number(),
1093
+ eventLoopLagMs: z.number(),
1094
+ agentsByStatus: z.record(z.string(), z.number()),
1095
+ clients: z.array(daemonClientInfoSchema),
1096
+ })
1097
+ .passthrough();
1098
+ export const daemonStatusRequestSchema = z
1099
+ .object({
1100
+ type: z.literal("daemon_status_request"),
1101
+ requestId: z.string(),
1102
+ })
1103
+ .passthrough();
1104
+ export const daemonStatusResponseSchema = z
1105
+ .object({
1106
+ type: z.literal("daemon_status_response"),
1107
+ requestId: z.string(),
1108
+ payload: daemonStatusSchema,
1109
+ })
1110
+ .passthrough();
1111
+ export const daemonStatusSubscribeRequestSchema = z
1112
+ .object({
1113
+ type: z.literal("daemon_status_subscribe_request"),
1114
+ requestId: z.string(),
1115
+ })
1116
+ .passthrough();
1117
+ export const daemonStatusSubscribeResponseSchema = z
1118
+ .object({
1119
+ type: z.literal("daemon_status_subscribe_response"),
1120
+ requestId: z.string(),
1121
+ payload: z.union([
1122
+ z
1123
+ .object({
1124
+ ok: z.literal(true),
1125
+ intervalMs: z.number(),
1126
+ status: daemonStatusSchema,
1127
+ })
1128
+ .passthrough(),
1129
+ z.object({ ok: z.literal(false), error: z.string() }).passthrough(),
1130
+ ]),
1131
+ })
1132
+ .passthrough();
1133
+ export const daemonStatusUnsubscribeRequestSchema = z
1134
+ .object({
1135
+ type: z.literal("daemon_status_unsubscribe_request"),
1136
+ requestId: z.string(),
1137
+ })
1138
+ .passthrough();
1139
+ export const daemonStatusUnsubscribeResponseSchema = z
1140
+ .object({
1141
+ type: z.literal("daemon_status_unsubscribe_response"),
1142
+ requestId: z.string(),
1143
+ payload: z.object({ ok: z.boolean() }).passthrough(),
1144
+ })
1145
+ .passthrough();
1146
+ /** Flat push to subscribed sessions only; carries no `requestId`. */
1147
+ export const daemonStatusUpdateSchema = z
1148
+ .object({
1149
+ type: z.literal("daemon_status_update"),
1150
+ payload: daemonStatusSchema,
1151
+ })
1152
+ .passthrough();
1153
+ // ===========================================================================
1154
+ // Daemon log streaming (swe/features/daemon-log-streaming.md) — per-session, filtered,
1155
+ // rate-capped tail of the daemon logger. `minLevel`/`tail` are validated daemon-side so a bad
1156
+ // value yields a domain `invalid_level`/`invalid_tail` response, never an `rpc_error`; the
1157
+ // request schema is therefore deliberately loose on those two fields. `LogLine.level` is an open
1158
+ // string (the six pino names today) so a future level still parses.
1159
+ // ===========================================================================
1160
+ export const logLineSchema = z
1161
+ .object({
1162
+ time: z.number(),
1163
+ level: z.string(),
1164
+ msg: z.string(),
1165
+ fields: z.record(z.string(), z.unknown()).optional(),
1166
+ })
1167
+ .passthrough();
1168
+ export const daemonLogsSubscribeRequestSchema = z
1169
+ .object({
1170
+ type: z.literal("daemon_logs_subscribe_request"),
1171
+ requestId: z.string(),
1172
+ minLevel: z.string(),
1173
+ tail: z.number().optional(),
1174
+ })
1175
+ .passthrough();
1176
+ export const daemonLogsSubscribeResponseSchema = z
1177
+ .object({
1178
+ type: z.literal("daemon_logs_subscribe_response"),
1179
+ requestId: z.string(),
1180
+ payload: z.union([
1181
+ z
1182
+ .object({
1183
+ ok: z.literal(true),
1184
+ minLevel: z.string(),
1185
+ effectiveLevel: z.string(),
1186
+ lines: z.array(logLineSchema),
1187
+ dropped: z.number(),
1188
+ })
1189
+ .passthrough(),
1190
+ z.object({ ok: z.literal(false), error: z.string() }).passthrough(),
1191
+ ]),
1192
+ })
1193
+ .passthrough();
1194
+ export const daemonLogsUnsubscribeRequestSchema = z
1195
+ .object({
1196
+ type: z.literal("daemon_logs_unsubscribe_request"),
1197
+ requestId: z.string(),
1198
+ })
1199
+ .passthrough();
1200
+ export const daemonLogsUnsubscribeResponseSchema = z
1201
+ .object({
1202
+ type: z.literal("daemon_logs_unsubscribe_response"),
1203
+ requestId: z.string(),
1204
+ payload: z.object({ ok: z.boolean() }).passthrough(),
1205
+ })
1206
+ .passthrough();
1207
+ /** Flat push to subscribed sessions only; carries no `requestId`. `dropped` is incremental. */
1208
+ export const daemonLogLinesSchema = z
1209
+ .object({
1210
+ type: z.literal("daemon_log_lines"),
1211
+ lines: z.array(logLineSchema),
1212
+ dropped: z.number(),
1213
+ })
1214
+ .passthrough();
1215
+ // ===========================================================================
1057
1216
  // Skills (swe/architecture/pi-resource-management.md § Wire family `skills_*`) — sprint-075
1058
1217
  // slice 1: list + toggle only. Preview/install/remove/update_all land in sprints 076-077 and
1059
1218
  // reuse `skillInfoSchema`/`piPackageInfoSchema` below.
@@ -1582,6 +1741,18 @@ export const sessionMessageSchema = z.discriminatedUnion("type", [
1582
1741
  viewerSettingsSetRequestSchema,
1583
1742
  viewerSettingsSetResponseSchema,
1584
1743
  viewerSettingsUpdateSchema,
1744
+ daemonStatusRequestSchema,
1745
+ daemonStatusResponseSchema,
1746
+ daemonStatusSubscribeRequestSchema,
1747
+ daemonStatusSubscribeResponseSchema,
1748
+ daemonStatusUnsubscribeRequestSchema,
1749
+ daemonStatusUnsubscribeResponseSchema,
1750
+ daemonStatusUpdateSchema,
1751
+ daemonLogsSubscribeRequestSchema,
1752
+ daemonLogsSubscribeResponseSchema,
1753
+ daemonLogsUnsubscribeRequestSchema,
1754
+ daemonLogsUnsubscribeResponseSchema,
1755
+ daemonLogLinesSchema,
1585
1756
  skillsListRequestSchema,
1586
1757
  skillsListResponseSchema,
1587
1758
  skillsSetEnabledRequestSchema,