@rallycry/conveyor-agent 10.12.1 → 10.13.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.
@@ -1902,1010 +1902,1100 @@ import { z } from "zod";
1902
1902
  import { z as z2 } from "zod";
1903
1903
  import { z as z3 } from "zod";
1904
1904
  import { z as z4 } from "zod";
1905
+ import { z as z5 } from "zod";
1905
1906
  var DEFAULT_SONNET_MODEL = "claude-sonnet-5";
1906
1907
  var FABLE_MODEL = "claude-fable-5";
1907
1908
  var TUI_KINDS = ["claude-code", "opencode"];
1909
+ var RISK_LEVELS = ["critical", "high", "medium", "low"];
1910
+ var riskLevelSchema = z.enum(RISK_LEVELS);
1911
+ var DEFAULT_RISK_LEVELS = [
1912
+ {
1913
+ level: "critical",
1914
+ value: 4,
1915
+ label: "Critical",
1916
+ description: "Touches critical surface area; give it the closest review.",
1917
+ color: "#dc2626",
1918
+ ordinal: 0
1919
+ },
1920
+ {
1921
+ level: "high",
1922
+ value: 3,
1923
+ label: "High",
1924
+ description: "Touches important surface area; review carefully.",
1925
+ color: "#ea580c",
1926
+ ordinal: 1
1927
+ },
1928
+ {
1929
+ level: "medium",
1930
+ value: 2,
1931
+ label: "Medium",
1932
+ description: "Moderate surface area; normal review.",
1933
+ color: "#d97706",
1934
+ ordinal: 2
1935
+ },
1936
+ {
1937
+ level: "low",
1938
+ value: 1,
1939
+ label: "Low",
1940
+ description: "Small or isolated surface area.",
1941
+ color: "#64748b",
1942
+ ordinal: 3
1943
+ }
1944
+ ];
1945
+ var LEVEL_BY_VALUE = new Map(DEFAULT_RISK_LEVELS.map((m) => [m.value, m.level]));
1946
+ var ACTIVE_WORK_STATUSES = [
1947
+ "InProgress",
1948
+ "ReviewPR",
1949
+ "ReviewDev",
1950
+ "ReviewLive",
1951
+ "Complete"
1952
+ ];
1953
+ var IDENTIFIED_WORK_STATUSES = ["Open", ...ACTIVE_WORK_STATUSES];
1908
1954
  var MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024;
1909
1955
  var EMBED_THRESHOLD_IMAGES = 5 * 1024 * 1024;
1910
1956
  var EMBED_THRESHOLD_TEXT = 2 * 1024 * 1024;
1911
1957
  var IDLE_HEARTBEAT_MS = 90 * 1e3;
1912
- var TurnEndToolCallSchema = z.object({
1913
- tool: z.string(),
1914
- input: z.string().optional(),
1915
- output: z.string().optional(),
1916
- timestamp: z.string().optional()
1958
+ var TurnEndToolCallSchema = z2.object({
1959
+ tool: z2.string(),
1960
+ input: z2.string().optional(),
1961
+ output: z2.string().optional(),
1962
+ timestamp: z2.string().optional()
1917
1963
  }).passthrough();
1918
- var KnownAgentEventSchema = z.discriminatedUnion("type", [
1964
+ var KnownAgentEventSchema = z2.discriminatedUnion("type", [
1919
1965
  // ── Lifecycle / connection ────────────────────────────────────────────
1920
- z.object({
1921
- type: z.literal("connected"),
1922
- sessionId: z.string(),
1923
- projectId: z.string().optional()
1966
+ z2.object({
1967
+ type: z2.literal("connected"),
1968
+ sessionId: z2.string(),
1969
+ projectId: z2.string().optional()
1924
1970
  }).passthrough(),
1925
1971
  // Open-ended context snapshot spread from buildInitializationContext().
1926
- z.object({ type: z.literal("session_manifest") }).passthrough(),
1927
- z.object({
1928
- type: z.literal("agent_runner_status"),
1929
- reason: z.string(),
1930
- attempt: z.number().optional(),
1931
- attempts: z.number().optional()
1972
+ z2.object({ type: z2.literal("session_manifest") }).passthrough(),
1973
+ z2.object({
1974
+ type: z2.literal("agent_runner_status"),
1975
+ reason: z2.string(),
1976
+ attempt: z2.number().optional(),
1977
+ attempts: z2.number().optional()
1932
1978
  }).passthrough(),
1933
- z.object({ type: z.literal("shutdown"), reason: z.string().optional() }).passthrough(),
1934
- z.object({ type: z.literal("mode_changed"), agentMode: z.string() }).passthrough(),
1935
- z.object({ type: z.literal("mode_transition"), from: z.string(), to: z.string() }).passthrough(),
1979
+ z2.object({ type: z2.literal("shutdown"), reason: z2.string().optional() }).passthrough(),
1980
+ z2.object({ type: z2.literal("mode_changed"), agentMode: z2.string() }).passthrough(),
1981
+ z2.object({ type: z2.literal("mode_transition"), from: z2.string(), to: z2.string() }).passthrough(),
1936
1982
  // ── Turn stream ───────────────────────────────────────────────────────
1937
- z.object({ type: z.literal("message"), content: z.string() }).passthrough(),
1938
- z.object({ type: z.literal("thinking"), message: z.string() }).passthrough(),
1939
- z.object({
1940
- type: z.literal("tool_use"),
1941
- tool: z.string(),
1983
+ z2.object({ type: z2.literal("message"), content: z2.string() }).passthrough(),
1984
+ z2.object({ type: z2.literal("thinking"), message: z2.string() }).passthrough(),
1985
+ z2.object({
1986
+ type: z2.literal("tool_use"),
1987
+ tool: z2.string(),
1942
1988
  // Producers send JSON.stringify(input); consumers defend against
1943
1989
  // object inputs from older agents, so the wire stays permissive here.
1944
- input: z.unknown().optional()
1990
+ input: z2.unknown().optional()
1945
1991
  }).passthrough(),
1946
- z.object({
1947
- type: z.literal("tool_result"),
1948
- tool: z.string(),
1949
- output: z.unknown().optional(),
1950
- isError: z.boolean().optional(),
1951
- redactedCount: z.number().optional()
1992
+ z2.object({
1993
+ type: z2.literal("tool_result"),
1994
+ tool: z2.string(),
1995
+ output: z2.unknown().optional(),
1996
+ isError: z2.boolean().optional(),
1997
+ redactedCount: z2.number().optional()
1952
1998
  }).passthrough(),
1953
- z.object({ type: z.literal("turn_end"), toolCalls: z.array(TurnEndToolCallSchema) }).passthrough(),
1954
- z.object({
1955
- type: z.literal("completed"),
1956
- summary: z.string().optional(),
1957
- durationMs: z.number().optional()
1999
+ z2.object({ type: z2.literal("turn_end"), toolCalls: z2.array(TurnEndToolCallSchema) }).passthrough(),
2000
+ z2.object({
2001
+ type: z2.literal("completed"),
2002
+ summary: z2.string().optional(),
2003
+ durationMs: z2.number().optional()
1958
2004
  }).passthrough(),
1959
- z.object({ type: z.literal("error"), message: z.string() }).passthrough(),
1960
- z.object({ type: z.literal("agent_typing_start") }).passthrough(),
1961
- z.object({ type: z.literal("agent_typing_stop") }).passthrough(),
2005
+ z2.object({ type: z2.literal("error"), message: z2.string() }).passthrough(),
2006
+ z2.object({ type: z2.literal("agent_typing_start") }).passthrough(),
2007
+ z2.object({ type: z2.literal("agent_typing_stop") }).passthrough(),
1962
2008
  // ── Telemetry ─────────────────────────────────────────────────────────
1963
2009
  // heartbeat/typing: legacy telemetry the server still classifies as
1964
2010
  // transient (TRANSIENT_EVENT_TYPES) — kept in the vocabulary.
1965
- z.object({ type: z.literal("heartbeat") }).passthrough(),
1966
- z.object({ type: z.literal("typing") }).passthrough(),
1967
- z.object({
1968
- type: z.literal("context_update"),
1969
- contextTokens: z.number(),
1970
- contextWindow: z.number(),
1971
- inputTokens: z.number().optional(),
1972
- cacheReadInputTokens: z.number().optional(),
1973
- cacheCreationInputTokens: z.number().optional(),
1974
- totalTokensUsed: z.number().optional()
2011
+ z2.object({ type: z2.literal("heartbeat") }).passthrough(),
2012
+ z2.object({ type: z2.literal("typing") }).passthrough(),
2013
+ z2.object({
2014
+ type: z2.literal("context_update"),
2015
+ contextTokens: z2.number(),
2016
+ contextWindow: z2.number(),
2017
+ inputTokens: z2.number().optional(),
2018
+ cacheReadInputTokens: z2.number().optional(),
2019
+ cacheCreationInputTokens: z2.number().optional(),
2020
+ totalTokensUsed: z2.number().optional()
1975
2021
  }).passthrough(),
1976
- // Two producer shapes share this type: {rateLimitType, utilization, status}
1977
- // (SDK rate_limit_event) and {resetsAt} (agent-connection resume notice).
1978
- z.object({
1979
- type: z.literal("rate_limit_update"),
1980
- rateLimitType: z.string().optional(),
1981
- utilization: z.number().optional(),
1982
- status: z.string().optional(),
1983
- resetsAt: z.string().optional()
2022
+ // Three producer shapes share this type: {rateLimitType, utilization, status}
2023
+ // (SDK rate_limit_event), {resetsAt} (agent-connection resume notice), and
2024
+ // the usage-sampler ({rateLimitType, utilization, status, resetsAt, gauges}
2025
+ // — resetsAt matches rateLimitType; gauges survives via .passthrough()).
2026
+ z2.object({
2027
+ type: z2.literal("rate_limit_update"),
2028
+ rateLimitType: z2.string().optional(),
2029
+ utilization: z2.number().optional(),
2030
+ status: z2.string().optional(),
2031
+ resetsAt: z2.string().optional()
1984
2032
  }).passthrough(),
1985
- z.object({
1986
- type: z.literal("context_compacted"),
1987
- trigger: z.string().optional(),
1988
- preTokens: z.number().optional()
2033
+ z2.object({
2034
+ type: z2.literal("context_compacted"),
2035
+ trigger: z2.string().optional(),
2036
+ preTokens: z2.number().optional()
1989
2037
  }).passthrough(),
1990
- z.object({
1991
- type: z.literal("tool_progress"),
1992
- toolName: z.string().optional(),
1993
- elapsedSeconds: z.number().optional()
2038
+ z2.object({
2039
+ type: z2.literal("tool_progress"),
2040
+ toolName: z2.string().optional(),
2041
+ elapsedSeconds: z2.number().optional()
1994
2042
  }).passthrough(),
1995
- z.object({
1996
- type: z.literal("subagent_started"),
1997
- sdkTaskId: z.string().optional(),
1998
- description: z.string().optional()
2043
+ z2.object({
2044
+ type: z2.literal("subagent_started"),
2045
+ sdkTaskId: z2.string().optional(),
2046
+ description: z2.string().optional()
1999
2047
  }).passthrough(),
2000
- z.object({
2001
- type: z.literal("subagent_progress"),
2002
- sdkTaskId: z.string().optional(),
2003
- description: z.string().optional(),
2004
- toolUses: z.number().optional(),
2005
- durationMs: z.number().optional()
2048
+ z2.object({
2049
+ type: z2.literal("subagent_progress"),
2050
+ sdkTaskId: z2.string().optional(),
2051
+ description: z2.string().optional(),
2052
+ toolUses: z2.number().optional(),
2053
+ durationMs: z2.number().optional()
2006
2054
  }).passthrough(),
2007
2055
  // ── Work products ─────────────────────────────────────────────────────
2008
- z.object({ type: z.literal("pr_created"), url: z.string(), number: z.number() }).passthrough(),
2009
- z.object({
2010
- type: z.literal("code_review_complete"),
2011
- result: z.enum(["approved", "changes_requested"]),
2012
- summary: z.string().optional(),
2013
- issues: z.array(
2014
- z.object({
2015
- file: z.string(),
2016
- line: z.number().optional(),
2017
- severity: z.string().optional(),
2018
- description: z.string().optional()
2056
+ z2.object({ type: z2.literal("pr_created"), url: z2.string(), number: z2.number() }).passthrough(),
2057
+ z2.object({
2058
+ type: z2.literal("code_review_complete"),
2059
+ result: z2.enum(["approved", "changes_requested"]),
2060
+ summary: z2.string().optional(),
2061
+ issues: z2.array(
2062
+ z2.object({
2063
+ file: z2.string(),
2064
+ line: z2.number().optional(),
2065
+ severity: z2.string().optional(),
2066
+ description: z2.string().optional()
2019
2067
  }).passthrough()
2020
2068
  ).optional()
2021
2069
  }).passthrough(),
2022
2070
  // ── Environment setup / start command ─────────────────────────────────
2023
- z.object({ type: z.literal("setup_output"), stream: z.string(), data: z.string() }).passthrough(),
2024
- z.object({
2025
- type: z.literal("setup_complete"),
2026
- startCommandRunning: z.boolean().optional(),
2071
+ z2.object({ type: z2.literal("setup_output"), stream: z2.string(), data: z2.string() }).passthrough(),
2072
+ z2.object({
2073
+ type: z2.literal("setup_complete"),
2074
+ startCommandRunning: z2.boolean().optional(),
2027
2075
  // Sanitized server-side by sanitizeSessionPreviewPorts — stays unknown.
2028
- previewPorts: z.unknown().optional()
2076
+ previewPorts: z2.unknown().optional()
2029
2077
  }).passthrough(),
2030
- z.object({ type: z.literal("setup_error"), message: z.string() }).passthrough(),
2031
- z.object({ type: z.literal("start_command_started") }).passthrough(),
2032
- z.object({ type: z.literal("start_command_output"), stream: z.string(), data: z.string() }).passthrough(),
2033
- z.object({
2034
- type: z.literal("start_command_exited"),
2035
- code: z.number().nullable().optional(),
2036
- signal: z.string().nullable().optional(),
2037
- message: z.string().optional()
2078
+ z2.object({ type: z2.literal("setup_error"), message: z2.string() }).passthrough(),
2079
+ z2.object({ type: z2.literal("start_command_started") }).passthrough(),
2080
+ z2.object({ type: z2.literal("start_command_output"), stream: z2.string(), data: z2.string() }).passthrough(),
2081
+ z2.object({
2082
+ type: z2.literal("start_command_exited"),
2083
+ code: z2.number().nullable().optional(),
2084
+ signal: z2.string().nullable().optional(),
2085
+ message: z2.string().optional()
2038
2086
  }).passthrough(),
2039
- z.object({ type: z.literal("start_command_error"), message: z.string() }).passthrough()
2087
+ z2.object({ type: z2.literal("start_command_error"), message: z2.string() }).passthrough()
2040
2088
  ]);
2041
- var AgentEventSchema = z.union([
2089
+ var AgentEventSchema = z2.union([
2042
2090
  KnownAgentEventSchema,
2043
- z.object({ type: z.string().min(1) }).catchall(z.unknown())
2091
+ z2.object({ type: z2.string().min(1) }).catchall(z2.unknown())
2044
2092
  ]);
2045
- var AgentHeartbeatSchema = z2.object({
2046
- sessionId: z2.string().optional(),
2047
- timestamp: z2.string(),
2048
- status: z2.enum(["active", "idle", "building"]),
2049
- currentAction: z2.string().optional(),
2093
+ var AgentHeartbeatSchema = z3.object({
2094
+ sessionId: z3.string().optional(),
2095
+ timestamp: z3.string(),
2096
+ status: z3.enum(["active", "idle", "building"]),
2097
+ currentAction: z3.string().optional(),
2050
2098
  /** Sender-observed main event-loop lag (ms) — see AgentHeartbeat.loopLagMs. */
2051
- loopLagMs: z2.number().nonnegative().optional()
2099
+ loopLagMs: z3.number().nonnegative().optional()
2052
2100
  });
2053
- var CreatePRInputSchema = z2.object({
2054
- title: z2.string().min(1),
2055
- body: z2.string(),
2056
- head: z2.string().optional(),
2057
- base: z2.string().optional()
2101
+ var CreatePRInputSchema = z3.object({
2102
+ title: z3.string().min(1),
2103
+ body: z3.string(),
2104
+ head: z3.string().optional(),
2105
+ base: z3.string().optional()
2058
2106
  });
2059
- var PostToChatInputSchema = z2.object({
2060
- message: z2.string().min(1),
2061
- type: z2.enum(["message", "question", "update"]).optional().default("message")
2107
+ var PostToChatInputSchema = z3.object({
2108
+ message: z3.string().min(1),
2109
+ type: z3.enum(["message", "question", "update"]).optional().default("message")
2062
2110
  });
2063
- var GetTaskContextRequestSchema = z2.object({
2064
- sessionId: z2.string(),
2065
- includeHistory: z2.boolean().optional().default(false)
2111
+ var GetTaskContextRequestSchema = z3.object({
2112
+ sessionId: z3.string(),
2113
+ includeHistory: z3.boolean().optional().default(false)
2066
2114
  });
2067
- var GetChatMessagesRequestSchema = z2.object({
2068
- sessionId: z2.string(),
2069
- limit: z2.number().int().positive().optional().default(50),
2070
- offset: z2.number().int().nonnegative().optional().default(0)
2115
+ var GetChatMessagesRequestSchema = z3.object({
2116
+ sessionId: z3.string(),
2117
+ limit: z3.number().int().positive().optional().default(50),
2118
+ offset: z3.number().int().nonnegative().optional().default(0)
2071
2119
  });
2072
- var GetTaskFilesRequestSchema = z2.object({
2073
- sessionId: z2.string()
2120
+ var GetTaskFilesRequestSchema = z3.object({
2121
+ sessionId: z3.string()
2074
2122
  });
2075
- var GetTaskFileRequestSchema = z2.object({
2076
- sessionId: z2.string(),
2077
- fileId: z2.string()
2123
+ var GetTaskFileRequestSchema = z3.object({
2124
+ sessionId: z3.string(),
2125
+ fileId: z3.string()
2078
2126
  });
2079
- var GetTaskRequestSchema = z2.object({
2080
- sessionId: z2.string(),
2081
- taskSlugOrId: z2.string()
2127
+ var GetTaskRequestSchema = z3.object({
2128
+ sessionId: z3.string(),
2129
+ taskSlugOrId: z3.string()
2082
2130
  });
2083
- var GetCliHistoryRequestSchema = z2.object({
2084
- sessionId: z2.string(),
2085
- limit: z2.number().int().positive().optional().default(100),
2086
- source: z2.enum(["agent", "application"]).optional()
2131
+ var GetCliHistoryRequestSchema = z3.object({
2132
+ sessionId: z3.string(),
2133
+ limit: z3.number().int().positive().optional().default(100),
2134
+ source: z3.enum(["agent", "application"]).optional()
2087
2135
  });
2088
- var ListSubtasksRequestSchema = z2.object({
2089
- sessionId: z2.string(),
2136
+ var ListSubtasksRequestSchema = z3.object({
2137
+ sessionId: z3.string(),
2090
2138
  /** "compact" returns the slim orchestration view (ListSubtasksCompactResponse)
2091
2139
  * with the pack build-slot picture; "full" (default — wire-compat with older
2092
2140
  * agents) returns the verbose SubtaskSummaryDTO[] including description/plan. */
2093
- view: z2.enum(["compact", "full"]).optional()
2094
- });
2095
- var GetDependenciesRequestSchema = z2.object({
2096
- sessionId: z2.string()
2097
- });
2098
- var GetSuggestionsRequestSchema = z2.object({
2099
- sessionId: z2.string(),
2100
- status: z2.string().optional(),
2101
- limit: z2.number().int().min(1).max(100).optional()
2102
- });
2103
- var ListManualTestsRequestSchema = z2.object({
2104
- sessionId: z2.string()
2105
- });
2106
- var QueryManualTestsRequestSchema = z2.object({
2107
- sessionId: z2.string(),
2108
- cardStatuses: z2.array(z2.string()).optional(),
2109
- testStatuses: z2.array(z2.enum(["open", "approved", "rejected"])).optional()
2110
- });
2111
- var CreatePullRequestRequestSchema = CreatePRInputSchema.extend({ sessionId: z2.string() });
2112
- var RequestFileUploadRequestSchema = z2.object({
2113
- sessionId: z2.string(),
2114
- fileName: z2.string().min(1).max(255),
2115
- mimeType: z2.string().min(1).max(128),
2116
- fileSize: z2.number().int().positive().max(MAX_FILE_SIZE_BYTES)
2117
- });
2118
- var ConfirmFileUploadRequestSchema = z2.object({
2119
- sessionId: z2.string(),
2120
- fileId: z2.string(),
2121
- title: z2.string().max(500).optional()
2122
- });
2123
- var UpdateTaskStatusRequestSchema = z2.object({
2124
- sessionId: z2.string(),
2125
- status: z2.string(),
2126
- force: z2.boolean().optional().default(false)
2127
- });
2128
- var StoreSessionIdRequestSchema = z2.object({
2129
- sessionId: z2.string(),
2130
- sdkSessionId: z2.string()
2131
- });
2132
- var SetManualTestsRequestSchema = z2.object({
2133
- sessionId: z2.string(),
2134
- items: z2.array(z2.object({ title: z2.string().min(1) })).min(1)
2135
- });
2136
- var EditManualTestRequestSchema = z2.object({
2137
- sessionId: z2.string(),
2138
- title: z2.string().min(1),
2139
- newTitle: z2.string().min(1)
2140
- });
2141
- var RemoveManualTestRequestSchema = z2.object({
2142
- sessionId: z2.string(),
2143
- title: z2.string().min(1)
2144
- });
2145
- var ApproveManualTestRequestSchema = z2.object({
2146
- sessionId: z2.string(),
2147
- title: z2.string().min(1)
2148
- });
2149
- var RejectManualTestRequestSchema = z2.object({
2150
- sessionId: z2.string(),
2151
- title: z2.string().min(1),
2152
- reason: z2.string().min(1).max(2e3)
2153
- });
2154
- var SessionStartRequestSchema = z2.object({
2155
- sessionId: z2.string(),
2156
- agentVersion: z2.string(),
2157
- capabilities: z2.array(z2.string())
2158
- });
2159
- var SessionStopRequestSchema = z2.object({
2160
- sessionId: z2.string(),
2161
- reason: z2.string().optional()
2162
- });
2163
- var EndReviewSessionRequestSchema = z2.object({
2164
- sessionId: z2.string(),
2165
- reason: z2.enum(["approved", "changes_requested", "finished"]).optional()
2166
- });
2167
- var ConnectAgentRequestSchema = z2.object({
2168
- sessionId: z2.string()
2169
- });
2170
- var ReportAgentStatusRequestSchema = z2.object({
2171
- sessionId: z2.string(),
2172
- status: z2.string(),
2141
+ view: z3.enum(["compact", "full"]).optional()
2142
+ });
2143
+ var GetDependenciesRequestSchema = z3.object({
2144
+ sessionId: z3.string()
2145
+ });
2146
+ var GetSuggestionsRequestSchema = z3.object({
2147
+ sessionId: z3.string(),
2148
+ status: z3.string().optional(),
2149
+ limit: z3.number().int().min(1).max(100).optional()
2150
+ });
2151
+ var ListManualTestsRequestSchema = z3.object({
2152
+ sessionId: z3.string()
2153
+ });
2154
+ var QueryManualTestsRequestSchema = z3.object({
2155
+ sessionId: z3.string(),
2156
+ cardStatuses: z3.array(z3.string()).optional(),
2157
+ testStatuses: z3.array(z3.enum(["open", "approved", "rejected"])).optional()
2158
+ });
2159
+ var CreatePullRequestRequestSchema = CreatePRInputSchema.extend({ sessionId: z3.string() });
2160
+ var RequestFileUploadRequestSchema = z3.object({
2161
+ sessionId: z3.string(),
2162
+ fileName: z3.string().min(1).max(255),
2163
+ mimeType: z3.string().min(1).max(128),
2164
+ fileSize: z3.number().int().positive().max(MAX_FILE_SIZE_BYTES)
2165
+ });
2166
+ var ConfirmFileUploadRequestSchema = z3.object({
2167
+ sessionId: z3.string(),
2168
+ fileId: z3.string(),
2169
+ title: z3.string().max(500).optional()
2170
+ });
2171
+ var UpdateTaskStatusRequestSchema = z3.object({
2172
+ sessionId: z3.string(),
2173
+ status: z3.string(),
2174
+ force: z3.boolean().optional().default(false)
2175
+ });
2176
+ var StoreSessionIdRequestSchema = z3.object({
2177
+ sessionId: z3.string(),
2178
+ sdkSessionId: z3.string()
2179
+ });
2180
+ var SetManualTestsRequestSchema = z3.object({
2181
+ sessionId: z3.string(),
2182
+ items: z3.array(z3.object({ title: z3.string().min(1) })).min(1)
2183
+ });
2184
+ var EditManualTestRequestSchema = z3.object({
2185
+ sessionId: z3.string(),
2186
+ title: z3.string().min(1),
2187
+ newTitle: z3.string().min(1)
2188
+ });
2189
+ var RemoveManualTestRequestSchema = z3.object({
2190
+ sessionId: z3.string(),
2191
+ title: z3.string().min(1)
2192
+ });
2193
+ var ApproveManualTestRequestSchema = z3.object({
2194
+ sessionId: z3.string(),
2195
+ title: z3.string().min(1)
2196
+ });
2197
+ var RejectManualTestRequestSchema = z3.object({
2198
+ sessionId: z3.string(),
2199
+ title: z3.string().min(1),
2200
+ reason: z3.string().min(1).max(2e3)
2201
+ });
2202
+ var SessionStartRequestSchema = z3.object({
2203
+ sessionId: z3.string(),
2204
+ agentVersion: z3.string(),
2205
+ capabilities: z3.array(z3.string())
2206
+ });
2207
+ var SessionStopRequestSchema = z3.object({
2208
+ sessionId: z3.string(),
2209
+ reason: z3.string().optional()
2210
+ });
2211
+ var EndReviewSessionRequestSchema = z3.object({
2212
+ sessionId: z3.string(),
2213
+ reason: z3.enum(["approved", "changes_requested", "finished"]).optional()
2214
+ });
2215
+ var ConnectAgentRequestSchema = z3.object({
2216
+ sessionId: z3.string()
2217
+ });
2218
+ var ReportAgentStatusRequestSchema = z3.object({
2219
+ sessionId: z3.string(),
2220
+ status: z3.string(),
2173
2221
  /** Why the agent reports this status (e.g. "user_question" while an AskUserQuestion questionnaire is pending in the TUI). */
2174
- reason: z2.string().optional(),
2222
+ reason: z3.string().optional(),
2175
2223
  /**
2176
2224
  * The pending question text, sent only alongside `reason: "user_question"`
2177
2225
  * so the server can surface it in the user-question notification body (and
2178
2226
  * thus the Attention feed) instead of a generic string. Optional: older
2179
2227
  * agents omit it and the server falls back to the generic wording.
2180
2228
  */
2181
- questionText: z2.string().optional()
2182
- });
2183
- var NotifyAgentVersionRequestSchema = z2.object({
2184
- sessionId: z2.string(),
2185
- agentVersion: z2.string()
2186
- });
2187
- var DiscoveredPortSchema = z2.object({
2188
- port: z2.number().int().min(1).max(65535),
2189
- label: z2.string().min(1).max(64).optional(),
2190
- protocol: z2.enum(["http", "tcp"]).optional(),
2191
- detectedAt: z2.string()
2192
- });
2193
- var ReportDiscoveredPortsRequestSchema = z2.object({
2194
- sessionId: z2.string(),
2195
- ports: z2.array(DiscoveredPortSchema).max(64)
2196
- });
2197
- var CreateSubtaskRequestSchema = z2.object({
2198
- sessionId: z2.string(),
2199
- title: z2.string().min(1),
2200
- description: z2.string().optional(),
2201
- plan: z2.string().optional(),
2202
- storyPointValue: z2.number().int().positive().optional(),
2203
- ordinal: z2.number().int().nonnegative().optional(),
2204
- followParentStatus: z2.boolean().optional(),
2229
+ questionText: z3.string().optional()
2230
+ });
2231
+ var NotifyAgentVersionRequestSchema = z3.object({
2232
+ sessionId: z3.string(),
2233
+ agentVersion: z3.string()
2234
+ });
2235
+ var DiscoveredPortSchema = z3.object({
2236
+ port: z3.number().int().min(1).max(65535),
2237
+ label: z3.string().min(1).max(64).optional(),
2238
+ protocol: z3.enum(["http", "tcp"]).optional(),
2239
+ detectedAt: z3.string()
2240
+ });
2241
+ var ReportDiscoveredPortsRequestSchema = z3.object({
2242
+ sessionId: z3.string(),
2243
+ ports: z3.array(DiscoveredPortSchema).max(64)
2244
+ });
2245
+ var CreateSubtaskRequestSchema = z3.object({
2246
+ sessionId: z3.string(),
2247
+ title: z3.string().min(1),
2248
+ description: z3.string().optional(),
2249
+ plan: z3.string().optional(),
2250
+ storyPointValue: z3.number().int().positive().optional(),
2251
+ ordinal: z3.number().int().nonnegative().optional(),
2252
+ followParentStatus: z3.boolean().optional(),
2205
2253
  /** Sibling subtask ids or slugs this subtask blocks on (explicit dependency
2206
2254
  * metadata — preferred over encoding order in plan text / ordinal). */
2207
- dependsOn: z2.array(z2.string().min(1)).max(32).optional()
2208
- });
2209
- var UpdateSubtaskRequestSchema = z2.object({
2210
- sessionId: z2.string(),
2211
- subtaskId: z2.string(),
2212
- title: z2.string().min(1).optional(),
2213
- description: z2.string().optional(),
2214
- plan: z2.string().optional(),
2255
+ dependsOn: z3.array(z3.string().min(1)).max(32).optional()
2256
+ });
2257
+ var UpdateSubtaskRequestSchema = z3.object({
2258
+ sessionId: z3.string(),
2259
+ subtaskId: z3.string(),
2260
+ title: z3.string().min(1).optional(),
2261
+ description: z3.string().optional(),
2262
+ plan: z3.string().optional(),
2215
2263
  /** Orchestration statuses only ("Planning" | "Open") — the pack parent's
2216
2264
  * sanctioned promotion path. Execution statuses stay with the build
2217
2265
  * pipeline / force_update_task_status. Enforced server-side. */
2218
- status: z2.string().optional(),
2266
+ status: z3.string().optional(),
2219
2267
  /** Assign a project agent to the child — accepts the agent's id or exact
2220
2268
  * name; resolved against the parent task's project server-side. */
2221
- agentIdOrName: z2.string().min(1).optional(),
2222
- storyPointValue: z2.number().int().positive().optional(),
2223
- followParentStatus: z2.boolean().optional(),
2269
+ agentIdOrName: z3.string().min(1).optional(),
2270
+ storyPointValue: z3.number().int().positive().optional(),
2271
+ followParentStatus: z3.boolean().optional(),
2224
2272
  /** Replace this subtask's dependency edges with these sibling ids/slugs.
2225
2273
  * Empty array clears all. Omit to leave dependencies unchanged. */
2226
- dependsOn: z2.array(z2.string().min(1)).max(32).optional()
2227
- });
2228
- var DeleteSubtaskRequestSchema = z2.object({
2229
- sessionId: z2.string(),
2230
- subtaskId: z2.string()
2231
- });
2232
- var GetTaskPropertiesRequestSchema = z2.object({
2233
- sessionId: z2.string()
2234
- });
2235
- var UpdateTaskFieldsRequestSchema = z2.object({
2236
- sessionId: z2.string(),
2237
- plan: z2.string().optional(),
2238
- description: z2.string().optional()
2239
- });
2240
- var UpdateTaskPropertiesRequestSchema = z2.object({
2241
- sessionId: z2.string(),
2242
- title: z2.string().optional(),
2243
- storyPointValue: z2.number().int().positive().optional(),
2244
- tagIds: z2.array(z2.string()).optional(),
2245
- tagNames: z2.array(z2.string()).optional(),
2246
- githubPRUrl: z2.string().url().optional(),
2247
- githubBranch: z2.string().optional()
2248
- });
2249
- var ListIconsRequestSchema = z2.object({
2250
- sessionId: z2.string()
2251
- });
2252
- var GenerateTaskIconRequestSchema = z2.object({
2253
- sessionId: z2.string(),
2254
- prompt: z2.string().min(1),
2255
- aspectRatio: z2.string().optional()
2256
- });
2257
- var SearchFaIconsRequestSchema = z2.object({
2258
- sessionId: z2.string(),
2259
- query: z2.string().min(1),
2260
- first: z2.number().int().positive().optional()
2261
- });
2262
- var PickFaIconRequestSchema = z2.object({
2263
- sessionId: z2.string(),
2264
- fontAwesomeId: z2.string().min(1),
2265
- fontAwesomeStyle: z2.string().optional()
2266
- });
2267
- var CreateFollowUpTaskRequestSchema = z2.object({
2268
- sessionId: z2.string(),
2269
- title: z2.string().min(1),
2270
- description: z2.string().optional(),
2271
- plan: z2.string().optional(),
2272
- storyPointValue: z2.number().int().positive().optional()
2273
- });
2274
- var AddDependencyRequestSchema = z2.object({
2275
- sessionId: z2.string(),
2276
- dependsOnSlugOrId: z2.string()
2277
- });
2278
- var RemoveDependencyRequestSchema = z2.object({
2279
- sessionId: z2.string(),
2280
- dependsOnSlugOrId: z2.string()
2281
- });
2282
- var CreateSuggestionRequestSchema = z2.object({
2283
- sessionId: z2.string(),
2284
- title: z2.string().min(1),
2285
- description: z2.string().optional(),
2286
- tagNames: z2.array(z2.string()).optional()
2287
- });
2288
- var VoteSuggestionRequestSchema = z2.object({
2289
- sessionId: z2.string(),
2290
- suggestionId: z2.string(),
2291
- value: z2.union([z2.literal(1), z2.literal(-1)])
2292
- });
2293
- var TriggerIdentificationRequestSchema = z2.object({
2294
- sessionId: z2.string()
2295
- });
2296
- var SubmitCodeReviewResultRequestSchema = z2.object({
2297
- sessionId: z2.string(),
2298
- approved: z2.boolean(),
2299
- content: z2.string()
2300
- });
2301
- var CycleCodingAgentKeyRequestSchema = z2.object({
2302
- sessionId: z2.string(),
2303
- rateLimitType: z2.string(),
2304
- resetsAt: z2.string().optional()
2305
- });
2306
- var StartChildCloudBuildRequestSchema = z2.object({
2307
- sessionId: z2.string(),
2308
- childTaskId: z2.string()
2309
- });
2310
- var StopChildBuildRequestSchema = z2.object({
2311
- sessionId: z2.string(),
2312
- childTaskId: z2.string()
2313
- });
2314
- var ApproveAndMergePRRequestSchema = z2.object({
2315
- sessionId: z2.string(),
2316
- childTaskId: z2.string()
2317
- });
2318
- var PostChildChatMessageRequestSchema = z2.object({
2319
- sessionId: z2.string(),
2320
- childTaskId: z2.string(),
2321
- message: z2.string().min(1)
2322
- });
2323
- var UpdateChildStatusRequestSchema = z2.object({
2324
- sessionId: z2.string(),
2325
- childTaskId: z2.string(),
2326
- status: z2.string()
2327
- });
2328
- var GetAgentStatusRequestSchema = z2.object({
2329
- taskId: z2.string()
2330
- });
2331
- var GetUiCliHistoryRequestSchema = z2.object({
2332
- taskId: z2.string()
2333
- });
2334
- var GetActivePtySessionRequestSchema = z2.object({
2335
- taskId: z2.string()
2336
- });
2337
- var ListActivePtySessionsRequestSchema = z2.object({
2338
- taskId: z2.string()
2339
- });
2340
- var SendSoftStopRequestSchema = z2.object({
2341
- taskId: z2.string()
2342
- });
2343
- var StopTaskSessionRequestSchema = z2.object({
2344
- taskId: z2.string(),
2345
- sessionId: z2.string()
2346
- });
2347
- var FlushTaskQueueRequestSchema = z2.object({
2348
- taskId: z2.string(),
2349
- softStop: z2.boolean().optional()
2350
- });
2351
- var CancelTaskQueuedMessageRequestSchema = z2.object({
2352
- taskId: z2.string(),
2353
- messageId: z2.string()
2354
- });
2355
- var FlushSingleQueuedMessageRequestSchema = z2.object({
2356
- taskId: z2.string(),
2357
- messageId: z2.string(),
2358
- softStop: z2.boolean().optional()
2359
- });
2360
- var AnswerAgentQuestionRequestSchema = z2.object({
2361
- taskId: z2.string(),
2362
- requestId: z2.string(),
2363
- answers: z2.record(z2.string(), z2.string())
2364
- });
2365
- var ClearAgentTodosRequestSchema = z2.object({
2366
- taskId: z2.string()
2367
- });
2368
- var AgentQuestionOptionSchema = z2.object({
2369
- label: z2.string(),
2370
- description: z2.string(),
2371
- preview: z2.string().optional()
2372
- });
2373
- var AgentQuestionSchema = z2.object({
2374
- question: z2.string(),
2375
- header: z2.string(),
2376
- options: z2.array(AgentQuestionOptionSchema),
2377
- multiSelect: z2.boolean().optional()
2378
- });
2379
- var AskUserQuestionRequestSchema = z2.object({
2380
- sessionId: z2.string(),
2381
- question: z2.string().min(1),
2382
- requestId: z2.string().min(1),
2383
- questions: z2.array(AgentQuestionSchema).min(1)
2384
- });
2385
- var EmitAgentEventRequestSchema = z2.object({
2386
- sessionId: z2.string(),
2387
- events: z2.array(AgentEventSchema).max(500)
2388
- });
2389
- var RefreshGithubTokenRequestSchema = z2.object({
2390
- sessionId: z2.string()
2274
+ dependsOn: z3.array(z3.string().min(1)).max(32).optional()
2391
2275
  });
2392
- var ReportReviewSpawnFailureRequestSchema = z2.object({
2393
- sessionId: z2.string(),
2394
- reviewSessionId: z2.string(),
2395
- error: z2.string().max(2e3).optional()
2396
- });
2397
- var SpawnTaskSessionRequestSchema = z2.object({
2398
- taskId: z2.string(),
2399
- kind: z2.enum(["tui", "shell"])
2276
+ var DeleteSubtaskRequestSchema = z3.object({
2277
+ sessionId: z3.string(),
2278
+ subtaskId: z3.string()
2400
2279
  });
2401
- var SpawnTaskReviewRequestSchema = z2.object({
2402
- taskId: z2.string()
2280
+ var GetTaskPropertiesRequestSchema = z3.object({
2281
+ sessionId: z3.string()
2403
2282
  });
2404
- var ReportSessionSpawnFailureRequestSchema = z2.object({
2405
- sessionId: z2.string(),
2406
- spawnedSessionId: z2.string(),
2407
- error: z2.string().max(2e3).optional()
2283
+ var UpdateTaskFieldsRequestSchema = z3.object({
2284
+ sessionId: z3.string(),
2285
+ plan: z3.string().optional(),
2286
+ description: z3.string().optional()
2408
2287
  });
2409
- var RefreshGithubTokenResponseSchema = z2.object({
2410
- token: z2.string()
2288
+ var UpdateTaskPropertiesRequestSchema = z3.object({
2289
+ sessionId: z3.string(),
2290
+ title: z3.string().optional(),
2291
+ storyPointValue: z3.number().int().positive().optional(),
2292
+ tagIds: z3.array(z3.string()).optional(),
2293
+ tagNames: z3.array(z3.string()).optional(),
2294
+ githubPRUrl: z3.string().url().optional(),
2295
+ githubBranch: z3.string().optional()
2411
2296
  });
2412
- var PTY_FRAME_MAX_CHARS = 256 * 1024;
2413
- var PTY_MAX_DIMENSION = 1e3;
2414
- var PtyOutputRequestSchema = z2.object({
2415
- sessionId: z2.string(),
2416
- data: z2.string().max(PTY_FRAME_MAX_CHARS),
2417
- cols: z2.number().int().positive().max(PTY_MAX_DIMENSION).optional(),
2418
- rows: z2.number().int().positive().max(PTY_MAX_DIMENSION).optional()
2297
+ var ListIconsRequestSchema = z3.object({
2298
+ sessionId: z3.string()
2419
2299
  });
2420
- var PtyEndedRequestSchema = z2.object({
2421
- sessionId: z2.string()
2300
+ var GenerateTaskIconRequestSchema = z3.object({
2301
+ sessionId: z3.string(),
2302
+ prompt: z3.string().min(1),
2303
+ aspectRatio: z3.string().optional()
2422
2304
  });
2423
- var PtyInputRequestSchema = z2.object({
2424
- sessionId: z2.string(),
2425
- data: z2.string().max(PTY_FRAME_MAX_CHARS)
2305
+ var SearchFaIconsRequestSchema = z3.object({
2306
+ sessionId: z3.string(),
2307
+ query: z3.string().min(1),
2308
+ first: z3.number().int().positive().optional()
2426
2309
  });
2427
- var PtyResizeRequestSchema = z2.object({
2428
- sessionId: z2.string(),
2429
- cols: z2.number().int().positive().max(PTY_MAX_DIMENSION),
2430
- rows: z2.number().int().positive().max(PTY_MAX_DIMENSION)
2310
+ var PickFaIconRequestSchema = z3.object({
2311
+ sessionId: z3.string(),
2312
+ fontAwesomeId: z3.string().min(1),
2313
+ fontAwesomeStyle: z3.string().optional()
2431
2314
  });
2432
- var PtyAttachRequestSchema = z2.object({
2433
- sessionId: z2.string()
2315
+ var CreateFollowUpTaskRequestSchema = z3.object({
2316
+ sessionId: z3.string(),
2317
+ title: z3.string().min(1),
2318
+ description: z3.string().optional(),
2319
+ plan: z3.string().optional(),
2320
+ storyPointValue: z3.number().int().positive().optional()
2434
2321
  });
2435
- var PtyChatEventPayloadSchema = z2.discriminatedUnion("kind", [
2436
- z2.object({
2437
- kind: z2.literal("init"),
2438
- model: z2.string().max(200),
2439
- claudeSessionId: z2.string().max(100).optional()
2322
+ var AddDependencyRequestSchema = z3.object({
2323
+ sessionId: z3.string(),
2324
+ dependsOnSlugOrId: z3.string()
2325
+ });
2326
+ var RemoveDependencyRequestSchema = z3.object({
2327
+ sessionId: z3.string(),
2328
+ dependsOnSlugOrId: z3.string()
2329
+ });
2330
+ var CreateSuggestionRequestSchema = z3.object({
2331
+ sessionId: z3.string(),
2332
+ title: z3.string().min(1),
2333
+ description: z3.string().optional(),
2334
+ tagNames: z3.array(z3.string()).optional()
2335
+ });
2336
+ var VoteSuggestionRequestSchema = z3.object({
2337
+ sessionId: z3.string(),
2338
+ suggestionId: z3.string(),
2339
+ value: z3.union([z3.literal(1), z3.literal(-1)])
2340
+ });
2341
+ var TriggerIdentificationRequestSchema = z3.object({
2342
+ sessionId: z3.string()
2343
+ });
2344
+ var SubmitCodeReviewResultRequestSchema = z3.object({
2345
+ sessionId: z3.string(),
2346
+ approved: z3.boolean(),
2347
+ content: z3.string(),
2348
+ // Canonical risk derived by the reviewer (approve → low; changes → max issue
2349
+ // severity). Applied raise-only server-side; never lowers an explicit value.
2350
+ risk: riskLevelSchema.optional(),
2351
+ // The commit SHA the reviewer actually reviewed. When present, the verdict is
2352
+ // rejected unless the task is still at this SHA (guards against a late
2353
+ // old-SHA verdict overwriting a newer review cycle).
2354
+ reviewedSha: z3.string().optional()
2355
+ });
2356
+ var CycleCodingAgentKeyRequestSchema = z3.object({
2357
+ sessionId: z3.string(),
2358
+ rateLimitType: z3.string(),
2359
+ resetsAt: z3.string().optional()
2360
+ });
2361
+ var StartChildCloudBuildRequestSchema = z3.object({
2362
+ sessionId: z3.string(),
2363
+ childTaskId: z3.string()
2364
+ });
2365
+ var StopChildBuildRequestSchema = z3.object({
2366
+ sessionId: z3.string(),
2367
+ childTaskId: z3.string()
2368
+ });
2369
+ var ApproveAndMergePRRequestSchema = z3.object({
2370
+ sessionId: z3.string(),
2371
+ childTaskId: z3.string()
2372
+ });
2373
+ var PostChildChatMessageRequestSchema = z3.object({
2374
+ sessionId: z3.string(),
2375
+ childTaskId: z3.string(),
2376
+ message: z3.string().min(1)
2377
+ });
2378
+ var UpdateChildStatusRequestSchema = z3.object({
2379
+ sessionId: z3.string(),
2380
+ childTaskId: z3.string(),
2381
+ status: z3.string()
2382
+ });
2383
+ var GetAgentStatusRequestSchema = z3.object({
2384
+ taskId: z3.string()
2385
+ });
2386
+ var GetUiCliHistoryRequestSchema = z3.object({
2387
+ taskId: z3.string()
2388
+ });
2389
+ var GetActivePtySessionRequestSchema = z3.object({
2390
+ taskId: z3.string()
2391
+ });
2392
+ var ListActivePtySessionsRequestSchema = z3.object({
2393
+ taskId: z3.string()
2394
+ });
2395
+ var SendSoftStopRequestSchema = z3.object({
2396
+ taskId: z3.string()
2397
+ });
2398
+ var StopTaskSessionRequestSchema = z3.object({
2399
+ taskId: z3.string(),
2400
+ sessionId: z3.string()
2401
+ });
2402
+ var FlushTaskQueueRequestSchema = z3.object({
2403
+ taskId: z3.string(),
2404
+ softStop: z3.boolean().optional()
2405
+ });
2406
+ var CancelTaskQueuedMessageRequestSchema = z3.object({
2407
+ taskId: z3.string(),
2408
+ messageId: z3.string()
2409
+ });
2410
+ var FlushSingleQueuedMessageRequestSchema = z3.object({
2411
+ taskId: z3.string(),
2412
+ messageId: z3.string(),
2413
+ softStop: z3.boolean().optional()
2414
+ });
2415
+ var AnswerAgentQuestionRequestSchema = z3.object({
2416
+ taskId: z3.string(),
2417
+ requestId: z3.string(),
2418
+ answers: z3.record(z3.string(), z3.string())
2419
+ });
2420
+ var ClearAgentTodosRequestSchema = z3.object({
2421
+ taskId: z3.string()
2422
+ });
2423
+ var AgentQuestionOptionSchema = z3.object({
2424
+ label: z3.string(),
2425
+ description: z3.string(),
2426
+ preview: z3.string().optional()
2427
+ });
2428
+ var AgentQuestionSchema = z3.object({
2429
+ question: z3.string(),
2430
+ header: z3.string(),
2431
+ options: z3.array(AgentQuestionOptionSchema),
2432
+ multiSelect: z3.boolean().optional()
2433
+ });
2434
+ var AskUserQuestionRequestSchema = z3.object({
2435
+ sessionId: z3.string(),
2436
+ question: z3.string().min(1),
2437
+ requestId: z3.string().min(1),
2438
+ questions: z3.array(AgentQuestionSchema).min(1)
2439
+ });
2440
+ var EmitAgentEventRequestSchema = z3.object({
2441
+ sessionId: z3.string(),
2442
+ events: z3.array(AgentEventSchema).max(500)
2443
+ });
2444
+ var RefreshGithubTokenRequestSchema = z3.object({
2445
+ sessionId: z3.string()
2446
+ });
2447
+ var ReportReviewSpawnFailureRequestSchema = z3.object({
2448
+ sessionId: z3.string(),
2449
+ reviewSessionId: z3.string(),
2450
+ error: z3.string().max(2e3).optional()
2451
+ });
2452
+ var SpawnTaskSessionRequestSchema = z3.object({
2453
+ taskId: z3.string(),
2454
+ kind: z3.enum(["tui", "shell"])
2455
+ });
2456
+ var SpawnTaskReviewRequestSchema = z3.object({
2457
+ taskId: z3.string()
2458
+ });
2459
+ var ReportSessionSpawnFailureRequestSchema = z3.object({
2460
+ sessionId: z3.string(),
2461
+ spawnedSessionId: z3.string(),
2462
+ error: z3.string().max(2e3).optional()
2463
+ });
2464
+ var RefreshGithubTokenResponseSchema = z3.object({
2465
+ token: z3.string()
2466
+ });
2467
+ var PTY_FRAME_MAX_CHARS = 256 * 1024;
2468
+ var PTY_MAX_DIMENSION = 1e3;
2469
+ var PtyOutputRequestSchema = z3.object({
2470
+ sessionId: z3.string(),
2471
+ data: z3.string().max(PTY_FRAME_MAX_CHARS),
2472
+ cols: z3.number().int().positive().max(PTY_MAX_DIMENSION).optional(),
2473
+ rows: z3.number().int().positive().max(PTY_MAX_DIMENSION).optional()
2474
+ });
2475
+ var PtyEndedRequestSchema = z3.object({
2476
+ sessionId: z3.string()
2477
+ });
2478
+ var PtyInputRequestSchema = z3.object({
2479
+ sessionId: z3.string(),
2480
+ data: z3.string().max(PTY_FRAME_MAX_CHARS)
2481
+ });
2482
+ var PtyResizeRequestSchema = z3.object({
2483
+ sessionId: z3.string(),
2484
+ cols: z3.number().int().positive().max(PTY_MAX_DIMENSION),
2485
+ rows: z3.number().int().positive().max(PTY_MAX_DIMENSION)
2486
+ });
2487
+ var PtyAttachRequestSchema = z3.object({
2488
+ sessionId: z3.string()
2489
+ });
2490
+ var PtyChatEventPayloadSchema = z3.discriminatedUnion("kind", [
2491
+ z3.object({
2492
+ kind: z3.literal("init"),
2493
+ model: z3.string().max(200),
2494
+ claudeSessionId: z3.string().max(100).optional()
2440
2495
  }),
2441
- z2.object({ kind: z2.literal("user_text"), text: z2.string().max(16384) }),
2442
- z2.object({ kind: z2.literal("assistant_text"), text: z2.string().max(16384) }),
2443
- z2.object({
2444
- kind: z2.literal("tool_use"),
2445
- name: z2.string().max(200),
2496
+ z3.object({ kind: z3.literal("user_text"), text: z3.string().max(16384) }),
2497
+ z3.object({ kind: z3.literal("assistant_text"), text: z3.string().max(16384) }),
2498
+ z3.object({
2499
+ kind: z3.literal("tool_use"),
2500
+ name: z3.string().max(200),
2446
2501
  // Compact preview: JSON.stringify(input) truncated agent-side.
2447
- input: z2.string().max(2e3),
2502
+ input: z3.string().max(2e3),
2448
2503
  // Transcript tool_use block id — lets the client pair the tool_result.
2449
- id: z2.string().max(100).optional()
2504
+ id: z3.string().max(100).optional()
2450
2505
  }),
2451
- z2.object({
2452
- kind: z2.literal("tool_result"),
2506
+ z3.object({
2507
+ kind: z3.literal("tool_result"),
2453
2508
  // tool_use block id this result answers (absent on malformed records).
2454
- toolUseId: z2.string().max(100).optional(),
2509
+ toolUseId: z3.string().max(100).optional(),
2455
2510
  // Compact output preview, truncated agent-side.
2456
- output: z2.string().max(2e3),
2457
- isError: z2.boolean().optional()
2511
+ output: z3.string().max(2e3),
2512
+ isError: z3.boolean().optional()
2458
2513
  }),
2459
- z2.object({ kind: z2.literal("turn_end") })
2514
+ z3.object({ kind: z3.literal("turn_end") })
2460
2515
  ]);
2461
- var PtyChatEventRequestSchema = z2.object({
2462
- sessionId: z2.string(),
2516
+ var PtyChatEventRequestSchema = z3.object({
2517
+ sessionId: z3.string(),
2463
2518
  event: PtyChatEventPayloadSchema
2464
2519
  });
2465
- var PtyChatAttachRequestSchema = z2.object({
2466
- sessionId: z2.string()
2520
+ var PtyChatAttachRequestSchema = z3.object({
2521
+ sessionId: z3.string()
2467
2522
  });
2468
- var CreatePRResponseSchema = z2.object({
2469
- prNumber: z2.number().int().positive(),
2470
- prUrl: z2.string().url()
2523
+ var CreatePRResponseSchema = z3.object({
2524
+ prNumber: z3.number().int().positive(),
2525
+ prUrl: z3.string().url()
2471
2526
  });
2472
- var PostToChatResponseSchema = z2.object({
2473
- messageId: z2.string()
2527
+ var PostToChatResponseSchema = z3.object({
2528
+ messageId: z3.string()
2474
2529
  });
2475
- var UpdateTaskStatusResponseSchema = z2.object({
2476
- taskId: z2.string(),
2477
- status: z2.string()
2530
+ var UpdateTaskStatusResponseSchema = z3.object({
2531
+ taskId: z3.string(),
2532
+ status: z3.string()
2478
2533
  });
2479
- var StoreSessionIdResponseSchema = z2.object({
2480
- success: z2.boolean()
2534
+ var StoreSessionIdResponseSchema = z3.object({
2535
+ success: z3.boolean()
2481
2536
  });
2482
- var HeartbeatResponseSchema = z2.object({
2483
- acknowledged: z2.boolean()
2537
+ var HeartbeatResponseSchema = z3.object({
2538
+ acknowledged: z3.boolean()
2484
2539
  });
2485
- var SessionStartResponseSchema = z2.object({
2486
- sessionId: z2.string(),
2487
- startedAt: z2.string()
2540
+ var SessionStartResponseSchema = z3.object({
2541
+ sessionId: z3.string(),
2542
+ startedAt: z3.string()
2488
2543
  });
2489
- var SessionStopResponseSchema = z2.object({
2490
- sessionId: z2.string(),
2491
- stoppedAt: z2.string()
2544
+ var SessionStopResponseSchema = z3.object({
2545
+ sessionId: z3.string(),
2546
+ stoppedAt: z3.string()
2492
2547
  });
2493
- var DeleteSubtaskResponseSchema = z2.object({
2494
- deleted: z2.boolean()
2548
+ var DeleteSubtaskResponseSchema = z3.object({
2549
+ deleted: z3.boolean()
2495
2550
  });
2496
- var ListAccessibleProjectsRequestSchema = z3.object({
2497
- pageSize: z3.number().int().positive().max(100).optional().default(100)
2551
+ var ListAccessibleProjectsRequestSchema = z4.object({
2552
+ pageSize: z4.number().int().positive().max(100).optional().default(100)
2498
2553
  });
2499
- var ListProjectTasksRequestSchema = z3.object({
2500
- projectId: z3.string(),
2501
- status: z3.string().optional(),
2502
- assigneeId: z3.string().optional(),
2503
- unassigned: z3.boolean().optional(),
2504
- limit: z3.number().int().positive().optional().default(50)
2554
+ var ListProjectTasksRequestSchema = z4.object({
2555
+ projectId: z4.string(),
2556
+ status: z4.string().optional(),
2557
+ assigneeId: z4.string().optional(),
2558
+ unassigned: z4.boolean().optional(),
2559
+ // Scope to a sub-project board when provided. Unlike the board layer's `?? null`
2560
+ // semantics, agents default to seeing the whole project when omitted.
2561
+ subProjectId: z4.string().nullable().optional(),
2562
+ limit: z4.number().int().positive().optional().default(50)
2505
2563
  }).refine((p) => !(p.unassigned && p.assigneeId), {
2506
2564
  message: "Pass either assigneeId or unassigned, not both"
2507
2565
  });
2508
- var GetProjectTaskRequestSchema = z3.object({
2509
- projectId: z3.string(),
2510
- taskId: z3.string()
2566
+ var GetProjectTaskRequestSchema = z4.object({
2567
+ projectId: z4.string(),
2568
+ taskId: z4.string()
2511
2569
  });
2512
- var SearchProjectTasksRequestSchema = z3.object({
2513
- projectId: z3.string(),
2514
- tagNames: z3.array(z3.string()).optional(),
2515
- searchQuery: z3.string().optional(),
2516
- statusFilters: z3.array(z3.string()).optional(),
2570
+ var SearchProjectTasksRequestSchema = z4.object({
2571
+ projectId: z4.string(),
2572
+ tagNames: z4.array(z4.string()).optional(),
2573
+ searchQuery: z4.string().optional(),
2574
+ statusFilters: z4.array(z4.string()).optional(),
2517
2575
  // Card types to include. Omitted/empty → defaults to ["task"] in the handler so
2518
2576
  // search doesn't surface incidents/suggestions unless asked. Enum validation lives
2519
2577
  // at the MCP tool layer (mirrors statusFilters).
2520
- typeFilters: z3.array(z3.string()).optional(),
2521
- assigneeId: z3.string().optional(),
2522
- unassigned: z3.boolean().optional(),
2523
- limit: z3.number().int().positive().optional().default(20)
2578
+ typeFilters: z4.array(z4.string()).optional(),
2579
+ assigneeId: z4.string().optional(),
2580
+ unassigned: z4.boolean().optional(),
2581
+ // Scope to a sub-project board when provided. Unlike the board layer's `?? null`
2582
+ // semantics, agents default to seeing the whole project when omitted.
2583
+ subProjectId: z4.string().nullable().optional(),
2584
+ limit: z4.number().int().positive().optional().default(20)
2524
2585
  }).refine((p) => !(p.unassigned && p.assigneeId), {
2525
2586
  message: "Pass either assigneeId or unassigned, not both"
2526
2587
  });
2527
- var ListProjectTagsRequestSchema = z3.object({
2528
- projectId: z3.string()
2588
+ var ListProjectTagsRequestSchema = z4.object({
2589
+ projectId: z4.string()
2529
2590
  });
2530
- var GetProjectSummaryRequestSchema = z3.object({
2531
- projectId: z3.string()
2591
+ var GetProjectSummaryRequestSchema = z4.object({
2592
+ projectId: z4.string()
2532
2593
  });
2533
- var CreateProjectTaskRequestSchema = z3.object({
2534
- projectId: z3.string(),
2535
- title: z3.string().min(1),
2536
- description: z3.string().optional(),
2537
- plan: z3.string().optional(),
2538
- status: z3.string().optional(),
2539
- requestingUserId: z3.string().optional()
2594
+ var CreateProjectTaskRequestSchema = z4.object({
2595
+ projectId: z4.string(),
2596
+ title: z4.string().min(1),
2597
+ description: z4.string().optional(),
2598
+ plan: z4.string().optional(),
2599
+ status: z4.string().optional(),
2600
+ // Assign to a sub-project board. Validated to belong to `projectId` in the handler.
2601
+ subProjectId: z4.string().nullable().optional(),
2602
+ requestingUserId: z4.string().optional()
2540
2603
  });
2541
- var UpdateProjectTaskRequestSchema = z3.object({
2542
- projectId: z3.string(),
2543
- taskId: z3.string(),
2544
- title: z3.string().optional(),
2545
- description: z3.string().optional(),
2546
- plan: z3.string().optional(),
2547
- status: z3.string().optional(),
2548
- assignedUserId: z3.string().nullish(),
2549
- requestingUserId: z3.string().optional()
2604
+ var UpdateProjectTaskRequestSchema = z4.object({
2605
+ projectId: z4.string(),
2606
+ taskId: z4.string(),
2607
+ title: z4.string().optional(),
2608
+ plan: z4.string().optional(),
2609
+ // Canonical risk level, or null to clear. Resolved to the project's
2610
+ // configured Risk row (by rank) in the handler.
2611
+ risk: riskLevelSchema.nullable().optional(),
2612
+ assignedUserId: z4.string().nullish(),
2613
+ // Move to a different sub-project board, or null to move to the parent board.
2614
+ // Validated to belong to `projectId` in the handler.
2615
+ subProjectId: z4.string().nullable().optional(),
2616
+ requestingUserId: z4.string().optional()
2617
+ }).strict().refine(
2618
+ (v) => v.title !== void 0 || v.plan !== void 0 || v.risk !== void 0 || v.assignedUserId !== void 0 || v.subProjectId !== void 0,
2619
+ {
2620
+ message: "update_task requires at least one field to change (title, plan, risk, assignedUserId, or subProjectId)"
2621
+ }
2622
+ );
2623
+ var TransitionProjectTaskStatusRequestSchema = z4.object({
2624
+ projectId: z4.string(),
2625
+ taskId: z4.string(),
2626
+ toStatus: z4.string(),
2627
+ expectedFromStatus: z4.string().optional(),
2628
+ // Optional raise-only risk to attempt alongside the transition
2629
+ // (approve → low, request_changes → medium by default).
2630
+ risk: riskLevelSchema.optional(),
2631
+ requestingUserId: z4.string().optional()
2550
2632
  });
2551
- var PostToProjectTaskChatRequestSchema = z3.object({
2552
- projectId: z3.string(),
2553
- taskId: z3.string(),
2554
- content: z3.string(),
2555
- requestingUserId: z3.string().optional()
2633
+ var MoveProjectCardRequestSchema = z4.object({
2634
+ projectId: z4.string(),
2635
+ taskId: z4.string(),
2636
+ destinationProjectId: z4.string(),
2637
+ requestingUserId: z4.string().optional()
2556
2638
  });
2557
- var GetProjectTaskCliRequestSchema = z3.object({
2558
- projectId: z3.string(),
2559
- taskId: z3.string(),
2560
- limit: z3.number().int().positive().optional().default(50),
2561
- source: z3.string().optional()
2639
+ var PostToProjectTaskChatRequestSchema = z4.object({
2640
+ projectId: z4.string(),
2641
+ taskId: z4.string(),
2642
+ content: z4.string(),
2643
+ requestingUserId: z4.string().optional()
2562
2644
  });
2563
- var GetProjectTaskSessionsRequestSchema = z3.object({
2564
- projectId: z3.string(),
2565
- taskId: z3.string()
2645
+ var GetProjectTaskCliRequestSchema = z4.object({
2646
+ projectId: z4.string(),
2647
+ taskId: z4.string(),
2648
+ limit: z4.number().int().positive().optional().default(50),
2649
+ source: z4.string().optional()
2566
2650
  });
2567
- var QueryProjectGcpLogsRequestSchema = z3.object({
2568
- projectId: z3.string(),
2569
- env: z3.enum(["prod", "dev", "claudespace"]).optional(),
2570
- severity: z3.enum(["DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "CRITICAL", "ALERT", "EMERGENCY"]).optional(),
2571
- services: z3.array(z3.string().min(1).max(200)).max(25).optional(),
2572
- sqlInstances: z3.array(z3.string().min(1).max(200)).max(25).optional(),
2573
- allServices: z3.boolean().optional(),
2574
- search: z3.string().max(256).optional(),
2575
- filter: z3.string().max(1e3).optional(),
2576
- startTime: z3.string().optional(),
2577
- endTime: z3.string().optional(),
2578
- limit: z3.number().int().min(1).max(200).optional().default(50),
2579
- pageToken: z3.string().max(4096).optional()
2580
- });
2581
- var StartProjectBuildRequestSchema = z3.object({
2582
- projectId: z3.string(),
2583
- taskId: z3.string(),
2584
- requestingUserId: z3.string().optional()
2651
+ var GetProjectTaskSessionsRequestSchema = z4.object({
2652
+ projectId: z4.string(),
2653
+ taskId: z4.string()
2585
2654
  });
2586
- var StopProjectBuildRequestSchema = z3.object({
2587
- projectId: z3.string(),
2588
- taskId: z3.string(),
2589
- requestingUserId: z3.string().optional()
2655
+ var QueryProjectGcpLogsRequestSchema = z4.object({
2656
+ projectId: z4.string(),
2657
+ env: z4.enum(["prod", "dev", "claudespace"]).optional(),
2658
+ severity: z4.enum(["DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "CRITICAL", "ALERT", "EMERGENCY"]).optional(),
2659
+ services: z4.array(z4.string().min(1).max(200)).max(25).optional(),
2660
+ sqlInstances: z4.array(z4.string().min(1).max(200)).max(25).optional(),
2661
+ allServices: z4.boolean().optional(),
2662
+ search: z4.string().max(256).optional(),
2663
+ filter: z4.string().max(1e3).optional(),
2664
+ startTime: z4.string().optional(),
2665
+ endTime: z4.string().optional(),
2666
+ limit: z4.number().int().min(1).max(200).optional().default(50),
2667
+ pageToken: z4.string().max(4096).optional()
2668
+ });
2669
+ var StartProjectBuildRequestSchema = z4.object({
2670
+ projectId: z4.string(),
2671
+ taskId: z4.string(),
2672
+ requestingUserId: z4.string().optional()
2590
2673
  });
2591
- var StartProjectWorkspaceRequestSchema = z3.object({
2592
- projectId: z3.string(),
2593
- requestingUserId: z3.string().optional()
2674
+ var StopProjectBuildRequestSchema = z4.object({
2675
+ projectId: z4.string(),
2676
+ taskId: z4.string(),
2677
+ requestingUserId: z4.string().optional()
2594
2678
  });
2595
- var StopProjectWorkspaceRequestSchema = z3.object({
2596
- projectId: z3.string(),
2597
- destroy: z3.boolean().optional(),
2598
- requestingUserId: z3.string().optional()
2679
+ var StartProjectWorkspaceRequestSchema = z4.object({
2680
+ projectId: z4.string(),
2681
+ requestingUserId: z4.string().optional()
2599
2682
  });
2600
- var ListMyLiveSessionsRequestSchema = z3.object({
2601
- projectId: z3.string(),
2683
+ var StopProjectWorkspaceRequestSchema = z4.object({
2684
+ projectId: z4.string(),
2685
+ destroy: z4.boolean().optional(),
2686
+ requestingUserId: z4.string().optional()
2687
+ });
2688
+ var ListMyLiveSessionsRequestSchema = z4.object({
2689
+ projectId: z4.string(),
2602
2690
  /** Admin-only: list another member's sessions instead of the caller's. */
2603
- targetUserId: z3.string().optional()
2691
+ targetUserId: z4.string().optional()
2604
2692
  });
2605
- var ListProjectSessionGroupsRequestSchema = z3.object({
2606
- projectId: z3.string()
2693
+ var ListProjectSessionGroupsRequestSchema = z4.object({
2694
+ projectId: z4.string()
2607
2695
  });
2608
- var GetProjectAvailableTuisRequestSchema = z3.object({
2609
- projectId: z3.string()
2696
+ var GetProjectAvailableTuisRequestSchema = z4.object({
2697
+ projectId: z4.string()
2610
2698
  });
2611
- var StartAdhocSessionRequestSchema = z3.object({
2612
- projectId: z3.string(),
2613
- label: z3.string().max(200).optional(),
2699
+ var StartAdhocSessionRequestSchema = z4.object({
2700
+ projectId: z4.string(),
2701
+ label: z4.string().max(200).optional(),
2614
2702
  /** Coding-agent key to launch under — validated pick-time (ownership + TUI availability) in the handler. */
2615
- codingAgentKeyId: z3.string().optional(),
2703
+ codingAgentKeyId: z4.string().optional(),
2704
+ /** Model override (Claude model id) — overrides the launch key's own model. */
2705
+ model: z4.string().max(200).optional(),
2616
2706
  /**
2617
2707
  * Session role. Constrained: other task-less modes fall through to the pm
2618
2708
  * runner in the pod entrypoint, and "review" would crash without a task.
2619
2709
  */
2620
- mode: z3.enum(["adhoc", "pm"]).optional(),
2710
+ mode: z4.enum(["adhoc", "pm"]).optional(),
2621
2711
  /** Base branch to check out (defaults to the project's dev branch). */
2622
- branch: z3.string().max(300).optional(),
2623
- requestingUserId: z3.string().optional()
2624
- });
2625
- var StopAdhocSessionRequestSchema = z3.object({
2626
- projectId: z3.string(),
2627
- workspaceId: z3.string(),
2628
- destroy: z3.boolean().optional(),
2629
- requestingUserId: z3.string().optional()
2630
- });
2631
- var ResumeAdhocSessionRequestSchema = z3.object({
2632
- projectId: z3.string(),
2633
- workspaceId: z3.string(),
2634
- requestingUserId: z3.string().optional()
2635
- });
2636
- var CreateProjectReleaseRequestSchema = z3.object({
2637
- projectId: z3.string(),
2638
- taskIds: z3.array(z3.string()).optional(),
2639
- requestingUserId: z3.string().optional()
2640
- });
2641
- var ApproveProjectMergePRRequestSchema = z3.object({
2642
- projectId: z3.string(),
2643
- childTaskId: z3.string(),
2644
- requestingUserId: z3.string().optional()
2712
+ branch: z4.string().max(300).optional(),
2713
+ requestingUserId: z4.string().optional()
2645
2714
  });
2646
- var ListProjectSubtasksRequestSchema = z3.object({
2647
- projectId: z3.string(),
2648
- taskId: z3.string()
2715
+ var StopAdhocSessionRequestSchema = z4.object({
2716
+ projectId: z4.string(),
2717
+ workspaceId: z4.string(),
2718
+ destroy: z4.boolean().optional(),
2719
+ requestingUserId: z4.string().optional()
2649
2720
  });
2650
- var CreateProjectSubtaskRequestSchema = z3.object({
2651
- projectId: z3.string(),
2652
- parentTaskId: z3.string(),
2653
- title: z3.string().min(1),
2654
- description: z3.string().optional(),
2655
- plan: z3.string().optional(),
2656
- ordinal: z3.number().int().nonnegative().optional(),
2657
- storyPointValue: z3.number().int().positive().optional(),
2658
- followParentStatus: z3.boolean().optional(),
2721
+ var ResumeAdhocSessionRequestSchema = z4.object({
2722
+ projectId: z4.string(),
2723
+ workspaceId: z4.string(),
2724
+ requestingUserId: z4.string().optional()
2725
+ });
2726
+ var CreateProjectReleaseRequestSchema = z4.object({
2727
+ projectId: z4.string(),
2728
+ taskIds: z4.array(z4.string()).optional(),
2729
+ requestingUserId: z4.string().optional()
2730
+ });
2731
+ var ApproveProjectMergePRRequestSchema = z4.object({
2732
+ projectId: z4.string(),
2733
+ childTaskId: z4.string(),
2734
+ requestingUserId: z4.string().optional()
2735
+ });
2736
+ var ListProjectSubtasksRequestSchema = z4.object({
2737
+ projectId: z4.string(),
2738
+ taskId: z4.string()
2739
+ });
2740
+ var CreateProjectSubtaskRequestSchema = z4.object({
2741
+ projectId: z4.string(),
2742
+ parentTaskId: z4.string(),
2743
+ title: z4.string().min(1),
2744
+ description: z4.string().optional(),
2745
+ plan: z4.string().optional(),
2746
+ ordinal: z4.number().int().nonnegative().optional(),
2747
+ storyPointValue: z4.number().int().positive().optional(),
2748
+ followParentStatus: z4.boolean().optional(),
2659
2749
  /** Sibling subtask ids or slugs this subtask blocks on (explicit dependency
2660
2750
  * metadata — preferred over encoding order in plan text / ordinal). */
2661
- dependsOn: z3.array(z3.string().min(1)).max(32).optional(),
2662
- requestingUserId: z3.string().optional()
2751
+ dependsOn: z4.array(z4.string().min(1)).max(32).optional(),
2752
+ requestingUserId: z4.string().optional()
2663
2753
  });
2664
- var UpdateProjectSubtaskRequestSchema = z3.object({
2665
- projectId: z3.string(),
2666
- subtaskId: z3.string(),
2667
- title: z3.string().optional(),
2668
- description: z3.string().optional(),
2669
- plan: z3.string().optional(),
2670
- status: z3.string().optional(),
2671
- ordinal: z3.number().int().nonnegative().optional(),
2672
- storyPointValue: z3.number().int().positive().optional(),
2673
- followParentStatus: z3.boolean().optional(),
2674
- requestingUserId: z3.string().optional()
2754
+ var UpdateProjectSubtaskRequestSchema = z4.object({
2755
+ projectId: z4.string(),
2756
+ subtaskId: z4.string(),
2757
+ title: z4.string().optional(),
2758
+ description: z4.string().optional(),
2759
+ plan: z4.string().optional(),
2760
+ status: z4.string().optional(),
2761
+ ordinal: z4.number().int().nonnegative().optional(),
2762
+ storyPointValue: z4.number().int().positive().optional(),
2763
+ followParentStatus: z4.boolean().optional(),
2764
+ requestingUserId: z4.string().optional()
2675
2765
  });
2676
- var DeleteProjectSubtaskRequestSchema = z3.object({
2677
- projectId: z3.string(),
2678
- subtaskId: z3.string(),
2679
- requestingUserId: z3.string().optional()
2766
+ var DeleteProjectSubtaskRequestSchema = z4.object({
2767
+ projectId: z4.string(),
2768
+ subtaskId: z4.string(),
2769
+ requestingUserId: z4.string().optional()
2680
2770
  });
2681
- var GetProjectTaskChatRequestSchema = z3.object({
2682
- projectId: z3.string(),
2683
- taskId: z3.string(),
2684
- limit: z3.number().int().positive().optional().default(20)
2771
+ var GetProjectTaskChatRequestSchema = z4.object({
2772
+ projectId: z4.string(),
2773
+ taskId: z4.string(),
2774
+ limit: z4.number().int().positive().optional().default(20)
2685
2775
  });
2686
- var AddProjectTaskDependencyRequestSchema = z3.object({
2687
- projectId: z3.string(),
2688
- taskId: z3.string(),
2689
- dependsOnSlugOrId: z3.string(),
2690
- requestingUserId: z3.string().optional()
2776
+ var AddProjectTaskDependencyRequestSchema = z4.object({
2777
+ projectId: z4.string(),
2778
+ taskId: z4.string(),
2779
+ dependsOnSlugOrId: z4.string(),
2780
+ requestingUserId: z4.string().optional()
2691
2781
  });
2692
- var RemoveProjectTaskDependencyRequestSchema = z3.object({
2693
- projectId: z3.string(),
2694
- taskId: z3.string(),
2695
- dependsOnSlugOrId: z3.string(),
2696
- requestingUserId: z3.string().optional()
2782
+ var RemoveProjectTaskDependencyRequestSchema = z4.object({
2783
+ projectId: z4.string(),
2784
+ taskId: z4.string(),
2785
+ dependsOnSlugOrId: z4.string(),
2786
+ requestingUserId: z4.string().optional()
2697
2787
  });
2698
- var VoteProjectSuggestionRequestSchema = z3.object({
2699
- projectId: z3.string(),
2700
- suggestionId: z3.string(),
2701
- value: z3.union([z3.literal(1), z3.literal(-1)]),
2702
- requestingUserId: z3.string().optional()
2788
+ var VoteProjectSuggestionRequestSchema = z4.object({
2789
+ projectId: z4.string(),
2790
+ suggestionId: z4.string(),
2791
+ value: z4.union([z4.literal(1), z4.literal(-1)]),
2792
+ requestingUserId: z4.string().optional()
2703
2793
  });
2704
- var GetProjectTaskDependenciesRequestSchema = z3.object({
2705
- projectId: z3.string(),
2706
- taskId: z3.string()
2794
+ var GetProjectTaskDependenciesRequestSchema = z4.object({
2795
+ projectId: z4.string(),
2796
+ taskId: z4.string()
2707
2797
  });
2708
- var ListProjectTaskFilesRequestSchema = z3.object({
2709
- projectId: z3.string(),
2710
- taskId: z3.string()
2798
+ var ListProjectTaskFilesRequestSchema = z4.object({
2799
+ projectId: z4.string(),
2800
+ taskId: z4.string()
2711
2801
  });
2712
- var GetProjectAttachmentRequestSchema = z3.object({
2713
- projectId: z3.string(),
2714
- taskId: z3.string(),
2715
- fileId: z3.string(),
2802
+ var GetProjectAttachmentRequestSchema = z4.object({
2803
+ projectId: z4.string(),
2804
+ taskId: z4.string(),
2805
+ fileId: z4.string(),
2716
2806
  /** Byte offset into text content (paging large logs/JSON). Default 0. */
2717
- offset: z3.number().int().nonnegative().optional(),
2807
+ offset: z4.number().int().nonnegative().optional(),
2718
2808
  /** Max bytes of text content to return from `offset`. Server default applies. */
2719
- maxBytes: z3.number().int().positive().optional()
2809
+ maxBytes: z4.number().int().positive().optional()
2720
2810
  });
2721
- var RequestProjectFileUploadRequestSchema = z3.object({
2722
- projectId: z3.string(),
2723
- taskId: z3.string(),
2724
- fileName: z3.string().min(1).max(255),
2725
- mimeType: z3.string().min(1).max(128),
2726
- fileSize: z3.number().int().positive().max(MAX_FILE_SIZE_BYTES),
2727
- requestingUserId: z3.string().optional()
2811
+ var RequestProjectFileUploadRequestSchema = z4.object({
2812
+ projectId: z4.string(),
2813
+ taskId: z4.string(),
2814
+ fileName: z4.string().min(1).max(255),
2815
+ mimeType: z4.string().min(1).max(128),
2816
+ fileSize: z4.number().int().positive().max(MAX_FILE_SIZE_BYTES),
2817
+ requestingUserId: z4.string().optional()
2728
2818
  });
2729
- var ConfirmProjectFileUploadRequestSchema = z3.object({
2730
- projectId: z3.string(),
2731
- taskId: z3.string(),
2732
- fileId: z3.string(),
2819
+ var ConfirmProjectFileUploadRequestSchema = z4.object({
2820
+ projectId: z4.string(),
2821
+ taskId: z4.string(),
2822
+ fileId: z4.string(),
2733
2823
  /** When set, the attachment is also posted to the task chat with this text. */
2734
- comment: z3.string().max(2e3).optional(),
2735
- requestingUserId: z3.string().optional()
2736
- });
2737
- var CreateProjectPullRequestRequestSchema = z3.object({
2738
- projectId: z3.string(),
2739
- taskId: z3.string(),
2740
- title: z3.string().min(1),
2741
- body: z3.string(),
2742
- head: z3.string().optional(),
2743
- base: z3.string().optional(),
2744
- requestingUserId: z3.string().optional()
2745
- });
2746
- var ListProjectMembersRequestSchema = z3.object({
2747
- projectId: z3.string()
2748
- });
2749
- var AddProjectTaskReviewerRequestSchema = z3.object({
2750
- projectId: z3.string(),
2751
- taskId: z3.string(),
2752
- userId: z3.string(),
2753
- requestingUserId: z3.string().optional()
2754
- });
2755
- var RemoveProjectTaskReviewerRequestSchema = z3.object({
2756
- projectId: z3.string(),
2757
- taskId: z3.string(),
2758
- userId: z3.string(),
2759
- requestingUserId: z3.string().optional()
2760
- });
2761
- var ListProjectManualTestsRequestSchema = z3.object({
2762
- projectId: z3.string(),
2763
- taskId: z3.string()
2764
- });
2765
- var QueryProjectManualTestsRequestSchema = z3.object({
2766
- projectId: z3.string(),
2767
- cardStatuses: z3.array(z3.string()).optional(),
2768
- testStatuses: z3.array(z3.enum(["open", "approved", "rejected"])).optional()
2824
+ comment: z4.string().max(2e3).optional(),
2825
+ requestingUserId: z4.string().optional()
2769
2826
  });
2770
- var SetProjectManualTestsRequestSchema = z3.object({
2771
- projectId: z3.string(),
2772
- taskId: z3.string(),
2773
- items: z3.array(z3.object({ title: z3.string().min(1) })).min(1),
2774
- requestingUserId: z3.string().optional()
2827
+ var CreateProjectPullRequestRequestSchema = z4.object({
2828
+ projectId: z4.string(),
2829
+ taskId: z4.string(),
2830
+ title: z4.string().min(1),
2831
+ body: z4.string(),
2832
+ head: z4.string().optional(),
2833
+ base: z4.string().optional(),
2834
+ requestingUserId: z4.string().optional()
2775
2835
  });
2776
- var EditProjectManualTestRequestSchema = z3.object({
2777
- projectId: z3.string(),
2778
- taskId: z3.string(),
2779
- title: z3.string().min(1),
2780
- newTitle: z3.string().min(1),
2781
- requestingUserId: z3.string().optional()
2836
+ var ListProjectMembersRequestSchema = z4.object({
2837
+ projectId: z4.string()
2782
2838
  });
2783
- var RemoveProjectManualTestRequestSchema = z3.object({
2784
- projectId: z3.string(),
2785
- taskId: z3.string(),
2786
- title: z3.string().min(1),
2787
- requestingUserId: z3.string().optional()
2839
+ var AddProjectTaskReviewerRequestSchema = z4.object({
2840
+ projectId: z4.string(),
2841
+ taskId: z4.string(),
2842
+ userId: z4.string(),
2843
+ requestingUserId: z4.string().optional()
2788
2844
  });
2789
- var ApproveProjectManualTestRequestSchema = z3.object({
2790
- projectId: z3.string(),
2791
- taskId: z3.string(),
2792
- title: z3.string().min(1),
2793
- requestingUserId: z3.string().optional()
2845
+ var RemoveProjectTaskReviewerRequestSchema = z4.object({
2846
+ projectId: z4.string(),
2847
+ taskId: z4.string(),
2848
+ userId: z4.string(),
2849
+ requestingUserId: z4.string().optional()
2794
2850
  });
2795
- var RejectProjectManualTestRequestSchema = z3.object({
2796
- projectId: z3.string(),
2797
- taskId: z3.string(),
2798
- title: z3.string().min(1),
2799
- reason: z3.string().min(1).max(2e3),
2800
- requestingUserId: z3.string().optional()
2851
+ var ListProjectManualTestsRequestSchema = z4.object({
2852
+ projectId: z4.string(),
2853
+ taskId: z4.string()
2801
2854
  });
2802
- var CreateProjectSuggestionRequestSchema = z3.object({
2803
- projectId: z3.string(),
2804
- title: z3.string().min(1),
2805
- description: z3.string().optional(),
2806
- tagNames: z3.array(z3.string()).optional(),
2807
- requestingUserId: z3.string().optional()
2855
+ var QueryProjectManualTestsRequestSchema = z4.object({
2856
+ projectId: z4.string(),
2857
+ cardStatuses: z4.array(z4.string()).optional(),
2858
+ testStatuses: z4.array(z4.enum(["open", "approved", "rejected"])).optional()
2808
2859
  });
2809
- var ProjectTagContextPathSchema = z4.object({
2810
- type: z4.enum(["rule", "doc", "file", "folder"]),
2811
- path: z4.string().min(1).max(500),
2812
- label: z4.string().max(100).optional()
2860
+ var SetProjectManualTestsRequestSchema = z4.object({
2861
+ projectId: z4.string(),
2862
+ taskId: z4.string(),
2863
+ items: z4.array(z4.object({ title: z4.string().min(1) })).min(1),
2864
+ requestingUserId: z4.string().optional()
2813
2865
  });
2814
- var hexColor = z4.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected #RRGGBB hex color");
2815
- var CreateProjectTagRequestSchema = z4.object({
2866
+ var EditProjectManualTestRequestSchema = z4.object({
2816
2867
  projectId: z4.string(),
2817
- name: z4.string().min(1).max(50),
2818
- color: hexColor.optional(),
2819
- description: z4.string().max(500).optional(),
2820
- contextPaths: z4.array(ProjectTagContextPathSchema).max(20).optional(),
2868
+ taskId: z4.string(),
2869
+ title: z4.string().min(1),
2870
+ newTitle: z4.string().min(1),
2821
2871
  requestingUserId: z4.string().optional()
2822
2872
  });
2823
- var UpdateProjectTagRequestSchema = z4.object({
2873
+ var RemoveProjectManualTestRequestSchema = z4.object({
2824
2874
  projectId: z4.string(),
2825
- tagId: z4.string(),
2826
- name: z4.string().min(1).max(50).optional(),
2827
- color: hexColor.optional(),
2828
- description: z4.string().max(500).optional(),
2829
- /** Full replacement of the tag's context links when provided. */
2830
- contextPaths: z4.array(ProjectTagContextPathSchema).max(20).optional(),
2875
+ taskId: z4.string(),
2876
+ title: z4.string().min(1),
2831
2877
  requestingUserId: z4.string().optional()
2832
2878
  });
2833
- var PostToProjectChatRequestSchema = z4.object({
2879
+ var ApproveProjectManualTestRequestSchema = z4.object({
2834
2880
  projectId: z4.string(),
2835
- content: z4.string().min(1).max(2e4),
2836
- requestingUserId: z4.string().optional(),
2837
- /** Marks the post so the server can persist it beyond chat (tag-audit summaries land in tag history). */
2838
- kind: z4.enum(["tag_audit_summary"]).optional()
2881
+ taskId: z4.string(),
2882
+ title: z4.string().min(1),
2883
+ requestingUserId: z4.string().optional()
2839
2884
  });
2840
- var StartTagAuditRequestSchema = z4.object({
2885
+ var RejectProjectManualTestRequestSchema = z4.object({
2841
2886
  projectId: z4.string(),
2887
+ taskId: z4.string(),
2888
+ title: z4.string().min(1),
2889
+ reason: z4.string().min(1).max(2e3),
2842
2890
  requestingUserId: z4.string().optional()
2843
2891
  });
2844
- var StartTaskAuditRequestSchema = z4.object({
2892
+ var CreateProjectSuggestionRequestSchema = z4.object({
2845
2893
  projectId: z4.string(),
2846
- taskIds: z4.array(z4.string()).min(1).max(20),
2894
+ title: z4.string().min(1),
2895
+ description: z4.string().optional(),
2896
+ tagNames: z4.array(z4.string()).optional(),
2847
2897
  requestingUserId: z4.string().optional()
2848
2898
  });
2849
- var GetActiveAuditSessionsRequestSchema = z4.object({
2850
- projectId: z4.string()
2899
+ var ProjectTagContextPathSchema = z5.object({
2900
+ type: z5.enum(["rule", "doc", "file", "folder"]),
2901
+ path: z5.string().min(1).max(500),
2902
+ label: z5.string().max(100).optional()
2851
2903
  });
2852
- var ReportTaskAuditResultRequestSchema = z4.object({
2853
- projectId: z4.string(),
2854
- taskId: z4.string(),
2855
- summary: z4.string(),
2856
- turnGrades: z4.array(
2857
- z4.object({
2858
- turnIndex: z4.number(),
2859
- phase: z4.enum(["planning", "building", "human"]),
2860
- grade: z4.enum(["correct", "neutral", "blunder"]),
2861
- reasoning: z4.string(),
2862
- eventType: z4.string(),
2863
- eventSummary: z4.string()
2904
+ var hexColor = z5.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected #RRGGBB hex color");
2905
+ var CreateProjectTagRequestSchema = z5.object({
2906
+ projectId: z5.string(),
2907
+ name: z5.string().min(1).max(50),
2908
+ color: hexColor.optional(),
2909
+ description: z5.string().max(500).optional(),
2910
+ contextPaths: z5.array(ProjectTagContextPathSchema).max(20).optional(),
2911
+ requestingUserId: z5.string().optional()
2912
+ });
2913
+ var UpdateProjectTagRequestSchema = z5.object({
2914
+ projectId: z5.string(),
2915
+ tagId: z5.string(),
2916
+ name: z5.string().min(1).max(50).optional(),
2917
+ color: hexColor.optional(),
2918
+ description: z5.string().max(500).optional(),
2919
+ /** Full replacement of the tag's context links when provided. */
2920
+ contextPaths: z5.array(ProjectTagContextPathSchema).max(20).optional(),
2921
+ requestingUserId: z5.string().optional()
2922
+ });
2923
+ var PostToProjectChatRequestSchema = z5.object({
2924
+ projectId: z5.string(),
2925
+ content: z5.string().min(1).max(2e4),
2926
+ requestingUserId: z5.string().optional(),
2927
+ /** Marks the post so the server can persist it beyond chat (tag-audit summaries land in tag history). */
2928
+ kind: z5.enum(["tag_audit_summary"]).optional()
2929
+ });
2930
+ var StartTagAuditRequestSchema = z5.object({
2931
+ projectId: z5.string(),
2932
+ requestingUserId: z5.string().optional()
2933
+ });
2934
+ var StartTaskAuditRequestSchema = z5.object({
2935
+ projectId: z5.string(),
2936
+ taskIds: z5.array(z5.string()).min(1).max(20),
2937
+ requestingUserId: z5.string().optional()
2938
+ });
2939
+ var GetActiveAuditSessionsRequestSchema = z5.object({
2940
+ projectId: z5.string()
2941
+ });
2942
+ var ReportTaskAuditResultRequestSchema = z5.object({
2943
+ projectId: z5.string(),
2944
+ taskId: z5.string(),
2945
+ summary: z5.string(),
2946
+ turnGrades: z5.array(
2947
+ z5.object({
2948
+ turnIndex: z5.number(),
2949
+ phase: z5.enum(["planning", "building", "human"]),
2950
+ grade: z5.enum(["correct", "neutral", "blunder"]),
2951
+ reasoning: z5.string(),
2952
+ eventType: z5.string(),
2953
+ eventSummary: z5.string()
2864
2954
  })
2865
2955
  ),
2866
- planningAccuracy: z4.number().nullable(),
2867
- buildingAccuracy: z4.number().nullable(),
2868
- humanAccuracy: z4.number().nullable(),
2869
- planningCorrect: z4.number(),
2870
- planningNeutral: z4.number(),
2871
- planningBlunder: z4.number(),
2872
- buildingCorrect: z4.number(),
2873
- buildingNeutral: z4.number(),
2874
- buildingBlunder: z4.number(),
2875
- humanCorrect: z4.number(),
2876
- humanNeutral: z4.number(),
2877
- humanBlunder: z4.number(),
2878
- humanEvaluations: z4.array(
2879
- z4.object({
2880
- messageIndex: z4.number(),
2881
- rating: z4.union([z4.literal(-1), z4.literal(0), z4.literal(1)]),
2882
- reasoning: z4.string()
2956
+ planningAccuracy: z5.number().nullable(),
2957
+ buildingAccuracy: z5.number().nullable(),
2958
+ humanAccuracy: z5.number().nullable(),
2959
+ planningCorrect: z5.number(),
2960
+ planningNeutral: z5.number(),
2961
+ planningBlunder: z5.number(),
2962
+ buildingCorrect: z5.number(),
2963
+ buildingNeutral: z5.number(),
2964
+ buildingBlunder: z5.number(),
2965
+ humanCorrect: z5.number(),
2966
+ humanNeutral: z5.number(),
2967
+ humanBlunder: z5.number(),
2968
+ humanEvaluations: z5.array(
2969
+ z5.object({
2970
+ messageIndex: z5.number(),
2971
+ rating: z5.union([z5.literal(-1), z5.literal(0), z5.literal(1)]),
2972
+ reasoning: z5.string()
2883
2973
  })
2884
2974
  ).optional(),
2885
- suggestionIds: z4.array(z4.string()),
2886
- auditCostUsd: z4.number().nullable(),
2887
- model: z4.string().nullable(),
2975
+ suggestionIds: z5.array(z5.string()),
2976
+ auditCostUsd: z5.number().nullable(),
2977
+ model: z5.string().nullable(),
2888
2978
  /** When set, the audit is marked failed with this message instead. */
2889
- error: z4.string().optional()
2979
+ error: z5.string().optional()
2890
2980
  });
2891
- var GetTaskAuditsRequestSchema = z4.object({
2892
- projectId: z4.string(),
2893
- limit: z4.number().int().positive().max(200).optional().default(50)
2981
+ var GetTaskAuditsRequestSchema = z5.object({
2982
+ projectId: z5.string(),
2983
+ limit: z5.number().int().positive().max(200).optional().default(50)
2894
2984
  });
2895
- var GetTaskAuditRequestSchema = z4.object({
2896
- projectId: z4.string(),
2897
- auditId: z4.string()
2985
+ var GetTaskAuditRequestSchema = z5.object({
2986
+ projectId: z5.string(),
2987
+ auditId: z5.string()
2898
2988
  });
2899
- var GetTaskAuditAggregatesRequestSchema = z4.object({
2900
- projectId: z4.string()
2989
+ var GetTaskAuditAggregatesRequestSchema = z5.object({
2990
+ projectId: z5.string()
2901
2991
  });
2902
- var DeleteTaskAuditRequestSchema = z4.object({
2903
- projectId: z4.string(),
2904
- auditId: z4.string(),
2905
- requestingUserId: z4.string().optional()
2992
+ var DeleteTaskAuditRequestSchema = z5.object({
2993
+ projectId: z5.string(),
2994
+ auditId: z5.string(),
2995
+ requestingUserId: z5.string().optional()
2906
2996
  });
2907
- var MarkInitialPromptSubmittedRequestSchema = z4.object({
2908
- sessionId: z4.string()
2997
+ var MarkInitialPromptSubmittedRequestSchema = z5.object({
2998
+ sessionId: z5.string()
2909
2999
  });
2910
3000
  var AGENT_STATUS_REASON_USER_QUESTION = "user_question";
2911
3001
  var TASK_CHAT_HISTORY_LIMIT = 20;
@@ -4064,7 +4154,7 @@ var PtyOutputCoalescer = class {
4064
4154
 
4065
4155
  // src/harness/pty/tool-server.ts
4066
4156
  import { createServer as createServer2 } from "http";
4067
- import { z as z5 } from "zod";
4157
+ import { z as z6 } from "zod";
4068
4158
  import { writeFile as writeFile3 } from "fs/promises";
4069
4159
  import { join as join2 } from "path";
4070
4160
  import { randomBytes } from "crypto";
@@ -4121,7 +4211,7 @@ var PtyToolServer = class {
4121
4211
  const mcp = new McpServer({ name: this.name, version: "1.0.0" });
4122
4212
  const register = mcp.registerTool.bind(mcp);
4123
4213
  for (const tool2 of this.tools) {
4124
- const inputSchema = tool2.strict ? z5.strictObject(tool2.schema) : tool2.schema;
4214
+ const inputSchema = tool2.strict ? z6.strictObject(tool2.schema) : tool2.schema;
4125
4215
  register(
4126
4216
  tool2.name,
4127
4217
  {
@@ -6086,7 +6176,7 @@ function formatEntry(entry) {
6086
6176
  const suffix = entry.summary ? ` \u2014 ${entry.summary}` : "";
6087
6177
  return `- \`${entry.path}\`${suffix}`;
6088
6178
  }
6089
- function formatResolvedTags(resolved) {
6179
+ function formatResolvedTags(resolved, subProject) {
6090
6180
  const parts = [
6091
6181
  `
6092
6182
  ## Reference Guides (load on demand)`,
@@ -6101,50 +6191,69 @@ function formatResolvedTags(resolved) {
6101
6191
  parts.push(formatEntry(entry));
6102
6192
  }
6103
6193
  }
6194
+ if (subProject && subProject.entries.length > 0) {
6195
+ parts.push(`
6196
+ ### Sub-project: "${subProject.name}"`);
6197
+ for (const entry of subProject.entries) {
6198
+ parts.push(formatEntry(entry));
6199
+ }
6200
+ }
6104
6201
  return parts.join("\n");
6105
6202
  }
6106
- async function resolveTagContext(projectTags, taskTagIds, _model, _betas, _runnerMode) {
6107
- if (!projectTags?.length || !taskTagIds.length) {
6108
- return { injectedSection: "", stats: { injected: 0, skipped: 0 } };
6109
- }
6110
- const taskTagIdSet = new Set(taskTagIds);
6111
- const assignedTags = projectTags.filter((t) => taskTagIdSet.has(t.id));
6112
- if (assignedTags.length === 0) {
6113
- return { injectedSection: "", stats: { injected: 0, skipped: 0 } };
6203
+ async function resolveEntries(contextPaths) {
6204
+ if (!contextPaths?.length) return [];
6205
+ const sorted = [...contextPaths].sort(
6206
+ (a, b) => (TYPE_PRIORITY[a.type] ?? 99) - (TYPE_PRIORITY[b.type] ?? 99)
6207
+ );
6208
+ const results = [];
6209
+ for (const entry of sorted) {
6210
+ results.push(await resolveEntry(entry));
6114
6211
  }
6115
- const allEntries = [];
6116
- for (let i = 0; i < assignedTags.length; i++) {
6117
- const tag = assignedTags[i];
6118
- if (!tag.contextPaths?.length) continue;
6119
- const sorted = [...tag.contextPaths].sort(
6120
- (a, b) => (TYPE_PRIORITY[a.type] ?? 99) - (TYPE_PRIORITY[b.type] ?? 99)
6121
- );
6122
- for (const entry of sorted) {
6123
- allEntries.push({ tagIndex: i, entry });
6124
- }
6212
+ return results;
6213
+ }
6214
+ function countResolved(entries) {
6215
+ const injected = entries.filter((e) => e.summary !== null).length;
6216
+ return { injected, skipped: entries.length - injected };
6217
+ }
6218
+ async function resolveAssignedTags(assignedTags) {
6219
+ const resolved = [];
6220
+ let injected = 0;
6221
+ let skipped = 0;
6222
+ for (const tag of assignedTags) {
6223
+ const entries = await resolveEntries(tag.contextPaths);
6224
+ const counts = countResolved(entries);
6225
+ injected += counts.injected;
6226
+ skipped += counts.skipped;
6227
+ resolved.push({ tagName: tag.name, description: tag.description, entries });
6125
6228
  }
6126
- if (allEntries.length === 0) {
6229
+ return { resolved, injected, skipped };
6230
+ }
6231
+ async function resolveTagContext(projectTags, taskTagIds, _model, _betas, _runnerMode, subProject) {
6232
+ const taskTagIdSet = new Set(taskTagIds);
6233
+ const assignedTags = (projectTags ?? []).filter((t) => taskTagIdSet.has(t.id));
6234
+ const hasTagPaths = assignedTags.some((t) => t.contextPaths?.length);
6235
+ const hasSubProjectPaths = (subProject?.contextPaths?.length ?? 0) > 0;
6236
+ if (!hasTagPaths && !hasSubProjectPaths) {
6127
6237
  return { injectedSection: "", stats: { injected: 0, skipped: 0 } };
6128
6238
  }
6129
- let injected = 0;
6130
- let skipped = 0;
6131
- const resolved = assignedTags.map((t) => ({
6132
- tagName: t.name,
6133
- description: t.description,
6134
- entries: []
6135
- }));
6136
- for (const { tagIndex, entry } of allEntries) {
6137
- const result = await resolveEntry(entry);
6138
- resolved[tagIndex].entries.push(result);
6139
- if (result.summary === null) {
6140
- skipped++;
6141
- } else {
6142
- injected++;
6143
- }
6239
+ const {
6240
+ resolved,
6241
+ injected: tagInjected,
6242
+ skipped: tagSkipped
6243
+ } = await resolveAssignedTags(assignedTags);
6244
+ let subProjectResolved = null;
6245
+ let subInjected = 0;
6246
+ let subSkipped = 0;
6247
+ if (subProject && hasSubProjectPaths) {
6248
+ const entries = await resolveEntries(subProject.contextPaths);
6249
+ const counts = countResolved(entries);
6250
+ subInjected = counts.injected;
6251
+ subSkipped = counts.skipped;
6252
+ subProjectResolved = { name: subProject.name, entries };
6144
6253
  }
6145
6254
  return {
6146
- injectedSection: formatResolvedTags(resolved),
6147
- stats: { injected, skipped }
6255
+ injectedSection: formatResolvedTags(resolved, subProjectResolved),
6256
+ stats: { injected: tagInjected + subInjected, skipped: tagSkipped + subSkipped }
6148
6257
  };
6149
6258
  }
6150
6259
 
@@ -6806,13 +6915,16 @@ Address the requested changes. Do NOT re-investigate the codebase from scratch o
6806
6915
  return parts.join("\n");
6807
6916
  }
6808
6917
  async function resolveTaskTagContext(context, runnerMode) {
6809
- if (!context.projectTags?.length || !context.taskTagIds?.length) return null;
6918
+ const hasTags = !!context.projectTags?.length && !!context.taskTagIds?.length;
6919
+ const hasSubProjectPaths = !!context.subProject?.contextPaths?.length;
6920
+ if (!hasTags && !hasSubProjectPaths) return null;
6810
6921
  const { injectedSection } = await resolveTagContext(
6811
6922
  context.projectTags,
6812
- context.taskTagIds,
6923
+ context.taskTagIds ?? [],
6813
6924
  context.model,
6814
6925
  context.agentSettings?.betas,
6815
- runnerMode
6926
+ runnerMode,
6927
+ context.subProject ?? null
6816
6928
  );
6817
6929
  return injectedSection || null;
6818
6930
  }
@@ -7104,7 +7216,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
7104
7216
  }
7105
7217
 
7106
7218
  // src/tools/task-context-tools.ts
7107
- import { z as z6 } from "zod";
7219
+ import { z as z7 } from "zod";
7108
7220
 
7109
7221
  // src/tools/helpers.ts
7110
7222
  function textResult(text) {
@@ -7138,8 +7250,8 @@ function buildReadTaskChatTool(connection) {
7138
7250
  "read_task_chat",
7139
7251
  "Read recent human/user chat messages for a task. Omit task_id for the current task; pass a child ID for a child's chat. For agent logs use get_execution_logs.",
7140
7252
  {
7141
- limit: z6.number().optional().describe("Number of recent messages to fetch (default 20)"),
7142
- task_id: z6.string().optional().describe("Child task ID to read chat from. Omit to read the current task's chat.")
7253
+ limit: z7.number().optional().describe("Number of recent messages to fetch (default 20)"),
7254
+ task_id: z7.string().optional().describe("Child task ID to read chat from. Omit to read the current task's chat.")
7143
7255
  },
7144
7256
  async ({ limit, task_id }) => {
7145
7257
  try {
@@ -7183,7 +7295,7 @@ function buildGetTaskTool(connection) {
7183
7295
  "get_task",
7184
7296
  "Look up any task by slug or ID. Returns JSON with id, slug, title, description, plan, status, branch, githubPRNumber, githubPRUrl, storyPoints. For children use list_subtasks.",
7185
7297
  {
7186
- slug_or_id: z6.string().describe("The task slug (e.g. 'my-task') or CUID")
7298
+ slug_or_id: z7.string().describe("The task slug (e.g. 'my-task') or CUID")
7187
7299
  },
7188
7300
  async ({ slug_or_id }) => {
7189
7301
  try {
@@ -7206,9 +7318,9 @@ function buildGetExecutionLogsTool(connection) {
7206
7318
  "get_execution_logs",
7207
7319
  "Read CLI execution logs \u2014 agent reasoning, tool calls, and setup/dev-server output. Filter via source='agent' or 'application'. For human chat use read_task_chat.",
7208
7320
  {
7209
- task_id: z6.string().optional().describe("Task ID or slug. Omit to read logs from the current task."),
7210
- source: z6.enum(["agent", "application"]).optional().describe("Filter by log source. Omit for all logs."),
7211
- limit: z6.number().optional().describe("Max number of log entries to return (default 50, max 500).")
7321
+ task_id: z7.string().optional().describe("Task ID or slug. Omit to read logs from the current task."),
7322
+ source: z7.enum(["agent", "application"]).optional().describe("Filter by log source. Omit for all logs."),
7323
+ limit: z7.number().optional().describe("Max number of log entries to return (default 50, max 500).")
7212
7324
  },
7213
7325
  async ({ task_id, source, limit }) => {
7214
7326
  try {
@@ -7268,7 +7380,7 @@ function buildGetAttachmentTool(connection) {
7268
7380
  return defineTool(
7269
7381
  "get_attachment",
7270
7382
  "Fetch one task file's content plus metadata by file ID. Call list_task_files first to discover IDs and check sizes \u2014 large binaries may be truncated by the service's size limit.",
7271
- { fileId: z6.string().describe("The file ID to retrieve") },
7383
+ { fileId: z7.string().describe("The file ID to retrieve") },
7272
7384
  async ({ fileId }) => {
7273
7385
  try {
7274
7386
  const file = await connection.call("getTaskFile", {
@@ -7306,7 +7418,7 @@ function buildTaskContextTools(connection) {
7306
7418
  }
7307
7419
 
7308
7420
  // src/tools/dependency-suggestion-tools.ts
7309
- import { z as z7 } from "zod";
7421
+ import { z as z8 } from "zod";
7310
7422
  function buildGetDependenciesTool(connection) {
7311
7423
  return defineTool(
7312
7424
  "get_dependencies",
@@ -7332,10 +7444,10 @@ function buildGetSuggestionsTool(connection) {
7332
7444
  "get_suggestions",
7333
7445
  "List project suggestions sorted by vote score. Filter by status or cap with limit (default 20). Suggestions are project-level ideas, not tasks \u2014 use get_task for tasks.",
7334
7446
  {
7335
- status: z7.string().optional().describe(
7447
+ status: z8.string().optional().describe(
7336
7448
  "Filter by status: Planning, Open, InProgress, ReviewPR, ReviewDev, ReviewLive, Complete, Cancelled"
7337
7449
  ),
7338
- limit: z7.number().int().min(1).max(100).optional().describe("Max results (default 20)")
7450
+ limit: z8.number().int().min(1).max(100).optional().describe("Max results (default 20)")
7339
7451
  },
7340
7452
  async ({ status, limit }) => {
7341
7453
  try {
@@ -7359,14 +7471,14 @@ function buildGetSuggestionsTool(connection) {
7359
7471
  }
7360
7472
 
7361
7473
  // src/tools/mutation-tools.ts
7362
- import { z as z8 } from "zod";
7474
+ import { z as z9 } from "zod";
7363
7475
  function buildPostToChatTool(connection) {
7364
7476
  return defineTool(
7365
7477
  "post_to_chat",
7366
7478
  "Post a message to the task chat for the team to see. Your turn output is NOT shown in chat, so this is the only way the team sees your status, summaries, and questions. Omit task_id to post to the current task's chat; pass a child's ID to message its chat.",
7367
7479
  {
7368
- message: z8.string().describe("The message to post to the team"),
7369
- task_id: z8.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
7480
+ message: z9.string().describe("The message to post to the team"),
7481
+ task_id: z9.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
7370
7482
  },
7371
7483
  async ({ message, task_id }) => {
7372
7484
  try {
@@ -7404,8 +7516,8 @@ function buildForceUpdateTaskStatusTool(connection) {
7404
7516
  "force_update_task_status",
7405
7517
  "EMERGENCY ONLY: force-override a task's Kanban status. Use when an automatic transition failed and the task is wedged. Normal flow transitions status automatically.",
7406
7518
  {
7407
- status: z8.enum(["InProgress", "ReviewPR", "ReviewDev", "Complete"]).describe("The new status for the task"),
7408
- task_id: z8.string().optional().describe("Child task ID to update. Omit to update the current task.")
7519
+ status: z9.enum(["InProgress", "ReviewPR", "ReviewDev", "Complete"]).describe("The new status for the task"),
7520
+ task_id: z9.string().optional().describe("Child task ID to update. Omit to update the current task.")
7409
7521
  },
7410
7522
  async ({ status, task_id }) => {
7411
7523
  try {
@@ -7436,18 +7548,18 @@ function buildCreatePullRequestTool(connection, config) {
7436
7548
  "create_pull_request",
7437
7549
  "Create a GitHub PR for this task. Auto-stages, commits (commitMessage or title default), pushes to origin, then opens the PR. Always use this instead of gh CLI or raw git.",
7438
7550
  {
7439
- title: z8.string().describe("The PR title"),
7440
- body: z8.string().describe("The PR description/body in markdown"),
7441
- branch: z8.string().optional().describe(
7551
+ title: z9.string().describe("The PR title"),
7552
+ body: z9.string().describe("The PR description/body in markdown"),
7553
+ branch: z9.string().optional().describe(
7442
7554
  "The head branch name for the PR. If the task doesn't have a branch set, this will be used. Defaults to the task's existing branch."
7443
7555
  ),
7444
- baseBranch: z8.string().optional().describe(
7556
+ baseBranch: z9.string().optional().describe(
7445
7557
  "The base branch to target for the PR (e.g. 'main', 'develop'). Defaults to the project's configured dev branch."
7446
7558
  ),
7447
- commitMessage: z8.string().optional().describe(
7559
+ commitMessage: z9.string().optional().describe(
7448
7560
  "Commit message for staging uncommitted changes. If not provided, a default message based on the PR title will be used."
7449
7561
  ),
7450
- skipVerify: z8.boolean().optional().describe(
7562
+ skipVerify: z9.boolean().optional().describe(
7451
7563
  "Controls the local pre-push quality gate (lint/typecheck/test). Defaults to true (--no-verify): the push skips the local gate because you should run gates yourself before opening the PR and CI re-runs them on the resulting PR. Running the full gate synchronously during the push would block the agent's event loop long enough to drop the Conveyor socket connection. Pass false to force the local pre-push hook to run."
7452
7564
  )
7453
7565
  },
@@ -7529,7 +7641,7 @@ function buildAddDependencyTool(connection) {
7529
7641
  "add_dependency",
7530
7642
  "Add a blocking dependency \u2014 this task cannot start until the named task is merged to dev. For post-task follow-ups use create_follow_up_task instead.",
7531
7643
  {
7532
- depends_on_slug_or_id: z8.string().describe("Slug or ID of the task this task depends on")
7644
+ depends_on_slug_or_id: z9.string().describe("Slug or ID of the task this task depends on")
7533
7645
  },
7534
7646
  async ({ depends_on_slug_or_id }) => {
7535
7647
  try {
@@ -7551,7 +7663,7 @@ function buildRemoveDependencyTool(connection) {
7551
7663
  "remove_dependency",
7552
7664
  "Remove a previously added dependency from this task. When to use: the dependency was added in error or is no longer relevant. Returns: confirmation string.",
7553
7665
  {
7554
- depends_on_slug_or_id: z8.string().describe("Slug or ID of the task to remove as dependency")
7666
+ depends_on_slug_or_id: z9.string().describe("Slug or ID of the task to remove as dependency")
7555
7667
  },
7556
7668
  async ({ depends_on_slug_or_id }) => {
7557
7669
  try {
@@ -7573,10 +7685,10 @@ function buildCreateFollowUpTaskTool(connection) {
7573
7685
  "create_follow_up_task",
7574
7686
  "Create a follow-up task that depends on the current task. Use for out-of-scope work or cleanup that should land after this task merges. For blockers use add_dependency.",
7575
7687
  {
7576
- title: z8.string().describe("Follow-up task title"),
7577
- description: z8.string().optional().describe("Brief description of the follow-up work"),
7578
- plan: z8.string().optional().describe("Implementation plan if known"),
7579
- story_point_value: z8.number().optional().describe("Story point estimate (1=Common, 2=Magic, 3=Rare, 5=Unique)")
7688
+ title: z9.string().describe("Follow-up task title"),
7689
+ description: z9.string().optional().describe("Brief description of the follow-up work"),
7690
+ plan: z9.string().optional().describe("Implementation plan if known"),
7691
+ story_point_value: z9.number().optional().describe("Story point estimate (1=Common, 2=Magic, 3=Rare, 5=Unique)")
7580
7692
  },
7581
7693
  async ({ title, description, plan, story_point_value }) => {
7582
7694
  try {
@@ -7603,11 +7715,11 @@ function buildCreateSuggestionTool(connection) {
7603
7715
  "create_suggestion",
7604
7716
  "Suggest a feature, improvement, rule, or idea for the project. Duplicates are deduped and your upvote is recorded. For actionable work on this task open a follow-up task.",
7605
7717
  {
7606
- title: z8.string().describe("Short title for the suggestion"),
7607
- description: z8.string().optional().describe(
7718
+ title: z9.string().describe("Short title for the suggestion"),
7719
+ description: z9.string().optional().describe(
7608
7720
  "1-2 sentence description of what should change and why. Keep concise and project-focused."
7609
7721
  ),
7610
- tag_names: z8.array(z8.string()).optional().describe("Tag names to categorize the suggestion")
7722
+ tag_names: z9.array(z9.string()).optional().describe("Tag names to categorize the suggestion")
7611
7723
  },
7612
7724
  async ({ title, description, tag_names }) => {
7613
7725
  try {
@@ -7636,8 +7748,8 @@ function buildVoteSuggestionTool(connection) {
7636
7748
  "vote_suggestion",
7637
7749
  "Vote +1 or -1 on a project suggestion. Use to express support or disagreement with a specific suggestion returned by get_suggestions.",
7638
7750
  {
7639
- suggestion_id: z8.string().describe("The suggestion ID to vote on"),
7640
- value: z8.number().refine((v) => v === 1 || v === -1, { message: "Value must be 1 or -1" }).describe("+1 to upvote, -1 to downvote")
7751
+ suggestion_id: z9.string().describe("The suggestion ID to vote on"),
7752
+ value: z9.number().refine((v) => v === 1 || v === -1, { message: "Value must be 1 or -1" }).describe("+1 to upvote, -1 to downvote")
7641
7753
  },
7642
7754
  async ({ suggestion_id, value }) => {
7643
7755
  try {
@@ -7670,7 +7782,7 @@ function buildMutationTools(connection, config) {
7670
7782
  // src/tools/attachment-tools.ts
7671
7783
  import { readFile as readFile3, stat as stat4 } from "fs/promises";
7672
7784
  import { basename, extname, isAbsolute, join as join6 } from "path";
7673
- import { z as z9 } from "zod";
7785
+ import { z as z10 } from "zod";
7674
7786
  var IMAGE_MIME_BY_EXT = {
7675
7787
  ".png": "image/png",
7676
7788
  ".jpg": "image/jpeg",
@@ -7683,8 +7795,8 @@ function buildUploadAttachmentTool(connection, config) {
7683
7795
  "upload_attachment",
7684
7796
  "Upload an image file (e.g. a Playwright screenshot) as a task attachment AND post it to the task chat in one step \u2014 no follow-up post_to_chat call needed. Supports png/jpg/gif/webp.",
7685
7797
  {
7686
- path: z9.string().describe("Path to the image file \u2014 absolute, or relative to the workspace root"),
7687
- title: z9.string().optional().describe("Short caption posted with the image (defaults to the file name)")
7798
+ path: z10.string().describe("Path to the image file \u2014 absolute, or relative to the workspace root"),
7799
+ title: z10.string().optional().describe("Short caption posted with the image (defaults to the file name)")
7688
7800
  },
7689
7801
  async ({ path: path4, title }) => {
7690
7802
  try {
@@ -7740,7 +7852,7 @@ function buildUploadAttachmentTool(connection, config) {
7740
7852
  }
7741
7853
 
7742
7854
  // src/tools/checklist-tools.ts
7743
- import { z as z10 } from "zod";
7855
+ import { z as z11 } from "zod";
7744
7856
  function buildListManualTestsTool(connection) {
7745
7857
  return defineTool(
7746
7858
  "list_manual_tests",
@@ -7792,8 +7904,8 @@ function buildQueryManualTestsTool(connection) {
7792
7904
  "query_manual_tests",
7793
7905
  "Query manual tests across many tasks in this project, grouped by task. Filter by card status (ReviewDev, ReviewLive, Complete, ...) and/or test status (open | approved | rejected). Use to answer 'show all OPEN manual tests in ReviewDev' or 'show all REJECTED manual tests with the failing reason'. With no filters it defaults to the needs-attention view: open+rejected tests on ReviewDev/ReviewLive cards.",
7794
7906
  {
7795
- cardStatuses: z10.array(z10.string()).optional().describe('Filter tasks by card status, e.g. ["ReviewDev", "ReviewLive"]'),
7796
- testStatuses: z10.array(z10.enum(["open", "approved", "rejected"])).optional().describe("Filter tests by status: open | approved | rejected")
7907
+ cardStatuses: z11.array(z11.string()).optional().describe('Filter tasks by card status, e.g. ["ReviewDev", "ReviewLive"]'),
7908
+ testStatuses: z11.array(z11.enum(["open", "approved", "rejected"])).optional().describe("Filter tests by status: open | approved | rejected")
7797
7909
  },
7798
7910
  async ({ cardStatuses, testStatuses }) => {
7799
7911
  try {
@@ -7817,7 +7929,7 @@ function buildSetManualTestsTool(connection) {
7817
7929
  "set_manual_tests",
7818
7930
  "Add manual test steps to the task checklist. Existing items with the same title are automatically skipped (deduplication). Use to record specific manual verification steps that reviewers should follow when testing this PR.",
7819
7931
  {
7820
- items: z10.array(z10.object({ title: z10.string().min(1).describe("A concise, actionable test step") })).min(1).describe("List of manual test steps to add")
7932
+ items: z11.array(z11.object({ title: z11.string().min(1).describe("A concise, actionable test step") })).min(1).describe("List of manual test steps to add")
7821
7933
  },
7822
7934
  async ({ items }) => {
7823
7935
  try {
@@ -7840,8 +7952,8 @@ function buildEditManualTestTool(connection) {
7840
7952
  "edit_manual_test",
7841
7953
  "Rename an existing manual test step. Identify the test by its current title (case-insensitive); pass the new title to replace it. Use to correct or refine a recorded manual verification step.",
7842
7954
  {
7843
- title: z10.string().min(1).describe("The current title of the manual test to edit"),
7844
- newTitle: z10.string().min(1).describe("The new title for the manual test")
7955
+ title: z11.string().min(1).describe("The current title of the manual test to edit"),
7956
+ newTitle: z11.string().min(1).describe("The new title for the manual test")
7845
7957
  },
7846
7958
  async ({ title, newTitle }) => {
7847
7959
  try {
@@ -7863,7 +7975,7 @@ function buildRemoveManualTestTool(connection) {
7863
7975
  "remove_manual_test",
7864
7976
  "Remove an existing manual test step from the task checklist. Identify the test by its title (case-insensitive). Use to delete a stale or incorrect manual verification step.",
7865
7977
  {
7866
- title: z10.string().min(1).describe("The title of the manual test to remove")
7978
+ title: z11.string().min(1).describe("The title of the manual test to remove")
7867
7979
  },
7868
7980
  async ({ title }) => {
7869
7981
  try {
@@ -7884,7 +7996,7 @@ function buildApproveManualTestTool(connection) {
7884
7996
  "approve_manual_test",
7885
7997
  "Sign off on (approve) a manual test step on behalf of your authenticated user. Identify the test by its title (case-insensitive). Use after you have verified the step passes.",
7886
7998
  {
7887
- title: z10.string().min(1).describe("The title of the manual test to approve")
7999
+ title: z11.string().min(1).describe("The title of the manual test to approve")
7888
8000
  },
7889
8001
  async ({ title }) => {
7890
8002
  try {
@@ -7905,8 +8017,8 @@ function buildRejectManualTestTool(connection) {
7905
8017
  "reject_manual_test",
7906
8018
  "Flag an issue with (reject) a manual test step on behalf of your authenticated user, recording the reason. Identify the test by its title (case-insensitive). Use when the step fails verification.",
7907
8019
  {
7908
- title: z10.string().min(1).describe("The title of the manual test to reject"),
7909
- reason: z10.string().min(1).max(2e3).describe("Why the test failed \u2014 what went wrong, shown to the team")
8020
+ title: z11.string().min(1).describe("The title of the manual test to reject"),
8021
+ reason: z11.string().min(1).max(2e3).describe("Why the test failed \u2014 what went wrong, shown to the team")
7910
8022
  },
7911
8023
  async ({ title, reason }) => {
7912
8024
  try {
@@ -7943,7 +8055,7 @@ function buildCommonTools(connection, config) {
7943
8055
  }
7944
8056
 
7945
8057
  // src/tools/pm-tools.ts
7946
- import { z as z11 } from "zod";
8058
+ import { z as z12 } from "zod";
7947
8059
  var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
7948
8060
  var FOLLOW_PARENT_STATUS_DESCRIPTION = "Child mirrors the parent task's status automatically \u2014 for subtasks that ship on the parent's branch/PR with no build or PR of their own. Manual status writes on a follower stick only until the parent's next transition.";
7949
8061
  var DEPENDS_ON_DESCRIPTION = "Sibling subtask ids or slugs this subtask blocks on (it won't start until they merge to dev). Set explicit dependency metadata here instead of describing order in the plan text \u2014 the pack runner schedules children off these edges. Omit / leave empty for independent children so they run in parallel.";
@@ -7952,8 +8064,8 @@ function buildUpdateTaskTool(connection) {
7952
8064
  "update_task_plan",
7953
8065
  "Save the plan and/or description to the current task. In auto/building mode, save the plan BEFORE writing code and keep it current as the approach evolves \u2014 post it, then build; never pause the build waiting for approval. For children use update_subtask; for title/tags/PR use update_task_properties.",
7954
8066
  {
7955
- plan: z11.string().optional().describe("The task plan in markdown"),
7956
- description: z11.string().optional().describe("Updated task description")
8067
+ plan: z12.string().optional().describe("The task plan in markdown"),
8068
+ description: z12.string().optional().describe("Updated task description")
7957
8069
  },
7958
8070
  async ({ plan, description }) => {
7959
8071
  try {
@@ -7974,13 +8086,13 @@ function buildCreateSubtaskTool(connection) {
7974
8086
  "create_subtask",
7975
8087
  "Create a subtask under the current parent task. Use when breaking a complex parent into smaller pieces during planning. For post-task follow-ups use create_follow_up_task.",
7976
8088
  {
7977
- title: z11.string().describe("Subtask title"),
7978
- description: z11.string().optional().describe("Brief description"),
7979
- plan: z11.string().optional().describe("Implementation plan in markdown"),
7980
- ordinal: z11.number().optional().describe("Step/order number (0-based)"),
7981
- storyPointValue: z11.number().optional().describe(SP_DESCRIPTION),
7982
- followParentStatus: z11.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
7983
- dependsOn: z11.array(z11.string()).optional().describe(DEPENDS_ON_DESCRIPTION)
8089
+ title: z12.string().describe("Subtask title"),
8090
+ description: z12.string().optional().describe("Brief description"),
8091
+ plan: z12.string().optional().describe("Implementation plan in markdown"),
8092
+ ordinal: z12.number().optional().describe("Step/order number (0-based)"),
8093
+ storyPointValue: z12.number().optional().describe(SP_DESCRIPTION),
8094
+ followParentStatus: z12.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
8095
+ dependsOn: z12.array(z12.string()).optional().describe(DEPENDS_ON_DESCRIPTION)
7984
8096
  },
7985
8097
  async ({
7986
8098
  title,
@@ -8016,20 +8128,20 @@ function buildUpdateSubtaskTool(connection) {
8016
8128
  "update_subtask",
8017
8129
  "Update an existing subtask's fields (title, description, plan, ordinal, storyPointValue, dependsOn) \u2014 and the sanctioned path to make a child buildable: promote it to status Open, assign its agent (agentIdOrName), and set story points. Setting story points does NOT auto-promote; set status explicitly. For the current task use update_task_plan.",
8018
8130
  {
8019
- subtaskId: z11.string().describe("The subtask ID to update"),
8020
- title: z11.string().optional(),
8021
- description: z11.string().optional(),
8022
- plan: z11.string().optional(),
8023
- status: z11.enum(["Planning", "Open"]).optional().describe(
8131
+ subtaskId: z12.string().describe("The subtask ID to update"),
8132
+ title: z12.string().optional(),
8133
+ description: z12.string().optional(),
8134
+ plan: z12.string().optional(),
8135
+ status: z12.enum(["Planning", "Open"]).optional().describe(
8024
8136
  'Move the child between "Planning" and "Open". "Open" marks it ready to execute \u2014 required before start_child_cloud_build. Execution statuses transition automatically.'
8025
8137
  ),
8026
- agentIdOrName: z11.string().optional().describe(
8138
+ agentIdOrName: z12.string().optional().describe(
8027
8139
  "Assign a project agent to the child (agent id or exact name from the Project Agents list). Required before start_child_cloud_build."
8028
8140
  ),
8029
- ordinal: z11.number().optional(),
8030
- storyPointValue: z11.number().optional().describe(SP_DESCRIPTION),
8031
- followParentStatus: z11.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
8032
- dependsOn: z11.array(z11.string()).optional().describe(
8141
+ ordinal: z12.number().optional(),
8142
+ storyPointValue: z12.number().optional().describe(SP_DESCRIPTION),
8143
+ followParentStatus: z12.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
8144
+ dependsOn: z12.array(z12.string()).optional().describe(
8033
8145
  `${DEPENDS_ON_DESCRIPTION} Replaces the full dependency set \u2014 pass [] to clear all, omit to leave unchanged.`
8034
8146
  )
8035
8147
  },
@@ -8068,7 +8180,7 @@ function buildDeleteSubtaskTool(connection) {
8068
8180
  return defineTool(
8069
8181
  "delete_subtask",
8070
8182
  "Delete a subtask by id. When to use: a subtask was created in error or is no longer needed. Returns: confirmation string.",
8071
- { subtaskId: z11.string().describe("The subtask ID to delete") },
8183
+ { subtaskId: z12.string().describe("The subtask ID to delete") },
8072
8184
  async ({ subtaskId }) => {
8073
8185
  try {
8074
8186
  await connection.call("deleteSubtask", {
@@ -8087,7 +8199,7 @@ function buildListSubtasksTool(connection) {
8087
8199
  "list_subtasks",
8088
8200
  "List all subtasks under the current parent task. Default compact view returns per child: status, agent, story points, PR number/state, dependencies, and holdsBuildSlot \u2014 plus packSlots (in-flight environments vs the PACK_CHILD_LIMIT cap, and which children hold the slots). Use to coordinate child work; pass verbose:true only when you need full description/plan text (large). For non-child tasks use get_task.",
8089
8201
  {
8090
- verbose: z11.boolean().optional().describe(
8202
+ verbose: z12.boolean().optional().describe(
8091
8203
  "Return full task rows including description and plan text (large \u2014 can exceed tool result limits on big packs). Default: compact orchestration view."
8092
8204
  )
8093
8205
  },
@@ -8111,7 +8223,7 @@ function buildPackTools(connection) {
8111
8223
  "start_child_cloud_build",
8112
8224
  "Start a cloud build (codespace) for a child task. Preconditions: child status is `Open`, story points set, and an agent assigned \u2014 satisfy all three with update_subtask (status/agentIdOrName/storyPointValue) first; none happen automatically. A PACK_CHILD_LIMIT error is backpressure, not failure: check list_subtasks packSlots for which children hold the in-flight slots, merge/stop one, then retry.",
8113
8225
  {
8114
- childTaskId: z11.string().describe("The child task ID to start a cloud build for")
8226
+ childTaskId: z12.string().describe("The child task ID to start a cloud build for")
8115
8227
  },
8116
8228
  async ({ childTaskId }) => {
8117
8229
  try {
@@ -8131,7 +8243,7 @@ function buildPackTools(connection) {
8131
8243
  "stop_child_build",
8132
8244
  "Send a graceful stop signal to a running child build's agent. Not a force-kill \u2014 the agent may take a moment to wind down. Stopping a child eventually frees its PACK_CHILD_LIMIT build slot (see list_subtasks packSlots).",
8133
8245
  {
8134
- childTaskId: z11.string().describe("The child task ID whose build should be stopped")
8246
+ childTaskId: z12.string().describe("The child task ID whose build should be stopped")
8135
8247
  },
8136
8248
  async ({ childTaskId }) => {
8137
8249
  try {
@@ -8151,7 +8263,7 @@ function buildPackTools(connection) {
8151
8263
  "approve_and_merge_pr",
8152
8264
  "Approve and merge a child task's PR. Preconditions: child in ReviewPR. Returns { merged }: true = merged (status\u2192ReviewDev); false = automerge queued, wait for ReviewDev.",
8153
8265
  {
8154
- childTaskId: z11.string().describe("The child task ID whose PR should be approved and merged")
8266
+ childTaskId: z12.string().describe("The child task ID whose PR should be approved and merged")
8155
8267
  },
8156
8268
  async ({ childTaskId }) => {
8157
8269
  try {
@@ -8189,7 +8301,7 @@ function buildPmTools(connection, options) {
8189
8301
  }
8190
8302
 
8191
8303
  // src/tools/discovery-tools.ts
8192
- import { z as z12 } from "zod";
8304
+ import { z as z13 } from "zod";
8193
8305
  var SP_DESCRIPTION2 = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique). The key is 'storyPointValue' \u2014 not 'storyPoints'.";
8194
8306
  var VALID_PROPERTY_KEYS = "title, storyPointValue, tagNames, githubPRUrl, githubBranch";
8195
8307
  function buildDiscoveryTools(connection) {
@@ -8198,11 +8310,11 @@ function buildDiscoveryTools(connection) {
8198
8310
  "update_task_properties",
8199
8311
  "Set one or more task properties in a single call. Valid keys: title, storyPointValue, tagNames, githubPRUrl, githubBranch. All are optional \u2014 include only the ones you want to update (at least one). Unknown keys are rejected.",
8200
8312
  {
8201
- title: z12.string().optional().describe("The new task title"),
8202
- storyPointValue: z12.number().optional().describe(SP_DESCRIPTION2),
8203
- tagNames: z12.array(z12.string()).optional().describe("Array of tag names to assign"),
8204
- githubPRUrl: z12.string().url().optional().describe("GitHub pull request URL to link to this task"),
8205
- githubBranch: z12.string().optional().describe("Set the GitHub branch name for this task (e.g. 'conveyor/my-feature-abc123')")
8313
+ title: z13.string().optional().describe("The new task title"),
8314
+ storyPointValue: z13.number().optional().describe(SP_DESCRIPTION2),
8315
+ tagNames: z13.array(z13.string()).optional().describe("Array of tag names to assign"),
8316
+ githubPRUrl: z13.string().url().optional().describe("GitHub pull request URL to link to this task"),
8317
+ githubBranch: z13.string().optional().describe("Set the GitHub branch name for this task (e.g. 'conveyor/my-feature-abc123')")
8206
8318
  },
8207
8319
  async ({ title, storyPointValue, tagNames, githubPRUrl, githubBranch }) => {
8208
8320
  try {
@@ -8243,20 +8355,25 @@ function buildDiscoveryTools(connection) {
8243
8355
  }
8244
8356
 
8245
8357
  // src/tools/code-review-tools.ts
8246
- import { z as z13 } from "zod";
8358
+ import { z as z14 } from "zod";
8247
8359
  async function endReviewSession(connection, reason) {
8248
8360
  await connection.call("endReviewSession", {
8249
8361
  sessionId: connection.sessionId,
8250
8362
  reason
8251
8363
  });
8252
8364
  }
8365
+ function riskFromIssues(issues) {
8366
+ if (issues.some((i) => i.severity === "critical")) return "critical";
8367
+ if (issues.some((i) => i.severity === "major")) return "high";
8368
+ return "medium";
8369
+ }
8253
8370
  function buildCodeReviewTools(connection) {
8254
8371
  return [
8255
8372
  defineTool(
8256
8373
  "approve_code_review",
8257
8374
  "Approve the code review and exit. Use when the diff passes all review criteria. Takes only a summary \u2014 for changes, use request_code_changes with a structured issues[] list.",
8258
8375
  {
8259
- summary: z13.string().describe("Brief summary of what was reviewed and why it looks good")
8376
+ summary: z14.string().describe("Brief summary of what was reviewed and why it looks good")
8260
8377
  },
8261
8378
  async ({ summary }) => {
8262
8379
  const content = `**Code Review: Approved** :white_check_mark:
@@ -8265,7 +8382,8 @@ ${summary}`;
8265
8382
  await connection.call("submitCodeReviewResult", {
8266
8383
  sessionId: connection.sessionId,
8267
8384
  approved: true,
8268
- content
8385
+ content,
8386
+ risk: "low"
8269
8387
  });
8270
8388
  connection.sendEvent({
8271
8389
  type: "code_review_complete",
@@ -8280,15 +8398,15 @@ ${summary}`;
8280
8398
  "request_code_changes",
8281
8399
  "Request changes during code review and exit. Use when substantive issues must be fixed before merge. Each issue: { file, line?, severity: critical|major|minor, description }.",
8282
8400
  {
8283
- issues: z13.array(
8284
- z13.object({
8285
- file: z13.string().describe("File path where the issue was found"),
8286
- line: z13.number().optional().describe("Line number (if applicable)"),
8287
- severity: z13.enum(["critical", "major", "minor"]).describe("Issue severity"),
8288
- description: z13.string().describe("What is wrong and how to fix it")
8401
+ issues: z14.array(
8402
+ z14.object({
8403
+ file: z14.string().describe("File path where the issue was found"),
8404
+ line: z14.number().optional().describe("Line number (if applicable)"),
8405
+ severity: z14.enum(["critical", "major", "minor"]).describe("Issue severity"),
8406
+ description: z14.string().describe("What is wrong and how to fix it")
8289
8407
  })
8290
8408
  ).describe("List of issues found during review"),
8291
- summary: z13.string().describe("Brief overall summary of the review findings")
8409
+ summary: z14.string().describe("Brief overall summary of the review findings")
8292
8410
  },
8293
8411
  async ({ issues, summary }) => {
8294
8412
  const issueLines = issues.map((issue) => {
@@ -8303,7 +8421,8 @@ ${issueLines}`;
8303
8421
  await connection.call("submitCodeReviewResult", {
8304
8422
  sessionId: connection.sessionId,
8305
8423
  approved: false,
8306
- content
8424
+ content,
8425
+ risk: riskFromIssues(issues)
8307
8426
  });
8308
8427
  connection.sendEvent({
8309
8428
  type: "code_review_complete",
@@ -10153,6 +10272,86 @@ function readAgentVersion() {
10153
10272
  // src/execution/usage-sampler.ts
10154
10273
  import { existsSync as existsSync3 } from "fs";
10155
10274
 
10275
+ // src/usage/reset-parse.ts
10276
+ var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
10277
+ function tzOffsetMs(utcMs, tz) {
10278
+ const dtf = new Intl.DateTimeFormat("en-US", {
10279
+ timeZone: tz,
10280
+ hour12: false,
10281
+ year: "numeric",
10282
+ month: "2-digit",
10283
+ day: "2-digit",
10284
+ hour: "2-digit",
10285
+ minute: "2-digit",
10286
+ second: "2-digit"
10287
+ });
10288
+ const map = {};
10289
+ for (const part of dtf.formatToParts(new Date(utcMs))) {
10290
+ if (part.type !== "literal") map[part.type] = part.value;
10291
+ }
10292
+ const hour = map.hour === "24" ? 0 : Number(map.hour);
10293
+ const asUtc = Date.UTC(
10294
+ Number(map.year),
10295
+ Number(map.month) - 1,
10296
+ Number(map.day),
10297
+ hour,
10298
+ Number(map.minute),
10299
+ Number(map.second)
10300
+ );
10301
+ return asUtc - utcMs;
10302
+ }
10303
+ function zonedWallClockToUtc(y, mo, d, h, mi, tz) {
10304
+ if (tz === "UTC" || tz === "Etc/UTC") return Date.UTC(y, mo, d, h, mi);
10305
+ const naiveUtc = Date.UTC(y, mo, d, h, mi);
10306
+ const firstGuess = naiveUtc - tzOffsetMs(naiveUtc, tz);
10307
+ return naiveUtc - tzOffsetMs(firstGuess, tz);
10308
+ }
10309
+ function parseResetInstant(rowText, now) {
10310
+ const m = /resets\s+(?:([a-z]{3})\s+(\d{1,2})(?:,|\s+at)?\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)\s*\(([^)]+)\)/i.exec(
10311
+ rowText
10312
+ );
10313
+ if (!m) return null;
10314
+ const [, monStr, dayStr, hourStr, minStr, meridiem, tzRaw] = m;
10315
+ const tz = tzRaw.trim();
10316
+ let hour = Number(hourStr) % 12;
10317
+ if (/pm/i.test(meridiem)) hour += 12;
10318
+ const minute = minStr ? Number(minStr) : 0;
10319
+ const nowDate = new Date(now);
10320
+ try {
10321
+ if (monStr && dayStr) {
10322
+ const month = MONTHS.indexOf(monStr.toLowerCase());
10323
+ if (month < 0) return null;
10324
+ const day = Number(dayStr);
10325
+ let utc2 = zonedWallClockToUtc(nowDate.getUTCFullYear(), month, day, hour, minute, tz);
10326
+ if (utc2 < now - 24 * 60 * 60 * 1e3) {
10327
+ utc2 = zonedWallClockToUtc(nowDate.getUTCFullYear() + 1, month, day, hour, minute, tz);
10328
+ }
10329
+ return new Date(utc2).toISOString();
10330
+ }
10331
+ let utc = zonedWallClockToUtc(
10332
+ nowDate.getUTCFullYear(),
10333
+ nowDate.getUTCMonth(),
10334
+ nowDate.getUTCDate(),
10335
+ hour,
10336
+ minute,
10337
+ tz
10338
+ );
10339
+ if (utc <= now) {
10340
+ utc = zonedWallClockToUtc(
10341
+ nowDate.getUTCFullYear(),
10342
+ nowDate.getUTCMonth(),
10343
+ nowDate.getUTCDate() + 1,
10344
+ hour,
10345
+ minute,
10346
+ tz
10347
+ );
10348
+ }
10349
+ return new Date(utc).toISOString();
10350
+ } catch {
10351
+ return null;
10352
+ }
10353
+ }
10354
+
10156
10355
  // src/usage/parse-usage.ts
10157
10356
  var ESC = "\\u001b";
10158
10357
  var ANSI_CSI2 = new RegExp(`${ESC}\\[[0-9;?]*[ -/]*[@-~]`, "g");
@@ -10161,22 +10360,27 @@ var BAR_GLYPHS = /[─-▟]/g;
10161
10360
  function normalizeUsageText(stdout) {
10162
10361
  return stdout.replace(ANSI_CSI2, "").replace(ANSI_OSC, "").replace(BAR_GLYPHS, " ").replace(/\r/g, "");
10163
10362
  }
10164
- function parseUsageGauges(stdout) {
10363
+ function parseUsageGauges(stdout, now = Date.now()) {
10165
10364
  const text = normalizeUsageText(stdout);
10166
10365
  const rows = [
10167
10366
  ...text.matchAll(
10168
- /Current (session|week)\s*(\([^)\n]*\))?[^%\n]*?(\d+(?:\.\d+)?)\s*%(?:\s*used)?/gi
10367
+ /Current (session|week)\s*(\([^)\n]*\))?[^%\n]*?(\d+(?:\.\d+)?)\s*%(?:\s*used)?([^\n]*?)(?=Current\s+(?:session|week)\b|\n|$)/gi
10169
10368
  )
10170
10369
  ];
10171
10370
  const gauges = rows.map((m) => ({
10172
10371
  label: `Current ${m[1].toLowerCase()}${m[2] ? ` ${m[2]}` : ""}`,
10173
- utilization: Number(m[3]) / 100
10372
+ utilization: Number(m[3]) / 100,
10373
+ resetsAt: parseResetInstant(m[4] ?? "", now)
10174
10374
  }));
10175
10375
  const session = gauges.find((g) => g.label.startsWith("Current session"));
10176
10376
  const weekly = gauges.filter((g) => g.label.startsWith("Current week"));
10377
+ const weeklyResets = weekly.map((g) => g.resetsAt).filter((r) => r !== null);
10177
10378
  return {
10178
10379
  sessionUsage: session ? session.utilization : null,
10179
10380
  weeklyUsage: weekly.length ? Math.max(...weekly.map((g) => g.utilization)) : null,
10381
+ sessionResetsAt: session?.resetsAt ?? null,
10382
+ // Soonest weekly reset (all weekly rows share one instant in practice).
10383
+ weeklyResetsAt: weeklyResets.length ? new Date(Math.min(...weeklyResets.map((r) => new Date(r).getTime()))).toISOString() : null,
10180
10384
  gauges
10181
10385
  };
10182
10386
  }
@@ -10311,13 +10515,14 @@ async function sampleKeyUsage(token, probe = () => runUsageProbe(), hasSubscript
10311
10515
  return [];
10312
10516
  }
10313
10517
  const stdout = await probe();
10314
- const { sessionUsage, weeklyUsage, gauges } = parseUsageGauges(stdout);
10518
+ const { sessionUsage, weeklyUsage, sessionResetsAt, weeklyResetsAt, gauges } = parseUsageGauges(stdout);
10315
10519
  const samples = [];
10316
10520
  if (sessionUsage !== null) {
10317
10521
  samples.push({
10318
10522
  rateLimitType: "five_hour",
10319
10523
  utilization: sessionUsage,
10320
10524
  status: "allowed",
10525
+ resetsAt: sessionResetsAt,
10321
10526
  gauges
10322
10527
  });
10323
10528
  }
@@ -10326,6 +10531,7 @@ async function sampleKeyUsage(token, probe = () => runUsageProbe(), hasSubscript
10326
10531
  rateLimitType: "seven_day",
10327
10532
  utilization: weeklyUsage,
10328
10533
  status: "allowed",
10534
+ resetsAt: weeklyResetsAt,
10329
10535
  gauges
10330
10536
  });
10331
10537
  }
@@ -11294,6 +11500,7 @@ var SessionRunner = class _SessionRunner {
11294
11500
  rateLimitType: sample.rateLimitType,
11295
11501
  utilization: sample.utilization,
11296
11502
  status: sample.status,
11503
+ resetsAt: sample.resetsAt ?? void 0,
11297
11504
  gauges: sample.gauges
11298
11505
  });
11299
11506
  }
@@ -11834,4 +12041,4 @@ export {
11834
12041
  runStartCommand,
11835
12042
  unshallowRepo
11836
12043
  };
11837
- //# sourceMappingURL=chunk-K23F674K.js.map
12044
+ //# sourceMappingURL=chunk-CHJ7JPAQ.js.map