@spencerboucher/switchyard-client 0.16.0 → 0.18.0

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/index.js CHANGED
@@ -64,7 +64,7 @@ var ApiClient = class {
64
64
  };
65
65
 
66
66
  // packages/protocol/dist/adapter-preview.js
67
- import { z as z8 } from "zod";
67
+ import { z as z7 } from "zod";
68
68
 
69
69
  // packages/protocol/dist/contributions.js
70
70
  import { z as z3 } from "zod";
@@ -414,7 +414,7 @@ function contributionSlot(id) {
414
414
  }
415
415
 
416
416
  // packages/protocol/dist/entities.js
417
- import { z as z7 } from "zod";
417
+ import { z as z6 } from "zod";
418
418
 
419
419
  // packages/protocol/dist/github.js
420
420
  import { z as z4 } from "zod";
@@ -964,346 +964,225 @@ var PolicyTestRequest = z5.object({
964
964
  request: PolicyRequestContext.nullable()
965
965
  }).strict().refine((v) => v.phase === "tool_call" ? v.tool !== null && v.request === null : v.tool === null && v.request !== null);
966
966
 
967
- // packages/protocol/dist/trackers.js
968
- import { z as z6 } from "zod";
969
- var Iso = z6.string();
970
- var Id4 = z6.string().min(1);
971
- var GitHubLogin = z6.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
972
- var TrackerStatusOption = z6.object({
973
- id: z6.string().min(1),
974
- name: z6.string().min(1).max(200)
975
- });
976
- var TrackerBoard = z6.object({
977
- projectNumber: z6.number().int().positive(),
978
- statusField: z6.string().min(1).max(100).default("Status"),
979
- /** Column to move a card to once its worktree exists (write-back). */
980
- onStart: z6.string().min(1).max(200).nullable().default(null),
981
- /** Column to move a card to once a pull request is open (write-back). */
982
- onReview: z6.string().min(1).max(200).nullable().default(null)
983
- });
984
- var Tracker = z6.object({
985
- id: Id4,
986
- name: z6.string().min(1).max(60),
987
- provider: z6.literal("github"),
988
- hostId: Id4,
989
- owner: GitHubLogin,
990
- repositories: z6.array(GitHubRepository).min(1).max(50).nullable(),
991
- /** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
992
- extraRepositories: z6.array(GitHubRepository).max(20).optional(),
993
- board: TrackerBoard.nullable(),
994
- writeBack: z6.boolean(),
995
- moveShared: z6.boolean(),
996
- enabled: z6.boolean(),
997
- /** The host's `gh` user, from the last sync. */
998
- login: z6.string().nullable(),
999
- lastSyncedAt: Iso.nullable(),
1000
- lastError: z6.string().max(2e3).nullable(),
1001
- createdAt: Iso,
1002
- updatedAt: Iso
1003
- });
1004
- var TrackerInput = z6.object({
1005
- name: Tracker.shape.name,
1006
- hostId: Id4,
1007
- owner: GitHubLogin,
1008
- repositories: Tracker.shape.repositories.default(null),
1009
- extraRepositories: z6.array(GitHubRepository).max(20).default([]),
1010
- board: TrackerBoard.nullable().default(null),
1011
- writeBack: z6.boolean().default(false),
1012
- moveShared: z6.boolean().default(true),
1013
- enabled: z6.boolean().default(true)
1014
- });
1015
- var TrackerPatch = z6.object({
1016
- name: Tracker.shape.name.optional(),
1017
- hostId: Id4.optional(),
1018
- owner: GitHubLogin.optional(),
1019
- repositories: Tracker.shape.repositories.optional(),
1020
- extraRepositories: z6.array(GitHubRepository).max(20).optional(),
1021
- board: TrackerBoard.nullable().optional(),
1022
- writeBack: z6.boolean().optional(),
1023
- moveShared: z6.boolean().optional(),
1024
- enabled: z6.boolean().optional()
1025
- });
1026
- var TrackerItemBoard = z6.object({
1027
- projectId: z6.string().min(1),
1028
- projectItemId: z6.string().min(1),
1029
- fieldId: z6.string().min(1),
1030
- status: z6.string().nullable(),
1031
- statusOptionId: z6.string().nullable(),
1032
- options: z6.array(TrackerStatusOption).max(50)
1033
- });
1034
- var TrackerPullRequest = z6.object({
1035
- number: z6.number().int().positive(),
1036
- state: z6.enum(["OPEN", "CLOSED", "MERGED"]),
1037
- url: z6.string().url(),
1038
- headRefName: z6.string().min(1).max(255)
1039
- });
1040
- var TrackerItem = z6.object({
1041
- itemId: z6.string().min(1),
1042
- repository: GitHubRepository,
1043
- number: z6.number().int().positive(),
1044
- title: z6.string().min(1).max(1e3),
1045
- url: GitHubIssueUrl,
1046
- assignees: z6.array(z6.string()).max(20),
1047
- branches: z6.array(z6.string().min(1).max(255)).max(10),
1048
- pullRequest: TrackerPullRequest.nullable(),
1049
- board: TrackerItemBoard.nullable()
1050
- });
1051
- var TrackerSyncResult = z6.object({
1052
- login: z6.string().min(1),
1053
- items: z6.array(TrackerItem).max(200),
1054
- truncated: z6.boolean()
1055
- });
1056
- var TaskTracker = z6.object({
1057
- trackerId: Id4,
1058
- itemId: z6.string().min(1),
1059
- repository: GitHubRepository,
1060
- number: z6.number().int().positive(),
1061
- assignees: z6.array(z6.string()).max(20),
1062
- branch: z6.string().nullable(),
1063
- workspaceId: Id4.nullable(),
1064
- pullRequest: TrackerPullRequest.nullable(),
1065
- board: TrackerItemBoard.nullable()
1066
- });
1067
- var TrackerSetStatusResult = z6.discriminatedUnion("status", [
1068
- z6.object({ status: z6.literal("moved") }),
1069
- z6.object({
1070
- status: z6.literal("skipped"),
1071
- reason: z6.enum(["not_assigned", "shared", "stale"])
1072
- })
1073
- ]);
1074
- var TrackerStatusRequest = z6.object({ status: z6.string().min(1).max(200) });
1075
- var TrackerHostSyncRequest = z6.object({
1076
- owner: GitHubLogin,
1077
- repositories: z6.array(GitHubRepository).nullable(),
1078
- board: z6.object({ projectNumber: z6.number().int().positive(), statusField: z6.string().min(1) }).nullable()
1079
- });
1080
- var TrackerHostPrepareBranchRequest = z6.object({
1081
- checkoutPath: z6.string().min(1),
1082
- branch: z6.string().min(1).max(255)
1083
- });
1084
- var TrackerHostStartIssueRequest = z6.object({
1085
- checkoutPath: z6.string().min(1),
1086
- repository: GitHubRepository,
1087
- number: z6.number().int().positive(),
1088
- branch: z6.string().min(1).max(255),
1089
- base: z6.string().min(1)
1090
- });
1091
- var TrackerHostSetStatusRequest = z6.object({
1092
- projectId: z6.string().min(1),
1093
- projectItemId: z6.string().min(1),
1094
- fieldId: z6.string().min(1),
1095
- statusField: z6.string().min(1),
1096
- optionId: z6.string().min(1),
1097
- expectedOptionId: z6.string().nullable(),
1098
- login: z6.string().min(1),
1099
- allowShared: z6.boolean()
1100
- });
1101
-
1102
967
  // packages/protocol/dist/entities.js
1103
- var Iso2 = z7.string();
1104
- var Id5 = z7.string();
1105
- var Connectivity = z7.enum(["connected", "reconnecting", "unreachable"]);
1106
- var ControlMode = z7.enum(["automation", "human"]);
1107
- var Platform = z7.enum(["darwin", "linux"]);
1108
- var DeviceKind = z7.enum(["browser", "pwa", "terminal", "cli"]);
1109
- var DiagnosticLevel = z7.enum(["info", "warning", "error"]);
968
+ var Iso = z6.string();
969
+ var Id4 = z6.string();
970
+ var Connectivity = z6.enum(["connected", "reconnecting", "unreachable"]);
971
+ var ControlMode = z6.enum(["automation", "human"]);
972
+ var Platform = z6.enum(["darwin", "linux"]);
973
+ var DeviceKind = z6.enum(["browser", "pwa", "terminal", "cli"]);
974
+ var DiagnosticLevel = z6.enum(["info", "warning", "error"]);
1110
975
  var DEFAULT_WORKTREE_DIR = ".worktrees";
1111
- var CoreCapabilities = z7.object({
1112
- prompt: z7.boolean(),
1113
- steer: z7.boolean(),
1114
- followUp: z7.boolean(),
1115
- abort: z7.boolean(),
1116
- resume: z7.boolean(),
1117
- rename: z7.boolean(),
1118
- importInactive: z7.boolean(),
1119
- extensionDialogs: z7.boolean(),
1120
- customUi: z7.boolean(),
1121
- widgetsText: z7.boolean(),
1122
- widgetsComponent: z7.boolean(),
1123
- tokenAccounting: z7.boolean(),
1124
- costAccounting: z7.boolean()
976
+ var CoreCapabilities = z6.object({
977
+ prompt: z6.boolean(),
978
+ steer: z6.boolean(),
979
+ followUp: z6.boolean(),
980
+ abort: z6.boolean(),
981
+ resume: z6.boolean(),
982
+ rename: z6.boolean(),
983
+ importInactive: z6.boolean(),
984
+ extensionDialogs: z6.boolean(),
985
+ customUi: z6.boolean(),
986
+ widgetsText: z6.boolean(),
987
+ widgetsComponent: z6.boolean(),
988
+ tokenAccounting: z6.boolean(),
989
+ costAccounting: z6.boolean()
1125
990
  });
1126
991
  var CAPABILITY_KEYS = CoreCapabilities.keyof().options;
1127
992
  var RuntimeCapabilities = CoreCapabilities.extend({
1128
993
  /** The host runs sessions as interactive Pi in a terminal that clients can attach to. */
1129
- terminal: z7.boolean().optional(),
994
+ terminal: z6.boolean().optional(),
1130
995
  /** The host answers session.models, session.commands, session.setModel, session.setThinking and session.compact. */
1131
- sessionControls: z7.boolean().optional(),
996
+ sessionControls: z6.boolean().optional(),
1132
997
  /** The host answers session.navigate for terminal sessions. */
1133
- treeNavigation: z7.boolean().optional(),
1134
- agentRequests: z7.boolean().optional(),
1135
- messageDelivery: z7.boolean().optional(),
1136
- policies: z7.boolean().optional(),
998
+ treeNavigation: z6.boolean().optional(),
999
+ agentRequests: z6.boolean().optional(),
1000
+ messageDelivery: z6.boolean().optional(),
1001
+ policies: z6.boolean().optional(),
1137
1002
  /** Session-scoped adapter inspection and safe reload. */
1138
- adapterDevelopment: z7.boolean().optional(),
1139
- unsupported: z7.array(z7.object({ capability: z7.string(), reason: z7.string() }))
1003
+ adapterDevelopment: z6.boolean().optional(),
1004
+ unsupported: z6.array(z6.object({ capability: z6.string(), reason: z6.string() }))
1140
1005
  });
1141
- var ProjectScan = z7.object({
1142
- state: z7.enum(["running", "done", "failed"]),
1143
- startedAt: Iso2,
1144
- finishedAt: Iso2.nullable(),
1006
+ var ProjectScan = z6.object({
1007
+ state: z6.enum(["running", "done", "failed"]),
1008
+ startedAt: Iso,
1009
+ finishedAt: Iso.nullable(),
1145
1010
  /** Repositories found across all folders. */
1146
- repositories: z7.number().int(),
1011
+ repositories: z6.number().int(),
1147
1012
  /** New projects created by this scan. */
1148
- projectsCreated: z7.number().int(),
1013
+ projectsCreated: z6.number().int(),
1149
1014
  /** New checkouts (including the ones of new projects). */
1150
- checkoutsAdded: z7.number().int(),
1015
+ checkoutsAdded: z6.number().int(),
1151
1016
  /** "<folder>: <message>" per folder that failed; for state "failed", the reason last. */
1152
- errors: z7.array(z7.string())
1153
- });
1154
- var UsageWindow = z7.object({
1155
- id: z7.enum(["five_hour", "weekly"]),
1156
- usedPct: z7.number(),
1157
- resetsAt: Iso2.nullable()
1158
- });
1159
- var ProviderUsage = z7.object({
1160
- provider: z7.enum(["anthropic", "openai-codex"]),
1161
- status: z7.enum(["available", "expired", "rejected", "error"]),
1162
- message: z7.string().nullable(),
1163
- windows: z7.array(UsageWindow),
1164
- fetchedAt: Iso2
1165
- });
1166
- var Host = z7.object({
1167
- id: Id5,
1168
- name: z7.string(),
1017
+ errors: z6.array(z6.string())
1018
+ });
1019
+ var UsageWindow = z6.object({
1020
+ id: z6.enum(["five_hour", "weekly"]),
1021
+ usedPct: z6.number(),
1022
+ resetsAt: Iso.nullable()
1023
+ });
1024
+ var ProviderUsage = z6.object({
1025
+ provider: z6.enum(["anthropic", "openai-codex"]),
1026
+ status: z6.enum(["available", "expired", "rejected", "error"]),
1027
+ message: z6.string().nullable(),
1028
+ windows: z6.array(UsageWindow),
1029
+ fetchedAt: Iso
1030
+ });
1031
+ var Host = z6.object({
1032
+ id: Id4,
1033
+ name: z6.string(),
1169
1034
  platform: Platform,
1170
- agentVersion: z7.string(),
1171
- piVersion: z7.string().nullable(),
1172
- piCompatible: z7.boolean(),
1035
+ agentVersion: z6.string(),
1036
+ piVersion: z6.string().nullable(),
1037
+ piCompatible: z6.boolean(),
1173
1038
  capabilities: RuntimeCapabilities.nullable(),
1174
1039
  connectivity: Connectivity,
1175
- lastSeenAt: Iso2.nullable(),
1176
- revokedAt: Iso2.nullable(),
1177
- createdAt: Iso2,
1040
+ lastSeenAt: Iso.nullable(),
1041
+ revokedAt: Iso.nullable(),
1042
+ createdAt: Iso,
1178
1043
  /** Folders on the host whose git repositories become projects (absolute or ~/...). */
1179
- projectFolders: z7.array(z7.string()).optional(),
1044
+ projectFolders: z6.array(z6.string()).optional(),
1180
1045
  projectScan: ProjectScan.nullable().optional(),
1181
1046
  /** Subscription limits (host-reported, refreshed every few minutes). */
1182
- usage: z7.array(ProviderUsage).optional(),
1047
+ usage: z6.array(ProviderUsage).optional(),
1183
1048
  github: HostGitHub.optional()
1184
1049
  });
1185
- var WorktreeDir = z7.string().min(1).refine((d) => !d.startsWith("/") && !d.includes("\\"), "must be a relative path").refine((d) => !d.split("/").includes(".."), "must stay inside the repository").refine((d) => d.split("/").every((s) => s.length > 0 && s !== "."), "must be a plain relative path");
1186
- var Project = z7.object({
1187
- id: Id5,
1188
- name: z7.string().min(1),
1189
- repoIdentity: z7.string(),
1190
- defaultProfileId: Id5.nullable(),
1191
- defaultHostId: Id5.nullable(),
1192
- maxConcurrentRuns: z7.number().int().min(1).max(32),
1193
- automationEnabled: z7.boolean(),
1194
- setupCommand: z7.string().nullable(),
1195
- checks: z7.array(z7.string()),
1196
- workspaceSharing: z7.enum(["single_writer", "shared"]),
1050
+ var WorktreeDir = z6.string().min(1).refine((d) => !d.startsWith("/") && !d.includes("\\"), "must be a relative path").refine((d) => !d.split("/").includes(".."), "must stay inside the repository").refine((d) => d.split("/").every((s) => s.length > 0 && s !== "."), "must be a plain relative path");
1051
+ var Project = z6.object({
1052
+ id: Id4,
1053
+ name: z6.string().min(1),
1054
+ repoIdentity: z6.string(),
1055
+ defaultProfileId: Id4.nullable(),
1056
+ defaultHostId: Id4.nullable(),
1057
+ maxConcurrentRuns: z6.number().int().min(1).max(32),
1058
+ automationEnabled: z6.boolean(),
1059
+ setupCommand: z6.string().nullable(),
1060
+ checks: z6.array(z6.string()),
1061
+ workspaceSharing: z6.enum(["single_writer", "shared"]),
1197
1062
  worktreeDir: WorktreeDir.default(DEFAULT_WORKTREE_DIR),
1198
1063
  /** Start one session in every non-main worktree the first time it appears without one. */
1199
- ensureSessions: z7.boolean().default(false),
1064
+ ensureSessions: z6.boolean().default(false),
1200
1065
  /** Archive sessions and remove a worktree (and its local branch) once its PR has merged. */
1201
- removeLanded: z7.boolean().default(false),
1202
- createdAt: Iso2,
1203
- updatedAt: Iso2
1066
+ removeLanded: z6.boolean().default(false),
1067
+ createdAt: Iso,
1068
+ updatedAt: Iso
1204
1069
  });
1205
- var Checkout = z7.object({
1206
- id: Id5,
1207
- projectId: Id5,
1208
- hostId: Id5,
1209
- path: z7.string(),
1210
- commonDir: z7.string(),
1211
- defaultBranch: z7.string(),
1212
- createdAt: Iso2
1213
- });
1214
- var GitState = z7.object({
1215
- dirty: z7.boolean(),
1216
- changedFiles: z7.number().int(),
1217
- ahead: z7.number().int(),
1218
- behind: z7.number().int(),
1219
- unmerged: z7.boolean(),
1070
+ var Checkout = z6.object({
1071
+ id: Id4,
1072
+ projectId: Id4,
1073
+ hostId: Id4,
1074
+ path: z6.string(),
1075
+ commonDir: z6.string(),
1076
+ defaultBranch: z6.string(),
1077
+ createdAt: Iso
1078
+ });
1079
+ var GitState = z6.object({
1080
+ dirty: z6.boolean(),
1081
+ changedFiles: z6.number().int(),
1082
+ ahead: z6.number().int(),
1083
+ behind: z6.number().int(),
1084
+ unmerged: z6.boolean(),
1220
1085
  /** HEAD commit; absent from older hosts. */
1221
- head: z7.string().regex(/^[0-9a-f]{40}$/).optional()
1222
- });
1223
- var Workspace = z7.object({
1224
- id: Id5,
1225
- checkoutId: Id5,
1226
- projectId: Id5,
1227
- hostId: Id5,
1228
- path: z7.string(),
1229
- branch: z7.string().nullable(),
1230
- baseBranch: z7.string().nullable(),
1231
- provenance: z7.enum(["managed", "discovered", "main"]),
1086
+ head: z6.string().regex(/^[0-9a-f]{40}$/).optional()
1087
+ });
1088
+ var Workspace = z6.object({
1089
+ id: Id4,
1090
+ checkoutId: Id4,
1091
+ projectId: Id4,
1092
+ hostId: Id4,
1093
+ path: z6.string(),
1094
+ branch: z6.string().nullable(),
1095
+ baseBranch: z6.string().nullable(),
1096
+ provenance: z6.enum(["managed", "discovered", "main"]),
1232
1097
  git: GitState,
1233
- setup: z7.object({
1234
- state: z7.enum(["none", "running", "succeeded", "failed"]),
1235
- log: z7.string()
1098
+ setup: z6.object({
1099
+ state: z6.enum(["none", "running", "succeeded", "failed"]),
1100
+ log: z6.string()
1236
1101
  }),
1237
- archivedAt: Iso2.nullable(),
1238
- updatedAt: Iso2,
1102
+ archivedAt: Iso.nullable(),
1103
+ updatedAt: Iso,
1239
1104
  github: WorkspaceGitHub.optional()
1240
1105
  });
1241
- var ThinkingLevel = z7.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
1242
- var SessionModel = z7.object({
1243
- provider: z7.string(),
1244
- id: z7.string(),
1245
- name: z7.string().nullable(),
1246
- contextWindow: z7.number().nullable(),
1247
- reasoning: z7.boolean(),
1106
+ var ThinkingLevel = z6.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
1107
+ var SessionModel = z6.object({
1108
+ provider: z6.string(),
1109
+ id: z6.string(),
1110
+ name: z6.string().nullable(),
1111
+ contextWindow: z6.number().nullable(),
1112
+ reasoning: z6.boolean(),
1248
1113
  /** In Pi's scoped (favorite) model list; set only when Pi has one. */
1249
- scoped: z7.boolean().optional(),
1114
+ scoped: z6.boolean().optional(),
1250
1115
  /** Effort levels this model accepts, in Pi's order; ["off"] without reasoning. */
1251
- thinkingLevels: z7.array(ThinkingLevel),
1116
+ thinkingLevels: z6.array(ThinkingLevel),
1252
1117
  /** Prompt-cache lifetimes in seconds from Pi's model metadata. */
1253
- promptCache: z7.object({ short: z7.number().optional(), long: z7.number().optional() }).nullable().optional()
1118
+ promptCache: z6.object({ short: z6.number().optional(), long: z6.number().optional() }).nullable().optional()
1254
1119
  });
1255
- var SlashCommand = z7.object({
1256
- name: z7.string().min(1),
1257
- description: z7.string().nullable(),
1258
- source: z7.enum(["extension", "prompt", "skill"]),
1259
- argumentHint: z7.string().nullable().optional()
1120
+ var SlashCommand = z6.object({
1121
+ name: z6.string().min(1),
1122
+ description: z6.string().nullable(),
1123
+ source: z6.enum(["extension", "prompt", "skill"]),
1124
+ argumentHint: z6.string().nullable().optional()
1260
1125
  });
1261
- var ContextUsage = z7.object({
1126
+ var ContextUsage = z6.object({
1262
1127
  /** Estimated tokens in context; null right after compaction until the next reply. */
1263
- tokens: z7.number().nullable(),
1264
- window: z7.number(),
1265
- percent: z7.number().nullable()
1128
+ tokens: z6.number().nullable(),
1129
+ window: z6.number(),
1130
+ percent: z6.number().nullable()
1266
1131
  });
1267
1132
  var FORBIDDEN_EXTRA_ARGS = ["--mode", "--fork", "--no-session", "-e", "--extension"];
1268
- var ExtraArg = z7.string().refine((a) => a.startsWith("--") || !a.startsWith("-"), "extra args must be long flags").refine((a) => !FORBIDDEN_EXTRA_ARGS.includes(a.split("=")[0]) && !a.startsWith("--session"), "this flag is managed by Switchyard");
1269
- var Profile = z7.object({
1270
- id: Id5,
1271
- name: z7.string().min(1),
1272
- provider: z7.string().nullable(),
1273
- model: z7.string().nullable(),
1133
+ var ExtraArg = z6.string().refine((a) => a.startsWith("--") || !a.startsWith("-"), "extra args must be long flags").refine((a) => !FORBIDDEN_EXTRA_ARGS.includes(a.split("=")[0]) && !a.startsWith("--session"), "this flag is managed by Switchyard");
1134
+ var Profile = z6.object({
1135
+ id: Id4,
1136
+ name: z6.string().min(1),
1137
+ provider: z6.string().nullable(),
1138
+ model: z6.string().nullable(),
1274
1139
  thinking: ThinkingLevel.nullable(),
1275
- projectTrust: z7.enum(["ask", "approve", "ignore"]),
1276
- extraArgs: z7.array(ExtraArg),
1140
+ projectTrust: z6.enum(["ask", "approve", "ignore"]),
1141
+ extraArgs: z6.array(ExtraArg),
1277
1142
  /** "vanilla": --no-extensions --no-skills --no-prompt-templates. Undefined means "all". */
1278
- resources: z7.enum(["all", "vanilla"]).optional()
1143
+ resources: z6.enum(["all", "vanilla"]).optional()
1279
1144
  });
1280
- var ViewClient = z7.object({
1145
+ var ViewClient = z6.object({
1281
1146
  /** `${kind}:${name}@${machine}` */
1282
- id: z7.string().min(1),
1283
- kind: z7.enum(["herdr", "tmux"]),
1284
- name: z7.string().min(1),
1285
- machine: z7.string().min(1),
1286
- lastSeenAt: Iso2
1287
- });
1288
- var View = z7.object({
1289
- id: Id5,
1290
- name: z7.string().min(1).max(60),
1291
- mode: z7.enum(["all", "pinned"]),
1292
- projectIds: z7.array(z7.string()).nullable(),
1293
- hostIds: z7.array(z7.string()).nullable(),
1294
- sessionIds: z7.array(z7.string()),
1295
- clients: z7.array(ViewClient),
1147
+ id: z6.string().min(1),
1148
+ kind: z6.enum(["herdr", "tmux"]),
1149
+ name: z6.string().min(1),
1150
+ machine: z6.string().min(1),
1151
+ lastSeenAt: Iso
1152
+ });
1153
+ var View = z6.object({
1154
+ id: Id4,
1155
+ name: z6.string().min(1).max(60),
1156
+ mode: z6.enum(["all", "pinned"]),
1157
+ projectIds: z6.array(z6.string()).nullable(),
1158
+ hostIds: z6.array(z6.string()).nullable(),
1159
+ sessionIds: z6.array(z6.string()),
1160
+ /** Deprecated: always empty; see Surface. */
1161
+ clients: z6.array(ViewClient).default([]),
1296
1162
  /** A tracker keeps this view's projects (see docs/trackers.md). */
1297
- trackerId: z7.string().nullable().optional(),
1163
+ trackerId: z6.string().nullable().optional(),
1298
1164
  /**
1299
- * A client as membership authority: sessions enrolled from this client (`ViewClient` id,
1300
- * `herdr:<session>@<machine>`) are pinned here when they first appear.
1165
+ * The source surface (`herdr:<session>@<machine>`): sessions started in it
1166
+ * (`Session.startedIn`) belong to this view.
1301
1167
  */
1302
- clientId: z7.string().min(1).max(200).nullable().optional(),
1303
- createdAt: Iso2,
1304
- updatedAt: Iso2
1168
+ clientId: z6.string().min(1).max(200).nullable().optional(),
1169
+ createdAt: Iso,
1170
+ updatedAt: Iso
1305
1171
  });
1306
- var RuntimeState = z7.enum([
1172
+ var SurfaceKind = z6.enum(["herdr", "tmux"]);
1173
+ var Surface = z6.object({
1174
+ /** `${kind}:${name}@${machine}` */
1175
+ id: z6.string().min(1).max(200),
1176
+ kind: SurfaceKind,
1177
+ name: z6.string().min(1),
1178
+ machine: z6.string().min(1),
1179
+ deviceId: Id4,
1180
+ hostId: Id4.nullable(),
1181
+ viewId: Id4.nullable(),
1182
+ lastSeenAt: Iso,
1183
+ createdAt: Iso
1184
+ });
1185
+ var RuntimeState = z6.enum([
1307
1186
  "starting",
1308
1187
  "idle",
1309
1188
  "running",
@@ -1312,150 +1191,154 @@ var RuntimeState = z7.enum([
1312
1191
  "failed",
1313
1192
  "stopped"
1314
1193
  ]);
1315
- var NativeHandle = z7.object({ sessionId: z7.string(), sessionFile: z7.string() });
1316
- var SessionStats = z7.object({
1317
- tokens: z7.number().nullable(),
1318
- costUsd: z7.number().nullable(),
1194
+ var NativeHandle = z6.object({ sessionId: z6.string(), sessionFile: z6.string() });
1195
+ var SessionStats = z6.object({
1196
+ tokens: z6.number().nullable(),
1197
+ costUsd: z6.number().nullable(),
1319
1198
  /** Completed usage, refreshed for this exact settlement; absent on older hosts or failure. */
1320
1199
  watermark: CompletedUsageWatermark.optional(),
1321
1200
  context: ContextUsage.nullable().optional()
1322
1201
  });
1323
- var PromptCacheInfo = z7.object({
1324
- at: Iso2,
1325
- provider: z7.string(),
1326
- model: z7.string(),
1327
- cacheRead: z7.number(),
1328
- cacheWrite: z7.number(),
1329
- cacheWrite1h: z7.number()
1330
- });
1331
- var Session = z7.object({
1332
- id: Id5,
1333
- title: z7.string(),
1334
- subtitle: z7.string().nullable(),
1335
- hostId: Id5,
1336
- workspaceId: Id5.nullable(),
1337
- projectId: Id5.nullable(),
1338
- cwd: z7.string(),
1202
+ var PromptCacheInfo = z6.object({
1203
+ at: Iso,
1204
+ provider: z6.string(),
1205
+ model: z6.string(),
1206
+ cacheRead: z6.number(),
1207
+ cacheWrite: z6.number(),
1208
+ cacheWrite1h: z6.number()
1209
+ });
1210
+ var Session = z6.object({
1211
+ id: Id4,
1212
+ title: z6.string(),
1213
+ subtitle: z6.string().nullable(),
1214
+ hostId: Id4,
1215
+ workspaceId: Id4.nullable(),
1216
+ projectId: Id4.nullable(),
1217
+ cwd: z6.string(),
1339
1218
  nativeHandle: NativeHandle.nullable(),
1340
1219
  profileSnapshot: Profile,
1341
1220
  runtime: RuntimeState,
1342
- runtimeDetail: z7.string().nullable(),
1221
+ runtimeDetail: z6.string().nullable(),
1343
1222
  connectivity: Connectivity,
1344
- runId: Id5.nullable(),
1345
- taskId: Id5.nullable(),
1346
- provenance: z7.enum(["created", "imported", "subagent"]),
1347
- readOnly: z7.boolean(),
1348
- lastActivityAt: Iso2,
1349
- archivedAt: Iso2.nullable(),
1350
- queue: z7.object({ steering: z7.array(z7.string()), followUp: z7.array(z7.string()) }),
1223
+ runId: Id4.nullable(),
1224
+ taskId: Id4.nullable(),
1225
+ provenance: z6.enum(["created", "imported", "subagent"]),
1226
+ readOnly: z6.boolean(),
1227
+ lastActivityAt: Iso,
1228
+ archivedAt: Iso.nullable(),
1229
+ queue: z6.object({ steering: z6.array(z6.string()), followUp: z6.array(z6.string()) }),
1351
1230
  stats: SessionStats.nullable(),
1352
1231
  /** The live model (host-owned; last known when stopped). */
1353
1232
  model: SessionModel.nullable().optional(),
1354
1233
  /** The live effort (Pi's thinking level). */
1355
1234
  thinking: ThinkingLevel.nullable().optional(),
1356
1235
  /** Pi is compacting the context. */
1357
- compacting: z7.boolean().optional(),
1358
- lastAssistantText: z7.string().nullable(),
1359
- createdAt: Iso2,
1236
+ compacting: z6.boolean().optional(),
1237
+ lastAssistantText: z6.string().nullable(),
1238
+ createdAt: Iso,
1360
1239
  /** A live terminal session: `switchyard tui` can attach to its Pi terminal. */
1361
- terminal: z7.boolean().optional(),
1240
+ terminal: z6.boolean().optional(),
1362
1241
  /**
1363
1242
  * A Pi the user started in their own terminal and enrolled (`client`: the herdr session it runs
1364
1243
  * in, when known). Switchyard never shows or closes that terminal.
1365
1244
  */
1366
- external: z7.object({ client: z7.string().min(1).max(200).nullable() }).nullable().optional(),
1245
+ external: z6.object({ client: z6.string().min(1).max(200).nullable() }).nullable().optional(),
1246
+ /** The session this subagent was started by (coordinator-owned). */
1247
+ parentSessionId: Id4.nullable().optional(),
1248
+ /** Chosen as its branch's primary session (coordinator-owned); without one the primary is derived. */
1249
+ primary: z6.boolean().optional(),
1250
+ /** The surface this Pi was started in, e.g. `herdr:default@mac` (coordinator-owned, set once). */
1251
+ startedIn: z6.string().min(1).max(200).nullable().optional(),
1367
1252
  /** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
1368
- unreadSince: Iso2.nullable().optional(),
1253
+ unreadSince: Iso.nullable().optional(),
1369
1254
  /** Identity of the adapter presentation currently installed on the host. */
1370
- adapterGeneration: z7.string().uuid().optional(),
1255
+ adapterGeneration: z6.string().uuid().optional(),
1371
1256
  /** Bumped when the transcript is rebuilt (rewind); clients drop cached copies (coordinator-owned). */
1372
- transcriptEpoch: z7.number().int().min(0).optional(),
1373
- bridge: z7.object({
1374
- version: z7.literal(1),
1375
- runtimeId: Id5,
1376
- nativeSessionId: Id5,
1257
+ transcriptEpoch: z6.number().int().min(0).optional(),
1258
+ bridge: z6.object({
1259
+ version: z6.literal(1),
1260
+ runtimeId: Id4,
1261
+ nativeSessionId: Id4,
1377
1262
  /** Host-generated local-controller identity, not Pi's private binding credential. */
1378
- controllerEpoch: Id5.optional(),
1379
- agentTools: z7.boolean(),
1380
- messageDelivery: z7.boolean(),
1381
- policyState: z7.enum(["initializing", "active", "unsupported", "lost"]),
1382
- policyPhases: z7.array(PolicyPhase)
1263
+ controllerEpoch: Id4.optional(),
1264
+ agentTools: z6.boolean(),
1265
+ messageDelivery: z6.boolean(),
1266
+ policyState: z6.enum(["initializing", "active", "unsupported", "lost"]),
1267
+ policyPhases: z6.array(PolicyPhase)
1383
1268
  }).optional(),
1384
1269
  /** Last assistant message's cache usage (host-owned). */
1385
1270
  promptCache: PromptCacheInfo.nullable().optional(),
1386
1271
  /** Warn before the prompt cache expires; non-null means on (coordinator-owned). */
1387
- cacheAlert: z7.object({ ttlSec: z7.number().int().min(60).max(86400).nullable(), warnedFor: Iso2.nullable() }).nullable().optional()
1272
+ cacheAlert: z6.object({ ttlSec: z6.number().int().min(60).max(86400).nullable(), warnedFor: Iso.nullable() }).nullable().optional()
1388
1273
  });
1389
- var ContinuationPolicy = z7.discriminatedUnion("enabled", [
1390
- z7.object({ enabled: z7.literal(false) }),
1391
- z7.object({
1392
- enabled: z7.literal(true),
1393
- objective: z7.string().min(1),
1394
- maxContinuations: z7.number().int().min(1).max(50),
1395
- maxElapsedMinutes: z7.number().int().min(1).max(1440),
1396
- maxTokens: z7.number().int().positive().nullable(),
1397
- maxCostUsd: z7.number().positive().nullable()
1274
+ var ContinuationPolicy = z6.discriminatedUnion("enabled", [
1275
+ z6.object({ enabled: z6.literal(false) }),
1276
+ z6.object({
1277
+ enabled: z6.literal(true),
1278
+ objective: z6.string().min(1),
1279
+ maxContinuations: z6.number().int().min(1).max(50),
1280
+ maxElapsedMinutes: z6.number().int().min(1).max(1440),
1281
+ maxTokens: z6.number().int().positive().nullable(),
1282
+ maxCostUsd: z6.number().positive().nullable()
1398
1283
  })
1399
1284
  ]);
1400
- var CompletionPolicy = z7.object({
1401
- checks: z7.array(z7.string()).nullable(),
1402
- requireHumanReview: z7.boolean()
1285
+ var CompletionPolicy = z6.object({
1286
+ checks: z6.array(z6.string()).nullable(),
1287
+ requireHumanReview: z6.boolean()
1403
1288
  });
1404
- var WorkspacePolicy = z7.discriminatedUnion("mode", [
1405
- z7.object({
1406
- mode: z7.literal("new_worktree"),
1407
- branch: z7.string().nullable(),
1408
- base: z7.string().nullable()
1289
+ var WorkspacePolicy = z6.discriminatedUnion("mode", [
1290
+ z6.object({
1291
+ mode: z6.literal("new_worktree"),
1292
+ branch: z6.string().nullable(),
1293
+ base: z6.string().nullable()
1409
1294
  }),
1410
- z7.object({ mode: z7.literal("existing"), workspaceId: Id5 })
1295
+ z6.object({ mode: z6.literal("existing"), workspaceId: Id4 })
1411
1296
  ]);
1412
- var TaskPolicy = z7.object({
1413
- hostId: Id5.nullable(),
1414
- profileId: Id5.nullable(),
1297
+ var TaskPolicy = z6.object({
1298
+ hostId: Id4.nullable(),
1299
+ profileId: Id4.nullable(),
1415
1300
  workspace: WorkspacePolicy,
1416
1301
  continuation: ContinuationPolicy,
1417
1302
  completion: CompletionPolicy
1418
1303
  });
1419
- var TaskState = z7.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
1420
- var Priority = z7.union([z7.literal(0), z7.literal(1), z7.literal(2), z7.literal(3)]);
1421
- var TaskOrigin = z7.discriminatedUnion("kind", [
1422
- z7.object({ kind: z7.literal("manual") }),
1423
- z7.object({
1424
- kind: z7.literal("automation"),
1425
- automationId: Id5,
1426
- occurrenceId: Id5,
1427
- routine: z7.boolean()
1304
+ var TaskState = z6.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
1305
+ var Priority = z6.union([z6.literal(0), z6.literal(1), z6.literal(2), z6.literal(3)]);
1306
+ var TaskOrigin = z6.discriminatedUnion("kind", [
1307
+ z6.object({ kind: z6.literal("manual") }),
1308
+ z6.object({
1309
+ kind: z6.literal("automation"),
1310
+ automationId: Id4,
1311
+ occurrenceId: Id4,
1312
+ routine: z6.boolean()
1428
1313
  })
1429
1314
  ]);
1430
- var Task = z7.object({
1431
- id: Id5,
1432
- projectId: Id5,
1433
- title: z7.string().min(1),
1434
- objective: z7.string(),
1435
- acceptanceCriteria: z7.array(z7.string()),
1436
- dependencies: z7.array(Id5),
1315
+ var Task = z6.object({
1316
+ id: Id4,
1317
+ projectId: Id4,
1318
+ title: z6.string().min(1),
1319
+ objective: z6.string(),
1320
+ acceptanceCriteria: z6.array(z6.string()),
1321
+ dependencies: z6.array(Id4),
1437
1322
  priority: Priority,
1438
- position: z7.number(),
1323
+ position: z6.number(),
1439
1324
  state: TaskState,
1440
- blocked: z7.object({ reason: z7.string() }).nullable(),
1441
- notBefore: Iso2.nullable(),
1325
+ blocked: z6.object({ reason: z6.string() }).nullable(),
1326
+ notBefore: Iso.nullable(),
1442
1327
  policy: TaskPolicy,
1443
1328
  origin: TaskOrigin,
1444
- groupingKey: z7.string().nullable(),
1445
- parentTaskId: Id5.nullable().optional(),
1446
- agentOrigin: z7.object({ sessionId: Id5, toolCallId: Id5 }).optional(),
1329
+ groupingKey: z6.string().nullable(),
1330
+ parentTaskId: Id4.nullable().optional(),
1331
+ agentOrigin: z6.object({ sessionId: Id4, toolCallId: Id4 }).optional(),
1447
1332
  githubIssue: GitHubIssue.optional(),
1448
- /** Set while a tracker owns this task (server-owned). */
1449
- tracker: TaskTracker.optional(),
1450
- currentRunId: Id5.nullable(),
1451
- sessionId: Id5.nullable(),
1452
- review: z7.object({ feedback: z7.array(z7.string()), changesRequested: z7.boolean() }),
1453
- hiddenFromBoard: z7.boolean(),
1454
- lastActivityAt: Iso2,
1455
- createdAt: Iso2,
1456
- updatedAt: Iso2
1333
+ currentRunId: Id4.nullable(),
1334
+ sessionId: Id4.nullable(),
1335
+ review: z6.object({ feedback: z6.array(z6.string()), changesRequested: z6.boolean() }),
1336
+ hiddenFromBoard: z6.boolean(),
1337
+ lastActivityAt: Iso,
1338
+ createdAt: Iso,
1339
+ updatedAt: Iso
1457
1340
  });
1458
- var RunState = z7.enum([
1341
+ var RunState = z6.enum([
1459
1342
  "queued",
1460
1343
  "dispatching",
1461
1344
  "uncertain",
@@ -1467,79 +1350,79 @@ var RunState = z7.enum([
1467
1350
  "interrupted",
1468
1351
  "canceled"
1469
1352
  ]);
1470
- var CheckResult = z7.object({
1471
- command: z7.string(),
1472
- exitCode: z7.number().int().nullable(),
1473
- outputTail: z7.string()
1474
- });
1475
- var Run = z7.object({
1476
- id: Id5,
1477
- taskId: Id5,
1478
- sessionId: Id5.nullable(),
1479
- hostId: Id5.nullable(),
1480
- dispatchKey: z7.string(),
1481
- attempt: z7.number().int().min(1),
1353
+ var CheckResult = z6.object({
1354
+ command: z6.string(),
1355
+ exitCode: z6.number().int().nullable(),
1356
+ outputTail: z6.string()
1357
+ });
1358
+ var Run = z6.object({
1359
+ id: Id4,
1360
+ taskId: Id4,
1361
+ sessionId: Id4.nullable(),
1362
+ hostId: Id4.nullable(),
1363
+ dispatchKey: z6.string(),
1364
+ attempt: z6.number().int().min(1),
1482
1365
  state: RunState,
1483
1366
  controlMode: ControlMode,
1484
- controlRevision: z7.number().int().min(1),
1485
- continuationsUsed: z7.number().int().min(0),
1486
- infraRetries: z7.number().int().min(0),
1487
- nextAttemptAt: Iso2.nullable(),
1488
- startedAt: Iso2.nullable(),
1489
- endedAt: Iso2.nullable(),
1490
- outcome: z7.object({
1491
- kind: z7.enum(["review", "failed", "blocked", "no_change", "canceled"]),
1492
- summary: z7.string()
1367
+ controlRevision: z6.number().int().min(1),
1368
+ continuationsUsed: z6.number().int().min(0),
1369
+ infraRetries: z6.number().int().min(0),
1370
+ nextAttemptAt: Iso.nullable(),
1371
+ startedAt: Iso.nullable(),
1372
+ endedAt: Iso.nullable(),
1373
+ outcome: z6.object({
1374
+ kind: z6.enum(["review", "failed", "blocked", "no_change", "canceled"]),
1375
+ summary: z6.string()
1493
1376
  }).nullable(),
1494
1377
  limits: ContinuationPolicy,
1495
- usage: z7.object({
1496
- tokens: z7.number().nullable(),
1497
- costUsd: z7.number().nullable(),
1498
- accounting: z7.enum(["available", "unavailable"]),
1499
- note: z7.string().nullable()
1378
+ usage: z6.object({
1379
+ tokens: z6.number().nullable(),
1380
+ costUsd: z6.number().nullable(),
1381
+ accounting: z6.enum(["available", "unavailable"]),
1382
+ note: z6.string().nullable()
1500
1383
  }),
1501
- checks: z7.array(CheckResult),
1502
- createdAt: Iso2,
1503
- updatedAt: Iso2
1384
+ checks: z6.array(CheckResult),
1385
+ createdAt: Iso,
1386
+ updatedAt: Iso
1504
1387
  });
1505
- var Trigger = z7.discriminatedUnion("kind", [
1506
- z7.object({ kind: z7.literal("manual") }),
1507
- z7.object({ kind: z7.literal("once"), at: Iso2 }),
1508
- z7.object({ kind: z7.literal("cron"), expr: z7.string().min(1), timezone: z7.string().min(1) }),
1509
- z7.object({ kind: z7.literal("webhook") }),
1510
- z7.object({ kind: z7.literal("dependency"), taskId: Id5 })
1388
+ var Trigger = z6.discriminatedUnion("kind", [
1389
+ z6.object({ kind: z6.literal("manual") }),
1390
+ z6.object({ kind: z6.literal("once"), at: Iso }),
1391
+ z6.object({ kind: z6.literal("cron"), expr: z6.string().min(1), timezone: z6.string().min(1) }),
1392
+ z6.object({ kind: z6.literal("webhook") }),
1393
+ z6.object({ kind: z6.literal("dependency"), taskId: Id4 })
1511
1394
  ]);
1512
- var TaskTemplate = z7.object({
1513
- title: z7.string().min(1),
1514
- objective: z7.string(),
1515
- acceptanceCriteria: z7.array(z7.string()),
1395
+ var TaskTemplate = z6.object({
1396
+ title: z6.string().min(1),
1397
+ objective: z6.string(),
1398
+ acceptanceCriteria: z6.array(z6.string()),
1516
1399
  priority: Priority
1517
1400
  });
1518
- var Automation = z7.object({
1519
- id: Id5,
1520
- name: z7.string().min(1),
1521
- enabled: z7.boolean(),
1522
- projectId: Id5,
1401
+ var Automation = z6.object({
1402
+ id: Id4,
1403
+ name: z6.string().min(1),
1404
+ enabled: z6.boolean(),
1405
+ projectId: Id4,
1523
1406
  trigger: Trigger,
1524
- filters: z7.array(z7.object({ path: z7.string(), equals: z7.string() })),
1407
+ filters: z6.array(z6.object({ path: z6.string(), equals: z6.string() })),
1525
1408
  template: TaskTemplate,
1526
- hostId: Id5.nullable(),
1527
- profileId: Id5.nullable(),
1528
- mode: z7.enum(["fresh", "continue", "watch"]),
1529
- groupingKey: z7.string().nullable(),
1530
- overlap: z7.enum(["skip", "queue_one", "append"]),
1531
- missed: z7.enum(["skip", "run_once"]),
1409
+ hostId: Id4.nullable(),
1410
+ profileId: Id4.nullable(),
1411
+ mode: z6.enum(["fresh", "continue", "watch"]),
1412
+ groupingKey: z6.string().nullable(),
1413
+ overlap: z6.enum(["skip", "queue_one", "append"]),
1414
+ missed: z6.enum(["skip", "run_once"]),
1532
1415
  continuation: ContinuationPolicy,
1533
1416
  completion: CompletionPolicy,
1534
- nextAt: Iso2.nullable(),
1535
- lastEvaluatedAt: Iso2.nullable(),
1536
- lastOutcome: z7.string().nullable(),
1537
- failureCount: z7.number().int().min(0),
1538
- webhookTokenSet: z7.boolean(),
1539
- createdAt: Iso2,
1540
- updatedAt: Iso2
1417
+ nextAt: Iso.nullable(),
1418
+ lastEvaluatedAt: Iso.nullable(),
1419
+ lastOutcome: z6.string().nullable(),
1420
+ failureCount: z6.number().int().min(0),
1421
+ webhookTokenSet: z6.boolean(),
1422
+ createdAt: Iso,
1423
+ updatedAt: Iso
1541
1424
  });
1542
- var OccurrenceState = z7.enum([
1425
+ var OccurrenceState = z6.enum([
1543
1426
  "fired",
1544
1427
  "skipped_overlap",
1545
1428
  "skipped_missed",
@@ -1548,39 +1431,39 @@ var OccurrenceState = z7.enum([
1548
1431
  "failed",
1549
1432
  "filtered"
1550
1433
  ]);
1551
- var Occurrence = z7.object({
1552
- id: Id5,
1553
- automationId: Id5,
1554
- key: z7.string(),
1555
- scheduledFor: Iso2.nullable(),
1434
+ var Occurrence = z6.object({
1435
+ id: Id4,
1436
+ automationId: Id4,
1437
+ key: z6.string(),
1438
+ scheduledFor: Iso.nullable(),
1556
1439
  state: OccurrenceState,
1557
- taskId: Id5.nullable(),
1558
- reason: z7.string().nullable(),
1559
- outcome: z7.string().nullable(),
1560
- createdAt: Iso2
1561
- });
1562
- var InteractionState = z7.preprocess((v) => v === "cancelled" ? "canceled" : v, z7.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
1563
- var Interaction = z7.object({
1564
- id: Id5,
1565
- sessionId: Id5,
1566
- revision: z7.number().int().min(1),
1567
- source: z7.discriminatedUnion("kind", [
1568
- z7.object({
1569
- kind: z7.literal("extension_ui"),
1570
- method: z7.enum(["select", "confirm", "input", "editor"]),
1571
- piRequestIds: z7.array(z7.string())
1440
+ taskId: Id4.nullable(),
1441
+ reason: z6.string().nullable(),
1442
+ outcome: z6.string().nullable(),
1443
+ createdAt: Iso
1444
+ });
1445
+ var InteractionState = z6.preprocess((v) => v === "cancelled" ? "canceled" : v, z6.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
1446
+ var Interaction = z6.object({
1447
+ id: Id4,
1448
+ sessionId: Id4,
1449
+ revision: z6.number().int().min(1),
1450
+ source: z6.discriminatedUnion("kind", [
1451
+ z6.object({
1452
+ kind: z6.literal("extension_ui"),
1453
+ method: z6.enum(["select", "confirm", "input", "editor"]),
1454
+ piRequestIds: z6.array(z6.string())
1572
1455
  }),
1573
- z7.object({ kind: z7.literal("unsupported_custom"), title: z7.string().nullable() })
1456
+ z6.object({ kind: z6.literal("unsupported_custom"), title: z6.string().nullable() })
1574
1457
  ]),
1575
- adapterId: z7.string().nullable(),
1458
+ adapterId: z6.string().nullable(),
1576
1459
  permission: PolicyPermission.optional(),
1577
- title: z7.string(),
1460
+ title: z6.string(),
1578
1461
  presentation: UINodeSchema,
1579
1462
  state: InteractionState,
1580
- resolution: z7.object({ by: z7.string(), summary: z7.string(), at: Iso2 }).nullable(),
1581
- createdAt: Iso2
1463
+ resolution: z6.object({ by: z6.string(), summary: z6.string(), at: Iso }).nullable(),
1464
+ createdAt: Iso
1582
1465
  });
1583
- var AttentionReason = z7.enum([
1466
+ var AttentionReason = z6.enum([
1584
1467
  "needs_input",
1585
1468
  "failed",
1586
1469
  "ready_for_review",
@@ -1588,171 +1471,171 @@ var AttentionReason = z7.enum([
1588
1471
  "host_unreachable",
1589
1472
  "cache_expiring"
1590
1473
  ]);
1591
- var AttentionItem = z7.object({
1592
- id: Id5,
1593
- sessionId: Id5.nullable(),
1594
- taskId: Id5.nullable(),
1595
- projectId: Id5.nullable(),
1474
+ var AttentionItem = z6.object({
1475
+ id: Id4,
1476
+ sessionId: Id4.nullable(),
1477
+ taskId: Id4.nullable(),
1478
+ projectId: Id4.nullable(),
1596
1479
  reason: AttentionReason,
1597
- severity: z7.enum(["info", "warning", "critical"]),
1598
- summary: z7.string(),
1599
- interactionId: Id5.nullable(),
1600
- deepLink: z7.string(),
1601
- acknowledgedAt: Iso2.nullable(),
1602
- resolvedAt: Iso2.nullable(),
1603
- createdAt: Iso2
1604
- });
1605
- var Device = z7.object({
1606
- id: Id5,
1607
- name: z7.string(),
1480
+ severity: z6.enum(["info", "warning", "critical"]),
1481
+ summary: z6.string(),
1482
+ interactionId: Id4.nullable(),
1483
+ deepLink: z6.string(),
1484
+ acknowledgedAt: Iso.nullable(),
1485
+ resolvedAt: Iso.nullable(),
1486
+ createdAt: Iso
1487
+ });
1488
+ var Device = z6.object({
1489
+ id: Id4,
1490
+ name: z6.string(),
1608
1491
  kind: DeviceKind,
1609
- createdAt: Iso2,
1610
- lastSeenAt: Iso2.nullable(),
1611
- revokedAt: Iso2.nullable(),
1612
- push: z7.object({
1613
- subscribed: z7.boolean(),
1614
- permission: z7.enum(["granted", "denied", "default", "unknown"])
1492
+ createdAt: Iso,
1493
+ lastSeenAt: Iso.nullable(),
1494
+ revokedAt: Iso.nullable(),
1495
+ push: z6.object({
1496
+ subscribed: z6.boolean(),
1497
+ permission: z6.enum(["granted", "denied", "default", "unknown"])
1615
1498
  }),
1616
- preferredMobile: z7.boolean(),
1617
- enrolledVia: z7.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
1618
- });
1619
- var ToolItemData = z7.object({
1620
- toolCallId: z7.string(),
1621
- name: z7.string(),
1622
- status: z7.enum(["running", "ok", "error"]),
1623
- args: z7.unknown(),
1624
- summary: z7.string(),
1625
- output: z7.string(),
1626
- startedAt: Iso2,
1627
- durationMs: z7.number().nullable(),
1499
+ preferredMobile: z6.boolean(),
1500
+ enrolledVia: z6.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
1501
+ });
1502
+ var ToolItemData = z6.object({
1503
+ toolCallId: z6.string(),
1504
+ name: z6.string(),
1505
+ status: z6.enum(["running", "ok", "error"]),
1506
+ args: z6.unknown(),
1507
+ summary: z6.string(),
1508
+ output: z6.string(),
1509
+ startedAt: Iso,
1510
+ durationMs: z6.number().nullable(),
1628
1511
  card: UINodeSchema.nullable(),
1629
- adapterId: z7.string().nullable(),
1630
- adapterGeneration: z7.string().uuid().optional()
1512
+ adapterId: z6.string().nullable(),
1513
+ adapterGeneration: z6.string().uuid().optional()
1631
1514
  });
1632
- var TranscriptItem = z7.discriminatedUnion("kind", [
1633
- z7.object({
1634
- id: Id5,
1635
- sessionId: Id5,
1636
- order: z7.number().int(),
1637
- at: Iso2,
1638
- kind: z7.literal("user"),
1639
- data: z7.object({
1640
- text: z7.string(),
1641
- images: z7.number().int().optional(),
1515
+ var TranscriptItem = z6.discriminatedUnion("kind", [
1516
+ z6.object({
1517
+ id: Id4,
1518
+ sessionId: Id4,
1519
+ order: z6.number().int(),
1520
+ at: Iso,
1521
+ kind: z6.literal("user"),
1522
+ data: z6.object({
1523
+ text: z6.string(),
1524
+ images: z6.number().int().optional(),
1642
1525
  /** Pi session entry id, for rewind and fork from this message. */
1643
- entryId: z7.string().optional()
1526
+ entryId: z6.string().optional()
1644
1527
  })
1645
1528
  }),
1646
- z7.object({
1647
- id: Id5,
1648
- sessionId: Id5,
1649
- order: z7.number().int(),
1650
- at: Iso2,
1651
- kind: z7.literal("assistant"),
1652
- data: z7.object({ text: z7.string(), streaming: z7.boolean().optional() })
1529
+ z6.object({
1530
+ id: Id4,
1531
+ sessionId: Id4,
1532
+ order: z6.number().int(),
1533
+ at: Iso,
1534
+ kind: z6.literal("assistant"),
1535
+ data: z6.object({ text: z6.string(), streaming: z6.boolean().optional() })
1653
1536
  }),
1654
- z7.object({
1655
- id: Id5,
1656
- sessionId: Id5,
1657
- order: z7.number().int(),
1658
- at: Iso2,
1659
- kind: z7.literal("thinking"),
1660
- data: z7.object({ text: z7.string() })
1537
+ z6.object({
1538
+ id: Id4,
1539
+ sessionId: Id4,
1540
+ order: z6.number().int(),
1541
+ at: Iso,
1542
+ kind: z6.literal("thinking"),
1543
+ data: z6.object({ text: z6.string() })
1661
1544
  }),
1662
- z7.object({
1663
- id: Id5,
1664
- sessionId: Id5,
1665
- order: z7.number().int(),
1666
- at: Iso2,
1667
- kind: z7.literal("tool"),
1545
+ z6.object({
1546
+ id: Id4,
1547
+ sessionId: Id4,
1548
+ order: z6.number().int(),
1549
+ at: Iso,
1550
+ kind: z6.literal("tool"),
1668
1551
  data: ToolItemData
1669
1552
  }),
1670
- z7.object({
1671
- id: Id5,
1672
- sessionId: Id5,
1673
- order: z7.number().int(),
1674
- at: Iso2,
1675
- kind: z7.literal("notice"),
1676
- data: z7.object({
1553
+ z6.object({
1554
+ id: Id4,
1555
+ sessionId: Id4,
1556
+ order: z6.number().int(),
1557
+ at: Iso,
1558
+ kind: z6.literal("notice"),
1559
+ data: z6.object({
1677
1560
  level: DiagnosticLevel,
1678
- text: z7.string(),
1679
- customType: z7.string().min(1).max(200).optional(),
1561
+ text: z6.string(),
1562
+ customType: z6.string().min(1).max(200).optional(),
1680
1563
  card: UINodeSchema.optional(),
1681
- adapterId: z7.string().optional(),
1682
- adapterGeneration: z7.string().uuid().optional()
1564
+ adapterId: z6.string().optional(),
1565
+ adapterGeneration: z6.string().uuid().optional()
1683
1566
  }).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
1684
1567
  }),
1685
- z7.object({
1686
- id: Id5,
1687
- sessionId: Id5,
1688
- order: z7.number().int(),
1689
- at: Iso2,
1690
- kind: z7.literal("interaction"),
1691
- data: z7.object({ interactionId: Id5 })
1568
+ z6.object({
1569
+ id: Id4,
1570
+ sessionId: Id4,
1571
+ order: z6.number().int(),
1572
+ at: Iso,
1573
+ kind: z6.literal("interaction"),
1574
+ data: z6.object({ interactionId: Id4 })
1692
1575
  }),
1693
- z7.object({
1694
- id: Id5,
1695
- sessionId: Id5,
1696
- order: z7.number().int(),
1697
- at: Iso2,
1698
- kind: z7.literal("subagent"),
1699
- data: z7.object({
1700
- runId: z7.string(),
1701
- label: z7.string(),
1702
- status: z7.string(),
1703
- sessionFile: z7.string().nullable(),
1704
- linkedSessionId: Id5.nullable()
1576
+ z6.object({
1577
+ id: Id4,
1578
+ sessionId: Id4,
1579
+ order: z6.number().int(),
1580
+ at: Iso,
1581
+ kind: z6.literal("subagent"),
1582
+ data: z6.object({
1583
+ runId: z6.string(),
1584
+ label: z6.string(),
1585
+ status: z6.string(),
1586
+ sessionFile: z6.string().nullable(),
1587
+ linkedSessionId: Id4.nullable()
1705
1588
  })
1706
1589
  }),
1707
- z7.object({
1708
- id: Id5,
1709
- sessionId: Id5,
1710
- order: z7.number().int(),
1711
- at: Iso2,
1712
- kind: z7.literal("system"),
1713
- data: z7.object({ text: z7.string(), suggestion: z7.boolean().optional() })
1590
+ z6.object({
1591
+ id: Id4,
1592
+ sessionId: Id4,
1593
+ order: z6.number().int(),
1594
+ at: Iso,
1595
+ kind: z6.literal("system"),
1596
+ data: z6.object({ text: z6.string(), suggestion: z6.boolean().optional() })
1714
1597
  })
1715
1598
  ]);
1716
- var Panel = z7.object({
1717
- sessionId: Id5,
1718
- adapterId: z7.string(),
1719
- slot: z7.string(),
1720
- title: z7.string(),
1599
+ var Panel = z6.object({
1600
+ sessionId: Id4,
1601
+ adapterId: z6.string(),
1602
+ slot: z6.string(),
1603
+ title: z6.string(),
1721
1604
  node: UINodeSchema.nullable(),
1722
- webRenderer: z7.boolean(),
1723
- mobileFallback: z7.string().nullable(),
1605
+ webRenderer: z6.boolean(),
1606
+ mobileFallback: z6.string().nullable(),
1724
1607
  contribution: ContributionDescriptor.optional(),
1725
- state: z7.unknown().optional(),
1726
- adapterGeneration: z7.string().uuid().optional(),
1727
- updatedAt: Iso2
1608
+ state: z6.unknown().optional(),
1609
+ adapterGeneration: z6.string().uuid().optional(),
1610
+ updatedAt: Iso
1728
1611
  });
1729
- var Diagnostic = z7.object({
1730
- sessionId: Id5.nullable(),
1731
- adapterId: z7.string().nullable(),
1612
+ var Diagnostic = z6.object({
1613
+ sessionId: Id4.nullable(),
1614
+ adapterId: z6.string().nullable(),
1732
1615
  level: DiagnosticLevel,
1733
- message: z7.string(),
1734
- at: Iso2
1735
- });
1736
- var AdapterInfo = z7.object({
1737
- id: z7.string(),
1738
- version: z7.string(),
1739
- tier: z7.enum(["project", "owner", "plugin", "bundled"]),
1740
- target: z7.object({
1741
- extension: z7.string(),
1742
- versionRange: z7.string(),
1743
- testedVersions: z7.array(z7.string())
1616
+ message: z6.string(),
1617
+ at: Iso
1618
+ });
1619
+ var AdapterInfo = z6.object({
1620
+ id: z6.string(),
1621
+ version: z6.string(),
1622
+ tier: z6.enum(["project", "owner", "plugin", "bundled"]),
1623
+ target: z6.object({
1624
+ extension: z6.string(),
1625
+ versionRange: z6.string(),
1626
+ testedVersions: z6.array(z6.string())
1744
1627
  }),
1745
- capabilities: z7.array(z7.string()),
1746
- webRenderer: z7.boolean(),
1747
- status: z7.enum(["active", "disabled", "error"]),
1748
- detail: z7.string().nullable()
1749
- });
1750
- var Passkey = z7.object({
1751
- id: z7.string(),
1752
- name: z7.string(),
1753
- createdAt: Iso2,
1754
- lastUsedAt: Iso2.nullable(),
1755
- transports: z7.array(z7.string())
1628
+ capabilities: z6.array(z6.string()),
1629
+ webRenderer: z6.boolean(),
1630
+ status: z6.enum(["active", "disabled", "error"]),
1631
+ detail: z6.string().nullable()
1632
+ });
1633
+ var Passkey = z6.object({
1634
+ id: z6.string(),
1635
+ name: z6.string(),
1636
+ createdAt: Iso,
1637
+ lastUsedAt: Iso.nullable(),
1638
+ transports: z6.array(z6.string())
1756
1639
  });
1757
1640
 
1758
1641
  // packages/protocol/dist/adapter-preview.js
@@ -1765,92 +1648,92 @@ function bounded(input, ctx) {
1765
1648
  return input;
1766
1649
  } catch (error) {
1767
1650
  ctx.addIssue({ code: "custom", message: error.message });
1768
- return z8.NEVER;
1651
+ return z7.NEVER;
1769
1652
  }
1770
1653
  }
1771
- var Id6 = z8.string().min(1).max(200);
1772
- var Text2 = z8.string().max(64 * 1024);
1773
- var Tool = { toolCallId: Id6, name: Id6, args: z8.unknown() };
1774
- var DialogCommon = { id: Id6, title: Text2 };
1775
- var AdapterPreviewPiUiRequestSchema = z8.discriminatedUnion("method", [
1776
- z8.object({
1654
+ var Id5 = z7.string().min(1).max(200);
1655
+ var Text2 = z7.string().max(64 * 1024);
1656
+ var Tool = { toolCallId: Id5, name: Id5, args: z7.unknown() };
1657
+ var DialogCommon = { id: Id5, title: Text2 };
1658
+ var AdapterPreviewPiUiRequestSchema = z7.discriminatedUnion("method", [
1659
+ z7.object({
1777
1660
  ...DialogCommon,
1778
- method: z8.literal("select"),
1779
- options: z8.array(Text2).max(200),
1780
- timeout: z8.number().nonnegative().optional()
1661
+ method: z7.literal("select"),
1662
+ options: z7.array(Text2).max(200),
1663
+ timeout: z7.number().nonnegative().optional()
1781
1664
  }).strict(),
1782
- z8.object({
1665
+ z7.object({
1783
1666
  ...DialogCommon,
1784
- method: z8.literal("confirm"),
1667
+ method: z7.literal("confirm"),
1785
1668
  message: Text2,
1786
- timeout: z8.number().nonnegative().optional()
1669
+ timeout: z7.number().nonnegative().optional()
1787
1670
  }).strict(),
1788
- z8.object({
1671
+ z7.object({
1789
1672
  ...DialogCommon,
1790
- method: z8.literal("input"),
1673
+ method: z7.literal("input"),
1791
1674
  placeholder: Text2.optional(),
1792
- timeout: z8.number().nonnegative().optional()
1675
+ timeout: z7.number().nonnegative().optional()
1793
1676
  }).strict(),
1794
- z8.object({ ...DialogCommon, method: z8.literal("editor"), prefill: Text2.optional() }).strict()
1677
+ z7.object({ ...DialogCommon, method: z7.literal("editor"), prefill: Text2.optional() }).strict()
1795
1678
  ]);
1796
- var AdapterPreviewStepSchema = z8.discriminatedUnion("kind", [
1797
- z8.object({ kind: z8.literal("restore") }).strict(),
1798
- z8.object({ kind: z8.literal("toolStart"), data: z8.object(Tool).strict() }).strict(),
1799
- z8.object({
1800
- kind: z8.literal("toolUpdate"),
1801
- data: z8.object({ ...Tool, partialResult: z8.unknown(), details: z8.unknown().optional() }).strict()
1679
+ var AdapterPreviewStepSchema = z7.discriminatedUnion("kind", [
1680
+ z7.object({ kind: z7.literal("restore") }).strict(),
1681
+ z7.object({ kind: z7.literal("toolStart"), data: z7.object(Tool).strict() }).strict(),
1682
+ z7.object({
1683
+ kind: z7.literal("toolUpdate"),
1684
+ data: z7.object({ ...Tool, partialResult: z7.unknown(), details: z7.unknown().optional() }).strict()
1802
1685
  }).strict(),
1803
- z8.object({
1804
- kind: z8.literal("toolEnd"),
1805
- data: z8.object({
1686
+ z7.object({
1687
+ kind: z7.literal("toolEnd"),
1688
+ data: z7.object({
1806
1689
  ...Tool,
1807
- result: z8.unknown(),
1808
- isError: z8.boolean(),
1809
- details: z8.unknown().optional()
1690
+ result: z7.unknown(),
1691
+ isError: z7.boolean(),
1692
+ details: z7.unknown().optional()
1810
1693
  }).strict()
1811
1694
  }).strict(),
1812
- z8.object({
1813
- kind: z8.literal("status"),
1814
- data: z8.object({ key: Id6, text: Text2.optional() }).strict()
1695
+ z7.object({
1696
+ kind: z7.literal("status"),
1697
+ data: z7.object({ key: Id5, text: Text2.optional() }).strict()
1815
1698
  }).strict(),
1816
- z8.object({
1817
- kind: z8.literal("widget"),
1818
- data: z8.object({ key: Id6, lines: z8.array(Text2).max(200).optional() }).strict()
1699
+ z7.object({
1700
+ kind: z7.literal("widget"),
1701
+ data: z7.object({ key: Id5, lines: z7.array(Text2).max(200).optional() }).strict()
1819
1702
  }).strict(),
1820
- z8.object({ kind: z8.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
1821
- z8.object({
1822
- kind: z8.literal("answer"),
1823
- data: z8.object({ requestId: Id6, response: InteractionResponseSchema }).strict()
1703
+ z7.object({ kind: z7.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
1704
+ z7.object({
1705
+ kind: z7.literal("answer"),
1706
+ data: z7.object({ requestId: Id5, response: InteractionResponseSchema }).strict()
1824
1707
  }).strict(),
1825
- z8.object({
1826
- kind: z8.literal("customMessage"),
1827
- data: z8.object({
1828
- customType: Id6,
1829
- content: z8.unknown(),
1830
- display: z8.boolean().optional(),
1831
- details: z8.unknown().optional()
1708
+ z7.object({
1709
+ kind: z7.literal("customMessage"),
1710
+ data: z7.object({
1711
+ customType: Id5,
1712
+ content: z7.unknown(),
1713
+ display: z7.boolean().optional(),
1714
+ details: z7.unknown().optional()
1832
1715
  }).strict()
1833
1716
  }).strict(),
1834
- z8.object({
1835
- kind: z8.literal("action"),
1836
- data: z8.object({ actionId: Id6, payload: z8.unknown() }).strict()
1717
+ z7.object({
1718
+ kind: z7.literal("action"),
1719
+ data: z7.object({ actionId: Id5, payload: z7.unknown() }).strict()
1837
1720
  }).strict()
1838
1721
  ]);
1839
- var AdapterPreviewFixtureSchema = z8.unknown().transform(bounded).pipe(z8.object({
1840
- version: z8.literal(1),
1841
- name: z8.string().min(1).max(200),
1842
- initialState: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())).optional(),
1843
- steps: z8.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
1722
+ var AdapterPreviewFixtureSchema = z7.unknown().transform(bounded).pipe(z7.object({
1723
+ version: z7.literal(1),
1724
+ name: z7.string().min(1).max(200),
1725
+ initialState: z7.record(z7.string(), z7.record(z7.string(), z7.unknown())).optional(),
1726
+ steps: z7.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
1844
1727
  }).strict());
1845
- var PortableNode = z8.unknown().transform((input, ctx) => {
1728
+ var PortableNode = z7.unknown().transform((input, ctx) => {
1846
1729
  try {
1847
1730
  return validateUINode(input);
1848
1731
  } catch (error) {
1849
1732
  ctx.addIssue({ code: "custom", message: error.message });
1850
- return z8.NEVER;
1733
+ return z7.NEVER;
1851
1734
  }
1852
1735
  });
1853
- var PreviewPanel = Panel.extend({ webRenderer: z8.literal(false) }).superRefine((panel, ctx) => {
1736
+ var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine((panel, ctx) => {
1854
1737
  try {
1855
1738
  if (panel.sessionId !== ADAPTER_PREVIEW_SESSION_ID)
1856
1739
  throw new Error("Preview panels must use the fake preview session");
@@ -1872,13 +1755,13 @@ var PreviewPanel = Panel.extend({ webRenderer: z8.literal(false) }).superRefine(
1872
1755
  ctx.addIssue({ code: "custom", message: error.message });
1873
1756
  }
1874
1757
  });
1875
- var AdapterPreviewSchema = z8.unknown().transform(bounded).pipe(z8.object({
1876
- version: z8.literal(1),
1877
- name: z8.string().min(1).max(200),
1878
- adapter: z8.object({ id: Id6, version: Id6 }).strict(),
1879
- steps: z8.array(z8.object({
1880
- index: z8.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
1881
- kind: z8.enum([
1758
+ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1759
+ version: z7.literal(1),
1760
+ name: z7.string().min(1).max(200),
1761
+ adapter: z7.object({ id: Id5, version: Id5 }).strict(),
1762
+ steps: z7.array(z7.object({
1763
+ index: z7.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
1764
+ kind: z7.enum([
1882
1765
  "restore",
1883
1766
  "toolStart",
1884
1767
  "toolUpdate",
@@ -1890,24 +1773,24 @@ var AdapterPreviewSchema = z8.unknown().transform(bounded).pipe(z8.object({
1890
1773
  "customMessage",
1891
1774
  "action"
1892
1775
  ]),
1893
- ok: z8.boolean(),
1894
- error: z8.string().max(4e3).nullable()
1776
+ ok: z7.boolean(),
1777
+ error: z7.string().max(4e3).nullable()
1895
1778
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1896
- panels: z8.array(PreviewPanel).max(256),
1897
- interactions: z8.array(z8.object({
1779
+ panels: z7.array(PreviewPanel).max(256),
1780
+ interactions: z7.array(z7.object({
1898
1781
  request: AdapterPreviewPiUiRequestSchema,
1899
1782
  presentation: PortableNode,
1900
- state: z8.enum(["pending", "resolved"])
1783
+ state: z7.enum(["pending", "resolved"])
1901
1784
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1902
- cards: z8.array(z8.unknown().transform((input, ctx) => {
1785
+ cards: z7.array(z7.unknown().transform((input, ctx) => {
1903
1786
  try {
1904
1787
  return validateContributionCard(input);
1905
1788
  } catch (error) {
1906
1789
  ctx.addIssue({ code: "custom", message: error.message });
1907
- return z8.NEVER;
1790
+ return z7.NEVER;
1908
1791
  }
1909
1792
  })).max(ADAPTER_PREVIEW_MAX_STEPS * 3),
1910
- diagnostics: z8.array(Diagnostic.extend({ message: z8.string().max(4e3) }).refine((d) => d.sessionId === null || d.sessionId === ADAPTER_PREVIEW_SESSION_ID, "Preview diagnostics must use the fake preview session")).max(200)
1793
+ diagnostics: z7.array(Diagnostic.extend({ message: z7.string().max(4e3) }).refine((d) => d.sessionId === null || d.sessionId === ADAPTER_PREVIEW_SESSION_ID, "Preview diagnostics must use the fake preview session")).max(200)
1911
1794
  }).strict().superRefine((preview, ctx) => {
1912
1795
  const slots = /* @__PURE__ */ new Set();
1913
1796
  let contributions = 0;
@@ -1936,39 +1819,39 @@ var AdapterPreviewSchema = z8.unknown().transform(bounded).pipe(z8.object({
1936
1819
  }));
1937
1820
 
1938
1821
  // packages/protocol/dist/adapters.js
1939
- import { z as z9 } from "zod";
1940
- var Path = z9.string().max(4096);
1822
+ import { z as z8 } from "zod";
1823
+ var Path = z8.string().max(4096);
1941
1824
  var SessionAdapterInfo = AdapterInfo.extend({
1942
- runtimeStatus: z9.enum(["active", "disabled", "unavailable"]),
1943
- runtimeDetail: z9.string().max(4e3).nullable(),
1944
- provenance: z9.object({
1945
- scope: z9.enum(["user", "project", "explicit"]),
1825
+ runtimeStatus: z8.enum(["active", "disabled", "unavailable"]),
1826
+ runtimeDetail: z8.string().max(4e3).nullable(),
1827
+ provenance: z8.object({
1828
+ scope: z8.enum(["user", "project", "explicit"]),
1946
1829
  source: Path.nullable(),
1947
1830
  packageDir: Path.nullable(),
1948
1831
  manifestPath: Path.nullable(),
1949
- targetVersion: z9.string().nullable(),
1950
- entrypoints: z9.array(Path).max(128),
1951
- evidence: z9.enum(["runtime-reported", "package-level", "explicit"])
1832
+ targetVersion: z8.string().nullable(),
1833
+ entrypoints: z8.array(Path).max(128),
1834
+ evidence: z8.enum(["runtime-reported", "package-level", "explicit"])
1952
1835
  })
1953
1836
  });
1954
- var SessionAdaptersResult = z9.object({
1955
- generation: z9.string().uuid().nullable(),
1956
- runtimeId: z9.string().nullable(),
1957
- reloadable: z9.boolean(),
1958
- blockedReason: z9.string().nullable(),
1959
- adapters: z9.array(SessionAdapterInfo).max(256),
1960
- diagnostics: z9.array(Diagnostic).max(100)
1837
+ var SessionAdaptersResult = z8.object({
1838
+ generation: z8.string().uuid().nullable(),
1839
+ runtimeId: z8.string().nullable(),
1840
+ reloadable: z8.boolean(),
1841
+ blockedReason: z8.string().nullable(),
1842
+ adapters: z8.array(SessionAdapterInfo).max(256),
1843
+ diagnostics: z8.array(Diagnostic).max(100)
1961
1844
  });
1962
1845
 
1963
1846
  // packages/protocol/dist/agent-wire.js
1964
- import { z as z10 } from "zod";
1965
- var Id7 = z10.string().min(1).max(200);
1966
- var Instant3 = z10.string().refine((value) => {
1847
+ import { z as z9 } from "zod";
1848
+ var Id6 = z9.string().min(1).max(200);
1849
+ var Instant3 = z9.string().refine((value) => {
1967
1850
  const date = new Date(value);
1968
1851
  return Number.isFinite(date.getTime()) && date.toISOString() === value;
1969
1852
  }, "Expected canonical UTC timestamp");
1970
1853
  var AGENT_FRAME_MAX_BYTES = 128 * 1024;
1971
- var AgentMethod = z10.enum([
1854
+ var AgentMethod = z9.enum([
1972
1855
  "session.bind",
1973
1856
  "task.create",
1974
1857
  "message.send",
@@ -1978,34 +1861,34 @@ var AgentMethod = z10.enum([
1978
1861
  "policy.status",
1979
1862
  "policy.cancel"
1980
1863
  ]);
1981
- var AgentToolMethod = z10.enum(["task.create", "message.send", "inbox.read"]);
1982
- var RequestHash = z10.string().regex(/^[a-f0-9]{64}$/);
1983
- var AgentReceiptPeekRequest = z10.object({ method: AgentToolMethod, args: z10.record(z10.string(), z10.json()) }).strict();
1984
- var AgentReceiptPeekResult = z10.discriminatedUnion("found", [
1985
- z10.object({ found: z10.literal(false) }).strict(),
1986
- z10.object({ found: z10.literal(true), requestHash: RequestHash }).strict()
1864
+ var AgentToolMethod = z9.enum(["task.create", "message.send", "inbox.read"]);
1865
+ var RequestHash = z9.string().regex(/^[a-f0-9]{64}$/);
1866
+ var AgentReceiptPeekRequest = z9.object({ method: AgentToolMethod, args: z9.record(z9.string(), z9.json()) }).strict();
1867
+ var AgentReceiptPeekResult = z9.discriminatedUnion("found", [
1868
+ z9.object({ found: z9.literal(false) }).strict(),
1869
+ z9.object({ found: z9.literal(true), requestHash: RequestHash }).strict()
1987
1870
  ]);
1988
- var AgentReceiptReplay = z10.object({ requestHash: RequestHash }).strict();
1989
- var CreateAgentTask = z10.object({
1990
- objective: z10.string().min(1).max(16e3),
1991
- acceptance: z10.array(z10.string().min(1).max(2e3)).max(100).default([]),
1992
- dependencies: z10.array(Id7).max(100).default([]),
1993
- parentTaskId: Id7.nullable().optional(),
1994
- hostId: Id7.optional(),
1995
- profileId: Id7.optional(),
1996
- notifyOnFinish: z10.boolean().default(true)
1997
- });
1998
- var SendAgentMessage = z10.object({
1999
- sessionId: Id7,
2000
- body: z10.string().min(1).max(16e3),
2001
- mode: z10.enum(["steer", "queue"]),
2002
- replyTo: Id7.optional()
2003
- });
2004
- var ReadAgentInbox = z10.object({
2005
- after: z10.number().int().nonnegative().default(0),
2006
- limit: z10.number().int().min(1).max(100).default(20)
2007
- });
2008
- var DeliveryState = z10.enum([
1871
+ var AgentReceiptReplay = z9.object({ requestHash: RequestHash }).strict();
1872
+ var CreateAgentTask = z9.object({
1873
+ objective: z9.string().min(1).max(16e3),
1874
+ acceptance: z9.array(z9.string().min(1).max(2e3)).max(100).default([]),
1875
+ dependencies: z9.array(Id6).max(100).default([]),
1876
+ parentTaskId: Id6.nullable().optional(),
1877
+ hostId: Id6.optional(),
1878
+ profileId: Id6.optional(),
1879
+ notifyOnFinish: z9.boolean().default(true)
1880
+ });
1881
+ var SendAgentMessage = z9.object({
1882
+ sessionId: Id6,
1883
+ body: z9.string().min(1).max(16e3),
1884
+ mode: z9.enum(["steer", "queue"]),
1885
+ replyTo: Id6.optional()
1886
+ });
1887
+ var ReadAgentInbox = z9.object({
1888
+ after: z9.number().int().nonnegative().default(0),
1889
+ limit: z9.number().int().min(1).max(100).default(20)
1890
+ });
1891
+ var DeliveryState = z9.enum([
2009
1892
  "pending",
2010
1893
  "held",
2011
1894
  "deferred",
@@ -2016,46 +1899,46 @@ var DeliveryState = z10.enum([
2016
1899
  "failed"
2017
1900
  ]);
2018
1901
  var AgentMessageFields = {
2019
- seq: z10.number().int().positive(),
2020
- id: Id7,
2021
- recipientSessionId: Id7,
2022
- replyTo: Id7.nullable(),
2023
- chainId: Id7,
2024
- depth: z10.number().int().min(0).max(4),
2025
- body: z10.unknown(),
2026
- requestedMode: z10.enum(["steer", "queue"]),
1902
+ seq: z9.number().int().positive(),
1903
+ id: Id6,
1904
+ recipientSessionId: Id6,
1905
+ replyTo: Id6.nullable(),
1906
+ chainId: Id6,
1907
+ depth: z9.number().int().min(0).max(4),
1908
+ body: z9.unknown(),
1909
+ requestedMode: z9.enum(["steer", "queue"]),
2027
1910
  deliveryState: DeliveryState,
2028
- holdUntil: z10.string(),
2029
- readAt: z10.string().nullable(),
2030
- createdAt: z10.string()
1911
+ holdUntil: z9.string(),
1912
+ readAt: z9.string().nullable(),
1913
+ createdAt: z9.string()
2031
1914
  };
2032
- var AgentMessage = z10.discriminatedUnion("kind", [
2033
- z10.object({ ...AgentMessageFields, kind: z10.literal("message"), senderSessionId: Id7 }),
2034
- z10.object({
1915
+ var AgentMessage = z9.discriminatedUnion("kind", [
1916
+ z9.object({ ...AgentMessageFields, kind: z9.literal("message"), senderSessionId: Id6 }),
1917
+ z9.object({
2035
1918
  ...AgentMessageFields,
2036
- kind: z10.literal("completion"),
2037
- senderSessionId: Id7.nullable()
1919
+ kind: z9.literal("completion"),
1920
+ senderSessionId: Id6.nullable()
2038
1921
  })
2039
1922
  ]);
2040
- var AgentInbox = z10.object({
2041
- messages: z10.array(AgentMessage),
2042
- nextAfter: z10.number().int().nonnegative(),
2043
- hasMore: z10.boolean()
2044
- });
2045
- var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z10.literal("policy.required") }).strict();
2046
- var AgentRequestFrame = z10.object({
2047
- type: z10.literal("agent.request"),
2048
- requestId: Id7,
2049
- sessionId: Id7,
2050
- nativeSessionId: Id7,
2051
- runtimeId: Id7,
2052
- context: z10.object({ humanInputId: Id7.nullable(), causalMessageId: Id7.nullable() }).strict(),
2053
- toolCallId: Id7.optional(),
1923
+ var AgentInbox = z9.object({
1924
+ messages: z9.array(AgentMessage),
1925
+ nextAfter: z9.number().int().nonnegative(),
1926
+ hasMore: z9.boolean()
1927
+ });
1928
+ var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z9.literal("policy.required") }).strict();
1929
+ var AgentRequestFrame = z9.object({
1930
+ type: z9.literal("agent.request"),
1931
+ requestId: Id6,
1932
+ sessionId: Id6,
1933
+ nativeSessionId: Id6,
1934
+ runtimeId: Id6,
1935
+ context: z9.object({ humanInputId: Id6.nullable(), causalMessageId: Id6.nullable() }).strict(),
1936
+ toolCallId: Id6.optional(),
2054
1937
  receiptReplay: AgentReceiptReplay.optional(),
2055
1938
  // Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
2056
1939
  deadlineAt: Instant3.optional(),
2057
1940
  method: AgentMethod,
2058
- args: z10.unknown()
1941
+ args: z9.unknown()
2059
1942
  }).strict().superRefine((frame, ctx) => {
2060
1943
  if (frame.method === "receipt.peek") {
2061
1944
  if (!frame.toolCallId) {
@@ -2074,19 +1957,19 @@ var AgentRequestFrame = z10.object({
2074
1957
  });
2075
1958
  }
2076
1959
  });
2077
- var AgentResultFrame = z10.discriminatedUnion("ok", [
2078
- z10.object({
2079
- type: z10.literal("agent.result"),
2080
- requestId: Id7,
2081
- runtimeId: Id7,
2082
- ok: z10.literal(true),
2083
- result: z10.unknown()
1960
+ var AgentResultFrame = z9.discriminatedUnion("ok", [
1961
+ z9.object({
1962
+ type: z9.literal("agent.result"),
1963
+ requestId: Id6,
1964
+ runtimeId: Id6,
1965
+ ok: z9.literal(true),
1966
+ result: z9.unknown()
2084
1967
  }),
2085
- z10.object({
2086
- type: z10.literal("agent.result"),
2087
- requestId: Id7,
2088
- runtimeId: Id7,
2089
- ok: z10.literal(false),
1968
+ z9.object({
1969
+ type: z9.literal("agent.result"),
1970
+ requestId: Id6,
1971
+ runtimeId: Id6,
1972
+ ok: z9.literal(false),
2090
1973
  error: ErrorBody
2091
1974
  })
2092
1975
  ]);
@@ -2099,6 +1982,196 @@ import { z as z13 } from "zod";
2099
1982
 
2100
1983
  // packages/protocol/dist/events.js
2101
1984
  import { z as z11 } from "zod";
1985
+
1986
+ // packages/protocol/dist/trackers.js
1987
+ import { z as z10 } from "zod";
1988
+ var Iso2 = z10.string();
1989
+ var Id7 = z10.string().min(1);
1990
+ var TrackerFollow = z10.enum(["assigned", "board"]);
1991
+ var GitHubLogin = z10.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
1992
+ var TrackerStatusOption = z10.object({
1993
+ id: z10.string().min(1),
1994
+ name: z10.string().min(1).max(200)
1995
+ });
1996
+ var TrackerBoard = z10.object({
1997
+ projectNumber: z10.number().int().positive(),
1998
+ statusField: z10.string().min(1).max(100).default("Status"),
1999
+ /** Column to move a card to once its worktree exists (write-back). */
2000
+ onStart: z10.string().min(1).max(200).nullable().default(null),
2001
+ /** Column to move a card to once a pull request is open (write-back). */
2002
+ onReview: z10.string().min(1).max(200).nullable().default(null),
2003
+ /** A single-select field that ranks issues: its first option is the highest. */
2004
+ priorityField: z10.string().min(1).max(100).nullable().optional(),
2005
+ /** Columns whose cards are not tracked until they have a branch or pull request. */
2006
+ backlog: z10.array(z10.string().min(1).max(200)).max(20).optional()
2007
+ });
2008
+ var Tracker = z10.object({
2009
+ id: Id7,
2010
+ name: z10.string().min(1).max(60),
2011
+ provider: z10.literal("github"),
2012
+ hostId: Id7,
2013
+ owner: GitHubLogin,
2014
+ repositories: z10.array(GitHubRepository).min(1).max(50).nullable(),
2015
+ /** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
2016
+ extraRepositories: z10.array(GitHubRepository).max(20).optional(),
2017
+ board: TrackerBoard.nullable(),
2018
+ /** Which issues it follows; absent means "assigned". "board": every open issue on its board. */
2019
+ follow: TrackerFollow.optional(),
2020
+ writeBack: z10.boolean(),
2021
+ moveShared: z10.boolean(),
2022
+ /** Make a worktree for an issue branch that has none; absent means true. */
2023
+ worktrees: z10.boolean().optional(),
2024
+ enabled: z10.boolean(),
2025
+ /** The host's `gh` user, from the last sync. */
2026
+ login: z10.string().nullable(),
2027
+ lastSyncedAt: Iso2.nullable(),
2028
+ lastError: z10.string().max(2e3).nullable(),
2029
+ createdAt: Iso2,
2030
+ updatedAt: Iso2
2031
+ });
2032
+ var TrackerInput = z10.object({
2033
+ name: Tracker.shape.name,
2034
+ hostId: Id7,
2035
+ owner: GitHubLogin,
2036
+ repositories: Tracker.shape.repositories.default(null),
2037
+ extraRepositories: z10.array(GitHubRepository).max(20).default([]),
2038
+ board: TrackerBoard.nullable().default(null),
2039
+ follow: TrackerFollow.default("assigned"),
2040
+ writeBack: z10.boolean().default(false),
2041
+ moveShared: z10.boolean().default(true),
2042
+ worktrees: z10.boolean().default(true),
2043
+ enabled: z10.boolean().default(true)
2044
+ });
2045
+ var TrackerPatch = z10.object({
2046
+ name: Tracker.shape.name.optional(),
2047
+ hostId: Id7.optional(),
2048
+ owner: GitHubLogin.optional(),
2049
+ repositories: Tracker.shape.repositories.optional(),
2050
+ extraRepositories: z10.array(GitHubRepository).max(20).optional(),
2051
+ board: TrackerBoard.nullable().optional(),
2052
+ follow: TrackerFollow.optional(),
2053
+ writeBack: z10.boolean().optional(),
2054
+ moveShared: z10.boolean().optional(),
2055
+ worktrees: z10.boolean().optional(),
2056
+ enabled: z10.boolean().optional()
2057
+ });
2058
+ var TrackerItemBoard = z10.object({
2059
+ projectId: z10.string().min(1),
2060
+ projectItemId: z10.string().min(1),
2061
+ fieldId: z10.string().min(1),
2062
+ status: z10.string().nullable(),
2063
+ statusOptionId: z10.string().nullable(),
2064
+ options: z10.array(TrackerStatusOption).max(50),
2065
+ /** The issue's value of the tracker's priority field; `rank` is its option's position. */
2066
+ priority: z10.object({ name: z10.string().min(1).max(200), rank: z10.number().int().min(0) }).nullable().optional()
2067
+ });
2068
+ var TrackerPullRequest = z10.object({
2069
+ number: z10.number().int().positive(),
2070
+ state: z10.enum(["OPEN", "CLOSED", "MERGED"]),
2071
+ url: z10.string().url(),
2072
+ headRefName: z10.string().min(1).max(255)
2073
+ });
2074
+ var TrackerParent = z10.object({
2075
+ number: z10.number().int().positive(),
2076
+ title: z10.string().max(300),
2077
+ url: GitHubIssueUrl
2078
+ });
2079
+ var TrackerSubIssues = z10.object({
2080
+ total: z10.number().int().min(0),
2081
+ completed: z10.number().int().min(0)
2082
+ });
2083
+ var TrackerItem = z10.object({
2084
+ itemId: z10.string().min(1),
2085
+ repository: GitHubRepository,
2086
+ number: z10.number().int().positive(),
2087
+ title: z10.string().min(1).max(1e3),
2088
+ url: GitHubIssueUrl,
2089
+ assignees: z10.array(z10.string()).max(20),
2090
+ branches: z10.array(z10.string().min(1).max(255)).max(10),
2091
+ pullRequest: TrackerPullRequest.nullable(),
2092
+ board: TrackerItemBoard.nullable(),
2093
+ parent: TrackerParent.nullable().optional(),
2094
+ subIssues: TrackerSubIssues.nullable().optional()
2095
+ });
2096
+ var TrackerSyncResult = z10.object({
2097
+ login: z10.string().min(1),
2098
+ items: z10.array(TrackerItem).max(200),
2099
+ truncated: z10.boolean()
2100
+ });
2101
+ var TrackedIssue = z10.object({
2102
+ /** `${trackerId}:${itemId}` */
2103
+ id: Id7,
2104
+ trackerId: Id7,
2105
+ itemId: z10.string().min(1),
2106
+ projectId: Id7,
2107
+ repository: GitHubRepository,
2108
+ number: z10.number().int().positive(),
2109
+ title: z10.string().min(1).max(300),
2110
+ url: GitHubIssueUrl,
2111
+ assignees: z10.array(z10.string()).max(20),
2112
+ /** Branches GitHub links to the issue. */
2113
+ branches: z10.array(z10.string()).max(10),
2114
+ /** The branch Switchyard works on. */
2115
+ branch: z10.string().nullable(),
2116
+ workspaceId: Id7.nullable(),
2117
+ pullRequest: TrackerPullRequest.nullable(),
2118
+ board: TrackerItemBoard.nullable(),
2119
+ /** The issue this one is a sub-issue of. */
2120
+ parent: TrackerParent.nullable().optional(),
2121
+ subIssues: TrackerSubIssues.nullable().optional(),
2122
+ updatedAt: Iso2
2123
+ });
2124
+ var OpenIssueRequest = z10.object({
2125
+ hostId: Id7.optional(),
2126
+ viewId: z10.string().optional(),
2127
+ /** The first prompt of a new session. */
2128
+ prompt: z10.string().optional(),
2129
+ profileId: z10.string().nullable().optional()
2130
+ });
2131
+ var TrackerSetStatusResult = z10.discriminatedUnion("status", [
2132
+ z10.object({ status: z10.literal("moved") }),
2133
+ z10.object({
2134
+ status: z10.literal("skipped"),
2135
+ reason: z10.enum(["not_assigned", "shared", "stale"])
2136
+ })
2137
+ ]);
2138
+ var LinkIssueRequest = z10.object({ workspaceId: Id7 });
2139
+ var TrackerStatusRequest = z10.object({ status: z10.string().min(1).max(200) });
2140
+ var TrackerHostSyncRequest = z10.object({
2141
+ owner: GitHubLogin,
2142
+ repositories: z10.array(GitHubRepository).nullable(),
2143
+ board: z10.object({
2144
+ projectNumber: z10.number().int().positive(),
2145
+ statusField: z10.string().min(1),
2146
+ priorityField: z10.string().min(1).nullable().optional()
2147
+ }).nullable(),
2148
+ follow: TrackerFollow.optional(),
2149
+ backlog: z10.array(z10.string().min(1)).max(20).optional()
2150
+ });
2151
+ var TrackerHostPrepareBranchRequest = z10.object({
2152
+ checkoutPath: z10.string().min(1),
2153
+ branch: z10.string().min(1).max(255)
2154
+ });
2155
+ var TrackerHostStartIssueRequest = z10.object({
2156
+ checkoutPath: z10.string().min(1),
2157
+ repository: GitHubRepository,
2158
+ number: z10.number().int().positive(),
2159
+ branch: z10.string().min(1).max(255),
2160
+ base: z10.string().min(1)
2161
+ });
2162
+ var TrackerHostSetStatusRequest = z10.object({
2163
+ projectId: z10.string().min(1),
2164
+ projectItemId: z10.string().min(1),
2165
+ fieldId: z10.string().min(1),
2166
+ statusField: z10.string().min(1),
2167
+ optionId: z10.string().min(1),
2168
+ expectedOptionId: z10.string().nullable(),
2169
+ login: z10.string().min(1),
2170
+ allowShared: z10.boolean(),
2171
+ allowUnassigned: z10.boolean().optional()
2172
+ });
2173
+
2174
+ // packages/protocol/dist/events.js
2102
2175
  var EventDataSchemas = {
2103
2176
  "host.updated": Host,
2104
2177
  "project.updated": Project,
@@ -2126,6 +2199,10 @@ var EventDataSchemas = {
2126
2199
  "occurrence.updated": Occurrence,
2127
2200
  "attention.updated": AttentionItem,
2128
2201
  "device.updated": Device,
2202
+ "issue.updated": TrackedIssue,
2203
+ "issue.deleted": z11.object({ id: z11.string() }),
2204
+ "surface.updated": Surface,
2205
+ "surface.deleted": z11.object({ id: z11.string() }),
2129
2206
  "settings.updated": z11.object({ dispatchPaused: z11.boolean() })
2130
2207
  };
2131
2208
  var EVENT_TYPES = Object.keys(EventDataSchemas);
@@ -2204,6 +2281,7 @@ var TermCoordinatorMsg = z12.discriminatedUnion("t", [
2204
2281
 
2205
2282
  // packages/protocol/dist/host-wire.js
2206
2283
  var Origin = z13.enum(["human", "automation"]);
2284
+ var DiffRev = z13.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
2207
2285
  var HostCommand = z13.discriminatedUnion("type", [
2208
2286
  z13.object({
2209
2287
  type: z13.literal("session.start"),
@@ -2346,7 +2424,15 @@ var HostCommand = z13.discriminatedUnion("type", [
2346
2424
  type: z13.literal("workspace.diff"),
2347
2425
  path: z13.string(),
2348
2426
  base: z13.string().nullable(),
2349
- file: z13.string().nullable()
2427
+ file: z13.string().nullable(),
2428
+ /** Hosts without gitLog.v1 never receive it. */
2429
+ rev: DiffRev.optional()
2430
+ }),
2431
+ z13.object({
2432
+ type: z13.literal("workspace.log"),
2433
+ path: z13.string(),
2434
+ base: z13.string().nullable(),
2435
+ limit: z13.number().int().min(1).max(200)
2350
2436
  }),
2351
2437
  z13.object({ type: z13.literal("workspace.files"), path: z13.string(), dir: z13.string() }),
2352
2438
  z13.object({ type: z13.literal("workspace.readFile"), path: z13.string(), file: z13.string() }),
@@ -2430,6 +2516,23 @@ var ProjectSuggestion = z13.object({
2430
2516
  lastActivityAt: z13.string()
2431
2517
  });
2432
2518
  var ProjectSuggestions = z13.object({ suggestions: z13.array(ProjectSuggestion) });
2519
+ var GitCommit = z13.object({
2520
+ sha: z13.string().regex(/^[0-9a-f]{40}$/),
2521
+ subject: z13.string().max(300),
2522
+ author: z13.string().max(200),
2523
+ authoredAt: z13.string(),
2524
+ pushed: z13.boolean()
2525
+ });
2526
+ var LogResult = z13.object({
2527
+ /** The base branch the commits are counted from. */
2528
+ base: z13.string(),
2529
+ /** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
2530
+ scope: z13.enum(["branch", "recent"]),
2531
+ commits: z13.array(GitCommit).max(200),
2532
+ truncated: z13.boolean(),
2533
+ /** Changed and untracked files not committed yet. */
2534
+ uncommitted: z13.number().int().min(0)
2535
+ });
2433
2536
  var DiffFile = z13.object({
2434
2537
  path: z13.string(),
2435
2538
  oldPath: z13.string().nullable(),
@@ -2639,6 +2742,20 @@ var CreateSessionRequest = z14.object({
2639
2742
  title: z14.string().optional(),
2640
2743
  viewId: z14.string().optional()
2641
2744
  });
2745
+ var OpenBranchRequest = z14.object({
2746
+ projectId: z14.string(),
2747
+ branch: z14.string().min(1),
2748
+ hostId: z14.string().optional(),
2749
+ base: z14.string().nullable().optional(),
2750
+ prompt: z14.string().default(""),
2751
+ profileId: z14.string().nullable().optional(),
2752
+ title: z14.string().optional(),
2753
+ viewId: z14.string().optional(),
2754
+ /** Start another session even when the branch has one. */
2755
+ another: z14.boolean().default(false)
2756
+ });
2757
+ var OpenBranchResult = z14.object({ session: Session, created: z14.boolean() });
2758
+ var SetPrimaryRequest = z14.object({ primary: z14.boolean() });
2642
2759
  var PromptRequest = z14.object({
2643
2760
  text: z14.string().min(1),
2644
2761
  mode: z14.enum(["prompt", "steer", "followUp"]).default("prompt"),
@@ -2816,7 +2933,6 @@ var UpdateTaskRequest = z14.object({
2816
2933
  githubIssueUrl: z14.never().optional(),
2817
2934
  githubIssue: z14.never().optional(),
2818
2935
  launchPrompt: z14.never().optional(),
2819
- tracker: z14.never().optional(),
2820
2936
  title: z14.string().min(1).max(300).optional(),
2821
2937
  objective: z14.string().optional(),
2822
2938
  acceptanceCriteria: z14.array(z14.string()).optional(),
@@ -2991,6 +3107,12 @@ var MeResponse = z14.object({
2991
3107
  admin: z14.boolean(),
2992
3108
  publicUrl: z14.string()
2993
3109
  });
3110
+ var SurfaceReport = Surface.pick({
3111
+ kind: true,
3112
+ name: true,
3113
+ machine: true,
3114
+ viewId: true
3115
+ }).extend({ hostId: z14.string().nullable().optional() });
2994
3116
  var ViewInput = View.pick({
2995
3117
  name: true,
2996
3118
  mode: true,
@@ -3015,6 +3137,9 @@ function reconnectDelay(attempt, steps = RECONNECT_BACKOFF_MS, random = Math.ran
3015
3137
  return Math.max(0, Math.round(base * (0.8 + random() * 0.4)));
3016
3138
  }
3017
3139
 
3140
+ // packages/protocol/dist/views.js
3141
+ var SURFACE_OPEN_MS = 10 * 6e4;
3142
+
3018
3143
  // packages/protocol/dist/client-wire.js
3019
3144
  import { z as z15 } from "zod";
3020
3145
  var SyncState = z15.object({
@@ -3032,6 +3157,10 @@ var SyncState = z15.object({
3032
3157
  interactions: z15.array(Interaction),
3033
3158
  panels: z15.array(Panel),
3034
3159
  devices: z15.array(Device),
3160
+ /** Tracked issues; absent from older coordinators. */
3161
+ issues: z15.array(TrackedIssue).default([]),
3162
+ /** Terminal surfaces; absent from older coordinators. */
3163
+ surfaces: z15.array(Surface).default([]),
3035
3164
  adapters: z15.record(z15.string(), z15.array(AdapterInfo)),
3036
3165
  dispatchPaused: z15.boolean()
3037
3166
  });
@@ -3205,9 +3334,6 @@ function monotonicFactory(prng) {
3205
3334
  // packages/protocol/dist/ids.js
3206
3335
  var ulid = monotonicFactory();
3207
3336
 
3208
- // packages/protocol/dist/views.js
3209
- var CLIENT_OPEN_MS = 10 * 6e4;
3210
-
3211
3337
  // packages/protocol/dist/web-bridge.js
3212
3338
  import { z as z16 } from "zod";
3213
3339
  var FRAME_MAX_HEIGHT = 4e3;
@@ -3246,6 +3372,8 @@ function emptyState() {
3246
3372
  interactions: {},
3247
3373
  panels: {},
3248
3374
  devices: {},
3375
+ surfaces: {},
3376
+ issues: {},
3249
3377
  dispatchPaused: false
3250
3378
  };
3251
3379
  }
@@ -3295,6 +3423,8 @@ function applySnapshot(state, seq, snap) {
3295
3423
  interactions: byId(snap.interactions),
3296
3424
  panels,
3297
3425
  devices: byId(snap.devices),
3426
+ surfaces: byId(snap.surfaces ?? []),
3427
+ issues: byId(snap.issues ?? []),
3298
3428
  dispatchPaused: snap.dispatchPaused
3299
3429
  };
3300
3430
  }
@@ -3409,6 +3539,22 @@ function reduceEvent(state, type, data) {
3409
3539
  devices: d.revokedAt ? drop(state.devices, d.id) : put(state.devices, d.id, d)
3410
3540
  };
3411
3541
  }
3542
+ case "issue.updated": {
3543
+ const d = data;
3544
+ return { ...state, issues: put(state.issues, d.id, d) };
3545
+ }
3546
+ case "issue.deleted": {
3547
+ const d = data;
3548
+ return { ...state, issues: drop(state.issues, d.id) };
3549
+ }
3550
+ case "surface.updated": {
3551
+ const d = data;
3552
+ return { ...state, surfaces: put(state.surfaces, d.id, d) };
3553
+ }
3554
+ case "surface.deleted": {
3555
+ const d = data;
3556
+ return { ...state, surfaces: drop(state.surfaces, d.id) };
3557
+ }
3412
3558
  case "settings.updated": {
3413
3559
  const d = data;
3414
3560
  return { ...state, dispatchPaused: d.dispatchPaused };