@rallycry/conveyor-agent 11.0.27 → 11.0.29

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.
@@ -244,6 +244,7 @@ function syncBundleGithubToken(token) {
244
244
  var logger = createServiceLogger("agent-connection");
245
245
  var EVENT_BATCH_MS = 500;
246
246
  var MAX_EVENT_BUFFER = 5e3;
247
+ var PTY_INPUT_REPORT_INTERVAL_MS = 3e4;
247
248
  var TOKEN_REFRESH_INTERVAL_MS = 45 * 60 * 1e3;
248
249
  var AgentConnection = class _AgentConnection {
249
250
  socket = null;
@@ -291,6 +292,9 @@ var AgentConnection = class _AgentConnection {
291
292
  * question-grace expiry reads it to defer un-parking while a human is
292
293
  * actively typing into the Connected-TUI (they may be mid-answer). */
293
294
  _lastPtyInputAt = null;
295
+ /** Runner-side subscribers to keystrokes from EITHER transport. */
296
+ ptyInputActivityListeners = /* @__PURE__ */ new Set();
297
+ lastReportedDirectInputAt = Number.NEGATIVE_INFINITY;
294
298
  constructor(config) {
295
299
  this.config = config;
296
300
  }
@@ -479,7 +483,7 @@ var AgentConnection = class _AgentConnection {
479
483
  });
480
484
  this.socket.on("pty:input", (data) => {
481
485
  if (data.sessionId && data.sessionId !== this.config.sessionId) return;
482
- this._lastPtyInputAt = Date.now();
486
+ this.notePtyInput("relay");
483
487
  this.ptyInputCallback?.(data.data);
484
488
  });
485
489
  this.socket.on("pty:resize", (data) => {
@@ -946,7 +950,32 @@ var AgentConnection = class _AgentConnection {
946
950
  }).catch(() => {
947
951
  });
948
952
  }
949
- /** Epoch ms of the last relayed TUI keystroke, or null before any. */
953
+ /**
954
+ * A human typed into the TUI. Stamps `lastPtyInputAt` and notifies the
955
+ * runner's input-activity listeners for both transports. Direct-stream
956
+ * keystrokes never cross the API, so for those this also tells the server
957
+ * (`reportPtyInput`, throttled, fire-and-forget) — the relay path's server
958
+ * already bumps in `relayPtyInput`. An old API that doesn't know the method
959
+ * rejects harmlessly.
960
+ */
961
+ notePtyInput(origin = "direct") {
962
+ const now = Date.now();
963
+ this._lastPtyInputAt = now;
964
+ for (const listener of this.ptyInputActivityListeners) listener();
965
+ if (origin !== "direct" || !this.socket) return;
966
+ if (now - this.lastReportedDirectInputAt < PTY_INPUT_REPORT_INTERVAL_MS) return;
967
+ this.lastReportedDirectInputAt = now;
968
+ void this.call("reportPtyInput", { sessionId: this.config.sessionId }).catch(() => {
969
+ });
970
+ }
971
+ /** Subscribe to keystroke activity from either transport. Returns an unsubscribe fn. */
972
+ onPtyInputActivity(listener) {
973
+ this.ptyInputActivityListeners.add(listener);
974
+ return () => {
975
+ this.ptyInputActivityListeners.delete(listener);
976
+ };
977
+ }
978
+ /** Epoch ms of the last TUI keystroke (relay or direct), or null before any. */
950
979
  get lastPtyInputAt() {
951
980
  return this._lastPtyInputAt;
952
981
  }
@@ -1446,14 +1475,24 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
1446
1475
  }
1447
1476
  };
1448
1477
 
1449
- // ../shared/dist/chunk-U3HGG5NX.js
1478
+ // ../shared/dist/chunk-3D2OVVIS.js
1450
1479
  import { z } from "zod";
1480
+ import { z as z2 } from "zod";
1451
1481
  var DEFAULT_SONNET_MODEL = "claude-sonnet-5";
1452
1482
  var DEFAULT_OPUS_MODEL = "claude-opus-5-5";
1453
1483
  var DEFAULT_HAIKU_MODEL = "claude-haiku-4-5-20251001";
1454
1484
  var FABLE_MODEL = "claude-fable-5-1";
1455
1485
  var PREVIOUS_SONNET_MODEL = "claude-sonnet-4-6";
1456
1486
  var PREVIOUS_OPUS_MODEL = "claude-opus-5";
1487
+ function formatModelId(provider, model) {
1488
+ return `${provider}/${model}`;
1489
+ }
1490
+ var JEV_MODEL = "jev-1.13.0";
1491
+ var JEV_MODEL_ID = formatModelId("typesafe", JEV_MODEL);
1492
+ var JEV_ZEN_MODEL = "jev-1.13";
1493
+ var JEV_ZEN_MODEL_ID = formatModelId("zen", JEV_ZEN_MODEL);
1494
+ var JEV_INPUT_PRICE_PER_TOKEN = 0.042 / 1e6;
1495
+ var JEV_STATE_MAX_CHARS = 1e5;
1457
1496
  var PTY_STREAM_PORT_BASE = 7420;
1458
1497
  var PTY_STREAM_PORT_ATTEMPTS = 8;
1459
1498
  function encodePtyStreamFrame(frame) {
@@ -1507,6 +1546,11 @@ var PREVIEW_PORT_DENY_LIST = [
1507
1546
  9200,
1508
1547
  ...Array.from({ length: PTY_STREAM_PORT_ATTEMPTS }, (_, i) => PTY_STREAM_PORT_BASE + i)
1509
1548
  ];
1549
+ function isAllowablePreviewPort(port) {
1550
+ if (typeof port !== "number" || !Number.isInteger(port)) return false;
1551
+ if (port < 1 || port > 65535) return false;
1552
+ return !PREVIEW_PORT_DENY_LIST.includes(port);
1553
+ }
1510
1554
  function normalizeCheckpointPath(value) {
1511
1555
  let normalized = value.trim().replace(/\/{2,}/g, "/");
1512
1556
  normalized = normalized.split("/").filter((segment) => segment !== ".").join("/");
@@ -1565,6 +1609,12 @@ var projectCheckpointSettingsSchema = z.object({
1565
1609
  var CARD_DESCRIPTION_MAX = 255;
1566
1610
  var CARD_DESCRIPTION_LIMIT_MESSAGE = `Card descriptions are capped at ${CARD_DESCRIPTION_MAX} characters \u2014 write 1-2 plain sentences a non-engineer can read; put technical detail in the plan or card chat.`;
1567
1611
  var CARD_DESCRIPTION_FIELD_HINT = `max ${CARD_DESCRIPTION_MAX} chars, 1-2 plain sentences a non-engineer can read \u2014 put technical detail in the plan`;
1612
+ var MAX_MANUAL_TESTS_PER_TASK = 5;
1613
+ var MAX_MANUAL_TEST_TITLE_LENGTH = 200;
1614
+ var ManualTestItemsSchema = z2.array(z2.object({ title: z2.string().min(1).max(MAX_MANUAL_TEST_TITLE_LENGTH) })).min(1).max(MAX_MANUAL_TESTS_PER_TASK);
1615
+ function describeManualTestRejection(item) {
1616
+ return item.reason === "cap" ? `Rejected "${item.title}": the card already holds ${MAX_MANUAL_TESTS_PER_TASK} manual tests. Use remove_manual_test or edit_manual_test to consolidate.` : `Rejected "${item.title}": names an automated step (lint, tests, CI, shell); manual tests describe what a person does in the app.`;
1617
+ }
1568
1618
  var DEFAULT_CI_WAIT_TIMEOUT_MINUTES = 45;
1569
1619
  var MAX_CI_WAIT_TIMEOUT_MINUTES = 180;
1570
1620
  var SEVERITY_ENUM = [
@@ -1699,9 +1749,9 @@ async function runQueryGrafanaLogs(port, params, now = Date.now) {
1699
1749
  }
1700
1750
 
1701
1751
  // ../shared/dist/index.js
1702
- import { z as z2 } from "zod";
1703
- import { z as z22 } from "zod";
1704
1752
  import { z as z3 } from "zod";
1753
+ import { z as z22 } from "zod";
1754
+ import { z as z32 } from "zod";
1705
1755
  import { z as z4 } from "zod";
1706
1756
  import { z as z5 } from "zod";
1707
1757
  import { z as z6 } from "zod";
@@ -1736,7 +1786,7 @@ var ACHIEVEMENT_RARITIES = [
1736
1786
  { key: "pack", name: "Pack", color: "#9c27b0", iconPath: "/storypoints/pack.svg" }
1737
1787
  ];
1738
1788
  var RISK_LEVELS = ["critical", "high", "medium", "low"];
1739
- var riskLevelSchema = z2.enum(RISK_LEVELS);
1789
+ var riskLevelSchema = z3.enum(RISK_LEVELS);
1740
1790
  var DEFAULT_RISK_LEVELS = [
1741
1791
  {
1742
1792
  level: "critical",
@@ -1966,7 +2016,9 @@ var KnownAgentEventSchema = z22.discriminatedUnion("type", [
1966
2016
  startCommandRunning: z22.boolean().optional(),
1967
2017
  startCommandConfigured: z22.boolean().optional(),
1968
2018
  // Sanitized server-side by sanitizeSessionPreviewPorts — stays unknown.
1969
- previewPorts: z22.unknown().optional()
2019
+ previewPorts: z22.unknown().optional(),
2020
+ // Sanitized server-side by sanitizeSessionPreviewLinks — stays unknown.
2021
+ previewLinks: z22.unknown().optional()
1970
2022
  }).passthrough(),
1971
2023
  z22.object({ type: z22.literal("setup_error"), message: z22.string() }).passthrough(),
1972
2024
  z22.object({ type: z22.literal("start_command_started") }).passthrough(),
@@ -1983,29 +2035,29 @@ var AgentEventSchema = z22.union([
1983
2035
  KnownAgentEventSchema,
1984
2036
  z22.object({ type: z22.string().min(1) }).catchall(z22.unknown())
1985
2037
  ]);
1986
- var cardDescription = z3.string().max(CARD_DESCRIPTION_MAX, CARD_DESCRIPTION_LIMIT_MESSAGE).optional();
1987
- var AgentHeartbeatSchema = z3.object({
1988
- sessionId: z3.string().optional(),
1989
- timestamp: z3.string(),
1990
- status: z3.enum(["active", "idle", "building"]),
1991
- currentAction: z3.string().optional(),
2038
+ var cardDescription = z32.string().max(CARD_DESCRIPTION_MAX, CARD_DESCRIPTION_LIMIT_MESSAGE).optional();
2039
+ var AgentHeartbeatSchema = z32.object({
2040
+ sessionId: z32.string().optional(),
2041
+ timestamp: z32.string(),
2042
+ status: z32.enum(["active", "idle", "building"]),
2043
+ currentAction: z32.string().optional(),
1992
2044
  /** Sender-observed main event-loop lag (ms) — see AgentHeartbeat.loopLagMs. */
1993
- loopLagMs: z3.number().nonnegative().optional()
1994
- });
1995
- var CreatePRInputSchema = z3.object({
1996
- title: z3.string().min(1),
1997
- body: z3.string(),
1998
- head: z3.string().optional(),
1999
- base: z3.string().optional()
2000
- });
2001
- var PostToChatInputSchema = z3.object({
2002
- message: z3.string().min(1),
2003
- type: z3.enum(["message", "question", "update"]).optional().default("message"),
2004
- milestone: z3.enum(["plan_ready", "implementation_complete", "blocked"]).optional()
2005
- });
2006
- var GetTaskContextRequestSchema = z3.object({
2007
- sessionId: z3.string(),
2008
- includeHistory: z3.boolean().optional().default(false),
2045
+ loopLagMs: z32.number().nonnegative().optional()
2046
+ });
2047
+ var CreatePRInputSchema = z32.object({
2048
+ title: z32.string().min(1),
2049
+ body: z32.string(),
2050
+ head: z32.string().optional(),
2051
+ base: z32.string().optional()
2052
+ });
2053
+ var PostToChatInputSchema = z32.object({
2054
+ message: z32.string().min(1),
2055
+ type: z32.enum(["message", "question", "update"]).optional().default("message"),
2056
+ milestone: z32.enum(["plan_ready", "implementation_complete", "blocked"]).optional()
2057
+ });
2058
+ var GetTaskContextRequestSchema = z32.object({
2059
+ sessionId: z32.string(),
2060
+ includeHistory: z32.boolean().optional().default(false),
2009
2061
  /**
2010
2062
  * Read the plan-revised marker WITHOUT consuming it. Bookkeeping fetches
2011
2063
  * (the session-identity check, the branch refresh) pass true so they cannot
@@ -2013,283 +2065,283 @@ var GetTaskContextRequestSchema = z3.object({
2013
2065
  * Defaults to false — consuming — so a pod running an older agent build still
2014
2066
  * clears the marker instead of showing the notice on every boot forever.
2015
2067
  */
2016
- peekPlanRevision: z3.boolean().optional().default(false)
2068
+ peekPlanRevision: z32.boolean().optional().default(false)
2017
2069
  });
2018
- var GetChatMessagesRequestSchema = z3.object({
2019
- sessionId: z3.string(),
2020
- limit: z3.number().int().positive().optional().default(50),
2021
- offset: z3.number().int().nonnegative().optional().default(0),
2070
+ var GetChatMessagesRequestSchema = z32.object({
2071
+ sessionId: z32.string(),
2072
+ limit: z32.number().int().positive().optional().default(50),
2073
+ offset: z32.number().int().nonnegative().optional().default(0),
2022
2074
  /** Task id or slug to read chat from. Omit for the session's own task. Only
2023
2075
  * the session's own task or one of its children resolves — anything else is
2024
2076
  * an error, never a silent fallback to the caller's own chat. */
2025
- taskId: z3.string().optional()
2077
+ taskId: z32.string().optional()
2026
2078
  });
2027
- var GetTaskFilesRequestSchema = z3.object({
2028
- sessionId: z3.string(),
2029
- taskId: z3.string().optional()
2079
+ var GetTaskFilesRequestSchema = z32.object({
2080
+ sessionId: z32.string(),
2081
+ taskId: z32.string().optional()
2030
2082
  });
2031
- var GetTaskFileRequestSchema = z3.object({
2032
- sessionId: z3.string(),
2033
- fileId: z3.string(),
2034
- taskId: z3.string().optional()
2083
+ var GetTaskFileRequestSchema = z32.object({
2084
+ sessionId: z32.string(),
2085
+ fileId: z32.string(),
2086
+ taskId: z32.string().optional()
2035
2087
  });
2036
- var DeleteTaskFileRequestSchema = z3.object({
2037
- sessionId: z3.string(),
2038
- fileId: z3.string()
2088
+ var DeleteTaskFileRequestSchema = z32.object({
2089
+ sessionId: z32.string(),
2090
+ fileId: z32.string()
2039
2091
  });
2040
- var GetTaskRequestSchema = z3.object({
2041
- sessionId: z3.string(),
2042
- taskSlugOrId: z3.string()
2092
+ var GetTaskRequestSchema = z32.object({
2093
+ sessionId: z32.string(),
2094
+ taskSlugOrId: z32.string()
2043
2095
  });
2044
- var GetCliHistoryRequestSchema = z3.object({
2045
- sessionId: z3.string(),
2046
- limit: z3.number().int().positive().optional().default(100),
2047
- source: z3.enum(["agent", "application"]).optional(),
2096
+ var GetCliHistoryRequestSchema = z32.object({
2097
+ sessionId: z32.string(),
2098
+ limit: z32.number().int().positive().optional().default(100),
2099
+ source: z32.enum(["agent", "application"]).optional(),
2048
2100
  /** Task id or slug to read logs from. Omit for the session's own task. Only
2049
2101
  * the session's own task or one of its children resolves — anything else is
2050
2102
  * an error, never a silent fallback to the caller's own logs. */
2051
- taskId: z3.string().optional()
2103
+ taskId: z32.string().optional()
2052
2104
  });
2053
- var ListSubtasksRequestSchema = z3.object({
2054
- sessionId: z3.string(),
2105
+ var ListSubtasksRequestSchema = z32.object({
2106
+ sessionId: z32.string(),
2055
2107
  /** "compact" returns the slim orchestration view (ListSubtasksCompactResponse:
2056
2108
  * per-child status, agent, story points, PR state, dependencies); "full" (default — wire-compat with older
2057
2109
  * agents) returns the verbose SubtaskSummaryDTO[] including description/plan. */
2058
- view: z3.enum(["compact", "full"]).optional()
2059
- });
2060
- var GetDependenciesRequestSchema = z3.object({
2061
- sessionId: z3.string()
2062
- });
2063
- var GetSuggestionsRequestSchema = z3.object({
2064
- sessionId: z3.string(),
2065
- status: z3.string().optional(),
2066
- limit: z3.number().int().min(1).max(100).optional()
2067
- });
2068
- var ListManualTestsRequestSchema = z3.object({
2069
- sessionId: z3.string()
2070
- });
2071
- var QueryManualTestsRequestSchema = z3.object({
2072
- sessionId: z3.string(),
2073
- cardStatuses: z3.array(z3.string()).optional(),
2074
- testStatuses: z3.array(z3.enum(["open", "approved", "rejected"])).optional()
2075
- });
2076
- var CreatePullRequestRequestSchema = CreatePRInputSchema.extend({ sessionId: z3.string() });
2077
- var RequestFileUploadRequestSchema = z3.object({
2078
- sessionId: z3.string(),
2079
- fileName: z3.string().min(1).max(255),
2080
- mimeType: z3.string().min(1).max(128),
2081
- fileSize: z3.number().int().positive().max(MAX_FILE_SIZE_BYTES)
2082
- });
2083
- var ConfirmFileUploadRequestSchema = z3.object({
2084
- sessionId: z3.string(),
2085
- fileId: z3.string(),
2086
- title: z3.string().max(500).optional(),
2110
+ view: z32.enum(["compact", "full"]).optional()
2111
+ });
2112
+ var GetDependenciesRequestSchema = z32.object({
2113
+ sessionId: z32.string()
2114
+ });
2115
+ var GetSuggestionsRequestSchema = z32.object({
2116
+ sessionId: z32.string(),
2117
+ status: z32.string().optional(),
2118
+ limit: z32.number().int().min(1).max(100).optional()
2119
+ });
2120
+ var ListManualTestsRequestSchema = z32.object({
2121
+ sessionId: z32.string()
2122
+ });
2123
+ var QueryManualTestsRequestSchema = z32.object({
2124
+ sessionId: z32.string(),
2125
+ cardStatuses: z32.array(z32.string()).optional(),
2126
+ testStatuses: z32.array(z32.enum(["open", "approved", "rejected"])).optional()
2127
+ });
2128
+ var CreatePullRequestRequestSchema = CreatePRInputSchema.extend({ sessionId: z32.string() });
2129
+ var RequestFileUploadRequestSchema = z32.object({
2130
+ sessionId: z32.string(),
2131
+ fileName: z32.string().min(1).max(255),
2132
+ mimeType: z32.string().min(1).max(128),
2133
+ fileSize: z32.number().int().positive().max(MAX_FILE_SIZE_BYTES)
2134
+ });
2135
+ var ConfirmFileUploadRequestSchema = z32.object({
2136
+ sessionId: z32.string(),
2137
+ fileId: z32.string(),
2138
+ title: z32.string().max(500).optional(),
2087
2139
  /** Glossary tag names (or ids) this file is an example of. */
2088
- tags: z3.array(z3.string().min(1).max(MAX_FILE_TAG_LENGTH)).max(MAX_FILE_TAGS).optional()
2089
- });
2090
- var UpdateTaskStatusRequestSchema = z3.object({
2091
- sessionId: z3.string(),
2092
- status: z3.string(),
2093
- force: z3.boolean().optional().default(false)
2094
- });
2095
- var StoreSessionIdRequestSchema = z3.object({
2096
- sessionId: z3.string(),
2097
- sdkSessionId: z3.string()
2098
- });
2099
- var SetManualTestsRequestSchema = z3.object({
2100
- sessionId: z3.string(),
2101
- items: z3.array(z3.object({ title: z3.string().min(1) })).min(1)
2102
- });
2103
- var EditManualTestRequestSchema = z3.object({
2104
- sessionId: z3.string(),
2105
- title: z3.string().min(1),
2106
- newTitle: z3.string().min(1)
2107
- });
2108
- var RemoveManualTestRequestSchema = z3.object({
2109
- sessionId: z3.string(),
2110
- title: z3.string().min(1)
2111
- });
2112
- var ApproveManualTestRequestSchema = z3.object({
2113
- sessionId: z3.string(),
2114
- title: z3.string().min(1)
2115
- });
2116
- var RejectManualTestRequestSchema = z3.object({
2117
- sessionId: z3.string(),
2118
- title: z3.string().min(1),
2119
- reason: z3.string().min(1).max(2e3)
2120
- });
2121
- var SessionStartRequestSchema = z3.object({
2122
- sessionId: z3.string(),
2123
- agentVersion: z3.string(),
2124
- capabilities: z3.array(z3.string())
2125
- });
2126
- var SessionStopRequestSchema = z3.object({
2127
- sessionId: z3.string(),
2128
- reason: z3.string().optional()
2129
- });
2130
- var EndReviewSessionRequestSchema = z3.object({
2131
- sessionId: z3.string(),
2132
- reason: z3.enum(["approved", "changes_requested", "finished"]).optional()
2133
- });
2134
- var ConnectAgentRequestSchema = z3.object({
2135
- sessionId: z3.string()
2136
- });
2137
- var ReportAgentStatusRequestSchema = z3.object({
2138
- sessionId: z3.string(),
2139
- status: z3.string(),
2140
+ tags: z32.array(z32.string().min(1).max(MAX_FILE_TAG_LENGTH)).max(MAX_FILE_TAGS).optional()
2141
+ });
2142
+ var UpdateTaskStatusRequestSchema = z32.object({
2143
+ sessionId: z32.string(),
2144
+ status: z32.string(),
2145
+ force: z32.boolean().optional().default(false)
2146
+ });
2147
+ var StoreSessionIdRequestSchema = z32.object({
2148
+ sessionId: z32.string(),
2149
+ sdkSessionId: z32.string()
2150
+ });
2151
+ var SetManualTestsRequestSchema = z32.object({
2152
+ sessionId: z32.string(),
2153
+ items: ManualTestItemsSchema
2154
+ });
2155
+ var EditManualTestRequestSchema = z32.object({
2156
+ sessionId: z32.string(),
2157
+ title: z32.string().min(1),
2158
+ newTitle: z32.string().min(1)
2159
+ });
2160
+ var RemoveManualTestRequestSchema = z32.object({
2161
+ sessionId: z32.string(),
2162
+ title: z32.string().min(1)
2163
+ });
2164
+ var ApproveManualTestRequestSchema = z32.object({
2165
+ sessionId: z32.string(),
2166
+ title: z32.string().min(1)
2167
+ });
2168
+ var RejectManualTestRequestSchema = z32.object({
2169
+ sessionId: z32.string(),
2170
+ title: z32.string().min(1),
2171
+ reason: z32.string().min(1).max(2e3)
2172
+ });
2173
+ var SessionStartRequestSchema = z32.object({
2174
+ sessionId: z32.string(),
2175
+ agentVersion: z32.string(),
2176
+ capabilities: z32.array(z32.string())
2177
+ });
2178
+ var SessionStopRequestSchema = z32.object({
2179
+ sessionId: z32.string(),
2180
+ reason: z32.string().optional()
2181
+ });
2182
+ var EndReviewSessionRequestSchema = z32.object({
2183
+ sessionId: z32.string(),
2184
+ reason: z32.enum(["approved", "changes_requested", "finished"]).optional()
2185
+ });
2186
+ var ConnectAgentRequestSchema = z32.object({
2187
+ sessionId: z32.string()
2188
+ });
2189
+ var ReportAgentStatusRequestSchema = z32.object({
2190
+ sessionId: z32.string(),
2191
+ status: z32.string(),
2140
2192
  /** Why the agent reports this status (e.g. "user_question" while an AskUserQuestion questionnaire is pending in the TUI). */
2141
- reason: z3.string().optional(),
2193
+ reason: z32.string().optional(),
2142
2194
  /**
2143
2195
  * The pending question text, sent only alongside `reason: "user_question"`
2144
2196
  * so the server can surface it in the user-question notification body (and
2145
2197
  * thus the Attention feed) instead of a generic string. Optional: older
2146
2198
  * agents omit it and the server falls back to the generic wording.
2147
2199
  */
2148
- questionText: z3.string().optional()
2200
+ questionText: z32.string().optional()
2149
2201
  });
2150
- var NotifyAgentVersionRequestSchema = z3.object({
2151
- sessionId: z3.string(),
2152
- agentVersion: z3.string()
2202
+ var NotifyAgentVersionRequestSchema = z32.object({
2203
+ sessionId: z32.string(),
2204
+ agentVersion: z32.string()
2153
2205
  });
2154
- var DiscoveredPortSchema = z3.object({
2155
- port: z3.number().int().min(1).max(65535),
2156
- label: z3.string().min(1).max(64).optional(),
2157
- protocol: z3.enum(["http", "tcp"]).optional(),
2158
- detectedAt: z3.string()
2206
+ var DiscoveredPortSchema = z32.object({
2207
+ port: z32.number().int().min(1).max(65535),
2208
+ label: z32.string().min(1).max(64).optional(),
2209
+ protocol: z32.enum(["http", "tcp"]).optional(),
2210
+ detectedAt: z32.string()
2159
2211
  });
2160
- var ReportDiscoveredPortsRequestSchema = z3.object({
2161
- sessionId: z3.string(),
2162
- ports: z3.array(DiscoveredPortSchema).max(64)
2212
+ var ReportDiscoveredPortsRequestSchema = z32.object({
2213
+ sessionId: z32.string(),
2214
+ ports: z32.array(DiscoveredPortSchema).max(64)
2163
2215
  });
2164
- var ReportBootMilestoneRequestSchema = z3.object({
2165
- sessionId: z3.string(),
2166
- key: z3.string().max(64)
2216
+ var ReportBootMilestoneRequestSchema = z32.object({
2217
+ sessionId: z32.string(),
2218
+ key: z32.string().max(64)
2167
2219
  });
2168
- var CreateSubtaskRequestSchema = z3.object({
2169
- sessionId: z3.string(),
2170
- title: z3.string().min(1),
2220
+ var CreateSubtaskRequestSchema = z32.object({
2221
+ sessionId: z32.string(),
2222
+ title: z32.string().min(1),
2171
2223
  description: cardDescription,
2172
- plan: z3.string().optional(),
2173
- storyPointValue: z3.number().int().positive().optional(),
2174
- ordinal: z3.number().int().nonnegative().optional(),
2175
- followParentStatus: z3.boolean().optional(),
2224
+ plan: z32.string().optional(),
2225
+ storyPointValue: z32.number().int().positive().optional(),
2226
+ ordinal: z32.number().int().nonnegative().optional(),
2227
+ followParentStatus: z32.boolean().optional(),
2176
2228
  /** Sibling subtask ids or slugs this subtask blocks on (explicit dependency
2177
2229
  * metadata — preferred over encoding order in plan text / ordinal). */
2178
- dependsOn: z3.array(z3.string().min(1)).max(32).optional(),
2230
+ dependsOn: z32.array(z32.string().min(1)).max(32).optional(),
2179
2231
  /** Glossary tag names to assign to the child. Unmatched names come back in
2180
2232
  * the response rather than failing the create. */
2181
- tags: z3.array(z3.string().min(1)).max(10).optional()
2233
+ tags: z32.array(z32.string().min(1)).max(10).optional()
2182
2234
  });
2183
- var UpdateSubtaskRequestSchema = z3.object({
2184
- sessionId: z3.string(),
2185
- subtaskId: z3.string(),
2186
- title: z3.string().min(1).optional(),
2235
+ var UpdateSubtaskRequestSchema = z32.object({
2236
+ sessionId: z32.string(),
2237
+ subtaskId: z32.string(),
2238
+ title: z32.string().min(1).optional(),
2187
2239
  description: cardDescription,
2188
- plan: z3.string().optional(),
2240
+ plan: z32.string().optional(),
2189
2241
  /** Orchestration statuses only ("Planning" | "Open") — the pack parent's
2190
2242
  * sanctioned promotion path. Execution statuses stay with the build
2191
2243
  * pipeline / force_update_task_status. Enforced server-side. */
2192
- status: z3.string().optional(),
2244
+ status: z32.string().optional(),
2193
2245
  /** Assign a project agent to the child — accepts the agent's id or exact
2194
2246
  * name; resolved against the parent task's project server-side. */
2195
- agentIdOrName: z3.string().min(1).optional(),
2196
- storyPointValue: z3.number().int().positive().optional(),
2197
- followParentStatus: z3.boolean().optional(),
2247
+ agentIdOrName: z32.string().min(1).optional(),
2248
+ storyPointValue: z32.number().int().positive().optional(),
2249
+ followParentStatus: z32.boolean().optional(),
2198
2250
  /** Replace this subtask's dependency edges with these sibling ids/slugs.
2199
2251
  * Empty array clears all. Omit to leave dependencies unchanged. */
2200
- dependsOn: z3.array(z3.string().min(1)).max(32).optional()
2252
+ dependsOn: z32.array(z32.string().min(1)).max(32).optional()
2201
2253
  });
2202
- var DeleteSubtaskRequestSchema = z3.object({
2203
- sessionId: z3.string(),
2204
- subtaskId: z3.string()
2254
+ var DeleteSubtaskRequestSchema = z32.object({
2255
+ sessionId: z32.string(),
2256
+ subtaskId: z32.string()
2205
2257
  });
2206
- var SetSubtaskParentRequestSchema = z3.object({
2207
- sessionId: z3.string(),
2208
- taskId: z3.string().min(1),
2209
- detach: z3.boolean().optional(),
2210
- ordinal: z3.number().int().nonnegative().optional(),
2211
- followParentStatus: z3.boolean().optional()
2258
+ var SetSubtaskParentRequestSchema = z32.object({
2259
+ sessionId: z32.string(),
2260
+ taskId: z32.string().min(1),
2261
+ detach: z32.boolean().optional(),
2262
+ ordinal: z32.number().int().nonnegative().optional(),
2263
+ followParentStatus: z32.boolean().optional()
2212
2264
  });
2213
- var GetTaskPropertiesRequestSchema = z3.object({
2214
- sessionId: z3.string()
2265
+ var GetTaskPropertiesRequestSchema = z32.object({
2266
+ sessionId: z32.string()
2215
2267
  });
2216
- var UpdateTaskFieldsRequestSchema = z3.object({
2217
- sessionId: z3.string(),
2218
- plan: z3.string().optional(),
2268
+ var UpdateTaskFieldsRequestSchema = z32.object({
2269
+ sessionId: z32.string(),
2270
+ plan: z32.string().optional(),
2219
2271
  description: cardDescription
2220
2272
  });
2221
- var UpdateTaskPropertiesRequestSchema = z3.object({
2222
- sessionId: z3.string(),
2223
- title: z3.string().optional(),
2224
- storyPointValue: z3.number().int().positive().optional(),
2225
- tagIds: z3.array(z3.string()).optional(),
2226
- tagNames: z3.array(z3.string()).optional(),
2227
- githubPRUrl: z3.string().url().optional(),
2228
- githubBranch: z3.string().optional(),
2273
+ var UpdateTaskPropertiesRequestSchema = z32.object({
2274
+ sessionId: z32.string(),
2275
+ title: z32.string().optional(),
2276
+ storyPointValue: z32.number().int().positive().optional(),
2277
+ tagIds: z32.array(z32.string()).optional(),
2278
+ tagNames: z32.array(z32.string()).optional(),
2279
+ githubPRUrl: z32.string().url().optional(),
2280
+ githubBranch: z32.string().optional(),
2229
2281
  // Canonical risk level, or null to clear — same semantics as the headless
2230
2282
  // update_task boundary (resolved to the project's Risk row in the handler).
2231
2283
  risk: riskLevelSchema.nullable().optional()
2232
2284
  });
2233
- var ListIconsRequestSchema = z3.object({
2234
- sessionId: z3.string()
2285
+ var ListIconsRequestSchema = z32.object({
2286
+ sessionId: z32.string()
2235
2287
  });
2236
- var GenerateTaskIconRequestSchema = z3.object({
2237
- sessionId: z3.string(),
2238
- prompt: z3.string().min(1),
2239
- aspectRatio: z3.string().optional()
2288
+ var GenerateTaskIconRequestSchema = z32.object({
2289
+ sessionId: z32.string(),
2290
+ prompt: z32.string().min(1),
2291
+ aspectRatio: z32.string().optional()
2240
2292
  });
2241
- var SearchFaIconsRequestSchema = z3.object({
2242
- sessionId: z3.string(),
2243
- query: z3.string().min(1),
2244
- first: z3.number().int().positive().optional()
2293
+ var SearchFaIconsRequestSchema = z32.object({
2294
+ sessionId: z32.string(),
2295
+ query: z32.string().min(1),
2296
+ first: z32.number().int().positive().optional()
2245
2297
  });
2246
- var PickFaIconRequestSchema = z3.object({
2247
- sessionId: z3.string(),
2248
- fontAwesomeId: z3.string().min(1),
2249
- fontAwesomeStyle: z3.string().optional()
2298
+ var PickFaIconRequestSchema = z32.object({
2299
+ sessionId: z32.string(),
2300
+ fontAwesomeId: z32.string().min(1),
2301
+ fontAwesomeStyle: z32.string().optional()
2250
2302
  });
2251
- var CreateFollowUpTaskRequestSchema = z3.object({
2252
- sessionId: z3.string(),
2253
- title: z3.string().min(1),
2303
+ var CreateFollowUpTaskRequestSchema = z32.object({
2304
+ sessionId: z32.string(),
2305
+ title: z32.string().min(1),
2254
2306
  description: cardDescription,
2255
- plan: z3.string().optional(),
2256
- storyPointValue: z3.number().int().positive().optional()
2307
+ plan: z32.string().optional(),
2308
+ storyPointValue: z32.number().int().positive().optional()
2257
2309
  });
2258
- var AddDependencyRequestSchema = z3.object({
2259
- sessionId: z3.string(),
2260
- dependsOnSlugOrId: z3.string()
2310
+ var AddDependencyRequestSchema = z32.object({
2311
+ sessionId: z32.string(),
2312
+ dependsOnSlugOrId: z32.string()
2261
2313
  });
2262
- var RemoveDependencyRequestSchema = z3.object({
2263
- sessionId: z3.string(),
2264
- dependsOnSlugOrId: z3.string()
2314
+ var RemoveDependencyRequestSchema = z32.object({
2315
+ sessionId: z32.string(),
2316
+ dependsOnSlugOrId: z32.string()
2265
2317
  });
2266
- var CreateSuggestionRequestSchema = z3.object({
2267
- sessionId: z3.string(),
2268
- title: z3.string().min(1),
2318
+ var CreateSuggestionRequestSchema = z32.object({
2319
+ sessionId: z32.string(),
2320
+ title: z32.string().min(1),
2269
2321
  description: cardDescription,
2270
- tagNames: z3.array(z3.string()).optional()
2322
+ tagNames: z32.array(z32.string()).optional()
2271
2323
  });
2272
- var VoteSuggestionRequestSchema = z3.object({
2273
- sessionId: z3.string(),
2274
- suggestionId: z3.string(),
2275
- value: z3.union([z3.literal(1), z3.literal(-1)])
2324
+ var VoteSuggestionRequestSchema = z32.object({
2325
+ sessionId: z32.string(),
2326
+ suggestionId: z32.string(),
2327
+ value: z32.union([z32.literal(1), z32.literal(-1)])
2276
2328
  });
2277
- var TriggerIdentificationRequestSchema = z3.object({
2278
- sessionId: z3.string()
2329
+ var TriggerIdentificationRequestSchema = z32.object({
2330
+ sessionId: z32.string()
2279
2331
  });
2280
- var HandoffToImplementerRequestSchema = z3.object({
2281
- sessionId: z3.string(),
2332
+ var HandoffToImplementerRequestSchema = z32.object({
2333
+ sessionId: z32.string(),
2282
2334
  // Optional difficulty sizing — sets the task's story points before resolving
2283
2335
  // the matched implementer agent. Omit to hand off using the task's current
2284
2336
  // story points (or the project's default task agent when unsized).
2285
- storyPoints: z3.number().int().positive().optional(),
2337
+ storyPoints: z32.number().int().positive().optional(),
2286
2338
  // Optional kickoff note posted to the task chat alongside the handoff notice.
2287
- message: z3.string().optional()
2339
+ message: z32.string().optional()
2288
2340
  });
2289
- var SubmitCodeReviewResultRequestSchema = z3.object({
2290
- sessionId: z3.string(),
2291
- approved: z3.boolean(),
2292
- content: z3.string(),
2341
+ var SubmitCodeReviewResultRequestSchema = z32.object({
2342
+ sessionId: z32.string(),
2343
+ approved: z32.boolean(),
2344
+ content: z32.string(),
2293
2345
  // Canonical risk level the reviewer assigned to this change. Required on every
2294
2346
  // verdict — the reviewer must judge it. Applied authoritatively server-side
2295
2347
  // (may raise OR lower an already-set value; the reviewer has that authority).
@@ -2297,165 +2349,168 @@ var SubmitCodeReviewResultRequestSchema = z3.object({
2297
2349
  // The commit SHA the reviewer actually reviewed. When present, the verdict is
2298
2350
  // rejected unless the task is still at this SHA (guards against a late
2299
2351
  // old-SHA verdict overwriting a newer review cycle).
2300
- reviewedSha: z3.string().optional()
2301
- });
2302
- var CycleCodingAgentKeyRequestSchema = z3.object({
2303
- sessionId: z3.string(),
2304
- rateLimitType: z3.string(),
2305
- resetsAt: z3.string().optional()
2306
- });
2307
- var PostChildChatMessageRequestSchema = z3.object({
2308
- sessionId: z3.string(),
2309
- childTaskId: z3.string(),
2310
- message: z3.string().min(1)
2311
- });
2312
- var UpdateChildStatusRequestSchema = z3.object({
2313
- sessionId: z3.string(),
2314
- childTaskId: z3.string(),
2315
- status: z3.string()
2316
- });
2317
- var GetAgentStatusRequestSchema = z3.object({
2318
- taskId: z3.string()
2319
- });
2320
- var GetUiCliHistoryRequestSchema = z3.object({
2321
- taskId: z3.string()
2322
- });
2323
- var GetActivePtySessionRequestSchema = z3.object({
2324
- taskId: z3.string()
2325
- });
2326
- var ListActivePtySessionsRequestSchema = z3.object({
2327
- taskId: z3.string()
2328
- });
2329
- var SendSoftStopRequestSchema = z3.object({
2330
- taskId: z3.string()
2331
- });
2332
- var StopTaskSessionRequestSchema = z3.object({
2333
- taskId: z3.string(),
2334
- sessionId: z3.string()
2335
- });
2336
- var FlushTaskQueueRequestSchema = z3.object({
2337
- taskId: z3.string(),
2338
- softStop: z3.boolean().optional()
2339
- });
2340
- var CancelTaskQueuedMessageRequestSchema = z3.object({
2341
- taskId: z3.string(),
2342
- messageId: z3.string()
2343
- });
2344
- var FlushSingleQueuedMessageRequestSchema = z3.object({
2345
- taskId: z3.string(),
2346
- messageId: z3.string(),
2347
- softStop: z3.boolean().optional()
2348
- });
2349
- var AnswerAgentQuestionRequestSchema = z3.object({
2350
- taskId: z3.string(),
2351
- requestId: z3.string(),
2352
- answers: z3.record(z3.string(), z3.string())
2353
- });
2354
- var ClearAgentTodosRequestSchema = z3.object({
2355
- taskId: z3.string()
2356
- });
2357
- var AgentQuestionOptionSchema = z3.object({
2358
- label: z3.string(),
2359
- description: z3.string(),
2360
- preview: z3.string().optional()
2361
- });
2362
- var AgentQuestionSchema = z3.object({
2363
- question: z3.string(),
2364
- header: z3.string(),
2365
- options: z3.array(AgentQuestionOptionSchema),
2366
- multiSelect: z3.boolean().optional()
2367
- });
2368
- var AskUserQuestionRequestSchema = z3.object({
2369
- sessionId: z3.string(),
2370
- question: z3.string().min(1),
2371
- requestId: z3.string().min(1),
2372
- questions: z3.array(AgentQuestionSchema).min(1)
2373
- });
2374
- var PostAgentMessageRequestSchema = z3.object({
2375
- sessionId: z3.string().min(1),
2376
- content: z3.string(),
2377
- milestone: z3.enum(["plan_ready", "implementation_complete", "blocked"]).optional()
2378
- });
2379
- var EmitAgentEventRequestSchema = z3.object({
2380
- sessionId: z3.string(),
2381
- events: z3.array(AgentEventSchema).max(500)
2382
- });
2383
- var RefreshGithubTokenRequestSchema = z3.object({
2384
- sessionId: z3.string(),
2385
- forceFresh: z3.boolean().optional()
2386
- });
2387
- var ReportCredentialFailureRequestSchema = z3.object({
2388
- sessionId: z3.string(),
2389
- error: z3.string().max(2e3).optional(),
2390
- tokenShape: z3.string().max(500).optional(),
2391
- healed: z3.boolean().optional()
2392
- });
2393
- var ReportReviewSpawnFailureRequestSchema = z3.object({
2394
- sessionId: z3.string(),
2395
- reviewSessionId: z3.string(),
2396
- error: z3.string().max(2e3).optional()
2352
+ reviewedSha: z32.string().optional()
2353
+ });
2354
+ var CycleCodingAgentKeyRequestSchema = z32.object({
2355
+ sessionId: z32.string(),
2356
+ rateLimitType: z32.string(),
2357
+ resetsAt: z32.string().optional()
2358
+ });
2359
+ var PostChildChatMessageRequestSchema = z32.object({
2360
+ sessionId: z32.string(),
2361
+ childTaskId: z32.string(),
2362
+ message: z32.string().min(1)
2363
+ });
2364
+ var UpdateChildStatusRequestSchema = z32.object({
2365
+ sessionId: z32.string(),
2366
+ childTaskId: z32.string(),
2367
+ status: z32.string()
2368
+ });
2369
+ var GetAgentStatusRequestSchema = z32.object({
2370
+ taskId: z32.string()
2371
+ });
2372
+ var GetUiCliHistoryRequestSchema = z32.object({
2373
+ taskId: z32.string()
2374
+ });
2375
+ var GetActivePtySessionRequestSchema = z32.object({
2376
+ taskId: z32.string()
2377
+ });
2378
+ var ListActivePtySessionsRequestSchema = z32.object({
2379
+ taskId: z32.string()
2380
+ });
2381
+ var SendSoftStopRequestSchema = z32.object({
2382
+ taskId: z32.string()
2383
+ });
2384
+ var StopTaskSessionRequestSchema = z32.object({
2385
+ taskId: z32.string(),
2386
+ sessionId: z32.string()
2387
+ });
2388
+ var FlushTaskQueueRequestSchema = z32.object({
2389
+ taskId: z32.string(),
2390
+ softStop: z32.boolean().optional()
2391
+ });
2392
+ var CancelTaskQueuedMessageRequestSchema = z32.object({
2393
+ taskId: z32.string(),
2394
+ messageId: z32.string()
2395
+ });
2396
+ var FlushSingleQueuedMessageRequestSchema = z32.object({
2397
+ taskId: z32.string(),
2398
+ messageId: z32.string(),
2399
+ softStop: z32.boolean().optional()
2400
+ });
2401
+ var AnswerAgentQuestionRequestSchema = z32.object({
2402
+ taskId: z32.string(),
2403
+ requestId: z32.string(),
2404
+ answers: z32.record(z32.string(), z32.string())
2405
+ });
2406
+ var ClearAgentTodosRequestSchema = z32.object({
2407
+ taskId: z32.string()
2408
+ });
2409
+ var AgentQuestionOptionSchema = z32.object({
2410
+ label: z32.string(),
2411
+ description: z32.string(),
2412
+ preview: z32.string().optional()
2413
+ });
2414
+ var AgentQuestionSchema = z32.object({
2415
+ question: z32.string(),
2416
+ header: z32.string(),
2417
+ options: z32.array(AgentQuestionOptionSchema),
2418
+ multiSelect: z32.boolean().optional()
2419
+ });
2420
+ var AskUserQuestionRequestSchema = z32.object({
2421
+ sessionId: z32.string(),
2422
+ question: z32.string().min(1),
2423
+ requestId: z32.string().min(1),
2424
+ questions: z32.array(AgentQuestionSchema).min(1)
2425
+ });
2426
+ var PostAgentMessageRequestSchema = z32.object({
2427
+ sessionId: z32.string().min(1),
2428
+ content: z32.string(),
2429
+ milestone: z32.enum(["plan_ready", "implementation_complete", "blocked"]).optional()
2430
+ });
2431
+ var EmitAgentEventRequestSchema = z32.object({
2432
+ sessionId: z32.string(),
2433
+ events: z32.array(AgentEventSchema).max(500)
2434
+ });
2435
+ var RefreshGithubTokenRequestSchema = z32.object({
2436
+ sessionId: z32.string(),
2437
+ forceFresh: z32.boolean().optional()
2438
+ });
2439
+ var ReportCredentialFailureRequestSchema = z32.object({
2440
+ sessionId: z32.string(),
2441
+ error: z32.string().max(2e3).optional(),
2442
+ tokenShape: z32.string().max(500).optional(),
2443
+ healed: z32.boolean().optional()
2444
+ });
2445
+ var ReportReviewSpawnFailureRequestSchema = z32.object({
2446
+ sessionId: z32.string(),
2447
+ reviewSessionId: z32.string(),
2448
+ error: z32.string().max(2e3).optional()
2397
2449
  });
2398
2450
  var ReportBuilderSpawnFailureRequestSchema = ReportReviewSpawnFailureRequestSchema.omit({
2399
2451
  reviewSessionId: true
2400
- }).extend({ buildSessionId: z3.string() });
2401
- var SpawnTaskSessionRequestSchema = z3.object({
2402
- taskId: z3.string(),
2403
- kind: z3.enum(["tui", "shell"])
2452
+ }).extend({ buildSessionId: z32.string() });
2453
+ var SpawnTaskSessionRequestSchema = z32.object({
2454
+ taskId: z32.string(),
2455
+ kind: z32.enum(["tui", "shell"])
2404
2456
  });
2405
- var StartCodeReviewRequestSchema = z3.object({
2406
- taskId: z3.string(),
2407
- force: z3.boolean().optional()
2457
+ var StartCodeReviewRequestSchema = z32.object({
2458
+ taskId: z32.string(),
2459
+ force: z32.boolean().optional()
2408
2460
  });
2409
- var StopCodeReviewRequestSchema = z3.object({
2410
- taskId: z3.string()
2461
+ var StopCodeReviewRequestSchema = z32.object({
2462
+ taskId: z32.string()
2411
2463
  });
2412
- var ReportSessionSpawnFailureRequestSchema = z3.object({
2413
- sessionId: z3.string(),
2414
- spawnedSessionId: z3.string(),
2415
- error: z3.string().max(2e3).optional()
2464
+ var ReportSessionSpawnFailureRequestSchema = z32.object({
2465
+ sessionId: z32.string(),
2466
+ spawnedSessionId: z32.string(),
2467
+ error: z32.string().max(2e3).optional()
2416
2468
  });
2417
- var RefreshGithubTokenResponseSchema = z3.object({
2418
- token: z3.string()
2469
+ var RefreshGithubTokenResponseSchema = z32.object({
2470
+ token: z32.string()
2419
2471
  });
2420
2472
  var PTY_FRAME_MAX_CHARS = 256 * 1024;
2421
2473
  var PTY_MAX_DIMENSION = 1e3;
2422
- var PtyOutputRequestSchema = z3.object({
2423
- sessionId: z3.string(),
2424
- data: z3.string().max(PTY_FRAME_MAX_CHARS),
2425
- cols: z3.number().int().positive().max(PTY_MAX_DIMENSION).optional(),
2426
- rows: z3.number().int().positive().max(PTY_MAX_DIMENSION).optional()
2427
- });
2428
- var PtyEndedRequestSchema = z3.object({
2429
- sessionId: z3.string()
2430
- });
2431
- var PtyInputRequestSchema = z3.object({
2432
- sessionId: z3.string(),
2433
- data: z3.string().max(PTY_FRAME_MAX_CHARS)
2434
- });
2435
- var PtyResizeRequestSchema = z3.object({
2436
- sessionId: z3.string(),
2437
- cols: z3.number().int().positive().max(PTY_MAX_DIMENSION),
2438
- rows: z3.number().int().positive().max(PTY_MAX_DIMENSION)
2439
- });
2440
- var PtyAttachRequestSchema = z3.object({
2441
- sessionId: z3.string()
2442
- });
2443
- var ReportPtyStreamRequestSchema = z3.object({
2444
- sessionId: z3.string(),
2445
- port: z3.number().int().positive().max(65535).nullable()
2446
- });
2447
- var GetPtyStreamEndpointRequestSchema = z3.object({
2448
- sessionId: z3.string()
2449
- });
2450
- var PtyChatEventPayloadSchema = z3.discriminatedUnion("kind", [
2451
- z3.object({
2452
- kind: z3.literal("init"),
2453
- model: z3.string().max(200),
2454
- claudeSessionId: z3.string().max(100).optional()
2474
+ var PtyOutputRequestSchema = z32.object({
2475
+ sessionId: z32.string(),
2476
+ data: z32.string().max(PTY_FRAME_MAX_CHARS),
2477
+ cols: z32.number().int().positive().max(PTY_MAX_DIMENSION).optional(),
2478
+ rows: z32.number().int().positive().max(PTY_MAX_DIMENSION).optional()
2479
+ });
2480
+ var PtyEndedRequestSchema = z32.object({
2481
+ sessionId: z32.string()
2482
+ });
2483
+ var PtyInputRequestSchema = z32.object({
2484
+ sessionId: z32.string(),
2485
+ data: z32.string().max(PTY_FRAME_MAX_CHARS)
2486
+ });
2487
+ var PtyResizeRequestSchema = z32.object({
2488
+ sessionId: z32.string(),
2489
+ cols: z32.number().int().positive().max(PTY_MAX_DIMENSION),
2490
+ rows: z32.number().int().positive().max(PTY_MAX_DIMENSION)
2491
+ });
2492
+ var PtyAttachRequestSchema = z32.object({
2493
+ sessionId: z32.string()
2494
+ });
2495
+ var ReportPtyStreamRequestSchema = z32.object({
2496
+ sessionId: z32.string(),
2497
+ port: z32.number().int().positive().max(65535).nullable()
2498
+ });
2499
+ var ReportPtyInputRequestSchema = z32.object({
2500
+ sessionId: z32.string()
2501
+ });
2502
+ var GetPtyStreamEndpointRequestSchema = z32.object({
2503
+ sessionId: z32.string()
2504
+ });
2505
+ var PtyChatEventPayloadSchema = z32.discriminatedUnion("kind", [
2506
+ z32.object({
2507
+ kind: z32.literal("init"),
2508
+ model: z32.string().max(200),
2509
+ claudeSessionId: z32.string().max(100).optional()
2455
2510
  }),
2456
- z3.object({
2457
- kind: z3.literal("user_text"),
2458
- text: z3.string().max(16384),
2511
+ z32.object({
2512
+ kind: z32.literal("user_text"),
2513
+ text: z32.string().max(16384),
2459
2514
  // Set by the SERVER (never the agent) when this prompt was injected by
2460
2515
  // Conveyor rather than typed by a human — the routed message's `source`
2461
2516
  // (`ci_success`, `review_trigger`, `automated_feedback`, …). The agent
@@ -2463,69 +2518,69 @@ var PtyChatEventPayloadSchema = z3.discriminatedUnion("kind", [
2463
2518
  // CLI records both as plain transcript `user` records; without this the
2464
2519
  // builder chat renders "All CI checks passed on your PR." as the human's
2465
2520
  // own bubble. Absent ⇒ a genuine human prompt.
2466
- source: z3.string().max(60).optional()
2521
+ source: z32.string().max(60).optional()
2467
2522
  }),
2468
- z3.object({ kind: z3.literal("assistant_text"), text: z3.string().max(16384) }),
2469
- z3.object({
2470
- kind: z3.literal("tool_use"),
2471
- name: z3.string().max(200),
2523
+ z32.object({ kind: z32.literal("assistant_text"), text: z32.string().max(16384) }),
2524
+ z32.object({
2525
+ kind: z32.literal("tool_use"),
2526
+ name: z32.string().max(200),
2472
2527
  // Compact preview: JSON.stringify(input) truncated agent-side. The cap
2473
2528
  // matches the text events because AskUserQuestion payloads ride this field
2474
2529
  // and the web lifts them into an interactive card — a tight cap forced
2475
2530
  // option descriptions down to 80 chars, making them unreadable. Every
2476
2531
  // other tool keeps a far smaller agent-side budget (`TOOL_INPUT_MAX` in
2477
2532
  // `chat-record-mapper.ts`), so the ring does not grow for normal calls.
2478
- input: z3.string().max(16384),
2533
+ input: z32.string().max(16384),
2479
2534
  // Transcript tool_use block id — lets the client pair the tool_result.
2480
- id: z3.string().max(100).optional()
2535
+ id: z32.string().max(100).optional()
2481
2536
  }),
2482
- z3.object({
2483
- kind: z3.literal("tool_result"),
2537
+ z32.object({
2538
+ kind: z32.literal("tool_result"),
2484
2539
  // tool_use block id this result answers (absent on malformed records).
2485
- toolUseId: z3.string().max(100).optional(),
2540
+ toolUseId: z32.string().max(100).optional(),
2486
2541
  // Compact output preview, truncated agent-side.
2487
- output: z3.string().max(2e3),
2488
- isError: z3.boolean().optional()
2542
+ output: z32.string().max(2e3),
2543
+ isError: z32.boolean().optional()
2489
2544
  }),
2490
- z3.object({ kind: z3.literal("turn_end") })
2545
+ z32.object({ kind: z32.literal("turn_end") })
2491
2546
  ]);
2492
- var PtyChatEventRequestSchema = z3.object({
2493
- sessionId: z3.string(),
2547
+ var PtyChatEventRequestSchema = z32.object({
2548
+ sessionId: z32.string(),
2494
2549
  event: PtyChatEventPayloadSchema
2495
2550
  });
2496
- var PtyChatAttachRequestSchema = z3.object({
2497
- sessionId: z3.string()
2551
+ var PtyChatAttachRequestSchema = z32.object({
2552
+ sessionId: z32.string()
2498
2553
  });
2499
- var CreatePRResponseSchema = z3.object({
2500
- prNumber: z3.number().int().positive(),
2501
- prUrl: z3.string().url(),
2554
+ var CreatePRResponseSchema = z32.object({
2555
+ prNumber: z32.number().int().positive(),
2556
+ prUrl: z32.string().url(),
2502
2557
  /** Advisory glossary-upkeep note derived from the PR's changed files matched
2503
2558
  * against tag contextPaths — rendered into the tool result, never stored. */
2504
- glossaryNote: z3.string().optional()
2559
+ glossaryNote: z32.string().optional()
2505
2560
  });
2506
- var PostToChatResponseSchema = z3.object({
2507
- messageId: z3.string()
2561
+ var PostToChatResponseSchema = z32.object({
2562
+ messageId: z32.string()
2508
2563
  });
2509
- var UpdateTaskStatusResponseSchema = z3.object({
2510
- taskId: z3.string(),
2511
- status: z3.string()
2564
+ var UpdateTaskStatusResponseSchema = z32.object({
2565
+ taskId: z32.string(),
2566
+ status: z32.string()
2512
2567
  });
2513
- var StoreSessionIdResponseSchema = z3.object({
2514
- success: z3.boolean()
2568
+ var StoreSessionIdResponseSchema = z32.object({
2569
+ success: z32.boolean()
2515
2570
  });
2516
- var HeartbeatResponseSchema = z3.object({
2517
- acknowledged: z3.boolean()
2571
+ var HeartbeatResponseSchema = z32.object({
2572
+ acknowledged: z32.boolean()
2518
2573
  });
2519
- var SessionStartResponseSchema = z3.object({
2520
- sessionId: z3.string(),
2521
- startedAt: z3.string()
2574
+ var SessionStartResponseSchema = z32.object({
2575
+ sessionId: z32.string(),
2576
+ startedAt: z32.string()
2522
2577
  });
2523
- var SessionStopResponseSchema = z3.object({
2524
- sessionId: z3.string(),
2525
- stoppedAt: z3.string()
2578
+ var SessionStopResponseSchema = z32.object({
2579
+ sessionId: z32.string(),
2580
+ stoppedAt: z32.string()
2526
2581
  });
2527
- var DeleteSubtaskResponseSchema = z3.object({
2528
- deleted: z3.boolean()
2582
+ var DeleteSubtaskResponseSchema = z32.object({
2583
+ deleted: z32.boolean()
2529
2584
  });
2530
2585
  var ParkOnCheckResultRequestSchema = z4.object({
2531
2586
  sessionId: z4.string(),
@@ -2561,6 +2616,11 @@ var ListProjectTasksRequestSchema = z5.object({
2561
2616
  // Scope to a sub-project board when provided. Unlike the board layer's `?? null`
2562
2617
  // semantics, agents default to seeing the whole project when omitted.
2563
2618
  subProjectId: z5.string().nullable().optional(),
2619
+ // Plain equality on the on-hold flag: true = only parked cards, false =
2620
+ // exclude them, omitted = both. Deliberately NOT the board's
2621
+ // includeOnHold/surfaceActiveWork bucketing — an agent sweeping a backlog
2622
+ // needs the raw column, not a column projection.
2623
+ onHold: z5.boolean().optional(),
2564
2624
  limit: z5.number().int().positive().optional().default(50)
2565
2625
  }).refine((p) => !(p.unassigned && p.assigneeId), {
2566
2626
  message: "Pass either assigneeId or unassigned, not both"
@@ -2595,7 +2655,9 @@ var SearchProjectTasksRequestSchema = z5.object({
2595
2655
  message: "Pass either assigneeId or unassigned, not both"
2596
2656
  });
2597
2657
  var ListProjectTagsRequestSchema = z5.object({
2598
- projectId: z5.string()
2658
+ projectId: z5.string(),
2659
+ /** "summary" (default) omits inline context links; "full" includes them. */
2660
+ detail: z5.enum(["summary", "full"]).optional()
2599
2661
  });
2600
2662
  var GetProjectTagRequestSchema = z5.object({
2601
2663
  projectId: z5.string(),
@@ -2698,11 +2760,15 @@ var UpdateProjectTaskRequestSchema = z5.object({
2698
2760
  // handler: the ref must exist on origin and no live workspace may be bound
2699
2761
  // to a different branch.
2700
2762
  githubBranch: z5.string().min(1).max(GIT_BRANCH_NAME_MAX).refine(isValidGitBranchName, { message: GIT_BRANCH_NAME_MESSAGE }).nullable().optional(),
2763
+ // Park the card on hold (true) or return it to the active board (false).
2764
+ // The handler mirrors the web path's two side effects: a board re-bucket
2765
+ // event, and demotion to Open when an active-work card is parked.
2766
+ onHold: z5.boolean().optional(),
2701
2767
  requestingUserId: z5.string().optional()
2702
2768
  }).strict().refine(
2703
- (v) => v.title !== void 0 || v.description !== void 0 || v.plan !== void 0 || v.status !== void 0 || v.risk !== void 0 || v.storyPointValue !== void 0 || v.assignedUserId !== void 0 || v.subProjectId !== void 0 || v.githubBranch !== void 0,
2769
+ (v) => v.title !== void 0 || v.description !== void 0 || v.plan !== void 0 || v.status !== void 0 || v.risk !== void 0 || v.storyPointValue !== void 0 || v.assignedUserId !== void 0 || v.subProjectId !== void 0 || v.githubBranch !== void 0 || v.onHold !== void 0,
2704
2770
  {
2705
- message: "update_task requires at least one field to change (title, description, plan, status, risk, storyPointValue, assignedUserId, subProjectId, or githubBranch)"
2771
+ message: "update_task requires at least one field to change (title, description, plan, status, risk, storyPointValue, assignedUserId, subProjectId, githubBranch, or onHold)"
2706
2772
  }
2707
2773
  );
2708
2774
  var TransitionProjectTaskStatusRequestSchema = z5.object({
@@ -3023,7 +3089,7 @@ var QueryProjectManualTestsRequestSchema = z5.object({
3023
3089
  var SetProjectManualTestsRequestSchema = z5.object({
3024
3090
  projectId: z5.string(),
3025
3091
  taskId: z5.string(),
3026
- items: z5.array(z5.object({ title: z5.string().min(1) })).min(1),
3092
+ items: ManualTestItemsSchema,
3027
3093
  requestingUserId: z5.string().optional()
3028
3094
  });
3029
3095
  var EditProjectManualTestRequestSchema = z5.object({
@@ -3102,42 +3168,6 @@ var ReportApiOutageRequestSchema = z7.object({
3102
3168
  detail: z7.string().max(2e3),
3103
3169
  attempts: z7.number().int().min(0).max(100)
3104
3170
  });
3105
- var SHA_PATTERN = /^[0-9a-f]{40}$/i;
3106
- var ReviewGuideFileReferenceSchema = z8.object({
3107
- path: z8.string().min(1).max(500),
3108
- startLine: z8.number().int().positive().max(1e6).optional(),
3109
- endLine: z8.number().int().positive().max(1e6).optional(),
3110
- hunkHeader: z8.string().min(1).max(300).optional()
3111
- }).strict().superRefine((value, ctx) => {
3112
- if (value.endLine !== void 0 && value.startLine === void 0) {
3113
- ctx.addIssue({
3114
- code: "custom",
3115
- path: ["startLine"],
3116
- message: "startLine is required when endLine is set"
3117
- });
3118
- }
3119
- if (value.startLine !== void 0 && value.endLine !== void 0 && value.endLine < value.startLine) {
3120
- ctx.addIssue({
3121
- code: "custom",
3122
- path: ["endLine"],
3123
- message: "endLine must be greater than or equal to startLine"
3124
- });
3125
- }
3126
- });
3127
- var ReviewGuideSectionSchema = z8.object({
3128
- title: z8.string().min(1).max(160),
3129
- explanation: z8.string().min(1).max(2e3),
3130
- classification: z8.enum(["core", "supporting"]).optional(),
3131
- files: z8.array(ReviewGuideFileReferenceSchema).min(1).max(20)
3132
- }).strict();
3133
- var ReviewGuideContentSchema = z8.object({
3134
- overview: z8.string().min(1).max(3e3),
3135
- sections: z8.array(ReviewGuideSectionSchema).min(1).max(12)
3136
- }).strict();
3137
- var PublishReviewGuideRequestSchema = ReviewGuideContentSchema.extend({
3138
- sessionId: z8.string().min(1),
3139
- reviewedSha: z8.string().regex(SHA_PATTERN, "reviewedSha must be a 40-character commit SHA")
3140
- }).strict();
3141
3171
  var CONTEXT_LINK_LOCATOR_MAX = 300;
3142
3172
  var TEST_TITLE = /\b(?:it|test|describe)(?:\.\w+)?\s*\(\s*(['"`])((?:(?!\1)[\s\S])*)\1/g;
3143
3173
  function extractTestTitles(content) {
@@ -3153,130 +3183,130 @@ function locatorMatchesContent(content, locatorType, locator) {
3153
3183
  var TAG_DESCRIPTION_MAX = CARD_DESCRIPTION_MAX;
3154
3184
  var TAG_OVERVIEW_MAX = 32e3;
3155
3185
  var TAG_REASON_MAX = 500;
3156
- var ProjectTagContextPathSchema = z9.object({
3157
- type: z9.enum(["rule", "doc", "file", "folder"]),
3158
- path: z9.string().min(1).max(500),
3159
- label: z9.string().max(100).optional(),
3186
+ var ProjectTagContextPathSchema = z8.object({
3187
+ type: z8.enum(["rule", "doc", "file", "folder"]),
3188
+ path: z8.string().min(1).max(500),
3189
+ label: z8.string().max(100).optional(),
3160
3190
  /** Verified-link tether — text that must keep existing in the file. */
3161
- locator: z9.string().min(1).max(CONTEXT_LINK_LOCATOR_MAX).regex(/^[^\r\n]*$/, "Locator cannot contain line breaks").optional(),
3191
+ locator: z8.string().min(1).max(CONTEXT_LINK_LOCATOR_MAX).regex(/^[^\r\n]*$/, "Locator cannot contain line breaks").optional(),
3162
3192
  /** test = must appear in a real test/describe title; code = any substring. */
3163
- locatorType: z9.enum(["test", "code"]).optional()
3193
+ locatorType: z8.enum(["test", "code"]).optional()
3164
3194
  }).refine((link) => link.locator === void 0 === (link.locatorType === void 0), {
3165
3195
  message: "locator and locatorType must be provided together"
3166
3196
  }).refine((link) => link.locator === void 0 || link.type !== "folder", {
3167
3197
  message: "folder links cannot carry a locator"
3168
3198
  });
3169
- var hexColor = z9.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected #RRGGBB hex color");
3170
- var overviewPathSchema = z9.string().min(1).max(500).regex(/^[^\r\n]*$/, "Overview path cannot contain line breaks");
3171
- var CreateProjectTagRequestSchema = z9.object({
3172
- projectId: z9.string(),
3173
- name: z9.string().min(1).max(50),
3199
+ var hexColor = z8.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected #RRGGBB hex color");
3200
+ var overviewPathSchema = z8.string().min(1).max(500).regex(/^[^\r\n]*$/, "Overview path cannot contain line breaks");
3201
+ var CreateProjectTagRequestSchema = z8.object({
3202
+ projectId: z8.string(),
3203
+ name: z8.string().min(1).max(50),
3174
3204
  color: hexColor.optional(),
3175
- description: z9.string().max(TAG_DESCRIPTION_MAX).optional(),
3176
- overview: z9.string().max(TAG_OVERVIEW_MAX).optional(),
3205
+ description: z8.string().max(TAG_DESCRIPTION_MAX).optional(),
3206
+ overview: z8.string().max(TAG_OVERVIEW_MAX).optional(),
3177
3207
  /** Source the overview from this repo file (stored overview stays as the pending fallback). */
3178
3208
  overviewPath: overviewPathSchema.optional(),
3179
- contextPaths: z9.array(ProjectTagContextPathSchema).max(20).optional(),
3209
+ contextPaths: z8.array(ProjectTagContextPathSchema).max(20).optional(),
3180
3210
  /** Parents to link at create time (multi-parent DAG). */
3181
- parentTagIds: z9.array(z9.string()).max(25).optional(),
3182
- requestingUserId: z9.string().optional()
3211
+ parentTagIds: z8.array(z8.string()).max(25).optional(),
3212
+ requestingUserId: z8.string().optional()
3183
3213
  });
3184
- var UpdateProjectTagRequestSchema = z9.object({
3185
- projectId: z9.string(),
3186
- tagId: z9.string(),
3187
- name: z9.string().min(1).max(50).optional(),
3214
+ var UpdateProjectTagRequestSchema = z8.object({
3215
+ projectId: z8.string(),
3216
+ tagId: z8.string(),
3217
+ name: z8.string().min(1).max(50).optional(),
3188
3218
  color: hexColor.optional(),
3189
- description: z9.string().max(TAG_DESCRIPTION_MAX).optional(),
3219
+ description: z8.string().max(TAG_DESCRIPTION_MAX).optional(),
3190
3220
  /** Full markdown glossary body; null clears it. Rejected while overviewPath is set. */
3191
- overview: z9.string().max(TAG_OVERVIEW_MAX).nullable().optional(),
3221
+ overview: z8.string().max(TAG_OVERVIEW_MAX).nullable().optional(),
3192
3222
  /** Repo file to source the overview from; null clears back to the stored overview. */
3193
3223
  overviewPath: overviewPathSchema.nullable().optional(),
3194
3224
  /** Full replacement of the tag's context links when provided. */
3195
- contextPaths: z9.array(ProjectTagContextPathSchema).max(20).optional(),
3225
+ contextPaths: z8.array(ProjectTagContextPathSchema).max(20).optional(),
3196
3226
  /** Full-set replacement of the tag's parent tags (multi-parent DAG). */
3197
- parentTagIds: z9.array(z9.string()).max(25).optional(),
3227
+ parentTagIds: z8.array(z8.string()).max(25).optional(),
3198
3228
  /** One-line revision provenance, recorded in the tag's history. */
3199
- reason: z9.string().max(TAG_REASON_MAX).optional(),
3229
+ reason: z8.string().max(TAG_REASON_MAX).optional(),
3200
3230
  /** Card the caller was working in — stamped into the revision history. */
3201
- taskId: z9.string().optional(),
3202
- requestingUserId: z9.string().optional()
3231
+ taskId: z8.string().optional(),
3232
+ requestingUserId: z8.string().optional()
3203
3233
  });
3204
- var PostToProjectChatRequestSchema = z9.object({
3205
- projectId: z9.string(),
3206
- content: z9.string().min(1).max(2e4),
3207
- requestingUserId: z9.string().optional(),
3234
+ var PostToProjectChatRequestSchema = z8.object({
3235
+ projectId: z8.string(),
3236
+ content: z8.string().min(1).max(2e4),
3237
+ requestingUserId: z8.string().optional(),
3208
3238
  /** Marks the post so the server can persist it beyond chat (tag-audit summaries land in tag history). */
3209
- kind: z9.enum(["tag_audit_summary"]).optional()
3210
- });
3211
- var StartTagAuditRequestSchema = z9.object({
3212
- projectId: z9.string(),
3213
- requestingUserId: z9.string().optional()
3214
- });
3215
- var StartTaskAuditRequestSchema = z9.object({
3216
- projectId: z9.string(),
3217
- taskIds: z9.array(z9.string()).min(1).max(20),
3218
- requestingUserId: z9.string().optional()
3219
- });
3220
- var GetActiveAuditSessionsRequestSchema = z9.object({
3221
- projectId: z9.string()
3222
- });
3223
- var ReportTaskAuditResultRequestSchema = z9.object({
3224
- projectId: z9.string(),
3225
- taskId: z9.string(),
3226
- summary: z9.string(),
3227
- turnGrades: z9.array(
3228
- z9.object({
3229
- turnIndex: z9.number(),
3230
- phase: z9.enum(["planning", "building", "human"]),
3231
- grade: z9.enum(["correct", "neutral", "blunder"]),
3232
- reasoning: z9.string(),
3233
- eventType: z9.string(),
3234
- eventSummary: z9.string()
3239
+ kind: z8.enum(["tag_audit_summary"]).optional()
3240
+ });
3241
+ var StartTagAuditRequestSchema = z8.object({
3242
+ projectId: z8.string(),
3243
+ requestingUserId: z8.string().optional()
3244
+ });
3245
+ var StartTaskAuditRequestSchema = z8.object({
3246
+ projectId: z8.string(),
3247
+ taskIds: z8.array(z8.string()).min(1).max(20),
3248
+ requestingUserId: z8.string().optional()
3249
+ });
3250
+ var GetActiveAuditSessionsRequestSchema = z8.object({
3251
+ projectId: z8.string()
3252
+ });
3253
+ var ReportTaskAuditResultRequestSchema = z8.object({
3254
+ projectId: z8.string(),
3255
+ taskId: z8.string(),
3256
+ summary: z8.string(),
3257
+ turnGrades: z8.array(
3258
+ z8.object({
3259
+ turnIndex: z8.number(),
3260
+ phase: z8.enum(["planning", "building", "human"]),
3261
+ grade: z8.enum(["correct", "neutral", "blunder"]),
3262
+ reasoning: z8.string(),
3263
+ eventType: z8.string(),
3264
+ eventSummary: z8.string()
3235
3265
  })
3236
3266
  ),
3237
- planningAccuracy: z9.number().nullable(),
3238
- buildingAccuracy: z9.number().nullable(),
3239
- humanAccuracy: z9.number().nullable(),
3240
- planningCorrect: z9.number(),
3241
- planningNeutral: z9.number(),
3242
- planningBlunder: z9.number(),
3243
- buildingCorrect: z9.number(),
3244
- buildingNeutral: z9.number(),
3245
- buildingBlunder: z9.number(),
3246
- humanCorrect: z9.number(),
3247
- humanNeutral: z9.number(),
3248
- humanBlunder: z9.number(),
3249
- humanEvaluations: z9.array(
3250
- z9.object({
3251
- messageIndex: z9.number(),
3252
- rating: z9.union([z9.literal(-1), z9.literal(0), z9.literal(1)]),
3253
- reasoning: z9.string()
3267
+ planningAccuracy: z8.number().nullable(),
3268
+ buildingAccuracy: z8.number().nullable(),
3269
+ humanAccuracy: z8.number().nullable(),
3270
+ planningCorrect: z8.number(),
3271
+ planningNeutral: z8.number(),
3272
+ planningBlunder: z8.number(),
3273
+ buildingCorrect: z8.number(),
3274
+ buildingNeutral: z8.number(),
3275
+ buildingBlunder: z8.number(),
3276
+ humanCorrect: z8.number(),
3277
+ humanNeutral: z8.number(),
3278
+ humanBlunder: z8.number(),
3279
+ humanEvaluations: z8.array(
3280
+ z8.object({
3281
+ messageIndex: z8.number(),
3282
+ rating: z8.union([z8.literal(-1), z8.literal(0), z8.literal(1)]),
3283
+ reasoning: z8.string()
3254
3284
  })
3255
3285
  ).optional(),
3256
- suggestionIds: z9.array(z9.string()),
3257
- auditCostUsd: z9.number().nullable(),
3258
- model: z9.string().nullable(),
3286
+ suggestionIds: z8.array(z8.string()),
3287
+ auditCostUsd: z8.number().nullable(),
3288
+ model: z8.string().nullable(),
3259
3289
  /** When set, the audit is marked failed with this message instead. */
3260
- error: z9.string().optional()
3290
+ error: z8.string().optional()
3261
3291
  });
3262
- var GetTaskAuditsRequestSchema = z9.object({
3263
- projectId: z9.string(),
3264
- limit: z9.number().int().positive().max(200).optional().default(50)
3292
+ var GetTaskAuditsRequestSchema = z8.object({
3293
+ projectId: z8.string(),
3294
+ limit: z8.number().int().positive().max(200).optional().default(50)
3265
3295
  });
3266
- var GetTaskAuditRequestSchema = z9.object({
3267
- projectId: z9.string(),
3268
- auditId: z9.string()
3296
+ var GetTaskAuditRequestSchema = z8.object({
3297
+ projectId: z8.string(),
3298
+ auditId: z8.string()
3269
3299
  });
3270
- var GetTaskAuditAggregatesRequestSchema = z9.object({
3271
- projectId: z9.string()
3300
+ var GetTaskAuditAggregatesRequestSchema = z8.object({
3301
+ projectId: z8.string()
3272
3302
  });
3273
- var DeleteTaskAuditRequestSchema = z9.object({
3274
- projectId: z9.string(),
3275
- auditId: z9.string(),
3276
- requestingUserId: z9.string().optional()
3303
+ var DeleteTaskAuditRequestSchema = z8.object({
3304
+ projectId: z8.string(),
3305
+ auditId: z8.string(),
3306
+ requestingUserId: z8.string().optional()
3277
3307
  });
3278
- var MarkInitialPromptSubmittedRequestSchema = z9.object({
3279
- sessionId: z9.string()
3308
+ var MarkInitialPromptSubmittedRequestSchema = z8.object({
3309
+ sessionId: z8.string()
3280
3310
  });
3281
3311
  var CRITICAL_AUTOMATED_SOURCES = /* @__PURE__ */ new Set([
3282
3312
  "ci_failure",
@@ -3293,6 +3323,30 @@ var CRITICAL_AUTOMATED_SOURCES = /* @__PURE__ */ new Set([
3293
3323
  // clear the completion guard.
3294
3324
  "ci_result"
3295
3325
  ]);
3326
+ var MAX_PREVIEW_LINKS = 8;
3327
+ var MAX_PREVIEW_LINK_LABEL = 64;
3328
+ var MAX_PREVIEW_LINK_PATH = 512;
3329
+ function isSafePreviewPath(path) {
3330
+ if (!path.startsWith("/") || path.startsWith("//")) return false;
3331
+ if (path.length > MAX_PREVIEW_LINK_PATH) return false;
3332
+ return !/[\s\\\u0000-\u001f\u007f]/.test(path);
3333
+ }
3334
+ function sanitizeSessionPreviewLinks(raw) {
3335
+ if (!Array.isArray(raw)) return [];
3336
+ const out = [];
3337
+ for (const entry of raw) {
3338
+ if (out.length >= MAX_PREVIEW_LINKS) break;
3339
+ if (!entry || typeof entry !== "object") continue;
3340
+ const { label, port, path } = entry;
3341
+ if (typeof label !== "string") continue;
3342
+ const trimmed = label.trim().slice(0, MAX_PREVIEW_LINK_LABEL);
3343
+ if (trimmed.length === 0 || !isAllowablePreviewPort(port)) continue;
3344
+ const resolvedPath = path === void 0 ? "/" : path;
3345
+ if (typeof resolvedPath !== "string" || !isSafePreviewPath(resolvedPath)) continue;
3346
+ out.push({ label: trimmed, port, path: resolvedPath });
3347
+ }
3348
+ return out;
3349
+ }
3296
3350
  var DECISION_STATUS_LABELS = ["Open", "Decided", "Cancelled"];
3297
3351
  var DECISION_OPTION_KINDS = ["current", "planned", "proposed"];
3298
3352
  var DECISION_VOTE_SOURCES = ["web", "slack", "discord", "agent"];
@@ -3306,166 +3360,265 @@ var DECISION_DEADLINE_MIN_HOURS = 1;
3306
3360
  var DECISION_DEADLINE_MAX_DAYS = 30;
3307
3361
  var DECISION_DEADLINE_MAX_HOURS = DECISION_DEADLINE_MAX_DAYS * 24;
3308
3362
  var DECISION_LIST_MAX_LIMIT = 200;
3309
- var decisionIdSchema = z10.string().cuid("Invalid decision ID");
3310
- var optionInputSchema = z10.object({
3311
- label: z10.string().min(1, "Option label is required").max(DECISION_OPTION_LABEL_MAX),
3312
- description: z10.string().min(1, "Describe the option as GIVEN / WHEN / THEN"),
3313
- kind: z10.enum(DECISION_OPTION_KINDS).optional()
3363
+ var decisionIdSchema = z9.string().cuid("Invalid decision ID");
3364
+ var optionInputSchema = z9.object({
3365
+ label: z9.string().min(1, "Option label is required").max(DECISION_OPTION_LABEL_MAX),
3366
+ description: z9.string().min(1, "Describe the option as GIVEN / WHEN / THEN"),
3367
+ kind: z9.enum(DECISION_OPTION_KINDS).optional()
3314
3368
  });
3315
- var optionsArraySchema = z10.array(optionInputSchema).min(DECISION_OPTIONS_MIN, `A decision needs at least ${DECISION_OPTIONS_MIN} options`).max(
3369
+ var optionsArraySchema = z9.array(optionInputSchema).min(DECISION_OPTIONS_MIN, `A decision needs at least ${DECISION_OPTIONS_MIN} options`).max(
3316
3370
  DECISION_OPTIONS_MAX,
3317
3371
  `A decision takes at most ${DECISION_OPTIONS_MAX} options \u2014 more than that means the question is not framed yet`
3318
3372
  );
3319
- var CreateDecisionRequestSchema = z10.object({
3320
- projectId: z10.string().cuid("Invalid project ID"),
3373
+ var CreateDecisionRequestSchema = z9.object({
3374
+ projectId: z9.string().cuid("Invalid project ID"),
3321
3375
  /** The question, as one plain sentence. */
3322
- title: z10.string().min(1, "A decision needs a question").max(DECISION_QUESTION_MAX),
3323
- description: z10.string().max(CARD_DESCRIPTION_MAX).optional(),
3324
- context: z10.string().min(1, "Context is required \u2014 say why this is being asked now"),
3376
+ title: z9.string().min(1, "A decision needs a question").max(DECISION_QUESTION_MAX),
3377
+ description: z9.string().max(CARD_DESCRIPTION_MAX).optional(),
3378
+ context: z9.string().min(1, "Context is required \u2014 say why this is being asked now"),
3325
3379
  options: optionsArraySchema,
3326
3380
  /** 1-based position of the option that wins on silence. */
3327
- defaultOptionOrdinal: z10.number().int().min(1).max(DECISION_OPTIONS_MAX),
3328
- deadlineHours: z10.number().min(DECISION_DEADLINE_MIN_HOURS).max(DECISION_DEADLINE_MAX_HOURS).optional(),
3381
+ defaultOptionOrdinal: z9.number().int().min(1).max(DECISION_OPTIONS_MAX),
3382
+ deadlineHours: z9.number().min(DECISION_DEADLINE_MIN_HOURS).max(DECISION_DEADLINE_MAX_HOURS).optional(),
3329
3383
  /** Cards this decision blocks, by cuid or slug. */
3330
- impactedCardRefs: z10.array(z10.string().min(1)).max(50).optional(),
3331
- tagNames: z10.array(z10.string().min(1)).max(10).optional(),
3332
- raisedByTaskId: z10.string().min(1).optional(),
3333
- raisedByPrNumber: z10.number().int().positive().optional()
3384
+ impactedCardRefs: z9.array(z9.string().min(1)).max(50).optional(),
3385
+ tagNames: z9.array(z9.string().min(1)).max(10).optional(),
3386
+ raisedByTaskId: z9.string().min(1).optional(),
3387
+ raisedByPrNumber: z9.number().int().positive().optional()
3334
3388
  });
3335
- var VoteDecisionRequestSchema = z10.object({
3389
+ var VoteDecisionRequestSchema = z9.object({
3336
3390
  decisionId: decisionIdSchema,
3337
- optionId: z10.string().cuid("Invalid option ID"),
3338
- reason: z10.string().max(DECISION_VOTE_REASON_MAX).optional(),
3339
- source: z10.enum(DECISION_VOTE_SOURCES).optional()
3391
+ optionId: z9.string().cuid("Invalid option ID"),
3392
+ reason: z9.string().max(DECISION_VOTE_REASON_MAX).optional(),
3393
+ source: z9.enum(DECISION_VOTE_SOURCES).optional()
3340
3394
  });
3341
- var RemoveDecisionVoteRequestSchema = z10.object({
3395
+ var RemoveDecisionVoteRequestSchema = z9.object({
3342
3396
  decisionId: decisionIdSchema
3343
3397
  });
3344
- var ResolveDecisionRequestSchema = z10.object({
3398
+ var ResolveDecisionRequestSchema = z9.object({
3345
3399
  decisionId: decisionIdSchema,
3346
- chosenOptionId: z10.string().cuid("Invalid option ID"),
3347
- resolution: z10.string().min(1, "A resolution is required \u2014 say what was decided").max(DECISION_RESOLUTION_MAX),
3348
- resolutionNotes: z10.string().optional()
3400
+ chosenOptionId: z9.string().cuid("Invalid option ID"),
3401
+ resolution: z9.string().min(1, "A resolution is required \u2014 say what was decided").max(DECISION_RESOLUTION_MAX),
3402
+ resolutionNotes: z9.string().optional()
3349
3403
  });
3350
- var CancelDecisionRequestSchema = z10.object({
3404
+ var CancelDecisionRequestSchema = z9.object({
3351
3405
  decisionId: decisionIdSchema,
3352
3406
  /** Why it is being dropped. Posted to the decision thread. */
3353
- reason: z10.string().max(DECISION_RESOLUTION_MAX).optional()
3407
+ reason: z9.string().max(DECISION_RESOLUTION_MAX).optional()
3354
3408
  });
3355
- var BulkDecisionIdsRequestSchema = z10.object({
3356
- projectId: z10.string().cuid("Invalid project ID"),
3357
- decisionIds: z10.array(z10.string().cuid()).min(1).max(200)
3409
+ var BulkDecisionIdsRequestSchema = z9.object({
3410
+ projectId: z9.string().cuid("Invalid project ID"),
3411
+ decisionIds: z9.array(z9.string().cuid()).min(1).max(200)
3358
3412
  });
3359
- var ReopenDecisionRequestSchema = z10.object({
3413
+ var ReopenDecisionRequestSchema = z9.object({
3360
3414
  decisionId: decisionIdSchema,
3361
- deadlineHours: z10.number().min(DECISION_DEADLINE_MIN_HOURS).max(DECISION_DEADLINE_MAX_HOURS).optional()
3415
+ deadlineHours: z9.number().min(DECISION_DEADLINE_MIN_HOURS).max(DECISION_DEADLINE_MAX_HOURS).optional()
3362
3416
  });
3363
- var UpdateDecisionRequestSchema = z10.object({
3417
+ var UpdateDecisionRequestSchema = z9.object({
3364
3418
  decisionId: decisionIdSchema,
3365
- title: z10.string().min(1).max(200).optional(),
3366
- description: z10.string().max(CARD_DESCRIPTION_MAX).optional(),
3367
- context: z10.string().min(1).optional(),
3368
- deadlineAt: z10.string().datetime().optional(),
3419
+ title: z9.string().min(1).max(200).optional(),
3420
+ description: z9.string().max(CARD_DESCRIPTION_MAX).optional(),
3421
+ context: z9.string().min(1).optional(),
3422
+ deadlineAt: z9.string().datetime().optional(),
3369
3423
  /** Only accepted while the decision has zero votes. */
3370
3424
  options: optionsArraySchema.optional(),
3371
- defaultOptionOrdinal: z10.number().int().min(1).max(DECISION_OPTIONS_MAX).optional(),
3372
- addImpactedCardRefs: z10.array(z10.string().min(1)).max(50).optional(),
3373
- removeImpactedCardIds: z10.array(z10.string().min(1)).max(50).optional()
3425
+ defaultOptionOrdinal: z9.number().int().min(1).max(DECISION_OPTIONS_MAX).optional(),
3426
+ addImpactedCardRefs: z9.array(z9.string().min(1)).max(50).optional(),
3427
+ removeImpactedCardIds: z9.array(z9.string().min(1)).max(50).optional()
3374
3428
  });
3375
- var GetDecisionRequestSchema = z10.object({
3429
+ var GetDecisionRequestSchema = z9.object({
3376
3430
  /** cuid or slug. A slug needs `projectId` to resolve unambiguously. */
3377
- decisionId: z10.string().min(1),
3378
- projectId: z10.string().cuid().optional()
3431
+ decisionId: z9.string().min(1),
3432
+ projectId: z9.string().cuid().optional()
3379
3433
  });
3380
- var ListDecisionsRequestSchema = z10.object({
3381
- projectId: z10.string().cuid("Invalid project ID"),
3382
- status: z10.enum(DECISION_STATUS_LABELS).optional(),
3434
+ var ListDecisionsRequestSchema = z9.object({
3435
+ projectId: z9.string().cuid("Invalid project ID"),
3436
+ status: z9.enum(DECISION_STATUS_LABELS).optional(),
3383
3437
  /** Tag name, not id — an agent knows the tag it is working under. */
3384
- tag: z10.string().min(1).optional(),
3438
+ tag: z9.string().min(1).optional(),
3385
3439
  /** Decisions that this card is blocked by (cuid or slug). */
3386
- cardId: z10.string().min(1).optional(),
3387
- query: z10.string().min(1).optional(),
3388
- limit: z10.number().int().min(1).max(DECISION_LIST_MAX_LIMIT).optional()
3440
+ cardId: z9.string().min(1).optional(),
3441
+ query: z9.string().min(1).optional(),
3442
+ limit: z9.number().int().min(1).max(DECISION_LIST_MAX_LIMIT).optional()
3389
3443
  });
3390
- var optionInput = z11.object({
3391
- label: z11.string().min(1).max(DECISION_OPTION_LABEL_MAX),
3392
- description: z11.string().min(1),
3393
- kind: z11.enum(DECISION_OPTION_KINDS).optional()
3444
+ var optionInput = z10.object({
3445
+ label: z10.string().min(1).max(DECISION_OPTION_LABEL_MAX),
3446
+ description: z10.string().min(1),
3447
+ kind: z10.enum(DECISION_OPTION_KINDS).optional()
3394
3448
  });
3395
- var optionsInput = z11.array(optionInput).min(DECISION_OPTIONS_MIN).max(DECISION_OPTIONS_MAX);
3396
- var deadlineHours = z11.number().min(DECISION_DEADLINE_MIN_HOURS).max(DECISION_DEADLINE_MAX_HOURS).optional();
3397
- var CreateProjectDecisionRequestSchema = z11.object({
3398
- projectId: z11.string(),
3399
- question: z11.string().min(1).max(200),
3400
- summary: z11.string().max(CARD_DESCRIPTION_MAX).optional(),
3401
- context: z11.string().min(1),
3449
+ var optionsInput = z10.array(optionInput).min(DECISION_OPTIONS_MIN).max(DECISION_OPTIONS_MAX);
3450
+ var deadlineHours = z10.number().min(DECISION_DEADLINE_MIN_HOURS).max(DECISION_DEADLINE_MAX_HOURS).optional();
3451
+ var CreateProjectDecisionRequestSchema = z10.object({
3452
+ projectId: z10.string(),
3453
+ question: z10.string().min(1).max(200),
3454
+ summary: z10.string().max(CARD_DESCRIPTION_MAX).optional(),
3455
+ context: z10.string().min(1),
3402
3456
  options: optionsInput,
3403
- defaultOption: z11.number().int().min(1).max(DECISION_OPTIONS_MAX),
3457
+ defaultOption: z10.number().int().min(1).max(DECISION_OPTIONS_MAX),
3404
3458
  deadlineHours,
3405
- impactedCards: z11.array(z11.string().min(1)).max(50).optional(),
3459
+ impactedCards: z10.array(z10.string().min(1)).max(50).optional(),
3406
3460
  /**
3407
3461
  * Pod surface only: also block the card this session is working on. The
3408
3462
  * session's task id is resolved SERVER-side from `sessionId` — a
3409
3463
  * client-supplied card id would let a pod block any card in the project.
3410
3464
  */
3411
- includeCurrentCard: z11.boolean().optional(),
3412
- sessionId: z11.string().optional(),
3413
- tagNames: z11.array(z11.string().min(1)).max(10).optional(),
3414
- raisedByPr: z11.number().int().positive().optional(),
3465
+ includeCurrentCard: z10.boolean().optional(),
3466
+ sessionId: z10.string().optional(),
3467
+ tagNames: z10.array(z10.string().min(1)).max(10).optional(),
3468
+ raisedByPr: z10.number().int().positive().optional(),
3415
3469
  /** Slug or id of the card that raised the question. A link back, not a block. */
3416
- raisedByCard: z11.string().min(1).optional(),
3470
+ raisedByCard: z10.string().min(1).optional(),
3417
3471
  /** Absolute deadline (ISO 8601). Wins over `deadlineHours` when both are sent. */
3418
- deadlineAt: z11.string().datetime({ offset: true }).optional(),
3419
- requestingUserId: z11.string().optional()
3420
- });
3421
- var ListProjectDecisionsRequestSchema = z11.object({
3422
- projectId: z11.string(),
3423
- status: z11.enum(DECISION_STATUS_LABELS).optional(),
3424
- tag: z11.string().min(1).optional(),
3425
- card: z11.string().min(1).optional(),
3426
- query: z11.string().min(1).optional(),
3427
- limit: z11.number().int().min(1).max(DECISION_LIST_MAX_LIMIT).optional(),
3428
- requestingUserId: z11.string().optional()
3429
- });
3430
- var GetProjectDecisionRequestSchema = z11.object({
3431
- projectId: z11.string(),
3432
- decision: z11.string().min(1),
3433
- requestingUserId: z11.string().optional()
3472
+ deadlineAt: z10.string().datetime({ offset: true }).optional(),
3473
+ requestingUserId: z10.string().optional()
3434
3474
  });
3435
- var VoteProjectDecisionRequestSchema = z11.object({
3436
- projectId: z11.string(),
3437
- decision: z11.string().min(1),
3438
- /** An option id, or its 1-based position. */
3439
- option: z11.string().min(1),
3440
- reason: z11.string().max(CARD_DESCRIPTION_MAX).optional(),
3441
- requestingUserId: z11.string().optional()
3475
+ var ListProjectDecisionsRequestSchema = z10.object({
3476
+ projectId: z10.string(),
3477
+ status: z10.enum(DECISION_STATUS_LABELS).optional(),
3478
+ tag: z10.string().min(1).optional(),
3479
+ card: z10.string().min(1).optional(),
3480
+ query: z10.string().min(1).optional(),
3481
+ limit: z10.number().int().min(1).max(DECISION_LIST_MAX_LIMIT).optional(),
3482
+ requestingUserId: z10.string().optional()
3442
3483
  });
3443
- var ResolveProjectDecisionRequestSchema = z11.object({
3444
- projectId: z11.string(),
3445
- decision: z11.string().min(1),
3446
- option: z11.string().min(1),
3447
- resolution: z11.string().min(1).max(DECISION_RESOLUTION_MAX),
3448
- notes: z11.string().optional(),
3449
- requestingUserId: z11.string().optional()
3484
+ var GetProjectDecisionRequestSchema = z10.object({
3485
+ projectId: z10.string(),
3486
+ decision: z10.string().min(1),
3487
+ requestingUserId: z10.string().optional()
3450
3488
  });
3451
- var UpdateProjectDecisionRequestSchema = z11.object({
3452
- projectId: z11.string(),
3453
- decision: z11.string().min(1),
3454
- question: z11.string().min(1).max(200).optional(),
3455
- summary: z11.string().max(CARD_DESCRIPTION_MAX).optional(),
3456
- context: z11.string().min(1).optional(),
3489
+ var VoteProjectDecisionRequestSchema = z10.object({
3490
+ projectId: z10.string(),
3491
+ decision: z10.string().min(1),
3492
+ /** An option id, or its 1-based position. */
3493
+ option: z10.string().min(1),
3494
+ reason: z10.string().max(CARD_DESCRIPTION_MAX).optional(),
3495
+ requestingUserId: z10.string().optional()
3496
+ });
3497
+ var ResolveProjectDecisionRequestSchema = z10.object({
3498
+ projectId: z10.string(),
3499
+ decision: z10.string().min(1),
3500
+ option: z10.string().min(1),
3501
+ resolution: z10.string().min(1).max(DECISION_RESOLUTION_MAX),
3502
+ notes: z10.string().optional(),
3503
+ requestingUserId: z10.string().optional()
3504
+ });
3505
+ var UpdateProjectDecisionRequestSchema = z10.object({
3506
+ projectId: z10.string(),
3507
+ decision: z10.string().min(1),
3508
+ question: z10.string().min(1).max(200).optional(),
3509
+ summary: z10.string().max(CARD_DESCRIPTION_MAX).optional(),
3510
+ context: z10.string().min(1).optional(),
3457
3511
  /** Accepted only while nobody has voted. */
3458
3512
  options: optionsInput.optional(),
3459
- defaultOption: z11.number().int().min(1).max(DECISION_OPTIONS_MAX).optional(),
3460
- tagNames: z11.array(z11.string().min(1)).max(10).optional(),
3513
+ defaultOption: z10.number().int().min(1).max(DECISION_OPTIONS_MAX).optional(),
3514
+ tagNames: z10.array(z10.string().min(1)).max(10).optional(),
3461
3515
  deadlineHours,
3462
3516
  /** Absolute deadline (ISO 8601). Wins over `deadlineHours` when both are sent. */
3463
- deadlineAt: z11.string().datetime({ offset: true }).optional(),
3464
- addImpactedCards: z11.array(z11.string().min(1)).max(50).optional(),
3465
- removeImpactedCards: z11.array(z11.string().min(1)).max(50).optional(),
3466
- status: z11.enum(["Cancelled", "Open"]).optional(),
3467
- requestingUserId: z11.string().optional()
3517
+ deadlineAt: z10.string().datetime({ offset: true }).optional(),
3518
+ addImpactedCards: z10.array(z10.string().min(1)).max(50).optional(),
3519
+ removeImpactedCards: z10.array(z10.string().min(1)).max(50).optional(),
3520
+ status: z10.enum(["Cancelled", "Open"]).optional(),
3521
+ requestingUserId: z10.string().optional()
3522
+ });
3523
+ var EVALUATE_MAX_QUESTIONS = 32;
3524
+ var EVALUATE_MAX_ITEMS = 100;
3525
+ var EVALUATE_ITEM_MAX_CHARS = 8e3;
3526
+ var EVALUATE_REQUEST_MAX_CHARS = 4e5;
3527
+ var TEXT_MAX = 1e3;
3528
+ var QUESTION_KEY = /^[A-Za-z0-9_-]{1,64}$/;
3529
+ var EvaluateQuestionSchema = z11.object({
3530
+ key: z11.string().regex(QUESTION_KEY, "key must be 1-64 letters, digits, _ or -"),
3531
+ type: z11.enum(["noul", "choice", "score"]),
3532
+ instructions: z11.string().min(1).max(4e3),
3533
+ options: z11.array(
3534
+ z11.object({
3535
+ key: z11.string().min(1).max(200),
3536
+ description: z11.string().min(1).max(TEXT_MAX)
3537
+ })
3538
+ ).optional(),
3539
+ levels: z11.array(z11.string().min(1).max(TEXT_MAX)).optional()
3540
+ }).superRefine((q, ctx) => {
3541
+ if (q.type === "choice") {
3542
+ const n = q.options?.length ?? 0;
3543
+ if (n < 2 || n > 255) {
3544
+ ctx.addIssue({
3545
+ code: z11.ZodIssueCode.custom,
3546
+ path: ["options"],
3547
+ message: "a choice question needs 2-255 options"
3548
+ });
3549
+ } else if (new Set(q.options?.map((o) => o.key)).size !== n) {
3550
+ ctx.addIssue({
3551
+ code: z11.ZodIssueCode.custom,
3552
+ path: ["options"],
3553
+ message: "option keys must be unique"
3554
+ });
3555
+ }
3556
+ }
3557
+ if (q.type === "score") {
3558
+ const n = q.levels?.length ?? 0;
3559
+ if (n < 2 || n > 10) {
3560
+ ctx.addIssue({
3561
+ code: z11.ZodIssueCode.custom,
3562
+ path: ["levels"],
3563
+ message: "a score question needs 2-10 levels"
3564
+ });
3565
+ }
3566
+ }
3567
+ });
3568
+ var EvaluateQuestionsRequestSchema = z11.object({
3569
+ projectId: z11.string(),
3570
+ state: z11.string().max(JEV_STATE_MAX_CHARS).optional(),
3571
+ items: z11.array(z11.string().max(EVALUATE_ITEM_MAX_CHARS)).max(EVALUATE_MAX_ITEMS).optional(),
3572
+ questions: z11.array(EvaluateQuestionSchema).min(1).max(EVALUATE_MAX_QUESTIONS)
3573
+ }).superRefine((req, ctx) => {
3574
+ if (req.state === void 0 && (!req.items || req.items.length === 0)) {
3575
+ ctx.addIssue({
3576
+ code: z11.ZodIssueCode.custom,
3577
+ path: ["state"],
3578
+ message: "pass state, or a non-empty items array"
3579
+ });
3580
+ }
3581
+ if (JSON.stringify(req).length > EVALUATE_REQUEST_MAX_CHARS) {
3582
+ ctx.addIssue({
3583
+ code: z11.ZodIssueCode.custom,
3584
+ path: [],
3585
+ message: `the request is over ${EVALUATE_REQUEST_MAX_CHARS} characters; split the items across calls`
3586
+ });
3587
+ }
3588
+ if (new Set(req.questions.map((q) => q.key)).size !== req.questions.length) {
3589
+ ctx.addIssue({
3590
+ code: z11.ZodIssueCode.custom,
3591
+ path: ["questions"],
3592
+ message: "question keys must be unique"
3593
+ });
3594
+ }
3468
3595
  });
3596
+ var round3 = (n) => Math.round(n * 1e3) / 1e3;
3597
+ function compactAnswer(answer) {
3598
+ switch (answer.type) {
3599
+ case "noul":
3600
+ return round3(answer.noul);
3601
+ case "choice":
3602
+ return {
3603
+ choice: answer.choice,
3604
+ p: round3(answer.probabilities[answer.choice] ?? 0),
3605
+ confidence: round3(answer.confidence)
3606
+ };
3607
+ case "score":
3608
+ return { score: answer.score, confidence: round3(answer.confidence) };
3609
+ }
3610
+ }
3611
+ function formatEvaluateQuestionsResult(res) {
3612
+ const results = res.results.map(
3613
+ (r) => "error" in r ? { index: r.index, error: r.error } : {
3614
+ index: r.index,
3615
+ answers: Object.fromEntries(
3616
+ Object.entries(r.answers).map(([key, a]) => [key, compactAnswer(a)])
3617
+ )
3618
+ }
3619
+ );
3620
+ return JSON.stringify({ model: res.model, results });
3621
+ }
3469
3622
  var MEETING_CHECKLIST_TITLE_MAX = 300;
3470
3623
  var MEETING_TRANSCRIPT_MAX_CHARS = 2e6;
3471
3624
  var MEETING_TITLE_MAX = 200;
@@ -3603,9 +3756,6 @@ var AGENT_STATUS_REASON_USER_QUESTION = "user_question";
3603
3756
  var TASK_CHAT_HISTORY_LIMIT = 20;
3604
3757
  var PM_CHAT_HISTORY_LIMIT = 40;
3605
3758
  var AGENT_CHAT_HISTORY_FETCH_LIMIT = Math.max(TASK_CHAT_HISTORY_LIMIT, PM_CHAT_HISTORY_LIMIT) + 10;
3606
- function formatModelId(provider, model) {
3607
- return `${provider}/${model}`;
3608
- }
3609
3759
  function anthropicEntry(model, label, inputPerMillion, outputPerMillion, opts = {}) {
3610
3760
  return {
3611
3761
  provider: "anthropic",
@@ -3635,7 +3785,7 @@ function isCodexReasoningEffort(value) {
3635
3785
  return typeof value === "string" && CODEX_REASONING_EFFORTS.includes(value);
3636
3786
  }
3637
3787
  var HUMAN_PROSE_WRITING_STYLE = `## Writing style for humans
3638
- When you write prose a person will read \u2014 chat messages, plan updates, PR titles and bodies, PR review guides (the \`publish_review_guide\` overview and section explanations), review comments \u2014 follow these rules (based on ASD-STE100 Simplified Technical English):
3788
+ When you write prose a person will read \u2014 chat messages, plan updates, PR titles and bodies, review comments \u2014 follow these rules (based on ASD-STE100 Simplified Technical English):
3639
3789
  - Use active voice. Say who does what ("The API rejects the request", not "the request is rejected").
3640
3790
  - Use simple tenses ("we received", not "we have received").
3641
3791
  - One instruction or fact per sentence. Keep sentences under ~20 words.
@@ -4539,21 +4689,30 @@ async function loadForwardPorts(workspaceDir) {
4539
4689
  if (value.visibility === "public" || value.visibility === "private") {
4540
4690
  entry.visibility = value.visibility;
4541
4691
  }
4692
+ if (value.onAutoForward === "ignore") entry.hidden = true;
4542
4693
  attributes[key] = entry;
4543
4694
  }
4544
- return { ports, attributes };
4695
+ const links = sanitizeSessionPreviewLinks(parsed.customizations?.conveyor?.previewLinks);
4696
+ return { ports, attributes, links };
4545
4697
  } catch {
4546
- return { ports: [], attributes: {} };
4698
+ return { ports: [], attributes: {}, links: [] };
4547
4699
  }
4548
4700
  }
4549
4701
  function buildSessionPreviewPorts(result) {
4550
- return result.ports.filter((port) => !DEVCONTAINER_PORT_DENY_LIST.has(port)).map((port) => {
4702
+ const toEntry = (port) => {
4551
4703
  const attr = result.attributes[String(port)];
4552
4704
  const entry = { port };
4553
4705
  if (attr?.label) entry.label = attr.label;
4554
4706
  if (attr?.visibility) entry.visibility = attr.visibility;
4707
+ if (attr?.hidden) entry.hidden = true;
4555
4708
  return entry;
4556
- });
4709
+ };
4710
+ const forwarded = result.ports.filter((port) => !DEVCONTAINER_PORT_DENY_LIST.has(port));
4711
+ const listed = new Set(forwarded);
4712
+ const hiddenOnly = Object.entries(result.attributes).filter(([, attr]) => attr.hidden).map(([key]) => Number(key)).filter(
4713
+ (port) => Number.isInteger(port) && port >= 1 && port <= 65535 && !listed.has(port) && !DEVCONTAINER_PORT_DENY_LIST.has(port)
4714
+ );
4715
+ return [...forwarded, ...hiddenOnly].map(toEntry);
4557
4716
  }
4558
4717
  function loadConveyorConfig() {
4559
4718
  const envStart = process.env.CONVEYOR_START_COMMAND;
@@ -4656,12 +4815,19 @@ var Lifecycle = class {
4656
4815
  this.clearIdleTimers();
4657
4816
  const delay2 = Math.max(0, overrideMs ?? this.config.idleTimeoutMs);
4658
4817
  this.idleTimer = setTimeout(() => {
4818
+ this.idleTimer = null;
4659
4819
  this.callbacks.onIdleTimeout();
4660
4820
  }, delay2);
4661
4821
  }
4662
4822
  cancelIdleTimer() {
4663
4823
  this.clearIdleTimers();
4664
4824
  }
4825
+ /** Restart an ARMED idle timer with the full window; a no-op when none is
4826
+ * armed. Human activity uses this, so a keystroke during a running turn
4827
+ * (timer cancelled) can never arm one. */
4828
+ touchIdleTimer() {
4829
+ if (this.idleTimer) this.startIdleTimer();
4830
+ }
4665
4831
  // ── Dormant timer ──────────────────────────────────────────────────
4666
4832
  /** Start (or restart) the dormant timer.
4667
4833
  * @param overrideMs Optional custom delay in ms. When provided, the timer
@@ -5098,6 +5264,9 @@ export {
5098
5264
  encodePtyStreamFrame,
5099
5265
  PtyStreamFrameReader,
5100
5266
  CARD_DESCRIPTION_FIELD_HINT,
5267
+ MAX_MANUAL_TESTS_PER_TASK,
5268
+ MAX_MANUAL_TEST_TITLE_LENGTH,
5269
+ describeManualTestRejection,
5101
5270
  DEFAULT_CI_WAIT_TIMEOUT_MINUTES,
5102
5271
  MAX_CI_WAIT_TIMEOUT_MINUTES,
5103
5272
  SEVERITY_ENUM,
@@ -5108,7 +5277,6 @@ export {
5108
5277
  MAX_FILE_SIZE_BYTES,
5109
5278
  isCapabilityServableMime,
5110
5279
  RUNNER_MODES,
5111
- ReviewGuideContentSchema,
5112
5280
  CONTEXT_LINK_LOCATOR_MAX,
5113
5281
  isPlaceholderLocator,
5114
5282
  locatorMatchesContent,
@@ -5116,6 +5284,7 @@ export {
5116
5284
  TAG_OVERVIEW_MAX,
5117
5285
  TAG_REASON_MAX,
5118
5286
  CRITICAL_AUTOMATED_SOURCES,
5287
+ formatEvaluateQuestionsResult,
5119
5288
  AGENT_STATUS_REASON_USER_QUESTION,
5120
5289
  TASK_CHAT_HISTORY_LIMIT,
5121
5290
  PM_CHAT_HISTORY_LIMIT,